@vellumai/web 0.11.3-dev.202608181511.30d84a2 → 0.11.3-dev.202608181709.1f85a67

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 (136) hide show
  1. package/dist/assets/{Trans-Dal9WgPa.js → Trans-Cjflukh4.js} +1 -1
  2. package/dist/assets/access-BMLS-Fnk.js +1 -0
  3. package/dist/assets/{account-page-DLdOtjTe.js → account-page-DKZfEhpc.js} +1 -1
  4. package/dist/assets/{acp-run-detail-panel-CY3VzLr8.js → acp-run-detail-panel-CHQcp6at.js} +1 -1
  5. package/dist/assets/{activity-steps-panel-DX3w2bQF.js → activity-steps-panel-Y-khrUIh.js} +1 -1
  6. package/dist/assets/{ai-page-B2iMtgUA.js → ai-page-DU_kjH_s.js} +1 -1
  7. package/dist/assets/{api-key-screen-CCDnT0AW.js → api-key-screen-BvKdp-t9.js} +1 -1
  8. package/dist/assets/{assistant-feature-flag-store-CNWz-RMv.js → assistant-feature-flag-store-DrLJ0Qcv.js} +1 -1
  9. package/dist/assets/{assistant-status-panel-BkuUZfnZ.js → assistant-status-panel-YLnGIq50.js} +1 -1
  10. package/dist/assets/{auth-store-DDMY1UvK.js → auth-store-DdlZ1ww5.js} +1 -1
  11. package/dist/assets/{background-task-detail-panel-CthS1pR0.js → background-task-detail-panel-CH6PZWc-.js} +1 -1
  12. package/dist/assets/{billing-page-DiBQoCOh.js → billing-page-C9KE8hcY.js} +1 -1
  13. package/dist/assets/bookmarks-page-Dfe8bDcH.js +1 -0
  14. package/dist/assets/{build-state-BZ5ujToI.js → build-state-Bjmhv0mc.js} +1 -1
  15. package/dist/assets/{channels-page-route-iNnyrH13.js → channels-page-route-CV1KYFZP.js} +1 -1
  16. package/dist/assets/{chat-C0-tqEYA.js → chat-BDM2Rt2I.js} +1 -1
  17. package/dist/assets/{chat-avatar-D7ZBWcZy.js → chat-avatar-DvxwDikV.js} +1 -1
  18. package/dist/assets/{chat-markdown-message-Yb99u00t.js → chat-markdown-message-BXJf0_QR.js} +1 -1
  19. package/dist/assets/{checkout-continuation-UVo_MUjH.js → checkout-continuation-CbOBM29m.js} +1 -1
  20. package/dist/assets/{checkout-page-BRtFcnh7.js → checkout-page-D-hRf00C.js} +1 -1
  21. package/dist/assets/{client-feature-flag-store-CT2T_Fg7.js → client-feature-flag-store-D5JmN6Ek.js} +1 -1
  22. package/dist/assets/{command-palette-window-page-nIdxmxPV.js → command-palette-window-page-BpJh54nn.js} +1 -1
  23. package/dist/assets/community-page-CEGpM417.js +1 -0
  24. package/dist/assets/{companion-surface-page-BZHSeP1U.js → companion-surface-page-CPVIM_YY.js} +1 -1
  25. package/dist/assets/{composer-settings-Bs2Ux46E.js → composer-settings-CacCpRW8.js} +1 -1
  26. package/dist/assets/{connect-page-C-NGwoX0.js → connect-page-BN5oRdA4.js} +1 -1
  27. package/dist/assets/{consent-controls-CoO2-Jk4.js → consent-controls-DtPeeFwa.js} +1 -1
  28. package/dist/assets/{contacts-page-route-DHEyL9Tb.js → contacts-page-route-DjEvifaN.js} +1 -1
  29. package/dist/assets/{conversation-navigation-DQEOhOXf.js → conversation-navigation-QdQDJsWW.js} +1 -1
  30. package/dist/assets/{conversation-queries-Crrs0Ih6.js → conversation-queries-BkhCpgfG.js} +1 -1
  31. package/dist/assets/{credential-entry-page-DO8ejJMn.js → credential-entry-page-CPamuLmq.js} +1 -1
  32. package/dist/assets/{credentials-page-Dg_4U44n.js → credentials-page-CFW32WuW.js} +1 -1
  33. package/dist/assets/{debug-page-BD2cYW46.js → debug-page-BjuFJknb.js} +1 -1
  34. package/dist/assets/developer-page-BKeIlAhr.js +1 -0
  35. package/dist/assets/{document-viewer-page-BAzglnC-.js → document-viewer-page-CshWr2tW.js} +1 -1
  36. package/dist/assets/{emails-page-DuPfdVXu.js → emails-page-CDo5Hm8w.js} +1 -1
  37. package/dist/assets/{feature-flag-catalog-Cyqf6Ns7.js → feature-flag-catalog-B7WTMM4F.js} +1 -1
  38. package/dist/assets/{first-run-scope-D3O-3xrc.js → first-run-scope-C-EiuVmf.js} +1 -1
  39. package/dist/assets/{format-usd-fmPL7AFm.js → format-usd-D6RSKlCb.js} +1 -1
  40. package/dist/assets/general-page-7GvIVegL.js +1 -0
  41. package/dist/assets/{hatching-screen-W-KZWWUK.js → hatching-screen-BK2AP-yW.js} +1 -1
  42. package/dist/assets/{home-page-route-BIZOmJ93.js → home-page-route-BICKF-V_.js} +1 -1
  43. package/dist/assets/{home-tool-permission-card-CJg95hSQ.js → home-tool-permission-card-BjKBLMiw.js} +1 -1
  44. package/dist/assets/{hosting-screen-CFrm43Dy.js → hosting-screen-B9f0pTOU.js} +1 -1
  45. package/dist/assets/{i18n-DVILRE1E.js → i18n-WHkGP0v4.js} +2 -2
  46. package/dist/assets/{identity-page-route-CFAR3-oq.js → identity-page-route-wXgjTfIf.js} +1 -1
  47. package/dist/assets/{index-DGkWtuxV.js → index-DWHV0D_I.js} +1 -1
  48. package/dist/assets/{inspect-page-DVwUDIGC.js → inspect-page-B42WpFV6.js} +1 -1
  49. package/dist/assets/integrations-page-DuVkrLeG.js +1 -0
  50. package/dist/assets/{intelligence-layout-DMYcgebj.js → intelligence-layout-DPwf5I5_.js} +1 -1
  51. package/dist/assets/{invalidate-memory-queries-Tk48s_wN.js → invalidate-memory-queries-CIErtFeT.js} +1 -1
  52. package/dist/assets/{library-detail-page-CVAqswwJ.js → library-detail-page-BfoeeBIn.js} +1 -1
  53. package/dist/assets/{library-page-BM8tQ9YT.js → library-page-Bp4va37D.js} +1 -1
  54. package/dist/assets/{local-runtime-upgrade-T5WFNI2L.js → local-runtime-upgrade-CFsjLDQO.js} +1 -1
  55. package/dist/assets/{login-flow-Bprf1KQp.js → login-flow-BIBYcOoQ.js} +1 -1
  56. package/dist/assets/{login-page--TV643GJ.js → login-page-B4F-3yLv.js} +1 -1
  57. package/dist/assets/{logout-page-SRy5z9jx.js → logout-page-ReEHLfsa.js} +1 -1
  58. package/dist/assets/{logs-layout-Cu6dKehr.js → logs-layout-TZutPXCD.js} +1 -1
  59. package/dist/assets/{memory-page-route-DA_nZTLy.js → memory-page-route-tBinK8qR.js} +1 -1
  60. package/dist/assets/{memory-router-playground-page-Dl9PFVCI.js → memory-router-playground-page-CMICcZta.js} +1 -1
  61. package/dist/assets/{multi-activity-group-Bb0i9Svk.js → multi-activity-group-mJeyn_8v.js} +1 -1
  62. package/dist/assets/{not-found-B1t0BEMZ.js → not-found-DtC_EDFf.js} +1 -1
  63. package/dist/assets/notifications-page-D2jRRoLP.js +1 -0
  64. package/dist/assets/{oauth-complete-page-CANn6gvA.js → oauth-complete-page-DQJuVVtX.js} +1 -1
  65. package/dist/assets/{oauth-popup-complete-page-myrPEXqa.js → oauth-popup-complete-page-eyeUww88.js} +1 -1
  66. package/dist/assets/{open-workspace-file-X52qB2qp.js → open-workspace-file-BxWvTr0R.js} +2 -2
  67. package/dist/assets/{operational-status-T7FDD0t5.js → operational-status-CQiaZbwn.js} +1 -1
  68. package/dist/assets/{pairing-page-DESl_ZDz.js → pairing-page-C4L9xIsk.js} +1 -1
  69. package/dist/assets/{personality-page-C2CFwqoI.js → personality-page-ifV2Ly9v.js} +1 -1
  70. package/dist/assets/{plans-page-muqh_GKc.js → plans-page-C5LGpzw5.js} +1 -1
  71. package/dist/assets/{platform-login-notice-BsrEG6VV.js → platform-login-notice-C6p4PqvT.js} +1 -1
  72. package/dist/assets/{platform-loopback-page-Dd4S1gEp.js → platform-loopback-page-DGXBiba8.js} +1 -1
  73. package/dist/assets/privacy-page-CjzNCeWl.js +1 -0
  74. package/dist/assets/{privacy-screen-3mFwwApP.js → privacy-screen-BqElyCBC.js} +1 -1
  75. package/dist/assets/{provider-callback-page-CDmIVfCW.js → provider-callback-page-BtXjs3Nf.js} +1 -1
  76. package/dist/assets/{provider-signup-page-DMjdoRvw.js → provider-signup-page-DEc2h5NX.js} +1 -1
  77. package/dist/assets/{remove-from-device-dialog-BDRSkSad.js → remove-from-device-dialog-CRb-Y2da.js} +1 -1
  78. package/dist/assets/{research-onboarding-route-CqzcOFSl.js → research-onboarding-route-Chr89yg5.js} +1 -1
  79. package/dist/assets/{retire-confirm-dialog-DPyqO3ao.js → retire-confirm-dialog-BjtXvcXF.js} +1 -1
  80. package/dist/assets/{review-terms-screen-BdsmSAB0.js → review-terms-screen-D-qvb1wH.js} +1 -1
  81. package/dist/assets/{routes-BFyJrTyc.js → routes-BLMWzYB3.js} +15 -15
  82. package/dist/assets/{runtime-upgrade-banner-BrXnDFJZ.js → runtime-upgrade-banner-BxbiSjfM.js} +1 -1
  83. package/dist/assets/{schedules-page-D8X7smgb.js → schedules-page-CjFWw3_W.js} +1 -1
  84. package/dist/assets/{select-assistant-screen-LQljPdU6.js → select-assistant-screen-BsuwJYzY.js} +1 -1
  85. package/dist/assets/settings-aUfLdBRz.js +1 -0
  86. package/dist/assets/{settings-layout-CY7avGjF.js → settings-layout-Dd5EZjfb.js} +1 -1
  87. package/dist/assets/{settings-navigation-Dt128ttq.js → settings-navigation-DaSxG0Zb.js} +1 -1
  88. package/dist/assets/{share-feedback-modal-BIIdahKH.js → share-feedback-modal-CXXHZ0pE.js} +1 -1
  89. package/dist/assets/{sidebar-tree-B44Neu5H.js → sidebar-tree-BFNHw8U0.js} +1 -1
  90. package/dist/assets/{signup-page-hGN2-FJK.js → signup-page-Cb4hwsdS.js} +1 -1
  91. package/dist/assets/{skill-detail-page-ZwBJ0aya.js → skill-detail-page-DbtCLCjS.js} +1 -1
  92. package/dist/assets/{skill-detail-panel-_VJdDHCj.js → skill-detail-panel-DpWCbORC.js} +1 -1
  93. package/dist/assets/sound-manager-C_OfGZpE.js +1 -0
  94. package/dist/assets/sounds-page-DS3dfn0E.js +1 -0
  95. package/dist/assets/{start-screen-9FGPcIZA.js → start-screen-DAAGQBRG.js} +1 -1
  96. package/dist/assets/{status-badge-pill-B6ZCVsS1.js → status-badge-pill-CCaDOkgw.js} +1 -1
  97. package/dist/assets/{stt-language-picker-modal-7-gnUFiL.js → stt-language-picker-modal-BCceehoL.js} +1 -1
  98. package/dist/assets/{subagent-detail-panel-DtGFlyiW.js → subagent-detail-panel-Bdx8mP2q.js} +1 -1
  99. package/dist/assets/{superpowers-page-BDA48HN2.js → superpowers-page-Bf2gVqt_.js} +1 -1
  100. package/dist/assets/{system-events-page-CCTWFd6R.js → system-events-page-BzHXfybi.js} +1 -1
  101. package/dist/assets/{theme-stage-page-CmF6f7RN.js → theme-stage-page-CF7Y2Nao.js} +1 -1
  102. package/dist/assets/{tool-detail-panel-DvCrzTMc.js → tool-detail-panel-DbeXuW6-.js} +1 -1
  103. package/dist/assets/{upgrade-cancel-page-Bcq16Wq7.js → upgrade-cancel-page-LBtCDPbE.js} +1 -1
  104. package/dist/assets/{upgrade-success-page-gzUkrWTd.js → upgrade-success-page-DLXxfvLv.js} +1 -1
  105. package/dist/assets/{use-app-theme-Z0l8oiAF.js → use-app-theme-Ctc6qUG2.js} +1 -1
  106. package/dist/assets/{use-checkout-dismiss-refresh-qrbpKyD5.js → use-checkout-dismiss-refresh-CrQDcwu4.js} +1 -1
  107. package/dist/assets/{use-command-palette-sections-D3ZIddUs.js → use-command-palette-sections-CoqpqLv8.js} +1 -1
  108. package/dist/assets/{use-edge-swipe-back-BKaFJJL1.js → use-edge-swipe-back-BRaFRc9L.js} +2 -2
  109. package/dist/assets/{use-is-org-ready-BYJTuCXo.js → use-is-org-ready-B-rv0-nk.js} +1 -1
  110. package/dist/assets/{use-onboarding-login-B8dp6OKw.js → use-onboarding-login-B9TNB1cb.js} +1 -1
  111. package/dist/assets/{use-platform-assistant-id-CuqHJket.js → use-platform-assistant-id-COWBauzz.js} +1 -1
  112. package/dist/assets/{use-platform-gate-DJ7NtOkG.js → use-platform-gate-8R99CXWd.js} +1 -1
  113. package/dist/assets/{use-return-to-short-circuit-C6BxMeSM.js → use-return-to-short-circuit-TyskDXwF.js} +1 -1
  114. package/dist/assets/{use-skill-actions-dzjZTfoi.js → use-skill-actions-DzEYf_yj.js} +1 -1
  115. package/dist/assets/{use-sticky-profiles-GXaLsrAN.js → use-sticky-profiles-0khxS8vF.js} +1 -1
  116. package/dist/assets/{use-stt-language-selection-82DrT6kd.js → use-stt-language-selection-DBG-8936.js} +1 -1
  117. package/dist/assets/{use-voice-sample-preview-BHCiYpHq.js → use-voice-sample-preview-DkWIdjMi.js} +1 -1
  118. package/dist/assets/{useTranslation-BBobNyt0.js → useTranslation-G7Ay-pzy.js} +1 -1
  119. package/dist/assets/voice-page-BiAEmFcW.js +1 -0
  120. package/dist/assets/{welcome-screen-CoYW5dEb.js → welcome-screen-6T3FMS9l.js} +1 -1
  121. package/dist/assets/{workflow-detail-panel-BuLfdVdN.js → workflow-detail-panel-Dwmkf-6A.js} +1 -1
  122. package/dist/assets/{workspace-page-CQ0LrVtV.js → workspace-page-CqkWCj10.js} +1 -1
  123. package/dist/index.html +40 -40
  124. package/package.json +1 -1
  125. package/dist/assets/access-Cngxal_O.js +0 -1
  126. package/dist/assets/bookmarks-page-DIzvqlcG.js +0 -1
  127. package/dist/assets/community-page-DK1RRzQb.js +0 -1
  128. package/dist/assets/developer-page-DshJ0gl6.js +0 -1
  129. package/dist/assets/general-page-ImEIWiSl.js +0 -1
  130. package/dist/assets/integrations-page-5xD6UTqR.js +0 -1
  131. package/dist/assets/notifications-page-D7nqzDdY.js +0 -1
  132. package/dist/assets/privacy-page-zsL0qgPk.js +0 -1
  133. package/dist/assets/settings-pnM5iQYW.js +0 -1
  134. package/dist/assets/sound-manager-lHaiHTCh.js +0 -1
  135. package/dist/assets/sounds-page-Co2G6n-5.js +0 -1
  136. package/dist/assets/voice-page-CqgBuO-G.js +0 -1
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{i as t,l as n}from"./local-settings-Bx7FsNo5.js";import{o as r,r as i}from"./device-settings-DZvv4pnY.js";import{t as a}from"./capture-error-DiNp24s6.js";import{t as o}from"./react-BFJW0bSv.js";import{t as s}from"./button-VkxVX0DM.js";import{d as c,h as l,t as u}from"./chunk-5KNZJZUH-BUqIilZr.js";import{n as d}from"./QueryClientProvider-EuRl-wrW.js";import{t as f}from"./useQuery-CTSuec5b.js";import{t as p}from"./useMutation-D2YPyfEH.js";import{t as m}from"./jsx-runtime-BJ8jcmzB.js";import{t as h}from"./cn-Cf8SmgbR.js";import{t as g}from"./card-DUsAeHUS.js";import{d as _,o as v}from"./list-row-CDwzGT9g.js";import{t as y}from"./createLucideIcon-B-ZPaMbU.js";import{t as b}from"./bell-CHRdx4mp.js";import{t as x}from"./check-pgeLaeXx.js";import{t as S}from"./chevron-down-CmQCCo_x.js";import{t as C}from"./circle-alert-DvkPmyIg.js";import{t as w}from"./circle-check-BlOeCme9.js";import{t as T}from"./hard-drive-BV9-fN_J.js";import{t as E}from"./heart-Bd-pnn1X.js";import{t as D}from"./loader-circle-DYe85z3g.js";import{t as O}from"./monitor-BHYV5XBf.js";import{t as k}from"./moon-CZZGDGLY.js";import{C as A,S as j,T as M,b as N,d as ee,h as P,i as F,l as I,m as L,n as R,o as te,t as ne,u as re}from"./composer-settings-Bs2Ux46E.js";import{t as ie}from"./refresh-cw-p138DTtp.js";import{t as ae}from"./rotate-ccw-Cs7aCSL9.js";import{t as oe}from"./smartphone-AcA2Q0mQ.js";import{t as se}from"./sparkles-Bhr0JiLM.js";import{t as ce}from"./sun-BzqYfTxT.js";import{t as le}from"./triangle-alert-43gIbLca.js";import{t as ue}from"./x-zfSDUG5z.js";import{t as z}from"./notice-BlYF-xU3.js";import{t as de}from"./progress-bar-C4e3e4vV.js";import{B as fe,a as pe,o as me,r as he,z as ge}from"./src-qDZBwoEm.js";import{t as _e}from"./tag-Ddzwz3ij.js";import{t as B}from"./input-DkgpMeG9.js";import{t as ve}from"./toggle-0qt1e_3r.js";import{t as V}from"./modal-UYNawsIu.js";import{n as H}from"./toast-DqqWkjsh.js";import{t as ye}from"./confirm-dialog-Drw1adml.js";import{t as be}from"./select-BKyejRky.js";import{t as U}from"./skeleton-D8_lkywC.js";import{C as xe,M as Se,P as Ce,S as we,V as Te,Y as Ee,_ as De,a as Oe,f as ke,i as Ae,p as je,u as Me,v as Ne,z as Pe}from"./local-mode-BNr2MrWI.js";import{t as W}from"./is-electron-wgAC5Mzb.js";import{r as Fe}from"./resolved-assistants-store-BNadgXqb.js";import{i as G,n as Ie,t as Le}from"./api-errors-CASENJGT.js";import{r as Re,t as ze}from"./semver-C2-EZfiR.js";import{i as Be}from"./utils-BEkyAhbA.js";import{$ as Ve,E as He,S as Ue,T as We,Z as Ge,a as Ke,g as qe,n as Je,q as Ye,tt as Xe,w as Ze,x as Qe}from"./auth-store-DDMY1UvK.js";import{t as K}from"./client.gen-CxTOBLiH.js";import{$ as $e,C as et,N as tt,P as nt,Q as rt,T as it,W as at,Wt as ot}from"./sdk.gen-DWvuzSBW.js";import{a as st,o as ct}from"./api-CQ3nejmH.js";import{c as lt}from"./remote-gateway-session-CzPLaXuT.js";import{t as q}from"./client-feature-flag-store-CT2T_Fg7.js";import{d as J}from"./routes-B7wRw3UT.js";import{d as ut,h as dt,o as ft,p as pt,u as mt}from"./platform-detection-Dt0-jSAU.js";import{i as ht,r as gt,t as _t}from"./use-platform-gate-DJ7NtOkG.js";import{A as vt,D as yt,E as bt,Ft as xt,It as St,Lt as Ct,Mt as wt,N as Tt,Nt as Et,O as Dt,Ot,P as kt,Pt as At,T as jt,c as Mt,ft as Nt,j as Pt,k as Ft,kt as It,mt as Lt,v as Rt,w as zt,wt as Bt}from"./react-query.gen-CwRPAiHT.js";import{t as Vt}from"./hard-navigate-CNxvVrtC.js";import{t as Ht}from"./assistant-feature-flag-store-CNWz-RMv.js";import{t as Ut}from"./pointer-BMK9brNn.js";import{n as Wt,t as Gt}from"./retire-confirm-dialog-DPyqO3ao.js";import{a as Kt,i as qt,r as Jt,s as Yt}from"./local-runtime-upgrade-T5WFNI2L.js";import{t as Xt}from"./copy-to-clipboard-D76_3Coc.js";import{t as Zt}from"./proxy-CT_qJI1K.js";import{t as Qt}from"./AnimatePresence-CxaKvfs9.js";import{t as $t}from"./use-reduced-motion-CU3dPXKf.js";import{t as Y}from"./platform-login-notice-BsrEG6VV.js";import{t as en}from"./use-active-assistant-id-BADYKVyx.js";import{t as tn}from"./use-copy-to-clipboard-B7Yrgm0s.js";import{t as X}from"./detail-card-BzCuPjtL.js";import{t as nn}from"./app-info-CvBesesf.js";import{a as rn,i as an,l as on,o as sn}from"./machine-sizes-BEgYDPIN.js";import{t as cn}from"./environment-store-CgcCuCfv.js";import{a as ln,i as un,n as dn,r as fn,t as pn}from"./assistant-status-panel-BkuUZfnZ.js";import{t as mn}from"./settings-divider-DGdHGRSV.js";var hn=y(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),gn=y(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),_n=y(`vibrate`,[[`path`,{d:`m2 8 2 2-2 2 2 2-2 2`,key:`sv1b1`}],[`path`,{d:`m22 8-2 2 2 2-2 2 2 2`,key:`101i4y`}],[`rect`,{width:`8`,height:`14`,x:`8`,y:`5`,rx:`1`,key:`1oyrl4`}]]),Z=e(o(),1),Q=m();function vn(){let e=q.use.velvet(),{theme:t,setThemePreference:n}=L(),r=[{value:`system`,label:`System`,icon:(0,Q.jsx)(O,{className:`h-4 w-4`})},{value:`light`,label:`Light`,icon:(0,Q.jsx)(ce,{className:`h-4 w-4`})},{value:`dark`,label:`Dark`,icon:(0,Q.jsx)(k,{className:`h-4 w-4`})},...e?[{value:`velvet`,label:`Velvet`,icon:(0,Q.jsx)(E,{className:`h-4 w-4`})}]:[]];return(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Theme`}),(0,Q.jsx)(`div`,{className:`mt-2 max-w-[360px]`,children:(0,Q.jsx)(v,{ariaLabel:`Theme`,value:t,onChange:n,items:r})})]})}var yn=Qe,bn=`Please choose a different handle.`;async function xn(e,t){let{data:n,error:r,response:i}=await nt({path:{id:e},body:{handle:t},throwOnError:!1});if(!i)return{kind:`error`,message:G(r,void 0,`Failed to save handle.`)??`Failed to save handle.`};if(i.ok&&n)return{kind:`ok`,data:n};if(i.status===409){let{message:e}=He(r,`handle`,yn.taken);return{kind:`taken`,message:e}}if(i.status===400){let{code:e,message:t}=He(r,`handle`,bn);return{kind:`invalid`,code:e,message:t}}return{kind:`error`,message:G(r,i,`Failed to save handle.`)}}async function Sn(e,t,n){let{data:r,error:i,response:a}=await et({path:{assistant_id:e},query:{handle:t},signal:n,throwOnError:!1});if(Ie(a,i,`Failed to check handle availability.`),!a.ok||!r)throw new Le(a.status,a.status===429?`Too many checks — try again in a moment.`:G(i,a,`Failed to check handle availability.`));return{available:r.available,code:r.code??null,message:r.message??null}}function Cn(e){return/\d{2,}$/.test(e)}var wn=300,Tn=1400;function En({initialHandle:e,inputLabel:t,helperText:n,idleHelperText:r,checkAvailable:i,save:a,onSaved:o,saveSuccessToast:c,fieldId:l}){let[u,d]=(0,Z.useState)(e),[f,p]=(0,Z.useState)(null),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(`idle`),[v,y]=(0,Z.useState)(null),b=$t(),S=(0,Z.useRef)(null),w=(0,Z.useMemo)(()=>u.trim().toLowerCase(),[u]),T=w===e.toLowerCase();(0,Z.useEffect)(()=>{if(T||w.length===0){h(!1),S.current?.abort();return}let e=new AbortController;S.current?.abort(),S.current=e,h(!0);let t=window.setTimeout(async()=>{try{let t=await i(w,e.signal);e.signal.aborted||p(t)}catch(t){e.signal.aborted||y(t instanceof Error?t.message:`Couldn't check availability.`)}finally{e.signal.aborted||h(!1)}},wn);return()=>{window.clearTimeout(t),e.abort()}},[w,T,i]);let E=(()=>{if(v)return v;if(f&&!f.available){let e=f.code;return f.message??(e?yn[e]:`Please choose a different handle.`)}return null})(),O=E?n:T?r??null:m?`Checking availability…`:f?.available?`Available.`:null,k=!T&&!m&&f?.available!==!1&&g!==`saving`,A=(0,Z.useCallback)(async()=>{if(!k)return;_(`saving`),y(null);let e=await a(w);if(e.kind===`ok`){_(`saved`),o(e.data),H.success(c),window.setTimeout(()=>_(`idle`),Tn);return}if(e.kind===`taken`){_(`idle`),p({available:!1,code:`taken`,message:e.message});return}if(e.kind===`invalid`){_(`idle`),p({available:!1,code:e.code,message:e.message});return}_(`error`),y(e.message),H.error(e.message)},[k,w,o,a,c]),j=(()=>{if(T&&u.length>0||u.length===0)return null;let e=m?`checking`:f?.available?`available`:f?.available===!1?`invalid`:null;return e?(0,Q.jsx)(Qt,{mode:`wait`,initial:!1,children:(0,Q.jsxs)(Zt.span,{initial:b?!1:{opacity:0,scale:.85},animate:{opacity:1,scale:1},exit:b?void 0:{opacity:0,scale:.85},transition:{duration:.14,ease:`easeOut`},className:`flex items-center`,"aria-hidden":e!==`available`&&e!==`invalid`,children:[e===`checking`&&(0,Q.jsx)(D,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),e===`available`&&(0,Q.jsx)(x,{className:`h-4 w-4 text-[var(--system-positive-strong)]`,"aria-label":`Available`}),e===`invalid`&&(0,Q.jsx)(C,{className:`h-4 w-4 text-[var(--system-negative-strong)]`,"aria-label":`Not available`})]},e)}):null})(),M=(()=>{switch(g){case`saving`:return(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(D,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),`Saving…`]});case`saved`:return(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(x,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`Saved`]});default:return`Save`}})();return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(B,{label:t,value:u,onChange:e=>{d(e.target.value.replace(/\s+/g,``)),p(null),y(null)},autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,maxLength:30,leftIcon:(0,Q.jsx)(`span`,{className:`select-none font-mono text-[var(--content-tertiary)]`,"aria-hidden":!0,children:`@`}),rightIcon:j,errorText:E??void 0,helperText:O??void 0,"aria-invalid":!!E,fullWidth:!0,"data-testid":`${l}-input`}),(!T||g!==`idle`)&&(0,Q.jsx)(`div`,{className:`flex justify-end`,children:(0,Q.jsx)(s,{variant:`primary`,size:`compact`,onClick:A,disabled:!k,"aria-live":`polite`,"data-testid":`${l}-save`,children:M})})]})}function Dn({initial:e,onSaved:t}){let n=Je.use.refreshSession(),r=Cn(e.username)?`Your handle was auto-generated at signup — pick one you like.`:void 0,i=(0,Z.useCallback)(async e=>await We({username:e}),[]),a=(0,Z.useCallback)((e,t)=>Ue(e,t),[]),o=(0,Z.useCallback)(e=>{t(e),n()},[t,n]);return(0,Q.jsx)(En,{initialHandle:e.username,inputLabel:`User handle`,helperText:`Lowercase letters, digits, hyphens, and underscores. 3–30 characters.`,idleHelperText:r,checkAvailable:a,save:i,onSaved:o,saveSuccessToast:`Profile updated.`,fieldId:`user-handle`})}function On({assistant:e,onSaved:t}){let n=e.handle??``,r=f({...Mt({path:{assistant_id:e.id}})}).data?.results?.[0],i=!!r&&r.subdomain.toLowerCase()===n.toLowerCase(),a=n.length===0?`Your assistant doesn't have a handle yet — claim one to make it mentionable.`:void 0,o=(0,Z.useCallback)(async t=>await xn(e.id,t),[e.id]),s=(0,Z.useCallback)((t,n)=>Sn(e.id,t,n),[e.id]);return i?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(B,{label:`Assistant handle`,value:n,readOnly:!0,disabled:!0,leftIcon:(0,Q.jsx)(`span`,{className:`select-none font-mono text-[var(--content-tertiary)]`,"aria-hidden":!0,children:`@`}),fullWidth:!0,"data-testid":`assistant-handle-input`}),(0,Q.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[`Your assistant's handle is locked because it's used as its email subdomain. To change it,`,` `,(0,Q.jsx)(u,{to:`${J.settings.ai}?release=1#email`,className:`text-[var(--content-link)] underline hover:text-[var(--content-link-hover)]`,children:`release the subdomain`}),` `,`first.`]})]}):(0,Q.jsx)(En,{initialHandle:n,inputLabel:`Assistant handle`,helperText:`Lowercase letters, digits, hyphens, and underscores. 3–30 characters.`,idleHelperText:a,checkAvailable:s,save:o,onSaved:t,saveSuccessToast:`Assistant handle updated.`,fieldId:`assistant-handle`})}function kn(){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,"aria-busy":!0,"aria-live":`polite`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(U,{className:`h-3 w-16`}),(0,Q.jsx)(U,{className:`h-9 w-full rounded-md`}),(0,Q.jsx)(U,{className:`h-3 w-72`})]}),(0,Q.jsx)(U,{className:`h-9 w-full rounded-md`}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(U,{className:`h-3 w-60`}),(0,Q.jsx)(U,{className:`h-7 w-16 rounded-md`})]}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Loading your profile…`})]})}function An(){return(0,Q.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`})}function jn({assistant:e,showHandles:t=!0,children:n}={}){let r=Je.use.user?.()?.email??null;return(0,Q.jsx)(X,{title:`Profile`,subtitle:`Manage your account details and preferences.`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[r&&(0,Q.jsx)(`div`,{className:`max-w-[420px]`,children:(0,Q.jsx)(B,{label:`Email`,value:r,disabled:!0,readOnly:!0})}),t&&(0,Q.jsxs)(Q.Fragment,{children:[r&&(0,Q.jsx)(An,{}),(0,Q.jsx)(Mn,{assistant:e})]}),n!=null&&(0,Q.jsxs)(Q.Fragment,{children:[(r||t)&&(0,Q.jsx)(An,{}),n]})]})})}function Mn({assistant:e}){let[t,n]=(0,Z.useState)(null),[r,i]=(0,Z.useState)(null),a=$t(),[o,s]=(0,Z.useState)(e??null);return(0,Z.useEffect)(()=>{s(e??null)},[e]),(0,Z.useEffect)(()=>{let e=!1;return Ze().then(t=>{e||n(t)}).catch(t=>{e||i(t instanceof Error?t.message:`Failed to load profile.`)}),()=>{e=!0}},[]),r?(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:r}):t?(0,Q.jsxs)(Zt.div,{initial:a?!1:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.22,ease:`easeOut`},className:`flex flex-col gap-6`,children:[(0,Q.jsx)(Dn,{initial:t,onSaved:n}),o&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Q.jsx)(On,{assistant:o,onSaved:s})]})]}):(0,Q.jsx)(kn,{})}var Nn=Rt({query:{hosting:`platform`}});function Pn(){let e=en(),t=f(Nn),n=t.data?.results??[];return t.isPending||n.length<2?null:(0,Q.jsx)(X,{title:`Switch Assistant`,subtitle:`Choose which assistant is active for this account.`,children:(0,Q.jsx)(`div`,{className:`space-y-2`,children:n.map(t=>{let n=t.id===e;return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-lg border px-4 py-3 ${n?`border-[var(--border-focus)] bg-[var(--surface-lift)]`:`border-[var(--border-base)] bg-[var(--surface-default)]`}`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(O,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:t.name||`Unnamed`}),t.status!==`active`&&(0,Q.jsx)(_e,{tone:`warning`,children:t.status})]})})]}),(0,Q.jsx)(`div`,{className:`shrink-0`,children:n?(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-body-small-default text-[var(--system-positive-default)]`,children:[(0,Q.jsx)(x,{className:`h-4 w-4`}),`Active`]}):(0,Q.jsx)(s,{variant:`outlined`,size:`compact`,disabled:t.status!==`active`,onClick:()=>{Ge(t.id),H.success(`Switched active assistant.`)},children:`Switch`})})]},t.id)})})})}var Fn=[{label:`Never`,seconds:0},{label:`5 min`,seconds:300,devOnly:!0},{label:`10 min`,seconds:600,devOnly:!0},{label:`1 hour`,seconds:3600},{label:`3 hours`,seconds:10800},{label:`1 day`,seconds:86400},{label:`3 days`,seconds:259200},{label:`7 days`,seconds:604800},{label:`14 days`,seconds:1209600},{label:`30 days`,seconds:2592e3}];function In(e){if(e===0)return`Never (sleep disabled)`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600);if(t>0&&n>0)return`${t}d ${n}h`;if(t>0)return`${t} day${t===1?``:`s`}`;if(n>0)return`${n} hour${n===1?``:`s`}`;let r=Math.floor(e/60);return r>0?`${r} minute${r===1?``:`s`}`:`${e}s`}function Ln({assistantId:e}){let t=d(),n=cn.use.isNonProduction(),r=(0,Z.useMemo)(()=>Fn.filter(e=>!e.devOnly||n),[n]),{data:i,isLoading:a,isError:o}=f(vt({path:{id:e}})),c=(0,Z.useMemo)(()=>i?.idle_timeout_seconds??259200,[i]),[l,u]=(0,Z.useState)(null),p=l??c,m=l!==null,h=It({onSuccess:()=>{H.success(`Sleep policy saved.`),u(null),t.invalidateQueries({queryKey:Pt({path:{id:e}})})},onError:()=>{H.error(`Failed to save sleep policy. Please try again.`)}});return a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(D,{className:`h-4 w-4 animate-spin`}),`Loading sleep settings...`]}):o?(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:`Failed to load sleep policy. Refresh the page to try again.`}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:`Idle timeout`}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`How long the assistant can be idle before it is put to sleep. "Never" disables idle sleep entirely.`}),(0,Q.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:r.map(e=>(0,Q.jsx)(s,{variant:`outlined`,active:p===e.seconds,onClick:()=>u(e.seconds),children:e.label},e.seconds))}),(0,Q.jsxs)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:[`Current: `,In(p)]})]}),m&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(s,{variant:`primary`,leftIcon:h.isPending?(0,Q.jsx)(D,{className:`animate-spin`}):void 0,onClick:()=>h.mutate({path:{id:e},body:{idle_timeout_seconds:p}}),disabled:h.isPending,children:`Save`}),(0,Q.jsx)(s,{variant:`outlined`,onClick:()=>u(null),disabled:h.isPending,children:`Cancel`})]})]})}function Rn(e,t,n){let r=[e.version];return e.version===n&&r.push(`(latest)`),t&&e.version===t&&r.push(`(current)`),r.join(` `)}var zn=3e3;function Bn({version:e,assistantId:t}){let{onTap:n,message:r}=un(t);return(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`block min-w-0 break-all text-left text-body-medium-lighter text-[var(--content-default)]`,onClick:n,children:e??`—`}),r&&(0,Q.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-accent)]`,children:r})]})}function Vn({assistantId:e,currentVersion:t,releaseChannel:n,onUpgradeComplete:r}){let i=Ht.use.rollbackEnabled(),a=q.use.previewChannel(),o=d(),c=qt(n,a),l=c===`preview`,[u,m]=(0,Z.useState)(!1),h=(0,Z.useRef)(null),[g,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(null),w=e=>e&&h.current&&e===h.current?(queueMicrotask(()=>{C(b?`Successfully rolled back to version ${h.current}.`:`Successfully updated to version ${h.current}.`),m(!1),h.current=null,_(null),H.success(b?`Rollback complete. Your assistant is healthy.`:`Update complete. Your assistant is healthy.`,{id:`runtime-upgrade-complete`,tone:`strong`}),r?.()}),!1):zn;f({...Dt({path:{id:e}}),refetchInterval:u?e=>w(e.state.data?.current_release_version):!1});let{data:T,isLoading:E}=f(Bt({query:{channel:c}})),O=T?.find(e=>e.is_stable!==!1)??T?.[0],k=g??O?.version??null,A=(0,Z.useMemo)(()=>{if(!i||!k||!t)return!1;let e=Re(k),n=Re(t);return!e||!n?!1:ze(e,n)<0},[i,k,t]),j=(0,Z.useMemo)(()=>{if(!k)return!1;if(!t)return!0;let e=Re(k),n=Re(t);if(!e||!n)return k!==t;let r=ze(e,n);return i?r!==0:r>0},[i,k,t]),M=p({mutationFn:async t=>{let{data:n}=await rt({path:{id:e},body:t,throwOnError:!0});return n}}),N=p({mutationFn:async t=>{let{data:n}=await at({path:{id:e},body:t,throwOnError:!0});return n}});return(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Current`}),(0,Q.jsx)(Bn,{version:t,assistantId:e})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:l?`Preview release`:j?A?`Rollback to`:`Update to`:`Selected`}),(0,Q.jsx)(`span`,{className:`block min-w-0`,children:E?(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(D,{className:`h-3 w-3 animate-spin`}),`Loading...`]}):T&&T.length>0?i?(0,Q.jsx)(be,{value:k??``,onChange:e=>_(e===O?.version?null:e),disabled:u||M.isPending||N.isPending,options:T.map(e=>({value:e.version,label:Rn(e,t,O?.version)}))}):(0,Q.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:O?Rn(O,t,O.version):`—`}):`No releases available`})]})]}),(0,Q.jsx)(s,{variant:A?`outlined`:`primary`,className:`min-w-[160px]`,leftIcon:M.isPending||N.isPending||u?(0,Q.jsx)(D,{className:`animate-spin`}):(0,Q.jsx)(ie,{}),onClick:()=>y(!0),disabled:!j||M.isPending||N.isPending||u||E||!T?.length,children:u?b?`Rolling back...`:`Updating...`:A?`Rollback`:l?`Update preview`:`Update`}),l&&(0,Q.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[`Using Preview releases.`,` `,(0,Q.jsx)(`a`,{href:`#preview-release-channel`,className:`text-[var(--primary-base)] underline-offset-2 hover:underline`,children:`Switch back to Stable`})]}),!j&&t&&k&&!E&&(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:S??`You are already on this version.`}),(0,Q.jsx)(ye,{open:v,title:A?`Rollback assistant`:l?`Update preview release`:`Update assistant`,message:A?`Rollback to version ${k??`unknown`}? The assistant will be briefly unavailable.`:l?`Update to preview version ${k??`latest`}? The assistant will be briefly unavailable during the update.`:`Update to version ${k??`latest`}? The assistant will be briefly unavailable during the update.`,confirmLabel:A?`Rollback`:l?`Update preview`:`Update`,onConfirm:async()=>{y(!1),C(null);let t=i?k??void 0:void 0;try{if(A){let e=await N.mutateAsync({version:t});h.current=e.version??t??null,H.success(e.detail||`Rollback to ${t} initiated.`)}else{let e=await M.mutateAsync({version:t});if(e.detail?.includes(`Already on the latest`)){H.warning(e.detail);return}h.current=e.version??t??null,H.success(e.detail||`Update to ${e.version??t??`latest`} initiated.`)}x(A),m(!0),o.invalidateQueries({queryKey:Ft({path:{id:e}})})}catch{H.error(A?`Failed to trigger rollback. Please try again.`:`Failed to trigger update. Please try again.`)}},onCancel:()=>y(!1)})]})}function Hn({assistantId:e,currentVersion:t,onUpgradeComplete:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(null),{data:c,isLoading:l}=f(Bt({query:{stable:!0,limit:100}})),u=(0,Z.useMemo)(()=>Jt(c),[c]),d=u?.version,p=t?Kt(t,d):!!d,m=Yt({assistantId:e,targetVersion:d});return(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Current`}),(0,Q.jsx)(Bn,{version:t,assistantId:e})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Update to`}),(0,Q.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:l?`Loading...`:d&&u?Rn(u,t,d):`No releases available`})]})]}),(0,Q.jsx)(s,{variant:`primary`,className:`min-w-[160px]`,leftIcon:m.isPending?(0,Q.jsx)(D,{className:`animate-spin`}):(0,Q.jsx)(ie,{}),onClick:()=>i(!0),disabled:m.isPending||l||!d||!p,children:m.isPending?`Updating...`:d?`Update to ${d}`:`Update`}),a&&(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:a}),!a&&!p&&d&&!l&&(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:`You are already on this version.`}),(0,Q.jsx)(ye,{open:r,title:`Update assistant`,message:`Update to version ${d??`latest`}? The assistant will be briefly unavailable during the update.`,confirmLabel:`Update`,onConfirm:async()=>{i(!1),o(null);try{let e=await m.upgrade();o(e.version?`Successfully updated to version ${e.version}.`:`Successfully updated to version ${d??`latest`}.`),H.success(`Update complete. Your assistant is healthy.`,{id:`runtime-upgrade-complete`,tone:`strong`}),n?.()}catch(e){H.error(e instanceof Error?e.message:`Failed to trigger update. Please try again.`)}},onCancel:()=>i(!1)})]})}function Un(){let e=ht({platformHostedOnly:!0}),t=gt(),n=Je.use.user()?.id??null,r=Je.use.logout(),[i,a]=(0,Z.useState)(!1),o=wt({onSuccess:async()=>{H.success(`Account deletion requested. You will be logged out shortly.`),qe(n),await r(),Vt(J.account.login)},onError:()=>{H.error(`Failed to request account deletion. Please try again.`)}}),c=e===`full`&&t;return(0,Z.useEffect)(()=>{c&&i&&a(!1)},[c,i]),e===`gated`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Delete Account`}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Permanently delete your account and all associated data.`}),(0,Q.jsx)(`div`,{className:`mt-1`,children:e===`disabled`?(0,Q.jsx)(Y,{children:`Log in to the Vellum platform to delete your account.`}):(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(s,{variant:`dangerOutline`,onClick:()=>a(!0),disabled:o.isPending||c,className:`self-start`,children:`Delete My Account`}),c&&(0,Q.jsx)(D,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`})]})})]}),(0,Q.jsx)(ye,{open:i,title:`Delete Account`,message:`This will permanently delete your account and all associated data. This action cannot be undone.`,confirmLabel:`Delete Account`,destructive:!0,onConfirm:()=>{if(c){a(!1);return}a(!1),o.mutate({})},onCancel:()=>a(!1)})]})}function Wn({title:e,subtitle:t,benefits:n,ctaLabel:r,ctaLeftIcon:i,onAction:a}){return(0,Q.jsx)(X,{title:e,subtitle:t,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`ul`,{className:`space-y-3`,children:n.map(({icon:e,text:t})=>(0,Q.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md`,style:{background:`var(--surface-base)`},children:(0,Q.jsx)(e,{size:14,style:{color:`var(--content-secondary)`},"aria-hidden":!0})}),(0,Q.jsx)(`span`,{className:`text-body-medium-lighter text-[color:var(--content-secondary)]`,children:t})]},t))}),(0,Q.jsx)(s,{variant:`primary`,size:`regular`,leftIcon:i,onClick:a,className:`self-start`,children:r})]})})}function Gn(){let e=ut(),t=mt(),n=e?`ios`:t?`android`:null,r=n?F(n):null;return r?(0,Q.jsx)(Wn,{title:`Get the ${r.appName} App`,subtitle:`The Vellum ${r.appName} app gives you a native experience.`,benefits:[{icon:b,text:`Push notifications`},{icon:hn,text:`Biometric login`},{icon:_n,text:`Native haptics`},{icon:oe,text:`Home screen access`}],ctaLabel:`Download`,ctaLeftIcon:(0,Q.jsx)(oe,{size:16}),onAction:()=>{I(r.platform),te(r.platform)}}):null}var Kn=`0.10.0`;function qn(){return Be(Kn)}var Jn=[`login.tailscale.com`,`tailscale.com`,`www.tailscale.com`,`ngrok.com`,`dashboard.ngrok.com`,`dash.cloudflare.com`,`cloudflare.com`,`www.cloudflare.com`];function Yn(e){let t;try{t=new URL(e).hostname}catch{return!1}return Jn.includes(t)}function Xn(e){let t;try{t=new URL(e).hostname}catch{return null}return Jn.includes(t)?t.includes(`tailscale`)?`Tailscale`:t.includes(`ngrok`)?`ngrok`:t.includes(`cloudflare`)?`Cloudflare`:null:null}function Zn(e){try{let t=new URL(e).hostname;return t===`localhost`||t===`[::1]`||/^127(?:\.\d{1,3}){3}$/.test(t)}catch{return!1}}function Qn(e){let t=new URL(e);t.search=``,t.hash=``;let n=t.pathname.split(`/`).filter(Boolean),r=n.indexOf(`assistant`);return r>=0&&n.splice(r),t.pathname=n.length?`/${n.join(`/`)}`:`/`,t.toString().replace(/\/+$/,``)}function $n(e){let t;try{t=Qn(e)}catch{return{ok:!1,reason:`unparseable`}}return Zn(t)?{ok:!1,reason:`loopback`}:Yn(t)?{ok:!1,reason:`service-website`}:new URL(t).protocol===`https:`?{ok:!0,url:t}:{ok:!1,reason:`non-https`}}function er(e){let t=new URL(e.verificationUri);return t.hash=new URLSearchParams({device_code:e.deviceCode}).toString(),t.toString()}function tr(e,t){switch(e){case`unparseable`:return`Enter a valid URL, e.g. https://your-assistant.ts.net.`;case`loopback`:return`This is a loopback address other devices can't reach. Enter the assistant's public https URL.`;case`non-https`:return`The URL must use https so your devices can connect securely.`;case`service-website`:return`This is ${t&&Xn(t)||`the tunnel provider`}'s website, not your assistant's address. Run \`vellum tunnel\` on the host to get one.`}}var nr=`/v1/remote-web/pairing-challenge`,rr=`/v1/remote-web/pairing-verification`,ir="If a scan can't connect, make sure a tunnel is running on the host (`vellum tunnel`) and the public URL points at it, then generate a new code.",ar=class extends Error{hint;constructor(e,t){super(e),this.name=`PairDeviceError`,this.hint=t}};function or(){if(typeof window>`u`)return null;let e=je(),t=Oe(e);return t?{base:`${window.location.origin}${t}`,assistantName:e?.name?.trim()||null,ingressUrl:e?.ingressUrl?.trim()||null}:null}function sr(e){let t=e?.error?.message;return typeof t==`string`&&t.trim()?t:null}async function cr(e,t,n){let r;try{r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:n})}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?e:new ar(`Couldn't reach the assistant. Make sure it's running and try again.`)}let i=await r.json().catch(()=>null);if(!r.ok)throw new ar(sr(i)??`Pairing failed (HTTP ${r.status}).`,ir);if(typeof i!=`object`||!i)throw new ar(`The assistant returned an unexpected response.`);return i}async function lr(e){let{base:t,publicBaseUrl:n,signal:r}=e,i=await cr(`${t}${nr}`,{publicBaseUrl:n},r);return await cr(`${t}${rr}`,{userCode:i.userCode},r),{pairUrl:er(i),expiresAt:i.expiresAt}}var ur=Object.defineProperty,dr=Object.getOwnPropertySymbols,fr=Object.prototype.hasOwnProperty,pr=Object.prototype.propertyIsEnumerable,mr=(e,t,n)=>t in e?ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hr=(e,t)=>{for(var n in t||={})fr.call(t,n)&&mr(e,n,t[n]);if(dr)for(var n of dr(t))pr.call(t,n)&&mr(e,n,t[n]);return e},gr=(e,t)=>{var n={};for(var r in e)fr.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&dr)for(var r of dr(e))t.indexOf(r)<0&&pr.call(e,r)&&(n[r]=e[r]);return n},_r;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(_r||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(_r||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(_r||={});var vr=_r,yr={L:vr.QrCode.Ecc.LOW,M:vr.QrCode.Ecc.MEDIUM,Q:vr.QrCode.Ecc.QUARTILE,H:vr.QrCode.Ecc.HIGH},br=128,xr=`L`,Sr=`#FFFFFF`,Cr=`#000000`,wr=!1,Tr=1,Er=4,Dr=0,Or=.1;function kr(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function Ar(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function jr(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*Or),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function Mr(e,t){return t==null?e?Er:Dr:Math.max(Math.floor(t),0)}function Nr({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=Z.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...vr.QrSegment.makeSegments(t)),e),[]);return vr.QrCode.encodeSegments(r,yr[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=Z.useMemo(()=>{let e=c.getModules(),t=Mr(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:jr(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var Pr=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Fr=Z.forwardRef(function(e,t){let n=e,{value:r,size:i=br,level:a=xr,bgColor:o=Sr,fgColor:s=Cr,includeMargin:c=wr,minVersion:l=Tr,boostLevel:u,marginSize:d,imageSettings:f}=n,p=gr(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=gr(p,[`style`]),g=f?.src,_=Z.useRef(null),v=Z.useRef(null),y=Z.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=Z.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=Nr({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});Z.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=Ar(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,Pr?t.fill(new Path2D(kr(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),Z.useEffect(()=>{x(!1)},[g]);let E=hr({height:i,width:i},m),D=null;return g!=null&&(D=Z.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),Z.createElement(Z.Fragment,null,Z.createElement(`canvas`,hr({style:E,height:i,width:i,ref:y,role:`img`},h)),D)});Fr.displayName=`QRCodeCanvas`;var Ir=Z.forwardRef(function(e,t){let n=e,{value:r,size:i=br,level:a=xr,bgColor:o=Sr,fgColor:s=Cr,includeMargin:c=wr,minVersion:l=Tr,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=gr(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=Nr({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=Ar(g,v.excavation)),b=Z.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=kr(y,h);return Z.createElement(`svg`,hr({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&Z.createElement(`title`,null,d),Z.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),Z.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});Ir.displayName=`QRCodeSVG`;function Lr(e){if(!Number.isFinite(e)||e<=0)return`Single-use.`;let t=Math.ceil(e/1e3);return`Expires in ${Math.floor(t/60)}:${(t%60).toString().padStart(2,`0`)} · single-use.`}function Rr({pairUrl:e,remainingMs:t,expired:n,copied:r,onCopy:i}){return n?(0,Q.jsx)(z,{tone:`warning`,title:`This pairing code expired.`,children:`Generate a new code to pair a device.`}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`div`,{className:`w-fit rounded-lg bg-white p-3`,children:(0,Q.jsx)(Ir,{value:e,size:192,level:`M`,title:`Device pairing QR code`})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`code`,{"data-testid":`pair-device-url`,className:`min-w-0 flex-1 truncate rounded-md bg-[var(--surface-active)] px-2.5 py-1.5 text-body-small-default text-[var(--content-secondary)]`,children:e}),(0,Q.jsx)(s,{variant:`outlined`,size:`compact`,leftIcon:r?(0,Q.jsx)(x,{}):(0,Q.jsx)(_,{}),onClick:()=>i(e),children:r?`Copied`:`Copy`})]}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:Lr(t)})]})}var zr=`vellum:pair-device:public-base-url`;function Br(e){let n=e?.trim();if(n)return{url:n,source:`tunnel`};let r=t(zr,``).trim();return r?{url:r,source:`stored`}:{url:``,source:`none`}}function Vr(e,t){let[r]=(0,Z.useState)(()=>Br(t)),[i,o]=(0,Z.useState)(r.url),[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)({kind:`idle`}),[d,f]=(0,Z.useState)(()=>Date.now()),p=(0,Z.useRef)(null);(0,Z.useEffect)(()=>()=>p.current?.abort(),[]),(0,Z.useEffect)(()=>{if(l.kind!==`ready`)return;f(Date.now());let e=setInterval(()=>f(Date.now()),1e3);return()=>clearInterval(e)},[l]);let m=(0,Z.useCallback)(e=>{o(e),c(null)},[]),h=(0,Z.useCallback)(()=>{if(!e)return;let t=i.trim(),r=$n(t);if(!r.ok){c(tr(r.reason,t));return}c(null),p.current?.abort();let o=new AbortController;p.current=o,u({kind:`minting`}),(async()=>{try{let t=await lr({base:e,publicBaseUrl:r.url,signal:o.signal});if(o.signal.aborted)return;n(zr,r.url),u({kind:`ready`,pairUrl:t.pairUrl,expiresAtMs:Date.parse(t.expiresAt)})}catch(e){if(o.signal.aborted)return;if(e instanceof ar){u({kind:`error`,message:e.message,hint:e.hint});return}a(e,{context:`pair-device-mint`}),u({kind:`error`,message:`Something went wrong while generating the code.`})}})()},[e,i]),g=l.kind===`ready`?Math.max(0,l.expiresAtMs-d):0,_=l.kind===`ready`&&g<=0;return{publicBaseUrl:i,setPublicBaseUrl:m,prefillSource:r.source,inputError:s,phase:l,remainingMs:g,expired:_,generate:h}}function Hr(){let e=or(),t=qn(),n=q.use.webRemoteIngress(),r=Vr(e?.base??null,e?.ingressUrl??null),{copy:i,copied:a}=tn({errorMessage:`Could not copy the pairing address.`});if(!e||!t||!n)return null;let{phase:o}=r,c=o.kind===`minting`,l=o.kind===`ready`,u=r.prefillSource===`tunnel`,d=r.prefillSource===`none`&&r.publicBaseUrl.trim()===``,f=c?`Generating…`:l?`Generate new code`:`Generate pairing QR`;return(0,Q.jsx)(X,{title:`Pair a device`,subtitle:`Scan with another device's camera — or open the link on it — to use ${e.assistantName??`this assistant`} there.`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[d&&(0,Q.jsx)(z,{tone:`info`,title:`No tunnel detected`,children:"On this computer, run `vellum tunnel --provider tailscale` (or another provider) — its address appears here."}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(B,{label:`Public URL`,fullWidth:!0,placeholder:`https://your-assistant.ts.net`,helperText:u?"This address comes from `vellum tunnel` on this computer. Edit it if your devices reach this assistant at a different URL.":`The https address your devices can reach this assistant at (your Tailscale URL, or another tunnel's).`,value:r.publicBaseUrl,errorText:r.inputError??void 0,disabled:c,onChange:e=>r.setPublicBaseUrl(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),r.generate())}}),(0,Q.jsx)(s,{variant:`primary`,className:`self-start`,disabled:c||r.publicBaseUrl.trim()===``,onClick:r.generate,children:f})]}),o.kind===`error`&&(0,Q.jsx)(z,{tone:`error`,title:o.message,children:o.hint}),l&&(0,Q.jsx)(Rr,{pairUrl:o.pairUrl,remainingMs:r.remainingMs,expired:r.expired,copied:a,onCopy:i})]})})}async function Ur(){if(!W())return[];let e=window.vellum;return e?.hotkeys?e.hotkeys.get():[]}async function Wr(e,t){if(!W())return;let n=window.vellum;n?.hotkeys&&await n.hotkeys.set(e,t)}function Gr(e){if(!W())return()=>{};let t=window.vellum;return t?.hotkeys?t.hotkeys.onChange(e):()=>{}}var Kr={ArrowUp:`Up`,ArrowDown:`Down`,ArrowLeft:`Left`,ArrowRight:`Right`,Enter:`Return`,NumpadEnter:`Return`,Space:`Space`,Tab:`Tab`,Escape:`Escape`,Backspace:`Backspace`,Delete:`Delete`,Insert:`Insert`,Home:`Home`,End:`End`,PageUp:`PageUp`,PageDown:`PageDown`,Minus:`-`,Equal:`=`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Semicolon:`;`,Quote:`'`,Backquote:"`",Comma:`,`,Period:`.`,Slash:`/`},qr=new Set([`MetaLeft`,`MetaRight`,`ControlLeft`,`ControlRight`,`AltLeft`,`AltRight`,`ShiftLeft`,`ShiftRight`]),Jr=e=>{let t=e.code;return qr.has(t)?null:/^Key[A-Z]$/.test(t)?t.slice(3):/^Digit[0-9]$/.test(t)?t.slice(5):/^Numpad[0-9]$/.test(t)?`num${t.slice(6)}`:/^F[0-9]{1,2}$/.test(t)?t:Kr[t]??null},Yr=e=>{let t=Jr(e);if(t===null)return null;let n=[];return e.metaKey&&n.push(`CmdOrCtrl`),e.ctrlKey&&n.push(`Control`),e.altKey&&n.push(`Alt`),e.shiftKey&&n.push(`Shift`),[...n,t].join(`+`)},Xr=(e,t,n)=>n===``?null:e.find(e=>e.key!==t&&e.accelerator===n)??null,Zr=[{scope:`global`,title:`Global shortcuts`,description:`Work anywhere, even when Vellum is in the background.`},{scope:`menu`,title:`App shortcuts`,description:`Work while a Vellum window is focused.`}];function Qr({hotkey:e,recording:t,conflictLabel:n,onStartRecording:r,onCancelRecording:i,onReset:a,onRemove:o}){let c=e.accelerator===``,l=e.override!==null;return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-2`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`div`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e.label}),n!==null&&(0,Q.jsxs)(`div`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:[`Already used by `,n]})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t?(0,Q.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Recording… press a shortcut, or Esc to cancel`}):c?(0,Q.jsx)(`span`,{className:`text-body-small-default italic text-[var(--content-disabled)]`,children:`Disabled`}):(0,Q.jsx)(he,{accelerator:e.accelerator}),t?(0,Q.jsx)(s,{variant:`ghost`,size:`compact`,onClick:i,children:`Cancel`}):(0,Q.jsx)(s,{variant:`outlined`,size:`compact`,onClick:r,"aria-label":`Record shortcut for ${e.label}`,children:`Record`}),(0,Q.jsx)(s,{variant:`ghost`,size:`compact`,disabled:!l,leftIcon:(0,Q.jsx)(ae,{className:`h-3.5 w-3.5`}),onClick:a,"aria-label":`Reset ${e.label} to default`}),(0,Q.jsx)(s,{variant:`ghost`,size:`compact`,disabled:c,leftIcon:(0,Q.jsx)(ue,{className:`h-3.5 w-3.5`}),onClick:o,"aria-label":`Remove ${e.label} binding`})]})]})}function $r(){let[e,t]=(0,Z.useState)([]),[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(null),o=(0,Z.useCallback)(()=>{Ur().then(t)},[]);(0,Z.useEffect)(()=>(o(),Gr(t)),[o]);let s=(0,Z.useCallback)(()=>{r(null),a(null)},[]);(0,Z.useEffect)(()=>{if(n===null)return;let t=t=>{if(t.preventDefault(),t.stopPropagation(),t.code===`Escape`){s();return}let r=Yr(t);if(r===null)return;let i=Xr(e,n,r);if(i!==null){a({key:n,label:i.label});return}Wr(n,r).then(o),s()};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},[n,e,o,s]);let c=(0,Z.useCallback)(e=>{a(null),r(e)},[]),l=(0,Z.useCallback)(t=>{let n=Xr(e,t,e.find(e=>e.key===t)?.defaultAccelerator??``);if(n!==null){r(null),a({key:t,label:n.label});return}s(),Wr(t,null).then(o)},[e,o,s]),u=(0,Z.useCallback)(e=>{s(),Wr(e,``).then(o)},[o,s]),d=(0,Z.useMemo)(()=>Zr.map(t=>({...t,commands:e.filter(e=>e.rebindable&&e.scope===t.scope)})).filter(e=>e.commands.length>0),[e]);return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[i!==null&&(0,Q.jsxs)(z,{tone:`warning`,children:[`That shortcut is already used by `,i.label,`.`,` `,n===null?`Remove or change that binding before resetting.`:`Pick a different combination, or press Esc to cancel.`]}),d.map(e=>(0,Q.jsxs)(g,{bordered:!0,children:[(0,Q.jsxs)(`div`,{className:`mb-2`,children:[(0,Q.jsx)(`div`,{className:`text-body-medium-emphasised text-[var(--content-default)]`,children:e.title}),(0,Q.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:e.commands.map(e=>(0,Q.jsx)(Qr,{hotkey:e,recording:n===e.key,conflictLabel:i!==null&&i.key===e.key?i.label:null,onStartRecording:()=>c(e.key),onCancelRecording:s,onReset:()=>l(e.key),onRemove:()=>u(e.key)},e.key))})]},e.scope))]})}async function ei(){if(!W())return!1;let e=window.vellum;return e?.launchAtLogin?e.launchAtLogin.get():!1}async function ti(e){if(!W())return;let t=window.vellum;t?.launchAtLogin&&await t.launchAtLogin.set(e)}function ni(){let e=ne.useValue(),t=R.useValue(),n=!Ut(),r=ft()?`Cmd`:`Ctrl`;return(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Composer`}),(0,Q.jsxs)(`div`,{className:`mt-2 space-y-4`,children:[n&&(0,Q.jsx)(ve,{checked:e,onChange:ne.save,label:`Send with ${r}+Enter`,helperText:`When enabled, Enter inserts a new line and ${r}+Enter sends.`}),(0,Q.jsx)(ve,{checked:t,onChange:R.save,label:`Show context window usage`,helperText:`Adds a ring to the composer tracking how full the context window is. Your assistant compacts its context automatically either way.`})]})]})}function ri(){let[e,t]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{ei().then(t)},[]);let n=async e=>{t(e);try{await ti(e)}catch{t(!e)}};return(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Launch at Login`}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Automatically start Vellum when you log in to your Mac.`}),(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(ve,{checked:e,onChange:e=>void n(e),"aria-label":`Launch at Login`})})]})}function ii({open:e,onClose:t}){return(0,Q.jsx)(V.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,Q.jsxs)(V.Content,{size:`lg`,children:[(0,Q.jsxs)(V.Header,{children:[(0,Q.jsx)(V.Title,{children:`Preferences`}),(0,Q.jsx)(V.Description,{children:`Customize shortcuts and how Vellum behaves on this device.`})]}),(0,Q.jsx)(V.Body,{children:(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[W()&&(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Keyboard Shortcuts`}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Customize the shortcuts for Vellum's commands.`}),(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)($r,{})})]}),(0,Q.jsx)(ni,{}),W()&&(0,Q.jsx)(ri,{})]})})]})})}function ai(e){return e===`preview`?`preview`:`stable`}function oi(e){if(!e)return`Unknown`;let t=new Date(e);return Number.isNaN(t.getTime())?`Unknown`:t.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function si(e){return e.source_release_version?`Stable ${e.source_release_version}`:e.snapshot_name}function ci(e){return e.filter(e=>e.ready_to_use)}function li(e){return e?.feature_enabled===!1}function ui({assistantId:e,onComplete:t}){let n=q.use.previewChannel(),r=d(),[i,a]=(0,Z.useState)(),[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),[u,m]=(0,Z.useState)(`restore_backup`),[h,g]=(0,Z.useState)(``),_=bt({path:{assistant_id:e}}),v=yt({path:{assistant_id:e}}),y=Ft({path:{id:e}}),{data:b,isLoading:x,isError:C}=f({..._,enabled:n,retry:!1}),w=b?.preview_backups??[],T=(0,Z.useMemo)(()=>ci(w),[w]),E=T[0],O=T.find(e=>e.snapshot_name===h)??E,k=()=>{r.invalidateQueries({queryKey:v}),r.invalidateQueries({queryKey:y}),t?.()},A=p(zt()),j=p(jt()),M=ai(b?.current_channel),N=A.isPending||j.isPending,ee=N||li(b)||!b?.latest_preview_release,P=u===`restore_backup`&&!O;if((0,Z.useEffect)(()=>{a(M===`preview`?`release-channel`:void 0)},[M]),!n)return null;let F=b?.standard_upgrade_available??!1;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(me.Root,{type:`single`,collapsible:!0,value:i,onValueChange:e=>a(e||void 0),className:`mt-5 border-t border-[var(--border-base)] pt-5`,children:(0,Q.jsxs)(me.Item,{value:`release-channel`,id:`preview-release-channel`,children:[(0,Q.jsxs)(me.Trigger,{className:`group justify-between gap-3`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:`Release Channel`}),b&&(0,Q.jsx)(_e,{tone:M===`preview`?`warning`:`neutral`,children:M===`preview`?`Preview`:`Stable`})]}),(0,Q.jsx)(S,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,Q.jsx)(me.Content,{children:(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[x&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(D,{className:`h-4 w-4 animate-spin`}),`Loading release channel...`]}),C&&(0,Q.jsx)(z,{tone:`error`,title:`Could not load release channel status`,children:`Refresh this page before changing release channels.`}),b&&(0,Q.jsxs)(Q.Fragment,{children:[li(b)&&(0,Q.jsx)(z,{tone:`neutral`,title:`Preview channel is unavailable`,children:`The Preview channel is not enabled for this assistant.`}),M===`stable`?(0,Q.jsx)(di,{status:b,isChangingChannel:N,optInDisabled:ee,onOptIn:()=>s(!0)}):(0,Q.jsx)(fi,{status:b,isChangingChannel:N,onOptOut:()=>{let e=E;g(e?.snapshot_name??``),m(e?`restore_backup`:F?`standard_upgrade`:`restore_backup`),l(!0)}})]})]})})]})}),(0,Q.jsx)(mi,{open:o,isPending:A.isPending,previewVersion:b?.latest_preview_release?.version,onConfirm:async()=>{try{let t=await A.mutateAsync({path:{assistant_id:e}});H.success(t.detail||`Preview channel enabled.`),s(!1),k()}catch(e){H.error(G(e,void 0,`Could not enable Preview channel.`))}},onCancel:()=>s(!1)}),(0,Q.jsx)(hi,{open:c,backups:T,mode:u,selectedSnapshotName:O?.snapshot_name??``,isPending:j.isPending,restoreModeDisabled:P,standardUpgradeAvailable:F,onModeChange:m,onSnapshotChange:g,onConfirm:async()=>{if(!P)try{let t=await j.mutateAsync({path:{assistant_id:e},body:u===`restore_backup`?{mode:`restore_backup`,snapshot_name:O?.snapshot_name}:{mode:`standard_upgrade`}});H.success(t.detail||`Stable channel enabled.`),l(!1),k()}catch(e){H.error(G(e,void 0,`Could not switch to Stable.`))}},onCancel:()=>l(!1)})]})}function di({status:e,isChangingChannel:t,optInDisabled:n,onOptIn:r}){return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(pi,{status:e}),!e.latest_preview_release&&(0,Q.jsx)(z,{tone:`neutral`,title:`No Preview release is available`,children:`Stable remains the only available release channel.`}),(0,Q.jsx)(s,{variant:`outlined`,leftIcon:t?(0,Q.jsx)(D,{className:`animate-spin`}):(0,Q.jsx)(M,{}),disabled:n,onClick:r,children:`Opt in to Preview`})]})}function fi({status:e,isChangingChannel:t,onOptOut:n}){return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(pi,{status:e}),(0,Q.jsx)(s,{variant:`outlined`,leftIcon:t?(0,Q.jsx)(D,{className:`animate-spin`}):(0,Q.jsx)(ae,{}),disabled:t,onClick:n,children:`Switch back to Stable`})]})}function pi({status:e}){return(0,Q.jsxs)(`dl`,{className:`grid gap-3 text-body-medium-lighter sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:`Latest Stable`}),(0,Q.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_stable_release?.version??`None`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:`Latest Preview`}),(0,Q.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_preview_release?.version??`None`})]})]})}function mi({open:e,isPending:t,previewVersion:n,onConfirm:r,onCancel:i}){return(0,Q.jsx)(V.Root,{open:e,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(V.Content,{size:`md`,hideCloseButton:t,children:[(0,Q.jsxs)(V.Header,{icon:le,children:[(0,Q.jsx)(V.Title,{children:`Opt in to Preview`}),(0,Q.jsx)(V.Description,{children:`Preview releases may be unstable. A 90-day safety backup is taken before the image changes.`})]}),(0,Q.jsx)(V.Body,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(z,{tone:`warning`,title:`Data loss may occur when returning to Stable`,children:`Preview data may not be compatible with the Stable channel. The safety backup lets you restore the Stable-channel data that existed before opt-in.`}),(0,Q.jsxs)(`ol`,{className:`list-decimal space-y-2 pl-5 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,Q.jsx)(`li`,{children:`Create and verify a Preview safety backup.`}),(0,Q.jsxs)(`li`,{children:[`Switch to Preview image `,n??`latest`,`.`]}),(0,Q.jsx)(`li`,{children:`Run the normal upgrade path and wait for health.`})]})]})}),(0,Q.jsxs)(V.Footer,{children:[(0,Q.jsx)(s,{variant:`outlined`,disabled:t,onClick:i,children:`Cancel`}),(0,Q.jsx)(s,{variant:`primary`,disabled:t,leftIcon:t?(0,Q.jsx)(D,{className:`animate-spin`}):(0,Q.jsx)(M,{}),onClick:r,children:t?`Switching...`:`Take Backup and Switch`})]})]})})}function hi({open:e,backups:t,mode:n,selectedSnapshotName:r,isPending:i,restoreModeDisabled:a,standardUpgradeAvailable:o,onModeChange:c,onSnapshotChange:l,onConfirm:u,onCancel:d}){return(0,Q.jsx)(V.Root,{open:e,onOpenChange:e=>!e&&d(),children:(0,Q.jsxs)(V.Content,{size:`md`,hideCloseButton:i,children:[(0,Q.jsxs)(V.Header,{icon:le,children:[(0,Q.jsx)(V.Title,{children:`Switch back to Stable`}),(0,Q.jsx)(V.Description,{children:`Choose how this assistant should leave the Preview channel.`})]}),(0,Q.jsx)(V.Body,{children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(fe,{value:n,onValueChange:c,disabled:i,"aria-label":`Stable channel return method`,children:[(0,Q.jsx)(ge,{value:`restore_backup`,disabled:t.length===0,label:`Restore safety backup`,helperText:`Return to the Stable-channel data captured before Preview opt-in.`}),(0,Q.jsx)(ge,{value:`standard_upgrade`,disabled:!o,label:`Switch to Stable without restoring backup`,helperText:o?`Keep the current data and directly switch to the Stable image.`:`Unavailable because the latest Stable release is older than this assistant's Preview release.`})]}),n===`restore_backup`&&t.length>0&&(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-medium-default text-[var(--content-secondary)]`,children:[`Safety backup`,(0,Q.jsx)(be,{value:r,onChange:l,disabled:i,options:t.map(e=>({value:e.snapshot_name,label:`${si(e)} - ${oi(e.created_at)}`}))})]}),n===`restore_backup`&&t.length===0&&!o&&(0,Q.jsx)(z,{tone:`error`,title:`Stable requires a safety backup`,children:`This Preview release is newer than the latest Stable release, so switching directly is blocked. Wait for a newer Stable release, or run Vellum Doctor if the safety backup is missing.`}),n===`standard_upgrade`&&(0,Q.jsx)(z,{tone:`error`,title:`Preview data may not survive this`,children:`Switching directly to the Stable image without restoring the safety backup may cause data loss or leave the assistant unusable if Preview data is incompatible with Stable.`})]})}),(0,Q.jsxs)(V.Footer,{children:[(0,Q.jsx)(s,{variant:`outlined`,disabled:i,onClick:d,children:`Cancel`}),(0,Q.jsx)(s,{variant:n===`standard_upgrade`?`danger`:`primary`,disabled:i||a||n===`standard_upgrade`&&!o,leftIcon:i?(0,Q.jsx)(D,{className:`animate-spin`}):(0,Q.jsx)(ie,{}),onClick:u,children:i?`Switching...`:`Switch to Stable`})]})]})})}var gi=new Set([`exceeds_machine_tier`,`exceeds_storage_tier`]);function _i(e,t){return e&&typeof e==`object`&&!Array.isArray(e)&&`error`in e&&typeof e.error==`string`&&gi.has(e.error)?`That size isn't available on your plan.`:G(e,void 0,t)}function vi({assistant:e,healthz:t,healthzLoading:n,healthzPolling:r,refetch:i,refetchUntilResized:a}){let o=c(),l=pt(),d=f(Lt()),p=d.data,m=!e.is_local,h=p?.plan_id===`pro`,g=f({...Nt(),enabled:h}),_=e.machine_size||`small`,v=rn(g.data?.max_machine_tier??null),y=(0,Z.useMemo)(()=>sn(v,_,(0,Q.jsx)(_e,{tone:`positive`,children:`Current`})),[v,_]),b=g.data?.selected_storage_gib??null,[x,S]=(0,Z.useState)(!1),C=v.length>0?v[v.length-1]:null,[w,E]=(0,Z.useState)(null),O=w??C??_,[k,A]=(0,Z.useState)(!1),[j,M]=(0,Z.useState)(null),N=Ot({onSuccess:(e,n)=>{H.success(`Resize started. Changes will apply shortly.`,{id:`assistant-resize`}),M(null),E(null),S(!1),n.body?.machine_size==null?i():a(t)},onError:e=>{M(_i(e,`Failed to resize assistant. Please try again.`))}});if(d.isError&&p==null)return(0,Q.jsx)(X,{id:`storage-resources`,title:`Compute & Resources`,subtitle:`Monitor resource usage and manage your assistant's compute profile.`,children:(0,Q.jsx)(z,{tone:`error`,children:`Could not load your subscription. Please try again.`})});let ee=h&&v.includes(O)&&O!==_?O:null,P=h&&b!=null&&!0,F=h&&v.length>0&&on(_)<on(v[v.length-1]),I=N.isPending||r,L=b==null?t?.disk?.totalMb??null:b*1024,R=t?.disk&&L!=null?{value:t.disk.usedMb,max:L,caption:`${pn(t.disk.usedMb)} of ${pn(L)}`}:null,te=t?.cpu?{value:t.cpu.currentPercent,max:100,caption:`${t.cpu.currentPercent.toFixed(1)}%`}:null,ne=t?.memory?{value:t.memory.currentMb,max:t.memory.maxMb,caption:`${pn(t.memory.currentMb)} of ${pn(t.memory.maxMb)}`}:null,re=l?null:(0,Q.jsx)(s,{variant:`ghost`,size:`compact`,onClick:()=>A(!0),children:`Resize`}),ae=m?h?P?(0,Q.jsxs)(`button`,{type:`button`,disabled:I,onClick:()=>S(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,Q.jsx)(se,{className:`h-3.5 w-3.5`}),`Increase Storage`]}):(0,Q.jsx)(s,{variant:`ghost`,size:`compact`,disabled:I,onClick:()=>S(!0),children:`Resize`}):re:null,oe=m?h?F?(0,Q.jsxs)(`button`,{type:`button`,disabled:I,onClick:()=>S(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,Q.jsx)(se,{className:`h-3.5 w-3.5`}),`Increase Size`]}):(0,Q.jsx)(s,{variant:`ghost`,size:`compact`,disabled:I,onClick:()=>S(!0),children:`Resize`}):re:null;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{id:`storage-resources`,title:`Compute & Resources`,subtitle:`Monitor resource usage and manage your assistant's compute profile.`,compactAccessory:!0,accessory:(0,Q.jsx)(s,{variant:`ghost`,size:`compact`,iconOnly:n||r?(0,Q.jsx)(D,{className:`animate-spin`}):(0,Q.jsx)(ie,{}),tooltip:r?`Applying resize…`:`Refresh resource metrics`,"aria-label":`Refresh resource metrics`,disabled:n||r,onClick:()=>void i()}),children:(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-[1fr_2fr]`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,Q.jsx)(T,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Disk`})]}),ae]}),(0,Q.jsxs)(`div`,{className:`mt-auto flex flex-col gap-1 pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Storage`}),R?(0,Q.jsx)(ln,{value:R.value,max:R.max,caption:R.caption}):n?(0,Q.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Q.jsx)(D,{className:`h-3 w-3 animate-spin`})}):(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Unavailable`})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,Q.jsx)(gn,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Machine`}),(0,Q.jsx)(_e,{tone:`neutral`,children:an[_]})]}),oe]}),(0,Q.jsxs)(`div`,{className:`mt-auto grid grid-cols-2 gap-3 pt-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`CPU`}),te?(0,Q.jsx)(ln,{value:te.value,max:te.max,caption:te.caption}):n?(0,Q.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Q.jsx)(D,{className:`h-3 w-3 animate-spin`})}):(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Memory`}),ne?(0,Q.jsx)(ln,{value:ne.value,max:ne.max,caption:ne.caption}):n?(0,Q.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Q.jsx)(D,{className:`h-3 w-3 animate-spin`})}):(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]})]})]})]})}),(0,Q.jsx)(V.Root,{open:k,onOpenChange:e=>{e||A(!1)},children:(0,Q.jsxs)(V.Content,{size:`sm`,children:[(0,Q.jsxs)(V.Header,{children:[(0,Q.jsx)(V.Title,{children:`Upgrade your plan`}),(0,Q.jsx)(V.Description,{children:`Move to a higher plan for more power, more storage, and a larger credit bundle.`})]}),(0,Q.jsxs)(V.Footer,{children:[(0,Q.jsx)(s,{variant:`ghost`,onClick:()=>A(!1),children:`Cancel`}),(0,Q.jsx)(s,{onClick:()=>{A(!1),o(J.plans)},children:`Upgrade`})]})]})}),(0,Q.jsx)(V.Root,{open:x,onOpenChange:e=>{e||(S(!1),E(null),M(null))},children:(0,Q.jsxs)(V.Content,{size:`sm`,children:[(0,Q.jsxs)(V.Header,{icon:gn,children:[(0,Q.jsx)(V.Title,{children:`Resize Assistant`}),(0,Q.jsx)(V.Description,{children:`Resize your assistant's compute and storage. Your assistant will briefly restart.`})]}),(0,Q.jsx)(V.Body,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[v.length===0?(0,Q.jsx)(z,{tone:`warning`,children:`No machine tier configured. Visit the community for help.`}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-secondary)]`,children:`Machine Size`}),(0,Q.jsx)(be,{options:y,value:O,onChange:E,"aria-label":`Compute machine size`,"data-testid":`resize-machine-size`})]}),P?(0,Q.jsx)(z,{tone:`info`,children:`Storage will be expanded to ${b} GB.`}):(0,Q.jsx)(z,{tone:`neutral`,children:`Storage will not change.`}),j&&(0,Q.jsx)(z,{tone:`error`,children:j})]})}),(0,Q.jsxs)(V.Footer,{className:l?`justify-end`:`items-center justify-between`,children:[l?null:(0,Q.jsxs)(`span`,{className:`text-label-small-default text-[var(--content-tertiary)]`,children:[`Need more?`,` `,(0,Q.jsx)(u,{to:J.plans,className:`text-[var(--content-secondary)] underline decoration-[var(--border-element)] underline-offset-2 transition-colors hover:text-[var(--content-default)]`,onClick:()=>S(!1),children:`Upgrade plan`})]}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(s,{variant:`ghost`,onClick:()=>{S(!1),E(null),M(null)},children:`Cancel`}),(0,Q.jsx)(s,{disabled:ee==null&&!P||I,leftIcon:I?(0,Q.jsx)(D,{className:`animate-spin`}):void 0,onClick:()=>{M(null);let t={};ee!=null&&(t.machine_size=ee),P&&b!=null&&(t.storage_gib=b),N.mutate({path:{id:e.id},body:t})},children:j?`Retry`:`Apply`})]})]})]})})]})}function yi({assistantId:e}){let t=c(),[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(!1);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(s,{variant:`dangerOutline`,onClick:()=>r(!0),className:`shrink-0`,children:`Retire Assistant`}),(0,Q.jsx)(Gt,{open:n,isPending:i,onConfirm:async()=>{a(!0);let n=await Wt(e);if(n.ok){r(!1),t(n.nextRoute,{replace:!0});return}H.error(n.error),a(!1),r(!1)},onCancel:()=>r(!1)})]})}function bi(){let e=A(),t=N.useValue();return j(e)?(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Q.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Show tips`}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Occasional tips in the sidebar that highlight features you haven't tried yet.`})]}),(0,Q.jsx)(ve,{checked:t,onChange:t=>{N.save(t),t||P(`settings`,`dont_show_again`,e)},"aria-label":`Show tips`})]}):null}var xi=`UTC.Africa/Cairo.Africa/Johannesburg.Africa/Lagos.Africa/Nairobi.America/Anchorage.America/Argentina/Buenos_Aires.America/Bogota.America/Chicago.America/Denver.America/Halifax.America/Lima.America/Los_Angeles.America/Mexico_City.America/New_York.America/Phoenix.America/Santiago.America/Sao_Paulo.America/Toronto.America/Vancouver.Asia/Bangkok.Asia/Dubai.Asia/Hong_Kong.Asia/Jakarta.Asia/Jerusalem.Asia/Karachi.Asia/Kolkata.Asia/Kuala_Lumpur.Asia/Manila.Asia/Seoul.Asia/Shanghai.Asia/Singapore.Asia/Taipei.Asia/Tokyo.Australia/Melbourne.Australia/Perth.Australia/Sydney.Europe/Amsterdam.Europe/Athens.Europe/Berlin.Europe/Brussels.Europe/Dublin.Europe/Istanbul.Europe/Lisbon.Europe/London.Europe/Madrid.Europe/Moscow.Europe/Paris.Europe/Rome.Europe/Stockholm.Europe/Vienna.Europe/Warsaw.Europe/Zurich.Pacific/Auckland.Pacific/Honolulu`.split(`.`);function Si(){let e=Intl;if(typeof e.supportedValuesOf==`function`)try{let t=e.supportedValuesOf(`timeZone`);if(t.length>0)return[...t].sort()}catch{}return[...xi].sort()}function Ci(e){let t=e.split(`/`),n=(t[t.length-1]??e).replace(/_/g,` `),r=t.length>1?(t[0]??``).replace(/_/g,` `):``,i=0,a=``;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??`GMT`;a=t.startsWith(`GMT`)||t.startsWith(`UTC`)?t:`GMT ${t}`;let n=t.match(/([+-])(\d{1,2})(?::(\d{2}))?/);if(n){let e=n[1]===`-`?-1:1,t=parseInt(n[2]??`0`,10),r=parseInt(n[3]??`0`,10);i=e*(t*60+r)}}catch{return null}return{identifier:e,city:n,region:r,offsetLabel:a,offsetMinutes:i}}function wi(e){try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e,hour:`numeric`,minute:`2-digit`,hour12:!0}).format(new Date)}catch{return``}}function Ti(e){if(!e)return`Not set`;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`long`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value;if(t)return t}catch{}return e.replace(/_/g,` `)}var Ei=200;function Di({value:e,onChange:t}){let[n,r]=(0,Z.useState)(``),i=(0,Z.useMemo)(()=>Si().map(e=>Ci(e)).filter(e=>e!==null),[]),a=n.trim().toLowerCase(),o=(0,Z.useMemo)(()=>(a?i.filter(e=>e.city.toLowerCase().includes(a)||e.region.toLowerCase().includes(a)||e.offsetLabel.toLowerCase().includes(a)||e.identifier.toLowerCase().includes(a)):i).slice(0,Ei),[i,a]),s=(0,Z.useMemo)(()=>o.map(e=>e.identifier),[o]),c=(0,Z.useMemo)(()=>{if(!e)return``;let t=e.split(`/`);return(t[t.length-1]??e).replace(/_/g,` `)},[e]);return(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 md:flex-row md:items-center md:justify-between md:gap-4`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Closest city`}),(0,Q.jsxs)(pe.Root,{className:`w-full md:max-w-[280px]`,options:s,value:e,onSelect:t,onOpenChange:e=>{e||r(``)},autoActivateFirst:a.length>0,children:[(0,Q.jsx)(pe.Input,{type:`text`,"aria-label":`Closest city`,value:n,placeholder:c||`Search city or country...`,onChange:e=>r(e.target.value),fullWidth:!0}),(0,Q.jsx)(pe.List,{"aria-label":`Cities`,className:`absolute left-0 right-0 top-full z-20 mt-1 max-h-[240px] rounded-md border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-lg`,emptyState:(0,Q.jsx)(`p`,{className:`px-3 py-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:`No matching cities`}),children:o.map(e=>(0,Q.jsxs)(pe.Option,{value:e.identifier,className:h(`flex w-full items-center justify-between gap-3 px-3 py-2`,`text-body-medium-lighter text-[var(--content-default)] transition-colors`,`hover:bg-[var(--surface-active)]`,`data-[active]:bg-[var(--surface-active)] aria-selected:bg-[var(--surface-active)]`),children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`truncate text-body-medium-default`,children:e.city}),e.region&&(0,Q.jsx)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.region})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(`span`,{children:wi(e.identifier)}),(0,Q.jsx)(`span`,{children:e.offsetLabel})]})]},e.identifier))})]})]}),(0,Q.jsx)(mn,{}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Time zone`}),(0,Q.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:Ti(e)})]})]})}function Oi(){let e=Fe.use.activeAssistantId(),[t,n]=(0,Z.useState)(()=>i(`timezone`,``)),o=(0,Z.useRef)(e);(0,Z.useEffect)(()=>{o.current=e},[e]);let s=(0,Z.useRef)(!1),c=(0,Z.useRef)(null),l=(0,Z.useRef)(()=>{}),u=e=>{if(s.current){c.current=e;return}let t=o.current;if(!t){c.current=null;return}s.current=!0,c.current=null,K.patch({url:`/v1/assistants/{assistant_id}/config`,path:{assistant_id:t},body:{ui:{userTimezone:e}},throwOnError:!0}).catch(e=>{a(e,{context:`settings-timezone-override`})}).finally(()=>{s.current=!1;let e=c.current;c.current=null,e!==null&&l.current(e)})};return(0,Z.useEffect)(()=>{l.current=u}),(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Timezone`}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Used when displaying times and scheduling reminders.`}),(0,Q.jsx)(`div`,{className:`mt-1`,children:(0,Q.jsx)(Di,{value:t,onChange:e=>{n(e),r(`timezone`,e),u(e)}})})]})}var ki=[[`Mon`,0],[`Tue`,1],[`Wed`,2],[`Thu`,3],[`Fri`,4],[`Sat`,5],[`Sun`,6]];function Ai(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),t,n));return`${i.getHours().toString().padStart(2,`0`)}:${i.getMinutes().toString().padStart(2,`0`)}`}function ji(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),t,n);return`${i.getUTCHours().toString().padStart(2,`0`)}:${i.getUTCMinutes().toString().padStart(2,`0`)}`}function Mi(){return Intl.DateTimeFormat(void 0,{timeZoneName:`short`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??``}function Ni(e){let t=e?.schedule?.window.start??`06:00`,n=e?.schedule?.window.end??`08:00`;return{enabled:e?.enabled??!0,timezone:`UTC`,frequency:e?.schedule?.frequency??`weekly`,daysOfWeek:e?.schedule?.days_of_week??[0],daysOfMonth:e?.schedule?.days_of_month??[],windowStart:Ai(t),windowEnd:Ai(n)}}function Pi({assistantId:e}){let t=d(),{data:n,isLoading:r,isError:i}=f(Tt({path:{id:e}})),a=(0,Z.useMemo)(()=>Ni(n),[n]),[o,c]=(0,Z.useState)(null),l=o??a,u=o!==null,m=(0,Z.useMemo)(()=>Mi(),[]),[h,g]=(0,Z.useState)(null),_=h??l.daysOfMonth.join(`, `),y=p({mutationFn:async t=>{let{data:n}=await $e({path:{id:e},body:t,throwOnError:!0});return n}}),b=e=>{c(t=>({...t??a,...e}))},x=e=>{b({daysOfWeek:l.daysOfWeek.includes(e)?l.daysOfWeek.filter(t=>t!==e):[...l.daysOfWeek,e].sort((e,t)=>e-t)})},S=e=>e.split(`,`).map(e=>parseInt(e.trim(),10)).filter(e=>!isNaN(e)&&e>=1&&e<=31);return r?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(D,{className:`h-4 w-4 animate-spin`}),`Loading update window settings...`]}):i?(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:`Failed to load update window policy. Refresh the page to try again.`}):(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(ve,{checked:l.enabled,onChange:e=>b({enabled:e}),label:`Automatic updates`,helperText:`Update automatically during a configured time window`}),l.enabled&&(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:`Frequency`}),(0,Q.jsx)(`div`,{className:`max-w-[400px]`,children:(0,Q.jsx)(v,{ariaLabel:`Frequency`,value:l.frequency,onChange:e=>{e!==`monthly`&&g(null),b({frequency:e})},items:[{value:`daily`,label:`Daily`},{value:`weekly`,label:`Weekly`},{value:`monthly`,label:`Monthly`}]})})]}),l.frequency===`weekly`&&(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:`Day(s) of week`}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:ki.map(([e,t])=>(0,Q.jsx)(s,{variant:`outlined`,size:`compact`,active:l.daysOfWeek.includes(t),onClick:()=>x(t),children:e},t))})]}),l.frequency===`monthly`&&(0,Q.jsx)(B,{label:`Day(s) of month`,type:`text`,value:_,onChange:e=>g(e.target.value),onBlur:e=>{let t=S(e.target.value);b({daysOfMonth:t}),g(t.join(`, `))},placeholder:`e.g. 1, 15`,helperText:`Comma-separated day numbers (1–31)`,className:`w-48`}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:[`Update window`,m?` (${m})`:``]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(B,{type:`time`,value:l.windowStart,onChange:e=>b({windowStart:e.target.value})}),(0,Q.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`to`}),(0,Q.jsx)(B,{type:`time`,value:l.windowEnd,onChange:e=>b({windowEnd:e.target.value})})]})]})]}),(0,Q.jsx)(s,{variant:`primary`,leftIcon:y.isPending?(0,Q.jsx)(D,{className:`animate-spin`}):void 0,onClick:async()=>{let n=l.frequency===`monthly`&&h!==null?S(h):l.daysOfMonth;try{await y.mutateAsync({enabled:l.enabled,timezone:`UTC`,schedule:{frequency:l.frequency,days_of_week:l.frequency===`weekly`?l.daysOfWeek:[],days_of_month:l.frequency===`monthly`?n:[],window:{start:ji(l.windowStart),end:ji(l.windowEnd)}}}),H.success(`Auto-update policy saved.`),c(null),g(null),t.invalidateQueries({queryKey:kt({path:{id:e}})})}catch{H.error(`Failed to save policy. Please try again.`)}},disabled:y.isPending||!u,children:`Save policy`})]})}function Fi({assistantId:e,open:t,onClose:n}){return(0,Q.jsx)(V.Root,{open:t,onOpenChange:e=>{e||n()},children:(0,Q.jsxs)(V.Content,{size:`md`,children:[(0,Q.jsxs)(V.Header,{children:[(0,Q.jsx)(V.Title,{children:`Update Window`}),(0,Q.jsx)(V.Description,{children:`Configure when automatic updates are applied.`})]}),(0,Q.jsx)(V.Body,{children:(0,Q.jsx)(Pi,{assistantId:e})})]})})}function Ii(e){if(typeof e==`object`&&e&&`code`in e){let t=e.code;if(typeof t==`string`)return t}}function Li({open:e,onOpenChange:t}){let n=d(),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(null),u=(0,Z.useRef)(!1),f=(0,Z.useRef)(e),p=()=>n.invalidateQueries({queryKey:Ct()}),m=e=>{ot({path:{id:e}}).catch(()=>void 0).finally(()=>void p())},h=Et({onSuccess:e=>{if(!f.current){m(e.factor_id);return}i(e)},onError:e=>{let n=Ii(e);n===`no_workos_account`?H.error(`Two-factor authentication is only available for Vellum platform accounts.`):n===`throttled`||n===`workos_rate_limited`?H.error(`Too many attempts. Try again in a minute.`):n===`factor_limit_reached`?H.error(`An authenticator app is already set up. Remove it before adding another.`):H.error(`Failed to start setup. Please try again.`),t(!1)}}),g=xt({onSuccess:e=>{e.valid?(u.current=!0,H.success(`Two-factor authentication is on.`),p(),t(!1)):l(`That code didn't match. Check your authenticator app and try again.`)},onError:e=>{let n=Ii(e);if(n===`challenge_already_verified`){u.current=!0,H.success(`Two-factor authentication is on.`),p(),t(!1);return}if(n===`challenge_expired`||n===`challenge_not_found`){r&&m(r.factor_id),i(null),o(``),l(`This setup session expired. Scan the new QR code and try again.`),h.mutate({});return}if(n===`throttled`||n===`workos_rate_limited`){l(`Too many attempts. Wait a minute and try again.`);return}l(`Couldn't verify the code. Wait a moment and try again.`)}});(0,Z.useEffect)(()=>{f.current=e,e&&(u.current=!1,i(null),o(``),l(null),h.mutate({}))},[e]);let v=e=>{!e&&g.isPending||(!e&&r&&!u.current&&m(r.factor_id),t(e))},y=()=>{r&&Xt(r.secret,{successMessage:`Setup key copied.`,errorMessage:`Couldn't copy the setup key.`})},b=()=>{!r||a.length!==6||g.isPending||(l(null),g.mutate({body:{challenge_id:r.challenge_id,code:a}}))};return(0,Q.jsx)(V.Root,{open:e,onOpenChange:v,children:(0,Q.jsxs)(V.Content,{size:`sm`,children:[(0,Q.jsxs)(V.Header,{children:[(0,Q.jsx)(V.Title,{children:`Set up authenticator app`}),(0,Q.jsx)(V.Description,{children:`Scan the QR code with an authenticator app such as Google Authenticator or 1Password, then enter the 6-digit code it shows.`})]}),(0,Q.jsx)(V.Body,{children:r===null?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,Q.jsx)(D,{className:`h-5 w-5 animate-spin text-[var(--content-tertiary)]`})}):(0,Q.jsxs)(`form`,{className:`flex flex-col items-center gap-4`,onSubmit:e=>{e.preventDefault(),b()},children:[(0,Q.jsx)(`img`,{src:r.qr_code,alt:`QR code for your authenticator app`,className:`h-44 w-44 rounded-lg bg-white p-2`}),(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Can't scan it? Enter this setup key manually:`}),(0,Q.jsxs)(`button`,{type:`button`,onClick:y,className:`flex cursor-pointer items-center gap-2 self-start font-mono text-body-small-default text-[var(--content-default)] hover:text-[var(--content-emphasised)]`,children:[(0,Q.jsx)(`span`,{className:`break-all text-left`,children:r.secret}),(0,Q.jsx)(_,{className:`h-3.5 w-3.5 shrink-0`})]})]}),(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,Q.jsx)(`label`,{htmlFor:`totp-code`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:`6-digit code`}),(0,Q.jsx)(B,{id:`totp-code`,inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:6,placeholder:`123456`,value:a,onChange:e=>o(e.target.value.replace(/\D/g,``).slice(0,6))}),c&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--system-negative-strong)]`,children:c})]})]})}),(0,Q.jsxs)(V.Footer,{children:[(0,Q.jsx)(s,{variant:`outlined`,onClick:()=>v(!1),disabled:g.isPending,children:`Cancel`}),(0,Q.jsx)(s,{onClick:b,disabled:r===null||a.length!==6||g.isPending,children:g.isPending?`Verifying…`:`Verify`})]})]})})}function Ri(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function zi(){let e=d(),[t,n]=(0,Z.useState)(!1),[r,i]=(0,Z.useState)(null),a=f({...St()}),o=a.data??[],c=()=>e.invalidateQueries({queryKey:Ct()}),l=At({onSuccess:()=>{H.success(`Authenticator app removed.`),c()},onError:e=>{if(Ii(e)===`factor_not_found`){c();return}H.error(`Failed to remove the authenticator app. Please try again.`)}});return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a.isPending?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(D,{className:`h-4 w-4 animate-spin`}),(0,Q.jsx)(`span`,{className:`text-body-medium-default`,children:`Loading authenticator apps…`})]}):a.isError?(0,Q.jsxs)(z,{tone:`error`,children:[`Couldn't load your authenticator apps.`,` `,(0,Q.jsx)(`button`,{type:`button`,className:`cursor-pointer underline`,onClick:()=>void a.refetch(),children:`Try again`})]}):o.length===0?(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`No authenticator app is set up. Add one to require a one-time code at sign-in.`}):(0,Q.jsx)(`ul`,{className:`flex flex-col divide-y divide-[var(--border-base)]`,children:o.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(oe,{className:`h-5 w-5 shrink-0 text-[var(--content-tertiary)]`}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Authenticator app`}),(0,Q.jsxs)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:[e.user,e.created_at?` · Added ${Ri(e.created_at)}`:``]})]})]}),(0,Q.jsx)(s,{variant:`dangerOutline`,onClick:()=>i(e),disabled:l.isPending,children:`Remove`})]},e.id))}),!a.isPending&&!a.isError&&o.length===0&&(0,Q.jsx)(s,{onClick:()=>n(!0),className:`self-start`,children:`Add authenticator app`}),(0,Q.jsx)(Li,{open:t,onOpenChange:n}),(0,Q.jsx)(ye,{open:r!==null,title:`Remove authenticator app`,message:`Signing in will no longer ask for a code from this app. You can set up a new authenticator app at any time.`,confirmLabel:`Remove`,destructive:!0,onConfirm:()=>{r&&l.mutate({path:{id:r.id}}),i(null)},onCancel:()=>i(null)})]})}var $=class extends Error{code;constructor(e,t){super(t),this.name=`TeleportError`,this.code=e}},Bi=`local`,Vi=`docker`,Hi=`vellum`;function Ui(e){switch((e??``).toLowerCase()){case Bi:return`local`;case Vi:return`docker`;case Hi:return`managed`;default:return`other`}}function Wi(e){let t=Ui(e);return t===`managed`?`local`:t===`local`?`platform`:null}function Gi(e){switch(e){case`docker`:return`Move to Docker`;case`platform`:return`Move to Cloud (Platform)`;case`local`:return`Move to Local`}}function Ki(e){switch(e){case`docker`:return`Run your assistant in a Docker container on this Mac.`;case`platform`:return`Run your assistant in the cloud, managed by the Vellum platform.`;case`local`:return`Run your assistant locally on this Mac.`}}function qi(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.reason!==`version_mismatch`)return null;let n=t.bundle_compat,r=t.target_runtime_version;if(!n||typeof n!=`object`||typeof r!=`string`)return null;let i=n,a=i.min_runtime_version;if(typeof a!=`string`)return null;let o=typeof i.max_runtime_version==`string`?i.max_runtime_version:null;return`Cannot import: bundle requires runtime ${o?`${a}–${o}`:`${a}+`}, but this local runtime is ${r}. Update your local runtime before importing.`}async function Ji(e,t){let n=Number(e.headers.get(`Content-Length`)??0);if(!e.body||!t||n<=0){let n=await e.arrayBuffer();return t?.(1),n}let r=e.body.getReader(),i=[],a=0;for(;;){let{done:e,value:o}=await r.read();if(e)break;i.push(o),a+=o.length,t(a/n)}let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return t(1),o.buffer}function Yi(e){let t=Oe(e);if(!t)throw new $(`local_assistant_not_found`,`Assistant ${e.assistantId} has no resolved local gateway.`);return`${window.location.origin}${t}`}async function Xi(e,t){let n=await Pe(e.assistantId),r=await fetch(`${t}/auth/token`,{method:`POST`,headers:{Authorization:`Bearer ${n}`}});if(!r.ok)throw new $(`not_signed_in`,`Gateway token request failed (HTTP ${r.status}).`);let{token:i}=await r.json();return i}async function Zi(e,t){let n=Yi(e),r=await Xi(e,n),i=await fetch(`${n}/v1/migrations/export`,{method:`POST`,headers:{Authorization:`Bearer ${r}`}});if(!i.ok)throw new $(`export_failed`,`Export failed (HTTP ${i.status}).`);return Ji(i,t)}async function Qi(e,t){let n=Yi(e),r=await Xi(e,n),i=await fetch(`${n}/v1/migrations/import`,{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:new Blob([t],{type:`application/octet-stream`})});if(!i.ok)throw new $(`import_failed`,`Import failed (HTTP ${i.status}).`);let a=await ta(i);if(a&&a.success===!1)throw new $(`import_failed`,a.error??`Import reported failure`)}async function $i(e,t){let{data:n,response:r}=await K.post({url:`/v1/assistants/{assistant_id}/migrations/export-to-gcs/`,path:{assistant_id:e},body:{upload_url:t},throwOnError:!1}),i=r?.status??0;if(!(r?.ok??!1)&&i!==202)throw new $(`export_failed`,`Export failed (HTTP ${i}).`);let a=n?.job_id;if(!a)throw new $(`export_failed`,`Export accepted but no job ID was returned.`);return a}async function ea(e,t){let{data:n,response:r}=await K.get({url:`/v1/assistants/{assistant_id}/migrations/jobs/{job_id}`,path:{assistant_id:e,job_id:t},throwOnError:!1}),i=r?.status??0;if(i>=500)return`processing`;if(!(r?.ok??!1))throw new $(`export_job_failed`,`Job status check failed (HTTP ${i})`);let a=n;if(a?.status===`failed`)throw new $(`export_job_failed`,a.error??`Export job failed`);return a?.status??`processing`}async function ta(e){try{return await e.json()}catch{return null}}var na=new Set([500,502,503,504]),ra=3,ia=e=>new Promise(t=>setTimeout(t,e));async function aa(e,t=new Set){for(let n=0;n<=ra;n++){let{response:r,data:i,error:a}=await e(),o=r?.status??0;if(n<ra&&na.has(o)&&!t.has(o)){await ia(2**n*1e3);continue}return{status:o,data:i,error:a}}throw new $(`unknown`,`Unexpected retry loop exit`)}async function oa(e,t){let n={operation:`upload`};e&&(n.min_runtime_version=e,n.max_runtime_version=null),t&&(n.consumer=t);let{status:r,data:i}=await aa(()=>K.post({url:`/v1/migrations/signed-url/`,body:n,throwOnError:!1}),new Set([404,503]));if(r===503||r===404)throw new $(`export_failed`,`Signed URL uploads are not available — the platform may not support this feature yet.`);if(r!==201)throw new $(`export_failed`,`Migration request failed (HTTP ${r}).`);let a=i;return{url:a.url,bundleKey:a.bundle_key,expiresAt:a.expires_at}}async function sa(e,t){let{status:n,data:r,error:i}=await aa(()=>K.post({url:`/v1/migrations/signed-url/`,body:{operation:`download`,bundle_key:e,target_runtime_version:t},throwOnError:!1}),new Set([422]));if(n===422){let e=qi(i);if(e)throw new $(`version_mismatch`,e)}if(n!==200&&n!==201)throw new $(`import_failed`,`Migration request failed (HTTP ${n}).`);return r.url}async function ca(e,t,n){for(let r=0;r<=ra;r++){let i=await la(e,t,n);if(r<ra&&na.has(i)){await ia(2**r*1e3),n?.(0);continue}if(i<200||i>=300)throw new $(`export_failed`,`Bundle upload failed (HTTP ${i}).`);return}}function la(e,t,n){return new Promise((r,i)=>{let a=new XMLHttpRequest;a.open(`PUT`,e),a.setRequestHeader(`Content-Type`,`application/octet-stream`),a.timeout=36e5,n&&(a.upload.onprogress=e=>{e.lengthComputable&&n(e.loaded/e.total)}),a.onload=()=>{n?.(1),r(a.status)},a.onerror=()=>i(new $(`export_failed`,`Bundle upload failed.`)),a.ontimeout=()=>i(new $(`export_timed_out`,`Bundle upload timed out.`)),a.send(t)})}async function ua(e,t){for(let n=0;n<=ra;n++){let r=await fetch(e,{method:`GET`});if(n<ra&&na.has(r.status)){await ia(2**n*1e3),t?.(0);continue}if(!r.ok)throw new $(`import_failed`,`Bundle download failed (HTTP ${r.status}).`);return Ji(r,t)}throw new $(`import_failed`,`Unexpected retry loop exit`)}async function da(e){let{status:t,data:n,error:r}=await aa(()=>K.post({url:`/v1/migrations/import-from-gcs/`,body:{bundle_key:e},throwOnError:!1}));return{status:t,body:n??r??null}}async function fa(e){let{status:t,data:n}=await aa(()=>K.get({url:`/v1/migrations/jobs/{job_id}/`,path:{job_id:e},throwOnError:!1}));if(t!==200)throw new $(`import_failed`,`Job status check failed (HTTP ${t})`);let r=n??{};return{status:typeof r.status==`string`?r.status:`unknown`,jobId:typeof r.job_id==`string`?r.job_id:null,error:typeof r.error==`string`?r.error:null}}var pa=5e3,ma=36e5,ha=5*6e4,ga=30,_a=e=>new Promise(t=>setTimeout(t,e));function va(){let e=c(),t=je(),n=Wi(t?.cloud),[r,i]=(0,Z.useState)({kind:`idle`}),[o,s]=(0,Z.useState)(!1),l=(0,Z.useRef)(null),u=(0,Z.useRef)(null),d=(0,Z.useCallback)(e=>{i({kind:`transferring`,step:e,progress:null})},[]),f=(0,Z.useCallback)(e=>{i(t=>t.kind===`transferring`?{...t,progress:e}:t)},[]),p=(0,Z.useCallback)(async()=>{if(!(!t||!n)){u.current={id:t.assistantId,kind:Ui(t.cloud)===`managed`?`managed`:`local`,createdFresh:!1};try{if(n===`platform`)await ya(t,d,f,l);else if(n===`local`)await ba(t,d,f,l);else throw new $(`unknown`,`Unsupported teleport destination.`);i({kind:`verifying`})}catch(e){i({kind:`failed`,error:`Teleport failed: ${e instanceof $||e instanceof Error?e.message:`Teleport failed.`}`}),a(e,{context:`teleport-execute`}),await Sa(l.current,u.current,`teleport-execute-cleanup`),l.current=null}}},[t,n,d,f]),m=(0,Z.useCallback)(()=>s(!0),[]),h=(0,Z.useCallback)(()=>s(!1),[]),g=(0,Z.useCallback)(()=>{s(!1),p()},[p]),_=(0,Z.useCallback)(()=>{l.current=null,u.current=null,i({kind:`idle`})},[]);return{destination:n,phase:r,confirmOpen:o,requestTeleport:m,cancelConfirm:h,confirm:g,confirmAndSwitch:(0,Z.useCallback)(()=>{let t=l.current,n=u.current;t&&(async()=>{try{let e=Je.getState();t.kind===`managed`?await e.connectPlatformAssistant(t.id):(await e.connectLocalAssistant(t.id),Ye(t.id,{onError:e=>a(e,{context:`teleport-inject-platform-identity`})}))}catch(e){i({kind:`failed`,error:`Switch failed: ${e instanceof Error?e.message:`Failed to switch assistant.`}`}),a(e,{context:`teleport-confirm-switch`});return}n&&Wt(n.id).then(e=>{e.ok||a(Error(e.error),{context:`teleport-retire-source`})}),_(),e(J.assistant,{replace:!0})})()},[e,_]),cancelTeleport:(0,Z.useCallback)(()=>{let e=l.current,t=u.current;l.current=null,u.current=null,i({kind:`idle`}),Sa(e,t,`teleport-cancel-retire-target`)},[]),reset:_}}async function ya(e,t,n,r){t(`Exporting assistant data...`);let i=await Zi(e,n);t(`Resolving organization...`);let a=await wa();t(`Checking for existing assistant...`);let o=(await it({query:{hosting:`platform`},throwOnError:!1})).data?.results?.[0];if(o)throw new $(`existing_platform_assistant`,`You already have a platform assistant '${o.id}'. Retire it first, then retry the teleport.`);t(`Uploading data to cloud...`);let s=await oa(e.resources?.runtimeVersion);await ca(s.url,i,n),t(`Setting up cloud assistant...`);let c=await ct(void 0,`create`);if(!c.ok)throw new $(`import_failed`,`Failed to set up the cloud assistant.`);if(c.status===200)throw new $(`existing_platform_assistant`,`You already have a platform assistant '${c.data.id}'. Retire it first, then retry the teleport.`);let l=c.data.id;await Se({assistantId:l,name:c.data.name,cloud:`vellum`,runtimeUrl:Ee(),hatchedAt:c.data.created??new Date().toISOString(),organizationId:a}),await Ce(e.assistantId),r.current={id:l,kind:`managed`,createdFresh:!0},t(`Finalizing cloud assistant...`),await Ta(l),t(`Importing data to cloud...`);let u=await da(s.bundleKey);if(u.status<200||u.status>=300){let e=u.body;throw new $(`import_failed`,e?.error??`Import failed (HTTP ${u.status}).`)}if(u.status===202){let e=u.body?.job_id;if(!e)throw new $(`import_failed`,`Import accepted but no job ID returned.`);await Ea(e)}else{let e=u.body;if(e&&e.success===!1)throw new $(`import_failed`,e.error??`Import reported failure.`)}}async function ba(e,t,n,r){t(`Preparing export...`);let i=await oa(await Ca(e.assistantId),`runtime`);t(`Exporting cloud data...`);let a=await $i(e.assistantId,i.url);await Da(e.assistantId,a),t(`Preparing local assistant...`);let{assistant:o,createdFresh:s}=await Oa();r.current={id:o.assistantId,kind:`local`,createdFresh:s};let c=await xa(o,s);if(!c)throw new $(`local_assistant_not_found`,`Could not determine the local assistant's runtime version. Restart or upgrade the local assistant, then retry the teleport.`);t(`Preparing import...`);let l=await sa(i.bundleKey,c);t(`Downloading data...`);let u=await ua(l,n);t(`Importing data...`),await Aa(o,u),await Ce(e.assistantId)}async function xa(e,t){if(e.resources?.runtimeVersion)return e.resources.runtimeVersion;if(t)return(await nn())?.version??void 0}async function Sa(e,t,n){if(e?.createdFresh){let t=await Wt(e.id);t.ok||a(Error(t.error),{context:n})}t&&await Ce(t.id)}async function Ca(e){let t=await st(e);return t.ok?t.data.version??void 0:void 0}async function wa(){let e=Xe.getState();e.organizations.length===0&&await e.fetchOrganizations();let t=Xe.getState().organizations,n=Ve();if(n&&t.some(e=>e.id===n))return n;if(t.length===0)throw new $(`no_organizations`,`No organizations found for this account.`);if(t.length>1)throw new $(`multiple_organizations`,`Multiple organizations found — please select one in account settings first.`);let r=t[0].id;return Xe.getState().setCurrentOrganizationId(r),r}async function Ta(e){let t=Date.now();for(;Date.now()-t<ha;){let{data:t,response:n}=await tt({path:{id:e},throwOnError:!1});if(n?.ok&&t?.state===`active`)return;await _a(pa)}}async function Ea(e){let t=Date.now();for(;Date.now()-t<ma;){await _a(pa);let t=await fa(e);if(t.status===`complete`)return;if(t.status===`failed`)throw new $(`import_failed`,t.error??`Import job failed`)}throw new $(`import_failed`,`Import timed out after 60 minutes.`)}async function Da(e,t){let n=Date.now();for(;Date.now()-n<ma;)if(await _a(pa),await ea(e,t)===`complete`)return;throw new $(`export_timed_out`,`Export timed out.`)}async function Oa(){let e=await Te(void 0,void 0);if(!e.ok)throw new $(`local_assistant_not_found`,e.error??`Could not create a local assistant.`);await xe();let t=e.assistantId?Ae().find(t=>t.assistantId===e.assistantId):ka();if(!t)throw new $(`local_assistant_not_found`,`Could not find or create a local assistant.`);return{assistant:t,createdFresh:!0}}function ka(){return Ae().slice().sort((e,t)=>(t.hatchedAt??``).localeCompare(e.hatchedAt??``))[0]}async function Aa(e,t){let n;for(let r=0;r<ga;r++)try{await Qi(e,t);return}catch(e){n=e,await _a(1e3)}throw n instanceof Error?n:new $(`import_failed`,`Import failed.`)}function ja(){let e=va(),{destination:t,phase:n}=e;return t?(0,Q.jsxs)(X,{title:`Teleport`,subtitle:`Move your assistant to a different hosting environment.`,children:[n.kind===`idle`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:Ki(t)}),(0,Q.jsx)(s,{variant:`outlined`,className:`self-start`,onClick:e.requestTeleport,children:Gi(t)})]}),n.kind===`transferring`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n.progress==null&&(0,Q.jsx)(D,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:n.step})]}),n.progress!=null&&(0,Q.jsx)(de,{value:n.progress,"aria-label":`Teleport progress`,className:`max-w-[240px]`})]}),n.kind===`verifying`&&(0,Q.jsx)(z,{tone:`success`,icon:(0,Q.jsx)(w,{className:`h-4 w-4`}),title:`Transfer complete — verify your new assistant is working.`,actions:(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(s,{variant:`primary`,onClick:e.confirmAndSwitch,children:`Confirm & Switch`}),(0,Q.jsx)(s,{variant:`outlined`,onClick:e.cancelTeleport,children:`Cancel`})]})}),n.kind===`failed`&&(0,Q.jsx)(z,{tone:`error`,title:n.error,actions:(0,Q.jsx)(s,{variant:`outlined`,onClick:e.reset,children:`Try Again`})}),(0,Q.jsx)(ye,{open:e.confirmOpen,title:Gi(t),message:`Your data will be copied to the new environment. The current assistant will remain available until you confirm the new one works.`,confirmLabel:`Teleport`,onConfirm:e.confirm,onCancel:e.cancelConfirm})]}):null}function Ma(){let{assistant:e,healthz:t,healthzLoading:n,healthzPolling:r,refetch:i,refetchUntilResized:a}=dn(),o=q.use.multiPlatformAssistant(),u=q.use.assistantSwitcher(),d=q.use.teleport(),f=q.use.accountMfa(),p=Ht.use.settingsSleepPolicy(),m=Ke(),h=dt(),g=u&&(Ne()||m||we()||h),_=c(),v=ht(),y=ht({platformHostedOnly:!0}),b=_t(),x=pt(),S=ee({assistantId:e?.id??null,enabled:y===`full`&&b}),[C,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(!1),[D,O]=l();(0,Z.useEffect)(()=>{if(D.get(`preferences`)!==`open`)return;let e=new URLSearchParams(D);e.delete(`preferences`),O(e,{replace:!0}),E(!0)},[D,O]);let k=e?.is_local&&!Ne()?null:e,A=je(),j=Ne()&&!!e&&!!A&&De(A),M=j,N=j&&!we(),P=y===`full`&&!!k||N&&!!e;(0,Z.useEffect)(()=>{!e||window.location.hash!==`#storage-resources`||requestAnimationFrame(()=>{document.getElementById(`storage-resources`)?.scrollIntoView({block:`start`})})},[e]);let F=t?.version??e?.current_release_version??null,I=()=>{let e=ke();if(we()&&!h&&e){let t=new URLSearchParams({register:lt()}),n=Me();n&&t.set(`name`,n);let r=new URL(e).origin;window.location.assign(`${r}${J.selectAssistant}?${t.toString()}`);return}_(`${J.selectAssistant}?noAutoSkip=1`)},L=(v===`full`||M)&&!!k||v===`disabled`&&!M,R=y!==`gated`;return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[S.status&&S.mode!==`inactive`&&(0,Q.jsx)(re,{status:S.status,mode:S.mode,isAcknowledging:S.isAcknowledging,acknowledgeError:S.acknowledgeError?.message??null,onAcknowledge:()=>void S.acknowledge(),onReviewWorkspaceData:()=>void _(`${J.workspace}?sort=size`),onUpgradeStorage:y===`full`&&!x?()=>void _(J.plans):null}),(0,Q.jsxs)(jn,{assistant:b?k:null,showHandles:m&&v===`full`,children:[(0,Q.jsx)(Oi,{}),f&&v!==`gated`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Two-Factor Authentication`}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Require a code from an authenticator app when you sign in.`}),(0,Q.jsx)(`div`,{className:`mt-1`,children:v===`disabled`?(0,Q.jsx)(Y,{children:`Log in to the Vellum platform to manage two-factor authentication.`}):(0,Q.jsx)(zi,{})})]})]})]}),(0,Q.jsx)(X,{title:`Version`,subtitle:`Manage your assistant's software version and updates.`,accessory:y===`full`&&k?(0,Q.jsx)(s,{variant:`outlined`,onClick:()=>w(!0),children:`Update Window`}):void 0,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[y===`full`&&k&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Vn,{assistantId:k.id,currentVersion:F,releaseChannel:k.release_channel,onUpgradeComplete:()=>{i()}}),(0,Q.jsx)(ui,{assistantId:k.id,onComplete:()=>{i()}})]}),N&&e&&(0,Q.jsx)(Hn,{assistantId:e.id,currentVersion:F,onUpgradeComplete:()=>{i()}}),!P&&e&&(0,Q.jsxs)(`div`,{className:`grid grid-cols-[140px_minmax(0,1fr)] gap-y-3`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Current`}),(0,Q.jsx)(fn,{version:F,loading:n&&!e.current_release_version,assistantId:e.id??null})]}),y===`disabled`&&!N&&(0,Q.jsx)(Y,{children:`Log in to the Vellum platform to manage software updates.`})]})}),y===`full`&&k&&(0,Q.jsx)(Fi,{assistantId:k.id,open:C,onClose:()=>w(!1)}),y===`full`&&e&&(0,Q.jsx)(vi,{assistant:e,healthz:t,healthzLoading:n,healthzPolling:r,refetch:i,refetchUntilResized:a}),y===`disabled`&&(0,Q.jsx)(X,{id:`storage-resources`,title:`Compute & Resources`,subtitle:`Monitor resource usage and manage your assistant's compute profile.`,children:(0,Q.jsx)(Y,{children:`Log in to the Vellum platform to manage compute resources.`})}),(0,Q.jsx)(X,{title:`Preferences`,subtitle:`Customize how Vellum looks and behaves on this device.`,accessory:(0,Q.jsx)(s,{variant:`outlined`,onClick:()=>E(!0),children:`Customize`}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsx)(vn,{}),(0,Q.jsx)(bi,{})]})}),(0,Q.jsx)(ii,{open:T,onClose:()=>E(!1)}),d&&W()&&(0,Q.jsx)(ja,{}),(0,Q.jsx)(Gn,{}),(0,Q.jsx)(Hr,{}),y===`full`&&k&&p&&(0,Q.jsx)(X,{title:`Sleep Policy`,subtitle:`Control how long this assistant stays awake when idle.`,children:(0,Q.jsx)(Ln,{assistantId:k.id})}),y===`disabled`&&p&&(0,Q.jsx)(X,{title:`Sleep Policy`,subtitle:`Control how long this assistant stays awake when idle.`,children:(0,Q.jsx)(Y,{children:`Log in to the Vellum platform to manage sleep policy.`})}),o&&!g&&(0,Q.jsx)(Pn,{}),g&&(0,Q.jsx)(X,{title:`Switch Assistant`,subtitle:`Choose which assistant this device is connected to.`,accessory:(0,Q.jsx)(s,{variant:`outlined`,onClick:I,children:`Choose Assistant`})}),(L||R)&&(0,Q.jsx)(X,{variant:`danger`,title:`Danger Zone`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[L&&(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Retire Assistant`}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Permanently retire this assistant and delete all associated data.`}),(0,Q.jsx)(`div`,{className:`mt-1`,children:(v===`full`||M)&&k?(0,Q.jsx)(yi,{assistantId:k.id}):(0,Q.jsx)(Y,{children:`Log in to the Vellum platform to retire this assistant.`})})]}),L&&R&&(0,Q.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Q.jsx)(Un,{})]})})]})}export{Ma as GeneralPage};
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{i as t,l as n}from"./local-settings-Bx7FsNo5.js";import{t as r}from"./capture-error-DiNp24s6.js";import{t as i}from"./react-BFJW0bSv.js";import{t as a}from"./button-VkxVX0DM.js";import{d as o,h as s}from"./chunk-5KNZJZUH-BUqIilZr.js";import{n as c}from"./QueryClientProvider-EuRl-wrW.js";import{t as l}from"./useQuery-CTSuec5b.js";import{t as u}from"./useQueries-Bimdc7uA.js";import{t as d}from"./jsx-runtime-BJ8jcmzB.js";import{t as f}from"./card-DUsAeHUS.js";import{a as p,d as m,n as h,o as g,s as _,t as v}from"./list-row-CDwzGT9g.js";import{t as y}from"./createLucideIcon-B-ZPaMbU.js";import{t as b}from"./check-pgeLaeXx.js";import{t as x}from"./chevron-down-CmQCCo_x.js";import{t as S}from"./chevron-right-Dwr_Sx98.js";import{t as C}from"./circle-alert-DvkPmyIg.js";import{t as w}from"./circle-check-BlOeCme9.js";import{t as T}from"./circle-x-CEXUbdoO.js";import{t as E}from"./external-link-B-pfCiUo.js";import{t as D}from"./key-round-C51ZTEMu.js";import{t as O}from"./loader-circle-DYe85z3g.js";import{t as k}from"./log-in-BsEhSW6v.js";import{t as A}from"./log-out-Dvz6dWwJ.js";import{t as j}from"./pencil-Ba0D7tjH.js";import{t as M}from"./plus-CWkbiq1y.js";import{n as N,t as P}from"./integration-icon-DbmKvxqf.js";import{t as F}from"./refresh-cw-p138DTtp.js";import{t as I}from"./search-D_t5oHhF.js";import{t as L}from"./sparkles-Bhr0JiLM.js";import{t as R}from"./trash-2-V2WT_DbX.js";import{t as z}from"./x-zfSDUG5z.js";import{t as B}from"./notice-BlYF-xU3.js";import{t as V}from"./popover-D3A6cIyW.js";import{t as H}from"./input-DkgpMeG9.js";import{t as U}from"./toggle-0qt1e_3r.js";import{t as W}from"./modal-UYNawsIu.js";import{n as G}from"./toast-DqqWkjsh.js";import{t as K}from"./confirm-dialog-Drw1adml.js";import{t as ee}from"./select-BKyejRky.js";import"./i18n-DVILRE1E.js";import{t as q}from"./useTranslation-BBobNyt0.js";import{i as J}from"./api-errors-CASENJGT.js";import{J as te}from"./auth-store-DDMY1UvK.js";import{Qr as Y}from"./sdk.gen-CiE6cMi0.js";import{r as ne}from"./api-CQ3nejmH.js";import{m as re}from"./native-biometric-BxYhgb-X.js";import{d as ie}from"./routes-B7wRw3UT.js";import{i as ae,t as oe}from"./use-platform-gate-DJ7NtOkG.js";import{ct as se,dt as ce,fn as le,hn as ue,lt as de,mn as fe,ot as pe,pn as me,st as he,ut as ge}from"./react-query.gen-Bbh5MII3.js";import{n as _e,r as ve}from"./browser-Nd92UvKg.js";import{Dt as ye,Et as be,S as xe,b as X,x as Se}from"./react-query.gen-CwRPAiHT.js";import{r as Ce}from"./conversation-navigation-DQEOhOXf.js";import{t as we}from"./assistant-feature-flag-store-CNWz-RMv.js";import{t as Te}from"./use-body-scroll-lock-DmT5-Tka.js";import{t as Ee}from"./use-touch-mobile-CnqGLpCj.js";import{t as De}from"./copy-to-clipboard-D76_3Coc.js";import{a as Oe,i as ke,n as Ae,r as je}from"./oauth-connection-utils-DmZFWfiy.js";import{a as Me,i as Ne,n as Pe,t as Fe}from"./oauth-popup-CrXEFWPi.js";import{t as Ie}from"./platform-login-notice-BsrEG6VV.js";import{t as Le}from"./use-active-assistant-id-BADYKVyx.js";import{t as Re}from"./use-platform-assistant-id-CuqHJket.js";var ze=y(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),Be=y(`calendar-plus`,[[`path`,{d:`M16 19h6`,key:`xwg31i`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M19 16v6`,key:`tddt3s`}],[`path`,{d:`M21 12.598V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5`,key:`1glfrc`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}]]),Z=e(i(),1);function Ve({assistantId:e,providerKey:t,displayName:n,managedAvailable:r,connectionsQueryKey:i,allConnections:a}){let o=c(),s=re(),l=(0,Z.useRef)(null),u=(0,Z.useRef)(null),d=(0,Z.useRef)(null),f=(0,Z.useRef)(null),[p,m]=(0,Z.useState)(!1),h=()=>{u.current=null,m(!1)},g=()=>{l.current&&!l.current.closed&&l.current.close(),l.current=null,d.current&&=(clearInterval(d.current),null),f.current&&=(clearTimeout(f.current),null)},_=(0,Z.useCallback)(e=>{if(e.type!==`vellum:oauth-complete`||!u.current||e.requestId!==u.current.requestId)return;let{oauthStatus:t,oauthCode:r}=e;if(g(),h(),t===`connected`)G.success(`${n} account connected.`),o.invalidateQueries({queryKey:i});else{let e=r?`Error: ${r}`:`Authorization failed`;G.error(`${n} ${e}`)}},[i,n,o]),v=(0,Z.useCallback)(async(e,n)=>{if(!r)return!1;for(let r=0;r<8;r+=1){r>0&&await ke(750);try{if(o.invalidateQueries({queryKey:i}),je(await o.fetchQuery({...X({path:{assistant_id:e}}),staleTime:0}),t,n))return!0}catch{}}return!1},[i,r,t,o]);(0,Z.useEffect)(()=>{let e=e=>{let t=u.current;if(!t)return;let n=Fe(e,window.location.origin,t.requestId);n&&_(n)},t=e=>{let t=u.current;if(!t)return;let n=Pe(e,t.requestId);n&&(_(n),window.localStorage.removeItem(Ne(t.requestId)))};return window.addEventListener(`message`,e),window.addEventListener(`storage`,t),()=>{window.removeEventListener(`message`,e),window.removeEventListener(`storage`,t)}},[_]),Oe((0,Z.useCallback)(e=>{let t=u.current;t&&e.requestId===t.requestId&&_({type:`vellum:oauth-complete`,requestId:e.requestId,oauthStatus:e.oauthStatus,oauthProvider:e.oauthProvider,oauthCode:e.oauthCode})},[_])),(0,Z.useEffect)(()=>ve(()=>{let e=u.current;e&&(async()=>{let t=await v(e.platformAssistantId,e.baselineConnectionSignatures);u.current&&(h(),t&&G.success(`${n} account connected.`))})()}),[v,n]),(0,Z.useEffect)(()=>()=>{d.current&&clearInterval(d.current),f.current&&clearTimeout(f.current),l.current&&!l.current.closed&&l.current.close()},[]);let y=ye();return{handleConnect:(i=[])=>{if(!r)return;let c=crypto.randomUUID();m(!0);let p=async r=>{let l;try{l=await te(e)}catch(e){g(),h(),G.error(e instanceof Error?e.message:`Failed to start ${n} authorization.`);return}let d=Ae(await o.fetchQuery({...X({path:{assistant_id:l}}),staleTime:0}).catch(()=>l===e?a??[]:[]),t);u.current={requestId:c,provider:t,platformAssistantId:l,baselineConnectionSignatures:d},y.mutate({path:{assistant_id:l,provider:t},body:{requested_scopes:i,redirect_after_connect:`${ie.account.oauth.popupComplete}?requestId=${c}${s?`&native=1`:``}`}},{onSuccess(e){if(s){_e(e.connect_url);return}r&&!r.closed?r.location.href=e.connect_url:u.current&&(g(),h(),G.error(`${n} connection failed: popup closed.`))},onError(e){g(),h();let t=J(e,void 0,`Failed to start ${n} authorization.`);G.error(t)}})};if(s){p(null);return}let b=window.open(``,`_blank`,`width=500,height=600`);if(b===null){h(),G.error(`Popup blocked. Please enable popups and try again.`);return}l.current=b,d.current=setInterval(()=>{l.current&&l.current.closed&&u.current&&!f.current&&(f.current=setTimeout(async()=>{f.current=null;let e=u.current;if(!e)return;let t=window.localStorage.getItem(Ne(e.requestId));if(t){let n=Me(t);if(n&&n.requestId===e.requestId){_(n),window.localStorage.removeItem(Ne(e.requestId));return}}let r=await v(e.platformAssistantId,e.baselineConnectionSignatures);if(u.current){if(r){g(),h(),G.success(`${n} account connected.`);return}g(),h(),G.error(`${n} connection failed: authorization popup closed.`)}},1e3))},100),p(b)},oauthInProgress:p,startOAuthPending:y.isPending}}var Q=d();function He({displayName:e,providerKey:t,logoUrl:n,connections:r,connectionsLoading:i,startPending:o,oauthInProgress:s,disconnectingId:c,onConnect:l,onDisconnect:u,connectPresets:d=[]}){let f=o||s;return i?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,Q.jsx)(O,{className:`h-5 w-5 animate-spin text-[var(--content-disabled)]`})}):r.length===0?o||s?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10`,children:[(0,Q.jsx)(P,{providerKey:t,displayName:e,logoUrl:n,size:48}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(O,{className:`h-3.5 w-3.5 animate-spin`}),`Waiting for authorization...`]})]}):(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10`,children:[(0,Q.jsx)(P,{providerKey:t,displayName:e,logoUrl:n,size:48}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:`Connect Account to continue`}),(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,Q.jsx)(a,{variant:`primary`,size:`compact`,leftIcon:(0,Q.jsx)(M,{}),onClick:()=>l(),disabled:f,children:`Connect Account`}),d.map(e=>(0,Q.jsx)(a,{variant:`outlined`,size:`compact`,leftIcon:(0,Q.jsx)(Be,{}),onClick:()=>l(e.scopes),disabled:f,children:e.label},e.id))]})]}):(0,Q.jsxs)(`div`,{className:`rounded-lg border border-[var(--border-base)]`,children:[(0,Q.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)]`,children:r.map(r=>{let i=c===r.id;return(0,Q.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,Q.jsx)(P,{providerKey:t,displayName:e,logoUrl:n,size:20}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-medium-default text-[var(--content-default)]`,children:r.account_label??`${e} Account`}),(0,Q.jsx)(a,{variant:`dangerOutline`,size:`compact`,iconOnly:i?(0,Q.jsx)(O,{className:`animate-spin`}):(0,Q.jsx)(R,{}),onClick:()=>u(r),disabled:i,"aria-label":`Disconnect ${r.account_label??`${e} account`}`})]},r.id)})}),(0,Q.jsx)(`div`,{className:`border-t border-[var(--border-base)] px-4 py-3 dark:border-[var(--border-base)]`,children:f?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(O,{className:`h-3.5 w-3.5 animate-spin`}),`Waiting for authorization...`]}):(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(a,{variant:`primary`,size:`compact`,leftIcon:(0,Q.jsx)(E,{}),onClick:()=>l(),disabled:f,children:`Connect account`}),d.map(e=>(0,Q.jsx)(a,{variant:`outlined`,size:`compact`,leftIcon:(0,Q.jsx)(Be,{}),onClick:()=>l(e.scopes),disabled:f,children:e.label},e.id))]})})]})}function Ue(e){return e.length>16?`${e.slice(0,12)}…${e.slice(-4)}`:e.length>8?`${e.slice(0,8)}…`:e}function We(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}catch{return``}}function Ge({assistantId:e,providerKey:t,displayName:n,logoUrl:r}){let i=c(),o=l({...se({path:{assistant_id:e},query:{provider_key:t}}),select:e=>e.apps}),s=l({...ge({path:{assistant_id:e,providerKey:t}}),select:e=>e.oauth_callback_url}),d=o.data??[],p=s.data??null,h=u({queries:d.map(t=>({...pe({path:{assistant_id:e,appId:t.id}}),select:e=>e.connections}))}),g={};d.forEach((e,t)=>{g[e.id]=h[t]?.data??[]});let _=de({path:{assistant_id:e},query:{provider_key:t}}),v=fe({onSuccess:()=>{i.invalidateQueries({queryKey:_}),D(``),A(``),w(!1),G.success(`${n} OAuth app added.`)},onError:e=>{G.error(e.message||`Failed to create OAuth app`)}}),y=me({onSuccess:()=>{i.invalidateQueries({queryKey:_}),G.success(`OAuth app deleted.`)},onError:e=>{G.error(e.message||`Failed to delete OAuth app`)}}),x=le({onSuccess:e=>{`auth_url`in e&&(window.location.href=e.auth_url)},onError:e=>{G.error(e.message||`Failed to start OAuth flow`)}}),S=ue(),[C,w]=(0,Z.useState)(!1),[T,D]=(0,Z.useState)(``),[k,A]=(0,Z.useState)(``),[j,N]=(0,Z.useState)(!1),[F,I]=(0,Z.useState)(null),[L,z]=(0,Z.useState)(null),B=v.isPending,V=y.isPending?y.variables?.path?.id??null:null,U=x.isPending?x.variables?.path?.appId??null:null,W=S.isPending?S.variables?.path?.id??null:null,ee=()=>{let n=T.trim(),r=k.trim();!n||!r||v.mutate({path:{assistant_id:e},body:{provider_key:t,client_id:n,client_secret:r}})},q=()=>{let t=F;I(null),t&&y.mutate({path:{assistant_id:e,id:t.id}})},J=t=>{x.mutate({path:{assistant_id:e,appId:t.id},body:{callback_transport:`gateway`,scopes:[]}})};return o.isLoading?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,Q.jsx)(O,{className:`h-5 w-5 animate-spin text-[var(--content-disabled)]`})}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[d.length===0||C?(0,Q.jsx)(f.Root,{children:(0,Q.jsxs)(f.Body,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:d.length===0?`Add your own ${n} OAuth app`:`Add another ${n} OAuth app`}),(0,Q.jsx)(`p`,{className:`text-body-small-default leading-relaxed text-[var(--content-tertiary)]`,children:`Credentials are stored encrypted on the assistant and are never sent to Vellum.`})]}),p?(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Redirect URL`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(H,{type:`text`,value:p,readOnly:!0,fullWidth:!0}),(0,Q.jsx)(a,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>{De(p,{successMessage:`Copied to clipboard!`,errorMessage:`Couldn't copy the redirect URL.`,onCopied:()=>{N(!0),setTimeout(()=>N(!1),2e3)}})},"aria-label":j?`Copied`:`Copy redirect URL`,iconOnly:j?(0,Q.jsx)(b,{"aria-hidden":!0}):(0,Q.jsx)(m,{"aria-hidden":!0})})]}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Add this URL to your OAuth app's redirect settings.`})]}):null,(0,Q.jsx)(H,{label:`Client ID`,type:`text`,value:T,onChange:e=>D(e.target.value),placeholder:`Enter your client ID`,fullWidth:!0}),(0,Q.jsx)(H,{label:`Client Secret`,type:`password`,value:k,onChange:e=>A(e.target.value),placeholder:`Enter your client secret`,fullWidth:!0}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pt-1`,children:[d.length>0?(0,Q.jsx)(a,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>{w(!1),D(``),A(``)},disabled:B,children:`Cancel`}):null,(0,Q.jsx)(a,{type:`button`,size:`compact`,onClick:ee,disabled:B||!T.trim()||!k.trim(),leftIcon:B?(0,Q.jsx)(O,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(M,{"aria-hidden":!0}),children:`Add App`})]})]})}):null,d.map(e=>{let i=g[e.id]??[],o=V===e.id,s=U===e.id;return(0,Q.jsx)(f.Root,{children:(0,Q.jsxs)(f.Body,{className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 space-y-0.5`,children:[(0,Q.jsx)(`p`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:Ue(e.client_id)}),(0,Q.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[`Added `,We(e.created_at)]})]}),(0,Q.jsx)(a,{type:`button`,variant:`dangerOutline`,size:`compact`,onClick:()=>I(e),disabled:o,"aria-label":`Delete OAuth app ${Ue(e.client_id)}`,iconOnly:o?(0,Q.jsx)(O,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(R,{"aria-hidden":!0})})]}),i.length>0?(0,Q.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)] overflow-hidden rounded-md border border-[var(--border-base)] dark:divide-[var(--border-base)] dark:border-[var(--border-base)]`,children:i.map(i=>{let o=W===i.id;return(0,Q.jsxs)(`li`,{className:`flex items-center gap-3 px-3 py-2`,children:[(0,Q.jsx)(P,{providerKey:t,displayName:n,logoUrl:r,size:18}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-medium-lighter text-[var(--content-default)]`,children:i.account_info??`${n} Account`}),(0,Q.jsx)(a,{type:`button`,variant:`dangerOutline`,size:`compact`,onClick:()=>z({appId:e.id,connection:i}),disabled:o,"aria-label":`Disconnect ${i.account_info??`${n} account`}`,iconOnly:o?(0,Q.jsx)(O,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(R,{"aria-hidden":!0})})]},i.id)})}):null,(0,Q.jsx)(a,{type:`button`,size:`compact`,onClick:()=>J(e),disabled:s,className:`w-full`,leftIcon:s?(0,Q.jsx)(O,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(E,{"aria-hidden":!0}),children:s?`Waiting for authorization...`:`Connect account`})]})},e.id)}),d.length>0&&!C?(0,Q.jsx)(a,{type:`button`,variant:`outlined`,size:`compact`,onClick:()=>w(!0),className:`w-full border-dashed`,leftIcon:(0,Q.jsx)(M,{"aria-hidden":!0}),children:`Add Another App`}):null,(0,Q.jsx)(K,{open:F!==null,title:`Delete OAuth app`,message:F?`Delete OAuth app '${Ue(F.client_id)}'? This will disconnect all linked accounts.`:``,confirmLabel:`Delete`,destructive:!0,onConfirm:q,onCancel:()=>I(null)}),(0,Q.jsx)(K,{open:L!==null,title:`Disconnect ${n}?`,message:L?`Disconnect ${L.connection.account_info??`${n} Account`}? You can reconnect later.`:``,confirmLabel:`Disconnect`,destructive:!0,onConfirm:()=>{let t=L;z(null),t&&S.mutate({path:{assistant_id:e,id:t.connection.id}},{onSuccess:()=>{let r=he({path:{assistant_id:e,appId:t.appId}});i.invalidateQueries({queryKey:r}),i.invalidateQueries({queryKey:_}),G.success(`${n} account disconnected.`)},onError:e=>{G.error(e.message||`Failed to disconnect account`)}})},onCancel:()=>z(null)})]})}var Ke={};function qe(e){return Ke[e]??[]}var Je=[{value:`managed`,label:`Managed`},{value:`your-own`,label:`Your Own`}];function Ye({assistantId:e,platformAssistantId:t,providerKey:n,displayName:r,description:i,logoUrl:o,platformGate:s,onClose:u}){let d=c(),f=s===`full`,p=!oe(),[m,h]=(0,Z.useState)(s===`gated`&&p?`your-own`:`managed`);(0,Z.useEffect)(()=>{!p&&m===`your-own`&&h(`managed`)},[p,m]);let[_,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(null),x=Se({path:{assistant_id:t}}),{data:S,isLoading:C}=l({...X({path:{assistant_id:t}}),enabled:f}),w=(S??[]).filter(e=>e.provider===n&&e.connected),{handleConnect:T,oauthInProgress:E,startOAuthPending:D}=Ve({assistantId:e,providerKey:n,displayName:r,managedAvailable:f,connectionsQueryKey:x,allConnections:S}),O={path:{assistant_id:t}},k=be({onSuccess(e,t){G.success(`${r} account disconnected.`);let n=t.path.connection_id;xe(d,O,e=>e?.filter(e=>e.id!==n)),d.invalidateQueries({queryKey:x}),v(null)},onError(e){let t=J(e,void 0,`Failed to disconnect ${r} account.`);G.error(t),v(null)}});Te(),(0,Z.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),u())};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[u]);let A=e=>{b(e)},j=()=>{let e=y;b(null),e&&(v(e.id),k.mutate({path:{assistant_id:t,connection_id:e.id}}))},M=i?`Configure ${r} OAuth for ${i}`:`Configure ${r} OAuth`;return(0,Q.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4`,children:[(0,Q.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`integration-modal-title`,className:`flex w-full max-w-[520px] flex-col overflow-hidden rounded-xl bg-white shadow-xl dark:bg-[var(--surface-lift)]`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-[var(--border-base)] px-5 py-4 dark:border-[var(--border-base)]`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(P,{providerKey:n,displayName:r,logoUrl:o,size:32}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`h2`,{id:`integration-modal-title`,className:`text-title-small text-[var(--content-default)]`,children:[r,` OAuth`]}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:M})]})]}),(0,Q.jsx)(a,{variant:`ghost`,size:`compact`,iconOnly:(0,Q.jsx)(z,{}),"aria-label":`Close`,onClick:u})]}),(0,Q.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[s!==`gated`&&p&&(0,Q.jsx)(g,{ariaLabel:`OAuth mode`,items:Je,value:m,onChange:h}),m===`managed`&&s!==`gated`?s===`disabled`?(0,Q.jsx)(Ie,{children:`Log in to the Vellum platform to manage OAuth connections.`}):(0,Q.jsx)(He,{displayName:r,providerKey:n,logoUrl:o,connections:w,connectionsLoading:C,startPending:D,oauthInProgress:E,disconnectingId:k.isPending?_:null,onConnect:T,onDisconnect:A,connectPresets:qe(n)}):p?(0,Q.jsx)(Ge,{assistantId:e,providerKey:n,displayName:r,logoUrl:o}):null]}),(0,Q.jsx)(`div`,{className:`flex justify-end border-t border-[var(--border-base)] px-5 py-3 dark:border-[var(--border-base)]`,children:(0,Q.jsx)(a,{variant:`outlined`,size:`compact`,onClick:u,children:`Confirm`})})]}),(0,Q.jsx)(K,{open:y!==null,title:`Disconnect ${r}?`,message:y?`Disconnect ${y.account_label??`${r} Account`}? You can reconnect later.`:``,confirmLabel:`Disconnect`,destructive:!0,onConfirm:j,onCancel:()=>b(null)})]})}function Xe({platformAssistantId:e,providerKey:t,displayName:n,description:r,logoUrl:i,connection:o,platformGate:s,onConfigure:l}){let u=c(),d=!!o?.connected,[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(!1),_=Se({path:{assistant_id:e}}),v={path:{assistant_id:e}},y=be({onSuccess(e,t){G.success(`${n} account disconnected.`);let r=t.path.connection_id;xe(u,v,e=>e?.filter(e=>e.id!==r)),u.invalidateQueries({queryKey:_})},onError(e){let t=J(e,void 0,`Failed to disconnect ${n} account.`);G.error(t)}}),b=()=>{o?.id&&g(!0)};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(f.Root,{children:(0,Q.jsxs)(f.Body,{padding:`sm`,className:`flex items-center gap-4 px-4`,children:[(0,Q.jsx)(P,{providerKey:t,displayName:n,logoUrl:i,size:32}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`truncate text-title-small text-[var(--content-default)]`,children:n}),r&&(0,Q.jsx)(`p`,{className:`truncate text-body-medium-lighter text-[var(--content-tertiary)]`,children:r})]}),d&&s===`full`?(0,Q.jsx)(`div`,{className:`shrink-0`,children:(0,Q.jsx)(Ze,{displayName:n,open:p,onOpenChange:m,onEditConnections:()=>{m(!1),l()},onDisable:()=>{m(!1),b()},disablePending:y.isPending})}):(0,Q.jsx)(a,{variant:`primary`,onClick:l,className:`shrink-0`,children:`Enable`})]})}),(0,Q.jsx)(K,{open:h,title:`Disconnect ${n}?`,message:`Disconnect your ${n} account? You can reconnect it later.`,confirmLabel:`Disconnect`,destructive:!0,onConfirm:()=>{g(!1),o?.id&&y.mutate({path:{assistant_id:e,connection_id:o.id}})},onCancel:()=>g(!1)})]})}function Ze({displayName:e,open:t,onOpenChange:n,onEditConnections:r,onDisable:i,disablePending:o}){return Ee()?(0,Q.jsxs)(p.Root,{open:t,onOpenChange:n,children:[(0,Q.jsx)(p.Trigger,{asChild:!0,children:(0,Q.jsx)(a,{variant:`outlined`,rightIcon:(0,Q.jsx)(x,{}),"aria-haspopup":`menu`,"aria-expanded":t,children:`Configure`})}),(0,Q.jsxs)(p.Content,{children:[(0,Q.jsx)(p.Header,{children:(0,Q.jsx)(p.Title,{children:e})}),(0,Q.jsxs)(p.Body,{children:[(0,Q.jsx)(h,{icon:j,label:`Edit connections`,onSelect:r}),(0,Q.jsx)(h,{icon:o?O:T,label:`Disable`,onSelect:()=>{o||i()}})]})]})]}):(0,Q.jsxs)(V.Root,{open:t,onOpenChange:n,children:[(0,Q.jsx)(V.Trigger,{asChild:!0,children:(0,Q.jsx)(a,{variant:`outlined`,rightIcon:(0,Q.jsx)(x,{}),"aria-haspopup":`menu`,"aria-expanded":t,children:`Configure`})}),(0,Q.jsxs)(V.Content,{align:`end`,sideOffset:4,role:`menu`,className:`w-56 overflow-hidden p-0`,children:[(0,Q.jsx)(a,{type:`button`,role:`menuitem`,variant:`ghost`,onClick:r,className:`w-full justify-start rounded-none`,leftIcon:(0,Q.jsx)(j,{"aria-hidden":!0}),children:`Edit connections`}),(0,Q.jsx)(a,{type:`button`,role:`menuitem`,variant:`dangerGhost`,onClick:i,disabled:o,className:`w-full justify-start rounded-none`,leftIcon:o?(0,Q.jsx)(O,{className:`animate-spin`,"aria-hidden":!0}):(0,Q.jsx)(T,{"aria-hidden":!0}),children:`Disable`})]})]})}var Qe=[{value:`none`,label:`None`},{value:`oauth`,label:`OAuth`},{value:`bearer`,label:`Bearer Token`},{value:`api-key`,label:`API Key`}],$e=[{value:`sse`,label:`SSE`},{value:`streamable-http`,label:`Streamable HTTP`},{value:`stdio`,label:`Stdio (command)`}];function et({open:e,onClose:t,onAdd:n,isPending:r}){let[i,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(`sse`),[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(`none`),[_,v]=(0,Z.useState)(``),[y,b]=(0,Z.useState)(`X-API-Key`),[x,S]=(0,Z.useState)(``),C=(0,Z.useCallback)(()=>{o(``),c(`sse`),u(``),f(``),m(``),g(`none`),v(``),b(`X-API-Key`),S(``)},[]),w=(0,Z.useCallback)(()=>{r||(C(),t())},[r,C,t]),T=(0,Z.useCallback)(()=>{let e=i.trim();if(!e)return;let t={name:e,transportType:s};if(s===`stdio`){let e=d.trim();if(!e)return;t.command=e;let n=p.trim();n&&(t.args=n.split(/\s+/))}else{let e=l.trim();if(!e)return;t.url=e,h===`bearer`&&_.trim()?t.headers={Authorization:`Bearer ${_.trim()}`}:h===`api-key`&&y.trim()&&x.trim()?t.headers={[y.trim()]:x.trim()}:h===`oauth`&&(t.autoAuth=!0)}n(t)},[i,s,l,d,p,h,_,y,x,n]),E=s===`stdio`,D=i.trim()&&(E?d.trim():l.trim());return(0,Q.jsx)(W.Root,{open:e,onOpenChange:e=>{e||w()},children:(0,Q.jsxs)(W.Content,{size:`md`,children:[(0,Q.jsxs)(W.Header,{icon:ze,children:[(0,Q.jsx)(W.Title,{children:`Add MCP Server`}),(0,Q.jsx)(W.Description,{children:`Connect to a Model Context Protocol server to extend available tools.`})]}),(0,Q.jsx)(W.Body,{children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-name`,children:`Server name`}),(0,Q.jsx)(H,{id:`mcp-name`,type:`text`,value:i,onChange:e=>o(e.target.value),placeholder:`my-server`,fullWidth:!0,autoFocus:!0})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-transport`,children:`Transport`}),(0,Q.jsx)(`select`,{id:`mcp-transport`,value:s,onChange:e=>c(e.target.value),className:`w-full rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-default text-[var(--content-default)] outline-none focus:ring-2 focus:ring-[var(--ring)]`,children:$e.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),E?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-command`,children:`Command`}),(0,Q.jsx)(H,{id:`mcp-command`,type:`text`,value:d,onChange:e=>f(e.target.value),placeholder:`npx -y @modelcontextprotocol/server-example`,fullWidth:!0})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-args`,children:`Arguments (space-separated)`}),(0,Q.jsx)(H,{id:`mcp-args`,type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:`--port 3000`,fullWidth:!0})]})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-url`,children:`Server URL`}),(0,Q.jsx)(H,{id:`mcp-url`,type:`url`,value:l,onChange:e=>u(e.target.value),placeholder:`https://example.com/mcp`,fullWidth:!0})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-auth`,children:`Authentication`}),(0,Q.jsx)(`select`,{id:`mcp-auth`,value:h,onChange:e=>g(e.target.value),className:`w-full rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-default text-[var(--content-default)] outline-none focus:ring-2 focus:ring-[var(--ring)]`,children:Qe.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),h===`oauth`?(0,Q.jsx)(`p`,{className:`rounded-md border border-[var(--border-element)] bg-[var(--surface-base)] px-3 py-2 text-body-small-default text-[var(--content-tertiary)]`,children:`OAuth credentials will be configured through a browser-based authorization flow after the server is added.`}):null,h===`bearer`?(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-bearer`,children:`Bearer token`}),(0,Q.jsx)(H,{id:`mcp-bearer`,type:`password`,value:_,onChange:e=>v(e.target.value),placeholder:`tok_...`,fullWidth:!0})]}):null,h===`api-key`?(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-apikey-header`,children:`Header name`}),(0,Q.jsx)(H,{id:`mcp-apikey-header`,type:`text`,value:y,onChange:e=>b(e.target.value),placeholder:`X-API-Key`,fullWidth:!0})]}),(0,Q.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-apikey-value`,children:`API key`}),(0,Q.jsx)(H,{id:`mcp-apikey-value`,type:`password`,value:x,onChange:e=>S(e.target.value),placeholder:`sk_...`,fullWidth:!0})]})]}):null]})]})}),(0,Q.jsxs)(W.Footer,{children:[(0,Q.jsx)(a,{variant:`ghost`,onClick:w,disabled:r,children:`Cancel`}),(0,Q.jsx)(a,{variant:`primary`,onClick:T,disabled:!D||r,children:r?`Adding...`:`Add Server`})]})]})})}async function tt(e){let{data:t,response:n}=await Y.get({url:`/v1/assistants/{assistant_id}/internal/mcp/list`,path:{assistant_id:e}});if(!n?.ok)throw Error(`Failed to fetch MCP servers: ${n?.status}`);return t}async function nt(e){let{data:t,response:n}=await Y.get({url:`/v1/assistants/{assistant_id}/internal/mcp/tools-summary`,path:{assistant_id:e}});if(!n?.ok)throw Error(`Failed to fetch MCP tools summary: ${n?.status}`);return t}async function rt(e,t){let{response:n}=await Y.post({url:`/v1/assistants/{assistant_id}/internal/mcp/update`,path:{assistant_id:e},body:t});if(!n?.ok)throw Error(`Failed to update MCP server: ${n?.status}`)}async function it(e,t){let{response:n}=await Y.post({url:`/v1/assistants/{assistant_id}/internal/mcp/add`,path:{assistant_id:e},body:t});if(!n?.ok)throw Error(`Failed to add MCP server: ${n?.status}`)}async function at(e,t){let{response:n}=await Y.post({url:`/v1/assistants/{assistant_id}/internal/mcp/remove`,path:{assistant_id:e},body:{name:t}});if(!n?.ok)throw Error(`Failed to remove MCP server: ${n?.status}`)}async function ot(e,t){let{data:n,response:r}=await Y.post({url:`/v1/assistants/{assistant_id}/internal/mcp/auth/start`,path:{assistant_id:e},body:{serverId:t}});if(!r?.ok)throw Error(`Failed to start MCP auth: ${r?.status}`);return n}async function st(e,t){let{data:n,response:r}=await Y.get({url:`/v1/assistants/{assistant_id}/internal/mcp/auth/status/${encodeURIComponent(t)}`,path:{assistant_id:e}});if(!r?.ok)throw Error(`Failed to poll MCP auth status: ${r?.status}`);return n}async function ct(e,t){let{response:n}=await Y.post({url:`/v1/assistants/{assistant_id}/internal/mcp/auth/revoke`,path:{assistant_id:e},body:{serverId:t}});if(!n?.ok)throw Error(`Failed to revoke OAuth for ${t}: ${n?.status}`)}async function lt(e){let{response:t}=await Y.post({url:`/v1/assistants/{assistant_id}/internal/mcp/reload`,path:{assistant_id:e},body:{}});if(!t?.ok)throw Error(`Failed to reload MCP servers: ${t?.status}`)}var ut={connected:{icon:w,label:`Connected`,className:`text-[var(--system-positive-strong)]`},"needs-auth":{icon:D,label:`Needs Auth`,className:`text-[var(--system-warning-strong)]`},disabled:{icon:N,label:`Disabled`,className:`text-[var(--content-tertiary)]`}},dt={icon:C,label:`Error`,className:`text-[var(--system-negative-strong)]`};function ft({server:e,toolsSummary:t,onToggleEnabled:n,onRemove:r,onConfigure:i,onAuthenticate:o,onRevokeOAuth:s,isUpdating:c,isAuthenticating:l,isRevoking:u}){let[d,p]=(0,Z.useState)(!1),m=ut[e.status]??dt,h=m.icon,g=(0,Z.useCallback)(t=>n(e.id,t),[n,e.id]),_=(0,Z.useCallback)(()=>r(e.id),[r,e.id]),y=(0,Z.useCallback)(()=>i(e.id),[i,e.id]),b=(0,Z.useCallback)(()=>o(e.id),[o,e.id]),C=(0,Z.useCallback)(()=>s(e.id),[s,e.id]),w=(0,Z.useCallback)(()=>p(e=>!e),[]);return(0,Q.jsx)(f.Root,{children:(0,Q.jsxs)(f.Body,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:e.id}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 text-label-medium-default ${m.className}`,children:[(0,Q.jsx)(h,{className:`h-3.5 w-3.5`}),m.label]}),e.hasOAuth?(0,Q.jsx)(`span`,{className:`rounded-full bg-[var(--surface-lift)] px-2 py-0.5 text-label-small-default text-[var(--content-secondary)]`,children:`OAuth`}):null]}),(0,Q.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(`span`,{children:e.transport.type}),t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsxs)(`span`,{children:[t.toolCount,` `,t.toolCount===1?`tool`:`tools`]}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsxs)(`span`,{children:[`~`,t.estimatedTokens.toLocaleString(),` tokens`]})]}):null]})]})}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[c||l?(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}):null,e.status===`needs-auth`&&e.transport.type!==`stdio`&&!e.hasOAuth?(0,Q.jsx)(a,{variant:`ghost`,size:`compact`,leftIcon:(0,Q.jsx)(k,{}),onClick:b,disabled:l,children:l?`Authenticating...`:`Authenticate`}):null,e.hasOAuth?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(a,{variant:`ghost`,size:`compact`,leftIcon:(0,Q.jsx)(F,{}),onClick:b,disabled:l,tooltip:`Re-authenticate OAuth`,children:`Re-auth`}),(0,Q.jsx)(a,{variant:`dangerGhost`,size:`compact`,leftIcon:(0,Q.jsx)(A,{}),onClick:C,disabled:u,tooltip:`Revoke OAuth credentials`,children:u?`Revoking...`:`Revoke`})]}):null,(0,Q.jsx)(U,{checked:e.enabled,onChange:g,disabled:c,"aria-label":`${e.enabled?`Disable`:`Enable`} ${e.id}`}),(0,Q.jsx)(a,{variant:`ghost`,size:`compact`,onClick:y,tooltip:`Configure`,children:`Configure`}),(0,Q.jsx)(a,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,Q.jsx)(R,{}),onClick:_,tooltip:`Remove server`,"aria-label":`Remove ${e.id}`})]})]}),t&&t.tools.length>0?(0,Q.jsxs)(`div`,{className:`mt-3 border-t border-[var(--border-base)] pt-2`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:w,className:`flex w-full cursor-pointer items-center gap-1 text-body-small-default text-[var(--content-secondary)] hover:text-[var(--content-default)]`,children:[d?(0,Q.jsx)(x,{className:`h-3.5 w-3.5`}):(0,Q.jsx)(S,{className:`h-3.5 w-3.5`}),t.toolCount,` registered`,` `,t.toolCount===1?`tool`:`tools`]}),d?(0,Q.jsx)(`div`,{className:`mt-2 max-h-60 overflow-y-auto`,children:t.tools.map(e=>(0,Q.jsx)(v,{title:e.name,subtitle:e.description||void 0,trailing:(0,Q.jsxs)(`span`,{className:`whitespace-nowrap text-body-small-default text-[var(--content-secondary)]`,children:[`~`,e.estimatedTokens.toLocaleString(),` tok`]})},e.name))}):null]}):null]})})}var pt=[{value:`none`,label:`None`},{value:`bearer`,label:`Bearer Token`},{value:`api-key`,label:`API Key`}],mt=[`low`,`medium`,`high`];function ht({server:e,toolsSummary:t,onClose:n,onSave:r,isPending:i}){let[o,s]=(0,Z.useState)(`medium`),[c,l]=(0,Z.useState)(`none`),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(`X-API-Key`),[m,h]=(0,Z.useState)(``);(0,Z.useEffect)(()=>{e&&(s(e.defaultRiskLevel),l(e.authType),d(``),p(e.authHeaderName??`X-API-Key`),h(``))},[e]);let g=(0,Z.useCallback)(()=>{if(!e)return;let t=c!==e.authType,n=c===`bearer`&&u.trim()!==``,i=c===`api-key`&&f.trim()!==``&&m.trim()!==``,a=t||n||i,s;s=a?c===`none`?null:c===`bearer`&&u.trim()?{Authorization:`Bearer ${u.trim()}`}:c===`api-key`&&f.trim()&&m.trim()?{[f.trim()]:m.trim()}:void 0:void 0,r(e.id,{name:e.id,defaultRiskLevel:o,...s===void 0?{}:{headers:s}})},[e,o,c,u,f,m,r]),_=(0,Z.useCallback)(()=>{i||n()},[i,n]);return e?(0,Q.jsx)(W.Root,{open:!!e,onOpenChange:e=>{e||_()},children:(0,Q.jsxs)(W.Content,{size:`lg`,children:[(0,Q.jsxs)(W.Header,{icon:ze,children:[(0,Q.jsx)(W.Title,{children:e.id}),(0,Q.jsxs)(W.Description,{children:[e.transport.type,` transport · `,e.status]})]}),(0,Q.jsx)(W.Body,{children:(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-risk`,children:`Default risk level`}),(0,Q.jsx)(`select`,{id:`mcp-risk`,value:o,onChange:e=>s(e.target.value),className:`w-full rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-default text-[var(--content-default)] outline-none focus:ring-2 focus:ring-[var(--ring)]`,children:mt.map(e=>(0,Q.jsx)(`option`,{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),e.transport.type===`stdio`?null:(0,Q.jsxs)(Q.Fragment,{children:[e.hasOAuth?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-[var(--border-element)] bg-[var(--surface-base)] px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Authentication`}),(0,Q.jsx)(`span`,{className:`rounded-full bg-[var(--surface-lift)] px-2 py-0.5 text-label-small-default text-[var(--content-default)]`,children:`OAuth`}),(0,Q.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`— managed via OAuth flow`})]}):null,e.hasOAuth?null:(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-auth`,children:`Authentication`}),(0,Q.jsx)(`select`,{id:`mcp-detail-auth`,value:c,onChange:e=>l(e.target.value),className:`w-full rounded-md border border-[var(--border-element)] bg-[var(--surface-lift)] px-3 py-1.5 text-body-medium-default text-[var(--content-default)] outline-none focus:ring-2 focus:ring-[var(--ring)]`,children:pt.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),c===`bearer`&&!e.hasOAuth?(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-bearer`,children:`Bearer token`}),(0,Q.jsx)(H,{id:`mcp-detail-bearer`,type:`password`,value:u,onChange:e=>d(e.target.value),placeholder:e.hasStaticAuth&&e.authType===`bearer`?`•••••••• (leave blank to keep current)`:`tok_...`,fullWidth:!0})]}):null,c===`api-key`&&!e.hasOAuth?(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-apikey-header`,children:`Header name`}),(0,Q.jsx)(H,{id:`mcp-detail-apikey-header`,type:`text`,value:f,onChange:e=>p(e.target.value),placeholder:`X-API-Key`,fullWidth:!0})]}),(0,Q.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,Q.jsx)(`label`,{className:`text-body-small-default text-[var(--content-secondary)]`,htmlFor:`mcp-detail-apikey-value`,children:`API key`}),(0,Q.jsx)(H,{id:`mcp-detail-apikey-value`,type:`password`,value:m,onChange:e=>h(e.target.value),placeholder:e.hasStaticAuth&&e.authType===`api-key`?`•••••••• (leave blank to keep current)`:`sk_...`,fullWidth:!0})]})]}):null]}),t&&t.tools.length>0?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`h3`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`Registered tools (`,t.toolCount,`)`]}),(0,Q.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[`Total estimated token overhead: ~`,t.estimatedTokens.toLocaleString(),` tokens`]}),(0,Q.jsx)(`div`,{className:`max-h-64 overflow-y-auto rounded-lg border border-[var(--border-base)]`,children:(0,Q.jsxs)(`table`,{className:`w-full text-body-small-default`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`border-b border-[var(--border-base)] bg-[var(--surface-base)]`,children:[(0,Q.jsx)(`th`,{className:`px-3 py-2 text-left font-medium text-[var(--content-secondary)]`,children:`Tool`}),(0,Q.jsx)(`th`,{className:`px-3 py-2 text-left font-medium text-[var(--content-secondary)]`,children:`Description`}),(0,Q.jsx)(`th`,{className:`px-3 py-2 text-right font-medium text-[var(--content-secondary)]`,children:`Tokens`})]})}),(0,Q.jsx)(`tbody`,{children:t.tools.map(e=>(0,Q.jsxs)(`tr`,{className:`border-b border-[var(--border-base)] last:border-b-0`,children:[(0,Q.jsx)(`td`,{className:`px-3 py-2 font-medium text-[var(--content-default)]`,children:e.name}),(0,Q.jsx)(`td`,{className:`max-w-xs truncate px-3 py-2 text-[var(--content-tertiary)]`,children:e.description||`—`}),(0,Q.jsxs)(`td`,{className:`px-3 py-2 text-right text-[var(--content-tertiary)]`,children:[`~`,e.estimatedTokens.toLocaleString()]})]},e.name))})]})})]}):null]})}),(0,Q.jsxs)(W.Footer,{children:[(0,Q.jsx)(a,{variant:`ghost`,onClick:_,disabled:i,children:`Cancel`}),(0,Q.jsx)(a,{variant:`primary`,onClick:g,disabled:i,children:i?`Saving...`:`Save`})]})]})}):null}var gt=`mcp-servers`,_t=`mcp-tools-summary`,vt=`Help me set up an MCP server to extend you with external tools.`;function yt(){let e=Le(),t=c(),n=o(),r=we.use.mcpAddServer(),i=we.use.hasHydrated(),[s,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(new Set),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(null),[D,k]=(0,Z.useState)(null),{data:A,isLoading:j,isError:N}=l({queryKey:[gt,e],queryFn:()=>tt(e)}),{data:P}=l({queryKey:[_t,e],queryFn:()=>nt(e)}),I=(0,Z.useCallback)(()=>{t.invalidateQueries({queryKey:[gt,e]}),t.invalidateQueries({queryKey:[_t,e]})},[t,e]),L=(0,Z.useMemo)(()=>{let e=new Map;if(P)for(let t of P.servers)e.set(t.serverId,t);return e},[P]),R=(0,Z.useMemo)(()=>!d||!A?null:A.servers.find(e=>e.id===d)??null,[d,A]),z=(0,Z.useCallback)(async(t,n)=>{g(e=>new Set(e).add(t));try{await rt(e,{name:t,enabled:n}),I()}catch{G.error(`Failed to ${n?`enable`:`disable`} ${t}`)}finally{g(e=>{let n=new Set(e);return n.delete(t),n})}},[e,I]),B=(0,Z.useCallback)(async()=>{if(p){b(!0);try{await at(e,p),I(),G.success(`Removed ${p}`),m(null)}catch{G.error(`Failed to remove ${p}`)}finally{b(!1)}}},[p,e,I]),V=(0,Z.useCallback)(async t=>{E(t);let n;try{n=await ot(e,t)}catch{G.error(`Failed to start authentication for ${t}`),E(null);return}try{if(n.already_authenticated){G.success(`${t} is already authenticated`),I();return}window.open(n.auth_url,`_blank`,`noopener,noreferrer`);for(let n=0;n<60;n++){await new Promise(e=>setTimeout(e,3e3));let n=await st(e,t);if(n.status===`complete`){G.success(`${t} authenticated successfully`),I();return}if(n.status===`error`){G.error(n.error??`Authentication failed for ${t}`);return}}G.error(`Authentication timed out for ${t}`)}catch{G.error(`Authentication polling failed for ${t}`)}finally{E(null),I()}},[e,I]),H=(0,Z.useCallback)(async t=>{k(t);try{await ct(e,t),I(),G.success(`OAuth credentials revoked for ${t}`)}catch{G.error(`Failed to revoke OAuth for ${t}`)}finally{k(null)}},[e,I]),U=(0,Z.useCallback)(async t=>{let n=t.autoAuth?window.open(`about:blank`,`_blank`,`noopener`):null;v(!0);try{await it(e,t),I(),G.success(`Added ${t.name}`),u(!1)}catch{G.error(`Failed to add ${t.name}`),n?.close(),v(!1);return}if(v(!1),t.autoAuth){E(t.name);try{let r=await ot(e,t.name);if(r.already_authenticated){n?.close(),G.success(`${t.name} is already authenticated`),I();return}n?n.location.href=r.auth_url:window.open(r.auth_url,`_blank`,`noopener,noreferrer`);for(let n=0;n<60;n++){await new Promise(e=>setTimeout(e,3e3));let n=await st(e,t.name);if(n.status===`complete`){G.success(`${t.name} authenticated successfully`),I();return}if(n.status===`error`){G.error(n.error??`Authentication failed for ${t.name}`);return}}G.error(`Authentication timed out for ${t.name}`)}catch{n?.close(),G.error(`Failed to start authentication for ${t.name}`)}finally{E(null),I()}}},[e,I]),W=(0,Z.useCallback)(async(t,n)=>{S(!0);try{await rt(e,n),I(),G.success(`Updated ${t}`),f(null)}catch{G.error(`Failed to update ${t}`)}finally{S(!1)}},[e,I]),ee=(0,Z.useCallback)(async()=>{w(!0);try{await lt(e),I(),G.success(`MCP servers reloaded`)}catch{G.error(`Failed to reload MCP servers`)}finally{w(!1)}},[e,I]),q=(0,Z.useCallback)(()=>{r?u(!0):Ce(n,{prompt:vt})},[r,n]),J=A?.servers??[];return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{className:`text-title-small text-[var(--content-default)]`,children:`MCP Servers`}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`Manage Model Context Protocol server connections and their registered tools.`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(a,{variant:`ghost`,size:`compact`,iconOnly:(0,Q.jsx)(F,{className:C?`animate-spin`:``}),onClick:ee,disabled:C,tooltip:`Reload all servers`,"aria-label":`Reload MCP servers`}),r?(0,Q.jsx)(a,{variant:`primary`,size:`compact`,leftIcon:(0,Q.jsx)(M,{}),onClick:()=>u(!0),children:`Add Server`}):null]})]}),P?(0,Q.jsxs)(`div`,{className:`flex gap-4 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,Q.jsxs)(`span`,{children:[P.totalToolCount,` total`,` `,P.totalToolCount===1?`tool`:`tools`]}),(0,Q.jsxs)(`span`,{children:[`~`,P.totalEstimatedTokens.toLocaleString(),` total tokens`]})]}):null,j?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin`}),(0,Q.jsx)(`span`,{children:`Loading MCP servers...`})]}):N?(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Failed to load MCP servers. Check that an assistant is running.`}):J.length===0?(0,Q.jsxs)(`button`,{type:`button`,onClick:q,disabled:!i,className:`flex w-full flex-col items-center gap-2 rounded-lg border border-dashed border-[var(--border-element)] px-4 py-12 text-center transition-colors hover:border-[var(--border-active)] hover:bg-[var(--surface-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:pointer-events-none`,children:[(0,Q.jsx)(ze,{className:`h-6 w-6 text-[var(--content-disabled)]`}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`No MCP Servers`}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:r?`Add an MCP server to extend your assistant with external tools.`:`Chat with your assistant to set up an MCP server.`})]}):(0,Q.jsx)(`div`,{className:`space-y-2`,children:J.map(e=>(0,Q.jsx)(ft,{server:e,toolsSummary:L.get(e.id),onToggleEnabled:z,onRemove:m,onConfigure:f,onAuthenticate:V,onRevokeOAuth:H,isUpdating:h.has(e.id),isAuthenticating:T===e.id,isRevoking:D===e.id},e.id))}),r?(0,Q.jsx)(et,{open:s,onClose:()=>u(!1),onAdd:U,isPending:_}):null,(0,Q.jsx)(ht,{server:R,toolsSummary:d?L.get(d):void 0,onClose:()=>f(null),onSave:W,isPending:x}),(0,Q.jsx)(K,{open:!!p,title:`Remove MCP Server`,message:`Are you sure you want to remove "${p}"? This will disconnect all tools provided by this server.`,confirmLabel:`Remove`,destructive:!0,isPending:y,onConfirm:B,onCancel:()=>m(null)})]})}function bt(){return(0,Q.jsx)(yt,{})}var xt=`vellum:integrations:bannerDismissed`,St=[{value:`all`,labelKey:`integrationsPage.filterAll`},{value:`enabled`,labelKey:`integrationsPage.filterEnabled`},{value:`not-enabled`,labelKey:`integrationsPage.filterNotEnabled`}];function $(e,t){return e?.find(e=>e.provider===t)??null}function Ct(e){return e===`mcp`?`mcp`:`oauth`}function wt(){let{t:e}=q(`settings`),[i]=s(),a=o(),c=ae(),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(!0),[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(`all`),[v,y]=(0,Z.useState)(!0),[b,x]=(0,Z.useState)(null);(0,Z.useEffect)(()=>{y(t(xt,`false`)===`true`)},[]);let S=()=>{y(!0),n(xt,`true`)};(0,Z.useEffect)(()=>{let e=!0;return(async()=>{try{let t=await ne();e&&t.ok&&d(t.data)}catch(e){r(e,{context:`integrations.getAssistant`})}finally{e&&p(!1)}})(),()=>{e=!1}},[]);let{platformAssistantId:C,isLoading:w}=Re(u?.id,c===`full`),{data:T,isLoading:E,isError:D}=l({...ce({path:{assistant_id:u?.id??``}}),select:e=>e.providers,enabled:!!u}),{data:k,isLoading:A}=l({...X({path:{assistant_id:C??``}}),enabled:!!C&&c===`full`});(0,Z.useEffect)(()=>{let e=i.get(`oauth_status`);if(!e)return;let t=i.get(`oauth_provider`),n=t?t.charAt(0).toUpperCase()+t.slice(1):null;if(e===`connected`)G.success(n?`${n} account connected successfully.`:`Account connected successfully.`);else if(e===`error`){let e=i.get(`oauth_code`)??`unknown`;G.error({denied:`Authorization was denied. Please try again.`,state_invalid:`Authorization state was invalid. Please try again.`,state_expired:`Authorization expired. Please try again.`,exchange_failed:`Failed to complete authorization. Please try again.`,identity_failed:`Failed to verify account identity. Please try again.`}[e]??(n?`Failed to connect ${n}.`:`Failed to connect. Please try again.`))}a(ie.settings.integrations,{replace:!0})},[i,a]);let j=(0,Z.useMemo)(()=>T?.filter(e=>e.supports_managed_mode)??[],[T]),M=(0,Z.useMemo)(()=>{let e=m.trim().toLowerCase(),t=j.filter(t=>{if(t.provider_key===`slack`)return!1;if(!e)return!0;let n=(t.display_name??t.provider_key).toLowerCase(),r=(t.description??``).toLowerCase();return n.includes(e)||r.includes(e)});return g!==`all`&&(t=t.filter(e=>{let t=!!$(k,e.provider_key)?.connected;return g===`enabled`?t:!t})),[...t].sort((e,t)=>{let n=!!$(k,e.provider_key)?.connected;if(n!==!!$(k,t.provider_key)?.connected)return n?-1:1;let r=(e.display_name??e.provider_key).toLowerCase(),i=(t.display_name??t.provider_key).toLowerCase();return r.localeCompare(i)})},[j,k,m,g]),N=f||E||A||w,P=(()=>{if(m.trim())return`No integrations matched`;switch(g){case`enabled`:return`No Enabled Integrations`;case`not-enabled`:return`All Integrations Are Enabled`;default:return`No Integrations Available`}})(),F=(()=>{if(m.trim())return`No integrations matched "${m.trim()}"`;switch(g){case`enabled`:return`Connect an integration to get started.`;case`not-enabled`:return`All available integrations have been connected.`;default:return`Check your connection and try again.`}})(),R=(0,Z.useMemo)(()=>b?j.find(e=>e.provider_key===b)??null:null,[j,b]),z=St.map(({value:t,labelKey:n})=>({value:t,label:e(n)}));return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[!v&&(0,Q.jsxs)(B,{tone:`info`,icon:(0,Q.jsx)(L,{className:`h-3.5 w-3.5`}),onDismiss:S,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default`,children:`Tip:`}),` You can enable integrations by mentioning them in chat.`]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(H,{type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:`Search Integrations`,"aria-label":`Search integrations`,leftIcon:(0,Q.jsx)(I,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),fullWidth:!0,wrapperClassName:`flex-1`}),(0,Q.jsx)(ee,{options:z,value:g,onChange:_,"aria-label":e(`integrationsPage.filterAriaLabel`),menuAlign:`end`,className:`w-36 shrink-0`})]}),(0,Q.jsx)(`div`,{children:N?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(O,{className:`h-4 w-4 animate-spin`}),(0,Q.jsx)(`span`,{children:`Loading...`})]}):D?(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Failed to load integrations. Please try again.`}):u?M.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-2 rounded-lg border border-dashed border-[var(--border-element)] px-4 py-12 text-center`,children:[(0,Q.jsx)(I,{className:`h-6 w-6 text-[var(--content-disabled)]`}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:P}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:F})]}):(0,Q.jsx)(`div`,{className:`space-y-2`,children:M.map(e=>(0,Q.jsx)(Xe,{platformAssistantId:C??u.id,providerKey:e.provider_key,displayName:e.display_name??e.provider_key,description:e.description,logoUrl:e.logo_url,connection:$(k,e.provider_key),platformGate:c,onConfigure:()=>x(e.provider_key)},e.provider_key))}):(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`No assistant found. Hatch an assistant to connect integrations.`})}),R&&u&&(0,Q.jsx)(Ye,{assistantId:u.id,platformAssistantId:C??u.id,providerKey:R.provider_key,displayName:R.display_name??R.provider_key,description:R.description,logoUrl:R.logo_url,platformGate:c,onClose:()=>x(null)})]})}function Tt(){let[e,t]=s(),n=Ct(e.get(`tab`));return(0,Q.jsx)(`div`,{className:`space-y-6`,children:(0,Q.jsxs)(_.Root,{value:n,onValueChange:n=>{let r=Ct(n),i=new URLSearchParams(e);r===`mcp`?i.set(`tab`,`mcp`):i.delete(`tab`),t(i,{replace:!0})},children:[(0,Q.jsxs)(_.List,{children:[(0,Q.jsx)(_.Trigger,{value:`oauth`,children:`OAuth`}),(0,Q.jsx)(_.Trigger,{value:`mcp`,children:`MCP`})]}),(0,Q.jsx)(_.Panel,{value:`oauth`,className:`pt-4`,children:(0,Q.jsx)(Z.Suspense,{children:(0,Q.jsx)(wt,{})})}),(0,Q.jsx)(_.Panel,{value:`mcp`,className:`pt-4`,children:(0,Q.jsx)(bt,{})})]})})}export{Tt as IntegrationsPage};
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-DiNp24s6.js";import{t as n}from"./react-BFJW0bSv.js";import{t as r}from"./button-VkxVX0DM.js";import{n as i}from"./chunk-5KNZJZUH-BUqIilZr.js";import{t as a}from"./jsx-runtime-BJ8jcmzB.js";import{t as o}from"./card-DUsAeHUS.js";import{t as s}from"./createLucideIcon-B-ZPaMbU.js";import{t as c}from"./external-link-B-pfCiUo.js";import{t as l}from"./tag-Ddzwz3ij.js";import{i as u,t as d}from"./dist-D7UWVopK.js";import{d as f}from"./routes-B7wRw3UT.js";import{p,s as m}from"./platform-detection-Dt0-jSAU.js";import{t as h}from"./use-bus-subscription-BuhDYgS1.js";import{a as g,n as _}from"./notifications-CZJragaI.js";var v=s(`bell-ring`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M22 8c0-2.3-.8-4.3-2-6`,key:`5bb3ad`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}],[`path`,{d:`M4 2C2.8 3.7 2 5.7 2 8`,key:`tap9e0`}]]),y=e(n(),1),b=u(`AndroidNotificationSettings`);function x(){return m()&&d.isPluginAvailable(`AndroidNotificationSettings`)}async function S(){if(x())try{await b.open()}catch(e){t(e,{context:`android_notification_settings_open`,level:`warning`})}}var C=a();function w(e){switch(e){case`granted`:return{description:`Notifications are allowed on this device.`,label:`On`,tone:`positive`};case`denied`:return{description:`Notifications are turned off in Android settings.`,label:`Off`,tone:`negative`};case`prompt`:return{description:`Turn on notifications in Android settings to receive alerts.`,label:`Not enabled`,tone:`warning`};case`unsupported`:return{description:`Notification settings are unavailable in this app version.`,label:`Unavailable`,tone:`neutral`};default:return{description:`Checking notification access for this device.`,label:`Checking`,tone:`neutral`}}}function T(){let e=x(),[t,n]=(0,y.useState)(null);(0,y.useEffect)(()=>{_().then(n)},[]),h(`app.resume`,({signal:e})=>{e!==`online`&&g().then(n)});let i=w(t);return(0,C.jsx)(o,{padding:`lg`,children:(0,C.jsxs)(`div`,{className:`flex flex-col gap-5 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[(0,C.jsx)(`span`,{className:`flex size-11 shrink-0 items-center justify-center rounded-xl bg-[var(--surface-base)] text-[var(--content-secondary)]`,children:(0,C.jsx)(v,{className:`size-5`,"aria-hidden":!0})}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,C.jsx)(`h2`,{className:`text-title-small text-[var(--content-default)]`,children:`Push notifications`}),(0,C.jsx)(l,{tone:i.tone,children:i.label})]}),(0,C.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-secondary)]`,children:i.description})]})]}),e&&(0,C.jsx)(r,{variant:`outlined`,onClick:()=>void S(),disabled:t===null,rightIcon:(0,C.jsx)(c,{"aria-hidden":!0}),className:`self-start sm:self-auto`,children:`Open settings`})]})})}function E(){return p()?(0,C.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-6`,children:[(0,C.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,C.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-[var(--surface-lift)] text-[var(--content-secondary)]`,children:(0,C.jsx)(v,{className:`size-5`,"aria-hidden":!0})}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`h1`,{className:`text-title-medium text-[var(--content-emphasised)]`,children:`Notifications`}),(0,C.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-secondary)]`,children:`Manage how Vellum notifies you on this Android device.`})]})]}),(0,C.jsx)(T,{})]}):(0,C.jsx)(i,{replace:!0,to:f.settings.general})}export{E as NotificationsPage};
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,n,o as r,r as i,s as a}from"./device-settings-DZvv4pnY.js";import{t as o}from"./react-BFJW0bSv.js";import{W as s,t as c}from"./button-VkxVX0DM.js";import{n as l}from"./QueryClientProvider-EuRl-wrW.js";import{t as u}from"./useQuery-CTSuec5b.js";import{t as d}from"./useMutation-D2YPyfEH.js";import{t as f}from"./jsx-runtime-BJ8jcmzB.js";import{t as p}from"./cn-Cf8SmgbR.js";import{t as m}from"./card-DUsAeHUS.js";import{t as h}from"./chevron-down-CmQCCo_x.js";import{t as g}from"./chevron-right-Dwr_Sx98.js";import{t as _}from"./loader-circle-DYe85z3g.js";import{c as v,o as y,r as b,t as x}from"./threshold-presets-DN0_JIJQ.js";import{t as S}from"./pencil-Ba0D7tjH.js";import{t as C}from"./shield-check-B-3lr0Uj.js";import{t as w}from"./trash-2-V2WT_DbX.js";import{t as T}from"./x-zfSDUG5z.js";import{t as E}from"./notice-BlYF-xU3.js";import{t as D}from"./tag-Ddzwz3ij.js";import{t as O}from"./input-DkgpMeG9.js";import{t as k}from"./toggle-0qt1e_3r.js";import{n as A}from"./toast-DqqWkjsh.js";import{t as j}from"./confirm-dialog-Drw1adml.js";import{t as M}from"./select-BKyejRky.js";import{n as N,r as P,y as F}from"./auth-store-DDMY1UvK.js";import{t as ee}from"./sdk.gen-DWvuzSBW.js";import{a as I,m as te,n as ne,o as re,r as ie,s as ae,t as oe}from"./native-biometric-BxYhgb-X.js";import{d as se,u as ce}from"./routes-B7wRw3UT.js";import{m as le,r as ue}from"./platform-detection-Dt0-jSAU.js";import{i as L,r as de,t as fe}from"./use-platform-gate-DJ7NtOkG.js";import{f as pe,p as R}from"./prefs-BLTugIFN.js";import{n as z,t as B}from"./react-query.gen-CwRPAiHT.js";import{a as me,c as he,f as ge,l as _e,n as ve,o as ye,r as V,s as be,u as xe}from"./trust-rules-api-BtUxkSk-.js";import{t as Se}from"./platform-login-notice-BsrEG6VV.js";import{t as H}from"./use-active-assistant-id-BADYKVyx.js";import{t as U}from"./detail-card-BzCuPjtL.js";import{t as W}from"./setting-row-C0mDhzZy.js";import{t as Ce}from"./settings-divider-DGdHGRSV.js";var G=e(o(),1),K=f(),we=[{id:`accessibility`,type:`system`,sourceKind:`accessibility`,label:`Accessibility`,description:`Allows your assistant to click, type, and control apps on your behalf.`},{id:`screen`,type:`system`,sourceKind:`screen`,label:`Screen Recording`,description:`Allows your assistant to capture screen context during computer-use tasks.`},{id:`microphone`,type:`system`,sourceKind:`microphone`,label:`Microphone`,description:`Allows your assistant to capture audio for voice input and recordings.`,windowsDescription:`Allows your assistant to capture audio for voice input and recordings.`},{id:`speechRecognition`,type:`system`,sourceKind:`speechRecognition`,label:`Speech Recognition`,description:`Allows your assistant to transcribe your speech into text on-device.`,windowsDescription:`Allows your assistant to transcribe your speech into text with Windows speech recognition.`},{id:`notifications`,type:`system`,sourceKind:`notifications`,label:`Notifications`,description:`Allows your assistant to send macOS alerts for approvals, messages, and task updates.`,windowsDescription:`Allows your assistant to show Windows notifications for approvals, messages, and task updates.`}],Te=[{id:`notificationBadges`,type:`local`,label:`Notification Badges`}];function Ee(){let[e,t]=(0,G.useState)(null);return{pendingKind:e,run:async(e,n)=>{t(e);try{await n()}catch{}finally{t(t=>t===e?null:t)}}}}function De(){let[e,r]=(0,G.useState)(()=>n(`dockBadgesEnabled`,!0));return(0,G.useEffect)(()=>a(`dockBadgesEnabled`,()=>{r(n(`dockBadgesEnabled`,!0))}),[]),[e,e=>{r(e),t(`dockBadgesEnabled`,e),e||be(0)}]}function Oe({row:e,onToggle:t}){return(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(k,{checked:e.checked,disabled:e.disabled,"aria-label":e.label,onChange:()=>t(e.id)}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>t(e.id),className:p(`block w-full text-left`,e.disabled?`cursor-not-allowed`:`cursor-pointer`),children:[(0,K.jsx)(`span`,{className:`block text-[14px] font-semibold leading-[18px] text-[var(--content-emphasised)]`,children:e.label}),(0,K.jsx)(`span`,{className:`mt-1 block text-[13px] font-medium leading-[18px] text-[var(--content-tertiary)]`,children:e.description})]}),e.error&&(0,K.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:e.error})]})]})}function ke(){return(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin rounded-full border-2 border-[var(--border-base)] border-t-[var(--content-tertiary)]`})}function Ae({compact:e=!1}){let{state:t,loading:n,error:r,supported:i,refresh:a}=ge(),{pendingKind:o,run:s}=Ee(),[c,l]=De(),u=ue()===`windows`,d=(0,G.useMemo)(()=>we.filter(e=>!u||e.windowsDescription),[u]),f=(0,G.useMemo)(()=>{let e=new Map;if(!t)return e;for(let n of d){let r=t[n.sourceKind];r&&e.set(n.id,{meta:n,item:r})}return e},[t,d]),p=(0,G.useMemo)(()=>{let e=d.map(e=>{let t=f.get(e.id)?.item;return t?{id:e.id,label:e.label,description:u&&e.windowsDescription?e.windowsDescription:e.description,checked:t.status===`granted`,disabled:o===e.id||t.status===`restricted`,...t.error?{error:t.error}:{}}:null}).filter(Boolean),t=he()?Te.map(e=>({id:e.id,label:e.label,description:`Allows your assistant to show unseen conversation counts on the ${ye()}.`,checked:c,disabled:o===e.id})):[];return[...e,...t]},[u,c,o,f,d]);if(!i&&p.length===0)return null;let m=async(e,t)=>{t.status===`granted`||t.status===`denied`||!t.canRequest?await _e(e.sourceKind):await xe(e.sourceKind),await a()},h=e=>{let t=f.get(e);if(t){s(e,()=>m(t.meta,t.item));return}e===`notificationBadges`&&s(e,async()=>{l(!c)})};return(0,K.jsxs)(`section`,{className:`w-full rounded-[20px] border border-[var(--border-hover)] bg-[var(--surface-lift)] px-4 pb-3 pt-5`,children:[(0,K.jsx)(`h2`,{className:`text-[18px] font-semibold leading-[22px] text-[var(--content-emphasised)]`,children:`System Permissions`}),n&&p.length===0?(0,K.jsxs)(`div`,{className:`mt-6 flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,K.jsx)(ke,{}),`Checking permissions...`]}):(0,K.jsx)(`div`,{className:`mt-3 space-y-2`,children:p.map(e=>(0,K.jsx)(Oe,{row:e,onToggle:h},e.id))}),r&&(0,K.jsx)(`div`,{role:`alert`,className:`mt-6 rounded-lg border border-[color-mix(in_srgb,var(--system-negative-strong)_25%,transparent)] bg-[var(--system-negative-weak)] p-3 text-body-medium-lighter text-[var(--content-secondary)]`,children:r})]})}function je(){let e=L({platformHostedOnly:!0}),t=fe(),n=de(),r=l(),{data:i,isLoading:a,isError:o}=u({...B(),enabled:e===`full`&&t}),s=d({mutationFn:async e=>{let{data:t}=await ee({body:{access_consented:e},throwOnError:!0});return t},onSuccess:e=>{z(r,void 0,e),A.success(e?.access_consented?`Admin data access enabled.`:`Admin data access disabled.`)},onError:()=>{A.error(`Failed to update log access consent.`)}});if(e===`gated`)return null;let c=e===`full`&&n,f=i?.access_consented??!1,p=e!==`full`||!t||a||o||s.isPending;return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Allow Staff Access`}),(0,K.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-tertiary)]`,children:`When enabled, Vellum Staff will be able to access your assistant and its data for debugging purposes. It's suggested that you leave this off and only turn it on temporarily if you need Vellum Support's help in investigating an issue.`}),e===`full`&&o&&(0,K.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:`Failed to load consent setting.`})]}),(0,K.jsx)(`div`,{className:`flex items-center gap-2`,children:e===`disabled`?null:(0,K.jsxs)(K.Fragment,{children:[(s.isPending||c)&&(0,K.jsx)(_,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,K.jsx)(k,{checked:f,disabled:p,onChange:()=>s.mutate(!f)})]})})]}),e===`disabled`&&(0,K.jsx)(Se,{className:`mt-3`,children:`Log in to the Vellum platform to manage admin data access.`})]})}function Me(){let e=te(),t=le(),[n,r]=(0,G.useState)(()=>ie()),[i,a]=(0,G.useState)(null),[o,s]=(0,G.useState)(!1);if((0,G.useEffect)(()=>{if(!e)return;let t=!0;return ne().then(e=>{t&&a(e)}),()=>{t=!1}},[e]),!e||!i?.available)return null;let c=async()=>{s(!0);try{if(n)I(!1),await oe(),r(!1);else{let e=ae();if(!e||!await re(e)){I(!1),r(!1);return}I(!0),r(!0)}}finally{s(!1)}};return(0,K.jsx)(U,{title:`Security`,children:(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsxs)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`Use `,i.label,` for sign-in`]}),(0,K.jsxs)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-tertiary)]`,children:[`When your session expires, verify with `,i.label,t&&` or your device passcode`,` instead of signing in again.`]})]}),(0,K.jsx)(k,{checked:n,onChange:()=>void c(),disabled:o})]})})}var q=[`youtube.com`,`youtu.be`,`vimeo.com`,`loom.com`];function Ne(e){try{let t=JSON.parse(e);if(Array.isArray(t))return t.filter(e=>typeof e==`string`)}catch{}return[...q]}function Pe(){return n(`mediaEmbedsEnabled`,!0)}function Fe(){let e=i(`mediaEmbedDomains`,``);return e?Ne(e):[...q]}function Ie(){let[e,n]=(0,G.useState)(()=>Pe()),[i,a]=(0,G.useState)(()=>Fe()),[o,s]=(0,G.useState)(!1),[l,u]=(0,G.useState)(``),d=(0,G.useMemo)(()=>l.trim().toLowerCase(),[l]),f=e=>{n(e),t(`mediaEmbedsEnabled`,e)},p=e=>{a(e),r(`mediaEmbedDomains`,JSON.stringify(e))},m=()=>{if(d){if(i.includes(d)){u(``);return}p([...i,d]),u(``)}},_=e=>{p(i.filter(t=>t!==e))},v=()=>{p([...q])},y=i.length===q.length&&i.every((e,t)=>e===q[t]);return(0,K.jsxs)(U,{title:`Media Embeds`,subtitle:`Automatically embed images, videos, and other media shared in chat messages.`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Auto Media Embeds`}),(0,K.jsx)(k,{checked:e,onChange:f})]}),e&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`mt-4`,children:(0,K.jsx)(Ce,{})}),(0,K.jsxs)(c,{type:`button`,variant:`ghost`,onClick:()=>s(e=>!e),className:`mt-4 w-full justify-between px-3`,"aria-expanded":o,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2`,children:[o?(0,K.jsx)(h,{className:`h-4 w-4`,"aria-hidden":!0}):(0,K.jsx)(g,{className:`h-4 w-4`,"aria-hidden":!0}),`Video Domain Allowlist`]}),(0,K.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[i.length,` domain`,i.length===1?``:`s`]})]}),o&&(0,K.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,K.jsx)(O,{label:`Add Domain`,type:`text`,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),m())},placeholder:`Add domain (e.g. example.com)`,fullWidth:!0,wrapperClassName:`flex-1`}),(0,K.jsx)(c,{variant:`primary`,size:`compact`,onClick:m,disabled:!d,children:`Add`})]}),i.length>0&&(0,K.jsx)(`div`,{className:`flex justify-end`,children:(0,K.jsx)(c,{type:`button`,variant:`ghost`,size:`compact`,onClick:v,disabled:y,tintColor:`var(--content-tertiary)`,children:`Reset to Defaults`})}),i.length>0&&(0,K.jsx)(`ul`,{className:`space-y-2`,children:i.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center justify-between rounded-md border border-[var(--border-base)] px-3 py-2 text-body-medium-lighter`,children:[(0,K.jsx)(`span`,{className:`font-mono text-[var(--content-default)]`,children:e}),(0,K.jsx)(c,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,K.jsx)(w,{}),onClick:()=>_(e),"aria-label":`Remove ${e}`})]},e))})]})]})]})}function J(){return(0,K.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}var Y=x.map(e=>({value:e.id,label:e.label,icon:(0,K.jsx)(e.icon,{className:`h-3.5 w-3.5`})}));function Le(){let e=H(),t=l(),{data:n,isError:r}=u({queryKey:[`thresholds`,e],queryFn:()=>y(e),staleTime:3e4}),[i,a]=(0,G.useState)(`relaxed`),[o,s]=(0,G.useState)(`conservative`),[c,d]=(0,G.useState)(`strict`),[f,p]=(0,G.useState)(!1),_=(0,G.useRef)(!1),[S,C]=(0,G.useState)(!1),w=(0,G.useRef)(null),T=(0,G.useRef)(null);(0,G.useEffect)(()=>{!n||_.current||(a(b(n.interactive).id),s(b(n.autonomous).id),d(b(n.headless).id),C(!0))},[n]),(0,G.useEffect)(()=>()=>{w.current!==null&&(clearTimeout(w.current),w.current=null,T.current?.(),T.current=null)},[]);let E=(0,G.useCallback)((n,r,i)=>{if(!e||!S)return;let a=x.find(e=>e.id===n)?.riskThreshold,o=x.find(e=>e.id===r)?.riskThreshold,s=x.find(e=>e.id===i)?.riskThreshold;!a||!o||!s||v(e,{interactive:a,autonomous:o,headless:s}).then(()=>{t.invalidateQueries({queryKey:[`thresholds`,e]})}).catch(()=>{})},[e,S,t]),D=(0,G.useCallback)((e,t,n)=>{w.current!==null&&clearTimeout(w.current),T.current=()=>E(e,t,n),w.current=setTimeout(()=>{T.current?.(),w.current=null,T.current=null},500)},[E]),O=(0,G.useCallback)(e=>{_.current=!0,a(e),D(e,o,c)},[o,c,D]),k=(0,G.useCallback)(e=>{_.current=!0,s(e),D(i,e,c)},[i,c,D]),A=(0,G.useCallback)(e=>{_.current=!0,d(e),D(i,o,e)},[i,o,D]),j=x.find(e=>e.id===i),N=x.find(e=>e.id===o),P=x.find(e=>e.id===c),F=!e||!S;return(0,K.jsxs)(m,{children:[(0,K.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Assistant Access`}),(0,K.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Control which actions your assistant can take without asking first. Each action is classified by risk level — your access level determines which levels auto-approve. Trust Rules fine-tune this for specific actions by raising or lowering their risk.`}),r&&(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--system-negative-strong)]`,children:`Could not load threshold settings. Check your connection and reload.`}),(0,K.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Conversations`}),(0,K.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When you're chatting with your assistant directly.`}),(0,K.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,K.jsx)(M,{value:i,onChange:O,options:Y,disabled:F})}),j&&(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:j.description})]}),(0,K.jsx)(J,{}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>p(e=>!e),className:`flex items-center gap-1 text-[var(--content-secondary)] hover:text-[var(--content-default)] transition-colors`,"aria-expanded":f,children:[f?(0,K.jsx)(h,{className:`h-4 w-4`}):(0,K.jsx)(g,{className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`text-body-medium-default`,children:`Advanced`})]}),(0,K.jsxs)(`div`,{className:f?`mt-4 space-y-4`:`hidden`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Background`}),(0,K.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When your assistant acts without you — scheduled tasks, background jobs, and external triggers.`}),(0,K.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,K.jsx)(M,{value:o,onChange:k,options:Y,disabled:F})}),N&&(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:N.description})]}),(0,K.jsx)(J,{}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Headless`}),(0,K.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When triggered externally with no interactive client.`}),(0,K.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,K.jsx)(M,{value:c,onChange:A,options:Y,disabled:F})}),P&&(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:P.description})]})]})]})]})]})}var X=e(s(),1),Re=[`bash`,`file_read`,`file_write`,`file_edit`,`web_fetch`,`skill_load`],ze=[{value:`low`,label:`Low`,description:`Auto-approve without prompting`},{value:`medium`,label:`Medium`,description:`Prompt before executing`},{value:`high`,label:`High`,description:`Always require explicit approval`}];function Z({assistantId:e,existingRule:t,onClose:n,onSaved:r}){let i=(0,G.useRef)(null),[a,o]=(0,G.useState)(t.tool),[s,c]=(0,G.useState)(t.pattern),[l,u]=(0,G.useState)(t.risk),[d,f]=(0,G.useState)(t.description??``),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=s.trim(),v=_.length>0&&!p,y=(0,G.useCallback)(async n=>{if(n.preventDefault(),!v)return;let i=d.trim()||`${a} — ${_}`;m(!0),g(null);try{await me(e,t.id,{risk:l,description:i}),r()}catch(e){g(e instanceof Error?e.message:`Failed to save trust rule.`)}finally{m(!1)}},[e,v,d,t,r,l,a,_]);return(0,X.createPortal)((0,K.jsx)(`div`,{ref:i,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`trust-rule-form-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:(0,G.useCallback)(e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),n())},[n]),onClick:(0,G.useCallback)(e=>{e.target===i.current&&n()},[n]),children:(0,K.jsxs)(`div`,{className:`mx-4 flex max-h-[calc(100vh-2rem)] w-full max-w-md flex-col rounded-xl border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,K.jsx)(`h2`,{id:`trust-rule-form-title`,className:`text-title-medium text-[var(--content-default)]`,children:`Edit Trust Rule`}),(0,K.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Close`,className:`rounded-lg p-1.5 text-[var(--content-tertiary)] transition-colors hover:bg-[var(--surface-base)] hover:text-[var(--content-default)]`,children:(0,K.jsx)(T,{className:`h-4 w-4`})})]}),(0,K.jsxs)(`form`,{onSubmit:e=>void y(e),className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-6 py-4`,children:[h&&(0,K.jsx)(E,{tone:`error`,children:h}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{htmlFor:`trust-rule-tool`,className:`block text-body-medium-default text-[var(--content-default)]`,children:`Tool`}),(0,K.jsx)(`div`,{className:`mt-1`,children:(0,K.jsx)(M,{value:a,onChange:o,disabled:!0,options:Re.map(e=>({value:e,label:e}))})})]}),(0,K.jsx)(O,{label:`Pattern`,type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`e.g., git *`,disabled:!0}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:`Risk Level`}),(0,K.jsx)(`div`,{className:`mt-2 flex gap-2`,children:ze.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>u(e.value),className:`flex-1 rounded-lg border px-3 py-2 text-left text-body-small-default transition-colors ${l===e.value?e.value===`low`?`border-[var(--system-positive-strong)] bg-[var(--system-positive-weak)] text-[var(--system-positive-strong)]`:e.value===`medium`?`border-[var(--system-warning-strong)] bg-[var(--system-warning-weak)] text-[var(--system-warning-strong)]`:`border-[var(--system-negative-strong)] bg-[var(--system-negative-weak)] text-[var(--system-negative-strong)]`:`border-[var(--border-element)] text-[var(--content-default)] hover:bg-[var(--surface-base)]`}`,children:[(0,K.jsx)(`div`,{children:e.label}),(0,K.jsx)(`div`,{className:`mt-0.5 text-label-medium-default leading-tight opacity-70`,children:e.description})]},e.value))})]}),(0,K.jsx)(O,{label:`Description (optional)`,type:`text`,value:d,onChange:e=>f(e.target.value),placeholder:`${a} — ${_||`pattern`}`}),(0,K.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-lg border border-[var(--border-element)] bg-white px-4 py-2 text-body-medium-default text-[var(--content-default)] transition-colors hover:bg-[var(--surface-base)] dark:border-[var(--border-base)] dark:bg-[var(--surface-lift)] dark:hover:bg-[var(--ghost-hover)]`,children:`Cancel`}),(0,K.jsx)(`button`,{type:`submit`,disabled:!v,className:`rounded-lg bg-[var(--system-positive-strong)] px-4 py-2 text-body-medium-default text-white transition-colors hover:bg-[var(--system-positive-strong)] disabled:cursor-not-allowed disabled:opacity-50`,children:p?`Saving…`:`Save`})]})]})]})}),document.body)}function Be(e){return e.origin===`default`&&!e.userModified}function Ve(e,t){let n=new Set,r=[];for(let t of e)n.has(t.id)||(n.add(t.id),r.push(t));for(let e of t)n.has(e.id)||(n.add(e.id),r.push(e));return r.sort((e,t)=>e.tool===t.tool?e.description.localeCompare(t.description):e.tool.localeCompare(t.tool))}function He(e){switch(e){case`low`:return`positive`;case`medium`:return`warning`;case`high`:return`negative`}}function Q(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Ue({assistantId:e,onClose:t}){let n=(0,G.useRef)(null),[r,i]=(0,G.useState)([]),[a,o]=(0,G.useState)(!0),[s,l]=(0,G.useState)(null),[u,d]=(0,G.useState)(null),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(!1),g=(0,G.useCallback)(async t=>{if(t){let[t,n]=await Promise.all([V(e),V(e,{origin:`default`})]);return Ve(t,n)}return V(e)},[e]),_=(0,G.useCallback)(async()=>{o(!0);try{i(await g(m)),l(null)}catch(e){l(e instanceof Error?e.message:`Failed to load trust rules.`)}finally{o(!1)}},[g,m]);(0,G.useEffect)(()=>{let e=!1;return(async()=>{o(!0);try{let t=await g(m);e||(i(t),l(null))}catch(t){e||l(t instanceof Error?t.message:`Failed to load trust rules.`)}finally{e||o(!1)}})(),()=>{e=!0}},[g,m]);let v=(0,G.useCallback)(async()=>{if(f)try{await ve(e,f.id),_()}catch(e){l(e instanceof Error?e.message:`Failed to delete trust rule.`)}finally{p(null)}},[e,f,_]);return(0,X.createPortal)((0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{ref:n,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`trust-rules-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:(0,G.useCallback)(e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),t())},[t]),onClick:(0,G.useCallback)(e=>{e.target===n.current&&t()},[t]),children:(0,K.jsxs)(`div`,{className:`mx-4 flex max-h-[80vh] w-full max-w-2xl flex-col rounded-xl border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,K.jsx)(`h2`,{id:`trust-rules-title`,className:`text-title-medium text-[var(--content-default)]`,children:`Trust Rules`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(k,{checked:m,onChange:h,label:`Show all defaults`}),(0,K.jsx)(c,{variant:`outlined`,onClick:t,children:`Done`})]})]}),(0,K.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4`,children:[s&&(0,K.jsx)(`div`,{className:`mb-3`,children:(0,K.jsx)(E,{tone:`error`,children:s})}),a?(0,K.jsx)(`div`,{className:`flex h-48 items-center justify-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Loading…`}):r.length===0?(0,K.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-2 px-6 text-[var(--content-tertiary)]`,children:[(0,K.jsx)(C,{className:`h-8 w-8`}),(0,K.jsx)(`p`,{className:`max-w-xs text-center text-body-medium-lighter`,children:`No trust rules yet. Rules are created when you classify actions from permission prompts.`})]}):(0,K.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)]`,children:r.map(e=>{let t=Be(e);return(0,K.jsxs)(`li`,{className:`flex items-start gap-3 py-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e.tool}),(0,K.jsx)(D,{tone:He(e.risk),children:Q(e.risk)}),e.origin===`default`&&(0,K.jsx)(D,{tone:`neutral`,children:`Default`}),e.userModified&&(0,K.jsx)(D,{tone:`warning`,children:`Modified`})]}),(0,K.jsx)(`div`,{className:`mt-1 truncate font-mono text-body-small-default text-[var(--content-secondary)]`,children:e.pattern}),e.description&&(0,K.jsx)(`div`,{className:`mt-0.5 truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":`Edit ${e.tool} rule`,onClick:()=>d(e),className:`rounded-lg p-1.5 text-[var(--content-tertiary)] transition-colors hover:bg-[var(--surface-base)] hover:text-[var(--content-default)]`,children:(0,K.jsx)(S,{className:`h-4 w-4`})}),(!t||e.userModified)&&(0,K.jsx)(c,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,K.jsx)(w,{className:`h-4 w-4`}),"aria-label":`Delete ${e.tool} rule`,onClick:()=>p(e)})]})]},e.id)})})]})]})}),u&&(0,K.jsx)(Z,{assistantId:e,existingRule:u,onClose:()=>d(null),onSaved:()=>{d(null),_()}}),(0,K.jsx)(j,{open:f!==null,title:`Delete Trust Rule?`,message:f?`Remove the ${Q(f.risk).toLowerCase()}-risk rule for ${f.tool} matching "${f.pattern}"?`:``,confirmLabel:`Delete`,cancelLabel:`Cancel`,destructive:!0,onConfirm:()=>void v(),onCancel:()=>p(null)})]}),document.body)}function We(){let e=H(),[t,n]=(0,G.useState)(!1);return(0,K.jsxs)(m,{children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(C,{className:`mt-0.5 h-5 w-5 shrink-0 text-[var(--content-secondary)]`}),(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Trust Rules`}),(0,K.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Manage per-tool rules that control which actions auto-approve and which require your explicit permission.`})]}),(0,K.jsx)(c,{variant:`outlined`,onClick:()=>n(!0),children:`Manage`})]}),t&&(0,K.jsx)(Ue,{assistantId:e,onClose:()=>n(!1)})]})}var Ge=[{value:`dontRetain`,label:`Don't retain`},{value:`oneHour`,label:`1 hour`},{value:`oneDay`,label:`1 day`},{value:`sevenDays`,label:`7 days`},{value:`thirtyDays`,label:`30 days`},{value:`ninetyDays`,label:`90 days`},{value:`keepForever`,label:`Keep forever`}],Ke=`thirtyDays`;function $(){return(0,K.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}function qe(){let e=L({platformHostedOnly:!0}),t=P(),n=t,a=N.use.user()?.id??null,[o]=pe(),[s]=R(),c=o??!0,l=s??!0,[u,d]=(0,G.useState)(()=>i(`llmLogRetention`,Ke));return(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(Me,{}),(0,K.jsx)(Ae,{}),(0,K.jsx)(We,{}),(0,K.jsx)(Le,{}),(0,K.jsx)(Ie,{}),(0,K.jsx)(U,{title:`Privacy`,subtitle:t?(0,K.jsxs)(K.Fragment,{children:[`View details about what data we collect and how it's used in our`,` `,(0,K.jsx)(`a`,{href:ce(se.docs.legal.privacyPolicy),target:`_blank`,rel:`noreferrer`,className:`underline`,children:`privacy policy`}),`.`]}):void 0,children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[n&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(W,{label:`Share Analytics`,helperText:`Send aggregated product usage data`,checked:c,onChange:()=>{F(`share_analytics`,!c,{userId:a,hasPlatformSession:t})},variant:`toggle-trailing`}),(0,K.jsx)($,{}),(0,K.jsx)(W,{label:`Share Diagnostics`,helperText:`Send crash reports, conversation traces, and session replay data`,checked:l,onChange:()=>{F(`share_diagnostics`,!l,{userId:a,hasPlatformSession:t})},variant:`toggle-trailing`}),(0,K.jsx)($,{})]}),(0,K.jsx)(je,{}),e!==`gated`&&(0,K.jsx)($,{}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{htmlFor:`llm-log-retention`,className:`block text-body-medium-default text-[var(--content-default)]`,children:`LLM Request Log Retention`}),(0,K.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,K.jsx)(M,{value:u,onChange:e=>{d(e),r(`llmLogRetention`,e)},options:Ge})}),(0,K.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:`How long to keep LLM request and response logs on this device. These logs record the prompts and completions sent to model providers and are used for debugging. Shorter retention improves privacy; longer retention helps troubleshoot issues.`})]})]})})]})}export{qe as PrivacyPage};
@@ -1 +0,0 @@
1
- var e={chooseProfilePlaceholder:`Elegir perfil…`,description:`El perfil que tu asistente consulta para una segunda opinión cuando quiere revisar un plan o su propio trabajo.`,title:`Asesor`},t={defaultEntryMeta:`Predeterminado`},n={backgroundConfirmContinue:`Continuar`,backgroundConfirmKeepWaiting:`Seguir esperando`,backgroundConfirmTitle:`¿Continuar en segundo plano?`},r={billingTab:`Facturación`,billingUnavailable:`La facturación no está disponible para el estado actual del asistente.`,finishSetupBody:`La dirección de correo de tu asistente aún no se ha configurado.`,finishSetupButton:`Finalizar configuración`,finishSetupTitle:`Termina de configurar tu plan {plan}`,loadingBilling:`Cargando facturación…`,platformLoginNotice:`Inicia sesión en la plataforma Vellum para administrar la facturación y el uso.`,usageTab:`Uso`},i={successToast:`¡Pago recibido! Tu saldo de créditos se actualizará en breve.`,topUpCancelToast:`Se canceló el pago. No se añadieron créditos.`,upgradeCancelToast:`Mejora cancelada. No hay cambios en tu plan.`},a={affectedSummary:`{count, plural, one {# acción usa actualmente {profile}} other {# acciones usan actualmente {profile}}}`,applyTo:`{count, plural, one {Aplicar a # acción} other {Aplicar a # acciones}}`,cancel:`Cancelar`,changeToLabel:`Cambiar a`,chooseActions:`Elige qué acciones actualizar.`,clearAll:`Borrar todo`,currentlyUsingLabel:`Usando actualmente`,intro:`Actualiza las acciones que actualmente usan un perfil. El resultado se guarda como anulaciones individuales.`,noticeBody:`Cambia las acciones seleccionadas que usan {sourceLabel} hoy. No crea una regla continua entre perfiles.`,noticeTitle:`Esto ocurre una sola vez.`,selectAll:`Seleccionar todo`,successToast:`Se actualizaron {count, plural, one {# acción} other {# acciones}} a "{targetLabel}".`,targetPlaceholder:`Selecciona un perfil…`,title:`Cambiar anulaciones de acciones`,updateFailedToast:`No se pudieron actualizar las anulaciones. Inténtalo de nuevo.`,viaDefault:`Predeterminado`,viaOverride:`Anulación`,willChange:`{count, plural, one {Cambiará # acción} other {Cambiarán # acciones}}`},o={defaultProfileSuffix:`· Predeterminado: {label}`,modelLabel:`Modelo`,overrideAriaLabel:`Anular {displayName}`,pickModelError:`Elige un modelo`,providerLabel:`Proveedor`,unavailableOption:`{name} (no disponible)`},s={completeFailed:`No se pudo completar el inicio de sesión. Inténtalo de nuevo.`,completeSignIn:`Completar inicio de sesión`,completingSignIn:`Completando inicio de sesión...`,connected:`Suscripción a ChatGPT conectada correctamente.`,intro:`Conecta tu suscripción a ChatGPT para usar modelos de OpenAI sin una clave de API.`,invalidUrl:`URL no válida. Pega la URL completa de la barra de direcciones.`,missingCode:`A la URL le falta el código de autorización. Asegúrate de haber copiado la URL completa.`,missingState:`A la URL le falta el parámetro state. Asegúrate de haber copiado la URL completa.`,pasteUrlError:`Pega la URL de la página de error.`,signInButton:`Iniciar sesión con ChatGPT`,startFailed:`No se pudo iniciar el inicio de sesión con ChatGPT. Inténtalo de nuevo.`,startingSignIn:`Iniciando sesión...`,step1Idle:`1. Haz clic en "Iniciar sesión con ChatGPT" abajo para abrir una ventana emergente`,step1PasteUrl:`1. Haz clic en "Iniciar sesión con ChatGPT" para abrir una ventana emergente`,step2:`2. Inicia sesión; llegarás a una página de error, y eso es normal`,step3:`3. Copia la URL completa de la barra de direcciones de esa página y pégala abajo`,tryAgain:`Intentar de nuevo`,urlPlaceholder:`Pega aquí la URL de devolución de llamada...`},c={body:`Reclama un crédito único de {amount} y lo añadiremos directamente al saldo de tu cuenta. No se requiere ningún pago.`,claim:`Reclamar {amount} en créditos`,decline:`No, gracias`,errorToast:`No se pudieron añadir los créditos. Inténtalo de nuevo.`,grantedToast:`Se añadieron {amount} en créditos a tu cuenta.`,title:`Aquí tienes {amount} de nuestra parte`,unavailableToast:`Esta oferta ya no está disponible.`},l={awaitingReturnMessage:`El pago se abrió en tu navegador. Complétalo allí para finalizar la mejora.`,checkoutFailedMessage:`No pudimos iniciar el pago. Inténtalo de nuevo.`,continueSetup:`Continuar configuración`,preparingCheckout:`Preparando pago…`,preparingCheckoutAriaLabel:`Preparando pago`,reopenCheckout:`Reabrir pago`,tryAgain:`Intentar de nuevo`,viewPlans:`Ver planes`},u={assistantFallbackName:`tu asistente`,returnTo:`Volver a {assistantName}`,title:`¡Ya está todo listo!`},d={cancel:`Cancelar`,comparedToPrevious:`{delta} en comparación con el anterior ({previous})`,continue:`Continuar`,creditBundleAriaLabel:`Paquete de créditos`,creditBundlePlaceholder:`Selecciona un paquete de créditos`,creditsDocsAriaLabel:`Más información sobre paquetes de créditos`,creditsLabel:`Añade créditos:`,learnMore:`Más información`,machineSizeAriaLabel:`Tamaño de máquina`,machineSizeDocsAriaLabel:`Más información sobre tamaños de máquina`,machineSizeLabel:`Selecciona un tamaño de máquina:`,machineSizePlaceholder:`Selecciona un tamaño de máquina`,recap:`Resumen`,storageAriaLabel:`Almacenamiento`,storageDocsAriaLabel:`Más información sobre almacenamiento`,storageLabel:`Selecciona almacenamiento:`,storagePlaceholder:`Selecciona almacenamiento`,subtitle:`Simplemente mejor.`,title:`Crear un plan personalizado`,totalBilledMonthly:`Total · Facturación mensual`,yourSelection:`Tu selección:`},f={configure:`Configurar`,currentPlanTag:`Tu plan actual`,genericDescriptor:`Selecciona potencia de CPU, RAM y almacenamiento personalizados. O añade algunos tokens.`,prompt:`¿Necesitas algo más adaptado a tus necesidades?`,title:`Plan personalizado`},p={continue:`Continuar`,domainLockedMessage:`Este dominio ya está establecido y no se puede cambiar.`,domainSetRedirecting:`Dominio establecido. Redirigiendo…`,handleImmutableNotice:`No podrás cambiar el identificador una vez establecido.`,handleLabel:`Identificador (público)`,machineBusyNotice:`Tu asistente se está reiniciando; podrás establecer el dominio en un momento.`,next:`Siguiente`,prefixLabel:`Prefijo`,registerSubdomainFailed:`No se pudo registrar ese subdominio. Prueba con otro.`,skip:`Omitir`,subtitle:`Configura un correo para tu asistente.`,title:`Correo del asistente`},m={addressLabel:`Dirección`,checkingSubscription:`Comprobando suscripción…`,confirm:`Confirmar`,create:`Crear`,createEmailFailedFallback:`No se pudo crear la dirección de correo.`,creating:`Creando…`,domainLabel:`Dominio`,domainRegisteredToast:`Dominio {domain} registrado.`,domainReleaseFailedToast:`No se pudo liberar el dominio.`,domainReleasedToast:`Dominio liberado.`,emailAddressLabel:`Dirección de correo`,emailCreatedToast:`Dirección de correo creada.`,emailRemoveFailedToast:`No se pudo eliminar la dirección de correo.`,emailRemovedToast:`Dirección de correo eliminada.`,emailUsernameAriaLabel:`Nombre de usuario del correo`,emailUsernamePlaceholder:`hola`,enterSubdomainError:`Introduce un subdominio.`,enterUsernameError:`Introduce un nombre de usuario de correo.`,register:`Registrar`,registerDomainFailedFallback:`No se pudo registrar el dominio.`,registering:`Registrando…`,releaseConfirm:`Liberar`,releaseDomainAriaLabel:`Liberar dominio`,releaseDomainConfirmMessage:`¿Seguro que quieres liberar <code>{domain}</code>? El subdominio quedará disponible para que otros lo reclamen.`,releaseDomainTitle:`Liberar dominio`,removeAddressFirstToast:`Elimina primero la dirección de correo.`,removeConfirm:`Eliminar`,removeEmailAriaLabel:`Eliminar dirección de correo`,removeEmailConfirmMessage:`¿Seguro que quieres eliminar <code>{address}</code>? Tu asistente ya no podrá enviar ni recibir correo en esta dirección.`,removeEmailTitle:`Eliminar dirección de correo`,retry:`Reintentar`,setSubdomainConfirmMessage:`<code>{subdomain}</code> también será el identificador público de tu asistente. No podrás cambiarlo una vez establecido.`,setSubdomainTitle:`Establecer subdominio`,subdomainExamplePlaceholder:`mi-asistente`,subdomainFallback:`subdominio`,subdomainHint:`Cada asistente tiene su propio subdominio. Solo letras minúsculas, números y guiones.`,subdomainLabel:`Subdominio`,subscriptionWarningBody:`No pudimos contactar con el servicio de facturación. El formulario siguiente asume que el correo gestionado está habilitado para tu organización. Si no lo está, registrar un dominio fallará.`,subscriptionWarningTitle:`No se pudo verificar el estado de la suscripción`,upgradeButton:`Mejorar plan`,upgradeNoticeBody:`Mejora a un plan que incluya una dirección de correo para tu asistente. No hace falta configurar un proveedor.`,upgradeNoticeTitle:`Dale a tu asistente su propia dirección de correo`,usageSummary:`{sent} / {limit} enviados hoy · {received} recibidos`},h={apiKeyConfigured:`Clave API de {providerName} configurada. Para reconfigurar, ejecuta la habilidad <code>{setupSkill}</code>.`,connecting:`Conectando con la plataforma Vellum…`,openProvider:`Abrir {providerName}`,platformLoginNotice:`Inicia sesión en la plataforma Vellum para administrar la configuración de correo.`,providerLabel:`Proveedor`,saveSuccessToast:`Configuración de correo guardada.`,setupInstructions:`Configura {providerName} mediante la CLI del asistente: pídele al asistente que ejecute la habilidad <code>{setupSkill}</code>. Te guiará para guardar la clave API, detectar el dominio y (opcionalmente) configurar un webhook entrante.`,subtitle:`Configura cómo tu asistente envía y recibe correo`,title:`Correo`},g={fetchErrorTitle:`No se pudo acceder a facturación`,goToBilling:`Ir a facturación`},_={bodyCancelOnly:`Se te llevará a Stripe para cancelar tu suscripción.`,bodyWithFeatures:`Al bajar de plan se eliminan las siguientes funciones Pro. Se te llevará a Stripe para cancelar tu suscripción.`,cancel:`Cancelar`,confirm:`Bajar a Base`,title:`¿Bajar a Base?`},v={activeModelLabel:`Modelo activo`,apiKeyLabel:`Clave de API`,configUpdateFailedToast:`No se pudo actualizar la configuración del asistente. Inténtalo de nuevo.`,geminiApiKeyPlaceholder:`Introduce tu clave de API de Gemini`,localPreferencesFailedToast:`Guardado, pero no se pudieron escribir las preferencias locales.`,modelAriaLabel:`Modelo de generación de imágenes`,modelUpdateFailedToast:`No se pudo actualizar el modelo de generación de imágenes. Inténtalo de nuevo.`,openaiApiKeyPlaceholder:`Introduce tu clave de API de OpenAI`,providerAriaLabel:`Proveedor de generación de imágenes`,providerLabel:`Proveedor`,savedToast:`Configuración de generación de imágenes guardada.`,subtitle:`Configura qué modelo usa tu asistente para generar imágenes`,title:`Generación de imágenes`,vellumNote:`La generación de imágenes se ejecuta a través de tu cuenta de Vellum.`},y={filterAriaLabel:`Filtrar integraciones`,filterAll:`Todas`,filterEnabled:`Habilitadas`,filterNotEnabled:`No habilitadas`},b={defaultProviderUnavailable:`Tu proveedor predeterminado no está disponible.`,manage:`Administrar`,overridesTitle:`Anulaciones`,subtitle:`Los perfiles eligen qué modelo responde. Los proveedores dan acceso a él`,title:`Modelo de lenguaje`},x={actionOverridesTitle:`Anulaciones de acciones`,cancel:`Cancelar`,clauseActionOverrides:`lo usa {count, plural, one {# anulación de acción} other {# anulaciones de acciones}}`,clauseDefaultProfile:`es tu perfil predeterminado`,clauseRunsBoth:`ejecuta {schedules, plural, one {# programación} other {# programaciones}} y {reminders, plural, one {# recordatorio} other {# recordatorios}}`,clauseRunsReminders:`ejecuta {count, plural, one {# recordatorio} other {# recordatorios}}`,clauseRunsSchedules:`ejecuta {count, plural, one {# programación} other {# programaciones}}`,disabledTargetTooltip:`Habilita este perfil para mover programaciones a él.`,moreSchedules:`y {count} más`,reassignAndDelete:`Reasignar y eliminar`,replacementLabel:`Perfil de reemplazo`,replacementPlaceholder:`Selecciona un reemplazo…`,saving:`Guardando…`,scheduleLookupFailed:`No pudimos comprobar qué programaciones usan este perfil. Cualquier programación fijada a él también se moverá al reemplazo.`,schedulesTitle:`Programaciones`,summaryNoReferences:`Elige un perfil de reemplazo para "{display}". Todo lo que aún apunte a él se moverá allí antes de eliminarlo.`,summaryOneClause:`"{display}" {clause1}. Elige un reemplazo abajo y esas referencias se moverán a él; después se eliminará "{display}".`,summaryThreeClauses:`"{display}" {clause1}, {clause2} y {clause3}. Elige un reemplazo abajo y esas referencias se moverán a él; después se eliminará "{display}".`,summaryTwoClauses:`"{display}" {clause1} y {clause2}. Elige un reemplazo abajo y esas referencias se moverán a él; después se eliminará "{display}".`,title:`Elige un perfil de reemplazo`},S={emptySearch:`Ninguna acción coincide con tu búsqueda.`},C={advisorSection:`Asesor`,bulkChange:`Cambio masivo`,bulkChangeNoCandidatesTitle:`Ninguna acción usa actualmente un perfil`,bulkChangeUnsavedTitle:`Guarda o restablece tus cambios primero`,customProfileOption:`Personalizado`,description:`Personaliza qué perfil de modelo deben usar acciones concretas. Usa tu perfil predeterminado si no hay anulación.`,loadErrorHint:`Asegúrate de que tu asistente esté en ejecución`,loadErrorTitle:`No se pudieron cargar las acciones`,otherDomain:`Otros`,overridesResetToast:`Anulaciones restablecidas.`,overridesSavedToast:`Anulaciones guardadas.`,resetConfirmMessage:`Todas las anulaciones de acciones se restablecerán y seguirán su valor predeterminado. Esto no se puede deshacer.`,resetFailedToast:`No se pudieron restablecer las anulaciones. Inténtalo de nuevo.`,resetToDefaults:`Restablecer valores predeterminados`,retry:`Reintentar`,save:`Guardar`,saveFailedToast:`No se pudieron guardar las anulaciones. Inténtalo de nuevo.`,searchPlaceholder:`Buscar acciones…`,title:`Anulaciones de acciones`},w={cancel:`Cancelar`},T={currentPlan:`Plan actual`,includes:`Incluye:`,recommended:`Recomendado`},E={alreadyOnPlanToast:`Ya estás en este plan.`,back:`Atrás`,billedMonthlyCaption:`Facturación mensual`,cancelAnytimeFooter:`Puedes cancelar o cambiar tu plan cuando quieras. Para obtener más información, <docsLink>Lee nuestra documentación.</docsLink>`,checkoutFailedToast:`No se pudo iniciar el pago de mejora. Inténtalo de nuevo.`,downgradeTo:`Bajar a {name}`,featureComputer:`Ordenador {machine}`,featureCreditsIncluded:`{amount} en créditos incluidos`,featureStorage:`{gib} GB de almacenamiento`,foreverCaption:`Para siempre`,freeFeaturePayAsYouGo:`Créditos de pago por uso`,freeFeatureSmallComputer:`Ordenador pequeño`,freeFeatureStorage:`{gib} GB de almacenamiento`,freePriceLabel:`Gratis`,heading:`Dale más potencia a tu asistente`,loadingPlansAriaLabel:`Cargando planes`,planUpdatedToast:`Plan actualizado.`,startFreeCta:`Empezar gratis`,subheading:`Elige el nivel que se ajuste a cuánto quieres que se encargue.`},D={contextWindowLabel:`Ventana de contexto`,defaultValueLabel:`Predeterminado · {value}`,effortLabel:`Esfuerzo`,effortSegmentDefault:`predeterminado`,enableExtendedThinkingLabel:`Habilitar pensamiento extendido`,maxOutputTokensLabel:`Máximo de tokens de salida`,reset:`Restablecer`,snapshotsHint:`Los campos que dejes en su valor predeterminado se guardan con los valores mostrados y no cambiarán si los valores predeterminados del asistente cambian más adelante.`,speedLabel:`Velocidad`,streamThinkingTokensLabel:`Transmitir tokens de pensamiento`,temperatureLabel:`Temperatura`,thinkingLevelInheritHint:`(predeterminado = heredar)`,thinkingLevelLabel:`Nivel de pensamiento`,tokensAriaLabel:`{label} (tokens)`,topPLabel:`Top P`,verbosityLabel:`Verbosidad`},O={createProfile:`Crear perfil`,defaultTitle:`Perfil`,delete:`Eliminar`,deleting:`Eliminando…`,managedTag:`Administrado por Vellum`,newProfileTitle:`Perfil nuevo`,save:`Guardar`,saveAsNew:`Guardar como nuevo`,saveChanges:`Guardar cambios`,saving:`Guardando…`},k={subscriptionSteeringHint:`Tu suscripción a ChatGPT está disponible como el proveedor ChatGPT.`},A={activeLabel:`Activo`,addApiKey:`Añadir clave API`,advanced:`Avanzado`,createNewProvider:`+ Crear proveedor nuevo`,descriptionLabel:`Descripción <optional>(opcional)</optional>`,descriptionPlaceholder:`Describe cuándo usar este perfil`,displayNameLabel:`Nombre para mostrar`,displayNamePlaceholder:`p. ej., Rápido y económico`,keyLabel:`Clave`,keyPlaceholder:`p. ej., rapido-economico`,nameLabel:`Nombre`,newProviderNote:`La nueva conexión de proveedor aparecerá en la sección Proveedores.`,providerLabel:`Proveedor`,selectProviderPlaceholder:`Selecciona un proveedor…`,setUp:`Configurar`},j={cancel:`Cancelar`,close:`Cerrar`,editProfileTitle:`Editar perfil`,newProfileTitle:`Nuevo perfil`,platformTag:`Plataforma`,profileFallbackTitle:`Perfil`,save:`Guardar`,saveAsNew:`Guardar como nuevo`,saving:`Guardando…`},M={chooseFromList:`Elegir de la lista`,connectionNotFound:`Este perfil hacía referencia a una credencial que ya no existe. Al guardar, se restablecerá para usar la clave disponible del proveedor.`,customModelAriaLabel:`ID de modelo personalizado`,customModelPlaceholder:`proveedor/id-modelo`,enterCustomModelIdHint:`Introduce el identificador exacto del modelo que espera tu proveedor. Se envía a la conexión tal cual.`,enterCustomModelIdOption:`Introduce un ID de modelo personalizado…`,modelAriaLabel:`Modelo`,modelEmptyConfigureConnectionHint:`No hay modelos disponibles. Configura modelos en la conexión del proveedor primero.`,modelEmptyConfigureConnectionPlaceholder:`Configura modelos en la conexión`,modelEmptyNoProviderPlaceholder:`Selecciona un proveedor primero`,modelEmptyUnknownHint:`No hay modelos disponibles para este proveedor en esta versión de la app. Actualiza la app o introduce un ID de modelo personalizado.`,modelEmptyUnknownPlaceholder:`No hay modelos disponibles`,modelLabel:`Modelo`,noProviderConnectionsHint:`No hay conexiones de proveedor. Abre Proveedores para añadir una.`,providerLabel:`Proveedor`,providerNotFoundSuffix:`(no encontrado)`,selectModelError:`Selecciona un modelo.`,selectModelPlaceholder:`Selecciona un modelo`,selectProviderPlaceholder:`Selecciona un proveedor…`},N={actionsAriaLabel:`Acciones para {displayName}`,defaultTag:`Predeterminado`,delete:`Eliminar`,disable:`Desactivar`,disabledTag:`Desactivado`,edit:`Editar`,enable:`Activar`,makeDefault:`Hacer predeterminado`,managedByVellum:`Gestionado por Vellum`,openProfileAriaLabel:`Abrir perfil {displayName}`,providerUnavailableDefault:`El proveedor de este perfil no está disponible.`,providerUnavailableFixable:`{message} Haz clic para corregirlo.`,view:`Ver`},P={createProfile:`Crear perfil`,emptyState:`Aún no hay perfiles. Crea uno para empezar.`,loading:`Cargando perfiles…`,title:`Perfiles`},F={add:`Añadir`,addNamed:`Añadir {name}`,addProviderDescription:`Elige un proveedor y pega su clave API.`,addProviderTitle:`Añadir proveedor`,advanced:`Avanzado`,apiKeyPlaceholder:`Introduce tu clave API`,baseUrlLabel:`URL base`,baseUrlPlaceholder:`https://api.x.ai/v1`,cancel:`Cancelar`,customProviderHint:`Los proveedores personalizados se conectan a cualquier endpoint que ofrezca la API compatible con OpenAI: xAI, Groq, LM Studio, vLLM y similares.`,customProviderOption:`Proveedor personalizado`,displayNameLabel:`Nombre para mostrar <optional>(opcional)</optional>`,displayNamePlaceholder:`p. ej., Mi clave de Anthropic`,emptyServerResponse:`El servidor devolvió una respuesta vacía. Inténtalo de nuevo.`,enterApiKeyOrCredential:`Introduce una clave API o selecciona una credencial existente.`,failedSaveApiKey:`No se pudo guardar la clave API. Inténtalo de nuevo.`,failedSaveProvider:`No se pudo guardar el proveedor. Inténtalo de nuevo.`,localEndpointHint:`Deja la clave vacía para endpoints locales: se conectan sin clave.`,modelsHint:`Identificadores de modelo separados por comas expuestos por tu endpoint.`,modelsLabel:`Modelos`,modelsPlaceholder:`modelo-1, modelo-2`,nameLabel:`Nombre`,namePlaceholder:`xAI`,providerAriaLabel:`Proveedor`,providerConnectedToast:`Proveedor conectado`,providerLabel:`Proveedor`,saving:`Guardando…`,useChatgptSignIn:`Usa el botón "Iniciar sesión con ChatGPT" para conectar tu suscripción.`},I={addProviderTitle:`Añadir proveedor`},L={advanced:`Avanzado`,apiKeyLabel:`Clave de API`,cancel:`Cancelar`,credentialReferenceAriaLabel:`Referencia de credencial`,credentialReferenceLabel:`Referencia de credencial`,credentialReferenceSuffix:`· Referencia de credencial`,loading:`Cargando…`,newCredential:`+ Nueva credencial`,newCredentialNameLabel:`Nombre de la nueva credencial`,newCredentialPlaceholder:`p. ej. clave-equipo`,use:`Usar`},R={apiKeyPlaceholder:`Introduce tu clave API`,baseUrlLabel:`URL base`,baseUrlPlaceholder:`https://api.example.com/v1`,cancel:`Cancelar`,displayNameLabel:`Nombre para mostrar <optional>(opcional)</optional>`,displayNamePlaceholder:`p. ej., Mi clave de Anthropic`,editProviderSettingsFallback:`Edita la configuración del proveedor.`,editProviderTitle:`Editar proveedor`,editingConnection:`Editando {name}.`,emptyServerResponse:`El servidor devolvió una respuesta vacía. Inténtalo de nuevo.`,failedSaveApiKey:`No se pudo guardar la clave API. Inténtalo de nuevo.`,failedSaveProvider:`No se pudo guardar el proveedor. Inténtalo de nuevo.`,modelsHint:`Identificadores de modelo separados por comas expuestos por tu endpoint.`,modelsLabel:`Modelos`,modelsPlaceholder:`modelo-1, modelo-2`,nothingToEdit:`No hay nada que editar. Cierra e inténtalo de nuevo.`,saveChanges:`Guardar cambios`,saving:`Guardando…`},z={actionsAriaLabel:`Acciones para {displayName}`,customTag:`Personalizado`,customTagTitle:`Un proveedor que creaste, servido por un endpoint compatible con OpenAI.`,defaultTag:`Predeterminado`,defaultTagTitle:`Los perfiles integrados (Balanced, Quality, Cost, Speed) usan este proveedor.`,delete:`Eliminar`,edit:`Editar`,localTag:`Local`,localTagTitle:`Ejecuta modelos en esta máquina.`,managedTag:`Administrado`,managedTagTitle:`Se ejecuta con las credenciales administradas de Vellum.`,openProviderAriaLabel:`Abrir proveedor {displayName}`,setAsDefault:`Establecer como predeterminado`},B={addProvider:`Añadir proveedor`,empty:`Aún no hay proveedores. Añade uno para empezar.`,loadError:`No se pudieron cargar los proveedores. Inténtalo de nuevo.`,title:`Proveedores`},V={allDoneStatus:`¡Todo listo!`,confirmingCaption:`Esto puede tardar unos segundos.`,continueInBackground:`Continuar en segundo plano`,creditsChip:`{count} créditos`,dimensionsComplete:`{dimensions} completado`,goToBilling:`Ir a facturación`,machineLabel:`Máquina`,packageChip:`paquete {name}`,planReadyStatus:`Tu plan está listo`,retryInBackground:`Reintentar en segundo plano`,srOnlyTo:`a`,stalledCaption:`Esto puede tardar un par de minutos.`,statusComplete:`Completado`,statusPending:`Pendiente`,storageLabel:`Almacenamiento`,takingLongerStatus:`Esto está tardando más de lo esperado`,tryAgain:`Intentar de nuevo`,waitingCaptionLong:`Seguimos trabajando. Esto puede tardar uno o dos minutos.`,waitingCaptionShort:`Esto puede tardar unos segundos.`},H={checkingDomain:`Comprobando dominio…`,domainVerified:`Dominio verificado`,failedTitle:`La verificación del dominio falló. Es posible que los registros DNS no se hayan propagado correctamente. Puedes intentar liberar y volver a registrar el dominio.`,managedLabel:`Administrado`,managedServicesBanner:`Los servicios administrados se miden y se deducen del saldo de tu cuenta de Vellum. <link>Ver precios</link>`,modeToggleAriaLabel:`Modo de servicio`,unknownStatus:`Estado desconocido`,unknownStatusTitle:`No se pudo obtener el estado de verificación del dominio.`,verificationFailed:`Verificación fallida`,verifiedTitle:`Los registros DNS se han verificado. Tu dominio está listo para enviar y recibir correo.`,verifyingDomain:`Verificando dominio…`,verifyingTitle:`Los registros DNS se han aprovisionado. Esperando a que el proveedor de correo los verifique; esto suele tardar unos minutos.`,yourOwnLabel:`Propio`},U={subtitle:`Configura cómo tu asistente transcribe el habla`,title:`Voz a texto`},W={subtitle:`Configura cómo habla tu asistente`,title:`Texto a voz`},G={billingUnavailable:`La facturación no está disponible para el estado actual del asistente.`,platformLoginNotice:`Inicie sesión en la plataforma Vellum para administrar facturación y uso.`,redirectingBody:`Regresándolo a la configuración de facturación…`,returnToBilling:`Volver a facturación`,title:`Actualización cancelada`},K={cantConfirmUpgrade:`No podemos confirmar su actualización para el asistente actual. Vuelva a facturación para reintentar.`,fetchErrorBody:`Tuvimos un problema al verificar su suscripción. Su actualización puede seguir procesándose. Vuelva a facturación para actualizar.`,fetchErrorTitle:`No se pudo acceder a facturación`,finalizingBody:`Stripe está confirmando su suscripción. Esto suele tardar unos segundos.`,finalizingTitle:`Finalizando su actualización…`,goToBilling:`Ir a facturación`,platformLoginNotice:`Inicie sesión en la plataforma Vellum para administrar facturación y uso.`,processingFallback:`Estamos procesando su actualización. Actualice en un momento para ver su nuevo plan.`,successBody:`Su plan Pro está activo. Será redirigido a facturación en un momento.`,welcomeTitle:`Bienvenido a Pro`},q={analyzeCostsButton:`Analizar costos con el asistente`,breakdownTitle:`Desglose`,cacheCreatedLabel:`Caché creada`,cacheReadLabel:`Caché leída`,costAssistantSubtitle:`Revise el gasto reciente y ajuste las opciones de perfil del modelo.`,costAssistantTitle:`Asistente de costos`,costLabel:`Costo`,dailyTrend:`Tendencia diaria`,dailyTrendBy:`Tendencia diaria por {group}`,directInputTokensLabel:`Tokens de entrada directa`,failedToLoadUsage:`No se pudo cargar el uso.`,groupByActor:`Actor`,groupByConversation:`Conversación`,groupByModel:`Modelo`,groupByProfile:`Perfil`,groupByProvider:`Proveedor`,groupBySchedule:`Programación`,groupByTask:`Acción`,groupColumnLabel:`Grupo`,hourlyTrend:`Tendencia por hora`,hourlyTrendBy:`Tendencia por hora por {group}`,inferenceUsageTitle:`Uso de inferencia`,llmCallsLabel:`Llamadas LLM`,noBreakdownDataSubtitle:`No hay uso registrado para esta agrupación`,noBreakdownDataTitle:`Sin datos de desglose`,optimizeSettingsButton:`Optimizar ajustes`,outputTokensLabel:`Tokens de salida`,percentOfTotalLabel:`% del total`,range30d:`Últimos 30 días`,range7d:`Últimos 7 días`,range90d:`Últimos 90 días`,rangeAll:`Todo el tiempo`,rangeToday:`Hoy`,rangeYesterday:`Ayer`,retry:`Reintentar`,title:`Uso`,tokensLabel:`Tokens`,totalsAriaLabel:`Totales`,turnsLabel:`Turnos`,unknownSchedule:`Programación desconocida ({scheduleId})`},J={noDailyData:`Sin datos diarios`,noHourlyData:`Sin datos por hora`,noUsageInRange:`No hay uso registrado en este intervalo`,total:`Total`},Y={assistantNotReadyToast:`El asistente no está listo. Inténtalo de nuevo.`,saveApiKeyFailedToast:`No se pudo guardar la clave de API de {providerName}. Inténtalo de nuevo.`},X={createdToast:`Perfil "{name}" creado`},Z={deleteFailedToast:`No se pudo eliminar el proveedor. Inténtalo de nuevo.`,deleteInUseToast:`Este proveedor está en uso en un perfil o como proveedor predeterminado. Actualiza esas configuraciones antes de eliminarlo.`,setDefaultFailedToast:`No se pudo establecer el proveedor predeterminado. Inténtalo de nuevo.`},Q={apiKeyLabel:`Clave de API`,apiKeyPlaceholder:`Introduce tu clave de API`,configUpdateFailedToast:`No se pudo actualizar la configuración del asistente. Inténtalo de nuevo.`,localPreferencesFailedToast:`Guardado, pero no se pudieron escribir las preferencias locales.`,providerLabel:`Proveedor`,savedToast:`Configuración de obtención web guardada.`,subtitle:`Configura cómo tu asistente lee páginas web individuales`,title:`Obtención web`},$={apiKeyLabel:`Clave de API`,apiKeyPlaceholder:`Introduce tu clave de API`,configUpdateFailedToast:`No se pudo actualizar la configuración del asistente. Inténtalo de nuevo.`,localPreferencesFailedToast:`Guardado, pero no se pudieron escribir las preferencias locales.`,providerAriaLabel:`Proveedor de búsqueda web`,providerLabel:`Proveedor`,savedToast:`Configuración de búsqueda web guardada.`,subtitle:`Configura cómo tu asistente debe buscar en la web`,title:`Búsqueda web`,vellumNote:`La búsqueda se ejecuta a través de tu cuenta de Vellum.`},ee={advisorProfileRow:e,aiProviderPicker:t,billingOnboardingModal:n,billingPage:r,billingStatusHandler:i,bulkOverrideSwapModal:a,callSiteOverridesRow:o,chatgptOauthSection:s,checkoutBonusModal:c,checkoutPage:l,completeState:u,customPlanModal:d,customPlanRow:f,domainStep:p,emailManagedContent:m,emailServiceCard:h,errorStates:g,freeDowngradeConfirmModal:_,imageGenerationCard:v,integrationsPage:y,languageModelCard:b,manageProfilesBlockedDeleteModal:x,overridesCallSiteList:S,overridesDetailPanel:C,packageSwitchConfirmModal:w,planColumnCard:T,plansPage:E,profileAdvancedParams:D,profileDetailPanel:O,profileEditor:k,profileEditorFields:A,profileEditorModal:j,profileEditorProviderSection:M,profileRow:N,profilesSection:P,providerCreateForm:F,providerDetailPanel:I,providerEditorApiKeySection:L,providerEditorContent:R,providerRow:z,providersSection:B,provisioningState:V,sharedUi:H,speechToTextCard:U,textToSpeechCard:W,upgradeCancelPage:G,upgradeSuccessPage:K,usageTab:q,usageTrendChart:J,useDaemonConfig:Y,useProfileSave:X,useProviderActions:Z,webFetchCard:Q,webSearchCard:$};export{e as advisorProfileRow,t as aiProviderPicker,n as billingOnboardingModal,r as billingPage,i as billingStatusHandler,a as bulkOverrideSwapModal,o as callSiteOverridesRow,s as chatgptOauthSection,c as checkoutBonusModal,l as checkoutPage,u as completeState,d as customPlanModal,f as customPlanRow,ee as default,p as domainStep,m as emailManagedContent,h as emailServiceCard,g as errorStates,_ as freeDowngradeConfirmModal,v as imageGenerationCard,y as integrationsPage,b as languageModelCard,x as manageProfilesBlockedDeleteModal,S as overridesCallSiteList,C as overridesDetailPanel,w as packageSwitchConfirmModal,T as planColumnCard,E as plansPage,D as profileAdvancedParams,O as profileDetailPanel,k as profileEditor,A as profileEditorFields,j as profileEditorModal,M as profileEditorProviderSection,N as profileRow,P as profilesSection,F as providerCreateForm,I as providerDetailPanel,L as providerEditorApiKeySection,R as providerEditorContent,z as providerRow,B as providersSection,V as provisioningState,H as sharedUi,U as speechToTextCard,W as textToSpeechCard,G as upgradeCancelPage,K as upgradeSuccessPage,q as usageTab,J as usageTrendChart,Y as useDaemonConfig,X as useProfileSave,Z as useProviderActions,Q as webFetchCard,$ as webSearchCard};
@@ -1 +0,0 @@
1
- import{n as e}from"./api-errors-CASENJGT.js";import{Gr as t}from"./sdk.gen-CiE6cMi0.js";var n=[`aiff`,`wav`,`mp3`,`m4a`,`caf`],r=[`task_complete`,`needs_input`,`task_failed`,`notification`,`new_conversation`,`message_sent`,`character_poke`,`random`],i={task_complete:`Task Complete`,needs_input:`Needs Input`,task_failed:`Task Failed`,notification:`Notification`,new_conversation:`New Conversation`,message_sent:`Message Sent`,character_poke:`Character Poke`,random:`Random`};function a(){let e={};for(let t of r)e[t]={enabled:!1,sounds:[]};return{globalEnabled:!1,volume:.7,events:e}}function o(e){let t=e.lastIndexOf(`.`);return t<0||t===e.length-1?``:e.slice(t+1).toLowerCase()}function s(e){let t=o(e);return n.includes(t)}function c(e){return!e||e.includes(`/`)||e.includes(`\\`)||e.includes(`..`)?!1:s(e)}function l(e){let t=e.lastIndexOf(`.`);return t<=0?e:e.slice(0,t)}var u=`data/sounds`;async function d(n,r){if(!c(r))return null;try{let{data:i,error:a,response:o}=await t({path:{assistant_id:n},query:{path:`${u}/${r}`},parseAs:`blob`,throwOnError:!1});return e(o,a,`Failed to fetch sound file`),!o.ok||!i?null:i}catch{return null}}function f(e){return Number.isFinite(e)?e<0?0:e>1?1:e:.7}var p=class{assistantId=null;config=null;featureEnabled=!1;cache=new Map;pendingFetches=new Map;audioContext=null;setAssistantId(e){e!==this.assistantId&&(this.assistantId=e,this.clearCache())}setConfig(e){this.config=e}setFeatureEnabled(e){this.featureEnabled=e}async play(e){if(!this.featureEnabled)return;let t=this.config;if(!t||!t.globalEnabled)return;let n=t.events[e];if(!n?.enabled)return;let r=f(t.volume),i=n.sounds.filter(c);if(i.length===0){this.playFallbackBlip(r);return}let a=i[Math.floor(Math.random()*i.length)];if(!a){this.playFallbackBlip(r);return}await this.playFile(a,r)||this.playFallbackBlip(r)}async previewSound(e,t){if(!this.featureEnabled)return;let n=f(t??this.config?.volume??.7);await this.playFile(e,n)||this.playFallbackBlip(n)}async previewFallbackBlip(e){if(!this.featureEnabled)return;let t=f(e??this.config?.volume??.7);this.playFallbackBlip(t)}clearCache(){for(let e of this.cache.values())URL.revokeObjectURL(e.url);this.cache.clear(),this.pendingFetches.clear()}async playFile(e,t){if(!c(e))return!1;let n=await this.getOrFetch(e);if(!n)return!1;try{let e=new Audio(n.url);return e.volume=t,await e.play(),!0}catch{return!1}}async getOrFetch(e){let t=this.cache.get(e);if(t)return t;let n=this.pendingFetches.get(e);if(n)return n;let r=this.assistantId;if(!r)return null;let i=(async()=>{try{let t=await d(r,e);if(!t)return null;let n={url:URL.createObjectURL(t)};return this.cache.set(e,n),n}finally{this.pendingFetches.delete(e)}})();return this.pendingFetches.set(e,i),i}playFallbackBlip(e){if(!(typeof window>`u`))try{let t=window.AudioContext||window.webkitAudioContext;if(!t)return;this.audioContext||=new t;let n=this.audioContext;n.state===`suspended`&&n.resume();let r=n.createOscillator(),i=n.createGain();r.type=`sine`,r.frequency.setValueAtTime(880,n.currentTime);let a=Math.max(0,Math.min(1,e))*.25;i.gain.setValueAtTime(0,n.currentTime),i.gain.linearRampToValueAtTime(a,n.currentTime+.01),i.gain.exponentialRampToValueAtTime(1e-4,n.currentTime+.18),r.connect(i),i.connect(n.destination),r.start(),r.stop(n.currentTime+.2)}catch{}}},m=null;function h(){return m||=new p,m}export{l as a,a as i,i as n,r,h as t};