@yuriai/web 0.2.27 → 0.2.29-beta.4
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/dist/assets/AgentAvatar-GVufO03R.js +1 -0
- package/dist/assets/AssistantContactStatus-AG7iGeRF.js +3 -0
- package/dist/assets/{AssistantUnreadBadge-BssH-RvV.js → AssistantUnreadBadge-BMCaH0Cc.js} +1 -1
- package/dist/assets/{AssistantView-CxQv-9Ms.js → AssistantView-C5ACV-pb.js} +1 -1
- package/dist/assets/{DiagramView-DPpG0fwx.js → DiagramView-DJDzscnd.js} +1 -1
- package/dist/assets/{FadeInOnReveal-S6UbimjB.js → FadeInOnReveal-8NiBU75a.js} +1 -1
- package/dist/assets/{GuiPluginSurface-BOf0JA1T.js → GuiPluginSurface-DfLl4Gd9.js} +1 -1
- package/dist/assets/{GuiPluginWindow-OrYkfQ4m.js → GuiPluginWindow-CW0-Tapi.js} +1 -1
- package/dist/assets/{Icon-BE4mEwzV.js → Icon-CLLDJn-P.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-CBFJC_KD.js → ImageLoadingPlaceholder-DTWzB26a.js} +1 -1
- package/dist/assets/LoadingImage-B89ghYMH.js +1 -0
- package/dist/assets/MarkdownRenderer-YzZqs3v5.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-Cv6UnGG7.js → MarkdownRendererImpl-BjjAFHTQ.js} +3 -3
- package/dist/assets/MarkstreamRendererImpl-D8tam--u.js +3 -0
- package/dist/assets/{MobileDetailNavigation-CK4KbkeS.js → MobileDetailNavigation-B-AuJG6R.js} +1 -1
- package/dist/assets/{MobileResizableSheet-Deidw1br.js → MobileResizableSheet-CAj4YGtu.js} +1 -1
- package/dist/assets/{MobileShareBridge-CO_OWEfq.js → MobileShareBridge-B8X_MEk1.js} +2 -2
- package/dist/assets/MobileTabPageHeader-vvveBlBV.js +2 -0
- package/dist/assets/MultiRunWindow-C0dOS6fA.js +1 -0
- package/dist/assets/{OnboardingScreen-C8ld4wO7.js → OnboardingScreen-BdU6Tyax.js} +1 -1
- package/dist/assets/{OverlayScrollbar-B3auC2WH.js → OverlayScrollbar-CzQC0JQI.js} +1 -1
- package/dist/assets/SettingsView-C0HSdVvS.css +1 -0
- package/dist/assets/SettingsView-aWGqxCrZ.js +30 -0
- package/dist/assets/SettingsWindow-rX0TNPNO.js +1 -0
- package/dist/assets/{TerminalView-CwRB6Yyr.js → TerminalView-BArR-jEl.js} +3 -3
- package/dist/assets/ToolOutputDialog-Bdwio4o_.js +10 -0
- package/dist/assets/YuriLogo-BZC0ckt0.js +1 -0
- package/dist/assets/{appThemeRegistry-B6woJIX5.js → appThemeRegistry-DOuA757r.js} +1 -1
- package/dist/assets/appearance--vFosLNi.js +1 -0
- package/dist/assets/{assistant-attachment-cache-B_qRvy-k.js → assistant-attachment-cache-DMw2Smc8.js} +1 -1
- package/dist/assets/{button-BXxwtxsG.js → button-BF2cNEuq.js} +1 -1
- package/dist/assets/{capgoAdapter-C5HFS-rx.js → capgoAdapter-BBnW57us.js} +1 -1
- package/dist/assets/collapsible-CS5qCQRU.js +1 -0
- package/dist/assets/context-menu-C6l4ycZG.js +1 -0
- package/dist/assets/desktopRelayRestore-C7pjf6fE.js +1 -0
- package/dist/assets/{device-BcRP6Tjd.js → device-DN1GigI_.js} +1 -1
- package/dist/assets/{diagram-DyY8dxjZ.js → diagram-D9-jif9d.js} +1 -1
- package/dist/assets/dialog-r7RRePv5.js +1 -0
- package/dist/assets/{dropdown-menu.styles-DGaALKP0.js → dropdown-menu.styles-CX8oXdks.js} +1 -1
- package/dist/assets/es-C8kGYKZo.js +15 -0
- package/dist/assets/{fileMentionTouchSelection-C4dvP8GY.js → fileMentionTouchSelection-dpFpcetU.js} +2 -2
- package/dist/assets/{fileQueries-BeXkd3o6.js → fileQueries-DWj9yB2g.js} +1 -1
- package/dist/assets/{fileReferenceActions-CrIAce3K.js → fileReferenceActions-BBLYnGEx.js} +1 -1
- package/dist/assets/{fr-CEgiRlfa.js → fr-BV_9HcN9.js} +3 -3
- package/dist/assets/{gitApi-D2G9ny2O.js → gitApi-b2Mo4rXl.js} +1 -1
- package/dist/assets/{gitApiHttp-B7vYwgBh.js → gitApiHttp-DGAlAuET.js} +4 -4
- package/dist/assets/host-DB6QzbOw.js +1 -0
- package/dist/assets/image-loading-BUouaouB.js +1 -0
- package/dist/assets/input-DvF_mp0Y.js +1 -0
- package/dist/assets/insertionBoundaries-BviApxnS.js +1 -0
- package/dist/assets/{ja-CX-_p9jZ.js → ja-CIMpz4Z2.js} +3 -3
- package/dist/assets/{ko-D5xlLYJM.js → ko-DPUsuWV1.js} +3 -3
- package/dist/assets/magpie-BuRvkGVQ.svg +1 -0
- package/dist/assets/main-BchAIbLD.js +2 -0
- package/dist/assets/main-Cp31rg32.js +169 -0
- package/dist/assets/{markdownHeightCache-D2VWb_4E.js → markdownHeightCache-D02GlOiy.js} +1 -1
- package/dist/assets/{markdownTheme-hpURsgju.js → markdownTheme-CHNl6tUv.js} +1 -1
- package/dist/assets/{mcpQueries-DQ3KthDF.js → mcpQueries-Cksi876R.js} +1 -1
- package/dist/assets/miniChat-BbuRxk9z.js +2 -0
- package/dist/assets/mobile-CBiiV7GW.js +2 -0
- package/dist/assets/{mobileBackNavigation-BJqt3oHk.js → mobileBackNavigation-BsbWBz8h.js} +1 -1
- package/dist/assets/multirun-Ce977k1P.js +3 -0
- package/dist/assets/native-CILcYDJz.js +1 -0
- package/dist/assets/{native-config-BIY0Cr-l.js → native-config-5BNfonUF.js} +1 -1
- package/dist/assets/persistence-Dta0OwIa.js +3 -0
- package/dist/assets/{pl-BjH81A_q.js → pl-ChxP5OZm.js} +3 -3
- package/dist/assets/projectMeta-KTYl7ter.js +1 -0
- package/dist/assets/pt-BR-9N8nJVqC.js +15 -0
- package/dist/assets/{queue-abort-optimistic-CS5jTJq-.js → queue-abort-optimistic-CJmevpBJ.js} +1 -1
- package/dist/assets/{react-DRe85o5s.js → react-Bwr5-XPi.js} +1 -1
- package/dist/assets/readiness-CdCOcZnK.js +1 -0
- package/dist/assets/renderElectronMiniChatApp-wFpIvOFT.js +2 -0
- package/dist/assets/renderMobileApp-QJ2XwXGj.js +28 -0
- package/dist/assets/{runtime-file-download-Cf1WxfeW.js → runtime-file-download-o29morT6.js} +1 -1
- package/dist/assets/{runtime-file-resource-UJjHUF2C.js → runtime-file-resource-qB_oVdE6.js} +1 -1
- package/dist/assets/{runtimeConfig-BX8JirIc.js → runtimeConfig-IuT6iZ4x.js} +1 -1
- package/dist/assets/runtimeEndpointReset-DEWSVYyD.js +149 -0
- package/dist/assets/scheduledTaskNavigation-BqkeRfVc.js +1 -0
- package/dist/assets/sessionLookup-mvlGQJTe.js +1 -0
- package/dist/assets/sortable-tabs-strip-Dc4Jr4ml.js +1 -0
- package/dist/assets/{speechSettingsQueries-CC0fusUo.js → speechSettingsQueries-DEGyglgn.js} +2 -2
- package/dist/assets/src-DME3XM8W.css +2 -0
- package/dist/assets/{store-CkIHVrmT.js → store-BPYoxYhv.js} +4 -4
- package/dist/assets/{terminalApi-rl9mZAlB.js → terminalApi-CPVNQ5DH.js} +1 -1
- package/dist/assets/{textarea-7eTptEtD.js → textarea-CIhiRPB2.js} +1 -1
- package/dist/assets/theme-validation-BGYdrOu7.js +1 -0
- package/dist/assets/themes-BgDJcxRc.js +1 -0
- package/dist/assets/tooltip-BoAbDVNP.js +1 -0
- package/dist/assets/{touch-gestures-K2_ZOkKW.js → touch-gestures-CErgaXZ7.js} +1 -1
- package/dist/assets/types-COEinOJU.js +2 -0
- package/dist/assets/uk-C-aeGNQI.js +15 -0
- package/dist/assets/{useAppFontEffects-Ck2PdQRx.js → useAppFontEffects-C__cAJlw.js} +54 -54
- package/dist/assets/{useAssistantUIStore-CfaQV3ID.js → useAssistantUIStore-CYyXdd5c.js} +1 -1
- package/dist/assets/useDesktopWindowControlsLayout-BYt7I5so.js +1 -0
- package/dist/assets/{useEffectiveDirectory-CNCQfN_x.js → useEffectiveDirectory-CcDsvhjq.js} +1 -1
- package/dist/assets/{useFontPreferences-DeqW9nRx.js → useFontPreferences-UzjDmx4b.js} +1 -1
- package/dist/assets/useMobileNavigationStore-BgM0EvUr.js +17 -0
- package/dist/assets/{useThemeSystem-CGF5jnIh.js → useThemeSystem-CNzUUkFn.js} +1 -1
- package/dist/assets/useUIStore-BDZCXouA.js +1 -0
- package/dist/assets/{useWorkerHighlightedLines-CN_RGaSw.js → useWorkerHighlightedLines-ZOArIAed.js} +1 -1
- package/dist/assets/vendor-base-ui-CzHs0bHY.js +1 -0
- package/dist/assets/{vendor-cmdk-C3oBVL9X.js → vendor-cmdk-C_tivUtr.js} +1 -1
- package/dist/assets/vendor-codemirror-autocomplete-C0FrlFqZ.js +12 -0
- package/dist/assets/vendor-codemirror-commands-5saeUOVY.js +1 -0
- package/dist/assets/vendor-codemirror-lang-angular-Cm7vBE3E.js +23 -0
- package/dist/assets/vendor-codemirror-lang-cpp-BjixvwC2.js +1 -0
- package/dist/assets/vendor-codemirror-lang-go-DFb2d_8t.js +11 -0
- package/dist/assets/vendor-codemirror-lang-java-CHitPigf.js +1 -0
- package/dist/assets/vendor-codemirror-lang-jinja-B8yrwpok.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-json-mLulNbwB.js → vendor-codemirror-lang-json-DowyFczU.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-less-CNvptX3P.js → vendor-codemirror-lang-less-B1_0-sTl.js} +1 -1
- package/dist/assets/vendor-codemirror-lang-liquid-FIsA7YFN.js +1 -0
- package/dist/assets/vendor-codemirror-lang-markdown-npWBZIoE.js +6 -0
- package/dist/assets/vendor-codemirror-lang-php-wyEc0fdz.js +1 -0
- package/dist/assets/vendor-codemirror-lang-python-OPRdU26g.js +9 -0
- package/dist/assets/{vendor-codemirror-lang-rust-CtafR0gt.js → vendor-codemirror-lang-rust-DgovszuH.js} +1 -1
- package/dist/assets/vendor-codemirror-lang-sass-BdU-i07o.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-sql-C6q09UUZ.js → vendor-codemirror-lang-sql-DUutq98l.js} +2 -2
- package/dist/assets/{vendor-codemirror-lang-vue-DIB78UsR.js → vendor-codemirror-lang-vue-CuRNbe8H.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-wast-C_JVdOCF.js → vendor-codemirror-lang-wast-CGFAOCoB.js} +1 -1
- package/dist/assets/vendor-codemirror-lang-xml-CMKBqGXF.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-yaml-BO0hIfQM.js → vendor-codemirror-lang-yaml-CH9a1QiY.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-Ctd4WxgW.js → vendor-codemirror-language-data-B3pLWvv-.js} +2 -2
- package/dist/assets/vendor-codemirror-search-hZY-L2l8.js +2 -0
- package/dist/assets/{vendor-dnd-kit-accessibility-DxpFzZhi.js → vendor-dnd-kit-accessibility-BOtnpZt5.js} +1 -1
- package/dist/assets/{vendor-dnd-kit-core-B3g3zWQd.js → vendor-dnd-kit-core-DK4OoOTr.js} +1 -1
- package/dist/assets/{vendor-dnd-kit-sortable-BKewx0Py.js → vendor-dnd-kit-sortable-Cv69eQm1.js} +1 -1
- package/dist/assets/{vendor-framer-motion-C1twy-GF.js → vendor-framer-motion-DDMKlXiP.js} +1 -1
- package/dist/assets/vendor-lodash-es-BS45jPoZ.js +1 -0
- package/dist/assets/{vendor-markstream-react-BlbOg72y.js → vendor-markstream-react-DfLaSG3W.js} +3 -3
- package/dist/assets/vendor-motion-C9oiAdx-.js +1 -0
- package/dist/assets/{vendor-pierre-diffs-Bj9Nqn6w.js → vendor-pierre-diffs-BFiZ3IhI.js} +2 -2
- package/dist/assets/{vendor-react-D5d-V1vN.js → vendor-react-DlzBev0S.js} +1 -1
- package/dist/assets/{vendor-react-drawio-C-iPmmED.js → vendor-react-drawio-Dyg1-39Q.js} +1 -1
- package/dist/assets/vendor-reactuses-core-DWo5Wn6R.js +1 -0
- package/dist/assets/{vendor-replit-codemirror-vim-DCdAdxvE.js → vendor-replit-codemirror-vim-BmQmU1lR.js} +6 -6
- package/dist/assets/{vendor-sonner-r2EJnfoo.js → vendor-sonner-BEHGipm5.js} +1 -1
- package/dist/assets/{vendor-stream-diffs-BnLmeqg2.js → vendor-stream-diffs-wcQxoPZk.js} +2 -2
- package/dist/assets/{vendor-tanstack-react-query-C4SG3JZB.js → vendor-tanstack-react-query-B2psfNaU.js} +1 -1
- package/dist/assets/{vendor-tanstack-react-virtual-BeZn51tF.js → vendor-tanstack-react-virtual-DSFNK3qc.js} +1 -1
- package/dist/assets/{vendor-zustand-B43HCgwC.js → vendor-zustand-vDaAPGfl.js} +1 -1
- package/dist/assets/zh-CN-DOchDQti.js +15 -0
- package/dist/assets/zh-TW-Dtigv2CE.js +15 -0
- package/dist/index.html +18 -18
- package/dist/mini-chat.html +18 -18
- package/dist/mobile.html +18 -18
- package/package.json +2 -1
- package/server/lib/assistants/DOCUMENTATION.md +7 -0
- package/server/lib/assistants/channel-output.integration.test.js +15 -1
- package/server/lib/assistants/harness.js +1 -0
- package/server/lib/assistants/harness.test.js +16 -0
- package/server/lib/config-sync/DOCUMENTATION.md +1 -0
- package/server/lib/config-sync/config-sync.test.js +22 -0
- package/server/lib/config-sync/constants.js +0 -3
- package/server/lib/gui-customization/DOCUMENTATION.md +45 -0
- package/server/lib/gui-customization/session-skill.js +58 -0
- package/server/lib/gui-customization/session-skill.test.js +53 -0
- package/server/lib/gui-customization/skill/SKILL.md +33 -0
- package/server/lib/gui-customization/skill/references/appearance.md +79 -0
- package/server/lib/gui-customization/skill/references/file-previews.md +113 -0
- package/server/lib/gui-customization/skill/references/global-pages.md +81 -0
- package/server/lib/gui-customization/skill/references/gui-api.md +37 -0
- package/server/lib/gui-customization/skill/references/preview-exports.md +74 -0
- package/server/lib/gui-customization/skill/references/workflow.md +81 -0
- package/server/lib/opencode/DOCUMENTATION.md +74 -1
- package/server/lib/opencode/config-entity-routes.js +2 -4
- package/server/lib/opencode/config-entity-routes.test.js +16 -13
- package/server/lib/opencode/core-routes.js +2 -0
- package/server/lib/opencode/core-routes.test.js +2 -2
- package/server/lib/opencode/custom-provider-models.d.ts +2 -0
- package/server/lib/opencode/custom-provider-models.js +71 -0
- package/server/lib/opencode/custom-provider-models.test.js +90 -0
- package/server/lib/opencode/custom-provider.d.ts +2 -0
- package/server/lib/opencode/custom-provider.js +107 -0
- package/server/lib/opencode/custom-provider.test.js +211 -0
- package/server/lib/opencode/feature-routes-runtime.js +5 -0
- package/server/lib/opencode/provider-catalog.js +14 -0
- package/server/lib/opencode/provider-catalog.test.js +15 -0
- package/server/lib/opencode/provider-configuration.test.js +64 -0
- package/server/lib/opencode/provider-model-config.d.ts +1 -0
- package/server/lib/opencode/provider-model-config.js +39 -0
- package/server/lib/opencode/provider-model-config.test.js +69 -0
- package/server/lib/opencode/provider-sources.d.ts +10 -0
- package/server/lib/opencode/provider-sources.js +52 -0
- package/server/lib/opencode/provider-sources.test.js +73 -0
- package/server/lib/opencode/providers.d.ts +5 -0
- package/server/lib/opencode/providers.js +28 -0
- package/server/lib/opencode/routes.js +50 -1
- package/server/lib/remote-desktop/DOCUMENTATION.md +6 -2
- package/server/lib/remote-desktop/runtime.js +3 -2
- package/server/lib/remote-desktop/runtime.test.js +20 -0
- package/server/lib/scheduled-tasks/session-skill.js +3 -0
- package/server/lib/scheduled-tasks/session-skill.test.js +4 -2
- package/shared/custom-provider-protocol.d.ts +4 -0
- package/shared/custom-provider-protocol.js +32 -0
- package/dist/assets/AgentAvatar-DNm_jMna.js +0 -1
- package/dist/assets/AssistantContactStatus-BPRpgMFh.js +0 -3
- package/dist/assets/LoadingImage-NLq7_P-i.js +0 -1
- package/dist/assets/MarkdownRenderer-BaMotAOQ.js +0 -2
- package/dist/assets/MarkstreamRendererImpl-Rb9O6wkW.js +0 -3
- package/dist/assets/MobileTabPageHeader-DbC8L6A4.js +0 -2
- package/dist/assets/MultiRunWindow-DtVW9NTV.js +0 -1
- package/dist/assets/SettingsView-BRIvklfP.css +0 -1
- package/dist/assets/SettingsView-Cm7woZWl.js +0 -29
- package/dist/assets/SettingsWindow-CdL4PFxW.js +0 -1
- package/dist/assets/ToolOutputDialog-B4BfmoVH.js +0 -10
- package/dist/assets/YuriLogo-BOx0s0Ue.js +0 -1
- package/dist/assets/collapsible-BEm0787p.js +0 -1
- package/dist/assets/context-menu-DUwvVUDY.js +0 -1
- package/dist/assets/desktopRelayRestore-D1UX7HW2.js +0 -1
- package/dist/assets/dialog-CLca6ojn.js +0 -1
- package/dist/assets/es-CrsHvgue.js +0 -15
- package/dist/assets/host-CnVx34Dh.js +0 -1
- package/dist/assets/image-loading-D5UhMj7Z.js +0 -1
- package/dist/assets/input-D59Q2pm8.js +0 -1
- package/dist/assets/insertionBoundaries-CedfTSM5.js +0 -1
- package/dist/assets/main-CxpUooVS.js +0 -2
- package/dist/assets/main-Dpm4KxWX.js +0 -169
- package/dist/assets/miniChat-CTdj8Ug9.js +0 -2
- package/dist/assets/mobile-ChbA3Q8j.js +0 -2
- package/dist/assets/multirun-BILeETbd.js +0 -3
- package/dist/assets/native-BYMhr-xH.js +0 -1
- package/dist/assets/persistence-CWuLIq1J.js +0 -3
- package/dist/assets/projectMeta-B9_Uh8YH.js +0 -1
- package/dist/assets/pt-BR-Dp5oK2x3.js +0 -15
- package/dist/assets/readiness-BNIgH81X.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-asOqV7FB.js +0 -2
- package/dist/assets/renderMobileApp-DAfque7-.js +0 -28
- package/dist/assets/runtimeEndpointReset-CFQgUiUr.js +0 -149
- package/dist/assets/scheduledTaskNavigation-EomDNVu2.js +0 -1
- package/dist/assets/sessionLookup-BxAaxPOw.js +0 -1
- package/dist/assets/sortable-tabs-strip-DpbW5MqX.js +0 -1
- package/dist/assets/src-BMKjN2ip.css +0 -2
- package/dist/assets/tooltip-BPwoSTzO.js +0 -1
- package/dist/assets/types-CUtSV1V8.js +0 -2
- package/dist/assets/uk-BEfkaLtM.js +0 -15
- package/dist/assets/useDesktopWindowControlsLayout-DxxOUZj1.js +0 -1
- package/dist/assets/useMobileNavigationStore-BmVr5a5c.js +0 -17
- package/dist/assets/useUIStore-C6CE42oh.js +0 -1
- package/dist/assets/vendor-base-ui-BQjbsJ43.js +0 -1
- package/dist/assets/vendor-codemirror-autocomplete-7c2L_4dM.js +0 -12
- package/dist/assets/vendor-codemirror-commands-B8KrBQ9B.js +0 -1
- package/dist/assets/vendor-codemirror-lang-angular-DXOgWEVj.js +0 -23
- package/dist/assets/vendor-codemirror-lang-cpp-Dh8C3xqP.js +0 -1
- package/dist/assets/vendor-codemirror-lang-go-BXAJ1_dh.js +0 -11
- package/dist/assets/vendor-codemirror-lang-java-DAyCHRhk.js +0 -1
- package/dist/assets/vendor-codemirror-lang-jinja-0TICrMfO.js +0 -1
- package/dist/assets/vendor-codemirror-lang-liquid-8g5seytq.js +0 -1
- package/dist/assets/vendor-codemirror-lang-markdown-CV1IO6Qs.js +0 -6
- package/dist/assets/vendor-codemirror-lang-php-xP7rf28_.js +0 -1
- package/dist/assets/vendor-codemirror-lang-python-YM2WVLHF.js +0 -9
- package/dist/assets/vendor-codemirror-lang-sass-B4iav_Ps.js +0 -1
- package/dist/assets/vendor-codemirror-lang-xml-DIuzY_d4.js +0 -1
- package/dist/assets/vendor-codemirror-search-DiPwvA-6.js +0 -2
- package/dist/assets/vendor-lodash-es-DfLbG5Af.js +0 -1
- package/dist/assets/vendor-motion-BmLx2V78.js +0 -1
- package/dist/assets/vendor-reactuses-core-BcebBLwF.js +0 -1
- package/dist/assets/zh-CN-DipfA56P.js +0 -15
- package/dist/assets/zh-TW-B7pXMVjt.js +0 -15
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-hePW80VL.js";import{r as t}from"./useUIStore-BDZCXouA.js";var n=`yuri:close-embedded-session-chat`,r=`yuri:embedded-visibility`,i=`yuri:embedded-visibility-request`,a=e=>new URLSearchParams(e).get(`yuriPanel`)===`session-chat`,o=(e,t,n)=>JSON.stringify({sessionID:e,directory:t||``,readOnly:n===!0}),s=(e,t,n,r)=>{if(typeof window>`u`)return``;let i=new URL(window.location.pathname,window.location.origin);return i.searchParams.set(`yuriPanel`,`session-chat`),i.searchParams.set(`surface`,`desktop`),i.searchParams.set(`sessionId`,e),n?i.searchParams.set(`readOnly`,`1`):i.searchParams.delete(`readOnly`),t&&t.trim().length>0?i.searchParams.set(`directory`,t):i.searchParams.delete(`directory`),i.searchParams.set(`themeMode`,r.mode),i.searchParams.set(`lightThemeId`,r.lightThemeId),i.searchParams.set(`darkThemeId`,r.darkThemeId),i.searchParams.set(`themeVariant`,r.currentTheme.metadata.variant===`dark`?`dark`:`light`),i.searchParams.set(`currentTheme`,JSON.stringify(r.currentTheme)),i.hash=``,i.toString()},c=(e,t,n,r,i,a)=>{let c=o(n,r,i),l=e.get(t);if(l?.signature===c)return l.src;let u=s(n,r,i,a);return e.set(t,{signature:c,src:u}),u},l=null,u=()=>{if(l!==null)return l;if(typeof window>`u`)return l=!1,!1;try{return l=new URLSearchParams(window.location.search).get(`yuriPanel`)===`session-chat`,l}catch{return l=!1,!1}},d=()=>{if(!u())return null;try{let e=new URLSearchParams(window.location.search).get(`sessionId`);return e&&e.trim().length>0?e.trim():null}catch{return null}},f=[`connection`,`personalization`,`workspace`,`opencode`,`content`,`system`],p=[`instances`,`appearance`,`chat`,`notifications`,`sessions`,`archived-sessions`,`summary-ai`,`shortcuts`,`projects`,`git`,`remote-instances`,`providers`,`agents`,`assistants`,`behavior`,`commands`,`mcp`,`plugins`,`global-config`,`magic-prompts`,`skills.installed`,`skills.catalog`,`usage`,`voice`,`about`],m=[`instances`,`appearance`,`chat`,`notifications`,`sessions`,`archived-sessions`,`summary-ai`,`projects`,`git`,`providers`,`agents`,`assistants`,`behavior`,`commands`,`mcp`,`plugins`,`magic-prompts`,`skills.installed`,`usage`,`voice`,`about`],h=[{slug:`home`,title:`Settings`,group:`personalization`,kind:`single`,description:`Search and jump to common pages.`,keywords:[`search`,`settings`]},{slug:`projects`,title:`Projects`,group:`workspace`,kind:`split`,keywords:[`project`,`projects`,`worktree`,`worktrees`,`repo`,`repository`,`directory`]},{slug:`instances`,title:`Switch instance`,group:`connection`,kind:`single`,keywords:[`instance`,`instances`,`server`,`connection`,`switch`],isAvailable:e=>e.isMobile},{slug:`remote-instances`,title:`Remote Instances`,group:`workspace`,kind:`single`,keywords:[`ssh`,`remote`,`instances`,`forwarding`,`connection`],isAvailable:e=>!e.isVSCode},{slug:`providers`,title:`Providers`,group:`opencode`,kind:`split`,keywords:[`provider`,`providers`,`models`,`model`,`api key`,`api keys`,`openai`,`anthropic`,`ollama`,`credentials`]},{slug:`usage`,title:`Usage`,group:`system`,kind:`split`,keywords:[`quota`,`billing`,`tokens`,`usage`,`limits`]},{slug:`agents`,title:`Agents`,group:`opencode`,kind:`split`,keywords:[`agent`,`agents`,`prompts`,`tools`,`permissions`]},{slug:`assistants`,title:`Bots`,group:`opencode`,kind:`split`,keywords:[`bot`,`bots`,`assistant`,`assistants`,`sharing`]},{slug:`behavior`,title:`Behavior`,group:`opencode`,kind:`single`,keywords:[`behavior`,`agents.md`,`system prompt`,`global rules`,`instructions`,`override`]},{slug:`commands`,title:`Commands`,group:`opencode`,kind:`split`,keywords:[`command`,`commands`,`slash`,`macros`,`automation`]},{slug:`mcp`,title:`MCP`,group:`opencode`,kind:`split`,keywords:[`mcp`,`model context protocol`,`servers`,`tools`,`remote`,`stdio`]},{slug:`plugins`,title:`Plugins`,group:`opencode`,kind:`split`,keywords:[`plugin`,`plugins`,`extensions`,`addons`,`npm`,`opencode-wakatime`]},{slug:`global-config`,title:`Global Configuration`,group:`opencode`,kind:`single`,keywords:[`global`,`configuration`,`opencode.json`,`opencode.jsonc`]},{slug:`skills.installed`,title:`Skills`,group:`content`,kind:`split`,keywords:[`skill`,`skills`,`instructions`,`install`,`catalog`]},{slug:`skills.catalog`,title:`Skills Catalog`,group:`content`,kind:`single`,keywords:[`install`,`catalog`,`external`,`repository`,`skills catalog`]},{slug:`git`,title:`Git`,group:`workspace`,kind:`single`,keywords:[`git`,`github`,`identity`,`identities`,`ssh`,`profiles`,`credentials`,`keys`,`commit`,`gitmoji`,`oauth`,`prs`,`issues`],isAvailable:e=>!e.isVSCode},{slug:`appearance`,title:`Appearance`,group:`personalization`,kind:`single`,keywords:[`theme`,`font`,`spacing`,`padding`,`corner radius`,`radius`,`input bar`,`keyboard`,`viewport`,`mobile`,`terminal`,`pwa`,`install name`,`app shortcuts`]},{slug:`chat`,title:`Chat`,group:`personalization`,kind:`single`,keywords:[`tools`,`diff`,`reasoning`,`dotfiles`,`draft`,`queue`,`output`,`copy`,`image`,`split messages`,`message actions`]},{slug:`shortcuts`,title:`Shortcuts`,group:`personalization`,kind:`single`,keywords:[`keyboard`,`hotkeys`,`shortcuts`,`bindings`],isAvailable:e=>!e.isVSCode},{slug:`sessions`,title:`Sessions`,group:`personalization`,kind:`single`,keywords:[`defaults`,`default agent`,`default model`,`retention`,`memory`,`limits`,`zen`]},{slug:`archived-sessions`,title:`Archived sessions`,group:`personalization`,kind:`single`,keywords:[`archive`,`archived`,`restore`,`preview`,`history`]},{slug:`summary-ai`,title:`Summary AI`,group:`personalization`,kind:`single`,keywords:[`summary`,`commit`,`session title`,`prompt`,`provider`,`custom api`,`base url`,`api token`]},{slug:`magic-prompts`,title:`Magic Prompts`,group:`content`,kind:`split`,keywords:[`prompts`,`templates`,`git`,`github`,`review`,`commit`,`pull request`],isAvailable:e=>!e.isVSCode},{slug:`notifications`,title:`Notifications`,group:`personalization`,kind:`single`,keywords:[`alerts`,`native`,`summary`,`summarization`]},{slug:`voice`,title:`Voice`,group:`system`,kind:`single`,keywords:[`tts`,`speech`,`voice`],isAvailable:e=>!e.isVSCode},{slug:`about`,title:`About`,group:`system`,kind:`single`,keywords:[`about`,`version`,`updates`,`release`,`changelog`],isAvailable:e=>e.isMobile||e.isDesktop}];function g(e){let t=new Map(p.map((e,t)=>[e,t])),n=new Map;for(let t of e){let e=n.get(t.group)??[];e.push(t),n.set(t.group,e)}return f.flatMap(e=>{let r=n.get(e);return r?.length?[{group:e,pages:r.sort((e,n)=>(t.get(e.slug)??999)-(t.get(n.slug)??999))}]:[]})}var _={sessions:`sessions`,agents:`agents`,commands:`commands`,mcp:`mcp`,skills:`skills.installed`,providers:`providers`,usage:`usage`,"git-identities":`git`,settings:`home`};function v(e){let t=e.trim().toLowerCase();return h.find(e=>e.slug===t)??null}function y(e){let t=(e??``).trim().toLowerCase();if(!t)return`home`;let n=_[t];if(n)return n;let r=v(t);return r?r.slug:`home`}var b=`schedule`,x=[`git`,`diff`,`terminal`,`files`,`diagram`],S=[`tasks`,`history`],C=`/session/new`,w=new Set(x),T=new Set(S),E=new Set([`staged`,`working`,`turn`]);function D(e){return!e||e===`chat`?`chat`:e===`scheduled`||e===`schedule`?b:e===`assistant`?`assistant`:w.has(e)?e:`chat`}function O(e){return y(e)}function k(e){return e&&T.has(e)?e:null}function A(e){return e&&E.has(e)?e:null}function j(){return C}function M(e,t){return`/plugins/${encodeURIComponent(e)}/${encodeURIComponent(t)}`}function N(e,t){let n=O(typeof e==`string`?e:e.slug),r=typeof e==`string`?t:e.entityId,i=`/settings/${n}`;return r&&r.trim().length>0?`${i}/${encodeURIComponent(r.trim())}`:i}function P(e,t){return t&&t.trim().length>0?`${e}/agent/${encodeURIComponent(t.trim())}`:e}function F(e={}){let t=k(e.scheduleView??e.scheduledView)??`tasks`,n=e.scheduleProjectId??e.scheduledProjectId??null,r=e.scheduleTaskId??e.scheduledTaskId??null,i;return i=n&&r?`/schedule/tasks/${encodeURIComponent(n)}/${encodeURIComponent(r)}`:t===`history`?`/schedule/history`:`/schedule`,P(i,e.focusSessionId)}function I(e={}){let t=`/assistant`;return e.assistantId&&e.assistantId.trim().length>0&&(t=`/assistant/${encodeURIComponent(e.assistantId.trim())}`),P(t,e.focusSessionId)}function L(e){let t=encodeURIComponent(e.sessionId),n=D(e.tab);if(n===`schedule`)return F({});if(n===`assistant`)return I({});let r;r=n===`chat`?`/session/${t}`:`/session/${t}/${n}`;let i=new URLSearchParams;e.file&&i.set(`file`,e.file);let a=A(e.scope);a&&i.set(`scope`,a);let o=i.toString();return o?`${r}?${o}`:r}function R(e){let t=D(e.tab);return t===`schedule`?F({scheduleView:e.scheduleView??e.scheduledView,scheduleProjectId:e.scheduleProjectId??e.scheduledProjectId,scheduleTaskId:e.scheduleTaskId??e.scheduledTaskId,focusSessionId:e.focusSessionId}):t===`assistant`?I({assistantId:e.assistantId,focusSessionId:e.focusSessionId}):e.sessionId&&e.sessionId.trim().length>0?L({sessionId:e.sessionId.trim(),tab:t,file:e.file,scope:e.scope}):`/`}function z(e){let t=new URLSearchParams(e.startsWith(`?`)?e.slice(1):e);return{file:t.get(`file`),scope:A(t.get(`scope`))}}function B(e){let t=e.indexOf(`agent`);return t>=0&&e[t+1]?{rest:e.slice(0,t),focusSessionId:decodeURIComponent(e[t+1])}:{rest:e,focusSessionId:null}}function V(e,t){let n=e[1];return n?n===`history`?{kind:`schedule`,scheduleView:`history`,scheduleProjectId:null,scheduleTaskId:null,focusSessionId:t}:n===`tasks`&&e[2]&&e[3]?{kind:`schedule`,scheduleView:`tasks`,scheduleProjectId:decodeURIComponent(e[2]),scheduleTaskId:decodeURIComponent(e[3]),focusSessionId:t}:{kind:`schedule`,scheduleView:`tasks`,scheduleProjectId:null,scheduleTaskId:null,focusSessionId:t}:{kind:`schedule`,scheduleView:`tasks`,scheduleProjectId:null,scheduleTaskId:null,focusSessionId:t}}function H(e){let t=e,n=``,r=e.indexOf(`?`);r>=0&&(t=e.slice(0,r),n=e.slice(r));let i=t.indexOf(`#`);if(i>=0&&(t=t.slice(0,i)),t===`/session/new`||t===`/new`||t===`/session/new/`)return{kind:`new`};if(t===`/connect`)return{kind:`connect`};let a=t.match(/^\/plugins\/([^/]+)\/([^/]+)\/?$/);if(a)try{return{kind:`plugin`,pluginId:decodeURIComponent(a[1]),pageId:decodeURIComponent(a[2])}}catch{return{kind:`unknown`}}let o=t.match(/^\/settings(?:\/([^/]+)(?:\/([^/]+))?)?$/);if(o)return{kind:`settings`,slug:O(o[1]??`home`),entityId:o[2]?decodeURIComponent(o[2]):null};let s=t.split(`/`).filter(Boolean);if(s.length===0)return{kind:`unknown`};let{rest:c,focusSessionId:l}=B(s),u=c[0];if(u===`schedule`||u===`scheduled`)return V(c,l);if(u===`assistant`)return{kind:`assistant`,assistantId:c[1]?decodeURIComponent(c[1]):null,focusSessionId:l};if(u===`session`){let e=c[1]?decodeURIComponent(c[1]):``;if(!e)return{kind:`unknown`};if(e===`new`)return{kind:`new`};let{file:t,scope:r}=z(n),i=c[2];if(i===`schedule`||i===`scheduled`)return V(c.slice(2),l);if(i===`assistant`)return{kind:`assistant`,assistantId:c[3]?decodeURIComponent(c[3]):null,focusSessionId:l};if(!i)return{kind:`session`,sessionId:e,tab:`chat`,file:t,scope:r};let a=D(i);return a===`chat`&&i!==`chat`?{kind:`session`,sessionId:e,tab:`chat`,file:t,scope:r}:{kind:`session`,sessionId:e,tab:a,file:t,scope:r}}return{kind:`unknown`}}function U(e){return typeof window>`u`?G():W(e===void 0?`${window.location.pathname}${window.location.search}`:`${window.location.pathname}?${e.toString()}`)}function W(e){let t=H(e);switch(t.kind){case`plugin`:return{...G(),tab:`plugin`,guiPageKey:JSON.stringify([t.pluginId,t.pageId])};case`new`:return{...G(),isNewSession:!0,tab:`chat`};case`session`:{let e=t.tab;return{sessionId:t.sessionId,isNewSession:!1,tab:e===`chat`?null:e,settingsPath:null,settingsEntityId:null,diffFile:t.file,diffScope:t.scope,scheduleView:null,scheduleProjectId:null,scheduleTaskId:null,assistantId:null,focusSessionId:null}}case`schedule`:return{sessionId:null,isNewSession:!1,tab:b,settingsPath:null,settingsEntityId:null,diffFile:null,diffScope:null,scheduleView:t.scheduleView,scheduleProjectId:t.scheduleProjectId,scheduleTaskId:t.scheduleTaskId,assistantId:null,focusSessionId:t.focusSessionId};case`assistant`:return{sessionId:null,isNewSession:!1,tab:`assistant`,settingsPath:null,settingsEntityId:null,diffFile:null,diffScope:null,scheduleView:null,scheduleProjectId:null,scheduleTaskId:null,assistantId:t.assistantId,focusSessionId:t.focusSessionId};case`settings`:return{sessionId:null,isNewSession:!1,tab:null,settingsPath:t.slug,settingsEntityId:t.entityId,diffFile:null,diffScope:null,scheduleView:null,scheduleProjectId:null,scheduleTaskId:null,assistantId:null,focusSessionId:null};default:return G()}}function G(){return{sessionId:null,isNewSession:!1,tab:null,settingsPath:null,settingsEntityId:null,diffFile:null,diffScope:null,scheduleView:null,scheduleProjectId:null,scheduleTaskId:null,assistantId:null,focusSessionId:null}}function K(){if(typeof window>`u`)return!1;try{let e=H(`${window.location.pathname}${window.location.search}`);return e.kind===`session`||e.kind===`new`||e.kind===`schedule`||e.kind===`assistant`||e.kind===`plugin`||e.kind===`settings`||e.kind===`connect`}catch{return!1}}function q(e){if(e.isSettingsOpen)return N({slug:e.settingsPath.trim().length>0?e.settingsPath:`home`,entityId:e.settingsEntityId??null});if(e.tab===`schedule`)return R({tab:b,scheduleView:e.scheduleView,scheduleProjectId:e.scheduleProjectId,scheduleTaskId:e.scheduleTaskId,focusSessionId:e.focusSessionId});if(e.tab===`plugin`){try{let t=JSON.parse(e.guiPageKey??`null`);if(Array.isArray(t)&&t.length===2&&t.every(e=>typeof e==`string`&&e))return M(t[0],t[1])}catch{}return`/`}if(e.tab===`assistant`)return R({tab:`assistant`,assistantId:e.assistantId,focusSessionId:e.focusSessionId});if((e.isNewSession||!e.sessionId&&e.tab===`chat`)&&e.isNewSession)return j();if(e.sessionId&&e.sessionId.trim().length>0&&e.sessionId!==`new`){let t=new Set([`diff`,`files`,`diagram`]).has(e.tab)&&e.diffFile?e.diffFile:null;return R({sessionId:e.sessionId.trim(),tab:e.tab,file:t,scope:e.tab===`diff`?e.diffScope??null:null})}return e.isNewSession?j():`/`}function J(e){if(typeof window>`u`)return!0;try{let t=`${window.location.pathname}${window.location.search}`,n=q(e);return JSON.stringify(H(t))===JSON.stringify(H(n))}catch{return!0}}function Y(e,t={}){if(!(typeof window>`u`)&&!(X()||u())&&!(!t.force&&J(e)))try{let n=q(e);t.replace?window.history.replaceState({...window.history.state,route:e},``,n):window.history.pushState({route:e},``,n)}catch{}}function X(){return typeof window>`u`?!1:window.__VSCODE_CONFIG__!==void 0}var Z=e({openScheduledTask:()=>Q});function Q(e,n){let r=t.getState();r.setActiveMainTab(`schedule`)&&(r.setSettingsDialogOpen(!1),Y({sessionId:null,tab:`schedule`,isSettingsOpen:!1,settingsPath:r.settingsPage,diffFile:null,scheduleView:`tasks`,scheduleProjectId:e,scheduleTaskId:n}),r.setScheduledTaskOpenRequest({projectId:e,taskId:n}),r.isMobile&&r.setScheduledTasksDialogOpen(!0))}export{a as _,U as a,v as c,n as d,r as f,u as g,c as h,K as i,g as l,d as m,Z as n,m as o,i as p,Y as r,h as s,Q as t,y as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{w as t}from"./desktop-JwYqThiw.js";import{at as n,ot as r,st as i}from"./vendor-base-ui-CzHs0bHY.js";import{At as a}from"./gitApiHttp-DGAlAuET.js";import{ct as o,dt as s,it as c,lt as l,rt as u}from"./persistence-Dta0OwIa.js";import{n as d}from"./vendor-react-DlzBev0S.js";import{a as f,n as p}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as m,t as h}from"./platform-DFJEtBlo.js";import{i as g,m as _}from"./vendor-reactuses-core-DWo5Wn6R.js";import{f as v,r as y,t as b}from"./button-BF2cNEuq.js";import{Gr as x,Jr as S,Qr as C,ei as ee,wi as te,yi as w}from"./useMobileNavigationStore-BgM0EvUr.js";import{n as T}from"./Icon-CLLDJn-P.js";import{r as E}from"./themes-BgDJcxRc.js";import{t as D}from"./MobileResizableSheet-CAj4YGtu.js";import{a as ne,o as O}from"./dropdown-menu.styles-CX8oXdks.js";import{t as k}from"./LoadingImage-B89ghYMH.js";import{t as A}from"./textarea-CIhiRPB2.js";var j=e(i(),1),M=d(),N=r(),re=e(n(),1),ie=f(`YuriMedia`);function P(e){return e.platform===`android`||/Android/i.test(e.userAgent)||e.userAgentDataPlatform===`Android`}function ae(){if(typeof window>`u`)return!1;let e=navigator.userAgentData;return P({platform:h(),userAgent:navigator.userAgent||``,userAgentDataPlatform:e?.platform})}function F(){return m()&&p.getPlatform()===`android`&&p.isPluginAvailable(`YuriMedia`)}async function oe(e){if(!F())return null;let t=await ie.pickMedia({limit:e});if(t.cancelled)return[];let n=[];for(let e of t.files){let t=await fetch(p.convertFileSrc(e.path));if(!t.ok)throw Error(`Native media fetch failed (${t.status})`);let r=await t.blob();n.push(new File([r],e.name,{type:e.mimeType}))}return n}var I=`h-auto min-h-12 w-full justify-start gap-3 rounded-none supports-[corner-shape:squircle]:rounded-none px-4 border-b border-[var(--surface-subtle)] last:border-b-0`,se=e=>{let t=(0,M.c)(38),{id:n,open:r,onOpenChange:i,onPickPhotos:a,onPickFiles:o}=e,{t:s}=v(),c;t[0]===s?c=t[1]:(c=s(`chat.chatInput.actions.addAttachment`),t[0]=s,t[1]=c);let l;t[2]===c?l=t[3]:(l=(0,N.jsx)(`h2`,{className:`truncate typography-ui-label font-semibold`,children:c}),t[2]=c,t[3]=l);let u;t[4]===s?u=t[5]:(u=s(`chat.chatInput.actions.addAttachment`),t[4]=s,t[5]=u);let d;t[6]===s?d=t[7]:(d=s(`mobile.surface.closeAria`),t[6]=s,t[7]=d);let f;t[8]===s?f=t[9]:(f=s(`mobile.sessions.sheet.resizeAria`),t[8]=s,t[9]=f);let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,N.jsx)(T,{name:`file-image`,className:`size-5 flex-shrink-0 text-muted-foreground`}),t[10]=p):p=t[10];let m;t[11]===s?m=t[12]:(m=s(`chat.chatInput.actions.attachPhotos`),t[11]=s,t[12]=m);let h;t[13]===m?h=t[14]:(h=(0,N.jsx)(`span`,{className:`truncate`,children:m}),t[13]=m,t[14]=h);let g;t[15]!==a||t[16]!==h?(g=(0,N.jsxs)(b,{type:`button`,variant:`ghost`,size:`lg`,className:I,"data-mobile-press-feedback":`none`,onClick:a,children:[p,h]}),t[15]=a,t[16]=h,t[17]=g):g=t[17];let _;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,N.jsx)(T,{name:`attachment-2`,className:`size-5 flex-shrink-0 text-muted-foreground`}),t[18]=_):_=t[18];let y;t[19]===s?y=t[20]:(y=s(`chat.chatInput.actions.attachFiles`),t[19]=s,t[20]=y);let x;t[21]===y?x=t[22]:(x=(0,N.jsx)(`span`,{className:`truncate`,children:y}),t[21]=y,t[22]=x);let S;t[23]!==o||t[24]!==x?(S=(0,N.jsxs)(b,{type:`button`,variant:`ghost`,size:`lg`,className:I,"data-mobile-press-feedback":`none`,onClick:o,children:[_,x]}),t[23]=o,t[24]=x,t[25]=S):S=t[25];let C;t[26]!==S||t[27]!==g?(C=(0,N.jsx)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto overscroll-contain px-3 pb-3`,children:(0,N.jsxs)(`div`,{className:`overflow-hidden rounded-2xl bg-[var(--surface-muted)]`,"data-page-scroll-lock":`true`,children:[g,S]})}),t[26]=S,t[27]=g,t[28]=C):C=t[28];let ee;return t[29]!==n||t[30]!==i||t[31]!==r||t[32]!==C||t[33]!==l||t[34]!==u||t[35]!==d||t[36]!==f?(ee=(0,N.jsx)(D,{id:n,open:r,onOpenChange:i,title:l,ariaLabel:u,closeAriaLabel:d,resizeAriaLabel:f,fitContent:!0,children:C}),t[29]=n,t[30]=i,t[31]=r,t[32]=C,t[33]=l,t[34]=u,t[35]=d,t[36]=f,t[37]=ee):ee=t[37],ee},L={glyph:`_glyph_1xs2e_1`,lens:`_lens_1xs2e_12`,shape:`_shape_1xs2e_21`,revolve:`_revolve_1xs2e_1`};function ce(e){let t=(0,M.c)(18),{decorative:n,size:r}=e,i=n!==void 0&&n,a=r===void 0?20:r,{t:o}=v(),s;t[0]===a?s=t[1]:(s={width:a,height:a},t[0]=a,t[1]=s);let c=i||void 0,l=i?void 0:`img`,u;t[2]!==i||t[3]!==o?(u=i?void 0:o(`common.loading`),t[2]=i,t[3]=o,t[4]=u):u=t[4];let d=`scale(${a/28})`,f;t[5]===d?f=t[6]:(f={transform:d},t[5]=d,t[6]=f);let p,m,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,N.jsx)(`span`,{className:L.shape}),p=(0,N.jsx)(`span`,{className:L.shape}),m=(0,N.jsx)(`span`,{className:L.shape}),t[7]=p,t[8]=m,t[9]=h):(p=t[7],m=t[8],h=t[9]);let g;t[10]===f?g=t[11]:(g=(0,N.jsxs)(`span`,{className:L.lens,style:f,children:[h,p,m]}),t[10]=f,t[11]=g);let _;return t[12]!==g||t[13]!==s||t[14]!==c||t[15]!==l||t[16]!==u?(_=(0,N.jsx)(`span`,{"data-dictation-loading":!0,className:L.glyph,style:s,"aria-hidden":c,role:l,"aria-label":u,children:g}),t[12]=g,t[13]=s,t[14]=c,t[15]=l,t[16]=u,t[17]=_):_=t[17],_}var R=E(!1).colors,le=`M-50 74.564 A600 600 0 0 1 147.707 22.283 A38 38 0 0 1 154.330 97.994 A524 524 0 0 0 -18.333 143.653 Z`,ue=`M450 74.564 A600 600 0 0 0 252.293 22.283 A38 38 0 0 0 245.670 97.994 A524 524 0 0 1 418.333 143.653 Z`,de={colorScheme:`light`,"--surface-background":R.surface.background,"--surface-foreground":R.surface.foreground,"--primary-base":R.primary.base,"--foreground":R.surface.background,"--interactive-hover":`color-mix(in srgb, var(--surface-background) 12%, transparent)`,"--interactive-active":`color-mix(in srgb, var(--surface-background) 20%, transparent)`,"--ring":R.interactive.focusRing,"--status-error":R.status.error};function fe(e){let t=(0,M.c)(85),{containerRef:n,disabled:r,onInsert:i,onSend:a,onRelease:o,onError:s,onHintChange:c}=e,{t:l}=v(),[u,d]=(0,j.useState)(!1),[f,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(`send`),_=(0,j.useRef)(null),y=(0,j.useRef)(null),b=(0,j.useRef)(`insert`),x=(0,j.useRef)(null),S=(0,j.useId)(),C=(0,j.useId)(),te=(0,j.useId)(),w;t[0]!==i||t[1]!==a?(w=e=>b.current===`send`?a(e):i(e),t[0]=i,t[1]=a,t[2]=w):w=t[2];let T;t[3]!==s||t[4]!==w?(T={onTranscript:w,onError:s},t[3]=s,t[4]=w,t[5]=T):T=t[5];let E=ne(T),{status:D,isStarting:O,partialTranscript:k,error:A,volume:ie}=E,P=g(c),ae=u?m===`cancel`?`cancelling`:m===`edit`?`editing`:`recording`:f?`processing`:null,F,oe;t[6]!==ae||t[7]!==P?(F=()=>{P(ae)},oe=[ae,P],t[6]=ae,t[7]=P,t[8]=F,t[9]=oe):(F=t[8],oe=t[9]),(0,j.useEffect)(F,oe);let I,se;t[10]===P?(I=t[11],se=t[12]):(I=()=>()=>P(null),se=[P],t[10]=P,t[11]=I,t[12]=se),(0,j.useEffect)(I,se);let L;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{y.current&&clearTimeout(y.current),y.current=null},t[13]=L):L=t[13];let R=g(L),fe;t[14]!==n||t[15]!==r?(fe=e=>{if(r||!(e instanceof HTMLElement))return null;let t=n.current?.querySelector(`textarea`);return!t||t.value!==``||t.disabled||t.readOnly||t.ownerDocument.activeElement===t||e!==t&&!e.closest(`[data-yuri-composer-compact-surface]`)||e.closest(`button, [data-composer-action]`)?null:t},t[14]=n,t[15]=r,t[16]=fe):fe=t[16];let B=g(fe),pe;t[17]!==R||t[18]!==E||t[19]!==A||t[20]!==f||t[21]!==D?(pe=()=>{f||(R(),_.current=null,d(!1),h(`send`),D===`failed`||D===`idle`&&A?E.discardFailedDictation():E.cancelDictation())},t[17]=R,t[18]=E,t[19]=A,t[20]=f,t[21]=D,t[22]=pe):pe=t[22];let V=g(pe),H;t[23]!==E||t[24]!==r||t[25]!==B||t[26]!==f||t[27]!==D?(H=e=>{let t=e.target;r||f||D!==`idle`||_.current||!e.isPrimary||e.button!==0||!(t instanceof HTMLElement)||B(t)&&(e.preventDefault(),e.stopPropagation(),_.current={pointer:e.pointerId,x:e.clientX,y:e.clientY,intent:`send`,started:!1},y.current=setTimeout(()=>{if(y.current=null,!_.current)return;let e=B(t);if(!e){_.current=null;return}e.blur(),_.current.started=!0,b.current=`insert`,d(!0),h(`send`),E.startDictation()},300))},t[23]=E,t[24]=r,t[25]=B,t[26]=f,t[27]=D,t[28]=H):H=t[28];let U=g(H),me;t[29]===R?me=t[30]:(me=e=>{let t=_.current;if(!t||t.pointer!==e.pointerId)return;e.preventDefault(),e.stopPropagation();let n=e.clientX-t.x,r=x.current?.getBoundingClientRect(),i=r&&r.width>0&&e.clientY>=r.top&&e.clientY<=r.bottom?e.clientX<r.left+r.width/2?`cancel`:`edit`:n<=-64?`cancel`:n>=64?`edit`:`send`;if(!t.started&&Math.hypot(n,t.y-e.clientY)>12){R(),_.current=null;return}t.started&&i!==t.intent&&(t.intent=i,h(i),ee(i===`send`?`light`:`medium`,{bypassCadence:!0}))},t[29]=R,t[30]=me);let W=g(me),he;t[31]!==V||t[32]!==R||t[33]!==n||t[34]!==E||t[35]!==A||t[36]!==o||t[37]!==k||t[38]!==D?(he=e=>{let t=_.current;if(!(!t||t.pointer!==e.pointerId)){if(e.preventDefault(),e.stopPropagation(),R(),A||D===`failed`){V();return}_.current=null,d(!1),t.started?t.intent===`cancel`?E.cancelDictation():(b.current=t.intent===`edit`?`insert`:`send`,o(k),p(!0),Promise.resolve(E.confirmDictation()).finally(()=>{p(!1),E.discardFailedDictation(),t.intent===`edit`&&n.current?.querySelector(`textarea`)?.focus()})):n.current?.querySelector(`textarea`)?.focus()}},t[31]=V,t[32]=R,t[33]=n,t[34]=E,t[35]=A,t[36]=o,t[37]=k,t[38]=D,t[39]=he):he=t[39];let G=g(he),ge;t[40]===V?ge=t[41]:(ge=e=>{_.current?.pointer===e.pointerId&&V()},t[40]=V,t[41]=ge);let _e=g(ge),ve;t[42]===B?ve=t[43]:(ve=e=>{B(e.target)&&e.preventDefault()},t[42]=B,t[43]=ve);let K=g(ve),q,J;t[44]!==V||t[45]!==R||t[46]!==n||t[47]!==U||t[48]!==_e||t[49]!==W||t[50]!==K||t[51]!==G?(q=()=>{let e=n.current;if(!e)return;let t=()=>{document.visibilityState===`hidden`&&V()};return e.addEventListener(`pointerdown`,U,!0),e.addEventListener(`touchstart`,K,{capture:!0,passive:!1}),window.addEventListener(`pointermove`,W,{capture:!0,passive:!1}),window.addEventListener(`pointerup`,G,!0),window.addEventListener(`pointercancel`,_e,!0),e.addEventListener(`contextmenu`,K,!0),e.addEventListener(`selectstart`,K,!0),window.addEventListener(`blur`,V),document.addEventListener(`visibilitychange`,t),()=>{R(),e.removeEventListener(`pointerdown`,U,!0),e.removeEventListener(`touchstart`,K,!0),window.removeEventListener(`pointermove`,W,!0),window.removeEventListener(`pointerup`,G,!0),window.removeEventListener(`pointercancel`,_e,!0),e.removeEventListener(`contextmenu`,K,!0),e.removeEventListener(`selectstart`,K,!0),window.removeEventListener(`blur`,V),document.removeEventListener(`visibilitychange`,t)}},J=[n,U,W,G,_e,V,R,K],t[44]=V,t[45]=R,t[46]=n,t[47]=U,t[48]=_e,t[49]=W,t[50]=K,t[51]=G,t[52]=q,t[53]=J):(q=t[52],J=t[53]),(0,j.useEffect)(q,J);let ye,Y;if(t[54]!==V||t[55]!==r?(ye=()=>{r&&V()},Y=[r,V],t[54]=V,t[55]=r,t[56]=ye,t[57]=Y):(ye=t[56],Y=t[57]),(0,j.useEffect)(ye,Y),!u&&!f)return null;let be=Math.min(1,Math.max(0,ie))**.6,X=!!A,xe=A?V:void 0,Se;t[58]===be?Se=t[59]:(Se={...de,"--speech-energy":be},t[58]=be,t[59]=Se);let Ce=Se,we;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,N.jsx)(`div`,{className:`yuri-speech-light-field`,"aria-hidden":`true`,children:[`ice`,`lilac`,`mint`,`blush`,`mid`,`core`].map(z)}),t[60]=we):we=t[60];let Te=O||f,Z;t[61]!==A||t[62]!==O||t[63]!==k||t[64]!==f||t[65]!==D||t[66]!==l?(Z=A&&!f?(0,N.jsx)(`p`,{role:`alert`,className:`yuri-speech-caption yuri-speech-error`,children:A}):(0,N.jsx)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`yuri-speech-caption`,children:O||f?(0,N.jsx)(ce,{size:72}):k?(0,N.jsx)(`span`,{className:`yuri-speech-interim`,children:k}):l(D===`uploading`?`chat.dictation.processing`:`chat.dictation.listening`)}),t[61]=A,t[62]=O,t[63]=k,t[64]=f,t[65]=D,t[66]=l,t[67]=Z):Z=t[67];let Q;t[68]!==Te||t[69]!==Z?(Q=(0,N.jsx)(`div`,{className:`yuri-speech-content`,"data-starting":Te,children:Z}),t[68]=Te,t[69]=Z,t[70]=Q):Q=t[70];let $;t[71]!==S||t[72]!==C||t[73]!==te||t[74]!==u||t[75]!==m||t[76]!==l?($=u&&(0,N.jsx)(`div`,{className:`yuri-speech-gesture-stage`,"aria-hidden":`true`,children:(0,N.jsxs)(`div`,{className:`yuri-speech-gesture-surfaces`,children:[(0,N.jsx)(`div`,{className:`yuri-speech-target-glass`,style:{clipPath:`url(#${C})`}}),(0,N.jsx)(`div`,{className:`yuri-speech-target-glass`,style:{clipPath:`url(#${te})`}}),(0,N.jsxs)(`svg`,{className:`yuri-speech-geometry`,viewBox:`0 0 400 226`,focusable:`false`,children:[(0,N.jsxs)(`defs`,{children:[(0,N.jsx)(`clipPath`,{id:C,clipPathUnits:`objectBoundingBox`,children:(0,N.jsx)(`path`,{transform:`scale(0.0025 0.004424778761)`,d:le})}),(0,N.jsx)(`clipPath`,{id:te,clipPathUnits:`objectBoundingBox`,children:(0,N.jsx)(`path`,{transform:`scale(0.0025 0.004424778761)`,d:ue})}),(0,N.jsxs)(`linearGradient`,{id:S,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,N.jsx)(`stop`,{offset:`0%`,className:`yuri-speech-arc-top`}),(0,N.jsx)(`stop`,{offset:`100%`,className:`yuri-speech-arc-bottom`})]})]}),(0,N.jsxs)(`g`,{className:`yuri-speech-targets`,ref:x,children:[(0,N.jsxs)(`g`,{className:`yuri-speech-target yuri-speech-target--cancel`,"data-active":m===`cancel`,children:[(0,N.jsx)(`path`,{d:le}),(0,N.jsx)(`text`,{x:`95`,y:`68`,textAnchor:`middle`,dominantBaseline:`central`,transform:`rotate(-11 95 68)`,children:l(`chat.dictation.cancelGesture`)})]}),(0,N.jsxs)(`g`,{className:`yuri-speech-target yuri-speech-target--edit`,"data-active":m===`edit`,children:[(0,N.jsx)(`path`,{d:ue}),(0,N.jsx)(`text`,{x:`305`,y:`68`,textAnchor:`middle`,dominantBaseline:`central`,transform:`rotate(11 305 68)`,children:l(`chat.dictation.edit`)})]})]}),(0,N.jsx)(`path`,{className:`yuri-speech-hold-arc`,fill:`url(#${S})`,d:`M-50 186.987 A500 500 0 0 1 450 186.987 L450 300 H-50 Z`})]})]})}),t[71]=S,t[72]=C,t[73]=te,t[74]=u,t[75]=m,t[76]=l,t[77]=$):$=t[77];let Ee;return t[78]!==m||t[79]!==X||t[80]!==xe||t[81]!==Ce||t[82]!==Q||t[83]!==$?(Ee=(0,re.createPortal)((0,N.jsxs)(`div`,{className:`yuri-speech-overlay`,"data-intent":m,"data-error":X,onClick:xe,style:Ce,children:[we,Q,$]}),document.body),t[78]=m,t[79]=X,t[80]=xe,t[81]=Ce,t[82]=Q,t[83]=$,t[84]=Ee):Ee=t[84],Ee}function z(e){return(0,N.jsx)(`div`,{className:`yuri-speech-reactor yuri-speech-reactor--${e}`,children:(0,N.jsx)(`div`,{className:`yuri-speech-light`})},e)}function B(e){let n=(0,M.c)(7),{available:r}=e,i=te(pe),[a,o]=(0,j.useState)(null),s;n[0]!==r||n[1]!==i?(s=r&&i&&!t()&&O(),n[0]=r,n[1]=i,n[2]=s):s=n[2];let c=s,l=c?a:null,u;return n[3]!==c||n[4]!==i||n[5]!==l?(u={globallyEnabled:i,enabled:c,hint:l,onHintChange:o},n[3]=c,n[4]=i,n[5]=l,n[6]=u):u=n[6],u}function pe(e){return e.dictationEnabled}var V=j.createContext(null),H=e=>{let t=(0,M.c)(3),{actions:n,children:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,N.jsx)(V.Provider,{value:n,children:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},U=()=>j.useContext(V),me=e=>e.nativeEvent.isComposing||e.nativeEvent.keyCode===229;function W(e){let t=(0,M.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=y(`inline-flex shrink-0 items-center justify-center rounded-full bg-foreground text-background`,r),t[4]=r,t[5]=a);let o;return t[6]!==n||t[7]!==i||t[8]!==a?(o=(0,N.jsx)(`span`,{className:a,...i,"aria-hidden":!0,children:n}),t[6]=n,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function he(e){let t=(0,M.c)(7),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,N.jsx)(`span`,{"data-stop-glyph":`true`,className:`block size-[38%] rounded-[20%] bg-current`}),t[3]=i):i=t[3];let a;return t[4]!==n||t[5]!==r?(a=(0,N.jsx)(W,{className:n,...r,children:i}),t[4]=n,t[5]=r,t[6]=a):a=t[6],a}function G(e){let t=(0,M.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,spinning:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i,o=a?`loader-4`:`arrow-up`,s=a?`size-[50%] animate-spin`:`size-[56%]`,c;t[4]===s?c=t[5]:(c=y(s),t[4]=s,t[5]=c);let l;t[6]!==o||t[7]!==c?(l=(0,N.jsx)(T,{name:o,weight:`medium`,className:c}),t[6]=o,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==n||t[10]!==r||t[11]!==l?(u=(0,N.jsx)(W,{className:n,...r,children:l}),t[9]=n,t[10]=r,t[11]=l,t[12]=u):u=t[12],u}var ge=j.forwardRef((e,t)=>{let n=(0,M.c)(17),r,i,a,o,s;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5]):({children:r,className:i,expanded:s,style:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s);let c=s!==void 0&&s&&`min-h-0 flex-1`,l;n[6]!==i||n[7]!==c?(l=y(`relative flex flex-col overflow-visible border border-[color-mix(in_srgb,var(--interactive-border)_50%,transparent)] dark:border-transparent`,`bg-[var(--surface-background)] shadow-[0_2px_6px_-3px_color-mix(in_srgb,var(--surface-foreground)_4%,transparent),inset_0_1px_0_var(--yuri-mobile-glass-highlight)] transition-colors duration-150 motion-reduce:transition-none`,`dark:bg-[color-mix(in_srgb,var(--surface-background),var(--surface-foreground)_8%)] dark:shadow-none dark:hover:bg-[color-mix(in_srgb,var(--surface-background),var(--surface-foreground)_11%)] dark:focus-within:bg-[color-mix(in_srgb,var(--surface-background),var(--surface-foreground)_11%)]`,c,i),n[6]=i,n[7]=c,n[8]=l):l=n[8];let u;n[9]===o?u=n[10]:(u={borderRadius:`var(--radius-xl)`,...o},n[9]=o,n[10]=u);let d;return n[11]!==r||n[12]!==a||n[13]!==t||n[14]!==l||n[15]!==u?(d=(0,N.jsx)(`div`,{ref:t,className:l,style:u,...a,children:r}),n[11]=r,n[12]=a,n[13]=t,n[14]=l,n[15]=u,n[16]=d):d=n[16],d});ge.displayName=`ChatComposerSurface`;var _e=j.forwardRef((e,t)=>{let n=(0,M.c)(3),r;return n[0]!==e||n[1]!==t?(r=(0,N.jsx)(A,{ref:t,...e}),n[0]=e,n[1]=t,n[2]=r):r=n[2],r});_e.displayName=`ChatPromptTextarea`;var ve=e=>{let t=(0,M.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=y(`flex shrink-0 items-center gap-2 bg-transparent px-2.5 py-1.5`,r),t[4]=r,t[5]=a);let o;return t[6]!==n||t[7]!==i||t[8]!==a?(o=(0,N.jsx)(`div`,{className:a,"data-chat-input-footer":`true`,...i,children:n}),t[6]=n,t[7]=i,t[8]=a,t[9]=o):o=t[9],o},K=(e,t)=>{typeof e==`function`?e(t):e&&(e.current=t)},q=({value:e,attachments:t=[],disabled:n=!1,pending:r=!1,placeholder:i,isMobile:a=!1,onChange:o,onSubmit:s,onStop:c,onAddFiles:l,onRemoveAttachment:u,addFilesLabel:d,removeAttachmentLabel:f,fileAccept:p=`image/*`,sendLabel:m,stopLabel:h,hint:b,leftControls:x,rightControls:S,footerContent:ee,inputHeader:te,attachmentContent:w,highlightedContent:E,highlightRef:D,inputRef:ne,textareaProps:O,textLayoutClassName:A,inputClassName:M,inputOuterClassName:re,inputStyle:ie,footerClassName:P,footerStyle:I,contentClassName:L,inputSectionClassName:ce,autoResize:R=!0,disableInputWhilePending:le=!0,layout:ue=`stacked`,children:de,className:fe,expanded:z=!1,...B})=>{let{t:pe}=v(),V=ue===`inline`,[H,U]=j.useState(!1),[W,q]=j.useState(!1),J=ae(),ye=t.length>0||H,Y=j.useRef(null),be=j.useRef(null),X=j.useRef(null),xe=j.useId().replace(/:/g,``),Se=g(()=>{if(!R||z||O?.fillContainer){V&&U(!1);return}let e=Y.current;if(!e)return;e.style.height=V?`0px`:`auto`;let t=Number.parseFloat(window.getComputedStyle(e).maxHeight),n=V?Math.max(e.scrollHeight,48):e.scrollHeight,r=Number.isFinite(t)?Math.min(n,t):n;e.style.height=`${r}px`,e.style.overflowY=Number.isFinite(t)&&n>t?`auto`:`hidden`;let i=r>48;V&&U(e=>e===i?e:i)});j.useLayoutEffect(()=>{Se()},[R,z,V,O?.fillContainer,e]),_(V&&R&&!z&&!O?.fillContainer?Y:null,Se);let Ce=e=>{O?.onKeyDown?.(e),!(e.defaultPrevented||me(e))&&e.key===`Enter`&&!e.shiftKey&&!a&&(e.preventDefault(),!n&&(!r||!le)&&s())},we=e=>{l?.(e.target.files),e.target.value=``},Te=g(()=>{Y.current?.blur(),q(!0)}),Z=g(e=>{q(!1),requestAnimationFrame(()=>e?.click())}),Q=g(()=>{q(!1),requestAnimationFrame(()=>{(async()=>{if(!F()){X.current?.click();return}try{let e=await oe(20);if(e===null){X.current?.click();return}e.length>0&&l?.(e)}catch(e){console.error(`Native photo pick failed`,e),C.error(pe(`chat.chatInput.toast.attachFileFailed`))}})()})}),$=e.trim().length>0||t.length>0,Ee=t.filter(e=>e.mime.startsWith(`image/`)),De=t.filter(e=>!e.mime.startsWith(`image/`)),Oe=l?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`input`,{ref:be,type:`file`,accept:p,multiple:!0,className:`hidden`,onChange:we}),J?(0,N.jsx)(`input`,{ref:X,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,onChange:we}):null,(0,N.jsx)(`button`,{type:`button`,className:`flex size-8 shrink-0 items-center justify-center rounded-md text-foreground outline-none hover:bg-[var(--interactive-hover)] disabled:cursor-not-allowed disabled:opacity-40`,onClick:()=>J?Te():be.current?.click(),onMouseDown:a?e=>e.preventDefault():void 0,onPointerDownCapture:a?e=>e.preventDefault():void 0,disabled:n||r,"aria-label":d,children:(0,N.jsx)(T,{name:`attachment-2`,className:`size-[18px]`})})]}):null,ke=!n&&!r&&$,Ae=a?`size-6`:`size-full`,je=r&&c?(0,N.jsx)(`button`,{type:`button`,"data-composer-stop":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-full outline-none hover:opacity-80`,onClick:c,"aria-label":h,children:(0,N.jsx)(he,{className:Ae})}):(0,N.jsx)(`button`,{type:`submit`,"data-composer-send":`true`,"data-composer-circle":ke?`true`:void 0,className:y(`flex size-8 shrink-0 items-center justify-center outline-none`,ke?`rounded-full hover:opacity-80`:`rounded-md text-primary hover:bg-[var(--interactive-hover)] disabled:cursor-not-allowed disabled:opacity-30`),disabled:n||r||!$,"aria-label":m,children:ke?(0,N.jsx)(G,{className:Ae}):(0,N.jsx)(T,{name:r?`loader-4`:`send-plane-2`,className:y(`size-4`,r&&`animate-spin`)})}),Me=r&&c?(0,N.jsx)(`button`,{type:`button`,"data-composer-stop":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-full outline-none hover:opacity-80`,onClick:c,"aria-label":h,children:(0,N.jsx)(he,{className:Ae})}):(0,N.jsx)(`button`,{type:`submit`,"data-composer-send":`true`,"data-composer-circle":`true`,className:y(`flex size-8 shrink-0 items-center justify-center rounded-full outline-none`,ke?`hover:opacity-80`:`cursor-not-allowed opacity-30`),disabled:n||r||!$,"aria-busy":r||void 0,"aria-label":m,onClick:()=>Y.current?.focus({preventScroll:!0}),onMouseDown:e=>e.preventDefault(),onPointerDownCapture:a?e=>e.preventDefault():void 0,children:(0,N.jsx)(G,{className:Ae,spinning:r})}),Ne=V?Me:je,Pe=x===void 0?Oe:x;return(0,N.jsxs)(ge,{className:fe,expanded:z,...B,children:[de,(0,N.jsxs)(`div`,{"data-composer-content":`true`,"data-composer-layout":ue,className:y(`relative flex min-h-0`,V?y(`min-h-12 flex-row`,ye?`items-end`:`items-center`):`flex-col`,z&&`flex-1`,L),children:[V&&Pe?(0,N.jsx)(`div`,{className:`flex h-12 shrink-0 items-center pl-1.5`,"data-composer-inline-attach":`true`,children:Pe}):null,(0,N.jsxs)(`div`,{className:y(`overflow-hidden`,V&&`min-w-0 flex-1`,z&&`flex min-h-0 flex-1 flex-col`,ce),children:[te,w,Ee.length>0?(0,N.jsx)(`div`,{className:`flex gap-2 overflow-x-auto px-3 pt-3`,"data-chat-prompt-attachments":`true`,children:Ee.map(e=>(0,N.jsxs)(`div`,{className:`group relative shrink-0`,children:[(0,N.jsx)(`span`,{className:`block size-16`,children:(0,N.jsx)(k,{fill:!0,src:e.url,alt:e.name,className:`size-16 rounded-lg border border-border object-cover`})}),u?(0,N.jsx)(`button`,{type:`button`,className:`absolute -right-1 -top-1 flex size-6 items-center justify-center rounded-full border border-border bg-[var(--surface-elevated)] shadow-sm hover:bg-[var(--interactive-hover)]`,onClick:()=>u(e.id),"aria-label":f,children:(0,N.jsx)(T,{name:`close`,className:`size-3`})}):null]},e.id))}):null,De.length>0?(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2 px-3 pt-3`,"data-chat-prompt-file-attachments":`true`,children:De.map(e=>(0,N.jsxs)(`div`,{className:`relative flex max-w-[12rem] items-center gap-1.5 rounded-lg border border-border bg-[var(--surface-elevated)] px-2 py-1`,children:[(0,N.jsx)(T,{name:`file-text`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,N.jsx)(`span`,{className:`min-w-0 truncate typography-micro`,children:e.name}),u?(0,N.jsx)(`button`,{type:`button`,className:`flex size-5 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-[var(--interactive-hover)]`,onClick:()=>u(e.id),"aria-label":f,children:(0,N.jsx)(T,{name:`close`,className:`size-3`})}):null]},e.id))}):null,(0,N.jsxs)(`div`,{className:y(`relative overflow-hidden`,V&&y(`flex min-h-12`,H?`items-end`:`items-center`),z&&`flex min-h-0 flex-1 flex-col`),"data-composer-input-shell":`true`,children:[E?(0,N.jsx)(`div`,{ref:D,"aria-hidden":!0,"data-composer-highlight":`true`,className:y(`pointer-events-none absolute inset-0 z-0 rounded-b-none`,A,M),children:E}):null,(0,N.jsx)(_e,{...O,simple:!0,fillContainer:!V&&O?.fillContainer,ref:e=>{Y.current=e,K(ne,e)},"data-chat-input":`true`,value:e,onChange:e=>o(e.target.value,e),onKeyDown:Ce,disabled:n||r&&le,placeholder:i,enterKeyHint:a?`enter`:O?.enterKeyHint,outerClassName:y(`ring-0 bg-transparent shadow-none hover:bg-transparent focus-within:ring-0`,V&&`flex-none`,z&&`min-h-0 flex-1`,re),className:y(`relative z-10 resize-none overflow-y-hidden appearance-none border-0 bg-transparent typography-markdown hover:border-transparent md:typography-ui-label`,V?`field-sizing-fixed min-h-12 max-h-32 px-3 py-3 leading-6`:`min-h-[52px] max-h-40 rounded-b-none px-3 pb-2 pt-4`,A,M,E&&`text-transparent caret-[var(--surface-foreground)]`),style:ie,rows:O?.rows??1})]})]}),V?(0,N.jsx)(`div`,{className:y(`flex h-12 shrink-0 items-center pr-1.5`,P),style:I,"data-composer-inline-send":`true`,children:S??Ne}):(0,N.jsx)(ve,{className:P,style:I,children:ee??(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`flex items-center gap-1.5`,children:x??Oe}),b?(0,N.jsx)(`div`,{className:`min-w-0 flex-1 truncate typography-micro text-muted-foreground`,children:b}):(0,N.jsx)(`div`,{className:`flex-1`}),(0,N.jsx)(`div`,{className:`flex items-center gap-1.5`,children:S??Ne})]})})]}),J&&l?(0,N.jsx)(se,{id:`mobile-attach-pick-${xe}`,open:W,onOpenChange:e=>{e||q(!1)},onPickPhotos:Q,onPickFiles:()=>Z(be.current)}):null]})},J={dictation:102,mentionFile:100,mentionAgent:100,mentionSession:100,mentionCommand:100,mentionPaste:100,code:90,codeFence:90,link:80,linkUrl:78,heading:70,blockquote:40,listMarker:35,marker:10},ye={dictation:`text-foreground underline decoration-current underline-offset-4`,mentionFile:`text-[var(--primary)]`,mentionAgent:`text-[var(--primary)]`,mentionSession:`text-[var(--primary)]`,mentionCommand:`text-[var(--primary)]`,mentionPaste:`text-[var(--primary)]`,code:`rounded-[3px] bg-[var(--surface-subtle)] text-[var(--markdown-inline-code)]`,codeFence:`bg-[var(--surface-subtle)] text-[var(--markdown-inline-code)]`,link:`text-[var(--status-info)] underline`,linkUrl:`text-muted-foreground`,heading:`text-[var(--syntax-keyword)]`,blockquote:`text-muted-foreground`,listMarker:`text-[var(--syntax-keyword)]`,marker:`text-muted-foreground`},Y=`text-foreground`;function be(e,t){if(!e||t.length===0)return null;let n=e.length,r=new Set([0,n]);for(let e of t)e.start>0&&e.start<n&&r.add(e.start),e.end>0&&e.end<n&&r.add(e.end);let i=[...r].sort((e,t)=>e-t),a=t.map((e,t)=>({range:e,index:t})).filter(e=>e.range.end>e.range.start).sort((e,t)=>e.range.start-t.range.start),o=[],c=[],l=0;for(let t=0;t<i.length-1;t+=1){let n=i[t],r=i[t+1];if(r<=n)continue;for(;l<a.length&&a[l].range.start<=n;)c.push(a[l]),l+=1;for(let e=c.length-1;e>=0;--e)c[e].range.end<=n&&c.splice(e,1);let u=null,d=-1,f=1/0;for(let{range:e,index:t}of c){let n=e.priority??J[e.style];(n>d||n===d&&t<f)&&(d=n,f=t,u=e)}let p=u?u.className??ye[u.style]:Y,m=e.slice(n,r),h=u?.visual,g=u?.skillName,_=o[o.length-1];_&&_.className===p&&s(_.visual,h)&&_.skillName===g?_.text+=m:o.push({text:m,className:p,visual:h,skillName:g})}return o.length>0?o:null}function X(e,t){let n=new Set(Array.from(t,e=>e.toLowerCase())),r=[];for(let t of[/(^|\s)\/(\u2003)?([a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?)/gi,/(^|\s)@(\u2003)?([a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?)(?=$|\s|[),.;:!?])/gi]){let i;for(;(i=t.exec(e))!==null;){let e=i[2]??``,t=i[3]||``;if(!n.has(t.toLowerCase()))continue;let a=i.index+(i[1]?.length??0);r.push({start:a,end:a+1+e.length+t.length,name:t})}}return r}function xe(e,t,n){if(e===t){let t=n.find(t=>e>t.start&&e<t.end);return t?{start:t.start,end:t.end}:null}let r=n.filter(n=>n.start<t&&n.end>e);return r.length===0?null:{start:Math.min(e,...r.map(e=>e.start)),end:Math.max(t,...r.map(e=>e.end))}}function Se(e,t,n){let r=X(e,t),i=Math.max(0,Math.min(n.selectionStart,e.length)),a=Math.max(i,Math.min(n.selectionEnd,e.length)),o=i,s=a;if(i===a)if(n.altKey)if(n.key===`Backspace`){for(;o>0&&/\s/.test(e[o-1]);)--o;for(;o>0&&!/\s/.test(e[o-1]);)--o}else{for(;s<e.length&&/\s/.test(e[s]);)s+=1;for(;s<e.length&&!/\s/.test(e[s]);)s+=1}else n.key===`Backspace`?o=Math.max(0,i-1):s=Math.min(e.length,i+1);if(o===s)return null;let c=r.filter(e=>e.start<s&&e.end>o);if(c.length===0)return null;let l=Math.min(o,...c.map(e=>e.start)),u=Math.max(s,...c.map(e=>e.end));return u<e.length&&/\s/.test(e[u])&&(l===0||/\s/.test(e[l-1]))?u+=1:u===e.length&&l>0&&/\s/.test(e[l-1])&&--l,{text:`${e.slice(0,l)}${e.slice(u)}`,caret:l,removedSkillNames:c.map(e=>e.name)}}function Ce(e){return e.map(e=>({start:e.start,end:e.end,style:e.kind===`file`?`mentionFile`:e.kind===`session`?`mentionSession`:`mentionAgent`,visual:e.kind===`session`&&e.label?l({trigger:`@`,icon:`chat-thread`,label:e.label},o({trigger:`@`,icon:`chat-thread`,label:e.label})):void 0}))}function we(e){let t=(0,M.c)(28),{visual:n,text:r}=e,i=n.trigger.length,a=i+n.label.length,o=a+(n.suffix?.length??0),s;t[0]!==a||t[1]!==i||t[2]!==r?(s=r.slice(i,Math.min(a,r.length)),t[0]=a,t[1]=i,t[2]=r,t[3]=s):s=t[3];let l=s,d;t[4]!==a||t[5]!==o||t[6]!==r?(d=r.slice(a,Math.min(o,r.length)),t[4]=a,t[5]=o,t[6]=r,t[7]=d):d=t[7];let f=d,p;t[8]!==o||t[9]!==r?(p=r.slice(Math.min(o,r.length)),t[8]=o,t[9]=r,t[10]=p):p=t[10];let m=p,h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h={left:u,right:u},t[11]=h):h=t[11];let g=n.icon,_;t[12]===g?_=t[13]:(_=(0,N.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 inline-flex items-center justify-center`,style:h,children:(0,N.jsx)(T,{name:g,className:`${c} shrink-0 text-[var(--primary)]`,"aria-hidden":`true`})}),t[12]=g,t[13]=_);let v;t[14]!==_||t[15]!==n.trigger?(v=(0,N.jsxs)(`span`,{className:`relative inline-block align-baseline text-transparent leading-none`,children:[n.trigger,_]}),t[14]=_,t[15]=n.trigger,t[16]=v):v=t[16];let y;t[17]===l?y=t[18]:(y=(0,N.jsx)(`span`,{children:l}),t[17]=l,t[18]=y);let b;t[19]===f?b=t[20]:(b=f?(0,N.jsx)(`span`,{className:`text-transparent`,children:f}):null,t[19]=f,t[20]=b);let x;t[21]===m?x=t[22]:(x=m?(0,N.jsx)(`span`,{className:`text-transparent`,children:m}):null,t[21]=m,t[22]=x);let S;return t[23]!==x||t[24]!==v||t[25]!==y||t[26]!==b?(S=(0,N.jsxs)(N.Fragment,{children:[v,y,b,x]}),t[23]=x,t[24]=v,t[25]=y,t[26]=b,t[27]=S):S=t[27],S}var Te=e=>{if(e.altKey||e.ctrlKey||e.metaKey)return!1;switch(e.key){case`ArrowUp`:case`PageUp`:case`Home`:return!0;default:return!1}},Z=(e,t,n)=>{let r=t instanceof Element?t:t instanceof Node?t.parentElement:null;for(;r&&r!==e;){if(r instanceof HTMLElement){let e=r.scrollHeight-r.clientHeight;if(e>1&&(n===`up`?r.scrollTop>0:r.scrollTop<e-1))return!0}r=r.parentElement}return!1},Q=(e,t)=>Z(e,t,`up`),$=(e,t)=>Z(e,t,`down`),Ee=e=>({text:e.text,references:e.references.map(e=>({...e}))}),De=e=>e.map(e=>({...e,range:{...e.range}})),Oe=(e,t)=>e.text===t.text&&JSON.stringify(e.references)===JSON.stringify(t.references),ke=(e,t,n)=>({document:Ee(e),mentions:De(t),selection:{...n}}),Ae=()=>({undo:[],redo:[]}),je=(e,t)=>({undo:[...e.undo,t].slice(-100),redo:[]}),Me=(e,t)=>{let n=e.undo.at(-1);return!n||!Oe(n.after.document,t)?null:{history:{undo:e.undo.slice(0,-1),redo:[...e.redo,n]},snapshot:ke(n.before.document,n.before.mentions,n.before.selection)}},Ne=(e,t)=>{let n=e.redo.at(-1);return!n||!Oe(n.before.document,t)?null:{history:{undo:[...e.undo,n],redo:e.redo.slice(0,-1)},snapshot:ke(n.after.document,n.after.mentions,n.after.selection)}},Pe=e=>{if(typeof e!=`number`||!Number.isFinite(e))return;let t=Math.trunc(e);return t>=0?t:void 0},Fe=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.summary;return!t||typeof t!=`object`||Array.isArray(t)?null:t},Ie=e=>{let t=Pe(e);return t!==void 0&&t>0?t:void 0};function Le(e){let t=Fe(e);if(!t)return null;let n=Ie(t.additions),r=Ie(t.deletions),i=Ie(t.files)??Ie(t.diffCount);return n===void 0&&r===void 0&&i===void 0?null:{...n===void 0?{}:{additions:n},...r===void 0?{}:{deletions:r},...i===void 0?{}:{files:i}}}function Re(e){if(!e)return null;let t=[];return e.additions!==void 0&&e.additions>0&&t.push(`+${e.additions}`),e.deletions!==void 0&&e.deletions>0&&t.push(`−${e.deletions}`),t.length>0?t.join(` `):null}function ze(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=typeof t.providerID==`string`?t.providerID.trim():``,r=typeof t.modelID==`string`?t.modelID.trim():``;if(n&&r)return`${n}/${r}`;let i=t.model;if(typeof i==`string`&&i.trim())return i.trim();if(i&&typeof i==`object`&&!Array.isArray(i)){let e=i,t=typeof e.providerID==`string`?e.providerID.trim():typeof e.provider==`string`?e.provider.trim():``,n=typeof e.modelID==`string`?e.modelID.trim():typeof e.id==`string`?e.id.trim():``;if(t&&n)return`${t}/${n}`}return null}function Be(e){if(!e||e.trim().length===0)return null;let t=S.getState(),n=t.activeSessions.find(t=>t.id===e)??t.archivedSessions.find(t=>t.id===e)??null;if(!n)return null;let r=x(n);return r?{sessionId:e,directory:r,session:n,fromCache:!t.hasLoaded,source:`memory`}:null}function Ve(e){return Be(e)?.directory??null}var He=new Map;async function Ue(e,t){let n=e.trim();if(!n)return null;let r=Be(n);if(r)return r;let i=He.get(n);if(i)return i;let o=(async()=>{let e=Be(n);if(e)return e;let r=await w(n,{signal:t?.signal});if(r?.directory)return{sessionId:r.id,directory:r.directory,session:null,fromCache:!1,source:`session-index`};if(t?.trySessionGet===!1)return null;try{let e=await a.getSession(n),t=typeof e.directory==`string`&&e.directory.trim()||(typeof e.project?.worktree==`string`?e.project.worktree.trim():``)||null;return t?{sessionId:n,directory:t,session:e,fromCache:!1,source:`session-get`}:null}catch{return null}})().finally(()=>{He.get(n)===o&&He.delete(n)});return He.set(n,o),o}export{se as A,he as C,B as D,U as E,oe as M,ae as N,fe as O,G as S,H as T,X as _,Le as a,Se as b,Ae as c,Me as d,Te as f,be as g,we as h,Re as i,F as j,ce as k,je as l,Q as m,Ve as n,ze as o,$ as p,Ue as r,ke as s,Be as t,Ne as u,Ce as v,me as w,q as x,xe as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-CzHs0bHY.js";import{r}from"./useUIStore-BDZCXouA.js";import{n as i}from"./vendor-react-DlzBev0S.js";import{f as a,r as o}from"./button-BF2cNEuq.js";import{n as s}from"./Icon-CLLDJn-P.js";import{r as c}from"./device-DN1GigI_.js";import{_ as l,l as u,n as d,s as ee,t as f,v as p,y as m}from"./vendor-dnd-kit-core-DK4OoOTr.js";import{o as h,r as te,t as g}from"./vendor-dnd-kit-sortable-Cv69eQm1.js";var ne=i(),_=e(n(),1),v=t(),re=({transform:e})=>({...e,y:0}),ie=e=>{let t=(0,ne.c)(18),{id:n,children:r,className:i}=e,a;t[0]===n?a=t[1]:(a={id:n},t[0]=n,t[1]=a);let{attributes:s,listeners:c,setNodeRef:l,transform:u,transition:d,isDragging:ee}=h(a),f;t[2]===u?f=t[3]:(f=m.Transform.toString(u),t[2]=u,t[3]=f);let p;t[4]!==f||t[5]!==d?(p={transform:f,transition:d},t[4]=f,t[5]=d,t[6]=p):p=t[6];let te=ee&&`opacity-50`,g;t[7]!==i||t[8]!==te?(g=o(`h-full rounded-md`,i,te),t[7]=i,t[8]=te,t[9]=g):g=t[9];let _;return t[10]!==s||t[11]!==r||t[12]!==n||t[13]!==c||t[14]!==l||t[15]!==p||t[16]!==g?(_=(0,v.jsx)(`div`,{ref:l,"data-sortable-tab-id":n,style:p,className:g,...s,...c,children:r}),t[10]=s,t[11]=r,t[12]=n,t[13]=c,t[14]=l,t[15]=p,t[16]=g,t[17]=_):_=t[17],_},ae=e=>{let t=(0,ne.c)(6),{id:n,children:r,className:i}=e,a;t[0]===i?a=t[1]:(a=o(`h-full`,i),t[0]=i,t[1]=a);let s;return t[2]!==r||t[3]!==n||t[4]!==a?(s=(0,v.jsx)(`div`,{className:a,"data-sortable-tab-id":n,children:r}),t[2]=r,t[3]=n,t[4]=a,t[5]=s):s=t[5],s},y=e=>{let t=(0,ne.c)(124),{items:n,activeId:i,onSelect:m,onClose:h,onReorder:y,layoutMode:he,variant:ge,activePillInsetClassName:_e,activePillButtonClassName:b,inactiveTabsIconOnly:ve,iconOnlyActiveTab:ye,animateActivePill:be,activePillLowercase:xe,className:Se}=e,Ce=he===void 0?`scrollable`:he,we=ge===void 0?`default`:ge,x=ve!==void 0&&ve,S=ye!==void 0&&ye,C=xe===void 0||xe,{t:Te}=a(),w=r(oe),{isTablet:Ee}=c(),T=w||Ee,E=_.useRef(null),De;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(De={left:!1,right:!1},t[0]=De):De=t[0];let[D,Oe]=_.useState(De),ke;t[1]===n?ke=t[2]:(ke=n.map(se),t[1]=n,t[2]=ke);let Ae=ke,O=Ce===`scrollable`,je=we==="default",k=we===`compact`,A=we===`active-pill`,Me=we===`animated`,j=A||Me,M=je,N=j||M,P=A&&O,Ne=j,Pe=be??Me,Fe=typeof y==`function`,F=Fe?ie:ae,Ie;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=new Map,t[3]=Ie):Ie=t[3];let Le=_.useRef(Ie),[I,Re]=_.useState(null),ze;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(ze={activationConstraint:{distance:8}},t[4]=ze):ze=t[4];let Be=p(l(ee,ze)),Ve=ce,He;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(He=(e,t)=>{if(t){Le.current.set(e,t);return}Le.current.delete(e)},t[5]=He):He=t[5];let Ue=He,We;t[6]!==i||t[7]!==N?(We=()=>{if(!N||!i){Re(le);return}let e=E.current,t=Le.current.get(i);if(!e||!t){Re(ue);return}let n=0,r=0,a=t;for(;a&&a!==e;)n+=a.offsetLeft,r+=a.offsetTop,a=a.offsetParent;let o={left:n,top:r,width:t.offsetWidth,height:t.offsetHeight};Re(e=>Ve(e,o)?e:o)},t[6]=i,t[7]=N,t[8]=We):We=t[8];let L=We,R;t[9]===O?R=t[10]:(R=()=>{if(!O){Oe({left:!1,right:!1});return}let e=E.current;if(!e){Oe({left:!1,right:!1});return}Oe({left:e.scrollLeft>2,right:e.scrollLeft+e.clientWidth<e.scrollWidth-2})},t[9]=O,t[10]=R);let z=R,Ge;t[11]!==O||t[12]!==z?(Ge=()=>{if(!O){Oe({left:!1,right:!1});return}let e=E.current;if(!e)return;z(),e.addEventListener(`scroll`,z,{passive:!0});let t=new ResizeObserver(z);return t.observe(e),()=>{e.removeEventListener(`scroll`,z),t.disconnect()}},t[11]=O,t[12]=z,t[13]=Ge):Ge=t[13];let B;t[14]!==O||t[15]!==n.length||t[16]!==z?(B=[O,n.length,z],t[14]=O,t[15]=n.length,t[16]=z,t[17]=B):B=t[17],_.useEffect(Ge,B);let V;t[18]!==i||t[19]!==L||t[20]!==N?(V=()=>{if(!N){Re(null);return}L();let e=E.current;if(!e)return;let t=new ResizeObserver(L);if(t.observe(e),i){let e=Le.current.get(i);e&&t.observe(e)}return()=>{t.disconnect()}},t[18]=i,t[19]=L,t[20]=N,t[21]=V):V=t[21];let H;t[22]!==i||t[23]!==n.length||t[24]!==L||t[25]!==N?(H=[i,n.length,L,N],t[22]=i,t[23]=n.length,t[24]=L,t[25]=N,t[26]=H):H=t[26],_.useEffect(V,H);let Ke;t[27]===L?Ke=t[28]:(Ke=()=>{L()},t[27]=L,t[28]=Ke),_.useLayoutEffect(Ke);let qe;t[29]!==i||t[30]!==O||t[31]!==z?(qe=()=>{if(!O||!i)return;let e=E.current;if(!e)return;let t=window.requestAnimationFrame(()=>{let t=typeof window.CSS?.escape==`function`?window.CSS.escape(i):i.replace(/"/g,`\\"`),n=e.querySelector(`[data-sortable-tab-id="${t}"]`);n&&(n.scrollIntoView({block:`nearest`,inline:`nearest`}),z())});return()=>{window.cancelAnimationFrame(t)}},t[29]=i,t[30]=O,t[31]=z,t[32]=qe):qe=t[32];let Je;t[33]!==i||t[34]!==O||t[35]!==n.length||t[36]!==z?(Je=[i,O,n.length,z],t[33]=i,t[34]=O,t[35]=n.length,t[36]=z,t[37]=Je):Je=t[37],_.useEffect(qe,Je);let Ye;t[38]===y?Ye=t[39]:(Ye=e=>{if(!y)return;let{active:t,over:n}=e;!n||t.id===n.id||y(String(t.id),String(n.id))},t[38]=y,t[39]=Ye);let Xe=Ye,U;t[40]===Se?U=t[41]:(U=o(`relative flex h-full min-w-0 flex-1`,Se),t[40]=Se,t[41]=U);let W;t[42]!==O||t[43]!==D||t[44]!==j?(W=O&&D.left?(0,v.jsx)(`div`,{className:o(`pointer-events-none absolute inset-y-0 left-0 z-20 bg-gradient-to-r to-transparent`,j?`w-8 from-[var(--surface-background)]`:`w-6 from-background`)}):null,t[42]=O,t[43]=D,t[44]=j,t[45]=W):W=t[45];let G;t[46]!==O||t[47]!==D||t[48]!==j?(G=O&&D.right?(0,v.jsx)(`div`,{className:o(`pointer-events-none absolute inset-y-0 right-0 z-20 bg-gradient-to-l to-transparent`,j?`w-8 from-[var(--surface-background)]`:`w-6 from-background`)}):null,t[46]=O,t[47]=D,t[48]=j,t[49]=G):G=t[49];let Ze=j?`items-center overflow-x-hidden overflow-y-hidden`:`items-stretch`,Qe=j&&`@container/pill-tabs`,$e=j&&`pill-tabs__track`,et=j&&(_e??`gap-0.5 py-0.5`),tt=M&&`items-center overflow-y-hidden`,nt=k&&`items-center gap-1 overflow-y-hidden`,rt=Ne&&`rounded-[10px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px] bg-[color-mix(in_srgb,var(--foreground)_2%,transparent)] p-0.5 gap-0.5`,it=O?`overflow-x-auto scrollbar-none`:`overflow-x-hidden`,K;t[50]!==Ze||t[51]!==Qe||t[52]!==$e||t[53]!==et||t[54]!==tt||t[55]!==nt||t[56]!==rt||t[57]!==it?(K=o(`relative flex h-full min-w-0 flex-1`,Ze,Qe,$e,et,tt,nt,rt,it),t[50]=Ze,t[51]=Qe,t[52]=$e,t[53]=et,t[54]=tt,t[55]=nt,t[56]=rt,t[57]=it,t[58]=K):K=t[58];let q;t[59]===O?q=t[60]:(q=O?{scrollbarWidth:`none`,msOverflowStyle:`none`}:void 0,t[59]=O,t[60]=q);let J;t[61]===Te?J=t[62]:(J=Te(`sortableTabsStrip.aria.tabs`),t[61]=Te,t[62]=J);let Y;t[63]!==I||t[64]!==Pe||t[65]!==j?(Y=j&&I?(0,v.jsx)(`div`,{className:o(`yuri-segmented-selected-pill pointer-events-none absolute left-0 top-0 z-0 rounded-[9px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px]`),style:{transform:`translate3d(${I.left}px, ${I.top}px, 0)`,width:`${I.width}px`,height:`${I.height}px`,transition:Pe?`transform 300ms cubic-bezier(0.65, 0, 0.35, 1), width 300ms cubic-bezier(0.65, 0, 0.35, 1), height 300ms cubic-bezier(0.65, 0, 0.35, 1)`:void 0}}):null,t[63]=I,t[64]=Pe,t[65]=j,t[66]=Y):Y=t[66];let X;t[67]!==I||t[68]!==M?(X=M&&I?(0,v.jsx)(`div`,{className:`pointer-events-none absolute left-0 -bottom-px z-10 h-[3px] rounded-t-[2px] bg-[var(--primary-base)]`,style:{transform:`translate3d(${I.left}px, 0, 0)`,width:`${I.width}px`},"aria-hidden":!0}):null,t[67]=I,t[68]=M,t[69]=X):X=t[69];let Z;if(t[70]!==F||t[71]!==i||t[72]!==b||t[73]!==C||t[74]!==T||t[75]!==S||t[76]!==x||t[77]!==A||t[78]!==k||t[79]!==w||t[80]!==O||t[81]!==n||t[82]!==h||t[83]!==m||t[84]!==P||t[85]!==j){let e;t[87]!==F||t[88]!==i||t[89]!==b||t[90]!==C||t[91]!==T||t[92]!==S||t[93]!==x||t[94]!==A||t[95]!==k||t[96]!==w||t[97]!==O||t[98]!==h||t[99]!==m||t[100]!==P||t[101]!==j?(e=e=>{let t=e.id===i,n=x&&j&&!t&&!!e.icon,r=!n,a=!!e.icon&&(!S||t),c=x&&j&&t&&!O&&!P,l=e.closable!==!1&&!!h,u=l&&!!e.icon&&!k,d=O||P?void 0:j?c?`flex-none basis-auto`:w?`flex-1 basis-0 min-w-0`:`flex-1 basis-0 min-w-fit`:`min-w-0 flex-1 basis-0`,ee=l?t=>{t.button===1&&(t.preventDefault(),t.stopPropagation(),h?.(e.id))}:void 0,f=l?de:void 0;return(0,v.jsx)(F,{id:e.id,className:d,children:(0,v.jsxs)(`div`,{ref:t=>Ue(e.id,t),onAuxClick:ee,onMouseDown:f,className:o(`group flex h-full min-w-0 flex-nowrap items-center`,O||P?`shrink-0`:j?`w-full`:`w-full min-w-0`,k?o(`relative rounded-md transition-colors`,t?`bg-interactive-selection text-interactive-selection-foreground`:`text-muted-foreground hover:bg-interactive-hover hover:text-foreground`):j?`relative z-10 bg-transparent`:t?`relative z-10 bg-transparent text-foreground`:`relative z-10 bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,v.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t,"aria-label":n?e.title??e.label:void 0,onClick:()=>m(e.id),className:o(k?`flex h-full max-w-56 min-w-0 flex-nowrap items-center rounded-md px-2 text-left text-xs font-normal !min-h-0 !min-w-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--interactive-focus-ring)]`:j?`animated-tabs__button pill-tabs__button relative z-10 flex flex-1 min-w-0 flex-nowrap items-center justify-center rounded-[9px] [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-[50px] text-sm font-medium transition-colors duration-150 !min-h-0`:`flex h-full min-w-0 flex-nowrap items-center typography-micro`,j&&C?`lowercase`:null,j&&(n?`gap-0`:`gap-1.5`),j?P?`shrink-0 whitespace-nowrap px-3 text-center`:O?`max-w-56 shrink-0 px-3 text-center`:n?`px-2 !min-w-0 text-center`:c?`shrink-0 whitespace-nowrap px-3 text-center`:`px-3 text-center`:k?null:O?`max-w-56 justify-start truncate px-3 text-left`:`w-full justify-center truncate px-3 text-center`,j?b??(A?w?`h-[38px]`:`h-[31px]`:`h-7`):null,j?t?`text-foreground`:`text-muted-foreground hover:text-foreground`:null,j?`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] focus-visible:ring-offset-1 focus-visible:ring-offset-background`:null),title:e.title??e.label,children:j?(0,v.jsxs)(v.Fragment,{children:[a?(0,v.jsxs)(`span`,{className:`relative flex h-4 w-4 shrink-0 items-center justify-center`,children:[(0,v.jsx)(`span`,{className:o(`flex items-center justify-center transition-opacity`,u&&(T?`opacity-0`:`group-hover:opacity-0`)),children:e.icon}),u?(0,v.jsx)(`span`,{role:`button`,tabIndex:-1,className:o(`absolute inset-0 z-20 flex !min-h-0 !min-w-0 items-center justify-center rounded-sm text-muted-foreground transition-opacity hover:text-foreground`,T?`opacity-100`:`opacity-0 group-hover:opacity-100`),onPointerDown:fe,onClick:t=>{t.stopPropagation(),h?.(e.id)},"aria-label":e.closeLabel??`Close ${e.label} tab`,title:e.closeLabel??`Close ${e.label} tab`,children:(0,v.jsx)(s,{name:`close`,className:`h-3.5 w-3.5`})}):null]}):null,r?(0,v.jsx)(`span`,{className:`animated-tabs__label truncate`,children:e.label}):null]}):(0,v.jsxs)(`span`,{className:o(`flex min-w-0 flex-nowrap items-center gap-1.5`,!O&&`justify-center`),children:[a?(0,v.jsxs)(`span`,{className:o(`relative flex h-4 w-4 shrink-0 items-center justify-center transition-colors duration-200 ease-out`,!k&&(t?`text-[var(--primary-base)]`:`text-muted-foreground`)),children:[(0,v.jsx)(`span`,{className:o(`flex items-center justify-center transition-opacity`,u&&(T?`opacity-0`:`group-hover:opacity-0`)),children:e.icon}),u?(0,v.jsx)(`span`,{role:`button`,tabIndex:-1,className:o(`absolute inset-0 z-20 flex !min-h-0 !min-w-0 items-center justify-center rounded-sm text-muted-foreground transition-opacity hover:text-foreground`,T?`opacity-100`:`opacity-0 group-hover:opacity-100`),onPointerDown:pe,onClick:t=>{t.stopPropagation(),h?.(e.id)},"aria-label":e.closeLabel??`Close ${e.label} tab`,title:e.closeLabel??`Close ${e.label} tab`,children:(0,v.jsx)(s,{name:`close`,className:`h-3.5 w-3.5`})}):null]}):null,(0,v.jsx)(`span`,{className:`truncate leading-[1.2]`,children:e.label})]})}),l&&!u?(0,v.jsx)(`button`,{type:`button`,onPointerDown:me,onClick:t=>{t.stopPropagation(),h?.(e.id)},className:o(`relative z-20 inline-flex !min-h-0 !min-w-0 items-center justify-center transition-opacity`,k?`mr-1 size-4 shrink-0 self-center rounded-sm text-muted-foreground hover:bg-interactive-hover hover:text-foreground`:j?`-ml-2.5 mr-1 h-[88%] w-5 self-center !aspect-auto rounded-md`:`aspect-square h-[65%] min-h-4 max-h-5 rounded-sm mr-1`,!k&&(j?t?`text-muted-foreground hover:bg-transparent hover:text-foreground`:`text-muted-foreground opacity-0 hover:bg-transparent hover:text-foreground group-hover:opacity-100`:t?`text-muted-foreground hover:bg-interactive-hover/60 hover:text-foreground`:`text-muted-foreground opacity-0 hover:bg-interactive-hover/80 hover:text-foreground group-hover:opacity-100`)),"aria-label":e.closeLabel??`Close ${e.label} tab`,title:e.closeLabel??`Close ${e.label} tab`,children:(0,v.jsx)(s,{name:`close`,className:`h-3 w-3`})}):null]})},e.id)},t[87]=F,t[88]=i,t[89]=b,t[90]=C,t[91]=T,t[92]=S,t[93]=x,t[94]=A,t[95]=k,t[96]=w,t[97]=O,t[98]=h,t[99]=m,t[100]=P,t[101]=j,t[102]=e):e=t[102],Z=n.map(e),t[70]=F,t[71]=i,t[72]=b,t[73]=C,t[74]=T,t[75]=S,t[76]=x,t[77]=A,t[78]=k,t[79]=w,t[80]=O,t[81]=n,t[82]=h,t[83]=m,t[84]=P,t[85]=j,t[86]=Z}else Z=t[86];let Q;t[103]!==K||t[104]!==q||t[105]!==J||t[106]!==Y||t[107]!==X||t[108]!==Z?(Q=(0,v.jsxs)(`div`,{ref:E,className:K,style:q,role:`tablist`,"aria-label":J,children:[Y,X,Z]}),t[103]=K,t[104]=q,t[105]=J,t[106]=Y,t[107]=X,t[108]=Z,t[109]=Q):Q=t[109];let at;t[110]!==U||t[111]!==W||t[112]!==G||t[113]!==Q?(at=(0,v.jsxs)(`div`,{className:U,children:[W,G,Q]}),t[110]=U,t[111]=W,t[112]=G,t[113]=Q,t[114]=at):at=t[114];let ot=at;if(!Fe)return ot;let st;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(st=[re],t[115]=st):st=t[115];let $;t[116]!==Ae||t[117]!==ot?($=(0,v.jsx)(g,{items:Ae,strategy:te,children:ot}),t[116]=Ae,t[117]=ot,t[118]=$):$=t[118];let ct;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,v.jsx)(d,{dropAnimation:null}),t[119]=ct):ct=t[119];let lt;return t[120]!==Xe||t[121]!==Be||t[122]!==$?(lt=(0,v.jsxs)(f,{sensors:Be,collisionDetection:u,onDragEnd:Xe,modifiers:st,children:[$,ct]}),t[120]=Xe,t[121]=Be,t[122]=$,t[123]=lt):lt=t[123],lt};function oe(e){return e.isMobile}function se(e){return e.id}function ce(e,t){return!e||!t?e===t:Math.abs(e.left-t.left)<.5&&Math.abs(e.top-t.top)<.5&&Math.abs(e.width-t.width)<.5&&Math.abs(e.height-t.height)<.5}function le(e){return e===null?e:null}function ue(e){return e===null?e:null}function de(e){e.button===1&&e.preventDefault()}function fe(e){e.stopPropagation()}function pe(e){e.stopPropagation()}function me(e){e.stopPropagation()}export{y as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/assistant-attachment-cache-
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,i as n,l as r,n as i}from"./runtime-switch-DEZ1K7qW.js";import{n as a}from"./runtime-fetch-D0YWp3FJ.js";import{_ as o,v as s,x as c}from"./desktop-JwYqThiw.js";import{t as l}from"./runtimeAPIRegistry-C2VogTny.js";import{g as u}from"./desktopHosts-CB0CTcMg.js";import{i as d,n as f,r as p}from"./desktopRelayRestore-D1UX7HW2.js";import{F as m,I as h,L as g,M as _,N as v,O as y,P as b,R as x,at as S,it as C,j as w,k as T,rt as E}from"./vendor-base-ui-BQjbsJ43.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{l as D}from"./persistence-CWuLIq1J.js";import{n as O}from"./vendor-react-D5d-V1vN.js";import{n as k}from"./vendor-tanstack-query-core-BWz0ose6.js";import{i as A,l as ee,n as te,r as ne,s as re}from"./vendor-tanstack-react-query-C4SG3JZB.js";import{a as j,o as ie}from"./queryRuntime-CTcigFdj.js";import{o as ae}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as M}from"./pathNormalization-ewtPqJWn.js";import{r as N}from"./vendor-reactuses-core-BcebBLwF.js";import{d as oe,f as se,l as P,p as F,r as I,t as ce}from"./button-BXxwtxsG.js";import{i as le,t as L}from"./store-CkIHVrmT.js";import{Li as ue,Qr as R,Si as z,va as B,wi as V}from"./useMobileNavigationStore-BmVr5a5c.js";import{n as H}from"./Icon-BE4mEwzV.js";import{i as de,n as fe,r as pe,t as me}from"./vendor-simplewebauthn-browser-Dwhcdg_5.js";import{E as he,O as ge,T as _e,w as ve}from"./projectMeta-B9_Uh8YH.js";import{t as ye}from"./input-D59Q2pm8.js";import{g as be,h as xe,m as Se,p as Ce,t as we}from"./MobileResizableSheet-Deidw1br.js";import{c as Te,d as Ee,f as De,h as Oe,l as ke,m as Ae,n as je,p as U,r as Me,s as Ne,t as Pe,u as Fe}from"./dropdown-menu.styles-DGaALKP0.js";import{n as Ie}from"./textarea-7eTptEtD.js";var W=O(),Le=[`desktopHostSwitch`],Re=class extends Error{result;host;constructor(e,t){super(e.reason),this.name=`DesktopHostSwitchError`,this.result=e,this.host=t}},ze=(e,t)=>L(le.getState().dictionary,e,t),Be=async e=>{let{host:t}=e;if(t.id===`local`){let n=(e.localApiOrigin||``).trim();if(!n)throw new Re({ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unreachable`},t);return r({apiBaseUrl:n,clientToken:e.localClientToken||null,runtimeKey:p(t)}),{ok:!0,via:`direct`,status:{status:`ok`,latencyMs:0}}}let n=await d(t,{cachedProbe:e.cachedProbe});if(!n.ok)throw new Re(n,t);return n},Ve=null,He=()=>Ve||(Ve=new k(j,{mutationKey:Le,mutationFn:Be,onError:(e,t)=>{if(!(e instanceof Re)){R.error(ze(`desktopHostSwitcher.toast.instanceUnreachable`,{host:u(t.host.label)}),{description:e instanceof Error?e.message:String(e)});return}if(e.result.reason!==`unsupported`){if(e.result.status.status===`auth`){R.error(ze(`desktopHostSwitcher.status.authRequired`));return}R.error(ze(`desktopHostSwitcher.toast.instanceUnreachable`,{host:u(t.host.label)}))}}}),Ve.subscribe(()=>void 0),Ve),Ue=async e=>{if(f(e.host))return{ok:!0,via:`direct`,status:e.cachedProbe?.status===`ok`?e.cachedProbe:{status:`ok`,latencyMs:0}};if(j.isMutating({mutationKey:Le})>0)return{ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unsupported`};try{return await He().mutate(e)}catch(e){return e instanceof Re?e.result:{ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unreachable`}}},We=e=>{let t=(0,W.c)(2),n=e!==void 0&&e,r;return t[0]===n?r=t[1]:(r={mutationKey:Le,predicate:e=>!n||!e.state.variables?.inlineProgress},t[0]=n,t[1]=r),ne(r)>0},Ge=()=>{let e=(0,W.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={filters:{mutationKey:Le,status:`pending`},select:Ke},e[0]=t):t=e[0],A(t)[0]?.host.id??null};function Ke(e){return e.state.variables}var G=e=>typeof e==`object`&&!!e,K=(e,t)=>{let n=e[t];return typeof n==`string`?n:null},q=(e,t)=>{let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:null},J=(e,t)=>{let n=e[t];return typeof n==`boolean`?n:null},qe=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],Y=()=>o()?(e,t)=>s(e,t):null,Je=e=>{if(!G(e))return;let t=J(e,`enabled`)??!1,n=K(e,`store`)?.toLowerCase()===`settings`?`settings`:`never`,r=K(e,`value`);return{enabled:t,store:n,...r?{value:r}:{}}},Ye=e=>e===`remote`||e===`dynamic`?e:`local`,Xe=e=>{if(!G(e))return null;let t=K(e,`id`);if(!t)return null;let n=J(e,`enabled`)??!0,r=Ye(K(e,`type`)),i=K(e,`localHost`)||K(e,`local_host`)||void 0,a=q(e,`localPort`)??q(e,`local_port`)??void 0,o=K(e,`remoteHost`)||K(e,`remote_host`)||void 0,s=q(e,`remotePort`)??q(e,`remote_port`)??void 0;return{id:t,enabled:n,type:r,...i?{localHost:i}:{},...typeof a==`number`?{localPort:a}:{},...o?{remoteHost:o}:{},...typeof s==`number`?{remotePort:s}:{}}},Ze=e=>{if(!G(e))return null;let t=K(e,`id`),n=K(e,`sshCommand`)||K(e,`ssh_command`);if(!t||!n)return null;let r=K(e,`nickname`),i=e.sshParsed,a=G(i)?{destination:K(i,`destination`)||``,args:qe(i.args)}:void 0,o=G(e.remoteYuri)?e.remoteYuri:G(e.remote_yuri)?e.remote_yuri:{},s=G(e.localForward)?e.localForward:G(e.local_forward)?e.local_forward:{},c=G(e.auth)?e.auth:{},l=K(o,`mode`)?.toLowerCase()===`external`?`external`:`managed`,u=K(o,`installMethod`)||K(o,`install_method`),d=u===`npm`||u===`download_release`||u===`upload_bundle`?u:`bun`,f=K(s,`bindHost`)||K(s,`bind_host`)||`127.0.0.1`,p=f===`localhost`||f===`0.0.0.0`?f:`127.0.0.1`,m=(Array.isArray(e.portForwards)?e.portForwards:Array.isArray(e.port_forwards)?e.port_forwards:[]).map(e=>Xe(e)).filter(e=>!!e),h=q(o,`preferredPort`)??q(o,`preferred_port`),g=q(s,`preferredLocalPort`)??q(s,`preferred_local_port`),_=Je(c.sshPassword||c.ssh_password),v=Je(c.yuriPassword||c.yuri_password);return{id:t,...r?{nickname:r}:{},sshCommand:n,...a&&a.destination?{sshParsed:a}:{},connectionTimeoutSec:q(e,`connectionTimeoutSec`)??q(e,`connection_timeout_sec`)??60,remoteYuri:{mode:l,keepRunning:J(o,`keepRunning`)??J(o,`keep_running`)??!0,relayHost:J(o,`relayHost`)??J(o,`relay_host`)??!0,...h?{preferredPort:h}:{},installMethod:d,uploadBundleOverSsh:J(o,`uploadBundleOverSsh`)??J(o,`upload_bundle_over_ssh`)??!1},localForward:{...g?{preferredLocalPort:g}:{},bindHost:p},auth:{..._?{sshPassword:_}:{},...v?{yuriPassword:v}:{}},portForwards:m}},Qe=e=>{switch(e){case`config_resolved`:case`auth_check`:case`master_connecting`:case`remote_probe`:case`installing`:case`updating`:case`server_detecting`:case`server_starting`:case`forwarding`:case`ready`:case`degraded`:case`error`:return e;default:return`idle`}},$e=e=>{if(!G(e))return null;let t=K(e,`id`);return t?{id:t,phase:Qe(K(e,`phase`)),...K(e,`detail`)?{detail:K(e,`detail`)||void 0}:{},...K(e,`localUrl`)||K(e,`local_url`)?{localUrl:K(e,`localUrl`)||K(e,`local_url`)||void 0}:{},...typeof(q(e,`localPort`)??q(e,`local_port`))==`number`?{localPort:q(e,`localPort`)??q(e,`local_port`)??void 0}:{},...typeof(q(e,`remotePort`)??q(e,`remote_port`))==`number`?{remotePort:q(e,`remotePort`)??q(e,`remote_port`)??void 0}:{},startedByUs:J(e,`startedByUs`)??J(e,`started_by_us`)??!1,retryAttempt:q(e,`retryAttempt`)??q(e,`retry_attempt`)??0,requiresUserAction:J(e,`requiresUserAction`)??J(e,`requires_user_action`)??!1,...K(e,`errorCode`)||K(e,`error_code`)?{errorCode:K(e,`errorCode`)||K(e,`error_code`)||void 0}:{},updatedAtMs:q(e,`updatedAtMs`)??q(e,`updated_at_ms`)??Date.now()}:null},et=e=>{if(!G(e))return null;let t=K(e,`host`),n=K(e,`source`),r=K(e,`sshCommand`)||K(e,`ssh_command`);return!t||!n||!r?null:{host:t,source:n,sshCommand:r,pattern:J(e,`pattern`)??!1}},tt=(e,t)=>({id:e,sshCommand:t,connectionTimeoutSec:60,remoteYuri:{mode:`managed`,keepRunning:!0,relayHost:!0,installMethod:`bun`,uploadBundleOverSsh:!1},localForward:{bindHost:`127.0.0.1`},auth:{},portForwards:[]}),nt=async()=>{let e=Y();if(!e)return{instances:[]};let t=await e(`desktop_ssh_instances_get`);return G(t)?{instances:(Array.isArray(t.instances)?t.instances:Array.isArray(t.desktopSshInstances)?t.desktopSshInstances:[]).map(e=>Ze(e)).filter(e=>!!e)}:{instances:[]}},rt=async e=>{let t=Y();t&&await t(`desktop_ssh_instances_set`,{config:{instances:e.instances}})},it=async()=>{let e=Y();if(!e)return[];let t=await e(`desktop_ssh_import_hosts`);return Array.isArray(t)?t.map(e=>et(e)).filter(e=>!!e):[]},at=async e=>{let t=Y();t&&await t(`desktop_ssh_connect`,{id:e})},ot=async e=>{let t=Y();t&&await t(`desktop_ssh_disconnect`,{id:e})},st=async e=>{let t=Y();if(!t)return[];let n=await t(`desktop_ssh_status`,{...e?{id:e}:{}});return Array.isArray(n)?n.map(e=>$e(e)).filter(e=>!!e):[]},ct=async(e,t)=>{let n=Y();if(!n)return[];let r=await n(`desktop_ssh_logs`,{id:e,...typeof t==`number`?{limit:t}:{}});return Array.isArray(r)?r.filter(e=>typeof e==`string`):[]},lt=async e=>{let t=Y();t&&await t(`desktop_ssh_logs_clear`,{id:e})},ut=(e,t)=>{let n=Math.max(0,Math.trunc(Number(e.fileGroups)||0)),r=Math.max(0,Math.trunc(Number(e.singleFiles)||0)),i=Math.max(0,Math.trunc(Number(e.directories)||0));return{fileGroups:Array.from({length:n},()=>!0),singleFiles:Array.from({length:r},()=>!0),directories:Array.from({length:i},()=>!0),agentsRoot:!0,providerCredentials:t?.includeProviderCredentials===!0,magpie:!1}},dt=e=>{if(!G(e))return null;let t=K(e,`path`),n=q(e,`bytes`);return!t||n===null?null:{path:t,bytes:n}},ft=e=>{if(!G(e))return null;let t=K(e,`path`),n=q(e,`fileCount`)??q(e,`file_count`),r=q(e,`bytes`);return!t||n===null||r===null?null:{path:t,fileCount:n,bytes:r}},pt=e=>{if(e==null||!G(e))return null;let t=q(e,`fileCount`)??q(e,`file_count`),n=q(e,`bytes`);return t===null||n===null?null:{fileCount:t,bytes:n}},mt=e=>{if(e==null||!G(e))return null;let t=q(e,`bytes`);return t===null?null:{bytes:t}},ht=e=>{if(!G(e))return null;let t=Array.isArray(e.files)?e.files:null,n=Array.isArray(e.directories)?e.directories:null,r=qe(e.deletes),i=q(e,`totalBytes`)??q(e,`total_bytes`);if(!t||!n||i===null||!(`agentsRoot`in e)&&!(`agents_root`in e))return null;let a=t.map(e=>dt(e)).filter(e=>!!e),o=n.map(e=>ft(e)).filter(e=>!!e);if(a.length!==t.length||o.length!==n.length)return null;let s=e.agentsRoot??e.agents_root,c=s==null?null:pt(s);if(s!=null&&c===null||!(`providerCredentials`in e))return null;let l=mt(e.providerCredentials);if(e.providerCredentials!==null&&l===null)return null;let u=e.direction===`pull`||e.direction===`push`?e.direction:void 0,d=e.selections,f=G(d)?{fileGroups:Array.isArray(d.fileGroups)?d.fileGroups.map(e=>e!==!1):[],singleFiles:Array.isArray(d.singleFiles)?d.singleFiles.map(e=>e!==!1):[],directories:Array.isArray(d.directories)?d.directories.map(e=>e!==!1):[],agentsRoot:d.agentsRoot!==!1,providerCredentials:d.providerCredentials===!0,magpie:d.magpie===!0}:void 0,p=gt(e.selectionShape??e.selection_shape);return{files:a,directories:o,agentsRoot:c,providerCredentials:l,magpieAvailable:e.magpieAvailable===!0,magpie:mt(e.magpie),deletes:r,totalBytes:i,...u?{direction:u}:{},...f?{selections:f}:{},...p?{selectionShape:p}:{}}},gt=e=>{if(!G(e))return null;let t=q(e,`fileGroups`)??q(e,`file_groups`),n=q(e,`singleFiles`)??q(e,`single_files`),r=q(e,`directories`);return t===null||n===null||r===null||t<0||n<0||r<0?null:{fileGroups:t,singleFiles:n,directories:r}},_t=e=>{if(!G(e))return null;let t=ht(e.plan);if(!t)return null;let n=gt(e.selectionShape??e.selection_shape)??t.selectionShape??null;return{plan:t,remoteExisting:qe(e.remoteExisting??e.remote_existing),remoteAgentsRootExists:J(e,`remoteAgentsRootExists`)??J(e,`remote_agents_root_exists`)??!1,remoteProviderCredentialsExists:J(e,`remoteProviderCredentialsExists`)??!1,...n?{selectionShape:n}:{}}},vt=e=>{if(!G(e)||J(e,`ok`)!==!0)return null;let t=q(e,`files`),n=q(e,`directories`),r=q(e,`deletes`),i=q(e,`totalBytes`)??q(e,`total_bytes`);if(t===null||n===null||r===null||i===null||!(`agentsRoot`in e)&&!(`agents_root`in e))return null;let a=e.agentsRoot??e.agents_root,o=null;if(a!=null){if(!G(a))return null;let e=q(a,`fileCount`)??q(a,`file_count`);if(e===null)return null;o={fileCount:e}}if(!(`providerCredentials`in e))return null;let s=mt(e.providerCredentials);if(e.providerCredentials!==null&&s===null)return null;let c=qe(e.magpieWarnings).filter(e=>e===`sign_in_required`||e===`plugin_install_failed`||e===`agent_settings_skipped`);return{ok:!0,files:t,directories:n,deletes:r,totalBytes:i,agentsRoot:o,providerCredentials:s,...c.length?{magpieWarnings:c}:{}}},yt=async(e={})=>{let t=Y();if(!t)return console.error(`[desktopSsh] config sync local scan skipped: desktop IPC bridge is unavailable in this window`),null;let n=await t(`desktop_ssh_sync_opencode_config`,{stage:`local`,...e.direction?{direction:e.direction}:{},...e.selections?{selections:e.selections}:{}});if(!G(n))return console.error(`[desktopSsh] config sync local scan returned a non-object payload`,n),null;let r=ht(n.plan);if(!r)return console.error(`[desktopSsh] config sync local scan plan payload was not recognized`,n),null;let i=gt(n.selectionShape??n.selection_shape)??r.selectionShape??null;return i?{...r,selectionShape:i}:r},bt=async(e,t={})=>{let n=Y();if(!n)return console.error(`[desktopSsh] config sync preview skipped: desktop IPC bridge is unavailable in this window`),null;let r=await n(`desktop_ssh_sync_opencode_config`,{id:e,...t.targetKind?{targetKind:t.targetKind}:{},...t.direction?{direction:t.direction}:{},...t.selections?{selections:t.selections}:{}}),i=_t(r);return i||console.error(`[desktopSsh] config sync preview payload was not recognized`,r),i},xt=async(e,t={})=>{let n=Y();if(!n)return console.error(`[desktopSsh] config sync apply skipped: desktop IPC bridge is unavailable in this window`),null;let r=await n(`desktop_ssh_sync_opencode_config`,{id:e,apply:!0,...t.targetKind?{targetKind:t.targetKind}:{},...t.direction?{direction:t.direction}:{},...t.selections?{selections:t.selections}:{}}),i=vt(r);return i||console.error(`[desktopSsh] config sync apply payload was not recognized`,r),i},St=async(e,t={})=>{let n=Y();if(!n)return[];let r=await n(`desktop_ssh_sync_runs_list`,{id:e,...t.targetKind?{targetKind:t.targetKind}:{}});return Array.isArray(r)?r.filter(e=>G(e)&&typeof e.syncRunId==`string`&&typeof e.targetId==`string`):[]},Ct=async e=>{if(!o())return async()=>{};let t=window.__YURI_DESKTOP__?.listen;if(typeof t!=`function`)return async()=>{};let n=await t(`yuri:ssh-instance-status`,t=>{let n=$e(t?.payload);n&&e(n)});return async()=>{await n()}},wt=new Set([`nodeRuntimeMissing`,`packageManagerMissing`,`nativeBinding`,`yuriCliMissing`,`yuriRegistry`,`yuriInstall`,`yuriCliIncompatible`,`opencodeInstall`,`serverStart`,`sshAuth`,`sshUnreachable`,`timeout`,`unknown`]),Tt=e=>typeof e==`string`&&wt.has(e),Et=e=>{let t=String(e||``);return/requires Node\.js \d+|no supported Node runtime/i.test(t)?`nodeRuntimeMissing`:/neither bun nor npm/i.test(t)?`packageManagerMissing`:/better-sqlite3|node_gyp_bins|gyp ERR|failed to prepare better-sqlite3/i.test(t)?`nativeBinding`:/Yuri installation completed but the executable is unavailable/i.test(t)?`yuriCliMissing`:/could not reach the npm registry|ENOTFOUND|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|CERT_HAS_EXPIRED|UNABLE_TO_GET_ISSUER_CERT|self-signed certificate|registry\.npmjs|npm error code E404|npm ERR! code E404|getaddrinfo/i.test(t)?`yuriRegistry`:/Failed to install Yuri/i.test(t)?`yuriInstall`:/Unknown option:\s*--relay-host|does not advertise --relay-host|does not support --relay-host/i.test(t)||/Unknown option:/i.test(t)?`yuriCliIncompatible`:/Failed to install OpenCode|OpenCode CLI/i.test(t)?`opencodeInstall`:/failed to become reachable|Managed Yuri server failed/i.test(t)?`serverStart`:/Permission denied|Authentication failed|publickey|keyboard-interactive/i.test(t)?`sshAuth`:/Could not resolve hostname|Connection refused|Connection timed out|ControlMaster connection timed out|SSH master process exited|Network is unreachable/i.test(t)?`sshUnreachable`:/Timed out waiting for SSH|Timed out waiting for forwarded/i.test(t)?`timeout`:`unknown`},Dt=(e,t)=>Tt(e)?e:Et(t),Ot=e=>{switch(e){case`nodeRuntimeMissing`:return`desktopHostSwitcher.sshError.nodeRuntimeMissing.title`;case`packageManagerMissing`:return`desktopHostSwitcher.sshError.packageManagerMissing.title`;case`nativeBinding`:return`desktopHostSwitcher.sshError.nativeBinding.title`;case`yuriCliMissing`:return`desktopHostSwitcher.sshError.yuriCliMissing.title`;case`yuriRegistry`:return`desktopHostSwitcher.sshError.yuriRegistry.title`;case`yuriInstall`:return`desktopHostSwitcher.sshError.yuriInstall.title`;case`yuriCliIncompatible`:return`desktopHostSwitcher.sshError.yuriCliIncompatible.title`;case`opencodeInstall`:return`desktopHostSwitcher.sshError.opencodeInstall.title`;case`serverStart`:return`desktopHostSwitcher.sshError.serverStart.title`;case`sshAuth`:return`desktopHostSwitcher.sshError.sshAuth.title`;case`sshUnreachable`:return`desktopHostSwitcher.sshError.sshUnreachable.title`;case`timeout`:return`desktopHostSwitcher.sshError.timeout.title`;default:return`desktopHostSwitcher.sshError.unknown.title`}},kt=e=>{switch(e){case`nodeRuntimeMissing`:return`desktopHostSwitcher.sshError.nodeRuntimeMissing.guidance`;case`packageManagerMissing`:return`desktopHostSwitcher.sshError.packageManagerMissing.guidance`;case`nativeBinding`:return`desktopHostSwitcher.sshError.nativeBinding.guidance`;case`yuriCliMissing`:return`desktopHostSwitcher.sshError.yuriCliMissing.guidance`;case`yuriRegistry`:return`desktopHostSwitcher.sshError.yuriRegistry.guidance`;case`yuriInstall`:return`desktopHostSwitcher.sshError.yuriInstall.guidance`;case`yuriCliIncompatible`:return`desktopHostSwitcher.sshError.yuriCliIncompatible.guidance`;case`opencodeInstall`:return`desktopHostSwitcher.sshError.opencodeInstall.guidance`;case`serverStart`:return`desktopHostSwitcher.sshError.serverStart.guidance`;case`sshAuth`:return`desktopHostSwitcher.sshError.sshAuth.guidance`;case`sshUnreachable`:return`desktopHostSwitcher.sshError.sshUnreachable.guidance`;case`timeout`:return`desktopHostSwitcher.sshError.timeout.guidance`;default:return`desktopHostSwitcher.sshError.unknown.guidance`}},At=e=>e===`unknown`||e===`yuriCliIncompatible`,jt=(e,t,n)=>{let r=typeof n==`string`?n.trim():``;return!At(t)||!r||r===e?e:`${e}\n${r}`},X=C();function Mt(e){let t=(0,W.c)(27),{errorCode:n,detail:r,className:i}=e,{t:a}=se(),o,s,c,l,u,d;if(t[0]!==i||t[1]!==r||t[2]!==n||t[3]!==a){let e=Dt(n,r);o=a(kt(e));let f;t[10]===r?f=t[11]:(f=typeof r==`string`?r.trim():``,t[10]=r,t[11]=f),s=f,c=At(e)&&!!s&&s!==o,t[12]===i?d=t[13]:(d=I(`space-y-1`,i),t[12]=i,t[13]=d),l=`typography-ui-label text-[var(--status-error)]`,u=a(Ot(e)),t[0]=i,t[1]=r,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9];let f;t[14]!==l||t[15]!==u?(f=(0,X.jsx)(`p`,{className:l,children:u}),t[14]=l,t[15]=u,t[16]=f):f=t[16];let p;t[17]===o?p=t[18]:(p=(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:o}),t[17]=o,t[18]=p);let m;t[19]!==s||t[20]!==c?(m=c?(0,X.jsx)(`p`,{className:`typography-meta break-words text-muted-foreground`,children:s}):null,t[19]=s,t[20]=c,t[21]=m):m=t[21];let h;return t[22]!==d||t[23]!==f||t[24]!==p||t[25]!==m?(h=(0,X.jsxs)(`div`,{className:d,children:[f,p,m]}),t[22]=d,t[23]=f,t[24]=p,t[25]=m,t[26]=h):h=t[26],h}var Nt=`/auth/passkey/authenticate/options`,Pt=`/auth/passkey/authenticate/verify`,Ft=`/auth/passkey/register/options`,It=`/auth/passkey/register/verify`,Lt=`/api/passkeys`,Rt=`/auth/passkey/status`,zt=`/api/auth/reset`,Bt={enabled:!1,hasPasskeys:!1,passkeyCount:0,rpID:null},Vt=async(e,t)=>a(e,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),Ht=async(e,t)=>{try{let t=await e.json();if(t&&typeof t.error==`string`&&t.error.trim())return t.error}catch{}return t},Ut=e=>e instanceof de&&e.code===`ERROR_CEREMONY_ABORTED`,Wt=()=>{pe.cancelCeremony()},Gt=()=>typeof window>`u`?{supported:!1,reason:`Passkeys are unavailable outside the browser.`}:window.isSecureContext?{supported:!0,reason:``}:{supported:!1,reason:`Passkeys require HTTPS or localhost.`},Kt=async()=>{let e=Gt();if(!e.supported)throw Error(e.reason);let t=await Vt(Ft,{label:typeof navigator.userAgent==`string`&&navigator.userAgent.trim()?navigator.userAgent:`This device`});if(!t.ok)throw Error(await Ht(t,`Could not start passkey setup.`));let{requestId:n,optionsJSON:r}=await t.json(),i=await Vt(It,{requestId:n,response:await fe({optionsJSON:r})});if(!i.ok)throw Error(await Ht(i,`Could not finish passkey setup.`));return i.json().catch(()=>null)},qt=async(e,t={})=>{let n=Gt();if(!n.supported)throw Error(n.reason);let r=await Vt(Nt);if(!r.ok)throw Error(await Ht(r,`Passkey sign-in is not available right now.`));let{requestId:i,optionsJSON:a}=await r.json(),o=await Vt(Pt,{requestId:i,response:await me({optionsJSON:a}),trustDevice:e,issueClientToken:t.issueClientToken===!0,clientLabel:t.clientLabel,clientKind:t.clientKind,dedupeKey:t.dedupeKey});if(!o.ok)throw Error(await Ht(o,`Passkey sign-in failed.`));return o.json().catch(()=>null)},Jt=async()=>{let e=await a(Rt,{method:`GET`,credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)return Bt;let t=await e.json().catch(()=>null);return{enabled:t?.enabled===!0,hasPasskeys:t?.hasPasskeys===!0,passkeyCount:typeof t?.passkeyCount==`number`?t.passkeyCount:0,rpID:typeof t?.rpID==`string`&&t.rpID?t.rpID:null}},Yt=async()=>{let e=await a(Lt,{method:`GET`,credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)throw Error(await Ht(e,`Could not load passkeys.`));let t=await e.json().catch(()=>null);return Array.isArray(t?.passkeys)?t.passkeys:[]},Xt=async e=>{let t=await a(`${Lt}/${encodeURIComponent(e)}`,{method:`DELETE`,credentials:`include`,headers:{Accept:`application/json`}});if(!t.ok)throw Error(await Ht(t,`Could not remove passkey.`));return t.json().catch(()=>null)},Zt=async()=>{let e=await Vt(zt);if(!e.ok)throw Error(await Ht(e,`Could not clear saved authentication.`));try{let{clearAssistantAttachmentCacheAll:e}=await ae(async()=>{let{clearAssistantAttachmentCacheAll:e}=await import(`./assistant-attachment-cache-B_qRvy-k.js`).then(e=>e.t);return{clearAssistantAttachmentCacheAll:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])),{invalidateRuntimeAuthSession:t}=await ae(async()=>{let{invalidateRuntimeAuthSession:e}=await import(`./runtime-auth-DBn9yahL.js`).then(e=>e.m);return{invalidateRuntimeAuthSession:e}},__vite__mapDeps([2,1]));await e(`auth-reset`),t()}catch{}return e.json().catch(()=>null)},Z=e(S(),1);function Qt(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=I(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{"data-slot":`card`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $t(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=I(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{"data-slot":`card-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function en(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=I(`leading-none font-semibold`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{"data-slot":`card-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function tn(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=I(`px-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{"data-slot":`card-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var nn=class extends Z.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.setState({error:e,errorInfo:t,copied:!1}),console.error(`Error caught by boundary:`,e,t)}handleReset=()=>{this.setState({hasError:!1,error:void 0,errorInfo:void 0})};handleCopy=async()=>{let{strings:e}=this.props,t=`${this.state.error?String(this.state.error):e.unknownError}${this.state.error?.stack?`\n\nStack:\n${this.state.error.stack}`:``}${this.state.errorInfo?.componentStack?`\n\n${e.componentStackLabel}${this.state.errorInfo.componentStack}`:``}`;(await oe(t)).ok&&(this.setState({copied:!0}),window.setTimeout(()=>{this.setState(e=>e.copied?{copied:!1}:null)},1500))};render(){let{strings:e}=this.props;return this.state.hasError?this.props.fallback?this.props.fallback:(0,X.jsx)(`div`,{className:`p-4 flex items-center justify-center min-h-screen`,children:(0,X.jsxs)(Qt,{className:`w-full max-w-md`,children:[(0,X.jsx)($t,{className:`text-center`,children:(0,X.jsxs)(en,{className:`flex items-center justify-center gap-2 text-destructive`,children:[(0,X.jsx)(H,{name:`error-warning`,className:`h-5 w-5`}),e.title]})}),(0,X.jsxs)(tn,{className:`space-y-4`,children:[(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground text-center`,children:e.description}),this.state.error&&(0,X.jsxs)(`details`,{className:`text-xs font-mono bg-muted p-3 rounded`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer hover:bg-interactive-hover/80`,children:e.detailsSummary}),(0,X.jsxs)(`pre`,{className:`mt-2 max-h-48 overflow-auto`,children:[this.state.error.toString(),this.state.errorInfo?.componentStack?`\n\n${e.componentStackLabel}${this.state.errorInfo.componentStack}`:``]})]}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsxs)(ce,{onClick:this.handleReset,variant:`outline`,className:`flex-1`,children:[(0,X.jsx)(H,{name:`restart`,className:`h-4 w-4 mr-2`}),e.tryAgain]}),(0,X.jsx)(ce,{onClick:this.handleCopy,variant:`outline`,className:`flex-1`,children:this.state.copied?e.copied:e.copy})]})]})]})}):this.props.children}},rn=e=>{let t=(0,W.c)(29),{children:n,fallback:r}=e,{t:i}=se(),a;t[0]===i?a=t[1]:(a=i(`errorBoundary.state.unknownError`),t[0]=i,t[1]=a);let o;t[2]===i?o=t[3]:(o=i(`errorBoundary.title`),t[2]=i,t[3]=o);let s;t[4]===i?s=t[5]:(s=i(`errorBoundary.description`),t[4]=i,t[5]=s);let c;t[6]===i?c=t[7]:(c=i(`errorBoundary.actions.errorDetails`),t[6]=i,t[7]=c);let l;t[8]===i?l=t[9]:(l=i(`errorBoundary.state.componentStackLabel`),t[8]=i,t[9]=l);let u;t[10]===i?u=t[11]:(u=i(`errorBoundary.actions.tryAgain`),t[10]=i,t[11]=u);let d;t[12]===i?d=t[13]:(d=i(`errorBoundary.actions.copied`),t[12]=i,t[13]=d);let f;t[14]===i?f=t[15]:(f=i(`errorBoundary.actions.copy`),t[14]=i,t[15]=f);let p;t[16]!==a||t[17]!==o||t[18]!==s||t[19]!==c||t[20]!==l||t[21]!==u||t[22]!==d||t[23]!==f?(p={unknownError:a,title:o,description:s,detailsSummary:c,componentStackLabel:l,tryAgain:u,copied:d,copy:f},t[16]=a,t[17]=o,t[18]=s,t[19]=c,t[20]=l,t[21]=u,t[22]=d,t[23]=f,t[24]=p):p=t[24];let m=p,h;return t[25]!==n||t[26]!==r||t[27]!==m?(h=(0,X.jsx)(nn,{fallback:r,strings:m,children:n}),t[25]=n,t[26]=r,t[27]=m,t[28]=h):h=t[28],h},an=`__unassigned__`,on={mod:`mod`,shift:`shift`,alt:`alt`,option:`alt`,ctrl:`ctrl`,meta:`mod`,cmd:`mod`,command:`mod`},sn={mod:P()?`⌘`:`Ctrl`,shift:`⇧`,alt:`⌥`,option:`⌥`,ctrl:`⌃`},cn={comma:`,`,period:`.`,enter:`Enter`,escape:`Esc`,tab:`Tab`,space:`Space`,backspace:`⌫`,delete:`⌦`,arrowup:`↑`,arrowdown:`↓`,arrowleft:`←`,arrowright:`→`,home:`Home`,end:`End`,pageup:`Page Up`,pagedown:`Page Down`,backtick:"`",grave:"`","=":`=`,equal:`=`,plus:`+`,minus:`-`,"-":`-`},ln=[`mod`,`ctrl`,`shift`,`alt`],un={"{":`[`,"}":`]`,":":`;`,'"':`'`,"<":`,`,">":`.`,"?":`/`,"|":`\\`,"~":"`","!":`1`,"@":`2`,"#":`3`,$:`4`,"%":`5`,"^":`6`,"&":`7`,"*":`8`,"(":`9`,")":`0`};function dn(e){return e.trim().toLowerCase()===an}function fn(e){let t=e.toLowerCase();return t===`,`?`comma`:t===`.`?`period`:t===` `?`space`:t===`esc`?`escape`:t===`+`?`plus`:t===`-`||t===`_`?`minus`:t===`arrowup`?`arrowup`:t===`arrowdown`?`arrowdown`:t===`arrowleft`?`arrowleft`:t===`arrowright`?`arrowright`:t==="`"?`backtick`:un[t]??t}var pn=[{id:`open_command_palette`,defaultCombo:`mod+p`,label:`Open command palette`,description:`Open the command palette`,customizable:!0},{id:`focus_input`,defaultCombo:`mod+i`,label:`Focus input`,description:`Focus the chat input field`,customizable:!0},{id:`open_status`,defaultCombo:`mod+shift+o`,label:`Open OpenCode status`,description:`Open the OpenCode status dialog`},{id:`open_settings`,defaultCombo:`mod+comma`,label:`Open settings`,description:`Open the settings panel`,customizable:!0},{id:`toggle_terminal`,defaultCombo:`ctrl+backtick`,label:`Toggle terminal`,description:`Toggle the integrated terminal`,customizable:!0},{id:`toggle_bottom_panel`,defaultCombo:`mod+j`,label:`Toggle bottom panel`,description:`Toggle the bottom panel dock`,customizable:!0},{id:`toggle_terminal_expanded`,defaultCombo:`mod+shift+j`,label:`Toggle terminal expanded`,description:`Toggle terminal expanded or collapsed`,customizable:!0},{id:`new_terminal_tab`,defaultCombo:`mod+t`,label:`New terminal tab`,description:`Create a new terminal tab when the terminal is focused`,customizable:!0},{id:`open_new_terminal`,defaultCombo:`mod+shift+backtick`,label:`Open new terminal`,description:`Open the terminal panel and create a new terminal tab`,customizable:!0},{id:`previous_terminal_tab`,defaultCombo:`mod+shift+[`,label:`Previous terminal tab`,description:`Switch to the previous terminal tab when the terminal is focused`,customizable:!0},{id:`next_terminal_tab`,defaultCombo:`mod+shift+]`,label:`Next terminal tab`,description:`Switch to the next terminal tab when the terminal is focused`,customizable:!0},{id:`toggle_files`,defaultCombo:`mod+shift+f`,label:`Toggle files`,description:`Toggle the files panel`},{id:`toggle_sidebar`,defaultCombo:`mod+b`,label:`Toggle sidebar`,description:`Toggle the session sidebar`,customizable:!0},{id:`open_timeline_dialog`,defaultCombo:`mod+t`,label:`Open conversation timeline`,description:`Search and navigate within current conversation`,customizable:!0},{id:`toggle_prompt_navigator`,defaultCombo:`mod+alt+p`,label:`Toggle prompt navigator`,description:`Show or hide the prompt navigator panel in chat`,customizable:!0},{id:`toggle_right_sidebar`,defaultCombo:`mod+alt+b`,defaultAliases:[`mod+\\`],label:`Toggle review panel`,description:`Toggle the review panel (right sidebar)`,customizable:!0},{id:`open_right_sidebar_git`,defaultCombo:`mod+shift+g`,label:`Open right sidebar Git tab`,description:`Open right sidebar and select Git`,customizable:!0},{id:`open_right_sidebar_files`,defaultCombo:`mod+shift+f`,label:`Open right sidebar Files tab`,description:`Open right sidebar and select Files`,customizable:!0},{id:`cycle_right_sidebar_tab`,defaultCombo:`mod+alt+shift+r`,label:`Cycle right sidebar tab`,description:`Cycle through right sidebar tabs`,customizable:!0},{id:`close_context_panel_tab`,defaultCombo:`mod+w`,label:`Close context panel tab`,description:`Close the active context panel tab (closes the panel when empty)`,customizable:!0},{id:`previous_session`,defaultCombo:`mod+shift+[`,defaultAliases:[`mod+arrowup`],label:`Previous session`,description:`Switch to the previous session`,customizable:!0},{id:`next_session`,defaultCombo:`mod+shift+]`,defaultAliases:[`mod+arrowdown`],label:`Next session`,description:`Switch to the next session`,customizable:!0},{id:`new_chat`,defaultCombo:`mod+n`,label:`New session`,description:`Start a new session`,customizable:!0},{id:`new_chat_worktree`,defaultCombo:`mod+shift+alt+n`,label:`New worktree draft`,description:`Create a new worktree and open a draft in it`,customizable:!0},{id:`new_mini_chat`,defaultCombo:`mod+alt+n`,label:`New Mini Chat window`,description:`Open a new Mini Chat draft window`,customizable:!0},{id:`submit_message`,defaultCombo:`mod+enter`,label:`Submit message`,description:`Submit the current message`},{id:`clear_input`,defaultCombo:`escape`,label:`Clear input`,description:`Clear the input field`},{id:`clear_all_messages`,defaultCombo:`ctrl+c`,label:`Clear all messages`,description:`Clear the composer input and queued messages`,customizable:!0},{id:`open_diff_panel`,defaultCombo:`mod+2`,label:`Open diff panel`,description:`Switch to the diff panel`},{id:`open_terminal_panel`,defaultCombo:`mod+3`,label:`Open terminal panel`,description:`Switch to the terminal panel`},{id:`open_git_panel`,defaultCombo:`mod+4`,label:`Open git panel`,description:`Switch to the git panel`},{id:`open_help`,defaultCombo:`mod+.`,label:`Open keyboard shortcuts`,description:`Show the keyboard shortcuts help`,customizable:!0},{id:`toggle_services_menu`,defaultCombo:`mod+shift+s`,label:`Toggle services menu`,description:`Open or close the services menu`,customizable:!0},{id:`open_usage`,defaultCombo:`mod+shift+c`,label:`Open usage`,description:`Open the usage panel`,customizable:!0},{id:`cycle_services_tab`,defaultCombo:`mod+alt+shift+s`,label:`Cycle services tab`,description:`Cycle through tabs in the services menu`,customizable:!0},{id:`cycle_theme`,defaultCombo:`mod+/`,label:`Cycle theme`,description:`Cycle between light, dark, and system theme`,customizable:!0},{id:`zoom_in`,defaultCombo:`mod+=`,label:`Zoom in`,description:`Increase the webview zoom level`,customizable:!0},{id:`zoom_out`,defaultCombo:`mod+-`,label:`Zoom out`,description:`Decrease the webview zoom level`,customizable:!0},{id:`zoom_reset`,defaultCombo:`mod+0`,label:`Reset zoom`,description:`Reset the webview zoom level to 100%`,customizable:!0},{id:`leader_key`,defaultCombo:`ctrl+x`,label:`Leader key`,description:`Start an OpenCode-style chord, then press M / A / N / C`,customizable:!0},{id:`open_model_selector`,defaultCombo:`mod+shift+m`,label:`Open model selector`,description:`Open model selector while in chat`,customizable:!0},{id:`cycle_thinking_variant`,defaultCombo:`mod+shift+t`,label:`Cycle thinking variant`,description:`Cycle thinking variant while in chat`},{id:`cycle_agent`,defaultCombo:`tab`,label:`Cycle agent`,description:`Cycle agent while the model selector is open`,customizable:!0},{id:`cycle_favorite_model_forward`,defaultCombo:`ctrl+]`,label:`Cycle favorite model forward`,description:`Cycle forward through starred models without opening the picker`,customizable:!0},{id:`cycle_favorite_model_backward`,defaultCombo:`ctrl+[`,label:`Cycle favorite model backward`,description:`Cycle backward through starred models without opening the picker`,customizable:!0},{id:`expand_input`,defaultCombo:`mod+shift+e`,label:`Expand input`,description:`Toggle focus mode for the chat input`,customizable:!0},{id:`toggle_dictation`,defaultCombo:`mod+alt+v`,label:`Voice input`,description:`Start dictation; press again to confirm and insert the transcript`,customizable:!0},{id:`abort_run`,defaultCombo:`escape`,label:`Abort active run`,description:`Abort the currently running task (double press)`},{id:`switch_tab_1`,defaultCombo:`mod+1`,label:`Switch to visible session 1`,description:`Switch to the first visible sidebar session`},{id:`switch_tab_2`,defaultCombo:`mod+2`,label:`Switch to visible session 2`,description:`Switch to the second visible sidebar session`},{id:`switch_tab_3`,defaultCombo:`mod+3`,label:`Switch to visible session 3`,description:`Switch to the third visible sidebar session`},{id:`switch_tab_4`,defaultCombo:`mod+4`,label:`Switch to visible session 4`,description:`Switch to the fourth visible sidebar session`},{id:`switch_tab_5`,defaultCombo:`mod+5`,label:`Switch to visible session 5`,description:`Switch to the fifth visible sidebar session`},{id:`switch_tab_6`,defaultCombo:`mod+6`,label:`Switch to visible session 6`,description:`Switch to the sixth visible sidebar session`},{id:`switch_tab_7`,defaultCombo:`mod+7`,label:`Switch to visible session 7`,description:`Switch to the seventh visible sidebar session`},{id:`switch_tab_8`,defaultCombo:`mod+8`,label:`Switch to visible session 8`,description:`Switch to the eighth visible sidebar session`},{id:`switch_tab_9`,defaultCombo:`mod+9`,label:`Switch to visible session 9`,description:`Switch to the ninth visible sidebar session`}];function mn(e){if(dn(e))return an;let t=e.toLowerCase().trim().split(`+`).map(e=>e.trim()).filter(Boolean),n=new Set,r=``;for(let e of t){let t=e===`,`?`comma`:e===`.`?`period`:e,i=on[t];if(i){n.add(i);continue}r=t}return[...ln.filter(e=>n.has(e)),r].filter(Boolean).join(`+`)}function hn(e){return dn(e)?!0:gn(e).key.trim().length>0}function gn(e){if(dn(e))return{modifiers:new Set,key:an};let t=mn(e).split(`+`),n=new Set,r=``;for(let e of t){let t=on[e];t?n.add(t):r=e}return{modifiers:n,key:r}}function _n(e){if(dn(e))return`Unassigned`;let t=gn(e);if(!t.key&&t.modifiers.size===0)return`Unassigned`;let n=[];for(let e of ln)t.modifiers.has(e)&&n.push(sn[e]);if(t.key){let e=cn[t.key.toLowerCase()]||t.key.toUpperCase();n.push(e)}return n.join(` + `)}function vn(e){return pn.find(t=>t.id===e)}function yn(){return pn.filter(e=>e.customizable===!0)}function bn(e,t){let n=vn(e);if(!n)return``;let r=t?.[e];if(typeof r==`string`){if(r.trim().toLowerCase()===`__unassigned__`)return``;let e=mn(r);if(e===`__unassigned__`)return an;if(hn(e))return e}return n.defaultCombo}function xn(e,t){let n=vn(e);if(!n)return[];let r=bn(e,t);return r===n.defaultCombo?[n.defaultCombo,...n.defaultAliases??[]]:r?[r]:[]}function Sn(e){if(dn(e))return!1;let t=gn(e);if(!t.modifiers.has(`mod`))return!1;let n=t.key.toLowerCase();return new Set([`w`,`t`,`r`,`p`,`s`,`f`,`l`,`n`]).has(n)&&!t.modifiers.has(`shift`)&&!t.modifiers.has(`alt`)}function Cn(e,t){let n=typeof t==`string`?t:t.defaultCombo;if(dn(n))return!1;let r=gn(n),i=r.modifiers.has(`mod`),a=r.modifiers.has(`shift`),o=r.modifiers.has(`alt`),s=r.modifiers.has(`ctrl`),l=P()&&c(),u=P(),d=l?e.metaKey:u&&e.metaKey||e.ctrlKey;if(i&&!d||!i&&e.metaKey||a!==e.shiftKey||o!==e.altKey)return!1;if(s){if(!e.ctrlKey)return!1}else{let t=i&&!l&&e.ctrlKey;if(e.ctrlKey&&!t)return!1}let f=e.key;return(!f||f===`Dead`)&&e.code===`Backquote`&&(f="`"),e.altKey&&(e.code.startsWith(`Key`)&&e.code.length===4?f=e.code.slice(3).toLowerCase():e.code.startsWith(`Digit`)&&e.code.length===6&&(f=e.code.slice(5))),fn(f)===fn(r.key)}function wn(){return P()?`⌘`:`Ctrl`}function Tn(e,t,n){if(Cn(e,n))return!0;let r=mn(n),i=P()&&c(),a=P();return!(i?e.metaKey:a&&e.metaKey||e.ctrlKey)||e.altKey||i&&e.ctrlKey&&!e.metaKey?!1:t===`in`&&r===`mod+=`?e.key===`+`||e.code===`NumpadAdd`:t===`out`&&(r===`mod+-`||r===`mod+minus`)?e.key===`_`||e.code===`NumpadSubtract`:!1}var En=Z.createContext(null),Dn=e=>e?e.closest(`[data-slot="dialog-content"], [role="dialog"]`):null;function On(e,t){return e&&Z.isValidElement(t)?{render:t}:{children:t}}function kn(e){let t=(0,W.c)(9),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let[r,i]=Z.useState(null),a;t[2]===r?a=t[3]:(a={portalContainer:r,setPortalContainer:i},t[2]=r,t[3]=a);let o=a,s;t[4]===n?s=t[5]:(s=(0,X.jsx)(w,{...n}),t[4]=n,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,X.jsx)(En.Provider,{value:o,children:s}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function An(e){let t=(0,W.c)(22),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:n,children:r,onPointerDownCapture:a,onFocusCapture:i,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=Z.useContext(En),c;t[6]===s?c=t[7]:(c=e=>{if(!s)return;let t=e instanceof HTMLElement?e:null;s.setPortalContainer(Dn(t))},t[6]=s,t[7]=c);let l=c,u;t[8]!==n||t[9]!==r?(u=On(n,r),t[8]=n,t[9]=r,t[10]=u):u=t[10];let d=u,f;t[11]!==a||t[12]!==l?(f=e=>{l(e.currentTarget),a?.(e)},t[11]=a,t[12]=l,t[13]=f):f=t[13];let p;t[14]!==i||t[15]!==l?(p=e=>{l(e.currentTarget),i?.(e)},t[14]=i,t[15]=l,t[16]=p):p=t[16];let m;return t[17]!==o||t[18]!==d||t[19]!==f||t[20]!==p?(m=(0,X.jsx)(T,{"data-slot":`dropdown-menu-trigger`,onPointerDownCapture:f,onFocusCapture:p,...o,...d}),t[17]=o,t[18]=d,t[19]=f,t[20]=p,t[21]=m):m=t[21],m}function jn(e){let t=(0,W.c)(40),n,r,i,a,o,s,c,l,u,d,f,p,_;if(t[0]!==e){let{className:m,sideOffset:h,align:g,side:v,alignOffset:y,anchor:b,portalToBody:x,positionerClassName:S,style:C,children:w,onCloseAutoFocus:T,collisionPadding:E,collisionAvoidance:D,...O}=e;o=m,d=h,n=g,l=v,r=y,i=b,f=x,s=S,u=C,a=w,p=E,_=D,c=O,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=_}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],_=t[13];let v=d===void 0?4:d,y=f!==void 0&&f,b=p===void 0?8:p,x;t[14]===_?x=t[15]:(x=_===void 0?{side:`shift`,align:`shift`}:_,t[14]=_,t[15]=x);let S=x,C=Z.useContext(En),w=y?void 0:C?.portalContainer||void 0,T;t[16]===s?T=t[17]:(T=I(`app-region-no-drag z-50`,s),t[16]=s,t[17]=T);let E;t[18]===u?E=t[19]:(E={color:`var(--surface-elevated-foreground)`,...u},t[18]=u,t[19]=E);let D;t[20]===o?D=t[21]:(D=I(je,o),t[20]=o,t[21]=D);let O;t[22]!==a||t[23]!==c||t[24]!==E||t[25]!==D?(O=(0,X.jsx)(g,{"data-slot":`dropdown-menu-content`,style:E,className:D,...c,children:a}),t[22]=a,t[23]=c,t[24]=E,t[25]=D,t[26]=O):O=t[26];let k;t[27]!==n||t[28]!==r||t[29]!==i||t[30]!==S||t[31]!==b||t[32]!==l||t[33]!==v||t[34]!==O||t[35]!==T?(k=(0,X.jsx)(m,{anchor:i,sideOffset:v,align:n,side:l,alignOffset:r,collisionPadding:b,collisionAvoidance:S,className:T,children:O}),t[27]=n,t[28]=r,t[29]=i,t[30]=S,t[31]=b,t[32]=l,t[33]=v,t[34]=O,t[35]=T,t[36]=k):k=t[36];let A;return t[37]!==k||t[38]!==w?(A=(0,X.jsx)(h,{container:w,children:k}),t[37]=k,t[38]=w,t[39]=A):A=t[39],A}function Mn(e){let t=(0,W.c)(24),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({className:i,inset:a,variant:l,asChild:n,children:r,onSelect:s,onClick:o,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=l===void 0?`default`:l,d;t[9]!==n||t[10]!==r?(d=On(n,r),t[9]=n,t[10]=r,t[11]=d):d=t[11];let f=d,p;t[12]!==o||t[13]!==s?(p=e=>{o?.(e),e.defaultPrevented||s?.(e)},t[12]=o,t[13]=s,t[14]=p):p=t[14];let m=p,h;t[15]===i?h=t[16]:(h=I(Pe,i),t[15]=i,t[16]=h);let g;return t[17]!==m||t[18]!==a||t[19]!==c||t[20]!==f||t[21]!==h||t[22]!==u?(g=(0,X.jsx)(x,{"data-slot":`dropdown-menu-item`,"data-inset":a,"data-variant":u,className:h,...c,onClick:m,...f}),t[17]=m,t[18]=a,t[19]=c,t[20]=f,t[21]=h,t[22]=u,t[23]=g):g=t[23],g}function Nn(e){let t=(0,W.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(b,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function Pn(e){let t=(0,W.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=I(`data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover data-[checked]:bg-interactive-selection data-[checked]:text-interactive-selection-foreground relative flex cursor-pointer items-start gap-2 rounded-lg py-1 pl-2 pr-8 typography-ui-label outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-3.5 items-center justify-center text-primary`,children:(0,X.jsx)(_,{children:(0,X.jsx)(H,{name:`check`,className:`size-3`})})}),t[6]=o):o=t[6];let s;return t[7]!==n||t[8]!==i||t[9]!==a?(s=(0,X.jsxs)(v,{"data-slot":`dropdown-menu-radio-item`,className:a,...i,children:[o,n]}),t[7]=n,t[8]=i,t[9]=a,t[10]=s):s=t[10],s}function Fn(e){let t=(0,W.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=I(`px-2 py-1 typography-ui-label font-medium data-[inset]:pl-8`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,X.jsx)(`div`,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function In(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=I(Me,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(y,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Ln=e(E(),1),Rn=`mobile-overlay-root`,zn=16,Bn=200,Vn=[],Hn=0,Un=``,Wn=0,Gn=()=>{if(typeof document>`u`)return null;let e=document.getElementById(Rn);return e||(e=document.createElement(`div`),e.id=Rn,document.body.appendChild(e)),e},Kn=({open:e,title:t,onClose:n,children:r,footer:i,className:a,contentMaxHeightClassName:o,renderHeader:s,containedBody:c=!1,closeAriaLabel:l})=>{let u=Z.useRef(null),d=Z.useRef(Symbol(`mobile-overlay`)),f=Z.useRef(n);f.current=n;let[p,m]=Z.useState(!1),[h,g]=Z.useState(!1);if(typeof document<`u`&&!u.current&&(u.current=Gn()),Z.useEffect(()=>{if(!e){m(!1),g(!1);return}let t=window.setTimeout(()=>m(!0),zn),n=window.setTimeout(()=>g(!0),266);return()=>{window.clearTimeout(t),window.clearTimeout(n)}},[e]),Z.useLayoutEffect(()=>{if(e)return Wn===0&&window.dispatchEvent(new Event(`yuri:mobile-overlay-opened`)),Wn+=1,()=>{Wn=Math.max(0,Wn-1),Wn===0&&window.dispatchEvent(new Event(`yuri:mobile-overlay-closed`))}},[e]),Z.useEffect(()=>{if(!e)return;let t=d.current;Vn.push(t),Hn===0&&(Un=document.body.style.overflow),Hn+=1,document.body.style.overflow=`hidden`;let n=e=>{e.key===`Escape`&&Vn[Vn.length-1]===t&&f.current()};return document.addEventListener(`keydown`,n),()=>{let e=Vn.lastIndexOf(t);e>=0&&Vn.splice(e,1),Hn=Math.max(0,Hn-1),Hn===0&&(document.body.style.overflow=Un),document.removeEventListener(`keydown`,n)}},[e]),!e||!u.current)return null;let _=o??`max-h-[min(70vh,520px)]`,v=(0,X.jsx)(`div`,{className:I(`yuri-keyboard-inset-surface fixed inset-0 z-[60] flex flex-col bg-[rgb(0_0_0_/_0.45)] transition-opacity duration-200 ease-out`,!h&&`yuri-keyboard-inset-snap`,p?`opacity-100`:`opacity-0`),role:`dialog`,"aria-modal":`true`,"aria-label":t,onPointerDown:xe,onClick:e=>{be(e)&&n()},children:(0,X.jsxs)(`div`,{className:I(`mt-auto flex max-h-[calc(100dvh-0.75rem)] min-h-0 w-full flex-col rounded-t-xl border-x border-t border-border/50 bg-background pb-[max(0.5rem,var(--yuri-app-bottom-safe,0px),var(--yuri-safe-area-bottom,env(safe-area-inset-bottom,0px)))] shadow-none pwa-overlay-panel`,`mx-auto max-w-lg`,a),style:{transform:p?`none`:`translateY(100%)`,transition:`transform ${Bn}ms cubic-bezier(0.32, 0.72, 0, 1)`},onClick:e=>e.stopPropagation(),children:[(()=>{let e=(0,X.jsx)(`button`,{type:`button`,onClick:n,className:I(`flex items-center justify-center rounded-lg text-muted-foreground hover:bg-interactive-hover`,c?`size-11`:`h-8 w-8`),"aria-label":l??t,children:(0,X.jsx)(H,{name:`close`,className:`h-4 w-4`})});return s?s(e):(0,X.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border/40`,children:[(0,X.jsx)(`h2`,{className:`typography-ui-label font-semibold text-foreground`,children:t}),e]})})(),c?(0,X.jsx)(`div`,{className:I(`flex min-h-0 flex-1 flex-col overflow-hidden`,_),children:r}):(0,X.jsx)(Ie,{useScrollShadow:!0,disableHorizontal:!0,preventOverscroll:!0,outerClassName:I(`min-h-0 flex-1`,_),className:`px-2 py-2 pwa-overlay-scroll`,children:r}),i?(0,X.jsx)(`div`,{className:`shrink-0 border-t border-border/40 px-3 py-2`,children:i}):null]})});return(0,Ln.createPortal)(v,u.current)},qn={compact:{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1,minimumFractionDigits:0},compactTokensShort:{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1},usd:{style:`currency`,currency:`USD`,maximumFractionDigits:4,minimumFractionDigits:2}},Jn=null,Yn={},Xn=(e,t)=>{Jn!==t&&(Jn=t,Yn.compact=void 0,Yn.compactTokensShort=void 0,Yn.usd=void 0);let n=Yn[e];if(n)return n;let r=new Intl.NumberFormat(t,qn[e]);return Yn[e]=r,r},Zn=(e,t=F())=>Xn(`compact`,t).format(e),Qn=(e,t=F())=>Xn(`compactTokensShort`,t).format(e),$n=(e,t=F())=>Xn(`usd`,t).format(e),er=(e,t=F())=>e.toLocaleDateString(t,{month:`short`,day:`numeric`,year:`numeric`}),tr=(e,t=F())=>new Date(e).toLocaleDateString(t,{year:`numeric`,month:`short`,day:`numeric`}),nr=(e,t=F())=>new Date(e).toLocaleTimeString(t,{hour:`numeric`,minute:`2-digit`}),rr=8,ir=e=>typeof e!=`number`||Number.isNaN(e)?``:Qn(e),ar=(e,t,n)=>{let r=e.find(e=>e.id===t)?.models?.find(e=>e.id===n);return r?.variants?Object.keys(r.variants):[]},or=e=>{let t=(0,W.c)(54),{open:n,onClose:r,selectedProviderID:i,selectedModelID:a,resolveSelectedVariant:o,onSelect:s,providers:c,favoriteModels:l,recentModels:u,hiddenModels:d,allowedProviderIds:f,allowedModelIdsByProvider:p,providerOrder:m,variantSelectionEnabled:h,isFavorite:g,onToggleFavorite:_,getMetadata:v,view:y,onViewChange:b}=e,x;t[0]===d?x=t[1]:(x=d===void 0?[]:d,t[0]=d,t[1]=x);let S=x,C=h===void 0||h,{t:w}=se(),T=Z.useId(),[E,D]=Z.useState(``),O;t[2]===i?O=t[3]:(O=()=>new Set(i?[i]:[]),t[2]=i,t[3]=O);let[k,A]=Z.useState(O),[ee,te]=Z.useState(null),[ne,re]=Z.useState(`model`),[j,ie]=Z.useState(null),ae=Z.useRef(!1),M=y??ne,N,oe;t[4]!==n||t[5]!==i?(N=()=>{n&&!ae.current&&A(new Set(i?[i]:[])),n||(D(``),te(null),re(`model`),ie(null)),ae.current=n},oe=[n,i],t[4]=n,t[5]=i,t[6]=N,t[7]=oe):(N=t[6],oe=t[7]),Z.useEffect(N,oe);let P;t[8]===b?P=t[9]:(P=e=>{re(e),b?.(e)},t[8]=b,t[9]=P);let F=P,I=M===`variant`&&!!(j??(i&&a)),le=`mobile-model-picker-sheet-${T}`,L;t[10]===r?L=t[11]:(L=e=>{e||r()},t[10]=r,t[11]=L);let ue;t[12]!==I||t[13]!==F||t[14]!==w?(ue=I?(0,X.jsx)(ce,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>F(`model`),"aria-label":w(`onboarding.common.actions.back`),children:(0,X.jsx)(H,{name:`arrow-left`,className:`size-5`})}):void 0,t[12]=I,t[13]=F,t[14]=w,t[15]=ue):ue=t[15];let R;t[16]!==I||t[17]!==w?(R=w(I?`chat.modelControls.thinking`:`chat.modelControls.selectModel`),t[16]=I,t[17]=w,t[18]=R):R=t[18];let z;t[19]===w?z=t[20]:(z=w(`mobile.surface.closeAria`),t[19]=w,t[20]=z);let B;t[21]===w?B=t[22]:(B=w(`mobile.sessions.sheet.resizeAria`),t[21]=w,t[22]=B);let V;t[23]!==M||t[24]!==p||t[25]!==f||t[26]!==ee||t[27]!==k||t[28]!==l||t[29]!==v||t[30]!==S||t[31]!==g||t[32]!==s||t[33]!==_||t[34]!==m||t[35]!==c||t[36]!==E||t[37]!==u||t[38]!==o||t[39]!==a||t[40]!==i||t[41]!==F||t[42]!==C||t[43]!==j?(V=(0,X.jsx)(sr,{query:E,onQueryChange:D,expandedProviders:k,onExpandedProvidersChange:A,expandedModelKey:ee,onExpandedModelKeyChange:te,activeView:M,setView:F,variantTarget:j,onVariantTargetChange:ie,selectedProviderID:i,selectedModelID:a,resolveSelectedVariant:o,onSelect:s,providers:c,favoriteModels:l,recentModels:u,hiddenModels:S,allowedProviderIds:f,allowedModelIdsByProvider:p,providerOrder:m,variantSelectionEnabled:C,isFavorite:g,onToggleFavorite:_,getMetadata:v}),t[23]=M,t[24]=p,t[25]=f,t[26]=ee,t[27]=k,t[28]=l,t[29]=v,t[30]=S,t[31]=g,t[32]=s,t[33]=_,t[34]=m,t[35]=c,t[36]=E,t[37]=u,t[38]=o,t[39]=a,t[40]=i,t[41]=F,t[42]=C,t[43]=j,t[44]=V):V=t[44];let de;return t[45]!==n||t[46]!==ue||t[47]!==R||t[48]!==z||t[49]!==B||t[50]!==V||t[51]!==le||t[52]!==L?(de=(0,X.jsx)(we,{id:le,open:n,onOpenChange:L,leading:ue,ariaLabel:R,closeAriaLabel:z,resizeAriaLabel:B,bodyClassName:`px-2`,children:V}),t[45]=n,t[46]=ue,t[47]=R,t[48]=z,t[49]=B,t[50]=V,t[51]=le,t[52]=L,t[53]=de):de=t[53],de},sr=e=>{let t=(0,W.c)(117),{query:n,onQueryChange:r,expandedProviders:i,onExpandedProvidersChange:a,expandedModelKey:o,onExpandedModelKeyChange:s,activeView:c,setView:l,variantTarget:u,onVariantTargetChange:d,selectedProviderID:f,selectedModelID:p,resolveSelectedVariant:m,onSelect:h,providers:g,favoriteModels:_,recentModels:v,hiddenModels:y,allowedProviderIds:b,allowedModelIdsByProvider:x,providerOrder:S,variantSelectionEnabled:C,isFavorite:w,onToggleFavorite:T,getMetadata:E}=e,{t:D}=se(),O;t[0]===b?O=t[1]:(O=b&&b.length>0?new Set(b):null,t[0]=b,t[1]=O);let k=O,A;t[2]===x?A=t[3]:(A=x?new Map(Object.entries(x).map(cr)):null,t[2]=x,t[3]=A);let ee=A,te;t[4]===y?te=t[5]:(te=new Set(y.map(lr)),t[4]=y,t[5]=te);let ne=te,re;t[6]===g?re=t[7]:(re=new Map(g.map(ur)),t[6]=g,t[7]=re);let j=re,ie;bb0:{if(!S?.length){ie=g;break bb0}let e;t[8]===S?e=t[9]:(e=new Map(S.map(dr)),t[8]=S,t[9]=e);let n=e,r;if(t[10]!==g||t[11]!==n){let e;t[13]===n?e=t[14]:(e=(e,t)=>{let r=n.get(e.id),i=n.get(t.id);return r===void 0&&i===void 0?0:r===void 0?1:i===void 0?-1:r-i},t[13]=n,t[14]=e),r=[...g].sort(e),t[10]=g,t[11]=n,t[12]=r}else r=t[12];ie=r}let ae=ie,M;t[15]!==ee||t[16]!==k||t[17]!==ne?(M=(e,t)=>k&&!k.has(e)||ee&&ee.get(e)?.has(t)!==!0?!1:!ne.has(`${e}:${t}`),t[15]=ee,t[16]=k,t[17]=ne,t[18]=M):M=t[18];let N=M,oe;t[19]!==j||t[20]!==n?(oe=e=>{let t=n.trim();if(!t)return!0;let r=j.get(e.providerID)?.name||e.providerID,i=ue(e.model,e.modelID,{maxLength:40});return ve(`${r} ${i}`,t)||ve(`${e.providerID} ${e.modelID}`,t)},t[19]=j,t[20]=n,t[21]=oe):oe=t[21];let P=oe,F;if(t[22]!==_||t[23]!==N||t[24]!==P){let e;t[26]!==N||t[27]!==P?(e=e=>N(e.providerID,e.modelID)&&P(e),t[26]=N,t[27]=P,t[28]=e):e=t[28],F=_.filter(e),t[22]=_,t[23]=N,t[24]=P,t[25]=F}else F=t[25];let ce=F,le;if(t[29]!==N||t[30]!==P||t[31]!==v){let e;t[33]!==N||t[34]!==P?(e=e=>N(e.providerID,e.modelID)&&P(e),t[33]=N,t[34]=P,t[35]=e):e=t[35],le=v.filter(e),t[29]=N,t[30]=P,t[31]=v,t[32]=le}else le=t[32];let L=le,R;if(t[36]!==k||t[37]!==N||t[38]!==ae||t[39]!==n){let e=n.trim(),r;t[41]===k?r=t[42]:(r=e=>!k||k.has(e.id),t[41]=k,t[42]=r),R=ae.filter(r).map(t=>{let n=e.length>0&&(ve(t.name||t.id,e)||ve(t.id,e));return{provider:t,models:(t.models??[]).filter(r=>{let i=typeof r.id==`string`?r.id:``;if(!i||!N(t.id,i))return!1;if(n||!e)return!0;let a=t.name||t.id;return ve(`${a} ${ue(r,i,{maxLength:40})}`,e)||ve(`${t.id} ${i}`,e)})}}).filter(fr),t[36]=k,t[37]=N,t[38]=ae,t[39]=n,t[40]=R}else R=t[40];let z=R,B;t[43]===D?B=t[44]:(B=e=>{if(!e?.trim())return D(`chat.modelControls.default`);let t=e.trim();return/^\d+(\.\d+)?$/.test(t)?t:t.charAt(0).toUpperCase()+t.slice(1)},t[43]=D,t[44]=B);let V=B,de;t[45]===D?de=t[46]:(de=e=>{let t=[];e?.tool_call&&t.push({key:`tool_call`,icon:`tools`,label:D(`chat.modelControls.capability.toolCalling`)}),e?.reasoning&&t.push({key:`reasoning`,icon:`brain-ai-3`,label:D(`chat.modelControls.capability.reasoning`)});let n={text:{icon:`text`,label:D(`chat.modelControls.modality.text`)},image:{icon:`file-image`,label:D(`chat.modelControls.modality.image`)},video:{icon:`file-video`,label:D(`chat.modelControls.modality.video`)},audio:{icon:`file-music`,label:D(`chat.modelControls.modality.audio`)},pdf:{icon:`file-pdf`,label:D(`chat.modelControls.modality.pdf`)}};for(let r of[...e?.modalities?.input??[],...e?.modalities?.output??[]]){let e=r.trim().toLowerCase(),i=n[e];i&&!t.some(t=>t.key===e)&&t.push({key:e,...i})}return t},t[45]=D,t[46]=de);let fe=de,pe;t[47]!==d||t[48]!==l?(pe=(e,t,n)=>{d(n===void 0?{providerID:e,modelID:t}:{providerID:e,modelID:t,variant:n}),l(`variant`)},t[47]=d,t[48]=l,t[49]=pe):pe=t[49];let me=pe,be;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(be={onPointerDown:Se,onClickCapture:pr},t[50]=be):be=t[50];let xe=be,Ce;t[51]!==o||t[52]!==V||t[53]!==E||t[54]!==fe||t[55]!==w||t[56]!==s||t[57]!==h||t[58]!==T||t[59]!==me||t[60]!==j||t[61]!==g||t[62]!==m||t[63]!==p||t[64]!==f||t[65]!==D||t[66]!==C?(Ce=(e,t)=>{let n=t===void 0?{}:t,{model:r,providerID:i,modelID:a}=e,c=`${i}:${a}`,l=i===f&&a===p,u=_e(i,r,E?.(i,a)),d=C?ar(g,i,a):[],_=m(i,a),v=n.preferRememberedVariant&&e.variant!==void 0&&d.includes(e.variant)?e.variant:void 0,y=v===void 0?_:v,b=l||v===void 0?_:v,x=[void 0,...d].slice(0,rr),S=o===c,O=fe(u),k=u?.limit?.context?`${ir(u.limit.context)} ctx`:null;return(0,X.jsxs)(`div`,{className:I(`border-b border-border/30 last:border-b-0`,l&&`bg-interactive-selection/15 text-interactive-selection-foreground`),children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5`,children:[(0,X.jsx)(`button`,{type:`button`,...xe,onClick:()=>h(i,a,y),className:`flex min-w-0 flex-1 items-start gap-2 rounded-lg text-left focus:outline-none focus-visible:ring-1 focus-visible:ring-primary`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[n.showProvider?(0,X.jsx)(`span`,{className:`truncate text-[10px] leading-none text-muted-foreground/60`,children:j.get(i)?.name||i}):null,(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,X.jsx)(ge,{modelId:a,providerId:i,className:`size-3.5 flex-shrink-0`}),(0,X.jsx)(`span`,{className:`truncate typography-meta font-medium text-foreground`,children:ue(r,a,{maxLength:40})}),l?(0,X.jsx)(H,{name:`check`,className:`size-4 flex-shrink-0 text-primary`}):null]}),k||O.length>0?(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 overflow-hidden typography-micro text-muted-foreground`,children:[k?(0,X.jsx)(`span`,{className:`flex-shrink-0 whitespace-nowrap`,children:k}):null,k&&O.length>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px flex-shrink-0 bg-border/50`}):null,(0,X.jsx)(`div`,{className:`flex min-w-0 items-center gap-1 overflow-hidden whitespace-nowrap pl-0.5`,children:O.map(e=>{let{key:t,icon:n,label:r}=e;return(0,X.jsx)(`span`,{className:`flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,title:r,"aria-label":r,children:(0,X.jsx)(H,{name:n,className:`size-3`})},`${c}-${t}`)})})]}):null]})}),d.length>0?(0,X.jsxs)(`button`,{type:`button`,...xe,onClick:()=>s(e=>e===c?null:c),className:`flex flex-shrink-0 items-center gap-0.5 typography-micro font-medium text-muted-foreground hover:text-foreground`,"aria-expanded":S,"aria-label":D(S?`chat.modelControls.hideThinkingModes`:`chat.modelControls.showThinkingModes`),children:[(0,X.jsx)(`span`,{className:`whitespace-nowrap`,children:V(b)}),(0,X.jsx)(H,{name:S?`arrow-down-s`:`arrow-right-s`,className:`size-3.5`})]}):null,(0,X.jsx)(`button`,{type:`button`,...xe,onClick:e=>{e.preventDefault(),e.stopPropagation(),T(i,a)},className:I(`model-favorite-button flex size-5 flex-shrink-0 items-center justify-center hover:text-primary/80`,w(i,a)?`text-primary`:`text-muted-foreground`),"aria-label":w(i,a)?D(`chat.modelControls.unfavoriteAria`):D(`chat.modelControls.favoriteAria`),title:w(i,a)?D(`chat.modelControls.removeFromFavorites`):D(`chat.modelControls.addToFavorites`),children:(0,X.jsx)(H,{name:w(i,a)?`star-fill`:`star`,className:`size-4`})})]}),S&&d.length>0?(0,X.jsx)(`div`,{className:`border-t border-border/30 p-2`,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[x.map(e=>{let t=e===b||!e&&!b;return(0,X.jsx)(`button`,{type:`button`,...xe,onClick:()=>h(i,a,e),className:I(`inline-flex items-center rounded-full border px-2.5 py-1 typography-meta font-medium`,t?`border-primary/30 bg-primary/10 text-foreground`:`border-border/40 text-muted-foreground hover:bg-interactive-hover/50`),"aria-pressed":t,children:V(e)},`${c}-${e??`default`}`)}),x.length<d.length+1?(0,X.jsx)(`button`,{type:`button`,...xe,onClick:()=>me(i,a,b),className:`inline-flex items-center rounded-full border border-border/40 px-2.5 py-1 typography-meta font-medium text-muted-foreground hover:bg-interactive-hover/50`,"aria-label":D(`chat.modelControls.moreThinkingModes`),children:D(`inlineComment.actions.showMore`)}):null]})}):null]},`mobile-model-${c}`)},t[51]=o,t[52]=V,t[53]=E,t[54]=fe,t[55]=w,t[56]=s,t[57]=h,t[58]=T,t[59]=me,t[60]=j,t[61]=g,t[62]=m,t[63]=p,t[64]=f,t[65]=D,t[66]=C,t[67]=Ce):Ce=t[67];let we=Ce,Te,Ee,De,Oe,ke,Ae,je,U,Me,Ne;if(t[68]!==c||t[69]!==i||t[70]!==ce||t[71]!==z||t[72]!==L||t[73]!==V||t[74]!==s||t[75]!==a||t[76]!==r||t[77]!==h||t[78]!==g||t[79]!==n||t[80]!==we||t[81]!==m||t[82]!==p||t[83]!==f||t[84]!==D||t[85]!==u){let e=u??(c===`variant`&&f&&p?{providerID:f,modelID:p}:null),o=e?ar(g,e.providerID,e.modelID):[],l;bb1:{if(!e){l=void 0;break bb1}if(e.providerID===f&&e.modelID===p){l=m(e.providerID,e.modelID);break bb1}l=(e.variant!==void 0&&o.includes(e.variant)?e.variant:void 0)??m(e.providerID,e.modelID)}let d=l,_=ce.length>0||L.length>0||z.length>0,v=c===`variant`&&!!e;Me=`flex min-h-0 flex-1 flex-col gap-2`,t[96]!==v||t[97]!==s||t[98]!==r||t[99]!==n||t[100]!==D?(Ne=v?null:(0,X.jsxs)(`div`,{className:`relative z-10 shrink-0`,"data-mobile-sheet-no-dismiss":``,"data-mobile-sheet-search":``,children:[(0,X.jsx)(H,{name:`search`,className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,X.jsx)(ye,{type:`text`,value:n,onChange:e=>{r(e.target.value),s(null)},placeholder:D(`chat.modelControls.searchProvidersOrModels`),className:`h-9 rounded-xl border-border/40 bg-[var(--surface-elevated)] pl-7 typography-meta`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`search`,inputMode:`search`}),n?(0,X.jsx)(`button`,{type:`button`,onClick:()=>{r(``),s(null)},className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,"aria-label":D(`chat.modelControls.clearSearch`),children:(0,X.jsx)(H,{name:`close-circle`,className:`size-4`})}):null]}),t[96]=v,t[97]=s,t[98]=r,t[99]=n,t[100]=D,t[101]=Ne):Ne=t[101],Te=Ie,Oe=!0,ke=!0,Ae=!0,je=`min-h-0 flex-1`,U=`overscroll-contain`,Ee=`flex flex-col gap-2`,De=v&&e?(0,X.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[void 0,...o].map(t=>{let n=t===d||!t&&!d;return(0,X.jsxs)(`button`,{type:`button`,className:I(`flex w-full items-center justify-between gap-2 rounded-xl border px-2 py-1.5 text-left focus:outline-none focus-visible:ring-1 focus-visible:ring-primary`,n?`border-primary/30 bg-primary/10`:`border-border/40`),...xe,onClick:()=>h(e.providerID,e.modelID,t),children:[(0,X.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:V(t)}),n?(0,X.jsx)(H,{name:`check`,className:`size-4 flex-shrink-0 text-primary`}):null]},t??`default`)})}):(0,X.jsxs)(X.Fragment,{children:[_?null:(0,X.jsx)(`div`,{className:`px-3 py-8 text-center typography-meta text-muted-foreground`,children:D(`chat.modelControls.noProvidersOrModelsFound`)}),ce.length>0?(0,X.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/40 bg-[var(--surface-elevated)]`,children:[(0,X.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,X.jsx)(H,{name:`star-fill`,className:`mr-1.5 inline-block size-3 text-primary`}),D(`chat.modelControls.favorites`)]}),(0,X.jsx)(`div`,{className:`flex flex-col border-t border-border/30`,children:ce.map(e=>we(e,{showProvider:!0,preferRememberedVariant:!0}))})]}):null,L.length>0?(0,X.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/40 bg-[var(--surface-elevated)]`,children:[(0,X.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,X.jsx)(H,{name:`time`,className:`mr-1.5 inline-block size-3`}),D(`chat.modelControls.recent`)]}),(0,X.jsx)(`div`,{className:`flex flex-col border-t border-border/30`,children:L.map(e=>we(e,{showProvider:!0,preferRememberedVariant:!0}))})]}):null,z.map(e=>{let{provider:t,models:r}=e,o=i.has(t.id)||n.trim().length>0;return(0,X.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/40 bg-[var(--surface-elevated)]`,children:[(0,X.jsxs)(`button`,{type:`button`,...xe,onClick:()=>{n.trim()||a(e=>{let n=new Set(e);return n.has(t.id)?n.delete(t.id):n.add(t.id),n})},className:`flex w-full items-center justify-between gap-1.5 px-2 py-1.5 text-left`,"aria-expanded":o,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(he,{providerId:t.id,className:`size-3.5`}),(0,X.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:t.name||t.id}),t.id===f?(0,X.jsx)(`span`,{className:`typography-micro text-primary/80`,children:D(`chat.modelControls.current`)}):null]}),(0,X.jsx)(H,{name:o?`arrow-down-s`:`arrow-right-s`,className:`size-3 text-muted-foreground`})]}),o?(0,X.jsx)(`div`,{className:`flex flex-col border-t border-border/30`,children:r.map(e=>we({model:e,providerID:t.id,modelID:e.id}))}):null]},t.id)})]}),t[68]=c,t[69]=i,t[70]=ce,t[71]=z,t[72]=L,t[73]=V,t[74]=s,t[75]=a,t[76]=r,t[77]=h,t[78]=g,t[79]=n,t[80]=we,t[81]=m,t[82]=p,t[83]=f,t[84]=D,t[85]=u,t[86]=Te,t[87]=Ee,t[88]=De,t[89]=Oe,t[90]=ke,t[91]=Ae,t[92]=je,t[93]=U,t[94]=Me,t[95]=Ne}else Te=t[86],Ee=t[87],De=t[88],Oe=t[89],ke=t[90],Ae=t[91],je=t[92],U=t[93],Me=t[94],Ne=t[95];let Pe;t[102]!==Ee||t[103]!==De?(Pe=(0,X.jsx)(`div`,{className:Ee,children:De}),t[102]=Ee,t[103]=De,t[104]=Pe):Pe=t[104];let Fe;t[105]!==Te||t[106]!==Oe||t[107]!==ke||t[108]!==Ae||t[109]!==je||t[110]!==U||t[111]!==Pe?(Fe=(0,X.jsx)(Te,{useScrollShadow:Oe,disableHorizontal:ke,preventOverscroll:Ae,outerClassName:je,className:U,children:Pe}),t[105]=Te,t[106]=Oe,t[107]=ke,t[108]=Ae,t[109]=je,t[110]=U,t[111]=Pe,t[112]=Fe):Fe=t[112];let Le;return t[113]!==Me||t[114]!==Ne||t[115]!==Fe?(Le=(0,X.jsxs)(`div`,{className:Me,children:[Ne,Fe]}),t[113]=Me,t[114]=Ne,t[115]=Fe,t[116]=Le):Le=t[116],Le};function cr(e){let[t,n]=e;return[t,new Set(n)]}function lr(e){return`${e.providerID}:${e.modelID}`}function ur(e){return[e.id,e]}function dr(e,t){return[e,t]}function fr(e){return e.models.length>0}function pr(e){Ce(e)||(e.preventDefault(),e.stopPropagation())}function mr(){let e=(0,W.c)(5),t=V(vr),n=V(_r),r=V(gr),i=V(hr),a=t||i,o=!a&&r===`init_error`,s=!a&&!o,c;return e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==s?(c={isReady:a,isLoading:s,isUnavailable:o,connectionPhase:n},e[0]=n,e[1]=a,e[2]=o,e[3]=s,e[4]=c):c=e[4],c}function hr(e){return e.providers.length>0}function gr(e){return e.lastDisconnectReason}function _r(e){return e.connectionPhase}function vr(e){return e.isInitialized}var yr=e=>e??l()?.github,br=(e=n())=>ie.github.auth(e),xr=async(e,t)=>{if(e)return e.authStatus();let n=await a(`/api/github/auth/status`,{method:`GET`,headers:{Accept:`application/json`},signal:t}),r=await n.json().catch(()=>null);if(!n.ok||!r)throw Error(r?.error||n.statusText||`Failed to load GitHub status`);return r},Sr=(e,t=n())=>{let r=yr(e);return{queryKey:br(t),queryFn:async({signal:e})=>xr(r,e),retry:2}},Cr=e=>!!e&&typeof e==`object`&&`authStatus`in e,wr=e=>{let t=(0,W.c)(5),n=Cr(e)?e:void 0,r=Cr(e)?void 0:e?.enabled,i;t[0]===n?i=t[1]:(i=Sr(n),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a={...i,enabled:r},t[2]=r,t[3]=i,t[4]=a):a=t[4],re(a)},Tr=(e=j,t=n())=>e.getQueryData(br(t))??null,Er=async(e,t,r)=>n()===r?e.fetchQuery({...Sr(t,r),staleTime:0}):e.getQueryData(br(r))??null,Dr=(e=j,t,r=n())=>{e.setQueryData(br(r),t)},Or=e=>e.replace(/[^\p{L}\p{N}]/gu,``).toLowerCase();function kr(e){let t=[],n=``;for(let r=0;r<e.length;){let i=String.fromCodePoint(e.codePointAt(r)),a=Or(i);for(let e=0;e<a.length;e++)t.push(r);n+=a,r+=i.length}let r=[],i=0,a=[];return{append(o){if(!o||typeof o!=`object`)throw Error(`Invalid speech subtitle`);let{text:s,words:c}=o;if(typeof s!=`string`||s.length>1e4||!Array.isArray(c)||c.length>1e4)throw Error(`Invalid speech subtitle`);if(!c.length||!s.trim())return;let l=1/0,u=0,d=-1;for(let e of c){if(!e||typeof e!=`object`||typeof e.word!=`string`||!Number.isFinite(e.startTime)||!Number.isFinite(e.endTime)||e.startTime<0||e.endTime<e.startTime||e.endTime>7200||e.startTime<d)throw Error(`Invalid speech subtitle timestamp`);l=Math.min(l,e.startTime),u=Math.max(u,e.endTime),d=e.startTime}if(r.some(e=>e.startTime===l&&e.text===s))return;if(i+=s.length,r.length>=1e3||i>2e4)throw Error(`Speech subtitle limit exceeded`);r.push({text:s,startTime:l,endTime:u}),r.sort((e,t)=>e.startTime-t.startTime);let f=0;a=[];for(let i of r){let r=Or(i.text),o=r?n.indexOf(r,f):-1;if(o<0)continue;let s=t[o],c=t[o+r.length-1],l=c+(e.codePointAt(c)>65535?2:1);l+=e.slice(l).match(/^[^\p{L}\p{N}]*/u)[0].length,a.push({...i,start:s,end:l}),f=o+r.length}},at(e){let t=0,n=a.length;for(;t<n;){let r=t+n>>>1;a[r].startTime<=e?t=r+1:n=r}let r=a[t-1];return r&&e<=r.endTime?r:void 0},lastBefore(e){for(let t=a.length-1;t>=0;t--)if(a[t].endTime<=e)return a[t]}}}function Ar(e){return{chunks:[],samples:0,complete:!1,position:0,timeline:kr(e)}}async function jr(e,t,n){if(e&&!e.body)throw Error(`Speech response has no stream`);let r=n.cache??Ar(``),i=e?.body?.getReader(),a=t.createGain();a.gain.value=n.volume,a.connect(t.destination);let o=new Set,s=new Set,c=new Set,l=()=>{for(let e of c)e();c.clear()},u=()=>new Promise(e=>{c.add(e)}),d=new TextDecoder,f=[],p=t.currentTime,m=!1,h=!1,g=!i,_=!i,v,y=-1,b=2**(n.pitch-1),x=i?0:r.position,S=()=>{let e=t.getOutputTimestamp?.().contextTime,i=e!==void 0&&Number.isFinite(e)&&e>=0?e:Math.max(0,t.currentTime-(t.outputLatency||0));for(;f.length&&i>=f[0].at;){h=!0;let e=f[0];if(r.position=e.offset+Math.min(e.duration,(i-e.at)*b),i<e.end)break;f.shift()}let a=r.timeline.at(r.position);a&&a.start>y&&h&&(y=a.start,n.onProgress?.(a))},C=()=>{for(let e of o)e.stop();l()},w=()=>{S(),i?.cancel().catch(()=>void 0),C()};n.signal.addEventListener(`abort`,w,{once:!0});let T=setInterval(S,50),E=()=>{if(n.signal.throwIfAborted(),v)throw v},D=(async()=>{if(!i)return;let e=``,t,a=0,o=e=>{if(!e.trim())return;if(_)throw Error(`Unexpected audio after speech completion`);if(e.length>1048576)throw Error(`Speech frame exceeds the size limit`);let n=JSON.parse(e);if(n.type===`error`)throw Error(`Speech synthesis interrupted or failed`);if(n.type===`done`){_=!0,l();return}if(n.type===`subtitle`){r.timeline.append(n),S();return}if(n.type!==`audio`||typeof n.data!=`string`||n.data.length>12800)throw Error(`Invalid speech audio frame`);let i=atob(n.data),a=new Uint8Array(i.length+(t===void 0?0:1)),o=0;t!==void 0&&(a[o++]=t);for(let e=0;e<i.length;e++)a[o+e]=i.charCodeAt(e);if(t=a.length%2?a[a.length-1]:void 0,a.length>1){if(r.samples*2+a.length>25165824||r.chunks.length>=8192)throw Error(`Speech cache exceeds the size limit`);let e=t===void 0?a:a.slice(0,-1);r.chunks.push(e),r.samples+=e.length/2,l()}};try{for(;;){let t=await i.read();if(n.signal.throwIfAborted(),t.done)break;if(a+=t.value.length,a>33554432)throw Error(`Speech stream exceeds the size limit`);e+=d.decode(t.value,{stream:!0});let r;for(;(r=e.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/assistant-attachment-cache-DMw2Smc8.js","assets/rolldown-runtime-hePW80VL.js","assets/runtime-auth-DBn9yahL.js","assets/runtime-switch-DEZ1K7qW.js","assets/runtime-fetch-D0YWp3FJ.js","assets/runtime-file-resource-qB_oVdE6.js","assets/runtimeAPIRegistry-C2VogTny.js","assets/queryRuntime-CTcigFdj.js","assets/vendor-tanstack-query-core-BWz0ose6.js","assets/fileQueries-DWj9yB2g.js","assets/vendor-base-ui-CzHs0bHY.js","assets/vendor-react-DlzBev0S.js","assets/vendor-tanstack-react-query-B2psfNaU.js","assets/runtime-file-store-BVRgEtI-.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/path-utils-jGozTg9d.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,i as n,l as r,n as i}from"./runtime-switch-DEZ1K7qW.js";import{n as a}from"./runtime-fetch-D0YWp3FJ.js";import{_ as o,v as s,x as c}from"./desktop-JwYqThiw.js";import{t as l}from"./runtimeAPIRegistry-C2VogTny.js";import{g as u}from"./desktopHosts-CB0CTcMg.js";import{i as d,n as f,r as p}from"./desktopRelayRestore-C7pjf6fE.js";import{A as m,B as h,F as g,I as _,L as v,N as y,P as b,R as x,at as S,j as C,ot as w,st as T,z as E}from"./vendor-base-ui-CzHs0bHY.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{l as D}from"./persistence-Dta0OwIa.js";import{n as O}from"./vendor-react-DlzBev0S.js";import{n as k}from"./vendor-tanstack-query-core-BWz0ose6.js";import{i as A,l as ee,n as te,r as ne,s as re}from"./vendor-tanstack-react-query-B2psfNaU.js";import{a as j,o as ie}from"./queryRuntime-CTcigFdj.js";import{o as ae}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{n as M}from"./pathNormalization-ewtPqJWn.js";import{i as N}from"./vendor-reactuses-core-DWo5Wn6R.js";import{d as oe,f as se,l as P,p as F,r as I,t as ce}from"./button-BF2cNEuq.js";import{i as le,t as L}from"./store-BPYoxYhv.js";import{Li as ue,Qr as R,Si as z,va as B,wi as V}from"./useMobileNavigationStore-BgM0EvUr.js";import{n as H}from"./Icon-CLLDJn-P.js";import{i as de,n as fe,r as pe,t as me}from"./vendor-simplewebauthn-browser-Dwhcdg_5.js";import{t as he}from"./input-DvF_mp0Y.js";import{g as ge,h as _e,m as ve,p as ye,t as be}from"./MobileResizableSheet-CAj4YGtu.js";import{E as xe,O as Se,T as Ce,w as we}from"./projectMeta-KTYl7ter.js";import{c as Te,d as Ee,f as De,h as Oe,l as ke,m as Ae,n as je,p as U,r as Me,s as Ne,t as Pe,u as Fe}from"./dropdown-menu.styles-CX8oXdks.js";import{n as Ie}from"./textarea-CIhiRPB2.js";var W=O(),Le=[`desktopHostSwitch`],Re=class extends Error{result;host;constructor(e,t){super(e.reason),this.name=`DesktopHostSwitchError`,this.result=e,this.host=t}},ze=(e,t)=>L(le.getState().dictionary,e,t),Be=async e=>{let{host:t}=e;if(t.id===`local`){let n=(e.localApiOrigin||``).trim();if(!n)throw new Re({ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unreachable`},t);return r({apiBaseUrl:n,clientToken:e.localClientToken||null,runtimeKey:p(t)}),{ok:!0,via:`direct`,status:{status:`ok`,latencyMs:0}}}let n=await d(t,{cachedProbe:e.cachedProbe});if(!n.ok)throw new Re(n,t);return n},Ve=null,He=()=>Ve||(Ve=new k(j,{mutationKey:Le,mutationFn:Be,onError:(e,t)=>{if(!(e instanceof Re)){R.error(ze(`desktopHostSwitcher.toast.instanceUnreachable`,{host:u(t.host.label)}),{description:e instanceof Error?e.message:String(e)});return}if(e.result.reason!==`unsupported`){if(e.result.status.status===`auth`){R.error(ze(`desktopHostSwitcher.status.authRequired`));return}R.error(ze(`desktopHostSwitcher.toast.instanceUnreachable`,{host:u(t.host.label)}))}}}),Ve.subscribe(()=>void 0),Ve),Ue=async e=>{if(f(e.host))return{ok:!0,via:`direct`,status:e.cachedProbe?.status===`ok`?e.cachedProbe:{status:`ok`,latencyMs:0}};if(j.isMutating({mutationKey:Le})>0)return{ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unsupported`};try{return await He().mutate(e)}catch(e){return e instanceof Re?e.result:{ok:!1,status:{status:`unreachable`,latencyMs:0},reason:`unreachable`}}},We=e=>{let t=(0,W.c)(2),n=e!==void 0&&e,r;return t[0]===n?r=t[1]:(r={mutationKey:Le,predicate:e=>!n||!e.state.variables?.inlineProgress},t[0]=n,t[1]=r),ne(r)>0},Ge=()=>{let e=(0,W.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={filters:{mutationKey:Le,status:`pending`},select:Ke},e[0]=t):t=e[0],A(t)[0]?.host.id??null};function Ke(e){return e.state.variables}var G=e=>typeof e==`object`&&!!e,K=(e,t)=>{let n=e[t];return typeof n==`string`?n:null},q=(e,t)=>{let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:null},J=(e,t)=>{let n=e[t];return typeof n==`boolean`?n:null},qe=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],Y=()=>o()?(e,t)=>s(e,t):null,Je=e=>{if(!G(e))return;let t=J(e,`enabled`)??!1,n=K(e,`store`)?.toLowerCase()===`settings`?`settings`:`never`,r=K(e,`value`);return{enabled:t,store:n,...r?{value:r}:{}}},Ye=e=>e===`remote`||e===`dynamic`?e:`local`,Xe=e=>{if(!G(e))return null;let t=K(e,`id`);if(!t)return null;let n=J(e,`enabled`)??!0,r=Ye(K(e,`type`)),i=K(e,`localHost`)||K(e,`local_host`)||void 0,a=q(e,`localPort`)??q(e,`local_port`)??void 0,o=K(e,`remoteHost`)||K(e,`remote_host`)||void 0,s=q(e,`remotePort`)??q(e,`remote_port`)??void 0;return{id:t,enabled:n,type:r,...i?{localHost:i}:{},...typeof a==`number`?{localPort:a}:{},...o?{remoteHost:o}:{},...typeof s==`number`?{remotePort:s}:{}}},Ze=e=>{if(!G(e))return null;let t=K(e,`id`),n=K(e,`sshCommand`)||K(e,`ssh_command`);if(!t||!n)return null;let r=K(e,`nickname`),i=e.sshParsed,a=G(i)?{destination:K(i,`destination`)||``,args:qe(i.args)}:void 0,o=G(e.remoteYuri)?e.remoteYuri:G(e.remote_yuri)?e.remote_yuri:{},s=G(e.localForward)?e.localForward:G(e.local_forward)?e.local_forward:{},c=G(e.auth)?e.auth:{},l=K(o,`mode`)?.toLowerCase()===`external`?`external`:`managed`,u=K(o,`installMethod`)||K(o,`install_method`),d=u===`npm`||u===`download_release`||u===`upload_bundle`?u:`bun`,f=K(s,`bindHost`)||K(s,`bind_host`)||`127.0.0.1`,p=f===`localhost`||f===`0.0.0.0`?f:`127.0.0.1`,m=(Array.isArray(e.portForwards)?e.portForwards:Array.isArray(e.port_forwards)?e.port_forwards:[]).map(e=>Xe(e)).filter(e=>!!e),h=q(o,`preferredPort`)??q(o,`preferred_port`),g=q(s,`preferredLocalPort`)??q(s,`preferred_local_port`),_=Je(c.sshPassword||c.ssh_password),v=Je(c.yuriPassword||c.yuri_password);return{id:t,...r?{nickname:r}:{},sshCommand:n,...a&&a.destination?{sshParsed:a}:{},connectionTimeoutSec:q(e,`connectionTimeoutSec`)??q(e,`connection_timeout_sec`)??60,remoteYuri:{mode:l,keepRunning:J(o,`keepRunning`)??J(o,`keep_running`)??!0,relayHost:J(o,`relayHost`)??J(o,`relay_host`)??!0,...h?{preferredPort:h}:{},installMethod:d,uploadBundleOverSsh:J(o,`uploadBundleOverSsh`)??J(o,`upload_bundle_over_ssh`)??!1},localForward:{...g?{preferredLocalPort:g}:{},bindHost:p},auth:{..._?{sshPassword:_}:{},...v?{yuriPassword:v}:{}},portForwards:m}},Qe=e=>{switch(e){case`config_resolved`:case`auth_check`:case`master_connecting`:case`remote_probe`:case`installing`:case`updating`:case`server_detecting`:case`server_starting`:case`forwarding`:case`ready`:case`degraded`:case`error`:return e;default:return`idle`}},$e=e=>{if(!G(e))return null;let t=K(e,`id`);return t?{id:t,phase:Qe(K(e,`phase`)),...K(e,`detail`)?{detail:K(e,`detail`)||void 0}:{},...K(e,`localUrl`)||K(e,`local_url`)?{localUrl:K(e,`localUrl`)||K(e,`local_url`)||void 0}:{},...typeof(q(e,`localPort`)??q(e,`local_port`))==`number`?{localPort:q(e,`localPort`)??q(e,`local_port`)??void 0}:{},...typeof(q(e,`remotePort`)??q(e,`remote_port`))==`number`?{remotePort:q(e,`remotePort`)??q(e,`remote_port`)??void 0}:{},startedByUs:J(e,`startedByUs`)??J(e,`started_by_us`)??!1,retryAttempt:q(e,`retryAttempt`)??q(e,`retry_attempt`)??0,requiresUserAction:J(e,`requiresUserAction`)??J(e,`requires_user_action`)??!1,...K(e,`errorCode`)||K(e,`error_code`)?{errorCode:K(e,`errorCode`)||K(e,`error_code`)||void 0}:{},updatedAtMs:q(e,`updatedAtMs`)??q(e,`updated_at_ms`)??Date.now()}:null},et=e=>{if(!G(e))return null;let t=K(e,`host`),n=K(e,`source`),r=K(e,`sshCommand`)||K(e,`ssh_command`);return!t||!n||!r?null:{host:t,source:n,sshCommand:r,pattern:J(e,`pattern`)??!1}},tt=(e,t)=>({id:e,sshCommand:t,connectionTimeoutSec:60,remoteYuri:{mode:`managed`,keepRunning:!0,relayHost:!0,installMethod:`bun`,uploadBundleOverSsh:!1},localForward:{bindHost:`127.0.0.1`},auth:{},portForwards:[]}),nt=async()=>{let e=Y();if(!e)return{instances:[]};let t=await e(`desktop_ssh_instances_get`);return G(t)?{instances:(Array.isArray(t.instances)?t.instances:Array.isArray(t.desktopSshInstances)?t.desktopSshInstances:[]).map(e=>Ze(e)).filter(e=>!!e)}:{instances:[]}},rt=async e=>{let t=Y();t&&await t(`desktop_ssh_instances_set`,{config:{instances:e.instances}})},it=async()=>{let e=Y();if(!e)return[];let t=await e(`desktop_ssh_import_hosts`);return Array.isArray(t)?t.map(e=>et(e)).filter(e=>!!e):[]},at=async e=>{let t=Y();t&&await t(`desktop_ssh_connect`,{id:e})},ot=async e=>{let t=Y();t&&await t(`desktop_ssh_disconnect`,{id:e})},st=async e=>{let t=Y();if(!t)return[];let n=await t(`desktop_ssh_status`,{...e?{id:e}:{}});return Array.isArray(n)?n.map(e=>$e(e)).filter(e=>!!e):[]},ct=async(e,t)=>{let n=Y();if(!n)return[];let r=await n(`desktop_ssh_logs`,{id:e,...typeof t==`number`?{limit:t}:{}});return Array.isArray(r)?r.filter(e=>typeof e==`string`):[]},lt=async e=>{let t=Y();t&&await t(`desktop_ssh_logs_clear`,{id:e})},ut=(e,t)=>{let n=Math.max(0,Math.trunc(Number(e.fileGroups)||0)),r=Math.max(0,Math.trunc(Number(e.singleFiles)||0)),i=Math.max(0,Math.trunc(Number(e.directories)||0));return{fileGroups:Array.from({length:n},()=>!0),singleFiles:Array.from({length:r},()=>!0),directories:Array.from({length:i},()=>!0),agentsRoot:!0,providerCredentials:t?.includeProviderCredentials===!0,magpie:!1}},dt=e=>{if(!G(e))return null;let t=K(e,`path`),n=q(e,`bytes`);return!t||n===null?null:{path:t,bytes:n}},ft=e=>{if(!G(e))return null;let t=K(e,`path`),n=q(e,`fileCount`)??q(e,`file_count`),r=q(e,`bytes`);return!t||n===null||r===null?null:{path:t,fileCount:n,bytes:r}},pt=e=>{if(e==null||!G(e))return null;let t=q(e,`fileCount`)??q(e,`file_count`),n=q(e,`bytes`);return t===null||n===null?null:{fileCount:t,bytes:n}},mt=e=>{if(e==null||!G(e))return null;let t=q(e,`bytes`);return t===null?null:{bytes:t}},ht=e=>{if(!G(e))return null;let t=Array.isArray(e.files)?e.files:null,n=Array.isArray(e.directories)?e.directories:null,r=qe(e.deletes),i=q(e,`totalBytes`)??q(e,`total_bytes`);if(!t||!n||i===null||!(`agentsRoot`in e)&&!(`agents_root`in e))return null;let a=t.map(e=>dt(e)).filter(e=>!!e),o=n.map(e=>ft(e)).filter(e=>!!e);if(a.length!==t.length||o.length!==n.length)return null;let s=e.agentsRoot??e.agents_root,c=s==null?null:pt(s);if(s!=null&&c===null||!(`providerCredentials`in e))return null;let l=mt(e.providerCredentials);if(e.providerCredentials!==null&&l===null)return null;let u=e.direction===`pull`||e.direction===`push`?e.direction:void 0,d=e.selections,f=G(d)?{fileGroups:Array.isArray(d.fileGroups)?d.fileGroups.map(e=>e!==!1):[],singleFiles:Array.isArray(d.singleFiles)?d.singleFiles.map(e=>e!==!1):[],directories:Array.isArray(d.directories)?d.directories.map(e=>e!==!1):[],agentsRoot:d.agentsRoot!==!1,providerCredentials:d.providerCredentials===!0,magpie:d.magpie===!0}:void 0,p=gt(e.selectionShape??e.selection_shape);return{files:a,directories:o,agentsRoot:c,providerCredentials:l,magpieAvailable:e.magpieAvailable===!0,magpie:mt(e.magpie),deletes:r,totalBytes:i,...u?{direction:u}:{},...f?{selections:f}:{},...p?{selectionShape:p}:{}}},gt=e=>{if(!G(e))return null;let t=q(e,`fileGroups`)??q(e,`file_groups`),n=q(e,`singleFiles`)??q(e,`single_files`),r=q(e,`directories`);return t===null||n===null||r===null||t<0||n<0||r<0?null:{fileGroups:t,singleFiles:n,directories:r}},_t=e=>{if(!G(e))return null;let t=ht(e.plan);if(!t)return null;let n=gt(e.selectionShape??e.selection_shape)??t.selectionShape??null;return{plan:t,remoteExisting:qe(e.remoteExisting??e.remote_existing),remoteAgentsRootExists:J(e,`remoteAgentsRootExists`)??J(e,`remote_agents_root_exists`)??!1,remoteProviderCredentialsExists:J(e,`remoteProviderCredentialsExists`)??!1,...n?{selectionShape:n}:{}}},vt=e=>{if(!G(e)||J(e,`ok`)!==!0)return null;let t=q(e,`files`),n=q(e,`directories`),r=q(e,`deletes`),i=q(e,`totalBytes`)??q(e,`total_bytes`);if(t===null||n===null||r===null||i===null||!(`agentsRoot`in e)&&!(`agents_root`in e))return null;let a=e.agentsRoot??e.agents_root,o=null;if(a!=null){if(!G(a))return null;let e=q(a,`fileCount`)??q(a,`file_count`);if(e===null)return null;o={fileCount:e}}if(!(`providerCredentials`in e))return null;let s=mt(e.providerCredentials);if(e.providerCredentials!==null&&s===null)return null;let c=qe(e.magpieWarnings).filter(e=>e===`sign_in_required`||e===`plugin_install_failed`||e===`agent_settings_skipped`);return{ok:!0,files:t,directories:n,deletes:r,totalBytes:i,agentsRoot:o,providerCredentials:s,...c.length?{magpieWarnings:c}:{}}},yt=async(e={})=>{let t=Y();if(!t)return console.error(`[desktopSsh] config sync local scan skipped: desktop IPC bridge is unavailable in this window`),null;let n=await t(`desktop_ssh_sync_opencode_config`,{stage:`local`,...e.direction?{direction:e.direction}:{},...e.selections?{selections:e.selections}:{}});if(!G(n))return console.error(`[desktopSsh] config sync local scan returned a non-object payload`,n),null;let r=ht(n.plan);if(!r)return console.error(`[desktopSsh] config sync local scan plan payload was not recognized`,n),null;let i=gt(n.selectionShape??n.selection_shape)??r.selectionShape??null;return i?{...r,selectionShape:i}:r},bt=async(e,t={})=>{let n=Y();if(!n)return console.error(`[desktopSsh] config sync preview skipped: desktop IPC bridge is unavailable in this window`),null;let r=await n(`desktop_ssh_sync_opencode_config`,{id:e,...t.targetKind?{targetKind:t.targetKind}:{},...t.direction?{direction:t.direction}:{},...t.selections?{selections:t.selections}:{}}),i=_t(r);return i||console.error(`[desktopSsh] config sync preview payload was not recognized`,r),i},xt=async(e,t={})=>{let n=Y();if(!n)return console.error(`[desktopSsh] config sync apply skipped: desktop IPC bridge is unavailable in this window`),null;let r=await n(`desktop_ssh_sync_opencode_config`,{id:e,apply:!0,...t.targetKind?{targetKind:t.targetKind}:{},...t.direction?{direction:t.direction}:{},...t.selections?{selections:t.selections}:{}}),i=vt(r);return i||console.error(`[desktopSsh] config sync apply payload was not recognized`,r),i},St=async(e,t={})=>{let n=Y();if(!n)return[];let r=await n(`desktop_ssh_sync_runs_list`,{id:e,...t.targetKind?{targetKind:t.targetKind}:{}});return Array.isArray(r)?r.filter(e=>G(e)&&typeof e.syncRunId==`string`&&typeof e.targetId==`string`):[]},Ct=async e=>{if(!o())return async()=>{};let t=window.__YURI_DESKTOP__?.listen;if(typeof t!=`function`)return async()=>{};let n=await t(`yuri:ssh-instance-status`,t=>{let n=$e(t?.payload);n&&e(n)});return async()=>{await n()}},wt=new Set([`nodeRuntimeMissing`,`packageManagerMissing`,`nativeBinding`,`yuriCliMissing`,`yuriRegistry`,`yuriInstall`,`yuriCliIncompatible`,`opencodeInstall`,`serverStart`,`sshAuth`,`sshUnreachable`,`timeout`,`unknown`]),Tt=e=>typeof e==`string`&&wt.has(e),Et=e=>{let t=String(e||``);return/requires Node\.js \d+|no supported Node runtime/i.test(t)?`nodeRuntimeMissing`:/neither bun nor npm/i.test(t)?`packageManagerMissing`:/better-sqlite3|node_gyp_bins|gyp ERR|failed to prepare better-sqlite3/i.test(t)?`nativeBinding`:/Yuri installation completed but the executable is unavailable/i.test(t)?`yuriCliMissing`:/could not reach the npm registry|ENOTFOUND|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|CERT_HAS_EXPIRED|UNABLE_TO_GET_ISSUER_CERT|self-signed certificate|registry\.npmjs|npm error code E404|npm ERR! code E404|getaddrinfo/i.test(t)?`yuriRegistry`:/Failed to install Yuri/i.test(t)?`yuriInstall`:/Unknown option:\s*--relay-host|does not advertise --relay-host|does not support --relay-host/i.test(t)||/Unknown option:/i.test(t)?`yuriCliIncompatible`:/Failed to install OpenCode|OpenCode CLI/i.test(t)?`opencodeInstall`:/failed to become reachable|Managed Yuri server failed/i.test(t)?`serverStart`:/Permission denied|Authentication failed|publickey|keyboard-interactive/i.test(t)?`sshAuth`:/Could not resolve hostname|Connection refused|Connection timed out|ControlMaster connection timed out|SSH master process exited|Network is unreachable/i.test(t)?`sshUnreachable`:/Timed out waiting for SSH|Timed out waiting for forwarded/i.test(t)?`timeout`:`unknown`},Dt=(e,t)=>Tt(e)?e:Et(t),Ot=e=>{switch(e){case`nodeRuntimeMissing`:return`desktopHostSwitcher.sshError.nodeRuntimeMissing.title`;case`packageManagerMissing`:return`desktopHostSwitcher.sshError.packageManagerMissing.title`;case`nativeBinding`:return`desktopHostSwitcher.sshError.nativeBinding.title`;case`yuriCliMissing`:return`desktopHostSwitcher.sshError.yuriCliMissing.title`;case`yuriRegistry`:return`desktopHostSwitcher.sshError.yuriRegistry.title`;case`yuriInstall`:return`desktopHostSwitcher.sshError.yuriInstall.title`;case`yuriCliIncompatible`:return`desktopHostSwitcher.sshError.yuriCliIncompatible.title`;case`opencodeInstall`:return`desktopHostSwitcher.sshError.opencodeInstall.title`;case`serverStart`:return`desktopHostSwitcher.sshError.serverStart.title`;case`sshAuth`:return`desktopHostSwitcher.sshError.sshAuth.title`;case`sshUnreachable`:return`desktopHostSwitcher.sshError.sshUnreachable.title`;case`timeout`:return`desktopHostSwitcher.sshError.timeout.title`;default:return`desktopHostSwitcher.sshError.unknown.title`}},kt=e=>{switch(e){case`nodeRuntimeMissing`:return`desktopHostSwitcher.sshError.nodeRuntimeMissing.guidance`;case`packageManagerMissing`:return`desktopHostSwitcher.sshError.packageManagerMissing.guidance`;case`nativeBinding`:return`desktopHostSwitcher.sshError.nativeBinding.guidance`;case`yuriCliMissing`:return`desktopHostSwitcher.sshError.yuriCliMissing.guidance`;case`yuriRegistry`:return`desktopHostSwitcher.sshError.yuriRegistry.guidance`;case`yuriInstall`:return`desktopHostSwitcher.sshError.yuriInstall.guidance`;case`yuriCliIncompatible`:return`desktopHostSwitcher.sshError.yuriCliIncompatible.guidance`;case`opencodeInstall`:return`desktopHostSwitcher.sshError.opencodeInstall.guidance`;case`serverStart`:return`desktopHostSwitcher.sshError.serverStart.guidance`;case`sshAuth`:return`desktopHostSwitcher.sshError.sshAuth.guidance`;case`sshUnreachable`:return`desktopHostSwitcher.sshError.sshUnreachable.guidance`;case`timeout`:return`desktopHostSwitcher.sshError.timeout.guidance`;default:return`desktopHostSwitcher.sshError.unknown.guidance`}},At=e=>e===`unknown`||e===`yuriCliIncompatible`,jt=(e,t,n)=>{let r=typeof n==`string`?n.trim():``;return!At(t)||!r||r===e?e:`${e}\n${r}`},X=w();function Mt(e){let t=(0,W.c)(27),{errorCode:n,detail:r,className:i}=e,{t:a}=se(),o,s,c,l,u,d;if(t[0]!==i||t[1]!==r||t[2]!==n||t[3]!==a){let e=Dt(n,r);o=a(kt(e));let f;t[10]===r?f=t[11]:(f=typeof r==`string`?r.trim():``,t[10]=r,t[11]=f),s=f,c=At(e)&&!!s&&s!==o,t[12]===i?d=t[13]:(d=I(`space-y-1`,i),t[12]=i,t[13]=d),l=`typography-ui-label text-[var(--status-error)]`,u=a(Ot(e)),t[0]=i,t[1]=r,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9];let f;t[14]!==l||t[15]!==u?(f=(0,X.jsx)(`p`,{className:l,children:u}),t[14]=l,t[15]=u,t[16]=f):f=t[16];let p;t[17]===o?p=t[18]:(p=(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:o}),t[17]=o,t[18]=p);let m;t[19]!==s||t[20]!==c?(m=c?(0,X.jsx)(`p`,{className:`typography-meta break-words text-muted-foreground`,children:s}):null,t[19]=s,t[20]=c,t[21]=m):m=t[21];let h;return t[22]!==d||t[23]!==f||t[24]!==p||t[25]!==m?(h=(0,X.jsxs)(`div`,{className:d,children:[f,p,m]}),t[22]=d,t[23]=f,t[24]=p,t[25]=m,t[26]=h):h=t[26],h}var Nt=`/auth/passkey/authenticate/options`,Pt=`/auth/passkey/authenticate/verify`,Ft=`/auth/passkey/register/options`,It=`/auth/passkey/register/verify`,Lt=`/api/passkeys`,Rt=`/auth/passkey/status`,zt=`/api/auth/reset`,Bt={enabled:!1,hasPasskeys:!1,passkeyCount:0,rpID:null},Vt=async(e,t)=>a(e,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),Ht=async(e,t)=>{try{let t=await e.json();if(t&&typeof t.error==`string`&&t.error.trim())return t.error}catch{}return t},Ut=e=>e instanceof de&&e.code===`ERROR_CEREMONY_ABORTED`,Wt=()=>{pe.cancelCeremony()},Gt=()=>typeof window>`u`?{supported:!1,reason:`Passkeys are unavailable outside the browser.`}:window.isSecureContext?{supported:!0,reason:``}:{supported:!1,reason:`Passkeys require HTTPS or localhost.`},Kt=async()=>{let e=Gt();if(!e.supported)throw Error(e.reason);let t=await Vt(Ft,{label:typeof navigator.userAgent==`string`&&navigator.userAgent.trim()?navigator.userAgent:`This device`});if(!t.ok)throw Error(await Ht(t,`Could not start passkey setup.`));let{requestId:n,optionsJSON:r}=await t.json(),i=await Vt(It,{requestId:n,response:await fe({optionsJSON:r})});if(!i.ok)throw Error(await Ht(i,`Could not finish passkey setup.`));return i.json().catch(()=>null)},qt=async(e,t={})=>{let n=Gt();if(!n.supported)throw Error(n.reason);let r=await Vt(Nt);if(!r.ok)throw Error(await Ht(r,`Passkey sign-in is not available right now.`));let{requestId:i,optionsJSON:a}=await r.json(),o=await Vt(Pt,{requestId:i,response:await me({optionsJSON:a}),trustDevice:e,issueClientToken:t.issueClientToken===!0,clientLabel:t.clientLabel,clientKind:t.clientKind,dedupeKey:t.dedupeKey});if(!o.ok)throw Error(await Ht(o,`Passkey sign-in failed.`));return o.json().catch(()=>null)},Jt=async()=>{let e=await a(Rt,{method:`GET`,credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)return Bt;let t=await e.json().catch(()=>null);return{enabled:t?.enabled===!0,hasPasskeys:t?.hasPasskeys===!0,passkeyCount:typeof t?.passkeyCount==`number`?t.passkeyCount:0,rpID:typeof t?.rpID==`string`&&t.rpID?t.rpID:null}},Yt=async()=>{let e=await a(Lt,{method:`GET`,credentials:`include`,headers:{Accept:`application/json`}});if(!e.ok)throw Error(await Ht(e,`Could not load passkeys.`));let t=await e.json().catch(()=>null);return Array.isArray(t?.passkeys)?t.passkeys:[]},Xt=async e=>{let t=await a(`${Lt}/${encodeURIComponent(e)}`,{method:`DELETE`,credentials:`include`,headers:{Accept:`application/json`}});if(!t.ok)throw Error(await Ht(t,`Could not remove passkey.`));return t.json().catch(()=>null)},Zt=async()=>{let e=await Vt(zt);if(!e.ok)throw Error(await Ht(e,`Could not clear saved authentication.`));try{let{clearAssistantAttachmentCacheAll:e}=await ae(async()=>{let{clearAssistantAttachmentCacheAll:e}=await import(`./assistant-attachment-cache-DMw2Smc8.js`).then(e=>e.t);return{clearAssistantAttachmentCacheAll:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])),{invalidateRuntimeAuthSession:t}=await ae(async()=>{let{invalidateRuntimeAuthSession:e}=await import(`./runtime-auth-DBn9yahL.js`).then(e=>e.m);return{invalidateRuntimeAuthSession:e}},__vite__mapDeps([2,1]));await e(`auth-reset`),t()}catch{}return e.json().catch(()=>null)},Z=e(T(),1);function Qt(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=I(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{"data-slot":`card`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $t(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=I(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{"data-slot":`card-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function en(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=I(`leading-none font-semibold`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{"data-slot":`card-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function tn(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=I(`px-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{"data-slot":`card-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var nn=class extends Z.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.setState({error:e,errorInfo:t,copied:!1}),console.error(`Error caught by boundary:`,e,t)}handleReset=()=>{this.setState({hasError:!1,error:void 0,errorInfo:void 0})};handleCopy=async()=>{let{strings:e}=this.props,t=`${this.state.error?String(this.state.error):e.unknownError}${this.state.error?.stack?`\n\nStack:\n${this.state.error.stack}`:``}${this.state.errorInfo?.componentStack?`\n\n${e.componentStackLabel}${this.state.errorInfo.componentStack}`:``}`;(await oe(t)).ok&&(this.setState({copied:!0}),window.setTimeout(()=>{this.setState(e=>e.copied?{copied:!1}:null)},1500))};render(){let{strings:e}=this.props;return this.state.hasError?this.props.fallback?this.props.fallback:(0,X.jsx)(`div`,{className:`p-4 flex items-center justify-center min-h-screen`,children:(0,X.jsxs)(Qt,{className:`w-full max-w-md`,children:[(0,X.jsx)($t,{className:`text-center`,children:(0,X.jsxs)(en,{className:`flex items-center justify-center gap-2 text-destructive`,children:[(0,X.jsx)(H,{name:`error-warning`,className:`h-5 w-5`}),e.title]})}),(0,X.jsxs)(tn,{className:`space-y-4`,children:[(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground text-center`,children:e.description}),this.state.error&&(0,X.jsxs)(`details`,{className:`text-xs font-mono bg-muted p-3 rounded`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer hover:bg-interactive-hover/80`,children:e.detailsSummary}),(0,X.jsxs)(`pre`,{className:`mt-2 max-h-48 overflow-auto`,children:[this.state.error.toString(),this.state.errorInfo?.componentStack?`\n\n${e.componentStackLabel}${this.state.errorInfo.componentStack}`:``]})]}),(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsxs)(ce,{onClick:this.handleReset,variant:`outline`,className:`flex-1`,children:[(0,X.jsx)(H,{name:`restart`,className:`h-4 w-4 mr-2`}),e.tryAgain]}),(0,X.jsx)(ce,{onClick:this.handleCopy,variant:`outline`,className:`flex-1`,children:this.state.copied?e.copied:e.copy})]})]})]})}):this.props.children}},rn=e=>{let t=(0,W.c)(29),{children:n,fallback:r}=e,{t:i}=se(),a;t[0]===i?a=t[1]:(a=i(`errorBoundary.state.unknownError`),t[0]=i,t[1]=a);let o;t[2]===i?o=t[3]:(o=i(`errorBoundary.title`),t[2]=i,t[3]=o);let s;t[4]===i?s=t[5]:(s=i(`errorBoundary.description`),t[4]=i,t[5]=s);let c;t[6]===i?c=t[7]:(c=i(`errorBoundary.actions.errorDetails`),t[6]=i,t[7]=c);let l;t[8]===i?l=t[9]:(l=i(`errorBoundary.state.componentStackLabel`),t[8]=i,t[9]=l);let u;t[10]===i?u=t[11]:(u=i(`errorBoundary.actions.tryAgain`),t[10]=i,t[11]=u);let d;t[12]===i?d=t[13]:(d=i(`errorBoundary.actions.copied`),t[12]=i,t[13]=d);let f;t[14]===i?f=t[15]:(f=i(`errorBoundary.actions.copy`),t[14]=i,t[15]=f);let p;t[16]!==a||t[17]!==o||t[18]!==s||t[19]!==c||t[20]!==l||t[21]!==u||t[22]!==d||t[23]!==f?(p={unknownError:a,title:o,description:s,detailsSummary:c,componentStackLabel:l,tryAgain:u,copied:d,copy:f},t[16]=a,t[17]=o,t[18]=s,t[19]=c,t[20]=l,t[21]=u,t[22]=d,t[23]=f,t[24]=p):p=t[24];let m=p,h;return t[25]!==n||t[26]!==r||t[27]!==m?(h=(0,X.jsx)(nn,{fallback:r,strings:m,children:n}),t[25]=n,t[26]=r,t[27]=m,t[28]=h):h=t[28],h},an=`__unassigned__`,on={mod:`mod`,shift:`shift`,alt:`alt`,option:`alt`,ctrl:`ctrl`,meta:`mod`,cmd:`mod`,command:`mod`},sn={mod:P()?`⌘`:`Ctrl`,shift:`⇧`,alt:`⌥`,option:`⌥`,ctrl:`⌃`},cn={comma:`,`,period:`.`,enter:`Enter`,escape:`Esc`,tab:`Tab`,space:`Space`,backspace:`⌫`,delete:`⌦`,arrowup:`↑`,arrowdown:`↓`,arrowleft:`←`,arrowright:`→`,home:`Home`,end:`End`,pageup:`Page Up`,pagedown:`Page Down`,backtick:"`",grave:"`","=":`=`,equal:`=`,plus:`+`,minus:`-`,"-":`-`},ln=[`mod`,`ctrl`,`shift`,`alt`],un={"{":`[`,"}":`]`,":":`;`,'"':`'`,"<":`,`,">":`.`,"?":`/`,"|":`\\`,"~":"`","!":`1`,"@":`2`,"#":`3`,$:`4`,"%":`5`,"^":`6`,"&":`7`,"*":`8`,"(":`9`,")":`0`};function dn(e){return e.trim().toLowerCase()===an}function fn(e){let t=e.toLowerCase();return t===`,`?`comma`:t===`.`?`period`:t===` `?`space`:t===`esc`?`escape`:t===`+`?`plus`:t===`-`||t===`_`?`minus`:t===`arrowup`?`arrowup`:t===`arrowdown`?`arrowdown`:t===`arrowleft`?`arrowleft`:t===`arrowright`?`arrowright`:t==="`"?`backtick`:un[t]??t}var pn=[{id:`open_command_palette`,defaultCombo:`mod+p`,label:`Open command palette`,description:`Open the command palette`,customizable:!0},{id:`focus_input`,defaultCombo:`mod+i`,label:`Focus input`,description:`Focus the chat input field`,customizable:!0},{id:`open_status`,defaultCombo:`mod+shift+o`,label:`Open OpenCode status`,description:`Open the OpenCode status dialog`},{id:`open_settings`,defaultCombo:`mod+comma`,label:`Open settings`,description:`Open the settings panel`,customizable:!0},{id:`toggle_terminal`,defaultCombo:`ctrl+backtick`,label:`Toggle terminal`,description:`Toggle the integrated terminal`,customizable:!0},{id:`toggle_bottom_panel`,defaultCombo:`mod+j`,label:`Toggle bottom panel`,description:`Toggle the bottom panel dock`,customizable:!0},{id:`toggle_terminal_expanded`,defaultCombo:`mod+shift+j`,label:`Toggle terminal expanded`,description:`Toggle terminal expanded or collapsed`,customizable:!0},{id:`new_terminal_tab`,defaultCombo:`mod+t`,label:`New terminal tab`,description:`Create a new terminal tab when the terminal is focused`,customizable:!0},{id:`open_new_terminal`,defaultCombo:`mod+shift+backtick`,label:`Open new terminal`,description:`Open the terminal panel and create a new terminal tab`,customizable:!0},{id:`previous_terminal_tab`,defaultCombo:`mod+shift+[`,label:`Previous terminal tab`,description:`Switch to the previous terminal tab when the terminal is focused`,customizable:!0},{id:`next_terminal_tab`,defaultCombo:`mod+shift+]`,label:`Next terminal tab`,description:`Switch to the next terminal tab when the terminal is focused`,customizable:!0},{id:`toggle_files`,defaultCombo:`mod+shift+f`,label:`Toggle files`,description:`Toggle the files panel`},{id:`toggle_sidebar`,defaultCombo:`mod+b`,label:`Toggle sidebar`,description:`Toggle the session sidebar`,customizable:!0},{id:`open_timeline_dialog`,defaultCombo:`mod+t`,label:`Open conversation timeline`,description:`Search and navigate within current conversation`,customizable:!0},{id:`toggle_prompt_navigator`,defaultCombo:`mod+alt+p`,label:`Toggle prompt navigator`,description:`Show or hide the prompt navigator panel in chat`,customizable:!0},{id:`toggle_right_sidebar`,defaultCombo:`mod+alt+b`,defaultAliases:[`mod+\\`],label:`Toggle review panel`,description:`Toggle the review panel (right sidebar)`,customizable:!0},{id:`open_right_sidebar_git`,defaultCombo:`mod+shift+g`,label:`Open right sidebar Git tab`,description:`Open right sidebar and select Git`,customizable:!0},{id:`open_right_sidebar_files`,defaultCombo:`mod+shift+f`,label:`Open right sidebar Files tab`,description:`Open right sidebar and select Files`,customizable:!0},{id:`cycle_right_sidebar_tab`,defaultCombo:`mod+alt+shift+r`,label:`Cycle right sidebar tab`,description:`Cycle through right sidebar tabs`,customizable:!0},{id:`close_context_panel_tab`,defaultCombo:`mod+w`,label:`Close context panel tab`,description:`Close the active context panel tab (closes the panel when empty)`,customizable:!0},{id:`previous_session`,defaultCombo:`mod+shift+[`,defaultAliases:[`mod+arrowup`],label:`Previous session`,description:`Switch to the previous session`,customizable:!0},{id:`next_session`,defaultCombo:`mod+shift+]`,defaultAliases:[`mod+arrowdown`],label:`Next session`,description:`Switch to the next session`,customizable:!0},{id:`new_chat`,defaultCombo:`mod+n`,label:`New session`,description:`Start a new session`,customizable:!0},{id:`new_chat_worktree`,defaultCombo:`mod+shift+alt+n`,label:`New worktree draft`,description:`Create a new worktree and open a draft in it`,customizable:!0},{id:`new_mini_chat`,defaultCombo:`mod+alt+n`,label:`New Mini Chat window`,description:`Open a new Mini Chat draft window`,customizable:!0},{id:`submit_message`,defaultCombo:`mod+enter`,label:`Submit message`,description:`Submit the current message`},{id:`clear_input`,defaultCombo:`escape`,label:`Clear input`,description:`Clear the input field`},{id:`clear_all_messages`,defaultCombo:`ctrl+c`,label:`Clear all messages`,description:`Clear the composer input and queued messages`,customizable:!0},{id:`open_diff_panel`,defaultCombo:`mod+2`,label:`Open diff panel`,description:`Switch to the diff panel`},{id:`open_terminal_panel`,defaultCombo:`mod+3`,label:`Open terminal panel`,description:`Switch to the terminal panel`},{id:`open_git_panel`,defaultCombo:`mod+4`,label:`Open git panel`,description:`Switch to the git panel`},{id:`open_help`,defaultCombo:`mod+.`,label:`Open keyboard shortcuts`,description:`Show the keyboard shortcuts help`,customizable:!0},{id:`toggle_services_menu`,defaultCombo:`mod+shift+s`,label:`Toggle services menu`,description:`Open or close the services menu`,customizable:!0},{id:`open_usage`,defaultCombo:`mod+shift+c`,label:`Open usage`,description:`Open the usage panel`,customizable:!0},{id:`cycle_services_tab`,defaultCombo:`mod+alt+shift+s`,label:`Cycle services tab`,description:`Cycle through tabs in the services menu`,customizable:!0},{id:`cycle_theme`,defaultCombo:`mod+/`,label:`Cycle theme`,description:`Cycle between light, dark, and system theme`,customizable:!0},{id:`zoom_in`,defaultCombo:`mod+=`,label:`Zoom in`,description:`Increase the webview zoom level`,customizable:!0},{id:`zoom_out`,defaultCombo:`mod+-`,label:`Zoom out`,description:`Decrease the webview zoom level`,customizable:!0},{id:`zoom_reset`,defaultCombo:`mod+0`,label:`Reset zoom`,description:`Reset the webview zoom level to 100%`,customizable:!0},{id:`leader_key`,defaultCombo:`ctrl+x`,label:`Leader key`,description:`Start an OpenCode-style chord, then press M / A / N / C`,customizable:!0},{id:`open_model_selector`,defaultCombo:`mod+shift+m`,label:`Open model selector`,description:`Open model selector while in chat`,customizable:!0},{id:`cycle_thinking_variant`,defaultCombo:`mod+shift+t`,label:`Cycle thinking variant`,description:`Cycle thinking variant while in chat`},{id:`cycle_agent`,defaultCombo:`tab`,label:`Cycle agent`,description:`Cycle agent while the model selector is open`,customizable:!0},{id:`cycle_favorite_model_forward`,defaultCombo:`ctrl+]`,label:`Cycle favorite model forward`,description:`Cycle forward through starred models without opening the picker`,customizable:!0},{id:`cycle_favorite_model_backward`,defaultCombo:`ctrl+[`,label:`Cycle favorite model backward`,description:`Cycle backward through starred models without opening the picker`,customizable:!0},{id:`expand_input`,defaultCombo:`mod+shift+e`,label:`Expand input`,description:`Toggle focus mode for the chat input`,customizable:!0},{id:`toggle_dictation`,defaultCombo:`mod+alt+v`,label:`Voice input`,description:`Start dictation; press again to confirm and insert the transcript`,customizable:!0},{id:`abort_run`,defaultCombo:`escape`,label:`Abort active run`,description:`Abort the currently running task (double press)`},{id:`switch_tab_1`,defaultCombo:`mod+1`,label:`Switch to visible session 1`,description:`Switch to the first visible sidebar session`},{id:`switch_tab_2`,defaultCombo:`mod+2`,label:`Switch to visible session 2`,description:`Switch to the second visible sidebar session`},{id:`switch_tab_3`,defaultCombo:`mod+3`,label:`Switch to visible session 3`,description:`Switch to the third visible sidebar session`},{id:`switch_tab_4`,defaultCombo:`mod+4`,label:`Switch to visible session 4`,description:`Switch to the fourth visible sidebar session`},{id:`switch_tab_5`,defaultCombo:`mod+5`,label:`Switch to visible session 5`,description:`Switch to the fifth visible sidebar session`},{id:`switch_tab_6`,defaultCombo:`mod+6`,label:`Switch to visible session 6`,description:`Switch to the sixth visible sidebar session`},{id:`switch_tab_7`,defaultCombo:`mod+7`,label:`Switch to visible session 7`,description:`Switch to the seventh visible sidebar session`},{id:`switch_tab_8`,defaultCombo:`mod+8`,label:`Switch to visible session 8`,description:`Switch to the eighth visible sidebar session`},{id:`switch_tab_9`,defaultCombo:`mod+9`,label:`Switch to visible session 9`,description:`Switch to the ninth visible sidebar session`}];function mn(e){if(dn(e))return an;let t=e.toLowerCase().trim().split(`+`).map(e=>e.trim()).filter(Boolean),n=new Set,r=``;for(let e of t){let t=e===`,`?`comma`:e===`.`?`period`:e,i=on[t];if(i){n.add(i);continue}r=t}return[...ln.filter(e=>n.has(e)),r].filter(Boolean).join(`+`)}function hn(e){return dn(e)?!0:gn(e).key.trim().length>0}function gn(e){if(dn(e))return{modifiers:new Set,key:an};let t=mn(e).split(`+`),n=new Set,r=``;for(let e of t){let t=on[e];t?n.add(t):r=e}return{modifiers:n,key:r}}function _n(e){if(dn(e))return`Unassigned`;let t=gn(e);if(!t.key&&t.modifiers.size===0)return`Unassigned`;let n=[];for(let e of ln)t.modifiers.has(e)&&n.push(sn[e]);if(t.key){let e=cn[t.key.toLowerCase()]||t.key.toUpperCase();n.push(e)}return n.join(` + `)}function vn(e){return pn.find(t=>t.id===e)}function yn(){return pn.filter(e=>e.customizable===!0)}function bn(e,t){let n=vn(e);if(!n)return``;let r=t?.[e];if(typeof r==`string`){if(r.trim().toLowerCase()===`__unassigned__`)return``;let e=mn(r);if(e===`__unassigned__`)return an;if(hn(e))return e}return n.defaultCombo}function xn(e,t){let n=vn(e);if(!n)return[];let r=bn(e,t);return r===n.defaultCombo?[n.defaultCombo,...n.defaultAliases??[]]:r?[r]:[]}function Sn(e){if(dn(e))return!1;let t=gn(e);if(!t.modifiers.has(`mod`))return!1;let n=t.key.toLowerCase();return new Set([`w`,`t`,`r`,`p`,`s`,`f`,`l`,`n`]).has(n)&&!t.modifiers.has(`shift`)&&!t.modifiers.has(`alt`)}function Cn(e,t){let n=typeof t==`string`?t:t.defaultCombo;if(dn(n))return!1;let r=gn(n),i=r.modifiers.has(`mod`),a=r.modifiers.has(`shift`),o=r.modifiers.has(`alt`),s=r.modifiers.has(`ctrl`),l=P()&&c(),u=P(),d=l?e.metaKey:u&&e.metaKey||e.ctrlKey;if(i&&!d||!i&&e.metaKey||a!==e.shiftKey||o!==e.altKey)return!1;if(s){if(!e.ctrlKey)return!1}else{let t=i&&!l&&e.ctrlKey;if(e.ctrlKey&&!t)return!1}let f=e.key;return(!f||f===`Dead`)&&e.code===`Backquote`&&(f="`"),e.altKey&&(e.code.startsWith(`Key`)&&e.code.length===4?f=e.code.slice(3).toLowerCase():e.code.startsWith(`Digit`)&&e.code.length===6&&(f=e.code.slice(5))),fn(f)===fn(r.key)}function wn(){return P()?`⌘`:`Ctrl`}function Tn(e,t,n){if(Cn(e,n))return!0;let r=mn(n),i=P()&&c(),a=P();return!(i?e.metaKey:a&&e.metaKey||e.ctrlKey)||e.altKey||i&&e.ctrlKey&&!e.metaKey?!1:t===`in`&&r===`mod+=`?e.key===`+`||e.code===`NumpadAdd`:t===`out`&&(r===`mod+-`||r===`mod+minus`)?e.key===`_`||e.code===`NumpadSubtract`:!1}var En=Z.createContext(null),Dn=e=>e?e.closest(`[data-slot="dialog-content"], [role="dialog"]`):null;function On(e,t){return e&&Z.isValidElement(t)?{render:t}:{children:t}}function kn(e){let t=(0,W.c)(9),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let[r,i]=Z.useState(null),a;t[2]===r?a=t[3]:(a={portalContainer:r,setPortalContainer:i},t[2]=r,t[3]=a);let o=a,s;t[4]===n?s=t[5]:(s=(0,X.jsx)(y,{...n}),t[4]=n,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,X.jsx)(En.Provider,{value:o,children:s}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function An(e){let t=(0,W.c)(22),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:n,children:r,onPointerDownCapture:a,onFocusCapture:i,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=Z.useContext(En),c;t[6]===s?c=t[7]:(c=e=>{if(!s)return;let t=e instanceof HTMLElement?e:null;s.setPortalContainer(Dn(t))},t[6]=s,t[7]=c);let l=c,u;t[8]!==n||t[9]!==r?(u=On(n,r),t[8]=n,t[9]=r,t[10]=u):u=t[10];let d=u,f;t[11]!==a||t[12]!==l?(f=e=>{l(e.currentTarget),a?.(e)},t[11]=a,t[12]=l,t[13]=f):f=t[13];let p;t[14]!==i||t[15]!==l?(p=e=>{l(e.currentTarget),i?.(e)},t[14]=i,t[15]=l,t[16]=p):p=t[16];let m;return t[17]!==o||t[18]!==d||t[19]!==f||t[20]!==p?(m=(0,X.jsx)(C,{"data-slot":`dropdown-menu-trigger`,onPointerDownCapture:f,onFocusCapture:p,...o,...d}),t[17]=o,t[18]=d,t[19]=f,t[20]=p,t[21]=m):m=t[21],m}function jn(e){let t=(0,W.c)(40),n,r,i,a,o,s,c,l,u,d,f,p,m;if(t[0]!==e){let{className:h,sideOffset:g,align:_,side:v,alignOffset:y,anchor:b,portalToBody:x,positionerClassName:S,style:C,children:w,onCloseAutoFocus:T,collisionPadding:E,collisionAvoidance:D,...O}=e;o=h,d=g,n=_,l=v,r=y,i=b,f=x,s=S,u=C,a=w,p=E,m=D,c=O,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13];let h=d===void 0?4:d,g=f!==void 0&&f,_=p===void 0?8:p,y;t[14]===m?y=t[15]:(y=m===void 0?{side:`shift`,align:`shift`}:m,t[14]=m,t[15]=y);let b=y,S=Z.useContext(En),C=g?void 0:S?.portalContainer||void 0,w;t[16]===s?w=t[17]:(w=I(`app-region-no-drag z-50`,s),t[16]=s,t[17]=w);let T;t[18]===u?T=t[19]:(T={color:`var(--surface-elevated-foreground)`,...u},t[18]=u,t[19]=T);let D;t[20]===o?D=t[21]:(D=I(je,o),t[20]=o,t[21]=D);let O;t[22]!==a||t[23]!==c||t[24]!==T||t[25]!==D?(O=(0,X.jsx)(E,{"data-slot":`dropdown-menu-content`,style:T,className:D,...c,children:a}),t[22]=a,t[23]=c,t[24]=T,t[25]=D,t[26]=O):O=t[26];let k;t[27]!==n||t[28]!==r||t[29]!==i||t[30]!==b||t[31]!==_||t[32]!==l||t[33]!==h||t[34]!==O||t[35]!==w?(k=(0,X.jsx)(v,{anchor:i,sideOffset:h,align:n,side:l,alignOffset:r,collisionPadding:_,collisionAvoidance:b,className:w,children:O}),t[27]=n,t[28]=r,t[29]=i,t[30]=b,t[31]=_,t[32]=l,t[33]=h,t[34]=O,t[35]=w,t[36]=k):k=t[36];let A;return t[37]!==k||t[38]!==C?(A=(0,X.jsx)(x,{container:C,children:k}),t[37]=k,t[38]=C,t[39]=A):A=t[39],A}function Mn(e){let t=(0,W.c)(24),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({className:i,inset:a,variant:l,asChild:n,children:r,onSelect:s,onClick:o,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=l===void 0?`default`:l,d;t[9]!==n||t[10]!==r?(d=On(n,r),t[9]=n,t[10]=r,t[11]=d):d=t[11];let f=d,p;t[12]!==o||t[13]!==s?(p=e=>{o?.(e),e.defaultPrevented||s?.(e)},t[12]=o,t[13]=s,t[14]=p):p=t[14];let m=p,g;t[15]===i?g=t[16]:(g=I(Pe,i),t[15]=i,t[16]=g);let _;return t[17]!==m||t[18]!==a||t[19]!==c||t[20]!==f||t[21]!==g||t[22]!==u?(_=(0,X.jsx)(h,{"data-slot":`dropdown-menu-item`,"data-inset":a,"data-variant":u,className:g,...c,onClick:m,...f}),t[17]=m,t[18]=a,t[19]=c,t[20]=f,t[21]=g,t[22]=u,t[23]=_):_=t[23],_}function Nn(e){let t=(0,W.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(_,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function Pn(e){let t=(0,W.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=I(`data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover data-[checked]:bg-interactive-selection data-[checked]:text-interactive-selection-foreground relative flex cursor-pointer items-start gap-2 rounded-lg py-1 pl-2 pr-8 typography-ui-label outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-3.5 items-center justify-center text-primary`,children:(0,X.jsx)(b,{children:(0,X.jsx)(H,{name:`check`,className:`size-3`})})}),t[6]=o):o=t[6];let s;return t[7]!==n||t[8]!==i||t[9]!==a?(s=(0,X.jsxs)(g,{"data-slot":`dropdown-menu-radio-item`,className:a,...i,children:[o,n]}),t[7]=n,t[8]=i,t[9]=a,t[10]=s):s=t[10],s}function Fn(e){let t=(0,W.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=I(`px-2 py-1 typography-ui-label font-medium data-[inset]:pl-8`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,X.jsx)(`div`,{"data-slot":`dropdown-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function In(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=I(Me,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(m,{"data-slot":`dropdown-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Ln=e(S(),1),Rn=`mobile-overlay-root`,zn=16,Bn=200,Vn=[],Hn=0,Un=``,Wn=0,Gn=()=>{if(typeof document>`u`)return null;let e=document.getElementById(Rn);return e||(e=document.createElement(`div`),e.id=Rn,document.body.appendChild(e)),e},Kn=({open:e,title:t,onClose:n,children:r,footer:i,className:a,contentMaxHeightClassName:o,renderHeader:s,containedBody:c=!1,closeAriaLabel:l})=>{let u=Z.useRef(null),d=Z.useRef(Symbol(`mobile-overlay`)),f=Z.useRef(n);f.current=n;let[p,m]=Z.useState(!1),[h,g]=Z.useState(!1);if(typeof document<`u`&&!u.current&&(u.current=Gn()),Z.useEffect(()=>{if(!e){m(!1),g(!1);return}let t=window.setTimeout(()=>m(!0),zn),n=window.setTimeout(()=>g(!0),266);return()=>{window.clearTimeout(t),window.clearTimeout(n)}},[e]),Z.useLayoutEffect(()=>{if(e)return Wn===0&&window.dispatchEvent(new Event(`yuri:mobile-overlay-opened`)),Wn+=1,()=>{Wn=Math.max(0,Wn-1),Wn===0&&window.dispatchEvent(new Event(`yuri:mobile-overlay-closed`))}},[e]),Z.useEffect(()=>{if(!e)return;let t=d.current;Vn.push(t),Hn===0&&(Un=document.body.style.overflow),Hn+=1,document.body.style.overflow=`hidden`;let n=e=>{e.key===`Escape`&&Vn[Vn.length-1]===t&&f.current()};return document.addEventListener(`keydown`,n),()=>{let e=Vn.lastIndexOf(t);e>=0&&Vn.splice(e,1),Hn=Math.max(0,Hn-1),Hn===0&&(document.body.style.overflow=Un),document.removeEventListener(`keydown`,n)}},[e]),!e||!u.current)return null;let _=o??`max-h-[min(70vh,520px)]`,v=(0,X.jsx)(`div`,{className:I(`yuri-keyboard-inset-surface fixed inset-0 z-[60] flex flex-col bg-[rgb(0_0_0_/_0.45)] transition-opacity duration-200 ease-out`,!h&&`yuri-keyboard-inset-snap`,p?`opacity-100`:`opacity-0`),role:`dialog`,"aria-modal":`true`,"aria-label":t,onPointerDown:_e,onClick:e=>{ge(e)&&n()},children:(0,X.jsxs)(`div`,{className:I(`mt-auto flex max-h-[calc(100dvh-0.75rem)] min-h-0 w-full flex-col rounded-t-xl border-x border-t border-border/50 bg-background pb-[max(0.5rem,var(--yuri-app-bottom-safe,0px),var(--yuri-safe-area-bottom,env(safe-area-inset-bottom,0px)))] shadow-none pwa-overlay-panel`,`mx-auto max-w-lg`,a),style:{transform:p?`none`:`translateY(100%)`,transition:`transform ${Bn}ms cubic-bezier(0.32, 0.72, 0, 1)`},onClick:e=>e.stopPropagation(),children:[(()=>{let e=(0,X.jsx)(`button`,{type:`button`,onClick:n,className:I(`flex items-center justify-center rounded-lg text-muted-foreground hover:bg-interactive-hover`,c?`size-11`:`h-8 w-8`),"aria-label":l??t,children:(0,X.jsx)(H,{name:`close`,className:`h-4 w-4`})});return s?s(e):(0,X.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border/40`,children:[(0,X.jsx)(`h2`,{className:`typography-ui-label font-semibold text-foreground`,children:t}),e]})})(),c?(0,X.jsx)(`div`,{className:I(`flex min-h-0 flex-1 flex-col overflow-hidden`,_),children:r}):(0,X.jsx)(Ie,{useScrollShadow:!0,disableHorizontal:!0,preventOverscroll:!0,outerClassName:I(`min-h-0 flex-1`,_),className:`px-2 py-2 pwa-overlay-scroll`,children:r}),i?(0,X.jsx)(`div`,{className:`shrink-0 border-t border-border/40 px-3 py-2`,children:i}):null]})});return(0,Ln.createPortal)(v,u.current)},qn={compact:{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1,minimumFractionDigits:0},compactTokensShort:{notation:`compact`,compactDisplay:`short`,maximumFractionDigits:1},usd:{style:`currency`,currency:`USD`,maximumFractionDigits:4,minimumFractionDigits:2}},Jn=null,Yn={},Xn=(e,t)=>{Jn!==t&&(Jn=t,Yn.compact=void 0,Yn.compactTokensShort=void 0,Yn.usd=void 0);let n=Yn[e];if(n)return n;let r=new Intl.NumberFormat(t,qn[e]);return Yn[e]=r,r},Zn=(e,t=F())=>Xn(`compact`,t).format(e),Qn=(e,t=F())=>Xn(`compactTokensShort`,t).format(e),$n=(e,t=F())=>Xn(`usd`,t).format(e),er=(e,t=F())=>e.toLocaleDateString(t,{month:`short`,day:`numeric`,year:`numeric`}),tr=(e,t=F())=>new Date(e).toLocaleDateString(t,{year:`numeric`,month:`short`,day:`numeric`}),nr=(e,t=F())=>new Date(e).toLocaleTimeString(t,{hour:`numeric`,minute:`2-digit`}),rr=8,ir=e=>typeof e!=`number`||Number.isNaN(e)?``:Qn(e),ar=(e,t,n)=>{let r=e.find(e=>e.id===t)?.models?.find(e=>e.id===n);return r?.variants?Object.keys(r.variants):[]},or=e=>{let t=(0,W.c)(54),{open:n,onClose:r,selectedProviderID:i,selectedModelID:a,resolveSelectedVariant:o,onSelect:s,providers:c,favoriteModels:l,recentModels:u,hiddenModels:d,allowedProviderIds:f,allowedModelIdsByProvider:p,providerOrder:m,variantSelectionEnabled:h,isFavorite:g,onToggleFavorite:_,getMetadata:v,view:y,onViewChange:b}=e,x;t[0]===d?x=t[1]:(x=d===void 0?[]:d,t[0]=d,t[1]=x);let S=x,C=h===void 0||h,{t:w}=se(),T=Z.useId(),[E,D]=Z.useState(``),O;t[2]===i?O=t[3]:(O=()=>new Set(i?[i]:[]),t[2]=i,t[3]=O);let[k,A]=Z.useState(O),[ee,te]=Z.useState(null),[ne,re]=Z.useState(`model`),[j,ie]=Z.useState(null),ae=Z.useRef(!1),M=y??ne,N,oe;t[4]!==n||t[5]!==i?(N=()=>{n&&!ae.current&&A(new Set(i?[i]:[])),n||(D(``),te(null),re(`model`),ie(null)),ae.current=n},oe=[n,i],t[4]=n,t[5]=i,t[6]=N,t[7]=oe):(N=t[6],oe=t[7]),Z.useEffect(N,oe);let P;t[8]===b?P=t[9]:(P=e=>{re(e),b?.(e)},t[8]=b,t[9]=P);let F=P,I=M===`variant`&&!!(j??(i&&a)),le=`mobile-model-picker-sheet-${T}`,L;t[10]===r?L=t[11]:(L=e=>{e||r()},t[10]=r,t[11]=L);let ue;t[12]!==I||t[13]!==F||t[14]!==w?(ue=I?(0,X.jsx)(ce,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>F(`model`),"aria-label":w(`onboarding.common.actions.back`),children:(0,X.jsx)(H,{name:`arrow-left`,className:`size-5`})}):void 0,t[12]=I,t[13]=F,t[14]=w,t[15]=ue):ue=t[15];let R;t[16]!==I||t[17]!==w?(R=w(I?`chat.modelControls.thinking`:`chat.modelControls.selectModel`),t[16]=I,t[17]=w,t[18]=R):R=t[18];let z;t[19]===w?z=t[20]:(z=w(`mobile.surface.closeAria`),t[19]=w,t[20]=z);let B;t[21]===w?B=t[22]:(B=w(`mobile.sessions.sheet.resizeAria`),t[21]=w,t[22]=B);let V;t[23]!==M||t[24]!==p||t[25]!==f||t[26]!==ee||t[27]!==k||t[28]!==l||t[29]!==v||t[30]!==S||t[31]!==g||t[32]!==s||t[33]!==_||t[34]!==m||t[35]!==c||t[36]!==E||t[37]!==u||t[38]!==o||t[39]!==a||t[40]!==i||t[41]!==F||t[42]!==C||t[43]!==j?(V=(0,X.jsx)(sr,{query:E,onQueryChange:D,expandedProviders:k,onExpandedProvidersChange:A,expandedModelKey:ee,onExpandedModelKeyChange:te,activeView:M,setView:F,variantTarget:j,onVariantTargetChange:ie,selectedProviderID:i,selectedModelID:a,resolveSelectedVariant:o,onSelect:s,providers:c,favoriteModels:l,recentModels:u,hiddenModels:S,allowedProviderIds:f,allowedModelIdsByProvider:p,providerOrder:m,variantSelectionEnabled:C,isFavorite:g,onToggleFavorite:_,getMetadata:v}),t[23]=M,t[24]=p,t[25]=f,t[26]=ee,t[27]=k,t[28]=l,t[29]=v,t[30]=S,t[31]=g,t[32]=s,t[33]=_,t[34]=m,t[35]=c,t[36]=E,t[37]=u,t[38]=o,t[39]=a,t[40]=i,t[41]=F,t[42]=C,t[43]=j,t[44]=V):V=t[44];let de;return t[45]!==n||t[46]!==ue||t[47]!==R||t[48]!==z||t[49]!==B||t[50]!==V||t[51]!==le||t[52]!==L?(de=(0,X.jsx)(be,{id:le,open:n,onOpenChange:L,leading:ue,ariaLabel:R,closeAriaLabel:z,resizeAriaLabel:B,bodyClassName:`px-2`,children:V}),t[45]=n,t[46]=ue,t[47]=R,t[48]=z,t[49]=B,t[50]=V,t[51]=le,t[52]=L,t[53]=de):de=t[53],de},sr=e=>{let t=(0,W.c)(117),{query:n,onQueryChange:r,expandedProviders:i,onExpandedProvidersChange:a,expandedModelKey:o,onExpandedModelKeyChange:s,activeView:c,setView:l,variantTarget:u,onVariantTargetChange:d,selectedProviderID:f,selectedModelID:p,resolveSelectedVariant:m,onSelect:h,providers:g,favoriteModels:_,recentModels:v,hiddenModels:y,allowedProviderIds:b,allowedModelIdsByProvider:x,providerOrder:S,variantSelectionEnabled:C,isFavorite:w,onToggleFavorite:T,getMetadata:E}=e,{t:D}=se(),O;t[0]===b?O=t[1]:(O=b&&b.length>0?new Set(b):null,t[0]=b,t[1]=O);let k=O,A;t[2]===x?A=t[3]:(A=x?new Map(Object.entries(x).map(cr)):null,t[2]=x,t[3]=A);let ee=A,te;t[4]===y?te=t[5]:(te=new Set(y.map(lr)),t[4]=y,t[5]=te);let ne=te,re;t[6]===g?re=t[7]:(re=new Map(g.map(ur)),t[6]=g,t[7]=re);let j=re,ie;bb0:{if(!S?.length){ie=g;break bb0}let e;t[8]===S?e=t[9]:(e=new Map(S.map(dr)),t[8]=S,t[9]=e);let n=e,r;if(t[10]!==g||t[11]!==n){let e;t[13]===n?e=t[14]:(e=(e,t)=>{let r=n.get(e.id),i=n.get(t.id);return r===void 0&&i===void 0?0:r===void 0?1:i===void 0?-1:r-i},t[13]=n,t[14]=e),r=[...g].sort(e),t[10]=g,t[11]=n,t[12]=r}else r=t[12];ie=r}let ae=ie,M;t[15]!==ee||t[16]!==k||t[17]!==ne?(M=(e,t)=>k&&!k.has(e)||ee&&ee.get(e)?.has(t)!==!0?!1:!ne.has(`${e}:${t}`),t[15]=ee,t[16]=k,t[17]=ne,t[18]=M):M=t[18];let N=M,oe;t[19]!==j||t[20]!==n?(oe=e=>{let t=n.trim();if(!t)return!0;let r=j.get(e.providerID)?.name||e.providerID,i=ue(e.model,e.modelID,{maxLength:40});return we(`${r} ${i}`,t)||we(`${e.providerID} ${e.modelID}`,t)},t[19]=j,t[20]=n,t[21]=oe):oe=t[21];let P=oe,F;if(t[22]!==_||t[23]!==N||t[24]!==P){let e;t[26]!==N||t[27]!==P?(e=e=>N(e.providerID,e.modelID)&&P(e),t[26]=N,t[27]=P,t[28]=e):e=t[28],F=_.filter(e),t[22]=_,t[23]=N,t[24]=P,t[25]=F}else F=t[25];let ce=F,le;if(t[29]!==N||t[30]!==P||t[31]!==v){let e;t[33]!==N||t[34]!==P?(e=e=>N(e.providerID,e.modelID)&&P(e),t[33]=N,t[34]=P,t[35]=e):e=t[35],le=v.filter(e),t[29]=N,t[30]=P,t[31]=v,t[32]=le}else le=t[32];let L=le,R;if(t[36]!==k||t[37]!==N||t[38]!==ae||t[39]!==n){let e=n.trim(),r;t[41]===k?r=t[42]:(r=e=>!k||k.has(e.id),t[41]=k,t[42]=r),R=ae.filter(r).map(t=>{let n=e.length>0&&(we(t.name||t.id,e)||we(t.id,e));return{provider:t,models:(t.models??[]).filter(r=>{let i=typeof r.id==`string`?r.id:``;if(!i||!N(t.id,i))return!1;if(n||!e)return!0;let a=t.name||t.id;return we(`${a} ${ue(r,i,{maxLength:40})}`,e)||we(`${t.id} ${i}`,e)})}}).filter(fr),t[36]=k,t[37]=N,t[38]=ae,t[39]=n,t[40]=R}else R=t[40];let z=R,B;t[43]===D?B=t[44]:(B=e=>{if(!e?.trim())return D(`chat.modelControls.default`);let t=e.trim();return/^\d+(\.\d+)?$/.test(t)?t:t.charAt(0).toUpperCase()+t.slice(1)},t[43]=D,t[44]=B);let V=B,de;t[45]===D?de=t[46]:(de=e=>{let t=[];e?.tool_call&&t.push({key:`tool_call`,icon:`tools`,label:D(`chat.modelControls.capability.toolCalling`)}),e?.reasoning&&t.push({key:`reasoning`,icon:`brain-ai-3`,label:D(`chat.modelControls.capability.reasoning`)});let n={text:{icon:`text`,label:D(`chat.modelControls.modality.text`)},image:{icon:`file-image`,label:D(`chat.modelControls.modality.image`)},video:{icon:`file-video`,label:D(`chat.modelControls.modality.video`)},audio:{icon:`file-music`,label:D(`chat.modelControls.modality.audio`)},pdf:{icon:`file-pdf`,label:D(`chat.modelControls.modality.pdf`)}};for(let r of[...e?.modalities?.input??[],...e?.modalities?.output??[]]){let e=r.trim().toLowerCase(),i=n[e];i&&!t.some(t=>t.key===e)&&t.push({key:e,...i})}return t},t[45]=D,t[46]=de);let fe=de,pe;t[47]!==d||t[48]!==l?(pe=(e,t,n)=>{d(n===void 0?{providerID:e,modelID:t}:{providerID:e,modelID:t,variant:n}),l(`variant`)},t[47]=d,t[48]=l,t[49]=pe):pe=t[49];let me=pe,ge;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ge={onPointerDown:ve,onClickCapture:pr},t[50]=ge):ge=t[50];let _e=ge,ye;t[51]!==o||t[52]!==V||t[53]!==E||t[54]!==fe||t[55]!==w||t[56]!==s||t[57]!==h||t[58]!==T||t[59]!==me||t[60]!==j||t[61]!==g||t[62]!==m||t[63]!==p||t[64]!==f||t[65]!==D||t[66]!==C?(ye=(e,t)=>{let n=t===void 0?{}:t,{model:r,providerID:i,modelID:a}=e,c=`${i}:${a}`,l=i===f&&a===p,u=Ce(i,r,E?.(i,a)),d=C?ar(g,i,a):[],_=m(i,a),v=n.preferRememberedVariant&&e.variant!==void 0&&d.includes(e.variant)?e.variant:void 0,y=v===void 0?_:v,b=l||v===void 0?_:v,x=[void 0,...d].slice(0,rr),S=o===c,O=fe(u),k=u?.limit?.context?`${ir(u.limit.context)} ctx`:null;return(0,X.jsxs)(`div`,{className:I(`border-b border-border/30 last:border-b-0`,l&&`bg-interactive-selection/15 text-interactive-selection-foreground`),children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5`,children:[(0,X.jsx)(`button`,{type:`button`,..._e,onClick:()=>h(i,a,y),className:`flex min-w-0 flex-1 items-start gap-2 rounded-lg text-left focus:outline-none focus-visible:ring-1 focus-visible:ring-primary`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[n.showProvider?(0,X.jsx)(`span`,{className:`truncate text-[10px] leading-none text-muted-foreground/60`,children:j.get(i)?.name||i}):null,(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,X.jsx)(Se,{modelId:a,providerId:i,className:`size-3.5 flex-shrink-0`}),(0,X.jsx)(`span`,{className:`truncate typography-meta font-medium text-foreground`,children:ue(r,a,{maxLength:40})}),l?(0,X.jsx)(H,{name:`check`,className:`size-4 flex-shrink-0 text-primary`}):null]}),k||O.length>0?(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 overflow-hidden typography-micro text-muted-foreground`,children:[k?(0,X.jsx)(`span`,{className:`flex-shrink-0 whitespace-nowrap`,children:k}):null,k&&O.length>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px flex-shrink-0 bg-border/50`}):null,(0,X.jsx)(`div`,{className:`flex min-w-0 items-center gap-1 overflow-hidden whitespace-nowrap pl-0.5`,children:O.map(e=>{let{key:t,icon:n,label:r}=e;return(0,X.jsx)(`span`,{className:`flex size-4 flex-shrink-0 items-center justify-center text-muted-foreground`,title:r,"aria-label":r,children:(0,X.jsx)(H,{name:n,className:`size-3`})},`${c}-${t}`)})})]}):null]})}),d.length>0?(0,X.jsxs)(`button`,{type:`button`,..._e,onClick:()=>s(e=>e===c?null:c),className:`flex flex-shrink-0 items-center gap-0.5 typography-micro font-medium text-muted-foreground hover:text-foreground`,"aria-expanded":S,"aria-label":D(S?`chat.modelControls.hideThinkingModes`:`chat.modelControls.showThinkingModes`),children:[(0,X.jsx)(`span`,{className:`whitespace-nowrap`,children:V(b)}),(0,X.jsx)(H,{name:S?`arrow-down-s`:`arrow-right-s`,className:`size-3.5`})]}):null,(0,X.jsx)(`button`,{type:`button`,..._e,onClick:e=>{e.preventDefault(),e.stopPropagation(),T(i,a)},className:I(`model-favorite-button flex size-5 flex-shrink-0 items-center justify-center hover:text-primary/80`,w(i,a)?`text-primary`:`text-muted-foreground`),"aria-label":w(i,a)?D(`chat.modelControls.unfavoriteAria`):D(`chat.modelControls.favoriteAria`),title:w(i,a)?D(`chat.modelControls.removeFromFavorites`):D(`chat.modelControls.addToFavorites`),children:(0,X.jsx)(H,{name:w(i,a)?`star-fill`:`star`,className:`size-4`})})]}),S&&d.length>0?(0,X.jsx)(`div`,{className:`border-t border-border/30 p-2`,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[x.map(e=>{let t=e===b||!e&&!b;return(0,X.jsx)(`button`,{type:`button`,..._e,onClick:()=>h(i,a,e),className:I(`inline-flex items-center rounded-full border px-2.5 py-1 typography-meta font-medium`,t?`border-primary/30 bg-primary/10 text-foreground`:`border-border/40 text-muted-foreground hover:bg-interactive-hover/50`),"aria-pressed":t,children:V(e)},`${c}-${e??`default`}`)}),x.length<d.length+1?(0,X.jsx)(`button`,{type:`button`,..._e,onClick:()=>me(i,a,b),className:`inline-flex items-center rounded-full border border-border/40 px-2.5 py-1 typography-meta font-medium text-muted-foreground hover:bg-interactive-hover/50`,"aria-label":D(`chat.modelControls.moreThinkingModes`),children:D(`inlineComment.actions.showMore`)}):null]})}):null]},`mobile-model-${c}`)},t[51]=o,t[52]=V,t[53]=E,t[54]=fe,t[55]=w,t[56]=s,t[57]=h,t[58]=T,t[59]=me,t[60]=j,t[61]=g,t[62]=m,t[63]=p,t[64]=f,t[65]=D,t[66]=C,t[67]=ye):ye=t[67];let be=ye,Te,Ee,De,Oe,ke,Ae,je,U,Me,Ne;if(t[68]!==c||t[69]!==i||t[70]!==ce||t[71]!==z||t[72]!==L||t[73]!==V||t[74]!==s||t[75]!==a||t[76]!==r||t[77]!==h||t[78]!==g||t[79]!==n||t[80]!==be||t[81]!==m||t[82]!==p||t[83]!==f||t[84]!==D||t[85]!==u){let e=u??(c===`variant`&&f&&p?{providerID:f,modelID:p}:null),o=e?ar(g,e.providerID,e.modelID):[],l;bb1:{if(!e){l=void 0;break bb1}if(e.providerID===f&&e.modelID===p){l=m(e.providerID,e.modelID);break bb1}l=(e.variant!==void 0&&o.includes(e.variant)?e.variant:void 0)??m(e.providerID,e.modelID)}let d=l,_=ce.length>0||L.length>0||z.length>0,v=c===`variant`&&!!e;Me=`flex min-h-0 flex-1 flex-col gap-2`,t[96]!==v||t[97]!==s||t[98]!==r||t[99]!==n||t[100]!==D?(Ne=v?null:(0,X.jsxs)(`div`,{className:`relative z-10 shrink-0`,"data-mobile-sheet-no-dismiss":``,"data-mobile-sheet-search":``,children:[(0,X.jsx)(H,{name:`search`,className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,X.jsx)(he,{type:`text`,value:n,onChange:e=>{r(e.target.value),s(null)},placeholder:D(`chat.modelControls.searchProvidersOrModels`),className:`h-9 rounded-xl border-border/40 bg-[var(--surface-elevated)] pl-7 typography-meta`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`search`,inputMode:`search`}),n?(0,X.jsx)(`button`,{type:`button`,onClick:()=>{r(``),s(null)},className:`absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,"aria-label":D(`chat.modelControls.clearSearch`),children:(0,X.jsx)(H,{name:`close-circle`,className:`size-4`})}):null]}),t[96]=v,t[97]=s,t[98]=r,t[99]=n,t[100]=D,t[101]=Ne):Ne=t[101],Te=Ie,Oe=!0,ke=!0,Ae=!0,je=`min-h-0 flex-1`,U=`overscroll-contain`,Ee=`flex flex-col gap-2`,De=v&&e?(0,X.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[void 0,...o].map(t=>{let n=t===d||!t&&!d;return(0,X.jsxs)(`button`,{type:`button`,className:I(`flex w-full items-center justify-between gap-2 rounded-xl border px-2 py-1.5 text-left focus:outline-none focus-visible:ring-1 focus-visible:ring-primary`,n?`border-primary/30 bg-primary/10`:`border-border/40`),..._e,onClick:()=>h(e.providerID,e.modelID,t),children:[(0,X.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:V(t)}),n?(0,X.jsx)(H,{name:`check`,className:`size-4 flex-shrink-0 text-primary`}):null]},t??`default`)})}):(0,X.jsxs)(X.Fragment,{children:[_?null:(0,X.jsx)(`div`,{className:`px-3 py-8 text-center typography-meta text-muted-foreground`,children:D(`chat.modelControls.noProvidersOrModelsFound`)}),ce.length>0?(0,X.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/40 bg-[var(--surface-elevated)]`,children:[(0,X.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,X.jsx)(H,{name:`star-fill`,className:`mr-1.5 inline-block size-3 text-primary`}),D(`chat.modelControls.favorites`)]}),(0,X.jsx)(`div`,{className:`flex flex-col border-t border-border/30`,children:ce.map(e=>be(e,{showProvider:!0,preferRememberedVariant:!0}))})]}):null,L.length>0?(0,X.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/40 bg-[var(--surface-elevated)]`,children:[(0,X.jsxs)(`div`,{className:`px-2 py-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,X.jsx)(H,{name:`time`,className:`mr-1.5 inline-block size-3`}),D(`chat.modelControls.recent`)]}),(0,X.jsx)(`div`,{className:`flex flex-col border-t border-border/30`,children:L.map(e=>be(e,{showProvider:!0,preferRememberedVariant:!0}))})]}):null,z.map(e=>{let{provider:t,models:r}=e,o=i.has(t.id)||n.trim().length>0;return(0,X.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border/40 bg-[var(--surface-elevated)]`,children:[(0,X.jsxs)(`button`,{type:`button`,..._e,onClick:()=>{n.trim()||a(e=>{let n=new Set(e);return n.has(t.id)?n.delete(t.id):n.add(t.id),n})},className:`flex w-full items-center justify-between gap-1.5 px-2 py-1.5 text-left`,"aria-expanded":o,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(xe,{providerId:t.id,className:`size-3.5`}),(0,X.jsx)(`span`,{className:`typography-meta font-medium text-foreground`,children:t.name||t.id}),t.id===f?(0,X.jsx)(`span`,{className:`typography-micro text-primary/80`,children:D(`chat.modelControls.current`)}):null]}),(0,X.jsx)(H,{name:o?`arrow-down-s`:`arrow-right-s`,className:`size-3 text-muted-foreground`})]}),o?(0,X.jsx)(`div`,{className:`flex flex-col border-t border-border/30`,children:r.map(e=>be({model:e,providerID:t.id,modelID:e.id}))}):null]},t.id)})]}),t[68]=c,t[69]=i,t[70]=ce,t[71]=z,t[72]=L,t[73]=V,t[74]=s,t[75]=a,t[76]=r,t[77]=h,t[78]=g,t[79]=n,t[80]=be,t[81]=m,t[82]=p,t[83]=f,t[84]=D,t[85]=u,t[86]=Te,t[87]=Ee,t[88]=De,t[89]=Oe,t[90]=ke,t[91]=Ae,t[92]=je,t[93]=U,t[94]=Me,t[95]=Ne}else Te=t[86],Ee=t[87],De=t[88],Oe=t[89],ke=t[90],Ae=t[91],je=t[92],U=t[93],Me=t[94],Ne=t[95];let Pe;t[102]!==Ee||t[103]!==De?(Pe=(0,X.jsx)(`div`,{className:Ee,children:De}),t[102]=Ee,t[103]=De,t[104]=Pe):Pe=t[104];let Fe;t[105]!==Te||t[106]!==Oe||t[107]!==ke||t[108]!==Ae||t[109]!==je||t[110]!==U||t[111]!==Pe?(Fe=(0,X.jsx)(Te,{useScrollShadow:Oe,disableHorizontal:ke,preventOverscroll:Ae,outerClassName:je,className:U,children:Pe}),t[105]=Te,t[106]=Oe,t[107]=ke,t[108]=Ae,t[109]=je,t[110]=U,t[111]=Pe,t[112]=Fe):Fe=t[112];let Le;return t[113]!==Me||t[114]!==Ne||t[115]!==Fe?(Le=(0,X.jsxs)(`div`,{className:Me,children:[Ne,Fe]}),t[113]=Me,t[114]=Ne,t[115]=Fe,t[116]=Le):Le=t[116],Le};function cr(e){let[t,n]=e;return[t,new Set(n)]}function lr(e){return`${e.providerID}:${e.modelID}`}function ur(e){return[e.id,e]}function dr(e,t){return[e,t]}function fr(e){return e.models.length>0}function pr(e){ye(e)||(e.preventDefault(),e.stopPropagation())}function mr(){let e=(0,W.c)(5),t=V(vr),n=V(_r),r=V(gr),i=V(hr),a=t||i,o=!a&&r===`init_error`,s=!a&&!o,c;return e[0]!==n||e[1]!==a||e[2]!==o||e[3]!==s?(c={isReady:a,isLoading:s,isUnavailable:o,connectionPhase:n},e[0]=n,e[1]=a,e[2]=o,e[3]=s,e[4]=c):c=e[4],c}function hr(e){return e.providers.length>0}function gr(e){return e.lastDisconnectReason}function _r(e){return e.connectionPhase}function vr(e){return e.isInitialized}var yr=e=>e??l()?.github,br=(e=n())=>ie.github.auth(e),xr=async(e,t)=>{if(e)return e.authStatus();let n=await a(`/api/github/auth/status`,{method:`GET`,headers:{Accept:`application/json`},signal:t}),r=await n.json().catch(()=>null);if(!n.ok||!r)throw Error(r?.error||n.statusText||`Failed to load GitHub status`);return r},Sr=(e,t=n())=>{let r=yr(e);return{queryKey:br(t),queryFn:async({signal:e})=>xr(r,e),retry:2}},Cr=e=>!!e&&typeof e==`object`&&`authStatus`in e,wr=e=>{let t=(0,W.c)(5),n=Cr(e)?e:void 0,r=Cr(e)?void 0:e?.enabled,i;t[0]===n?i=t[1]:(i=Sr(n),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a={...i,enabled:r},t[2]=r,t[3]=i,t[4]=a):a=t[4],re(a)},Tr=(e=j,t=n())=>e.getQueryData(br(t))??null,Er=async(e,t,r)=>n()===r?e.fetchQuery({...Sr(t,r),staleTime:0}):e.getQueryData(br(r))??null,Dr=(e=j,t,r=n())=>{e.setQueryData(br(r),t)},Or=e=>e.replace(/[^\p{L}\p{N}]/gu,``).toLowerCase();function kr(e){let t=[],n=``;for(let r=0;r<e.length;){let i=String.fromCodePoint(e.codePointAt(r)),a=Or(i);for(let e=0;e<a.length;e++)t.push(r);n+=a,r+=i.length}let r=[],i=0,a=[];return{append(o){if(!o||typeof o!=`object`)throw Error(`Invalid speech subtitle`);let{text:s,words:c}=o;if(typeof s!=`string`||s.length>1e4||!Array.isArray(c)||c.length>1e4)throw Error(`Invalid speech subtitle`);if(!c.length||!s.trim())return;let l=1/0,u=0,d=-1;for(let e of c){if(!e||typeof e!=`object`||typeof e.word!=`string`||!Number.isFinite(e.startTime)||!Number.isFinite(e.endTime)||e.startTime<0||e.endTime<e.startTime||e.endTime>7200||e.startTime<d)throw Error(`Invalid speech subtitle timestamp`);l=Math.min(l,e.startTime),u=Math.max(u,e.endTime),d=e.startTime}if(r.some(e=>e.startTime===l&&e.text===s))return;if(i+=s.length,r.length>=1e3||i>2e4)throw Error(`Speech subtitle limit exceeded`);r.push({text:s,startTime:l,endTime:u}),r.sort((e,t)=>e.startTime-t.startTime);let f=0;a=[];for(let i of r){let r=Or(i.text),o=r?n.indexOf(r,f):-1;if(o<0)continue;let s=t[o],c=t[o+r.length-1],l=c+(e.codePointAt(c)>65535?2:1);l+=e.slice(l).match(/^[^\p{L}\p{N}]*/u)[0].length,a.push({...i,start:s,end:l}),f=o+r.length}},at(e){let t=0,n=a.length;for(;t<n;){let r=t+n>>>1;a[r].startTime<=e?t=r+1:n=r}let r=a[t-1];return r&&e<=r.endTime?r:void 0},lastBefore(e){for(let t=a.length-1;t>=0;t--)if(a[t].endTime<=e)return a[t]}}}function Ar(e){return{chunks:[],samples:0,complete:!1,position:0,timeline:kr(e)}}async function jr(e,t,n){if(e&&!e.body)throw Error(`Speech response has no stream`);let r=n.cache??Ar(``),i=e?.body?.getReader(),a=t.createGain();a.gain.value=n.volume,a.connect(t.destination);let o=new Set,s=new Set,c=new Set,l=()=>{for(let e of c)e();c.clear()},u=()=>new Promise(e=>{c.add(e)}),d=new TextDecoder,f=[],p=t.currentTime,m=!1,h=!1,g=!i,_=!i,v,y=-1,b=2**(n.pitch-1),x=i?0:r.position,S=()=>{let e=t.getOutputTimestamp?.().contextTime,i=e!==void 0&&Number.isFinite(e)&&e>=0?e:Math.max(0,t.currentTime-(t.outputLatency||0));for(;f.length&&i>=f[0].at;){h=!0;let e=f[0];if(r.position=e.offset+Math.min(e.duration,(i-e.at)*b),i<e.end)break;f.shift()}let a=r.timeline.at(r.position);a&&a.start>y&&h&&(y=a.start,n.onProgress?.(a))},C=()=>{for(let e of o)e.stop();l()},w=()=>{S(),i?.cancel().catch(()=>void 0),C()};n.signal.addEventListener(`abort`,w,{once:!0});let T=setInterval(S,50),E=()=>{if(n.signal.throwIfAborted(),v)throw v},D=(async()=>{if(!i)return;let e=``,t,a=0,o=e=>{if(!e.trim())return;if(_)throw Error(`Unexpected audio after speech completion`);if(e.length>1048576)throw Error(`Speech frame exceeds the size limit`);let n=JSON.parse(e);if(n.type===`error`)throw Error(`Speech synthesis interrupted or failed`);if(n.type===`done`){_=!0,l();return}if(n.type===`subtitle`){r.timeline.append(n),S();return}if(n.type!==`audio`||typeof n.data!=`string`||n.data.length>12800)throw Error(`Invalid speech audio frame`);let i=atob(n.data),a=new Uint8Array(i.length+(t===void 0?0:1)),o=0;t!==void 0&&(a[o++]=t);for(let e=0;e<i.length;e++)a[o+e]=i.charCodeAt(e);if(t=a.length%2?a[a.length-1]:void 0,a.length>1){if(r.samples*2+a.length>25165824||r.chunks.length>=8192)throw Error(`Speech cache exceeds the size limit`);let e=t===void 0?a:a.slice(0,-1);r.chunks.push(e),r.samples+=e.length/2,l()}};try{for(;;){let t=await i.read();if(n.signal.throwIfAborted(),t.done)break;if(a+=t.value.length,a>33554432)throw Error(`Speech stream exceeds the size limit`);e+=d.decode(t.value,{stream:!0});let r;for(;(r=e.indexOf(`
|
|
3
3
|
`))!==-1;)o(e.slice(0,r)),e=e.slice(r+1);if(e.length>1048576)throw Error(`Speech frame exceeds the size limit`)}if(e+=d.decode(),e.trim()&&o(e),!_||!r.samples||t!==void 0)throw Error(`Incomplete speech audio stream`);r.complete=!0}finally{g=!0,l()}})().catch(e=>{v=e,C()}),O=async(e,r)=>{for(;p-t.currentTime>2&&s.size;)await Promise.race([Promise.race(s),u()]),E();E();let i=Math.min(e.length/2,Math.max(0,Math.round(((n.endAt??1/0)-r)*24e3))),c=Math.max(0,Math.round((x-r)*24e3));if(c>=i)return;let d=t.createBuffer(1,i-c,24e3),h=d.getChannelData(0),g=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let e=c;e<i;e++)h[e-c]=g.getInt16(e*2,!0)/32768;let _=t.createBufferSource();_.buffer=d,_.detune.value=(n.pitch-1)*1200,_.connect(a);let v,y=new Promise(e=>{v=e});s.add(y),o.add(_),_.onended=()=>{S(),o.delete(_),s.delete(y),_.disconnect(),v(),l()};let C=Math.max(p,t.currentTime+.02);p=C+d.duration/b,f.push({at:C,end:p,offset:r+c/24e3,duration:d.duration}),_.start(C),m||(m=!0,n.onStart())};try{E();let e=0,i=0,a=!0;for(;E(),!(i>=(n.endAt??1/0));){if(e>=r.chunks.length){if(g)break;await u();continue}p<t.currentTime+.02&&(a=!0);let n=(r.samples/24e3-Math.max(i,x))/b;if(a&&!_&&n<.4){await u();continue}a=!1;let o=r.chunks[e++];await O(o,i),i+=o.length/48e3}if(await D,E(),!m&&x<Math.min(r.samples/24e3,n.endAt??1/0))throw Error(`Incomplete speech audio stream`);await Promise.all(s),E(),r.position=Math.min(r.samples/24e3,n.endAt??1/0)}finally{S(),clearInterval(T),n.signal.removeEventListener(`abort`,w),await i?.cancel().catch(()=>void 0),await D,i?.releaseLock();for(let e of o)e.onended=null,e.stop(),e.disconnect();a.disconnect()}}async function*Mr(e,t,n){let r=await Ee(Oe(e,`tts`),n),i=crypto.randomUUID(),a=new TextEncoder,o={speaker:e.voice,audio_params:{format:`pcm`,sample_rate:24e3,speech_rate:Math.round((e.speed-1)*100),...[`seed-tts-2.0`,`seed-icl-2.0`].includes(e.resourceId)?{enable_subtitle:!0}:{}},...e.resourceId===`seed-tts-2.0`&&e.voice===`zh_female_vv_uranus_bigtts`?{additions:JSON.stringify({context_texts:[`请用自然、温暖的对话语气朗读,根据文本内容表达恰当的情感,保持清晰自然的停顿与重音,避免夸张的播音腔。`]})}:{}},s=(e,n=!1)=>({user:{uid:`yuri`},namespace:`BidirectionalTTS`,event:e,req_params:{...o,...n?{text:t}:{}}}),c=`connection`,l=0;try{for(r.send(U(1));;){let e=await Fe(await r.read(),`tts`);if(n.throwIfAborted(),e.event===51||e.event===153||e.event===151)throw Error(`Speech synthesis failed`);if(e.event>=100&&e.sessionId!==i)throw Error(`Unexpected speech session`);if(e.event===50&&c===`connection`)c=`session`,r.send(U(100,i,s(100)));else if(e.event===150&&c===`session`)c=`audio`,r.send(U(200,i,s(200,!0))),r.send(U(102,i));else if(e.event===352&&c===`audio`&&e.type===11){if(l+=e.payload.length,l>33554432)throw Error(`Speech audio exceeds size limit`);for(let t=0;t<e.payload.length;t+=9600){let n=e.payload.subarray(t,t+9600),r=``;for(let e of n)r+=String.fromCharCode(e);yield a.encode(`${JSON.stringify({type:`audio`,data:btoa(r)})}\n`)}}else if(e.event===364&&c===`audio`){let t=De(e.payload);yield a.encode(`${JSON.stringify({type:`subtitle`,text:t.text,words:t.words})}\n`)}else if(e.event===152&&c===`audio`){let t=De(e.payload);if(t.status_code!==void 0&&t.status_code!==0&&t.status_code!==2e7)throw Error(`Speech synthesis failed`);if(!l)throw Error(`Speech returned no audio`);try{r.send(U(2))}catch{}yield a.encode(`{"type":"done"}
|
|
4
4
|
`);return}else if(e.event!==350&&e.event!==351)throw Error(`Unexpected speech synthesis event`)}}finally{r.close()}}async function Nr(e,t){if(!e.trim())throw Error(`Speech text is required`);let n=await Ae(`tts`,t);if(!n)return a(`/api/tts/speak`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/x-ndjson, audio/*`},body:JSON.stringify({text:e.trim()}),signal:t});if(e.length>1e4)throw Error(`Speech text must contain 1–10000 characters`);let r=new AbortController,i=Mr(n,e.trim(),AbortSignal.any([t,r.signal])),o=new ReadableStream({async pull(e){try{let t=await i.next();t.done?e.close():e.enqueue(t.value)}catch(t){e.error(t)}},async cancel(){r.abort(),await i.return(void 0)}});return new Response(o,{headers:{"Content-Type":`application/x-ndjson`,"X-Speech-Pitch":String(n.pitch),"X-Speech-Volume":String(n.volume)}})}var Pr=3e4,Fr=new Map,Ir=new Map;async function Lr(e){let t=Date.now(),n=Fr.get(e);if(n&&t-n.checkedAt<Pr)return n.available;let r=Ir.get(e);if(r)return r;let i=(async()=>{try{let t=await a(`/api/tts/status`);if(!t.ok)return Fr.set(e,{available:!1,checkedAt:Date.now()}),!1;let n=!!(await t.json()).available;return Fr.set(e,{available:n,checkedAt:Date.now()}),n}catch{return Fr.set(e,{available:!1,checkedAt:Date.now()}),!1}finally{Ir.delete(e)}})();return Ir.set(e,i),i}var Rr=null,zr=null;function Br(){return Te(),zr||=new(window.AudioContext||window.webkitAudioContext),zr}function Vr(e={}){let r=e.enabled??!0,[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(null),u=(0,Z.useRef)(null),d=(0,Z.useRef)(null),f=(0,Z.useRef)(0),p=N(async()=>{let e=++f.current,t=n(),i=r=>(e===f.current&&n()===t&&s(r),r);if(!r)return i(!1);try{return i(await Lr(t))}catch{return i(!1)}});(0,Z.useEffect)(()=>{p()},[r,p]),(0,Z.useEffect)(()=>t(()=>{p()}),[p]);let m=N(()=>{let e=d.current;if(d.current=null,e?.abort.abort(),u.current){try{u.current.onended=null,u.current.stop()}catch{}u.current=null}a(!1)}),h=N(async()=>{try{let e=Br();e.state===`suspended`&&await e.resume();let t=e.createBuffer(1,1,22050),n=e.createBufferSource();n.buffer=t,n.connect(e.destination),n.start(0)}catch(e){console.error(`[useServerTTS] Failed to unlock audio:`,e)}}),g=N(async(e,t)=>{if(m(),!e.trim()){l(`No text to speak`),t?.onError?.(`No text to speak`);return}l(null);let r={abort:new AbortController};d.current=r;try{let i=Br();i.state===`suspended`&&await i.resume();let o=i.createBuffer(1,1,22050),s=i.createBufferSource();s.buffer=o,s.connect(i.destination),s.start(0);let c=n(),l=t?.resume&&t.playbackKey&&Rr?.key===t.playbackKey&&Rr.identity===c&&Rr.text===e?Rr:null,f=Math.max(0,Math.min(e.length,t?.resumeOffset??0)),p=async(e,n,o,s,c,l)=>{await jr(e,i,{signal:r.abort.signal,pitch:o,volume:s,cache:n,endAt:l,onStart:()=>{d.current===r&&(a(!0),t?.onStart?.())},onProgress:e=>{d.current===r&&t?.onProgress?.({...e,start:e.start+c,end:e.end+c})}})},m=()=>{d.current===r&&(Rr?.key===t?.playbackKey&&(Rr=null),d.current=null,a(!1),t?.onEnd?.())};if(l){if(l.pcm.complete){await p(null,l.pcm,l.pitch,l.volume,l.offset),m();return}let t=l.pcm.timeline.lastBefore(l.pcm.samples/24e3);t&&l.offset+t.end<e.trimEnd().length&&(t.endTime>l.pcm.position&&await p(null,l.pcm,l.pitch,l.volume,l.offset,t.endTime),f=Math.max(f,l.offset+t.end))}if(r.abort.signal.throwIfAborted(),Rr=null,f+=e.slice(f).match(/^\s*/u)[0].length,f===e.length){m();return}let h=await Nr(e.slice(f),r.abort.signal);if(d.current!==r){await h.body?.cancel();return}if(!h.ok){let e=await h.json().catch(()=>({error:`Unknown error`}));throw Error(e.error||`HTTP ${h.status}`)}let g=Number(h.headers.get(`X-Speech-Pitch`)??1),_=Number(h.headers.get(`X-Speech-Volume`)??1);if(h.headers.get(`content-type`)?.includes(`application/x-ndjson`)){let n=Ar(e.slice(f));t?.playbackKey&&(Rr={key:t.playbackKey,identity:c,text:e,offset:f,pcm:n,pitch:g,volume:_}),await p(h,n,g,_,f),m();return}let v=await(await h.blob()).arrayBuffer();if(d.current!==r)return;let y=await i.decodeAudioData(v);if(d.current!==r)return;let b=i.createBufferSource();b.buffer=y,g!==1&&(b.detune.value=(g-1)*1200);let x=i.createGain();if(x.gain.value=_,b.connect(x),x.connect(i.destination),u.current=b,b.onended=()=>{d.current===r&&u.current===b&&(a(!1),u.current=null,d.current=null,t?.onEnd?.())},a(!0),t?.onStart?.(),d.current!==r||u.current!==b)return;b.start(0)}catch(e){if(e.name===`AbortError`||d.current!==r)return;let n=e instanceof Error?e.message:`Failed to speak`;console.error(`[useServerTTS] Error:`,n),l(n),t?.onError?.(n),a(!1),u.current&&=(u.current.onended=null,null),d.current=null}});return(0,Z.useEffect)(()=>t(()=>{m(),Rr=null}),[m]),(0,Z.useEffect)(()=>ke(m),[m]),(0,Z.useEffect)(()=>()=>{m()},[m]),{isPlaying:i,isAvailable:o,error:c,speak:g,stop:m,checkAvailability:p,unlockAudio:h}}var Hr=60,Ur=400;function Wr(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return[];let n=t.match(/[^.!?…]+[.!?…]+["')\]]*\s*|[^.!?…]+$/g)??[t],r=[],i=``;for(let e of n)for(let t=0;t<e.length;t+=Ur){let n=e.slice(t,t+Ur);i&&i.length+n.length>Ur&&(r.push(i.trim()),i=``),i+=n,i.length>=Hr&&/[.!?…]["')\]]*\s*$/.test(i)&&(r.push(i.trim()),i=``)}if(i.trim()&&r.push(i.trim()),r.length>0&&r[0].length>120){let e=r[0],t=/[,;:]\s/g,n=-1,i;for(;(i=t.exec(e))!==null;){let e=i.index+1;if(!(e<40)){if(e>160)break;n=e;break}}if(n>0){let t=e.slice(0,n).trim(),i=e.slice(n).trim();r.splice(0,1,t,i)}}return r}var Gr=null;function Kr(){return Te(),Gr||=new(window.AudioContext||window.webkitAudioContext),Gr}function qr(){let[e,t]=(0,Z.useState)(!1),[n,r]=(0,Z.useState)(null),i=(0,Z.useRef)(null),o=(0,Z.useRef)(null),s=(0,Z.useCallback)(async()=>{try{let e=Kr();e.state===`suspended`&&await e.resume();let t=e.createBuffer(1,1,22050),n=e.createBufferSource();n.buffer=t,n.connect(e.destination),n.start(0)}catch{}},[]),c=(0,Z.useCallback)(()=>{let e=o.current;if(e&&(e.cancelled=!0,e.abort.abort(),o.current=null),i.current){try{i.current.onended=null,i.current.stop()}catch{}i.current=null}t(!1)},[]),l=(0,Z.useCallback)(async(e,n)=>{c();let s=Wr(e);if(s.length===0){r(`No text to speak`),n?.onError?.(`No text to speak`);return}r(null);let l={cancelled:!1,abort:new AbortController};o.current=l;let u=async e=>{let t=await a(`/api/dictation/tts/speak`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:e}),signal:l.abort.signal});if(!t.ok){let e=await t.json().catch(()=>({error:`Unknown error`}));throw Error(e.error||`HTTP ${t.status}`)}return(await t.blob()).arrayBuffer()},d=async e=>{let t=Kr();t.state===`suspended`&&await t.resume();let n=await t.decodeAudioData(e);l.cancelled||await new Promise(e=>{let r=t.createBufferSource();r.buffer=n,r.connect(t.destination),i.current=r,r.onended=()=>{i.current===r&&(i.current=null),e()},r.start(0)})};try{t(!0),n?.onStart?.();let e=u(s[0]);for(let t=0;t<s.length;t+=1){let n=await e;if(l.cancelled||(t+1<s.length&&(e=u(s[t+1])),await d(n),l.cancelled))return}t(!1),n?.onEnd?.()}catch(e){if(e.name===`AbortError`||l.cancelled)return;let i=e instanceof Error?e.message:`Failed to speak`;r(i),n?.onError?.(i),t(!1)}finally{o.current===l&&(o.current=null)}},[c]);return(0,Z.useEffect)(()=>ke(c),[c]),(0,Z.useEffect)(()=>()=>{c()},[c]),{isPlaying:e,error:n,speak:l,stop:c,unlockAudio:s}}var Jr=new class{recognition=null;isListening=!1;currentLang=`en-US`;onResultCallback=null;onErrorCallback=null;restartOnEnd=!1;conversationMode=!1;isSpeaking=!1;audioContext=null;audioUnlockRequired=!1;speechGeneration=0;isSupported(){let e=`SpeechRecognition`in window||`webkitSpeechRecognition`in window,t=`speechSynthesis`in window;return e&&t}getSupportDetails(){return{recognition:`SpeechRecognition`in window||`webkitSpeechRecognition`in window,synthesis:`speechSynthesis`in window,prefixed:!(`SpeechRecognition`in window)&&`webkitSpeechRecognition`in window,secureContext:window.isSecureContext}}setConversationMode(e){this.conversationMode=e,e||(this.restartOnEnd=!1)}isConversationMode(){return this.conversationMode}pauseListening(){if(this.restartOnEnd=!1,this.recognition)try{this.recognition.stop()}catch{}this.isListening=!1}resumeListening(){if(this.conversationMode,this.onResultCallback,this.isSpeaking,this.currentLang,this.conversationMode&&this.onResultCallback&&!this.isSpeaking)try{this.startListeningSync(this.currentLang,this.onResultCallback,this.onErrorCallback||void 0)}catch(e){console.error(`[BrowserVoiceService] Failed to resume listening:`,e)}}async checkMicrophonePermission(){try{return`permissions`in navigator&&(await navigator.permissions.query({name:`microphone`})).state===`granted`}catch{return!1}}async prepareListening(){if(!this.isSupported())throw Error(`Web Speech API not supported in this browser`);if(typeof navigator>`u`||typeof navigator.mediaDevices?.getUserMedia!=`function`)return!0;try{return Ne(),(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop()),!0}catch(e){let t=typeof e==`object`&&e&&`name`in e?String(e.name):``;if(t===`NotAllowedError`)throw Error(`Microphone permission denied`);if(t===`NotFoundError`)throw Error(`No microphone found`);let n=e instanceof Error?e.message:`Unable to access microphone`;throw Error(n)}}startListeningSync(e,t,n){if(!this.isSupported()){let e=`Web Speech API not supported in this browser`;throw n?.(e),Error(e)}this.stopListening(),Ne(),this.isSpeaking=!1;let r=window.SpeechRecognition||window.webkitSpeechRecognition;if(!r){let e=`Web Speech API not supported in this browser`;throw n?.(e),Error(e)}let i=new r;this.recognition=i,this.currentLang=e,this.onResultCallback=t,this.onErrorCallback=n||null,i.continuous=!0,i.interimResults=!0,i.lang=e,i.onstart=()=>{this.isListening=!0,this.restartOnEnd=!0},i.onaudiostart=()=>{},i.onsoundstart=()=>{},i.onresult=e=>{e.results.length;let t=``,n=``;for(let r=e.resultIndex;r<e.results.length;r++){let i=e.results[r];i.isFinal?t+=i[0].transcript:n+=i[0].transcript}n&&this.onResultCallback?.(n,!1),t&&this.onResultCallback?.(t,!0)},i.onerror=e=>{if(e.error===`aborted`)return;let t=this.getErrorMessage(e.error);this.onErrorCallback?.(t),(e.error===`not-allowed`||e.error===`service-not-allowed`||e.error===`network`)&&(this.restartOnEnd=!1,this.isListening=!1)},i.onend=()=>{if(this.isListening=!1,this.restartOnEnd&&this.recognition&&!this.isSpeaking)try{this.recognition.start()}catch{}};try{i.start()}catch(e){let t=e instanceof Error?e.message:`Failed to start speech recognition`;throw n?.(t),Error(t)}}async startListening(e,t,n){this.startListeningSync(e,t,n)}stopListening(){if(this.restartOnEnd=!1,this.recognition){try{this.recognition.stop()}catch{}this.recognition=null}this.isListening=!1}getIsListening(){return this.isListening}getCurrentLang(){return this.currentLang}async resumeAudioContext(){Te(),this.audioContext||=new(window.AudioContext||window.webkitAudioContext),this.audioContext.state===`suspended`&&await this.audioContext.resume()}isAudioUnlockRequired(){return this.audioUnlockRequired}async unlockAudio(){Te();try{let e=new Audio;if(e.src=`data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA`,e.volume=.01,await e.play(),await this.resumeAudioContext(),this.isMobileDevice()&&`speechSynthesis`in window){let e=new SpeechSynthesisUtterance(``);e.volume=0,window.speechSynthesis.speak(e),window.speechSynthesis.cancel()}return this.audioUnlockRequired=!1,!0}catch(e){return console.error(`[BrowserVoiceService] Failed to unlock audio:`,e),!1}}async speakText(e,t,n,r){if(!(`speechSynthesis`in window))throw Error(`Speech synthesis not supported`);let i=++this.speechGeneration;await this.resumeAudioContext();let a=await this.waitForVoices();if(await new Promise(e=>setTimeout(e,50)),i!==this.speechGeneration)return;this.isSpeaking=!0,this.pauseListening(),window.speechSynthesis.cancel();let o=new SpeechSynthesisUtterance(e);o.lang=t,o.rate=r?.rate??1,o.pitch=r?.pitch??1,o.volume=r?.volume??1;let s=null;return r?.voiceName&&(s=a.find(e=>e.name===r.voiceName)||null,s?`${s.name}${s.lang}`:console.warn(`[BrowserVoiceService] Selected voice "${r.voiceName}" not found, falling back to language match`)),s||(s=this.findBestVoice(a,t),s?`${s.name}${s.lang}`:console.warn(`[BrowserVoiceService] No voice found for language: ${t}, using default`)),s&&(o.voice=s),`${e.length}${t}`,new Promise((e,t)=>{let a=!1;o.onstart=()=>{i===this.speechGeneration&&(a=!0,r?.onStart?.(),e())},o.onend=()=>{i===this.speechGeneration&&(this.isSpeaking=!1,n?.())},o.onerror=e=>{if(i!==this.speechGeneration)return;this.isSpeaking=!1,console.error(`[BrowserVoiceService] Speech synthesis error:`,e.error),(e.error===`not-allowed`||e.error===`interrupted`)&&(this.audioUnlockRequired=!0);let n=`Speech synthesis error: ${e.error||`unknown`}`;e.error===`not-allowed`?n=`Audio blocked by browser autoplay policy. Please interact with the page first.`:e.error===`interrupted`&&(n=`Speech was interrupted. Please try again.`),r?.onError?.(n),t(Error(n))},setTimeout(()=>{a||(console.warn(`[BrowserVoiceService] Speech start timeout - audio may be blocked`),this.audioUnlockRequired=!0)},2e3),window.speechSynthesis.speak(o)})}cancelSpeech(){this.speechGeneration+=1,this.isSpeaking=!1,`speechSynthesis`in window&&window.speechSynthesis.cancel()}getVoices(){return`speechSynthesis`in window?window.speechSynthesis.getVoices():[]}async waitForVoices(){if(!(`speechSynthesis`in window))return[];let e=window.speechSynthesis.getVoices();return e.length>0?e:new Promise(e=>{let t=()=>{e(window.speechSynthesis.getVoices()),window.speechSynthesis.onvoiceschanged=null};window.speechSynthesis.onvoiceschanged=t,setTimeout(()=>{e(window.speechSynthesis.getVoices()),window.speechSynthesis.onvoiceschanged=null},1e3)})}findBestVoice(e,t){let n=e.find(e=>e.lang===t);if(!n){let r=t.split(`-`)[0];n=e.find(e=>e.lang.startsWith(r))}return n||=e.find(e=>e.lang.startsWith(t.split(`-`)[0])&&e.localService),n||null}isMobileDevice(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent.toLowerCase();return/iphone|ipad|ipod|android|mobile|webos|blackberry|iemobile|opera mini/i.test(e)}isIOSSafari(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent.toLowerCase(),t=/iphone|ipad|ipod/i.test(e),n=/safari/i.test(e)&&!/chrome|crios|crmo/i.test(e);return t&&n}getErrorMessage(e){let t=this.isMobileDevice(),n=this.isIOSSafari();return{"no-speech":`No speech detected`,aborted:`Speech recognition aborted`,"audio-capture":`No microphone found`,network:`Network error - check connection`,"not-allowed":t?`Microphone permission denied. Check Settings > Safari > Microphone`:`Microphone permission denied`,"service-not-allowed":n?`Speech recognition requires a user gesture. Please tap the microphone button again.`:`Speech recognition service not allowed`,"bad-grammar":`Grammar error`,"language-not-supported":`Language not supported`}[e]||`Speech recognition error: ${e}`}};ke(()=>Jr.cancelSpeech());var Yr=e=>{if(e===`12h`)return!0;if(e===`24h`)return!1},Xr=(e,t,n={})=>{let r=e instanceof Date?e:new Date(e);return Number.isFinite(r.getTime())?r.toLocaleTimeString(F(),{hour:n.hour??`numeric`,minute:`2-digit`,second:n.precision===`second`?`2-digit`:void 0,hour12:Yr(t)}):n.fallback??``},Zr=(e,t,n)=>{let r=e instanceof Date?e:new Date(e);return Number.isFinite(r.getTime())?r.toLocaleString(F(),{...n,hour12:n.hour?Yr(t):n.hour12}):``},Qr=e=>e===`allow`||e===`deny`||e===`ask`;function $r(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function ei(e){return $r(e)?typeof e.action==`string`&&typeof e.resource==`string`&&Qr(e.effect)?{action:e.action,resource:e.resource,effect:e.effect}:typeof e.permission==`string`&&typeof e.pattern==`string`&&Qr(e.action)?{action:e.permission,resource:e.pattern,effect:e.action}:null:null}function ti(e){if(Array.isArray(e))return e.flatMap(e=>{let t=ei(e);return t?[t]:[]});if(Qr(e))return[{action:`*`,resource:`*`,effect:e}];if(!$r(e))return[];let t=[];for(let[n,r]of Object.entries(e))if(n!==`__originalKeys`){if(Qr(r)){t.push({action:n,resource:`*`,effect:r});continue}if($r(r))for(let[e,i]of Object.entries(r))Qr(i)&&t.push({action:n,resource:e,effect:i})}return t}function ni(e){return ti(e)}var Q=e=>L(le.getState().dictionary,e),ri=e=>typeof e!=`number`||!Number.isFinite(e)?null:Math.max(0,Math.min(100,Math.round(e))),ii=e=>typeof e!=`number`||!Number.isFinite(e)?`-`:`${Math.round(e)}%`,ai=(e,t)=>e??ii(t),oi=(e,t,n=`auto`)=>{if(!e)return t??``;try{let r=new Date(e);if(!Number.isFinite(r.getTime()))return t??``;let i=new Date;return r.toDateString()===i.toDateString()?Xr(r,n,{fallback:t??``}):Zr(r,n,{month:`short`,day:`numeric`,weekday:`short`,hour:`numeric`,minute:`2-digit`})}catch{return t??``}},si=e=>e===null?`safe`:e>=80?`critical`:e>=50?`warn`:`safe`,ci=e=>e===`5h`?Q(`quota.window.5h`):e===`7d`?Q(`quota.window.7d`):e===`7d-sonnet`?Q(`quota.window.7dSonnet`):e===`7d-opus`?Q(`quota.window.7dOpus`):e===`weekly`?Q(`quota.window.weekly`):e===`daily`?Q(`quota.window.daily`):e===`monthly`?Q(`quota.window.monthly`):e===`credits`?Q(`quota.window.credits`):e===`credits_balance`?Q(`quota.window.creditsBalance`):e===`billing_cycle`?Q(`quota.window.billingCycle`):e===`auto`?Q(`quota.window.auto`):e===`api`?Q(`quota.window.api`):e===`plan_limit`?Q(`quota.window.planLimit`):e===`on_demand`?Q(`quota.window.onDemand`):e===`session`?Q(`quota.window.session`):e===`premium`?Q(`quota.window.premium`):e===`chat`?Q(`quota.window.chat`):e===`completions`?Q(`quota.window.completions`):e===`premium_interactions`?Q(`quota.window.premiumInteractions`):e,li=e=>{let t=e.toLowerCase().trim();if(t===`5h`)return 18e3;if(t===`7d`||t===`weekly`||t===`7d-sonnet`||t===`7d-opus`)return 604800;if(t===`monthly`)return 2592e3;if(t===`24h`||t===`daily`)return 86400;if(t===`1h`)return 3600;let n=t.match(/^(\d+)h$/);if(n)return parseInt(n[1],10)*3600;let r=t.match(/^(\d+)d$/);return r?parseInt(r[1],10)*86400:null},ui=(e,t,n,r)=>{let i=n;if(i===null&&r&&(i=li(r)),e===null||t===null||i===null||i<=0)return null;let a=Math.max(0,(t-Date.now())/1e3),o=Math.max(0,Math.min(i,i-a)),s=Math.max(0,Math.min(1,o/i)),c=e/100,l=e>=100&&a>0,u;u=s>.01?Math.min(999,c/s*100):e;let d;d=l?`exhausted`:c<=s?`on-track`:u<=130?`slightly-fast`:`too-fast`;let f=i>=432e3,p=f?86400:3600,m=f?`d`:`h`,h=i/p,g=e/Math.max(o/p,h*.01),_=Number.isFinite(g)?`${Math.min(999.9,Math.max(0,g)).toFixed(1)}%/${m}`:`-`,v=u>100?`+${Math.round(u)}%`:`${Math.round(u)}%`,y=null,b=i/86400;return b>=7&&(y=100/b),{elapsedRatio:s,usageRatio:c,predictedFinalPercent:u,remainingSeconds:a,isExhausted:l,elapsedSeconds:o,totalSeconds:i,status:d,paceRateText:_,predictText:v,dailyAllocationPercent:y}},di=e=>{switch(e){case`exhausted`:case`too-fast`:return`var(--status-error)`;case`slightly-fast`:return`var(--status-warning)`;case`on-track`:return`var(--status-success)`}},fi=e=>{let t=Math.floor(Math.max(0,Math.floor(e))/60),n=Math.floor(t/60),r=Math.floor(n/24),i=n%24,a=t%60;return r>0?`${r}d ${i}h`:n>0?`${n}h`:t===0?`<1m`:`${a}m`},pi=e=>Math.min(100,Math.max(0,e*100)),$=(e,t)=>L(le.getState().dictionary,e,t),mi=e=>{let t=new Date(e),n=new Date,r=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),i=new Date(n);return i.setDate(n.getDate()-1),r(t,n)?$(`common.date.today`):r(t,i)?$(`common.date.yesterday`):t.toLocaleDateString(F(),{month:`short`,day:`numeric`,year:`numeric`}).replace(`,`,``)},hi=e=>{let t=new Date;if(((e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate())(new Date(e),t)){let t=Date.now()-e;return t<6e4?$(`common.relative.justNow`):t<36e5?$(`common.relative.minutesAgoShort`,{count:Math.floor(t/6e4)}):$(`common.relative.hoursAgoShort`,{count:Math.floor(t/36e5)})}return mi(e)},gi=e=>{let t=Math.max(0,Date.now()-e),n=6e4,r=60*n,i=24*r,a=7*i,o=365*i;return t<r?$(`common.relative.minutesAgoCompact`,{count:Math.max(1,Math.floor(t/n))}):t<i?$(`common.relative.hoursAgoCompact`,{count:Math.floor(t/r)}):t<a?$(`common.relative.daysAgoCompact`,{count:Math.floor(t/i)}):t<5*a?$(`common.relative.weeksAgoCompact`,{count:Math.floor(t/a)}):t<o?$(`common.relative.monthsAgoCompact`,{count:Math.floor(t/2592e6)}):$(`common.relative.yearsAgoCompact`,{count:Math.floor(t/o)})},_i=(e,t)=>vi(M(e),M(t)),vi=(e,t)=>!e||!t?!1:e===t?!0:t===`/`?e.startsWith(`/`):e.startsWith(`${t}/`),yi=e=>e.toLowerCase().replace(/^opencode[/-]?/i,``).replace(/[-_]/g,``).trim(),bi=(e,t)=>e?yi(e)!==yi(t):!1,xi=e=>{if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`&&e.trim().length>0){let t=Number(e);if(Number.isFinite(t))return t}},Si=e=>xi(e.time?.created)??0,Ci=(e,t,n)=>{let r=n.has(e.id),i=n.has(t.id);return r===i?r&&i?Si(t)-Si(e):z(t)-z(e):r?-1:1},wi=e=>{let t=new Map;return e.forEach(e=>{t.set(e.id,e)}),Array.from(t.values())},Ti=e=>`__archived__:${e}`,Ei=(e,t)=>{let n=M(e.directory??null),r=M(e.project?.worktree??null),i=n??r;if(!i)return`unassigned`;if(t&&i===t)return`project root`;let a=(t&&i.startsWith(`${t}/`)?i.slice(t.length+1):i).split(`/`).filter(Boolean);return a[a.length-1]??`unassigned`},Di=`box-border w-full px-2 py-1.5 text-left typography-micro text-muted-foreground/70 select-none`,Oi=`bg-[color-mix(in_srgb,var(--surface-foreground)_6%,transparent)] dark:bg-[color-mix(in_srgb,var(--surface-foreground)_11%,transparent)]`,ki=`hover:bg-[color-mix(in_srgb,var(--surface-foreground)_3.5%,transparent)] dark:hover:bg-[color-mix(in_srgb,var(--surface-foreground)_8%,transparent)]`,Ai=e=>{let t=Math.max(0,e);return t===0?8:30+(t-1)*14},ji=(e,t)=>{if(!t)return e;let n=e.toLowerCase(),r=t.toLowerCase(),i=r.length;if(i===0)return e;let a=[],o=0,s=n.indexOf(r,o);for(;s!==-1;){s>o&&a.push(e.slice(o,s));let t=e.slice(s,s+i);a.push((0,X.jsx)(`mark`,{className:`bg-transparent font-[inherit] text-[var(--primary-base)]`,children:t},`${s}-${t}`)),o=s+i,s=n.indexOf(r,o)}return o<e.length&&a.push(e.slice(o)),a.length>0?a:e},Mi=`/api/browser-providers`,Ni=`/api/browser-providers/selection`,Pi=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,Fi=200,Ii=e=>`/api/browser-providers/${encodeURIComponent(e)}/surface/ws`,Li=e=>!!e&&typeof e==`object`&&!Array.isArray(e),Ri=e=>typeof e==`string`&&Pi.test(e)?e:null,zi=e=>{if(!Li(e))return null;let t=Ri(e.id),n=typeof e.name==`string`?e.name.trim():``;return!t||!n||n.length>Fi?null:{id:t,name:n,surface:e.surface===!0}},Bi=e=>{if(!Li(e)||!Array.isArray(e.providers))return null;let t=[],n=new Set;for(let r of e.providers){let e=zi(r);!e||n.has(e.id)||(n.add(e.id),t.push(e))}let r=Ri(e.selectedId);return{providers:t,selectedId:r&&n.has(r)?r:null}},Vi=e=>{if(!Li(e))return null;let t=Ri(e.selectedId);return t?{selectedId:t}:null},Hi=e=>e?.selectedId?e.providers.find(t=>t.id===e.selectedId)??null:null,Ui=e=>!!(e&&e.providers.length>0),Wi=e=>Hi(e)!==null,Gi=e=>typeof e==`number`&&Number.isFinite(e),Ki=e=>{if(!Li(e)||typeof e.type!=`string`)return null;if(e.type===`hello`&&typeof e.viewerId==`string`&&e.viewerId.length>0)return{type:`hello`,viewerId:e.viewerId};if(e.type===`frame`){let t=e.mime===`image/jpeg`||e.mime===`image/png`?e.mime:null;if(!t||!Gi(e.seq)||!Gi(e.width)||!Gi(e.height)||!Gi(e.bytes)||e.bytes<1||typeof e.agentActive!=`boolean`)return null;let n=typeof e.title==`string`?e.title:void 0;return{type:`frame`,seq:e.seq,width:e.width,height:e.height,mime:t,bytes:e.bytes,title:n,agentActive:e.agentActive}}if(e.type===`control`){let t=e.controller===`none`||e.controller===`agent`||e.controller===`user`?e.controller:null;return!t||typeof e.mine!=`boolean`?null:{type:`control`,controller:t,mine:e.mine}}return e.type===`resized`&&Gi(e.width)&&Gi(e.height)?{type:`resized`,width:e.width,height:e.height}:e.type===`error`&&typeof e.code==`string`&&typeof e.message==`string`?{type:`error`,code:e.code,message:e.message}:e.type===`ended`&&(e.reason===`service-stopped`||e.reason===`extension-unavailable`||e.reason===`host-shutdown`)?{type:`ended`,reason:e.reason}:null},qi=class extends Error{status;constructor(e){super(`browser_provider_request_failed:${e}`),this.name=`BrowserProviderRequestError`,this.status=e}},Ji=(e=n())=>ie.browserProviders.catalog(e),Yi=async e=>{let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return null}},Xi=async e=>{let t=await a(Mi,{method:`GET`,headers:{Accept:`application/json`},signal:e}),n=await Yi(t);if(!t.ok)throw new qi(t.status);let r=Bi(n);if(!r)throw new qi(t.status||502);return r},Zi=(e=n())=>({queryKey:Ji(e),queryFn:({signal:e})=>Xi(e),staleTime:5e3,refetchOnWindowFocus:!0,refetchInterval:e=>{let t=e.state.error;return t instanceof qi&&(t.status===404||t.status===501)?!1:15e3}}),Qi=()=>{let e=(0,W.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=Zi(),e[0]=t):t=e[0],re(t)},$i=(e=j,t=n())=>e.getQueryData(Ji(t))??null,ea=(e,t)=>e?.providers.some(e=>e.id===t)?{providers:e.providers,selectedId:t}:null,ta=async(e,t=j,r)=>{let i=n(),o=await a(Ni,{method:`PUT`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({id:e}),signal:r}),s=await Yi(o);if(!o.ok)throw new qi(o.status);let c=Vi(s);if(!c||c.selectedId!==e||n()!==i)throw new qi(o.status||502);let l=ea(t.getQueryData(Ji(i)),c.selectedId);if(!l)throw new qi(409);return l},na=()=>{let e=(0,W.c)(2),t=ee(),r;return e[0]===t?r=e[1]:(r={mutationFn:e=>ta(e,t),onMutate:async e=>{let r=n(),i=Ji(r);await t.cancelQueries({queryKey:i});let a=t.getQueryData(i),o=ea(a,e);return o&&t.setQueryData(i,o),{previous:a,key:i,transport:r}},onError:(e,r,i)=>{!i||n()!==i.transport||t.setQueryData(i.key,i.previous)},onSuccess:(e,r,i)=>{!i||n()!==i.transport||t.setQueryData(i.key,e)}},e[0]=t,e[1]=r),te(r)},ra=[`standalone`,`minimal-ui`,`fullscreen`,`window-controls-overlay`],ia=`yuri.pwaRecentSessions`,aa=e=>typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(display-mode: ${e})`).matches,oa=()=>typeof window>`u`?`browser`:typeof document<`u`&&document.referrer.startsWith(`android-app://`)?`twa`:window.navigator.standalone?`standalone`:ra.find(e=>aa(e))??`browser`,sa=(e=n())=>({queryKey:[e,`speech`,`settings`],queryFn:({signal:e})=>D(e,async e=>{let t=await a(`/api/voice/settings`,{signal:e});if(!t.ok)throw Error(`Unable to load speech settings`);return B(await t.json())}),staleTime:3e4,networkMode:`always`,retry:1,refetchOnWindowFocus:!0}),ca=()=>{let e=(0,W.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=sa(),e[0]=t):t=e[0],re(t)};async function la(e,t=i(),r=n()){let{queryKey:o}=sa(r);if(await j.cancelQueries({queryKey:o,exact:!0}),t!==i())throw Error(`Runtime changed`);let s=await D(new AbortController().signal,async t=>{let n=await a(`/api/voice/settings`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e),signal:t});if(!n.ok)throw Error(`Unable to save speech settings`);return B(await n.json())});if(t!==i()||r!==n()||(await j.cancelQueries({queryKey:o,exact:!0}),t!==i()))throw Error(`Runtime changed`);return j.setQueryData(o,s),s}export{$n as $,bt as $t,oi as A,Yt as At,Jr as B,Ot as Bt,_i as C,tn as Ct,pi as D,Wt as Dt,Ei as E,qt as Et,si as F,Xt as Ft,Dr as G,it as Gt,Vr as H,tt as Ht,ni as I,Mt as It,or as J,ct as Jt,wr as K,nt as Kt,ti as L,jt as Lt,fi as M,Ut as Mt,ci as N,Kt as Nt,ui as O,Bt as Ot,di as P,Zt as Pt,nr as Q,yt as Qt,Zr as R,Dt as Rt,bi as S,Qt as St,ji as T,en as Tt,Tr as U,at as Ut,qr as V,ut as Vt,Er as W,ot as Wt,er as X,st as Xt,Zn as Y,lt as Yt,tr as Z,xt as Zt,wi as _,vn as _t,oa as a,Nn as at,Ti as b,mn as bt,na as c,An as ct,Wi as d,Tn as dt,St as en,Kn as et,Ui as f,_n as ft,Ci as g,wn as gt,ki as h,xn as ht,ia as i,Ge as in,Fn as it,ai as j,Gt as jt,ri as k,Jt as kt,Ii as l,an as lt,Oi as m,bn as mt,sa as n,Ue as nn,jn as nt,$i as o,Pn as ot,Di as p,yn as pt,mr as q,rt as qt,ca as r,We as rn,Mn as rt,Qi as s,In as st,la as t,Ct as tn,kn as tt,Ki as u,Cn as ut,gi as v,Sn as vt,yi as w,$t as wt,Ai as x,rn as xt,hi as y,fn as yt,Xr as z,kt as zt};
|