@vellumai/web 0.11.7-dev.202608302213.8788231 → 0.11.7-dev.202608310050.dde6a86

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.
Files changed (159) hide show
  1. package/dist/assets/{a2a-invite-JBrmE-tC.js → a2a-invite-D9hC5st9.js} +1 -1
  2. package/dist/assets/{about-page-DcIlK1__.js → about-page-CZfgDrcp.js} +1 -1
  3. package/dist/assets/{account-page-4xJwMubj.js → account-page-Dm7JVcRJ.js} +1 -1
  4. package/dist/assets/{account-shell-BiQzbdFl.js → account-shell-eMQ8pE5x.js} +1 -1
  5. package/dist/assets/{acp-run-detail-panel-I3KZThcr.js → acp-run-detail-panel-Db-8TMNz.js} +1 -1
  6. package/dist/assets/{activity-steps-panel-CChMQNDW.js → activity-steps-panel-CB7RwZc4.js} +1 -1
  7. package/dist/assets/{add-credits-modal-7YO1C1oD.js → add-credits-modal-DB5PQhbF.js} +1 -1
  8. package/dist/assets/{ai-page-DCmzP_4J.js → ai-page-DiGPHUq0.js} +1 -1
  9. package/dist/assets/{android-billing-handoff-D5HMm3oy.js → android-billing-handoff-Ci3cShs0.js} +1 -1
  10. package/dist/assets/{api-key-screen-pYM51YGJ.js → api-key-screen-CnzXx0NQ.js} +1 -1
  11. package/dist/assets/{app-info-ioJ7Ulaa.js → app-info-CfUrMWvR.js} +1 -1
  12. package/dist/assets/archive-redirect-page-DDwxULsv.js +1 -0
  13. package/dist/assets/{assistant-status-panel-CF7LkE93.js → assistant-status-panel-aOunlk5l.js} +1 -1
  14. package/dist/assets/{auth-welcome-screen-D5yi-XMB.js → auth-welcome-screen-DJX2DLT5.js} +1 -1
  15. package/dist/assets/{avatar-bundled-components-BT4ThdYQ.js → avatar-bundled-components-ct1wpz6P.js} +1 -1
  16. package/dist/assets/{avatar-random-9s98wzbJ.js → avatar-random-BsoYUQTP.js} +1 -1
  17. package/dist/assets/{background-task-detail-panel-BX4mybl5.js → background-task-detail-panel-CTR-6MVc.js} +1 -1
  18. package/dist/assets/{billing-page-DhGXW2om.js → billing-page-Db9KwszH.js} +3 -3
  19. package/dist/assets/{billing-redirect-page-Cjm2GREa.js → billing-redirect-page-DWfdLuCJ.js} +1 -1
  20. package/dist/assets/{bookmarks-page-B5vTJTpV.js → bookmarks-page-BZ87UosD.js} +1 -1
  21. package/dist/assets/{bundle-confirm-page-lE4r-rqX.js → bundle-confirm-page-MGjo6CVl.js} +1 -1
  22. package/dist/assets/{channel-transcript-panel-dgxwsfyj.js → channel-transcript-panel-CJP34wG0.js} +1 -1
  23. package/dist/assets/{channels-page-route-5sp33xNr.js → channels-page-route-BiGywd_B.js} +1 -1
  24. package/dist/assets/{checkout-continuation-4IHYEsSQ.js → checkout-continuation-D0ZT-kid.js} +1 -1
  25. package/dist/assets/{checkout-page-kfjxHvG9.js → checkout-page-B3UcJH0Q.js} +1 -1
  26. package/dist/assets/checkout-return-target-CKaCH8Dq.js +1 -0
  27. package/dist/assets/{command-palette-DydDVDzH.js → command-palette-COeR79Jz.js} +1 -1
  28. package/dist/assets/{command-palette-window-page-CIeDbdpJ.js → command-palette-window-page-BECLXN9i.js} +1 -1
  29. package/dist/assets/{community-page-DgfWVYlW.js → community-page-D2iJP5tj.js} +1 -1
  30. package/dist/assets/{companion-layout-yBPBayvk.js → companion-layout-DvUMh7RP.js} +1 -1
  31. package/dist/assets/{companion-surface-page-DJgYph0p.js → companion-surface-page-C0K347BL.js} +1 -1
  32. package/dist/assets/{connect-page-vscqLtxm.js → connect-page-DJVS6bzs.js} +1 -1
  33. package/dist/assets/{consent-controls-ibyP_zRV.js → consent-controls-DTRZ1ggK.js} +1 -1
  34. package/dist/assets/{contacts-gateway-seZZ1mIP.js → contacts-gateway-CAW4Zfw1.js} +1 -1
  35. package/dist/assets/{contacts-page-route-CD5UUYI9.js → contacts-page-route-D0ESea68.js} +1 -1
  36. package/dist/assets/{credential-entry-page-200uE5C-.js → credential-entry-page-CXtcFpSX.js} +1 -1
  37. package/dist/assets/{credentials-page-yccE6l8F.js → credentials-page-CtVX7mMh.js} +1 -1
  38. package/dist/assets/{csv-preview-DL6wLgEp.js → csv-preview-ZIF-kWlx.js} +1 -1
  39. package/dist/assets/danger-zone-redirect-page-B1qGEbBR.js +1 -0
  40. package/dist/assets/{debug-page-DMPlP0iG.js → debug-page-BGE_Ju-c.js} +1 -1
  41. package/dist/assets/{deploy-dialogs-DZJhjE3_.js → deploy-dialogs-CXEyJ60N.js} +1 -1
  42. package/dist/assets/{detail-card-Bfp_QSc_.js → detail-card-DNfB7obU.js} +1 -1
  43. package/dist/assets/{detail-drawer-DhUr5YNx.js → detail-drawer-BPkaCFsM.js} +1 -1
  44. package/dist/assets/{detail-panel-stop-button-DAipdVBy.js → detail-panel-stop-button-BBX5GKy0.js} +1 -1
  45. package/dist/assets/{developer-page-fIQuslFO.js → developer-page-D0b3nubB.js} +1 -1
  46. package/dist/assets/devices-redirect-page-C7pytTxX.js +1 -0
  47. package/dist/assets/{dictation-overlay-page-DuqAZiFH.js → dictation-overlay-page-Ct2Ph1JG.js} +1 -1
  48. package/dist/assets/{document-viewer-page-BaWyFUOf.js → document-viewer-page-CojFD0T6.js} +1 -1
  49. package/dist/assets/{emails-page-CSVDTPUL.js → emails-page-BAAcNPZT.js} +1 -1
  50. package/dist/assets/{environment-store-BQgFRH2W.js → environment-store-DOLyKA1V.js} +1 -1
  51. package/dist/assets/{file-editor-DAHV7AVz.js → file-editor-DEFE-ILe.js} +1 -1
  52. package/dist/assets/{general-page-Ue0yKElI.js → general-page-CALM-pnG.js} +1 -1
  53. package/dist/assets/{hatching-screen-BD1ubl8q.js → hatching-screen-C4hmJIsc.js} +1 -1
  54. package/dist/assets/{home-page-route-DAzUQ_WG.js → home-page-route-BG_N3Ohg.js} +1 -1
  55. package/dist/assets/{hosting-screen-Bgcflbmn.js → hosting-screen-CL6IicQ_.js} +1 -1
  56. package/dist/assets/{identity-page-route-BVGC5IG-.js → identity-page-route-ZEaP1PO5.js} +1 -1
  57. package/dist/assets/index-BL1oo6fL.js +369 -0
  58. package/dist/assets/index-Cy94qwEG.css +2 -0
  59. package/dist/assets/{inspect-page-D9r4ZGWC.js → inspect-page-CKEVLl6A.js} +3 -3
  60. package/dist/assets/{integrations-page-Bdb8MtAj.js → integrations-page-dFwaz0D4.js} +1 -1
  61. package/dist/assets/{intelligence-layout-CPVNXIro.js → intelligence-layout-BeriQPdd.js} +1 -1
  62. package/dist/assets/keyboard-shortcuts-redirect-page-SZc6EiMV.js +1 -0
  63. package/dist/assets/{latest-assistant-text-B91e9NmT.js → latest-assistant-text-BfKkByke.js} +1 -1
  64. package/dist/assets/{library-detail-page-B_ruJ2Eu.js → library-detail-page-CIOULvEs.js} +1 -1
  65. package/dist/assets/{library-page-C6Ft702c.js → library-page-BEn05cov.js} +1 -1
  66. package/dist/assets/{login-page-BP-w2ylY.js → login-page-OKiEGL2Q.js} +1 -1
  67. package/dist/assets/{logout-page-C9VlMwpn.js → logout-page-DGHBjoaT.js} +1 -1
  68. package/dist/assets/{logs-layout-Fhlf0ono.js → logs-layout-DIrW9GoU.js} +1 -1
  69. package/dist/assets/{markdown-preview-CEfZQM3s.js → markdown-preview-DRz7j5VP.js} +1 -1
  70. package/dist/assets/{media-preview-RZ3i7Wp2.js → media-preview-Co_LQJLj.js} +1 -1
  71. package/dist/assets/{memory-page-route-CYE45Q7B.js → memory-page-route-Cz2QOVIF.js} +1 -1
  72. package/dist/assets/{memory-router-playground-page-BzOzldwn.js → memory-router-playground-page-B0Svz3sN.js} +1 -1
  73. package/dist/assets/{message-files-panel-BS-3XVFF.js → message-files-panel-CFNE3YR_.js} +1 -1
  74. package/dist/assets/{metric-card-SJqTY1Nx.js → metric-card-BAV27WiB.js} +1 -1
  75. package/dist/assets/{notifications-page-hc-Z1hAt.js → notifications-page-T5b5--2B.js} +1 -1
  76. package/dist/assets/{oauth-complete-page-CGOa-ZkP.js → oauth-complete-page-C23Nh_T9.js} +1 -1
  77. package/dist/assets/{oauth-popup-complete-page-CLHIEq29.js → oauth-popup-complete-page-iBNTnzLk.js} +1 -1
  78. package/dist/assets/{page-shell-Voip6OVS.js → page-shell-CqydP5iU.js} +1 -1
  79. package/dist/assets/{pairing-page-qkJ7Q_r0.js → pairing-page-DpJNSmoa.js} +1 -1
  80. package/dist/assets/password-reset-page-MHFvUuln.js +1 -0
  81. package/dist/assets/{pdf-file-preview-DhqFHpdz.js → pdf-file-preview-N7CVR9YB.js} +1 -1
  82. package/dist/assets/{personality-page-D07rrsqj.js → personality-page-eImHPITp.js} +1 -1
  83. package/dist/assets/{plans-page-vW48J2h0.js → plans-page-BrwwTzDA.js} +1 -1
  84. package/dist/assets/{platform-loopback-page-C7exl8Vp.js → platform-loopback-page-D9aoRUVQ.js} +1 -1
  85. package/dist/assets/{plugin-detail-page-CdJf0GXD.js → plugin-detail-page-D4NyncgG.js} +1 -1
  86. package/dist/assets/{plugins-page-DVjyZhli.js → plugins-page-Ws-GgVPH.js} +1 -1
  87. package/dist/assets/{preview-error-D7Ot5naO.js → preview-error-BXLICJRK.js} +1 -1
  88. package/dist/assets/{privacy-page-BFwl7U1z.js → privacy-page-BT7HLNUZ.js} +1 -1
  89. package/dist/assets/{privacy-screen-Cmlhvm8m.js → privacy-screen-CA3unoQe.js} +1 -1
  90. package/dist/assets/{provider-callback-page-D5A4Lje8.js → provider-callback-page-DgoXduKW.js} +1 -1
  91. package/dist/assets/{provider-key-Y2FCGhud.js → provider-key-Af5D49Je.js} +1 -1
  92. package/dist/assets/{provider-signup-page-BsZTZBAC.js → provider-signup-page-D3SrU9n5.js} +1 -1
  93. package/dist/assets/{quick-input-page-gD7_Qezw.js → quick-input-page-BEVauFrH.js} +1 -1
  94. package/dist/assets/{research-mock-page-_9FnOKT_.js → research-mock-page-CotO5BZB.js} +1 -1
  95. package/dist/assets/{research-onboarding-route-1ihMtWnz.js → research-onboarding-route-DmdvSTcx.js} +1 -1
  96. package/dist/assets/{review-terms-screen-DD82cxwf.js → review-terms-screen-Bt3vpSiA.js} +1 -1
  97. package/dist/assets/{schedules-BkH-2-mv.js → schedules-CG_0wm_x.js} +1 -1
  98. package/dist/assets/{schedules-page-BeQcjBn9.js → schedules-page-DoD6xQMk.js} +1 -1
  99. package/dist/assets/security-redirect-page-xcOk4OAW.js +1 -0
  100. package/dist/assets/{select-assistant-screen-gtqiZiQd.js → select-assistant-screen-BB_u3xVd.js} +1 -1
  101. package/dist/assets/{self-hosted-servers-B_NBU-mX.js → self-hosted-servers-6uKaURl5.js} +1 -1
  102. package/dist/assets/{service-form-controls-BDCiSV7r.js → service-form-controls-BGFU4HPO.js} +1 -1
  103. package/dist/assets/{setting-row-93h-pUwo.js → setting-row-1OYESrSi.js} +1 -1
  104. package/dist/assets/{settings-divider-CjugTknF.js → settings-divider-0L_Wz-RM.js} +1 -1
  105. package/dist/assets/{settings-layout-BpLQoTzS.js → settings-layout-CRYHtWPD.js} +1 -1
  106. package/dist/assets/{share-feedback-modal-DKmZuRTO.js → share-feedback-modal-CpXRCMM8.js} +1 -1
  107. package/dist/assets/{sidebar-tree-BDYYQ-WY.js → sidebar-tree-CmisBQgl.js} +1 -1
  108. package/dist/assets/{signup-page-B-fUPsPM.js → signup-page-B6zU5NNX.js} +1 -1
  109. package/dist/assets/{signup-shell-Ls6IXWMB.js → signup-shell-5HU_UOdt.js} +1 -1
  110. package/dist/assets/{skill-detail-page-C7y7G_L6.js → skill-detail-page-DswpNxZk.js} +1 -1
  111. package/dist/assets/{skill-detail-panel-CBmLM2uO.js → skill-detail-panel-DVc-bsgr.js} +1 -1
  112. package/dist/assets/{skill-removal-dialog-6L9qC-6y.js → skill-removal-dialog-C6AIMbk-.js} +1 -1
  113. package/dist/assets/{skills-page-BWROf4Uo.js → skills-page-BFR-9fP5.js} +1 -1
  114. package/dist/assets/{sounds-page-qv9oOfpC.js → sounds-page-ClUUiT_q.js} +1 -1
  115. package/dist/assets/{start-screen-sbdLD4gf.js → start-screen-CdW_zY2y.js} +1 -1
  116. package/dist/assets/{stt-language-picker-modal-YaeF7QSu.js → stt-language-picker-modal-CTQbFR_p.js} +1 -1
  117. package/dist/assets/{subagent-detail-panel-C91NJBQw.js → subagent-detail-panel-C2nUWi3Z.js} +1 -1
  118. package/dist/assets/{superpowers-page-DTPr5Do7.js → superpowers-page-DzXvuN2Y.js} +1 -1
  119. package/dist/assets/{system-events-page-Bn1nIji_.js → system-events-page-Cq5Db_lf.js} +1 -1
  120. package/dist/assets/system-events-redirect-page-C3vCeMK0.js +1 -0
  121. package/dist/assets/{text-preview-B-pbR8TZ.js → text-preview-G4KnuNRh.js} +1 -1
  122. package/dist/assets/{theme-stage-page-CkjuHBF1.js → theme-stage-page-BjoInv6H.js} +1 -1
  123. package/dist/assets/{tiptap-document-editor-BuB5ums8.js → tiptap-document-editor-CNnUjs5Y.js} +1 -1
  124. package/dist/assets/{tool-detail-panel-BLsTQccq.js → tool-detail-panel-DGGg_CNE.js} +1 -1
  125. package/dist/assets/{trait-cycle-row-DGQcJ8_Z.js → trait-cycle-row-MwtySI8M.js} +1 -1
  126. package/dist/assets/{upgrade-cancel-page-DoQmEwGS.js → upgrade-cancel-page-CNXP1dPv.js} +1 -1
  127. package/dist/assets/{upgrade-success-page-ATqnohMx.js → upgrade-success-page-B8dGTo6a.js} +1 -1
  128. package/dist/assets/{usage-redirect-page-DY8B7eEZ.js → usage-redirect-page-x_6lsu0x.js} +1 -1
  129. package/dist/assets/{use-assistant-identity-details-TYNdjmKO.js → use-assistant-identity-details-BgoRrfoI.js} +1 -1
  130. package/dist/assets/{use-checkout-dismiss-refresh-eO0xwQYo.js → use-checkout-dismiss-refresh-cscBlsdJ.js} +1 -1
  131. package/dist/assets/{use-edge-swipe-back-ChjaiCJ2.js → use-edge-swipe-back-BesXTiBz.js} +2 -2
  132. package/dist/assets/{use-hotkey-recorder-Dax47RKk.js → use-hotkey-recorder-DKTINkvG.js} +1 -1
  133. package/dist/assets/{use-invite-link-dialog-Ifpiq3sC.js → use-invite-link-dialog-BRcP8gem.js} +1 -1
  134. package/dist/assets/{use-platform-assistant-id-k0znzKyy.js → use-platform-assistant-id-0iTlKZs4.js} +1 -1
  135. package/dist/assets/{use-return-to-short-circuit-DDSOIdqN.js → use-return-to-short-circuit-BmNEgmXY.js} +1 -1
  136. package/dist/assets/{use-side-list-room-DA-aOrFK.js → use-side-list-room-u-_x2Ory.js} +1 -1
  137. package/dist/assets/{use-skill-actions-CmDSEIYS.js → use-skill-actions-DH5NKPsR.js} +1 -1
  138. package/dist/assets/{use-skill-detail-files-A2Qef_mz.js → use-skill-detail-files-CtZvGLy3.js} +1 -1
  139. package/dist/assets/use-supports-credentials-settings-eBNxgyqC.js +1 -0
  140. package/dist/assets/use-transcript-message-by-id-Cf96ExZ1.js +1 -0
  141. package/dist/assets/{voice-page-D7QgXH6I.js → voice-page-BA5RkKUM.js} +1 -1
  142. package/dist/assets/{weather-forecast-display-TpUCwYTW.js → weather-forecast-display-D_We5LdN.js} +1 -1
  143. package/dist/assets/{welcome-screen-Bw6cp96H.js → welcome-screen-B5cNbuU5.js} +1 -1
  144. package/dist/assets/{workflow-detail-panel-XRtkpHjT.js → workflow-detail-panel-DyP9NP9w.js} +1 -1
  145. package/dist/assets/{workspace-page-BWcPwrdI.js → workspace-page-Ce3acPgA.js} +1 -1
  146. package/dist/index.html +2 -2
  147. package/package.json +1 -1
  148. package/dist/assets/archive-redirect-page-CaOiwd0c.js +0 -1
  149. package/dist/assets/checkout-return-target-ExZ1Hd5K.js +0 -1
  150. package/dist/assets/danger-zone-redirect-page-BJcrFEu4.js +0 -1
  151. package/dist/assets/devices-redirect-page-z5KyI5cJ.js +0 -1
  152. package/dist/assets/index-DvN3JT-z.css +0 -2
  153. package/dist/assets/index-hiaJ3JFk.js +0 -369
  154. package/dist/assets/keyboard-shortcuts-redirect-page-D2wCm22U.js +0 -1
  155. package/dist/assets/password-reset-page-CkJw6hfe.js +0 -1
  156. package/dist/assets/security-redirect-page-25Ftzkzy.js +0 -1
  157. package/dist/assets/system-events-redirect-page-7-TfXlyz.js +0 -1
  158. package/dist/assets/use-supports-credentials-settings-ClverR_N.js +0 -1
  159. package/dist/assets/use-transcript-message-by-id-D7Tml53p.js +0 -1
