libre-webui 0.37.2 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (432) hide show
  1. package/README.md +29 -65
  2. package/backend/dist/db.js +1 -1
  3. package/backend/dist/index.d.ts.map +1 -1
  4. package/backend/dist/index.js +13 -36
  5. package/backend/dist/index.js.map +1 -1
  6. package/backend/dist/main.js +0 -12
  7. package/backend/dist/main.js.map +1 -1
  8. package/backend/dist/middleware/cors.d.ts.map +1 -1
  9. package/backend/dist/middleware/cors.js +5 -0
  10. package/backend/dist/middleware/cors.js.map +1 -1
  11. package/backend/dist/persistence/postgresExtensionRepositories.d.ts.map +1 -1
  12. package/backend/dist/persistence/postgresExtensionRepositories.js +2 -4
  13. package/backend/dist/persistence/postgresExtensionRepositories.js.map +1 -1
  14. package/backend/dist/persistence/postgresMigrationRegistry.d.ts.map +1 -1
  15. package/backend/dist/persistence/postgresMigrationRegistry.js +2 -0
  16. package/backend/dist/persistence/postgresMigrationRegistry.js.map +1 -1
  17. package/backend/dist/persistence/postgresWorkRunThinkMigration.d.ts +9 -0
  18. package/backend/dist/persistence/postgresWorkRunThinkMigration.d.ts.map +1 -0
  19. package/backend/dist/persistence/postgresWorkRunThinkMigration.js +39 -0
  20. package/backend/dist/persistence/postgresWorkRunThinkMigration.js.map +1 -0
  21. package/backend/dist/persistence/sqliteExtensionRepositories.d.ts.map +1 -1
  22. package/backend/dist/persistence/sqliteExtensionRepositories.js +2 -4
  23. package/backend/dist/persistence/sqliteExtensionRepositories.js.map +1 -1
  24. package/backend/dist/persistence/sqliteMigrations.d.ts.map +1 -1
  25. package/backend/dist/persistence/sqliteMigrations.js +20 -0
  26. package/backend/dist/persistence/sqliteMigrations.js.map +1 -1
  27. package/backend/dist/persistence/sqliteToPostgresMigration.d.ts.map +1 -1
  28. package/backend/dist/persistence/sqliteToPostgresMigration.js +1 -0
  29. package/backend/dist/persistence/sqliteToPostgresMigration.js.map +1 -1
  30. package/backend/dist/platform/workPersistence/postgresWorkPersistence.d.ts.map +1 -1
  31. package/backend/dist/platform/workPersistence/postgresWorkPersistence.js +3 -2
  32. package/backend/dist/platform/workPersistence/postgresWorkPersistence.js.map +1 -1
  33. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.d.ts.map +1 -1
  34. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js +3 -3
  35. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js.map +1 -1
  36. package/backend/dist/platform/workPersistence/types.d.ts +5 -0
  37. package/backend/dist/platform/workPersistence/types.d.ts.map +1 -1
  38. package/backend/dist/platform/workPersistence/types.js.map +1 -1
  39. package/backend/dist/routes/agentCli.d.ts.map +1 -1
  40. package/backend/dist/routes/agentCli.js +8 -3
  41. package/backend/dist/routes/agentCli.js.map +1 -1
  42. package/backend/dist/routes/{cordis.d.ts → strands.d.ts} +1 -1
  43. package/backend/dist/routes/strands.d.ts.map +1 -0
  44. package/backend/dist/routes/strands.js +300 -0
  45. package/backend/dist/routes/strands.js.map +1 -0
  46. package/backend/dist/routes/work.d.ts.map +1 -1
  47. package/backend/dist/routes/work.js +26 -23
  48. package/backend/dist/routes/work.js.map +1 -1
  49. package/backend/dist/services/agentAccessService.d.ts +0 -5
  50. package/backend/dist/services/agentAccessService.d.ts.map +1 -1
  51. package/backend/dist/services/agentAccessService.js +7 -35
  52. package/backend/dist/services/agentAccessService.js.map +1 -1
  53. package/backend/dist/services/agentCliService.d.ts +16 -23
  54. package/backend/dist/services/agentCliService.d.ts.map +1 -1
  55. package/backend/dist/services/agentCliService.js +85 -112
  56. package/backend/dist/services/agentCliService.js.map +1 -1
  57. package/backend/dist/services/authService.d.ts +3 -3
  58. package/backend/dist/services/authService.d.ts.map +1 -1
  59. package/backend/dist/services/authService.js +3 -4
  60. package/backend/dist/services/authService.js.map +1 -1
  61. package/backend/dist/services/authorizationService.d.ts +1 -1
  62. package/backend/dist/services/authorizationService.d.ts.map +1 -1
  63. package/backend/dist/services/authorizationService.js +17 -8
  64. package/backend/dist/services/authorizationService.js.map +1 -1
  65. package/backend/dist/services/followUpService.d.ts +4 -1
  66. package/backend/dist/services/followUpService.d.ts.map +1 -1
  67. package/backend/dist/services/followUpService.js +23 -2
  68. package/backend/dist/services/followUpService.js.map +1 -1
  69. package/backend/dist/services/pluginService.d.ts.map +1 -1
  70. package/backend/dist/services/pluginService.js +10 -6
  71. package/backend/dist/services/pluginService.js.map +1 -1
  72. package/backend/dist/services/pluginUsageService.d.ts +0 -34
  73. package/backend/dist/services/pluginUsageService.d.ts.map +1 -1
  74. package/backend/dist/services/pluginUsageService.js +0 -62
  75. package/backend/dist/services/pluginUsageService.js.map +1 -1
  76. package/backend/dist/services/strandsAccessService.d.ts +26 -0
  77. package/backend/dist/services/strandsAccessService.d.ts.map +1 -0
  78. package/backend/dist/services/strandsAccessService.js +95 -0
  79. package/backend/dist/services/strandsAccessService.js.map +1 -0
  80. package/backend/dist/services/thinkingSummaryService.d.ts +2 -3
  81. package/backend/dist/services/thinkingSummaryService.d.ts.map +1 -1
  82. package/backend/dist/services/thinkingSummaryService.js +13 -27
  83. package/backend/dist/services/thinkingSummaryService.js.map +1 -1
  84. package/backend/dist/services/titleGenerationService.d.ts +7 -18
  85. package/backend/dist/services/titleGenerationService.d.ts.map +1 -1
  86. package/backend/dist/services/titleGenerationService.js +15 -36
  87. package/backend/dist/services/titleGenerationService.js.map +1 -1
  88. package/backend/dist/services/workAgentService.d.ts +1 -1
  89. package/backend/dist/services/workAgentService.d.ts.map +1 -1
  90. package/backend/dist/services/workAgentService.js +17 -60
  91. package/backend/dist/services/workAgentService.js.map +1 -1
  92. package/backend/dist/services/workModelProviderService.d.ts +1 -4
  93. package/backend/dist/services/workModelProviderService.d.ts.map +1 -1
  94. package/backend/dist/services/workModelProviderService.js +60 -50
  95. package/backend/dist/services/workModelProviderService.js.map +1 -1
  96. package/backend/dist/services/workTaskService.d.ts +3 -2
  97. package/backend/dist/services/workTaskService.d.ts.map +1 -1
  98. package/backend/dist/services/workTaskService.js +11 -7
  99. package/backend/dist/services/workTaskService.js.map +1 -1
  100. package/backend/dist/strands/catalog.d.ts +57 -0
  101. package/backend/dist/strands/catalog.d.ts.map +1 -0
  102. package/backend/dist/strands/catalog.js +241 -0
  103. package/backend/dist/strands/catalog.js.map +1 -0
  104. package/backend/dist/strands/engine.d.ts +131 -0
  105. package/backend/dist/strands/engine.d.ts.map +1 -0
  106. package/backend/dist/strands/engine.js +477 -0
  107. package/backend/dist/strands/engine.js.map +1 -0
  108. package/backend/dist/strands/harness.d.ts +14 -0
  109. package/backend/dist/strands/harness.d.ts.map +1 -0
  110. package/backend/dist/strands/harness.js +41 -0
  111. package/backend/dist/strands/harness.js.map +1 -0
  112. package/backend/dist/strands/model.d.ts +24 -0
  113. package/backend/dist/strands/model.d.ts.map +1 -0
  114. package/backend/dist/strands/model.js +381 -0
  115. package/backend/dist/strands/model.js.map +1 -0
  116. package/backend/dist/strands/runtime.d.ts +4 -0
  117. package/backend/dist/strands/runtime.d.ts.map +1 -0
  118. package/backend/dist/{cordis/work-model.js → strands/runtime.js} +16 -12
  119. package/backend/dist/strands/runtime.js.map +1 -0
  120. package/backend/dist/strands/sandbox.d.ts +24 -0
  121. package/backend/dist/strands/sandbox.d.ts.map +1 -0
  122. package/backend/dist/strands/sandbox.js +156 -0
  123. package/backend/dist/strands/sandbox.js.map +1 -0
  124. package/backend/dist/strands/work-driver.d.ts +11 -0
  125. package/backend/dist/strands/work-driver.d.ts.map +1 -0
  126. package/backend/dist/strands/work-driver.js +443 -0
  127. package/backend/dist/strands/work-driver.js.map +1 -0
  128. package/backend/dist/strands/work-model.d.ts +7 -0
  129. package/backend/dist/strands/work-model.d.ts.map +1 -0
  130. package/backend/dist/strands/work-model.js +42 -0
  131. package/backend/dist/strands/work-model.js.map +1 -0
  132. package/backend/dist/types/work.d.ts +7 -11
  133. package/backend/dist/types/work.d.ts.map +1 -1
  134. package/backend/dist/types/work.js.map +1 -1
  135. package/backend/dist/utils/bedrockMantle.d.ts +46 -0
  136. package/backend/dist/utils/bedrockMantle.d.ts.map +1 -0
  137. package/backend/dist/utils/bedrockMantle.js +206 -0
  138. package/backend/dist/utils/bedrockMantle.js.map +1 -0
  139. package/backend/dist/utils/corsOriginPolicy.d.ts +10 -0
  140. package/backend/dist/utils/corsOriginPolicy.d.ts.map +1 -0
  141. package/backend/dist/utils/corsOriginPolicy.js +70 -0
  142. package/backend/dist/utils/corsOriginPolicy.js.map +1 -0
  143. package/backend/dist/utils/pluginChatAdapter.d.ts +36 -0
  144. package/backend/dist/utils/pluginChatAdapter.d.ts.map +1 -1
  145. package/backend/dist/utils/pluginChatAdapter.js +122 -47
  146. package/backend/dist/utils/pluginChatAdapter.js.map +1 -1
  147. package/backend/dist/utils/pluginDefinitionTrust.d.ts.map +1 -1
  148. package/backend/dist/utils/pluginDefinitionTrust.js +3 -2
  149. package/backend/dist/utils/pluginDefinitionTrust.js.map +1 -1
  150. package/backend/dist/utils/pluginValidation.d.ts +1 -1
  151. package/backend/dist/utils/pluginValidation.d.ts.map +1 -1
  152. package/backend/dist/utils/pluginValidation.js +11 -0
  153. package/backend/dist/utils/pluginValidation.js.map +1 -1
  154. package/backend/package.json +6 -36
  155. package/frontend/dist/artifact-runtime/.build-fingerprint +1 -1
  156. package/frontend/dist/artifact-runtime/babel.js +170 -170
  157. package/frontend/dist/artifact-runtime/framer-motion.js +3 -3
  158. package/frontend/dist/artifact-runtime/lucide-react.js +1 -1
  159. package/frontend/dist/artifact-runtime/mathjs.js +1 -1
  160. package/frontend/dist/artifact-runtime/mermaid.js +1 -1
  161. package/frontend/dist/artifact-runtime/plotly.js +1 -1
  162. package/frontend/dist/artifact-runtime/react.js +3 -3
  163. package/frontend/dist/assets/index-D99DS5c6.js +57 -0
  164. package/frontend/dist/assets/index-Dz1JufgZ.css +1 -0
  165. package/frontend/dist/assets/{markdown-math-D1Bj3pDB.css → markdown-math-DzFXvcrH.css} +1 -1
  166. package/frontend/dist/index.html +34 -34
  167. package/frontend/dist/js/{ArtifactContainer-D4v4l15L.js → ArtifactContainer-Cn7X9HGm.js} +1 -1
  168. package/frontend/dist/js/{ArtifactDemoPage-B2uaVpsi.js → ArtifactDemoPage-Ddpy2O_v.js} +1 -1
  169. package/frontend/dist/js/{ArtifactSandboxFrame-DlWJHI-r.js → ArtifactSandboxFrame-CdsAqv8H.js} +1 -1
  170. package/frontend/dist/js/{ArtifactSlideOutPanel-laZ98QKB.js → ArtifactSlideOutPanel-cVd9X80o.js} +1 -1
  171. package/frontend/dist/js/AutomationModal-B4UaWjkk.js +1 -0
  172. package/frontend/dist/js/AutomationsPage-huCrvLUp.js +1 -0
  173. package/frontend/dist/js/{AvatarUpload-KaBaTKoG.js → AvatarUpload-CG-w6Mpt.js} +1 -1
  174. package/frontend/dist/js/{Button-CGMYia4g.js → Button-j68Q8KVh.js} +1 -1
  175. package/frontend/dist/js/{CalendarPage-Dc7r-86c.js → CalendarPage-CZXT1w99.js} +1 -1
  176. package/frontend/dist/js/ChannelsPage-DbtdHnSL.js +1 -0
  177. package/frontend/dist/js/ChatPage-BZE65kiq.js +14 -0
  178. package/frontend/dist/js/ConnectModels-DD4bLgdq.js +1 -0
  179. package/frontend/dist/js/{EvaluationsPage-BB7sPhIR.js → EvaluationsPage-Dq53LaXd.js} +2 -2
  180. package/frontend/dist/js/{FirstTimeSetup-elqSi9JH.js → FirstTimeSetup-BoJIfuQT.js} +1 -1
  181. package/frontend/dist/js/GalleryPage-DKwqeB2A.js +1 -0
  182. package/frontend/dist/js/HomePage-C8bCJfls.js +1 -0
  183. package/frontend/dist/js/LanguageSwitcher-B_YyU5JG.js +1 -0
  184. package/frontend/dist/js/{Logo-HZvdAk2c.js → Logo-DnfVtjgj.js} +1 -1
  185. package/frontend/dist/js/{LogoMark-GJnfMXsk.js → LogoMark-BzObGdA9.js} +1 -1
  186. package/frontend/dist/js/{ModelManagerModals-Bk6OQzJI.js → ModelManagerModals-BzjZ-QwL.js} +1 -1
  187. package/frontend/dist/js/NotesPage-CnaAp_w_.js +3 -0
  188. package/frontend/dist/js/{OptimizedSyntaxHighlighter-CzzV6ONG.js → OptimizedSyntaxHighlighter-B0g8cxZQ.js} +1 -1
  189. package/frontend/dist/js/OptimizedSyntaxHighlighter-B_BbHeO1.js +1 -0
  190. package/frontend/dist/js/{PasswordStrengthMeter-DasfJa4P.js → PasswordStrengthMeter-DI4RDv67.js} +1 -1
  191. package/frontend/dist/js/{PersonasPage-CIJINcQK.js → PersonasPage-CH3GUKph.js} +2 -2
  192. package/frontend/dist/js/PluginUsagePage-d54K2gAj.js +1 -0
  193. package/frontend/dist/js/{RichMessageContent-DxCHlUlY.js → RichMessageContent-BfYbVBFz.js} +2 -2
  194. package/frontend/dist/js/RichMessageContent-CDxxs3Tt.js +1 -0
  195. package/frontend/dist/js/SettingsModal-BvtJcvow.js +19 -0
  196. package/frontend/dist/js/{SettingsToggle-oxvw7ulA.js → SettingsToggle-DrJ0Bapi.js} +1 -1
  197. package/frontend/dist/js/{ShareDialog-Bhpt_Y1N.js → ShareDialog-DaSxkTKS.js} +1 -1
  198. package/frontend/dist/js/StrandsPage-BQwz0mWq.js +1 -0
  199. package/frontend/dist/js/{SystemPage-BfhVXqar.js → SystemPage-BqNZoFxR.js} +1 -1
  200. package/frontend/dist/js/{TurnstileWidget-CVepEMEQ.js → TurnstileWidget-tI50c7Kc.js} +1 -1
  201. package/frontend/dist/js/{UserManagementPage-2yHv89ZA.js → UserManagementPage-UvPjA9RP.js} +1 -1
  202. package/frontend/dist/js/UserManagementPanel-C3T1ReJJ.js +1 -0
  203. package/frontend/dist/js/{WhatsNewModal-Dl69bG2T.js → WhatsNewModal-CLcU2Ugk.js} +1 -1
  204. package/frontend/dist/js/WorkPage-BpjGn--1.js +8 -0
  205. package/frontend/dist/js/api-BrHW-VGd.js +14 -0
  206. package/frontend/dist/js/api-K_hhqPdx.js +1 -0
  207. package/frontend/dist/js/{appNavigation-R8iKverf.js → appNavigation-B6xYIgLi.js} +1 -1
  208. package/frontend/dist/js/appStore-DkRdQQeY.js +2 -0
  209. package/frontend/dist/js/appVersion-BVtSqLVj.js +1 -0
  210. package/frontend/dist/js/ar-XTZGEtBr.js +2 -0
  211. package/frontend/dist/js/authStore-DBS6Kbvh.js +1 -0
  212. package/frontend/dist/js/{authStore-D8fc-Hl0.js → authStore-DjAsRpNL.js} +3 -3
  213. package/frontend/dist/js/bn-JiK7ZWmy.js +2 -0
  214. package/frontend/dist/js/chatStore-DpVxt9VX.js +3 -0
  215. package/frontend/dist/js/{client-BeJbHHWx.js → client-DppLngAs.js} +2 -2
  216. package/frontend/dist/js/{config-D6Kcp5n3.js → config-4_s8hdqO.js} +1 -1
  217. package/frontend/dist/js/cs-D8ju18CO.js +2 -0
  218. package/frontend/dist/js/da-BJWcAoUc.js +2 -0
  219. package/frontend/dist/js/de-CLJLmy69.js +2 -0
  220. package/frontend/dist/js/es-BvqHEL-3.js +2 -0
  221. package/frontend/dist/js/{evaluationsApi-2YwZBPk5.js → evaluationsApi-DyuW7IJ_.js} +1 -1
  222. package/frontend/dist/js/fr-B8ZoZomI.js +2 -0
  223. package/frontend/dist/js/hi-AzJLALo-.js +2 -0
  224. package/frontend/dist/js/id-DZYGQhvC.js +2 -0
  225. package/frontend/dist/js/is-Da_kvtzW.js +2 -0
  226. package/frontend/dist/js/it-B90zSlqn.js +2 -0
  227. package/frontend/dist/js/ja-DU_K1GOr.js +2 -0
  228. package/frontend/dist/js/ko-DicfoO-e.js +2 -0
  229. package/frontend/dist/js/{markdown-CZ1tYEW8.js → markdown-DU84620G.js} +1 -1
  230. package/frontend/dist/js/{markdown-core-KjS96SYW.js → markdown-core-Cyql92Hg.js} +1 -1
  231. package/frontend/dist/js/{markdown-html-DQEwrWcf.js → markdown-html-CUc2fCgY.js} +1 -1
  232. package/frontend/dist/js/{markdown-math-CKi32S5d.js → markdown-math-DxPfMKvO.js} +1 -1
  233. package/frontend/dist/js/{markdownHtml-lrXhxBhK.js → markdownHtml-KhS0cFNH.js} +1 -1
  234. package/frontend/dist/js/markdownMath-CsfRQAcz.js +1 -0
  235. package/frontend/dist/js/{messageCodeStyles-D4haBw80.js → messageCodeStyles-CuQPkfEK.js} +1 -1
  236. package/frontend/dist/js/ms-CfH7wjUY.js +2 -0
  237. package/frontend/dist/js/nl-ELlOz-B3.js +2 -0
  238. package/frontend/dist/js/pl-33dayyUk.js +2 -0
  239. package/frontend/dist/js/pt-aIXSQPCT.js +2 -0
  240. package/frontend/dist/js/react-vendor-CR5VJ85Q.js +9 -0
  241. package/frontend/dist/js/{router-vendor-HZm4FR0A.js → router-vendor-DqMnEJWK.js} +1 -1
  242. package/frontend/dist/js/ru-BSvGtBtW.js +2 -0
  243. package/frontend/dist/js/{standalone-DbyFjvTU.js → standalone-D_lg5NC9.js} +1 -1
  244. package/frontend/dist/js/strandsApi-BFbeEpAY.js +2 -0
  245. package/frontend/dist/js/sv-B7KOz81W.js +2 -0
  246. package/frontend/dist/js/{syntax-highlight-DNc3FFCa.js → syntax-highlight-D7dQ5s5-.js} +1 -1
  247. package/frontend/dist/js/{teamEventStream-omPy51va.js → teamEventStream-DsAS6P4m.js} +1 -1
  248. package/frontend/dist/js/th-DgpjGxvA.js +2 -0
  249. package/frontend/dist/js/tr-BQTbl2h-.js +2 -0
  250. package/frontend/dist/js/{ui-D5-4niRk.js → ui-Aq8MP7Ph.js} +2 -2
  251. package/frontend/dist/js/ui-vendor-DVTj_sKN.js +1 -0
  252. package/frontend/dist/js/uk-JLymloot.js +2 -0
  253. package/frontend/dist/js/{useChat-DnGClJeX.js → useChat-D3ZAGz70.js} +4 -4
  254. package/frontend/dist/js/useDialogFocus-zSGHkpE4.js +1 -0
  255. package/frontend/dist/js/useDictation-B6l8QzeM.js +1 -0
  256. package/frontend/dist/js/{useQuery-hWmQjdLu.js → useQuery-BTKpXudI.js} +1 -1
  257. package/frontend/dist/js/{useTranslation-B9kflK9S.js → useTranslation-Boi0fB1B.js} +1 -1
  258. package/frontend/dist/js/utils-B-Bhh1pF.js +1 -0
  259. package/frontend/dist/js/utils-vendor-DPJG-EG_.js +1 -0
  260. package/frontend/dist/js/vi-BXdLOJ8q.js +2 -0
  261. package/frontend/dist/js/{work-DmJpVPPO.js → work-CdbmBok5.js} +1 -1
  262. package/frontend/dist/js/workApi-D1xtiG3Q.js +1 -0
  263. package/frontend/dist/js/{workApi-C5InfT8x.js → workApi-UPxumrEF.js} +1 -1
  264. package/frontend/dist/js/workModels-BM2Zyiba.js +1 -0
  265. package/frontend/dist/js/zh-gdUf9sXa.js +2 -0
  266. package/package.json +11 -40
  267. package/plugins/anthropic.json +3 -1
  268. package/plugins/bedrock.json +86 -0
  269. package/plugins/openrouter.json +2 -0
  270. package/backend/dist/cordis/contracts.d.ts +0 -270
  271. package/backend/dist/cordis/contracts.d.ts.map +0 -1
  272. package/backend/dist/cordis/contracts.js +0 -32
  273. package/backend/dist/cordis/contracts.js.map +0 -1
  274. package/backend/dist/cordis/dsh/chat-model.d.ts +0 -16
  275. package/backend/dist/cordis/dsh/chat-model.d.ts.map +0 -1
  276. package/backend/dist/cordis/dsh/chat-model.js +0 -104
  277. package/backend/dist/cordis/dsh/chat-model.js.map +0 -1
  278. package/backend/dist/cordis/dsh/engine-plugin.d.ts +0 -186
  279. package/backend/dist/cordis/dsh/engine-plugin.d.ts.map +0 -1
  280. package/backend/dist/cordis/dsh/engine-plugin.js +0 -1116
  281. package/backend/dist/cordis/dsh/engine-plugin.js.map +0 -1
  282. package/backend/dist/cordis/dsh/librewebui-llm-adapter.d.ts +0 -175
  283. package/backend/dist/cordis/dsh/librewebui-llm-adapter.d.ts.map +0 -1
  284. package/backend/dist/cordis/dsh/librewebui-llm-adapter.js +0 -480
  285. package/backend/dist/cordis/dsh/librewebui-llm-adapter.js.map +0 -1
  286. package/backend/dist/cordis/dsh/model-identity.d.ts +0 -12
  287. package/backend/dist/cordis/dsh/model-identity.d.ts.map +0 -1
  288. package/backend/dist/cordis/dsh/model-identity.js +0 -87
  289. package/backend/dist/cordis/dsh/model-identity.js.map +0 -1
  290. package/backend/dist/cordis/dsh/native-provider-client.d.ts +0 -44
  291. package/backend/dist/cordis/dsh/native-provider-client.d.ts.map +0 -1
  292. package/backend/dist/cordis/dsh/native-provider-client.js +0 -524
  293. package/backend/dist/cordis/dsh/native-provider-client.js.map +0 -1
  294. package/backend/dist/cordis/dsh/native-provider-plugin.d.ts +0 -11
  295. package/backend/dist/cordis/dsh/native-provider-plugin.d.ts.map +0 -1
  296. package/backend/dist/cordis/dsh/native-provider-plugin.js +0 -416
  297. package/backend/dist/cordis/dsh/native-provider-plugin.js.map +0 -1
  298. package/backend/dist/cordis/dsh/native-provider-protocol.d.ts +0 -37
  299. package/backend/dist/cordis/dsh/native-provider-protocol.d.ts.map +0 -1
  300. package/backend/dist/cordis/dsh/native-provider-protocol.js +0 -325
  301. package/backend/dist/cordis/dsh/native-provider-protocol.js.map +0 -1
  302. package/backend/dist/cordis/dsh/provider-handler.d.ts +0 -36
  303. package/backend/dist/cordis/dsh/provider-handler.d.ts.map +0 -1
  304. package/backend/dist/cordis/dsh/provider-handler.js +0 -582
  305. package/backend/dist/cordis/dsh/provider-handler.js.map +0 -1
  306. package/backend/dist/cordis/dsh/session-files.d.ts +0 -9
  307. package/backend/dist/cordis/dsh/session-files.d.ts.map +0 -1
  308. package/backend/dist/cordis/dsh/session-files.js +0 -60
  309. package/backend/dist/cordis/dsh/session-files.js.map +0 -1
  310. package/backend/dist/cordis/dsh/session-settings.d.ts +0 -15
  311. package/backend/dist/cordis/dsh/session-settings.d.ts.map +0 -1
  312. package/backend/dist/cordis/dsh/session-settings.js +0 -51
  313. package/backend/dist/cordis/dsh/session-settings.js.map +0 -1
  314. package/backend/dist/cordis/dsh/work-driver.d.ts +0 -12
  315. package/backend/dist/cordis/dsh/work-driver.d.ts.map +0 -1
  316. package/backend/dist/cordis/dsh/work-driver.js +0 -402
  317. package/backend/dist/cordis/dsh/work-driver.js.map +0 -1
  318. package/backend/dist/cordis/dsh/workspace-policy.d.ts +0 -10
  319. package/backend/dist/cordis/dsh/workspace-policy.d.ts.map +0 -1
  320. package/backend/dist/cordis/dsh/workspace-policy.js +0 -44
  321. package/backend/dist/cordis/dsh/workspace-policy.js.map +0 -1
  322. package/backend/dist/cordis/host/composition.d.ts +0 -73
  323. package/backend/dist/cordis/host/composition.d.ts.map +0 -1
  324. package/backend/dist/cordis/host/composition.js +0 -205
  325. package/backend/dist/cordis/host/composition.js.map +0 -1
  326. package/backend/dist/cordis/host/config.d.ts +0 -159
  327. package/backend/dist/cordis/host/config.d.ts.map +0 -1
  328. package/backend/dist/cordis/host/config.js +0 -184
  329. package/backend/dist/cordis/host/config.js.map +0 -1
  330. package/backend/dist/cordis/host/host.d.ts +0 -74
  331. package/backend/dist/cordis/host/host.d.ts.map +0 -1
  332. package/backend/dist/cordis/host/host.js +0 -420
  333. package/backend/dist/cordis/host/host.js.map +0 -1
  334. package/backend/dist/cordis/host/loader-entry.d.ts +0 -41
  335. package/backend/dist/cordis/host/loader-entry.d.ts.map +0 -1
  336. package/backend/dist/cordis/host/loader-entry.js +0 -52
  337. package/backend/dist/cordis/host/loader-entry.js.map +0 -1
  338. package/backend/dist/cordis/host/model.d.ts +0 -45
  339. package/backend/dist/cordis/host/model.d.ts.map +0 -1
  340. package/backend/dist/cordis/host/model.js +0 -54
  341. package/backend/dist/cordis/host/model.js.map +0 -1
  342. package/backend/dist/cordis/host/privacy.d.ts +0 -8
  343. package/backend/dist/cordis/host/privacy.d.ts.map +0 -1
  344. package/backend/dist/cordis/host/privacy.js +0 -73
  345. package/backend/dist/cordis/host/privacy.js.map +0 -1
  346. package/backend/dist/cordis/index.d.ts +0 -14
  347. package/backend/dist/cordis/index.d.ts.map +0 -1
  348. package/backend/dist/cordis/index.js +0 -30
  349. package/backend/dist/cordis/index.js.map +0 -1
  350. package/backend/dist/cordis/runtime.d.ts +0 -97
  351. package/backend/dist/cordis/runtime.d.ts.map +0 -1
  352. package/backend/dist/cordis/runtime.js +0 -231
  353. package/backend/dist/cordis/runtime.js.map +0 -1
  354. package/backend/dist/cordis/work-model.d.ts +0 -7
  355. package/backend/dist/cordis/work-model.d.ts.map +0 -1
  356. package/backend/dist/cordis/work-model.js.map +0 -1
  357. package/backend/dist/routes/cordis.d.ts.map +0 -1
  358. package/backend/dist/routes/cordis.js +0 -440
  359. package/backend/dist/routes/cordis.js.map +0 -1
  360. package/backend/dist/routes/libreClaw.d.ts +0 -3
  361. package/backend/dist/routes/libreClaw.d.ts.map +0 -1
  362. package/backend/dist/routes/libreClaw.js +0 -200
  363. package/backend/dist/routes/libreClaw.js.map +0 -1
  364. package/backend/dist/services/cordisAccessService.d.ts +0 -56
  365. package/backend/dist/services/cordisAccessService.d.ts.map +0 -1
  366. package/backend/dist/services/cordisAccessService.js +0 -98
  367. package/backend/dist/services/cordisAccessService.js.map +0 -1
  368. package/backend/dist/services/libreClawService.d.ts +0 -105
  369. package/backend/dist/services/libreClawService.d.ts.map +0 -1
  370. package/backend/dist/services/libreClawService.js +0 -169
  371. package/backend/dist/services/libreClawService.js.map +0 -1
  372. package/frontend/dist/assets/index-C8_AByBq.css +0 -1
  373. package/frontend/dist/assets/index-DWLnkKwj.js +0 -16
  374. package/frontend/dist/js/AutomationModal-CjjiEZFA.js +0 -1
  375. package/frontend/dist/js/AutomationsPage-jnWmD58y.js +0 -1
  376. package/frontend/dist/js/ChannelsPage-DHPabX1e.js +0 -1
  377. package/frontend/dist/js/ChatPage-ZvGp-iqV.js +0 -14
  378. package/frontend/dist/js/ConnectModels-aUTD6s9B.js +0 -1
  379. package/frontend/dist/js/CordisPage-DZKcpPVj.js +0 -1
  380. package/frontend/dist/js/GalleryPage-CrlNRnkn.js +0 -1
  381. package/frontend/dist/js/HomePage-lR9h7_a1.js +0 -1
  382. package/frontend/dist/js/LanguageSwitcher-CWkbzpxT.js +0 -1
  383. package/frontend/dist/js/LibreClawPage-P19FnNlu.js +0 -1
  384. package/frontend/dist/js/NotesPage-DopG0M4B.js +0 -3
  385. package/frontend/dist/js/OptimizedSyntaxHighlighter-ajqwyBQm.js +0 -1
  386. package/frontend/dist/js/PluginUsagePage-Cj0mUxD8.js +0 -1
  387. package/frontend/dist/js/RichMessageContent-BZndQSJU.js +0 -1
  388. package/frontend/dist/js/SettingsModal-wAuFQOE4.js +0 -19
  389. package/frontend/dist/js/UserManagementPanel-BU95ZPOv.js +0 -1
  390. package/frontend/dist/js/WorkPage-CSderbeT.js +0 -8
  391. package/frontend/dist/js/api-CU-JXx2u.js +0 -1
  392. package/frontend/dist/js/api-DPXCtanG.js +0 -14
  393. package/frontend/dist/js/appStore-BD70bvas.js +0 -2
  394. package/frontend/dist/js/appVersion-C7sxqgMd.js +0 -1
  395. package/frontend/dist/js/ar-Cq-DrSYL.js +0 -2
  396. package/frontend/dist/js/authStore-FNKLFUQp.js +0 -1
  397. package/frontend/dist/js/bn-BqxLh-KL.js +0 -2
  398. package/frontend/dist/js/chatStore-CK5ojwft.js +0 -3
  399. package/frontend/dist/js/cordisApi-BS8QMSV4.js +0 -2
  400. package/frontend/dist/js/cs-D2DDNZf-.js +0 -2
  401. package/frontend/dist/js/da-BciY-TSG.js +0 -2
  402. package/frontend/dist/js/de-DjU_eXQ-.js +0 -2
  403. package/frontend/dist/js/es-ChIEs80I.js +0 -2
  404. package/frontend/dist/js/fr-Bi8BGRW4.js +0 -2
  405. package/frontend/dist/js/hi-BMsCnWg7.js +0 -2
  406. package/frontend/dist/js/i18next-DOICz7ZY.js +0 -1
  407. package/frontend/dist/js/id-CpcN1vhk.js +0 -2
  408. package/frontend/dist/js/is-DkUy2cmP.js +0 -2
  409. package/frontend/dist/js/it-BglK9DRZ.js +0 -2
  410. package/frontend/dist/js/ja-IrprzwLJ.js +0 -2
  411. package/frontend/dist/js/ko--wwEsMPi.js +0 -2
  412. package/frontend/dist/js/markdownMath-B0BpyFBS.js +0 -1
  413. package/frontend/dist/js/ms-BWj59y7-.js +0 -2
  414. package/frontend/dist/js/nl-D-QndW_A.js +0 -2
  415. package/frontend/dist/js/pl-Dw7d7iDV.js +0 -2
  416. package/frontend/dist/js/pt-BI53uHJw.js +0 -2
  417. package/frontend/dist/js/react-vendor-wiHys0m2.js +0 -9
  418. package/frontend/dist/js/ru-JKyTgPg9.js +0 -2
  419. package/frontend/dist/js/sv-BIkBLPSQ.js +0 -2
  420. package/frontend/dist/js/th-CZ_LcCU0.js +0 -2
  421. package/frontend/dist/js/tr-B265byx1.js +0 -2
  422. package/frontend/dist/js/ui-vendor-BhHHyHk3.js +0 -1
  423. package/frontend/dist/js/uk-VTAlChwf.js +0 -2
  424. package/frontend/dist/js/useDialogFocus-BPTG_Zmy.js +0 -1
  425. package/frontend/dist/js/useDictation-D7zVBjDJ.js +0 -1
  426. package/frontend/dist/js/utils-p8Gt72YP.js +0 -1
  427. package/frontend/dist/js/utils-vendor-DISWt2y9.js +0 -1
  428. package/frontend/dist/js/vi-D8rXh-53.js +0 -2
  429. package/frontend/dist/js/workApi-FV75LKJn.js +0 -1
  430. package/frontend/dist/js/workModels-MzU2Ab7l.js +0 -1
  431. package/frontend/dist/js/zh-BEGd9iBD.js +0 -2
  432. package/scripts/prepare-dsh-provider.mjs +0 -124
