@vellumai/web 0.10.9-staging.1 → 0.10.9-staging.2

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 (156) hide show
  1. package/dist/assets/{a2a-invite-BgVgm24S.js → a2a-invite-CwD3hY_-.js} +1 -1
  2. package/dist/assets/{account-page-BYVwf7xV.js → account-page-uVMhWTmh.js} +1 -1
  3. package/dist/assets/{acp-run-detail-panel-D7Shyx6k.js → acp-run-detail-panel-DKXp8jTf.js} +1 -1
  4. package/dist/assets/{activity-steps-panel-CuI8SWWZ.js → activity-steps-panel-Bq9yj1qu.js} +1 -1
  5. package/dist/assets/{add-credits-modal-B2t4geb6.js → add-credits-modal-DjQdNLWh.js} +1 -1
  6. package/dist/assets/{advanced-page-MbQr5gTH.js → advanced-page-CQPwr2B4.js} +1 -1
  7. package/dist/assets/{ai-page-BbtSlOOr.js → ai-page-CO4dBJpg.js} +1 -1
  8. package/dist/assets/{api-D2xHldt2.js → api-Dfrm6N2I.js} +1 -1
  9. package/dist/assets/{api-key-screen--mSD5piK.js → api-key-screen-DhFeDT-n.js} +1 -1
  10. package/dist/assets/{archive-page-Y2o3PaeP.js → archive-page-BLEqhIZ8.js} +1 -1
  11. package/dist/assets/{assistant-feature-flag-store-4edQKaeq.js → assistant-feature-flag-store-BA3GR2m5.js} +1 -1
  12. package/dist/assets/{assistant-status-panel-CdoOjV0m.js → assistant-status-panel-CW7lTRBE.js} +1 -1
  13. package/dist/assets/{auth-store-B8a9KLUt.js → auth-store-65JKPW7C.js} +2 -2
  14. package/dist/assets/{background-task-detail-panel-Dj6SWg-M.js → background-task-detail-panel-ChfmmS5C.js} +1 -1
  15. package/dist/assets/{billing-page-BAtqAcvw.js → billing-page-CaP8_CF9.js} +3 -3
  16. package/dist/assets/{bookmarks-page-BdcQABPJ.js → bookmarks-page-BdcnBpJK.js} +1 -1
  17. package/dist/assets/{browser-WjU02SUS.js → browser-Cnr7iqbJ.js} +2 -2
  18. package/dist/assets/{build-state-CTWX014G.js → build-state-D-aPe0DY.js} +1 -1
  19. package/dist/assets/{channels-page-route-DoG1IfDg.js → channels-page-route-DKkdGS4b.js} +1 -1
  20. package/dist/assets/{chat-markdown-message-B6ba9Nea.js → chat-markdown-message-Cp8stHaU.js} +2 -2
  21. package/dist/assets/{client-feature-flag-store-Bm7cFUky.js → client-feature-flag-store-Ri-a_LuI.js} +1 -1
  22. package/dist/assets/{client-identity-C5bng1El.js → client-identity-DfC94VQ4.js} +1 -1
  23. package/dist/assets/{command-palette-3Kt4aKqv.js → command-palette-Bu2Qjyle.js} +1 -1
  24. package/dist/assets/{command-palette-window-page-Ce_JAimQ.js → command-palette-window-page-CtQ40jMw.js} +1 -1
  25. package/dist/assets/{community-page-BwkGsQOO.js → community-page-DL_oR63v.js} +1 -1
  26. package/dist/assets/{connect-page-GobyNuEq.js → connect-page-BCb6nr8x.js} +1 -1
  27. package/dist/assets/{consent-controls-C7ZF8P6y.js → consent-controls-udcijSAB.js} +1 -1
  28. package/dist/assets/constants-BQVXM0At.js +1 -0
  29. package/dist/assets/{contacts-page-route-mJdb0p-P.js → contacts-page-route-CicU-jSI.js} +1 -1
  30. package/dist/assets/{credentials-page-D7wWekUv.js → credentials-page-DDM2V8iZ.js} +1 -1
  31. package/dist/assets/{danger-zone-redirect-page-BwbAORqw.js → danger-zone-redirect-page-BpM01x_c.js} +1 -1
  32. package/dist/assets/debug-page-BGhdwv9M.js +4 -0
  33. package/dist/assets/{deploy-dialogs-3Mkwr6Lr.js → deploy-dialogs-C6pCnoVj.js} +1 -1
  34. package/dist/assets/{detail-panel-stop-button-B89ORnF4.js → detail-panel-stop-button-H9sXvWGa.js} +1 -1
  35. package/dist/assets/{developer-page-BepHaWqd.js → developer-page-DZdwzLQu.js} +1 -1
  36. package/dist/assets/{devices-page-Bvgt1Qx3.js → devices-page-ChwagiFL.js} +1 -1
  37. package/dist/assets/{diagnostics-BjIFTbZd.js → diagnostics-CUmYxbmM.js} +1 -1
  38. package/dist/assets/{dictation-overlay-page-DlScWKYV.js → dictation-overlay-page-BmLNyGeD.js} +1 -1
  39. package/dist/assets/{document-viewer-page-7mbMVgWm.js → document-viewer-page-B-ShLH6Y.js} +1 -1
  40. package/dist/assets/{earn-credits-modal-BLyGdcsU.js → earn-credits-modal-BILKTI_F.js} +1 -1
  41. package/dist/assets/{emails-page-kA5rCqOM.js → emails-page-D_ZdkIHT.js} +1 -1
  42. package/dist/assets/{esm-bqqA92jW.js → esm-BC-IlNg6.js} +2 -2
  43. package/dist/assets/{esm-BgQ9CqZD.js → esm-BVzHqFEK.js} +2 -2
  44. package/dist/assets/{esm-k-oyYh2U.js → esm-CE4Ehw9K.js} +2 -2
  45. package/dist/assets/{esm-B0Io_iMT.js → esm-D4S5VlIC.js} +2 -2
  46. package/dist/assets/{esm-CWRflJ6T.js → esm-Ddwl5DWt.js} +2 -2
  47. package/dist/assets/esm-ZgeaRH-O.js +2 -0
  48. package/dist/assets/feature-flag-catalog-DjfXrBPD.js +1 -0
  49. package/dist/assets/{general-page-yhD_Wuar.js → general-page-61s8VehJ.js} +1 -1
  50. package/dist/assets/{haptics-Dgz3Ixf7.js → haptics-BOswdY5A.js} +2 -2
  51. package/dist/assets/{hatching-screen-trN-MWFq.js → hatching-screen-DiUygZtk.js} +1 -1
  52. package/dist/assets/{home-page-route-CmuFehkr.js → home-page-route-1hEkRjdv.js} +1 -1
  53. package/dist/assets/{hosting-screen-Cxg-qKjE.js → hosting-screen-nru73FGU.js} +1 -1
  54. package/dist/assets/identity-page-route-CbHcVb6m.js +1 -0
  55. package/dist/assets/{index-CkKSY1-Q.js → index-B4Qq7TL7.js} +23 -23
  56. package/dist/assets/index-CCPsEVwr.css +2 -0
  57. package/dist/assets/{inspect-page-T3Y4-Vmv.js → inspect-page-DoA1sfxg.js} +3 -3
  58. package/dist/assets/{integrations-page-Ock6mFN1.js → integrations-page-vFP_lh3w.js} +1 -1
  59. package/dist/assets/intelligence-layout-oIGPC8W1.js +1 -0
  60. package/dist/assets/{keyboard-shortcuts-page-CG1twx2C.js → keyboard-shortcuts-page-BzeIMUpj.js} +1 -1
  61. package/dist/assets/{library-detail-page-C2iWMOjx.js → library-detail-page-D0Dv3ZLJ.js} +1 -1
  62. package/dist/assets/{library-page-BC0GGthr.js → library-page-D7I-sk41.js} +1 -1
  63. package/dist/assets/{login-flow-DdiUXQhA.js → login-flow-DYLpX6IU.js} +1 -1
  64. package/dist/assets/{login-page-CGmLnOmi.js → login-page-UotBWZu9.js} +1 -1
  65. package/dist/assets/{logout-page-4e8K14KD.js → logout-page-xucijGcq.js} +1 -1
  66. package/dist/assets/{logs-layout-wJKzizjg.js → logs-layout-JUd7Ag6q.js} +1 -1
  67. package/dist/assets/memory-page-route-DqM6EMFu.js +1 -0
  68. package/dist/assets/{memory-router-playground-page-FZC-VIVr.js → memory-router-playground-page-DikxzmKT.js} +1 -1
  69. package/dist/assets/{messages-BnurE-6y.js → messages-B2CZAuPN.js} +1 -1
  70. package/dist/assets/{mobile-sidebar-drawer-BN_mMpOa.js → mobile-sidebar-drawer-BaL8el3Y.js} +1 -1
  71. package/dist/assets/{native-biometric-Dy5Vb7o0.js → native-biometric-B2cBAQ1U.js} +1 -1
  72. package/dist/assets/{native-file-H6DBFhbO.js → native-file-BZDk5eyB.js} +2 -2
  73. package/dist/assets/{notifications-page-D8wbor2x.js → notifications-page-BISnBOYH.js} +1 -1
  74. package/dist/assets/{oauth-complete-page-Ce1AmHXp.js → oauth-complete-page-SfFEsa_M.js} +1 -1
  75. package/dist/assets/{oauth-popup-complete-page-M9ID8MBR.js → oauth-popup-complete-page-D4Xoa-Gr.js} +1 -1
  76. package/dist/assets/{pairing-page-COwbBOrn.js → pairing-page-B5xnM6XX.js} +1 -1
  77. package/dist/assets/{password-reset-page-DfUZ0wSh.js → password-reset-page-NF13YMiM.js} +1 -1
  78. package/dist/assets/{platform-detection-DJWRuZPt.js → platform-detection-DGxL0AsS.js} +1 -1
  79. package/dist/assets/{platform-loopback-page-MtmBE9rf.js → platform-loopback-page-_IbNDHN2.js} +1 -1
  80. package/dist/assets/{plugin-detail-page-jrt28WVX.js → plugin-detail-page-_iCqtxl9.js} +1 -1
  81. package/dist/assets/{plugins-page-BkFE86Ch.js → plugins-page-DHiFqgxf.js} +1 -1
  82. package/dist/assets/{prechat-route-CyUlbfqD.js → prechat-route-BwML3ZL1.js} +1 -1
  83. package/dist/assets/{prefs-BLNqdDWZ.js → prefs-DNYLVDvB.js} +1 -1
  84. package/dist/assets/{privacy-page-DD2N7jR3.js → privacy-page-DhxWA9mA.js} +1 -1
  85. package/dist/assets/{privacy-screen-CiInQmTP.js → privacy-screen-DRGDGj0W.js} +1 -1
  86. package/dist/assets/{provider-callback-page-apRb9-js.js → provider-callback-page-BoO2JgZt.js} +1 -1
  87. package/dist/assets/{provider-signup-page-ajKQp8fF.js → provider-signup-page-DLVKMYZh.js} +1 -1
  88. package/dist/assets/{quick-input-page-Bfry352-.js → quick-input-page-7z8Ti2GI.js} +1 -1
  89. package/dist/assets/react-query.gen-DV9K_z-o.js +1 -0
  90. package/dist/assets/{research-mock-page-D_q1_UFd.js → research-mock-page-CoMthbl4.js} +1 -1
  91. package/dist/assets/{research-onboarding-route-CWQvTAZs.js → research-onboarding-route-CeTflgoE.js} +1 -1
  92. package/dist/assets/{review-terms-screen-DQscfsQA.js → review-terms-screen-DAZ66rIh.js} +1 -1
  93. package/dist/assets/{risk-CGuJt8eV.js → risk-BQ3NV8r8.js} +1 -1
  94. package/dist/assets/routes-BXlWEOF0.js +1 -0
  95. package/dist/assets/sdk.gen-9Cdt87h5.js +1 -0
  96. package/dist/assets/{security-page-PDmclL0z.js → security-page-BS1WxY0d.js} +1 -1
  97. package/dist/assets/{select-assistant-screen-NbYyB8gd.js → select-assistant-screen-z3B8ngdP.js} +1 -1
  98. package/dist/assets/{settings-layout-CXwmK0bq.js → settings-layout-DFzwR63d.js} +1 -1
  99. package/dist/assets/{share-feedback-modal-8FYv2LvY.js → share-feedback-modal-DH2dhWbo.js} +1 -1
  100. package/dist/assets/{sidebar-tree-DXcgyQSp.js → sidebar-tree-DWJkYLPh.js} +1 -1
  101. package/dist/assets/{signup-page-7ln71c_p.js → signup-page-D2LQXMnG.js} +1 -1
  102. package/dist/assets/site-favicon-DsYdnaxV.js +1 -0
  103. package/dist/assets/{skill-detail-page-D-KI1GRv.js → skill-detail-page-CcZFUjdw.js} +1 -1
  104. package/dist/assets/{skill-detail-panel-B6dgeIjw.js → skill-detail-panel-B4WEYtK9.js} +1 -1
  105. package/dist/assets/{skills-page-BANGKYGT.js → skills-page-Di8dGQGo.js} +1 -1
  106. package/dist/assets/{sounds-page-B5nmCucp.js → sounds-page-CF3gwgc9.js} +1 -1
  107. package/dist/assets/{subagent-detail-panel-B-XO_qpq.js → subagent-detail-panel-BqYWP0b9.js} +1 -1
  108. package/dist/assets/{system-events-page-3D8JNX2E.js → system-events-page-DdvtYv0_.js} +1 -1
  109. package/dist/assets/{system-events-redirect-page-CXWqj4sU.js → system-events-redirect-page-HeBGwZCZ.js} +1 -1
  110. package/dist/assets/{theme-stage-page-9uebvm3N.js → theme-stage-page-8v_hsKXd.js} +1 -1
  111. package/dist/assets/{tiptap-document-editor-BQsMI5MK.js → tiptap-document-editor-1QvKHdlQ.js} +1 -1
  112. package/dist/assets/{tool-detail-panel-C6bS4xqt.js → tool-detail-panel-DarSpKEx.js} +1 -1
  113. package/dist/assets/{upgrade-cancel-page-DFVxgGMD.js → upgrade-cancel-page-wop4boqC.js} +1 -1
  114. package/dist/assets/{upgrade-success-page-CmS8UX41.js → upgrade-success-page-DWPEHzlo.js} +1 -1
  115. package/dist/assets/{usage-page-J9DnhUSp.js → usage-page-CB5oigmL.js} +1 -1
  116. package/dist/assets/{use-edge-swipe-back-CGjL1V81.js → use-edge-swipe-back-R9ItWgTp.js} +1 -1
  117. package/dist/assets/{use-invite-link-dialog-DiQ0mtix.js → use-invite-link-dialog-_LChrtmw.js} +1 -1
  118. package/dist/assets/use-is-org-ready-1Xighdsa.js +1 -0
  119. package/dist/assets/{use-onboarding-login-CymKDO-T.js → use-onboarding-login-BHrngniO.js} +1 -1
  120. package/dist/assets/{use-skill-actions-DgIZqg7U.js → use-skill-actions-mJaMNpfO.js} +1 -1
  121. package/dist/assets/{use-skill-categories-573c1Oen.js → use-skill-categories-Bit2V2fA.js} +1 -1
  122. package/dist/assets/{use-skill-detail-files-omgWFzAG.js → use-skill-detail-files-DDUUobr0.js} +1 -1
  123. package/dist/assets/{voice-page-CDyjR4fA.js → voice-page-Dfl4T4_g.js} +1 -1
  124. package/dist/assets/{weather-forecast-display-C5EykzzK.js → weather-forecast-display-DOXofTcV.js} +1 -1
  125. package/dist/assets/{web-BRWcXGs9.js → web-BrbVmY32.js} +1 -1
  126. package/dist/assets/{web-CKE5sM1b.js → web-CBHy41qN.js} +1 -1
  127. package/dist/assets/{welcome-screen-Dz0Avnjt.js → welcome-screen-kc41a0yS.js} +1 -1
  128. package/dist/assets/{workflow-detail-panel-D-1Pxr3t.js → workflow-detail-panel-Dctg7w-3.js} +1 -1
  129. package/dist/assets/{workspace-page-D5FdWIRh.js → workspace-page-BWn-Je40.js} +1 -1
  130. package/dist/index.html +26 -26
  131. package/package.json +1 -1
  132. package/dist/assets/debug-page-b1M-_rZF.js +0 -4
  133. package/dist/assets/esm-C9MocOv0.js +0 -2
  134. package/dist/assets/feature-flag-catalog-CM5COdiW.js +0 -1
  135. package/dist/assets/identity-page-route-CEUFy067.js +0 -1
  136. package/dist/assets/index-CnqTir5A.css +0 -2
  137. package/dist/assets/intelligence-layout-DzdGg3IO.js +0 -1
  138. package/dist/assets/react-query.gen-GVQbBTEp.js +0 -1
  139. package/dist/assets/routes-DYcJgn9k.js +0 -1
  140. package/dist/assets/sdk.gen-CmKfVpgB.js +0 -1
  141. package/dist/assets/site-favicon-BXY4qlvA.js +0 -1
  142. package/dist/assets/use-is-org-ready-B5vVKY9m.js +0 -1
  143. /package/dist/assets/{BundleConfirmPage-C02c50EO.js → BundleConfirmPage-DwVI7U0b.js} +0 -0
  144. /package/dist/assets/{build.umd-D88jX3tx.js → build.umd-t16r8k1T.js} +0 -0
  145. /package/dist/assets/{definitions-RERkHOnv.js → definitions-CK0CSdwt.js} +0 -0
  146. /package/dist/assets/{definitions-EvNC1i1H.js → definitions-Dj7uajgZ.js} +0 -0
  147. /package/dist/assets/{esm-D_FdLNK8.js → esm-wMYgN14J.js} +0 -0
  148. /package/dist/assets/{pdf-OTWpgOp2.js → pdf-jCZ1S_t-.js} +0 -0
  149. /package/dist/assets/{web-ClHk8mQB.js → web-6YTn0Mpt.js} +0 -0
  150. /package/dist/assets/{web-Qpx2h8tK.js → web-B6BDTvZe.js} +0 -0
  151. /package/dist/assets/{web-CU5yzmqR.js → web-BEtTYpif.js} +0 -0
  152. /package/dist/assets/{web-CTmLPP3c.js → web-C3rsbCeg.js} +0 -0
  153. /package/dist/assets/{web-8CyK9syi.js → web-CIdUPUaN.js} +0 -0
  154. /package/dist/assets/{web-CyGs80Wd.js → web-DGaEiOw7.js} +0 -0
  155. /package/dist/assets/{xterm-fGXm5t6D.js → xterm-CJZcgQLM.js} +0 -0
  156. /package/dist/assets/{xterm-addon-fit-DNV09uVI.js → xterm-addon-fit-BmGG02AS.js} +0 -0
