libre-webui 0.18.0 → 0.19.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 (371) hide show
  1. package/README.md +30 -17
  2. package/backend/dist/db.d.ts.map +1 -1
  3. package/backend/dist/db.js +45 -0
  4. package/backend/dist/db.js.map +1 -1
  5. package/backend/dist/index.d.ts.map +1 -1
  6. package/backend/dist/index.js +33 -9
  7. package/backend/dist/index.js.map +1 -1
  8. package/backend/dist/middleware/auth.d.ts.map +1 -1
  9. package/backend/dist/middleware/index.d.ts.map +1 -1
  10. package/backend/dist/models/personaModel.d.ts.map +1 -1
  11. package/backend/dist/models/personaModel.js.map +1 -1
  12. package/backend/dist/models/userModel.d.ts +3 -2
  13. package/backend/dist/models/userModel.d.ts.map +1 -1
  14. package/backend/dist/models/userModel.js +5 -2
  15. package/backend/dist/models/userModel.js.map +1 -1
  16. package/backend/dist/routes/agentCli.d.ts.map +1 -1
  17. package/backend/dist/routes/agentCli.js +2 -2
  18. package/backend/dist/routes/agentCli.js.map +1 -1
  19. package/backend/dist/routes/auth.d.ts.map +1 -1
  20. package/backend/dist/routes/auth.js +73 -23
  21. package/backend/dist/routes/auth.js.map +1 -1
  22. package/backend/dist/routes/chat.d.ts.map +1 -1
  23. package/backend/dist/routes/chat.js +103 -2
  24. package/backend/dist/routes/chat.js.map +1 -1
  25. package/backend/dist/routes/documents.d.ts.map +1 -1
  26. package/backend/dist/routes/documents.js +130 -0
  27. package/backend/dist/routes/documents.js.map +1 -1
  28. package/backend/dist/routes/embeddings.d.ts.map +1 -1
  29. package/backend/dist/routes/huggingfaceHub.d.ts.map +1 -1
  30. package/backend/dist/routes/imageGen.d.ts.map +1 -1
  31. package/backend/dist/routes/libreClaw.d.ts.map +1 -1
  32. package/backend/dist/routes/media.d.ts.map +1 -1
  33. package/backend/dist/routes/notes.d.ts +3 -0
  34. package/backend/dist/routes/notes.d.ts.map +1 -0
  35. package/backend/dist/routes/notes.js +121 -0
  36. package/backend/dist/routes/notes.js.map +1 -0
  37. package/backend/dist/routes/ollama.d.ts.map +1 -1
  38. package/backend/dist/routes/ollama.js +2 -2
  39. package/backend/dist/routes/ollama.js.map +1 -1
  40. package/backend/dist/routes/personas.d.ts.map +1 -1
  41. package/backend/dist/routes/plugins.d.ts.map +1 -1
  42. package/backend/dist/routes/preferences.d.ts.map +1 -1
  43. package/backend/dist/routes/systemDiagnostics.d.ts.map +1 -1
  44. package/backend/dist/routes/tts.d.ts.map +1 -1
  45. package/backend/dist/routes/users.d.ts.map +1 -1
  46. package/backend/dist/routes/users.js +21 -0
  47. package/backend/dist/routes/users.js.map +1 -1
  48. package/backend/dist/routes/work.d.ts.map +1 -1
  49. package/backend/dist/services/agentCliService.d.ts +37 -4
  50. package/backend/dist/services/agentCliService.d.ts.map +1 -1
  51. package/backend/dist/services/agentCliService.js +229 -10
  52. package/backend/dist/services/agentCliService.js.map +1 -1
  53. package/backend/dist/services/assistantCompletionService.d.ts.map +1 -1
  54. package/backend/dist/services/authService.d.ts.map +1 -1
  55. package/backend/dist/services/authService.js +6 -1
  56. package/backend/dist/services/authService.js.map +1 -1
  57. package/backend/dist/services/chatGenerationService.d.ts.map +1 -1
  58. package/backend/dist/services/chatGenerationService.js +3 -3
  59. package/backend/dist/services/chatGenerationService.js.map +1 -1
  60. package/backend/dist/services/chatRequestService.d.ts.map +1 -1
  61. package/backend/dist/services/chatService.d.ts +6 -1
  62. package/backend/dist/services/chatService.d.ts.map +1 -1
  63. package/backend/dist/services/chatService.js +54 -1
  64. package/backend/dist/services/chatService.js.map +1 -1
  65. package/backend/dist/services/codexOAuthService.d.ts +22 -0
  66. package/backend/dist/services/codexOAuthService.d.ts.map +1 -0
  67. package/backend/dist/services/codexOAuthService.js +176 -0
  68. package/backend/dist/services/codexOAuthService.js.map +1 -0
  69. package/backend/dist/services/documentService.d.ts +7 -1
  70. package/backend/dist/services/documentService.d.ts.map +1 -1
  71. package/backend/dist/services/documentService.js +24 -11
  72. package/backend/dist/services/documentService.js.map +1 -1
  73. package/backend/dist/services/embeddingService.d.ts.map +1 -1
  74. package/backend/dist/services/encryptionService.d.ts.map +1 -1
  75. package/backend/dist/services/encryptionService.js.map +1 -1
  76. package/backend/dist/services/followUpService.d.ts +44 -0
  77. package/backend/dist/services/followUpService.d.ts.map +1 -0
  78. package/backend/dist/services/followUpService.js +123 -0
  79. package/backend/dist/services/followUpService.js.map +1 -0
  80. package/backend/dist/services/galleryService.d.ts.map +1 -1
  81. package/backend/dist/services/galleryService.js.map +1 -1
  82. package/backend/dist/services/libreClawService.d.ts.map +1 -1
  83. package/backend/dist/services/mediaGenerationJobService.d.ts.map +1 -1
  84. package/backend/dist/services/mediaGenerationJobService.js.map +1 -1
  85. package/backend/dist/services/memoryService.d.ts.map +1 -1
  86. package/backend/dist/services/memoryService.js.map +1 -1
  87. package/backend/dist/services/mutationEngineService.d.ts.map +1 -1
  88. package/backend/dist/services/oauthSecurity.d.ts +14 -0
  89. package/backend/dist/services/oauthSecurity.d.ts.map +1 -0
  90. package/backend/dist/services/oauthSecurity.js +101 -0
  91. package/backend/dist/services/oauthSecurity.js.map +1 -0
  92. package/backend/dist/services/ollamaService.d.ts +8 -2
  93. package/backend/dist/services/ollamaService.d.ts.map +1 -1
  94. package/backend/dist/services/ollamaService.js +40 -2
  95. package/backend/dist/services/ollamaService.js.map +1 -1
  96. package/backend/dist/services/personaService.d.ts.map +1 -1
  97. package/backend/dist/services/personaService.js.map +1 -1
  98. package/backend/dist/services/pluginActivationService.d.ts.map +1 -1
  99. package/backend/dist/services/pluginActivationService.js.map +1 -1
  100. package/backend/dist/services/pluginAudioGenerationService.d.ts.map +1 -1
  101. package/backend/dist/services/pluginAudioGenerationService.js.map +1 -1
  102. package/backend/dist/services/pluginCapabilityRegistryService.d.ts.map +1 -1
  103. package/backend/dist/services/pluginCapabilityRegistryService.js.map +1 -1
  104. package/backend/dist/services/pluginCredentialsService.d.ts.map +1 -1
  105. package/backend/dist/services/pluginEmbeddingService.d.ts.map +1 -1
  106. package/backend/dist/services/pluginEmbeddingService.js.map +1 -1
  107. package/backend/dist/services/pluginImageGenerationService.d.ts.map +1 -1
  108. package/backend/dist/services/pluginImageGenerationService.js.map +1 -1
  109. package/backend/dist/services/pluginService.d.ts +5 -0
  110. package/backend/dist/services/pluginService.d.ts.map +1 -1
  111. package/backend/dist/services/pluginService.js +53 -4
  112. package/backend/dist/services/pluginService.js.map +1 -1
  113. package/backend/dist/services/pluginTTSService.d.ts.map +1 -1
  114. package/backend/dist/services/pluginTTSService.js.map +1 -1
  115. package/backend/dist/services/pluginUsageService.d.ts +18 -0
  116. package/backend/dist/services/pluginUsageService.d.ts.map +1 -1
  117. package/backend/dist/services/pluginUsageService.js +53 -0
  118. package/backend/dist/services/pluginUsageService.js.map +1 -1
  119. package/backend/dist/services/pluginVariablesService.d.ts.map +1 -1
  120. package/backend/dist/services/pluginVariablesService.js.map +1 -1
  121. package/backend/dist/services/pluginVideoGenerationService.d.ts.map +1 -1
  122. package/backend/dist/services/pluginVideoGenerationService.js.map +1 -1
  123. package/backend/dist/services/preferencesService.d.ts.map +1 -1
  124. package/backend/dist/services/preferencesService.js +1 -0
  125. package/backend/dist/services/preferencesService.js.map +1 -1
  126. package/backend/dist/services/registrationPolicy.d.ts +3 -3
  127. package/backend/dist/services/registrationPolicy.d.ts.map +1 -1
  128. package/backend/dist/services/registrationPolicy.js +4 -4
  129. package/backend/dist/services/registrationPolicy.js.map +1 -1
  130. package/backend/dist/services/simpleGitHubOAuth.d.ts +1 -1
  131. package/backend/dist/services/simpleGitHubOAuth.d.ts.map +1 -1
  132. package/backend/dist/services/simpleGitHubOAuth.js +5 -1
  133. package/backend/dist/services/simpleGitHubOAuth.js.map +1 -1
  134. package/backend/dist/services/simpleHuggingFaceOAuth.d.ts +1 -1
  135. package/backend/dist/services/simpleHuggingFaceOAuth.d.ts.map +1 -1
  136. package/backend/dist/services/simpleHuggingFaceOAuth.js +5 -5
  137. package/backend/dist/services/simpleHuggingFaceOAuth.js.map +1 -1
  138. package/backend/dist/services/systemDiagnosticsService.d.ts.map +1 -1
  139. package/backend/dist/services/systemDiagnosticsService.js.map +1 -1
  140. package/backend/dist/services/titleGenerationService.d.ts.map +1 -1
  141. package/backend/dist/services/turnstileService.d.ts.map +1 -1
  142. package/backend/dist/services/userService.d.ts +1 -0
  143. package/backend/dist/services/userService.js +1 -1
  144. package/backend/dist/services/workAgentService.d.ts.map +1 -1
  145. package/backend/dist/services/workAgentService.js.map +1 -1
  146. package/backend/dist/services/workEventService.d.ts.map +1 -1
  147. package/backend/dist/services/workEventService.js.map +1 -1
  148. package/backend/dist/services/workHostWorkspaceService.d.ts.map +1 -1
  149. package/backend/dist/services/workModelProviderService.d.ts.map +1 -1
  150. package/backend/dist/services/workModelProviderService.js +30 -6
  151. package/backend/dist/services/workModelProviderService.js.map +1 -1
  152. package/backend/dist/services/workPreviewProxyService.d.ts.map +1 -1
  153. package/backend/dist/services/workPreviewProxyService.js.map +1 -1
  154. package/backend/dist/services/workRuntimeService.d.ts +6 -6
  155. package/backend/dist/services/workRuntimeService.d.ts.map +1 -1
  156. package/backend/dist/services/workRuntimeService.js.map +1 -1
  157. package/backend/dist/services/workTaskService.d.ts.map +1 -1
  158. package/backend/dist/services/workTaskService.js.map +1 -1
  159. package/backend/dist/services/workTerminalService.d.ts +1 -1
  160. package/backend/dist/services/workTerminalService.d.ts.map +1 -1
  161. package/backend/dist/services/workTerminalService.js.map +1 -1
  162. package/backend/dist/storage.d.ts +12 -1
  163. package/backend/dist/storage.d.ts.map +1 -1
  164. package/backend/dist/storage.js +183 -9
  165. package/backend/dist/storage.js.map +1 -1
  166. package/backend/dist/storageMappers.d.ts +13 -0
  167. package/backend/dist/storageMappers.d.ts.map +1 -1
  168. package/backend/dist/storageMappers.js +5 -0
  169. package/backend/dist/storageMappers.js.map +1 -1
  170. package/backend/dist/types/index.d.ts +29 -0
  171. package/backend/dist/types/index.d.ts.map +1 -1
  172. package/backend/dist/types/index.js.map +1 -1
  173. package/backend/dist/utils/chatContext.js.map +1 -1
  174. package/backend/dist/utils/chatDocumentContext.d.ts.map +1 -1
  175. package/backend/dist/utils/chatDocumentContext.js +6 -1
  176. package/backend/dist/utils/chatDocumentContext.js.map +1 -1
  177. package/backend/dist/utils/chatProviderSelection.d.ts.map +1 -1
  178. package/backend/dist/utils/generationUtils.d.ts.map +1 -1
  179. package/backend/dist/utils/hash.d.ts.map +1 -1
  180. package/backend/dist/utils/hash.js +13 -2
  181. package/backend/dist/utils/hash.js.map +1 -1
  182. package/backend/dist/utils/logger.d.ts +1 -1
  183. package/backend/dist/utils/logger.d.ts.map +1 -1
  184. package/backend/dist/utils/ollamaStreaming.d.ts +6 -2
  185. package/backend/dist/utils/ollamaStreaming.d.ts.map +1 -1
  186. package/backend/dist/utils/ollamaStreaming.js +12 -2
  187. package/backend/dist/utils/ollamaStreaming.js.map +1 -1
  188. package/backend/dist/utils/openAIResponsesAdapter.js.map +1 -1
  189. package/backend/dist/utils/packagePaths.js.map +1 -1
  190. package/backend/dist/utils/pluginChatAdapter.d.ts.map +1 -1
  191. package/backend/dist/utils/pluginChatAdapter.js +11 -4
  192. package/backend/dist/utils/pluginChatAdapter.js.map +1 -1
  193. package/backend/dist/utils/pluginChatContext.js.map +1 -1
  194. package/backend/dist/utils/pluginDefinitionTrust.d.ts.map +1 -1
  195. package/backend/dist/utils/pluginDefinitionTrust.js +1 -0
  196. package/backend/dist/utils/pluginDefinitionTrust.js.map +1 -1
  197. package/backend/dist/utils/pluginStreamAdapter.d.ts +10 -1
  198. package/backend/dist/utils/pluginStreamAdapter.d.ts.map +1 -1
  199. package/backend/dist/utils/pluginStreamAdapter.js +30 -23
  200. package/backend/dist/utils/pluginStreamAdapter.js.map +1 -1
  201. package/backend/dist/utils/pluginValidation.d.ts +1 -1
  202. package/backend/dist/utils/pluginValidation.d.ts.map +1 -1
  203. package/backend/dist/utils/pluginValidation.js +17 -0
  204. package/backend/dist/utils/pluginValidation.js.map +1 -1
  205. package/backend/dist/utils/resourceLimits.d.ts +10 -0
  206. package/backend/dist/utils/resourceLimits.d.ts.map +1 -0
  207. package/backend/dist/utils/resourceLimits.js +29 -0
  208. package/backend/dist/utils/resourceLimits.js.map +1 -0
  209. package/backend/dist/utils/thinkingPhaseTimer.d.ts +21 -0
  210. package/backend/dist/utils/thinkingPhaseTimer.d.ts.map +1 -0
  211. package/backend/dist/utils/thinkingPhaseTimer.js +84 -0
  212. package/backend/dist/utils/thinkingPhaseTimer.js.map +1 -0
  213. package/backend/dist/utils/webpageFetcher.d.ts +25 -0
  214. package/backend/dist/utils/webpageFetcher.d.ts.map +1 -0
  215. package/backend/dist/utils/webpageFetcher.js +231 -0
  216. package/backend/dist/utils/webpageFetcher.js.map +1 -0
  217. package/backend/dist/utils/websocketMessages.js.map +1 -1
  218. package/backend/dist/websocketServer.d.ts.map +1 -1
  219. package/backend/dist/websocketServer.js +2 -1
  220. package/backend/dist/websocketServer.js.map +1 -1
  221. package/backend/package.json +8 -7
  222. package/bin/cli.js +2 -2
  223. package/frontend/dist/assets/index-CFhy8YLA.css +1 -0
  224. package/frontend/dist/assets/index-_lG_lwU-.js +164 -0
  225. package/frontend/dist/assets/markdown-math-ClQbWekD.css +1 -0
  226. package/frontend/dist/assets/xterm-DHcfr8qj.css +1 -0
  227. package/frontend/dist/index.html +21 -16
  228. package/frontend/dist/js/ArtifactContainer-CjpvtR8G.js +1 -0
  229. package/frontend/dist/js/{ArtifactDemoPage-BWN0MWCx.js → ArtifactDemoPage-yrPXLBQo.js} +1 -1
  230. package/frontend/dist/js/ArtifactSlideOutPanel-DdsL2AOQ.js +1 -0
  231. package/frontend/dist/js/{Button-CRwzOaDZ.js → Button-X9TT9gTD.js} +1 -1
  232. package/frontend/dist/js/ChatPage-D9lWGM8g.js +16 -0
  233. package/frontend/dist/js/FirstTimeSetup-CwLPbHkI.js +1 -0
  234. package/frontend/dist/js/GalleryPage-C9DTdo_-.js +1 -0
  235. package/frontend/dist/js/HomePage-iF44c34e.js +1 -0
  236. package/frontend/dist/js/LibreClawPage-B9wWZIz6.js +1 -0
  237. package/frontend/dist/js/{ModelManagerModals-C2rwHd01.js → ModelManagerModals-D9j9RECi.js} +1 -1
  238. package/frontend/dist/js/ModelSelector-B0RKEJwC.js +1 -0
  239. package/frontend/dist/js/ModelsPage-DJXoIOs8.js +2 -0
  240. package/frontend/dist/js/NotesPage-BTNH6JR2.js +1 -0
  241. package/frontend/dist/js/{OptimizedSyntaxHighlighter-Ci9sRc78.js → OptimizedSyntaxHighlighter-CWYUn9Oe.js} +1 -1
  242. package/frontend/dist/js/PersonasPage--nqoJ-wA.js +13 -0
  243. package/frontend/dist/js/PluginUsagePage-BHwm-BBr.js +1 -0
  244. package/frontend/dist/js/{RichMessageContent-nAEaPTpH.js → RichMessageContent-DYRrXJ75.js} +3 -3
  245. package/frontend/dist/js/SettingsModal-y1Nzg55O.js +1 -0
  246. package/frontend/dist/js/SystemPage-CHez8h3p.js +1 -0
  247. package/frontend/dist/js/UserManagementPage-aJhKXQxG.js +1 -0
  248. package/frontend/dist/js/WorkPage-Ccla0MDm.js +5 -0
  249. package/frontend/dist/js/addon-fit-DIOBYJe3.js +1 -0
  250. package/frontend/dist/js/api-DVP8xiYT.js +19 -0
  251. package/frontend/dist/js/appStore-Cw7PmG-J.js +2 -0
  252. package/frontend/dist/js/ar-ONXFvOB1.js +2 -0
  253. package/frontend/dist/js/artifactHtml-C0Hu9I1u.js +41 -0
  254. package/frontend/dist/js/authStore-gv_MgDKr.js +3 -0
  255. package/frontend/dist/js/babel-CmENXdZw.js +16 -0
  256. package/frontend/dist/js/bn-BLhREPm6.js +2 -0
  257. package/frontend/dist/js/chatStore-DmDbolTg.js +2 -0
  258. package/frontend/dist/js/cs-Bg8E9fG5.js +2 -0
  259. package/frontend/dist/js/da-ODCU8w4x.js +2 -0
  260. package/frontend/dist/js/de-nuGHRJ5N.js +2 -0
  261. package/frontend/dist/js/es-DcN_cwum.js +2 -0
  262. package/frontend/dist/js/estree-DJwQLE88.js +44 -0
  263. package/frontend/dist/js/fr-C-L_xGr5.js +2 -0
  264. package/frontend/dist/js/hi-DUEtwA9G.js +2 -0
  265. package/frontend/dist/js/html-DdAOfeK4.js +25 -0
  266. package/frontend/dist/js/i18n-xir4Zz7C.js +2 -0
  267. package/frontend/dist/js/i18next-DgmgtwsV.js +1 -0
  268. package/frontend/dist/js/id-DNTYhti_.js +2 -0
  269. package/frontend/dist/js/imageGenModels-Dx_QMLJQ.js +1 -0
  270. package/frontend/dist/js/is-Bx28ymbQ.js +2 -0
  271. package/frontend/dist/js/it-BjW-JLlS.js +2 -0
  272. package/frontend/dist/js/ja-uThj4Q1w.js +2 -0
  273. package/frontend/dist/js/ko-DqgmMYXK.js +2 -0
  274. package/frontend/dist/js/logger-DSXjF4ye.js +1 -0
  275. package/frontend/dist/js/markdown-RaVsONor.js +70 -0
  276. package/frontend/dist/js/markdown-core-DHnR5Hw8.js +16 -0
  277. package/frontend/dist/js/markdown-math-B7FlYsmr.js +261 -0
  278. package/frontend/dist/js/messageCodeStyles-cTX0rQGK.js +2 -0
  279. package/frontend/dist/js/ms-R9kt_P0T.js +2 -0
  280. package/frontend/dist/js/nl-BjmtEgpK.js +2 -0
  281. package/frontend/dist/js/pl-C8_gU9r1.js +2 -0
  282. package/frontend/dist/js/postcss-B5WIGhAY.js +62 -0
  283. package/frontend/dist/js/pt-7BJForUD.js +2 -0
  284. package/frontend/dist/js/react-vendor-DPNXrO-8.js +9 -0
  285. package/frontend/dist/js/{rolldown-runtime-QTnfLwEv.js → rolldown-runtime-hePW80VL.js} +1 -1
  286. package/frontend/dist/js/router-vendor-Ca9zqOqT.js +1 -0
  287. package/frontend/dist/js/ru-D2HmhY6Y.js +2 -0
  288. package/frontend/dist/js/{standalone-C0NjJpWr.js → standalone-B_aPlu7o.js} +8 -8
  289. package/frontend/dist/js/sv-zny3sDBM.js +2 -0
  290. package/frontend/dist/js/syntax-highlight-Ca9bHsaz.js +8 -0
  291. package/frontend/dist/js/th-CAzEKRz8.js +2 -0
  292. package/frontend/dist/js/tr-BmYgtmUo.js +2 -0
  293. package/frontend/dist/js/{typescript-d0TUM2-0.js → typescript-Dz4OUZSl.js} +10 -10
  294. package/frontend/dist/js/ui-DDlcz2oy.js +2 -0
  295. package/frontend/dist/js/ui-vendor-D_pYT79f.js +177 -0
  296. package/frontend/dist/js/uk-eiYZ0uRq.js +2 -0
  297. package/frontend/dist/js/useTranslation-CdeLZqSW.js +1 -0
  298. package/frontend/dist/js/utils-BhpNrGnR.js +1 -0
  299. package/frontend/dist/js/utils-vendor-1zob7nK9.js +9 -0
  300. package/frontend/dist/js/vi-C7SVAWpO.js +2 -0
  301. package/frontend/dist/js/welcomePrompts-to5mv_gx.js +1 -0
  302. package/frontend/dist/js/xterm-Da5ppSVt.js +18 -0
  303. package/frontend/dist/js/{yaml-mLy9chOK.js → yaml-QD4znPfZ.js} +20 -20
  304. package/frontend/dist/js/zh-2Q3cQv3s.js +2 -0
  305. package/package.json +19 -12
  306. package/plugins/codex-oauth.json +19 -0
  307. package/frontend/dist/assets/index-ChhWhug2.css +0 -1
  308. package/frontend/dist/assets/index-CmZntyR1.js +0 -3
  309. package/frontend/dist/assets/markdown-math-CYlHEDRF.css +0 -1
  310. package/frontend/dist/assets/xterm-CmMoOwwu.css +0 -1
  311. package/frontend/dist/js/ArtifactContainer-CBAbdoIJ.js +0 -1
  312. package/frontend/dist/js/ArtifactSlideOutPanel-D-AvYkfk.js +0 -1
  313. package/frontend/dist/js/ChatPage-w2FkF_fE.js +0 -16
  314. package/frontend/dist/js/FirstTimeSetup-CzBxl7UH.js +0 -1
  315. package/frontend/dist/js/GalleryPage-Cv8pniRW.js +0 -1
  316. package/frontend/dist/js/HomePage-Vyj4ndU4.js +0 -1
  317. package/frontend/dist/js/LibreClawPage-CYhLgQB-.js +0 -1
  318. package/frontend/dist/js/ModelSelector-D7kDjZV9.js +0 -1
  319. package/frontend/dist/js/ModelsPage-BnUddkrs.js +0 -2
  320. package/frontend/dist/js/PersonasPage-BL5XlrEm.js +0 -13
  321. package/frontend/dist/js/PluginUsagePage-BXqweCCs.js +0 -1
  322. package/frontend/dist/js/SettingsModal-DZYCI5-y.js +0 -1
  323. package/frontend/dist/js/SystemPage-jdHYfn9A.js +0 -1
  324. package/frontend/dist/js/UserManagementPage-BpOnt6os.js +0 -1
  325. package/frontend/dist/js/WorkPage-DAp1T1dl.js +0 -5
  326. package/frontend/dist/js/addon-fit-Cj0_dfHF.js +0 -1
  327. package/frontend/dist/js/api-BCqWXjZI.js +0 -19
  328. package/frontend/dist/js/appStore-CDM6V5ny.js +0 -2
  329. package/frontend/dist/js/ar-DS8gs8WK.js +0 -2
  330. package/frontend/dist/js/artifactHtml-B7Oy2e__.js +0 -27
  331. package/frontend/dist/js/authStore-Bl5ofD_h.js +0 -4
  332. package/frontend/dist/js/babel-BnLuavNv.js +0 -16
  333. package/frontend/dist/js/bn-CrMPJwTR.js +0 -2
  334. package/frontend/dist/js/cs-BL116Ezu.js +0 -2
  335. package/frontend/dist/js/da-TDNaKzqy.js +0 -2
  336. package/frontend/dist/js/de-DkIqdAB5.js +0 -2
  337. package/frontend/dist/js/demoMode-BhEpMVh5.js +0 -1
  338. package/frontend/dist/js/es-CHRXt6Fd.js +0 -2
  339. package/frontend/dist/js/estree-BFya-bSu.js +0 -44
  340. package/frontend/dist/js/fr-8715yUKq.js +0 -2
  341. package/frontend/dist/js/hi-C2O08SBU.js +0 -2
  342. package/frontend/dist/js/html-DJot0Wwf.js +0 -25
  343. package/frontend/dist/js/id-Dq7UXUEV.js +0 -2
  344. package/frontend/dist/js/is-B3dbbhSl.js +0 -2
  345. package/frontend/dist/js/it-CLSuu2K7.js +0 -2
  346. package/frontend/dist/js/ja-CthrqyCR.js +0 -2
  347. package/frontend/dist/js/ko-BJvFDJ82.js +0 -2
  348. package/frontend/dist/js/logger-DbNs3-DK.js +0 -1
  349. package/frontend/dist/js/markdown-CXwWsPYG.js +0 -70
  350. package/frontend/dist/js/markdown-core-GI9BPwrB.js +0 -16
  351. package/frontend/dist/js/markdown-math-E4O1gcxj.js +0 -261
  352. package/frontend/dist/js/ms-QV0202Mj.js +0 -2
  353. package/frontend/dist/js/nl-Dob1m1pV.js +0 -2
  354. package/frontend/dist/js/pl-urfOKnYI.js +0 -2
  355. package/frontend/dist/js/postcss-DSDkwgFE.js +0 -62
  356. package/frontend/dist/js/pt-D52Xkpi0.js +0 -2
  357. package/frontend/dist/js/react-vendor-DyG_ODzn.js +0 -9
  358. package/frontend/dist/js/router-vendor-BjDI9mRe.js +0 -1
  359. package/frontend/dist/js/ru-CwnW9Xe2.js +0 -2
  360. package/frontend/dist/js/sv-BNclj-Fo.js +0 -2
  361. package/frontend/dist/js/syntax-highlight-pM1xnNpY.js +0 -8
  362. package/frontend/dist/js/th-BlQ4PL57.js +0 -2
  363. package/frontend/dist/js/tr-B80aZ1px.js +0 -2
  364. package/frontend/dist/js/ui-vendor-ChfdHf5M.js +0 -177
  365. package/frontend/dist/js/uk-DZuuaI56.js +0 -2
  366. package/frontend/dist/js/useTranslation-Cs6iTP4m.js +0 -1
  367. package/frontend/dist/js/utils-DmZD5uA3.js +0 -1
  368. package/frontend/dist/js/utils-vendor-Cbaj0BC5.js +0 -9
  369. package/frontend/dist/js/vi-Bg42fPfF.js +0 -2
  370. package/frontend/dist/js/xterm-DKl1QLiw.js +0 -7
  371. package/frontend/dist/js/zh-BSt87zs6.js +0 -2
