@yuriai/web 0.3.4 → 0.3.6-beta.5
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-BaKbuiEG.js +1 -0
- package/dist/assets/AgentSelector-BXLvdwk0.js +1 -0
- package/dist/assets/ArchivedSessionsDialog-wIl8A7HL.js +1 -0
- package/dist/assets/AssistantConversationSurface-DRwJ4zWe.js +3 -0
- package/dist/assets/AssistantSessionCard-D1AZs8JQ.js +2 -0
- package/dist/assets/AssistantUnreadBadge-4aoNcXVG.js +1 -0
- package/dist/assets/AssistantView-CG0DnE1H.js +1 -0
- package/dist/assets/AssistantWorkingAvatar-uOBMRhP_.js +1 -0
- package/dist/assets/AssistantsSettingsPage-DIWJVEf8.js +1 -0
- package/dist/assets/BinaryFileFallback-BH_-EIjs.js +1 -0
- package/dist/assets/BtwPanel-DRdap4Qu.js +6 -0
- package/dist/assets/BusyDots-BGjLnIPh.js +4 -0
- package/dist/assets/ChatContainer-BtfbvM1R.js +65 -0
- package/dist/assets/ChatView-CUwLwCFl.js +3 -0
- package/dist/assets/{DiagramView-DGnmjS2b.js → DiagramView-CRZFpG4-.js} +1 -1
- package/dist/assets/{DiffView-Bbit6OZ8.js → DiffView-4Z0aCFfu.js} +2 -2
- package/dist/assets/DiffViewToggle-DYSI03aW.js +1 -0
- package/dist/assets/ErrorBoundary-CinEsvgD.js +1 -0
- package/dist/assets/FadeInOnReveal-P-c7VO7Q.js +1 -0
- package/dist/assets/{GuiPluginMount-TC5FELtQ.js → GuiPluginMount-DtJaOBdU.js} +1 -1
- package/dist/assets/GuiPluginPage-DSeGfoT6.js +1 -0
- package/dist/assets/GuiPluginSurface-357Sz83f.js +1 -0
- package/dist/assets/GuiPluginTitlebarItems-XIPpX6DU.js +1 -0
- package/dist/assets/{GuiPluginWindow-BkAFJyFd.js → GuiPluginWindow-ICodvkoO.js} +1 -1
- package/dist/assets/Icon-CeG6IExS.js +1 -0
- package/dist/assets/ImageLoadingPlaceholder-zzKCgcZz.js +1 -0
- package/dist/assets/{LoadingImage-Df22Rkor.js → LoadingImage-B4Icoej_.js} +1 -1
- package/dist/assets/MarkdownRenderer-Bjm6Wld2.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-D8q0FMnr.js → MarkdownRendererImpl-BdOA-vAV.js} +1 -1
- package/dist/assets/MarkstreamRendererImpl-j30G11Dc.js +3 -0
- package/dist/assets/{MobileAssistantSettingsPage-Dgq5FMho.js → MobileAssistantSettingsPage-CGK1ceah.js} +1 -1
- package/dist/assets/MobileAssistantTab-ZugumKSY.js +1 -0
- package/dist/assets/{MobileBtwPage-DQUkSO6N.js → MobileBtwPage-afopNi2T.js} +1 -1
- package/dist/assets/{MobileChangesSurface-DsYNmAuM.js → MobileChangesSurface-C3mhr7en.js} +2 -2
- package/dist/assets/MobileChatScreen-ByOiuFAV.js +1 -0
- package/dist/assets/MobileDetailNavigation-IQDDP6TO.js +1 -0
- package/dist/assets/MobileFilesSurface-Bia8vPcg.js +2 -0
- package/dist/assets/MobileHtmlNetworkBoundary-DCiTI-t-.js +2 -0
- package/dist/assets/MobileOverlayPanel-D0W5tjrd.js +1 -0
- package/dist/assets/MobileResizableSheet-0fdiGkg0.js +1 -0
- package/dist/assets/{MobileSettingsTab-DaTtRHo1.js → MobileSettingsTab-iPLVIfcN.js} +1 -1
- package/dist/assets/{MobileShareBridge-CZpFYmiy.js → MobileShareBridge-DzcR4Knr.js} +1 -1
- package/dist/assets/MobileSurface-B1fG72a-.js +1 -0
- package/dist/assets/MobileTabPageHeader-BFKAUrAU.js +1 -0
- package/dist/assets/ModelLogo-CYR-ynHM.js +1 -0
- package/dist/assets/ModelSelector-B3h2Xy64.js +1 -0
- package/dist/assets/MultiRunWindow-C8S7H7Md.js +1 -0
- package/dist/assets/OnboardingScreen-D7fZQm8c.js +1 -0
- package/dist/assets/OverlayScrollbar-C5v7GRZi.js +1 -0
- package/dist/assets/{PierreDiffViewer-DVKsdwJR.js → PierreDiffViewer-CxRfGY_b.js} +3 -3
- package/dist/assets/ProviderLogo-zqjvjfIK.js +1 -0
- package/dist/assets/{RemoteAssistantSessionCard-DAoFvZht.js → RemoteAssistantSessionCard-B284CHHf.js} +1 -1
- package/dist/assets/RemoteDesktopPanel-CREalB4m.js +1 -0
- package/dist/assets/ScheduledTasksDialog-YAy5JZVs.js +3 -0
- package/dist/assets/ScrollableOverlay-BGOUZmbS.js +1 -0
- package/dist/assets/SettingsGroup-BoEy2EFq.js +1 -0
- package/dist/assets/{SettingsView-DEU94-h1.js → SettingsView-cLTUC0DF.js} +13 -13
- package/dist/assets/SettingsWindow-Kp2ClVgJ.js +1 -0
- package/dist/assets/SetupTourDialog-DNb6i2Z1.js +1 -0
- package/dist/assets/{SyncActions-CrOoREWF.js → SyncActions-D7uIFrJB.js} +1 -1
- package/dist/assets/TerminalView-viydTW0Q.js +8 -0
- package/dist/assets/TextSelectionMenu-B3RIGNm7.js +11 -0
- package/dist/assets/{ToolOutputDialog-DpaaQ1uZ.js → ToolOutputDialog-CoGamWCH.js} +1 -1
- package/dist/assets/{YuriLogo-Cp6vWDWp.js → YuriLogo-_1Inxw8P.js} +1 -1
- package/dist/assets/{YuriWordmark-CLGHwobA.js → YuriWordmark-CW53XKgV.js} +1 -1
- package/dist/assets/{assistant-attachment-cache-bRIIESGe.js → assistant-attachment-cache-eNT2QtmP.js} +1 -1
- package/dist/assets/assistantMessagePreview-CDdckvGJ.js +1 -0
- package/dist/assets/assistantQueries-DKqpPYqd.js +1 -0
- package/dist/assets/{auto-read-context-ClBUErN2.js → auto-read-context-G7T0GxFZ.js} +1 -1
- package/dist/assets/{capgoAdapter-pfQJmvW2.js → capgoAdapter-Cu4rw1AP.js} +1 -1
- package/dist/assets/card-BBxZ1WhJ.js +1 -0
- package/dist/assets/chatUpwardIntent-DmVhPEhT.js +1 -0
- package/dist/assets/checkbox-D9uVg1CM.js +1 -0
- package/dist/assets/{client-B_907PBv.js → client-ITylDDCS.js} +1 -1
- package/dist/assets/collapsible-_BAnUguY.js +1 -0
- package/dist/assets/{connection-hint-B-kOWome.js → connection-hint-BnhKxvRb.js} +1 -1
- package/dist/assets/context-menu-j9GOycjo.js +1 -0
- package/dist/assets/diagram-B4DOrQoy.js +1 -0
- package/dist/assets/dialog-CZlghHCF.js +1 -0
- package/dist/assets/dropdown-menu-C-MjrLjA.js +1 -0
- package/dist/assets/{es-DqYZgeC6.js → es-BxH-QWNw.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-BQEUty_A.js → fileMentionTouchSelection-Dv6PCS5x.js} +1 -1
- package/dist/assets/{fileReferenceActions-TmbrIHBI.js → fileReferenceActions-B2jCazPJ.js} +1 -1
- package/dist/assets/{fr-BHaun7Zq.js → fr-BuXhxsLA.js} +1 -1
- package/dist/assets/{gitApi-CoVwjIDy.js → gitApi-BnZcCLpz.js} +1 -1
- package/dist/assets/gitApiHttp-DF1ID314.js +3 -0
- package/dist/assets/githubAuthQueries-C5RxUNL2.js +1 -0
- package/dist/assets/historyImportQueries-CZsECryv.js +1 -0
- package/dist/assets/{host-ChBHl_Vl.js → host-C7jHgymK.js} +1 -1
- package/dist/assets/{i18n-DXc6czdR.js → i18n-BcqhT5IQ.js} +1 -1
- package/dist/assets/{icons-Bd-INsoy.js → icons-BjKhmiUB.js} +1 -1
- package/dist/assets/{imageSource-BR4C9TuS.js → imageSource-Cq_p4gAe.js} +1 -1
- package/dist/assets/input-CK6ESZJN.js +1 -0
- package/dist/assets/{input-store-BSJBQTMi.js → input-store-dLjM4aiu.js} +1 -1
- package/dist/assets/insertionBoundaries-CD1bfNQI.js +1 -0
- package/dist/assets/{ja-BGNugvrx.js → ja-qWngDHZr.js} +1 -1
- package/dist/assets/kbd-DqpD1Z1W.js +1 -0
- package/dist/assets/{ko-CGbNBfDe.js → ko-CSKPW13b.js} +1 -1
- package/dist/assets/main-buUrzK21.js +2 -0
- package/dist/assets/main-wnAp11Lg.js +169 -0
- package/dist/assets/{markdownHeightCache-CHGGNhWI.js → markdownHeightCache-B5NINUfB.js} +1 -1
- package/dist/assets/mcpQueries-CEyM57ph.js +1 -0
- package/dist/assets/miniChat-DDuanxyB.js +2 -0
- package/dist/assets/mobile-CL1PHr-g.js +2 -0
- package/dist/assets/{mobileBackNavigation-C94n2eLT.js → mobileBackNavigation-Cqz28R4e.js} +1 -1
- package/dist/assets/mobileConnections-DBVkkjN_.js +2 -0
- package/dist/assets/multirun-CG2iQzs1.js +3 -0
- package/dist/assets/{native-config-DVg8_Zx1.js → native-config-q8-2XVGB.js} +1 -1
- package/dist/assets/{nativeComposerCover-Bhv1EKPT.js → nativeComposerCover-X18Rxy9s.js} +1 -1
- package/dist/assets/{navigation-D1klsD7k.js → navigation-B17JP7Nc.js} +2 -2
- package/dist/assets/openRemoteProjectSession-B2oJdHC6.js +1 -0
- package/dist/assets/{pl-k8-4URiE.js → pl-ON0IoadC.js} +1 -1
- package/dist/assets/pluginPresentation-OcngX2e8.js +2 -0
- package/dist/assets/{project-preview-BCtFY4Rg.js → project-preview-BcLPKzwg.js} +1 -1
- package/dist/assets/{prompt-attachment-upload-B5DHrw6U.js → prompt-attachment-upload-BGppTOgV.js} +1 -1
- package/dist/assets/{pt-BR-DdwCzXBH.js → pt-BR-BAekLJyC.js} +1 -1
- package/dist/assets/pwa-dfKnHt2U.js +2 -0
- package/dist/assets/queue-abort-optimistic-CIugRVbT.js +1 -0
- package/dist/assets/{quota-CqWNkFzw.js → quota-BpQX7Pfg.js} +1 -1
- package/dist/assets/{reference-history-IEuzG8KC.js → reference-history-Dk7Uz1e9.js} +1 -1
- package/dist/assets/{remote-input-store-C6UIEZxp.js → remote-input-store-DdjKfpxS.js} +1 -1
- package/dist/assets/remoteProjectQueries-BXrXdLjN.js +1 -0
- package/dist/assets/{remoteSessionReference-ex07CtrZ.js → remoteSessionReference-DL-cFaU4.js} +1 -1
- package/dist/assets/renderElectronMiniChatApp-D-qMtvJ5.js +2 -0
- package/dist/assets/renderMobileApp-DE4dovZy.js +17 -0
- package/dist/assets/{runtime-file-download-BWeoSXRb.js → runtime-file-download-1s2Al1t3.js} +1 -1
- package/dist/assets/runtime-file-resource-C5kmYlLv.js +6 -0
- package/dist/assets/{runtimeConfig-CyvlrO58.js → runtimeConfig-Bto7mqiH.js} +1 -1
- package/dist/assets/runtimeEndpointReset-C41HR0MC.js +4 -0
- package/dist/assets/{scheduledTaskNavigation-VVTOq9n2.js → scheduledTaskNavigation-qCB0nuyR.js} +1 -1
- package/dist/assets/select-DsqFxij6.js +1 -0
- package/dist/assets/{sessionLookup-DQOiycHr.js → sessionLookup-BL43L4KX.js} +1 -1
- package/dist/assets/sessionOwnership-CoFyzErn.js +2 -0
- package/dist/assets/shortcuts-CS2j7q63.js +1 -0
- package/dist/assets/sortable-tabs-strip-DiIB2-kp.js +1 -0
- package/dist/assets/speechSettingsQueries-DXlNIuv5.js +1 -0
- package/dist/assets/src-DYCPWwUH.css +2 -0
- package/dist/assets/{store-C1ifDY0C.js → store-BHq6XijA.js} +3 -3
- package/dist/assets/switch-C-h9UNYt.js +1 -0
- package/dist/assets/{terminalApi-DXvEquBF.js → terminalApi-2TIqWX2z.js} +1 -1
- package/dist/assets/textarea-DjSTlLEk.js +1 -0
- package/dist/assets/{timeFormat-dCsf2MQv.js → timeFormat-CPklO4G4.js} +1 -1
- package/dist/assets/tooltip-mPnbOruE.js +1 -0
- package/dist/assets/truncated-path-DJ1GdoM1.js +1 -0
- package/dist/assets/types-DjjmI1B9.js +2 -0
- package/dist/assets/ui-Cd2-HQSa.js +13 -0
- package/dist/assets/{uk-DU-7fAP4.js → uk-CV7mskVO.js} +1 -1
- package/dist/assets/{useAppFontEffects-rbTKcF0f.js → useAppFontEffects-mOLMhLug.js} +5 -5
- package/dist/assets/{useAssistantUIStore-CpJZ4Rqs.js → useAssistantUIStore-AI2LkqlQ.js} +1 -1
- package/dist/assets/useDesktopWindowControlsLayout-BC62ly7f.js +1 -0
- package/dist/assets/{useDictation-CZzAlsW0.js → useDictation-D8v7PflM.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-DiJBIfai.js → useEffectiveDirectory-CCVmwzs7.js} +1 -1
- package/dist/assets/{useFontPreferences-BiRBKhti.js → useFontPreferences-DB18Mtz6.js} +1 -1
- package/dist/assets/{useGitStore-Bv8xmXDa.js → useGitStore-Bab2zave.js} +1 -1
- package/dist/assets/{useInlineCommentDraftStore-B2mkmAZd.js → useInlineCommentDraftStore-DAYe4P_i.js} +1 -1
- package/dist/assets/useMcpConfigStore-BJm6513j.js +1 -0
- package/dist/assets/useMobileSwipeActions-D0WXnZEj.js +1 -0
- package/dist/assets/useMobileTranscriptSyncHint-CG4nKZAr.js +10 -0
- package/dist/assets/useModelLists-BimLCgIE.js +1 -0
- package/dist/assets/useOpenCodeReadiness-DXkY7-Jm.js +1 -0
- package/dist/assets/usePluginsStore-C69K4oDx.js +1 -0
- package/dist/assets/useProjectGitActions-DVpxGjd_.js +1 -0
- package/dist/assets/{useProjectGitStore-DzU2pvrH.js → useProjectGitStore-tqdyts8E.js} +1 -1
- package/dist/assets/{useProjectRuntimeAPIs-tjGuODhu.js → useProjectRuntimeAPIs-3ykZWBEc.js} +1 -1
- package/dist/assets/useQuotaStore-B3QxYEfM.js +1 -0
- package/dist/assets/{useSessionBtwStore-CwvlMabN.js → useSessionBtwStore-LV6b9oRF.js} +1 -1
- package/dist/assets/{useStreamingTextThrottle-C9SaKeil.js → useStreamingTextThrottle-ClWAbNdQ.js} +1 -1
- package/dist/assets/{useUIStore-C3ewjGgP.js → useUIStore-Dzf_W6hZ.js} +1 -1
- package/dist/assets/worktreeManager-CZpGApxy.js +1 -0
- package/dist/assets/{worktreeSourceBranchPreference-CuLKwxkx.js → worktreeSourceBranchPreference-CyrpQH5R.js} +1 -1
- package/dist/assets/{zh-CN-DOHH7nht.js → zh-CN-D9xdLrNm.js} +1 -1
- package/dist/assets/{zh-TW-t1qlXGOg.js → zh-TW-Dyiv4-Dr.js} +1 -1
- package/dist/index.html +13 -14
- package/dist/mini-chat.html +13 -14
- package/dist/mobile.html +2 -2
- package/package.json +1 -1
- package/server/index.js +1 -0
- package/server/lib/gui-customization/DOCUMENTATION.md +22 -1
- package/server/lib/gui-customization/projects-client.mjs +14 -3
- package/server/lib/gui-customization/projects-lifecycle.js +89 -0
- package/server/lib/gui-customization/projects-lifecycle.test.js +199 -0
- package/server/lib/gui-customization/projects.js +19 -3
- package/server/lib/gui-customization/projects.test.js +6 -0
- package/server/lib/gui-customization/session-skill.js +2 -2
- package/server/lib/gui-customization/session-skill.test.js +6 -0
- package/server/lib/gui-customization/skill/SKILL.md +3 -1
- package/server/lib/gui-customization/skill/references/projects.md +30 -0
- package/server/lib/opencode/feature-routes-runtime.js +5 -0
- package/server/lib/opencode/feature-routes-runtime.test.js +6 -0
- package/server/lib/opencode/settings-helpers.js +4 -0
- package/dist/assets/AgentAvatar-CHCjMxCF.js +0 -1
- package/dist/assets/AgentSelector-uBoLtut8.js +0 -1
- package/dist/assets/ArchivedSessionsDialog-DZcicxVO.js +0 -1
- package/dist/assets/AssistantConversationSurface-36aP0hRf.js +0 -3
- package/dist/assets/AssistantSessionCard-CZ-1oJiE.js +0 -2
- package/dist/assets/AssistantUnreadBadge-p9mkpbMC.js +0 -1
- package/dist/assets/AssistantView-8fyAae7J.js +0 -1
- package/dist/assets/AssistantWorkingAvatar-CoxhuMvM.js +0 -1
- package/dist/assets/AssistantsSettingsPage-DD6spbXz.js +0 -1
- package/dist/assets/BinaryFileFallback-DgYaMG9f.js +0 -1
- package/dist/assets/BtwPanel-BkobGcf3.js +0 -6
- package/dist/assets/BusyDots-COTTwItx.js +0 -4
- package/dist/assets/ChatContainer-BfQ7RXwY.js +0 -65
- package/dist/assets/ChatView-ByMRjY1h.js +0 -3
- package/dist/assets/DiffViewToggle-BwJ6MYB7.js +0 -1
- package/dist/assets/ErrorBoundary-D7QcwhmL.js +0 -1
- package/dist/assets/FadeInOnReveal-B3uT04YJ.js +0 -1
- package/dist/assets/GuiPluginPage-BPjU8N49.js +0 -1
- package/dist/assets/GuiPluginSurface-CYPH6XzX.js +0 -1
- package/dist/assets/GuiPluginTitlebarItems-DxFINwbr.js +0 -1
- package/dist/assets/Icon-DmykXZL1.js +0 -1
- package/dist/assets/ImageLoadingPlaceholder-DgM_EFHn.js +0 -1
- package/dist/assets/MarkdownRenderer-VvziwyJB.js +0 -2
- package/dist/assets/MarkstreamRendererImpl-U_m_ZKG7.js +0 -3
- package/dist/assets/MobileAssistantTab-CMIQansR.js +0 -1
- package/dist/assets/MobileChatScreen-p356_BCN.js +0 -1
- package/dist/assets/MobileDetailNavigation-ldTzGo19.js +0 -1
- package/dist/assets/MobileFilesSurface-CF3EW_SK.js +0 -2
- package/dist/assets/MobileHtmlNetworkBoundary-DlPF4iPS.js +0 -2
- package/dist/assets/MobileOverlayPanel-C36VWWmN.js +0 -1
- package/dist/assets/MobileResizableSheet-CqphcaKq.js +0 -1
- package/dist/assets/MobileSurface-cmaGf3hZ.js +0 -1
- package/dist/assets/MobileTabPageHeader-D6P4K98S.js +0 -1
- package/dist/assets/ModelLogo-BkbD514M.js +0 -1
- package/dist/assets/ModelSelector-EmtltPnd.js +0 -1
- package/dist/assets/MultiRunWindow-CeSxAB8w.js +0 -1
- package/dist/assets/OnboardingScreen-BubjTNcy.js +0 -1
- package/dist/assets/OverlayScrollbar-D6vmoMkQ.js +0 -1
- package/dist/assets/ProviderLogo-DA98yu7M.js +0 -1
- package/dist/assets/RemoteDesktopPanel-f3vRj4ZP.js +0 -1
- package/dist/assets/ScheduledTasksDialog-D_hBP47Y.js +0 -3
- package/dist/assets/ScrollableOverlay-stxT7gLf.js +0 -1
- package/dist/assets/SettingsGroup-CvaPYznp.js +0 -1
- package/dist/assets/SettingsWindow-DMVAV_el.js +0 -1
- package/dist/assets/SetupTourDialog-BlR7FJvd.js +0 -1
- package/dist/assets/TerminalView-Xcwp3SG1.js +0 -8
- package/dist/assets/TextSelectionMenu-h8iUeNzE.js +0 -11
- package/dist/assets/assistantMessagePreview-DLBvPQtq.js +0 -1
- package/dist/assets/assistantQueries-NdPqu6rx.js +0 -1
- package/dist/assets/card-DmysoUAV.js +0 -1
- package/dist/assets/chatUpwardIntent-B2NrGMm-.js +0 -1
- package/dist/assets/checkbox-BMN5hAVm.js +0 -1
- package/dist/assets/collapsible-Z0IjDAMO.js +0 -1
- package/dist/assets/context-menu-CKlB6wxo.js +0 -1
- package/dist/assets/diagram-CzY6n_4N.js +0 -1
- package/dist/assets/dialog-BeFBA6ja.js +0 -1
- package/dist/assets/dropdown-menu-BblI9sN2.js +0 -1
- package/dist/assets/gitApiHttp-Dd-FwgCq.js +0 -3
- package/dist/assets/githubAuthQueries-DqregESf.js +0 -1
- package/dist/assets/historyImportQueries-D00KjUT2.js +0 -1
- package/dist/assets/input-Cf16qJ6g.js +0 -1
- package/dist/assets/insertionBoundaries-Btqgsu1M.js +0 -1
- package/dist/assets/kbd-CamdaxHJ.js +0 -1
- package/dist/assets/main-CXH2hObl.js +0 -169
- package/dist/assets/main-ClH7cLKr.js +0 -2
- package/dist/assets/mcpQueries-Rmp1BKeo.js +0 -1
- package/dist/assets/miniChat-B_Bw6udu.js +0 -2
- package/dist/assets/mobile-BR73yoNi.js +0 -2
- package/dist/assets/mobileConnections-x07fHO_5.js +0 -2
- package/dist/assets/multirun-CKQymP08.js +0 -3
- package/dist/assets/openRemoteProjectSession-DNr74gHD.js +0 -1
- package/dist/assets/pluginPresentation-DtyC8NF2.js +0 -2
- package/dist/assets/pwa-CtDladgB.js +0 -2
- package/dist/assets/queue-abort-optimistic-DFbWDRKT.js +0 -1
- package/dist/assets/remoteProjectQueries-C8382jM8.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-DM9y9qXo.js +0 -2
- package/dist/assets/renderMobileApp-DqpPYtZI.js +0 -17
- package/dist/assets/runtime-file-resource-Bc_ss-sW.js +0 -2
- package/dist/assets/runtimeEndpointReset-C0zNrsI9.js +0 -4
- package/dist/assets/select-vZCgcnYG.js +0 -1
- package/dist/assets/session-startup-barrier-DT-hIBRf.js +0 -1
- package/dist/assets/sessionOwnership-BjhXe6pi.js +0 -2
- package/dist/assets/shortcuts-WkN3Gh8v.js +0 -1
- package/dist/assets/sortable-tabs-strip-DmtfYPz0.js +0 -1
- package/dist/assets/speechSettingsQueries-BmkXNn4w.js +0 -1
- package/dist/assets/src-QTj33Z0x.css +0 -2
- package/dist/assets/switch-CNmsFYfY.js +0 -1
- package/dist/assets/textarea-ZiXxEOHK.js +0 -1
- package/dist/assets/tooltip-CpTbxEOE.js +0 -1
- package/dist/assets/truncated-path-CcmWjgCQ.js +0 -1
- package/dist/assets/types-DpcA-uDW.js +0 -2
- package/dist/assets/ui-ee2iN869.js +0 -13
- package/dist/assets/useDesktopWindowControlsLayout-BOkRz-p9.js +0 -1
- package/dist/assets/useMcpConfigStore-DKTl0PvE.js +0 -1
- package/dist/assets/useMobileSwipeActions-XoxrtaUo.js +0 -1
- package/dist/assets/useMobileTranscriptSyncHint-DM8WG7kz.js +0 -10
- package/dist/assets/useModelLists-Bf60FIJu.js +0 -1
- package/dist/assets/useOpenCodeReadiness-Dm6BjA1T.js +0 -1
- package/dist/assets/usePluginsStore-Du4WlceO.js +0 -1
- package/dist/assets/useProjectGitActions-D3B9ma9z.js +0 -1
- package/dist/assets/useQuotaStore-CSn2pk3T.js +0 -1
- package/dist/assets/worktreeManager-DGu8M01Z.js +0 -1
- package/dist/assets/yuriEvents-BFrD5fMU.js +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,Q as n,et as r,ot as i,rt as a,st as o,tt as s}from"./vendor-base-ui-wXsskyKm.js";import{n as c}from"./vendor-react-BkccXcWz.js";import{no as l}from"./ui-Cd2-HQSa.js";import{t as u}from"./i18n-BcqhT5IQ.js";import{SettingsView as d}from"./SettingsView-cLTUC0DF.js";var f=c(),p=e(o(),1),m=i(),h=e=>{let i=(0,f.c)(19),{open:o,onOpenChange:c}=e,{t:h}=u(),_=p.useId(),v=g,y;i[0]===c?y=i[1]:(y=e=>{!e&&v()||c(e)},i[0]=c,i[1]=y);let b;i[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,m.jsx)(a,{className:l(`fixed inset-0 z-50 bg-black/50 dark:bg-black/75`,`transition-opacity duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[ending-style]:opacity-0`)}),i[2]=b):b=i[2];let x;i[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=l(`relative pointer-events-auto`,`w-[90vw] max-w-[1200px] h-[85vh] max-h-[900px]`,`rounded-xl border shadow-none overflow-hidden origin-center`,`bg-background`,`transition-all duration-150 ease-out`,`data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]`,`data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]`,`data-[nested-dialog-open]:brightness-[0.55] dark:data-[nested-dialog-open]:brightness-[0.4]`),i[3]=x):x=i[3];let S;i[4]===h?S=i[5]:(S=h(`settings.window.description`),i[4]=h,i[5]=S);let C;i[6]!==_||i[7]!==S?(C=(0,m.jsx)(s,{id:_,className:`sr-only`,children:S}),i[6]=_,i[7]=S,i[8]=C):C=i[8];let w;i[9]===c?w=i[10]:(w=(0,m.jsx)(d,{onClose:()=>c(!1),isWindowed:!0}),i[9]=c,i[10]=w);let T;i[11]!==_||i[12]!==C||i[13]!==w?(T=(0,m.jsxs)(t,{children:[b,(0,m.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center pointer-events-none`,children:(0,m.jsxs)(r,{"aria-describedby":_,className:x,children:[C,w]})})]}),i[11]=_,i[12]=C,i[13]=w,i[14]=T):T=i[14];let E;return i[15]!==o||i[16]!==y||i[17]!==T?(E=(0,m.jsx)(n,{open:o,onOpenChange:y,children:T}),i[15]=o,i[16]=y,i[17]=T,i[18]=E):E=i[18],E};function g(){return typeof document>`u`?!1:!!document.querySelector(`[data-slot="dropdown-menu-content"][data-open], [data-slot="select-content"][data-open]`)}export{h as SettingsWindow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-DEPKHgdL.js";import{ot as r,st as i}from"./vendor-base-ui-wXsskyKm.js";import{n as a}from"./vendor-react-BkccXcWz.js";import{s as o}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{q as s}from"./runtime-file-resource-C5kmYlLv.js";import{r as c}from"./vendor-reactuses-core-DjKFMfz7.js";import{Na as l,Yi as u,Yn as d,no as f}from"./ui-Cd2-HQSa.js";import{n as p}from"./Icon-CeG6IExS.js";import{t as m}from"./i18n-BcqhT5IQ.js";import{a as h,n as g,o as _,t as v}from"./dialog-CZlghHCF.js";import{n as y}from"./MarkdownRenderer-Bjm6Wld2.js";import{t as b}from"./checkbox-D9uVg1CM.js";import{t as x}from"./YuriLogo-_1Inxw8P.js";import{a as S,i as C}from"./ModelLogo-CYR-ynHM.js";import{l as w}from"./zhipuai-coding-plan-CcFj8zKy.js";import{t as T}from"./ProviderLogo-zqjvjfIK.js";import{n as E}from"./speechSettingsQueries-DXlNIuv5.js";import{n as D,t as O}from"./YuriWordmark-CW53XKgV.js";import{n as k}from"./SettingsGroup-BoEy2EFq.js";import{a as A,c as j,n as M,r as N,t as P}from"./usePluginsStore-C69K4oDx.js";import{a as F,l as I,n as ee,o as te,r as L,t as R}from"./pluginPresentation-OcngX2e8.js";import{a as z,c as ne,d as re,l as B,o as V,s as ie,t as H,u as U}from"./historyImportQueries-CZsECryv.js";var W=e(i(),1),G=a(),K=[{name:`Magpie`,spec:`opencode-magpie-plugin`},{name:`Eficy`,spec:`@eficy/opencode2-plugin`},{name:`yee-profile`,spec:`@yee94/opencode-profile`}];function ae(e,t){return e.some(e=>e.parsedKind===`npm`&&R(e.spec).name===t)}async function q(e,t){let n=[];for(let r of new Set(e)){if(!t.current())throw Error(`Runtime changed`);try{let e=await t.list();if(!t.current())throw Error(`Runtime changed`);ae(e,r)||(await t.create(r)).ok||n.push(r)}catch{n.push(r)}}if(!t.current())throw Error(`Runtime changed`);return{failed:n}}function oe(e,r,i){let a=t(),o=n();return q(e,{current:()=>!i.aborted&&o===n()&&a===t(),list:async()=>(await s.fetchQuery({...N(r,a),staleTime:0})).entries,create:e=>P.getState().createEntry({spec:e,scope:`user`})})}var J=`data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eClaude%20Code%3c/title%3e%3cpath%20clip-rule='evenodd'%20d='M20.998%2010.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6%2010.949h1.488V8.102H6v2.847zm10.51%200H18V8.102h-1.49v2.847z'%20fill='%23D97757'%20fill-rule='evenodd'/%3e%3c/svg%3e`,Y=`data:image/svg+xml,%3csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eCodex%3c/title%3e%3cpath%20d='M19.503%200H4.496A4.496%204.496%200%20000%204.496v15.007A4.496%204.496%200%20004.496%2024h15.007A4.496%204.496%200%200024%2019.503V4.496A4.496%204.496%200%200019.503%200z'%20fill='%23fff'/%3e%3cpath%20d='M9.064%203.344a4.578%204.578%200%20012.285-.312c1%20.115%201.891.54%202.673%201.275.01.01.024.017.037.021a.09.09%200%2000.043%200%204.55%204.55%200%20013.046.275l.047.022.116.057a4.581%204.581%200%20012.188%202.399c.209.51.313%201.041.315%201.595a4.24%204.24%200%2001-.134%201.223.123.123%200%2000.03.115c.594.607.988%201.33%201.183%202.17.289%201.425-.007%202.71-.887%203.854l-.136.166a4.548%204.548%200%2001-2.201%201.388.123.123%200%2000-.081.076c-.191.551-.383%201.023-.74%201.494-.9%201.187-2.222%201.846-3.711%201.838-1.187-.006-2.239-.44-3.157-1.302a.107.107%200%2000-.105-.024c-.388.125-.78.143-1.204.138a4.441%204.441%200%2001-1.945-.466%204.544%204.544%200%2001-1.61-1.335c-.152-.202-.303-.392-.414-.617a5.81%205.81%200%2001-.37-.961%204.582%204.582%200%2001-.014-2.298.124.124%200%2000.006-.056.085.085%200%2000-.027-.048%204.467%204.467%200%2001-1.034-1.651%203.896%203.896%200%2001-.251-1.192%205.189%205.189%200%2001.141-1.6c.337-1.112.982-1.985%201.933-2.618.212-.141.413-.251.601-.33.215-.089.43-.164.646-.227a.098.098%200%2000.065-.066%204.51%204.51%200%2001.829-1.615%204.535%204.535%200%20011.837-1.388zm3.482%2010.565a.637.637%200%20000%201.272h3.636a.637.637%200%20100-1.272h-3.636zM8.462%209.23a.637.637%200%2000-1.106.631l1.272%202.224-1.266%202.136a.636.636%200%20101.095.649l1.454-2.455a.636.636%200%2000.005-.64L8.462%209.23z'%20fill='url(%23codex-gradient)'/%3e%3cdefs%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20id='codex-gradient'%20x1='12'%20x2='12'%20y1='3'%20y2='21'%3e%3cstop%20stop-color='%23B1A7FF'/%3e%3cstop%20offset='.5'%20stop-color='%237A9DFF'/%3e%3cstop%20offset='1'%20stop-color='%233941FF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e`,X=r(),se={claude:J,codex:Y,cursor:S,dsh:C,opencode:w};function ce({onBusy:e,directory:r=null,onPrimaryChange:i,onComplete:a}){let{t:o,locale:s}=m(),l=t(),u=n(),[h,g]=W.useState([]),[_,v]=W.useState(!1),[y,x]=W.useState(null),S=V(),C=S.data?.state===`running`,w=ie(S.isSuccess&&!C),T=ne(w.data?.id,r,`${S.data?.id??``}:${S.data?.state??``}`,!C&&!w.isFetching&&!w.isError),E=W.useRef(null),D=W.useRef(!1),O=W.useRef(null),k=W.useRef(null),A=c(e),j=c(e=>i?.(e)),M=c((e,t)=>g(n=>t?n.includes(e)?n:[...n,e]:n.filter(t=>t!==e)));W.useEffect(()=>{let e=new AbortController;return E.current=e,()=>{e.abort(),A(!1)}},[l,u,A]);let N=W.useMemo(()=>{let e=B.map(e=>({...e,sessions:[]}));for(let t of w.data?.sessions??[]){let n=e.find(e=>e.id===t.source);n&&n.sessions.length<5&&n.sessions.push(t)}return e.filter(e=>e.sessions.length)},[w.data]),P=!!(O.current&&S.data?.id===O.current&&re(S.data)),F=_||!C&&!P&&(w.isFetching||!w.data||w.isError||S.isError);W.useEffect(()=>{j({disabled:F,background:C})},[F,C,j]);let I=()=>!E.current?.signal.aborted&&l===t()&&u===n(),ee=async e=>{if(!(D.current||!E.current)){D.current=!0,v(!0),A(!0),x(null);try{await e(E.current.signal)}catch(e){I()&&x(e instanceof Error&&/^[a-z_]+$/.test(e.message)?e.message:`import_failed`)}finally{D.current=!1,I()&&(v(!1),A(!1))}}},te=()=>ee(async e=>{if(F)return;if(C||P){I()&&a?.();return}if(!h.length){I()&&a?.();return}let t=await z(h,r,e,l,u);I()&&(O.current=t.id,k.current?.scrollIntoView({block:`start`}))}),L=w.error??S.error,R=y||(L instanceof Error&&/^[a-z_]+$/.test(L.message)?L.message:w.isError||S.isError?`import_failed`:null),G=W.useMemo(()=>new Intl.DateTimeFormat(s,{month:`short`,day:`numeric`}),[s]),K=S.data?U(S.data):null,ae=W.useMemo(()=>new Intl.NumberFormat(s),[s]),q=(e,t)=>{let n=w.data?.counts?.[e],r=n?.value;if(r==null||w.isError)return null;let i=ae.format(r),a=o(n?.approximate?`historyImport.estimatedCount`:`historyImport.sourceCount`,{count:i});return(0,X.jsx)(`span`,{id:t,"data-history-count":e,className:`yuri-import-source-count`,title:a,"aria-label":a,children:w.isFetching?(0,X.jsx)(p,{name:`loader-4`,className:`size-3 animate-spin`,"aria-label":o(`historyImport.scanning`)}):`${n?.approximate?`≈ `:``}${i}`})};return(0,X.jsxs)(`form`,{id:`yuri-tour-import`,className:`yuri-history-import`,"data-history-import":!0,onSubmit:e=>{e.preventDefault(),te()},children:[(0,X.jsx)(`h2`,{ref:k,className:`yuri-import-heading`,children:o(`historyImport.heading`)}),(0,X.jsx)(`p`,{className:`yuri-import-subtitle`,children:o(`historyImport.deduplication`)}),S.data&&!re(S.data)&&(C||O.current===S.data.id)&&(0,X.jsxs)(`div`,{className:`yuri-import-job`,role:`status`,children:[(0,X.jsx)(p,{name:C?`loader-4`:`error-warning`,className:f(`size-4`,C&&`animate-spin`)}),(0,X.jsx)(`span`,{children:o(C&&K?`historyImport.phase.${K.phase}`:`historyImport.state.${S.data.state}`)}),K&&K.total>0&&(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[K.completed,` / `,K.total]}),C&&(0,X.jsx)(d,{variant:`ghost`,size:`icon`,disabled:_,"aria-label":o(`historyImport.cancel`),title:o(`historyImport.cancel`),onClick:()=>void ee(async e=>{await H(S.data.id,e,l),I()&&await S.refetch()}),children:(0,X.jsx)(p,{name:`stop`,className:`size-4`})}),C&&K&&(0,X.jsx)(`progress`,{value:K.total?K.completed:void 0,max:K.total||1,"aria-label":o(`historyImport.progress`)}),S.data.progress?.code&&(0,X.jsxs)(`p`,{role:`alert`,children:[o(`historyImport.failed`),` `,(0,X.jsx)(`code`,{children:S.data.progress.code})]}),S.data.results.some(e=>e.status===`failed`||e.project===`failed`||e.index===`failed`)&&(0,X.jsxs)(`p`,{role:`alert`,children:[o(`historyImport.failed`),[...new Set(S.data.results.filter(e=>e.status===`failed`&&e.code).map(e=>e.code))].map(e=>(0,X.jsxs)(`code`,{children:[` `,e]},e))]})]}),(0,X.jsx)(`div`,{className:`yuri-import-source-grid`,"aria-label":o(`historyImport.sources`),children:B.map(e=>{let t=w.data?.installations?.[e.id],n=o(t===!0?`historyImport.installed`:t===!1?`historyImport.notDetected`:`historyImport.installationUnknown`),r=w.data?.counts?.[e.id]?.value!=null&&!w.isError?` history-import-count-${e.id}`:``;return(0,X.jsxs)(d,{variant:`ghost`,"data-history-source":e.id,className:f(`yuri-import-source-card`,(e.id===`cursor`||e.id===`opencode`)&&`yuri-import-source-cursor`),disabled:_||C,"aria-pressed":h.includes(e.id),"aria-label":e.name,"aria-describedby":`history-import-installed-${e.id}${r}`,onClick:()=>M(e.id,!h.includes(e.id)),children:[(0,X.jsxs)(`span`,{className:`yuri-import-logo-wrap`,children:[(0,X.jsx)(`img`,{src:se[e.id],alt:``,draggable:!1,className:`yuri-import-source-logo`}),(0,X.jsx)(`span`,{id:`history-import-installed-${e.id}`,role:`img`,"aria-label":n,title:n,"data-installed":t===!0?`true`:t===!1?`false`:`unknown`,className:`yuri-import-installation`})]}),(0,X.jsx)(`span`,{className:`yuri-import-source-name`,children:e.name}),q(e.id,`history-import-count-${e.id}`),(0,X.jsx)(`span`,{className:`yuri-import-source-check`,"aria-hidden":`true`,children:(0,X.jsx)(p,{name:`check`,className:`size-3`})})]},e.id)})}),R&&(0,X.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,X.jsxs)(`p`,{children:[o(R===`history_import_unsupported`?`historyImport.unsupported`:`historyImport.failed`),` `,(0,X.jsx)(`code`,{children:R})]}),(w.isError||S.isError)&&(0,X.jsx)(d,{variant:`ghost`,size:`xs`,disabled:w.isFetching||S.isFetching,onClick:()=>{Promise.all([w.refetch(),S.refetch()])},children:o(`settings.plugins.status.retry`)})]}),w.data&&!w.isFetching&&!w.isError&&!w.data.sessions.length&&!w.data.errors.length&&(0,X.jsx)(`p`,{className:`yuri-tour-feedback`,children:o(`historyImport.empty`)}),N.length>0&&(0,X.jsxs)(`section`,{"aria-label":o(`historyImport.sessions`),children:[(0,X.jsx)(`div`,{className:`yuri-import-list-heading`,children:o(`historyImport.sessions`)}),(0,X.jsx)(`div`,{className:`yuri-import-preview-groups`,children:N.map(e=>(0,X.jsxs)(`section`,{"aria-label":e.name,"data-source-selected":h.includes(e.id),children:[(0,X.jsxs)(`div`,{className:`yuri-import-preview-heading`,children:[(0,X.jsx)(`h3`,{children:e.name}),q(e.id),(0,X.jsx)(b,{checked:h.includes(e.id),disabled:_||C,ariaLabel:e.name,onChange:t=>M(e.id,t)})]}),(0,X.jsx)(`ul`,{className:`yuri-import-session-grid`,children:e.sessions.map(e=>(0,X.jsxs)(`li`,{"data-history-session":e.key,className:f(`yuri-import-session-card`,(e.source===`cursor`||e.source===`opencode`)&&`yuri-import-source-cursor`),title:e.title,children:[(0,X.jsx)(`img`,{src:se[e.source],alt:``,draggable:!1,className:`yuri-import-session-logo`}),(0,X.jsxs)(`span`,{className:`yuri-import-session-copy`,children:[(0,X.jsxs)(`span`,{className:`yuri-import-session-heading`,children:[(0,X.jsx)(`span`,{className:`yuri-import-session-title`,children:e.title}),!T.isError&&T.data?.states[e.key]===`imported`&&(0,X.jsx)(`span`,{className:`yuri-import-session-imported`,"data-history-imported":!0,children:o(`historyImport.alreadyImported`)}),e.updated&&e.updated>0?(0,X.jsx)(`time`,{dateTime:new Date(e.updated).toISOString(),children:G.format(e.updated)}):null]}),e.excerpt&&(0,X.jsx)(`span`,{className:`yuri-import-session-excerpt`,children:e.excerpt})]})]},e.key))})]},e.id))})]})]})}var Z=K.map(e=>e.spec),le=[`tour.models`,`tour.plugins`,`tour.import`,`tour.voice`],ue=[{id:`openai`,name:`OpenAI`},{id:`anthropic`,name:`Anthropic`},{id:`google`,name:`Google Gemini`},{id:`github-copilot`,name:`GitHub Copilot`},{id:`deepseek`,name:`DeepSeek`},{id:`openrouter`,name:`OpenRouter`}];function de(e){let t=(0,G.c)(48),{index:n,info:r,installed:i,selected:a,onSelect:o,onReadme:s}=e,{t:c}=m(),l=K[n],u=r?.kind===`npm-ok`?r:void 0,h=a&&`yuri-tour-card-selected`,g;t[0]===h?g=t[1]:(g=f(`yuri-tour-plugin yuri-tour-select-card`,h),t[0]=h,t[1]=g);let _;t[2]===a?_=t[3]:(_=a&&(0,X.jsx)(p,{name:`check`,className:`size-5`}),t[2]=a,t[3]=_);let v;t[4]===_?v=t[5]:(v=(0,X.jsx)(`span`,{className:`yuri-tour-card-check`,"aria-hidden":`true`,children:_}),t[4]=_,t[5]=v);let y;t[6]!==o||t[7]!==l.name||t[8]!==a||t[9]!==v?(y=(0,X.jsx)(d,{variant:`ghost`,className:`yuri-tour-card-toggle`,"aria-label":l.name,"aria-pressed":a,onClick:o,children:v}),t[6]=o,t[7]=l.name,t[8]=a,t[9]=v,t[10]=y):y=t[10];let b=u?.icon,x;t[11]!==l.name||t[12]!==b?(x=(0,X.jsx)(I,{name:l.name,src:b,size:30}),t[11]=l.name,t[12]=b,t[13]=x):x=t[13];let S;t[14]===l.name?S=t[15]:(S=(0,X.jsx)(`h3`,{className:`typography-ui-label font-medium`,children:l.name}),t[14]=l.name,t[15]=S);let C;t[16]===l.spec?C=t[17]:(C=(0,X.jsx)(`p`,{className:`break-all typography-micro text-muted-foreground`,children:l.spec}),t[16]=l.spec,t[17]=C);let w;t[18]!==S||t[19]!==C?(w=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[S,C]}),t[18]=S,t[19]=C,t[20]=w):w=t[20];let T;t[21]===u?T=t[22]:(T=u?.latestVersion&&(0,X.jsx)(`span`,{className:`typography-micro text-muted-foreground`,children:u.latestVersion}),t[21]=u,t[22]=T);let E;t[23]!==w||t[24]!==T||t[25]!==x?(E=(0,X.jsxs)(`div`,{className:`flex items-start gap-3 pr-10`,children:[x,w,T]}),t[23]=w,t[24]=T,t[25]=x,t[26]=E):E=t[26];let D;t[27]!==r||t[28]!==u?.description||t[29]!==c?(D=u?.description||c(r?`tour.metadataUnavailable`:`common.loading`),t[27]=r,t[28]=u?.description,t[29]=c,t[30]=D):D=t[30];let O;t[31]===D?O=t[32]:(O=(0,X.jsx)(`p`,{className:`flex-1 typography-meta text-muted-foreground`,children:D}),t[31]=D,t[32]=O);let k=!u,A;t[33]!==s||t[34]!==k?(A=(0,X.jsx)(d,{size:`xs`,variant:`ghost`,className:`yuri-tour-card-link`,disabled:k,onClick:s,children:`README`}),t[33]=s,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==i||t[37]!==c?(j=i&&(0,X.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:c(`tour.saved`)}),t[36]=i,t[37]=c,t[38]=j):j=t[38];let M;t[39]!==A||t[40]!==j?(M=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[A,j]}),t[39]=A,t[40]=j,t[41]=M):M=t[41];let N;return t[42]!==E||t[43]!==O||t[44]!==M||t[45]!==g||t[46]!==y?(N=(0,X.jsxs)(`section`,{className:g,children:[y,E,O,M]}),t[42]=E,t[43]=O,t[44]=M,t[45]=g,t[46]=y,t[47]=N):N=t[47],N}function fe(e){let t=(0,G.c)(28),{settings:n,onComplete:r,onBusy:i}=e,{t:a}=m(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={voiceProvider:`volcengine`,sttProvider:`volcengine`,dictationEnabled:!0,showMessageTTSButtons:!0},t[0]=o):o=t[0];let s=L(n,o),l=c(i),u,d;t[1]!==s.saving||t[2]!==l?(u=()=>(l(s.saving),()=>l(!1)),d=[s.saving,l],t[1]=s.saving,t[2]=l,t[3]=u,t[4]=d):(u=t[3],d=t[4]),W.useEffect(u,d);let f;t[5]!==s||t[6]!==r||t[7]!==n.configured?(f=async e=>{e.preventDefault(),!(!n.configured&&!s.draft.apiKey?.trim())&&(await s.save())?.configured&&r()},t[5]=s,t[6]=r,t[7]=n.configured,t[8]=f):f=t[8];let p=f,h;t[9]===p?h=t[10]:(h=e=>void p(e),t[9]=p,t[10]=h);let g;t[11]===a?g=t[12]:(g=a(`settings.voice.volcengine.name`),t[11]=a,t[12]=g);let _,v;t[13]===s?(_=t[14],v=t[15]):(_=(0,X.jsx)(F,{mode:`tts`,form:s}),v=(0,X.jsx)(F,{mode:`asr`,form:s,showCredentials:!1}),t[13]=s,t[14]=_,t[15]=v);let y;t[16]!==g||t[17]!==_||t[18]!==v?(y=(0,X.jsxs)(k,{label:g,children:[_,v]}),t[16]=g,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==s.draft||t[21]!==n.configured||t[22]!==a?(b=!n.configured&&!s.draft.apiKey?.trim()&&(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:a(`settings.providers.page.toast.apiKeyRequired`)}),t[20]=s.draft,t[21]=n.configured,t[22]=a,t[23]=b):b=t[23];let x;return t[24]!==b||t[25]!==h||t[26]!==y?(x=(0,X.jsxs)(`form`,{id:`yuri-tour-voice`,onSubmit:h,className:`yuri-settings-section-stack`,children:[y,b]}),t[24]=b,t[25]=h,t[26]=y,t[27]=x):x=t[27],x}function pe({runtime:e,onClose:r}){let{t:i}=m(),a=A(),c=D(t=>t.progress[e]?.step??0),[b,S]=W.useState(`magpie`),[C,w]=W.useState(),[k,N]=W.useState(Z.slice(1)),[P,F]=W.useState(`tour`),[I,L]=W.useState(null),[R,z]=W.useState(!1),[ne,re]=W.useState({disabled:!0}),[B,V]=W.useState(null),ie=n(),H=t(),U=W.useRef(null),G=W.useRef(!1);W.useEffect(()=>{let e=new AbortController;return U.current=e,()=>e.abort()},[]);let q=j(),J=o({...M(a,Z.slice(1),!1,H,!0),enabled:c===1}),Y=o({...E(H),enabled:c===3}),se=q.data?.entries??[],pe=e=>{let t=u.getState(),n=e&&t.providers.some(t=>t.id===e);S(`other`),w(n?void 0:e),t.setSelectedProvider(n?e:`__add_provider__`),F(`providers`)},Q=()=>!U.current?.signal.aborted&&ie===n()&&H===t(),$=t=>{F(`tour`),V(null),D.getState().move(e,t)},me=()=>{Q()&&r()},he=()=>{c===3?me():$(c+1)},ge=async()=>{if(c===2){he();return}if(!(G.current||R||!U.current)){G.current=!0,z(!0),V(null);try{let e=c===0?b===`magpie`?[Z[0]]:[]:k;if(e.length){let t=await oe(e,a,U.current.signal);if(!Q())return;if(t.failed.length){V(i(`tour.saveFailed`,{names:t.failed.join(`, `)}));return}}if(c===0&&b===`other`){let e=await s.fetchQuery({...l(a,H),staleTime:0});if(!Q())return;if(e.partial||!e.providers.some(e=>Object.keys(e.models).length>0)){V(i(`tour.noModels`));return}await u.getState().loadProviders({directory:a,forceRefresh:!0,source:`setup-tour`})}Q()&&he()}catch{Q()&&V(i(`tour.operationFailed`))}finally{G.current=!1,Q()&&z(!1)}}},_e=()=>{I===null?P===`tour`?c>0&&$(c-1):F(`tour`):L(null)},ve=I===null?void 0:J.data?.[Z[I]],ye=ve?.kind===`npm-ok`?ve.readme:void 0;return(0,X.jsx)(v,{open:!0,onOpenChange:e=>{!e&&!R&&(I!==null||P!==`tour`?_e():me())},children:(0,X.jsxs)(g,{className:`yuri-setup-tour yuri-settings-workspace`,showCloseButton:!1,"aria-describedby":void 0,children:[(0,X.jsx)(`div`,{className:`yuri-tour-watermark`,"aria-hidden":`true`,children:(0,X.jsx)(x,{width:440,height:440})}),(0,X.jsx)(h,{children:(0,X.jsxs)(_,{className:`yuri-tour-title`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`👋`}),i(`tour.title`).split(`Yuri`).map((e,t)=>(0,X.jsxs)(W.Fragment,{children:[t>0&&(0,X.jsx)(O,{width:`2.05em`}),(0,X.jsx)(`span`,{children:e.trim()})]},t))]})}),(0,X.jsxs)(`div`,{className:`yuri-tour-body`,children:[(0,X.jsx)(`nav`,{className:`yuri-tour-progress`,"aria-label":i(`tour.title`),children:le.map((e,t)=>(0,X.jsxs)(d,{variant:`ghost`,size:`lg`,disabled:R,"aria-current":c===t?`step`:void 0,onClick:()=>{L(null),$(t)},children:[(0,X.jsx)(`span`,{className:`yuri-tour-number`,"aria-hidden":`true`,children:String(t+1).padStart(2,`0`)}),(0,X.jsx)(`span`,{children:i(e)})]},e))}),(0,X.jsx)(`div`,{className:f(`yuri-tour-content`,P===`providers`&&I===null&&`yuri-tour-provider-content`),children:(0,X.jsxs)(`fieldset`,{disabled:R,className:`contents`,children:[I===null?P===`providers`?(0,X.jsx)(te,{initialConnectionId:C}):P===`voice`&&Y.data?(0,X.jsx)(fe,{settings:Y.data,onComplete:me,onBusy:z}):P===`asr`||P===`tts`?(0,X.jsx)(ee,{section:P}):(0,X.jsxs)(X.Fragment,{children:[c<2&&(c===1&&J.isError||q.isError)&&(0,X.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,X.jsx)(`p`,{children:i(`tour.metadataUnavailable`)}),(0,X.jsx)(d,{size:`xs`,onClick:()=>{c===1&&J.refetch(),q.refetch()},children:i(`settings.plugins.status.retry`)})]}),c===0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`section`,{className:f(`yuri-tour-magpie yuri-tour-select-card`,b===`magpie`&&`yuri-tour-card-selected`),children:[(0,X.jsx)(d,{variant:`ghost`,className:`yuri-tour-card-toggle`,"aria-label":`Magpie`,"aria-pressed":b===`magpie`,onClick:()=>S(b===`magpie`?`other`:`magpie`),children:(0,X.jsx)(`span`,{className:`yuri-tour-card-check`,"aria-hidden":`true`,children:b===`magpie`&&(0,X.jsx)(p,{name:`check`,className:`size-5`})})}),(0,X.jsxs)(`div`,{className:`flex w-full items-center gap-3 pr-10`,children:[(0,X.jsx)(T,{providerId:`magpie`,alt:`Magpie`,className:`size-8 shrink-0`}),(0,X.jsx)(`span`,{className:`typography-ui-label`,children:`Magpie`}),(0,X.jsx)(`span`,{className:`yuri-tour-recommended`,children:i(`tour.recommended`)})]}),(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:i(`tour.magpieDescription`)}),(0,X.jsxs)(`a`,{className:`yuri-tour-card-link typography-meta text-muted-foreground underline`,href:`https://usemagpie.ai/docs/start`,target:`_blank`,rel:`noreferrer`,children:[i(`tour.docs`),` ↗`]})]}),(0,X.jsxs)(`div`,{className:`yuri-tour-provider-heading`,children:[(0,X.jsx)(`span`,{className:`typography-meta text-muted-foreground`,children:`OpenCode`}),(0,X.jsxs)(`a`,{className:`typography-meta text-muted-foreground underline`,href:`https://opencode.ai/docs/providers/`,target:`_blank`,rel:`noreferrer`,children:[i(`tour.docs`),` ↗`]})]}),(0,X.jsx)(`div`,{className:`yuri-tour-provider-grid`,children:ue.map(e=>(0,X.jsxs)(d,{variant:`ghost`,className:`yuri-tour-provider-choice`,onClick:()=>pe(e.id),children:[(0,X.jsx)(T,{providerId:e.id,alt:e.name,className:`size-6 shrink-0`}),(0,X.jsx)(`span`,{children:e.name})]},e.id))}),(0,X.jsxs)(d,{className:`mt-3`,size:`sm`,variant:`ghost`,onClick:()=>pe(),children:[i(`tour.otherProvider`),(0,X.jsx)(p,{name:`arrow-right-s`,className:`size-4`})]})]}),c===1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`yuri-tour-plugins`,children:[1,2].map(e=>(0,X.jsx)(de,{index:e,info:J.data?.[Z[e]],installed:ae(se,Z[e]),selected:k.includes(Z[e]),onSelect:()=>N(t=>t.includes(Z[e])?t.filter(t=>t!==Z[e]):[...t,Z[e]]),onReadme:()=>L(e)},e))}),(0,X.jsxs)(`a`,{className:`mt-4 inline-block typography-meta text-muted-foreground underline underline-offset-4 hover:text-foreground`,href:`https://opencode.ai/docs/ecosystem/#plugins`,target:`_blank`,rel:`noopener noreferrer`,children:[i(`tour.morePlugins`),` ↗`]})]}),c===2&&(0,X.jsx)(ce,{onBusy:z,directory:a,onPrimaryChange:re,onComplete:()=>$(3)}),c===3&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`yuri-tour-voice-intro`,children:[(0,X.jsx)(`h2`,{children:i(`tour.voiceHeading`)}),(0,X.jsx)(`p`,{children:i(`tour.voiceIntro`)})]}),(0,X.jsxs)(`div`,{className:`yuri-tour-voice-capabilities`,children:[(0,X.jsxs)(`section`,{children:[(0,X.jsx)(p,{name:`mic`,className:`yuri-tour-voice-icon`}),(0,X.jsx)(`h3`,{children:i(`settings.voice.page.section.speechRecognition`)}),(0,X.jsx)(`p`,{children:i(`tour.dictationDescription`)}),(0,X.jsxs)(`div`,{className:`yuri-tour-voice-services`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-4`}),i(`settings.voice.volcengine.name`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(p,{name:`computer`}),i(`settings.voice.page.provider.local`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(p,{name:`server`}),i(`settings.voice.page.provider.server`)]})]}),(0,X.jsxs)(d,{size:`sm`,onClick:()=>F(`asr`),children:[i(`tour.configureInput`),(0,X.jsx)(p,{name:`arrow-right-s`,className:`size-4`})]})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(p,{name:`volume-up`,className:`yuri-tour-voice-icon`}),(0,X.jsx)(`h3`,{children:i(`tour.readAloudTitle`)}),(0,X.jsx)(`p`,{children:i(`tour.readAloudDescription`)}),(0,X.jsxs)(`div`,{className:`yuri-tour-voice-services`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-4`}),i(`settings.voice.volcengine.name`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(T,{providerId:`openai`,alt:`OpenAI`,className:`size-4`}),`OpenAI`]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(p,{name:`computer`}),i(`settings.voice.page.provider.browser`)]}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(p,{name:`cloud`}),i(`settings.voice.page.provider.custom`)]})]}),(0,X.jsxs)(d,{size:`sm`,onClick:()=>F(`tts`),children:[i(`tour.configureReadAloud`),(0,X.jsx)(p,{name:`arrow-right-s`,className:`size-4`})]})]})]}),(0,X.jsxs)(`section`,{className:`yuri-tour-voice-recommendation`,children:[(0,X.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20height='24'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='24'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDoubao%3c/title%3e%3cpath%20d='M5.31%2015.756c.172-3.75%201.883-5.999%202.549-6.739-3.26%202.058-5.425%205.658-6.358%208.308v1.12C1.501%2021.513%204.226%2024%207.59%2024a6.59%206.59%200%20002.2-.375c.353-.12.7-.248%201.039-.378.913-.899%201.65-1.91%202.243-2.992-4.877%202.431-7.974.072-7.763-4.5l.002.001z'%20fill='%231E37FC'%3e%3c/path%3e%3cpath%20d='M22.57%2010.283c-1.212-.901-4.109-2.404-7.397-2.8.295%203.792.093%208.766-2.1%2012.773a12.782%2012.782%200%2001-2.244%202.992c3.764-1.448%206.746-3.457%208.596-5.219%202.82-2.683%203.353-5.178%203.361-6.66a2.737%202.737%200%2000-.216-1.084v-.002z'%20fill='%2337E1BE'%3e%3c/path%3e%3cpath%20d='M14.303%201.867C12.955.7%2011.248%200%209.39%200%207.532%200%205.883.677%204.545%201.807%202.791%203.29%201.627%205.557%201.5%208.125v9.201c.932-2.65%203.097-6.25%206.357-8.307.5-.318%201.025-.595%201.569-.829%201.883-.801%203.878-.932%205.746-.706-.222-2.83-.718-5.002-.87-5.617h.001z'%20fill='%23A569FF'%3e%3c/path%3e%3cpath%20d='M17.305%204.961a199.47%20199.47%200%2001-1.08-1.094c-.202-.213-.398-.419-.586-.622l-1.333-1.378c.151.615.648%202.786.869%205.617%203.288.395%206.185%201.898%207.396%202.8-1.306-1.275-3.475-3.487-5.266-5.323z'%20fill='%231E37FC'%3e%3c/path%3e%3c/svg%3e`,alt:``,className:`size-6 shrink-0`}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{children:i(`settings.voice.volcengine.name`)}),(0,X.jsx)(`span`,{className:`yuri-tour-recommended`,children:i(`tour.recommended`)})]}),(0,X.jsx)(`p`,{children:i(`tour.voiceAllowance`)})]}),(0,X.jsx)(d,{disabled:!Y.data,size:`sm`,onClick:()=>F(`voice`),children:i(`tour.configureVoice`)})]}),Y.isError&&(0,X.jsxs)(`div`,{role:`alert`,className:`yuri-tour-feedback`,children:[(0,X.jsx)(`p`,{children:i(`settings.voice.volcengine.loadFailed`)}),(0,X.jsx)(d,{size:`xs`,onClick:()=>void Y.refetch(),children:i(`settings.voice.volcengine.retry`)})]})]})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`h3`,{className:`typography-ui-label mb-4`,children:[K[I].name,` · README`]}),ye?(0,X.jsx)(y,{content:ye,enableFileReferences:!1}):(0,X.jsx)(`p`,{className:`typography-meta text-muted-foreground`,children:i(`tour.metadataUnavailable`)})]}),B&&I===null&&(0,X.jsx)(`p`,{role:`alert`,className:`yuri-tour-feedback`,children:B})]})})]}),(0,X.jsxs)(`footer`,{className:`yuri-tour-footer`,children:[(P!==`tour`||I!==null)&&(0,X.jsx)(d,{variant:`ghost`,size:`sm`,disabled:R,onClick:_e,children:i(`onboarding.common.actions.back`)}),I===null&&(0,X.jsxs)(`div`,{className:`ml-auto flex flex-wrap justify-end gap-2`,children:[(0,X.jsx)(d,{variant:`ghost`,size:`sm`,disabled:R,onClick:he,children:i(`tour.later`)}),c===2?(0,X.jsxs)(d,{size:`sm`,type:`submit`,form:`yuri-tour-import`,disabled:R||ne.disabled,"aria-busy":R,children:[R&&(0,X.jsx)(p,{name:`loader-4`,className:`size-3 animate-spin`}),i(ne.background?`historyImport.background`:`historyImport.next`)]}):c===3?(0,X.jsx)(d,{size:`sm`,disabled:R,type:P===`voice`?`submit`:`button`,form:P===`voice`?`yuri-tour-voice`:void 0,onClick:P===`voice`?void 0:me,children:i(P===`voice`?`settings.common.actions.saveChanges`:`tour.finish`)}):(0,X.jsxs)(d,{size:`sm`,disabled:R||c<2&&(!q.data||q.isError),"aria-busy":R,onClick:()=>void ge(),children:[R&&(0,X.jsx)(p,{name:`loader-4`,className:`size-3 animate-spin`}),i(`tour.continue`)]})]})]})]})})}export{pe as SetupTourDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-hePW80VL.js";import{ot as e,st as t}from"./vendor-base-ui-wXsskyKm.js";import{n}from"./vendor-react-BkccXcWz.js";import{n as r}from"./Icon-
|
|
1
|
+
import"./rolldown-runtime-hePW80VL.js";import{ot as e,st as t}from"./vendor-base-ui-wXsskyKm.js";import{n}from"./vendor-react-BkccXcWz.js";import{n as r}from"./Icon-CeG6IExS.js";import{t as i}from"./i18n-BcqhT5IQ.js";import{i as a,n as o,t as s}from"./tooltip-mPnbOruE.js";var c=n();t();var l=e(),u=e=>{let t=(0,c.c)(38),{syncAction:n,remotes:u,onSync:d,disabled:f,aheadCount:p,behindCount:m,trackingRemoteName:h,hasUncommittedChanges:g}=e,_;t[0]===u?_=t[1]:(_=u===void 0?[]:u,t[0]=u,t[1]=_);let v=_,y=p===void 0?0:p,b=m===void 0?0:m,x=g!==void 0&&g,{t:S}=i(),C;t[2]!==v||t[3]!==h?(C=v.find(e=>e.name===h)??v[0],t[2]=v,t[3]=h,t[4]=C):C=t[4];let w=C,T=b>0&&x,E=f||n!==null||!w||T,D=y>0||b>0,O;t[5]!==y||t[6]!==b||t[7]!==T||t[8]!==D||t[9]!==S||t[10]!==w?(O=T?S(`gitView.sync.commitOrStashTooltip`):w?D?S(`gitView.sync.syncChangesTooltip`,{ahead:y,behind:b}):S(`gitView.sync.syncChanges`):S(`gitView.sync.noRemoteTooltip`),t[5]=y,t[6]=b,t[7]=T,t[8]=D,t[9]=S,t[10]=w,t[11]=O):O=t[11];let k=O,A;t[12]!==d||t[13]!==w?(A=()=>{w&&d(w)},t[12]=d,t[13]=w,t[14]=A):A=t[14];let j=A,M=D?0:void 0,N;t[15]!==y||t[16]!==b||t[17]!==D||t[18]!==S?(N=D?S(`gitView.sync.syncChangesTooltip`,{ahead:y,behind:b}):S(`gitView.sync.syncChanges`),t[15]=y,t[16]=b,t[17]=D,t[18]=S,t[19]=N):N=t[19];let P;t[20]===n?P=t[21]:(P=n===`sync`?(0,l.jsx)(r,{name:`loader-4`,className:`size-3.5 animate-spin`}):(0,l.jsx)(r,{name:`refresh`,className:`size-3.5`}),t[20]=n,t[21]=P);let F;t[22]===D?F=t[23]:(F=D?(0,l.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -right-0.5 top-0 size-1 rounded-full bg-[var(--status-error)] ring-1 ring-[var(--surface-background)]`}):null,t[22]=D,t[23]=F);let I;t[24]!==P||t[25]!==F?(I=(0,l.jsxs)(`span`,{className:`relative flex size-3.5 shrink-0`,children:[P,F]}),t[24]=P,t[25]=F,t[26]=I):I=t[26];let L;t[27]!==j||t[28]!==E||t[29]!==N||t[30]!==I?(L=(0,l.jsx)(a,{asChild:!0,children:(0,l.jsx)(`button`,{type:`button`,onClick:j,disabled:E,className:`inline-flex h-6 w-fit shrink-0 items-center justify-center gap-1 rounded px-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":N,children:I})}),t[27]=j,t[28]=E,t[29]=N,t[30]=I,t[31]=L):L=t[31];let R;t[32]===k?R=t[33]:(R=(0,l.jsx)(o,{side:`bottom`,sideOffset:8,children:k}),t[32]=k,t[33]=R);let z;return t[34]!==L||t[35]!==R||t[36]!==M?(z=(0,l.jsxs)(s,{delayDuration:M,children:[L,R]}),t[34]=L,t[35]=R,t[36]=M,t[37]=z):z=t[37],z};export{u as t};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t}from"./runtime-fetch-V-iMWR8t.js";import{F as n,s as r}from"./platform-CiUKDeXd.js";import{it as i,ot as a,st as o}from"./vendor-base-ui-wXsskyKm.js";import{f as s,p as c,r as l}from"./useUIStore-Dzf_W6hZ.js";import{s as u}from"./terminalApi-2TIqWX2z.js";import{n as d,r as f,t as ee}from"./vendor-ghostty-web-DbBrwBII.js";import{Yn as p,f as m,no as h,to as g}from"./ui-Cd2-HQSa.js";import{n as _}from"./Icon-CeG6IExS.js";import{t as v}from"./i18n-BcqhT5IQ.js";import{t as y}from"./OverlayScrollbar-C5v7GRZi.js";import{n as b}from"./useThemeSystem-BIXghnHj.js";import{r as te}from"./device-EIfSfSWk.js";import{n as x}from"./useEffectiveDirectory-CCVmwzs7.js";import{n as ne}from"./useProjectRuntimeAPIs-3ykZWBEc.js";import{t as re}from"./sortable-tabs-strip-DiIB2-kp.js";import{n as S,t as C}from"./useFontPreferences-DB18Mtz6.js";import{t as ie}from"./project-preview-BcLPKzwg.js";import{n as ae}from"./projectActions-BPmI9_mW.js";var w=e(o(),1);function oe(e){let{colors:t}=e,n=t.syntax.base;return{background:t.surface.background,foreground:n.foreground,cursor:t.interactive.cursor,cursorAccent:t.surface.background,selectionBackground:t.interactive.selection,selectionForeground:t.interactive.selectionForeground,selectionInactiveBackground:t.interactive.selection+`50`,black:t.surface.muted,red:t.status.error,green:t.status.success,yellow:t.status.warning,blue:n.function,magenta:n.keyword,cyan:n.type,white:n.foreground,brightBlack:n.comment,brightRed:t.status.error,brightGreen:t.status.success,brightYellow:t.status.warning,brightBlue:n.function,brightMagenta:n.keyword,brightCyan:n.type,brightWhite:t.surface.elevatedForeground}}function se(e,t,n,r,i=!1){return{cursorBlink:!1,cursorStyle:`bar`,fontSize:t,lineHeight:1.15,fontFamily:`${e}, "JetBrainsMonoNL Nerd Font", "FiraCode Nerd Font", "Cascadia Code PL", "Fira Code", "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "Courier New", monospace`,allowTransparency:!1,theme:{background:n.background,foreground:n.foreground,cursor:n.cursor,cursorAccent:n.cursorAccent,selectionBackground:n.selectionBackground,selectionForeground:n.selectionForeground,black:n.black,red:n.red,green:n.green,yellow:n.yellow,blue:n.blue,magenta:n.magenta,cyan:n.cyan,white:n.white,brightBlack:n.brightBlack,brightRed:n.brightRed,brightGreen:n.brightGreen,brightYellow:n.brightYellow,brightBlue:n.brightBlue,brightMagenta:n.brightMagenta,brightCyan:n.brightCyan,brightWhite:n.brightWhite},scrollback:1e4,ghostty:r,disableStdin:i}}var ce=e(i(),1),T=a(),E=null;function D(){return E||=f.load(),E}function O(e){if(typeof window>`u`)return null;let t=[e,...Array.from(e.querySelectorAll(`*`))],n=null;for(let e of t){let t=window.getComputedStyle(e).overflowY;if(t===`auto`||t===`scroll`){if(e.scrollHeight-e.clientHeight>2)return e;n||=e}}return n}var k=w.forwardRef(({sessionKey:e,chunks:t,onInput:n,onResize:r,theme:i,fontFamily:a,fontSize:o,className:s,enableTouchScroll:c,autoFocus:l=!0,isVisible:u=!0},f)=>{let{t:p}=v(),m=w.useRef(null),_=w.useRef(null),b=w.useRef(null),te=w.useRef(null),x=w.useRef(n),ne=w.useRef(r),re=w.useRef(null),S=w.useRef(``),C=w.useRef(null),ie=w.useRef(!1),ae=w.useRef(null),oe=w.useRef(!0),E=w.useRef(null),k=w.useRef(null),le=w.useRef(0),ue=w.useRef(null),de=w.useRef(null),A=w.useRef(!1),j=w.useRef(!1),M=w.useRef(null),N=w.useRef(null),fe=w.useRef(null),pe=w.useRef(``),me=w.useRef(null),P=w.useRef(!c),he=w.useRef(u),[,ge]=w.useReducer(e=>e+1,0),[_e,ve]=w.useReducer(e=>e+1,0);x.current=n,ne.current=r;let ye=typeof navigator<`u`&&(/Android/i.test(navigator.userAgent)||navigator.userAgentData?.platform===`Android`),F=!!c;w.useEffect(()=>{if(!c){P.current=!0,he.current=u;return}!he.current&&u&&(P.current=!1),he.current=u},[c,u]);let be=w.useCallback(()=>{if(!F)return;let e=m.current,t=ue.current;if(!e)return;let n=[];e.getAttribute(`contenteditable`)===`true`&&n.push(e),n.push(...Array.from(e.querySelectorAll(`[contenteditable="true"]`))),n.forEach(e=>{e.setAttribute(`data-terminal-disabled-contenteditable`,`true`),e.setAttribute(`contenteditable`,`false`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,e.style.setProperty(`caret-color`,`transparent`),e.style.color=`transparent`,e.style.setProperty(`-webkit-text-fill-color`,`transparent`),e.style.background=`transparent`,e.style.outline=`none`,e.style.boxShadow=`none`,e.style.textShadow=`none`,e.style.setProperty(`user-select`,`none`),e.style.setProperty(`-webkit-user-select`,`none`)}),e.tabIndex=-1,e.removeAttribute(`role`),e.removeAttribute(`aria-multiline`),Array.from(e.querySelectorAll(`textarea`)).forEach(e=>{e.style.setProperty(`caret-color`,`transparent`),e.style.color=`transparent`,e.style.setProperty(`-webkit-text-fill-color`,`transparent`),e.style.background=`transparent`,e.style.border=`0`,e.style.outline=`none`,e.style.boxShadow=`none`,e.style.textShadow=`none`,e.style.fontSize=`0`,e.style.lineHeight=`0`,e!==t&&e.getAttribute(`data-terminal-disabled-input`)!==`true`&&(e.setAttribute(`data-terminal-disabled-input`,`true`),e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,e.disabled=!0,e.style.position=`absolute`,e.style.opacity=`0`,e.style.width=`0px`,e.style.height=`0px`,e.style.pointerEvents=`none`,e.style.zIndex=`-1`)})},[F]),I=w.useCallback(e=>{if(me.current===e)return;let t=b.current;if(t)try{if(typeof t.setOption==`function`){t.setOption(`cursorBlink`,e),me.current=e;return}t.options&&(t.options.cursorBlink=e,me.current=e)}catch{}},[]),L=F&&ye,R=w.useCallback((e,t)=>{let n=L?de.current:ue.current,r=m.current;if(!n||!r)return;let i=r.getBoundingClientRect(),a=typeof window<`u`?window.innerWidth:i.width,o=typeof window<`u`?window.innerHeight:i.height,s=i.left+i.width/2,c=i.top+i.height-12,l=typeof e==`number`?e:s,u=typeof t==`number`?t:c,d=Math.max(8,Math.min(a-8,l)),f=Math.max(8,Math.min(o-8,u));n.style.left=`${d}px`,n.style.top=`${f}px`,n.style.bottom=``,(n instanceof HTMLTextAreaElement||n instanceof HTMLInputElement)&&(n.disabled=!1,n.readOnly=!1,n.removeAttribute(`disabled`),n.removeAttribute(`readonly`));try{n.focus({preventScroll:!0})}catch{try{n.focus()}catch{}}},[L]),z=w.useCallback(()=>{if(F){R(),I(!0);return}b.current?.focus(),I(!0)},[R,I,F]),B=w.useCallback(e=>e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement?e.value:e.textContent??``,[]),V=w.useCallback(e=>{if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){e.value=``;return}e.textContent=``},[]),xe=w.useCallback(e=>{if(typeof window>`u`||L)return;fe.current!==null&&(window.clearTimeout(fe.current),fe.current=null);let t=0,n=()=>{fe.current=window.setTimeout(()=>{fe.current=null;let r=B(e);if(!r){if(t+=1,t<3){n();return}return}let i=pe.current;pe.current=r;let a=r.startsWith(i)?r.slice(i.length):r;a&&x.current(a.replace(/\r\n|\r|\n/g,`\r`)),V(e),pe.current=``},t===0?0:24)};n()},[V,B,L]);w.useEffect(()=>{let e=m.current;if(!F||!e||c)return;let t=t=>{let n=t.target;if(n&&n.getAttribute(`data-terminal-hidden-input`)!==`true`&&e.contains(n)){try{n.blur()}catch{}R()}};return e.addEventListener(`focusin`,t,!0),()=>{e.removeEventListener(`focusin`,t,!0)}},[c,F,R]);let Se=w.useCallback(()=>{let e=b.current;if(!e||typeof e.getSelection!=`function`)return``;let t=e.getSelection();return typeof t==`string`?t:``},[]),H=w.useCallback(()=>{if(typeof window>`u`)return``;let e=window.getSelection();if(!e)return``;let t=e.toString();if(!t.trim())return``;let n=m.current;if(!n)return``;let r=e.anchorNode,i=e.focusNode;return r&&!n.contains(r)||i&&!n.contains(i)?``:t},[]),U=w.useCallback(async()=>{if(typeof document>`u`)return;let e=Se()||H();e.trim()&&await g(e)},[H,Se]),W=w.useCallback(()=>Se().trim()?!0:!!H().trim(),[H,Se]);w.useEffect(()=>{if(typeof window>`u`)return;let e=e=>{W()&&(e.preventDefault(),U())};return window.addEventListener(`yuri:copy`,e),()=>{window.removeEventListener(`yuri:copy`,e)}},[U,W]);let G=w.useCallback(()=>{S.current=``,C.current!==null&&typeof window<`u`&&window.cancelAnimationFrame(C.current),C.current=null,ie.current=!1,ae.current=null},[]),K=w.useCallback(()=>{let e=te.current,t=b.current,n=m.current;if(!e||!t||!n)return;let r=n.getBoundingClientRect();if(!(r.width<24||r.height<24))try{e.fit();let n={cols:t.cols,rows:t.rows},r=re.current;(!r||r.cols!==n.cols||r.rows!==n.rows)&&(re.current=n,ne.current(n.cols,n.rows))}catch{}},[]),Ce=w.useCallback(()=>{if(ie.current)return;let e=b.current;if(!e){G();return}if(!S.current)return;let t=S.current;S.current=``,ie.current=!0,e.write(t,()=>{ie.current=!1,S.current&&(typeof window<`u`?C.current=window.requestAnimationFrame(()=>{C.current=null,Ce()}):Ce())})},[G]),we=w.useCallback(()=>{C.current===null&&(typeof window<`u`?C.current=window.requestAnimationFrame(()=>{C.current=null,Ce()}):Ce())},[Ce]),Te=w.useCallback(e=>{e&&(S.current+=e,we())},[we]),Ee=w.useCallback(()=>{if(E.current?.(),E.current=null,k.current!==null&&typeof window<`u`&&(window.clearTimeout(k.current),k.current=null),!c){le.current=0;return}let e=m.current;if(!e)return;let t=b.current;if(!t)return;le.current=0;let n=2.2,r=2.8,i=.25,a=.05,s=.015,l={lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1},u=()=>typeof performance<`u`?performance.now():Date.now(),d=Math.max(12,Math.round(o*1.35)),f=0,ee=e=>{if(!e)return!1;let n=t.getViewportY(),r=f+e,i=Math.trunc(r/d);return f=r-i*d,i!==0&&t.scrollLines(i),t.getViewportY()!==n},p=()=>{l.rafId!==null&&typeof window<`u`&&window.cancelAnimationFrame(l.rafId),l.rafId=null},h={passive:!1,capture:!1};if(typeof window<`u`&&`PointerEvent`in window){let t=Object.assign(l,{pointerId:null,startX:null,startY:null,moved:!1}),o=n=>{if(n.pointerType===`touch`){p(),t.pointerId=n.pointerId,t.startX=n.clientX,t.startY=n.clientY,t.moved=!1,t.lastY=n.clientY,t.lastTime=u(),t.velocity=0;try{e.setPointerCapture(n.pointerId)}catch{}}},d=e=>{if(e.pointerType!==`touch`||t.pointerId!==e.pointerId)return;if(t.startX!==null&&t.startY!==null&&!t.moved){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>=6&&(t.moved=!0)}if(t.lastY===null){t.lastY=e.clientY,t.lastTime=u();return}let a=t.lastY,o=t.lastTime??u(),s=u();t.lastY=e.clientY,t.lastTime=s;let c=a-e.clientY;if(Math.abs(c)<1)return;let l=Math.max(s-o,8),d=c*(n+Math.min(r,Math.abs(c)/25)),f=d/l;t.velocity=t.velocity*.75+f*i,t.velocity>8?t.velocity=8:t.velocity<-8&&(t.velocity=-8),t.moved&&(e.cancelable&&e.preventDefault(),e.stopPropagation()),ee(d)},f=n=>{if(n.pointerType!==`touch`||t.pointerId!==n.pointerId)return;let r=!t.moved;t.pointerId=null,t.startX=null,t.startY=null,t.moved=!1,t.lastY=null,t.lastTime=null;try{e.releasePointerCapture(n.pointerId)}catch{}if(r){F?R(n.clientX,n.clientY):c&&!P.current&&(P.current=!0,b.current?.focus());return}if(typeof window>`u`)return;if(Math.abs(t.velocity)<a){t.velocity=0;return}let i=u(),o=()=>{let e=u(),n=Math.max(e-i,8);i=e;let r=ee(t.velocity*n)??!1,c=Math.sign(t.velocity),l=Math.max(0,Math.abs(t.velocity)-s*n);if(t.velocity=l*c,!r||l<=a){p(),t.velocity=0;return}t.rafId=window.requestAnimationFrame(o)};t.rafId=window.requestAnimationFrame(o)};e.addEventListener(`pointerdown`,o,h),e.addEventListener(`pointermove`,d,h),e.addEventListener(`pointerup`,f,h),e.addEventListener(`pointercancel`,f,h);let m=e.style.touchAction,g=e.style.overscrollBehaviorY;e.style.touchAction=`none`,e.style.overscrollBehaviorY=`contain`,E.current=()=>{p(),k.current!==null&&typeof window<`u`&&(window.clearTimeout(k.current),k.current=null),le.current=0,e.removeEventListener(`pointerdown`,o,h),e.removeEventListener(`pointermove`,d,h),e.removeEventListener(`pointerup`,f,h),e.removeEventListener(`pointercancel`,f,h),e.style.touchAction=m,e.style.overscrollBehaviorY=g};return}let g=e=>{e.touches.length===1&&(p(),l.lastY=e.touches[0].clientY,l.lastTime=u(),l.velocity=0,l.startX=e.touches[0].clientX,l.startY=e.touches[0].clientY,l.didMove=!1)},_=e=>{if(e.touches.length!==1){l.lastY=null,l.lastTime=null,l.velocity=0,l.startX=null,l.startY=null,l.didMove=!1,p();return}let t=e.touches[0].clientX,a=e.touches[0].clientY;if(l.startX!==null&&l.startY!==null&&!l.didMove){let e=t-l.startX,n=a-l.startY;Math.hypot(e,n)>=6&&(l.didMove=!0)}if(l.lastY===null){l.lastY=a,l.lastTime=u();return}let o=l.lastY,s=l.lastTime??u(),c=u();l.lastY=a,l.lastTime=c;let d=o-a;if(Math.abs(d)<1)return;let f=Math.max(c-s,8),m=d*(n+Math.min(r,Math.abs(d)/25)),h=m/f;l.velocity=l.velocity*.75+h*i,l.velocity>8?l.velocity=8:l.velocity<-8&&(l.velocity=-8),l.didMove&&(e.preventDefault(),e.stopPropagation()),ee(m)},v=e=>{let t=!l.didMove;l.lastY=null,l.lastTime=null;let n=l.velocity;if(l.startX=null,l.startY=null,l.didMove=!1,t){let t=e.changedTouches?.[0];F?R(t?.clientX,t?.clientY):c&&!P.current&&(P.current=!0,b.current?.focus());return}if(typeof window>`u`)return;if(Math.abs(n)<a){l.velocity=0;return}let r=u(),i=()=>{let e=u(),t=Math.max(e-r,8);r=e;let n=ee(l.velocity*t)??!1,o=Math.sign(l.velocity),c=Math.max(0,Math.abs(l.velocity)-s*t);if(l.velocity=c*o,!n||c<=a){p(),l.velocity=0;return}l.rafId=window.requestAnimationFrame(i)};l.rafId=window.requestAnimationFrame(i)};e.addEventListener(`touchstart`,g,h),e.addEventListener(`touchmove`,_,h),e.addEventListener(`touchend`,v,h),e.addEventListener(`touchcancel`,v,h);let y=e.style.touchAction,te=e.style.overscrollBehaviorY;e.style.touchAction=`none`,e.style.overscrollBehaviorY=`contain`,E.current=()=>{p(),k.current!==null&&typeof window<`u`&&(window.clearTimeout(k.current),k.current=null),le.current=0,e.removeEventListener(`touchstart`,g,h),e.removeEventListener(`touchmove`,_,h),e.removeEventListener(`touchend`,v,h),e.removeEventListener(`touchcancel`,v,h),e.style.touchAction=y,e.style.overscrollBehaviorY=te}},[c,F,R,o]);w.useEffect(()=>{let e=!1,t=null,n=null,r=null,s=[],l=null,u=null,f=null,p=m.current;if(!p)return;if(p.tabIndex=F?-1:0,F){let e=p.focus.bind(p),t=p;t.focus=((...e)=>{R()}),f=()=>{t.focus=e}}let h=()=>{I(!0)},g=()=>{I(!1)},v=e=>{let t=e.target;if(t&&p.contains(t)){if(F&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur(),R()},0),I(!1);return}if(c&&!P.current&&t instanceof HTMLElement){window.setTimeout(()=>{t.blur()},0),I(!1);return}I(!0);return}I(!1)},y=()=>{I(!1)},ne=null;return(async()=>{try{let f=await D();if(e)return;let m=se(a,o,i,f,!1),v=new d(m);oe.current=!0,F&&(v.focus=()=>{});let y=v;if(typeof y.scrollToBottom==`function`){let e=y.scrollToBottom.bind(y);y.scrollToBottom=()=>{oe.current&&e()},l=()=>{y.scrollToBottom=e}}let re=new ee;if(t=v,b.current=v,te.current=re,v.loadAddon(re),v.open(p),c){let e=v.renderer;if(e&&typeof e.renderScrollbar==`function`){let t=e.renderScrollbar.bind(e);e.renderScrollbar=()=>{},u=()=>{e.renderScrollbar=t}}}ve(),me.current=!1,ne=v.textarea??p.querySelector(`textarea`),ne&&(ne.addEventListener(`focus`,h),ne.addEventListener(`blur`,g)),be(),typeof MutationObserver<`u`&&(r=new MutationObserver(()=>{be()}),r.observe(p,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`contenteditable`,`role`,`tabindex`,`aria-label`]}));let S=O(p);S?(S.classList.add(`overlay-scrollbar-target`,`overlay-scrollbar-container`),_.current=S,ge()):_.current=null,K();let C=re;typeof C.observeResize==`function`&&C.observeResize(),Ee(),s=[v.onData(e=>{x.current(e)}),v.onScroll(e=>{if(typeof e==`number`&&Number.isFinite(e)){let t=typeof v.hasSelection==`function`&&v.hasSelection();oe.current=!t&&e<=.5}}),v.onSelectionChange(()=>{if(typeof v.hasSelection==`function`&&v.hasSelection()){oe.current=!1;return}let e=typeof v.getViewportY==`function`?v.getViewportY():0;oe.current=e<=.5})],n=new ResizeObserver(()=>{K()}),n.observe(p),typeof window<`u`&&window.setTimeout(()=>{K()},0)}catch{}})(),document.addEventListener(`focusin`,v,!0),window.addEventListener(`blur`,y),()=>{e=!0,E.current?.(),E.current=null,document.removeEventListener(`focusin`,v,!0),window.removeEventListener(`blur`,y),s.forEach(e=>e.dispose()),l?.(),l=null,u?.(),u=null,ne&&(ne.removeEventListener(`focus`,h),ne.removeEventListener(`blur`,g)),n?.disconnect(),r?.disconnect(),f?.(),t?.dispose(),b.current=null,te.current=null,_.current=null,re.current=null,me.current=null,G()}},[be,c,K,R,a,o,Ee,i,G,I,F]),w.useEffect(()=>{let e=b.current;e&&(e.reset(),G(),re.current=null,K())},[e,_e,K,G]),w.useEffect(()=>{l&&b.current&&z()},[l,z,e,_e]),w.useEffect(()=>(Ee(),()=>{E.current?.(),E.current=null}),[Ee,e]),w.useEffect(()=>{let e=b.current;if(!e)return;if(t.length===0){ae.current!==null&&(e.reset(),G(),K());return}let n=ae.current,r;if(n===null)r=t;else{let e=t.findIndex(e=>e.id===n);r=e>=0?t.slice(e+1):t}r.length>0&&Te(r.map(e=>e.data).join(``)),ae.current=t[t.length-1].id},[t,_e,Te,K,G]),w.useImperativeHandle(f,()=>({focus:()=>{z()},clear:()=>{let e=b.current;e&&(e.reset(),G(),K())},fit:()=>{K()}}),[z,K,G]);let De=w.useCallback(e=>{if(!F)return;let t=m.current,n=e.relatedTarget,r=n?.tagName;r===`INPUT`||r===`TEXTAREA`||n?.isContentEditable,n?.getAttribute(`data-terminal-hidden-input`),n&&t?.contains(n)},[F]),q=w.useCallback(e=>{let t=e.nativeEvent,n=t?.inputType??``,r=typeof t?.data==`string`?t.data:``;if(N.current=typeof performance<`u`?performance.now():Date.now(),n===`insertCompositionText`){A.current=!0;return}if(!n&&r){if(A.current)return;e.preventDefault(),x.current(r),M.current={type:`insertText`,at:typeof performance<`u`?performance.now():Date.now()},j.current=!0;return}if(n===`insertText`&&r){if(A.current)return;e.preventDefault(),x.current(r),M.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},j.current=!0;return}if(n===`insertLineBreak`){if(A.current)return;e.preventDefault(),x.current(`\r`),M.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},j.current=!0;return}if(n===`deleteContentBackward`){if(A.current)return;e.preventDefault(),x.current(``),M.current={type:n,at:typeof performance<`u`?performance.now():Date.now()},j.current=!0}},[]),Oe=w.useCallback(e=>{let t=e.currentTarget;if(N.current=typeof performance<`u`?performance.now():Date.now(),A.current)return;if(j.current){let e=M.current,n=typeof performance<`u`?performance.now():Date.now();if(e&&n-e.at<50){j.current=!1,V(t);return}j.current=!1}let n=B(t);if(!n)return;pe.current=n;let r=n.replace(/\r\n|\r|\n/g,`\r`);x.current(r),V(t),pe.current=``},[V,B]),J=w.useCallback(e=>{e.stopPropagation();let t=e.key.toLowerCase(),n=e.metaKey&&!e.ctrlKey&&!e.altKey&&t===`c`,r=e.ctrlKey&&e.shiftKey&&!e.metaKey&&!e.altKey&&t===`c`;if((n||r)&&W()){e.preventDefault(),U();return}if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.length===1){let t=e.key.toUpperCase();if(t>=`A`&&t<=`Z`){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),x.current(String.fromCharCode(t.charCodeAt(0)-64)),V(e.currentTarget);return}}if(e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key.length===1){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),x.current(`\x1B`+e.key),V(e.currentTarget);return}let i={ArrowUp:`\x1B[A`,ArrowDown:`\x1B[B`,ArrowRight:`\x1B[C`,ArrowLeft:`\x1B[D`,Escape:`\x1B`,Tab:` `,Delete:`\x1B[3~`,Home:`\x1B[H`,End:`\x1B[F`}[e.key];if(i){e.preventDefault(),x.current(i),V(e.currentTarget);return}let a=e.currentTarget;if(e.nativeEvent?.isComposing)return;let o=M.current,s=typeof performance<`u`?performance.now():Date.now(),c=!!(o&&s-o.at<50);if(e.key===`Enter`){if(c&&o?.type===`insertLineBreak`)return;e.preventDefault(),x.current(`\r`),V(a);return}if(e.key===`Backspace`){if(e.preventDefault(),c&&o?.type===`deleteContentBackward`)return;B(a)||x.current(``)}if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let t=N.current;t&&s-t<50||(e.preventDefault(),x.current(e.key),j.current=!0,M.current={type:`keydown-text`,at:s})}xe(a)},[V,U,W,B,xe]),ke=w.useCallback(e=>{e.stopPropagation();let t=e.currentTarget;e.nativeEvent?.isComposing||xe(t)},[xe]),Y=w.useCallback(e=>{let t=e.currentTarget;A.current=!1;let n=e.data||B(t);if(N.current=typeof performance<`u`?performance.now():Date.now(),!n)return;let r=n.replace(/\r\n|\r|\n/g,`\r`);x.current(r),V(t),M.current={type:`compositionend`,at:typeof performance<`u`?performance.now():Date.now()},j.current=!0},[V,B]),X=w.useCallback(e=>{e.stopPropagation();let t=e.clipboardData?.getData(`text`)??``;if(!t)return;e.preventDefault();let n=b.current?.hasBracketedPaste?.()?`\x1b[200~${t}\x1b[201~`:t;x.current(n)},[]),Z={position:`fixed`,left:0,top:0,width:1,height:1,opacity:0,zIndex:-1,background:`transparent`,color:`transparent`,WebkitTextFillColor:`transparent`,caretColor:`transparent`,textShadow:`none`,WebkitAppearance:`none`,appearance:`none`,resize:`none`,overflow:`hidden`,whiteSpace:`nowrap`,border:`0`,padding:0,margin:0,outline:`none`,outlineOffset:0,fontSize:16,fontWeight:400,pointerEvents:`none`,WebkitUserSelect:`none`,userSelect:`none`};return(0,T.jsxs)(`div`,{ref:m,className:h(`relative h-full w-full terminal-viewport-container`,s),"data-hidden-input-overlay-active":F?`true`:void 0,style:{backgroundColor:i.background},onTouchStart:e=>{if(!(!F||c)&&!W()){let t=e.touches?.[0];R(t?.clientX,t?.clientY)}},onClick:e=>{if(!c)if(F){if(W())return;R(e.clientX,e.clientY)}else b.current?.focus()},onMouseUp:()=>{!c&&W()&&U()},onTouchEnd:()=>{!c&&W()&&U()},children:[F&&typeof document<`u`?(0,ce.createPortal)((0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`input`,{ref:de,type:`text`,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":p(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...Z,display:L?`block`:`none`},onBlur:De,onBeforeInput:q,onCompositionStart:()=>{A.current=!0},onInput:Oe,onKeyDown:J,onKeyUp:ke,onCompositionEnd:Y,onPaste:X}),(0,T.jsx)(`textarea`,{ref:ue,inputMode:`text`,autoCapitalize:`off`,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,tabIndex:-1,enterKeyHint:`send`,"data-terminal-hidden-input":`true`,"aria-label":p(`terminalView.viewport.inputAria`),"aria-hidden":`true`,style:{...Z,display:L?`none`:`block`},onBlur:De,onBeforeInput:q,onCompositionStart:()=>{A.current=!0},onInput:Oe,onKeyDown:J,onKeyUp:ke,onCompositionEnd:Y,onPaste:X})]}),document.body):null,_.current&&!c?(0,T.jsx)(y,{containerRef:_,disableHorizontal:!0,className:`overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero`}):null]})});k.displayName=`TerminalViewport`;var le=RegExp(`\x1B\\[[0-9;?]*[ -/]*[@-~]`,`g`),ue=/(https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[(?:::1|::)\])(?::\d{2,5})?(?:\/[^\s<>'"`]*)?)/gi,de=/(?:➜\s*(?:Local|Network):)|\b(?:local|network|loopback|serving|listening|available|ready|started|running|server|vite|webpack|next\.js|astro|sveltekit|nuxt)\b/i,A=/Serving HTTP on .*? port (\d{2,5})/i,j=new Set([`.`,`,`,`;`,`:`,`!`,`?`]),M=e=>{let t=e;for(;t.length>0;){let e=t[t.length-1];if(e===`)`||e===`]`||e===`}`||e===`>`){let n=e===`)`?`(`:e===`]`?`[`:e===`}`?`{`:`<`,r=t.slice(0,-1);if((r.match(RegExp(`\\${n}`,`g`))||[]).length>(r.match(RegExp(`\\${e}`,`g`))||[]).length)break;t=r;continue}if(j.has(e)){t=t.slice(0,-1);continue}break}return t},N=e=>{let t=M(e);return t=t.replace(`0.0.0.0`,`127.0.0.1`),t=t.replace(`[::1]`,`127.0.0.1`),t=t.replace(`[::]`,`127.0.0.1`),t},fe=e=>{if(!e)return null;let t=e.replace(le,``),n=t.match(A);if(n?.[1]){let e=Number.parseInt(n[1],10);if(Number.isFinite(e)&&e>0&&e<=65535)return`http://127.0.0.1:${e}/`}let r=t.split(`
|
|
2
|
+
`);for(let e of r){if(!de.test(e))continue;let t=Array.from(e.matchAll(ue));if(t.length!==0)return N((t.find(e=>{try{return!!new URL(N(e[1])).port}catch{return!1}})??t[0])[1])}return null},pe=async(e,n=1500)=>{if(!e||typeof window>`u`)return!1;let r;try{r=new URL(e)}catch{return!1}if(r.protocol!==`http:`&&r.protocol!==`https:`)return!1;let i=r.hostname.toLowerCase();if(i!==`localhost`&&i!==`127.0.0.1`&&i!==`0.0.0.0`&&i!==`::1`&&i!==`::`)return!1;let a=new AbortController,o=window.setTimeout(()=>a.abort(),n);try{let e=await t(`/api/system/probe-url`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:r.toString()}),cache:`no-store`,signal:a.signal});return e.ok?(await e.json().catch(()=>null))?.ok===!0:!1}catch{return!1}finally{window.clearTimeout(o)}},me={esc:`\x1B`,tab:` `,enter:`\r`,"arrow-up":`\x1B[A`,"arrow-down":`\x1B[B`,"arrow-left":`\x1B[D`,"arrow-right":`\x1B[C`},P={ctrl:`5`,cmd:`3`},he={retry:{maxRetries:3,initialDelayMs:500,maxDelayMs:8e3},connectionTimeoutMs:1e4},ge={retry:{maxRetries:8,initialDelayMs:400,maxDelayMs:8e3},connectionTimeoutMs:15e3},_e=(e,t)=>{if(t)switch(e){case`arrow-up`:return`\u001b[1;${P[t]}A`;case`arrow-down`:return`\u001b[1;${P[t]}B`;case`arrow-right`:return`\u001b[1;${P[t]}C`;case`arrow-left`:return`\u001b[1;${P[t]}D`}return me[e]??null},ve=()=>{let{t:e}=v(),{terminal:t,runtime:i,projectScope:a}=ne(),{currentTheme:o}=b(),{monoFont:d}=C(),f=l(e=>e.terminalFontSize),ee=l(e=>e.bottomTerminalHeight),g=l(e=>e.isBottomTerminalExpanded),{isMobile:y,isTablet:se,hasTouchOnlyPointer:ce}=te(),E=y||se,D=(E||ce)&&i.platform===`web`,O=i.platform!==`vscode`,le=l(e=>e.showTerminalQuickKeysOnDesktop),ue=!n()&&(E||le),de=m(e=>e.currentSessionId),A=m(e=>e.newSessionDraft),j=!!a||de!==null||A?.open===!0,M=x()??null??a?.location.directory??null,N=a?r({...a.location,directory:M??a.location.directory}):M,me=S(e=>e.sessions),P=S(e=>e.hasHydrated),ve=S(e=>e.ensureDirectory),ye=S(e=>e.createTab),F=S(e=>e.setActiveTab),be=S(e=>e.closeTab),I=w.useMemo(()=>a?async(e,n)=>{await be(e,n,t.close)}:be,[a,t,be]),L=S(e=>e.setTabSessionId),R=S(e=>e.setTabLifecycle),z=S(e=>e.setConnecting),B=S(e=>e.appendToBuffer),V=S(e=>e.setTabPreviewUrl),xe=S(e=>e.clearBuffer),Se=l(e=>e.openContextPreview),H=w.useMemo(()=>{if(N)return me.get(N)},[me,N]),U=w.useMemo(()=>H?O?H.activeTabId??H.tabs[0]?.id??null:H.tabs[0]?.id??null:null,[H,O]),W=w.useMemo(()=>{if(H)return U?H.tabs.find(e=>e.id===U)??H.tabs[0]:H.tabs[0]},[H,U]),G=w.useMemo(()=>(H?.tabs??[]).map(t=>({icon:(()=>{let e=t.iconKey?ae[t.iconKey]??`terminal`:`terminal`;return(0,T.jsx)(_,{name:e,className:`h-4 w-4`})})(),id:t.id,label:t.label,title:t.label,closeLabel:e(`terminalView.tabs.closeTabTitle`)})),[H?.tabs,e]),K=W?.terminalSessionId??null,Ce=W?.lifecycle??`idle`,we=W?.bufferChunks??[],Te=W?.isConnecting??!1,Ee=W?.previewUrl??null,[De,q]=w.useState(null),[Oe,J]=w.useState(!1),[ke,Y]=w.useState(!1),[X,Z]=w.useState(null),[Ae,je]=w.useState(!1),[Me,Ne]=w.useState(0),Pe=w.useRef(null),Fe=w.useRef(null),Ie=w.useRef(U),Le=w.useRef(K),Re=w.useRef(N),ze=w.useRef(null),Be=w.useRef(null),Ve=w.useRef(!1),He=w.useRef(!1),Ue=w.useRef(null),We=w.useRef(null),Ge=w.useRef(new Set),Ke=w.useRef(!1),qe=w.useRef(``),Je=w.useRef(new Set),Ye=w.useRef(0),Xe=w.useCallback(()=>{qe.current=``,Je.current.clear(),Ye.current+=1},[]),Ze=w.useCallback(()=>{D||typeof document<`u`&&!document.hasFocus()||ze.current?.focus()},[D]),Qe=w.useCallback(()=>{D||ze.current?.focus()},[D]);w.useEffect(()=>{if(!P||Ke.current)return;Ke.current=!0;let e=new Set;for(let[,t]of S.getState().sessions.entries())for(let n of t.tabs)n.terminalSessionId&&e.add(n.terminalSessionId);Ge.current=e},[P]);let $e=l(e=>e.activeMainTab),et=l(e=>e.isBottomTerminalOpen),tt=l(e=>e.setBottomTerminalOpen),nt=l(e=>e.setBottomTerminalExpanded),rt=$e===`terminal`,Q=rt||et,[it,at]=w.useState(Q);w.useEffect(()=>{!Q||i.platform===`vscode`||a||u()},[Q,i.platform,a]),w.useEffect(()=>{Q&&at(!0)},[Q]),w.useEffect(()=>{He.current=Q},[Q]),w.useEffect(()=>{Le.current=K},[K]),w.useEffect(()=>{Ie.current=U,Xe()},[U,Xe]),w.useEffect(()=>{Re.current=N},[N]),w.useEffect(()=>{!ue&&X!==null&&Z(null)},[ue,X,Z]),w.useEffect(()=>{!K&&X!==null&&Z(null)},[K,X,Z]);let $=w.useCallback(()=>{Pe.current?.(),Pe.current=null,Fe.current=null,Ue.current=null,Y(!1)},[]);w.useEffect(()=>()=>{$(),Le.current=null},[$]),w.useEffect(()=>($(),$),[t,$]);let ot=w.useCallback((e,t,n)=>{if(!n)return;let r=`${qe.current}${n}`.replace(/\r\n|\r/g,`
|
|
3
|
+
`),i=r.split(`
|
|
4
|
+
`),o=r.endsWith(`
|
|
5
|
+
`)?i.join(`
|
|
6
|
+
`):i.slice(0,-1).join(`
|
|
7
|
+
`);if(qe.current=r.endsWith(`
|
|
8
|
+
`)?``:(i[i.length-1]??``).slice(-1024),!o)return;let s=fe(o);if(!s||Je.current.has(s))return;let c=Ye.current;Je.current.add(s),(a?ie(a,s):pe(s)).then(n=>{if(Je.current.delete(s),!n||Ye.current!==c)return;let r=S.getState().getDirectoryState(e)?.tabs.find(e=>e.id===t);!r||r.previewUrlLocked||r.previewUrl===s||V(e,t,s,{locked:!1,autoOpened:!1})})},[V,a]),st=w.useCallback((n,r,i,a=he,o=!1)=>{if(Fe.current===i)return;$(),Fe.current=i;let s=t.connect(i,{onEvent:a=>{if(Fe.current===i)switch(a.type){case`connected`:Ue.current=i,z(n,r,!1),q(null),J(!1),Y(!1),Ze(),We.current===i&&(We.current=null,t.sendInput(i,`\r`).catch(()=>{}));break;case`reconnecting`:q(null),J(!1),Y(!0);break;case`data`:a.data&&(B(n,r,a.data),ot(n,r,a.data));break;case`exit`:{let t=typeof a.exitCode==`number`?a.exitCode:null,i=typeof a.signal==`number`?a.signal:null,o=!!(S.getState().getDirectoryState(n)?.tabs.find(e=>e.id===r))?.label?.startsWith(`Action:`);B(n,r,e(`terminalView.stream.processExitedMessage`,{exitCodeSegment:t===null?``:e(`terminalView.stream.processExitedWithCode`,{exitCode:t}),signalSegment:i===null?``:e(`terminalView.stream.processExitedWithSignal`,{signal:i})})),R(n,r,`exited`),L(n,r,null),z(n,r,!1),q(o?null:e(`terminalView.error.sessionEnded`)),J(!1),Y(!1),$();break}}},onError:(t,a)=>{if(Fe.current===i){if(!a){q(null),J(!1);return}if(/session not found/i.test(t.message)||o){Y(!1),q(null),J(!1),z(n,r,!0),xe(n,r),R(n,r,`idle`),L(n,r,null),$();return}Y(!1),q(e(`terminalView.error.connectionFailed`,{message:t.message})),J(!0),z(n,r,!1),xe(n,r),R(n,r,`exited`),L(n,r,null),$()}}},a);Pe.current=()=>{s.close(),Fe.current=null}},[B,xe,$,Ze,ot,z,R,L,e,t]);w.useEffect(()=>{let n=!1;if(!(!P||!it)){if(!N){q(e(j?`terminalView.empty.noWorkingDirectory`:`terminalView.empty.selectSession`));return}return(async()=>{let r=N;if(!Re.current||Re.current!==r)return;ve(r);let i=S.getState().getDirectoryState(r);if(!i||i.tabs.length===0)return;let a=O?i.activeTabId??i.tabs[0]?.id??null:i.tabs[0]?.id??null;if(!a)return;let o=i.tabs.find(e=>e.id===a)??i.tabs[0],s=o?.terminalSessionId??null,c=o?.lifecycle??`idle`,l=!!o?.label?.startsWith(`Action:`),u=(o?.bufferLength??0)>0||(o?.bufferChunks?.length??0)>0;if(s)return;if(c===`exited`){z(r,a,!1);return}if(l&&u){z(r,a,!1);return}let d=Be.current;if(!(!d&&He.current)){q(null),J(!1),Y(!1),z(r,a,!0);try{let e=await t.createSession({cwd:M??``,cols:d?.cols,rows:d?.rows});if(!(!n&&Re.current===r&&Ie.current===a)){try{await t.close(e.sessionId)}catch{}return}if(S.getState().getDirectoryState(r)?.tabs.find(e=>e.id===a)?.terminalSessionId){try{await t.close(e.sessionId)}catch{}return}L(r,a,e.sessionId)}catch(t){n||(q(t instanceof Error?t.message:e(`terminalView.error.startSessionFailed`)),J(!0),Y(!1),z(r,a,!1))}}})(),()=>{n=!0}}},[j,N,M,K,Ce,U,it,Me,O,P,ve,z,L,e,t]);let ct=w.useRef(st);ct.current=st;let lt=w.useRef($);lt.current=$,w.useEffect(()=>{if(!P||!it)return;if(!N){lt.current();return}let e=N,t=S.getState().getDirectoryState(e);if(!t||t.tabs.length===0){lt.current();return}let n=O?t.activeTabId??t.tabs[0]?.id??null:t.tabs[0]?.id??null;if(!n){lt.current();return}let r=t.tabs.find(e=>e.id===n)??t.tabs[0],i=r?.terminalSessionId??null;if(!i){lt.current(),Le.current=null;return}if(Fe.current===i&&Pe.current){Le.current=i;return}Le.current=i;let a=Ge.current.has(i),o=a&&(r?.bufferLength??0)===0&&(r?.bufferChunks?.length??0)===0;a&&Ge.current.delete(i),o&&(We.current=i),ct.current(e,n,i,a?ge:he,a)},[N,K,U,O,it,P,t]),w.useEffect(()=>{if(!Q||D)return;if(typeof window>`u`){Ze();return}let e=window.requestAnimationFrame(()=>{Ze()});return()=>{window.cancelAnimationFrame(e)}},[U,Ze,Q,D]);let ut=w.useCallback(async()=>{if(!N||Ae)return;let t=S.getState().getDirectoryState(N),n=O?U??t?.activeTabId??t?.tabs[0]?.id??null:t?.tabs[0]?.id??null;if(n){je(!0),q(null),J(!1),Y(!1),$(),xe(N,n),Xe();try{await I(N,n)}catch(t){q(t instanceof Error?t.message:e(`terminalView.error.restartFailed`)),J(!0),Y(!1)}finally{je(!1)}}},[U,xe,I,$,N,O,Ae,Xe,e]),dt=w.useCallback(async()=>{await ut()},[ut]),ft=w.useCallback(()=>{if(!N)return;let e=ye(N);F(N,e),q(null),J(!1),Y(!1),$()},[ye,$,N,F]),pt=w.useCallback(e=>{N&&(F(N,e),q(null),J(!1),Y(!1),$())},[$,N,F]),mt=w.useCallback(e=>{N&&(e===U&&$(),q(null),J(!1),Y(!1),I(N,e))},[U,I,$,N]),ht=w.useCallback(n=>{if(!n||ke)return;let r=n,i=!1;if(X&&n.length>0){let e=n[0];if(e.length===1&&/[a-zA-Z]/.test(e)){let t=e.toUpperCase();(X===`ctrl`||X===`cmd`)&&(r=String.fromCharCode(t.charCodeAt(0)&31),i=!0)}i||=!0}let a=Le.current;!a||Ue.current!==a||(t.sendInput(a,r).catch(t=>{ke||q(t instanceof Error?t.message:e(`terminalView.error.sendInputFailed`))}),i&&(Z(null),Qe()))},[X,Qe,ke,Z,e,t]),gt=w.useCallback((e,n)=>{let r=Be.current;if((!r||r.cols!==e||r.rows!==n)&&(Be.current={cols:e,rows:n}),Ve.current||(Ve.current=!0,Ne(e=>e+1)),!He.current)return;let i=Le.current;!i||Ue.current!==i||t.resize({sessionId:i,cols:e,rows:n}).catch(()=>{})},[t]),_t=w.useCallback(e=>{Z(t=>t===e?null:e),Qe()},[Qe,Z]),vt=w.useCallback(e=>{let t=_e(e,X);t&&(ht(t),Z(null),Qe())},[X,Qe,ht,Z]);w.useEffect(()=>{if(!ue||!X||!K)return;let e=e=>{if(e.repeat)return;let t=e.key;if(!t||t===`Control`||t===`Meta`||t===`Alt`||t===`Shift`)return;let n=t.length===1?t.toLowerCase():t,r=e.code??``,i=r.startsWith(`Key`)&&r.length===4?r.slice(3).toUpperCase():null,a=t.length===1&&/[a-zA-Z]/.test(t)?t.toUpperCase():i,o={Tab:`tab`,Enter:`enter`,ArrowUp:`arrow-up`,ArrowDown:`arrow-down`,ArrowLeft:`arrow-left`,ArrowRight:`arrow-right`,Escape:`esc`,tab:`tab`,enter:`enter`,arrowup:`arrow-up`,arrowdown:`arrow-down`,arrowleft:`arrow-left`,arrowright:`arrow-right`,escape:`esc`};if(n in o){e.preventDefault(),e.stopPropagation(),vt(o[n]);return}if(X===`ctrl`&&a&&a.length===1&&a>=`A`&&a<=`Z`){let t=String.fromCharCode(a.charCodeAt(0)&31);e.preventDefault(),e.stopPropagation(),ht(t),Z(null),Qe()}};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[X,vt,ht,Qe,ue,Z,K]);let yt=w.useMemo(()=>{let e=s[c].stack;if(typeof window>`u`)return(s[d]??s[`system-mono`]).stack;let t=window.getComputedStyle(document.documentElement).getPropertyValue(`--font-family-mono`);return t&&t.trim().length>0?t.trim():(s[d]??s[`system-mono`]).stack??e},[d]),bt=w.useMemo(()=>oe(o),[o]),xt=w.useMemo(()=>`${N??`no-dir`}::${U??`no-tab`}`,[N,U]);if(w.useEffect(()=>{if(!Q||D)return;let e=ze.current;if(!e)return;let t=()=>{e.fit()};if(typeof window<`u`){let e=window.requestAnimationFrame(()=>{t(),Ze()}),n=[220,400].map(e=>window.setTimeout(t,e));return()=>{window.cancelAnimationFrame(e),n.forEach(e=>window.clearTimeout(e))}}t()},[Ze,Q,D,xt,K]),w.useEffect(()=>{if(D||!Q||!et)return;let e=ze.current;if(!e)return;let t=()=>{e.fit()};if(typeof window<`u`){let e=window.requestAnimationFrame(()=>{t()}),n=[0,80,180,320].map(e=>window.setTimeout(t,e));return()=>{window.cancelAnimationFrame(e),n.forEach(e=>window.clearTimeout(e))}}t()},[ee,g,et,Q,D]),!j)return(0,T.jsx)(`div`,{className:`flex h-full items-center justify-center p-4 text-center text-sm text-muted-foreground`,children:e(`terminalView.empty.selectSession`)});if(!N)return(0,T.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 p-4 text-center text-sm text-muted-foreground`,children:[(0,T.jsx)(`p`,{children:e(`terminalView.empty.noWorkingDirectoryForSession`)}),(0,T.jsx)(p,{onClick:ut,size:`sm`,children:e(`terminalView.actions.retry`)})]});let St=!K||Te||Ae||ke,Ct=it,wt=!E&&et&&!rt,Tt=(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(p,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs`,onClick:()=>vt(`esc`),disabled:St,children:e(`terminalView.quickKeys.escape`)}),(0,T.jsxs)(p,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>vt(`tab`),disabled:St,children:[(0,T.jsx)(_,{name:`arrow-right`,className:`h-4 w-4`}),(0,T.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.tabAria`)})]}),(0,T.jsxs)(p,{type:`button`,size:`sm`,variant:`chip`,"aria-pressed":X===`ctrl`,className:`h-6 w-9 p-0`,onClick:()=>_t(`ctrl`),disabled:St,children:[(0,T.jsx)(`span`,{className:`text-xs font-medium`,children:e(`terminalView.quickKeys.controlLabel`)}),(0,T.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.controlModifierAria`)})]}),(0,T.jsxs)(p,{type:`button`,size:`sm`,variant:`chip`,"aria-pressed":X===`cmd`,className:`h-6 w-9 p-0`,onClick:()=>_t(`cmd`),disabled:St,children:[(0,T.jsx)(_,{name:`command`}),(0,T.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.commandModifierAria`)})]}),(0,T.jsxs)(p,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>vt(`arrow-up`),disabled:St,children:[(0,T.jsx)(_,{name:`arrow-up`}),(0,T.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowUpAria`)})]}),(0,T.jsxs)(p,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>vt(`arrow-left`),disabled:St,children:[(0,T.jsx)(_,{name:`arrow-left`}),(0,T.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowLeftAria`)})]}),(0,T.jsxs)(p,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>vt(`arrow-down`),disabled:St,children:[(0,T.jsx)(_,{name:`arrow-down`}),(0,T.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowDownAria`)})]}),(0,T.jsxs)(p,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>vt(`arrow-right`),disabled:St,children:[(0,T.jsx)(_,{name:`arrow-right`}),(0,T.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.arrowRightAria`)})]}),(0,T.jsxs)(p,{type:`button`,size:`sm`,variant:`outline`,className:`h-6 w-9 p-0`,onClick:()=>vt(`enter`),disabled:St,children:[(0,T.jsx)(_,{name:`arrow-go-back`}),(0,T.jsx)(`span`,{className:`sr-only`,children:e(`terminalView.quickKeys.enterAria`)})]})]});return(0,T.jsxs)(`div`,{"data-terminal-view":`true`,className:`flex h-full flex-col overflow-hidden bg-[var(--surface-background)]`,children:[(0,T.jsxs)(`div`,{className:h(`app-region-no-drag sticky top-0 z-20 shrink-0 bg-[var(--surface-background)] text-xs`,E?`px-3 py-1.5`:`pl-3 pr-1.5 py-1`),children:[O&&H?(0,T.jsxs)(`div`,{className:`flex items-center gap-2 pl-1 pr-1`,children:[(0,T.jsx)(`div`,{className:h(`min-w-0 flex-1`,E?`h-8`:`h-7`),children:(0,T.jsx)(re,{items:G,activeId:U,onSelect:pt,onClose:mt,layoutMode:`scrollable`,variant:`default`,className:`h-full bg-transparent`})}),(0,T.jsx)(p,{type:`button`,size:`xs`,variant:`ghost`,className:h(`shrink-0`,E?`h-8 w-8 p-0`:`h-7 w-7 p-0`),onClick:ft,title:e(`terminalView.tabs.newTabTitle`),children:(0,T.jsx)(_,{name:`add`,className:`${E?`h-[18px] w-[18px]`:`h-4 w-4`}`})}),(0,T.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 overflow-visible`,children:[Ee?(0,T.jsxs)(p,{type:`button`,size:`xs`,variant:`outline`,className:`h-6 shrink-0 gap-1 px-2`,onClick:()=>{N&&Se(N,Ee)},title:e(`terminalView.preview.openTitle`),children:[(0,T.jsx)(_,{name:`global`,className:`h-3.5 w-3.5 shrink-0`}),(0,T.jsx)(`span`,{className:`whitespace-nowrap`,children:e(`terminalView.preview.open`)})]}):null,wt?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(p,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>nt(!g),className:h(`shrink-0 p-0`,y?`h-8 w-8`:`h-7 w-7`),title:e(g?`terminalView.bottomDock.restoreTitle`:`terminalView.bottomDock.expandTitle`),"aria-label":e(g?`terminalView.bottomDock.restoreAria`:`terminalView.bottomDock.expandAria`),children:g?(0,T.jsx)(_,{name:`fullscreen-exit`,className:`h-4 w-4`}):(0,T.jsx)(_,{name:`fullscreen`,className:`h-4 w-4`})}),(0,T.jsx)(p,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>tt(!1),className:h(`shrink-0 p-0`,y?`h-8 w-8`:`h-7 w-7`),title:e(`terminalView.bottomDock.closeTitle`),"aria-label":e(`terminalView.bottomDock.closeAria`),children:(0,T.jsx)(_,{name:`close`,className:`h-4 w-4`})})]}):null]})]}):null,!y&&ue&&O&&H?(0,T.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1 pl-1 pr-1`,children:Tt}):null,ue&&(y||!O||!H)?(0,T.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1`,children:Tt}):null]}),(0,T.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,style:{backgroundColor:bt.background},children:[(0,T.jsx)(`div`,{className:`h-full w-full box-border pl-4 pr-1.5 pt-3 pb-4`,children:Ct?(0,T.jsx)(k,{ref:e=>{ze.current=e},sessionKey:xt,chunks:we,onInput:ht,onResize:gt,theme:bt,fontFamily:yt,fontSize:f,enableTouchScroll:D,autoFocus:!D&&Q,isVisible:Q},xt):null}),!ke&&De&&(0,T.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 bg-[var(--status-error-background)] px-3 py-2 text-xs text-[var(--status-error-foreground)] flex items-center justify-between gap-2`,children:[(0,T.jsx)(`span`,{children:De}),Oe&&y&&(0,T.jsx)(p,{size:`sm`,variant:`secondary`,className:`h-6 px-2 py-0 text-xs`,onClick:dt,disabled:Ae,title:e(`terminalView.actions.hardRestartTitle`),type:`button`,children:e(`terminalView.actions.hardRestart`)})]})]})]})};export{ve as TerminalView};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t}from"./platform-CiUKDeXd.js";import{a as n}from"./vendor-zustand-CTekDqaS.js";import{it as r,ot as i,st as a}from"./vendor-base-ui-wXsskyKm.js";import{E as o}from"./runtime-file-resource-C5kmYlLv.js";import{r as s}from"./vendor-reactuses-core-DjKFMfz7.js";import{a as c,o as l,r as u}from"./useUIStore-Dzf_W6hZ.js";import{Yn as ee,co as d,f,jt as p,no as te}from"./ui-Cd2-HQSa.js";import{t as ne}from"./i18n-BcqhT5IQ.js";import{n as re}from"./useEffectiveDirectory-CCVmwzs7.js";import{s as m}from"./mobileBackNavigation-Cqz28R4e.js";import{i as h,n as g}from"./shortcuts-CS2j7q63.js";import{a as ie,c as _,l as v,s as ae,u as oe}from"./SessionSurfaceContext-BP4NCKp6.js";import{o as se}from"./useSessionBtwStore-LV6b9oRF.js";import{a as ce,i as y,r as le,t as b}from"./nativeComposerCover-X18Rxy9s.js";var x=e(a(),1),S=e(r(),1),C=(e,t)=>{if(!(t in e))return e;let n={...e};return delete n[t],n},w=n(e=>({quotesByKey:{},addQuote:(t,n)=>e(e=>{let r=e.quotesByKey[t]??_,i=v(r,n);return i===r?e:{quotesByKey:{...e.quotesByKey,[t]:i}}}),removeQuote:(t,n)=>e(e=>{let r=e.quotesByKey[t];if(!r||n<0||n>=r.length)return e;let i=r.filter((e,t)=>t!==n);return{quotesByKey:i.length===0?C(e.quotesByKey,t):{...e.quotesByKey,[t]:i}}}),removeLast:t=>e(e=>{let n=e.quotesByKey[t];if(!n||n.length===0)return e;let r=n.slice(0,-1);return{quotesByKey:r.length===0?C(e.quotesByKey,t):{...e.quotesByKey,[t]:r}}}),clear:t=>e(e=>({quotesByKey:C(e.quotesByKey,t)})),restore:(t,n)=>e(e=>n.length===0?{quotesByKey:C(e.quotesByKey,t)}:{quotesByKey:{...e.quotesByKey,[t]:n}})})),T=e=>t=>e?t.quotesByKey[e]??_:_,E=()=>{typeof window>`u`||window.requestAnimationFrame(()=>{document.querySelector(`[data-btw-composer] textarea`)?.focus()})},D=e=>{let t=e.directory??null;p({sessionId:e.sessionId,directory:t})?y(b):u.getState().openContextPanelTab(t??``,{mode:`btw`}),E()},O=e=>{let t=Number.isFinite(e.cssInsetPx)?Math.max(0,e.cssInsetPx):0,n=e.visualHeight,r=n==null||!Number.isFinite(n)?0:Math.max(0,e.innerHeight-n-(e.visualOffsetTop??0));return Math.max(t,r)},k=e=>{let t=Number.parseFloat(e??``);return Number.isFinite(t)?Math.max(0,t):0},A=48,j=88,M=e=>{let t=e.composer;if(t&&t.height>=A&&t.width>=A)return{left:t.left,top:t.top,width:t.width,height:t.height};let n=e.nativeComposerHeightPx>=A?e.nativeComposerHeightPx:e.lastHeightPx>=A?e.lastHeightPx:j,r=Math.max(0,e.keyboardOverlapPx);return{left:0,top:Math.max(0,e.viewportHeight-r-n),width:Math.max(0,e.viewportWidth),height:n}},N=i(),P=8,F=`mod+l`,I=`mod+shift+s`,L=[`⌃`,`⌥`,`⇧`,`⌘`],ue=e=>{let t=h(e).split(` + `);if(!d())return t.join(`+`);let n=t[t.length-1];return[...t.slice(0,-1).sort((e,t)=>L.indexOf(e)-L.indexOf(t)),n].join(``)},de=280,R=()=>{if(typeof document>`u`)return null;let e=null;for(let t of document.querySelectorAll(`.yuri-mobile-composer`)){let n=window.getComputedStyle(t);if(n.display===`none`||n.visibility===`hidden`)continue;let r=t.getBoundingClientRect();r.height<48||r.width<48||r.bottom<0||r.top>window.innerHeight||(!e||r.bottom>e.top+e.height)&&(e={left:r.left,top:r.top,width:r.width,height:r.height})}return e},fe=e=>{let t=document.documentElement,n=window.visualViewport;return M({composer:R(),viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,keyboardOverlapPx:O({cssInsetPx:k(t.style.getPropertyValue(`--yuri-keyboard-inset`)),innerHeight:window.innerHeight,visualHeight:n?.height,visualOffsetTop:n?.offsetTop}),nativeComposerHeightPx:k(t.style.getPropertyValue(m)),lastHeightPx:e})},z=null;l(()=>{typeof window<`u`&&!document.activeElement?.matches(`textarea[data-chat-input="true"]`)&&window.getSelection()?.removeAllRanges(),z?.()});var B=new Set(`address.article.aside.blockquote.dd.div.dl.dt.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hr.li.main.nav.ol.p.pre.section.table.ul`.split(`.`)),V=e=>e.replace(/\r\n?/g,`
|
|
2
|
+
`),H=e=>V(e).trim(),U=(e,t)=>{if(e.contains(t))return!0;let n=t instanceof ShadowRoot?t:t.getRootNode();return n instanceof ShadowRoot&&e.contains(n.host)},W=e=>{let t=[],n=e=>{for(let r of e.querySelectorAll(`*`))r.shadowRoot&&(t.push(r.shadowRoot),n(r.shadowRoot))};return n(e),t},G=(e,t)=>{let n=W(t),r=e.getComposedRanges?.({shadowRoots:n})[0];if(r){let e=document.createRange();if(e.setStart(r.startContainer,r.startOffset),e.setEnd(r.endContainer,r.endOffset),U(t,e.commonAncestorContainer))return e}if(e.rangeCount===0)return null;let i=e.getRangeAt(0);return U(t,i.commonAncestorContainer)?i:null},K=e=>e.replace(/\s+/g,` `).trim(),q=e=>{if(e.nodeType===Node.TEXT_NODE)return K(e.textContent||``);if(e.nodeType!==Node.ELEMENT_NODE)return``;let t=e,n=t.tagName.toLowerCase(),r=Array.from(t.childNodes).map(e=>q(e)).join(``).replace(/\s+/g,` `).trim();if(!r&&n!==`br`)return``;if(n===`br`)return`
|
|
3
|
+
`;if(n===`strong`||n===`b`)return`**${r}**`;if(n===`em`||n===`i`)return`*${r}*`;if(n===`code`)return`\`${r.replace(/`/g,"\\`")}\``;if(n===`a`){let e=t.getAttribute(`href`);return e?`[${r}](${e})`:r}return r},J=(e,t)=>Array.from(e.children).filter(e=>e instanceof HTMLElement&&e.tagName.toLowerCase()===`li`).map((e,n)=>{let r=t?`${n+1}. `:`- `,i=Array.from(e.childNodes).map(e=>q(e)).join(``).replace(/\s+/g,` `).trim();return i?`${r}${i}`:``}).filter(Boolean).join(`
|
|
4
|
+
`),Y=e=>{if(e.nodeType===Node.TEXT_NODE)return H(e.textContent||``);if(e.nodeType!==Node.ELEMENT_NODE)return``;let t=e,n=t.tagName.toLowerCase();if(n===`pre`){let e=t.querySelector(`code`);return`\`\`\`${((e?.className||``).match(/language-([\w-]+)/)?.[1]||``).trim()}\n${V(e?.textContent||t.textContent||``).replace(/\n$/,``)}\n\`\`\``}if(n===`code`){let e=V(t.textContent||``).trim();return e?`\`${e.replace(/`/g,"\\`")}\``:``}if(n===`ul`)return J(t,!1);if(n===`ol`)return J(t,!0);if(n===`blockquote`)return H(Array.from(t.childNodes).map(e=>Y(e)).join(`
|
|
5
|
+
`)).split(`
|
|
6
|
+
`).filter(e=>e.length>0).map(e=>`> ${e}`).join(`
|
|
7
|
+
`);if(/^h[1-6]$/.test(n)){let e=Number.parseInt(n[1],10),r=H(Array.from(t.childNodes).map(e=>q(e)).join(``));return r?`${`#`.repeat(e)} ${r}`:``}if(n===`p`||n===`div`||n===`li`)return H(Array.from(t.childNodes).map(e=>q(e)).join(``));let r=Array.from(t.childNodes).map(e=>Y(e)).filter(e=>e.length>0);return r.length>0?r.join(`
|
|
8
|
+
|
|
9
|
+
`):H(Array.from(t.childNodes).map(e=>q(e)).join(``))},X=e=>Array.from(e.childNodes).every(e=>{if(e.nodeType===Node.TEXT_NODE||e.nodeType!==Node.ELEMENT_NODE)return!0;let t=e;return!B.has(t.tagName.toLowerCase())}),Z=(e,t)=>{let n=e.cloneContents();if(X(n)){let e=H(Array.from(n.childNodes).map(e=>q(e)).join(``));if(e)return e}return Array.from(n.childNodes).map(e=>Y(e)).filter(e=>e.length>0).join(`
|
|
10
|
+
|
|
11
|
+
`).trim()||H(t)},Q=({containerRef:e})=>{let{t:n}=ne(),[r,i]=x.useState({x:0,y:0,show:!1}),[a,l]=x.useState(``),d=x.useRef(!1),[p,m]=x.useState(!1),h=x.useRef(null),_=x.useRef(de),v=x.useRef(null),y=x.useRef(null),b=x.useRef(null),C=x.useRef(!1),T=x.useRef(0),[E,O]=x.useState(null),k=f(e=>e.currentSessionId),A=re()??null,j=u(e=>e.isMobile),M=ae(),L=o(),R=L?.entry.location.hostId?L.entry:void 0,B=R?M.sessionId:k,V=ie(M).textSelectionMutation,U=M.kind===`primary`&&!!B;x.useEffect(()=>{C.current=r.show},[r.show]);let K=x.useCallback(()=>{v.current=null,z===K&&(z=null),b.current!==null&&(window.clearTimeout(b.current),b.current=null),y.current!==null&&(window.cancelAnimationFrame(y.current),y.current=null),C.current&&=(m(!1),i(e=>({...e,show:!1})),l(``),!1)},[]);x.useLayoutEffect(()=>K,[K]);let q=x.useCallback(e=>{if(typeof window>`u`)return e;let t=window.innerWidth,n=_.current/2,r=P+n,i=t-P-n;return r>i?t/2:Math.min(Math.max(e,r),i)},[]),J=x.useCallback(()=>{if(!v.current)return;z!==K&&(z?.(),z=K);let{markdownText:e,rect:t}=v.current,n=!r.show,a=j?t.left+t.width/2:q(t.left+t.width/2),o=t.top-10;l(e),i({x:a,y:o,show:!0}),C.current=!0,n&&(m(!0),y.current!==null&&window.cancelAnimationFrame(y.current),y.current=window.requestAnimationFrame(()=>{m(!1),y.current=null}))},[q,K,j,r.show]);x.useLayoutEffect(()=>{if(!r.show||j||!h.current)return;let e=h.current.offsetWidth;!Number.isFinite(e)||e<=0||e===_.current||(_.current=e,i(e=>({...e,x:q(e.x)})))},[q,j,r.show]),x.useEffect(()=>{if(!r.show||j)return;let e=()=>{i(e=>({...e,x:q(e.x)}))};return window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[q,j,r.show]);let Y=x.useCallback(()=>{let t=window.getSelection(),n=e.current;if(!t||!n){d.current||K();return}let r=H(t.toString());if(!r){d.current||K();return}let i=G(t,n);if(!i){d.current||K();return}let a=i.getBoundingClientRect();v.current={plainText:r,markdownText:Z(i,r),rect:a},d.current||J()},[e,K,J]);x.useEffect(()=>{let t=e.current;if(!t)return;let n=()=>{d.current=!0,K()},r=()=>{d.current=!1,b.current!==null&&window.clearTimeout(b.current);let e=c();b.current=window.setTimeout(()=>{b.current=null,c()===e&&Y()},10)},i=new Set,a=()=>{for(let e of W(t))i.has(e)||(i.add(e),e.addEventListener(`selectionchange`,Y))};a();let o=new MutationObserver(a);o.observe(t,{childList:!0,subtree:!0}),document.addEventListener(`selectionchange`,Y),t.addEventListener(`mousedown`,n),document.addEventListener(`mouseup`,r);let s=e=>{h.current&&!h.current.contains(e.target)&&!window.getSelection()?.toString().trim()&&K()};return document.addEventListener(`mousedown`,s),()=>{b.current!==null&&(window.clearTimeout(b.current),b.current=null),o.disconnect();for(let e of i)e.removeEventListener(`selectionchange`,Y);document.removeEventListener(`selectionchange`,Y),t.removeEventListener(`mousedown`,n),document.removeEventListener(`mouseup`,r),document.removeEventListener(`mousedown`,s)}},[e,Y,K,J]),x.useLayoutEffect(()=>{if(!j||!r.show){T.current=0,O(null);return}let e=ce(le),t=0,n=0,i=()=>{let e=fe(T.current);T.current=e.height,O(t=>t&&t.left===e.left&&t.top===e.top&&t.width===e.width&&t.height===e.height?t:e)},a=e=>{i(),e<n&&(t=window.requestAnimationFrame(a))},o=()=>{n=performance.now()+320,window.cancelAnimationFrame(t),t=window.requestAnimationFrame(a)};i(),o();let s=window.visualViewport;return s?.addEventListener(`resize`,o),s?.addEventListener(`scroll`,o),window.addEventListener(`resize`,o),window.addEventListener(`yuri:keyboard-anim`,o),window.addEventListener(`yuri:keyboard-settled`,o),()=>{window.cancelAnimationFrame(t),s?.removeEventListener(`resize`,o),s?.removeEventListener(`scroll`,o),window.removeEventListener(`resize`,o),window.removeEventListener(`yuri:keyboard-anim`,o),window.removeEventListener(`yuri:keyboard-settled`,o),e()}},[j,r.show]),x.useEffect(()=>{if(!r.show)return;let e=e=>{h.current&&e.target instanceof Node&&h.current.contains(e.target)||K()};return window.addEventListener(`scroll`,e,{capture:!0,passive:!0}),()=>{window.removeEventListener(`scroll`,e,!0)}},[r.show,K]);let X=()=>{K(),window.getSelection()?.removeAllRanges()},Q=s(e=>{if(!e)return;let n=f.getState().newSessionDraft.draftID,r=oe(R&&B?t(R.location,B):B,n);r&&(w.getState().addQuote(r,e),X(),requestAnimationFrame(()=>{Array.from(document.querySelectorAll(`textarea[data-chat-input="true"]`)).find(e=>!e.disabled&&e.getClientRects().length>0&&!e.closest(`[data-btw-composer]`))?.focus({preventScroll:!0})}))}),$=s(e=>{if(!e||!B)return;let t={sessionId:B,directory:R?.location.directory??A,host:R};se.getState().addQuote(t,e),X(),D(t)});if(x.useEffect(()=>{if(!V)return;let t=t=>{let n=g(t,F),r=U&&g(t,I);if(!n&&!r)return;let i=window.getSelection(),a=e.current;if(!i||!a||!i.toString().trim())return;let o=G(i,a);if(!o)return;t.preventDefault(),t.stopPropagation();let s=Z(o,i.toString());n?Q(s):$(s)};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},[Q,$,U,V,e]),!r.show||!V)return null;let pe=[{id:`chat`,label:n(`chat.textSelection.actions.addToChat`),shortcut:F,run:()=>Q(a)},...U?[{id:`side`,label:n(`chat.textSelection.actions.addToSideChat`),shortcut:I,run:()=>$(a)}]:[]];if(j){let e=E??{left:0,top:Math.max(0,window.innerHeight-88),width:window.innerWidth,height:88};return(0,S.createPortal)((0,N.jsx)(`div`,{ref:h,"data-text-selection-menu":!0,className:te(`fixed z-50 flex items-center justify-center gap-2 bg-background px-4`,`transition-opacity duration-200 ease-out`,p?`opacity-0`:`opacity-100`),style:{left:e.left,top:e.top,width:e.width,height:e.height,paddingBottom:`max(0.75rem, var(--yuri-safe-area-bottom-visual, env(safe-area-inset-bottom, 0px)))`},onPointerDown:e=>{e.preventDefault()},children:pe.map(e=>(0,N.jsx)(ee,{type:`button`,variant:`secondary`,size:`sm`,onClick:e.run,className:`max-w-[11rem] min-w-0`,children:(0,N.jsx)(`span`,{className:`truncate`,children:e.label})},e.id))}),document.body)}return(0,S.createPortal)((0,N.jsx)(`div`,{ref:h,"data-text-selection-menu":!0,className:`fixed z-50`,style:{left:r.x,top:r.y,transform:`translate(-50%, -100%)`},children:(0,N.jsx)(`div`,{className:te(`flex items-center gap-0.5 whitespace-nowrap rounded-lg p-0.5`,`border border-[var(--interactive-border)] bg-[var(--surface-elevated)] shadow-sm`,`transition-[opacity,transform] duration-200 ease-out will-change-[opacity,transform]`,p?`opacity-0 translate-y-[4px]`:`opacity-100 translate-y-0`),children:pe.map((e,t)=>(0,N.jsxs)(x.Fragment,{children:[t>0?(0,N.jsx)(`div`,{className:`h-3 w-px shrink-0 bg-[var(--interactive-border)]`}):null,(0,N.jsxs)(`button`,{type:`button`,onClick:e.run,className:`flex h-6 items-center gap-1.5 rounded-md px-2 typography-meta text-[var(--surface-foreground)] transition-colors duration-150 hover:bg-[var(--interactive-hover)]`,children:[(0,N.jsx)(`span`,{children:e.label}),(0,N.jsx)(`span`,{className:`tracking-[0.08em] text-[var(--surface-muted-foreground)]`,"aria-hidden":`true`,children:ue(e.shortcut)})]})]},e.id))})}),document.body)};export{w as i,D as n,T as r,Q as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{_ as n,t as r,v as i,w as a}from"./runtime-auth-DA-qfGHk.js";import{c as o,i as s}from"./runtime-switch-DEPKHgdL.js";import{n as c}from"./runtime-fetch-V-iMWR8t.js";import{R as l,n as u}from"./platform-CiUKDeXd.js";import{t as d}from"./runtimeAPIRegistry-C2VogTny.js";import{it as f,ot as p,st as m}from"./vendor-base-ui-wXsskyKm.js";import{n as h}from"./vendor-react-BkccXcWz.js";import{s as g}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{E as _,c as v,f as y,o as b,s as x}from"./runtime-file-resource-Bc_ss-sW.js";import{r as S}from"./vendor-reactuses-core-DjKFMfz7.js";import{a as C,n as w}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{S as T,x as E}from"./useUIStore-C3ewjGgP.js";import{n as D,t as O}from"./runtime-file-download-BWeoSXRb.js";import{n as k,t as A}from"./vendor-pierre-diffs-B0OmIhMO.js";import{i as j,o as M}from"./session-startup-barrier-DT-hIBRf.js";import{n as N}from"./Icon-DmykXZL1.js";import{t as P}from"./i18n-DXc6czdR.js";import{a as F,n as I,r as L}from"./toolHelpers-iEHVHQ9p.js";import{l as R,o as ee,s as te,u as ne}from"./vendor-framer-motion-D5NyyC73.js";import{t as z}from"./MobileWindowStack-DGLdgoGr.js";import{t as re}from"./vendor-tanstack-react-virtual-qsd3nvZb.js";import{n as ie,t as ae}from"./dialog-BeFBA6ja.js";import{t as oe}from"./tap-LkQum5bB.js";import{n as se,t as ce}from"./useThemeSystem-BIXghnHj.js";import{t as B}from"./appThemeRegistry-BdjrGBQ4.js";import{r as le}from"./themes-BgDJcxRc.js";import{n as ue}from"./useEffectiveDirectory-DiJBIfai.js";import{n as de}from"./mobileBackNavigation-C94n2eLT.js";import{t as fe}from"./ImageLoadingPlaceholder-DgM_EFHn.js";import{n as V,r as pe}from"./MarkdownRenderer-VvziwyJB.js";import{a as H,c as me,i as U,o as W}from"./imageSource-BR4C9TuS.js";import{n as G}from"./markdownTheme-D84XyNiT.js";import{n as K,t as he}from"./markdown-worker-oBGEB9Eg.js";import{t as ge}from"./DiffViewToggle-BwJ6MYB7.js";import{t as _e}from"./touch-gestures-DOoBxhz5.js";var q=t(m(),1),J=h(),Y=p(),X=e=>e===`in_progress`||e===`completed`||e===`cancelled`?e:`pending`,Z=e=>e.status===`completed`||e.status===`cancelled`,ve={in_progress:`chat.statusRow.todo.status.inProgress`,pending:`chat.statusRow.todo.status.pending`,completed:`chat.statusRow.todo.status.completed`,cancelled:`chat.statusRow.todo.status.cancelled`},ye={in_progress:`text-foreground`,pending:`text-muted-foreground/60`,completed:`text-muted-foreground`,cancelled:`text-muted-foreground/60`},be={in_progress:`text-foreground`,pending:`text-muted-foreground`,completed:`text-muted-foreground/60 line-through decoration-1`,cancelled:`text-muted-foreground/60 line-through decoration-1`},xe=1.2,Se=24,Ce=`1 1`,we=e=>{let t=(0,J.c)(23),{status:n,className:r}=e,{t:i}=P(),a=ve[n],o;t[0]!==i||t[1]!==a?(o=i(a),t[0]=i,t[1]=a,t[2]=o):o=t[2];let s=ye[n],c;t[3]!==r||t[4]!==s?(c=M(`size-[1em] shrink-0 transition-colors duration-300`,s,r),t[3]=r,t[4]=s,t[5]=c):c=t[5];let l=n===`pending`?xe:void 0,u=n===`pending`?Se:void 0,d=n===`pending`?Ce:void 0,f;t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`,stroke:`currentColor`,strokeWidth:l,pathLength:u,strokeDasharray:d}),t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;t[10]===n?p=t[11]:(p=n===`in_progress`?(0,Y.jsx)(`path`,{d:`M4.8 8h6.4M8.6 5.4 11.2 8l-2.6 2.6`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}):null,t[10]=n,t[11]=p);let m;t[12]===n?m=t[13]:(m=n===`completed`?(0,Y.jsx)(`path`,{d:`M5 8 7.5 11 11 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}):null,t[12]=n,t[13]=m);let h;t[14]===n?h=t[15]:(h=n===`cancelled`?(0,Y.jsx)(`path`,{d:`M3.5 12.5 12.5 3.5`,stroke:`currentColor`}):null,t[14]=n,t[15]=h);let g;return t[16]!==m||t[17]!==h||t[18]!==o||t[19]!==c||t[20]!==f||t[21]!==p?(g=(0,Y.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,role:`img`,"aria-label":o,className:c,children:[f,p,m,h]}),t[16]=m,t[17]=h,t[18]=o,t[19]=c,t[20]=f,t[21]=p,t[22]=g):g=t[22],g},Te=3.2,Ee=e=>{let t=Math.PI*2*e,n=8+Te*Math.sin(t),r=8-Te*Math.cos(t);return`M8 8 L8 4.8 A${Te} ${Te} 0 ${+(e>.5)} 1 ${n.toFixed(3)} ${r.toFixed(3)} Z`},De=e=>{let t=(0,J.c)(11),{done:n,total:r,spinning:i,className:a}=e,o=n===void 0?0:n,s=r===void 0?0:r,c=i!==void 0&&i,l=s>0?Math.min(1,o/s):0,u;t[0]===a?u=t[1]:(u=M(`size-[1.15em] shrink-0 text-foreground`,a),t[0]=a,t[1]=u);let d=c?`yuri-todo-spin`:void 0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f={transformBox:`fill-box`,transformOrigin:`center`},t[2]=f):f=t[2];let p;t[3]===d?p=t[4]:(p=(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`,stroke:`currentColor`,strokeWidth:xe,pathLength:Se,strokeDasharray:Ce,className:d,style:f}),t[3]=d,t[4]=p);let m;t[5]===l?m=t[6]:(m=l>0?(0,Y.jsx)(`path`,{d:Ee(l),fill:`currentColor`,className:`transition-opacity duration-300`}):null,t[5]=l,t[6]=m);let h;return t[7]!==u||t[8]!==p||t[9]!==m?(h=(0,Y.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:u,children:[p,m]}),t[7]=u,t[8]=p,t[9]=m,t[10]=h):h=t[10],h},Oe=({done:e,total:t,className:n,animate:r=!0})=>{let i=q.useRef(e),a=r&&i.current!==e;return q.useEffect(()=>{i.current=e},[e]),(0,Y.jsxs)(`span`,{className:M(`shrink-0 tabular-nums`,n),children:[(0,Y.jsx)(`span`,{className:M(a&&`yuri-todo-count-tick`),children:e},e),`/${t}`]})},ke=e=>{let t=(0,J.c)(5),{className:n}=e,r;t[0]===n?r=t[1]:(r=M(`flex size-[1.15em] shrink-0 items-center justify-center rounded-full bg-[var(--status-success)] text-[var(--status-success-foreground)]`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:`size-[70%]`,children:(0,Y.jsx)(`path`,{d:`M4.5 8.2 7 10.8 11.5 5.5`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,Y.jsx)(`span`,{"data-todo-complete":!0,className:r,children:i}),t[3]=r,t[4]=a),a},Ae=e=>{let t=(0,J.c)(27),{todos:n,isWorking:r,animate:i,className:a,rowClassName:o,listRef:s,id:c}=e,l=r!==void 0&&r,u=i!==void 0&&i,{t:d}=P(),f=n.findIndex(je),p;t[0]!==f||t[1]!==n?(p=f>=0?f:n.findIndex(Me),t[0]=f,t[1]=n,t[2]=p):p=t[2];let m=p,h;t[3]===n?h=t[4]:(h=n.some(Ne),t[3]=n,t[4]=h);let g=h,_;t[5]===a?_=t[6]:(_=M(`m-0 flex min-w-0 list-none flex-col gap-[0.125em] p-0`,a),t[5]=a,t[6]=_);let v;if(t[7]!==m||t[8]!==u||t[9]!==g||t[10]!==l||t[11]!==o||t[12]!==d||t[13]!==n){let e;t[15]!==m||t[16]!==u||t[17]!==g||t[18]!==l||t[19]!==o||t[20]!==d?(e=(e,t)=>{let n=X(e.status),r=l&&!g&&t===m&&n===`pending`?`in_progress`:n;return(0,Y.jsxs)(`li`,{"data-status":r,"aria-current":t===m?`step`:void 0,className:M(`grid min-w-0 shrink-0 grid-cols-[auto_minmax(0,1fr)] items-start py-[0.25em]`,o??`gap-[0.6em] px-[0.5em]`,u&&`yuri-todo-row-in`),children:[(0,Y.jsx)(`span`,{className:M(`flex h-[1.32em] w-[1.15em] items-center justify-center`,u&&`yuri-todo-icon-pop`),title:d(ve[r]),children:(0,Y.jsx)(we,{status:r})},r),(0,Y.jsx)(`span`,{dir:`auto`,title:e.content,className:M(`line-clamp-3 min-w-0 whitespace-normal text-[0.88em] break-words leading-[1.5] transition-colors duration-300`,be[r]),children:(0,Y.jsx)(`span`,{className:M(r===`in_progress`&&`animate-text-shimmer`),children:e.content})})]},e.id??`${t}:${e.content}`)},t[15]=m,t[16]=u,t[17]=g,t[18]=l,t[19]=o,t[20]=d,t[21]=e):e=t[21],v=n.map(e),t[7]=m,t[8]=u,t[9]=g,t[10]=l,t[11]=o,t[12]=d,t[13]=n,t[14]=v}else v=t[14];let y;return t[22]!==c||t[23]!==s||t[24]!==_||t[25]!==v?(y=(0,Y.jsx)(`ul`,{id:c,ref:s,className:_,children:v}),t[22]=c,t[23]=s,t[24]=_,t[25]=v,t[26]=y):y=t[26],y};function je(e){return e.status===`in_progress`}function Me(e){return e.status===`pending`}function Ne(e){return e.status===`in_progress`}var Pe=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),Fe=e=>e?Object.entries(e).map(([e,t])=>t==null?``:`${e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${typeof t==`number`?`${t}px`:t};`).join(``):``,Ie=(e,t,n)=>{let r=e.querySelector(`pre`);r&&(r.style.margin=`0`,r.style.background=`transparent`,r.style.whiteSpace=t?`pre-wrap`:`pre`,t&&(r.style.wordBreak=`break-word`,r.style.overflowWrap=`break-word`));let i=e.querySelector(`code`);if(i){let e=Fe(n);e&&i.setAttribute(`style`,`${i.getAttribute(`style`)??``}${e}`)}},Le=e=>`<pre><code>${Pe(e)}</code></pre>`,Re=e=>{let t=(0,J.c)(21),{code:n,language:r,className:i,style:a,codeStyle:o,wrap:s}=e,c=s!==void 0&&s,{currentTheme:l}=se(),u=q.useRef(null),d;t[0]===l?d=t[1]:(d=G(l),t[0]=l,t[1]=d);let f=d,p,m;t[2]!==n||t[3]!==o||t[4]!==c?(p=()=>{let e=u.current;e&&(e.innerHTML=Le(n),Ie(e,c,o))},m=[n,c,o],t[2]=n,t[3]=o,t[4]=c,t[5]=p,t[6]=m):(p=t[5],m=t[6]),q.useLayoutEffect(p,m);let h,g;t[7]!==n||t[8]!==o||t[9]!==r||t[10]!==c?(h=()=>{let e=u.current;if(!e)return;let t=!0,i=new AbortController;return he(n,(r||`text`).toLowerCase(),{signal:i.signal,priority:`visible`}).then(n=>{!t||!e||!n||(e.innerHTML=n,Ie(e,c,o))}),()=>{t=!1,i.abort()}},g=[n,r,c,o],t[7]=n,t[8]=o,t[9]=r,t[10]=c,t[11]=h,t[12]=g):(h=t[11],g=t[12]),q.useEffect(h,g);let _;t[13]===i?_=t[14]:(_=M(`typography-code`,i),t[13]=i,t[14]=_);let v=f,y;t[15]!==a||t[16]!==v?(y={...v,...a},t[15]=a,t[16]=v,t[17]=y):y=t[17];let b;return t[18]!==_||t[19]!==y?(b=(0,Y.jsx)(`div`,{ref:u,className:_,style:y}),t[18]=_,t[19]=y,t[20]=b):b=t[20],b},ze=e=>{let t=e.replace(/^<file>\s*\n?/,``).replace(/\n?<\/file>\s*$/,``);return t=t.replace(/^\s*\d{5}\|\s?/gm,``),t.trim()},Be=(e,t=``)=>{if(typeof e==`string`)return e;if(e==null)return t;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return t}},Ve=e=>e?e.includes(`<diagnostics`)||e.includes(`<file_diagnostics>`)||e.includes(`LSP errors detected`)||e.includes(`This file has errors`):!1,He=e=>e?e.replace(/\n{0,2}LSP errors detected[\s\S]*?<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/\n{0,2}This file has errors[\s\S]*?<\/file_diagnostics>/g,``).replace(/<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/<file_diagnostics>[\s\S]*?<\/file_diagnostics>/g,``).trim():``,Ue=(e,t)=>!e||typeof e!=`object`?String(e):L(e,t||``),We=e=>{if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}if(e&&typeof e==`object`){let t=e.patch;if(typeof t==`string`){let e=t.trim();return e.length>0?e:void 0}}},Ge=e=>{if(!e||typeof e!=`object`)return;let t=We(e.patch)??We(e.diff);if(t)return t;let n=Array.isArray(e.files)?e.files:[];for(let e of n){if(!e||typeof e!=`object`)continue;let t=We(e.patch)??We(e.diff);if(t)return t}},Ke=e=>{if(!e||typeof e!=`string`)return{data:null,isJson:!1};let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`)||!t.endsWith(`}`)&&!t.endsWith(`]`)||t.length<2)return{data:null,isJson:!1};try{let e=JSON.parse(t);return typeof e==`object`&&e?{data:e,isJson:!0}:{data:null,isJson:!1}}catch{return{data:null,isJson:!1}}},qe=(e,t,n)=>{let r=ze(e);if((t===`edit`||t===`multiedit`||t===`write`||t===`apply_patch`)&&Ve(r)&&(r=He(r)),(t===`edit`||t===`multiedit`||t===`apply_patch`)&&r.trim().length===0){let e=Ge(n);if(e)return e}return r},Je=e=>{let t=e.match(/<type>(file|directory)<\/type>/i)?.[1]?.toLowerCase()??`unknown`,n=(e.match(/<content>([\s\S]*?)<\/content>/i)?.[1]??e).replace(/\r\n/g,`
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{_ as n,t as r,v as i,w as a}from"./runtime-auth-DA-qfGHk.js";import{c as o,i as s}from"./runtime-switch-DEPKHgdL.js";import{n as c}from"./runtime-fetch-V-iMWR8t.js";import{R as l,n as u}from"./platform-CiUKDeXd.js";import{t as d}from"./runtimeAPIRegistry-C2VogTny.js";import{it as f,ot as p,st as m}from"./vendor-base-ui-wXsskyKm.js";import{n as h}from"./vendor-react-BkccXcWz.js";import{s as g}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{E as _,c as v,f as y,o as b,s as x}from"./runtime-file-resource-C5kmYlLv.js";import{r as S}from"./vendor-reactuses-core-DjKFMfz7.js";import{a as C,n as w}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{S as T,x as E}from"./useUIStore-Dzf_W6hZ.js";import{n as D,t as O}from"./runtime-file-download-1s2Al1t3.js";import{n as k,t as A}from"./vendor-pierre-diffs-B0OmIhMO.js";import{Yn as j,no as M}from"./ui-Cd2-HQSa.js";import{n as N}from"./Icon-CeG6IExS.js";import{t as P}from"./i18n-BcqhT5IQ.js";import{a as F,n as I,r as L}from"./toolHelpers-iEHVHQ9p.js";import{l as R,o as ee,s as te,u as ne}from"./vendor-framer-motion-D5NyyC73.js";import{t as z}from"./MobileWindowStack-DGLdgoGr.js";import{t as re}from"./vendor-tanstack-react-virtual-qsd3nvZb.js";import{n as ie,t as ae}from"./dialog-CZlghHCF.js";import{t as oe}from"./tap-LkQum5bB.js";import{n as se,t as ce}from"./useThemeSystem-BIXghnHj.js";import{t as B}from"./appThemeRegistry-BdjrGBQ4.js";import{r as le}from"./themes-BgDJcxRc.js";import{n as ue}from"./useEffectiveDirectory-CCVmwzs7.js";import{n as de}from"./mobileBackNavigation-Cqz28R4e.js";import{t as fe}from"./ImageLoadingPlaceholder-zzKCgcZz.js";import{n as V,r as pe}from"./MarkdownRenderer-Bjm6Wld2.js";import{a as H,c as me,i as U,o as W}from"./imageSource-Cq_p4gAe.js";import{n as G}from"./markdownTheme-D84XyNiT.js";import{n as K,t as he}from"./markdown-worker-oBGEB9Eg.js";import{t as ge}from"./DiffViewToggle-DYSI03aW.js";import{t as _e}from"./touch-gestures-DOoBxhz5.js";var q=t(m(),1),J=h(),Y=p(),X=e=>e===`in_progress`||e===`completed`||e===`cancelled`?e:`pending`,Z=e=>e.status===`completed`||e.status===`cancelled`,ve={in_progress:`chat.statusRow.todo.status.inProgress`,pending:`chat.statusRow.todo.status.pending`,completed:`chat.statusRow.todo.status.completed`,cancelled:`chat.statusRow.todo.status.cancelled`},ye={in_progress:`text-foreground`,pending:`text-muted-foreground/60`,completed:`text-muted-foreground`,cancelled:`text-muted-foreground/60`},be={in_progress:`text-foreground`,pending:`text-muted-foreground`,completed:`text-muted-foreground/60 line-through decoration-1`,cancelled:`text-muted-foreground/60 line-through decoration-1`},xe=1.2,Se=24,Ce=`1 1`,we=e=>{let t=(0,J.c)(23),{status:n,className:r}=e,{t:i}=P(),a=ve[n],o;t[0]!==i||t[1]!==a?(o=i(a),t[0]=i,t[1]=a,t[2]=o):o=t[2];let s=ye[n],c;t[3]!==r||t[4]!==s?(c=M(`size-[1em] shrink-0 transition-colors duration-300`,s,r),t[3]=r,t[4]=s,t[5]=c):c=t[5];let l=n===`pending`?xe:void 0,u=n===`pending`?Se:void 0,d=n===`pending`?Ce:void 0,f;t[6]!==l||t[7]!==u||t[8]!==d?(f=(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`,stroke:`currentColor`,strokeWidth:l,pathLength:u,strokeDasharray:d}),t[6]=l,t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;t[10]===n?p=t[11]:(p=n===`in_progress`?(0,Y.jsx)(`path`,{d:`M4.8 8h6.4M8.6 5.4 11.2 8l-2.6 2.6`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}):null,t[10]=n,t[11]=p);let m;t[12]===n?m=t[13]:(m=n===`completed`?(0,Y.jsx)(`path`,{d:`M5 8 7.5 11 11 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`}):null,t[12]=n,t[13]=m);let h;t[14]===n?h=t[15]:(h=n===`cancelled`?(0,Y.jsx)(`path`,{d:`M3.5 12.5 12.5 3.5`,stroke:`currentColor`}):null,t[14]=n,t[15]=h);let g;return t[16]!==m||t[17]!==h||t[18]!==o||t[19]!==c||t[20]!==f||t[21]!==p?(g=(0,Y.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,role:`img`,"aria-label":o,className:c,children:[f,p,m,h]}),t[16]=m,t[17]=h,t[18]=o,t[19]=c,t[20]=f,t[21]=p,t[22]=g):g=t[22],g},Te=3.2,Ee=e=>{let t=Math.PI*2*e,n=8+Te*Math.sin(t),r=8-Te*Math.cos(t);return`M8 8 L8 4.8 A${Te} ${Te} 0 ${+(e>.5)} 1 ${n.toFixed(3)} ${r.toFixed(3)} Z`},De=e=>{let t=(0,J.c)(11),{done:n,total:r,spinning:i,className:a}=e,o=n===void 0?0:n,s=r===void 0?0:r,c=i!==void 0&&i,l=s>0?Math.min(1,o/s):0,u;t[0]===a?u=t[1]:(u=M(`size-[1.15em] shrink-0 text-foreground`,a),t[0]=a,t[1]=u);let d=c?`yuri-todo-spin`:void 0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f={transformBox:`fill-box`,transformOrigin:`center`},t[2]=f):f=t[2];let p;t[3]===d?p=t[4]:(p=(0,Y.jsx)(`circle`,{cx:`8`,cy:`8`,r:`6.5`,stroke:`currentColor`,strokeWidth:xe,pathLength:Se,strokeDasharray:Ce,className:d,style:f}),t[3]=d,t[4]=p);let m;t[5]===l?m=t[6]:(m=l>0?(0,Y.jsx)(`path`,{d:Ee(l),fill:`currentColor`,className:`transition-opacity duration-300`}):null,t[5]=l,t[6]=m);let h;return t[7]!==u||t[8]!==p||t[9]!==m?(h=(0,Y.jsxs)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:u,children:[p,m]}),t[7]=u,t[8]=p,t[9]=m,t[10]=h):h=t[10],h},Oe=({done:e,total:t,className:n,animate:r=!0})=>{let i=q.useRef(e),a=r&&i.current!==e;return q.useEffect(()=>{i.current=e},[e]),(0,Y.jsxs)(`span`,{className:M(`shrink-0 tabular-nums`,n),children:[(0,Y.jsx)(`span`,{className:M(a&&`yuri-todo-count-tick`),children:e},e),`/${t}`]})},ke=e=>{let t=(0,J.c)(5),{className:n}=e,r;t[0]===n?r=t[1]:(r=M(`flex size-[1.15em] shrink-0 items-center justify-center rounded-full bg-[var(--status-success)] text-[var(--status-success-foreground)]`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:`size-[70%]`,children:(0,Y.jsx)(`path`,{d:`M4.5 8.2 7 10.8 11.5 5.5`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,Y.jsx)(`span`,{"data-todo-complete":!0,className:r,children:i}),t[3]=r,t[4]=a),a},Ae=e=>{let t=(0,J.c)(27),{todos:n,isWorking:r,animate:i,className:a,rowClassName:o,listRef:s,id:c}=e,l=r!==void 0&&r,u=i!==void 0&&i,{t:d}=P(),f=n.findIndex(je),p;t[0]!==f||t[1]!==n?(p=f>=0?f:n.findIndex(Me),t[0]=f,t[1]=n,t[2]=p):p=t[2];let m=p,h;t[3]===n?h=t[4]:(h=n.some(Ne),t[3]=n,t[4]=h);let g=h,_;t[5]===a?_=t[6]:(_=M(`m-0 flex min-w-0 list-none flex-col gap-[0.125em] p-0`,a),t[5]=a,t[6]=_);let v;if(t[7]!==m||t[8]!==u||t[9]!==g||t[10]!==l||t[11]!==o||t[12]!==d||t[13]!==n){let e;t[15]!==m||t[16]!==u||t[17]!==g||t[18]!==l||t[19]!==o||t[20]!==d?(e=(e,t)=>{let n=X(e.status),r=l&&!g&&t===m&&n===`pending`?`in_progress`:n;return(0,Y.jsxs)(`li`,{"data-status":r,"aria-current":t===m?`step`:void 0,className:M(`grid min-w-0 shrink-0 grid-cols-[auto_minmax(0,1fr)] items-start py-[0.25em]`,o??`gap-[0.6em] px-[0.5em]`,u&&`yuri-todo-row-in`),children:[(0,Y.jsx)(`span`,{className:M(`flex h-[1.32em] w-[1.15em] items-center justify-center`,u&&`yuri-todo-icon-pop`),title:d(ve[r]),children:(0,Y.jsx)(we,{status:r})},r),(0,Y.jsx)(`span`,{dir:`auto`,title:e.content,className:M(`line-clamp-3 min-w-0 whitespace-normal text-[0.88em] break-words leading-[1.5] transition-colors duration-300`,be[r]),children:(0,Y.jsx)(`span`,{className:M(r===`in_progress`&&`animate-text-shimmer`),children:e.content})})]},e.id??`${t}:${e.content}`)},t[15]=m,t[16]=u,t[17]=g,t[18]=l,t[19]=o,t[20]=d,t[21]=e):e=t[21],v=n.map(e),t[7]=m,t[8]=u,t[9]=g,t[10]=l,t[11]=o,t[12]=d,t[13]=n,t[14]=v}else v=t[14];let y;return t[22]!==c||t[23]!==s||t[24]!==_||t[25]!==v?(y=(0,Y.jsx)(`ul`,{id:c,ref:s,className:_,children:v}),t[22]=c,t[23]=s,t[24]=_,t[25]=v,t[26]=y):y=t[26],y};function je(e){return e.status===`in_progress`}function Me(e){return e.status===`pending`}function Ne(e){return e.status===`in_progress`}var Pe=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),Fe=e=>e?Object.entries(e).map(([e,t])=>t==null?``:`${e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}:${typeof t==`number`?`${t}px`:t};`).join(``):``,Ie=(e,t,n)=>{let r=e.querySelector(`pre`);r&&(r.style.margin=`0`,r.style.background=`transparent`,r.style.whiteSpace=t?`pre-wrap`:`pre`,t&&(r.style.wordBreak=`break-word`,r.style.overflowWrap=`break-word`));let i=e.querySelector(`code`);if(i){let e=Fe(n);e&&i.setAttribute(`style`,`${i.getAttribute(`style`)??``}${e}`)}},Le=e=>`<pre><code>${Pe(e)}</code></pre>`,Re=e=>{let t=(0,J.c)(21),{code:n,language:r,className:i,style:a,codeStyle:o,wrap:s}=e,c=s!==void 0&&s,{currentTheme:l}=se(),u=q.useRef(null),d;t[0]===l?d=t[1]:(d=G(l),t[0]=l,t[1]=d);let f=d,p,m;t[2]!==n||t[3]!==o||t[4]!==c?(p=()=>{let e=u.current;e&&(e.innerHTML=Le(n),Ie(e,c,o))},m=[n,c,o],t[2]=n,t[3]=o,t[4]=c,t[5]=p,t[6]=m):(p=t[5],m=t[6]),q.useLayoutEffect(p,m);let h,g;t[7]!==n||t[8]!==o||t[9]!==r||t[10]!==c?(h=()=>{let e=u.current;if(!e)return;let t=!0,i=new AbortController;return he(n,(r||`text`).toLowerCase(),{signal:i.signal,priority:`visible`}).then(n=>{!t||!e||!n||(e.innerHTML=n,Ie(e,c,o))}),()=>{t=!1,i.abort()}},g=[n,r,c,o],t[7]=n,t[8]=o,t[9]=r,t[10]=c,t[11]=h,t[12]=g):(h=t[11],g=t[12]),q.useEffect(h,g);let _;t[13]===i?_=t[14]:(_=M(`typography-code`,i),t[13]=i,t[14]=_);let v=f,y;t[15]!==a||t[16]!==v?(y={...v,...a},t[15]=a,t[16]=v,t[17]=y):y=t[17];let b;return t[18]!==_||t[19]!==y?(b=(0,Y.jsx)(`div`,{ref:u,className:_,style:y}),t[18]=_,t[19]=y,t[20]=b):b=t[20],b},ze=e=>{let t=e.replace(/^<file>\s*\n?/,``).replace(/\n?<\/file>\s*$/,``);return t=t.replace(/^\s*\d{5}\|\s?/gm,``),t.trim()},Be=(e,t=``)=>{if(typeof e==`string`)return e;if(e==null)return t;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return t}},Ve=e=>e?e.includes(`<diagnostics`)||e.includes(`<file_diagnostics>`)||e.includes(`LSP errors detected`)||e.includes(`This file has errors`):!1,He=e=>e?e.replace(/\n{0,2}LSP errors detected[\s\S]*?<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/\n{0,2}This file has errors[\s\S]*?<\/file_diagnostics>/g,``).replace(/<diagnostics[^>]*>[\s\S]*?<\/diagnostics>/g,``).replace(/<file_diagnostics>[\s\S]*?<\/file_diagnostics>/g,``).trim():``,Ue=(e,t)=>!e||typeof e!=`object`?String(e):L(e,t||``),We=e=>{if(typeof e==`string`){let t=e.trim();return t.length>0?t:void 0}if(e&&typeof e==`object`){let t=e.patch;if(typeof t==`string`){let e=t.trim();return e.length>0?e:void 0}}},Ge=e=>{if(!e||typeof e!=`object`)return;let t=We(e.patch)??We(e.diff);if(t)return t;let n=Array.isArray(e.files)?e.files:[];for(let e of n){if(!e||typeof e!=`object`)continue;let t=We(e.patch)??We(e.diff);if(t)return t}},Ke=e=>{if(!e||typeof e!=`string`)return{data:null,isJson:!1};let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`)||!t.endsWith(`}`)&&!t.endsWith(`]`)||t.length<2)return{data:null,isJson:!1};try{let e=JSON.parse(t);return typeof e==`object`&&e?{data:e,isJson:!0}:{data:null,isJson:!1}}catch{return{data:null,isJson:!1}}},qe=(e,t,n)=>{let r=ze(e);if((t===`edit`||t===`multiedit`||t===`write`||t===`apply_patch`)&&Ve(r)&&(r=He(r)),(t===`edit`||t===`multiedit`||t===`apply_patch`)&&r.trim().length===0){let e=Ge(n);if(e)return e}return r},Je=e=>{let t=e.match(/<type>(file|directory)<\/type>/i)?.[1]?.toLowerCase()??`unknown`,n=(e.match(/<content>([\s\S]*?)<\/content>/i)?.[1]??e).replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`),r=e=>/\(\s*File has more lines\..*offset.*\)/i.test(e.trim());return{type:t,lines:n.map(e=>{let n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);if(t!==`directory`){let t=e.match(/^(\d+):\s?(.*)$/);if(t){let e=t[2],n=e.trim(),i=n.startsWith(`(`)&&n.endsWith(`)`)||r(n);return{lineNumber:i?null:Number(t[1]),text:e,isInfo:i}}}return{lineNumber:null,text:e,isInfo:i}}).filter((e,t,n)=>{if(e.text.trim().length>0)return!0;let r=n[t-1],i=n[t+1],a=!!(r?.isInfo||i?.isInfo),o=e.lineNumber!==null;return!(a&&o)})}},Ye=(e,t)=>{try{let n=e.trim().split(`
|
|
4
4
|
`).filter(Boolean);if(n.length===0)return null;let r=[];return n.forEach(e=>{let t=e.match(/^(\s*)(.+)$/);if(t){let[,e,n]=t,i=Math.floor(e.length/2),a=!n.endsWith(`/`);r.push({name:n.replace(/\/$/,``),depth:i,isFile:a})}}),(0,Y.jsx)(`div`,{className:M(`w-full min-w-0 font-mono space-y-0.5`,t?.unstyled?null:`p-3 bg-muted/20 rounded-xl border border-border/30`),style:T.tool.popup,children:r.map((e,t)=>(0,Y.jsx)(`div`,{className:`min-w-0`,style:{paddingLeft:`${e.depth*20}px`},children:e.isFile?(0,Y.jsx)(`span`,{className:`text-foreground/90 block truncate`,children:e.name}):(0,Y.jsxs)(`span`,{className:`font-semibold text-foreground block truncate`,children:[e.name,`/`]})},t))})}catch{return null}},Xe={backgroundColor:`var(--status-info)`,opacity:.6},Ze=(e,t,n)=>{try{let r=e.trim().split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-wXsskyKm.js";import{n as r}from"./vendor-react-BkccXcWz.js";import{t as i}from"./i18n-DXc6czdR.js";import{t as a}from"./useThemeSystem-BIXghnHj.js";var o=r(),s=e(n(),1),c=(0,s.createContext)(null),l=t(),u=e=>{let t=(0,o.c)(22),{className:n,width:r,height:u,isAnimated:d}=e,f=n===void 0?``:n,p=r===void 0?70:r,m=u===void 0?70:u,h=d!==void 0&&d,{t:g}=i(),_=a(),v=s.useContext(c),y=_?_.currentTheme.metadata.variant!==`light`:typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;if(v?.logo){let e=v.logo,n;t[0]===g?n=t[1]:(n=g(`yuriLogo.aria.logo`),t[0]=g,t[1]=n);let r;return t[2]!==v.logo||t[3]!==f||t[4]!==m||t[5]!==n||t[6]!==p?(r=(0,l.jsx)(`img`,{src:e,width:p,height:m,className:f,alt:n,"data-yuri-logo":!0}),t[2]=v.logo,t[3]=f,t[4]=m,t[5]=n,t[6]=p,t[7]=r):r=t[7],r}let b;t[8]===g?b=t[9]:(b=g(`yuriLogo.aria.logo`),t[8]=g,t[9]=b);let x;t[10]===h?x=t[11]:(x=h?(0,l.jsx)(`style`,{children:`@keyframes yuri-logo-breathe{50%{opacity:.65}}.yuri-logo-breathe{animation:yuri-logo-breathe 1.8s ease-in-out infinite}@media(prefers-reduced-motion:reduce){.yuri-logo-breathe{animation:none}}`}):null,t[10]=h,t[11]=x);let S=y?`white`:`black`,C=h?`yuri-logo-breathe`:void 0,w;t[12]!==S||t[13]!==C?(w=(0,l.jsx)(`path`,{fill:S,fillRule:`evenodd`,className:C,d:`M48.34 6.03L47.62 6.07L46.95 6.12L46.64 6.15L46.20 6.21L45.36 6.34L44.97 6.42L44.61 6.48L43.53 6.73L43.27 6.79L43.01 6.86L42.16 7.13L41.77 7.24L41.22 7.41L40.38 7.70L39.25 8.13L38.84 8.30L38.28 8.57L37.62 8.85L37.30 9.01L36.95 9.20L36.25 9.59L35.44 10.06L34.74 10.46L34.40 10.67L33.76 11.16L33.51 11.34L32.95 11.71L32.41 12.10L31.98 12.42L31.81 12.56L31.64 12.71L31.06 13.26L30.53 13.75L29.89 14.37L29.30 14.91L29.11 15.10L28.90 15.33L28.71 15.57L28.17 16.29L27.78 16.77L27.42 17.22L27.26 17.44L26.87 17.99L26.58 18.43L26.27 18.87L25.98 19.32L25.77 19.71L25.04 21.09L24.83 21.54L24.51 22.27L24.32 22.73L24.11 23.31L23.97 23.69L23.84 24.11L23.62 24.79L23.45 25.39L23.37 25.79L23.26 26.22L23.20 26.52L23.10 27.10L23.04 27.49L22.92 28.38L22.88 28.87L22.85 29.36L22.84 29.89L22.83 30.38L22.83 31.01L22.84 31.45L22.87 31.85L22.89 32.21L23.02 33.41L23.08 33.89L23.14 34.20L23.24 34.63L23.36 35.06L23.46 35.50L23.62 36.10L23.79 36.66L23.96 37.16L24.14 37.67L24.41 38.37L24.55 38.70L24.93 39.51L25.38 40.48L25.73 41.20L25.85 41.44L26.10 41.86L26.38 42.32L26.89 43.21L27.25 43.83L27.50 44.30L27.83 44.88L27.96 45.16L28.19 45.65L28.34 46.02L28.52 46.48L28.66 46.90L28.85 47.54L29.02 48.19L29.06 48.41L29.14 48.89L29.23 49.42L29.27 49.82L29.30 50.58L29.30 51.24L29.27 52.09L29.25 52.45L29.23 52.67L29.15 53.38L29.06 53.99L28.78 55.40L28.71 55.79L28.52 56.62L28.36 57.22L28.11 57.93L27.59 59.31L27.47 59.60L27.33 59.88L26.73 61.12L26.64 61.28L26.25 61.92L25.96 62.38L25.53 63.10L25.31 63.44L24.96 63.96L23.92 65.41L23.70 65.69L23.25 66.19L23.05 66.42L22.89 66.64L22.52 67.14L22.14 67.58L21.72 68.10L21.36 68.56L21.25 68.70L21.23 68.74L21.23 68.78L21.26 68.82L21.30 68.83L21.34 68.83L22.18 68.73L23.16 68.63L23.38 68.61L24.10 68.60L25.08 68.60L25.43 68.61L25.97 68.64L26.63 68.72L27.08 68.75L27.25 68.78L28.22 68.92L29.19 69.11L29.41 69.15L30.10 69.33L30.70 69.49L31.08 69.61L31.72 69.81L32.23 69.99L32.97 70.28L33.75 70.61L34.40 70.92L34.80 71.11L35.31 71.38L36.00 71.79L36.55 72.09L36.85 72.28L37.58 72.79L38.10 73.14L38.46 73.41L38.70 73.60L39.82 74.49L40.06 74.68L40.49 75.00L40.77 75.22L41.10 75.52L41.55 75.96L41.98 76.35L42.17 76.53L42.39 76.76L42.72 77.18L42.90 77.38L43.02 77.51L43.47 77.94L43.74 78.24L44.15 78.71L44.64 79.29L44.98 79.71L45.13 79.92L45.26 80.16L45.28 80.20L45.29 80.24L45.27 80.27L45.23 80.29L45.19 80.27L44.95 80.08L44.75 79.90L44.40 79.56L44.07 79.26L43.64 78.87L43.44 78.70L42.77 78.16L42.42 77.89L41.51 77.25L40.74 76.64L39.96 76.05L39.26 75.58L38.54 75.12L37.39 74.44L36.59 73.96L36.31 73.81L35.95 73.63L34.83 73.09L33.89 72.67L33.57 72.52L33.11 72.34L31.78 71.84L31.61 71.78L31.23 71.66L30.79 71.55L29.81 71.27L29.20 71.11L29.03 71.07L28.33 70.93L27.71 70.84L27.32 70.77L27.10 70.74L26.83 70.71L26.39 70.68L25.86 70.61L25.28 70.57L24.96 70.56L24.52 70.56L24.03 70.56L23.76 70.58L23.10 70.64L22.30 70.73L22.08 70.76L21.15 70.92L20.72 71.03L20.33 71.12L19.74 71.31L19.15 71.51L18.77 71.64L18.40 71.80L17.87 72.03L17.71 72.11L17.55 72.20L17.21 72.41L16.74 72.75L16.22 73.09L15.90 73.33L15.61 73.54L15.30 73.80L14.97 74.09L14.52 74.53L14.27 74.78L13.90 75.23L13.34 75.92L13.09 76.24L12.89 76.53L12.31 77.49L12.16 77.76L12.06 77.96L11.97 78.16L11.86 78.45L11.84 78.49L11.84 78.54L11.85 78.58L11.88 78.61L11.93 78.62L12.88 78.37L13.40 78.26L14.01 78.14L14.54 78.03L14.84 77.97L15.59 77.87L16.57 77.77L17.32 77.67L17.50 77.66L17.72 77.65L18.52 77.63L19.82 77.63L20.58 77.63L21.87 77.67L22.31 77.70L22.62 77.72L23.65 77.82L24.00 77.86L24.57 77.95L25.24 78.04L25.98 78.16L26.42 78.24L26.91 78.33L27.26 78.39L27.65 78.47L28.13 78.56L28.57 78.67L28.96 78.74L29.31 78.83L29.74 78.92L30.12 79.04L30.94 79.26L31.54 79.44L32.18 79.64L32.98 79.91L33.79 80.15L33.96 80.21L35.30 80.71L36.63 81.22L37.04 81.39L37.58 81.60L38.49 81.98L39.48 82.39L39.92 82.59L40.36 82.81L40.60 82.92L41.18 83.18L41.92 83.49L42.44 83.73L42.84 83.92L43.73 84.34L44.42 84.66L45.15 85.00L45.51 85.18L46.29 85.60L46.66 85.77L47.13 86.01L47.74 86.29L48.22 86.52L49.54 87.17L50.10 87.46L50.94 87.87L52.09 88.45L53.85 89.22L54.05 89.31L54.52 89.56L54.88 89.74L55.21 89.89L55.58 90.05L56.65 90.50L57.21 90.77L57.70 90.99L58.15 91.17L58.48 91.31L58.94 91.47L59.54 91.67L59.92 91.79L60.30 91.92L60.88 92.13L61.59 92.40L62.01 92.55L62.78 92.78L63.99 93.10L64.68 93.28L65.12 93.37L65.55 93.47L66.25 93.62L67.39 93.81L67.75 93.85L68.06 93.88L69.17 93.95L69.70 93.99L70.02 94.00L70.24 93.99L70.28 93.98L70.32 93.96L70.31 93.92L70.28 93.89L70.21 93.84L70.09 93.79L69.55 93.57L69.06 93.35L68.46 93.06L66.66 92.08L66.00 91.71L65.73 91.55L65.35 91.31L64.91 91.01L64.23 90.58L63.75 90.25L63.32 89.94L63.03 89.73L61.99 88.89L61.42 88.46L61.01 88.12L60.74 87.88L60.22 87.39L59.66 86.82L59.10 86.24L58.62 85.78L58.43 85.59L58.24 85.40L57.95 85.06L57.51 84.56L57.09 84.04L56.42 83.25L56.03 82.77L55.87 82.56L55.64 82.23L55.40 81.91L54.98 81.28L54.78 80.98L54.25 80.10L54.00 79.68L53.37 78.55L53.20 78.23L52.81 77.43L52.64 77.07L52.48 76.66L52.12 75.69L51.96 75.23L51.85 74.89L51.76 74.60L51.60 74.04L51.41 73.21L51.34 72.82L51.25 72.38L51.14 71.77L50.98 71.03L50.79 70.29L50.61 69.65L50.45 69.14L50.26 68.59L50.00 67.97L49.91 67.77L49.82 67.61L49.60 67.23L49.21 66.63L49.05 66.42L48.85 66.17L48.71 66.00L48.56 65.84L48.18 65.46L47.95 65.25L47.74 65.08L46.72 64.29L46.52 64.11L46.12 63.75L45.29 62.94L45.10 62.75L44.65 62.26L44.37 61.91L43.99 61.41L43.64 60.90L43.38 60.48L43.16 60.10L43.03 59.86L42.63 59.06L42.31 58.33L42.23 58.12L42.16 57.91L42.15 57.87L42.15 57.82L42.17 57.78L42.21 57.77L42.25 57.78L42.32 57.84L42.41 57.94L42.49 58.04L42.67 58.30L42.80 58.48L43.19 58.96L43.99 59.86L44.18 60.05L44.38 60.24L44.55 60.38L45.02 60.78L45.97 61.60L46.35 61.91L46.63 62.13L46.99 62.39L47.56 62.75L47.79 62.88L49.13 63.59L49.77 63.91L50.54 64.27L51.31 64.62L51.59 64.74L51.97 64.89L53.02 65.27L53.77 65.53L54.40 65.77L55.12 66.01L55.67 66.18L56.58 66.42L57.52 66.70L59.15 67.14L59.84 67.35L60.30 67.51L60.75 67.69L60.96 67.78L61.20 67.90L61.40 68.00L61.59 68.11L61.81 68.26L62.10 68.47L62.28 68.61L62.41 68.72L62.66 68.97L62.81 69.14L62.93 69.28L63.06 69.46L63.21 69.68L64.12 71.16L64.32 71.46L64.45 71.64L64.65 71.88L65.19 72.53L65.49 72.86L65.84 73.20L66.11 73.44L66.31 73.61L66.91 74.08L67.41 74.45L67.67 74.63L68.04 74.87L68.23 74.98L68.28 74.99L68.32 74.97L68.32 74.92L68.32 74.88L68.31 74.84L68.23 74.67L67.56 73.27L67.47 73.06L67.27 72.52L67.16 72.23L66.93 71.46L66.89 71.28L66.85 71.06L66.81 70.75L66.79 70.49L66.78 70.27L66.77 70.00L66.77 69.60L66.78 69.37L66.81 68.97L66.84 68.71L66.90 68.40L66.95 68.14L67.06 67.75L67.12 67.54L67.27 67.12L67.44 66.66L67.51 66.49L67.61 66.29L67.98 65.58L68.38 64.78L68.51 64.50L68.57 64.38L68.64 64.27L68.74 64.12L68.77 64.09L68.81 64.08L68.85 64.11L68.86 64.16L68.85 64.20L68.83 64.33L68.79 64.46L68.73 64.67L68.60 65.05L68.51 65.35L68.39 65.78L68.33 66.04L68.21 66.61L68.07 67.49L68.01 67.98L67.98 68.29L67.96 68.87L67.96 69.31L67.98 69.76L68.01 70.11L68.06 70.47L68.18 71.03L68.22 71.21L68.37 71.72L68.43 71.89L68.53 72.14L68.75 72.63L68.93 72.98L69.39 73.80L69.56 74.11L69.75 74.51L70.07 75.20L70.25 75.71L70.69 76.97L71.04 77.88L71.14 78.18L71.28 78.65L71.46 79.20L71.58 79.54L71.69 79.78L71.78 79.98L71.94 80.30L72.22 80.81L72.62 81.56L72.82 81.91L72.98 82.17L73.30 82.66L73.62 83.14L73.81 83.39L74.24 83.96L74.41 84.17L74.58 84.37L74.83 84.63L75.05 84.84L75.26 85.02L75.30 85.04L75.34 85.05L75.37 85.02L75.37 84.98L75.36 84.94L75.24 84.65L74.99 84.08L74.62 83.21L74.43 82.67L74.06 81.57L73.92 81.01L73.69 79.91L73.57 79.26L73.52 78.90L73.37 77.53L73.33 77.17L73.32 76.86L73.29 76.06L73.28 75.75L73.29 75.44L73.32 74.81L73.34 74.55L73.57 72.78L73.69 72.07L73.82 71.46L73.98 70.54L74.02 70.28L74.10 69.70L74.17 69.04L74.20 68.64L74.22 68.14L74.21 67.83L74.20 67.61L74.19 67.39L74.14 66.99L74.01 66.20L73.95 65.94L73.83 65.51L73.67 65.05L73.51 64.68L73.27 64.19L72.81 63.28L72.70 63.04L72.65 62.91L72.59 62.75L72.54 62.53L72.51 62.35L72.50 62.18L72.50 62.00L72.50 61.86L72.52 61.69L72.55 61.56L72.58 61.43L72.65 61.26L72.72 61.10L72.81 60.94L72.93 60.76L73.02 60.66L73.11 60.56L73.31 60.38L73.69 60.08L73.82 59.95L73.93 59.82L73.98 59.74L74.02 59.66L74.06 59.58L74.10 59.46L74.12 59.33L74.14 59.24L74.14 59.15L74.14 59.06L74.12 58.97L74.09 58.84L74.05 58.72L74.02 58.63L73.96 58.52L73.91 58.44L73.83 58.33L73.78 58.27L73.68 58.18L73.61 58.13L73.53 58.08L73.45 58.05L73.28 58.00L73.06 57.97L72.74 57.96L72.48 57.97L72.25 57.99L71.86 58.03L71.59 58.08L70.33 58.35L70.11 58.41L69.47 58.59L69.17 58.69L68.58 58.87L68.44 58.89L68.31 58.91L68.27 58.90L68.25 58.87L68.26 58.83L68.28 58.80L68.46 58.66L68.67 58.50L68.93 58.32L69.20 58.16L69.59 57.95L69.79 57.85L70.00 57.76L70.20 57.69L71.26 57.34L71.78 57.19L71.95 57.15L72.56 57.02L72.78 56.98L73.14 56.94L73.71 56.90L73.85 56.88L73.97 56.85L74.10 56.81L74.22 56.75L74.34 56.69L74.46 56.62L74.57 56.55L74.67 56.47L74.77 56.38L74.83 56.31L74.89 56.25L74.97 56.14L75.05 55.98L75.11 55.81L75.13 55.73L75.15 55.60L75.16 55.46L75.16 55.33L75.14 54.93L75.10 54.49L75.07 54.31L75.05 54.18L75.00 54.01L74.92 53.80L74.85 53.64L74.76 53.48L74.61 53.26L74.44 53.05L74.23 52.82L73.98 52.57L73.89 52.47L73.86 52.43L73.85 52.39L73.86 52.35L73.88 52.31L73.92 52.29L73.96 52.28L74.09 52.26L74.27 52.26L74.58 52.26L74.94 52.29L75.11 52.31L75.29 52.35L75.59 52.41L75.94 52.48L76.51 52.61L76.86 52.67L77.17 52.70L77.48 52.72L77.75 52.71L77.97 52.68L78.19 52.64L78.36 52.59L78.53 52.53L78.69 52.45L78.85 52.37L79.00 52.27L79.10 52.19L79.20 52.10L79.29 52.00L79.36 51.89L79.45 51.73L79.50 51.61L79.54 51.48L79.57 51.35L79.58 51.22L79.57 51.09L79.56 50.91L79.53 50.78L79.50 50.65L79.36 50.13L79.25 49.75L79.13 49.27L78.88 48.47L78.48 47.14L78.34 46.72L78.08 45.86L77.99 45.57L77.89 45.22L77.64 44.41L77.48 43.86L77.37 43.42L77.27 43.08L77.11 42.48L76.94 41.83L76.86 41.44L76.77 41.09L76.69 40.66L76.56 40.09L76.39 39.21L76.25 38.47L76.18 38.16L76.14 38.04L76.08 37.87L75.99 37.72L75.88 37.53L75.59 37.13L75.39 36.88L75.28 36.75L75.04 36.49L74.65 36.12L74.48 35.97L74.30 35.84L73.80 35.47L73.35 35.17L72.97 34.95L72.42 34.66L71.81 34.38L70.44 33.83L69.90 33.62L69.39 33.45L68.28 33.11L67.77 32.98L67.64 32.93L67.48 32.86L67.44 32.84L67.41 32.81L67.41 32.78L67.44 32.75L67.49 32.74L67.71 32.73L67.98 32.74L68.20 32.77L68.82 32.86L69.30 32.93L70.14 33.07L70.84 33.21L71.10 33.28L72.17 33.58L72.72 33.75L72.94 33.81L73.44 33.99L73.65 34.07L73.86 34.15L74.54 34.48L74.94 34.67L75.30 34.86L75.69 35.08L75.99 35.27L76.28 35.48L76.58 35.74L76.98 36.10L77.21 36.30L77.32 36.38L77.40 36.40L77.48 36.41L77.56 36.39L77.63 36.35L77.74 36.28L77.84 36.19L77.96 36.06L78.07 35.92L78.14 35.80L78.20 35.69L78.26 35.56L78.30 35.44L78.33 35.31L78.35 35.18L78.36 35.04L78.34 34.73L78.31 34.51L78.28 34.34L78.03 33.25L77.92 32.64L77.82 32.20L77.79 32.02L77.77 31.80L77.72 31.27L77.65 30.16L77.57 29.18L77.39 27.94L77.36 27.72L77.28 27.33L77.20 26.89L77.04 26.20L77.00 26.02L76.85 25.51L76.69 24.95L76.49 24.36L76.40 24.11L76.31 23.81L76.23 23.60L76.14 23.39L76.05 23.19L75.61 22.27L75.23 21.51L74.93 20.96L74.38 19.99L73.64 18.82L73.18 18.17L72.96 17.89L72.11 16.91L71.27 15.87L70.77 15.30L70.49 15.02L70.16 14.71L69.60 14.20L69.17 13.81L68.94 13.60L68.54 13.25L68.16 12.94L67.75 12.59L67.54 12.42L67.22 12.18L66.68 11.79L65.94 11.29L65.20 10.79L64.71 10.48L64.05 10.10L62.65 9.33L62.29 9.14L62.01 9.01L61.73 8.87L60.87 8.51L60.34 8.27L59.93 8.08L59.61 7.94L59.15 7.77L58.13 7.42L57.79 7.32L57.50 7.23L56.86 7.03L56.26 6.86L55.39 6.64L54.74 6.49L54.34 6.42L53.86 6.33L53.29 6.24L52.58 6.15L52.36 6.12L51.11 6.04L50.53 6.01L50.13 6.00L49.38 6.00L48.66 6.01ZM84.78 23.79L84.64 23.81L84.51 23.84L84.08 23.95L83.87 24.03L83.63 24.14L83.51 24.21L83.40 24.28L83.18 24.44L82.99 24.62L82.84 24.79L82.66 25.04L82.52 25.27L82.46 25.39L82.39 25.55L82.33 25.72L82.28 25.84L82.18 26.23L82.13 26.49L82.12 26.63L82.11 26.76L82.12 26.89L82.13 27.07L82.15 27.20L82.18 27.38L82.23 27.60L82.28 27.77L82.36 27.98L82.49 28.26L82.55 28.38L82.62 28.49L82.70 28.60L82.79 28.70L82.97 28.90L83.07 28.99L83.20 29.10L83.42 29.26L83.54 29.32L83.66 29.39L84.06 29.57L84.19 29.61L84.32 29.65L84.58 29.70L84.71 29.72L84.84 29.73L85.16 29.74L85.33 29.73L85.47 29.71L85.82 29.65L86.03 29.60L86.16 29.55L86.36 29.47L86.61 29.35L86.76 29.26L86.91 29.16L87.16 28.98L87.43 28.74L87.52 28.65L87.61 28.55L87.73 28.36L87.88 28.09L87.99 27.84L88.04 27.67L88.08 27.55L88.13 27.28L88.15 27.11L88.16 26.97L88.16 26.66L88.14 26.35L88.10 26.09L88.07 25.95L88.03 25.83L87.92 25.53L87.87 25.41L87.78 25.25L87.72 25.14L87.64 25.03L87.48 24.82L87.29 24.63L87.08 24.46L86.83 24.28L86.59 24.15L86.35 24.04L86.10 23.95L85.62 23.83L85.40 23.79L85.27 23.78L85.09 23.77L84.91 23.78ZM63.90 37.84L63.95 37.83L63.99 37.83L64.15 37.92L64.63 38.23L65.01 38.47L65.60 38.87L66.10 39.16L66.54 39.39L66.78 39.50L67.02 39.61L67.44 39.77L68.36 40.10L68.88 40.25L69.05 40.30L69.22 40.34L69.92 40.46L70.15 40.49L70.37 40.52L71.66 40.61L72.15 40.63L72.59 40.62L72.68 40.63L72.72 40.65L72.75 40.68L72.77 40.72L72.76 40.77L72.74 40.81L72.71 40.84L72.60 40.91L72.41 41.03L72.22 41.13L72.01 41.22L71.68 41.35L71.51 41.41L71.00 41.56L70.87 41.59L70.65 41.62L70.25 41.67L69.98 41.69L69.63 41.68L69.31 41.66L69.00 41.62L68.83 41.59L68.66 41.55L68.11 41.37L67.78 41.24L67.41 41.07L67.09 40.91L66.82 40.76L66.63 40.64L66.45 40.51L65.95 40.13L65.68 39.90L65.38 39.64L65.05 39.33L64.77 39.04L64.51 38.74L64.11 38.26L63.92 38.01L63.90 37.98L63.88 37.93L63.88 37.89Z`}),t[12]=S,t[13]=C,t[14]=w):w=t[14];let T;return t[15]!==f||t[16]!==m||t[17]!==b||t[18]!==x||t[19]!==w||t[20]!==p?(T=(0,l.jsxs)(`svg`,{width:p,height:m,viewBox:`0 0 100 100`,xmlns:`http://www.w3.org/2000/svg`,className:f,role:`img`,"aria-label":b,"data-yuri-logo":!0,children:[x,w]}),t[15]=f,t[16]=m,t[17]=b,t[18]=x,t[19]=w,t[20]=p,t[21]=T):T=t[21],T};export{c as n,u as t};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-wXsskyKm.js";import{n as r}from"./vendor-react-BkccXcWz.js";import{t as i}from"./i18n-BcqhT5IQ.js";import{t as a}from"./useThemeSystem-BIXghnHj.js";var o=r(),s=e(n(),1),c=(0,s.createContext)(null),l=t(),u=e=>{let t=(0,o.c)(22),{className:n,width:r,height:u,isAnimated:d}=e,f=n===void 0?``:n,p=r===void 0?70:r,m=u===void 0?70:u,h=d!==void 0&&d,{t:g}=i(),_=a(),v=s.useContext(c),y=_?_.currentTheme.metadata.variant!==`light`:typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;if(v?.logo){let e=v.logo,n;t[0]===g?n=t[1]:(n=g(`yuriLogo.aria.logo`),t[0]=g,t[1]=n);let r;return t[2]!==v.logo||t[3]!==f||t[4]!==m||t[5]!==n||t[6]!==p?(r=(0,l.jsx)(`img`,{src:e,width:p,height:m,className:f,alt:n,"data-yuri-logo":!0}),t[2]=v.logo,t[3]=f,t[4]=m,t[5]=n,t[6]=p,t[7]=r):r=t[7],r}let b;t[8]===g?b=t[9]:(b=g(`yuriLogo.aria.logo`),t[8]=g,t[9]=b);let x;t[10]===h?x=t[11]:(x=h?(0,l.jsx)(`style`,{children:`@keyframes yuri-logo-breathe{50%{opacity:.65}}.yuri-logo-breathe{animation:yuri-logo-breathe 1.8s ease-in-out infinite}@media(prefers-reduced-motion:reduce){.yuri-logo-breathe{animation:none}}`}):null,t[10]=h,t[11]=x);let S=y?`white`:`black`,C=h?`yuri-logo-breathe`:void 0,w;t[12]!==S||t[13]!==C?(w=(0,l.jsx)(`path`,{fill:S,fillRule:`evenodd`,className:C,d:`M48.34 6.03L47.62 6.07L46.95 6.12L46.64 6.15L46.20 6.21L45.36 6.34L44.97 6.42L44.61 6.48L43.53 6.73L43.27 6.79L43.01 6.86L42.16 7.13L41.77 7.24L41.22 7.41L40.38 7.70L39.25 8.13L38.84 8.30L38.28 8.57L37.62 8.85L37.30 9.01L36.95 9.20L36.25 9.59L35.44 10.06L34.74 10.46L34.40 10.67L33.76 11.16L33.51 11.34L32.95 11.71L32.41 12.10L31.98 12.42L31.81 12.56L31.64 12.71L31.06 13.26L30.53 13.75L29.89 14.37L29.30 14.91L29.11 15.10L28.90 15.33L28.71 15.57L28.17 16.29L27.78 16.77L27.42 17.22L27.26 17.44L26.87 17.99L26.58 18.43L26.27 18.87L25.98 19.32L25.77 19.71L25.04 21.09L24.83 21.54L24.51 22.27L24.32 22.73L24.11 23.31L23.97 23.69L23.84 24.11L23.62 24.79L23.45 25.39L23.37 25.79L23.26 26.22L23.20 26.52L23.10 27.10L23.04 27.49L22.92 28.38L22.88 28.87L22.85 29.36L22.84 29.89L22.83 30.38L22.83 31.01L22.84 31.45L22.87 31.85L22.89 32.21L23.02 33.41L23.08 33.89L23.14 34.20L23.24 34.63L23.36 35.06L23.46 35.50L23.62 36.10L23.79 36.66L23.96 37.16L24.14 37.67L24.41 38.37L24.55 38.70L24.93 39.51L25.38 40.48L25.73 41.20L25.85 41.44L26.10 41.86L26.38 42.32L26.89 43.21L27.25 43.83L27.50 44.30L27.83 44.88L27.96 45.16L28.19 45.65L28.34 46.02L28.52 46.48L28.66 46.90L28.85 47.54L29.02 48.19L29.06 48.41L29.14 48.89L29.23 49.42L29.27 49.82L29.30 50.58L29.30 51.24L29.27 52.09L29.25 52.45L29.23 52.67L29.15 53.38L29.06 53.99L28.78 55.40L28.71 55.79L28.52 56.62L28.36 57.22L28.11 57.93L27.59 59.31L27.47 59.60L27.33 59.88L26.73 61.12L26.64 61.28L26.25 61.92L25.96 62.38L25.53 63.10L25.31 63.44L24.96 63.96L23.92 65.41L23.70 65.69L23.25 66.19L23.05 66.42L22.89 66.64L22.52 67.14L22.14 67.58L21.72 68.10L21.36 68.56L21.25 68.70L21.23 68.74L21.23 68.78L21.26 68.82L21.30 68.83L21.34 68.83L22.18 68.73L23.16 68.63L23.38 68.61L24.10 68.60L25.08 68.60L25.43 68.61L25.97 68.64L26.63 68.72L27.08 68.75L27.25 68.78L28.22 68.92L29.19 69.11L29.41 69.15L30.10 69.33L30.70 69.49L31.08 69.61L31.72 69.81L32.23 69.99L32.97 70.28L33.75 70.61L34.40 70.92L34.80 71.11L35.31 71.38L36.00 71.79L36.55 72.09L36.85 72.28L37.58 72.79L38.10 73.14L38.46 73.41L38.70 73.60L39.82 74.49L40.06 74.68L40.49 75.00L40.77 75.22L41.10 75.52L41.55 75.96L41.98 76.35L42.17 76.53L42.39 76.76L42.72 77.18L42.90 77.38L43.02 77.51L43.47 77.94L43.74 78.24L44.15 78.71L44.64 79.29L44.98 79.71L45.13 79.92L45.26 80.16L45.28 80.20L45.29 80.24L45.27 80.27L45.23 80.29L45.19 80.27L44.95 80.08L44.75 79.90L44.40 79.56L44.07 79.26L43.64 78.87L43.44 78.70L42.77 78.16L42.42 77.89L41.51 77.25L40.74 76.64L39.96 76.05L39.26 75.58L38.54 75.12L37.39 74.44L36.59 73.96L36.31 73.81L35.95 73.63L34.83 73.09L33.89 72.67L33.57 72.52L33.11 72.34L31.78 71.84L31.61 71.78L31.23 71.66L30.79 71.55L29.81 71.27L29.20 71.11L29.03 71.07L28.33 70.93L27.71 70.84L27.32 70.77L27.10 70.74L26.83 70.71L26.39 70.68L25.86 70.61L25.28 70.57L24.96 70.56L24.52 70.56L24.03 70.56L23.76 70.58L23.10 70.64L22.30 70.73L22.08 70.76L21.15 70.92L20.72 71.03L20.33 71.12L19.74 71.31L19.15 71.51L18.77 71.64L18.40 71.80L17.87 72.03L17.71 72.11L17.55 72.20L17.21 72.41L16.74 72.75L16.22 73.09L15.90 73.33L15.61 73.54L15.30 73.80L14.97 74.09L14.52 74.53L14.27 74.78L13.90 75.23L13.34 75.92L13.09 76.24L12.89 76.53L12.31 77.49L12.16 77.76L12.06 77.96L11.97 78.16L11.86 78.45L11.84 78.49L11.84 78.54L11.85 78.58L11.88 78.61L11.93 78.62L12.88 78.37L13.40 78.26L14.01 78.14L14.54 78.03L14.84 77.97L15.59 77.87L16.57 77.77L17.32 77.67L17.50 77.66L17.72 77.65L18.52 77.63L19.82 77.63L20.58 77.63L21.87 77.67L22.31 77.70L22.62 77.72L23.65 77.82L24.00 77.86L24.57 77.95L25.24 78.04L25.98 78.16L26.42 78.24L26.91 78.33L27.26 78.39L27.65 78.47L28.13 78.56L28.57 78.67L28.96 78.74L29.31 78.83L29.74 78.92L30.12 79.04L30.94 79.26L31.54 79.44L32.18 79.64L32.98 79.91L33.79 80.15L33.96 80.21L35.30 80.71L36.63 81.22L37.04 81.39L37.58 81.60L38.49 81.98L39.48 82.39L39.92 82.59L40.36 82.81L40.60 82.92L41.18 83.18L41.92 83.49L42.44 83.73L42.84 83.92L43.73 84.34L44.42 84.66L45.15 85.00L45.51 85.18L46.29 85.60L46.66 85.77L47.13 86.01L47.74 86.29L48.22 86.52L49.54 87.17L50.10 87.46L50.94 87.87L52.09 88.45L53.85 89.22L54.05 89.31L54.52 89.56L54.88 89.74L55.21 89.89L55.58 90.05L56.65 90.50L57.21 90.77L57.70 90.99L58.15 91.17L58.48 91.31L58.94 91.47L59.54 91.67L59.92 91.79L60.30 91.92L60.88 92.13L61.59 92.40L62.01 92.55L62.78 92.78L63.99 93.10L64.68 93.28L65.12 93.37L65.55 93.47L66.25 93.62L67.39 93.81L67.75 93.85L68.06 93.88L69.17 93.95L69.70 93.99L70.02 94.00L70.24 93.99L70.28 93.98L70.32 93.96L70.31 93.92L70.28 93.89L70.21 93.84L70.09 93.79L69.55 93.57L69.06 93.35L68.46 93.06L66.66 92.08L66.00 91.71L65.73 91.55L65.35 91.31L64.91 91.01L64.23 90.58L63.75 90.25L63.32 89.94L63.03 89.73L61.99 88.89L61.42 88.46L61.01 88.12L60.74 87.88L60.22 87.39L59.66 86.82L59.10 86.24L58.62 85.78L58.43 85.59L58.24 85.40L57.95 85.06L57.51 84.56L57.09 84.04L56.42 83.25L56.03 82.77L55.87 82.56L55.64 82.23L55.40 81.91L54.98 81.28L54.78 80.98L54.25 80.10L54.00 79.68L53.37 78.55L53.20 78.23L52.81 77.43L52.64 77.07L52.48 76.66L52.12 75.69L51.96 75.23L51.85 74.89L51.76 74.60L51.60 74.04L51.41 73.21L51.34 72.82L51.25 72.38L51.14 71.77L50.98 71.03L50.79 70.29L50.61 69.65L50.45 69.14L50.26 68.59L50.00 67.97L49.91 67.77L49.82 67.61L49.60 67.23L49.21 66.63L49.05 66.42L48.85 66.17L48.71 66.00L48.56 65.84L48.18 65.46L47.95 65.25L47.74 65.08L46.72 64.29L46.52 64.11L46.12 63.75L45.29 62.94L45.10 62.75L44.65 62.26L44.37 61.91L43.99 61.41L43.64 60.90L43.38 60.48L43.16 60.10L43.03 59.86L42.63 59.06L42.31 58.33L42.23 58.12L42.16 57.91L42.15 57.87L42.15 57.82L42.17 57.78L42.21 57.77L42.25 57.78L42.32 57.84L42.41 57.94L42.49 58.04L42.67 58.30L42.80 58.48L43.19 58.96L43.99 59.86L44.18 60.05L44.38 60.24L44.55 60.38L45.02 60.78L45.97 61.60L46.35 61.91L46.63 62.13L46.99 62.39L47.56 62.75L47.79 62.88L49.13 63.59L49.77 63.91L50.54 64.27L51.31 64.62L51.59 64.74L51.97 64.89L53.02 65.27L53.77 65.53L54.40 65.77L55.12 66.01L55.67 66.18L56.58 66.42L57.52 66.70L59.15 67.14L59.84 67.35L60.30 67.51L60.75 67.69L60.96 67.78L61.20 67.90L61.40 68.00L61.59 68.11L61.81 68.26L62.10 68.47L62.28 68.61L62.41 68.72L62.66 68.97L62.81 69.14L62.93 69.28L63.06 69.46L63.21 69.68L64.12 71.16L64.32 71.46L64.45 71.64L64.65 71.88L65.19 72.53L65.49 72.86L65.84 73.20L66.11 73.44L66.31 73.61L66.91 74.08L67.41 74.45L67.67 74.63L68.04 74.87L68.23 74.98L68.28 74.99L68.32 74.97L68.32 74.92L68.32 74.88L68.31 74.84L68.23 74.67L67.56 73.27L67.47 73.06L67.27 72.52L67.16 72.23L66.93 71.46L66.89 71.28L66.85 71.06L66.81 70.75L66.79 70.49L66.78 70.27L66.77 70.00L66.77 69.60L66.78 69.37L66.81 68.97L66.84 68.71L66.90 68.40L66.95 68.14L67.06 67.75L67.12 67.54L67.27 67.12L67.44 66.66L67.51 66.49L67.61 66.29L67.98 65.58L68.38 64.78L68.51 64.50L68.57 64.38L68.64 64.27L68.74 64.12L68.77 64.09L68.81 64.08L68.85 64.11L68.86 64.16L68.85 64.20L68.83 64.33L68.79 64.46L68.73 64.67L68.60 65.05L68.51 65.35L68.39 65.78L68.33 66.04L68.21 66.61L68.07 67.49L68.01 67.98L67.98 68.29L67.96 68.87L67.96 69.31L67.98 69.76L68.01 70.11L68.06 70.47L68.18 71.03L68.22 71.21L68.37 71.72L68.43 71.89L68.53 72.14L68.75 72.63L68.93 72.98L69.39 73.80L69.56 74.11L69.75 74.51L70.07 75.20L70.25 75.71L70.69 76.97L71.04 77.88L71.14 78.18L71.28 78.65L71.46 79.20L71.58 79.54L71.69 79.78L71.78 79.98L71.94 80.30L72.22 80.81L72.62 81.56L72.82 81.91L72.98 82.17L73.30 82.66L73.62 83.14L73.81 83.39L74.24 83.96L74.41 84.17L74.58 84.37L74.83 84.63L75.05 84.84L75.26 85.02L75.30 85.04L75.34 85.05L75.37 85.02L75.37 84.98L75.36 84.94L75.24 84.65L74.99 84.08L74.62 83.21L74.43 82.67L74.06 81.57L73.92 81.01L73.69 79.91L73.57 79.26L73.52 78.90L73.37 77.53L73.33 77.17L73.32 76.86L73.29 76.06L73.28 75.75L73.29 75.44L73.32 74.81L73.34 74.55L73.57 72.78L73.69 72.07L73.82 71.46L73.98 70.54L74.02 70.28L74.10 69.70L74.17 69.04L74.20 68.64L74.22 68.14L74.21 67.83L74.20 67.61L74.19 67.39L74.14 66.99L74.01 66.20L73.95 65.94L73.83 65.51L73.67 65.05L73.51 64.68L73.27 64.19L72.81 63.28L72.70 63.04L72.65 62.91L72.59 62.75L72.54 62.53L72.51 62.35L72.50 62.18L72.50 62.00L72.50 61.86L72.52 61.69L72.55 61.56L72.58 61.43L72.65 61.26L72.72 61.10L72.81 60.94L72.93 60.76L73.02 60.66L73.11 60.56L73.31 60.38L73.69 60.08L73.82 59.95L73.93 59.82L73.98 59.74L74.02 59.66L74.06 59.58L74.10 59.46L74.12 59.33L74.14 59.24L74.14 59.15L74.14 59.06L74.12 58.97L74.09 58.84L74.05 58.72L74.02 58.63L73.96 58.52L73.91 58.44L73.83 58.33L73.78 58.27L73.68 58.18L73.61 58.13L73.53 58.08L73.45 58.05L73.28 58.00L73.06 57.97L72.74 57.96L72.48 57.97L72.25 57.99L71.86 58.03L71.59 58.08L70.33 58.35L70.11 58.41L69.47 58.59L69.17 58.69L68.58 58.87L68.44 58.89L68.31 58.91L68.27 58.90L68.25 58.87L68.26 58.83L68.28 58.80L68.46 58.66L68.67 58.50L68.93 58.32L69.20 58.16L69.59 57.95L69.79 57.85L70.00 57.76L70.20 57.69L71.26 57.34L71.78 57.19L71.95 57.15L72.56 57.02L72.78 56.98L73.14 56.94L73.71 56.90L73.85 56.88L73.97 56.85L74.10 56.81L74.22 56.75L74.34 56.69L74.46 56.62L74.57 56.55L74.67 56.47L74.77 56.38L74.83 56.31L74.89 56.25L74.97 56.14L75.05 55.98L75.11 55.81L75.13 55.73L75.15 55.60L75.16 55.46L75.16 55.33L75.14 54.93L75.10 54.49L75.07 54.31L75.05 54.18L75.00 54.01L74.92 53.80L74.85 53.64L74.76 53.48L74.61 53.26L74.44 53.05L74.23 52.82L73.98 52.57L73.89 52.47L73.86 52.43L73.85 52.39L73.86 52.35L73.88 52.31L73.92 52.29L73.96 52.28L74.09 52.26L74.27 52.26L74.58 52.26L74.94 52.29L75.11 52.31L75.29 52.35L75.59 52.41L75.94 52.48L76.51 52.61L76.86 52.67L77.17 52.70L77.48 52.72L77.75 52.71L77.97 52.68L78.19 52.64L78.36 52.59L78.53 52.53L78.69 52.45L78.85 52.37L79.00 52.27L79.10 52.19L79.20 52.10L79.29 52.00L79.36 51.89L79.45 51.73L79.50 51.61L79.54 51.48L79.57 51.35L79.58 51.22L79.57 51.09L79.56 50.91L79.53 50.78L79.50 50.65L79.36 50.13L79.25 49.75L79.13 49.27L78.88 48.47L78.48 47.14L78.34 46.72L78.08 45.86L77.99 45.57L77.89 45.22L77.64 44.41L77.48 43.86L77.37 43.42L77.27 43.08L77.11 42.48L76.94 41.83L76.86 41.44L76.77 41.09L76.69 40.66L76.56 40.09L76.39 39.21L76.25 38.47L76.18 38.16L76.14 38.04L76.08 37.87L75.99 37.72L75.88 37.53L75.59 37.13L75.39 36.88L75.28 36.75L75.04 36.49L74.65 36.12L74.48 35.97L74.30 35.84L73.80 35.47L73.35 35.17L72.97 34.95L72.42 34.66L71.81 34.38L70.44 33.83L69.90 33.62L69.39 33.45L68.28 33.11L67.77 32.98L67.64 32.93L67.48 32.86L67.44 32.84L67.41 32.81L67.41 32.78L67.44 32.75L67.49 32.74L67.71 32.73L67.98 32.74L68.20 32.77L68.82 32.86L69.30 32.93L70.14 33.07L70.84 33.21L71.10 33.28L72.17 33.58L72.72 33.75L72.94 33.81L73.44 33.99L73.65 34.07L73.86 34.15L74.54 34.48L74.94 34.67L75.30 34.86L75.69 35.08L75.99 35.27L76.28 35.48L76.58 35.74L76.98 36.10L77.21 36.30L77.32 36.38L77.40 36.40L77.48 36.41L77.56 36.39L77.63 36.35L77.74 36.28L77.84 36.19L77.96 36.06L78.07 35.92L78.14 35.80L78.20 35.69L78.26 35.56L78.30 35.44L78.33 35.31L78.35 35.18L78.36 35.04L78.34 34.73L78.31 34.51L78.28 34.34L78.03 33.25L77.92 32.64L77.82 32.20L77.79 32.02L77.77 31.80L77.72 31.27L77.65 30.16L77.57 29.18L77.39 27.94L77.36 27.72L77.28 27.33L77.20 26.89L77.04 26.20L77.00 26.02L76.85 25.51L76.69 24.95L76.49 24.36L76.40 24.11L76.31 23.81L76.23 23.60L76.14 23.39L76.05 23.19L75.61 22.27L75.23 21.51L74.93 20.96L74.38 19.99L73.64 18.82L73.18 18.17L72.96 17.89L72.11 16.91L71.27 15.87L70.77 15.30L70.49 15.02L70.16 14.71L69.60 14.20L69.17 13.81L68.94 13.60L68.54 13.25L68.16 12.94L67.75 12.59L67.54 12.42L67.22 12.18L66.68 11.79L65.94 11.29L65.20 10.79L64.71 10.48L64.05 10.10L62.65 9.33L62.29 9.14L62.01 9.01L61.73 8.87L60.87 8.51L60.34 8.27L59.93 8.08L59.61 7.94L59.15 7.77L58.13 7.42L57.79 7.32L57.50 7.23L56.86 7.03L56.26 6.86L55.39 6.64L54.74 6.49L54.34 6.42L53.86 6.33L53.29 6.24L52.58 6.15L52.36 6.12L51.11 6.04L50.53 6.01L50.13 6.00L49.38 6.00L48.66 6.01ZM84.78 23.79L84.64 23.81L84.51 23.84L84.08 23.95L83.87 24.03L83.63 24.14L83.51 24.21L83.40 24.28L83.18 24.44L82.99 24.62L82.84 24.79L82.66 25.04L82.52 25.27L82.46 25.39L82.39 25.55L82.33 25.72L82.28 25.84L82.18 26.23L82.13 26.49L82.12 26.63L82.11 26.76L82.12 26.89L82.13 27.07L82.15 27.20L82.18 27.38L82.23 27.60L82.28 27.77L82.36 27.98L82.49 28.26L82.55 28.38L82.62 28.49L82.70 28.60L82.79 28.70L82.97 28.90L83.07 28.99L83.20 29.10L83.42 29.26L83.54 29.32L83.66 29.39L84.06 29.57L84.19 29.61L84.32 29.65L84.58 29.70L84.71 29.72L84.84 29.73L85.16 29.74L85.33 29.73L85.47 29.71L85.82 29.65L86.03 29.60L86.16 29.55L86.36 29.47L86.61 29.35L86.76 29.26L86.91 29.16L87.16 28.98L87.43 28.74L87.52 28.65L87.61 28.55L87.73 28.36L87.88 28.09L87.99 27.84L88.04 27.67L88.08 27.55L88.13 27.28L88.15 27.11L88.16 26.97L88.16 26.66L88.14 26.35L88.10 26.09L88.07 25.95L88.03 25.83L87.92 25.53L87.87 25.41L87.78 25.25L87.72 25.14L87.64 25.03L87.48 24.82L87.29 24.63L87.08 24.46L86.83 24.28L86.59 24.15L86.35 24.04L86.10 23.95L85.62 23.83L85.40 23.79L85.27 23.78L85.09 23.77L84.91 23.78ZM63.90 37.84L63.95 37.83L63.99 37.83L64.15 37.92L64.63 38.23L65.01 38.47L65.60 38.87L66.10 39.16L66.54 39.39L66.78 39.50L67.02 39.61L67.44 39.77L68.36 40.10L68.88 40.25L69.05 40.30L69.22 40.34L69.92 40.46L70.15 40.49L70.37 40.52L71.66 40.61L72.15 40.63L72.59 40.62L72.68 40.63L72.72 40.65L72.75 40.68L72.77 40.72L72.76 40.77L72.74 40.81L72.71 40.84L72.60 40.91L72.41 41.03L72.22 41.13L72.01 41.22L71.68 41.35L71.51 41.41L71.00 41.56L70.87 41.59L70.65 41.62L70.25 41.67L69.98 41.69L69.63 41.68L69.31 41.66L69.00 41.62L68.83 41.59L68.66 41.55L68.11 41.37L67.78 41.24L67.41 41.07L67.09 40.91L66.82 40.76L66.63 40.64L66.45 40.51L65.95 40.13L65.68 39.90L65.38 39.64L65.05 39.33L64.77 39.04L64.51 38.74L64.11 38.26L63.92 38.01L63.90 37.98L63.88 37.93L63.88 37.89Z`}),t[12]=S,t[13]=C,t[14]=w):w=t[14];let T;return t[15]!==f||t[16]!==m||t[17]!==b||t[18]!==x||t[19]!==w||t[20]!==p?(T=(0,l.jsxs)(`svg`,{width:p,height:m,viewBox:`0 0 100 100`,xmlns:`http://www.w3.org/2000/svg`,className:f,role:`img`,"aria-label":b,"data-yuri-logo":!0,children:[x,w]}),t[15]=f,t[16]=m,t[17]=b,t[18]=x,t[19]=w,t[20]=p,t[21]=T):T=t[21],T};export{c as n,u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-hePW80VL.js";import{c as e,s as t}from"./runtime-switch-DEPKHgdL.js";import{a as n,i as r}from"./vendor-zustand-CTekDqaS.js";import{ot as i,st as a}from"./vendor-base-ui-wXsskyKm.js";import{_r as o}from"./client-
|
|
1
|
+
import"./rolldown-runtime-hePW80VL.js";import{c as e,s as t}from"./runtime-switch-DEPKHgdL.js";import{a as n,i as r}from"./vendor-zustand-CTekDqaS.js";import{ot as i,st as a}from"./vendor-base-ui-wXsskyKm.js";import{_r as o}from"./client-ITylDDCS.js";import{n as s}from"./vendor-react-BkccXcWz.js";var c=n()(r(e=>({progress:{},openedRuntime:null,open:t=>e(e=>({openedRuntime:t,progress:{...e.progress,[t]:e.progress[t]??{step:0,dismissed:!1}}})),move:(t,n)=>e(e=>({progress:{...e.progress,[t]:{step:n,dismissed:e.progress[t]?.dismissed??!1}}})),dismiss:t=>e(e=>({openedRuntime:e.openedRuntime===t?null:e.openedRuntime,progress:{...e.progress,[t]:{step:e.progress[t]?.step??0,dismissed:!0}}}))}),{name:`yuri-setup-tour`,version:1,migrate:e=>({progress:Object.fromEntries(Object.entries(e?.progress??{}).map(([e,t])=>[e,t&&typeof t==`object`?{...t,step:t.step===2?3:t.step}:t]))}),storage:o(),partialize:e=>({progress:e.progress}),merge:(e,t)=>{let n=e,r={};if(n?.progress&&typeof n.progress==`object`)for(let[e,t]of Object.entries(n.progress))t&&[0,1,2,3].includes(t.step)&&typeof t.dismissed==`boolean`&&(r[e]={step:t.step,dismissed:t.dismissed});return{...t,progress:r,openedRuntime:null}}}));e(e=>{t(e)&&c.persist.rehydrate()}),a();var l=s(),u=`/assets/yuri-wordmark-DSJqXYVo.svg`,d=i();function f(e){let t=(0,l.c)(5),{className:n,width:r}=e,i=n===void 0?``:n,a=r===void 0?112:r,o=`inline-block shrink-0 ${i}`,s;t[0]===a?s=t[1]:(s={width:a,aspectRatio:`626.723 / 280`,backgroundColor:`currentColor`,mask:`url("${u}") center / contain no-repeat`,WebkitMask:`url("${u}") center / contain no-repeat`},t[0]=a,t[1]=s);let c;return t[2]!==o||t[3]!==s?(c=(0,d.jsx)(`span`,{role:`img`,"aria-label":`Yuri`,className:o,style:s}),t[2]=o,t[3]=s,t[4]=c):c=t[4],c}export{c as n,f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,c as n,d as r,s as i}from"./runtime-auth-DA-qfGHk.js";import{c as a,i as o}from"./runtime-switch-DEPKHgdL.js";import{n as s}from"./runtime-fetch-V-iMWR8t.js";import{d as c,g as l,h as u,i as d,l as f,m as p,n as m,p as h,u as g}from"./runtime-file-resource-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-hePW80VL.js";import{_ as t,c as n,d as r,s as i}from"./runtime-auth-DA-qfGHk.js";import{c as a,i as o}from"./runtime-switch-DEPKHgdL.js";import{n as s}from"./runtime-fetch-V-iMWR8t.js";import{d as c,g as l,h as u,i as d,l as f,m as p,n as m,p as h,u as g}from"./runtime-file-resource-C5kmYlLv.js";var _=26214400,v=class extends Error{status;code;constructor(e,t,n=`Failed to upload assistant attachment`){super(n),this.name=`AssistantAttachmentUploadError`,this.status=e,this.code=t}},y=e=>typeof e==`object`&&!!e&&!Array.isArray(e),b=e=>[...new Uint8Array(e)].map(e=>e.toString(16).padStart(2,`0`)).join(``),x=async e=>{let t;if(e instanceof ArrayBuffer)t=e;else if(ArrayBuffer.isView(e)){let n=e;t=n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}else t=await e.arrayBuffer();return b(await crypto.subtle.digest(`SHA-256`,t))},S=e=>typeof e==`string`?e.split(`;`)[0]?.trim().toLowerCase():``,C=e=>{if(!Number.isSafeInteger(e)||e<0)throw new v(0,`rejected`,`Invalid attachment size`);if(e>26214400)throw new v(413,`too-large`)},w=(e,t,n={})=>{if(!y(e))throw new v(0,`integrity`,`Attachment response was not a JSON object`);if(e.type!==`file`)throw new v(0,`integrity`,`Attachment response type must be file`);let r=typeof e.attachmentID==`string`?e.attachmentID.trim():``,i=typeof e.sha256==`string`?e.sha256.trim().toLowerCase():``,a=typeof e.size==`number`&&Number.isSafeInteger(e.size)?e.size:NaN,o=S(typeof e.mime==`string`?e.mime:``),s=typeof e.filename==`string`&&e.filename.trim()?e.filename.trim():void 0;if(!r)throw new v(0,`integrity`,`Attachment response missing attachmentID`);if(!/^[a-f0-9]{64}$/i.test(i))throw new v(0,`integrity`,`Attachment response missing sha256`);if(!Number.isSafeInteger(a)||a<0)throw new v(0,`integrity`,`Attachment response missing size`);if(!o)throw new v(0,`integrity`,`Attachment response missing mime`);if((n.enforceUploadLimit===!0||t)&&C(a),t){if(i!==t.sha256.toLowerCase())throw new v(0,`integrity`,`Attachment SHA-256 mismatch`);if(a!==t.size)throw new v(0,`integrity`,`Attachment size mismatch`);if(o!==t.mime)throw new v(0,`integrity`,`Attachment mime mismatch`)}return{type:`file`,attachmentID:r,sha256:i,size:a,mime:o,...s?{filename:s}:{}}},T=async(e,t,n,r)=>{let i=m(),a=typeof e==`string`?e.trim():``,o=typeof n==`string`?n.trim():``;if(!a||!o)throw new v(0,`rejected`,`assistantID and uploadID are required`);if(!(t instanceof Blob))throw new v(0,`rejected`,`file must be a File or Blob`);let c=S(t.type||t.type)||`application/octet-stream`,l=t.type===c?t:new Blob([t],{type:c});C(l.size);let u=await x(l),d=typeof t.name==`string`&&t.name.trim()?t.name.trim():void 0,f;try{f=await s(`/api/yuri/assistants/${encodeURIComponent(a)}/contact/attachments/${encodeURIComponent(o)}`,{method:`PUT`,headers:{"Content-Type":c,"X-Content-SHA256":u,"X-Content-Size":String(l.size),...d?{"X-Attachment-Filename":encodeURIComponent(d)}:{}},body:l,signal:r})}catch{throw new v(0,`unavailable`)}if(f.status===204||f.status===205)throw new v(f.status,`integrity`,`Attachment upload returned empty status`);if(f.status===413)throw new v(413,`too-large`);if(!f.ok)throw new v(f.status,f.status>=500||f.status===0?`unavailable`:`rejected`);let p=f.headers.get(`content-type`)?.toLowerCase()??``;if(p.includes(`text/html`)||p.includes(`text/plain`))throw new v(f.status,`integrity`,`Attachment upload returned non-JSON body`);let h;try{let e=await f.text();if(!e.trim())throw new v(f.status,`integrity`,`Attachment upload returned empty body`);if(!p.includes(`application/json`)&&!e.trim().startsWith(`{`))throw new v(f.status,`integrity`,`Attachment upload returned non-JSON body`);h=JSON.parse(e)}catch(e){throw e instanceof v?e:new v(f.status,`integrity`,`Attachment upload response was not valid JSON`)}let g=w(h,{sha256:u,size:l.size,mime:c});return await i(l,u),g},E=e=>{try{return w(e,void 0,{enforceUploadLimit:!1}),!0}catch{return!1}},D=e({clearAssistantAttachmentCacheAll:()=>G,clearAssistantAttachmentCacheForBearer:()=>W,clearAssistantAttachmentCacheScope:()=>U,getAssistantAttachmentBlob:()=>J,getAssistantAttachmentDisplay:()=>Y,resolveAssistantAttachmentCacheScope:()=>R}),O=g,k=class extends Error{status;code;constructor(e,t,n=`Assistant attachment cache error`){super(n),this.status=e,this.code=t,this.name=`AssistantAttachmentCacheError`}},A=async e=>[...new Uint8Array(await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e)))].map(e=>e.toString(16).padStart(2,`0`)).join(``),j=0,M,N,P=!1,F=new Map,I=new Map,L=new Set,R=async(e={})=>{let t=e.transportIdentity??o(),r=e.authGeneration??i(),a=(e.bearer??n()).trim();return{transportIdentity:t,authGeneration:r,authScope:a?`b:${await A(a)}`:`m:${r}`,authScopeKind:a?`bearer-hash`:`memory-ephemeral`}},z=e=>`assistant:${e.transportIdentity}:${e.authScope}`,B=e=>`assistant-auth:${e}`,V=()=>{j++;for(let e of L)e.abort();L.clear();for(let e of I.values())e.controller.abort(),e.url&&p(e.url);I.clear();for(let e of F.values()){for(let t=0;t<e.refs;t++)h(e.url);p(e.url)}F.clear()},H=()=>{if(!P&&globalThis.indexedDB){P=!0;for(let e of[`yuri-assistant-attachments`,`openchamber-assistant-attachments`,`openchambery-assistant-attachments`])try{globalThis.indexedDB.deleteDatabase(e)}catch{}}M||=a(V),N||=t(e=>{V(),e.reason!==`endpoint-switch`&&d(e.previousBearerDigest?B(`b:${e.previousBearerDigest}`):void 0)})},U=async(e,t=`scope-cleared`)=>{let n=typeof e==`object`?e:await R();V(),await d(z(n))},W=async(e,t=`forget-bearer`)=>{if(!e.trim())return;let n=B(`b:${await A(e.trim())}`);V(),await d(n)},G=async(e=`cleared`)=>{V(),await d()},K=(e,t,n)=>{if(!e.trim()||!E(t))throw new k(0,`rejected`);if(t.size>n)throw new k(413,`too-large`)},q=async(e,t,n,a)=>{H(),K(e,t,n),a?.throwIfAborted();let o=j,c=await R();if(o!==j)throw new k(0,`stale`);let l=new AbortController,u=()=>l.abort(a?.reason);a?.addEventListener(`abort`,u,{once:!0}),L.add(l);let d;try{a?.throwIfAborted();let u=await f({identity:`/api/yuri/assistants/${encodeURIComponent(e.trim())}/contact/attachments/${encodeURIComponent(t.attachmentID)}`,sha256:t.sha256.toLowerCase(),size:t.size,mime:t.mime,filename:t.filename,persistent:c.authScopeKind===`bearer-hash`,tags:[z(c),B(c.authScope)],signal:l.signal,maxBytes:n,load:async n=>{let a=await s(`/api/yuri/assistants/${encodeURIComponent(e.trim())}/contact/attachments/${encodeURIComponent(t.attachmentID)}`,{method:`GET`,cache:`no-store`,signal:n});if(a.status===401||a.status===403)throw d=new k(a.status,`unauthorized`),await U(c,`unauthorized`),i()===c.authGeneration&&r(),new k(a.status,`unauthorized`);if(!a.ok)throw new k(a.status,a.status===413?`too-large`:a.status>=500?`unavailable`:`rejected`);return a}});if(o!==j)throw new k(0,`stale`);return u}catch(e){throw d||(e instanceof k?e:o===j?l.signal.aborted?new k(0,`aborted`):/descriptor limit|streaming destination/i.test(String(e))?new k(413,`too-large`):new k(0,/fingerprint|size|changed|truncated/i.test(String(e))?`integrity`:`unavailable`):new k(0,`stale`))}finally{L.delete(l),a?.removeEventListener(`abort`,u)}},J=(e,t,n={})=>q(e,t,_,n.signal),Y=async(e,t,n={})=>{H(),K(e,t,O),n.signal?.throwIfAborted();let r=j,i=await R(),a=JSON.stringify([z(i),e,t.attachmentID,t.sha256]),o=e=>{if(r!==j||!c(e)||!u(e))throw p(e),new k(0,`stale`);let t=F.get(a)?.url===e?F.get(a):{url:e,refs:0};t.refs++,F.set(a,t);let n=!1;return{url:e,release:()=>{n||(n=!0,F.get(a)===t&&(h(e),--t.refs===0&&(F.delete(a),p(e))))}}},s=F.get(a);if(s&&c(s.url))return o(s.url);let d=I.get(a);if(!d){let n=new AbortController,i={controller:n,refs:0,promise:Promise.resolve(``)};i.promise=q(e,t,O,n.signal).then(e=>l(e,n.signal,{mimeType:t.mime||e.type})).then(e=>{if(i.url=e,r!==j||n.signal.aborted||i.refs===0)throw p(e),new k(0,`stale`);return e}).catch(e=>{throw I.get(a)===i&&I.delete(a),e}),d=i,I.set(a,d)}let f=d;return f.refs++,new Promise((e,t)=>{let r=!1,i=e=>{--f.refs===0&&(e&&f.controller.abort(),I.get(a)===f&&I.delete(a),e&&f.url&&!F.has(a)&&p(f.url))},s=()=>{r||(r=!0,i(!0),t(new k(0,`aborted`)))};n.signal?.addEventListener(`abort`,s,{once:!0}),n.signal?.aborted&&s(),f.promise.then(a=>{if(n.signal?.removeEventListener(`abort`,s),!r){r=!0;try{e(o(a))}catch(e){t(e)}i(!1)}},e=>{n.signal?.removeEventListener(`abort`,s),!r&&(r=!0,i(!1),t(e))})})};export{T as i,J as n,Y as r,D as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,w as n}from"./runtime-auth-DA-qfGHk.js";import{i as r,t as i}from"./runtime-switch-DEPKHgdL.js";import{j as a,m as o}from"./platform-CiUKDeXd.js";import{ot as s,st as c}from"./vendor-base-ui-wXsskyKm.js";import{n as l}from"./vendor-react-BkccXcWz.js";import{n as u}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{r as d}from"./vendor-reactuses-core-DjKFMfz7.js";import{r as f}from"./vendor-sonner-DX3nfJx4.js";import{Yn as p,no as m}from"./ui-Cd2-HQSa.js";import{n as h}from"./Icon-CeG6IExS.js";import{t as g}from"./i18n-BcqhT5IQ.js";import{i as _}from"./useAssistantUIStore-AI2LkqlQ.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./dialog-CZlghHCF.js";import{a as w,i as T,n as E,r as D,t as O}from"./context-menu-j9GOycjo.js";import{c as k,i as A,o as j,p as M}from"./assistantQueries-DKqpPYqd.js";import{t as N}from"./assistantPresentation-DRbsH1Ej.js";import{r as P,t as F}from"./AssistantWorkingAvatar-uOBMRhP_.js";import{n as I}from"./AssistantUnreadBadge-4aoNcXVG.js";var L=e(c(),1),R=l(),z=()=>o()&&!n(),B=async e=>{if(!z())throw Error(`Assistant Mini Chat requires a direct desktop connection`);await a(`desktop_open_assistant_mini_chat_window`,{assistantID:e,apiBaseUrl:i(),clientToken:t()})},V=s();function H(e){let t=(0,R.c)(49),{assistant:n,trigger:i,onEdit:a,onDelete:o,doubleClickMiniChat:s}=e,c=s!==void 0&&s,{t:l}=g(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=r(),t[0]=d):d=t[0];let p;t[1]===n.id?p=t[2]:(p=[d,`assistants`,n.id,`pin`],t[1]=n.id,t[2]=p);let m;t[3]===n?m=t[4]:(m=()=>M(n,{pinned:n.pinnedAt==null}),t[3]=n,t[4]=m);let _;t[5]===l?_=t[6]:(_=()=>f.error(l(`assistants.menu.pinError`)),t[5]=l,t[6]=_);let v;t[7]!==p||t[8]!==m||t[9]!==_?(v={mutationKey:p,mutationFn:m,onError:_},t[7]=p,t[8]=m,t[9]=_,t[10]=v):v=t[10];let y=u(v),b;t[11]!==n.id||t[12]!==l?(b=()=>{B(n.id).catch(()=>f.error(l(`miniChat.actions.failed`)))},t[11]=n.id,t[12]=l,t[13]=b):b=t[13];let x=b,S=i,C;t[14]!==S||t[15]!==c||t[16]!==x||t[17]!==i?(C=c?L.cloneElement(S,{onDoubleClick:e=>{S.props.onDoubleClick?.(e),!e.defaultPrevented&&z()&&x()}}):i,t[14]=S,t[15]=c,t[16]=x,t[17]=i,t[18]=C):C=t[18];let k;t[19]===C?k=t[20]:(k=(0,V.jsx)(w,{render:C}),t[19]=C,t[20]=k);let A;t[21]!==n.pinnedAt||t[22]!==y||t[23]!==l?(A=n.pinnedAt===void 0?null:(0,V.jsxs)(D,{disabled:y.isPending,onClick:()=>y.mutate(),children:[(0,V.jsx)(h,{name:n.pinnedAt==null?`pushpin-2`:`unpin`,className:`size-4`}),l(n.pinnedAt==null?`assistants.menu.pin`:`assistants.menu.unpin`)]}),t[21]=n.pinnedAt,t[22]=y,t[23]=l,t[24]=A):A=t[24];let j;t[25]!==x||t[26]!==l?(j=z()?(0,V.jsxs)(D,{onClick:x,children:[(0,V.jsx)(h,{name:`external-link`,className:`size-4`}),l(`sessions.sidebar.session.menu.openMiniChatWindow`)]}):null,t[25]=x,t[26]=l,t[27]=j):j=t[27];let N;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,V.jsx)(h,{name:`edit`,className:`size-4`}),t[28]=N):N=t[28];let P;t[29]===l?P=t[30]:(P=l(`assistants.menu.edit`),t[29]=l,t[30]=P);let F;t[31]!==a||t[32]!==P?(F=(0,V.jsxs)(D,{onClick:a,children:[N,P]}),t[31]=a,t[32]=P,t[33]=F):F=t[33];let I;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,V.jsx)(T,{}),t[34]=I):I=t[34];let H;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,V.jsx)(h,{name:`delete-bin`,className:`size-4 text-inherit`}),t[35]=H):H=t[35];let U;t[36]===l?U=t[37]:(U=l(`assistants.settings.delete`),t[36]=l,t[37]=U);let W;t[38]!==o||t[39]!==U?(W=(0,V.jsxs)(D,{onClick:o,className:`text-[var(--status-error)] focus:text-[var(--status-error)] data-[highlighted]:text-[var(--status-error)]`,children:[H,U]}),t[38]=o,t[39]=U,t[40]=W):W=t[40];let G;t[41]!==A||t[42]!==j||t[43]!==F||t[44]!==W?(G=(0,V.jsxs)(E,{className:`min-w-[10rem]`,children:[A,j,F,I,W]}),t[41]=A,t[42]=j,t[43]=F,t[44]=W,t[45]=G):G=t[45];let K;return t[46]!==G||t[47]!==k?(K=(0,V.jsxs)(O,{children:[k,G]}),t[46]=G,t[47]=k,t[48]=K):K=t[48],K}function U(e){let t=(0,R.c)(38),{assistant:n,selected:r,onSelect:i,onEdit:a,onDelete:o}=e,s=L.useRef(null),c=P(n.id,n.working),l;t[0]===n.name?l=t[1]:(l=N(n.name).displayName||n.name,t[0]=n.name,t[1]=l);let u=l,d;t[2]!==n.id||t[3]!==a?(d=()=>a(n.id),t[2]=n.id,t[3]=a,t[4]=d):d=t[4];let f;t[5]!==n||t[6]!==o?(f=()=>o(n),t[5]=n,t[6]=o,t[7]=f):f=t[7];let p=n.id,h;t[8]!==n.id||t[9]!==i?(h=()=>i(n.id),t[8]=n.id,t[9]=i,t[10]=h):h=t[10];let g=r?`bg-[var(--surface-muted)]`:`hover:bg-interactive-hover`,_;t[11]===g?_=t[12]:(_=m(`flex w-full min-w-0 max-w-28 flex-col items-center gap-2 rounded-2xl px-2 py-3 text-center outline-none transition-colors focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] active:bg-interactive-active motion-reduce:transition-none`,g),t[11]=g,t[12]=_);let v;t[13]!==n.avatarSeed||t[14]!==n.id||t[15]!==u||t[16]!==c?(v=(0,V.jsx)(F,{name:n.id,avatarSeed:n.avatarSeed,size:64,label:u,working:c,hoverTarget:s}),t[13]=n.avatarSeed,t[14]=n.id,t[15]=u,t[16]=c,t[17]=v):v=t[17];let y=n.unreadCount??0,b;t[18]===y?b=t[19]:(b=(0,V.jsx)(I,{count:y,className:`absolute -right-1 -top-1`}),t[18]=y,t[19]=b);let x;t[20]!==b||t[21]!==v?(x=(0,V.jsxs)(`span`,{className:`relative`,children:[v,b]}),t[20]=b,t[21]=v,t[22]=x):x=t[22];let S;t[23]===u?S=t[24]:(S=(0,V.jsx)(`span`,{className:`w-full truncate typography-ui-label font-medium leading-5`,children:u}),t[23]=u,t[24]=S);let C;t[25]!==n.id||t[26]!==u||t[27]!==r||t[28]!==x||t[29]!==S||t[30]!==h||t[31]!==_?(C=(0,V.jsxs)(`button`,{ref:s,type:`button`,role:`option`,"aria-selected":r,title:u,"data-assistant-pinned":p,"data-mobile-press-feedback":`soft`,onClick:h,className:_,children:[x,S]}),t[25]=n.id,t[26]=u,t[27]=r,t[28]=x,t[29]=S,t[30]=h,t[31]=_,t[32]=C):C=t[32];let w;return t[33]!==n||t[34]!==C||t[35]!==d||t[36]!==f?(w=(0,V.jsx)(H,{assistant:n,doubleClickMiniChat:!0,onEdit:d,onDelete:f,trigger:C}),t[33]=n,t[34]=C,t[35]=d,t[36]=f,t[37]=w):w=t[37],w}function W(e){let t=(0,R.c)(16),{contacts:n,selectedAssistantID:r,onSelect:i,onEdit:a,onDelete:o}=e,{t:s}=g();if(n.length===0)return null;let c;t[0]===s?c=t[1]:(c=s(`assistants.list.pinned`),t[0]=s,t[1]=c);let l;if(t[2]!==n||t[3]!==o||t[4]!==a||t[5]!==i||t[6]!==r){let e;t[8]!==o||t[9]!==a||t[10]!==i||t[11]!==r?(e=e=>(0,V.jsx)(U,{assistant:e,selected:e.id===r,onSelect:i,onEdit:a,onDelete:o},e.id),t[8]=o,t[9]=a,t[10]=i,t[11]=r,t[12]=e):e=t[12],l=n.map(e),t[2]=n,t[3]=o,t[4]=a,t[5]=i,t[6]=r,t[7]=l}else l=t[7];let u;return t[13]!==c||t[14]!==l?(u=(0,V.jsx)(`div`,{role:`group`,"aria-label":c,className:`yuri-assistant-pinned-contacts grid grid-cols-1 justify-items-center gap-2 pb-3 pt-2`,children:l}),t[13]=c,t[14]=l,t[15]=u):u=t[15],u}function G({snapshot:e,rowClassName:t,compact:n=!1,mobile:r=!1}){let{t:i}=g(),[a,o]=L.useState(!1),s=L.useRef(!1),c=d(async()=>{if(!s.current){s.current=!0,o(!0);try{(await k(e)).failed&&f.error(i(`assistants.unread.markAllFailed`))}catch{f.error(i(`assistants.unread.markAllFailed`))}finally{s.current=!1,o(!1)}}}),l=e.assistants.some(e=>(e.unreadCount??0)>0);return!n&&!l?null:(0,V.jsx)(`div`,{className:t,style:n&&!l?{visibility:`hidden`}:void 0,children:(0,V.jsx)(p,{type:`button`,variant:r?`mobileGlass`:`ghost`,size:r?`mobileIcon`:`icon`,onClick:c,"aria-label":i(`assistants.unread.markAll`),title:i(`assistants.unread.markAll`),disabled:a||!e.assistants.some(e=>(e.unreadCount??0)>0&&e.readTip),"aria-busy":a,children:(0,V.jsx)(h,{name:`check-double`,className:r?`size-5`:`size-4`})})})}async function K(e){await A(e);let t=_.getState().defaultShareAssistant;if(t?.assistantID!==e.id)return;let n=await j();n.serverInstanceID&&t.serverInstanceID===n.serverInstanceID&&_.getState().setDefaultShareAssistant(null)}function q({assistant:e,open:t,onOpenChange:n,onDeleted:r}){let{t:i}=g(),[a,o]=L.useState(!1),s=e?N(e.name).displayName||e.name:``,c=d(e=>{a&&!e||n(e)}),l=d(()=>{a||n(!1)}),u=d(async()=>{if(!(!e||a)){o(!0);try{await K(e),r?.(e.id),n(!1),f.success(i(`assistants.settings.toast.deleted`))}catch{f.error(i(`assistants.settings.toast.deleteFailed`))}finally{o(!1)}}});return(0,V.jsx)(C,{open:t&&e!==null,onOpenChange:c,children:(0,V.jsxs)(b,{className:`max-w-md`,children:[(0,V.jsxs)(v,{children:[(0,V.jsx)(x,{children:i(`assistants.settings.delete`)}),(0,V.jsx)(S,{children:i(`assistants.settings.deleteConfirm`,{name:s})})]}),(0,V.jsxs)(y,{children:[(0,V.jsx)(p,{size:`sm`,variant:`ghost`,onClick:l,disabled:a,children:i(`settings.common.actions.cancel`)}),(0,V.jsx)(p,{size:`sm`,variant:`destructive`,onClick:u,disabled:a,children:i(`settings.common.actions.delete`)})]})]})})}var J=`block min-w-0 max-w-full truncate typography-micro text-muted-foreground`,Y={image:`assistants.contact.attachment.image`,file:`assistants.contact.attachment.file`,session:`assistants.contact.card.session.untitled`,assistant:`assistants.title`,schedule:`assistants.settings.scheduledTasks.title`};function X(e,t){let n=e?.text??``;return(e?.fallbackKind?n:n.replace(/^\s{0,3}(?:`{3,}|~{3,})[\w+-]*(?:\s+|$)/gmu,``).replace(/`{3,}|~{3,}/gu,``).replace(/^\s{0,3}(?:#{1,6}\s+|(?:>\s*)+|[-+*]\s+(?:\[[ xX]\]\s*)?|\d+[.)]\s+)/gmu,``).replace(/!?\[([^\]\n]*)\]\([^\n)]*(?:\)|$)/gu,`$1`).replace(/!\[([^\]\n]*)(?:\]|$)/gu,`$1`).replace(/(`+)([^`\n]+)\1/gu,`$2`).replace(/(\*{1,3}|~~)(?=\S)(.+?)\1/gu,`$2`).replace(/(?<![\p{L}\p{N}_])(_{1,3})(?=\S)(.+?)\1(?![\p{L}\p{N}_])/gu,`$2`)).replace(/\s+/gu,` `).trim()||t(e?.fallbackKind?Y[e.fallbackKind]:`assistants.contact.empty`)}export{W as a,G as i,X as n,H as o,q as r,J as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n}from"./runtime-switch-DEPKHgdL.js";import{n as r}from"./runtime-fetch-V-iMWR8t.js";import{st as i}from"./vendor-base-ui-wXsskyKm.js";import{n as a}from"./vendor-react-BkccXcWz.js";import{s as o}from"./vendor-tanstack-react-query-DIb_ItL-.js";import{L as s,q as c}from"./runtime-file-resource-C5kmYlLv.js";import{Tt as l}from"./ui-Cd2-HQSa.js";import{i as u}from"./store-BHq6XijA.js";var d=e(i(),1),f=a(),p=class extends Error{code;status;resource;constructor(e,t,n,r){super(typeof r==`string`&&r.trim()?r.trim():e),this.code=e,this.status=t,this.resource=n}},m=e=>{if(!e||typeof e!=`object`)return!1;let t=`name`in e?String(e.name):``;return t===`AbortError`||t===`TimeoutError`},h=class extends p{operation;constructor(e,t,n){super(e,t,`share_operation`),this.operation=n}},g=(e,t=200)=>{throw new p(`invalid_${e}_response`,t,e)},_=(e,t)=>e&&typeof e==`object`&&!Array.isArray(e)?e:g(t),v=(e,t)=>typeof e==`string`?e:g(t),y=(e,t)=>e===null||typeof e==`string`?e:g(t),b=(e,t)=>typeof e==`number`&&Number.isFinite(e)?e:g(t),x=(e,t)=>e===null?null:b(e,t),S=(e,t)=>typeof e==`boolean`?e:g(t),C=(e,t,n)=>t.includes(e)?e:g(n),w=e=>{let t=_(e,`capability`);return{supported:S(t.supported,`capability`),enabled:S(t.enabled,`capability`),revision:b(t.revision,`capability`),serverInstanceID:y(t.serverInstanceID,`capability`),sharingAvailable:t.sharingAvailable!==void 0&&S(t.sharingAvailable,`capability`)}},T=e=>{if(e==null)return null;let t=_(e,`assistant`);return{turnID:v(t.turnID,`assistant`),messageID:v(t.messageID,`assistant`),status:C(t.status,[`queued`,`running`],`assistant`),admittedAt:b(t.admittedAt,`assistant`)}},E=e=>{if(e==null)return null;let t=_(e,`assistant_preview`),n=b(t.ordinal,`assistant_preview`);return!Number.isSafeInteger(n)||n<0?g(`assistant_preview`):{...t.createdAt===void 0?{}:{createdAt:b(t.createdAt,`assistant_preview`)},messageID:v(t.messageID,`assistant_preview`),ordinal:n,role:C(t.role,[`user`,`assistant`],`assistant_preview`),text:v(t.text,`assistant_preview`),fallbackKind:t.fallbackKind===null?null:C(t.fallbackKind,[`image`,`file`,`session`,`assistant`,`schedule`],`assistant_preview`)}},D=e=>{let t=b(e,`assistant_read`);return Number.isSafeInteger(t)&&t>=0?t:g(`assistant_read`)},O=e=>{let t=_(e,`assistant_read`);return{generation:D(t.generation),ordinal:D(t.ordinal),messageID:v(t.messageID,`assistant_read`)}},ee=e=>({unreadCount:e.unreadCount===void 0?0:D(e.unreadCount),readWatermark:e.readWatermark==null?null:O(e.readWatermark),readTip:e.readTip==null?null:O(e.readTip)}),te=e=>{let t=_(e,`assistant_read`);return{assistantID:v(t.assistantID,`assistant_read`),changed:S(t.changed,`assistant_read`),unreadCount:D(t.unreadCount),readWatermark:O(t.readWatermark),readTip:O(t.readTip),revision:D(t.revision)}},k=e=>{let t=_(e,`assistant`),n=Array.isArray(t.historySessionIDs)?t.historySessionIDs.map(e=>v(e,`assistant`)):[],r=t.historySessionCount===void 0?n.length:b(t.historySessionCount,`assistant`);if(!Number.isSafeInteger(r)||r<n.length)return g(`assistant`);let i=Array.isArray(t.assignedSessionIDs)?t.assignedSessionIDs.map(e=>v(e,`assistant`)):[],a=t.activeContactTurn===void 0?null:T(t.activeContactTurn),o=t.working===void 0?a!=null:S(t.working,`assistant`);return{...ee(t),pinnedAt:t.pinnedAt===void 0?void 0:x(t.pinnedAt,`assistant`),latestMessagePreview:E(t.latestMessagePreview),id:v(t.id,`assistant`),avatarSeed:v(t.avatarSeed??t.id,`assistant`),revision:b(t.revision,`assistant`),enabled:S(t.enabled,`assistant`),name:v(t.name,`assistant`),defaultPrompt:v(t.defaultPrompt,`assistant`),workspacePath:y(t.workspacePath,`assistant`),effectiveWorkspacePath:v(t.effectiveWorkspacePath,`assistant`),managedWorkspacePath:y(t.managedWorkspacePath??null,`assistant`),providerID:v(t.providerID,`assistant`),modelID:v(t.modelID,`assistant`),agent:y(t.agent,`assistant`),variant:y(t.variant??null,`assistant`),mode:C(t.mode,[`continuous`,`stateless`],`assistant`),sessionID:y(t.sessionID,`assistant`),sessionGeneration:b(t.sessionGeneration,`assistant`),historySessionIDs:n,historySessionCount:r,assignedSessionIDs:i,working:o,activeContactTurn:a,createdAt:x(t.createdAt,`assistant`),updatedAt:b(t.updatedAt,`assistant`),tombstoneAt:x(t.tombstoneAt,`assistant`)}},ne=e=>{let t=_(e,`snapshot`);return{revision:b(t.revision,`snapshot`),enabled:S(t.enabled,`snapshot`),assistants:Array.isArray(t.assistants)?t.assistants.map(k):g(`snapshot`)}},re=e=>{let t=_(e,`binding`);return{sessionID:y(t.sessionID,`binding`),directory:v(t.directory,`binding`),sessionGeneration:b(t.sessionGeneration,`binding`)}},ie=e=>{let t=_(e,`message_admission`);if(t.admitted!==!0)return g(`message_admission`);let n=t.revision===void 0||t.revision===null?null:b(t.revision,`message_admission`);return{binding:re(t.binding),messageID:v(t.messageID,`message_admission`),admitted:!0,revision:n,...t.replayed===!0?{replayed:!0}:{}}},A=e=>{let t=_(e,`share_operation`);return{operationID:v(t.operationID,`share_operation`),assistantID:v(t.assistantID,`share_operation`),sessionID:y(t.sessionID,`share_operation`),messageID:y(t.messageID,`share_operation`),state:C(t.state,[`submitting`,`running`,`completed`,`failed`,`unresolved`],`share_operation`),phase:v(t.phase,`share_operation`),attempt:b(t.attempt,`share_operation`),leaseExpiresAt:x(t.leaseExpiresAt,`share_operation`),errorCode:y(t.errorCode,`share_operation`)}},ae=e=>{let t=_(e,`assistant_contact_part`);if(t.type===`text`)return{type:`text`,text:v(t.text,`assistant_contact_part`)};if(t.type===`file`){let e=t.filename===void 0||t.filename===null?void 0:v(t.filename,`assistant_contact_part`),n=v(t.mime,`assistant_contact_part`),r=t.url!==void 0&&t.url!==null,i=t.attachmentID!==void 0&&t.attachmentID!==null;if(r&&i)return g(`assistant_contact_part`);if(i){let r=b(t.size,`assistant_contact_part`);return!Number.isSafeInteger(r)||r<0?g(`assistant_contact_part`):{type:`file`,mime:n,attachmentID:v(t.attachmentID,`assistant_contact_part`),sha256:v(t.sha256,`assistant_contact_part`),size:r,...e?{filename:e}:{}}}return r?{type:`file`,mime:n,url:v(t.url,`assistant_contact_part`),...e?{filename:e}:{}}:g(`assistant_contact_part`)}if(t.type===`card`){let e=C(t.cardType,[`session`,`assistant`,`schedule`],`assistant_contact_part`);if(e===`session`){let e;if(t.target!==void 0){let n=_(t.target,`assistant_contact_part`),r=e=>{let t=v(n[e],`assistant_contact_part`);return!t||t!==t.trim()||t.length>512||Array.from(t).some(e=>e.charCodeAt(0)<32)?g(`assistant_contact_part`):t};e={hubId:r(`hubId`),hostId:r(`hostId`),instanceId:r(`instanceId`)}}return{type:`card`,cardType:`session`,sessionID:v(t.sessionID,`assistant_contact_part`),directory:v(t.directory,`assistant_contact_part`),title:y(t.title??null,`assistant_contact_part`),status:y(t.status??null,`assistant_contact_part`),branch:y(t.branch??null,`assistant_contact_part`),...e?{target:e}:{}}}return e===`assistant`?{type:`card`,cardType:`assistant`,assistantID:v(t.assistantID,`assistant_contact_part`),name:v(t.name,`assistant_contact_part`),providerID:v(t.providerID,`assistant_contact_part`),modelID:v(t.modelID,`assistant_contact_part`),mode:C(t.mode??`continuous`,[`continuous`,`stateless`],`assistant_contact_part`)}:{type:`card`,cardType:`schedule`,taskID:v(t.taskID,`assistant_contact_part`),projectID:v(t.projectID,`assistant_contact_part`),name:v(t.name,`assistant_contact_part`),kind:y(t.kind??null,`assistant_contact_part`),time:y(t.time??null,`assistant_contact_part`),timezone:y(t.timezone??null,`assistant_contact_part`),prompt:y(t.prompt??null,`assistant_contact_part`),...t.cron===void 0?{}:{cron:y(t.cron,`assistant_contact_part`)},...t.date===void 0?{}:{date:y(t.date,`assistant_contact_part`)},...t.times===void 0?{}:{times:t.times===null?null:Array.isArray(t.times)?t.times.map(e=>v(e,`assistant_contact_part`)):g(`assistant_contact_part`)},...t.weekdays===void 0?{}:{weekdays:t.weekdays===null?null:Array.isArray(t.weekdays)?t.weekdays.map(e=>{let t=b(e,`assistant_contact_part`);return Number.isInteger(t)&&t>=0&&t<=6?t:g(`assistant_contact_part`)}):g(`assistant_contact_part`)}}}return g(`assistant_contact_part`)},oe=e=>{let t=_(e,`assistant_contact`),n=y(t.nextCursor,`assistant_contact`),r=S(t.complete,`assistant_contact`);if(!r&&!n||r&&n||!Array.isArray(t.messages))return g(`assistant_contact`);let i=b(t.generation,`assistant_contact`),a=b(t.revision,`assistant_contact`);return!Number.isSafeInteger(i)||i<0||!Number.isSafeInteger(a)||a<0?g(`assistant_contact`):{messages:t.messages.map(e=>{let t=_(e,`assistant_contact_message`);if(!Array.isArray(t.parts))return g(`assistant_contact_message`);let n=t.parts.map(ae);return{messageID:v(t.messageID,`assistant_contact_message`),assistantID:v(t.assistantID,`assistant_contact_message`),role:C(t.role,[`user`,`assistant`,`peer`],`assistant_contact_message`),turnID:v(t.turnID,`assistant_contact_message`),bubbleIndex:b(t.bubbleIndex,`assistant_contact_message`),createdAt:b(t.createdAt,`assistant_contact_message`),ordinal:b(t.ordinal,`assistant_contact_message`),status:v(t.status,`assistant_contact_message`),fromAssistantID:y(t.fromAssistantID??null,`assistant_contact_message`),fromAssistantName:y(t.fromAssistantName??null,`assistant_contact_message`),parts:n,text:typeof t.text==`string`?t.text:n.filter(e=>e.type===`text`).map(e=>e.text).join(``),cards:n.filter(e=>e.type===`card`)}}),nextCursor:n,complete:r,generation:i,revision:a}},se=e=>{let t=_(e,`assistant_scheduled_tasks`);return Array.isArray(t.tasks)?{tasks:t.tasks.map(e=>{let t=_(e,`assistant_scheduled_task`),n=t.task===null||t.task===void 0?null:_(t.task,`assistant_scheduled_task_live`);return{assistantID:v(t.assistantID,`assistant_scheduled_task`),projectID:v(t.projectID,`assistant_scheduled_task`),taskID:v(t.taskID,`assistant_scheduled_task`),createdAt:b(t.createdAt,`assistant_scheduled_task`),projectPath:y(t.projectPath??null,`assistant_scheduled_task`),projectLabel:y(t.projectLabel??null,`assistant_scheduled_task`),task:n}})}:g(`assistant_scheduled_tasks`)},j=async(e,t)=>{try{let t=await e.json();if(t&&typeof t.error==`string`&&t.error.trim().length>0)return t.error}catch{return t}return t},M=e=>{let t=typeof e==`string`?e.trim():``;if(!t)throw Error(`projectId is required`);return t},N=e=>e===null||typeof e==`string`,ce=e=>e===null||typeof e==`number`&&Number.isFinite(e),le=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0&&e<=864e13,ue=e=>e===null||le(e),de=e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.id==`string`&&t.id.length>0&&typeof t.projectId==`string`&&t.projectId.length>0&&typeof t.taskId==`string`&&t.taskId.length>0&&typeof t.taskName==`string`&&(t.trigger===`scheduled`||t.trigger===`manual`)&&(t.status===`running`||t.status===`success`||t.status===`error`)&&N(t.sessionId)&&N(t.directory)&&N(t.error)&&le(t.startedAt)&&ue(t.finishedAt)&&ce(t.durationMs)&&(t.durationMs===null||t.durationMs>=0)},fe=e=>{if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Malformed scheduled task runs response`);let t=e;if(!Array.isArray(t.runs)||!t.runs.every(de)||!N(t.nextCursor)||typeof t.complete!=`boolean`||t.complete!==(t.nextCursor===null)||t.nextCursor!==null&&t.nextCursor.length===0)throw Error(`Malformed scheduled task runs response`);return{runs:t.runs,nextCursor:t.nextCursor,complete:t.complete}},pe=async(e,t)=>{let n=new URLSearchParams;e.before&&n.set(`before`,e.before);let i=e.limit??20;if(!Number.isInteger(i)||i<1)throw Error(`limit must be a positive integer`);n.set(`limit`,String(i)),e.projectId&&n.set(`projectId`,e.projectId),e.taskId&&n.set(`taskId`,e.taskId);let a=await r(`/api/yuri/scheduled-task-runs?${n.toString()}`,{signal:t});if(!a.ok)throw Error(await j(a,`Failed to load scheduled task history`));return fe(await a.json().catch(()=>null))},me=async({signal:e}={})=>{let t=await r(`/api/yuri/scheduled-tasks`,{signal:e});if(!t.ok)throw Error(await j(t,`Failed to load schedules`));let n=await t.json().catch(()=>null);if(!n||!Array.isArray(n.tasks))throw Error(`Malformed schedules response`);return{tasks:Array.isArray(n?.tasks)?n.tasks:[],failedProjectIds:Array.isArray(n?.failedProjectIds)?n.failedProjectIds.filter(e=>typeof e==`string`):[]}},he=async(e,t)=>{let n=M(e),i=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks`,{method:`PUT`,headers:{"content-type":`application/json`,accept:`application/json`},body:JSON.stringify({task:t})});if(!i.ok)throw Error(await j(i,`Failed to save schedule`));let a=await i.json().catch(()=>null);return!a||!Array.isArray(a.tasks)?[]:a.tasks},ge=async(e,t)=>{let n=M(e),i=M(t),a=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks/${encodeURIComponent(i)}`,{method:`DELETE`,headers:{accept:`application/json`}});if(!a.ok)throw Error(await j(a,`Failed to delete schedule`));let o=await a.json().catch(()=>null);return!o||!Array.isArray(o.tasks)?[]:o.tasks},_e=async(e,t)=>{let n=M(e),i=M(t),a=await r(`/api/projects/${encodeURIComponent(n)}/scheduled-tasks/${encodeURIComponent(i)}/run`,{method:`POST`,headers:{accept:`application/json`}});if(!a.ok)throw Error(await j(a,`Failed to run schedule`));let o=await a.json().catch(()=>null);return{sessionId:typeof o?.sessionId==`string`&&o.sessionId.length>0?o.sessionId:void 0}},P=(e,t)=>e.ordinal===t.ordinal?e.messageID<t.messageID?-1:+(e.messageID>t.messageID):e.ordinal-t.ordinal,ve=e=>{if(e.type===`file`||e.type===`card`)return!0;if(e.type!==`text`)return!1;let t=typeof e.text==`string`?e.text.trim():``;return!!t&&!t.startsWith(`yuri.settle.`)&&!t.startsWith(`oc.settle.`)},ye=(e,t)=>{if(!t||!e.readTip||!((e.unreadCount??0)>0))return null;let n=e.readTip;if(t.generation!==n.generation)return null;let r;for(let n=t.messages.length-1;n>=0;--n){let i=t.messages[n];if(i.assistantID===e.id&&(i.status===`complete`||i.status===`error`)&&i.parts.some(ve)){r=i;break}}if(!r)return null;let i=e.readWatermark;return i&&(i.generation>t.generation||i.generation===t.generation&&P({ordinal:i.ordinal,messageID:i.messageID},{ordinal:r.ordinal,messageID:r.messageID})>=0)?null:{generation:t.generation,ordinal:r.ordinal,messageID:r.messageID}},be=()=>({messages:[],generation:-1,revision:0,olderCursor:null,olderComplete:!0,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:[]}),F=e=>!!(e&&e.generation>=0),I=(e,t)=>P({ordinal:e.ordinal,messageID:e.messageID},{ordinal:t.ordinal,messageID:t.messageID}),L=(e,t,n=`incoming`)=>{let r=new Map;for(let t of e)r.set(t.messageID,t);for(let e of t)(n===`incoming`||!r.has(e.messageID))&&r.set(e.messageID,e);return[...r.values()].sort(I)},xe=e=>{let t=1/0;for(let n of e)n.ordinal<t&&(t=n.ordinal);return Number.isFinite(t)?t:null},R=e=>e.map(e=>e.messageID),z=(e,t)=>{for(let n of e)if(t.has(n))return!0;return!1},B=e=>new Set(e),Se=(e,t)=>!e||!t||e.length!==t.length?!1:e.every((e,n)=>e===t[n]),Ce=e=>({...e,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null}),V=e=>({ordinal:e.ordinal,messageID:e.messageID}),we=(e,t,n)=>{if(n)return[...t];if(t.length===0)return[...e];let r=t[0];return[...e.filter(e=>P(V(e),V(r))<0),...t]},Te=(e,t)=>{let n=e??be(),r=F(n),i=[...t.messages].sort(I),a=R(i);if(r&&t.generation<n.generation)return n;if(r&&t.generation>n.generation)return{messages:i,generation:t.generation,revision:t.revision,olderCursor:t.nextCursor,olderComplete:t.complete,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:a};if(!r)return{messages:i,generation:t.generation,revision:t.revision,olderCursor:t.complete?null:t.nextCursor,olderComplete:t.complete,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:a};let o=Math.max(n.revision,t.revision),s=t.revision>=n.revision;if(i.length===0)return s&&t.complete?{messages:[],generation:t.generation,revision:o,olderCursor:null,olderComplete:!0,hasMessageGap:!1,gapCursor:null,gapRequestIDs:null,gapTargetIDs:null,liveWindowIDs:[]}:{...n,generation:t.generation,revision:o,olderCursor:n.olderCursor??t.nextCursor,olderComplete:n.olderComplete&&t.complete,liveWindowIDs:[],hasMessageGap:n.hasMessageGap,gapCursor:n.hasMessageGap?t.nextCursor??n.gapCursor:null,gapRequestIDs:n.hasMessageGap?n.gapRequestIDs:null,gapTargetIDs:n.hasMessageGap?n.gapTargetIDs:null};let c;if(s)c=we(n.messages,i,t.complete);else{let e=xe(i);c=L(n.messages.filter(t=>t.ordinal<e),L(n.messages.filter(t=>t.ordinal>=e),i,`existing`),`incoming`)}let l=n.liveWindowIDs,u=B(a),d=l.length>0&&z(l,u),f=n.hasMessageGap,p=n.gapCursor,m=n.gapRequestIDs,h=n.gapTargetIDs;if(!d&&l.length>0&&t.nextCursor){f=!0,p=t.nextCursor;let e=l.filter(e=>!u.has(e));m=e.length>0?e:[...l],h=n.hasMessageGap&&n.gapTargetIDs&&n.gapTargetIDs.length>0?n.gapTargetIDs:m}else n.hasMessageGap?(f=!0,p=n.gapCursor,m=n.gapRequestIDs,h=n.gapTargetIDs):(f=!1,p=null,m=null,h=null);return{messages:c,generation:t.generation,revision:o,olderCursor:n.liveWindowIDs.length===0&&n.messages.length===0?t.complete?null:t.nextCursor:n.olderCursor,olderComplete:!r||n.liveWindowIDs.length===0&&n.messages.length===0?t.complete:n.olderComplete,hasMessageGap:f,gapCursor:f?p:null,gapRequestIDs:f?m:null,gapTargetIDs:f?h:null,liveWindowIDs:a}},Ee=(e,t)=>{if(!F(e)||t.generation!==e.generation)return e;let n=t.revision>=e.revision?`incoming`:`existing`,r=L(e.messages,t.messages,n);return{...e,messages:r,revision:Math.max(e.revision,t.revision),olderCursor:t.complete?null:t.nextCursor,olderComplete:t.complete}},De=(e,t,n)=>{if(!F(e)||t.generation!==e.generation)return e;let r=t.revision>=e.revision?`incoming`:`existing`,i=L(e.messages,t.messages,r),a=Math.max(e.revision,t.revision),o=n?.requestIDs??e.gapRequestIDs;if(!(e.hasMessageGap&&o&&e.gapRequestIDs&&Se(o,e.gapRequestIDs)))return{...e,messages:i,revision:a};let s=R(t.messages),c=e.gapTargetIDs??[],l=B(c);return c.length>0&&z(s,l)||t.complete||!t.nextCursor?Ce({...e,messages:i,revision:a}):{...e,messages:i,revision:a,hasMessageGap:!0,gapCursor:t.nextCursor??e.gapCursor,gapRequestIDs:e.gapRequestIDs,gapTargetIDs:e.gapTargetIDs}},H={snapshot:(e=t())=>[e,`assistants`,`snapshot`],capability:(e=t())=>[e,`assistants`,`capability`],history:(e,r,i,a=t(),o=n())=>[a,o,`assistants`,`history`,e,r,i],contact:(e,r=t(),i=n())=>[r,i,`assistants`,`contact`,e],scheduledTasks:(e,r=t(),i=n())=>[r,i,`assistants`,`scheduled-tasks`,e],globalScheduledTasks:(e=t())=>[e,`scheduled-tasks`]},U=async(e,t={})=>{let n=await r(e,t),i=await n.json().catch(()=>null);if(!n.ok){let e=i&&typeof i==`object`&&`error`in i&&typeof i.error==`string`?i.error:`request_failed`,t=i&&typeof i==`object`&&`message`in i&&typeof i.message==`string`?i.message:void 0;throw new p(e,n.status,void 0,t)}return i},W=(e,t)=>({method:e,headers:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t)}),G=(e,r)=>{if(t()!==e||n()!==r)throw new p(`runtime_stale`,409)},Oe=(e,t,r)=>{c.setQueryData(H.snapshot(r),n=>n&&{...n,assistants:n.assistants.map(n=>n.id!==e||n.sessionGeneration>t.sessionGeneration?n:{...n,sessionID:t.sessionID,sessionGeneration:t.sessionGeneration,effectiveWorkspacePath:t.directory})}),c.invalidateQueries({queryKey:H.snapshot(r)}),c.invalidateQueries({queryKey:[r,n(),`assistants`,`history`,e]})},ke=(e,t)=>{c.setQueryData(H.snapshot(t),t=>t&&{...t,assistants:t.assistants.some(t=>t.id===e.id)?t.assistants.map(t=>t.id===e.id?e:t):[...t.assistants,e]}),c.invalidateQueries({queryKey:H.snapshot(t)})},Ae=2500,je=15e3,Me=e=>!!e?.assistants.some(e=>e.working||e.activeContactTurn),Ne=(e,t={})=>{if(t.assistantID){let n=e?.assistants.find(e=>e.id===t.assistantID);return n?.working||n?.activeContactTurn?Ae:je}return Me(e)?Ae:je},K=(e=t())=>({queryKey:H.snapshot(e),queryFn:async({signal:e})=>ne(await U(`/api/yuri/assistants/snapshot`,{signal:e})),staleTime:0,retry:2,refetchInterval:e=>Ne(e.state.data),refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),q=new Map,J=e=>{let r=q.get(e);if(r)r.count+=1;else{let r=n(),i=!1,a=!1,o=!1,l=()=>!i&&t()===e&&n()===r,u=async()=>{if(o=!0,!a){a=!0;try{do o=!1,c.getQueryCache().find({queryKey:H.snapshot(e),exact:!0})?.state.fetchStatus===`fetching`&&(o=!0),await c.invalidateQueries({queryKey:H.snapshot(e),exact:!0},{cancelRefetch:!1});while(o&&l())}finally{a=!1}}},d=s(t=>{if(!l())return;let n=c.getQueryData(H.snapshot(e));(t.type===`event-stream-ready`||t.type===`contact-turn-start`||t.type===`contact-turn-end`||t.type===`assistants-changed`&&(!n||t.revision>n.revision))&&u()});q.set(e,{count:1,dispose:()=>{i=!0,d()}})}return()=>{let t=q.get(e);t&&--t.count===0&&(t.dispose(),q.delete(e))}},Pe=e=>{let n=(0,f.c)(7),r,i,a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=t(),i=o,r=K(a),n[0]=r,n[1]=i,n[2]=a):(r=n[0],i=n[1],a=n[2]);let s;n[3]===e?s=n[4]:(s={...r,select:e},n[3]=e,n[4]=s);let c=i(s),l,u;return n[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>J(a),u=[a],n[5]=l,n[6]=u):(l=n[5],u=n[6]),d.useEffect(l,u),c},Fe=e=>e.enabled?e.assistants.reduce((e,t)=>e+(t.unreadCount??0),0):0,Ie=()=>{let e=(0,f.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=o,r={...K(i),select:Fe},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),s,c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>J(i),c=[i],e[3]=s,e[4]=c):(s=e[3],c=e[4]),d.useEffect(s,c),a.data??0},Le=e=>e.enabled&&Me(e),Re=()=>{let e=(0,f.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=o,r={...K(i),select:Le},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),s,c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>J(i),c=[i],e[3]=s,e[4]=c):(s=e[3],c=e[4]),d.useEffect(s,c),a.data??!1},ze=(e,t={})=>{let n=new URLSearchParams;return n.set(`limit`,String(t.limit??20)),t.before&&n.set(`before`,t.before),t.messageID&&n.set(`messageID`,t.messageID),`/api/yuri/assistants/${encodeURIComponent(e)}/contact/messages?${n}`},Y=async(e,t,n)=>oe(await U(ze(e,t),n?{signal:n}:{})),Be=(e,t)=>e.generation===t.generation&&e.revision===t.revision&&e.olderCursor===t.olderCursor&&e.olderComplete===t.olderComplete&&e.hasMessageGap===t.hasMessageGap&&e.gapCursor===t.gapCursor&&e.messages===t.messages&&e.liveWindowIDs===t.liveWindowIDs&&e.gapRequestIDs===t.gapRequestIDs&&e.gapTargetIDs===t.gapTargetIDs,X=new Map,Z=new Map,Q=e=>e.join(``),Ve=async(e,t,n,r,i)=>{let a=Q(t),o=Z.get(a);if(o)return o;let s=(async()=>{let a=c.getQueryData(t)??n,o=0,s=!1,l=!1,u=a.gapRequestIDs?[...a.gapRequestIDs]:null,d=a.gapCursor;for(;a.hasMessageGap&&a.gapCursor&&o<5&&!i?.aborted;){G(r.transport,r.runtimeGeneration),o+=1;let n=a.gapCursor;try{let o=await Y(e,{limit:20,before:n},i);G(r.transport,r.runtimeGeneration);let l=c.getQueryData(t)??a;if(o.generation!==l.generation){a=l;break}let f=!u||!!(l.hasMessageGap&&l.gapRequestIDs&&l.gapRequestIDs.length===u.length&&l.gapRequestIDs.every((e,t)=>e===u[t]));if(a=De(l,o,u?{requestIDs:u,cursor:d}:void 0),c.setQueryData(t,a),!f)break;if(!a.hasMessageGap){s=!0;break}if(a.gapCursor&&a.gapCursor!==n)s=!0;else break}catch(e){if(i?.aborted||m(e))break;l=!0,a=c.getQueryData(t)??a;break}}return{view:c.getQueryData(t)??a,failed:l,progressed:s}})();Z.set(a,s);try{return await s}finally{Z.get(a)===s&&Z.delete(a)}},He=(e,r=t(),i=n(),a={})=>({queryKey:H.contact(e,r,i),queryFn:async({signal:t})=>{G(r,i),await l(),G(r,i);let n=H.contact(e,r,i),a=c.getQueryData(n),o=await Y(e,{limit:20},t);G(r,i);let s=Te(c.getQueryData(n)??a??null,o);c.setQueryData(n,s);let u=Q(n);if(s.hasMessageGap&&s.gapCursor){X.delete(u);let a=await Ve(e,n,s,{transport:r,runtimeGeneration:i},t);s=a.view,(a.failed||a.view.hasMessageGap&&!a.progressed)&&a.view.gapCursor&&X.set(u,a.view.gapCursor)}else X.delete(u);G(r,i);let d=c.getQueryData(n)??s;return a&&Be(a,d)?a:d},retry:2,staleTime:0,refetchInterval:()=>a.reconcileInForeground?Ne(c.getQueryData(H.snapshot(r)),{assistantID:e}):!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0,refetchOnReconnect:!0,structuralSharing:!0}),Ue=(e,r=!0)=>{let i=t(),a=n(),[l,u]=d.useState(!1),[f,p]=d.useState(null),[h,g]=d.useState(!1),_=d.useRef(null),v=d.useRef(null),y=d.useRef(null),b=d.useRef(null),x=d.useRef({assistantID:e,transport:i,runtimeGeneration:a,enabled:r});x.current={assistantID:e,transport:i,runtimeGeneration:a,enabled:r};let S=o({...He(e,i,a,{reconcileInForeground:!0}),enabled:r&&!!e});d.useEffect(()=>{!r||!e||c.invalidateQueries({queryKey:H.snapshot(i),exact:!0},{cancelRefetch:!1})},[e,r,a,i]),d.useEffect(()=>s(n=>{t()===i&&(n.type===`assistants-changed`||n.type===`event-stream-ready`||n.type===`contact-turn-end`)&&(n.type===`contact-turn-end`&&`assistantID`in n&&n.assistantID!==e||c.invalidateQueries({queryKey:H.contact(e,i,a),exact:!0}))}),[e,a,i]),d.useEffect(()=>{let t=Q(H.contact(e,i,a));return()=>{y.current?.abort(),b.current?.abort(),y.current=null,b.current=null,_.current=null,v.current=null,X.delete(t)}},[e,i,a,r]);let C=S.data,w=H.contact(e,i,a),T=async()=>{if(!e||!r)return;if(_.current)return _.current;let t=c.getQueryData(w)??C;if(!t||t.olderComplete||!t.olderCursor)return;p(null),u(!0);let n=new AbortController;b.current?.abort(),b.current=n;let o={transport:i,runtimeGeneration:a,assistantID:e,cursor:t.olderCursor},s=(async()=>{try{G(o.transport,o.runtimeGeneration);let e=await Y(o.assistantID,{limit:20,before:o.cursor},n.signal);if(n.signal.aborted||(G(o.transport,o.runtimeGeneration),x.current.assistantID!==o.assistantID||x.current.transport!==o.transport||x.current.runtimeGeneration!==o.runtimeGeneration))return;let r=c.getQueryData(w)??t;if(e.generation!==r.generation)return;c.setQueryData(w,Ee(r,e))}catch(e){if(n.signal.aborted||m(e))return;let t=e instanceof Error?e:Error(String(e));throw p(t),t}finally{b.current===n&&(b.current=null),u(!1),_.current=null}})();return _.current=s,s},E=async(t=`explicit`)=>{if(!e||!r)return;if(v.current)return v.current;let n=c.getQueryData(w)??C;if(!n?.hasMessageGap||!n.gapCursor)return;let o=Q(w);if(t===`auto`&&X.get(o)===n.gapCursor)return;t===`explicit`&&X.delete(o),g(!0);let s=new AbortController;y.current?.abort(),y.current=s;let l={transport:i,runtimeGeneration:a,assistantID:e,cursor:n.gapCursor},u=(async()=>{try{G(l.transport,l.runtimeGeneration);let e=await Ve(l.assistantID,w,n,{transport:l.transport,runtimeGeneration:l.runtimeGeneration},s.signal);if(s.signal.aborted)return;if(G(l.transport,l.runtimeGeneration),e.failed||!e.progressed){e.view.gapCursor&&X.set(o,e.view.gapCursor);return}e.view.hasMessageGap||X.delete(o)}catch(e){if(s.signal.aborted||m(e))return;throw X.set(o,l.cursor),e}finally{y.current===s&&(y.current=null),g(!1),v.current=null}})();return v.current=u,u};return d.useEffect(()=>{if(!r||!e||!C?.hasMessageGap||!C.gapCursor||S.isFetching||h)return;let t=Q(w);X.get(t)!==C.gapCursor&&E(`auto`).catch(()=>void 0)},[r,e,C?.hasMessageGap,C?.gapCursor,S.isFetching,h,w]),{data:C?{messages:C.messages,generation:C.generation,revision:C.revision,nextCursor:C.olderCursor,complete:C.olderComplete}:void 0,status:S.status,fetchStatus:S.fetchStatus,isError:S.isError,isPending:S.isPending,isFetching:S.isFetching,isSuccess:S.isSuccess,error:S.error instanceof Error?S.error:S.error?Error(String(S.error)):null,refetch:()=>S.refetch(),fetchPreviousPage:T,hasPreviousPage:!!(C&&!C.olderComplete&&C.olderCursor),isFetchingPreviousPage:l,previousPageError:f,hasMessageGap:!!C?.hasMessageGap,isFillingMessageGap:h,retryMessageGap:()=>E(`explicit`)}},We=async(e,r)=>{let i=t(),a=n();await l(),G(i,a);let o=await Y(e,{messageID:r,limit:1});if(G(i,a),!o.messages.some(e=>e.messageID===r&&e.role===`user`))return null;c.invalidateQueries({queryKey:H.contact(e,i,a),exact:!0}),c.invalidateQueries({queryKey:H.snapshot(i),exact:!0});let s=c.getQueryData(H.snapshot(i));return{admitted:!0,messageID:r,revision:o.revision??s?.revision??null}},Ge=(e,r=t(),i=n())=>({queryKey:H.scheduledTasks(e,r,i),queryFn:async({signal:t})=>{G(r,i);let n=se(await U(`/api/yuri/assistants/${encodeURIComponent(e)}/scheduled-tasks`,{signal:t}));return G(r,i),n},refetchOnMount:`always`,retry:(e,t)=>!(t instanceof p&&t.status===404)&&e<2}),Ke=(e,r)=>{let i=(0,f.c)(6),a=r===void 0||r,s,c;if(i[0]!==e){let r=t(),a=n();c=o,s=Ge(e,r,a),i[0]=e,i[1]=s,i[2]=c}else s=i[1],c=i[2];let l=a&&!!e,u;return i[3]!==s||i[4]!==l?(u={...s,enabled:l},i[3]=s,i[4]=l,i[5]=u):u=i[5],c(u)},$=(e=t())=>({queryKey:H.globalScheduledTasks(e),queryFn:me,refetchOnMount:`always`}),qe=e=>{let t=(0,f.c)(3),n=e===void 0||e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=$(),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i={...r,enabled:n},t[1]=n,t[2]=i),o(i)},Je=e=>e.tasks.some(({task:e})=>e.state.lastStatus===`running`),Ye=()=>{let e=(0,f.c)(5),n,r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=t(),n=o,r={...$(i),select:Je,staleTime:0,refetchInterval:mt,refetchIntervalInBackground:!1},e[0]=n,e[1]=r,e[2]=i):(n=e[0],r=e[1],i=e[2]);let a=n(r),l,u;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>s(e=>{t()===i&&(e.type===`scheduled-task-ran`||e.type===`event-stream-ready`)&&c.invalidateQueries({queryKey:$(i).queryKey,exact:!0})}),u=[i],e[3]=l,e[4]=u):(l=e[3],u=e[4]),d.useEffect(l,u),a.data===!0},Xe=(e,r=t())=>{c.invalidateQueries({queryKey:[r,n(),`assistants`,`contact`,e]})},Ze=(e=t())=>({queryKey:H.capability(e),queryFn:()=>dt(),retry:!1}),Qe=()=>{let e=(0,f.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=Ze(),e[0]=t):t=e[0],o(t)},$e=(e=c,n=t())=>e.getQueryData(H.snapshot(n)),et=(e=c,n=t())=>e.fetchQuery(K(n)),tt=async(e=c)=>{let r=t(),i=n();await e.invalidateQueries({queryKey:H.snapshot(r),exact:!0}),G(r,i);let a=await e.fetchQuery(K(r));return G(r,i),a},nt=15e3,rt=e=>{throw e instanceof p?e:m(e)?new p(`admission_timeout`,408):e},it=async(e,r,i)=>{let a=t(),o=n(),s=typeof i==`string`?[{type:`text`,text:i}]:Array.isArray(i.parts)&&i.parts.length>0?i.parts:[{type:`text`,text:i.text??``}],c=AbortSignal.timeout(nt);try{let t=ie(await U(`/api/yuri/assistants/${encodeURIComponent(e)}/messages`,{...W(`POST`,{messageID:r,parts:s,language:u.getState().locale}),signal:c}));return G(a,o),Oe(e,t.binding,a),Xe(e,a),t}catch(e){return rt(e)}},at=async(e,r,i,a,o)=>{let s=t(),c=n(),l=A(await U(`/api/yuri/assistants/${encodeURIComponent(e)}/share`,W(`POST`,{operationID:r,payload:{messageID:i,parts:a,source:o}})));return G(s,c),l},ot=async(e,r=t(),i=n())=>{G(r,i);let a=A(await U(`/api/yuri/assistants/share-operations/${encodeURIComponent(e)}`));return G(r,i),a},st=async(e,r=t(),i=n())=>{let a=e;for(let e=0;e<60&&(a.state===`running`||a.state===`submitting`);e+=1)G(r,i),await new Promise(e=>setTimeout(e,750)),a=await ot(a.operationID,r,i);if(G(r,i),a.state===`completed`)return a;throw a.state===`failed`?new h(a.errorCode??`share_failed`,400,a):new h(`share_unresolved`,408,a)},ct=async e=>{let n=t(),r=k(await U(`/api/yuri/assistants`,W(`POST`,{...e,language:u.getState().locale})));return ke(r,n),r},lt=async(e,r)=>{let i=t(),a=n(),o=k(await U(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,W(`PATCH`,{...r,expectedRevision:e.revision})));return G(i,a),r.pinned===void 0?ke(o,i):(await c.cancelQueries({queryKey:H.snapshot(i),exact:!0}),G(i,a),await c.fetchQuery(K(i)),G(i,a)),o},ut=async e=>{await U(`/api/yuri/assistants/${encodeURIComponent(e.id)}`,W(`DELETE`,{expectedRevision:e.revision})),await c.invalidateQueries({queryKey:H.snapshot(t())})},dt=async()=>w(await U(`/api/yuri/assistants/capability`)),ft=async(e,r)=>{let i=t(),a=n(),o=O(r);try{let t=te(await U(`/api/yuri/assistants/${encodeURIComponent(e)}/contact/read`,{...W(`POST`,o),signal:AbortSignal.timeout(15e3)}));if(G(i,a),t.assistantID!==e)throw new p(`invalid_assistant_read_response`,200);return t}finally{t()===i&&n()===a&&c.invalidateQueries({queryKey:H.snapshot(i),exact:!0})}},pt=async e=>{let r=e.assistants.filter(e=>(e.unreadCount??0)>0&&e.readTip).map(e=>({id:e.id,position:{...e.readTip}})),i=t(),a=n(),o=[];for(let e=0;e<r.length;e+=4)o.push(...await Promise.allSettled(r.slice(e,e+4).map(async e=>(G(i,a),ft(e.id,e.position)))));return{failed:o.filter(e=>e.status===`rejected`).length}};function mt(e){return e.state.data&&Je(e.state.data)?2500:15e3}export{p as A,ye as C,pe as D,me as E,m as M,_e as O,st as S,ge as T,Pe as _,et as a,qe as b,pt as c,it as d,at as f,Ke as g,Ue as h,ut as i,h as j,he as k,ft as l,Qe as m,We as n,dt as o,lt as p,ct as r,tt as s,He as t,$e as u,Ie as v,ve as w,Ye as x,Re as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t}from"./runtime-switch-DEPKHgdL.js";import{n}from"./runtime-fetch-V-iMWR8t.js";import{st as r}from"./vendor-base-ui-wXsskyKm.js";import{U as i}from"./client-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t}from"./runtime-switch-DEPKHgdL.js";import{n}from"./runtime-fetch-V-iMWR8t.js";import{st as r}from"./vendor-base-ui-wXsskyKm.js";import{U as i}from"./client-ITylDDCS.js";import{n as a}from"./vendor-react-BkccXcWz.js";import{i as o,r as s}from"./vendor-reactuses-core-DjKFMfz7.js";import{Yi as c}from"./ui-Cd2-HQSa.js";import{n as l,r as u}from"./audio-session-BFWjrDbp.js";import{n as d,r as f,t as p}from"./browserVoiceService-x5Pci8L3.js";var m=e=>!!(e&&typeof e==`object`&&typeof e.type==`string`),h=e=>e.filter(m),g=e=>{let t=e,n=t.text;return typeof n==`string`?n:t.content||t.value||``},_=e=>/[^\s\u200B-\u200D\u2060\uFEFF]/u.test(e),v=e=>e.type===`text`&&!_(g(e)),y=(e,t={})=>{let{includeReasoning:n=!0}=t,r=h(e),a=r.some(e=>!e.synthetic);return r.filter(e=>{let t=!!e.synthetic;if(e.type===`text`){if(v(e))return!1;let t=g(e);if(t.includes(`<system-reminder>`)&&i(t).length===0)return!1}return t&&a||!n&&e.type===`reasoning`?!1:e.type!==`patch`})},b=e(r(),1),x=3e4,S=null,C=null;async function w(){return S&&Date.now()-S.checkedAt<x?S:C||(C=(async()=>{try{let e=await n(`/api/tts/say/status`);if(!e.ok){let e={available:!1,voices:[],checkedAt:Date.now()};return S=e,e}let t=await e.json(),r={available:!!t.available,voices:Array.isArray(t.voices)?t.voices:[],checkedAt:Date.now()};return S=r,r}catch{let e={available:!1,voices:[],checkedAt:Date.now()};return S=e,e}finally{C=null}})(),C)}var T=null;function E(){return l(),T||=new(window.AudioContext||window.webkitAudioContext),T}function D(e={}){let t=e.enabled??!0,[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)([]),[l,d]=(0,b.useState)(null),f=(0,b.useRef)(null),p=(0,b.useRef)(null),m=(0,b.useCallback)(async()=>{try{let e=E();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(`[useSayTTS] Failed to unlock audio:`,e)}},[]),h=(0,b.useCallback)(async()=>{if(!t)return o(!1),c([]),!1;try{let e=await w();return o(e.available),c(e.voices),e.available}catch{return o(!1),c([]),!1}},[t]);(0,b.useEffect)(()=>{h()},[h]);let g=(0,b.useCallback)(()=>{if(f.current){try{f.current.stop()}catch{}f.current=null}p.current&&=(p.current.abort(),null),i(!1)},[]),_=(0,b.useCallback)(async(e,t)=>{if(g(),!e.trim()){d(`No text to speak`),t?.onError?.(`No text to speak`);return}d(null);try{p.current=new AbortController;let r=await n(`/api/tts/say/speak`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:e.trim()}),signal:p.current.signal});if(!r.ok){let e=await r.json().catch(()=>({error:`Unknown error`}));throw Error(e.error||`HTTP ${r.status}`)}let a=await r.blob(),o=await a.arrayBuffer();a.size;let s=E();s.state===`suspended`&&await s.resume();let c=await s.decodeAudioData(o),l=s.createBufferSource();l.buffer=c,l.connect(s.destination),f.current=l,l.onended=()=>{i(!1),f.current=null,t?.onEnd?.()},i(!0),t?.onStart?.(),l.start(0)}catch(e){if(e.name===`AbortError`)return;let n=e instanceof Error?e.message:`Failed to speak`;console.error(`[useSayTTS] Error:`,n),d(n),t?.onError?.(n),i(!1)}},[g]);return(0,b.useEffect)(()=>u(g),[g]),(0,b.useEffect)(()=>()=>{g()},[g]),{isPlaying:r,isAvailable:a,voices:s,error:l,speak:_,stop:g,checkAvailability:h,unlockAudio:m}}function O(e,t=!1){return e?e.replace(/```[\s\S]*?```/g,``).replace(/`([^`\n]*)`/g,`$1`).replace(/!\[(?:\\.|[^\]\\])*\]\((?:\\.|[^()\\]|\((?:\\.|[^()\\])*\))*\)/g,` `).replace(/[*_~#]/g,``).replace(/https?:\/\/[^\s]+/g,``).replace(/(^|\s)\/(?:[\w.-]+\/)*[\w.-]+/g,`$1`).replace(/[//]+/g,` `).replace(/^\s*[$#>]\s*/gm,``).replace(/[[\]{}()<>|&;]/g,` `).replace(/\\/g,``).replace(/\s+/g,e=>t&&/\n\s*\n/.test(e)?`
|
|
2
2
|
|
|
3
3
|
`:` `).trim():``}function k(e){let t=[],n=e.trim();for(;n;){let e=n.indexOf(`
|
|
4
4
|
|