@@ -1 +1 @@
1
- import{yv as e}from"./index-hiaJ3JFk.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
+ import{yv as e}from"./index-BL1oo6fL.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{O as t}from"./vendor-BdYt2Rah.js";import{b as n,t as r}from"./react-DPM_L_aA.js";import{bv as i}from"./index-hiaJ3JFk.js";import{n as a,t as o}from"./app-info-ioJ7Ulaa.js";var s=e(n(),1),c=r();function l(){let{t:e}=t(),[n,r]=(0,s.useState)(null);(0,s.useEffect)(()=>{o().then(r)},[]);let l=n??u;return(0,c.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,c.jsx)(`h1`,{className:`mt-4 text-2xl font-semibold`,children:l.appName}),(0,c.jsx)(`p`,{className:`text-muted-foreground mt-1 mb-7 text-xs`,children:e(`aboutPage.tagline`)}),(0,c.jsxs)(`dl`,{className:`mb-7 grid grid-cols-[auto_auto] gap-x-4 gap-y-1.5 text-sm`,children:[(0,c.jsx)(`dt`,{className:`text-muted-foreground text-right`,children:e(`aboutPage.version`)}),(0,c.jsx)(`dd`,{className:`text-left font-mono tabular-nums select-text`,children:l.version}),(0,c.jsx)(`dt`,{className:`text-muted-foreground text-right`,children:e(`aboutPage.build`)}),(0,c.jsx)(`dd`,{className:`text-left font-mono tabular-nums select-text`,children:l.commitSha})]}),(0,c.jsx)(`a`,{href:l.website,className:`text-primary text-sm hover:underline`,onClick:e=>{i()&&(e.preventDefault(),a())},children:new URL(l.website).host}),(0,c.jsx)(`div`,{className:`text-muted-foreground mt-auto pt-6 text-[11px]`,children:l.copyright})]})}var u={appName:`Vellum`,version:`—`,commitSha:`—`,copyright:`© ${new Date().getFullYear()} Vellum`,website:`https://vellum.ai`};export{l as AboutPage};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{O as t}from"./vendor-BdYt2Rah.js";import{b as n,t as r}from"./react-DPM_L_aA.js";import{bv as i}from"./index-BL1oo6fL.js";import{n as a,t as o}from"./app-info-CfUrMWvR.js";var s=e(n(),1),c=r();function l(){let{t:e}=t(),[n,r]=(0,s.useState)(null);(0,s.useEffect)(()=>{o().then(r)},[]);let l=n??u;return(0,c.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,c.jsx)(`h1`,{className:`mt-4 text-2xl font-semibold`,children:l.appName}),(0,c.jsx)(`p`,{className:`text-muted-foreground mt-1 mb-7 text-xs`,children:e(`aboutPage.tagline`)}),(0,c.jsxs)(`dl`,{className:`mb-7 grid grid-cols-[auto_auto] gap-x-4 gap-y-1.5 text-sm`,children:[(0,c.jsx)(`dt`,{className:`text-muted-foreground text-right`,children:e(`aboutPage.version`)}),(0,c.jsx)(`dd`,{className:`text-left font-mono tabular-nums select-text`,children:l.version}),(0,c.jsx)(`dt`,{className:`text-muted-foreground text-right`,children:e(`aboutPage.build`)}),(0,c.jsx)(`dd`,{className:`text-left font-mono tabular-nums select-text`,children:l.commitSha})]}),(0,c.jsx)(`a`,{href:l.website,className:`text-primary text-sm hover:underline`,onClick:e=>{i()&&(e.preventDefault(),a())},children:new URL(l.website).host}),(0,c.jsx)(`div`,{className:`text-muted-foreground mt-auto pt-6 text-[11px]`,children:l.copyright})]})}var u={appName:`Vellum`,version:`—`,commitSha:`—`,copyright:`© ${new Date().getFullYear()} Vellum`,website:`https://vellum.ai`};export{l as AboutPage};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{O as t}from"./vendor-BdYt2Rah.js";import{b as n,n as r,t as i}from"./react-DPM_L_aA.js";import{Cs as a,Qf as o,ns as s,rm as c,rp as l,tp as u,ts as d,yv as f}from"./index-hiaJ3JFk.js";import{r as p,t as m}from"./account-shell-BiQzbdFl.js";var h=e(n(),1),g=i();function _(){let{t:e}=t(`account`),n=u(),i=l(),_=o.use.user(),v=o.use.logout(),[y,b]=(0,h.useState)(null),[x,S]=(0,h.useState)(!1),C=async()=>{b(null),S(!0);try{await c(s,d)}catch(t){console.error(`[account] auth flow failed:`,t),b(e(`authErrors.genericFailure`)),S(!1)}};return i?(0,g.jsx)(m,{children:(0,g.jsx)(p,{title:e(`accountPage.loading`)})}):n?(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)(r,{to:f.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(),a(f.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
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{O as t}from"./vendor-BdYt2Rah.js";import{b as n,n as r,t as i}from"./react-DPM_L_aA.js";import{Cs as a,Qf as o,ns as s,rm as c,rp as l,tp as u,ts as d,yv as f}from"./index-BL1oo6fL.js";import{r as p,t as m}from"./account-shell-eMQ8pE5x.js";var h=e(n(),1),g=i();function _(){let{t:e}=t(`account`),n=u(),i=l(),_=o.use.user(),v=o.use.logout(),[y,b]=(0,h.useState)(null),[x,S]=(0,h.useState)(!1),C=async()=>{b(null),S(!0);try{await c(s,d)}catch(t){console.error(`[account] auth flow failed:`,t),b(e(`authErrors.genericFailure`)),S(!1)}};return i?(0,g.jsx)(m,{children:(0,g.jsx)(p,{title:e(`accountPage.loading`)})}):n?(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)(r,{to:f.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(),a(f.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{t as e}from"./react-DPM_L_aA.js";import{My as t}from"./index-hiaJ3JFk.js";var n=e(),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:e,error:i,children:a,submitLabel:o,submittingLabel:s,isSubmitting:c,footer:l}){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(`form`,{onSubmit:e,className:`flex flex-col gap-4`,children:[i&&(0,n.jsx)(t,{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
+ import{t as e}from"./react-DPM_L_aA.js";import{My as t}from"./index-BL1oo6fL.js";var n=e(),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:e,error:i,children:a,submitLabel:o,submittingLabel:s,isSubmitting:c,footer:l}){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(`form`,{onSubmit:e,className:`flex flex-col gap-4`,children:[i&&(0,n.jsx)(t,{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,4 +1,4 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{N as t,O as n}from"./vendor-BdYt2Rah.js";import{b as r,t as i}from"./react-DPM_L_aA.js";import{Cn as a,In as o,J as s,Lr as c,Or as l,Rr as u,S as d,Sr as f,Zr as p,gi as m,hi as h,in as g,jn as _,jr as v,or as y,q as b,v as x,x as S,xi as C,zr as w}from"./icons-CSdHOix6.js";import{n as T,r as ee,t as E}from"./metric-card-SJqTY1Nx.js";import{t as te}from"./repeat-DVEpBLT_.js";import{Dv as D,F as ne,Fy as O,Hn as re,Py as k,Un as A,Vn as ie,Wn as j,ar as M,cn as N,cr as P,ky as ae,or as F,sr as oe}from"./index-hiaJ3JFk.js";import{t as se}from"./diff-rows-BVqSFCjn.js";import{t as ce}from"./detail-panel-stop-button-DAipdVBy.js";import{t as le}from"./status-badge-pill-Bg90syHR.js";var ue=C(`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`}]]),I=e(r(),1),L=``;function R(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 de(e){return(e.messageId?.startsWith(`local-marker-`)??!1)||(e.content?.startsWith(`↻ Steering: `)??!1)}function z(e){let t=e??``;return t.startsWith(`↻ Steering: `)?t.slice(M.length):t}function B(e){let t=e[e.length-1];t&&(t.kind===`agent`||t.kind===`thinking`)&&!t.isComplete&&(e[e.length-1]={...t,isComplete:!0})}function V(e,t){if(t.updateType===`agent_message_chunk`&&de(t)){B(e),e.push({kind:`user`,id:t.messageId??`steer-${e.length}`,content:z(t.content)});return}switch(t.updateType){case`user_message_chunk`:{let n=t.messageId??L,r=z(t.content),i=e[e.length-1];i&&i.kind===`user`&&i.id===n?e[e.length-1]={...i,content:i.content+r}:(B(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??L,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!==L&&r&&r.kind===`agent`&&r.messageId===L&&!r.isComplete&&r.content===(t.content??``)){e[e.length-1]={...r,messageId:n};return}B(e),e.push({kind:`agent`,messageId:n,content:t.content??``,isComplete:!1});return}case`agent_thought_chunk`:{let n=t.messageId??L,r=e[e.length-1];if(r&&r.kind===`thinking`&&r.messageId===n){e[e.length-1]={...r,content:r.content+(t.content??``)};return}B(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;B(e),e.push({kind:`tool`,toolCallId:n,title:t.toolTitle??``,toolKind:t.toolKind,status:R(t.toolStatus,`running`),content:t.content,locations:H(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=H(t);e[r]={...i,title:t.toolTitle??i.title,toolKind:t.toolKind??i.toolKind,status:R(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=fe(t.content);if(n===null)return;let r=e.findIndex(e=>e.kind===`plan`),i={kind:`plan`,entries:n};r===-1?(B(e),e.push(i)):e[r]=i;return}}}function H(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 fe(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 pe(e){let t=[];for(let n of e)V(t,n);return t}function me(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 he(){let e=null,t=[];function n(n){return t=pe(n),e=n,t}function r(r){let i=me(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++)V(n,r[e]);return e=r,t=n,t}case`mutate-last`:case`fallback`:return n(r)}}return{project:r}}function ge(e){let t=(0,I.useRef)(null);return t.current??=he(),t.current.project(e)}function U(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=_e(e);t&&r.push(t)}return r}function _e(e){if(typeof e!=`object`||!e)return null;let t=e;switch(t.type){case`content`:return{type:`content`,text:ve(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=ye(t);return e===void 0?{type:`terminal`}:{type:`terminal`,text:e}}default:return null}}function ve(e){if(typeof e==`string`)return e;if(typeof e==`object`&&e){let t=e.text;if(typeof t==`string`)return t}return``}function ye(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 W(e){if(typeof e!=`object`||!e)return;let t=e.command;return typeof t==`string`?t:void 0}function G(e){return U(e).filter(e=>e.type===`content`||e.type===`terminal`).map(e=>`text`in e?e.text??``:``).filter(e=>e.length>0).join(`
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{N as t,O as n}from"./vendor-BdYt2Rah.js";import{b as r,t as i}from"./react-DPM_L_aA.js";import{Cn as a,In as o,J as s,Lr as c,Or as l,Rr as u,S as d,Sr as f,Zr as p,gi as m,hi as h,in as g,jn as _,jr as v,or as y,q as b,v as x,x as S,xi as C,zr as w}from"./icons-CSdHOix6.js";import{n as T,r as ee,t as E}from"./metric-card-BAV27WiB.js";import{t as te}from"./repeat-DVEpBLT_.js";import{Dv as D,F as ne,Fy as O,Hn as re,Py as k,Un as A,Vn as ie,Wn as j,ar as M,cn as N,cr as P,ky as ae,or as F,sr as oe}from"./index-BL1oo6fL.js";import{t as se}from"./diff-rows-BVqSFCjn.js";import{t as ce}from"./detail-panel-stop-button-BBX5GKy0.js";import{t as le}from"./status-badge-pill-Bg90syHR.js";var ue=C(`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`}]]),I=e(r(),1),L=``;function R(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 de(e){return(e.messageId?.startsWith(`local-marker-`)??!1)||(e.content?.startsWith(`↻ Steering: `)??!1)}function z(e){let t=e??``;return t.startsWith(`↻ Steering: `)?t.slice(M.length):t}function B(e){let t=e[e.length-1];t&&(t.kind===`agent`||t.kind===`thinking`)&&!t.isComplete&&(e[e.length-1]={...t,isComplete:!0})}function V(e,t){if(t.updateType===`agent_message_chunk`&&de(t)){B(e),e.push({kind:`user`,id:t.messageId??`steer-${e.length}`,content:z(t.content)});return}switch(t.updateType){case`user_message_chunk`:{let n=t.messageId??L,r=z(t.content),i=e[e.length-1];i&&i.kind===`user`&&i.id===n?e[e.length-1]={...i,content:i.content+r}:(B(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??L,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!==L&&r&&r.kind===`agent`&&r.messageId===L&&!r.isComplete&&r.content===(t.content??``)){e[e.length-1]={...r,messageId:n};return}B(e),e.push({kind:`agent`,messageId:n,content:t.content??``,isComplete:!1});return}case`agent_thought_chunk`:{let n=t.messageId??L,r=e[e.length-1];if(r&&r.kind===`thinking`&&r.messageId===n){e[e.length-1]={...r,content:r.content+(t.content??``)};return}B(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;B(e),e.push({kind:`tool`,toolCallId:n,title:t.toolTitle??``,toolKind:t.toolKind,status:R(t.toolStatus,`running`),content:t.content,locations:H(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=H(t);e[r]={...i,title:t.toolTitle??i.title,toolKind:t.toolKind??i.toolKind,status:R(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=fe(t.content);if(n===null)return;let r=e.findIndex(e=>e.kind===`plan`),i={kind:`plan`,entries:n};r===-1?(B(e),e.push(i)):e[r]=i;return}}}function H(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 fe(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 pe(e){let t=[];for(let n of e)V(t,n);return t}function me(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 he(){let e=null,t=[];function n(n){return t=pe(n),e=n,t}function r(r){let i=me(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++)V(n,r[e]);return e=r,t=n,t}case`mutate-last`:case`fallback`:return n(r)}}return{project:r}}function ge(e){let t=(0,I.useRef)(null);return t.current??=he(),t.current.project(e)}function U(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=_e(e);t&&r.push(t)}return r}function _e(e){if(typeof e!=`object`||!e)return null;let t=e;switch(t.type){case`content`:return{type:`content`,text:ve(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=ye(t);return e===void 0?{type:`terminal`}:{type:`terminal`,text:e}}default:return null}}function ve(e){if(typeof e==`string`)return e;if(typeof e==`object`&&e){let t=e.text;if(typeof t==`string`)return t}return``}function ye(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 W(e){if(typeof e!=`object`||!e)return;let t=e.command;return typeof t==`string`?t:void 0}function G(e){return U(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 K(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 q(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 J=i();function be({content:e,isComplete:t,assistantId:n}){return(0,J.jsxs)(`div`,{"data-testid":`acp-chat-agent-message`,className:`flex w-full flex-col items-start text-chat text-[var(--content-default)]`,children:[(0,J.jsx)(N,{content:e,assistantId:n}),!t&&(0,J.jsx)(j,{className:`mt-1`,"data-testid":`acp-chat-agent-streaming`})]})}function xe({entries:e}){let{t}=n(`chat`);return e.length===0?null:(0,J.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,J.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 text-[var(--content-tertiary)]`,children:[(0,J.jsx)(g,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,J.jsx)(k,{variant:`body-small-emphasised`,className:`text-inherit`,children:t(`acpChatPlanBlock.plan`)})]}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:e.map((e,t)=>(0,J.jsxs)(`li`,{"data-testid":`acp-chat-plan-entry`,"data-checked":e.checked,className:`flex items-start gap-2`,children:[e.checked?(0,J.jsx)(v,{"aria-hidden":!0,className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}):(0,J.jsx)(f,{"aria-hidden":!0,className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-disabled)]`}),(0,J.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 Se(e){switch(e){case`max_tokens`:case`max_turn_requests`:return t(`chat:acpChatTerminalBlock.stoppedLimitReached`);case`refusal`:return t(`chat:acpChatTerminalBlock.refused`);case`cancelled`:return t(`chat:acpChatTerminalBlock.cancelled`);default:return t(`chat:acpChatTerminalBlock.completed`)}}function Ce(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`})}function Y({completedAt:e}){let{t}=n(`chat`);return e===void 0?null:(0,J.jsx)(`span`,{"data-testid":`acp-chat-terminal-time`,children:t(`acpChatTerminalBlock.atTime`,{time:Ce(e)})})}function we({status:e,stopReason:t,error:r,completedAt:i}){let{t:a}=n(`chat`);if(P(e))return null;if(e===`failed`)return(0,J.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,J.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,J.jsx)(x,{className:`h-4 w-4`})}),(0,J.jsx)(`span`,{children:r??a(`acpChatTerminalBlock.runFailed`)})]});if(e===`cancelled`)return(0,J.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,J.jsx)(l,{"aria-hidden":!0,className:`h-4 w-4 shrink-0`}),(0,J.jsx)(`span`,{children:a(`acpChatTerminalBlock.cancelled`)}),(0,J.jsx)(Y,{completedAt:i})]});let o=Se(t);return(0,J.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,J.jsx)(v,{"aria-hidden":!0,className:`h-4 w-4 shrink-0 text-[var(--system-positive-strong)]`}),(0,J.jsx)(`span`,{children:o}),(0,J.jsx)(Y,{completedAt:i})]})}function Te({showDot:e,isLast:t,children:n}){return(0,J.jsxs)(`div`,{className:`relative flex items-start gap-2${t?``:` pb-4`}`,children:[!t&&(0,J.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,J.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,J.jsx)(`span`,{className:`h-[5px] w-[5px] rounded-full bg-[var(--content-disabled)]`})}):(0,J.jsx)(`span`,{"aria-hidden":!0,className:`h-[14px] w-[14px] shrink-0`}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:n})]})}function Ee({content:e,isComplete:t,assistantId:n}){let[r,i]=(0,I.useState)(null),a=r??!t,o=e.trim().length>0,s=t?`Thought process`:`Thinking`,l=t?(0,J.jsx)(p,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,J.jsx)(j,{dotSize:5,className:`shrink-0`,"data-testid":`acp-chat-thinking-streaming`});return o?(0,J.jsxs)(`div`,{"data-testid":`acp-chat-thinking-block`,className:`w-full`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":a,onClick:()=>i(!a),"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:[a?(0,J.jsx)(w,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,J.jsx)(c,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),l,(0,J.jsx)(`span`,{children:s})]}),a&&(0,J.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,J.jsx)(N,{content:e,assistantId:n})})]}):(0,J.jsx)(`div`,{"data-testid":`acp-chat-thinking-block`,className:`w-full`,children:(0,J.jsxs)(`div`,{className:`flex w-full items-center gap-1.5 text-body-small-default text-[var(--content-tertiary)]`,children:[l,(0,J.jsx)(`span`,{children:s})]})})}var De={running:`neutral`,completed:`positive`,error:`negative`,ended:`neutral`},Oe={running:`Running`,completed:`Completed`,error:`Failed`,ended:`Ended`},ke={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`},Ae=`Tool call`,je={read:o,edit:ue,delete:S,move:_,search:s,execute:d,think:p,fetch:a,switch_mode:te},Me=new Set([`read`,`edit`,`delete`,`move`]);function Ne({toolKind:e}){return(0,J.jsx)(e&&je[e]||y,{"aria-hidden":!0,className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`})}function X({label:e,value:t,testId:n}){return(0,J.jsxs)(`div`,{"data-testid":n,children:[(0,J.jsx)(`div`,{className:`mb-1 text-body-small-default text-[var(--content-tertiary)]`,children:e}),(0,J.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 Pe({block:e,isTerminal:t=!1,onOpenDiff:r,onOpenOutput:i}){let{t:a}=n(`chat`),[s,l]=(0,I.useState)(!1),u=(0,I.useMemo)(()=>U(e.content),[e.content]),f=(0,I.useMemo)(()=>G(e.content),[e.content]),p=(0,I.useMemo)(()=>f.split(`
3
3
  `).map(e=>e.trim()).find(e=>e.length>0&&!e.startsWith("```"))||`View output`,[f]),m=(0,I.useMemo)(()=>q(u,e.locations),[u,e.locations]),h=t&&e.status===`running`?`ended`:e.status,g=h===`running`,_=e.toolKind&&ke[e.toolKind]||Ae,v=W(e.rawInput)??e.title,y=v&&v!==_&&(!Me.has(e.toolKind??``)||m.length===0)?v:null,b=K(e.rawInput),x=K(e.rawOutput),S=b!==void 0||x!==void 0;return(0,J.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,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(Ne,{toolKind:e.toolKind}),(0,J.jsx)(k,{variant:`body-small-emphasised`,className:`min-w-0 flex-1 truncate text-[var(--content-default)]`,title:e.title,children:_}),(0,J.jsx)(ae,{tone:De[h],"data-testid":`acp-chat-tool-status`,children:Oe[h]}),g&&(0,J.jsx)(j,{className:`shrink-0`,"data-testid":`acp-chat-tool-running`})]}),y&&(0,J.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}),m.length>0&&(0,J.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:m.map(t=>{let n=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 n?(0,J.jsxs)(`button`,{type:`button`,"data-testid":`acp-chat-tool-file-chip`,onClick:()=>r(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,J.jsx)(o,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,J.jsx)(`span`,{className:`truncate font-mono`,children:t.path})]},t.path):(0,J.jsxs)(`span`,{"data-testid":`acp-chat-tool-file-ref`,title:t.path,className:i,children:[(0,J.jsx)(o,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,J.jsx)(`span`,{className:`truncate font-mono`,children:t.path})]},t.path)})}),f.length>0&&(0,J.jsxs)(`button`,{type:`button`,"data-testid":`acp-chat-tool-output-open`,onClick:()=>i?.(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,J.jsx)(d,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-tertiary)]`}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-body-small-default text-[var(--content-secondary)]`,children:p}),(0,J.jsx)(c,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-tertiary)]`})]}),S&&(0,J.jsxs)(`div`,{className:`mt-2`,"data-testid":`acp-chat-tool-raw`,children:[(0,J.jsxs)(`button`,{type:`button`,"data-testid":`acp-chat-tool-raw-toggle`,"aria-expanded":s,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:[s?(0,J.jsx)(w,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}):(0,J.jsx)(c,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0`}),(0,J.jsx)(`span`,{children:a(s?`acpChatToolCard.hideRaw`:`acpChatToolCard.showRaw`)})]}),s&&(0,J.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-2`,children:[b!==void 0&&(0,J.jsx)(X,{label:a(`acpChatToolCard.rawInput`),value:b,testId:`acp-chat-tool-raw-input`}),x!==void 0&&(0,J.jsx)(X,{label:a(`acpChatToolCard.rawOutput`),value:x,testId:`acp-chat-tool-raw-output`})]})]})]})}function Fe({content:e}){return(0,J.jsx)(`div`,{"data-testid":`acp-chat-user-turn`,className:`flex w-full justify-end`,children:(0,J.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 Ie({content:e,assistantId:t}){return(0,J.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,J.jsx)(N,{content:G(e),hardLineBreaks:!0,assistantId:t})})}var Z=2e3;function Q(e){if(e===``)return[];let t=e.split(`
4
4
  `);return e.endsWith(`
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{O as t}from"./vendor-BdYt2Rah.js";import{b as n,t as r}from"./react-DPM_L_aA.js";import{Rr as i}from"./icons-CSdHOix6.js";import{An as a,At as o,Ct as s,Dt as c,En as l,Fy as u,In as d,Mn as f,Mt as p,On as m,Ot as h,P as g,Py as _,St as v,Tt as y,Zs as b,bt as x,cn as S,kn as C,kt as w,mr as T,or as E,vt as D,wt as O,xt as k,yt as A}from"./index-hiaJ3JFk.js";import{t as j}from"./use-transcript-message-by-id-D7Tml53p.js";import{ToolDetailBody as M,t as N}from"./tool-detail-panel-BLsTQccq.js";var P=e(n(),1);function F(e,t,n){let r=A(t,n.workflow),i=e=>{let t=k(e,n.workflow.byToolUseId);if(t!==null&&r.has(t))return!0;let i=D(e,n.acpByToolUseId);if(i!==null&&n.acpById[i]!==void 0)return!0;let a=x(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 I(e,t){let n=j(e),r=b.use.byId(),i=b.use.byToolUseId(),o=b.use.notFoundRunIds(),s=b.use.hydrationFailedRunIds(),c=E.use.byId(),l=E.use.byToolUseId(),u=T.use.byId();return(0,P.useMemo)(()=>{if(!n||t==null)return null;let e=a(n.contentBlocks??[],{splitInlineThinking:n.role!==`user`})[t];if(!e||e.type!==`activity`)return null;let{cardItems:d,toolCalls:f}=C(e.items);return F(d,f,{workflow:{byId:r,byToolUseId:i,notFoundRunIds:o,hydrationFailedRunIds:s},acpById:c,acpByToolUseId:l,backgroundTaskById:u})},[n,t,r,i,o,s,c,l,u])}var L=r(),R=60;function z({payload:e,onClose:n,assistantId:r}){let{t:a}=t(`chat`),[o,c]=(0,P.useState)(null),d=I(e.messageId,e.groupIndex),f=d?.items??e.items,m=d?.toolCalls??e.toolCalls,h=y(f),b=s(h.steps),x=O(h.state,h.steps),S=x===`loading`,C=v(x,h.totalDurationLabel??``,b.failed),w=S&&h.currentStepTitle||C,T=new Map(m.map(e=>[e.id,e])),E=o?o.kind===`thinking`?`Thinking`:o.activity||o.title:``;return(0,L.jsx)(g,{icon:o?(0,L.jsx)(u,{variant:`outlined`,iconOnly:(0,L.jsx)(i,{}),"aria-label":a(`activityStepsPanel.backAria`),tooltip:a(`activityStepsPanel.backTooltip`),onClick:()=>c(null),className:`shrink-0`}):void 0,titleNode:o?(0,L.jsx)(_,{variant:`title-medium`,className:`min-w-0 shrink truncate py-0.5 leading-snug text-[var(--content-default)]`,children:E}):(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 py-0.5`,children:[(0,L.jsx)(_,{variant:`title-medium`,className:`min-w-0 shrink truncate leading-snug text-[var(--content-default)]`,children:S?(0,L.jsx)(l,{children:w}):w}),h.stepCount?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:`size-[3px] shrink-0 rounded-full bg-[var(--content-tertiary)]`}),(0,L.jsx)(_,{variant:`title-medium`,className:`shrink-0 whitespace-nowrap leading-snug text-[var(--content-secondary)]`,children:h.stepCount})]}):null]}),closeLabel:a(`activityStepsPanel.closeSteps`),onClose:n,children:o?(0,L.jsx)(V,{detail:o,assistantId:r}):(0,L.jsx)(p,{steps:h.steps,timeline:!0,renderStep:t=>(0,L.jsx)(B,{step:t,activeDetail:o,onOpenDetail:c,lookupToolCall:e=>T.get(e),messageId:e.messageId,groupIndex:e.groupIndex})})})}function B({step:e,activeDetail:n,onOpenDetail:r,lookupToolCall:i,messageId:a,groupIndex:s}){let{t:l}=t(`chat`);if(e.kind===`thinking`){let t=a!=null&&e.thinkingItemIndex!=null?{messageId:a,thinkingGroupIndex:s,thinkingItemIndex:e.thinkingItemIndex}:{};return(0,L.jsx)(w,{iconName:`brain`,label:d(f(e.text),R),ariaLabel:l(`activityStepsPanel.viewThinkingAria`),active:!1,onClick:()=>r({kind:`thinking`,toolCallId:``,toolName:``,title:l(`activityStepsPanel.thinkingTitle`),activity:``,input:{},status:`completed`,thinkingText:e.text,...t})})}if(e.kind===`web_search`)return(0,L.jsx)(h,{step:e});if(e.kind===`web_search_error`)return(0,L.jsx)(c,{step:e});if(e.kind!==`tool`)return(0,L.jsx)(o,{step:e});let u=i(e.toolCallId);return(0,L.jsx)(w,{iconName:e.iconName,label:e.activity||e.info||e.title,active:n?.toolCallId===e.toolCallId,onClick:()=>{u&&r(m(u))}})}function V({detail:e,assistantId:t}){let n=N(e.kind===`thinking`?e.messageId:void 0,e.thinkingGroupIndex,e.thinkingItemIndex);return(0,L.jsx)(`div`,{className:`flex flex-col gap-4`,children:e.kind===`thinking`?(0,L.jsx)(S,{content:n??e.thinkingText??``,hardLineBreaks:!0,assistantId:t}):(0,L.jsx)(M,{detail:e,assistantId:t})})}export{z as ActivityStepsPanel};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{O as t}from"./vendor-BdYt2Rah.js";import{b as n,t as r}from"./react-DPM_L_aA.js";import{Rr as i}from"./icons-CSdHOix6.js";import{An as a,At as o,Ct as s,Dt as c,En as l,Fy as u,In as d,Mn as f,Mt as p,On as m,Ot as h,P as g,Py as _,St as v,Tt as y,Zs as b,bt as x,cn as S,kn as C,kt as w,mr as T,or as E,vt as D,wt as O,xt as k,yt as A}from"./index-BL1oo6fL.js";import{t as j}from"./use-transcript-message-by-id-Cf96ExZ1.js";import{ToolDetailBody as M,t as N}from"./tool-detail-panel-DGGg_CNE.js";var P=e(n(),1);function F(e,t,n){let r=A(t,n.workflow),i=e=>{let t=k(e,n.workflow.byToolUseId);if(t!==null&&r.has(t))return!0;let i=D(e,n.acpByToolUseId);if(i!==null&&n.acpById[i]!==void 0)return!0;let a=x(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 I(e,t){let n=j(e),r=b.use.byId(),i=b.use.byToolUseId(),o=b.use.notFoundRunIds(),s=b.use.hydrationFailedRunIds(),c=E.use.byId(),l=E.use.byToolUseId(),u=T.use.byId();return(0,P.useMemo)(()=>{if(!n||t==null)return null;let e=a(n.contentBlocks??[],{splitInlineThinking:n.role!==`user`})[t];if(!e||e.type!==`activity`)return null;let{cardItems:d,toolCalls:f}=C(e.items);return F(d,f,{workflow:{byId:r,byToolUseId:i,notFoundRunIds:o,hydrationFailedRunIds:s},acpById:c,acpByToolUseId:l,backgroundTaskById:u})},[n,t,r,i,o,s,c,l,u])}var L=r(),R=60;function z({payload:e,onClose:n,assistantId:r}){let{t:a}=t(`chat`),[o,c]=(0,P.useState)(null),d=I(e.messageId,e.groupIndex),f=d?.items??e.items,m=d?.toolCalls??e.toolCalls,h=y(f),b=s(h.steps),x=O(h.state,h.steps),S=x===`loading`,C=v(x,h.totalDurationLabel??``,b.failed),w=S&&h.currentStepTitle||C,T=new Map(m.map(e=>[e.id,e])),E=o?o.kind===`thinking`?`Thinking`:o.activity||o.title:``;return(0,L.jsx)(g,{icon:o?(0,L.jsx)(u,{variant:`outlined`,iconOnly:(0,L.jsx)(i,{}),"aria-label":a(`activityStepsPanel.backAria`),tooltip:a(`activityStepsPanel.backTooltip`),onClick:()=>c(null),className:`shrink-0`}):void 0,titleNode:o?(0,L.jsx)(_,{variant:`title-medium`,className:`min-w-0 shrink truncate py-0.5 leading-snug text-[var(--content-default)]`,children:E}):(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 py-0.5`,children:[(0,L.jsx)(_,{variant:`title-medium`,className:`min-w-0 shrink truncate leading-snug text-[var(--content-default)]`,children:S?(0,L.jsx)(l,{children:w}):w}),h.stepCount?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:`size-[3px] shrink-0 rounded-full bg-[var(--content-tertiary)]`}),(0,L.jsx)(_,{variant:`title-medium`,className:`shrink-0 whitespace-nowrap leading-snug text-[var(--content-secondary)]`,children:h.stepCount})]}):null]}),closeLabel:a(`activityStepsPanel.closeSteps`),onClose:n,children:o?(0,L.jsx)(V,{detail:o,assistantId:r}):(0,L.jsx)(p,{steps:h.steps,timeline:!0,renderStep:t=>(0,L.jsx)(B,{step:t,activeDetail:o,onOpenDetail:c,lookupToolCall:e=>T.get(e),messageId:e.messageId,groupIndex:e.groupIndex})})})}function B({step:e,activeDetail:n,onOpenDetail:r,lookupToolCall:i,messageId:a,groupIndex:s}){let{t:l}=t(`chat`);if(e.kind===`thinking`){let t=a!=null&&e.thinkingItemIndex!=null?{messageId:a,thinkingGroupIndex:s,thinkingItemIndex:e.thinkingItemIndex}:{};return(0,L.jsx)(w,{iconName:`brain`,label:d(f(e.text),R),ariaLabel:l(`activityStepsPanel.viewThinkingAria`),active:!1,onClick:()=>r({kind:`thinking`,toolCallId:``,toolName:``,title:l(`activityStepsPanel.thinkingTitle`),activity:``,input:{},status:`completed`,thinkingText:e.text,...t})})}if(e.kind===`web_search`)return(0,L.jsx)(h,{step:e});if(e.kind===`web_search_error`)return(0,L.jsx)(c,{step:e});if(e.kind!==`tool`)return(0,L.jsx)(o,{step:e});let u=i(e.toolCallId);return(0,L.jsx)(w,{iconName:e.iconName,label:e.activity||e.info||e.title,active:n?.toolCallId===e.toolCallId,onClick:()=>{u&&r(m(u))}})}function V({detail:e,assistantId:t}){let n=N(e.kind===`thinking`?e.messageId:void 0,e.thinkingGroupIndex,e.thinkingItemIndex);return(0,L.jsx)(`div`,{className:`flex flex-col gap-4`,children:e.kind===`thinking`?(0,L.jsx)(S,{content:n??e.thinkingText??``,hardLineBreaks:!0,assistantId:t}):(0,L.jsx)(M,{detail:e,assistantId:t})})}export{z as ActivityStepsPanel};
@@ -1 +1 @@
1
- import{o as e,r as t}from"./rolldown-runtime-BM3Ffeng.js";import{Kn as n,O as r,Un as i}from"./vendor-BdYt2Rah.js";import{b as a,d as o,g as s,n as c,t as l}from"./react-DPM_L_aA.js";import{Fr as u,Lr as d,tn as f}from"./icons-CSdHOix6.js";import{$l as p,Fy as m,Ku as h,Sl as g,oy as _,qu as v,vy as y,wl as b,yv as x}from"./index-hiaJ3JFk.js";import{n as S}from"./android-billing-handoff-D5HMm3oy.js";import{t as C}from"./checkout-return-target-ExZ1Hd5K.js";var w=t({AddCreditsModal:()=>j}),T=e(a(),1),E=l(),D=[`10.00`,`20.00`,`30.00`,`40.00`,`50.00`,`60.00`,`70.00`,`80.00`,`90.00`,`100.00`];function O(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 k(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 A({open:e,onOpenChange:t}){let{t:a}=r(),{pathname:l}=o(),[S]=s(),w=S.toString()?`${l}?${S.toString()}`:l,{data:A,isLoading:j}=n(g()),M=A?.allowed_top_up_amounts?.length?A.allowed_top_up_amounts:D,[N,P]=(0,T.useState)(null),F=N&&M.includes(N)?N:M[0]??D[0],I=i(b());return(0,T.useEffect)(()=>v(()=>{t(!1)}),[t]),p(`deeplink.billingCheckoutComplete`,({flow:e})=>{e===`top_up`&&t(!1)}),(0,E.jsx)(y.Root,{open:e,onOpenChange:t,children:(0,E.jsxs)(y.Content,{size:`sm`,children:[(0,E.jsxs)(y.Header,{children:[(0,E.jsx)(y.Title,{children:a(`addCreditsModal.title`)}),(0,E.jsx)(y.Description,{children:a(`addCreditsModal.description`)})]}),(0,E.jsx)(y.Body,{children:(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{htmlFor:`add-credits-amount`,className:`block text-body-small-default text-[var(--content-tertiary)]`,children:a(`addCreditsModal.amount`)}),(0,E.jsx)(_,{id:`add-credits-amount`,value:F,onChange:e=>{P(e),I.isError&&I.reset()},disabled:j||!A,options:M.map(e=>({value:e,label:O(e)}))})]}),I.isError&&(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,E.jsx)(u,{className:`h-3.5 w-3.5 shrink-0`}),k(I.error)]}),(0,E.jsxs)(c,{to:x.settings.usageBillingConfigureTopUps,className:`flex items-center gap-1 text-body-small-default text-[var(--content-tertiary)] hover:text-[var(--content-secondary)]`,onClick:()=>t(!1),children:[a(`addCreditsModal.configureAutoReload`),(0,E.jsx)(d,{className:`size-4`})]}),(0,E.jsx)(`div`,{className:`h-px w-full bg-[var(--border-subtle)]`})]})}),(0,E.jsxs)(y.Footer,{children:[(0,E.jsx)(y.Close,{asChild:!0,children:(0,E.jsx)(m,{variant:`outlined`,children:a(`addCreditsModal.cancel`)})}),(0,E.jsx)(m,{variant:`primary`,leftIcon:I.isPending?(0,E.jsx)(f,{className:`animate-spin`}):void 0,onClick:()=>{I.isPending||I.mutate({body:{amount:F,return_path:w,return_target:C()}},{onSuccess:e=>{h(e.checkout_url)}})},disabled:I.isPending||j||!A,children:a(`addCreditsModal.continue`)})]})]})})}function j(e){return S({open:e.open,path:x.settings.usageBilling,onClose:()=>e.onOpenChange(!1)})?null:(0,E.jsx)(A,{...e})}export{w as n,j as t};
1
+ import{o as e,r as t}from"./rolldown-runtime-BM3Ffeng.js";import{Kn as n,O as r,Un as i}from"./vendor-BdYt2Rah.js";import{b as a,d as o,g as s,n as c,t as l}from"./react-DPM_L_aA.js";import{Fr as u,Lr as d,tn as f}from"./icons-CSdHOix6.js";import{$l as p,Fy as m,Ku as h,Sl as g,oy as _,qu as v,vy as y,wl as b,yv as x}from"./index-BL1oo6fL.js";import{n as S}from"./android-billing-handoff-Ci3cShs0.js";import{t as C}from"./checkout-return-target-CKaCH8Dq.js";var w=t({AddCreditsModal:()=>j}),T=e(a(),1),E=l(),D=[`10.00`,`20.00`,`30.00`,`40.00`,`50.00`,`60.00`,`70.00`,`80.00`,`90.00`,`100.00`];function O(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 k(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 A({open:e,onOpenChange:t}){let{t:a}=r(),{pathname:l}=o(),[S]=s(),w=S.toString()?`${l}?${S.toString()}`:l,{data:A,isLoading:j}=n(g()),M=A?.allowed_top_up_amounts?.length?A.allowed_top_up_amounts:D,[N,P]=(0,T.useState)(null),F=N&&M.includes(N)?N:M[0]??D[0],I=i(b());return(0,T.useEffect)(()=>v(()=>{t(!1)}),[t]),p(`deeplink.billingCheckoutComplete`,({flow:e})=>{e===`top_up`&&t(!1)}),(0,E.jsx)(y.Root,{open:e,onOpenChange:t,children:(0,E.jsxs)(y.Content,{size:`sm`,children:[(0,E.jsxs)(y.Header,{children:[(0,E.jsx)(y.Title,{children:a(`addCreditsModal.title`)}),(0,E.jsx)(y.Description,{children:a(`addCreditsModal.description`)})]}),(0,E.jsx)(y.Body,{children:(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`label`,{htmlFor:`add-credits-amount`,className:`block text-body-small-default text-[var(--content-tertiary)]`,children:a(`addCreditsModal.amount`)}),(0,E.jsx)(_,{id:`add-credits-amount`,value:F,onChange:e=>{P(e),I.isError&&I.reset()},disabled:j||!A,options:M.map(e=>({value:e,label:O(e)}))})]}),I.isError&&(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,E.jsx)(u,{className:`h-3.5 w-3.5 shrink-0`}),k(I.error)]}),(0,E.jsxs)(c,{to:x.settings.usageBillingConfigureTopUps,className:`flex items-center gap-1 text-body-small-default text-[var(--content-tertiary)] hover:text-[var(--content-secondary)]`,onClick:()=>t(!1),children:[a(`addCreditsModal.configureAutoReload`),(0,E.jsx)(d,{className:`size-4`})]}),(0,E.jsx)(`div`,{className:`h-px w-full bg-[var(--border-subtle)]`})]})}),(0,E.jsxs)(y.Footer,{children:[(0,E.jsx)(y.Close,{asChild:!0,children:(0,E.jsx)(m,{variant:`outlined`,children:a(`addCreditsModal.cancel`)})}),(0,E.jsx)(m,{variant:`primary`,leftIcon:I.isPending?(0,E.jsx)(f,{className:`animate-spin`}):void 0,onClick:()=>{I.isPending||I.mutate({body:{amount:F,return_path:w,return_target:C()}},{onSuccess:e=>{h(e.checkout_url)}})},disabled:I.isPending||j||!A,children:a(`addCreditsModal.continue`)})]})]})})}function j(e){return S({open:e.open,path:x.settings.usageBilling,onClose:()=>e.onOpenChange(!1)})?null:(0,E.jsx)(A,{...e})}export{w as n,j as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{A as t,Kn as n,N as r,O as i,Un as a,Yn as o}from"./vendor-BdYt2Rah.js";import{b as s,t as c,y as l}from"./react-DPM_L_aA.js";import{Fr as u,J as d,mn as f,nn as p,qn as m,st as h,tn as g,v as _,x as v}from"./icons-CSdHOix6.js";import{t as y}from"./ellipsis-vertical-npNyglhR.js";import{$a as b,$d as x,$g as S,$u as C,Au as w,Bf as T,Bg as E,Bv as D,Cd as O,Cf as k,Du as A,Dv as j,Ey as M,Fh as N,Fs as P,Fu as F,Fy as I,Ga as L,Gf as R,Hf as ee,Ht as z,If as te,Iu as ne,Iy as B,Ja as re,Ka as V,Kf as ie,Kt as ae,Lf as oe,Lu as se,Lv as H,Mu as ce,My as le,Nu as U,Nv as W,Ou as ue,Oy as de,P as fe,Pu as pe,Py as G,Qd as me,Qg as K,Rf as he,Rg as ge,Ru as _e,Rv as ve,S_ as ye,Sd as be,Td as xe,Ty as Se,Ua as Ce,Uf as we,Vf as Te,Vp as Ee,Wa as De,Wf as Oe,Wt as ke,Xa as Ae,Xh as je,Ya as Me,Yv as Ne,Za as Pe,Zd as Fe,Zg as Ie,__ as Le,_h as Re,_t as ze,a_ as Be,ad as Ve,ah as He,ai as Ue,ao as We,at as Ge,av as Ke,b_ as qe,bp as Je,c_ as Ye,ct as Xe,d_ as Ze,df as Qe,dy as q,e_ as $e,ed as et,eo as tt,f_ as nt,ft as J,g_ as rt,gf as it,gt as at,gy as Y,h_ as ot,hy as st,i_ as ct,id as lt,ii as ut,io as dt,it as ft,ju as pt,ku as mt,ky as ht,l_ as gt,lt as _t,ly as vt,m_ as yt,mh as bt,mt as xt,n_ as St,nd as Ct,nt as wt,o_ as Tt,oo as Et,ot as Dt,oy as X,p_ as Ot,pp as kt,qa as At,qf as jt,qt as Mt,r_ as Nt,rd as Pt,ro as Ft,rt as It,s_ as Lt,so as Rt,st as zt,t_ as Bt,td as Vt,to as Ht,ty as Ut,u_ as Wt,uf as Gt,v_ as Kt,vh as qt,vy as Z,wd as Jt,wp as Yt,wy as Xt,x_ as Zt,xp as Qt,y_ as $t,zf as en,zg as tn}from"./index-hiaJ3JFk.js";import{i as nn,n as rn,r as an,t as on}from"./service-form-controls-BDCiSV7r.js";import{n as sn,t as cn}from"./detail-drawer-DhUr5YNx.js";import{a as ln}from"./schedules-BkH-2-mv.js";import{t as un}from"./stt-language-picker-modal-YaeF7QSu.js";var Q=e(s(),1);function dn(){let e=J();return(0,Q.useCallback)(async(t,n)=>{try{let{data:r}=await je({path:{assistant_id:e},body:{value:n,type:`api_key`,name:t},throwOnError:!0});Ie(r)}catch(e){throw e instanceof Error&&e.message===`No assistant found`?Y.error(r(`settings:useDaemonConfig.assistantNotReadyToast`)):Y.error(r(`settings:useDaemonConfig.saveApiKeyFailedToast`,{providerName:t})),j(e,{context:`provision_provider_key`}),e}},[e])}function fn(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 pn=`0.11.0`;function mn(){return Je(pn)}var $=c(),hn=`gemini-3.1-flash-image-preview`;function gn(){let{t:e}=i(`settings`),t=J(),r=o(),a=kt(),{data:s}=n({...C({path:{assistant_id:t}}),enabled:a,staleTime:3e4}),c=it({onSuccess:e=>{Vt(r,{path:{assistant_id:t}},e)}}),l=dn(),[u,d]=fn((0,Q.useMemo)(()=>{if(!s)return H(De,`gemini`);let e=s.services?.[`image-generation`];return e?.mode===`managed`?`vellum`:e?.provider||H(`vellum:ai:imageGenProvider`,`gemini`)},[s])),[f,p]=(0,Q.useState)(()=>H(Ce,hn)),m=dt(u),h=m.includes(f)?f:m[0]??hn,[_,v]=(0,Q.useState)(``),[y,x]=(0,Q.useState)(!1),S=tt.map(e=>({value:e,label:Ht[e]??e})),w=(0,Q.useMemo)(()=>dt(u).map(e=>({value:e,label:b[e]??e})),[u]),T=u===`gemini`||u===`openai`,{hasStoredCredential:E}=oe({assistantId:t,credentialKind:`api_key`,credentialName:u,enabled:T}),O=d,k=(0,Q.useCallback)(async()=>{x(!0);let n=_.trim(),i=T&&n.length>0;try{i&&await l(We(h),n),await Yt();let a=u===`vellum`&&!mn()?{mode:`managed`}:{provider:u,mode:u===`vellum`?`managed`:`your-own`};await c.mutateAsync({path:{assistant_id:t},body:{services:{"image-generation":a}}}).catch(t=>{throw Y.error(e(`imageGenerationCard.configUpdateFailedToast`)),j(t,{context:`patch_daemon_config`}),t});try{await N({path:{assistant_id:t},body:{modelId:h},throwOnError:!0})}catch(t){throw Y.error(e(`imageGenerationCard.modelUpdateFailedToast`)),j(t,{context:`set_image_gen_model`}),t}finally{r.invalidateQueries({queryKey:et({path:{assistant_id:t}})})}}catch{x(!1);return}x(!1);try{if(D(De,u),D(Ce,h),i){let e=te(t,`api_key`,u);r.setQueryData(e,!0),r.invalidateQueries({queryKey:e}),v(``)}Y.success(e(`imageGenerationCard.savedToast`))}catch(t){j(t,{context:`settings-ai-image-gen-persist-local`}),Y.error(e(`imageGenerationCard.localPreferencesFailedToast`))}},[_,u,T,h,t,c,l,r,e]),A=(0,Q.useCallback)(()=>{v(``),p(hn),D(Ce,hn)},[]);return(0,$.jsx)(nn,{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)(X,{"aria-label":e(`imageGenerationCard.providerAriaLabel`),value:u,onChange:O,options:S})]}),u===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`imageGenerationCard.vellumNote`)}),T&&(0,$.jsx)(M,{label:e(`imageGenerationCard.apiKeyLabel`),type:`password`,value:_,onChange:e=>v(e.target.value),placeholder:pe(e(u===`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)(X,{"aria-label":e(`imageGenerationCard.modelAriaLabel`),value:h,onChange:p,options:w})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(an,{onClick:k,disabled:y}),y&&(0,$.jsx)(g,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),T&&(0,$.jsx)(rn,{onClick:A})]})]})})}function _n({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)(G,{variant:`body-large-default`,as:`h3`,className:`text-[var(--content-secondary)]`,children:e}),t==null?null:(0,$.jsxs)(G,{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 vn(e){return e.scheduleNames.length>0||e.deferredReminderCount>0||e.scheduleLookupFailed}var yn=5;function bn({title:e,items:t,mono:n}){return(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(G,{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 xn(e){let t=e.label||e.name,n=[];e.isActive&&n.push(r(`settings:manageProfilesBlockedDeleteModal.clauseDefaultProfile`)),e.callSiteIds.length>0&&n.push(r(`settings:manageProfilesBlockedDeleteModal.clauseActionOverrides`,{count:e.callSiteIds.length}));let i=e.scheduleNames.length,a=e.deferredReminderCount;return i>0&&a>0?n.push(r(`settings:manageProfilesBlockedDeleteModal.clauseRunsBoth`,{schedules:i,reminders:a})):i>0?n.push(r(`settings:manageProfilesBlockedDeleteModal.clauseRunsSchedules`,{count:i})):a>0&&n.push(r(`settings:manageProfilesBlockedDeleteModal.clauseRunsReminders`,{count:a})),n.length===0?r(`settings:manageProfilesBlockedDeleteModal.summaryNoReferences`,{display:t}):n.length===1?r(`settings:manageProfilesBlockedDeleteModal.summaryOneClause`,{display:t,clause1:n[0]}):n.length===2?r(`settings:manageProfilesBlockedDeleteModal.summaryTwoClauses`,{display:t,clause1:n[0],clause2:n[1]}):r(`settings:manageProfilesBlockedDeleteModal.summaryThreeClauses`,{display:t,clause1:n[0],clause2:n[1],clause3:n[2]})}function Sn({blocked:e,availableReplacements:t,replacement:n,onReplacementChange:r,error:a,saving:o,onClose:s,onConfirm:c}){let{t:l}=i(`settings`),u=e?.scheduleNames??[],d=u.slice(0,yn),f=u.length-d.length,p=e!=null&&vn(e);return(0,$.jsx)(Z.Root,{open:e!==null,onOpenChange:e=>{e||s()},children:(0,$.jsxs)(Z.Content,{size:`sm`,children:[(0,$.jsx)(Z.Header,{children:(0,$.jsx)(Z.Title,{children:l(`manageProfilesBlockedDeleteModal.title`)})}),(0,$.jsxs)(Z.Body,{className:`space-y-4`,children:[e&&(0,$.jsx)(G,{variant:`body-medium-default`,as:`p`,children:xn(e)}),e&&e.callSiteIds.length>0&&(0,$.jsx)(bn,{title:l(`manageProfilesBlockedDeleteModal.actionOverridesTitle`),items:e.callSiteIds,mono:!0}),d.length>0&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(bn,{title:l(`manageProfilesBlockedDeleteModal.schedulesTitle`),items:d}),f>0&&(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`pl-1 text-(--content-tertiary)`,children:l(`manageProfilesBlockedDeleteModal.moreSchedules`,{count:f})})]}),e?.scheduleLookupFailed&&(0,$.jsx)(G,{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)(X,{"aria-label":l(`manageProfilesBlockedDeleteModal.replacementLabel`),value:n,onChange:r,placeholder:l(`manageProfilesBlockedDeleteModal.replacementPlaceholder`),options:t.map(e=>{let t=p&&e.status===`disabled`;return{value:e.name,label:Ge(e),disabled:t,tooltip:t?l(`manageProfilesBlockedDeleteModal.disabledTargetTooltip`):void 0}})})]}),a&&(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:a})]}),(0,$.jsxs)(Z.Footer,{children:[(0,$.jsx)(I,{variant:`ghost`,size:`compact`,onClick:s,children:l(`manageProfilesBlockedDeleteModal.cancel`)}),(0,$.jsx)(I,{variant:`primary`,size:`compact`,disabled:!n||o,onClick:c,children:l(o?`manageProfilesBlockedDeleteModal.saving`:`manageProfilesBlockedDeleteModal.reassignAndDelete`)})]})]})})}function Cn({profile:e,isActiveProfile:t,selected:n,connections:r,deletePending:a=!1,onOpen:o,onMakeActive:s,onSetStatus:c,onDelete:l}){let{t:d}=i(`settings`),f=e.source===`managed`,p=e.status===`disabled`,m=e.label??e.name,h=[];e.model&&h.push(w(e.provider??void 0,e.model,r)),f&&h.push(d(`profileRow.managedByVellum`));let g=e.availability,_=e.config_issue,v=_!=null||g?.status===`incomplete`,b=g?.message??d(`profileRow.providerUnavailableDefault`),x=_==null?g!=null&&g.status!==`ok`?v?d(`profileRow.providerUnavailableFixable`,{message:b}):b:null:d(`profileRow.providerUnavailableFixable`,{message:d(_.code===`over_output_cap`?`profileRow.configIssueOverOutputCap`:_.code===`no_input_room`?`profileRow.configIssueNoInputRoom`:`profileRow.configIssueModelUnknown`)});return(0,$.jsx)(Ne,{title:(0,$.jsx)(`span`,{className:p?`opacity-55`:void 0,children:m}),subtitle:h.length>0?h.join(` • `):void 0,onClick:o,showChevron:!1,selected:n,disabled:a,contentAriaLabel:d(`profileRow.openProfileAriaLabel`,{displayName:m}),trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[x==null?null:(0,$.jsx)(B,{content:x,children:v?(0,$.jsx)(`button`,{type:`button`,onClick:o,"aria-label":x,className:`inline-flex cursor-pointer rounded-sm p-0.5 keyboard-focus:ring-2 keyboard-focus:ring-[var(--ring)]`,children:(0,$.jsx)(u,{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)(u,{className:`h-4 w-4 text-[var(--system-mid-strong)]`,"aria-label":x,role:`img`})})}),p?(0,$.jsx)(ht,{tone:`neutral`,children:d(`profileRow.disabledTag`)}):null,t?(0,$.jsx)(ht,{tone:`positive`,children:d(`profileRow.defaultTag`)}):null,(0,$.jsxs)(q.Root,{children:[(0,$.jsx)(q.Trigger,{asChild:!0,children:(0,$.jsx)(I,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(y,{}),"aria-label":d(`profileRow.actionsAriaLabel`,{displayName:m}),disabled:a})}),(0,$.jsxs)(q.Content,{align:`end`,sideOffset:4,children:[(0,$.jsx)(q.Item,{onSelect:o,children:d(f?`profileRow.view`:`profileRow.edit`)}),!t&&!p?(0,$.jsx)(q.Item,{onSelect:s,children:d(`profileRow.makeDefault`)}):null,p?(0,$.jsx)(q.Item,{onSelect:()=>c(!0),children:d(`profileRow.enable`)}):f?null:(0,$.jsx)(q.Item,{onSelect:()=>c(!1),children:d(`profileRow.disable`)}),f?null:(0,$.jsx)(q.Item,{onSelect:l,className:vt.anchored,children:d(`profileRow.delete`)})]})]})]})})}function wn(e,t){let r=ut(),{data:i}=n({...be({path:{assistant_id:e}}),enabled:r,staleTime:3e4}),{profiles:a,profileOrder:o}=wt(t?.llm,e);return(0,Q.useMemo)(()=>i==null?{entries:K(a,o).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:i.profiles,isEffectiveCatalog:!0},[i,a,o])}var Tn=`0.10.8`;function En(e){return Qt(Tn,e)}var Dn=`settings-ai-profile-make-active`,On=`Failed to set the active profile. Please try again.`;function kn(e){let t=ue(),n=o(),r=En(e),i=k({onSuccess:()=>{n.invalidateQueries({queryKey:et({path:{assistant_id:e}})}),n.invalidateQueries({queryKey:O({path:{assistant_id:e}})})}});async function a(n,r,i){try{await t.mutateAsync({path:{assistant_id:e},body:{llm:n}})}catch(e){throw j(e,{context:r}),Y.error(i),e}}async function s(t){if(!r){await a({activeProfile:t},Dn,On);return}try{await i.mutateAsync({path:{assistant_id:e},body:{name:t}})}catch(e){let t=W(e);throw Y.error(t??On),t||j(e,{context:Dn}),e}}return{makeActive:s,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 An=`The profile was not deleted.`,jn=`Failed to move the schedules. ${An}`;function Mn(e){let t=W(e);return t?`${/[.!?]$/.test(t)?t:`${t}.`} ${An}`:jn}function Nn(e,t,n){let r=kn(e),i=o(),a=_t(),s=t?.llm?.activeProfile??null,c=t?.llm?.advisorProfile??null,l=t?.llm?.callSites??{},u=(0,Q.useMemo)(()=>t?.llm?.profiles??{},[t?.llm?.profiles]),d=(0,Q.useMemo)(()=>t?.llm?.profileOrder??[],[t?.llm?.profileOrder]),f=(0,Q.useMemo)(()=>K(u,d),[u,d]),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(null),C=(0,Q.useRef)(!1);function w(e){return f.filter(t=>t.name===e?!1:t.status===`disabled`?!0:It(t,f,{requireOwnProviderAndModel:a}))}function T(e,t){let n=w(e).filter(e=>!t||e.status!==`disabled`),r=n.find(e=>e.name===s),i=n.find(e=>e.source!==`managed`);return(r??i??n[0])?.name??``}async function E(e){try{await r.deleteProfile(e,d,{isAdvisor:e===c}),n?.onDeleted?.(e)}catch{}}async function D(t){let n=u[t]?.label??t,r=t===s,a=Object.entries(l).filter(([e,n])=>e!==`mainAgent`&&n?.profile===t).map(([e])=>e),o=[],c=0,d=!1;try{let n=(await i.fetchQuery({...Fe({path:{assistant_id:e},query:{inference_profile:t,include_all:`true`}}),retry:!1,staleTime:0})).schedules??[];o=n.filter(e=>!e.isDeferred).map(e=>e.name),c=n.filter(e=>e.isDeferred).length}catch(e){j(e,{context:`settings-ai-profile-delete-schedule-scan`}),d=!0}if(!(r||a.length>0||o.length>0||c>0)&&!d){await E(t);return}let f={name:t,label:n,isActive:r,callSiteIds:a,scheduleNames:o,deferredReminderCount:c,scheduleLookupFailed:d};m(f),v(T(t,vn(f))),g(null)}function O(e){t==null||C.current||(C.current=!0,S(e),D(e).finally(()=>{C.current=!1,S(null)}))}async function k(){if(!p||!_)return;if(b(!0),g(null),vn(p))try{await ln(e,p.name,_),await i.invalidateQueries({queryKey:me({path:{assistant_id:e}})})}catch(e){j(e,{context:`settings-ai-profile-reassign-schedules`}),g(Mn(e)),b(!1);return}let t={};if(p.isActive&&(t.activeProfile=_),p.callSiteIds.length>0){let e={};for(let t of p.callSiteIds)e[t]={profile:_};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{g(`Failed to reassign references. Please try again.`),b(!1);return}let n=p.name;m(null),b(!1),E(n)}return{requestDelete:O,pendingDeleteName:x,blockedDeleteModalProps:{blocked:p,availableReplacements:w(p?.name??null),replacement:_,onReplacementChange:v,error:h,saving:y,onClose:()=>{m(null),g(null)},onConfirm:()=>void k()}}}function Pn(){}function Fn({assistantId:e,config:t,connections:n,selectedProfileName:r,onOpenProfile:a,onCreateProfile:o,onProfileDeleted:s}){let{t:c}=i(`settings`),{entries:l}=wn(e,t),u=kn(e),d=Nn(e,t,{onDeleted:s}),f=t?.llm?.activeProfile??null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_n,{title:c(`profilesSection.title`),action:(0,$.jsx)(I,{variant:`primary`,onClick:o,leftIcon:(0,$.jsx)(h,{}),disabled:t==null,children:c(`profilesSection.createProfile`)}),children:t==null?(0,$.jsx)(G,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:c(`profilesSection.loading`)}):l.length===0?(0,$.jsx)(G,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:c(`profilesSection.emptyState`)}):l.map(e=>(0,$.jsx)(Cn,{profile:e,isActiveProfile:e.name===f,selected:e.name===r,connections:n,deletePending:d.pendingDeleteName===e.name,onOpen:()=>a(e.name),onMakeActive:()=>void u.makeActive(e.name).catch(Pn),onSetStatus:t=>void u.setStatus(e.name,t).catch(Pn),onDelete:()=>d.requestDelete(e.name)},e.name))}),(0,$.jsx)(Sn,{...d.blockedDeleteModalProps})]})}var In={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 Ln(e){return e in In}function Rn(e){if(!e.baseUrl)return null;try{return new URL(e.baseUrl).host}catch{return e.baseUrl}}function zn(e){let t=Rn(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 Bn(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 Vn(e){if(e.provider===`vellum`)return`Included with your plan`;if(e.provider===`openai-compatible`)return zn(e);let t=[];if(e.provider===`ollama`||e.provider===`opencode`){let n=Rn(e);n&&t.push(n)}let n=e.provider===`chatgpt`?`openai`:e.provider,r=e.auth.type===`oauth_subscription`?ge(n):Zt(n),i=e.models?.length??r.length;i>0&&t.push(`${i} ${i===1?`model`:`models`}`);let a=Bn(e);return a&&t.push(a),t.join(` • `)}function Hn({connection:e,isDefault:t,supportsDefaultProvider:n,selected:r,isSettingDefault:a,onOpen:o,onSetDefault:s,onDelete:c}){let{t:l}=i(`settings`),u=e.isManaged??!1,d=Oe(e),f=Ln(e.provider),p=Vn(e),m=n&&!t&&f,h=!u&&o!=null,g=!u&&!t,_=m||h||g;return(0,$.jsx)(Ne,{title:d,subtitle:p.length>0?p:void 0,onClick:o,showChevron:!1,selected:r,contentAriaLabel:o?l(`providerRow.openProviderAriaLabel`,{displayName:d}):void 0,trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsx)(ht,{tone:`neutral`,title:l(`providerRow.managedTagTitle`),children:l(`providerRow.managedTag`)}):null,t?(0,$.jsx)(ht,{tone:`info`,title:l(`providerRow.defaultTagTitle`),children:l(`providerRow.defaultTag`)}):null,e.provider===`ollama`?(0,$.jsx)(ht,{tone:`neutral`,title:l(`providerRow.localTagTitle`),children:l(`providerRow.localTag`)}):null,e.provider===`openai-compatible`?(0,$.jsx)(ht,{tone:`neutral`,title:l(`providerRow.customTagTitle`),children:l(`providerRow.customTag`)}):null,_?(0,$.jsxs)(q.Root,{children:[(0,$.jsx)(q.Trigger,{asChild:!0,children:(0,$.jsx)(I,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(y,{}),"aria-label":l(`providerRow.actionsAriaLabel`,{displayName:d})})}),(0,$.jsxs)(q.Content,{align:`end`,sideOffset:4,children:[h?(0,$.jsx)(q.Item,{onSelect:o,children:l(`providerRow.edit`)}):null,m?(0,$.jsx)(q.Item,{disabled:a,onSelect:s,children:l(`providerRow.setAsDefault`)}):null,g?(0,$.jsx)(q.Item,{onSelect:c,className:vt.anchored,children:l(`providerRow.delete`)}):null]})]}):(0,$.jsx)(`span`,{className:`inline-block w-8`,"aria-hidden":!0})]})})}function Un(e,t){let n=o(),i={path:{assistant_id:e}},s=a({...Ve(),onSuccess:()=>{n.invalidateQueries({queryKey:lt(i)}),n.invalidateQueries({queryKey:et(i)}),n.invalidateQueries({queryKey:O(i)})},onError:e=>{j(e,{context:`settings-ai-set-default-provider`}),Y.error(r(`settings:useProviderActions.setDefaultFailedToast`))}});function c(t){Ln(t.provider)&&s.mutate({path:{assistant_id:e},body:{provider:t.provider,connectionName:t.name}})}function l(e){return s.isPending&&s.variables?.body?.connectionName===e}async function u(a){try{let{response:o}=await Re({path:{assistant_id:e,name:a}});o?.ok||o?.status===404?(n.invalidateQueries({queryKey:xe(i)}),t?.onDeleted?.(a)):o?.status===409?Y.error(r(`settings:useProviderActions.deleteInUseToast`)):Y.error(r(`settings:useProviderActions.deleteFailedToast`))}catch(e){j(e,{context:`settings-ai-provider-delete`}),Y.error(r(`settings:useProviderActions.deleteFailedToast`))}}return{setDefault:c,isSettingDefault:l,deleteConnection:u}}function Wn({assistantId:e,selectedConnectionName:t,onOpenConnection:r,onAddProvider:a,onConnectionDeleted:o}){let{t:s}=i(`settings`),{data:c,isLoading:l,isError:u}=n(Jt({path:{assistant_id:e}})),d=Ue(),{data:f}=n({...Pt({path:{assistant_id:e}}),enabled:d}),p=d?f?.resolvedConnectionName??null:null,m=Un(e,{onDeleted:o}),g=(0,Q.useMemo)(()=>{let e=c?.connections??[];return[...e.filter(e=>e.provider===Le),...e.filter(e=>e.provider!==Le)]},[c]);return(0,$.jsx)(_n,{title:s(`providersSection.title`),action:(0,$.jsx)(I,{variant:`outlined`,onClick:a,leftIcon:(0,$.jsx)(h,{}),children:s(`providersSection.addProvider`)}),children:l?(0,$.jsx)(`div`,{className:`space-y-2 py-2`,children:[1,2,3].map(e=>(0,$.jsx)(Ut,{className:`h-10 rounded-lg`},e))}):u?(0,$.jsx)(G,{variant:`body-medium-default`,as:`p`,className:`py-4 text-center text-(--system-negative-strong)`,children:s(`providersSection.loadError`)}):g.length===0?(0,$.jsx)(G,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:s(`providersSection.empty`)}):g.map(e=>(0,$.jsx)(Hn,{connection:e,isDefault:e.name===p,supportsDefaultProvider:d,selected:e.name===t,isSettingDefault:m.isSettingDefault(e.name),onOpen:e.isManaged??!1?void 0:()=>r(e.name),onSetDefault:()=>m.setDefault(e),onDelete:()=>void m.deleteConnection(e.name)},e.name))})}function Gn({panel:e,onOpenPanel:t,onClosePanel:r}){let{t:a}=i(`settings`),o=J(),{data:s}=n({...C({path:{assistant_id:o}}),staleTime:3e4}),c=Ue(),{data:l}=n({...Pt({path:{assistant_id:o}}),enabled:c}),u=l?.availability,{data:d}=n({...Jt({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)(nn,{title:a(`languageModelCard.title`),subtitle:a(`languageModelCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[u&&u.status!==`ok`&&(0,$.jsx)(le,{tone:u.status===`unknown`?`warning`:`error`,children:u.message??a(`languageModelCard.defaultProviderUnavailable`)}),o&&(0,$.jsx)(Fn,{assistantId:o,config:s,connections:f,selectedProfileName:e?.kind===`profile`?e.name:null,onOpenProfile:e=>t({kind:`profile`,name:e}),onCreateProfile:()=>t({kind:`create-profile`}),onProfileDeleted:t=>{e?.kind===`profile`&&e.name===t&&r()}}),o&&(0,$.jsx)(Wn,{assistantId:o,selectedConnectionName:e?.kind===`provider`?e.name:null,onOpenConnection:e=>t({kind:`provider`,name:e}),onAddProvider:()=>t({kind:`add-provider`}),onConnectionDeleted:t=>{e?.kind===`provider`&&e.name===t&&r()}}),(0,$.jsx)(_n,{title:a(`languageModelCard.overridesTitle`),count:m,action:(0,$.jsx)(I,{variant:`outlined`,onClick:()=>t({kind:`overrides`}),children:a(`languageModelCard.manage`)})})]})})}function Kn({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)(m,{className:`h-3.5 w-3.5`})]})}function qn(){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)(f,{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)(t,{i18nKey:`managedServicesBanner.body`,ns:`common`,components:{link:(0,$.jsx)(Kn,{})}})})]})}function Jn({assistantId:e,profileName:t,onClose:r}){let{t:a}=i(`settings`),{data:o}=n({...C({path:{assistant_id:e}}),staleTime:3e4}),{data:s}=n({...Jt({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(t==null)return;let e=l[t];return e?{name:t,...e}:void 0},[t,l]),f=t==null?`create`:d?.source===`managed`||d?.invariant===!0?`view`:`edit`,{saveProfile:p,isPending:m}=A(e,{onSaved:r}),h=mt({mode:f,profileName:t??void 0,initialValues:d,existingNames:u,connections:c,assistantId:e,onSave:p}),_=Nn(e,o,{onDeleted:()=>r()}),y=t!=null&&_.pendingDeleteName===t,b=t!=null&&o!=null&&!(t in l);(0,Q.useEffect)(()=>{b&&!h.saving&&!m&&r()},[b,h.saving,m,r]);let x=f===`view`;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(fe,{title:h.effectiveMode===`create`?a(`profileDetailPanel.createTitle`):d?.label??t??a(`profileDetailPanel.defaultTitle`),closeVariant:`outlined`,onClose:r,headerTrailing:x&&h.effectiveMode!==`create`?(0,$.jsx)(ht,{tone:`neutral`,children:a(`profileDetailPanel.managedTag`)}):null,headerActions:h.effectiveMode!==`create`&&!h.isReadOnly?(0,$.jsx)(I,{variant:`dangerOutline`,iconOnly:y?(0,$.jsx)(g,{className:`animate-spin`}):(0,$.jsx)(v,{}),"aria-label":a(y?`profileDetailPanel.deleting`:`profileDetailPanel.delete`),tooltip:a(`profileDetailPanel.delete`),onClick:()=>{t!=null&&_.requestDelete(t)},disabled:h.saving||y}):null,footer:h.isReadOnly?(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(I,{variant:`outlined`,onClick:h.switchToSaveAsNew,disabled:h.saving,children:a(`profileDetailPanel.saveAsNew`)}),h.hasViewModeChanges?(0,$.jsx)(I,{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)(I,{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)(pt,{editor:h,assistantId:e,connections:c,variant:`panel`})}),(0,$.jsx)(Sn,{..._.blockedDeleteModalProps})]})}function Yn({value:e,profileOptions:t,disabled:n,onChange:r}){let{t:a}=i(`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:a(`advisorProfileRow.title`)}),(0,$.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:a(`advisorProfileRow.description`)})]}),(0,$.jsx)(X,{value:e,onChange:r,options:t,placeholder:a(`advisorProfileRow.chooseProfilePlaceholder`),className:`w-44`,menuMinWidth:280,menuAlign:`start`,disabled:n})]})})}var Xn=`__custom__`;function Zn(e){return e?!!(e.profile||e.provider||e.model):!1}function Qn(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 $n(e,t){let n=Zn(e);return n===Zn(t)?n?(e?.profile??null)===(t?.profile??null)&&(e?.provider??null)===(t?.provider??null)&&(e?.model??null)===(t?.model??null):!0:!1}function er({assistantId:e,callSites:t,domains:n,persistedOverrides:r,orderedProfiles:a,onClose:o,onApplied:s}){let{t:c}=i(`settings`),l=ue(),u=_t(),d=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:u}),[u]),f=(0,Q.useMemo)(()=>{let e=new Map;for(let n of t){let t=Qn(n,r[n.id]);t&&e.set(n.id,t)}return e},[t,r]),p=(0,Q.useMemo)(()=>{let e=new Set(Array.from(f.values(),e=>e.profile));return a.filter(t=>e.has(t.name))},[a,f]),[m,h]=(0,Q.useState)(()=>p[0]?.name??``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(new Set),[x,S]=(0,Q.useState)(!1),C=(0,Q.useMemo)(()=>{let e=new Map(n.map(e=>[e.id,e.displayName]));return t=>e.get(t)??t},[n]),w=(0,Q.useMemo)(()=>t.filter(e=>f.get(e.id)?.profile===m),[t,f,m]),T=(0,Q.useMemo)(()=>w.map(e=>e.id).filter(e=>!y.has(e)),[w,y]),E=(0,Q.useMemo)(()=>p.map(e=>({value:e.name,label:Ge(e)})),[p]),D=(0,Q.useMemo)(()=>Xe(a,[],d).filter(e=>e.name!==m).map(e=>({value:e.name,label:Ge(e)})),[a,m,d]),O=Bt(a,m),k=Bt(a,_),A=y.size===0;function M(e){h(e),b(new Set),e===_&&v(``)}function N(e,t){b(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})}async function P(){if(!(!m||!_||T.length===0)){S(!0);try{let t={};for(let e of T)t[e]={profile:_};await l.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:t}}}),Y.success(c(`bulkOverrideSwapModal.successToast`,{count:T.length,targetLabel:k})),s(),o()}catch(e){let t=W(e);Y.error(t??c(`bulkOverrideSwapModal.updateFailedToast`)),t||j(e,{context:`settings-ai-bulk-override-swap`})}finally{S(!1)}}}return(0,$.jsx)(Z.Root,{open:!0,onOpenChange:e=>{e||o()},children:(0,$.jsxs)(Z.Content,{size:`md`,children:[(0,$.jsx)(Z.Header,{children:(0,$.jsx)(Z.Title,{children:c(`bulkOverrideSwapModal.title`)})}),(0,$.jsxs)(Z.Body,{className:`space-y-4`,children:[(0,$.jsx)(G,{variant:`body-medium-default`,as:`p`,children:c(`bulkOverrideSwapModal.intro`)}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(X,{id:`bulk-swap-source`,label:c(`bulkOverrideSwapModal.currentlyUsingLabel`),value:m,onChange:M,options:E}),(0,$.jsx)(X,{id:`bulk-swap-target`,label:c(`bulkOverrideSwapModal.changeToLabel`),value:_,onChange:v,options:D,placeholder:c(`bulkOverrideSwapModal.targetPlaceholder`)})]}),(0,$.jsx)(le,{tone:`info`,title:c(`bulkOverrideSwapModal.noticeTitle`),children:c(`bulkOverrideSwapModal.noticeBody`,{sourceLabel:O})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(G,{variant:`body-medium-default`,as:`p`,children:c(`bulkOverrideSwapModal.affectedSummary`,{count:w.length,profile:O})}),(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`text-[color:var(--content-secondary)]`,children:c(`bulkOverrideSwapModal.chooseActions`)})]}),(0,$.jsx)(I,{variant:`ghost`,onClick:()=>b(A?new Set(w.map(e=>e.id)):new Set),children:c(A?`bulkOverrideSwapModal.clearAll`:`bulkOverrideSwapModal.selectAll`)})]}),(0,$.jsx)(`div`,{className:`max-h-72 space-y-1 overflow-y-auto`,children:w.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)(Xt,{checked:!y.has(e.id),onCheckedChange:t=>N(e.id,t===!0),disabled:x,label:e.displayName,helperText:C(e.domain)}),(0,$.jsx)(`span`,{className:`shrink-0 text-body-small-default text-[color:var(--content-tertiary)]`,children:f.get(e.id)?.via===`override`?c(`bulkOverrideSwapModal.viaOverride`):c(`bulkOverrideSwapModal.viaDefault`)})]},e.id))})]})]}),(0,$.jsxs)(Z.Footer,{children:[(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`mr-auto self-center text-[color:var(--content-secondary)]`,children:c(`bulkOverrideSwapModal.willChange`,{count:T.length})}),(0,$.jsx)(I,{variant:`ghost`,onClick:o,disabled:x,children:c(`bulkOverrideSwapModal.cancel`)}),(0,$.jsx)(I,{variant:`primary`,disabled:!m||!_||T.length===0||x,onClick:()=>void P(),children:x?(0,$.jsx)(g,{className:`h-4 w-4 animate-spin`}):c(`bulkOverrideSwapModal.applyTo`,{count:T.length})})]})]})})}function tr({id:e,displayName:t,description:n,defaultProfileLabel:r,draft:a,profileOptions:o,connections:s,onDraftChange:c,onToggle:l}){let{t:u}=i(`settings`),d=E.use.settingsDeveloperNav(),f=Zn(a),p=!a||!f?``:a.provider||a.model?Xn:a.profile??``,m=p===Xn,h=T(),g=he(),_=(s??[]).some(e=>e.provider===ot),v=[...rt,..._?[ot]:[]],y=h[0]??rt[0],b=a?.provider,x=Kt(b)?b:b===`chatgpt`?ot:void 0,S=x!==void 0&&v.some(e=>e===x),C=x??y,w=tn(C,``,(s??[]).filter(e=>en(e.provider,C)))?ge(C):ye(C,d),D=w.map(e=>({value:e.id,label:e.displayName})),O=typeof a?.model==`string`?a.model:``;if(O&&!w.some(e=>e.id===O)){let e=Zt(C).find(e=>e.id===O)?.displayName??O;D.push({value:O,label:u(`callSiteOverridesRow.unavailableOption`,{name:e})})}let k=!!a?.provider&&!a?.model,A=[...v.map(e=>({value:e,label:$t[e]??e,...g(e)})),...x&&!S?[{value:x,label:u(`callSiteOverridesRow.unavailableOption`,{name:$t[x]??x})}]:[]];function j(t){t===`__custom__`?c(e,{profile:null,provider:y,model:qe(y)??``}):t===``?c(e,null):c(e,{profile:t,provider:null,model:null})}function M(t){let n=qe(t)??``;c(e,{...a??{},profile:null,provider:t,model:n})}function N(t){c(e,{...a??{},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:u(`callSiteOverridesRow.defaultProfileSuffix`,{label:r})})]})]}),(0,$.jsx)(Se,{checked:f,onChange:t=>l(e,t),"aria-label":u(`callSiteOverridesRow.overrideAriaLabel`,{displayName:t}),className:`shrink-0`})]}),f&&(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(X,{value:p,onChange:j,options:o,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:u(`callSiteOverridesRow.providerLabel`)}),(0,$.jsx)(X,{value:C??``,onChange:M,options:A})]}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:u(`callSiteOverridesRow.modelLabel`)}),(0,$.jsx)(X,{value:a?.model??``,onChange:N,options:D})]})]}),k&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:u(`callSiteOverridesRow.pickModelError`)})]})]})}function nr({groups:e,drafts:t,buildProfileOptionsForRow:n,profileLabelFor:r,advisorMatchesSearch:a,connections:o,onDraftChange:s,onToggle:c}){let{t:l}=i(`settings`);return(0,$.jsx)(`div`,{className:`space-y-4`,children:e.length===0?a?null:(0,$.jsx)(`p`,{className:`py-8 text-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:l(`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||!Zn(n)?``:n.provider||n.model?Xn:n.profile??``})(),a=e.shippedDefaultProfile??e.defaultProfile,l=a?r(a):null;return(0,$.jsx)(tr,{id:e.id,displayName:e.displayName,description:e.description,defaultProfileLabel:l,draft:t[e.id]??null,profileOptions:n(i===``||i===`__custom__`?null:i),connections:o,onDraftChange:s,onToggle:c},e.id)})})]},e.id))})}function rr(e,t){let n={};for(let r of Object.keys(e)){let i=e[r]??null;Zn(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 ir(e){let t={};for(let n of Object.keys(e))t[n]=null;return t}function ar({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(!$n(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=>Zn(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)(()=>rr(c,i),[c,i]),buildResetPatch:(0,Q.useCallback)(()=>ir(c),[c])}}function or({assistantId:e,onClose:t}){let{t:r}=i(`settings`),{data:a}=n({...C({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)(()=>K(o,s),[o,s]),f=T(),p=_t(),m=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:p}),[p]),h=ue(),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),[w,E]=(0,Q.useState)(!1),{data:D,isLoading:O,isError:k,refetch:A}=n({...Ct({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4,refetchOnWindowFocus:!1}),{data:N}=n({...Jt({path:{assistant_id:e}}),enabled:!!e}),P=(0,Q.useMemo)(()=>(D?.callSites??[]).filter(e=>e.id!==`mainAgent`),[D]),F=!O&&!k&&!!D,L=!!a,R=F&&L,ee=(0,Q.useMemo)(()=>P.map(e=>e.id),[P]),z=a?.llm?.advisorProfile??``,{drafts:te,advisorProfile:ne,advisorDirty:B,callSiteDraftsDirty:re,hasUnsavedDrafts:V,hasValidationError:ie,setDraft:ae,setAdvisor:oe,clearEdits:se,buildSavePatch:H,buildResetPatch:ce}=ar({catalogCallSiteIds:ee,persistedOverrides:c,persistedAdvisor:z,isSeeded:R}),le=(0,Q.useMemo)(()=>new Set(ee),[ee]),U=(0,Q.useCallback)(e=>Bt(l,e),[l]),W=(0,Q.useCallback)(e=>({value:e.name,label:Ge(e),...ft(e,l,m)===`undispatchable`?{icon:(0,$.jsx)(u,{className:`h-3.5 w-3.5 text-[var(--system-mid-strong)]`}),tooltip:zt(e)}:{}}),[l,m]),de=(0,Q.useMemo)(()=>Xe(l,[z],m).map(W),[l,z,W,m]),pe=(0,Q.useMemo)(()=>{let e=_.trim().toLowerCase();return e===``||`advisor`.includes(e)||`second opinion`.includes(e)},[_]),G=(0,Q.useMemo)(()=>P.some(e=>Qn(e,c[e.id])!==null),[P,c]),me=(0,Q.useMemo)(()=>Object.entries(c).some(([e,t])=>le.has(e)&&(t?.profile!=null||t?.provider!=null||t?.model!=null)),[c,le]),he=(0,Q.useCallback)(e=>[...Xe(l,[e],m).map(W),{value:Xn,label:r(`overridesDetailPanel.customProfileOption`)}],[l,W,m,r]),ge=(0,Q.useMemo)(()=>{if(!_.trim())return P;let e=_.toLowerCase();return P.filter(t=>(t.displayName??``).toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e)||(t.domain??``).toLowerCase().includes(e))},[P,_]),_e=(0,Q.useMemo)(()=>{if(!D)return[];let e=D.domains.map(e=>e.id),t=new Map(D.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 i=new Set(e),a=ge.filter(e=>!i.has(e.domain));return a.length>0&&n.push({domain:{id:`other`,displayName:r(`overridesDetailPanel.otherDomain`)},sites:a}),n},[D,ge,r]),ve=(0,Q.useCallback)((e,t)=>{if(!t){ae(e,null);return}let n=Dt(l,P.find(t=>t.id===e)?.defaultProfile,m);if(n)ae(e,{profile:n});else{let t=f[0]??rt[0];ae(e,{provider:t,model:qe(t)??``})}},[P,l,f,ae,m]),ye=(0,Q.useCallback)(async()=>{b(!0);try{let n=H();await h.mutateAsync({path:{assistant_id:e},body:{llm:{...re?{callSites:n}:{},...B?{advisorProfile:ne}:{}}}}),t(),Y.success(r(`overridesDetailPanel.overridesSavedToast`))}catch(e){Y.error(r(`overridesDetailPanel.saveFailedToast`)),j(e,{context:`call_site_overrides_save`})}finally{b(!1)}},[H,re,B,ne,t,h,e,r]),be=(0,Q.useCallback)(async()=>{b(!0);try{let n=ce();await h.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:n}}}),t(),Y.success(r(`overridesDetailPanel.overridesResetToast`))}catch(e){Y.error(r(`overridesDetailPanel.resetFailedToast`)),j(e,{context:`call_site_overrides_reset`})}finally{b(!1)}},[ce,t,h,e,r]),xe=(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[me&&(0,$.jsx)(I,{variant:`outlined`,onClick:()=>S(!0),disabled:y||!R,tintColor:`var(--system-negative-strong)`,className:`mr-auto`,children:r(`overridesDetailPanel.resetToDefaults`)}),(0,$.jsx)(I,{variant:`primary`,onClick:()=>void ye(),disabled:!V||ie||y,children:y?(0,$.jsx)(g,{className:`h-4 w-4 animate-spin`}):r(`overridesDetailPanel.save`)})]});return(0,$.jsxs)(fe,{title:r(`overridesDetailPanel.title`),closeVariant:`outlined`,onClose:t,footer:xe,children:[(0,$.jsx)(`p`,{className:`mb-4 text-body-medium-lighter text-[var(--content-tertiary)]`,children:r(`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)(M,{type:`search`,value:_,onChange:e=>v(e.target.value),placeholder:r(`overridesDetailPanel.searchPlaceholder`),leftIcon:(0,$.jsx)(d,{className:`h-4 w-4`}),fullWidth:!0})}),(0,$.jsx)(I,{variant:`outlined`,onClick:()=>E(!0),disabled:!R||y||V||!G,title:V?r(`overridesDetailPanel.bulkChangeUnsavedTitle`):G?void 0:r(`overridesDetailPanel.bulkChangeNoCandidatesTitle`),children:r(`overridesDetailPanel.bulkChange`)})]}),L&&pe&&(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:r(`overridesDetailPanel.advisorSection`)}),(0,$.jsx)(Yn,{value:ne,profileOptions:de,disabled:y,onChange:oe})]}),O&&(0,$.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,$.jsx)(g,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`})}),k&&(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:r(`overridesDetailPanel.loadErrorTitle`)}),(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:r(`overridesDetailPanel.loadErrorHint`)}),(0,$.jsx)(I,{variant:`outlined`,onClick:()=>void A(),children:r(`overridesDetailPanel.retry`)})]}),!O&&!k&&D&&(0,$.jsx)(nr,{groups:_e,drafts:te,buildProfileOptionsForRow:he,profileLabelFor:U,advisorMatchesSearch:pe,connections:N?.connections,onDraftChange:ae,onToggle:ve})]}),w&&D&&(0,$.jsx)(er,{assistantId:e,callSites:P,domains:D.domains,persistedOverrides:c,orderedProfiles:l,onClose:()=>E(!1),onApplied:se}),(0,$.jsx)(st,{open:x,title:r(`overridesDetailPanel.resetToDefaults`),message:r(`overridesDetailPanel.resetConfirmMessage`),confirmLabel:r(`overridesDetailPanel.resetToDefaults`),destructive:!0,onConfirm:()=>{S(!1),be()},onCancel:()=>S(!1)})]})}var sr=e(l(),1);function cr({mode:e,connection:n,assistantId:r,existingNames:a,connections:s,variant:c=`modal`,actionsSlot:l,onSave:u,onCancel:d}){let{t:f}=i(`settings`),[p,m]=(0,Q.useState)(n?.label??``),h=n?.name??``,g=n?.provider??`anthropic`,_=n?.auth.type??`api_key`,[v,y]=(0,Q.useState)(()=>n?.auth.type===`api_key`?n.auth.credential:n?``:`credential/anthropic/api_key`),[b,S]=(0,Q.useState)(n?.baseUrl??``),[C,w]=(0,Q.useState)(()=>n?.models?n.models.map(e=>e.id).join(`, `):``),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(null),k=g===`openai-compatible`,A=we(g),j=R(g),[N,P]=(0,Q.useState)(``),[L,z]=(0,Q.useState)(!1),B=o(),re=(0,Q.useMemo)(()=>ee(v),[v]),V=_===`api_key`&&re!==null,{hasStoredCredential:ae,isLoading:H}=oe({assistantId:r,credentialKind:`credential`,credentialName:re?`${re.service}:${re.field}`:``,enabled:V}),{credentials:le}=U({assistantId:r,enabled:_===`api_key`});(0,Q.useEffect)(()=>{let e=n?.provider??`anthropic`;m(n?.label??``),n?.auth.type===`api_key`?y(n.auth.credential):y(n?``:`credential/${e}/api_key`),O(null),S(n?.baseUrl??``),w(n?.models?n.models.map(e=>e.id).join(`, `):``),P(``),z(!1)},[n]);let W=p.trim()!==(n?.label??``).trim(),ue=k&&W?se(p,s,n?.name):null,de=h.trim().length>0&&ue===null;async function fe(){if(de){E(!0),O(null);try{let e;if(_===`api_key`){let t=v.trim()||`credential/${g}/api_key`,n=N.trim();if(n){z(!0);try{let e=ee(t);await je({path:{assistant_id:r},body:e?{type:`credential`,name:`${e.service}:${e.field}`,value:n}:{type:`api_key`,name:g,value:n},throwOnError:!0});let i=te(r,`credential`,e?`${e.service}:${e.field}`:``);B.setQueryData(i,!0),B.invalidateQueries({queryKey:x({path:{assistant_id:r}})})}catch{O(f(`providerEditorContent.failedSaveApiKey`));return}finally{z(!1)}}e={type:`api_key`,credential:t}}else if(n)e=n.auth;else{O(f(`providerEditorContent.nothingToEdit`));return}let t=p.trim()||null,i={auth:e,label:t,...A&&{base_url:b.trim()||null},...j&&{models:C.trim()?C.split(`,`).map(e=>({id:e.trim()})).filter(e=>e.id):null}},{data:a,error:o,response:s}=await qt({path:{assistant_id:r,name:n?.name??h.trim()},body:i});if(!s?.ok){O(ie(s?.status,o)??Te(s?.status));return}if(!a){O(f(`providerEditorContent.emptyServerResponse`));return}jt(a,f),u(a)}catch{O(f(`providerEditorContent.failedSaveProvider`))}finally{E(!1)}}}let me=le.filter(e=>e.service===g),K=e!==`create`&&n?.auth.type===`api_key`,he=me.length>0||K,ge=pe(f(`providerEditorContent.apiKeyPlaceholder`),ae);if(e===`create`)return(0,$.jsx)(ce,{variant:c===`panel`?`inline`:`modal`,actionsSlot:l,assistantId:r,existingNames:a,connections:s,defaultProviderType:g,onCreated:u,onCancel:d});let ve=(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)(t,{i18nKey:`providerEditorContent.displayNameLabel`,ns:`settings`,components:{optional:(0,$.jsx)(`span`,{className:`text-[var(--content-disabled)]`})}})}),(0,$.jsx)(M,{value:p,onChange:e=>m(e.target.value),placeholder:f(`providerEditorContent.displayNamePlaceholder`),fullWidth:!0}),ue?(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:ne[ue]}):null]}),A&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:f(`providerEditorContent.baseUrlLabel`)}),(0,$.jsx)(M,{value:b,onChange:e=>S(e.target.value),placeholder:f(g===`ollama`?`providerEditorContent.baseUrlPlaceholderOllama`:g===`opencode`?`providerEditorContent.baseUrlPlaceholderOpencode`:`providerEditorContent.baseUrlPlaceholder`),fullWidth:!0}),g===`ollama`?(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:f(`providerEditorContent.baseUrlHintOllama`)}):null,g===`opencode`?(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:f(`providerEditorContent.baseUrlHintOpencode`)}):null]}),j&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:f(`providerEditorContent.modelsLabel`)}),(0,$.jsx)(M,{value:C,onChange:e=>w(e.target.value),placeholder:f(`providerEditorContent.modelsPlaceholder`),fullWidth:!0}),(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:f(`providerEditorContent.modelsHint`)})]}),_===`api_key`&&(0,$.jsx)(F,{apiKeyValue:N,onApiKeyChange:P,credential:v,onCredentialChange:y,isLoadingCredential:H,apiKeyPlaceholder:ge,provider:g,providerCredentials:me,showAdvancedSection:he,onError:O}),_===`oauth_subscription`&&(0,$.jsx)(_e,{assistantId:r,onConnected:u}),D&&(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:D})]}),ye=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{variant:`ghost`,onClick:d,children:f(`providerEditorContent.cancel`)}),(0,$.jsx)(I,{variant:`primary`,disabled:!de||T||L,onClick:()=>void fe(),children:f(T?`providerEditorContent.saving`:`providerEditorContent.saveChanges`)})]});return c===`panel`?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[ve,l===void 0?(0,$.jsx)(`div`,{className:`flex justify-end gap-2`,children:ye}):l&&(0,sr.createPortal)(ye,l)]}):(0,$.jsxs)(Z.Content,{size:`md`,children:[(0,$.jsxs)(Z.Header,{children:[(0,$.jsx)(Z.Title,{children:f(`providerEditorContent.editProviderTitle`)}),(0,$.jsx)(Z.Description,{children:n?f(`providerEditorContent.editingConnection`,{name:Oe(n)}):f(`providerEditorContent.editProviderSettingsFallback`)})]}),(0,$.jsx)(Z.Body,{children:ve}),(0,$.jsx)(Z.Footer,{children:ye})]})}function lr({assistantId:e,connectionName:t,onClose:r}){let{t:a}=i(`settings`),s=o(),[c,l]=(0,Q.useState)(null),{data:u}=n(Jt({path:{assistant_id:e}})),d=(0,Q.useMemo)(()=>u?.connections??[],[u]),f=(0,Q.useMemo)(()=>t==null?void 0:d.find(e=>e.name===t),[t,d]),p=t!=null&&u!=null&&f==null;(0,Q.useEffect)(()=>{p&&r()},[p,r]);function m(){s.invalidateQueries({queryKey:xe({path:{assistant_id:e}})}),s.invalidateQueries({queryKey:lt({path:{assistant_id:e}})}),r()}return(0,$.jsx)(fe,{title:f?Oe(f):a(`providerDetailPanel.addProviderTitle`),closeVariant:`outlined`,onClose:r,footer:(0,$.jsx)(`div`,{ref:l,className:`flex justify-end gap-2`}),children:t==null||f!=null?(0,$.jsx)(cr,{mode:f?`edit`:`create`,connection:f,variant:`panel`,actionsSlot:c,assistantId:e,existingNames:d.map(e=>e.name),connections:d,onSave:m,onCancel:r}):null})}var ur={vellum:{provider:`vellum`},deepgram:{provider:`deepgram`,credentialService:`deepgram`},openai:{provider:`openai-whisper`,credentialService:`openai`}},dr={vellum:`vellum`,deepgram:`deepgram`,"openai-whisper":`openai`},fr=`deepgram`;function pr({assistantId:e,hideSaveButton:t=!1,hideCredentialsGuide:r=!1,onSaveStateChange:a}={}){let s=J(),c=e??s,l=kt(),u=o(),{t:d}=i(),f=(0,Q.useMemo)(()=>Et(Ee(),{displayName:d(`sttProviderForm.windowsNativeDisplayName`),subtitle:d(`sttProviderForm.windowsNativeSubtitle`),setupWarning:d(`sttProviderForm.windowsNativeSetupWarning`)}).filter(e=>!e.requiresNativeDictation||Rt()),[d]),p=fr,{data:m}=n({...C({path:{assistant_id:c}}),enabled:l,staleTime:3e4}),h=m?.services?.stt,g=h?.mode===`managed`?`vellum`:h?.provider,v=(0,Q.useMemo)(()=>{let e=g?dr[g]:void 0;if(e&&f.some(t=>t.id===e))return e;let t=H(V,p);return f.some(e=>e.id===t)?t:p},[g,f,p]),y=!!g,[b,x]=fn(v),{available:S,currentCode:w,configuredProviderId:T,selectLanguage:E,selecting:O}=xt(c),[k,A]=(0,Q.useState)(!1),j=S&&b===v&&(ur[b]?.provider===T||!!g&&!dr[g]),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(!1),[R,ee]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{let e=H(V,p);e===`macos-native`&&!f.some(t=>t.id===e)&&D(V,p)},[f,p]);let z=(0,Q.useMemo)(()=>f.find(e=>e.id===b)??f[0],[f,b]),te=z.apiKeyPlaceholder!==void 0;(0,Q.useEffect)(()=>{I(H(L+b,``).length>0),P(``)},[b]);let ne=(0,Q.useMemo)(()=>{let e=b!==v,t=N.trim().length>0;return e||t},[b,v,N]),B=(0,Q.useCallback)(async()=>{let e=N.trim();D(V,b),e.length>0&&D(L+b,e);let t=ur[b];ee(!0);try{if(t?.credentialService){let n=e.length>0?e:H(L+b,``);if(n.length>0){let{response:e}=await bt({path:{assistant_id:c},body:{service:t.credentialService,field:`api_key`,value:n,label:`${z.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}}if(t&&(b!==v||!y)||g===`vellum`&&b!==`vellum`){let e=t?.provider??fr,{response:n}=await He({path:{assistant_id:c},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&&I(!0),P(``),u.invalidateQueries({queryKey:et({path:{assistant_id:c}})}),Y.success(d(`sttProviderForm.saveSuccess`)),!0}catch(e){return Y.error(e instanceof Error?e.message:d(`sttProviderForm.saveFailed`)),!1}finally{ee(!1)}},[c,b,N,z,v,y,g,u,d]);(0,Q.useEffect)(()=>{a?.({hasChanges:ne,saving:R,save:B})},[a,ne,R,B]);let re=(0,Q.useCallback)(()=>{D(L+b,``),I(!1),P(``)},[b]),ie=F?d(`sttProviderForm.apiKeyPlaceholderReplace`):z.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:d(`sttProviderForm.providerLabel`)}),(0,$.jsx)(X,{value:b,onChange:x,options:f.map(e=>({value:e.id,label:e.displayName})),"aria-label":d(`sttProviderForm.providerAriaLabel`)})]}),j&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:d(`sttProviderForm.spokenLanguage`)}),(0,$.jsx)(ze,{"aria-label":d(`sttProviderForm.spokenLanguage`),"aria-haspopup":`dialog`,onClick:()=>A(!0),value:at(w,T)}),(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:d(`sttProviderForm.spokenLanguageApplies`)}),(0,$.jsx)(un,{open:k,onOpenChange:A,title:d(`sttProviderForm.spokenLanguage`),currentCode:w,configuredProviderId:T,selectLanguage:E,selecting:O})]}),te&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:d(`sttProviderForm.apiKeyLabel`)}),(0,$.jsx)(M,{type:`password`,value:N,onChange:e=>P(e.target.value),placeholder:ie,fullWidth:!0})]}),z.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)(_,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--system-mid-strong)]`}),(0,$.jsx)(`span`,{children:z.setupWarning})]}),!r&&z.credentialsGuide&&(0,$.jsx)(on,{guide:z.credentialsGuide}),b===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:d(`sttProviderForm.vellumTranscription`)}),(!t||F)&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!t&&(0,$.jsx)(an,{onClick:B,disabled:!ne||R}),F&&(0,$.jsx)(rn,{onClick:re})]})]})}var mr={batch:`sttRoleOverrides.role.batch`,dictation:`sttRoleOverrides.role.dictation`,liveVoice:`sttRoleOverrides.role.liveVoice`,telephony:`sttRoleOverrides.role.telephony`,watch:`sttRoleOverrides.role.watch`};function hr(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 gr({assistantId:e}){let{t}=i(`settings`),r=o(),a=kt(),[s,c]=(0,Q.useState)(null),{data:l}=n({...C({path:{assistant_id:e}}),enabled:a,staleTime:3e4}),u=l?.services?.stt,d=hr(u),{data:f}=n({...Gt({path:{assistant_id:e}}),enabled:a&&d.length>0,staleTime:5*6e4});if(d.length===0)return null;let p=e=>f?.providers?.find(t=>t.id===e)?.displayName??e,m=async n=>{c(n);try{let{response:t}=await He({path:{assistant_id:e},body:{services:{stt:{roles:{[n]:null}}}},throwOnError:!1});if(!t?.ok)throw Error(String(t?.status??``));await r.invalidateQueries({queryKey:et({path:{assistant_id:e}})})}catch{Y.error(t(`sttRoleOverrides.clearFailed`))}finally{c(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:d.map(e=>{let n=mr[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?`${p(e.provider)} · ${e.model}`:p(e.provider)}),(0,$.jsx)(I,{variant:`ghost`,size:`compact`,"aria-label":t(`sttRoleOverrides.clearAria`,{feature:n?t(n):e.role}),className:`[--vbtn-fg:var(--content-tertiary)]`,disabled:s===e.role,onClick:()=>void m(e.role),children:t(`sttRoleOverrides.clear`)})]},e.role)})})]})}function _r(){let{t:e}=i(`settings`),t=J();return(0,$.jsxs)(nn,{title:e(`speechToTextCard.title`),subtitle:e(`speechToTextCard.subtitle`),children:[(0,$.jsx)(pr,{}),(0,$.jsx)(gr,{assistantId:t})]})}async function vr(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 yr(n,r,i):t===`deepgram`?await br(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 yr(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 xr(i,`ElevenLabs rejected the request.`)}}async function br(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 xr(n,`Deepgram rejected the request.`)}}async function xr(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 Sr({assistantId:e,value:t,onChange:n,className:r}){let{t:a}=i(),[o,s]=(0,Q.useState)(!1),{voices:c}=ae(e);if(c.length===0)return null;let l=c.find(e=>e.model===t)??c[0];return(0,$.jsxs)(de.Root,{open:o,onOpenChange:s,children:[(0,$.jsx)(de.Trigger,{asChild:!0,children:(0,$.jsx)(ze,{"aria-label":a(`voicePickerField.ariaLabel`),value:l?ke(l.description):a(`voicePickerField.selectVoice`),className:r})}),(0,$.jsx)(de.Content,{side:`bottom`,align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,children:(0,$.jsx)(z,{assistantId:e,value:t,onChange:n,onSelect:()=>s(!1),showSource:!0,autoScrollToSelected:!0})})]})}var Cr={elevenlabs:`voiceId`,"fish-audio":`referenceId`,xai:`voiceId`};function wr({assistantId:e,hideSaveButton:t=!1,hideCredentialsGuide:r=!1,onSaveStateChange:a}={}){let{t:s}=i(),c=J(),l=e??c,u=Ke.use.name()??`your assistant`,d=kt(),f=o(),{data:m}=n({...Qe({path:{assistant_id:l}}),enabled:d,staleTime:1/0}),h=(0,Q.useMemo)(()=>{let e=m?.providers;if(!e)return Ft;if(e.some(e=>e.id===`vellum`))return e;let t=Ft.find(e=>e.id===`vellum`);return t?[t,...e]:e},[m]),{data:g}=n({...C({path:{assistant_id:l}}),enabled:d,staleTime:3e4}),_=g?.services?.tts,v=_?.mode===`managed`?`vellum`:_?.provider,y=`elevenlabs`,b=(0,Q.useMemo)(()=>v??H(`vellum:voice:ttsProvider`,y),[v,y]),x=!!v,[S,w]=fn(b),[T,E]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(!1),[F,L]=(0,Q.useState)(!1),[R,ee]=(0,Q.useState)(!1),{voices:z,defaultModel:te,fetched:ne}=Mt(l,{enabled:S===`vellum`}),B=_?.providers?.vellum?.model??te??``,[V,ie]=fn(B),ae=z.find(e=>e.model===V)??z[0],[oe,se]=(0,Q.useState)(null),ce=z.some(e=>e.model===B),le=oe??(ne&&B!==``&&!ce),U=(0,Q.useMemo)(()=>h.find(e=>e.id===S)??h[0],[S,h]),W=S===`vellum`&&U.supportsVoiceSelection&&V.trim()!==``&&V.trim()!==B,ue=(0,Q.useCallback)(e=>{let t=H(At+e,``),n=H(Me+e,``);P(t.length>0),k(n),j(n),E(``)},[]);(0,Q.useEffect)(()=>{ue(S)},[S,ue]);let de=(0,Q.useMemo)(()=>{let e=S!==b,t=T.trim().length>0,n=O.trim()!==A;return e||t||n||W},[S,b,T,O,A,W]),fe=(0,Q.useCallback)(async()=>{let e=T.trim(),t=O.trim(),n=U.id;D(re,n),e.length>0&&D(At+n,e),D(Me+n,t);let r=e.length>0?e:H(At+n,``),i=Cr[n];ee(!0);try{if(r.length>0){let{response:e}=await bt({path:{assistant_id:l},body:{service:n,field:`api_key`,value:r,label:`${U.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}let e={...S!==b||!x?{provider:n,mode:n===`vellum`?`managed`:`your-own`}:{},...i?{providers:{[n]:{[i]:t}}}:{},...W?{providers:{vellum:{model:V.trim()}}}:{}};if(Object.keys(e).length>0){let{response:t}=await He({path:{assistant_id:l},body:{services:{tts:e}},throwOnError:!1});if(!t?.ok)throw Error(`Failed to save configuration (HTTP ${t?.status??`?`})`)}return P(r.length>0),j(t),E(``),f.invalidateQueries({queryKey:et({path:{assistant_id:l}})}),Y.success(s(`ttsProviderForm.saved`)),!0}catch(e){return Y.error(e instanceof Error?e.message:s(`ttsProviderForm.saveFailed`)),!1}finally{ee(!1)}},[l,S,V,W,T,O,U,b,x,f,s]);(0,Q.useEffect)(()=>{a?.({hasChanges:de,saving:R,save:fe})},[a,de,R,fe]);let pe=(0,Q.useCallback)(()=>{D(At+S,``),P(!1),E(``)},[S]),G=(0,Q.useCallback)(async()=>{L(!0);try{let e=H(At+S,``),t=T.trim(),n=t.length>0?t:e;if(n.length===0){Y.error(s(`ttsProviderForm.apiKeyRequired`));return}let r=H(Me+S,``),i=O.trim(),a=await vr({provider:S,apiKey:n,voiceId:i.length>0?i:r,text:`Hey! It's ${u}. How does this sound?`});if(a.kind!==`audio`){Y.error(a.message);return}let o=URL.createObjectURL(a.blob);try{let e=new Audio(o);await e.play(),await new Promise(t=>{e.onended=()=>t(),e.onerror=()=>t()})}finally{URL.revokeObjectURL(o)}}finally{L(!1)}},[u,T,S,O,s]),me=N?`•••••••• (Enter a new key to replace)`:U.apiKeyPlaceholder,K=S===`vellum`,he=K&&U.supportsVoiceSelection,ge=(0,$.jsxs)(I,{variant:`link`,size:`compact`,className:`inline-flex h-auto items-center gap-1 px-0 underline [--vbtn-fg:var(--content-tertiary)]`,onClick:()=>{se(!1),z.some(e=>e.model===V)||ie(te||z[0]?.model||``)},children:[(0,$.jsx)(p,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),s(`ttsProviderForm.chooseFromCatalog`)]}),_e=he&&le&&z.length>0?ge: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:s(`ttsProviderForm.provider`)}),(0,$.jsx)(X,{value:S,onChange:w,options:h.map(e=>({value:e.id,label:e.displayName})),"aria-label":s(`ttsProviderForm.providerAriaLabel`)})]}),!K&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:s(`ttsProviderForm.apiKey`)}),(0,$.jsx)(M,{type:`password`,value:T,onChange:e=>E(e.target.value),placeholder:me,fullWidth:!0})]}),he&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:s(`ttsProviderForm.voice`)}),le?(0,$.jsx)(M,{type:`text`,value:V,onChange:e=>ie(e.target.value),placeholder:s(`ttsProviderForm.voiceIdPlaceholder`),"aria-label":s(`ttsProviderForm.customVoiceIdAriaLabel`),fullWidth:!0}):ae?(0,$.jsx)(Sr,{assistantId:l,value:V,onChange:ie}):ne&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`ttsProviderForm.noManagedVoices`)})]}),U.supportsVoiceSelection&&!K&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:s(`ttsProviderForm.voiceId`)}),(0,$.jsx)(M,{type:`text`,value:O,onChange:e=>k(e.target.value),placeholder:s(`ttsProviderForm.voiceIdPlaceholder`),fullWidth:!0})]}),!r&&!K&&(0,$.jsx)(on,{guide:U.credentialsGuide}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!K&&(0,$.jsx)(I,{variant:`outlined`,onClick:G,disabled:F,children:s(F?`ttsProviderForm.testing`:`ttsProviderForm.test`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[_e,!t&&(0,$.jsx)(an,{onClick:fe,disabled:!de||R}),N&&!K&&(0,$.jsx)(rn,{onClick:pe})]})]})]})}function Tr(){let{t:e}=i(`settings`);return(0,$.jsx)(nn,{id:`text-to-speech`,title:e(`textToSpeechCard.title`),subtitle:e(`textToSpeechCard.subtitle`),children:(0,$.jsx)(wr,{})})}var Er=`default`;function Dr(){let{t:e}=i(`settings`),t=J(),r=o(),{data:a}=n({...C({path:{assistant_id:t}}),staleTime:3e4}),s=it({onSuccess:e=>{Vt(r,{path:{assistant_id:t}},e)}}),c=dn(),l=(0,Q.useMemo)(()=>a?a.services?.[`web-fetch`]?.provider||H(`vellum:ai:webFetchProvider`,Er):H(Ae,Er),[a]),u=(0,Q.useMemo)(()=>a?.services?.[`web-fetch`]?.apiBase??``,[a]),[d,f]=(0,Q.useState)(!1),[p,m]=fn(l),[h,_]=fn(u),[v,y]=(0,Q.useState)(``),b=gt.has(p),x=Wt.has(p),{hasStoredCredential:w}=oe({assistantId:t,credentialKind:`api_key`,credentialName:p,enabled:x}),T=v.trim().length>0,E=h.trim(),O=b&&E.length>0,k=p!==l||b&&E!==u.trim(),A=d||x&&!O&&!w&&!T||!k&&!T,N=pe(yt[p]??e(`webFetchCard.apiKeyPlaceholder`),w),P=Ze[p]??``,F=(0,Q.useCallback)(async()=>{f(!0);let n=v.trim(),i=x&&n.length>0;try{i&&await c(p,n),await s.mutateAsync({path:{assistant_id:t},body:{services:{"web-fetch":{provider:p,...b?{apiBase:E}:{}}}}}).catch(t=>{throw Y.error(e(`webFetchCard.configUpdateFailedToast`)),j(t,{context:`patch_daemon_config`}),t})}catch{f(!1);return}f(!1);try{if(D(Ae,p),i){let e=S(p);e&&D(e,n);let i=te(t,`api_key`,p);r.setQueryData(i,!0),r.invalidateQueries({queryKey:i}),y(``)}Y.success(e(`webFetchCard.savedToast`))}catch(t){j(t,{context:`settings-ai-web-fetch-persist-local`}),Y.error(e(`webFetchCard.localPreferencesFailedToast`))}},[x,s,c,r,t,v,p,b,E,e]),I=(0,Q.useCallback)(()=>{let e=S(p);e&&ve(e),y(``),_(``),m(Er),D(Ae,Er)},[p,m,_]);return(0,$.jsx)(nn,{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)(X,{value:p,onChange:m,options:Ot.map(e=>({value:e,label:nt[e]??e}))})]}),b&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(M,{label:e(`webFetchCard.apiBaseLabel`),type:`url`,value:h,onChange:e=>_(e.target.value),placeholder:P||e(`webFetchCard.apiBasePlaceholder`),fullWidth:!0}),P?(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`webFetchCard.apiBaseHint`,{defaultBase:P})}):null]}),x&&(0,$.jsx)(M,{label:e(`webFetchCard.apiKeyLabel`),type:`password`,value:v,onChange:e=>y(e.target.value),placeholder:N,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(an,{onClick:F,disabled:A}),d&&(0,$.jsx)(g,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),x&&(0,$.jsx)(rn,{onClick:I,filled:!0})]})]})})}var Or=`0.10.12`;function kr(){return Je(Or)}function Ar(){let{t:e}=i(`settings`),t=J(),r=o(),a=kt(),{data:s}=n({...C({path:{assistant_id:t}}),enabled:a,staleTime:3e4}),c=it({onSuccess:e=>{Vt(r,{path:{assistant_id:t}},e)}}),l=dn(),u=(0,Q.useMemo)(()=>{if(!s)return H(Pe,`inference-provider-native`);let e=s.services?.[`web-search`];return(e?.mode===`managed`&&e?.provider!==`inference-provider-native`?`vellum`:e?.provider)||H(`vellum:ai:webSearchProvider`,`inference-provider-native`)},[s]),d=(0,Q.useMemo)(()=>s?.services?.[`web-search`]?.apiBase??``,[s]),[f,p]=(0,Q.useState)(!1),[m,h]=fn(u),[_,v]=fn(d),[y,b]=(0,Q.useState)(``),x=St.has(m),S=Nt.has(m),w=ct.has(m),{hasStoredCredential:T}=oe({assistantId:t,credentialKind:`api_key`,credentialName:m,enabled:S}),E=y.trim().length>0,O=_.trim(),k=x&&O.length>0,A=m!==u||x&&O!==d.trim(),N=f||S&&!w&&!k&&!T&&!E||!A&&!E,P=pe(Ye[m]??e(`webSearchCard.apiKeyPlaceholder`),T),F=Be[m]??``,I=(0,Q.useCallback)(async()=>{p(!0);let n=y.trim(),i=$e(m),a=S&&n.length>0;try{a&&await l(m,n),await Yt();let r=m===`vellum`?kr()?{provider:`vellum`,mode:`managed`}:{mode:`managed`}:{provider:m,mode:`your-own`,...x?{apiBase:O}:{}};await c.mutateAsync({path:{assistant_id:t},body:{services:{"web-search":r}}}).catch(t=>{throw Y.error(e(`webSearchCard.configUpdateFailedToast`)),j(t,{context:`patch_daemon_config`}),t})}catch{p(!1);return}p(!1);try{if(D(Pe,m),a){i&&D(i,n);let e=te(t,`api_key`,m);r.setQueryData(e,!0),r.invalidateQueries({queryKey:e}),b(``)}Y.success(e(`webSearchCard.savedToast`))}catch(t){j(t,{context:`settings-ai-web-search-persist-local`}),Y.error(e(`webSearchCard.localPreferencesFailedToast`))}},[S,c,l,r,t,y,m,x,O,e]),L=(0,Q.useCallback)(()=>{let e=$e(m);e&&ve(e),b(``),v(``),h(`inference-provider-native`),D(Pe,`inference-provider-native`)},[m,h,v]);return(0,$.jsx)(nn,{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)(X,{"aria-label":e(`webSearchCard.providerAriaLabel`),value:m,onChange:h,options:Lt.map(e=>({value:e,label:Tt[e]??e}))})]}),m===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`webSearchCard.vellumNote`)}),x&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(M,{label:e(`webSearchCard.apiBaseLabel`),type:`url`,value:_,onChange:e=>v(e.target.value),placeholder:F||e(`webSearchCard.apiBasePlaceholder`),fullWidth:!0}),F?(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`webSearchCard.apiBaseHint`,{defaultBase:F})}):null]}),S&&(0,$.jsx)(M,{label:e(`webSearchCard.apiKeyLabel`),type:`password`,value:y,onChange:e=>b(e.target.value),placeholder:P,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(an,{onClick:I,disabled:N}),f&&(0,$.jsx)(g,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),S&&(0,$.jsx)(rn,{onClick:L,filled:!0})]})]})})}function jr(){let e=J(),t=P(),[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)(qn,{}),(0,$.jsx)(Gn,{panel:n,onOpenPanel:r,onClosePanel:()=>r(null)}),(0,$.jsx)(Ar,{}),(0,$.jsx)(Dr,{}),(0,$.jsx)(gn,{}),(0,$.jsx)(Tr,{}),(0,$.jsx)(_r,{})]}),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)(or,{assistantId:e,onClose:()=>r(null)},a):o?(0,$.jsx)(lr,{assistantId:e,connectionName:n.kind===`provider`?n.name:null,onClose:()=>r(null)},a):(0,$.jsx)(Jn,{assistantId:e,profileName:n.kind===`profile`?n.name:null,onClose:()=>r(null)},a):null;return s&&t?(0,$.jsx)(sn,{children:s}):s?(0,$.jsx)(cn,{storageKey:`aiSettingsDetailDrawerWidth`,detailKey:a,section:i,detail:s}):i}export{jr as AiPage};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{A as t,Kn as n,N as r,O as i,Un as a,Yn as o}from"./vendor-BdYt2Rah.js";import{b as s,t as c,y as l}from"./react-DPM_L_aA.js";import{Fr as u,J as d,mn as f,nn as p,qn as m,st as h,tn as g,v as _,x as v}from"./icons-CSdHOix6.js";import{t as y}from"./ellipsis-vertical-npNyglhR.js";import{$a as b,$d as x,$g as S,$u as C,Au as w,Bf as T,Bg as E,Bv as D,Cd as O,Cf as k,Du as A,Dv as j,Ey as M,Fh as N,Fs as P,Fu as F,Fy as I,Ga as L,Gf as R,Hf as ee,Ht as z,If as te,Iu as ne,Iy as B,Ja as re,Ka as V,Kf as ie,Kt as ae,Lf as oe,Lu as se,Lv as H,Mu as ce,My as le,Nu as U,Nv as W,Ou as ue,Oy as de,P as fe,Pu as pe,Py as G,Qd as me,Qg as K,Rf as he,Rg as ge,Ru as _e,Rv as ve,S_ as ye,Sd as be,Td as xe,Ty as Se,Ua as Ce,Uf as we,Vf as Te,Vp as Ee,Wa as De,Wf as Oe,Wt as ke,Xa as Ae,Xh as je,Ya as Me,Yv as Ne,Za as Pe,Zd as Fe,Zg as Ie,__ as Le,_h as Re,_t as ze,a_ as Be,ad as Ve,ah as He,ai as Ue,ao as We,at as Ge,av as Ke,b_ as qe,bp as Je,c_ as Ye,ct as Xe,d_ as Ze,df as Qe,dy as q,e_ as $e,ed as et,eo as tt,f_ as nt,ft as J,g_ as rt,gf as it,gt as at,gy as Y,h_ as ot,hy as st,i_ as ct,id as lt,ii as ut,io as dt,it as ft,ju as pt,ku as mt,ky as ht,l_ as gt,lt as _t,ly as vt,m_ as yt,mh as bt,mt as xt,n_ as St,nd as Ct,nt as wt,o_ as Tt,oo as Et,ot as Dt,oy as X,p_ as Ot,pp as kt,qa as At,qf as jt,qt as Mt,r_ as Nt,rd as Pt,ro as Ft,rt as It,s_ as Lt,so as Rt,st as zt,t_ as Bt,td as Vt,to as Ht,ty as Ut,u_ as Wt,uf as Gt,v_ as Kt,vh as qt,vy as Z,wd as Jt,wp as Yt,wy as Xt,x_ as Zt,xp as Qt,y_ as $t,zf as en,zg as tn}from"./index-BL1oo6fL.js";import{i as nn,n as rn,r as an,t as on}from"./service-form-controls-BGFU4HPO.js";import{n as sn,t as cn}from"./detail-drawer-BPkaCFsM.js";import{a as ln}from"./schedules-CG_0wm_x.js";import{t as un}from"./stt-language-picker-modal-CTQbFR_p.js";var Q=e(s(),1);function dn(){let e=J();return(0,Q.useCallback)(async(t,n)=>{try{let{data:r}=await je({path:{assistant_id:e},body:{value:n,type:`api_key`,name:t},throwOnError:!0});Ie(r)}catch(e){throw e instanceof Error&&e.message===`No assistant found`?Y.error(r(`settings:useDaemonConfig.assistantNotReadyToast`)):Y.error(r(`settings:useDaemonConfig.saveApiKeyFailedToast`,{providerName:t})),j(e,{context:`provision_provider_key`}),e}},[e])}function fn(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 pn=`0.11.0`;function mn(){return Je(pn)}var $=c(),hn=`gemini-3.1-flash-image-preview`;function gn(){let{t:e}=i(`settings`),t=J(),r=o(),a=kt(),{data:s}=n({...C({path:{assistant_id:t}}),enabled:a,staleTime:3e4}),c=it({onSuccess:e=>{Vt(r,{path:{assistant_id:t}},e)}}),l=dn(),[u,d]=fn((0,Q.useMemo)(()=>{if(!s)return H(De,`gemini`);let e=s.services?.[`image-generation`];return e?.mode===`managed`?`vellum`:e?.provider||H(`vellum:ai:imageGenProvider`,`gemini`)},[s])),[f,p]=(0,Q.useState)(()=>H(Ce,hn)),m=dt(u),h=m.includes(f)?f:m[0]??hn,[_,v]=(0,Q.useState)(``),[y,x]=(0,Q.useState)(!1),S=tt.map(e=>({value:e,label:Ht[e]??e})),w=(0,Q.useMemo)(()=>dt(u).map(e=>({value:e,label:b[e]??e})),[u]),T=u===`gemini`||u===`openai`,{hasStoredCredential:E}=oe({assistantId:t,credentialKind:`api_key`,credentialName:u,enabled:T}),O=d,k=(0,Q.useCallback)(async()=>{x(!0);let n=_.trim(),i=T&&n.length>0;try{i&&await l(We(h),n),await Yt();let a=u===`vellum`&&!mn()?{mode:`managed`}:{provider:u,mode:u===`vellum`?`managed`:`your-own`};await c.mutateAsync({path:{assistant_id:t},body:{services:{"image-generation":a}}}).catch(t=>{throw Y.error(e(`imageGenerationCard.configUpdateFailedToast`)),j(t,{context:`patch_daemon_config`}),t});try{await N({path:{assistant_id:t},body:{modelId:h},throwOnError:!0})}catch(t){throw Y.error(e(`imageGenerationCard.modelUpdateFailedToast`)),j(t,{context:`set_image_gen_model`}),t}finally{r.invalidateQueries({queryKey:et({path:{assistant_id:t}})})}}catch{x(!1);return}x(!1);try{if(D(De,u),D(Ce,h),i){let e=te(t,`api_key`,u);r.setQueryData(e,!0),r.invalidateQueries({queryKey:e}),v(``)}Y.success(e(`imageGenerationCard.savedToast`))}catch(t){j(t,{context:`settings-ai-image-gen-persist-local`}),Y.error(e(`imageGenerationCard.localPreferencesFailedToast`))}},[_,u,T,h,t,c,l,r,e]),A=(0,Q.useCallback)(()=>{v(``),p(hn),D(Ce,hn)},[]);return(0,$.jsx)(nn,{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)(X,{"aria-label":e(`imageGenerationCard.providerAriaLabel`),value:u,onChange:O,options:S})]}),u===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`imageGenerationCard.vellumNote`)}),T&&(0,$.jsx)(M,{label:e(`imageGenerationCard.apiKeyLabel`),type:`password`,value:_,onChange:e=>v(e.target.value),placeholder:pe(e(u===`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)(X,{"aria-label":e(`imageGenerationCard.modelAriaLabel`),value:h,onChange:p,options:w})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(an,{onClick:k,disabled:y}),y&&(0,$.jsx)(g,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),T&&(0,$.jsx)(rn,{onClick:A})]})]})})}function _n({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)(G,{variant:`body-large-default`,as:`h3`,className:`text-[var(--content-secondary)]`,children:e}),t==null?null:(0,$.jsxs)(G,{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 vn(e){return e.scheduleNames.length>0||e.deferredReminderCount>0||e.scheduleLookupFailed}var yn=5;function bn({title:e,items:t,mono:n}){return(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(G,{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 xn(e){let t=e.label||e.name,n=[];e.isActive&&n.push(r(`settings:manageProfilesBlockedDeleteModal.clauseDefaultProfile`)),e.callSiteIds.length>0&&n.push(r(`settings:manageProfilesBlockedDeleteModal.clauseActionOverrides`,{count:e.callSiteIds.length}));let i=e.scheduleNames.length,a=e.deferredReminderCount;return i>0&&a>0?n.push(r(`settings:manageProfilesBlockedDeleteModal.clauseRunsBoth`,{schedules:i,reminders:a})):i>0?n.push(r(`settings:manageProfilesBlockedDeleteModal.clauseRunsSchedules`,{count:i})):a>0&&n.push(r(`settings:manageProfilesBlockedDeleteModal.clauseRunsReminders`,{count:a})),n.length===0?r(`settings:manageProfilesBlockedDeleteModal.summaryNoReferences`,{display:t}):n.length===1?r(`settings:manageProfilesBlockedDeleteModal.summaryOneClause`,{display:t,clause1:n[0]}):n.length===2?r(`settings:manageProfilesBlockedDeleteModal.summaryTwoClauses`,{display:t,clause1:n[0],clause2:n[1]}):r(`settings:manageProfilesBlockedDeleteModal.summaryThreeClauses`,{display:t,clause1:n[0],clause2:n[1],clause3:n[2]})}function Sn({blocked:e,availableReplacements:t,replacement:n,onReplacementChange:r,error:a,saving:o,onClose:s,onConfirm:c}){let{t:l}=i(`settings`),u=e?.scheduleNames??[],d=u.slice(0,yn),f=u.length-d.length,p=e!=null&&vn(e);return(0,$.jsx)(Z.Root,{open:e!==null,onOpenChange:e=>{e||s()},children:(0,$.jsxs)(Z.Content,{size:`sm`,children:[(0,$.jsx)(Z.Header,{children:(0,$.jsx)(Z.Title,{children:l(`manageProfilesBlockedDeleteModal.title`)})}),(0,$.jsxs)(Z.Body,{className:`space-y-4`,children:[e&&(0,$.jsx)(G,{variant:`body-medium-default`,as:`p`,children:xn(e)}),e&&e.callSiteIds.length>0&&(0,$.jsx)(bn,{title:l(`manageProfilesBlockedDeleteModal.actionOverridesTitle`),items:e.callSiteIds,mono:!0}),d.length>0&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(bn,{title:l(`manageProfilesBlockedDeleteModal.schedulesTitle`),items:d}),f>0&&(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`pl-1 text-(--content-tertiary)`,children:l(`manageProfilesBlockedDeleteModal.moreSchedules`,{count:f})})]}),e?.scheduleLookupFailed&&(0,$.jsx)(G,{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)(X,{"aria-label":l(`manageProfilesBlockedDeleteModal.replacementLabel`),value:n,onChange:r,placeholder:l(`manageProfilesBlockedDeleteModal.replacementPlaceholder`),options:t.map(e=>{let t=p&&e.status===`disabled`;return{value:e.name,label:Ge(e),disabled:t,tooltip:t?l(`manageProfilesBlockedDeleteModal.disabledTargetTooltip`):void 0}})})]}),a&&(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:a})]}),(0,$.jsxs)(Z.Footer,{children:[(0,$.jsx)(I,{variant:`ghost`,size:`compact`,onClick:s,children:l(`manageProfilesBlockedDeleteModal.cancel`)}),(0,$.jsx)(I,{variant:`primary`,size:`compact`,disabled:!n||o,onClick:c,children:l(o?`manageProfilesBlockedDeleteModal.saving`:`manageProfilesBlockedDeleteModal.reassignAndDelete`)})]})]})})}function Cn({profile:e,isActiveProfile:t,selected:n,connections:r,deletePending:a=!1,onOpen:o,onMakeActive:s,onSetStatus:c,onDelete:l}){let{t:d}=i(`settings`),f=e.source===`managed`,p=e.status===`disabled`,m=e.label??e.name,h=[];e.model&&h.push(w(e.provider??void 0,e.model,r)),f&&h.push(d(`profileRow.managedByVellum`));let g=e.availability,_=e.config_issue,v=_!=null||g?.status===`incomplete`,b=g?.message??d(`profileRow.providerUnavailableDefault`),x=_==null?g!=null&&g.status!==`ok`?v?d(`profileRow.providerUnavailableFixable`,{message:b}):b:null:d(`profileRow.providerUnavailableFixable`,{message:d(_.code===`over_output_cap`?`profileRow.configIssueOverOutputCap`:_.code===`no_input_room`?`profileRow.configIssueNoInputRoom`:`profileRow.configIssueModelUnknown`)});return(0,$.jsx)(Ne,{title:(0,$.jsx)(`span`,{className:p?`opacity-55`:void 0,children:m}),subtitle:h.length>0?h.join(` • `):void 0,onClick:o,showChevron:!1,selected:n,disabled:a,contentAriaLabel:d(`profileRow.openProfileAriaLabel`,{displayName:m}),trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[x==null?null:(0,$.jsx)(B,{content:x,children:v?(0,$.jsx)(`button`,{type:`button`,onClick:o,"aria-label":x,className:`inline-flex cursor-pointer rounded-sm p-0.5 keyboard-focus:ring-2 keyboard-focus:ring-[var(--ring)]`,children:(0,$.jsx)(u,{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)(u,{className:`h-4 w-4 text-[var(--system-mid-strong)]`,"aria-label":x,role:`img`})})}),p?(0,$.jsx)(ht,{tone:`neutral`,children:d(`profileRow.disabledTag`)}):null,t?(0,$.jsx)(ht,{tone:`positive`,children:d(`profileRow.defaultTag`)}):null,(0,$.jsxs)(q.Root,{children:[(0,$.jsx)(q.Trigger,{asChild:!0,children:(0,$.jsx)(I,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(y,{}),"aria-label":d(`profileRow.actionsAriaLabel`,{displayName:m}),disabled:a})}),(0,$.jsxs)(q.Content,{align:`end`,sideOffset:4,children:[(0,$.jsx)(q.Item,{onSelect:o,children:d(f?`profileRow.view`:`profileRow.edit`)}),!t&&!p?(0,$.jsx)(q.Item,{onSelect:s,children:d(`profileRow.makeDefault`)}):null,p?(0,$.jsx)(q.Item,{onSelect:()=>c(!0),children:d(`profileRow.enable`)}):f?null:(0,$.jsx)(q.Item,{onSelect:()=>c(!1),children:d(`profileRow.disable`)}),f?null:(0,$.jsx)(q.Item,{onSelect:l,className:vt.anchored,children:d(`profileRow.delete`)})]})]})]})})}function wn(e,t){let r=ut(),{data:i}=n({...be({path:{assistant_id:e}}),enabled:r,staleTime:3e4}),{profiles:a,profileOrder:o}=wt(t?.llm,e);return(0,Q.useMemo)(()=>i==null?{entries:K(a,o).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:i.profiles,isEffectiveCatalog:!0},[i,a,o])}var Tn=`0.10.8`;function En(e){return Qt(Tn,e)}var Dn=`settings-ai-profile-make-active`,On=`Failed to set the active profile. Please try again.`;function kn(e){let t=ue(),n=o(),r=En(e),i=k({onSuccess:()=>{n.invalidateQueries({queryKey:et({path:{assistant_id:e}})}),n.invalidateQueries({queryKey:O({path:{assistant_id:e}})})}});async function a(n,r,i){try{await t.mutateAsync({path:{assistant_id:e},body:{llm:n}})}catch(e){throw j(e,{context:r}),Y.error(i),e}}async function s(t){if(!r){await a({activeProfile:t},Dn,On);return}try{await i.mutateAsync({path:{assistant_id:e},body:{name:t}})}catch(e){let t=W(e);throw Y.error(t??On),t||j(e,{context:Dn}),e}}return{makeActive:s,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 An=`The profile was not deleted.`,jn=`Failed to move the schedules. ${An}`;function Mn(e){let t=W(e);return t?`${/[.!?]$/.test(t)?t:`${t}.`} ${An}`:jn}function Nn(e,t,n){let r=kn(e),i=o(),a=_t(),s=t?.llm?.activeProfile??null,c=t?.llm?.advisorProfile??null,l=t?.llm?.callSites??{},u=(0,Q.useMemo)(()=>t?.llm?.profiles??{},[t?.llm?.profiles]),d=(0,Q.useMemo)(()=>t?.llm?.profileOrder??[],[t?.llm?.profileOrder]),f=(0,Q.useMemo)(()=>K(u,d),[u,d]),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(null),C=(0,Q.useRef)(!1);function w(e){return f.filter(t=>t.name===e?!1:t.status===`disabled`?!0:It(t,f,{requireOwnProviderAndModel:a}))}function T(e,t){let n=w(e).filter(e=>!t||e.status!==`disabled`),r=n.find(e=>e.name===s),i=n.find(e=>e.source!==`managed`);return(r??i??n[0])?.name??``}async function E(e){try{await r.deleteProfile(e,d,{isAdvisor:e===c}),n?.onDeleted?.(e)}catch{}}async function D(t){let n=u[t]?.label??t,r=t===s,a=Object.entries(l).filter(([e,n])=>e!==`mainAgent`&&n?.profile===t).map(([e])=>e),o=[],c=0,d=!1;try{let n=(await i.fetchQuery({...Fe({path:{assistant_id:e},query:{inference_profile:t,include_all:`true`}}),retry:!1,staleTime:0})).schedules??[];o=n.filter(e=>!e.isDeferred).map(e=>e.name),c=n.filter(e=>e.isDeferred).length}catch(e){j(e,{context:`settings-ai-profile-delete-schedule-scan`}),d=!0}if(!(r||a.length>0||o.length>0||c>0)&&!d){await E(t);return}let f={name:t,label:n,isActive:r,callSiteIds:a,scheduleNames:o,deferredReminderCount:c,scheduleLookupFailed:d};m(f),v(T(t,vn(f))),g(null)}function O(e){t==null||C.current||(C.current=!0,S(e),D(e).finally(()=>{C.current=!1,S(null)}))}async function k(){if(!p||!_)return;if(b(!0),g(null),vn(p))try{await ln(e,p.name,_),await i.invalidateQueries({queryKey:me({path:{assistant_id:e}})})}catch(e){j(e,{context:`settings-ai-profile-reassign-schedules`}),g(Mn(e)),b(!1);return}let t={};if(p.isActive&&(t.activeProfile=_),p.callSiteIds.length>0){let e={};for(let t of p.callSiteIds)e[t]={profile:_};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{g(`Failed to reassign references. Please try again.`),b(!1);return}let n=p.name;m(null),b(!1),E(n)}return{requestDelete:O,pendingDeleteName:x,blockedDeleteModalProps:{blocked:p,availableReplacements:w(p?.name??null),replacement:_,onReplacementChange:v,error:h,saving:y,onClose:()=>{m(null),g(null)},onConfirm:()=>void k()}}}function Pn(){}function Fn({assistantId:e,config:t,connections:n,selectedProfileName:r,onOpenProfile:a,onCreateProfile:o,onProfileDeleted:s}){let{t:c}=i(`settings`),{entries:l}=wn(e,t),u=kn(e),d=Nn(e,t,{onDeleted:s}),f=t?.llm?.activeProfile??null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_n,{title:c(`profilesSection.title`),action:(0,$.jsx)(I,{variant:`primary`,onClick:o,leftIcon:(0,$.jsx)(h,{}),disabled:t==null,children:c(`profilesSection.createProfile`)}),children:t==null?(0,$.jsx)(G,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:c(`profilesSection.loading`)}):l.length===0?(0,$.jsx)(G,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:c(`profilesSection.emptyState`)}):l.map(e=>(0,$.jsx)(Cn,{profile:e,isActiveProfile:e.name===f,selected:e.name===r,connections:n,deletePending:d.pendingDeleteName===e.name,onOpen:()=>a(e.name),onMakeActive:()=>void u.makeActive(e.name).catch(Pn),onSetStatus:t=>void u.setStatus(e.name,t).catch(Pn),onDelete:()=>d.requestDelete(e.name)},e.name))}),(0,$.jsx)(Sn,{...d.blockedDeleteModalProps})]})}var In={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 Ln(e){return e in In}function Rn(e){if(!e.baseUrl)return null;try{return new URL(e.baseUrl).host}catch{return e.baseUrl}}function zn(e){let t=Rn(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 Bn(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 Vn(e){if(e.provider===`vellum`)return`Included with your plan`;if(e.provider===`openai-compatible`)return zn(e);let t=[];if(e.provider===`ollama`||e.provider===`opencode`){let n=Rn(e);n&&t.push(n)}let n=e.provider===`chatgpt`?`openai`:e.provider,r=e.auth.type===`oauth_subscription`?ge(n):Zt(n),i=e.models?.length??r.length;i>0&&t.push(`${i} ${i===1?`model`:`models`}`);let a=Bn(e);return a&&t.push(a),t.join(` • `)}function Hn({connection:e,isDefault:t,supportsDefaultProvider:n,selected:r,isSettingDefault:a,onOpen:o,onSetDefault:s,onDelete:c}){let{t:l}=i(`settings`),u=e.isManaged??!1,d=Oe(e),f=Ln(e.provider),p=Vn(e),m=n&&!t&&f,h=!u&&o!=null,g=!u&&!t,_=m||h||g;return(0,$.jsx)(Ne,{title:d,subtitle:p.length>0?p:void 0,onClick:o,showChevron:!1,selected:r,contentAriaLabel:o?l(`providerRow.openProviderAriaLabel`,{displayName:d}):void 0,trailingInteractive:!0,trailing:(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsx)(ht,{tone:`neutral`,title:l(`providerRow.managedTagTitle`),children:l(`providerRow.managedTag`)}):null,t?(0,$.jsx)(ht,{tone:`info`,title:l(`providerRow.defaultTagTitle`),children:l(`providerRow.defaultTag`)}):null,e.provider===`ollama`?(0,$.jsx)(ht,{tone:`neutral`,title:l(`providerRow.localTagTitle`),children:l(`providerRow.localTag`)}):null,e.provider===`openai-compatible`?(0,$.jsx)(ht,{tone:`neutral`,title:l(`providerRow.customTagTitle`),children:l(`providerRow.customTag`)}):null,_?(0,$.jsxs)(q.Root,{children:[(0,$.jsx)(q.Trigger,{asChild:!0,children:(0,$.jsx)(I,{variant:`ghost`,size:`compact`,iconOnly:(0,$.jsx)(y,{}),"aria-label":l(`providerRow.actionsAriaLabel`,{displayName:d})})}),(0,$.jsxs)(q.Content,{align:`end`,sideOffset:4,children:[h?(0,$.jsx)(q.Item,{onSelect:o,children:l(`providerRow.edit`)}):null,m?(0,$.jsx)(q.Item,{disabled:a,onSelect:s,children:l(`providerRow.setAsDefault`)}):null,g?(0,$.jsx)(q.Item,{onSelect:c,className:vt.anchored,children:l(`providerRow.delete`)}):null]})]}):(0,$.jsx)(`span`,{className:`inline-block w-8`,"aria-hidden":!0})]})})}function Un(e,t){let n=o(),i={path:{assistant_id:e}},s=a({...Ve(),onSuccess:()=>{n.invalidateQueries({queryKey:lt(i)}),n.invalidateQueries({queryKey:et(i)}),n.invalidateQueries({queryKey:O(i)})},onError:e=>{j(e,{context:`settings-ai-set-default-provider`}),Y.error(r(`settings:useProviderActions.setDefaultFailedToast`))}});function c(t){Ln(t.provider)&&s.mutate({path:{assistant_id:e},body:{provider:t.provider,connectionName:t.name}})}function l(e){return s.isPending&&s.variables?.body?.connectionName===e}async function u(a){try{let{response:o}=await Re({path:{assistant_id:e,name:a}});o?.ok||o?.status===404?(n.invalidateQueries({queryKey:xe(i)}),t?.onDeleted?.(a)):o?.status===409?Y.error(r(`settings:useProviderActions.deleteInUseToast`)):Y.error(r(`settings:useProviderActions.deleteFailedToast`))}catch(e){j(e,{context:`settings-ai-provider-delete`}),Y.error(r(`settings:useProviderActions.deleteFailedToast`))}}return{setDefault:c,isSettingDefault:l,deleteConnection:u}}function Wn({assistantId:e,selectedConnectionName:t,onOpenConnection:r,onAddProvider:a,onConnectionDeleted:o}){let{t:s}=i(`settings`),{data:c,isLoading:l,isError:u}=n(Jt({path:{assistant_id:e}})),d=Ue(),{data:f}=n({...Pt({path:{assistant_id:e}}),enabled:d}),p=d?f?.resolvedConnectionName??null:null,m=Un(e,{onDeleted:o}),g=(0,Q.useMemo)(()=>{let e=c?.connections??[];return[...e.filter(e=>e.provider===Le),...e.filter(e=>e.provider!==Le)]},[c]);return(0,$.jsx)(_n,{title:s(`providersSection.title`),action:(0,$.jsx)(I,{variant:`outlined`,onClick:a,leftIcon:(0,$.jsx)(h,{}),children:s(`providersSection.addProvider`)}),children:l?(0,$.jsx)(`div`,{className:`space-y-2 py-2`,children:[1,2,3].map(e=>(0,$.jsx)(Ut,{className:`h-10 rounded-lg`},e))}):u?(0,$.jsx)(G,{variant:`body-medium-default`,as:`p`,className:`py-4 text-center text-(--system-negative-strong)`,children:s(`providersSection.loadError`)}):g.length===0?(0,$.jsx)(G,{variant:`body-medium-lighter`,as:`p`,className:`py-4 text-center text-(--content-tertiary)`,children:s(`providersSection.empty`)}):g.map(e=>(0,$.jsx)(Hn,{connection:e,isDefault:e.name===p,supportsDefaultProvider:d,selected:e.name===t,isSettingDefault:m.isSettingDefault(e.name),onOpen:e.isManaged??!1?void 0:()=>r(e.name),onSetDefault:()=>m.setDefault(e),onDelete:()=>void m.deleteConnection(e.name)},e.name))})}function Gn({panel:e,onOpenPanel:t,onClosePanel:r}){let{t:a}=i(`settings`),o=J(),{data:s}=n({...C({path:{assistant_id:o}}),staleTime:3e4}),c=Ue(),{data:l}=n({...Pt({path:{assistant_id:o}}),enabled:c}),u=l?.availability,{data:d}=n({...Jt({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)(nn,{title:a(`languageModelCard.title`),subtitle:a(`languageModelCard.subtitle`),children:(0,$.jsxs)(`div`,{className:`space-y-2`,children:[u&&u.status!==`ok`&&(0,$.jsx)(le,{tone:u.status===`unknown`?`warning`:`error`,children:u.message??a(`languageModelCard.defaultProviderUnavailable`)}),o&&(0,$.jsx)(Fn,{assistantId:o,config:s,connections:f,selectedProfileName:e?.kind===`profile`?e.name:null,onOpenProfile:e=>t({kind:`profile`,name:e}),onCreateProfile:()=>t({kind:`create-profile`}),onProfileDeleted:t=>{e?.kind===`profile`&&e.name===t&&r()}}),o&&(0,$.jsx)(Wn,{assistantId:o,selectedConnectionName:e?.kind===`provider`?e.name:null,onOpenConnection:e=>t({kind:`provider`,name:e}),onAddProvider:()=>t({kind:`add-provider`}),onConnectionDeleted:t=>{e?.kind===`provider`&&e.name===t&&r()}}),(0,$.jsx)(_n,{title:a(`languageModelCard.overridesTitle`),count:m,action:(0,$.jsx)(I,{variant:`outlined`,onClick:()=>t({kind:`overrides`}),children:a(`languageModelCard.manage`)})})]})})}function Kn({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)(m,{className:`h-3.5 w-3.5`})]})}function qn(){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)(f,{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)(t,{i18nKey:`managedServicesBanner.body`,ns:`common`,components:{link:(0,$.jsx)(Kn,{})}})})]})}function Jn({assistantId:e,profileName:t,onClose:r}){let{t:a}=i(`settings`),{data:o}=n({...C({path:{assistant_id:e}}),staleTime:3e4}),{data:s}=n({...Jt({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(t==null)return;let e=l[t];return e?{name:t,...e}:void 0},[t,l]),f=t==null?`create`:d?.source===`managed`||d?.invariant===!0?`view`:`edit`,{saveProfile:p,isPending:m}=A(e,{onSaved:r}),h=mt({mode:f,profileName:t??void 0,initialValues:d,existingNames:u,connections:c,assistantId:e,onSave:p}),_=Nn(e,o,{onDeleted:()=>r()}),y=t!=null&&_.pendingDeleteName===t,b=t!=null&&o!=null&&!(t in l);(0,Q.useEffect)(()=>{b&&!h.saving&&!m&&r()},[b,h.saving,m,r]);let x=f===`view`;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(fe,{title:h.effectiveMode===`create`?a(`profileDetailPanel.createTitle`):d?.label??t??a(`profileDetailPanel.defaultTitle`),closeVariant:`outlined`,onClose:r,headerTrailing:x&&h.effectiveMode!==`create`?(0,$.jsx)(ht,{tone:`neutral`,children:a(`profileDetailPanel.managedTag`)}):null,headerActions:h.effectiveMode!==`create`&&!h.isReadOnly?(0,$.jsx)(I,{variant:`dangerOutline`,iconOnly:y?(0,$.jsx)(g,{className:`animate-spin`}):(0,$.jsx)(v,{}),"aria-label":a(y?`profileDetailPanel.deleting`:`profileDetailPanel.delete`),tooltip:a(`profileDetailPanel.delete`),onClick:()=>{t!=null&&_.requestDelete(t)},disabled:h.saving||y}):null,footer:h.isReadOnly?(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(I,{variant:`outlined`,onClick:h.switchToSaveAsNew,disabled:h.saving,children:a(`profileDetailPanel.saveAsNew`)}),h.hasViewModeChanges?(0,$.jsx)(I,{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)(I,{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)(pt,{editor:h,assistantId:e,connections:c,variant:`panel`})}),(0,$.jsx)(Sn,{..._.blockedDeleteModalProps})]})}function Yn({value:e,profileOptions:t,disabled:n,onChange:r}){let{t:a}=i(`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:a(`advisorProfileRow.title`)}),(0,$.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:a(`advisorProfileRow.description`)})]}),(0,$.jsx)(X,{value:e,onChange:r,options:t,placeholder:a(`advisorProfileRow.chooseProfilePlaceholder`),className:`w-44`,menuMinWidth:280,menuAlign:`start`,disabled:n})]})})}var Xn=`__custom__`;function Zn(e){return e?!!(e.profile||e.provider||e.model):!1}function Qn(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 $n(e,t){let n=Zn(e);return n===Zn(t)?n?(e?.profile??null)===(t?.profile??null)&&(e?.provider??null)===(t?.provider??null)&&(e?.model??null)===(t?.model??null):!0:!1}function er({assistantId:e,callSites:t,domains:n,persistedOverrides:r,orderedProfiles:a,onClose:o,onApplied:s}){let{t:c}=i(`settings`),l=ue(),u=_t(),d=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:u}),[u]),f=(0,Q.useMemo)(()=>{let e=new Map;for(let n of t){let t=Qn(n,r[n.id]);t&&e.set(n.id,t)}return e},[t,r]),p=(0,Q.useMemo)(()=>{let e=new Set(Array.from(f.values(),e=>e.profile));return a.filter(t=>e.has(t.name))},[a,f]),[m,h]=(0,Q.useState)(()=>p[0]?.name??``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(new Set),[x,S]=(0,Q.useState)(!1),C=(0,Q.useMemo)(()=>{let e=new Map(n.map(e=>[e.id,e.displayName]));return t=>e.get(t)??t},[n]),w=(0,Q.useMemo)(()=>t.filter(e=>f.get(e.id)?.profile===m),[t,f,m]),T=(0,Q.useMemo)(()=>w.map(e=>e.id).filter(e=>!y.has(e)),[w,y]),E=(0,Q.useMemo)(()=>p.map(e=>({value:e.name,label:Ge(e)})),[p]),D=(0,Q.useMemo)(()=>Xe(a,[],d).filter(e=>e.name!==m).map(e=>({value:e.name,label:Ge(e)})),[a,m,d]),O=Bt(a,m),k=Bt(a,_),A=y.size===0;function M(e){h(e),b(new Set),e===_&&v(``)}function N(e,t){b(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r})}async function P(){if(!(!m||!_||T.length===0)){S(!0);try{let t={};for(let e of T)t[e]={profile:_};await l.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:t}}}),Y.success(c(`bulkOverrideSwapModal.successToast`,{count:T.length,targetLabel:k})),s(),o()}catch(e){let t=W(e);Y.error(t??c(`bulkOverrideSwapModal.updateFailedToast`)),t||j(e,{context:`settings-ai-bulk-override-swap`})}finally{S(!1)}}}return(0,$.jsx)(Z.Root,{open:!0,onOpenChange:e=>{e||o()},children:(0,$.jsxs)(Z.Content,{size:`md`,children:[(0,$.jsx)(Z.Header,{children:(0,$.jsx)(Z.Title,{children:c(`bulkOverrideSwapModal.title`)})}),(0,$.jsxs)(Z.Body,{className:`space-y-4`,children:[(0,$.jsx)(G,{variant:`body-medium-default`,as:`p`,children:c(`bulkOverrideSwapModal.intro`)}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(X,{id:`bulk-swap-source`,label:c(`bulkOverrideSwapModal.currentlyUsingLabel`),value:m,onChange:M,options:E}),(0,$.jsx)(X,{id:`bulk-swap-target`,label:c(`bulkOverrideSwapModal.changeToLabel`),value:_,onChange:v,options:D,placeholder:c(`bulkOverrideSwapModal.targetPlaceholder`)})]}),(0,$.jsx)(le,{tone:`info`,title:c(`bulkOverrideSwapModal.noticeTitle`),children:c(`bulkOverrideSwapModal.noticeBody`,{sourceLabel:O})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(G,{variant:`body-medium-default`,as:`p`,children:c(`bulkOverrideSwapModal.affectedSummary`,{count:w.length,profile:O})}),(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`text-[color:var(--content-secondary)]`,children:c(`bulkOverrideSwapModal.chooseActions`)})]}),(0,$.jsx)(I,{variant:`ghost`,onClick:()=>b(A?new Set(w.map(e=>e.id)):new Set),children:c(A?`bulkOverrideSwapModal.clearAll`:`bulkOverrideSwapModal.selectAll`)})]}),(0,$.jsx)(`div`,{className:`max-h-72 space-y-1 overflow-y-auto`,children:w.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)(Xt,{checked:!y.has(e.id),onCheckedChange:t=>N(e.id,t===!0),disabled:x,label:e.displayName,helperText:C(e.domain)}),(0,$.jsx)(`span`,{className:`shrink-0 text-body-small-default text-[color:var(--content-tertiary)]`,children:f.get(e.id)?.via===`override`?c(`bulkOverrideSwapModal.viaOverride`):c(`bulkOverrideSwapModal.viaDefault`)})]},e.id))})]})]}),(0,$.jsxs)(Z.Footer,{children:[(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`mr-auto self-center text-[color:var(--content-secondary)]`,children:c(`bulkOverrideSwapModal.willChange`,{count:T.length})}),(0,$.jsx)(I,{variant:`ghost`,onClick:o,disabled:x,children:c(`bulkOverrideSwapModal.cancel`)}),(0,$.jsx)(I,{variant:`primary`,disabled:!m||!_||T.length===0||x,onClick:()=>void P(),children:x?(0,$.jsx)(g,{className:`h-4 w-4 animate-spin`}):c(`bulkOverrideSwapModal.applyTo`,{count:T.length})})]})]})})}function tr({id:e,displayName:t,description:n,defaultProfileLabel:r,draft:a,profileOptions:o,connections:s,onDraftChange:c,onToggle:l}){let{t:u}=i(`settings`),d=E.use.settingsDeveloperNav(),f=Zn(a),p=!a||!f?``:a.provider||a.model?Xn:a.profile??``,m=p===Xn,h=T(),g=he(),_=(s??[]).some(e=>e.provider===ot),v=[...rt,..._?[ot]:[]],y=h[0]??rt[0],b=a?.provider,x=Kt(b)?b:b===`chatgpt`?ot:void 0,S=x!==void 0&&v.some(e=>e===x),C=x??y,w=tn(C,``,(s??[]).filter(e=>en(e.provider,C)))?ge(C):ye(C,d),D=w.map(e=>({value:e.id,label:e.displayName})),O=typeof a?.model==`string`?a.model:``;if(O&&!w.some(e=>e.id===O)){let e=Zt(C).find(e=>e.id===O)?.displayName??O;D.push({value:O,label:u(`callSiteOverridesRow.unavailableOption`,{name:e})})}let k=!!a?.provider&&!a?.model,A=[...v.map(e=>({value:e,label:$t[e]??e,...g(e)})),...x&&!S?[{value:x,label:u(`callSiteOverridesRow.unavailableOption`,{name:$t[x]??x})}]:[]];function j(t){t===`__custom__`?c(e,{profile:null,provider:y,model:qe(y)??``}):t===``?c(e,null):c(e,{profile:t,provider:null,model:null})}function M(t){let n=qe(t)??``;c(e,{...a??{},profile:null,provider:t,model:n})}function N(t){c(e,{...a??{},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:u(`callSiteOverridesRow.defaultProfileSuffix`,{label:r})})]})]}),(0,$.jsx)(Se,{checked:f,onChange:t=>l(e,t),"aria-label":u(`callSiteOverridesRow.overrideAriaLabel`,{displayName:t}),className:`shrink-0`})]}),f&&(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(X,{value:p,onChange:j,options:o,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:u(`callSiteOverridesRow.providerLabel`)}),(0,$.jsx)(X,{value:C??``,onChange:M,options:A})]}),(0,$.jsxs)(`div`,{className:`flex-1`,children:[(0,$.jsx)(`label`,{className:`mb-1 block text-body-small-default text-[var(--content-tertiary)]`,children:u(`callSiteOverridesRow.modelLabel`)}),(0,$.jsx)(X,{value:a?.model??``,onChange:N,options:D})]})]}),k&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:u(`callSiteOverridesRow.pickModelError`)})]})]})}function nr({groups:e,drafts:t,buildProfileOptionsForRow:n,profileLabelFor:r,advisorMatchesSearch:a,connections:o,onDraftChange:s,onToggle:c}){let{t:l}=i(`settings`);return(0,$.jsx)(`div`,{className:`space-y-4`,children:e.length===0?a?null:(0,$.jsx)(`p`,{className:`py-8 text-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:l(`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||!Zn(n)?``:n.provider||n.model?Xn:n.profile??``})(),a=e.shippedDefaultProfile??e.defaultProfile,l=a?r(a):null;return(0,$.jsx)(tr,{id:e.id,displayName:e.displayName,description:e.description,defaultProfileLabel:l,draft:t[e.id]??null,profileOptions:n(i===``||i===`__custom__`?null:i),connections:o,onDraftChange:s,onToggle:c},e.id)})})]},e.id))})}function rr(e,t){let n={};for(let r of Object.keys(e)){let i=e[r]??null;Zn(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 ir(e){let t={};for(let n of Object.keys(e))t[n]=null;return t}function ar({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(!$n(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=>Zn(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)(()=>rr(c,i),[c,i]),buildResetPatch:(0,Q.useCallback)(()=>ir(c),[c])}}function or({assistantId:e,onClose:t}){let{t:r}=i(`settings`),{data:a}=n({...C({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)(()=>K(o,s),[o,s]),f=T(),p=_t(),m=(0,Q.useMemo)(()=>({requireOwnProviderAndModel:p}),[p]),h=ue(),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),[w,E]=(0,Q.useState)(!1),{data:D,isLoading:O,isError:k,refetch:A}=n({...Ct({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4,refetchOnWindowFocus:!1}),{data:N}=n({...Jt({path:{assistant_id:e}}),enabled:!!e}),P=(0,Q.useMemo)(()=>(D?.callSites??[]).filter(e=>e.id!==`mainAgent`),[D]),F=!O&&!k&&!!D,L=!!a,R=F&&L,ee=(0,Q.useMemo)(()=>P.map(e=>e.id),[P]),z=a?.llm?.advisorProfile??``,{drafts:te,advisorProfile:ne,advisorDirty:B,callSiteDraftsDirty:re,hasUnsavedDrafts:V,hasValidationError:ie,setDraft:ae,setAdvisor:oe,clearEdits:se,buildSavePatch:H,buildResetPatch:ce}=ar({catalogCallSiteIds:ee,persistedOverrides:c,persistedAdvisor:z,isSeeded:R}),le=(0,Q.useMemo)(()=>new Set(ee),[ee]),U=(0,Q.useCallback)(e=>Bt(l,e),[l]),W=(0,Q.useCallback)(e=>({value:e.name,label:Ge(e),...ft(e,l,m)===`undispatchable`?{icon:(0,$.jsx)(u,{className:`h-3.5 w-3.5 text-[var(--system-mid-strong)]`}),tooltip:zt(e)}:{}}),[l,m]),de=(0,Q.useMemo)(()=>Xe(l,[z],m).map(W),[l,z,W,m]),pe=(0,Q.useMemo)(()=>{let e=_.trim().toLowerCase();return e===``||`advisor`.includes(e)||`second opinion`.includes(e)},[_]),G=(0,Q.useMemo)(()=>P.some(e=>Qn(e,c[e.id])!==null),[P,c]),me=(0,Q.useMemo)(()=>Object.entries(c).some(([e,t])=>le.has(e)&&(t?.profile!=null||t?.provider!=null||t?.model!=null)),[c,le]),he=(0,Q.useCallback)(e=>[...Xe(l,[e],m).map(W),{value:Xn,label:r(`overridesDetailPanel.customProfileOption`)}],[l,W,m,r]),ge=(0,Q.useMemo)(()=>{if(!_.trim())return P;let e=_.toLowerCase();return P.filter(t=>(t.displayName??``).toLowerCase().includes(e)||(t.description??``).toLowerCase().includes(e)||(t.domain??``).toLowerCase().includes(e))},[P,_]),_e=(0,Q.useMemo)(()=>{if(!D)return[];let e=D.domains.map(e=>e.id),t=new Map(D.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 i=new Set(e),a=ge.filter(e=>!i.has(e.domain));return a.length>0&&n.push({domain:{id:`other`,displayName:r(`overridesDetailPanel.otherDomain`)},sites:a}),n},[D,ge,r]),ve=(0,Q.useCallback)((e,t)=>{if(!t){ae(e,null);return}let n=Dt(l,P.find(t=>t.id===e)?.defaultProfile,m);if(n)ae(e,{profile:n});else{let t=f[0]??rt[0];ae(e,{provider:t,model:qe(t)??``})}},[P,l,f,ae,m]),ye=(0,Q.useCallback)(async()=>{b(!0);try{let n=H();await h.mutateAsync({path:{assistant_id:e},body:{llm:{...re?{callSites:n}:{},...B?{advisorProfile:ne}:{}}}}),t(),Y.success(r(`overridesDetailPanel.overridesSavedToast`))}catch(e){Y.error(r(`overridesDetailPanel.saveFailedToast`)),j(e,{context:`call_site_overrides_save`})}finally{b(!1)}},[H,re,B,ne,t,h,e,r]),be=(0,Q.useCallback)(async()=>{b(!0);try{let n=ce();await h.mutateAsync({path:{assistant_id:e},body:{llm:{callSites:n}}}),t(),Y.success(r(`overridesDetailPanel.overridesResetToast`))}catch(e){Y.error(r(`overridesDetailPanel.resetFailedToast`)),j(e,{context:`call_site_overrides_reset`})}finally{b(!1)}},[ce,t,h,e,r]),xe=(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[me&&(0,$.jsx)(I,{variant:`outlined`,onClick:()=>S(!0),disabled:y||!R,tintColor:`var(--system-negative-strong)`,className:`mr-auto`,children:r(`overridesDetailPanel.resetToDefaults`)}),(0,$.jsx)(I,{variant:`primary`,onClick:()=>void ye(),disabled:!V||ie||y,children:y?(0,$.jsx)(g,{className:`h-4 w-4 animate-spin`}):r(`overridesDetailPanel.save`)})]});return(0,$.jsxs)(fe,{title:r(`overridesDetailPanel.title`),closeVariant:`outlined`,onClose:t,footer:xe,children:[(0,$.jsx)(`p`,{className:`mb-4 text-body-medium-lighter text-[var(--content-tertiary)]`,children:r(`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)(M,{type:`search`,value:_,onChange:e=>v(e.target.value),placeholder:r(`overridesDetailPanel.searchPlaceholder`),leftIcon:(0,$.jsx)(d,{className:`h-4 w-4`}),fullWidth:!0})}),(0,$.jsx)(I,{variant:`outlined`,onClick:()=>E(!0),disabled:!R||y||V||!G,title:V?r(`overridesDetailPanel.bulkChangeUnsavedTitle`):G?void 0:r(`overridesDetailPanel.bulkChangeNoCandidatesTitle`),children:r(`overridesDetailPanel.bulkChange`)})]}),L&&pe&&(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:r(`overridesDetailPanel.advisorSection`)}),(0,$.jsx)(Yn,{value:ne,profileOptions:de,disabled:y,onChange:oe})]}),O&&(0,$.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,$.jsx)(g,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`})}),k&&(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:r(`overridesDetailPanel.loadErrorTitle`)}),(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:r(`overridesDetailPanel.loadErrorHint`)}),(0,$.jsx)(I,{variant:`outlined`,onClick:()=>void A(),children:r(`overridesDetailPanel.retry`)})]}),!O&&!k&&D&&(0,$.jsx)(nr,{groups:_e,drafts:te,buildProfileOptionsForRow:he,profileLabelFor:U,advisorMatchesSearch:pe,connections:N?.connections,onDraftChange:ae,onToggle:ve})]}),w&&D&&(0,$.jsx)(er,{assistantId:e,callSites:P,domains:D.domains,persistedOverrides:c,orderedProfiles:l,onClose:()=>E(!1),onApplied:se}),(0,$.jsx)(st,{open:x,title:r(`overridesDetailPanel.resetToDefaults`),message:r(`overridesDetailPanel.resetConfirmMessage`),confirmLabel:r(`overridesDetailPanel.resetToDefaults`),destructive:!0,onConfirm:()=>{S(!1),be()},onCancel:()=>S(!1)})]})}var sr=e(l(),1);function cr({mode:e,connection:n,assistantId:r,existingNames:a,connections:s,variant:c=`modal`,actionsSlot:l,onSave:u,onCancel:d}){let{t:f}=i(`settings`),[p,m]=(0,Q.useState)(n?.label??``),h=n?.name??``,g=n?.provider??`anthropic`,_=n?.auth.type??`api_key`,[v,y]=(0,Q.useState)(()=>n?.auth.type===`api_key`?n.auth.credential:n?``:`credential/anthropic/api_key`),[b,S]=(0,Q.useState)(n?.baseUrl??``),[C,w]=(0,Q.useState)(()=>n?.models?n.models.map(e=>e.id).join(`, `):``),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(null),k=g===`openai-compatible`,A=we(g),j=R(g),[N,P]=(0,Q.useState)(``),[L,z]=(0,Q.useState)(!1),B=o(),re=(0,Q.useMemo)(()=>ee(v),[v]),V=_===`api_key`&&re!==null,{hasStoredCredential:ae,isLoading:H}=oe({assistantId:r,credentialKind:`credential`,credentialName:re?`${re.service}:${re.field}`:``,enabled:V}),{credentials:le}=U({assistantId:r,enabled:_===`api_key`});(0,Q.useEffect)(()=>{let e=n?.provider??`anthropic`;m(n?.label??``),n?.auth.type===`api_key`?y(n.auth.credential):y(n?``:`credential/${e}/api_key`),O(null),S(n?.baseUrl??``),w(n?.models?n.models.map(e=>e.id).join(`, `):``),P(``),z(!1)},[n]);let W=p.trim()!==(n?.label??``).trim(),ue=k&&W?se(p,s,n?.name):null,de=h.trim().length>0&&ue===null;async function fe(){if(de){E(!0),O(null);try{let e;if(_===`api_key`){let t=v.trim()||`credential/${g}/api_key`,n=N.trim();if(n){z(!0);try{let e=ee(t);await je({path:{assistant_id:r},body:e?{type:`credential`,name:`${e.service}:${e.field}`,value:n}:{type:`api_key`,name:g,value:n},throwOnError:!0});let i=te(r,`credential`,e?`${e.service}:${e.field}`:``);B.setQueryData(i,!0),B.invalidateQueries({queryKey:x({path:{assistant_id:r}})})}catch{O(f(`providerEditorContent.failedSaveApiKey`));return}finally{z(!1)}}e={type:`api_key`,credential:t}}else if(n)e=n.auth;else{O(f(`providerEditorContent.nothingToEdit`));return}let t=p.trim()||null,i={auth:e,label:t,...A&&{base_url:b.trim()||null},...j&&{models:C.trim()?C.split(`,`).map(e=>({id:e.trim()})).filter(e=>e.id):null}},{data:a,error:o,response:s}=await qt({path:{assistant_id:r,name:n?.name??h.trim()},body:i});if(!s?.ok){O(ie(s?.status,o)??Te(s?.status));return}if(!a){O(f(`providerEditorContent.emptyServerResponse`));return}jt(a,f),u(a)}catch{O(f(`providerEditorContent.failedSaveProvider`))}finally{E(!1)}}}let me=le.filter(e=>e.service===g),K=e!==`create`&&n?.auth.type===`api_key`,he=me.length>0||K,ge=pe(f(`providerEditorContent.apiKeyPlaceholder`),ae);if(e===`create`)return(0,$.jsx)(ce,{variant:c===`panel`?`inline`:`modal`,actionsSlot:l,assistantId:r,existingNames:a,connections:s,defaultProviderType:g,onCreated:u,onCancel:d});let ve=(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)(t,{i18nKey:`providerEditorContent.displayNameLabel`,ns:`settings`,components:{optional:(0,$.jsx)(`span`,{className:`text-[var(--content-disabled)]`})}})}),(0,$.jsx)(M,{value:p,onChange:e=>m(e.target.value),placeholder:f(`providerEditorContent.displayNamePlaceholder`),fullWidth:!0}),ue?(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:ne[ue]}):null]}),A&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:f(`providerEditorContent.baseUrlLabel`)}),(0,$.jsx)(M,{value:b,onChange:e=>S(e.target.value),placeholder:f(g===`ollama`?`providerEditorContent.baseUrlPlaceholderOllama`:g===`opencode`?`providerEditorContent.baseUrlPlaceholderOpencode`:`providerEditorContent.baseUrlPlaceholder`),fullWidth:!0}),g===`ollama`?(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:f(`providerEditorContent.baseUrlHintOllama`)}):null,g===`opencode`?(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:f(`providerEditorContent.baseUrlHintOpencode`)}):null]}),j&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:f(`providerEditorContent.modelsLabel`)}),(0,$.jsx)(M,{value:C,onChange:e=>w(e.target.value),placeholder:f(`providerEditorContent.modelsPlaceholder`),fullWidth:!0}),(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`text-[var(--content-tertiary)]`,children:f(`providerEditorContent.modelsHint`)})]}),_===`api_key`&&(0,$.jsx)(F,{apiKeyValue:N,onApiKeyChange:P,credential:v,onCredentialChange:y,isLoadingCredential:H,apiKeyPlaceholder:ge,provider:g,providerCredentials:me,showAdvancedSection:he,onError:O}),_===`oauth_subscription`&&(0,$.jsx)(_e,{assistantId:r,onConnected:u}),D&&(0,$.jsx)(G,{variant:`body-small-default`,as:`p`,className:`text-(--system-negative-strong)`,children:D})]}),ye=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{variant:`ghost`,onClick:d,children:f(`providerEditorContent.cancel`)}),(0,$.jsx)(I,{variant:`primary`,disabled:!de||T||L,onClick:()=>void fe(),children:f(T?`providerEditorContent.saving`:`providerEditorContent.saveChanges`)})]});return c===`panel`?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[ve,l===void 0?(0,$.jsx)(`div`,{className:`flex justify-end gap-2`,children:ye}):l&&(0,sr.createPortal)(ye,l)]}):(0,$.jsxs)(Z.Content,{size:`md`,children:[(0,$.jsxs)(Z.Header,{children:[(0,$.jsx)(Z.Title,{children:f(`providerEditorContent.editProviderTitle`)}),(0,$.jsx)(Z.Description,{children:n?f(`providerEditorContent.editingConnection`,{name:Oe(n)}):f(`providerEditorContent.editProviderSettingsFallback`)})]}),(0,$.jsx)(Z.Body,{children:ve}),(0,$.jsx)(Z.Footer,{children:ye})]})}function lr({assistantId:e,connectionName:t,onClose:r}){let{t:a}=i(`settings`),s=o(),[c,l]=(0,Q.useState)(null),{data:u}=n(Jt({path:{assistant_id:e}})),d=(0,Q.useMemo)(()=>u?.connections??[],[u]),f=(0,Q.useMemo)(()=>t==null?void 0:d.find(e=>e.name===t),[t,d]),p=t!=null&&u!=null&&f==null;(0,Q.useEffect)(()=>{p&&r()},[p,r]);function m(){s.invalidateQueries({queryKey:xe({path:{assistant_id:e}})}),s.invalidateQueries({queryKey:lt({path:{assistant_id:e}})}),r()}return(0,$.jsx)(fe,{title:f?Oe(f):a(`providerDetailPanel.addProviderTitle`),closeVariant:`outlined`,onClose:r,footer:(0,$.jsx)(`div`,{ref:l,className:`flex justify-end gap-2`}),children:t==null||f!=null?(0,$.jsx)(cr,{mode:f?`edit`:`create`,connection:f,variant:`panel`,actionsSlot:c,assistantId:e,existingNames:d.map(e=>e.name),connections:d,onSave:m,onCancel:r}):null})}var ur={vellum:{provider:`vellum`},deepgram:{provider:`deepgram`,credentialService:`deepgram`},openai:{provider:`openai-whisper`,credentialService:`openai`}},dr={vellum:`vellum`,deepgram:`deepgram`,"openai-whisper":`openai`},fr=`deepgram`;function pr({assistantId:e,hideSaveButton:t=!1,hideCredentialsGuide:r=!1,onSaveStateChange:a}={}){let s=J(),c=e??s,l=kt(),u=o(),{t:d}=i(),f=(0,Q.useMemo)(()=>Et(Ee(),{displayName:d(`sttProviderForm.windowsNativeDisplayName`),subtitle:d(`sttProviderForm.windowsNativeSubtitle`),setupWarning:d(`sttProviderForm.windowsNativeSetupWarning`)}).filter(e=>!e.requiresNativeDictation||Rt()),[d]),p=fr,{data:m}=n({...C({path:{assistant_id:c}}),enabled:l,staleTime:3e4}),h=m?.services?.stt,g=h?.mode===`managed`?`vellum`:h?.provider,v=(0,Q.useMemo)(()=>{let e=g?dr[g]:void 0;if(e&&f.some(t=>t.id===e))return e;let t=H(V,p);return f.some(e=>e.id===t)?t:p},[g,f,p]),y=!!g,[b,x]=fn(v),{available:S,currentCode:w,configuredProviderId:T,selectLanguage:E,selecting:O}=xt(c),[k,A]=(0,Q.useState)(!1),j=S&&b===v&&(ur[b]?.provider===T||!!g&&!dr[g]),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(!1),[R,ee]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{let e=H(V,p);e===`macos-native`&&!f.some(t=>t.id===e)&&D(V,p)},[f,p]);let z=(0,Q.useMemo)(()=>f.find(e=>e.id===b)??f[0],[f,b]),te=z.apiKeyPlaceholder!==void 0;(0,Q.useEffect)(()=>{I(H(L+b,``).length>0),P(``)},[b]);let ne=(0,Q.useMemo)(()=>{let e=b!==v,t=N.trim().length>0;return e||t},[b,v,N]),B=(0,Q.useCallback)(async()=>{let e=N.trim();D(V,b),e.length>0&&D(L+b,e);let t=ur[b];ee(!0);try{if(t?.credentialService){let n=e.length>0?e:H(L+b,``);if(n.length>0){let{response:e}=await bt({path:{assistant_id:c},body:{service:t.credentialService,field:`api_key`,value:n,label:`${z.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}}if(t&&(b!==v||!y)||g===`vellum`&&b!==`vellum`){let e=t?.provider??fr,{response:n}=await He({path:{assistant_id:c},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&&I(!0),P(``),u.invalidateQueries({queryKey:et({path:{assistant_id:c}})}),Y.success(d(`sttProviderForm.saveSuccess`)),!0}catch(e){return Y.error(e instanceof Error?e.message:d(`sttProviderForm.saveFailed`)),!1}finally{ee(!1)}},[c,b,N,z,v,y,g,u,d]);(0,Q.useEffect)(()=>{a?.({hasChanges:ne,saving:R,save:B})},[a,ne,R,B]);let re=(0,Q.useCallback)(()=>{D(L+b,``),I(!1),P(``)},[b]),ie=F?d(`sttProviderForm.apiKeyPlaceholderReplace`):z.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:d(`sttProviderForm.providerLabel`)}),(0,$.jsx)(X,{value:b,onChange:x,options:f.map(e=>({value:e.id,label:e.displayName})),"aria-label":d(`sttProviderForm.providerAriaLabel`)})]}),j&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:d(`sttProviderForm.spokenLanguage`)}),(0,$.jsx)(ze,{"aria-label":d(`sttProviderForm.spokenLanguage`),"aria-haspopup":`dialog`,onClick:()=>A(!0),value:at(w,T)}),(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:d(`sttProviderForm.spokenLanguageApplies`)}),(0,$.jsx)(un,{open:k,onOpenChange:A,title:d(`sttProviderForm.spokenLanguage`),currentCode:w,configuredProviderId:T,selectLanguage:E,selecting:O})]}),te&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:d(`sttProviderForm.apiKeyLabel`)}),(0,$.jsx)(M,{type:`password`,value:N,onChange:e=>P(e.target.value),placeholder:ie,fullWidth:!0})]}),z.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)(_,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--system-mid-strong)]`}),(0,$.jsx)(`span`,{children:z.setupWarning})]}),!r&&z.credentialsGuide&&(0,$.jsx)(on,{guide:z.credentialsGuide}),b===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:d(`sttProviderForm.vellumTranscription`)}),(!t||F)&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!t&&(0,$.jsx)(an,{onClick:B,disabled:!ne||R}),F&&(0,$.jsx)(rn,{onClick:re})]})]})}var mr={batch:`sttRoleOverrides.role.batch`,dictation:`sttRoleOverrides.role.dictation`,liveVoice:`sttRoleOverrides.role.liveVoice`,telephony:`sttRoleOverrides.role.telephony`,watch:`sttRoleOverrides.role.watch`};function hr(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 gr({assistantId:e}){let{t}=i(`settings`),r=o(),a=kt(),[s,c]=(0,Q.useState)(null),{data:l}=n({...C({path:{assistant_id:e}}),enabled:a,staleTime:3e4}),u=l?.services?.stt,d=hr(u),{data:f}=n({...Gt({path:{assistant_id:e}}),enabled:a&&d.length>0,staleTime:5*6e4});if(d.length===0)return null;let p=e=>f?.providers?.find(t=>t.id===e)?.displayName??e,m=async n=>{c(n);try{let{response:t}=await He({path:{assistant_id:e},body:{services:{stt:{roles:{[n]:null}}}},throwOnError:!1});if(!t?.ok)throw Error(String(t?.status??``));await r.invalidateQueries({queryKey:et({path:{assistant_id:e}})})}catch{Y.error(t(`sttRoleOverrides.clearFailed`))}finally{c(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:d.map(e=>{let n=mr[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?`${p(e.provider)} · ${e.model}`:p(e.provider)}),(0,$.jsx)(I,{variant:`ghost`,size:`compact`,"aria-label":t(`sttRoleOverrides.clearAria`,{feature:n?t(n):e.role}),className:`[--vbtn-fg:var(--content-tertiary)]`,disabled:s===e.role,onClick:()=>void m(e.role),children:t(`sttRoleOverrides.clear`)})]},e.role)})})]})}function _r(){let{t:e}=i(`settings`),t=J();return(0,$.jsxs)(nn,{title:e(`speechToTextCard.title`),subtitle:e(`speechToTextCard.subtitle`),children:[(0,$.jsx)(pr,{}),(0,$.jsx)(gr,{assistantId:t})]})}async function vr(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 yr(n,r,i):t===`deepgram`?await br(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 yr(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 xr(i,`ElevenLabs rejected the request.`)}}async function br(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 xr(n,`Deepgram rejected the request.`)}}async function xr(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 Sr({assistantId:e,value:t,onChange:n,className:r}){let{t:a}=i(),[o,s]=(0,Q.useState)(!1),{voices:c}=ae(e);if(c.length===0)return null;let l=c.find(e=>e.model===t)??c[0];return(0,$.jsxs)(de.Root,{open:o,onOpenChange:s,children:[(0,$.jsx)(de.Trigger,{asChild:!0,children:(0,$.jsx)(ze,{"aria-label":a(`voicePickerField.ariaLabel`),value:l?ke(l.description):a(`voicePickerField.selectVoice`),className:r})}),(0,$.jsx)(de.Content,{side:`bottom`,align:`start`,className:`w-[var(--radix-popover-trigger-width)] p-1`,children:(0,$.jsx)(z,{assistantId:e,value:t,onChange:n,onSelect:()=>s(!1),showSource:!0,autoScrollToSelected:!0})})]})}var Cr={elevenlabs:`voiceId`,"fish-audio":`referenceId`,xai:`voiceId`};function wr({assistantId:e,hideSaveButton:t=!1,hideCredentialsGuide:r=!1,onSaveStateChange:a}={}){let{t:s}=i(),c=J(),l=e??c,u=Ke.use.name()??`your assistant`,d=kt(),f=o(),{data:m}=n({...Qe({path:{assistant_id:l}}),enabled:d,staleTime:1/0}),h=(0,Q.useMemo)(()=>{let e=m?.providers;if(!e)return Ft;if(e.some(e=>e.id===`vellum`))return e;let t=Ft.find(e=>e.id===`vellum`);return t?[t,...e]:e},[m]),{data:g}=n({...C({path:{assistant_id:l}}),enabled:d,staleTime:3e4}),_=g?.services?.tts,v=_?.mode===`managed`?`vellum`:_?.provider,y=`elevenlabs`,b=(0,Q.useMemo)(()=>v??H(`vellum:voice:ttsProvider`,y),[v,y]),x=!!v,[S,w]=fn(b),[T,E]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(!1),[F,L]=(0,Q.useState)(!1),[R,ee]=(0,Q.useState)(!1),{voices:z,defaultModel:te,fetched:ne}=Mt(l,{enabled:S===`vellum`}),B=_?.providers?.vellum?.model??te??``,[V,ie]=fn(B),ae=z.find(e=>e.model===V)??z[0],[oe,se]=(0,Q.useState)(null),ce=z.some(e=>e.model===B),le=oe??(ne&&B!==``&&!ce),U=(0,Q.useMemo)(()=>h.find(e=>e.id===S)??h[0],[S,h]),W=S===`vellum`&&U.supportsVoiceSelection&&V.trim()!==``&&V.trim()!==B,ue=(0,Q.useCallback)(e=>{let t=H(At+e,``),n=H(Me+e,``);P(t.length>0),k(n),j(n),E(``)},[]);(0,Q.useEffect)(()=>{ue(S)},[S,ue]);let de=(0,Q.useMemo)(()=>{let e=S!==b,t=T.trim().length>0,n=O.trim()!==A;return e||t||n||W},[S,b,T,O,A,W]),fe=(0,Q.useCallback)(async()=>{let e=T.trim(),t=O.trim(),n=U.id;D(re,n),e.length>0&&D(At+n,e),D(Me+n,t);let r=e.length>0?e:H(At+n,``),i=Cr[n];ee(!0);try{if(r.length>0){let{response:e}=await bt({path:{assistant_id:l},body:{service:n,field:`api_key`,value:r,label:`${U.displayName} API Key`},throwOnError:!1});if(!e?.ok)throw Error(`Failed to store API key (HTTP ${e?.status??`?`})`)}let e={...S!==b||!x?{provider:n,mode:n===`vellum`?`managed`:`your-own`}:{},...i?{providers:{[n]:{[i]:t}}}:{},...W?{providers:{vellum:{model:V.trim()}}}:{}};if(Object.keys(e).length>0){let{response:t}=await He({path:{assistant_id:l},body:{services:{tts:e}},throwOnError:!1});if(!t?.ok)throw Error(`Failed to save configuration (HTTP ${t?.status??`?`})`)}return P(r.length>0),j(t),E(``),f.invalidateQueries({queryKey:et({path:{assistant_id:l}})}),Y.success(s(`ttsProviderForm.saved`)),!0}catch(e){return Y.error(e instanceof Error?e.message:s(`ttsProviderForm.saveFailed`)),!1}finally{ee(!1)}},[l,S,V,W,T,O,U,b,x,f,s]);(0,Q.useEffect)(()=>{a?.({hasChanges:de,saving:R,save:fe})},[a,de,R,fe]);let pe=(0,Q.useCallback)(()=>{D(At+S,``),P(!1),E(``)},[S]),G=(0,Q.useCallback)(async()=>{L(!0);try{let e=H(At+S,``),t=T.trim(),n=t.length>0?t:e;if(n.length===0){Y.error(s(`ttsProviderForm.apiKeyRequired`));return}let r=H(Me+S,``),i=O.trim(),a=await vr({provider:S,apiKey:n,voiceId:i.length>0?i:r,text:`Hey! It's ${u}. How does this sound?`});if(a.kind!==`audio`){Y.error(a.message);return}let o=URL.createObjectURL(a.blob);try{let e=new Audio(o);await e.play(),await new Promise(t=>{e.onended=()=>t(),e.onerror=()=>t()})}finally{URL.revokeObjectURL(o)}}finally{L(!1)}},[u,T,S,O,s]),me=N?`•••••••• (Enter a new key to replace)`:U.apiKeyPlaceholder,K=S===`vellum`,he=K&&U.supportsVoiceSelection,ge=(0,$.jsxs)(I,{variant:`link`,size:`compact`,className:`inline-flex h-auto items-center gap-1 px-0 underline [--vbtn-fg:var(--content-tertiary)]`,onClick:()=>{se(!1),z.some(e=>e.model===V)||ie(te||z[0]?.model||``)},children:[(0,$.jsx)(p,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),s(`ttsProviderForm.chooseFromCatalog`)]}),_e=he&&le&&z.length>0?ge: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:s(`ttsProviderForm.provider`)}),(0,$.jsx)(X,{value:S,onChange:w,options:h.map(e=>({value:e.id,label:e.displayName})),"aria-label":s(`ttsProviderForm.providerAriaLabel`)})]}),!K&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:s(`ttsProviderForm.apiKey`)}),(0,$.jsx)(M,{type:`password`,value:T,onChange:e=>E(e.target.value),placeholder:me,fullWidth:!0})]}),he&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:s(`ttsProviderForm.voice`)}),le?(0,$.jsx)(M,{type:`text`,value:V,onChange:e=>ie(e.target.value),placeholder:s(`ttsProviderForm.voiceIdPlaceholder`),"aria-label":s(`ttsProviderForm.customVoiceIdAriaLabel`),fullWidth:!0}):ae?(0,$.jsx)(Sr,{assistantId:l,value:V,onChange:ie}):ne&&(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:s(`ttsProviderForm.noManagedVoices`)})]}),U.supportsVoiceSelection&&!K&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:s(`ttsProviderForm.voiceId`)}),(0,$.jsx)(M,{type:`text`,value:O,onChange:e=>k(e.target.value),placeholder:s(`ttsProviderForm.voiceIdPlaceholder`),fullWidth:!0})]}),!r&&!K&&(0,$.jsx)(on,{guide:U.credentialsGuide}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[!K&&(0,$.jsx)(I,{variant:`outlined`,onClick:G,disabled:F,children:s(F?`ttsProviderForm.testing`:`ttsProviderForm.test`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[_e,!t&&(0,$.jsx)(an,{onClick:fe,disabled:!de||R}),N&&!K&&(0,$.jsx)(rn,{onClick:pe})]})]})]})}function Tr(){let{t:e}=i(`settings`);return(0,$.jsx)(nn,{id:`text-to-speech`,title:e(`textToSpeechCard.title`),subtitle:e(`textToSpeechCard.subtitle`),children:(0,$.jsx)(wr,{})})}var Er=`default`;function Dr(){let{t:e}=i(`settings`),t=J(),r=o(),{data:a}=n({...C({path:{assistant_id:t}}),staleTime:3e4}),s=it({onSuccess:e=>{Vt(r,{path:{assistant_id:t}},e)}}),c=dn(),l=(0,Q.useMemo)(()=>a?a.services?.[`web-fetch`]?.provider||H(`vellum:ai:webFetchProvider`,Er):H(Ae,Er),[a]),u=(0,Q.useMemo)(()=>a?.services?.[`web-fetch`]?.apiBase??``,[a]),[d,f]=(0,Q.useState)(!1),[p,m]=fn(l),[h,_]=fn(u),[v,y]=(0,Q.useState)(``),b=gt.has(p),x=Wt.has(p),{hasStoredCredential:w}=oe({assistantId:t,credentialKind:`api_key`,credentialName:p,enabled:x}),T=v.trim().length>0,E=h.trim(),O=b&&E.length>0,k=p!==l||b&&E!==u.trim(),A=d||x&&!O&&!w&&!T||!k&&!T,N=pe(yt[p]??e(`webFetchCard.apiKeyPlaceholder`),w),P=Ze[p]??``,F=(0,Q.useCallback)(async()=>{f(!0);let n=v.trim(),i=x&&n.length>0;try{i&&await c(p,n),await s.mutateAsync({path:{assistant_id:t},body:{services:{"web-fetch":{provider:p,...b?{apiBase:E}:{}}}}}).catch(t=>{throw Y.error(e(`webFetchCard.configUpdateFailedToast`)),j(t,{context:`patch_daemon_config`}),t})}catch{f(!1);return}f(!1);try{if(D(Ae,p),i){let e=S(p);e&&D(e,n);let i=te(t,`api_key`,p);r.setQueryData(i,!0),r.invalidateQueries({queryKey:i}),y(``)}Y.success(e(`webFetchCard.savedToast`))}catch(t){j(t,{context:`settings-ai-web-fetch-persist-local`}),Y.error(e(`webFetchCard.localPreferencesFailedToast`))}},[x,s,c,r,t,v,p,b,E,e]),I=(0,Q.useCallback)(()=>{let e=S(p);e&&ve(e),y(``),_(``),m(Er),D(Ae,Er)},[p,m,_]);return(0,$.jsx)(nn,{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)(X,{value:p,onChange:m,options:Ot.map(e=>({value:e,label:nt[e]??e}))})]}),b&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(M,{label:e(`webFetchCard.apiBaseLabel`),type:`url`,value:h,onChange:e=>_(e.target.value),placeholder:P||e(`webFetchCard.apiBasePlaceholder`),fullWidth:!0}),P?(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`webFetchCard.apiBaseHint`,{defaultBase:P})}):null]}),x&&(0,$.jsx)(M,{label:e(`webFetchCard.apiKeyLabel`),type:`password`,value:v,onChange:e=>y(e.target.value),placeholder:N,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(an,{onClick:F,disabled:A}),d&&(0,$.jsx)(g,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),x&&(0,$.jsx)(rn,{onClick:I,filled:!0})]})]})})}var Or=`0.10.12`;function kr(){return Je(Or)}function Ar(){let{t:e}=i(`settings`),t=J(),r=o(),a=kt(),{data:s}=n({...C({path:{assistant_id:t}}),enabled:a,staleTime:3e4}),c=it({onSuccess:e=>{Vt(r,{path:{assistant_id:t}},e)}}),l=dn(),u=(0,Q.useMemo)(()=>{if(!s)return H(Pe,`inference-provider-native`);let e=s.services?.[`web-search`];return(e?.mode===`managed`&&e?.provider!==`inference-provider-native`?`vellum`:e?.provider)||H(`vellum:ai:webSearchProvider`,`inference-provider-native`)},[s]),d=(0,Q.useMemo)(()=>s?.services?.[`web-search`]?.apiBase??``,[s]),[f,p]=(0,Q.useState)(!1),[m,h]=fn(u),[_,v]=fn(d),[y,b]=(0,Q.useState)(``),x=St.has(m),S=Nt.has(m),w=ct.has(m),{hasStoredCredential:T}=oe({assistantId:t,credentialKind:`api_key`,credentialName:m,enabled:S}),E=y.trim().length>0,O=_.trim(),k=x&&O.length>0,A=m!==u||x&&O!==d.trim(),N=f||S&&!w&&!k&&!T&&!E||!A&&!E,P=pe(Ye[m]??e(`webSearchCard.apiKeyPlaceholder`),T),F=Be[m]??``,I=(0,Q.useCallback)(async()=>{p(!0);let n=y.trim(),i=$e(m),a=S&&n.length>0;try{a&&await l(m,n),await Yt();let r=m===`vellum`?kr()?{provider:`vellum`,mode:`managed`}:{mode:`managed`}:{provider:m,mode:`your-own`,...x?{apiBase:O}:{}};await c.mutateAsync({path:{assistant_id:t},body:{services:{"web-search":r}}}).catch(t=>{throw Y.error(e(`webSearchCard.configUpdateFailedToast`)),j(t,{context:`patch_daemon_config`}),t})}catch{p(!1);return}p(!1);try{if(D(Pe,m),a){i&&D(i,n);let e=te(t,`api_key`,m);r.setQueryData(e,!0),r.invalidateQueries({queryKey:e}),b(``)}Y.success(e(`webSearchCard.savedToast`))}catch(t){j(t,{context:`settings-ai-web-search-persist-local`}),Y.error(e(`webSearchCard.localPreferencesFailedToast`))}},[S,c,l,r,t,y,m,x,O,e]),L=(0,Q.useCallback)(()=>{let e=$e(m);e&&ve(e),b(``),v(``),h(`inference-provider-native`),D(Pe,`inference-provider-native`)},[m,h,v]);return(0,$.jsx)(nn,{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)(X,{"aria-label":e(`webSearchCard.providerAriaLabel`),value:m,onChange:h,options:Lt.map(e=>({value:e,label:Tt[e]??e}))})]}),m===`vellum`&&(0,$.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`webSearchCard.vellumNote`)}),x&&(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(M,{label:e(`webSearchCard.apiBaseLabel`),type:`url`,value:_,onChange:e=>v(e.target.value),placeholder:F||e(`webSearchCard.apiBasePlaceholder`),fullWidth:!0}),F?(0,$.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`webSearchCard.apiBaseHint`,{defaultBase:F})}):null]}),S&&(0,$.jsx)(M,{label:e(`webSearchCard.apiKeyLabel`),type:`password`,value:y,onChange:e=>b(e.target.value),placeholder:P,fullWidth:!0}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(an,{onClick:I,disabled:N}),f&&(0,$.jsx)(g,{className:`h-4 w-4 animate-spin text-[var(--content-disabled)]`}),S&&(0,$.jsx)(rn,{onClick:L,filled:!0})]})]})})}function jr(){let e=J(),t=P(),[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)(qn,{}),(0,$.jsx)(Gn,{panel:n,onOpenPanel:r,onClosePanel:()=>r(null)}),(0,$.jsx)(Ar,{}),(0,$.jsx)(Dr,{}),(0,$.jsx)(gn,{}),(0,$.jsx)(Tr,{}),(0,$.jsx)(_r,{})]}),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)(or,{assistantId:e,onClose:()=>r(null)},a):o?(0,$.jsx)(lr,{assistantId:e,connectionName:n.kind===`provider`?n.name:null,onClose:()=>r(null)},a):(0,$.jsx)(Jn,{assistantId:e,profileName:n.kind===`profile`?n.name:null,onClose:()=>r(null)},a):null;return s&&t?(0,$.jsx)(sn,{children:s}):s?(0,$.jsx)(cn,{storageKey:`aiSettingsDetailDrawerWidth`,detailKey:a,section:i,detail:s}):i}export{jr as AiPage};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{b as t}from"./react-DPM_L_aA.js";import{Ku as n,Qp as r}from"./index-hiaJ3JFk.js";var i=e(t(),1);function a(e){return new URL(e,window.location.origin).toString()}function o(e){n(a(e))}function s(e){let{open:t,path:n,onClose:a}=e,s=r(),c=(0,i.useRef)(a);return(0,i.useEffect)(()=>{c.current=a}),(0,i.useEffect)(()=>{s&&t&&(o(n),c.current())},[s,t,n]),s}export{s as n,o as t};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{b as t}from"./react-DPM_L_aA.js";import{Ku as n,Qp as r}from"./index-BL1oo6fL.js";var i=e(t(),1);function a(e){return new URL(e,window.location.origin).toString()}function o(e){n(a(e))}function s(e){let{open:t,path:n,onClose:a}=e,s=r(),c=(0,i.useRef)(a);return(0,i.useEffect)(()=>{c.current=a}),(0,i.useEffect)(()=>{s&&t&&(o(n),c.current())},[s,t,n]),s}export{s as n,o as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{O as t}from"./vendor-BdYt2Rah.js";import{b as n,f as r,g as i,t as a}from"./react-DPM_L_aA.js";import{Ey as o,Fy as s,Gr as c,Yr as l,au as u,bv as d,oy as f,yv as p}from"./index-hiaJ3JFk.js";import{a as m,c as h,i as g,o as _,r as v,s as y}from"./provider-key-Y2FCGhud.js";import"./onboarding-step-layout-L7nLBldg.js";var b=e(n(),1),x=a();function S(){let{t:e}=t(`onboarding`),n=r(),[a]=i(),S=a.get(`hosting`),C=d(),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)(c,{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)(f,{"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)(f,{"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)(o,{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)(o,{type:`text`,placeholder:e(`apiKeyScreen.modelsPlaceholder`),value:N,onChange:e=>P(e.target.value),fullWidth:!0}),(0,x.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`apiKeyScreen.modelsHelp`)})]})]}),L&&(0,x.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,x.jsx)(o,{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)(s,{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({[u]:`1`});S&&t.set(`hosting`,S),n(`${p.onboarding.privacy}?${t.toString()}`,l)},className:C?void 0:`h-11 text-base`,children:e(`actions.continue`)}),(0,x.jsx)(s,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:()=>{n(p.onboarding.hosting,l)},className:C?void 0:`h-11 text-base`,children:e(`actions.back`)})]})]})})}export{S as ApiKeyScreen};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{O as t}from"./vendor-BdYt2Rah.js";import{b as n,f as r,g as i,t as a}from"./react-DPM_L_aA.js";import{Ey as o,Fy as s,Gr as c,Yr as l,au as u,bv as d,oy as f,yv as p}from"./index-BL1oo6fL.js";import{a as m,c as h,i as g,o as _,r as v,s as y}from"./provider-key-Af5D49Je.js";import"./onboarding-step-layout-L7nLBldg.js";var b=e(n(),1),x=a();function S(){let{t:e}=t(`onboarding`),n=r(),[a]=i(),S=a.get(`hosting`),C=d(),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)(c,{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)(f,{"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)(f,{"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)(o,{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)(o,{type:`text`,placeholder:e(`apiKeyScreen.modelsPlaceholder`),value:N,onChange:e=>P(e.target.value),fullWidth:!0}),(0,x.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`apiKeyScreen.modelsHelp`)})]})]}),L&&(0,x.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,x.jsx)(o,{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)(s,{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({[u]:`1`});S&&t.set(`hosting`,S),n(`${p.onboarding.privacy}?${t.toString()}`,l)},className:C?void 0:`h-11 text-base`,children:e(`actions.continue`)}),(0,x.jsx)(s,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:()=>{n(p.onboarding.hosting,l)},className:C?void 0:`h-11 text-base`,children:e(`actions.back`)})]})]})})}export{S as ApiKeyScreen};
@@ -1 +1 @@
1
- import{bv as e}from"./index-hiaJ3JFk.js";async function t(){return e()?await window.vellum?.app.versionInfo()??null:null}async function n(){e()&&await window.vellum?.app.openWebsite()}export{n,t};
1
+ import{bv as e}from"./index-BL1oo6fL.js";async function t(){return e()?await window.vellum?.app.versionInfo()??null:null}async function n(){e()&&await window.vellum?.app.openWebsite()}export{n,t};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{b as t,f as n}from"./react-DPM_L_aA.js";import{yv as r}from"./index-BL1oo6fL.js";var i=e(t(),1);function a(){let e=n();return(0,i.useEffect)(()=>{e(`${r.settings.debug}?tab=archive`,{replace:!0})},[e]),null}export{a as ArchiveRedirectPage};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Kn as t,N as n,O as r}from"./vendor-BdYt2Rah.js";import{b as i,t as a}from"./react-DPM_L_aA.js";import{tn as o}from"./icons-CSdHOix6.js";import{Bg as s,Dv as c,Jm as l,Ov as u,ft as d,gy as f,qm as p}from"./index-hiaJ3JFk.js";import"./environment-store-BQgFRH2W.js";var m=e(i(),1),h=a();function g({value:e,max:t,caption:n}){let r=t>0?Math.max(0,Math.min(e/t*100,100)):0,i=r>90;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`div`,{className:`h-2 w-full overflow-hidden rounded-full bg-[var(--surface-active)]`,children:(0,h.jsx)(`div`,{className:`h-full rounded-full transition-[width] duration-200`,style:{width:`${r}%`,backgroundColor:i?`var(--system-negative-strong)`:`var(--system-positive-strong)`}})}),n&&(0,h.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:n})]})}var _=7,v=2e3;function y(e){let t=(0,m.useRef)(0),r=(0,m.useRef)(null),[i,a]=(0,m.useState)(null),o=(0,m.useCallback)(()=>{if(t.current+=1,t.current>=_){t.current=0;let i=s.getState(),o=!i.settingsDeveloperNav;i.setFlag(`settingsDeveloperNav`,o,e),a(n(o?`settings:devModeVersionUnlock.enabled`:`settings:devModeVersionUnlock.disabled`)),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>{a(null),r.current=null},v)}},[e]);return(0,m.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),{onTap:o,message:i}}function b({version:e,loading:t,assistantId:n}){let{t:i}=r(`settings`),{onTap:a,message:s}=y(n);return t?(0,h.jsxs)(`span`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,h.jsx)(o,{className:`h-4 w-4 animate-spin`}),i(`devModeVersionUnlock.loading`)]}):e?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`button`,{type:`button`,className:`break-all text-left text-body-medium-lighter text-[var(--content-default)]`,onClick:a,children:e}),s&&(0,h.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-accent)]`,children:s})]}):(0,h.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`—`})}var x=`currentAssistant`,S=4e3,C=9e4;function w(e,t){return(e.memory?.maxMb??null)!==(t.memory?.maxMb??null)||(e.cpu?.maxCores??null)!==(t.cpu?.maxCores??null)}function T(){let e=d(),{data:r=null,isLoading:i,refetch:a}=t({queryKey:[x,e],queryFn:async()=>{let t=await p(e);return t.ok?t.data:null},retry:!1}),o=r?.id,[s,h]=(0,m.useState)(null),[g,_]=(0,m.useState)(!1),[v,y]=(0,m.useState)(!1),b=(0,m.useRef)(0),T=(0,m.useRef)(0),E=(0,m.useCallback)(async e=>{if(!o)return h(null),_(!1),null;b.current+=1;let t=b.current;_(!0);try{let n=await l(o);return t===b.current?n.ok?(h(n.data),n.data):(e?.keepStaleOnError||h(null),null):null}catch(r){return t===b.current?(e?.keepStaleOnError||h(null),!u(r)&&!e?.keepStaleOnError&&(c(r,{context:`fetch_assistant_healthz`}),f.error(n(`settings:assistantStatusPanel.loadHealthzFailed`))),null):null}finally{t===b.current&&_(!1)}},[o]);return(0,m.useEffect)(()=>{E()},[E]),(0,m.useEffect)(()=>()=>{T.current+=1,y(!1),h(null)},[o]),{assistant:r,assistantLoading:i,healthz:s,healthzLoading:g,healthzPolling:v,refetch:(0,m.useCallback)(async()=>{await a(),await E()},[a,E]),refetchUntilResized:(0,m.useCallback)(async e=>{let t=++T.current,n=Date.now()+C;y(!0);let r=e;try{for(a();Date.now()<n&&t===T.current;){if(await new Promise(e=>setTimeout(e,S)),t!==T.current)return;let e=await E({keepStaleOnError:!0});if(t!==T.current)return;if(e){if(r==null){r=e;continue}if(w(e,r))return}}}finally{t===T.current&&y(!1)}},[E,a])}}function E(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${e.toFixed(0)} MB`}export{g as a,y as i,T as n,b as r,E as t};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Kn as t,N as n,O as r}from"./vendor-BdYt2Rah.js";import{b as i,t as a}from"./react-DPM_L_aA.js";import{tn as o}from"./icons-CSdHOix6.js";import{Bg as s,Dv as c,Jm as l,Ov as u,ft as d,gy as f,qm as p}from"./index-BL1oo6fL.js";import"./environment-store-DOLyKA1V.js";var m=e(i(),1),h=a();function g({value:e,max:t,caption:n}){let r=t>0?Math.max(0,Math.min(e/t*100,100)):0,i=r>90;return(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`div`,{className:`h-2 w-full overflow-hidden rounded-full bg-[var(--surface-active)]`,children:(0,h.jsx)(`div`,{className:`h-full rounded-full transition-[width] duration-200`,style:{width:`${r}%`,backgroundColor:i?`var(--system-negative-strong)`:`var(--system-positive-strong)`}})}),n&&(0,h.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:n})]})}var _=7,v=2e3;function y(e){let t=(0,m.useRef)(0),r=(0,m.useRef)(null),[i,a]=(0,m.useState)(null),o=(0,m.useCallback)(()=>{if(t.current+=1,t.current>=_){t.current=0;let i=s.getState(),o=!i.settingsDeveloperNav;i.setFlag(`settingsDeveloperNav`,o,e),a(n(o?`settings:devModeVersionUnlock.enabled`:`settings:devModeVersionUnlock.disabled`)),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>{a(null),r.current=null},v)}},[e]);return(0,m.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),{onTap:o,message:i}}function b({version:e,loading:t,assistantId:n}){let{t:i}=r(`settings`),{onTap:a,message:s}=y(n);return t?(0,h.jsxs)(`span`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,h.jsx)(o,{className:`h-4 w-4 animate-spin`}),i(`devModeVersionUnlock.loading`)]}):e?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`button`,{type:`button`,className:`break-all text-left text-body-medium-lighter text-[var(--content-default)]`,onClick:a,children:e}),s&&(0,h.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-accent)]`,children:s})]}):(0,h.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`—`})}var x=`currentAssistant`,S=4e3,C=9e4;function w(e,t){return(e.memory?.maxMb??null)!==(t.memory?.maxMb??null)||(e.cpu?.maxCores??null)!==(t.cpu?.maxCores??null)}function T(){let e=d(),{data:r=null,isLoading:i,refetch:a}=t({queryKey:[x,e],queryFn:async()=>{let t=await p(e);return t.ok?t.data:null},retry:!1}),o=r?.id,[s,h]=(0,m.useState)(null),[g,_]=(0,m.useState)(!1),[v,y]=(0,m.useState)(!1),b=(0,m.useRef)(0),T=(0,m.useRef)(0),E=(0,m.useCallback)(async e=>{if(!o)return h(null),_(!1),null;b.current+=1;let t=b.current;_(!0);try{let n=await l(o);return t===b.current?n.ok?(h(n.data),n.data):(e?.keepStaleOnError||h(null),null):null}catch(r){return t===b.current?(e?.keepStaleOnError||h(null),!u(r)&&!e?.keepStaleOnError&&(c(r,{context:`fetch_assistant_healthz`}),f.error(n(`settings:assistantStatusPanel.loadHealthzFailed`))),null):null}finally{t===b.current&&_(!1)}},[o]);return(0,m.useEffect)(()=>{E()},[E]),(0,m.useEffect)(()=>()=>{T.current+=1,y(!1),h(null)},[o]),{assistant:r,assistantLoading:i,healthz:s,healthzLoading:g,healthzPolling:v,refetch:(0,m.useCallback)(async()=>{await a(),await E()},[a,E]),refetchUntilResized:(0,m.useCallback)(async e=>{let t=++T.current,n=Date.now()+C;y(!0);let r=e;try{for(a();Date.now()<n&&t===T.current;){if(await new Promise(e=>setTimeout(e,S)),t!==T.current)return;let e=await E({keepStaleOnError:!0});if(t!==T.current)return;if(e){if(r==null){r=e;continue}if(w(e,r))return}}}finally{t===T.current&&y(!1)}},[E,a])}}function E(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${e.toFixed(0)} MB`}export{g as a,y as i,T as n,b as r,E as t};
@@ -1 +1 @@
1
- import{O as e}from"./vendor-BdYt2Rah.js";import{n as t,t as n}from"./react-DPM_L_aA.js";import{Fy as r,Gr as i,Yo as a,bv as o}from"./index-hiaJ3JFk.js";var s=n();function c({children:e,animateAvatarWaveIn:t=!1,fillsViewport:n=!1}){let r=(0,s.jsx)(i,{avatarWave:`around`,animateAvatarWaveIn:t,children:(0,s.jsx)(`div`,{className:`mx-auto flex min-h-full w-full max-w-xl flex-col items-center px-6 pb-40 text-[var(--content-default)] md:pb-0`,children:(0,s.jsx)(`div`,{className:`flex flex-1 flex-col items-center justify-center`,children:e})})});return n?(0,s.jsx)(`div`,{className:`h-dvh`,children:r}):r}function l({returnTo:n,secondary:i,errorContext:l,fillsViewport:u=!1}){let{t:d}=e(`onboarding`),{loading:f,error:p,login:m,cancel:h}=a(n,{errorContext:l}),g=o(),_=f&&!g,v=()=>{f&&h(),i.onSelect?.()},y=`h-11 text-base`,b=i.href?(0,s.jsx)(r,{variant:`ghost`,size:`regular`,fullWidth:!0,className:y,asChild:!0,children:(0,s.jsx)(t,{to:i.href,onClick:v,children:i.label})}):(0,s.jsx)(r,{variant:`ghost`,size:`regular`,fullWidth:!0,className:y,onClick:v,children:i.label});return(0,s.jsxs)(c,{animateAvatarWaveIn:!0,fillsViewport:u,children:[(0,s.jsx)(`h1`,{className:`text-5xl font-normal tracking-tight md:text-4xl lg:text-5xl xl:text-6xl`,style:{fontFamily:`var(--font-serif)`,animation:`fadeInUp 0.5s ease-out 0.1s both`},children:d(`welcome.title`)}),(0,s.jsx)(`p`,{className:`mt-3 text-body-large-lighter text-[var(--content-tertiary)]`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:d(`welcome.body`)}),p&&(0,s.jsx)(`p`,{className:`mt-4 text-body-small-default text-[var(--system-negative-strong)]`,children:p}),(0,s.jsxs)(`div`,{className:`${p?`mt-4`:`mt-15`} flex w-full max-w-sm flex-col gap-3`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[(0,s.jsx)(r,{variant:`primary`,size:`regular`,fullWidth:!0,className:`h-11 text-base`,disabled:_,onClick:f&&g?h:()=>void m(),children:d(f&&g?`actions.cancel`:`actions.logIn`)}),b]})]})}export{c as n,l as t};
1
+ import{O as e}from"./vendor-BdYt2Rah.js";import{n as t,t as n}from"./react-DPM_L_aA.js";import{Fy as r,Gr as i,Yo as a,bv as o}from"./index-BL1oo6fL.js";var s=n();function c({children:e,animateAvatarWaveIn:t=!1,fillsViewport:n=!1}){let r=(0,s.jsx)(i,{avatarWave:`around`,animateAvatarWaveIn:t,children:(0,s.jsx)(`div`,{className:`mx-auto flex min-h-full w-full max-w-xl flex-col items-center px-6 pb-40 text-[var(--content-default)] md:pb-0`,children:(0,s.jsx)(`div`,{className:`flex flex-1 flex-col items-center justify-center`,children:e})})});return n?(0,s.jsx)(`div`,{className:`h-dvh`,children:r}):r}function l({returnTo:n,secondary:i,errorContext:l,fillsViewport:u=!1}){let{t:d}=e(`onboarding`),{loading:f,error:p,login:m,cancel:h}=a(n,{errorContext:l}),g=o(),_=f&&!g,v=()=>{f&&h(),i.onSelect?.()},y=`h-11 text-base`,b=i.href?(0,s.jsx)(r,{variant:`ghost`,size:`regular`,fullWidth:!0,className:y,asChild:!0,children:(0,s.jsx)(t,{to:i.href,onClick:v,children:i.label})}):(0,s.jsx)(r,{variant:`ghost`,size:`regular`,fullWidth:!0,className:y,onClick:v,children:i.label});return(0,s.jsxs)(c,{animateAvatarWaveIn:!0,fillsViewport:u,children:[(0,s.jsx)(`h1`,{className:`text-5xl font-normal tracking-tight md:text-4xl lg:text-5xl xl:text-6xl`,style:{fontFamily:`var(--font-serif)`,animation:`fadeInUp 0.5s ease-out 0.1s both`},children:d(`welcome.title`)}),(0,s.jsx)(`p`,{className:`mt-3 text-body-large-lighter text-[var(--content-tertiary)]`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:d(`welcome.body`)}),p&&(0,s.jsx)(`p`,{className:`mt-4 text-body-small-default text-[var(--system-negative-strong)]`,children:p}),(0,s.jsxs)(`div`,{className:`${p?`mt-4`:`mt-15`} flex w-full max-w-sm flex-col gap-3`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[(0,s.jsx)(r,{variant:`primary`,size:`regular`,fullWidth:!0,className:`h-11 text-base`,disabled:_,onClick:f&&g?h:()=>void m(),children:d(f&&g?`actions.cancel`:`actions.logIn`)}),b]})]})}export{c as n,l as t};