@@ -0,0 +1,164 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/SettingsModal-y1Nzg55O.js","js/rolldown-runtime-hePW80VL.js","js/markdown-core-DHnR5Hw8.js","js/useTranslation-CdeLZqSW.js","js/i18n-xir4Zz7C.js","js/router-vendor-Ca9zqOqT.js","js/i18next-DgmgtwsV.js","js/ui-vendor-D_pYT79f.js","js/logger-DSXjF4ye.js","js/api-DVP8xiYT.js","js/utils-vendor-1zob7nK9.js","js/imageGenModels-Dx_QMLJQ.js","js/utils-BhpNrGnR.js","js/chatStore-DmDbolTg.js","js/authStore-gv_MgDKr.js","js/appStore-Cw7PmG-J.js","js/Button-X9TT9gTD.js","js/ui-DDlcz2oy.js","js/messageCodeStyles-cTX0rQGK.js","js/HomePage-iF44c34e.js","js/work-DVgm81bJ.js","js/ChatPage-D9lWGM8g.js","js/react-vendor-DPNXrO-8.js","js/welcomePrompts-to5mv_gx.js","js/artifactHtml-C0Hu9I1u.js","js/ArtifactContainer-CjpvtR8G.js","js/OptimizedSyntaxHighlighter-CWYUn9Oe.js","js/syntax-highlight-Ca9bHsaz.js","js/ModelSelector-B0RKEJwC.js","js/ModelsPage-DJXoIOs8.js","js/PersonasPage--nqoJ-wA.js","js/GalleryPage-C9DTdo_-.js","js/NotesPage-BTNH6JR2.js","js/RichMessageContent-DYRrXJ75.js","js/markdown-math-B7FlYsmr.js","assets/markdown-math-ClQbWekD.css","js/LibreClawPage-B9wWZIz6.js","js/WorkPage-Ccla0MDm.js","js/UserManagementPage-aJhKXQxG.js","js/PluginUsagePage-BHwm-BBr.js","js/SystemPage-CHez8h3p.js","js/ArtifactDemoPage-yrPXLBQo.js","js/ArtifactSlideOutPanel-DdsL2AOQ.js","js/FirstTimeSetup-CwLPbHkI.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"../js/rolldown-runtime-hePW80VL.js";import{d as t,f as n,i as r}from"../js/markdown-core-DHnR5Hw8.js";import{n as i,t as a}from"../js/react-vendor-DPNXrO-8.js";import{_ as o,a as s,c,d as l,g as u,h as d,i as f,m as p,n as m,o as h,r as g,s as _,t as v,u as y,v as b}from"../js/router-vendor-Ca9zqOqT.js";import{t as x}from"../js/useTranslation-CdeLZqSW.js";import{i as S,r as C,t as w}from"../js/i18n-xir4Zz7C.js";import{A as T,At as E,B as D,Bt as O,Cn as ee,Ct as te,Dt as ne,J as k,K as A,M as j,O as M,Ot as re,P as N,R as ie,Rt as P,S as ae,T as oe,Tn as F,U as se,Ut as ce,Y as le,Z as ue,Zt as de,an as fe,at as pe,bn as me,c as he,cn as ge,ct as _e,d as ve,f as ye,ft as be,hn as xe,ht as Se,in as Ce,it as we,k as Te,l as Ee,m as De,n as Oe,on as ke,pn as Ae,rn as je,s as Me,sn as Ne,st as Pe,tt as Fe,un as Ie,ut as Le,vt as Re,wn as I,wt as ze,y as Be,zt as Ve}from"../js/ui-vendor-D_pYT79f.js";import{a as He,o as Ue,t as We}from"../js/utils-vendor-1zob7nK9.js";import{i as Ge,t as L}from"../js/logger-DSXjF4ye.js";import{C as Ke,S as qe,p as Je,w as Ye}from"../js/api-DVP8xiYT.js";import{i as Xe,n as Ze,o as Qe,t as R}from"../js/utils-BhpNrGnR.js";import{i as $e,o as et,t as tt}from"../js/chatStore-DmDbolTg.js";import{a as nt,c as rt,l as it,n as z,r as at}from"../js/authStore-gv_MgDKr.js";import{t as ot}from"../js/appStore-Cw7PmG-J.js";import{n as st}from"../js/welcomePrompts-to5mv_gx.js";import{t as B}from"../js/Button-X9TT9gTD.js";import{p as ct}from"../js/ui-DDlcz2oy.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var lt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ut,dt,ft,pt=new(ut=new WeakMap,dt=new WeakMap,ft=new WeakMap,class extends lt{constructor(){super(),o(this,ut,void 0),o(this,dt,void 0),o(this,ft,void 0),d(ft,this,e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}})}onSubscribe(){p(dt,this)||this.setEventListener(p(ft,this))}onUnsubscribe(){this.hasListeners()||(p(dt,this)?.call(this),d(dt,this,void 0))}setEventListener(e){d(ft,this,e),p(dt,this)?.call(this),d(dt,this,e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()}))}setFocused(e){p(ut,this)!==e&&(d(ut,this,e),this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof p(ut,this)==`boolean`?p(ut,this):globalThis.document?.visibilityState!==`hidden`}}),mt,ht,gt={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_t=new(mt=new WeakMap,ht=new WeakMap,class{constructor(){o(this,mt,gt),o(this,ht,!1)}setTimeoutProvider(e){d(mt,this,e)}setTimeout(e,t){return p(mt,this).setTimeout(e,t)}clearTimeout(e){p(mt,this).clearTimeout(e)}setInterval(e,t){return p(mt,this).setInterval(e,t)}clearInterval(e){p(mt,this).clearInterval(e)}});function vt(e){setTimeout(e,0)}var yt=typeof window>`u`||`Deno`in globalThis;function V(){}function bt(e,t){return typeof e==`function`?e(t):e}function xt(e){return typeof e==`number`&&e>=0&&e!==1/0}function St(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ct(e,t){return typeof e==`function`?e(t):e}function H(e,t){return typeof e==`function`?e(t):e}function wt(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Et(o,t.options))return!1}else if(!Ot(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Tt(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Dt(t.options.mutationKey)!==Dt(a))return!1}else if(!Ot(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Et(e,t){return(t?.queryKeyHashFn||Dt)(e)}function Dt(e){return JSON.stringify(e,(e,t)=>Nt(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Ot(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!Ot(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!Ot(e[r],t[r]))return!1;return!0}return!1}var kt=Object.prototype.hasOwnProperty;function At(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Mt(e)&&Mt(t);if(!r&&!(Nt(e)&&Nt(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:kt.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=At(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function jt(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Mt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Nt(e){if(!Pt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Pt(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Pt(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ft(e){return new Promise(t=>{_t.setTimeout(t,e)})}function It(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:At(e,t)}function Lt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Rt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var zt=Symbol();function Bt(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===zt?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Vt(e,t){return typeof e==`function`?e(...t):!!e}function Ht(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Ut=(()=>{let e=()=>yt;return{isServer(){return e()},setIsServer(t){e=t}}})();function Wt(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Gt=vt;function Kt(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Gt,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var U=Kt(),qt,Jt,Yt,Xt=new(qt=new WeakMap,Jt=new WeakMap,Yt=new WeakMap,class extends lt{constructor(){super(),o(this,qt,!0),o(this,Jt,void 0),o(this,Yt,void 0),d(Yt,this,e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}})}onSubscribe(){p(Jt,this)||this.setEventListener(p(Yt,this))}onUnsubscribe(){this.hasListeners()||(p(Jt,this)?.call(this),d(Jt,this,void 0))}setEventListener(e){d(Yt,this,e),p(Jt,this)?.call(this),d(Jt,this,e(this.setOnline.bind(this)))}setOnline(e){p(qt,this)!==e&&(d(qt,this,e),this.listeners.forEach(t=>{t(e)}))}isOnline(){return p(qt,this)}});function Zt(e){return Math.min(1e3*2**e,3e4)}function Qt(e){return(e??`online`)!==`online`||Xt.isOnline()}var $t=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function en(e){let t=!1,n=0,r,i=Wt(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new $t(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>pt.isFocused()&&(e.networkMode===`always`||Xt.isOnline())&&e.canRun(),u=()=>Qt(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Ut.isServer()?0:3),o=e.retryDelay??Zt,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),Ft(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var tn,nn=(tn=new WeakMap,class{constructor(){o(this,tn,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),xt(this.gcTime)&&d(tn,this,_t.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ut.isServer()?1/0:3e5))}clearGcTimeout(){p(tn,this)!==void 0&&(_t.clearTimeout(p(tn,this)),d(tn,this,void 0))}});function rn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Ht(e,()=>t.signal,()=>n=!0)},u=Bt(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Rt:Lt;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?on:an,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:an(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function an(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function on(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function sn(e,t){return t?an(e,t)!=null:!1}function cn(e,t){return!t||!e.getPreviousPageParam?!1:on(e,t)!=null}function ln(e,t){b(e,t),t.add(e)}var un,dn,fn,pn,mn,W,hn,gn,_n,vn=(un=new WeakMap,dn=new WeakMap,fn=new WeakMap,pn=new WeakMap,mn=new WeakMap,W=new WeakMap,hn=new WeakMap,gn=new WeakMap,_n=new WeakSet,class extends nn{constructor(e){super(),ln(this,_n),o(this,un,void 0),o(this,dn,void 0),o(this,fn,void 0),o(this,pn,void 0),o(this,mn,void 0),o(this,W,void 0),o(this,hn,void 0),o(this,gn,void 0),d(gn,this,!1),d(hn,this,e.defaultOptions),this.setOptions(e.options),this.observers=[],d(mn,this,e.client),d(pn,this,p(mn,this).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,d(dn,this,Cn(this.options)),this.state=e.state??p(dn,this),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return p(un,this)}get promise(){return p(W,this)?.promise}setOptions(e){if(this.options={...p(hn,this),...e},e?._type&&d(un,this,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Cn(this.options);e.data!==void 0&&(this.setState(Sn(e.data,e.dataUpdatedAt)),d(dn,this,e))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&p(pn,this).remove(this)}setData(e,t){let n=It(this.state.data,e,this.options);return u(_n,this,bn).call(this,{data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){u(_n,this,bn).call(this,{type:`setState`,state:e})}cancel(e){let t=p(W,this)?.promise;return p(W,this)?.cancel(e),t?t.then(V).catch(V):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return p(dn,this)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>H(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===zt||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Ct(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!St(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),p(W,this)?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),p(W,this)?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),p(pn,this).notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(p(W,this)&&(p(gn,this)||u(_n,this,yn).call(this)?p(W,this).cancel({revert:!0}):p(W,this).cancelRetry()),this.scheduleGc()),p(pn,this).notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||u(_n,this,bn).call(this,{type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&p(W,this)?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(p(W,this))return p(W,this).continueRetry(),p(W,this).promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(d(gn,this,!0),n.signal)})},i=()=>{let e=Bt(this.options,t),n=(()=>{let e={client:p(mn,this),queryKey:this.queryKey,meta:this.meta};return r(e),e})();return d(gn,this,!1),this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:p(mn,this),state:this.state,fetchFn:i};return r(e),e})();(p(un,this)===`infinite`?rn(this.options.pages):this.options.behavior)?.onFetch(a,this),d(fn,this,this.state),(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&u(_n,this,bn).call(this,{type:`fetch`,meta:a.fetchOptions?.meta}),d(W,this,en({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof $t&&e.revert&&this.setState({...p(fn,this),fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{u(_n,this,bn).call(this,{type:`failed`,failureCount:e,error:t})},onPause:()=>{u(_n,this,bn).call(this,{type:`pause`})},onContinue:()=>{u(_n,this,bn).call(this,{type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{let e=await p(W,this).start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),p(pn,this).config.onSuccess?.(e,this),p(pn,this).config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof $t){if(e.silent)return p(W,this).promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw u(_n,this,bn).call(this,{type:`error`,error:e}),p(pn,this).config.onError?.(e,this),p(pn,this).config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}});function yn(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}function bn(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...xn(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Sn(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return d(fn,this,e.manual?n:void 0),n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),U.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),p(pn,this).notify({query:this,type:`updated`,action:e})})}function xn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Qt(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Sn(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Cn(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var G,K,wn,q,Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn,Fn,J,In=(G=new WeakMap,K=new WeakMap,wn=new WeakMap,q=new WeakMap,Tn=new WeakMap,En=new WeakMap,Dn=new WeakMap,On=new WeakMap,kn=new WeakMap,An=new WeakMap,jn=new WeakMap,Mn=new WeakMap,Nn=new WeakMap,Pn=new WeakMap,Fn=new WeakMap,J=new WeakSet,class extends lt{constructor(e,t){super(),ln(this,J),o(this,G,void 0),o(this,K,void 0),o(this,wn,void 0),o(this,q,void 0),o(this,Tn,void 0),o(this,En,void 0),o(this,Dn,void 0),o(this,On,void 0),o(this,kn,void 0),o(this,An,void 0),o(this,jn,void 0),o(this,Mn,void 0),o(this,Nn,void 0),o(this,Pn,void 0),o(this,Fn,new Set),this.options=t,d(G,this,e),d(On,this,null),d(Dn,this,Wt()),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(p(K,this).addObserver(this),qn(p(K,this),this.options)?u(J,this,Ln).call(this):this.updateResult(),u(J,this,Vn).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Jn(p(K,this),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Jn(p(K,this),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,u(J,this,Hn).call(this),u(J,this,Un).call(this),p(K,this).removeObserver(this)}setOptions(e){let t=this.options,n=p(K,this);if(this.options=p(G,this).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof H(this.options.enabled,p(K,this))!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);u(J,this,Wn).call(this),p(K,this).setOptions(this.options),t._defaulted&&!jt(this.options,t)&&p(G,this).getQueryCache().notify({type:`observerOptionsUpdated`,query:p(K,this),observer:this});let r=this.hasListeners();r&&Yn(p(K,this),n,this.options,t)&&u(J,this,Ln).call(this),this.updateResult(),r&&(p(K,this)!==n||H(this.options.enabled,p(K,this))!==H(t.enabled,p(K,this))||Ct(this.options.staleTime,p(K,this))!==Ct(t.staleTime,p(K,this)))&&u(J,this,Rn).call(this);let i=u(J,this,zn).call(this);r&&(p(K,this)!==n||H(this.options.enabled,p(K,this))!==H(t.enabled,p(K,this))||i!==p(Pn,this))&&u(J,this,Bn).call(this,i)}getOptimisticResult(e){let t=p(G,this).getQueryCache().build(p(G,this),e),n=this.createResult(t,e);return Zn(this,n)&&(d(q,this,n),d(En,this,this.options),d(Tn,this,p(K,this).state)),n}getCurrentResult(){return p(q,this)}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&p(Dn,this).status===`pending`&&p(Dn,this).reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){p(Fn,this).add(e)}getCurrentQuery(){return p(K,this)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=p(G,this).defaultQueryOptions(e),n=p(G,this).getQueryCache().build(p(G,this),t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return u(J,this,Ln).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),p(q,this)))}createResult(e,t){let n=p(K,this),r=this.options,i=p(q,this),a=p(Tn,this),o=p(En,this),s=e===n?p(wn,this):e.state,{state:c}=e,l={...c},u=!1,f;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&qn(e,t),o=i&&Yn(e,n,t,r);(a||o)&&(l={...l,...xn(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:m,errorUpdatedAt:h,status:g}=l;f=l.data;let _=!1;if(t.placeholderData!==void 0&&f===void 0&&g===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,_=!0):e=typeof t.placeholderData==`function`?t.placeholderData(p(jn,this)?.state.data,p(jn,this)):t.placeholderData,e!==void 0&&(g=`success`,f=It(i?.data,e,t),u=!0)}if(t.select&&f!==void 0&&!_)if(i&&f===a?.data&&t.select===p(kn,this))f=p(An,this);else try{d(kn,this,t.select),f=t.select(f),f=It(i?.data,f,t),d(An,this,f),d(On,this,null)}catch(e){d(On,this,e)}p(On,this)&&(m=p(On,this),f=p(An,this),h=Date.now(),g=`error`);let v=l.fetchStatus===`fetching`,y=g===`pending`,b=g===`error`,x=y&&v,S=f!==void 0,C={status:g,fetchStatus:l.fetchStatus,isPending:y,isSuccess:g===`success`,isError:b,isInitialLoading:x,isLoading:x,data:f,dataUpdatedAt:l.dataUpdatedAt,error:m,errorUpdatedAt:h,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:v,isRefetching:v&&!y,isLoadingError:b&&!S,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:b&&S,isStale:Xn(e,t),refetch:this.refetch,promise:p(Dn,this),isEnabled:H(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=C.data!==void 0,r=C.status===`error`&&!t,i=e=>{r?e.reject(C.error):t&&e.resolve(C.data)},a=()=>{let e=d(Dn,this,C.promise=Wt());i(e)},o=p(Dn,this);switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||C.data!==o.value)&&a();break;case`rejected`:(!r||C.error!==o.reason)&&a()}}return C}updateResult(){let e=p(q,this),t=this.createResult(p(K,this),this.options);d(Tn,this,p(K,this).state),d(En,this,this.options),p(Tn,this).data!==void 0&&d(jn,this,p(K,this)),!jt(t,e)&&(d(q,this,t),u(J,this,Gn).call(this,{listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!p(Fn,this).size)return!0;let r=new Set(n??p(Fn,this));return this.options.throwOnError&&r.add(`error`),Object.keys(p(q,this)).some(t=>{let n=t;return p(q,this)[n]!==e[n]&&r.has(n)})})()}))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&u(J,this,Vn).call(this)}});function Ln(e){u(J,this,Wn).call(this);let t=p(K,this).fetch(this.options,e);return e?.throwOnError||(t=t.catch(V)),t}function Rn(){u(J,this,Hn).call(this);let e=Ct(this.options.staleTime,p(K,this));if(Ut.isServer()||p(q,this).isStale||!xt(e))return;let t=St(p(q,this).dataUpdatedAt,e)+1;d(Mn,this,_t.setTimeout(()=>{p(q,this).isStale||this.updateResult()},t))}function zn(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(p(K,this)):this.options.refetchInterval)??!1}function Bn(e){u(J,this,Un).call(this),d(Pn,this,e),!(Ut.isServer()||H(this.options.enabled,p(K,this))===!1||!xt(p(Pn,this))||p(Pn,this)===0)&&d(Nn,this,_t.setInterval(()=>{(this.options.refetchIntervalInBackground||pt.isFocused())&&u(J,this,Ln).call(this)},p(Pn,this)))}function Vn(){u(J,this,Rn).call(this),u(J,this,Bn).call(this,u(J,this,zn).call(this))}function Hn(){p(Mn,this)!==void 0&&(_t.clearTimeout(p(Mn,this)),d(Mn,this,void 0))}function Un(){p(Nn,this)!==void 0&&(_t.clearInterval(p(Nn,this)),d(Nn,this,void 0))}function Wn(){let e=p(G,this).getQueryCache().build(p(G,this),this.options);if(e===p(K,this))return;let t=p(K,this);d(K,this,e),d(wn,this,e.state),this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}function Gn(e){U.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(p(q,this))}),p(G,this).getQueryCache().notify({query:p(K,this),type:`observerResultsUpdated`})})}function Kn(e,t){return H(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||H(t.retryOnMount,e)!==!1)}function qn(e,t){return Kn(e,t)||e.state.data!==void 0&&Jn(e,t,t.refetchOnMount)}function Jn(e,t,n){if(H(t.enabled,e)!==!1&&Ct(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Xn(e,t)}return!1}function Yn(e,t,n,r){return(e!==t||H(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Xn(e,n)}function Xn(e,t){return H(t.enabled,e)!==!1&&e.isStaleByTime(Ct(t.staleTime,e))}function Zn(e,t){return!jt(e.getCurrentResult(),t)}var Qn,$n,Y,er,tr,nr=(Qn=new WeakMap,$n=new WeakMap,Y=new WeakMap,er=new WeakMap,tr=new WeakSet,class extends nn{constructor(e){super(),ln(this,tr),o(this,Qn,void 0),o(this,$n,void 0),o(this,Y,void 0),o(this,er,void 0),d(Qn,this,e.client),this.mutationId=e.mutationId,d(Y,this,e.mutationCache),d($n,this,[]),this.state=e.state||ir(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){p($n,this).includes(e)||(p($n,this).push(e),this.clearGcTimeout(),p(Y,this).notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){d($n,this,p($n,this).filter(t=>t!==e)),this.scheduleGc(),p(Y,this).notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){p($n,this).length||(this.state.status===`pending`?this.scheduleGc():p(Y,this).remove(this))}continue(){return p(er,this)?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{u(tr,this,rr).call(this,{type:`continue`})},n={client:p(Qn,this),meta:this.options.meta,mutationKey:this.options.mutationKey};d(er,this,en({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{u(tr,this,rr).call(this,{type:`failed`,failureCount:e,error:t})},onPause:()=>{u(tr,this,rr).call(this,{type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>p(Y,this).canRun(this)}));let r=this.state.status===`pending`,i=!p(er,this).canStart();try{if(r)t();else{u(tr,this,rr).call(this,{type:`pending`,variables:e,isPaused:i}),p(Y,this).config.onMutate&&await p(Y,this).config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&u(tr,this,rr).call(this,{type:`pending`,context:t,variables:e,isPaused:i})}let a=await p(er,this).start();return await p(Y,this).config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await p(Y,this).config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),u(tr,this,rr).call(this,{type:`success`,data:a}),a}catch(t){try{await p(Y,this).config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await p(Y,this).config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw u(tr,this,rr).call(this,{type:`error`,error:t}),t}finally{p(Y,this).runNext(this)}}});function rr(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),U.batch(()=>{p($n,this).forEach(t=>{t.onMutationUpdate(e)}),p(Y,this).notify({mutation:this,type:`updated`,action:e})})}function ir(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var ar,or,sr,cr=(ar=new WeakMap,or=new WeakMap,sr=new WeakMap,class extends lt{constructor(e={}){super(),o(this,ar,void 0),o(this,or,void 0),o(this,sr,void 0),this.config=e,d(ar,this,new Set),d(or,this,new Map),d(sr,this,0)}build(e,t,n){var r;let i=new nr({client:e,mutationCache:this,mutationId:d(sr,this,(r=p(sr,this),++r)),options:e.defaultMutationOptions(t),state:n});return this.add(i),i}add(e){p(ar,this).add(e);let t=lr(e);if(typeof t==`string`){let n=p(or,this).get(t);n?n.push(e):p(or,this).set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(p(ar,this).delete(e)){let t=lr(e);if(typeof t==`string`){let n=p(or,this).get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&p(or,this).delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=lr(e);if(typeof t==`string`){let n=p(or,this).get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=lr(e);return typeof t==`string`?(p(or,this).get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){U.batch(()=>{p(ar,this).forEach(e=>{this.notify({type:`removed`,mutation:e})}),p(ar,this).clear(),p(or,this).clear()})}getAll(){return Array.from(p(ar,this))}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Tt(t,e))}findAll(e={}){return this.getAll().filter(t=>Tt(e,t))}notify(e){U.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return U.batch(()=>Promise.all(e.map(e=>e.continue().catch(V))))}});function lr(e){return e.options.scope?.id}var ur,dr=(ur=new WeakMap,class extends lt{constructor(e={}){super(),o(this,ur,void 0),this.config=e,d(ur,this,new Map)}build(e,t,n){let r=t.queryKey,i=t.queryHash??Et(r,t),a=this.get(i);return a||(a=new vn({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){p(ur,this).has(e.queryHash)||(p(ur,this).set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=p(ur,this).get(e.queryHash);t&&(e.destroy(),t===e&&p(ur,this).delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){U.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return p(ur,this).get(e)}getAll(){return[...p(ur,this).values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>wt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>wt(e,t)):t}notify(e){U.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){U.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){U.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}}),X,fr,pr,mr,hr,gr,_r,vr,yr=(X=new WeakMap,fr=new WeakMap,pr=new WeakMap,mr=new WeakMap,hr=new WeakMap,gr=new WeakMap,_r=new WeakMap,vr=new WeakMap,class{constructor(e={}){o(this,X,void 0),o(this,fr,void 0),o(this,pr,void 0),o(this,mr,void 0),o(this,hr,void 0),o(this,gr,void 0),o(this,_r,void 0),o(this,vr,void 0),d(X,this,e.queryCache||new dr),d(fr,this,e.mutationCache||new cr),d(pr,this,e.defaultOptions||{}),d(mr,this,new Map),d(hr,this,new Map),d(gr,this,0)}mount(){var e;d(gr,this,(e=p(gr,this),e++,e)),p(gr,this)===1&&(d(_r,this,pt.subscribe(async e=>{e&&(await this.resumePausedMutations(),p(X,this).onFocus())})),d(vr,this,Xt.subscribe(async e=>{e&&(await this.resumePausedMutations(),p(X,this).onOnline())})))}unmount(){var e;d(gr,this,(e=p(gr,this),e--,e)),p(gr,this)===0&&(p(_r,this)?.call(this),d(_r,this,void 0),p(vr,this)?.call(this),d(vr,this,void 0))}isFetching(e){return p(X,this).findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return p(fr,this).findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return p(X,this).get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=p(X,this).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ct(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return p(X,this).findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=p(X,this).get(r.queryHash)?.state.data,a=bt(t,i);if(a!==void 0)return p(X,this).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return U.batch(()=>p(X,this).findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return p(X,this).get(t.queryHash)?.state}removeQueries(e){let t=p(X,this);U.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=p(X,this);return U.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=U.batch(()=>p(X,this).findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(V).catch(V)}invalidateQueries(e,t={}){return U.batch(()=>(p(X,this).findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=U.batch(()=>p(X,this).findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(V)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(V)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=p(X,this).build(this,t);return n.isStaleByTime(Ct(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(V).catch(V)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(V).catch(V)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Xt.isOnline()?p(fr,this).resumePausedMutations():Promise.resolve()}getQueryCache(){return p(X,this)}getMutationCache(){return p(fr,this)}getDefaultOptions(){return p(pr,this)}setDefaultOptions(e){d(pr,this,e)}setQueryDefaults(e,t){p(mr,this).set(Dt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...p(mr,this).values()],n={};return t.forEach(t=>{Ot(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){p(hr,this).set(Dt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...p(hr,this).values()],n={};return t.forEach(t=>{Ot(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...p(pr,this).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Et(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===zt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...p(pr,this).mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){p(X,this).clear(),p(fr,this).clear()}}),Z=e(n(),1),Q=t(),br=Z.createContext(void 0),xr=e=>{let t=Z.useContext(br);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Sr=({client:e,children:t})=>(Z.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,Q.jsx)(br.Provider,{value:e,children:t})),Cr=Z.createContext(!1),wr=()=>Z.useContext(Cr);Cr.Provider;function Tr(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Er=Z.createContext(Tr()),Dr=()=>Z.useContext(Er),Or=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?Vt(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},kr=e=>{Z.useEffect(()=>{e.clearReset()},[e])},Ar=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Vt(n,[e.error,r])),jr=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Mr=(e,t)=>e.isLoading&&e.isFetching&&!t,Nr=(e,t)=>e?.suspense&&t.isPending,Pr=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Fr(e,t,n){let r=wr(),i=Dr(),a=xr(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,jr(o),Or(o,i,s),kr(i);let l=!a.getQueryCache().get(o.queryHash),[u]=Z.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(Z.useSyncExternalStore(Z.useCallback(e=>{let t=f?u.subscribe(U.batchCalls(e)):V;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),Z.useEffect(()=>{u.setOptions(o)},[o,u]),Nr(o,d))throw Pr(o,u,i);if(Ar({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!Ut.isServer()&&Mr(d,r)&&(l?Pr(o,u,i):s?.promise)?.catch(V).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function Ir(e,t){return Fr(e,In,t)}var Lr=e(a(),1),Rr={id:`home`,kind:`home`,path:`/`},zr=[`/models`,`/personas`,`/gallery`,`/agents`,`/users`,`/usage`,`/system`,`/artifacts`],Br=e=>{if(e===`/`||e===`/home`)return Rr;if(e===`/chat`)return{id:`chat:new`,kind:`chat`,path:`/chat`};let t=e.match(/^\/c\/([^/]+)$/);if(t)return{id:`chat:${t[1]}`,kind:`chat`,path:e};if(e===`/work`)return{id:`work:new`,kind:`work`,path:`/work`};let n=e.match(/^\/work\/([^/]+)$/);return n?{id:`work:${n[1]}`,kind:`work`,path:e}:zr.includes(e)?{id:`page:${e}`,kind:`page`,path:e}:null},Vr=e=>[Rr,...e.filter(e=>e.id!==Rr.id)],Hr=Ue()(We((e,t)=>({tabs:[Rr],activeTabId:Rr.id,syncWithPath:t=>{let n=Br(t);n&&e(e=>{let t=Vr(e.tabs),r=t.find(e=>e.id===n.id);if(r)return{tabs:t,activeTabId:r.id};let i=t.find(t=>t.id===e.activeTabId);return i&&i.kind===n.kind&&i.id.endsWith(`:new`)&&!n.id.endsWith(`:new`)?{tabs:t.map(e=>e.id===i.id?n:e),activeTabId:n.id}:{tabs:[...t,n],activeTabId:n.id}})},closeTab:e=>t().closeTabs([e]),closeTabs:(n,r)=>{let i=t(),a=Vr(i.tabs),o=new Set(n.filter(e=>e!==Rr.id&&a.some(t=>t.id===e)));if(o.size===0)return null;let s=a.findIndex(e=>e.id===i.activeTabId),c=a.filter(e=>!o.has(e.id));if(!o.has(i.activeTabId))return e({tabs:c}),null;let l=r?c.find(e=>e.id===r):void 0,u=a.slice(0,Math.max(0,s)).reverse().find(e=>!o.has(e.id)),d=l??u??c[0]??Rr;return e({tabs:c,activeTabId:d.id}),d},reset:()=>e({tabs:[Rr],activeTabId:Rr.id})}),{name:`libre-webui-tabs`,merge:(e,t)=>{let n=e??{},r=Array.isArray(n.tabs)?Vr(n.tabs.filter(e=>!!e&&typeof e.id==`string`&&typeof e.path==`string`&&Br(e.path)?.id===e.id)):t.tabs,i=r.some(e=>e.id===n.activeTabId)?n.activeTabId:Rr.id;return{...t,tabs:r,activeTabId:i}}})),Ur=i(),Wr=L(`components:avatar-upload`),Gr=({value:e,onChange:t,className:n=``})=>{let{t:r}=x(),i=(0,Z.useRef)(null),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(!1),l=async e=>{if(!e.type.startsWith(`image/`)){F.error(r(`user.avatar.invalidFile`));return}if(e.size>2097152){F.error(r(`user.avatar.fileTooLarge`));return}o(!0);try{let n=new FileReader;n.onload=e=>{let n=e.target?.result;t(n),F.success(r(`user.avatar.uploaded`))},n.onerror=()=>{F.error(r(`user.avatar.readFailed`))},n.readAsDataURL(e)}catch(e){Wr.error(`Failed to upload avatar:`,e),F.error(r(`user.avatar.uploadFailed`))}finally{o(!1)}},u=e=>{let t=e.target.files?.[0];t&&l(t)},d=e=>{e.preventDefault(),c(!0)},f=e=>{e.preventDefault(),c(!1)},p=e=>{e.preventDefault(),c(!1);let t=e.dataTransfer.files?.[0];t&&l(t)},m=()=>{t(``),F.success(r(`user.avatar.removed`))},h=()=>e||null;return(0,Q.jsx)(`div`,{className:`space-y-4 ${n}`,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`block text-sm font-medium text-gray-700 dark:text-dark-600 mb-2`,children:r(`user.avatar.label`)}),(0,Q.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,Q.jsx)(`div`,{className:`flex-shrink-0`,children:(0,Q.jsx)(`div`,{className:`w-20 h-20 rounded-full overflow-hidden bg-gray-100 dark:bg-dark-200 border-2 border-gray-300 dark:border-dark-300 flex items-center justify-center`,children:h()?(0,Q.jsx)(`img`,{src:h(),alt:`Avatar preview`,className:`w-full h-full object-cover`}):(0,Q.jsx)(he,{className:`h-8 w-8 text-gray-400 dark:text-gray-500`})})}),(0,Q.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[e?(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 p-3 bg-gray-50 dark:bg-dark-200 rounded-lg`,children:[(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:r(`user.avatar.customAvatar`)}),(0,Q.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400`,children:r(`user.avatar.clickToChange`)})]}),(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,onClick:m,className:`text-red-600 hover:text-red-700 hover:bg-red-50 dark:text-red-400 dark:hover:text-red-300 dark:hover:bg-red-900/20`,children:(0,Q.jsx)(Oe,{className:`h-4 w-4`})})]}):(0,Q.jsxs)(`div`,{className:`border-2 border-dashed rounded-lg p-4 text-center cursor-pointer transition-colors ${s?`border-primary-500 bg-primary-50 dark:bg-primary-900/20`:`border-gray-300 dark:border-gray-600 hover:border-gray-400 dark:hover:border-gray-500`}`,onDragOver:d,onDragLeave:f,onDrop:p,onClick:()=>i.current?.click(),children:[(0,Q.jsx)(ve,{className:`h-8 w-8 mx-auto text-gray-400 dark:text-gray-500 mb-2`}),(0,Q.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 mb-2`,children:r(`user.avatar.uploadAvatarImage`)}),(0,Q.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mb-2`,children:r(`user.avatar.dragAndDrop`)}),(0,Q.jsxs)(B,{variant:`outline`,size:`sm`,disabled:a,className:`mx-auto`,children:[(0,Q.jsx)(ve,{className:`h-4 w-4 mr-2`}),r(a?`user.avatar.uploading`:`user.avatar.chooseImage`)]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`block text-xs font-medium text-gray-600 dark:text-gray-400 mb-1`,children:r(`user.avatar.enterImageUrl`)}),(0,Q.jsx)(`input`,{type:`url`,value:e,onChange:e=>t(e.target.value),className:`w-full px-3 py-2 text-sm border border-gray-300 dark:border-dark-300 rounded-md bg-white dark:bg-dark-50 text-gray-900 dark:text-dark-800`,placeholder:`https://example.com/avatar.jpg`})]})]})]}),(0,Q.jsx)(`input`,{ref:i,type:`file`,accept:`image/*`,onChange:u,className:`hidden`}),(0,Q.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 mt-2`,children:r(`user.avatar.supportedFormats`)})]})})};function Kr({open:e,value:t,saving:n,onChange:r,onClose:i,onSave:a}){let{t:o}=x();return e?(0,Ur.createPortal)((0,Q.jsx)(`div`,{className:`fixed inset-0 z-[2147483647] flex items-center justify-center bg-gray-950/55 p-4 backdrop-blur-md`,onClick:i,children:(0,Q.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`avatar-modal-title`,className:`bg-white dark:bg-dark-25 rounded-3xl shadow-[0_24px_80px_rgba(0,0,0,0.24)] p-6 w-full max-w-md border border-black/[0.07] dark:border-white/[0.08] animate-scale-in`,onClick:e=>e.stopPropagation(),children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Q.jsx)(`h3`,{id:`avatar-modal-title`,className:`text-lg font-medium tracking-[-0.02em] text-gray-950 dark:text-dark-950`,children:o(`user.avatar.title`)}),(0,Q.jsx)(`button`,{onClick:i,className:`p-2 hover:bg-gray-100 dark:hover:bg-dark-200 rounded-xl transition-colors`,children:(0,Q.jsx)(Oe,{size:20,className:`text-gray-500`})})]}),(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(Gr,{value:t,onChange:r}),(0,Q.jsxs)(`div`,{className:`flex justify-end gap-3 pt-4 border-t border-gray-200 dark:border-dark-300`,children:[(0,Q.jsx)(`button`,{onClick:i,className:`px-4 py-2 text-sm font-medium text-gray-700 dark:text-dark-700 hover:bg-gray-100 dark:hover:bg-dark-200 rounded-xl transition-colors`,children:o(`common.cancel`)}),(0,Q.jsx)(`button`,{onClick:a,disabled:n,className:`px-4 py-2 text-sm font-medium text-white bg-gray-950 hover:bg-gray-800 dark:bg-white dark:text-gray-950 dark:hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed rounded-xl transition-colors`,children:o(n?`common.saving`:`common.save`)})]})]})]})}),document.body):null}var qr={sm:`text-[1.0625rem] leading-none`,md:`text-[1.625rem] leading-none`,lg:`text-[2.5rem] leading-none`},Jr=({className:e,size:t=`md`,wordmark:n=!0})=>(0,Q.jsxs)(`span`,{dir:`ltr`,className:R(`libre-brand inline-flex items-baseline whitespace-nowrap`,qr[t],e),children:[`Libre`,n&&(0,Q.jsx)(`span`,{className:`ms-1 font-normal tracking-[-0.035em]`,children:`WebUI`})]}),Yr=()=>{let{theme:e,toggleTheme:t}=ot(),n=e.mode===`light`?`dark`:`light`,r=e.mode===`light`?(0,Q.jsx)(ue,{className:`h-4 w-4 text-ink-muted transition-colors duration-150 group-hover:text-ink motion-reduce:transition-none`,strokeWidth:1.75,"aria-hidden":`true`}):(0,Q.jsx)(Be,{className:`h-4 w-4 text-ink-muted transition-colors duration-150 group-hover:text-ink motion-reduce:transition-none`,strokeWidth:1.75,"aria-hidden":`true`}),i=`Switch to ${n} mode`;return(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,onClick:t,className:`h-9 w-9 rounded-full p-0`,"aria-label":i,title:`${i} (⌘D)`,children:r})};function Xr({sidebarCompact:e,isElectron:t,showWork:n,activeMode:r,selectedModel:i,modelCount:a,onToggleCompact:o,onStartWork:s,onCreateSession:c}){let{t:l}=x(),u=!i||a===0,d=u?l(`chat.model.noModelsTooltip`):``;return(0,Q.jsxs)(`div`,{className:R(e?`px-2 pb-3 pt-3`:`px-4 pb-4 pt-4`,t&&`pt-10`),children:[(0,Q.jsx)(`div`,{className:R(`flex items-center`,e?`justify-center mb-3`:`justify-between mb-4`),children:e?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,Q.jsx)(Jr,{size:`sm`,wordmark:!1,className:`text-gray-950 dark:text-dark-950 text-base tracking-[-0.035em]`}),(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,onClick:o,className:`h-9 w-9 p-0 rounded-xl text-gray-500 dark:text-dark-600 hover:bg-white/80 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation`,title:l(`sidebar.expandSidebar`),"aria-label":l(`sidebar.expandSidebar`),children:(0,Q.jsx)(je,{className:`h-4 w-4 rtl:rotate-180`})}),(0,Q.jsx)(Yr,{})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Jr,{size:`sm`,className:`text-gray-950 dark:text-dark-950 tracking-[-0.035em]`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,Q.jsx)(Yr,{}),(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,onClick:o,className:`h-9 w-9 p-0 rounded-xl text-gray-500 dark:text-dark-600 hover:bg-white/80 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation`,title:l(`sidebar.toggleSize`),"aria-label":l(`sidebar.toggleSize`),children:(0,Q.jsx)(Ce,{className:`h-4 w-4 rtl:rotate-180`})})]})]})}),(0,Q.jsxs)(`div`,{className:R(`grid w-full gap-2`,e||!n?`grid-cols-1`:`grid-cols-2`),"data-testid":`sidebar-create-actions`,children:[n&&(0,Q.jsxs)(B,{variant:r===`work`?`primary`:`secondary`,onClick:s,className:R(`h-10 rounded-xl shadow-none touch-manipulation`,e&&`w-full p-0`),size:`sm`,title:l(`chat.session.work`),"aria-label":l(`chat.session.work`),"aria-pressed":r===`work`,"data-testid":`sidebar-work-button`,children:[(0,Q.jsx)(Ie,{className:`h-4 w-4`}),!e&&l(`chat.session.work`)]}),(0,Q.jsxs)(B,{variant:r===`chat`?`primary`:`secondary`,onClick:c,disabled:u,className:R(`h-10 rounded-xl shadow-none touch-manipulation`,e&&`w-full p-0`),size:`sm`,title:u?d:l(`chat.session.chat`),"aria-label":l(`chat.session.chat`),"aria-pressed":r===`chat`,"data-testid":`sidebar-chat-button`,children:[(0,Q.jsx)(Fe,{className:`h-4 w-4`}),!e&&l(`chat.session.chat`)]})]}),(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`sidebar-search-button`,onClick:()=>window.dispatchEvent(new Event(`libre:open-palette`)),title:l(`palette.search`,`Search`),"aria-label":l(`palette.search`,`Search`),className:R(`mt-2 flex items-center gap-2.5 rounded-xl text-[13px] text-gray-500 transition-colors hover:bg-white/60 hover:text-gray-950 dark:text-dark-600 dark:hover:bg-dark-200/60 dark:hover:text-dark-950 outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30 touch-manipulation`,e?`h-11 w-11 justify-center p-0 mx-auto`:`w-full px-2.5 py-2`),children:[(0,Q.jsx)(N,{className:`h-4 w-4 shrink-0`}),!e&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`flex-1 text-start`,children:l(`palette.search`,`Search`)}),(0,Q.jsxs)(`span`,{className:`font-mono text-[10px] tracking-wide text-gray-400 dark:text-dark-500`,children:[Xe()?`⌘`:`Ctrl`,`K`]})]})]})]})}var Zr=[{path:`/notes`,icon:le,labelKey:`sidebar.navigation.notes`},{path:`/models`,icon:ce,labelKey:`sidebar.navigation.models`},{path:`/personas`,icon:he,labelKey:`sidebar.navigation.personas`},{path:`/gallery`,icon:oe,labelKey:`sidebar.navigation.imagine`},{path:`/agents`,icon:xe,labelKey:`sidebar.navigation.agents`}];function Qr({sidebarCompact:e,activePath:t,showAgents:n,onMobileNavigate:r}){let{t:i}=x();return(0,Q.jsx)(`div`,{className:R(`pb-3`,e?`px-2`:`px-3`),children:(0,Q.jsx)(`nav`,{"data-testid":`sidebar-navigation`,"aria-label":i(`sidebar.navigation.exploreLabel`,`Explore`),className:R(`flex gap-1`,e?`flex-col items-center`:`items-center`),children:Zr.filter(e=>e.path!==`/agents`||n).map(({path:n,icon:a,labelKey:o})=>{let s=t===n,c=i(o);return(0,Q.jsx)(v,{to:n,onClick:r,title:c,"aria-label":c,"aria-current":s?`page`:void 0,className:R(`flex items-center justify-center rounded-xl transition-colors duration-150 touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,e?`h-11 w-11`:`h-9 flex-1`,s?`bg-white text-gray-950 ring-1 ring-black/[0.04] dark:bg-dark-200 dark:text-dark-950 dark:ring-white/[0.06]`:`text-gray-500 hover:bg-white/60 hover:text-gray-950 dark:text-dark-600 dark:hover:bg-dark-200/60 dark:hover:text-dark-950`),children:(0,Q.jsx)(a,{className:`h-[18px] w-[18px] shrink-0`})},n)})})})}function $r(e){let t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),r=864e5;return e>=n?`today`:e>=n-r?`yesterday`:e>=n-7*r?`previous7Days`:e>=n-30*r?`previous30Days`:`older`}var ei=[`today`,`yesterday`,`previous7Days`,`previous30Days`,`older`];function ti({preview:e}){let{t,i18n:n}=x(),{session:r}=e,i=r.messages.find(e=>e.role===`user`&&e.content.trim()),a=r.messages.find(e=>e.role===`assistant`&&e.content.trim());return(0,Ur.createPortal)((0,Q.jsxs)(`div`,{role:`tooltip`,className:`pointer-events-none fixed z-[70] w-72 rounded-2xl border border-black/[0.07] bg-surface/95 p-3.5 shadow-[0_16px_48px_rgba(15,23,42,0.18)] backdrop-blur-xl animate-scale-in dark:border-white/[0.09] dark:bg-dark-100/95`,style:{top:Math.max(8,Math.min(e.top,window.innerHeight-220)),left:e.left},children:[(0,Q.jsx)(`p`,{className:`mb-1 truncate text-[13px] font-semibold text-gray-900 dark:text-dark-900`,children:r.title}),(0,Q.jsx)(`p`,{className:`mb-2 text-[10px] tabular-nums text-gray-400 dark:text-dark-500`,children:Ze(r.updatedAt,n.language)}),i&&(0,Q.jsx)(`div`,{className:`mb-1.5 flex justify-end`,children:(0,Q.jsx)(`p`,{dir:`auto`,className:`max-w-[85%] rounded-xl rounded-ee-sm bg-gray-900 px-2.5 py-1.5 text-[11px] leading-snug text-white dark:bg-dark-300`,children:Qe(i.content,110)})}),a&&(0,Q.jsx)(`p`,{dir:`auto`,className:`text-[11px] leading-snug text-gray-600 dark:text-dark-700`,children:Qe(a.content.replace(/\s+/g,` `),180)}),!i&&!a&&(0,Q.jsx)(`p`,{className:`text-[11px] italic text-gray-400 dark:text-dark-500`,children:t(`chat.session.noChats`)})]}),document.body)}function ni({sessions:e,personas:t,currentSessionId:n,generatingTitleForSession:r,sidebarCompact:i,editingSessionId:a,editingTitle:o,onEditingTitleChange:s,onSelectSession:c,onStartEditing:l,onSaveEdit:u,onCancelEdit:d,onDeleteSession:f,onArchiveSession:p,folders:m=[],onCreateFolder:h,onRenameFolder:g,onDeleteFolder:_,onMoveSession:v}){let{t:y,i18n:b}=x(),[S,C]=(0,Z.useState)(null),w=(0,Z.useRef)(null);(0,Z.useEffect)(()=>()=>{w.current!==null&&window.clearTimeout(w.current)},[]);let T=()=>{w.current!==null&&(window.clearTimeout(w.current),w.current=null),C(null)},D=(e,t)=>{i||(w.current!==null&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>{let n=t.getBoundingClientRect();C({session:e,top:n.top,left:n.right+10})},500))},[O,ee]=(0,Z.useState)(()=>new Set),[te,k]=(0,Z.useState)(!1),[A,j]=(0,Z.useState)(``),[M,N]=(0,Z.useState)(null),[ie,P]=(0,Z.useState)(null),ae=e=>{ee(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},oe=()=>{let e=A.trim();k(!1),j(``),e&&h&&h(e)},F=e=>{let t=A.trim();N(null),j(``),t&&g&&g(e,t)},ce=new Set(m.map(e=>e.id)),le=e.filter(e=>!e.folderId||!ce.has(e.folderId)),ue=[...m.map(t=>({key:`folder:${t.id}`,folder:t,sessions:e.filter(e=>e.folderId===t.id)})),...ei.map(e=>({key:e,labelKey:e,sessions:le.filter(t=>$r(t.updatedAt)===e)})).filter(e=>e.sessions.length>0)];return(0,Q.jsxs)(`div`,{"data-testid":`sidebar-session-scroll-region`,className:`scroll-region min-h-0 flex-1 scrollbar-thin border-t border-black/[0.05] dark:border-white/[0.05]`,style:{willChange:`scroll-position`},children:[(0,Q.jsxs)(`div`,{className:R(`px-3 py-3`,i&&`px-2`),children:[!i&&e.length>0&&(0,Q.jsxs)(`div`,{className:`flex items-center justify-between mb-2 px-1`,children:[(0,Q.jsx)(`h3`,{className:`text-[10px] font-semibold text-gray-500 dark:text-dark-500 uppercase tracking-[0.16em] rtl:tracking-normal`,children:y(`chat.session.chats`)}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[h&&(0,Q.jsx)(`button`,{onClick:()=>{k(!0),j(``)},className:`rounded-md p-0.5 text-gray-400 transition-colors hover:bg-white/70 hover:text-gray-700 dark:text-dark-500 dark:hover:bg-dark-200 dark:hover:text-dark-800`,title:y(`chat.session.folder.new`),children:(0,Q.jsx)(re,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(`span`,{className:`text-[10px] tabular-nums text-gray-400 dark:text-dark-500 font-medium`,children:e.length})]})]}),!i&&te&&(0,Q.jsx)(`div`,{className:`mb-2 px-1`,children:(0,Q.jsx)(ct,{value:A,onChange:e=>j(e.target.value),onKeyDown:e=>{e.key===`Enter`?oe():e.key===`Escape`&&(k(!1),j(``))},onBlur:oe,placeholder:y(`chat.session.folder.namePlaceholder`),className:`h-8 text-sm`,autoFocus:!0})}),e.length===0?(0,Q.jsxs)(`div`,{className:R(`text-center py-8`,i?`px-1`:`px-2`),children:[(0,Q.jsx)(`div`,{className:R(`mx-auto mb-3 bg-white/70 dark:bg-dark-200 rounded-xl flex items-center justify-center ring-1 ring-black/[0.04] dark:ring-white/[0.05]`,i?`w-8 h-8`:`w-12 h-12`),children:(0,Q.jsx)(Fe,{className:R(`text-gray-400 dark:text-gray-500`,i?`h-4 w-4`:`h-5 w-5`)})}),!i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-gray-600 dark:text-dark-600`,children:y(`chat.session.noChats`)}),(0,Q.jsx)(`p`,{className:`text-xs mt-1 text-gray-400 dark:text-dark-500`,children:y(`chat.session.createFirst`)})]})]}):(0,Q.jsx)(`div`,{className:R(`space-y-2`,i&&`space-y-1`),children:ue.map(e=>(0,Q.jsxs)(`div`,{children:[!i&&e.folder&&(0,Q.jsx)(`div`,{className:`group/folder mb-1 flex items-center justify-between px-1`,children:M===e.folder.id?(0,Q.jsx)(ct,{value:A,onChange:e=>j(e.target.value),onKeyDown:t=>{t.key===`Enter`?F(e.folder.id):t.key===`Escape`&&(N(null),j(``))},onBlur:()=>F(e.folder.id),className:`h-7 text-sm`,autoFocus:!0}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{onClick:()=>ae(e.folder.id),className:`flex min-w-0 flex-1 items-center gap-1 text-[11px] font-semibold text-gray-500 transition-colors hover:text-gray-800 dark:text-dark-600 dark:hover:text-dark-800`,"aria-expanded":!O.has(e.folder.id),children:[O.has(e.folder.id)?(0,Q.jsx)(je,{className:`h-3 w-3 shrink-0 rtl:rotate-180`}):(0,Q.jsx)(fe,{className:`h-3 w-3 shrink-0`}),(0,Q.jsx)(ne,{className:`h-3 w-3 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.folder.name}),(0,Q.jsx)(`span`,{className:`text-[10px] font-medium tabular-nums text-gray-400 dark:text-dark-500`,children:e.sessions.length})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-0.5 opacity-0 transition-opacity group-hover/folder:opacity-100`,children:[g&&(0,Q.jsx)(`button`,{onClick:()=>{N(e.folder.id),j(e.folder.name)},className:`rounded-md p-0.5 text-gray-400 hover:text-gray-700 dark:text-dark-500 dark:hover:text-dark-800`,title:y(`chat.session.renameChat`),children:(0,Q.jsx)(se,{className:`h-3 w-3`})}),_&&(0,Q.jsx)(`button`,{onClick:()=>{window.confirm(y(`chat.session.folder.deleteConfirm`))&&_(e.folder.id)},className:`rounded-md p-0.5 text-gray-400 hover:text-red-500 dark:text-dark-500 dark:hover:text-red-400`,title:y(`chat.session.folder.delete`),children:(0,Q.jsx)(De,{className:`h-3 w-3`})})]})]})}),!i&&!e.folder&&(0,Q.jsx)(`p`,{className:`mb-1 px-1 text-[10px] font-semibold uppercase tracking-[0.12em] text-gray-400 dark:text-dark-500 rtl:tracking-normal`,children:y(`chat.session.groups.${e.labelKey}`)}),e.folder&&O.has(e.folder.id)?null:(0,Q.jsx)(`div`,{className:R(`space-y-0.5`,i&&`space-y-1`),children:e.sessions.map(e=>{let h=n===e.id,g=e.personaId?t[e.personaId]:null;return(0,Q.jsx)(`div`,{className:R(`group relative cursor-pointer transition-colors duration-150 touch-manipulation outline-none`,i?`rounded-xl p-1 flex items-center justify-center`:`rounded-lg px-2.5 py-2`,h?`bg-white ring-1 ring-black/[0.04] dark:bg-dark-200 dark:ring-white/[0.05]`:`hover:bg-white/60 dark:hover:bg-dark-200/60`),onClick:()=>c(e),onMouseEnter:t=>D(e,t.currentTarget),onMouseLeave:T,title:i?`${e.title} - ${e.model}`:void 0,children:i?(0,Q.jsx)(`div`,{className:`flex items-center justify-center w-full h-10`,children:(0,Q.jsx)(`div`,{className:R(`flex h-9 w-9 items-center justify-center rounded-xl text-[11px] font-semibold uppercase transition-colors`,r===e.id?`bg-white text-primary-600 animate-pulse dark:bg-dark-200 dark:text-primary-400`:h?`bg-gray-950 text-white dark:bg-white dark:text-gray-950`:`bg-white/70 text-gray-500 ring-1 ring-black/[0.04] dark:bg-dark-200/70 dark:text-dark-600 dark:ring-white/[0.05]`),children:e.title.trim().charAt(0)||`•`})}):a===e.id?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(ct,{value:o,onChange:e=>s(e.target.value),onKeyDown:t=>{t.key===`Enter`?u(e.id):t.key===`Escape`&&d()},className:`text-sm h-8`,autoFocus:!0}),(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>u(e.id),className:`h-8 w-8 p-0 shrink-0 hover:bg-gray-100 dark:hover:bg-dark-300 active:bg-gray-200 dark:active:bg-dark-400 touch-manipulation`,children:(0,Q.jsx)(ke,{className:`h-3 w-3`})}),(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,onClick:d,className:`h-8 w-8 p-0 shrink-0 hover:bg-gray-100 dark:hover:bg-dark-300 active:bg-gray-200 dark:active:bg-dark-400 touch-manipulation`,children:(0,Q.jsx)(Oe,{className:`h-3 w-3`})})]}):(0,Q.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0 me-2`,children:[(0,Q.jsx)(`h3`,{className:`text-[13px] font-medium truncate leading-tight text-gray-900 dark:text-dark-900`,children:r===e.id?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(`span`,{className:`animate-pulse`,children:y(`chat.session.generatingTitle`)}),(0,Q.jsxs)(`span`,{className:`inline-flex`,children:[(0,Q.jsx)(`span`,{className:`animate-bounce`,style:{animationDelay:`0ms`},children:`.`}),(0,Q.jsx)(`span`,{className:`animate-bounce`,style:{animationDelay:`150ms`},children:`.`}),(0,Q.jsx)(`span`,{className:`animate-bounce`,style:{animationDelay:`300ms`},children:`.`})]})]}):Qe(e.title,32)}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-0.5`,children:[(0,Q.jsx)(`span`,{dir:`auto`,className:R(`text-[11px] tabular-nums`,h?`text-gray-500 dark:text-dark-600`:`text-gray-400 dark:text-dark-500`),children:Ze(e.updatedAt,b.language)}),(0,Q.jsx)(`span`,{className:`text-gray-300 dark:text-dark-400`,children:`•`}),e.personaId?g?(0,Q.jsxs)(`span`,{className:R(`flex items-center gap-1 text-[11px] font-medium`,h?`text-primary-600 dark:text-primary-400`:`text-primary-500 dark:text-primary-500`),title:g.description||g.name,children:[g.avatar&&!g.avatar.startsWith(`data:`)&&(0,Q.jsx)(`span`,{className:`text-[10px]`,children:g.avatar}),(0,Q.jsx)(`span`,{className:`truncate max-w-[100px]`,children:g.name})]}):(0,Q.jsx)(`span`,{className:R(`text-[11px] font-medium italic`,h?`text-gray-500 dark:text-gray-500`:`text-gray-400 dark:text-gray-600`),children:`Persona`}):(0,Q.jsx)(`span`,{dir:`ltr`,className:R(`font-mono text-[10px] truncate max-w-[108px]`,h?`text-gray-700 dark:text-gray-300`:`text-gray-600 dark:text-gray-400`),title:e.model,children:e.model})]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100 transition-opacity duration-150 shrink-0`,children:[(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,onClick:t=>l(e,t),className:`h-7 w-7 sm:h-7 sm:w-7 p-0 hover:bg-gray-100 dark:hover:bg-dark-300 rounded-lg touch-manipulation`,title:y(`chat.session.renameChat`),children:(0,Q.jsx)(se,{className:`h-3 w-3`})}),v&&m.length>0&&(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,onClick:t=>{t.stopPropagation(),T(),P(t=>t===e.id?null:e.id)},className:`h-7 w-7 sm:h-7 sm:w-7 p-0 hover:bg-gray-100 dark:hover:bg-dark-300 rounded-lg touch-manipulation`,title:y(`chat.session.folder.move`),children:(0,Q.jsx)(E,{className:`h-3 w-3`})}),ie===e.id&&(0,Q.jsxs)(`div`,{className:`absolute end-0 top-full z-40 mt-1 w-44 rounded-xl border border-black/[0.08] bg-surface/95 p-1 shadow-[0_12px_36px_rgba(15,23,42,0.16)] backdrop-blur-xl dark:border-white/[0.09] dark:bg-dark-100/95`,onClick:e=>e.stopPropagation(),children:[m.map(t=>(0,Q.jsxs)(`button`,{onClick:()=>{P(null),v(e.id,t.id)},className:R(`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-start text-[12px] text-gray-700 hover:bg-gray-100 dark:text-dark-800 dark:hover:bg-dark-200`,e.folderId===t.id&&`text-primary-600 dark:text-primary-400`),children:[(0,Q.jsx)(ne,{className:`h-3 w-3 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:t.name})]},t.id)),e.folderId&&(0,Q.jsxs)(`button`,{onClick:()=>{P(null),v(e.id,null)},className:`flex w-full items-center gap-2 rounded-lg border-t border-gray-100 px-2 py-1.5 text-start text-[12px] text-gray-500 hover:bg-gray-100 dark:border-dark-300 dark:text-dark-600 dark:hover:bg-dark-200`,children:[(0,Q.jsx)(Oe,{className:`h-3 w-3 shrink-0`}),y(`chat.session.folder.remove`)]})]})]}),p&&(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,onClick:t=>{T(),p(e.id,t)},className:`h-7 w-7 sm:h-7 sm:w-7 p-0 hover:bg-gray-100 dark:hover:bg-dark-300 rounded-lg touch-manipulation`,title:y(`chat.session.archiveChat`),children:(0,Q.jsx)(me,{className:`h-3 w-3`})}),(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,onClick:t=>f(e.id,t),className:`h-7 w-7 sm:h-7 sm:w-7 p-0 text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg touch-manipulation`,title:y(`chat.session.deleteChat`),children:(0,Q.jsx)(De,{className:`h-3 w-3`})})]})]})},e.id)})})]},e.key))})]}),S&&(0,Q.jsx)(ti,{preview:S})]})}function ri({user:e,size:t}){let n=t===`sm`?`w-7 h-7`:`w-8 h-8`,r=t===`sm`?`text-xs`:`text-sm`;return e.avatar?(0,Q.jsx)(`img`,{src:e.avatar,alt:e.username,className:`${n} rounded-full object-cover ring-1 ring-black/10 dark:ring-white/10`,title:`${e.username} (${e.role})`}):(0,Q.jsx)(`div`,{className:`${n} bg-gray-950 dark:bg-white rounded-full flex items-center justify-center`,title:`${e.username} (${e.role})`,children:(0,Q.jsx)(`span`,{className:`text-white dark:text-gray-950 ${r} font-medium`,children:e.username.charAt(0).toUpperCase()})})}function ii({requiresAuth:e,user:t,isAdmin:n,pendingApprovalCount:r,sidebarCompact:i,userMenuOpen:a,userMenuRef:o,onToggleUserMenu:s,onOpenSettings:c,onOpenAvatar:l,onLogout:u,onMobileNavigate:d,onCloseUserMenu:f}){let{t:p}=x();return!e||!t?null:(0,Q.jsx)(`div`,{className:R(`border-t border-black/[0.05] dark:border-white/[0.05]`,i?`p-2`:`p-3`),children:i?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center space-y-2`,children:[(0,Q.jsx)(ri,{user:t,size:`sm`}),n&&(0,Q.jsxs)(v,{to:`/users`,onClick:d,className:`relative w-10 h-10 flex items-center justify-center rounded-xl text-gray-600 dark:text-dark-600 hover:bg-white/70 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation transition-colors duration-150`,title:p(`sidebar.navigation.userManagement`),children:[(0,Q.jsx)(he,{className:`h-4 w-4`}),r>0&&(0,Q.jsx)(`span`,{"data-testid":`pending-user-notification-badge`,className:`absolute -end-1 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-error-500 px-1 text-[10px] font-semibold text-white shadow-subtle`,"aria-label":p(`userManager.approval.notificationBadge`,{count:r,defaultValue:`{{count}} pending user approvals`}),children:r>99?`99+`:r})]}),n&&(0,Q.jsx)(v,{to:`/system`,onClick:d,className:`w-10 h-10 flex items-center justify-center rounded-xl text-gray-600 dark:text-dark-600 hover:bg-white/70 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation transition-colors duration-150`,title:p(`sidebar.navigation.system`),children:(0,Q.jsx)(j,{className:`h-4 w-4`})}),n&&(0,Q.jsx)(v,{to:`/usage`,onClick:d,className:`w-10 h-10 flex items-center justify-center rounded-xl text-gray-600 dark:text-dark-600 hover:bg-white/70 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation transition-colors duration-150`,title:p(`sidebar.navigation.usageAnalytics`),children:(0,Q.jsx)(Ne,{className:`h-4 w-4`})}),(0,Q.jsx)(`button`,{onClick:c,className:`w-10 h-10 flex items-center justify-center rounded-xl text-gray-600 dark:text-dark-600 hover:bg-white/70 dark:hover:bg-dark-200 hover:text-gray-950 dark:hover:text-dark-950 touch-manipulation transition-colors duration-150`,title:p(`sidebar.navigation.settings`),children:(0,Q.jsx)(T,{className:`h-4 w-4`})}),(0,Q.jsx)(`button`,{onClick:u,className:`w-10 h-10 flex items-center justify-center rounded-xl text-gray-500 dark:text-dark-500 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-600 dark:hover:text-red-400 touch-manipulation transition-colors duration-150`,title:p(`sidebar.navigation.signOut`),children:(0,Q.jsx)(we,{className:`h-4 w-4`})})]}):(0,Q.jsxs)(`div`,{className:`relative`,ref:o,children:[(0,Q.jsxs)(`button`,{onClick:s,className:`relative w-full p-2.5 rounded-xl hover:bg-white/70 dark:hover:bg-dark-200 transition-colors duration-150 text-start touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,Q.jsx)(ri,{user:t,size:`sm`}),(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:t.username}),(0,Q.jsxs)(`div`,{className:`flex items-center mt-0.5`,children:[t.role===`admin`&&(0,Q.jsx)(M,{size:10,className:`text-primary-500 me-1`}),(0,Q.jsx)(`span`,{className:`text-[11px] text-gray-500 dark:text-dark-500 capitalize`,children:t.role})]})]}),(0,Q.jsx)(je,{className:R(`h-4 w-4 text-gray-400 dark:text-dark-500 transition-transform duration-150 rtl:rotate-180`,a&&`rotate-90 rtl:rotate-90`)})]}),n&&r>0&&(0,Q.jsx)(`span`,{"data-testid":`pending-user-notification-badge`,className:`absolute -end-1 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-error-500 px-1 text-[10px] font-semibold text-white shadow-subtle`,"aria-label":p(`userManager.approval.notificationBadge`,{count:r,defaultValue:`{{count}} pending user approvals`}),children:r>99?`99+`:r})]}),a&&(0,Q.jsxs)(`div`,{"data-testid":`sidebar-user-menu`,className:`scroll-region absolute bottom-full left-0 right-0 z-50 mb-2 max-h-[calc(100dvh-1rem)] rounded-2xl border border-black/[0.07] bg-white/95 py-2 shadow-[0_18px_60px_rgba(15,23,42,0.16)] backdrop-blur-xl animate-scale-in scrollbar-thin dark:border-white/[0.08] dark:bg-dark-25/95`,children:[(0,Q.jsx)(`div`,{className:`px-3 py-2 border-b border-gray-100 dark:border-dark-200/50`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,Q.jsx)(ri,{user:t,size:`md`}),(0,Q.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:t.username}),(0,Q.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 truncate`,children:t.email||p(`user.profile.noEmail`)})]})]})}),(0,Q.jsxs)(`div`,{className:`py-1`,children:[(0,Q.jsxs)(`button`,{onClick:()=>{l(t.avatar||``),f()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150 text-start`,children:[(0,Q.jsx)(ge,{className:`h-4 w-4 shrink-0`}),p(`user.menu.changePicture`)]}),n&&(0,Q.jsxs)(v,{to:`/users`,onClick:()=>{f(),d()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150`,children:[(0,Q.jsx)(he,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 text-start`,children:p(`user.menu.userManagement`)}),r>0&&(0,Q.jsx)(`span`,{className:`ms-2 rounded-full bg-error-500 px-1.5 py-0.5 text-[10px] font-semibold text-white`,children:r>99?`99+`:r})]}),n&&(0,Q.jsxs)(v,{to:`/system`,onClick:()=>{f(),d()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150`,children:[(0,Q.jsx)(j,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 text-start`,children:p(`user.menu.system`)})]}),n&&(0,Q.jsxs)(v,{to:`/usage`,onClick:()=>{f(),d()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150`,children:[(0,Q.jsx)(Ne,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 text-start`,children:p(`user.menu.usageAnalytics`)})]}),(0,Q.jsx)(`div`,{className:`border-t border-gray-100 dark:border-dark-200/50 my-1`}),(0,Q.jsxs)(`button`,{onClick:()=>{c(),f()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-gray-700 dark:text-dark-700 hover:bg-gray-100/70 dark:hover:bg-dark-200/70 transition-colors duration-150 text-start`,children:[(0,Q.jsx)(T,{className:`h-4 w-4 shrink-0`}),p(`user.menu.settings`)]}),(0,Q.jsxs)(`button`,{onClick:()=>{u(),f()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors duration-150 text-start`,children:[(0,Q.jsx)(we,{className:`h-4 w-4 shrink-0`}),p(`user.menu.logout`)]})]})]})]})})}var ai={idle:{labelKey:`work.statusLabels.idle`,label:`Idle`,color:`rgb(255, 255, 255)`,animated:!1},preparing:{labelKey:`work.statusLabels.thinking`,label:`Thinking`,color:`rgb(48, 121, 255)`,animated:!0},running:{labelKey:`work.statusLabels.thinking`,label:`Thinking`,color:`rgb(48, 121, 255)`,animated:!0},completed:{labelKey:`work.statusLabels.complete`,label:`Complete`,color:`rgb(76, 212, 117)`,animated:!1},needs_input:{labelKey:`work.statusLabels.needsInput`,label:`Needs input`,color:`rgb(255, 204, 0)`,animated:!1},cancelled:{labelKey:`work.statusLabels.needsInput`,label:`Needs input`,color:`rgb(255, 204, 0)`,animated:!1},failed:{labelKey:`work.statusLabels.error`,label:`Error`,color:`rgb(255, 61, 129)`,animated:!1}};function oi({tasks:e,currentTaskId:t,loading:n,actionLoading:r,sidebarCompact:i,onSelectTask:a,onDeleteTask:o}){let{t:s,i18n:c}=x();return(0,Q.jsx)(`div`,{"data-testid":`sidebar-work-task-scroll-region`,className:`scroll-region min-h-0 flex-1 border-t border-black/[0.05] scrollbar-thin dark:border-white/[0.05]`,style:{willChange:`scroll-position`},children:(0,Q.jsxs)(`div`,{className:R(`px-3 py-3`,i&&`px-2`),children:[!i&&e.length>0&&(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between px-1`,children:[(0,Q.jsx)(`h3`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-gray-500 dark:text-dark-500 rtl:tracking-normal`,children:s(`work.tasks.title`,{defaultValue:`Work tasks`})}),(0,Q.jsx)(`span`,{className:`text-[10px] font-medium tabular-nums text-gray-400 dark:text-dark-500`,children:e.length})]}),n&&e.length===0?(0,Q.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex items-center justify-center py-10 text-gray-400 dark:text-dark-500`,children:[(0,Q.jsx)(Pe,{"aria-hidden":`true`,className:`h-5 w-5 animate-spin`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:s(`work.tasks.loading`,{defaultValue:`Loading Work tasks`})})]}):e.length===0?(0,Q.jsxs)(`div`,{className:R(`py-8 text-center`,i?`px-1`:`px-2`),children:[(0,Q.jsx)(`div`,{className:R(`mx-auto mb-3 flex items-center justify-center rounded-xl bg-white/70 ring-1 ring-black/[0.04] dark:bg-dark-200 dark:ring-white/[0.05]`,i?`h-8 w-8`:`h-12 w-12`),children:(0,Q.jsx)(Ie,{className:R(`text-gray-400 dark:text-gray-500`,i?`h-4 w-4`:`h-5 w-5`)})}),!i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-gray-600 dark:text-dark-600`,children:s(`work.tasks.emptyTitle`,{defaultValue:`No Work tasks yet`})}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-gray-400 dark:text-dark-500`,children:s(`work.tasks.empty`,{defaultValue:`Your Work tasks will appear here after you send the first message.`})})]})]}):(0,Q.jsx)(`div`,{"data-testid":`sidebar-work-task-list`,className:R(`space-y-0.5`,i&&`space-y-1`),children:e.map(e=>{let n=t===e.id,l=ai[e.status],u=s(l.labelKey,{defaultValue:l.label});return(0,Q.jsxs)(`div`,{"data-testid":`sidebar-work-task-item`,"data-task-id":e.id,className:R(`group relative transition-colors duration-150 outline-none`,i?`flex items-center justify-center rounded-xl p-1`:`rounded-xl px-3 py-2.5`,n?`bg-white ring-1 ring-black/[0.04] dark:bg-dark-200 dark:ring-white/[0.05]`:`hover:bg-white/60 dark:hover:bg-dark-200/60`),children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-current":n?`page`:void 0,className:R(`w-full text-start outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,i?`flex h-10 items-center justify-center`:`pe-8`),title:i?`${e.title} · ${e.model}`:void 0,onClick:()=>a(e.id),children:[i?(0,Q.jsxs)(`span`,{className:R(`relative flex h-9 w-9 items-center justify-center rounded-xl text-[11px] font-semibold uppercase transition-colors`,n?`bg-gray-950 text-white dark:bg-white dark:text-gray-950`:`bg-white/70 text-gray-500 ring-1 ring-black/[0.04] dark:bg-dark-200/70 dark:text-dark-600 dark:ring-white/[0.05]`),children:[e.title.trim().charAt(0)||`•`,(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`sidebar-work-task-status`,"data-status-label":u,className:R(`absolute -bottom-0.5 -end-0.5 h-2.5 w-2.5 rounded-full border-2 border-gray-100 dark:border-dark-50`,l.animated&&`animate-pulse`,e.status===`idle`&&`ring-1 ring-black/20 dark:ring-white/20`),style:{backgroundColor:l.color}})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`sidebar-work-task-status`,"data-status-label":u,className:R(`h-2 w-2 shrink-0 rounded-full`,l.animated&&`animate-pulse`,e.status===`idle`&&`ring-1 ring-black/20 dark:ring-white/20`),style:{backgroundColor:l.color}}),(0,Q.jsx)(`span`,{dir:`auto`,className:`min-w-0 flex-1 truncate text-[13px] font-medium leading-tight text-gray-900 dark:text-dark-900`,children:Qe(e.title||s(`work.tasks.untitled`,{defaultValue:`Untitled task`}),32)})]}),(0,Q.jsxs)(`span`,{className:`mt-1 flex items-center gap-1.5 ps-4 text-[11px] text-gray-400 dark:text-dark-500`,children:[(0,Q.jsx)(`span`,{className:`tabular-nums`,children:Ze(e.updatedAt,c.language)}),(0,Q.jsx)(`span`,{className:`text-gray-300 dark:text-dark-400`,children:`•`}),(0,Q.jsx)(`span`,{dir:`ltr`,className:`min-w-0 truncate font-medium text-gray-600 dark:text-gray-400`,title:e.model,children:e.model})]})]}),(0,Q.jsx)(`span`,{className:`sr-only`,children:s(`work.tasks.status`,{defaultValue:`Status: {{status}}`,status:u})})]}),!i&&(0,Q.jsx)(`button`,{type:`button`,"data-testid":`sidebar-work-task-delete`,disabled:r,className:R(`absolute end-2 top-1/2 -translate-y-1/2 rounded-lg p-1.5 text-gray-400 transition-[color,background-color,opacity] hover:bg-error-500/10 hover:text-error-600 focus:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-error-500/30 disabled:cursor-not-allowed disabled:opacity-40 group-focus-within:opacity-100 group-hover:opacity-100 dark:text-dark-500`,n?`opacity-100`:`opacity-0`),"aria-label":s(`work.tasks.deleteNamed`,{defaultValue:`Delete {{title}}`,title:e.title||s(`work.tasks.untitled`,{defaultValue:`Untitled task`})}),onClick:t=>{t.stopPropagation(),o(e)},children:(0,Q.jsx)(De,{"aria-hidden":`true`,className:`h-3.5 w-3.5`})})]},e.id)})})]})})}function si(e){let{t}=x(),n=(0,Z.useRef)(null),r=Ir({queryKey:[`users`,`pending-approvals`],enabled:e,queryFn:async()=>{let e=await Ke.getPendingApprovals();if(!e.success||!e.data)throw Error(e.message||`Could not load pending accounts`);return e.data},refetchInterval:6e4,refetchOnWindowFocus:!0});return(0,Z.useEffect)(()=>{if(!r.data)return;let e=n.current,i=e?!!(r.data.count>e.count||r.data.latestCreatedAt&&r.data.latestCreatedAt!==e.latestCreatedAt):r.data.count>0;n.current=r.data,i&&I(t(`userManager.approval.notification`,{count:r.data.count,defaultValue:`{{count}} registration(s) are waiting for your approval.`}),{icon:`👤`})},[r.data,t]),{...r,pendingApprovalCount:r.data?.count??0}}var ci=L(`components:sidebar`),li=Z.lazy(()=>f(()=>import(`../js/SettingsModal-y1Nzg55O.js`).then(e=>({default:e.SettingsModal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]))),ui=({isOpen:e,onClose:t,className:n})=>{let{t:r}=x(),i=y(),a=l(),{sessions:o,deleteSession:s,updateSessionTitle:c,setSessionArchived:u,folders:d,loadFolders:f,createFolder:p,renameFolder:m,deleteFolder:h,moveSessionToFolder:g,selectedModel:_,models:v,currentSession:b,generatingTitleForSession:S,personas:C}=tt(),w=it(e=>e.tasks),T=it(e=>e.loadingTasks),E=it(e=>e.actionLoading),D=it(e=>e.deleteTask),{user:O,isAdmin:ee,systemInfo:te,setUser:ne}=z(),{backgroundImage:k,sidebarCompact:A,toggleSidebarCompact:j}=ot(),M=ee(),{pendingApprovalCount:re}=si(!!(O&&M&&te?.requiresAuth)),[N,ie]=(0,Z.useState)(null),[P,ae]=(0,Z.useState)(``),[oe,F]=(0,Z.useState)(!1),[se,ce]=(0,Z.useState)(!1),[le,ue]=(0,Z.useState)(!1),[de,fe]=(0,Z.useState)(``),[pe,me]=(0,Z.useState)(!1),he=(0,Z.useRef)(null),ge=(0,Z.useRef)(null),_e=i.pathname.match(/^\/c\/([^/]+)$/)?.[1]||null,ve=b?.id||_e,ye=()=>{window.innerWidth<768&&!A&&j()},be=()=>{let{setCurrentSession:e}=tt.getState();st(),e(null),sessionStorage.setItem(`forceWelcomeScreen`,`true`)};(0,Z.useEffect)(()=>{let e=e=>{he.current&&!he.current.contains(e.target)&&ce(!1)};if(se)return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[se]),(0,Z.useEffect)(()=>{let t=t=>{ge.current&&!ge.current.contains(t.target)&&window.innerWidth<768&&e&&!A&&j()};if(e&&!A&&window.innerWidth<768)return document.addEventListener(`mousedown`,t),()=>document.removeEventListener(`mousedown`,t)},[e,A,j]);let xe=async()=>{me(!0);try{let e=await Ke.updateMyAvatar(de||null);e.success&&e.data?(ne(e.data),I.success(r(`user.avatar.updated`)),ue(!1)):I.error(e.message||r(`user.avatar.updateFailed`))}catch(e){ci.error(`Failed to update avatar:`,e),I.error(r(`user.avatar.updateFailed`))}finally{me(!1)}},Se=()=>{be(),a(`/chat`,{replace:!0}),ye()},Ce=()=>{it.getState().clearError(),a(`/work`),ye()},we=e=>{a(`/c/${e.id}`,{replace:!0}),ye()},Te=e=>{a(`/work/${e}`,{replace:!0}),ye()},Ee=async e=>{if(window.confirm(r(`work.tasks.deleteConfirm`,{defaultValue:`Delete “{{title}}” and its workspace permanently?`,title:e.title||r(`work.tasks.untitled`,{defaultValue:`Untitled task`})})))try{await D(e.id),nt(e.id),Hr.getState().closeTab(`work:${e.id}`),Le===e.id&&a(`/work`,{replace:!0,state:{deletedWorkTaskId:e.id}})}catch(e){ci.error(`Failed to delete Work task:`,e),I.error(r(`work.toasts.deleteFailed`,{defaultValue:`Could not delete this Work task.`}))}},De=async(e,t)=>{if(t.stopPropagation(),ci.debug(`Delete session clicked:`,e),window.confirm(r(`chat.session.deleteConfirm`)))try{ci.debug(`Attempting to delete session:`,e);let t=ve===e;if(await s(e),ci.debug(`Session deleted successfully`),Hr.getState().closeTab(`chat:${e}`),t){let t=o.filter(t=>t.id!==e);t.length>0?a(`/c/${t[0].id}`,{replace:!0}):a(`/`,{replace:!0})}}catch(e){ci.error(`Error deleting session:`,e)}};(0,Z.useEffect)(()=>{f()},[f]);let Oe=async(e,t)=>{if(t.stopPropagation(),await u(e,!0),Hr.getState().closeTab(`chat:${e}`),ve===e){let t=o.filter(t=>t.id!==e&&!t.archived);t.length>0?a(`/c/${t[0].id}`,{replace:!0}):a(`/`,{replace:!0})}},ke=(e,t)=>{t.stopPropagation(),ie(e.id),ae(e.title)},Ae=async e=>{P.trim()&&await c(e,P.trim()),ie(null),ae(``)},je=()=>{ie(null),ae(``)},Me=async()=>{try{await qe.logout();let{logout:e}=z.getState();e(),a(`/login`),I.success(r(`auth.logout.success`))}catch(e){ci.error(`Logout error:`,e);let{logout:t}=z.getState();t(),a(`/login`)}},Ne=()=>{F(!0),ye()},Pe=e=>{fe(e),ue(!0)},Fe=window.location.protocol===`file:`,Ie=i.pathname===`/work`||i.pathname.startsWith(`/work/`),Le=i.pathname.match(/^\/work\/([^/]+)$/)?.[1]||null,Re=i.pathname===`/`||i.pathname===`/chat`||i.pathname.startsWith(`/c/`),ze=te?.requiresAuth===!1||ee();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{ref:ge,"data-testid":`sidebar`,className:R(`fixed inset-y-0 start-0 z-50 border-e border-black/[0.06] dark:border-white/[0.06] transform transition-[width,transform,background-color] duration-200 ease-out shadow-[0_24px_80px_rgba(15,23,42,0.12)]`,A?`w-18`:`w-72 max-sm:w-64`,e?`translate-x-0`:`ltr:-translate-x-full rtl:translate-x-full`,`lg:shadow-none`,k?`bg-gray-100/75 dark:bg-dark-50/75 backdrop-blur-xl`:`bg-gray-100 dark:bg-dark-50`,`overscroll-behavior-contain`,n),style:{WebkitOverflowScrolling:`touch`},children:[Fe&&(0,Q.jsx)(`div`,{className:`absolute top-0 start-16 end-0 h-8 z-[60]`,style:{WebkitAppRegion:`drag`}}),(0,Q.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,Q.jsx)(Xr,{sidebarCompact:A,isElectron:Fe,showWork:ze,activeMode:Ie?`work`:Re?`chat`:null,selectedModel:_,modelCount:v.length,onToggleCompact:j,onStartWork:Ce,onCreateSession:Se}),(0,Q.jsx)(Qr,{sidebarCompact:A,activePath:i.pathname,showAgents:ze,onMobileNavigate:ye}),Ie&&ze?(0,Q.jsx)(oi,{tasks:w,currentTaskId:Le,loading:T,actionLoading:E,sidebarCompact:A,onSelectTask:Te,onDeleteTask:e=>void Ee(e)}):(0,Q.jsx)(ni,{sessions:o.filter(e=>!e.archived),personas:C,currentSessionId:ve,generatingTitleForSession:S,sidebarCompact:A,editingSessionId:N,editingTitle:P,onEditingTitleChange:ae,onSelectSession:we,onStartEditing:ke,onSaveEdit:Ae,onCancelEdit:je,onDeleteSession:De,onArchiveSession:Oe,folders:d,onCreateFolder:e=>void p(e),onRenameFolder:(e,t)=>void m(e,t),onDeleteFolder:e=>void h(e),onMoveSession:(e,t)=>void g(e,t)}),(0,Q.jsx)(ii,{requiresAuth:te?.requiresAuth,user:O,isAdmin:M,pendingApprovalCount:re,sidebarCompact:A,userMenuOpen:se,userMenuRef:he,onToggleUserMenu:()=>ce(e=>!e),onOpenSettings:Ne,onOpenAvatar:Pe,onLogout:Me,onMobileNavigate:ye,onCloseUserMenu:()=>ce(!1)})]})]}),oe&&(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(li,{isOpen:oe,onClose:()=>F(!1)})}),(0,Q.jsx)(Kr,{open:le,value:de,saving:pe,onChange:fe,onClose:()=>ue(!1),onSave:xe})]})},$=({children:e,requireAuth:t=!0,requireAdmin:n=!1})=>{let{isAuthenticated:r,user:i,systemInfo:a,isLoading:o}=z();return y(),o?(0,Q.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-50 dark:bg-dark-50`,children:(0,Q.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-200 dark:border-dark-300 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})}):a&&!a.requiresAuth?(0,Q.jsx)(Q.Fragment,{children:e}):t&&!r?(0,Q.jsx)(s,{to:`/login`,replace:!0}):n&&(!i||i.role!==`admin`)?(0,Q.jsx)(s,{to:`/`,replace:!0}):(0,Q.jsx)(Q.Fragment,{children:e})},di=L(`components:error-boundary`),fi=({error:e})=>{let{t}=x();return(0,Q.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center p-4 text-gray-900 dark:text-dark-800`,children:(0,Q.jsx)(`div`,{className:`w-full max-w-md rounded-2xl border border-gray-200 dark:border-dark-300 bg-white/95 dark:bg-dark-100/95 shadow-card backdrop-blur-sm`,children:(0,Q.jsxs)(`div`,{className:`p-6 text-center`,children:[(0,Q.jsx)(`div`,{className:`mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-2xl bg-primary-100 text-primary-700 dark:bg-primary-900/35 dark:text-primary-300 ring-1 ring-primary-200 dark:ring-primary-800/60`,children:(0,Q.jsx)(ye,{className:`h-6 w-6`})}),(0,Q.jsx)(`h1`,{className:`mb-2 text-xl font-semibold text-gray-950 dark:text-dark-950`,children:t(`errorBoundary.title`)}),(0,Q.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-gray-600 dark:text-dark-600`,children:t(`errorBoundary.description`)}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:justify-center`,children:[(0,Q.jsxs)(`button`,{onClick:()=>window.location.reload(),className:`inline-flex items-center justify-center gap-2 rounded-xl bg-primary-600 px-4 py-2.5 text-sm font-medium text-white shadow-sm transition-all hover:bg-primary-700 hover:shadow-md focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 dark:focus:ring-offset-dark-100`,children:[(0,Q.jsx)(ie,{className:`h-4 w-4`}),t(`errorBoundary.tryAgain`)]}),(0,Q.jsxs)(`button`,{onClick:()=>{window.location.assign(`/`)},className:`inline-flex items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white px-4 py-2.5 text-sm font-medium text-gray-700 shadow-sm transition-all hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 dark:border-dark-300 dark:bg-dark-50 dark:text-dark-700 dark:hover:bg-dark-200 dark:focus:ring-offset-dark-100`,children:[(0,Q.jsx)(Se,{className:`h-4 w-4`}),t(`common.home`,`Home`)]})]}),!1]})})})},pi=class extends Z.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){di.error(`ErrorBoundary caught an error:`,e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,Q.jsx)(fi,{error:this.state.error}):this.props.children}},mi=(e,t=!0)=>{let n=(0,Z.useCallback)(n=>{if(!t)return;let r=n.target;if(r.tagName===`INPUT`||r.tagName===`TEXTAREA`||r.contentEditable===`true`||r.isContentEditable)return;if(n.key===`?`||n.key===`/`&&n.shiftKey){let t=e.find(e=>e.key===`?`||e.key===`h`);if(t){n.preventDefault(),n.stopPropagation(),t.action();return}}let i=e.find(e=>{let t=e.key.toLowerCase()===n.key.toLowerCase(),r=!!e.metaKey,i=n.metaKey||n.ctrlKey,a=!r||i,o=!e.ctrlKey||n.ctrlKey,s=!!e.shiftKey===n.shiftKey,c=!!e.altKey===n.altKey;return t&&a&&o&&s&&c});i&&(n.preventDefault(),n.stopPropagation(),i.action())},[e,t]);(0,Z.useEffect)(()=>{if(t)return document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`keydown`,n)}},[n,t])},hi=e=>{let t=[];e.metaKey&&t.push(navigator.platform.includes(`Mac`)?`⌘`:`Ctrl`),e.ctrlKey&&t.push(`Ctrl`),e.shiftKey&&t.push(`⇧`),e.altKey&&t.push(navigator.platform.includes(`Mac`)?`⌥`:`Alt`);let n=e.key.toUpperCase();return e.key===`,`&&(n=`,`),e.key===` `&&(n=`Space`),e.key===`Enter`&&(n=`↩`),e.key===`Escape`&&(n=`Esc`),t.push(n),t.join(`+`)},gi=({isOpen:e,onClose:t,shortcuts:n})=>{let{t:r}=x();if(!e)return null;let i={navigation:n.filter(e=>e.description.includes(`sidebar`)||e.description.includes(`Toggle`)),settings:n.filter(e=>e.description.includes(`settings`)||e.description.includes(`dark mode`)),general:n.filter(e=>!e.description.includes(`sidebar`)&&!e.description.includes(`settings`)&&!e.description.includes(`dark mode`)&&!e.description.includes(`Toggle`))};return(0,Q.jsx)(`div`,{className:`fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4`,children:(0,Q.jsxs)(`div`,{className:`flex max-h-[calc(100dvh-2rem)] min-h-0 w-full max-w-md flex-col overflow-hidden rounded-xl bg-white shadow-2xl dark:bg-dark-100 sm:max-h-[80dvh]`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between p-6 border-b border-gray-200 dark:border-dark-300`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Le,{className:`h-5 w-5 text-gray-700 dark:text-dark-600`}),(0,Q.jsx)(`h2`,{className:`text-lg font-semibold text-gray-900 dark:text-dark-800`,children:r(`keyboard.title`)})]}),(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,onClick:t,className:`h-8 w-8 p-0 hover:bg-gray-100 dark:hover:bg-dark-200`,children:(0,Q.jsx)(Oe,{className:`h-4 w-4`})})]}),(0,Q.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 space-y-6 p-6 scrollbar-thin`,children:[Object.entries(i).map(([e,t])=>t.length===0?null:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 dark:text-dark-600 mb-3`,children:r(`keyboard.groups.${e}`)}),(0,Q.jsx)(`div`,{className:`space-y-2`,children:t.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:e.description}),(0,Q.jsx)(`kbd`,{className:`px-2 py-1 text-xs font-mono bg-gray-100 dark:bg-dark-200 text-gray-700 dark:text-dark-600 rounded border border-gray-300 dark:border-dark-400`,children:hi(e)})]},t))})]},e)),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-gray-700 dark:text-dark-600 mb-3`,children:r(`keyboard.groups.chat`)}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:r(`keyboard.actions.sendMessage`)}),(0,Q.jsx)(`kbd`,{className:`px-2 py-1 text-xs font-mono bg-gray-100 dark:bg-dark-200 text-gray-700 dark:text-dark-600 rounded border border-gray-300 dark:border-dark-400`,children:`Enter`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between py-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm text-gray-600 dark:text-dark-500`,children:r(`keyboard.actions.newLine`)}),(0,Q.jsx)(`kbd`,{className:`px-2 py-1 text-xs font-mono bg-gray-100 dark:bg-dark-200 text-gray-700 dark:text-dark-600 rounded border border-gray-300 dark:border-dark-400`,children:`Shift+Enter`})]})]})]})]}),(0,Q.jsx)(`div`,{className:`px-6 py-4 bg-gray-50 dark:bg-dark-200 border-t border-gray-200 dark:border-dark-300`,children:(0,Q.jsxs)(`p`,{className:`text-xs text-gray-500 dark:text-dark-400 text-center`,children:[r(`keyboard.footer`,{key1:`?`,key2:`H`}).split(`?`)[0],(0,Q.jsx)(`kbd`,{className:`px-1 py-0.5 text-xs font-mono bg-gray-200 dark:bg-dark-300 rounded`,children:`?`}),r(`keyboard.footer`,{key1:`?`,key2:`H`}).split(`?`)[1].split(`H`)[0],(0,Q.jsx)(`kbd`,{className:`px-1 py-0.5 text-xs font-mono bg-gray-200 dark:bg-dark-300 rounded`,children:`H`}),r(`keyboard.footer`,{key1:`?`,key2:`H`}).split(`H`)[1]]})})]})})},_i=({onClick:e,className:t})=>{let{t:n}=x(),[r,i]=(0,Z.useState)(!1);return(0,Q.jsxs)(B,{variant:`ghost`,size:`sm`,onClick:e,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),className:R(`fixed bottom-4 end-4 h-10 w-10 p-0 bg-white/80 dark:bg-dark-100/80 backdrop-blur-sm border border-gray-200 dark:border-dark-300 shadow-lg hover:shadow-xl transition-all duration-200 z-50`,`hover:bg-white dark:hover:bg-dark-100`,t),title:n(`keyboard.tooltip`),children:[(0,Q.jsx)(Le,{className:`h-4 w-4`}),r&&(0,Q.jsx)(`div`,{className:`absolute bottom-full mb-2 end-0 px-2 py-1 text-xs bg-gray-900 text-white rounded whitespace-nowrap`,children:n(`keyboard.tooltip`)})]})},vi=({notes:e,onDismiss:t})=>{let{t:n}=x();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`fixed inset-0 z-[60] bg-black/55 backdrop-blur-sm transition-opacity duration-200`,onClick:t}),(0,Q.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4`,role:`dialog`,"aria-modal":`true`,"aria-label":n(`whatsNew.title`),onMouseDown:e=>{e.target===e.currentTarget&&t()},children:(0,Q.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,Q.jsxs)(`div`,{className:`flex items-start justify-between px-6 pb-3 pt-6`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-xl font-semibold tracking-[-0.02em] text-gray-950 dark:text-dark-950`,children:n(`whatsNew.title`)}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-gray-500 dark:text-dark-500`,children:[n(`whatsNew.releaseNotes`),` · v`,e.version,` · `,e.date]})]}),(0,Q.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:n(`common.close`),children:(0,Q.jsx)(Oe,{className:`h-4 w-4`})})]}),(0,Q.jsx)(`div`,{className:`scroll-region min-h-0 flex-1 overflow-y-auto px-6 py-3 scrollbar-thin`,children:(0,Q.jsx)(r,{components:{h3:({children:e})=>(0,Q.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,Q.jsx)(`ul`,{className:`space-y-2.5`,children:e}),li:({children:e})=>(0,Q.jsxs)(`li`,{className:`flex gap-2 text-[13.5px] leading-relaxed text-gray-700 dark:text-dark-700`,children:[(0,Q.jsx)(`span`,{className:`mt-[7px] h-1 w-1 shrink-0 rounded-full bg-gray-300 dark:bg-dark-400`}),(0,Q.jsx)(`span`,{className:`min-w-0`,children:e})]}),strong:({children:e})=>(0,Q.jsx)(`strong`,{className:`font-semibold text-gray-900 dark:text-dark-900`,children:e}),a:({children:e,href:t})=>(0,Q.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,Q.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,Q.jsx)(`p`,{className:`mb-2 text-[13.5px] leading-relaxed text-gray-700 dark:text-dark-700`,children:e})},children:e.body})}),(0,Q.jsx)(`div`,{className:`flex justify-end border-t border-gray-200/70 px-6 py-4 dark:border-white/[0.08]`,children:(0,Q.jsx)(B,{onClick:t,size:`sm`,children:n(`whatsNew.cta`)})})]})})]})},yi=`libre-webui:whats-new-seen`;function bi(){let e={version:`0.19.0`,date:`2026-08-03`,body:`Libre WebUI 0.19.0 expands the chat workspace with reusable knowledge
3
+ collections, standalone notes, folders, per-chat controls, webpage attachments,
4
+ voice dictation, follow-up suggestions, message editing, response ratings, and
5
+ richer artifact tools. Agents gain OpenCode and Pi support plus explicit model
6
+ selection, Codex can use the server's ChatGPT sign-in for chat and Work, and the
7
+ Usage page now measures Ollama and agent activity across a full-year heatmap.
8
+
9
+ This release also changes important security defaults. A fresh installation
10
+ still permits its first local administrator, but later public registration is
11
+ closed unless explicitly enabled. OAuth tokens no longer travel in callback
12
+ URLs, Compose services bind more narrowly by default, fetched webpages and
13
+ artifacts cross stricter trust boundaries, and all five CodeQL findings opened
14
+ against the release candidate are fixed in code with regression coverage.
15
+
16
+ ### ✨ New Features
17
+
18
+ - **Knowledge collections.** Create reusable document collections in Settings,
19
+ assign existing or newly uploaded documents to them, and attach an entire
20
+ collection to a conversation as one context source.
21
+ - **Standalone notes.** A dedicated Notes page supports creating, editing,
22
+ deleting, searching, and previewing encrypted-at-rest Markdown notes.
23
+ - **Chat folders.** Create, rename, collapse, and delete sidebar folders; move
24
+ conversations between them or return a conversation to the unfiled list.
25
+ - **Per-chat controls.** Override the system prompt, temperature, top-p, top-k,
26
+ min-p, maximum tokens, repeat penalty, seed, and context length for an
27
+ individual conversation, with reset controls and persisted session state.
28
+ - **Expanded attachment menu.** Reuse an existing document, upload a new file,
29
+ attach a knowledge collection, or fetch a public webpage into chat context.
30
+ - **Voice dictation.** Browsers with the Web Speech API can transcribe speech
31
+ directly into the message composer while preserving already typed text.
32
+ - **Follow-up suggestions.** After a completed assistant response, Libre WebUI
33
+ can generate short, clickable suggestions for the user's next message.
34
+ - **Editable conversations and ratings.** Edit and resend a previous user
35
+ message from that point in the conversation, and record a positive or
36
+ negative rating on assistant responses.
37
+ - **Richer code blocks.** Long code blocks start collapsed and can be expanded,
38
+ downloaded with a language-aware filename, or opened in the artifact preview
39
+ when the language supports it.
40
+ - **Artifact history.** Navigate earlier and later versions of an artifact from
41
+ the slide-out panel without leaving the conversation.
42
+ - **Reasoning duration.** Thinking blocks show elapsed reasoning time during
43
+ generation and retain the final duration with the saved response.
44
+ - **Conversation navigation.** The sidebar groups chats by date, adds archiving,
45
+ and shows conversation previews on hover; settings navigation is searchable.
46
+ - **What's New dialog.** A version-aware modal summarizes newly installed
47
+ features once after an upgrade and records the version locally when dismissed.
48
+ - **OpenCode and Pi agents.** The Agents group detects \`opencode\` and \`pi\`
49
+ alongside Claude Code and Codex. Pi runs statelessly with tools disabled and a
50
+ neutral system prompt so chats do not use the server user's Pi configuration.
51
+ - **Explicit agent model selection.** Claude Code offers its default, Sonnet,
52
+ Opus, and Haiku choices; Codex exposes its documented ChatGPT-sign-in models;
53
+ OpenCode discovers provider models and requires an explicit selection instead
54
+ of inheriting a possibly unreachable CLI default.
55
+ - **Codex through ChatGPT sign-in.** The bundled administrator-only Codex
56
+ provider reuses the server's \`codex login\` session for chat and sandboxed Work
57
+ tasks. The CLI's OAuth client refreshes tokens, credentials never enter task
58
+ containers, and administrators can disable the integration with
59
+ \`CODEX_OAUTH_MODELS_ENABLED=false\`.
60
+ - **Full-year usage activity.** The administrator Usage page adds a responsive
61
+ contribution-style calendar for the trailing year, per-day tooltips and call
62
+ totals, top-model coloring, an intensity scale, and a ranked model legend
63
+ designed to remain distinguishable in both themes.
64
+ - **Ollama and agent metering.** Local Ollama calls now contribute prompt and
65
+ completion token counts, while agent CLI turns contribute usage events, so
66
+ the activity calendar and model tables cover local, plugin, and agent chats.
67
+
68
+ ### 🔧 Improvements
69
+
70
+ - New interface strings for notes, folders, controls, attachments, dictation,
71
+ usage, and related states are included across all 25 shipped locales.
72
+ - Added database indexes for per-user notes and session folders and enforced
73
+ clear storage policies: at most 100 notes and 100 folders per user, 200
74
+ characters per note title, 200,000 characters per note, and 120 characters
75
+ per folder name.
76
+ - Upgraded both application workspaces to TypeScript 7 while keeping ESLint on
77
+ an isolated compatible TypeScript compiler; expanded toolchain regression
78
+ tests prevent the two compiler paths from drifting.
79
+ - Added focused regression suites for webpage fetching, HTML artifacts, OAuth,
80
+ registration, password handling, public deployment defaults, content limits,
81
+ agent chats, Codex OAuth, and usage analytics.
82
+ - Refined the project and Helm descriptions and keywords around Libre WebUI's
83
+ local-first chat, private knowledge, artifact, agent, and Work capabilities.
84
+
85
+ ### 🐛 Bug Fixes
86
+
87
+ - **Agent chat selection now retains provider identity.** Starting a chat with an
88
+ agent, or switching an existing chat to one, no longer fails after the model
89
+ selector drops the agent provider metadata.
90
+ - **Work model selection excludes agent CLI entries.** Agent pseudo-models stay
91
+ in chat's Agents group instead of appearing as unusable Work provider models.
92
+ - **Codex streaming handles every supported caller path.** Responses streams
93
+ without a content-type are recognized, non-streaming callers receive an
94
+ aggregated result, and accumulated output is retained when a terminal event
95
+ carries no final text.
96
+ - Refactored What's New initialization and document-list loading so the frontend
97
+ passes the current React effect and Fast Refresh lint rules without warnings.
98
+
99
+ ### 🔒 Security
100
+
101
+ - **Registration is closed by default after bootstrap.** A fresh database still
102
+ permits exactly one local administrator, while every later local or OAuth
103
+ registration requires \`ENABLE_SIGNUP=true\` and still enters the existing
104
+ approval flow.
105
+ - **Password policy is enforced server-side and in the UI.** New passwords must
106
+ contain at least 12 characters with uppercase, lowercase, and numeric
107
+ characters, and cannot exceed bcrypt's 72 UTF-8-byte input boundary.
108
+ - **OAuth callbacks no longer expose bearer tokens.** GitHub and Hugging Face
109
+ flows bind cryptographically random state to short-lived HttpOnly, SameSite
110
+ cookies. The resulting JWT crosses through a 60-second Secure, HttpOnly
111
+ exchange cookie that is cleared immediately instead of appearing in URLs,
112
+ browser history, referrers, or reverse-proxy logs.
113
+ - **Safer Compose defaults.** The WebUI binds to loopback by default; bundled
114
+ Ollama is no longer published to the host unless the new opt-in override is
115
+ used; signup defaults to disabled; and the private deployment separates the
116
+ root-equivalent Work Docker socket and Watchtower into explicit overrides.
117
+ - **SSRF-resistant webpage attachments.** Only HTTP(S) URLs without embedded
118
+ credentials are accepted. Every resolved IPv4/IPv6 address and every redirect
119
+ hop must remain public, DNS is pinned for the connection, redirects are
120
+ bounded, fetches time out after 15 seconds, and response bodies are limited to
121
+ 2 MB.
122
+ - **Parser-based HTML extraction.** Webpage text now uses an HTML parser instead
123
+ of filtering regular expressions, ignores script/style/template content, and
124
+ decodes entities once. This fixes CodeQL alerts #119, #120, and #121 without
125
+ introducing double-unescaping or malformed-markup bypasses.
126
+ - **Isolated artifact previews.** HTML previews open inside an opaque-origin
127
+ sandboxed iframe without same-origin or sandbox-escape privileges. SVG
128
+ artifacts also render in a script-free sandbox with a restrictive content
129
+ security policy instead of using direct HTML injection.
130
+ - **Protected server Codex credentials.** User-writable plugins cannot reserve
131
+ the bundled Codex provider ID or receive the server user's OAuth access token;
132
+ only the bundled definition matching its trust anchor can use that route.
133
+ - **CodeQL cookie fixes.** The OAuth transfer cookie is always Secure and
134
+ HttpOnly, resolving alerts #117 and #118 for clear-text transmission and
135
+ client-side exposure of a sensitive server cookie.
136
+ - Added a public security policy with private GitHub/email reporting,
137
+ coordinated-disclosure expectations, documented trust boundaries, supported
138
+ versions, and a good-faith research safe harbor.
139
+
140
+ ### 📦 Dependencies
141
+
142
+ - Refreshed 31 direct and transitive dependencies. Notable upgrades include
143
+ better-sqlite3 13, TypeScript 7, Xterm 6, Vite 8.2, KaTeX 0.18, Playwright
144
+ 1.62, Electron 41.10.3, electron-builder 26.15.7, React type definitions,
145
+ i18next, Framer Motion, Lucide, PostCSS, and TanStack Query.
146
+ - Raised the \`brace-expansion\` override from 5.0.8 to 5.0.9 to close the
147
+ remaining denial-of-service CVE bypass path; \`npm audit\` reports no known
148
+ vulnerabilities at release time.
149
+
150
+ ### 📚 Documentation
151
+
152
+ - Updated quick-start, authentication, Docker, external Ollama, local GPU,
153
+ environment-variable, development-branch, agent CLI, provider connection,
154
+ and private remote deployment guides for the new registration and network
155
+ defaults.
156
+ - Added Docker Hub publishing metadata with installation paths, image-tag
157
+ semantics, architecture support, security notes, and canonical project links.
158
+ - Replaced certification-style compliance claims with precise regulated-
159
+ deployment guidance: Libre WebUI can support local, private, or air-gapped
160
+ controls, but the complete deployment and organizational process determine
161
+ compliance.
162
+ - Clarified the project charter's no-relicensing examples, added the canonical
163
+ security-policy link, removed the obsolete Hetzner GPU tutorial, and fixed the
164
+ private Compose documentation link so it works outside the repository.`},[t,n]=(0,Z.useState)(()=>{if(!e||typeof window>`u`)return!1;try{return window.localStorage.getItem(yi)!==e.version}catch{return!1}});return{open:t,dismiss:()=>{if(n(!1),e)try{window.localStorage.setItem(yi,e.version)}catch{}},notes:e}}var xi=({message:e=`This is a demo version for presentation purposes only. The Ollama backend is not connected.`,onDismiss:t,className:n})=>{let[r,i]=(0,Z.useState)(!1),{t:a}=x();return r?null:(0,Q.jsx)(`div`,{className:R(`bg-gray-950 text-white dark:bg-white dark:text-gray-950`,`border-b border-black/10 dark:border-white/10`,`px-4 py-2`,n),children:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between max-w-6xl mx-auto gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,Q.jsx)(`div`,{className:`flex-shrink-0`,children:(0,Q.jsx)(be,{className:`h-4 w-4 text-white/65 dark:text-gray-950/60`})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Q.jsx)(`p`,{className:`shrink-0 text-xs font-semibold tracking-wide`,children:a(`demoMode.title`)}),(0,Q.jsx)(`p`,{className:`hidden truncate text-xs text-white/60 dark:text-gray-950/60 sm:block`,children:e})]})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 ml-4`,children:[(0,Q.jsxs)(B,{variant:`ghost`,size:`sm`,className:`h-8 px-2 text-white/70 hover:bg-white/10 hover:text-white dark:text-gray-950/70 dark:hover:bg-black/[0.06] dark:hover:text-gray-950`,onClick:()=>window.open(`https://github.com/libre-webui/libre-webui`,`_blank`),title:`View on GitHub`,children:[(0,Q.jsx)(O,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`ml-1 hidden sm:inline`,children:a(`demoMode.github`)})]}),(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>{i(!0),t?.()},className:`h-8 w-8 p-0 text-white/70 hover:bg-white/10 hover:text-white dark:text-gray-950/70 dark:hover:bg-black/[0.06] dark:hover:text-gray-950`,title:`Dismiss`,children:(0,Q.jsx)(Oe,{className:`h-4 w-4`})})]})]})})},Si=()=>{let{preferences:e,backgroundImage:t}=ot(),n=e.backgroundSettings||{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6},r=t||n.imageUrl;return!n.enabled||!r?null:(0,Q.jsx)(`div`,{"data-testid":`app-background`,className:`fixed inset-0 pointer-events-none z-0`,style:{backgroundImage:`url(${r})`,backgroundSize:`cover`,backgroundPosition:`center`,backgroundRepeat:`no-repeat`,filter:`blur(${n.blurAmount}px)`,opacity:n.opacity,transform:`scale(1.1)`}})},Ci=e=>{st(),tt.getState().setCurrentSession(null),sessionStorage.setItem(`forceWelcomeScreen`,`true`),e(`/chat`)},wi=e=>{st(),tt.getState().setCurrentSession(null),sessionStorage.removeItem(`pendingMessage`),sessionStorage.setItem(`forceWelcomeScreen`,`true`),e(`/chat?incognito=1`)},Ti=e=>{it.getState().clearError(),e(`/work`)},Ei={"/models":{icon:ce,labelKey:`sidebar.navigation.models`},"/personas":{icon:he,labelKey:`sidebar.navigation.personas`},"/gallery":{icon:oe,labelKey:`sidebar.navigation.imagine`},"/agents":{icon:xe,labelKey:`sidebar.navigation.agents`},"/users":{icon:Me,labelKey:`sidebar.navigation.userManagement`},"/usage":{icon:Ne,labelKey:`usageAnalytics.title`},"/system":{icon:j,labelKey:`systemPage.title`},"/artifacts":{icon:k,labelKey:`tabs.artifacts`}},Di=e=>e.kind===`home`?Se:e.kind===`chat`?Fe:e.kind===`work`?Ie:Ei[e.path]?.icon??k,Oi=()=>Xe()?`⌘`:`Ctrl`,ki=new Set([`/agents`,`/users`,`/usage`,`/system`]),Ai=e=>e.kind===`work`||ki.has(e.path),ji=()=>{let{t:e}=x(),t=y(),n=l(),r=Hr(e=>e.tabs),i=Hr(e=>e.activeTabId),a=Hr(e=>e.syncWithPath),o=Hr(e=>e.closeTab),s=Hr(e=>e.closeTabs),c=tt(e=>e.sessions),u=tt(e=>e.currentSession),d=it(e=>e.tasks),{systemInfo:f,isAdmin:p}=z(),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(null),v=(0,Z.useRef)(null),b=(0,Z.useRef)(null),S=(0,Z.useRef)(null),C=p(),w=f?.requiresAuth===!1||C,T=w,E=w?r:r.filter(e=>!Ai(e));(0,Z.useEffect)(()=>{a(t.pathname)},[t.pathname,a]),(0,Z.useEffect)(()=>{(S.current?.querySelector(`[data-active="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},[E.length,i]),(0,Z.useEffect)(()=>{if(!f||w)return;let e=r.filter(Ai).map(e=>e.id);if(e.length===0)return;let t=s(e,`home`);t&&n(t.path,{replace:!0})},[s,n,w,f,r]),(0,Z.useEffect)(()=>{if(!m&&!g)return;let e=e=>{let t=e.target;!v.current?.contains(t)&&!b.current?.contains(t)&&(h(!1),_(null))},t=e=>{e.key===`Escape`&&(h(!1),_(null))};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[g,m]),(0,Z.useEffect)(()=>{g&&b.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()},[g]);let O=t=>{if(t.kind===`home`)return e(`tabs.home`,`Home`);if(t.kind===`chat`){if(t.id===`chat:new`)return u?.isPrivate?e(`chat.session.incognito`,`Incognito Chat`):e(`tabs.newChat`,`New Chat`);let n=t.id.slice(5);return c.find(e=>e.id===n)?.title||e(`tabs.chat`,`Chat`)}if(t.kind===`work`){if(t.id===`work:new`)return e(`tabs.work`,`Work`);let n=t.id.slice(5);return d.find(e=>e.id===n)?.title||e(`tabs.work`,`Work`)}let n=Ei[t.path];return n?e(n.labelKey,t.path.slice(1)):t.path.slice(1)},ee=(e,t)=>{e.stopPropagation(),e.preventDefault();let r=o(t.id);r&&n(r.path)},te=(e,t,n)=>{h(!1),_({tabId:e.id,x:Math.max(8,Math.min(t,window.innerWidth-224-8)),y:Math.max(8,Math.min(n,window.innerHeight-176-8))})},ne=(e,t)=>{e.preventDefault(),e.stopPropagation(),te(t,e.clientX,e.clientY)},k=(e,t)=>{if(e.key!==`ContextMenu`&&!(e.shiftKey&&e.key===`F10`))return;e.preventDefault();let n=e.currentTarget.getBoundingClientRect();te(t,n.left+12,n.bottom+4)},j=e=>{let t=Array.from(b.current?.querySelectorAll(`[role="menuitem"]:not(:disabled)`)??[]);if(t.length===0)return;let n=t.indexOf(document.activeElement),r=n;if(e.key===`ArrowDown`)r=(n+1+t.length)%t.length;else if(e.key===`ArrowUp`)r=(n-1+t.length)%t.length;else if(e.key===`Home`)r=0;else if(e.key===`End`)r=t.length-1;else return;e.preventDefault(),t[r]?.focus()},M=(e,t)=>{let r=s(e,t);_(null),r&&n(r.path)},re=[{key:`chat`,label:e(`tabs.newChat`,`New Chat`),icon:Fe,shortcut:`${Oi()}⇧O`,action:()=>Ci(n)},{key:`incognito-chat`,label:e(`chat.session.incognito`,`Incognito Chat`),icon:ze,action:()=>wi(n)},...T?[{key:`work`,label:e(`tabs.newWork`,`New Work`),icon:Ie,shortcut:`${Oi()}⇧U`,action:()=>Ti(n)}]:[],...[`/models`,`/personas`,`/gallery`].map(t=>({key:t,label:e(Ei[t].labelKey,t.slice(1)),icon:Ei[t].icon,action:()=>n(t)})),...w?[{key:`/agents`,label:e(Ei[`/agents`].labelKey,`Agents`),icon:Ei[`/agents`].icon,separatorBefore:!0,action:()=>n(`/agents`)}]:[],...C?[`/users`,`/system`,`/usage`].map(t=>({key:t,label:e(Ei[t].labelKey,t.slice(1)),icon:Ei[t].icon,action:()=>n(t)})):[]],N=g?E.find(e=>e.id===g.tabId):void 0,ie=N?E.findIndex(e=>e.id===N.id):-1,P=N?E.filter(e=>e.id!==`home`&&e.id!==N.id).map(e=>e.id):[],oe=ie>=0?E.slice(ie+1).filter(e=>e.id!==`home`).map(e=>e.id):[],F=E.filter(e=>e.id!==`home`).map(e=>e.id);return(0,Q.jsxs)(`div`,{"data-testid":`app-tab-bar`,className:`relative z-20 flex h-9 flex-none items-center gap-1 px-1 pb-1 lg:px-0`,children:[(0,Q.jsx)(`div`,{ref:S,role:`tablist`,"aria-label":e(`tabs.label`,`Open tabs`),className:`flex min-w-0 items-center gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:E.map(t=>{let r=t.id===`chat:new`&&u?.isPrivate?ze:Di(t),a=t.id===i;return(0,Q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":a,"data-active":a||void 0,"data-tab-id":t.id,"data-testid":`app-tab`,title:O(t),onClick:()=>n(t.path),onContextMenu:e=>ne(e,t),onKeyDown:e=>k(e,t),onAuxClick:e=>{e.button===1&&t.id!==`home`&&ee(e,t)},className:R(`group flex h-7 min-w-0 flex-none items-center gap-1.5 rounded-lg border text-[13px] transition-colors duration-150 outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40`,t.id===`home`?`px-2.5`:`ps-2.5 pe-1`,a?`border-black/[0.06] bg-gray-50 text-gray-950 shadow-subtle dark:border-white/[0.07] dark:bg-dark-100 dark:text-dark-950`:`border-transparent text-gray-500 hover:bg-white/60 hover:text-gray-900 dark:text-dark-600 dark:hover:bg-dark-200/60 dark:hover:text-dark-900`),children:[(0,Q.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`max-w-[9rem] truncate`,children:O(t)}),t.id!==`home`&&(0,Q.jsx)(`span`,{role:`button`,tabIndex:-1,"aria-label":e(`tabs.close`,`Close tab`),"data-testid":`app-tab-close`,onClick:e=>ee(e,t),className:R(`flex h-5 w-5 shrink-0 items-center justify-center rounded-md text-gray-400 transition-opacity hover:bg-black/[0.06] hover:text-gray-700 dark:text-dark-500 dark:hover:bg-white/[0.08] dark:hover:text-dark-800`,a?`opacity-100`:`sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-visible:opacity-100`),children:(0,Q.jsx)(Oe,{className:`h-3 w-3`})})]},t.id)})}),g&&N&&(0,Q.jsxs)(`div`,{ref:b,role:`menu`,"aria-label":e(`tabs.actions`,`Tab actions`),"data-testid":`app-tab-context-menu`,onContextMenu:e=>e.preventDefault(),onKeyDown:j,className:`fixed z-[100] w-56 rounded-xl border border-line bg-surface-overlay/95 p-1 shadow-overlay backdrop-blur-xl animate-fade-in motion-reduce:animate-none`,style:{left:g.x,top:g.y},children:[(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`app-tab-context-close`,disabled:N.id===`home`,onClick:()=>{let e=o(N.id);_(null),e&&n(e.path)},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] text-ink-muted transition-colors hover:bg-black/[0.05] hover:text-ink disabled:cursor-not-allowed disabled:opacity-40 dark:hover:bg-white/[0.06]`,children:[(0,Q.jsx)(Oe,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{children:e(`tabs.close`,`Close tab`)})]}),(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`app-tab-context-close-others`,disabled:P.length===0,onClick:()=>M(P,N.id),className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] text-ink-muted transition-colors hover:bg-black/[0.05] hover:text-ink disabled:cursor-not-allowed disabled:opacity-40 dark:hover:bg-white/[0.06]`,children:[(0,Q.jsx)(ae,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{children:e(`tabs.closeOthers`,`Close other tabs`)})]}),(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`app-tab-context-close-right`,disabled:oe.length===0,onClick:()=>M(oe,N.id),className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] text-ink-muted transition-colors hover:bg-black/[0.05] hover:text-ink disabled:cursor-not-allowed disabled:opacity-40 dark:hover:bg-white/[0.06]`,children:[(0,Q.jsx)(A,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{children:e(`tabs.closeRight`,`Close tabs to the right`)})]}),(0,Q.jsx)(`div`,{className:`mx-2 my-1 h-px bg-line`,role:`separator`}),(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`app-tab-context-close-all`,disabled:F.length===0,onClick:()=>M(F,`home`),className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] text-ink-muted transition-colors hover:bg-black/[0.05] hover:text-ink disabled:cursor-not-allowed disabled:opacity-40 dark:hover:bg-white/[0.06]`,children:[(0,Q.jsx)(_e,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{children:e(`tabs.closeAll`,`Close all tabs`)})]})]}),(0,Q.jsxs)(`div`,{className:`relative flex-none`,ref:v,children:[(0,Q.jsx)(`button`,{type:`button`,"aria-label":e(`tabs.new`,`New tab`),"aria-expanded":m,"data-testid":`app-tab-new`,onClick:()=>h(e=>!e),className:`flex h-7 w-7 items-center justify-center rounded-lg text-gray-500 transition-colors hover:bg-white/60 hover:text-gray-900 dark:text-dark-600 dark:hover:bg-dark-200/60 dark:hover:text-dark-900 outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40`,children:(0,Q.jsx)(D,{className:`h-4 w-4`})}),m&&(0,Q.jsx)(`div`,{role:`menu`,"data-testid":`app-tab-new-menu`,className:`absolute start-0 top-full z-50 mt-1 w-56 rounded-xl border border-line bg-surface-overlay/95 p-1 shadow-overlay backdrop-blur-xl animate-fade-in motion-reduce:animate-none`,children:re.map(e=>(0,Q.jsxs)(Z.Fragment,{children:[e.separatorBefore&&(0,Q.jsx)(`div`,{className:`mx-2 my-1 h-px bg-line`,role:`separator`}),(0,Q.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{h(!1),e.action()},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] text-ink-muted transition-colors hover:bg-black/[0.05] hover:text-ink dark:hover:bg-white/[0.06]`,children:[(0,Q.jsx)(e.icon,{className:`h-4 w-4 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-start`,children:e.label}),e.shortcut&&(0,Q.jsx)(`span`,{className:`font-mono text-[10px] tracking-wide text-ink-subtle`,children:e.shortcut})]})]},e.key))})]})]})},Mi=({onOpenSettings:e})=>{let{t,i18n:n}=x(),r=l(),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(``),[c,u]=(0,Z.useState)(0),d=(0,Z.useRef)(null),f=(0,Z.useRef)(null),p=tt(e=>e.sessions),m=it(e=>e.tasks),h=ot(e=>e.toggleTheme),{systemInfo:g,isAdmin:_}=z(),v=g?.requiresAuth===!1||_(),y=v,b=Xe()?`⌘`:`Ctrl`;(0,Z.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),s(``),u(0),a(e=>!e))},t=()=>{s(``),u(0),a(!0)};return document.addEventListener(`keydown`,e,!0),window.addEventListener(`libre:open-palette`,t),()=>{document.removeEventListener(`keydown`,e,!0),window.removeEventListener(`libre:open-palette`,t)}},[]),(0,Z.useEffect)(()=>{if(!i)return;let e=window.requestAnimationFrame(()=>d.current?.focus());return()=>window.cancelAnimationFrame(e)},[i]);let S=(0,Z.useCallback)(()=>a(!1),[]),C=(0,Z.useMemo)(()=>{let i=t(`palette.actions`,`Actions`),a=[{id:`action:new-chat`,section:i,label:t(`tabs.newChat`,`New Chat`),icon:Fe,hint:`${b}⇧O`,run:()=>Ci(r)},{id:`action:incognito-chat`,section:i,label:t(`chat.session.incognito`,`Incognito Chat`),icon:ze,run:()=>wi(r)},...v?[{id:`action:new-work`,section:i,label:t(`tabs.newWork`,`New Work`),icon:Ie,hint:`${b}⇧U`,run:()=>Ti(r)}]:[],{id:`action:home`,section:i,label:t(`tabs.home`,`Home`),icon:Se,run:()=>r(`/`)},{id:`action:models`,section:i,label:t(`sidebar.navigation.models`,`Models`),icon:ce,run:()=>r(`/models`)},{id:`action:personas`,section:i,label:t(`sidebar.navigation.personas`,`Personas`),icon:he,run:()=>r(`/personas`)},{id:`action:gallery`,section:i,label:t(`sidebar.navigation.imagine`,`Imagine`),icon:oe,run:()=>r(`/gallery`)},...y?[{id:`action:agents`,section:i,label:t(`sidebar.navigation.agents`,`Agents`),icon:xe,run:()=>r(`/agents`)}]:[],{id:`action:settings`,section:i,label:t(`palette.settings`,`Settings`),icon:T,hint:`${b},`,run:e},{id:`action:theme`,section:i,label:t(`palette.toggleTheme`,`Toggle theme`),icon:ue,hint:`${b}D`,run:h}],o=[...p].sort((e,t)=>t.updatedAt-e.updatedAt).map(e=>({id:`session:${e.id}`,section:t(`palette.chats`,`Chats`),label:e.title||t(`tabs.chat`,`Chat`),icon:Fe,hint:Ze(e.updatedAt,n.language),keywords:e.model,run:()=>r(`/c/${e.id}`)})),s=v?[...m].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).map(e=>({id:`work:${e.id}`,section:t(`palette.work`,`Work`),label:e.title||t(`work.tasks.untitled`,`Untitled task`),icon:Ie,hint:e.status,run:()=>r(`/work/${e.id}`)})):[];return[...a,...o,...s]},[t,b,r,e,h,p,m,v,y,n.language]),w=(0,Z.useMemo)(()=>{let e=o.trim().toLowerCase();if(!e){let e=C.filter(e=>e.id.startsWith(`action:`)),t=C.filter(e=>e.id.startsWith(`session:`)).slice(0,4),n=C.filter(e=>e.id.startsWith(`work:`)).slice(0,3);return[...e,...t,...n]}return C.filter(t=>`${t.label} ${t.keywords??``}`.toLowerCase().includes(e)).slice(0,20)},[C,o]);(0,Z.useEffect)(()=>{(f.current?.querySelector(`[data-selected="true"]`))?.scrollIntoView({block:`nearest`})},[c,w.length]);let E=e=>{e&&(S(),e.run())};if(!i)return null;let D=``;return(0,Ur.createPortal)((0,Q.jsx)(`div`,{"data-testid":`command-palette`,className:`fixed inset-0 z-[120] flex items-start justify-center bg-black/25 px-4 pt-[14vh] backdrop-blur-[2px] dark:bg-black/45`,onMouseDown:e=>{e.target===e.currentTarget&&S()},children:(0,Q.jsxs)(`div`,{className:`w-full max-w-lg overflow-hidden rounded-2xl border border-line bg-surface-overlay/95 shadow-overlay backdrop-blur-xl animate-scale-in motion-reduce:animate-none`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2.5 border-b border-line px-3.5`,children:[(0,Q.jsx)(N,{className:`h-4 w-4 shrink-0 text-ink-subtle`}),(0,Q.jsx)(`input`,{ref:d,"data-testid":`command-palette-input`,value:o,onChange:e=>{s(e.target.value),u(0)},onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),S()):e.key===`ArrowDown`?(e.preventDefault(),u(e=>Math.min(w.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),u(e=>Math.max(0,e-1))):e.key===`Enter`&&(e.preventDefault(),E(w[c]))},placeholder:t(`palette.placeholder`,`Search chats, Work, actions…`),className:`h-11 w-full bg-transparent text-sm text-ink outline-none placeholder:text-ink-subtle`}),(0,Q.jsx)(`kbd`,{className:`shrink-0 rounded-md border border-line px-1.5 py-0.5 font-mono text-[10px] text-ink-subtle`,children:`esc`})]}),(0,Q.jsxs)(`div`,{ref:f,className:`max-h-[19rem] overflow-y-auto p-1.5 scrollbar-thin`,children:[w.length===0&&(0,Q.jsx)(`p`,{className:`px-3 py-6 text-center text-sm text-ink-subtle`,children:t(`palette.empty`,`No matches.`)}),w.map((e,t)=>{let n=e.section!==D;return D=e.section,(0,Q.jsxs)(Z.Fragment,{children:[n&&(0,Q.jsx)(`p`,{className:`px-2.5 pb-1 pt-2 text-[10px] font-medium uppercase tracking-[0.08em] text-ink-subtle first:pt-1`,children:e.section}),(0,Q.jsxs)(`button`,{type:`button`,"data-selected":t===c||void 0,onMouseEnter:()=>u(t),onClick:()=>E(e),className:R(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-start text-sm transition-colors`,t===c?`bg-black/[0.05] text-ink dark:bg-white/[0.07]`:`text-ink-muted`),children:[(0,Q.jsx)(e.icon,{className:`h-4 w-4 shrink-0 text-ink-subtle`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.hint&&(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-ink-subtle`,children:e.hint})]})]},e.id)})]})]})}),document.body)},Ni=L(`user-service`),Pi=class{static async initializeAuth(){let{setLoading:e,setSystemInfo:t,login:n}=z.getState();try{e(!0),Ni.debug(`Starting auth initialization...`),Ni.debug(`Fetching system info...`);let r=await qe.getSystemInfo();Ni.debug(`System info response:`,r),r.success&&r.data?(Ni.debug(`Setting system info:`,r.data),t(r.data)):Ni.error(`System info response failed:`,r);let i=localStorage.getItem(`auth-token`);if(i)try{let e=(await f(async()=>{let{default:e}=await import(`../js/utils-vendor-1zob7nK9.js`).then(e=>e.i);return{default:e}},__vite__mapDeps([10,1,2]))).default,t=e.defaults.headers.common;e.defaults.headers.common.Authorization=`Bearer ${i}`;let r=await qe.verifyToken();if(r.success&&r.data){let e=z.getState().systemInfo;e&&n(r.data,i,e)}e.defaults.headers.common=t}catch(e){Ni.error(`Token verification failed:`,e),localStorage.removeItem(`auth-token`)}}catch(e){Ni.error(`Auth initialization error:`,e)}finally{e(!1)}}};He.interceptors.request.use(e=>{let t=localStorage.getItem(`auth-token`);return t&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e)),He.interceptors.response.use(e=>e,e=>{if(e.response?.status===401){localStorage.removeItem(`auth-token`);let{logout:e}=z.getState();e();let t=window.location.protocol===`file:`;window.location.href=t?`#/login`:`/login`}return Promise.reject(e)});var Fi=L(`initialize`),Ii=()=>{let e=(0,Z.useRef)(!1),t=(0,Z.useRef)(!1),{loadSessions:n,loadModels:r,loadPreferences:i,setSelectedModel:a,models:o}=tt(),{loadPreferences:s}=ot(),{loadPlugins:c,plugins:l}=rt();(0,Z.useEffect)(()=>{e.current||t.current||(async()=>{t.current=!0;try{Fi.debug(`Initializing Libre WebUI...`),await Pi.initializeAuth();let t=z.getState();if(t.requiresAuth()&&!t.isAuthenticated){Fi.debug(`Authentication required; deferring protected app initialization`),e.current=!0;return}try{!(await Je.checkHealth()).success&&!Ge()&&F.error(`Ollama service is not available. Plugin models may still be used.`)}catch(e){Fi.warn(`Ollama health check failed; continuing provider initialization:`,e),Ge()||F.error(`Ollama service is not available. Plugin models may still be used.`)}await Promise.all([s(),i()]),await Promise.all([r(),n(),c()]),e.current=!0,Fi.debug(`Libre WebUI initialized successfully`)}catch(t){Ge()?(await Promise.all([s(),i()]),await Promise.all([r(),n(),c()]),e.current=!0):(Fi.error(`Failed to initialize app:`,t),F.error(`Failed to connect to the backend service`))}finally{t.current=!1}})()},[s,i,r,n,c]),(0,Z.useEffect)(()=>{if(o.length>0){let e=o.filter(e=>!e.name.includes(`embed`))[0]||o[0],{selectedModel:t,selectedProviderType:n,selectedProviderId:r}=tt.getState();if(t){if(!et(o,{model:t,providerType:n,providerId:r})&&n!==`ollama`&&n!==`plugin`){let t=$e(e);Fi.debug(`Legacy selected model not available, falling back to:`,t.model),a(t.model,t.providerType,t.providerId)}}else{let t=$e(e);Fi.debug(`No model selected, using first available:`,t.model),a(t.model,t.providerType,t.providerId)}}},[o,a]),(0,Z.useEffect)(()=>{e.current&&(Fi.debug(`Plugin availability changed, reloading models...`),r())},[l,r])},Li=L(`components:git-hub-auth-button`),Ri=()=>{let{t:e}=x(),[t,n]=(0,Z.useState)(!1),[r,i]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{(async()=>{try{let e=await fetch(`${Ye}/auth/oauth/github/status`,{method:`GET`,credentials:`include`});if(e.ok){let t=await e.json();i(t.configured||!1),Li.debug(`GitHub OAuth configured:`,t.configured)}else Li.debug(`GitHub OAuth status check failed`),i(!1)}catch(e){Li.debug(`GitHub OAuth not configured:`,e),i(!1)}})()},[]),r?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{if(!r||t)return;n(!0);let e=`${Ye}/auth/oauth/github`;window.location.href=e},disabled:t,className:`flex h-11 w-full items-center justify-center rounded-xl border border-line bg-surface-raised px-4 text-sm font-medium text-ink shadow-subtle transition-colors hover:border-line-strong hover:bg-surface-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:t?(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(Pe,{size:16,className:`me-2 animate-spin`}),e(`auth.oauth.connectingTo`,{provider:e(`auth.oauth.github`)})]}):(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(te,{size:16,className:`me-2`}),e(`auth.oauth.continueWith`,{provider:e(`auth.oauth.github`)})]})}):null},zi=L(`components:hugging-face-auth-button`),Bi=()=>{let{t:e}=x(),[t,n]=(0,Z.useState)(!1),[r,i]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{(async()=>{try{let e=await fetch(`${Ye}/auth/oauth/huggingface/status`,{method:`GET`,credentials:`include`});if(e.ok){let t=await e.json();i(t.configured||!1),zi.debug(`Hugging Face OAuth configured:`,t.configured)}else zi.debug(`Hugging Face OAuth status check failed`),i(!1)}catch(e){zi.debug(`Hugging Face OAuth not configured:`,e),i(!1)}})()},[]),r?(0,Q.jsx)(`button`,{type:`button`,onClick:()=>{if(!r||t)return;n(!0);let e=`${Ye}/auth/oauth/huggingface`;window.location.href=e},disabled:t,className:`flex h-11 w-full items-center justify-center rounded-xl border border-line bg-surface-raised px-4 text-sm font-medium text-ink shadow-subtle transition-colors hover:border-line-strong hover:bg-surface-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:t?(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(Pe,{size:16,className:`me-2 animate-spin`}),e(`auth.oauth.connectingTo`,{provider:e(`auth.oauth.huggingFace`)})]}):(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(`span`,{className:`me-2 text-base`,children:`🤗`}),e(`auth.oauth.continueWith`,{provider:e(`auth.oauth.huggingFace`)})]})}):null},Vi=L(`hooks:oauth-providers`),Hi=async e=>{try{let t=await fetch(`${Ye}/auth/oauth/${e}/status`,{method:`GET`,credentials:`include`});return t.ok?!!(await t.json()).configured:!1}catch(t){return Vi.debug(`${e} OAuth not configured:`,t),!1}},Ui=()=>{let[e,t]=(0,Z.useState)({github:!1,huggingface:!1});return(0,Z.useEffect)(()=>{let e=!0;return Promise.all([Hi(`github`),Hi(`huggingface`)]).then(([n,r])=>{e&&t({github:n,huggingface:r})}),()=>{e=!1}},[]),{...e,hasAny:e.github||e.huggingface}},Wi=L(`components:turnstile-widget`),Gi=`https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit`,Ki=null,qi=()=>window.turnstile?Promise.resolve():Ki||(Ki=new Promise((e,t)=>{let n=document.querySelector(`script[src="${Gi}"]`);if(n){n.addEventListener(`load`,()=>e(),{once:!0}),n.addEventListener(`error`,t,{once:!0});return}let r=document.createElement(`script`);r.src=Gi,r.async=!0,r.defer=!0,r.onload=()=>e(),r.onerror=t,document.head.appendChild(r)}),Ki),Ji=({siteKey:e,action:t,disabled:n=!1,errorMessage:r,onTokenChange:i})=>{let a=(0,Z.useRef)(null),o=(0,Z.useRef)(null),[s,c]=(0,Z.useState)(!1);return(0,Z.useEffect)(()=>{let n=!1,r=a.current;return i(``),qi().then(()=>{n||!r||!window.turnstile||(r.innerHTML=``,o.current=window.turnstile.render(r,{sitekey:e,theme:`auto`,action:t,callback:e=>i(e),"expired-callback":()=>i(``),"error-callback":()=>i(``)}))}).catch(e=>{Wi.error(`Turnstile script failed to load:`,e),n||c(!0)}),()=>{n=!0,i(``),o.current&&window.turnstile?.remove?window.turnstile.remove(o.current):r&&(r.innerHTML=``),o.current=null}},[t,i,e]),(0,Z.useEffect)(()=>{n&&o.current&&(window.turnstile?.reset(o.current),i(``))},[n,i]),s?(0,Q.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,Q.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,Q.jsx)(`div`,{ref:a,className:`min-h-[65px]`})})},Yi=L(`components:login-form`),Xi={username:`demo`,password:`demo`},Zi=({onLogin:e,onShowSignup:t,initialApprovalPending:n=!1,bare:r=!1})=>{let{t:i}=x(),a=Ge(),o=Ui(),[s,c]=(0,Z.useState)(a?Xi.username:``),[u,d]=(0,Z.useState)(a?Xi.password:``),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(n),[v,y]=(0,Z.useState)(``),b=l(),{login:S,systemInfo:C}=z(),w=C?.turnstile?.siteKey,T=!!(C?.turnstile?.enabled&&w&&!a),E=(0,Z.useCallback)(e=>{y(e)},[]),D=(0,Z.useMemo)(()=>m||T&&!v,[m,T,v]),O=async t=>{t.preventDefault();let n=a?Xi.username:s.trim(),r=a?Xi.password:u;if(!n||!r){I.error(i(`auth.login.enterBoth`));return}if(T&&!v){I.error(i(`auth.login.verificationFailed`,`Security verification failed. Please refresh and try again.`));return}h(!0),_(!1);try{localStorage.removeItem(`auth-token`);let t=await qe.login({username:n,password:r,turnstileToken:v});t.success&&t.data?(S(t.data.user,t.data.token,t.data.systemInfo),I.success(i(`auth.login.loginSuccess`)),e?.(),b(`/`)):I.error(t.message||i(`auth.login.loginFailed`))}catch(e){Yi.error(`Login error:`,e);let t=e;t.response?.data?.code===`ACCOUNT_PENDING`?(_(!0),I.error(t.response.data.message||i(`auth.login.approvalPending`,`Your account is waiting for administrator approval.`))):I.error(i(`auth.login.checkCredentials`))}finally{y(``),h(!1)}},ee=e=>{if(e.key===`Enter`){let t=e.currentTarget.form;t&&t.requestSubmit()}};return(0,Q.jsxs)(`div`,{className:R(`mx-auto w-full max-w-md`,!r&&`rounded-3xl border border-line bg-surface-raised p-6 shadow-card sm:p-8`),children:[(0,Q.jsxs)(`div`,{className:R(`mb-8`,r?`text-start`:`text-center`),children:[(0,Q.jsx)(`h1`,{className:`mb-2 text-3xl font-light tracking-[-0.04em] text-ink`,children:i(`auth.login.title`)}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:i(`auth.login.subtitle`)})]}),(0,Q.jsxs)(`form`,{onSubmit:O,className:`space-y-5`,children:[g&&(0,Q.jsxs)(`div`,{"data-testid":`login-approval-pending`,role:`status`,className:`flex gap-3 rounded-xl border border-warning-500/30 bg-warning-500/10 p-3 text-start`,children:[(0,Q.jsx)(de,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 shrink-0 text-warning-700 dark:text-warning-400`}),(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-ink-muted`,children:i(`auth.login.approvalPending`,`Your account is waiting for administrator approval.`)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{htmlFor:`username`,className:`mb-2 block text-sm font-medium text-ink`,children:i(`auth.login.username`)}),(0,Q.jsx)(`input`,{id:`username`,type:`text`,value:s,onChange:e=>c(e.target.value),onKeyDown:ee,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-muted motion-reduce:transition-none`,placeholder:i(`auth.login.usernamePlaceholder`),required:!0,disabled:m||a})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{htmlFor:`password`,className:`mb-2 block text-sm font-medium text-ink`,children:i(`auth.login.password`)}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`input`,{id:`password`,type:f?`text`:`password`,value:u,onChange:e=>d(e.target.value),onKeyDown:ee,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 pe-11 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:bg-surface-subtle disabled:text-ink-muted motion-reduce:transition-none`,placeholder:i(`auth.login.passwordPlaceholder`),required:!0,disabled:m||a}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>p(!f),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-ink-muted transition-colors hover:text-ink disabled:cursor-not-allowed disabled:opacity-50`,disabled:m||a,"aria-label":f?`Hide characters`:`Reveal characters`,children:f?(0,Q.jsx)(Ve,{size:20}):(0,Q.jsx)(P,{size:20})})]})]}),T&&w&&(0,Q.jsx)(Ji,{siteKey:w,action:`login`,disabled:m,errorMessage:i(`auth.login.verificationFailed`,`Security verification failed. Please refresh and try again.`),onTokenChange:E}),(0,Q.jsx)(`button`,{type:`submit`,disabled:D,className:`flex h-11 w-full items-center justify-center rounded-xl border border-transparent bg-ink px-4 text-sm font-medium text-ink-inverse shadow-subtle transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:m?(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-current`}),i(`auth.login.signingIn`)]}):(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(pe,{size:16,className:`me-2`}),i(`auth.login.signIn`)]})})]}),!a&&(0,Q.jsxs)(Q.Fragment,{children:[o.hasAny&&(0,Q.jsxs)(`div`,{className:`mt-6`,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,Q.jsx)(`div`,{className:`w-full border-t border-line`})}),(0,Q.jsx)(`div`,{className:`relative flex justify-center text-sm`,children:(0,Q.jsx)(`span`,{className:R(`px-2 text-ink-muted`,r?`bg-canvas`:`bg-surface-raised`),children:i(`common.or`)})})]}),(0,Q.jsxs)(`div`,{className:`mt-6 space-y-3`,children:[o.github&&(0,Q.jsx)(Ri,{}),o.huggingface&&(0,Q.jsx)(Bi,{})]})]}),t&&(0,Q.jsx)(`div`,{className:`mt-6 text-center`,children:(0,Q.jsxs)(`p`,{className:`text-sm text-ink-muted`,children:[i(`auth.login.noAccount`),` `,(0,Q.jsx)(`button`,{onClick:t,className:`font-medium text-primary-600 transition-colors hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300`,children:i(`auth.login.signUpHere`)})]})})]})]})},Qi=`Use at least 12 characters, no more than 72 UTF-8 bytes, with uppercase, lowercase, and a number.`,$i=e=>e.length<12?`Password must be at least 12 characters.`:new TextEncoder().encode(e).length>72?`Password must be no more than 72 UTF-8 bytes.`:/[A-Z]/.test(e)?/[a-z]/.test(e)?/[0-9]/.test(e)?null:`Password must contain a number.`:`Password must contain a lowercase letter.`:`Password must contain an uppercase letter.`,ea=L(`components:signup-form`),ta=({onSignup:e,onBackToLogin:t,bare:n=!1})=>{let{t:r}=x(),[i,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(``),[c,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(``),w=l(),{login:T,systemInfo:E}=z(),D=E?.turnstile?.siteKey,O=!!(E?.turnstile?.enabled&&D),ee=(0,Z.useCallback)(e=>{C(e)},[]),te=(0,Z.useMemo)(()=>_||O&&!S,[_,O,S]),ne=async t=>{if(t.preventDefault(),!i.trim()||!c.trim()){I.error(r(`auth.signup.usernameRequired`));return}if(c!==d){I.error(r(`auth.signup.passwordMismatch`));return}let n=$i(c);if(n){I.error(n);return}if(O&&!S){I.error(r(`auth.signup.tryAgain`));return}v(!0);try{let t=await qe.signup({username:i,password:c,email:o,turnstileToken:S});if(t.success&&t.data){if(!(`token`in t.data)){b(!0),I.success(r(`auth.signup.approvalPending`,`Registration received. An administrator must approve your account.`));return}T(t.data.user,t.data.token,t.data.systemInfo),I.success(r(`auth.signup.signupSuccess`)),e?.(),w(`/`)}else I.error(t.message||r(`auth.signup.signupFailed`))}catch(e){ea.error(`Signup error:`,e),I.error(r(`auth.signup.tryAgain`))}finally{C(``),v(!1)}},k=e=>{if(e.key===`Enter`){let t=e.currentTarget.form;t&&t.requestSubmit()}};return y?(0,Q.jsxs)(`div`,{"data-testid":`signup-approval-pending`,className:R(`mx-auto w-full max-w-md text-center`,!n&&`rounded-3xl border border-line bg-surface-raised p-6 shadow-card sm:p-8`),children:[(0,Q.jsx)(`div`,{className:`mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-warning-500/15 text-warning-700 dark:text-warning-400`,children:(0,Q.jsx)(de,{"aria-hidden":`true`,className:`h-6 w-6`})}),(0,Q.jsx)(`h1`,{className:`mt-5 text-3xl font-light tracking-[-0.04em] text-ink`,children:r(`auth.signup.awaitingApproval`,`Awaiting approval`)}),(0,Q.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-ink-muted`,children:r(`auth.signup.awaitingApprovalDescription`,`Your account has been created, but an administrator must activate it before you can sign in.`)}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`mt-6 inline-flex h-11 w-full items-center justify-center rounded-xl border border-line bg-surface px-4 text-sm font-medium text-ink shadow-subtle transition-colors hover:bg-surface-raised`,children:r(`auth.signup.backToSignIn`,`Back to sign in`)})]}):(0,Q.jsxs)(`div`,{className:R(`mx-auto w-full max-w-md`,!n&&`rounded-3xl border border-line bg-surface-raised p-6 shadow-card sm:p-8`),children:[(0,Q.jsxs)(`div`,{className:R(`mb-8`,n?`text-start`:`text-center`),children:[(0,Q.jsx)(`h1`,{className:`mb-2 text-3xl font-light tracking-[-0.04em] text-ink`,children:r(`auth.signup.title`)}),(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:r(`auth.signup.subtitle`)})]}),(0,Q.jsxs)(`form`,{onSubmit:ne,className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{htmlFor:`username`,className:`mb-2 block text-sm font-medium text-ink`,children:r(`auth.signup.username`)}),(0,Q.jsx)(`input`,{id:`username`,type:`text`,value:i,onChange:e=>a(e.target.value),onKeyDown:k,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:r(`auth.signup.usernamePlaceholder`),required:!0,disabled:_})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`label`,{htmlFor:`email`,className:`mb-2 block text-sm font-medium text-ink`,children:[r(`auth.signup.email`),` `,(0,Q.jsxs)(`span`,{className:`text-ink-muted`,children:[`(`,r(`common.optional`),`)`]})]}),(0,Q.jsx)(`input`,{id:`email`,type:`email`,value:o,onChange:e=>s(e.target.value),onKeyDown:k,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:r(`auth.signup.emailPlaceholder`),disabled:_})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{htmlFor:`password`,className:`mb-2 block text-sm font-medium text-ink`,children:r(`auth.signup.password`)}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`input`,{id:`password`,type:p?`text`:`password`,value:c,onChange:e=>u(e.target.value),onKeyDown:k,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 pe-11 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:r(`auth.signup.passwordPlaceholder`),required:!0,disabled:_}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>m(!p),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-ink-muted transition-colors hover:text-ink disabled:cursor-not-allowed disabled:opacity-50`,disabled:_,"aria-label":p?`Hide characters`:`Reveal characters`,children:p?(0,Q.jsx)(Ve,{size:20}):(0,Q.jsx)(P,{size:20})})]}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-xs text-ink-muted`,children:Qi})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{htmlFor:`confirmPassword`,className:`mb-2 block text-sm font-medium text-ink`,children:r(`auth.signup.confirmPassword`)}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`input`,{id:`confirmPassword`,type:h?`text`:`password`,value:d,onChange:e=>f(e.target.value),onKeyDown:k,className:`h-11 w-full rounded-xl border border-line bg-surface px-3 pe-11 text-sm text-ink shadow-subtle outline-none transition-[border-color,box-shadow,background-color] placeholder:text-ink-muted focus:border-line-strong focus:ring-2 focus:ring-primary-500/35 disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none`,placeholder:r(`auth.signup.confirmPasswordPlaceholder`),required:!0,disabled:_}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>g(!h),className:`absolute inset-y-0 end-0 flex items-center pe-3 text-ink-muted transition-colors hover:text-ink disabled:cursor-not-allowed disabled:opacity-50`,disabled:_,"aria-label":h?`Hide confirmation`:`Reveal confirmation`,children:h?(0,Q.jsx)(Ve,{size:20}):(0,Q.jsx)(P,{size:20})})]})]}),O&&D&&(0,Q.jsx)(Ji,{siteKey:D,action:`signup`,disabled:_,errorMessage:r(`auth.signup.tryAgain`),onTokenChange:ee}),(0,Q.jsx)(`button`,{type:`submit`,disabled:te,className:`flex h-11 w-full items-center justify-center rounded-xl border border-transparent bg-ink px-4 text-sm font-medium text-ink-inverse shadow-subtle transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 focus-visible:ring-offset-canvas disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:_?(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-current`}),r(`auth.signup.creatingAccount`)]}):(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[(0,Q.jsx)(Ee,{size:16,className:`me-2`}),r(`auth.signup.createAccount`)]})})]}),(0,Q.jsx)(Ri,{}),(0,Q.jsx)(`div`,{className:`mt-6 text-center`,children:(0,Q.jsxs)(`p`,{className:`text-sm text-ink-muted`,children:[r(`auth.signup.hasAccount`),` `,(0,Q.jsx)(`button`,{onClick:t,className:`font-medium text-primary-600 transition-colors hover:text-primary-700 dark:text-primary-400 dark:hover:text-primary-300`,children:r(`auth.signup.signInHere`)})]})})]})},na=`0.19.0`,ra=()=>{let{t:e}=x(),t=l(),n=y(),{isAuthenticated:r,requiresAuth:i,systemInfo:a}=z(),[o,s]=(0,Z.useState)(!1),c=i(),u=a?.signupEnabled??!0,d=new URLSearchParams(n.search).get(`approval`)===`pending`;if((0,Z.useEffect)(()=>{(r||!c)&&t(`/`)},[c,r,t]),r||!c)return null;let f=[{icon:Te,title:e(`auth.highlights.local.title`,`Local first`),body:e(`auth.highlights.local.body`,`Your conversations and files stay on the machine you run this on.`)},{icon:Ae,title:e(`auth.highlights.providers.title`,`Any provider`),body:e(`auth.highlights.providers.body`,`Local models through Ollama, plus the remote providers you choose to add.`)},{icon:Re,title:e(`auth.highlights.work.title`,`Isolated Work`),body:e(`auth.highlights.work.body`,`Give a model a sandboxed workspace with files, a terminal, and a preview.`)}],p=a?.version||na;return(0,Q.jsxs)(`div`,{className:`relative min-h-screen overflow-y-auto bg-canvas text-ink`,children:[(0,Q.jsxs)(`header`,{className:`absolute inset-x-0 top-0 z-10 flex h-14 items-center justify-between px-5 sm:px-8`,children:[(0,Q.jsx)(Jr,{size:`sm`,className:`text-ink lg:invisible`}),(0,Q.jsx)(Yr,{})]}),(0,Q.jsxs)(`main`,{className:`grid min-h-screen lg:grid-cols-2`,children:[(0,Q.jsxs)(`section`,{className:`relative hidden flex-col justify-between border-e border-line bg-surface px-10 py-12 lg:flex xl:px-16`,children:[(0,Q.jsx)(Jr,{size:`lg`,className:`relative z-10 text-ink`}),(0,Q.jsxs)(`div`,{className:`relative z-10 max-w-lg`,children:[(0,Q.jsx)(`p`,{className:`text-[2.6rem] font-light leading-[1.05] tracking-[-0.04em] text-ink xl:text-5xl`,children:e(`auth.tagline`,`Your AI stack should answer to you.`)}),(0,Q.jsx)(`ul`,{className:`mt-10 space-y-5`,children:f.map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-3`,children:[(0,Q.jsx)(e.icon,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 shrink-0 text-ink-subtle`}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`text-[13px] font-medium text-ink`,children:e.title}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-[13px] leading-relaxed text-ink-muted`,children:e.body})]})]},e.title))})]}),(0,Q.jsxs)(`p`,{className:`relative z-10 font-mono text-[11px] text-ink-subtle`,children:[p?`v${p}`:``,p?` · `:``,e(`auth.selfHosted`,`Self-hosted · Apache 2.0`)]})]}),(0,Q.jsx)(`section`,{className:`flex items-center justify-center px-5 pb-12 pt-24 sm:px-8 lg:px-12 lg:py-12`,children:(0,Q.jsx)(`div`,{className:`w-full max-w-sm`,children:o&&u?(0,Q.jsx)(ta,{bare:!0,onBackToLogin:()=>s(!1),onSignup:()=>s(!1)}):(0,Q.jsx)(Zi,{bare:!0,initialApprovalPending:d,onShowSignup:u?()=>s(!0):void 0})})})]})]})},ia=window.location.protocol===`file:`,aa=()=>ia?(0,Q.jsx)(`div`,{className:`absolute top-0 left-0 right-0 h-8 z-50`,style:{WebkitAppRegion:`drag`}}):null,oa=L(`app`),sa=Z.lazy(()=>f(()=>import(`../js/HomePage-iF44c34e.js`),__vite__mapDeps([19,1,2,5,3,7,12,10,13,8,9,14,15,20]))),ca=Z.lazy(()=>f(()=>import(`../js/ChatPage-D9lWGM8g.js`),__vite__mapDeps([21,1,2,22,5,3,4,6,7,8,9,10,12,13,14,15,23,16,17,18,24,25,26,27,28]))),la=Z.lazy(()=>f(()=>import(`../js/ModelsPage-DJXoIOs8.js`),__vite__mapDeps([29,1,2,5,3,7,8,9,10,12,14,13,15,16,17,18]))),ua=Z.lazy(()=>f(()=>import(`../js/PersonasPage--nqoJ-wA.js`),__vite__mapDeps([30,1,2,3,7,8,9,5,10,12,15,16,17,18]))),da=Z.lazy(()=>f(()=>import(`../js/GalleryPage-C9DTdo_-.js`),__vite__mapDeps([31,1,2,22,3,7,8,9,5,10,11,12,15,16,17,18]))),fa=Z.lazy(()=>f(()=>import(`../js/NotesPage-BTNH6JR2.js`),__vite__mapDeps([32,1,2,3,7,8,9,5,10,12,16,17,18,15,33,34,35]))),pa=Z.lazy(()=>f(()=>import(`../js/LibreClawPage-B9wWZIz6.js`),__vite__mapDeps([36,1,2,6,3,7,8,9,5,10,12,16,17,18,15]))),ma=Z.lazy(()=>f(()=>import(`../js/WorkPage-Ccla0MDm.js`),__vite__mapDeps([37,1,2,5,3,4,6,7,9,10,8,12,13,14,15,16,17,18,33,34,35,28,22,20]))),ha=Z.lazy(()=>f(()=>import(`../js/UserManagementPage-aJhKXQxG.js`),__vite__mapDeps([38,1,2,3,7,8,9,5,10,14,13,12,15,16,17,18]))),ga=Z.lazy(()=>f(()=>import(`../js/PluginUsagePage-BHwm-BBr.js`),__vite__mapDeps([39,1,2,3,7,9,5,10,8,12,16,17,18,15]))),_a=Z.lazy(()=>f(()=>import(`../js/SystemPage-CHez8h3p.js`),__vite__mapDeps([40,1,2,3,7,9,5,10,8,12,16,17,18,15]))),va=Z.lazy(()=>f(()=>import(`../js/ArtifactDemoPage-yrPXLBQo.js`),__vite__mapDeps([41,1,2,16,12,10,17,5,18,3,7,8,15,25,26,27,24]))),ya=Z.lazy(()=>f(()=>import(`../js/SettingsModal-y1Nzg55O.js`).then(e=>({default:e.SettingsModal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]))),ba=Z.lazy(()=>f(()=>import(`../js/ArtifactSlideOutPanel-DdsL2AOQ.js`).then(e=>({default:e.ArtifactSlideOutPanel})),__vite__mapDeps([42,1,2,22,3,4,5,6,7,8,12,10,13,9,15,16,26,27,24]))),xa=Z.lazy(()=>f(()=>import(`../js/FirstTimeSetup-CwLPbHkI.js`).then(e=>({default:e.FirstTimeSetup})),__vite__mapDeps([43,1,2,3,7,8,9,5,10,14,13,12,15]))),Sa=()=>{let{t:e}=x();return(0,Q.jsx)(`div`,{className:`flex h-full min-h-screen items-center justify-center bg-gray-50 dark:bg-dark-100`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,Q.jsx)(`div`,{className:`h-8 w-8 rounded-full border-4 border-gray-200 border-t-primary-500 animate-spin dark:border-dark-300 dark:border-t-primary-400`}),(0,Q.jsx)(`div`,{className:`text-gray-600 dark:text-dark-600`,children:e(`common.loading`)})]})})},Ca=({isOpen:e,compact:t})=>(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:R(`hidden lg:block flex-shrink-0 transition-[width] duration-200 ease-out`,e?t?`w-18`:`w-72`:`w-0`)}),wa=({hasBackground:e,sidebarOpen:t,sidebarCompact:n,onCloseSidebar:r,showDemoBanner:i,demoMessage:a,children:o})=>(0,Q.jsxs)(`div`,{className:R(`flex h-dvh min-h-0 text-gray-950 dark:text-dark-900 relative overflow-hidden`,e?`bg-gray-100/60 dark:bg-dark-50/60`:`bg-gray-100 dark:bg-dark-50`),children:[(0,Q.jsx)(aa,{}),(0,Q.jsx)(Si,{}),(0,Q.jsx)(ui,{isOpen:t,onClose:r}),(0,Q.jsx)(Ca,{isOpen:t,compact:n}),(0,Q.jsxs)(`div`,{"data-testid":`app-shell-content`,className:R(`flex-1 basis-0 flex min-h-0 flex-col min-w-0 transition-[margin,background-color] duration-200 ease-out relative z-10 lg:pb-2 lg:pe-2`,ia?`pt-8`:`lg:pt-1.5`,t&&n?`max-lg:ms-18`:`max-lg:ms-0`,e?`bg-white/10 dark:bg-dark-50/10`:`bg-transparent`),children:[i&&(0,Q.jsx)(xi,{message:a}),(0,Q.jsx)(ji,{}),(0,Q.jsx)(`main`,{className:R(`min-h-0 flex-1 overflow-hidden lg:rounded-[1.5rem] lg:border lg:border-black/[0.06] dark:lg:border-white/[0.07] lg:shadow-[0_1px_2px_rgba(0,0,0,0.03),0_18px_60px_rgba(15,23,42,0.04)]`,e?`bg-white/30 dark:bg-dark-100/35 backdrop-blur-sm`:`bg-gray-50 dark:bg-dark-100`),children:(0,Q.jsx)(pi,{children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Sa,{}),children:o})})})]})]}),Ta=({onClick:e})=>{let t=y();return t.pathname===`/chat`||t.pathname.startsWith(`/c/`)?(0,Q.jsx)(`div`,{className:`hidden lg:block`,children:(0,Q.jsx)(_i,{onClick:e})}):null},Ea=()=>{let{t:e,i18n:t}=x(),n=l(),[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(!1),[s,u]=(0,Z.useState)(0),[d,f]=(0,Z.useState)(!1),{sidebarOpen:p,sidebarCompact:m,setSidebarOpen:g,setSidebarCompact:_,toggleSidebar:v,toggleSidebarCompact:y,toggleTheme:b,backgroundImage:C,preferences:w,artifactPanelOpen:T,closeArtifactPanel:E}=ot(),{systemInfo:D,isLoading:O,user:te,isAuthenticated:ne}=z(),{isDemoMode:k,demoConfig:A}=ot(),j=D?.requiresAuth===!1||ne,M=bi(),[re,N]=Z.useState(!1),ie=Z.useRef(!1);Z.useEffect(()=>{(async()=>{if(ie.current){oa.debug(`OAuth already processing, skipping...`);return}if(oa.debug(`Starting OAuth callback processing...`),ie.current=!0,new URLSearchParams(window.location.search).get(`auth`)===`success`){try{let e=await fetch(`${Ye}/auth/oauth/exchange`,{method:`POST`,credentials:`include`});if(e.ok){let t=await e.json();if(t.success&&t.data){let{login:e}=z.getState();e(t.data.user,t.data.token,t.data.systemInfo),oa.debug(`OAuth login successful`),F.success(`OAuth login successful!`)}else F.error(`Failed to complete OAuth authentication`)}else F.error(`OAuth authentication verification failed`)}catch(e){oa.error(`OAuth processing error:`,e),F.error(`OAuth authentication failed`)}window.history.replaceState({},document.title,window.location.pathname)}oa.debug(`OAuth processing completed`),N(!0),ie.current=!1})()},[]),Ii();let P=()=>{if(C)return!0;let e=w.backgroundSettings;return e?.enabled&&e?.imageUrl},ae=[{key:`b`,metaKey:!0,action:()=>{window.innerWidth>=1024?p?y():(_(!1),v()):(!p&&m&&_(!1),v())},description:e(`keyboard.toggleSidebar`)},{key:`,`,metaKey:!0,action:()=>i(!0),description:e(`keyboard.openSettings`)},{key:`o`,metaKey:!0,shiftKey:!0,action:()=>Ci(n),description:e(`keyboard.newChat`,`New chat`)},{key:`u`,metaKey:!0,shiftKey:!0,action:()=>{let{systemInfo:e,isAdmin:t}=z.getState();(e?.requiresAuth===!1||t())&&Ti(n)},description:e(`keyboard.newWork`,`New Work session`)},{key:`d`,metaKey:!0,action:b,description:e(`keyboard.toggleDarkMode`)},{key:`h`,action:()=>o(!0),description:e(`keyboard.showShortcuts`)},{key:`Escape`,action:()=>{i(!1),o(!1)},description:e(`keyboard.closeModals`)}];mi(ae,j),Z.useEffect(()=>{if(j)return;let e=window.requestAnimationFrame(()=>{i(!1),o(!1),E()});return()=>window.cancelAnimationFrame(e)},[E,j]),Z.useEffect(()=>{if(!j){at.disconnect();return}return at.connect().catch(oa.error),()=>{at.disconnect()}},[j]),Z.useEffect(()=>{if(!D&&!O&&s<15){let e=setTimeout(async()=>{u(e=>e+1);try{await Pi.initializeAuth()}catch{}},2e3);return()=>clearTimeout(e)}},[D,O,s]);let oe=!d&&D?.requiresAuth===!0&&D?.hasUsers===!1;return O?(0,Q.jsxs)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8`,children:[(0,Q.jsx)(`div`,{className:`sm:mx-auto sm:w-full sm:max-w-md`,children:(0,Q.jsx)(`div`,{className:`flex flex-col items-center`,children:(0,Q.jsx)(Jr,{className:`text-gray-900 dark:text-gray-100`})})}),(0,Q.jsx)(`div`,{className:`mt-8 flex flex-col items-center gap-4`,children:(0,Q.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-300 dark:border-gray-600 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})})]}):D?oe&&!d?(0,Q.jsx)(pi,{children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Sa,{}),children:(0,Q.jsx)(xa,{onComplete:()=>{f(!0)}})})}):re?(0,Q.jsxs)(Q.Fragment,{children:[D&&!D.requiresAuth?(0,Q.jsx)(wa,{hasBackground:!!P(),sidebarOpen:p,sidebarCompact:m,onCloseSidebar:()=>g(!1),showDemoBanner:k&&A.showBanner,demoMessage:A.message,children:(0,Q.jsxs)(c,{children:[(0,Q.jsx)(h,{path:`/`,element:(0,Q.jsx)(sa,{})}),(0,Q.jsx)(h,{path:`/chat`,element:(0,Q.jsx)(ca,{})}),(0,Q.jsx)(h,{path:`/c/:sessionId`,element:(0,Q.jsx)(ca,{})}),(0,Q.jsx)(h,{path:`/models`,element:(0,Q.jsx)(la,{})}),(0,Q.jsx)(h,{path:`/personas`,element:(0,Q.jsx)(ua,{})}),(0,Q.jsx)(h,{path:`/gallery`,element:(0,Q.jsx)(da,{})}),(0,Q.jsx)(h,{path:`/notes`,element:(0,Q.jsx)(fa,{})}),(0,Q.jsx)(h,{path:`/work`,element:(0,Q.jsx)($,{requireAdmin:!0,children:(0,Q.jsx)(ma,{})})}),(0,Q.jsx)(h,{path:`/work/:taskId`,element:(0,Q.jsx)($,{requireAdmin:!0,children:(0,Q.jsx)(ma,{})})}),(0,Q.jsx)(h,{path:`/agents`,element:(0,Q.jsx)($,{requireAdmin:!0,children:(0,Q.jsx)(pa,{})})}),(0,Q.jsx)(h,{path:`/usage`,element:(0,Q.jsx)($,{requireAdmin:!0,children:(0,Q.jsx)(ga,{})})}),(0,Q.jsx)(h,{path:`/system`,element:(0,Q.jsx)($,{requireAdmin:!0,children:(0,Q.jsx)(_a,{})})}),(0,Q.jsx)(h,{path:`/login`,element:(0,Q.jsx)(ra,{})})]})}):(0,Q.jsxs)(c,{children:[(0,Q.jsx)(h,{path:`/login`,element:(0,Q.jsx)(ra,{})}),(0,Q.jsx)(h,{path:`/*`,element:(0,Q.jsx)($,{children:(0,Q.jsx)(wa,{hasBackground:!!P(),sidebarOpen:p,sidebarCompact:m,onCloseSidebar:()=>g(!1),showDemoBanner:k&&A.showBanner,demoMessage:A.message,children:(0,Q.jsxs)(c,{children:[(0,Q.jsx)(h,{path:`/`,element:(0,Q.jsx)(sa,{})}),(0,Q.jsx)(h,{path:`/chat`,element:(0,Q.jsx)(ca,{})}),(0,Q.jsx)(h,{path:`/c/:sessionId`,element:(0,Q.jsx)(ca,{})}),(0,Q.jsx)(h,{path:`/models`,element:(0,Q.jsx)(la,{})}),(0,Q.jsx)(h,{path:`/personas`,element:(0,Q.jsx)(ua,{})}),(0,Q.jsx)(h,{path:`/gallery`,element:(0,Q.jsx)(da,{})}),(0,Q.jsx)(h,{path:`/notes`,element:(0,Q.jsx)(fa,{})}),(0,Q.jsx)(h,{path:`/work`,element:(0,Q.jsx)($,{requireAdmin:!0,children:(0,Q.jsx)(ma,{})})}),(0,Q.jsx)(h,{path:`/work/:taskId`,element:(0,Q.jsx)($,{requireAdmin:!0,children:(0,Q.jsx)(ma,{})})}),(0,Q.jsx)(h,{path:`/agents`,element:(0,Q.jsx)($,{requireAdmin:!0,children:(0,Q.jsx)(pa,{})})}),(0,Q.jsx)(h,{path:`/artifacts`,element:(0,Q.jsx)(va,{})}),(0,Q.jsx)(h,{path:`/usage`,element:(0,Q.jsx)($,{requireAdmin:!0,children:(0,Q.jsx)(ga,{})})}),(0,Q.jsx)(h,{path:`/system`,element:(0,Q.jsx)($,{requireAdmin:!0,children:(0,Q.jsx)(_a,{})})}),(0,Q.jsx)(h,{path:`/users`,element:(0,Q.jsx)($,{requireAdmin:!0,children:(0,Q.jsx)(ha,{})})})]})})})})]}),j&&r&&(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(ya,{isOpen:r,onClose:()=>i(!1)})}),(0,Q.jsx)(gi,{isOpen:j&&a,onClose:()=>o(!1),shortcuts:ae}),j&&M.open&&M.notes&&(0,Q.jsx)(vi,{notes:M.notes,onDismiss:M.dismiss}),j&&(0,Q.jsx)(Ta,{onClick:()=>o(!0)}),j&&T&&(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(ba,{})}),(0,Q.jsx)(ee,{position:S(t.language)?`top-left`:`top-right`,toastOptions:{duration:4e3,className:`animate-slide-up`,style:{background:`var(--toast-bg)`,color:`var(--toast-color)`,border:`1px solid var(--toast-border)`,borderRadius:`0.75rem`,boxShadow:`0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)`,cursor:`pointer`},success:{iconTheme:{primary:`rgb(var(--color-primary-600))`,secondary:`#ffffff`}},error:{iconTheme:{primary:`rgb(var(--color-primary-600))`,secondary:`#ffffff`}}},containerStyle:{top:80,insetInlineEnd:20}}),j&&(0,Q.jsx)(Mi,{onOpenSettings:()=>i(!0)})]}):(0,Q.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center`,children:(0,Q.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-300 dark:border-gray-600 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})}):(0,Q.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center p-4`,children:(0,Q.jsxs)(`div`,{className:`text-center`,children:[(0,Q.jsx)(`div`,{className:`mb-8`,children:(0,Q.jsx)(Jr,{className:`text-gray-900 dark:text-white`})}),(0,Q.jsx)(`div`,{className:`flex justify-center mb-4`,children:(0,Q.jsx)(`div`,{className:`w-8 h-8 border-4 border-gray-300 dark:border-dark-300 border-t-primary-500 dark:border-t-primary-400 rounded-full animate-spin`})}),(0,Q.jsx)(`p`,{className:`text-gray-600 dark:text-dark-600 text-sm`,children:s>0?`Connecting to backend... (${s}/15)`:`Starting up...`})]})})},Da=ia?g([{path:`*`,element:(0,Q.jsx)(Ea,{})}]):m([{path:`*`,element:(0,Q.jsx)(Ea,{})}]),Oa=()=>(0,Q.jsx)(pi,{children:(0,Q.jsx)(_,{router:Da})}),ka=new yr({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}});C.catch(()=>{w(`en`)}).then(()=>{Lr.createRoot(document.getElementById(`root`)).render((0,Q.jsx)(Z.StrictMode,{children:(0,Q.jsx)(Sr,{client:ka,children:(0,Q.jsx)(Oa,{})})}))});export{Ci as a,Jr as c,Fr as d,xr as f,cn as g,sn as h,wi as i,Gr as l,ln as m,$i as n,Ti as o,In as p,Ji as r,ai as s,Qi as t,Ir as u};
@@ -0,0 +1 @@
1
+ @font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2)format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff)format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2)format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff)format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2)format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff)format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2)format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff)format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2)format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff)format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2)format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff)format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2)format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff)format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2)format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff)format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2)format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff)format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2)format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff)format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2)format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff)format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2)format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff)format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2)format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff)format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2)format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff)format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2)format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff)format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2)format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff)format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2)format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff)format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC)format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff)format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2)format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff)format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf)format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2)format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff)format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf)format("truetype")}.katex{text-indent:0;text-rendering:auto;font:1.21em/1.2 KaTeX_Main,Times New Roman,serif;position:relative}.katex *{border-color:currentColor;-ms-high-contrast-adjust:none!important}.katex .katex-version:after{content:"0.18.1"}.katex .katex-mathml{clip-path:inset(50%);border:0;width:1px;height:1px;padding:0;position:absolute;overflow:hidden}.katex .katex-html>.katex-newline{display:block}.katex .katex-base{white-space:nowrap;width:min-content;position:relative}.katex .katex-base,.katex .katex-strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;table-layout:fixed;display:inline-table}.katex .vlist-r{display:table-row}.katex .vlist{vertical-align:bottom;display:table-cell;position:relative}.katex .vlist>span{height:0;display:block;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{width:0;overflow:hidden}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{vertical-align:bottom;width:2px;min-width:2px;font-size:1px;display:table-cell}.katex .katex-vbox{flex-direction:column;align-items:baseline;display:inline-flex}.katex .katex-thinbox{flex-direction:row;width:0;max-width:0;display:inline-flex}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;width:100%;display:inline-block}.katex .katex-hdashline,.katex .katex-hline,.katex .katex-overline .overline-line,.katex .katex-rule,.katex .katex-underline .underline-line,.katex .mfrac .frac-line{min-height:1px}.katex .mspace{display:inline-block}.katex .katex-smash{line-height:0;display:inline}.katex .clap,.katex .llap,.katex .rlap{width:0;position:relative}.katex .clap>.katex-inner,.katex .llap>.katex-inner,.katex .rlap>.katex-inner{position:absolute}.katex .clap>.katex-fix,.katex .llap>.katex-fix,.katex .rlap>.katex-fix{display:inline-block}.katex .llap>.katex-inner{right:0}.katex .clap>.katex-inner,.katex .rlap>.katex-inner{left:0}.katex .clap>.katex-inner>span{margin-left:-50%;margin-right:50%}.katex .katex-rule{border:0 solid;display:inline-block;position:relative}.katex .katex-hline,.katex .katex-overline .overline-line,.katex .katex-underline .underline-line{border-bottom-style:solid;width:100%;display:inline-block}.katex .katex-hdashline{border-bottom-style:dashed;width:100%;display:inline-block}.katex .sqrt>.katex-root{margin-left:.277778em;margin-right:-.555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .katex-sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .katex-sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .katex-sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .katex-sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .katex-sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .katex-sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .katex-sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .katex-sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .katex-sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .katex-sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .katex-sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .katex-sizing.reset-size2.size1{font-size:.833333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .katex-sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .katex-sizing.reset-size2.size3{font-size:1.16667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .katex-sizing.reset-size2.size4{font-size:1.33333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .katex-sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .katex-sizing.reset-size2.size6{font-size:1.66667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .katex-sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .katex-sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .katex-sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .katex-sizing.reset-size2.size10{font-size:3.45667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .katex-sizing.reset-size2.size11{font-size:4.14667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .katex-sizing.reset-size3.size1{font-size:.714286em}.katex .fontsize-ensurer.reset-size3.size2,.katex .katex-sizing.reset-size3.size2{font-size:.857143em}.katex .fontsize-ensurer.reset-size3.size3,.katex .katex-sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .katex-sizing.reset-size3.size4{font-size:1.14286em}.katex .fontsize-ensurer.reset-size3.size5,.katex .katex-sizing.reset-size3.size5{font-size:1.28571em}.katex .fontsize-ensurer.reset-size3.size6,.katex .katex-sizing.reset-size3.size6{font-size:1.42857em}.katex .fontsize-ensurer.reset-size3.size7,.katex .katex-sizing.reset-size3.size7{font-size:1.71429em}.katex .fontsize-ensurer.reset-size3.size8,.katex .katex-sizing.reset-size3.size8{font-size:2.05714em}.katex .fontsize-ensurer.reset-size3.size9,.katex .katex-sizing.reset-size3.size9{font-size:2.46857em}.katex .fontsize-ensurer.reset-size3.size10,.katex .katex-sizing.reset-size3.size10{font-size:2.96286em}.katex .fontsize-ensurer.reset-size3.size11,.katex .katex-sizing.reset-size3.size11{font-size:3.55429em}.katex .fontsize-ensurer.reset-size4.size1,.katex .katex-sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .katex-sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .katex-sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .katex-sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .katex-sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .katex-sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .katex-sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .katex-sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .katex-sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .katex-sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .katex-sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .katex-sizing.reset-size5.size1{font-size:.555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .katex-sizing.reset-size5.size2{font-size:.666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .katex-sizing.reset-size5.size3{font-size:.777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .katex-sizing.reset-size5.size4{font-size:.888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .katex-sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .katex-sizing.reset-size5.size6{font-size:1.11111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .katex-sizing.reset-size5.size7{font-size:1.33333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .katex-sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .katex-sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .katex-sizing.reset-size5.size10{font-size:2.30444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .katex-sizing.reset-size5.size11{font-size:2.76444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .katex-sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .katex-sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .katex-sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .katex-sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .katex-sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .katex-sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .katex-sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .katex-sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .katex-sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .katex-sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .katex-sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .katex-sizing.reset-size7.size1{font-size:.416667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .katex-sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .katex-sizing.reset-size7.size3{font-size:.583333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .katex-sizing.reset-size7.size4{font-size:.666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .katex-sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .katex-sizing.reset-size7.size6{font-size:.833333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .katex-sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .katex-sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .katex-sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .katex-sizing.reset-size7.size10{font-size:1.72833em}.katex .fontsize-ensurer.reset-size7.size11,.katex .katex-sizing.reset-size7.size11{font-size:2.07333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .katex-sizing.reset-size8.size1{font-size:.347222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .katex-sizing.reset-size8.size2{font-size:.416667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .katex-sizing.reset-size8.size3{font-size:.486111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .katex-sizing.reset-size8.size4{font-size:.555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .katex-sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .katex-sizing.reset-size8.size6{font-size:.694444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .katex-sizing.reset-size8.size7{font-size:.833333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .katex-sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .katex-sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .katex-sizing.reset-size8.size10{font-size:1.44028em}.katex .fontsize-ensurer.reset-size8.size11,.katex .katex-sizing.reset-size8.size11{font-size:1.72778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .katex-sizing.reset-size9.size1{font-size:.289352em}.katex .fontsize-ensurer.reset-size9.size2,.katex .katex-sizing.reset-size9.size2{font-size:.347222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .katex-sizing.reset-size9.size3{font-size:.405093em}.katex .fontsize-ensurer.reset-size9.size4,.katex .katex-sizing.reset-size9.size4{font-size:.462963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .katex-sizing.reset-size9.size5{font-size:.520833em}.katex .fontsize-ensurer.reset-size9.size6,.katex .katex-sizing.reset-size9.size6{font-size:.578704em}.katex .fontsize-ensurer.reset-size9.size7,.katex .katex-sizing.reset-size9.size7{font-size:.694444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .katex-sizing.reset-size9.size8{font-size:.833333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .katex-sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .katex-sizing.reset-size9.size10{font-size:1.20023em}.katex .fontsize-ensurer.reset-size9.size11,.katex .katex-sizing.reset-size9.size11{font-size:1.43981em}.katex .fontsize-ensurer.reset-size10.size1,.katex .katex-sizing.reset-size10.size1{font-size:.24108em}.katex .fontsize-ensurer.reset-size10.size2,.katex .katex-sizing.reset-size10.size2{font-size:.289296em}.katex .fontsize-ensurer.reset-size10.size3,.katex .katex-sizing.reset-size10.size3{font-size:.337512em}.katex .fontsize-ensurer.reset-size10.size4,.katex .katex-sizing.reset-size10.size4{font-size:.385728em}.katex .fontsize-ensurer.reset-size10.size5,.katex .katex-sizing.reset-size10.size5{font-size:.433944em}.katex .fontsize-ensurer.reset-size10.size6,.katex .katex-sizing.reset-size10.size6{font-size:.48216em}.katex .fontsize-ensurer.reset-size10.size7,.katex .katex-sizing.reset-size10.size7{font-size:.578592em}.katex .fontsize-ensurer.reset-size10.size8,.katex .katex-sizing.reset-size10.size8{font-size:.694311em}.katex .fontsize-ensurer.reset-size10.size9,.katex .katex-sizing.reset-size10.size9{font-size:.833173em}.katex .fontsize-ensurer.reset-size10.size10,.katex .katex-sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .katex-sizing.reset-size10.size11{font-size:1.19961em}.katex .fontsize-ensurer.reset-size11.size1,.katex .katex-sizing.reset-size11.size1{font-size:.200965em}.katex .fontsize-ensurer.reset-size11.size2,.katex .katex-sizing.reset-size11.size2{font-size:.241158em}.katex .fontsize-ensurer.reset-size11.size3,.katex .katex-sizing.reset-size11.size3{font-size:.281351em}.katex .fontsize-ensurer.reset-size11.size4,.katex .katex-sizing.reset-size11.size4{font-size:.321543em}.katex .fontsize-ensurer.reset-size11.size5,.katex .katex-sizing.reset-size11.size5{font-size:.361736em}.katex .fontsize-ensurer.reset-size11.size6,.katex .katex-sizing.reset-size11.size6{font-size:.401929em}.katex .fontsize-ensurer.reset-size11.size7,.katex .katex-sizing.reset-size11.size7{font-size:.482315em}.katex .fontsize-ensurer.reset-size11.size8,.katex .katex-sizing.reset-size11.size8{font-size:.578778em}.katex .fontsize-ensurer.reset-size11.size9,.katex .katex-sizing.reset-size11.size9{font-size:.694534em}.katex .fontsize-ensurer.reset-size11.size10,.katex .katex-sizing.reset-size11.size10{font-size:.833601em}.katex .fontsize-ensurer.reset-size11.size11,.katex .katex-sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{width:.12em;display:inline-block}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .katex-accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .katex-accent .accent-body{position:relative}.katex .katex-accent .accent-body:not(.accent-full){width:0}.katex .katex-overlay{display:block}.katex .mtable .vertical-separator{min-width:1px;display:inline-block}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;height:inherit;width:100%;display:block;position:absolute}.katex svg path{stroke:none}.katex svg{fill-rule:nonzero;fill-opacity:1;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1}.katex img{border-style:none;min-width:0;max-width:none;min-height:0;max-height:none}.katex .katex-stretchy{width:100%;display:block;position:relative;overflow:hidden}.katex .katex-stretchy:after,.katex .katex-stretchy:before{content:""}.katex .hide-tail{width:100%;position:relative;overflow:hidden}.katex .halfarrow-left{width:50.2%;position:absolute;left:0;overflow:hidden}.katex .halfarrow-right{width:50.2%;position:absolute;right:0;overflow:hidden}.katex .brace-left{width:25.1%;position:absolute;left:0;overflow:hidden}.katex .brace-center{width:50%;position:absolute;left:25%;overflow:hidden}.katex .brace-right{width:25.1%;position:absolute;right:0;overflow:hidden}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{box-sizing:border-box;border:.04em solid}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .katex-sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{box-sizing:border-box;border-top:.049em solid;border-right:.049em solid;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{text-align:left;display:inline-block;position:absolute;right:calc(50% + .3em)}.katex .cd-label-right{text-align:right;display:inline-block;position:absolute;left:calc(50% + .3em)}.katex-display{text-align:center;margin:1em 0;display:block}.katex-display>.katex{text-align:center;white-space:nowrap;display:block}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.katex-tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.katex-tag{left:0;right:auto}.katex-display.fleqn>.katex{text-align:left;padding-left:2em}body{counter-reset:katexEqnNo mmlEqnNo}