@vellumai/web 0.12.5-staging.2 → 0.12.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/{a2a-invite-2n6gRbID.js → a2a-invite-2DFcr5cK.js} +1 -1
- package/dist/assets/{about-page-N1N2ME9b.js → about-page-CPNBbifd.js} +1 -1
- package/dist/assets/{account-page-DOnTpuZ-.js → account-page-CJ_VtU8O.js} +1 -1
- package/dist/assets/{account-shell-CDePfCVi.js → account-shell-DxLEvbei.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-B3R4i5mk.js → acp-run-detail-panel-CB_kEsnS.js} +1 -1
- package/dist/assets/{activation-list-route-CHvtTpMz.js → activation-list-route-CGW4JxwN.js} +1 -1
- package/dist/assets/{activity-redirect-page-CTTRdkxc.js → activity-redirect-page-BIjoWTCA.js} +1 -1
- package/dist/assets/{activity-steps-panel-DR0Y2oZk.js → activity-steps-panel-DMQrQxtA.js} +1 -1
- package/dist/assets/add-credits-modal-Dv7XHwyy.js +1 -0
- package/dist/assets/{add-credits-modal-Bf3UIKWo.js → add-credits-modal-LuPOq4kF.js} +1 -1
- package/dist/assets/{ai-page-nn0k_IIb.js → ai-page-BYnMIWGK.js} +1 -1
- package/dist/assets/{all-chats-page-route-CPhckAtu.js → all-chats-page-route-nS138Vap.js} +1 -1
- package/dist/assets/{android-billing-handoff-Bdbyo5OG.js → android-billing-handoff-Q1a-ZHj3.js} +1 -1
- package/dist/assets/{animated-stat-square-C1mgqXq8.js → animated-stat-square--YG74D1T.js} +1 -1
- package/dist/assets/{api-key-screen-BRkuexDs.js → api-key-screen-CYEJaUQl.js} +1 -1
- package/dist/assets/app-Dy5YEvtr.css +2 -0
- package/dist/assets/{app-g1TvV-Dl.js → app-XG_RF2yi.js} +55 -55
- package/dist/assets/{app-info-R4Y_BPoT.js → app-info-zQFV6PZi.js} +1 -1
- package/dist/assets/{archive-redirect-page-Cb4LdH50.js → archive-redirect-page-DQbvA1Z-.js} +1 -1
- package/dist/assets/{assistant-handle-modal-BQBleuWg.js → assistant-handle-modal-CbatcZHT.js} +1 -1
- package/dist/assets/{assistant-inbox-page-route-CWQiF8gx.js → assistant-inbox-page-route-CxI0ViyX.js} +1 -1
- package/dist/assets/{assistant-inbox-upgrade-body-D3qYrXZU.js → assistant-inbox-upgrade-body-UUuOySwQ.js} +1 -1
- package/dist/assets/{assistant-status-panel-Dz8eNfbE.js → assistant-status-panel-Db_tR-He.js} +1 -1
- package/dist/assets/auth-store-CpGZaJMT.js +1 -0
- package/dist/assets/{auth-welcome-screen-CYoMdZVW.js → auth-welcome-screen-CCmw8K2q.js} +1 -1
- package/dist/assets/avatar-bundled-components-BOhrT2YY.js +1 -0
- package/dist/assets/{avatar-random-7_b8sN9c.js → avatar-random-ChM4pm8c.js} +2 -2
- package/dist/assets/{await-org-header-settled-BaNRynwI.js → await-org-header-settled-D7gXGNkp.js} +1 -1
- package/dist/assets/{background-task-detail-panel-DyQHMRcX.js → background-task-detail-panel-BfpAZAV7.js} +1 -1
- package/dist/assets/billing-page-D4Aw0uK5.js +3 -0
- package/dist/assets/{billing-redirect-page-DisLOg_5.js → billing-redirect-page-CPoe8Fxo.js} +1 -1
- package/dist/assets/{bookmarks-page-CaKBt1k4.js → bookmarks-page-DabizPXt.js} +1 -1
- package/dist/assets/{bundle-confirm-page-W2r6YW2S.js → bundle-confirm-page--s00f5SK.js} +1 -1
- package/dist/assets/{channel-transcript-panel-DjZfVDU6.js → channel-transcript-panel-kIskgOQO.js} +1 -1
- package/dist/assets/{channels-page-route-fjQyOftI.js → channels-page-route-DBYtimrU.js} +1 -1
- package/dist/assets/{chat-info-panel-CQwSB97L.js → chat-info-panel-C8-aLnsR.js} +1 -1
- package/dist/assets/{checkout-continuation-CGCnWbzu.js → checkout-continuation-DV6qqLmB.js} +1 -1
- package/dist/assets/{checkout-page-DoYMFyd4.js → checkout-page-CDszxDKy.js} +1 -1
- package/dist/assets/checkout-return-target-kOAtAdtD.js +1 -0
- package/dist/assets/{command-palette-D0KYxCnU.js → command-palette-CvSDYYKx.js} +1 -1
- package/dist/assets/{command-palette-window-page-BTVDAM95.js → command-palette-window-page-vfJ8M15E.js} +1 -1
- package/dist/assets/command-palette-xzqumNt2.js +1 -0
- package/dist/assets/{community-page--2IpZpKw.js → community-page-Dnrsh7JC.js} +1 -1
- package/dist/assets/{companion-accent-CBLb9Kpv.js → companion-accent-CbS8BVae.js} +1 -1
- package/dist/assets/{companion-dock-zones-page-DxuMrFf9.js → companion-dock-zones-page-CRsK4Pv9.js} +1 -1
- package/dist/assets/{companion-layout-C6tp_Wvl.js → companion-layout-DCGXuvsw.js} +1 -1
- package/dist/assets/{companion-popover-B7KpH4N8.js → companion-popover-BsoxqJOP.js} +1 -1
- package/dist/assets/{companion-popover-page-YQKBZlNX.js → companion-popover-page-B-tbPgw2.js} +1 -1
- package/dist/assets/{companion-surface-DM4lsh7V.js → companion-surface-Lu_Uj_QW.js} +1 -1
- package/dist/assets/{companion-surface-page-BvvOIZO_.js → companion-surface-page-Cu5KYGHm.js} +1 -1
- package/dist/assets/{companion-tour-entry-BBJtal5R.js → companion-tour-entry-C3txdrPi.js} +1 -1
- package/dist/assets/{companion-watch-frame-page-D_cml_5E.js → companion-watch-frame-page-CxWQHVyd.js} +1 -1
- package/dist/assets/{connect-page-De9qYGFr.js → connect-page-BnIPLsIl.js} +1 -1
- package/dist/assets/{consent-controls-gxLFaZqC.js → consent-controls-CzokWb_V.js} +1 -1
- package/dist/assets/{contacts-gateway-xRhaWZVq.js → contacts-gateway-CXKsci-d.js} +1 -1
- package/dist/assets/{contacts-page-route-DuAdAqXe.js → contacts-page-route-rxGvMBYc.js} +1 -1
- package/dist/assets/{copy-button-DUDzh1nb.js → copy-button-CDraE4Q7.js} +1 -1
- package/dist/assets/{credential-entry-page-DMfgwRck.js → credential-entry-page-CISniD8g.js} +1 -1
- package/dist/assets/{credentials-page-CMgmkOGd.js → credentials-page-CY8AWXDI.js} +1 -1
- package/dist/assets/{csv-preview-CQY-2Dx9.js → csv-preview-CIYuh6hO.js} +1 -1
- package/dist/assets/{danger-zone-redirect-page-yy5xW0mL.js → danger-zone-redirect-page-CvReBloK.js} +1 -1
- package/dist/assets/{debug-page-BU3-JUrT.js → debug-page-Bi_rgZ5l.js} +1 -1
- package/dist/assets/deploy-dialogs-C2piFvJp.js +1 -0
- package/dist/assets/{deploy-dialogs-Daud7Ibu.js → deploy-dialogs-HsxdyBbf.js} +1 -1
- package/dist/assets/{desktop-preview-content-Cg0mJFW9.js → desktop-preview-content-CV1cf7mU.js} +2 -2
- package/dist/assets/{desktop-status-DGbF0l_T.js → desktop-status-DEExfNSz.js} +1 -1
- package/dist/assets/{desktop-viewer-ClERTjPw.js → desktop-viewer-D7Wghl4J.js} +1 -1
- package/dist/assets/{detail-card-uV-Fvv0m.js → detail-card-C7tTQwmv.js} +1 -1
- package/dist/assets/{detail-panel-stop-button-CpIFrlAa.js → detail-panel-stop-button-DnqOX8hL.js} +1 -1
- package/dist/assets/{detail-primitives-BVAXXLTM.js → detail-primitives-wlzeidYY.js} +1 -1
- package/dist/assets/{developer-page-C2US1ngx.js → developer-page-BCRjXz1c.js} +1 -1
- package/dist/assets/{devices-redirect-page-C6LAvhsi.js → devices-redirect-page-7ye90eAr.js} +1 -1
- package/dist/assets/{dictation-overlay-page-4Ws_3jMt.js → dictation-overlay-page-DOBCTXi_.js} +1 -1
- package/dist/assets/{document-load-Bc7bzEgK.js → document-load-C2pkXMId.js} +1 -1
- package/dist/assets/document-load-D-wTWGym.js +1 -0
- package/dist/assets/{document-viewer-page-rYlc99qC.js → document-viewer-page-DOzOlaOx.js} +1 -1
- package/dist/assets/{emails-page-BoKSj0Bi.js → emails-page-BcGsKx08.js} +1 -1
- package/dist/assets/{file-diff-view-D4vpp28T.js → file-diff-view-Cl9aJla4.js} +1 -1
- package/dist/assets/{file-view-mode-CFTpeJXr.js → file-view-mode-B1UgDONH.js} +1 -1
- package/dist/assets/{general-page-CCuGQaED.js → general-page-D5BxF2Og.js} +1 -1
- package/dist/assets/{hatching-screen-DlG-aMJX.js → hatching-screen-6FiOHAnm.js} +1 -1
- package/dist/assets/{hosting-screen-COVzfBVx.js → hosting-screen-CYbWPSH7.js} +1 -1
- package/dist/assets/{identity-page-route-9SdenOmX.js → identity-page-route-B7hLB4vt.js} +1 -1
- package/dist/assets/{inspect-page-9FD0Y4Wu.js → inspect-page-Q3Uns0YC.js} +3 -3
- package/dist/assets/{integrations-page-CXrP8dj3.js → integrations-page-C--xdzQF.js} +1 -1
- package/dist/assets/{intelligence-layout-_R-R-8WX.js → intelligence-layout-5NiOjPJY.js} +1 -1
- package/dist/assets/{intelligence-layout-slots-store-DfpF-AiU.js → intelligence-layout-slots-store-DTzofJ6x.js} +1 -1
- package/dist/assets/{keyboard-shortcuts-redirect-page-CD21JSvn.js → keyboard-shortcuts-redirect-page-BXubnemT.js} +1 -1
- package/dist/assets/{latest-assistant-text-D5_fKeDo.js → latest-assistant-text-C5_QcZxG.js} +1 -1
- package/dist/assets/{library-detail-page-DG-7BXZ4.js → library-detail-page-lz31jiv2.js} +1 -1
- package/dist/assets/{library-page-DRUkvK5M.js → library-page-Cqt_PX2Z.js} +1 -1
- package/dist/assets/local-mode-BdKYdq-q.js +1 -0
- package/dist/assets/{login-page-BqaYnqWg.js → login-page-BcSmXRpH.js} +1 -1
- package/dist/assets/{logout-page-C6QRRvol.js → logout-page-BiLyA8KS.js} +1 -1
- package/dist/assets/{logs-layout-CgZTvfsn.js → logs-layout-DtEdDxuo.js} +1 -1
- package/dist/assets/{markdown-preview-CjIFQp7z.js → markdown-preview-BZ0peNgQ.js} +1 -1
- package/dist/assets/{media-preview-CQ5_mth7.js → media-preview-WLwNLylQ.js} +1 -1
- package/dist/assets/{memory-page-route-CMctq-2Y.js → memory-page-route-ULkaZxE1.js} +1 -1
- package/dist/assets/{memory-router-playground-page-dreB6wRu.js → memory-router-playground-page-BW7vZW_9.js} +1 -1
- package/dist/assets/{message-files-panel-CDRctrdn.js → message-files-panel-CjeAStji.js} +1 -1
- package/dist/assets/native-attachment-pickers-DyuoT-EL.js +1 -0
- package/dist/assets/native-file-xbQpY6mL.js +1 -0
- package/dist/assets/{notifications-page-u4JixJTc.js → notifications-page-CJRzep02.js} +1 -1
- package/dist/assets/{oauth-complete-page-C9Yh4aN1.js → oauth-complete-page-ocdI_rC8.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-T4U79Q12.js → oauth-popup-complete-page-HK8d4Spc.js} +1 -1
- package/dist/assets/paired-platform-identity-BPPyfzDM.js +1 -0
- package/dist/assets/{pairing-page-CmjjyJSK.js → pairing-page-DnBwkmV0.js} +1 -1
- package/dist/assets/password-reset-page-B6LfA1PC.js +1 -0
- package/dist/assets/{pdf-file-preview-BV59QVcL.js → pdf-file-preview-BICwIHq3.js} +1 -1
- package/dist/assets/{permission-guide-page-Zb7kuXV2.js → permission-guide-page-z6AAkvY2.js} +1 -1
- package/dist/assets/{permission-setup-D8C_-pLn.js → permission-setup-DQzKLhBn.js} +1 -1
- package/dist/assets/{personality-page-Bl2WDg64.js → personality-page-CKLYnk7H.js} +1 -1
- package/dist/assets/{personality-page-Cl6IWyFN.js → personality-page-CzJKC8lv.js} +1 -1
- package/dist/assets/{personality-sliders-CHGQlasL.js → personality-sliders-Dd3JGL5I.js} +1 -1
- package/dist/assets/{plans-page-CX_DS3pd.js → plans-page-DDs81rnq.js} +1 -1
- package/dist/assets/{platform-loopback-page-BbAZA0xo.js → platform-loopback-page-BC5gtTbI.js} +1 -1
- package/dist/assets/{plugin-detail-page-Y171rg5Z.js → plugin-detail-page-Dre4KSYH.js} +1 -1
- package/dist/assets/{plugins-page-7JFDRd3d.js → plugins-page-BJhR5JYi.js} +1 -1
- package/dist/assets/plugins-surface-B99o65kn.js +1 -0
- package/dist/assets/{preview-error-DRiLBVjC.js → preview-error-BSpmr-KH.js} +1 -1
- package/dist/assets/{privacy-page-BbzNYunu.js → privacy-page-BUf0Wrj1.js} +1 -1
- package/dist/assets/{privacy-screen-DRWTgt4o.js → privacy-screen-CRkWqj_4.js} +1 -1
- package/dist/assets/{profile-card-BUk3o7SO.js → profile-card-BDi2Aa7O.js} +1 -1
- package/dist/assets/{provider-callback-page-4eckbJpB.js → provider-callback-page-xSMG5fuv.js} +1 -1
- package/dist/assets/{provider-key-CJJJNyHJ.js → provider-key-CY2sGv7V.js} +1 -1
- package/dist/assets/{provider-signup-page-DEgiOj-f.js → provider-signup-page-CYvh6GNB.js} +1 -1
- package/dist/assets/{quick-input-page-DaqK2hi0.js → quick-input-page-Lfrb-P2b.js} +1 -1
- package/dist/assets/referral-modal--kTnJAWn.js +1 -0
- package/dist/assets/{referral-modal-IFQp20cn.js → referral-modal-Bk5N1oeX.js} +1 -1
- package/dist/assets/{research-mock-page-C9fb3mU6.js → research-mock-page-BdpSM2ZV.js} +1 -1
- package/dist/assets/{research-onboarding-route-Cm8d8gDB.js → research-onboarding-route-DLbIS8Fh.js} +1 -1
- package/dist/assets/{review-terms-screen-DMQInhYK.js → review-terms-screen-DXYmPnS3.js} +1 -1
- package/dist/assets/routes-CJexmSc5.js +1 -0
- package/dist/assets/{schedules--58e813j.js → schedules-B_xQSD0K.js} +1 -1
- package/dist/assets/{schedules-page-B6cSKNVA.js → schedules-page--mjVQq8F.js} +1 -1
- package/dist/assets/{security-redirect-page-BP_ofq6j.js → security-redirect-page-CJJqdMen.js} +1 -1
- package/dist/assets/{select-assistant-screen-BG3K7gmK.js → select-assistant-screen-CWrLBgEC.js} +1 -1
- package/dist/assets/{self-hosted-servers-BWwS6drJ.js → self-hosted-servers-ByTPcaPx.js} +1 -1
- package/dist/assets/{service-form-controls-DdqTR20W.js → service-form-controls-DtPD00wU.js} +1 -1
- package/dist/assets/{setting-row-DUPI2E5K.js → setting-row-CaZDTGD2.js} +1 -1
- package/dist/assets/settings-CF0G96O8.js +3 -0
- package/dist/assets/settings-D9aUsORh.js +3 -0
- package/dist/assets/{settings-Bxxp6jKc.js → settings-XqI4_biG.js} +1 -1
- package/dist/assets/{settings-layout-Bwhzzkgd.js → settings-layout-DNdADVFk.js} +1 -1
- package/dist/assets/{settings-B267Hpr6.js → settings-ooHvceam.js} +1 -1
- package/dist/assets/{share-feedback-modal-dOu0B-Md.js → share-feedback-modal-BcKnGtHL.js} +1 -1
- package/dist/assets/share-feedback-modal-DF6Y_Ddr.js +1 -0
- package/dist/assets/{sidebar-tree-EIcBry0H.js → sidebar-tree-BTeywUnh.js} +1 -1
- package/dist/assets/{signup-page-iMX6V56Q.js → signup-page-C3giBlX2.js} +1 -1
- package/dist/assets/{signup-shell-DE0anhe6.js → signup-shell-GSIPLhaj.js} +1 -1
- package/dist/assets/{skill-detail-page-DY4PImw4.js → skill-detail-page-Deqf_hR_.js} +1 -1
- package/dist/assets/{skill-detail-panel-C5ehfnq7.js → skill-detail-panel-Dxor1hrH.js} +1 -1
- package/dist/assets/{skill-removal-dialog-BUKv2Tas.js → skill-removal-dialog-BT--h1By.js} +1 -1
- package/dist/assets/{skills-page-D0nQMb4s.js → skills-page-KhBWpqn3.js} +1 -1
- package/dist/assets/{sounds-page-BHxwlTqF.js → sounds-page-DTRSATq6.js} +1 -1
- package/dist/assets/{start-screen-BNWpr3jU.js → start-screen-xL6YeEfA.js} +1 -1
- package/dist/assets/{step-detail-header-B4fNZIZg.js → step-detail-header-q2pswG-E.js} +1 -1
- package/dist/assets/{stt-language-picker-modal-DfBKJmLh.js → stt-language-picker-modal-oMpmGSKQ.js} +1 -1
- package/dist/assets/{subagent-detail-panel-ByW7jl3W.js → subagent-detail-panel-BbfzXdX1.js} +1 -1
- package/dist/assets/{superpowers-page-D_RuLpvG.js → superpowers-page-Bew1AAic.js} +1 -1
- package/dist/assets/{system-events-page-C7X57xA5.js → system-events-page-CyvA59Rb.js} +1 -1
- package/dist/assets/{system-events-redirect-page-CTGlRdMz.js → system-events-redirect-page-BlGZqWyR.js} +1 -1
- package/dist/assets/{teleport-gateway-client-B-Ymh7N4.js → teleport-gateway-client-ZoYt4yRw.js} +1 -1
- package/dist/assets/{text-preview-DXRIEUbr.js → text-preview-C4goqoCR.js} +1 -1
- package/dist/assets/{theme-stage-page-T1E0J2aJ.js → theme-stage-page-wBctgsW9.js} +1 -1
- package/dist/assets/{tiptap-document-editor-DqmlydKI.js → tiptap-document-editor-9k3KCMGt.js} +1 -1
- package/dist/assets/tool-detail-panel-BXJOMwEr.js +1 -0
- package/dist/assets/{tool-detail-panel-Cy_HQVT-.js → tool-detail-panel-D3kcmDuC.js} +1 -1
- package/dist/assets/{trait-cycle-row-BNqcZU0H.js → trait-cycle-row-Bj1z4vx9.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-BH0iigJ_.js → upgrade-cancel-page-B8aHpJFd.js} +1 -1
- package/dist/assets/{upgrade-success-page-CQTTbbGB.js → upgrade-success-page-Dj6egC1G.js} +1 -1
- package/dist/assets/{usage-redirect-page-4wBYE6Hz.js → usage-redirect-page-Cc7zOqgH.js} +1 -1
- package/dist/assets/{use-app-delete-BqUAzWOi.js → use-app-delete-S-DdyUwn.js} +1 -1
- package/dist/assets/{use-assistant-identity-details-DsO3-hL9.js → use-assistant-identity-details-DT3Hy4pf.js} +1 -1
- package/dist/assets/{use-checkout-dismiss-refresh-DpbPh5Dv.js → use-checkout-dismiss-refresh-DV7QRuSY.js} +1 -1
- package/dist/assets/{use-edge-swipe-back-C_dV-uDl.js → use-edge-swipe-back-BCvtCYFp.js} +1 -1
- package/dist/assets/{use-hotkey-recorder-DSplqHTv.js → use-hotkey-recorder-BIhIsp-5.js} +1 -1
- package/dist/assets/{use-invite-link-dialog-BbFm0xLB.js → use-invite-link-dialog-DQEUmYHq.js} +1 -1
- package/dist/assets/{use-plugins-list-v7ZdJF5y.js → use-plugins-list-DPWrP6Mv.js} +1 -1
- package/dist/assets/{use-return-to-short-circuit-e_HCiNdS.js → use-return-to-short-circuit-BVGVwuLm.js} +1 -1
- package/dist/assets/{use-side-list-room-CJYjHQez.js → use-side-list-room-DH5gDKs9.js} +1 -1
- package/dist/assets/{use-skill-actions-U5IaZ-Z1.js → use-skill-actions-CMoU5oFT.js} +1 -1
- package/dist/assets/{use-skill-detail-files-B2ECj0iR.js → use-skill-detail-files-19-kefs2.js} +1 -1
- package/dist/assets/use-supports-credentials-settings-Bq2yot1y.js +1 -0
- package/dist/assets/{use-transcript-message-by-id-De7Rp17U.js → use-transcript-message-by-id-KYGOx3D6.js} +1 -1
- package/dist/assets/{voice-page-CUNQ2QJA.js → voice-page-Cuy1oc6q.js} +1 -1
- package/dist/assets/{wake-detail-panel-BouMf1FM.js → wake-detail-panel-B6BImUJo.js} +1 -1
- package/dist/assets/{weather-forecast-display-Ea8cYhbQ.js → weather-forecast-display-BvUd--wf.js} +1 -1
- package/dist/assets/{welcome-screen-Bh45FGdD.js → welcome-screen-CtVGX2aV.js} +1 -1
- package/dist/assets/{workflow-detail-panel-BfplcjXd.js → workflow-detail-panel-DMYrbO29.js} +1 -1
- package/dist/assets/{workspace-page-Cn3iFJgb.js → workspace-page-DPWYRJjr.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/add-credits-modal-CjhPCEo3.js +0 -1
- package/dist/assets/app-hw35VYTL.css +0 -2
- package/dist/assets/auth-store-B_1Y9Uid.js +0 -1
- package/dist/assets/avatar-bundled-components-5UFPY9JK.js +0 -1
- package/dist/assets/billing-page-JaprT6Vv.js +0 -3
- package/dist/assets/checkout-return-target-D5A2Rv1t.js +0 -1
- package/dist/assets/command-palette-Lr-NeDCr.js +0 -1
- package/dist/assets/deploy-dialogs-BaSfIbBO.js +0 -1
- package/dist/assets/document-load-CD-0uWA-.js +0 -1
- package/dist/assets/local-mode-CP6E3D3e.js +0 -1
- package/dist/assets/native-attachment-pickers-DGHZuGbD.js +0 -1
- package/dist/assets/native-file-DxOOIrLm.js +0 -1
- package/dist/assets/paired-platform-identity-X_FlXunr.js +0 -1
- package/dist/assets/password-reset-page-CDmQuW9S.js +0 -1
- package/dist/assets/plugins-surface-DAYezPv6.js +0 -1
- package/dist/assets/referral-modal-8IXUqxso.js +0 -1
- package/dist/assets/routes-CkL6GgBk.js +0 -1
- package/dist/assets/settings-Clb97agh.js +0 -3
- package/dist/assets/settings-o6cuYhH5.js +0 -3
- package/dist/assets/share-feedback-modal-fY8BlOwK.js +0 -1
- package/dist/assets/tool-detail-panel-Dqa39U7-.js +0 -1
- package/dist/assets/use-supports-credentials-settings-CMhSepvQ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$p as t,AS as n,BC as r,Bm as i,Br as a,CC as o,CS as s,C_ as c,DC as l,Fy as u,Gc as d,HC as f,Hr as p,Hu as m,Ji as h,Jl as g,Jp as _,KS as v,Ly as y,MC as b,OC as x,Qp as S,Rc as C,Rm as w,SC as T,UC as E,Uf as D,Ur as O,Uu as k,VC as A,Vm as j,Vr as M,Vu as N,WC as P,Wm as F,XS as I,Xp as ee,Yp as te,Zp as ne,bi as L,cC as R,fh as re,gC as z,hS as ie,jC as ae,jy as oe,ky as B,lh as se,mC as ce,mS as le,nt as ue,oC as V,sC as H,wi as de,xi as fe,yi as U,zc as pe,zd as W,zm as me,zy as he}from"./app-g1TvV-Dl.js";import{$n as G,E as K,Xn as ge,er as _e,nr as q}from"./vendor-DwMhK7fD.js";import{_ as ve,d as ye,f as be,t as xe,x as Se}from"./react-B9IgSVeK.js";import{$r as Ce,A as we,At as Te,D as J,Ji as Y,Lt as Ee,Pt as De,Ya as Oe,Yn as ke,Zr as Ae,a as je,dr as Me,ft as Ne,gt as Pe,i as Fe,li as Ie,qi as Le,vt as Re,za as ze}from"./icons-C0wyat6T.js";import{a as Be,n as Ve,r as He,u as Ue}from"./use-plugins-list-v7ZdJF5y.js";var We=Oe(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),Ge=[`productivity`,`communication`,`meetings`,`sales`,`marketing`,`finance`,`commerce`,`engineering`,`knowledge`,`recruiting`],Ke=new Set(Ge);function qe(e){return typeof e==`string`&&Ke.has(e)}var X=e(Se(),1),Z=xe(),Je={"mcp-oauth":We,"mcp-manual":We,"managed-oauth":Ne,"own-oauth":Me};function Ye(e){let{t}=K(`settings`);return(0,X.useCallback)(n=>{switch(n.kind){case`mcp-oauth`:return t(`connectMethod.mcp`,{name:e});case`mcp-manual`:return t(`connectMethod.mcpManual`);case`managed-oauth`:return t(`connectMethod.managed`);case`own-oauth`:return t(`connectMethod.own`)}},[t,e])}function Xe(e,t,n){return e.map(e=>(0,Z.jsx)(b.Item,{icon:Je[e.kind],label:t(e),onSelect:()=>n(e)},e.id))}var Ze={slack:`slack_channel`,discord:`discord_channel`,telegram:`telegram`};function Qe(e){return Object.entries(Ze).some(([t,n])=>t===e&&n!==e)}function $e(e){return`plugin:${e}`}function et(e){let t=e.filter(e=>e.transport.type!==`stdio`&&e.status!==`connected`);return t.length===1?t[0].id:null}function tt(e){return async()=>(await e.install(),et(await e.loadPluginServers()))}function nt(e,t){return e.filter(e=>e.source===`plugin`&&e.pluginName===t)}function rt(e){return qe(e)?e:null}function it(e){let{connectedCount:t,needsAttention:n}=ot(e,[]);return{connectedCount:t,needsAttention:n}}function at(e,t){return e.filter(e=>e.provider===t)}function ot(e,t,n=!0){let r=t.flatMap(e=>e.servers),i=t.filter(e=>ct(e,n));return{connectedCount:e.filter(e=>e.connected).length+r.filter(e=>e.status===`connected`).length,needsAttention:e.some(e=>!e.connected)||i.some(e=>e.servers.some(e=>e.status!==`connected`)),configured:e.length>0||i.length>0}}function st(e){return e.status===`connected`||e.hasOAuth||e.hasStaticAuth}function ct(e,t=!0){return t?e.servers.some(st)?!0:!!e.definition.installed&&et(e.servers)===null:!!e.definition.installed||e.servers.length>0}function lt(e){if(e.transport.url)try{return new URL(e.transport.url).hostname}catch{return}}function ut(e,t,n,r=[],i=!0){let a=r.map(e=>({definition:e,servers:nt(n,e.pluginName)})),o=new Set,s=new Set(a.flatMap(e=>e.servers));return[...e.filter(e=>e.supports_managed_mode).flatMap(e=>{let n=at(t,e.provider_key);if(Qe(e.provider_key)&&n.length===0)return[];let r=a.filter(t=>t.definition.oauthProvider===e.provider_key);return r.forEach(e=>o.add(e)),[{kind:`oauth`,id:`oauth:${e.provider_key}`,name:e.display_name??e.provider_key,description:[e.description,...r.map(e=>e.definition.description)].filter(Boolean).join(` `),configured:ot(n,r,i).configured,category:rt(e.category),provider:e,connections:n,methods:r}]}),...a.filter(e=>!o.has(e)).map(e=>({kind:`plugin`,id:`plugin:${e.definition.pluginName}`,name:e.definition.displayName,description:e.definition.description,configured:ct(e,i),category:e.definition.category??null,method:e})),...n.filter(e=>!s.has(e)).map(e=>({kind:`mcp`,id:`mcp:${e.id}`,name:e.id,description:[e.pluginName,lt(e)].filter(Boolean).join(` `),configured:!0,category:null,server:e}))]}function dt(e,t,n=null){let r=t.trim().toLocaleLowerCase();return e.filter(e=>!n||e.category===n).filter(e=>!r||e.name.toLocaleLowerCase().includes(r)||e.description.toLocaleLowerCase().includes(r)).sort((e,t)=>Number(t.configured)-Number(e.configured)||e.name.localeCompare(t.name)||e.id.localeCompare(t.id))}function ft(e){return e.logo?de(`/images/integrations/${e.logo}`):null}function Q(e){return e===`mcp-oauth`||e===`mcp-manual`}function pt(e){switch(e.status){case`connected`:return`connected`;case`connecting`:case`starting`:return`connecting`;case`declared`:return`pending`;default:return`needs-attention`}}function mt(e,t,n){let r=e.servers.length>1;return e.servers.map(e=>{let i=pt(e);return{id:`mcp:${e.id}`,methodId:t,methodKind:n,label:r?e.id:null,detail:lt(e),status:i,pluginName:e.pluginName,serverId:e.id,canReconnect:i!==`connected`&&i!==`connecting`&&e.transport.type!==`stdio`&&!e.hasStaticAuth}})}function ht(e,t,n){return{id:`plugin:${e.pluginName}`,methodId:t,methodKind:n,label:null,status:`pending`,pluginName:e.pluginName,canReconnect:!1}}function gt(e,t){return e.map(e=>({id:`oauth:${e.id}`,methodId:t,methodKind:`managed-oauth`,label:e.account_label,accountId:e.id,status:e.connected?`connected`:`needs-attention`,canReconnect:!e.connected}))}function _t(e,t){let{definition:n}=e,r=n.setup.mode===`manual`?`mcp-manual`:`mcp-oauth`,i=`mcp:${n.pluginName}`,a=t&&e.servers.length===0&&n.installed;return{id:i,kind:r,availability:`available`,instructions:n.setup.instructions,setupGuideUrl:n.documentationUrl,connections:a?[ht(n,i,r)]:mt(e,i,r),plugin:n}}function vt(e,t){let n=[],r,i=null,a;if(e.kind===`oauth`){r=e.provider.provider_key,i=e.provider.logo_url,a=e.provider.description;for(let r of e.methods)n.push(_t(r,t.mcpServersLoaded));if(t.platformGate!==`gated`){let r=`managed:${e.provider.provider_key}`;n.push({id:r,kind:`managed-oauth`,availability:t.platformGate===`full`?`available`:`login-required`,connections:gt(e.connections,r)})}t.ownOAuthAvailable&&n.push({id:`own:${e.provider.provider_key}`,kind:`own-oauth`,availability:`available`,setupGuideUrl:e.provider.dashboard_url??void 0,connections:[]})}else{let{definition:o}=e.method;r=o.pluginName,i=ft(o),a=o.description,n.push(_t(e.method,t.mcpServersLoaded))}let[o,...s]=n;return o?{name:e.name,description:a,iconKey:r,logoUrl:i,primary:o,alternatives:s}:null}function yt(e){return[e.primary,...e.alternatives]}function bt(e){return yt(e).flatMap(e=>e.connections)}function xt(e){return yt(e).filter(e=>!Q(e.kind)||e.connections.length===0)}var $=`pointer-coarse:size-11`,St=[`flex flex-wrap items-start gap-2 [&>*]:shrink-0`,`[&_button]:max-w-full [&_button]:whitespace-normal`,`[&_button]:pointer-coarse:min-h-11`].join(` `);function Ct({icon:e,title:t,subtitle:n,status:r,primaryAction:i,actionMenu:a,layout:o=`row`}){return o===`tile`?(0,Z.jsxs)(x.Root,{bordered:!0,className:`flex h-full flex-col gap-3 transition-colors hover:border-[var(--border-hover)]`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[e,(0,Z.jsxs)(`div`,{className:`${St} justify-end`,children:[i,a]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,Z.jsx)(`p`,{className:`text-title-small text-[var(--content-default)] [overflow-wrap:anywhere]`,children:t}),(0,Z.jsx)(`p`,{className:`line-clamp-2 min-h-9 text-body-small-lighter text-[var(--content-tertiary)] [overflow-wrap:anywhere]`,children:n})]})]}):(0,Z.jsx)(x.Root,{children:(0,Z.jsxs)(x.Body,{padding:`md`,className:`grid grid-cols-[2rem_minmax(6rem,1fr)_minmax(0,auto)] items-start gap-x-3`,children:[e,(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-title-small text-[var(--content-default)] [overflow-wrap:anywhere]`,children:t}),r]}),n?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-body-medium-lighter text-[var(--content-tertiary)] [overflow-wrap:anywhere]`,children:n}):null]}),(0,Z.jsxs)(`div`,{className:`${St} col-start-3 row-start-1 justify-end`,children:[i,a]})]})})}function wt({plan:e,title:t,description:n}){return(0,Z.jsx)(R.Header,{children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(O,{providerKey:e.iconKey,displayName:e.name,logoUrl:e.logoUrl,size:40}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(R.Title,{className:`[&>span]:whitespace-normal`,children:t}),(0,Z.jsx)(R.Description,{children:n})]})]})})}function Tt({plan:e,attempt:t,focusMethodId:n,callbackUrl:i,callbackCopied:a=!1,toolsByConnectionId:o,ownOAuthContent:s,tenantHost:c,onConnect:l,onLogin:u,onCancelAttempt:d,onRetryAttempt:f,onReconnect:p,onDisconnect:m,onOpenTools:h,onCopyCallbackUrl:g,onOpenSetupGuide:_,onClose:v}){let{t:y}=K(`settings`),b=Ye(e.name),x=yt(e),S=bt(e),[C,w]=(0,X.useState)(()=>n?{kind:`connect`,methodId:n}:S.length>0?{kind:`connections`}:{kind:`connect`,methodId:e.primary.id}),[T,E]=(0,X.useState)(!1),[D,O]=(0,X.useState)(null);function k(t){return t.kind===`connect`?t:S.length===0?{kind:`connect`,methodId:e.primary.id}:t.kind===`tools`&&!S.some(e=>e.id===t.connectionId)?{kind:`connections`}:t}let A=k(C);function j(e){switch(e.kind){case`mcp-oauth`:case`mcp-manual`:return y(`integrationConnect.tagMcp`);case`managed-oauth`:return y(`integrationConnect.tagVellum`);case`own-oauth`:return y(`integrationConnect.tagOwnApp`)}}function M(t){return t.label?t.label:Q(t.methodKind)?y(`integrationConnect.connectionMcpLabel`,{name:e.name}):y(`integrationConnect.connectionAccountLabel`,{name:e.name})}function N(e,t){return Xe(e,b,t)}function P(e){E(!1),w({kind:`connect`,methodId:e.id})}function F(){if(S.length>0){w({kind:`connections`});return}w({kind:`connect`,methodId:e.primary.id})}let I=A.kind===`tools`?S.find(e=>e.id===A.connectionId):void 0,ee=A.kind===`connect`?x.find(e=>e.id===A.methodId)??e.primary:e.primary;function te(e){let t=e.setupGuideUrl;return t?(0,Z.jsx)(r,{variant:`ghost`,className:`mr-auto min-h-11`,leftIcon:(0,Z.jsx)(Ae,{}),onClick:()=>_(t),children:y(`integrationConnect.setupGuide`)}):null}return(0,Z.jsxs)(R.Root,{open:!0,onOpenChange:e=>{e||v()},children:[(0,Z.jsx)(R.Content,{size:`md`,children:A.kind===`connect`?(0,Z.jsx)(Et,{plan:e,method:ee,setupGuide:te(ee),methods:x,attempt:t,callbackUrl:i,callbackCopied:a,ownOAuthContent:s,tenantHost:c,acknowledged:T,hasConnections:S.length>0,methodItems:N,onAcknowledge:E,onPickMethod:P,onBack:F,onConnect:l,onLogin:u,onCancelAttempt:d,onRetryAttempt:f,onCopyCallbackUrl:g,onClose:v}):A.kind===`tools`?(0,Z.jsx)(Mt,{plan:e,connection:I,title:I?M(I):e.name,tools:o?.[A.connectionId],onBack:()=>w({kind:`connections`}),onClose:v}):(0,Z.jsx)(At,{plan:e,methods:x,connections:S,connectionTitle:M,methodTag:j,methodItems:N,onPickMethod:P,onOpenTools:e=>{h?.(e),w({kind:`tools`,connectionId:e.id})},onReconnect:e=>{p(e),w({kind:`connect`,methodId:e.methodId})},onRequestDisconnect:O,onClose:v})}),(0,Z.jsx)(V,{open:D!==null,destructive:!0,title:y(`integrationConnect.removeTitle`,{label:D?M(D):``}),message:y(`integrationConnect.removeMessage`),confirmLabel:y(`integrationConnect.remove`),cancelLabel:y(`integrationConnect.cancel`),onConfirm:()=>{D&&m(D),O(null)},onCancel:()=>O(null)})]})}function Et({plan:e,method:t,methods:n,attempt:i,callbackUrl:a,callbackCopied:o,ownOAuthContent:s,tenantHost:c,acknowledged:u,hasConnections:d,setupGuide:f,methodItems:m,onAcknowledge:h,onPickMethod:g,onBack:_,onConnect:v,onLogin:y,onCancelAttempt:b,onRetryAttempt:x,onCopyCallbackUrl:S,onClose:C}){let{t:w}=K(`settings`),T=t.kind===`managed-oauth`?c:null,E=p(T),D=i?.methodId===t.id?i:null,O=D!==null&&D.phase!==`error`,k=t.availability===`login-required`,A=t.kind===`mcp-manual`&&a!==void 0&&(!u||a.status!==`ready`),j=t.id!==e.primary.id||d,M=n.filter(e=>e.id!==t.id);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{plan:e,title:w(`integrationConnect.connectTitle`,{name:e.name}),description:e.description??w(`integrationConnect.connectDescription`,{name:e.name})}),(0,Z.jsxs)(R.Body,{className:`space-y-4`,children:[j?(0,Z.jsx)(r,{variant:`ghost`,leftIcon:(0,Z.jsx)(ze,{}),onClick:_,children:w(`integrationConnect.back`)}):null,k?(0,Z.jsx)(l,{tone:`info`,children:w(`integrationConnect.loginRequired`,{name:e.name})}):null,D?(0,Z.jsx)(Dt,{name:e.name,attempt:D,onCancel:b,onRetry:x}):null,T?(0,Z.jsx)(z,{label:T.label,type:`text`,value:E.value,onChange:e=>E.setValue(e.target.value),placeholder:T.placeholder,"aria-invalid":E.showsInvalid||void 0,helperText:E.showsInvalid?w(`integrationConnect.tenantHostInvalid`,{label:T.label,placeholder:T.placeholder}):void 0,disabled:O,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,fullWidth:!0}):null,t.kind===`mcp-manual`?(0,Z.jsx)(Ot,{instructions:t.instructions,name:e.name,callbackUrl:a,callbackCopied:o,acknowledged:u,onAcknowledge:h,onCopyCallbackUrl:S}):t.kind===`own-oauth`?s:(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:t.instructions??w(`integrationConnect.browserHint`,{name:e.name})})]}),(0,Z.jsxs)(R.Footer,{children:[f,(0,Z.jsx)(r,{variant:`ghost`,className:`min-h-11`,onClick:C,children:w(`integrationConnect.cancel`)}),t.kind===`own-oauth`?null:(0,Z.jsx)(ae,{className:`min-h-11`,disabled:O||A||!E.valid,menuDisabled:O,leftIcon:O?(0,Z.jsx)(ke,{className:`animate-spin`}):null,menuTitle:w(`integrationConnect.otherWays`),menuTriggerLabel:w(`connectMethod.otherWaysLabel`,{name:e.name}),menuItems:m(M,g),onClick:()=>k?y():v(t,{acknowledged:u,tenantHost:E.normalized}),children:w(k?`integrationConnect.loginToConnect`:`integrationConnect.connect`)})]})]})}function Dt({name:e,attempt:t,onCancel:n,onRetry:i}){let{t:a}=K(`settings`);if(t.phase===`error`)return(0,Z.jsx)(l,{tone:`error`,actions:(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(r,{variant:`outlined`,onClick:i,children:a(`integrationConnect.retry`)}),(0,Z.jsx)(r,{variant:`ghost`,onClick:n,children:t.canCancel?a(`integrationConnect.stopWaiting`):a(`integrationConnect.cancel`)})]}),children:(0,Z.jsx)(`p`,{children:t.error??a(`integrationConnect.attemptFailed`,{name:e})})});let o=t.phase===`starting`?a(`integrationConnect.attemptStarting`,{name:e}):t.phase===`connecting`?a(`integrationConnect.attemptConnecting`,{name:e}):a(`integrationConnect.attemptWaiting`,{name:e});return(0,Z.jsx)(l,{tone:`info`,icon:(0,Z.jsx)(ke,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),actions:t.canCancel?(0,Z.jsx)(r,{variant:`ghost`,onClick:n,children:a(`integrationConnect.stopWaiting`)}):void 0,children:o})}function Ot({instructions:e,name:t,callbackUrl:n,callbackCopied:i,acknowledged:a,onAcknowledge:o,onCopyCallbackUrl:s}){let{t:c}=K(`settings`),l=n?.status===`ready`?n.url:void 0,u=e?(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:e}):null;return n?(0,Z.jsxs)(Z.Fragment,{children:[u,(0,Z.jsxs)(`ol`,{className:`space-y-4`,children:[(0,Z.jsxs)(kt,{index:1,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-default`,children:c(`integrationConnect.manualStep1`)}),l?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-2`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-body-small-default [overflow-wrap:anywhere]`,children:l}),s?(0,Z.jsx)(r,{variant:`outlined`,size:`compact`,leftIcon:i?(0,Z.jsx)(Y,{}):(0,Z.jsx)(Ie,{}),onClick:()=>s(l),children:c(i?`integrationConnect.copied`:`integrationConnect.copy`)}):null]}):(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:n?.status===`error`?c(`integrationConnect.callbackError`):c(`integrationConnect.callbackLoading`)})]}),(0,Z.jsx)(kt,{index:2,children:(0,Z.jsx)(`p`,{className:`text-body-medium-default`,children:c(`integrationConnect.manualStep2`,{name:t})})}),(0,Z.jsx)(kt,{index:3,children:(0,Z.jsx)(ce,{checked:a,onCheckedChange:e=>o(e===!0),label:c(`integrationConnect.manualStep3`)})})]})]}):u}function kt({index:e,children:t}){return(0,Z.jsxs)(`li`,{className:`flex gap-3`,children:[(0,Z.jsx)(`span`,{className:`w-3 shrink-0 text-body-medium-default text-[var(--content-tertiary)]`,children:e}),(0,Z.jsx)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:t})]})}function At({plan:e,methods:t,connections:n,connectionTitle:i,methodTag:a,methodItems:o,onPickMethod:s,onOpenTools:c,onReconnect:l,onRequestDisconnect:u,onClose:d}){let{t:f}=K(`settings`),p=xt(e);function m(e){let n=t.find(t=>t.id===e.methodId);if(t.length<2||!n)return e.detail;let r=a(n);return e.detail?f(`integrationConnect.connectionSubtitle`,{method:r,detail:e.detail}):r}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{plan:e,title:e.name,description:f(`integrationConnect.connectionsDescription`,{name:e.name})}),(0,Z.jsx)(R.Body,{children:(0,Z.jsx)(`div`,{className:`rounded-lg border border-[var(--border-base)]`,children:n.map(e=>(0,Z.jsx)(v,{title:i(e),subtitle:m(e),trailingInteractive:!0,trailing:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 touch-mobile:max-w-24`,children:[(0,Z.jsx)(jt,{status:e.status}),e.canReconnect?(0,Z.jsx)(r,{variant:`outlined`,size:`compact`,leftIcon:(0,Z.jsx)(Te,{}),onClick:()=>l(e),children:e.status===`pending`?f(`integrationConnect.finishConnecting`):f(`integrationConnect.reconnect`)}):null,Q(e.methodKind)?(0,Z.jsx)(r,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(je,{}),"aria-label":f(`integrationConnect.toolsAndDetailsLabel`,{label:i(e)}),onClick:()=>c(e)}):null,(0,Z.jsx)(r,{variant:`dangerOutline`,className:$,iconOnly:(0,Z.jsx)(we,{}),"aria-label":f(`integrationConnect.removeLabel`,{label:i(e)}),onClick:()=>u(e)})]})},e.id))})}),(0,Z.jsxs)(R.Footer,{children:[p.length>0?(0,Z.jsxs)(b.Root,{children:[(0,Z.jsx)(b.Trigger,{asChild:!0,children:(0,Z.jsx)(r,{variant:`outlined`,className:`min-h-11`,rightIcon:(0,Z.jsx)(Le,{}),children:f(`integrationConnect.connectAnother`)})}),(0,Z.jsx)(b.Content,{title:f(`integrationConnect.connectAnother`),children:o(p,s)})]}):null,(0,Z.jsx)(r,{className:`min-h-11`,onClick:d,children:f(`integrationConnect.done`)})]})]})}function jt({status:e}){let{t}=K(`settings`);switch(e){case`needs-attention`:return(0,Z.jsx)(T,{tone:`negative`,children:t(`integrationConnect.statusNeedsAttention`)});case`connecting`:return(0,Z.jsx)(T,{children:t(`integrationConnect.statusConnecting`)});case`pending`:return(0,Z.jsx)(T,{children:t(`integrationConnect.statusPending`)});case`connected`:return null}}function Mt({plan:e,connection:t,title:n,tools:i,onBack:a,onClose:o}){let{t:s}=K(`settings`),c=i?.summary;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{plan:e,title:n,description:s(`integrationConnect.toolsAndDetails`)}),(0,Z.jsxs)(R.Body,{className:`space-y-4`,children:[(0,Z.jsx)(r,{variant:`ghost`,leftIcon:(0,Z.jsx)(ze,{}),onClick:a,children:s(`integrationConnect.back`)}),(0,Z.jsxs)(`dl`,{className:`space-y-1`,children:[(0,Z.jsx)(`dt`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:s(`integrationConnect.endpoint`)}),(0,Z.jsx)(`dd`,{className:`font-mono text-body-small-default text-[var(--content-tertiary)] [overflow-wrap:anywhere]`,children:i?.endpointUrl??t?.detail??s(`integrationConnect.endpointUnknown`)})]}),i?.loading?(0,Z.jsx)(`p`,{role:`status`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`integrationConnect.toolsLoading`)}):i?.error?(0,Z.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`integrationConnect.toolsError`)}):c&&c.tools.length>0?(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:s(`integrationConnect.toolsSummary`,{count:c.toolCount,tokens:c.estimatedTokens})}),(0,Z.jsx)(I.Root,{type:`multiple`,className:`rounded-lg border border-[var(--border-base)]`,children:c.tools.map(e=>(0,Z.jsxs)(I.Item,{value:e.name,className:`border-b border-[var(--border-base)] last:border-b-0`,children:[(0,Z.jsxs)(I.Trigger,{className:`justify-between gap-2 px-3 py-2.5 text-left [&[data-state=open]>svg]:rotate-180`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-body-small-default`,children:e.name}),(0,Z.jsx)(Le,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform duration-150`})]}),(0,Z.jsx)(I.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-1 px-3 pb-3`,children:[e.description?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap text-body-small-default text-[var(--content-secondary)] [overflow-wrap:anywhere]`,children:e.description}):null,(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`integrationConnect.toolTokens`,{tokens:e.estimatedTokens})})]})})]},e.name))})]}):(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`integrationConnect.toolsEmpty`)})]}),(0,Z.jsx)(R.Footer,{children:(0,Z.jsx)(r,{className:`min-h-11`,onClick:o,children:s(`integrationConnect.done`)})})]})}function Nt({providerKey:e,displayName:t,description:n,logoUrl:i,connections:a,mcpMethods:o=[],disabled:s,onConfigure:c}){let{t:l}=K(`settings`),{connectedCount:u}=it(a),{needsAttention:d,configured:f}=ot(a,o);return(0,Z.jsx)(Ct,{icon:(0,Z.jsx)(O,{providerKey:e,displayName:t,logoUrl:i,size:32}),title:t,subtitle:u>0?l(`integrationRow.connectedAccounts`,{count:u}):n,status:d?(0,Z.jsx)(T,{tone:`negative`,children:l(`integrationRow.needsAttention`)}):void 0,primaryAction:f?(0,Z.jsx)(r,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Pe,{}),"aria-label":l(`integrationRow.configureLabel`,{name:t}),onClick:c,disabled:s}):(0,Z.jsx)(r,{variant:`primary`,onClick:c,disabled:s,children:l(`integrationRow.connect`)})})}function Pt({plan:e,state:t,layout:n=`tile`,showAlternatives:i=!1,disabled:a=!1,onConnect:o,onLogin:s,onCancel:c,onRetry:l,onOpenSetupGuide:u}){let{t:d}=K(`settings`),f=Ye(e.name),p=E(),m=t.phase===`waiting`||t.phase===`connecting`,h=m&&!p;function g(e){if(e.availability===`login-required`){s();return}o(e)}function _(e){return Xe(e,f,g)}let v=i&&e.alternatives.length>0?(0,Z.jsx)(ae,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Ee,{}),"aria-label":d(`integrationTile.connect`,{name:e.name}),menuTitle:d(`integrationTile.connect`,{name:e.name}),menuTriggerLabel:d(`connectMethod.otherWaysLabel`,{name:e.name}),menuItems:_(yt(e)),disabled:a,onClick:()=>g(e.primary)}):(0,Z.jsx)(r,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Ee,{}),"aria-label":d(`integrationTile.connect`,{name:e.name}),disabled:a,onClick:()=>g(e.primary)});return m?v=(0,Z.jsx)(zt,{name:e.name,state:t,announce:!h,onCancel:c}):t.phase===`failed`&&(v=(0,Z.jsx)(Rt,{plan:e,state:t,disabled:a,methodItems:_,onRetry:l,onOpenSetupGuide:u})),(0,Z.jsx)(Ct,{layout:n,icon:(0,Z.jsx)(O,{providerKey:e.iconKey,displayName:e.name,logoUrl:e.logoUrl,size:32}),title:e.name,subtitle:t.phase===`failed`?(0,Z.jsx)(Lt,{name:e.name,state:t}):h&&m?(0,Z.jsx)(`span`,{role:`status`,children:It(d,e.name,t)}):e.description??void 0,primaryAction:v})}var Ft=4e3;function It(e,t,n){return n.phase===`waiting`?e(`integrationTile.waiting`,{name:t}):e(`integrationTile.connecting`,{name:t})}function Lt({name:e,state:t}){let{t:n}=K(`settings`),r=t.error||n(`integrationTile.failedGeneric`,{name:e});return(0,Z.jsxs)(`span`,{role:`alert`,title:t.error||void 0,className:`font-medium text-[var(--system-negative-strong)]`,children:[(0,Z.jsx)(J,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 shrink-0 align-[-0.15em]`}),r]})}function Rt({plan:e,state:t,disabled:n,methodItems:i,onRetry:a,onOpenSetupGuide:o}){let{t:s}=K(`settings`),c=Q(t.methodKind)?t.setupGuideUrl:void 0,l=xt(e).filter(e=>e.id!==t.methodId),u=[...c?[(0,Z.jsx)(b.Item,{icon:Ae,label:s(`integrationTile.setupGuide`),onSelect:()=>o(c)},`setup-guide`)]:[],...i(l)],d=s(`integrationTile.retryLabel`,{name:e.name});return u.length===0?(0,Z.jsx)(r,{variant:`dangerOutline`,className:$,iconOnly:(0,Z.jsx)(Te,{}),"aria-label":d,disabled:n,onClick:a}):(0,Z.jsx)(ae,{variant:`dangerOutline`,className:$,iconOnly:(0,Z.jsx)(Te,{}),"aria-label":d,menuTitle:s(`connectMethod.otherWaysLabel`,{name:e.name}),menuTriggerLabel:s(`connectMethod.otherWaysLabel`,{name:e.name}),menuItems:u,disabled:n,onClick:a})}function zt({name:e,state:t,announce:n,onCancel:i}){let{t:a}=K(`settings`),o=E(),[s,c]=(0,X.useState)(!1),l=(0,X.useRef)(null),u=t.phase===`waiting`&&t.canCancel,d=It(a,e,t);function p(){l.current&&=(clearTimeout(l.current),null)}function m(e){p(),c(!0),e&&(l.current=setTimeout(()=>c(!1),Ft))}function h(){p(),c(!1)}(0,X.useEffect)(()=>p,[]);function g(e){return o&&e!==`touch`}let _=n?(0,Z.jsx)(`span`,{role:`status`,className:`sr-only`,children:d}):null;return u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(r,{variant:`outlined`,className:$,iconOnly:s?(0,Z.jsx)(Fe,{}):(0,Z.jsx)(ke,{className:`animate-spin`}),"aria-label":a(`integrationTile.cancelLabel`,{name:e}),tooltip:a(`integrationTile.waitingCancel`,{name:e}),onPointerEnter:e=>{g(e.pointerType)&&m(!1)},onPointerLeave:e=>{g(e.pointerType)&&h()},onBlur:h,onClick:e=>{if(s||e.detail===0){h(),i();return}m(!0)}}),_]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(f,{content:d,children:(0,Z.jsx)(`span`,{className:P(A({variant:`outlined`,iconOnly:!0}),$,`cursor-default hover:bg-transparent`),children:(0,Z.jsx)(ke,{"aria-hidden":`true`,className:`size-3.5 animate-spin text-[var(--content-tertiary)]`})})}),_]})}function Bt({assistantId:e,providerKey:t,providerLabel:n,tenantHost:r,restartToken:i,onReport:a}){let{connect:o,dismiss:s,status:c,errorMessage:l}=U({assistantId:e,providerKey:t,providerLabel:n}),u=(0,X.useRef)(o),d=(0,X.useRef)(r);return(0,X.useLayoutEffect)(()=>{u.current=o,d.current=r}),(0,X.useLayoutEffect)(()=>{u.current(void 0,d.current)},[i]),(0,X.useEffect)(()=>s,[s]),(0,X.useEffect)(()=>{a({status:c,errorMessage:l})},[l,a,c]),null}function Vt(e){return e.length>16?`${e.slice(0,12)}…${e.slice(-4)}`:e.length>8?`${e.slice(0,8)}…`:e}function Ht(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}catch{return``}}function Ut({assistantId:e,providerKey:t,displayName:n,logoUrl:a}){let{t:o}=K(`settings`),s=q(),c=G({...ee({path:{assistant_id:e},query:{provider_key:t}}),select:e=>e.apps}),l=G({...S({path:{assistant_id:e,providerKey:t}}),select:e=>e.oauth_callback_url}),u=c.data??[],d=l.data??null,f=_e({queries:u.map(t=>({..._({path:{assistant_id:e,appId:t.id}}),select:e=>e.connections}))}),p={};u.forEach((e,t)=>{p[e.id]=f[t]?.data??[]});let m=ne({path:{assistant_id:e},query:{provider_key:t}}),h=i({onSuccess:()=>{s.invalidateQueries({queryKey:m}),E(``),k(``),C(!1),H.success(o(`yourOwnOauthTab.appAddedToast`,{name:n}))},onError:e=>{H.error(e.message||o(`yourOwnOauthTab.createFailedToast`))}}),g=me({onSuccess:()=>{s.invalidateQueries({queryKey:m}),H.success(o(`yourOwnOauthTab.appDeletedToast`))},onError:e=>{H.error(e.message||o(`yourOwnOauthTab.deleteFailedToast`))}}),v=w({onSuccess:e=>{`auth_url`in e&&(window.location.href=e.auth_url)},onError:e=>{H.error(e.message||o(`yourOwnOauthTab.connectFailedToast`))}}),y=j(),[b,C]=(0,X.useState)(!1),[T,E]=(0,X.useState)(``),[D,k]=(0,X.useState)(``),[A,M]=(0,X.useState)(!1),[N,P]=(0,X.useState)(null),[F,I]=(0,X.useState)(null),L=h.isPending,R=g.isPending?g.variables?.path?.id??null:null,re=v.isPending?v.variables?.path?.appId??null:null,ie=y.isPending?y.variables?.path?.id??null:null,ae=()=>{let n=T.trim(),r=D.trim();!n||!r||h.mutate({path:{assistant_id:e},body:{provider_key:t,client_id:n,client_secret:r}})},B=()=>{let t=N;P(null),t&&g.mutate({path:{assistant_id:e,id:t.id}})},se=t=>{v.mutate({path:{assistant_id:e,appId:t.id},body:{callback_transport:`gateway`,scopes:[]}})};return c.isLoading?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,Z.jsx)(ke,{className:`h-5 w-5 animate-spin text-[var(--content-disabled)]`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u.length===0||b?(0,Z.jsx)(x.Root,{children:(0,Z.jsxs)(x.Body,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:u.length===0?o(`yourOwnOauthTab.addOwnApp`,{name:n}):o(`yourOwnOauthTab.addAnotherApp`,{name:n})}),(0,Z.jsx)(`p`,{className:`text-body-small-lighter leading-relaxed text-[var(--content-tertiary)]`,children:o(`yourOwnOauthTab.credentialsNote`)})]}),d?(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:o(`yourOwnOauthTab.redirectUrl`)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(z,{type:`text`,value:d,readOnly:!0,fullWidth:!0}),(0,Z.jsx)(r,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>{oe(d,{successMessage:o(`yourOwnOauthTab.copiedToast`),errorMessage:o(`yourOwnOauthTab.copyFailedToast`),onCopied:()=>{M(!0),setTimeout(()=>M(!1),2e3)}})},"aria-label":o(A?`yourOwnOauthTab.copiedAria`:`yourOwnOauthTab.copyRedirectAria`),iconOnly:A?(0,Z.jsx)(Y,{"aria-hidden":!0}):(0,Z.jsx)(Ie,{"aria-hidden":!0})})]}),(0,Z.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:o(`yourOwnOauthTab.redirectHint`)})]}):null,(0,Z.jsx)(z,{label:o(`yourOwnOauthTab.clientId`),type:`text`,value:T,onChange:e=>E(e.target.value),placeholder:o(`yourOwnOauthTab.clientIdPlaceholder`),fullWidth:!0}),(0,Z.jsx)(z,{label:o(`yourOwnOauthTab.clientSecret`),type:`password`,value:D,onChange:e=>k(e.target.value),placeholder:o(`yourOwnOauthTab.clientSecretPlaceholder`),fullWidth:!0}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-1`,children:[u.length>0?(0,Z.jsx)(r,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>{C(!1),E(``),k(``)},disabled:L,children:o(`yourOwnOauthTab.cancel`)}):null,(0,Z.jsx)(r,{type:`button`,size:`compact`,onClick:ae,disabled:L||!T.trim()||!D.trim(),loading:L,leftIcon:(0,Z.jsx)(Ee,{"aria-hidden":!0}),children:o(`yourOwnOauthTab.addApp`)})]})]})}):null,u.map(e=>{let i=p[e.id]??[],s=R===e.id,c=re===e.id;return(0,Z.jsx)(x.Root,{children:(0,Z.jsxs)(x.Body,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,Z.jsx)(`p`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:Vt(e.client_id)}),(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:o(`yourOwnOauthTab.addedOn`,{date:Ht(e.created_at)})})]}),(0,Z.jsx)(r,{type:`button`,variant:`dangerOutline`,size:`compact`,onClick:()=>P(e),disabled:s,"aria-label":o(`yourOwnOauthTab.deleteAppAria`,{id:Vt(e.client_id)}),loading:s,iconOnly:(0,Z.jsx)(we,{"aria-hidden":!0})})]}),i.length>0?(0,Z.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)] overflow-hidden rounded-md border border-[var(--border-base)] dark:divide-[var(--border-base)] dark:border-[var(--border-base)]`,children:i.map(i=>{let s=ie===i.id,c=i.account_info??o(`yourOwnOauthTab.accountFallback`,{name:n});return(0,Z.jsxs)(`li`,{className:`flex items-center gap-3 px-3 py-2`,children:[(0,Z.jsx)(O,{providerKey:t,displayName:n,logoUrl:a,size:18}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-medium-lighter text-[var(--content-default)]`,children:c}),(0,Z.jsx)(r,{type:`button`,variant:`dangerOutline`,size:`compact`,onClick:()=>I({appId:e.id,connection:i}),disabled:s,"aria-label":o(`yourOwnOauthTab.disconnectAria`,{account:c}),loading:s,iconOnly:(0,Z.jsx)(we,{"aria-hidden":!0})})]},i.id)})}):null,(0,Z.jsx)(r,{type:`button`,size:`compact`,onClick:()=>se(e),disabled:c,className:`w-full`,loading:c,leftIcon:(0,Z.jsx)(Ae,{"aria-hidden":!0}),children:o(c?`yourOwnOauthTab.waitingAuthorization`:`yourOwnOauthTab.connectAccount`)})]})},e.id)}),u.length>0&&!b?(0,Z.jsx)(r,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>C(!0),className:`w-full border-dashed`,leftIcon:(0,Z.jsx)(Ee,{"aria-hidden":!0}),children:o(`yourOwnOauthTab.addAnotherAppButton`)}):null,(0,Z.jsx)(V,{open:N!==null,title:o(`yourOwnOauthTab.deleteAppTitle`),message:N?o(`yourOwnOauthTab.deleteAppMessage`,{id:Vt(N.client_id)}):``,confirmLabel:o(`yourOwnOauthTab.delete`),destructive:!0,onConfirm:B,onCancel:()=>P(null)}),(0,Z.jsx)(V,{open:F!==null,title:o(`yourOwnOauthTab.disconnectTitle`,{name:n}),message:F?o(`yourOwnOauthTab.disconnectMessage`,{account:F.connection.account_info??o(`yourOwnOauthTab.accountFallback`,{name:n})}):``,confirmLabel:o(`yourOwnOauthTab.disconnect`),destructive:!0,onConfirm:()=>{let t=F;I(null),t&&y.mutate({path:{assistant_id:e,id:t.connection.id}},{onSuccess:()=>{let r=te({path:{assistant_id:e,appId:t.appId}});s.invalidateQueries({queryKey:r}),s.invalidateQueries({queryKey:m}),H.success(o(`yourOwnOauthTab.disconnectedToast`,{name:n}))},onError:e=>{H.error(e.message||o(`yourOwnOauthTab.disconnectFailedToast`))}})},onCancel:()=>I(null)})]})}var Wt={phase:`idle`};function Gt({assistantId:e,mcp:t}){let{t:n}=K(`settings`),r=q(),{mutateAsync:i}=F(),[o,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(null),_=(0,X.useRef)(null),v=(0,X.useRef)(null),y=t.auth.attempt,b=t.auth.connect,x=t.auth.retry,S=t.auth.stopWaiting,C=t.auth.isBusy,w=t.list.refetch;(0,X.useEffect)(()=>{let e=_.current;if(e&&(_.current=null,y&&y.operationId!==e.priorOperationId)){c({itemId:e.itemId,methodId:e.methodId,methodKind:e.methodKind,setupGuideUrl:e.setupGuideUrl,operationId:y.operationId});return}o&&y?.operationId!==o.operationId&&(c(null),v.current=null)},[y,o]),(0,X.useEffect)(()=>{y?.phase===`connecting`&&(v.current=null)},[y?.phase]),(0,X.useEffect)(()=>{!l||d?.status!==`connected`||(H.success(n(`useOauthConnect.accountConnected`,{name:l.providerLabel,ns:`common`})),u(null),f(null))},[l,d,n]);let T=(0,X.useCallback)(async e=>{let t=await w();return t.isError?[]:nt(t.data?.servers??[],e)},[w]),{remove:E}=Be(e,{onRemoved:()=>{w(),g(null)},onRemoveError:(e,t)=>{s(t,{context:`integrations.connectRollback`,tags:{plugin:e}}),g(null)},announceWarnings:!1}),D=(0,X.useCallback)((t,n)=>{let a=(async()=>{await i({path:{assistant_id:e},body:{name:t}}),pe(r,e,t)})();return v.current={itemId:n,pluginName:t,landed:a.then(()=>!0,()=>!1)},a},[e,i,r]),O=(0,X.useCallback)(()=>{let e=v.current;v.current=null,e&&(g(e.itemId),e.landed.then(t=>{if(!t){g(null);return}E(e.pluginName)}))},[E]),k=(0,X.useCallback)(()=>{o&&S(),u(null),f(null),O()},[S,o,O]),A=(0,X.useCallback)((e,t,n,r)=>{h!==e.itemId&&(k(),_.current={...e,priorOperationId:y?.operationId??null},b(t,r,n))},[y,b,k,h]),j=(0,X.useCallback)((e,t,n)=>{let r=n.plugin;if(!r||C)return;let i=!!r.installed;A({itemId:e.id,methodId:n.id,methodKind:n.kind,setupGuideUrl:n.setupGuideUrl},$e(r.pluginName),t.name,tt({install:i?()=>Promise.resolve():()=>D(r.pluginName,e.id),loadPluginServers:()=>T(r.pluginName)}))},[C,A,D,T]),M=(0,X.useCallback)((e,t,n,r)=>{if(e.kind!==`oauth`||C)return;let{provider:i}=e;if(!r?.tenantHost&&a(i.provider_key,i.tenant_host)){m({itemId:e.id,methodId:n.id});return}k(),u({itemId:e.id,methodId:n.id,providerKey:i.provider_key,providerLabel:t.name,tenantHost:r?.tenantHost,restartToken:0})},[C,k]),N=(0,X.useCallback)((e,t,n,r)=>{if(Q(n.kind)){j(e,t,n);return}n.kind===`managed-oauth`&&M(e,t,n,r)},[M,j]),P=(0,X.useCallback)((e,t,n)=>{let r=yt(t).find(e=>e.id===n.methodId);if(!Q(n.methodKind)){r&&M(e,t,r);return}!n.serverId||C||A({itemId:e.id,methodId:n.methodId,methodKind:n.methodKind,setupGuideUrl:r?.setupGuideUrl},n.serverId,t.name)},[C,A,M]),I=(0,X.useCallback)((e,t,n)=>{if(n.kind===`mcp-manual`||n.kind===`own-oauth`){m({itemId:e.id,methodId:n.id});return}N(e,t,n)},[N]),ee=(0,X.useCallback)(()=>{if(o){if(y?.phase!==`error`)return;_.current={itemId:o.itemId,methodId:o.methodId,methodKind:o.methodKind,setupGuideUrl:o.setupGuideUrl,priorOperationId:o.operationId},x();return}f(null),u(e=>e&&{...e,restartToken:e.restartToken+1})},[y,x,o]),te=(0,X.useCallback)((e,t)=>o?.itemId===e&&y?y.phase===`error`?{phase:`failed`,error:y.error??n(`integrationTile.failedGeneric`,{name:t}),methodId:o.methodId,methodKind:o.methodKind,setupGuideUrl:o.setupGuideUrl}:y.phase===`connecting`?{phase:`connecting`}:{phase:`waiting`,canCancel:!0}:l?.itemId===e?d?.errorMessage?{phase:`failed`,error:d.errorMessage,methodId:l.methodId,methodKind:`managed-oauth`}:{phase:`waiting`,canCancel:!0}:Wt,[y,l,d,o,n]),ne=(0,X.useCallback)(e=>o?.itemId===e&&y?{methodId:o.methodId,phase:y.phase,error:y.error,canCancel:!0}:l?.itemId===e?{methodId:l.methodId,phase:d?.errorMessage?`error`:`waiting`,error:d?.errorMessage??void 0,canCancel:!0}:null,[y,l,d,o]),L=(0,X.useCallback)(e=>C&&o?.itemId!==e||l!==null&&l.itemId!==e||h===e,[C,l,o,h]),R=(0,X.useCallback)((e,t)=>m({itemId:e,methodId:t}),[]),re=(0,X.useCallback)(()=>m(null),[]);return{start:I,run:N,reconnect:P,cancel:k,retry:ee,stateFor:te,attemptFor:ne,isBusyElsewhere:L,ownsMcpAttempt:o!==null,attemptItemId:o?.itemId??l?.itemId??null,managed:l,onManagedReport:f,modal:p,openModal:R,closeModal:re}}function Kt({assistantId:e,platformAssistantId:t,onStopAuth:r,onRemoveServer:i,onPluginRemoved:a}){let{t:o}=K(`settings`),s=q(),c=(0,X.useRef)(``),l=Be(e,{onRemoved:()=>{a(),H.success(o(`integrationConnect.removedToast`,{name:c.current}))},onRemoveError:()=>H.error(o(`integrationConnect.removeFailedToast`,{name:c.current}))}),u={path:{assistant_id:t??``}},d=W({onSuccess(e,t){H.success(o(`integrationConnect.disconnectedToast`,{name:c.current}));let n=t.path.connection_id;k(s,u,e=>e?.filter(e=>e.id!==n)),s.invalidateQueries({queryKey:m(u)})},onError(e){H.error(n(e,void 0,o(`integrationConnect.disconnectFailedToast`,{name:c.current})))}}),f=d.mutate,p=l.remove,h=l.isRemoving||d.isPending;return(0,X.useCallback)((e,n)=>{if(!h){if(c.current=n,Q(e.methodKind)){if(r(e),e.pluginName){p(e.pluginName);return}e.serverId&&i(e.serverId);return}!e.accountId||!t||f({path:{assistant_id:t,connection_id:e.accountId}})}},[h,f,i,r,t,p])}var qt=[{value:`none`,labelKey:`mcpAddServerModal.authNone`},{value:`oauth`,labelKey:`mcpAddServerModal.authOAuth`},{value:`bearer`,labelKey:`mcpAddServerModal.authBearer`},{value:`api-key`,labelKey:`mcpAddServerModal.authApiKey`}],Jt=[{value:`sse`,labelKey:`mcpAddServerModal.transportSse`},{value:`streamable-http`,labelKey:`mcpAddServerModal.transportStreamableHttp`},{value:`stdio`,labelKey:`mcpAddServerModal.transportStdio`}];function Yt(e){return qt.map(({value:t,labelKey:n})=>({value:t,label:e(n)}))}function Xt(e){return Jt.map(({value:t,labelKey:n})=>({value:t,label:e(n)}))}function Zt({open:e,onClose:t,onAdd:n,isPending:i}){let{t:a}=K(`settings`),o=(0,X.useMemo)(()=>Yt(a),[a]),s=(0,X.useMemo)(()=>Xt(a),[a]),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(`sse`),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(``),[g,_]=(0,X.useState)(``),[v,y]=(0,X.useState)(`none`),[b,x]=(0,X.useState)(``),[S,C]=(0,X.useState)(`X-API-Key`),[w,T]=(0,X.useState)(``),E=(0,X.useCallback)(()=>{l(``),d(`sse`),p(``),h(``),_(``),y(`none`),x(``),C(`X-API-Key`),T(``)},[]),D=(0,X.useCallback)(()=>{i||(E(),t())},[i,E,t]),O=(0,X.useCallback)(()=>{let e=c.trim();if(!e)return;let t={name:e,transportType:u};if(u===`stdio`){let e=m.trim();if(!e)return;t.command=e;let n=g.trim();n&&(t.args=n.split(/\s+/))}else{let e=f.trim();if(!e)return;t.url=e,v===`bearer`&&b.trim()?t.headers={Authorization:`Bearer ${b.trim()}`}:v===`api-key`&&S.trim()&&w.trim()?t.headers={[S.trim()]:w.trim()}:v===`oauth`&&(t.autoAuth=!0)}n(t)},[c,u,f,m,g,v,b,S,w,n]),k=u===`stdio`,A=c.trim()&&(k?m.trim():f.trim());return(0,Z.jsx)(R.Root,{open:e,onOpenChange:e=>{e||D()},children:(0,Z.jsxs)(R.Content,{size:`md`,children:[(0,Z.jsxs)(R.Header,{icon:We,children:[(0,Z.jsx)(R.Title,{children:a(`mcpAddServerModal.title`)}),(0,Z.jsx)(R.Description,{children:a(`mcpAddServerModal.description`)})]}),(0,Z.jsx)(R.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-name`,children:a(`mcpAddServerModal.serverNameLabel`)}),(0,Z.jsx)(z,{id:`mcp-name`,type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:a(`mcpAddServerModal.namePlaceholder`),fullWidth:!0,autoFocus:!0})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-transport`,children:a(`mcpAddServerModal.transportLabel`)}),(0,Z.jsx)(`select`,{id:`mcp-transport`,value:u,onChange:e=>d(e.target.value),className:`w-full rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-default text-[var(--content-default)] outline-none focus:ring-2 focus:ring-[var(--ring)]`,children:s.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),k?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-command`,children:a(`mcpAddServerModal.commandLabel`)}),(0,Z.jsx)(z,{id:`mcp-command`,type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:a(`mcpAddServerModal.commandPlaceholder`),fullWidth:!0})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-args`,children:a(`mcpAddServerModal.argsLabel`)}),(0,Z.jsx)(z,{id:`mcp-args`,type:`text`,value:g,onChange:e=>_(e.target.value),placeholder:a(`mcpAddServerModal.argsPlaceholder`),fullWidth:!0})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-url`,children:a(`mcpAddServerModal.serverUrlLabel`)}),(0,Z.jsx)(z,{id:`mcp-url`,type:`url`,value:f,onChange:e=>p(e.target.value),placeholder:a(`mcpAddServerModal.urlPlaceholder`),fullWidth:!0})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-auth`,children:a(`mcpAddServerModal.authenticationLabel`)}),(0,Z.jsx)(`select`,{id:`mcp-auth`,value:v,onChange:e=>y(e.target.value),className:`w-full rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-default text-[var(--content-default)] outline-none focus:ring-2 focus:ring-[var(--ring)]`,children:o.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),v===`oauth`?(0,Z.jsx)(`p`,{className:`rounded-md border border-[var(--border-element)] bg-[var(--surface-base)] px-3 py-2 text-body-small-lighter text-[var(--content-tertiary)]`,children:a(`mcpAddServerModal.oauthHint`)}):null,v===`bearer`?(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-bearer`,children:a(`mcpAddServerModal.bearerTokenLabel`)}),(0,Z.jsx)(z,{id:`mcp-bearer`,type:`password`,value:b,onChange:e=>x(e.target.value),placeholder:a(`mcpAddServerModal.bearerPlaceholder`),fullWidth:!0})]}):null,v===`api-key`?(0,Z.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-apikey-header`,children:a(`mcpAddServerModal.headerNameLabel`)}),(0,Z.jsx)(z,{id:`mcp-apikey-header`,type:`text`,value:S,onChange:e=>C(e.target.value),placeholder:a(`mcpAddServerModal.apiKeyHeaderPlaceholder`),fullWidth:!0})]}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-apikey-value`,children:a(`mcpAddServerModal.apiKeyLabel`)}),(0,Z.jsx)(z,{id:`mcp-apikey-value`,type:`password`,value:w,onChange:e=>T(e.target.value),placeholder:a(`mcpAddServerModal.apiKeyPlaceholder`),fullWidth:!0})]})]}):null]})]})}),(0,Z.jsxs)(R.Footer,{children:[(0,Z.jsx)(r,{variant:`ghost`,onClick:D,disabled:i,children:a(`mcpAddServerModal.cancel`)}),(0,Z.jsx)(r,{variant:`primary`,onClick:O,disabled:!A||i,children:a(i?`mcpAddServerModal.adding`:`mcpAddServerModal.addServer`)})]})]})})}var Qt=[`none`,`bearer`,`api-key`];function $t(e,t){switch(e){case`none`:return t(`mcpServerDetailModal.authNone`);case`bearer`:return t(`mcpServerDetailModal.authBearerToken`);case`api-key`:return t(`mcpServerDetailModal.authApiKey`)}}function en({server:e,toolsSummary:t,toolsLoading:n=!1,toolsError:i=!1,readOnly:a=!1,onClose:o,onSave:s,isPending:c}){let{t:l}=K(`settings`),[u,d]=(0,X.useState)(`none`),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(`X-API-Key`),[g,_]=(0,X.useState)(``);(0,X.useEffect)(()=>{e&&(d(e.authType),p(``),h(e.authHeaderName??`X-API-Key`),_(``))},[e]);let v=(0,X.useCallback)(()=>{if(!e||a)return;let t=u!==e.authType,n=u===`bearer`&&f.trim()!==``,r=u===`api-key`&&m.trim()!==``&&g.trim()!==``,i=t||n||r,o;o=i?u===`none`?null:u===`bearer`&&f.trim()?{Authorization:`Bearer ${f.trim()}`}:u===`api-key`&&m.trim()&&g.trim()?{[m.trim()]:g.trim()}:void 0:void 0,s(e.id,{name:e.id,...o===void 0?{}:{headers:o}})},[e,u,f,m,g,s,a]),y=(0,X.useCallback)(()=>{c||o()},[c,o]);return e?(0,Z.jsx)(R.Root,{open:!!e,onOpenChange:e=>{e||y()},children:(0,Z.jsxs)(R.Content,{size:`lg`,children:[(0,Z.jsxs)(R.Header,{icon:We,children:[(0,Z.jsx)(R.Title,{children:e.id}),(0,Z.jsx)(R.Description,{children:l(`mcpServerDetailModal.description`,{transport:e.transport.type,status:e.status})})]}),(0,Z.jsx)(R.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[!a&&e.transport.type!==`stdio`?(0,Z.jsxs)(Z.Fragment,{children:[e.hasOAuth?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-[var(--border-element)] bg-[var(--surface-base)] px-3 py-2`,children:[(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:l(`mcpServerDetailModal.authentication`)}),(0,Z.jsx)(`span`,{className:`rounded-full bg-[var(--surface-lift)] px-2 py-0.5 text-label-small-default text-[var(--content-default)]`,children:l(`mcpServerDetailModal.oauthBadge`)}),(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.oauthManagedHint`)})]}):null,e.hasOAuth?null:(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-auth`,children:l(`mcpServerDetailModal.authentication`)}),(0,Z.jsx)(`select`,{id:`mcp-detail-auth`,value:u,onChange:e=>d(e.target.value),className:`w-full rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-default text-[var(--content-default)] outline-none focus:ring-2 focus:ring-[var(--ring)]`,children:Qt.map(e=>(0,Z.jsx)(`option`,{value:e,children:$t(e,l)},e))})]}),u===`bearer`&&!e.hasOAuth?(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-bearer`,children:l(`mcpServerDetailModal.bearerToken`)}),(0,Z.jsx)(z,{id:`mcp-detail-bearer`,type:`password`,value:f,onChange:e=>p(e.target.value),placeholder:e.hasStaticAuth&&e.authType===`bearer`?l(`mcpServerDetailModal.savedBearerPlaceholder`):l(`mcpServerDetailModal.bearerTokenPlaceholder`),fullWidth:!0})]}):null,u===`api-key`&&!e.hasOAuth?(0,Z.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-apikey-header`,children:l(`mcpServerDetailModal.headerName`)}),(0,Z.jsx)(z,{id:`mcp-detail-apikey-header`,type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:l(`mcpServerDetailModal.headerNamePlaceholder`),fullWidth:!0})]}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-apikey-value`,children:l(`mcpServerDetailModal.apiKey`)}),(0,Z.jsx)(z,{id:`mcp-detail-apikey-value`,type:`password`,value:g,onChange:e=>_(e.target.value),placeholder:e.hasStaticAuth&&e.authType===`api-key`?l(`mcpServerDetailModal.savedApiCredentialPlaceholder`):l(`mcpServerDetailModal.apiKeyPlaceholder`),fullWidth:!0})]})]}):null]}):null,e.transport.url||e.transport.command?(0,Z.jsxs)(`dl`,{className:`space-y-1 text-body-small-default`,children:[(0,Z.jsx)(`dt`,{className:`text-[var(--content-secondary)]`,children:e.transport.type===`stdio`?l(`mcpServerDetailModal.command`):l(`mcpServerDetailModal.endpoint`)}),(0,Z.jsx)(`dd`,{className:`text-[var(--content-tertiary)] [overflow-wrap:anywhere]`,children:e.transport.url??e.transport.command})]}):null,(0,Z.jsxs)(`section`,{className:`space-y-2`,children:[(0,Z.jsx)(`h3`,{className:`text-body-medium-default text-[var(--content-default)]`,children:l(`mcpServerDetailModal.toolsHeading`)}),n?(0,Z.jsx)(`p`,{role:`status`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.toolsLoading`)}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.toolsError`)}):t&&t.tools.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.tokenOverhead`,{count:t.estimatedTokens.toLocaleString()})}),(0,Z.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)] rounded-lg border border-[var(--border-base)]`,children:t.tools.map(e=>(0,Z.jsxs)(`li`,{className:`space-y-1 px-3 py-3`,children:[(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-default)] [overflow-wrap:anywhere]`,children:e.name}),e.description?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap text-body-small-default text-[var(--content-secondary)] [overflow-wrap:anywhere]`,children:e.description}):null,(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.toolEstimatedTokens`,{count:e.estimatedTokens.toLocaleString()})})]},e.name))})]}):(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.toolsEmpty`)})]})]})}),(0,Z.jsxs)(R.Footer,{children:[(0,Z.jsx)(r,{variant:a?`primary`:`ghost`,onClick:y,disabled:c,children:l(a?`mcpServerDetailModal.close`:`mcpServerDetailModal.cancel`)}),a?null:(0,Z.jsx)(r,{variant:`primary`,onClick:v,disabled:c,children:l(c?`mcpServerDetailModal.saving`:`mcpServerDetailModal.save`)})]})]})}):null}function tn({connections:e,allowAdd:t,attemptReportedElsewhere:n=!1}){let{t:i}=K(`settings`),{auth:a,add:o,save:s,remove:c,details:u,configureServer:d}=e;return(0,Z.jsxs)(Z.Fragment,{children:[a.attempt&&!n?(0,Z.jsx)(l,{tone:a.attempt.error?`warning`:`info`,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{className:`[overflow-wrap:anywhere]`,children:a.attempt.error??(a.attempt.phase===`connecting`?i(`mcpConnect.waitingForRuntime`,{name:a.attempt.displayName}):i(`mcpConnect.waitingForAuthorization`,{name:a.attempt.displayName}))}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a.attempt.phase===`error`?(0,Z.jsx)(r,{variant:`outlined`,onClick:a.retry,children:i(`mcpConnect.retry`)}):null,(0,Z.jsx)(r,{variant:`ghost`,onClick:a.stopWaiting,children:i(`mcpConnect.stopWaiting`)})]})]})}):null,t?(0,Z.jsx)(Zt,{open:e.addOpen,onClose:()=>e.setAddOpen(!1),onAdd:e.addCustom,isPending:o.isPending}):null,(0,Z.jsx)(en,{server:d,readOnly:d?.source===`plugin`,toolsSummary:u.data?.servers.find(e=>e.serverId===d?.id),toolsLoading:u.isFetching,toolsError:u.isError,onClose:()=>e.setConfigureServerId(null),onSave:(e,t)=>s.mutate(t),isPending:s.isPending}),(0,Z.jsx)(V,{open:e.removeServerId!==null,title:i(`mcpPage.removeDialogTitle`),message:e.removeServerId?i(`mcpPage.removeDialogMessage`,{serverId:e.removeServerId}):``,confirmLabel:i(`mcpPage.removeDialogConfirm`),destructive:!0,isPending:c.isPending,onConfirm:()=>{e.removeServerId&&c.mutate(e.removeServerId)},onCancel:()=>e.setRemoveServerId(null)})]})}function nn(e,t){let n=new Map(t.map(e=>[e.name,e]));return e.flatMap(e=>{let t=e.integration;if(t?.kind!==`mcp`)return[];let r=n.get(e.name);return[{pluginName:e.name,displayName:t.displayName,description:e.description??t.displayName,documentationUrl:t.documentationUrl,logo:t.logo,oauthProvider:t.oauthProvider,category:rt(t.category)??void 0,setup:t.setup,installed:r?{icon:r.icon,hasIcon:r.hasIcon,iconVersion:r.iconVersion}:void 0}]})}function rn(){return(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-md bg-[var(--surface-base)] text-[var(--content-secondary)]`,children:(0,Z.jsx)(De,{size:20})})}function an({server:e,onRemove:t,onConfigure:n,onAuthenticate:i,onManagePlugin:a,isAuthenticating:o,connectDisabled:s=!1}){let{t:c}=K(`settings`),l=e.source===`plugin`,u=!l&&e.status===`needs-auth`&&e.transport.type!==`stdio`,d=!l&&!o&&!u,f=l?c(`mcpServerCard.managePlugin`):o?c(`mcpServerCard.connecting`):e.hasOAuth?c(`mcpServerCard.reconnect`):c(`mcpServerCard.finishConnecting`);return(0,Z.jsx)(Ct,{icon:(0,Z.jsx)(rn,{}),title:e.id,subtitle:l?e.pluginName:lt(e),status:e.status===`connected`?void 0:(0,Z.jsx)(T,{tone:`negative`,children:c(`mcpServerCard.statusNeedsAttention`)}),primaryAction:d?(0,Z.jsx)(r,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Pe,{}),"aria-label":c(`mcpServerCard.configureLabel`,{serverId:e.id}),onClick:()=>n(e.id)}):(0,Z.jsx)(r,{variant:u?`primary`:`outlined`,loading:o,onClick:()=>{l?a(e.pluginName):u&&i(e.id)},disabled:o||u&&s,children:f}),actionMenu:(0,Z.jsxs)(b.Root,{children:[(0,Z.jsx)(b.Trigger,{asChild:!0,children:(0,Z.jsx)(r,{variant:`ghost`,iconOnly:(0,Z.jsx)(Ce,{}),className:$,"aria-label":c(`mcpServerCard.moreActions`,{serverId:e.id})})}),(0,Z.jsxs)(b.Content,{title:e.id,showTitle:!0,closeLabel:c(`mcpServerCard.actionsSheetClose`),align:`end`,children:[u||l?(0,Z.jsx)(b.Item,{icon:Pe,label:c(l?`mcpServerCard.viewDetails`:`mcpServerCard.configure`),onSelect:()=>n(e.id)}):null,l?null:(0,Z.jsx)(b.Item,{icon:we,label:c(`mcpServerCard.removeServer`),tone:`destructive`,onSelect:()=>t(e.id)})]})]})})}function on({assistantId:e,definition:t}){let n=He(e,t.pluginName,t.installed?.hasIcon,t.installed?.iconVersion);return(0,Z.jsx)(Ue,{external:!0,icon:t.installed?.icon,iconSrc:n,iconUrl:ft(t)??void 0,size:`md`})}function sn({assistantId:e,method:t,disabled:n,onOpen:i}){let{t:a}=K(`settings`),o=ot([],[t]);return(0,Z.jsx)(Ct,{icon:(0,Z.jsx)(on,{assistantId:e,definition:t.definition}),title:t.definition.displayName,subtitle:t.definition.description,status:o.needsAttention?(0,Z.jsx)(T,{tone:`negative`,children:a(`integrationRow.needsAttention`)}):void 0,primaryAction:(0,Z.jsx)(r,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Pe,{}),"aria-label":a(`integrationRow.configureLabel`,{name:t.definition.displayName}),disabled:n,onClick:i})})}async function cn(e){let{data:t,response:n}=await B.get({url:`/v1/assistants/{assistant_id}/internal/mcp/list`,path:{assistant_id:e}});if(!n?.ok)throw Error(`Failed to fetch MCP servers: ${n?.status}`);return t}async function ln(e){let{data:t,response:n}=await B.get({url:`/v1/assistants/{assistant_id}/internal/mcp/tools-summary`,path:{assistant_id:e}});if(!n?.ok)throw Error(`Failed to fetch MCP tools summary: ${n?.status}`);return t}async function un(e,t){let{response:n}=await B.post({url:`/v1/assistants/{assistant_id}/internal/mcp/update`,path:{assistant_id:e},body:t});if(!n?.ok)throw Error(`Failed to update MCP server: ${n?.status}`)}async function dn(e,t){let{response:n}=await B.post({url:`/v1/assistants/{assistant_id}/internal/mcp/add`,path:{assistant_id:e},body:t});if(!n?.ok)throw Error(`Failed to add MCP server: ${n?.status}`)}async function fn(e,t){let{response:n}=await B.post({url:`/v1/assistants/{assistant_id}/internal/mcp/remove`,path:{assistant_id:e},body:{name:t}});if(!n?.ok)throw Error(`Failed to remove MCP server: ${n?.status}`)}async function pn(e,t){let{data:n,response:r}=await B.post({url:`/v1/assistants/{assistant_id}/internal/mcp/auth/start`,path:{assistant_id:e},body:{serverId:t}});if(!r?.ok)throw Error(`Failed to start MCP auth: ${r?.status}`);return n}async function mn(e,t){let{data:n,response:r}=await B.get({url:`/v1/assistants/{assistant_id}/internal/mcp/auth/status/${encodeURIComponent(t)}`,path:{assistant_id:e}});if(!r?.ok)throw Error(`Failed to poll MCP auth status: ${r?.status}`);return n}function hn(e,t){return e.some(e=>e.id===t&&e.status===`connected`)}function gn(e,t){return t?null:e}function _n(e){let{t}=K(`settings`),n=q(),[r,i]=(0,X.useState)(null),a=(0,X.useRef)(null),o=(0,X.useRef)(null),c=(0,X.useRef)(null),l=(0,X.useCallback)(()=>{a.current=null,c.current=null,o.current?.close(),o.current=null,i(null)},[]);(0,X.useEffect)(()=>(l(),()=>{a.current=null,c.current=null,o.current?.close(),o.current=null}),[e,l]);let d=r?.phase===`authorizing`||r?.phase===`waiting`,f=G({queryKey:C.auth(e,r?.operationId??``),queryFn:()=>mn(e,r.serverId),enabled:d,refetchInterval:d?L:!1,staleTime:0,gcTime:0,retry:1}),p=G({queryKey:C.list(e),queryFn:()=>cn(e),enabled:r?.phase===`connecting`,refetchInterval:r?.phase===`connecting`?L:!1,staleTime:0,retry:1});(0,X.useEffect)(()=>{!r||!d||a.current!==r.operationId||!f.data||(f.data.status===`complete`?(o.current?.close(),o.current=null,i({...r,phase:`connecting`}),n.invalidateQueries({queryKey:C.list(e)})):f.data.status===`error`&&i({...r,phase:`error`,error:f.data.error?.replaceAll(r.serverId,r.displayName)??t(`mcpConnect.authorizationFailed`)}))},[e,r,f.data,d,n,t]),(0,X.useEffect)(()=>{r?.phase!==`connecting`||a.current!==r.operationId||!p.data||p.isFetching||hn(p.data.servers,r.serverId)&&(l(),n.invalidateQueries({queryKey:C.details(e)}))},[e,r,n,p.data,p.isFetching,l]),(0,X.useEffect)(()=>{if(!r||r.phase===`error`)return;let e=d?gn(f.error,f.isFetching):r.phase===`connecting`?gn(p.error,p.isFetching):null;e&&(s(e,{context:`mcp.connect.poll`}),i({...r,phase:`error`,error:t(`mcpConnect.pollFailed`)}))},[r,f.error,f.isFetching,d,p.error,p.isFetching,t]),(0,X.useEffect)(()=>{if(!r||r.phase===`error`)return;let e=setTimeout(()=>{a.current===r.operationId&&(o.current?.close(),o.current=null,i(e=>e?.operationId===r.operationId?{...e,phase:`error`,error:t(`mcpConnect.timedOut`)}:e))},Math.max(0,r.startedAt+fe-Date.now()));return()=>clearTimeout(e)},[r,t]);let m=(0,X.useCallback)(t=>{a.current===t&&(i(e=>e?.operationId===t&&e.phase===`authorizing`?{...e,phase:`waiting`}:e),n.invalidateQueries({queryKey:C.auth(e,t)}),n.invalidateQueries({queryKey:C.list(e)}))},[e,n]);(0,X.useEffect)(()=>{let e=o.current;if(r?.phase!==`authorizing`||!e)return;let t=setInterval(()=>{e.closed&&m(r.operationId)},500);return()=>clearInterval(t)},[r?.operationId,r?.phase,m]),(0,X.useEffect)(()=>{let e=r?.operationId,t=r?.phase;if(!(!e||t===`connecting`||t===`error`))return y(()=>m(e))},[r?.operationId,r?.phase,m]);let h=(0,X.useCallback)((n,l,d=n)=>{if(a.current&&r?.phase!==`error`)return;let f=crypto.randomUUID();a.current=f,o.current?.close(),o.current=null,c.current=l?{operationId:f,run:l}:null;let p={operationId:f,serverId:n,displayName:d,startedAt:Date.now(),phase:`starting`};i(p);let m=he()||ie(),h=m?null:window.open(``,`_blank`,`width=500,height=600`);if(!m&&!h){i({...p,phase:`error`,error:t(`mcpConnect.popupBlocked`)});return}h&&(h.opener=null,o.current=h);let g=()=>a.current===f&&Date.now()<p.startedAt+3e5;(async()=>{try{let t=await l?.();if(c.current?.operationId===f&&(c.current=null),!g())return;if(t===null){h?.close(),o.current=null,a.current=null,i(null);return}let n=t?{...p,serverId:t}:p;t&&i(n);let r=await pn(e,n.serverId);if(!g())return;if(r.already_authenticated){h?.close(),o.current=null,i({...n,phase:`connecting`});return}let s=new URL(r.auth_url);if(s.protocol!==`https:`&&s.protocol!==`http:`)throw Error(`Unsupported MCP authorization URL protocol`);i({...n,phase:`authorizing`}),h?h.closed||h.location.replace(s.href):await u(s.href)}catch(e){h?.close(),g()&&(o.current=null,s(e,{context:`mcp.connect.start`}),i(e=>e?.operationId===f?{...e,phase:`error`,error:t(`mcpConnect.startFailed`)}:e))}})()},[e,r?.phase,t]);return{attempt:r,isBusy:!!(r&&r.phase!==`error`),connect:h,retry:()=>{r&&h(r.serverId,c.current?.run,r.displayName)},stopWaiting:l}}function vn(e){let{t}=K(`settings`),n=q(),r=_n(e),[i,a]=(0,X.useState)(!1),[o,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(null),p=G({queryKey:C.list(e),queryFn:()=>cn(e)}),m=p.data?.servers.find(e=>e.id===o)??null,h=G({queryKey:C.details(e),queryFn:()=>ln(e),enabled:m!==null||d!==null}),g=()=>{n.invalidateQueries({queryKey:C.list(e)}),n.invalidateQueries({queryKey:C.details(e)})},_=ge({mutationFn:t=>dn(e,t),onSuccess:()=>{g(),a(!1)},onError:e=>{s(e,{context:`mcp.add`}),H.error(t(`mcpConnect.addFailed`))}});return{list:p,details:h,auth:r,add:_,save:ge({mutationFn:t=>un(e,t),onSuccess:()=>{g(),c(null)},onError:e=>{s(e,{context:`mcp.update`}),H.error(t(`mcpConnect.saveFailed`))}}),remove:ge({mutationFn:t=>fn(e,t),onSuccess:(e,n)=>{r.attempt?.serverId===n&&r.stopWaiting(),g(),u(null),c(null),H.success(t(`mcpPage.toastRemoved`,{serverId:n}))},onError:(e,n)=>{s(e,{context:`mcp.remove`}),H.error(t(`mcpPage.toastRemoveFailed`,{serverId:n}))}}),addCustom:e=>{e.autoAuth?r.connect(e.name,async()=>{await _.mutateAsync(e)},e.name):_.mutate(e)},addOpen:i,setAddOpen:a,configureServer:m,configureServerId:o,setConfigureServerId:c,removeServerId:l,setRemoveServerId:u,toolsServerId:d,setToolsServerId:f}}var yn={productivity:`integrationsPage.categories.productivity`,communication:`integrationsPage.categories.communication`,meetings:`integrationsPage.categories.meetings`,sales:`integrationsPage.categories.sales`,marketing:`integrationsPage.categories.marketing`,finance:`integrationsPage.categories.finance`,commerce:`integrationsPage.categories.commerce`,engineering:`integrationsPage.categories.engineering`,knowledge:`integrationsPage.categories.knowledge`,recruiting:`integrationsPage.categories.recruiting`},bn=`grid gap-3 [grid-template-columns:repeat(auto-fill,minmax(min(100%,22rem),1fr))]`,xn=`grid gap-3 [grid-template-columns:repeat(auto-fill,minmax(min(100%,15rem),1fr))]`;function Sn({title:e,count:t,gridClassName:n,children:r}){return(0,Z.jsxs)(`section`,{className:`space-y-3`,children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-title-small text-[var(--content-default)]`,children:[e,(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:t})]}),(0,Z.jsx)(`div`,{className:n,children:r})]})}function Cn(e,t){return{denied:e(`integrationsPage.oauthErrorDenied`),state_invalid:e(`integrationsPage.oauthErrorStateInvalid`),state_expired:e(`integrationsPage.oauthErrorStateExpired`),exchange_failed:e(`integrationsPage.oauthErrorExchangeFailed`),identity_failed:e(`integrationsPage.oauthErrorIdentityFailed`)}[t]}function wn({mcpAssistantId:e}){let{t:n}=K(`settings`),[i,a]=ve(),f=be(),p=ye(),m=re(),_=se(),v=D.use.mcpAddServer(),y=D.use.hasHydrated(),[b,x]=(0,X.useState)(null),[S,C]=(0,X.useState)(!0),[w,T]=(0,X.useState)(``),[E,O]=(0,X.useState)(null),k=i.get(`provider`),A=(0,X.useRef)(null),j=vn(e),P=Ve(e),F=Gt({assistantId:e,mcp:j});(0,X.useEffect)(()=>{let t=!0;return(async()=>{try{let n=await c(e);t&&n.ok&&x(n.data)}catch(e){s(e,{context:`integrations.getAssistant`})}finally{t&&C(!1)}})(),()=>{t=!1}},[e]);let{login:I}=d(`${p.pathname}${p.search}${p.hash}`),ee=(0,X.useCallback)(()=>void I(),[I]),te=F.closeModal,ne=F.cancel,L=F.attemptItemId,R=F.modal?.itemId??null,ie=j.setToolsServerId,ae=(0,X.useCallback)(()=>{if(R!==null&&L===R&&ne(),te(),ie(null),!i.has(`provider`))return;let e=new URLSearchParams(i);e.delete(`provider`),a(e,{replace:!0})},[ne,L,te,R,i,a,ie]),{platformAssistantId:oe,isLoading:B,error:ce}=h(b?.id,m===`full`),ue=G({...t({path:{assistant_id:b?.id??``}}),select:e=>e.providers,enabled:!!b}),V=G({...N({path:{assistant_id:oe??``}}),enabled:!!oe&&m===`full`});(0,X.useEffect)(()=>{let e=i.get(`oauth_status`);if(!e)return;let t=i.get(`oauth_provider`),r=t?t.charAt(0).toUpperCase()+t.slice(1):null;e===`connected`?H.success(r?n(`integrationsPage.accountConnectedToast`,{providerLabel:r}):n(`integrationsPage.accountConnectedToastGeneric`)):e===`error`&&H.error(Cn(n,i.get(`oauth_code`)??`unknown`)??(r?n(`integrationsPage.connectFailedToast`,{providerLabel:r}):n(`integrationsPage.connectFailedToastGeneric`))),f(le.settings.integrations,{replace:!0})},[i,f,n]);let de=ue.isError||V.isError||!!ce||!S&&!b,fe=!de&&!!ue.data&&(m!==`full`||!!V.data),U=(0,X.useMemo)(()=>ut(fe?ue.data??[]:[],fe?V.data??[]:[],j.list.data?.servers??[],P.installedLoaded?nn(P.catalogMatches,P.installedPlugins):[],j.list.isSuccess),[fe,ue.data,V.data,j.list.data,j.list.isSuccess,P.installedLoaded,P.catalogMatches,P.installedPlugins]),pe=(0,X.useMemo)(()=>{let e=new Map;for(let t of U)t.category&&e.set(t.category,(e.get(t.category)??0)+1);return Ge.flatMap(t=>{let n=e.get(t);return n?[{category:t,count:n}]:[]})},[U]),W=pe.some(e=>e.category===E)?E:null,me=(0,X.useMemo)(()=>dt(U,w,W),[U,w,W]),he=(0,X.useMemo)(()=>{let e=new Map;for(let t of U){if(t.kind===`mcp`)continue;let n=vt(t,{platformGate:m,ownOAuthAvailable:!_,mcpServersLoaded:j.list.isSuccess});n&&e.set(t.id,n)}return e},[U,_,j.list.isSuccess,m]),ge=e=>he.has(e.id)&&(!e.configured||e.id===L&&F.modal?.itemId!==e.id),_e=e=>!e.configured||ge(e),q=me.filter(e=>!_e(e)),xe=me.filter(_e).sort((e,t)=>e.name.localeCompare(t.name)||e.id.localeCompare(t.id)),Se=S||ue.isLoading||V.isLoading||B||j.list.isLoading||(P.isLoading||P.catalogLoading)&&U.length===0,Ce=j.auth.isBusy||F.managed!==null,we=S||!b||m===`full`&&!oe,Te=F.ownsMcpAttempt&&L!==null&&(F.modal?.itemId===L||me.some(e=>e.id===L&&ge(e))),J=F.modal?U.find(e=>e.id===F.modal?.itemId):void 0,Y=J?he.get(J.id):void 0,De=J?.kind===`oauth`?J.provider:void 0,Oe=M(De?.provider_key??``,De?.tenant_host),Ae=F.openModal;(0,X.useEffect)(()=>{if(!k){A.current=null;return}if(k===A.current)return;let e=U.find(e=>e.kind===`oauth`&&e.provider.provider_key===k);e&&(A.current=k,Ae(e.id))},[U,Ae,k]);let je=j.toolsServerId,Me=j.list.data?.servers.find(e=>e.id===je),Ne=Y&&je?bt(Y).find(e=>e.serverId===je):void 0,Pe=Ne?{[Ne.id]:{loading:j.details.isFetching,error:j.details.isError,summary:j.details.data?.servers.find(e=>e.serverId===je),endpointUrl:Me?.transport.url}}:void 0,Fe=Kt({assistantId:e,platformAssistantId:oe,onStopAuth:e=>{let t=j.auth.attempt?.serverId;if(!t)return;let n=e.pluginName!==void 0&&(t===$e(e.pluginName)||j.list.data?.servers.find(e=>e.id===t)?.pluginName===e.pluginName);(t===e.serverId||n)&&j.auth.stopWaiting()},onRemoveServer:j.setRemoveServerId,onPluginRemoved:()=>void j.list.refetch()}),Ie=()=>{v?j.setAddOpen(!0):g(f,{prompt:n(`mcpPage.setupPrompt`)})},Le=t=>{let n=t.kind===`mcp`?void 0:he.get(t.id);return t.kind!==`mcp`&&n&&ge(t)?(0,Z.jsx)(Pt,{plan:n,state:F.stateFor(t.id,n.name),showAlternatives:!_,disabled:F.isBusyElsewhere(t.id)||n.primary.kind===`managed-oauth`&&we,onConnect:e=>F.start(t,n,e),onLogin:ee,onCancel:F.cancel,onRetry:F.retry,onOpenSetupGuide:e=>void u(e)},t.id):t.kind===`oauth`?(0,Z.jsx)(Nt,{providerKey:t.provider.provider_key,displayName:t.name,description:t.provider.description,logoUrl:t.provider.logo_url,connections:t.connections,mcpMethods:t.methods,disabled:we||!n||F.isBusyElsewhere(t.id),onConfigure:()=>F.openModal(t.id)},t.id):t.kind===`plugin`?(0,Z.jsx)(sn,{assistantId:e,method:t.method,disabled:!n||F.isBusyElsewhere(t.id),onOpen:()=>F.openModal(t.id)},t.id):(0,Z.jsx)(an,{server:t.server,onRemove:j.setRemoveServerId,onConfigure:j.setConfigureServerId,onAuthenticate:e=>j.auth.connect(e),onManagePlugin:e=>f(e?`${le.plugins}/${encodeURIComponent(e)}`:le.plugins),isAuthenticating:j.auth.attempt?.serverId===t.server.id&&Ce,connectDisabled:Ce},t.id)};return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{value:w,onChange:e=>T(e.target.value),placeholder:n(`integrationsPage.searchPlaceholder`),"aria-label":n(`integrationsPage.searchAriaLabel`),leftIcon:(0,Z.jsx)(Re,{"aria-hidden":!0,className:`size-4`}),className:`min-h-11`,wrapperClassName:`min-w-0 basis-64 flex-1`,fullWidth:!0}),(0,Z.jsx)(r,{variant:`outlined`,className:`min-h-11 max-w-full whitespace-normal`,leftIcon:(0,Z.jsx)(Ee,{}),onClick:Ie,disabled:!y||Ce,children:n(`integrationsPage.addCustom`)})]}),pe.length>0?(0,Z.jsx)(`div`,{role:`group`,"aria-label":n(`integrationsPage.categoriesLabel`),className:`flex gap-2 overflow-x-auto pb-1 [scrollbar-width:none]`,children:pe.map(e=>(0,Z.jsx)(o,{selected:W===e.category,count:e.count,onClick:()=>O(W===e.category?null:e.category),children:n(yn[e.category])},e.category))}):null]}),de?(0,Z.jsx)(l,{tone:`warning`,children:n(`integrationsPage.oauthUnavailable`)}):null,j.list.isError?(0,Z.jsx)(l,{tone:`warning`,actions:(0,Z.jsx)(r,{variant:`ghost`,onClick:()=>void j.list.refetch(),children:n(`mcpConnect.retry`)}),children:n(`integrationsPage.mcpUnavailable`)}):null,P.catalogError||P.isError?(0,Z.jsx)(l,{tone:`warning`,children:n(`integrationsPage.pluginCatalogUnavailable`)}):null,(0,Z.jsx)(tn,{connections:j,allowAdd:v,attemptReportedElsewhere:Te}),F.managed&&b?(0,Z.jsx)(Bt,{assistantId:b.id,providerKey:F.managed.providerKey,providerLabel:F.managed.providerLabel,tenantHost:F.managed.tenantHost,restartToken:F.managed.restartToken,onReport:F.onManagedReport},F.managed.providerKey):null,Se?(0,Z.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(ke,{className:`size-4 animate-spin`}),n(`integrationsPage.loading`)]}):null,q.length>0?(0,Z.jsx)(Sn,{title:n(`integrationsPage.sectionConfigured`),count:q.length,gridClassName:bn,children:q.map(Le)}):null,xe.length>0?(0,Z.jsx)(Sn,{title:n(`integrationsPage.sectionAvailable`),count:xe.length,gridClassName:xn,children:xe.map(Le)}):null,!Se&&me.length===0?(0,Z.jsx)(`p`,{className:`py-8 text-center text-body-medium-default text-[var(--content-tertiary)]`,children:w.trim()?n(`integrationsPage.emptySearchSubtitle`,{query:w.trim()}):W?n(`integrationsPage.emptyCategory`,{category:n(yn[W])}):n(`integrationsPage.empty`)}):null,F.modal&&Y&&J&&J.kind!==`mcp`?(0,Z.jsx)(Tt,{plan:Y,focusMethodId:F.modal.methodId,attempt:F.attemptFor(J.id),tenantHost:Oe,toolsByConnectionId:Pe,ownOAuthContent:b&&J.kind===`oauth`?(0,Z.jsx)(Ut,{assistantId:b.id,providerKey:J.provider.provider_key,displayName:J.name,logoUrl:J.provider.logo_url}):null,onConnect:(e,t)=>F.run(J,Y,e,t),onLogin:ee,onCancelAttempt:F.cancel,onRetryAttempt:F.retry,onReconnect:e=>F.reconnect(J,Y,e),onOpenTools:e=>j.setToolsServerId(e.serverId??null),onDisconnect:e=>Fe(e,Y.name),onOpenSetupGuide:e=>void u(e),onClose:ae},J.id):null]})}function Tn(){let e=ue();return(0,Z.jsx)(X.Suspense,{children:(0,Z.jsx)(wn,{mcpAssistantId:e},e)})}export{Tn as IntegrationsPage};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$p as t,AS as n,BC as r,Bm as i,Br as a,CC as o,CS as s,C_ as c,DC as l,Fy as u,Gc as d,HC as f,Hr as p,Hu as m,Ji as h,Jl as g,Jp as _,KS as v,Ly as y,MC as b,OC as x,Qp as S,Rc as C,Rm as w,SC as T,UC as E,Uf as D,Ur as O,Uu as k,VC as A,Vm as j,Vr as M,Vu as N,WC as P,Wm as F,XS as I,Xp as ee,Yp as te,Zp as ne,bi as L,cC as R,fh as re,gC as z,hS as ie,jC as ae,jy as oe,ky as B,lh as se,mC as ce,mS as le,nt as ue,oC as V,sC as H,wi as de,xi as fe,yi as U,zc as pe,zd as W,zm as me,zy as he}from"./app-XG_RF2yi.js";import{$n as G,E as K,Xn as ge,er as _e,nr as q}from"./vendor-DwMhK7fD.js";import{_ as ve,d as ye,f as be,t as xe,x as Se}from"./react-B9IgSVeK.js";import{$r as Ce,A as we,At as Te,D as J,Ji as Y,Lt as Ee,Pt as De,Ya as Oe,Yn as ke,Zr as Ae,a as je,dr as Me,ft as Ne,gt as Pe,i as Fe,li as Ie,qi as Le,vt as Re,za as ze}from"./icons-C0wyat6T.js";import{a as Be,n as Ve,r as He,u as Ue}from"./use-plugins-list-DPWrP6Mv.js";var We=Oe(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),Ge=[`productivity`,`communication`,`meetings`,`sales`,`marketing`,`finance`,`commerce`,`engineering`,`knowledge`,`recruiting`],Ke=new Set(Ge);function qe(e){return typeof e==`string`&&Ke.has(e)}var X=e(Se(),1),Z=xe(),Je={"mcp-oauth":We,"mcp-manual":We,"managed-oauth":Ne,"own-oauth":Me};function Ye(e){let{t}=K(`settings`);return(0,X.useCallback)(n=>{switch(n.kind){case`mcp-oauth`:return t(`connectMethod.mcp`,{name:e});case`mcp-manual`:return t(`connectMethod.mcpManual`);case`managed-oauth`:return t(`connectMethod.managed`);case`own-oauth`:return t(`connectMethod.own`)}},[t,e])}function Xe(e,t,n){return e.map(e=>(0,Z.jsx)(b.Item,{icon:Je[e.kind],label:t(e),onSelect:()=>n(e)},e.id))}var Ze={slack:`slack_channel`,discord:`discord_channel`,telegram:`telegram`};function Qe(e){return Object.entries(Ze).some(([t,n])=>t===e&&n!==e)}function $e(e){return`plugin:${e}`}function et(e){let t=e.filter(e=>e.transport.type!==`stdio`&&e.status!==`connected`);return t.length===1?t[0].id:null}function tt(e){return async()=>(await e.install(),et(await e.loadPluginServers()))}function nt(e,t){return e.filter(e=>e.source===`plugin`&&e.pluginName===t)}function rt(e){return qe(e)?e:null}function it(e){let{connectedCount:t,needsAttention:n}=ot(e,[]);return{connectedCount:t,needsAttention:n}}function at(e,t){return e.filter(e=>e.provider===t)}function ot(e,t,n=!0){let r=t.flatMap(e=>e.servers),i=t.filter(e=>ct(e,n));return{connectedCount:e.filter(e=>e.connected).length+r.filter(e=>e.status===`connected`).length,needsAttention:e.some(e=>!e.connected)||i.some(e=>e.servers.some(e=>e.status!==`connected`)),configured:e.length>0||i.length>0}}function st(e){return e.status===`connected`||e.hasOAuth||e.hasStaticAuth}function ct(e,t=!0){return t?e.servers.some(st)?!0:!!e.definition.installed&&et(e.servers)===null:!!e.definition.installed||e.servers.length>0}function lt(e){if(e.transport.url)try{return new URL(e.transport.url).hostname}catch{return}}function ut(e,t,n,r=[],i=!0){let a=r.map(e=>({definition:e,servers:nt(n,e.pluginName)})),o=new Set,s=new Set(a.flatMap(e=>e.servers));return[...e.filter(e=>e.supports_managed_mode).flatMap(e=>{let n=at(t,e.provider_key);if(Qe(e.provider_key)&&n.length===0)return[];let r=a.filter(t=>t.definition.oauthProvider===e.provider_key);return r.forEach(e=>o.add(e)),[{kind:`oauth`,id:`oauth:${e.provider_key}`,name:e.display_name??e.provider_key,description:[e.description,...r.map(e=>e.definition.description)].filter(Boolean).join(` `),configured:ot(n,r,i).configured,category:rt(e.category),provider:e,connections:n,methods:r}]}),...a.filter(e=>!o.has(e)).map(e=>({kind:`plugin`,id:`plugin:${e.definition.pluginName}`,name:e.definition.displayName,description:e.definition.description,configured:ct(e,i),category:e.definition.category??null,method:e})),...n.filter(e=>!s.has(e)).map(e=>({kind:`mcp`,id:`mcp:${e.id}`,name:e.id,description:[e.pluginName,lt(e)].filter(Boolean).join(` `),configured:!0,category:null,server:e}))]}function dt(e,t,n=null){let r=t.trim().toLocaleLowerCase();return e.filter(e=>!n||e.category===n).filter(e=>!r||e.name.toLocaleLowerCase().includes(r)||e.description.toLocaleLowerCase().includes(r)).sort((e,t)=>Number(t.configured)-Number(e.configured)||e.name.localeCompare(t.name)||e.id.localeCompare(t.id))}function ft(e){return e.logo?de(`/images/integrations/${e.logo}`):null}function Q(e){return e===`mcp-oauth`||e===`mcp-manual`}function pt(e){switch(e.status){case`connected`:return`connected`;case`connecting`:case`starting`:return`connecting`;case`declared`:return`pending`;default:return`needs-attention`}}function mt(e,t,n){let r=e.servers.length>1;return e.servers.map(e=>{let i=pt(e);return{id:`mcp:${e.id}`,methodId:t,methodKind:n,label:r?e.id:null,detail:lt(e),status:i,pluginName:e.pluginName,serverId:e.id,canReconnect:i!==`connected`&&i!==`connecting`&&e.transport.type!==`stdio`&&!e.hasStaticAuth}})}function ht(e,t,n){return{id:`plugin:${e.pluginName}`,methodId:t,methodKind:n,label:null,status:`pending`,pluginName:e.pluginName,canReconnect:!1}}function gt(e,t){return e.map(e=>({id:`oauth:${e.id}`,methodId:t,methodKind:`managed-oauth`,label:e.account_label,accountId:e.id,status:e.connected?`connected`:`needs-attention`,canReconnect:!e.connected}))}function _t(e,t){let{definition:n}=e,r=n.setup.mode===`manual`?`mcp-manual`:`mcp-oauth`,i=`mcp:${n.pluginName}`,a=t&&e.servers.length===0&&n.installed;return{id:i,kind:r,availability:`available`,instructions:n.setup.instructions,setupGuideUrl:n.documentationUrl,connections:a?[ht(n,i,r)]:mt(e,i,r),plugin:n}}function vt(e,t){let n=[],r,i=null,a;if(e.kind===`oauth`){r=e.provider.provider_key,i=e.provider.logo_url,a=e.provider.description;for(let r of e.methods)n.push(_t(r,t.mcpServersLoaded));if(t.platformGate!==`gated`){let r=`managed:${e.provider.provider_key}`;n.push({id:r,kind:`managed-oauth`,availability:t.platformGate===`full`?`available`:`login-required`,connections:gt(e.connections,r)})}t.ownOAuthAvailable&&n.push({id:`own:${e.provider.provider_key}`,kind:`own-oauth`,availability:`available`,setupGuideUrl:e.provider.dashboard_url??void 0,connections:[]})}else{let{definition:o}=e.method;r=o.pluginName,i=ft(o),a=o.description,n.push(_t(e.method,t.mcpServersLoaded))}let[o,...s]=n;return o?{name:e.name,description:a,iconKey:r,logoUrl:i,primary:o,alternatives:s}:null}function yt(e){return[e.primary,...e.alternatives]}function bt(e){return yt(e).flatMap(e=>e.connections)}function xt(e){return yt(e).filter(e=>!Q(e.kind)||e.connections.length===0)}var $=`pointer-coarse:size-11`,St=[`flex flex-wrap items-start gap-2 [&>*]:shrink-0`,`[&_button]:max-w-full [&_button]:whitespace-normal`,`[&_button]:pointer-coarse:min-h-11`].join(` `);function Ct({icon:e,title:t,subtitle:n,status:r,primaryAction:i,actionMenu:a,layout:o=`row`}){return o===`tile`?(0,Z.jsxs)(x.Root,{bordered:!0,className:`flex h-full flex-col gap-3 transition-colors hover:border-[var(--border-hover)]`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[e,(0,Z.jsxs)(`div`,{className:`${St} justify-end`,children:[i,a]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,Z.jsx)(`p`,{className:`text-title-small text-[var(--content-default)] [overflow-wrap:anywhere]`,children:t}),(0,Z.jsx)(`p`,{className:`line-clamp-2 min-h-9 text-body-small-lighter text-[var(--content-tertiary)] [overflow-wrap:anywhere]`,children:n})]})]}):(0,Z.jsx)(x.Root,{children:(0,Z.jsxs)(x.Body,{padding:`md`,className:`grid grid-cols-[2rem_minmax(6rem,1fr)_minmax(0,auto)] items-start gap-x-3`,children:[e,(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-title-small text-[var(--content-default)] [overflow-wrap:anywhere]`,children:t}),r]}),n?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-body-medium-lighter text-[var(--content-tertiary)] [overflow-wrap:anywhere]`,children:n}):null]}),(0,Z.jsxs)(`div`,{className:`${St} col-start-3 row-start-1 justify-end`,children:[i,a]})]})})}function wt({plan:e,title:t,description:n}){return(0,Z.jsx)(R.Header,{children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(O,{providerKey:e.iconKey,displayName:e.name,logoUrl:e.logoUrl,size:40}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(R.Title,{className:`[&>span]:whitespace-normal`,children:t}),(0,Z.jsx)(R.Description,{children:n})]})]})})}function Tt({plan:e,attempt:t,focusMethodId:n,callbackUrl:i,callbackCopied:a=!1,toolsByConnectionId:o,ownOAuthContent:s,tenantHost:c,onConnect:l,onLogin:u,onCancelAttempt:d,onRetryAttempt:f,onReconnect:p,onDisconnect:m,onOpenTools:h,onCopyCallbackUrl:g,onOpenSetupGuide:_,onClose:v}){let{t:y}=K(`settings`),b=Ye(e.name),x=yt(e),S=bt(e),[C,w]=(0,X.useState)(()=>n?{kind:`connect`,methodId:n}:S.length>0?{kind:`connections`}:{kind:`connect`,methodId:e.primary.id}),[T,E]=(0,X.useState)(!1),[D,O]=(0,X.useState)(null);function k(t){return t.kind===`connect`?t:S.length===0?{kind:`connect`,methodId:e.primary.id}:t.kind===`tools`&&!S.some(e=>e.id===t.connectionId)?{kind:`connections`}:t}let A=k(C);function j(e){switch(e.kind){case`mcp-oauth`:case`mcp-manual`:return y(`integrationConnect.tagMcp`);case`managed-oauth`:return y(`integrationConnect.tagVellum`);case`own-oauth`:return y(`integrationConnect.tagOwnApp`)}}function M(t){return t.label?t.label:Q(t.methodKind)?y(`integrationConnect.connectionMcpLabel`,{name:e.name}):y(`integrationConnect.connectionAccountLabel`,{name:e.name})}function N(e,t){return Xe(e,b,t)}function P(e){E(!1),w({kind:`connect`,methodId:e.id})}function F(){if(S.length>0){w({kind:`connections`});return}w({kind:`connect`,methodId:e.primary.id})}let I=A.kind===`tools`?S.find(e=>e.id===A.connectionId):void 0,ee=A.kind===`connect`?x.find(e=>e.id===A.methodId)??e.primary:e.primary;function te(e){let t=e.setupGuideUrl;return t?(0,Z.jsx)(r,{variant:`ghost`,className:`mr-auto min-h-11`,leftIcon:(0,Z.jsx)(Ae,{}),onClick:()=>_(t),children:y(`integrationConnect.setupGuide`)}):null}return(0,Z.jsxs)(R.Root,{open:!0,onOpenChange:e=>{e||v()},children:[(0,Z.jsx)(R.Content,{size:`md`,children:A.kind===`connect`?(0,Z.jsx)(Et,{plan:e,method:ee,setupGuide:te(ee),methods:x,attempt:t,callbackUrl:i,callbackCopied:a,ownOAuthContent:s,tenantHost:c,acknowledged:T,hasConnections:S.length>0,methodItems:N,onAcknowledge:E,onPickMethod:P,onBack:F,onConnect:l,onLogin:u,onCancelAttempt:d,onRetryAttempt:f,onCopyCallbackUrl:g,onClose:v}):A.kind===`tools`?(0,Z.jsx)(Mt,{plan:e,connection:I,title:I?M(I):e.name,tools:o?.[A.connectionId],onBack:()=>w({kind:`connections`}),onClose:v}):(0,Z.jsx)(At,{plan:e,methods:x,connections:S,connectionTitle:M,methodTag:j,methodItems:N,onPickMethod:P,onOpenTools:e=>{h?.(e),w({kind:`tools`,connectionId:e.id})},onReconnect:e=>{p(e),w({kind:`connect`,methodId:e.methodId})},onRequestDisconnect:O,onClose:v})}),(0,Z.jsx)(V,{open:D!==null,destructive:!0,title:y(`integrationConnect.removeTitle`,{label:D?M(D):``}),message:y(`integrationConnect.removeMessage`),confirmLabel:y(`integrationConnect.remove`),cancelLabel:y(`integrationConnect.cancel`),onConfirm:()=>{D&&m(D),O(null)},onCancel:()=>O(null)})]})}function Et({plan:e,method:t,methods:n,attempt:i,callbackUrl:a,callbackCopied:o,ownOAuthContent:s,tenantHost:c,acknowledged:u,hasConnections:d,setupGuide:f,methodItems:m,onAcknowledge:h,onPickMethod:g,onBack:_,onConnect:v,onLogin:y,onCancelAttempt:b,onRetryAttempt:x,onCopyCallbackUrl:S,onClose:C}){let{t:w}=K(`settings`),T=t.kind===`managed-oauth`?c:null,E=p(T),D=i?.methodId===t.id?i:null,O=D!==null&&D.phase!==`error`,k=t.availability===`login-required`,A=t.kind===`mcp-manual`&&a!==void 0&&(!u||a.status!==`ready`),j=t.id!==e.primary.id||d,M=n.filter(e=>e.id!==t.id);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{plan:e,title:w(`integrationConnect.connectTitle`,{name:e.name}),description:e.description??w(`integrationConnect.connectDescription`,{name:e.name})}),(0,Z.jsxs)(R.Body,{className:`space-y-4`,children:[j?(0,Z.jsx)(r,{variant:`ghost`,leftIcon:(0,Z.jsx)(ze,{}),onClick:_,children:w(`integrationConnect.back`)}):null,k?(0,Z.jsx)(l,{tone:`info`,children:w(`integrationConnect.loginRequired`,{name:e.name})}):null,D?(0,Z.jsx)(Dt,{name:e.name,attempt:D,onCancel:b,onRetry:x}):null,T?(0,Z.jsx)(z,{label:T.label,type:`text`,value:E.value,onChange:e=>E.setValue(e.target.value),placeholder:T.placeholder,"aria-invalid":E.showsInvalid||void 0,helperText:E.showsInvalid?w(`integrationConnect.tenantHostInvalid`,{label:T.label,placeholder:T.placeholder}):void 0,disabled:O,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,fullWidth:!0}):null,t.kind===`mcp-manual`?(0,Z.jsx)(Ot,{instructions:t.instructions,name:e.name,callbackUrl:a,callbackCopied:o,acknowledged:u,onAcknowledge:h,onCopyCallbackUrl:S}):t.kind===`own-oauth`?s:(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:t.instructions??w(`integrationConnect.browserHint`,{name:e.name})})]}),(0,Z.jsxs)(R.Footer,{children:[f,(0,Z.jsx)(r,{variant:`ghost`,className:`min-h-11`,onClick:C,children:w(`integrationConnect.cancel`)}),t.kind===`own-oauth`?null:(0,Z.jsx)(ae,{className:`min-h-11`,disabled:O||A||!E.valid,menuDisabled:O,leftIcon:O?(0,Z.jsx)(ke,{className:`animate-spin`}):null,menuTitle:w(`integrationConnect.otherWays`),menuTriggerLabel:w(`connectMethod.otherWaysLabel`,{name:e.name}),menuItems:m(M,g),onClick:()=>k?y():v(t,{acknowledged:u,tenantHost:E.normalized}),children:w(k?`integrationConnect.loginToConnect`:`integrationConnect.connect`)})]})]})}function Dt({name:e,attempt:t,onCancel:n,onRetry:i}){let{t:a}=K(`settings`);if(t.phase===`error`)return(0,Z.jsx)(l,{tone:`error`,actions:(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(r,{variant:`outlined`,onClick:i,children:a(`integrationConnect.retry`)}),(0,Z.jsx)(r,{variant:`ghost`,onClick:n,children:t.canCancel?a(`integrationConnect.stopWaiting`):a(`integrationConnect.cancel`)})]}),children:(0,Z.jsx)(`p`,{children:t.error??a(`integrationConnect.attemptFailed`,{name:e})})});let o=t.phase===`starting`?a(`integrationConnect.attemptStarting`,{name:e}):t.phase===`connecting`?a(`integrationConnect.attemptConnecting`,{name:e}):a(`integrationConnect.attemptWaiting`,{name:e});return(0,Z.jsx)(l,{tone:`info`,icon:(0,Z.jsx)(ke,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),actions:t.canCancel?(0,Z.jsx)(r,{variant:`ghost`,onClick:n,children:a(`integrationConnect.stopWaiting`)}):void 0,children:o})}function Ot({instructions:e,name:t,callbackUrl:n,callbackCopied:i,acknowledged:a,onAcknowledge:o,onCopyCallbackUrl:s}){let{t:c}=K(`settings`),l=n?.status===`ready`?n.url:void 0,u=e?(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:e}):null;return n?(0,Z.jsxs)(Z.Fragment,{children:[u,(0,Z.jsxs)(`ol`,{className:`space-y-4`,children:[(0,Z.jsxs)(kt,{index:1,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-default`,children:c(`integrationConnect.manualStep1`)}),l?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-2`,children:[(0,Z.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-body-small-default [overflow-wrap:anywhere]`,children:l}),s?(0,Z.jsx)(r,{variant:`outlined`,size:`compact`,leftIcon:i?(0,Z.jsx)(Y,{}):(0,Z.jsx)(Ie,{}),onClick:()=>s(l),children:c(i?`integrationConnect.copied`:`integrationConnect.copy`)}):null]}):(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:n?.status===`error`?c(`integrationConnect.callbackError`):c(`integrationConnect.callbackLoading`)})]}),(0,Z.jsx)(kt,{index:2,children:(0,Z.jsx)(`p`,{className:`text-body-medium-default`,children:c(`integrationConnect.manualStep2`,{name:t})})}),(0,Z.jsx)(kt,{index:3,children:(0,Z.jsx)(ce,{checked:a,onCheckedChange:e=>o(e===!0),label:c(`integrationConnect.manualStep3`)})})]})]}):u}function kt({index:e,children:t}){return(0,Z.jsxs)(`li`,{className:`flex gap-3`,children:[(0,Z.jsx)(`span`,{className:`w-3 shrink-0 text-body-medium-default text-[var(--content-tertiary)]`,children:e}),(0,Z.jsx)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:t})]})}function At({plan:e,methods:t,connections:n,connectionTitle:i,methodTag:a,methodItems:o,onPickMethod:s,onOpenTools:c,onReconnect:l,onRequestDisconnect:u,onClose:d}){let{t:f}=K(`settings`),p=xt(e);function m(e){let n=t.find(t=>t.id===e.methodId);if(t.length<2||!n)return e.detail;let r=a(n);return e.detail?f(`integrationConnect.connectionSubtitle`,{method:r,detail:e.detail}):r}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{plan:e,title:e.name,description:f(`integrationConnect.connectionsDescription`,{name:e.name})}),(0,Z.jsx)(R.Body,{children:(0,Z.jsx)(`div`,{className:`rounded-lg border border-[var(--border-base)]`,children:n.map(e=>(0,Z.jsx)(v,{title:i(e),subtitle:m(e),trailingInteractive:!0,trailing:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 touch-mobile:max-w-24`,children:[(0,Z.jsx)(jt,{status:e.status}),e.canReconnect?(0,Z.jsx)(r,{variant:`outlined`,size:`compact`,leftIcon:(0,Z.jsx)(Te,{}),onClick:()=>l(e),children:e.status===`pending`?f(`integrationConnect.finishConnecting`):f(`integrationConnect.reconnect`)}):null,Q(e.methodKind)?(0,Z.jsx)(r,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(je,{}),"aria-label":f(`integrationConnect.toolsAndDetailsLabel`,{label:i(e)}),onClick:()=>c(e)}):null,(0,Z.jsx)(r,{variant:`dangerOutline`,className:$,iconOnly:(0,Z.jsx)(we,{}),"aria-label":f(`integrationConnect.removeLabel`,{label:i(e)}),onClick:()=>u(e)})]})},e.id))})}),(0,Z.jsxs)(R.Footer,{children:[p.length>0?(0,Z.jsxs)(b.Root,{children:[(0,Z.jsx)(b.Trigger,{asChild:!0,children:(0,Z.jsx)(r,{variant:`outlined`,className:`min-h-11`,rightIcon:(0,Z.jsx)(Le,{}),children:f(`integrationConnect.connectAnother`)})}),(0,Z.jsx)(b.Content,{title:f(`integrationConnect.connectAnother`),children:o(p,s)})]}):null,(0,Z.jsx)(r,{className:`min-h-11`,onClick:d,children:f(`integrationConnect.done`)})]})]})}function jt({status:e}){let{t}=K(`settings`);switch(e){case`needs-attention`:return(0,Z.jsx)(T,{tone:`negative`,children:t(`integrationConnect.statusNeedsAttention`)});case`connecting`:return(0,Z.jsx)(T,{children:t(`integrationConnect.statusConnecting`)});case`pending`:return(0,Z.jsx)(T,{children:t(`integrationConnect.statusPending`)});case`connected`:return null}}function Mt({plan:e,connection:t,title:n,tools:i,onBack:a,onClose:o}){let{t:s}=K(`settings`),c=i?.summary;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{plan:e,title:n,description:s(`integrationConnect.toolsAndDetails`)}),(0,Z.jsxs)(R.Body,{className:`space-y-4`,children:[(0,Z.jsx)(r,{variant:`ghost`,leftIcon:(0,Z.jsx)(ze,{}),onClick:a,children:s(`integrationConnect.back`)}),(0,Z.jsxs)(`dl`,{className:`space-y-1`,children:[(0,Z.jsx)(`dt`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:s(`integrationConnect.endpoint`)}),(0,Z.jsx)(`dd`,{className:`font-mono text-body-small-default text-[var(--content-tertiary)] [overflow-wrap:anywhere]`,children:i?.endpointUrl??t?.detail??s(`integrationConnect.endpointUnknown`)})]}),i?.loading?(0,Z.jsx)(`p`,{role:`status`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`integrationConnect.toolsLoading`)}):i?.error?(0,Z.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`integrationConnect.toolsError`)}):c&&c.tools.length>0?(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:s(`integrationConnect.toolsSummary`,{count:c.toolCount,tokens:c.estimatedTokens})}),(0,Z.jsx)(I.Root,{type:`multiple`,className:`rounded-lg border border-[var(--border-base)]`,children:c.tools.map(e=>(0,Z.jsxs)(I.Item,{value:e.name,className:`border-b border-[var(--border-base)] last:border-b-0`,children:[(0,Z.jsxs)(I.Trigger,{className:`justify-between gap-2 px-3 py-2.5 text-left [&[data-state=open]>svg]:rotate-180`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-body-small-default`,children:e.name}),(0,Z.jsx)(Le,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform duration-150`})]}),(0,Z.jsx)(I.Content,{children:(0,Z.jsxs)(`div`,{className:`space-y-1 px-3 pb-3`,children:[e.description?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap text-body-small-default text-[var(--content-secondary)] [overflow-wrap:anywhere]`,children:e.description}):null,(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`integrationConnect.toolTokens`,{tokens:e.estimatedTokens})})]})})]},e.name))})]}):(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`integrationConnect.toolsEmpty`)})]}),(0,Z.jsx)(R.Footer,{children:(0,Z.jsx)(r,{className:`min-h-11`,onClick:o,children:s(`integrationConnect.done`)})})]})}function Nt({providerKey:e,displayName:t,description:n,logoUrl:i,connections:a,mcpMethods:o=[],disabled:s,onConfigure:c}){let{t:l}=K(`settings`),{connectedCount:u}=it(a),{needsAttention:d,configured:f}=ot(a,o);return(0,Z.jsx)(Ct,{icon:(0,Z.jsx)(O,{providerKey:e,displayName:t,logoUrl:i,size:32}),title:t,subtitle:u>0?l(`integrationRow.connectedAccounts`,{count:u}):n,status:d?(0,Z.jsx)(T,{tone:`negative`,children:l(`integrationRow.needsAttention`)}):void 0,primaryAction:f?(0,Z.jsx)(r,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Pe,{}),"aria-label":l(`integrationRow.configureLabel`,{name:t}),onClick:c,disabled:s}):(0,Z.jsx)(r,{variant:`primary`,onClick:c,disabled:s,children:l(`integrationRow.connect`)})})}function Pt({plan:e,state:t,layout:n=`tile`,showAlternatives:i=!1,disabled:a=!1,onConnect:o,onLogin:s,onCancel:c,onRetry:l,onOpenSetupGuide:u}){let{t:d}=K(`settings`),f=Ye(e.name),p=E(),m=t.phase===`waiting`||t.phase===`connecting`,h=m&&!p;function g(e){if(e.availability===`login-required`){s();return}o(e)}function _(e){return Xe(e,f,g)}let v=i&&e.alternatives.length>0?(0,Z.jsx)(ae,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Ee,{}),"aria-label":d(`integrationTile.connect`,{name:e.name}),menuTitle:d(`integrationTile.connect`,{name:e.name}),menuTriggerLabel:d(`connectMethod.otherWaysLabel`,{name:e.name}),menuItems:_(yt(e)),disabled:a,onClick:()=>g(e.primary)}):(0,Z.jsx)(r,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Ee,{}),"aria-label":d(`integrationTile.connect`,{name:e.name}),disabled:a,onClick:()=>g(e.primary)});return m?v=(0,Z.jsx)(zt,{name:e.name,state:t,announce:!h,onCancel:c}):t.phase===`failed`&&(v=(0,Z.jsx)(Rt,{plan:e,state:t,disabled:a,methodItems:_,onRetry:l,onOpenSetupGuide:u})),(0,Z.jsx)(Ct,{layout:n,icon:(0,Z.jsx)(O,{providerKey:e.iconKey,displayName:e.name,logoUrl:e.logoUrl,size:32}),title:e.name,subtitle:t.phase===`failed`?(0,Z.jsx)(Lt,{name:e.name,state:t}):h&&m?(0,Z.jsx)(`span`,{role:`status`,children:It(d,e.name,t)}):e.description??void 0,primaryAction:v})}var Ft=4e3;function It(e,t,n){return n.phase===`waiting`?e(`integrationTile.waiting`,{name:t}):e(`integrationTile.connecting`,{name:t})}function Lt({name:e,state:t}){let{t:n}=K(`settings`),r=t.error||n(`integrationTile.failedGeneric`,{name:e});return(0,Z.jsxs)(`span`,{role:`alert`,title:t.error||void 0,className:`font-medium text-[var(--system-negative-strong)]`,children:[(0,Z.jsx)(J,{"aria-hidden":`true`,className:`mr-1 inline size-3.5 shrink-0 align-[-0.15em]`}),r]})}function Rt({plan:e,state:t,disabled:n,methodItems:i,onRetry:a,onOpenSetupGuide:o}){let{t:s}=K(`settings`),c=Q(t.methodKind)?t.setupGuideUrl:void 0,l=xt(e).filter(e=>e.id!==t.methodId),u=[...c?[(0,Z.jsx)(b.Item,{icon:Ae,label:s(`integrationTile.setupGuide`),onSelect:()=>o(c)},`setup-guide`)]:[],...i(l)],d=s(`integrationTile.retryLabel`,{name:e.name});return u.length===0?(0,Z.jsx)(r,{variant:`dangerOutline`,className:$,iconOnly:(0,Z.jsx)(Te,{}),"aria-label":d,disabled:n,onClick:a}):(0,Z.jsx)(ae,{variant:`dangerOutline`,className:$,iconOnly:(0,Z.jsx)(Te,{}),"aria-label":d,menuTitle:s(`connectMethod.otherWaysLabel`,{name:e.name}),menuTriggerLabel:s(`connectMethod.otherWaysLabel`,{name:e.name}),menuItems:u,disabled:n,onClick:a})}function zt({name:e,state:t,announce:n,onCancel:i}){let{t:a}=K(`settings`),o=E(),[s,c]=(0,X.useState)(!1),l=(0,X.useRef)(null),u=t.phase===`waiting`&&t.canCancel,d=It(a,e,t);function p(){l.current&&=(clearTimeout(l.current),null)}function m(e){p(),c(!0),e&&(l.current=setTimeout(()=>c(!1),Ft))}function h(){p(),c(!1)}(0,X.useEffect)(()=>p,[]);function g(e){return o&&e!==`touch`}let _=n?(0,Z.jsx)(`span`,{role:`status`,className:`sr-only`,children:d}):null;return u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(r,{variant:`outlined`,className:$,iconOnly:s?(0,Z.jsx)(Fe,{}):(0,Z.jsx)(ke,{className:`animate-spin`}),"aria-label":a(`integrationTile.cancelLabel`,{name:e}),tooltip:a(`integrationTile.waitingCancel`,{name:e}),onPointerEnter:e=>{g(e.pointerType)&&m(!1)},onPointerLeave:e=>{g(e.pointerType)&&h()},onBlur:h,onClick:e=>{if(s||e.detail===0){h(),i();return}m(!0)}}),_]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(f,{content:d,children:(0,Z.jsx)(`span`,{className:P(A({variant:`outlined`,iconOnly:!0}),$,`cursor-default hover:bg-transparent`),children:(0,Z.jsx)(ke,{"aria-hidden":`true`,className:`size-3.5 animate-spin text-[var(--content-tertiary)]`})})}),_]})}function Bt({assistantId:e,providerKey:t,providerLabel:n,tenantHost:r,restartToken:i,onReport:a}){let{connect:o,dismiss:s,status:c,errorMessage:l}=U({assistantId:e,providerKey:t,providerLabel:n}),u=(0,X.useRef)(o),d=(0,X.useRef)(r);return(0,X.useLayoutEffect)(()=>{u.current=o,d.current=r}),(0,X.useLayoutEffect)(()=>{u.current(void 0,d.current)},[i]),(0,X.useEffect)(()=>s,[s]),(0,X.useEffect)(()=>{a({status:c,errorMessage:l})},[l,a,c]),null}function Vt(e){return e.length>16?`${e.slice(0,12)}…${e.slice(-4)}`:e.length>8?`${e.slice(0,8)}…`:e}function Ht(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}catch{return``}}function Ut({assistantId:e,providerKey:t,displayName:n,logoUrl:a}){let{t:o}=K(`settings`),s=q(),c=G({...ee({path:{assistant_id:e},query:{provider_key:t}}),select:e=>e.apps}),l=G({...S({path:{assistant_id:e,providerKey:t}}),select:e=>e.oauth_callback_url}),u=c.data??[],d=l.data??null,f=_e({queries:u.map(t=>({..._({path:{assistant_id:e,appId:t.id}}),select:e=>e.connections}))}),p={};u.forEach((e,t)=>{p[e.id]=f[t]?.data??[]});let m=ne({path:{assistant_id:e},query:{provider_key:t}}),h=i({onSuccess:()=>{s.invalidateQueries({queryKey:m}),E(``),k(``),C(!1),H.success(o(`yourOwnOauthTab.appAddedToast`,{name:n}))},onError:e=>{H.error(e.message||o(`yourOwnOauthTab.createFailedToast`))}}),g=me({onSuccess:()=>{s.invalidateQueries({queryKey:m}),H.success(o(`yourOwnOauthTab.appDeletedToast`))},onError:e=>{H.error(e.message||o(`yourOwnOauthTab.deleteFailedToast`))}}),v=w({onSuccess:e=>{`auth_url`in e&&(window.location.href=e.auth_url)},onError:e=>{H.error(e.message||o(`yourOwnOauthTab.connectFailedToast`))}}),y=j(),[b,C]=(0,X.useState)(!1),[T,E]=(0,X.useState)(``),[D,k]=(0,X.useState)(``),[A,M]=(0,X.useState)(!1),[N,P]=(0,X.useState)(null),[F,I]=(0,X.useState)(null),L=h.isPending,R=g.isPending?g.variables?.path?.id??null:null,re=v.isPending?v.variables?.path?.appId??null:null,ie=y.isPending?y.variables?.path?.id??null:null,ae=()=>{let n=T.trim(),r=D.trim();!n||!r||h.mutate({path:{assistant_id:e},body:{provider_key:t,client_id:n,client_secret:r}})},B=()=>{let t=N;P(null),t&&g.mutate({path:{assistant_id:e,id:t.id}})},se=t=>{v.mutate({path:{assistant_id:e,appId:t.id},body:{callback_transport:`gateway`,scopes:[]}})};return c.isLoading?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,Z.jsx)(ke,{className:`h-5 w-5 animate-spin text-[var(--content-disabled)]`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u.length===0||b?(0,Z.jsx)(x.Root,{children:(0,Z.jsxs)(x.Body,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:u.length===0?o(`yourOwnOauthTab.addOwnApp`,{name:n}):o(`yourOwnOauthTab.addAnotherApp`,{name:n})}),(0,Z.jsx)(`p`,{className:`text-body-small-lighter leading-relaxed text-[var(--content-tertiary)]`,children:o(`yourOwnOauthTab.credentialsNote`)})]}),d?(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:o(`yourOwnOauthTab.redirectUrl`)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(z,{type:`text`,value:d,readOnly:!0,fullWidth:!0}),(0,Z.jsx)(r,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>{oe(d,{successMessage:o(`yourOwnOauthTab.copiedToast`),errorMessage:o(`yourOwnOauthTab.copyFailedToast`),onCopied:()=>{M(!0),setTimeout(()=>M(!1),2e3)}})},"aria-label":o(A?`yourOwnOauthTab.copiedAria`:`yourOwnOauthTab.copyRedirectAria`),iconOnly:A?(0,Z.jsx)(Y,{"aria-hidden":!0}):(0,Z.jsx)(Ie,{"aria-hidden":!0})})]}),(0,Z.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:o(`yourOwnOauthTab.redirectHint`)})]}):null,(0,Z.jsx)(z,{label:o(`yourOwnOauthTab.clientId`),type:`text`,value:T,onChange:e=>E(e.target.value),placeholder:o(`yourOwnOauthTab.clientIdPlaceholder`),fullWidth:!0}),(0,Z.jsx)(z,{label:o(`yourOwnOauthTab.clientSecret`),type:`password`,value:D,onChange:e=>k(e.target.value),placeholder:o(`yourOwnOauthTab.clientSecretPlaceholder`),fullWidth:!0}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-1`,children:[u.length>0?(0,Z.jsx)(r,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>{C(!1),E(``),k(``)},disabled:L,children:o(`yourOwnOauthTab.cancel`)}):null,(0,Z.jsx)(r,{type:`button`,size:`compact`,onClick:ae,disabled:L||!T.trim()||!D.trim(),loading:L,leftIcon:(0,Z.jsx)(Ee,{"aria-hidden":!0}),children:o(`yourOwnOauthTab.addApp`)})]})]})}):null,u.map(e=>{let i=p[e.id]??[],s=R===e.id,c=re===e.id;return(0,Z.jsx)(x.Root,{children:(0,Z.jsxs)(x.Body,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,Z.jsx)(`p`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:Vt(e.client_id)}),(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:o(`yourOwnOauthTab.addedOn`,{date:Ht(e.created_at)})})]}),(0,Z.jsx)(r,{type:`button`,variant:`dangerOutline`,size:`compact`,onClick:()=>P(e),disabled:s,"aria-label":o(`yourOwnOauthTab.deleteAppAria`,{id:Vt(e.client_id)}),loading:s,iconOnly:(0,Z.jsx)(we,{"aria-hidden":!0})})]}),i.length>0?(0,Z.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)] overflow-hidden rounded-md border border-[var(--border-base)] dark:divide-[var(--border-base)] dark:border-[var(--border-base)]`,children:i.map(i=>{let s=ie===i.id,c=i.account_info??o(`yourOwnOauthTab.accountFallback`,{name:n});return(0,Z.jsxs)(`li`,{className:`flex items-center gap-3 px-3 py-2`,children:[(0,Z.jsx)(O,{providerKey:t,displayName:n,logoUrl:a,size:18}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-medium-lighter text-[var(--content-default)]`,children:c}),(0,Z.jsx)(r,{type:`button`,variant:`dangerOutline`,size:`compact`,onClick:()=>I({appId:e.id,connection:i}),disabled:s,"aria-label":o(`yourOwnOauthTab.disconnectAria`,{account:c}),loading:s,iconOnly:(0,Z.jsx)(we,{"aria-hidden":!0})})]},i.id)})}):null,(0,Z.jsx)(r,{type:`button`,size:`compact`,onClick:()=>se(e),disabled:c,className:`w-full`,loading:c,leftIcon:(0,Z.jsx)(Ae,{"aria-hidden":!0}),children:o(c?`yourOwnOauthTab.waitingAuthorization`:`yourOwnOauthTab.connectAccount`)})]})},e.id)}),u.length>0&&!b?(0,Z.jsx)(r,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>C(!0),className:`w-full border-dashed`,leftIcon:(0,Z.jsx)(Ee,{"aria-hidden":!0}),children:o(`yourOwnOauthTab.addAnotherAppButton`)}):null,(0,Z.jsx)(V,{open:N!==null,title:o(`yourOwnOauthTab.deleteAppTitle`),message:N?o(`yourOwnOauthTab.deleteAppMessage`,{id:Vt(N.client_id)}):``,confirmLabel:o(`yourOwnOauthTab.delete`),destructive:!0,onConfirm:B,onCancel:()=>P(null)}),(0,Z.jsx)(V,{open:F!==null,title:o(`yourOwnOauthTab.disconnectTitle`,{name:n}),message:F?o(`yourOwnOauthTab.disconnectMessage`,{account:F.connection.account_info??o(`yourOwnOauthTab.accountFallback`,{name:n})}):``,confirmLabel:o(`yourOwnOauthTab.disconnect`),destructive:!0,onConfirm:()=>{let t=F;I(null),t&&y.mutate({path:{assistant_id:e,id:t.connection.id}},{onSuccess:()=>{let r=te({path:{assistant_id:e,appId:t.appId}});s.invalidateQueries({queryKey:r}),s.invalidateQueries({queryKey:m}),H.success(o(`yourOwnOauthTab.disconnectedToast`,{name:n}))},onError:e=>{H.error(e.message||o(`yourOwnOauthTab.disconnectFailedToast`))}})},onCancel:()=>I(null)})]})}var Wt={phase:`idle`};function Gt({assistantId:e,mcp:t}){let{t:n}=K(`settings`),r=q(),{mutateAsync:i}=F(),[o,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(null),_=(0,X.useRef)(null),v=(0,X.useRef)(null),y=t.auth.attempt,b=t.auth.connect,x=t.auth.retry,S=t.auth.stopWaiting,C=t.auth.isBusy,w=t.list.refetch;(0,X.useEffect)(()=>{let e=_.current;if(e&&(_.current=null,y&&y.operationId!==e.priorOperationId)){c({itemId:e.itemId,methodId:e.methodId,methodKind:e.methodKind,setupGuideUrl:e.setupGuideUrl,operationId:y.operationId});return}o&&y?.operationId!==o.operationId&&(c(null),v.current=null)},[y,o]),(0,X.useEffect)(()=>{y?.phase===`connecting`&&(v.current=null)},[y?.phase]),(0,X.useEffect)(()=>{!l||d?.status!==`connected`||(H.success(n(`useOauthConnect.accountConnected`,{name:l.providerLabel,ns:`common`})),u(null),f(null))},[l,d,n]);let T=(0,X.useCallback)(async e=>{let t=await w();return t.isError?[]:nt(t.data?.servers??[],e)},[w]),{remove:E}=Be(e,{onRemoved:()=>{w(),g(null)},onRemoveError:(e,t)=>{s(t,{context:`integrations.connectRollback`,tags:{plugin:e}}),g(null)},announceWarnings:!1}),D=(0,X.useCallback)((t,n)=>{let a=(async()=>{await i({path:{assistant_id:e},body:{name:t}}),pe(r,e,t)})();return v.current={itemId:n,pluginName:t,landed:a.then(()=>!0,()=>!1)},a},[e,i,r]),O=(0,X.useCallback)(()=>{let e=v.current;v.current=null,e&&(g(e.itemId),e.landed.then(t=>{if(!t){g(null);return}E(e.pluginName)}))},[E]),k=(0,X.useCallback)(()=>{o&&S(),u(null),f(null),O()},[S,o,O]),A=(0,X.useCallback)((e,t,n,r)=>{h!==e.itemId&&(k(),_.current={...e,priorOperationId:y?.operationId??null},b(t,r,n))},[y,b,k,h]),j=(0,X.useCallback)((e,t,n)=>{let r=n.plugin;if(!r||C)return;let i=!!r.installed;A({itemId:e.id,methodId:n.id,methodKind:n.kind,setupGuideUrl:n.setupGuideUrl},$e(r.pluginName),t.name,tt({install:i?()=>Promise.resolve():()=>D(r.pluginName,e.id),loadPluginServers:()=>T(r.pluginName)}))},[C,A,D,T]),M=(0,X.useCallback)((e,t,n,r)=>{if(e.kind!==`oauth`||C)return;let{provider:i}=e;if(!r?.tenantHost&&a(i.provider_key,i.tenant_host)){m({itemId:e.id,methodId:n.id});return}k(),u({itemId:e.id,methodId:n.id,providerKey:i.provider_key,providerLabel:t.name,tenantHost:r?.tenantHost,restartToken:0})},[C,k]),N=(0,X.useCallback)((e,t,n,r)=>{if(Q(n.kind)){j(e,t,n);return}n.kind===`managed-oauth`&&M(e,t,n,r)},[M,j]),P=(0,X.useCallback)((e,t,n)=>{let r=yt(t).find(e=>e.id===n.methodId);if(!Q(n.methodKind)){r&&M(e,t,r);return}!n.serverId||C||A({itemId:e.id,methodId:n.methodId,methodKind:n.methodKind,setupGuideUrl:r?.setupGuideUrl},n.serverId,t.name)},[C,A,M]),I=(0,X.useCallback)((e,t,n)=>{if(n.kind===`mcp-manual`||n.kind===`own-oauth`){m({itemId:e.id,methodId:n.id});return}N(e,t,n)},[N]),ee=(0,X.useCallback)(()=>{if(o){if(y?.phase!==`error`)return;_.current={itemId:o.itemId,methodId:o.methodId,methodKind:o.methodKind,setupGuideUrl:o.setupGuideUrl,priorOperationId:o.operationId},x();return}f(null),u(e=>e&&{...e,restartToken:e.restartToken+1})},[y,x,o]),te=(0,X.useCallback)((e,t)=>o?.itemId===e&&y?y.phase===`error`?{phase:`failed`,error:y.error??n(`integrationTile.failedGeneric`,{name:t}),methodId:o.methodId,methodKind:o.methodKind,setupGuideUrl:o.setupGuideUrl}:y.phase===`connecting`?{phase:`connecting`}:{phase:`waiting`,canCancel:!0}:l?.itemId===e?d?.errorMessage?{phase:`failed`,error:d.errorMessage,methodId:l.methodId,methodKind:`managed-oauth`}:{phase:`waiting`,canCancel:!0}:Wt,[y,l,d,o,n]),ne=(0,X.useCallback)(e=>o?.itemId===e&&y?{methodId:o.methodId,phase:y.phase,error:y.error,canCancel:!0}:l?.itemId===e?{methodId:l.methodId,phase:d?.errorMessage?`error`:`waiting`,error:d?.errorMessage??void 0,canCancel:!0}:null,[y,l,d,o]),L=(0,X.useCallback)(e=>C&&o?.itemId!==e||l!==null&&l.itemId!==e||h===e,[C,l,o,h]),R=(0,X.useCallback)((e,t)=>m({itemId:e,methodId:t}),[]),re=(0,X.useCallback)(()=>m(null),[]);return{start:I,run:N,reconnect:P,cancel:k,retry:ee,stateFor:te,attemptFor:ne,isBusyElsewhere:L,ownsMcpAttempt:o!==null,attemptItemId:o?.itemId??l?.itemId??null,managed:l,onManagedReport:f,modal:p,openModal:R,closeModal:re}}function Kt({assistantId:e,platformAssistantId:t,onStopAuth:r,onRemoveServer:i,onPluginRemoved:a}){let{t:o}=K(`settings`),s=q(),c=(0,X.useRef)(``),l=Be(e,{onRemoved:()=>{a(),H.success(o(`integrationConnect.removedToast`,{name:c.current}))},onRemoveError:()=>H.error(o(`integrationConnect.removeFailedToast`,{name:c.current}))}),u={path:{assistant_id:t??``}},d=W({onSuccess(e,t){H.success(o(`integrationConnect.disconnectedToast`,{name:c.current}));let n=t.path.connection_id;k(s,u,e=>e?.filter(e=>e.id!==n)),s.invalidateQueries({queryKey:m(u)})},onError(e){H.error(n(e,void 0,o(`integrationConnect.disconnectFailedToast`,{name:c.current})))}}),f=d.mutate,p=l.remove,h=l.isRemoving||d.isPending;return(0,X.useCallback)((e,n)=>{if(!h){if(c.current=n,Q(e.methodKind)){if(r(e),e.pluginName){p(e.pluginName);return}e.serverId&&i(e.serverId);return}!e.accountId||!t||f({path:{assistant_id:t,connection_id:e.accountId}})}},[h,f,i,r,t,p])}var qt=[{value:`none`,labelKey:`mcpAddServerModal.authNone`},{value:`oauth`,labelKey:`mcpAddServerModal.authOAuth`},{value:`bearer`,labelKey:`mcpAddServerModal.authBearer`},{value:`api-key`,labelKey:`mcpAddServerModal.authApiKey`}],Jt=[{value:`sse`,labelKey:`mcpAddServerModal.transportSse`},{value:`streamable-http`,labelKey:`mcpAddServerModal.transportStreamableHttp`},{value:`stdio`,labelKey:`mcpAddServerModal.transportStdio`}];function Yt(e){return qt.map(({value:t,labelKey:n})=>({value:t,label:e(n)}))}function Xt(e){return Jt.map(({value:t,labelKey:n})=>({value:t,label:e(n)}))}function Zt({open:e,onClose:t,onAdd:n,isPending:i}){let{t:a}=K(`settings`),o=(0,X.useMemo)(()=>Yt(a),[a]),s=(0,X.useMemo)(()=>Xt(a),[a]),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(`sse`),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(``),[g,_]=(0,X.useState)(``),[v,y]=(0,X.useState)(`none`),[b,x]=(0,X.useState)(``),[S,C]=(0,X.useState)(`X-API-Key`),[w,T]=(0,X.useState)(``),E=(0,X.useCallback)(()=>{l(``),d(`sse`),p(``),h(``),_(``),y(`none`),x(``),C(`X-API-Key`),T(``)},[]),D=(0,X.useCallback)(()=>{i||(E(),t())},[i,E,t]),O=(0,X.useCallback)(()=>{let e=c.trim();if(!e)return;let t={name:e,transportType:u};if(u===`stdio`){let e=m.trim();if(!e)return;t.command=e;let n=g.trim();n&&(t.args=n.split(/\s+/))}else{let e=f.trim();if(!e)return;t.url=e,v===`bearer`&&b.trim()?t.headers={Authorization:`Bearer ${b.trim()}`}:v===`api-key`&&S.trim()&&w.trim()?t.headers={[S.trim()]:w.trim()}:v===`oauth`&&(t.autoAuth=!0)}n(t)},[c,u,f,m,g,v,b,S,w,n]),k=u===`stdio`,A=c.trim()&&(k?m.trim():f.trim());return(0,Z.jsx)(R.Root,{open:e,onOpenChange:e=>{e||D()},children:(0,Z.jsxs)(R.Content,{size:`md`,children:[(0,Z.jsxs)(R.Header,{icon:We,children:[(0,Z.jsx)(R.Title,{children:a(`mcpAddServerModal.title`)}),(0,Z.jsx)(R.Description,{children:a(`mcpAddServerModal.description`)})]}),(0,Z.jsx)(R.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-name`,children:a(`mcpAddServerModal.serverNameLabel`)}),(0,Z.jsx)(z,{id:`mcp-name`,type:`text`,value:c,onChange:e=>l(e.target.value),placeholder:a(`mcpAddServerModal.namePlaceholder`),fullWidth:!0,autoFocus:!0})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-transport`,children:a(`mcpAddServerModal.transportLabel`)}),(0,Z.jsx)(`select`,{id:`mcp-transport`,value:u,onChange:e=>d(e.target.value),className:`w-full rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-default text-[var(--content-default)] outline-none focus:ring-2 focus:ring-[var(--ring)]`,children:s.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),k?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-command`,children:a(`mcpAddServerModal.commandLabel`)}),(0,Z.jsx)(z,{id:`mcp-command`,type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:a(`mcpAddServerModal.commandPlaceholder`),fullWidth:!0})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-args`,children:a(`mcpAddServerModal.argsLabel`)}),(0,Z.jsx)(z,{id:`mcp-args`,type:`text`,value:g,onChange:e=>_(e.target.value),placeholder:a(`mcpAddServerModal.argsPlaceholder`),fullWidth:!0})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-url`,children:a(`mcpAddServerModal.serverUrlLabel`)}),(0,Z.jsx)(z,{id:`mcp-url`,type:`url`,value:f,onChange:e=>p(e.target.value),placeholder:a(`mcpAddServerModal.urlPlaceholder`),fullWidth:!0})]}),(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-auth`,children:a(`mcpAddServerModal.authenticationLabel`)}),(0,Z.jsx)(`select`,{id:`mcp-auth`,value:v,onChange:e=>y(e.target.value),className:`w-full rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-default text-[var(--content-default)] outline-none focus:ring-2 focus:ring-[var(--ring)]`,children:o.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),v===`oauth`?(0,Z.jsx)(`p`,{className:`rounded-md border border-[var(--border-element)] bg-[var(--surface-base)] px-3 py-2 text-body-small-lighter text-[var(--content-tertiary)]`,children:a(`mcpAddServerModal.oauthHint`)}):null,v===`bearer`?(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-bearer`,children:a(`mcpAddServerModal.bearerTokenLabel`)}),(0,Z.jsx)(z,{id:`mcp-bearer`,type:`password`,value:b,onChange:e=>x(e.target.value),placeholder:a(`mcpAddServerModal.bearerPlaceholder`),fullWidth:!0})]}):null,v===`api-key`?(0,Z.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-apikey-header`,children:a(`mcpAddServerModal.headerNameLabel`)}),(0,Z.jsx)(z,{id:`mcp-apikey-header`,type:`text`,value:S,onChange:e=>C(e.target.value),placeholder:a(`mcpAddServerModal.apiKeyHeaderPlaceholder`),fullWidth:!0})]}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-apikey-value`,children:a(`mcpAddServerModal.apiKeyLabel`)}),(0,Z.jsx)(z,{id:`mcp-apikey-value`,type:`password`,value:w,onChange:e=>T(e.target.value),placeholder:a(`mcpAddServerModal.apiKeyPlaceholder`),fullWidth:!0})]})]}):null]})]})}),(0,Z.jsxs)(R.Footer,{children:[(0,Z.jsx)(r,{variant:`ghost`,onClick:D,disabled:i,children:a(`mcpAddServerModal.cancel`)}),(0,Z.jsx)(r,{variant:`primary`,onClick:O,disabled:!A||i,children:a(i?`mcpAddServerModal.adding`:`mcpAddServerModal.addServer`)})]})]})})}var Qt=[`none`,`bearer`,`api-key`];function $t(e,t){switch(e){case`none`:return t(`mcpServerDetailModal.authNone`);case`bearer`:return t(`mcpServerDetailModal.authBearerToken`);case`api-key`:return t(`mcpServerDetailModal.authApiKey`)}}function en({server:e,toolsSummary:t,toolsLoading:n=!1,toolsError:i=!1,readOnly:a=!1,onClose:o,onSave:s,isPending:c}){let{t:l}=K(`settings`),[u,d]=(0,X.useState)(`none`),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(`X-API-Key`),[g,_]=(0,X.useState)(``);(0,X.useEffect)(()=>{e&&(d(e.authType),p(``),h(e.authHeaderName??`X-API-Key`),_(``))},[e]);let v=(0,X.useCallback)(()=>{if(!e||a)return;let t=u!==e.authType,n=u===`bearer`&&f.trim()!==``,r=u===`api-key`&&m.trim()!==``&&g.trim()!==``,i=t||n||r,o;o=i?u===`none`?null:u===`bearer`&&f.trim()?{Authorization:`Bearer ${f.trim()}`}:u===`api-key`&&m.trim()&&g.trim()?{[m.trim()]:g.trim()}:void 0:void 0,s(e.id,{name:e.id,...o===void 0?{}:{headers:o}})},[e,u,f,m,g,s,a]),y=(0,X.useCallback)(()=>{c||o()},[c,o]);return e?(0,Z.jsx)(R.Root,{open:!!e,onOpenChange:e=>{e||y()},children:(0,Z.jsxs)(R.Content,{size:`lg`,children:[(0,Z.jsxs)(R.Header,{icon:We,children:[(0,Z.jsx)(R.Title,{children:e.id}),(0,Z.jsx)(R.Description,{children:l(`mcpServerDetailModal.description`,{transport:e.transport.type,status:e.status})})]}),(0,Z.jsx)(R.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[!a&&e.transport.type!==`stdio`?(0,Z.jsxs)(Z.Fragment,{children:[e.hasOAuth?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-[var(--border-element)] bg-[var(--surface-base)] px-3 py-2`,children:[(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:l(`mcpServerDetailModal.authentication`)}),(0,Z.jsx)(`span`,{className:`rounded-full bg-[var(--surface-lift)] px-2 py-0.5 text-label-small-default text-[var(--content-default)]`,children:l(`mcpServerDetailModal.oauthBadge`)}),(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.oauthManagedHint`)})]}):null,e.hasOAuth?null:(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-auth`,children:l(`mcpServerDetailModal.authentication`)}),(0,Z.jsx)(`select`,{id:`mcp-detail-auth`,value:u,onChange:e=>d(e.target.value),className:`w-full rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-default text-[var(--content-default)] outline-none focus:ring-2 focus:ring-[var(--ring)]`,children:Qt.map(e=>(0,Z.jsx)(`option`,{value:e,children:$t(e,l)},e))})]}),u===`bearer`&&!e.hasOAuth?(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-bearer`,children:l(`mcpServerDetailModal.bearerToken`)}),(0,Z.jsx)(z,{id:`mcp-detail-bearer`,type:`password`,value:f,onChange:e=>p(e.target.value),placeholder:e.hasStaticAuth&&e.authType===`bearer`?l(`mcpServerDetailModal.savedBearerPlaceholder`):l(`mcpServerDetailModal.bearerTokenPlaceholder`),fullWidth:!0})]}):null,u===`api-key`&&!e.hasOAuth?(0,Z.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-apikey-header`,children:l(`mcpServerDetailModal.headerName`)}),(0,Z.jsx)(z,{id:`mcp-detail-apikey-header`,type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:l(`mcpServerDetailModal.headerNamePlaceholder`),fullWidth:!0})]}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Z.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-apikey-value`,children:l(`mcpServerDetailModal.apiKey`)}),(0,Z.jsx)(z,{id:`mcp-detail-apikey-value`,type:`password`,value:g,onChange:e=>_(e.target.value),placeholder:e.hasStaticAuth&&e.authType===`api-key`?l(`mcpServerDetailModal.savedApiCredentialPlaceholder`):l(`mcpServerDetailModal.apiKeyPlaceholder`),fullWidth:!0})]})]}):null]}):null,e.transport.url||e.transport.command?(0,Z.jsxs)(`dl`,{className:`space-y-1 text-body-small-default`,children:[(0,Z.jsx)(`dt`,{className:`text-[var(--content-secondary)]`,children:e.transport.type===`stdio`?l(`mcpServerDetailModal.command`):l(`mcpServerDetailModal.endpoint`)}),(0,Z.jsx)(`dd`,{className:`text-[var(--content-tertiary)] [overflow-wrap:anywhere]`,children:e.transport.url??e.transport.command})]}):null,(0,Z.jsxs)(`section`,{className:`space-y-2`,children:[(0,Z.jsx)(`h3`,{className:`text-body-medium-default text-[var(--content-default)]`,children:l(`mcpServerDetailModal.toolsHeading`)}),n?(0,Z.jsx)(`p`,{role:`status`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.toolsLoading`)}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.toolsError`)}):t&&t.tools.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.tokenOverhead`,{count:t.estimatedTokens.toLocaleString()})}),(0,Z.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)] rounded-lg border border-[var(--border-base)]`,children:t.tools.map(e=>(0,Z.jsxs)(`li`,{className:`space-y-1 px-3 py-3`,children:[(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-default)] [overflow-wrap:anywhere]`,children:e.name}),e.description?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap text-body-small-default text-[var(--content-secondary)] [overflow-wrap:anywhere]`,children:e.description}):null,(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.toolEstimatedTokens`,{count:e.estimatedTokens.toLocaleString()})})]},e.name))})]}):(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:l(`mcpServerDetailModal.toolsEmpty`)})]})]})}),(0,Z.jsxs)(R.Footer,{children:[(0,Z.jsx)(r,{variant:a?`primary`:`ghost`,onClick:y,disabled:c,children:l(a?`mcpServerDetailModal.close`:`mcpServerDetailModal.cancel`)}),a?null:(0,Z.jsx)(r,{variant:`primary`,onClick:v,disabled:c,children:l(c?`mcpServerDetailModal.saving`:`mcpServerDetailModal.save`)})]})]})}):null}function tn({connections:e,allowAdd:t,attemptReportedElsewhere:n=!1}){let{t:i}=K(`settings`),{auth:a,add:o,save:s,remove:c,details:u,configureServer:d}=e;return(0,Z.jsxs)(Z.Fragment,{children:[a.attempt&&!n?(0,Z.jsx)(l,{tone:a.attempt.error?`warning`:`info`,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{className:`[overflow-wrap:anywhere]`,children:a.attempt.error??(a.attempt.phase===`connecting`?i(`mcpConnect.waitingForRuntime`,{name:a.attempt.displayName}):i(`mcpConnect.waitingForAuthorization`,{name:a.attempt.displayName}))}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a.attempt.phase===`error`?(0,Z.jsx)(r,{variant:`outlined`,onClick:a.retry,children:i(`mcpConnect.retry`)}):null,(0,Z.jsx)(r,{variant:`ghost`,onClick:a.stopWaiting,children:i(`mcpConnect.stopWaiting`)})]})]})}):null,t?(0,Z.jsx)(Zt,{open:e.addOpen,onClose:()=>e.setAddOpen(!1),onAdd:e.addCustom,isPending:o.isPending}):null,(0,Z.jsx)(en,{server:d,readOnly:d?.source===`plugin`,toolsSummary:u.data?.servers.find(e=>e.serverId===d?.id),toolsLoading:u.isFetching,toolsError:u.isError,onClose:()=>e.setConfigureServerId(null),onSave:(e,t)=>s.mutate(t),isPending:s.isPending}),(0,Z.jsx)(V,{open:e.removeServerId!==null,title:i(`mcpPage.removeDialogTitle`),message:e.removeServerId?i(`mcpPage.removeDialogMessage`,{serverId:e.removeServerId}):``,confirmLabel:i(`mcpPage.removeDialogConfirm`),destructive:!0,isPending:c.isPending,onConfirm:()=>{e.removeServerId&&c.mutate(e.removeServerId)},onCancel:()=>e.setRemoveServerId(null)})]})}function nn(e,t){let n=new Map(t.map(e=>[e.name,e]));return e.flatMap(e=>{let t=e.integration;if(t?.kind!==`mcp`)return[];let r=n.get(e.name);return[{pluginName:e.name,displayName:t.displayName,description:e.description??t.displayName,documentationUrl:t.documentationUrl,logo:t.logo,oauthProvider:t.oauthProvider,category:rt(t.category)??void 0,setup:t.setup,installed:r?{icon:r.icon,hasIcon:r.hasIcon,iconVersion:r.iconVersion}:void 0}]})}function rn(){return(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-8 shrink-0 items-center justify-center rounded-md bg-[var(--surface-base)] text-[var(--content-secondary)]`,children:(0,Z.jsx)(De,{size:20})})}function an({server:e,onRemove:t,onConfigure:n,onAuthenticate:i,onManagePlugin:a,isAuthenticating:o,connectDisabled:s=!1}){let{t:c}=K(`settings`),l=e.source===`plugin`,u=!l&&e.status===`needs-auth`&&e.transport.type!==`stdio`,d=!l&&!o&&!u,f=l?c(`mcpServerCard.managePlugin`):o?c(`mcpServerCard.connecting`):e.hasOAuth?c(`mcpServerCard.reconnect`):c(`mcpServerCard.finishConnecting`);return(0,Z.jsx)(Ct,{icon:(0,Z.jsx)(rn,{}),title:e.id,subtitle:l?e.pluginName:lt(e),status:e.status===`connected`?void 0:(0,Z.jsx)(T,{tone:`negative`,children:c(`mcpServerCard.statusNeedsAttention`)}),primaryAction:d?(0,Z.jsx)(r,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Pe,{}),"aria-label":c(`mcpServerCard.configureLabel`,{serverId:e.id}),onClick:()=>n(e.id)}):(0,Z.jsx)(r,{variant:u?`primary`:`outlined`,loading:o,onClick:()=>{l?a(e.pluginName):u&&i(e.id)},disabled:o||u&&s,children:f}),actionMenu:(0,Z.jsxs)(b.Root,{children:[(0,Z.jsx)(b.Trigger,{asChild:!0,children:(0,Z.jsx)(r,{variant:`ghost`,iconOnly:(0,Z.jsx)(Ce,{}),className:$,"aria-label":c(`mcpServerCard.moreActions`,{serverId:e.id})})}),(0,Z.jsxs)(b.Content,{title:e.id,showTitle:!0,closeLabel:c(`mcpServerCard.actionsSheetClose`),align:`end`,children:[u||l?(0,Z.jsx)(b.Item,{icon:Pe,label:c(l?`mcpServerCard.viewDetails`:`mcpServerCard.configure`),onSelect:()=>n(e.id)}):null,l?null:(0,Z.jsx)(b.Item,{icon:we,label:c(`mcpServerCard.removeServer`),tone:`destructive`,onSelect:()=>t(e.id)})]})]})})}function on({assistantId:e,definition:t}){let n=He(e,t.pluginName,t.installed?.hasIcon,t.installed?.iconVersion);return(0,Z.jsx)(Ue,{external:!0,icon:t.installed?.icon,iconSrc:n,iconUrl:ft(t)??void 0,size:`md`})}function sn({assistantId:e,method:t,disabled:n,onOpen:i}){let{t:a}=K(`settings`),o=ot([],[t]);return(0,Z.jsx)(Ct,{icon:(0,Z.jsx)(on,{assistantId:e,definition:t.definition}),title:t.definition.displayName,subtitle:t.definition.description,status:o.needsAttention?(0,Z.jsx)(T,{tone:`negative`,children:a(`integrationRow.needsAttention`)}):void 0,primaryAction:(0,Z.jsx)(r,{variant:`outlined`,className:$,iconOnly:(0,Z.jsx)(Pe,{}),"aria-label":a(`integrationRow.configureLabel`,{name:t.definition.displayName}),disabled:n,onClick:i})})}async function cn(e){let{data:t,response:n}=await B.get({url:`/v1/assistants/{assistant_id}/internal/mcp/list`,path:{assistant_id:e}});if(!n?.ok)throw Error(`Failed to fetch MCP servers: ${n?.status}`);return t}async function ln(e){let{data:t,response:n}=await B.get({url:`/v1/assistants/{assistant_id}/internal/mcp/tools-summary`,path:{assistant_id:e}});if(!n?.ok)throw Error(`Failed to fetch MCP tools summary: ${n?.status}`);return t}async function un(e,t){let{response:n}=await B.post({url:`/v1/assistants/{assistant_id}/internal/mcp/update`,path:{assistant_id:e},body:t});if(!n?.ok)throw Error(`Failed to update MCP server: ${n?.status}`)}async function dn(e,t){let{response:n}=await B.post({url:`/v1/assistants/{assistant_id}/internal/mcp/add`,path:{assistant_id:e},body:t});if(!n?.ok)throw Error(`Failed to add MCP server: ${n?.status}`)}async function fn(e,t){let{response:n}=await B.post({url:`/v1/assistants/{assistant_id}/internal/mcp/remove`,path:{assistant_id:e},body:{name:t}});if(!n?.ok)throw Error(`Failed to remove MCP server: ${n?.status}`)}async function pn(e,t){let{data:n,response:r}=await B.post({url:`/v1/assistants/{assistant_id}/internal/mcp/auth/start`,path:{assistant_id:e},body:{serverId:t}});if(!r?.ok)throw Error(`Failed to start MCP auth: ${r?.status}`);return n}async function mn(e,t){let{data:n,response:r}=await B.get({url:`/v1/assistants/{assistant_id}/internal/mcp/auth/status/${encodeURIComponent(t)}`,path:{assistant_id:e}});if(!r?.ok)throw Error(`Failed to poll MCP auth status: ${r?.status}`);return n}function hn(e,t){return e.some(e=>e.id===t&&e.status===`connected`)}function gn(e,t){return t?null:e}function _n(e){let{t}=K(`settings`),n=q(),[r,i]=(0,X.useState)(null),a=(0,X.useRef)(null),o=(0,X.useRef)(null),c=(0,X.useRef)(null),l=(0,X.useCallback)(()=>{a.current=null,c.current=null,o.current?.close(),o.current=null,i(null)},[]);(0,X.useEffect)(()=>(l(),()=>{a.current=null,c.current=null,o.current?.close(),o.current=null}),[e,l]);let d=r?.phase===`authorizing`||r?.phase===`waiting`,f=G({queryKey:C.auth(e,r?.operationId??``),queryFn:()=>mn(e,r.serverId),enabled:d,refetchInterval:d?L:!1,staleTime:0,gcTime:0,retry:1}),p=G({queryKey:C.list(e),queryFn:()=>cn(e),enabled:r?.phase===`connecting`,refetchInterval:r?.phase===`connecting`?L:!1,staleTime:0,retry:1});(0,X.useEffect)(()=>{!r||!d||a.current!==r.operationId||!f.data||(f.data.status===`complete`?(o.current?.close(),o.current=null,i({...r,phase:`connecting`}),n.invalidateQueries({queryKey:C.list(e)})):f.data.status===`error`&&i({...r,phase:`error`,error:f.data.error?.replaceAll(r.serverId,r.displayName)??t(`mcpConnect.authorizationFailed`)}))},[e,r,f.data,d,n,t]),(0,X.useEffect)(()=>{r?.phase!==`connecting`||a.current!==r.operationId||!p.data||p.isFetching||hn(p.data.servers,r.serverId)&&(l(),n.invalidateQueries({queryKey:C.details(e)}))},[e,r,n,p.data,p.isFetching,l]),(0,X.useEffect)(()=>{if(!r||r.phase===`error`)return;let e=d?gn(f.error,f.isFetching):r.phase===`connecting`?gn(p.error,p.isFetching):null;e&&(s(e,{context:`mcp.connect.poll`}),i({...r,phase:`error`,error:t(`mcpConnect.pollFailed`)}))},[r,f.error,f.isFetching,d,p.error,p.isFetching,t]),(0,X.useEffect)(()=>{if(!r||r.phase===`error`)return;let e=setTimeout(()=>{a.current===r.operationId&&(o.current?.close(),o.current=null,i(e=>e?.operationId===r.operationId?{...e,phase:`error`,error:t(`mcpConnect.timedOut`)}:e))},Math.max(0,r.startedAt+fe-Date.now()));return()=>clearTimeout(e)},[r,t]);let m=(0,X.useCallback)(t=>{a.current===t&&(i(e=>e?.operationId===t&&e.phase===`authorizing`?{...e,phase:`waiting`}:e),n.invalidateQueries({queryKey:C.auth(e,t)}),n.invalidateQueries({queryKey:C.list(e)}))},[e,n]);(0,X.useEffect)(()=>{let e=o.current;if(r?.phase!==`authorizing`||!e)return;let t=setInterval(()=>{e.closed&&m(r.operationId)},500);return()=>clearInterval(t)},[r?.operationId,r?.phase,m]),(0,X.useEffect)(()=>{let e=r?.operationId,t=r?.phase;if(!(!e||t===`connecting`||t===`error`))return y(()=>m(e))},[r?.operationId,r?.phase,m]);let h=(0,X.useCallback)((n,l,d=n)=>{if(a.current&&r?.phase!==`error`)return;let f=crypto.randomUUID();a.current=f,o.current?.close(),o.current=null,c.current=l?{operationId:f,run:l}:null;let p={operationId:f,serverId:n,displayName:d,startedAt:Date.now(),phase:`starting`};i(p);let m=he()||ie(),h=m?null:window.open(``,`_blank`,`width=500,height=600`);if(!m&&!h){i({...p,phase:`error`,error:t(`mcpConnect.popupBlocked`)});return}h&&(h.opener=null,o.current=h);let g=()=>a.current===f&&Date.now()<p.startedAt+3e5;(async()=>{try{let t=await l?.();if(c.current?.operationId===f&&(c.current=null),!g())return;if(t===null){h?.close(),o.current=null,a.current=null,i(null);return}let n=t?{...p,serverId:t}:p;t&&i(n);let r=await pn(e,n.serverId);if(!g())return;if(r.already_authenticated){h?.close(),o.current=null,i({...n,phase:`connecting`});return}let s=new URL(r.auth_url);if(s.protocol!==`https:`&&s.protocol!==`http:`)throw Error(`Unsupported MCP authorization URL protocol`);i({...n,phase:`authorizing`}),h?h.closed||h.location.replace(s.href):await u(s.href)}catch(e){h?.close(),g()&&(o.current=null,s(e,{context:`mcp.connect.start`}),i(e=>e?.operationId===f?{...e,phase:`error`,error:t(`mcpConnect.startFailed`)}:e))}})()},[e,r?.phase,t]);return{attempt:r,isBusy:!!(r&&r.phase!==`error`),connect:h,retry:()=>{r&&h(r.serverId,c.current?.run,r.displayName)},stopWaiting:l}}function vn(e){let{t}=K(`settings`),n=q(),r=_n(e),[i,a]=(0,X.useState)(!1),[o,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(null),p=G({queryKey:C.list(e),queryFn:()=>cn(e)}),m=p.data?.servers.find(e=>e.id===o)??null,h=G({queryKey:C.details(e),queryFn:()=>ln(e),enabled:m!==null||d!==null}),g=()=>{n.invalidateQueries({queryKey:C.list(e)}),n.invalidateQueries({queryKey:C.details(e)})},_=ge({mutationFn:t=>dn(e,t),onSuccess:()=>{g(),a(!1)},onError:e=>{s(e,{context:`mcp.add`}),H.error(t(`mcpConnect.addFailed`))}});return{list:p,details:h,auth:r,add:_,save:ge({mutationFn:t=>un(e,t),onSuccess:()=>{g(),c(null)},onError:e=>{s(e,{context:`mcp.update`}),H.error(t(`mcpConnect.saveFailed`))}}),remove:ge({mutationFn:t=>fn(e,t),onSuccess:(e,n)=>{r.attempt?.serverId===n&&r.stopWaiting(),g(),u(null),c(null),H.success(t(`mcpPage.toastRemoved`,{serverId:n}))},onError:(e,n)=>{s(e,{context:`mcp.remove`}),H.error(t(`mcpPage.toastRemoveFailed`,{serverId:n}))}}),addCustom:e=>{e.autoAuth?r.connect(e.name,async()=>{await _.mutateAsync(e)},e.name):_.mutate(e)},addOpen:i,setAddOpen:a,configureServer:m,configureServerId:o,setConfigureServerId:c,removeServerId:l,setRemoveServerId:u,toolsServerId:d,setToolsServerId:f}}var yn={productivity:`integrationsPage.categories.productivity`,communication:`integrationsPage.categories.communication`,meetings:`integrationsPage.categories.meetings`,sales:`integrationsPage.categories.sales`,marketing:`integrationsPage.categories.marketing`,finance:`integrationsPage.categories.finance`,commerce:`integrationsPage.categories.commerce`,engineering:`integrationsPage.categories.engineering`,knowledge:`integrationsPage.categories.knowledge`,recruiting:`integrationsPage.categories.recruiting`},bn=`grid gap-3 [grid-template-columns:repeat(auto-fill,minmax(min(100%,22rem),1fr))]`,xn=`grid gap-3 [grid-template-columns:repeat(auto-fill,minmax(min(100%,15rem),1fr))]`;function Sn({title:e,count:t,gridClassName:n,children:r}){return(0,Z.jsxs)(`section`,{className:`space-y-3`,children:[(0,Z.jsxs)(`h2`,{className:`flex items-center gap-2 text-title-small text-[var(--content-default)]`,children:[e,(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:t})]}),(0,Z.jsx)(`div`,{className:n,children:r})]})}function Cn(e,t){return{denied:e(`integrationsPage.oauthErrorDenied`),state_invalid:e(`integrationsPage.oauthErrorStateInvalid`),state_expired:e(`integrationsPage.oauthErrorStateExpired`),exchange_failed:e(`integrationsPage.oauthErrorExchangeFailed`),identity_failed:e(`integrationsPage.oauthErrorIdentityFailed`)}[t]}function wn({mcpAssistantId:e}){let{t:n}=K(`settings`),[i,a]=ve(),f=be(),p=ye(),m=re(),_=se(),v=D.use.mcpAddServer(),y=D.use.hasHydrated(),[b,x]=(0,X.useState)(null),[S,C]=(0,X.useState)(!0),[w,T]=(0,X.useState)(``),[E,O]=(0,X.useState)(null),k=i.get(`provider`),A=(0,X.useRef)(null),j=vn(e),P=Ve(e),F=Gt({assistantId:e,mcp:j});(0,X.useEffect)(()=>{let t=!0;return(async()=>{try{let n=await c(e);t&&n.ok&&x(n.data)}catch(e){s(e,{context:`integrations.getAssistant`})}finally{t&&C(!1)}})(),()=>{t=!1}},[e]);let{login:I}=d(`${p.pathname}${p.search}${p.hash}`),ee=(0,X.useCallback)(()=>void I(),[I]),te=F.closeModal,ne=F.cancel,L=F.attemptItemId,R=F.modal?.itemId??null,ie=j.setToolsServerId,ae=(0,X.useCallback)(()=>{if(R!==null&&L===R&&ne(),te(),ie(null),!i.has(`provider`))return;let e=new URLSearchParams(i);e.delete(`provider`),a(e,{replace:!0})},[ne,L,te,R,i,a,ie]),{platformAssistantId:oe,isLoading:B,error:ce}=h(b?.id,m===`full`),ue=G({...t({path:{assistant_id:b?.id??``}}),select:e=>e.providers,enabled:!!b}),V=G({...N({path:{assistant_id:oe??``}}),enabled:!!oe&&m===`full`});(0,X.useEffect)(()=>{let e=i.get(`oauth_status`);if(!e)return;let t=i.get(`oauth_provider`),r=t?t.charAt(0).toUpperCase()+t.slice(1):null;e===`connected`?H.success(r?n(`integrationsPage.accountConnectedToast`,{providerLabel:r}):n(`integrationsPage.accountConnectedToastGeneric`)):e===`error`&&H.error(Cn(n,i.get(`oauth_code`)??`unknown`)??(r?n(`integrationsPage.connectFailedToast`,{providerLabel:r}):n(`integrationsPage.connectFailedToastGeneric`))),f(le.settings.integrations,{replace:!0})},[i,f,n]);let de=ue.isError||V.isError||!!ce||!S&&!b,fe=!de&&!!ue.data&&(m!==`full`||!!V.data),U=(0,X.useMemo)(()=>ut(fe?ue.data??[]:[],fe?V.data??[]:[],j.list.data?.servers??[],P.installedLoaded?nn(P.catalogMatches,P.installedPlugins):[],j.list.isSuccess),[fe,ue.data,V.data,j.list.data,j.list.isSuccess,P.installedLoaded,P.catalogMatches,P.installedPlugins]),pe=(0,X.useMemo)(()=>{let e=new Map;for(let t of U)t.category&&e.set(t.category,(e.get(t.category)??0)+1);return Ge.flatMap(t=>{let n=e.get(t);return n?[{category:t,count:n}]:[]})},[U]),W=pe.some(e=>e.category===E)?E:null,me=(0,X.useMemo)(()=>dt(U,w,W),[U,w,W]),he=(0,X.useMemo)(()=>{let e=new Map;for(let t of U){if(t.kind===`mcp`)continue;let n=vt(t,{platformGate:m,ownOAuthAvailable:!_,mcpServersLoaded:j.list.isSuccess});n&&e.set(t.id,n)}return e},[U,_,j.list.isSuccess,m]),ge=e=>he.has(e.id)&&(!e.configured||e.id===L&&F.modal?.itemId!==e.id),_e=e=>!e.configured||ge(e),q=me.filter(e=>!_e(e)),xe=me.filter(_e).sort((e,t)=>e.name.localeCompare(t.name)||e.id.localeCompare(t.id)),Se=S||ue.isLoading||V.isLoading||B||j.list.isLoading||(P.isLoading||P.catalogLoading)&&U.length===0,Ce=j.auth.isBusy||F.managed!==null,we=S||!b||m===`full`&&!oe,Te=F.ownsMcpAttempt&&L!==null&&(F.modal?.itemId===L||me.some(e=>e.id===L&&ge(e))),J=F.modal?U.find(e=>e.id===F.modal?.itemId):void 0,Y=J?he.get(J.id):void 0,De=J?.kind===`oauth`?J.provider:void 0,Oe=M(De?.provider_key??``,De?.tenant_host),Ae=F.openModal;(0,X.useEffect)(()=>{if(!k){A.current=null;return}if(k===A.current)return;let e=U.find(e=>e.kind===`oauth`&&e.provider.provider_key===k);e&&(A.current=k,Ae(e.id))},[U,Ae,k]);let je=j.toolsServerId,Me=j.list.data?.servers.find(e=>e.id===je),Ne=Y&&je?bt(Y).find(e=>e.serverId===je):void 0,Pe=Ne?{[Ne.id]:{loading:j.details.isFetching,error:j.details.isError,summary:j.details.data?.servers.find(e=>e.serverId===je),endpointUrl:Me?.transport.url}}:void 0,Fe=Kt({assistantId:e,platformAssistantId:oe,onStopAuth:e=>{let t=j.auth.attempt?.serverId;if(!t)return;let n=e.pluginName!==void 0&&(t===$e(e.pluginName)||j.list.data?.servers.find(e=>e.id===t)?.pluginName===e.pluginName);(t===e.serverId||n)&&j.auth.stopWaiting()},onRemoveServer:j.setRemoveServerId,onPluginRemoved:()=>void j.list.refetch()}),Ie=()=>{v?j.setAddOpen(!0):g(f,{prompt:n(`mcpPage.setupPrompt`)})},Le=t=>{let n=t.kind===`mcp`?void 0:he.get(t.id);return t.kind!==`mcp`&&n&&ge(t)?(0,Z.jsx)(Pt,{plan:n,state:F.stateFor(t.id,n.name),showAlternatives:!_,disabled:F.isBusyElsewhere(t.id)||n.primary.kind===`managed-oauth`&&we,onConnect:e=>F.start(t,n,e),onLogin:ee,onCancel:F.cancel,onRetry:F.retry,onOpenSetupGuide:e=>void u(e)},t.id):t.kind===`oauth`?(0,Z.jsx)(Nt,{providerKey:t.provider.provider_key,displayName:t.name,description:t.provider.description,logoUrl:t.provider.logo_url,connections:t.connections,mcpMethods:t.methods,disabled:we||!n||F.isBusyElsewhere(t.id),onConfigure:()=>F.openModal(t.id)},t.id):t.kind===`plugin`?(0,Z.jsx)(sn,{assistantId:e,method:t.method,disabled:!n||F.isBusyElsewhere(t.id),onOpen:()=>F.openModal(t.id)},t.id):(0,Z.jsx)(an,{server:t.server,onRemove:j.setRemoveServerId,onConfigure:j.setConfigureServerId,onAuthenticate:e=>j.auth.connect(e),onManagePlugin:e=>f(e?`${le.plugins}/${encodeURIComponent(e)}`:le.plugins),isAuthenticating:j.auth.attempt?.serverId===t.server.id&&Ce,connectDisabled:Ce},t.id)};return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{value:w,onChange:e=>T(e.target.value),placeholder:n(`integrationsPage.searchPlaceholder`),"aria-label":n(`integrationsPage.searchAriaLabel`),leftIcon:(0,Z.jsx)(Re,{"aria-hidden":!0,className:`size-4`}),className:`min-h-11`,wrapperClassName:`min-w-0 basis-64 flex-1`,fullWidth:!0}),(0,Z.jsx)(r,{variant:`outlined`,className:`min-h-11 max-w-full whitespace-normal`,leftIcon:(0,Z.jsx)(Ee,{}),onClick:Ie,disabled:!y||Ce,children:n(`integrationsPage.addCustom`)})]}),pe.length>0?(0,Z.jsx)(`div`,{role:`group`,"aria-label":n(`integrationsPage.categoriesLabel`),className:`flex gap-2 overflow-x-auto pb-1 [scrollbar-width:none]`,children:pe.map(e=>(0,Z.jsx)(o,{selected:W===e.category,count:e.count,onClick:()=>O(W===e.category?null:e.category),children:n(yn[e.category])},e.category))}):null]}),de?(0,Z.jsx)(l,{tone:`warning`,children:n(`integrationsPage.oauthUnavailable`)}):null,j.list.isError?(0,Z.jsx)(l,{tone:`warning`,actions:(0,Z.jsx)(r,{variant:`ghost`,onClick:()=>void j.list.refetch(),children:n(`mcpConnect.retry`)}),children:n(`integrationsPage.mcpUnavailable`)}):null,P.catalogError||P.isError?(0,Z.jsx)(l,{tone:`warning`,children:n(`integrationsPage.pluginCatalogUnavailable`)}):null,(0,Z.jsx)(tn,{connections:j,allowAdd:v,attemptReportedElsewhere:Te}),F.managed&&b?(0,Z.jsx)(Bt,{assistantId:b.id,providerKey:F.managed.providerKey,providerLabel:F.managed.providerLabel,tenantHost:F.managed.tenantHost,restartToken:F.managed.restartToken,onReport:F.onManagedReport},F.managed.providerKey):null,Se?(0,Z.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(ke,{className:`size-4 animate-spin`}),n(`integrationsPage.loading`)]}):null,q.length>0?(0,Z.jsx)(Sn,{title:n(`integrationsPage.sectionConfigured`),count:q.length,gridClassName:bn,children:q.map(Le)}):null,xe.length>0?(0,Z.jsx)(Sn,{title:n(`integrationsPage.sectionAvailable`),count:xe.length,gridClassName:xn,children:xe.map(Le)}):null,!Se&&me.length===0?(0,Z.jsx)(`p`,{className:`py-8 text-center text-body-medium-default text-[var(--content-tertiary)]`,children:w.trim()?n(`integrationsPage.emptySearchSubtitle`,{query:w.trim()}):W?n(`integrationsPage.emptyCategory`,{category:n(yn[W])}):n(`integrationsPage.empty`)}):null,F.modal&&Y&&J&&J.kind!==`mcp`?(0,Z.jsx)(Tt,{plan:Y,focusMethodId:F.modal.methodId,attempt:F.attemptFor(J.id),tenantHost:Oe,toolsByConnectionId:Pe,ownOAuthContent:b&&J.kind===`oauth`?(0,Z.jsx)(Ut,{assistantId:b.id,providerKey:J.provider.provider_key,displayName:J.name,logoUrl:J.provider.logo_url}):null,onConnect:(e,t)=>F.run(J,Y,e,t),onLogin:ee,onCancelAttempt:F.cancel,onRetryAttempt:F.retry,onReconnect:e=>F.reconnect(J,Y,e),onOpenTools:e=>j.setToolsServerId(e.serverId??null),onDisconnect:e=>Fe(e,Y.name),onOpenSetupGuide:e=>void u(e),onClose:ae},J.id):null]})}function Tn(){let e=ue();return(0,Z.jsx)(X.Suspense,{children:(0,Z.jsx)(wn,{mcpAssistantId:e},e)})}export{Tn as IntegrationsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{AC as t,BC as n,To as r,Yl as i,Zx as a,fS as o,mS as s,o as c,uS as l}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{AC as t,BC as n,To as r,Yl as i,Zx as a,fS as o,mS as s,o as c,uS as l}from"./app-XG_RF2yi.js";import{E as u}from"./vendor-DwMhK7fD.js";import{d,f,i as p,n as m,t as h,x as g}from"./react-B9IgSVeK.js";import{Ki as _,za as v}from"./icons-C0wyat6T.js";import{t as y}from"./intelligence-layout-slots-store-DTzofJ6x.js";import{n as b}from"./list-detail-navigation-ChFNCRwF.js";var x=e(g(),1),S=h();function C({children:e}){return(0,S.jsx)(t,{variant:`body-medium-default`,className:`max-w-[50vw] truncate text-[var(--content-secondary)]`,children:e})}function w({ariaLabel:e,tooltip:t,to:r,onClick:i}){return(0,S.jsx)(n,{shape:`pill`,variant:`ghost`,iconOnly:(0,S.jsx)(v,{"aria-hidden":!0}),className:`max-md:bg-[var(--surface-active)]`,"aria-label":e,tooltip:t,...r==null?{onClick:i}:{asChild:!0,children:(0,S.jsx)(m,{to:r})}})}var T={schedules:`sections.schedules`,superpowers:`sections.superpowers`,plugins:`sections.superpowers`,skills:`sections.superpowers`,memory:`sections.memory`,library:`sections.library`,workspace:`sections.workspace`,contacts:`sections.contacts`,channels:`sections.channels`};function E(){let{t:e}=u(`intelligence`),t=a.use.name(),{pathname:n,state:h}=d(),g=f(),v=i(),E=r.use.setTopBarCenter(),D=r.use.setMobileTopBar(),O=y.use.headerTrailing(),k=y.use.headerTitle(),A=y.use.detailIsScreen(),j=l(n),M=j?e(T[j.key]):null,N=M??(o(n,s.personality)?e(`identitySections.personality.label`):null),P=v&&N!=null,F=P&&A&&j!=null&&!o(n,j.to)?j.to:null,I=t||e(`identityOverview.defaultAssistantName`),L=e(`intelligenceLayout.backToAriaLabel`,{name:I}),R=e(`intelligenceLayout.backToTitle`,{name:I});return(0,x.useEffect)(()=>{if(P&&N){let t=F==null?{ariaLabel:L,tooltip:R,to:s.identity}:{ariaLabel:e(`intelligenceLayout.backToAriaLabel`,{name:N}),tooltip:e(`intelligenceLayout.backToTitle`,{name:N}),onClick:()=>b(g,h,F)};E(null),D({leading:(0,S.jsx)(w,{...t}),center:k??(0,S.jsx)(C,{children:N}),trailing:O})}else D(null),E(null);return()=>{D(null),E(null)}},[L,R,F,O,k,N,g,P,D,E,h,e]),j?(0,S.jsxs)(c,{className:j.key===`workspace`?`max-md:rounded-none max-md:border-0 max-md:px-3.5 max-md:pt-0 max-md:pb-3.5`:void 0,style:j.key===`workspace`?{backgroundColor:`var(--surface-base)`}:void 0,children:[P?null:(0,S.jsxs)(`div`,{className:`mb-4 flex shrink-0 items-center gap-1.5`,children:[(0,S.jsx)(m,{to:s.identity,className:`-ml-2 flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors outline-none hover:bg-[var(--surface-hover)] hover:text-[var(--content-default)] focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,"aria-label":L,title:R,children:(0,S.jsx)(_,{className:`h-5 w-5`,"aria-hidden":!0})}),k??(0,S.jsx)(`h1`,{className:`text-title-large text-[var(--content-default)]`,children:M}),O?(0,S.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center`,children:O}):null]}),(0,S.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:(0,S.jsx)(p,{})})]}):(0,S.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,S.jsx)(p,{})})}export{E as IntelligenceLayout};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{WS as e}from"./app-
|
|
1
|
+
import{WS as e}from"./app-XG_RF2yi.js";import{J as t}from"./vendor-DwMhK7fD.js";var n=e(t(e=>({headerTitle:null,headerTrailing:null,detailIsScreen:!1,setHeaderTitle:t=>e({headerTitle:t}),setHeaderTrailing:t=>e({headerTrailing:t}),setDetailIsScreen:t=>e({detailIsScreen:t})})));export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{mS as t}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{mS as t}from"./app-XG_RF2yi.js";import{f as n,x as r}from"./react-B9IgSVeK.js";var i=e(r(),1);function a(){let e=n();return(0,i.useEffect)(()=>{e(t.settings.keyboardShortcuts,{replace:!0})},[e]),null}export{a as KeyboardShortcutsRedirectPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{mg as e,ov as t}from"./app-
|
|
1
|
+
import{mg as e,ov as t}from"./app-XG_RF2yi.js";var n=2;function r({processing:e,sawProcessing:t,hasReply:r,stableReads:i}){return e===void 0?r&&i>=n:!e&&(r||t)}var i=e=>Math.max(0,Math.min(100,Math.round(e)));function a(e,n,r){let a=t=>i(e[t]??50),o=a(t.companionCoworker),s=a(t.executeCollaborate),c=a(t.playfulSerious),l=a(t.politeUnfiltered),u=n?.trim()||`The user`,d=r?.trim(),f=d?`Your name is ${d}. Write exactly \`- **Name:** ${d}\` in IDENTITY.md — do not rename yourself or invent a different name, even if the file currently shows a placeholder or a different name. This changes your personality, not who you are.`:"Keep your existing name exactly as it is — this changes your personality, not who you are. Do not rename yourself, and if your name is already set, carry it through verbatim (don't treat it as a placeholder to fill). Whatever the name ends up being, keep it on IDENTITY.md's `- **Name:** …` line.";return`<system-message>
|
|
2
2
|
${u} wants to customize your personality.
|
|
3
3
|
This is what they want you to be:
|
|
4
4
|
Companion (0-100): ${100-o}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Fr as t,Hh as n,Jl as r,Pr as i,Yl as a,_r as o,mS as s,nt as c,v as l,yv as u}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Fr as t,Hh as n,Jl as r,Pr as i,Yl as a,_r as o,mS as s,nt as c,v as l,yv as u}from"./app-XG_RF2yi.js";import{E as d}from"./vendor-DwMhK7fD.js";import{d as f,f as p,h as m,t as h,x as g}from"./react-B9IgSVeK.js";import{Yn as _}from"./icons-C0wyat6T.js";import{t as v}from"./deploy-dialogs-HsxdyBbf.js";import{t as y}from"./use-edge-swipe-back-BCvtCYFp.js";import{t as b}from"./app-types-Cp5xNgLa.js";var x=e(g(),1),S=h();function C({enabled:e}){return e?(0,S.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-y-0 left-0 z-10`,style:{width:20}}):null}function w(){let{t:e}=d(`library`),{appId:h}=m(),g=c(),w=p(),{pathname:T}=f(),E=a(),D=i.use.isDeploying(),O=(0,x.useRef)(null),[k,A]=(0,x.useState)(null),[j,M]=(0,x.useState)(null),[N,P]=(0,x.useState)(!1),F=(0,x.useRef)(null);(0,x.useEffect)(()=>{if(h)return F.current=h,A(null),M(null),u({path:{assistant_id:g,id:h},throwOnError:!0}).then(({data:e})=>{F.current===h&&(n(g,e.appId,e.html),A({assistantId:g,appId:e.appId,dirName:e.dirName,name:e.name,html:e.html,origin:e.origin}))}).catch(e=>{F.current===h&&M(e instanceof Error?e.message:`Failed to open app`)}),()=>{F.current=null}},[g,h]);let I=(0,x.useCallback)(()=>{w(s.library.root)},[w]),L=(0,x.useCallback)(e=>{w(e)},[w]);y({containerRef:O,onBack:I,enabled:E,navKey:T,prefetchHref:s.library.root});let R=l(),z=(0,x.useCallback)(()=>{k&&R(k)},[k,R]),B=(0,x.useCallback)(async()=>{if(!(!k||N)){P(!0);try{await t(g,{id:k.appId,name:k.name},{exported:e(`libraryAppCard.exported`),failed:e(`libraryAppCard.shareFailed`)})}finally{P(!1)}}},[g,k,N,e]),V=(0,x.useCallback)(()=>{k&&i.getState().deployApp(g,k.appId,k.name,k.html)},[g,k]),H=(0,x.useCallback)(e=>{r(w,{prompt:e})},[w]);return h?j?(0,S.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-4`,children:[(0,S.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:j}),(0,S.jsx)(`button`,{type:`button`,onClick:I,className:`text-body-medium-default text-[var(--primary-base)] underline`,children:e(`libraryDetailPage.backToLibrary`)})]}):k?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{ref:O,className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,S.jsx)(C,{enabled:E}),(0,S.jsx)(o,{appId:k.appId,appName:k.name,html:k.html,assistantId:g,onClose:I,onNavigateAppRoute:L,...b(k.origin)?{}:{onEdit:z,onShare:B,isSharing:N,onDeploy:V,isDeploying:D},enableFullscreen:!0})]}),(0,S.jsx)(v,{assistantId:g,onStartConversation:H})]}):(0,S.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,S.jsx)(_,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`})}):null}export{w as LibraryDetailPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{BC as t,CS as n,Dp as r,Ep as i,Ht as a,Jl as o,MC as s,Pr as c,Tp as l,Vh as u,Yi as d,Yl as f,bv as p,do as m,fc as h,gC as g,ip as _,jg as v,l as y,mS as b,ns as x,nt as S,qo as C,rp as w,sC as T,u as E,un as D,uo as O,vr as k,wa as A,yr as j}from"./app-g1TvV-Dl.js";import{$n as M,E as N,Xn as P,nr as F}from"./vendor-DwMhK7fD.js";import{d as I,f as L,t as R,x as z}from"./react-B9IgSVeK.js";import{$r as B,A as V,At as H,Br as U,Cr as W,Ht as G,Ia as K,Ur as ee,Vt as q,ir as J,ri as te,tr as ne,vt as Y}from"./icons-C0wyat6T.js";import{t as re}from"./deploy-dialogs-Daud7Ibu.js";import{t as ie}from"./intelligence-layout-slots-store-DfpF-AiU.js";import{n as ae,r as oe,t as se}from"./use-app-delete-BqUAzWOi.js";import{t as ce}from"./app-types-Cp5xNgLa.js";var X=e(z(),1),Z=R();function le(e){return e===1?`1 word`:`${e} words`}function ue({document:e,onOpen:t}){return(0,Z.jsxs)(`div`,{className:`group relative flex flex-col gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:C(`relative flex w-full cursor-pointer flex-col items-center justify-center gap-2 overflow-hidden rounded-xl border border-[var(--border-base)] bg-[var(--surface-base)]`,`aspect-[16/10]`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:[(0,Z.jsx)(U,{size:34,className:`text-[var(--content-tertiary)]`}),(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:le(e.wordCount)})]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:`flex cursor-pointer flex-col gap-0.5 rounded-sm px-0.5 text-left outline-none keyboard-focus:ring-2 keyboard-focus:ring-inset keyboard-focus:ring-[var(--ring)]`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:e.title}),(0,Z.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:a(new Date(e.updatedAt))})]})]})}function de({onNewConversation:e}){let{t:n}=N(`library`);return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4 py-24`,children:[(0,Z.jsx)(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-xl bg-[var(--surface-base)]`,children:(0,Z.jsx)(J,{size:32,className:`text-[var(--content-tertiary)]`})}),(0,Z.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:n(`libraryEmptyState.heading`)}),(0,Z.jsx)(`p`,{className:`max-w-md text-center text-body-medium-lighter text-[color:var(--content-tertiary)]`,children:n(`libraryEmptyState.body`)}),e?(0,Z.jsx)(t,{variant:`primary`,size:`regular`,onClick:e,children:n(`libraryEmptyState.newConversation`)}):null]})}function fe({app:e,assistantId:t,isPinned:n,onOpen:r,onPin:i,onDelete:o,onDeploy:s,justImported:c,onAnimationEnd:l}){let{t:d}=N(`library`),f=ce(e.origin),p=f?void 0:o,m=f?void 0:s,h=(0,X.useCallback)(()=>u(t,e.id,e.updatedAt),[t,e.id,e.updatedAt]),g=ae(t,e,{exported:d(`libraryAppCard.exported`),failed:d(`libraryAppCard.shareFailed`)}),[_,v]=(0,X.useState)(!1),[y,b]=(0,X.useState)(!1),x=(0,X.useCallback)(()=>b(!0),[]),{deployedUrl:S}=j(t,e.id,{enabled:y&&m!=null}),w=(0,X.useCallback)(()=>{S!=null&&k(S)},[S]);return(0,Z.jsx)(A,{trailingActions:[{id:`pin`,label:d(n?`libraryAppCard.unpin`:`libraryAppCard.pin`),icon:n?G:q,onSelect:()=>i(e)},...p?[{id:`delete`,label:d(`libraryAppCard.delete`),icon:V,variant:`destructive`,onSelect:()=>p(e)}]:[]],className:`rounded-xl`,children:(0,Z.jsxs)(`div`,{"data-reveal-row":``,className:C(`relative flex flex-col gap-2`,c&&`animate-[card-entrance_400ms_ease-out]`),onAnimationEnd:c?l:void 0,onPointerEnter:x,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:C(`relative w-full cursor-pointer overflow-hidden rounded-xl`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:(0,Z.jsx)(D,{name:e.name,icon:e.icon,loadHtml:h})}),(0,Z.jsx)(`div`,{"data-reveal":``,className:`absolute right-2 top-2 z-20`,children:(0,Z.jsx)(pe,{appName:e.name,isPinned:n,open:_,onOpenChange:e=>{e&&x(),v(e)},onPin:()=>i(e),onDelete:p?()=>p(e):void 0,onShare:f?void 0:g,onDeploy:m,deployedUrl:S,onCopyDeployedLink:w})}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`flex cursor-pointer flex-col gap-0.5 rounded-sm px-0.5 text-left outline-none keyboard-focus:ring-2 keyboard-focus:ring-inset keyboard-focus:ring-[var(--ring)]`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)] max-md:text-body-medium-lighter max-md:text-[color:var(--content-secondary)]`,children:e.name}),(0,Z.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)] max-md:hidden`,children:a(new Date(e.createdAt))})]})]})})}function pe({appName:e,isPinned:n,open:r,onOpenChange:i,onPin:a,onDelete:o,onShare:c,onDeploy:l,deployedUrl:u,onCopyDeployedLink:d}){let{t:f}=N(`library`),p=u!=null&&u!==``&&d!=null,m=f(`libraryAppCard.actionsTitle`,{appName:e});return(0,Z.jsxs)(s.Root,{open:r,onOpenChange:i,children:[(0,Z.jsx)(s.Trigger,{asChild:!0,children:(0,Z.jsx)(t,{variant:`primary`,size:`compact`,iconOnly:(0,Z.jsx)(B,{}),"aria-label":m,onClick:e=>e.stopPropagation()})}),(0,Z.jsxs)(s.Content,{title:m,children:[(0,Z.jsx)(s.Item,{icon:n?G:q,label:f(n?`libraryAppCard.unpin`:`libraryAppCard.pin`),onSelect:a}),c?(0,Z.jsx)(s.Item,{icon:K,label:f(`libraryAppCard.share`),description:f(`libraryAppCard.shareSub`),onSelect:c}):null,l&&p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s.Item,{icon:ne,label:f(`libraryAppCard.deployed`),description:(0,Z.jsx)(`span`,{className:`break-all`,children:u}),trailing:f(`libraryAppCard.copyLink`),onSelect:()=>d?.()}),(0,Z.jsx)(s.Item,{icon:H,label:f(`libraryAppCard.redeploy`),description:f(`libraryAppCard.redeploySub`),onSelect:l})]}):l?(0,Z.jsx)(s.Item,{icon:W,label:f(`libraryAppCard.deploy`),description:f(`libraryAppCard.deploySub`),onSelect:l}):null,o?(0,Z.jsx)(s.Item,{icon:V,label:f(`libraryAppCard.delete`),tone:`destructive`,onSelect:o}):null]})]})}function Q({title:e,apps:t,assistantId:n,pinnedAppIds:r,lastImportedAppId:i,onOpen:a,onPin:o,onDelete:s,onDeploy:c,onAnimationEnd:l}){return t.length===0?null:(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)] max-md:sr-only`,children:e}),(0,Z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6 [--swipe-item-surface:var(--surface-base)] max-md:[--swipe-item-surface:var(--surface-overlay)]`,children:t.map(e=>(0,Z.jsx)(fe,{app:e,assistantId:n,isPinned:r.has(e.id),onOpen:a,onPin:o,onDelete:s,justImported:e.id===i,onAnimationEnd:l,onDeploy:c?()=>c(e.id):void 0},e.id))})]})}var $=(e,t)=>t.updatedAt-e.updatedAt||t.createdAt-e.createdAt;function me(e){let{pinnedAppIds:t}=d(e),{data:n=[],isLoading:r,error:a}=M({...w({path:{assistant_id:e}}),select:e=>e.apps}),{data:o=[],isLoading:s,error:c}=M({...i({path:{assistant_id:e}}),select:e=>e.documents}),l=r||s,u=a&&c?a instanceof Error?a.message:`Failed to load library`:null,[f,p]=(0,X.useState)(``),m=(0,X.useMemo)(()=>{if(!f.trim())return n;let e=f.toLowerCase();return n.filter(t=>t.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[n,f]);return{apps:n,documents:o,filteredApps:m,pinnedApps:(0,X.useMemo)(()=>m.filter(e=>t.has(e.id)).sort($),[m,t]),recentApps:(0,X.useMemo)(()=>m.filter(e=>!t.has(e.id)).sort($),[m,t]),filteredDocuments:(0,X.useMemo)(()=>{if(!f.trim())return o;let e=f.toLowerCase();return o.filter(t=>t.title.toLowerCase().includes(e))},[o,f]),searchText:f,setSearchText:p,loading:l,error:u}}async function he(e,t){let{data:n,error:r,response:i}=await p({path:{assistant_id:e},body:t,bodySerializer:e=>e,headers:{"Content-Type":`application/octet-stream`},throwOnError:!1});if(!i||!i.ok){let e=(r&&typeof r==`object`&&`message`in r?r.message:null)??`Failed to import app.`;throw Error(e)}return n}function ge({assistantId:e,assistantName:n,onNewConversation:r,onOpenDocument:i,onNewDocument:a,isCreatingDocument:o=!1,onOpenApp:s}){let{t:l}=N(`library`),p=f(),m=F(),{togglePin:h,pinnedAppIds:v}=d(e),y=c.use.isDeploying(),{apps:b,documents:S,filteredApps:C,pinnedApps:w,recentApps:E,filteredDocuments:D,searchText:O,setSearchText:k,loading:A,error:j}=me(e),{pendingDelete:M,isDeleting:P,requestDelete:I,confirmDelete:L,cancelDelete:R}=se(e),[z]=(0,X.useState)(()=>x()?void 0:`.vellum`),B=(0,X.useRef)(null),[V,H]=(0,X.useState)(!1),U=(0,X.useCallback)(async t=>{let n=t.target.files?.[0];if(!(!n||V)){H(!0);try{let t=await he(e,n);await m.invalidateQueries({queryKey:_({path:{assistant_id:e}})}),T.success(l(`libraryView.imported`,{name:t.name})),s(t.appId)}catch(e){T.error(e instanceof Error?e.message:l(`libraryView.importFailed`))}finally{H(!1),B.current&&(B.current.value=``)}}},[e,V,m,s,l]),W=(0,X.useCallback)(async t=>{if(y)return;let n=b.find(e=>e.id===t)?.name??`this app`;try{let r=await u(e,t);c.getState().deployApp(e,t,n,r)}catch{c.getState().deployApp(e,t,n,``)}},[e,y,b]),G=(0,X.useCallback)(e=>h(e.id),[h]),K=ie.use.setHeaderTrailing(),q=!A&&!j;if((0,X.useEffect)(()=>{if(!q){K(null);return}let e=(0,Z.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}),n=V?e:(0,Z.jsx)(te,{"aria-hidden":!0}),r=o?e:(0,Z.jsx)(ee,{"aria-hidden":!0});return K(p?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(t,{shape:`pill`,variant:`ghost`,iconOnly:n,"aria-label":l(`libraryView.import`),tooltip:l(`libraryView.import`),className:`max-md:bg-[var(--surface-active)]`,onClick:()=>B.current?.click(),disabled:V}),a?(0,Z.jsx)(t,{shape:`pill`,variant:`ghost`,iconOnly:r,"aria-label":l(`libraryView.newDocument`),tooltip:l(`libraryView.newDocument`),className:`max-md:bg-[var(--surface-active)]`,onClick:a,disabled:o}):null]}):(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(t,{variant:`outlined`,size:`regular`,onClick:()=>B.current?.click(),disabled:V,children:[n,(0,Z.jsx)(`span`,{className:`ml-1.5`,children:l(`libraryView.import`)})]}),a?(0,Z.jsxs)(t,{size:`regular`,onClick:a,disabled:o,children:[r,(0,Z.jsx)(`span`,{className:`ml-1.5`,children:l(`libraryView.newDocument`)})]}):null]})),()=>{K(null)}},[p,q,V,a,o,K,l]),A)return(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Z.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--border-base)] border-t-[var(--primary-base)]`,role:`status`,"aria-label":l(`libraryView.loadingAria`)})});if(j)return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4`,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:j}),(0,Z.jsx)(`button`,{type:`button`,className:`rounded-lg bg-[var(--primary-base)] px-4 py-2 text-body-medium-default text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)]`,onClick:()=>window.location.reload(),children:l(`libraryView.retry`)})]});let J=b.length===0&&S.length===0;return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[(0,Z.jsx)(`input`,{ref:B,type:`file`,accept:z,className:`hidden`,onChange:U}),J?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(de,{onNewConversation:r?()=>r():void 0})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mb-6 shrink-0`,children:(0,Z.jsx)(g,{fullWidth:!0,type:`text`,placeholder:l(`libraryView.searchPlaceholder`),value:O,onChange:e=>k(e.target.value),leftIcon:(0,Z.jsx)(Y,{size:16})})}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:C.length===0&&D.length===0?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16`,children:[(0,Z.jsx)(Y,{size:32,className:`mb-4 text-[var(--content-tertiary)]`}),(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:l(`libraryView.noMatches`,{query:O})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Z.jsx)(Q,{title:l(`libraryView.pinned`),apps:w,assistantId:e,pinnedAppIds:v,onOpen:s,onPin:G,onDelete:I,onDeploy:W}),(0,Z.jsx)(Q,{title:l(`libraryView.recents`),apps:E,assistantId:e,pinnedAppIds:v,onOpen:s,onPin:G,onDelete:I,onDeploy:W}),D.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)]`,children:l(`libraryView.documents`)}),(0,Z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6`,children:D.map(e=>(0,Z.jsx)(ue,{document:e,onOpen:e=>{i&&i(e)}},e.surfaceId))})]}):null]})}),(0,Z.jsx)(re,{assistantId:e,assistantName:n,onStartConversation:r}),(0,Z.jsx)(oe,{app:M,isDeleting:P,onConfirm:L,onCancel:R})]})]})}function _e(){let e=F(),t=P({...l(),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:r({path:n.path})})}});return{createDocument:({assistantId:e,conversationId:n})=>t.mutateAsync({path:{assistant_id:e},body:{conversationId:n}}),isPending:t.isPending}}function ve(e,t){let{t:r}=N(`library`),i=F(),{createDocument:a}=_e(),[o,s]=(0,X.useState)(!1),c=(0,X.useRef)(!1);return{newDocument:(0,X.useCallback)(async()=>{if(!c.current){c.current=!0,s(!0);try{let o=await y({assistantId:e,fallback:r(`libraryView.newDocumentFailed`)});if(!o.ok){T.error(o.error);return}let s;try{({surfaceId:s}=await a({assistantId:e,conversationId:o.conversationId}))}catch(t){n(t,{context:`new_library_document`}),E(e,o.conversationId),T.error(r(`libraryView.newDocumentFailed`));return}h(i,e),t(s)}finally{c.current=!1,s(!1)}}},[e,a,t,i,r]),isCreating:o}}var ye=`0.12.2-dev.202609211450.3151b18`;function be(e){return v(ye,e)}function xe(){let e=S(),t=L(),n=I(),r=(0,X.useCallback)(e=>{o(t,{prompt:e})},[t]),i=(0,X.useCallback)(e=>{t(m(e,n.pathname),{state:O(n,e)})},[t,n]),{newDocument:a,isCreating:s}=ve(e,i),c=be(e),l=(0,X.useCallback)(()=>{a()},[a]),u=(0,X.useCallback)(e=>{t(b.library.app(e))},[t]);return(0,Z.jsx)(ge,{assistantId:e,onNewConversation:r,onOpenDocument:i,onNewDocument:c?l:void 0,isCreatingDocument:s,onOpenApp:u})}export{xe as LibraryPage};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{BC as t,CS as n,Dp as r,Ep as i,Ht as a,Jl as o,MC as s,Pr as c,Tp as l,Vh as u,Yi as d,Yl as f,bv as p,do as m,fc as h,gC as g,ip as _,jg as v,l as y,mS as b,ns as x,nt as S,qo as C,rp as w,sC as T,u as E,un as D,uo as O,vr as k,wa as A,yr as j}from"./app-XG_RF2yi.js";import{$n as M,E as N,Xn as P,nr as F}from"./vendor-DwMhK7fD.js";import{d as I,f as L,t as R,x as z}from"./react-B9IgSVeK.js";import{$r as B,A as V,At as H,Br as U,Cr as W,Ht as G,Ia as K,Ur as ee,Vt as q,ir as J,ri as te,tr as ne,vt as Y}from"./icons-C0wyat6T.js";import{t as re}from"./deploy-dialogs-HsxdyBbf.js";import{t as ie}from"./intelligence-layout-slots-store-DTzofJ6x.js";import{n as ae,r as oe,t as se}from"./use-app-delete-S-DdyUwn.js";import{t as ce}from"./app-types-Cp5xNgLa.js";var X=e(z(),1),Z=R();function le(e){return e===1?`1 word`:`${e} words`}function ue({document:e,onOpen:t}){return(0,Z.jsxs)(`div`,{className:`group relative flex flex-col gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:C(`relative flex w-full cursor-pointer flex-col items-center justify-center gap-2 overflow-hidden rounded-xl border border-[var(--border-base)] bg-[var(--surface-base)]`,`aspect-[16/10]`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:[(0,Z.jsx)(U,{size:34,className:`text-[var(--content-tertiary)]`}),(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:le(e.wordCount)})]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:`flex cursor-pointer flex-col gap-0.5 rounded-sm px-0.5 text-left outline-none keyboard-focus:ring-2 keyboard-focus:ring-inset keyboard-focus:ring-[var(--ring)]`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:e.title}),(0,Z.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:a(new Date(e.updatedAt))})]})]})}function de({onNewConversation:e}){let{t:n}=N(`library`);return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4 py-24`,children:[(0,Z.jsx)(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-xl bg-[var(--surface-base)]`,children:(0,Z.jsx)(J,{size:32,className:`text-[var(--content-tertiary)]`})}),(0,Z.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:n(`libraryEmptyState.heading`)}),(0,Z.jsx)(`p`,{className:`max-w-md text-center text-body-medium-lighter text-[color:var(--content-tertiary)]`,children:n(`libraryEmptyState.body`)}),e?(0,Z.jsx)(t,{variant:`primary`,size:`regular`,onClick:e,children:n(`libraryEmptyState.newConversation`)}):null]})}function fe({app:e,assistantId:t,isPinned:n,onOpen:r,onPin:i,onDelete:o,onDeploy:s,justImported:c,onAnimationEnd:l}){let{t:d}=N(`library`),f=ce(e.origin),p=f?void 0:o,m=f?void 0:s,h=(0,X.useCallback)(()=>u(t,e.id,e.updatedAt),[t,e.id,e.updatedAt]),g=ae(t,e,{exported:d(`libraryAppCard.exported`),failed:d(`libraryAppCard.shareFailed`)}),[_,v]=(0,X.useState)(!1),[y,b]=(0,X.useState)(!1),x=(0,X.useCallback)(()=>b(!0),[]),{deployedUrl:S}=j(t,e.id,{enabled:y&&m!=null}),w=(0,X.useCallback)(()=>{S!=null&&k(S)},[S]);return(0,Z.jsx)(A,{trailingActions:[{id:`pin`,label:d(n?`libraryAppCard.unpin`:`libraryAppCard.pin`),icon:n?G:q,onSelect:()=>i(e)},...p?[{id:`delete`,label:d(`libraryAppCard.delete`),icon:V,variant:`destructive`,onSelect:()=>p(e)}]:[]],className:`rounded-xl`,children:(0,Z.jsxs)(`div`,{"data-reveal-row":``,className:C(`relative flex flex-col gap-2`,c&&`animate-[card-entrance_400ms_ease-out]`),onAnimationEnd:c?l:void 0,onPointerEnter:x,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:C(`relative w-full cursor-pointer overflow-hidden rounded-xl`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:(0,Z.jsx)(D,{name:e.name,icon:e.icon,loadHtml:h})}),(0,Z.jsx)(`div`,{"data-reveal":``,className:`absolute right-2 top-2 z-20`,children:(0,Z.jsx)(pe,{appName:e.name,isPinned:n,open:_,onOpenChange:e=>{e&&x(),v(e)},onPin:()=>i(e),onDelete:p?()=>p(e):void 0,onShare:f?void 0:g,onDeploy:m,deployedUrl:S,onCopyDeployedLink:w})}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`flex cursor-pointer flex-col gap-0.5 rounded-sm px-0.5 text-left outline-none keyboard-focus:ring-2 keyboard-focus:ring-inset keyboard-focus:ring-[var(--ring)]`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)] max-md:text-body-medium-lighter max-md:text-[color:var(--content-secondary)]`,children:e.name}),(0,Z.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)] max-md:hidden`,children:a(new Date(e.createdAt))})]})]})})}function pe({appName:e,isPinned:n,open:r,onOpenChange:i,onPin:a,onDelete:o,onShare:c,onDeploy:l,deployedUrl:u,onCopyDeployedLink:d}){let{t:f}=N(`library`),p=u!=null&&u!==``&&d!=null,m=f(`libraryAppCard.actionsTitle`,{appName:e});return(0,Z.jsxs)(s.Root,{open:r,onOpenChange:i,children:[(0,Z.jsx)(s.Trigger,{asChild:!0,children:(0,Z.jsx)(t,{variant:`primary`,size:`compact`,iconOnly:(0,Z.jsx)(B,{}),"aria-label":m,onClick:e=>e.stopPropagation()})}),(0,Z.jsxs)(s.Content,{title:m,children:[(0,Z.jsx)(s.Item,{icon:n?G:q,label:f(n?`libraryAppCard.unpin`:`libraryAppCard.pin`),onSelect:a}),c?(0,Z.jsx)(s.Item,{icon:K,label:f(`libraryAppCard.share`),description:f(`libraryAppCard.shareSub`),onSelect:c}):null,l&&p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s.Item,{icon:ne,label:f(`libraryAppCard.deployed`),description:(0,Z.jsx)(`span`,{className:`break-all`,children:u}),trailing:f(`libraryAppCard.copyLink`),onSelect:()=>d?.()}),(0,Z.jsx)(s.Item,{icon:H,label:f(`libraryAppCard.redeploy`),description:f(`libraryAppCard.redeploySub`),onSelect:l})]}):l?(0,Z.jsx)(s.Item,{icon:W,label:f(`libraryAppCard.deploy`),description:f(`libraryAppCard.deploySub`),onSelect:l}):null,o?(0,Z.jsx)(s.Item,{icon:V,label:f(`libraryAppCard.delete`),tone:`destructive`,onSelect:o}):null]})]})}function Q({title:e,apps:t,assistantId:n,pinnedAppIds:r,lastImportedAppId:i,onOpen:a,onPin:o,onDelete:s,onDeploy:c,onAnimationEnd:l}){return t.length===0?null:(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)] max-md:sr-only`,children:e}),(0,Z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6 [--swipe-item-surface:var(--surface-base)] max-md:[--swipe-item-surface:var(--surface-overlay)]`,children:t.map(e=>(0,Z.jsx)(fe,{app:e,assistantId:n,isPinned:r.has(e.id),onOpen:a,onPin:o,onDelete:s,justImported:e.id===i,onAnimationEnd:l,onDeploy:c?()=>c(e.id):void 0},e.id))})]})}var $=(e,t)=>t.updatedAt-e.updatedAt||t.createdAt-e.createdAt;function me(e){let{pinnedAppIds:t}=d(e),{data:n=[],isLoading:r,error:a}=M({...w({path:{assistant_id:e}}),select:e=>e.apps}),{data:o=[],isLoading:s,error:c}=M({...i({path:{assistant_id:e}}),select:e=>e.documents}),l=r||s,u=a&&c?a instanceof Error?a.message:`Failed to load library`:null,[f,p]=(0,X.useState)(``),m=(0,X.useMemo)(()=>{if(!f.trim())return n;let e=f.toLowerCase();return n.filter(t=>t.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[n,f]);return{apps:n,documents:o,filteredApps:m,pinnedApps:(0,X.useMemo)(()=>m.filter(e=>t.has(e.id)).sort($),[m,t]),recentApps:(0,X.useMemo)(()=>m.filter(e=>!t.has(e.id)).sort($),[m,t]),filteredDocuments:(0,X.useMemo)(()=>{if(!f.trim())return o;let e=f.toLowerCase();return o.filter(t=>t.title.toLowerCase().includes(e))},[o,f]),searchText:f,setSearchText:p,loading:l,error:u}}async function he(e,t){let{data:n,error:r,response:i}=await p({path:{assistant_id:e},body:t,bodySerializer:e=>e,headers:{"Content-Type":`application/octet-stream`},throwOnError:!1});if(!i||!i.ok){let e=(r&&typeof r==`object`&&`message`in r?r.message:null)??`Failed to import app.`;throw Error(e)}return n}function ge({assistantId:e,assistantName:n,onNewConversation:r,onOpenDocument:i,onNewDocument:a,isCreatingDocument:o=!1,onOpenApp:s}){let{t:l}=N(`library`),p=f(),m=F(),{togglePin:h,pinnedAppIds:v}=d(e),y=c.use.isDeploying(),{apps:b,documents:S,filteredApps:C,pinnedApps:w,recentApps:E,filteredDocuments:D,searchText:O,setSearchText:k,loading:A,error:j}=me(e),{pendingDelete:M,isDeleting:P,requestDelete:I,confirmDelete:L,cancelDelete:R}=se(e),[z]=(0,X.useState)(()=>x()?void 0:`.vellum`),B=(0,X.useRef)(null),[V,H]=(0,X.useState)(!1),U=(0,X.useCallback)(async t=>{let n=t.target.files?.[0];if(!(!n||V)){H(!0);try{let t=await he(e,n);await m.invalidateQueries({queryKey:_({path:{assistant_id:e}})}),T.success(l(`libraryView.imported`,{name:t.name})),s(t.appId)}catch(e){T.error(e instanceof Error?e.message:l(`libraryView.importFailed`))}finally{H(!1),B.current&&(B.current.value=``)}}},[e,V,m,s,l]),W=(0,X.useCallback)(async t=>{if(y)return;let n=b.find(e=>e.id===t)?.name??`this app`;try{let r=await u(e,t);c.getState().deployApp(e,t,n,r)}catch{c.getState().deployApp(e,t,n,``)}},[e,y,b]),G=(0,X.useCallback)(e=>h(e.id),[h]),K=ie.use.setHeaderTrailing(),q=!A&&!j;if((0,X.useEffect)(()=>{if(!q){K(null);return}let e=(0,Z.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}),n=V?e:(0,Z.jsx)(te,{"aria-hidden":!0}),r=o?e:(0,Z.jsx)(ee,{"aria-hidden":!0});return K(p?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(t,{shape:`pill`,variant:`ghost`,iconOnly:n,"aria-label":l(`libraryView.import`),tooltip:l(`libraryView.import`),className:`max-md:bg-[var(--surface-active)]`,onClick:()=>B.current?.click(),disabled:V}),a?(0,Z.jsx)(t,{shape:`pill`,variant:`ghost`,iconOnly:r,"aria-label":l(`libraryView.newDocument`),tooltip:l(`libraryView.newDocument`),className:`max-md:bg-[var(--surface-active)]`,onClick:a,disabled:o}):null]}):(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(t,{variant:`outlined`,size:`regular`,onClick:()=>B.current?.click(),disabled:V,children:[n,(0,Z.jsx)(`span`,{className:`ml-1.5`,children:l(`libraryView.import`)})]}),a?(0,Z.jsxs)(t,{size:`regular`,onClick:a,disabled:o,children:[r,(0,Z.jsx)(`span`,{className:`ml-1.5`,children:l(`libraryView.newDocument`)})]}):null]})),()=>{K(null)}},[p,q,V,a,o,K,l]),A)return(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Z.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--border-base)] border-t-[var(--primary-base)]`,role:`status`,"aria-label":l(`libraryView.loadingAria`)})});if(j)return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4`,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:j}),(0,Z.jsx)(`button`,{type:`button`,className:`rounded-lg bg-[var(--primary-base)] px-4 py-2 text-body-medium-default text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)]`,onClick:()=>window.location.reload(),children:l(`libraryView.retry`)})]});let J=b.length===0&&S.length===0;return(0,Z.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[(0,Z.jsx)(`input`,{ref:B,type:`file`,accept:z,className:`hidden`,onChange:U}),J?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(de,{onNewConversation:r?()=>r():void 0})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mb-6 shrink-0`,children:(0,Z.jsx)(g,{fullWidth:!0,type:`text`,placeholder:l(`libraryView.searchPlaceholder`),value:O,onChange:e=>k(e.target.value),leftIcon:(0,Z.jsx)(Y,{size:16})})}),(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:C.length===0&&D.length===0?(0,Z.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16`,children:[(0,Z.jsx)(Y,{size:32,className:`mb-4 text-[var(--content-tertiary)]`}),(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:l(`libraryView.noMatches`,{query:O})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Z.jsx)(Q,{title:l(`libraryView.pinned`),apps:w,assistantId:e,pinnedAppIds:v,onOpen:s,onPin:G,onDelete:I,onDeploy:W}),(0,Z.jsx)(Q,{title:l(`libraryView.recents`),apps:E,assistantId:e,pinnedAppIds:v,onOpen:s,onPin:G,onDelete:I,onDeploy:W}),D.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)]`,children:l(`libraryView.documents`)}),(0,Z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6`,children:D.map(e=>(0,Z.jsx)(ue,{document:e,onOpen:e=>{i&&i(e)}},e.surfaceId))})]}):null]})}),(0,Z.jsx)(re,{assistantId:e,assistantName:n,onStartConversation:r}),(0,Z.jsx)(oe,{app:M,isDeleting:P,onConfirm:L,onCancel:R})]})]})}function _e(){let e=F(),t=P({...l(),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:r({path:n.path})})}});return{createDocument:({assistantId:e,conversationId:n})=>t.mutateAsync({path:{assistant_id:e},body:{conversationId:n}}),isPending:t.isPending}}function ve(e,t){let{t:r}=N(`library`),i=F(),{createDocument:a}=_e(),[o,s]=(0,X.useState)(!1),c=(0,X.useRef)(!1);return{newDocument:(0,X.useCallback)(async()=>{if(!c.current){c.current=!0,s(!0);try{let o=await y({assistantId:e,fallback:r(`libraryView.newDocumentFailed`)});if(!o.ok){T.error(o.error);return}let s;try{({surfaceId:s}=await a({assistantId:e,conversationId:o.conversationId}))}catch(t){n(t,{context:`new_library_document`}),E(e,o.conversationId),T.error(r(`libraryView.newDocumentFailed`));return}h(i,e),t(s)}finally{c.current=!1,s(!1)}}},[e,a,t,i,r]),isCreating:o}}var ye=`0.12.2-dev.202609211450.3151b18`;function be(e){return v(ye,e)}function xe(){let e=S(),t=L(),n=I(),r=(0,X.useCallback)(e=>{o(t,{prompt:e})},[t]),i=(0,X.useCallback)(e=>{t(m(e,n.pathname),{state:O(n,e)})},[t,n]),{newDocument:a,isCreating:s}=ve(e,i),c=be(e),l=(0,X.useCallback)(()=>{a()},[a]),u=(0,X.useCallback)(e=>{t(b.library.app(e))},[t]);return(0,Z.jsx)(ge,{assistantId:e,onNewConversation:r,onOpenDocument:i,onNewDocument:c?l:void 0,isCreatingDocument:s,onOpenApp:u})}export{xe as LibraryPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{wx as e}from"./app-XG_RF2yi.js";export{e as markLockfileAssistantOnboarded};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{BC as t,CS as n,Hy as r,Jc as i,Kc as a,Vy as o,Yc as s,mS as c,qc as l,vb as u}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{BC as t,CS as n,Hy as r,Jc as i,Kc as a,Vy as o,Yc as s,mS as c,qc as l,vb as u}from"./app-XG_RF2yi.js";import{E as d}from"./vendor-DwMhK7fD.js";import{d as f,t as p,x as m}from"./react-B9IgSVeK.js";import{n as h,r as g,t as _}from"./auth-welcome-screen-CCmw8K2q.js";import{n as v,t as y}from"./use-return-to-short-circuit-BVGVwuLm.js";var b=e(m(),1),x=p();function S({returnTo:e}){let{t:r}=d(`account`),[c,u]=(0,b.useState)(null),[f,p]=(0,b.useState)(!1),m=async()=>{u(null),p(!0);try{await o({returnTo:e??null})}catch(e){if(l(e)){p(!1);return}n(e,{context:`native_login`,tags:{authError:i(e)??`unclassified`}}),u(r(s(e),{community:a})),p(!1)}};return(0,x.jsx)(g,{animateAvatarWaveIn:!0,fillsViewport:!0,children:(0,x.jsx)(h,{error:c,children:(0,x.jsx)(t,{type:`button`,variant:`primary`,size:`large`,fullWidth:!0,onClick:()=>{m()},disabled:f,children:r(`loginPage.signIn`)})})})}function C({returnTo:e}){let{t}=d(`account`),{search:n}=f(),r=u(e?`${c.account.signup}?returnTo=${encodeURIComponent(e)}`:c.account.signup,n);return(0,x.jsx)(_,{returnTo:e,errorContext:`web_login`,fillsViewport:!0,secondary:{label:t(`loginPage.signUp`),href:r}})}function w(){let e=r(),t=y();return t.kind===`wait`?(0,x.jsx)(g,{animateAvatarWaveIn:!0,fillsViewport:!0,children:(0,x.jsx)(v,{})}):t.kind===`redirect`?t.node:e?(0,x.jsx)(S,{returnTo:t.returnTo}):(0,x.jsx)(C,{returnTo:t.returnTo})}export{w as LoginPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{gb as t,hh as n,mS as r,ol as i}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{gb as t,hh as n,mS as r,ol as i}from"./app-XG_RF2yi.js";import{E as a}from"./vendor-DwMhK7fD.js";import{_ as o,t as s,x as c}from"./react-B9IgSVeK.js";import{r as l,t as u}from"./account-shell-DxLEvbei.js";var d=e(c(),1),f=s();function p(){let{t:e}=a(`account`),[s]=o(),c=n.use.logout(),p=(0,d.useRef)(!1);return(0,d.useEffect)(()=>{if(p.current)return;p.current=!0;let e=t(s.get(`returnTo`),r.account.login),n=e.startsWith(`http`)||e===r.account.login?e:`${r.account.login}?returnTo=${encodeURIComponent(e)}`,a=!1;return c().then(()=>{a||i(n)},()=>{a||i(n)}),()=>{a=!0}},[c,s]),(0,f.jsx)(u,{children:(0,f.jsx)(l,{title:e(`logoutPage.title`)})})}export{p as LogoutPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{fh as t,mS as n}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{fh as t,mS as n}from"./app-XG_RF2yi.js";import{d as r,i,t as a,x as o}from"./react-B9IgSVeK.js";import{Vn as s,Ya as c}from"./icons-C0wyat6T.js";import{n as l,t as u}from"./sidebar-tree-BTeywUnh.js";var d=c(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),f=e(o(),1),p=[{id:`emails`,label:`Emails`,href:n.logs.emails,icon:s},{id:`system-events`,label:`System Events`,href:n.logs.systemEvents,icon:d}],m=a();function h(){let e=t({platformHostedOnly:!0}),a=t(),{pathname:o}=r(),s=(0,f.useMemo)(()=>p.filter(t=>!(t.id===`system-events`&&e===`gated`||t.id===`emails`&&a===`gated`)),[e,a]),c=(0,f.useMemo)(()=>{let e=p.find(e=>o===e.href||o.startsWith(e.href+`/`));return e?e.label:o===n.logs.root?p[0]?.label??`Logs & Usage`:`Logs & Usage`},[o]);return(0,m.jsx)(l,{backHref:n.assistant,sidebar:(0,m.jsx)(u,{items:s,indexPath:n.logs.root}),title:c,menuRoute:n.logs.root,children:(0,m.jsx)(i,{})})}export{h as LogsLayout};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Rn as e,Vn as t,fr as n}from"./app-
|
|
1
|
+
import{Rn as e,Vn as t,fr as n}from"./app-XG_RF2yi.js";import{E as r}from"./vendor-DwMhK7fD.js";import{t as i}from"./react-B9IgSVeK.js";import{t as a}from"./preview-error-BSpmr-KH.js";import{t as o}from"./use-truncated-blob-text-CDefp8f8.js";var s=i(),c=512*1024;function l({blob:i,filename:l}){let{t:u}=r(`chat`),{text:d,truncated:f,decodeFailed:p}=o(i,c);return p?(0,s.jsx)(a,{filename:l}):d===null?(0,s.jsx)(n,{}):(0,s.jsxs)(`div`,{className:`flex min-h-0 flex-col gap-2`,children:[(0,s.jsx)(e,{content:d}),f&&(0,s.jsx)(t,{children:u(`previewTruncationNotice.markdown`)})]})}export{l as MarkdownPreview};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ah as t,dr as n,fr as r}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ah as t,dr as n,fr as r}from"./app-XG_RF2yi.js";import{t as i,x as a}from"./react-B9IgSVeK.js";var o=e(a(),1),s=i(),c=`nodownload noplaybackrate`;function l({blob:e,filename:i,kind:a}){let l=n(e,(0,o.useMemo)(()=>t({sniffedMime:null,serverMime:e.type.length>0?e.type:null,filename:i}).mime,[e,i]));return l===null?(0,s.jsx)(r,{}):a===`image`?(0,s.jsx)(`div`,{className:`flex justify-center`,children:(0,s.jsx)(`img`,{src:l,alt:i,className:`h-auto max-w-full rounded-lg border border-[var(--border-element)]`})}):a===`audio`?(0,s.jsx)(`audio`,{src:l,controls:!0,controlsList:c,preload:`metadata`,"aria-label":i,className:`w-full`}):(0,s.jsx)(`video`,{src:l,controls:!0,controlsList:c,playsInline:!0,preload:`metadata`,"aria-label":i,className:`max-w-full rounded-lg border border-[var(--border-element)]`})}export{l as MediaPreview};
|