@@ -1,3 +1,3 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{r as t,s as n}from"./local-settings-lVNyIOJ_.js";import{t as r}from"./react-DJZBPgpf.js";import{t as i}from"./createLucideIcon-IRfcSUxS.js";import{n as a,t as o}from"./create-selectors-8NePGNlX.js";import{n as s}from"./typed-storage-BRvgA7pX.js";import{a as c}from"./diagnostics-BjIFTbZd.js";import{l}from"./chat-markdown-message-B6ba9Nea.js";import{t as u}from"./conversation-store-CynXqAcO.js";import{c as ee,d as te}from"./messages-BnurE-6y.js";import{b as d,n as f,t as ne,v as re,w as p,x as ie}from"./chat-0L0NBUcq.js";var ae=i(`bolt`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}],[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}]]),oe=i(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),se=i(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),ce=i(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),le=e(r(),1),m=1e3,ue=15,de=0,h=new Map,g=[];function fe(e){let t=`sse-${++de}`,n={id:t,abortSignal:e,initiatedAt:Date.now(),establishedAt:null,lastTrafficAt:null,lastDataAt:null,dataFrames:0,keepalives:0,endedAt:null,endReason:null};h.set(t,n),Se();let r=()=>{xe(t,`aborted`)};return e.aborted?r():e.addEventListener(`abort`,r,{once:!0}),t}function pe(e){let t=h.get(e);t&&t.establishedAt===null&&(t.establishedAt=Date.now())}function me(e,t){let n=h.get(e);if(!n)return;let r=Date.now();n.lastTrafficAt=r,t?(n.lastDataAt=r,n.dataFrames++):n.keepalives++}function he(e,t){g.push({clientId:e,receivedAt:new Date().toISOString(),...t}),g.length>m&&g.shift()}var ge=`events-tail`;function _e(e){if(e.length===0)return;let t=new Set;for(let e of g)typeof e.seq==`number`&&t.add(e.seq);for(let n of e)typeof n.seq==`number`&&t.has(n.seq)||g.push({clientId:ge,receivedAt:new Date().toISOString(),...n});for(;g.length>m;)g.shift()}function ve(){return Array.from(h.values())}function ye(e=m){let t=Math.max(0,g.length-e);return g.slice(t)}function be(e,t){if(t===null)return null;let n=1/0;for(let e of g)typeof e.seq==`number`&&(n=Math.min(n,e.seq));return n!==1/0&&n>t+1?null:g.filter(n=>n.conversationId===e&&typeof n.seq==`number`&&n.seq>t).sort((e,t)=>e.seq-t.seq)}function xe(e,t){let n=h.get(e);n&&(n.endedAt===null?(n.endedAt=Date.now(),n.endReason=t):n.endReason===`aborted`&&t!==`aborted`&&(n.endReason=t),Se())}function Se(){let e=0;for(let t of h.values())t.endedAt!==null&&e++;if(!(e<=ue))for(let[t,n]of h){if(e<=ue)break;n.endedAt!==null&&(h.delete(t),e--)}}var _={phase:`idle`,pendingQueuedCount:0,activeToolCallCount:0,activeTurnId:null,lastTerminalReason:null,statusText:null,liveWebActivity:{}};function v(e){return e===`queued`||e===`thinking`||e===`streaming`||e===`awaiting_user_input`}function Ce(e){return e===`thinking`}function y(e){return(e.phase===`idle`||e.phase===`errored`)&&!e.activeTurnId}var we=o(a()((e,t)=>({..._,requestSend:t=>e(e=>({phase:`thinking`,activeTurnId:t??e.activeTurnId,lastTerminalReason:null,activeToolCallCount:0,statusText:null})),acceptSend:t=>e(e=>({activeTurnId:t,...e.phase===`idle`||e.phase===`errored`?{phase:`thinking`,lastTerminalReason:null}:null})),onTextDelta:()=>{let n=t();if(n.phase===`idle`||n.phase===`errored`){if(!n.activeTurnId)return;e({phase:`streaming`});return}(n.phase===`thinking`||n.phase===`queued`)&&e({phase:`streaming`})},onToolUseStart:()=>{let n=t();y(n)||e({phase:n.phase===`idle`||n.phase===`errored`||n.phase===`queued`?`thinking`:n.phase,activeToolCallCount:n.activeToolCallCount+1})},onToolResult:()=>e(e=>({activeToolCallCount:Math.max(0,e.activeToolCallCount-1)})),onToolActivityMetadata:(n,r)=>{let i=t();y(i)||e({liveWebActivity:{...i.liveWebActivity,[n]:r}})},onActivityThinking:n=>{let r=t();y(r)||r.phase!==`awaiting_user_input`&&e({phase:`thinking`,statusText:n??null})},showSurface:n=>{y(t())||n&&e({phase:`awaiting_user_input`})},updateSurface:()=>{},dismissSurface:()=>{let n=t();n.phase===`awaiting_user_input`&&n.activeToolCallCount===0&&e({phase:`thinking`})},completeSurface:()=>{let n=t();n.phase===`awaiting_user_input`&&n.activeToolCallCount===0&&e({phase:`thinking`})},onSecretRequest:()=>{y(t())||e({phase:`awaiting_user_input`})},onConfirmationRequest:()=>{y(t())||e({phase:`awaiting_user_input`})},onQuestionRequest:()=>{y(t())||e({phase:`awaiting_user_input`})},onContactRequest:()=>{y(t())||e({phase:`awaiting_user_input`})},completeTurn:()=>{e({phase:t().pendingQueuedCount>0?`queued`:`idle`,activeTurnId:null,activeToolCallCount:0,lastTerminalReason:`complete`,statusText:null,liveWebActivity:{}})},handoffGeneration:()=>{y(t())||e({phase:`thinking`,activeToolCallCount:0,statusText:null})},cancelGeneration:()=>{e({phase:t().pendingQueuedCount>0?`queued`:`idle`,activeTurnId:null,activeToolCallCount:0,lastTerminalReason:`cancelled`,statusText:null,liveWebActivity:{}})},onStreamError:()=>e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,pendingQueuedCount:0,lastTerminalReason:`error`,statusText:null,liveWebActivity:{}}),onSessionError:()=>e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,pendingQueuedCount:0,lastTerminalReason:`session_error`,statusText:null,liveWebActivity:{}}),onTurnTimeout:()=>e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,pendingQueuedCount:0,lastTerminalReason:`timeout`,statusText:null,liveWebActivity:{}}),onPollReconciled:n=>{let r=t();n&&n!==r.activeTurnId||v(r.phase)&&e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,lastTerminalReason:`complete`,statusText:null,liveWebActivity:{}})},resetTurn:()=>e({..._}),clearStaleTurn:()=>{let n=t();n.activeTurnId&&v(n.phase)||e({..._})},enqueueMessage:()=>e(e=>({pendingQueuedCount:e.pendingQueuedCount+1})),dequeueMessage:()=>{let n=t(),r=Math.max(0,n.pendingQueuedCount-1);if(y(n)){e({pendingQueuedCount:r});return}e({phase:`thinking`,pendingQueuedCount:r})},deleteQueuedMessage:()=>{let n=t(),r=Math.max(0,n.pendingQueuedCount-1);if(r===0&&n.phase===`queued`){e({phase:`idle`,pendingQueuedCount:0,activeTurnId:null,lastTerminalReason:`complete`,statusText:null,liveWebActivity:{}});return}e({pendingQueuedCount:r})}}))),Te=3670016,Ee=[.85,.75,.65,.5],De=2e7,Oe=new Set([`image/jpeg`,`image/jpg`,`image/png`,`image/webp`,`image/heic`,`image/heif`,`image/bmp`,`image/tiff`]),ke=new Set([`jpg`,`jpeg`,`png`,`webp`,`heic`,`heif`,`bmp`,`tif`,`tiff`]);function b(e){let t=e.type.trim().toLowerCase();if(Oe.has(t))return!0;let n=e.name.split(`.`).pop()?.trim().toLowerCase();return n?ke.has(n):!1}function Ae(e){return b(e)&&e.size>3670016}function je(e){let t=e.type.trim().toLowerCase();if(t===`image/heic`||t===`image/heif`)return!0;let n=e.name.split(`.`).pop()?.trim().toLowerCase();return n===`heic`||n===`heif`}function Me(e){return Ae(e)||je(e)}function Ne(e){let t=`attachment`,n=e.trim()||t;return/\.(?:jpe?g)$/i.test(n)?n:`${n.replace(/\.[^./\\]+$/,``)||t}.jpg`}async function Pe(e){if(!Me(e)||await Ie(e))return{status:`unchanged`,file:e};if(e.size>104857600)return{status:`failed`,error:`This image is too large to process safely. Please choose a smaller image.`};let t;try{t=await Fe(e)}catch{return{status:`failed`,error:`Couldn't resize this image for upload. Try a smaller image.`}}try{let n;try{n=await Re(t,e.size)}catch{n=null}return!n||!je(e)&&n.size>=e.size?{status:`failed`,error:`Couldn't resize this image for upload. Try a smaller image.`}:{status:`resized`,file:new File([n],Ne(e.name),{type:`image/jpeg`,lastModified:e.lastModified})}}finally{t.close()}}async function Fe(e){if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e,{imageOrientation:`from-image`});return{source:t,width:t.width,height:t.height,close:()=>t.close()}}catch{}if(typeof Image>`u`)throw Error(`No browser image decoder is available.`);let t=URL.createObjectURL(e);return await new Promise((e,n)=>{let r=new Image;r.onload=()=>{e({source:r,width:r.naturalWidth||r.width,height:r.naturalHeight||r.height,close:()=>URL.revokeObjectURL(t)})},r.onerror=()=>{URL.revokeObjectURL(t),n(Error(`Image decode failed.`))},r.src=t})}async function Ie(e){if(!Le(e))return!1;let t;try{t=new Uint8Array(await e.slice(0,Math.min(e.size,1024*1024)).arrayBuffer())}catch{return!0}if(!S(t,0,`RIFF`)||!S(t,8,`WEBP`))return!1;let n=x(t,`VP8X`);return n>=0&&(t[n+8]??0)&2?!0:x(t,`ANIM`)>=0||x(t,`ANMF`)>=0}function Le(e){return e.type.trim().toLowerCase()===`image/webp`||/\.webp$/i.test(e.name)}function x(e,t){for(let n=0;n<=e.length-t.length;n+=1)if(S(e,n,t))return n;return-1}function S(e,t,n){if(t+n.length>e.length)return!1;for(let r=0;r<n.length;r+=1)if(e[t+r]!==n.charCodeAt(r))return!1;return!0}async function Re(e,t){let n=e.width*e.height,r=null;if(n<=De)for(let t of Ee){let n=await ze(e.source,e.width,e.height,t);if(r=C(r,n),n&&n.size<=3670016)return n}let i=r?.size??t,a=Math.min(Math.sqrt(Te/i*.9),.95);for(let t=0;t<4;t+=1){let t=Math.max(Math.floor(e.width*a),1),n=Math.max(Math.floor(e.height*a),1),o=null;for(let i of Ee){let a=await ze(e.source,t,n,i);if(r=C(r,a),o=C(o,a),a&&a.size<=3670016)return a}i=o?.size??i,a*=Math.min(Math.sqrt(Te/i*.9),.9)}return null}function C(e,t){return t&&(!e||t.size<e.size)?t:e}async function ze(e,t,n,r){if(typeof document>`u`)return null;let i=document.createElement(`canvas`);i.width=t,i.height=n;let a=i.getContext(`2d`);if(!a||typeof i.toBlob!=`function`)return null;a.fillStyle=`#fff`,a.fillRect(0,0,t,n),a.drawImage(e,0,0,t,n);try{return await new Promise(e=>{i.toBlob(t=>e(t),`image/jpeg`,r)})}finally{i.width=0,i.height=0}}var Be=`vellum:chatDrafts:`;function w(e){return`${Be}${e}`}function Ve(e){let n=t(w(e),``);if(!n)return new Map;try{let e=JSON.parse(n);return typeof e!=`object`||!e||Array.isArray(e)?new Map:new Map(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return new Map}}function T(e,t){n(w(e),JSON.stringify(Object.fromEntries(t)))}function He(){return`att-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function Ue(e){return b(e)?`100 MB`:`50 MB`}function We(e){return e.size<=52428800?!0:b(e)&&e.size<=104857600}function Ge(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n===-1?t:t.slice(n+1)}var E=new Map,D=null,O=new Map,k=new Set,Ke=a()((e,t)=>({input:``,restoredDraftConversationId:null,attachments:[],attachmentLastError:null,setInput:t=>{e(e=>({input:typeof t==`function`?t(e.input):t}))},saveDraft:(e,t)=>{t.trim()?E.set(e,t):E.delete(e),D&&T(D,E)},clearDraft:e=>{E.delete(e),D&&T(D,E)},handleConversationSwitch:({previousKey:n,nextKey:r})=>{if(!(n!==null&&n!==r)||!n)return;let i=t().input;i.trim()?E.set(n,i):E.delete(n);let a=(r&&E.get(r))??``;e({input:a,restoredDraftConversationId:a.length>0&&r?r:null}),D&&T(D,E)},loadAssistantDrafts:(n,r)=>{if(D&&D!==n){let n=t().input;r&&(n.trim()?E.set(r,n):E.delete(r)),T(D,E),e({input:``,restoredDraftConversationId:null})}E=Ve(n),D=n},clearRestoredDraftNotice:()=>{e({restoredDraftConversationId:null})},restoreDraftIfEmpty:n=>{let r=E.get(n);r&&r.trim()&&!t().input.trim()&&e({input:r,restoredDraftConversationId:n})},addFiles:(t,n)=>{let r=Array.from(t);if(r.length===0)return;if(!n){e({attachmentLastError:`No active assistant. Please try again.`});return}let i=[],a=[];for(let e of r)We(e)?a.push(e):i.push(e);let o=i[0];if(e(o?{attachmentLastError:i.length===1?`${o.name} is larger than ${Ue(o)} and can't be attached.`:`${i.length} files are too large and can't be attached.`}:{attachmentLastError:null}),a.length===0)return;let s=a.map(e=>({pending:{kind:`uploading`,localId:He(),filename:e.name||`attachment`,mimeType:e.type||`application/octet-stream`,sizeBytes:e.size},file:e}));e(e=>({attachments:[...e.attachments,...s.map(e=>e.pending)]}));for(let{pending:t,file:r}of s)(async()=>{try{let i=await Pe(r);if(k.has(t.localId)){k.delete(t.localId);return}if(i.status===`failed`&&r.size>52428800){A(e,t.localId,i.error);return}let a=i.status===`failed`?r:i.file;if(a.size>52428800){A(e,t.localId,`This attachment is still larger than 50 MB after resizing. Try a smaller image.`);return}i.status===`resized`&&e(e=>({attachments:e.attachments.map(e=>e.localId===t.localId&&e.kind===`uploading`?{...e,filename:a.name||`attachment`,mimeType:a.type||`application/octet-stream`,sizeBytes:a.size}:e)}));let o=await ee(n,a);if(k.has(t.localId)){k.delete(t.localId);return}if(!o.ok){A(e,t.localId,o.error.detail??`Upload failed`);return}let s=a.type||`application/octet-stream`,c=o.filename??(a.name||`attachment`),u=o.mimeType??s,te=o.sizeBytes??a.size,d=a;if(u.startsWith(`image/`)&&u!==s){let e=await l(n,o.id);if(k.has(t.localId)){k.delete(t.localId);return}e&&(d=e)}let f=null;try{f=URL.createObjectURL(d),O.set(t.localId,f)}catch{f=null}e(e=>({attachments:e.attachments.map(e=>e.localId===t.localId?{kind:`uploaded`,localId:t.localId,id:o.id,filename:c,mimeType:u,sizeBytes:te,previewUrl:f,thumbnailUrl:null}:e)}))}catch{if(k.has(t.localId)){k.delete(t.localId);return}A(e,t.localId,`Upload failed`)}})()},addPathReferences:t=>{let n=[];for(let e of t){let t=e.trim();t&&n.push({kind:`path-reference`,localId:He(),path:t,filename:Ge(t)||t})}n.length!==0&&e(e=>({attachments:[...e.attachments,...n],attachmentLastError:null}))},removeAttachment:t=>{e(e=>{let n=e.attachments.find(e=>e.localId===t);return n&&n.kind===`uploading`&&k.add(t),{attachments:e.attachments.filter(e=>e.localId!==t)}}),qe(t)},resetAttachments:()=>{e(e=>{for(let t of e.attachments)t.kind===`uploading`&&k.add(t.localId);return{attachments:[],attachmentLastError:null}})},fullReset:()=>{e(e=>{for(let t of e.attachments)t.kind===`uploading`&&k.add(t.localId);return{attachments:[],attachmentLastError:null}}),O.forEach(e=>URL.revokeObjectURL(e)),O.clear()},dismissAttachmentError:()=>{e({attachmentLastError:null})}}));function A(e,t,n){e(e=>({attachments:e.attachments.map(e=>e.localId!==t||e.kind!==`uploading`?e:{kind:`failed`,localId:t,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes,error:n})}))}function qe(e){let t=O.get(e);t&&(URL.revokeObjectURL(t),O.delete(e))}function Je(e){return e.reduce((e,t)=>t.kind===`uploading`?e+1:e,0)}function Ye(e){return e.filter(e=>e.kind===`uploaded`).map(e=>e.id)}function Xe(e){return e.filter(e=>e.kind===`path-reference`).map(e=>e.path)}var j=o(Ke);function Ze(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function Qe(e){let t=JSON.parse(e);return Ze(t)?t:null}function M(e,t){let n=[...e??[]],r=n.findIndex(e=>e.type===`surface`&&e.surface.surfaceId===t.surfaceId);return r===-1?n.push({type:`surface`,surface:t}):n[r]={type:`surface`,surface:t},n}function $e(e,t){return e?.filter(e=>!(e.type===`surface`&&e.surface.surfaceId===t))}function et(e,t){if(!e.surfaces?.length)return e;let n=!1,r=e.contentBlocks,i=e.surfaces.map(e=>{let i=t(e);return i!==e&&(n=!0,r=M(r,i)),i});return n?{...e,surfaces:i,contentBlocks:r}:e}function tt(e,t){if(!e.surfaces?.length)return e;let n=e.surfaces.filter(t);if(n.length===e.surfaces.length)return e;let r=new Set(e.surfaces.filter(e=>!t(e)).map(e=>e.surfaceId));return{...e,surfaces:n,contentOrder:e.contentOrder?.filter(e=>!(e.type===`surface`&&r.has(e.id))),contentBlocks:e.contentBlocks?.filter(e=>!(e.type===`surface`&&r.has(e.surface.surfaceId)))}}var nt=500,rt=s({keyFn:e=>`vellum:dismissed-surfaces:${e}`,scope:`user`,parseValue:e=>Ze(e)?e:null,fallback:{},maxEntries:200});function it(e,t){let n=rt.get(e,t);return n?new Set(n):new Set}function at(e,t,n){let r=Array.from(n);r.length>nt&&(r=r.slice(r.length-nt)),rt.set(e,t,r)}var ot=[];function st(e,t){if(!e)return ot;if(t.size===0)return e;let n=!1,r=e.map(e=>{let r=tt(e,e=>!t.has(e.surfaceId));return r!==e&&(n=!0),r});return n?r:e}function ct(e){if(!e||typeof e!=`object`)return!1;let t=e;return!(typeof t.tokens!=`number`||!Number.isFinite(t.tokens)||t.maxTokens!==null&&(typeof t.maxTokens!=`number`||!Number.isFinite(t.maxTokens))||t.fillRatio!==null&&(typeof t.fillRatio!=`number`||!Number.isFinite(t.fillRatio)))}var lt=s({keyFn:e=>`vellum:ctxwindow:${e}`,scope:`user`,parseValue:e=>ct(e)?e:null,fallback:{},maxEntries:200});function ut(e){return new Map(Object.entries(lt.load(e)))}function dt(e,t,n){lt.set(e,t,n)}var ft=`PROVIDER_BILLING`,pt=`PROVIDER_NOT_CONFIGURED`,mt=`MANAGED_KEY_INVALID`,ht=`credits_exhausted`,gt=`provider_billing`;function _t(e){return e?.errorCategory?e.errorCategory.endsWith(ht):e?.code===ft}function vt(e){return e?.errorCategory?e.errorCategory.endsWith(gt):!1}function yt(e){return _t(e)?`managed_credits`:vt(e)?`provider_billing`:null}function N(e){return yt(e)!==null||e?.code===pt||e?.displayAs===`modal`}function bt(e){return!!e&&!N(e)}function xt(e){return e?.code===mt}var St={pendingSecret:null,isSubmittingSecret:!1,secretSaved:!1,pendingConfirmation:null,isSubmittingConfirmation:!1,pendingContactRequest:null,isSubmittingContactRequest:!1,contactRequestAccepted:!1,pendingQuestion:null,isSubmittingQuestion:!1,isQuestionCardDismissed:!1,inlineConfirmationToolCallId:null,unknownNudgeToolCallIds:new Set},P=o(a()((e,t)=>({...St,showSecret:n=>{let{pendingSecret:r}=t();if(r&&r.requestId===n.requestId){let t={};for(let e of Object.keys(n))n[e]!==void 0&&(t[e]=n[e]);e({pendingSecret:{...r,...t}});return}e({pendingSecret:n,isSubmittingSecret:!1,secretSaved:!1})},submitSecretStart:()=>e({isSubmittingSecret:!0}),submitSecretEnd:t=>e({isSubmittingSecret:!1,secretSaved:t??!1}),dismissSecret:()=>e({pendingSecret:null,isSubmittingSecret:!1}),updateSecret:(n,r)=>{let{pendingSecret:i}=t();!i||i.requestId!==n||e({pendingSecret:{...i,...r}})},showConfirmation:t=>e({pendingConfirmation:t,isSubmittingConfirmation:!1}),submitConfirmationStart:()=>e({isSubmittingConfirmation:!0}),submitConfirmationEnd:()=>e({isSubmittingConfirmation:!1}),dismissConfirmation:()=>e({pendingConfirmation:null,isSubmittingConfirmation:!1}),dismissConfirmationIfMatches:n=>{let{pendingConfirmation:r}=t();!r||r.requestId!==n||e({pendingConfirmation:null,isSubmittingConfirmation:!1})},updateConfirmation:(n,r)=>{let{pendingConfirmation:i}=t();!i||i.requestId!==n||e({pendingConfirmation:{...i,...r}})},setInlineConfirmationToolCallId:t=>e({inlineConfirmationToolCallId:t}),showContactRequest:t=>e({pendingContactRequest:t,isSubmittingContactRequest:!1,contactRequestAccepted:!1}),submitContactRequestStart:()=>e({isSubmittingContactRequest:!0}),submitContactRequestEnd:()=>e({isSubmittingContactRequest:!1}),dismissContactRequest:()=>e({pendingContactRequest:null,isSubmittingContactRequest:!1}),acceptContactRequest:()=>e({contactRequestAccepted:!0}),showQuestion:t=>e({pendingQuestion:t,isSubmittingQuestion:!1,isQuestionCardDismissed:!1}),submitQuestionStart:()=>e({isSubmittingQuestion:!0}),submitQuestionEnd:()=>e({isSubmittingQuestion:!1}),dismissQuestion:()=>e({pendingQuestion:null,isSubmittingQuestion:!1,isQuestionCardDismissed:!1}),dismissQuestionCard:()=>e({isQuestionCardDismissed:!0}),resetSecretAndConfirmation:()=>e({pendingSecret:null,isSubmittingSecret:!1,secretSaved:!1,pendingConfirmation:null,isSubmittingConfirmation:!1,inlineConfirmationToolCallId:null}),addUnknownNudgeToolCallId:n=>{let r=t().unknownNudgeToolCallIds;r.has(n)||e({unknownNudgeToolCallIds:new Set([...r,n])})},removeUnknownNudgeToolCallId:n=>{let r=t().unknownNudgeToolCallIds;if(!r.has(n))return;let i=new Set(r);i.delete(n),e({unknownNudgeToolCallIds:i})},resetAll:()=>e(St)})));function Ct(e){if(e.length===0)return``;let t=e[0]??``;for(let n=1;n<e.length;n++){let r=t[t.length-1],i=e[n][0];r&&i&&r!==` `&&r!==`
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{r as t,s as n}from"./local-settings-lVNyIOJ_.js";import{t as r}from"./react-DJZBPgpf.js";import{t as i}from"./createLucideIcon-IRfcSUxS.js";import{n as a,t as o}from"./create-selectors-8NePGNlX.js";import{n as s}from"./typed-storage-BRvgA7pX.js";import{a as c}from"./diagnostics-CUmYxbmM.js";import{l}from"./chat-markdown-message-Cp8stHaU.js";import{t as u}from"./conversation-store-CynXqAcO.js";import{c as ee,d as te}from"./messages-B2CZAuPN.js";import{b as d,n as f,t as ne,v as re,w as p,x as ie}from"./chat-0L0NBUcq.js";var ae=i(`bolt`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}],[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}]]),oe=i(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),se=i(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),ce=i(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),le=e(r(),1),m=1e3,ue=15,de=0,h=new Map,g=[];function fe(e){let t=`sse-${++de}`,n={id:t,abortSignal:e,initiatedAt:Date.now(),establishedAt:null,lastTrafficAt:null,lastDataAt:null,dataFrames:0,keepalives:0,endedAt:null,endReason:null};h.set(t,n),Se();let r=()=>{xe(t,`aborted`)};return e.aborted?r():e.addEventListener(`abort`,r,{once:!0}),t}function pe(e){let t=h.get(e);t&&t.establishedAt===null&&(t.establishedAt=Date.now())}function me(e,t){let n=h.get(e);if(!n)return;let r=Date.now();n.lastTrafficAt=r,t?(n.lastDataAt=r,n.dataFrames++):n.keepalives++}function he(e,t){g.push({clientId:e,receivedAt:new Date().toISOString(),...t}),g.length>m&&g.shift()}var ge=`events-tail`;function _e(e){if(e.length===0)return;let t=new Set;for(let e of g)typeof e.seq==`number`&&t.add(e.seq);for(let n of e)typeof n.seq==`number`&&t.has(n.seq)||g.push({clientId:ge,receivedAt:new Date().toISOString(),...n});for(;g.length>m;)g.shift()}function ve(){return Array.from(h.values())}function ye(e=m){let t=Math.max(0,g.length-e);return g.slice(t)}function be(e,t){if(t===null)return null;let n=1/0;for(let e of g)typeof e.seq==`number`&&(n=Math.min(n,e.seq));return n!==1/0&&n>t+1?null:g.filter(n=>n.conversationId===e&&typeof n.seq==`number`&&n.seq>t).sort((e,t)=>e.seq-t.seq)}function xe(e,t){let n=h.get(e);n&&(n.endedAt===null?(n.endedAt=Date.now(),n.endReason=t):n.endReason===`aborted`&&t!==`aborted`&&(n.endReason=t),Se())}function Se(){let e=0;for(let t of h.values())t.endedAt!==null&&e++;if(!(e<=ue))for(let[t,n]of h){if(e<=ue)break;n.endedAt!==null&&(h.delete(t),e--)}}var _={phase:`idle`,pendingQueuedCount:0,activeToolCallCount:0,activeTurnId:null,lastTerminalReason:null,statusText:null,liveWebActivity:{}};function v(e){return e===`queued`||e===`thinking`||e===`streaming`||e===`awaiting_user_input`}function Ce(e){return e===`thinking`}function y(e){return(e.phase===`idle`||e.phase===`errored`)&&!e.activeTurnId}var we=o(a()((e,t)=>({..._,requestSend:t=>e(e=>({phase:`thinking`,activeTurnId:t??e.activeTurnId,lastTerminalReason:null,activeToolCallCount:0,statusText:null})),acceptSend:t=>e(e=>({activeTurnId:t,...e.phase===`idle`||e.phase===`errored`?{phase:`thinking`,lastTerminalReason:null}:null})),onTextDelta:()=>{let n=t();if(n.phase===`idle`||n.phase===`errored`){if(!n.activeTurnId)return;e({phase:`streaming`});return}(n.phase===`thinking`||n.phase===`queued`)&&e({phase:`streaming`})},onToolUseStart:()=>{let n=t();y(n)||e({phase:n.phase===`idle`||n.phase===`errored`||n.phase===`queued`?`thinking`:n.phase,activeToolCallCount:n.activeToolCallCount+1})},onToolResult:()=>e(e=>({activeToolCallCount:Math.max(0,e.activeToolCallCount-1)})),onToolActivityMetadata:(n,r)=>{let i=t();y(i)||e({liveWebActivity:{...i.liveWebActivity,[n]:r}})},onActivityThinking:n=>{let r=t();y(r)||r.phase!==`awaiting_user_input`&&e({phase:`thinking`,statusText:n??null})},showSurface:n=>{y(t())||n&&e({phase:`awaiting_user_input`})},updateSurface:()=>{},dismissSurface:()=>{let n=t();n.phase===`awaiting_user_input`&&n.activeToolCallCount===0&&e({phase:`thinking`})},completeSurface:()=>{let n=t();n.phase===`awaiting_user_input`&&n.activeToolCallCount===0&&e({phase:`thinking`})},onSecretRequest:()=>{y(t())||e({phase:`awaiting_user_input`})},onConfirmationRequest:()=>{y(t())||e({phase:`awaiting_user_input`})},onQuestionRequest:()=>{y(t())||e({phase:`awaiting_user_input`})},onContactRequest:()=>{y(t())||e({phase:`awaiting_user_input`})},completeTurn:()=>{e({phase:t().pendingQueuedCount>0?`queued`:`idle`,activeTurnId:null,activeToolCallCount:0,lastTerminalReason:`complete`,statusText:null,liveWebActivity:{}})},handoffGeneration:()=>{y(t())||e({phase:`thinking`,activeToolCallCount:0,statusText:null})},cancelGeneration:()=>{e({phase:t().pendingQueuedCount>0?`queued`:`idle`,activeTurnId:null,activeToolCallCount:0,lastTerminalReason:`cancelled`,statusText:null,liveWebActivity:{}})},onStreamError:()=>e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,pendingQueuedCount:0,lastTerminalReason:`error`,statusText:null,liveWebActivity:{}}),onSessionError:()=>e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,pendingQueuedCount:0,lastTerminalReason:`session_error`,statusText:null,liveWebActivity:{}}),onTurnTimeout:()=>e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,pendingQueuedCount:0,lastTerminalReason:`timeout`,statusText:null,liveWebActivity:{}}),onPollReconciled:n=>{let r=t();n&&n!==r.activeTurnId||v(r.phase)&&e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,lastTerminalReason:`complete`,statusText:null,liveWebActivity:{}})},resetTurn:()=>e({..._}),clearStaleTurn:()=>{let n=t();n.activeTurnId&&v(n.phase)||e({..._})},enqueueMessage:()=>e(e=>({pendingQueuedCount:e.pendingQueuedCount+1})),dequeueMessage:()=>{let n=t(),r=Math.max(0,n.pendingQueuedCount-1);if(y(n)){e({pendingQueuedCount:r});return}e({phase:`thinking`,pendingQueuedCount:r})},deleteQueuedMessage:()=>{let n=t(),r=Math.max(0,n.pendingQueuedCount-1);if(r===0&&n.phase===`queued`){e({phase:`idle`,pendingQueuedCount:0,activeTurnId:null,lastTerminalReason:`complete`,statusText:null,liveWebActivity:{}});return}e({pendingQueuedCount:r})}}))),Te=3670016,Ee=[.85,.75,.65,.5],De=2e7,Oe=new Set([`image/jpeg`,`image/jpg`,`image/png`,`image/webp`,`image/heic`,`image/heif`,`image/bmp`,`image/tiff`]),ke=new Set([`jpg`,`jpeg`,`png`,`webp`,`heic`,`heif`,`bmp`,`tif`,`tiff`]);function b(e){let t=e.type.trim().toLowerCase();if(Oe.has(t))return!0;let n=e.name.split(`.`).pop()?.trim().toLowerCase();return n?ke.has(n):!1}function Ae(e){return b(e)&&e.size>3670016}function je(e){let t=e.type.trim().toLowerCase();if(t===`image/heic`||t===`image/heif`)return!0;let n=e.name.split(`.`).pop()?.trim().toLowerCase();return n===`heic`||n===`heif`}function Me(e){return Ae(e)||je(e)}function Ne(e){let t=`attachment`,n=e.trim()||t;return/\.(?:jpe?g)$/i.test(n)?n:`${n.replace(/\.[^./\\]+$/,``)||t}.jpg`}async function Pe(e){if(!Me(e)||await Ie(e))return{status:`unchanged`,file:e};if(e.size>104857600)return{status:`failed`,error:`This image is too large to process safely. Please choose a smaller image.`};let t;try{t=await Fe(e)}catch{return{status:`failed`,error:`Couldn't resize this image for upload. Try a smaller image.`}}try{let n;try{n=await Re(t,e.size)}catch{n=null}return!n||!je(e)&&n.size>=e.size?{status:`failed`,error:`Couldn't resize this image for upload. Try a smaller image.`}:{status:`resized`,file:new File([n],Ne(e.name),{type:`image/jpeg`,lastModified:e.lastModified})}}finally{t.close()}}async function Fe(e){if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e,{imageOrientation:`from-image`});return{source:t,width:t.width,height:t.height,close:()=>t.close()}}catch{}if(typeof Image>`u`)throw Error(`No browser image decoder is available.`);let t=URL.createObjectURL(e);return await new Promise((e,n)=>{let r=new Image;r.onload=()=>{e({source:r,width:r.naturalWidth||r.width,height:r.naturalHeight||r.height,close:()=>URL.revokeObjectURL(t)})},r.onerror=()=>{URL.revokeObjectURL(t),n(Error(`Image decode failed.`))},r.src=t})}async function Ie(e){if(!Le(e))return!1;let t;try{t=new Uint8Array(await e.slice(0,Math.min(e.size,1024*1024)).arrayBuffer())}catch{return!0}if(!S(t,0,`RIFF`)||!S(t,8,`WEBP`))return!1;let n=x(t,`VP8X`);return n>=0&&(t[n+8]??0)&2?!0:x(t,`ANIM`)>=0||x(t,`ANMF`)>=0}function Le(e){return e.type.trim().toLowerCase()===`image/webp`||/\.webp$/i.test(e.name)}function x(e,t){for(let n=0;n<=e.length-t.length;n+=1)if(S(e,n,t))return n;return-1}function S(e,t,n){if(t+n.length>e.length)return!1;for(let r=0;r<n.length;r+=1)if(e[t+r]!==n.charCodeAt(r))return!1;return!0}async function Re(e,t){let n=e.width*e.height,r=null;if(n<=De)for(let t of Ee){let n=await ze(e.source,e.width,e.height,t);if(r=C(r,n),n&&n.size<=3670016)return n}let i=r?.size??t,a=Math.min(Math.sqrt(Te/i*.9),.95);for(let t=0;t<4;t+=1){let t=Math.max(Math.floor(e.width*a),1),n=Math.max(Math.floor(e.height*a),1),o=null;for(let i of Ee){let a=await ze(e.source,t,n,i);if(r=C(r,a),o=C(o,a),a&&a.size<=3670016)return a}i=o?.size??i,a*=Math.min(Math.sqrt(Te/i*.9),.9)}return null}function C(e,t){return t&&(!e||t.size<e.size)?t:e}async function ze(e,t,n,r){if(typeof document>`u`)return null;let i=document.createElement(`canvas`);i.width=t,i.height=n;let a=i.getContext(`2d`);if(!a||typeof i.toBlob!=`function`)return null;a.fillStyle=`#fff`,a.fillRect(0,0,t,n),a.drawImage(e,0,0,t,n);try{return await new Promise(e=>{i.toBlob(t=>e(t),`image/jpeg`,r)})}finally{i.width=0,i.height=0}}var Be=`vellum:chatDrafts:`;function w(e){return`${Be}${e}`}function Ve(e){let n=t(w(e),``);if(!n)return new Map;try{let e=JSON.parse(n);return typeof e!=`object`||!e||Array.isArray(e)?new Map:new Map(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return new Map}}function T(e,t){n(w(e),JSON.stringify(Object.fromEntries(t)))}function He(){return`att-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function Ue(e){return b(e)?`100 MB`:`50 MB`}function We(e){return e.size<=52428800?!0:b(e)&&e.size<=104857600}function Ge(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n===-1?t:t.slice(n+1)}var E=new Map,D=null,O=new Map,k=new Set,Ke=a()((e,t)=>({input:``,restoredDraftConversationId:null,attachments:[],attachmentLastError:null,setInput:t=>{e(e=>({input:typeof t==`function`?t(e.input):t}))},saveDraft:(e,t)=>{t.trim()?E.set(e,t):E.delete(e),D&&T(D,E)},clearDraft:e=>{E.delete(e),D&&T(D,E)},handleConversationSwitch:({previousKey:n,nextKey:r})=>{if(!(n!==null&&n!==r)||!n)return;let i=t().input;i.trim()?E.set(n,i):E.delete(n);let a=(r&&E.get(r))??``;e({input:a,restoredDraftConversationId:a.length>0&&r?r:null}),D&&T(D,E)},loadAssistantDrafts:(n,r)=>{if(D&&D!==n){let n=t().input;r&&(n.trim()?E.set(r,n):E.delete(r)),T(D,E),e({input:``,restoredDraftConversationId:null})}E=Ve(n),D=n},clearRestoredDraftNotice:()=>{e({restoredDraftConversationId:null})},restoreDraftIfEmpty:n=>{let r=E.get(n);r&&r.trim()&&!t().input.trim()&&e({input:r,restoredDraftConversationId:n})},addFiles:(t,n)=>{let r=Array.from(t);if(r.length===0)return;if(!n){e({attachmentLastError:`No active assistant. Please try again.`});return}let i=[],a=[];for(let e of r)We(e)?a.push(e):i.push(e);let o=i[0];if(e(o?{attachmentLastError:i.length===1?`${o.name} is larger than ${Ue(o)} and can't be attached.`:`${i.length} files are too large and can't be attached.`}:{attachmentLastError:null}),a.length===0)return;let s=a.map(e=>({pending:{kind:`uploading`,localId:He(),filename:e.name||`attachment`,mimeType:e.type||`application/octet-stream`,sizeBytes:e.size},file:e}));e(e=>({attachments:[...e.attachments,...s.map(e=>e.pending)]}));for(let{pending:t,file:r}of s)(async()=>{try{let i=await Pe(r);if(k.has(t.localId)){k.delete(t.localId);return}if(i.status===`failed`&&r.size>52428800){A(e,t.localId,i.error);return}let a=i.status===`failed`?r:i.file;if(a.size>52428800){A(e,t.localId,`This attachment is still larger than 50 MB after resizing. Try a smaller image.`);return}i.status===`resized`&&e(e=>({attachments:e.attachments.map(e=>e.localId===t.localId&&e.kind===`uploading`?{...e,filename:a.name||`attachment`,mimeType:a.type||`application/octet-stream`,sizeBytes:a.size}:e)}));let o=await ee(n,a);if(k.has(t.localId)){k.delete(t.localId);return}if(!o.ok){A(e,t.localId,o.error.detail??`Upload failed`);return}let s=a.type||`application/octet-stream`,c=o.filename??(a.name||`attachment`),u=o.mimeType??s,te=o.sizeBytes??a.size,d=a;if(u.startsWith(`image/`)&&u!==s){let e=await l(n,o.id);if(k.has(t.localId)){k.delete(t.localId);return}e&&(d=e)}let f=null;try{f=URL.createObjectURL(d),O.set(t.localId,f)}catch{f=null}e(e=>({attachments:e.attachments.map(e=>e.localId===t.localId?{kind:`uploaded`,localId:t.localId,id:o.id,filename:c,mimeType:u,sizeBytes:te,previewUrl:f,thumbnailUrl:null}:e)}))}catch{if(k.has(t.localId)){k.delete(t.localId);return}A(e,t.localId,`Upload failed`)}})()},addPathReferences:t=>{let n=[];for(let e of t){let t=e.trim();t&&n.push({kind:`path-reference`,localId:He(),path:t,filename:Ge(t)||t})}n.length!==0&&e(e=>({attachments:[...e.attachments,...n],attachmentLastError:null}))},removeAttachment:t=>{e(e=>{let n=e.attachments.find(e=>e.localId===t);return n&&n.kind===`uploading`&&k.add(t),{attachments:e.attachments.filter(e=>e.localId!==t)}}),qe(t)},resetAttachments:()=>{e(e=>{for(let t of e.attachments)t.kind===`uploading`&&k.add(t.localId);return{attachments:[],attachmentLastError:null}})},fullReset:()=>{e(e=>{for(let t of e.attachments)t.kind===`uploading`&&k.add(t.localId);return{attachments:[],attachmentLastError:null}}),O.forEach(e=>URL.revokeObjectURL(e)),O.clear()},dismissAttachmentError:()=>{e({attachmentLastError:null})}}));function A(e,t,n){e(e=>({attachments:e.attachments.map(e=>e.localId!==t||e.kind!==`uploading`?e:{kind:`failed`,localId:t,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes,error:n})}))}function qe(e){let t=O.get(e);t&&(URL.revokeObjectURL(t),O.delete(e))}function Je(e){return e.reduce((e,t)=>t.kind===`uploading`?e+1:e,0)}function Ye(e){return e.filter(e=>e.kind===`uploaded`).map(e=>e.id)}function Xe(e){return e.filter(e=>e.kind===`path-reference`).map(e=>e.path)}var j=o(Ke);function Ze(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function Qe(e){let t=JSON.parse(e);return Ze(t)?t:null}function M(e,t){let n=[...e??[]],r=n.findIndex(e=>e.type===`surface`&&e.surface.surfaceId===t.surfaceId);return r===-1?n.push({type:`surface`,surface:t}):n[r]={type:`surface`,surface:t},n}function $e(e,t){return e?.filter(e=>!(e.type===`surface`&&e.surface.surfaceId===t))}function et(e,t){if(!e.surfaces?.length)return e;let n=!1,r=e.contentBlocks,i=e.surfaces.map(e=>{let i=t(e);return i!==e&&(n=!0,r=M(r,i)),i});return n?{...e,surfaces:i,contentBlocks:r}:e}function tt(e,t){if(!e.surfaces?.length)return e;let n=e.surfaces.filter(t);if(n.length===e.surfaces.length)return e;let r=new Set(e.surfaces.filter(e=>!t(e)).map(e=>e.surfaceId));return{...e,surfaces:n,contentOrder:e.contentOrder?.filter(e=>!(e.type===`surface`&&r.has(e.id))),contentBlocks:e.contentBlocks?.filter(e=>!(e.type===`surface`&&r.has(e.surface.surfaceId)))}}var nt=500,rt=s({keyFn:e=>`vellum:dismissed-surfaces:${e}`,scope:`user`,parseValue:e=>Ze(e)?e:null,fallback:{},maxEntries:200});function it(e,t){let n=rt.get(e,t);return n?new Set(n):new Set}function at(e,t,n){let r=Array.from(n);r.length>nt&&(r=r.slice(r.length-nt)),rt.set(e,t,r)}var ot=[];function st(e,t){if(!e)return ot;if(t.size===0)return e;let n=!1,r=e.map(e=>{let r=tt(e,e=>!t.has(e.surfaceId));return r!==e&&(n=!0),r});return n?r:e}function ct(e){if(!e||typeof e!=`object`)return!1;let t=e;return!(typeof t.tokens!=`number`||!Number.isFinite(t.tokens)||t.maxTokens!==null&&(typeof t.maxTokens!=`number`||!Number.isFinite(t.maxTokens))||t.fillRatio!==null&&(typeof t.fillRatio!=`number`||!Number.isFinite(t.fillRatio)))}var lt=s({keyFn:e=>`vellum:ctxwindow:${e}`,scope:`user`,parseValue:e=>ct(e)?e:null,fallback:{},maxEntries:200});function ut(e){return new Map(Object.entries(lt.load(e)))}function dt(e,t,n){lt.set(e,t,n)}var ft=`PROVIDER_BILLING`,pt=`PROVIDER_NOT_CONFIGURED`,mt=`MANAGED_KEY_INVALID`,ht=`credits_exhausted`,gt=`provider_billing`;function _t(e){return e?.errorCategory?e.errorCategory.endsWith(ht):e?.code===ft}function vt(e){return e?.errorCategory?e.errorCategory.endsWith(gt):!1}function yt(e){return _t(e)?`managed_credits`:vt(e)?`provider_billing`:null}function N(e){return yt(e)!==null||e?.code===pt||e?.displayAs===`modal`}function bt(e){return!!e&&!N(e)}function xt(e){return e?.code===mt}var St={pendingSecret:null,isSubmittingSecret:!1,secretSaved:!1,pendingConfirmation:null,isSubmittingConfirmation:!1,pendingContactRequest:null,isSubmittingContactRequest:!1,contactRequestAccepted:!1,pendingQuestion:null,isSubmittingQuestion:!1,isQuestionCardDismissed:!1,inlineConfirmationToolCallId:null,unknownNudgeToolCallIds:new Set},P=o(a()((e,t)=>({...St,showSecret:n=>{let{pendingSecret:r}=t();if(r&&r.requestId===n.requestId){let t={};for(let e of Object.keys(n))n[e]!==void 0&&(t[e]=n[e]);e({pendingSecret:{...r,...t}});return}e({pendingSecret:n,isSubmittingSecret:!1,secretSaved:!1})},submitSecretStart:()=>e({isSubmittingSecret:!0}),submitSecretEnd:t=>e({isSubmittingSecret:!1,secretSaved:t??!1}),dismissSecret:()=>e({pendingSecret:null,isSubmittingSecret:!1}),updateSecret:(n,r)=>{let{pendingSecret:i}=t();!i||i.requestId!==n||e({pendingSecret:{...i,...r}})},showConfirmation:t=>e({pendingConfirmation:t,isSubmittingConfirmation:!1}),submitConfirmationStart:()=>e({isSubmittingConfirmation:!0}),submitConfirmationEnd:()=>e({isSubmittingConfirmation:!1}),dismissConfirmation:()=>e({pendingConfirmation:null,isSubmittingConfirmation:!1}),dismissConfirmationIfMatches:n=>{let{pendingConfirmation:r}=t();!r||r.requestId!==n||e({pendingConfirmation:null,isSubmittingConfirmation:!1})},updateConfirmation:(n,r)=>{let{pendingConfirmation:i}=t();!i||i.requestId!==n||e({pendingConfirmation:{...i,...r}})},setInlineConfirmationToolCallId:t=>e({inlineConfirmationToolCallId:t}),showContactRequest:t=>e({pendingContactRequest:t,isSubmittingContactRequest:!1,contactRequestAccepted:!1}),submitContactRequestStart:()=>e({isSubmittingContactRequest:!0}),submitContactRequestEnd:()=>e({isSubmittingContactRequest:!1}),dismissContactRequest:()=>e({pendingContactRequest:null,isSubmittingContactRequest:!1}),acceptContactRequest:()=>e({contactRequestAccepted:!0}),showQuestion:t=>e({pendingQuestion:t,isSubmittingQuestion:!1,isQuestionCardDismissed:!1}),submitQuestionStart:()=>e({isSubmittingQuestion:!0}),submitQuestionEnd:()=>e({isSubmittingQuestion:!1}),dismissQuestion:()=>e({pendingQuestion:null,isSubmittingQuestion:!1,isQuestionCardDismissed:!1}),dismissQuestionCard:()=>e({isQuestionCardDismissed:!0}),resetSecretAndConfirmation:()=>e({pendingSecret:null,isSubmittingSecret:!1,secretSaved:!1,pendingConfirmation:null,isSubmittingConfirmation:!1,inlineConfirmationToolCallId:null}),addUnknownNudgeToolCallId:n=>{let r=t().unknownNudgeToolCallIds;r.has(n)||e({unknownNudgeToolCallIds:new Set([...r,n])})},removeUnknownNudgeToolCallId:n=>{let r=t().unknownNudgeToolCallIds;if(!r.has(n))return;let i=new Set(r);i.delete(n),e({unknownNudgeToolCallIds:i})},resetAll:()=>e(St)})));function Ct(e){if(e.length===0)return``;let t=e[0]??``;for(let n=1;n<e.length;n++){let r=t[t.length-1],i=e[n][0];r&&i&&r!==` `&&r!==`
2
2
  `&&r!==` `&&i!==` `&&i!==`
3
3
  `&&i!==` `&&(t+=` `),t+=e[n]}return t}function wt(e){let t=[];for(let n of e?.contentBlocks??[])n.type===`text`&&t.push(n.text);return Ct(t)}function Tt(e){if(!(!e||e.length===0))return e.map(e=>{let{previewUrl:t,thumbnailUrl:n}=te(e.mimeType,e.data,e.thumbnailData,e.id!=null);return{id:e.id??e.filename,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes??(e.data?Math.floor(e.data.length*3/4):0),previewUrl:t,thumbnailUrl:n}})}function F(e){let t=e[e.length-1];return!!t&&t.role===`assistant`}function Et(e,t){if(!t)return null;let n=e.length-1;for(;n>=0&&e[n].role===`user`&&e[n].queueStatus===`queued`;)n--;let r=e[n];return!r||r.role!==`assistant`?null:r.id}function I(e,t){return e.findIndex(e=>e.role===`assistant`&&(e.id===t||!!e.mergedMessageIds?.includes(t)))}function L(e,t){if(!t||e.id===t)return e;let n=e.mergedMessageIds??[];return n.includes(t)?e:{...e,mergedMessageIds:[...n,t]}}function R(e,t=Date.now()){if(!e.toolCalls?.some(e=>p(e)))return null;let n=t;return{toolCalls:e.toolCalls.map(e=>p(e)?{...e,completedAt:n}:e),contentBlocks:e.contentBlocks?.map(e=>e.type===`tool_use`&&p(e.toolCall)?{type:`tool_use`,toolCall:{...e.toolCall,completedAt:n}}:e)}}function Dt(e,t,n){return e.map(e=>e.id===t?{...e,queuePosition:n}:e)}function Ot(e,t){return e.map(e=>e.id===t?{...e,queueStatus:void 0,queuePosition:void 0}:e)}function kt(e,t){return e.filter(e=>e.id!==t)}function At(e,t,n,r=Date.now()){return[...e,{id:n??crypto.randomUUID(),...n?{}:{isOptimistic:!0},role:`assistant`,textSegments:[t],contentOrder:[{type:`text`,id:`0`}],contentBlocks:[{type:`text`,text:t}],timestamp:r}]}function jt(e,t,n){n&&e[e.length-1]?.type===t.type?e[e.length-1]=t:e.push(t)}function z(e,t,n,r){let i=L(e[t],r),a=[...i.textSegments??[]],o=[...i.contentOrder??[]],s=[...i.contentBlocks??[]],c=o[o.length-1]?.type===`text`&&a.length>0;c?a[a.length-1]=a[a.length-1]+n:(o.push({type:`text`,id:String(a.length)}),a.push(n)),jt(s,{type:`text`,text:a[a.length-1]},c);let l=[...e];return l[t]={...i,textSegments:a,contentOrder:o,contentBlocks:s},l}function B(e,t,n,r){let i=L(e[t],r),a=[...i.thinkingSegments??[]],o=[...i.contentOrder??[]],s=[...i.contentBlocks??[]],c=o[o.length-1]?.type===`thinking`&&a.length>0;c?a[a.length-1]=a[a.length-1]+n:(o.push({type:`thinking`,id:String(a.length)}),a.push(n)),jt(s,{type:`thinking`,thinking:a[a.length-1]},c);let l=[...e];return l[t]={...i,thinkingSegments:a,contentOrder:o,contentBlocks:s},l}function Mt(e,t,n,r,i=Date.now()){if(n){let a=I(e,n);if(a>=0)return z(e,a,t,n);if(F(e))return z(e,e.length-1,t,n);let o=r?.();return o?z([...e,o],e.length,t,n):At(e,t,n,i)}return F(e)?z(e,e.length-1,t,void 0):At(e,t,n,i)}function Nt(e,t,n,r=Date.now()){return[...e,{id:n??crypto.randomUUID(),...n?{}:{isOptimistic:!0},role:`assistant`,thinkingSegments:[t],contentOrder:[{type:`thinking`,id:`0`}],contentBlocks:[{type:`thinking`,thinking:t}],timestamp:r}]}function Pt(e,t,n,r,i=Date.now()){if(n){let a=I(e,n);if(a>=0)return B(e,a,t,n);if(F(e))return B(e,e.length-1,t,n);let o=r?.();return o?B([...e,o],e.length,t,n):Nt(e,t,n,i)}return F(e)?B(e,e.length-1,t,void 0):Nt(e,t,n,i)}function Ft(e,t=Date.now()){let n=!1,r=e.map(e=>{if(e.role!==`assistant`)return e;let r=R(e,t);return r?(n=!0,{...e,...r}):e});return n?r:e}function It(e,t,n=Date.now()){let r=e[e.length-1],i=Tt(t.attachments);if(r?.role!==`assistant`)return i?[...e,{id:t.messageId??crypto.randomUUID(),...t.messageId?{}:{isOptimistic:!0},role:`assistant`,timestamp:n,attachments:i}]:e;let a=R(r,n),o=r.isOptimistic===!0&&!!t.messageId;return[...e.slice(0,-1),{...r,...o?{id:t.messageId,isOptimistic:!1}:{},...i?{attachments:i}:{},...a??{}}]}function Lt(e,t){if(t!==void 0)return e.findIndex(e=>e.role===`user`&&e.clientMessageId===t);for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.role===`user`&&n.isOptimistic===!0)return t}return-1}function Rt(e,t,n=Date.now()){let r=t.messageId;if(r!==void 0&&e.some(e=>e.role===`user`&&(e.id===r||e.mergedMessageIds?.includes(r))))return e;let i=Lt(e,t.clientMessageId);if(i!==-1){if(r===void 0)return e;let t=[...e];return t[i]={...t[i],id:r,isOptimistic:!1,queueStatus:void 0,queuePosition:void 0},t}return[...e,{id:r??crypto.randomUUID(),...r===void 0?{isOptimistic:!0}:{},...t.clientMessageId?{clientMessageId:t.clientMessageId}:{},role:`user`,textSegments:[t.text],contentOrder:[{type:`text`,id:`0`}],contentBlocks:[{type:`text`,text:t.text}],timestamp:n}]}function zt(e,t=Date.now()){let n=e.length-1,r=e[n];if(!r||r.role!==`assistant`)return e;let i=R(r,t);if(!(wt(r).trim().length>0||r.thinkingSegments!=null&&r.thinkingSegments.length>0||r.toolCalls!=null&&r.toolCalls.length>0||r.surfaces!=null&&r.surfaces.length>0))return e.slice(0,-1);let a=[...e];return a[n]={...r,...i??{}},a}function V(e,t){let n=[...e??[]],r=n.findIndex(e=>e.type===`tool_use`&&e.toolCall.id===t.id);return r===-1?n.push({type:`tool_use`,toolCall:t}):n[r]={type:`tool_use`,toolCall:t},n}function H(e,t,n,r){let i=L(e[t],r),a=i.toolCalls?.findIndex(e=>e.id===n.id)??-1,o=[...e];if(a!==-1){let e=[...i.toolCalls??[]],r={...e[a],...n};return e[a]=r,o[t]={...i,toolCalls:e,contentBlocks:V(i.contentBlocks,r)},o}return o[t]={...i,toolCalls:[...i.toolCalls??[],n],contentOrder:[...i.contentOrder??[],{type:`toolCall`,id:n.id}],contentBlocks:V(i.contentBlocks,n)},o}function Bt(e,t,n,r=Date.now()){if(n){let r=I(e,n);if(r>=0)return H(e,r,t,n);if(F(e))return H(e,e.length-1,t,n)}else if(F(e))return H(e,e.length-1,t);return[...e,{id:n??crypto.randomUUID(),...n?{}:{isOptimistic:!0},role:`assistant`,toolCalls:[t],contentOrder:[{type:`toolCall`,id:t.id}],contentBlocks:[{type:`tool_use`,toolCall:t}],timestamp:r}]}function Vt(e,t){let n=-1,r=-1;if(t.toolUseId)for(let i=e.length-1;i>=0;i--){let a=e[i];if(a?.role!==`assistant`||!a.toolCalls?.length)continue;let o=a.toolCalls.findIndex(e=>e.id===t.toolUseId);if(o!==-1){n=i,r=o;break}}if(n===-1){if(n=e.findLastIndex(e=>e.role===`assistant`&&e.toolCalls&&e.toolCalls.length>0),n===-1)return e;let t=e[n];if(!t?.toolCalls)return e;r=t.toolCalls.findLastIndex(e=>p(e))}if(r===-1)return e;let i=e[n],a=i.toolCalls[r];if(!a)return e;let o=t.imageDataList===void 0?t.imageData===void 0?void 0:[t.imageData]:t.imageDataList,s=t.imageData===void 0?o?.[0]:t.imageData,c=[...i.toolCalls],l={...a,result:t.result,isError:t.isError,riskLevel:t.riskLevel,riskReason:t.riskReason,matchedTrustRuleId:t.matchedTrustRuleId,approvalMode:t.approvalMode,approvalReason:t.approvalReason,riskThreshold:t.riskThreshold,riskAllowlistOptions:t.riskAllowlistOptions,riskScopeOptions:t.riskScopeOptions,riskDirectoryScopeOptions:t.riskDirectoryScopeOptions,...s===void 0?{}:{imageData:s},...o===void 0?{}:{imageDataList:o},...t.activityMetadata===void 0?{}:{activityMetadata:t.activityMetadata},completedAt:t.completedAt??Date.now(),streamedOutput:void 0};c[r]=l;let u=[...e];return u[n]={...i,toolCalls:c,contentBlocks:V(i.contentBlocks,l)},u}var Ht=16384;function Ut(e){return e.length<=16384?e:e.slice(e.length-Ht)}function Wt(e,t){if(!t.chunk)return e;let n=-1,r=-1;if(t.toolUseId){if(t.messageId){let i=I(e,t.messageId);if(i>=0){let a=e[i].toolCalls?.findIndex(e=>e.id===t.toolUseId)??-1;a!==-1&&(n=i,r=a)}}if(n===-1)for(let i=e.length-1;i>=0;i--){let a=e[i];if(a?.role!==`assistant`||!a.toolCalls?.length)continue;let o=a.toolCalls.findIndex(e=>e.id===t.toolUseId);if(o!==-1){n=i,r=o;break}}}else{if(n=e.findLastIndex(e=>e.role===`assistant`&&e.toolCalls&&e.toolCalls.length>0),n===-1)return e;let t=e[n];if(!t?.toolCalls)return e;r=t.toolCalls.findLastIndex(e=>p(e))}if(n===-1||r===-1)return e;let i=e[n],a=i.toolCalls[r];if(!a)return e;let o={...a,streamedOutput:Ut((a.streamedOutput??``)+t.chunk)},s=[...i.toolCalls];s[r]=o;let c=[...e];return c[n]={...i,toolCalls:s,contentBlocks:V(i.contentBlocks,o)},c}function Gt(e,t,n,r=Date.now()){let i=-1;if(n&&(i=I(e,n)),i===-1){for(let t=e.length-1;t>=0;t--)if(e[t]?.role===`assistant`){i=t;break}}let a=[...e];if(i===-1)a.push({id:n??crypto.randomUUID(),...n?{}:{isOptimistic:!0},role:`assistant`,surfaces:[t],contentOrder:[{type:`surface`,id:t.surfaceId}],contentBlocks:[{type:`surface`,surface:t}],timestamp:r});else{let r=L(e[i],n);if(r.contentOrder?.some(e=>e.type===`surface`&&e.id===t.surfaceId)||r.surfaces?.some(e=>e.surfaceId===t.surfaceId))return e;a[i]={...r,surfaces:[...r.surfaces??[],t],contentOrder:[...r.contentOrder??[],{type:`surface`,id:t.surfaceId}],contentBlocks:M(r.contentBlocks,t)}}return a}function Kt(e,t,n){for(let r=e.length-1;r>=0;r--){let i=e[r],a=i.surfaces?.findIndex(e=>e.surfaceId===t)??-1;if(a===-1)continue;let o=i.surfaces[a],s={...o.data,...n};o.data.templateData&&n.templateData&&typeof o.data.templateData==`object`&&typeof n.templateData==`object`&&(s.templateData={...o.data.templateData,...n.templateData});let c={...o,data:s},l=[...e],u=[...i.surfaces];return u[a]=c,l[r]={...i,surfaces:u,contentBlocks:M(i.contentBlocks,c)},l}return e}function qt(e,t){for(let n=e.length-1;n>=0;n--){if(!e[n].surfaces?.some(e=>e.surfaceId===t))continue;let r=[...e];return r[n]={...e[n],surfaces:e[n].surfaces?.filter(e=>e.surfaceId!==t),contentOrder:e[n].contentOrder?.filter(e=>!(e.type===`surface`&&e.id===t)),contentBlocks:$e(e[n].contentBlocks,t)},r}return e}function Jt(e,t,n){for(let r=e.length-1;r>=0;r--){let i=e[r].surfaces?.find(e=>e.surfaceId===t);if(!i)continue;let a={...i,completed:!0,completionSummary:n},o=[...e];return o[r]={...e[r],surfaces:e[r].surfaces?.map(e=>e.surfaceId===t?a:e),contentBlocks:M(e[r].contentBlocks,a)},o}return e}var Yt=[`choice`,`oauth_connect`,`form`,`confirmation`,`file_upload`,`card`,`list`,`table`,`browser_view`,`task_preferences`];function Xt(e){return e==null||e.hasPendingConfirmation||e.hasUncompletedVisibleSurface}function Zt(e,t){let n=!1,r=e.map(e=>{let r=re(e,e=>e.pendingConfirmation?.requestId===t?{...e,pendingConfirmation:void 0}:e);return r!==e&&(n=!0),r});return n?r:e}function Qt(e){let t=!1,n=e.map(e=>{let n=re(e,e=>e.pendingConfirmation?{...e,pendingConfirmation:void 0}:e);return n!==e&&(t=!0),n});return t?n:e}function $t(e,t){let n=new Set;for(let e of t)if(e.surfaces)for(let t of e.surfaces)ie(t)&&n.add(t.surfaceId);return n.size===0?{updatedMessages:e,dismissedIds:n}:{updatedMessages:e.map(e=>tt(e,e=>!n.has(e.surfaceId))),dismissedIds:n}}function en(e,t,n,r){for(let i=e.length-1;i>=0;i--){let a=e[i].surfaces?.find(e=>e.surfaceId===t);if(!a)continue;if(!Yt.includes(a.surfaceType))return e;let o=a.actions?.find(e=>e.id===n),s=n===`cancel`||n===`dismiss`||o?.style===`secondary`,c=[...e];return c[i]=et(e[i],e=>e.surfaceId===t?{...e,completed:!0,completionSummary:s?`Cancelled`:r??o?.label??void 0}:e),c}return e}function tn(e,t,n){return e&&ne[e]||t||n}function U(e){return typeof e==`string`?e:void 0}function nn(e){return typeof e==`boolean`?e:void 0}function rn(e){return Array.isArray(e)?e:void 0}function an(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function W(e){return Array.isArray(e)?e:void 0}function on(e){return{requestId:typeof e.requestId==`string`?e.requestId:``,label:U(e.label),service:U(e.service),field:U(e.field),description:U(e.description),placeholder:U(e.placeholder),allowOneTimeSend:nn(e.allowOneTimeSend),allowedTools:rn(e.allowedTools),allowedDomains:rn(e.allowedDomains),purpose:U(e.purpose)}}function sn(e){let t={requestId:typeof e.requestId==`string`?e.requestId:``,title:U(e.title),description:U(e.description),toolName:U(e.toolName),riskLevel:U(e.riskLevel),riskReason:U(e.riskReason),allowlistOptions:W(e.allowlistOptions),scopeOptions:W(e.scopeOptions),directoryScopeOptions:W(e.directoryScopeOptions),persistentDecisionsAllowed:nn(e.persistentDecisionsAllowed),input:an(e.input),toolUseId:U(e.toolUseId)};return{confData:t,state:{...t,confirmLabel:U(e.confirmLabel),denyLabel:U(e.denyLabel)}}}function cn(){return`turn-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function ln(e,t){let n=Date.parse(e);return Number.isFinite(n)?n:typeof t==`number`?t:0}function un(e,t,n){switch(t.type){case`assistant_text_delta`:return Mt(e,t.text,t.messageId,void 0,n);case`assistant_thinking_delta`:return Pt(e,t.thinking,t.messageId,void 0,n);case`message_complete`:return It(e,t,n);case`user_message_echo`:return Rt(e,{text:t.text,messageId:t.messageId,clientMessageId:t.clientMessageId},n);case`assistant_activity_state`:return t.phase===`idle`?Ft(e,n):e;case`conversation_error`:return zt(e,n);case`tool_use_preview_start`:return Bt(e,{id:t.toolUseId,name:t.toolName,input:{},previewStartedAt:typeof t.previewStartedAt==`number`?t.previewStartedAt:n},t.messageId,n);case`tool_use_start`:return Bt(e,{id:t.toolUseId??`tool-${n}`,name:t.toolName,input:t.input,startedAt:`startedAt`in t&&typeof t.startedAt==`number`?t.startedAt:n,...`previewStartedAt`in t&&typeof t.previewStartedAt==`number`?{previewStartedAt:t.previewStartedAt}:{}},t.messageId,n);case`tool_result`:return Vt(e,{toolUseId:t.toolUseId,result:t.result,isError:t.isError,riskLevel:t.riskLevel,riskReason:t.riskReason,matchedTrustRuleId:t.matchedTrustRuleId,approvalMode:t.approvalMode,approvalReason:t.approvalReason,riskThreshold:t.riskThreshold,riskAllowlistOptions:t.riskAllowlistOptions,riskScopeOptions:t.riskScopeOptions,riskDirectoryScopeOptions:t.riskDirectoryScopeOptions,imageData:t.imageData,imageDataList:t.imageDataList,activityMetadata:t.activityMetadata,completedAt:`completedAt`in t&&typeof t.completedAt==`number`?t.completedAt:n});case`tool_output_chunk`:return t.chunk?Wt(e,{chunk:t.chunk,toolUseId:t.toolUseId,messageId:t.messageId}):e;case`ui_surface_show`:{let r={surfaceId:t.surfaceId,surfaceType:t.surfaceType,title:t.title,data:t.data,actions:t.actions,display:t.display};return r.display=d(r),Gt(e,r,t.messageId,n)}case`ui_surface_update`:return Kt(e,t.surfaceId,t.data);case`ui_surface_dismiss`:return qt(e,t.surfaceId);case`ui_surface_complete`:return Jt(e,t.surfaceId,t.summary);case`confirmation_request`:return f(e,{requestId:t.requestId,toolName:t.toolName,riskLevel:t.riskLevel,riskReason:t.riskReason,allowlistOptions:t.allowlistOptions,scopeOptions:t.scopeOptions,directoryScopeOptions:t.directoryScopeOptions,persistentDecisionsAllowed:t.persistentDecisionsAllowed,input:t.input,toolUseId:t.toolUseId}).updatedMessages;case`interaction_resolved`:return t.kind===`confirmation`||t.kind===`acp_confirmation`?Zt(e,t.requestId):e;default:return e}}function dn(e,t,n){if(e!==void 0){if(typeof n!=`number`)return e;switch(t.type){case`assistant_turn_start`:case`assistant_text_delta`:case`assistant_thinking_delta`:return!0;case`assistant_activity_state`:return t.phase!==`idle`;case`message_complete`:return!1;default:return e}}}function fn(e,t){let{seq:n}=t;if(typeof n==`number`&&typeof e.seq==`number`&&n<=e.seq)return e;let r=ln(t.emittedAt,n),i=un(e.messages,t.message,r),a=typeof n==`number`?Math.max(e.seq??-1,n):e.seq??null,o=dn(e.processing,t.message,n);return{...e,messages:i,seq:a,processing:o}}function pn(e,t){return t.reduce(fn,e)}function mn(e,t){return t===null?e:pn(e,t)}function hn(e){return[...new Set([e.id,...e.mergedMessageIds??[]].filter(e=>typeof e==`string`&&e.length>0))]}function G(e){let t=hn(e);return e.clientMessageId&&!t.includes(e.clientMessageId)?[...t,e.clientMessageId]:t}var gn={hasMore:!1,oldestTimestamp:null,isLoadingOlder:!1};function _n(){return{snapshot:null,optimisticSends:[],error:null,notice:null,isLoadingHistory:!0,transcriptPagination:{...gn},contextWindowUsage:null,ephemeralMetaResults:[],compactionCircuitOpenUntil:null,dismissedSurfaceIds:new Set,streamingMessageIds:new Set,pendingQueuedMessageIds:[],requestIdToMessageId:new Map,pendingLocalDeletions:new Set,confirmationToolCallMap:new Map,expandedToolCallIds:new Set,expandedCardIds:new Map,contextWindowUsageByConversation:new Map,previousConversationId:null,previousAssistantId:null,draftConversationIdResolution:!1}}function K(e,t){return typeof t==`function`?t(e):t}function vn(e,t){if(e.length===0)return e;let n=new Map;for(let e of t)for(let t of G(e))n.has(t)||n.set(t,e);let r=e.filter(e=>{let t;for(let r of G(e))if(t=n.get(r),t)break;return t?!!e.attachments?.length&&!t.attachments?.length:!0});return r.length===e.length?e:r}var q=o(a()((e,t)=>({..._n(),seedSnapshot:(n,r)=>{let i=t().snapshot;if(r.seq==null&&i!==null&&typeof i.seq==`number`){c(`history_seed_skipped_anchorless`,{conversationId:n,liveSeq:i.seq});return}let a=be(n,r.seq??null);if(a===null&&i!==null&&typeof i.seq==`number`&&typeof r.seq==`number`&&r.seq<i.seq){c(`history_seed_skipped_stale_anchor`,{conversationId:n,liveSeq:i.seq,fetchedSeq:r.seq});return}let o=mn(r,a);e(e=>({snapshot:o,optimisticSends:vn(e.optimisticSends,o.messages)}))},applyEnvelopeToSnapshot:t=>e(e=>e.snapshot?{snapshot:fn(e.snapshot,t)}:{}),addOptimisticSend:t=>e(e=>({optimisticSends:[...e.optimisticSends,t]})),setOptimisticSends:t=>e(e=>({optimisticSends:K(e.optimisticSends,t)})),patchSnapshotMessages:t=>e(e=>e.snapshot?{snapshot:{...e.snapshot,messages:t(e.snapshot.messages)}}:{}),setError:t=>e(e=>({error:K(e.error,t)})),setNotice:t=>e(e=>({notice:K(e.notice,t)})),setIsLoadingHistory:t=>e({isLoadingHistory:t}),setTranscriptPagination:t=>e(e=>({transcriptPagination:K(e.transcriptPagination,t)})),setContextWindowUsage:t=>e(e=>({contextWindowUsage:K(e.contextWindowUsage,t)})),setCompactionCircuitOpenUntil:t=>e(e=>({compactionCircuitOpenUntil:K(e.compactionCircuitOpenUntil,t)})),switchToConversation:({assistantId:n,activeConversationId:r})=>{let i=t();if(i.draftConversationIdResolution){e({draftConversationIdResolution:!1});return}let a=i.previousConversationId;if(a&&a!==r&&a){let e=P.getState();(e.pendingSecret||e.pendingConfirmation)&&u.getState().addAttentionConversationId(a)}let o=i.previousAssistantId!==null&&i.previousAssistantId!==n,s=o||i.previousAssistantId===null;c(`conversation_switch_reset`,{assistantId:n,conversationId:r,outgoingConversationId:a??null}),j.getState().handleConversationSwitch({previousKey:a??null,nextKey:r}),we.getState().resetTurn(),P.getState().resetAll(),o?j.getState().fullReset():j.getState().resetAttachments();let l=s?ut(n):i.contextWindowUsageByConversation;e({snapshot:null,optimisticSends:[],ephemeralMetaResults:[],error:N(i.error)?i.error:null,notice:null,isLoadingHistory:!0,transcriptPagination:{...gn},contextWindowUsage:l.get(r)??null,compactionCircuitOpenUntil:null,dismissedSurfaceIds:it(n,r),streamingMessageIds:new Set,pendingQueuedMessageIds:[],requestIdToMessageId:new Map,pendingLocalDeletions:new Set,confirmationToolCallMap:new Map,expandedToolCallIds:new Set,expandedCardIds:new Map,contextWindowUsageByConversation:l,previousConversationId:r,previousAssistantId:n,draftConversationIdResolution:!1})},markDraftResolution:()=>e({draftConversationIdResolution:!0}),setConfirmationToolCall:(t,n)=>e(e=>{let r=new Map(e.confirmationToolCallMap);return r.set(t,n),{confirmationToolCallMap:r}}),deleteConfirmationToolCall:t=>e(e=>{let n=new Map(e.confirmationToolCallMap);return n.delete(t),{confirmationToolCallMap:n}}),clearConfirmationToolCallMap:()=>e({confirmationToolCallMap:new Map}),addDismissedSurfaceId:t=>e(e=>{let n=new Set(e.dismissedSurfaceIds);return n.add(t),{dismissedSurfaceIds:n}}),addDismissedSurfaceIds:t=>e(e=>{let n=new Set(e.dismissedSurfaceIds);for(let e of t)n.add(e);return{dismissedSurfaceIds:n}}),batchUpdateStreamingMessageIds:(t,n)=>e(e=>{let r=new Set(e.streamingMessageIds);for(let e of t)r.add(e);for(let e of n)r.delete(e);return{streamingMessageIds:r}}),pushPendingQueuedMessageId:t=>e(e=>({pendingQueuedMessageIds:[...e.pendingQueuedMessageIds,t]})),shiftPendingQueuedMessageId:()=>{let n=t().pendingQueuedMessageIds;if(n.length===0)return;let[r,...i]=n;return e({pendingQueuedMessageIds:i}),r},setRequestIdMapping:(t,n)=>e(e=>{let r=new Map(e.requestIdToMessageId);return r.set(t,n),{requestIdToMessageId:r}}),popRequestIdMapping:n=>{let r=t().requestIdToMessageId,i=r.get(n);if(i!==void 0){let t=new Map(r);t.delete(n),e({requestIdToMessageId:t})}return i},addPendingLocalDeletion:t=>e(e=>{let n=new Set(e.pendingLocalDeletions);return n.add(t),{pendingLocalDeletions:n}}),consumePendingLocalDeletion:n=>{let r=t().pendingLocalDeletions;if(!r.has(n))return!1;let i=new Set(r);return i.delete(n),e({pendingLocalDeletions:i}),!0},setExpandedToolCallId:(t,n)=>e(e=>{let r=new Set(e.expandedToolCallIds);return n?r.add(t):r.delete(t),{expandedToolCallIds:r}}),setExpandedCardId:(t,n)=>e(e=>{let r=new Map(e.expandedCardIds);return r.set(t,n),{expandedCardIds:r}}),setContextWindowUsageForConversation:(t,n)=>e(e=>{let r=new Map(e.contextWindowUsageByConversation);return r.set(t,n),{contextWindowUsageByConversation:r}}),addEphemeralMetaResult:t=>e(e=>({ephemeralMetaResults:[...e.ephemeralMetaResults,t]})),clearEphemeralMetaResults:()=>e(e=>e.ephemeralMetaResults.length===0?e:{ephemeralMetaResults:[]})})));function J(e,t){if(t.length===0)return e;let n=new Map;for(let e of t)for(let t of G(e))n.has(t)||n.set(t,e);let r=[],i=new Set;for(let t of e){let e;for(let r of G(t)){let t=n.get(r);if(t){e=t;break}}if(e){i.has(e)||(r.push(e),i.add(e));continue}r.push(t)}for(let e of t)i.has(e)||r.push(e);return r}function yn(){let e=q.use.snapshot(),t=q.use.optimisticSends(),n=q.use.dismissedSurfaceIds();return(0,le.useMemo)(()=>J(st(e?.messages,n),t),[e,t,n])}function Y(e,t,n=`…`){return e.length<=t?e:e.slice(0,t-n.length)+n}function bn(e){if(!e)return null;let t=e.split(`/`),n=t[t.length-1];return!n||n===`.`?null:n}function X(e,t){return Y(e,t,`...`)}function xn(e){if(!e)return null;let t=e.replace(/\s+/g,` `).trim().match(/(?:^|&&\s*|\|\|\s*|;\s*)(?:\S*\/)?assistant\s+browser\s+([^\s;&|]+)/i);if(!t)return null;let n=t[1].toLowerCase();return new Set([`navigate`,`click`,`type`,`screenshot`,`snapshot`,`scroll`,`hover`,`select`,`drag`,`wait`,`back`,`forward`,`refresh`,`close`,`tab`,`press_key`,`wait_for`,`extract`,`fill_credential`]).has(n)?n:`unknown`}function Z(e,t){let n=e.toLowerCase();return n!==`bash`&&n!==`host_bash`?null:xn(t)}function Sn(e){switch(e){case`navigate`:return`Opened a page`;case`click`:return`Clicked on the page`;case`type`:return`Typed on the page`;case`screenshot`:return`Took a screenshot`;case`snapshot`:return`Captured page snapshot`;case`scroll`:return`Scrolled the page`;case`hover`:return`Hovered on the page`;case`select`:return`Selected on the page`;case`drag`:return`Dragged on the page`;case`wait`:return`Waited for the page`;case`back`:return`Went back`;case`forward`:return`Went forward`;case`refresh`:return`Refreshed the page`;case`close`:return`Closed the tab`;case`tab`:return`Switched tabs`;case`press_key`:return`Pressed a key`;case`wait_for`:return`Waited for a condition`;case`extract`:return`Extracted page content`;case`fill_credential`:return`Filled a credential`;case`unknown`:return`Used the browser`}}function Cn(e){switch(e){case`navigate`:return`Opening a page`;case`click`:return`Clicking on the page`;case`type`:return`Typing on the page`;case`screenshot`:return`Taking a screenshot`;case`snapshot`:return`Capturing page snapshot`;case`scroll`:return`Scrolling the page`;case`hover`:return`Hovering on the page`;case`select`:return`Selecting on the page`;case`drag`:return`Dragging on the page`;case`wait`:return`Waiting for the page`;case`back`:return`Going back`;case`forward`:return`Going forward`;case`refresh`:return`Refreshing the page`;case`close`:return`Closing the tab`;case`tab`:return`Switching tabs`;case`press_key`:return`Pressing a key`;case`wait_for`:return`Waiting for a condition`;case`extract`:return`Extracting page content`;case`fill_credential`:return`Filling a credential`;case`unknown`:return`Using the browser`}}function wn(e){switch(e){case`navigate`:case`back`:case`forward`:case`tab`:return`compass`;case`click`:case`hover`:case`select`:case`drag`:case`scroll`:return`compass`;case`screenshot`:case`snapshot`:return`camera`;case`type`:case`press_key`:case`fill_credential`:return`compass`;case`wait`:case`wait_for`:case`refresh`:case`close`:return`compass`;case`extract`:return`compass`;case`unknown`:return`compass`}}function Tn(e,t){let n=e.toLowerCase();if(n===`bash`||n===`host_bash`){let e=t.command??t.cmd;if(typeof e==`string`)return e.replace(/\s+/g,` `).trim()}if(n===`file_read`||n===`host_file_read`||n===`file_write`||n===`host_file_write`||n===`file_edit`||n===`host_file_edit`){let e=t.file_path??t.path??t.filePath;if(typeof e==`string`)return e}if(n===`grep`||n===`glob`){let e=t.pattern??t.query;if(typeof e==`string`)return e}if(n===`web_search`){let e=t.query??t.search;if(typeof e==`string`)return e}return``}function En(e,t=``){let n=e.toLowerCase(),r=t.replace(/\s+/g,` `).trim(),i=bn(r),a=Z(e,r);if(a)return Sn(a);switch(n){case`bash`:case`host_bash`:return r?`Ran \`${X(r,30)}\``:`Ran a command`;case`file_read`:case`host_file_read`:return i?`Read ${i}`:`Read a file`;case`file_write`:case`host_file_write`:return i?`Wrote ${i}`:`Wrote a file`;case`file_edit`:case`host_file_edit`:return i?`Edited ${i}`:`Edited a file`;case`grep`:return r?`Searched for '${X(r,25)}'`:`Searched files`;case`glob`:return r?`Searched for ${X(r,25)}`:`Found files`;case`web_search`:return r?`Searched '${X(r,25)}'`:`Searched the web`;case`web_fetch`:return`Fetched a webpage`;default:return`Used ${e.replace(/_/g,` `)}`}}function Dn(e,t=``,n){let r=Z(e,t);if(r)return Cn(r);if(n){let t=e.toLowerCase();if(t===`app_create`||t===`app_refresh`||t===`app_update`)return n}switch(e.toLowerCase()){case`bash`:case`host_bash`:return`Running a command`;case`file_read`:case`host_file_read`:return`Reading a file`;case`file_write`:case`host_file_write`:return`Writing a file`;case`file_edit`:case`host_file_edit`:return`Editing a file`;case`grep`:return`Searching files`;case`glob`:return`Finding files`;case`web_search`:return`Searching the web`;case`web_fetch`:return`Fetching a webpage`;case`app_create`:return`Building your app`;case`app_refresh`:case`app_update`:return`Refreshing your app`;default:return`Running ${e.replace(/_/g,` `)}`}}function On(e){return e.split(/[_-]+/).filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)}function kn(e,t=``){let n=Z(e,t);if(n)return wn(n);switch(e.toLowerCase()){case`bash`:case`host_bash`:return`terminal`;case`file_read`:case`host_file_read`:return`file-text`;case`file_write`:case`host_file_write`:return`file-plus`;case`file_edit`:case`host_file_edit`:return`pencil`;case`grep`:case`glob`:case`web_search`:return`search`;case`web_fetch`:return`globe`;default:return`wrench`}}var An=80;function Q(e,...t){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim().length>0)return t}return``}function jn(e){if(!e)return``;let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n===-1?t:t.slice(n+1)}function Mn(e){if(!e.startsWith(`mcp__`))return null;let t=e.slice(5),n=t.indexOf(`__`);if(n===-1)return null;let r=t.slice(0,n),i=t.slice(n+2);return!r||!i?null:{serverName:r,toolMethod:i}}function $(e,t){let n=t&&typeof t==`object`?t:{},r=e.toLowerCase(),i=Q(n,`activity`,`reason`),a=Mn(e);if(a)return{title:`Using ${a.serverName}`,info:a.toolMethod,activity:i,iconName:`plug`};switch(r){case`bash`:case`host_bash`:return{title:`Working`,info:Y(Q(n,`command`,`cmd`).replace(/\s+/g,` `).trim(),An),activity:i,iconName:`terminal`};case`str_replace_editor`:case`text_editor`:{let e=Q(n,`command`).toLowerCase(),t=jn(Q(n,`path`,`file_path`,`filePath`));return e===`view`?{title:`Reading`,info:t,activity:i,iconName:`file`}:{title:`Editing`,info:t,activity:i,iconName:`pen`}}case`computer`:return{title:`Using computer`,info:Q(n,`action`),activity:i,iconName:`monitor`};case`skill_execute`:{let e=Q(n,`tool`);if(e){let t=n.input,r=$(e,t);return{...r,activity:i||r.activity}}return{title:`Using a skill`,info:Q(n,`skill`,`name`,`skillName`),activity:i,iconName:`sparkle`}}case`skill`:case`skill_invoke`:case`skill_load`:return{title:`Using a skill`,info:Q(n,`skill`,`name`,`skillName`),activity:i,iconName:`sparkle`};case`subagent_spawn`:return{title:`Spawning subagent`,info:Q(n,`label`,`objective`,`task`),activity:i,iconName:`user-plus`};default:return{title:e?`Running ${On(e)}`:`Running tool`,info:``,activity:i,iconName:`bolt`}}}function Nn(e){return $(e.name,e.input)}var Pn=[{open:`<thinking>`,close:`</thinking>`},{open:`<think>`,close:`</think>`}];function Fn(e){return Pn.some(t=>e.includes(t.open))}function In(e){if(!Fn(e))return null;let t=[],n=e=>{e.trim()&&t.push({type:`text`,text:e})},r=e=>{let n=e.trim();n&&t.push({type:`thinking`,thinking:n})},i=0;for(;;){let a=-1,o;for(let t of Pn){let n=e.indexOf(t.open,i);n!==-1&&(a===-1||n<a)&&(a=n,o=t)}if(!o)break;n(e.slice(i,a));let s=a+o.open.length,c=e.indexOf(o.close,s);if(c===-1)return r(e.slice(s)),t;r(e.slice(s,c)),i=c+o.close.length}return n(e.slice(i)),t}function Ln(e){return typeof e.id==`string`&&e.id.length>0}function Rn(e){return e.some(e=>e.type===`text`&&Fn(e.text))?e.flatMap(e=>{let t=e.type===`text`?In(e.text):null;return t?t.map(e=>e.type===`thinking`?{type:`thinking`,thinking:e.thinking}:{type:`text`,text:e.text}):[e]}):e}function zn(e,t){let n=t?.splitInlineThinking?Rn(e):e,r=[],i=null,a=()=>(i||(i={type:`activity`,items:[]},r.push(i)),i);for(let e of n)if(e.type===`thinking`){let t=a(),n=t.items[t.items.length-1];n?.type===`thinking`?(n.thinking=n.thinking?`${n.thinking}\n${e.thinking}`:e.thinking,e.startedAt!=null&&(n.startedAt=n.startedAt==null?e.startedAt:Math.min(n.startedAt,e.startedAt)),e.completedAt!=null&&(n.completedAt=n.completedAt==null?e.completedAt:Math.max(n.completedAt,e.completedAt))):t.items.push({type:`thinking`,thinking:e.thinking,startedAt:e.startedAt,completedAt:e.completedAt})}else if(e.type===`tool_use`){if(!Ln(e.toolCall))continue;a().items.push({type:`tool_use`,toolCall:e.toolCall})}else (e.type===`text`||e.type===`surface`)&&(i=null,r.push(e));return r}function Bn(e){let t=[],n=[];for(let r of e){if(r.type===`thinking`){r.thinking&&t.push({kind:`thinking`,text:r.thinking,startedAt:r.startedAt,completedAt:r.completedAt});continue}let e=r.toolCall;Vn(e)||(n.push(e),t.push({kind:`toolCall`,toolCall:e}))}return{cardItems:t,toolCalls:n}}function Vn(e){return!e.pendingConfirmation&&(e.name===`ui_show`||e.name===`ui_update`||e.name===`ui_dismiss`)}function Hn(e){if(e.name===`subagent_spawn`)return!0;if(e.name!==`skill_execute`)return!1;let t=e.input;return typeof t!=`object`||!t?!1:t.tool===`subagent_spawn`}function Un(e){if(e.name===`run_workflow`)return!0;if(e.name!==`skill_execute`)return!1;let t=e.input;return typeof t!=`object`||!t?!1:t.tool===`run_workflow`}function Wn(e){if(e.name===`acp_spawn`)return!0;if(e.name!==`skill_execute`)return!1;let t=e.input;return typeof t!=`object`||!t?!1:t.tool===`acp_spawn`}function Gn(e){if(e.name!==`bash`&&e.name!==`host_bash`)return!1;let t=e.input;return typeof t!=`object`||!t?!1:t.background===!0}var Kn=new Set([`low`,`medium`,`high`]);function qn(e){let t=e?.toLowerCase();return t&&Kn.has(t)?t:`medium`}function Jn(e){switch(e?.toLowerCase()){case`low`:return{bg:`bg-[var(--system-positive-strong)]`,text:`text-white`,label:`Low`};case`medium`:return{bg:`bg-[var(--system-mid-strong)]`,text:`text-black`,label:`Medium`};case`high`:return{bg:`bg-[var(--system-negative-strong)]`,text:`text-white`,label:`High`};case`workspace`:return{bg:`bg-[var(--surface-lift)]`,text:`text-[var(--content-secondary)]`,border:`border border-[var(--border-element)]`,label:`Workspace`};default:return{bg:`bg-[var(--content-secondary)]`,text:`text-white`,label:e??`Unknown`}}}function Yn(e){switch(e?.toLowerCase()){case`low`:return`Auto-approved at Conservative tolerance or higher`;case`medium`:return`Auto-approved at Relaxed tolerance or higher`;case`high`:return`Auto-approved only at Full Access tolerance`;default:return}}function Xn(e){switch(e?.toLowerCase()){case`low`:return{bg:`bg-[var(--system-positive-weak)]`,text:`text-[var(--system-positive-strong)]`,label:`Low`};case`medium`:return{bg:`bg-[var(--system-mid-weak)]`,text:`text-[var(--system-mid-strong)]`,label:`Medium`};case`high`:return{bg:`bg-[var(--system-negative-weak)]`,text:`text-[var(--system-negative-strong)]`,label:`High`};case`workspace`:return{bg:`bg-[var(--surface-lift)]`,text:`text-[var(--content-secondary)]`,label:`Workspace`};default:return{bg:`bg-[var(--surface-lift)]`,text:`text-[var(--content-secondary)]`,label:e?e.charAt(0).toUpperCase()+e.slice(1):`Unknown`}}}var Zn={unknown:2,low:0,medium:1,high:2},Qn={none:-1,low:0,medium:1,high:2};function $n(e,t,n){return e?.toLowerCase()!==`auto`||!n?!0:(Zn[(t??``).toLowerCase()]??-1)<=(Qn[n.toLowerCase()]??-1)}function er(e){switch(e){case`trust_rule_allowed`:return`· Auto-approved · Trust rule matched`;case`sandbox_auto_approve`:return null;case`platform_auto_approve`:return`· Auto-approved · Platform session`;default:return null}}function tr(e,t){return e===`sandbox_auto_approve`?{displayLevel:`workspace`,inherentRisk:t}:{displayLevel:t??`unknown`}}export{Je as $,$t as A,F as B,J as C,Zt as D,G as E,Xt as F,bt as G,P as H,Ot as I,at as J,N as K,Et as L,sn as M,on as N,Qt as O,tn as P,Ye as Q,kt as R,yn as S,hn as T,yt as U,wt as V,xt as W,Qe as X,et as Y,Xe as Z,Dn as _,Yn as a,ve as at,On as b,Bn as c,pe as ct,Gn as d,fe as dt,j as et,Un as f,ce as ft,Tn as g,$ as h,ae as ht,Xn as i,xe as it,cn as j,en as k,zn as l,he as lt,Nn as m,oe as mt,er as n,Ce as nt,qn as o,ye as ot,Hn as p,se as pt,dt as q,Jn as r,we as rt,$n as s,_e as st,tr as t,v as tt,Wn as u,me as ut,kn as v,q as w,Y as x,En as y,Dt as z};