@@ -1 +1 @@
1
- import{t as e}from"./react-vendor-wiHys0m2.js";import{t}from"./utils-p8Gt72YP.js";var n=e();function r({checked:e,onChange:r,disabled:i=!1}){return(0,n.jsxs)(`label`,{className:`relative flex items-center cursor-pointer`,children:[(0,n.jsx)(`input`,{type:`checkbox`,checked:e,onChange:e=>r(e.target.checked),disabled:i,className:`peer sr-only`}),(0,n.jsx)(`div`,{className:t(`relative inline-flex h-6 w-11 items-center rounded-full transition-colors peer-focus-visible:ring-2 peer-focus-visible:ring-primary-500 peer-focus-visible:ring-offset-2`,i?`bg-gray-100 dark:bg-dark-200 opacity-50 cursor-not-allowed`:e?`bg-primary-600 dark:bg-primary-500`:`bg-gray-200 dark:bg-dark-300`),children:(0,n.jsx)(`span`,{className:t(`inline-block h-4 w-4 transform rounded-full bg-white transition-transform`,e?`translate-x-6 rtl:-translate-x-6`:`translate-x-1 rtl:-translate-x-1`)})})]})}export{r as t};
1
+ import{t as e}from"./react-vendor-CR5VJ85Q.js";import{t}from"./utils-B-Bhh1pF.js";var n=e();function r({checked:e,onChange:r,disabled:i=!1}){return(0,n.jsxs)(`label`,{className:`relative flex items-center cursor-pointer`,children:[(0,n.jsx)(`input`,{type:`checkbox`,checked:e,onChange:e=>r(e.target.checked),disabled:i,className:`peer sr-only`}),(0,n.jsx)(`div`,{className:t(`relative inline-flex h-6 w-11 items-center rounded-full transition-colors peer-focus-visible:ring-2 peer-focus-visible:ring-primary-500 peer-focus-visible:ring-offset-2`,i?`bg-gray-100 dark:bg-dark-200 opacity-50 cursor-not-allowed`:e?`bg-primary-600 dark:bg-primary-500`:`bg-gray-200 dark:bg-dark-300`),children:(0,n.jsx)(`span`,{className:t(`inline-block h-4 w-4 transform rounded-full bg-white transition-transform`,e?`translate-x-6 rtl:-translate-x-6`:`translate-x-1 rtl:-translate-x-1`)})})]})}export{r as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-vendor-wiHys0m2.js";import{t as r}from"./logger-BR4forr_.js";import{t as i}from"./useTranslation-B9kflK9S.js";import{B as a,Lt as o,n as s,s as c,wr as l}from"./ui-vendor-BhHHyHk3.js";import{A as u}from"./api-DPXCtanG.js";import{t as d}from"./Button-CGMYia4g.js";import{n as f,r as p}from"./ui-D5-4niRk.js";var m=e(t(),1),h=n(),g=r(`share-dialog`),_=({resourceType:e,resourceId:t,resourceLabel:n,onClose:r})=>{let{t:_}=i(),[v,y]=(0,m.useState)(null),[b,x]=(0,m.useState)(`user`),[S,C]=(0,m.useState)(``),[w,T]=(0,m.useState)(`read`),[E,D]=(0,m.useState)(!1),O=(0,m.useCallback)(()=>{u.listGrants(e,t).then(e=>{e.success&&Array.isArray(e.data)&&y(e.data)}).catch(e=>g.error(`Failed to load shares:`,e))},[e,t]);(0,m.useEffect)(()=>{O()},[O]);let k=async()=>{let n=S.trim();if(n){D(!0);try{let r=b===`user`?await u.resolvePrincipal(n):await u.resolveGroup(n);if(!r.success||!r.data){l.error(_(b===`user`?`share.userNotFound`:`share.groupNotFound`));return}let i=await u.createGrant({resourceType:e,resourceId:t,principalType:b,principalId:r.data.id,permission:w});i.success?(C(``),O(),l.success(_(`share.added`,{name:n}))):l.error(i.error||_(`share.failed`))}catch(e){g.error(`Failed to share resource:`,e),l.error(_(`share.failed`))}finally{D(!1)}}},A=async e=>{try{(await u.deleteGrant(e)).success&&O()}catch(e){g.error(`Failed to revoke share:`,e)}};return(0,h.jsxs)(f,{titleId:`share-dialog-title`,title:_(`share.title`,{name:n}),subtitle:_(`share.subtitle`),onClose:r,testId:`share-dialog`,children:[(0,h.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,h.jsxs)(`select`,{value:b,onChange:e=>x(e.target.value),className:`${p} w-auto`,"data-testid":`share-principal-kind`,children:[(0,h.jsx)(`option`,{value:`user`,children:_(`share.kindUser`)}),(0,h.jsx)(`option`,{value:`group`,children:_(`share.kindGroup`)})]}),(0,h.jsx)(`input`,{type:`text`,value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Enter`&&k()},placeholder:_(b===`user`?`share.usernamePlaceholder`:`share.groupPlaceholder`),className:`${p} min-w-0 flex-1`,"data-testid":`share-principal-name`}),(0,h.jsxs)(`select`,{value:w,onChange:e=>T(e.target.value),className:`${p} w-auto`,"data-testid":`share-permission`,children:[(0,h.jsx)(`option`,{value:`read`,children:_(`share.permissionRead`)}),(0,h.jsx)(`option`,{value:`write`,children:_(`share.permissionWrite`)})]}),(0,h.jsx)(d,{size:`sm`,disabled:E||!S.trim(),onClick:()=>void k(),"data-testid":`share-submit`,children:E?(0,h.jsx)(o,{className:`h-3.5 w-3.5 animate-spin`}):_(`share.action`)})]}),v===null?(0,h.jsx)(o,{className:`mx-auto h-4 w-4 animate-spin text-gray-400`}):v.length===0?(0,h.jsx)(`p`,{className:`text-center text-xs text-gray-400 dark:text-dark-500`,children:_(`share.empty`)}):(0,h.jsx)(`div`,{className:`space-y-2`,children:v.map(e=>(0,h.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-black/[0.06] px-2.5 py-2 dark:border-white/[0.08]`,"data-testid":`share-item`,children:[e.principalType===`group`?(0,h.jsx)(c,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 dark:text-dark-500`}):(0,h.jsx)(a,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 dark:text-dark-500`}),(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] text-gray-800 dark:text-dark-800`,children:e.principalName??e.principalId}),(0,h.jsx)(`span`,{className:`shrink-0 text-[11px] uppercase text-gray-400 dark:text-dark-500`,children:e.permission}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>void A(e.id),className:`rounded-md p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20`,title:_(`share.revoke`),children:(0,h.jsx)(s,{className:`h-3.5 w-3.5`})})]},e.id))}),(0,h.jsx)(`p`,{className:`text-[11px] leading-relaxed text-gray-400 dark:text-dark-500`,children:_(`share.hint`)})]})};export{_ as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-vendor-CR5VJ85Q.js";import{t as r}from"./logger-BR4forr_.js";import{t as i}from"./useTranslation-Boi0fB1B.js";import{B as a,Lt as o,Tr as s,n as c,s as l}from"./ui-vendor-DVTj_sKN.js";import{t as u}from"./Button-j68Q8KVh.js";import{k as d}from"./api-BrHW-VGd.js";import{n as f,r as p}from"./ui-Aq8MP7Ph.js";var m=e(t(),1),h=n(),g=r(`share-dialog`),_=({resourceType:e,resourceId:t,resourceLabel:n,onClose:r})=>{let{t:_}=i(),[v,y]=(0,m.useState)(null),[b,x]=(0,m.useState)(`user`),[S,C]=(0,m.useState)(``),[w,T]=(0,m.useState)(`read`),[E,D]=(0,m.useState)(!1),O=(0,m.useCallback)(()=>{d.listGrants(e,t).then(e=>{e.success&&Array.isArray(e.data)&&y(e.data)}).catch(e=>g.error(`Failed to load shares:`,e))},[e,t]);(0,m.useEffect)(()=>{O()},[O]);let k=async()=>{let n=S.trim();if(n){D(!0);try{let r=b===`user`?await d.resolvePrincipal(n):await d.resolveGroup(n);if(!r.success||!r.data){s.error(_(b===`user`?`share.userNotFound`:`share.groupNotFound`));return}let i=await d.createGrant({resourceType:e,resourceId:t,principalType:b,principalId:r.data.id,permission:w});i.success?(C(``),O(),s.success(_(`share.added`,{name:n}))):s.error(i.error||_(`share.failed`))}catch(e){g.error(`Failed to share resource:`,e),s.error(_(`share.failed`))}finally{D(!1)}}},A=async e=>{try{(await d.deleteGrant(e)).success&&O()}catch(e){g.error(`Failed to revoke share:`,e)}};return(0,h.jsxs)(f,{titleId:`share-dialog-title`,title:_(`share.title`,{name:n}),subtitle:_(`share.subtitle`),onClose:r,testId:`share-dialog`,children:[(0,h.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,h.jsxs)(`select`,{value:b,onChange:e=>x(e.target.value),className:`${p} w-auto`,"data-testid":`share-principal-kind`,children:[(0,h.jsx)(`option`,{value:`user`,children:_(`share.kindUser`)}),(0,h.jsx)(`option`,{value:`group`,children:_(`share.kindGroup`)})]}),(0,h.jsx)(`input`,{type:`text`,value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Enter`&&k()},placeholder:_(b===`user`?`share.usernamePlaceholder`:`share.groupPlaceholder`),className:`${p} min-w-0 flex-1`,"data-testid":`share-principal-name`}),(0,h.jsxs)(`select`,{value:w,onChange:e=>T(e.target.value),className:`${p} w-auto`,"data-testid":`share-permission`,children:[(0,h.jsx)(`option`,{value:`read`,children:_(`share.permissionRead`)}),(0,h.jsx)(`option`,{value:`write`,children:_(`share.permissionWrite`)})]}),(0,h.jsx)(u,{size:`sm`,disabled:E||!S.trim(),onClick:()=>void k(),"data-testid":`share-submit`,children:E?(0,h.jsx)(o,{className:`h-3.5 w-3.5 animate-spin`}):_(`share.action`)})]}),v===null?(0,h.jsx)(o,{className:`mx-auto h-4 w-4 animate-spin text-gray-400`}):v.length===0?(0,h.jsx)(`p`,{className:`text-center text-xs text-gray-400 dark:text-dark-500`,children:_(`share.empty`)}):(0,h.jsx)(`div`,{className:`space-y-2`,children:v.map(e=>(0,h.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-black/[0.06] px-2.5 py-2 dark:border-white/[0.08]`,"data-testid":`share-item`,children:[e.principalType===`group`?(0,h.jsx)(l,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 dark:text-dark-500`}):(0,h.jsx)(a,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 dark:text-dark-500`}),(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] text-gray-800 dark:text-dark-800`,children:e.principalName??e.principalId}),(0,h.jsx)(`span`,{className:`shrink-0 text-[11px] uppercase text-gray-400 dark:text-dark-500`,children:e.permission}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>void A(e.id),className:`rounded-md p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20`,title:_(`share.revoke`),children:(0,h.jsx)(c,{className:`h-3.5 w-3.5`})})]},e.id))}),(0,h.jsx)(`p`,{className:`text-[11px] leading-relaxed text-gray-400 dark:text-dark-500`,children:_(`share.hint`)})]})};export{_ as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-vendor-CR5VJ85Q.js";import{t as r}from"./useTranslation-Boi0fB1B.js";import{t as i}from"./utils-B-Bhh1pF.js";import{O as a,Ot as o,Tr as s,W as c,cr as l,r as u,v as d}from"./ui-vendor-DVTj_sKN.js";import{t as f}from"./Button-j68Q8KVh.js";import{a as p}from"./client-DppLngAs.js";import{t as m}from"./strandsApi-BFbeEpAY.js";import{f as h,l as g,p as _}from"./ui-Aq8MP7Ph.js";import{n as v}from"./composerStyles-C83jssgZ.js";var y=e(t(),1),b=n(),x=(e,t)=>{if(p(e)){let t=e.response?.data;if(typeof t?.error==`string`)return t.error}return e instanceof Error?e.message:t},S=e=>{if(e==null)return``;try{let t=typeof e==`string`?e:JSON.stringify(e);return t.length>400?`${t.slice(0,400)}…`:t}catch{return``}},C=(e,t)=>{switch(t.type){case`text`:return{...e,content:e.content+t.text};case`reasoning`:return{...e,thinking:(e.thinking??``)+t.text};case`tool-start`:return{...e,tools:[...e.tools??[],{id:t.toolUseId,name:t.name,input:t.input}]};case`tool-result`:return{...e,tools:(e.tools??[]).map(e=>e.id===t.toolUseId?{...e,status:t.status,output:t.output}:e)};case`done`:return{...e,stopReason:t.stopReason};case`error`:return{...e,error:t.message};default:return e}},w=({tool:e})=>{let{t}=r(),n=S(e.input);return(0,b.jsxs)(`details`,{className:`rounded-lg border border-line bg-surface-subtle px-3 py-2 text-xs`,"data-testid":`strands-tool-trace`,children:[(0,b.jsxs)(`summary`,{className:`flex cursor-pointer items-center gap-2 text-ink-muted`,children:[(0,b.jsx)(u,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}),(0,b.jsx)(`span`,{dir:`ltr`,className:`font-mono text-ink`,children:e.name}),(0,b.jsx)(`span`,{children:e.status===`error`?t(`strands.tool.failed`):e.status===`success`?t(`strands.tool.done`):t(`strands.tool.running`)})]}),n&&(0,b.jsx)(`pre`,{dir:`ltr`,className:`mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-all font-mono text-ink-muted`,children:n}),e.output&&(0,b.jsx)(`pre`,{dir:`ltr`,className:`mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-all font-mono text-ink`,children:e.output})]})},T=({message:e,streaming:t=!1})=>{let{t:n}=r();return e.role===`user`?(0,b.jsx)(`div`,{className:`flex justify-end`,"data-testid":`strands-user-message`,children:(0,b.jsx)(`div`,{className:`max-w-[85%] whitespace-pre-wrap rounded-2xl bg-surface-subtle px-4 py-2.5 text-sm text-ink`,children:e.content})}):(0,b.jsxs)(`div`,{className:`space-y-2`,"data-testid":`strands-assistant-message`,children:[e.thinking&&(0,b.jsxs)(`details`,{className:`text-xs text-ink-muted`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer`,children:n(`strands.reasoning`)}),(0,b.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap`,children:e.thinking})]}),(e.tools??[]).map(e=>(0,b.jsx)(w,{tool:e},e.id)),e.content&&(0,b.jsx)(`div`,{className:`text-sm text-ink`,children:(0,b.jsx)(g,{content:e.content,isStreaming:t})}),e.error&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-error-600 dark:text-error-400`,children:e.error}),e.stopReason===`cancelled`&&(0,b.jsx)(`p`,{className:`text-xs text-ink-muted`,children:n(`strands.cancelled`)}),e.stopReason===`limitTurns`&&(0,b.jsx)(`p`,{className:`text-xs text-ink-muted`,children:n(`strands.turnLimit`)})]})};function E(){let{t:e}=r(),[t,n]=(0,y.useState)(null),[u,p]=(0,y.useState)([]),[g,S]=(0,y.useState)([]),[w,E]=(0,y.useState)(null),[D,O]=(0,y.useState)([]),[k,A]=(0,y.useState)(``),[j,M]=(0,y.useState)(``),[N,P]=(0,y.useState)(!0),[F,I]=(0,y.useState)(null),[L,R]=(0,y.useState)(null),z=(0,y.useRef)(null),B=(0,y.useRef)(null),V=(0,y.useRef)(null),H=g.find(e=>e.id===w)??null,U=H?H.model??``:j,W=(0,y.useCallback)(async()=>{let e=await m.listSessions();return e.success&&e.data&&S(e.data),e.data??[]},[]);(0,y.useEffect)(()=>{let t=!1;return(async()=>{try{let[e,r,i]=await Promise.all([m.health(),m.models(),W()]);if(t)return;e.success&&e.data&&n(e.data),r.success&&r.data&&p(r.data),E(e=>e??i[0]?.id??null)}catch(n){t||I(x(n,e(`strands.loadFailed`)))}finally{t||P(!1)}})(),()=>{t=!0}},[W,e]),(0,y.useEffect)(()=>{if(!w||B.current===w)return;let t=!1;return m.getSession(w).then(e=>{!t&&e.success&&e.data&&O(e.data.messages)}).catch(n=>{t||s.error(x(n,e(`strands.loadFailed`)))}),()=>{t=!0}},[w,e]),(0,y.useEffect)(()=>{V.current?.scrollIntoView({block:`end`})},[D,L]),(0,y.useEffect)(()=>()=>z.current?.abort(),[]);let G=async()=>{try{let e=await m.createSession({model:U||null});if(!e.success||!e.data)throw Error(e.error);return B.current=e.data.id,S(t=>[e.data,...t]),O([]),E(e.data.id),e.data}catch(t){return s.error(x(t,e(`strands.createFailed`))),null}},K=async t=>{if(window.confirm(e(`strands.deleteConfirm`,{title:t.title})))try{await m.deleteSession(t.id);let e=g.filter(e=>e.id!==t.id);S(e),w===t.id&&(O([]),E(e[0]?.id??null))}catch(t){s.error(x(t,e(`strands.deleteFailed`)))}},q=async t=>{if(M(t),!H)return;let n=H.id,r=H.model,i=e=>S(t=>t.map(t=>t.id===n?{...t,model:e}:t));i(t||null);try{let e=await m.updateSession(n,{model:t||null});if(!e.success||!e.data)throw Error(e.error);S(t=>t.map(t=>t.id===n?e.data:t))}catch(t){i(r),M(r??``),s.error(x(t,e(`strands.saveFailed`)))}},J=async()=>{let t=k.trim();if(!t||L)return;let n=H??await G();if(!n)return;let r=Date.now();A(``),O(e=>[...e,{id:`local-${r}`,role:`user`,content:t,createdAt:r}]);let i={id:`local-reply-${r}`,role:`assistant`,content:``,createdAt:r};R(i);let a=new AbortController;z.current=a;try{await m.sendMessage(n.id,t,{signal:a.signal,onEvent:e=>{i=C(i,e),R(i)}})}catch(t){i=a.signal.aborted?{...i,stopReason:`cancelled`}:{...i,error:x(t,e(`strands.turnFailed`))}}finally{z.current=null,O(e=>[...e,i]),R(null),W()}},Y=async()=>{H&&(await m.cancel(H.id).catch(()=>void 0),z.current?.abort())},X=[{value:``,label:e(`strands.defaultModel`)},...u.map(e=>({value:e.id,label:`${e.name} · ${e.providerName}`}))];return U&&!u.some(e=>e.id===U)&&X.push({value:U,label:U}),(0,b.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-surface`,"data-testid":`strands-page`,children:[(0,b.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-line px-4 py-3 sm:px-6`,children:[(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`h1`,{className:`truncate text-lg font-medium text-ink`,children:e(`strands.title`)}),(0,b.jsx)(`p`,{className:`truncate text-xs text-ink-muted`,children:t?.harnessVersion?e(`strands.subtitleVersion`,{version:t.harnessVersion}):e(`strands.subtitle`)})]}),(0,b.jsxs)(f,{size:`sm`,variant:`outline`,onClick:()=>void G(),disabled:!!L,"data-testid":`strands-new-session`,children:[(0,b.jsx)(o,{className:`me-2 h-4 w-4`,"aria-hidden":`true`}),e(`strands.newSession`)]})]}),F&&(0,b.jsx)(`div`,{role:`alert`,className:`m-4 rounded-xl border border-line bg-surface-subtle p-4 text-sm text-ink`,children:F}),(0,b.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col lg:flex-row`,children:[(0,b.jsx)(`aside`,{"aria-label":e(`strands.sessions`),className:`shrink-0 border-b border-line bg-surface-subtle/30 lg:flex lg:w-64 lg:min-h-0 lg:flex-col lg:border-b-0 lg:border-e`,children:(0,b.jsxs)(`div`,{className:`min-h-0 overflow-auto p-2 lg:flex-1 lg:p-3`,children:[(0,b.jsx)(`ul`,{className:`flex gap-1 lg:block lg:space-y-1`,children:g.map(t=>(0,b.jsx)(`li`,{className:`min-w-44 lg:min-w-0`,children:(0,b.jsxs)(`div`,{className:i(`group flex items-center gap-1 rounded-lg`,t.id===w?`bg-surface-raised`:`hover:bg-surface-raised/60`),children:[(0,b.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40`,onClick:()=>{t.id!==w&&(O([]),E(t.id))},"aria-current":t.id===w?`page`:void 0,disabled:!!L,children:[(0,b.jsx)(`span`,{className:`block truncate text-sm text-ink`,children:t.title}),(0,b.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-ink-muted`,children:e(`strands.messageCount`,{count:t.messageCount})})]}),(0,b.jsx)(`button`,{type:`button`,className:`me-1 rounded p-1.5 text-ink-muted opacity-70 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40 group-hover:opacity-100`,"aria-label":`${e(`strands.deleteSession`)}: ${t.title}`,onClick:()=>void K(t),disabled:!!L,children:(0,b.jsx)(d,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})]})},t.id))}),!N&&g.length===0&&(0,b.jsx)(`p`,{className:`p-2 text-xs text-ink-muted`,children:e(`strands.noSessions`)})]})}),(0,b.jsxs)(`section`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,b.jsx)(`div`,{className:`scroll-region min-h-0 flex-1 overflow-y-auto px-4 py-5 sm:px-6`,children:(0,b.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-5`,children:[N?(0,b.jsx)(`p`,{role:`status`,className:`text-sm text-ink-muted`,children:e(`common.loading`)}):D.length===0&&!L?(0,b.jsxs)(`div`,{className:`py-12 text-center`,children:[(0,b.jsx)(l,{className:`mx-auto mb-3 h-7 w-7 text-ink-muted`,"aria-hidden":`true`}),(0,b.jsx)(`p`,{className:`text-sm text-ink-muted`,children:e(`strands.empty`)})]}):D.map(e=>(0,b.jsx)(T,{message:e},e.id)),L&&(0,b.jsx)(T,{message:L,streaming:!0}),(0,b.jsx)(`div`,{ref:V})]})}),(0,b.jsx)(`div`,{className:`shrink-0 px-4 pb-4 sm:px-6`,children:(0,b.jsxs)(`div`,{className:i(`mx-auto max-w-3xl`,v),children:[(0,b.jsx)(_,{value:k,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),J())},placeholder:e(`strands.placeholder`),"aria-label":e(`strands.placeholder`),rows:2,className:`resize-none border-0 bg-transparent shadow-none focus:ring-0`,"data-testid":`strands-input`}),(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-1 pt-1`,children:[(0,b.jsx)(`div`,{className:`w-56 max-w-[60%]`,children:(0,b.jsx)(h,{"aria-label":e(`strands.model`),"data-testid":`strands-model-select`,value:U,onChange:e=>void q(e.target.value),disabled:!!L,options:X,className:`h-9 py-1 text-sm`})}),L?(0,b.jsx)(f,{size:`sm`,variant:`outline`,onClick:()=>void Y(),"aria-label":e(`strands.stop`),"data-testid":`strands-stop`,children:(0,b.jsx)(a,{className:`h-4 w-4`,"aria-hidden":`true`})}):(0,b.jsx)(f,{size:`sm`,onClick:()=>void J(),disabled:!k.trim(),"aria-label":e(`strands.send`),"data-testid":`strands-send`,children:(0,b.jsx)(c,{className:`h-4 w-4`,"aria-hidden":`true`})})]})]})})]})]})]})}export{E as default};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-vendor-wiHys0m2.js";import{C as r,t as i}from"./useQuery-hWmQjdLu.js";import{t as a}from"./useTranslation-B9kflK9S.js";import{r as o,t as s}from"./utils-p8Gt72YP.js";import{At as c,Cr as l,Lt as u,Mn as d,U as f,Z as p,Zt as m,br as h,cr as g,g as _,ht as v,sr as y,z as b,zn as x}from"./ui-vendor-BhHHyHk3.js";import{t as S}from"./client-BeJbHHWx.js";import{o as C}from"./api-DPXCtanG.js";import{t as w}from"./workApi-C5InfT8x.js";import{t as T}from"./authStore-D8fc-Hl0.js";import{t as E}from"./Button-CGMYia4g.js";import{a as D,o as O}from"./ui-D5-4niRk.js";var k=e(t(),1),A={getDrills:()=>S.get(`/recovery/drills`).then(e=>e.data),runDrill:()=>S.post(`/recovery/drills/run`).then(e=>e.data)},j=n(),M=e=>e===null?`—`:e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} KB`:`${e} B`,N=e=>e===null?`—`:e>=3600?`${(e/3600).toFixed(1)} h`:e>=60?`${Math.round(e/60)} min`:`${e} s`,P=()=>{let{t:e}=a(),{user:t}=T(),[n,r]=(0,k.useState)(null),[i,o]=(0,k.useState)(!1),s=(0,k.useCallback)(async()=>{try{let e=await A.getDrills();e.success&&e.data&&r(e.data)}catch{}},[]);if((0,k.useEffect)(()=>{if(t?.role!==`admin`)return;let e=setTimeout(()=>void s(),0);return()=>clearTimeout(e)},[t?.role,s]),t?.role!==`admin`||!n)return null;let c=n.drills[0],d=n.drills.find(e=>e.status===`passed`),f=async()=>{o(!0);try{let t=await A.runDrill();t.success&&t.data?t.data.status===`passed`?l.success(e(`systemPage.recovery.passed`)):l.error(t.data.error||e(`systemPage.recovery.failed`)):l.error(t.message||e(`systemPage.recovery.failed`))}catch(t){let n=t;l.error(n.response?.data?.message||e(`systemPage.recovery.failed`))}finally{o(!1),await s()}};return(0,j.jsxs)(`section`,{"data-testid":`recovery-drills-panel`,className:`rounded-2xl border border-gray-200 bg-white p-4 dark:border-dark-200 dark:bg-dark-25`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-gray-100`,children:[(0,j.jsx)(h,{className:`h-4 w-4 text-primary-500`}),e(`systemPage.recovery.title`)]}),(0,j.jsx)(`p`,{className:`mt-0.5 text-xs text-gray-500 dark:text-dark-500`,children:n.supported?n.intervalHours?e(`systemPage.recovery.scheduleOn`,{hours:n.intervalHours}):e(`systemPage.recovery.scheduleOff`):e(`systemPage.recovery.teamUnsupported`)})]}),n.supported&&(0,j.jsx)(E,{size:`sm`,onClick:()=>void f(),disabled:i,children:i?(0,j.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(u,{className:`h-4 w-4 animate-spin`}),e(`systemPage.recovery.running`)]}):e(`systemPage.recovery.runNow`)})]}),d&&(0,j.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-dark-500`,children:e(`systemPage.recovery.lastPassed`)}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:new Date(d.startedAt).toLocaleString()})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-dark-500`,children:e(`systemPage.recovery.restoreTime`)}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:d.restoreMs===null?`—`:`${(d.restoreMs/1e3).toFixed(1)} s`})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-dark-500`,children:e(`systemPage.recovery.drillSpacing`)}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:N(d.rpoSeconds)})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-dark-500`,children:e(`systemPage.recovery.archiveSize`)}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:M(d.snapshotBytes)})]})]}),c&&c.status===`failed`&&(0,j.jsxs)(`p`,{className:`mt-3 rounded-lg bg-red-50 px-3 py-2 text-xs text-red-700 dark:bg-red-950/30 dark:text-red-300`,children:[e(`systemPage.recovery.lastFailed`,{date:new Date(c.startedAt).toLocaleString()}),c.error?` — ${c.error}`:``]}),n.drills.length>0&&(0,j.jsx)(`div`,{className:`mt-3 max-h-48 overflow-y-auto`,children:(0,j.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{className:`text-left text-gray-500 dark:text-dark-500`,children:[(0,j.jsx)(`th`,{className:`py-1 pe-3 font-medium`,children:e(`systemPage.recovery.columns.when`)}),(0,j.jsx)(`th`,{className:`py-1 pe-3 font-medium`,children:e(`systemPage.recovery.columns.origin`)}),(0,j.jsx)(`th`,{className:`py-1 pe-3 font-medium`,children:e(`systemPage.recovery.columns.status`)}),(0,j.jsx)(`th`,{className:`py-1 font-medium`,children:e(`systemPage.recovery.columns.restore`)})]})}),(0,j.jsx)(`tbody`,{children:n.drills.slice(0,10).map(t=>(0,j.jsxs)(`tr`,{className:`border-t border-gray-100 text-gray-700 dark:border-dark-200 dark:text-dark-800`,children:[(0,j.jsx)(`td`,{className:`py-1 pe-3`,children:new Date(t.startedAt).toLocaleString()}),(0,j.jsx)(`td`,{className:`py-1 pe-3`,children:t.origin===`manual`?e(`systemPage.recovery.originManual`):e(`systemPage.recovery.originScheduled`)}),(0,j.jsx)(`td`,{className:`py-1 pe-3`,children:(0,j.jsx)(`span`,{className:t.status===`passed`?`text-green-600 dark:text-green-400`:t.status===`failed`?`text-red-600 dark:text-red-400`:`text-gray-500 dark:text-dark-500`,children:e(`systemPage.recovery.status.${t.status}`)})}),(0,j.jsx)(`td`,{className:`py-1`,children:t.restoreMs===null?`—`:`${(t.restoreMs/1e3).toFixed(1)} s`})]},t.id))})]})})]})},F=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}),I=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}),L=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}),R=e=>{if(!Number.isFinite(e)||e<0)return`—`;if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`,`PB`],n=Math.min(t.length-1,Math.floor(Math.log(e)/Math.log(1024)));return`${F.format(e/1024**n)} ${t[n]}`},z=e=>{if(!Number.isFinite(e)||e<0)return`—`;let t=Math.floor(e/60),n=Math.floor(t/1440),r=Math.floor(t%1440/60),i=t%60;return n>0?`${n}d ${r}h`:r>0?`${r}h ${i}m`:i>0?`${i}m`:`${Math.floor(e)}s`},B=e=>Math.min(100,Math.max(0,Number.isFinite(e)?e:0)),V=e=>{switch(e.toLowerCase()){case`running`:return`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`;case`paused`:return`bg-amber-500/10 text-amber-700 dark:text-amber-300`;case`exited`:case`dead`:return`bg-gray-500/10 text-gray-600 dark:text-dark-600`;default:return`bg-primary-500/10 text-primary-700 dark:text-primary-300`}},H=({title:e,description:t,icon:n,className:r,action:i,children:a})=>(0,j.jsxs)(`section`,{className:s(`overflow-hidden rounded-2xl border border-gray-200/80 bg-white/80 shadow-subtle backdrop-blur-md dark:border-white/[0.08] dark:bg-dark-100/75`,r),children:[(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-gray-200/70 px-4 py-3 dark:border-white/[0.07] sm:px-5`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,j.jsx)(`div`,{className:`mt-0.5 rounded-xl bg-primary-500/10 p-1.5 text-primary-600 dark:text-primary-300`,children:(0,j.jsx)(n,{className:`h-4 w-4`})}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`h2`,{className:`text-sm font-medium text-gray-950 dark:text-dark-950`,children:e}),t&&(0,j.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500 dark:text-dark-500`,children:t})]})]}),i]}),a]}),U=({label:e,value:t,mono:n})=>(0,j.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-5 border-b border-gray-100 py-2 last:border-0 dark:border-white/[0.05]`,children:[(0,j.jsx)(`dt`,{className:`shrink-0 text-xs text-gray-500 dark:text-dark-500`,children:e}),(0,j.jsx)(`dd`,{className:s(`min-w-0 break-words text-end text-xs font-medium text-gray-800 dark:text-dark-800`,n&&`font-mono text-[11px]`),children:t})]}),W=({value:e,tone:t=`primary`})=>(0,j.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-gray-100 dark:bg-dark-300`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(B(e)),children:(0,j.jsx)(`div`,{className:s(`h-full rounded-full transition-[width] duration-300`,t===`warning`?`bg-amber-500 dark:bg-amber-400`:`bg-primary-500 dark:bg-primary-400`),style:{width:`${B(e)}%`}})}),G=()=>{let{t:e,i18n:t}=a(),n=r(),[s,c]=k.useState(!1),{data:u,error:d}=i({queryKey:[`work-admin-recovery`],queryFn:async()=>{let t=await w.adminRecovery();if(!t.success||!t.data)throw Error(t.error||e(`systemPage.work.recovery.loadFailed`));return t.data},refetchInterval:15e3,refetchIntervalInBackground:!1}),f=t=>{switch(t){case`stop-failed`:return e(`systemPage.work.recovery.reasonStopFailed`);case`runtime-unreachable`:return e(`systemPage.work.recovery.reasonRuntimeUnreachable`);case`orphan`:return e(`systemPage.work.recovery.reasonOrphan`);default:return e(`systemPage.work.recovery.reasonStartup`)}},p=async()=>{c(!0);try{let t=await w.retryAdminRecovery();if(!t.success||!t.data){l.error(t.error||e(`systemPage.work.recovery.retryFailed`));return}let{attempted:n,cleared:r}=t.data;r>0?l.success(e(`systemPage.work.recovery.retrySucceeded`,{attempted:n,cleared:r})):l.error(e(`systemPage.work.recovery.retryPending`,{attempted:n}))}catch(t){l.error(t instanceof Error&&t.message?t.message:e(`systemPage.work.recovery.retryFailed`))}finally{c(!1),await n.invalidateQueries({queryKey:[`work-admin-recovery`]}),await n.invalidateQueries({queryKey:[`work-admin-overview`]})}};return(0,j.jsxs)(`div`,{"data-testid":`work-recovery-panel`,className:`mx-4 mt-4 rounded-xl border border-amber-500/30 bg-amber-500/5 sm:mx-5`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 px-4 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,j.jsx)(_,{className:`mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-dark-900`,children:e(`systemPage.work.recovery.title`)}),(0,j.jsx)(`p`,{className:`mt-0.5 text-xs text-gray-600 dark:text-dark-600`,children:e(`systemPage.work.recovery.description`)})]})]}),(0,j.jsx)(E,{variant:`outline`,size:`sm`,"data-testid":`work-recovery-retry`,onClick:()=>void p(),disabled:s,children:e(s?`systemPage.work.recovery.retrying`:`systemPage.work.recovery.retry`)})]}),d&&!u?(0,j.jsx)(`p`,{className:`px-4 pb-3 text-xs text-red-700 dark:text-red-300`,children:d instanceof Error&&d.message?d.message:e(`systemPage.work.recovery.loadFailed`)}):(0,j.jsx)(`div`,{className:`overflow-x-auto`,children:(0,j.jsxs)(`table`,{className:`w-full min-w-[720px] text-sm`,children:[(0,j.jsx)(`thead`,{className:`text-[11px] uppercase tracking-[0.1em] text-gray-400 dark:text-dark-500`,children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.recovery.container`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.recovery.task`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.recovery.reason`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.recovery.attempts`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.recovery.lastError`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-end font-medium`,children:e(`systemPage.work.recovery.nextAttempt`)})]})}),(0,j.jsx)(`tbody`,{className:`divide-y divide-amber-500/20`,children:(u??[]).map(n=>(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`td`,{className:`px-4 py-2.5 font-mono text-[11px] text-gray-800 dark:text-dark-800`,children:n.containerName}),(0,j.jsx)(`td`,{className:`px-4 py-2.5 text-xs text-gray-700 dark:text-dark-700`,children:n.title?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`font-medium text-gray-900 dark:text-dark-900`,children:n.title}),n.ownerUsername&&(0,j.jsx)(`div`,{className:`mt-0.5 text-[11px] text-gray-500 dark:text-dark-500`,children:n.ownerUsername})]}):e(`systemPage.work.recovery.reasonOrphan`)}),(0,j.jsx)(`td`,{className:`px-4 py-2.5 text-xs text-gray-700 dark:text-dark-700`,children:f(n.reason)}),(0,j.jsx)(`td`,{className:`px-4 py-2.5 text-xs text-gray-700 dark:text-dark-700`,children:n.attempts}),(0,j.jsx)(`td`,{className:`max-w-xs px-4 py-2.5 text-xs text-gray-600 dark:text-dark-600`,children:(0,j.jsx)(`span`,{className:`line-clamp-2`,children:n.lastError||`—`})}),(0,j.jsx)(`td`,{className:`px-4 py-2.5 text-end text-xs text-gray-600 dark:text-dark-600`,children:n.nextAttemptAt?o(n.nextAttemptAt,t.language):e(`systemPage.work.recovery.notScheduled`)})]},`${n.kind}:${n.containerName}`))})]})})]})},K=()=>{let{t:e}=a(),{data:t,error:n,isFetching:r,refetch:o}=i({queryKey:[`work-admin-overview`],queryFn:async()=>{let t=await w.adminOverview();if(!t.success||!t.data)throw Error(t.error||e(`systemPage.loadFailed`));return t.data},refetchInterval:3e4,refetchIntervalInBackground:!1});if(!t)return n?(0,j.jsx)(H,{title:e(`systemPage.work.title`),description:e(`systemPage.work.description`),icon:y,children:(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-4 sm:px-5`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-3 text-sm text-red-700 dark:text-red-300`,children:[(0,j.jsx)(_,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,j.jsx)(`p`,{children:n instanceof Error&&n.message?n.message:e(`systemPage.loadFailed`)})]}),(0,j.jsx)(E,{variant:`outline`,size:`sm`,onClick:()=>void o(),disabled:r,children:e(`common.retry`)})]})}):null;let c=t=>e(t===null?`systemPage.work.stateUnknown`:t?`systemPage.work.stateRunning`:`systemPage.work.stateStopped`),l=t=>{if(!t||t.length===0)return e(`systemPage.work.inUseNone`);let n=new Map;for(let e of t)n.set(e.kind,(n.get(e.kind)??0)+1);return[...n.entries()].map(([t,n])=>`${n} ${e(`systemPage.work.usageKinds.${t}`)}`).join(`, `)},u=t=>{switch((t||``).split(`:`)[0]){case`completed`:return e(`work.runs.exitStates.completed`);case`needs_input`:return e(`work.runs.exitStates.needsInput`);case`failed`:return e(`work.runs.exitStates.failed`);case`cancelled`:return e(`work.runs.exitStates.cancelled`);default:return`—`}},d=t=>t===`running`?e(`systemPage.work.stateRunning`):t===`starting`?e(`systemPage.work.stateStarting`):`—`;return(0,j.jsxs)(H,{title:e(`systemPage.work.title`),description:e(`systemPage.work.description`),icon:y,action:(0,j.jsxs)(`span`,{className:s(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.1em]`,t.runtimeAvailable?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-gray-500/10 text-gray-600 dark:text-dark-600`),children:[(0,j.jsx)(`span`,{className:s(`h-1.5 w-1.5 rounded-full`,t.runtimeAvailable?`bg-emerald-500`:`bg-gray-400`)}),t.runtimeAvailable?e(`systemPage.work.runtimeAvailable`):e(`systemPage.work.runtimeUnavailable`)]}),children:[(0,j.jsx)(`div`,{className:`grid gap-3 border-b border-gray-200/70 p-4 dark:border-white/[0.07] sm:grid-cols-2 sm:p-5 lg:grid-cols-4`,children:[[e(`systemPage.work.access`),t.accessMode===`all-users`?e(`systemPage.work.accessAllUsers`):e(`systemPage.work.accessAdmins`)],[e(`systemPage.work.activeRuntimes`),`${t.admission.activeGlobal} / ${t.admission.maxGlobal}`],[e(`systemPage.work.pendingCleanups`),t.recoveryPending],[e(`systemPage.work.orphans`),t.orphanContainers.length]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-xl bg-gray-50 px-3 py-2.5 dark:bg-dark-200/70`,children:[(0,j.jsx)(`div`,{className:`text-[11px] text-gray-500 dark:text-dark-500`,children:e}),(0,j.jsx)(`div`,{className:`mt-1 text-xl text-gray-950 dark:text-dark-950`,children:t})]},String(e)))}),t.recoveryPending>0&&(0,j.jsx)(G,{}),!t.runtimeAvailable&&t.runtimeReason&&(0,j.jsxs)(`div`,{className:`mx-4 mt-4 flex items-start gap-3 rounded-xl border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-600 dark:border-white/[0.07] dark:bg-dark-200/60 dark:text-dark-600 sm:mx-5`,children:[(0,j.jsx)(_,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,j.jsx)(`p`,{children:t.runtimeReason})]}),t.tasks.length===0?(0,j.jsx)(`p`,{className:`px-4 py-4 text-sm text-gray-500 dark:text-dark-500 sm:px-5`,children:e(`systemPage.work.noTasks`)}):(0,j.jsx)(`div`,{className:`overflow-x-auto`,children:(0,j.jsxs)(`table`,{"data-testid":`system-work-table`,className:`w-full min-w-[900px] text-sm`,children:[(0,j.jsx)(`thead`,{className:`text-[11px] uppercase tracking-[0.1em] text-gray-400 dark:text-dark-500`,children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{className:`px-5 py-2 text-start font-medium`,children:e(`systemPage.work.owner`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.task`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.state`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.preview`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.terminals`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.inUse`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.lastRun`)}),(0,j.jsx)(`th`,{className:`px-5 py-2 text-end font-medium`,children:e(`systemPage.work.updated`)})]})}),(0,j.jsx)(`tbody`,{className:`divide-y divide-gray-100 dark:divide-white/[0.06]`,children:t.tasks.map(t=>(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`td`,{className:`px-5 py-2.5 text-gray-800 dark:text-dark-800`,children:t.ownerUsername}),(0,j.jsxs)(`td`,{className:`px-4 py-2.5`,children:[(0,j.jsx)(`div`,{className:`font-medium text-gray-900 dark:text-dark-900`,children:t.title}),(0,j.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-gray-500 dark:text-dark-500`,children:t.model})]}),(0,j.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,j.jsxs)(`span`,{className:s(`inline-flex items-center gap-1.5 text-xs`,t.running?`text-emerald-700 dark:text-emerald-300`:`text-gray-600 dark:text-dark-600`),children:[(0,j.jsx)(`span`,{className:s(`h-1.5 w-1.5 rounded-full`,t.running===null?`bg-amber-400`:t.running?`bg-emerald-500`:`bg-gray-400`)}),c(t.running)]})}),(0,j.jsx)(`td`,{className:`px-4 py-2.5 text-xs text-gray-600 dark:text-dark-600`,children:d(t.previewStatus)}),(0,j.jsx)(`td`,{className:`px-4 py-2.5 text-xs text-gray-600 dark:text-dark-600`,children:t.terminalSessions}),(0,j.jsx)(`td`,{className:`px-4 py-2.5 text-xs text-gray-600 dark:text-dark-600`,"data-testid":`work-admin-usage`,children:l(t.usage)}),(0,j.jsx)(`td`,{className:`max-w-[240px] px-4 py-2.5 text-xs text-gray-600 dark:text-dark-600`,"data-testid":`work-admin-last-run`,children:t.lastRun?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{title:t.lastRun.exitState,children:u(t.lastRun.exitState)}),t.lastRun.summary&&(0,j.jsx)(`div`,{dir:`auto`,className:`mt-0.5 truncate text-[10px] text-gray-500 dark:text-dark-500`,title:t.lastRun.summary,children:t.lastRun.summary})]}):e(`systemPage.work.noRun`)}),(0,j.jsx)(`td`,{className:`px-5 py-2.5 text-end text-xs text-gray-600 dark:text-dark-600`,children:L.format(t.updatedAt)})]},t.id))})]})})]})},q=()=>{let{t:e}=a(),{data:t,error:n,isLoading:r,isFetching:o,refetch:c}=i({queryKey:[`system-diagnostics`],queryFn:async()=>{let t=await C.getDiagnostics();if(!t.success||!t.data)throw Error(t.error||e(`systemPage.loadFailed`));return t.data},refetchInterval:3e4,refetchIntervalInBackground:!1}),l=n?n instanceof Error?n.message:e(`systemPage.loadFailed`):null;return r&&!t?(0,j.jsx)(O,{width:`wide`,children:(0,j.jsx)(`div`,{className:`flex min-h-[50vh] items-center justify-center`,children:(0,j.jsx)(u,{className:`h-7 w-7 animate-spin text-primary-500`})})}):(0,j.jsxs)(O,{width:`wide`,children:[(0,j.jsx)(D,{eyebrow:e(`systemPage.eyebrow`),title:e(`systemPage.title`),description:e(`systemPage.description`),actions:(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[t&&(0,j.jsx)(`span`,{className:`hidden text-xs text-gray-500 dark:text-dark-500 sm:inline`,children:e(`systemPage.updated`,{date:L.format(t.generatedAt)})}),(0,j.jsxs)(E,{variant:`outline`,size:`sm`,onClick:()=>void c(),disabled:o,children:[(0,j.jsx)(p,{className:s(`h-4 w-4`,o&&`animate-spin`)}),(0,j.jsx)(`span`,{className:`sr-only`,children:e(`systemPage.refresh`)})]})]})}),l&&(0,j.jsxs)(`div`,{className:`mb-6 flex items-center gap-3 rounded-2xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300`,children:[(0,j.jsx)(_,{className:`h-4 w-4 shrink-0`}),(0,j.jsx)(`span`,{children:l})]}),t&&(0,j.jsxs)(`div`,{"data-testid":`system-dashboard`,className:`space-y-4`,children:[(0,j.jsx)(J,{diagnostics:t}),(0,j.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,j.jsx)(Y,{diagnostics:t}),(0,j.jsx)(X,{diagnostics:t})]}),(0,j.jsx)(Z,{diagnostics:t}),(0,j.jsx)(Q,{diagnostics:t}),(0,j.jsx)(K,{}),(0,j.jsx)(P,{}),(0,j.jsx)(ee,{diagnostics:t}),(0,j.jsxs)(`div`,{className:`flex items-start gap-2 px-1 text-xs leading-5 text-gray-500 dark:text-dark-500`,children:[(0,j.jsx)(b,{className:`mt-0.5 h-4 w-4 shrink-0 text-primary-500`}),(0,j.jsx)(`p`,{children:e(`systemPage.securityNote`)})]})]})]})},J=({diagnostics:e})=>{let{t}=a(),n=e.filesystems.find(e=>e.label===`Data directory`)??e.filesystems[0],r=[{label:t(`systemPage.cards.uptime`),value:z(e.host.uptimeSeconds),detail:t(`systemPage.cards.uptimeDetail`,{date:L.format(e.host.bootedAt)}),icon:x},{label:t(`systemPage.cards.memory`),value:`${I.format(e.memory.usedPercent)}%`,detail:t(`systemPage.cards.memoryDetail`,{used:R(e.memory.usedBytes),total:R(e.memory.totalBytes)}),icon:c},{label:t(`systemPage.cards.freeSpace`),value:n?R(n.freeBytes):`—`,detail:n?t(`systemPage.cards.freeSpaceDetail`,{label:n.label,total:R(n.totalBytes)}):t(`systemPage.cards.unavailable`),icon:m},{label:t(`systemPage.cards.containers`),value:e.docker.available?String(e.docker.runningContainers):`—`,detail:e.docker.available?t(`systemPage.cards.containersDetail`,{total:e.docker.totalContainers}):t(`systemPage.cards.dockerUnavailable`),icon:d}];return(0,j.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:r.map(e=>{let t=e.icon;return(0,j.jsxs)(`section`,{className:`rounded-2xl border border-gray-200/80 bg-white/75 p-4 shadow-subtle backdrop-blur-md dark:border-white/[0.08] dark:bg-dark-100/70`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-xs font-medium uppercase tracking-[0.12em] text-gray-500 dark:text-dark-500`,children:e.label}),(0,j.jsx)(t,{className:`h-4 w-4 text-primary-500 dark:text-primary-400`})]}),(0,j.jsx)(`div`,{className:`mt-2 text-2xl font-normal tracking-[-0.04em] text-gray-950 dark:text-dark-950`,children:e.value}),(0,j.jsx)(`p`,{className:`mt-1.5 text-xs text-gray-500 dark:text-dark-500`,children:e.detail})]},e.label)})})},Y=({diagnostics:e})=>{let{t}=a(),{host:n,runtime:r}=e;return(0,j.jsx)(H,{title:t(`systemPage.host.title`),description:t(`systemPage.host.description`),icon:f,action:(0,j.jsx)(`span`,{className:`rounded-full bg-primary-500/10 px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.1em] text-primary-700 dark:text-primary-300`,children:n.containerized?t(`systemPage.host.container`):t(`systemPage.host.native`)}),children:(0,j.jsxs)(`dl`,{className:`px-4 py-2 sm:px-5`,children:[(0,j.jsx)(U,{label:t(`systemPage.host.hostname`),value:n.hostname}),(0,j.jsx)(U,{label:t(`systemPage.host.operatingSystem`),value:`${n.platform} ${n.release} · ${n.architecture}`}),(0,j.jsx)(U,{label:t(`systemPage.host.processor`),value:`${n.cpuModel} · ${n.logicalCpus} ${t(`systemPage.host.logicalCpus`)}`}),(0,j.jsx)(U,{label:t(`systemPage.host.loadAverage`),value:n.loadAverage.map(e=>I.format(e)).join(` · `)}),(0,j.jsx)(U,{label:t(`systemPage.host.libreVersion`),value:r.appVersion}),(0,j.jsx)(U,{label:t(`systemPage.host.nodeVersion`),value:r.nodeVersion}),(0,j.jsx)(U,{label:t(`systemPage.host.process`),value:`PID ${r.processId} · ${z(r.processUptimeSeconds)}`}),(0,j.jsx)(U,{label:t(`systemPage.host.workingDirectory`),value:r.workingDirectory,mono:!0})]})})},X=({diagnostics:e})=>{let{t}=a(),{memory:n}=e;return(0,j.jsx)(H,{title:t(`systemPage.memory.title`),description:t(`systemPage.memory.description`),icon:c,children:(0,j.jsxs)(`div`,{className:`space-y-4 p-4 sm:p-5`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`mb-2 flex items-end justify-between gap-4`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`text-2xl tracking-[-0.04em] text-gray-950 dark:text-dark-950`,children:[I.format(n.usedPercent),`%`]}),(0,j.jsx)(`div`,{className:`mt-1 text-xs text-gray-500 dark:text-dark-500`,children:t(`systemPage.memory.usedOf`,{used:R(n.usedBytes),total:R(n.totalBytes)})})]}),(0,j.jsx)(`span`,{className:`text-xs tabular-nums text-gray-500 dark:text-dark-500`,children:t(`systemPage.memory.free`,{value:R(n.freeBytes)})})]}),(0,j.jsx)(W,{value:n.usedPercent,tone:n.usedPercent>=85?`warning`:`primary`})]}),(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:[[t(`systemPage.memory.processRss`),n.processRssBytes],[t(`systemPage.memory.heapUsed`),n.heapUsedBytes],[t(`systemPage.memory.heapTotal`),n.heapTotalBytes],[t(`systemPage.memory.external`),n.externalBytes]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-xl bg-gray-50 px-3 py-2.5 dark:bg-dark-200/70`,children:[(0,j.jsx)(`div`,{className:`text-[11px] text-gray-500 dark:text-dark-500`,children:e}),(0,j.jsx)(`div`,{className:`mt-1 text-lg text-gray-950 dark:text-dark-950`,children:R(Number(t))})]},String(e)))})]})})},Z=({diagnostics:e})=>{let{t}=a();return(0,j.jsx)(H,{title:t(`systemPage.storage.title`),description:t(`systemPage.storage.description`),icon:m,children:e.filesystems.length===0?(0,j.jsx)(`p`,{className:`p-5 text-sm text-gray-500 dark:text-dark-500`,children:t(`systemPage.storage.empty`)}):(0,j.jsx)(`div`,{className:`grid gap-3 p-4 sm:grid-cols-2 sm:p-5`,children:e.filesystems.map(e=>(0,j.jsxs)(`div`,{className:`rounded-xl border border-gray-200/80 bg-gray-50/70 p-4 dark:border-white/[0.06] dark:bg-dark-200/55`,children:[(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`h3`,{className:`text-sm font-medium text-gray-900 dark:text-dark-900`,children:e.label}),(0,j.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-gray-500 dark:text-dark-500`,children:e.path})]}),(0,j.jsxs)(`span`,{className:`shrink-0 text-sm tabular-nums text-gray-700 dark:text-dark-700`,children:[I.format(e.usedPercent),`%`]})]}),(0,j.jsx)(`div`,{className:`mt-4`,children:(0,j.jsx)(W,{value:e.usedPercent,tone:e.usedPercent>=85?`warning`:`primary`})}),(0,j.jsxs)(`div`,{className:`mt-3 flex justify-between gap-4 text-[11px] text-gray-500 dark:text-dark-500`,children:[(0,j.jsx)(`span`,{children:t(`systemPage.storage.used`,{value:R(e.usedBytes)})}),(0,j.jsx)(`span`,{children:t(`systemPage.storage.free`,{value:R(e.freeBytes)})})]})]},`${e.label}:${e.path}`))})})},Q=({diagnostics:e})=>{let{t}=a(),{docker:n}=e;return(0,j.jsx)(H,{title:t(`systemPage.docker.title`),description:t(`systemPage.docker.description`),icon:d,action:(0,j.jsxs)(`span`,{className:s(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.1em]`,n.available?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-gray-500/10 text-gray-600 dark:text-dark-600`),children:[(0,j.jsx)(`span`,{className:s(`h-1.5 w-1.5 rounded-full`,n.available?`bg-emerald-500`:`bg-gray-400`)}),n.available?t(`systemPage.docker.connected`):t(`systemPage.docker.unavailable`)]}),children:n.available?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`grid gap-3 border-b border-gray-200/70 p-4 dark:border-white/[0.07] sm:grid-cols-2 sm:p-5 lg:grid-cols-4`,children:[[t(`systemPage.docker.running`),n.runningContainers],[t(`systemPage.docker.stopped`),n.stoppedContainers],[t(`systemPage.docker.paused`),n.pausedContainers],[t(`systemPage.docker.total`),n.totalContainers]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-xl bg-gray-50 px-3 py-2.5 dark:bg-dark-200/70`,children:[(0,j.jsx)(`div`,{className:`text-[11px] text-gray-500 dark:text-dark-500`,children:e}),(0,j.jsx)(`div`,{className:`mt-1 text-xl text-gray-950 dark:text-dark-950`,children:t})]},String(e)))}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 px-4 py-4 sm:px-5`,children:[n.serverVersion&&(0,j.jsx)($,{label:t(`systemPage.docker.version`),value:n.serverVersion}),n.operatingSystem&&(0,j.jsx)($,{label:t(`systemPage.docker.host`),value:n.operatingSystem}),n.architecture&&(0,j.jsx)($,{label:t(`systemPage.docker.architecture`),value:n.architecture}),n.logicalCpus!==void 0&&(0,j.jsx)($,{label:t(`systemPage.docker.cpus`),value:String(n.logicalCpus)}),n.memoryBytes!==void 0&&(0,j.jsx)($,{label:t(`systemPage.docker.memory`),value:R(n.memoryBytes)})]}),n.containers.length===0?(0,j.jsx)(`p`,{className:`px-5 pb-5 text-sm text-gray-500 dark:text-dark-500`,children:t(`systemPage.docker.empty`)}):(0,j.jsx)(`div`,{className:`overflow-x-auto border-t border-gray-200/70 dark:border-white/[0.07]`,children:(0,j.jsxs)(`table`,{"data-testid":`system-docker-table`,className:`w-full min-w-[760px] text-sm`,children:[(0,j.jsx)(`thead`,{className:`text-[11px] uppercase tracking-[0.1em] text-gray-400 dark:text-dark-500`,children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{className:`px-5 py-2 text-start font-medium`,children:t(`systemPage.docker.container`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:t(`systemPage.docker.image`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:t(`systemPage.docker.state`)}),(0,j.jsx)(`th`,{className:`px-5 py-2 text-end font-medium`,children:t(`systemPage.docker.created`)})]})}),(0,j.jsx)(`tbody`,{className:`divide-y divide-gray-100 dark:divide-white/[0.06]`,children:n.containers.map(e=>(0,j.jsxs)(`tr`,{children:[(0,j.jsxs)(`td`,{className:`px-5 py-2.5`,children:[(0,j.jsx)(`div`,{className:`font-medium text-gray-900 dark:text-dark-900`,children:e.name}),(0,j.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-gray-500 dark:text-dark-500`,children:e.id})]}),(0,j.jsx)(`td`,{className:`max-w-[280px] px-4 py-2.5`,children:(0,j.jsx)(`div`,{className:`truncate font-mono text-[11px] text-gray-600 dark:text-dark-600`,title:e.image,children:e.image})}),(0,j.jsxs)(`td`,{className:`px-4 py-2.5`,children:[(0,j.jsx)(`span`,{className:s(`inline-flex rounded-full px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.08em]`,V(e.state)),children:e.state}),(0,j.jsx)(`div`,{className:`mt-1.5 text-[11px] text-gray-500 dark:text-dark-500`,children:e.status})]}),(0,j.jsx)(`td`,{className:`px-5 py-2.5 text-end text-xs text-gray-500 dark:text-dark-500`,children:e.createdAt?L.format(e.createdAt):`—`})]},e.id))})]})})]}):(0,j.jsxs)(`div`,{className:`m-4 flex items-start gap-3 rounded-xl border border-gray-200 bg-gray-50 px-4 py-4 text-sm text-gray-600 dark:border-white/[0.07] dark:bg-dark-200/60 dark:text-dark-600 sm:m-5`,children:[(0,j.jsx)(_,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{children:n.reason||t(`systemPage.docker.unavailableDetail`)}),(0,j.jsx)(`p`,{className:`mt-2 text-xs text-gray-500 dark:text-dark-500`,children:t(`systemPage.docker.socketStatus`,{status:n.socketMounted?t(`systemPage.docker.mounted`):t(`systemPage.docker.notMounted`)})})]})]})})},$=({label:e,value:t})=>(0,j.jsxs)(`span`,{className:`rounded-full border border-gray-200 bg-white px-3 py-1.5 text-[11px] text-gray-600 dark:border-white/[0.07] dark:bg-dark-200/70 dark:text-dark-600`,children:[(0,j.jsx)(`span`,{className:`text-gray-400 dark:text-dark-500`,children:e}),` `,t]}),ee=({diagnostics:e})=>{let{t}=a();return(0,j.jsx)(H,{title:t(`systemPage.network.title`),description:t(`systemPage.network.description`),icon:v,children:e.network.interfaces.length===0?(0,j.jsx)(`p`,{className:`p-5 text-sm text-gray-500 dark:text-dark-500`,children:t(`systemPage.network.empty`)}):(0,j.jsx)(`div`,{className:`grid gap-3 p-4 sm:grid-cols-2 sm:p-5 xl:grid-cols-3`,children:e.network.interfaces.map(e=>(0,j.jsxs)(`div`,{className:`rounded-xl border border-gray-200/80 bg-gray-50/70 p-4 dark:border-white/[0.06] dark:bg-dark-200/55`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(g,{className:`h-4 w-4 text-primary-500`}),(0,j.jsx)(`h3`,{className:`font-mono text-xs font-medium text-gray-900 dark:text-dark-900`,children:e.name})]}),(0,j.jsx)(`div`,{className:`mt-3 space-y-2`,children:e.addresses.map(e=>(0,j.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-white px-3 py-2 dark:bg-dark-100/80`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-[0.08em] text-gray-400 dark:text-dark-500`,children:e.family}),e.internal&&(0,j.jsx)(`span`,{className:`text-[10px] text-gray-400 dark:text-dark-500`,children:t(`systemPage.network.internal`)})]}),(0,j.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px] text-gray-700 dark:text-dark-700`,children:e.cidr||e.address})]},`${e.family}:${e.address}`))}),(e.receivedBytes!==void 0||e.transmittedBytes!==void 0)&&(0,j.jsxs)(`div`,{className:`mt-3 flex justify-between gap-4 text-[10px] text-gray-500 dark:text-dark-500`,children:[(0,j.jsxs)(`span`,{children:[`↓ `,R(e.receivedBytes??0)]}),(0,j.jsxs)(`span`,{children:[`↑ `,R(e.transmittedBytes??0)]})]})]},e.name))})})};export{q as default};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-vendor-CR5VJ85Q.js";import{C as r,t as i}from"./useQuery-BTKpXudI.js";import{t as a}from"./useTranslation-Boi0fB1B.js";import{r as o,t as s}from"./utils-B-Bhh1pF.js";import{At as c,Lt as l,Mn as u,U as d,Z as f,Zt as p,g as m,ht as h,or as g,sr as _,wr as v,yr as y,z as b,zn as x}from"./ui-vendor-DVTj_sKN.js";import{t as S}from"./Button-j68Q8KVh.js";import{t as C}from"./client-DppLngAs.js";import{o as w}from"./api-BrHW-VGd.js";import{t as T}from"./workApi-UPxumrEF.js";import{t as E}from"./authStore-DjAsRpNL.js";import{a as D,o as O}from"./ui-Aq8MP7Ph.js";var k=e(t(),1),A={getDrills:()=>C.get(`/recovery/drills`).then(e=>e.data),runDrill:()=>C.post(`/recovery/drills/run`).then(e=>e.data)},j=n(),M=e=>e===null?`—`:e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} KB`:`${e} B`,N=e=>e===null?`—`:e>=3600?`${(e/3600).toFixed(1)} h`:e>=60?`${Math.round(e/60)} min`:`${e} s`,P=()=>{let{t:e}=a(),{user:t}=E(),[n,r]=(0,k.useState)(null),[i,o]=(0,k.useState)(!1),s=(0,k.useCallback)(async()=>{try{let e=await A.getDrills();e.success&&e.data&&r(e.data)}catch{}},[]);if((0,k.useEffect)(()=>{if(t?.role!==`admin`)return;let e=setTimeout(()=>void s(),0);return()=>clearTimeout(e)},[t?.role,s]),t?.role!==`admin`||!n)return null;let c=n.drills[0],u=n.drills.find(e=>e.status===`passed`),d=async()=>{o(!0);try{let t=await A.runDrill();t.success&&t.data?t.data.status===`passed`?v.success(e(`systemPage.recovery.passed`)):v.error(t.data.error||e(`systemPage.recovery.failed`)):v.error(t.message||e(`systemPage.recovery.failed`))}catch(t){let n=t;v.error(n.response?.data?.message||e(`systemPage.recovery.failed`))}finally{o(!1),await s()}};return(0,j.jsxs)(`section`,{"data-testid":`recovery-drills-panel`,className:`rounded-2xl border border-gray-200 bg-white p-4 dark:border-dark-200 dark:bg-dark-25`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-gray-100`,children:[(0,j.jsx)(y,{className:`h-4 w-4 text-primary-500`}),e(`systemPage.recovery.title`)]}),(0,j.jsx)(`p`,{className:`mt-0.5 text-xs text-gray-500 dark:text-dark-500`,children:n.supported?n.intervalHours?e(`systemPage.recovery.scheduleOn`,{hours:n.intervalHours}):e(`systemPage.recovery.scheduleOff`):e(`systemPage.recovery.teamUnsupported`)})]}),n.supported&&(0,j.jsx)(S,{size:`sm`,onClick:()=>void d(),disabled:i,children:i?(0,j.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(l,{className:`h-4 w-4 animate-spin`}),e(`systemPage.recovery.running`)]}):e(`systemPage.recovery.runNow`)})]}),u&&(0,j.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-dark-500`,children:e(`systemPage.recovery.lastPassed`)}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:new Date(u.startedAt).toLocaleString()})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-dark-500`,children:e(`systemPage.recovery.restoreTime`)}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:u.restoreMs===null?`—`:`${(u.restoreMs/1e3).toFixed(1)} s`})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-dark-500`,children:e(`systemPage.recovery.drillSpacing`)}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:N(u.rpoSeconds)})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-dark-500`,children:e(`systemPage.recovery.archiveSize`)}),(0,j.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:M(u.snapshotBytes)})]})]}),c&&c.status===`failed`&&(0,j.jsxs)(`p`,{className:`mt-3 rounded-lg bg-red-50 px-3 py-2 text-xs text-red-700 dark:bg-red-950/30 dark:text-red-300`,children:[e(`systemPage.recovery.lastFailed`,{date:new Date(c.startedAt).toLocaleString()}),c.error?` — ${c.error}`:``]}),n.drills.length>0&&(0,j.jsx)(`div`,{className:`mt-3 max-h-48 overflow-y-auto`,children:(0,j.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{className:`text-left text-gray-500 dark:text-dark-500`,children:[(0,j.jsx)(`th`,{className:`py-1 pe-3 font-medium`,children:e(`systemPage.recovery.columns.when`)}),(0,j.jsx)(`th`,{className:`py-1 pe-3 font-medium`,children:e(`systemPage.recovery.columns.origin`)}),(0,j.jsx)(`th`,{className:`py-1 pe-3 font-medium`,children:e(`systemPage.recovery.columns.status`)}),(0,j.jsx)(`th`,{className:`py-1 font-medium`,children:e(`systemPage.recovery.columns.restore`)})]})}),(0,j.jsx)(`tbody`,{children:n.drills.slice(0,10).map(t=>(0,j.jsxs)(`tr`,{className:`border-t border-gray-100 text-gray-700 dark:border-dark-200 dark:text-dark-800`,children:[(0,j.jsx)(`td`,{className:`py-1 pe-3`,children:new Date(t.startedAt).toLocaleString()}),(0,j.jsx)(`td`,{className:`py-1 pe-3`,children:t.origin===`manual`?e(`systemPage.recovery.originManual`):e(`systemPage.recovery.originScheduled`)}),(0,j.jsx)(`td`,{className:`py-1 pe-3`,children:(0,j.jsx)(`span`,{className:t.status===`passed`?`text-green-600 dark:text-green-400`:t.status===`failed`?`text-red-600 dark:text-red-400`:`text-gray-500 dark:text-dark-500`,children:e(`systemPage.recovery.status.${t.status}`)})}),(0,j.jsx)(`td`,{className:`py-1`,children:t.restoreMs===null?`—`:`${(t.restoreMs/1e3).toFixed(1)} s`})]},t.id))})]})})]})},F=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}),I=new Intl.NumberFormat(void 0,{maximumFractionDigits:1}),L=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}),R=e=>{if(!Number.isFinite(e)||e<0)return`—`;if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`,`PB`],n=Math.min(t.length-1,Math.floor(Math.log(e)/Math.log(1024)));return`${F.format(e/1024**n)} ${t[n]}`},z=e=>{if(!Number.isFinite(e)||e<0)return`—`;let t=Math.floor(e/60),n=Math.floor(t/1440),r=Math.floor(t%1440/60),i=t%60;return n>0?`${n}d ${r}h`:r>0?`${r}h ${i}m`:i>0?`${i}m`:`${Math.floor(e)}s`},B=e=>Math.min(100,Math.max(0,Number.isFinite(e)?e:0)),V=e=>{switch(e.toLowerCase()){case`running`:return`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`;case`paused`:return`bg-amber-500/10 text-amber-700 dark:text-amber-300`;case`exited`:case`dead`:return`bg-gray-500/10 text-gray-600 dark:text-dark-600`;default:return`bg-primary-500/10 text-primary-700 dark:text-primary-300`}},H=({title:e,description:t,icon:n,className:r,action:i,children:a})=>(0,j.jsxs)(`section`,{className:s(`overflow-hidden rounded-2xl border border-gray-200/80 bg-white/80 shadow-subtle backdrop-blur-md dark:border-white/[0.08] dark:bg-dark-100/75`,r),children:[(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-gray-200/70 px-4 py-3 dark:border-white/[0.07] sm:px-5`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,j.jsx)(`div`,{className:`mt-0.5 rounded-xl bg-primary-500/10 p-1.5 text-primary-600 dark:text-primary-300`,children:(0,j.jsx)(n,{className:`h-4 w-4`})}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`h2`,{className:`text-sm font-medium text-gray-950 dark:text-dark-950`,children:e}),t&&(0,j.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500 dark:text-dark-500`,children:t})]})]}),i]}),a]}),U=({label:e,value:t,mono:n})=>(0,j.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-5 border-b border-gray-100 py-2 last:border-0 dark:border-white/[0.05]`,children:[(0,j.jsx)(`dt`,{className:`shrink-0 text-xs text-gray-500 dark:text-dark-500`,children:e}),(0,j.jsx)(`dd`,{className:s(`min-w-0 break-words text-end text-xs font-medium text-gray-800 dark:text-dark-800`,n&&`font-mono text-[11px]`),children:t})]}),W=({value:e,tone:t=`primary`})=>(0,j.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-gray-100 dark:bg-dark-300`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(B(e)),children:(0,j.jsx)(`div`,{className:s(`h-full rounded-full transition-[width] duration-300`,t===`warning`?`bg-amber-500 dark:bg-amber-400`:`bg-primary-500 dark:bg-primary-400`),style:{width:`${B(e)}%`}})}),G=()=>{let{t:e,i18n:t}=a(),n=r(),[s,c]=k.useState(!1),{data:l,error:u}=i({queryKey:[`work-admin-recovery`],queryFn:async()=>{let t=await T.adminRecovery();if(!t.success||!t.data)throw Error(t.error||e(`systemPage.work.recovery.loadFailed`));return t.data},refetchInterval:15e3,refetchIntervalInBackground:!1}),d=t=>{switch(t){case`stop-failed`:return e(`systemPage.work.recovery.reasonStopFailed`);case`runtime-unreachable`:return e(`systemPage.work.recovery.reasonRuntimeUnreachable`);case`orphan`:return e(`systemPage.work.recovery.reasonOrphan`);default:return e(`systemPage.work.recovery.reasonStartup`)}},f=async()=>{c(!0);try{let t=await T.retryAdminRecovery();if(!t.success||!t.data){v.error(t.error||e(`systemPage.work.recovery.retryFailed`));return}let{attempted:n,cleared:r}=t.data;r>0?v.success(e(`systemPage.work.recovery.retrySucceeded`,{attempted:n,cleared:r})):v.error(e(`systemPage.work.recovery.retryPending`,{attempted:n}))}catch(t){v.error(t instanceof Error&&t.message?t.message:e(`systemPage.work.recovery.retryFailed`))}finally{c(!1),await n.invalidateQueries({queryKey:[`work-admin-recovery`]}),await n.invalidateQueries({queryKey:[`work-admin-overview`]})}};return(0,j.jsxs)(`div`,{"data-testid":`work-recovery-panel`,className:`mx-4 mt-4 rounded-xl border border-amber-500/30 bg-amber-500/5 sm:mx-5`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 px-4 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,j.jsx)(m,{className:`mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400`}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-dark-900`,children:e(`systemPage.work.recovery.title`)}),(0,j.jsx)(`p`,{className:`mt-0.5 text-xs text-gray-600 dark:text-dark-600`,children:e(`systemPage.work.recovery.description`)})]})]}),(0,j.jsx)(S,{variant:`outline`,size:`sm`,"data-testid":`work-recovery-retry`,onClick:()=>void f(),disabled:s,children:e(s?`systemPage.work.recovery.retrying`:`systemPage.work.recovery.retry`)})]}),u&&!l?(0,j.jsx)(`p`,{className:`px-4 pb-3 text-xs text-red-700 dark:text-red-300`,children:u instanceof Error&&u.message?u.message:e(`systemPage.work.recovery.loadFailed`)}):(0,j.jsx)(`div`,{className:`overflow-x-auto`,children:(0,j.jsxs)(`table`,{className:`w-full min-w-[720px] text-sm`,children:[(0,j.jsx)(`thead`,{className:`text-[11px] uppercase tracking-[0.1em] text-gray-400 dark:text-dark-500`,children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.recovery.container`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.recovery.task`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.recovery.reason`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.recovery.attempts`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.recovery.lastError`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-end font-medium`,children:e(`systemPage.work.recovery.nextAttempt`)})]})}),(0,j.jsx)(`tbody`,{className:`divide-y divide-amber-500/20`,children:(l??[]).map(n=>(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`td`,{className:`px-4 py-2.5 font-mono text-[11px] text-gray-800 dark:text-dark-800`,children:n.containerName}),(0,j.jsx)(`td`,{className:`px-4 py-2.5 text-xs text-gray-700 dark:text-dark-700`,children:n.title?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`font-medium text-gray-900 dark:text-dark-900`,children:n.title}),n.ownerUsername&&(0,j.jsx)(`div`,{className:`mt-0.5 text-[11px] text-gray-500 dark:text-dark-500`,children:n.ownerUsername})]}):e(`systemPage.work.recovery.reasonOrphan`)}),(0,j.jsx)(`td`,{className:`px-4 py-2.5 text-xs text-gray-700 dark:text-dark-700`,children:d(n.reason)}),(0,j.jsx)(`td`,{className:`px-4 py-2.5 text-xs text-gray-700 dark:text-dark-700`,children:n.attempts}),(0,j.jsx)(`td`,{className:`max-w-xs px-4 py-2.5 text-xs text-gray-600 dark:text-dark-600`,children:(0,j.jsx)(`span`,{className:`line-clamp-2`,children:n.lastError||`—`})}),(0,j.jsx)(`td`,{className:`px-4 py-2.5 text-end text-xs text-gray-600 dark:text-dark-600`,children:n.nextAttemptAt?o(n.nextAttemptAt,t.language):e(`systemPage.work.recovery.notScheduled`)})]},`${n.kind}:${n.containerName}`))})]})})]})},K=()=>{let{t:e}=a(),{data:t,error:n,isFetching:r,refetch:o}=i({queryKey:[`work-admin-overview`],queryFn:async()=>{let t=await T.adminOverview();if(!t.success||!t.data)throw Error(t.error||e(`systemPage.loadFailed`));return t.data},refetchInterval:3e4,refetchIntervalInBackground:!1});if(!t)return n?(0,j.jsx)(H,{title:e(`systemPage.work.title`),description:e(`systemPage.work.description`),icon:g,children:(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-4 sm:px-5`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-3 text-sm text-red-700 dark:text-red-300`,children:[(0,j.jsx)(m,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,j.jsx)(`p`,{children:n instanceof Error&&n.message?n.message:e(`systemPage.loadFailed`)})]}),(0,j.jsx)(S,{variant:`outline`,size:`sm`,onClick:()=>void o(),disabled:r,children:e(`common.retry`)})]})}):null;let c=t=>e(t===null?`systemPage.work.stateUnknown`:t?`systemPage.work.stateRunning`:`systemPage.work.stateStopped`),l=t=>{if(!t||t.length===0)return e(`systemPage.work.inUseNone`);let n=new Map;for(let e of t)n.set(e.kind,(n.get(e.kind)??0)+1);return[...n.entries()].map(([t,n])=>`${n} ${e(`systemPage.work.usageKinds.${t}`)}`).join(`, `)},u=t=>{switch((t||``).split(`:`)[0]){case`completed`:return e(`work.runs.exitStates.completed`);case`needs_input`:return e(`work.runs.exitStates.needsInput`);case`failed`:return e(`work.runs.exitStates.failed`);case`cancelled`:return e(`work.runs.exitStates.cancelled`);default:return`—`}},d=t=>t===`running`?e(`systemPage.work.stateRunning`):t===`starting`?e(`systemPage.work.stateStarting`):`—`;return(0,j.jsxs)(H,{title:e(`systemPage.work.title`),description:e(`systemPage.work.description`),icon:g,action:(0,j.jsxs)(`span`,{className:s(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.1em]`,t.runtimeAvailable?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-gray-500/10 text-gray-600 dark:text-dark-600`),children:[(0,j.jsx)(`span`,{className:s(`h-1.5 w-1.5 rounded-full`,t.runtimeAvailable?`bg-emerald-500`:`bg-gray-400`)}),t.runtimeAvailable?e(`systemPage.work.runtimeAvailable`):e(`systemPage.work.runtimeUnavailable`)]}),children:[(0,j.jsx)(`div`,{className:`grid gap-3 border-b border-gray-200/70 p-4 dark:border-white/[0.07] sm:grid-cols-2 sm:p-5 lg:grid-cols-4`,children:[[e(`systemPage.work.access`),t.accessMode===`all-users`?e(`systemPage.work.accessAllUsers`):e(`systemPage.work.accessAdmins`)],[e(`systemPage.work.activeRuntimes`),`${t.admission.activeGlobal} / ${t.admission.maxGlobal}`],[e(`systemPage.work.pendingCleanups`),t.recoveryPending],[e(`systemPage.work.orphans`),t.orphanContainers.length]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-xl bg-gray-50 px-3 py-2.5 dark:bg-dark-200/70`,children:[(0,j.jsx)(`div`,{className:`text-[11px] text-gray-500 dark:text-dark-500`,children:e}),(0,j.jsx)(`div`,{className:`mt-1 text-xl text-gray-950 dark:text-dark-950`,children:t})]},String(e)))}),t.recoveryPending>0&&(0,j.jsx)(G,{}),!t.runtimeAvailable&&t.runtimeReason&&(0,j.jsxs)(`div`,{className:`mx-4 mt-4 flex items-start gap-3 rounded-xl border border-gray-200 bg-gray-50 px-4 py-3 text-sm text-gray-600 dark:border-white/[0.07] dark:bg-dark-200/60 dark:text-dark-600 sm:mx-5`,children:[(0,j.jsx)(m,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,j.jsx)(`p`,{children:t.runtimeReason})]}),t.tasks.length===0?(0,j.jsx)(`p`,{className:`px-4 py-4 text-sm text-gray-500 dark:text-dark-500 sm:px-5`,children:e(`systemPage.work.noTasks`)}):(0,j.jsx)(`div`,{className:`overflow-x-auto`,children:(0,j.jsxs)(`table`,{"data-testid":`system-work-table`,className:`w-full min-w-[900px] text-sm`,children:[(0,j.jsx)(`thead`,{className:`text-[11px] uppercase tracking-[0.1em] text-gray-400 dark:text-dark-500`,children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{className:`px-5 py-2 text-start font-medium`,children:e(`systemPage.work.owner`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.task`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.state`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.preview`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.terminals`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.inUse`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:e(`systemPage.work.lastRun`)}),(0,j.jsx)(`th`,{className:`px-5 py-2 text-end font-medium`,children:e(`systemPage.work.updated`)})]})}),(0,j.jsx)(`tbody`,{className:`divide-y divide-gray-100 dark:divide-white/[0.06]`,children:t.tasks.map(t=>(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`td`,{className:`px-5 py-2.5 text-gray-800 dark:text-dark-800`,children:t.ownerUsername}),(0,j.jsxs)(`td`,{className:`px-4 py-2.5`,children:[(0,j.jsx)(`div`,{className:`font-medium text-gray-900 dark:text-dark-900`,children:t.title}),(0,j.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-gray-500 dark:text-dark-500`,children:t.model})]}),(0,j.jsx)(`td`,{className:`px-4 py-2.5`,children:(0,j.jsxs)(`span`,{className:s(`inline-flex items-center gap-1.5 text-xs`,t.running?`text-emerald-700 dark:text-emerald-300`:`text-gray-600 dark:text-dark-600`),children:[(0,j.jsx)(`span`,{className:s(`h-1.5 w-1.5 rounded-full`,t.running===null?`bg-amber-400`:t.running?`bg-emerald-500`:`bg-gray-400`)}),c(t.running)]})}),(0,j.jsx)(`td`,{className:`px-4 py-2.5 text-xs text-gray-600 dark:text-dark-600`,children:d(t.previewStatus)}),(0,j.jsx)(`td`,{className:`px-4 py-2.5 text-xs text-gray-600 dark:text-dark-600`,children:t.terminalSessions}),(0,j.jsx)(`td`,{className:`px-4 py-2.5 text-xs text-gray-600 dark:text-dark-600`,"data-testid":`work-admin-usage`,children:l(t.usage)}),(0,j.jsx)(`td`,{className:`max-w-[240px] px-4 py-2.5 text-xs text-gray-600 dark:text-dark-600`,"data-testid":`work-admin-last-run`,children:t.lastRun?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{title:t.lastRun.exitState,children:u(t.lastRun.exitState)}),t.lastRun.summary&&(0,j.jsx)(`div`,{dir:`auto`,className:`mt-0.5 truncate text-[10px] text-gray-500 dark:text-dark-500`,title:t.lastRun.summary,children:t.lastRun.summary})]}):e(`systemPage.work.noRun`)}),(0,j.jsx)(`td`,{className:`px-5 py-2.5 text-end text-xs text-gray-600 dark:text-dark-600`,children:L.format(t.updatedAt)})]},t.id))})]})})]})},q=()=>{let{t:e}=a(),{data:t,error:n,isLoading:r,isFetching:o,refetch:c}=i({queryKey:[`system-diagnostics`],queryFn:async()=>{let t=await w.getDiagnostics();if(!t.success||!t.data)throw Error(t.error||e(`systemPage.loadFailed`));return t.data},refetchInterval:3e4,refetchIntervalInBackground:!1}),u=n?n instanceof Error?n.message:e(`systemPage.loadFailed`):null;return r&&!t?(0,j.jsx)(O,{width:`wide`,children:(0,j.jsx)(`div`,{className:`flex min-h-[50vh] items-center justify-center`,children:(0,j.jsx)(l,{className:`h-7 w-7 animate-spin text-primary-500`})})}):(0,j.jsxs)(O,{width:`wide`,children:[(0,j.jsx)(D,{eyebrow:e(`systemPage.eyebrow`),title:e(`systemPage.title`),description:e(`systemPage.description`),actions:(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[t&&(0,j.jsx)(`span`,{className:`hidden text-xs text-gray-500 dark:text-dark-500 sm:inline`,children:e(`systemPage.updated`,{date:L.format(t.generatedAt)})}),(0,j.jsxs)(S,{variant:`outline`,size:`sm`,onClick:()=>void c(),disabled:o,children:[(0,j.jsx)(f,{className:s(`h-4 w-4`,o&&`animate-spin`)}),(0,j.jsx)(`span`,{className:`sr-only`,children:e(`systemPage.refresh`)})]})]})}),u&&(0,j.jsxs)(`div`,{className:`mb-6 flex items-center gap-3 rounded-2xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300`,children:[(0,j.jsx)(m,{className:`h-4 w-4 shrink-0`}),(0,j.jsx)(`span`,{children:u})]}),t&&(0,j.jsxs)(`div`,{"data-testid":`system-dashboard`,className:`space-y-4`,children:[(0,j.jsx)(J,{diagnostics:t}),(0,j.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-2`,children:[(0,j.jsx)(Y,{diagnostics:t}),(0,j.jsx)(X,{diagnostics:t})]}),(0,j.jsx)(Z,{diagnostics:t}),(0,j.jsx)(Q,{diagnostics:t}),(0,j.jsx)(K,{}),(0,j.jsx)(P,{}),(0,j.jsx)(ee,{diagnostics:t}),(0,j.jsxs)(`div`,{className:`flex items-start gap-2 px-1 text-xs leading-5 text-gray-500 dark:text-dark-500`,children:[(0,j.jsx)(b,{className:`mt-0.5 h-4 w-4 shrink-0 text-primary-500`}),(0,j.jsx)(`p`,{children:e(`systemPage.securityNote`)})]})]})]})},J=({diagnostics:e})=>{let{t}=a(),n=e.filesystems.find(e=>e.label===`Data directory`)??e.filesystems[0],r=[{label:t(`systemPage.cards.uptime`),value:z(e.host.uptimeSeconds),detail:t(`systemPage.cards.uptimeDetail`,{date:L.format(e.host.bootedAt)}),icon:x},{label:t(`systemPage.cards.memory`),value:`${I.format(e.memory.usedPercent)}%`,detail:t(`systemPage.cards.memoryDetail`,{used:R(e.memory.usedBytes),total:R(e.memory.totalBytes)}),icon:c},{label:t(`systemPage.cards.freeSpace`),value:n?R(n.freeBytes):`—`,detail:n?t(`systemPage.cards.freeSpaceDetail`,{label:n.label,total:R(n.totalBytes)}):t(`systemPage.cards.unavailable`),icon:p},{label:t(`systemPage.cards.containers`),value:e.docker.available?String(e.docker.runningContainers):`—`,detail:e.docker.available?t(`systemPage.cards.containersDetail`,{total:e.docker.totalContainers}):t(`systemPage.cards.dockerUnavailable`),icon:u}];return(0,j.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:r.map(e=>{let t=e.icon;return(0,j.jsxs)(`section`,{className:`rounded-2xl border border-gray-200/80 bg-white/75 p-4 shadow-subtle backdrop-blur-md dark:border-white/[0.08] dark:bg-dark-100/70`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-xs font-medium uppercase tracking-[0.12em] text-gray-500 dark:text-dark-500`,children:e.label}),(0,j.jsx)(t,{className:`h-4 w-4 text-primary-500 dark:text-primary-400`})]}),(0,j.jsx)(`div`,{className:`mt-2 text-2xl font-normal tracking-[-0.04em] text-gray-950 dark:text-dark-950`,children:e.value}),(0,j.jsx)(`p`,{className:`mt-1.5 text-xs text-gray-500 dark:text-dark-500`,children:e.detail})]},e.label)})})},Y=({diagnostics:e})=>{let{t}=a(),{host:n,runtime:r}=e;return(0,j.jsx)(H,{title:t(`systemPage.host.title`),description:t(`systemPage.host.description`),icon:d,action:(0,j.jsx)(`span`,{className:`rounded-full bg-primary-500/10 px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.1em] text-primary-700 dark:text-primary-300`,children:n.containerized?t(`systemPage.host.container`):t(`systemPage.host.native`)}),children:(0,j.jsxs)(`dl`,{className:`px-4 py-2 sm:px-5`,children:[(0,j.jsx)(U,{label:t(`systemPage.host.hostname`),value:n.hostname}),(0,j.jsx)(U,{label:t(`systemPage.host.operatingSystem`),value:`${n.platform} ${n.release} · ${n.architecture}`}),(0,j.jsx)(U,{label:t(`systemPage.host.processor`),value:`${n.cpuModel} · ${n.logicalCpus} ${t(`systemPage.host.logicalCpus`)}`}),(0,j.jsx)(U,{label:t(`systemPage.host.loadAverage`),value:n.loadAverage.map(e=>I.format(e)).join(` · `)}),(0,j.jsx)(U,{label:t(`systemPage.host.libreVersion`),value:r.appVersion}),(0,j.jsx)(U,{label:t(`systemPage.host.nodeVersion`),value:r.nodeVersion}),(0,j.jsx)(U,{label:t(`systemPage.host.process`),value:`PID ${r.processId} · ${z(r.processUptimeSeconds)}`}),(0,j.jsx)(U,{label:t(`systemPage.host.workingDirectory`),value:r.workingDirectory,mono:!0})]})})},X=({diagnostics:e})=>{let{t}=a(),{memory:n}=e;return(0,j.jsx)(H,{title:t(`systemPage.memory.title`),description:t(`systemPage.memory.description`),icon:c,children:(0,j.jsxs)(`div`,{className:`space-y-4 p-4 sm:p-5`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`mb-2 flex items-end justify-between gap-4`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsxs)(`div`,{className:`text-2xl tracking-[-0.04em] text-gray-950 dark:text-dark-950`,children:[I.format(n.usedPercent),`%`]}),(0,j.jsx)(`div`,{className:`mt-1 text-xs text-gray-500 dark:text-dark-500`,children:t(`systemPage.memory.usedOf`,{used:R(n.usedBytes),total:R(n.totalBytes)})})]}),(0,j.jsx)(`span`,{className:`text-xs tabular-nums text-gray-500 dark:text-dark-500`,children:t(`systemPage.memory.free`,{value:R(n.freeBytes)})})]}),(0,j.jsx)(W,{value:n.usedPercent,tone:n.usedPercent>=85?`warning`:`primary`})]}),(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:[[t(`systemPage.memory.processRss`),n.processRssBytes],[t(`systemPage.memory.heapUsed`),n.heapUsedBytes],[t(`systemPage.memory.heapTotal`),n.heapTotalBytes],[t(`systemPage.memory.external`),n.externalBytes]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-xl bg-gray-50 px-3 py-2.5 dark:bg-dark-200/70`,children:[(0,j.jsx)(`div`,{className:`text-[11px] text-gray-500 dark:text-dark-500`,children:e}),(0,j.jsx)(`div`,{className:`mt-1 text-lg text-gray-950 dark:text-dark-950`,children:R(Number(t))})]},String(e)))})]})})},Z=({diagnostics:e})=>{let{t}=a();return(0,j.jsx)(H,{title:t(`systemPage.storage.title`),description:t(`systemPage.storage.description`),icon:p,children:e.filesystems.length===0?(0,j.jsx)(`p`,{className:`p-5 text-sm text-gray-500 dark:text-dark-500`,children:t(`systemPage.storage.empty`)}):(0,j.jsx)(`div`,{className:`grid gap-3 p-4 sm:grid-cols-2 sm:p-5`,children:e.filesystems.map(e=>(0,j.jsxs)(`div`,{className:`rounded-xl border border-gray-200/80 bg-gray-50/70 p-4 dark:border-white/[0.06] dark:bg-dark-200/55`,children:[(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`h3`,{className:`text-sm font-medium text-gray-900 dark:text-dark-900`,children:e.label}),(0,j.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-gray-500 dark:text-dark-500`,children:e.path})]}),(0,j.jsxs)(`span`,{className:`shrink-0 text-sm tabular-nums text-gray-700 dark:text-dark-700`,children:[I.format(e.usedPercent),`%`]})]}),(0,j.jsx)(`div`,{className:`mt-4`,children:(0,j.jsx)(W,{value:e.usedPercent,tone:e.usedPercent>=85?`warning`:`primary`})}),(0,j.jsxs)(`div`,{className:`mt-3 flex justify-between gap-4 text-[11px] text-gray-500 dark:text-dark-500`,children:[(0,j.jsx)(`span`,{children:t(`systemPage.storage.used`,{value:R(e.usedBytes)})}),(0,j.jsx)(`span`,{children:t(`systemPage.storage.free`,{value:R(e.freeBytes)})})]})]},`${e.label}:${e.path}`))})})},Q=({diagnostics:e})=>{let{t}=a(),{docker:n}=e;return(0,j.jsx)(H,{title:t(`systemPage.docker.title`),description:t(`systemPage.docker.description`),icon:u,action:(0,j.jsxs)(`span`,{className:s(`inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.1em]`,n.available?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-gray-500/10 text-gray-600 dark:text-dark-600`),children:[(0,j.jsx)(`span`,{className:s(`h-1.5 w-1.5 rounded-full`,n.available?`bg-emerald-500`:`bg-gray-400`)}),n.available?t(`systemPage.docker.connected`):t(`systemPage.docker.unavailable`)]}),children:n.available?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`grid gap-3 border-b border-gray-200/70 p-4 dark:border-white/[0.07] sm:grid-cols-2 sm:p-5 lg:grid-cols-4`,children:[[t(`systemPage.docker.running`),n.runningContainers],[t(`systemPage.docker.stopped`),n.stoppedContainers],[t(`systemPage.docker.paused`),n.pausedContainers],[t(`systemPage.docker.total`),n.totalContainers]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-xl bg-gray-50 px-3 py-2.5 dark:bg-dark-200/70`,children:[(0,j.jsx)(`div`,{className:`text-[11px] text-gray-500 dark:text-dark-500`,children:e}),(0,j.jsx)(`div`,{className:`mt-1 text-xl text-gray-950 dark:text-dark-950`,children:t})]},String(e)))}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 px-4 py-4 sm:px-5`,children:[n.serverVersion&&(0,j.jsx)($,{label:t(`systemPage.docker.version`),value:n.serverVersion}),n.operatingSystem&&(0,j.jsx)($,{label:t(`systemPage.docker.host`),value:n.operatingSystem}),n.architecture&&(0,j.jsx)($,{label:t(`systemPage.docker.architecture`),value:n.architecture}),n.logicalCpus!==void 0&&(0,j.jsx)($,{label:t(`systemPage.docker.cpus`),value:String(n.logicalCpus)}),n.memoryBytes!==void 0&&(0,j.jsx)($,{label:t(`systemPage.docker.memory`),value:R(n.memoryBytes)})]}),n.containers.length===0?(0,j.jsx)(`p`,{className:`px-5 pb-5 text-sm text-gray-500 dark:text-dark-500`,children:t(`systemPage.docker.empty`)}):(0,j.jsx)(`div`,{className:`overflow-x-auto border-t border-gray-200/70 dark:border-white/[0.07]`,children:(0,j.jsxs)(`table`,{"data-testid":`system-docker-table`,className:`w-full min-w-[760px] text-sm`,children:[(0,j.jsx)(`thead`,{className:`text-[11px] uppercase tracking-[0.1em] text-gray-400 dark:text-dark-500`,children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{className:`px-5 py-2 text-start font-medium`,children:t(`systemPage.docker.container`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:t(`systemPage.docker.image`)}),(0,j.jsx)(`th`,{className:`px-4 py-2 text-start font-medium`,children:t(`systemPage.docker.state`)}),(0,j.jsx)(`th`,{className:`px-5 py-2 text-end font-medium`,children:t(`systemPage.docker.created`)})]})}),(0,j.jsx)(`tbody`,{className:`divide-y divide-gray-100 dark:divide-white/[0.06]`,children:n.containers.map(e=>(0,j.jsxs)(`tr`,{children:[(0,j.jsxs)(`td`,{className:`px-5 py-2.5`,children:[(0,j.jsx)(`div`,{className:`font-medium text-gray-900 dark:text-dark-900`,children:e.name}),(0,j.jsx)(`div`,{className:`mt-0.5 font-mono text-[10px] text-gray-500 dark:text-dark-500`,children:e.id})]}),(0,j.jsx)(`td`,{className:`max-w-[280px] px-4 py-2.5`,children:(0,j.jsx)(`div`,{className:`truncate font-mono text-[11px] text-gray-600 dark:text-dark-600`,title:e.image,children:e.image})}),(0,j.jsxs)(`td`,{className:`px-4 py-2.5`,children:[(0,j.jsx)(`span`,{className:s(`inline-flex rounded-full px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.08em]`,V(e.state)),children:e.state}),(0,j.jsx)(`div`,{className:`mt-1.5 text-[11px] text-gray-500 dark:text-dark-500`,children:e.status})]}),(0,j.jsx)(`td`,{className:`px-5 py-2.5 text-end text-xs text-gray-500 dark:text-dark-500`,children:e.createdAt?L.format(e.createdAt):`—`})]},e.id))})]})})]}):(0,j.jsxs)(`div`,{className:`m-4 flex items-start gap-3 rounded-xl border border-gray-200 bg-gray-50 px-4 py-4 text-sm text-gray-600 dark:border-white/[0.07] dark:bg-dark-200/60 dark:text-dark-600 sm:m-5`,children:[(0,j.jsx)(m,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`p`,{children:n.reason||t(`systemPage.docker.unavailableDetail`)}),(0,j.jsx)(`p`,{className:`mt-2 text-xs text-gray-500 dark:text-dark-500`,children:t(`systemPage.docker.socketStatus`,{status:n.socketMounted?t(`systemPage.docker.mounted`):t(`systemPage.docker.notMounted`)})})]})]})})},$=({label:e,value:t})=>(0,j.jsxs)(`span`,{className:`rounded-full border border-gray-200 bg-white px-3 py-1.5 text-[11px] text-gray-600 dark:border-white/[0.07] dark:bg-dark-200/70 dark:text-dark-600`,children:[(0,j.jsx)(`span`,{className:`text-gray-400 dark:text-dark-500`,children:e}),` `,t]}),ee=({diagnostics:e})=>{let{t}=a();return(0,j.jsx)(H,{title:t(`systemPage.network.title`),description:t(`systemPage.network.description`),icon:h,children:e.network.interfaces.length===0?(0,j.jsx)(`p`,{className:`p-5 text-sm text-gray-500 dark:text-dark-500`,children:t(`systemPage.network.empty`)}):(0,j.jsx)(`div`,{className:`grid gap-3 p-4 sm:grid-cols-2 sm:p-5 xl:grid-cols-3`,children:e.network.interfaces.map(e=>(0,j.jsxs)(`div`,{className:`rounded-xl border border-gray-200/80 bg-gray-50/70 p-4 dark:border-white/[0.06] dark:bg-dark-200/55`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(_,{className:`h-4 w-4 text-primary-500`}),(0,j.jsx)(`h3`,{className:`font-mono text-xs font-medium text-gray-900 dark:text-dark-900`,children:e.name})]}),(0,j.jsx)(`div`,{className:`mt-3 space-y-2`,children:e.addresses.map(e=>(0,j.jsxs)(`div`,{className:`min-w-0 rounded-xl bg-white px-3 py-2 dark:bg-dark-100/80`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-[0.08em] text-gray-400 dark:text-dark-500`,children:e.family}),e.internal&&(0,j.jsx)(`span`,{className:`text-[10px] text-gray-400 dark:text-dark-500`,children:t(`systemPage.network.internal`)})]}),(0,j.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px] text-gray-700 dark:text-dark-700`,children:e.cidr||e.address})]},`${e.family}:${e.address}`))}),(e.receivedBytes!==void 0||e.transmittedBytes!==void 0)&&(0,j.jsxs)(`div`,{className:`mt-3 flex justify-between gap-4 text-[10px] text-gray-500 dark:text-dark-500`,children:[(0,j.jsxs)(`span`,{children:[`↓ `,R(e.receivedBytes??0)]}),(0,j.jsxs)(`span`,{children:[`↑ `,R(e.transmittedBytes??0)]})]})]},e.name))})})};export{q as default};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-vendor-wiHys0m2.js";import{t as r}from"./logger-BR4forr_.js";var i=e(t(),1),a=n(),o=r(`components:turnstile-widget`),s=`https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit`,c=null,l=()=>window.turnstile?Promise.resolve():c||(c=new Promise((e,t)=>{let n=document.querySelector(`script[src="${s}"]`);if(n){n.addEventListener(`load`,()=>e(),{once:!0}),n.addEventListener(`error`,t,{once:!0});return}let r=document.createElement(`script`);r.src=s,r.async=!0,r.defer=!0,r.onload=()=>e(),r.onerror=t,document.head.appendChild(r)}),c),u=({siteKey:e,action:t,disabled:n=!1,errorMessage:r,onTokenChange:s})=>{let c=(0,i.useRef)(null),u=(0,i.useRef)(null),[d,f]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{let n=!1,r=c.current;return s(``),l().then(()=>{!n&&r&&window.turnstile&&(r.innerHTML=``,u.current=window.turnstile.render(r,{sitekey:e,theme:`auto`,size:`flexible`,action:t,callback:e=>s(e),"expired-callback":()=>s(``),"error-callback":()=>s(``)}))}).catch(e=>{o.error(`Turnstile script failed to load:`,e),n||f(!0)}),()=>{n=!0,s(``),u.current&&window.turnstile?.remove?window.turnstile.remove(u.current):r&&(r.innerHTML=``),u.current=null}},[t,s,e]),(0,i.useEffect)(()=>{n&&u.current&&(window.turnstile?.reset(u.current),s(``))},[n,s]),d?(0,a.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300`,children:r}):(0,a.jsx)(`div`,{className:`rounded-lg border border-accent-200 bg-accent-50/40 p-3 transition-opacity dark:border-accent-800/70 dark:bg-accent-950/20 ${n?`pointer-events-none opacity-60`:``}`,"aria-label":`Security verification`,children:(0,a.jsx)(`div`,{ref:c,className:`min-h-[65px]`})})};export{u as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-vendor-CR5VJ85Q.js";import{t as r}from"./logger-BR4forr_.js";var i=e(t(),1),a=n(),o=r(`components:turnstile-widget`),s=`https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit`,c=null,l=()=>window.turnstile?Promise.resolve():c||(c=new Promise((e,t)=>{let n=document.querySelector(`script[src="${s}"]`);if(n){n.addEventListener(`load`,()=>e(),{once:!0}),n.addEventListener(`error`,t,{once:!0});return}let r=document.createElement(`script`);r.src=s,r.async=!0,r.defer=!0,r.onload=()=>e(),r.onerror=t,document.head.appendChild(r)}),c),u=({siteKey:e,action:t,disabled:n=!1,errorMessage:r,onTokenChange:s})=>{let c=(0,i.useRef)(null),u=(0,i.useRef)(null),[d,f]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{let n=!1,r=c.current;return s(``),l().then(()=>{!n&&r&&window.turnstile&&(r.innerHTML=``,u.current=window.turnstile.render(r,{sitekey:e,theme:`auto`,size:`flexible`,action:t,callback:e=>s(e),"expired-callback":()=>s(``),"error-callback":()=>s(``)}))}).catch(e=>{o.error(`Turnstile script failed to load:`,e),n||f(!0)}),()=>{n=!0,s(``),u.current&&window.turnstile?.remove?window.turnstile.remove(u.current):r&&(r.innerHTML=``),u.current=null}},[t,s,e]),(0,i.useEffect)(()=>{n&&u.current&&(window.turnstile?.reset(u.current),s(``))},[n,s]),d?(0,a.jsx)(`div`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300`,children:r}):(0,a.jsx)(`div`,{className:`rounded-lg border border-accent-200 bg-accent-50/40 p-3 transition-opacity dark:border-accent-800/70 dark:bg-accent-950/20 ${n?`pointer-events-none opacity-60`:``}`,"aria-label":`Security verification`,children:(0,a.jsx)(`div`,{ref:c,className:`min-h-[65px]`})})};export{u as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./react-vendor-wiHys0m2.js";import{d as n}from"./router-vendor-HZm4FR0A.js";var r=e(t(),1),i=({onOpen:e})=>{let t=n(),i=(0,r.useRef)(e);return(0,r.useEffect)(()=>{i.current=e},[e]),(0,r.useEffect)(()=>{i.current(),t(`/`,{replace:!0})},[t]),null};export{i as UserManagementPage,i as default};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./react-vendor-CR5VJ85Q.js";import{d as n}from"./router-vendor-DqMnEJWK.js";var r=e(t(),1),i=({onOpen:e})=>{let t=n(),i=(0,r.useRef)(e);return(0,r.useEffect)(()=>{i.current=e},[e]),(0,r.useEffect)(()=>{i.current(),t(`/`,{replace:!0})},[t]),null};export{i as UserManagementPage,i as default};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-vendor-CR5VJ85Q.js";import{C as r,t as i}from"./useQuery-BTKpXudI.js";import{a}from"./logger-BR4forr_.js";import{t as o}from"./chatStore-DpVxt9VX.js";import{t as s}from"./useTranslation-Boi0fB1B.js";import{t as c}from"./utils-B-Bhh1pF.js";import{E as l,G as u,I as d,K as f,Mt as p,R as m,T as h,Yn as g,Z as _,Zn as v,_t as y,c as b,d as x,et as S,f as C,j as w,ot as T,s as E,v as D,vt as O,wr as k,xt as A,zn as ee}from"./ui-vendor-DVTj_sKN.js";import{t as j}from"./Button-j68Q8KVh.js";import{n as M,t as N}from"./client-DppLngAs.js";import{C as P,I as F,P as I,R as L,d as R,s as z,w as B,y as V,z as H}from"./api-BrHW-VGd.js";import{t as U}from"./strandsApi-BFbeEpAY.js";import{t as W}from"./workApi-UPxumrEF.js";import{t as G}from"./authStore-DjAsRpNL.js";import{c as K,t as te}from"./appStore-DkRdQQeY.js";import{c as ne,f as q,m as J,n as re}from"./ui-Aq8MP7Ph.js";import{t as ie}from"./PasswordStrengthMeter-DI4RDv67.js";import{t as Y}from"./SettingsToggle-DrJ0Bapi.js";var X=e(t(),1),Z=n(),ae=`h-11 w-full rounded-xl border border-line bg-surface-raised px-3 text-sm text-ink focus:outline-none focus:ring-2 focus:ring-primary-500 disabled:cursor-not-allowed disabled:opacity-60`;function oe(e,t){return e?.response?.data?.message||(e instanceof Error?e.message:t)||t}function se({user:e,currentUserId:t,onClose:n,onSaved:r}){let{t:i}=s(),[a,o]=(0,X.useState)({username:e?.username??``,email:e?.email??``,password:``,role:e?.role??`user`}),[c,l]=(0,X.useState)(!1),u=(0,X.useRef)(!1),[d,f]=(0,X.useState)(``),p=e?.id===t,m=()=>{u.current||n()};return(0,Z.jsx)(re,{titleId:`user-form-title`,title:i(e?`userManager.form.title.edit`:`userManager.form.title.create`),subtitle:e?(0,Z.jsx)(`span`,{className:`break-all`,children:e.username}):i(`userManager.subtitle`),onClose:m,testId:`user-form-dialog`,children:(0,Z.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),u.current)return;u.current=!0,l(!0),f(``);let n=i(e?`userManager.form.updateFailed`:`userManager.form.createFailed`);try{let t={username:a.username.trim(),email:a.email.trim()||null,role:p?e.role:a.role};a.password&&(t.password=a.password);let o=e?await L.updateUser(e.id,t):await L.createUser({...a,username:a.username.trim(),email:a.email.trim()});if(!o.success||!o.data)throw Error(o.message||n);r(o.data),k.success(i(e?`userManager.form.updateSuccess`:`userManager.form.createSuccess`))}catch(e){f(oe(e,n))}finally{u.current=!1,l(!1)}},className:`space-y-5`,"aria-busy":c,children:[(0,Z.jsxs)(`fieldset`,{disabled:c,className:`min-w-0 space-y-4`,children:[(0,Z.jsx)(J,{id:`user-form-username`,label:i(`userManager.form.username`),autoFocus:!0,autoComplete:`off`,value:a.username,onChange:e=>o({...a,username:e.target.value}),required:!0}),(0,Z.jsx)(J,{id:`user-form-email`,label:`${i(`userManager.form.email`)}${e?` (${i(`common.optional`)})`:``}`,type:`email`,dir:`ltr`,autoComplete:`off`,value:a.email,onChange:e=>o({...a,email:e.target.value}),required:!e}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(J,{id:`user-form-password`,label:`${i(`userManager.form.password`)}${e?` (${i(`common.optional`)})`:``}`,type:`password`,autoComplete:`new-password`,value:a.password,onChange:e=>o({...a,password:e.target.value}),required:!e,helper:e?i(`userManager.form.passwordHint`):void 0}),(0,Z.jsx)(ie,{password:a.password})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(ne,{htmlFor:`user-form-role`,children:i(`userManager.form.role`)}),(0,Z.jsxs)(`select`,{id:`user-form-role`,value:a.role,onChange:e=>o({...a,role:e.target.value}),disabled:p,"aria-describedby":p?`user-form-role-hint`:void 0,className:ae,children:[(0,Z.jsx)(`option`,{value:`user`,children:i(`userManager.roles.user`)}),(0,Z.jsx)(`option`,{value:`admin`,children:i(`userManager.roles.admin`)})]}),p&&(0,Z.jsx)(`p`,{id:`user-form-role-hint`,className:`text-xs text-ink-muted`,children:i(`userManager.directory.editSelfRole`)})]})]}),d&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-sm text-error-600 dark:text-error-400`,children:d}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-line pt-4`,children:[(0,Z.jsx)(j,{type:`button`,variant:`outline`,onClick:m,disabled:c,className:`min-h-11`,children:i(`common.cancel`)}),(0,Z.jsx)(j,{type:`submit`,loading:c,disabled:!a.username.trim(),className:`min-h-11`,children:i(c?e?`userManager.form.updating`:`userManager.form.creating`:e?`userManager.form.updateButton`:`userManager.form.createButton`)})]})]})})}var ce=()=>{let{t:e,i18n:t}=s(),n=r(),a=G(e=>e.user),o=G(e=>e.setUser),[c,l]=(0,X.useState)(null),[f,p]=(0,X.useState)(``),[h,g]=(0,X.useState)(`all`),[v,y]=(0,X.useState)(null),[x,T]=(0,X.useState)(``),[O,A]=(0,X.useState)(null),M=(0,X.useRef)(!1),{data:N=[],isLoading:P,isError:F,isFetching:I,refetch:R}=i({queryKey:[`users`],queryFn:async()=>{let t=await L.getUsers();if(!t.success||!t.data)throw Error(e(`userManager.directory.loadFailed`));return t.data}}),z=()=>{n.invalidateQueries({queryKey:[`users`]})},B=e=>{n.setQueryData([`users`],(t=[])=>t.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[...t,e]),e.id===a?.id&&o(e),l(null),z()},V=f.trim().toLocaleLowerCase(t.language),H=N.filter(e=>(h===`all`||e.role===h)&&`${e.username} ${e.email??``}`.toLocaleLowerCase(t.language).includes(V)),U=H.filter(e=>e.status===`pending`),W=H.filter(e=>e.status!==`pending`),K=N.filter(e=>e.status===`pending`).length,te=N.length-K,q=!!(f||h!==`all`),ie=()=>{p(``),g(`all`)},Y=async t=>{if(!M.current){M.current=!0,A(t.id);try{let n=await L.approveUser(t.id);if(!n.success||!n.data)throw Error(n.message||e(`userManager.approval.failed`));B(n.data),k.success(e(`userManager.approval.approved`,{name:t.username}))}catch(t){k.error(oe(t,e(`userManager.approval.failed`)))}finally{M.current=!1,A(null)}}},ce=async()=>{if(!v||M.current||v.kind===`delete`&&v.user.id===a?.id)return;M.current=!0,A(v.user.id),T(``);let t=e(v.kind===`delete`?`userManager.deleteFailed`:`userManager.mfaResetFailed`);try{if(v.kind===`delete`){let r=await L.deleteUser(v.user.id);if(!r.success)throw Error(r.message||t);n.setQueryData([`users`],(e=[])=>e.filter(e=>e.id!==v.user.id)),z(),k.success(e(`userManager.deleteSuccess`))}else{let n=await L.resetUserMfa(v.user.id);if(!n.success)throw Error(n.message||t);k.success(e(n.data?.removed?`userManager.mfaResetSuccess`:`userManager.mfaResetNothing`,{name:v.user.username}))}y(null)}catch(e){T(oe(e,t))}finally{M.current=!1,A(null)}},le=(e,t)=>{T(``),y({kind:e,user:t})},ue=n=>(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Z.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-surface-subtle text-ink-muted`,"aria-hidden":`true`,children:n.status===`pending`?(0,Z.jsx)(ee,{size:18}):n.role===`admin`?(0,Z.jsx)(d,{size:18}):(0,Z.jsx)(b,{size:18})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,Z.jsx)(`h3`,{className:`min-w-0 break-all text-sm font-medium text-ink`,children:(0,Z.jsx)(`bdi`,{children:n.username})}),n.id===a?.id&&(0,Z.jsxs)(`span`,{className:`text-xs text-ink-muted`,children:[`(`,e(`chatMessage.you`),`)`]}),(0,Z.jsx)(`span`,{className:`rounded-md border border-line px-1.5 py-0.5 text-xs text-ink-muted`,children:e(n.role===`admin`?`userManager.roles.admin`:`userManager.roles.user`)})]}),(0,Z.jsx)(`p`,{className:`mt-1 break-all text-sm text-ink-muted`,children:(0,Z.jsx)(`bdi`,{children:n.email||e(`userManager.noEmail`)})}),(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-ink-subtle`,children:[e(n.status===`pending`?`userManager.approval.registered`:`userManager.columns.created`),`: `,new Date(n.createdAt).toLocaleDateString(t.language)]})]})]}),de=e=>(0,Z.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,Z.jsx)(E,{size:24,className:`mx-auto mb-3 text-ink-subtle`,"aria-hidden":`true`}),(0,Z.jsx)(`p`,{className:`text-sm text-ink-muted`,children:e})]});return(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-5`,"data-testid":`user-directory`,children:[(0,Z.jsxs)(`div`,{className:`rounded-2xl border border-line bg-surface p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`div`,{className:`relative min-w-0 basis-full sm:flex-1 sm:basis-48`,children:[(0,Z.jsx)(u,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute start-3.5 top-3.5 text-ink-subtle`}),(0,Z.jsx)(J,{type:`search`,"aria-label":e(`userManager.search`),placeholder:e(`userManager.search`),value:f,onChange:e=>p(e.target.value),className:`ps-10`})]}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 sm:max-w-36`,children:[(0,Z.jsx)(ne,{htmlFor:`user-role-filter`,className:`sr-only`,children:e(`userManager.columns.role`)}),(0,Z.jsxs)(`select`,{id:`user-role-filter`,value:h,onChange:e=>g(e.target.value),className:ae,children:[(0,Z.jsx)(`option`,{value:`all`,children:e(`userManager.directory.allRoles`)}),(0,Z.jsx)(`option`,{value:`admin`,children:e(`userManager.roles.admin`)}),(0,Z.jsx)(`option`,{value:`user`,children:e(`userManager.roles.user`)})]})]}),(0,Z.jsx)(j,{type:`button`,variant:`outline`,onClick:()=>void R(),disabled:I,className:`min-h-11 min-w-11 px-3`,"aria-label":e(`common.refresh`),title:e(`common.refresh`),children:(0,Z.jsx)(_,{size:16,"aria-hidden":`true`,className:I?`animate-spin motion-reduce:animate-none`:void 0})}),(0,Z.jsxs)(j,{type:`button`,onClick:()=>l(`create`),disabled:!!O,className:`min-h-11`,children:[(0,Z.jsx)(S,{size:16,"aria-hidden":`true`}),e(`userManager.createUser`)]})]}),(0,Z.jsxs)(`div`,{className:`mt-3 flex min-h-5 flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`p`,{role:`status`,className:`text-xs text-ink-muted`,children:P?e(`userManager.loading`):e(`userManager.directory.results`,{visible:H.length,total:N.length})}),q&&(0,Z.jsx)(j,{type:`button`,size:`sm`,variant:`ghost`,onClick:ie,className:`min-h-11 sm:min-h-8`,children:e(`userManager.directory.clearFilters`)})]})]}),F&&(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-error-500/30 p-4`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-ink`,children:e(`userManager.directory.loadFailed`)}),(0,Z.jsx)(j,{type:`button`,variant:`outline`,onClick:()=>void R(),disabled:I,children:e(`common.retry`)})]}),!P&&(!F||N.length>0)&&(0,Z.jsxs)(Z.Fragment,{children:[K>0&&(0,Z.jsxs)(`section`,{"data-testid":`pending-user-approvals`,"aria-labelledby":`pending-users-title`,className:`overflow-hidden rounded-2xl border border-warning-500/30 bg-surface`,children:[(0,Z.jsxs)(`div`,{className:`border-b border-line bg-warning-500/[0.06] p-4`,children:[(0,Z.jsxs)(`h3`,{id:`pending-users-title`,className:`flex items-center gap-2 text-sm font-semibold text-ink`,children:[(0,Z.jsx)(ee,{size:16,"aria-hidden":`true`,className:`text-warning-700 dark:text-warning-400`}),e(`userManager.approval.title`),` `,(0,Z.jsxs)(`span`,{className:`text-ink-muted`,children:[`(`,K,`)`]})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-ink-muted`,children:e(`userManager.approval.description`)})]}),(0,Z.jsxs)(`div`,{className:`divide-y divide-line`,children:[U.map(t=>(0,Z.jsxs)(`div`,{"data-testid":`pending-user-row`,className:`flex flex-col gap-3 p-4 xl:flex-row xl:items-center xl:justify-between`,children:[ue(t),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,Z.jsxs)(j,{type:`button`,size:`sm`,"data-testid":`approve-user-button`,onClick:()=>void Y(t),disabled:!!O,loading:O===t.id,className:`min-h-11 sm:min-h-9`,children:[(0,Z.jsx)(C,{size:16,"aria-hidden":`true`}),e(`userManager.approval.activate`)]}),(0,Z.jsx)(j,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>le(`delete`,t),disabled:!!O,className:`min-h-11 sm:min-h-9`,children:e(`userManager.approval.reject`)})]})]},t.id)),U.length===0&&de(e(`userManager.noUsersMatching`))]})]}),(0,Z.jsxs)(`section`,{"aria-labelledby":`active-users-title`,className:`overflow-hidden rounded-2xl border border-line bg-surface`,children:[(0,Z.jsx)(`div`,{className:`border-b border-line px-4 py-3`,children:(0,Z.jsxs)(`h3`,{id:`active-users-title`,className:`text-sm font-semibold text-ink`,children:[e(`userManager.directory.title`),` `,(0,Z.jsxs)(`span`,{className:`text-ink-muted`,children:[`(`,te,`)`]})]})}),(0,Z.jsxs)(`div`,{className:`divide-y divide-line`,children:[W.map(t=>(0,Z.jsxs)(`div`,{"data-testid":`user-row`,className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[ue(t),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Z.jsxs)(j,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>l(t),disabled:!!O,"aria-label":`${e(`common.edit`)}: ${t.username}`,className:`min-h-11 sm:min-h-9`,children:[(0,Z.jsx)(w,{size:15,"aria-hidden":`true`}),e(`common.edit`)]}),(0,Z.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`reset-mfa-button`,"aria-label":`${e(`userManager.mfaReset`)}: ${t.username}`,title:e(`userManager.mfaReset`),onClick:()=>le(`reset`,t),disabled:!!O,className:`min-h-11 min-w-11 sm:min-h-9 sm:min-w-9 px-2`,children:(0,Z.jsx)(m,{size:16,"aria-hidden":`true`})}),(0,Z.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":`${e(`common.delete`)}: ${t.username}`,title:t.id===a?.id?e(`userManager.cannotDeleteSelf`):e(`common.delete`),onClick:()=>le(`delete`,t),disabled:t.id===a?.id||!!O,className:`min-h-11 min-w-11 sm:min-h-9 sm:min-w-9 px-2 text-error-600 dark:text-error-400`,children:(0,Z.jsx)(D,{size:16,"aria-hidden":`true`})})]})]},t.id)),W.length===0&&de(e(q?`userManager.noUsersMatching`:`userManager.directory.empty`))]})]})]}),c&&(0,Z.jsx)(se,{user:c===`create`?null:c,currentUserId:a?.id,onClose:()=>l(null),onSaved:B},c===`create`?`create`:c.id),v&&(0,Z.jsxs)(re,{titleId:`user-action-title`,title:e(v.kind===`reset`?`userManager.mfaReset`:v.user.status===`pending`?`userManager.approval.reject`:`userManager.directory.deleteTitle`),onClose:()=>{M.current||y(null)},testId:`user-action-dialog`,children:[(0,Z.jsx)(`p`,{className:`break-words text-sm leading-relaxed text-ink-muted`,children:e(v.kind===`delete`?`userManager.deleteConfirm`:`userManager.mfaResetConfirm`,{name:v.user.username})}),x&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-sm text-error-600 dark:text-error-400`,children:x}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2 border-t border-line pt-4`,children:[(0,Z.jsx)(j,{type:`button`,variant:`outline`,onClick:()=>y(null),disabled:!!O,className:`min-h-11`,children:e(`common.cancel`)}),(0,Z.jsx)(j,{type:`button`,variant:`danger`,loading:!!O,onClick:()=>void ce(),className:`min-h-11`,children:e(v.kind===`delete`?`common.delete`:`userManager.mfaReset`)})]})]})]})},le=()=>{let{t:e}=s(),t=G(e=>e.systemInfo),n=G(e=>e.setSystemInfo),r=o(e=>e.loadModels),[i,a]=(0,X.useState)(null),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(0),g=`userManager.agentCliAccess`;return(0,X.useEffect)(()=>{let e=!1;return H.getAccess().then(t=>{e||(t.success&&t.data?(a(t.data.enabled),l(t.data.lockedByEnv)):p(!0))}).catch(()=>{e||p(!0)}),()=>{e=!0}},[m]),(0,Z.jsx)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-100 p-4`,"data-testid":`agent-cli-access-settings`,children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`${g}.title`)}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,children:e(`${g}.description`)}),c&&(0,Z.jsx)(`p`,{className:`text-xs text-amber-600 dark:text-amber-400 mt-1`,children:e(`${g}.lockedByEnv`)})]}),i===null&&f?(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>{p(!1),h(e=>e+1)},children:e(`common.retry`)}):(0,Z.jsx)(Y,{checked:i===!0,onChange:async i=>{d(!0);try{let o=await H.setAccess(i);if(!o.success||!o.data)throw Error(o.error||`Agent access update failed.`);a(o.data.enabled),t&&n({...t,agentCliModelsEnabled:o.data.enabled}),await r({quiet:!0}),k.success(e(`userManager.agentCliAccess.saved`))}catch{k.error(e(`userManager.agentCliAccess.saveFailed`))}finally{d(!1)}},disabled:u||i===null||c})]})})},ue=[`disabled`,`admins`,`all-users`],de=()=>{let{t:e}=s(),t=G(e=>e.systemInfo),n=G(e=>e.setSystemInfo),r=o(e=>e.loadModels),[i,a]=(0,X.useState)(null),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=!1;return U.getAccess().then(t=>{e||(t.success&&t.data?(a(t.data.mode),l(t.data.lockedByEnv)):p(!0))}).catch(()=>{e||p(!0)}),()=>{e=!0}},[m]);let g=async i=>{d(!0);try{let o=await U.setAccess(i);if(!o.success||!o.data)throw Error(o.error||`Strands access update failed.`);a(o.data.mode),t&&n({...t,strandsAccess:o.data.mode}),await r({quiet:!0}),k.success(e(`userManager.strandsAccess.saved`))}catch{k.error(e(`userManager.strandsAccess.saveFailed`))}finally{d(!1)}};return(0,Z.jsx)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-100 p-4`,"data-testid":`strands-access-settings`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`userManager.strandsAccess.title`)}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,children:e(`userManager.strandsAccess.description`)}),c&&(0,Z.jsx)(`p`,{className:`text-xs text-amber-600 dark:text-amber-400 mt-1`,children:e(`userManager.strandsAccess.lockedByEnv`)})]}),i===null&&f?(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>{p(!1),h(e=>e+1)},children:e(`common.retry`)}):(0,Z.jsx)(`div`,{className:`w-44`,children:(0,Z.jsx)(q,{"data-testid":`strands-access-mode`,"aria-label":e(`userManager.strandsAccess.title`),value:i??`disabled`,disabled:u||i===null||c,onChange:e=>void g(e.target.value),options:ue.map(t=>({value:t,label:e(`userManager.strandsAccess.modes.${t}`)}))})})]})})},fe=[{mode:`light`,icon:l,key:`settings.appearance.theme.light`},{mode:`dark`,icon:y,key:`settings.appearance.theme.dark`},{mode:`amoled`,icon:O,key:`settings.appearance.theme.amoled`},{mode:`celestial`,icon:h,key:`settings.appearance.theme.celestial`}],pe=()=>{let{t:e}=s(),t=G(e=>e.systemInfo),n=G(e=>e.setSystemInfo),r=te(e=>e.applyInstanceTheme),[i,a]=(0,X.useState)(null),[o,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=!1;return z.getDefaultTheme().then(t=>{e||(t.success&&t.data?a(K(t.data.theme)):d(!0))}).catch(()=>{e||d(!0)}),()=>{e=!0}},[f]);let m=async o=>{if(i&&i.mode!==o){l(!0);try{let s=await z.setDefaultTheme({...i,mode:o});if(!s.success||!s.data)throw Error(s.error||`Default theme update failed.`);let c=K(s.data.theme);a(c),t&&n({...t,defaultTheme:c}),r(c),k.success(e(`userManager.defaultTheme.saved`))}catch{k.error(e(`userManager.defaultTheme.saveFailed`))}finally{l(!1)}}};return(0,Z.jsx)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-100 p-4`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-[1_1_18rem]`,children:[(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`userManager.defaultTheme.title`)}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,children:e(`userManager.defaultTheme.description`)})]}),i===null&&u?(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>{d(!1),p(e=>e+1)},children:e(`common.retry`)}):(0,Z.jsx)(`div`,{role:`radiogroup`,"aria-label":e(`userManager.defaultTheme.title`),className:`flex max-w-full flex-wrap gap-2`,children:fe.map(({mode:t,icon:n,key:r})=>{let a=i?.mode===t;return(0,Z.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":a,disabled:o||i===null,onClick:()=>void m(t),className:c(`flex min-h-11 max-w-full items-center gap-2 rounded-lg border px-3 py-2 text-sm text-ink transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40 disabled:cursor-not-allowed disabled:opacity-60`,a?`border-line-strong bg-surface-subtle`:`border-line hover:bg-interactive-hover`),children:[(0,Z.jsx)(n,{className:`h-4 w-4`,"aria-hidden":`true`}),e(r)]},t)})})]})})},me=()=>{let{t:e}=s(),[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(!1),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(0);return(0,X.useEffect)(()=>{let e=!1;return R.getAccessMode().then(t=>{e||(t.success&&t.data?(n(t.data.mode),i(t.data.lockedByEnv)):l(!0))}).catch(()=>{e||l(!0)}),()=>{e=!0}},[u]),(0,Z.jsx)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-100 p-4`,children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`userManager.tools.title`)}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,children:e(`userManager.tools.description`)}),r&&(0,Z.jsx)(`p`,{className:`text-xs text-amber-600 dark:text-amber-400 mt-1`,children:e(`userManager.tools.lockedByEnv`)})]}),t===null&&c?(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>{l(!1),d(e=>e+1)},children:e(`common.retry`)}):(0,Z.jsx)(Y,{checked:t===`all-users`,onChange:async t=>{let r=t?`all-users`:`admins`;o(!0);try{let t=await R.setAccessMode(r);if(!t.success)throw Error(t.error||`Tool access update failed.`);n(r),k.success(e(`userManager.tools.saved`))}catch{k.error(e(`userManager.tools.saveFailed`))}finally{o(!1)}},disabled:a||t===null||r})]})})},he={stt:{mode:`all-users`,lockedByEnv:!1},tts:{mode:`all-users`,lockedByEnv:!1},"voice-mode":{mode:`all-users`,lockedByEnv:!1},"voice-cloning":{mode:`all-users`,lockedByEnv:!1}},ge={getModes:async()=>a()?M(he):(await N.get(`/voice-access`)).data,setMode:async(e,t)=>a()?M({feature:e,mode:t}):(await N.put(`/voice-access/${encodeURIComponent(e)}`,{mode:t})).data},_e=[{key:`stt`,labelKey:`userManager.voice.features.stt`},{key:`tts`,labelKey:`userManager.voice.features.tts`},{key:`voice-mode`,labelKey:`userManager.voice.features.voiceMode`},{key:`voice-cloning`,labelKey:`userManager.voice.features.voiceCloning`}],ve=()=>{let{t:e}=s(),[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(!1),[c,l]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=!1;return ge.getModes().then(t=>{e||(t.success&&t.data?n(t.data):o(!0))}).catch(()=>{e||o(!0)}),()=>{e=!0}},[c]);let u=async(t,r)=>{let a=r?`all-users`:`admins`;i(t);try{let r=await ge.setMode(t,a);if(!r.success)throw Error(r.error||`Voice access update failed.`);n(e=>e&&{...e,[t]:{...e[t],mode:a}}),k.success(e(`userManager.voice.saved`))}catch{k.error(e(`userManager.voice.saveFailed`))}finally{i(null)}};return(0,Z.jsxs)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-100 p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`userManager.voice.title`)}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,children:e(`userManager.voice.description`)})]}),t===null&&a&&(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>{o(!1),l(e=>e+1)},children:e(`common.retry`)})]}),(0,Z.jsx)(`div`,{className:`mt-3 space-y-2`,children:_e.map(n=>{let i=t?.[n.key];return(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`text-xs text-gray-700 dark:text-gray-300`,children:e(n.labelKey)}),i?.lockedByEnv&&(0,Z.jsx)(`p`,{className:`text-xs text-amber-600 dark:text-amber-400`,children:e(`userManager.voice.lockedByEnv`)})]}),(0,Z.jsx)(Y,{checked:i?.mode===`all-users`,onChange:e=>u(n.key,e),disabled:i===void 0||r===n.key||i.lockedByEnv})]},n.key)})})]})},ye=[`starttls`,`tls`,`none`],be=e=>({host:e.host??``,port:e.port?String(e.port):``,security:e.security??`starttls`,username:e.username??``,password:``,from:e.from??``,appUrl:e.appUrl??``,rejectUnauthorized:e.rejectUnauthorized!==!1}),xe=()=>{let{t:e}=s(),[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(``),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(!1),[f,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=!1;return P.getSettings().then(t=>{e||(t.success&&t.data?(n(t.data),i(be(t.data)),o(t.data.recipient??``)):g(!0))}).catch(()=>{e||g(!0)}),()=>{e=!0}},[_]);let y=e=>{n(e),i(be(e)),m(!1)},b=(e,t)=>{let n=e.response?.data;return n?.error?n.error:n?.message?n.message:e instanceof Error&&e.message?e.message:t},x=async()=>{if(r){l(!0);try{let t=await P.updateSettings({host:r.host.trim(),port:r.port.trim(),security:r.security,username:r.username.trim(),from:r.from.trim(),appUrl:r.appUrl.trim(),rejectUnauthorized:r.rejectUnauthorized,...r.password?{password:r.password}:f?{password:``}:{}});if(!t.success||!t.data)throw Error(t.error||e(`userManager.emailNotifications.saveFailed`));y(t.data),k.success(e(`userManager.emailNotifications.saved`))}catch(t){k.error(b(t,e(`userManager.emailNotifications.saveFailed`)))}finally{l(!1)}}},S=async t=>{l(!0);try{let n=await P.updateSettings({enabled:t});if(!n.success||!n.data)throw Error(n.error||e(`userManager.emailNotifications.saveFailed`));y(n.data),k.success(e(t?`userManager.emailNotifications.enabledToast`:`userManager.emailNotifications.disabledToast`))}catch(t){k.error(b(t,e(`userManager.emailNotifications.saveFailed`)))}finally{l(!1)}},C=async()=>{d(!0);try{let t=await P.test(a.trim()||void 0);if(!t.success||!t.data?.ok)throw Error(t.error||e(`userManager.emailNotifications.testFailed`));k.success(t.data.sentTo?e(`userManager.emailNotifications.testSent`,{address:t.data.sentTo}):e(`userManager.emailNotifications.testConnected`))}catch(t){k.error(b(t,e(`userManager.emailNotifications.testFailed`)))}finally{d(!1)}},w=(e,t)=>i(n=>n&&{...n,[e]:t}),T=n=>t?.sources?.[n]===`env`?e(`userManager.emailNotifications.fromEnvironment`):null,E=t!==null&&r!==null&&(JSON.stringify(be(t))!==JSON.stringify({...r,password:``})||r.password.length>0||f),D=`mb-1 block text-sm font-medium text-gray-900 dark:text-gray-100`,O=`mb-2 block text-xs text-gray-500 dark:text-gray-400`;return(0,Z.jsxs)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-100 p-4 space-y-4`,"data-testid":`email-notification-settings`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-gray-900 dark:text-gray-100`,children:[(0,Z.jsx)(p,{className:`h-4 w-4 text-primary-500`}),e(`userManager.emailNotifications.title`)]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-gray-500 dark:text-gray-400`,children:e(`userManager.emailNotifications.description`)})]}),(0,Z.jsx)(`div`,{"data-testid":`email-notifications-enabled`,children:(0,Z.jsx)(Y,{checked:t?.enabled===!0,onChange:e=>void S(e),disabled:c||t===null||!t.enabled&&!t.configured})})]}),h&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800 dark:border-amber-900/60 dark:bg-amber-950/40 dark:text-amber-200`,children:[(0,Z.jsx)(`span`,{children:e(`userManager.emailNotifications.loadFailed`)}),(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>{g(!1),v(e=>e+1)},children:e(`common.retry`)})]}),r&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[2fr_1fr]`,children:[(0,Z.jsxs)(`label`,{className:`block`,children:[(0,Z.jsx)(`span`,{className:D,children:e(`userManager.emailNotifications.hostLabel`)}),(0,Z.jsx)(`span`,{className:O,children:T(`host`)??e(`userManager.emailNotifications.hostHint`)}),(0,Z.jsx)(J,{value:r.host,onChange:e=>w(`host`,e.target.value),placeholder:`smtp.example.com`,spellCheck:!1,dir:`ltr`,"data-testid":`email-smtp-host`})]}),(0,Z.jsxs)(`label`,{className:`block`,children:[(0,Z.jsx)(`span`,{className:D,children:e(`userManager.emailNotifications.portLabel`)}),(0,Z.jsx)(`span`,{className:O,children:T(`port`)??e(`userManager.emailNotifications.portHint`)}),(0,Z.jsx)(J,{type:`number`,min:1,max:65535,value:r.port,onChange:e=>w(`port`,e.target.value),placeholder:r.security===`tls`?`465`:`587`,dir:`ltr`,"data-testid":`email-smtp-port`})]})]}),(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsxs)(`label`,{className:`block`,children:[(0,Z.jsx)(`span`,{className:D,children:e(`userManager.emailNotifications.securityLabel`)}),(0,Z.jsx)(`span`,{className:O,children:T(`security`)??e(`userManager.emailNotifications.securityHint`)}),(0,Z.jsx)(q,{value:r.security,onChange:e=>w(`security`,e.target.value),options:ye.map(t=>({value:t,label:e(`userManager.emailNotifications.security.${t}`)})),"data-testid":`email-smtp-security`})]}),(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-4 sm:pt-1`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:D,children:e(`userManager.emailNotifications.verifyLabel`)}),(0,Z.jsx)(`span`,{className:`block text-xs text-gray-500 dark:text-gray-400`,children:e(`userManager.emailNotifications.verifyHint`)})]}),(0,Z.jsx)(Y,{checked:r.rejectUnauthorized,onChange:e=>w(`rejectUnauthorized`,e),disabled:c||r.security===`none`})]})]}),(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsxs)(`label`,{className:`block`,children:[(0,Z.jsx)(`span`,{className:D,children:e(`userManager.emailNotifications.usernameLabel`)}),(0,Z.jsx)(`span`,{className:O,children:T(`username`)??e(`userManager.emailNotifications.usernameHint`)}),(0,Z.jsx)(J,{value:r.username,onChange:e=>w(`username`,e.target.value),autoComplete:`off`,spellCheck:!1,dir:`ltr`,"data-testid":`email-smtp-username`})]}),(0,Z.jsxs)(`label`,{className:`block`,children:[(0,Z.jsx)(`span`,{className:D,children:e(`userManager.emailNotifications.passwordLabel`)}),(0,Z.jsx)(`span`,{className:O,children:T(`password`)??(t?.passwordConfigured?e(`userManager.emailNotifications.passwordStored`):e(`userManager.emailNotifications.passwordHint`))}),(0,Z.jsx)(J,{type:`password`,value:r.password,onChange:e=>{w(`password`,e.target.value),e.target.value&&m(!1)},autoComplete:`new-password`,placeholder:t?.passwordConfigured?`••••••••`:``,dir:`ltr`,"data-testid":`email-smtp-password`}),t?.passwordConfigured&&t.sources?.password===`stored`&&!r.password&&(0,Z.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>m(e.target.checked)}),e(`userManager.emailNotifications.clearPassword`)]})]})]}),(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsxs)(`label`,{className:`block`,children:[(0,Z.jsx)(`span`,{className:D,children:e(`userManager.emailNotifications.fromLabel`)}),(0,Z.jsx)(`span`,{className:O,children:T(`from`)??e(`userManager.emailNotifications.fromHint`)}),(0,Z.jsx)(J,{value:r.from,onChange:e=>w(`from`,e.target.value),placeholder:`Libre WebUI <notifications@example.com>`,spellCheck:!1,dir:`ltr`,"data-testid":`email-smtp-from`})]}),(0,Z.jsxs)(`label`,{className:`block`,children:[(0,Z.jsx)(`span`,{className:D,children:e(`userManager.emailNotifications.appUrlLabel`)}),(0,Z.jsx)(`span`,{className:O,children:T(`appUrl`)??e(`userManager.emailNotifications.appUrlHint`)}),(0,Z.jsx)(J,{value:r.appUrl,onChange:e=>w(`appUrl`,e.target.value),placeholder:`https://chat.example.com`,spellCheck:!1,dir:`ltr`,"data-testid":`email-app-url`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 border-t border-gray-200 dark:border-dark-300 pt-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,Z.jsxs)(`label`,{className:`block sm:max-w-xs sm:flex-1`,children:[(0,Z.jsx)(`span`,{className:D,children:e(`userManager.emailNotifications.testRecipientLabel`)}),(0,Z.jsx)(`span`,{className:O,children:e(`userManager.emailNotifications.testRecipientHint`)}),(0,Z.jsx)(J,{type:`email`,value:a,onChange:e=>o(e.target.value),placeholder:`you@example.com`,spellCheck:!1,dir:`ltr`,"data-testid":`email-test-recipient`})]}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>void C(),disabled:u||c||!t?.configured||E,title:E?e(`userManager.emailNotifications.saveBeforeTest`):void 0,"data-testid":`email-test-button`,children:e(u?`userManager.emailNotifications.testing`:`userManager.emailNotifications.test`)}),(0,Z.jsx)(j,{size:`sm`,onClick:()=>void x(),disabled:c||!E,"data-testid":`email-save-button`,children:e(c?`userManager.emailNotifications.saving`:`userManager.emailNotifications.save`)})]})]})]})]})},Se=()=>{let{t:e}=s(),[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(!1),[c,l]=(0,X.useState)(0);return(0,X.useEffect)(()=>{let e=!1;return F.getMfaPolicy().then(t=>{e||(t.success&&t.data?n(t.data):o(!0))}).catch(()=>{e||o(!0)}),()=>{e=!0}},[c]),(0,Z.jsxs)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-100 p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`userManager.mfaPolicy.title`)}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,children:e(`userManager.mfaPolicy.description`)})]}),t===null&&a&&(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>{o(!1),l(e=>e+1)},children:e(`common.retry`)})]}),(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`text-sm text-gray-900 dark:text-gray-100`,children:e(`userManager.mfaPolicy.requireAll`)}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:t?.locked?e(`userManager.mfaPolicy.lockedByEnv`):e(`userManager.mfaPolicy.requireAllHint`)})]}),(0,Z.jsx)(Y,{checked:t?.mode===`required`,disabled:t===null||t.locked||r,onChange:async t=>{let r=t?`required`:`optional`;i(!0);try{let t=await F.setMfaPolicy(r);if(!t.success||!t.data)throw Error(t.error||`MFA policy update failed.`);n(t.data),k.success(e(`userManager.mfaPolicy.saved`))}catch{k.error(e(`userManager.mfaPolicy.saveFailed`))}finally{i(!1)}}})]})]})},Ce=()=>{let{t:e}=s(),[t,n]=(0,X.useState)([]),[r,i]=(0,X.useState)([]),[a,o]=(0,X.useState)(!1),[c,l]=(0,X.useState)(!0),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(``),[_,y]=(0,X.useState)(!1),[b,C]=(0,X.useState)(null),[w,T]=(0,X.useState)(``),[O,A]=(0,X.useState)(null),[ee,M]=(0,X.useState)(``),[N,P]=(0,X.useState)(null),[F,R]=(0,X.useState)(!1),z=(0,X.useMemo)(()=>{let e=new Map;return r.forEach(t=>e.set(t.id,t.username)),e},[r]),B=(0,X.useCallback)(async()=>{l(!0),o(!1);try{let[e,t]=await Promise.all([I.getGroups(),L.getUsers()]);if(!e.success||!e.data)throw Error(e.error||`Failed to load groups.`);n(e.data),t.success&&t.data&&i(t.data)}catch{o(!0)}finally{l(!1)}},[]);(0,X.useEffect)(()=>{let e=setTimeout(()=>void B(),0);return()=>clearTimeout(e)},[B]);let V=async t=>{if(t.preventDefault(),!f.trim()){k.error(e(`userManager.groups.nameRequired`,`Give the group a name.`));return}y(!0);try{let t=await I.createGroup({name:f.trim(),description:m.trim()||void 0});if(!t.success)throw Error(t.error||`Group creation failed.`);p(``),h(``),d(!1),k.success(e(`userManager.groups.created`,`Group created.`)),await B()}catch(t){k.error(t instanceof Error&&t.message?t.message:e(`userManager.groups.createFailed`,`The group could not be created.`))}finally{y(!1)}},H=async t=>{A(t.id);try{let n=await I.deleteGroup(t.id);if(!n.success)throw Error(n.error||`Group delete failed.`);k.success(e(`userManager.groups.deleted`,`Group deleted.`)),b===t.id&&C(null),await B()}catch(t){k.error(t instanceof Error&&t.message?t.message:e(`userManager.groups.deleteFailed`,`The group could not be deleted.`))}finally{A(null)}},U=async t=>{if(w){A(t.id);try{let n=await I.addGroupMember(t.id,w);if(!n.success)throw Error(n.error||`Member add failed.`);T(``),k.success(e(`userManager.groups.memberAdded`,`Member added.`)),await B()}catch(t){k.error(t instanceof Error&&t.message?t.message:e(`userManager.groups.memberAddFailed`,`The member could not be added.`))}finally{A(null)}}},W=async(t,n)=>{A(t.id);try{let r=await I.removeGroupMember(t.id,n);if(!r.success)throw Error(r.error||`Member remove failed.`);k.success(e(`userManager.groups.memberRemoved`,`Member removed.`)),await B()}catch(t){k.error(t instanceof Error&&t.message?t.message:e(`userManager.groups.memberRemoveFailed`,`The member could not be removed.`))}finally{A(null)}},G=async t=>{if(M(t),P(null),t){R(!0);try{let e=await I.getEffectiveAccess(t);if(!e.success||!e.data)throw Error(e.error||`Access lookup failed.`);P(e.data)}catch(t){k.error(t instanceof Error&&t.message?t.message:e(`userManager.groups.accessLookupFailed`,`The effective access could not be loaded.`))}finally{R(!1)}}},K=e=>e.map(e=>({value:e.id,label:e.username}));return(0,Z.jsxs)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-100 p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-gray-100`,children:[(0,Z.jsx)(E,{className:`h-4 w-4 text-primary-500`}),e(`userManager.groups.title`,`Groups`)]}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,children:e(`userManager.groups.description`,`Group accounts to manage shared access, and inspect what any account can effectively do.`)})]}),a?(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>void B(),children:e(`common.retry`)}):(0,Z.jsxs)(j,{size:`sm`,variant:`outline`,onClick:()=>d(e=>!e),className:`gap-1.5`,children:[(0,Z.jsx)(S,{size:14}),e(`userManager.groups.newGroup`,`New group`)]})]}),u&&(0,Z.jsxs)(`form`,{onSubmit:V,className:`mt-4 rounded-lg border border-gray-200 dark:border-dark-300 bg-gray-50 dark:bg-dark-50 p-4 space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsxs)(`label`,{className:`block`,children:[(0,Z.jsx)(`span`,{className:`mb-1 block text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`userManager.groups.nameLabel`,`Name`)}),(0,Z.jsx)(J,{value:f,onChange:e=>p(e.target.value)})]}),(0,Z.jsxs)(`label`,{className:`block`,children:[(0,Z.jsx)(`span`,{className:`mb-1 block text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`userManager.groups.descriptionLabel`,`Description (optional)`)}),(0,Z.jsx)(J,{value:m,onChange:e=>h(e.target.value)})]})]}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(j,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>d(!1),children:e(`common.cancel`)}),(0,Z.jsx)(j,{type:`submit`,size:`sm`,disabled:_,children:_?e(`userManager.groups.creating`,`Creating…`):e(`userManager.groups.create`,`Create group`)})]})]}),(0,Z.jsx)(`div`,{className:`mt-4 space-y-3`,children:c?(0,Z.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:e(`common.loading`)}):a?(0,Z.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:e(`userManager.groups.loadFailed`,`The groups could not be loaded.`)}):t.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:e(`userManager.groups.empty`,`No groups yet.`)}):t.map(t=>{let n=b===t.id,i=new Set(t.members.map(e=>e.user_id)),a=r.filter(e=>!i.has(e.id));return(0,Z.jsxs)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-gray-50 dark:bg-dark-100`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 p-4`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-2 text-start`,onClick:()=>{C(n?null:t.id),T(``)},"aria-expanded":n,children:[n?(0,Z.jsx)(v,{className:`h-4 w-4 shrink-0 text-gray-500 dark:text-gray-400`}):(0,Z.jsx)(g,{className:`h-4 w-4 shrink-0 text-gray-500 dark:text-gray-400`}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsxs)(`span`,{className:`block truncate text-sm font-medium text-gray-900 dark:text-gray-100`,children:[t.name,(0,Z.jsx)(`span`,{className:`ms-2 text-xs font-normal text-gray-500 dark:text-gray-400`,children:e(`userManager.groups.memberCount`,{count:t.members.length,defaultValue:`Members: {{count}}`})})]}),t.description&&(0,Z.jsx)(`span`,{className:`block truncate text-xs text-gray-500 dark:text-gray-400`,children:t.description})]})]}),(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>void H(t),disabled:O===t.id,"aria-label":e(`userManager.groups.deleteGroup`,`Delete group`),className:`text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 hover:bg-red-50 dark:hover:bg-red-900/20`,children:(0,Z.jsx)(D,{size:16})})]}),n&&(0,Z.jsxs)(`div`,{className:`border-t border-gray-200 dark:border-dark-300 p-4 space-y-3`,children:[t.members.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:e(`userManager.groups.noMembers`,`No members yet.`)}):(0,Z.jsx)(`div`,{className:`space-y-2`,children:t.members.map(n=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-50 px-3 py-2`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`p`,{className:`truncate text-sm text-gray-900 dark:text-gray-100`,children:z.get(n.user_id)||n.user_id}),(0,Z.jsxs)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:[e(`userManager.groups.addedAt`,`Added`),`:`,` `,new Date(n.added_at).toLocaleDateString()]})]}),(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>void W(t,n.user_id),disabled:O===t.id,"aria-label":e(`userManager.groups.removeMember`,`Remove member`),children:(0,Z.jsx)(x,{size:16})})]},n.user_id))}),a.length>0&&(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Z.jsx)(`div`,{className:`flex-1`,children:(0,Z.jsx)(q,{label:e(`userManager.groups.addMember`,`Add member`),value:w,onChange:e=>T(e.target.value),options:[{value:``,label:e(`userManager.groups.selectUser`,`Select a user…`)},...K(a)]})}),(0,Z.jsx)(j,{size:`sm`,onClick:()=>void U(t),disabled:!w||O===t.id,className:`mb-0.5`,children:e(`userManager.groups.add`,`Add`)})]})]})]},t.id)})}),(0,Z.jsxs)(`div`,{className:`mt-6 border-t border-gray-200 dark:border-dark-300 pt-4 space-y-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`userManager.groups.effectiveTitle`,`Effective access`)}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,children:e(`userManager.groups.effectiveDescription`,`Pick an account to see the access it ends up with across role, groups, and grants.`)})]}),(0,Z.jsx)(q,{value:ee,onChange:e=>void G(e.target.value),options:[{value:``,label:e(`userManager.groups.selectUser`,`Select a user…`)},...K(r)]}),F&&(0,Z.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:e(`common.loading`)}),N&&!F&&(0,Z.jsxs)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-gray-50 dark:bg-dark-50 p-4 space-y-3`,children:[(0,Z.jsxs)(`p`,{className:`text-sm text-gray-900 dark:text-gray-100`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:N.username}),(0,Z.jsxs)(`span`,{className:`text-gray-500 dark:text-gray-400`,children:[` · `,e(`userManager.groups.roleLabel`,`Role`),`: `,N.role,` · `,e(`userManager.groups.statusLabel`,`Status`),`: `,N.status]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`mb-1 text-xs font-medium text-gray-500 dark:text-gray-400`,children:e(`userManager.groups.memberOf`,`Groups`)}),N.groups.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:e(`common.none`)}):(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:N.groups.map(e=>(0,Z.jsx)(`span`,{className:`rounded-full bg-primary-100 dark:bg-primary-900/30 px-2 py-0.5 text-xs text-primary-700 dark:text-primary-300`,children:e.name},e.id))})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`mb-1 text-xs font-medium text-gray-500 dark:text-gray-400`,children:e(`userManager.groups.featuresLabel`,`Feature access`)}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:Object.entries(N.features).map(([t,n])=>(0,Z.jsxs)(`span`,{className:n?`rounded-full bg-green-100 dark:bg-green-900/30 px-2 py-0.5 text-xs text-green-700 dark:text-green-300`:`rounded-full bg-gray-100 dark:bg-dark-200 px-2 py-0.5 text-xs text-gray-500 dark:text-gray-400`,children:[t,`: `,e(n?`common.yes`:`common.no`)]},t))})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`mb-1 text-xs font-medium text-gray-500 dark:text-gray-400`,children:e(`userManager.groups.grantsLabel`,`Grants`)}),N.grants.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:e(`common.none`)}):(0,Z.jsx)(`div`,{className:`space-y-1`,children:N.grants.map(t=>(0,Z.jsxs)(`p`,{className:`text-xs text-gray-700 dark:text-gray-300`,children:[t.resourceType,`/`,t.resourceId,` ·`,` `,t.permission,` `,(0,Z.jsxs)(`span`,{className:`text-gray-500 dark:text-gray-400`,children:[`(`,e(`userManager.groups.grantVia`,`via`),` `,t.via,`)`]})]},t.id))})]})]})]})]})},we={success:`bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300`,denied:`bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300`,failure:`bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300`},Te=()=>{let{t:e}=s(),[t,n]=(0,X.useState)([]),[r,i]=(0,X.useState)(!0),[a,o]=(0,X.useState)(!1),[c,l]=(0,X.useState)(null),[u,d]=(0,X.useState)(``),[p,m]=(0,X.useState)(``),[h,y]=(0,X.useState)(`50`),b=(0,X.useCallback)(async()=>{i(!0),o(!1);try{let e=Number(h),t=await I.getAuditEvents({action:u.trim()||void 0,result:p||void 0,limit:Number.isInteger(e)&&e>0?e:void 0});if(!t.success||!t.data)throw Error(t.error||`Failed to load audit events.`);n(t.data)}catch{o(!0)}finally{i(!1)}},[u,p,h]);(0,X.useEffect)(()=>{let e=setTimeout(()=>void b(),0);return()=>clearTimeout(e)},[]);let x=t=>{switch(t){case`success`:return e(`userManager.audit.resultSuccess`,`Success`);case`denied`:return e(`userManager.audit.resultDenied`,`Denied`);case`failure`:return e(`userManager.audit.resultFailure`,`Failure`);default:return t}};return(0,Z.jsxs)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-100 p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-gray-100`,children:[(0,Z.jsx)(f,{className:`h-4 w-4 text-primary-500`}),e(`userManager.audit.title`,`Security audit log`)]}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,children:e(`userManager.audit.description`,`Recent sign-ins, permission checks, and administrative changes on this instance.`)})]}),(0,Z.jsxs)(j,{size:`sm`,variant:`outline`,onClick:()=>void b(),disabled:r,className:`gap-1.5`,children:[(0,Z.jsx)(_,{size:14,className:r?`animate-spin`:void 0}),e(`common.refresh`)]})]}),(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-3`,children:[(0,Z.jsxs)(`label`,{className:`block`,children:[(0,Z.jsx)(`span`,{className:`mb-1 block text-xs font-medium text-gray-500 dark:text-gray-400`,children:e(`userManager.audit.actionFilter`,`Action`)}),(0,Z.jsx)(J,{value:u,onChange:e=>d(e.target.value),placeholder:e(`userManager.audit.actionPlaceholder`,`e.g. auth.login`),spellCheck:!1,dir:`ltr`})]}),(0,Z.jsxs)(`label`,{className:`block`,children:[(0,Z.jsx)(`span`,{className:`mb-1 block text-xs font-medium text-gray-500 dark:text-gray-400`,children:e(`userManager.audit.resultFilter`,`Result`)}),(0,Z.jsx)(q,{value:p,onChange:e=>m(e.target.value),options:[{value:``,label:e(`common.all`)},{value:`success`,label:e(`userManager.audit.resultSuccess`,`Success`)},{value:`denied`,label:e(`userManager.audit.resultDenied`,`Denied`)},{value:`failure`,label:e(`userManager.audit.resultFailure`,`Failure`)}]})]}),(0,Z.jsxs)(`label`,{className:`block`,children:[(0,Z.jsx)(`span`,{className:`mb-1 block text-xs font-medium text-gray-500 dark:text-gray-400`,children:e(`userManager.audit.limitFilter`,`Limit`)}),(0,Z.jsx)(J,{type:`number`,min:1,max:500,value:h,onChange:e=>y(e.target.value),dir:`ltr`})]})]}),(0,Z.jsx)(`div`,{className:`mt-4 space-y-2`,children:r?(0,Z.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:e(`common.loading`)}):a?(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:e(`userManager.audit.loadFailed`,`The audit log could not be loaded.`)}),(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>void b(),children:e(`common.retry`)})]}):t.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:e(`userManager.audit.empty`,`No audit events recorded yet.`)}):t.map(t=>{let n=c===t.id,r=t.details&&Object.keys(t.details).length>0;return(0,Z.jsxs)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-gray-50 dark:bg-dark-50`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 px-3 py-2 text-start`,onClick:()=>l(n?null:t.id),"aria-expanded":n,children:[r?n?(0,Z.jsx)(v,{className:`h-4 w-4 shrink-0 text-gray-500 dark:text-gray-400`}):(0,Z.jsx)(g,{className:`h-4 w-4 shrink-0 text-gray-500 dark:text-gray-400`}):(0,Z.jsx)(`span`,{className:`h-4 w-4 shrink-0`}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:t.action}),(0,Z.jsx)(`span`,{className:`rounded-full px-2 py-0.5 text-xs font-medium ${we[t.result]||`bg-gray-100 dark:bg-dark-200 text-gray-600 dark:text-gray-300`}`,children:x(t.result)})]}),(0,Z.jsxs)(`span`,{className:`mt-0.5 block truncate text-xs text-gray-500 dark:text-gray-400`,children:[new Date(t.occurredAt).toLocaleString(),` · `,e(`userManager.audit.actor`,`Actor`),`:`,` `,t.actorUserId||t.actorKind,t.targetType&&(0,Z.jsxs)(Z.Fragment,{children:[` · `,e(`userManager.audit.target`,`Target`),`:`,` `,t.targetType,t.targetId?`/${t.targetId}`:``]})]})]})]}),n&&r&&(0,Z.jsx)(`pre`,{dir:`ltr`,className:`mx-3 mb-3 overflow-x-auto rounded-md bg-white dark:bg-dark-100 border border-gray-200 dark:border-dark-300 p-3 text-xs text-gray-700 dark:text-gray-300`,children:JSON.stringify(t.details,null,2)})]},t.id)})})]})},Ee=()=>{let{t:e}=s(),[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(!1),[c,l]=(0,X.useState)(0);return(0,X.useEffect)(()=>{let e=!1;return V.getModelAccess().then(t=>{e||(t.success&&t.data?n(t.data.mode):o(!0))}).catch(()=>{e||o(!0)}),()=>{e=!0}},[c]),(0,Z.jsx)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-100 p-4`,children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`userManager.modelAccess.title`)}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,children:e(`userManager.modelAccess.description`)})]}),t===null&&a?(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>{o(!1),l(e=>e+1)},children:e(`common.retry`)}):(0,Z.jsx)(Y,{checked:t===`all-users`,onChange:async t=>{let r=t?`all-users`:`admins`;i(!0);try{if(!(await V.setModelAccess(r)).success)throw Error(`Model download access update failed.`);n(r),k.success(e(`userManager.modelAccess.saved`))}catch{k.error(e(`userManager.modelAccess.saveFailed`))}finally{i(!1)}},disabled:r||t===null})]})})},De=()=>{let{t:e}=s(),[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(``),[a,o]=(0,X.useState)(!1),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=!1;return V.getSettings().then(t=>{e||(t.success&&t.data?(n(t.data),i(t.data.baseUrl)):l(!0))}).catch(()=>{e||l(!0)}),()=>{e=!0}},[u]);let f=async t=>{o(!0);try{let r=await V.updateSettings(t);if(!r.success||!r.data)throw Error(r.message||`update failed`);n(r.data),i(r.data.baseUrl),k.success(e(`userManager.ollamaProvider.saved`))}catch{k.error(e(`userManager.ollamaProvider.saveFailed`))}finally{o(!1)}},p=t!==null&&r.trim()!==t.baseUrl;return(0,Z.jsxs)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-100 p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`userManager.ollamaProvider.title`)}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,children:e(`userManager.ollamaProvider.description`)})]}),t===null&&c?(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>{l(!1),d(e=>e+1)},children:e(`common.retry`)}):(0,Z.jsx)(Y,{checked:t?.enabled===!0,onChange:e=>void f({enabled:e}),disabled:a||t===null})]}),t!==null&&(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,Z.jsx)(`input`,{className:`min-w-0 flex-1 rounded-lg border border-gray-200 bg-white px-3 py-1.5 font-mono text-xs text-gray-900 focus:border-primary-400 focus:outline-none dark:border-dark-300 dark:bg-dark-50 dark:text-gray-100`,value:r,onChange:e=>i(e.target.value),placeholder:`http://localhost:11434`,spellCheck:!1,"aria-label":e(`userManager.ollamaProvider.baseUrlLabel`)}),(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>void f({baseUrl:r.trim()}),disabled:a||!p||!r.trim(),children:e(`common.save`)})]})]})},Oe=()=>{let{t:e}=s(),[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(!1),[c,l]=(0,X.useState)(0);return(0,X.useEffect)(()=>{let e=!1;return B.getAccess().then(t=>{e||(t.success&&t.data?n(t.data.mode):o(!0))}).catch(()=>{e||o(!0)}),()=>{e=!0}},[c]),(0,Z.jsx)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-100 p-4`,children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`userManager.webSearchAccess.title`)}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,children:e(`userManager.webSearchAccess.description`)})]}),t===null&&a?(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>{o(!1),l(e=>e+1)},children:e(`common.retry`)}):(0,Z.jsx)(Y,{checked:t===`all-users`,onChange:async t=>{let r=t?`all-users`:`admins`;i(!0);try{if(!(await B.setAccess(r)).success)throw Error(`Web search access update failed.`);n(r),k.success(e(`userManager.webSearchAccess.saved`))}catch{k.error(e(`userManager.webSearchAccess.saveFailed`))}finally{i(!1)}},disabled:r||t===null})]})})},ke=()=>{let{t:e}=s(),t=G(e=>e.refreshWorkAccess),[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(!1),[o,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(0);return(0,X.useEffect)(()=>{let e=!1;return W.access().then(t=>{e||(t.success&&t.data?r(t.data.mode):c(!0))}).catch(()=>{e||c(!0)}),()=>{e=!0}},[l]),(0,Z.jsx)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-100 p-4`,children:(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`userManager.workAccess.title`)}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,children:e(`userManager.workAccess.description`)})]}),n===null&&o?(0,Z.jsx)(j,{size:`sm`,variant:`outline`,onClick:()=>{c(!1),u(e=>e+1)},children:e(`common.retry`)}):(0,Z.jsx)(Y,{checked:n===`all-users`,onChange:async n=>{let i=n?`all-users`:`admins`;a(!0);try{if(!(await W.setAccess(i)).success)throw Error(`Work access update failed.`);r(i),await t(),k.success(e(`userManager.workAccess.saved`))}catch{k.error(e(`userManager.workAccess.saveFailed`))}finally{a(!1)}},disabled:i||n===null})]})})},Q={name:``,image:``,memoryLimit:``,cpuLimit:``,pidsLimit:``,workspaceSize:``,idleMinutes:``,networkDefault:`inherit`,guiEnabled:!1,takeoverEnabled:!0,approvalsRequired:!1},Ae={...Q,name:`Work Computer`,image:`libre-work-computer:latest`,memoryLimit:`4g`,networkDefault:`on`,guiEnabled:!0},je=e=>({name:e.name,guiEnabled:e.guiEnabled===!0,takeoverEnabled:e.takeoverEnabled!==!1,approvalsRequired:e.approvalsRequired===!0,image:e.image??``,memoryLimit:e.memoryLimit??``,cpuLimit:e.cpuLimit??``,pidsLimit:e.pidsLimit===void 0?``:String(e.pidsLimit),workspaceSize:e.workspaceSize??``,idleMinutes:e.idleTimeoutMs===void 0?``:String(e.idleTimeoutMs/6e4),networkDefault:e.networkDefault===void 0?`inherit`:e.networkDefault?`on`:`off`}),Me=e=>[e.pidsLimit,e.idleMinutes].some(e=>e.trim()!==``&&!Number.isFinite(Number(e))),Ne=e=>({name:e.name.trim(),image:e.image.trim()||null,memoryLimit:e.memoryLimit.trim()||null,cpuLimit:e.cpuLimit.trim()||null,pidsLimit:e.pidsLimit.trim()?Number(e.pidsLimit):null,workspaceSize:e.workspaceSize.trim()||null,idleTimeoutMs:e.idleMinutes.trim()?Math.round(Number(e.idleMinutes)*6e4):null,networkDefault:e.networkDefault===`inherit`?null:e.networkDefault===`on`,guiEnabled:e.guiEnabled?!0:null,takeoverEnabled:e.takeoverEnabled?null:!1,approvalsRequired:e.approvalsRequired?!0:null}),Pe=()=>{let{t:e}=s(),[t,n]=(0,X.useState)([]),[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(Q),[c,l]=(0,X.useState)(!1),u=async()=>{try{let e=await W.listPolicies();e.success&&e.data&&n(e.data)}catch{}};(0,X.useEffect)(()=>{let e=!1;return W.listPolicies().then(t=>{!e&&t.success&&t.data&&n(t.data)}).catch(()=>{}),()=>{e=!0}},[]);let d=e=>({value:a[e],onChange:t=>o(n=>({...n,[e]:t.target.value}))}),f=async()=>{if(Me(a)){k.error(e(`userManager.workPolicies.invalidNumber`));return}l(!0);try{let t=Ne(a),n=r===`new`?await W.createPolicy(t):await W.updatePolicy(r,t);if(!n.success)throw Error(n.error||`Policy save failed.`);k.success(e(`userManager.workPolicies.saved`)),i(null),o(Q),await u()}catch(t){k.error(t instanceof Error&&t.message?t.message:e(`userManager.workPolicies.failed`))}finally{l(!1)}},p=async t=>{if(window.confirm(e(`userManager.workPolicies.deleteConfirm`)))try{let n=await W.deletePolicy(t.id);if(!n.success)throw Error(n.error||`Policy delete failed.`);k.success(e(`userManager.workPolicies.deleted`)),await u()}catch(t){k.error(t instanceof Error&&t.message?t.message:e(`userManager.workPolicies.failed`))}},m=(e,t,n)=>(0,Z.jsxs)(`label`,{className:`block text-xs`,children:[(0,Z.jsx)(`span`,{className:`mb-1 block font-medium text-gray-700 dark:text-gray-300`,children:t}),(0,Z.jsx)(`input`,{...d(e),placeholder:n,spellCheck:!1,className:`w-full rounded-lg border border-gray-200 bg-white px-2.5 py-1.5 text-sm text-gray-900 outline-none focus:border-primary-500 dark:border-dark-300 dark:bg-dark-50 dark:text-gray-100`})]});return(0,Z.jsxs)(`div`,{className:`rounded-lg border border-gray-200 dark:border-dark-300 bg-white dark:bg-dark-100 p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:e(`userManager.workPolicies.title`)}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-1`,children:e(`userManager.workPolicies.description`)})]}),r===null&&(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Z.jsxs)(j,{size:`sm`,variant:`outline`,className:`whitespace-nowrap`,"data-testid":`work-policy-computer-preset`,onClick:()=>{o(Ae),i(`new`)},children:[(0,Z.jsx)(A,{size:14,className:`shrink-0`}),(0,Z.jsx)(`span`,{className:`ms-1.5`,children:e(`userManager.workPolicies.computerPreset`)})]}),(0,Z.jsxs)(j,{size:`sm`,variant:`outline`,className:`whitespace-nowrap`,onClick:()=>{o(Q),i(`new`)},children:[(0,Z.jsx)(S,{size:14,className:`shrink-0`}),(0,Z.jsx)(`span`,{className:`ms-1.5`,children:e(`userManager.workPolicies.add`)})]})]})]}),t.length===0&&r===null&&(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-gray-500 dark:text-gray-400`,children:e(`userManager.workPolicies.empty`)}),t.length>0&&(0,Z.jsx)(`ul`,{className:`mt-3 divide-y divide-gray-100 dark:divide-dark-300`,children:t.map(t=>(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100`,children:t.name}),(0,Z.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-gray-500 dark:text-gray-400`,children:[t.memoryLimit,t.cpuLimit&&`cpu ${t.cpuLimit}`,t.pidsLimit&&`pids ${t.pidsLimit}`,t.workspaceSize,t.idleTimeoutMs!==void 0&&`idle ${Math.round(t.idleTimeoutMs/6e4)}m`,t.networkDefault!==void 0&&`net ${t.networkDefault?`on`:`off`}`,t.image].filter(Boolean).join(` · `)||`—`})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,Z.jsx)(j,{size:`sm`,variant:`ghost`,"aria-label":e(`userManager.workPolicies.edit`),onClick:()=>{o(je(t)),i(t.id)},children:(0,Z.jsx)(T,{size:14})}),(0,Z.jsx)(j,{size:`sm`,variant:`ghost`,"aria-label":e(`userManager.workPolicies.delete`),onClick:()=>void p(t),children:(0,Z.jsx)(D,{size:14})})]})]},t.id))}),r!==null&&(0,Z.jsxs)(`div`,{className:`mt-4 rounded-lg border border-gray-200 p-3 dark:border-dark-300`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[m(`name`,e(`userManager.workPolicies.name`),`heavy`),m(`memoryLimit`,e(`userManager.workPolicies.memory`),`4g`),m(`cpuLimit`,e(`userManager.workPolicies.cpu`),`4`),m(`pidsLimit`,e(`userManager.workPolicies.pids`),`512`),m(`workspaceSize`,e(`userManager.workPolicies.workspaceSize`),`20Gi`),m(`idleMinutes`,e(`userManager.workPolicies.idleMinutes`),`30`),(0,Z.jsxs)(`label`,{className:`block text-xs`,children:[(0,Z.jsx)(`span`,{className:`mb-1 block font-medium text-gray-700 dark:text-gray-300`,children:e(`userManager.workPolicies.networkDefault`)}),(0,Z.jsxs)(`select`,{...d(`networkDefault`),className:`w-full rounded-lg border border-gray-200 bg-white px-2.5 py-1.5 text-sm text-gray-900 outline-none focus:border-primary-500 dark:border-dark-300 dark:bg-dark-50 dark:text-gray-100`,children:[(0,Z.jsx)(`option`,{value:`inherit`,children:e(`userManager.workPolicies.networkInherit`)}),(0,Z.jsx)(`option`,{value:`on`,children:e(`userManager.workPolicies.networkOn`)}),(0,Z.jsx)(`option`,{value:`off`,children:e(`userManager.workPolicies.networkOff`)})]})]}),(0,Z.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,"data-testid":`work-policy-gui`,checked:a.guiEnabled,onChange:e=>o(t=>({...t,guiEnabled:e.target.checked})),className:`h-3.5 w-3.5 rounded border-gray-300 text-primary-600 focus:ring-primary-500`}),(0,Z.jsx)(`span`,{className:`font-medium text-gray-700 dark:text-gray-300`,children:e(`userManager.workPolicies.guiEnabled`)})]}),a.guiEnabled&&(0,Z.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,"data-testid":`work-policy-takeover`,checked:a.takeoverEnabled,onChange:e=>o(t=>({...t,takeoverEnabled:e.target.checked})),className:`h-3.5 w-3.5 rounded border-gray-300 text-primary-600 focus:ring-primary-500`}),(0,Z.jsx)(`span`,{className:`font-medium text-gray-700 dark:text-gray-300`,children:e(`userManager.workPolicies.takeoverEnabled`)})]}),(0,Z.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,"data-testid":`work-policy-approvals`,checked:a.approvalsRequired,onChange:e=>o(t=>({...t,approvalsRequired:e.target.checked})),className:`h-3.5 w-3.5 rounded border-gray-300 text-primary-600 focus:ring-primary-500`}),(0,Z.jsx)(`span`,{className:`font-medium text-gray-700 dark:text-gray-300`,children:e(`userManager.workPolicies.approvalsRequired`)})]}),m(`image`,e(`userManager.workPolicies.image`),`node:22-bookworm@sha256:…`)]}),a.guiEnabled&&(0,Z.jsx)(`p`,{className:`mt-2 text-[11px] text-gray-500 dark:text-gray-400`,children:e(`userManager.workPolicies.computerPresetHint`)}),(0,Z.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,Z.jsx)(j,{size:`sm`,variant:`ghost`,disabled:c,onClick:()=>{i(null),o(Q)},children:e(`userManager.workPolicies.cancel`)}),(0,Z.jsx)(j,{size:`sm`,disabled:c||!a.name.trim(),onClick:()=>void f(),children:e(`userManager.workPolicies.save`)})]})]})]})},$=[{id:`users`,label:`userManager.sections.users`},{id:`groups`,label:`userManager.groups.title`},{id:`access`,label:`userManager.sections.access`},{id:`security`,label:`userManager.sections.security`},{id:`defaults`,label:`userManager.sections.defaults`}],Fe=e=>{switch(e){case`users`:return(0,Z.jsx)(ce,{});case`groups`:return(0,Z.jsx)(Ce,{});case`access`:return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(ke,{}),(0,Z.jsx)(Pe,{}),(0,Z.jsx)(De,{}),(0,Z.jsx)(Ee,{}),(0,Z.jsx)(Oe,{}),(0,Z.jsx)(le,{}),(0,Z.jsx)(de,{}),(0,Z.jsx)(me,{}),(0,Z.jsx)(ve,{}),(0,Z.jsx)(xe,{})]});case`security`:return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(Se,{}),(0,Z.jsx)(Te,{})]});case`defaults`:return(0,Z.jsx)(pe,{})}},Ie=()=>{let{t:e}=s(),t=(0,X.useId)(),n=(0,X.useRef)({}),[r,i]=(0,X.useState)(`users`),[a,o]=(0,X.useState)([`users`]),l=e=>{i(e),o(t=>t.includes(e)?t:[...t,e])},u=(e,t)=>{let r=getComputedStyle(e.currentTarget).direction===`rtl`,i=$.findIndex(e=>e.id===t),a;switch(e.key){case`Home`:a=0;break;case`End`:a=$.length-1;break;case`ArrowRight`:a=i+(r?-1:1);break;case`ArrowLeft`:a=i+(r?1:-1);break;default:return}e.preventDefault();let o=$[(a+$.length)%$.length].id;l(o),n.current[o]?.focus()};return(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-5`,children:[(0,Z.jsx)(`div`,{role:`tablist`,"aria-label":e(`userManager.title`),"aria-orientation":`horizontal`,className:`-mx-1 flex gap-1 overflow-x-auto border-b border-line px-1 pb-3 pt-1 scrollbar-thin`,children:$.map(i=>(0,Z.jsx)(`button`,{ref:e=>{n.current[i.id]=e},type:`button`,role:`tab`,id:`${t}-tab-${i.id}`,"aria-controls":`${t}-panel-${i.id}`,"aria-selected":r===i.id,tabIndex:r===i.id?0:-1,onClick:()=>l(i.id),onKeyDown:e=>u(e,i.id),className:c(`min-h-11 shrink-0 rounded-xl border px-3 py-2 text-sm font-medium outline-none transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-surface motion-reduce:transition-none`,r===i.id?`border-line bg-nav-active text-ink`:`border-transparent text-ink-muted hover:bg-hover-solid hover:text-ink`),children:e(i.label)},i.id))}),$.map(e=>(0,Z.jsx)(`div`,{id:`${t}-panel-${e.id}`,role:`tabpanel`,"aria-labelledby":`${t}-tab-${e.id}`,hidden:r!==e.id,children:a.includes(e.id)&&Fe(e.id)},e.id))]})};export{Ie as UserManagementPanel,Ie as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime-hePW80VL.js";import{i as e,t}from"./react-vendor-wiHys0m2.js";import{t as n}from"./useTranslation-B9kflK9S.js";import{D as r,n as i}from"./ui-vendor-BhHHyHk3.js";import{t as a}from"./Button-CGMYia4g.js";import"./ui-D5-4niRk.js";import{s as o}from"./markdown-core-KjS96SYW.js";e();var s=t(),c=({notes:e,onDismiss:t})=>{let{t:c}=n();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-black/55 backdrop-blur-sm transition-opacity duration-200`,onClick:t}),(0,s.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4`,role:`dialog`,"aria-modal":`true`,"aria-label":c(`whatsNew.title`),onMouseDown:e=>{e.target===e.currentTarget&&t()},children:(0,s.jsxs)(`div`,{className:`flex max-h-[82vh] w-full max-w-2xl flex-col rounded-3xl border border-gray-200/80 bg-surface/95 shadow-2xl backdrop-blur-xl animate-scale-in dark:border-white/10 dark:bg-dark-25/95`,children:[(0,s.jsxs)(`div`,{className:`flex items-start justify-between px-6 pb-3 pt-6`,children:[(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`h2`,{className:`text-xl font-semibold tracking-[-0.02em] text-gray-950 dark:text-dark-950`,children:c(`whatsNew.title`)}),(0,s.jsxs)(`p`,{className:`mt-1 text-xs text-gray-500 dark:text-dark-500`,children:[c(`whatsNew.releaseNotes`),` · v`,e.version,` · `,e.date]})]}),(0,s.jsx)(`button`,{onClick:t,className:`rounded-full p-2 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 dark:text-dark-600 dark:hover:bg-white/[0.06] dark:hover:text-dark-900`,title:c(`common.close`),children:(0,s.jsx)(i,{className:`h-4 w-4`})})]}),(0,s.jsx)(`div`,{className:`scroll-region min-h-0 flex-1 overflow-y-auto px-6 py-3 scrollbar-thin`,children:(0,s.jsx)(o,{components:{h3:({children:e})=>(0,s.jsx)(`h3`,{className:`mb-2 mt-5 text-[11px] font-semibold uppercase tracking-[0.1em] text-primary-600 first:mt-0 dark:text-primary-400`,children:e}),ul:({children:e})=>(0,s.jsx)(`ul`,{className:`space-y-2.5`,children:e}),li:({children:e})=>(0,s.jsxs)(`li`,{className:`flex gap-2 text-[13.5px] leading-relaxed text-gray-700 dark:text-dark-700`,children:[(0,s.jsx)(`span`,{className:`mt-[7px] h-1 w-1 shrink-0 rounded-full bg-gray-300 dark:bg-dark-400`}),(0,s.jsx)(`span`,{className:`min-w-0`,children:e})]}),strong:({children:e})=>(0,s.jsx)(`strong`,{className:`font-semibold text-gray-900 dark:text-dark-900`,children:e}),a:({children:e,href:t})=>(0,s.jsx)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`text-primary-600 underline decoration-primary-300 underline-offset-2 hover:text-primary-700 dark:text-primary-400`,children:e}),code:({children:e})=>(0,s.jsx)(`code`,{className:`rounded-md border border-gray-200 bg-gray-100 px-1 py-0.5 font-mono text-[0.85em] text-gray-800 dark:border-dark-300 dark:bg-dark-200 dark:text-dark-800`,children:e}),p:({children:e})=>(0,s.jsx)(`p`,{className:`mb-2 text-[13.5px] leading-relaxed text-gray-700 dark:text-dark-700`,children:e})},children:e.body})}),(0,s.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-gray-200/70 px-6 py-4 dark:border-white/[0.08]`,children:[(0,s.jsxs)(`a`,{href:`https://github.com/libre-webui/libre-webui`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-w-0 items-center gap-1.5 text-xs text-gray-500 transition-colors hover:text-gray-900 dark:text-dark-500 dark:hover:text-dark-900`,children:[(0,s.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`}),(0,s.jsx)(`span`,{className:`truncate`,children:c(`whatsNew.starAsk`)})]}),(0,s.jsx)(a,{onClick:t,size:`sm`,children:c(`whatsNew.cta`)})]})]})})]})};export{c as WhatsNewModal};
1
+ import"./rolldown-runtime-hePW80VL.js";import{i as e,t}from"./react-vendor-CR5VJ85Q.js";import{t as n}from"./useTranslation-Boi0fB1B.js";import{D as r,n as i}from"./ui-vendor-DVTj_sKN.js";import{t as a}from"./Button-j68Q8KVh.js";import"./ui-Aq8MP7Ph.js";import{s as o}from"./markdown-core-Cyql92Hg.js";e();var s=t(),c=({notes:e,onDismiss:t})=>{let{t:c}=n();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-black/55 backdrop-blur-sm transition-opacity duration-200`,onClick:t}),(0,s.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4`,role:`dialog`,"aria-modal":`true`,"aria-label":c(`whatsNew.title`),onMouseDown:e=>{e.target===e.currentTarget&&t()},children:(0,s.jsxs)(`div`,{className:`flex max-h-[82vh] w-full max-w-2xl flex-col rounded-3xl border border-gray-200/80 bg-surface/95 shadow-2xl backdrop-blur-xl animate-scale-in dark:border-white/10 dark:bg-dark-25/95`,children:[(0,s.jsxs)(`div`,{className:`flex items-start justify-between px-6 pb-3 pt-6`,children:[(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`h2`,{className:`text-xl font-semibold tracking-[-0.02em] text-gray-950 dark:text-dark-950`,children:c(`whatsNew.title`)}),(0,s.jsxs)(`p`,{className:`mt-1 text-xs text-gray-500 dark:text-dark-500`,children:[c(`whatsNew.releaseNotes`),` · v`,e.version,` · `,e.date]})]}),(0,s.jsx)(`button`,{onClick:t,className:`rounded-full p-2 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-900 dark:text-dark-600 dark:hover:bg-white/[0.06] dark:hover:text-dark-900`,title:c(`common.close`),children:(0,s.jsx)(i,{className:`h-4 w-4`})})]}),(0,s.jsx)(`div`,{className:`scroll-region min-h-0 flex-1 overflow-y-auto px-6 py-3 scrollbar-thin`,children:(0,s.jsx)(o,{components:{h3:({children:e})=>(0,s.jsx)(`h3`,{className:`mb-2 mt-5 text-[11px] font-semibold uppercase tracking-[0.1em] text-primary-600 first:mt-0 dark:text-primary-400`,children:e}),ul:({children:e})=>(0,s.jsx)(`ul`,{className:`space-y-2.5`,children:e}),li:({children:e})=>(0,s.jsxs)(`li`,{className:`flex gap-2 text-[13.5px] leading-relaxed text-gray-700 dark:text-dark-700`,children:[(0,s.jsx)(`span`,{className:`mt-[7px] h-1 w-1 shrink-0 rounded-full bg-gray-300 dark:bg-dark-400`}),(0,s.jsx)(`span`,{className:`min-w-0`,children:e})]}),strong:({children:e})=>(0,s.jsx)(`strong`,{className:`font-semibold text-gray-900 dark:text-dark-900`,children:e}),a:({children:e,href:t})=>(0,s.jsx)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`text-primary-600 underline decoration-primary-300 underline-offset-2 hover:text-primary-700 dark:text-primary-400`,children:e}),code:({children:e})=>(0,s.jsx)(`code`,{className:`rounded-md border border-gray-200 bg-gray-100 px-1 py-0.5 font-mono text-[0.85em] text-gray-800 dark:border-dark-300 dark:bg-dark-200 dark:text-dark-800`,children:e}),p:({children:e})=>(0,s.jsx)(`p`,{className:`mb-2 text-[13.5px] leading-relaxed text-gray-700 dark:text-dark-700`,children:e})},children:e.body})}),(0,s.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-gray-200/70 px-6 py-4 dark:border-white/[0.08]`,children:[(0,s.jsxs)(`a`,{href:`https://github.com/libre-webui/libre-webui`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-w-0 items-center gap-1.5 text-xs text-gray-500 transition-colors hover:text-gray-900 dark:text-dark-500 dark:hover:text-dark-900`,children:[(0,s.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`}),(0,s.jsx)(`span`,{className:`truncate`,children:c(`whatsNew.starAsk`)})]}),(0,s.jsx)(a,{onClick:t,size:`sm`,children:c(`whatsNew.cta`)})]})]})})]})};export{c as WhatsNewModal};