@vellumai/web 0.12.2-dev.202609170044.9cbb729 → 0.12.2-dev.202609170320.2f82e57
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-CPOepgSQ.js → a2a-invite-CGyWwrVb.js} +1 -1
- package/dist/assets/{about-page-mvJO6yza.js → about-page-CpXKAK5Z.js} +1 -1
- package/dist/assets/{account-page-yyir0M2y.js → account-page-cpDusq21.js} +1 -1
- package/dist/assets/{account-shell-B5314FtI.js → account-shell-D1_mSHj9.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-BYr2gH9F.js → acp-run-detail-panel-D_bA-uwm.js} +1 -1
- package/dist/assets/{activation-list-route-dhx_UhFW.js → activation-list-route-_x10pg_q.js} +1 -1
- package/dist/assets/{activity-redirect-page-Cyo877Rg.js → activity-redirect-page-CLc8hSfC.js} +1 -1
- package/dist/assets/{activity-steps-panel-DKg15Oc4.js → activity-steps-panel-YPKDTvLp.js} +1 -1
- package/dist/assets/{add-credits-modal-CzpgEkT9.js → add-credits-modal-CXIeeHpM.js} +1 -1
- package/dist/assets/add-credits-modal-Lw_orElQ.js +1 -0
- package/dist/assets/{ai-page-CBX1v1tS.js → ai-page-532485Rg.js} +1 -1
- package/dist/assets/{android-billing-handoff-CWqhP_0I.js → android-billing-handoff-BjLOXHzL.js} +1 -1
- package/dist/assets/{api-key-screen-DKzLIFst.js → api-key-screen-DBRohhxk.js} +1 -1
- package/dist/assets/{app-BffxeWB8.js → app-Bevxq2OH.js} +13 -13
- package/dist/assets/{app-info-DsEx-jq_.js → app-info-CLe39i6W.js} +1 -1
- package/dist/assets/{archive-redirect-page-BK_dY4v-.js → archive-redirect-page-CrqrZE0I.js} +1 -1
- package/dist/assets/{assistant-status-panel-BSioaCpK.js → assistant-status-panel-D0GMw4-F.js} +1 -1
- package/dist/assets/auth-store-CpWb7YyB.js +1 -0
- package/dist/assets/{auth-welcome-screen-LyL7WDL8.js → auth-welcome-screen-DqyGTmht.js} +1 -1
- package/dist/assets/avatar-bundled-components-Dg1tq-xF.js +1 -0
- package/dist/assets/{avatar-random-DIn9GmRk.js → avatar-random-Bg-JtW3h.js} +2 -2
- package/dist/assets/{await-org-header-settled-DNIo8_Tf.js → await-org-header-settled-CPTObvNn.js} +1 -1
- package/dist/assets/{background-task-detail-panel-HleNtRAe.js → background-task-detail-panel-BVlprJsr.js} +1 -1
- package/dist/assets/{billing-page-DbEVS2q_.js → billing-page-7AqrZkVw.js} +3 -3
- package/dist/assets/{billing-redirect-page-CdcCmEUc.js → billing-redirect-page-CBdGeWQH.js} +1 -1
- package/dist/assets/{bookmarks-page-CUi4LhrR.js → bookmarks-page-BlaJ96ej.js} +1 -1
- package/dist/assets/{bundle-confirm-page-Tz6RPE2c.js → bundle-confirm-page-C-nGTAWg.js} +1 -1
- package/dist/assets/{channel-transcript-panel-gPgCvcoI.js → channel-transcript-panel-C8sNJBUg.js} +1 -1
- package/dist/assets/{channels-page-route-D8adodpU.js → channels-page-route-Ccf07m7d.js} +1 -1
- package/dist/assets/{chat-info-panel-jeK_s1xx.js → chat-info-panel-Dc7yOSba.js} +1 -1
- package/dist/assets/{checkout-continuation-BJuTfVL4.js → checkout-continuation-DndPlOQH.js} +1 -1
- package/dist/assets/{checkout-page-BEB-CumM.js → checkout-page-BubQ6HKx.js} +1 -1
- package/dist/assets/checkout-return-target-UI7zqK_V.js +1 -0
- package/dist/assets/command-palette-C1EnF4gm.js +1 -0
- package/dist/assets/{command-palette-CWDqjKuB.js → command-palette-CMP9k9JI.js} +1 -1
- package/dist/assets/{command-palette-window-page-C0OorhM_.js → command-palette-window-page-BiTxCLMC.js} +1 -1
- package/dist/assets/{community-page-Dp56nq4K.js → community-page-BnK8lv_7.js} +1 -1
- package/dist/assets/{companion-accent-BkhXA9n8.js → companion-accent-Cw1QrON6.js} +1 -1
- package/dist/assets/{companion-dock-zones-page-BiaNWu9U.js → companion-dock-zones-page-BDH8JnN-.js} +1 -1
- package/dist/assets/{companion-layout-CPz7l-4W.js → companion-layout-DY7WNHKB.js} +1 -1
- package/dist/assets/{companion-popover-Wr9gfDIe.js → companion-popover-CrjiSDbu.js} +1 -1
- package/dist/assets/{companion-popover-page-PVlrSn4w.js → companion-popover-page-CySPinox.js} +1 -1
- package/dist/assets/{companion-surface-page-Dp_CShHP.js → companion-surface-page-BOo03Cql.js} +1 -1
- package/dist/assets/{companion-watch-frame-page-CVY57Wpn.js → companion-watch-frame-page-D0gmPDdg.js} +1 -1
- package/dist/assets/{connect-page-BSje-9ym.js → connect-page-ASh20AlX.js} +1 -1
- package/dist/assets/{consent-controls-Bz_IOnmZ.js → consent-controls-CEkwbqJw.js} +1 -1
- package/dist/assets/{contacts-gateway-CY5vUfM2.js → contacts-gateway-BFbyNbl_.js} +1 -1
- package/dist/assets/{contacts-page-route-JRYP87zz.js → contacts-page-route-Dq0E2ER7.js} +1 -1
- package/dist/assets/{copy-button-BuISIxU2.js → copy-button-CpRMm23v.js} +1 -1
- package/dist/assets/{credential-entry-page-D2GsP2g5.js → credential-entry-page-7W319fSF.js} +1 -1
- package/dist/assets/{credentials-page-B2B50A98.js → credentials-page-CZjpoj-1.js} +1 -1
- package/dist/assets/{csv-preview--DFbpKhn.js → csv-preview-BntRaLY3.js} +1 -1
- package/dist/assets/{danger-zone-redirect-page-BizWd5Ru.js → danger-zone-redirect-page-BIJ7iH3z.js} +1 -1
- package/dist/assets/{debug-page-C5iUTBcy.js → debug-page-5TIa2DWf.js} +1 -1
- package/dist/assets/{deploy-dialogs-Cb2DGIT-.js → deploy-dialogs-6ed2FkO5.js} +1 -1
- package/dist/assets/deploy-dialogs-Gj5nNCwe.js +1 -0
- package/dist/assets/{desktop-preview-content-C-2TO84E.js → desktop-preview-content-C8-eBvWs.js} +2 -2
- package/dist/assets/{desktop-status-Cq9tSoVe.js → desktop-status-Bb9_j80h.js} +1 -1
- package/dist/assets/{desktop-viewer-BFoFR7Sg.js → desktop-viewer-B1LngIwF.js} +1 -1
- package/dist/assets/{detail-card-B3_bSihf.js → detail-card-BwHvhGMs.js} +1 -1
- package/dist/assets/{detail-panel-stop-button-DOTn90Cm.js → detail-panel-stop-button-CeSH5ncG.js} +1 -1
- package/dist/assets/{detail-primitives-Bc5PDjkl.js → detail-primitives-DscaN9rD.js} +1 -1
- package/dist/assets/{developer-page-CWg9QzIf.js → developer-page-BAPxl51t.js} +1 -1
- package/dist/assets/{devices-redirect-page-c67PRqw0.js → devices-redirect-page-CL5kygqy.js} +1 -1
- package/dist/assets/{dictation-overlay-page-UYCz2T3V.js → dictation-overlay-page-CqBYNqCX.js} +1 -1
- package/dist/assets/{document-load-DHCCLogD.js → document-load-D6zwCeMh.js} +1 -1
- package/dist/assets/document-load-DwJmiaST.js +1 -0
- package/dist/assets/{document-viewer-page-ClJvwnU-.js → document-viewer-page-CgUpLtrR.js} +1 -1
- package/dist/assets/{emails-page-2ou2eAkW.js → emails-page-B3KXvdQh.js} +1 -1
- package/dist/assets/{environment-store-Dka2FZhs.js → environment-store-gXJzyQ9n.js} +1 -1
- package/dist/assets/{file-diff-view-BmdOQaeZ.js → file-diff-view-gj5qz7ac.js} +1 -1
- package/dist/assets/{file-editor--nn3ZR0r.js → file-editor-yxcARNDB.js} +1 -1
- package/dist/assets/{general-page-uvMmHHyl.js → general-page-Be2OEMQv.js} +1 -1
- package/dist/assets/{hatching-screen-C5Hdkxta.js → hatching-screen-Os08fIB7.js} +1 -1
- package/dist/assets/{hosting-screen-D3yRf7Vz.js → hosting-screen-KGS2hNnI.js} +1 -1
- package/dist/assets/{identity-page-route-CBystW_n.js → identity-page-route-CcWEsb73.js} +1 -1
- package/dist/assets/{inspect-page-VMZxgoOP.js → inspect-page-BqwGgtCg.js} +3 -3
- package/dist/assets/{integrations-page-_YxXV8LC.js → integrations-page-DxXjeCOU.js} +1 -1
- package/dist/assets/{intelligence-layout-COHWei3O.js → intelligence-layout-0GHP1abK.js} +1 -1
- package/dist/assets/intelligence-layout-slots-store-DO8r8MbX.js +1 -0
- package/dist/assets/{keyboard-shortcuts-redirect-page-CkO8sqRv.js → keyboard-shortcuts-redirect-page-D8Sd0awe.js} +1 -1
- package/dist/assets/{latest-assistant-text-px--r87U.js → latest-assistant-text-CFfTfLEE.js} +1 -1
- package/dist/assets/{library-detail-page-BROUcqvW.js → library-detail-page-hchQ6i_Z.js} +1 -1
- package/dist/assets/{library-page-D8lvqAnn.js → library-page-DCcuCaVz.js} +1 -1
- package/dist/assets/local-mode-BF0BHVrs.js +1 -0
- package/dist/assets/{login-page-KwB7QV63.js → login-page-CFu2kSt0.js} +1 -1
- package/dist/assets/{logout-page-BS_b3wIp.js → logout-page-TdBoJnoW.js} +1 -1
- package/dist/assets/{logs-layout-3574H70Q.js → logs-layout-CB0oUcCN.js} +1 -1
- package/dist/assets/{markdown-preview-BQBD4nZl.js → markdown-preview-DFx6LTIB.js} +1 -1
- package/dist/assets/{media-preview-B8dzo6SD.js → media-preview-s9zPdEVg.js} +1 -1
- package/dist/assets/{memory-page-route-lL9WqSlP.js → memory-page-route-BfiwTjz6.js} +1 -1
- package/dist/assets/{memory-router-playground-page-Xn90HoK0.js → memory-router-playground-page-BMqYc2PM.js} +1 -1
- package/dist/assets/{message-files-panel-BLVYF2bR.js → message-files-panel-DFgNQOkk.js} +1 -1
- package/dist/assets/{metric-card-qtWiXfjv.js → metric-card-Cp9VXC7R.js} +1 -1
- package/dist/assets/native-attachment-pickers-Da2NEx1r.js +1 -0
- package/dist/assets/native-file-BE23yEsJ.js +1 -0
- package/dist/assets/{notifications-page-Butll45i.js → notifications-page-B9YszO_J.js} +1 -1
- package/dist/assets/{oauth-complete-page-CEcHbwIV.js → oauth-complete-page-BNh9-xUX.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-D3zQC3el.js → oauth-popup-complete-page-IDBMA6bj.js} +1 -1
- package/dist/assets/paired-platform-identity-CV09bF6L.js +1 -0
- package/dist/assets/{pairing-page-BfAzRCkh.js → pairing-page-BiagkAmV.js} +1 -1
- package/dist/assets/password-reset-page-BnC4ZtAH.js +1 -0
- package/dist/assets/{pdf-file-preview-BNNzH1Lj.js → pdf-file-preview-DyZKuW6K.js} +1 -1
- package/dist/assets/{personality-page-pYkfDoiT.js → personality-page-CaVp-IFA.js} +1 -1
- package/dist/assets/{personality-page-C9g8m-ZV.js → personality-page-D9S6ceuR.js} +1 -1
- package/dist/assets/{personality-sliders-vC7qRQZ4.js → personality-sliders-B8XJXHql.js} +1 -1
- package/dist/assets/{plans-page-Cqz11rXC.js → plans-page-COqIWjjU.js} +1 -1
- package/dist/assets/{platform-loopback-page-zI5kt-1B.js → platform-loopback-page-Be6zZTjk.js} +1 -1
- package/dist/assets/{plugin-detail-page-BVUJF_Z0.js → plugin-detail-page-B7rDYqFA.js} +1 -1
- package/dist/assets/{plugins-page-grMYw6ca.js → plugins-page-CLR2LTmD.js} +1 -1
- package/dist/assets/plugins-surface-DV2Ze-pt.js +1 -0
- package/dist/assets/{preview-error-DAI-w4oR.js → preview-error-BJZmVu5_.js} +1 -1
- package/dist/assets/{privacy-page-CkYCyPUl.js → privacy-page-DoWHQiAM.js} +1 -1
- package/dist/assets/{privacy-screen-C8KSanLw.js → privacy-screen-CqHYvdcC.js} +1 -1
- package/dist/assets/{provider-callback-page-CaXQeoGc.js → provider-callback-page-CoDo_LGa.js} +1 -1
- package/dist/assets/{provider-key-CMRKdOp6.js → provider-key-CdT-QLy6.js} +1 -1
- package/dist/assets/{provider-signup-page-pmWAHHvg.js → provider-signup-page-BqLSsqmz.js} +1 -1
- package/dist/assets/{quick-input-page-D2Ps4Nn9.js → quick-input-page-DNQrrRym.js} +1 -1
- package/dist/assets/referral-modal-Cb9yHvB_.js +1 -0
- package/dist/assets/{referral-modal-T0tz9cKz.js → referral-modal-Cxu42QEQ.js} +1 -1
- package/dist/assets/{research-mock-page-C2hO1AJp.js → research-mock-page-BGxSDObT.js} +1 -1
- package/dist/assets/{research-onboarding-route-YUY_VAoR.js → research-onboarding-route-DIsnSqMQ.js} +1 -1
- package/dist/assets/{review-terms-screen-ClCuevTT.js → review-terms-screen-DO7ygsE4.js} +1 -1
- package/dist/assets/routes-CBqv5JWO.js +1 -0
- package/dist/assets/{schedules-C4v6G4Yl.js → schedules-BVvKpKi_.js} +1 -1
- package/dist/assets/{schedules-page-BEE6gG-0.js → schedules-page-DMg82o_w.js} +1 -1
- package/dist/assets/{security-redirect-page-CfHdAiGm.js → security-redirect-page-Dt9NUQpQ.js} +1 -1
- package/dist/assets/{select-assistant-screen-uEMd-mms.js → select-assistant-screen-C_lmPTkj.js} +1 -1
- package/dist/assets/{self-hosted-servers-qDFPnEcM.js → self-hosted-servers-rVknxhh5.js} +1 -1
- package/dist/assets/{service-form-controls-DTOMkj0Y.js → service-form-controls-Dtw6VZjE.js} +1 -1
- package/dist/assets/{setting-row-snAhMVc8.js → setting-row-Dl37RqUe.js} +1 -1
- package/dist/assets/{settings-divider-DAr-iUO3.js → settings-divider-CqLEhf9T.js} +1 -1
- package/dist/assets/{settings-layout-iM3mkXFz.js → settings-layout-g2w2BcMj.js} +1 -1
- package/dist/assets/share-feedback-modal-Cw4b0uTf.js +1 -0
- package/dist/assets/{share-feedback-modal-BkIQkrgI.js → share-feedback-modal-DQOqrbac.js} +1 -1
- package/dist/assets/{sidebar-tree-Ar6vYFqW.js → sidebar-tree-AAmgDds0.js} +1 -1
- package/dist/assets/{signup-page-DP1R2EYG.js → signup-page-Bo3kV3uI.js} +1 -1
- package/dist/assets/{signup-shell-DDOwFm8f.js → signup-shell-BFlnJZeT.js} +1 -1
- package/dist/assets/{skill-detail-page-tlOn1SgY.js → skill-detail-page-D3aEzdPR.js} +1 -1
- package/dist/assets/{skill-detail-panel-BT-gwhZC.js → skill-detail-panel-p4BBQO99.js} +1 -1
- package/dist/assets/{skill-removal-dialog-BKxKHM93.js → skill-removal-dialog-DDrOdXOm.js} +1 -1
- package/dist/assets/{skills-page-CNDvB7S4.js → skills-page-C6d2b4U2.js} +1 -1
- package/dist/assets/{sounds-page-CB-BYrIs.js → sounds-page-DcDVb904.js} +1 -1
- package/dist/assets/{start-screen-TdesbZb_.js → start-screen-xNv_UqZY.js} +1 -1
- package/dist/assets/{stt-language-picker-modal-DPCuG3ZL.js → stt-language-picker-modal-ClWhCUb4.js} +1 -1
- package/dist/assets/{subagent-detail-panel-CZ80KyIm.js → subagent-detail-panel-Br1VLPKI.js} +1 -1
- package/dist/assets/{superpowers-page-CWF29nBb.js → superpowers-page-4mJC8gCY.js} +1 -1
- package/dist/assets/{system-events-page-1v0djQRa.js → system-events-page-BxTLnX53.js} +1 -1
- package/dist/assets/{system-events-redirect-page-H4jpP5pT.js → system-events-redirect-page-sTK7jdID.js} +1 -1
- package/dist/assets/{text-preview-DSjmL18D.js → text-preview-ByPfVkyx.js} +1 -1
- package/dist/assets/{theme-stage-page-DW2rC9j9.js → theme-stage-page-BUDy_3aW.js} +1 -1
- package/dist/assets/{tiptap-document-editor-nrxutBtH.js → tiptap-document-editor-D0xp5ZOs.js} +1 -1
- package/dist/assets/tool-detail-panel-DkIHPygu.js +1 -0
- package/dist/assets/tool-detail-panel-aNvOK4DH.js +15 -0
- package/dist/assets/{trait-cycle-row-BSA19j9_.js → trait-cycle-row-DxnV3-Yt.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-DTHemN5k.js → upgrade-cancel-page-C30oAeVw.js} +1 -1
- package/dist/assets/{upgrade-success-page-CIFrIxM0.js → upgrade-success-page-oW6vbrAs.js} +1 -1
- package/dist/assets/{usage-redirect-page-Cq63trs2.js → usage-redirect-page-CgUD4SND.js} +1 -1
- package/dist/assets/{use-app-delete-BE_RhdkC.js → use-app-delete-CKSNRj2W.js} +1 -1
- package/dist/assets/{use-assistant-identity-details-CrtLW4Dl.js → use-assistant-identity-details-V-aHH_Fd.js} +1 -1
- package/dist/assets/{use-checkout-dismiss-refresh-Ch1dFcBe.js → use-checkout-dismiss-refresh-3vETASUz.js} +1 -1
- package/dist/assets/{use-edge-swipe-back-DCbPXF6z.js → use-edge-swipe-back-iYvf5Z3Y.js} +1 -1
- package/dist/assets/{use-hotkey-recorder-v5Akb2eM.js → use-hotkey-recorder-D_xoveSa.js} +1 -1
- package/dist/assets/{use-invite-link-dialog-BWou3cIT.js → use-invite-link-dialog-BmO2UW56.js} +1 -1
- package/dist/assets/{use-platform-assistant-id-eSCNuEeV.js → use-platform-assistant-id-B2zxeseH.js} +1 -1
- package/dist/assets/{use-plugins-list-BeN4VoGr.js → use-plugins-list-B2RZk-mQ.js} +1 -1
- package/dist/assets/{use-return-to-short-circuit-sIhAEoPs.js → use-return-to-short-circuit-DmEpr1I6.js} +1 -1
- package/dist/assets/{use-side-list-room-DKS_urYu.js → use-side-list-room-Bzn8D2aH.js} +1 -1
- package/dist/assets/{use-skill-actions-VsDYLi1F.js → use-skill-actions-D8xWO_74.js} +1 -1
- package/dist/assets/{use-skill-detail-files-4oFtcDS1.js → use-skill-detail-files-tb5cSgGr.js} +1 -1
- package/dist/assets/use-supports-credentials-settings-D7VgTBHl.js +1 -0
- package/dist/assets/{use-transcript-message-by-id-DAnqm2sU.js → use-transcript-message-by-id-CUhOzUVt.js} +1 -1
- package/dist/assets/{voice-page-ZM6m4a6g.js → voice-page-V5DTtBCx.js} +1 -1
- package/dist/assets/{wake-detail-panel-DDiMpVwh.js → wake-detail-panel-CwGS3ebR.js} +1 -1
- package/dist/assets/{weather-forecast-display-BidX04za.js → weather-forecast-display-Cy7gAmUS.js} +1 -1
- package/dist/assets/{welcome-screen-BLO3HSl6.js → welcome-screen-CsDlUcyv.js} +1 -1
- package/dist/assets/{workflow-detail-panel-DoYNc1Sc.js → workflow-detail-panel-BoCJgSNC.js} +1 -1
- package/dist/assets/{workspace-page-CBkUkz3A.js → workspace-page-ch8vZBtm.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/add-credits-modal-3J4yC3LM.js +0 -1
- package/dist/assets/auth-store-BPEP8tVJ.js +0 -1
- package/dist/assets/avatar-bundled-components-B9pE82_X.js +0 -1
- package/dist/assets/checkout-return-target-Be4ZEj1n.js +0 -1
- package/dist/assets/command-palette-Qu5B2KQE.js +0 -1
- package/dist/assets/deploy-dialogs-X-N6_uqc.js +0 -1
- package/dist/assets/document-load-Cr8Ud-va.js +0 -1
- package/dist/assets/intelligence-layout-slots-store-BmRlMDFx.js +0 -1
- package/dist/assets/local-mode-CBsNlz7d.js +0 -1
- package/dist/assets/native-attachment-pickers-CtYddiW_.js +0 -1
- package/dist/assets/native-file-D3F1srNM.js +0 -1
- package/dist/assets/paired-platform-identity-B0dB5CoX.js +0 -1
- package/dist/assets/password-reset-page-Dr4-0_xs.js +0 -1
- package/dist/assets/plugins-surface-BSzMy9bT.js +0 -1
- package/dist/assets/referral-modal-CeOVD766.js +0 -1
- package/dist/assets/routes-DxNQ44wo.js +0 -1
- package/dist/assets/share-feedback-modal-BPKLrcqs.js +0 -1
- package/dist/assets/tool-detail-panel-CFC6gU9K.js +0 -15
- package/dist/assets/tool-detail-panel-CVYxc8vR.js +0 -1
- package/dist/assets/use-supports-credentials-settings-DqJKqLDf.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fb as e}from"./app-
|
|
1
|
+
import{Fb as e}from"./app-Bevxq2OH.js";function t(t){let n=typeof window<`u`?window.location.origin:``,r=new URLSearchParams({senderAssistantId:t.senderAssistantId,token:t.token});return`${n}${e.connect}?${r.toString()}`}function n(e){let t=e.get(`senderAssistantId`)?.trim(),n=e.get(`token`)?.trim();return!t||!n?null:{senderAssistantId:t,token:n}}export{n,t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ib as t,lh as n}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ib as t,lh as n}from"./app-Bevxq2OH.js";import{j as r}from"./vendor-CtuA73w5.js";import{t as i,x as a}from"./react-B9IgSVeK.js";import{n as o,t as s}from"./app-info-CLe39i6W.js";var c=e(a(),1),l=i();function u(){let{t:e}=r(),i=n(),[a,u]=(0,c.useState)(null);(0,c.useEffect)(()=>{s().then(u)},[]);let f=a??d;return(0,l.jsxs)(`div`,{className:`flex h-svh w-screen flex-col items-center justify-center bg-background px-8 pt-14 pb-8 text-center text-foreground select-none`,children:[(0,l.jsx)(`h1`,{className:`mt-4 text-2xl font-semibold`,children:f.appName}),(0,l.jsx)(`p`,{className:`text-muted-foreground mt-1 mb-7 text-xs`,children:e(i===`windows`?`aboutPage.taglineWindows`:`aboutPage.taglineMacOS`)}),(0,l.jsxs)(`dl`,{className:`mb-7 grid grid-cols-[auto_auto] gap-x-4 gap-y-1.5 text-sm`,children:[(0,l.jsx)(`dt`,{className:`text-muted-foreground text-right`,children:e(`aboutPage.version`)}),(0,l.jsx)(`dd`,{className:`text-left font-mono tabular-nums select-text`,children:f.version}),(0,l.jsx)(`dt`,{className:`text-muted-foreground text-right`,children:e(`aboutPage.build`)}),(0,l.jsx)(`dd`,{className:`text-left font-mono tabular-nums select-text`,children:f.commitSha})]}),(0,l.jsx)(`a`,{href:f.website,className:`text-primary text-sm hover:underline`,onClick:e=>{t()&&(e.preventDefault(),o())},children:new URL(f.website).host}),(0,l.jsx)(`div`,{className:`text-muted-foreground mt-auto pt-6 text-[11px]`,children:f.copyright})]})}var d={appName:`Vellum`,version:`—`,commitSha:`—`,copyright:`© ${new Date().getFullYear()} Vellum`,website:`https://vellum.ai`};export{u as AboutPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ap as t,Dp as n,Es as r,Fb as i,Mp as a,Ps as o,Ts as s,cv as c}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ap as t,Dp as n,Es as r,Fb as i,Mp as a,Ps as o,Ts as s,cv as c}from"./app-Bevxq2OH.js";import{j as l}from"./vendor-CtuA73w5.js";import{n as u,t as d,x as f}from"./react-B9IgSVeK.js";import{r as p,t as m}from"./account-shell-D1_mSHj9.js";var h=e(f(),1),g=d();function _(){let{t:e}=l(`account`),d=t(),f=a(),_=n.use.user(),v=n.use.logout(),[y,b]=(0,h.useState)(null),[x,S]=(0,h.useState)(!1),C=async()=>{b(null),S(!0);try{await c(r,s)}catch(t){console.error(`[account] auth flow failed:`,t),b(e(`authErrors.genericFailure`)),S(!1)}};return f?(0,g.jsx)(m,{children:(0,g.jsx)(p,{title:e(`accountPage.loading`)})}):d?(0,g.jsxs)(m,{children:[(0,g.jsx)(p,{title:_?.username?e(`accountPage.signedInTitleNamed`,{name:_.username}):e(`accountPage.signedInTitle`),subtitle:e(`accountPage.signedInSubtitle`)}),(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,g.jsx)(u,{to:i.assistant,className:`inline-flex w-full items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:e(`accountPage.goToAssistant`)}),(0,g.jsx)(`button`,{type:`button`,onClick:async()=>{await v(),o(i.account.login)},className:`cursor-pointer bg-transparent text-sm font-normal text-[var(--content-secondary)] transition-colors hover:text-[var(--content-default)]`,children:e(`accountPage.signOut`)})]})]}):(0,g.jsxs)(m,{children:[(0,g.jsx)(p,{title:e(`accountPage.welcomeTitle`),subtitle:e(`accountPage.welcomeSubtitle`)}),y&&(0,g.jsx)(`p`,{className:`text-center text-sm text-[var(--system-negative-strong)]`,children:y}),(0,g.jsx)(`div`,{className:`flex flex-col items-center gap-4`,children:(0,g.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:x,className:`inline-flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)] disabled:opacity-50`,children:e(`accountPage.signIn`)})})]})}export{_ as AccountPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Xx as e}from"./app-
|
|
1
|
+
import{Xx as e}from"./app-Bevxq2OH.js";import{t}from"./react-B9IgSVeK.js";var n=t(),r=(0,n.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,n.jsx)(`path`,{d:`M7.5 15L12.5 10L7.5 5`,stroke:`currentColor`,strokeWidth:`1.67`,strokeLinecap:`round`,strokeLinejoin:`round`})});function i({onSubmit:t,error:i,children:a,submitLabel:o,submittingLabel:s,isSubmitting:c,footer:l}){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(`form`,{onSubmit:t,className:`flex flex-col gap-4`,children:[i&&(0,n.jsx)(e,{tone:`error`,children:i}),(0,n.jsx)(`div`,{className:`flex flex-col gap-3`,children:a}),(0,n.jsxs)(`button`,{type:`submit`,disabled:c,className:`mt-2 inline-flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)] disabled:cursor-wait disabled:opacity-50`,children:[c?s:o,r]})]}),l&&(0,n.jsx)(`div`,{className:`mt-8 text-center`,children:l})]})}function a(e){return(0,n.jsx)(`input`,{...e,className:`w-full rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] px-4 py-3 text-sm text-[var(--content-default)] outline-none placeholder:text-[var(--content-tertiary)] focus:border-[var(--primary-base)]/50`})}function o({title:e,subtitle:t}){return(0,n.jsxs)(`div`,{className:`mb-8 text-center`,children:[(0,n.jsx)(`h1`,{className:`mb-2 font-serif text-[2rem] font-bold italic text-[var(--content-default)]`,children:e}),t&&(0,n.jsx)(`p`,{className:`text-sm text-[var(--content-secondary)]`,children:t})]})}function s({children:e}){return(0,n.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-[var(--surface-base)]`,children:(0,n.jsx)(`div`,{className:`w-full max-w-[480px] px-6`,children:(0,n.jsx)(`div`,{className:`flex flex-col items-center gap-10`,children:(0,n.jsx)(`div`,{className:`w-full`,children:e})})})})}export{a as i,i as n,o as r,s as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Jn as n,Kx as r,Pn as i,Qn as a,Qx as o,Wb as s,Xn as c,Yn as l,_r as u,br as d,nS as f,vr as p,wn as m,yr as h}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Jn as n,Kx as r,Pn as i,Qn as a,Qx as o,Wb as s,Xn as c,Yn as l,_r as u,br as d,nS as f,vr as p,wn as m,yr as h}from"./app-Bevxq2OH.js";import{I as g,j as _}from"./vendor-CtuA73w5.js";import{t as v,x as y}from"./react-B9IgSVeK.js";import{Ba as b,E as x,Fi as S,Gi as C,Ja as w,Ki as T,Mr as E,N as D,Ot as O,Q as ee,Qn as te,Ri as k,Sr as ne,Va as re,Wi as A,_t as ie,gt as ae,k as oe,ki as j,ma as M,pi as se,zr as N}from"./icons-DxrLl-Dj.js";import{i as P,n as ce,r as F,t as I}from"./metric-card-Cp9VXC7R.js";import{t as le}from"./file-diff-view-gj5qz7ac.js";import{t as ue}from"./detail-panel-stop-button-CeSH5ncG.js";import{t as de}from"./status-badge-pill-Dw3L9IOE.js";var fe=w(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),L=e(y(),1),R=``;function z(e,t){switch(e){case`complete`:case`completed`:return`completed`;case`failed`:case`error`:return`error`;case void 0:return t;default:return`running`}}function B(e){return(e.messageId?.startsWith(`local-marker-`)??!1)||(e.content?.startsWith(`↻ Steering: `)??!1)}function V(e){let t=e??``;return t.startsWith(`↻ Steering: `)?t.slice(u.length):t}function H(e){let t=e[e.length-1];t&&(t.kind===`agent`||t.kind===`thinking`)&&!t.isComplete&&(e[e.length-1]={...t,isComplete:!0})}function U(e,t){if(t.updateType===`agent_message_chunk`&&B(t)){H(e),e.push({kind:`user`,id:t.messageId??`steer-${e.length}`,content:V(t.content)});return}switch(t.updateType){case`user_message_chunk`:{let n=t.messageId??R,r=V(t.content),i=e[e.length-1];i&&i.kind===`user`&&i.id===n?e[e.length-1]={...i,content:i.content+r}:(H(e),e.push({kind:`user`,id:n,content:r}));let a=e[e.length-1].content;for(let t=0;t<e.length-1;t++){let n=e[t];if(n.kind===`user`&&n.id.startsWith(`local-marker-`)&&n.content===a){e.splice(t,1);break}}return}case`agent_message_chunk`:{let n=t.messageId??R,r=e[e.length-1];if(r&&r.kind===`agent`&&r.messageId===n){e[e.length-1]={...r,content:r.content+(t.content??``)};return}if(n!==R&&r&&r.kind===`agent`&&r.messageId===R&&!r.isComplete&&r.content===(t.content??``)){e[e.length-1]={...r,messageId:n};return}H(e),e.push({kind:`agent`,messageId:n,content:t.content??``,isComplete:!1});return}case`agent_thought_chunk`:{let n=t.messageId??R,r=e[e.length-1];if(r&&r.kind===`thinking`&&r.messageId===n){e[e.length-1]={...r,content:r.content+(t.content??``)};return}H(e),e.push({kind:`thinking`,messageId:n,content:t.content??``,isComplete:!1});return}case`tool_call`:{let n=t.toolCallId;if(n===void 0)return;H(e),e.push({kind:`tool`,toolCallId:n,title:t.toolTitle??``,toolKind:t.toolKind,status:z(t.toolStatus,`running`),content:t.content,locations:W(t),rawInput:t.rawInput,rawOutput:t.rawOutput});return}case`tool_call_update`:{let n=t.toolCallId;if(n===void 0)return;let r=e.findIndex(e=>e.kind===`tool`&&e.toolCallId===n);if(r===-1)return;let i=e[r],a=W(t);e[r]={...i,title:t.toolTitle??i.title,toolKind:t.toolKind??i.toolKind,status:z(t.toolStatus,i.status),content:t.content??i.content,locations:a??i.locations,rawInput:t.rawInput===void 0?i.rawInput:t.rawInput,rawOutput:t.rawOutput===void 0?i.rawOutput:t.rawOutput};return}case`plan`:{let n=pe(t.content);if(n===null)return;let r=e.findIndex(e=>e.kind===`plan`),i={kind:`plan`,entries:n};r===-1?(H(e),e.push(i)):e[r]=i;return}}}function W(e){let t=e.locations;if(!Array.isArray(t))return;let n=[];for(let e of t){let t=e??{};typeof t.path==`string`&&n.push(typeof t.line==`number`?{path:t.path,line:t.line}:{path:t.path})}return n}function pe(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}let n=Array.isArray(t)?t:Array.isArray(t?.entries)?t.entries:null;return n===null?null:n.map(e=>{let t=e??{},n=t.content??t.label??``;return{label:typeof n==`string`?n:String(n),checked:t.checked===!0||t.status===`completed`}})}function me(e){let t=[];for(let n of e)U(t,n);return t}function he(e,t){if(e===t)return{kind:`identity`};if(e===null)return{kind:`first`};if(t.length<e.length)return{kind:`fallback`};for(let n=0;n<e.length;n++)if(e[n]!==t[n])return n===e.length-1&&t.length===e.length?{kind:`mutate-last`}:{kind:`fallback`};return t.length===e.length?{kind:`identity`}:{kind:`append`,from:e.length}}function ge(){let e=null,t=[];function n(n){return t=me(n),e=n,t}function r(r){let i=he(e,r);switch(i.kind){case`identity`:return t;case`first`:return n(r);case`append`:{let n=t.slice();for(let e=i.from;e<r.length;e++)U(n,r[e]);return e=r,t=n,t}case`mutate-last`:case`fallback`:return n(r)}}return{project:r}}function _e(e){let t=(0,L.useRef)(null);return t.current??=ge(),t.current.project(e)}function G(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{let t=e.trimStart();return t.startsWith(`{`)||t.startsWith(`[`)?[]:[{type:`content`,text:e}]}let n=Array.isArray(t)?t:[t],r=[];for(let e of n){let t=ve(e);t&&r.push(t)}return r}function ve(e){if(typeof e!=`object`||!e)return null;let t=e;switch(t.type){case`content`:return{type:`content`,text:ye(t.content)};case`diff`:return typeof t.path!=`string`||typeof t.newText!=`string`?null:{type:`diff`,path:t.path,newText:t.newText,...typeof t.oldText==`string`?{oldText:t.oldText}:{}};case`terminal`:{let e=be(t);return e===void 0?{type:`terminal`}:{type:`terminal`,text:e}}default:return null}}function ye(e){if(typeof e==`string`)return e;if(typeof e==`object`&&e){let t=e.text;if(typeof t==`string`)return t}return``}function be(e){if(typeof e.text==`string`)return e.text;if(typeof e.output==`string`)return e.output;if(typeof e.content==`string`)return e.content;if(typeof e.content==`object`&&e.content!==null){let t=e.content.text;if(typeof t==`string`)return t}}function K(e){if(typeof e!=`object`||!e)return;let t=e.command;return typeof t==`string`?t:void 0}function q(e){return G(e).filter(e=>e.type===`content`||e.type===`terminal`).map(e=>`text`in e?e.text??``:``).filter(e=>e.length>0).join(`
|
|
2
2
|
`)}function J(e){if(e!=null){if(typeof e==`string`)return e;if(typeof e==`object`)try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)}}function Y(e,t){let n=new Map;for(let t of e)t.type===`diff`&&n.set(t.path,{path:t.path,newText:t.newText,...t.oldText===void 0?{}:{oldText:t.oldText}});for(let e of t??[])n.has(e.path)||n.set(e.path,{path:e.path});return Array.from(n.values())}var X=v();function xe({content:e,isComplete:t,assistantId:n}){return(0,X.jsxs)(`div`,{"data-testid":`acp-chat-agent-message`,className:`flex w-full flex-col items-start text-chat text-[var(--content-default)]`,children:[(0,X.jsx)(m,{content:e,assistantId:n}),!t&&(0,X.jsx)(i,{className:`mt-1`,"data-testid":`acp-chat-agent-streaming`})]})}function Se({entries:e}){let{t}=_(`chat`);return e.length===0?null:(0,X.jsxs)(`div`,{"data-testid":`acp-chat-plan-block`,className:`w-full rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3`,children:[(0,X.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 text-[var(--content-tertiary)]`,children:[(0,X.jsx)(te,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,X.jsx)(o,{variant:`body-small-emphasised`,className:`text-inherit`,children:t(`acpChatPlanBlock.plan`)})]}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:e.map((e,t)=>(0,X.jsxs)(`li`,{"data-testid":`acp-chat-plan-entry`,"data-checked":e.checked,className:`flex items-start gap-2`,children:[e.checked?(0,X.jsx)(k,{"aria-hidden":!0,className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}):(0,X.jsx)(j,{"aria-hidden":!0,className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-disabled)]`}),(0,X.jsx)(`span`,{className:e.checked?`text-body-small-default text-[var(--content-tertiary)] line-through`:`text-body-small-default text-[var(--content-default)]`,children:e.label})]},t))})]})}function Ce(e){switch(e){case`max_tokens`:case`max_turn_requests`:return g(`chat:acpChatTerminalBlock.stoppedLimitReached`);case`refusal`:return g(`chat:acpChatTerminalBlock.refused`);case`cancelled`:return g(`chat:acpChatTerminalBlock.cancelled`);default:return g(`chat:acpChatTerminalBlock.completed`)}}function we(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function Z({completedAt:e}){let{t}=_(`chat`);return e===void 0?null:(0,X.jsx)(`span`,{"data-testid":`acp-chat-terminal-time`,children:t(`acpChatTerminalBlock.atTime`,{time:we(e)})})}function Te({status:e,stopReason:t,error:n,completedAt:r}){let{t:i}=_(`chat`);if(d(e))return null;if(e===`failed`)return(0,X.jsxs)(`div`,{"data-testid":`acp-chat-terminal-block`,"data-terminal-kind":`failed`,className:`flex items-start gap-2 rounded-md bg-[var(--system-negative-weak)] px-3 py-2 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,"data-testid":`acp-chat-terminal-failed-icon`,className:`flex h-[12px] w-4 shrink-0 items-center justify-center`,children:(0,X.jsx)(x,{className:`h-4 w-4`})}),(0,X.jsx)(`span`,{children:n??i(`acpChatTerminalBlock.runFailed`)})]});if(e===`cancelled`)return(0,X.jsxs)(`div`,{"data-testid":`acp-chat-terminal-block`,"data-terminal-kind":`cancelled`,className:`flex items-center gap-2 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,X.jsx)(S,{"aria-hidden":!0,className:`h-4 w-4 shrink-0`}),(0,X.jsx)(`span`,{children:i(`acpChatTerminalBlock.cancelled`)}),(0,X.jsx)(Z,{completedAt:r})]});let a=Ce(t);return(0,X.jsxs)(`div`,{"data-testid":`acp-chat-terminal-block`,"data-terminal-kind":`completed`,className:`flex items-center gap-2 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,X.jsx)(k,{"aria-hidden":!0,className:`h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}),(0,X.jsx)(`span`,{children:a}),(0,X.jsx)(Z,{completedAt:r})]})}function Ee({showDot:e,isLast:t,children:n}){return(0,X.jsxs)(`div`,{className:`relative flex items-start gap-2${t?``:` pb-4`}`,children:[!t&&(0,X.jsx)(`div`,{"aria-hidden":!0,className:`absolute bottom-0 left-[6.5px] w-px bg-[var(--border-element)] ${e?`top-[16px]`:`top-0`}`}),e?(0,X.jsx)(`span`,{"aria-hidden":!0,"data-testid":`acp-chat-timeline-dot`,className:`flex h-[14px] w-[14px] shrink-0 items-center justify-center`,children:(0,X.jsx)(`span`,{className:`h-[5px] w-[5px] rounded-full bg-[var(--content-disabled)]`})}):(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-[14px] w-[14px] shrink-0`}),(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:n})]})}function De({content:e,isComplete:t,assistantId:n}){let[r,a]=(0,L.useState)(null),o=r??!t,s=e.trim().length>0,c=t?`Thought process`:`Thinking`,l=t?(0,X.jsx)(M,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,X.jsx)(i,{dotSize:5,className:`shrink-0`,"data-testid":`acp-chat-thinking-streaming`});return s?(0,X.jsxs)(`div`,{"data-testid":`acp-chat-thinking-block`,className:`w-full`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":o,onClick:()=>a(!o),"data-testid":`acp-chat-thinking-toggle`,className:`flex w-full items-center gap-1.5 text-body-small-default text-[var(--content-tertiary)] transition-colors hover:text-[var(--content-secondary)]`,children:[o?(0,X.jsx)(T,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,X.jsx)(A,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),l,(0,X.jsx)(`span`,{children:c})]}),o&&(0,X.jsx)(`div`,{"data-testid":`acp-chat-thinking-body`,className:`mt-1.5 border-l-2 border-[var(--border-base)] pl-3 text-body-small-default text-[var(--content-tertiary)]`,children:(0,X.jsx)(m,{content:e,assistantId:n})})]}):(0,X.jsx)(`div`,{"data-testid":`acp-chat-thinking-block`,className:`w-full`,children:(0,X.jsxs)(`div`,{className:`flex w-full items-center gap-1.5 text-body-small-default text-[var(--content-tertiary)]`,children:[l,(0,X.jsx)(`span`,{children:c})]})})}var Oe={running:`neutral`,completed:`positive`,error:`negative`,ended:`neutral`},ke={running:`Running`,completed:`Completed`,error:`Failed`,ended:`Ended`},Ae={read:`Read file`,edit:`Edit file`,delete:`Delete file`,move:`Move file`,search:`Search`,execute:`Run command`,think:`Thinking`,fetch:`Fetch`,switch_mode:`Switch mode`},je=`Tool call`,Me={read:N,edit:fe,delete:oe,move:E,search:ie,execute:D,think:M,fetch:ne,switch_mode:O},Ne=new Set([`read`,`edit`,`delete`,`move`]);function Pe({toolKind:e}){return(0,X.jsx)(e&&Me[e]||se,{"aria-hidden":!0,className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`})}function Q({label:e,value:t,testId:n}){return(0,X.jsxs)(`div`,{"data-testid":n,children:[(0,X.jsx)(`div`,{className:`mb-1 text-body-small-default text-[var(--content-tertiary)]`,children:e}),(0,X.jsx)(`pre`,{className:`max-h-60 overflow-auto rounded-md border border-[var(--border-element)] bg-[var(--surface-base)] p-2.5 font-mono text-body-small-default text-[var(--content-secondary)]`,children:t})]})}function Fe({block:e,isTerminal:t=!1,onOpenDiff:n,onOpenOutput:a}){let{t:s}=_(`chat`),[c,l]=(0,L.useState)(!1),u=(0,L.useMemo)(()=>G(e.content),[e.content]),d=(0,L.useMemo)(()=>q(e.content),[e.content]),f=(0,L.useMemo)(()=>d.split(`
|
|
3
3
|
`).map(e=>e.trim()).find(e=>e.length>0&&!e.startsWith("```"))||`View output`,[d]),p=(0,L.useMemo)(()=>Y(u,e.locations),[u,e.locations]),m=t&&e.status===`running`?`ended`:e.status,h=m===`running`,g=e.toolKind&&Ae[e.toolKind]||je,v=K(e.rawInput)??e.title,y=v&&v!==g&&(!Ne.has(e.toolKind??``)||p.length===0)?v:null,b=J(e.rawInput),x=J(e.rawOutput),S=b!==void 0||x!==void 0;return(0,X.jsxs)(`div`,{"data-testid":`acp-chat-tool-card`,"data-status":e.status,className:`w-full rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Pe,{toolKind:e.toolKind}),(0,X.jsx)(o,{variant:`body-small-emphasised`,className:`min-w-0 flex-1 truncate text-[var(--content-default)]`,title:e.title,children:g}),(0,X.jsx)(r,{tone:Oe[m],"data-testid":`acp-chat-tool-status`,children:ke[m]}),h&&(0,X.jsx)(i,{className:`shrink-0`,"data-testid":`acp-chat-tool-running`})]}),y&&(0,X.jsx)(`div`,{"data-testid":`acp-chat-tool-detail`,className:`mt-1.5 font-mono text-body-small-default whitespace-pre-wrap break-words text-[var(--content-secondary)]`,children:y}),p.length>0&&(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:p.map(t=>{let r=t.oldText!==void 0||t.newText!==void 0,i=`flex max-w-full items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-2 py-1 text-body-small-default text-[var(--content-secondary)]`;return r?(0,X.jsxs)(`button`,{type:`button`,"data-testid":`acp-chat-tool-file-chip`,onClick:()=>n(e.toolCallId,t),title:t.path,className:`${i} cursor-pointer transition-colors hover:bg-[var(--surface-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--border-focus)]`,children:[(0,X.jsx)(N,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`truncate font-mono`,children:t.path})]},t.path):(0,X.jsxs)(`span`,{"data-testid":`acp-chat-tool-file-ref`,title:t.path,className:i,children:[(0,X.jsx)(N,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`truncate font-mono`,children:t.path})]},t.path)})}),d.length>0&&(0,X.jsxs)(`button`,{type:`button`,"data-testid":`acp-chat-tool-output-open`,onClick:()=>a?.(e.toolCallId),className:`mt-2 flex w-full items-center gap-2 rounded-md border border-[var(--border-element)] bg-[var(--surface-base)] px-2.5 py-2 text-left transition-colors hover:bg-[var(--surface-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--border-focus)]`,children:[(0,X.jsx)(D,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-tertiary)]`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-body-small-default text-[var(--content-secondary)]`,children:f}),(0,X.jsx)(A,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-tertiary)]`})]}),S&&(0,X.jsxs)(`div`,{className:`mt-2`,"data-testid":`acp-chat-tool-raw`,children:[(0,X.jsxs)(`button`,{type:`button`,"data-testid":`acp-chat-tool-raw-toggle`,"aria-expanded":c,onClick:()=>l(e=>!e),className:`flex items-center gap-1 text-body-small-default text-[var(--content-tertiary)] transition-colors hover:text-[var(--content-default)]`,children:[c?(0,X.jsx)(T,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,X.jsx)(A,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,X.jsx)(`span`,{children:s(c?`acpChatToolCard.hideRaw`:`acpChatToolCard.showRaw`)})]}),c&&(0,X.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-2`,children:[b!==void 0&&(0,X.jsx)(Q,{label:s(`acpChatToolCard.rawInput`),value:b,testId:`acp-chat-tool-raw-input`}),x!==void 0&&(0,X.jsx)(Q,{label:s(`acpChatToolCard.rawOutput`),value:x,testId:`acp-chat-tool-raw-output`})]})]})]})}function Ie({content:e}){return(0,X.jsx)(`div`,{"data-testid":`acp-chat-user-turn`,className:`flex w-full justify-end`,children:(0,X.jsx)(`div`,{className:`max-w-[80%] rounded-lg bg-[var(--surface-lift)] px-4 py-3 whitespace-pre-wrap text-chat text-[var(--content-default)]`,children:e})})}function Le({model:e,options:t}){let{t:n}=_(`chat`),r=t?.find(t=>t.value===e)?.label??e;return(0,X.jsx)(ce,{icon:(0,X.jsx)(ee,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),value:r,valueTitle:r,label:n(`acpRunChatView.modelLabel`)})}function Re({content:e,assistantId:t}){return(0,X.jsx)(`div`,{"data-testid":`acp-chat-command-output`,className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3 [&_pre]:!max-h-none`,children:(0,X.jsx)(m,{content:q(e),hardLineBreaks:!0,assistantId:t})})}var ze=80;function Be(e){return e.scrollHeight-e.clientHeight-e.scrollTop<=ze}function Ve(e){let t=(0,L.useRef)(null),n=(0,L.useRef)(!0),[r,i]=(0,L.useState)(!1),a=(0,L.useCallback)(()=>{let e=t.current;e&&(e.scrollTop=e.scrollHeight)},[]),o=(0,L.useCallback)(()=>{let e=t.current;if(!e)return;let r=Be(e);n.current=r,i(e=>e===!r?e:!r)},[]),s=(0,L.useCallback)(()=>{n.current=!0,a(),i(!1)},[a]),c=(0,L.useCallback)(e=>{let r=t.current;r&&r.removeEventListener(`scroll`,o),t.current=e,e&&(e.addEventListener(`scroll`,o,{passive:!0}),n.current?e.scrollTop=e.scrollHeight:o())},[o]);return(0,L.useLayoutEffect)(()=>{n.current?a():o()},[e,a,o]),{scrollRef:c,showScrollToLatest:r,scrollToLatest:s}}function $(e,t){switch(e.kind){case`user`:return`user-${e.id||t}`;case`agent`:return`agent-${e.messageId||t}`;case`thinking`:return`thinking-${e.messageId||t}`;case`tool`:return`tool-${e.toolCallId}`;case`plan`:return`plan`}}var He=[];function Ue({entry:e,onClose:n,assistantId:r}){let{t:i}=_(`chat`),a=d(e.status),{model:s}=e,c=e.inputTokens!==void 0||e.outputTokens!==void 0,l=_e(p(t=>t.byId[e.acpSessionId]?.events??He)),[u,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(e.acpSessionId);h!==e.acpSessionId&&(g(e.acpSessionId),m(null));let v=(0,L.useCallback)((e,t)=>m({kind:`diff`,toolCallId:e,path:t.path}),[]),y=(0,L.useCallback)(e=>m({kind:`output`,toolCallId:e}),[]),x=(0,L.useCallback)(()=>m(null),[]),S=(0,L.useMemo)(()=>u?l.find(e=>e.kind===`tool`&&e.toolCallId===u.toolCallId)??null:null,[u,l]),C=(0,L.useMemo)(()=>u?.kind!==`diff`||!S?null:Y(G(S.content),S.locations).find(e=>e.path===u.path)??null,[u,S]),w=u?.kind===`diff`?u.path:S?K(S.rawInput)??S.title??`Output`:`Output`,{scrollRef:T,showScrollToLatest:E,scrollToLatest:D}=Ve((0,L.useMemo)(()=>({blocks:l,status:e.status,completedAt:e.completedAt}),[l,e.status,e.completedAt])),O=!a;return(0,X.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden rounded-xl bg-[var(--surface-lift)]`,children:[u&&(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-[var(--border-hover)] px-5 py-3`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:x,title:e.agent,className:`min-w-0 shrink cursor-pointer truncate text-left text-[var(--content-default)] hover:underline`,children:(0,X.jsx)(o,{variant:`body-small-default`,as:`span`,children:e.agent})}),(0,X.jsx)(A,{className:`h-2.5 w-2.5 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":!0}),(0,X.jsx)(o,{variant:`body-small-default`,as:`span`,title:w,className:`min-w-0 shrink truncate font-mono text-[var(--content-secondary)]`,children:w})]}),(0,X.jsx)(We,{entry:e,isRunning:a,onClose:n,showBack:!!u,onBack:x},`header-${e.acpSessionId}`),u?(0,X.jsx)(`div`,{className:`flex-1 overflow-y-auto px-5 py-5`,children:u.kind===`diff`?(0,X.jsx)(le,{path:u.path,oldText:C?.oldText,newText:C?.newText}):(0,X.jsx)(Re,{content:S?.content,assistantId:r})}):(0,X.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,X.jsxs)(`div`,{ref:T,"data-testid":`acp-chat-conversation`,className:`flex h-full flex-col gap-4 overflow-y-auto px-5 py-5`,children:[(c||s!==void 0)&&(0,X.jsxs)(`div`,{className:f(`grid gap-3`,c?`grid-cols-2`:`grid-cols-1`),"data-testid":`acp-run-metrics`,children:[c&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(I,{icon:(0,X.jsx)(re,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:e.inputTokens??0,format:e=>F(Math.round(e)),label:i(`acpRunChatView.inputLabel`)}),(0,X.jsx)(I,{icon:(0,X.jsx)(P,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),target:e.outputTokens??0,format:e=>F(Math.round(e)),label:i(`acpRunChatView.outputLabel`)})]}),s!==void 0&&(0,X.jsx)(`div`,{className:c?`col-span-2`:void 0,children:(0,X.jsx)(Le,{model:s,options:e.availableModels})})]}),(0,X.jsx)(Ge,{task:e.task}),(0,X.jsx)(`div`,{className:`flex flex-col`,"data-testid":`acp-chat-timeline`,children:l.map((e,t)=>(0,X.jsx)(Ee,{showDot:t===0||t===l.length-1||e.kind===`tool`||e.kind===`plan`,isLast:t===l.length-1,children:(0,X.jsx)(Ke,{block:e,isTerminal:O,onOpenDiff:v,onOpenOutput:y,assistantId:r})},$(e,t)))}),!a&&(0,X.jsx)(Te,{status:e.status,stopReason:e.stopReason,error:e.error,completedAt:e.completedAt})]}),E&&(0,X.jsx)(t,{variant:`outlined`,size:`compact`,iconOnly:(0,X.jsx)(b,{}),onClick:D,"aria-label":i(`acpRunChatView.goToNewest`),tooltip:i(`acpRunChatView.goToNewest`),"data-testid":`acp-chat-scroll-to-latest`,className:`absolute bottom-3 left-1/2 -translate-x-1/2 rounded-full shadow-md`})]}),a&&!u&&(0,X.jsx)(qe,{acpSessionId:e.acpSessionId},`steer-${e.acpSessionId}`)]})}function We({entry:e,isRunning:n,onClose:r,showBack:i=!1,onBack:o}){let{t:u}=_(`chat`),[d,f]=(0,L.useState)(!1),p=h(e.status,e.stopReason),m=(0,L.useCallback)(()=>{f(!0),l(e.acpSessionId).catch(e=>{f(!1),s(e,{context:`AcpRunChatView.stop`})})},[e.acpSessionId]);return(0,X.jsx)(a,{icon:(0,X.jsxs)(X.Fragment,{children:[i&&(0,X.jsx)(t,{variant:`outlined`,iconOnly:(0,X.jsx)(C,{}),onClick:o,"aria-label":u(`acpRunChatView.backToConversationAria`),tooltip:u(`acpRunChatView.backTooltip`),"data-testid":`acp-chat-diff-back`,className:`shrink-0`}),(0,X.jsx)(c,{agent:e.agent,className:`h-5 w-5 shrink-0`})]}),title:e.agent,headerTrailing:(0,X.jsx)(de,{color:p.color,label:p.label}),headerActions:n?(0,X.jsx)(ue,{onStop:m,ariaLabel:u(`acpRunChatView.stopRunAria`),disabled:d}):void 0,closeLabel:u(`acpRunChatView.closeRunDetail`),onClose:r})}function Ge({task:e}){let{t}=_(`chat`);return e?(0,X.jsxs)(`div`,{"data-testid":`acp-chat-objective`,children:[(0,X.jsx)(o,{variant:`body-medium-default`,as:`h3`,className:`mb-1 text-[var(--content-emphasised)]`,children:t(`acpRunChatView.objective`)}),(0,X.jsx)(o,{variant:`body-medium-lighter`,as:`p`,className:`whitespace-pre-wrap break-words leading-relaxed text-[var(--content-default)]`,children:e}),(0,X.jsx)(`div`,{className:`mt-4 h-px w-full bg-[var(--border-hover)]`})]}):null}function Ke({block:e,isTerminal:t,onOpenDiff:n,onOpenOutput:r,assistantId:i}){switch(e.kind){case`user`:return(0,X.jsx)(Ie,{content:e.content});case`agent`:return(0,X.jsx)(xe,{content:e.content,isComplete:e.isComplete||t,assistantId:i});case`thinking`:return(0,X.jsx)(De,{content:e.content,isComplete:e.isComplete||t,assistantId:i});case`tool`:return(0,X.jsx)(Fe,{block:e,isTerminal:t,onOpenDiff:n,onOpenOutput:r});case`plan`:return(0,X.jsx)(Se,{entries:e.entries})}}function qe({acpSessionId:e}){let{t:r}=_(`chat`),[i,a]=(0,L.useState)(``),[o,c]=(0,L.useState)(!1);return(0,X.jsx)(`form`,{onSubmit:(0,L.useCallback)(t=>{t.preventDefault();let r=i.trim();if(!r||o)return;c(!0);let l=p.getState().appendLocalMarker({acpSessionId:e,content:`${u}${r}`});n(e,r).then(()=>a(``)).catch(t=>{l&&p.getState().removeLocalMarker({acpSessionId:e,markerId:l}),s(t,{context:`AcpRunChatView.steer`})}).finally(()=>c(!1))},[i,o,e]),"data-testid":`acp-chat-steer-form`,className:`sticky bottom-0 z-10 shrink-0 border-t border-[var(--border-hover)] bg-[var(--surface-lift)] px-5 py-3`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md bg-[var(--surface-base)] px-3 py-2`,children:[(0,X.jsx)(`input`,{type:`text`,value:i,onChange:e=>a(e.target.value),placeholder:r(`acpRunChatView.steerPlaceholder`),disabled:o,"aria-label":r(`acpRunChatView.steerAria`),className:`text-body-medium-default min-w-0 flex-1 bg-transparent text-[color:var(--content-default)] placeholder:text-[color:var(--content-tertiary)] focus:outline-none disabled:opacity-50`}),(0,X.jsx)(t,{type:`submit`,variant:`primary`,size:`compact`,iconOnly:(0,X.jsx)(ae,{}),disabled:o||i.trim()===``,"aria-label":r(`acpRunChatView.sendSteerAria`),className:`shrink-0`})]})})}function Je({entry:e,onClose:t,assistantId:n}){return(0,X.jsx)(Ue,{entry:e,onClose:t,assistantId:n})}export{Je as AcpRunDetailPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Fb as t,_y as n,a as r,ai as i,c as a,ii as o,l as s,ri as c,s as l,yc as u}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Fb as t,_y as n,a as r,ai as i,c as a,ii as o,l as s,ri as c,s as l,yc as u}from"./app-Bevxq2OH.js";import{j as d}from"./vendor-CtuA73w5.js";import{f,r as p,t as m,x as h}from"./react-B9IgSVeK.js";var g=e(h(),1),_=m();function v(){let e=f(),{t:m}=d(`activation`),h=n.use.activeAssistantId(),v=c(),y=i(),{data:b}=o(),{starters:x,items:S}=s(v??``),{launch:C,pendingTaskIds:w}=a(v??``),T=(0,g.useMemo)(()=>[...x,...S],[x,S]),E=(0,g.useCallback)(async t=>{l(await C(t),m,t=>{u(e,t)})},[C,e,m]);return v===null?y?(0,_.jsx)(p,{to:t.assistant,replace:!0}):null:(0,_.jsx)(r,{tasks:T,progress:b?.tasks,pendingTaskIds:w,onLaunch:e=>{E(e)},onOpenConversation:t=>{u(e,t)},assistantId:h??void 0})}export{v as ActivationListRoute};
|
package/dist/assets/{activity-redirect-page-Cyo877Rg.js → activity-redirect-page-CLc8hSfC.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Fb as t}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Fb as t}from"./app-Bevxq2OH.js";import{d as n,f as r,x as i}from"./react-B9IgSVeK.js";var a=e(i(),1);function o(){let e=r(),{search:i,hash:o}=n();return(0,a.useEffect)(()=>{e(`${t.assistant}${i}${o}`,{replace:!0})},[e,i,o]),null}export{o as ActivityRedirectPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Bn as n,Bt as r,Cr as i,Dc as a,Dn as o,Et as s,Gt as c,Hn as l,Ht as u,Ig as d,Kt as f,Ln as p,Mt as m,Nn as h,Qx as g,Rn as _,St as v,Ut as y,Vo as b,Zn as ee,_t as x,bt as S,cm as C,er as w,ft as te,gn as T,ht as E,jt as D,lm as O,mt as k,pt as A,vr as j,vt as M,wr as N,yt as P,zn as F,zp as I,zr as L}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Bn as n,Bt as r,Cr as i,Dc as a,Dn as o,Et as s,Gt as c,Hn as l,Ht as u,Ig as d,Kt as f,Ln as p,Mt as m,Nn as h,Qx as g,Rn as _,St as v,Ut as y,Vo as b,Zn as ee,_t as x,bt as S,cm as C,er as w,ft as te,gn as T,ht as E,jt as D,lm as O,mt as k,pt as A,vr as j,vt as M,wr as N,yt as P,zn as F,zp as I,zr as L}from"./app-Bevxq2OH.js";import{j as R}from"./vendor-CtuA73w5.js";import{t as z,x as B}from"./react-B9IgSVeK.js";import{Gi as V,Jn as H}from"./icons-DxrLl-Dj.js";import{t as U}from"./use-transcript-message-by-id-CUhOzUVt.js";import{a as W,n as G,t as K}from"./tool-detail-panel-aNvOK4DH.js";var q=e(B(),1),J=z();function Y({assistantId:e,image:t,title:n,ariaLabel:i,onPreview:a}){let o=(0,q.useRef)(null),{url:s,isError:c,isPending:l}=h(e,t,D(o)||typeof IntersectionObserver>`u`),[u,d]=(0,q.useState)(null);(0,q.useEffect)(()=>{d(null)},[t.id,t.previewUrl]);let f=s===u?null:s,p=l?null:{...t,previewUrl:f??null};return(0,J.jsx)(`div`,{ref:o,"data-testid":`activity-screenshot-tile`,"data-tool-call-id":t.toolCallId,children:(0,J.jsx)(r,{attachment:p,placeholder:c?null:(0,J.jsx)(H,{className:`h-6 w-6 animate-spin`,"aria-hidden":`true`}),labels:{title:n,ariaLabel:i,secondary:null},hideCaptions:!0,onPreview:()=>a(o.current?.firstElementChild instanceof HTMLElement?o.current.firstElementChild:null),onPreviewError:()=>d(s)})})}function X(e,t){return e[t]?.type===`activity`&&t===e.length-1}function Z(e,t){let n=t.at(-1);if(!n)return!1;let r=new Set(I(n));return I(e).some(e=>r.has(e))}function ne(e,t,n){if(!n)return e[t]?.type===`activity`?t:null;let r=t=>{let r=e[t];return!r||r.type!==`activity`?!1:_(r.items).toolCalls.some(e=>e.id===n)};if(r(t))return t;let i=e.findIndex((e,t)=>r(t));return i===-1?null:i}function re(e,t,n){let r=y(t,n.workflow),i=e=>{let t=f(e,n.workflow.byToolUseId);if(t!==null&&r.has(t))return!0;let i=u(e,n.acpByToolUseId);if(i!==null&&n.acpById[i]!==void 0)return!0;let a=c(e);return a!==void 0&&n.backgroundTaskById[a]!==void 0},a=t.filter(e=>!i(e));if(a.length===t.length)return{items:e,toolCalls:t};let o=new Set(a.map(e=>e.id));return{items:e.filter(e=>e.kind!==`toolCall`||o.has(e.toolCall.id)),toolCalls:a}}function ie(e,t,r){let o=U(e),s=i(),c=T(),l=a.use.byId(),u=a.use.byToolUseId(),d=a.use.notFoundRunIds(),f=a.use.hydrationFailedRunIds(),p=j.use.byId(),m=j.use.byToolUseId(),h=N.use.byId();return(0,q.useMemo)(()=>{if(!o||t==null)return null;let e=F(o.contentBlocks??[],n(o,c)),i=ne(e,t,r);if(i==null)return null;let a=e[i];if(!a||a.type!==`activity`)return null;let{cardItems:g,toolCalls:v}=_(a.items);return{...re(g,v,{workflow:{byId:l,byToolUseId:u,notFoundRunIds:d,hydrationFailedRunIds:f},acpById:p,acpByToolUseId:m,backgroundTaskById:h}),isLastGroup:X(e,i),isLatestMessage:Z(o,s),groupIndex:i}},[o,s,t,r,c,l,u,d,f,p,m,h])}var ae=60;function oe(e,t){return Q(e,t.flatMap(e=>e.kind===`tool`?[e.toolCallId]:[]))}function Q(e,t){let n=new Set(e.filter(e=>d(e.name,e.input)).map(e=>e.id)),r=new Map;for(let t of m(e))n.has(t.toolCallId)&&r.set(t.toolCallId,t);let i=[],a=new Set;for(let e of t){if(a.has(e))continue;let t=r.get(e);t&&(a.add(e),i.push({image:t,occurrenceKey:e}))}return i}function $({payload:e,onClose:t,assistantId:n}){return(0,J.jsx)(ce,{payload:e,onClose:t,assistantId:n},se(e))}function se(e){if(e.messageId!=null){let t=e.groupToolCallIds?.[0];return JSON.stringify(t==null?[`message`,e.messageId,`index`,e.groupIndex??null]:[`message`,e.messageId,`tool`,t])}let t=e.toolCalls[0]?.id;return JSON.stringify(t==null?[`snapshot`,`index`,e.groupIndex??null]:[`snapshot`,`tool`,t])}function ce({payload:e,onClose:n,assistantId:r}){let{t:i}=R(`chat`),[a,s]=(0,q.useState)(null),c=e.groupToolCallIds?.[0]??e.toolCalls[0]?.id,l=ie(e.messageId,e.groupIndex,c),u=l?.items??e.items,d=l?.toolCalls??e.toolCalls,f=O.use.phase(),p=l?l.isLastGroup&&l.isLatestMessage:e.messageId==null,m=E(u,{active:e.active===!0&&p&&C(f)}),h=(0,q.useMemo)(()=>u.flatMap(e=>e.kind===`toolCall`?[e.toolCall.id]:[]),[u]),_=(0,q.useMemo)(()=>Q(d,h),[d,h]),y=(0,q.useMemo)(()=>_.map(e=>e.occurrenceKey),[_]),b=(0,q.useMemo)(()=>new Map(_.map((e,t)=>[e.occurrenceKey,t])),[_]),x=(0,q.useMemo)(()=>_.map(e=>e.image),[_]),S=(0,q.useRef)(null),{openPreview:T,previewModal:D}=o(r,x,y,{scopeKey:`${r??``}:${e.messageId??``}:${c??e.groupIndex??``}`,getFallbackFocus:()=>S.current?.querySelector(`button, [role="button"][tabindex="0"]`)??null}),j=A(m.steps),M=k(m.state,m.steps),N=M===`loading`,P=te(M,m.totalDurationLabel??``,j.failed),F=N&&m.currentStepTitle||P,I=(0,q.useMemo)(()=>new Map(d.map(e=>[e.id,e])),[d]);return(0,J.jsx)(`div`,{ref:S,className:`contents`,children:(0,J.jsxs)(ee,{icon:a?(0,J.jsx)(t,{variant:`outlined`,iconOnly:(0,J.jsx)(V,{}),"aria-label":i(`activityStepsPanel.backAria`),tooltip:i(`activityStepsPanel.backTooltip`),onClick:()=>s(null),className:`shrink-0`}):void 0,titleNode:a?a.kind===`thinking`?(0,J.jsx)(g,{variant:`title-medium`,className:`min-w-0 shrink truncate py-0.5 leading-snug text-[var(--content-default)]`,children:i(`activityStepsPanel.thinkingTitle`)}):(0,J.jsx)(G,{detail:a}):(0,J.jsx)(w,{title:N?(0,J.jsx)(L,{children:F}):F,count:m.stepCount}),closeLabel:i(`activityStepsPanel.closeSteps`),onClose:n,children:[a?(0,J.jsx)(de,{detail:a,assistantId:r}):(0,J.jsx)(v,{steps:m.steps,timeline:!0,renderStep:t=>(0,J.jsx)(ue,{step:t,activeDetail:a,onOpenDetail:s,lookupToolCall:e=>I.get(e),messageId:e.messageId,groupIndex:l?.groupIndex??e.groupIndex}),renderPhaseFooter:e=>{let t=le(e,_,b);if(!t)return null;let{entry:n,step:a,index:o}=t,s=a.activity?.trim(),c=s?i(`activityStepsPanel.screenshotTitle`,{activity:s}):i(`activityStepsPanel.screenshotFallbackTitle`),l=s?i(`activityStepsPanel.screenshotAria`,{activity:s}):i(`activityStepsPanel.screenshotFallbackAria`);return(0,J.jsx)(Y,{assistantId:r,image:n.image,title:c,ariaLabel:l,onPreview:e=>T(n.image,o,e)})}}),D]})})}function le(e,t,n){if(!s(e.label))return null;for(let r=e.steps.length-1;r>=0;--r){let i=e.steps[r];if(i?.kind!==`tool`)continue;let a=n.get(i.toolCallId);if(a!==void 0)return{entry:t[a],step:i,index:a}}return null}function ue({step:e,activeDetail:t,onOpenDetail:n,lookupToolCall:r,messageId:i,groupIndex:a}){let{t:o}=R(`chat`);if(e.kind===`thinking`){let t=i!=null&&e.thinkingItemIndex!=null?{messageId:i,thinkingGroupIndex:a,thinkingItemIndex:e.thinkingItemIndex}:{};return(0,J.jsx)(P,{iconName:`brain`,label:b(l(e.text),ae),ariaLabel:o(`activityStepsPanel.viewThinkingAria`),active:!1,onClick:()=>n({kind:`thinking`,toolCallId:``,toolName:``,title:o(`activityStepsPanel.thinkingTitle`),activity:``,input:{},status:`completed`,thinkingText:e.text,...t})})}if(e.kind===`web_search`)return(0,J.jsx)(M,{step:e});if(e.kind===`web_search_error`)return(0,J.jsx)(x,{step:e});if(e.kind!==`tool`)return(0,J.jsx)(S,{step:e});let s=r(e.toolCallId);return(0,J.jsx)(P,{iconName:e.iconName,label:e.activity||e.info||e.title,active:t?.toolCallId===e.toolCallId,onClick:()=>{s&&n(p(s))}})}function de({detail:e,assistantId:t}){return(0,J.jsx)(`div`,{className:`flex flex-col gap-4`,children:e.kind===`thinking`?(0,J.jsx)(W,{detail:e,assistantId:t}):(0,J.jsx)(K,{detail:e,assistantId:t})})}export{$ as ActivityStepsPanel,oe as buildActivityScreenshotGallery};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$l as t,$x as n,Au as r,Cx as i,Fb as a,Fx as o,Zl as s,av as c,iv as l}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$l as t,$x as n,Au as r,Cx as i,Fb as a,Fx as o,Zl as s,av as c,iv as l}from"./app-Bevxq2OH.js";import{Jn as u,Zn as d,j as f}from"./vendor-CtuA73w5.js";import{_ as p,d as m,n as h,t as g,x as _}from"./react-B9IgSVeK.js";import{Hi as v,Jn as y,Wi as b}from"./icons-DxrLl-Dj.js";import{n as x}from"./android-billing-handoff-BjLOXHzL.js";import{t as S}from"./checkout-return-target-UI7zqK_V.js";var C=e(_(),1),w=g(),T=[`10.00`,`20.00`,`30.00`,`40.00`,`50.00`,`60.00`,`70.00`,`80.00`,`90.00`,`100.00`];function E(e){let t=parseFloat(e);if(Number.isNaN(t))return`0 credits`;let n=t.toLocaleString(`en-US`,{minimumFractionDigits:2,maximumFractionDigits:2});return`${n.endsWith(`.00`)?n.slice(0,-3):n} credits`}function D(e){if(e&&typeof e==`object`){let t=e.amount;if(Array.isArray(t)&&typeof t[0]==`string`)return t[0]}return`Failed to create checkout session. Please try again.`}function O({open:e,onOpenChange:g}){let{t:_}=f(),{pathname:x}=m(),[O]=p(),k=O.toString()?`${x}?${O.toString()}`:x,{data:A,isLoading:j}=d(s()),M=A?.allowed_top_up_amounts?.length?A.allowed_top_up_amounts:T,[N,P]=(0,C.useState)(null),F=N&&M.includes(N)?N:M[0]??T[0],I=u(t());return(0,C.useEffect)(()=>c(()=>{g(!1)}),[g]),r(`deeplink.billingCheckoutComplete`,({flow:e})=>{e===`top_up`&&g(!1)}),(0,w.jsx)(o.Root,{open:e,onOpenChange:g,children:(0,w.jsxs)(o.Content,{size:`sm`,children:[(0,w.jsxs)(o.Header,{children:[(0,w.jsx)(o.Title,{children:_(`addCreditsModal.title`)}),(0,w.jsx)(o.Description,{children:_(`addCreditsModal.description`)})]}),(0,w.jsx)(o.Body,{children:(0,w.jsxs)(`div`,{className:`space-y-4`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{htmlFor:`add-credits-amount`,className:`block text-body-small-default text-[var(--content-tertiary)]`,children:_(`addCreditsModal.amount`)}),(0,w.jsx)(i,{id:`add-credits-amount`,value:F,onChange:e=>{P(e),I.isError&&I.reset()},disabled:j||!A,options:M.map(e=>({value:e,label:E(e)}))})]}),I.isError&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,w.jsx)(v,{className:`h-3.5 w-3.5 shrink-0`}),D(I.error)]}),(0,w.jsxs)(h,{to:a.settings.usageBillingConfigureTopUps,className:`flex items-center gap-1 text-body-small-default text-[var(--content-tertiary)] hover:text-[var(--content-secondary)]`,onClick:()=>g(!1),children:[_(`addCreditsModal.configureAutoReload`),(0,w.jsx)(b,{className:`size-4`})]}),(0,w.jsx)(`div`,{className:`h-px w-full bg-[var(--border-subtle)]`})]})}),(0,w.jsxs)(o.Footer,{children:[(0,w.jsx)(o.Close,{asChild:!0,children:(0,w.jsx)(n,{variant:`outlined`,children:_(`addCreditsModal.cancel`)})}),(0,w.jsx)(n,{variant:`primary`,leftIcon:I.isPending?(0,w.jsx)(y,{className:`animate-spin`}):void 0,onClick:()=>{I.isPending||I.mutate({body:{amount:F,return_path:k,return_target:S()}},{onSuccess:e=>{l(e.checkout_url)}})},disabled:I.isPending||j||!A,children:_(`addCreditsModal.continue`)})]})]})})}function k(e){return x({open:e.open,path:a.settings.usageBilling,onClose:()=>e.onOpenChange(!1)})?null:(0,w.jsx)(O,{...e})}export{k as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./add-credits-modal-CXIeeHpM.js";export{e as AddCreditsModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$d as t,$v as n,$x as r,Ad as i,Ao as a,Bf as o,C_ as s,Ca as c,Co as l,Cx as u,Df as d,Dm as f,Ef as p,Eo as m,Ex as h,Fo as g,Fx as _,G as v,Gf as y,Gv as b,Gx as x,Hv as S,Hx as C,Io as w,J as T,Jg as E,Jt as D,Jv as O,K as k,Kv as A,Kx as j,Lg as M,Md as N,Mo as P,Mx as F,Nd as I,No as L,Nx as R,Od as ee,Of as te,Oo as z,Ox as B,Pd as ne,Po as re,Qd as ie,Qf as V,Qv as ae,Qx as H,Sa as oe,So as se,To as ce,Uv as le,Ux as U,Vv as ue,Vx as W,W as de,Wb as G,Wv as fe,X as pe,Xb as me,Xv as he,Xx as ge,Y as _e,Ym as ve,Yv as ye,Z as be,Zd as xe,Zn as Se,Zv as Ce,_d as we,_p as Te,a_ as Ee,ad as De,at as Oe,ay as ke,bd as Ae,bo as je,bp as Me,cd as Ne,ci as Pe,cy as Fe,dh as Ie,dp as Le,dy as Re,eS as ze,ef as Be,et as Ve,ex as K,ey as He,fp as Ue,fx as We,fy as Ge,gd as Ke,gp as qe,hp as Je,hy as Ye,id as Xe,it as Ze,iy as Qe,jd as $e,kd as et,ko as tt,li as nt,ly as rt,mh as it,mp as at,my as ot,nd as st,nt as ct,ny as lt,o_ as ut,od as dt,oy as ft,pp as pt,py as mt,q as ht,qv as gt,r_ as _t,rd as vt,rx as q,ry as yt,sd as bt,sy as xt,td as St,tx as Ct,ty as wt,uh as Tt,up as Et,uy as Dt,vd as Ot,vo as kt,vp as At,vx as jt,wo as Mt,xa as Nt,xc as Pt,xd as Ft,xo as It,xp as Lt,yb as Rt,yd as zt,yo as Bt,yp as Vt,z_ as Ht,zf as Ut}from"./app-BffxeWB8.js";import{I as J,Jn as Wt,N as Gt,Zn as Y,er as X,j as Z}from"./vendor-CtuA73w5.js";import{b as Kt,t as qt,x as Jt}from"./react-B9IgSVeK.js";import{E as Yt,Hi as Xt,It as Zt,Jn as Qt,Xr as $t,Yn as en,_t as tn,dr as nn,k as rn}from"./icons-DxrLl-Dj.js";import{t as an}from"./ellipsis-vertical-DWDUOGRm.js";import{i as on,n as sn,r as cn,t as ln}from"./service-form-controls-DTOMkj0Y.js";import{d as un,o as dn,u as fn}from"./schedules-C4v6G4Yl.js";import{t as pn}from"./stt-language-picker-modal-DPCuG3ZL.js";var Q=e(Jt(),1);function mn(){let e=Ve();return(0,Q.useCallback)(async(t,n)=>{try{let{data:r}=await Ht({path:{assistant_id:e},body:{value:n,type:`api_key`,name:t},throwOnError:!0});ue(r)}catch(e){throw e instanceof Error&&e.message===`No assistant found`?R.error(J(`settings:useDaemonConfig.assistantNotReadyToast`)):R.error(J(`settings:useDaemonConfig.saveApiKeyFailedToast`,{providerName:t})),G(e,{context:`provision_provider_key`}),e}},[e])}function hn(e){let[t,n]=(0,Q.useState)(void 0);return(0,Q.useEffect)(()=>{t!==void 0&&e===t.value&&n(void 0)},[e,t]),[t===void 0?e:t.value,(0,Q.useCallback)(e=>n(e===void 0?void 0:{value:e}),[])]}var gn=`0.11.0`;function _n(){return Tt(gn)}var $=qt(),vn=`gemini-3.1-flash-image-preview`;function yn(){let{t:e}=Z(`settings`),t=Ve(),n=X(),r=f(),{data:o}=Y({...ee({path:{assistant_id:t}}),enabled:r,staleTime:3e4}),c=y({onSuccess:e=>{i(n,{path:{assistant_id:t}},e)}}),l=mn(),[d,p]=hn((0,Q.useMemo)(()=>{if(!o)return K(Bt,`gemini`);let e=o.services?.[`image-generation`];return e?.mode===`managed`?`vellum`:e?.provider||K(`vellum:ai:imageGenProvider`,`gemini`)},[o])),[m,h]=(0,Q.useState)(()=>K(kt,vn)),g=L(d),_=g.includes(m)?m:g[0]??vn,[v,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(!1),C=tt.map(e=>({value:e,label:a[e]??e})),w=(0,Q.useMemo)(()=>L(d).map(e=>({value:e,label:z[e]??e})),[d]),T=d===`gemini`||d===`openai`,{hasStoredCredential:E}=Le({assistantId:t,credentialKind:`api_key`,credentialName:d,enabled:T}),D=p,O=(0,Q.useCallback)(async()=>{S(!0);let r=v.trim(),i=T&&r.length>0;try{i&&await l(re(_),r),await it();let a=d===`vellum`&&!_n()?{mode:`managed`}:{provider:d,mode:d===`vellum`?`managed`:`your-own`};await c.mutateAsync({path:{assistant_id:t},body:{services:{"image-generation":a}}}).catch(t=>{throw R.error(e(`imageGenerationCard.configUpdateFailedToast`)),G(t,{context:`patch_daemon_config`}),t});try{await s({path:{assistant_id:t},body:{modelId:_},throwOnError:!0})}catch(t){throw R.error(e(`imageGenerationCard.modelUpdateFailedToast`)),G(t,{context:`set_image_gen_model`}),t}finally{n.invalidateQueries({queryKey:et({path:{assistant_id:t}})})}}catch{S(!1);return}S(!1);try{if(q(Bt,d),q(kt,_),i){let e=Et(t,`api_key`,d);n.setQueryData(e,!0),n.invalidateQueries({queryKey:e}),b(``)}R.success(e(`imageGenerationCard.savedToast`))}catch(t){G(t,{context:`settings-ai-image-gen-persist-local`}),R.error(e(`imageGenerationCard.localPreferencesFailedToast`))}},[v,d,T,_,t,c,l,n,e]),k=(0,Q.useCallback)(()=>{b(``),h(vn),q(kt,vn)},[]);return(0,$.jsx)(on,{title:e(`imageGenerationCard.title`),subtitle:e(`imageGenerationCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e(`imageGenerationCard.providerLabel`)}),(0,$.jsx)(u,{"aria-label":e(`imageGenerationCard.providerAriaLabel`),value:d,onChange:D,options:C})]}),d===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`imageGenerationCard.vellumNote`)}),T&&(0,$.jsx)(U,{label:e(`imageGenerationCard.apiKeyLabel`),type:`password`,value:v,onChange:e=>b(e.target.value),placeholder:Ot(e(d===`openai`?`imageGenerationCard.openaiApiKeyPlaceholder`:`imageGenerationCard.geminiApiKeyPlaceholder`),E),fullWidth:!0}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e(`imageGenerationCard.activeModelLabel`)}),(0,$.jsx)(u,{"aria-label":e(`imageGenerationCard.modelAriaLabel`),value:_,onChange:h,options:w})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(cn,{onClick:O,disabled:x}),x&&(0,$.jsx)(Qt,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),T&&(0,$.jsx)(sn,{onClick:k})]})]})})}function bn({title:e,count:t,action:n,children:r}){return(0,$.jsxs)(`section`,{className:`rounded-xl border border-[var(--border-hover)] bg-[var(--surface-overlay)] px-3 py-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,$.jsx)(H,{variant:`body-large-default`,as:`h3`,className:`text-[var(--content-secondary)]`,children:e}),t==null?null:(0,$.jsxs)(H,{variant:`body-large-default`,as:`span`,"aria-label":`${t} ${e.toLowerCase()}`,className:`text-[var(--content-disabled)]`,children:[`·`,` `,t]})]}),n]}),r==null?null:(0,$.jsx)(`div`,{className:`mt-4 border-t border-[var(--border-base)]`,children:r})]})}function xn(e){return e.scheduleNames.length>0||e.deferredReminderCount>0||e.scheduleLookupFailed}var Sn=5;function Cn({title:e,items:t,mono:n}){return(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-(--content-tertiary)`,children:e}),(0,$.jsx)(`ul`,{className:`space-y-1 pl-1`,children:t.map(e=>(0,$.jsxs)(`li`,{className:`text-body-small-default text-(--content-secondary)`,children:[`• `,n?(0,$.jsx)(`code`,{children:e}):e]},e))})]})}function wn(e){let t=e.label||e.name,n=[];e.isActive&&n.push(J(`settings:manageProfilesBlockedDeleteModal.clauseDefaultProfile`)),e.callSiteIds.length>0&&n.push(J(`settings:manageProfilesBlockedDeleteModal.clauseActionOverrides`,{count:e.callSiteIds.length}));let r=e.scheduleNames.length,i=e.deferredReminderCount;return r>0&&i>0?n.push(J(`settings:manageProfilesBlockedDeleteModal.clauseRunsBoth`,{schedules:r,reminders:i})):r>0?n.push(J(`settings:manageProfilesBlockedDeleteModal.clauseRunsSchedules`,{count:r})):i>0&&n.push(J(`settings:manageProfilesBlockedDeleteModal.clauseRunsReminders`,{count:i})),n.length===0?J(`settings:manageProfilesBlockedDeleteModal.summaryNoReferences`,{display:t}):n.length===1?J(`settings:manageProfilesBlockedDeleteModal.summaryOneClause`,{display:t,clause1:n[0]}):n.length===2?J(`settings:manageProfilesBlockedDeleteModal.summaryTwoClauses`,{display:t,clause1:n[0],clause2:n[1]}):J(`settings:manageProfilesBlockedDeleteModal.summaryThreeClauses`,{display:t,clause1:n[0],clause2:n[1],clause3:n[2]})}function Tn({blocked:e,availableReplacements:t,replacement:n,onReplacementChange:i,error:a,saving:o,onClose:s,onConfirm:c}){let{t:l}=Z(`settings`),d=e?.scheduleNames??[],f=d.slice(0,Sn),p=d.length-f.length,m=e!=null&&xn(e);return(0,$.jsx)(_.Root,{open:e!==null,onOpenChange:e=>{e||s()},children:(0,$.jsxs)(_.Content,{size:`sm`,children:[(0,$.jsx)(_.Header,{children:(0,$.jsx)(_.Title,{children:l(`manageProfilesBlockedDeleteModal.title`)})}),(0,$.jsxs)(_.Body,{className:`space-y-4`,children:[e&&(0,$.jsx)(H,{variant:`body-medium-default`,as:`p`,children:wn(e)}),e&&e.callSiteIds.length>0&&(0,$.jsx)(Cn,{title:l(`manageProfilesBlockedDeleteModal.actionOverridesTitle`),items:e.callSiteIds,mono:!0}),f.length>0&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(Cn,{title:l(`manageProfilesBlockedDeleteModal.schedulesTitle`),items:f}),p>0&&(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`pl-1 text-(--content-tertiary)`,children:l(`manageProfilesBlockedDeleteModal.moreSchedules`,{count:p})})]}),e?.scheduleLookupFailed&&(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-(--system-mid-strong)`,children:l(`manageProfilesBlockedDeleteModal.scheduleLookupFailed`)}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-(--content-tertiary)`,children:l(`manageProfilesBlockedDeleteModal.replacementLabel`)}),(0,$.jsx)(u,{"aria-label":l(`manageProfilesBlockedDeleteModal.replacementLabel`),value:n,onChange:i,placeholder:l(`manageProfilesBlockedDeleteModal.replacementPlaceholder`),options:t.map(e=>{let t=m&&e.status===`disabled`;return{value:e.name,label:ht(e),disabled:t,tooltip:t?l(`manageProfilesBlockedDeleteModal.disabledTargetTooltip`):void 0}})})]}),a&&(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:a})]}),(0,$.jsxs)(_.Footer,{children:[(0,$.jsx)(r,{variant:`ghost`,size:`compact`,onClick:s,children:l(`manageProfilesBlockedDeleteModal.cancel`)}),(0,$.jsx)(r,{variant:`primary`,size:`compact`,disabled:!n||o,onClick:c,children:l(o?`manageProfilesBlockedDeleteModal.saving`:`manageProfilesBlockedDeleteModal.reassignAndDelete`)})]})]})})}function En({profile:e,isActiveProfile:t,selected:n,connections:i,deletePending:a=!1,onOpen:o,onMakeActive:s,onSetStatus:c,onDelete:l}){let{t:u}=Z(`settings`),d=e.source===`managed`,f=e.status===`disabled`,p=e.label??e.name,m=[];e.model&&m.push(Xe(e.provider??void 0,e.model,i)),d&&m.push(u(`profileRow.managedByVellum`));let g=e.availability,_=e.config_issue,v=_!=null||g?.status===`incomplete`,y=g?.message??u(`profileRow.providerUnavailableDefault`),b=_==null?g!=null&&g.status!==`ok`?v?u(`profileRow.providerUnavailableFixable`,{message:y}):y:null:u(`profileRow.providerUnavailableFixable`,{message:u(_.code===`over_output_cap`?`profileRow.configIssueOverOutputCap`:_.code===`no_input_room`?`profileRow.configIssueNoInputRoom`:`profileRow.configIssueModelUnknown`)});return(0,$.jsx)(We,{title:(0,$.jsx)(`span`,{className:f?`opacity-55`:void 0,children:p}),subtitle:m.length>0?m.join(` • `):void 0,onClick:o,showChevron:!1,selected:n,disabled:a,contentAriaLabel:u(`profileRow.openProfileAriaLabel`,{displayName:p}),trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[b==null?null:(0,$.jsx)(ze,{content:b,children:v?(0,$.jsx)(`button`,{type:`button`,onClick:o,"aria-label":b,className:`inline-flex cursor-pointer rounded-sm p-0.5 keyboard-focus:ring-2 keyboard-focus:ring-[var(--ring)]`,children:(0,$.jsx)(Xt,{className:`h-4 w-4 text-[var(--system-mid-strong)]`,"aria-hidden":`true`})}):(0,$.jsx)(`span`,{className:`inline-flex p-0.5`,tabIndex:0,children:(0,$.jsx)(Xt,{className:`h-4 w-4 text-[var(--system-mid-strong)]`,"aria-label":b,role:`img`})})}),f?(0,$.jsx)(j,{tone:`neutral`,children:u(`profileRow.disabledTag`)}):null,t?(0,$.jsx)(j,{tone:`positive`,children:u(`profileRow.defaultTag`)}):null,(0,$.jsxs)(B.Root,{children:[(0,$.jsx)(B.Trigger,{asChild:!0,children:(0,$.jsx)(r,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(an,{}),"aria-label":u(`profileRow.actionsAriaLabel`,{displayName:p}),disabled:a})}),(0,$.jsxs)(B.Content,{align:`end`,sideOffset:4,children:[(0,$.jsx)(B.Item,{onSelect:o,children:u(d?`profileRow.view`:`profileRow.edit`)}),!t&&!f&&Re(e.provider,e.model)?(0,$.jsx)(B.Item,{onSelect:s,children:u(`profileRow.makeDefault`)}):null,f?(0,$.jsx)(B.Item,{onSelect:()=>c(!0),children:u(`profileRow.enable`)}):d?null:(0,$.jsx)(B.Item,{onSelect:()=>c(!1),children:u(`profileRow.disable`)}),d?null:(0,$.jsx)(B.Item,{onSelect:l,className:h.anchored,children:u(`profileRow.delete`)})]})]})]})})}function Dn(e,t){let n=Pe(),{data:r}=Y({...xe({path:{assistant_id:e}}),enabled:n,staleTime:3e4}),{profiles:i,profileOrder:a}=de(t?.llm,e);return(0,Q.useMemo)(()=>r==null?{entries:S(i,a).map(e=>({name:e.name,label:e.label??null,provider:e.provider??null,model:e.model??null,status:e.status===`disabled`?`disabled`:`active`,source:e.source===`managed`?`managed`:`user`,provider_connection:e.provider_connection,availability:null})),isEffectiveCatalog:!1}:{entries:r.profiles,isEffectiveCatalog:!0},[r,i,a])}var On=`0.10.8`;function kn(e){return Ie(On,e)}var An=`settings-ai-profile-make-active`,jn=`Failed to set the active profile. Please try again.`;function Mn(e){let t=st(),n=X(),r=kn(e),i=V({onSuccess:()=>{n.invalidateQueries({queryKey:et({path:{assistant_id:e}})}),n.invalidateQueries({queryKey:ie({path:{assistant_id:e}})})}});async function a(n,r,i){try{await t.mutateAsync({path:{assistant_id:e},body:{llm:n}})}catch(e){throw G(e,{context:r}),R.error(i),e}}async function o(t){if(!r){await a({activeProfile:t},An,jn);return}try{await i.mutateAsync({path:{assistant_id:e},body:{name:t}})}catch(e){let t=me(e);throw R.error(t??jn),t||G(e,{context:An}),e}}return{makeActive:o,setStatus:(e,t)=>a({profiles:{[e]:{status:t?`active`:`disabled`}}},`settings-ai-profile-toggle`,`Failed to update the profile. Please try again.`),deleteProfile:(e,t,n)=>a({profiles:{[e]:null},profileOrder:t.filter(t=>t!==e),...n?.isAdvisor?{advisorProfile:null}:{}},`settings-ai-profile-delete`,`Failed to delete the profile. Please try again.`),patchLlm:a,isPending:t.isPending||i.isPending}}var Nn=`The profile was not deleted.`,Pn=`Failed to move the schedules. ${Nn}`;function Fn(e){let t=me(e);return t?`${/[.!?]$/.test(t)?t:`${t}.`} ${Nn}`:Pn}function In(e,t,n){let r=Mn(e),i=X(),a=be(),o=t?.llm?.activeProfile??null,s=t?.llm?.advisorProfile??null,c=t?.llm?.callSites??{},l=(0,Q.useMemo)(()=>t?.llm?.profiles??{},[t?.llm?.profiles]),u=(0,Q.useMemo)(()=>t?.llm?.profileOrder??[],[t?.llm?.profileOrder]),f=(0,Q.useMemo)(()=>S(l,u),[l,u]),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(``),[x,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(null),E=(0,Q.useRef)(!1);function D(e){return f.filter(t=>t.name===e?!1:t.status===`disabled`?!0:v(t,f,{requireOwnProviderAndModel:a}))}function O(e,t){let n=D(e).filter(e=>!t||e.status!==`disabled`),r=n.find(e=>e.name===o),i=n.find(e=>e.source!==`managed`);return(r??i??n[0])?.name??``}async function k(e){try{await r.deleteProfile(e,u,{isAdvisor:e===s}),n?.onDeleted?.(e)}catch{}}async function A(t){let n=l[t]?.label??t,r=t===o,a=Object.entries(c).filter(([e,n])=>e!==`mainAgent`&&n?.profile===t).map(([e])=>e),s=[],u=0,d=!1;try{let n=(await i.fetchQuery({...p({path:{assistant_id:e},query:{inference_profile:t,include_all:`true`}}),retry:!1,staleTime:0})).schedules??[];s=n.filter(e=>!e.isDeferred).map(e=>e.name),u=n.filter(e=>e.isDeferred).length}catch(e){G(e,{context:`settings-ai-profile-delete-schedule-scan`}),d=!0}if(!(r||a.length>0||s.length>0||u>0)&&!d){await k(t);return}let f={name:t,label:n,isActive:r,callSiteIds:a,scheduleNames:s,deferredReminderCount:u,scheduleLookupFailed:d};h(f),b(O(t,xn(f))),_(null)}function j(e){t==null||E.current||(E.current=!0,T(e),A(e).finally(()=>{E.current=!1,T(null)}))}async function M(){if(!m||!y)return;if(C(!0),_(null),xn(m))try{await dn(e,m.name,y),await i.invalidateQueries({queryKey:d({path:{assistant_id:e}})})}catch(e){G(e,{context:`settings-ai-profile-reassign-schedules`}),_(Fn(e)),C(!1);return}let t={};if(m.isActive&&(t.activeProfile=y),m.callSiteIds.length>0){let e={};for(let t of m.callSiteIds)e[t]={profile:y};t.callSites=e}if(Object.keys(t).length>0)try{await r.patchLlm(t,`settings-ai-profile-reassign-delete`,`Failed to reassign references. Please try again.`)}catch{_(`Failed to reassign references. Please try again.`),C(!1);return}let n=m.name;h(null),C(!1),k(n)}return{requestDelete:j,pendingDeleteName:w,blockedDeleteModalProps:{blocked:m,availableReplacements:D(m?.name??null),replacement:y,onReplacementChange:b,error:g,saving:x,onClose:()=>{h(null),_(null)},onConfirm:()=>void M()}}}function Ln(){}function Rn({assistantId:e,config:t,connections:n,selectedProfileName:i,onOpenProfile:a,onCreateProfile:o,onProfileDeleted:s}){let{t:c}=Z(`settings`),{entries:l}=Dn(e,t),u=Mn(e),d=In(e,t,{onDeleted:s}),f=t?.llm?.activeProfile??null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(bn,{title:c(`profilesSection.title`),action:(0,$.jsx)(r,{variant:`primary`,onClick:o,leftIcon:(0,$.jsx)(Zt,{}),disabled:t==null,children:c(`profilesSection.createProfile`)}),children:t==null?(0,$.jsx)(H,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:c(`profilesSection.loading`)}):l.length===0?(0,$.jsx)(H,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:c(`profilesSection.emptyState`)}):l.map(e=>(0,$.jsx)(En,{profile:e,isActiveProfile:e.name===f,selected:e.name===i,connections:n,deletePending:d.pendingDeleteName===e.name,onOpen:()=>a(e.name),onMakeActive:()=>void u.makeActive(e.name).catch(Ln),onSetStatus:t=>void u.setStatus(e.name,t).catch(Ln),onDelete:()=>d.requestDelete(e.name)},e.name))}),(0,$.jsx)(Tn,{...d.blockedDeleteModalProps})]})}var zn={anthropic:!0,openai:!0,gemini:!0,fireworks:!0,openrouter:!0,chatgpt:!0,vellum:!0,together:!0,"vercel-ai-gateway":!0,minimax:!0,atlascloud:!0,baseten:!0,poolside:!0};function Bn(e){return e in zn}function Vn(e){if(!e.baseUrl)return null;try{return new URL(e.baseUrl).host}catch{return e.baseUrl}}function Hn(e){let t=Vn(e)??``,n=[];t&&n.push(t);let r=e.models?.length??0;return r>0&&n.push(`${r} ${r===1?`model`:`models`}`),e.auth.type===`none`&&n.push(`keyless`),n.join(` · `)}function Un(e){switch(e.auth.type){case`api_key`:return`Own API key`;case`oauth_subscription`:return`ChatGPT subscription`;case`none`:return`No API key needed`;default:return null}}function Wn(e){if(e.provider===`vellum`)return`Included with your plan`;if(e.provider===`openai-compatible`)return Hn(e);let t=[];if(e.provider===`ollama`||e.provider===`opencode`){let n=Vn(e);n&&t.push(n)}let n=e.provider===`chatgpt`?`openai`:e.provider,r=e.auth.type===`oauth_subscription`?dt(n):mt(n),i=e.models?.length??r.length;i>0&&t.push(`${i} ${i===1?`model`:`models`}`);let a=Un(e);return a&&t.push(a),t.join(` • `)}function Gn({connection:e,isDefault:t,supportsDefaultProvider:n,selected:i,isSettingDefault:a,onOpen:o,onSetDefault:s,onDelete:c}){let{t:l}=Z(`settings`),u=e.isManaged??!1,d=At(e),f=Bn(e.provider),p=Wn(e),m=n&&!t&&f,g=!u&&o!=null,_=!u&&!t,v=m||g||_;return(0,$.jsx)(We,{title:d,subtitle:p.length>0?p:void 0,onClick:o,showChevron:!1,selected:i,contentAriaLabel:o?l(`providerRow.openProviderAriaLabel`,{displayName:d}):void 0,trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsx)(j,{tone:`neutral`,title:l(`providerRow.managedTagTitle`),children:l(`providerRow.managedTag`)}):null,t?(0,$.jsx)(j,{tone:`info`,title:l(`providerRow.defaultTagTitle`),children:l(`providerRow.defaultTag`)}):null,e.provider===`ollama`?(0,$.jsx)(j,{tone:`neutral`,title:l(`providerRow.localTagTitle`),children:l(`providerRow.localTag`)}):null,e.provider===`openai-compatible`?(0,$.jsx)(j,{tone:`neutral`,title:l(`providerRow.customTagTitle`),children:l(`providerRow.customTag`)}):null,v?(0,$.jsxs)(B.Root,{children:[(0,$.jsx)(B.Trigger,{asChild:!0,children:(0,$.jsx)(r,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(an,{}),"aria-label":l(`providerRow.actionsAriaLabel`,{displayName:d})})}),(0,$.jsxs)(B.Content,{align:`end`,sideOffset:4,children:[g?(0,$.jsx)(B.Item,{onSelect:o,children:l(`providerRow.edit`)}):null,m?(0,$.jsx)(B.Item,{disabled:a,onSelect:s,children:l(`providerRow.setAsDefault`)}):null,_?(0,$.jsx)(B.Item,{onSelect:c,className:h.anchored,children:l(`providerRow.delete`)}):null]})]}):(0,$.jsx)(`span`,{className:`inline-block w-8`,"aria-hidden":!0})]})})}function Kn(e,t){let n=X(),r={path:{assistant_id:e}},i=Wt({...ne(),onSuccess:()=>{n.invalidateQueries({queryKey:I(r)}),n.invalidateQueries({queryKey:et(r)}),n.invalidateQueries({queryKey:ie(r)})},onError:e=>{G(e,{context:`settings-ai-set-default-provider`}),R.error(J(`settings:useProviderActions.setDefaultFailedToast`))}});function a(t){Bn(t.provider)&&i.mutate({path:{assistant_id:e},body:{provider:t.provider,connectionName:t.name}})}function o(e){return i.isPending&&i.variables?.body?.connectionName===e}async function s(i){try{let{response:a}=await Ee({path:{assistant_id:e,name:i}});a?.ok||a?.status===404?(n.invalidateQueries({queryKey:Be(r)}),t?.onDeleted?.(i)):a?.status===409?R.error(J(`settings:useProviderActions.deleteInUseToast`)):R.error(J(`settings:useProviderActions.deleteFailedToast`))}catch(e){G(e,{context:`settings-ai-provider-delete`}),R.error(J(`settings:useProviderActions.deleteFailedToast`))}}return{setDefault:a,isSettingDefault:o,deleteConnection:s}}function qn({assistantId:e,selectedConnectionName:n,onOpenConnection:i,onAddProvider:a,onConnectionDeleted:o}){let{t:s}=Z(`settings`),{data:c,isLoading:l,isError:u}=Y(t({path:{assistant_id:e}})),d=nt(),{data:f}=Y({...N({path:{assistant_id:e}}),enabled:d}),p=d?f?.resolvedConnectionName??null:null,m=Kn(e,{onDeleted:o}),h=(0,Q.useMemo)(()=>{let e=c?.connections??[];return[...e.filter(e=>e.provider===xt),...e.filter(e=>e.provider!==xt)]},[c]);return(0,$.jsx)(bn,{title:s(`providersSection.title`),action:(0,$.jsx)(r,{variant:`outlined`,onClick:a,leftIcon:(0,$.jsx)(Zt,{}),children:s(`providersSection.addProvider`)}),children:l?(0,$.jsx)(`div`,{className:`space-y-2 py-2`,children:[1,2,3].map(e=>(0,$.jsx)(jt,{className:`h-10 rounded-lg`},e))}):u?(0,$.jsx)(H,{variant:`body-medium-default`,as:`p`,className:`py-4 text-center text-(--system-negative-strong)`,children:s(`providersSection.loadError`)}):h.length===0?(0,$.jsx)(H,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:s(`providersSection.empty`)}):h.map(e=>(0,$.jsx)(Gn,{connection:e,isDefault:e.name===p,supportsDefaultProvider:d,selected:e.name===n,isSettingDefault:m.isSettingDefault(e.name),onOpen:e.isManaged??!1?void 0:()=>i(e.name),onSetDefault:()=>m.setDefault(e),onDelete:()=>void m.deleteConnection(e.name)},e.name))})}function Jn({panel:e,onOpenPanel:n,onClosePanel:i}){let{t:a}=Z(`settings`),o=Ve(),{data:s}=Y({...ee({path:{assistant_id:o}}),staleTime:3e4}),c=nt(),{data:l}=Y({...N({path:{assistant_id:o}}),enabled:c}),u=l?.availability,{data:d}=Y({...t({path:{assistant_id:o}})}),f=d?.connections,p=s?.llm?.callSites??{},m=Object.entries(p).filter(([e,t])=>e!==`mainAgent`&&(t?.profile!=null||t?.provider!=null||t?.model!=null)).length;return(0,$.jsx)(on,{title:a(`languageModelCard.title`),subtitle:a(`languageModelCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[u&&u.status!==`ok`&&(0,$.jsx)(ge,{tone:u.status===`unknown`?`warning`:`error`,children:u.message??a(`languageModelCard.defaultProviderUnavailable`)}),o&&(0,$.jsx)(Rn,{assistantId:o,config:s,connections:f,selectedProfileName:e?.kind===`profile`?e.name:null,onOpenProfile:e=>n({kind:`profile`,name:e}),onCreateProfile:()=>n({kind:`create-profile`}),onProfileDeleted:t=>{e?.kind===`profile`&&e.name===t&&i()}}),o&&(0,$.jsx)(qn,{assistantId:o,selectedConnectionName:e?.kind===`provider`?e.name:null,onOpenConnection:e=>n({kind:`provider`,name:e}),onAddProvider:()=>n({kind:`add-provider`}),onConnectionDeleted:t=>{e?.kind===`provider`&&e.name===t&&i()}}),(0,$.jsx)(bn,{title:a(`languageModelCard.overridesTitle`),count:m,action:(0,$.jsx)(r,{variant:`outlined`,onClick:()=>n({kind:`overrides`}),children:a(`languageModelCard.manage`)})})]})})}function Yn({children:e}){return(0,$.jsxs)(`a`,{href:`https://www.vellum.ai/docs/pricing`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[var(--primary-base)] hover:underline`,children:[e,(0,$.jsx)($t,{className:`h-3.5 w-3.5`})]})}function Xn(){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] px-4 py-2.5`,children:[(0,$.jsx)(nn,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:(0,$.jsx)(Gt,{i18nKey:`managedServicesBanner.body`,ns:`common`,components:{link:(0,$.jsx)(Yn,{})}})})]})}function Zn({assistantId:e,profileName:n,onClose:i}){let{t:a}=Z(`settings`),{data:o}=Y({...ee({path:{assistant_id:e}}),staleTime:3e4}),{data:s}=Y({...t({path:{assistant_id:e}})}),c=s?.connections,l=(0,Q.useMemo)(()=>o?.llm?.profiles??{},[o?.llm?.profiles]),u=Object.keys(l),d=(0,Q.useMemo)(()=>{if(n==null)return;let e=l[n];return e?{name:n,...e}:void 0},[n,l]),f=n==null?`create`:d?.source===`managed`||d?.invariant===!0?`view`:`edit`,{saveProfile:p,isPending:m}=St(e,{onSaved:i}),h=vt({mode:f,profileName:n??void 0,initialValues:d,existingNames:u,connections:c,assistantId:e,onSave:p}),g=In(e,o,{onDeleted:()=>i()}),_=n!=null&&g.pendingDeleteName===n,v=n!=null&&o!=null&&!(n in l);(0,Q.useEffect)(()=>{v&&!h.saving&&!m&&i()},[v,h.saving,m,i]);let y=f===`view`;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Se,{title:h.effectiveMode===`create`?a(`profileDetailPanel.createTitle`):d?.label??n??a(`profileDetailPanel.defaultTitle`),closeVariant:`outlined`,onClose:i,headerTrailing:y&&h.effectiveMode!==`create`?(0,$.jsx)(j,{tone:`neutral`,children:a(`profileDetailPanel.managedTag`)}):null,headerActions:h.effectiveMode!==`create`&&!h.isReadOnly?(0,$.jsx)(r,{variant:`dangerOutline`,iconOnly:_?(0,$.jsx)(Qt,{className:`animate-spin`}):(0,$.jsx)(rn,{}),"aria-label":a(_?`profileDetailPanel.deleting`:`profileDetailPanel.delete`),tooltip:a(`profileDetailPanel.delete`),onClick:()=>{n!=null&&g.requestDelete(n)},disabled:h.saving||_}):null,footer:h.isReadOnly?(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(r,{variant:`outlined`,onClick:h.switchToSaveAsNew,disabled:h.saving,children:a(`profileDetailPanel.saveAsNew`)}),h.hasViewModeChanges?(0,$.jsx)(r,{variant:`primary`,onClick:()=>void h.handleSave(),disabled:h.saving,children:h.saving?a(`profileDetailPanel.saving`):a(`profileDetailPanel.save`)}):null]}):(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(r,{variant:`primary`,onClick:()=>void h.handleSave(),disabled:h.isInvalid||h.saving,children:h.saving?a(`profileDetailPanel.saving`):h.effectiveMode===`create`?a(`profileDetailPanel.create`):a(`profileDetailPanel.saveChanges`)})}),children:(0,$.jsx)(De,{editor:h,assistantId:e,connections:c,variant:`panel`})}),(0,$.jsx)(Tn,{...g.blockedDeleteModalProps})]})}function Qn({value:e,profileOptions:t,disabled:n,onChange:r}){let{t:i}=Z(`settings`);return(0,$.jsx)(`div`,{className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-default font-medium text-[var(--content-default)]`,children:i(`advisorProfileRow.title`)}),(0,$.jsx)(`p`,{className:`mt-0.5 text-body-small-lighter text-[var(--content-tertiary)]`,children:i(`advisorProfileRow.description`)})]}),(0,$.jsx)(u,{value:e,onChange:r,options:t,placeholder:i(`advisorProfileRow.chooseProfilePlaceholder`),className:`w-44`,menuMinWidth:280,menuAlign:`start`,disabled:n})]})})}var $n=`__custom__`;function er(e){return e?!!(e.profile||e.provider||e.model):!1}function tr(e,t){if(t?.provider||t?.model)return null;let n=e.defaultProfile??e.shippedDefaultProfile;return n?{profile:n,via:t?.profile===n?`override`:`default`}:null}function nr(e,t){let n=er(e);return n===er(t)?n?(e?.profile??null)===(t?.profile??null)&&(e?.provider??null)===(t?.provider??null)&&(e?.model??null)===(t?.model??null):!0:!1}function rr({assistantId:e,callSites:t,domains:n,persistedOverrides:i,orderedProfiles:a,onClose:o,onApplied:s}){let{t:c}=Z(`settings`),l=st(),d=be(),f=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:d}),[d]),p=(0,Q.useMemo)(()=>{let e=new Map;for(let n of t){let t=tr(n,i[n.id]);t&&e.set(n.id,t)}return e},[t,i]),m=(0,Q.useMemo)(()=>{let e=new Set(Array.from(p.values(),e=>e.profile));return a.filter(t=>e.has(t.name))},[a,p]),[h,g]=(0,Q.useState)(()=>m[0]?.name??``),[v,y]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(new Set),[C,w]=(0,Q.useState)(!1),T=(0,Q.useMemo)(()=>{let e=new Map(n.map(e=>[e.id,e.displayName]));return t=>e.get(t)??t},[n]),E=(0,Q.useMemo)(()=>t.filter(e=>p.get(e.id)?.profile===h),[t,p,h]),D=(0,Q.useMemo)(()=>E.map(e=>e.id).filter(e=>!x.has(e)),[E,x]),O=(0,Q.useMemo)(()=>m.map(e=>({value:e.name,label:ht(e)})),[m]),k=(0,Q.useMemo)(()=>pe(a,[],f).filter(e=>e.name!==h).map(e=>({value:e.name,label:ht(e)})),[a,h,f]),A=b(a,h),j=b(a,v),M=x.size===0;function N(e){g(e),S(new Set),e===v&&y(``)}function P(e,t){S(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})}async function F(){if(!(!h||!v||D.length===0)){w(!0);try{let t={};for(let e of D)t[e]={profile:v};await l.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:t}}}),R.success(c(`bulkOverrideSwapModal.successToast`,{count:D.length,targetLabel:j})),s(),o()}catch(e){let t=me(e);R.error(t??c(`bulkOverrideSwapModal.updateFailedToast`)),t||G(e,{context:`settings-ai-bulk-override-swap`})}finally{w(!1)}}}return(0,$.jsx)(_.Root,{open:!0,onOpenChange:e=>{e||o()},children:(0,$.jsxs)(_.Content,{size:`md`,children:[(0,$.jsx)(_.Header,{children:(0,$.jsx)(_.Title,{children:c(`bulkOverrideSwapModal.title`)})}),(0,$.jsxs)(_.Body,{className:`space-y-4`,children:[(0,$.jsx)(H,{variant:`body-medium-default`,as:`p`,children:c(`bulkOverrideSwapModal.intro`)}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(u,{id:`bulk-swap-source`,label:c(`bulkOverrideSwapModal.currentlyUsingLabel`),value:h,onChange:N,options:O}),(0,$.jsx)(u,{id:`bulk-swap-target`,label:c(`bulkOverrideSwapModal.changeToLabel`),value:v,onChange:y,options:k,placeholder:c(`bulkOverrideSwapModal.targetPlaceholder`)})]}),(0,$.jsx)(ge,{tone:`info`,title:c(`bulkOverrideSwapModal.noticeTitle`),children:c(`bulkOverrideSwapModal.noticeBody`,{sourceLabel:A})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(H,{variant:`body-medium-default`,as:`p`,children:c(`bulkOverrideSwapModal.affectedSummary`,{count:E.length,profile:A})}),(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-[color:var(--content-secondary)]`,children:c(`bulkOverrideSwapModal.chooseActions`)})]}),(0,$.jsx)(r,{variant:`ghost`,onClick:()=>S(M?new Set(E.map(e=>e.id)):new Set),children:c(M?`bulkOverrideSwapModal.clearAll`:`bulkOverrideSwapModal.selectAll`)})]}),(0,$.jsx)(`div`,{className:`max-h-72 space-y-1 overflow-y-auto`,children:E.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-[var(--border-base)] px-3 py-2`,children:[(0,$.jsx)(W,{checked:!x.has(e.id),onCheckedChange:t=>P(e.id,t===!0),disabled:C,label:e.displayName,helperText:T(e.domain)}),(0,$.jsx)(`span`,{className:`shrink-0 text-body-small-default text-[color:var(--content-tertiary)]`,children:p.get(e.id)?.via===`override`?c(`bulkOverrideSwapModal.viaOverride`):c(`bulkOverrideSwapModal.viaDefault`)})]},e.id))})]})]}),(0,$.jsxs)(_.Footer,{children:[(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`mr-auto self-center text-[color:var(--content-secondary)]`,children:c(`bulkOverrideSwapModal.willChange`,{count:D.length})}),(0,$.jsx)(r,{variant:`ghost`,onClick:o,disabled:C,children:c(`bulkOverrideSwapModal.cancel`)}),(0,$.jsx)(r,{variant:`primary`,disabled:!h||!v||D.length===0||C,onClick:()=>void F(),children:C?(0,$.jsx)(Qt,{className:`h-4 w-4 animate-spin`}):c(`bulkOverrideSwapModal.applyTo`,{count:D.length})})]})]})})}function ir({id:e,displayName:t,description:n,defaultProfileLabel:r,draft:i,profileOptions:a,connections:o,onDraftChange:s,onToggle:c}){let{t:l}=Z(`settings`),d=Dt({hostedInference:Ne.use.vellumHostedInference()}),f=er(i),p=!i||!f?``:i.provider||i.model?$n:i.profile??``,m=p===$n,h=at(),g=Ue(),_=(o??[]).some(e=>e.provider===ke),v=[...ft.filter(Ye),..._?[ke]:[]],y=h[0]??ft[0],b=i?.provider,x=Fe(b)?b:b===`chatgpt`?ke:void 0,S=x!==void 0&&v.some(e=>e===x),w=x??y,T=bt(w,``,(o??[]).filter(e=>pt(e.provider,w)))?dt(w):ot(w,d),E=T.map(e=>({value:e.id,label:e.displayName})),D=typeof i?.model==`string`?i.model:``;if(D&&!T.some(e=>e.id===D)){let e=mt(w).find(e=>e.id===D)?.displayName??D;E.push({value:D,label:l(`callSiteOverridesRow.unavailableOption`,{name:e})})}let O=!!i?.provider&&!i?.model,k=[...v.map(e=>({value:e,label:rt[e]??e,...g(e)})),...x&&!S?[{value:x,label:l(`callSiteOverridesRow.unavailableOption`,{name:rt[x]??x})}]:[]];function A(t){t===`__custom__`?s(e,{profile:null,provider:y,model:Ge(y)??``}):t===``?s(e,null):s(e,{profile:t,provider:null,model:null})}function j(t){let n=Ge(t)??``;s(e,{...i??{},profile:null,provider:t,model:n})}function M(t){s(e,{...i??{},model:t})}return(0,$.jsxs)(`div`,{className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-default font-medium text-[var(--content-default)]`,children:t}),n&&(0,$.jsxs)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[n,r&&(0,$.jsx)(`span`,{className:`ml-1.5 text-body-small-default text-[var(--content-tertiary)] opacity-60`,children:l(`callSiteOverridesRow.defaultProfileSuffix`,{label:r})})]})]}),(0,$.jsx)(C,{checked:f,onChange:t=>c(e,t),"aria-label":l(`callSiteOverridesRow.overrideAriaLabel`,{displayName:t}),className:`shrink-0`})]}),f&&(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(u,{value:p,onChange:A,options:a,className:`w-44`,menuMinWidth:280,menuAlign:`start`})}),f&&m&&(0,$.jsxs)(`div`,{className:`mt-3 space-y-2 border-t border-[var(--border-base)] pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:l(`callSiteOverridesRow.providerLabel`)}),(0,$.jsx)(u,{value:w??``,onChange:j,options:k})]}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:l(`callSiteOverridesRow.modelLabel`)}),(0,$.jsx)(u,{value:i?.model??``,onChange:M,options:E})]})]}),O&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:l(`callSiteOverridesRow.pickModelError`)})]})]})}function ar({groups:e,drafts:t,buildProfileOptionsForRow:n,profileLabelFor:r,advisorMatchesSearch:i,connections:a,onDraftChange:o,onToggle:s}){let{t:c}=Z(`settings`);return(0,$.jsx)(`div`,{className:`space-y-4`,children:e.length===0?i?null:(0,$.jsx)(`p`,{className:`py-8 text-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:c(`overridesCallSiteList.emptySearch`)}):e.map(({domain:e,sites:i})=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`mb-2 text-body-small-default font-semibold uppercase tracking-wider text-[var(--content-tertiary)]`,children:e.displayName}),(0,$.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>{let i=(()=>{let n=t[e.id]??null;return!n||!er(n)?``:n.provider||n.model?$n:n.profile??``})(),c=e.shippedDefaultProfile??e.defaultProfile,l=c?r(c):null;return(0,$.jsx)(ir,{id:e.id,displayName:e.displayName,description:e.description,defaultProfileLabel:l,draft:t[e.id]??null,profileOptions:n(i===``||i===`__custom__`?null:i),connections:a,onDraftChange:o,onToggle:s},e.id)})})]},e.id))})}function or(e,t){let n={};for(let r of Object.keys(e)){let i=e[r]??null;er(i)?n[r]={profile:i?.profile??null,provider:i?.provider??null,model:i?.model??null}:r in t&&t[r]===null&&(n[r]=null)}return n}function sr(e){let t={};for(let n of Object.keys(e))t[n]=null;return t}function cr({catalogCallSiteIds:e,persistedOverrides:t,persistedAdvisor:n,isSeeded:r}){let[i,a]=(0,Q.useState)({}),[o,s]=(0,Q.useState)(void 0),c=(0,Q.useMemo)(()=>{if(!r)return{};let n={};for(let r of e)if(r in i)n[r]=i[r];else{let e=t[r];n[r]=e?{...e}:{}}return n},[r,e,t,i]),l=o??n,u=l!==n,d=(0,Q.useMemo)(()=>{if(!r)return!1;for(let e of Object.keys(c))if(!nr(c[e],t[e]))return!0;return!1},[r,c,t]);return{drafts:c,advisorProfile:l,advisorDirty:u,callSiteDraftsDirty:d,hasUnsavedDrafts:u||d,hasValidationError:(0,Q.useMemo)(()=>Object.values(c).some(e=>er(e)&&!!e?.provider&&!e?.model),[c]),setDraft:(0,Q.useCallback)((e,t)=>{a(n=>({...n,[e]:t}))},[]),setAdvisor:(0,Q.useCallback)(e=>{s(e)},[]),clearEdits:(0,Q.useCallback)(()=>{a({}),s(void 0)},[]),buildSavePatch:(0,Q.useCallback)(()=>or(c,i),[c,i]),buildResetPatch:(0,Q.useCallback)(()=>sr(c),[c])}}function lr({assistantId:e,onClose:n}){let{t:i}=Z(`settings`),{data:a}=Y({...ee({path:{assistant_id:e}}),staleTime:3e4}),o=(0,Q.useMemo)(()=>a?.llm?.profiles??{},[a?.llm?.profiles]),s=(0,Q.useMemo)(()=>a?.llm?.profileOrder??[],[a?.llm?.profileOrder]),c=(0,Q.useMemo)(()=>a?.llm?.callSites??{},[a?.llm?.callSites]),l=(0,Q.useMemo)(()=>S(o,s),[o,s]),u=at(),d=be(),f=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:d}),[d]),p=st(),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[x,C]=(0,Q.useState)(!1),{data:w,isLoading:E,isError:D,refetch:O}=Y({...$e({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4,refetchOnWindowFocus:!1}),{data:A}=Y({...t({path:{assistant_id:e}}),enabled:!!e}),j=(0,Q.useMemo)(()=>(w?.callSites??[]).filter(e=>e.id!==`mainAgent`),[w]),M=!E&&!D&&!!w,N=!!a,P=M&&N,I=(0,Q.useMemo)(()=>j.map(e=>e.id),[j]),L=a?.llm?.advisorProfile??``,{drafts:te,advisorProfile:z,advisorDirty:B,callSiteDraftsDirty:ne,hasUnsavedDrafts:re,hasValidationError:ie,setDraft:V,setAdvisor:ae,clearEdits:H,buildSavePatch:oe,buildResetPatch:se}=cr({catalogCallSiteIds:I,persistedOverrides:c,persistedAdvisor:L,isSeeded:P}),ce=(0,Q.useMemo)(()=>new Set(I),[I]),le=(0,Q.useCallback)(e=>b(l,e),[l]),ue=(0,Q.useCallback)(e=>({value:e.name,label:ht(e),...k(e,l,f)===`undispatchable`?{icon:(0,$.jsx)(Xt,{className:`h-3.5 w-3.5 text-[var(--system-mid-strong)]`}),tooltip:_e(e)}:{}}),[l,f]),W=(0,Q.useMemo)(()=>pe(l,[L],f).map(ue),[l,L,ue,f]),de=(0,Q.useMemo)(()=>{let e=m.trim().toLowerCase();return e===``||`advisor`.includes(e)||`second opinion`.includes(e)},[m]),fe=(0,Q.useMemo)(()=>j.some(e=>tr(e,c[e.id])!==null),[j,c]),me=(0,Q.useMemo)(()=>Object.entries(c).some(([e,t])=>ce.has(e)&&(t?.profile!=null||t?.provider!=null||t?.model!=null)),[c,ce]),he=(0,Q.useCallback)(e=>[...pe(l,[e],f).map(ue),{value:$n,label:i(`overridesDetailPanel.customProfileOption`)}],[l,ue,f,i]),ge=(0,Q.useMemo)(()=>{if(!m.trim())return j;let e=m.toLowerCase();return j.filter(t=>(t.displayName??``).toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e)||(t.domain??``).toLowerCase().includes(e))},[j,m]),ve=(0,Q.useMemo)(()=>{if(!w)return[];let e=w.domains.map(e=>e.id),t=new Map(w.domains.map(e=>[e.id,e])),n=[];for(let r of e){let e=ge.filter(e=>e.domain===r);e.length>0&&n.push({domain:t.get(r),sites:e})}let r=new Set(e),a=ge.filter(e=>!r.has(e.domain));return a.length>0&&n.push({domain:{id:`other`,displayName:i(`overridesDetailPanel.otherDomain`)},sites:a}),n},[w,ge,i]),ye=(0,Q.useCallback)((e,t)=>{if(!t){V(e,null);return}let n=T(l,j.find(t=>t.id===e)?.defaultProfile,f);if(n)V(e,{profile:n});else{let t=u[0]??ft[0];V(e,{provider:t,model:Ge(t)??``})}},[j,l,u,V,f]),xe=(0,Q.useCallback)(async()=>{_(!0);try{let t=oe();await p.mutateAsync({path:{assistant_id:e},body:{llm:{...ne?{callSites:t}:{},...B?{advisorProfile:z}:{}}}}),n(),R.success(i(`overridesDetailPanel.overridesSavedToast`))}catch(e){R.error(i(`overridesDetailPanel.saveFailedToast`)),G(e,{context:`call_site_overrides_save`})}finally{_(!1)}},[oe,ne,B,z,n,p,e,i]),Ce=(0,Q.useCallback)(async()=>{_(!0);try{let t=se();await p.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:t}}}),n(),R.success(i(`overridesDetailPanel.overridesResetToast`))}catch(e){R.error(i(`overridesDetailPanel.resetFailedToast`)),G(e,{context:`call_site_overrides_reset`})}finally{_(!1)}},[se,n,p,e,i]),we=(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[me&&(0,$.jsx)(r,{variant:`outlined`,onClick:()=>y(!0),disabled:g||!P,tintColor:`var(--system-negative-strong)`,className:`mr-auto`,children:i(`overridesDetailPanel.resetToDefaults`)}),(0,$.jsx)(r,{variant:`primary`,onClick:()=>void xe(),disabled:!re||ie||g,children:g?(0,$.jsx)(Qt,{className:`h-4 w-4 animate-spin`}):i(`overridesDetailPanel.save`)})]});return(0,$.jsxs)(Se,{title:i(`overridesDetailPanel.title`),closeVariant:`outlined`,onClose:n,footer:we,children:[(0,$.jsx)(`p`,{className:`mb-4 text-body-medium-lighter text-[var(--content-tertiary)]`,children:i(`overridesDetailPanel.description`)}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-4 flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(U,{type:`search`,value:m,onChange:e=>h(e.target.value),placeholder:i(`overridesDetailPanel.searchPlaceholder`),leftIcon:(0,$.jsx)(tn,{className:`h-4 w-4`}),fullWidth:!0})}),(0,$.jsx)(r,{variant:`outlined`,onClick:()=>C(!0),disabled:!P||g||re||!fe,title:re?i(`overridesDetailPanel.bulkChangeUnsavedTitle`):fe?void 0:i(`overridesDetailPanel.bulkChangeNoCandidatesTitle`),children:i(`overridesDetailPanel.bulkChange`)})]}),N&&de&&(0,$.jsxs)(`div`,{className:`mb-4`,children:[(0,$.jsx)(`p`,{className:`mb-2 text-body-small-default font-semibold uppercase tracking-wider text-[var(--content-tertiary)]`,children:i(`overridesDetailPanel.advisorSection`)}),(0,$.jsx)(Qn,{value:z,profileOptions:W,disabled:g,onChange:ae})]}),E&&(0,$.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,$.jsx)(Qt,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`})}),D&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-12 text-center`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:i(`overridesDetailPanel.loadErrorTitle`)}),(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:i(`overridesDetailPanel.loadErrorHint`)}),(0,$.jsx)(r,{variant:`outlined`,onClick:()=>void O(),children:i(`overridesDetailPanel.retry`)})]}),!E&&!D&&w&&(0,$.jsx)(ar,{groups:ve,drafts:te,buildProfileOptionsForRow:he,profileLabelFor:le,advisorMatchesSearch:de,connections:A?.connections,onDraftChange:V,onToggle:ye})]}),x&&w&&(0,$.jsx)(rr,{assistantId:e,callSites:j,domains:w.domains,persistedOverrides:c,orderedProfiles:l,onClose:()=>C(!1),onApplied:H}),(0,$.jsx)(F,{open:v,title:i(`overridesDetailPanel.resetToDefaults`),message:i(`overridesDetailPanel.resetConfirmMessage`),confirmLabel:i(`overridesDetailPanel.resetToDefaults`),destructive:!0,onConfirm:()=>{y(!1),Ce()},onCancel:()=>y(!1)})]})}var ur=e(Kt(),1);function dr({mode:e,connection:t,assistantId:n,existingNames:i,connections:a,variant:o=`modal`,actionsSlot:s,onSave:c,onCancel:l}){let{t:u}=Z(`settings`),[d,f]=(0,Q.useState)(t?.label??``),p=t?.name??``,m=t?.provider??`anthropic`,h=t?.auth.type??`api_key`,[g,v]=(0,Q.useState)(()=>t?.auth.type===`api_key`?t.auth.credential:t?``:`credential/anthropic/api_key`),[y,b]=(0,Q.useState)(t?.baseUrl??``),[x,S]=(0,Q.useState)(()=>t?.models?t.models.map(e=>e.id).join(`, `):``),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),D=m===`openai-compatible`,O=Te(m),k=Vt(m),[A,j]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(!1),F=X(),I=(0,Q.useMemo)(()=>qe(g),[g]),L=h===`api_key`&&I!==null,{hasStoredCredential:R,isLoading:ee}=Le({assistantId:n,credentialKind:`credential`,credentialName:I?`${I.service}:${I.field}`:``,enabled:L}),{credentials:z}=we({assistantId:n,enabled:h===`api_key`});(0,Q.useEffect)(()=>{let e=t?.provider??`anthropic`;f(t?.label??``),t?.auth.type===`api_key`?v(t.auth.credential):v(t?``:`credential/${e}/api_key`),E(null),b(t?.baseUrl??``),S(t?.models?t.models.map(e=>e.id).join(`, `):``),j(``),P(!1)},[t]);let B=d.trim()!==(t?.label??``).trim(),ne=D&&B?Ft(d,a,t?.name):null,re=p.trim().length>0&&ne===null;async function ie(){if(re){w(!0),E(null);try{let e;if(h===`api_key`){let t=g.trim()||`credential/${m}/api_key`,r=A.trim();if(r){P(!0);try{let e=qe(t);await Ht({path:{assistant_id:n},body:e?{type:`credential`,name:`${e.service}:${e.field}`,value:r}:{type:`api_key`,name:m,value:r},throwOnError:!0});let i=Et(n,`credential`,e?`${e.service}:${e.field}`:``);F.setQueryData(i,!0),F.invalidateQueries({queryKey:te({path:{assistant_id:n}})})}catch{E(u(`providerEditorContent.failedSaveApiKey`));return}finally{P(!1)}}e={type:`api_key`,credential:t}}else if(t)e=t.auth;else{E(u(`providerEditorContent.nothingToEdit`));return}let r=d.trim()||null,i={auth:e,label:r,...O&&{base_url:y.trim()||null},...k&&{models:x.trim()?x.split(`,`).map(e=>({id:e.trim()})).filter(e=>e.id):null}},{data:a,error:o,response:s}=await ut({path:{assistant_id:n,name:t?.name??p.trim()},body:i});if(!s?.ok){E(Me(s?.status,o)??Je(s?.status));return}if(!a){E(u(`providerEditorContent.emptyServerResponse`));return}Lt(a,u),c(a)}catch{E(u(`providerEditorContent.failedSaveProvider`))}finally{w(!1)}}}let V=z.filter(e=>e.service===m),ae=e!==`create`&&t?.auth.type===`api_key`,oe=V.length>0||ae,se=Ot(u(`providerEditorContent.apiKeyPlaceholder`),R);if(e===`create`)return(0,$.jsx)(Ke,{variant:o===`panel`?`inline`:`modal`,actionsSlot:s,assistantId:n,existingNames:i,connections:a,defaultProviderType:m,onCreated:c,onCancel:l});let ce=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:(0,$.jsx)(Gt,{i18nKey:`providerEditorContent.displayNameLabel`,ns:`settings`,components:{optional:(0,$.jsx)(`span`,{className:`text-[var(--content-disabled)]`})}})}),(0,$.jsx)(U,{value:d,onChange:e=>f(e.target.value),placeholder:u(`providerEditorContent.displayNamePlaceholder`),fullWidth:!0}),ne?(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:Ae[ne]}):null]}),O&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:u(`providerEditorContent.baseUrlLabel`)}),(0,$.jsx)(U,{value:y,onChange:e=>b(e.target.value),placeholder:u(m===`ollama`?`providerEditorContent.baseUrlPlaceholderOllama`:m===`opencode`?`providerEditorContent.baseUrlPlaceholderOpencode`:`providerEditorContent.baseUrlPlaceholder`),fullWidth:!0}),m===`ollama`?(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:u(`providerEditorContent.baseUrlHintOllama`)}):null,m===`opencode`?(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:u(`providerEditorContent.baseUrlHintOpencode`)}):null]}),k&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:u(`providerEditorContent.modelsLabel`)}),(0,$.jsx)(U,{value:x,onChange:e=>S(e.target.value),placeholder:u(`providerEditorContent.modelsPlaceholder`),fullWidth:!0}),(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:u(`providerEditorContent.modelsHint`)})]}),h===`api_key`&&(0,$.jsx)(zt,{apiKeyValue:A,onApiKeyChange:j,credential:g,onCredentialChange:v,isLoadingCredential:ee,apiKeyPlaceholder:se,provider:m,providerCredentials:V,showAdvancedSection:oe,onError:E}),h===`oauth_subscription`&&(0,$.jsx)(M,{assistantId:n,onConnected:c}),T&&(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:T})]}),le=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(r,{variant:`ghost`,onClick:l,children:u(`providerEditorContent.cancel`)}),(0,$.jsx)(r,{variant:`primary`,disabled:!re||C||N,onClick:()=>void ie(),children:u(C?`providerEditorContent.saving`:`providerEditorContent.saveChanges`)})]});return o===`panel`?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[ce,s===void 0?(0,$.jsx)(`div`,{className:`flex justify-end gap-2`,children:le}):s&&(0,ur.createPortal)(le,s)]}):(0,$.jsxs)(_.Content,{size:`md`,children:[(0,$.jsxs)(_.Header,{children:[(0,$.jsx)(_.Title,{children:u(`providerEditorContent.editProviderTitle`)}),(0,$.jsx)(_.Description,{children:t?u(`providerEditorContent.editingConnection`,{name:At(t)}):u(`providerEditorContent.editProviderSettingsFallback`)})]}),(0,$.jsx)(_.Body,{children:ce}),(0,$.jsx)(_.Footer,{children:le})]})}function fr({assistantId:e,connectionName:n,onClose:r}){let{t:i}=Z(`settings`),a=X(),[o,s]=(0,Q.useState)(null),{data:c}=Y(t({path:{assistant_id:e}})),l=(0,Q.useMemo)(()=>c?.connections??[],[c]),u=(0,Q.useMemo)(()=>n==null?void 0:l.find(e=>e.name===n),[n,l]),d=n!=null&&c!=null&&u==null;(0,Q.useEffect)(()=>{d&&r()},[d,r]);function f(){a.invalidateQueries({queryKey:Be({path:{assistant_id:e}})}),a.invalidateQueries({queryKey:I({path:{assistant_id:e}})}),r()}return(0,$.jsx)(Se,{title:u?At(u):i(`providerDetailPanel.addProviderTitle`),closeVariant:`outlined`,onClose:r,footer:(0,$.jsx)(`div`,{ref:s,className:`flex justify-end gap-2`}),children:n==null||u!=null?(0,$.jsx)(dr,{mode:u?`edit`:`create`,connection:u,variant:`panel`,actionsSlot:o,assistantId:e,existingNames:l.map(e=>e.name),connections:l,onSave:f,onCancel:r}):null})}var pr={vellum:{provider:`vellum`},deepgram:{provider:`deepgram`,credentialService:`deepgram`},openai:{provider:`openai-whisper`,credentialService:`openai`}},mr={vellum:`vellum`,deepgram:`deepgram`,"openai-whisper":`openai`},hr=`deepgram`;function gr({assistantId:e,hideSaveButton:t=!1,hideCredentialsGuide:n=!1,onSaveStateChange:r}={}){let i=Ve(),a=e??i,o=f(),s=X(),{t:c}=Z(),l=(0,Q.useMemo)(()=>g(ve(),{displayName:c(`sttProviderForm.windowsNativeDisplayName`),subtitle:c(`sttProviderForm.windowsNativeSubtitle`),setupWarning:c(`sttProviderForm.windowsNativeSetupWarning`)}).filter(e=>!e.requiresNativeDictation||w()),[c]),d=hr,{data:p}=Y({...ee({path:{assistant_id:a}}),enabled:o,staleTime:3e4}),m=p?.services?.stt,h=m?.mode===`managed`?`vellum`:m?.provider,_=(0,Q.useMemo)(()=>{let e=h?mr[h]:void 0;if(e&&l.some(t=>t.id===e))return e;let t=K(It,d);return l.some(e=>e.id===t)?t:d},[h,l,d]),v=!!h,[y,b]=hn(_),{available:x,currentCode:S,configuredProviderId:C,selectLanguage:T,selecting:D}=ct(a),[O,k]=(0,Q.useState)(!1),A=x&&y===_&&(pr[y]?.provider===C||!!h&&!mr[h]),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{let e=K(It,d);e===`macos-native`&&!l.some(t=>t.id===e)&&q(It,d)},[l,d]);let L=(0,Q.useMemo)(()=>l.find(e=>e.id===y)??l[0],[l,y]),te=L.apiKeyPlaceholder!==void 0;(0,Q.useEffect)(()=>{P(K(je+y,``).length>0),M(``)},[y]);let z=(0,Q.useMemo)(()=>{let e=y!==_,t=j.trim().length>0;return e||t},[y,_,j]),B=(0,Q.useCallback)(async()=>{let e=j.trim();q(It,y),e.length>0&&q(je+y,e);let t=pr[y];I(!0);try{if(t?.credentialService){let n=e.length>0?e:K(je+y,``);if(n.length>0){let{response:e}=await _t({path:{assistant_id:a},body:{service:t.credentialService,field:`api_key`,value:n,label:`${L.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}}if(t&&(y!==_||!v)||h===`vellum`&&y!==`vellum`){let e=t?.provider??hr,{response:n}=await E({path:{assistant_id:a},body:{services:{stt:{provider:e,mode:e===`vellum`?`managed`:`your-own`}}},throwOnError:!1});if(!n?.ok)throw Error(`Failed to save configuration (HTTP ${n?.status??`?`})`)}return e.length>0&&P(!0),M(``),s.invalidateQueries({queryKey:et({path:{assistant_id:a}})}),R.success(c(`sttProviderForm.saveSuccess`)),!0}catch(e){return R.error(e instanceof Error?e.message:c(`sttProviderForm.saveFailed`)),!1}finally{I(!1)}},[a,y,j,L,_,v,h,s,c]);(0,Q.useEffect)(()=>{r?.({hasChanges:z,saving:F,save:B})},[r,z,F,B]);let ne=(0,Q.useCallback)(()=>{q(je+y,``),P(!1),M(``)},[y]),re=N?c(`sttProviderForm.apiKeyPlaceholderReplace`):L.apiKeyPlaceholder;return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:c(`sttProviderForm.providerLabel`)}),(0,$.jsx)(u,{value:y,onChange:b,options:l.map(e=>({value:e.id,label:e.displayName})),"aria-label":c(`sttProviderForm.providerAriaLabel`)})]}),A&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:c(`sttProviderForm.spokenLanguage`)}),(0,$.jsx)(Oe,{"aria-label":c(`sttProviderForm.spokenLanguage`),"aria-haspopup":`dialog`,onClick:()=>k(!0),value:Ze(S,C)}),(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:c(`sttProviderForm.spokenLanguageApplies`)}),(0,$.jsx)(pn,{open:O,onOpenChange:k,title:c(`sttProviderForm.spokenLanguage`),currentCode:S,configuredProviderId:C,selectLanguage:T,selecting:D})]}),te&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:c(`sttProviderForm.apiKeyLabel`)}),(0,$.jsx)(U,{type:`password`,value:j,onChange:e=>M(e.target.value),placeholder:re,fullWidth:!0})]}),L.setupWarning&&(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-sunken)] p-3 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,$.jsx)(Yt,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--system-mid-strong)]`}),(0,$.jsx)(`span`,{children:L.setupWarning})]}),!n&&L.credentialsGuide&&(0,$.jsx)(ln,{guide:L.credentialsGuide}),y===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:c(`sttProviderForm.vellumTranscription`)}),(!t||N)&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!t&&(0,$.jsx)(cn,{onClick:B,disabled:!z||F}),N&&(0,$.jsx)(sn,{onClick:ne})]})]})}var _r={batch:`sttRoleOverrides.role.batch`,dictation:`sttRoleOverrides.role.dictation`,liveVoice:`sttRoleOverrides.role.liveVoice`,telephony:`sttRoleOverrides.role.telephony`,watch:`sttRoleOverrides.role.watch`};function vr(e){let t=e?.roles;if(!t)return[];let n=e?.provider,r=n?e?.providers?.[n]?.model:void 0,i=[];for(let[e,a]of Object.entries(t)){let t=a?.provider;t&&(t===n&&a?.model===r||i.push({role:e,provider:t,...a?.model===void 0?{}:{model:a.model}}))}return i}function yr({assistantId:e}){let{t}=Z(`settings`),n=X(),i=f(),[a,o]=(0,Q.useState)(null),{data:s}=Y({...ee({path:{assistant_id:e}}),enabled:i,staleTime:3e4}),c=s?.services?.stt,l=vr(c),{data:u}=Y({...Ut({path:{assistant_id:e}}),enabled:i&&l.length>0,staleTime:5*6e4});if(l.length===0)return null;let d=e=>u?.providers?.find(t=>t.id===e)?.displayName??e,p=async r=>{o(r);try{let{response:t}=await E({path:{assistant_id:e},body:{services:{stt:{roles:{[r]:null}}}},throwOnError:!1});if(!t?.ok)throw Error(String(t?.status??``));await n.invalidateQueries({queryKey:et({path:{assistant_id:e}})})}catch{R.error(t(`sttRoleOverrides.clearFailed`))}finally{o(null)}};return(0,$.jsxs)(`div`,{className:`mt-1 flex flex-col gap-2 border-t border-[var(--border-subtle)] pt-4`,children:[(0,$.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t(`sttRoleOverrides.title`)}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-1`,children:l.map(e=>{let n=_r[e.role];return(0,$.jsxs)(`li`,{className:`flex items-center gap-4 rounded-md border border-[var(--border-subtle)] bg-[var(--surface-sunken)] px-3 py-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-medium-lighter text-[var(--content-default)]`,children:n?t(n):e.role}),(0,$.jsx)(`span`,{className:`min-w-0 truncate text-body-small-default text-[var(--content-default)]`,children:e.model?`${d(e.provider)} · ${e.model}`:d(e.provider)}),(0,$.jsx)(r,{variant:`ghost`,size:`compact`,"aria-label":t(`sttRoleOverrides.clearAria`,{feature:n?t(n):e.role}),className:`[--vbtn-fg:var(--content-tertiary)]`,disabled:a===e.role,onClick:()=>void p(e.role),children:t(`sttRoleOverrides.clear`)})]},e.role)})})]})}function br(){let{t:e}=Z(`settings`),t=Ve();return(0,$.jsxs)(on,{title:e(`speechToTextCard.title`),subtitle:e(`speechToTextCard.subtitle`),children:[(0,$.jsx)(gr,{}),(0,$.jsx)(yr,{assistantId:t})]})}async function xr(e){let{provider:t,apiKey:n,voiceId:r,text:i}=e;if(n.trim().length===0)return{kind:`error`,message:`Save an API key for this provider first.`};try{return t===`elevenlabs`?await Sr(n,r,i):t===`deepgram`?await Cr(n,i):t===`fish-audio`?{kind:`unsupported`,message:`Fish Audio TTS is only supported in the desktop app today. Use ElevenLabs or Deepgram to test from the browser.`}:t===`xai`?{kind:`unsupported`,message:`xAI TTS is only supported in the desktop app today. Use ElevenLabs or Deepgram to test from the browser.`}:{kind:`unsupported`,message:`TTS testing for "${t}" is not supported from the browser yet.`}}catch(e){return{kind:`error`,message:e instanceof Error?e.message:`Failed to reach the TTS provider.`}}}async function Sr(e,t,n){let r=t.trim();if(r.length===0)return{kind:`error`,message:`Enter and save a Voice ID before testing ElevenLabs.`};let i=await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${encodeURIComponent(r)}?output_format=mp3_44100_128`,{method:`POST`,headers:{"xi-api-key":e,"Content-Type":`application/json`,Accept:`audio/mpeg`},body:JSON.stringify({text:n,model_id:`eleven_turbo_v2_5`})});return i.ok?{kind:`audio`,blob:await i.blob()}:{kind:`error`,message:await wr(i,`ElevenLabs rejected the request.`)}}async function Cr(e,t){let n=await fetch(`https://api.deepgram.com/v1/speak?model=aura-2-thalia-en`,{method:`POST`,headers:{Authorization:`Token ${e}`,"Content-Type":`application/json`,Accept:`audio/mpeg`},body:JSON.stringify({text:t})});return n.ok?{kind:`audio`,blob:await n.blob()}:{kind:`error`,message:await wr(n,`Deepgram rejected the request.`)}}async function wr(e,t){try{let n=await e.text();if(n.length===0)return`${t} (HTTP ${e.status})`;try{let e=JSON.parse(n);if(e&&typeof e==`object`&&`detail`in e&&typeof e.detail==`string`)return e.detail;if(e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`)return e.message}catch{}return n.slice(0,200)}catch{return`${t} (HTTP ${e.status})`}}function Tr({assistantId:e,value:t,onChange:n,className:r}){let{t:i}=Z(),[a,o]=(0,Q.useState)(!1),{voices:s}=oe(e);if(s.length===0)return null;let c=s.find(e=>e.model===t)??s[0];return(0,$.jsxs)(x.Root,{open:a,onOpenChange:o,children:[(0,$.jsx)(x.Trigger,{asChild:!0,children:(0,$.jsx)(Oe,{"aria-label":i(`voicePickerField.ariaLabel`),value:c?Nt(c.description):i(`voicePickerField.selectVoice`),className:r})}),(0,$.jsx)(x.Content,{side:`bottom`,align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,children:(0,$.jsx)(D,{assistantId:e,value:t,onChange:n,onSelect:()=>o(!1),showSource:!0,autoScrollToSelected:!0})})]})}var Er={elevenlabs:`voiceId`,"fish-audio":`referenceId`,xai:`voiceId`};function Dr({assistantId:e,hideSaveButton:t=!1,hideCredentialsGuide:n=!1,onSaveStateChange:i}={}){let{t:a}=Z(),s=Ve(),d=e??s,p=Rt.use.name()??`your assistant`,m=f(),h=X(),{data:g}=Y({...o({path:{assistant_id:d}}),enabled:m,staleTime:1/0}),_=(0,Q.useMemo)(()=>{let e=g?.providers;if(!e)return P;if(e.some(e=>e.id===`vellum`))return e;let t=P.find(e=>e.id===`vellum`);return t?[t,...e]:e},[g]),{data:v}=Y({...ee({path:{assistant_id:d}}),enabled:m,staleTime:3e4}),y=v?.services?.tts,b=y?.mode===`managed`?`vellum`:y?.provider,x=`elevenlabs`,S=(0,Q.useMemo)(()=>b??K(`vellum:voice:ttsProvider`,x),[b,x]),C=!!b,[w,T]=hn(S),[D,O]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(``),[j,M]=(0,Q.useState)(``),[N,F]=(0,Q.useState)(!1),[I,L]=(0,Q.useState)(!1),[te,z]=(0,Q.useState)(!1),{voices:B,defaultModel:ne,fetched:re}=c(d,{enabled:w===`vellum`}),ie=y?.providers?.vellum?.model??ne??``,[V,ae]=hn(ie),H=B.find(e=>e.model===V)??B[0],[oe,ce]=(0,Q.useState)(null),le=B.some(e=>e.model===ie),ue=oe??(re&&ie!==``&&!le),W=(0,Q.useMemo)(()=>_.find(e=>e.id===w)??_[0],[w,_]),de=w===`vellum`&&W.supportsVoiceSelection&&V.trim()!==``&&V.trim()!==ie,G=(0,Q.useCallback)(e=>{let t=K(se+e,``),n=K(Mt+e,``);F(t.length>0),A(n),M(n),O(``)},[]);(0,Q.useEffect)(()=>{G(w)},[w,G]);let fe=(0,Q.useMemo)(()=>{let e=w!==S,t=D.trim().length>0,n=k.trim()!==j;return e||t||n||de},[w,S,D,k,j,de]),pe=(0,Q.useCallback)(async()=>{let e=D.trim(),t=k.trim(),n=W.id;q(l,n),e.length>0&&q(se+n,e),q(Mt+n,t);let r=e.length>0?e:K(se+n,``),i=Er[n];z(!0);try{if(r.length>0){let{response:e}=await _t({path:{assistant_id:d},body:{service:n,field:`api_key`,value:r,label:`${W.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}let e={...w!==S||!C?{provider:n,mode:n===`vellum`?`managed`:`your-own`}:{},...i?{providers:{[n]:{[i]:t}}}:{},...de?{providers:{vellum:{model:V.trim()}}}:{}};if(Object.keys(e).length>0){let{response:t}=await E({path:{assistant_id:d},body:{services:{tts:e}},throwOnError:!1});if(!t?.ok)throw Error(`Failed to save configuration (HTTP ${t?.status??`?`})`)}return F(r.length>0),M(t),O(``),h.invalidateQueries({queryKey:et({path:{assistant_id:d}})}),R.success(a(`ttsProviderForm.saved`)),!0}catch(e){return R.error(e instanceof Error?e.message:a(`ttsProviderForm.saveFailed`)),!1}finally{z(!1)}},[d,w,V,de,D,k,W,S,C,h,a]);(0,Q.useEffect)(()=>{i?.({hasChanges:fe,saving:te,save:pe})},[i,fe,te,pe]);let me=(0,Q.useCallback)(()=>{q(se+w,``),F(!1),O(``)},[w]),he=(0,Q.useCallback)(async()=>{L(!0);try{let e=K(se+w,``),t=D.trim(),n=t.length>0?t:e;if(n.length===0){R.error(a(`ttsProviderForm.apiKeyRequired`));return}let r=K(Mt+w,``),i=k.trim(),o=await xr({provider:w,apiKey:n,voiceId:i.length>0?i:r,text:`Hey! It's ${p}. How does this sound?`});if(o.kind!==`audio`){R.error(o.message);return}let s=URL.createObjectURL(o.blob);try{let e=new Audio(s);await e.play(),await new Promise(t=>{e.onended=()=>t(),e.onerror=()=>t()})}finally{URL.revokeObjectURL(s)}}finally{L(!1)}},[p,D,w,k,a]),ge=N?`•••••••• (Enter a new key to replace)`:W.apiKeyPlaceholder,_e=w===`vellum`,ve=_e&&W.supportsVoiceSelection,ye=(0,$.jsxs)(r,{variant:`link`,size:`compact`,className:`inline-flex h-auto items-center gap-1 px-0 underline [--vbtn-fg:var(--content-tertiary)]`,onClick:()=>{ce(!1),B.some(e=>e.model===V)||ae(ne||B[0]?.model||``)},children:[(0,$.jsx)(en,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`ttsProviderForm.chooseFromCatalog`)]}),be=ve&&ue&&B.length>0?ye:null;return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:a(`ttsProviderForm.provider`)}),(0,$.jsx)(u,{value:w,onChange:T,options:_.map(e=>({value:e.id,label:e.displayName})),"aria-label":a(`ttsProviderForm.providerAriaLabel`)})]}),!_e&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:a(`ttsProviderForm.apiKey`)}),(0,$.jsx)(U,{type:`password`,value:D,onChange:e=>O(e.target.value),placeholder:ge,fullWidth:!0})]}),ve&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:a(`ttsProviderForm.voice`)}),ue?(0,$.jsx)(U,{type:`text`,value:V,onChange:e=>ae(e.target.value),placeholder:a(`ttsProviderForm.voiceIdPlaceholder`),"aria-label":a(`ttsProviderForm.customVoiceIdAriaLabel`),fullWidth:!0}):H?(0,$.jsx)(Tr,{assistantId:d,value:V,onChange:ae}):re&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:a(`ttsProviderForm.noManagedVoices`)})]}),W.supportsVoiceSelection&&!_e&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:a(`ttsProviderForm.voiceId`)}),(0,$.jsx)(U,{type:`text`,value:k,onChange:e=>A(e.target.value),placeholder:a(`ttsProviderForm.voiceIdPlaceholder`),fullWidth:!0})]}),!n&&!_e&&(0,$.jsx)(ln,{guide:W.credentialsGuide}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!_e&&(0,$.jsx)(r,{variant:`outlined`,onClick:he,disabled:I,children:a(I?`ttsProviderForm.testing`:`ttsProviderForm.test`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[be,!t&&(0,$.jsx)(cn,{onClick:pe,disabled:!fe||te}),N&&!_e&&(0,$.jsx)(sn,{onClick:me})]})]})]})}function Or(){let{t:e}=Z(`settings`);return(0,$.jsx)(on,{id:`text-to-speech`,title:e(`textToSpeechCard.title`),subtitle:e(`textToSpeechCard.subtitle`),children:(0,$.jsx)(Dr,{})})}var kr=`default`;function Ar(){let{t:e}=Z(`settings`),t=Ve(),r=X(),{data:a}=Y({...ee({path:{assistant_id:t}}),staleTime:3e4}),o=y({onSuccess:e=>{i(r,{path:{assistant_id:t}},e)}}),s=mn(),c=(0,Q.useMemo)(()=>a?a.services?.[`web-fetch`]?.provider||K(`vellum:ai:webFetchProvider`,kr):K(ce,kr),[a]),l=(0,Q.useMemo)(()=>a?.services?.[`web-fetch`]?.apiBase??``,[a]),[d,f]=(0,Q.useState)(!1),[p,m]=hn(c),[h,g]=hn(l),[_,v]=(0,Q.useState)(``),b=n.has(p),x=He.has(p),{hasStoredCredential:S}=Le({assistantId:t,credentialKind:`api_key`,credentialName:p,enabled:x}),C=_.trim().length>0,w=h.trim(),T=b&&w.length>0,E=p!==c||b&&w!==l.trim(),D=d||x&&!T&&!S&&!C||!E&&!C,O=Ot(Qe[p]??e(`webFetchCard.apiKeyPlaceholder`),S),k=wt[p]??``,A=(0,Q.useCallback)(async()=>{f(!0);let n=_.trim(),i=x&&n.length>0;try{i&&await s(p,n),await o.mutateAsync({path:{assistant_id:t},body:{services:{"web-fetch":{provider:p,...b?{apiBase:w}:{}}}}}).catch(t=>{throw R.error(e(`webFetchCard.configUpdateFailedToast`)),G(t,{context:`patch_daemon_config`}),t})}catch{f(!1);return}f(!1);try{if(q(ce,p),i){let e=le(p);e&&q(e,n);let i=Et(t,`api_key`,p);r.setQueryData(i,!0),r.invalidateQueries({queryKey:i}),v(``)}R.success(e(`webFetchCard.savedToast`))}catch(t){G(t,{context:`settings-ai-web-fetch-persist-local`}),R.error(e(`webFetchCard.localPreferencesFailedToast`))}},[x,o,s,r,t,_,p,b,w,e]),j=(0,Q.useCallback)(()=>{let e=le(p);e&&Ct(e),v(``),g(``),m(kr),q(ce,kr)},[p,m,g]);return(0,$.jsx)(on,{id:`web-fetch`,title:e(`webFetchCard.title`),subtitle:e(`webFetchCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e(`webFetchCard.providerLabel`)}),(0,$.jsx)(u,{value:p,onChange:m,options:yt.map(e=>({value:e,label:lt[e]??e}))})]}),b&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(U,{label:e(`webFetchCard.apiBaseLabel`),type:`url`,value:h,onChange:e=>g(e.target.value),placeholder:k||e(`webFetchCard.apiBasePlaceholder`),fullWidth:!0}),k?(0,$.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`webFetchCard.apiBaseHint`,{defaultBase:k})}):null]}),x&&(0,$.jsx)(U,{label:e(`webFetchCard.apiKeyLabel`),type:`password`,value:_,onChange:e=>v(e.target.value),placeholder:O,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(cn,{onClick:A,disabled:D}),d&&(0,$.jsx)(Qt,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),x&&(0,$.jsx)(sn,{onClick:j,filled:!0})]})]})})}var jr=`0.10.12`;function Mr(){return Tt(jr)}function Nr(){let{t:e}=Z(`settings`),t=Ve(),n=X(),r=f(),{data:a}=Y({...ee({path:{assistant_id:t}}),enabled:r,staleTime:3e4}),o=y({onSuccess:e=>{i(n,{path:{assistant_id:t}},e)}}),s=mn(),c=(0,Q.useMemo)(()=>{if(!a)return K(m,`inference-provider-native`);let e=a.services?.[`web-search`];return(e?.mode===`managed`&&e?.provider!==`inference-provider-native`?`vellum`:e?.provider)||K(`vellum:ai:webSearchProvider`,`inference-provider-native`)},[a]),l=(0,Q.useMemo)(()=>a?.services?.[`web-search`]?.apiBase??``,[a]),[d,p]=(0,Q.useState)(!1),[h,g]=hn(c),[_,v]=hn(l),[b,x]=(0,Q.useState)(``),S=A.has(h),C=gt.has(h),w=O.has(h),{hasStoredCredential:T}=Le({assistantId:t,credentialKind:`api_key`,credentialName:h,enabled:C}),E=b.trim().length>0,D=_.trim(),k=S&&D.length>0,j=h!==c||S&&D!==l.trim(),M=d||C&&!w&&!k&&!T&&!E||!j&&!E,N=Ot(ae[h]??e(`webSearchCard.apiKeyPlaceholder`),T),P=ye[h]??``,F=(0,Q.useCallback)(async()=>{p(!0);let r=b.trim(),i=fe(h),a=C&&r.length>0;try{a&&await s(h,r),await it();let n=h===`vellum`?Mr()?{provider:`vellum`,mode:`managed`}:{mode:`managed`}:{provider:h,mode:`your-own`,...S?{apiBase:D}:{}};await o.mutateAsync({path:{assistant_id:t},body:{services:{"web-search":n}}}).catch(t=>{throw R.error(e(`webSearchCard.configUpdateFailedToast`)),G(t,{context:`patch_daemon_config`}),t})}catch{p(!1);return}p(!1);try{if(q(m,h),a){i&&q(i,r);let e=Et(t,`api_key`,h);n.setQueryData(e,!0),n.invalidateQueries({queryKey:e}),x(``)}R.success(e(`webSearchCard.savedToast`))}catch(t){G(t,{context:`settings-ai-web-search-persist-local`}),R.error(e(`webSearchCard.localPreferencesFailedToast`))}},[C,o,s,n,t,b,h,S,D,e]),I=(0,Q.useCallback)(()=>{let e=fe(h);e&&Ct(e),x(``),v(``),g(`inference-provider-native`),q(m,`inference-provider-native`)},[h,g,v]);return(0,$.jsx)(on,{title:e(`webSearchCard.title`),subtitle:e(`webSearchCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e(`webSearchCard.providerLabel`)}),(0,$.jsx)(u,{"aria-label":e(`webSearchCard.providerAriaLabel`),value:h,onChange:g,options:Ce.map(e=>({value:e,label:he[e]??e}))})]}),h===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`webSearchCard.vellumNote`)}),S&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(U,{label:e(`webSearchCard.apiBaseLabel`),type:`url`,value:_,onChange:e=>v(e.target.value),placeholder:P||e(`webSearchCard.apiBasePlaceholder`),fullWidth:!0}),P?(0,$.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`webSearchCard.apiBaseHint`,{defaultBase:P})}):null]}),C&&(0,$.jsx)(U,{label:e(`webSearchCard.apiKeyLabel`),type:`password`,value:b,onChange:e=>x(e.target.value),placeholder:N,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(cn,{onClick:F,disabled:M}),d&&(0,$.jsx)(Qt,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),C&&(0,$.jsx)(sn,{onClick:I,filled:!0})]})]})})}function Pr(){let e=Ve(),t=Pt(),[n,r]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e=window.location.hash.slice(1);e&&requestAnimationFrame(()=>{document.getElementById(e)?.scrollIntoView({block:`start`})})},[]);let i=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto`,children:[(0,$.jsx)(Xn,{}),(0,$.jsx)(Jn,{panel:n,onOpenPanel:r,onClosePanel:()=>r(null)}),(0,$.jsx)(Nr,{}),(0,$.jsx)(Ar,{}),(0,$.jsx)(yn,{}),(0,$.jsx)(Or,{}),(0,$.jsx)(br,{})]}),a=`${e??`none`}:${n?.kind===`profile`?`profile:${n.name}`:n?.kind===`provider`?`provider:${n.name}`:n?.kind??`closed`}`,o=n?.kind===`provider`||n?.kind===`add-provider`,s=n!=null&&e?n.kind===`overrides`?(0,$.jsx)(lr,{assistantId:e,onClose:()=>r(null)},a):o?(0,$.jsx)(fr,{assistantId:e,connectionName:n.kind===`provider`?n.name:null,onClose:()=>r(null)},a):(0,$.jsx)(Zn,{assistantId:e,profileName:n.kind===`profile`?n.name:null,onClose:()=>r(null)},a):null;return s&&t?(0,$.jsx)(un,{children:s}):s?(0,$.jsx)(fn,{storageKey:`aiSettingsDetailDrawerWidth`,detailKey:a,section:i,detail:s}):i}export{Pr as AiPage};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$d as t,$v as n,$x as r,Ad as i,Ao as a,Bf as o,C_ as s,Ca as c,Co as l,Cx as u,Df as d,Dm as f,Ef as p,Eo as m,Ex as h,Fo as g,Fx as _,G as v,Gf as y,Gv as b,Gx as x,Hv as S,Hx as C,Io as w,J as T,Jg as E,Jt as D,Jv as O,K as k,Kv as A,Kx as j,Lg as M,Md as N,Mo as P,Mx as F,Nd as I,No as L,Nx as R,Od as ee,Of as te,Oo as z,Ox as B,Pd as ne,Po as re,Qd as ie,Qf as V,Qv as ae,Qx as H,Sa as oe,So as se,To as ce,Uv as le,Ux as U,Vv as ue,Vx as W,W as de,Wb as G,Wv as fe,X as pe,Xb as me,Xv as he,Xx as ge,Y as _e,Ym as ve,Yv as ye,Z as be,Zd as xe,Zn as Se,Zv as Ce,_d as we,_p as Te,a_ as Ee,ad as De,at as Oe,ay as ke,bd as Ae,bo as je,bp as Me,cd as Ne,ci as Pe,cy as Fe,dh as Ie,dp as Le,dy as Re,eS as ze,ef as Be,et as Ve,ex as K,ey as He,fp as Ue,fx as We,fy as Ge,gd as Ke,gp as qe,hp as Je,hy as Ye,id as Xe,it as Ze,iy as Qe,jd as $e,kd as et,ko as tt,li as nt,ly as rt,mh as it,mp as at,my as ot,nd as st,nt as ct,ny as lt,o_ as ut,od as dt,oy as ft,pp as pt,py as mt,q as ht,qv as gt,r_ as _t,rd as vt,rx as q,ry as yt,sd as bt,sy as xt,td as St,tx as Ct,ty as wt,uh as Tt,up as Et,uy as Dt,vd as Ot,vo as kt,vp as At,vx as jt,wo as Mt,xa as Nt,xc as Pt,xd as Ft,xo as It,xp as Lt,yb as Rt,yd as zt,yo as Bt,yp as Vt,z_ as Ht,zf as Ut}from"./app-Bevxq2OH.js";import{I as J,Jn as Wt,N as Gt,Zn as Y,er as X,j as Z}from"./vendor-CtuA73w5.js";import{b as Kt,t as qt,x as Jt}from"./react-B9IgSVeK.js";import{E as Yt,Hi as Xt,It as Zt,Jn as Qt,Xr as $t,Yn as en,_t as tn,dr as nn,k as rn}from"./icons-DxrLl-Dj.js";import{t as an}from"./ellipsis-vertical-DWDUOGRm.js";import{i as on,n as sn,r as cn,t as ln}from"./service-form-controls-Dtw6VZjE.js";import{d as un,o as dn,u as fn}from"./schedules-BVvKpKi_.js";import{t as pn}from"./stt-language-picker-modal-ClWhCUb4.js";var Q=e(Jt(),1);function mn(){let e=Ve();return(0,Q.useCallback)(async(t,n)=>{try{let{data:r}=await Ht({path:{assistant_id:e},body:{value:n,type:`api_key`,name:t},throwOnError:!0});ue(r)}catch(e){throw e instanceof Error&&e.message===`No assistant found`?R.error(J(`settings:useDaemonConfig.assistantNotReadyToast`)):R.error(J(`settings:useDaemonConfig.saveApiKeyFailedToast`,{providerName:t})),G(e,{context:`provision_provider_key`}),e}},[e])}function hn(e){let[t,n]=(0,Q.useState)(void 0);return(0,Q.useEffect)(()=>{t!==void 0&&e===t.value&&n(void 0)},[e,t]),[t===void 0?e:t.value,(0,Q.useCallback)(e=>n(e===void 0?void 0:{value:e}),[])]}var gn=`0.11.0`;function _n(){return Tt(gn)}var $=qt(),vn=`gemini-3.1-flash-image-preview`;function yn(){let{t:e}=Z(`settings`),t=Ve(),n=X(),r=f(),{data:o}=Y({...ee({path:{assistant_id:t}}),enabled:r,staleTime:3e4}),c=y({onSuccess:e=>{i(n,{path:{assistant_id:t}},e)}}),l=mn(),[d,p]=hn((0,Q.useMemo)(()=>{if(!o)return K(Bt,`gemini`);let e=o.services?.[`image-generation`];return e?.mode===`managed`?`vellum`:e?.provider||K(`vellum:ai:imageGenProvider`,`gemini`)},[o])),[m,h]=(0,Q.useState)(()=>K(kt,vn)),g=L(d),_=g.includes(m)?m:g[0]??vn,[v,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(!1),C=tt.map(e=>({value:e,label:a[e]??e})),w=(0,Q.useMemo)(()=>L(d).map(e=>({value:e,label:z[e]??e})),[d]),T=d===`gemini`||d===`openai`,{hasStoredCredential:E}=Le({assistantId:t,credentialKind:`api_key`,credentialName:d,enabled:T}),D=p,O=(0,Q.useCallback)(async()=>{S(!0);let r=v.trim(),i=T&&r.length>0;try{i&&await l(re(_),r),await it();let a=d===`vellum`&&!_n()?{mode:`managed`}:{provider:d,mode:d===`vellum`?`managed`:`your-own`};await c.mutateAsync({path:{assistant_id:t},body:{services:{"image-generation":a}}}).catch(t=>{throw R.error(e(`imageGenerationCard.configUpdateFailedToast`)),G(t,{context:`patch_daemon_config`}),t});try{await s({path:{assistant_id:t},body:{modelId:_},throwOnError:!0})}catch(t){throw R.error(e(`imageGenerationCard.modelUpdateFailedToast`)),G(t,{context:`set_image_gen_model`}),t}finally{n.invalidateQueries({queryKey:et({path:{assistant_id:t}})})}}catch{S(!1);return}S(!1);try{if(q(Bt,d),q(kt,_),i){let e=Et(t,`api_key`,d);n.setQueryData(e,!0),n.invalidateQueries({queryKey:e}),b(``)}R.success(e(`imageGenerationCard.savedToast`))}catch(t){G(t,{context:`settings-ai-image-gen-persist-local`}),R.error(e(`imageGenerationCard.localPreferencesFailedToast`))}},[v,d,T,_,t,c,l,n,e]),k=(0,Q.useCallback)(()=>{b(``),h(vn),q(kt,vn)},[]);return(0,$.jsx)(on,{title:e(`imageGenerationCard.title`),subtitle:e(`imageGenerationCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e(`imageGenerationCard.providerLabel`)}),(0,$.jsx)(u,{"aria-label":e(`imageGenerationCard.providerAriaLabel`),value:d,onChange:D,options:C})]}),d===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`imageGenerationCard.vellumNote`)}),T&&(0,$.jsx)(U,{label:e(`imageGenerationCard.apiKeyLabel`),type:`password`,value:v,onChange:e=>b(e.target.value),placeholder:Ot(e(d===`openai`?`imageGenerationCard.openaiApiKeyPlaceholder`:`imageGenerationCard.geminiApiKeyPlaceholder`),E),fullWidth:!0}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e(`imageGenerationCard.activeModelLabel`)}),(0,$.jsx)(u,{"aria-label":e(`imageGenerationCard.modelAriaLabel`),value:_,onChange:h,options:w})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(cn,{onClick:O,disabled:x}),x&&(0,$.jsx)(Qt,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),T&&(0,$.jsx)(sn,{onClick:k})]})]})})}function bn({title:e,count:t,action:n,children:r}){return(0,$.jsxs)(`section`,{className:`rounded-xl border border-[var(--border-hover)] bg-[var(--surface-overlay)] px-3 py-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,$.jsx)(H,{variant:`body-large-default`,as:`h3`,className:`text-[var(--content-secondary)]`,children:e}),t==null?null:(0,$.jsxs)(H,{variant:`body-large-default`,as:`span`,"aria-label":`${t} ${e.toLowerCase()}`,className:`text-[var(--content-disabled)]`,children:[`·`,` `,t]})]}),n]}),r==null?null:(0,$.jsx)(`div`,{className:`mt-4 border-t border-[var(--border-base)]`,children:r})]})}function xn(e){return e.scheduleNames.length>0||e.deferredReminderCount>0||e.scheduleLookupFailed}var Sn=5;function Cn({title:e,items:t,mono:n}){return(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-(--content-tertiary)`,children:e}),(0,$.jsx)(`ul`,{className:`space-y-1 pl-1`,children:t.map(e=>(0,$.jsxs)(`li`,{className:`text-body-small-default text-(--content-secondary)`,children:[`• `,n?(0,$.jsx)(`code`,{children:e}):e]},e))})]})}function wn(e){let t=e.label||e.name,n=[];e.isActive&&n.push(J(`settings:manageProfilesBlockedDeleteModal.clauseDefaultProfile`)),e.callSiteIds.length>0&&n.push(J(`settings:manageProfilesBlockedDeleteModal.clauseActionOverrides`,{count:e.callSiteIds.length}));let r=e.scheduleNames.length,i=e.deferredReminderCount;return r>0&&i>0?n.push(J(`settings:manageProfilesBlockedDeleteModal.clauseRunsBoth`,{schedules:r,reminders:i})):r>0?n.push(J(`settings:manageProfilesBlockedDeleteModal.clauseRunsSchedules`,{count:r})):i>0&&n.push(J(`settings:manageProfilesBlockedDeleteModal.clauseRunsReminders`,{count:i})),n.length===0?J(`settings:manageProfilesBlockedDeleteModal.summaryNoReferences`,{display:t}):n.length===1?J(`settings:manageProfilesBlockedDeleteModal.summaryOneClause`,{display:t,clause1:n[0]}):n.length===2?J(`settings:manageProfilesBlockedDeleteModal.summaryTwoClauses`,{display:t,clause1:n[0],clause2:n[1]}):J(`settings:manageProfilesBlockedDeleteModal.summaryThreeClauses`,{display:t,clause1:n[0],clause2:n[1],clause3:n[2]})}function Tn({blocked:e,availableReplacements:t,replacement:n,onReplacementChange:i,error:a,saving:o,onClose:s,onConfirm:c}){let{t:l}=Z(`settings`),d=e?.scheduleNames??[],f=d.slice(0,Sn),p=d.length-f.length,m=e!=null&&xn(e);return(0,$.jsx)(_.Root,{open:e!==null,onOpenChange:e=>{e||s()},children:(0,$.jsxs)(_.Content,{size:`sm`,children:[(0,$.jsx)(_.Header,{children:(0,$.jsx)(_.Title,{children:l(`manageProfilesBlockedDeleteModal.title`)})}),(0,$.jsxs)(_.Body,{className:`space-y-4`,children:[e&&(0,$.jsx)(H,{variant:`body-medium-default`,as:`p`,children:wn(e)}),e&&e.callSiteIds.length>0&&(0,$.jsx)(Cn,{title:l(`manageProfilesBlockedDeleteModal.actionOverridesTitle`),items:e.callSiteIds,mono:!0}),f.length>0&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(Cn,{title:l(`manageProfilesBlockedDeleteModal.schedulesTitle`),items:f}),p>0&&(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`pl-1 text-(--content-tertiary)`,children:l(`manageProfilesBlockedDeleteModal.moreSchedules`,{count:p})})]}),e?.scheduleLookupFailed&&(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-(--system-mid-strong)`,children:l(`manageProfilesBlockedDeleteModal.scheduleLookupFailed`)}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-(--content-tertiary)`,children:l(`manageProfilesBlockedDeleteModal.replacementLabel`)}),(0,$.jsx)(u,{"aria-label":l(`manageProfilesBlockedDeleteModal.replacementLabel`),value:n,onChange:i,placeholder:l(`manageProfilesBlockedDeleteModal.replacementPlaceholder`),options:t.map(e=>{let t=m&&e.status===`disabled`;return{value:e.name,label:ht(e),disabled:t,tooltip:t?l(`manageProfilesBlockedDeleteModal.disabledTargetTooltip`):void 0}})})]}),a&&(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:a})]}),(0,$.jsxs)(_.Footer,{children:[(0,$.jsx)(r,{variant:`ghost`,size:`compact`,onClick:s,children:l(`manageProfilesBlockedDeleteModal.cancel`)}),(0,$.jsx)(r,{variant:`primary`,size:`compact`,disabled:!n||o,onClick:c,children:l(o?`manageProfilesBlockedDeleteModal.saving`:`manageProfilesBlockedDeleteModal.reassignAndDelete`)})]})]})})}function En({profile:e,isActiveProfile:t,selected:n,connections:i,deletePending:a=!1,onOpen:o,onMakeActive:s,onSetStatus:c,onDelete:l}){let{t:u}=Z(`settings`),d=e.source===`managed`,f=e.status===`disabled`,p=e.label??e.name,m=[];e.model&&m.push(Xe(e.provider??void 0,e.model,i)),d&&m.push(u(`profileRow.managedByVellum`));let g=e.availability,_=e.config_issue,v=_!=null||g?.status===`incomplete`,y=g?.message??u(`profileRow.providerUnavailableDefault`),b=_==null?g!=null&&g.status!==`ok`?v?u(`profileRow.providerUnavailableFixable`,{message:y}):y:null:u(`profileRow.providerUnavailableFixable`,{message:u(_.code===`over_output_cap`?`profileRow.configIssueOverOutputCap`:_.code===`no_input_room`?`profileRow.configIssueNoInputRoom`:`profileRow.configIssueModelUnknown`)});return(0,$.jsx)(We,{title:(0,$.jsx)(`span`,{className:f?`opacity-55`:void 0,children:p}),subtitle:m.length>0?m.join(` • `):void 0,onClick:o,showChevron:!1,selected:n,disabled:a,contentAriaLabel:u(`profileRow.openProfileAriaLabel`,{displayName:p}),trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[b==null?null:(0,$.jsx)(ze,{content:b,children:v?(0,$.jsx)(`button`,{type:`button`,onClick:o,"aria-label":b,className:`inline-flex cursor-pointer rounded-sm p-0.5 keyboard-focus:ring-2 keyboard-focus:ring-[var(--ring)]`,children:(0,$.jsx)(Xt,{className:`h-4 w-4 text-[var(--system-mid-strong)]`,"aria-hidden":`true`})}):(0,$.jsx)(`span`,{className:`inline-flex p-0.5`,tabIndex:0,children:(0,$.jsx)(Xt,{className:`h-4 w-4 text-[var(--system-mid-strong)]`,"aria-label":b,role:`img`})})}),f?(0,$.jsx)(j,{tone:`neutral`,children:u(`profileRow.disabledTag`)}):null,t?(0,$.jsx)(j,{tone:`positive`,children:u(`profileRow.defaultTag`)}):null,(0,$.jsxs)(B.Root,{children:[(0,$.jsx)(B.Trigger,{asChild:!0,children:(0,$.jsx)(r,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(an,{}),"aria-label":u(`profileRow.actionsAriaLabel`,{displayName:p}),disabled:a})}),(0,$.jsxs)(B.Content,{align:`end`,sideOffset:4,children:[(0,$.jsx)(B.Item,{onSelect:o,children:u(d?`profileRow.view`:`profileRow.edit`)}),!t&&!f&&Re(e.provider,e.model)?(0,$.jsx)(B.Item,{onSelect:s,children:u(`profileRow.makeDefault`)}):null,f?(0,$.jsx)(B.Item,{onSelect:()=>c(!0),children:u(`profileRow.enable`)}):d?null:(0,$.jsx)(B.Item,{onSelect:()=>c(!1),children:u(`profileRow.disable`)}),d?null:(0,$.jsx)(B.Item,{onSelect:l,className:h.anchored,children:u(`profileRow.delete`)})]})]})]})})}function Dn(e,t){let n=Pe(),{data:r}=Y({...xe({path:{assistant_id:e}}),enabled:n,staleTime:3e4}),{profiles:i,profileOrder:a}=de(t?.llm,e);return(0,Q.useMemo)(()=>r==null?{entries:S(i,a).map(e=>({name:e.name,label:e.label??null,provider:e.provider??null,model:e.model??null,status:e.status===`disabled`?`disabled`:`active`,source:e.source===`managed`?`managed`:`user`,provider_connection:e.provider_connection,availability:null})),isEffectiveCatalog:!1}:{entries:r.profiles,isEffectiveCatalog:!0},[r,i,a])}var On=`0.10.8`;function kn(e){return Ie(On,e)}var An=`settings-ai-profile-make-active`,jn=`Failed to set the active profile. Please try again.`;function Mn(e){let t=st(),n=X(),r=kn(e),i=V({onSuccess:()=>{n.invalidateQueries({queryKey:et({path:{assistant_id:e}})}),n.invalidateQueries({queryKey:ie({path:{assistant_id:e}})})}});async function a(n,r,i){try{await t.mutateAsync({path:{assistant_id:e},body:{llm:n}})}catch(e){throw G(e,{context:r}),R.error(i),e}}async function o(t){if(!r){await a({activeProfile:t},An,jn);return}try{await i.mutateAsync({path:{assistant_id:e},body:{name:t}})}catch(e){let t=me(e);throw R.error(t??jn),t||G(e,{context:An}),e}}return{makeActive:o,setStatus:(e,t)=>a({profiles:{[e]:{status:t?`active`:`disabled`}}},`settings-ai-profile-toggle`,`Failed to update the profile. Please try again.`),deleteProfile:(e,t,n)=>a({profiles:{[e]:null},profileOrder:t.filter(t=>t!==e),...n?.isAdvisor?{advisorProfile:null}:{}},`settings-ai-profile-delete`,`Failed to delete the profile. Please try again.`),patchLlm:a,isPending:t.isPending||i.isPending}}var Nn=`The profile was not deleted.`,Pn=`Failed to move the schedules. ${Nn}`;function Fn(e){let t=me(e);return t?`${/[.!?]$/.test(t)?t:`${t}.`} ${Nn}`:Pn}function In(e,t,n){let r=Mn(e),i=X(),a=be(),o=t?.llm?.activeProfile??null,s=t?.llm?.advisorProfile??null,c=t?.llm?.callSites??{},l=(0,Q.useMemo)(()=>t?.llm?.profiles??{},[t?.llm?.profiles]),u=(0,Q.useMemo)(()=>t?.llm?.profileOrder??[],[t?.llm?.profileOrder]),f=(0,Q.useMemo)(()=>S(l,u),[l,u]),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(``),[x,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(null),E=(0,Q.useRef)(!1);function D(e){return f.filter(t=>t.name===e?!1:t.status===`disabled`?!0:v(t,f,{requireOwnProviderAndModel:a}))}function O(e,t){let n=D(e).filter(e=>!t||e.status!==`disabled`),r=n.find(e=>e.name===o),i=n.find(e=>e.source!==`managed`);return(r??i??n[0])?.name??``}async function k(e){try{await r.deleteProfile(e,u,{isAdvisor:e===s}),n?.onDeleted?.(e)}catch{}}async function A(t){let n=l[t]?.label??t,r=t===o,a=Object.entries(c).filter(([e,n])=>e!==`mainAgent`&&n?.profile===t).map(([e])=>e),s=[],u=0,d=!1;try{let n=(await i.fetchQuery({...p({path:{assistant_id:e},query:{inference_profile:t,include_all:`true`}}),retry:!1,staleTime:0})).schedules??[];s=n.filter(e=>!e.isDeferred).map(e=>e.name),u=n.filter(e=>e.isDeferred).length}catch(e){G(e,{context:`settings-ai-profile-delete-schedule-scan`}),d=!0}if(!(r||a.length>0||s.length>0||u>0)&&!d){await k(t);return}let f={name:t,label:n,isActive:r,callSiteIds:a,scheduleNames:s,deferredReminderCount:u,scheduleLookupFailed:d};h(f),b(O(t,xn(f))),_(null)}function j(e){t==null||E.current||(E.current=!0,T(e),A(e).finally(()=>{E.current=!1,T(null)}))}async function M(){if(!m||!y)return;if(C(!0),_(null),xn(m))try{await dn(e,m.name,y),await i.invalidateQueries({queryKey:d({path:{assistant_id:e}})})}catch(e){G(e,{context:`settings-ai-profile-reassign-schedules`}),_(Fn(e)),C(!1);return}let t={};if(m.isActive&&(t.activeProfile=y),m.callSiteIds.length>0){let e={};for(let t of m.callSiteIds)e[t]={profile:y};t.callSites=e}if(Object.keys(t).length>0)try{await r.patchLlm(t,`settings-ai-profile-reassign-delete`,`Failed to reassign references. Please try again.`)}catch{_(`Failed to reassign references. Please try again.`),C(!1);return}let n=m.name;h(null),C(!1),k(n)}return{requestDelete:j,pendingDeleteName:w,blockedDeleteModalProps:{blocked:m,availableReplacements:D(m?.name??null),replacement:y,onReplacementChange:b,error:g,saving:x,onClose:()=>{h(null),_(null)},onConfirm:()=>void M()}}}function Ln(){}function Rn({assistantId:e,config:t,connections:n,selectedProfileName:i,onOpenProfile:a,onCreateProfile:o,onProfileDeleted:s}){let{t:c}=Z(`settings`),{entries:l}=Dn(e,t),u=Mn(e),d=In(e,t,{onDeleted:s}),f=t?.llm?.activeProfile??null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(bn,{title:c(`profilesSection.title`),action:(0,$.jsx)(r,{variant:`primary`,onClick:o,leftIcon:(0,$.jsx)(Zt,{}),disabled:t==null,children:c(`profilesSection.createProfile`)}),children:t==null?(0,$.jsx)(H,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:c(`profilesSection.loading`)}):l.length===0?(0,$.jsx)(H,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:c(`profilesSection.emptyState`)}):l.map(e=>(0,$.jsx)(En,{profile:e,isActiveProfile:e.name===f,selected:e.name===i,connections:n,deletePending:d.pendingDeleteName===e.name,onOpen:()=>a(e.name),onMakeActive:()=>void u.makeActive(e.name).catch(Ln),onSetStatus:t=>void u.setStatus(e.name,t).catch(Ln),onDelete:()=>d.requestDelete(e.name)},e.name))}),(0,$.jsx)(Tn,{...d.blockedDeleteModalProps})]})}var zn={anthropic:!0,openai:!0,gemini:!0,fireworks:!0,openrouter:!0,chatgpt:!0,vellum:!0,together:!0,"vercel-ai-gateway":!0,minimax:!0,atlascloud:!0,baseten:!0,poolside:!0};function Bn(e){return e in zn}function Vn(e){if(!e.baseUrl)return null;try{return new URL(e.baseUrl).host}catch{return e.baseUrl}}function Hn(e){let t=Vn(e)??``,n=[];t&&n.push(t);let r=e.models?.length??0;return r>0&&n.push(`${r} ${r===1?`model`:`models`}`),e.auth.type===`none`&&n.push(`keyless`),n.join(` · `)}function Un(e){switch(e.auth.type){case`api_key`:return`Own API key`;case`oauth_subscription`:return`ChatGPT subscription`;case`none`:return`No API key needed`;default:return null}}function Wn(e){if(e.provider===`vellum`)return`Included with your plan`;if(e.provider===`openai-compatible`)return Hn(e);let t=[];if(e.provider===`ollama`||e.provider===`opencode`){let n=Vn(e);n&&t.push(n)}let n=e.provider===`chatgpt`?`openai`:e.provider,r=e.auth.type===`oauth_subscription`?dt(n):mt(n),i=e.models?.length??r.length;i>0&&t.push(`${i} ${i===1?`model`:`models`}`);let a=Un(e);return a&&t.push(a),t.join(` • `)}function Gn({connection:e,isDefault:t,supportsDefaultProvider:n,selected:i,isSettingDefault:a,onOpen:o,onSetDefault:s,onDelete:c}){let{t:l}=Z(`settings`),u=e.isManaged??!1,d=At(e),f=Bn(e.provider),p=Wn(e),m=n&&!t&&f,g=!u&&o!=null,_=!u&&!t,v=m||g||_;return(0,$.jsx)(We,{title:d,subtitle:p.length>0?p:void 0,onClick:o,showChevron:!1,selected:i,contentAriaLabel:o?l(`providerRow.openProviderAriaLabel`,{displayName:d}):void 0,trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsx)(j,{tone:`neutral`,title:l(`providerRow.managedTagTitle`),children:l(`providerRow.managedTag`)}):null,t?(0,$.jsx)(j,{tone:`info`,title:l(`providerRow.defaultTagTitle`),children:l(`providerRow.defaultTag`)}):null,e.provider===`ollama`?(0,$.jsx)(j,{tone:`neutral`,title:l(`providerRow.localTagTitle`),children:l(`providerRow.localTag`)}):null,e.provider===`openai-compatible`?(0,$.jsx)(j,{tone:`neutral`,title:l(`providerRow.customTagTitle`),children:l(`providerRow.customTag`)}):null,v?(0,$.jsxs)(B.Root,{children:[(0,$.jsx)(B.Trigger,{asChild:!0,children:(0,$.jsx)(r,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(an,{}),"aria-label":l(`providerRow.actionsAriaLabel`,{displayName:d})})}),(0,$.jsxs)(B.Content,{align:`end`,sideOffset:4,children:[g?(0,$.jsx)(B.Item,{onSelect:o,children:l(`providerRow.edit`)}):null,m?(0,$.jsx)(B.Item,{disabled:a,onSelect:s,children:l(`providerRow.setAsDefault`)}):null,_?(0,$.jsx)(B.Item,{onSelect:c,className:h.anchored,children:l(`providerRow.delete`)}):null]})]}):(0,$.jsx)(`span`,{className:`inline-block w-8`,"aria-hidden":!0})]})})}function Kn(e,t){let n=X(),r={path:{assistant_id:e}},i=Wt({...ne(),onSuccess:()=>{n.invalidateQueries({queryKey:I(r)}),n.invalidateQueries({queryKey:et(r)}),n.invalidateQueries({queryKey:ie(r)})},onError:e=>{G(e,{context:`settings-ai-set-default-provider`}),R.error(J(`settings:useProviderActions.setDefaultFailedToast`))}});function a(t){Bn(t.provider)&&i.mutate({path:{assistant_id:e},body:{provider:t.provider,connectionName:t.name}})}function o(e){return i.isPending&&i.variables?.body?.connectionName===e}async function s(i){try{let{response:a}=await Ee({path:{assistant_id:e,name:i}});a?.ok||a?.status===404?(n.invalidateQueries({queryKey:Be(r)}),t?.onDeleted?.(i)):a?.status===409?R.error(J(`settings:useProviderActions.deleteInUseToast`)):R.error(J(`settings:useProviderActions.deleteFailedToast`))}catch(e){G(e,{context:`settings-ai-provider-delete`}),R.error(J(`settings:useProviderActions.deleteFailedToast`))}}return{setDefault:a,isSettingDefault:o,deleteConnection:s}}function qn({assistantId:e,selectedConnectionName:n,onOpenConnection:i,onAddProvider:a,onConnectionDeleted:o}){let{t:s}=Z(`settings`),{data:c,isLoading:l,isError:u}=Y(t({path:{assistant_id:e}})),d=nt(),{data:f}=Y({...N({path:{assistant_id:e}}),enabled:d}),p=d?f?.resolvedConnectionName??null:null,m=Kn(e,{onDeleted:o}),h=(0,Q.useMemo)(()=>{let e=c?.connections??[];return[...e.filter(e=>e.provider===xt),...e.filter(e=>e.provider!==xt)]},[c]);return(0,$.jsx)(bn,{title:s(`providersSection.title`),action:(0,$.jsx)(r,{variant:`outlined`,onClick:a,leftIcon:(0,$.jsx)(Zt,{}),children:s(`providersSection.addProvider`)}),children:l?(0,$.jsx)(`div`,{className:`space-y-2 py-2`,children:[1,2,3].map(e=>(0,$.jsx)(jt,{className:`h-10 rounded-lg`},e))}):u?(0,$.jsx)(H,{variant:`body-medium-default`,as:`p`,className:`py-4 text-center text-(--system-negative-strong)`,children:s(`providersSection.loadError`)}):h.length===0?(0,$.jsx)(H,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:s(`providersSection.empty`)}):h.map(e=>(0,$.jsx)(Gn,{connection:e,isDefault:e.name===p,supportsDefaultProvider:d,selected:e.name===n,isSettingDefault:m.isSettingDefault(e.name),onOpen:e.isManaged??!1?void 0:()=>i(e.name),onSetDefault:()=>m.setDefault(e),onDelete:()=>void m.deleteConnection(e.name)},e.name))})}function Jn({panel:e,onOpenPanel:n,onClosePanel:i}){let{t:a}=Z(`settings`),o=Ve(),{data:s}=Y({...ee({path:{assistant_id:o}}),staleTime:3e4}),c=nt(),{data:l}=Y({...N({path:{assistant_id:o}}),enabled:c}),u=l?.availability,{data:d}=Y({...t({path:{assistant_id:o}})}),f=d?.connections,p=s?.llm?.callSites??{},m=Object.entries(p).filter(([e,t])=>e!==`mainAgent`&&(t?.profile!=null||t?.provider!=null||t?.model!=null)).length;return(0,$.jsx)(on,{title:a(`languageModelCard.title`),subtitle:a(`languageModelCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[u&&u.status!==`ok`&&(0,$.jsx)(ge,{tone:u.status===`unknown`?`warning`:`error`,children:u.message??a(`languageModelCard.defaultProviderUnavailable`)}),o&&(0,$.jsx)(Rn,{assistantId:o,config:s,connections:f,selectedProfileName:e?.kind===`profile`?e.name:null,onOpenProfile:e=>n({kind:`profile`,name:e}),onCreateProfile:()=>n({kind:`create-profile`}),onProfileDeleted:t=>{e?.kind===`profile`&&e.name===t&&i()}}),o&&(0,$.jsx)(qn,{assistantId:o,selectedConnectionName:e?.kind===`provider`?e.name:null,onOpenConnection:e=>n({kind:`provider`,name:e}),onAddProvider:()=>n({kind:`add-provider`}),onConnectionDeleted:t=>{e?.kind===`provider`&&e.name===t&&i()}}),(0,$.jsx)(bn,{title:a(`languageModelCard.overridesTitle`),count:m,action:(0,$.jsx)(r,{variant:`outlined`,onClick:()=>n({kind:`overrides`}),children:a(`languageModelCard.manage`)})})]})})}function Yn({children:e}){return(0,$.jsxs)(`a`,{href:`https://www.vellum.ai/docs/pricing`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-[var(--primary-base)] hover:underline`,children:[e,(0,$.jsx)($t,{className:`h-3.5 w-3.5`})]})}function Xn(){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] px-4 py-2.5`,children:[(0,$.jsx)(nn,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:(0,$.jsx)(Gt,{i18nKey:`managedServicesBanner.body`,ns:`common`,components:{link:(0,$.jsx)(Yn,{})}})})]})}function Zn({assistantId:e,profileName:n,onClose:i}){let{t:a}=Z(`settings`),{data:o}=Y({...ee({path:{assistant_id:e}}),staleTime:3e4}),{data:s}=Y({...t({path:{assistant_id:e}})}),c=s?.connections,l=(0,Q.useMemo)(()=>o?.llm?.profiles??{},[o?.llm?.profiles]),u=Object.keys(l),d=(0,Q.useMemo)(()=>{if(n==null)return;let e=l[n];return e?{name:n,...e}:void 0},[n,l]),f=n==null?`create`:d?.source===`managed`||d?.invariant===!0?`view`:`edit`,{saveProfile:p,isPending:m}=St(e,{onSaved:i}),h=vt({mode:f,profileName:n??void 0,initialValues:d,existingNames:u,connections:c,assistantId:e,onSave:p}),g=In(e,o,{onDeleted:()=>i()}),_=n!=null&&g.pendingDeleteName===n,v=n!=null&&o!=null&&!(n in l);(0,Q.useEffect)(()=>{v&&!h.saving&&!m&&i()},[v,h.saving,m,i]);let y=f===`view`;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Se,{title:h.effectiveMode===`create`?a(`profileDetailPanel.createTitle`):d?.label??n??a(`profileDetailPanel.defaultTitle`),closeVariant:`outlined`,onClose:i,headerTrailing:y&&h.effectiveMode!==`create`?(0,$.jsx)(j,{tone:`neutral`,children:a(`profileDetailPanel.managedTag`)}):null,headerActions:h.effectiveMode!==`create`&&!h.isReadOnly?(0,$.jsx)(r,{variant:`dangerOutline`,iconOnly:_?(0,$.jsx)(Qt,{className:`animate-spin`}):(0,$.jsx)(rn,{}),"aria-label":a(_?`profileDetailPanel.deleting`:`profileDetailPanel.delete`),tooltip:a(`profileDetailPanel.delete`),onClick:()=>{n!=null&&g.requestDelete(n)},disabled:h.saving||_}):null,footer:h.isReadOnly?(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(r,{variant:`outlined`,onClick:h.switchToSaveAsNew,disabled:h.saving,children:a(`profileDetailPanel.saveAsNew`)}),h.hasViewModeChanges?(0,$.jsx)(r,{variant:`primary`,onClick:()=>void h.handleSave(),disabled:h.saving,children:h.saving?a(`profileDetailPanel.saving`):a(`profileDetailPanel.save`)}):null]}):(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(r,{variant:`primary`,onClick:()=>void h.handleSave(),disabled:h.isInvalid||h.saving,children:h.saving?a(`profileDetailPanel.saving`):h.effectiveMode===`create`?a(`profileDetailPanel.create`):a(`profileDetailPanel.saveChanges`)})}),children:(0,$.jsx)(De,{editor:h,assistantId:e,connections:c,variant:`panel`})}),(0,$.jsx)(Tn,{...g.blockedDeleteModalProps})]})}function Qn({value:e,profileOptions:t,disabled:n,onChange:r}){let{t:i}=Z(`settings`);return(0,$.jsx)(`div`,{className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-default font-medium text-[var(--content-default)]`,children:i(`advisorProfileRow.title`)}),(0,$.jsx)(`p`,{className:`mt-0.5 text-body-small-lighter text-[var(--content-tertiary)]`,children:i(`advisorProfileRow.description`)})]}),(0,$.jsx)(u,{value:e,onChange:r,options:t,placeholder:i(`advisorProfileRow.chooseProfilePlaceholder`),className:`w-44`,menuMinWidth:280,menuAlign:`start`,disabled:n})]})})}var $n=`__custom__`;function er(e){return e?!!(e.profile||e.provider||e.model):!1}function tr(e,t){if(t?.provider||t?.model)return null;let n=e.defaultProfile??e.shippedDefaultProfile;return n?{profile:n,via:t?.profile===n?`override`:`default`}:null}function nr(e,t){let n=er(e);return n===er(t)?n?(e?.profile??null)===(t?.profile??null)&&(e?.provider??null)===(t?.provider??null)&&(e?.model??null)===(t?.model??null):!0:!1}function rr({assistantId:e,callSites:t,domains:n,persistedOverrides:i,orderedProfiles:a,onClose:o,onApplied:s}){let{t:c}=Z(`settings`),l=st(),d=be(),f=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:d}),[d]),p=(0,Q.useMemo)(()=>{let e=new Map;for(let n of t){let t=tr(n,i[n.id]);t&&e.set(n.id,t)}return e},[t,i]),m=(0,Q.useMemo)(()=>{let e=new Set(Array.from(p.values(),e=>e.profile));return a.filter(t=>e.has(t.name))},[a,p]),[h,g]=(0,Q.useState)(()=>m[0]?.name??``),[v,y]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(new Set),[C,w]=(0,Q.useState)(!1),T=(0,Q.useMemo)(()=>{let e=new Map(n.map(e=>[e.id,e.displayName]));return t=>e.get(t)??t},[n]),E=(0,Q.useMemo)(()=>t.filter(e=>p.get(e.id)?.profile===h),[t,p,h]),D=(0,Q.useMemo)(()=>E.map(e=>e.id).filter(e=>!x.has(e)),[E,x]),O=(0,Q.useMemo)(()=>m.map(e=>({value:e.name,label:ht(e)})),[m]),k=(0,Q.useMemo)(()=>pe(a,[],f).filter(e=>e.name!==h).map(e=>({value:e.name,label:ht(e)})),[a,h,f]),A=b(a,h),j=b(a,v),M=x.size===0;function N(e){g(e),S(new Set),e===v&&y(``)}function P(e,t){S(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})}async function F(){if(!(!h||!v||D.length===0)){w(!0);try{let t={};for(let e of D)t[e]={profile:v};await l.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:t}}}),R.success(c(`bulkOverrideSwapModal.successToast`,{count:D.length,targetLabel:j})),s(),o()}catch(e){let t=me(e);R.error(t??c(`bulkOverrideSwapModal.updateFailedToast`)),t||G(e,{context:`settings-ai-bulk-override-swap`})}finally{w(!1)}}}return(0,$.jsx)(_.Root,{open:!0,onOpenChange:e=>{e||o()},children:(0,$.jsxs)(_.Content,{size:`md`,children:[(0,$.jsx)(_.Header,{children:(0,$.jsx)(_.Title,{children:c(`bulkOverrideSwapModal.title`)})}),(0,$.jsxs)(_.Body,{className:`space-y-4`,children:[(0,$.jsx)(H,{variant:`body-medium-default`,as:`p`,children:c(`bulkOverrideSwapModal.intro`)}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(u,{id:`bulk-swap-source`,label:c(`bulkOverrideSwapModal.currentlyUsingLabel`),value:h,onChange:N,options:O}),(0,$.jsx)(u,{id:`bulk-swap-target`,label:c(`bulkOverrideSwapModal.changeToLabel`),value:v,onChange:y,options:k,placeholder:c(`bulkOverrideSwapModal.targetPlaceholder`)})]}),(0,$.jsx)(ge,{tone:`info`,title:c(`bulkOverrideSwapModal.noticeTitle`),children:c(`bulkOverrideSwapModal.noticeBody`,{sourceLabel:A})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(H,{variant:`body-medium-default`,as:`p`,children:c(`bulkOverrideSwapModal.affectedSummary`,{count:E.length,profile:A})}),(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-[color:var(--content-secondary)]`,children:c(`bulkOverrideSwapModal.chooseActions`)})]}),(0,$.jsx)(r,{variant:`ghost`,onClick:()=>S(M?new Set(E.map(e=>e.id)):new Set),children:c(M?`bulkOverrideSwapModal.clearAll`:`bulkOverrideSwapModal.selectAll`)})]}),(0,$.jsx)(`div`,{className:`max-h-72 space-y-1 overflow-y-auto`,children:E.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-[var(--border-base)] px-3 py-2`,children:[(0,$.jsx)(W,{checked:!x.has(e.id),onCheckedChange:t=>P(e.id,t===!0),disabled:C,label:e.displayName,helperText:T(e.domain)}),(0,$.jsx)(`span`,{className:`shrink-0 text-body-small-default text-[color:var(--content-tertiary)]`,children:p.get(e.id)?.via===`override`?c(`bulkOverrideSwapModal.viaOverride`):c(`bulkOverrideSwapModal.viaDefault`)})]},e.id))})]})]}),(0,$.jsxs)(_.Footer,{children:[(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`mr-auto self-center text-[color:var(--content-secondary)]`,children:c(`bulkOverrideSwapModal.willChange`,{count:D.length})}),(0,$.jsx)(r,{variant:`ghost`,onClick:o,disabled:C,children:c(`bulkOverrideSwapModal.cancel`)}),(0,$.jsx)(r,{variant:`primary`,disabled:!h||!v||D.length===0||C,onClick:()=>void F(),children:C?(0,$.jsx)(Qt,{className:`h-4 w-4 animate-spin`}):c(`bulkOverrideSwapModal.applyTo`,{count:D.length})})]})]})})}function ir({id:e,displayName:t,description:n,defaultProfileLabel:r,draft:i,profileOptions:a,connections:o,onDraftChange:s,onToggle:c}){let{t:l}=Z(`settings`),d=Dt({hostedInference:Ne.use.vellumHostedInference()}),f=er(i),p=!i||!f?``:i.provider||i.model?$n:i.profile??``,m=p===$n,h=at(),g=Ue(),_=(o??[]).some(e=>e.provider===ke),v=[...ft.filter(Ye),..._?[ke]:[]],y=h[0]??ft[0],b=i?.provider,x=Fe(b)?b:b===`chatgpt`?ke:void 0,S=x!==void 0&&v.some(e=>e===x),w=x??y,T=bt(w,``,(o??[]).filter(e=>pt(e.provider,w)))?dt(w):ot(w,d),E=T.map(e=>({value:e.id,label:e.displayName})),D=typeof i?.model==`string`?i.model:``;if(D&&!T.some(e=>e.id===D)){let e=mt(w).find(e=>e.id===D)?.displayName??D;E.push({value:D,label:l(`callSiteOverridesRow.unavailableOption`,{name:e})})}let O=!!i?.provider&&!i?.model,k=[...v.map(e=>({value:e,label:rt[e]??e,...g(e)})),...x&&!S?[{value:x,label:l(`callSiteOverridesRow.unavailableOption`,{name:rt[x]??x})}]:[]];function A(t){t===`__custom__`?s(e,{profile:null,provider:y,model:Ge(y)??``}):t===``?s(e,null):s(e,{profile:t,provider:null,model:null})}function j(t){let n=Ge(t)??``;s(e,{...i??{},profile:null,provider:t,model:n})}function M(t){s(e,{...i??{},model:t})}return(0,$.jsxs)(`div`,{className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-default font-medium text-[var(--content-default)]`,children:t}),n&&(0,$.jsxs)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[n,r&&(0,$.jsx)(`span`,{className:`ml-1.5 text-body-small-default text-[var(--content-tertiary)] opacity-60`,children:l(`callSiteOverridesRow.defaultProfileSuffix`,{label:r})})]})]}),(0,$.jsx)(C,{checked:f,onChange:t=>c(e,t),"aria-label":l(`callSiteOverridesRow.overrideAriaLabel`,{displayName:t}),className:`shrink-0`})]}),f&&(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(u,{value:p,onChange:A,options:a,className:`w-44`,menuMinWidth:280,menuAlign:`start`})}),f&&m&&(0,$.jsxs)(`div`,{className:`mt-3 space-y-2 border-t border-[var(--border-base)] pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:l(`callSiteOverridesRow.providerLabel`)}),(0,$.jsx)(u,{value:w??``,onChange:j,options:k})]}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:l(`callSiteOverridesRow.modelLabel`)}),(0,$.jsx)(u,{value:i?.model??``,onChange:M,options:E})]})]}),O&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:l(`callSiteOverridesRow.pickModelError`)})]})]})}function ar({groups:e,drafts:t,buildProfileOptionsForRow:n,profileLabelFor:r,advisorMatchesSearch:i,connections:a,onDraftChange:o,onToggle:s}){let{t:c}=Z(`settings`);return(0,$.jsx)(`div`,{className:`space-y-4`,children:e.length===0?i?null:(0,$.jsx)(`p`,{className:`py-8 text-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:c(`overridesCallSiteList.emptySearch`)}):e.map(({domain:e,sites:i})=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`mb-2 text-body-small-default font-semibold uppercase tracking-wider text-[var(--content-tertiary)]`,children:e.displayName}),(0,$.jsx)(`div`,{className:`space-y-1`,children:i.map(e=>{let i=(()=>{let n=t[e.id]??null;return!n||!er(n)?``:n.provider||n.model?$n:n.profile??``})(),c=e.shippedDefaultProfile??e.defaultProfile,l=c?r(c):null;return(0,$.jsx)(ir,{id:e.id,displayName:e.displayName,description:e.description,defaultProfileLabel:l,draft:t[e.id]??null,profileOptions:n(i===``||i===`__custom__`?null:i),connections:a,onDraftChange:o,onToggle:s},e.id)})})]},e.id))})}function or(e,t){let n={};for(let r of Object.keys(e)){let i=e[r]??null;er(i)?n[r]={profile:i?.profile??null,provider:i?.provider??null,model:i?.model??null}:r in t&&t[r]===null&&(n[r]=null)}return n}function sr(e){let t={};for(let n of Object.keys(e))t[n]=null;return t}function cr({catalogCallSiteIds:e,persistedOverrides:t,persistedAdvisor:n,isSeeded:r}){let[i,a]=(0,Q.useState)({}),[o,s]=(0,Q.useState)(void 0),c=(0,Q.useMemo)(()=>{if(!r)return{};let n={};for(let r of e)if(r in i)n[r]=i[r];else{let e=t[r];n[r]=e?{...e}:{}}return n},[r,e,t,i]),l=o??n,u=l!==n,d=(0,Q.useMemo)(()=>{if(!r)return!1;for(let e of Object.keys(c))if(!nr(c[e],t[e]))return!0;return!1},[r,c,t]);return{drafts:c,advisorProfile:l,advisorDirty:u,callSiteDraftsDirty:d,hasUnsavedDrafts:u||d,hasValidationError:(0,Q.useMemo)(()=>Object.values(c).some(e=>er(e)&&!!e?.provider&&!e?.model),[c]),setDraft:(0,Q.useCallback)((e,t)=>{a(n=>({...n,[e]:t}))},[]),setAdvisor:(0,Q.useCallback)(e=>{s(e)},[]),clearEdits:(0,Q.useCallback)(()=>{a({}),s(void 0)},[]),buildSavePatch:(0,Q.useCallback)(()=>or(c,i),[c,i]),buildResetPatch:(0,Q.useCallback)(()=>sr(c),[c])}}function lr({assistantId:e,onClose:n}){let{t:i}=Z(`settings`),{data:a}=Y({...ee({path:{assistant_id:e}}),staleTime:3e4}),o=(0,Q.useMemo)(()=>a?.llm?.profiles??{},[a?.llm?.profiles]),s=(0,Q.useMemo)(()=>a?.llm?.profileOrder??[],[a?.llm?.profileOrder]),c=(0,Q.useMemo)(()=>a?.llm?.callSites??{},[a?.llm?.callSites]),l=(0,Q.useMemo)(()=>S(o,s),[o,s]),u=at(),d=be(),f=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:d}),[d]),p=st(),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[x,C]=(0,Q.useState)(!1),{data:w,isLoading:E,isError:D,refetch:O}=Y({...$e({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4,refetchOnWindowFocus:!1}),{data:A}=Y({...t({path:{assistant_id:e}}),enabled:!!e}),j=(0,Q.useMemo)(()=>(w?.callSites??[]).filter(e=>e.id!==`mainAgent`),[w]),M=!E&&!D&&!!w,N=!!a,P=M&&N,I=(0,Q.useMemo)(()=>j.map(e=>e.id),[j]),L=a?.llm?.advisorProfile??``,{drafts:te,advisorProfile:z,advisorDirty:B,callSiteDraftsDirty:ne,hasUnsavedDrafts:re,hasValidationError:ie,setDraft:V,setAdvisor:ae,clearEdits:H,buildSavePatch:oe,buildResetPatch:se}=cr({catalogCallSiteIds:I,persistedOverrides:c,persistedAdvisor:L,isSeeded:P}),ce=(0,Q.useMemo)(()=>new Set(I),[I]),le=(0,Q.useCallback)(e=>b(l,e),[l]),ue=(0,Q.useCallback)(e=>({value:e.name,label:ht(e),...k(e,l,f)===`undispatchable`?{icon:(0,$.jsx)(Xt,{className:`h-3.5 w-3.5 text-[var(--system-mid-strong)]`}),tooltip:_e(e)}:{}}),[l,f]),W=(0,Q.useMemo)(()=>pe(l,[L],f).map(ue),[l,L,ue,f]),de=(0,Q.useMemo)(()=>{let e=m.trim().toLowerCase();return e===``||`advisor`.includes(e)||`second opinion`.includes(e)},[m]),fe=(0,Q.useMemo)(()=>j.some(e=>tr(e,c[e.id])!==null),[j,c]),me=(0,Q.useMemo)(()=>Object.entries(c).some(([e,t])=>ce.has(e)&&(t?.profile!=null||t?.provider!=null||t?.model!=null)),[c,ce]),he=(0,Q.useCallback)(e=>[...pe(l,[e],f).map(ue),{value:$n,label:i(`overridesDetailPanel.customProfileOption`)}],[l,ue,f,i]),ge=(0,Q.useMemo)(()=>{if(!m.trim())return j;let e=m.toLowerCase();return j.filter(t=>(t.displayName??``).toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e)||(t.domain??``).toLowerCase().includes(e))},[j,m]),ve=(0,Q.useMemo)(()=>{if(!w)return[];let e=w.domains.map(e=>e.id),t=new Map(w.domains.map(e=>[e.id,e])),n=[];for(let r of e){let e=ge.filter(e=>e.domain===r);e.length>0&&n.push({domain:t.get(r),sites:e})}let r=new Set(e),a=ge.filter(e=>!r.has(e.domain));return a.length>0&&n.push({domain:{id:`other`,displayName:i(`overridesDetailPanel.otherDomain`)},sites:a}),n},[w,ge,i]),ye=(0,Q.useCallback)((e,t)=>{if(!t){V(e,null);return}let n=T(l,j.find(t=>t.id===e)?.defaultProfile,f);if(n)V(e,{profile:n});else{let t=u[0]??ft[0];V(e,{provider:t,model:Ge(t)??``})}},[j,l,u,V,f]),xe=(0,Q.useCallback)(async()=>{_(!0);try{let t=oe();await p.mutateAsync({path:{assistant_id:e},body:{llm:{...ne?{callSites:t}:{},...B?{advisorProfile:z}:{}}}}),n(),R.success(i(`overridesDetailPanel.overridesSavedToast`))}catch(e){R.error(i(`overridesDetailPanel.saveFailedToast`)),G(e,{context:`call_site_overrides_save`})}finally{_(!1)}},[oe,ne,B,z,n,p,e,i]),Ce=(0,Q.useCallback)(async()=>{_(!0);try{let t=se();await p.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:t}}}),n(),R.success(i(`overridesDetailPanel.overridesResetToast`))}catch(e){R.error(i(`overridesDetailPanel.resetFailedToast`)),G(e,{context:`call_site_overrides_reset`})}finally{_(!1)}},[se,n,p,e,i]),we=(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[me&&(0,$.jsx)(r,{variant:`outlined`,onClick:()=>y(!0),disabled:g||!P,tintColor:`var(--system-negative-strong)`,className:`mr-auto`,children:i(`overridesDetailPanel.resetToDefaults`)}),(0,$.jsx)(r,{variant:`primary`,onClick:()=>void xe(),disabled:!re||ie||g,children:g?(0,$.jsx)(Qt,{className:`h-4 w-4 animate-spin`}):i(`overridesDetailPanel.save`)})]});return(0,$.jsxs)(Se,{title:i(`overridesDetailPanel.title`),closeVariant:`outlined`,onClose:n,footer:we,children:[(0,$.jsx)(`p`,{className:`mb-4 text-body-medium-lighter text-[var(--content-tertiary)]`,children:i(`overridesDetailPanel.description`)}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-4 flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,$.jsx)(U,{type:`search`,value:m,onChange:e=>h(e.target.value),placeholder:i(`overridesDetailPanel.searchPlaceholder`),leftIcon:(0,$.jsx)(tn,{className:`h-4 w-4`}),fullWidth:!0})}),(0,$.jsx)(r,{variant:`outlined`,onClick:()=>C(!0),disabled:!P||g||re||!fe,title:re?i(`overridesDetailPanel.bulkChangeUnsavedTitle`):fe?void 0:i(`overridesDetailPanel.bulkChangeNoCandidatesTitle`),children:i(`overridesDetailPanel.bulkChange`)})]}),N&&de&&(0,$.jsxs)(`div`,{className:`mb-4`,children:[(0,$.jsx)(`p`,{className:`mb-2 text-body-small-default font-semibold uppercase tracking-wider text-[var(--content-tertiary)]`,children:i(`overridesDetailPanel.advisorSection`)}),(0,$.jsx)(Qn,{value:z,profileOptions:W,disabled:g,onChange:ae})]}),E&&(0,$.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,$.jsx)(Qt,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`})}),D&&(0,$.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-12 text-center`,children:[(0,$.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:i(`overridesDetailPanel.loadErrorTitle`)}),(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:i(`overridesDetailPanel.loadErrorHint`)}),(0,$.jsx)(r,{variant:`outlined`,onClick:()=>void O(),children:i(`overridesDetailPanel.retry`)})]}),!E&&!D&&w&&(0,$.jsx)(ar,{groups:ve,drafts:te,buildProfileOptionsForRow:he,profileLabelFor:le,advisorMatchesSearch:de,connections:A?.connections,onDraftChange:V,onToggle:ye})]}),x&&w&&(0,$.jsx)(rr,{assistantId:e,callSites:j,domains:w.domains,persistedOverrides:c,orderedProfiles:l,onClose:()=>C(!1),onApplied:H}),(0,$.jsx)(F,{open:v,title:i(`overridesDetailPanel.resetToDefaults`),message:i(`overridesDetailPanel.resetConfirmMessage`),confirmLabel:i(`overridesDetailPanel.resetToDefaults`),destructive:!0,onConfirm:()=>{y(!1),Ce()},onCancel:()=>y(!1)})]})}var ur=e(Kt(),1);function dr({mode:e,connection:t,assistantId:n,existingNames:i,connections:a,variant:o=`modal`,actionsSlot:s,onSave:c,onCancel:l}){let{t:u}=Z(`settings`),[d,f]=(0,Q.useState)(t?.label??``),p=t?.name??``,m=t?.provider??`anthropic`,h=t?.auth.type??`api_key`,[g,v]=(0,Q.useState)(()=>t?.auth.type===`api_key`?t.auth.credential:t?``:`credential/anthropic/api_key`),[y,b]=(0,Q.useState)(t?.baseUrl??``),[x,S]=(0,Q.useState)(()=>t?.models?t.models.map(e=>e.id).join(`, `):``),[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),D=m===`openai-compatible`,O=Te(m),k=Vt(m),[A,j]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(!1),F=X(),I=(0,Q.useMemo)(()=>qe(g),[g]),L=h===`api_key`&&I!==null,{hasStoredCredential:R,isLoading:ee}=Le({assistantId:n,credentialKind:`credential`,credentialName:I?`${I.service}:${I.field}`:``,enabled:L}),{credentials:z}=we({assistantId:n,enabled:h===`api_key`});(0,Q.useEffect)(()=>{let e=t?.provider??`anthropic`;f(t?.label??``),t?.auth.type===`api_key`?v(t.auth.credential):v(t?``:`credential/${e}/api_key`),E(null),b(t?.baseUrl??``),S(t?.models?t.models.map(e=>e.id).join(`, `):``),j(``),P(!1)},[t]);let B=d.trim()!==(t?.label??``).trim(),ne=D&&B?Ft(d,a,t?.name):null,re=p.trim().length>0&&ne===null;async function ie(){if(re){w(!0),E(null);try{let e;if(h===`api_key`){let t=g.trim()||`credential/${m}/api_key`,r=A.trim();if(r){P(!0);try{let e=qe(t);await Ht({path:{assistant_id:n},body:e?{type:`credential`,name:`${e.service}:${e.field}`,value:r}:{type:`api_key`,name:m,value:r},throwOnError:!0});let i=Et(n,`credential`,e?`${e.service}:${e.field}`:``);F.setQueryData(i,!0),F.invalidateQueries({queryKey:te({path:{assistant_id:n}})})}catch{E(u(`providerEditorContent.failedSaveApiKey`));return}finally{P(!1)}}e={type:`api_key`,credential:t}}else if(t)e=t.auth;else{E(u(`providerEditorContent.nothingToEdit`));return}let r=d.trim()||null,i={auth:e,label:r,...O&&{base_url:y.trim()||null},...k&&{models:x.trim()?x.split(`,`).map(e=>({id:e.trim()})).filter(e=>e.id):null}},{data:a,error:o,response:s}=await ut({path:{assistant_id:n,name:t?.name??p.trim()},body:i});if(!s?.ok){E(Me(s?.status,o)??Je(s?.status));return}if(!a){E(u(`providerEditorContent.emptyServerResponse`));return}Lt(a,u),c(a)}catch{E(u(`providerEditorContent.failedSaveProvider`))}finally{w(!1)}}}let V=z.filter(e=>e.service===m),ae=e!==`create`&&t?.auth.type===`api_key`,oe=V.length>0||ae,se=Ot(u(`providerEditorContent.apiKeyPlaceholder`),R);if(e===`create`)return(0,$.jsx)(Ke,{variant:o===`panel`?`inline`:`modal`,actionsSlot:s,assistantId:n,existingNames:i,connections:a,defaultProviderType:m,onCreated:c,onCancel:l});let ce=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:(0,$.jsx)(Gt,{i18nKey:`providerEditorContent.displayNameLabel`,ns:`settings`,components:{optional:(0,$.jsx)(`span`,{className:`text-[var(--content-disabled)]`})}})}),(0,$.jsx)(U,{value:d,onChange:e=>f(e.target.value),placeholder:u(`providerEditorContent.displayNamePlaceholder`),fullWidth:!0}),ne?(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:Ae[ne]}):null]}),O&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:u(`providerEditorContent.baseUrlLabel`)}),(0,$.jsx)(U,{value:y,onChange:e=>b(e.target.value),placeholder:u(m===`ollama`?`providerEditorContent.baseUrlPlaceholderOllama`:m===`opencode`?`providerEditorContent.baseUrlPlaceholderOpencode`:`providerEditorContent.baseUrlPlaceholder`),fullWidth:!0}),m===`ollama`?(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:u(`providerEditorContent.baseUrlHintOllama`)}):null,m===`opencode`?(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:u(`providerEditorContent.baseUrlHintOpencode`)}):null]}),k&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:u(`providerEditorContent.modelsLabel`)}),(0,$.jsx)(U,{value:x,onChange:e=>S(e.target.value),placeholder:u(`providerEditorContent.modelsPlaceholder`),fullWidth:!0}),(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:u(`providerEditorContent.modelsHint`)})]}),h===`api_key`&&(0,$.jsx)(zt,{apiKeyValue:A,onApiKeyChange:j,credential:g,onCredentialChange:v,isLoadingCredential:ee,apiKeyPlaceholder:se,provider:m,providerCredentials:V,showAdvancedSection:oe,onError:E}),h===`oauth_subscription`&&(0,$.jsx)(M,{assistantId:n,onConnected:c}),T&&(0,$.jsx)(H,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:T})]}),le=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(r,{variant:`ghost`,onClick:l,children:u(`providerEditorContent.cancel`)}),(0,$.jsx)(r,{variant:`primary`,disabled:!re||C||N,onClick:()=>void ie(),children:u(C?`providerEditorContent.saving`:`providerEditorContent.saveChanges`)})]});return o===`panel`?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[ce,s===void 0?(0,$.jsx)(`div`,{className:`flex justify-end gap-2`,children:le}):s&&(0,ur.createPortal)(le,s)]}):(0,$.jsxs)(_.Content,{size:`md`,children:[(0,$.jsxs)(_.Header,{children:[(0,$.jsx)(_.Title,{children:u(`providerEditorContent.editProviderTitle`)}),(0,$.jsx)(_.Description,{children:t?u(`providerEditorContent.editingConnection`,{name:At(t)}):u(`providerEditorContent.editProviderSettingsFallback`)})]}),(0,$.jsx)(_.Body,{children:ce}),(0,$.jsx)(_.Footer,{children:le})]})}function fr({assistantId:e,connectionName:n,onClose:r}){let{t:i}=Z(`settings`),a=X(),[o,s]=(0,Q.useState)(null),{data:c}=Y(t({path:{assistant_id:e}})),l=(0,Q.useMemo)(()=>c?.connections??[],[c]),u=(0,Q.useMemo)(()=>n==null?void 0:l.find(e=>e.name===n),[n,l]),d=n!=null&&c!=null&&u==null;(0,Q.useEffect)(()=>{d&&r()},[d,r]);function f(){a.invalidateQueries({queryKey:Be({path:{assistant_id:e}})}),a.invalidateQueries({queryKey:I({path:{assistant_id:e}})}),r()}return(0,$.jsx)(Se,{title:u?At(u):i(`providerDetailPanel.addProviderTitle`),closeVariant:`outlined`,onClose:r,footer:(0,$.jsx)(`div`,{ref:s,className:`flex justify-end gap-2`}),children:n==null||u!=null?(0,$.jsx)(dr,{mode:u?`edit`:`create`,connection:u,variant:`panel`,actionsSlot:o,assistantId:e,existingNames:l.map(e=>e.name),connections:l,onSave:f,onCancel:r}):null})}var pr={vellum:{provider:`vellum`},deepgram:{provider:`deepgram`,credentialService:`deepgram`},openai:{provider:`openai-whisper`,credentialService:`openai`}},mr={vellum:`vellum`,deepgram:`deepgram`,"openai-whisper":`openai`},hr=`deepgram`;function gr({assistantId:e,hideSaveButton:t=!1,hideCredentialsGuide:n=!1,onSaveStateChange:r}={}){let i=Ve(),a=e??i,o=f(),s=X(),{t:c}=Z(),l=(0,Q.useMemo)(()=>g(ve(),{displayName:c(`sttProviderForm.windowsNativeDisplayName`),subtitle:c(`sttProviderForm.windowsNativeSubtitle`),setupWarning:c(`sttProviderForm.windowsNativeSetupWarning`)}).filter(e=>!e.requiresNativeDictation||w()),[c]),d=hr,{data:p}=Y({...ee({path:{assistant_id:a}}),enabled:o,staleTime:3e4}),m=p?.services?.stt,h=m?.mode===`managed`?`vellum`:m?.provider,_=(0,Q.useMemo)(()=>{let e=h?mr[h]:void 0;if(e&&l.some(t=>t.id===e))return e;let t=K(It,d);return l.some(e=>e.id===t)?t:d},[h,l,d]),v=!!h,[y,b]=hn(_),{available:x,currentCode:S,configuredProviderId:C,selectLanguage:T,selecting:D}=ct(a),[O,k]=(0,Q.useState)(!1),A=x&&y===_&&(pr[y]?.provider===C||!!h&&!mr[h]),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{let e=K(It,d);e===`macos-native`&&!l.some(t=>t.id===e)&&q(It,d)},[l,d]);let L=(0,Q.useMemo)(()=>l.find(e=>e.id===y)??l[0],[l,y]),te=L.apiKeyPlaceholder!==void 0;(0,Q.useEffect)(()=>{P(K(je+y,``).length>0),M(``)},[y]);let z=(0,Q.useMemo)(()=>{let e=y!==_,t=j.trim().length>0;return e||t},[y,_,j]),B=(0,Q.useCallback)(async()=>{let e=j.trim();q(It,y),e.length>0&&q(je+y,e);let t=pr[y];I(!0);try{if(t?.credentialService){let n=e.length>0?e:K(je+y,``);if(n.length>0){let{response:e}=await _t({path:{assistant_id:a},body:{service:t.credentialService,field:`api_key`,value:n,label:`${L.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}}if(t&&(y!==_||!v)||h===`vellum`&&y!==`vellum`){let e=t?.provider??hr,{response:n}=await E({path:{assistant_id:a},body:{services:{stt:{provider:e,mode:e===`vellum`?`managed`:`your-own`}}},throwOnError:!1});if(!n?.ok)throw Error(`Failed to save configuration (HTTP ${n?.status??`?`})`)}return e.length>0&&P(!0),M(``),s.invalidateQueries({queryKey:et({path:{assistant_id:a}})}),R.success(c(`sttProviderForm.saveSuccess`)),!0}catch(e){return R.error(e instanceof Error?e.message:c(`sttProviderForm.saveFailed`)),!1}finally{I(!1)}},[a,y,j,L,_,v,h,s,c]);(0,Q.useEffect)(()=>{r?.({hasChanges:z,saving:F,save:B})},[r,z,F,B]);let ne=(0,Q.useCallback)(()=>{q(je+y,``),P(!1),M(``)},[y]),re=N?c(`sttProviderForm.apiKeyPlaceholderReplace`):L.apiKeyPlaceholder;return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:c(`sttProviderForm.providerLabel`)}),(0,$.jsx)(u,{value:y,onChange:b,options:l.map(e=>({value:e.id,label:e.displayName})),"aria-label":c(`sttProviderForm.providerAriaLabel`)})]}),A&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:c(`sttProviderForm.spokenLanguage`)}),(0,$.jsx)(Oe,{"aria-label":c(`sttProviderForm.spokenLanguage`),"aria-haspopup":`dialog`,onClick:()=>k(!0),value:Ze(S,C)}),(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:c(`sttProviderForm.spokenLanguageApplies`)}),(0,$.jsx)(pn,{open:O,onOpenChange:k,title:c(`sttProviderForm.spokenLanguage`),currentCode:S,configuredProviderId:C,selectLanguage:T,selecting:D})]}),te&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:c(`sttProviderForm.apiKeyLabel`)}),(0,$.jsx)(U,{type:`password`,value:j,onChange:e=>M(e.target.value),placeholder:re,fullWidth:!0})]}),L.setupWarning&&(0,$.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-sunken)] p-3 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,$.jsx)(Yt,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--system-mid-strong)]`}),(0,$.jsx)(`span`,{children:L.setupWarning})]}),!n&&L.credentialsGuide&&(0,$.jsx)(ln,{guide:L.credentialsGuide}),y===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:c(`sttProviderForm.vellumTranscription`)}),(!t||N)&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!t&&(0,$.jsx)(cn,{onClick:B,disabled:!z||F}),N&&(0,$.jsx)(sn,{onClick:ne})]})]})}var _r={batch:`sttRoleOverrides.role.batch`,dictation:`sttRoleOverrides.role.dictation`,liveVoice:`sttRoleOverrides.role.liveVoice`,telephony:`sttRoleOverrides.role.telephony`,watch:`sttRoleOverrides.role.watch`};function vr(e){let t=e?.roles;if(!t)return[];let n=e?.provider,r=n?e?.providers?.[n]?.model:void 0,i=[];for(let[e,a]of Object.entries(t)){let t=a?.provider;t&&(t===n&&a?.model===r||i.push({role:e,provider:t,...a?.model===void 0?{}:{model:a.model}}))}return i}function yr({assistantId:e}){let{t}=Z(`settings`),n=X(),i=f(),[a,o]=(0,Q.useState)(null),{data:s}=Y({...ee({path:{assistant_id:e}}),enabled:i,staleTime:3e4}),c=s?.services?.stt,l=vr(c),{data:u}=Y({...Ut({path:{assistant_id:e}}),enabled:i&&l.length>0,staleTime:5*6e4});if(l.length===0)return null;let d=e=>u?.providers?.find(t=>t.id===e)?.displayName??e,p=async r=>{o(r);try{let{response:t}=await E({path:{assistant_id:e},body:{services:{stt:{roles:{[r]:null}}}},throwOnError:!1});if(!t?.ok)throw Error(String(t?.status??``));await n.invalidateQueries({queryKey:et({path:{assistant_id:e}})})}catch{R.error(t(`sttRoleOverrides.clearFailed`))}finally{o(null)}};return(0,$.jsxs)(`div`,{className:`mt-1 flex flex-col gap-2 border-t border-[var(--border-subtle)] pt-4`,children:[(0,$.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t(`sttRoleOverrides.title`)}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-1`,children:l.map(e=>{let n=_r[e.role];return(0,$.jsxs)(`li`,{className:`flex items-center gap-4 rounded-md border border-[var(--border-subtle)] bg-[var(--surface-sunken)] px-3 py-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-medium-lighter text-[var(--content-default)]`,children:n?t(n):e.role}),(0,$.jsx)(`span`,{className:`min-w-0 truncate text-body-small-default text-[var(--content-default)]`,children:e.model?`${d(e.provider)} · ${e.model}`:d(e.provider)}),(0,$.jsx)(r,{variant:`ghost`,size:`compact`,"aria-label":t(`sttRoleOverrides.clearAria`,{feature:n?t(n):e.role}),className:`[--vbtn-fg:var(--content-tertiary)]`,disabled:a===e.role,onClick:()=>void p(e.role),children:t(`sttRoleOverrides.clear`)})]},e.role)})})]})}function br(){let{t:e}=Z(`settings`),t=Ve();return(0,$.jsxs)(on,{title:e(`speechToTextCard.title`),subtitle:e(`speechToTextCard.subtitle`),children:[(0,$.jsx)(gr,{}),(0,$.jsx)(yr,{assistantId:t})]})}async function xr(e){let{provider:t,apiKey:n,voiceId:r,text:i}=e;if(n.trim().length===0)return{kind:`error`,message:`Save an API key for this provider first.`};try{return t===`elevenlabs`?await Sr(n,r,i):t===`deepgram`?await Cr(n,i):t===`fish-audio`?{kind:`unsupported`,message:`Fish Audio TTS is only supported in the desktop app today. Use ElevenLabs or Deepgram to test from the browser.`}:t===`xai`?{kind:`unsupported`,message:`xAI TTS is only supported in the desktop app today. Use ElevenLabs or Deepgram to test from the browser.`}:{kind:`unsupported`,message:`TTS testing for "${t}" is not supported from the browser yet.`}}catch(e){return{kind:`error`,message:e instanceof Error?e.message:`Failed to reach the TTS provider.`}}}async function Sr(e,t,n){let r=t.trim();if(r.length===0)return{kind:`error`,message:`Enter and save a Voice ID before testing ElevenLabs.`};let i=await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${encodeURIComponent(r)}?output_format=mp3_44100_128`,{method:`POST`,headers:{"xi-api-key":e,"Content-Type":`application/json`,Accept:`audio/mpeg`},body:JSON.stringify({text:n,model_id:`eleven_turbo_v2_5`})});return i.ok?{kind:`audio`,blob:await i.blob()}:{kind:`error`,message:await wr(i,`ElevenLabs rejected the request.`)}}async function Cr(e,t){let n=await fetch(`https://api.deepgram.com/v1/speak?model=aura-2-thalia-en`,{method:`POST`,headers:{Authorization:`Token ${e}`,"Content-Type":`application/json`,Accept:`audio/mpeg`},body:JSON.stringify({text:t})});return n.ok?{kind:`audio`,blob:await n.blob()}:{kind:`error`,message:await wr(n,`Deepgram rejected the request.`)}}async function wr(e,t){try{let n=await e.text();if(n.length===0)return`${t} (HTTP ${e.status})`;try{let e=JSON.parse(n);if(e&&typeof e==`object`&&`detail`in e&&typeof e.detail==`string`)return e.detail;if(e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`)return e.message}catch{}return n.slice(0,200)}catch{return`${t} (HTTP ${e.status})`}}function Tr({assistantId:e,value:t,onChange:n,className:r}){let{t:i}=Z(),[a,o]=(0,Q.useState)(!1),{voices:s}=oe(e);if(s.length===0)return null;let c=s.find(e=>e.model===t)??s[0];return(0,$.jsxs)(x.Root,{open:a,onOpenChange:o,children:[(0,$.jsx)(x.Trigger,{asChild:!0,children:(0,$.jsx)(Oe,{"aria-label":i(`voicePickerField.ariaLabel`),value:c?Nt(c.description):i(`voicePickerField.selectVoice`),className:r})}),(0,$.jsx)(x.Content,{side:`bottom`,align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,children:(0,$.jsx)(D,{assistantId:e,value:t,onChange:n,onSelect:()=>o(!1),showSource:!0,autoScrollToSelected:!0})})]})}var Er={elevenlabs:`voiceId`,"fish-audio":`referenceId`,xai:`voiceId`};function Dr({assistantId:e,hideSaveButton:t=!1,hideCredentialsGuide:n=!1,onSaveStateChange:i}={}){let{t:a}=Z(),s=Ve(),d=e??s,p=Rt.use.name()??`your assistant`,m=f(),h=X(),{data:g}=Y({...o({path:{assistant_id:d}}),enabled:m,staleTime:1/0}),_=(0,Q.useMemo)(()=>{let e=g?.providers;if(!e)return P;if(e.some(e=>e.id===`vellum`))return e;let t=P.find(e=>e.id===`vellum`);return t?[t,...e]:e},[g]),{data:v}=Y({...ee({path:{assistant_id:d}}),enabled:m,staleTime:3e4}),y=v?.services?.tts,b=y?.mode===`managed`?`vellum`:y?.provider,x=`elevenlabs`,S=(0,Q.useMemo)(()=>b??K(`vellum:voice:ttsProvider`,x),[b,x]),C=!!b,[w,T]=hn(S),[D,O]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(``),[j,M]=(0,Q.useState)(``),[N,F]=(0,Q.useState)(!1),[I,L]=(0,Q.useState)(!1),[te,z]=(0,Q.useState)(!1),{voices:B,defaultModel:ne,fetched:re}=c(d,{enabled:w===`vellum`}),ie=y?.providers?.vellum?.model??ne??``,[V,ae]=hn(ie),H=B.find(e=>e.model===V)??B[0],[oe,ce]=(0,Q.useState)(null),le=B.some(e=>e.model===ie),ue=oe??(re&&ie!==``&&!le),W=(0,Q.useMemo)(()=>_.find(e=>e.id===w)??_[0],[w,_]),de=w===`vellum`&&W.supportsVoiceSelection&&V.trim()!==``&&V.trim()!==ie,G=(0,Q.useCallback)(e=>{let t=K(se+e,``),n=K(Mt+e,``);F(t.length>0),A(n),M(n),O(``)},[]);(0,Q.useEffect)(()=>{G(w)},[w,G]);let fe=(0,Q.useMemo)(()=>{let e=w!==S,t=D.trim().length>0,n=k.trim()!==j;return e||t||n||de},[w,S,D,k,j,de]),pe=(0,Q.useCallback)(async()=>{let e=D.trim(),t=k.trim(),n=W.id;q(l,n),e.length>0&&q(se+n,e),q(Mt+n,t);let r=e.length>0?e:K(se+n,``),i=Er[n];z(!0);try{if(r.length>0){let{response:e}=await _t({path:{assistant_id:d},body:{service:n,field:`api_key`,value:r,label:`${W.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}let e={...w!==S||!C?{provider:n,mode:n===`vellum`?`managed`:`your-own`}:{},...i?{providers:{[n]:{[i]:t}}}:{},...de?{providers:{vellum:{model:V.trim()}}}:{}};if(Object.keys(e).length>0){let{response:t}=await E({path:{assistant_id:d},body:{services:{tts:e}},throwOnError:!1});if(!t?.ok)throw Error(`Failed to save configuration (HTTP ${t?.status??`?`})`)}return F(r.length>0),M(t),O(``),h.invalidateQueries({queryKey:et({path:{assistant_id:d}})}),R.success(a(`ttsProviderForm.saved`)),!0}catch(e){return R.error(e instanceof Error?e.message:a(`ttsProviderForm.saveFailed`)),!1}finally{z(!1)}},[d,w,V,de,D,k,W,S,C,h,a]);(0,Q.useEffect)(()=>{i?.({hasChanges:fe,saving:te,save:pe})},[i,fe,te,pe]);let me=(0,Q.useCallback)(()=>{q(se+w,``),F(!1),O(``)},[w]),he=(0,Q.useCallback)(async()=>{L(!0);try{let e=K(se+w,``),t=D.trim(),n=t.length>0?t:e;if(n.length===0){R.error(a(`ttsProviderForm.apiKeyRequired`));return}let r=K(Mt+w,``),i=k.trim(),o=await xr({provider:w,apiKey:n,voiceId:i.length>0?i:r,text:`Hey! It's ${p}. How does this sound?`});if(o.kind!==`audio`){R.error(o.message);return}let s=URL.createObjectURL(o.blob);try{let e=new Audio(s);await e.play(),await new Promise(t=>{e.onended=()=>t(),e.onerror=()=>t()})}finally{URL.revokeObjectURL(s)}}finally{L(!1)}},[p,D,w,k,a]),ge=N?`•••••••• (Enter a new key to replace)`:W.apiKeyPlaceholder,_e=w===`vellum`,ve=_e&&W.supportsVoiceSelection,ye=(0,$.jsxs)(r,{variant:`link`,size:`compact`,className:`inline-flex h-auto items-center gap-1 px-0 underline [--vbtn-fg:var(--content-tertiary)]`,onClick:()=>{ce(!1),B.some(e=>e.model===V)||ae(ne||B[0]?.model||``)},children:[(0,$.jsx)(en,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`ttsProviderForm.chooseFromCatalog`)]}),be=ve&&ue&&B.length>0?ye:null;return(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:a(`ttsProviderForm.provider`)}),(0,$.jsx)(u,{value:w,onChange:T,options:_.map(e=>({value:e.id,label:e.displayName})),"aria-label":a(`ttsProviderForm.providerAriaLabel`)})]}),!_e&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:a(`ttsProviderForm.apiKey`)}),(0,$.jsx)(U,{type:`password`,value:D,onChange:e=>O(e.target.value),placeholder:ge,fullWidth:!0})]}),ve&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:a(`ttsProviderForm.voice`)}),ue?(0,$.jsx)(U,{type:`text`,value:V,onChange:e=>ae(e.target.value),placeholder:a(`ttsProviderForm.voiceIdPlaceholder`),"aria-label":a(`ttsProviderForm.customVoiceIdAriaLabel`),fullWidth:!0}):H?(0,$.jsx)(Tr,{assistantId:d,value:V,onChange:ae}):re&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:a(`ttsProviderForm.noManagedVoices`)})]}),W.supportsVoiceSelection&&!_e&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:a(`ttsProviderForm.voiceId`)}),(0,$.jsx)(U,{type:`text`,value:k,onChange:e=>A(e.target.value),placeholder:a(`ttsProviderForm.voiceIdPlaceholder`),fullWidth:!0})]}),!n&&!_e&&(0,$.jsx)(ln,{guide:W.credentialsGuide}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!_e&&(0,$.jsx)(r,{variant:`outlined`,onClick:he,disabled:I,children:a(I?`ttsProviderForm.testing`:`ttsProviderForm.test`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[be,!t&&(0,$.jsx)(cn,{onClick:pe,disabled:!fe||te}),N&&!_e&&(0,$.jsx)(sn,{onClick:me})]})]})]})}function Or(){let{t:e}=Z(`settings`);return(0,$.jsx)(on,{id:`text-to-speech`,title:e(`textToSpeechCard.title`),subtitle:e(`textToSpeechCard.subtitle`),children:(0,$.jsx)(Dr,{})})}var kr=`default`;function Ar(){let{t:e}=Z(`settings`),t=Ve(),r=X(),{data:a}=Y({...ee({path:{assistant_id:t}}),staleTime:3e4}),o=y({onSuccess:e=>{i(r,{path:{assistant_id:t}},e)}}),s=mn(),c=(0,Q.useMemo)(()=>a?a.services?.[`web-fetch`]?.provider||K(`vellum:ai:webFetchProvider`,kr):K(ce,kr),[a]),l=(0,Q.useMemo)(()=>a?.services?.[`web-fetch`]?.apiBase??``,[a]),[d,f]=(0,Q.useState)(!1),[p,m]=hn(c),[h,g]=hn(l),[_,v]=(0,Q.useState)(``),b=n.has(p),x=He.has(p),{hasStoredCredential:S}=Le({assistantId:t,credentialKind:`api_key`,credentialName:p,enabled:x}),C=_.trim().length>0,w=h.trim(),T=b&&w.length>0,E=p!==c||b&&w!==l.trim(),D=d||x&&!T&&!S&&!C||!E&&!C,O=Ot(Qe[p]??e(`webFetchCard.apiKeyPlaceholder`),S),k=wt[p]??``,A=(0,Q.useCallback)(async()=>{f(!0);let n=_.trim(),i=x&&n.length>0;try{i&&await s(p,n),await o.mutateAsync({path:{assistant_id:t},body:{services:{"web-fetch":{provider:p,...b?{apiBase:w}:{}}}}}).catch(t=>{throw R.error(e(`webFetchCard.configUpdateFailedToast`)),G(t,{context:`patch_daemon_config`}),t})}catch{f(!1);return}f(!1);try{if(q(ce,p),i){let e=le(p);e&&q(e,n);let i=Et(t,`api_key`,p);r.setQueryData(i,!0),r.invalidateQueries({queryKey:i}),v(``)}R.success(e(`webFetchCard.savedToast`))}catch(t){G(t,{context:`settings-ai-web-fetch-persist-local`}),R.error(e(`webFetchCard.localPreferencesFailedToast`))}},[x,o,s,r,t,_,p,b,w,e]),j=(0,Q.useCallback)(()=>{let e=le(p);e&&Ct(e),v(``),g(``),m(kr),q(ce,kr)},[p,m,g]);return(0,$.jsx)(on,{id:`web-fetch`,title:e(`webFetchCard.title`),subtitle:e(`webFetchCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e(`webFetchCard.providerLabel`)}),(0,$.jsx)(u,{value:p,onChange:m,options:yt.map(e=>({value:e,label:lt[e]??e}))})]}),b&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(U,{label:e(`webFetchCard.apiBaseLabel`),type:`url`,value:h,onChange:e=>g(e.target.value),placeholder:k||e(`webFetchCard.apiBasePlaceholder`),fullWidth:!0}),k?(0,$.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`webFetchCard.apiBaseHint`,{defaultBase:k})}):null]}),x&&(0,$.jsx)(U,{label:e(`webFetchCard.apiKeyLabel`),type:`password`,value:_,onChange:e=>v(e.target.value),placeholder:O,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(cn,{onClick:A,disabled:D}),d&&(0,$.jsx)(Qt,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),x&&(0,$.jsx)(sn,{onClick:j,filled:!0})]})]})})}var jr=`0.10.12`;function Mr(){return Tt(jr)}function Nr(){let{t:e}=Z(`settings`),t=Ve(),n=X(),r=f(),{data:a}=Y({...ee({path:{assistant_id:t}}),enabled:r,staleTime:3e4}),o=y({onSuccess:e=>{i(n,{path:{assistant_id:t}},e)}}),s=mn(),c=(0,Q.useMemo)(()=>{if(!a)return K(m,`inference-provider-native`);let e=a.services?.[`web-search`];return(e?.mode===`managed`&&e?.provider!==`inference-provider-native`?`vellum`:e?.provider)||K(`vellum:ai:webSearchProvider`,`inference-provider-native`)},[a]),l=(0,Q.useMemo)(()=>a?.services?.[`web-search`]?.apiBase??``,[a]),[d,p]=(0,Q.useState)(!1),[h,g]=hn(c),[_,v]=hn(l),[b,x]=(0,Q.useState)(``),S=A.has(h),C=gt.has(h),w=O.has(h),{hasStoredCredential:T}=Le({assistantId:t,credentialKind:`api_key`,credentialName:h,enabled:C}),E=b.trim().length>0,D=_.trim(),k=S&&D.length>0,j=h!==c||S&&D!==l.trim(),M=d||C&&!w&&!k&&!T&&!E||!j&&!E,N=Ot(ae[h]??e(`webSearchCard.apiKeyPlaceholder`),T),P=ye[h]??``,F=(0,Q.useCallback)(async()=>{p(!0);let r=b.trim(),i=fe(h),a=C&&r.length>0;try{a&&await s(h,r),await it();let n=h===`vellum`?Mr()?{provider:`vellum`,mode:`managed`}:{mode:`managed`}:{provider:h,mode:`your-own`,...S?{apiBase:D}:{}};await o.mutateAsync({path:{assistant_id:t},body:{services:{"web-search":n}}}).catch(t=>{throw R.error(e(`webSearchCard.configUpdateFailedToast`)),G(t,{context:`patch_daemon_config`}),t})}catch{p(!1);return}p(!1);try{if(q(m,h),a){i&&q(i,r);let e=Et(t,`api_key`,h);n.setQueryData(e,!0),n.invalidateQueries({queryKey:e}),x(``)}R.success(e(`webSearchCard.savedToast`))}catch(t){G(t,{context:`settings-ai-web-search-persist-local`}),R.error(e(`webSearchCard.localPreferencesFailedToast`))}},[C,o,s,n,t,b,h,S,D,e]),I=(0,Q.useCallback)(()=>{let e=fe(h);e&&Ct(e),x(``),v(``),g(`inference-provider-native`),q(m,`inference-provider-native`)},[h,g,v]);return(0,$.jsx)(on,{title:e(`webSearchCard.title`),subtitle:e(`webSearchCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:e(`webSearchCard.providerLabel`)}),(0,$.jsx)(u,{"aria-label":e(`webSearchCard.providerAriaLabel`),value:h,onChange:g,options:Ce.map(e=>({value:e,label:he[e]??e}))})]}),h===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`webSearchCard.vellumNote`)}),S&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(U,{label:e(`webSearchCard.apiBaseLabel`),type:`url`,value:_,onChange:e=>v(e.target.value),placeholder:P||e(`webSearchCard.apiBasePlaceholder`),fullWidth:!0}),P?(0,$.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`webSearchCard.apiBaseHint`,{defaultBase:P})}):null]}),C&&(0,$.jsx)(U,{label:e(`webSearchCard.apiKeyLabel`),type:`password`,value:b,onChange:e=>x(e.target.value),placeholder:N,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(cn,{onClick:F,disabled:M}),d&&(0,$.jsx)(Qt,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),C&&(0,$.jsx)(sn,{onClick:I,filled:!0})]})]})})}function Pr(){let e=Ve(),t=Pt(),[n,r]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{let e=window.location.hash.slice(1);e&&requestAnimationFrame(()=>{document.getElementById(e)?.scrollIntoView({block:`start`})})},[]);let i=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto`,children:[(0,$.jsx)(Xn,{}),(0,$.jsx)(Jn,{panel:n,onOpenPanel:r,onClosePanel:()=>r(null)}),(0,$.jsx)(Nr,{}),(0,$.jsx)(Ar,{}),(0,$.jsx)(yn,{}),(0,$.jsx)(Or,{}),(0,$.jsx)(br,{})]}),a=`${e??`none`}:${n?.kind===`profile`?`profile:${n.name}`:n?.kind===`provider`?`provider:${n.name}`:n?.kind??`closed`}`,o=n?.kind===`provider`||n?.kind===`add-provider`,s=n!=null&&e?n.kind===`overrides`?(0,$.jsx)(lr,{assistantId:e,onClose:()=>r(null)},a):o?(0,$.jsx)(fr,{assistantId:e,connectionName:n.kind===`provider`?n.name:null,onClose:()=>r(null)},a):(0,$.jsx)(Zn,{assistantId:e,profileName:n.kind===`profile`?n.name:null,onClose:()=>r(null)},a):null;return s&&t?(0,$.jsx)(un,{children:s}):s?(0,$.jsx)(fn,{storageKey:`aiSettingsDetailDrawerWidth`,detailKey:a,section:i,detail:s}):i}export{Pr as AiPage};
|
package/dist/assets/{android-billing-handoff-CWqhP_0I.js → android-billing-handoff-BjLOXHzL.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{iv as t,oh as n}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{iv as t,oh as n}from"./app-Bevxq2OH.js";import{x as r}from"./react-B9IgSVeK.js";var i=e(r(),1);function a(e){return new URL(e,window.location.origin).toString()}function o(e){t(a(e))}function s(e){let{open:t,path:r,onClose:a}=e,s=n(),c=(0,i.useRef)(a);return(0,i.useEffect)(()=>{c.current=a}),(0,i.useEffect)(()=>{s&&t&&(o(r),c.current())},[s,t,r]),s}export{s as n,o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Cx as n,Fb as r,Ib as i,Kr as a,Tv as o,Ux as s,Xr as c}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Cx as n,Fb as r,Ib as i,Kr as a,Tv as o,Ux as s,Xr as c}from"./app-Bevxq2OH.js";import{j as l}from"./vendor-CtuA73w5.js";import{_ as u,f as d,t as f,x as p}from"./react-B9IgSVeK.js";import{a as m,c as h,i as g,o as _,r as v,s as y}from"./provider-key-CdT-QLy6.js";import"./onboarding-step-layout-D1cb8TW9.js";var b=e(p(),1),x=f();function S(){let{t:e}=l(`onboarding`),f=d(),[p]=u(),S=p.get(`hosting`),C=i(),w=v(),[T,E]=(0,b.useState)(()=>w?.provider??m.id),[D,O]=(0,b.useState)(()=>w?.key??``),[k,A]=(0,b.useState)(()=>w?.model??y(w?.provider??m.id)??``),[j,M]=(0,b.useState)(()=>w?.baseUrl??``),[N,P]=(0,b.useState)(()=>w?.customModels??``),F=h(T)??m,I=F.models??[],L=F.requiresKey,R=I.length>0,z=T===`openai-compatible`,B=(!(L&&!z)||D.trim().length>0)&&(!R||k.trim().length>0)&&(!z||j.trim().length>0&&N.trim().length>0);return(0,x.jsx)(a,{avatarWave:`beside`,children:(0,x.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${C?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[(0,x.jsx)(`h1`,{className:C?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:e(`apiKeyScreen.title`)}),(0,x.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${C?`mt-3.5`:`mt-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:e(`apiKeyScreen.body`)}),(0,x.jsxs)(`div`,{className:`flex w-full flex-col gap-4 ${C?`mt-8`:`mt-10`}`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:[(0,x.jsxs)(`div`,{className:`flex flex-col ${C?`gap-2`:`gap-1`}`,children:[(0,x.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`apiKeyScreen.providerLabel`)}),(0,x.jsx)(n,{"aria-label":e(`apiKeyScreen.providerLabel`),value:T,onChange:e=>{let t=h(e);t&&(E(t.id),O(``),A(y(t.id)??``))},options:_.map(e=>({value:e.id,label:e.displayName}))})]}),I.length>0&&(0,x.jsxs)(`div`,{className:`flex flex-col ${C?`gap-2`:`gap-1`}`,children:[(0,x.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`apiKeyScreen.modelLabel`)}),(0,x.jsx)(n,{"aria-label":e(`apiKeyScreen.modelLabel`),value:k,onChange:A,options:I.map(e=>({value:e.id,label:e.displayName}))})]}),z&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`flex flex-col ${C?`gap-2`:`gap-1`}`,children:[(0,x.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`apiKeyScreen.baseUrlLabel`)}),(0,x.jsx)(s,{type:`text`,placeholder:`http://localhost:1234/v1`,value:j,onChange:e=>M(e.target.value),fullWidth:!0})]}),(0,x.jsxs)(`div`,{className:`flex flex-col ${C?`gap-2`:`gap-1`}`,children:[(0,x.jsx)(`label`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`apiKeyScreen.modelsLabel`)}),(0,x.jsx)(s,{type:`text`,placeholder:e(`apiKeyScreen.modelsPlaceholder`),value:N,onChange:e=>P(e.target.value),fullWidth:!0}),(0,x.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`apiKeyScreen.modelsHelp`)})]})]}),L&&(0,x.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,x.jsx)(s,{type:`password`,label:e(`apiKeyScreen.apiKeyLabel`,{provider:F.displayName}),placeholder:F.apiKeyPlaceholder??e(`apiKeyScreen.apiKeyPlaceholder`),value:D,onChange:e=>O(e.target.value),className:`touch-mobile:text-[16px]`,fullWidth:!0}),F.docsUrl&&(0,x.jsxs)(`p`,{className:`self-start text-body-medium-lighter text-[var(--content-tertiary)]`,children:[e(`apiKeyScreen.noKeyPrompt`),` `,(0,x.jsx)(`a`,{href:F.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[var(--content-default)] underline`,children:e(`apiKeyScreen.getKeyLink`)})]})]})]}),(0,x.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${C?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[(0,x.jsx)(t,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!B,onClick:()=>{if(!B)return;let e=k.trim()||y(T);g({provider:T,key:D.trim(),...e?{model:e}:{},...z?{baseUrl:j.trim(),customModels:N.trim()}:{}});let t=new URLSearchParams({[o]:`1`});S&&t.set(`hosting`,S),f(`${r.onboarding.privacy}?${t.toString()}`,c)},className:C?void 0:`h-11 text-base`,children:e(`actions.continue`)}),(0,x.jsx)(t,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:()=>{f(r.onboarding.hosting,c)},className:C?void 0:`h-11 text-base`,children:e(`actions.back`)})]})]})})}export{S as ApiKeyScreen};
|