@@ -0,0 +1 @@
1
+ import{t as e}from"./is-electron-y5bNUVyG.js";var t=e=>e,n=(e,t)=>`${e}/${t}`,r=t(`/assistant/logs/usage`),i=`message`,a={assistant:t(`/assistant`),about:t(`/assistant/about`),bundleConfirm:t(`/assistant/bundle/confirm`),remotePair:t(`/assistant/pair`),credentialEntry:t(`/assistant/credentials/enter`),quickInput:t(`/assistant/quick-input`),conversations:t(`/assistant/conversations`),conversation:e=>n(t(`/assistant/conversations`),e),conversationAtMessage:(e,r)=>`${n(t(`/assistant/conversations`),e)}?${i}=${encodeURIComponent(r)}`,conversationWithPrompt:(e,r,i)=>{let a=`${n(t(`/assistant/conversations`),e)}?prompt=${encodeURIComponent(r)}`;return i?`${a}&relay=${encodeURIComponent(i)}`:a},inspect:e=>`${n(t(`/assistant/conversations`),e)}/inspect`,logs:{root:t(`/assistant/logs`),usage:r,usageForSchedule:e=>`${r}?${new URLSearchParams({range:`7d`,groupBy:`schedule`,scheduleId:e}).toString()}`,emails:t(`/assistant/logs/emails`),systemEvents:t(`/assistant/logs/system-events`)},account:{root:t(`/account`),login:t(`/account/login`),signup:t(`/account/signup`),providerSignup:t(`/account/provider/signup`),providerCallback:t(`/account/provider/callback`),oauth:{popupComplete:t(`/account/oauth/popup-complete`),complete:t(`/account/oauth/complete`),desktopComplete:t(`/account/oauth/desktop-complete`)}},welcome:t(`/assistant/welcome`),selectAssistant:t(`/assistant/select-assistant`),reviewTerms:t(`/assistant/review-terms`),onboarding:{hosting:t(`/assistant/onboarding/hosting`),apiKey:t(`/assistant/onboarding/api-key`),privacy:t(`/assistant/onboarding/privacy`),prechat:t(`/assistant/onboarding/prechat`),hatching:t(`/assistant/onboarding/hatching`),research:t(`/assistant/onboarding/research`)},home:t(`/assistant/home`),schedules:{root:t(`/assistant/schedules`),detail:e=>n(t(`/assistant/schedules`),e)},identity:t(`/assistant/identity`),memory:t(`/assistant/memory`),plugins:t(`/assistant/plugins`),skills:{root:t(`/assistant/skills`),detail:e=>n(t(`/assistant/skills`),encodeURIComponent(e))},workspace:t(`/assistant/workspace`),library:{root:t(`/assistant/library`),app:e=>n(t(`/assistant/library`),e)},document:e=>n(t(`/assistant/documents`),e),connect:t(`/assistant/connect`),channels:t(`/assistant/channels`),contacts:{root:t(`/assistant/contacts`)},settings:{root:t(`/assistant/settings`),general:t(`/assistant/settings/general`),ai:t(`/assistant/settings/ai`),integrations:t(`/assistant/settings/integrations`),credentials:t(`/assistant/settings/credentials`),notifications:t(`/assistant/settings/notifications`),keyboardShortcuts:t(`/assistant/settings/keyboard-shortcuts`),sounds:t(`/assistant/settings/sounds`),voice:t(`/assistant/settings/voice`),devices:t(`/assistant/settings/devices`),privacy:t(`/assistant/settings/privacy`),security:t(`/assistant/settings/security`),archive:t(`/assistant/settings/archive`),bookmarks:t(`/assistant/settings/bookmarks`),billing:t(`/assistant/settings/billing`),community:t(`/assistant/settings/community`),debug:t(`/assistant/settings/debug`),developer:t(`/assistant/settings/developer`),mcp:t(`/assistant/settings/mcp`),advanced:t(`/assistant/settings/advanced`),dangerZone:t(`/assistant/settings/danger-zone`),systemEvents:t(`/assistant/settings/system-events`),upgradeCancel:t(`/assistant/settings/billing/upgrade/cancel`),upgradeSuccess:t(`/assistant/settings/billing/upgrade/success`)},admin:{root:t(`/admin`)},docs:{hostingOptions:t(`/docs/hosting-options`),legal:{privacyPolicy:t(`/docs/privacy-policy`),termsOfUse:t(`/docs/vellum-terms-of-use`),dataSharing:t(`/docs/data-sharing`),prohibitedUse:t(`/docs/prohibited-use`),privacyAndData:t(`/docs/trust-security/privacy-and-data`)}}},o=[a.identity,a.memory,a.plugins,a.skills.root,a.workspace,a.contacts.root,a.channels];function s(e){return o.some(t=>e===t||e.startsWith(`${t}/`))}function c(e){return e===a.assistant||e===`${a.assistant}/`||e.startsWith(`${a.conversations}/`)}function l(e){if(e===a.assistant||e===`${a.assistant}/`)return!0;let t=`${a.conversations}/`;if(!e.startsWith(t))return!1;let n=e.slice(t.length).replace(/\/+$/,``);return n.length>0&&!n.includes(`/`)}var u=`vellum.ai`;function d(e){return f(e)}function f(e){return`https://${u}${e}`}function p(){return e()?`${window.__VELLUM_CONFIG__?.webUrl??window.location.origin}${a.admin.root}`:a.admin.root}export{l as a,a as c,s as i,p as n,c as o,f as r,d as s,i as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./client.gen-DVfIRXUZ.js";var t=t=>(t?.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/`,...t}),n=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/backups/`,...t}),r=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/backups/`,...t}),i=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/backups/{snapshot_name}/restore/`,...t}),a=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/doctor/history/`,...t}),o=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/doctor/history/{doctor_session_id}/`,...t}),s=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/doctor/sessions/`,...t}),c=t=>(t.client??e).delete({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/doctor/sessions/{session_id}/`,...t}),l=t=>(t.client??e).sse.get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/doctor/sessions/{session_id}/events/`,...t}),u=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/doctor/sessions/{session_id}/messages/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),d=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/doctor/sessions/{session_id}/user-outcome/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),f=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{name:`Authorization`,type:`apiKey`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/domains/`,...t}),p=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{name:`Authorization`,type:`apiKey`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/domains/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),m=t=>(t.client??e).delete({security:[{scheme:`bearer`,type:`http`},{name:`Authorization`,type:`apiKey`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/domains/{id}/`,...t}),h=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{name:`Authorization`,type:`apiKey`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/domains/{id}/verification-status/`,...t}),g=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{name:`Authorization`,type:`apiKey`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/email-addresses/`,...t}),_=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{name:`Authorization`,type:`apiKey`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/email-addresses/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),v=t=>(t.client??e).delete({security:[{scheme:`bearer`,type:`http`},{name:`Authorization`,type:`apiKey`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/email-addresses/{id}/`,...t}),y=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{name:`Authorization`,type:`apiKey`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/email-addresses/{id}/status/`,...t}),b=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{name:`Authorization`,type:`apiKey`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/emails/`,...t}),x=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/handle-available/`,...t}),S=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/maintenance-mode/enter/`,...t}),C=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/maintenance-mode/exit/`,...t}),w=t=>(t.client??e).post({security:[{name:`Authorization`,type:`apiKey`},{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/oauth/{provider}/start/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),T=t=>(t.client??e).get({security:[{name:`Authorization`,type:`apiKey`},{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/oauth/connections/`,...t}),E=t=>(t.client??e).post({security:[{name:`Authorization`,type:`apiKey`},{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/oauth/connections/{connection_id}/disconnect/`,...t}),D=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/push-tokens/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),O=t=>(t.client??e).delete({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/push-tokens/{token}/`,...t}),k=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/release-channel/`,...t}),A=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/release-channel/preview/opt-in/`,...t}),j=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/release-channel/preview/opt-out/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),M=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/system-events/`,...t}),N=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/terminal/sessions/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),P=t=>(t.client??e).delete({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/terminal/sessions/{session_id}/`,...t}),F=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/terminal/sessions/{session_id}/input/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),I=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/assistants/{assistant_id}/terminal/sessions/{session_id}/resize/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),L=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/{id}/`,...t}),R=t=>(t.client??e).patch({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/{id}/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),z=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/{id}/operational/status/`,...t}),B=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/{id}/resize/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),V=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/{id}/restart/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),H=t=>(t.client??e).delete({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/{id}/retire/`,...t}),U=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/{id}/rollback/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),W=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/{id}/sleep-policy/`,...t}),G=t=>(t.client??e).patch({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/{id}/sleep-policy/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),K=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/{id}/upgrade/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),q=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/{id}/upgrade-policy/`,...t}),J=t=>(t.client??e).patch({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/{id}/upgrade-policy/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),Y=t=>(t?.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/access-consent/`,...t}),X=t=>(t?.client??e).patch({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/access-consent/`,...t,headers:{"Content-Type":`application/json`,...t?.headers}}),ee=t=>(t?.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/active/`,...t}),Z=t=>(t?.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/assistants/hatch/`,...t,headers:{"Content-Type":`application/json`,...t?.headers}}),Q=t=>(t.client??e).post({security:[{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/auth/live-voice-token/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),$=t=>(t?.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/feature-flags/client-flag-values/`,...t}),te=t=>(t.client??e).post({security:[{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/feedback/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),ne=t=>(t?.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/`,...t}),re=t=>(t?.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/auto-top-up/`,...t}),ie=t=>(t.client??e).put({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/auto-top-up/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),ae=t=>(t?.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/auto-top-up/disable/`,...t}),oe=t=>(t?.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/auto-top-up/remove-payment-method/`,...t}),se=t=>(t?.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/auto-top-up/setup-intent/`,...t}),ce=t=>(t?.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/invoices/`,...t}),le=t=>(t?.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/invoices/download/`,...t}),ue=t=>(t?.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/low-balance-alert/`,...t}),de=t=>(t.client??e).put({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/low-balance-alert/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),fe=t=>(t?.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/plans/`,...t}),pe=t=>(t?.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/portal-session/`,...t}),me=t=>(t?.client??e).get({security:[{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/subscription/`,...t}),he=t=>(t.client??e).post({security:[{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/subscription/change-credit-tier/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),ge=t=>(t.client??e).post({security:[{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/subscription/change-machine-tier/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),_e=t=>(t.client??e).post({security:[{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/subscription/change-storage-tier/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),ve=t=>(t?.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/subscription/onboarding/`,...t}),ye=t=>(t?.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/subscription/onboarding/domain/`,...t,headers:{"Content-Type":`application/json`,...t?.headers}}),be=t=>(t.client??e).post({security:[{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/subscription/upgrade/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),xe=t=>(t?.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/organizations/billing/summary/`,...t}),Se=t=>(t?.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/summary/`,...t}),Ce=t=>(t?.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/top-ups/checkout-session/`,...t,headers:{"Content-Type":`application/json`,...t?.headers}}),we=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/usage/series/`,...t}),Te=t=>(t.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/billing/usage/totals/`,...t}),Ee=t=>(t?.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/notifications/`,...t}),De=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/notifications/{id}/acknowledge/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),Oe=t=>(t.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/notifications/{id}/snooze/`,...t,headers:{"Content-Type":`application/json`,...t.headers}}),ke=t=>(t?.client??e).post({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/notifications/pause-rules/`,...t,headers:{"Content-Type":`application/json`,...t?.headers}}),Ae=t=>(t.client??e).delete({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/organizations/notifications/pause-rules/{rule_id}/`,...t}),je=t=>(t?.client??e).get({security:[{scheme:`bearer`,type:`http`},{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/referral-codes/me/`,...t}),Me=t=>(t?.client??e).get({security:[{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`},{name:`Authorization`,type:`apiKey`}],url:`/v1/releases/`,...t}),Ne=t=>(t?.client??e).post({security:[{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/user/deletion-request/`,...t}),Pe=t=>(t?.client??e).get({security:[{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/user/mfa/factors/`,...t}),Fe=t=>(t?.client??e).post({security:[{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/user/mfa/factors/`,...t}),Ie=t=>(t.client??e).delete({security:[{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/user/mfa/factors/{id}/`,...t}),Le=t=>(t.client??e).post({security:[{in:`cookie`,name:`sessionid`,type:`apiKey`},{name:`X-Session-Token`,type:`apiKey`}],url:`/v1/user/mfa/factors/verify/`,...t,headers:{"Content-Type":`application/json`,...t.headers}});export{Q as $,w as A,Oe as At,H as B,x as C,we as Ct,C as D,Ee as Dt,S as E,De as Et,A as F,Ie as Ft,M as G,U as H,j as I,Pe as It,F as J,N as K,k as L,Le as Lt,R as M,Me as Mt,O as N,Ne as Nt,T as O,ke as Ot,D as P,Fe as Pt,q as Q,B as R,b as S,Ce as St,t as T,ne as Tt,G as U,L as V,W,K as X,I as Y,J as Z,h as _,ve as _t,i as a,se as at,g as b,Se as bt,o as c,ce as ct,l as d,fe as dt,$ as et,u as f,pe as ft,f as g,ye as gt,m as h,_e as ht,r as i,re as it,z as j,je as jt,E as k,Ae as kt,s as l,ue as lt,p as m,ge as mt,Y as n,ae as nt,n as o,ie as ot,d as p,he as pt,P as q,ee as r,oe as rt,a as s,le as st,X as t,te as tt,c as u,de as ut,_ as v,me as vt,Z as w,Te as wt,y as x,xe as xt,v as y,be as yt,V as z};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-amTXFI-2.js";import{r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as i}from"./QueryClientProvider-DKhXIxGb.js";import{t as a}from"./useQuery-B45lW1Kk.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./copy-Cn1FKrEp.js";import{t as c}from"./loader-circle-Cz7opInR.js";import{t as l}from"./notice-DkcNAP8O.js";import{t as u}from"./input-CoUmPnRU.js";import{t as d}from"./modal-D5nLWNN9.js";import{n as f}from"./toast-xTp-xwYL.js";import{t as p}from"./confirm-dialog-CSkhRFRk.js";import{Pt as m}from"./sdk.gen-CmKfVpgB.js";import{c as h}from"./routes-DYcJgn9k.js";import{t as g}from"./client-feature-flag-store-Bm7cFUky.js";import{At as _,Mt as v,Nt as y,jt as b,kt as x}from"./react-query.gen-GVQbBTEp.js";import{D as S,Gr as C,Ti as w}from"./index-CkKSY1-Q.js";import{t as T}from"./detail-card-GPqFZVmX.js";var E=e(t(),1);function D(e){if(typeof e==`object`&&e&&`code`in e){let t=e.code;if(typeof t==`string`)return t}}var O=o();function k({open:e,onOpenChange:t}){let r=i(),[a,o]=(0,E.useState)(null),[l,p]=(0,E.useState)(``),[h,g]=(0,E.useState)(null),_=(0,E.useRef)(!1),v=(0,E.useRef)(e),S=()=>r.invalidateQueries({queryKey:y()}),C=e=>{m({path:{id:e}}).catch(()=>void 0).finally(()=>void S())},w=x({onSuccess:e=>{if(!v.current){C(e.factor_id);return}o(e)},onError:e=>{let n=D(e);n===`no_workos_account`?f.error(`Two-factor authentication is only available for Vellum platform accounts.`):n===`throttled`||n===`workos_rate_limited`?f.error(`Too many attempts. Try again in a minute.`):n===`factor_limit_reached`?f.error(`An authenticator app is already set up. Remove it before adding another.`):f.error(`Failed to start setup. Please try again.`),t(!1)}}),T=b({onSuccess:e=>{e.valid?(_.current=!0,f.success(`Two-factor authentication is on.`),S(),t(!1)):g(`That code didn't match. Check your authenticator app and try again.`)},onError:e=>{let n=D(e);if(n===`challenge_already_verified`){_.current=!0,f.success(`Two-factor authentication is on.`),S(),t(!1);return}if(n===`challenge_expired`||n===`challenge_not_found`){a&&C(a.factor_id),o(null),p(``),g(`This setup session expired. Scan the new QR code and try again.`),w.mutate({});return}if(n===`throttled`||n===`workos_rate_limited`){g(`Too many attempts. Wait a minute and try again.`);return}g(`Couldn't verify the code. Wait a moment and try again.`)}});(0,E.useEffect)(()=>{v.current=e,e&&(_.current=!1,o(null),p(``),g(null),w.mutate({}))},[e]);let k=e=>{!e&&T.isPending||(!e&&a&&!_.current&&C(a.factor_id),t(e))},A=()=>{a&&navigator.clipboard.writeText(a.secret).then(()=>f.success(`Setup key copied.`)).catch(()=>f.error(`Couldn't copy the setup key.`))},j=()=>{!a||l.length!==6||T.isPending||(g(null),T.mutate({body:{challenge_id:a.challenge_id,code:l}}))};return(0,O.jsx)(d.Root,{open:e,onOpenChange:k,children:(0,O.jsxs)(d.Content,{size:`sm`,children:[(0,O.jsxs)(d.Header,{children:[(0,O.jsx)(d.Title,{children:`Set up authenticator app`}),(0,O.jsx)(d.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,O.jsx)(d.Body,{children:a===null?(0,O.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,O.jsx)(c,{className:`h-5 w-5 animate-spin text-[var(--content-tertiary)]`})}):(0,O.jsxs)(`form`,{className:`flex flex-col items-center gap-4`,onSubmit:e=>{e.preventDefault(),j()},children:[(0,O.jsx)(`img`,{src:a.qr_code,alt:`QR code for your authenticator app`,className:`h-44 w-44 rounded-lg bg-white p-2`}),(0,O.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,O.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Can't scan it? Enter this setup key manually:`}),(0,O.jsxs)(`button`,{type:`button`,onClick:A,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,O.jsx)(`span`,{className:`break-all text-left`,children:a.secret}),(0,O.jsx)(s,{className:`h-3.5 w-3.5 shrink-0`})]})]}),(0,O.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,O.jsx)(`label`,{htmlFor:`totp-code`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:`6-digit code`}),(0,O.jsx)(u,{id:`totp-code`,inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:6,placeholder:`123456`,value:l,onChange:e=>p(e.target.value.replace(/\D/g,``).slice(0,6))}),h&&(0,O.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--system-negative-strong)]`,children:h})]})]})}),(0,O.jsxs)(d.Footer,{children:[(0,O.jsx)(n,{variant:`outlined`,onClick:()=>k(!1),disabled:T.isPending,children:`Cancel`}),(0,O.jsx)(n,{onClick:j,disabled:a===null||l.length!==6||T.isPending,children:T.isPending?`Verifying…`:`Verify`})]})]})})}function A(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function j(){let e=i(),[t,r]=(0,E.useState)(!1),[o,s]=(0,E.useState)(null),u=a({...v()}),d=u.data??[],m=()=>e.invalidateQueries({queryKey:y()}),h=_({onSuccess:()=>{f.success(`Authenticator app removed.`),m()},onError:e=>{if(D(e)===`factor_not_found`){m();return}f.error(`Failed to remove the authenticator app. Please try again.`)}});return(0,O.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u.isPending?(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:[(0,O.jsx)(c,{className:`h-4 w-4 animate-spin`}),(0,O.jsx)(`span`,{className:`text-body-medium-default`,children:`Loading authenticator apps…`})]}):u.isError?(0,O.jsxs)(l,{tone:`error`,children:[`Couldn't load your authenticator apps.`,` `,(0,O.jsx)(`button`,{type:`button`,className:`cursor-pointer underline`,onClick:()=>void u.refetch(),children:`Try again`})]}):d.length===0?(0,O.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,O.jsx)(`ul`,{className:`flex flex-col divide-y divide-[var(--border-base)]`,children:d.map(e=>(0,O.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-3`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,O.jsx)(w,{className:`h-5 w-5 shrink-0 text-[var(--content-tertiary)]`}),(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Authenticator app`}),(0,O.jsxs)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:[e.user,e.created_at?` · Added ${A(e.created_at)}`:``]})]})]}),(0,O.jsx)(n,{variant:`dangerOutline`,onClick:()=>s(e),disabled:h.isPending,children:`Remove`})]},e.id))}),!u.isPending&&!u.isError&&d.length===0&&(0,O.jsx)(n,{onClick:()=>r(!0),className:`self-start`,children:`Add authenticator app`}),(0,O.jsx)(k,{open:t,onOpenChange:r}),(0,O.jsx)(p,{open:o!==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:()=>{o&&h.mutate({path:{id:o.id}}),s(null)},onCancel:()=>s(null)})]})}function M(){let e=g.use.accountMfa(),t=g.use.hydrated(),n=C();return t&&!e?(0,O.jsx)(r,{replace:!0,to:h.settings.general}):!e||n===`gated`?null:(0,O.jsx)(`div`,{className:`space-y-4`,children:(0,O.jsx)(T,{title:`Two-Factor Authentication`,subtitle:`Require a code from an authenticator app when you sign in.`,children:n===`disabled`?(0,O.jsx)(S,{children:`Log in to the Vellum platform to manage two-factor authentication.`}):(0,O.jsx)(j,{})})})}export{M as SecurityPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-amTXFI-2.js";import{r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as i}from"./QueryClientProvider-DKhXIxGb.js";import{t as a}from"./useQuery-B45lW1Kk.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./copy-Cn1FKrEp.js";import{t as c}from"./loader-circle-Cz7opInR.js";import{t as l}from"./notice-DkcNAP8O.js";import{t as u}from"./input-CoUmPnRU.js";import{t as d}from"./modal-D5nLWNN9.js";import{n as f}from"./toast-xTp-xwYL.js";import{t as p}from"./confirm-dialog-CSkhRFRk.js";import{Ft as m}from"./sdk.gen-9Cdt87h5.js";import{c as h}from"./routes-BXlWEOF0.js";import{t as g}from"./client-feature-flag-store-Ri-a_LuI.js";import{At as _,Mt as v,Nt as y,jt as b,kt as x}from"./react-query.gen-DV9K_z-o.js";import{D as S,Gr as C,Ti as w}from"./index-B4Qq7TL7.js";import{t as T}from"./detail-card-GPqFZVmX.js";var E=e(t(),1);function D(e){if(typeof e==`object`&&e&&`code`in e){let t=e.code;if(typeof t==`string`)return t}}var O=o();function k({open:e,onOpenChange:t}){let r=i(),[a,o]=(0,E.useState)(null),[l,p]=(0,E.useState)(``),[h,g]=(0,E.useState)(null),_=(0,E.useRef)(!1),v=(0,E.useRef)(e),S=()=>r.invalidateQueries({queryKey:y()}),C=e=>{m({path:{id:e}}).catch(()=>void 0).finally(()=>void S())},w=x({onSuccess:e=>{if(!v.current){C(e.factor_id);return}o(e)},onError:e=>{let n=D(e);n===`no_workos_account`?f.error(`Two-factor authentication is only available for Vellum platform accounts.`):n===`throttled`||n===`workos_rate_limited`?f.error(`Too many attempts. Try again in a minute.`):n===`factor_limit_reached`?f.error(`An authenticator app is already set up. Remove it before adding another.`):f.error(`Failed to start setup. Please try again.`),t(!1)}}),T=b({onSuccess:e=>{e.valid?(_.current=!0,f.success(`Two-factor authentication is on.`),S(),t(!1)):g(`That code didn't match. Check your authenticator app and try again.`)},onError:e=>{let n=D(e);if(n===`challenge_already_verified`){_.current=!0,f.success(`Two-factor authentication is on.`),S(),t(!1);return}if(n===`challenge_expired`||n===`challenge_not_found`){a&&C(a.factor_id),o(null),p(``),g(`This setup session expired. Scan the new QR code and try again.`),w.mutate({});return}if(n===`throttled`||n===`workos_rate_limited`){g(`Too many attempts. Wait a minute and try again.`);return}g(`Couldn't verify the code. Wait a moment and try again.`)}});(0,E.useEffect)(()=>{v.current=e,e&&(_.current=!1,o(null),p(``),g(null),w.mutate({}))},[e]);let k=e=>{!e&&T.isPending||(!e&&a&&!_.current&&C(a.factor_id),t(e))},A=()=>{a&&navigator.clipboard.writeText(a.secret).then(()=>f.success(`Setup key copied.`)).catch(()=>f.error(`Couldn't copy the setup key.`))},j=()=>{!a||l.length!==6||T.isPending||(g(null),T.mutate({body:{challenge_id:a.challenge_id,code:l}}))};return(0,O.jsx)(d.Root,{open:e,onOpenChange:k,children:(0,O.jsxs)(d.Content,{size:`sm`,children:[(0,O.jsxs)(d.Header,{children:[(0,O.jsx)(d.Title,{children:`Set up authenticator app`}),(0,O.jsx)(d.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,O.jsx)(d.Body,{children:a===null?(0,O.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,O.jsx)(c,{className:`h-5 w-5 animate-spin text-[var(--content-tertiary)]`})}):(0,O.jsxs)(`form`,{className:`flex flex-col items-center gap-4`,onSubmit:e=>{e.preventDefault(),j()},children:[(0,O.jsx)(`img`,{src:a.qr_code,alt:`QR code for your authenticator app`,className:`h-44 w-44 rounded-lg bg-white p-2`}),(0,O.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,O.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Can't scan it? Enter this setup key manually:`}),(0,O.jsxs)(`button`,{type:`button`,onClick:A,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,O.jsx)(`span`,{className:`break-all text-left`,children:a.secret}),(0,O.jsx)(s,{className:`h-3.5 w-3.5 shrink-0`})]})]}),(0,O.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,O.jsx)(`label`,{htmlFor:`totp-code`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:`6-digit code`}),(0,O.jsx)(u,{id:`totp-code`,inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:6,placeholder:`123456`,value:l,onChange:e=>p(e.target.value.replace(/\D/g,``).slice(0,6))}),h&&(0,O.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--system-negative-strong)]`,children:h})]})]})}),(0,O.jsxs)(d.Footer,{children:[(0,O.jsx)(n,{variant:`outlined`,onClick:()=>k(!1),disabled:T.isPending,children:`Cancel`}),(0,O.jsx)(n,{onClick:j,disabled:a===null||l.length!==6||T.isPending,children:T.isPending?`Verifying…`:`Verify`})]})]})})}function A(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function j(){let e=i(),[t,r]=(0,E.useState)(!1),[o,s]=(0,E.useState)(null),u=a({...v()}),d=u.data??[],m=()=>e.invalidateQueries({queryKey:y()}),h=_({onSuccess:()=>{f.success(`Authenticator app removed.`),m()},onError:e=>{if(D(e)===`factor_not_found`){m();return}f.error(`Failed to remove the authenticator app. Please try again.`)}});return(0,O.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u.isPending?(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:[(0,O.jsx)(c,{className:`h-4 w-4 animate-spin`}),(0,O.jsx)(`span`,{className:`text-body-medium-default`,children:`Loading authenticator apps…`})]}):u.isError?(0,O.jsxs)(l,{tone:`error`,children:[`Couldn't load your authenticator apps.`,` `,(0,O.jsx)(`button`,{type:`button`,className:`cursor-pointer underline`,onClick:()=>void u.refetch(),children:`Try again`})]}):d.length===0?(0,O.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,O.jsx)(`ul`,{className:`flex flex-col divide-y divide-[var(--border-base)]`,children:d.map(e=>(0,O.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-3`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,O.jsx)(w,{className:`h-5 w-5 shrink-0 text-[var(--content-tertiary)]`}),(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Authenticator app`}),(0,O.jsxs)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:[e.user,e.created_at?` · Added ${A(e.created_at)}`:``]})]})]}),(0,O.jsx)(n,{variant:`dangerOutline`,onClick:()=>s(e),disabled:h.isPending,children:`Remove`})]},e.id))}),!u.isPending&&!u.isError&&d.length===0&&(0,O.jsx)(n,{onClick:()=>r(!0),className:`self-start`,children:`Add authenticator app`}),(0,O.jsx)(k,{open:t,onOpenChange:r}),(0,O.jsx)(p,{open:o!==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:()=>{o&&h.mutate({path:{id:o.id}}),s(null)},onCancel:()=>s(null)})]})}function M(){let e=g.use.accountMfa(),t=g.use.hydrated(),n=C();return t&&!e?(0,O.jsx)(r,{replace:!0,to:h.settings.general}):!e||n===`gated`?null:(0,O.jsx)(`div`,{className:`space-y-4`,children:(0,O.jsx)(T,{title:`Two-Factor Authentication`,subtitle:`Require a code from an authenticator app when you sign in.`,children:n===`disabled`?(0,O.jsx)(S,{children:`Log in to the Vellum platform to manage two-factor authentication.`}):(0,O.jsx)(j,{})})})}export{M as SecurityPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-amTXFI-2.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./check-DFNrQERi.js";import{t as s}from"./modal-D5nLWNN9.js";import{t as c}from"./confirm-dialog-CSkhRFRk.js";import{A as l,F as u,M as d,d as f,lt as ee,rt as te,t as ne}from"./local-mode-Bskd5bsT.js";import{t as p}from"./is-electron-y5bNUVyG.js";import{n as m}from"./resolved-assistants-store-DAzPZ1eV.js";import{D as h,O as g,i as _,n as v}from"./auth-store-B8a9KLUt.js";import{c as y}from"./routes-DYcJgn9k.js";import{t as b}from"./use-onboarding-login-CymKDO-T.js";import{Fn as x,Pn as S,ga as C,na as w,on as T}from"./index-CkKSY1-Q.js";import{r as E}from"./format-date-cTplgJ8P.js";var D=e(t(),1),O=a();function k({open:e,assistantName:t,isPending:r,errorMessage:i,onCancel:a,onRepair:o,onRetire:l}){let[u,d]=(0,D.useState)(`menu`);(0,D.useEffect)(()=>{e&&d(`menu`)},[e]);let f=i?(0,O.jsx)(`span`,{className:`mt-3 block text-body-small-default text-[var(--system-negative-strong)]`,children:i}):null;return u===`confirm-repair`?(0,O.jsx)(c,{open:e,title:`Repair Assistant?`,message:(0,O.jsxs)(O.Fragment,{children:[`Repairing re-provisions this assistant’s authentication token. Any other devices or browser sessions connected to it will be signed out and need to reconnect.`,f]}),confirmLabel:`Repair`,isPending:r,onConfirm:o,onCancel:()=>d(`menu`)}):u===`confirm-retire`?(0,O.jsx)(S,{open:e,isPending:r,extraMessage:f,onConfirm:l,onCancel:()=>d(`menu`)}):(0,O.jsx)(s.Root,{open:e,onOpenChange:e=>{!e&&!r&&a()},children:(0,O.jsxs)(s.Content,{size:`sm`,hideCloseButton:!0,onEscapeKeyDown:e=>{e.preventDefault(),e.stopPropagation(),r||a()},children:[(0,O.jsx)(s.Header,{children:(0,O.jsx)(s.Title,{children:`Can’t Authenticate Assistant`})}),(0,O.jsxs)(s.Body,{children:[(0,O.jsxs)(s.Description,{children:[`The authentication token for `,t,` is missing or can no longer be refreshed, so this assistant can’t be connected. You can repair it, retire it, or pick a different assistant.`]}),f,(0,O.jsxs)(`div`,{className:`mt-5 flex w-full flex-col gap-2`,children:[(0,O.jsx)(n,{variant:`primary`,fullWidth:!0,disabled:r,onClick:()=>d(`confirm-repair`),children:`Wake & Repair`}),(0,O.jsx)(n,{variant:`dangerOutline`,fullWidth:!0,disabled:r,onClick:()=>d(`confirm-retire`),children:`Retire Assistant`}),(0,O.jsx)(n,{variant:`outlined`,fullWidth:!0,disabled:r,onClick:a,children:`Cancel`})]})]})]})})}function A(e){return e.name?e.name:e.isLocal?`Local Assistant`:`Cloud Assistant`}function j(e){if(e.hatchedAt)return`Created ${E(e.hatchedAt)}`}function M(){let e=r(),[t]=i(),a=t.get(`fromLogin`)===`1`,o=t.get(`noAutoSkip`)===`1`,s=p(),c=_(),S=m.use.assistants(),C=h.use.currentOrganizationId(),{loading:w,error:E,login:j,cancel:M}=b(),P=e=>e.isLocal||c,F=S.filter(P),I=S.some(e=>e.isPlatformHosted)&&!c,[L,R]=(0,D.useState)(null),[z,B]=(0,D.useState)(!1),[V,H]=(0,D.useState)(!1),[U,W]=(0,D.useState)(null),[G,K]=(0,D.useState)(null),[q,J]=(0,D.useState)(!1),[Y,X]=(0,D.useState)(null);(0,D.useEffect)(()=>{if(L!=null||F.length===0)return;let e=g(C);R(F.find(t=>t.id===e)?.id??F[0].id)},[L,F,C]);let Z=async t=>{B(!0),W(null);try{t.isLocal?await v.getState().connectLocalAssistant(t.id):await v.getState().connectPlatformAssistant(t.id),e(y.assistant,{replace:!0})}catch(e){console.error(`selectAssistant.handleConnect failed`,e),t.isLocal&&l()&&(d(e)||ee(e)||e instanceof ne)&&f(t.id)?K(t):W(`Failed to connect. Please try again.`),B(!1)}},Q=()=>{K(null),J(!1),X(null),H(!1)},re=async()=>{if(!(!G||q)){J(!0),X(null);try{let e=await u(G.id,{repairGuardian:!0});if(e.ok){te(),Q(),Z(G);return}X(e.error||`Repair failed. Please try again.`)}catch(e){console.error(`selectAssistant.recoveryRepair failed`,e),X(`Repair failed. Please try again.`)}J(!1)}},ie=async()=>{if(!(!G||q)){J(!0),X(null);try{let t=await x(G.id);if(t.ok){Q(),e(t.nextRoute,{replace:!0});return}X(t.error)}catch(e){console.error(`selectAssistant.recoveryRetire failed`,e),X(`Failed to retire assistant. Please try again.`)}J(!1)}};(0,D.useEffect)(()=>{a||o||z||V||S.length!==0&&S.length===1&&F.length===1&&(H(!0),Z(F[0]))},[S.length,F.length]);let ae=()=>{let e=S.find(e=>e.id===L);e&&Z(e)},oe=()=>{e(y.welcome)},$=E??U;return V&&!$&&!G?(0,O.jsx)(T,{children:(0,O.jsx)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-xl flex-col items-center justify-center px-6 text-[var(--content-default)]`,children:(0,O.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Connecting to your assistant…`})})}):(0,O.jsxs)(T,{children:[(0,O.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${s?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`min-h-screen px-6 pb-40 pt-16`} text-[var(--content-default)]`,children:[(0,O.jsx)(`h1`,{className:s?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Choose an Assistant`}),(0,O.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)] ${s?`mt-3.5`:`mt-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Select which assistant you’d like to use.`}),$&&(0,O.jsx)(`p`,{className:`mt-4 text-body-small-default text-[var(--system-negative-strong)]`,children:$}),(0,O.jsx)(`div`,{className:`flex w-full flex-col ${s?`mt-8 gap-2`:`mt-10 gap-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:S.map(e=>{let t=P(e);return(0,O.jsx)(N,{assistant:e,selected:L===e.id,disabled:!t,badge:!t&&e.isPlatformHosted?`Requires Account`:void 0,onSelect:()=>{t&&R(e.id)}},e.id)})}),(0,O.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${s?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[F.length>0&&(0,O.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:ae,disabled:!L||z,children:z?`Connecting…`:`Continue`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:()=>void e(`${y.onboarding.hosting}?from=select-assistant`),disabled:z||w,children:`Create New Assistant`}),I&&(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:w?M:()=>void j(),disabled:z,children:w?`Cancel`:`Log In`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:oe,disabled:z||w,children:`Back`})]})]}),(0,O.jsx)(k,{open:G!=null,assistantName:G?A(G):``,isPending:q,errorMessage:Y??void 0,onCancel:Q,onRepair:()=>void re(),onRetire:()=>void ie()})]})}function N({assistant:e,selected:t,disabled:n,badge:r,onSelect:i}){let a=j(e),s=p();return(0,O.jsxs)(`button`,{type:`button`,onClick:i,disabled:n,className:[`group flex w-full items-center border text-left`,s?`gap-3 rounded-lg p-3`:`gap-4 rounded-2xl px-5 py-4`,`transition-all duration-200 ease-out`,n?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-[var(--surface-secondary)]`,t&&!n?`border-[var(--primary-base)] bg-[var(--primary-base)]/[0.08] shadow-[inset_0_0_0_1px_var(--primary-base)]`:`border-[var(--border-element)] bg-transparent`].join(` `),children:[(0,O.jsx)(`div`,{className:[`flex shrink-0 items-center justify-center transition-colors duration-200`,s?`h-8 w-8 rounded-lg`:`h-10 w-10 rounded-xl`,t&&!n?`bg-[var(--primary-base)]/15 text-[var(--primary-base)]`:`bg-[var(--surface-tertiary)] text-[var(--content-secondary)]`].join(` `),children:e.isLocal?(0,O.jsx)(w,{className:`h-5 w-5`}):(0,O.jsx)(C,{className:`h-5 w-5`})}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:A(e)}),r&&(0,O.jsx)(`span`,{className:`rounded-full bg-[var(--surface-tertiary)] px-2 py-0.5 text-[var(--content-tertiary)] ${s?`text-label-medium-default`:`text-body-small-default`}`,children:r})]}),a&&(0,O.jsx)(`span`,{className:`mt-0.5 block text-[var(--content-tertiary)] ${s?`text-label-medium-default`:`text-body-small-default`}`,children:a})]}),!n&&(0,O.jsx)(`div`,{className:[`flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 transition-all duration-200`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)] group-hover:border-[var(--content-tertiary)]`].join(` `),children:t&&(0,O.jsx)(o,{className:`h-3 w-3 text-[var(--surface-base)]`,strokeWidth:3})})]})}export{M as SelectAssistantScreen};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-amTXFI-2.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./check-DFNrQERi.js";import{t as s}from"./modal-D5nLWNN9.js";import{t as c}from"./confirm-dialog-CSkhRFRk.js";import{A as l,F as u,M as d,d as f,lt as ee,rt as te,t as ne}from"./local-mode-Bskd5bsT.js";import{t as p}from"./is-electron-y5bNUVyG.js";import{n as m}from"./resolved-assistants-store-DAzPZ1eV.js";import{D as h,O as g,i as _,n as v}from"./auth-store-65JKPW7C.js";import{c as y}from"./routes-BXlWEOF0.js";import{t as b}from"./use-onboarding-login-BHrngniO.js";import{Fn as x,Pn as S,ga as C,na as w,on as T}from"./index-B4Qq7TL7.js";import{r as E}from"./format-date-cTplgJ8P.js";var D=e(t(),1),O=a();function k({open:e,assistantName:t,isPending:r,errorMessage:i,onCancel:a,onRepair:o,onRetire:l}){let[u,d]=(0,D.useState)(`menu`);(0,D.useEffect)(()=>{e&&d(`menu`)},[e]);let f=i?(0,O.jsx)(`span`,{className:`mt-3 block text-body-small-default text-[var(--system-negative-strong)]`,children:i}):null;return u===`confirm-repair`?(0,O.jsx)(c,{open:e,title:`Repair Assistant?`,message:(0,O.jsxs)(O.Fragment,{children:[`Repairing re-provisions this assistant’s authentication token. Any other devices or browser sessions connected to it will be signed out and need to reconnect.`,f]}),confirmLabel:`Repair`,isPending:r,onConfirm:o,onCancel:()=>d(`menu`)}):u===`confirm-retire`?(0,O.jsx)(S,{open:e,isPending:r,extraMessage:f,onConfirm:l,onCancel:()=>d(`menu`)}):(0,O.jsx)(s.Root,{open:e,onOpenChange:e=>{!e&&!r&&a()},children:(0,O.jsxs)(s.Content,{size:`sm`,hideCloseButton:!0,onEscapeKeyDown:e=>{e.preventDefault(),e.stopPropagation(),r||a()},children:[(0,O.jsx)(s.Header,{children:(0,O.jsx)(s.Title,{children:`Can’t Authenticate Assistant`})}),(0,O.jsxs)(s.Body,{children:[(0,O.jsxs)(s.Description,{children:[`The authentication token for `,t,` is missing or can no longer be refreshed, so this assistant can’t be connected. You can repair it, retire it, or pick a different assistant.`]}),f,(0,O.jsxs)(`div`,{className:`mt-5 flex w-full flex-col gap-2`,children:[(0,O.jsx)(n,{variant:`primary`,fullWidth:!0,disabled:r,onClick:()=>d(`confirm-repair`),children:`Wake & Repair`}),(0,O.jsx)(n,{variant:`dangerOutline`,fullWidth:!0,disabled:r,onClick:()=>d(`confirm-retire`),children:`Retire Assistant`}),(0,O.jsx)(n,{variant:`outlined`,fullWidth:!0,disabled:r,onClick:a,children:`Cancel`})]})]})]})})}function A(e){return e.name?e.name:e.isLocal?`Local Assistant`:`Cloud Assistant`}function j(e){if(e.hatchedAt)return`Created ${E(e.hatchedAt)}`}function M(){let e=r(),[t]=i(),a=t.get(`fromLogin`)===`1`,o=t.get(`noAutoSkip`)===`1`,s=p(),c=_(),S=m.use.assistants(),C=h.use.currentOrganizationId(),{loading:w,error:E,login:j,cancel:M}=b(),P=e=>e.isLocal||c,F=S.filter(P),I=S.some(e=>e.isPlatformHosted)&&!c,[L,R]=(0,D.useState)(null),[z,B]=(0,D.useState)(!1),[V,H]=(0,D.useState)(!1),[U,W]=(0,D.useState)(null),[G,K]=(0,D.useState)(null),[q,J]=(0,D.useState)(!1),[Y,X]=(0,D.useState)(null);(0,D.useEffect)(()=>{if(L!=null||F.length===0)return;let e=g(C);R(F.find(t=>t.id===e)?.id??F[0].id)},[L,F,C]);let Z=async t=>{B(!0),W(null);try{t.isLocal?await v.getState().connectLocalAssistant(t.id):await v.getState().connectPlatformAssistant(t.id),e(y.assistant,{replace:!0})}catch(e){console.error(`selectAssistant.handleConnect failed`,e),t.isLocal&&l()&&(d(e)||ee(e)||e instanceof ne)&&f(t.id)?K(t):W(`Failed to connect. Please try again.`),B(!1)}},Q=()=>{K(null),J(!1),X(null),H(!1)},re=async()=>{if(!(!G||q)){J(!0),X(null);try{let e=await u(G.id,{repairGuardian:!0});if(e.ok){te(),Q(),Z(G);return}X(e.error||`Repair failed. Please try again.`)}catch(e){console.error(`selectAssistant.recoveryRepair failed`,e),X(`Repair failed. Please try again.`)}J(!1)}},ie=async()=>{if(!(!G||q)){J(!0),X(null);try{let t=await x(G.id);if(t.ok){Q(),e(t.nextRoute,{replace:!0});return}X(t.error)}catch(e){console.error(`selectAssistant.recoveryRetire failed`,e),X(`Failed to retire assistant. Please try again.`)}J(!1)}};(0,D.useEffect)(()=>{a||o||z||V||S.length!==0&&S.length===1&&F.length===1&&(H(!0),Z(F[0]))},[S.length,F.length]);let ae=()=>{let e=S.find(e=>e.id===L);e&&Z(e)},oe=()=>{e(y.welcome)},$=E??U;return V&&!$&&!G?(0,O.jsx)(T,{children:(0,O.jsx)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-xl flex-col items-center justify-center px-6 text-[var(--content-default)]`,children:(0,O.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Connecting to your assistant…`})})}):(0,O.jsxs)(T,{children:[(0,O.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${s?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`min-h-screen px-6 pb-40 pt-16`} text-[var(--content-default)]`,children:[(0,O.jsx)(`h1`,{className:s?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Choose an Assistant`}),(0,O.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)] ${s?`mt-3.5`:`mt-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Select which assistant you’d like to use.`}),$&&(0,O.jsx)(`p`,{className:`mt-4 text-body-small-default text-[var(--system-negative-strong)]`,children:$}),(0,O.jsx)(`div`,{className:`flex w-full flex-col ${s?`mt-8 gap-2`:`mt-10 gap-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:S.map(e=>{let t=P(e);return(0,O.jsx)(N,{assistant:e,selected:L===e.id,disabled:!t,badge:!t&&e.isPlatformHosted?`Requires Account`:void 0,onSelect:()=>{t&&R(e.id)}},e.id)})}),(0,O.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${s?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[F.length>0&&(0,O.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:ae,disabled:!L||z,children:z?`Connecting…`:`Continue`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:()=>void e(`${y.onboarding.hosting}?from=select-assistant`),disabled:z||w,children:`Create New Assistant`}),I&&(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:w?M:()=>void j(),disabled:z,children:w?`Cancel`:`Log In`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:oe,disabled:z||w,children:`Back`})]})]}),(0,O.jsx)(k,{open:G!=null,assistantName:G?A(G):``,isPending:q,errorMessage:Y??void 0,onCancel:Q,onRepair:()=>void re(),onRetire:()=>void ie()})]})}function N({assistant:e,selected:t,disabled:n,badge:r,onSelect:i}){let a=j(e),s=p();return(0,O.jsxs)(`button`,{type:`button`,onClick:i,disabled:n,className:[`group flex w-full items-center border text-left`,s?`gap-3 rounded-lg p-3`:`gap-4 rounded-2xl px-5 py-4`,`transition-all duration-200 ease-out`,n?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-[var(--surface-secondary)]`,t&&!n?`border-[var(--primary-base)] bg-[var(--primary-base)]/[0.08] shadow-[inset_0_0_0_1px_var(--primary-base)]`:`border-[var(--border-element)] bg-transparent`].join(` `),children:[(0,O.jsx)(`div`,{className:[`flex shrink-0 items-center justify-center transition-colors duration-200`,s?`h-8 w-8 rounded-lg`:`h-10 w-10 rounded-xl`,t&&!n?`bg-[var(--primary-base)]/15 text-[var(--primary-base)]`:`bg-[var(--surface-tertiary)] text-[var(--content-secondary)]`].join(` `),children:e.isLocal?(0,O.jsx)(w,{className:`h-5 w-5`}):(0,O.jsx)(C,{className:`h-5 w-5`})}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:A(e)}),r&&(0,O.jsx)(`span`,{className:`rounded-full bg-[var(--surface-tertiary)] px-2 py-0.5 text-[var(--content-tertiary)] ${s?`text-label-medium-default`:`text-body-small-default`}`,children:r})]}),a&&(0,O.jsx)(`span`,{className:`mt-0.5 block text-[var(--content-tertiary)] ${s?`text-label-medium-default`:`text-body-small-default`}`,children:a})]}),!n&&(0,O.jsx)(`div`,{className:[`flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 transition-all duration-200`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)] group-hover:border-[var(--content-tertiary)]`].join(` `),children:t&&(0,O.jsx)(o,{className:`h-3 w-3 text-[var(--surface-base)]`,strokeWidth:3})})]})}export{M as SelectAssistantScreen};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,i as r,u as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./log-in--aqELu3z.js";import{t as s}from"./is-electron-y5bNUVyG.js";import{i as c}from"./auth-store-B8a9KLUt.js";import{c as l}from"./routes-DYcJgn9k.js";import{t as u}from"./client-feature-flag-store-Bm7cFUky.js";import{t as d}from"./use-onboarding-login-CymKDO-T.js";import{t as f}from"./assistant-feature-flag-store-4edQKaeq.js";import{Gr as p,Nt as m,Yi as h,yr as g}from"./index-CkKSY1-Q.js";import{n as _,t as v}from"./sidebar-tree-DXcgyQSp.js";var y=e(t(),1),b=a();function x(){let e=f.use.settingsDeveloperNav(),t=f.use.credentialsSettings(),a=u.use.platformNotifications(),x=u.use.bookmarks(),S=u.use.accountMfa(),C=p({platformHostedOnly:!0}),w=p(),{pathname:T}=i(),E=n(),D=c(),{login:O}=d(),k=(0,y.useMemo)(()=>m.filter(e=>!(e.id===`notifications`&&(!a||C===`gated`)||e.id===`billing`&&w!==`full`||e.id===`security`&&(!S||w===`gated`)||e.id===`bookmarks`&&!x||e.id===`credentials`&&!t||e.id===`devices`&&C===`gated`||e.id===`keyboard-shortcuts`&&!s()||e.id===`developer`)),[a,C,w,x,S,t]),A=(0,y.useMemo)(()=>{let t=[];return e&&t.push(...m.filter(e=>e.id===`developer`)),t.push(D?{id:`logout`,label:`Log Out`,icon:h,onSelect:()=>void g(E)}:{id:`login`,label:`Log In`,icon:o,onSelect:()=>void O()}),t},[e,D,E,O]),j=(0,y.useMemo)(()=>{if(T===l.settings.root)return`Settings`;let e=m.find(e=>T===e.href||T.startsWith(e.href+`/`));return e?e.label:`Settings`},[T]);return(0,b.jsx)(_,{backHref:l.assistant,sidebar:(0,b.jsx)(v,{items:k,bottomItems:A,indexPath:l.settings.root}),title:j,children:(0,b.jsx)(r,{})})}export{x as SettingsLayout};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,i as r,u as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./log-in--aqELu3z.js";import{t as s}from"./is-electron-y5bNUVyG.js";import{i as c}from"./auth-store-65JKPW7C.js";import{c as l}from"./routes-BXlWEOF0.js";import{t as u}from"./client-feature-flag-store-Ri-a_LuI.js";import{t as d}from"./use-onboarding-login-BHrngniO.js";import{t as f}from"./assistant-feature-flag-store-BA3GR2m5.js";import{Gr as p,Nt as m,Yi as h,yr as g}from"./index-B4Qq7TL7.js";import{n as _,t as v}from"./sidebar-tree-DWJkYLPh.js";var y=e(t(),1),b=a();function x(){let e=f.use.settingsDeveloperNav(),t=f.use.credentialsSettings(),a=u.use.platformNotifications(),x=u.use.bookmarks(),S=u.use.accountMfa(),C=p({platformHostedOnly:!0}),w=p(),{pathname:T}=i(),E=n(),D=c(),{login:O}=d(),k=(0,y.useMemo)(()=>m.filter(e=>!(e.id===`notifications`&&(!a||C===`gated`)||e.id===`billing`&&w!==`full`||e.id===`security`&&(!S||w===`gated`)||e.id===`bookmarks`&&!x||e.id===`credentials`&&!t||e.id===`devices`&&C===`gated`||e.id===`keyboard-shortcuts`&&!s()||e.id===`developer`)),[a,C,w,x,S,t]),A=(0,y.useMemo)(()=>{let t=[];return e&&t.push(...m.filter(e=>e.id===`developer`)),t.push(D?{id:`logout`,label:`Log Out`,icon:h,onSelect:()=>void g(E)}:{id:`login`,label:`Log In`,icon:o,onSelect:()=>void O()}),t},[e,D,E,O]),j=(0,y.useMemo)(()=>{if(T===l.settings.root)return`Settings`;let e=m.find(e=>T===e.href||T.startsWith(e.href+`/`));return e?e.label:`Settings`},[T]);return(0,b.jsx)(_,{backHref:l.assistant,sidebar:(0,b.jsx)(v,{items:k,bottomItems:A,indexPath:l.settings.root}),title:j,children:(0,b.jsx)(r,{})})}export{x as SettingsLayout};
@@ -1 +1 @@
1
- import{o as e,r as t}from"./chunk-jRWAZmH_.js";import{t as n}from"./react-DJZBPgpf.js";import{F as r,n as i,t as a}from"./button-amTXFI-2.js";import{t as o}from"./useMutation-Lj4VunQV.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./bug-BsuQ5ciQ.js";import{t as l}from"./download-CAuK-nZ6.js";import{t as u}from"./info-DsOyuMO9.js";import{t as d}from"./loader-circle-Cz7opInR.js";import{t as f}from"./x-CkSVp1Ok.js";import{t as p}from"./notice-DkcNAP8O.js";import{n as ee,t as m}from"./input-CoUmPnRU.js";import{t as h}from"./toggle-CDfguvUz.js";import{t as g}from"./dropdown-ByHOpeOU.js";import{t as _}from"./is-electron-y5bNUVyG.js";import{an as v}from"./sdk.gen-CFgJ4K6f.js";import{t as y}from"./impersonate-version-flag-BhxfH6iZ.js";import{n as te}from"./auth-store-B8a9KLUt.js";import{t as b}from"./dist-RkT480s0.js";import{n as x}from"./diagnostics-BjIFTbZd.js";import{L as S}from"./react-query.gen-GVQbBTEp.js";import{Ai as ne,Ji as re,Ki as C,Vi as ie,ea as w}from"./index-CkKSY1-Q.js";var T=e(n(),1),ae=e(r(),1),E=`vellum:debug:`;function oe(){let e={};if(typeof window>`u`)return e;try{for(let t=0;t<window.localStorage.length;t++){let n=window.localStorage.key(t);if(n===null||!n.startsWith(E))continue;let r=window.localStorage.getItem(n);r!==null&&(e[n]=r)}}catch{}return e}function D(){return{collectedAt:new Date().toISOString(),resolved:{impersonateAssistantVersion:y()},overrides:oe()}}var O=t({ShareFeedbackModal:()=>z}),k=s(),A=[{value:`bug_report`,label:`Bug Report`,icon:c,includesLogsByDefault:!0},{value:`feature_request`,label:`Feature Request`,icon:w,includesLogsByDefault:!1},{value:`other`,label:`Other`,icon:C,includesLogsByDefault:!1}],j=[{value:`past_hour`,label:`Past hour`,cutoffMs:3600*1e3},{value:`past_24_hours`,label:`Past 24 hours`,cutoffMs:1440*60*1e3},{value:`all_time`,label:`All time`,cutoffMs:null}],se=j.map(e=>({value:e.value,label:e.label})),M=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`video/mp4`,`video/quicktime`,`video/webm`]),N=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`mp4`,`mov`,`webm`]),P=10,F=50*1024*1024,ce={bug_report:`bug_report`,feature_request:`feature_request`,other:`other`};function le(){return _()?`electron`:b.getPlatform()===`ios`?`ios`:`web`}function ue(e){if(e.size>F)return!1;if(e.type&&M.has(e.type))return!0;if(!e.type){let t=e.name.split(`.`).pop()?.toLowerCase();return t?N.has(t):!1}return!1}function I(e,t){let n=Math.ceil(t.length/512),r=new Uint8Array(512+n*512),i=new TextEncoder,a=(e,t,n)=>{let a=i.encode(e);r.set(a.slice(0,n),t)},o=(e,t,n)=>{a(e.toString(8).padStart(n-1,`0`)+`\0`,t,n)};a(e,0,100),o(420,100,8),o(0,108,8),o(0,116,8),o(t.length,124,12),o(Math.floor(Date.now()/1e3),136,12);for(let e=148;e<156;e++)r[e]=32;r[156]=48,a(`ustar\0`,257,6),a(`00`,263,2);let s=0;for(let e=0;e<512;e++)s+=r[e];return o(s,148,7),r[155]=32,r.set(t,512),r}async function L(e,t){try{let n={};t.window.startTime!=null&&(n.startTime=t.window.startTime,n.endTime=t.window.endTime),t.activeConversationId&&(n.conversationId=t.activeConversationId);let{data:r,error:i}=await v({path:{assistant_id:e},body:n,parseAs:`blob`,throwOnError:!1});if(i||!(r instanceof Blob))return null;let a=await r.arrayBuffer();return new Uint8Array(a)}catch{return null}}async function R(e,t,n,r={}){if(typeof CompressionStream>`u`)return null;let{diagnosticsProvider:i,doctorSessionId:a,extraLogFiles:o=[]}=r,s=new Date,c=j.find(t=>t.value===e),l=s.getTime(),u=c?.cutoffMs==null?null:l-c.cutoffMs,d=u==null?null:new Date(u).toISOString(),f=null;try{f=i?.()??null}catch{f=null}let p=x(f),ee={collected_at:s.toISOString(),time_range:e,cutoff:d,log_window:{start_time_ms:u,end_time_ms:l},assistant_id:t,active_conversation_id:n,doctor_session_id:a??null,user_agent:typeof navigator<`u`?navigator.userAgent:``,language:typeof navigator<`u`?navigator.language:``,platform:typeof navigator<`u`?navigator.platform:``,url:typeof window<`u`?window.location.href:``,viewport:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:null,screen:typeof screen<`u`?{width:screen.width,height:screen.height}:null,connection:typeof navigator<`u`&&`connection`in navigator?{effectiveType:navigator.connection.effectiveType,downlink:navigator.connection.downlink,rtt:navigator.connection.rtt}:null,deviceMemory:typeof navigator<`u`&&`deviceMemory`in navigator?navigator.deviceMemory:null,hardwareConcurrency:typeof navigator<`u`?navigator.hardwareConcurrency:null},m=new TextEncoder,h=m.encode(JSON.stringify(ee,null,2)),g=m.encode(JSON.stringify(p,null,2)),v=[I(`web-client-context.json`,h),I(`web-chat-diagnostics.json`,g)],y=new TextEncoder().encode(JSON.stringify(D(),null,2));v.push(I(`web-debug-flags.json`,y));for(let e of o){let t=e.contents.trim();t&&v.push(I(e.filename,m.encode(t)))}try{let e=typeof window<`u`?window._vellumDebug?.chat:null;if(e){let t={clientMessages:e.getClientMessages?.()??null,transcriptItems:e.getTranscriptItems?.()??null,pendingInteractions:e.listPendingInteractions?.()??null,thinkingIndicator:e.thinkingIndicator?.()??null,streamingRing:e.streamingRing?.()??null,reconciliationDiagnostics:e.getReconciliationDiagnostics?.()??null},n=new TextEncoder().encode(JSON.stringify(t,null,2));v.push(I(`web-chat-debug-api-triage.json`,n))}}catch{}try{let e=typeof window<`u`?window._vellumDebug?.events:null;if(e){let t={focus:typeof document<`u`?{hasFocus:typeof document.hasFocus==`function`?document.hasFocus():null,visibilityState:document.visibilityState}:null,clients:e.getClients().map(({abortSignal:e,...t})=>({...t,aborted:e.aborted})),events:e.getEvents()},n=new TextEncoder().encode(JSON.stringify(t,null,2));v.push(I(`web-sse-liveness-triage.json`,n))}}catch{}if(_()&&window.vellum?.feedback){try{let e=await window.vellum.feedback.diagnostics(),t=new TextEncoder().encode(JSON.stringify(e,null,2));v.push(I(`electron-diagnostics.json`,t))}catch{}try{let e=await window.vellum.feedback.logs();if(e){let t=new TextEncoder().encode(e);v.push(I(`electron-main-logs.txt`,t))}}catch{}}if(t){let e=await L(t,{window:{startTime:u,endTime:l},activeConversationId:n});e&&v.push(I(`platform-logs.tar.gz`,e))}v.push(new Uint8Array(1024));let te=v.reduce((e,t)=>e+t.length,0),b=new Uint8Array(te),S=0;for(let e of v)b.set(e,S),S+=e.length;let ne=new Blob([b.buffer]),re=await new Response(ne.stream().pipeThrough(new CompressionStream(`gzip`))).blob();return new File([re],`web-client-logs-${s.getTime()}.tar.gz`,{type:`application/gzip`})}function z({open:e,onClose:t,initialReason:n,initialMessage:r,onSubmitted:s,assistantId:c,assistantVersion:v,activeConversationId:y,doctorSessionId:b,doctorSessionLog:x,getDiagnosticsSnapshot:C}){let w=te.use.user(),E=w?.email,oe=w?.isStaff??!1,D=(0,T.useId)(),O=(0,T.useRef)(null),j=(0,T.useRef)(null),M=(0,T.useRef)(null),N=(0,T.useRef)(null),[F,I]=(0,T.useState)(n??`bug_report`),[L,z]=(0,T.useState)(``),[B,pe]=(0,T.useState)(``),[V,H]=(0,T.useState)(A.find(e=>e.value===(n??`bug_report`))?.includesLogsByDefault??!0),[me,he]=(0,T.useState)(!1),[U,W]=(0,T.useState)(`past_hour`),[G,K]=(0,T.useState)([]),[ge,q]=(0,T.useState)(null),[_e,J]=(0,T.useState)(!1),[Y,ve]=(0,T.useState)(!1),[X,ye]=(0,T.useState)(!1),Z=o(S()),[be,Q]=(0,T.useState)(!1),$=Z.isPending||be,xe=!E,Se=(0,T.useMemo)(()=>L.trim().length>0&&B.trim().length>0,[L,B]);(0,T.useEffect)(()=>{if(!e)return;let t=n??`bug_report`;I(t),z(r??``),pe(E??``),H(A.find(e=>e.value===t)?.includesLogsByDefault??!0),he(!1),W(`past_hour`),K([]),ve(!1),ye(!1),q(null),Q(!1),Z.reset();let i=setTimeout(()=>{E?M.current?.focus():N.current?.focus()},50);return()=>clearTimeout(i)},[e]),(0,T.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e]);let Ce=e=>{I(e),me||H(A.find(t=>t.value===e)?.includesLogsByDefault??!1)},we=()=>{H(e=>!e),he(!0)},Te=x?.trim()?[{filename:`doctor-session.txt`,contents:x}]:[],Ee=(0,T.useCallback)(e=>{e.key===`Escape`&&!$&&t()},[t,$]),De=(0,T.useCallback)(e=>{e.target===O.current&&!$&&t()},[t,$]),Oe=(0,T.useCallback)(e=>{K(t=>{let n=P-t.length;if(n<=0)return t;let r=new Set(t.map(e=>`${e.name}:${e.size}`)),i=[];for(let t of e){if(i.length>=n)break;if(!ue(t))continue;let e=`${t.name}:${t.size}`;r.has(e)||(r.add(e),i.push(t))}return i.length>0?[...t,...i]:t})},[]),ke=e=>{e.target.files&&Oe(Array.from(e.target.files)),e.target.value=``},Ae=e=>{e.preventDefault(),J(!1),e.dataTransfer.files?.length&&Oe(Array.from(e.dataTransfer.files))},je=e=>{e.preventDefault(),J(!0)},Me=e=>{e.preventDefault(),e.currentTarget===e.target&&J(!1)},Ne=e=>{K(t=>t.filter((t,n)=>n!==e))};return e?(0,ae.createPortal)((0,k.jsx)(`div`,{ref:O,role:`dialog`,"aria-modal":`true`,"aria-labelledby":D,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:Ee,onClick:De,onDrop:Ae,onDragOver:je,onDragLeave:Me,children:(0,k.jsxs)(`div`,{className:`mx-4 flex w-full max-w-lg flex-col rounded-xl border p-6 shadow-xl`,style:{backgroundColor:`var(--surface-lift)`,borderColor:`var(--border-base)`,maxHeight:`calc(100vh - 2rem)`},children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-4`,style:{borderColor:`var(--border-subtle)`},children:[(0,k.jsx)(`h2`,{id:D,className:`!m-0 text-title-small text-[var(--content-default)]`,children:`Share Feedback`}),(0,k.jsx)(a,{variant:`ghost`,iconOnly:(0,k.jsx)(f,{}),onClick:t,disabled:$,"aria-label":`Close`,tintColor:`var(--content-secondary)`})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-3.5 overflow-y-auto pt-4 ${$?`pointer-events-none opacity-60`:``}`,children:[oe&&(0,k.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-2.5`,children:[(0,k.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3`,children:[(0,k.jsx)(h,{checked:X,onChange:()=>ye(e=>!e),"aria-label":`Download diagnostics directly`}),(0,k.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Download diagnostics directly`})]}),(0,k.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Admin only — builds the diagnostics archive locally and downloads it instead of submitting feedback or notifying Slack.`})]}),X?(0,k.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,k.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Time range`}),(0,k.jsx)(g,{options:se,value:U,onChange:W,"aria-label":`Diagnostics time range`})]}):(0,k.jsxs)(k.Fragment,{children:[xe&&(0,k.jsx)(m,{id:`${D}-email`,ref:N,label:`Email`,type:`email`,placeholder:`you@example.com`,value:B,onChange:e=>pe(e.target.value),leftIcon:(0,k.jsx)(re,{className:`h-4 w-4`,"aria-hidden":!0}),fullWidth:!0}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,k.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Category`}),(0,k.jsx)(`div`,{className:`flex gap-2`,children:A.map(e=>(0,k.jsx)(de,{option:e,isSelected:F===e.value,onSelect:()=>Ce(e.value)},e.value))})]}),(0,k.jsx)(`hr`,{className:`border-[var(--border-subtle)]`}),F===`bug_report`&&(0,k.jsxs)(p,{tone:`info`,children:[`Tip: Get faster support by posting in our`,` `,(0,k.jsx)(`a`,{href:`https://vellum.ai/community`,target:`_blank`,rel:`noopener noreferrer`,className:`underline text-[var(--content-default)]`,children:`Discord community`})]}),F===`feature_request`&&(0,k.jsxs)(p,{tone:`info`,children:[`Tip: Vote on features on our`,` `,(0,k.jsx)(`a`,{href:`https://vellum.ai/roadmap`,target:`_blank`,rel:`noopener noreferrer`,className:`underline text-[var(--content-default)]`,children:`public roadmap`})]}),(0,k.jsx)(ee,{id:`${D}-message`,ref:M,label:F===`bug_report`?`What went wrong?`:F===`feature_request`?`Describe your idea`:`What's on your mind?`,rows:3,placeholder:F===`bug_report`?`What did you expect to happen, and what happened instead?`:F===`feature_request`?`What problem would this solve for you?`:`Share your thoughts...`,value:L,onChange:e=>z(e.target.value),fullWidth:!0}),F!==`feature_request`&&(0,k.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,k.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,k.jsx)(h,{checked:V,onChange:we,"aria-label":`Include browser diagnostics`}),(0,k.jsx)(`span`,{className:`text-body-medium-lighter leading-6 text-[var(--content-default)]`,children:`Include diagnostics`})]}),(0,k.jsx)(i,{content:`Diagnostics include browser context, assistant logs, and timestamps — never passwords or credentials.`,children:(0,k.jsx)(`button`,{type:`button`,"aria-label":`About diagnostics`,className:`inline-flex items-center justify-center text-[var(--content-tertiary)]`,children:(0,k.jsx)(u,{className:`h-3.5 w-3.5`})})})]}),V&&(0,k.jsx)(g,{options:se,value:U,onChange:W,"aria-label":`Diagnostics time range`})]}),_()&&y&&F!==`feature_request`&&(0,k.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,k.jsx)(h,{checked:Y,onChange:()=>ve(e=>!e),"aria-label":`Include the most recent conversation`}),(0,k.jsx)(`span`,{className:`text-body-medium-lighter leading-6 text-[var(--content-default)]`,children:`Include the most recent conversation`})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,k.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Attachments`,G.length>0&&(0,k.jsxs)(`span`,{className:`text-[var(--content-tertiary)]`,children:[` · `,G.length,`/`,P]})]}),(0,k.jsx)(a,{variant:`outlined`,size:`compact`,leftIcon:(0,k.jsx)(ie,{}),onClick:()=>j.current?.click(),disabled:G.length>=P,children:`Add files`}),(0,k.jsx)(`input`,{ref:j,type:`file`,multiple:!0,accept:`image/png,image/jpeg,image/gif,image/webp,video/mp4,video/quicktime,video/webm`,onChange:ke,className:`hidden`})]}),G.length>0&&(0,k.jsx)(`div`,{className:`flex gap-2 overflow-x-auto`,children:G.map((e,t)=>(0,k.jsx)(fe,{file:e,onRemove:()=>Ne(t)},`${e.name}-${t}`))}),_e&&(0,k.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Drop files to attach…`})]})]}),ge&&(0,k.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:ge})]}),(0,k.jsx)(`div`,{className:`mt-4 flex items-center justify-end gap-2 border-t pt-4`,style:{borderColor:`var(--border-subtle)`},children:$?(0,k.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,k.jsx)(d,{className:`h-4 w-4 animate-spin`}),X?`Preparing diagnostics…`:`Sending feedback…`]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(a,{variant:`ghost`,onClick:t,children:`Cancel`}),X?(0,k.jsx)(a,{variant:`primary`,leftIcon:(0,k.jsx)(l,{}),onClick:async()=>{if(!$){q(null),Q(!0);try{let e=await R(U,c??null,_()?Y?y??null:null:y??null,{diagnosticsProvider:C,doctorSessionId:b,extraLogFiles:Te});if(!e){q(`Diagnostics export isn't supported in this browser.`);return}let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=e.name,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0),t()}catch(e){q(e instanceof Error?e.message:`Failed to build diagnostics. Please try again.`)}finally{Q(!1)}}},children:`Download diagnostics`}):(0,k.jsx)(a,{variant:`primary`,leftIcon:(0,k.jsx)(ne,{}),onClick:async()=>{if(!(!Se||$)){q(null),Q(!0);try{let e=V&&F!==`feature_request`?await R(U,c??null,_()?Y?y??null:null:y??null,{diagnosticsProvider:C,doctorSessionId:b,extraLogFiles:Te}):null;await Z.mutateAsync({headers:{"Content-Type":null},body:{message:L.trim(),classification:ce[F],email:B.trim(),client:le(),client_version:void 0,...c?{assistant_id:c}:{},...v?{assistant_version:v}:{},...b?{doctor_session_id:b}:{},...e?{logs_file:e}:{},...G.length?{attachments:G}:{}},bodySerializer:e=>{let t=new FormData;for(let[n,r]of Object.entries(e))if(r!=null){if(n===`attachments`&&Array.isArray(r)){for(let e of r)t.append(`attachments`,e);continue}r instanceof Blob?t.append(n,r):t.append(n,String(r))}return t}}),s?.(),t()}catch(e){q(e instanceof Error?e.message:`Failed to submit feedback. Please try again.`)}finally{Q(!1)}}},disabled:!Se,children:`Submit`})]})})]})}),document.body):null}function de({option:e,isSelected:t,onSelect:n}){let r=e.icon;return(0,k.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,className:`flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-left transition-colors`,style:{borderColor:t?`var(--primary-base)`:`var(--border-base)`,backgroundColor:t?`color-mix(in oklab, var(--primary-base) 10%, transparent)`:`transparent`},children:[(0,k.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`,style:{color:t?`var(--primary-base)`:`var(--content-secondary)`}}),(0,k.jsx)(`span`,{className:`text-body-small-default`,style:{color:t?`var(--primary-base)`:`var(--content-default)`},children:e.label})]})}function fe({file:e,onRemove:t}){let n=e.type.startsWith(`image/`),r=(0,T.useMemo)(()=>n?URL.createObjectURL(e):null,[e,n]);return(0,T.useEffect)(()=>{if(r)return()=>URL.revokeObjectURL(r)},[r]),(0,k.jsxs)(`div`,{className:`relative flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)]`,title:e.name,children:[n&&r?(0,k.jsx)(`img`,{src:r,alt:e.name,className:`h-full w-full object-cover`}):(0,k.jsx)(ie,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,k.jsx)(a,{variant:`ghost`,size:`compact`,iconOnly:(0,k.jsx)(f,{}),onClick:t,"aria-label":`Remove ${e.name}`,className:`absolute top-0.5 right-0.5 h-4 w-4 rounded-full bg-black/60 text-white hover:bg-black/70`,tintColor:`#fff`})]})}export{O as n,z as t};
1
+ import{o as e,r as t}from"./chunk-jRWAZmH_.js";import{t as n}from"./react-DJZBPgpf.js";import{F as r,n as i,t as a}from"./button-amTXFI-2.js";import{t as o}from"./useMutation-Lj4VunQV.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./bug-BsuQ5ciQ.js";import{t as l}from"./download-CAuK-nZ6.js";import{t as u}from"./info-DsOyuMO9.js";import{t as d}from"./loader-circle-Cz7opInR.js";import{t as f}from"./x-CkSVp1Ok.js";import{t as p}from"./notice-DkcNAP8O.js";import{n as ee,t as m}from"./input-CoUmPnRU.js";import{t as h}from"./toggle-CDfguvUz.js";import{t as g}from"./dropdown-ByHOpeOU.js";import{t as _}from"./is-electron-y5bNUVyG.js";import{an as v}from"./sdk.gen-CFgJ4K6f.js";import{t as y}from"./impersonate-version-flag-BhxfH6iZ.js";import{n as te}from"./auth-store-65JKPW7C.js";import{t as b}from"./dist-RkT480s0.js";import{n as x}from"./diagnostics-CUmYxbmM.js";import{L as S}from"./react-query.gen-DV9K_z-o.js";import{Ai as ne,Ji as re,Ki as C,Vi as ie,ea as w}from"./index-B4Qq7TL7.js";var T=e(n(),1),ae=e(r(),1),E=`vellum:debug:`;function oe(){let e={};if(typeof window>`u`)return e;try{for(let t=0;t<window.localStorage.length;t++){let n=window.localStorage.key(t);if(n===null||!n.startsWith(E))continue;let r=window.localStorage.getItem(n);r!==null&&(e[n]=r)}}catch{}return e}function D(){return{collectedAt:new Date().toISOString(),resolved:{impersonateAssistantVersion:y()},overrides:oe()}}var O=t({ShareFeedbackModal:()=>z}),k=s(),A=[{value:`bug_report`,label:`Bug Report`,icon:c,includesLogsByDefault:!0},{value:`feature_request`,label:`Feature Request`,icon:w,includesLogsByDefault:!1},{value:`other`,label:`Other`,icon:C,includesLogsByDefault:!1}],j=[{value:`past_hour`,label:`Past hour`,cutoffMs:3600*1e3},{value:`past_24_hours`,label:`Past 24 hours`,cutoffMs:1440*60*1e3},{value:`all_time`,label:`All time`,cutoffMs:null}],se=j.map(e=>({value:e.value,label:e.label})),M=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`video/mp4`,`video/quicktime`,`video/webm`]),N=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`mp4`,`mov`,`webm`]),P=10,F=50*1024*1024,ce={bug_report:`bug_report`,feature_request:`feature_request`,other:`other`};function le(){return _()?`electron`:b.getPlatform()===`ios`?`ios`:`web`}function ue(e){if(e.size>F)return!1;if(e.type&&M.has(e.type))return!0;if(!e.type){let t=e.name.split(`.`).pop()?.toLowerCase();return t?N.has(t):!1}return!1}function I(e,t){let n=Math.ceil(t.length/512),r=new Uint8Array(512+n*512),i=new TextEncoder,a=(e,t,n)=>{let a=i.encode(e);r.set(a.slice(0,n),t)},o=(e,t,n)=>{a(e.toString(8).padStart(n-1,`0`)+`\0`,t,n)};a(e,0,100),o(420,100,8),o(0,108,8),o(0,116,8),o(t.length,124,12),o(Math.floor(Date.now()/1e3),136,12);for(let e=148;e<156;e++)r[e]=32;r[156]=48,a(`ustar\0`,257,6),a(`00`,263,2);let s=0;for(let e=0;e<512;e++)s+=r[e];return o(s,148,7),r[155]=32,r.set(t,512),r}async function L(e,t){try{let n={};t.window.startTime!=null&&(n.startTime=t.window.startTime,n.endTime=t.window.endTime),t.activeConversationId&&(n.conversationId=t.activeConversationId);let{data:r,error:i}=await v({path:{assistant_id:e},body:n,parseAs:`blob`,throwOnError:!1});if(i||!(r instanceof Blob))return null;let a=await r.arrayBuffer();return new Uint8Array(a)}catch{return null}}async function R(e,t,n,r={}){if(typeof CompressionStream>`u`)return null;let{diagnosticsProvider:i,doctorSessionId:a,extraLogFiles:o=[]}=r,s=new Date,c=j.find(t=>t.value===e),l=s.getTime(),u=c?.cutoffMs==null?null:l-c.cutoffMs,d=u==null?null:new Date(u).toISOString(),f=null;try{f=i?.()??null}catch{f=null}let p=x(f),ee={collected_at:s.toISOString(),time_range:e,cutoff:d,log_window:{start_time_ms:u,end_time_ms:l},assistant_id:t,active_conversation_id:n,doctor_session_id:a??null,user_agent:typeof navigator<`u`?navigator.userAgent:``,language:typeof navigator<`u`?navigator.language:``,platform:typeof navigator<`u`?navigator.platform:``,url:typeof window<`u`?window.location.href:``,viewport:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:null,screen:typeof screen<`u`?{width:screen.width,height:screen.height}:null,connection:typeof navigator<`u`&&`connection`in navigator?{effectiveType:navigator.connection.effectiveType,downlink:navigator.connection.downlink,rtt:navigator.connection.rtt}:null,deviceMemory:typeof navigator<`u`&&`deviceMemory`in navigator?navigator.deviceMemory:null,hardwareConcurrency:typeof navigator<`u`?navigator.hardwareConcurrency:null},m=new TextEncoder,h=m.encode(JSON.stringify(ee,null,2)),g=m.encode(JSON.stringify(p,null,2)),v=[I(`web-client-context.json`,h),I(`web-chat-diagnostics.json`,g)],y=new TextEncoder().encode(JSON.stringify(D(),null,2));v.push(I(`web-debug-flags.json`,y));for(let e of o){let t=e.contents.trim();t&&v.push(I(e.filename,m.encode(t)))}try{let e=typeof window<`u`?window._vellumDebug?.chat:null;if(e){let t={clientMessages:e.getClientMessages?.()??null,transcriptItems:e.getTranscriptItems?.()??null,pendingInteractions:e.listPendingInteractions?.()??null,thinkingIndicator:e.thinkingIndicator?.()??null,streamingRing:e.streamingRing?.()??null,reconciliationDiagnostics:e.getReconciliationDiagnostics?.()??null},n=new TextEncoder().encode(JSON.stringify(t,null,2));v.push(I(`web-chat-debug-api-triage.json`,n))}}catch{}try{let e=typeof window<`u`?window._vellumDebug?.events:null;if(e){let t={focus:typeof document<`u`?{hasFocus:typeof document.hasFocus==`function`?document.hasFocus():null,visibilityState:document.visibilityState}:null,clients:e.getClients().map(({abortSignal:e,...t})=>({...t,aborted:e.aborted})),events:e.getEvents()},n=new TextEncoder().encode(JSON.stringify(t,null,2));v.push(I(`web-sse-liveness-triage.json`,n))}}catch{}if(_()&&window.vellum?.feedback){try{let e=await window.vellum.feedback.diagnostics(),t=new TextEncoder().encode(JSON.stringify(e,null,2));v.push(I(`electron-diagnostics.json`,t))}catch{}try{let e=await window.vellum.feedback.logs();if(e){let t=new TextEncoder().encode(e);v.push(I(`electron-main-logs.txt`,t))}}catch{}}if(t){let e=await L(t,{window:{startTime:u,endTime:l},activeConversationId:n});e&&v.push(I(`platform-logs.tar.gz`,e))}v.push(new Uint8Array(1024));let te=v.reduce((e,t)=>e+t.length,0),b=new Uint8Array(te),S=0;for(let e of v)b.set(e,S),S+=e.length;let ne=new Blob([b.buffer]),re=await new Response(ne.stream().pipeThrough(new CompressionStream(`gzip`))).blob();return new File([re],`web-client-logs-${s.getTime()}.tar.gz`,{type:`application/gzip`})}function z({open:e,onClose:t,initialReason:n,initialMessage:r,onSubmitted:s,assistantId:c,assistantVersion:v,activeConversationId:y,doctorSessionId:b,doctorSessionLog:x,getDiagnosticsSnapshot:C}){let w=te.use.user(),E=w?.email,oe=w?.isStaff??!1,D=(0,T.useId)(),O=(0,T.useRef)(null),j=(0,T.useRef)(null),M=(0,T.useRef)(null),N=(0,T.useRef)(null),[F,I]=(0,T.useState)(n??`bug_report`),[L,z]=(0,T.useState)(``),[B,pe]=(0,T.useState)(``),[V,H]=(0,T.useState)(A.find(e=>e.value===(n??`bug_report`))?.includesLogsByDefault??!0),[me,he]=(0,T.useState)(!1),[U,W]=(0,T.useState)(`past_hour`),[G,K]=(0,T.useState)([]),[ge,q]=(0,T.useState)(null),[_e,J]=(0,T.useState)(!1),[Y,ve]=(0,T.useState)(!1),[X,ye]=(0,T.useState)(!1),Z=o(S()),[be,Q]=(0,T.useState)(!1),$=Z.isPending||be,xe=!E,Se=(0,T.useMemo)(()=>L.trim().length>0&&B.trim().length>0,[L,B]);(0,T.useEffect)(()=>{if(!e)return;let t=n??`bug_report`;I(t),z(r??``),pe(E??``),H(A.find(e=>e.value===t)?.includesLogsByDefault??!0),he(!1),W(`past_hour`),K([]),ve(!1),ye(!1),q(null),Q(!1),Z.reset();let i=setTimeout(()=>{E?M.current?.focus():N.current?.focus()},50);return()=>clearTimeout(i)},[e]),(0,T.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e]);let Ce=e=>{I(e),me||H(A.find(t=>t.value===e)?.includesLogsByDefault??!1)},we=()=>{H(e=>!e),he(!0)},Te=x?.trim()?[{filename:`doctor-session.txt`,contents:x}]:[],Ee=(0,T.useCallback)(e=>{e.key===`Escape`&&!$&&t()},[t,$]),De=(0,T.useCallback)(e=>{e.target===O.current&&!$&&t()},[t,$]),Oe=(0,T.useCallback)(e=>{K(t=>{let n=P-t.length;if(n<=0)return t;let r=new Set(t.map(e=>`${e.name}:${e.size}`)),i=[];for(let t of e){if(i.length>=n)break;if(!ue(t))continue;let e=`${t.name}:${t.size}`;r.has(e)||(r.add(e),i.push(t))}return i.length>0?[...t,...i]:t})},[]),ke=e=>{e.target.files&&Oe(Array.from(e.target.files)),e.target.value=``},Ae=e=>{e.preventDefault(),J(!1),e.dataTransfer.files?.length&&Oe(Array.from(e.dataTransfer.files))},je=e=>{e.preventDefault(),J(!0)},Me=e=>{e.preventDefault(),e.currentTarget===e.target&&J(!1)},Ne=e=>{K(t=>t.filter((t,n)=>n!==e))};return e?(0,ae.createPortal)((0,k.jsx)(`div`,{ref:O,role:`dialog`,"aria-modal":`true`,"aria-labelledby":D,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:Ee,onClick:De,onDrop:Ae,onDragOver:je,onDragLeave:Me,children:(0,k.jsxs)(`div`,{className:`mx-4 flex w-full max-w-lg flex-col rounded-xl border p-6 shadow-xl`,style:{backgroundColor:`var(--surface-lift)`,borderColor:`var(--border-base)`,maxHeight:`calc(100vh - 2rem)`},children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-4`,style:{borderColor:`var(--border-subtle)`},children:[(0,k.jsx)(`h2`,{id:D,className:`!m-0 text-title-small text-[var(--content-default)]`,children:`Share Feedback`}),(0,k.jsx)(a,{variant:`ghost`,iconOnly:(0,k.jsx)(f,{}),onClick:t,disabled:$,"aria-label":`Close`,tintColor:`var(--content-secondary)`})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-3.5 overflow-y-auto pt-4 ${$?`pointer-events-none opacity-60`:``}`,children:[oe&&(0,k.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-2.5`,children:[(0,k.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3`,children:[(0,k.jsx)(h,{checked:X,onChange:()=>ye(e=>!e),"aria-label":`Download diagnostics directly`}),(0,k.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Download diagnostics directly`})]}),(0,k.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Admin only — builds the diagnostics archive locally and downloads it instead of submitting feedback or notifying Slack.`})]}),X?(0,k.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,k.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Time range`}),(0,k.jsx)(g,{options:se,value:U,onChange:W,"aria-label":`Diagnostics time range`})]}):(0,k.jsxs)(k.Fragment,{children:[xe&&(0,k.jsx)(m,{id:`${D}-email`,ref:N,label:`Email`,type:`email`,placeholder:`you@example.com`,value:B,onChange:e=>pe(e.target.value),leftIcon:(0,k.jsx)(re,{className:`h-4 w-4`,"aria-hidden":!0}),fullWidth:!0}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,k.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Category`}),(0,k.jsx)(`div`,{className:`flex gap-2`,children:A.map(e=>(0,k.jsx)(de,{option:e,isSelected:F===e.value,onSelect:()=>Ce(e.value)},e.value))})]}),(0,k.jsx)(`hr`,{className:`border-[var(--border-subtle)]`}),F===`bug_report`&&(0,k.jsxs)(p,{tone:`info`,children:[`Tip: Get faster support by posting in our`,` `,(0,k.jsx)(`a`,{href:`https://vellum.ai/community`,target:`_blank`,rel:`noopener noreferrer`,className:`underline text-[var(--content-default)]`,children:`Discord community`})]}),F===`feature_request`&&(0,k.jsxs)(p,{tone:`info`,children:[`Tip: Vote on features on our`,` `,(0,k.jsx)(`a`,{href:`https://vellum.ai/roadmap`,target:`_blank`,rel:`noopener noreferrer`,className:`underline text-[var(--content-default)]`,children:`public roadmap`})]}),(0,k.jsx)(ee,{id:`${D}-message`,ref:M,label:F===`bug_report`?`What went wrong?`:F===`feature_request`?`Describe your idea`:`What's on your mind?`,rows:3,placeholder:F===`bug_report`?`What did you expect to happen, and what happened instead?`:F===`feature_request`?`What problem would this solve for you?`:`Share your thoughts...`,value:L,onChange:e=>z(e.target.value),fullWidth:!0}),F!==`feature_request`&&(0,k.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,k.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,k.jsx)(h,{checked:V,onChange:we,"aria-label":`Include browser diagnostics`}),(0,k.jsx)(`span`,{className:`text-body-medium-lighter leading-6 text-[var(--content-default)]`,children:`Include diagnostics`})]}),(0,k.jsx)(i,{content:`Diagnostics include browser context, assistant logs, and timestamps — never passwords or credentials.`,children:(0,k.jsx)(`button`,{type:`button`,"aria-label":`About diagnostics`,className:`inline-flex items-center justify-center text-[var(--content-tertiary)]`,children:(0,k.jsx)(u,{className:`h-3.5 w-3.5`})})})]}),V&&(0,k.jsx)(g,{options:se,value:U,onChange:W,"aria-label":`Diagnostics time range`})]}),_()&&y&&F!==`feature_request`&&(0,k.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,k.jsx)(h,{checked:Y,onChange:()=>ve(e=>!e),"aria-label":`Include the most recent conversation`}),(0,k.jsx)(`span`,{className:`text-body-medium-lighter leading-6 text-[var(--content-default)]`,children:`Include the most recent conversation`})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,k.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Attachments`,G.length>0&&(0,k.jsxs)(`span`,{className:`text-[var(--content-tertiary)]`,children:[` · `,G.length,`/`,P]})]}),(0,k.jsx)(a,{variant:`outlined`,size:`compact`,leftIcon:(0,k.jsx)(ie,{}),onClick:()=>j.current?.click(),disabled:G.length>=P,children:`Add files`}),(0,k.jsx)(`input`,{ref:j,type:`file`,multiple:!0,accept:`image/png,image/jpeg,image/gif,image/webp,video/mp4,video/quicktime,video/webm`,onChange:ke,className:`hidden`})]}),G.length>0&&(0,k.jsx)(`div`,{className:`flex gap-2 overflow-x-auto`,children:G.map((e,t)=>(0,k.jsx)(fe,{file:e,onRemove:()=>Ne(t)},`${e.name}-${t}`))}),_e&&(0,k.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Drop files to attach…`})]})]}),ge&&(0,k.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:ge})]}),(0,k.jsx)(`div`,{className:`mt-4 flex items-center justify-end gap-2 border-t pt-4`,style:{borderColor:`var(--border-subtle)`},children:$?(0,k.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,k.jsx)(d,{className:`h-4 w-4 animate-spin`}),X?`Preparing diagnostics…`:`Sending feedback…`]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(a,{variant:`ghost`,onClick:t,children:`Cancel`}),X?(0,k.jsx)(a,{variant:`primary`,leftIcon:(0,k.jsx)(l,{}),onClick:async()=>{if(!$){q(null),Q(!0);try{let e=await R(U,c??null,_()?Y?y??null:null:y??null,{diagnosticsProvider:C,doctorSessionId:b,extraLogFiles:Te});if(!e){q(`Diagnostics export isn't supported in this browser.`);return}let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=e.name,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0),t()}catch(e){q(e instanceof Error?e.message:`Failed to build diagnostics. Please try again.`)}finally{Q(!1)}}},children:`Download diagnostics`}):(0,k.jsx)(a,{variant:`primary`,leftIcon:(0,k.jsx)(ne,{}),onClick:async()=>{if(!(!Se||$)){q(null),Q(!0);try{let e=V&&F!==`feature_request`?await R(U,c??null,_()?Y?y??null:null:y??null,{diagnosticsProvider:C,doctorSessionId:b,extraLogFiles:Te}):null;await Z.mutateAsync({headers:{"Content-Type":null},body:{message:L.trim(),classification:ce[F],email:B.trim(),client:le(),client_version:void 0,...c?{assistant_id:c}:{},...v?{assistant_version:v}:{},...b?{doctor_session_id:b}:{},...e?{logs_file:e}:{},...G.length?{attachments:G}:{}},bodySerializer:e=>{let t=new FormData;for(let[n,r]of Object.entries(e))if(r!=null){if(n===`attachments`&&Array.isArray(r)){for(let e of r)t.append(`attachments`,e);continue}r instanceof Blob?t.append(n,r):t.append(n,String(r))}return t}}),s?.(),t()}catch(e){q(e instanceof Error?e.message:`Failed to submit feedback. Please try again.`)}finally{Q(!1)}}},disabled:!Se,children:`Submit`})]})})]})}),document.body):null}function de({option:e,isSelected:t,onSelect:n}){let r=e.icon;return(0,k.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,className:`flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-left transition-colors`,style:{borderColor:t?`var(--primary-base)`:`var(--border-base)`,backgroundColor:t?`color-mix(in oklab, var(--primary-base) 10%, transparent)`:`transparent`},children:[(0,k.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`,style:{color:t?`var(--primary-base)`:`var(--content-secondary)`}}),(0,k.jsx)(`span`,{className:`text-body-small-default`,style:{color:t?`var(--primary-base)`:`var(--content-default)`},children:e.label})]})}function fe({file:e,onRemove:t}){let n=e.type.startsWith(`image/`),r=(0,T.useMemo)(()=>n?URL.createObjectURL(e):null,[e,n]);return(0,T.useEffect)(()=>{if(r)return()=>URL.revokeObjectURL(r)},[r]),(0,k.jsxs)(`div`,{className:`relative flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)]`,title:e.name,children:[n&&r?(0,k.jsx)(`img`,{src:r,alt:e.name,className:`h-full w-full object-cover`}):(0,k.jsx)(ie,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,k.jsx)(a,{variant:`ghost`,size:`compact`,iconOnly:(0,k.jsx)(f,{}),onClick:t,"aria-label":`Remove ${e.name}`,className:`absolute top-0.5 right-0.5 h-4 w-4 rounded-full bg-black/60 text-white hover:bg-black/70`,tintColor:`#fff`})]})}export{O as n,z as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-amTXFI-2.js";import{d as r,t as i,u as a}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./typography-D5f7kt80.js";import{t as c}from"./arrow-left-DI9551VI.js";import{t as l}from"./chevron-right-DqqmezXC.js";import{i as u}from"./src-DZbMXyC2.js";import{t as d}from"./is-electron-y5bNUVyG.js";import{c as f}from"./routes-DYcJgn9k.js";import{In as p,Sr as m,gn as h}from"./index-CkKSY1-Q.js";import{t as g}from"./use-edge-swipe-back-CGjL1V81.js";var _=e(t(),1),v=o();function y({sidebar:e,children:t,actions:o,backHref:l,title:u=`Settings`,menuRoute:y=f.settings.root}){let{pathname:b}=a(),x=r(),S=b===y,C=m(),w=(0,_.useRef)(null),T=(0,_.useRef)(null);(0,_.useLayoutEffect)(()=>{T.current?.scrollTo(0,0)},[b]);let E=S?l:y;g({containerRef:w,onBack:(0,_.useCallback)(()=>{x(E)},[x,E]),enabled:C,navKey:b});let D=d(),O=S?`Back from ${u}`:`Back to ${u} menu`,k=(0,v.jsx)(n,{variant:`ghost`,iconOnly:(0,v.jsx)(c,{}),"aria-label":O,tintColor:`var(--content-secondary)`,onClick:()=>x(E)}),A=(0,v.jsx)(n,{asChild:!0,variant:`outlined`,"aria-label":`Back from ${u}`,className:`h-8 w-8 px-0`,tintColor:`var(--content-secondary)`,children:(0,v.jsx)(i,{to:l,className:`flex items-center justify-center no-underline`,children:(0,v.jsx)(c,{size:16,"aria-hidden":`true`})})});return(0,v.jsxs)(`div`,{ref:w,className:`flex h-full min-h-0 w-full flex-1 flex-col gap-4 p-4 sm:p-6 md:gap-0`,style:{paddingTop:D?`3.75rem`:`1rem`},children:[(0,v.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 md:hidden`,children:[k,(0,v.jsx)(s,{as:`h1`,variant:`body-large-default`,className:`flex-1 truncate text-center`,style:{color:`var(--content-tertiary)`,lineHeight:1.4},children:u}),(0,v.jsx)(`div`,{className:`h-10 w-10 shrink-0`,"aria-hidden":`true`})]}),D?(0,v.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 pb-4 empty:hidden`,children:[(0,v.jsx)(p,{placement:`electron`,className:`px-0 pt-0`}),(0,v.jsx)(h,{placement:`electron`,className:`px-0 pt-0`})]}):null,(0,v.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden md:rounded-[12px] md:border md:border-[var(--border-base)] md:bg-[var(--surface-overlay)]`,children:[(0,v.jsxs)(`div`,{className:`hidden shrink-0 items-center justify-between gap-4 px-6 py-5 md:flex`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[A,(0,v.jsx)(`h1`,{className:`text-title-large truncate`,style:{color:`var(--content-emphasised)`,lineHeight:1.2},children:u})]}),(0,v.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:o})]}),(0,v.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,v.jsx)(`aside`,{className:`hidden w-64 shrink-0 overflow-y-auto md:block`,"aria-label":`${u} navigation`,children:e}),S?(0,v.jsx)(`div`,{className:`flex min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overflow-x-hidden pb-6 md:hidden`,children:e}):null,(0,v.jsx)(`main`,{ref:T,className:`min-w-0 min-h-0 flex-1 flex-col gap-4 overflow-y-auto overflow-x-hidden pb-6 md:flex md:px-6 md:pt-0 ${S?`hidden`:`flex`}`,children:t})]})]})]})}function b({items:e,bottomItems:t,indexPath:n}){let{pathname:i}=a(),o=r(),s=m(),c=(e,t,r)=>{let{href:a,onSelect:c}=e,d=a!=null&&(i===a||i.startsWith(a+`/`)||!s&&r&&n!=null&&i===n);return(0,v.jsxs)(_.Fragment,{children:[(0,v.jsx)(u.Item,{icon:e.icon,label:e.label,active:d,trailingIcon:a==null?void 0:l,trailingIconClassName:a==null?void 0:`md:hidden`,href:a,onSelect:c,onClick:a==null?void 0:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||(e.preventDefault(),o(a))}}),!t&&(0,v.jsx)(`div`,{role:`presentation`,"aria-hidden":!0,className:`my-2 h-px w-full bg-[var(--border-base)] md:hidden`})]},e.id)};return(0,v.jsxs)(`nav`,{"aria-label":`Sidebar navigation`,className:`flex min-h-full flex-col md:gap-2 md:px-6 md:pb-4`,children:[e.map((n,r)=>c(n,r===e.length-1&&!t?.length,r===0)),t&&t.length>0&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`flex-1`}),(0,v.jsx)(`div`,{role:`presentation`,"aria-hidden":!0,className:`mx-0 my-2 h-px w-full bg-[var(--border-base)] md:mx-0`}),t.map((e,n)=>c(e,n===t.length-1,!1))]})]})}export{y as n,b as t};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-amTXFI-2.js";import{d as r,t as i,u as a}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./typography-D5f7kt80.js";import{t as c}from"./arrow-left-DI9551VI.js";import{t as l}from"./chevron-right-DqqmezXC.js";import{i as u}from"./src-DZbMXyC2.js";import{t as d}from"./is-electron-y5bNUVyG.js";import{c as f}from"./routes-BXlWEOF0.js";import{In as p,Sr as m,gn as h}from"./index-B4Qq7TL7.js";import{t as g}from"./use-edge-swipe-back-R9ItWgTp.js";var _=e(t(),1),v=o();function y({sidebar:e,children:t,actions:o,backHref:l,title:u=`Settings`,menuRoute:y=f.settings.root}){let{pathname:b}=a(),x=r(),S=b===y,C=m(),w=(0,_.useRef)(null),T=(0,_.useRef)(null);(0,_.useLayoutEffect)(()=>{T.current?.scrollTo(0,0)},[b]);let E=S?l:y;g({containerRef:w,onBack:(0,_.useCallback)(()=>{x(E)},[x,E]),enabled:C,navKey:b});let D=d(),O=S?`Back from ${u}`:`Back to ${u} menu`,k=(0,v.jsx)(n,{variant:`ghost`,iconOnly:(0,v.jsx)(c,{}),"aria-label":O,tintColor:`var(--content-secondary)`,onClick:()=>x(E)}),A=(0,v.jsx)(n,{asChild:!0,variant:`outlined`,"aria-label":`Back from ${u}`,className:`h-8 w-8 px-0`,tintColor:`var(--content-secondary)`,children:(0,v.jsx)(i,{to:l,className:`flex items-center justify-center no-underline`,children:(0,v.jsx)(c,{size:16,"aria-hidden":`true`})})});return(0,v.jsxs)(`div`,{ref:w,className:`flex h-full min-h-0 w-full flex-1 flex-col gap-4 p-4 sm:p-6 md:gap-0`,style:{paddingTop:D?`3.75rem`:`1rem`},children:[(0,v.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 md:hidden`,children:[k,(0,v.jsx)(s,{as:`h1`,variant:`body-large-default`,className:`flex-1 truncate text-center`,style:{color:`var(--content-tertiary)`,lineHeight:1.4},children:u}),(0,v.jsx)(`div`,{className:`h-10 w-10 shrink-0`,"aria-hidden":`true`})]}),D?(0,v.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 pb-4 empty:hidden`,children:[(0,v.jsx)(p,{placement:`electron`,className:`px-0 pt-0`}),(0,v.jsx)(h,{placement:`electron`,className:`px-0 pt-0`})]}):null,(0,v.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden md:rounded-[12px] md:border md:border-[var(--border-base)] md:bg-[var(--surface-overlay)]`,children:[(0,v.jsxs)(`div`,{className:`hidden shrink-0 items-center justify-between gap-4 px-6 py-5 md:flex`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[A,(0,v.jsx)(`h1`,{className:`text-title-large truncate`,style:{color:`var(--content-emphasised)`,lineHeight:1.2},children:u})]}),(0,v.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:o})]}),(0,v.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,v.jsx)(`aside`,{className:`hidden w-64 shrink-0 overflow-y-auto md:block`,"aria-label":`${u} navigation`,children:e}),S?(0,v.jsx)(`div`,{className:`flex min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overflow-x-hidden pb-6 md:hidden`,children:e}):null,(0,v.jsx)(`main`,{ref:T,className:`min-w-0 min-h-0 flex-1 flex-col gap-4 overflow-y-auto overflow-x-hidden pb-6 md:flex md:px-6 md:pt-0 ${S?`hidden`:`flex`}`,children:t})]})]})]})}function b({items:e,bottomItems:t,indexPath:n}){let{pathname:i}=a(),o=r(),s=m(),c=(e,t,r)=>{let{href:a,onSelect:c}=e,d=a!=null&&(i===a||i.startsWith(a+`/`)||!s&&r&&n!=null&&i===n);return(0,v.jsxs)(_.Fragment,{children:[(0,v.jsx)(u.Item,{icon:e.icon,label:e.label,active:d,trailingIcon:a==null?void 0:l,trailingIconClassName:a==null?void 0:`md:hidden`,href:a,onSelect:c,onClick:a==null?void 0:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||(e.preventDefault(),o(a))}}),!t&&(0,v.jsx)(`div`,{role:`presentation`,"aria-hidden":!0,className:`my-2 h-px w-full bg-[var(--border-base)] md:hidden`})]},e.id)};return(0,v.jsxs)(`nav`,{"aria-label":`Sidebar navigation`,className:`flex min-h-full flex-col md:gap-2 md:px-6 md:pb-4`,children:[e.map((n,r)=>c(n,r===e.length-1&&!t?.length,r===0)),t&&t.length>0&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`flex-1`}),(0,v.jsx)(`div`,{role:`presentation`,"aria-hidden":!0,className:`mx-0 my-2 h-px w-full bg-[var(--border-base)] md:mx-0`}),t.map((e,n)=>c(e,n===t.length-1,!1))]})]})}export{y as n,b as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{f as i}from"./native-biometric-Dy5Vb7o0.js";import{n as a,r as o}from"./login-flow-DdiUXQhA.js";import{t as s}from"./proxy-Cadlowdl.js";import{t as c}from"./AnimatePresence-TZWSGjkI.js";import{st as l}from"./index-CkKSY1-Q.js";import{t as u}from"./signup-shell-DCGARCES.js";var d=e(t(),1),f=r();function p({words:e}){let[t,n]=(0,d.useState)(0),r=(0,d.useMemo)(()=>e.reduce((e,t)=>e.length>=t.length?e:t),[e]);return(0,d.useEffect)(()=>{let t=setInterval(()=>{n(t=>(t+1)%e.length)},2400);return()=>clearInterval(t)},[e.length]),(0,f.jsxs)(`span`,{className:`signup__rotating`,children:[(0,f.jsxs)(`span`,{className:`signup__rotating-sizer`,"aria-hidden":!0,children:[r,`.`]}),(0,f.jsx)(c,{mode:`wait`,children:(0,f.jsxs)(s.em,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-16},transition:{duration:.3,ease:`easeInOut`},children:[e[t],`.`]},e[t])})]})}var m=[`Personal Intelligence`,`Software Engineer`,`Finance Ops`,`Household Manager`,`GTM Engineer`,`Product Lead`];function h({returnTo:e}){let[t,n]=(0,d.useState)(null),r=o(e,{authIntent:`signup`});return(0,f.jsxs)(u,{children:[(0,f.jsxs)(`h1`,{className:`signup__title`,children:[`Meet your new`,(0,f.jsx)(`br`,{}),(0,f.jsx)(p,{words:m})]}),(0,f.jsx)(`p`,{className:`signup__subtitle`,children:`The most powerful assistant that can handle your work and life admin tasks.`}),(0,f.jsx)(`div`,{className:`signup__buttons`,children:(0,f.jsx)(`button`,{type:`button`,className:`signup__btn`,onClick:()=>{n(null),i(a,r,{returnTo:e,intent:`signup`}).catch(e=>{console.error(`[signup] auth flow failed:`,e),n(`Something went wrong. Please try again.`)})},children:`Continue`})}),t&&(0,f.jsx)(`p`,{className:`signup__error`,children:t}),(0,f.jsxs)(`p`,{className:`signup__footer`,children:[`Already have an account?`,` `,(0,f.jsx)(`button`,{type:`button`,className:`signup__link`,onClick:()=>{n(null),i(a,o(e),{returnTo:e}).catch(e=>{console.error(`[signup] sign-in flow failed:`,e),n(`Something went wrong. Please try again.`)})},children:`Sign in`})]}),(0,f.jsxs)(`a`,{className:`signup__download`,href:`/downloads`,children:[(0,f.jsx)(l,{size:16}),`Download for macOS`]})]})}function g(){let[e]=n();return(0,f.jsx)(h,{returnTo:e.get(`returnTo`)})}export{g as SignupPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{f as i}from"./native-biometric-B2cBAQ1U.js";import{n as a,r as o}from"./login-flow-DYLpX6IU.js";import{t as s}from"./proxy-Cadlowdl.js";import{t as c}from"./AnimatePresence-TZWSGjkI.js";import{st as l}from"./index-B4Qq7TL7.js";import{t as u}from"./signup-shell-DCGARCES.js";var d=e(t(),1),f=r();function p({words:e}){let[t,n]=(0,d.useState)(0),r=(0,d.useMemo)(()=>e.reduce((e,t)=>e.length>=t.length?e:t),[e]);return(0,d.useEffect)(()=>{let t=setInterval(()=>{n(t=>(t+1)%e.length)},2400);return()=>clearInterval(t)},[e.length]),(0,f.jsxs)(`span`,{className:`signup__rotating`,children:[(0,f.jsxs)(`span`,{className:`signup__rotating-sizer`,"aria-hidden":!0,children:[r,`.`]}),(0,f.jsx)(c,{mode:`wait`,children:(0,f.jsxs)(s.em,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-16},transition:{duration:.3,ease:`easeInOut`},children:[e[t],`.`]},e[t])})]})}var m=[`Personal Intelligence`,`Software Engineer`,`Finance Ops`,`Household Manager`,`GTM Engineer`,`Product Lead`];function h({returnTo:e}){let[t,n]=(0,d.useState)(null),r=o(e,{authIntent:`signup`});return(0,f.jsxs)(u,{children:[(0,f.jsxs)(`h1`,{className:`signup__title`,children:[`Meet your new`,(0,f.jsx)(`br`,{}),(0,f.jsx)(p,{words:m})]}),(0,f.jsx)(`p`,{className:`signup__subtitle`,children:`The most powerful assistant that can handle your work and life admin tasks.`}),(0,f.jsx)(`div`,{className:`signup__buttons`,children:(0,f.jsx)(`button`,{type:`button`,className:`signup__btn`,onClick:()=>{n(null),i(a,r,{returnTo:e,intent:`signup`}).catch(e=>{console.error(`[signup] auth flow failed:`,e),n(`Something went wrong. Please try again.`)})},children:`Continue`})}),t&&(0,f.jsx)(`p`,{className:`signup__error`,children:t}),(0,f.jsxs)(`p`,{className:`signup__footer`,children:[`Already have an account?`,` `,(0,f.jsx)(`button`,{type:`button`,className:`signup__link`,onClick:()=>{n(null),i(a,o(e),{returnTo:e}).catch(e=>{console.error(`[signup] sign-in flow failed:`,e),n(`Something went wrong. Please try again.`)})},children:`Sign in`})]}),(0,f.jsxs)(`a`,{className:`signup__download`,href:`/downloads`,children:[(0,f.jsx)(l,{size:16}),`Download for macOS`]})]})}function g(){let[e]=n();return(0,f.jsx)(h,{returnTo:e.get(`returnTo`)})}export{g as SignupPage};
@@ -0,0 +1 @@
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{n}from"./button-amTXFI-2.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{t as i}from"./typography-D5f7kt80.js";import{ft as a,ht as o,m as s,mt as c,p as l,pt as u}from"./risk-BQ3NV8r8.js";import{t as d}from"./brain-BLDXGaUy.js";import{t as f}from"./check-DFNrQERi.js";import{t as p}from"./circle-check-VSiny8yl.js";import{t as m}from"./code-Czx7d7SK.js";import{t as h}from"./file-text-CYJz-GvF.js";import{t as g}from"./globe-4qSOWE2N.js";import{t as _}from"./monitor-DfbL8_59.js";import{t as v}from"./sparkles-PGiR5v1g.js";import{t as y}from"./user-plus-DMh4_UTz.js";import"./src-DZbMXyC2.js";import{t as b}from"./popover-CFL4WZTr.js";import{T as x,w as S}from"./chat-0L0NBUcq.js";import{t as C}from"./misc-DnHIYCE9.js";import{t as ee}from"./proxy-Cadlowdl.js";import{t as te}from"./AnimatePresence-TZWSGjkI.js";import{t as ne}from"./use-reduced-motion-BPBlq9_a.js";import{t as w}from"./three-dot-indicator-BuZzHFUJ.js";var T=e(t(),1),re=.44;function ie(e,t){let n=[...e].sort((e,t)=>e.position-t.position),r=n[0]?.color??`white`,i=n[n.length-1]?.color??`white`,a=n.map(e=>{let t=(e.position-.5)*2*re;return`${e.color} calc(50% + var(--gs-spread-mid) * ${t.toFixed(4)})`}).join(`, `);return[`linear-gradient(${t}deg`,`var(--gs-base) calc(50% - var(--gs-spread))`,`color-mix(in oklab, var(--gs-base) 42%, ${r}) calc(50% - var(--gs-spread-mid))`,a,`color-mix(in oklab, var(--gs-base) 42%, ${i}) calc(50% + var(--gs-spread-mid))`,`var(--gs-base) calc(50% + var(--gs-spread)))`].join(`, `)}var E={sunrise:[{color:`#B6D3EF`,position:0},{color:`#CAD1D7`,position:.153},{color:`#D7CFC8`,position:.252},{color:`#E1CDB9`,position:.341},{color:`#EAC6A5`,position:.424},{color:`#EDB185`,position:.505},{color:`#EF9B62`,position:.586},{color:`#F18F60`,position:.669},{color:`#F48D7A`,position:.758},{color:`#F78A94`,position:.857},{color:`#F888A0`,position:1}],bubble:[{color:`#F5EBD9`,position:0},{color:`#F2D4DB`,position:.31},{color:`#EBBDDE`,position:.5},{color:`#CCBAE3`,position:.65},{color:`#8CBFF0`,position:.82},{color:`#78B0FF`,position:1}],peach:[{color:`#D9F5FA`,position:0},{color:`#FCD9D6`,position:.31},{color:`#FCBAC9`,position:.61},{color:`#F0B3F5`,position:1}],tonic:[{color:`#E3EDF0`,position:0},{color:`#E8EBB8`,position:.27},{color:`#F0DEA3`,position:.43},{color:`#E8B078`,position:.75},{color:`#F29682`,position:1}],mint:[{color:`#DECEE8`,position:0},{color:`#CBBAEE`,position:.21},{color:`#7DC0FB`,position:.46},{color:`#00C7A6`,position:1}],spring:[{color:`#F7D5C5`,position:.07},{color:`#46A8C0`,position:.58},{color:`#43AE7D`,position:1}],twilight:[{color:`#E3CCE6`,position:0},{color:`#4E8CD5`,position:.35},{color:`#6068C2`,position:.64},{color:`#38364E`,position:1}],bay:[{color:`#DBE3D0`,position:0},{color:`#8DB8A7`,position:.23},{color:`#2D8E9A`,position:.42},{color:`#076492`,position:.59},{color:`#154288`,position:.79},{color:`#262C81`,position:1}]},D={smooth:`cubic-bezier(0.45, 0, 0.55, 1)`,gentle:`cubic-bezier(0.76, 0, 0.24, 1)`,snappy:`cubic-bezier(0.3, 0, 0.2, 1)`};function ae(){return typeof window>`u`?!0:typeof window.CSS?.supports==`function`?window.CSS.supports(`background-clip`,`text`)||window.CSS.supports(`-webkit-background-clip`,`text`):!1}function oe(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var se=`160px`,ce=120;function le(e,{pauseOnScroll:t,pauseWhenOffscreen:n},r){if(typeof window>`u`)return()=>{};let i=!n||typeof IntersectionObserver>`u`,a=typeof document>`u`?!0:!document.hidden,o=!0,s=()=>r(i&&a&&o),c;n&&typeof IntersectionObserver<`u`&&(c=new IntersectionObserver(e=>{let t=e[e.length-1];t&&(i=t.isIntersecting,s())},{rootMargin:se}),c.observe(e));let l=()=>{a=!document.hidden,s()};document.addEventListener(`visibilitychange`,l);let u,d=()=>{o=!1,s(),clearTimeout(u),u=setTimeout(()=>{o=!0,s()},ce)};return t&&window.addEventListener(`scroll`,d,{passive:!0,capture:!0}),s(),()=>{c?.disconnect(),document.removeEventListener(`visibilitychange`,l),t&&window.removeEventListener(`scroll`,d,{capture:!0}),clearTimeout(u)}}var ue=96,de=48,fe=.72,pe=14,me=1.45,he=3,ge=105;function _e(e){return e?typeof e==`string`?E[e]??E.sunrise:e:E.sunrise}function O(e,t){return Number.isFinite(e)?e:t}function ve(e){e.style.removeProperty(`background-image`),e.style.removeProperty(`-webkit-text-fill-color`)}function ye({children:e,gradient:t,easing:n=`smooth`,duration:r=me,spread:i=he,angle:a=ge,pauseBetween:o=1e3,baseColor:s=`currentColor`,pauseOnScroll:c=!0,pauseWhenOffscreen:l=!0,respectReducedMotion:u=!0,as:d=`span`,className:f,style:p,...m}){let h=(0,T.useRef)(null),g=Math.max(.001,O(r,me)),_=Math.max(0,O(i,he)),v=O(a,ge),y=(0,T.useMemo)(()=>_e(t),[t]),b=(0,T.useMemo)(()=>ie(y,v),[y,v]),x=D[n]??D.smooth,S=Math.min(e.length*_,de);(0,T.useEffect)(()=>{let t=h.current;if(!t)return;let n=()=>{let n=t.getBoundingClientRect().width||ue,r=(Number.parseFloat(getComputedStyle(t).fontSize)||pe)/pe,i=Math.min(e.length*_*r,de*r),a=Math.max(1,n+i*2),o=-i-a/2,s=n+i-a/2,c=g*1e3;return t.style.setProperty(`--gs-spread`,`${i}px`),t.style.setProperty(`--gs-spread-mid`,`${i*fe}px`),t.style.backgroundSize=`${a}px 100%`,{start:o,end:s,durationMs:c}};if(!ae()){ve(t);return}if(n(),u&&oe()||typeof t.animate!=`function`)return;let r=null,i,a=!0,s=!1,d=()=>{if(s)return;let{start:e,end:c,durationMs:l}=n(),u=t.animate([{backgroundPosition:`${e}px center`},{backgroundPosition:`${c}px center`}],{duration:l,easing:x,fill:`forwards`});a||u.pause(),r?.cancel(),r=u,u.onfinish=()=>{i=setTimeout(d,Math.max(0,o))}},f=le(t,{pauseOnScroll:c,pauseWhenOffscreen:l},e=>{a=e,r&&(a?r.play():r.pause())});return d(),()=>{s=!0,r?.cancel(),clearTimeout(i),f()}},[e,_,g,x,o,c,l,u]);let C={position:`relative`,display:`inline-block`,backgroundImage:b,backgroundRepeat:`no-repeat`,backgroundSize:`100% 100%`,backgroundColor:`var(--gs-base)`,WebkitBackgroundClip:`text`,backgroundClip:`text`,WebkitTextFillColor:`transparent`,"--gs-base":s,"--gs-spread":`${S}px`,"--gs-spread-mid":`${S*fe}px`,...p};return(0,T.createElement)(d,{...m,ref:h,className:f,style:C},e)}var k=r();function be(e){let t=`color-mix(in srgb, ${e} 40%, white)`;return[{position:0,color:t},{position:.5,color:e},{position:1,color:t}]}var xe=`var(--avatar-accent, var(--content-emphasised))`;function A({children:e,colorHex:t,className:n,"data-testid":r}){let i=t??xe;return(0,k.jsx)(ye,{gradient:(0,T.useMemo)(()=>be(i),[i]),easing:`gentle`,duration:1.5,spread:6,angle:106,pauseBetween:0,pauseOnScroll:!1,baseColor:`color-mix(in srgb, currentColor 45%, transparent)`,className:n,"data-testid":r,children:e})}var Se=400;function Ce(e,t,n){let[r,i]=(0,T.useState)(e),a=(0,T.useRef)(null),o=(0,T.useRef)(null),s=(0,T.useRef)(null);return(0,T.useEffect)(()=>{if(Object.is(r,e)){o.current=null;return}if(n){s.current&&=(clearTimeout(s.current),null),o.current=null,i(e),a.current=Date.now();return}o.current=e;let c=Date.now();a.current===null&&(a.current=c);let l=c-a.current,u=Math.max(0,t-l);return s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{o.current!==null&&(i(o.current),a.current=Date.now(),o.current=null),s.current=null},u),()=>{s.current&&=(clearTimeout(s.current),null)}},[e,r,t,n]),r}function we({currentStepTitle:e,currentStepInfo:t,bypassDwell:n=!1,animationKey:r,shimmer:a=!1,inline:o=!1}){let s=ne(),c=Ce((0,T.useMemo)(()=>({title:e,info:t}),[e,t]),Se,n),l=s?{duration:0}:{duration:.25,ease:[.16,1,.3,1]},u=s?{opacity:0}:{y:-16,opacity:0},d=s?{opacity:1}:{y:0,opacity:1},f=s?{opacity:0}:{y:16,opacity:0},p=typeof c.info==`string`||typeof c.info==`number`,m=p?String(c.info):c.info==null?``:`node`,h=r??`${c.title}::${m}`,g=p?c.info!==``:c.info!=null,_=c.title.trim()!==``;return(0,k.jsx)(te,{initial:!1,mode:`popLayout`,children:(0,k.jsxs)(ee.span,{initial:u,animate:d,exit:f,transition:l,className:`flex min-w-0 flex-1 items-center gap-1`,children:[_?o?(0,k.jsx)(`span`,{className:g?`shrink-0 whitespace-nowrap text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`:`block min-w-0 flex-1 truncate text-left text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`,children:a?(0,k.jsx)(A,{children:c.title}):c.title}):(0,k.jsx)(i,{variant:`body-medium-default`,className:g?`ml-1 shrink-0 whitespace-nowrap text-[var(--content-emphasised)]`:`ml-1 block min-w-0 flex-1 truncate text-left text-[var(--content-emphasised)]`,children:a?(0,k.jsx)(A,{children:c.title}):c.title}):null,g?(0,k.jsxs)(k.Fragment,{children:[_?(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`ml-1 h-3.5 w-px shrink-0 bg-[var(--border-element)]`}):null,p?o&&!_?(0,k.jsx)(`span`,{className:`block min-w-0 flex-1 truncate text-left text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`,children:a&&typeof c.info==`string`?(0,k.jsx)(A,{children:c.info}):c.info}):(0,k.jsx)(i,{variant:_?`body-small-default`:`body-medium-default`,className:`ml-1 block min-w-0 flex-1 truncate text-left leading-[16px] ${_?`text-[var(--content-tertiary)]`:`text-[var(--content-emphasised)]`}`,children:a&&!_&&typeof c.info==`string`?(0,k.jsx)(A,{children:c.info}):c.info}):(0,k.jsx)(`span`,{className:`ml-1 block min-w-0 flex-1`,children:c.info})]}):null]},h)})}var Te=/^https?:\/\/\S+/,Ee=/^URL:\s*(https?:\/\/\S+)/i,De=/^\[\d+\]\s*(https?:\/\/\S+)/;function j(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return``}}function Oe(e){let t=e.trim();return Ee.exec(t)?.[1]??De.exec(t)?.[1]??t}function ke(e){return e.trim().replace(/^\d+\.\s+/,``)}function Ae(e){let t=e.split(/\r?\n/),n=[],r=new Set,i=``;for(let e of t){let t=e.trim();if(!t){i=``;continue}let a=Oe(t);if(Te.test(a)){r.has(a)||(r.add(a),n.push({title:i,url:a})),i=``;continue}/^Web search results for /i.test(t)||/^Sources:?$/i.test(t)||(i=ke(t))}return n}function M(e){return!e||!e.trim()?[]:Ae(e).map((e,t)=>{let n=j(e.url);return{rank:t+1,title:e.title,url:e.url,domain:n}})}var N=5,P=new Set([`web_search`,`web_fetch`]);function F(e){if(!Number.isFinite(e)||e<1e3)return`<1s`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);return n<60?`${n}m`:`${Math.round(n/60)}h`}function I(e){return P.has(e.name)}function L(e){return e?`Searched the web`:`Searching the web`}function R(e){return{visible:e.slice(0,N),overflowResults:e.slice(N)}}function je(e,t){let{visible:n,overflowResults:r}=R(e.results);return{kind:`web_search`,title:L(t),durationLabel:F(e.durationMs),linkCount:e.resultCount,results:n,overflowResults:r}}function Me(e){let t=e.title??e.domain;return{kind:`thinking`,durationLabel:F(e.durationMs),text:`Reading ${t}`}}function Ne(){return{kind:`web_search`,title:`Searching the web`,durationLabel:``,linkCount:0,results:[]}}function Pe(){return{kind:`thinking`,durationLabel:``,text:`Reading…`}}function Fe(e){let t=M(e);if(t.length===0)return null;let{visible:n,overflowResults:r}=R(t);return{kind:`web_search`,title:L(!0),durationLabel:``,linkCount:t.length,results:n,overflowResults:r}}function Ie(e){return{kind:`web_search_error`,title:`Web search failed`,durationLabel:F(e.durationMs),errorMessage:e.errorMessage??`Search is having trouble right now. You can try again in a moment, continue without web search, or paste the relevant details here and I'll use those.`}}function z(){return{kind:`web_search`,title:L(!0),durationLabel:``,linkCount:0,results:[]}}function B(e,t){return t[e.id]??e.activityMetadata}function V(e){return!S(e)}function H(e,t){return e.results.length>0?!1:!!e.errorMessage||!!t.isError}function U(e){return e.confirmationDecision===`denied`||e.confirmationDecision===`timed_out`?`denied`:e.isError?`error`:S(e)?`running`:`completed`}function W(e,t){return e==null||t==null?null:Math.max(0,t-e)}function G(e,t){let n=W(e,t);return n==null?``:F(n)}function K(e){return G(e.startedAt??void 0,e.completedAt??void 0)}function Le(e){return!l(e)&&S(e)}function Re(e,t){if(e.kind===`thinking`)return e.text?e.completedAt==null?e.startedAt!=null&&t!=null?Math.max(0,t-e.startedAt):null:W(e.startedAt,e.completedAt):null;let n=e.toolCall;if(l(n))return null;let r=x(n);return n.completedAt==null?S(n)&&r!=null&&t!=null?Math.max(0,t-r):null:W(r,n.completedAt)}function ze(e){return e.some(e=>e.kind===`thinking`?!!e.text&&e.startedAt!=null&&e.completedAt==null:Le(e.toolCall))}function Be(e,t){let n=0,r=!1;for(let i of e){let e=Re(i,t);e!=null&&(r=!0,n+=e)}return r?F(n):``}function Ve(e){let{title:t,activity:n}=s(e);return{toolCallId:e.id,toolName:e.name,title:t,activity:n,input:e.input??{},result:e.result,streamedOutput:e.streamedOutput,status:U(e),riskLevel:e.riskLevel,riskReason:e.riskReason,durationLabel:K(e)}}function He(e){let{title:t,info:n,activity:r,iconName:i}=s(e);return{kind:`tool`,durationLabel:K(e),startedAt:e.startedAt??void 0,title:t,info:n,activity:r,riskLevel:e.riskLevel,iconName:i,toolCallId:e.id,status:U(e)}}function Ue(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(I(r)){let e=B(r,t),n=V(r);if(e?.webSearch&&H(e.webSearch,r))return`Web search failed`;if(r.name===`web_search`)return L(n);if(r.name===`web_fetch`)return`Thinking`}else return s(r).title}return``}function We(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(!I(r)){let{info:e,activity:t}=s(r);return t||e}let i=B(r,t),a=V(r);if(i?.webSearch){let e=i.webSearch;if(H(e,r))return e.errorMessage??`Search is having trouble right now. You can try again in a moment, continue without web search, or paste the relevant details here and I'll use those.`;if(e.results.length>0)return e.results[e.results.length-1].title;if(!a&&e.query)return`Searching ${e.query}`}if(i?.webFetch){let e=i.webFetch;return a?e.title??e.domain:`Reading ${e.domain}`}if(r.name===`web_search`){if(!a){let e=typeof r.input?.query==`string`?r.input.query.trim():``;return e?`Searching ${e}`:``}if(typeof r.result==`string`){let e=M(r.result);if(e.length>0){let t=e[e.length-1].title;if(t)return t}}}if(r.name===`web_fetch`){let e=typeof r.input?.url==`string`?r.input.url:``,t=e?j(e):``;if(t)return a?t:`Reading ${t}`}}return``}function Ge(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.name!==`web_search`)continue;let i=B(r,t)?.webSearch?.results;if(i&&i.length>0)return i}return[]}function Ke(e){return e.includes(`denied`)?`denied`:e.includes(`loading`)?`loading`:e.includes(`error`)?`error`:`complete`}function qe(e){return Ke(e.map(e=>e.confirmationDecision===`denied`||e.confirmationDecision===`timed_out`?`denied`:S(e)?`loading`:e.isError?`error`:`complete`))}function Je(e,t){if(l(e))return null;if(!I(e))return He(e);let n=B(e,t),r=V(e);if(n?.webSearch){let t=n.webSearch;return H(t,e)?Ie(t):je(t,r)}return n?.webFetch?Me(n.webFetch):r?e.name===`web_search`&&typeof e.result==`string`?Fe(e.result)??z():z():e.name===`web_search`?Ne():Pe()}function Ye(e,t,n){let r=e.filter(e=>e.kind===`toolCall`).map(e=>e.toolCall).filter(e=>!l(e)),i=[],a=null,o=0;for(let n of e){if(n.kind===`thinking`){n.text&&(i.push({kind:`thinking`,durationLabel:G(n.startedAt,n.completedAt),text:n.text,startedAt:n.startedAt,completedAt:n.completedAt,thinkingItemIndex:o++}),a=n.text);continue}let e=Je(n.toolCall,t);e&&(i.push(e),a=null)}let s=qe(r),c,u,d;a===null?(c=Ue(r,t),u=We(r,t),d=`tool`):(c=`Thinking`,u=a,d=`thinking`);let f=Ge(r,t),p=`${i.length} step${i.length===1?``:`s`}`,m=Be(e,n);return{currentStepTitle:c,currentStepInfo:u,currentStepKind:d,stepCount:p,totalDurationLabel:m,steps:i,state:s,carouselItems:f}}var q={code:m,terminal:a,file:h,globe:g,pen:c,monitor:_,plug:u,sparkle:v,"user-plus":y,bolt:o,brain:d};function Xe(e){if(e.kind===`thinking`)return`Thinking`;if(e.kind===`web_search`||e.kind===`web_search_error`)return`Searching the web`;if(e.kind===`tool_error`)return`Error`;let t=e.title;return t.startsWith(`Working`)?t:t===`Reading`||t===`Editing`||t.startsWith(`Running`)?`Working`:t===`Using a skill`?`Using a skill`:(t.startsWith(`Using `),t)}function Ze(e){if(!e||e===`<1s`)return 0;let t=/^(\d+)(s|m|h)$/.exec(e);if(!t)return 0;let n=Number(t[1]);switch(t[2]){case`h`:return n*36e5;case`m`:return n*6e4;default:return n*1e3}}function Qe(e){let t=null;for(let n of e)(n.kind===`tool`||n.kind===`thinking`)&&n.startedAt!=null&&(t=t==null?n.startedAt:Math.min(t,n.startedAt));return t}function $e(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`,second:`2-digit`})}function et({durationLabel:e,startedAt:t}){let r=(0,k.jsx)(i,{variant:`label-medium-default`,className:`text-[var(--content-tertiary)]`,children:e});return t==null?r:(0,k.jsx)(n,{content:`Started at ${$e(t)}`,side:`top`,align:`end`,children:(0,k.jsx)(`span`,{className:`cursor-default`,children:r})})}function J(e){let t=0,n=!1;for(let r of e)r&&(n=!0,t+=Ze(r));return n?F(t):``}function Y(e){if(e.length===0)return`running`;for(let t of e){if(t.kind===`tool`){if(t.status===`running`)return`running`;continue}if(t.kind===`web_search`&&t.title===`Searching the web`)return`running`}return`completed`}function tt(e){let t=[];for(let n of e){let e=Xe(n),r=t[t.length-1];r&&r.label===e?r.steps.push(n):t.push({label:e,steps:[n]})}return t}function nt({steps:e,renderStep:t,timeline:n=!1}){if(e.length===0)return null;let r=tt(e),i=[],a=0;for(let e of r)i.push(a),a+=e.steps.length;let o=(e,n)=>e.steps.map((e,r)=>{let i=st(e,n+r);return(0,k.jsx)(T.Fragment,{children:t?t(e):(0,k.jsx)(ut,{step:e})},i)});return n?(0,k.jsx)(`div`,{className:`flex w-full flex-col`,children:r.map((e,t)=>(0,k.jsx)(rt,{section:e,baseIndex:i[t],isLast:t===r.length-1,renderSectionSteps:o},`${e.label}-${t}`))}):(0,k.jsx)(`div`,{className:`flex w-full flex-col gap-3`,children:r.map((e,t)=>{let n=J(e.steps.map(e=>`durationLabel`in e?e.durationLabel:``)),r=Y(e.steps),a=i[t];return(0,k.jsxs)(`div`,{"data-testid":`phase-section`,"data-phase-label":e.label,className:`flex flex-col gap-1`,children:[(0,k.jsx)(ct,{label:e.label,durationLabel:n,status:r}),(0,k.jsx)(`div`,{className:`flex min-w-0 flex-col items-start gap-1 pl-[24px]`,children:o(e,a)})]},`${e.label}-${t}`)})})}function rt({section:e,baseIndex:t,isLast:n,renderSectionSteps:r}){let a=J(e.steps.map(e=>`durationLabel`in e?e.durationLabel:``)),o=Y(e.steps),s=e.steps[0]?.kind===`thinking`;return(0,k.jsxs)(`div`,{"data-testid":`phase-section`,"data-phase-label":e.label,className:`relative flex flex-col gap-2`,children:[!n&&(0,k.jsx)(it,{}),(0,k.jsxs)(`div`,{"data-testid":`phase-header`,className:`flex items-center justify-between gap-2 py-[2px]`,children:[(0,k.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,k.jsx)(at,{status:o,isThinking:s}),(0,k.jsx)(i,{variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e.label})]}),a?(0,k.jsx)(et,{durationLabel:a,startedAt:Qe(e.steps)}):null]}),(0,k.jsx)(`div`,{className:C(`flex min-w-0 flex-col items-start gap-1 pl-[22px]`,!n&&`pb-3`),children:r(e,t)})]})}function it({className:e}){return(0,k.jsx)(`div`,{"aria-hidden":!0,className:C(`absolute bottom-0 left-[6.5px] top-6 w-px bg-[var(--border-subtle)]`,e)})}function at({status:e,isThinking:t}){return t?(0,k.jsx)(d,{"aria-hidden":`true`,"data-testid":`phase-header-status-icon`,"data-status":`thinking`,className:`h-[14px] w-[14px] shrink-0 text-[var(--content-secondary)]`}):(0,k.jsx)(ot,{status:e,testId:`phase-header-status-icon`})}function ot({status:e,testId:t}){return e===`completed`?(0,k.jsx)(p,{"aria-hidden":`true`,"data-testid":t,"data-status":`completed`,className:`h-[14px] w-[14px] shrink-0 text-[var(--system-positive-strong)]`}):(0,k.jsx)(w,{"data-testid":t,className:`shrink-0`})}function st(e,t){return e.kind===`tool`&&e.toolCallId?e.toolCallId:`${e.kind}-${t}`}function ct({label:e,durationLabel:t,status:n}){return(0,k.jsxs)(`div`,{"data-testid":`phase-header`,className:`flex items-center justify-between py-[2px]`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-1`,children:[n===`completed`?(0,k.jsx)(f,{"aria-hidden":`true`,"data-testid":`phase-header-status-icon`,"data-status":`completed`,className:`h-[14px] w-[14px] text-[var(--system-positive-strong)]`}):(0,k.jsx)(w,{"data-testid":`phase-header-status-icon`,className:`shrink-0`}),(0,k.jsx)(i,{variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]}),t?(0,k.jsx)(i,{variant:`label-medium-default`,className:`text-[var(--content-tertiary)]`,children:t}):null]})}function lt(e){switch(e.kind){case`thinking`:return!0;case`tool`:return e.info.length>0;case`tool_error`:case`web_search_error`:case`web_search`:return!0}}function ut({step:e}){if(e.kind===`thinking`)return(0,k.jsx)(Z,{children:(0,k.jsx)(X,{children:e.text})});if(e.kind===`tool`){let t=q[e.iconName]??o;return lt(e)?(0,k.jsxs)(Z,{children:[(0,k.jsx)(t,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-secondary)]`}),(0,k.jsx)(X,{children:e.info})]}):null}return e.kind===`tool_error`?(0,k.jsx)(Z,{children:(0,k.jsx)(X,{children:e.message})}):e.kind===`web_search_error`?(0,k.jsx)(Z,{children:(0,k.jsx)(X,{children:e.errorMessage})}):(0,k.jsx)(Z,{children:(0,k.jsx)(X,{children:e.title})})}function X({children:e}){return(0,k.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit`,children:e})}function Z({children:e}){return(0,k.jsx)(`div`,{"data-testid":`phase-step-pill`,className:`inline-flex min-w-0 max-w-full items-center gap-1 self-start rounded-full border border-[var(--border-element)] bg-transparent px-2 py-1 text-[var(--content-default)]`,children:e})}var Q=`inline-flex min-w-0 items-center gap-1 self-start rounded-full px-2 py-1 text-left leading-normal`,dt=`transition-colors cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--border-focus)]`,ft=`bg-[var(--surface-overlay)] text-[var(--content-default)]`;function pt({faviconUrl:e,domain:t,label:n}){let[r,i]=(0,T.useState)(!1),a=!!e&&!r,o=(t&&t.length>0?t:n).charAt(0).toUpperCase();return(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)]`,children:a?(0,k.jsx)(`img`,{src:e,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>i(!0)}):(0,k.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-tertiary)]`,children:o})})}function mt({label:e,url:t,faviconUrl:n,domain:r,ariaLabel:a}){return(0,k.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,"data-testid":`tool-step-pill`,"data-variant":`web`,"aria-label":a??`Open ${e}`,className:`${Q} ${dt} max-w-[240px] no-underline hover:bg-[var(--surface-active)] ${ft}`,children:[(0,k.jsx)(pt,{faviconUrl:n,domain:r,label:e}),(0,k.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit leading-normal`,children:e})]})}function $(e){if(e.variant===`web`)return(0,k.jsx)(mt,{...e});let{iconName:t,label:n,onClick:r,active:a=!1,ariaLabel:s}=e,c=a?`bg-[var(--surface-active)] text-[var(--content-default)]`:ft,l=(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(q[t]??o,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-tertiary)]`}),(0,k.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit leading-normal`,children:n})]});return r?(0,k.jsx)(`button`,{type:`button`,"data-testid":`tool-step-pill`,"data-active":a?``:void 0,"aria-pressed":a,"aria-label":s??`View details: ${n}`,onClick:r,className:`${Q} ${dt} max-w-full hover:bg-[var(--surface-active)] ${c}`,children:l}):(0,k.jsx)(`span`,{"data-testid":`tool-step-pill`,className:`${Q} max-w-full ${c}`,children:l})}function ht(e){let t=(e.domain&&e.domain.length>0?e.domain:e.title).charAt(0);return t?t.toUpperCase():``}function gt({item:e}){let[t,n]=(0,T.useState)(!1),r=!!e.faviconUrl&&!t;return(0,k.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 rounded-[var(--radius-md)] px-2 py-1.5 hover:bg-[var(--surface-hover)]`,children:[(0,k.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex h-[14px] w-[14px] shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)] bg-[var(--surface-overlay)]`,children:r?(0,k.jsx)(`img`,{src:e.faviconUrl,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>n(!0)}):(0,k.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-default)]`,children:ht(e)})}),(0,k.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,k.jsx)(i,{variant:`body-small-default`,className:`truncate text-[var(--content-default)]`,children:e.title}),(0,k.jsx)(i,{variant:`body-small-default`,className:`truncate text-[var(--content-secondary)]`,children:e.domain})]})]})}function _t({results:e}){return(0,k.jsxs)(b.Root,{children:[(0,k.jsx)(b.Trigger,{asChild:!0,children:(0,k.jsx)(`button`,{type:`button`,"data-testid":`web-search-overflow-chip`,className:`inline-flex min-h-[26px] cursor-pointer items-center rounded-[var(--radius-pill)] bg-[var(--surface-base)] px-[10px] py-[6px] outline-none hover:bg-[var(--surface-hover)] focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:(0,k.jsxs)(i,{variant:`body-small-default`,className:`text-[var(--content-default)]`,children:[`+`,e.length,` more`]})})}),(0,k.jsx)(b.Content,{align:`start`,side:`bottom`,className:`flex max-h-[260px] w-[280px] flex-col gap-0.5 overflow-y-auto`,children:e.map(e=>(0,k.jsx)(gt,{item:e},e.rank))})]})}function vt({message:e}){return(0,k.jsx)(`div`,{"data-testid":`web-search-error-chip`,className:`inline-flex items-center gap-1 rounded-[var(--radius-pill)] border border-[var(--border-element)] bg-transparent px-[10px] py-[6px]`,children:(0,k.jsx)(i,{variant:`body-small-default`,className:`text-[var(--content-default)]`,children:e})})}function yt({step:e}){let t=e.overflowResults??[];return(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(e.results??[]).map(e=>(0,k.jsx)($,{variant:`web`,url:e.url,faviconUrl:e.faviconUrl,domain:e.domain,label:e.title},e.rank)),t.length>0?(0,k.jsx)(_t,{results:t}):null]})}function bt({step:e}){return(0,k.jsx)(vt,{message:e.errorMessage})}function xt({faviconUrl:e,domain:t,title:n,className:r}){let[i,a]=(0,T.useState)(!1);(0,T.useEffect)(()=>{a(!1)},[e]);let o=!!e&&!i,s=(t&&t.length>0?t:n).charAt(0).toUpperCase();return(0,k.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`site-favicon`,className:C(`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)]`,r),children:o?(0,k.jsx)(`img`,{src:e,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>a(!0)}):(0,k.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-tertiary)]`,children:s})})}export{A as C,we as S,F as _,ut as a,j as b,it as c,Y as d,st as f,Ye as g,P as h,$ as i,at as l,J as m,bt as n,q as o,lt as p,yt as r,nt as s,xt as t,tt as u,ze as v,M as x,Ve as y};