libre-webui 0.36.0 → 0.37.1
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.
- package/README.md +59 -0
- package/backend/dist/cordis/contracts.d.ts +270 -0
- package/backend/dist/cordis/contracts.d.ts.map +1 -0
- package/backend/dist/cordis/contracts.js +32 -0
- package/backend/dist/cordis/contracts.js.map +1 -0
- package/backend/dist/cordis/dsh/chat-model.d.ts +16 -0
- package/backend/dist/cordis/dsh/chat-model.d.ts.map +1 -0
- package/backend/dist/cordis/dsh/chat-model.js +104 -0
- package/backend/dist/cordis/dsh/chat-model.js.map +1 -0
- package/backend/dist/cordis/dsh/engine-plugin.d.ts +186 -0
- package/backend/dist/cordis/dsh/engine-plugin.d.ts.map +1 -0
- package/backend/dist/cordis/dsh/engine-plugin.js +1116 -0
- package/backend/dist/cordis/dsh/engine-plugin.js.map +1 -0
- package/backend/dist/cordis/dsh/librewebui-llm-adapter.d.ts +175 -0
- package/backend/dist/cordis/dsh/librewebui-llm-adapter.d.ts.map +1 -0
- package/backend/dist/cordis/dsh/librewebui-llm-adapter.js +480 -0
- package/backend/dist/cordis/dsh/librewebui-llm-adapter.js.map +1 -0
- package/backend/dist/cordis/dsh/model-identity.d.ts +12 -0
- package/backend/dist/cordis/dsh/model-identity.d.ts.map +1 -0
- package/backend/dist/cordis/dsh/model-identity.js +87 -0
- package/backend/dist/cordis/dsh/model-identity.js.map +1 -0
- package/backend/dist/cordis/dsh/native-provider-client.d.ts +44 -0
- package/backend/dist/cordis/dsh/native-provider-client.d.ts.map +1 -0
- package/backend/dist/cordis/dsh/native-provider-client.js +524 -0
- package/backend/dist/cordis/dsh/native-provider-client.js.map +1 -0
- package/backend/dist/cordis/dsh/native-provider-plugin.d.ts +11 -0
- package/backend/dist/cordis/dsh/native-provider-plugin.d.ts.map +1 -0
- package/backend/dist/cordis/dsh/native-provider-plugin.js +416 -0
- package/backend/dist/cordis/dsh/native-provider-plugin.js.map +1 -0
- package/backend/dist/cordis/dsh/native-provider-protocol.d.ts +37 -0
- package/backend/dist/cordis/dsh/native-provider-protocol.d.ts.map +1 -0
- package/backend/dist/cordis/dsh/native-provider-protocol.js +325 -0
- package/backend/dist/cordis/dsh/native-provider-protocol.js.map +1 -0
- package/backend/dist/cordis/dsh/provider-handler.d.ts +36 -0
- package/backend/dist/cordis/dsh/provider-handler.d.ts.map +1 -0
- package/backend/dist/cordis/dsh/provider-handler.js +582 -0
- package/backend/dist/cordis/dsh/provider-handler.js.map +1 -0
- package/backend/dist/cordis/dsh/session-files.d.ts +9 -0
- package/backend/dist/cordis/dsh/session-files.d.ts.map +1 -0
- package/backend/dist/cordis/dsh/session-files.js +60 -0
- package/backend/dist/cordis/dsh/session-files.js.map +1 -0
- package/backend/dist/cordis/dsh/session-settings.d.ts +15 -0
- package/backend/dist/cordis/dsh/session-settings.d.ts.map +1 -0
- package/backend/dist/cordis/dsh/session-settings.js +51 -0
- package/backend/dist/cordis/dsh/session-settings.js.map +1 -0
- package/backend/dist/cordis/dsh/work-driver.d.ts +12 -0
- package/backend/dist/cordis/dsh/work-driver.d.ts.map +1 -0
- package/backend/dist/cordis/dsh/work-driver.js +402 -0
- package/backend/dist/cordis/dsh/work-driver.js.map +1 -0
- package/backend/dist/cordis/dsh/workspace-policy.d.ts +10 -0
- package/backend/dist/cordis/dsh/workspace-policy.d.ts.map +1 -0
- package/backend/dist/cordis/dsh/workspace-policy.js +44 -0
- package/backend/dist/cordis/dsh/workspace-policy.js.map +1 -0
- package/backend/dist/cordis/host/composition.d.ts +73 -0
- package/backend/dist/cordis/host/composition.d.ts.map +1 -0
- package/backend/dist/cordis/host/composition.js +205 -0
- package/backend/dist/cordis/host/composition.js.map +1 -0
- package/backend/dist/cordis/host/config.d.ts +159 -0
- package/backend/dist/cordis/host/config.d.ts.map +1 -0
- package/backend/dist/cordis/host/config.js +184 -0
- package/backend/dist/cordis/host/config.js.map +1 -0
- package/backend/dist/cordis/host/host.d.ts +74 -0
- package/backend/dist/cordis/host/host.d.ts.map +1 -0
- package/backend/dist/cordis/host/host.js +420 -0
- package/backend/dist/cordis/host/host.js.map +1 -0
- package/backend/dist/cordis/host/loader-entry.d.ts +41 -0
- package/backend/dist/cordis/host/loader-entry.d.ts.map +1 -0
- package/backend/dist/cordis/host/loader-entry.js +52 -0
- package/backend/dist/cordis/host/loader-entry.js.map +1 -0
- package/backend/dist/cordis/host/model.d.ts +45 -0
- package/backend/dist/cordis/host/model.d.ts.map +1 -0
- package/backend/dist/cordis/host/model.js +54 -0
- package/backend/dist/cordis/host/model.js.map +1 -0
- package/backend/dist/cordis/host/privacy.d.ts +8 -0
- package/backend/dist/cordis/host/privacy.d.ts.map +1 -0
- package/backend/dist/cordis/host/privacy.js +73 -0
- package/backend/dist/cordis/host/privacy.js.map +1 -0
- package/backend/dist/cordis/index.d.ts +14 -0
- package/backend/dist/cordis/index.d.ts.map +1 -0
- package/backend/dist/cordis/index.js +30 -0
- package/backend/dist/cordis/index.js.map +1 -0
- package/backend/dist/cordis/runtime.d.ts +97 -0
- package/backend/dist/cordis/runtime.d.ts.map +1 -0
- package/backend/dist/cordis/runtime.js +231 -0
- package/backend/dist/cordis/runtime.js.map +1 -0
- package/backend/dist/cordis/work-model.d.ts +7 -0
- package/backend/dist/cordis/work-model.d.ts.map +1 -0
- package/backend/dist/cordis/work-model.js +30 -0
- package/backend/dist/cordis/work-model.js.map +1 -0
- package/backend/dist/db.js +1 -1
- package/backend/dist/index.d.ts.map +1 -1
- package/backend/dist/index.js +9 -0
- package/backend/dist/index.js.map +1 -1
- package/backend/dist/main.js +12 -0
- package/backend/dist/main.js.map +1 -1
- package/backend/dist/persistence/extensionTypes.d.ts +2 -0
- package/backend/dist/persistence/extensionTypes.d.ts.map +1 -1
- package/backend/dist/persistence/extensionTypes.js.map +1 -1
- package/backend/dist/persistence/postgresExtensionRepositories.d.ts.map +1 -1
- package/backend/dist/persistence/postgresExtensionRepositories.js +38 -0
- package/backend/dist/persistence/postgresExtensionRepositories.js.map +1 -1
- package/backend/dist/persistence/postgresResourceRepositories.d.ts.map +1 -1
- package/backend/dist/persistence/postgresResourceRepositories.js +6 -1
- package/backend/dist/persistence/postgresResourceRepositories.js.map +1 -1
- package/backend/dist/persistence/resourceTypes.d.ts +3 -1
- package/backend/dist/persistence/resourceTypes.d.ts.map +1 -1
- package/backend/dist/persistence/resourceTypes.js.map +1 -1
- package/backend/dist/persistence/sqliteExtensionRepositories.d.ts.map +1 -1
- package/backend/dist/persistence/sqliteExtensionRepositories.js +40 -0
- package/backend/dist/persistence/sqliteExtensionRepositories.js.map +1 -1
- package/backend/dist/persistence/sqliteResourceRepositories.d.ts.map +1 -1
- package/backend/dist/persistence/sqliteResourceRepositories.js +7 -1
- package/backend/dist/persistence/sqliteResourceRepositories.js.map +1 -1
- package/backend/dist/routes/agentCli.d.ts.map +1 -1
- package/backend/dist/routes/agentCli.js +34 -2
- package/backend/dist/routes/agentCli.js.map +1 -1
- package/backend/dist/routes/chat.d.ts.map +1 -1
- package/backend/dist/routes/chat.js +9 -1
- package/backend/dist/routes/chat.js.map +1 -1
- package/backend/dist/routes/cordis.d.ts +3 -0
- package/backend/dist/routes/cordis.d.ts.map +1 -0
- package/backend/dist/routes/cordis.js +440 -0
- package/backend/dist/routes/cordis.js.map +1 -0
- package/backend/dist/routes/libreClaw.js +1 -1
- package/backend/dist/routes/libreClaw.js.map +1 -1
- package/backend/dist/routes/work.d.ts.map +1 -1
- package/backend/dist/routes/work.js +23 -8
- package/backend/dist/routes/work.js.map +1 -1
- package/backend/dist/services/agentAccessService.d.ts +4 -0
- package/backend/dist/services/agentAccessService.d.ts.map +1 -1
- package/backend/dist/services/agentAccessService.js +48 -16
- package/backend/dist/services/agentAccessService.js.map +1 -1
- package/backend/dist/services/agentCliService.d.ts +42 -1
- package/backend/dist/services/agentCliService.d.ts.map +1 -1
- package/backend/dist/services/agentCliService.js +206 -7
- package/backend/dist/services/agentCliService.js.map +1 -1
- package/backend/dist/services/agentCliUsage.d.ts +22 -0
- package/backend/dist/services/agentCliUsage.d.ts.map +1 -0
- package/backend/dist/services/agentCliUsage.js +192 -0
- package/backend/dist/services/agentCliUsage.js.map +1 -0
- package/backend/dist/services/authService.d.ts +3 -0
- package/backend/dist/services/authService.d.ts.map +1 -1
- package/backend/dist/services/authService.js +4 -1
- package/backend/dist/services/authService.js.map +1 -1
- package/backend/dist/services/chatGenerationService.d.ts +7 -0
- package/backend/dist/services/chatGenerationService.d.ts.map +1 -1
- package/backend/dist/services/chatGenerationService.js +32 -1
- package/backend/dist/services/chatGenerationService.js.map +1 -1
- package/backend/dist/services/cordisAccessService.d.ts +56 -0
- package/backend/dist/services/cordisAccessService.d.ts.map +1 -0
- package/backend/dist/services/cordisAccessService.js +98 -0
- package/backend/dist/services/cordisAccessService.js.map +1 -0
- package/backend/dist/services/durableChatGenerationService.d.ts.map +1 -1
- package/backend/dist/services/durableChatGenerationService.js +9 -1
- package/backend/dist/services/durableChatGenerationService.js.map +1 -1
- package/backend/dist/services/emailService.d.ts.map +1 -1
- package/backend/dist/services/emailService.js +8 -1
- package/backend/dist/services/emailService.js.map +1 -1
- package/backend/dist/services/pluginService.d.ts.map +1 -1
- package/backend/dist/services/pluginService.js +7 -26
- package/backend/dist/services/pluginService.js.map +1 -1
- package/backend/dist/services/pluginUsageService.d.ts +52 -0
- package/backend/dist/services/pluginUsageService.d.ts.map +1 -1
- package/backend/dist/services/pluginUsageService.js +89 -1
- package/backend/dist/services/pluginUsageService.js.map +1 -1
- package/backend/dist/services/systemSettingsService.d.ts +1 -1
- package/backend/dist/services/systemSettingsService.d.ts.map +1 -1
- package/backend/dist/services/systemSettingsService.js +1 -1
- package/backend/dist/services/systemSettingsService.js.map +1 -1
- package/backend/dist/services/thinkingSummaryService.d.ts +3 -0
- package/backend/dist/services/thinkingSummaryService.d.ts.map +1 -1
- package/backend/dist/services/thinkingSummaryService.js +56 -17
- package/backend/dist/services/thinkingSummaryService.js.map +1 -1
- package/backend/dist/services/titleGenerationService.d.ts +22 -2
- package/backend/dist/services/titleGenerationService.d.ts.map +1 -1
- package/backend/dist/services/titleGenerationService.js +63 -8
- package/backend/dist/services/titleGenerationService.js.map +1 -1
- package/backend/dist/services/workAgentService.d.ts +1 -1
- package/backend/dist/services/workAgentService.d.ts.map +1 -1
- package/backend/dist/services/workAgentService.js +76 -12
- package/backend/dist/services/workAgentService.js.map +1 -1
- package/backend/dist/services/workModelProviderService.d.ts +5 -0
- package/backend/dist/services/workModelProviderService.d.ts.map +1 -1
- package/backend/dist/services/workModelProviderService.js +52 -3
- package/backend/dist/services/workModelProviderService.js.map +1 -1
- package/backend/dist/services/workRuntimeService.d.ts.map +1 -1
- package/backend/dist/services/workRuntimeService.js +4 -1
- package/backend/dist/services/workRuntimeService.js.map +1 -1
- package/backend/dist/services/workTaskService.d.ts.map +1 -1
- package/backend/dist/services/workTaskService.js +6 -6
- package/backend/dist/services/workTaskService.js.map +1 -1
- package/backend/dist/types/work.d.ts +12 -1
- package/backend/dist/types/work.d.ts.map +1 -1
- package/backend/dist/utils/pluginStreamAdapter.d.ts.map +1 -1
- package/backend/dist/utils/pluginStreamAdapter.js +18 -4
- package/backend/dist/utils/pluginStreamAdapter.js.map +1 -1
- package/backend/dist/utils/pluginStreaming.d.ts +6 -0
- package/backend/dist/utils/pluginStreaming.d.ts.map +1 -1
- package/backend/dist/utils/pluginStreaming.js +10 -0
- package/backend/dist/utils/pluginStreaming.js.map +1 -1
- package/backend/dist/utils/smtpClient.d.ts +5 -1
- package/backend/dist/utils/smtpClient.d.ts.map +1 -1
- package/backend/dist/utils/smtpClient.js +29 -3
- package/backend/dist/utils/smtpClient.js.map +1 -1
- package/backend/dist/websocketServer.d.ts.map +1 -1
- package/backend/dist/websocketServer.js +4 -0
- package/backend/dist/websocketServer.js.map +1 -1
- package/backend/package.json +37 -2
- package/frontend/dist/artifact-runtime/.build-fingerprint +1 -1
- package/frontend/dist/artifact-runtime/framer-motion.js +3 -3
- package/frontend/dist/artifact-runtime/lucide-react.js +1 -1
- package/frontend/dist/artifact-runtime/react.js +5 -5
- package/frontend/dist/artifact-runtime/recharts.js +45 -45
- package/frontend/dist/assets/index-BrDSO609.js +20 -0
- package/frontend/dist/assets/index-C8_AByBq.css +1 -0
- package/frontend/dist/index.html +33 -31
- package/frontend/dist/js/{ArtifactContainer-B8tyPtWd.js → ArtifactContainer-B1-GVzVf.js} +1 -1
- package/frontend/dist/js/{ArtifactDemoPage-BwRfWoSK.js → ArtifactDemoPage-goftRHdk.js} +1 -1
- package/frontend/dist/js/{ArtifactSandboxFrame-Ctcwt_l2.js → ArtifactSandboxFrame-_8RA8_JV.js} +1 -1
- package/frontend/dist/js/ArtifactSlideOutPanel-DlkOZI5N.js +1 -0
- package/frontend/dist/js/{AutomationModal-mTYs9LrJ.js → AutomationModal-BaaxZF1M.js} +1 -1
- package/frontend/dist/js/AutomationsPage-DY2x7zVm.js +1 -0
- package/frontend/dist/js/{AvatarUpload-wWUAi3e2.js → AvatarUpload-CH_n1Ef0.js} +1 -1
- package/frontend/dist/js/{Button-ZQ6BePid.js → Button-CGMYia4g.js} +1 -1
- package/frontend/dist/js/{CalendarPage-Ch4racU2.js → CalendarPage-DLo5nm3Q.js} +1 -1
- package/frontend/dist/js/ChannelsPage-DnQI7mzq.js +1 -0
- package/frontend/dist/js/ChatPage-BaDkJnEC.js +14 -0
- package/frontend/dist/js/ConnectModels-B4dGb5yc.js +1 -0
- package/frontend/dist/js/CordisPage-CPiYn2Bx.js +1 -0
- package/frontend/dist/js/{EvaluationsPage-DHPnNBkW.js → EvaluationsPage-DpdGpd7x.js} +2 -2
- package/frontend/dist/js/{FirstTimeSetup-CoF83yY8.js → FirstTimeSetup-By8OE1JS.js} +1 -1
- package/frontend/dist/js/GalleryPage-ByZyIhZQ.js +1 -0
- package/frontend/dist/js/HomePage-Btc-Mvin.js +1 -0
- package/frontend/dist/js/{LanguageSwitcher-CogfczNm.js → LanguageSwitcher-B3CxRW6J.js} +1 -1
- package/frontend/dist/js/LibreClawPage-3Sonm1gu.js +1 -0
- package/frontend/dist/js/{Logo-C9fsEUaY.js → Logo-HZvdAk2c.js} +1 -1
- package/frontend/dist/js/{LogoMark-Cvu5CQOW.js → LogoMark-GJnfMXsk.js} +1 -1
- package/frontend/dist/js/{ModelManagerModals-Bc2Woor7.js → ModelManagerModals-Bk6OQzJI.js} +1 -1
- package/frontend/dist/js/NotesPage-lFhfjMqJ.js +3 -0
- package/frontend/dist/js/{OptimizedSyntaxHighlighter-aKWyHj_c.js → OptimizedSyntaxHighlighter-CzzV6ONG.js} +1 -1
- package/frontend/dist/js/OptimizedSyntaxHighlighter-ajqwyBQm.js +1 -0
- package/frontend/dist/js/{PasswordStrengthMeter-BJr4eBbo.js → PasswordStrengthMeter-DasfJa4P.js} +1 -1
- package/frontend/dist/js/{PersonasPage-ff5opf9B.js → PersonasPage-nOThOpXp.js} +2 -2
- package/frontend/dist/js/PluginUsagePage-BRbHeRf7.js +1 -0
- package/frontend/dist/js/{RichMessageContent-BNNylVAb.js → RichMessageContent-BZ7KKJKK.js} +2 -2
- package/frontend/dist/js/RichMessageContent-oyydJjgc.js +1 -0
- package/frontend/dist/js/SettingsModal-VpsAx2Ns.js +19 -0
- package/frontend/dist/js/{SettingsToggle-CKLHOUt-.js → SettingsToggle-oxvw7ulA.js} +1 -1
- package/frontend/dist/js/{ShareDialog-DykD70uB.js → ShareDialog-CnxPGPb_.js} +1 -1
- package/frontend/dist/js/SystemPage-D2ikvhDp.js +1 -0
- package/frontend/dist/js/{TurnstileWidget-BO2ceTt8.js → TurnstileWidget-CVepEMEQ.js} +1 -1
- package/frontend/dist/js/{UserManagementPage-Ch-PvYQ9.js → UserManagementPage-2yHv89ZA.js} +1 -1
- package/frontend/dist/js/UserManagementPanel-vxpiyiTZ.js +1 -0
- package/frontend/dist/js/{WhatsNewModal-Bu4H4MEb.js → WhatsNewModal-DAAFzY0d.js} +1 -1
- package/frontend/dist/js/WorkPage-BYpYD9mr.js +8 -0
- package/frontend/dist/js/api-C0ligMmL.js +1 -0
- package/frontend/dist/js/api-CVUaOaq4.js +14 -0
- package/frontend/dist/js/{appNavigation-CVsQuDI1.js → appNavigation-CqtrZ9bm.js} +1 -1
- package/frontend/dist/js/{appStore-Din-tTD9.js → appStore-Biw63DtJ.js} +2 -2
- package/frontend/dist/js/appVersion-D78eXAb-.js +1 -0
- package/frontend/dist/js/ar-Cq-DrSYL.js +2 -0
- package/frontend/dist/js/authStore-2DsDTcIu.js +1 -0
- package/frontend/dist/js/{authStore-Cm8P6rYs.js → authStore-C5qKrmn4.js} +3 -3
- package/frontend/dist/js/bn-BqxLh-KL.js +2 -0
- package/frontend/dist/js/chatStore-DQhEqb9F.js +3 -0
- package/frontend/dist/js/client-gf5bjBrn.js +2 -0
- package/frontend/dist/js/composerStyles-C83jssgZ.js +1 -0
- package/frontend/dist/js/{config-DHea4b8N.js → config-CNvgxwAm.js} +1 -1
- package/frontend/dist/js/cordisApi-BYjA4EOQ.js +2 -0
- package/frontend/dist/js/cs-D2DDNZf-.js +2 -0
- package/frontend/dist/js/da-BciY-TSG.js +2 -0
- package/frontend/dist/js/de-DjU_eXQ-.js +2 -0
- package/frontend/dist/js/es-ChIEs80I.js +2 -0
- package/frontend/dist/js/{estree-DCT3Jm65.js → estree-DGmLqopC.js} +17 -17
- package/frontend/dist/js/evaluationsApi-Bg12ekHo.js +1 -0
- package/frontend/dist/js/fr-Bi8BGRW4.js +2 -0
- package/frontend/dist/js/hi-BMsCnWg7.js +2 -0
- package/frontend/dist/js/{html-CBXMuS97.js → html-BryNQ_yx.js} +6 -6
- package/frontend/dist/js/id-CpcN1vhk.js +2 -0
- package/frontend/dist/js/is-DkUy2cmP.js +2 -0
- package/frontend/dist/js/it-BglK9DRZ.js +2 -0
- package/frontend/dist/js/ja-IrprzwLJ.js +2 -0
- package/frontend/dist/js/ko--wwEsMPi.js +2 -0
- package/frontend/dist/js/{markdown-Bo71X2X2.js → markdown-CZ1tYEW8.js} +17 -17
- package/frontend/dist/js/{markdown-core-BFkBYv2v.js → markdown-core-KjS96SYW.js} +1 -1
- package/frontend/dist/js/{markdown-html-CwjnwJbl.js → markdown-html-DQEwrWcf.js} +1 -1
- package/frontend/dist/js/{markdown-math-CJvHdD1l.js → markdown-math-CKi32S5d.js} +1 -1
- package/frontend/dist/js/{markdownHtml-egpK3_YY.js → markdownHtml-lrXhxBhK.js} +1 -1
- package/frontend/dist/js/markdownMath-B0BpyFBS.js +1 -0
- package/frontend/dist/js/{messageCodeStyles-euWoxwoo.js → messageCodeStyles-DJZ4QMVq.js} +2 -2
- package/frontend/dist/js/ms-BWj59y7-.js +2 -0
- package/frontend/dist/js/nl-D-QndW_A.js +2 -0
- package/frontend/dist/js/pl-Dw7d7iDV.js +2 -0
- package/frontend/dist/js/pt-BI53uHJw.js +2 -0
- package/frontend/dist/js/react-vendor-wiHys0m2.js +9 -0
- package/frontend/dist/js/router-vendor-HZm4FR0A.js +1 -0
- package/frontend/dist/js/ru-JKyTgPg9.js +2 -0
- package/frontend/dist/js/{standalone-6z5x8CWe.js → standalone-DbyFjvTU.js} +1 -1
- package/frontend/dist/js/sv-BIkBLPSQ.js +2 -0
- package/frontend/dist/js/{syntax-highlight-7t8DGG2n.js → syntax-highlight-DNc3FFCa.js} +1 -1
- package/frontend/dist/js/{teamEventStream-DGgjrVqw.js → teamEventStream-PXiwR5Kr.js} +1 -1
- package/frontend/dist/js/th-CZ_LcCU0.js +2 -0
- package/frontend/dist/js/tr-B265byx1.js +2 -0
- package/frontend/dist/js/{typescript-CslHIgIJ.js → typescript-DUM5niRM.js} +1 -1
- package/frontend/dist/js/{ui-CNcEDQ95.js → ui-DDMjO5dd.js} +2 -2
- package/frontend/dist/js/ui-vendor-BhHHyHk3.js +1 -0
- package/frontend/dist/js/uk-VTAlChwf.js +2 -0
- package/frontend/dist/js/{useChat-YRODF1y1.js → useChat-DaIZ2Dbu.js} +1 -1
- package/frontend/dist/js/{useDialogFocus-BQLdAGYH.js → useDialogFocus-BPTG_Zmy.js} +1 -1
- package/frontend/dist/js/useDictation-BXyX1U8r.js +1 -0
- package/frontend/dist/js/useQuery-hWmQjdLu.js +1 -0
- package/frontend/dist/js/{useTranslation-Kn7_iLGj.js → useTranslation-B9kflK9S.js} +1 -1
- package/frontend/dist/js/{utils-Dq1w7K0c.js → utils-p8Gt72YP.js} +1 -1
- package/frontend/dist/js/{utils-vendor-dx9vGAt3.js → utils-vendor-DISWt2y9.js} +1 -1
- package/frontend/dist/js/vi-D8rXh-53.js +2 -0
- package/frontend/dist/js/{workStatus-oU04ZrUq.js → work-DmJpVPPO.js} +1 -1
- package/frontend/dist/js/workApi-BIS9RxRi.js +1 -0
- package/frontend/dist/js/workApi-C3Td_lFD.js +5 -0
- package/frontend/dist/js/workModels-MzU2Ab7l.js +1 -0
- package/frontend/dist/js/zh-BEGd9iBD.js +2 -0
- package/package.json +43 -8
- package/scripts/prepare-dsh-provider.mjs +124 -0
- package/frontend/dist/assets/index-BXTzjRcS.js +0 -92
- package/frontend/dist/assets/index-uzzNXp5R.css +0 -1
- package/frontend/dist/js/ArtifactSlideOutPanel-DPWGjHhp.js +0 -1
- package/frontend/dist/js/AutomationsPage-DvsLZWtg.js +0 -1
- package/frontend/dist/js/ChannelsPage-D252gXwf.js +0 -1
- package/frontend/dist/js/ChatPage-D_CzOiHw.js +0 -14
- package/frontend/dist/js/ConnectModels-DYOtIOEY.js +0 -1
- package/frontend/dist/js/GalleryPage-BpK-vrvd.js +0 -1
- package/frontend/dist/js/HomePage-zJkkDNJl.js +0 -1
- package/frontend/dist/js/LibreClawPage-CAgNj9GM.js +0 -1
- package/frontend/dist/js/NotesPage-CNTqlwNc.js +0 -3
- package/frontend/dist/js/OptimizedSyntaxHighlighter-BFjOBavF.js +0 -1
- package/frontend/dist/js/PluginUsagePage-Cp4j4-VZ.js +0 -1
- package/frontend/dist/js/RichMessageContent-BOY5jqj-.js +0 -1
- package/frontend/dist/js/SettingsModal-WAdVG4-g.js +0 -19
- package/frontend/dist/js/SystemPage-Dwi8leEQ.js +0 -1
- package/frontend/dist/js/UserManagementPanel-CfG67c_k.js +0 -1
- package/frontend/dist/js/WorkPage-D_cL9wp4.js +0 -8
- package/frontend/dist/js/api-29NO19CP.js +0 -14
- package/frontend/dist/js/api-DhafOTdF.js +0 -1
- package/frontend/dist/js/appVersion-BNuquyI6.js +0 -1
- package/frontend/dist/js/ar-WHne6B0o.js +0 -2
- package/frontend/dist/js/authStore-snvjjOuX.js +0 -1
- package/frontend/dist/js/bn-BZvCjqwO.js +0 -2
- package/frontend/dist/js/chatStore-BPpcL4I5.js +0 -3
- package/frontend/dist/js/composerStyles-bNlrIugf.js +0 -1
- package/frontend/dist/js/cs-DfSqWQ9V.js +0 -2
- package/frontend/dist/js/da-BmMLW4Dl.js +0 -2
- package/frontend/dist/js/de-BQMiQwQT.js +0 -2
- package/frontend/dist/js/es-DXf6jt4Z.js +0 -2
- package/frontend/dist/js/evaluationsApi-Btc9Mg9z.js +0 -1
- package/frontend/dist/js/fr-BD6nT1oc.js +0 -2
- package/frontend/dist/js/hi-BSuNic-8.js +0 -2
- package/frontend/dist/js/id-wodbwt3B.js +0 -2
- package/frontend/dist/js/is-CEjw-OJE.js +0 -2
- package/frontend/dist/js/it-X_pq8C7q.js +0 -2
- package/frontend/dist/js/ja-DWM2HZZd.js +0 -2
- package/frontend/dist/js/ko-DFi2khBB.js +0 -2
- package/frontend/dist/js/markdownMath-mesq3ZcY.js +0 -1
- package/frontend/dist/js/ms-DNQateTR.js +0 -2
- package/frontend/dist/js/nl-DSWhi8W8.js +0 -2
- package/frontend/dist/js/pl-W9WEDpZ3.js +0 -2
- package/frontend/dist/js/pt-DCCGvdNt.js +0 -2
- package/frontend/dist/js/react-vendor-D0Ec-185.js +0 -9
- package/frontend/dist/js/router-vendor-CM0PhOMl.js +0 -1
- package/frontend/dist/js/ru-D-Ww6dXe.js +0 -2
- package/frontend/dist/js/sv-B0Iry-H3.js +0 -2
- package/frontend/dist/js/th-CEZS0WeE.js +0 -2
- package/frontend/dist/js/tr-BFJ8TeYb.js +0 -2
- package/frontend/dist/js/ui-vendor-LatG6rFF.js +0 -177
- package/frontend/dist/js/uk-BmW3yDel.js +0 -2
- package/frontend/dist/js/useQuery-C3O4CZ54.js +0 -1
- package/frontend/dist/js/vi-Cu25FXnp.js +0 -2
- package/frontend/dist/js/work-DVgm81bJ.js +0 -1
- package/frontend/dist/js/workApi-BdUNugC3.js +0 -1
- package/frontend/dist/js/workApi-OieM8qEL.js +0 -6
- package/frontend/dist/js/zh-CuCAx3oH.js +0 -2
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/SettingsModal-WAdVG4-g.js","js/rolldown-runtime-hePW80VL.js","js/react-vendor-D0Ec-185.js","js/useQuery-C3O4CZ54.js","js/logger-BR4forr_.js","js/useTranslation-Kn7_iLGj.js","js/utils-Dq1w7K0c.js","js/utils-vendor-dx9vGAt3.js","js/chatStore-BPpcL4I5.js","js/i18next-DOICz7ZY.js","js/ui-vendor-LatG6rFF.js","js/goober.modern-BaHbaW3_.js","js/api-29NO19CP.js","js/config-DHea4b8N.js","js/workApi-OieM8qEL.js","js/imageGenModels-Dx_QMLJQ.js","js/authStore-Cm8P6rYs.js","js/appStore-Din-tTD9.js","js/messageCodeStyles-euWoxwoo.js","js/Button-ZQ6BePid.js","js/ui-CNcEDQ95.js","js/useDialogFocus-BQLdAGYH.js","js/Logo-C9fsEUaY.js","js/LogoMark-Cvu5CQOW.js","js/ShareDialog-DykD70uB.js","js/LanguageSwitcher-CogfczNm.js","js/ttsBatching-kFVEE3Ip.js","js/appVersion-BNuquyI6.js","js/SettingsToggle-CKLHOUt-.js","js/thinking-DwlkTfPX.js","js/HomePage-zJkkDNJl.js","js/router-vendor-CM0PhOMl.js","js/workStatus-oU04ZrUq.js","js/appNavigation-CVsQuDI1.js","js/welcomePrompts-to5mv_gx.js","js/work-DVgm81bJ.js","js/ChatPage-D_CzOiHw.js","js/useChat-YRODF1y1.js","js/artifactHtml-DDmfpcB0.js","js/ConnectModels-DYOtIOEY.js","js/ArtifactContainer-B8tyPtWd.js","js/OptimizedSyntaxHighlighter-aKWyHj_c.js","js/syntax-highlight-7t8DGG2n.js","js/markdown-core-BFkBYv2v.js","js/ArtifactSandboxFrame-Ctcwt_l2.js","js/evaluationsApi-Btc9Mg9z.js","js/composerStyles-bNlrIugf.js","js/WhatsNewModal-Bu4H4MEb.js","js/PersonasPage-ff5opf9B.js","js/AvatarUpload-wWUAi3e2.js","js/GalleryPage-BpK-vrvd.js","js/NotesPage-CNTqlwNc.js","js/RichMessageContent-BNNylVAb.js","js/CalendarPage-Ch4racU2.js","js/calendarDates-Co3o_05Y.js","js/AutomationsPage-DvsLZWtg.js","js/AutomationModal-mTYs9LrJ.js","js/LibreClawPage-CAgNj9GM.js","js/ChannelsPage-D252gXwf.js","js/teamEventStream-DGgjrVqw.js","js/WorkPage-D_cL9wp4.js","js/UserManagementPage-Ch-PvYQ9.js","js/PluginUsagePage-Cp4j4-VZ.js","js/EvaluationsPage-DHPnNBkW.js","js/SystemPage-Dwi8leEQ.js","js/ArtifactDemoPage-BwRfWoSK.js","js/ArtifactSlideOutPanel-DPWGjHhp.js","js/FirstTimeSetup-CoF83yY8.js","js/TurnstileWidget-BO2ceTt8.js","js/PasswordStrengthMeter-BJr4eBbo.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"../js/rolldown-runtime-hePW80VL.js";import{i as t,n,r,t as i}from"../js/react-vendor-D0Ec-185.js";import{S as a,_ as o,b as s,c,d as l,f as u,g as d,h as f,i as p,l as m,m as h,p as g,s as _,t as v,u as y,v as b,x,y as S}from"../js/useQuery-C3O4CZ54.js";import{a as C,c as w,d as T,m as E,n as D,o as O,p as k,r as A,s as j,t as M,u as N}from"../js/router-vendor-CM0PhOMl.js";import{a as P,o as F,t as I}from"../js/logger-BR4forr_.js";import{t as L}from"../js/useTranslation-Kn7_iLGj.js";import{i as ee,l as te,o as R,t as z}from"../js/utils-Dq1w7K0c.js";import{S as ne,T as B,d as re,m as ie,t as ae,w as oe}from"../js/chatStore-BPpcL4I5.js";import{$n as se,$t as ce,B as le,Cn as ue,Cr as V,E as de,En as fe,Et as pe,G as H,I as me,It as U,Jn as he,Lt as ge,M as _e,Mt as ve,Nt as W,On as ye,Qn as be,Rn as xe,Sn as Se,Sr as G,T as Ce,Tt as we,U as Te,Ut as Ee,V as De,Wt as Oe,Xn as ke,Xt as Ae,Z as je,Zn as Me,_t as Ne,an as Pe,ar as Fe,at as Ie,c as Le,cr as Re,dn as ze,dr as Be,dt as Ve,er as He,et as Ue,g as We,gn as Ge,h as Ke,it as qe,k as Je,ln as Ye,lr as Xe,mt as Ze,n as K,on as Qe,pt as $e,qt as et,r as tt,rr as nt,st as rt,t as it,tr as at,u as ot,ut as st,v as ct,vr as lt,vt as ut,wn as dt,xr as ft,z as pt}from"../js/ui-vendor-LatG6rFF.js";import{i as mt,t as ht}from"../js/utils-vendor-dx9vGAt3.js";import{t as gt}from"../js/config-DHea4b8N.js";import{D as _t,E as vt,L as yt,R as bt,T as xt,_ as St,g as Ct,h as wt,v as Tt,y as Et,z as Dt}from"../js/api-29NO19CP.js";import{d as Ot,n as kt,s as At,t as q,u as jt}from"../js/authStore-Cm8P6rYs.js";import{f as Mt,l as Nt,n as Pt,o as Ft,t as J,u as It}from"../js/appStore-Din-tTD9.js";import{n as Lt}from"../js/welcomePrompts-to5mv_gx.js";import{l as Rt}from"../js/messageCodeStyles-euWoxwoo.js";import{t as Y}from"../js/Button-ZQ6BePid.js";import{d as zt,m as Bt}from"../js/ui-CNcEDQ95.js";import{t as Vt}from"../js/useDialogFocus-BQLdAGYH.js";import{t as Ht}from"../js/AvatarUpload-wWUAi3e2.js";import{t as Ut}from"../js/Logo-C9fsEUaY.js";import{t as Wt}from"../js/LogoMark-Cvu5CQOW.js";import{t as Gt}from"../js/ShareDialog-DykD70uB.js";import{t as Kt}from"../js/teamEventStream-DGgjrVqw.js";import{n as qt}from"../js/workStatus-oU04ZrUq.js";import{t as Jt}from"../js/useChat-YRODF1y1.js";import{a as Yt,c as Xt,i as Zt,o as Qt,r as $t,t as en}from"../js/LanguageSwitcher-CogfczNm.js";import{n as tn,r as nn,t as rn}from"../js/appNavigation-CVsQuDI1.js";import{n as an}from"../js/ttsBatching-kFVEE3Ip.js";import{t as on}from"../js/TurnstileWidget-BO2ceTt8.js";import{n as sn,t as cn}from"../js/PasswordStrengthMeter-BJr4eBbo.js";import{t as ln}from"../js/appVersion-BNuquyI6.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 un=class extends _{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||dn(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=c({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.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 this.#n.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 this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(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),y.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function dn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var fn=class extends u{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new un({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=pn(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=pn(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=pn(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=pn(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){y.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>d(t,e))}findAll(e={}){return this.getAll().filter(t=>d(e,t))}notify(e){y.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return y.batch(()=>Promise.all(e.map(e=>e.continue().catch(b))))}};function pn(e){return e.options.scope?.id}var mn=class extends u{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??f(r,t),a=this.get(i);return a||(a=new p({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){y.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>o(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>o(e,t)):t}notify(e){y.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){y.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){y.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},hn=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new mn,this.#t=e.mutationCache||new fn,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=l.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=m.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(s(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=g(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return y.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;y.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return y.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=y.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(b).catch(b)}invalidateQueries(e,t={}){return y.batch(()=>(this.#e.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=y.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(b)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(b)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(s(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(s(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(b).catch(b)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(b).catch(b)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return m.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(h(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{S(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(h(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{S(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=f(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===x&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},X=e(t(),1),gn=e(n(),1),Z=i(),_n={id:`home`,kind:`home`,path:`/`},vn=[`/calendar`,`/automations`,`/channels`,`/personas`,`/gallery`,`/agents`,`/usage`,`/system`,`/artifacts`],yn=e=>{if(e===`/`||e===`/home`)return _n;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}:vn.includes(e)?{id:`page:${e}`,kind:`page`,path:e}:null},bn=e=>[_n,...e.filter(e=>e.id!==_n.id)],xn=mt()(ht((e,t)=>({tabs:[_n],activeTabId:_n.id,syncWithPath:t=>{let n=yn(t);n&&e(e=>{let t=bn(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=bn(i.tabs),o=new Set(n.filter(e=>e!==_n.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]??_n;return e({tabs:c,activeTabId:d.id}),d},reset:()=>e({tabs:[_n],activeTabId:_n.id})}),{name:`libre-webui-tabs`,merge:(e,t)=>{let n=e??{},r=Array.isArray(n.tabs)?bn(n.tabs.filter(e=>!!e&&typeof e.id==`string`&&typeof e.path==`string`&&yn(e.path)?.id===e.id)):t.tabs,i=r.some(e=>e.id===n.activeTabId)?n.activeTabId:_n.id;return{...t,tabs:r,activeTabId:i}}})),Q=r();function Sn({open:e,value:t,saving:n,onChange:r,onClose:i,onSave:a}){let{t:o}=L();return e?(0,Q.createPortal)((0,Z.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,Z.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,Z.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,Z.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,Z.jsx)(`button`,{onClick:i,className:`p-2 hover:bg-gray-100 dark:hover:bg-dark-200 rounded-xl transition-colors`,children:(0,Z.jsx)(K,{size:20,className:`text-gray-500`})})]}),(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(Ht,{value:t,onChange:r}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-3 pt-4 border-t border-gray-200 dark:border-dark-300`,children:[(0,Z.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,Z.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 Cn=`h-4 w-4 text-ink-muted transition-colors duration-150 group-hover:text-ink motion-reduce:transition-none`,wn={light:de,dark:Ne,amoled:ut,celestial:Ce},Tn={light:`light`,dark:`dark`,amoled:`pure black`,celestial:`celestial`},En=()=>{let{theme:e,toggleTheme:t}=J(),n=Ft(e.mode),r=wn[n],i=`Switch to ${Tn[n]} mode`;return(0,Z.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:t,className:`h-9 w-9 rounded-full p-0`,"aria-label":i,title:`${i} (⌘D)`,children:(0,Z.jsx)(r,{className:Cn,strokeWidth:1.75,"aria-hidden":`true`})})},Dn=`relative flex h-[44px] w-[44px] shrink-0 items-center justify-center rounded-full text-ink transition-colors duration-150 hover:bg-interactive-hover outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30 touch-manipulation motion-reduce:transition-none`;function On(){let{t:e}=L();return(0,Z.jsx)(`div`,{className:`flex shrink-0 justify-center px-2`,children:(0,Z.jsx)(`button`,{type:`button`,"data-testid":`sidebar-search-button`,onClick:()=>window.dispatchEvent(new Event(`libre:open-palette`)),title:e(`palette.search`,`Search`),"aria-label":e(`palette.search`,`Search`),className:Dn,children:(0,Z.jsx)(H,{"aria-hidden":`true`,className:`h-[18px] w-[18px]`})})})}function kn({sidebarCompact:e,isElectron:t,showWork:n,activeMode:r,selectedModel:i,modelCount:a,onToggleCompact:o,onStartWork:s,onCreateSession:c}){let{t:l}=L(),u=!i||a===0,d=u?l(`chat.model.noModelsTooltip`):``;return e?(0,Z.jsxs)(`div`,{className:z(`flex shrink-0 flex-col items-center gap-[4px] px-2 pt-[8px]`,t&&`pt-10`),children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:o,className:z(Dn,`group`),title:l(`sidebar.expandSidebar`),"aria-label":l(`sidebar.expandSidebar`),"data-testid":`sidebar-rail-expand`,children:[(0,Z.jsx)(Wt,{size:`sm`,label:null,className:`h-6 w-6 p-0 text-ink group-hover:hidden`}),(0,Z.jsx)(Ve,{className:`hidden h-[18px] w-[18px] group-hover:block rtl:rotate-180`})]}),(0,Z.jsx)(`button`,{type:`button`,onClick:c,disabled:u,className:z(Dn,u&&`opacity-40`),title:u?d:l(`chat.session.chat`),"aria-label":l(`chat.session.chat`),"aria-pressed":r===`chat`,"data-testid":`sidebar-chat-button`,children:(0,Z.jsx)(pe,{className:`h-[18px] w-[18px]`})}),n&&(0,Z.jsx)(`button`,{type:`button`,onClick:s,className:`relative flex h-[44px] w-[44px] shrink-0 items-center justify-center rounded-full text-ink transition-colors duration-150 hover:bg-interactive-hover outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30 touch-manipulation motion-reduce:transition-none`,title:l(`chat.session.work`),"aria-label":l(`chat.session.work`),"aria-pressed":r===`work`,"data-testid":`sidebar-work-button`,children:(0,Z.jsx)(nt,{className:`h-[18px] w-[18px]`})})]}):(0,Z.jsxs)(`div`,{className:z(`px-3 pb-2 pt-2`,t&&`pt-10`),children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex h-[52px] min-w-0 items-center justify-between ps-1`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-ink`,children:[(0,Z.jsx)(Wt,{size:`sm`,label:null}),(0,Z.jsx)(Ut,{size:`sm`,className:`tracking-[-0.035em]`})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,Z.jsx)(`div`,{className:`hidden sm:block`,children:(0,Z.jsx)(En,{})}),(0,Z.jsx)(`button`,{type:`button`,onClick:o,className:`flex h-7 w-7 items-center justify-center rounded-full text-ink-muted transition-colors hover:bg-interactive-hover hover:text-ink outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30 touch-manipulation`,title:l(`sidebar.toggleSize`),"aria-label":l(`sidebar.toggleSize`),"data-testid":`sidebar-toggle-size`,children:(0,Z.jsx)(Ve,{className:`h-4 w-4 rtl:rotate-180`})})]})]}),(0,Z.jsxs)(`div`,{className:z(`grid w-full gap-2`,!n&&`grid-cols-1`,n&&`grid-cols-2`),"data-testid":`sidebar-create-actions`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:c,disabled:u,className:z(`flex h-[38px] items-center justify-center gap-1.5 rounded-xl border text-sm font-medium transition-colors touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,r===`chat`?`border-transparent bg-nav-active text-ink`:`border-line bg-surface-raised text-ink hover:bg-hover-solid dark:border-white/[0.12] dark:bg-dark-25 dark:hover:bg-dark-300`,u&&`opacity-50`),title:u?d:l(`chat.session.chat`),"aria-label":l(`chat.session.chat`),"aria-pressed":r===`chat`,"data-testid":`sidebar-chat-button`,children:[(0,Z.jsx)(pe,{className:`h-4 w-4`}),l(`chat.session.chat`)]}),n&&(0,Z.jsxs)(`button`,{type:`button`,onClick:s,className:z(`flex h-[38px] items-center justify-center gap-1.5 rounded-xl border text-sm font-medium transition-colors touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,r===`work`?`border-transparent bg-nav-active text-ink`:`border-line bg-surface-raised text-ink hover:bg-hover-solid dark:border-white/[0.12] dark:bg-dark-25 dark:hover:bg-dark-300`),title:l(`chat.session.work`),"aria-label":l(`chat.session.work`),"aria-pressed":r===`work`,"data-testid":`sidebar-work-button`,children:[(0,Z.jsx)(nt,{className:`h-4 w-4`}),l(`chat.session.work`)]})]}),(0,Z.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:`mt-1.5 flex h-[34px] w-full items-center gap-2 rounded-xl px-2.5 text-sm text-ink-muted transition-colors hover:bg-interactive-hover hover:text-ink outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30 touch-manipulation`,children:[(0,Z.jsx)(H,{className:`h-4 w-4 shrink-0`}),(0,Z.jsx)(`span`,{className:`flex-1 text-start`,children:l(`palette.search`,`Search`)}),(0,Z.jsxs)(`span`,{className:`font-mono text-[10px] tracking-wide text-ink-subtle`,children:[R()?`⌘`:`Ctrl`,`K`]})]})]})}var An=[{path:`/channels`,icon:we,labelKey:`sidebar.navigation.channels`},{path:`/notes`,icon:Ze,labelKey:`sidebar.navigation.notes`},{path:`/calendar`,icon:at,labelKey:`sidebar.navigation.calendar`},{path:`/automations`,icon:it,labelKey:`sidebar.navigation.automations`},{path:`/personas`,icon:Le,labelKey:`sidebar.navigation.personas`},{path:`/gallery`,icon:_e,labelKey:`sidebar.navigation.imagine`},{path:`/agents`,icon:Re,labelKey:`sidebar.navigation.agents`}];function jn({sidebarCompact:e,activePath:t,showAgents:n,unseenRunCount:r=0,onMobileNavigate:i}){let{t:a}=L();return(0,Z.jsx)(`div`,{className:z(`shrink-0`,e?`px-2`:`px-3 pb-3`),children:(0,Z.jsx)(`nav`,{"data-testid":`sidebar-navigation`,"aria-label":a(`sidebar.navigation.exploreLabel`,`Explore`),className:z(`flex`,e?`flex-col items-center gap-[4px]`:`items-center gap-1`),children:An.filter(e=>e.path!==`/agents`||n).map(({path:n,icon:o,labelKey:s})=>{let c=t===n||t.startsWith(`${n}/`),l=a(s);return(0,Z.jsxs)(M,{to:n,onClick:i,title:l,"aria-label":l,"aria-current":c?`page`:void 0,className:z(e?Dn:`relative flex h-9 flex-1 items-center justify-center rounded-xl transition-colors duration-150 touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,c?`bg-nav-active text-ink`:!e&&`text-ink-muted hover:bg-interactive-hover hover:text-ink`),children:[(0,Z.jsx)(o,{"aria-hidden":`true`,className:`h-[18px] w-[18px] shrink-0`}),n===`/automations`&&r>0&&(0,Z.jsx)(`span`,{"data-testid":`automations-unseen-badge`,className:`absolute -end-0.5 -top-0.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-primary-500 px-0.5 text-[9px] font-semibold leading-none text-white`,children:r>9?`9+`:r})]},n)})})})}function Mn({top:e,left:t,title:n,timestamp:r,children:i}){let{i18n:a}=L();return(0,Q.createPortal)((0,Z.jsxs)(`div`,{role:`tooltip`,className:`pointer-events-none fixed z-[70] hidden 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 md:block`,style:{top:Math.max(8,Math.min(e,window.innerHeight-220)),left:t},children:[(0,Z.jsx)(`p`,{className:`mb-1 truncate text-[13px] font-semibold text-gray-900 dark:text-dark-900`,children:n}),(0,Z.jsx)(`p`,{className:`mb-2 text-[10px] tabular-nums text-gray-400 dark:text-dark-500`,children:ee(r,a.language)}),i]}),document.body)}function Nn({children:e,"data-testid":t,compact:n=!1,compactClassName:r}){let i=(0,X.useRef)(null),a=(0,X.useRef)(null);return(0,X.useLayoutEffect)(()=>{if(n)return;let e=i.current,t=a.current;if(!e||!t)return;let r=null,o=()=>{r=null;let{scrollTop:t,scrollHeight:n,clientHeight:i}=e,a=n-i-t;e.style.setProperty(`--sidebar-fade-top`,`${Math.min(24,Math.max(0,t))}px`),e.style.setProperty(`--sidebar-fade-bottom`,`${Math.min(24,Math.max(0,a))}px`)},s=()=>{r===null&&(r=requestAnimationFrame(o))};o(),e.addEventListener(`scroll`,s,{passive:!0});let c=new ResizeObserver(s);return c.observe(e),c.observe(t),()=>{e.removeEventListener(`scroll`,s),c.disconnect(),r!==null&&cancelAnimationFrame(r),e.style.removeProperty(`--sidebar-fade-top`),e.style.removeProperty(`--sidebar-fade-bottom`)}},[n]),(0,Z.jsx)(`div`,{className:n?z(`shrink-0`,r):`flex min-h-0 flex-1 flex-col border-t border-black/[0.05] dark:border-white/[0.05]`,children:(0,Z.jsx)(`div`,{ref:i,"data-testid":t,className:n?void 0:`sidebar-scroll-fade scroll-region min-h-0 flex-1 scrollbar-thin`,children:(0,Z.jsx)(`div`,{ref:a,children:e})})})}function Pn(e,t){let n=(0,X.useRef)(null),r=(0,X.useRef)(null);(0,X.useEffect)(()=>{if(!e)return;let t=n.current,i=r.current;return t?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus(),()=>{(document.activeElement===document.body||t?.contains(document.activeElement))&&i?.focus()}},[e]);let i=()=>{e&&r.current?.focus(),t()};return{menuRef:n,setTrigger:e=>{r.current=e},onKeyDown:e=>{if(e.key===`Escape`||e.key===`Tab`){e.key===`Escape`&&e.preventDefault(),e.stopPropagation(),i();return}let t=Array.from(n.current?.querySelectorAll(`[role="menuitem"]:not(:disabled)`)??[]);if(!t.length)return;let r=t.indexOf(document.activeElement),a;switch(e.key){case`ArrowDown`:a=(r+1)%t.length;break;case`ArrowUp`:a=(r-1+t.length)%t.length;break;case`Home`:a=0;break;case`End`:a=t.length-1;break;default:return}e.preventDefault(),e.stopPropagation(),t[a].focus()},closeMenu:i}}function Fn(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 In=[`today`,`yesterday`,`previous7Days`,`previous30Days`,`older`];function Ln({preview:e}){let{t}=L(),{session:n}=e,r=n.messages.find(e=>e.role===`user`&&e.content.trim()),i=n.messages.find(e=>e.role===`assistant`&&e.content.trim());return(0,Z.jsxs)(Mn,{top:e.top,left:e.left,title:n.title,timestamp:n.updatedAt,children:[r&&(0,Z.jsx)(`div`,{className:`mb-1.5 flex justify-end`,children:(0,Z.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:te(r.content,110)})}),i&&(0,Z.jsx)(`p`,{dir:`auto`,className:`text-[11px] leading-snug text-gray-600 dark:text-dark-700`,children:te(i.content.replace(/\s+/g,` `),180)}),!r&&!i&&(0,Z.jsx)(`p`,{className:`text-[11px] italic text-gray-400 dark:text-dark-500`,children:t(`chat.session.noChats`)})]})}function Rn({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,onTogglePinSession:m,folders:h=[],onCreateFolder:g,onRenameFolder:_,onDeleteFolder:v,onMoveSession:y,onExpandSidebar:b}){let{t:x,i18n:S}=L(),[C,w]=(0,X.useState)(null),[T,E]=(0,X.useState)(null),D=(0,X.useRef)(null),O=T?e.find(e=>e.id===T)??null:null;(0,X.useEffect)(()=>()=>{D.current!==null&&window.clearTimeout(D.current)},[]);let k=()=>{D.current!==null&&(window.clearTimeout(D.current),D.current=null),w(null)},A=(e,t)=>{let n=window.matchMedia(`(hover: hover) and (pointer: fine)`).matches;i||window.innerWidth<768||!n||(D.current!==null&&window.clearTimeout(D.current),D.current=window.setTimeout(()=>{let n=t.getBoundingClientRect();w({session:e,top:n.top,left:n.right+10})},500))},[j,M]=(0,X.useState)(()=>new Set),[N,P]=(0,X.useState)(!1),[F,I]=(0,X.useState)(``),[R,ne]=(0,X.useState)(null),[B,re]=(0,X.useState)(null),[ie,ae]=(0,X.useState)(null),oe=B?e.find(e=>e.id===B)??null:null,se=()=>{re(null),ae(null)},ce=e=>{let t=oe;se(),t&&y&&(t.folderId??null)!==e&&y(t.id,e)},ue=(e,t)=>({onDragOver:t=>{B&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,ie!==e&&ae(e))},onDragLeave:()=>{ie===e&&ae(null)},onDrop:e=>{e.preventDefault(),ce(t)}}),[V,de]=(0,X.useState)(null),[H,me]=(0,X.useState)(null),U=H?e.find(e=>e.id===H.sessionId)??null:null,{menuRef:ge,setTrigger:_e,onKeyDown:ve,closeMenu:W}=Pn(H?.sessionId,()=>me(null)),ye=(e,t)=>{if(t.stopPropagation(),k(),H?.sessionId===e.id){W();return}_e(t.currentTarget);let n=t.currentTarget.getBoundingClientRect();me({sessionId:e.id,top:Math.max(8,Math.min(n.bottom+6,window.innerHeight-340-8)),left:Math.max(8,Math.min(n.right-208,window.innerWidth-208-8))})},be=e=>{let t=window.location.protocol===`file:`?`${window.location.pathname}#/c/${e.id}`:`/c/${e.id}`;window.open(t,`_blank`,`noopener,noreferrer`)},xe=e=>{M(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Se=()=>{let e=F.trim();P(!1),I(``),e&&g&&g(e)},G=e=>{let t=F.trim();ne(null),I(``),t&&_&&_(e,t)},Ce=new Set(h.map(e=>e.id)),we=e.filter(e=>e.pinned),Te=e.filter(e=>!e.pinned),Ee=Te.filter(e=>!e.folderId||!Ce.has(e.folderId)),De=[...we.length>0?[{key:`pinned`,labelKey:`pinned`,sessions:we}]:[],...h.map(e=>({key:`folder:${e.id}`,folder:e,sessions:Te.filter(t=>t.folderId===e.id)})),...In.map(e=>({key:e,labelKey:e,sessions:Ee.filter(t=>Fn(t.updatedAt)===e)})).filter(e=>e.sessions.length>0)];return(0,Z.jsxs)(Nn,{"data-testid":`sidebar-session-scroll-region`,compact:i,compactClassName:`md:hidden`,children:[(0,Z.jsxs)(`div`,{className:i?`p-0`:`px-3 py-3`,children:[!i&&e.length>0&&(0,Z.jsxs)(`div`,{className:`mb-1 flex h-7 items-center justify-between px-1.5`,children:[(0,Z.jsx)(`h3`,{className:`text-xs font-medium text-ink-subtle`,children:x(`chat.session.chats`)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[g&&(0,Z.jsx)(`button`,{onClick:()=>{P(!0),I(``)},className:`flex h-6 w-6 items-center justify-center rounded-md text-ink-subtle transition-colors hover:bg-interactive-hover hover:text-ink`,title:x(`chat.session.folder.new`),children:(0,Z.jsx)(ze,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(`span`,{className:`text-[10px] tabular-nums text-ink-subtle font-medium`,children:e.length})]})]}),!i&&N&&(0,Z.jsx)(`div`,{className:`mb-2 px-1`,children:(0,Z.jsx)(Bt,{value:F,onChange:e=>I(e.target.value),onKeyDown:e=>{e.key===`Enter`?Se():e.key===`Escape`&&(P(!1),I(``))},onBlur:Se,placeholder:x(`chat.session.folder.namePlaceholder`),className:`h-8 text-sm`,autoFocus:!0})}),i?(0,Z.jsx)(`div`,{className:`flex flex-col items-center gap-[4px]`,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:b,"data-testid":`sidebar-mobile-chats`,"aria-label":`${x(`chat.session.chats`)} (${e.length})`,title:x(`chat.session.chats`),className:z(Dn,`relative md:hidden`),children:[(0,Z.jsx)(pe,{className:`h-[18px] w-[18px]`}),e.length>0&&(0,Z.jsx)(`span`,{className:`absolute -end-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-md bg-primary-500 px-1 text-[9px] font-semibold tabular-nums text-white shadow-sm`,children:e.length>99?`99+`:e.length})]})}):e.length===0?(0,Z.jsxs)(`div`,{className:`text-center py-8 px-2`,children:[(0,Z.jsx)(`div`,{className:`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] w-12 h-12`,children:(0,Z.jsx)(pe,{className:`text-gray-400 dark:text-gray-500 h-5 w-5`})}),(0,Z.jsx)(`p`,{className:`text-sm font-medium text-gray-600 dark:text-dark-600`,children:x(`chat.session.noChats`)}),(0,Z.jsx)(`p`,{className:`text-xs mt-1 text-gray-400 dark:text-dark-500`,children:x(`chat.session.createFirst`)})]}):(0,Z.jsx)(`div`,{className:`space-y-2`,children:De.map(e=>(0,Z.jsxs)(`div`,{children:[!i&&e.folder&&(0,Z.jsx)(`div`,{...ue(`folder:${e.folder.id}`,e.folder.id),className:z(`group/folder mb-0.5 flex h-[34px] items-center justify-between rounded-lg px-2 transition-colors hover:bg-interactive-hover`,ie===`folder:${e.folder.id}`&&`bg-primary-500/10 ring-1 ring-primary-500/40`),children:R===e.folder.id?(0,Z.jsx)(Bt,{value:F,onChange:e=>I(e.target.value),onKeyDown:t=>{t.key===`Enter`?G(e.folder.id):t.key===`Escape`&&(ne(null),I(``))},onBlur:()=>G(e.folder.id),className:`h-7 text-sm`,autoFocus:!0}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{onClick:()=>xe(e.folder.id),className:`flex min-w-0 flex-1 items-center gap-1.5 text-sm text-ink transition-colors`,"aria-expanded":!j.has(e.folder.id),children:[j.has(e.folder.id)?(0,Z.jsx)(he,{className:`h-3.5 w-3.5 shrink-0 text-ink-subtle rtl:rotate-180`}):(0,Z.jsx)(ke,{className:`h-3.5 w-3.5 shrink-0 text-ink-subtle`}),(0,Z.jsx)(Ye,{className:`h-4 w-4 shrink-0 text-ink-subtle`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.folder.name}),(0,Z.jsx)(`span`,{className:`text-[10px] font-medium tabular-nums text-ink-subtle`,children:e.sessions.length})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5 transition-opacity sm:opacity-0 sm:group-hover/folder:opacity-100 sm:group-focus-within/folder:opacity-100 [@media(hover:none)]:opacity-100`,children:[_&&(0,Z.jsx)(`button`,{onClick:()=>{ne(e.folder.id),I(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:x(`chat.session.renameChat`),children:(0,Z.jsx)(rt,{className:`h-3 w-3`})}),v&&(0,Z.jsx)(`button`,{onClick:()=>{window.confirm(x(`chat.session.folder.deleteConfirm`))&&v(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:x(`chat.session.folder.delete`),children:(0,Z.jsx)(ct,{className:`h-3 w-3`})})]})]})}),!i&&!e.folder&&(0,Z.jsx)(`p`,{...ue(`group:${e.key}`,null),className:z(`mb-0.5 mt-1 rounded-md px-2 text-[11px] font-medium text-ink-subtle transition-colors`,ie===`group:${e.key}`&&oe?.folderId&&`bg-primary-500/10 ring-1 ring-primary-500/40 text-primary-600 dark:text-primary-400`),children:x(`chat.session.groups.${e.labelKey}`)}),e.folder&&j.has(e.folder.id)?null:(0,Z.jsx)(`div`,{className:z(`space-y-0.5`,i&&`space-y-1`),children:e.sessions.map(e=>{let t=n===e.id,l=H?.sessionId===e.id;return(0,Z.jsx)(`div`,{draggable:!i&&!!y&&a!==e.id,onDragStart:t=>{k(),W(),re(e.id),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,e.id)},onDragEnd:se,className:z(`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`,t?`bg-interactive-active`:`hover:bg-interactive-hover`,B===e.id&&`opacity-40`),onClick:()=>{k(),c(e)},onMouseEnter:t=>A(e,t.currentTarget),onMouseLeave:k,title:i?`${e.title} - ${e.model}`:void 0,children:i?(0,Z.jsx)(`div`,{className:`flex items-center justify-center w-full h-10`,children:(0,Z.jsx)(`div`,{className:z(`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`:t?`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,Z.jsxs)(`div`,{className:`flex items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(Bt,{value:o,"aria-label":x(`chat.session.renameChat`),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,Z.jsx)(Y,{variant:`ghost`,size:`sm`,"aria-label":x(`common.save`),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,Z.jsx)(Me,{className:`h-3 w-3`})}),(0,Z.jsx)(Y,{variant:`ghost`,size:`sm`,"aria-label":x(`common.cancel`),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,Z.jsx)(K,{className:`h-3 w-3`})})]}):(0,Z.jsxs)(`div`,{className:`flex h-8 w-full items-center`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`min-w-0 flex-1 truncate rounded-md py-1 text-start text-sm leading-5 text-ink outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,title:e.title,"aria-label":e.title,"aria-current":t?`page`:void 0,children:r===e.id?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:x(`chat.session.generatingTitle`),children:[(0,Z.jsx)(zt,{}),(0,Z.jsx)(`span`,{className:`truncate`,children:te(e.title,40)})]}):te(e.title,40)}),(0,Z.jsx)(`span`,{dir:`auto`,className:z(`ms-2 shrink-0 text-xs leading-5 tabular-nums text-ink-subtle max-sm:hidden`,`sm:group-hover:hidden sm:group-focus-within:hidden`,l&&`sm:hidden`),children:ee(e.updatedAt,S.language)}),(0,Z.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:t=>{t.stopPropagation(),k(),E(e.id)},className:`h-8 w-8 shrink-0 rounded-lg p-0 touch-manipulation sm:hidden`,title:x(`palette.actions`),"aria-label":x(`palette.actions`),"data-testid":`sidebar-session-actions-mobile`,children:(0,Z.jsx)(fe,{className:`h-4 w-4`})}),(0,Z.jsx)(`div`,{className:z(`hidden shrink-0`,`sm:group-hover:block sm:group-focus-within:block`,l&&`sm:block`),children:(0,Z.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:t=>ye(e,t),className:z(`h-6 w-6 rounded-md p-0 text-ink-subtle hover:text-ink hover:bg-transparent touch-manipulation`,l&&`text-ink`),title:x(`palette.actions`),"aria-label":x(`palette.actions`),"aria-haspopup":`menu`,"aria-expanded":l,"data-testid":`sidebar-session-actions`,children:(0,Z.jsx)(fe,{className:`h-4 w-4`})})})]})},e.id)})})]},e.key))})]}),C&&(0,Z.jsx)(Ln,{preview:C}),H&&U&&(0,Q.createPortal)((0,Z.jsxs)(`div`,{className:`fixed inset-0 z-[75] hidden sm:block`,children:[(0,Z.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":x(`common.close`),className:`absolute inset-0 cursor-default`,onClick:()=>W()}),(0,Z.jsxs)(`div`,{ref:ge,onKeyDown:ve,role:`menu`,"aria-label":U.title,"data-testid":`sidebar-session-menu`,className:`absolute overflow-y-auto rounded-xl border border-black/[0.04] bg-surface-overlay p-1 shadow-lv3 animate-scale-in dark:border-white/[0.06]`,style:{top:H.top,left:H.left,width:208,maxHeight:340},children:[(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{W(),be(U)},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-[13px] text-ink hover:bg-interactive-hover`,children:[(0,Z.jsx)(dt,{className:`h-3.5 w-3.5 shrink-0`}),x(`chat.session.openNewTab`)]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:e=>{W(),l(U,e)},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-[13px] text-ink hover:bg-interactive-hover`,children:[(0,Z.jsx)(rt,{className:`h-3.5 w-3.5 shrink-0`}),x(`chat.session.renameChat`)]}),m&&(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{W(),m(U.id,!U.pinned)},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-[13px] text-ink hover:bg-interactive-hover`,children:[U.pinned?(0,Z.jsx)(qe,{className:`h-3.5 w-3.5 shrink-0`}):(0,Z.jsx)(Ie,{className:`h-3.5 w-3.5 shrink-0`}),U.pinned?x(`chat.session.unpinChat`):x(`chat.session.pinChat`)]}),!U.shared&&!U.isPrivate&&(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{W(),de(U)},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-[13px] text-ink hover:bg-interactive-hover`,"data-testid":`session-share`,children:[(0,Z.jsx)(le,{className:`h-3.5 w-3.5 shrink-0`}),x(`chat.session.shareChat`)]}),p&&(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:e=>{W(),p(U.id,e)},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-[13px] text-ink hover:bg-interactive-hover`,children:[(0,Z.jsx)(lt,{className:`h-3.5 w-3.5 shrink-0`}),x(`chat.session.archiveChat`)]}),y&&h.length>0&&(0,Z.jsxs)(`div`,{className:`mt-1 border-t border-black/[0.06] pt-1 dark:border-white/[0.07]`,children:[(0,Z.jsx)(`p`,{className:`px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em] text-gray-400 dark:text-dark-500 rtl:tracking-normal`,children:x(`chat.session.folder.move`)}),h.map(e=>(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{W(),y(U.id,e.id)},className:z(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-[13px] text-ink hover:bg-interactive-hover`,U.folderId===e.id&&`text-primary-600 dark:text-primary-400`),children:[(0,Z.jsx)(Ye,{className:`h-3.5 w-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),U.folderId&&(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{W(),y(U.id,null)},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-[13px] text-ink-muted hover:bg-interactive-hover`,children:[(0,Z.jsx)(K,{className:`h-3.5 w-3.5 shrink-0`}),x(`chat.session.folder.remove`)]})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:e=>{W(),f(U.id,e)},className:`mt-1 flex w-full items-center gap-2.5 rounded-lg border-t border-black/[0.06] px-2.5 py-2 text-start text-[13px] text-red-500 hover:bg-red-50 dark:border-white/[0.07] dark:hover:bg-red-900/20`,children:[(0,Z.jsx)(ct,{className:`h-3.5 w-3.5 shrink-0`}),x(`chat.session.deleteChat`)]})]})]}),document.body),V&&(0,Z.jsx)(Gt,{resourceType:`session`,resourceId:V.id,resourceLabel:V.title,onClose:()=>de(null)}),O&&(0,Q.createPortal)((0,Z.jsxs)(`div`,{className:`fixed inset-0 z-[80] sm:hidden`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`absolute inset-0 bg-black/35 backdrop-blur-[2px]`,onClick:()=>E(null),"aria-label":x(`common.close`)}),(0,Z.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":x(`palette.actions`),className:`absolute inset-x-3 bottom-3 rounded-2xl border border-black/[0.08] bg-surface p-2 shadow-[0_20px_70px_rgba(0,0,0,0.3)] dark:border-white/[0.09] dark:bg-dark-100`,"data-testid":`sidebar-session-actions-sheet`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2 pb-2 pt-1`,children:[(0,Z.jsx)(`p`,{className:`min-w-0 truncate text-sm font-semibold text-gray-900 dark:text-dark-900`,children:O.title}),(0,Z.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>E(null),className:`h-9 w-9 shrink-0 rounded-xl p-0`,title:x(`common.close`),"aria-label":x(`common.close`),children:(0,Z.jsx)(K,{className:`h-4 w-4`})})]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:e=>{E(null),l(O,e)},className:`flex min-h-11 w-full items-center gap-3 rounded-xl px-3 py-2 text-start text-sm text-ink hover:bg-interactive-hover`,children:[(0,Z.jsx)(rt,{className:`h-4 w-4 shrink-0`}),x(`chat.session.renameChat`)]}),m&&(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{E(null),m(O.id,!O.pinned)},className:`flex min-h-11 w-full items-center gap-3 rounded-xl px-3 py-2 text-start text-sm text-ink hover:bg-interactive-hover`,children:[O.pinned?(0,Z.jsx)(qe,{className:`h-4 w-4 shrink-0`}):(0,Z.jsx)(Ie,{className:`h-4 w-4 shrink-0`}),O.pinned?x(`chat.session.unpinChat`):x(`chat.session.pinChat`)]}),p&&(0,Z.jsxs)(`button`,{type:`button`,onClick:e=>{E(null),p(O.id,e)},className:`flex min-h-11 w-full items-center gap-3 rounded-xl px-3 py-2 text-start text-sm text-ink hover:bg-interactive-hover`,children:[(0,Z.jsx)(lt,{className:`h-4 w-4 shrink-0`}),x(`chat.session.archiveChat`)]}),y&&h.length>0&&(0,Z.jsxs)(`div`,{className:`mt-1 border-t border-black/[0.06] pt-1 dark:border-white/[0.07]`,children:[(0,Z.jsx)(`p`,{className:`px-3 py-1 text-[10px] font-semibold uppercase tracking-[0.12em] text-gray-400 dark:text-dark-500`,children:x(`chat.session.folder.move`)}),h.map(e=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{E(null),y(O.id,e.id)},className:z(`flex min-h-11 w-full items-center gap-3 rounded-xl px-3 py-2 text-start text-sm text-ink hover:bg-interactive-hover`,O.folderId===e.id&&`text-primary-600 dark:text-primary-400`),children:[(0,Z.jsx)(Ye,{className:`h-4 w-4 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),O.folderId&&(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{E(null),y(O.id,null)},className:`flex min-h-11 w-full items-center gap-3 rounded-xl px-3 py-2 text-start text-sm text-gray-500 hover:bg-gray-100 dark:text-dark-600 dark:hover:bg-dark-200`,children:[(0,Z.jsx)(K,{className:`h-4 w-4 shrink-0`}),x(`chat.session.folder.remove`)]})]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:e=>{E(null),f(O.id,e)},className:`mt-1 flex min-h-11 w-full items-center gap-3 rounded-xl border-t border-black/[0.06] px-3 py-2 text-start text-sm text-red-500 hover:bg-red-50 dark:border-white/[0.07] dark:hover:bg-red-900/20`,children:[(0,Z.jsx)(ct,{className:`h-4 w-4 shrink-0`}),x(`chat.session.deleteChat`)]})]})]}),document.body)]})}var zn=[{id:`system`,to:`/system`,icon:Te,labelKey:`user.menu.system`},{id:`usage`,to:`/usage`,icon:se,labelKey:`user.menu.usageAnalytics`},{id:`evaluations`,to:`/evaluations`,icon:Ke,labelKey:`user.menu.evaluations`}];function Bn({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,Z.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,Z.jsx)(`div`,{className:`${n} bg-gray-950 dark:bg-white rounded-full flex items-center justify-center`,title:`${e.username} (${e.role})`,children:(0,Z.jsx)(`span`,{className:`text-white dark:text-gray-950 ${r} font-medium`,children:e.username.charAt(0).toUpperCase()})})}function Vn({requiresAuth:e,user:t,isAdmin:n,pendingApprovalCount:r,sidebarCompact:i,userMenuOpen:a,userMenuRef:o,pinnedShortcuts:s,onToggleShortcutPin:c,onToggleUserMenu:l,onOpenSettings:u,onOpenAvatar:d,onLogout:f,onMobileNavigate:p,onCloseUserMenu:m}){let{t:h}=L();if(!e||!t)return null;let g=n?zn.filter(e=>s.includes(e.id)):[],_=()=>n&&zn.map(e=>{let t=s.includes(e.id),n=h(t?`user.menu.unpinShortcut`:`user.menu.pinShortcut`);return(0,Z.jsxs)(`div`,{className:`group/shortcut relative`,children:[(0,Z.jsxs)(M,{to:e.to,onClick:()=>{m(),p()},className:`flex w-full items-center gap-3 px-3 py-2.5 pe-9 text-[13px] text-ink transition-colors duration-150 hover:bg-interactive-hover`,children:[(0,Z.jsx)(e.icon,{className:`h-4 w-4 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 text-start`,children:h(e.labelKey)})]}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>c(e.id),className:z(`absolute end-2 top-1/2 -translate-y-1/2 rounded-md p-1 text-ink-subtle transition-[color,opacity] hover:text-ink focus-visible:opacity-100`,t?`opacity-100 text-primary-600 dark:text-primary-400 hover:text-primary-500`:`opacity-0 group-hover/shortcut:opacity-100`),title:n,"aria-label":`${n}: ${h(e.labelKey)}`,"aria-pressed":t,"data-testid":`sidebar-shortcut-pin-${e.id}`,children:t?(0,Z.jsx)(qe,{className:`h-3.5 w-3.5`}):(0,Z.jsx)(Ie,{className:`h-3.5 w-3.5`})})]},e.id)});return(0,Z.jsx)(`div`,{className:z(`border-t border-black/[0.04] dark:border-white/[0.06]`,`p-2`),children:i?(0,Z.jsxs)(`div`,{className:`relative flex flex-col items-center gap-1`,ref:o,children:[g.map(e=>(0,Z.jsx)(M,{to:e.to,onClick:p,className:`relative flex h-9 w-9 items-center justify-center rounded-full text-ink outline-none transition-colors hover:bg-interactive-hover focus-visible:ring-2 focus-visible:ring-primary-500/30`,title:h(e.labelKey),"aria-label":h(e.labelKey),"data-testid":`sidebar-rail-pinned-${e.id}`,children:(0,Z.jsx)(e.icon,{className:`h-[18px] w-[18px]`})},e.id)),(0,Z.jsx)(`button`,{type:`button`,onClick:u,className:`flex h-9 w-9 items-center justify-center rounded-full text-ink outline-none transition-colors hover:bg-interactive-hover focus-visible:ring-2 focus-visible:ring-primary-500/30`,title:h(`user.menu.settings`),"aria-label":h(`user.menu.settings`),"data-testid":`sidebar-rail-settings-button`,children:(0,Z.jsx)(De,{className:`h-[18px] w-[18px]`})}),(0,Z.jsxs)(`button`,{type:`button`,onClick:l,className:`relative flex h-9 w-9 items-center justify-center rounded-full outline-none transition-colors hover:bg-interactive-hover focus-visible:ring-2 focus-visible:ring-primary-500/30`,"aria-label":t.username,"aria-expanded":a,title:t.username,"data-testid":`sidebar-rail-user-menu-button`,children:[(0,Z.jsx)(Bn,{user:t,size:`sm`}),r>0&&(0,Z.jsx)(`span`,{"data-testid":`pending-user-notification-badge`,className:`absolute -end-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-md bg-error-500 px-1 text-[9px] font-semibold text-white shadow-sm`,"aria-label":h(`userManager.approval.notificationBadge`,{count:r,defaultValue:`{{count}} pending user approvals`}),children:r>99?`99+`:r})]}),a&&(0,Z.jsxs)(`div`,{"data-testid":`sidebar-user-menu`,className:`scroll-region absolute bottom-0 start-full z-[70] ms-3 w-64 max-h-[calc(100dvh-1rem)] overflow-y-auto rounded-xl border border-black/[0.04] bg-surface-overlay py-1 shadow-lv3 animate-scale-in scrollbar-thin dark:border-white/[0.06]`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{d(t.avatar||``),m()},className:`flex w-full items-center gap-2.5 border-b border-gray-100 px-3 py-2.5 text-start transition-colors hover:bg-gray-100/70 dark:border-dark-200/50 dark:hover:bg-dark-200/70`,children:[(0,Z.jsx)(Bn,{user:t,size:`md`}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:`block truncate text-sm font-medium text-gray-900 dark:text-gray-100`,children:t.username}),(0,Z.jsx)(`span`,{className:`block truncate text-xs text-gray-500 dark:text-gray-400`,children:h(`user.menu.changePicture`)})]}),(0,Z.jsx)(He,{className:`h-4 w-4 shrink-0 text-gray-400`})]}),(0,Z.jsxs)(`div`,{className:`py-1`,children:[_(),(0,Z.jsx)(`div`,{className:`my-1 border-t border-gray-100 dark:border-dark-200/50`}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{u(),m()},className:`flex w-full items-center gap-3 px-3 py-2.5 text-start text-[13px] text-ink transition-colors hover:bg-interactive-hover`,children:[(0,Z.jsx)(De,{className:`h-4 w-4 shrink-0`}),h(`user.menu.settings`)]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{f(),m()},className:`flex w-full items-center gap-3 px-3 py-2.5 text-start text-[13px] text-red-600 transition-colors hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20`,children:[(0,Z.jsx)(ve,{className:`h-4 w-4 shrink-0`}),h(`user.menu.logout`)]})]})]})]}):(0,Z.jsxs)(`div`,{className:`relative`,ref:o,children:[g.map(e=>(0,Z.jsxs)(M,{to:e.to,onClick:p,className:`flex h-[34px] w-full items-center gap-2 rounded-xl px-2.5 text-start text-sm text-ink transition-colors duration-150 hover:bg-interactive-hover touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,"data-testid":`sidebar-pinned-${e.id}`,children:[(0,Z.jsx)(e.icon,{className:`h-4 w-4 shrink-0 text-ink-muted`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:h(e.labelKey)})]},e.id)),(0,Z.jsxs)(`button`,{type:`button`,onClick:u,className:`flex h-[34px] w-full items-center gap-2 rounded-xl px-2.5 text-start text-sm text-ink transition-colors duration-150 hover:bg-interactive-hover touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,"data-testid":`sidebar-settings-button`,children:[(0,Z.jsx)(De,{className:`h-4 w-4 shrink-0 text-ink-muted`}),h(`user.menu.settings`)]}),(0,Z.jsxs)(`button`,{onClick:l,className:`relative h-[38px] w-full rounded-xl px-2.5 hover:bg-interactive-hover transition-colors duration-150 text-start touch-manipulation outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Bn,{user:t,size:`sm`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,Z.jsx)(`p`,{className:`truncate text-sm text-ink`,children:t.username}),t.role===`admin`&&(0,Z.jsx)(me,{size:11,className:`shrink-0 text-ink-subtle`})]}),(0,Z.jsx)(he,{className:z(`h-4 w-4 text-ink-subtle transition-transform duration-150 rtl:rotate-180`,a&&`rotate-90 rtl:rotate-90`)})]}),n&&r>0&&(0,Z.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":h(`userManager.approval.notificationBadge`,{count:r,defaultValue:`{{count}} pending user approvals`}),children:r>99?`99+`:r})]}),a&&(0,Z.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-xl border border-black/[0.04] bg-surface-overlay py-1 shadow-lv3 animate-scale-in scrollbar-thin dark:border-white/[0.06]`,children:[(0,Z.jsx)(`div`,{className:`px-3 py-2 border-b border-gray-100 dark:border-dark-200/50`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,Z.jsx)(Bn,{user:t,size:`md`}),(0,Z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-gray-900 dark:text-gray-100 truncate`,children:t.username}),(0,Z.jsx)(`p`,{className:`text-xs text-gray-500 dark:text-gray-400 truncate`,children:t.email||h(`user.profile.noEmail`)})]})]})}),(0,Z.jsxs)(`div`,{className:`py-1`,children:[(0,Z.jsxs)(`button`,{onClick:()=>{d(t.avatar||``),m()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-ink hover:bg-interactive-hover transition-colors duration-150 text-start`,children:[(0,Z.jsx)(He,{className:`h-4 w-4 shrink-0`}),h(`user.menu.changePicture`)]}),_(),(0,Z.jsx)(`div`,{className:`border-t border-gray-100 dark:border-dark-200/50 my-1`}),(0,Z.jsxs)(`button`,{onClick:()=>{u(),m()},className:`w-full flex items-center gap-3 px-3 py-2.5 text-[13px] text-ink hover:bg-interactive-hover transition-colors duration-150 text-start`,children:[(0,Z.jsx)(De,{className:`h-4 w-4 shrink-0`}),h(`user.menu.settings`)]}),(0,Z.jsxs)(`button`,{onClick:()=>{f(),m()},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,Z.jsx)(ve,{className:`h-4 w-4 shrink-0`}),h(`user.menu.logout`)]})]})]})]})})}var Hn=I(`notification-bell`),Un=({sidebarCompact:e})=>{let{t,i18n:n}=L(),r=T(),[i,a]=(0,X.useState)(0),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(null),u=(0,X.useRef)(null),d=(0,X.useCallback)(()=>{_t.unreadCount().then(e=>{e.success&&e.data&&a(e.data.count)}).catch(e=>Hn.debug(`Unread poll failed:`,e))},[]);(0,X.useEffect)(()=>{d();let e=window.setInterval(d,6e4),t=new AbortController;return Kt({path:`/notifications/events`,signal:t.signal,onEvent:()=>d()}),()=>{window.clearInterval(e),t.abort()}},[d]);let f=()=>{s(!0),_t.list({limit:50}).then(e=>{e.success&&e.data&&l(e.data)}).catch(e=>Hn.error(`Failed to load notifications:`,e))},p=e=>{_t.markRead(e.id).then(d),s(!1),e.href&&r(e.href)};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>o?s(!1):f(),className:z(`relative flex items-center gap-2 rounded-lg text-[13px] text-gray-600 hover:bg-black/[0.04] dark:text-dark-700 dark:hover:bg-white/[0.06]`,e?`mx-auto h-9 w-9 justify-center`:`mx-2 px-2 py-1.5`),title:t(`notifications.title`),"aria-label":t(`notifications.title`),"data-testid":`notification-bell`,children:[(0,Z.jsx)(Be,{className:`h-4 w-4 shrink-0`}),!e&&(0,Z.jsx)(`span`,{children:t(`notifications.title`)}),i>0&&(0,Z.jsx)(`span`,{className:z(`rounded-full bg-primary-500 px-1.5 text-[10px] font-semibold leading-4 text-white`,e&&`absolute -right-0.5 -top-0.5`),"data-testid":`notification-unread-badge`,children:i>99?`99+`:i})]}),o&&(0,Q.createPortal)((0,Z.jsx)(`div`,{className:`fixed inset-0 z-[2147483646]`,onClick:()=>s(!1),children:(0,Z.jsxs)(`div`,{ref:u,role:`dialog`,"aria-label":t(`notifications.title`),className:`absolute bottom-16 left-4 flex max-h-[70vh] w-80 flex-col overflow-hidden rounded-2xl border border-black/[0.08] bg-white shadow-[0_18px_60px_rgba(0,0,0,0.22)] dark:border-white/[0.1] dark:bg-dark-25`,onClick:e=>e.stopPropagation(),"data-testid":`notification-panel`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-black/[0.06] px-3 py-2 dark:border-white/[0.06]`,children:[(0,Z.jsx)(`span`,{className:`flex-1 text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-dark-600`,children:t(`notifications.title`)}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>void _t.markAllRead().then(()=>{d(),l(e=>e&&e.map(e=>({...e,readAt:e.readAt??Date.now()})))}),className:`rounded-md p-1 text-gray-400 hover:text-gray-700 dark:hover:text-dark-800`,title:t(`notifications.markAllRead`),"data-testid":`notification-mark-all`,children:(0,Z.jsx)(be,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>s(!1),className:`rounded-md p-1 text-gray-400 hover:text-gray-700 dark:hover:text-dark-800`,children:(0,Z.jsx)(K,{className:`h-3.5 w-3.5`})})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto scrollbar-thin`,children:c===null?(0,Z.jsx)(U,{className:`mx-auto my-6 h-4 w-4 animate-spin text-gray-400`}):c.length===0?(0,Z.jsx)(`p`,{className:`py-8 text-center text-xs text-gray-400 dark:text-dark-500`,children:t(`notifications.empty`)}):c.map(e=>(0,Z.jsxs)(`div`,{className:z(`group flex cursor-pointer items-start gap-2 border-b border-black/[0.04] px-3 py-2.5 last:border-b-0 hover:bg-black/[0.03] dark:border-white/[0.04] dark:hover:bg-white/[0.04]`,!e.readAt&&`bg-primary-500/[0.04]`),onClick:()=>p(e),"data-testid":`notification-item`,children:[(0,Z.jsx)(`span`,{className:z(`mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full`,e.readAt?`bg-transparent`:`bg-primary-500`)}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{className:`text-[13px] font-medium leading-snug text-gray-900 dark:text-dark-900`,children:e.title}),e.body&&(0,Z.jsx)(`p`,{className:`mt-0.5 truncate text-[12px] text-gray-500 dark:text-dark-600`,children:e.body}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-[11px] text-gray-400 dark:text-dark-500`,children:ee(e.createdAt,n.language)})]}),!e.readAt&&(0,Z.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),_t.markRead(e.id).then(()=>{d(),l(t=>t&&t.map(t=>t.id===e.id?{...t,readAt:Date.now()}:t))})},className:`hidden rounded p-1 text-gray-400 hover:text-emerald-600 group-hover:block`,title:t(`notifications.markRead`),"data-testid":`notification-mark-read`,children:(0,Z.jsx)(Me,{className:`h-3.5 w-3.5`})})]},e.id))})]})}),document.body)]})};function Wn(e,t){return e.isAgent===!0&&!t&&typeof e.lastSeenAt==`number`&&e.updatedAt>e.lastSeenAt&&(e.status===`completed`||e.status===`needs_input`||e.status===`failed`)}function Gn({preview:e}){let{t}=L(),{task:n}=e,r=qt[n.status],i=t(r.labelKey,{defaultValue:r.label});return(0,Z.jsxs)(Mn,{top:e.top,left:e.left,title:n.title||t(`work.tasks.untitled`,{defaultValue:`Untitled task`}),timestamp:n.updatedAt,children:[(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[11px] leading-snug text-gray-600 dark:text-dark-700`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:z(`h-2 w-2 shrink-0 rounded-full`,r.animated&&`animate-pulse`),style:{backgroundColor:r.color}}),i]}),n.statusBlurb&&(0,Z.jsx)(`p`,{dir:`auto`,className:`mt-1.5 line-clamp-2 text-[11px] leading-snug text-gray-600 dark:text-dark-700`,children:n.statusBlurb}),(0,Z.jsx)(`p`,{className:`mt-1.5 truncate font-mono text-[10px] text-gray-400 dark:text-dark-500`,children:n.model}),n.hostPath&&(0,Z.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-gray-400 dark:text-dark-500`,title:n.hostPath,children:n.hostPath})]})}var Kn=208,qn=180;function Jn({tasks:e,personas:t,currentTaskId:n,loading:r,actionLoading:i,sidebarCompact:a,onSelectTask:o,onDeleteTask:s,onExpandSidebar:c}){let{t:l,i18n:u}=L(),d=e.filter(e=>e.isAgent===!0),f=e.filter(e=>e.isAgent!==!0),p=d,[m,h]=(0,X.useState)(null),g=(0,X.useRef)(null),[_,v]=(0,X.useState)(null),y=_?e.find(e=>e.id===_)??null:null;(0,X.useEffect)(()=>()=>{g.current!==null&&window.clearTimeout(g.current)},[]);let b=()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null),h(null)},x=(e,t)=>{let n=window.matchMedia(`(hover: hover) and (pointer: fine)`).matches;a||window.innerWidth<768||!n||(g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{let n=t.getBoundingClientRect();h({task:e,top:n.top,left:n.right+10})},500))},[S,C]=(0,X.useState)(null),w=S?e.find(e=>e.id===S.taskId)??null:null,{menuRef:T,setTrigger:E,onKeyDown:D,closeMenu:O}=Pn(S?.taskId,()=>C(null)),k=(e,t)=>{if(t.stopPropagation(),b(),S?.taskId===e.id){O();return}E(t.currentTarget);let n=t.currentTarget.getBoundingClientRect();C({taskId:e.id,top:Math.max(8,Math.min(n.bottom+6,window.innerHeight-qn-8)),left:Math.max(8,Math.min(n.right-Kn,window.innerWidth-Kn-8))})},A=e=>{let t=window.location.protocol===`file:`?`${window.location.pathname}#/work/${e.id}`:`/work/${e.id}`;window.open(t,`_blank`,`noopener,noreferrer`)},j=e=>e.title||l(`work.tasks.untitled`,{defaultValue:`Untitled task`}),M=e=>{let r=n===e.id,i=qt[e.status],a=l(i.labelKey,{defaultValue:i.label}),s=S?.taskId===e.id,c=e.isAgent===!0,d=c&&e.personaId?t[e.personaId]:void 0,f=Wn(e,r),p=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{dir:`auto`,className:z(`ms-2 shrink-0 text-xs leading-5 tabular-nums text-ink-subtle max-sm:hidden`,`sm:group-hover:hidden sm:group-focus-within:hidden`,s&&`sm:hidden`),children:ee(e.updatedAt,u.language)}),(0,Z.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:t=>{t.stopPropagation(),b(),v(e.id)},className:`h-8 w-8 shrink-0 rounded-lg p-0 touch-manipulation sm:hidden`,title:l(`palette.actions`),"aria-label":l(`palette.actions`),"data-testid":`sidebar-work-task-actions-mobile`,children:(0,Z.jsx)(fe,{className:`h-4 w-4`})}),(0,Z.jsx)(`div`,{className:z(`hidden shrink-0`,`sm:group-hover:block sm:group-focus-within:block`,s&&`sm:block`),children:(0,Z.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:t=>k(e,t),className:z(`h-6 w-6 rounded-md p-0 text-ink-subtle hover:text-ink hover:bg-transparent touch-manipulation`,s&&`text-ink`),title:l(`palette.actions`),"aria-label":l(`palette.actions`),"aria-haspopup":`menu`,"aria-expanded":s,"data-testid":`sidebar-work-task-actions`,children:(0,Z.jsx)(fe,{className:`h-4 w-4`})})})]});return(0,Z.jsx)(`div`,{"data-testid":`sidebar-work-task-item`,"data-task-id":e.id,"data-agent":c?`true`:void 0,"aria-current":r?`page`:void 0,className:z(`group relative cursor-pointer rounded-lg px-2 transition-colors duration-150 outline-none touch-manipulation`,r?`bg-interactive-active`:`hover:bg-interactive-hover`),onClick:()=>{b(),o(e.id)},onMouseEnter:t=>x(e,t.currentTarget),onMouseLeave:b,children:c?(0,Z.jsxs)(`div`,{className:`flex w-full items-center gap-2.5 py-1.5`,children:[(0,Z.jsxs)(`span`,{className:`relative shrink-0`,children:[(0,Z.jsx)(`img`,{src:d?Ct(d,64):wt(j(e),64),alt:``,"aria-hidden":`true`,"data-testid":`sidebar-work-agent-avatar`,onError:t=>St(t.currentTarget,d?.name??j(e),64),className:`h-8 w-8 rounded-lg object-cover`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`sidebar-work-task-status`,"data-status-label":a,className:z(`absolute -bottom-0.5 -end-0.5 h-2.5 w-2.5 rounded-full border-2 border-gray-100 dark:border-dark-50`,i.animated&&`animate-pulse`,e.status===`idle`&&`ring-1 ring-black/20 dark:ring-white/20`),style:{backgroundColor:i.color}})]}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center`,children:[(0,Z.jsxs)(`button`,{type:`button`,dir:`auto`,className:z(`min-w-0 flex-1 truncate rounded-md text-start text-sm leading-5 text-ink outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,f&&`font-medium`),title:j(e),"aria-current":r?`page`:void 0,children:[j(e),(0,Z.jsx)(`span`,{className:`sr-only`,children:l(`work.tasks.status`,{defaultValue:`Status: {{status}}`,status:a})})]}),f&&(0,Z.jsx)(`span`,{"data-testid":`sidebar-work-agent-unread`,"aria-label":l(`work.agent.unread`,{defaultValue:`New activity`}),className:`ms-2 h-2 w-2 shrink-0 rounded-full bg-primary-500 shadow-[0_0_8px_rgb(var(--color-primary-500)/0.6)]`}),p]}),(0,Z.jsx)(`p`,{dir:`auto`,"data-testid":`sidebar-work-agent-blurb`,className:z(`truncate text-[11px] leading-4`,f?`text-ink-muted`:`text-ink-subtle`),title:e.statusBlurb||a,children:e.statusBlurb||a})]})]}):(0,Z.jsxs)(`div`,{className:`flex h-8 w-full items-center`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`sidebar-work-task-status`,"data-status-label":a,className:z(`me-2 h-2 w-2 shrink-0 rounded-full`,i.animated&&`animate-pulse`,e.status===`idle`&&`ring-1 ring-black/20 dark:ring-white/20`),style:{backgroundColor:i.color}}),(0,Z.jsxs)(`button`,{type:`button`,dir:`auto`,className:`min-w-0 flex-1 truncate rounded-md py-1 text-start text-sm leading-5 text-ink outline-none focus-visible:ring-2 focus-visible:ring-primary-500/30`,title:j(e),"aria-current":r?`page`:void 0,children:[j(e),(0,Z.jsx)(`span`,{className:`sr-only`,children:l(`work.tasks.status`,{defaultValue:`Status: {{status}}`,status:a})})]}),p]})},e.id)};return(0,Z.jsxs)(Nn,{"data-testid":`sidebar-work-task-scroll-region`,compact:a,compactClassName:p.length===0?`md:hidden`:void 0,children:[(0,Z.jsxs)(`div`,{className:a?`p-0`:`px-3 py-3`,children:[!a&&e.length>0&&(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between px-1`,children:[(0,Z.jsx)(`h3`,{className:`text-xs font-medium text-ink-subtle`,children:d.length>0?l(`work.agents.title`,{defaultValue:`Agents`}):l(`work.tasks.title`,{defaultValue:`Work tasks`})}),(0,Z.jsx)(`span`,{className:`text-[10px] font-medium tabular-nums text-gray-400 dark:text-dark-500`,children:d.length>0?d.length:e.length})]}),a?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-[4px]`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:c,"data-testid":`sidebar-mobile-work-tasks`,"aria-label":`${l(`work.tasks.title`,{defaultValue:`Work tasks`})} (${e.length})`,title:l(`work.tasks.title`,{defaultValue:`Work tasks`}),className:z(Dn,`relative md:hidden`),children:[(0,Z.jsx)(nt,{className:`h-[18px] w-[18px]`}),e.length>0&&(0,Z.jsx)(`span`,{className:`absolute -end-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-md bg-primary-500 px-1 text-[9px] font-semibold tabular-nums text-white shadow-sm`,children:e.length>99?`99+`:e.length})]}),(0,Z.jsx)(`div`,{"data-testid":`sidebar-compact-work-agent-list`,className:`flex w-full flex-col items-center gap-[4px] empty:hidden`,children:p.map(e=>{let r=n===e.id,i=qt[e.status],a=l(i.labelKey,{defaultValue:i.label}),s=j(e),c=e.personaId?t[e.personaId]:void 0,u=Wn(e,r),d=[s,l(`work.tasks.status`,{defaultValue:`Status: {{status}}`,status:a}),u?l(`work.agent.unread`,{defaultValue:`New activity`}):null].filter(Boolean).join(`. `);return(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>o(e.id),"data-testid":`sidebar-compact-work-agent`,"data-task-id":e.id,"data-agent":`true`,"aria-current":r?`page`:void 0,"aria-label":d,title:d,className:z(Dn,`relative`,r?`bg-primary-500/10 text-primary-700 ring-1 ring-primary-500/10 dark:bg-primary-500/15 dark:text-primary-300 dark:ring-primary-400/10`:void 0),children:[r&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -start-2 h-5 w-0.5 rounded-full bg-primary-500 shadow-[0_0_12px_rgb(var(--color-primary-500)/0.55)]`}),(0,Z.jsx)(`img`,{src:c?Ct(c,64):wt(s,64),alt:``,"aria-hidden":`true`,"data-testid":`sidebar-compact-work-agent-avatar`,onError:e=>St(e.currentTarget,c?.name??s,64),className:`h-9 w-9 rounded-lg object-cover`}),u&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`sidebar-compact-work-agent-unread`,className:`absolute end-1.5 top-1.5 h-2 w-2 rounded-full bg-primary-500 ring-2 ring-gray-100 dark:ring-dark-50`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`sidebar-compact-work-agent-status`,"data-status":e.status,className:z(`absolute bottom-1.5 end-1.5 h-2 w-2 rounded-full border-2 border-gray-100 dark:border-dark-50`,i.animated&&`animate-pulse`,e.status===`idle`&&`ring-1 ring-black/20 dark:ring-white/20`),style:{backgroundColor:i.color}})]},e.id)})})]}):r&&e.length===0?(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex items-center justify-center py-10 text-gray-400 dark:text-dark-500`,children:[(0,Z.jsx)(U,{"aria-hidden":`true`,className:`h-5 w-5 animate-spin`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:l(`work.tasks.loading`,{defaultValue:`Loading Work tasks`})})]}):e.length===0?(0,Z.jsxs)(`div`,{className:`py-8 text-center px-2`,children:[(0,Z.jsx)(`div`,{className:`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] h-12 w-12`,children:(0,Z.jsx)(nt,{className:`text-gray-400 dark:text-gray-500 h-5 w-5`})}),(0,Z.jsx)(`p`,{className:`text-sm font-medium text-gray-600 dark:text-dark-600`,children:l(`work.tasks.emptyTitle`,{defaultValue:`No Work tasks yet`})}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-gray-400 dark:text-dark-500`,children:l(`work.tasks.empty`,{defaultValue:`Your Work tasks will appear here after you send the first message.`})})]}):(0,Z.jsx)(`div`,{"data-testid":`sidebar-work-task-list`,className:`space-y-0.5`,children:d.length>0?(0,Z.jsxs)(Z.Fragment,{children:[d.map(M),f.length>0&&(0,Z.jsxs)(`div`,{className:`mb-1 mt-4 flex items-center justify-between px-1`,children:[(0,Z.jsx)(`h3`,{className:`text-xs font-medium text-ink-subtle`,children:l(`work.tasks.title`,{defaultValue:`Work tasks`})}),(0,Z.jsx)(`span`,{className:`text-[10px] font-medium tabular-nums text-gray-400 dark:text-dark-500`,children:f.length})]}),f.map(M)]}):e.map(M)})]}),m&&(0,Z.jsx)(Gn,{preview:m}),S&&w&&(0,Q.createPortal)((0,Z.jsxs)(`div`,{className:`fixed inset-0 z-[75] hidden sm:block`,children:[(0,Z.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":l(`common.close`),className:`absolute inset-0 cursor-default`,onClick:()=>O()}),(0,Z.jsxs)(`div`,{ref:T,onKeyDown:D,role:`menu`,"aria-label":j(w),"data-testid":`sidebar-work-task-menu`,className:`absolute overflow-y-auto rounded-xl border border-black/[0.04] bg-surface-overlay p-1 shadow-lv3 animate-scale-in dark:border-white/[0.06]`,style:{top:S.top,left:S.left,width:Kn,maxHeight:qn},children:[(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{O(),A(w)},className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-[13px] text-ink hover:bg-interactive-hover`,children:[(0,Z.jsx)(dt,{className:`h-3.5 w-3.5 shrink-0`}),l(`chat.session.openNewTab`)]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:i,"data-testid":`sidebar-work-task-delete`,onClick:()=>{O(),s(w)},className:`mt-1 flex w-full items-center gap-2.5 rounded-lg border-t border-black/[0.06] px-2.5 py-2 text-start text-[13px] text-red-500 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-40 dark:border-white/[0.07] dark:hover:bg-red-900/20`,children:[(0,Z.jsx)(ct,{className:`h-3.5 w-3.5 shrink-0`}),l(`work.tasks.delete`,{defaultValue:`Delete task`})]})]})]}),document.body),y&&(0,Q.createPortal)((0,Z.jsxs)(`div`,{className:`fixed inset-0 z-[80] sm:hidden`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`absolute inset-0 bg-black/35 backdrop-blur-[2px]`,onClick:()=>v(null),"aria-label":l(`common.close`)}),(0,Z.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":l(`palette.actions`),className:`absolute inset-x-3 bottom-3 rounded-2xl border border-black/[0.08] bg-surface p-2 shadow-[0_20px_70px_rgba(0,0,0,0.3)] dark:border-white/[0.09] dark:bg-dark-100`,"data-testid":`sidebar-work-task-actions-sheet`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2 pb-2 pt-1`,children:[(0,Z.jsx)(`p`,{className:`min-w-0 truncate text-sm font-semibold text-gray-900 dark:text-dark-900`,children:j(y)}),(0,Z.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>v(null),className:`h-9 w-9 shrink-0 rounded-xl p-0`,title:l(`common.close`),"aria-label":l(`common.close`),children:(0,Z.jsx)(K,{className:`h-4 w-4`})})]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{v(null),A(y)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-3 text-start text-sm text-ink hover:bg-interactive-hover`,children:[(0,Z.jsx)(dt,{className:`h-4 w-4 shrink-0`}),l(`chat.session.openNewTab`)]}),(0,Z.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{v(null),s(y)},className:`flex w-full items-center gap-3 rounded-xl px-3 py-3 text-start text-sm text-red-500 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-40 dark:hover:bg-red-900/20`,children:[(0,Z.jsx)(ct,{className:`h-4 w-4 shrink-0`}),l(`work.tasks.delete`,{defaultValue:`Delete task`})]})]})]}),document.body)]})}function Yn(e){let{t}=L(),n=(0,X.useRef)(null),r=v({queryKey:[`users`,`pending-approvals`],enabled:e,queryFn:async()=>{let e=await Dt.getPendingApprovals();if(!e.success||!e.data)throw Error(e.message||`Could not load pending accounts`);return e.data},refetchInterval:6e4,refetchOnWindowFocus:!0});return(0,X.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&&G(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}}function Xn(e){let{t}=L(),n=(0,X.useRef)(null),r=v({queryKey:[`automations`,`runs-summary`],enabled:e,queryFn:async()=>{let e=await vt.getRunsSummary();if(!e.success||!e.data)throw Error(e.error||`Could not load automation runs`);return e.data},refetchInterval:6e4,refetchOnWindowFocus:!0});return(0,X.useEffect)(()=>{if(!r.data)return;let e=n.current,i=r.data.unseenCount;e!==null&&i>e&&G(t(`automations.finishedNotification`,{n:i}),{icon:`⚡`}),n.current=i},[r.data,t]),{...r,unseenRunCount:r.data?.unseenCount??0}}var Zn=I(`components:sidebar`),Qn=X.lazy(()=>F(()=>import(`../js/SettingsModal-WAdVG4-g.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,19,20,21,22,23,24,25,26,27,28,29]))),$n=({isOpen:e,onClose:t,className:n})=>{let{t:r}=L(),i=N(),a=T(),{sessions:o,deleteSession:s,updateSessionTitle:c,setSessionArchived:l,setSessionPinned:u,folders:d,loadFolders:f,createFolder:p,renameFolder:m,deleteFolder:h,moveSessionToFolder:g,selectedModel:_,models:v,currentSession:y,generatingTitleForSession:b,personas:x}=ae(),S=Ot(e=>e.tasks),C=Ot(e=>e.loadingTasks),w=Ot(e=>e.actionLoading),E=Ot(e=>e.deleteTask),{user:D,isAdmin:O,systemInfo:k,setUser:A,canUseWork:j,canUseAgents:M}=q(),{theme:P,sidebarCompact:F,toggleSidebarCompact:I,isGenerating:ee,pinnedAdminShortcuts:te,toggleAdminShortcut:R}=J(),ne=b??(ee&&y&&Jt(y.title)?y.id:null),B=O(),{pendingApprovalCount:re}=Yn(!!(D&&B&&k?.requiresAuth)),{unseenRunCount:ie}=Xn(!!(D||k?.requiresAuth===!1)),[oe,se]=(0,X.useState)(null),[ce,le]=(0,X.useState)(``),[ue,V]=(0,X.useState)(!1),[de,fe]=(0,X.useState)(!1),[pe,H]=(0,X.useState)(!1),[me,U]=(0,X.useState)(``),[he,ge]=(0,X.useState)(!1),_e=(0,X.useRef)(null),ve=(0,X.useRef)(null),W=i.pathname.match(/^\/c\/([^/]+)$/)?.[1]||y?.id,ye=()=>{window.innerWidth<768&&!F&&I()},be=()=>{Rt(`selection`),I()},xe=()=>{let{setCurrentSession:e}=ae.getState();Lt(),e(null),sessionStorage.setItem(`forceWelcomeScreen`,`true`)};(0,X.useEffect)(()=>{let e=e=>{_e.current&&!_e.current.contains(e.target)&&fe(!1)};if(de)return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[de]),(0,X.useEffect)(()=>{let t=t=>{ve.current&&!ve.current.contains(t.target)&&window.innerWidth<768&&e&&!F&&I()};if(e&&!F&&window.innerWidth<768)return document.addEventListener(`mousedown`,t),()=>document.removeEventListener(`mousedown`,t)},[e,F,I]);let Se=async()=>{ge(!0);try{let e=await Dt.updateMyAvatar(me||null);e.success&&e.data?(A(e.data),G.success(r(`user.avatar.updated`)),H(!1)):G.error(e.message||r(`user.avatar.updateFailed`))}catch(e){Zn.error(`Failed to update avatar:`,e),G.error(r(`user.avatar.updateFailed`))}finally{ge(!1)}},Ce=()=>{Rt(`impact`),xe(),a(`/chat`,{replace:!0}),ye()},we=()=>{Rt(`impact`),Ot.getState().clearError(),a(`/work`),ye()},Te=e=>{Rt(`selection`),a(`/c/${e.id}`,{replace:!0}),ye()},Ee=e=>{Rt(`selection`),a(`/work/${e}`,{replace:!0}),ye()},De=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`})}))){Rt(`warning`);try{await E(e.id),At(e.id),xn.getState().closeTab(`work:${e.id}`),ze===e.id&&a(`/work`,{replace:!0,state:{deletedWorkTaskId:e.id}})}catch(e){Zn.error(`Failed to delete Work task:`,e),G.error(r(`work.toasts.deleteFailed`,{defaultValue:`Could not delete this Work task.`}))}}},Oe=async(e,t)=>{if(t.stopPropagation(),Zn.debug(`Delete session clicked:`,e),window.confirm(r(`chat.session.deleteConfirm`))){Rt(`warning`);try{Zn.debug(`Attempting to delete session:`,e);let t=W===e;if(await s(e),Zn.debug(`Session deleted successfully`),xn.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){Zn.error(`Error deleting session:`,e)}}};(0,X.useEffect)(()=>{f()},[f]);let ke=async(e,t)=>{if(t.stopPropagation(),await l(e,!0),xn.getState().closeTab(`chat:${e}`),W===e){let t=o.filter(t=>t.id!==e&&!t.archived);t.length>0?a(`/c/${t[0].id}`,{replace:!0}):a(`/`,{replace:!0})}},Ae=(e,t)=>{u(e,t)},je=(e,t)=>{t.stopPropagation(),se(e.id),le(e.title)},Me=async e=>{ce.trim()&&await c(e,ce.trim()),se(null),le(``)},Ne=()=>{se(null),le(``)},Pe=async()=>{try{await yt.logout();let{logout:e}=q.getState();e(),a(`/login`),G.success(r(`auth.logout.success`))}catch(e){Zn.error(`Logout error:`,e);let{logout:t}=q.getState();t(),a(`/login`)}},Fe=()=>{V(!0),ye()},Ie=e=>{U(e),H(!0)},Le=window.location.protocol===`file:`,Re=i.pathname===`/work`||i.pathname.startsWith(`/work/`),ze=i.pathname.match(/^\/work\/([^/]+)$/)?.[1]||null,Be=i.pathname===`/`||i.pathname===`/chat`||i.pathname.startsWith(`/c/`),Ve=j();return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{ref:ve,"data-testid":`sidebar`,"data-app-sidebar":``,className:z(`fixed inset-y-0 start-0 z-50 border-0 [box-shadow:none] transform transition-[width,transform,background-color] duration-200 ease-out motion-reduce:transition-none`,F?`w-16`:`w-72 max-sm:w-[calc(100vw-4.5rem)] max-sm:max-w-80`,e?`translate-x-0`:`ltr:-translate-x-full rtl:translate-x-full`,P.mode===`celestial`?`bg-sidebar/30 backdrop-blur-xl md:bg-transparent md:backdrop-filter-none`:`bg-sidebar`,`overscroll-behavior-contain`,n),style:{WebkitOverflowScrolling:`touch`},children:[Le&&(0,Z.jsx)(`div`,{className:`absolute top-0 start-16 end-0 h-8 z-[60]`,style:{WebkitAppRegion:`drag`}}),(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,Z.jsxs)(`div`,{"data-testid":`sidebar-browse-scroll-region`,className:z(`min-h-0 flex-1 [&>*]:transition-none`,F?`scroll-region flex flex-col gap-[4px] pb-[8px] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden [&>*]:w-16`:`flex flex-col overflow-hidden [&>*]:w-72 max-sm:[&>*]:w-[calc(100vw-4.5rem)] max-sm:[&>*]:max-w-80`),children:[(0,Z.jsx)(kn,{sidebarCompact:F,isElectron:Le,showWork:Ve,activeMode:Re?`work`:Be?`chat`:null,selectedModel:_,modelCount:v.length,onToggleCompact:be,onStartWork:we,onCreateSession:Ce}),(0,Z.jsx)(jn,{sidebarCompact:F,activePath:i.pathname,showAgents:M(),unseenRunCount:ie,onMobileNavigate:ye}),Re&&Ve?(0,Z.jsx)(Jn,{tasks:S,personas:x,currentTaskId:ze,loading:C,actionLoading:w,sidebarCompact:F,onSelectTask:Ee,onDeleteTask:e=>void De(e),onExpandSidebar:be}):(0,Z.jsx)(Rn,{sessions:o.filter(e=>!e.archived),personas:x,currentSessionId:W,generatingTitleForSession:ne,sidebarCompact:F,editingSessionId:oe,editingTitle:ce,onEditingTitleChange:le,onSelectSession:Te,onStartEditing:je,onSaveEdit:Me,onCancelEdit:Ne,onDeleteSession:Oe,onArchiveSession:ke,onTogglePinSession:Ae,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),onExpandSidebar:be}),F&&(0,Z.jsx)(On,{})]}),(0,Z.jsxs)(`div`,{className:z(`shrink-0 transition-none`,F&&`w-16`),children:[(0,Z.jsx)(Un,{sidebarCompact:F}),(0,Z.jsx)(Vn,{requiresAuth:k?.requiresAuth,user:D,isAdmin:B,pendingApprovalCount:re,sidebarCompact:F,userMenuOpen:de,userMenuRef:_e,pinnedShortcuts:te,onToggleShortcutPin:R,onToggleUserMenu:()=>fe(e=>!e),onOpenSettings:Fe,onOpenAvatar:Ie,onLogout:Pe,onMobileNavigate:ye,onCloseUserMenu:()=>fe(!1)})]})]})]}),ue&&(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(Qn,{isOpen:ue,onClose:()=>V(!1)})}),(0,Z.jsx)(Sn,{open:pe,value:me,saving:he,onChange:U,onClose:()=>H(!1),onSave:Se})]})},$=({children:e,requireAuth:t=!0,requireAdmin:n=!1,requireWork:r=!1,requireAgents:i=!1})=>{let{isAuthenticated:a,user:o,systemInfo:s,isLoading:c,canUseWork:l}=q();return N(),c?(0,Z.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-50 dark:bg-dark-50`,children:(0,Z.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`})}):i&&s?.agentsEnabled!==!0?(0,Z.jsx)(C,{to:`/`,replace:!0}):s&&!s.requiresAuth?(0,Z.jsx)(Z.Fragment,{children:e}):t&&!a?(0,Z.jsx)(C,{to:`/login`,replace:!0}):n&&(!o||o.role!==`admin`)||r&&!l()?(0,Z.jsx)(C,{to:`/`,replace:!0}):(0,Z.jsx)(Z.Fragment,{children:e})},er=I(`components:error-boundary`),tr=({error:e})=>{let{t}=L();return(0,Z.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,Z.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,Z.jsxs)(`div`,{className:`p-6 text-center`,children:[(0,Z.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,Z.jsx)(We,{className:`h-6 w-6`})}),(0,Z.jsx)(`h1`,{className:`mb-2 text-xl font-semibold text-gray-950 dark:text-dark-950`,children:t(`errorBoundary.title`)}),(0,Z.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-gray-600 dark:text-dark-600`,children:t(`errorBoundary.description`)}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:justify-center`,children:[(0,Z.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,Z.jsx)(je,{className:`h-4 w-4`}),t(`errorBoundary.tryAgain`)]}),(0,Z.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,Z.jsx)(et,{className:`h-4 w-4`}),t(`common.home`,`Home`)]})]}),!1]})})})},nr=()=>{let e=k();(0,X.useEffect)(()=>{er.error(`Route error screen caught an error:`,e)},[e]);let t=e instanceof Error?e:E(e)?Error(`${e.status} ${e.statusText}`):Error(String(e));return(0,Z.jsx)(tr,{error:t})},rr=class extends X.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){er.error(`ErrorBoundary caught an error:`,e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,Z.jsx)(tr,{error:this.state.error}):this.props.children}},ir=`libre-webui:whats-new-seen`;function ar(){let e={version:`0.36.0`,date:`2026-09-18`,body:`Notifications reach your inbox by email, routines fire on events and carry
|
|
3
|
-
their payload, MCP servers connect through OAuth, channel mentions use tools,
|
|
4
|
-
and Work keeps what every run produced, shows who is on each task, recovers in
|
|
5
|
-
the open, and stops idle sandboxes on its own.
|
|
6
|
-
|
|
7
|
-
### ✨ New Features
|
|
8
|
-
|
|
9
|
-
- **Email notifications.** Administrators configure one outgoing SMTP server
|
|
10
|
-
under **Settings > User Management > Access & policies** (host, port,
|
|
11
|
-
STARTTLS or TLS, credentials, sender, application URL, with a **Send test**
|
|
12
|
-
button); the \`SMTP_*\` environment variables seed the same fields and a
|
|
13
|
-
value saved in the UI wins. Each user then chooses what reaches their inbox
|
|
14
|
-
under **Settings > Notifications**: channel mentions, and the result of
|
|
15
|
-
their automation runs, success or failure, with the reply itself. Messages
|
|
16
|
-
use the website's look, render the run's Markdown, and leave through a
|
|
17
|
-
built-in SMTP client with bounded retries; the password is stored
|
|
18
|
-
encrypted and never returned to the browser.
|
|
19
|
-
- **Routines that run on events.** An automation can now use an **On an
|
|
20
|
-
event** trigger: a channel mention, a direct message, a share, a calendar
|
|
21
|
-
reminder, a finished or waiting agent run, and every other notification
|
|
22
|
-
kind, with an optional title filter and a one-minute cooldown. Inbound
|
|
23
|
-
webhook calls forward their JSON body into the run as a trigger payload.
|
|
24
|
-
- **Interactive OAuth for MCP servers.** A tool server can be registered
|
|
25
|
-
with **Interactive OAuth**: Libre WebUI discovers the authorization server
|
|
26
|
-
from the 401 challenge, registers a client where the provider allows it,
|
|
27
|
-
signs each user in with PKCE, keeps their tokens encrypted, refreshes them
|
|
28
|
-
before they expire, and asks to reconnect when a call is refused. The
|
|
29
|
-
server card gains Connect, Reconnect and Disconnect.
|
|
30
|
-
- **Tools in channel mentions.** An @model reply in a channel now runs the
|
|
31
|
-
mentioning member's tool catalog like a chat turn: read-only tools run,
|
|
32
|
-
tools that change things are declined unless a standing approval exists,
|
|
33
|
-
and the reply shows which tools it used.
|
|
34
|
-
- **Skills that demand approval.** A skill can declare tools that always
|
|
35
|
-
pause for the user while it is loaded, even when approvals are otherwise
|
|
36
|
-
off, and no saved "Always allow" rule can wave them through. Taught Work
|
|
37
|
-
Computer skills set this automatically when a demonstration contained
|
|
38
|
-
redacted input.
|
|
39
|
-
- **DeepSeek provider.** DeepSeek ships as a bundled chat provider with model
|
|
40
|
-
discovery, the thinking toggle, and reasoning replayed beside tool calls as
|
|
41
|
-
the API requires.
|
|
42
|
-
- **Work run history.** Every run keeps its summary, the files it changed and
|
|
43
|
-
how it ended. The Runs list on the Agent tab and the Activity tab shows
|
|
44
|
-
past runs, file chips survive a reload, automation emails carry the
|
|
45
|
-
summary, and the administrator's overview shows each task's last run.
|
|
46
|
-
|
|
47
|
-
### 🔧 Improvements
|
|
48
|
-
|
|
49
|
-
- **Who is using a task.** Commands, previews, terminals and screens register
|
|
50
|
-
themselves outside process memory, so the idle and preview sweeps respect
|
|
51
|
-
holds from any replica and **System > Work** shows who is on each task.
|
|
52
|
-
- **Idle-stop by default.** Previews and screens nobody touches stop after
|
|
53
|
-
thirty minutes; the panes say so, a policy can set its own value, and
|
|
54
|
-
\`WORK_RUNTIME_IDLE_TIMEOUT_MS=0\` keeps the old behavior. A finished task is
|
|
55
|
-
not given a preview or a screen by accident: the panes offer **Reopen task
|
|
56
|
-
and start preview** or **Reopen task and open the screen**.
|
|
57
|
-
- **Recovery in the open.** While Work is cleaning up sandboxes it now says
|
|
58
|
-
how many, since when, and when it retries next; administrators see each
|
|
59
|
-
pending container with its reason, attempt count and last error under
|
|
60
|
-
**System > Work**, and can retry immediately.
|
|
61
|
-
- **Stale previews reconcile themselves.** A preview whose container or
|
|
62
|
-
process is gone is marked stopped within a minute instead of blocking
|
|
63
|
-
backups, recovery snapshots and host updaters that wait for an idle
|
|
64
|
-
platform.
|
|
65
|
-
- **Dependencies refreshed.** Mermaid 12 (pinned to the classic dagre layout
|
|
66
|
-
so diagrams keep their look, with the unused ELK engine left out of the
|
|
67
|
-
artifact bundle), Vite 8.3, KaTeX, plotly, three, lucide-react, the AWS S3
|
|
68
|
-
client, TypeScript ESLint, and a set of minor and patch bumps; lodash-es
|
|
69
|
-
moves to 4.18 to clear two advisories.
|
|
70
|
-
|
|
71
|
-
### 🐛 Bug Fixes
|
|
72
|
-
|
|
73
|
-
- A successful automation run now emails its owner; only failures did before.
|
|
74
|
-
- Client-side identifiers are minted with Web Crypto.
|
|
75
|
-
- The Vite dev configuration imports its proxy with an extension, so the
|
|
76
|
-
build and dev server start without a warning.
|
|
77
|
-
|
|
78
|
-
### 📚 Documentation
|
|
79
|
-
|
|
80
|
-
- Environment variables gain the \`SMTP_*\` section; Notifications describes
|
|
81
|
-
email delivery and the branded messages; Automations covers event
|
|
82
|
-
triggers and payloads; Chat tools documents interactive MCP OAuth and the
|
|
83
|
-
channel mention rules; Skills documents approval demands; Workspaces
|
|
84
|
-
documents run history, task usage, idle-stop defaults, reopening finished
|
|
85
|
-
tasks, and recovery; Provider connections and the quick start list
|
|
86
|
-
DeepSeek. The capability inventories are regenerated.
|
|
87
|
-
|
|
88
|
-
### ⚠️ Upgrade note
|
|
89
|
-
|
|
90
|
-
This release adds database columns (SQLite schema v30, PostgreSQL v29).
|
|
91
|
-
Existing rows keep their meaning; the first start after the update runs the
|
|
92
|
-
migration and takes a little longer than usual.`},[t,n]=(0,X.useState)(()=>{if(!e||typeof window>`u`)return!1;try{return window.localStorage.getItem(ir)!==e.version}catch{return!1}});return(0,X.useEffect)(()=>{let e=()=>n(!0);return window.addEventListener(`libre:open-whats-new`,e),()=>window.removeEventListener(`libre:open-whats-new`,e)},[]),{open:t,dismiss:()=>{if(n(!1),e)try{window.localStorage.setItem(ir,e.version)}catch{}},notes:e}}var or=({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,X.useState)(!1),{t:a}=L();return r?null:(0,Z.jsx)(`div`,{className:z(`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,Z.jsxs)(`div`,{className:`flex items-center justify-between max-w-6xl mx-auto gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,Z.jsx)(`div`,{className:`flex-shrink-0`,children:(0,Z.jsx)(Oe,{className:`h-4 w-4 text-white/65 dark:text-gray-950/60`})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Z.jsx)(`p`,{className:`shrink-0 text-xs font-semibold tracking-wide`,children:a(`demoMode.title`)}),(0,Z.jsx)(`p`,{className:`hidden truncate text-xs text-white/60 dark:text-gray-950/60 sm:block`,children:e})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 ml-4`,children:[(0,Z.jsxs)(Y,{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,Z.jsx)(dt,{className:`h-4 w-4`}),(0,Z.jsx)(`span`,{className:`ml-1 hidden sm:inline`,children:a(`demoMode.github`)})]}),(0,Z.jsx)(Y,{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,Z.jsx)(K,{className:`h-4 w-4`})})]})]})})},sr=110,cr=48,lr=5e3,ur=()=>{let e=7,t=()=>(e=(e*9301+49297)%233280,e/233280);return Array.from({length:sr},(e,n)=>({id:n,x:t()*100,y:t()*78,size:1.2+t()*2.2,delay:t()*7,period:2.5+t()*4.5,bright:t()>.82}))},dr=[{id:`a`,top:16,left:-14,width:46,height:20,depth:22,drift:120,delay:0},{id:`b`,top:30,left:38,width:40,height:16,depth:16,drift:150,delay:-50},{id:`c`,top:9,left:66,width:32,height:14,depth:28,drift:95,delay:-70},{id:`d`,top:46,left:8,width:30,height:12,depth:12,drift:170,delay:-20},{id:`e`,top:22,left:84,width:26,height:12,depth:34,drift:80,delay:-110}],fr=()=>{let e=21,t=()=>(e=(e*9301+49297)%233280,e/233280);return Array.from({length:cr},(e,n)=>({id:n,x:t()*100,size:2+t()*4,delay:-t()*14,period:9+t()*9,sway:10+t()*30}))},pr=()=>{let e=It(e=>e.palette),t=It(e=>e.scene),n=It(e=>e.previewMinutes),r=J(e=>e.isGenerating),i=(0,X.useRef)(null),a=(0,X.useMemo)(()=>ur(),[]),o=(0,X.useMemo)(()=>fr(),[]),[s,c]=(0,X.useState)([]),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(()=>typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches),[p,m]=(0,X.useState)(()=>typeof document>`u`||document.visibilityState===`visible`),h=e!==null&&t!==null,g=e?.night??0,_=h&&!d&&p,v=g>0;(0,X.useEffect)(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>f(e.matches),n=()=>m(document.visibilityState===`visible`);return e.addEventListener(`change`,t),document.addEventListener(`visibilitychange`,n),()=>{e.removeEventListener(`change`,t),document.removeEventListener(`visibilitychange`,n)}},[]),(0,X.useEffect)(()=>{if(!_||typeof window>`u`)return;let e=i.current;if(!e)return;let t=document.documentElement,n=0,r=0,a=0,o=0,s=50,c=50,l,u,d=()=>{n=0,e.style.setProperty(`--sky-px`,r.toFixed(3)),e.style.setProperty(`--sky-py`,a.toFixed(3)),e.style.setProperty(`--sky-scroll`,o.toFixed(2)),v&&(t.style.setProperty(`--lamp-x`,`${s.toFixed(2)}%`),t.style.setProperty(`--lamp-y`,`${c.toFixed(2)}%`))},f=()=>{n||=window.requestAnimationFrame(d)},p=e=>{let{innerWidth:t,innerHeight:n}=window;r=(e.clientX/t-.5)*2,a=(e.clientY/n-.5)*2,s=e.clientX/t*100,c=e.clientY/n*100,f()},m=e=>{let t=e.target;t&&typeof t.scrollTop==`number`&&(o=Math.max(-1,Math.min(1,t.scrollTop%2400/2400)),f())},h=()=>{t.removeAttribute(`data-composing`)},g=e=>{v&&(t.style.setProperty(`--lamp-pulse`,`1`),l&&clearTimeout(l),l=setTimeout(()=>t.style.setProperty(`--lamp-pulse`,`0`),320));let n=e.target;n&&n.tagName===`TEXTAREA`&&(t.setAttribute(`data-composing`,`true`),u&&clearTimeout(u),u=setTimeout(h,lr))},y=e=>{let t=e.target;t&&t.tagName===`TEXTAREA`&&h()};return window.addEventListener(`pointermove`,p,{passive:!0}),window.addEventListener(`keydown`,g,{passive:!0}),window.addEventListener(`scroll`,m,{passive:!0,capture:!0}),document.addEventListener(`focusout`,y),()=>{window.removeEventListener(`pointermove`,p),window.removeEventListener(`keydown`,g),window.removeEventListener(`scroll`,m,{capture:!0}),document.removeEventListener(`focusout`,y),n&&window.cancelAnimationFrame(n),l&&clearTimeout(l),u&&clearTimeout(u),h();for(let t of[`--sky-px`,`--sky-py`,`--sky-scroll`])e.style.removeProperty(t);for(let e of[`--lamp-x`,`--lamp-y`,`--lamp-pulse`])t.style.removeProperty(e)}},[_,v]);let y=_&&g>=.4;(0,X.useEffect)(()=>{if(!y)return;let e,t=new Set,n=0,i=()=>{let a={id:n+=1,x:10+Math.random()*70,y:4+Math.random()*36,angle:20+Math.random()*30,length:120+Math.random()*140};c(e=>[...e.slice(-2),a]);let o=setTimeout(()=>{t.delete(o),c(e=>e.filter(e=>e.id!==a.id))},1600);t.add(o),e=setTimeout(i,(r?6e3:2e4)+Math.random()*3e4)};return e=setTimeout(i,4e3+Math.random()*8e3),()=>{e&&clearTimeout(e),t.forEach(clearTimeout),c([])}},[y,r]);let b=t?.thunder??!1;if((0,X.useEffect)(()=>{if(!_||!b)return;let e,t,n=()=>{u(!0),t=setTimeout(()=>u(!1),180+Math.random()*160),e=setTimeout(n,9e3+Math.random()*25e3)};return e=setTimeout(n,3e3+Math.random()*6e3),()=>{e&&clearTimeout(e),t&&clearTimeout(t),u(!1)}},[_,b]),!e||!t)return null;let x=t.moon.phase,S=(x<.5?1-x*2:-(x*2-1))*92,C=t.sun.visible?t.sun.warmth:0;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{ref:i,"data-testid":`celestial-sky`,"data-night":g>.5?`true`:`false`,"data-preview":n===null?`false`:`true`,"data-generating":r?`true`:`false`,"data-motion":_?`active`:`paused`,"data-weather":t.weatherKind,"data-flash":_&&l?`true`:`false`,"aria-hidden":`true`,className:`celestial-sky pointer-events-none fixed inset-0 z-0`,style:{"--wind":t.wind},children:(0,Z.jsxs)(`div`,{className:`celestial-sky__layers absolute inset-0 overflow-hidden`,children:[(0,Z.jsx)(`div`,{className:`celestial-sky__gradient`}),(0,Z.jsx)(`div`,{className:`celestial-sky__stars`,style:{opacity:t.stars},"data-testid":`celestial-stars`,children:a.map(e=>(0,Z.jsx)(`span`,{className:e.bright?`celestial-sky__star celestial-sky__star--bright`:`celestial-sky__star`,style:{left:`${e.x}%`,top:`${e.y}%`,width:e.size,height:e.size,animationDelay:`${e.delay}s`,animationDuration:`${e.period}s`}},e.id))}),y&&s.map(e=>(0,Z.jsx)(`span`,{className:`celestial-sky__meteor`,style:{left:`${e.x}%`,top:`${e.y}%`,width:e.length,transform:`rotate(${e.angle}deg)`}},e.id)),(0,Z.jsx)(`div`,{className:`celestial-sky__aurora`}),(0,Z.jsx)(`div`,{className:`celestial-sky__sun`,"data-testid":`celestial-sun`,style:{opacity:t.sun.visible?t.sun.dim:0,"--body-x":t.sun.x,"--body-y":t.sun.y,"--sun-warmth":t.sun.warmth}}),(0,Z.jsx)(`div`,{className:`celestial-sky__moon`,"data-testid":`celestial-moon`,style:{opacity:t.moon.visible?t.moon.dim:0,"--body-x":t.moon.x,"--body-y":t.moon.y},children:(0,Z.jsx)(`span`,{className:`celestial-sky__moon-shadow`,style:{transform:`translateX(${S}%)`}})}),dr.map(e=>(0,Z.jsx)(`div`,{className:`celestial-sky__cloud`,style:{top:`${e.top}%`,left:`${e.left}%`,width:`${e.width}vw`,height:`${e.height}vh`,background:t.cloudTint,opacity:t.cloudOpacity,animationDuration:`${e.drift/t.wind}s`,animationDelay:`${e.delay}s`,"--cloud-depth":`${e.depth}px`}},e.id)),(0,Z.jsx)(`div`,{className:`celestial-sky__horizon-glow`,style:{"--body-x":t.sun.x,opacity:C,background:`radial-gradient(60vw 34vh at 50% 100%, ${e.sky.horizon} 0%, transparent 70%)`}}),(0,Z.jsx)(`div`,{className:`celestial-sky__haze`,style:{opacity:Math.min(1,.3+t.haze*.45)}}),t.fog>0&&(0,Z.jsx)(`div`,{className:`celestial-sky__fog`,style:{opacity:t.fog}}),t.rain>0&&(0,Z.jsx)(`div`,{className:`celestial-sky__rain`,"data-testid":`celestial-rain`,style:{opacity:.25+t.rain*.5}}),t.snow>0&&(0,Z.jsx)(`div`,{className:`celestial-sky__snow`,"data-testid":`celestial-snow`,style:{opacity:t.snow},children:o.map(e=>(0,Z.jsx)(`span`,{className:`celestial-sky__flake`,style:{left:`${e.x}%`,width:e.size,height:e.size,animationDelay:`${e.delay}s`,animationDuration:`${e.period/t.wind}s`,"--sway":`${e.sway}px`}},e.id))}),(0,Z.jsx)(`div`,{className:`celestial-sky__flash`}),(0,Z.jsx)(`div`,{className:`celestial-sky__grain`})]})}),(0,Z.jsx)(`div`,{className:`celestial-sky__lamp`,"data-motion":_?`active`:`paused`,"aria-hidden":`true`})]})};function mr(){let{t:e}=L(),t=N(),n=J(e=>e.theme.mode===`celestial`),r=It(e=>e.palette),i=It(e=>e.previewMinutes),a=(0,X.useRef)(null),o=(0,X.useRef)(null),s=(0,X.useRef)(!1),c=(0,X.useId)(),l=(0,X.useId)(),[u,d]=(0,X.useState)(null),f=u!==null,p=n&&r!==null,m=(0,X.useCallback)((e=!1)=>{s.current&&(s.current=!1,d(null),Nt(null),e&&a.current?.focus())},[]);if((0,X.useEffect)(()=>{m()},[p,t.key,m]),(0,X.useEffect)(()=>()=>{s.current&&Nt(null)},[]),(0,X.useEffect)(()=>{if(!f)return;let e=e=>e instanceof Node&&(a.current?.contains(e)||o.current?.contains(e)),t=t=>{e(t.target)||m()},n=e=>{let t=e.target;e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),m(!0)):(e.ctrlKey||e.metaKey)&&e.key===`,`&&!e.shiftKey&&!e.altKey&&t.tagName!==`INPUT`&&t.tagName!==`TEXTAREA`&&t.contentEditable!==`true`&&!t.isContentEditable&&m()},r=()=>m(),i=requestAnimationFrame(()=>{o.current?.querySelector(`input[type="range"]`)?.focus()});return document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`focusin`,t),document.addEventListener(`keydown`,n,!0),window.addEventListener(`resize`,r),()=>{cancelAnimationFrame(i),document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`focusin`,t),document.removeEventListener(`keydown`,n,!0),window.removeEventListener(`resize`,r)}},[f,m]),!p||!r)return null;let h=Mt(r.solar.minutes),g=e(`settings.appearance.celestial.title`),_=e(i===null?`settings.appearance.celestial.live`:`settings.appearance.celestial.preview`),v=r.solar.isDay?de:Ne;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{ref:a,type:`button`,className:`celestial-clock-trigger`,"data-testid":`celestial-clock-trigger`,"aria-label":`${g}: ${h}`,"aria-describedby":l,title:`${g}: ${h} · ${_}`,"aria-haspopup":`dialog`,"aria-expanded":f,"aria-controls":c,onClick:()=>{if(f){m();return}let e=a.current?.getBoundingClientRect();if(!e)return;let t=Math.min(336,Math.max(0,window.innerWidth-24)),n=document.documentElement.dir===`rtl`?e.left:e.right-t,r=Math.max(8,Math.min(n,window.innerWidth-t-8)),i=Math.min(e.bottom+8,window.innerHeight-8);s.current=!0,d({top:i,left:r,width:t,maxHeight:Math.max(0,window.innerHeight-i-8)})},children:(0,Z.jsxs)(`span`,{dir:`ltr`,"data-testid":`celestial-clock-time`,className:`inline-flex items-center gap-1.5`,children:[(0,Z.jsx)(v,{className:`h-4 w-4`,strokeWidth:1.75,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`hidden tabular-nums sm:inline`,children:h})]})}),(0,Z.jsx)(`span`,{id:l,className:`sr-only`,children:_}),u&&(0,Q.createPortal)((0,Z.jsxs)(`div`,{ref:o,id:c,role:`dialog`,"aria-label":g,className:`celestial-day-popover`,"data-testid":`celestial-day-popover`,"data-scroll-fade":``,style:{position:`fixed`,overflowY:`auto`,...u},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":e(`common.close`),title:e(`common.close`),onClick:()=>m(!0),className:`absolute end-2 top-2 flex h-8 w-8 items-center justify-center rounded-full text-ink-muted hover:bg-interactive-hover hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/40`,children:(0,Z.jsx)(K,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,Z.jsx)(Yt,{})]}),document.body)]})}var hr={"/notes":{icon:Ze,labelKey:`sidebar.navigation.notes`},"/calendar":{icon:at,labelKey:`sidebar.navigation.calendar`},"/automations":{icon:it,labelKey:`sidebar.navigation.automations`},"/channels":{icon:we,labelKey:`sidebar.navigation.channels`},"/personas":{icon:Le,labelKey:`sidebar.navigation.personas`},"/gallery":{icon:_e,labelKey:`sidebar.navigation.imagine`},"/agents":{icon:Re,labelKey:`sidebar.navigation.agents`},"/usage":{icon:se,labelKey:`usageAnalytics.title`},"/system":{icon:Te,labelKey:`systemPage.title`},"/artifacts":{icon:$e,labelKey:`tabs.artifacts`}},gr=e=>e.kind===`home`?et:e.kind===`chat`?pe:e.kind===`work`?nt:hr[e.path]?.icon??$e,_r=()=>R()?`⌘`:`Ctrl`,vr=new Set([`/agents`,`/usage`,`/system`]),yr=(e,t)=>e.kind===`work`?!t:vr.has(e.path),br=()=>{let{t:e,i18n:t}=L(),n=N(),r=T(),i=xn(e=>e.tabs),a=xn(e=>e.activeTabId),o=xn(e=>e.syncWithPath),s=xn(e=>e.closeTab),c=xn(e=>e.closeTabs),l=ae(e=>e.sessions),u=ae(e=>e.currentSession),d=Ot(e=>e.tasks),{systemInfo:f,isAdmin:p,canUseWork:m,canUseAgents:h}=q(),[g,_]=(0,X.useState)(!1),[v,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(null),S=(0,X.useRef)(null),C=(0,X.useRef)(null),w=(0,X.useRef)(null),E=(0,X.useRef)(null),D=(0,X.useRef)(null),O=p(),k=f?.requiresAuth===!1||O,A=m(),j=k?i:i.filter(e=>!yr(e,A));(0,X.useEffect)(()=>{o(n.pathname)},[n.pathname,o]),(0,X.useLayoutEffect)(()=>{let e=D.current;if(!e)return;let t=null,n=()=>{t=null;let n=Math.max(0,e.scrollWidth-e.clientWidth),r=getComputedStyle(e).direction===`rtl`?n+e.scrollLeft:e.scrollLeft,i=n-r;e.style.setProperty(`--tab-fade-left`,`${r<=1?0:Math.min(24,r)}px`),e.style.setProperty(`--tab-fade-right`,`${i<=1?0:Math.min(24,i)}px`)},r=()=>{t===null&&(t=requestAnimationFrame(n))};n(),e.addEventListener(`scroll`,r,{passive:!0});let i=new ResizeObserver(r);i.observe(e);for(let t of e.children)i.observe(t);return()=>{e.removeEventListener(`scroll`,r),i.disconnect(),t!==null&&cancelAnimationFrame(t)}},[j.length,t.resolvedLanguage,i]),(0,X.useEffect)(()=>{(D.current?.querySelector(`[data-active="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},[j.length,a]),(0,X.useEffect)(()=>{if(!f||k)return;let e=i.filter(e=>yr(e,A)).map(e=>e.id);if(e.length===0)return;let t=c(e,`home`);t&&r(t.path,{replace:!0})},[c,r,k,A,f,i]),(0,X.useEffect)(()=>{if(!g&&!b)return;let e=e=>{let t=e.target;!S.current?.contains(t)&&!C.current?.contains(t)&&!E.current?.contains(t)&&(_(!1),x(null))},t=e=>{e.key===`Escape`&&(_(!1),x(null))};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[b,g]),(0,X.useEffect)(()=>{if(!g)return;let e=()=>{let e=w.current;if(!e)return;let t=e.getBoundingClientRect(),n=e.closest(`[data-testid="app-shell-content"]`)?.getBoundingClientRect(),r=n?.left??0,i=n?.right??window.innerWidth,a=r+8,o=i-8,s=Math.max(0,Math.min(224,o-a)),c=o-t.left>=s?t.left:t.right-s,l=Math.max(a,Math.min(c,o-s));y({left:l,top:t.bottom+4,width:s})};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[g]),(0,X.useEffect)(()=>{b&&E.current?.querySelector(`[role="menuitem"]:not(:disabled)`)?.focus()},[b]);let M=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 l.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=hr[t.path];return n?e(n.labelKey,t.path.slice(1)):t.path.slice(1)},P=(e,t)=>{e.stopPropagation(),e.preventDefault();let n=s(t.id);n&&r(n.path)},F=(e,t,n)=>{_(!1),x({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))})},I=(e,t)=>{e.preventDefault(),e.stopPropagation(),F(t,e.clientX,e.clientY)},ee=(e,t)=>{if(e.key!==`ContextMenu`&&!(e.shiftKey&&e.key===`F10`))return;e.preventDefault();let n=e.currentTarget.getBoundingClientRect();F(t,n.left+12,n.bottom+4)},te=e=>{let t=Array.from(E.current?.querySelectorAll(`[role="menuitem"]:not(:disabled)`)??[]);if(t.length===0)return;let n=t.indexOf(document.activeElement),r;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()},R=(e,t)=>{let n=c(e,t);x(null),n&&r(n.path)},ne=[{key:`chat`,label:e(`tabs.newChat`,`New Chat`),icon:pe,shortcut:`${_r()}⇧O`,action:()=>tn(r)},{key:`incognito-chat`,label:e(`chat.session.incognito`,`Incognito Chat`),icon:Qe,action:()=>rn(r)},...A?[{key:`work`,label:e(`tabs.newWork`,`New Work`),icon:nt,shortcut:`${_r()}⇧U`,action:()=>nn(r)}]:[],...[`/channels`,`/notes`,`/calendar`,`/automations`,`/personas`,`/gallery`].map(t=>({key:t,label:e(hr[t].labelKey,t.slice(1)),icon:hr[t].icon,action:()=>r(t)})),...h()?[{key:`/agents`,label:e(hr[`/agents`].labelKey,`Agents`),icon:hr[`/agents`].icon,separatorBefore:!0,action:()=>r(`/agents`)}]:[],...O?[`/system`,`/usage`].map(t=>({key:t,label:e(hr[t].labelKey,t.slice(1)),icon:hr[t].icon,action:()=>r(t)})):[]],B=b?j.find(e=>e.id===b.tabId):void 0,re=B?j.findIndex(e=>e.id===B.id):-1,ie=B?j.filter(e=>e.id!==`home`&&e.id!==B.id).map(e=>e.id):[],oe=re>=0?j.slice(re+1).filter(e=>e.id!==`home`).map(e=>e.id):[],se=j.filter(e=>e.id!==`home`).map(e=>e.id);return(0,Z.jsxs)(`div`,{"data-testid":`app-tab-bar`,"data-app-tabbar":``,className:`relative z-20 flex h-9 flex-none items-center gap-1 px-1 pb-1 lg:px-0`,children:[(0,Z.jsx)(`div`,{ref:D,role:`tablist`,"aria-label":e(`tabs.label`,`Open tabs`),className:`tab-scroll-fade flex min-w-0 items-center gap-1 overflow-x-auto p-0.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:j.map(t=>{let n=t.id===`chat:new`&&u?.isPrivate?Qe:gr(t),i=t.id===a;return(0,Z.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":i,"data-active":i||void 0,"data-tab-id":t.id,"data-testid":`app-tab`,title:M(t),onClick:()=>r(t.path),onContextMenu:e=>I(e,t),onKeyDown:e=>ee(e,t),onAuxClick:e=>{e.button===1&&t.id!==`home`&&P(e,t)},className:z(`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`,i?`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,Z.jsx)(n,{className:`h-3.5 w-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`max-w-[9rem] truncate`,children:M(t)}),t.id!==`home`&&(0,Z.jsx)(`span`,{role:`button`,tabIndex:-1,"aria-label":e(`tabs.close`,`Close tab`),"data-testid":`app-tab-close`,onClick:e=>P(e,t),className:z(`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`,i?`opacity-100`:`sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-visible:opacity-100`),children:(0,Z.jsx)(K,{className:`h-3 w-3`})})]},t.id)})}),b&&B&&(0,Q.createPortal)((0,Z.jsxs)(`div`,{ref:E,role:`menu`,"aria-label":e(`tabs.actions`,`Tab actions`),"data-testid":`app-tab-context-menu`,onContextMenu:e=>e.preventDefault(),onKeyDown:te,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:b.x,top:b.y},children:[(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`app-tab-context-close`,disabled:B.id===`home`,onClick:()=>{let e=s(B.id);x(null),e&&r(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,Z.jsx)(K,{className:`h-4 w-4 shrink-0`}),(0,Z.jsx)(`span`,{children:e(`tabs.close`,`Close tab`)})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`app-tab-context-close-others`,disabled:ie.length===0,onClick:()=>R(ie,B.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,Z.jsx)(Je,{className:`h-4 w-4 shrink-0`}),(0,Z.jsx)(`span`,{children:e(`tabs.closeOthers`,`Close other tabs`)})]}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`app-tab-context-close-right`,disabled:oe.length===0,onClick:()=>R(oe,B.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,Z.jsx)(st,{className:`h-4 w-4 shrink-0`}),(0,Z.jsx)(`span`,{children:e(`tabs.closeRight`,`Close tabs to the right`)})]}),(0,Z.jsx)(`div`,{className:`mx-2 my-1 h-px bg-line`,role:`separator`}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`app-tab-context-close-all`,disabled:se.length===0,onClick:()=>R(se,`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,Z.jsx)(ge,{className:`h-4 w-4 shrink-0`}),(0,Z.jsx)(`span`,{children:e(`tabs.closeAll`,`Close all tabs`)})]})]}),document.body),(0,Z.jsxs)(`div`,{className:`relative flex-none`,ref:S,children:[(0,Z.jsx)(`button`,{ref:w,type:`button`,"aria-label":e(`tabs.new`,`New tab`),"aria-expanded":g,"data-testid":`app-tab-new`,onClick:()=>_(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,Z.jsx)(Ue,{className:`h-4 w-4`})}),g&&v&&(0,Q.createPortal)((0,Z.jsx)(`div`,{ref:C,role:`menu`,"data-testid":`app-tab-new-menu`,className:`fixed z-[100] max-h-[calc(100dvh-4rem)] overflow-y-auto rounded-xl border border-line bg-surface-overlay/95 p-1 shadow-overlay backdrop-blur-xl animate-fade-in motion-reduce:animate-none`,style:v,children:ne.map(e=>(0,Z.jsxs)(X.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(`div`,{className:`mx-2 my-1 h-px bg-line`,role:`separator`}),(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{_(!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,Z.jsx)(e.icon,{className:`h-4 w-4 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-start`,children:e.label}),e.shortcut&&(0,Z.jsx)(`span`,{className:`font-mono text-[10px] tracking-wide text-ink-subtle`,children:e.shortcut})]})]},e.key))}),document.body)]}),(0,Z.jsx)(mr,{})]})},xr=24;function Sr(e,t){let n=e.toLowerCase(),r=t.toLowerCase();if(!n)return{score:0,ranges:[]};let i=r.indexOf(n);if(i!==-1)return{score:100+(i===0||/[\s\-_/.]/.test(r[i-1])?40:0)-Math.min(i,20)-Math.min(r.length-n.length,10)/10,ranges:[[i,i+n.length]]};let a=[],o=0,s=0;for(let e=0;e<n.length;e++){let t=r.indexOf(n[e],s);if(t===-1)return null;let i=a.length>0&&t===s,c=t===0||/[\s\-_/.]/.test(r[t-1]);o+=2+(i?4:0)+(c?6:0),i||(o-=Math.min(t-s,6)/2);let l=a[a.length-1];l&&l[1]===t?l[1]=t+1:a.push([t,t+1]),s=t+1}return{score:o,ranges:a}}function Cr({text:e,ranges:t}){if(t.length===0)return(0,Z.jsx)(Z.Fragment,{children:e});let n=[],r=0;return t.forEach(([t,i],a)=>{t>r&&n.push(e.slice(r,t)),n.push((0,Z.jsx)(`span`,{className:`font-semibold text-ink`,children:e.slice(t,i)},a)),r=i}),r<e.length&&n.push(e.slice(r)),(0,Z.jsx)(Z.Fragment,{children:n})}var wr=({onOpenSettings:e,onOpenSettingsTab:t})=>{let{t:n,i18n:r}=L(),i=T(),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(0),d=(0,X.useRef)(null),f=(0,X.useRef)(null),p=ae(e=>e.sessions),m=Ot(e=>e.tasks),h=J(e=>e.toggleTheme),{canUseWork:g,canUseAgents:_}=q(),v=g(),y=_(),b=R()?`⌘`:`Ctrl`;(0,X.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),c(``),u(0),o(e=>!e))},t=()=>{c(``),u(0),o(!0)};return document.addEventListener(`keydown`,e,!0),window.addEventListener(`libre:open-palette`,t),()=>{document.removeEventListener(`keydown`,e,!0),window.removeEventListener(`libre:open-palette`,t)}},[]);let x=(0,X.useCallback)(()=>o(!1),[]);Vt(d,{onClose:x,enabled:a});let[S,C]=(0,X.useState)(null);S!==null&&(!a||s.trim().length<3)&&C(null),(0,X.useEffect)(()=>{let e=s.trim();if(!a||e.length<3)return;let t=!1,n=window.setTimeout(()=>{xt.searchApp(e).then(e=>{!t&&e.success&&e.data&&C(e.data)}).catch(()=>{})},300);return()=>{t=!0,window.clearTimeout(n)}},[s,a]);let w=(0,X.useMemo)(()=>{let a=n(`palette.actions`,`Actions`),o=[{id:`action:new-chat`,section:a,label:n(`tabs.newChat`,`New Chat`),icon:pe,hint:`${b}⇧O`,keywords:`new chat conversation start`,run:()=>tn(i)},{id:`action:incognito-chat`,section:a,label:n(`chat.session.incognito`,`Incognito Chat`),icon:Qe,keywords:`incognito private temporary ghost`,run:()=>rn(i)},...v?[{id:`action:new-work`,section:a,label:n(`tabs.newWork`,`New Work`),icon:nt,hint:`${b}⇧U`,keywords:`new work task workspace`,run:()=>nn(i)}]:[],{id:`action:home`,section:a,label:n(`tabs.home`,`Home`),icon:et,run:()=>i(`/`)},{id:`action:models`,section:a,label:n(`sidebar.navigation.models`,`Models`),icon:ye,keywords:`models ollama providers llm`,run:()=>t(`model-manager`)},{id:`action:personas`,section:a,label:n(`sidebar.navigation.personas`,`Personas`),icon:Le,run:()=>i(`/personas`)},{id:`action:gallery`,section:a,label:n(`sidebar.navigation.imagine`,`Imagine`),icon:_e,keywords:`imagine images generation gallery pictures`,run:()=>i(`/gallery`)},{id:`action:calendar`,section:a,label:n(`sidebar.navigation.calendar`,`Calendar`),icon:at,keywords:`calendar events schedule agenda`,run:()=>i(`/calendar`)},{id:`action:channels`,section:a,label:n(`sidebar.navigation.channels`,`Channels`),icon:we,keywords:`channels team messages dm direct chat rooms`,run:()=>i(`/channels`)},{id:`action:automations`,section:a,label:n(`sidebar.navigation.automations`,`Automations`),icon:it,keywords:`automations schedule cron recurring routines`,run:()=>i(`/automations`)},{id:`action:prompts`,section:a,label:n(`sidebar.navigation.prompts`,`Prompts`),icon:Xe,keywords:`prompts templates slash snippets library`,run:()=>t(`prompts`)},{id:`action:skills`,section:a,label:n(`sidebar.navigation.skills`,`Skills`),icon:ce,keywords:`skills instructions playbooks load_skill`,run:()=>t(`skills`)},{id:`action:tools`,section:a,label:n(`sidebar.navigation.tools`,`Tools`),icon:tt,keywords:`tools servers mcp openapi integrations approvals`,run:()=>t(`tools`)},...y?[{id:`action:agents`,section:a,label:n(`sidebar.navigation.agents`,`Agents`),icon:Re,run:()=>i(`/agents`)}]:[],{id:`action:settings`,section:a,label:n(`palette.settings`,`Settings`),icon:De,hint:`${b},`,keywords:`settings preferences configuration options`,run:e},{id:`action:theme`,section:a,label:n(`palette.toggleTheme`,`Toggle theme`),icon:Ne,hint:`${b}D`,keywords:`theme dark light mode appearance`,run:h}],s=[...p].sort((e,t)=>t.updatedAt-e.updatedAt).map(e=>({id:`session:${e.id}`,section:n(`palette.chats`,`Chats`),label:e.title||n(`tabs.chat`,`Chat`),icon:pe,hint:ee(e.updatedAt,r.language),keywords:e.model,run:()=>i(`/c/${e.id}`)})),c=v?[...m].sort((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).map(e=>({id:`work:${e.id}`,section:n(`palette.work`,`Work`),label:e.title||n(`work.tasks.untitled`,`Untitled task`),icon:nt,hint:e.status,run:()=>i(`/work/${e.id}`)})):[];return[...o,...s,...c]},[n,b,i,e,t,h,p,m,v,y,r.language]),E=(0,X.useMemo)(()=>{let e=s.trim();if(!e){let e=w.filter(e=>e.id.startsWith(`action:`)),t=w.filter(e=>e.id.startsWith(`session:`)).slice(0,6),n=w.filter(e=>e.id.startsWith(`work:`)).slice(0,4);return[...e,...t,...n].map(e=>({item:e,ranges:[]}))}let r=w.flatMap(t=>{let n=Sr(e,t.label);if(n)return[{item:t,...n}];let r=t.keywords?Sr(e,t.keywords):null;return r?[{item:t,score:r.score-30,ranges:[]}]:[]}),a=new Map;r.forEach(({item:e,score:t})=>{let n=a.get(e.section);(n===void 0||t>n)&&a.set(e.section,t)});let o=r.sort((e,t)=>(a.get(t.item.section)??0)-(a.get(e.item.section)??0)||e.item.section.localeCompare(t.item.section)||t.score-e.score).slice(0,xr).map(({item:e,ranges:t})=>({item:e,ranges:t}));if(!S)return o;let c=new Set(o.filter(e=>e.item.id.startsWith(`session:`)).map(e=>e.item.id.slice(8))),l=[...S.sessions.filter(e=>!c.has(e.sessionId)).map(e=>({id:`deep-session:${e.sessionId}:${e.messageId}`,section:n(`palette.messages`,`Messages`),label:e.title||n(`tabs.chat`,`Chat`),icon:pe,hint:e.snippet,run:()=>i(`/c/${e.sessionId}`)})),...S.notes.map(e=>({id:`deep-note:${e.noteId}`,section:n(`palette.notes`,`Notes`),label:e.title||n(`notes.untitled`,`Untitled`),icon:Ze,hint:e.snippet,run:()=>i(`/notes?note=${encodeURIComponent(e.noteId)}`)})),...S.documents.map(e=>({id:`deep-document:${e.documentId}`,section:n(`palette.documents`,`Documents`),label:e.filename,icon:Ge,hint:e.snippet,run:()=>t(`documents`)}))];return[...o,...l.map(e=>({item:e,ranges:[]}))]},[w,s,S,n,i,t]);(0,X.useEffect)(()=>{(f.current?.querySelector(`[data-selected="true"]`))?.scrollIntoView({block:`nearest`})},[l,E.length]);let D=e=>{e&&(x(),e.run())};return a?(0,Q.createPortal)((0,Z.jsx)(`div`,{"data-testid":`command-palette`,className:`fixed inset-0 z-[2147483647] flex items-center justify-center bg-black/25 px-4 backdrop-blur-[2px] dark:bg-black/45`,onMouseDown:e=>{e.target===e.currentTarget&&x()},children:(0,Z.jsxs)(`div`,{ref:d,role:`dialog`,"aria-modal":`true`,"aria-label":n(`palette.search`,`Search`),tabIndex:-1,className:`flex h-[min(34rem,76vh)] w-full max-w-2xl flex-col 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,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2.5 border-b border-line px-4`,children:[(0,Z.jsx)(H,{className:`h-4 w-4 shrink-0 text-ink-subtle`}),(0,Z.jsx)(`input`,{"data-testid":`command-palette-input`,"aria-label":n(`palette.placeholder`,`Search chats, Work, actions…`),value:s,onChange:e=>{c(e.target.value),u(0)},onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`ArrowDown`?(e.preventDefault(),u(e=>Math.min(E.length-1,e+1))):e.key===`ArrowUp`?(e.preventDefault(),u(e=>Math.max(0,e-1))):e.key===`Enter`&&(e.preventDefault(),D(E[l]?.item)))},placeholder:n(`palette.placeholder`,`Search chats, Work, actions…`),className:`h-[3.25rem] w-full bg-transparent text-[15px] text-ink outline-none placeholder:text-ink-subtle`}),(0,Z.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,Z.jsxs)(`div`,{ref:f,className:`min-h-0 flex-1 overflow-y-auto p-2 scrollbar-thin`,children:[E.length===0&&(0,Z.jsx)(`p`,{className:`px-3 py-6 text-center text-sm text-ink-subtle`,children:n(`palette.empty`,`No matches.`)}),E.map(({item:e,ranges:t},n)=>{let r=n===0||e.section!==E[n-1].item.section;return(0,Z.jsxs)(X.Fragment,{children:[r&&(0,Z.jsx)(`p`,{className:`px-2.5 pb-1 pt-2.5 text-[10px] font-medium uppercase tracking-[0.08em] text-ink-subtle first:pt-1`,children:e.section}),(0,Z.jsxs)(`button`,{type:`button`,"data-selected":n===l||void 0,onMouseEnter:()=>u(n),onClick:()=>D(e),className:z(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-start text-sm transition-colors`,n===l?`bg-black/[0.05] text-ink dark:bg-white/[0.07]`:`text-ink-muted`),children:[(0,Z.jsx)(e.icon,{className:`h-4 w-4 shrink-0 text-ink-subtle`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,Z.jsx)(Cr,{text:e.label,ranges:t})}),e.hint&&(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-ink-subtle`,children:e.hint})]})]},e.id)})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-t border-line px-4 py-2 text-[10px] text-ink-subtle`,children:[(0,Z.jsx)(`span`,{className:`inline-flex items-center gap-1`,children:(0,Z.jsx)(`kbd`,{className:`rounded-md border border-line px-1.5 py-0.5 font-mono`,children:`↑↓`})}),(0,Z.jsx)(`span`,{className:`inline-flex items-center gap-1`,children:(0,Z.jsx)(`kbd`,{className:`rounded-md border border-line px-1.5 py-0.5 font-mono`,children:`↵`})}),(0,Z.jsx)(`span`,{className:`ms-auto inline-flex items-center gap-1`,children:(0,Z.jsx)(`kbd`,{className:`rounded-md border border-line px-1.5 py-0.5 font-mono`,children:`esc`})})]})]})}),document.body):null},Tr=I(`user-service`),Er=class{static async initializeAuth(){let{setLoading:e,setSystemInfo:t,login:n}=q.getState();try{e(!0),Tr.debug(`Starting auth initialization...`),Tr.debug(`Fetching system info...`);let r=await yt.getSystemInfo();Tr.debug(`System info response:`,r),r.success&&r.data?(Tr.debug(`Setting system info:`,r.data),t(r.data),J.getState().applyInstanceTheme(r.data.defaultTheme)):Tr.error(`System info response failed:`,r);let i=localStorage.getItem(`auth-token`);if(i)try{let e=await yt.verifyToken();if(e.success&&e.data){let t=q.getState().systemInfo;t&&n(e.data,i,t)}}catch(e){Tr.error(`Token verification failed:`,e),localStorage.removeItem(`auth-token`)}}catch(e){Tr.error(`Auth initialization error:`,e)}finally{e(!1)}}},Dr=I(`initialize`),Or=()=>{let{t:e}=L(),t=(0,X.useRef)(!1),n=(0,X.useRef)(!1),{loadSessions:r,loadModels:i,loadPreferences:a,setSelectedModel:o,models:s,ollamaConnected:c}=ae(),{loadPreferences:l}=J(),{loadPlugins:u,plugins:d}=jt(),f=q(e=>e.isAuthenticated);(0,X.useEffect)(()=>{t.current||n.current||(async()=>{n.current=!0;try{Dr.debug(`Initializing Libre WebUI...`),await Er.initializeAuth();let n=q.getState();if(n.requiresAuth()&&!n.isAuthenticated){Dr.debug(`Authentication required; deferring protected app initialization`);return}try{!(await Et.checkHealth()).success&&!P()&&V.error(e(`appInitialization.ollamaUnavailable`))}catch(t){Dr.warn(`Ollama health check failed; continuing provider initialization:`,t),P()||V.error(e(`appInitialization.ollamaUnavailable`))}await Promise.all([l(),a()]),await Promise.all([i(),r(),u()]),t.current=!0,Dr.debug(`Libre WebUI initialized successfully`)}catch(n){P()?(await Promise.all([l(),a()]),await Promise.all([i(),r(),u()]),t.current=!0):(Dr.error(`Failed to initialize app:`,n),V.error(e(`appInitialization.backendConnectionFailed`)))}finally{n.current=!1}})()},[f,l,a,i,r,u,e]),(0,X.useEffect)(()=>{if(s.length>0){let e=s.filter(e=>!e.name.includes(`embed`))[0]||s[0],{selectedModel:t,selectedProviderType:n,selectedProviderId:r}=ae.getState();if(t){if(!ie(s,{model:t,providerType:n,providerId:r})&&n!==`ollama`&&n!==`plugin`){let t=re(e);Dr.debug(`Legacy selected model not available, falling back to:`,t.model),o(t.model,t.providerType,t.providerId)}}else{let t=re(e);Dr.debug(`No model selected, using first available:`,t.model),o(t.model,t.providerType,t.providerId)}}},[s,o]),(0,X.useEffect)(()=>{t.current&&(Dr.debug(`Plugin availability changed, reloading models...`),i())},[d,i]),(0,X.useEffect)(()=>{let e=0,t=()=>{if(document.visibilityState!==`visible`)return;let t=q.getState();if(t.requiresAuth()&&!t.isAuthenticated)return;let n=Date.now();n-e<1e4||(e=n,t.refreshWorkAccess())};return window.addEventListener(`focus`,t),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,t),document.removeEventListener(`visibilitychange`,t)}},[]),(0,X.useEffect)(()=>{let e=()=>{Dr.debug(`Installed models changed, reloading models...`),i()};return window.addEventListener(Tt,e),()=>window.removeEventListener(Tt,e)},[i]),(0,X.useEffect)(()=>{if(c)return;let e=q.getState();if(e.requiresAuth()&&!e.isAuthenticated)return;let t=()=>{document.visibilityState===`visible`&&(Dr.debug(`Provider offline at startup, re-checking availability...`),i({quiet:!0}))},n=s.some(e=>!e.isPersona)?void 0:window.setInterval(t,1e4);return window.addEventListener(`focus`,t),()=>{n!==void 0&&window.clearInterval(n),window.removeEventListener(`focus`,t)}},[c,s,i])},kr=`.scroll-region, [class*="overflow-y-auto"], [class*="overflow-x-auto"], [class*="overflow-auto"], [data-scroll-fade]`,Ar=`input, textarea, [contenteditable="true"], [data-scroll-fade="off"], .sidebar-scroll-fade, .tab-scroll-fade`,jr=[`top`,`bottom`,`left`,`right`];function Mr(){(0,X.useEffect)(()=>{let e=new Map,t=new Set,n=new Set,r=null,i=!1,a=e=>{let t=getComputedStyle(e),n=e=>/^(auto|scroll)$/.test(e),r=n(t.overflowY)?Math.max(0,e.scrollHeight-e.clientHeight):0,i=n(t.overflowX)?Math.max(0,e.scrollWidth-e.clientWidth):0,a=Math.max(0,Math.min(r,e.scrollTop)),o=Math.max(0,Math.min(i,t.direction===`rtl`?i+e.scrollLeft:e.scrollLeft)),s=[a,r-a,o,i-o];jr.forEach((t,n)=>{let r=s[n],i=Number.parseFloat(e.getAttribute(`data-scroll-fade-${t}`)??``),a=`${r<=1?0:Math.min(Number.isFinite(i)&&i>=0?i:24,r)}px`,o=`--scroll-fade-${t}`;e.style.getPropertyValue(o)!==a&&e.style.setProperty(o,a)}),e.toggleAttribute(`data-scroll-fade-active`,e.clientWidth>0&&e.clientHeight>0&&(r>1||i>1))},o=r=>{e.get(r)?.observer.disconnect(),e.delete(r),t.delete(r),n.delete(r),r.removeAttribute(`data-scroll-fade-active`),r.removeAttribute(`data-scroll-fade-keyboard`),jr.forEach(e=>r.style.removeProperty(`--scroll-fade-${e}`))},s=()=>{r=null;for(let t of e.keys())t.isConnected||o(t);for(let e of t)a(e);t.clear()},c=n=>{e.has(n)&&(t.add(n),r===null&&(r=requestAnimationFrame(s)))},l=t=>{let n=e.get(t);if(!n)return;let r=new Set(t.children);for(let e of n.children)r.has(e)||n.observer.unobserve(e);for(let e of r)n.children.has(e)||n.observer.observe(e);n.children=r},u=t=>{if(t instanceof HTMLElement){if(t.matches(Ar)||t.closest(`[contenteditable="true"], [data-scroll-fade="off"]`)||!t.matches(kr)){e.has(t)&&o(t);return}if(!e.has(t)){let n=new ResizeObserver(()=>c(t));e.set(t,{observer:n,children:new Set}),n.observe(t)}l(t),c(t)}},d=e=>{u(e),e.querySelectorAll(kr).forEach(u)},f=t=>{let n=t instanceof HTMLElement?t:t.parentElement;for(;n;)e.has(n)&&(l(n),c(n)),n=n.parentElement},p=()=>e.forEach((e,t)=>c(t)),m=()=>{for(let e of n)e.removeAttribute(`data-scroll-fade-keyboard`);if(n.clear(),!i)return;let t=document.activeElement;for(;t instanceof HTMLElement;)e.has(t)&&(t.setAttribute(`data-scroll-fade-keyboard`,``),n.add(t)),t=t.parentElement},h=e=>{[`Tab`,`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`].includes(e.key)&&(i=!0,m())},g=()=>{i=!1,m()},_=t=>{t.target instanceof HTMLElement&&e.has(t.target)&&c(t.target)};d(document.body);let v=new MutationObserver(e=>{for(let t of e){t.type===`attributes`&&t.target instanceof Element&&(u(t.target),t.target.querySelectorAll(kr).forEach(u));for(let e of t.addedNodes)e instanceof Element&&d(e);f(t.target)}r===null&&(r=requestAnimationFrame(s)),m()});return v.observe(document.documentElement,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`class`,`dir`,`data-scroll-fade`,...jr.map(e=>`data-scroll-fade-${e}`)]}),document.addEventListener(`scroll`,_,!0),document.addEventListener(`keydown`,h,!0),document.addEventListener(`focusin`,m),document.addEventListener(`pointerdown`,g,!0),document.addEventListener(`wheel`,g,{passive:!0,capture:!0}),window.addEventListener(`resize`,p),()=>{v.disconnect(),e.forEach((e,t)=>o(t)),r!==null&&cancelAnimationFrame(r),document.removeEventListener(`scroll`,_,!0),document.removeEventListener(`keydown`,h,!0),document.removeEventListener(`focusin`,m),document.removeEventListener(`pointerdown`,g,!0),document.removeEventListener(`wheel`,g,!0),window.removeEventListener(`resize`,p)}},[])}var Nr=(e,t=!0)=>{let n=(0,X.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===`?`);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,X.useEffect)(()=>{if(t)return document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`keydown`,n)}},[n,t])},Pr=I(`components:git-hub-auth-button`),Fr=()=>{let{t:e}=L(),[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{(async()=>{try{let e=await fetch(`${gt}/auth/oauth/github/status`,{method:`GET`,credentials:`include`});if(e.ok){let t=await e.json();i(t.configured||!1),Pr.debug(`GitHub OAuth configured:`,t.configured)}else Pr.debug(`GitHub OAuth status check failed`),i(!1)}catch(e){Pr.debug(`GitHub OAuth not configured:`,e),i(!1)}})()},[]),r?(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{if(!r||t)return;n(!0);let e=`${gt}/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,Z.jsxs)(`div`,{className:`flex items-center`,children:[(0,Z.jsx)(U,{size:16,className:`me-2 animate-spin`}),e(`auth.oauth.connectingTo`,{provider:e(`auth.oauth.github`)})]}):(0,Z.jsxs)(`div`,{className:`flex items-center`,children:[(0,Z.jsx)(Pe,{size:16,className:`me-2`}),e(`auth.oauth.continueWith`,{provider:e(`auth.oauth.github`)})]})}):null},Ir=I(`components:hugging-face-auth-button`),Lr=()=>{let{t:e}=L(),[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{(async()=>{try{let e=await fetch(`${gt}/auth/oauth/huggingface/status`,{method:`GET`,credentials:`include`});if(e.ok){let t=await e.json();i(t.configured||!1),Ir.debug(`Hugging Face OAuth configured:`,t.configured)}else Ir.debug(`Hugging Face OAuth status check failed`),i(!1)}catch(e){Ir.debug(`Hugging Face OAuth not configured:`,e),i(!1)}})()},[]),r?(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{if(!r||t)return;n(!0);let e=`${gt}/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,Z.jsxs)(`div`,{className:`flex items-center`,children:[(0,Z.jsx)(U,{size:16,className:`me-2 animate-spin`}),e(`auth.oauth.connectingTo`,{provider:e(`auth.oauth.huggingFace`)})]}):(0,Z.jsxs)(`div`,{className:`flex items-center`,children:[(0,Z.jsx)(`span`,{className:`me-2 text-base`,children:`🤗`}),e(`auth.oauth.continueWith`,{provider:e(`auth.oauth.huggingFace`)})]})}):null},Rr=({displayName:e})=>{let{t}=L(),[n,r]=(0,X.useState)(!1),i=e||t(`auth.oidc.defaultProviderName`,`Single sign-on`);return(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{n||(r(!0),window.location.href=`${gt}/auth/oauth/oidc`)},disabled:n,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:n?(0,Z.jsxs)(`div`,{className:`flex items-center`,children:[(0,Z.jsx)(U,{size:16,className:`me-2 animate-spin`}),t(`auth.oauth.connectingTo`,{provider:i})]}):(0,Z.jsxs)(`div`,{className:`flex items-center`,children:[(0,Z.jsx)(Ee,{size:16,className:`me-2`}),t(`auth.oauth.continueWith`,{provider:i})]})})},zr=I(`hooks:oauth-providers`),Br=async e=>{try{let t=await fetch(`${gt}/auth/oauth/${e}/status`,{method:`GET`,credentials:`include`});if(!t.ok)return{configured:!1};let n=await t.json();return{configured:!!n.configured,displayName:typeof n.displayName==`string`?n.displayName:void 0}}catch(t){return zr.debug(`${e} OAuth not configured:`,t),{configured:!1}}},Vr=()=>{let[e,t]=(0,X.useState)({github:!1,huggingface:!1,oidc:!1}),[n,r]=(0,X.useState)(void 0);return(0,X.useEffect)(()=>{let e=!0;return Promise.all([Br(`github`),Br(`huggingface`),Br(`oidc`)]).then(([n,i,a])=>{e&&(t({github:n.configured,huggingface:i.configured,oidc:a.configured}),r(a.displayName))}),()=>{e=!1}},[]),{...e,oidcDisplayName:n,hasAny:e.github||e.huggingface||e.oidc}},Hr=I(`components:login-form`),Ur={username:`demo`,password:`demo`},Wr=({onLogin:e,onShowSignup:t,initialApprovalPending:n=!1,bare:r=!1})=>{let{t:i}=L(),a=P(),o=Vr(),[s,c]=(0,X.useState)(a?Ur.username:``),[l,u]=(0,X.useState)(a?Ur.password:``),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(n),[_,v]=(0,X.useState)(``),[y,b]=(0,X.useState)(null),[x,S]=(0,X.useState)(``),[C,w]=(0,X.useState)(null),[E,D]=(0,X.useState)(null),[O,k]=(0,X.useState)(null),A=T(),{login:j,systemInfo:M}=q(),N=M?.turnstile?.siteKey,F=!!(M?.turnstile?.enabled&&N&&!a),I=(0,X.useCallback)(e=>{v(e)},[]),ee=(0,X.useMemo)(()=>p||F&&!_,[p,F,_]),te=async t=>{t.preventDefault();let n=a?Ur.username:s.trim(),r=a?Ur.password:l;if(!n||!r){G.error(i(`auth.login.enterBoth`));return}if(F&&!_){G.error(i(`auth.login.verificationFailed`,`Security verification failed. Please refresh and try again.`));return}m(!0),g(!1);try{localStorage.removeItem(`auth-token`);let t=await yt.login({username:n,password:r,turnstileToken:_});if(t.success&&t.data){if(bt(t.data)){if(b(t.data),S(``),t.data.requirement===`enroll`){let e=await yt.mfaEnrollChallenge({challengeToken:t.data.challengeToken});e.success&&e.data?w(e.data):(G.error(e.message||i(`auth.mfa.enrollFailed`)),b(null))}return}j(t.data.user,t.data.token,t.data.systemInfo),G.success(i(`auth.login.loginSuccess`)),e?.(),A(`/`)}else G.error(t.message||i(`auth.login.loginFailed`))}catch(e){Hr.error(`Login error:`,e);let t=e;t.response?.data?.code===`ACCOUNT_PENDING`?(g(!0),G.error(t.response.data.message||i(`auth.login.approvalPending`,`Your account is waiting for administrator approval.`))):G.error(i(`auth.login.checkCredentials`))}finally{v(``),m(!1)}},R=t=>{j(t.user,t.token,t.systemInfo),G.success(i(`auth.login.loginSuccess`)),e?.(),A(`/`)},ne=async e=>{if(e.preventDefault(),y&&x.trim()){m(!0);try{if(y.requirement===`enroll`){let e=await yt.mfaActivateChallenge({challengeToken:y.challengeToken,code:x.trim()});if(e.success&&e.data){let{recoveryCodes:t,...n}=e.data;k(n),D(t)}else G.error(e.message||i(`auth.mfa.invalidCode`));return}let e=await yt.mfaVerify({challengeToken:y.challengeToken,code:x.trim()});e.success&&e.data?R(e.data):G.error(e.message||i(`auth.mfa.invalidCode`))}catch(e){let t=e.response?.data?.message;t&&/challenge/i.test(t)?(G.error(i(`auth.mfa.challengeExpired`)),b(null),w(null)):G.error(t||i(`auth.mfa.invalidCode`))}finally{S(``),m(!1)}}},B=async()=>{m(!0);try{let e=await yt.passkeyLoginOptions();if(!e.success||!e.data){G.error(e.message||i(`auth.passkeys.signInFailed`));return}let t=await $t(e.data.publicKey),n=await yt.passkeyLogin({challengeToken:e.data.challengeToken,credential:t});n.success&&n.data?(localStorage.removeItem(`auth-token`),R(n.data)):G.error(n.message||i(`auth.passkeys.signInFailed`))}catch(e){let t=e;if(t.name===`NotAllowedError`||t.name===`AbortError`)return;let n=e;Hr.error(`Passkey login error:`,e),G.error(n.response?.data?.message||i(`auth.passkeys.signInFailed`))}finally{m(!1)}},re=e=>{if(e.key===`Enter`){let t=e.currentTarget.form;t&&t.requestSubmit()}},ie=z(`mx-auto w-full max-w-md`,!r&&`rounded-3xl border border-line bg-surface-raised p-6 shadow-card sm:p-8`);if(E&&O)return(0,Z.jsxs)(`div`,{className:ie,"data-testid":`login-recovery-codes`,children:[(0,Z.jsxs)(`div`,{className:z(`mb-6`,r?`text-start`:`text-center`),children:[(0,Z.jsx)(`h1`,{className:`mb-2 text-2xl font-light tracking-[-0.04em] text-ink`,children:i(`auth.mfa.recoveryCodesTitle`)}),(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:i(`auth.mfa.recoveryCodesHint`)})]}),(0,Z.jsx)(`div`,{className:`mb-6 grid grid-cols-2 gap-2 rounded-xl border border-line bg-surface p-4 font-mono text-sm text-ink`,children:E.map(e=>(0,Z.jsx)(`span`,{dir:`ltr`,children:e},e))}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>R(O),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 disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:i(`auth.mfa.recoveryCodesSaved`)})]});if(y){let e=y.requirement===`enroll`;return(0,Z.jsxs)(`div`,{className:ie,"data-testid":`login-mfa-step`,children:[(0,Z.jsxs)(`div`,{className:z(`mb-6`,r?`text-start`:`text-center`),children:[(0,Z.jsx)(`div`,{className:z(`mb-3 flex`,r?`justify-start`:`justify-center`),children:(0,Z.jsx)(pt,{"aria-hidden":`true`,className:`h-8 w-8 text-ink`})}),(0,Z.jsx)(`h1`,{className:`mb-2 text-2xl font-light tracking-[-0.04em] text-ink`,children:i(e?`auth.mfa.setupTitle`:`auth.mfa.verifyTitle`)}),(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:i(e?`auth.mfa.setupSubtitle`:`auth.mfa.verifyHint`)})]}),e&&C&&(0,Z.jsxs)(`div`,{className:`mb-5 space-y-3 rounded-xl border border-line bg-surface p-4 text-start`,children:[(0,Z.jsx)(`p`,{className:`text-xs leading-5 text-ink-muted`,children:i(`auth.mfa.secretHint`)}),(0,Z.jsx)(`code`,{dir:`ltr`,"data-testid":`mfa-enroll-secret`,className:`block break-all font-mono text-sm text-ink`,children:C.secret}),(0,Z.jsx)(`a`,{href:C.otpauthUrl,dir:`ltr`,className:`inline-block text-xs font-medium text-primary-600 hover:text-primary-700 dark:text-primary-400`,children:i(`auth.mfa.openAuthenticator`)})]}),(0,Z.jsxs)(`form`,{onSubmit:ne,className:`space-y-5`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{htmlFor:`mfa-code`,className:`mb-2 block text-sm font-medium text-ink`,children:i(e?`auth.mfa.codeLabel`:`auth.mfa.codeOrRecoveryLabel`)}),(0,Z.jsx)(`input`,{id:`mfa-code`,"data-testid":`mfa-code-input`,type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,autoFocus:!0,dir:`ltr`,value:x,onChange:e=>S(e.target.value),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.mfa.codePlaceholder`),required:!0,disabled:p})]}),(0,Z.jsx)(`button`,{type:`submit`,disabled:p||!x.trim(),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 disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:p?(0,Z.jsxs)(`div`,{className:`flex items-center`,children:[(0,Z.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-current`}),i(`auth.login.signingIn`)]}):i(`auth.mfa.verifyButton`)}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{b(null),w(null),S(``)},className:`w-full text-center text-sm font-medium text-ink-muted transition-colors hover:text-ink`,children:i(`auth.mfa.backToSignIn`)})]})]})}return(0,Z.jsxs)(`div`,{className:z(`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,Z.jsxs)(`div`,{className:z(`mb-8`,r?`text-start`:`text-center`),children:[(0,Z.jsx)(`h1`,{className:`mb-2 text-3xl font-light tracking-[-0.04em] text-ink`,children:i(`auth.login.title`)}),(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:i(`auth.login.subtitle`)})]}),(0,Z.jsxs)(`form`,{onSubmit:te,className:`space-y-5`,children:[h&&(0,Z.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,Z.jsx)(xe,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 shrink-0 text-warning-700 dark:text-warning-400`}),(0,Z.jsx)(`p`,{className:`text-xs leading-5 text-ink-muted`,children:i(`auth.login.approvalPending`,`Your account is waiting for administrator approval.`)})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{htmlFor:`username`,className:`mb-2 block text-sm font-medium text-ink`,children:i(`auth.login.username`)}),(0,Z.jsx)(`input`,{id:`username`,type:`text`,value:s,onChange:e=>c(e.target.value),onKeyDown:re,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:p||a})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{htmlFor:`password`,className:`mb-2 block text-sm font-medium text-ink`,children:i(`auth.login.password`)}),(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(`input`,{id:`password`,type:d?`text`:`password`,value:l,onChange:e=>u(e.target.value),onKeyDown:re,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:p||a}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>f(!d),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:p||a,"aria-label":d?`Hide characters`:`Reveal characters`,children:d?(0,Z.jsx)(ue,{size:20}):(0,Z.jsx)(Se,{size:20})})]})]}),F&&N&&(0,Z.jsx)(on,{siteKey:N,action:`login`,disabled:p,errorMessage:i(`auth.login.verificationFailed`,`Security verification failed. Please refresh and try again.`),onTokenChange:I}),(0,Z.jsx)(`button`,{type:`submit`,disabled:ee,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:p?(0,Z.jsxs)(`div`,{className:`flex items-center`,children:[(0,Z.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-current`}),i(`auth.login.signingIn`)]}):(0,Z.jsxs)(`div`,{className:`flex items-center`,children:[(0,Z.jsx)(W,{size:16,className:`me-2`}),i(`auth.login.signIn`)]})})]}),!a&&Zt()&&M?.passkeysInUse&&(0,Z.jsxs)(`button`,{type:`button`,"data-testid":`passkey-signin-button`,onClick:B,disabled:p,className:`mt-3 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-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 disabled:cursor-not-allowed disabled:opacity-40 motion-reduce:transition-none`,children:[(0,Z.jsx)(Ee,{size:16,className:`me-2`}),i(`auth.passkeys.signInButton`)]}),!a&&(0,Z.jsxs)(Z.Fragment,{children:[o.hasAny&&(0,Z.jsxs)(`div`,{className:`mt-6`,children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,Z.jsx)(`div`,{className:`w-full border-t border-line`})}),(0,Z.jsx)(`div`,{className:`relative flex justify-center text-sm`,children:(0,Z.jsx)(`span`,{className:z(`px-2 text-ink-muted`,r?`bg-canvas`:`bg-surface-raised`),children:i(`common.or`)})})]}),(0,Z.jsxs)(`div`,{className:`mt-6 space-y-3`,children:[o.github&&(0,Z.jsx)(Fr,{}),o.huggingface&&(0,Z.jsx)(Lr,{}),o.oidc&&(0,Z.jsx)(Rr,{displayName:o.oidcDisplayName})]})]}),t&&(0,Z.jsx)(`div`,{className:`mt-6 text-center`,children:(0,Z.jsxs)(`p`,{className:`text-sm text-ink-muted`,children:[i(`auth.login.noAccount`),` `,(0,Z.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`)})]})})]})]})},Gr=I(`components:signup-form`),Kr=({onSignup:e,onBackToLogin:t,bare:n=!1})=>{let{t:r}=L(),[i,a]=(0,X.useState)(``),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(!1),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(``),S=T(),{login:C,systemInfo:w}=q(),E=w?.turnstile?.siteKey,D=!!(w?.turnstile?.enabled&&E),O=(0,X.useCallback)(e=>{x(e)},[]),k=(0,X.useMemo)(()=>g||D&&!b,[g,D,b]),A=async t=>{if(t.preventDefault(),!i.trim()||!c.trim()){G.error(r(`auth.signup.usernameRequired`));return}if(c!==u){G.error(r(`auth.signup.passwordMismatch`));return}let n=sn(c);if(n){G.error(n);return}if(D&&!b){G.error(r(`auth.signup.tryAgain`));return}_(!0);try{let t=await yt.signup({username:i,password:c,email:o,turnstileToken:b});if(t.success&&t.data){if(!(`token`in t.data)){y(!0),G.success(r(`auth.signup.approvalPending`,`Registration received. An administrator must approve your account.`));return}C(t.data.user,t.data.token,t.data.systemInfo),G.success(r(`auth.signup.signupSuccess`)),e?.(),S(`/`)}else G.error(t.message||r(`auth.signup.signupFailed`))}catch(e){Gr.error(`Signup error:`,e),G.error(r(`auth.signup.tryAgain`))}finally{x(``),_(!1)}},j=e=>{if(e.key===`Enter`){let t=e.currentTarget.form;t&&t.requestSubmit()}};return v?(0,Z.jsxs)(`div`,{"data-testid":`signup-approval-pending`,className:z(`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,Z.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,Z.jsx)(xe,{"aria-hidden":`true`,className:`h-6 w-6`})}),(0,Z.jsx)(`h1`,{className:`mt-5 text-3xl font-light tracking-[-0.04em] text-ink`,children:r(`auth.signup.awaitingApproval`,`Awaiting approval`)}),(0,Z.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,Z.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,Z.jsxs)(`div`,{className:z(`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,Z.jsxs)(`div`,{className:z(`mb-8`,n?`text-start`:`text-center`),children:[(0,Z.jsx)(`h1`,{className:`mb-2 text-3xl font-light tracking-[-0.04em] text-ink`,children:r(`auth.signup.title`)}),(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-ink-muted`,children:r(`auth.signup.subtitle`)})]}),(0,Z.jsxs)(`form`,{onSubmit:A,className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{htmlFor:`username`,className:`mb-2 block text-sm font-medium text-ink`,children:r(`auth.signup.username`)}),(0,Z.jsx)(`input`,{id:`username`,type:`text`,value:i,onChange:e=>a(e.target.value),onKeyDown:j,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:g})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`label`,{htmlFor:`email`,className:`mb-2 block text-sm font-medium text-ink`,children:[r(`auth.signup.email`),` `,(0,Z.jsxs)(`span`,{className:`text-ink-muted`,children:[`(`,r(`common.optional`),`)`]})]}),(0,Z.jsx)(`input`,{id:`email`,type:`email`,value:o,onChange:e=>s(e.target.value),onKeyDown:j,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:g})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{htmlFor:`password`,className:`mb-2 block text-sm font-medium text-ink`,children:r(`auth.signup.password`)}),(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(`input`,{id:`password`,type:f?`text`:`password`,value:c,onChange:e=>l(e.target.value),onKeyDown:j,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:g}),(0,Z.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:g,"aria-label":f?`Hide characters`:`Reveal characters`,children:f?(0,Z.jsx)(ue,{size:20}):(0,Z.jsx)(Se,{size:20})})]}),(0,Z.jsx)(cn,{password:c})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{htmlFor:`confirmPassword`,className:`mb-2 block text-sm font-medium text-ink`,children:r(`auth.signup.confirmPassword`)}),(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(`input`,{id:`confirmPassword`,type:m?`text`:`password`,value:u,onChange:e=>d(e.target.value),onKeyDown:j,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:g}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>h(!m),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:g,"aria-label":m?`Hide confirmation`:`Reveal confirmation`,children:m?(0,Z.jsx)(ue,{size:20}):(0,Z.jsx)(Se,{size:20})})]})]}),D&&E&&(0,Z.jsx)(on,{siteKey:E,action:`signup`,disabled:g,errorMessage:r(`auth.signup.tryAgain`),onTokenChange:O}),(0,Z.jsx)(`button`,{type:`submit`,disabled:k,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:g?(0,Z.jsxs)(`div`,{className:`flex items-center`,children:[(0,Z.jsx)(`div`,{className:`me-2 h-4 w-4 animate-spin rounded-full border-b-2 border-current`}),r(`auth.signup.creatingAccount`)]}):(0,Z.jsxs)(`div`,{className:`flex items-center`,children:[(0,Z.jsx)(ot,{size:16,className:`me-2`}),r(`auth.signup.createAccount`)]})})]}),(0,Z.jsx)(Fr,{}),(0,Z.jsx)(`div`,{className:`mt-6 text-center`,children:(0,Z.jsxs)(`p`,{className:`text-sm text-ink-muted`,children:[r(`auth.signup.hasAccount`),` `,(0,Z.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`)})]})})]})},qr=()=>{let{t:e}=L(),t=T(),n=N(),{isAuthenticated:r,requiresAuth:i,systemInfo:a}=q(),[o,s]=(0,X.useState)(!1),c=i(),l=a?.signupEnabled??!0,u=new URLSearchParams(n.search).get(`approval`)===`pending`;if((0,X.useEffect)(()=>{(r||!c)&&t(`/`)},[c,r,t]),r||!c)return null;let d=[{icon:pt,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:Fe,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:Ae,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.`)}],f=ln(a?.version);return(0,Z.jsxs)(`div`,{className:`relative min-h-screen overflow-y-auto bg-canvas text-ink`,"data-celestial-canvas":``,children:[(0,Z.jsx)(pr,{}),(0,Z.jsxs)(`header`,{className:`absolute inset-x-0 top-0 z-20 flex h-14 items-center justify-between px-5 sm:px-8`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-ink lg:invisible`,children:[(0,Z.jsx)(Wt,{size:`sm`,label:null}),(0,Z.jsx)(`span`,{className:`hidden sm:inline`,children:(0,Z.jsx)(Ut,{size:`sm`})})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(en,{compact:!0}),(0,Z.jsx)(En,{})]})]}),(0,Z.jsxs)(`main`,{className:`relative z-10 grid min-h-screen lg:grid-cols-2`,children:[(0,Z.jsxs)(`section`,{className:`relative hidden flex-col justify-between border-e border-line bg-surface px-10 py-12 lg:flex xl:px-16`,"data-celestial-surface":``,children:[(0,Z.jsxs)(`div`,{className:`relative z-10 flex items-center gap-3.5 text-ink`,children:[(0,Z.jsx)(Wt,{size:`lg`,label:null}),(0,Z.jsx)(Ut,{size:`lg`})]}),(0,Z.jsxs)(`div`,{className:`relative z-10 max-w-lg`,children:[(0,Z.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,Z.jsx)(`ul`,{className:`mt-10 space-y-5`,children:d.map(e=>(0,Z.jsxs)(`li`,{className:`flex gap-3`,children:[(0,Z.jsx)(e.icon,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 shrink-0 text-ink-subtle`}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`p`,{className:`text-[13px] font-medium text-ink`,children:e.title}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-[13px] leading-relaxed text-ink-muted`,children:e.body})]})]},e.title))})]}),(0,Z.jsxs)(`div`,{className:`relative z-10 space-y-1 font-mono text-[11px] text-ink-subtle`,children:[(0,Z.jsxs)(`p`,{children:[(0,Z.jsx)(`a`,{href:`https://librewebui.org`,target:`_blank`,rel:`noopener noreferrer`,className:`transition-colors hover:text-ink`,children:`librewebui.org`}),` · `,(0,Z.jsx)(`a`,{href:`https://docs.librewebui.org`,target:`_blank`,rel:`noopener noreferrer`,className:`transition-colors hover:text-ink`,children:`docs.librewebui.org`})]}),(0,Z.jsxs)(`p`,{"data-testid":`app-version`,children:[f?`v${f}`:``,f?` · `:``,e(`auth.selfHosted`,`Self-hosted · Apache 2.0`),` · `,(0,Z.jsx)(`a`,{href:`https://kroonen.ai`,target:`_blank`,rel:`noopener noreferrer`,className:`transition-colors hover:text-ink`,children:`kroonen.ai`})]})]})]}),(0,Z.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,Z.jsx)(`div`,{className:`w-full max-w-sm`,children:o&&l?(0,Z.jsx)(Kr,{bare:!0,onBackToLogin:()=>s(!1),onSignup:()=>s(!1)}):(0,Z.jsx)(Wr,{bare:!0,initialApprovalPending:u,onShowSignup:l?()=>s(!0):void 0})})})]})]})},Jr=window.location.protocol===`file:`,Yr=()=>Jr?(0,Z.jsx)(`div`,{className:`absolute top-0 left-0 right-0 h-8 z-50`,style:{WebkitAppRegion:`drag`}}):null,Xr=I(`app`),Zr=X.lazy(()=>F(()=>import(`../js/HomePage-zJkkDNJl.js`),__vite__mapDeps([30,1,2,31,4,5,6,7,8,9,10,11,12,13,14,16,17,32,33,34,27,35]))),Qr=X.lazy(()=>F(()=>import(`../js/ChatPage-D_CzOiHw.js`),__vite__mapDeps([36,1,2,31,4,5,6,7,8,9,10,11,12,13,14,16,17,34,18,19,20,21,23,37,38,26,39,29,40,41,42,43,44,45,46,3]))),$r=X.lazy(()=>F(()=>import(`../js/WhatsNewModal-Bu4H4MEb.js`).then(e=>({default:e.WhatsNewModal})),__vite__mapDeps([47,1,2,5,6,7,10,11,19,20,4,17,18,21,43]))),ei=X.lazy(()=>F(()=>import(`../js/PersonasPage-ff5opf9B.js`),__vite__mapDeps([48,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17,19,20,18,21,49,24]))),ti=X.lazy(()=>F(()=>import(`../js/GalleryPage-BpK-vrvd.js`),__vite__mapDeps([50,1,2,3,4,5,6,7,10,11,12,13,14,15,17,19,20,18,21]))),ni=X.lazy(()=>F(()=>import(`../js/NotesPage-CNTqlwNc.js`),__vite__mapDeps([51,1,2,31,4,5,6,7,8,9,10,11,12,13,14,19,20,17,18,21,52,43]))),ri=X.lazy(()=>F(()=>import(`../js/CalendarPage-Ch4racU2.js`),__vite__mapDeps([53,1,2,31,4,5,6,7,10,11,12,13,14,19,20,17,18,21,24,54]))),ii=X.lazy(()=>F(()=>import(`../js/AutomationsPage-DvsLZWtg.js`),__vite__mapDeps([55,1,2,31,4,5,6,7,8,9,10,11,12,13,14,19,20,17,18,21,56,54]))),ai=X.lazy(()=>F(()=>import(`../js/LibreClawPage-CAgNj9GM.js`),__vite__mapDeps([57,1,2,4,9,5,6,7,10,11,12,13,14,19,20,17,18,21]))),oi=X.lazy(()=>F(()=>import(`../js/ChannelsPage-D252gXwf.js`),__vite__mapDeps([58,1,2,31,4,5,6,7,8,9,10,11,12,13,14,16,17,19,20,18,21,59]))),si=X.lazy(()=>F(()=>import(`../js/WorkPage-D_cL9wp4.js`),__vite__mapDeps([60,1,2,31,4,5,6,7,8,9,10,11,12,13,14,16,17,19,20,18,21,23,32,52,43,56,54,46,3,35]))),ci=X.lazy(()=>F(()=>import(`../js/UserManagementPage-Ch-PvYQ9.js`),__vite__mapDeps([61,1,2,31,4]))),li=X.lazy(()=>F(()=>import(`../js/PluginUsagePage-Cp4j4-VZ.js`),__vite__mapDeps([62,1,2,3,5,6,7,10,11,14,4,13,12,19,20,17,18,21]))),ui=X.lazy(()=>F(()=>import(`../js/EvaluationsPage-DHPnNBkW.js`),__vite__mapDeps([63,1,2,5,6,7,8,4,9,10,11,12,13,14,19,20,17,18,21,45]))),di=X.lazy(()=>F(()=>import(`../js/SystemPage-Dwi8leEQ.js`),__vite__mapDeps([64,1,2,3,5,6,7,10,11,14,4,13,12,16,8,9,17,19,20,18,21]))),fi=X.lazy(()=>F(()=>import(`../js/ArtifactDemoPage-BwRfWoSK.js`),__vite__mapDeps([65,1,2,19,6,7,20,4,5,10,11,17,18,21,40,38,41,42,43,44,13]))),pi=X.lazy(()=>F(()=>import(`../js/SettingsModal-WAdVG4-g.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,19,20,21,22,23,24,25,26,27,28,29]))),mi=X.lazy(()=>F(()=>import(`../js/ArtifactSlideOutPanel-DPWGjHhp.js`).then(e=>({default:e.ArtifactSlideOutPanel})),__vite__mapDeps([66,1,2,4,5,6,7,8,9,10,11,12,13,14,17,19,38,41,42,43,44]))),hi=X.lazy(()=>F(()=>import(`../js/FirstTimeSetup-CoF83yY8.js`).then(e=>({default:e.FirstTimeSetup})),__vite__mapDeps([67,1,2,4,5,6,7,10,11,12,13,14,16,8,9,17,22,23,68,69,39,19,20,18,21]))),gi=()=>{let{t:e}=L();return(0,Z.jsx)(`div`,{className:`flex h-full min-h-screen items-center justify-center bg-gray-50 dark:bg-dark-100`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,Z.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,Z.jsx)(`div`,{className:`text-gray-600 dark:text-dark-600`,children:e(`common.loading`)})]})})},_i=({isOpen:e,compact:t})=>(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-sidebar-layout-spacer":``,className:z(`hidden md:block flex-shrink-0 transition-[width] duration-200 ease-out motion-reduce:transition-none`,e?t?`w-16`:`w-72`:`w-0`)}),vi=()=>{let{artifactPanelOpen:e,artifactPanelWidth:t,artifactPanelResizing:n}=J();return(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:z(`hidden md:block flex-shrink-0`,!n&&`transition-[width] duration-300 ease-out`),style:{width:e?t:0}})},yi=({sidebarOpen:e,sidebarCompact:t,onCloseSidebar:n,showDemoBanner:r,demoMessage:i,children:a})=>{let{pathname:o}=N(),s=J(e=>e.preferences.backgroundSettings),c=J(e=>e.backgroundImage),l=Pt(s),u=Xt(o)&&l.enabled&&l.opacity>0&&!!(c??l.imageUrl);return(0,Z.jsxs)(`div`,{className:`relative flex h-dvh min-h-0 overflow-hidden bg-sidebar text-ink`,"data-app-shell":``,children:[(0,Z.jsx)(Yr,{}),(0,Z.jsx)(pr,{}),(0,Z.jsx)($n,{isOpen:e,onClose:n}),(0,Z.jsx)(_i,{isOpen:e,compact:t}),(0,Z.jsxs)(`div`,{"data-testid":`app-shell-content`,className:z(`relative z-10 flex min-h-0 min-w-0 flex-1 basis-0 flex-col bg-transparent transition-[margin,background-color] duration-200 ease-out motion-reduce:transition-none lg:pb-2 lg:pe-2`,Jr?`pt-8`:`lg:pt-1.5`,e?`max-md:ms-16`:`max-md:ms-0`),children:[r&&(0,Z.jsx)(or,{message:i}),(0,Z.jsx)(br,{}),(0,Z.jsxs)(`main`,{"data-app-main":``,"data-wallpaper":u?`true`:void 0,className:`relative isolate min-h-0 flex-1 overflow-hidden bg-canvas 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)]`,children:[(0,Z.jsx)(Qt,{active:u}),(0,Z.jsx)(`div`,{className:`relative z-10 h-full min-h-0`,"data-wallpaper-content":``,children:(0,Z.jsx)(rr,{children:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(gi,{}),children:a})})})]})]}),(0,Z.jsx)(vi,{})]})},bi=[{path:`*`,element:(0,Z.jsx)(()=>{let{t:e,i18n:t}=L(),n=T(),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(void 0),s=(0,X.useCallback)(()=>{o(`users`),i(!0)},[]),[c,l]=(0,X.useState)(0),[u,d]=(0,X.useState)(!1),{sidebarOpen:f,sidebarCompact:p,setSidebarOpen:m,setSidebarCompact:h,toggleSidebar:g,toggleSidebarCompact:_,toggleTheme:v,preferences:y,artifactPanelOpen:b,closeArtifactPanel:x}=J(),{systemInfo:S,isLoading:C,user:E,isAuthenticated:D}=q(),{isDemoMode:k,demoConfig:A}=J(),j=S?.requiresAuth===!1||D,M=ar();X.useEffect(()=>{if(y.ttsSettings?.enabled&&y.ttsSettings.autoPlay)return an()},[y.ttsSettings?.autoPlay,y.ttsSettings?.enabled]);let[N,P]=X.useState(!1),F=X.useRef(!1);X.useEffect(()=>{(async()=>{if(F.current){Xr.debug(`OAuth already processing, skipping...`);return}if(Xr.debug(`Starting OAuth callback processing...`),F.current=!0,new URLSearchParams(window.location.search).get(`auth`)===`success`){try{let t=await fetch(`${gt}/auth/oauth/exchange`,{method:`POST`,credentials:`include`});if(t.ok){let n=await t.json();if(n.success&&n.data){let{login:t}=q.getState();t(n.data.user,n.data.token,n.data.systemInfo),Xr.debug(`OAuth login successful`),V.success(e(`auth.oauth.loginSuccess`))}else V.error(e(`auth.oauth.completionFailed`))}else V.error(e(`auth.oauth.verificationFailed`))}catch(t){Xr.error(`OAuth processing error:`,t),V.error(e(`auth.oauth.authenticationFailed`))}window.history.replaceState({},document.title,window.location.pathname)}Xr.debug(`OAuth processing completed`),P(!0),F.current=!1})()},[e]),Or(),Mr(),Nr([{key:`b`,metaKey:!0,action:()=>{window.innerWidth>=1024?f?_():(h(!1),g()):(!f&&p&&h(!1),g())},description:e(`keyboard.toggleSidebar`)},{key:`,`,metaKey:!0,action:()=>{o(void 0),i(!0)},description:e(`keyboard.openSettings`)},{key:`o`,metaKey:!0,shiftKey:!0,action:()=>tn(n),description:e(`keyboard.newChat`)},{key:`u`,metaKey:!0,shiftKey:!0,action:()=>{q.getState().canUseWork()&&nn(n)},description:e(`keyboard.newWork`)},{key:`d`,metaKey:!0,action:v,description:e(`keyboard.toggleDarkMode`)},{key:`?`,action:()=>{o(`shortcuts`),i(!0)},description:e(`keyboard.showShortcuts`)}],j),X.useEffect(()=>{if(j)return;let e=window.requestAnimationFrame(()=>{i(!1),x()});return()=>window.cancelAnimationFrame(e)},[x,j]),X.useEffect(()=>{if(!j){kt.disconnect();return}return kt.connect().catch(Xr.error),()=>{kt.disconnect()}},[j]),X.useEffect(()=>{if(!S&&!C&&c<15){let e=setTimeout(async()=>{l(e=>e+1);try{await Er.initializeAuth()}catch{}},2e3);return()=>clearTimeout(e)}},[S,C,c]);let I=!u&&S?.requiresAuth===!0&&S?.hasUsers===!1;return C?(0,Z.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,Z.jsx)(`div`,{className:`sm:mx-auto sm:w-full sm:max-w-md`,children:(0,Z.jsx)(`div`,{className:`flex flex-col items-center`,children:(0,Z.jsx)(Wt,{size:`lg`,className:`text-gray-900 dark:text-gray-100`})})}),(0,Z.jsx)(`div`,{className:`mt-8 flex flex-col items-center gap-4`,children:(0,Z.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`})})]}):S?I&&!u?(0,Z.jsx)(rr,{children:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(gi,{}),children:(0,Z.jsx)(hi,{onComplete:()=>{d(!0)}})})}):N?(0,Z.jsxs)(Z.Fragment,{children:[S.requiresAuth?(0,Z.jsxs)(w,{children:[(0,Z.jsx)(O,{path:`/login`,element:(0,Z.jsx)(qr,{})}),(0,Z.jsx)(O,{path:`/*`,element:(0,Z.jsx)($,{children:(0,Z.jsx)(yi,{sidebarOpen:f,sidebarCompact:p,onCloseSidebar:()=>m(!1),showDemoBanner:k&&A.showBanner,demoMessage:A.message,children:(0,Z.jsxs)(w,{children:[(0,Z.jsx)(O,{path:`/`,element:(0,Z.jsx)(Zr,{})}),(0,Z.jsx)(O,{path:`/chat`,element:(0,Z.jsx)(Qr,{})}),(0,Z.jsx)(O,{path:`/c/:sessionId`,element:(0,Z.jsx)(Qr,{})}),(0,Z.jsx)(O,{path:`/personas`,element:(0,Z.jsx)(ei,{})}),(0,Z.jsx)(O,{path:`/gallery`,element:(0,Z.jsx)(ti,{})}),(0,Z.jsx)(O,{path:`/notes`,element:(0,Z.jsx)(ni,{})}),(0,Z.jsx)(O,{path:`/calendar`,element:(0,Z.jsx)(ri,{})}),(0,Z.jsx)(O,{path:`/automations`,element:(0,Z.jsx)(ii,{})}),(0,Z.jsx)(O,{path:`/channels`,element:(0,Z.jsx)(oi,{})}),(0,Z.jsx)(O,{path:`/work`,element:(0,Z.jsx)($,{requireWork:!0,children:(0,Z.jsx)(si,{})})}),(0,Z.jsx)(O,{path:`/work/:taskId`,element:(0,Z.jsx)($,{requireWork:!0,children:(0,Z.jsx)(si,{})})}),(0,Z.jsx)(O,{path:`/agents`,element:(0,Z.jsx)($,{requireAdmin:!0,requireAgents:!0,children:(0,Z.jsx)(ai,{})})}),(0,Z.jsx)(O,{path:`/artifacts`,element:(0,Z.jsx)(fi,{})}),(0,Z.jsx)(O,{path:`/usage`,element:(0,Z.jsx)($,{requireAdmin:!0,children:(0,Z.jsx)(li,{})})}),(0,Z.jsx)(O,{path:`/evaluations`,element:(0,Z.jsx)(ui,{})}),(0,Z.jsx)(O,{path:`/system`,element:(0,Z.jsx)($,{requireAdmin:!0,children:(0,Z.jsx)(di,{})})}),(0,Z.jsx)(O,{path:`/users`,element:(0,Z.jsx)($,{requireAdmin:!0,children:(0,Z.jsx)(ci,{onOpen:s})})})]})})})})]}):(0,Z.jsx)(yi,{sidebarOpen:f,sidebarCompact:p,onCloseSidebar:()=>m(!1),showDemoBanner:k&&A.showBanner,demoMessage:A.message,children:(0,Z.jsxs)(w,{children:[(0,Z.jsx)(O,{path:`/`,element:(0,Z.jsx)(Zr,{})}),(0,Z.jsx)(O,{path:`/chat`,element:(0,Z.jsx)(Qr,{})}),(0,Z.jsx)(O,{path:`/c/:sessionId`,element:(0,Z.jsx)(Qr,{})}),(0,Z.jsx)(O,{path:`/personas`,element:(0,Z.jsx)(ei,{})}),(0,Z.jsx)(O,{path:`/gallery`,element:(0,Z.jsx)(ti,{})}),(0,Z.jsx)(O,{path:`/notes`,element:(0,Z.jsx)(ni,{})}),(0,Z.jsx)(O,{path:`/calendar`,element:(0,Z.jsx)(ri,{})}),(0,Z.jsx)(O,{path:`/automations`,element:(0,Z.jsx)(ii,{})}),(0,Z.jsx)(O,{path:`/channels`,element:(0,Z.jsx)(oi,{})}),(0,Z.jsx)(O,{path:`/work`,element:(0,Z.jsx)($,{requireWork:!0,children:(0,Z.jsx)(si,{})})}),(0,Z.jsx)(O,{path:`/work/:taskId`,element:(0,Z.jsx)($,{requireWork:!0,children:(0,Z.jsx)(si,{})})}),(0,Z.jsx)(O,{path:`/agents`,element:(0,Z.jsx)($,{requireAdmin:!0,requireAgents:!0,children:(0,Z.jsx)(ai,{})})}),(0,Z.jsx)(O,{path:`/usage`,element:(0,Z.jsx)($,{requireAdmin:!0,children:(0,Z.jsx)(li,{})})}),(0,Z.jsx)(O,{path:`/evaluations`,element:(0,Z.jsx)(ui,{})}),(0,Z.jsx)(O,{path:`/system`,element:(0,Z.jsx)($,{requireAdmin:!0,children:(0,Z.jsx)(di,{})})}),(0,Z.jsx)(O,{path:`/login`,element:(0,Z.jsx)(qr,{})})]})}),j&&r&&(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(pi,{isOpen:r,initialTab:a,onClose:()=>i(!1)})}),j&&M.open&&M.notes&&(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)($r,{notes:M.notes,onDismiss:M.dismiss})}),j&&b&&(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(mi,{})}),(0,Z.jsx)(ft,{position:B(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,Z.jsx)(wr,{onOpenSettings:()=>{o(void 0),i(!0)},onOpenSettingsTab:e=>{o(e),i(!0)}})]}):(0,Z.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center`,children:(0,Z.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,Z.jsx)(`div`,{className:`min-h-screen bg-gray-50 dark:bg-dark-50 flex items-center justify-center p-4`,children:(0,Z.jsxs)(`div`,{className:`text-center`,children:[(0,Z.jsx)(`div`,{className:`mb-8`,children:(0,Z.jsx)(Wt,{size:`lg`,className:`mx-auto text-gray-900 dark:text-white`})}),(0,Z.jsx)(`div`,{className:`flex justify-center mb-4`,children:(0,Z.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,Z.jsx)(`p`,{className:`text-gray-600 dark:text-dark-600 text-sm`,children:c>0?`Connecting to backend... (${c}/15)`:`Starting up...`})]})})},{}),errorElement:(0,Z.jsx)(nr,{})}],xi=Jr?A(bi):D(bi),Si=()=>(0,Z.jsx)(rr,{children:(0,Z.jsx)(j,{router:xi})}),Ci=new hn({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}});oe.catch(()=>{ne(`en`)}).then(()=>{gn.createRoot(document.getElementById(`root`)).render((0,Z.jsx)(X.StrictMode,{children:(0,Z.jsx)(a,{client:Ci,children:(0,Z.jsx)(Si,{})})}))}),window.addEventListener(`vite:preloadError`,e=>{let t=`libre:chunk-reload`;sessionStorage.getItem(t)||(e.preventDefault(),sessionStorage.setItem(t,String(Date.now())),window.location.reload())}),window.setTimeout(()=>{sessionStorage.removeItem(`libre:chunk-reload`)},6e4),`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/sw.js?v=0.36.0`).catch(()=>{})});
|