@vellumai/web 0.10.11-dev.202607221933.baa2119 → 0.10.11-dev.202607222129.31c06e5

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 (232) hide show
  1. package/dist/assets/{AnimatePresence-C8APSgIu.js → AnimatePresence-C42g9zWi.js} +3 -3
  2. package/dist/assets/{BundleConfirmPage-DNYvq-iC.js → BundleConfirmPage-3mylM4ZL.js} +1 -1
  3. package/dist/assets/{Combination-CRZ7Bg3f.js → Combination-DXrVEfaA.js} +1 -1
  4. package/dist/assets/{about-page-XGv9RAQu.js → about-page-CDdCEGZl.js} +1 -1
  5. package/dist/assets/{account-page-BTuXazxB.js → account-page-CzZuoekz.js} +1 -1
  6. package/dist/assets/{account-shell-CGkhTBfc.js → account-shell-Bw5tLjak.js} +1 -1
  7. package/dist/assets/{acp-run-detail-panel-MmrH2dwd.js → acp-run-detail-panel-DssICbn8.js} +4 -4
  8. package/dist/assets/{activity-steps-panel-CTrABRV1.js → activity-steps-panel-CeLVlAeY.js} +1 -1
  9. package/dist/assets/{add-credits-modal-F52jjB45.js → add-credits-modal-BFTdUmH6.js} +1 -1
  10. package/dist/assets/ai-page-ukSnDSJr.js +1 -0
  11. package/dist/assets/{animated-avatar-D36iTfMF.js → animated-avatar-6bSYRHZr.js} +1 -1
  12. package/dist/assets/{api-DkdVwOxT.js → api-CxAtNZ-r.js} +1 -1
  13. package/dist/assets/api-DqHVnn1b.js +1 -0
  14. package/dist/assets/{api-key-screen-Cr6tOl8S.js → api-key-screen-DD_TJKco.js} +1 -1
  15. package/dist/assets/{assistant-feature-flag-store-DuuDCLuS.js → assistant-feature-flag-store-Bh-_qc7v.js} +1 -1
  16. package/dist/assets/{assistant-status-panel-BhJkFBTi.js → assistant-status-panel-gpwr0glD.js} +1 -1
  17. package/dist/assets/auth-store-Lzg3kiaw.js +2 -0
  18. package/dist/assets/{background-task-detail-panel-_Bw4wSRH.js → background-task-detail-panel-BCXH3MXV.js} +1 -1
  19. package/dist/assets/billing-page-BZwgqWS1.js +3 -0
  20. package/dist/assets/{bookmarks-page-BhNbOYSg.js → bookmarks-page-B-PbfvFN.js} +1 -1
  21. package/dist/assets/{browser-CUpmd8oz.js → browser-Cvy3lr__.js} +2 -2
  22. package/dist/assets/{build-state-IyDyesd2.js → build-state-Bo2Ut5Js.js} +1 -1
  23. package/dist/assets/button-CW7wKp2r.js +1 -0
  24. package/dist/assets/{card-D8zyWtZh.js → card-Cf8bWrcq.js} +1 -1
  25. package/dist/assets/{channels-page-route-Ca1iWSkL.js → channels-page-route-DEwl411M.js} +2 -2
  26. package/dist/assets/chat-CNlH625o.js +1 -0
  27. package/dist/assets/chat-markdown-message-CjK8FRpm.js +2 -0
  28. package/dist/assets/{checkbox-1DytZ46G.js → checkbox-D5aqx2QZ.js} +1 -1
  29. package/dist/assets/{client-feature-flag-store-BI4z6UOY.js → client-feature-flag-store-BOcAh56y.js} +1 -1
  30. package/dist/assets/{command-palette-C18hRHXB.js → command-palette-DNujIsf0.js} +1 -1
  31. package/dist/assets/{command-palette-window-page-Bs7nyUOe.js → command-palette-window-page-mWNMMe4I.js} +1 -1
  32. package/dist/assets/{community-page-Bf7YWY7S.js → community-page-DEcDCjsQ.js} +1 -1
  33. package/dist/assets/{confirm-dialog-Zyfei9GV.js → confirm-dialog-DxBl6zcI.js} +1 -1
  34. package/dist/assets/{connect-page-BPS-ZbTc.js → connect-page-DuBhY8KD.js} +1 -1
  35. package/dist/assets/{consent-controls-a3lLNrbR.js → consent-controls-HYKKj225.js} +1 -1
  36. package/dist/assets/contacts-page-route-BS2duMoh.js +1 -0
  37. package/dist/assets/{credential-entry-page-Bo9MyWJX.js → credential-entry-page-CVOU9a8m.js} +1 -1
  38. package/dist/assets/{credentials-page-DZTud37s.js → credentials-page-DDgYexAA.js} +1 -1
  39. package/dist/assets/{debug-page-CXd4HoJ7.js → debug-page-B_us491I.js} +3 -3
  40. package/dist/assets/{deploy-dialogs-B2KiWrEe.js → deploy-dialogs-CB5PSyxZ.js} +1 -1
  41. package/dist/assets/{detail-card-BXVPDa5J.js → detail-card-CAHT277C.js} +1 -1
  42. package/dist/assets/{detail-panel-stop-button-ChKf-46C.js → detail-panel-stop-button-26G26Tqs.js} +1 -1
  43. package/dist/assets/developer-page-Dqug_k0U.js +1 -0
  44. package/dist/assets/{dictation-overlay-page-CZRUD9qJ.js → dictation-overlay-page-Rz3bqW3f.js} +1 -1
  45. package/dist/assets/{dist-Krx5xY9z.js → dist-B_4-HXSm.js} +1 -1
  46. package/dist/assets/{dist-y8XVYHzD.js → dist-D7fbUVVD.js} +1 -1
  47. package/dist/assets/{dist-CO5a5--H.js → dist-V7BKcICH.js} +1 -1
  48. package/dist/assets/{dist-Cul7ysiV.js → dist-kYT5dDAe.js} +1 -1
  49. package/dist/assets/{document-viewer-page-cHXNfErr.js → document-viewer-page-DmHPShuz.js} +1 -1
  50. package/dist/assets/{dropdown-BxYrCXBS.js → dropdown-DQozlhbb.js} +1 -1
  51. package/dist/assets/{emails-page-DgmWq23T.js → emails-page-s9TxP6jP.js} +1 -1
  52. package/dist/assets/{esm-CtFJECNT.js → esm-BGZHdoYP.js} +2 -2
  53. package/dist/assets/{esm-BvREcXsb.js → esm-CZhfXk6a.js} +2 -2
  54. package/dist/assets/{esm-CABHbixu.js → esm-Da6ZHZYd.js} +2 -2
  55. package/dist/assets/{esm-u9ag4ek2.js → esm-DcTPJLRl.js} +2 -2
  56. package/dist/assets/esm-LOX7qY3n.js +2 -0
  57. package/dist/assets/{esm-Dy0d6BZB.js → esm-hFTNI1fw.js} +2 -2
  58. package/dist/assets/feature-flag-catalog-W5kYlNH2.js +1 -0
  59. package/dist/assets/{file-editor-CmUOlTjl.js → file-editor-BdFicqX_.js} +1 -1
  60. package/dist/assets/{file-markdown-BXMDJYDD.js → file-markdown-BCMtcYze.js} +1 -1
  61. package/dist/assets/{general-page-BVWKFUsd.js → general-page-DsrG3cM2.js} +1 -1
  62. package/dist/assets/{haptics-CXVXviY1.js → haptics-ThOnpgA-.js} +2 -2
  63. package/dist/assets/{hatching-screen-DPCeV75d.js → hatching-screen-CuzULcU_.js} +1 -1
  64. package/dist/assets/home-page-route-Cc3ksf3X.js +1 -0
  65. package/dist/assets/{hosting-screen-Cb6yCWrz.js → hosting-screen-DufVMlwF.js} +1 -1
  66. package/dist/assets/identity-page-route-CUrEsO_0.js +7 -0
  67. package/dist/assets/index-BRSW3eiH.css +2 -0
  68. package/dist/assets/index-C7ix_asE.js +217 -0
  69. package/dist/assets/{input-ZpyYt_a0.js → input-D3MhHg0d.js} +1 -1
  70. package/dist/assets/{inspect-page-DMtLyfeS.js → inspect-page-BUAbv6xj.js} +4 -4
  71. package/dist/assets/{integrations-page-CB4Tc_d1.js → integrations-page-9JcrAORp.js} +1 -1
  72. package/dist/assets/{intelligence-layout-CxxCLiFO.js → intelligence-layout-DJjUScCy.js} +1 -1
  73. package/dist/assets/{library-detail-page-IhOT4Jph.js → library-detail-page-BCAZmbR6.js} +1 -1
  74. package/dist/assets/{library-page-BpHOV3jv.js → library-page-CiTHHvZ5.js} +1 -1
  75. package/dist/assets/{list-row-CFyYr-FU.js → list-row-CVw67M2Z.js} +1 -1
  76. package/dist/assets/{login-flow-xM94yfZy.js → login-flow-DYrO-od6.js} +1 -1
  77. package/dist/assets/{login-page-hM0g8LFI.js → login-page-DAFzFbRp.js} +1 -1
  78. package/dist/assets/{logout-page-CNz1LTSY.js → logout-page-CsPkQ-4I.js} +1 -1
  79. package/dist/assets/{logs-layout-DioKpdeF.js → logs-layout-DBJaWlOK.js} +1 -1
  80. package/dist/assets/memory-page-route-CpPfBU9j.js +2 -0
  81. package/dist/assets/{memory-router-playground-page-BCfQ2zWi.js → memory-router-playground-page-DfGhXcZW.js} +1 -1
  82. package/dist/assets/{menu-C9SOvGlk.js → menu-DSB0wFjY.js} +1 -1
  83. package/dist/assets/{metric-card-DDHse5we.js → metric-card-TrndloL3.js} +1 -1
  84. package/dist/assets/{misc-D0u5tzSd.js → misc-BMp6WHdm.js} +1 -1
  85. package/dist/assets/{mobile-sidebar-drawer-D9v0PpYI.js → mobile-sidebar-drawer-CVT3O8os.js} +1 -1
  86. package/dist/assets/{modal-BtcwNEBj.js → modal-D_Y2RPD5.js} +1 -1
  87. package/dist/assets/mutation-error-CSy2D6ry.js +1 -0
  88. package/dist/assets/native-anchor-ChGbTnsU.js +1 -0
  89. package/dist/assets/{native-file-CIQQYbIp.js → native-file-CKFw72Il.js} +2 -2
  90. package/dist/assets/{notice-DkAWz47A.js → notice-CvJ7MBx5.js} +1 -1
  91. package/dist/assets/{notifications-page-BS2GmBjD.js → notifications-page-DcHyVoSk.js} +1 -1
  92. package/dist/assets/{oauth-complete-page-mxqE6rCA.js → oauth-complete-page-DjKBNbdN.js} +1 -1
  93. package/dist/assets/{oauth-popup-complete-page-Cpf2kPNU.js → oauth-popup-complete-page-2KKVC5zM.js} +1 -1
  94. package/dist/assets/{page-empty-state-Co5e7lOF.js → page-empty-state-DhwyXbFT.js} +1 -1
  95. package/dist/assets/{page-shell-CAoXXReY.js → page-shell-BUD21prh.js} +1 -1
  96. package/dist/assets/{pairing-page-DNPxREzR.js → pairing-page-7NMcVDJj.js} +1 -1
  97. package/dist/assets/{panel-item-An-BBeyL.js → panel-item-D1WbMkez.js} +1 -1
  98. package/dist/assets/{personality-page-Ce_Qm2cp.js → personality-page-CwaMBzXV.js} +1 -1
  99. package/dist/assets/plans-page-Cre3Gpys.js +1 -0
  100. package/dist/assets/{platform-loopback-page-DRElW55V.js → platform-loopback-page-CIcVs3UP.js} +1 -1
  101. package/dist/assets/{plugin-detail-page-DAlLoybE.js → plugin-detail-page-R7HOcOd1.js} +1 -1
  102. package/dist/assets/{popover-Bl6742nZ.js → popover-BglbovUA.js} +1 -1
  103. package/dist/assets/privacy-page-CTQpOjs-.js +1 -0
  104. package/dist/assets/{privacy-screen-C05Qf8-3.js → privacy-screen-DgHmBdN-.js} +1 -1
  105. package/dist/assets/{progress-bar-Bqv7D4mZ.js → progress-bar-DrwFU9Ti.js} +1 -1
  106. package/dist/assets/{provider-callback-page-7lCx-5li.js → provider-callback-page-kcYxB4WF.js} +1 -1
  107. package/dist/assets/{provider-signup-page-BMAi3lou.js → provider-signup-page-D9aI4WFt.js} +1 -1
  108. package/dist/assets/{proxy-BzlH_XAe.js → proxy-DoUA9mK6.js} +1 -1
  109. package/dist/assets/{quick-input-page-LVkv3KP4.js → quick-input-page-D2Bqa3St.js} +1 -1
  110. package/dist/assets/{research-mock-page-7srDoNvK.js → research-mock-page-C6zrZtBI.js} +1 -1
  111. package/dist/assets/research-onboarding-route-AYDHEowO.js +43 -0
  112. package/dist/assets/{review-terms-screen-Dsntd0nU.js → review-terms-screen-BSa9jNvG.js} +1 -1
  113. package/dist/assets/{risk-DIRsQZCZ.js → risk-C-ZyBTAb.js} +1 -1
  114. package/dist/assets/{schedules-page-ANwXBbHw.js → schedules-page-gqD1Tbf8.js} +1 -1
  115. package/dist/assets/{select-assistant-screen-Byptt05K.js → select-assistant-screen-CFvCmydl.js} +1 -1
  116. package/dist/assets/{setting-row-BL-mNsNh.js → setting-row-DbMFAasE.js} +1 -1
  117. package/dist/assets/settings-divider-RhnS0iml.js +1 -0
  118. package/dist/assets/{settings-layout-Cm34rPj8.js → settings-layout-XYxLMpW0.js} +1 -1
  119. package/dist/assets/share-feedback-modal-Bjh3dK-n.js +1 -0
  120. package/dist/assets/{shared-ui-BQzVwlXn.js → shared-ui-CUd8SsYi.js} +1 -1
  121. package/dist/assets/{sidebar-tree-DrzE0Jyv.js → sidebar-tree-CDqUGPSK.js} +1 -1
  122. package/dist/assets/{signup-page-CCUuskkM.js → signup-page-DgYRwrxX.js} +1 -1
  123. package/dist/assets/{signup-shell-C--ZjbjA.js → signup-shell-BXZMEgBY.js} +1 -1
  124. package/dist/assets/{site-favicon-DewrgH-a.js → site-favicon-DHBOONR1.js} +1 -1
  125. package/dist/assets/{skill-detail-page-D_PcInrM.js → skill-detail-page-Dnh8ep5N.js} +1 -1
  126. package/dist/assets/{skill-detail-panel-QoaxPpCX.js → skill-detail-panel-DIn7RLCC.js} +1 -1
  127. package/dist/assets/{skills-C7LCNEFA.js → skills-BFnEzvAC.js} +1 -1
  128. package/dist/assets/{src-BNYQ8guL.js → src-BT0gNVcT.js} +2 -2
  129. package/dist/assets/{start-screen-BWJii2no.js → start-screen-CJb-0lgs.js} +1 -1
  130. package/dist/assets/{subagent-detail-panel-BsPcIQ85.js → subagent-detail-panel-V44LtNl6.js} +1 -1
  131. package/dist/assets/{subagent-store-Dr3FrKiG.js → subagent-store-CPEG25fH.js} +1 -1
  132. package/dist/assets/superpowers-page-X0kSM_TF.js +1 -0
  133. package/dist/assets/{system-events-page-BARlmsdY.js → system-events-page-Duos2ubJ.js} +1 -1
  134. package/dist/assets/{tag-B6WeUtBW.js → tag-CJyI1Y2J.js} +1 -1
  135. package/dist/assets/{theme-stage-page-eXVxLFfi.js → theme-stage-page-BU-Gj4c2.js} +1 -1
  136. package/dist/assets/tier-upgrade-resize-modal-CbRtJhAf.js +1 -0
  137. package/dist/assets/{tiptap-document-editor-CM8rLP9w.js → tiptap-document-editor-D1aVS6nK.js} +2 -2
  138. package/dist/assets/{toast-Be8FEQ-I.js → toast-zHo1wvF9.js} +1 -1
  139. package/dist/assets/{toggle-QSEiPr3k.js → toggle-Ca1aoG-l.js} +1 -1
  140. package/dist/assets/{tool-detail-panel-BLLGFD3k.js → tool-detail-panel-C-O4opDs.js} +1 -1
  141. package/dist/assets/typography-1kyF_Eu1.js +1 -0
  142. package/dist/assets/{upgrade-cancel-page-BN873SsM.js → upgrade-cancel-page-UaVSwAVr.js} +1 -1
  143. package/dist/assets/{upgrade-success-page-DhPly3fp.js → upgrade-success-page-CBs03tVb.js} +1 -1
  144. package/dist/assets/{use-assistant-identity-details-D2HgphdP.js → use-assistant-identity-details-CKel0e_r.js} +1 -1
  145. package/dist/assets/{use-edge-swipe-back-DDRGGiWx.js → use-edge-swipe-back-Dv1ShCT7.js} +1 -1
  146. package/dist/assets/use-invite-link-dialog-BfVPh6F5.js +1 -0
  147. package/dist/assets/use-is-org-ready-Ba5vxuqM.js +1 -0
  148. package/dist/assets/{use-onboarding-login-DxALcEIP.js → use-onboarding-login-DMLLDHRX.js} +1 -1
  149. package/dist/assets/{use-reduced-motion-CcGT6CHV.js → use-reduced-motion-DpK6cQN-.js} +1 -1
  150. package/dist/assets/{use-skill-actions-_fTnRmQu.js → use-skill-actions-DPXX5qWL.js} +1 -1
  151. package/dist/assets/{use-skill-detail-files-DSYS5cni.js → use-skill-detail-files-CuoCiyOy.js} +1 -1
  152. package/dist/assets/voice-page-DdjI8A76.js +1 -0
  153. package/dist/assets/{weather-forecast-display-CuVMLDZg.js → weather-forecast-display-0GtxW555.js} +1 -1
  154. package/dist/assets/{web-C_RyjuPn.js → web-BgxqKmFT.js} +1 -1
  155. package/dist/assets/{web-D1Wdlc7e.js → web-TTULY5zV.js} +1 -1
  156. package/dist/assets/{welcome-screen-BsESWnlC.js → welcome-screen-DZhajJW3.js} +1 -1
  157. package/dist/assets/{workflow-detail-panel-Di6HXfLP.js → workflow-detail-panel-Cw0kRLTK.js} +1 -1
  158. package/dist/assets/workspace-page-7j1DZUlp.js +1 -0
  159. package/dist/index.html +52 -51
  160. package/package.json +1 -1
  161. package/dist/assets/ai-page-Cnqe_MF7.js +0 -1
  162. package/dist/assets/api-zOKpkRT4.js +0 -1
  163. package/dist/assets/auth-store-yYPy4QuG.js +0 -2
  164. package/dist/assets/billing-page-GwV110rl.js +0 -3
  165. package/dist/assets/button-BQVYX8n_.js +0 -1
  166. package/dist/assets/chat-BDhsGoUo.js +0 -1
  167. package/dist/assets/chat-markdown-message-DdvPHLTI.js +0 -2
  168. package/dist/assets/contacts-page-route-DvE4cWB1.js +0 -1
  169. package/dist/assets/developer-page-DuGuTkuS.js +0 -1
  170. package/dist/assets/esm-B-GaVjH1.js +0 -2
  171. package/dist/assets/feature-flag-catalog-XCUDf5iL.js +0 -1
  172. package/dist/assets/home-page-route-GRWsjnoO.js +0 -1
  173. package/dist/assets/identity-page-route-Cekp7lb1.js +0 -7
  174. package/dist/assets/index-CtMfDVgi.css +0 -2
  175. package/dist/assets/index-D5iUyXUl.js +0 -217
  176. package/dist/assets/memory-page-route-BChNkOHd.js +0 -2
  177. package/dist/assets/mutation-error-C9sr8Rue.js +0 -1
  178. package/dist/assets/plans-page-CyFzFPMf.js +0 -1
  179. package/dist/assets/privacy-page-CKLXEI25.js +0 -1
  180. package/dist/assets/research-onboarding-route-B4MdewsW.js +0 -43
  181. package/dist/assets/settings-divider-jsYVGphg.js +0 -1
  182. package/dist/assets/share-feedback-modal-Do56cx6v.js +0 -1
  183. package/dist/assets/superpowers-page-DttFOVF5.js +0 -1
  184. package/dist/assets/tier-upgrade-resize-modal-BTi56abH.js +0 -1
  185. package/dist/assets/typography-Cqi8q9o7.js +0 -1
  186. package/dist/assets/use-invite-link-dialog-B7jUrCaY.js +0 -1
  187. package/dist/assets/use-is-org-ready-CoKP2L8w.js +0 -1
  188. package/dist/assets/voice-page-D5c_WgX8.js +0 -1
  189. package/dist/assets/workspace-page-BAX94prH.js +0 -1
  190. /package/dist/assets/{a2a-invite-VS3p3CfD.js → a2a-invite-sGxHSsPS.js} +0 -0
  191. /package/dist/assets/{app-info-Clwt3pCt.js → app-info-DDWMarAq.js} +0 -0
  192. /package/dist/assets/{app-types-XM5qKBD0.js → app-types-CR9QB0-8.js} +0 -0
  193. /package/dist/assets/{archive-redirect-page-Brvq3ES5.js → archive-redirect-page-emWqj2aZ.js} +0 -0
  194. /package/dist/assets/{billing-redirect-page-B3C0OqCH.js → billing-redirect-page-BFcz_1bP.js} +0 -0
  195. /package/dist/assets/{build.umd-Cygy7skA.js → build.umd-CW7LiBLq.js} +0 -0
  196. /package/dist/assets/{contacts-gateway-C1Oif2mf.js → contacts-gateway-C1Yhfk72.js} +0 -0
  197. /package/dist/assets/{danger-zone-redirect-page-DjzXSO6Q.js → danger-zone-redirect-page-CKqC2kf5.js} +0 -0
  198. /package/dist/assets/{definitions-yU7UnVpH.js → definitions-BUCExH-9.js} +0 -0
  199. /package/dist/assets/{definitions-BEx8SBhF.js → definitions-DpZNNWA7.js} +0 -0
  200. /package/dist/assets/{devices-redirect-page-aDimdAFs.js → devices-redirect-page-BBmdT-cM.js} +0 -0
  201. /package/dist/assets/{emoji-catalog-data-D8lRMt3A.js → emoji-catalog-data-Do3FUA8t.js} +0 -0
  202. /package/dist/assets/{environment-store-R_3zZFKL.js → environment-store-geigPfHz.js} +0 -0
  203. /package/dist/assets/{esm-BhZb3XhL.js → esm-BNfE-1QY.js} +0 -0
  204. /package/dist/assets/{format-file-size-BSrdQr7P.js → format-file-size-B9DWgk-8.js} +0 -0
  205. /package/dist/assets/{get-memory-stats-KWGzIlTp.js → get-memory-stats-CswQQLY0.js} +0 -0
  206. /package/dist/assets/{keyboard-shortcuts-redirect-page-Cwga2alP.js → keyboard-shortcuts-redirect-page-BlXA_79i.js} +0 -0
  207. /package/dist/assets/{latest-assistant-text-BKts4hYK.js → latest-assistant-text-CQ8YGbvQ.js} +0 -0
  208. /package/dist/assets/{link-click-Cw5JZikw.js → link-click-B_ZqHynd.js} +0 -0
  209. /package/dist/assets/{onboarding-step-layout-2XcmxqFN.js → onboarding-step-layout-CEt9JOpN.js} +0 -0
  210. /package/dist/assets/{password-reset-page-BJ68aXQ5.js → password-reset-page-DzLdCWhJ.js} +0 -0
  211. /package/dist/assets/{pdf-aq5Mn3GZ.js → pdf-BFBTGjwO.js} +0 -0
  212. /package/dist/assets/{plugin-attribution-6W3_ulYk.js → plugin-attribution-meUNq3wV.js} +0 -0
  213. /package/dist/assets/{plugins-page-DbqKT2CS.js → plugins-page-CeEkVNFM.js} +0 -0
  214. /package/dist/assets/{profile-metadata-CMym5q9r.js → profile-metadata-C6i7Ro9a.js} +0 -0
  215. /package/dist/assets/{provider-key-ACM9xzKs.js → provider-key-BPINSkGG.js} +0 -0
  216. /package/dist/assets/{schedules-CqDlgP0M.js → schedules-CL3Ox7Jc.js} +0 -0
  217. /package/dist/assets/{security-redirect-page-x1aDP81r.js → security-redirect-page-DYh8CKKb.js} +0 -0
  218. /package/dist/assets/{skills-page-bdypLibR.js → skills-page-CX46pcIo.js} +0 -0
  219. /package/dist/assets/{sounds-redirect-page-Blt0vV_7.js → sounds-redirect-page-DfVvXEAS.js} +0 -0
  220. /package/dist/assets/{status-badge-pill-0N6rTEBg.js → status-badge-pill-j3ke1d9o.js} +0 -0
  221. /package/dist/assets/{system-events-redirect-page-CMriM4T-.js → system-events-redirect-page-BHASNLky.js} +0 -0
  222. /package/dist/assets/{three-dot-indicator-CwchtNVS.js → three-dot-indicator-BuZzHFUJ.js} +0 -0
  223. /package/dist/assets/{usage-redirect-page-CYLunqbd.js → usage-redirect-page-1zbr09t0.js} +0 -0
  224. /package/dist/assets/{use-copy-to-clipboard-D3nUm_6n.js → use-copy-to-clipboard-Ap1ESW2j.js} +0 -0
  225. /package/dist/assets/{web-DwtkFwhF.js → web-Cfu1-OYV.js} +0 -0
  226. /package/dist/assets/{web-DE01jWtm.js → web-CpMgd0X0.js} +0 -0
  227. /package/dist/assets/{web-D2t1-p2V.js → web-D5EBYCt2.js} +0 -0
  228. /package/dist/assets/{web-DNkvgjT6.js → web-DT7Uml3n.js} +0 -0
  229. /package/dist/assets/{web-DK4RzUrM.js → web-D_z4FjB0.js} +0 -0
  230. /package/dist/assets/{web-DoV8m3zw.js → web-F3CAps0-.js} +0 -0
  231. /package/dist/assets/{xterm-DUb6-aPw.js → xterm-BSc05cUt.js} +0 -0
  232. /package/dist/assets/{xterm-addon-fit-D82wciIP.js → xterm-addon-fit-CW_qH798.js} +0 -0
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./jsx-runtime-CVSDxk6A.js";import{t as r}from"./is-electron-y5bNUVyG.js";import{t as i}from"./public-asset-Cr86Gucv.js";import{Hs as a}from"./index-D5iUyXUl.js";var o=e(t(),1);async function s(e){r()&&await window.vellum?.quickInput?.submit(e)}async function c(){r()&&await window.vellum?.quickInput?.dismiss()}var l=n();function u(){let[e,t]=(0,o.useState)(``),n=(0,o.useRef)(null);(0,o.useEffect)(()=>{n.current?.focus()},[]);let r=(0,o.useCallback)(n=>{n.preventDefault();let r=e.trim();r&&(s(r),t(``))},[e]),u=(0,o.useCallback)(e=>{e.key===`Escape`&&(e.preventDefault(),c())},[]);return(0,l.jsx)(`div`,{className:`flex h-screen w-screen items-center justify-center bg-transparent p-2`,children:(0,l.jsxs)(`form`,{onSubmit:r,className:`flex w-full items-center gap-3 rounded-2xl border border-[var(--border-default)] bg-[var(--surface-base)] px-4 py-3 shadow-lg`,children:[(0,l.jsx)(`img`,{src:i(`/vellum-logo.svg`),alt:`Vellum`,width:24,height:24,className:`shrink-0 dark:hidden`,draggable:!1}),(0,l.jsx)(`img`,{src:i(`/vellum-logo-white.svg`),alt:`Vellum`,width:24,height:24,className:`hidden shrink-0 dark:block`,draggable:!1}),(0,l.jsx)(`input`,{ref:n,type:`text`,value:e,onChange:e=>t(e.target.value),onKeyDown:u,placeholder:`Ask Vellum anything...`,className:`min-w-0 flex-1 bg-transparent text-sm text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none`}),(0,l.jsx)(`button`,{type:`submit`,disabled:!e.trim(),className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-[var(--surface-accent)] text-[var(--content-on-accent)] transition-opacity disabled:opacity-30`,children:(0,l.jsx)(a,{size:16})})]})})}export{u as QuickInputPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./jsx-runtime-CVSDxk6A.js";import{t as r}from"./is-electron-y5bNUVyG.js";import{t as i}from"./public-asset-Cr86Gucv.js";import{Ws as a}from"./index-C7ix_asE.js";var o=e(t(),1);async function s(e){r()&&await window.vellum?.quickInput?.submit(e)}async function c(){r()&&await window.vellum?.quickInput?.dismiss()}var l=n();function u(){let[e,t]=(0,o.useState)(``),n=(0,o.useRef)(null);(0,o.useEffect)(()=>{n.current?.focus()},[]);let r=(0,o.useCallback)(n=>{n.preventDefault();let r=e.trim();r&&(s(r),t(``))},[e]),u=(0,o.useCallback)(e=>{e.key===`Escape`&&(e.preventDefault(),c())},[]);return(0,l.jsx)(`div`,{className:`flex h-screen w-screen items-center justify-center bg-transparent p-2`,children:(0,l.jsxs)(`form`,{onSubmit:r,className:`flex w-full items-center gap-3 rounded-2xl border border-[var(--border-default)] bg-[var(--surface-base)] px-4 py-3 shadow-lg`,children:[(0,l.jsx)(`img`,{src:i(`/vellum-logo.svg`),alt:`Vellum`,width:24,height:24,className:`shrink-0 dark:hidden`,draggable:!1}),(0,l.jsx)(`img`,{src:i(`/vellum-logo-white.svg`),alt:`Vellum`,width:24,height:24,className:`hidden shrink-0 dark:block`,draggable:!1}),(0,l.jsx)(`input`,{ref:n,type:`text`,value:e,onChange:e=>t(e.target.value),onKeyDown:u,placeholder:`Ask Vellum anything...`,className:`min-w-0 flex-1 bg-transparent text-sm text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none`}),(0,l.jsx)(`button`,{type:`submit`,disabled:!e.trim(),className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-[var(--surface-accent)] text-[var(--content-on-accent)] transition-opacity disabled:opacity-30`,children:(0,l.jsx)(a,{size:16})})]})})}export{u as QuickInputPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import"./button-BQVYX8n_.js";import{n,u as r}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{u as a}from"./routes-D4ff4ONd.js";import"./conversation-store-CnRrUeSu.js";import"./index-D5iUyXUl.js";var o=e(t(),1),s=i(),c=[{claim:`Software engineer based in Austin, TX`,confidence:`confident`,sources:[`https://github.com/example-dev`]},{claim:`Product engineer at an early-stage AI startup`,confidence:`confident`,sources:[`https://example.com/team`]},{claim:`Maintains an open-source CLI tool for local LLM evaluation and tooling`,confidence:`confident`,sources:[`https://github.com/example-dev`,`https://example.com/project`]},{claim:`Primarily writes TypeScript and Go`,confidence:`confident`,sources:[`https://github.com/example-dev`]},{claim:`Came up through a coding bootcamp rather than a CS degree`,confidence:`maybe`,sources:[]}];function l(){r();let[e,t]=(0,o.useState)(`results`),[i,l]=(0,o.useState)(()=>new Map);return c.map((e,t)=>({fact:e,index:t})),(0,s.jsx)(n,{to:a.assistant,replace:!0})}export{l as ResearchMockPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import"./button-CW7wKp2r.js";import{n,u as r}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{u as a}from"./routes-D4ff4ONd.js";import"./conversation-store-CnRrUeSu.js";import"./index-C7ix_asE.js";var o=e(t(),1),s=i(),c=[{claim:`Software engineer based in Austin, TX`,confidence:`confident`,sources:[`https://github.com/example-dev`]},{claim:`Product engineer at an early-stage AI startup`,confidence:`confident`,sources:[`https://example.com/team`]},{claim:`Maintains an open-source CLI tool for local LLM evaluation and tooling`,confidence:`confident`,sources:[`https://github.com/example-dev`,`https://example.com/project`]},{claim:`Primarily writes TypeScript and Go`,confidence:`confident`,sources:[`https://github.com/example-dev`]},{claim:`Came up through a coding bootcamp rather than a CS degree`,confidence:`maybe`,sources:[]}];function l(){r();let[e,t]=(0,o.useState)(`results`),[i,l]=(0,o.useState)(()=>new Map);return c.map((e,t)=>({fact:e,index:t})),(0,s.jsx)(n,{to:a.assistant,replace:!0})}export{l as ResearchMockPage};
@@ -0,0 +1,43 @@
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-anSemq95.js";import{t as n}from"./react-DJZBPgpf.js";import{P as r,t as i}from"./button-CW7wKp2r.js";import{m as a,u as o}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as s}from"./QueryClientProvider-DKhXIxGb.js";import{t as c}from"./useQuery-B45lW1Kk.js";import{t as l}from"./jsx-runtime-CVSDxk6A.js";import{t as u}from"./arrow-left-C2re-gYj.js";import{t as d}from"./loader-circle-Ck8fq3yv.js";import{t as f}from"./pencil-CsnkG5VN.js";import{t as p}from"./plus-DZZypDUF.js";import{t as m}from"./x-CswtfvgS.js";import{t as h}from"./tag-CJyI1Y2J.js";import{t as g}from"./input-D3MhHg0d.js";import{i as _,r as v,t as y}from"./dist-kYT5dDAe.js";import{n as b}from"./toast-zHo1wvF9.js";import{n as x,t as S}from"./create-selectors-8NePGNlX.js";import{ct as C,f as w,o as T,y as E}from"./local-mode-Dydd46cS.js";import{Gn as D,Or as O,Tr as k,V as A,Wn as j,bn as M,tt as N,xn as P}from"./sdk.gen-BR-xXIZm.js";import{r as ee}from"./api-errors-CoE1wFl2.js";import{A as F,B as te,L as I,R as ne,n as re,z as ie}from"./auth-store-Lzg3kiaw.js";import{a as L,o as ae,r as oe}from"./api-CxAtNZ-r.js";import{u as se}from"./routes-D4ff4ONd.js";import{n as ce}from"./platform-detection-BBQ3eUv5.js";import{a as le}from"./feature-flag-catalog-W5kYlNH2.js";import{o as ue,s as de}from"./prechat-mDxOfWth.js";import{t as fe}from"./browser-timezone-2SnmKDjM.js";import{c as pe}from"./conversation-list-fetchers-DKtnmlFF.js";import{i as me,n as he,r as ge,t as _e}from"./research-onboarding-persistence-C4LT0Ekr.js";import{t as R}from"./proxy-DoUA9mK6.js";import{t as ve}from"./AnimatePresence-C42g9zWi.js";import{t as z}from"./use-reduced-motion-DpK6cQN-.js";import{t as B}from"./animated-avatar-6bSYRHZr.js";import{An as ye,Br as be,Dn as xe,Fn as Se,Jn as V,Ks as H,Ln as Ce,Lo as we,Oa as Te,On as Ee,Os as De,Ra as Oe,Tn as U,Zo as ke,_n as W,_t as Ae,gn as je,hn as G,jn as Me,ka as Ne,kn as K,on as Pe,vn as Fe,vt as q,wn as J}from"./index-C7ix_asE.js";import{c as Ie,i as Le,l as Re,n as ze,r as Be,s as Ve,t as He}from"./latest-assistant-text-CQ8YGbvQ.js";import{n as Ue,t as We}from"./onboarding-step-layout-CEt9JOpN.js";import{n as Ge}from"./plugin-attribution-meUNq3wV.js";var Y=e(n(),1),Ke=`grounded`,qe=12;function Je(e,t){let n=e.slice(0,qe).map(e=>`- ${e.name} — ${e.description}`).join(`
2
+ `);return n?`
3
+ Capabilities you can offer me — specialized skillsets you can invoke on my behalf, not generic chat:
4
+ ${n}
5
+
6
+ Add a "plugins" array as the FIRST key in your JSON object, ${t?`before "claims" and "suggestions"`:`before "claims"`}: the 1-2 capabilities from the list above (exact names) that best fit who I am — judged by what you researched about my real role, stack, and day-to-day work. (Emit it first so setup can start while you finish the rest.) These get set up for me automatically as part of getting started, so pick by overall fit to ME, not to any single suggestion. Prefer fewer over forcing a match; use [] if nothing clearly fits. Example: "plugins": ["<exact name from the list above>"]. ${t?`Don't reference the setup in the claims or suggestions text.`:`Don't reference the setup in the claims text.`}
7
+ `:``}function Ye({firstName:e,lastName:t,occupation:n,hobbies:r,timezone:i},a=[],{includeSuggestions:o=!0}={}){let s=[e.trim(),t.trim()].filter(Boolean).join(` `),c=n.trim(),l=(r??[]).map(e=>e.trim()).filter(Boolean).join(`, `),u=i?.trim()??``,d=Je(a,o),f=d?`"plugins": ["<exact name from the list above>"], `:``,p=[s?`My name is ${s}.`:``,c?`I work as ${c}.`:``,l?`My hobby is ${l}.`:``].filter(Boolean).join(` `),m=p?[p,u?`My timezone is ${u}.`:``].filter(Boolean).join(` `):`I'd like you to get to know me before we start working together.`,h=o?` "suggestions": [ { "suggestion": "I'll find the 3 newest arXiv eval papers worth your time", "prompt": "Find me the 3 newest arXiv eval papers worth reading." }, { "suggestion": "I'll draft a crisp summary of the latest model-serving trade-offs", "prompt": "Draft me a short summary of the latest model-serving trade-offs." }, { "suggestion": "Connect GitHub and I'll triage your stalest issues", "prompt": "Connect to GitHub and triage my oldest open issues." }, { "suggestion": "I'll plan a weekend climbing trip near Boulder", "prompt": "Plan me a weekend climbing trip near Boulder." } ]`:``,g=`{ ${f}"claims": [ { "claim": "Senior engineer at an AI infra startup", "confidence": "confident", "sources": ["https://linkedin.com/in/example-user", "https://example-infra.com/about"] }, { "claim": "Based in Boulder, CO", "confidence": "maybe", "sources": ["https://linkedin.com/in/example-user"] }, { "claim": "Into climbing and the outdoors", "confidence": "guessing", "sources": [] } ]${h?`,${h}`:``} }`;return`${m}
8
+
9
+ Get to know me. Search the web for what's publicly known about me, and infer a handful of things about who I am: what I do, my role, where I'm based, what I'm into, anything that would help you assist me better. Prefer sources people author about themselves — LinkedIn, a personal site, GitHub, an employer's team page, published work, public social profiles. Never fetch or cite people-search or background-check aggregators (Instant Checkmate, Spokeo, BeenVerified, TruePeopleSearch, Whitepages, and similar); data-broker directories (ZoomInfo, RocketReach, Apollo) may corroborate another source but must never be a claim's only basis.
10
+
11
+ IDENTITY GATE — decide who a page is about before you use it: a name match alone is NEVER enough to attribute a page to me. Attribute it to me only when it also corroborates something I stated — my role, my hobby, or a location consistent with my timezone if I gave one. If several people share my name and none clears that bar, or you find no verifiable match at all, then I have no public profile you can use: return ONLY inferences from what I stated above, each labeled "guessing" with "sources": []. An honest near-empty card beats a stranger's biography. If my details above read as placeholder or joke input rather than a real identity, skip the web search and return an empty claims array.
12
+
13
+ Treat the name, role, and hobby I provided above as first-party context from me. Use public sources to enrich that context, not to override or correct it. If public sources use a different title or omit part of my stated role, do not frame my stated role as wrong; mention the public title only as supporting nuance when it is useful, and keep ${o?`claims and suggestions`:`claims`} aligned with my stated role.
14
+
15
+ CRITICAL: your final reply must be ONLY a JSON object. No preamble, no explanation, no prose, nothing before or after it. Do your thinking and searching, then respond with exactly this shape and nothing else:
16
+
17
+ ${g}
18
+
19
+ Rules for "claims":
20
+
21
+ AT MOST 5 claims, typically 3 to 4. Never pad the list or inflate a confidence tier to seem thorough.
22
+ Phrase each claim in third person as a short headline ("Senior engineer at an AI infra startup", "Based in Boulder, CO", "Active climber on Mountain Project"). No multi-clause sentences, no em-dash asides, no explanations. Good: "Contributed to Chirps (vector-DB security)". Bad: "You've done real work in vector database security. You contributed to Chirps, a tool for scanning vector DBs for sensitive data".
23
+ Each claim must be independently true-or-false so I can remove the ones that are wrong.
24
+ Every specific in a claim (employer, title, publication, city) must appear in a source you actually fetched this turn — never synthesize or embellish specifics a source doesn't state.
25
+ "confidence" is earned per the identity gate: "confident" needs 2+ independent gate-passing sources, "maybe" needs exactly one, and a claim with no sources is an inference from my stated details and must be "guessing".
26
+ "sources": 0 to 3 URLs you actually used as evidence for that specific claim. Use [] for pure inferences.
27
+ ${o?`Rules for "suggestions":
28
+
29
+ Each suggestion is an object with two fields:
30
+ "suggestion": the offer in YOUR voice (the assistant), exactly as it appears on the clickable card — first-person "I" refers to you (whatever your name). Pattern: "I'll [verb] [specific artifact]" or "Connect me to [integration] and I'll [verb] [artifact]." Lead with the offer; no intake question in front of it — you gather the details in the follow-up conversation after the click.
31
+ "prompt": the same offer re-voiced as the message sent on the user's behalf when they click, in the USER's first person ("I"/"my" = the user) — what they'd say to take you up on it (suggestion "I'll find you 3 papers" → prompt "Find me 3 papers worth reading"). State the request; don't echo the assistant-voiced wording and don't ask a question back.
32
+
33
+ Generate EXACTLY 4 suggestions covering four DIFFERENT capabilities, each making me think "wait, you can do that?" Draw on your range — a quick researched answer, a recurring brief or monitor, a doc drafted in a live editor, an integration (GitHub, Gmail, Calendar, Slack, Linear) connected with a first action, or a hobby hook if research surfaced one — but pick what genuinely fits; don't force a fixed set.
34
+ Ground every suggestion in what you actually learned about me — my real role, stack, industry, and (if given) hobby. Specific to me, not generic assistant stuff; skip bare "summarize" or "draft a post."
35
+ CRITICAL: every suggestion must be a fast win you can deliver in the first reply, never a long-running build. NEVER suggest building an app, dashboard, tool, site, or tracker, or any multi-step "build me a ___" project — those kill the first impression. The ambitious build can come later in the conversation, never on the first card.
36
+ Keep each SHORT and skimmable: under 10 words, ONE clause, ONE artifact, no lists of three ("X, Y, and Z"). The reader scans four cards in seconds — a long line loses them.
37
+ `:``}${d}
38
+ ${o?`Don't include anything sensitive or private. If the identity gate leaves you with very little, return only the honest "guessing" claims my stated details support, and lean on broadly useful suggestions for my role.`:`Don't include anything sensitive or private. If the identity gate leaves you with very little, return only the honest "guessing" claims my stated details support.`}
39
+ Keep every string value simple so the JSON always parses: one line, no line breaks inside a value, and NO double-quote characters inside a value — use single quotes (or none) for emphasis, quoted names, or tool names. Output ONLY the JSON object. No code fence, no extra text.`}function Xe({hostingParam:e,localMode:t,gatewayAuthSession:n}){return t?e===null?n:e!==`vellum-cloud`:!1}var Ze=3e3,Qe=3e5,$e=`Failed to start your assistant. Please try again.`,et=`Your assistant is taking longer than expected. Please try again.`,tt=e=>new Promise(t=>setTimeout(t,e));function nt({adoptExisting:e=!1,adoptAssistantId:n}={}){let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),l=(0,Y.useRef)(!1),u=(0,Y.useRef)([]),d=(0,Y.useRef)(null),f=(0,Y.useCallback)(e=>{if(!d.current){d.current={kind:`ready`,id:e},i(!0);for(let t of u.current)t.resolve(e);u.current=[]}},[]),p=(0,Y.useCallback)(e=>{if(d.current)return;d.current={kind:`error`,message:e},c(e);let t=Error(e);for(let e of u.current)e.reject(t);u.current=[]},[]);return{start:(0,Y.useCallback)(()=>{if(l.current)return;l.current=!0;let r=Date.now(),i=()=>Date.now()-r>=Qe;(async()=>{if(e&&n){let e=T(n);if(e){o(e.assistantId),f(e.assistantId);return}}let r=e?n:void 0;if(!e)try{let e=await ae();if(e.ok)r=e.data.id,o(e.data.id);else{if(ne(e.status,e.error)){p(I);return}if(!te(e.status)){p(ee(e.error,void 0,$e));return}}}catch(e){t(e,{context:`research_background_hatch`})}let a;for(;!a;){if(i()){p(et);return}try{let e=await oe(r);r&&!e.ok&&e.status===404&&(r=void 0,e=await oe());let t=ie(e);if(t.kind===`active`&&e.ok){a=e.data.id,o(a);break}if(t.kind===`error`){p(t.message);return}}catch(e){t(e,{context:`research_background_hatch_poll`})}await tt(Ze)}if(e)for(;!await E();){if(i()){p(et);return}await tt(Ze)}else for(;;){try{if((await L(a)).ok)break}catch{}if(i()){p(et);return}await tt(Ze)}f(a)})()},[p,f,e,n]),ready:r,assistantId:a,error:s,awaitReady:(0,Y.useCallback)(()=>{let e=d.current;return e?.kind===`ready`?Promise.resolve(e.id):e?.kind===`error`?Promise.reject(Error(e.message)):new Promise((e,t)=>{u.current.push({resolve:e,reject:t})})},[])}}async function rt(e,n){try{await A({path:{assistant_id:e,id:n},throwOnError:!1})}catch(e){t(e,{context:`research_onboarding_archive`})}}var it=[`admin-copilot`],at=[{plugin:`marketing-expert`,keywords:[`founder`,`cofounder`,`co founder`,`ceo`,`cmo`,`chief executive`,`chief marketing`,`entrepreneur`,`marketing`,`marketer`,`growth`,`brand`,`content`,`copywriter`,`copywriting`,`seo`,`demand gen`,`demand generation`,`sales`,`account executive`,`business development`,`creator`,`social media`,`community manager`]},{plugin:`git-workflow`,keywords:`developer.swe.programmer.coder.devops.dev ops.sre.site reliability.software engineer.software architect.backend engineer.back end engineer.frontend engineer.front end engineer.full stack engineer.fullstack engineer.platform engineer.infrastructure engineer.data engineer.machine learning engineer.ml engineer.qa engineer.embedded engineer.security engineer.staff engineer.principal engineer.solutions architect.tech lead.technical lead.engineering manager.engineering lead.head of engineering.director of engineering.vp of engineering.vp engineering.cto`.split(`.`)}];function ot(e){return` ${e.toLowerCase().replace(/[^a-z0-9]+/g,` `).trim()} `}function st(e,t){return e.includes(` ${t} `)}function ct(e){let t=ot(e),n=[];for(let{plugin:e,keywords:r}of at)r.some(e=>st(t,e))&&n.push(e);return n}function lt(e,t){let n=[...it,...Ge(),...ct(e)],r=new Set,i=[];for(let e of n)!t.has(e)||r.has(e)||(r.add(e),i.push(e));return i}var ut=1500,dt=12e4,ft=2;function pt({complete:e,stableReads:t}){return e&&t>=ft}function mt({sawCompletePayload:e}){return e?`done`:`error`}function ht({sawCompletePayload:e}){return e}var gt=`vellum-ai`,_t=new Set([`simple-memory`,`level-up`]);function vt(e){let t=e.trim().split(/(?<=\.)\s/)[0]?.trim()??e.trim();return t.length>100?`${t.slice(0,97).trimEnd()}…`:t}function yt(e){return e?.split(`/`)[0]?.trim()??``}function bt(e){let t=[],n=new Set;for(let r of e){let e=r.name?.trim(),i=r.description?.trim();!e||!i||yt(r.source?.repo)===gt&&(_t.has(e)||(n.add(e),t.push({name:e,description:vt(i)})))}return{capabilities:t,validNames:n}}async function xt(e){try{return bt((await D({path:{assistant_id:e},throwOnError:!1})).data?.matches??[])}catch(e){return t(e,{context:`research_onboarding_catalog`}),{capabilities:[],validNames:new Set}}}async function St(e,n){try{await j({path:{assistant_id:e},body:{name:n},throwOnError:!1})}catch(e){t(e,{context:`research_onboarding_install`})}}var Ct=32;function wt(e,t){return e.filter(e=>e.confidence===t).length}async function Tt({assistantId:e,conversationId:n,status:r,subject:i,claims:a,suggestions:o,plugins:s,installedPlugins:c}){try{await k({path:{assistant_id:e},body:{type:`onboarding_research`,...r===`done`?{daemon_event_id:`onboarding_research:${n}`}:{},fields:{conversation_id:n,status:r,self_reported_occupation:i.occupation,self_reported_hobbies:(i.hobbies??[]).slice(0,Ct),self_reported_timezone:i.timezone,claims:a,claim_count:a.length,claims_confident:wt(a,`confident`),claims_maybe:wt(a,`maybe`),claims_guessing:wt(a,`guessing`),suggestions:o,suggestion_count:o.length,plugins:s,installed_plugins:c}},throwOnError:!1})}catch(e){t(e,{context:`research_onboarding_telemetry`})}}var Et=e=>new Promise(t=>setTimeout(t,e));function Dt({role:e,validNames:t,modelPlugins:n}){return[...new Set([...lt(e,t),...n.filter(e=>t.has(e))])]}function Ot(){let[e,n]=(0,Y.useState)({status:`idle`,claims:[],droppedClaims:[],suggestions:[],installedPlugins:[],pluginCatalog:{}}),r=(0,Y.useRef)(0),i=(0,Y.useRef)(null),a=(0,Y.useRef)(new Map),o=(0,Y.useRef)(Promise.resolve()),c=s(),l=(0,Y.useCallback)(({awaitAssistantId:e,subject:s,conversationTitle:l,resumeConversationId:u,onConversationCreated:d,includeSuggestions:f=!0})=>{let p=JSON.stringify(s);if(i.current===p)return;i.current=p;let m=r.current+1;r.current=m;let h=()=>r.current!==m,g=()=>{};o.current=new Promise(e=>{g=e}),a.current.clear(),n({status:`running`,claims:[],droppedClaims:[],suggestions:[],installedPlugins:[],pluginCatalog:{}}),(async()=>{let r,i,o=!1;try{let t=await e();if(r=t,h())return;let{capabilities:c,validNames:p}=await xt(t);if(h())return;let m=Object.fromEntries(c.map(e=>[e.name,e.description]));n(e=>({...e,pluginCatalog:m})),p.size===0&&g();let _=a.current,v=lt(s.occupation,p);for(let e of v)_.has(e)||_.set(e,St(t,e));v.length>0&&n(e=>({...e,installedPlugins:v}));let y=async e=>{let n={conversationId:e,content:Ye(s,c,{includeSuggestions:f}),sourceChannel:`vellum`,interface:`web`,clientOs:ce(),clientMessageId:crypto.randomUUID()};try{let e=Intl.DateTimeFormat().resolvedOptions().timeZone;e&&(n.clientTimezone=e)}catch{}return!!(await P({path:{assistant_id:t},body:n,throwOnError:!1})).response?.ok},b=async()=>{let e=await N({path:{assistant_id:t},body:{conversationType:`standard`,...l?{title:l}:{}},throwOnError:!1});i=e.data?.id;let n=e.data?.id;if(!(!e.response?.ok||!n))return d?.(n),n},x;if(u){let e=await M({path:{assistant_id:t},query:{conversationId:u},throwOnError:!1});if(h())return;if(e.response?.ok&&(x=u,i=u,!(e.data?.messages??[]).some(e=>e.role===`user`))){if(!await y(x)){n(e=>({...e,status:`error`}));return}if(h())return}}if(!x){if(x=await b(),h())return;if(!x){n(e=>({...e,status:`error`}));return}if(!await y(x)){n(e=>({...e,status:`error`}));return}if(h())return}let S=Date.now()+dt,C=``,w=0,T=!1,E=[],D=[],O=[],k=v;for(;Date.now()<S;){if(await Et(ut),h())return;let e=await M({path:{assistant_id:t},query:{conversationId:x},throwOnError:!1});if(h())return;let r=He(e.data?.messages??[]);if(r){let{claims:e,droppedClaims:i,suggestions:a,plugins:c,pluginsResolved:l,complete:u}=W(r),d=c.filter(e=>p.has(e));for(let e of d)_.has(e)||_.set(e,St(t,e));l&&g();let f=Dt({role:s.occupation,validNames:p,modelPlugins:d});if(n({status:`running`,claims:e,droppedClaims:i,suggestions:a,installedPlugins:f,pluginCatalog:m}),E=e,D=a,O=c,k=f,u&&(o=!0),u&&!T&&(T=!0,Tt({assistantId:t,conversationId:x,status:`done`,subject:s,claims:e,suggestions:a,plugins:c,installedPlugins:f})),w=r===C?w+1:0,C=r,pt({complete:u,stableReads:w}))break}}if(h())return;T||(T=!0,Tt({assistantId:t,conversationId:x,status:`error`,subject:s,claims:E,suggestions:D,plugins:O,installedPlugins:k})),n(e=>({...e,status:mt({sawCompletePayload:o})}))}catch(e){if(h())return;t(e,{context:`research_onboarding_runner`}),n(e=>({...e,status:`error`}))}finally{g(),ht({sawCompletePayload:o})&&r&&i&&(await rt(r,i),Ne(c,r))}})()},[c]),u=(0,Y.useCallback)(async()=>{await o.current,await Promise.all([...a.current.values()])},[]),d=(0,Y.useCallback)((e,t)=>{if(r.current+=1,n(e),t&&e.installedPlugins.length>0){let n=a.current;n.clear();for(let r of e.installedPlugins)n.set(r,(async()=>{try{await St(await t(),r)}catch{}})())}},[]);return{...e,start:l,awaitPluginInstalls:u,hydrate:d}}function kt({removedClaims:e,rejectedAll:t}){if(t)return[`Correction: none of what you found in that web search is actually me —`,`it looks like you matched someone else with a similar name. Please`,`disregard everything from that search and don't remember any of it as`,`true about me. We'll build up what you actually know about me from here,`,`as we talk.`].join(` `);let n=e.map(e=>e.trim()).filter(Boolean);return n.length===0?null:[`Quick correction on what you found about me — these aren't true, so please`,`disregard them and don't remember them as facts about me:`,``,...n.map(e=>`- ${e}`)].join(`
40
+ `)}async function At({assistantId:e,conversationId:n,removedClaims:r,rejectedAll:i}){let a=kt({removedClaims:r,rejectedAll:i});if(a){try{let t={conversationId:n,content:a,sourceChannel:`vellum`,interface:`web`,clientOs:ce(),clientMessageId:crypto.randomUUID()};await P({path:{assistant_id:e},body:t,throwOnError:!1})}catch(e){t(e,{context:`research_onboarding_correction`})}await rt(e,n)}}var jt=1500,Mt=12e4,Nt=e=>new Promise(t=>setTimeout(t,e));async function Pt({awaitAssistantId:e,values:n,userName:r,assistantName:i}){let a,o;try{a=await e();let t=await N({path:{assistant_id:a},body:{conversationType:`standard`,title:`Updating personality`},throwOnError:!1});if(o=t.data?.id,!t.response?.ok||!o)return;let s={conversationId:o,content:Ie(n,r,i),sourceChannel:`vellum`,interface:`vellum`,clientMessageId:crypto.randomUUID()};if(!(await P({path:{assistant_id:a},body:s,throwOnError:!1})).response?.ok)return;await Ve(a,Le(n));let c=Date.now()+Mt,l=``,u=0,d=!1;for(;Date.now()<c;){await Nt(jt);let e=await M({path:{assistant_id:a},query:{conversationId:o},throwOnError:!1}),t=He(e.data?.messages??[]);if(t&&(u=t===l?u+1:0,l=t),e.data?.processing===!0&&(d=!0),Re({processing:e.data?.processing,sawProcessing:d,hasReply:t.length>0,stableReads:u}))break}}catch(e){t(e,{context:`research_onboarding_personality`})}finally{if(a&&o)try{await A({path:{assistant_id:a,id:o},throwOnError:!1})}catch(e){t(e,{context:`research_onboarding_personality_archive`})}}}function Ft(e){let t=e?.trim();return`You're about to begin your first conversation.${t?`\nYour name is ${t} — introduce yourself as ${t}.`:``}
41
+ Respond with a warm and engaging greeting. Be interesting, be real. This is your chance to get to know and impress the user.
42
+ End with exactly one short question about something specific you already know about them (see your Onboarding Context) — a question they can answer in five words or less. If you know almost nothing about them yet, ask one specific, concrete question anyway (still five-word-answerable). Never ask what they want to do, what you're getting into, or anything else open-ended: an open question hands a stranger a blank page.
43
+ Keep it short! For this opening greeting only, don't use \`recall\` or read any files — just say hello. (This applies to the greeting alone; use your tools normally for everything the user asks afterward.)`}function It(e,t){if(!e)return null;let n=new Date(e);if(Number.isNaN(n.getTime()))return null;try{return new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`,...t?{timeZone:t}:{}}).format(n)}catch{return new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n)}}var X=l(),Lt=(0,Y.createContext)(null);function Rt({size:e,children:t}){return(0,X.jsx)(Lt.Provider,{value:e,children:t})}function zt(){let e=(0,Y.useContext)(Lt),[t,n]=(0,Y.useState)(()=>Be());return(0,Y.useEffect)(()=>{if(e)return;let t=()=>n(Be());return window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)},[e]),e??t}var Bt={x:.5,y:.43},Vt=[-8,6,9,0,7,-6,5,0,-7,4,-5,6];function Ht(e){return Vt[e%Vt.length]??0}var Ut=[1,0,1,0,1,0,1,0,1,0,0],Wt=[.72,1],Gt=[.4,1],Kt=[10,20],qt=50,Jt={6:1.1};function Yt(e){return(Wt[Ut[e]??1]??1)*(Jt[e]??1)}function Xt(e){return Gt[Ut[e]??1]??1}function Zt(e){return Kt[Ut[e]??1]??20}function Qt(e,t){return Math.round(Math.max(130,Math.min(Math.min(e,t)*.4,420)))}function $t(e,t){return Math.round(Math.max(110,Math.min(Math.min(e,t)*.21,205)))}function en(e,t,n){let r=n*.4,i=n*.48;return[{x:i,y:i},{x:e*.3,y:r-t*.03},{x:e*.72,y:r-t*.1},{x:e-i,y:i},{x:e-r,y:t*.72},{x:e-i,y:t-i},{x:i,y:t-i},{x:r,y:t*.5},{x:e-r,y:t*.3},{x:e*.28,y:t-r+t*.05},{x:e*.77,y:t-r}]}function tn(e,t,n,r,i){let a=e.x-t,o=e.y-n,s=Math.hypot(a,o)||1,c=Math.max(r,i);return{x:e.x+a/s*c,y:e.y+o/s*c}}function nn({components:e,characters:t,centerChar:n,edgeOrder:r,entering:i,exiting:a,onEnterComplete:o,onSelectChar:s}){let{w:c,h:l}=zt(),u=z(),d=c<640,f=new Set([4,7,8,9,10]),p=e=>d&&f.has(e),m=Qt(c,l),h=m/2,g=m/2,_=$t(c,l)/m,v=$t(c,l),y=(0,Y.useMemo)(()=>{let e=new Map;return r.forEach((t,n)=>e.set(t,n)),e},[r]),b=Bt.x*c,x=Bt.y*l,S=b-h,C=x-h,w=(0,Y.useMemo)(()=>en(c,l,g),[c,l,g]);return(0,X.jsxs)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-0 overflow-hidden`,children:[(0,X.jsx)(`div`,{className:`absolute rounded-[50%] bg-[var(--aux-black,#000)] opacity-20 blur-md`,style:{width:v*.62,height:16,left:b-v*.31,top:x+v*.4}}),t.map((t,r)=>{let d=r===n,f=!u&&i?.char===r,g=!u&&a?.char===r;if(f){let n=w[i.fromSlot],a=tn(n,b,x,c,l),s=Yt(i.fromSlot),u=Xt(i.fromSlot);return(0,X.jsx)(R.div,{className:`absolute left-0 top-0`,style:{width:m,height:m,zIndex:qt},initial:!1,animate:{x:[n.x-h,a.x-h,a.x-h,S,S,S],y:[n.y-h,a.y-h,a.y-h,C,C,C],scale:[s,s,s,_*.7,_*1.08,_],opacity:[u,u,0,0,1,1]},transition:{duration:.85,times:[0,.28,.34,.42,.72,1],ease:[`easeIn`,`linear`,`linear`,`easeOut`,`easeOut`]},onAnimationComplete:()=>o(r),children:(0,X.jsx)(B,{components:e,traits:t,size:m})},r)}if(g){if(p(a.toSlot))return null;let n=w[a.toSlot],i=tn(n,b,x,c,l),o=Yt(a.toSlot),s=Xt(a.toSlot);return(0,X.jsx)(R.div,{className:`absolute left-0 top-0`,style:{width:m,height:m,zIndex:Zt(a.toSlot)},initial:!1,animate:{x:[S,S,i.x-h,i.x-h,n.x-h,n.x-h],y:[C,C,i.y-h,i.y-h,n.y-h,n.y-h],scale:[_,_*.6,o,o,o*1.1,o],opacity:[1,0,0,s,s,s]},transition:{duration:.85,times:[0,.28,.34,.45,.78,1],ease:[`easeIn`,`linear`,`linear`,`easeOut`,`easeOut`]},children:(0,X.jsx)(`div`,{style:{transform:`rotate(${Ht(a.toSlot)}deg)`},children:(0,X.jsx)(B,{components:e,traits:t,size:m,breathe:!1})})},r)}let v=y.get(r)??0;if(!d&&p(v))return null;let T=d?{x:b,y:x}:w[v];return(0,X.jsx)(R.div,{className:`absolute left-0 top-0 ${d?``:`pointer-events-auto cursor-pointer`}`,style:{width:m,height:m,zIndex:d?qt:Zt(v)},initial:!1,animate:{x:T.x-h,y:T.y-h,scale:d?_:Yt(v),opacity:d?1:Xt(v)},transition:u?{duration:0}:{type:`spring`,stiffness:230,damping:26},onClick:d?void 0:()=>s(r),children:(0,X.jsx)(`div`,{style:{transform:d?void 0:`rotate(${Ht(y.get(r)??0)}deg)`},children:(0,X.jsx)(B,{components:e,traits:t,size:m,breathe:d})})},r)})]})}var rn=[{bodyShape:`urchin`,eyeStyle:`goofy`,color:`teal`},{bodyShape:`blob`,eyeStyle:`grumpy`,color:`purple`},{bodyShape:`star`,eyeStyle:`surprised`,color:`orange`},{bodyShape:`blob`,eyeStyle:`gentle`,color:`pink`},{bodyShape:`ninja`,eyeStyle:`angry`,color:`yellow`},{bodyShape:`urchin`,eyeStyle:`curious`,color:`pink`},{bodyShape:`burst`,eyeStyle:`quirky`,color:`orange`},{bodyShape:`ghost`,eyeStyle:`bashful`,color:`green`},{bodyShape:`sprout`,eyeStyle:`dazed`,color:`orange`},{bodyShape:`star`,eyeStyle:`goofy`,color:`teal`},{bodyShape:`flower`,eyeStyle:`angry`,color:`pink`},{bodyShape:`cloud`,eyeStyle:`curious`,color:`yellow`}],Z=S(x((e,t)=>({characters:[],selectedIndex:0,ensureGenerated:()=>{t().characters.length>0||e({characters:rn,selectedIndex:0})},setSelectedIndex:t=>e({selectedIndex:t}),selectNext:()=>e(e=>({selectedIndex:e.characters.length===0?0:(e.selectedIndex+1)%e.characters.length})),selectPrev:()=>e(e=>({selectedIndex:e.characters.length===0?0:(e.selectedIndex-1+e.characters.length)%e.characters.length}))})));function an(){let[e,t]=(0,Y.useState)(()=>({w:typeof window>`u`?1280:window.innerWidth,h:typeof window>`u`?800:window.innerHeight}));return(0,Y.useEffect)(()=>{let e=()=>t({w:window.innerWidth,h:window.innerHeight});return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function on(){let e=q(),t=Z.use.characters(),n=Z.use.ensureGenerated(),r=z(),{w:i,h:a}=an();(0,Y.useEffect)(()=>{e&&n(e)},[e,n]);let o=Qt(i,a),s=(0,Y.useMemo)(()=>en(i,a,o/2),[i,a,o]),c=i<640,l=new Set([4,7,8,9,10]);return!e||t.length===0?null:(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 z-0 overflow-hidden`,children:t.map((t,n)=>{if(n===0)return null;let i=n-1;if(c&&l.has(i))return null;let a=s[i];if(!a)return null;let u=Vt[i%Vt.length]??0,d=o*Yt(i),f=Xt(i),p=Zt(i);return(0,X.jsx)(`div`,{className:`absolute`,style:{left:a.x-d/2,top:a.y-d/2,width:d,height:d,zIndex:p,animation:r?void 0:`character-pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) ${.1+n*.05}s both`},children:(0,X.jsx)(`div`,{style:{opacity:f,transform:`rotate(${u}deg)`},children:(0,X.jsx)(B,{components:e,traits:t,size:d,breathe:!1})})},n)})})}var sn=r(`flex w-full items-center gap-1.5 rounded-md border bg-[var(--field-bg)] px-3`,`border-[var(--field-border)] transition-[border-color,background-color] duration-150 ease-out`,`focus-within:border-[var(--border-active)]`),cn=r(`min-w-0 flex-1 bg-transparent text-body-medium-lighter text-[var(--content-default)]`,`placeholder:text-[var(--content-tertiary)] outline-none`,We);function Q(e){return e.trim().toLowerCase()}function ln(e,t,n=[],r=8){let i=Q(t),a=new Set(n.map(Q)),o=[];for(let t of e)if(!a.has(Q(t))&&((i.length===0||Q(t).includes(i))&&o.push(t),o.length>=r))break;return o}function un({id:e,options:t,highlighted:n,showAddHint:i,onPick:a,onHover:o}){return(0,X.jsxs)(`ul`,{id:e,role:`listbox`,className:r(`absolute left-0 right-0 top-full z-50 mt-1.5 max-h-60 overflow-auto`,`rounded-lg bg-[var(--surface-lift)] p-1 shadow-[var(--shadow-popover)]`,`animate-[fadeInUp_0.12s_ease-out]`),children:[t.map((t,i)=>(0,X.jsx)(`li`,{id:`${e}-opt-${i}`,role:`option`,"aria-selected":i===n,onMouseDown:e=>{e.preventDefault(),a(t.value)},onMouseEnter:()=>o(i),className:r(`flex cursor-pointer items-center gap-2 rounded-md px-2.5 py-1.5`,`text-body-medium-lighter text-[var(--content-default)]`,i===n?`bg-[var(--surface-base)]`:`bg-transparent`),children:t.isAdd?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(p,{size:15,className:`shrink-0 text-[var(--content-tertiary)]`}),(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`Add “`,t.value,`”`]}),(0,X.jsx)(`span`,{className:`ml-auto shrink-0 text-body-small-default text-[var(--content-tertiary)]`,children:`↵ Enter`})]}):t.value},t.isAdd?`__add__${t.value}`:t.value)),i&&(0,X.jsx)(`li`,{role:`presentation`,className:`mt-0.5 border-t border-[var(--border-base)] px-2.5 pb-0.5 pt-1.5 text-body-small-default text-[var(--content-tertiary)]`,children:`Type anything and press ↵ to add your own`})]})}function dn({htmlFor:e,required:t,children:n}){return(0,X.jsxs)(`label`,{htmlFor:e,className:`text-body-small-default text-[var(--content-secondary)]`,children:[n,t?(0,X.jsx)(`span`,{"aria-hidden":!0,className:`text-[var(--system-negative-strong)]`,children:` *`}):null]})}function fn(e,t){(0,Y.useEffect)(()=>{function n(n){e.current&&!e.current.contains(n.target)&&t()}return document.addEventListener(`mousedown`,n),()=>document.removeEventListener(`mousedown`,n)},[e,t])}function pn({label:e,placeholder:t,values:n,onChange:i,suggestions:a}){let o=(0,Y.useId)(),s=`tac-${o}`,c=`tac-list-${o}`,l=(0,Y.useRef)(null),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(!1),[m,g]=(0,Y.useState)(-1),_=(0,Y.useMemo)(()=>ln(a,u,n),[a,u,n]),v=u.trim(),y=(0,Y.useMemo)(()=>{if(!v)return!1;let e=Q(v);return!(n.some(t=>Q(t)===e)||_.some(t=>Q(t)===e))},[v,n,_]),b=(0,Y.useMemo)(()=>{let e=_.map(e=>({value:e,isAdd:!1}));return y?[...e,{value:v,isAdd:!0}]:e},[_,y,v]);fn(l,()=>p(!1)),(0,Y.useEffect)(()=>{g(e=>e>=b.length?b.length-1:e)},[b.length]);let x=f&&b.length>0,S=!y;function C(e){let t=e.trim();t&&(n.some(e=>Q(e)===Q(t))||i([...n,t]),d(``),g(-1))}function w(e){i(n.filter(t=>t!==e))}function T(e){e.key===`ArrowDown`?(e.preventDefault(),p(!0),g(e=>Math.min(e+1,b.length-1))):e.key===`ArrowUp`?(e.preventDefault(),g(e=>Math.max(e-1,0))):e.key===`Enter`?x&&m>=0?(e.preventDefault(),C(b[m].value)):u.trim()&&(e.preventDefault(),C(u)):e.key===`,`?(e.preventDefault(),C(u)):e.key===`Backspace`&&u.length===0&&n.length>0?w(n[n.length-1]):e.key===`Escape`&&p(!1)}return(0,X.jsxs)(`div`,{ref:l,className:`relative flex flex-col gap-1.5`,children:[(0,X.jsx)(dn,{htmlFor:s,children:e}),(0,X.jsxs)(`div`,{className:r(sn,`min-h-9 flex-wrap py-1.5`),children:[(0,X.jsx)(ke,{size:16,"aria-hidden":!0,className:`shrink-0 self-center text-[var(--content-tertiary)]`}),n.map(e=>(0,X.jsx)(h,{onRemove:()=>w(e),removeLabel:`Remove ${e}`,className:`border border-[var(--border-base)] bg-[var(--surface-base)]`,children:e},e)),(0,X.jsx)(`input`,{id:s,role:`combobox`,"aria-expanded":x,"aria-controls":c,"aria-autocomplete":`list`,"aria-activedescendant":m>=0?`${c}-opt-${m}`:void 0,autoComplete:`off`,className:r(cn,`h-6 w-24`),placeholder:n.length===0?t:``,value:u,onChange:e=>{d(e.target.value),p(!0)},onFocus:()=>p(!0),onKeyDown:T})]}),x&&(0,X.jsx)(un,{id:c,options:b,highlighted:m,showAddHint:S,onPick:C,onHover:g})]})}var mn=`Reading.Writing.Cooking.Baking.Gardening.Photography.Painting.Drawing.Hiking.Running.Cycling.Swimming.Yoga.Climbing.Weightlifting.Gaming.Board games.Chess.Traveling.Cars.Woodworking.Knitting.Playing guitar.Playing piano.Singing.Dancing.Fishing.Camping.Surfing.Skiing.Snowboarding.Coffee.Wine.Birdwatching.Pottery.Investing.Podcasts.Movies.Soccer.Basketball.Tennis.Golf.Meditation.Volunteering.Astronomy.3D printing`.split(`.`);function hn(e,t){return{animation:`fadeInUp 0.4s ease-out ${e}s both`,...t==null?{}:{position:`relative`,zIndex:t}}}function gn({initialFirstName:e=``,initialLastName:t=``,onSubmit:n}){let[r,a]=(0,Y.useState)(e),[o,s]=(0,Y.useState)(t),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)([]),f=r.trim().length>0&&c.trim().length>0;function p(){f&&n({firstName:r,lastName:o,role:c,hobbies:u})}return(0,X.jsx)(`div`,{"data-theme":`dark`,className:`h-full`,children:(0,X.jsxs)(G,{showCreatureFooter:!1,children:[(0,X.jsx)(on,{}),(0,X.jsxs)(`form`,{className:`relative z-10 mx-auto flex min-h-screen w-full max-w-sm flex-col items-center justify-center px-6 py-16 text-[var(--content-default)]`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,X.jsx)(`h1`,{className:`text-center font-serif text-[2.75rem] leading-[1.05] tracking-tight`,style:hn(.05),children:`Let's start with you.`}),(0,X.jsx)(`p`,{className:`mt-3 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:hn(.12),children:`A few details so I can get to know you.`}),(0,X.jsxs)(`div`,{className:`mt-10 flex w-full flex-col gap-5`,children:[(0,X.jsx)(`div`,{style:hn(.2,40),children:(0,X.jsx)(g,{label:(0,X.jsxs)(X.Fragment,{children:[`What should I call you?`,(0,X.jsx)(`span`,{"aria-hidden":!0,className:`text-[var(--system-negative-strong)]`,children:` *`})]}),placeholder:`Your name`,value:r,onChange:e=>a(e.target.value),className:We,autoFocus:!0,required:!0,fullWidth:!0})}),(0,X.jsx)(`div`,{style:hn(.27,30),children:(0,X.jsx)(g,{label:`And your last name?`,placeholder:`Your last name (optional)`,value:o,onChange:e=>s(e.target.value),className:We,fullWidth:!0})}),(0,X.jsx)(`div`,{style:hn(.34,20),children:(0,X.jsx)(g,{label:`Your role`,placeholder:`What do you do for work?`,value:c,onChange:e=>l(e.target.value),className:We,required:!0,fullWidth:!0})}),(0,X.jsx)(`div`,{style:hn(.41,10),children:(0,X.jsx)(pn,{label:`Any hobbies?`,placeholder:`Cars, books, growing tomatoes?`,values:u,onChange:d,suggestions:mn})})]}),(0,X.jsx)(`div`,{className:`mt-10 w-full`,style:hn(.5),children:(0,X.jsx)(i,{type:`submit`,variant:`primary`,size:`regular`,rightIcon:(0,X.jsx)(H,{size:16}),fullWidth:!0,disabled:!f,className:`h-11 text-base`,children:`Continue`})})]})]})})}function _n(){let e=q(),t=Z.use.characters(),n=Z.use.selectedIndex();return(0,Y.useMemo)(()=>{let r=t[n],i=e?.colors.find(e=>e.id===r?.color)?.hex;return xe(i??`var(--surface-base)`)},[e,t,n])}function $({onBack:e,onNext:t,tone:n}){let r=_n(),i=n?n===`dark`?`#1A1A1A`:`#FFFFFF`:r.fg,a=`color-mix(in srgb, ${i} 10%, transparent)`,o=`color-mix(in srgb, ${i} 18%, transparent)`;return(0,X.jsxs)(`div`,{className:`absolute left-4 top-6 z-10 flex items-center gap-3`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:e,"aria-label":`Back`,className:`flex cursor-pointer h-10 w-10 items-center justify-center rounded-full transition-colors duration-150`,style:{color:i,backgroundColor:a},onMouseEnter:e=>e.currentTarget.style.backgroundColor=o,onMouseLeave:e=>e.currentTarget.style.backgroundColor=a,children:(0,X.jsx)(u,{className:`h-4 w-4`})}),t?(0,X.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Forward`,className:`flex cursor-pointer h-10 w-10 items-center justify-center rounded-full transition-colors duration-150`,style:{color:i,backgroundColor:a},onMouseEnter:e=>e.currentTarget.style.backgroundColor=o,onMouseLeave:e=>e.currentTarget.style.backgroundColor=a,children:(0,X.jsx)(H,{className:`h-4 w-4`})}):null]})}async function vn(e,t){try{let{data:n,error:r,response:i}=await O({path:{assistant_id:e},body:{text:t},parseAs:`blob`,throwOnError:!1});return r||!i?.ok||!n?null:n}catch{return null}}var yn=[`Ziggy`,`Quill`,`Luna`,`Remy`,`Cleo`,`Cade`];function bn(e,t){let n=[];for(let r=0;r<e;r++)r!==t&&n.push(r);return{centerChar:t,edgeOrder:n}}function xn({onContinue:e,onBack:t,onForward:n,voiceEnabled:r=!1,assistantId:a=null}){let o=q(),s=Z.use.characters(),c=Z.use.ensureGenerated(),l=Z.use.selectedIndex(),p=Z.use.setSelectedIndex();(0,Y.useEffect)(()=>{o&&c(o)},[o,c]);let m=s.length,[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(``),[y,x]=(0,Y.useState)(!1),S=(0,Y.useRef)(!1),C=(0,Y.useRef)(null),{ref:w,size:T}=ze(),[E,D]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{m>0&&h===null&&g(bn(m,l))},[m,l,h]),(0,Y.useEffect)(()=>{h&&p(h.centerChar)},[h,p]);let O=h?.centerChar;(0,Y.useEffect)(()=>{O!=null&&!S.current&&v(yn[O%yn.length])},[O]),(0,Y.useEffect)(()=>{y&&(C.current?.focus(),C.current?.select())},[y]);function k(e){if(!h||e===h.centerChar)return;let t=h.edgeOrder.indexOf(e);if(t<0)return;let n=[...h.edgeOrder];n[t]=h.centerChar,D({entering:{char:e,fromSlot:t},exiting:{char:h.centerChar,toSlot:t}}),g({centerChar:e,edgeOrder:n})}let A=()=>h&&k((h.centerChar+1)%m),j=()=>h&&k((h.centerChar-1+m)%m),M=(0,Y.useMemo)(()=>h?s[h.centerChar]:void 0,[h,s]),N=!!o&&!!h&&!!M;function P(){M&&e({traits:M,name:_.trim()})}let[ee,F]=(0,Y.useState)(!1),te=(0,Y.useRef)(null),I=(0,Y.useRef)(null),ne=(0,Y.useRef)(0);function re(){te.current?.pause(),te.current=null,I.current&&=(URL.revokeObjectURL(I.current),null)}(0,Y.useEffect)(()=>()=>{ne.current++,re()},[]);async function ie(){if(!a){b.error(`Your assistant is still warming up — try again in a moment.`);return}re();let e=++ne.current,t=()=>ne.current===e;F(!0);try{let e=_.trim(),n=await vn(a,e?`Hi! It's ${e}. This is how I sound.`:`Hi there! This is how I sound.`);if(!t())return;if(!n){b.error(`Couldn't play a sample just now — give it another try.`);return}let r=URL.createObjectURL(n);I.current=r;let i=new Audio(r);te.current=i,i.onended=()=>re(),await i.play()}catch{t()&&b.error(`Couldn't play a sample just now — give it another try.`)}finally{t()&&F(!1)}}function L(){S.current=!0,v(e=>{let t=yn.filter(t=>t!==e),n=t.length>0?t:yn;return n[Math.floor(Math.random()*n.length)]})}let ae=`pointer-events-auto z-10 flex cursor-pointer h-10 w-10 items-center justify-center rounded-full bg-[color-mix(in_srgb,var(--content-default)_10%,transparent)] text-[var(--content-default)] transition-colors duration-150 hover:bg-[color-mix(in_srgb,var(--content-default)_18%,transparent)]`;return(0,X.jsx)(`div`,{ref:w,"data-theme":`dark`,className:`relative h-full overflow-hidden bg-[var(--surface-base)] text-[var(--content-default)]`,children:(0,X.jsxs)(Rt,{size:T,children:[N&&(0,X.jsx)(nn,{components:o,characters:s,centerChar:h.centerChar,edgeOrder:h.edgeOrder,entering:E?.entering??null,exiting:E?.exiting??null,onEnterComplete:e=>D(t=>t?.entering.char===e?null:t),onSelectChar:k}),(0,X.jsx)($,{tone:`light`,onBack:t,onNext:n?P:void 0}),(0,X.jsx)(`h1`,{className:`absolute left-1/2 top-[22%] z-10 -translate-x-1/2 whitespace-nowrap text-center text-[2.6rem] leading-none max-md:w-[90vw] max-md:whitespace-normal max-md:text-[2.08rem]`,style:{fontFamily:`var(--font-serif)`,animation:`fadeInUp 0.4s ease-out both`},children:`Give me a face and a name`}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Previous character`,onClick:j,className:`absolute left-[calc(50%-170px)] top-[43%] -translate-y-1/2 ${ae}`,children:(0,X.jsx)(u,{className:`h-4 w-4`})}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Next character`,onClick:A,className:`absolute right-[calc(50%-170px)] top-[43%] -translate-y-1/2 ${ae}`,children:(0,X.jsx)(H,{className:`h-4 w-4`})}),(0,X.jsxs)(`div`,{className:`absolute left-1/2 top-[58%] z-10 flex -translate-x-1/2 flex-col items-center gap-10 max-md:top-[54%]`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[y?(0,X.jsx)(`input`,{ref:C,value:_,onChange:e=>{S.current=!0,v(e.target.value)},onBlur:()=>x(!1),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),x(!1))},placeholder:`Name your assistant`,"aria-label":`Assistant name`,className:`w-[234px] rounded-2xl border border-[var(--border-element)] bg-transparent px-4 py-2.5 text-center text-lg text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none transition-colors duration-150 focus:border-[var(--border-active)]`}):(0,X.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>x(!0),"aria-label":`Edit name`,className:`flex cursor-pointer items-center gap-2.5`,children:[(0,X.jsx)(`span`,{className:`text-2xl font-medium ${_?`text-[var(--content-default)]`:`text-[var(--content-tertiary)]`}`,children:_||`Name your assistant`}),(0,X.jsx)(f,{className:`h-5 w-5 text-[var(--content-tertiary)]`})]}),(0,X.jsx)(`button`,{type:`button`,onClick:L,"aria-label":`Shuffle name`,title:`Shuffle name`,className:`cursor-pointer text-[var(--content-tertiary)] transition-[transform,color] duration-300 hover:rotate-180 hover:text-[var(--content-default)]`,children:(0,X.jsx)(De,{className:`h-5 w-5`})})]}),r&&(0,X.jsxs)(`button`,{type:`button`,onClick:ie,disabled:ee,title:`Hear my voice`,"aria-label":`Hear my voice`,className:`flex cursor-pointer items-center gap-2 rounded-full border border-[color-mix(in_srgb,var(--content-default)_22%,transparent)] px-4 py-2 text-sm text-[var(--content-default)] transition-colors duration-150 hover:bg-[color-mix(in_srgb,var(--content-default)_10%,transparent)] disabled:cursor-default disabled:opacity-70`,children:[ee?(0,X.jsx)(d,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(we,{className:`h-4 w-4`}),`Hear my voice`]})]}),(0,X.jsx)(i,{type:`button`,variant:`primary`,size:`regular`,rightIcon:(0,X.jsx)(H,{size:16}),disabled:!N,onClick:P,className:`h-11 w-[234px] text-base`,children:`Continue`})]})]})})}function Sn(e){let t=be(),{data:n}=c({...Te({path:{assistant_id:e??``}}),enabled:e!==null,...t,retry:1});return n?.flags?.some(e=>le(e.key)===`voiceMode`&&e.enabled===!0)??!1}var Cn=.25,wn=.46,Tn=.3,En=.85,Dn=40,On=14,kn=8;function An({entrance:e=!1,entranceDelay:t=0,bumpNonce:n=0,settleBlink:r=!0}){let i=q(),a=Z.use.characters(),o=Z.use.selectedIndex(),s=z(),{w:c,h:l}=zt(),[u,d]=(0,Y.useState)({x:0,y:0});(0,Y.useEffect)(()=>{if(s)return;let e=e=>{d({x:(e.clientX/window.innerWidth-.5)*2,y:(e.clientY/window.innerHeight-.5)*2})};return window.addEventListener(`mousemove`,e),()=>window.removeEventListener(`mousemove`,e)},[s]);let f=e&&!s,p=Ee();(0,Y.useEffect)(()=>{n>0&&!s&&p.start({y:[0,-34,8,0],transition:{duration:.45,ease:`easeOut`}})},[n,s,p]);let[m,h]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(!e);(0,Y.useEffect)(()=>{if(s||!g)return;let e=!1,t,n=n=>{e||(h(!0),t=setTimeout(()=>{e||(h(!1),t=setTimeout(n,140))},140))},i=()=>{t=setTimeout(()=>n(i),2500+Math.random()*4e3)};return r?n(()=>n(i)):i(),()=>{e=!0,clearTimeout(t)}},[s,g,r]);let v=a.length>0?a[o]:void 0,y=(0,Y.useMemo)(()=>{if(!i||!v)return null;let e=i.eyeStyles.find(e=>e.id===v.eyeStyle);return e?{paths:e.paths,bbox:U(e.paths.map(e=>J(e.svgPath)))}:null},[i,v]);if(!y)return null;let b=c*En,x=Math.min(Math.min(c,l)*Tn,b*y.bbox.h/y.bbox.w),S=x*y.bbox.w/y.bbox.h,C=(c-S)/2,w=l-(1-Cn)*x+l*.05,T=Dn/100*l-(w+x/2),E=(wn-Cn)*x,D=y.bbox.x+y.bbox.w/2,O=y.bbox.y+y.bbox.h/2;return(0,X.jsx)(R.div,{"aria-hidden":`true`,className:`pointer-events-none absolute z-[2]`,style:{left:C,top:w,width:S,height:x,transformOrigin:`center`},initial:f?{y:T,scale:.35}:!1,animate:f?{y:[T,E,0],scale:[.35,1,1]}:{y:0,scale:1},transition:f?{duration:1,delay:t,times:[0,.7,1],ease:`easeInOut`}:{duration:0},onAnimationComplete:()=>_(!0),children:(0,X.jsx)(R.div,{animate:p,children:(0,X.jsx)(`div`,{style:{transform:`translate(${u.x*On}px, ${u.y*kn}px)`,transition:`transform 0.5s cubic-bezier(0.22, 1, 0.36, 1)`},children:(0,X.jsx)(`svg`,{viewBox:`${y.bbox.x} ${y.bbox.y} ${y.bbox.w} ${y.bbox.h}`,width:S,height:x,style:{overflow:`visible`,display:`block`},children:(0,X.jsx)(`g`,{style:{transform:m?`scaleY(0.1)`:`scaleY(1)`,transformOrigin:`${D}px ${O}px`,transition:`transform 0.14s ease-in-out`},children:y.paths.map((e,t)=>(0,X.jsx)(`path`,{d:e.svgPath,fill:e.color},t))})})})})})}var jn=200,Mn=40;function Nn({firstName:e,assistantName:t,onContinue:n,onBack:r,onForward:a}){let o=q(),s=Z.use.characters(),c=Z.use.selectedIndex(),l=z(),{ref:u,size:{w:d,h:f}}=ze(),p=_n(),m=s.length>0?s[c]:void 0,h=(0,Y.useMemo)(()=>{if(!o||!m)return null;let e=o.bodyShapes.find(e=>e.id===m.bodyShape),t=o.colors.find(e=>e.id===m.color);return!e||!t?null:{body:e,color:t.hex}},[o,m]),g=e.trim()?`Hey, ${e.trim()}!`:`Hey!`,_=t?.trim()?`I’m ${t.trim()}, your new AI assistant.`:`I’m your new AI assistant.`;if(!h)return(0,X.jsx)(`div`,{"data-theme":`dark`,className:`h-full`,style:{backgroundColor:`var(--surface-base)`}});let v=1.25*Math.max(d,f),y=v*h.body.viewBox.height/h.body.viewBox.width,b=(d-v)/2,x=(f-y)/2,S=jn/v,C=(Mn/100-.5)*f;return(0,X.jsx)(`div`,{ref:u,"data-theme":`dark`,className:`relative h-full overflow-hidden`,style:{backgroundColor:`var(--surface-base)`},children:(0,X.jsxs)(Rt,{size:{w:d,h:f},children:[(0,X.jsx)(R.div,{className:`absolute inset-0 z-0`,style:{backgroundColor:h.color},initial:l?!1:{opacity:0},animate:{opacity:1},transition:l?{duration:0}:{duration:.6,delay:.35}}),(0,X.jsx)(R.svg,{"aria-hidden":`true`,className:`pointer-events-none absolute z-[1]`,viewBox:`0 0 ${h.body.viewBox.width} ${h.body.viewBox.height}`,width:v,height:y,style:{left:b,top:x,transformOrigin:`center`},initial:l?!1:{scale:S,y:C},animate:{scale:1,y:0},transition:l?{duration:0}:{type:`spring`,stiffness:78,damping:18,mass:1},children:(0,X.jsx)(`path`,{d:h.body.svgPath,fill:h.color})}),(0,X.jsx)(An,{entrance:!0}),(0,X.jsx)(R.div,{initial:l?!1:{opacity:0},animate:{opacity:1},transition:l?{duration:0}:{duration:.4,delay:1},children:(0,X.jsx)($,{onBack:r,onNext:a})}),(0,X.jsxs)(`div`,{className:Ue,children:[(0,X.jsxs)(R.h1,{className:`text-center leading-[1.15] max-md:leading-[1.25]`,style:{fontFamily:`var(--font-serif)`},initial:l?!1:{scale:.9,opacity:0},animate:{scale:1,opacity:1},transition:l?{duration:0}:{type:`spring`,stiffness:260,damping:11,delay:1},children:[(0,X.jsx)(`span`,{className:`block text-[clamp(2.5rem,6vw,5rem)]`,style:{color:p.fgDeep},children:g}),(0,X.jsx)(`span`,{className:`block text-[clamp(2.5rem,6vw,5rem)]`,style:{color:p.fg},children:_})]}),(0,X.jsx)(R.div,{initial:l?!1:{opacity:0,y:8},animate:{opacity:1,y:0},transition:l?{duration:0}:{duration:.4,delay:1.15},children:(0,X.jsx)(i,{type:`button`,variant:`primary`,size:`regular`,rightIcon:(0,X.jsx)(H,{size:16}),onClick:n,className:`h-11 w-[234px] text-base`,children:`Continue`})})]})]})})}var Pn=.3,Fn=.85,In=.25;function Ln(){let e=q(),t=Z.use.characters(),n=Z.use.selectedIndex(),r=t.length>0?t[n]:void 0,{w:i,h:a}=zt(),o=(0,Y.useMemo)(()=>{if(!e||!r)return null;let t=e.eyeStyles.find(e=>e.id===r.eyeStyle);return t?{paths:t.paths,bbox:U(t.paths.map(e=>J(e.svgPath)))}:null},[e,r]),s=o?Math.min(Math.min(i,a)*Pn,i*Fn*o.bbox.h/o.bbox.w):0;return{art:o,eyesW:o?s*o.bbox.w/o.bbox.h:0,eyesH:s,restCy:a-In*s,centerX:i/2,w:i,h:a}}function Rn({art:e,eyesW:t,eyesH:n,centerX:r,eyeCy:i,eyeScale:a,eyeX:o,blinking:s,className:c=`pointer-events-none absolute top-0 z-0`}){let l=ye(i,e=>e-n/2),u=e.bbox.x+e.bbox.w/2,d=e.bbox.y+e.bbox.h/2;return(0,X.jsx)(R.div,{"aria-hidden":`true`,className:c,style:{left:r-t/2,top:0,x:o,y:l,width:t,height:n,scale:a,transformOrigin:`center`},children:(0,X.jsx)(`svg`,{viewBox:`${e.bbox.x} ${e.bbox.y} ${e.bbox.w} ${e.bbox.h}`,width:t,height:n,style:{overflow:`visible`,display:`block`},children:(0,X.jsx)(`g`,{style:{transform:s?`scaleY(0.1)`:`scaleY(1)`,transformOrigin:`${u}px ${d}px`,transition:`transform 0.13s ease-in-out`},children:e.paths.map((e,t)=>(0,X.jsx)(`path`,{d:e.svgPath,fill:e.color},t))})})})}var zn={green:[`pink`,`purple`,`orange`,`yellow`],orange:[`teal`,`purple`,`green`,`yellow`],pink:[`teal`,`green`,`yellow`,`purple`],purple:[`yellow`,`teal`,`green`,`orange`],teal:[`pink`,`orange`,`yellow`,`purple`],yellow:[`purple`,`teal`,`pink`,`green`]};function Bn(e,t){let n=zn[e];return n&&n.length>0?n:t.filter(t=>t!==e)}var Vn=new Set([`orange`,`pink`,`red`]);function Hn(e,t){return Vn.has(e)&&Vn.has(t)}function Un(e,t,n){let r=Bn(e,t),i=[];for(let e of r){if(i.length>=n)break;i.some(t=>Hn(t,e))||i.push(e)}for(let e of r){if(i.length>=n)break;i.includes(e)||i.push(e)}return i}var Wn=`You’ve used AI that just answers questions.`,Gn=`The more I help,`,Kn=`I’m different.`,qn=`the better I get,`,Jn=`and the less you have to do.`,Yn=[{bodyShape:`blob`,eyeStyle:`gentle`},{bodyShape:`urchin`,eyeStyle:`curious`},{bodyShape:`star`,eyeStyle:`goofy`}],Xn=290;function Zn({firstH:e,secondH:t,color:n,firstText:r,secondText:i,revealed:a,carouseled:o,revealFrom:s,revealDuration:c,reduce:l}){let u=s===`bottom`?`inset(100% 0 0 0)`:`inset(0 0 100% 0)`;return!e||!t?null:(0,X.jsx)(R.div,{className:`relative w-full overflow-hidden`,initial:!1,animate:{height:o?t:e},transition:l?{duration:0}:{duration:.5,ease:`easeInOut`},children:(0,X.jsxs)(R.div,{className:`flex flex-col`,style:{color:n},initial:!1,animate:{y:o?-e:0},transition:l?{duration:0}:{duration:.5,ease:`easeInOut`},children:[(0,X.jsx)(`div`,{className:`flex items-center justify-center`,style:{height:e},children:(0,X.jsx)(R.span,{className:`block`,initial:!1,animate:{clipPath:a?`inset(0% 0 0% 0)`:u},transition:l?{duration:0}:{duration:c,ease:`easeOut`},children:r})}),(0,X.jsx)(`div`,{className:`flex items-center justify-center`,style:{height:t},children:(0,X.jsx)(`span`,{className:`block`,children:i})})]})})}function Qn({onContinue:e,onBack:t,onForward:n}){let r=_n(),a=z(),{art:o,eyesW:s,eyesH:c,restCy:l,centerX:u,w:d,h:f}=Ln(),p=q(),m=Z.use.characters(),h=Z.use.selectedIndex(),g=m.length>0?m[h]:void 0,_=f>0&&f<=800,v=_?.17:.22,y=_?`top-[17%]`:`top-[22%]`,b=Me(0),x=Me(1),S=(0,Y.useMemo)(()=>!p||!g?`orange`:Un(g.color,p.colors.map(e=>e.id),1)[0]??`orange`,[p,g]),C=Math.min(220,Math.max(150,d*.16)),w=-C,T=-C*.4,E=Me(-220),D=(0,Y.useMemo)(()=>!p||!g?[]:Un(g.color,p.colors.map(e=>e.id),3),[p,g]),O=Math.max(.42,Math.min(d/1100,1)),k=Math.round(Xn*O),A=-k*1.1,j=-k*.42,M=Me(-320),[N,P]=(0,Y.useState)(!!a),[ee,F]=(0,Y.useState)(!!a),[te,I]=(0,Y.useState)(!1),[ne,re]=(0,Y.useState)(!1),[ie,L]=(0,Y.useState)(!1),[ae,oe]=(0,Y.useState)(!1),[se,ce]=(0,Y.useState)(!!a),le=Math.min(d,768)-48,ue=(0,Y.useRef)(null),de=(0,Y.useRef)(null),fe=(0,Y.useRef)(null),pe=(0,Y.useRef)(null),me=(0,Y.useRef)(null),[he,ge]=(0,Y.useState)(0),[_e,ve]=(0,Y.useState)(0),[ye,be]=(0,Y.useState)(0),[xe,Se]=(0,Y.useState)(0),[V,Ce]=(0,Y.useState)(0);return(0,Y.useLayoutEffect)(()=>{ue.current?.offsetHeight&&ge(ue.current.offsetHeight),de.current?.offsetHeight&&ve(de.current.offsetHeight),fe.current?.offsetHeight&&be(fe.current.offsetHeight),pe.current?.offsetHeight&&Se(pe.current.offsetHeight),me.current?.offsetHeight&&Ce(me.current.offsetHeight)},[le]),(0,Y.useEffect)(()=>{b.set(l),oe(!0)},[l,b]),(0,Y.useEffect)(()=>{if(!a)return;let e=setTimeout(()=>{I(!0),re(!0),L(!0)},1400);return()=>clearTimeout(e)},[a]),(0,Y.useEffect)(()=>{if(a||!o)return;b.set(l),x.set(1),E.set(w),M.set(A),P(!1),F(!1),I(!1),re(!1);let e=Math.max(c*.5,f*v-36),t=[],n=[],r=!1,i=e=>(t.push(e),e),s=e=>new Promise(t=>{n.push(setTimeout(t,e))});return(async()=>{if(await s(200),r||(P(!0),await Promise.all([i(K(b,e,{duration:.55,ease:`easeOut`})),i(K(x,.55,{duration:.55,ease:`easeOut`}))]),r)||(F(!0),await Promise.all([i(K(b,l,{type:`spring`,stiffness:210,damping:15})),i(K(x,1,{duration:.45,ease:`easeOut`}))]),r)||(await s(900),r)||(I(!0),re(!0),await i(K(E,[w,T,T,w],{duration:1.5,times:[0,.28,.62,1],ease:[`easeOut`,`easeInOut`,`easeInOut`]})),r)||(await s(150),r))return;L(!0);let t=i(K(M,[A,j,j,A],{duration:1.5,times:[0,.28,.62,1],ease:[`easeOut`,`easeInOut`,`easeInOut`]}));await s(700),!r&&(ce(!0),await t)})(),()=>{r=!0,t.forEach(e=>e.stop()),n.forEach(clearTimeout)}},[a,o,f,v,c,l,b,x,E,w,T,M,A,j]),(0,X.jsxs)(`div`,{className:`absolute inset-0 z-10 overflow-hidden`,style:{color:r.fg},children:[(0,X.jsx)($,{onBack:t,onNext:n}),(0,X.jsxs)(`div`,{"aria-hidden":`true`,className:`pointer-events-none invisible absolute -left-[9999px] top-0 text-[clamp(2.25rem,5.5vw,4.5rem)] leading-[1.15]`,style:{width:le,fontFamily:`var(--font-serif)`},children:[(0,X.jsx)(`span`,{ref:ue,className:`block`,children:Wn}),(0,X.jsx)(`span`,{ref:de,className:`block`,children:Gn}),(0,X.jsx)(`span`,{ref:fe,className:`block`,children:Kn}),(0,X.jsx)(`span`,{ref:pe,className:`block`,children:qn}),(0,X.jsx)(`span`,{ref:me,className:`block`,children:Jn})]}),ae&&o&&(0,X.jsx)(Rn,{art:o,eyesW:s,eyesH:c,centerX:u,eyeCy:b,eyeScale:x,blinking:!1}),!a&&p&&(0,X.jsx)(R.div,{"aria-hidden":`true`,className:`pointer-events-none absolute z-[1]`,style:{left:Math.max(16,d*.05),top:0,y:E,width:C,height:C},children:(0,X.jsx)(B,{components:p,traits:{bodyShape:`blob`,eyeStyle:`goofy`,color:S},size:C,breathe:!1})}),!a&&p&&(0,X.jsx)(R.div,{"aria-hidden":`true`,className:`pointer-events-none absolute right-0 top-0 z-[1] flex items-start`,style:{right:-Math.round(k*.12),y:M},children:Yn.map((e,t)=>(0,X.jsx)(`div`,{style:{width:k,height:k,marginLeft:t===0?0:-k*.34,zIndex:Yn.length-t},children:(0,X.jsx)(B,{components:p,traits:{bodyShape:e.bodyShape,eyeStyle:e.eyeStyle,color:D[t]??`teal`},size:k,breathe:!1})},e.bodyShape))}),(0,X.jsxs)(`div`,{className:`${Ue.replace(`top-[30%]`,y)} max-w-3xl max-md:top-[34%]`,children:[(0,X.jsxs)(`div`,{className:`flex w-full flex-col gap-3 text-[clamp(2.25rem,5.5vw,4.5rem)] leading-[1.15]`,style:{fontFamily:`var(--font-serif)`},children:[(0,X.jsx)(Zn,{firstH:he,secondH:_e,color:r.fgDeep,firstText:Wn,secondText:Gn,revealed:N,carouseled:te,revealFrom:`bottom`,revealDuration:.55,reduce:!!a}),(0,X.jsx)(Zn,{firstH:ye,secondH:xe,color:r.fg,firstText:Kn,secondText:qn,revealed:ee,carouseled:ne,revealFrom:`top`,revealDuration:.45,reduce:!!a}),(0,X.jsx)(R.div,{className:`relative w-full overflow-hidden`,style:{color:r.fg},initial:!1,animate:{height:ie?V:0},transition:a?{duration:0}:{duration:.5,ease:`easeInOut`},children:V>0&&(0,X.jsx)(`div`,{className:`flex items-center justify-center`,style:{height:V},children:(0,X.jsx)(R.span,{className:`block`,initial:!1,animate:{clipPath:ie?`inset(0% 0 0% 0)`:`inset(100% 0 0 0)`},transition:a?{duration:0}:{duration:.5,ease:`easeOut`},children:Jn})})})]}),se&&(0,X.jsx)(R.div,{initial:a?!1:{opacity:0,y:8},animate:{opacity:1,y:0},transition:a?{duration:0}:{duration:.4},children:(0,X.jsx)(i,{type:`button`,variant:`primary`,size:`regular`,rightIcon:(0,X.jsx)(H,{size:16}),onClick:e,className:`h-11 w-[234px] text-base`,children:`Continue`})})]})]})}function $n({idSuffix:e}){let t=`cf-${e}`,n=`cr-${e}`,r=`cg-${e}`,i=`cs-${e}`;return(0,X.jsxs)(`svg`,{viewBox:`0 0 100 100`,width:`100%`,height:`100%`,style:{display:`block`,position:`absolute`,inset:0},children:[(0,X.jsxs)(`defs`,{children:[(0,X.jsxs)(`linearGradient`,{id:n,x1:`0.12`,y1:`0.05`,x2:`0.85`,y2:`0.95`,children:[(0,X.jsx)(`stop`,{offset:`0%`,stopColor:`#FFF0AE`}),(0,X.jsx)(`stop`,{offset:`50%`,stopColor:`#F4C231`}),(0,X.jsx)(`stop`,{offset:`100%`,stopColor:`#D29B1A`})]}),(0,X.jsxs)(`radialGradient`,{id:t,cx:`42%`,cy:`36%`,r:`82%`,children:[(0,X.jsx)(`stop`,{offset:`0%`,stopColor:`#FFF6CE`}),(0,X.jsx)(`stop`,{offset:`55%`,stopColor:`#F8CB3E`}),(0,X.jsx)(`stop`,{offset:`100%`,stopColor:`#EEB52C`})]}),(0,X.jsxs)(`radialGradient`,{id:r,cx:`36%`,cy:`24%`,r:`44%`,children:[(0,X.jsx)(`stop`,{offset:`0%`,stopColor:`#FFFFFF`,stopOpacity:`0.85`}),(0,X.jsx)(`stop`,{offset:`100%`,stopColor:`#FFFFFF`,stopOpacity:`0`})]}),(0,X.jsxs)(`radialGradient`,{id:i,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,X.jsx)(`stop`,{offset:`0%`,stopColor:`#FFFFFF`,stopOpacity:`1`}),(0,X.jsx)(`stop`,{offset:`100%`,stopColor:`#FFFFFF`,stopOpacity:`0`})]})]}),(0,X.jsx)(`circle`,{cx:`50`,cy:`50`,r:`49`,fill:`url(#${n})`}),(0,X.jsx)(`circle`,{cx:`50`,cy:`50`,r:`45.5`,fill:`none`,stroke:`#FFF6CF`,strokeOpacity:`0.6`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeDasharray:`70 210`,transform:`rotate(-128 50 50)`}),(0,X.jsx)(`circle`,{cx:`50`,cy:`50`,r:`40`,fill:`url(#${t})`}),(0,X.jsx)(`circle`,{cx:`50`,cy:`50`,r:`40`,fill:`none`,stroke:`#C28F18`,strokeOpacity:`0.35`,strokeWidth:`1.4`}),(0,X.jsxs)(`g`,{fontFamily:`var(--font-sans), system-ui, sans-serif`,fontWeight:900,fontSize:`58`,textAnchor:`middle`,children:[(0,X.jsx)(`text`,{x:`50`,y:`50`,dy:`0.355em`,fill:`#C88E16`,transform:`translate(1.3 1.6)`,children:`$`}),(0,X.jsx)(`text`,{x:`50`,y:`50`,dy:`0.355em`,fill:`#FFF6CF`,opacity:`0.7`,transform:`translate(-1.3 -1.5)`,children:`$`}),(0,X.jsx)(`text`,{x:`50`,y:`50`,dy:`0.355em`,fill:`#F4C12A`,children:`$`})]}),(0,X.jsx)(`ellipse`,{cx:`38`,cy:`28`,rx:`22`,ry:`14`,fill:`url(#${r})`}),(0,X.jsx)(`ellipse`,{cx:`34`,cy:`24`,rx:`7`,ry:`4.5`,fill:`url(#${i})`})]})}function er({size:e,tiltX:t=0,tiltY:n=0,shadow:r=!0,spinning:i=!1,className:a}){return(0,X.jsxs)(`div`,{style:{position:`relative`,width:e,height:e},children:[r&&(0,X.jsx)(`div`,{"aria-hidden":`true`,style:{position:`absolute`,left:`50%`,bottom:-e*.14,width:e*.74,height:e*.16,transform:`translateX(-50%)`,background:`radial-gradient(ellipse at center, rgba(0,0,0,0.22), rgba(0,0,0,0) 70%)`,filter:`blur(2px)`}}),(0,X.jsx)(`div`,{style:{width:e,height:e,perspective:e*10},children:(0,X.jsxs)(R.div,{className:a,style:{width:e,height:e,position:`relative`,transformStyle:`preserve-3d`},initial:!1,animate:{rotateX:t,rotateY:i?[n,n+360,n+760,n+1180]:n},transition:i?{duration:.95,times:[0,.32,.62,1],ease:`easeInOut`}:{duration:0},children:[(0,X.jsx)(`div`,{style:{position:`absolute`,inset:0,backfaceVisibility:`hidden`,transform:`translateZ(0.5px)`},children:(0,X.jsx)($n,{idSuffix:`front`})}),(0,X.jsx)(`div`,{style:{position:`absolute`,inset:0,backfaceVisibility:`hidden`,transform:`translateZ(-0.5px) rotateY(180deg)`},children:(0,X.jsx)($n,{idSuffix:`back`})})]})})]})}var tr=.3,nr=.95;function rr({onClaim:e,onBumpEyes:t,onBack:n,onForward:r}){let i=z(),a=_n(),{h:o}=zt(),[s,c]=(0,Y.useState)(!1);function l(){if(!s){if(c(!0),i){e();return}window.setTimeout(t,tr*1e3)}}let u=o*.42,d=-o*.08,f=o*.9;return(0,X.jsxs)(`div`,{className:`absolute inset-0 z-10`,style:{color:a.fg},children:[(0,X.jsx)($,{onBack:n,onNext:r}),(0,X.jsxs)(`div`,{className:`absolute left-1/2 top-[26%] flex w-full max-w-xl -translate-x-1/2 flex-col items-center gap-3 px-6 text-center`,children:[(0,X.jsxs)(`h1`,{className:`text-[2.6rem] leading-[1.1] max-md:max-w-[80vw]`,style:{fontFamily:`var(--font-serif)`},children:[`Here are some free credits`,(0,X.jsx)(`br`,{className:`max-md:hidden`}),` to get started.`]}),(0,X.jsx)(`div`,{className:`mt-10 flex flex-col items-center gap-4`,children:(0,X.jsx)(R.div,{animate:s&&!i?{y:[0,u,d,f],scale:[1,1,1,.2],opacity:[1,1,1,0]}:{},transition:{duration:nr,times:[0,tr/nr,.62,1],ease:[`easeIn`,`easeOut`,`easeIn`]},onAnimationComplete:()=>{s&&e()},children:(0,X.jsx)(er,{size:88,spinning:s&&!i})})}),!s&&(0,X.jsxs)(`button`,{type:`button`,onClick:l,className:`flex cursor-pointer h-11 w-[234px] items-center justify-center gap-2 rounded-[10px] text-body-medium-default transition-transform duration-150 active:scale-[0.97]`,style:{marginTop:Math.round(24+o*.05),backgroundColor:a.isLight?`#1A1A1A`:`#FFFFFF`,color:a.isLight?`#FFFFFF`:`#1A1A1A`},children:[`Claim`,(0,X.jsx)(H,{className:`h-4 w-4`})]})]})]})}Ae();var ir=640,ar=[{id:`companion-coworker`,left:`Companion`,right:`Coworker`,leftAvatar:{bodyShape:`blob`,eyeStyle:`gentle`,color:`pink`},rightAvatar:{bodyShape:`ninja`,eyeStyle:`curious`,color:`purple`}},{id:`genz-boomer`,left:`Gen Z`,right:`Baby Boomer`,leftAvatar:{bodyShape:`burst`,eyeStyle:`quirky`,color:`yellow`},rightAvatar:{bodyShape:`cloud`,eyeStyle:`dazed`,color:`green`}},{id:`execute-collaborate`,left:`Independent`,right:`Collaborative`,leftAvatar:{bodyShape:`star`,eyeStyle:`angry`,color:`orange`},rightAvatar:{bodyShape:`flower`,eyeStyle:`goofy`,color:`teal`}},{id:`playful-serious`,left:`Playful`,right:`Serious`,leftAvatar:{bodyShape:`star`,eyeStyle:`goofy`,color:`yellow`},rightAvatar:{bodyShape:`blob`,eyeStyle:`grumpy`,color:`purple`}},{id:`polite-unfiltered`,left:`Polite`,right:`Unfiltered`,leftAvatar:{bodyShape:`sprout`,eyeStyle:`bashful`,color:`green`},rightAvatar:{bodyShape:`urchin`,eyeStyle:`surprised`,color:`orange`}}],or=[`9%`,`27%`,`45%`,`62%`,`79%`],sr=50,cr=.3*.75,lr=`rgba(36, 41, 46, 0.2)`,ur=`#FDFDFC`,dr=.16;function fr(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=r[i-1],o=e[i+1],s=e[i]??``,c=e=>e===t||e===a;if(!c(s)){r.push(s);continue}let l=n.find(e=>!c(e)&&e!==o)??n.find(e=>!c(e))??s;r.push(l)}return r}function pr(){let[e,t]=(0,Y.useState)(()=>typeof window>`u`?1280:window.innerWidth);return(0,Y.useEffect)(()=>{let e=()=>t(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function mr({components:e,traits:t,side:n,top:r,size:i,progress:a}){let o=Math.max(0,Math.min(1,a)),s=100+dr*100,c=n===`left`?-100+s*o:100-s*o;return(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute`,style:{[n]:`calc(50% - 50vw)`,top:r,width:i,height:i,opacity:Math.min(1,o*1.6),transform:`translate(${c}%, -50%) scale(${.8+.2*o})`,transformOrigin:`${n} center`,transition:`transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease`,willChange:`transform, opacity`},children:(0,X.jsx)(B,{components:e,traits:t,size:i,breathe:!1})})}function hr({axis:e,value:t,onValueChange:n,fg:r,disabled:i}){return(0,X.jsxs)(`div`,{className:`flex w-full shrink-0 flex-wrap items-center gap-x-5 gap-y-1.5 sm:flex-nowrap`,style:{opacity:i?.7:1},children:[(0,X.jsx)(`span`,{className:`order-1 flex-1 text-left text-sm sm:w-32 sm:flex-none sm:text-right sm:text-[17px]`,style:{color:r},children:e.left}),(0,X.jsx)(`span`,{className:`order-2 flex-1 text-right text-sm sm:order-3 sm:w-32 sm:flex-none sm:text-left sm:text-[17px]`,style:{color:r},children:e.right}),(0,X.jsxs)(y,{className:`relative order-3 flex h-6 w-full touch-none items-center select-none sm:order-2 sm:w-auto sm:flex-1`,value:[t],onValueChange:e=>n(e[0]??sr),disabled:i,min:0,max:100,step:1,"aria-label":`${e.left} to ${e.right}`,children:[(0,X.jsx)(_,{className:`relative h-2 w-full grow rounded-full sm:h-3`,style:{backgroundColor:lr}}),(0,X.jsx)(v,{className:`block h-5 w-5 cursor-grab rounded-full shadow-sm transition-transform active:scale-95 active:cursor-grabbing keyboard-focus:outline-none keyboard-focus:ring-2 keyboard-focus:ring-white/70 data-[disabled]:cursor-not-allowed data-[disabled]:active:scale-100 sm:h-6 sm:w-6`,style:{backgroundColor:ur}})]})]})}function gr({components:e,values:t,sideAvatars:n,size:r}){return(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 -z-10`,children:ar.map((i,a)=>{let o=t[i.id]??sr,s=Math.max(0,(sr-o)/sr),c=Math.max(0,(o-sr)/sr),l=or[a]??`50%`,u=n[a];return u?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(mr,{components:e,traits:u.left,side:`left`,top:l,size:r,progress:s}),(0,X.jsx)(mr,{components:e,traits:u.right,side:`right`,top:l,size:r,progress:c})]},i.id):null})})}function _r({values:e,onValueChange:t,locked:n,onContinue:r,onBack:i,onForward:a}){let o=_n(),s=q(),c=pr(),{w:l,h:u}=zt(),d=Math.round(cr*Math.min(l,u))+12,f=c>=ir,p=Z.use.characters()[Z.use.selectedIndex()]?.color,m=Math.round(Math.min(300,Math.max(160,c*.16))),h=(0,Y.useMemo)(()=>{let e=s?.colors.map(e=>e.id)??[],t=fr(ar.map(e=>e.leftAvatar.color),p,e),n=fr(ar.map(e=>e.rightAvatar.color),p,e);return ar.map((e,r)=>({left:{...e.leftAvatar,color:t[r]??e.leftAvatar.color},right:{...e.rightAvatar,color:n[r]??e.rightAvatar.color}}))},[s,p]);return(0,X.jsxs)(`div`,{className:`absolute inset-0 z-10 overflow-hidden`,style:{color:o.fg},children:[(0,X.jsx)($,{onBack:i,onNext:a}),f&&s&&(0,X.jsx)(gr,{components:s,values:e,sideAvatars:h,size:m}),(0,X.jsxs)(`div`,{className:`absolute inset-x-0 top-0 bottom-0 mx-auto flex w-full max-w-2xl flex-col items-center overflow-y-auto px-6`,style:{paddingBottom:d},children:[(0,X.jsx)(`div`,{className:`w-full min-h-14 shrink-[4]`,style:{flexBasis:Math.round(u*.14)}}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-4`,children:[(0,X.jsx)(`h1`,{className:`text-center text-[2.6rem] leading-none`,style:{fontFamily:`var(--font-serif)`},children:`Create my personality`}),n?(0,X.jsx)(`p`,{className:`text-center text-[15px]`,style:{color:o.fgMuted},children:`Personality locked — chat with your assistant to make any more updates`}):null]}),(0,X.jsx)(`div`,{className:`w-full min-h-3 shrink-[2]`,style:{flexBasis:Math.round(40+u*.03)}}),ar.map((r,i)=>(0,X.jsxs)(Y.Fragment,{children:[i>0&&(0,X.jsx)(`div`,{className:`w-full min-h-2.5 shrink basis-8 sm:basis-11`}),(0,X.jsx)(hr,{axis:r,value:e[r.id]??sr,onValueChange:e=>t(r.id,e),fg:o.fg,disabled:n})]},r.id)),(0,X.jsx)(`div`,{className:`w-full min-h-3 shrink-[2] basis-14`}),(0,X.jsxs)(`button`,{type:`button`,onClick:r,className:`flex h-11 w-[234px] shrink-0 cursor-pointer items-center justify-center gap-2 rounded-[10px] text-body-medium-default transition-transform duration-150 active:scale-[0.97]`,style:{backgroundColor:o.isLight?`#1A1A1A`:`#FFFFFF`,color:o.isLight?`#FFFFFF`:`#1A1A1A`},children:[`Continue`,(0,X.jsx)(H,{className:`h-4 w-4`})]})]})]})}function vr({assistantId:e,assistantReady:t,onConnected:n,onSkip:r,onBack:i,onForward:a,missingCalendarScope:o=!1,onRetry:s,hatchError:c=null}){let l=_n(),{handleConnect:u,oauthInProgress:f}=Pe({assistantId:e??``,onConnect:n}),p=()=>{s?.(),u()},m=!e||!t,h=m||f;return(0,X.jsxs)(`div`,{className:`absolute inset-0 z-10`,style:{color:l.fg},children:[(0,X.jsx)($,{onBack:i,onNext:a}),(0,X.jsxs)(`div`,{className:`absolute left-1/2 top-[26%] flex w-[360px] -translate-x-1/2 flex-col items-center gap-5 text-center`,children:[(0,X.jsx)(`h1`,{className:`text-[2.6rem] leading-tight`,style:{fontFamily:`var(--font-serif)`},children:m?`Waking up`:o?`Access not enabled`:`Let me make this easy`}),(0,X.jsx)(`p`,{className:`text-[16px]`,style:{color:l.fgMuted},children:m?`Your assistant is getting ready`:o?`Check the box next to the Google Calendar permission so I can book the check-in.`:`Connect your Google Calendar so I can find time to check in and start helping.`}),(0,X.jsxs)(`div`,{className:`mt-6 flex w-[234px] flex-col items-center gap-4`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:p,disabled:h,className:`flex cursor-pointer h-11 w-full items-center justify-center gap-2 rounded-[10px] text-body-medium-default transition-transform duration-150 enabled:active:scale-[0.97] disabled:cursor-not-allowed disabled:opacity-60`,style:{backgroundColor:l.isLight?`#1A1A1A`:`#FFFFFF`,color:l.isLight?`#FFFFFF`:`#1A1A1A`},children:m?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(d,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}),`Starting assistant…`]}):f?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(d,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}),`Waiting for authorization…`]}):o?`Try again`:`Connect Calendar →`}),(!m||c)&&(0,X.jsx)(`button`,{type:`button`,onClick:r,disabled:f,className:`cursor-pointer text-body-small-default transition-opacity hover:opacity-100 disabled:opacity-60`,style:{color:l.fgMuted},children:`Skip for now`})]})]})]})}var yr=xe(`#17191C`);function br(){let[e,t]=(0,Y.useState)(()=>({w:typeof window>`u`?1280:window.innerWidth,h:typeof window>`u`?800:window.innerHeight}));return(0,Y.useEffect)(()=>{let e=()=>t({w:window.innerWidth,h:window.innerHeight});return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function xr(){let e=q(),t=Z.use.characters(),n=Z.use.selectedIndex();return{components:e,chosen:t.length>0?t[n]:void 0}}function Sr({size:e=64,isAssistantBusy:t=!1}){let{components:n,chosen:r}=xr();return!n||!r?(0,X.jsx)(`div`,{style:{width:e,height:e}}):(0,X.jsx)(`div`,{className:`shrink-0`,style:{width:e,height:e},children:(0,X.jsx)(B,{components:n,traits:r,size:e,isAssistantBusy:t})})}var Cr=`pt-[0.7rem] text-[2.6rem] leading-none`,wr=64,Tr=4500,Er=7e3;function Dr({onDone:e,onBack:t,onForward:n,scheduledTime:r,awaitingTime:i}){let{components:a,chosen:o}=xr(),s=z(),{w:c,h:l}=br(),u=r?`Check-in scheduled for tomorrow at ${r}!`:`Check-in scheduled!`;(0,Y.useEffect)(()=>{let t=setTimeout(e,i&&!r?Er:Tr);return()=>clearTimeout(t)},[e,i,r]);let d=(0,Y.useRef)(null),[f,p]=(0,Y.useState)(null);(0,Y.useLayoutEffect)(()=>{let e=()=>{let e=d.current?.getBoundingClientRect();e&&p({cx:e.left+e.width/2,cy:e.top+e.height/2})};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[u]);let m=1.3*Math.max(c,l)/wr,h=f?c/2-f.cx:0,g=f?l*.88-f.cy:0,_=l*.05;return(0,X.jsxs)(`div`,{className:`absolute inset-0 z-10 overflow-hidden text-white`,children:[(0,X.jsx)($,{onBack:t,onNext:n,tone:`light`}),(0,X.jsxs)(`div`,{className:`absolute left-1/2 top-[14%] sm:top-[26%] flex w-full max-w-xl -translate-x-1/2 items-start gap-3 px-6`,children:[(0,X.jsx)(`div`,{ref:d,className:`relative shrink-0`,style:{width:wr,height:wr},children:a&&o&&f&&(0,X.jsx)(R.div,{className:`absolute inset-0`,style:{transformOrigin:`center`},initial:s?!1:{scale:m,x:h,y:g},animate:{x:[h,h,0,0],y:[g,g+_,0,0],scale:[m,m,1.07,1]},transition:s?{duration:0}:{duration:1.1,times:[0,.18,.82,1],ease:[`easeOut`,`easeIn`,`easeOut`]},children:(0,X.jsx)(B,{components:a,traits:o,size:wr})})}),(0,X.jsx)(R.span,{className:Cr,style:{fontFamily:`var(--font-serif)`},initial:s?!1:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:s?{duration:0}:{duration:.4,delay:.9},children:u})]})]})}var Or=[`Searching the web to get to know you…`,`Reading public profiles…`,`Skimming the highlights…`,`Connecting the dots…`,`Piecing it together…`],kr=[`Updating my personality…`,`Finding my voice…`,`Getting into character…`],Ar=`Almost there…`,jr=[...Or,Ar],Mr=[...kr,Ar],Nr=2800;function Pr({onDone:e,onBack:t,onAdvance:n,onForward:r,ready:i}){let a=yr,[o,s]=(0,Y.useState)(0);return(0,Y.useEffect)(()=>{n?.(o);let t=o>=jr.length-1;if(i&&t){let t=setTimeout(e,Nr);return()=>clearTimeout(t)}let r=setTimeout(()=>s(e=>(e+1)%jr.length),Nr);return()=>clearTimeout(r)},[o,i,e,n]),(0,X.jsxs)(`div`,{className:`absolute inset-0 z-10`,style:{color:a.fg},children:[(0,X.jsx)($,{onBack:t,onNext:r}),(0,X.jsxs)(`div`,{className:`absolute left-1/2 top-1/2 flex w-full max-w-xl -translate-x-1/2 -translate-y-1/2 items-center gap-3 px-6`,children:[(0,X.jsx)(Sr,{isAssistantBusy:!0}),(0,X.jsx)(ve,{mode:`wait`,children:(0,X.jsx)(R.p,{className:`${Cr} flex min-h-[4.4rem] items-center !pt-0 !text-[2.08rem]`,style:{fontFamily:`var(--font-serif)`},initial:{y:12,opacity:0},animate:{y:0,opacity:1},exit:{y:-12,opacity:0},transition:{duration:.35},children:jr[o]},o)})]})]})}function Fr({onDone:e,ready:t}){let n=yr,[r,i]=(0,Y.useState)(0);return(0,Y.useEffect)(()=>{let n=Mr.length-1;if(t){if(r!==n){i(n);return}let t=setTimeout(e,Nr);return()=>clearTimeout(t)}let a=setTimeout(()=>i(e=>(e+1)%Mr.length),Nr);return()=>clearTimeout(a)},[r,t,e]),(0,X.jsx)(`div`,{className:`absolute inset-0 z-10`,style:{color:n.fg},children:(0,X.jsxs)(`div`,{className:`absolute left-1/2 top-[14%] sm:top-[26%] flex w-full max-w-xl -translate-x-1/2 items-start gap-3 px-6`,children:[(0,X.jsx)(Sr,{isAssistantBusy:!0}),(0,X.jsx)(ve,{mode:`wait`,children:(0,X.jsx)(R.p,{className:Cr,style:{fontFamily:`var(--font-serif)`},initial:{y:12,opacity:0},animate:{y:0,opacity:1},exit:{y:-12,opacity:0},transition:{duration:.35},children:Mr[r]},r)})]})})}function Ir({claims:e,loading:t,onContinue:n,onRejectAll:r,onBack:i,onForward:a}){let o=yr,s=z(),[c,l]=(0,Y.useState)(()=>new Set),u=e.filter(e=>!c.has(e.claim)),d=u.length>0,f=!t;return(0,X.jsxs)(`div`,{className:`absolute inset-0 z-10`,style:{color:o.fg},children:[(0,X.jsx)($,{onBack:i,onNext:a}),(0,X.jsxs)(`div`,{className:`absolute bottom-0 left-1/2 top-[11%] sm:top-[8%] z-10 flex w-full max-w-xl -translate-x-1/2 flex-col px-6 pb-8`,children:[(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto [&::-webkit-scrollbar]:hidden [scrollbar-width:none]`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(Sr,{}),(0,X.jsx)(`h1`,{className:`text-[2.2rem] leading-none`,style:{fontFamily:`var(--font-serif)`},children:`This is what I found about you`})]}),(0,X.jsx)(`p`,{className:`mb-7 mt-2 text-[15px]`,style:{color:o.fgMuted},children:d?t?`Still checking the rest. You can review these as they come in.`:`I searched the web. Feel free to remove anything that isn’t true.`:t?`Still putting this together…`:`I didn’t turn up much — we can fill it in as we chat.`}),(0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:(0,X.jsx)(ve,{children:u.map(e=>(0,X.jsxs)(R.div,{layout:!0,initial:s?!1:{opacity:0,y:10},animate:{opacity:1,y:0},exit:s?void 0:{opacity:0,scale:.95},className:`flex items-center justify-between gap-3 rounded-2xl px-5 py-4 text-[15px]`,style:{backgroundColor:o.isLight?`rgba(0,0,0,0.06)`:`rgba(255,255,255,0.1)`},children:[(0,X.jsx)(`span`,{children:e.claim}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Remove "${e.claim}"`,onClick:()=>l(t=>new Set(t).add(e.claim)),className:`flex cursor-pointer h-6 w-6 shrink-0 items-center justify-center rounded-full transition-opacity hover:opacity-100`,style:{color:o.fgMuted},children:(0,X.jsx)(m,{className:`h-4 w-4`})})]},e.claim))})}),d&&f&&(0,X.jsx)(`button`,{type:`button`,onClick:r,className:`mt-5 self-start shrink-0 cursor-pointer text-[14px] underline underline-offset-2 transition-opacity hover:opacity-80`,style:{color:o.fgMuted},children:`This is not me`})]}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>n([...c]),disabled:!f,className:`mt-8 flex cursor-pointer h-11 w-[200px] shrink-0 items-center justify-center gap-2 rounded-[10px] text-body-medium-default transition duration-150 enabled:active:scale-[0.97] disabled:cursor-not-allowed disabled:opacity-60`,style:{backgroundColor:o.isLight?`#1A1A1A`:`#FFFFFF`,color:o.isLight?`#FFFFFF`:`#1A1A1A`},children:[f?`Continue`:`Still searching…`,f&&(0,X.jsx)(H,{className:`h-4 w-4`})]})]})]})}var Lr=38,Rr=Lr;function zr({head:e,note:t,flyToNote:n,reduce:r,onLanded:i}){let{components:a,chosen:o}=xr();if(!a||!o)return null;let s=Lr/2,c=n&&t?t:e,l={x:c.x-s,y:c.y-s};return(0,X.jsx)(R.div,{className:`pointer-events-none absolute left-0 top-0`,style:{width:Lr,height:Lr,transformOrigin:`center`},initial:!1,animate:l,transition:r?{duration:0}:n&&t?{type:`spring`,duration:.9,bounce:.45}:{duration:.4},onAnimationComplete:()=>{n&&t&&i()},children:(0,X.jsx)(B,{components:a,traits:o,size:Lr})})}function Br({installedPlugins:e=[],pluginCatalog:t={},onStart:n,onBack:r,onForward:i,disabled:a=!1}){let o=yr,s=z(),[c,l]=(0,Y.useState)(!1),{components:u,chosen:d}=xr(),{h:f}=br(),p=e.map(e=>({name:e,displayName:Fe(e),description:t[e]?.trim()??``})).filter(e=>e.displayName.length>0),m=p.length>0,h=(0,Y.useRef)(null),g=(0,Y.useRef)(null),_=(0,Y.useRef)(null),[v,y]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(!1),w=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{w.current=b},[b]),(0,Y.useLayoutEffect)(()=>{let e=h.current,t=g.current;if(!e||!t)return;let n=()=>{if(w.current)return;let n=e.getBoundingClientRect(),r=e=>({x:e.left-n.left+e.width/2,y:e.top-n.top+e.height/2}),i=_.current;y({head:r(t.getBoundingClientRect()),note:i?r(i.getBoundingClientRect()):void 0})};n();let r=new ResizeObserver(n);return r.observe(e),window.addEventListener(`resize`,n),()=>{r.disconnect(),window.removeEventListener(`resize`,n)}},[]);let T=v?.note?.y;return(0,Y.useEffect)(()=>{T===void 0||b||x(!0)},[T,b]),(0,X.jsxs)(`div`,{className:`absolute inset-0 z-10`,style:{color:o.fg},children:[(0,X.jsx)($,{onBack:r,onNext:i}),(0,X.jsxs)(`div`,{ref:h,className:`absolute left-1/2 top-1/2 z-10 flex w-full max-w-xl -translate-x-1/2 -translate-y-1/2 flex-col px-6`,children:[(0,X.jsxs)(`div`,{className:`flex items-center`,children:[(0,X.jsx)(R.div,{ref:g,className:`shrink-0`,style:{height:Lr},initial:!1,animate:b?{width:0,marginRight:0}:{width:Lr,marginRight:12},transition:s?{duration:0}:{duration:.5,ease:`easeInOut`}}),(0,X.jsx)(`h1`,{className:`text-[2.2rem] leading-none`,style:{fontFamily:`var(--font-serif)`},children:`You’re all set`})]}),(0,X.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[S&&u&&d?(0,X.jsx)(`div`,{className:`shrink-0`,children:(0,X.jsx)(B,{components:u,traits:d,size:Rr})}):(0,X.jsx)(`div`,{ref:_,className:`shrink-0`,style:{width:Rr,height:Rr}}),(0,X.jsx)(R.p,{className:`text-[15px]`,style:{color:o.fg},initial:!1,animate:{opacity:+!!S,x:S?0:-6},transition:s?{duration:0}:{duration:.35},children:`I’ve set myself up with plugins around who you are.`})]}),m&&(0,X.jsx)(`div`,{className:`flex flex-col gap-3`,style:{marginTop:Math.round(64-f*.02)},children:p.map((e,t)=>(0,X.jsxs)(R.div,{initial:s?!1:{opacity:0,y:10},animate:{opacity:1,y:0},transition:s?{duration:0}:{duration:.3,delay:t*.06},className:`rounded-2xl px-5 py-4`,style:{backgroundColor:o.isLight?`rgba(0,0,0,0.06)`:`rgba(255,255,255,0.1)`},children:[(0,X.jsx)(`div`,{className:`text-[15px] font-medium`,children:e.displayName}),e.description&&(0,X.jsx)(`div`,{className:`mt-1 text-[13px] leading-snug`,style:{color:o.fgMuted},children:e.description})]},e.name))}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>{c||a||(l(!0),Promise.resolve().then(n).catch(()=>l(!1)))},disabled:c||a,className:`mt-16 flex cursor-pointer h-11 w-[200px] items-center justify-center gap-2 rounded-[10px] text-body-medium-default transition duration-150 enabled:active:scale-[0.97] disabled:cursor-not-allowed disabled:opacity-60`,style:{backgroundColor:o.isLight?`#1A1A1A`:`#FFFFFF`,color:o.isLight?`#FFFFFF`:`#1A1A1A`},children:[c?`Starting…`:`Let's chat`,!c&&(0,X.jsx)(H,{className:`h-4 w-4`})]}),v&&!S&&(0,X.jsx)(zr,{head:v.head,note:v.note,flyToNote:b&&v.note!==void 0,reduce:s,onLanded:()=>C(!0)})]})]})}var Vr=[{bodyShape:`sprout`,eyeStyle:`curious`,colorIdx:0,base:230,pos:e=>({left:-e*.32,top:`40%`})},{bodyShape:`flower`,eyeStyle:`goofy`,colorIdx:1,base:230,pos:e=>({right:-e*.32,top:`40%`})},{bodyShape:`star`,eyeStyle:`dazed`,colorIdx:2,base:240,mobile:!0,pos:e=>({left:`16%`,bottom:-e*.42}),mobilePos:e=>({left:-e*.3,bottom:-e*.3})},{bodyShape:`burst`,eyeStyle:`angry`,colorIdx:0,base:240,mobile:!0,pos:e=>({right:`16%`,bottom:-e*.42}),mobilePos:e=>({right:-e*.3,bottom:-e*.3})},{bodyShape:`blob`,eyeStyle:`gentle`,colorIdx:1,base:220,pos:e=>({left:`42%`,bottom:-e*.5})},{bodyShape:`urchin`,eyeStyle:`curious`,colorIdx:2,base:220,mobile:!0,pos:e=>({left:-e*.28,bottom:`16%`}),mobilePos:e=>({left:-e*.3,top:-e*.3})},{bodyShape:`burst`,eyeStyle:`quirky`,colorIdx:0,base:220,mobile:!0,pos:e=>({right:-e*.28,bottom:`16%`}),mobilePos:e=>({right:-e*.3,top:-e*.3})},{bodyShape:`flower`,eyeStyle:`quirky`,colorIdx:1,base:230,pos:e=>({left:`30%`,bottom:-e*.4})}],Hr=`#17191C`,Ur=[{bodyShape:`blob`,eyeStyle:`gentle`},{bodyShape:`urchin`,eyeStyle:`curious`},{bodyShape:`star`,eyeStyle:`goofy`}],Wr=290;function Gr({peekLevel:e=0,eyesBumpNonce:t=0,darkBg:n=!1,showBottomEyes:r=!0,showTopTeam:i=!1,eyesEntrance:a=!1}){let o=q(),s=Z.use.characters(),c=Z.use.selectedIndex(),l=z(),{w:u}=zt(),d=Math.max(.42,Math.min(u/1100,1)),f=u<640,p=s.length>0?s[c]:void 0,{bg:m,peekColors:h}=(0,Y.useMemo)(()=>!o||!p?{bg:`var(--surface-base)`,peekColors:[]}:{bg:o.colors.find(e=>e.id===p.color)?.hex??`var(--surface-base)`,peekColors:Un(p.color,o.colors.map(e=>e.id),3)},[o,p]);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(R.div,{className:`absolute inset-0 z-0`,initial:!1,animate:{backgroundColor:n?Hr:m},transition:l?{duration:0}:{duration:1,ease:`easeInOut`}}),r&&(0,X.jsx)(An,{bumpNonce:t,settleBlink:a,entrance:a}),i&&o&&(0,X.jsx)(`div`,{className:`pointer-events-none absolute right-0 z-[1] flex items-start`,style:{top:-Math.round(Wr*d)*.42,right:-Math.round(Wr*d)*.12},children:Ur.map((e,t)=>{let n=Math.round(Wr*d);return(0,X.jsx)(R.div,{style:{width:n,height:n,marginLeft:t===0?0:-n*.34,zIndex:Ur.length-t},initial:l?!1:{y:-140,opacity:0},animate:{y:0,opacity:1},transition:l?{duration:0}:{type:`spring`,stiffness:200,damping:18,delay:t*.1},children:(0,X.jsx)(B,{components:o,traits:{bodyShape:e.bodyShape,eyeStyle:e.eyeStyle,color:h[t]??`teal`},size:n,breathe:!1})},e.bodyShape)})}),o&&(0,X.jsx)(ve,{children:(f?Vr.filter(e=>e.mobile):Vr).slice(0,Math.max(0,e)).map((e,t)=>{let n=Math.round(e.base*d),r=f&&e.mobilePos?e.mobilePos(n):e.pos(n);return(0,X.jsx)(R.div,{"aria-hidden":`true`,className:`pointer-events-none absolute z-[1]`,style:{...r,width:n,height:n},initial:l?!1:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:l?void 0:{scale:0,opacity:0},transition:l?{duration:0}:{type:`spring`,stiffness:220,damping:16,delay:.1},children:(0,X.jsx)(B,{components:o,traits:{bodyShape:e.bodyShape,eyeStyle:e.eyeStyle,color:h[e.colorIdx]??`teal`},size:n,breathe:!1})},`peek-${t}`)})})]})}var Kr={established:!1,assistantName:null};async function qr(e,n={hasAnyActiveConversation:pe,fetchAssistantIdentity:Oe}){try{if(!await n.hasAnyActiveConversation(e))return Kr}catch(e){return t(e,{context:`research_onboarding_established_check`}),Kr}let r=await n.fetchAssistantIdentity(e).catch(()=>null);return{established:!0,assistantName:(typeof r?.name==`string`?r.name.trim():``)||null}}function Jr({assistantName:e,onKeep:t,onRedo:n,onBack:r}){let a=e?.trim()||``,o=a||`your assistant`,s=a?`${a}'s`:`its`;return(0,X.jsxs)(`div`,{"data-theme":`dark`,className:`relative h-full overflow-hidden`,style:{backgroundColor:`var(--surface-base)`,color:`var(--content-primary)`},children:[(0,X.jsx)($,{onBack:r,tone:`light`}),(0,X.jsxs)(`div`,{className:`${Ue} max-w-xl`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,X.jsx)(`h1`,{className:`text-[2.2rem] leading-none`,style:{fontFamily:`var(--font-serif)`},children:a?`${a} is already up and running`:`Your assistant is already up and running`}),(0,X.jsxs)(`p`,{className:`text-[15px]`,style:{color:`var(--content-secondary)`},children:[`You two have history — a personality, memories, and past conversations. Running setup again would overwrite who `,o,` is now.`]})]}),(0,X.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col items-center gap-3`,children:[(0,X.jsxs)(i,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:t,className:`h-11 text-base`,children:[`Keep `,o,` and start chatting`,(0,X.jsx)(H,{className:`h-4 w-4`})]}),(0,X.jsxs)(i,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:n,className:`h-11 text-base`,children:[`Start over and rebuild `,s,` personality`]})]})]})]})}var Yr=4e3;function Xr(e){return{firstName:e.firstName,lastName:e.lastName,occupation:e.role,hobbies:e.hobbies,timezone:fe()}}function Zr(e){let t=e.firstName.trim();return t?`Getting to know ${t}`:`Getting to know you`}Ae();function Qr(){let e=o(),t=re.use.user(),n=t?.id??null,r=V.use.enterFocus(),i=V.use.exitFocus(),s=V.use.setPendingAvatarTraits(),c=V.use.requestSidebarCollapse(),[l,u]=(0,Y.useState)(`form`),{ref:d,size:f}=ze(),[p,m]=(0,Y.useState)([]),[h,g]=(0,Y.useState)(!1);function _(e){u(e)}function v(e,t=`completed`){Ce(Se[l],{userId:n,outcome:t}),m([]),_(e)}function y(e){m(e=>[...e,l]),_(e)}function b(){let e=p[p.length-1];e&&(m(e=>e.slice(0,-1)),_(e))}let x=p.length>0?b:void 0,[S,T]=(0,Y.useState)(null),E=(0,Y.useRef)(null),[D,O]=(0,Y.useState)(null),[k,A]=(0,Y.useState)(null),j=(0,Y.useRef)(!1),[M,N]=(0,Y.useState)(!1),[P,ee]=(0,Y.useState)(null),[te,I]=(0,Y.useState)({}),[ne,ie]=(0,Y.useState)(!1),[L,ae]=(0,Y.useState)(null),[oe,ce]=(0,Y.useState)(null),[le,fe]=(0,Y.useState)(!1),[pe,R]=(0,Y.useState)(!1),[ve,z]=(0,Y.useState)(!1),[B,ye]=(0,Y.useState)(0),[be,xe]=(0,Y.useState)(0),[H]=a(),we=Xe({hostingParam:H.get(`hosting`),localMode:w(),gatewayAuthSession:C()}),Te=H.get(`assistant`)??void 0,Ee=we,{start:De,ready:Oe,assistantId:U,error:ke,awaitReady:W}=nt({adoptExisting:we,adoptAssistantId:Te}),Ae=Sn(U),G=Ot(),{start:Me,hydrate:Ne}=G,K=(0,Y.useRef)(Promise.resolve()),Pe=(0,Y.useRef)(!1),[Fe,q]=(0,Y.useState)(!1),J=(0,Y.useCallback)(e=>{Pe.current=e,q(e)},[]),[Ie,Le]=(0,Y.useState)(null),Re=(0,Y.useRef)(Promise.resolve()),[Be,Ve]=(0,Y.useState)(!1),He=G.status===`idle`||G.status===`running`,Ue=!He&&G.claims.length===0;(0,Y.useEffect)(()=>{i(),s(null),De()},[i,s,De]),(0,Y.useEffect)(()=>{if(E.current)return;let e=W().then(e=>qr(e)).catch(()=>Kr);E.current=e,e.then(O)},[W]);let We=(0,Y.useCallback)(()=>Promise.race([E.current??Promise.resolve(null),new Promise(e=>{setTimeout(()=>e(null),Yr)})]),[]);(0,Y.useLayoutEffect)(()=>{if(h||!n)return;let e=he(n);if(e?.formValues){T(e.formValues),ee(e.faceValues),ce(e.checkinTime),R(e.checkinBooked),Le(e.keptClaims??null),ae(e.researchConversationId??null),e.research&&(Ne({...e.research,pluginCatalog:e.research.pluginCatalog??{},droppedClaims:e.research.droppedClaims??[]},W),J(e.droppedClaimsScrubbed??!1),N(!0));let t=ge(e);u(Ee&&(t===`letschat`||t===`meeting`)?`looking`:t),m([])}g(!0)},[h,n,Ne,W,Ee,J]),(0,Y.useEffect)(()=>{!h||!S||me(n,{step:l,formValues:S,faceValues:P,checkinTime:oe,checkinBooked:pe,research:G.status===`done`?{status:`done`,claims:G.claims,droppedClaims:G.droppedClaims,suggestions:G.suggestions,installedPlugins:G.installedPlugins,pluginCatalog:G.pluginCatalog}:null,...L?{researchConversationId:L}:{},...Ie?{keptClaims:Ie}:{},...Fe?{droppedClaimsScrubbed:!0}:{}})},[h,n,l,Ie,S,P,oe,pe,L,G.status,G.claims,G.droppedClaims,G.suggestions,G.installedPlugins,G.pluginCatalog,Fe]),(0,Y.useEffect)(()=>{if(!h||!S||G.status!==`idle`&&G.status!==`done`)return;let e=G.status===`idle`,t=S,n=!1;return(async()=>{if(!j.current){let e=await We();if(n)return;if(e?.established){A(t),m([]),T(null),u(`existing`),N(!1);return}}N(!1),e&&Me({awaitAssistantId:W,subject:Xr(t),conversationTitle:Zr(t),...L?{resumeConversationId:L}:{},onConversationCreated:ae,includeSuggestions:!1})})(),()=>{n=!0,N(!1)}},[h,S,L,G.status,Me,W,!0,We]),(0,Y.useEffect)(()=>{l===`results`&&Ue&&(m([]),u(`suggestions`))},[l,Ue]),(0,Y.useEffect)(()=>{Pe.current||He||G.droppedClaims.length!==0&&(!L||!U||G.claims.length>0&&l!==`suggestions`||(J(!0),K.current=At({assistantId:U,conversationId:L,removedClaims:G.droppedClaims,rejectedAll:!1})))},[He,G.claims.length,G.droppedClaims,L,U,l,J]);function Ge(t,i,a,{skip:o=!1,hidden:l=!1}={}){_e(n);let{firstName:u,lastName:d,role:f,hobbies:p}=t,m=[u.trim(),d.trim()].filter(Boolean).join(` `),h=u.trim(),g=!o&&a===void 0;de({tools:[],tasks:[],tone:Ke,...m?{userName:m}:{},...f.trim()?{occupation:f.trim()}:{},...o?{}:{initialMessage:a??Ye({firstName:u,lastName:d,occupation:f,hobbies:p}),...l?{initialMessageHidden:!0}:{}},...g?{title:h?`Getting to know ${h}`:`Getting to know you`}:{},...i?.name?.trim()?{assistantName:i.name.trim()}:{},...Ie?.length?{researchFindings:Ie}:{}});let _=i?.name?.trim();_&&ue(_),s(i?.traits??null),g&&r(),o||F.markExpectingFirstMessage(),c(),F.checkAssistant(U??void 0).finally(()=>{e(`${se.assistant}?onboarding=1`,{replace:!0})})}async function qe(){S&&(await Promise.all([G.awaitPluginInstalls(),K.current,Re.current]),Ge(S,P,Ft(P?.name),{hidden:!0}))}function Je(e){J(!1),G.start({awaitAssistantId:W,subject:Xr(e),conversationTitle:Zr(e),onConversationCreated:ae,includeSuggestions:!1})}async function Ze(e){if(!j.current&&(await We())?.established){A(e),v(`existing`);return}T(e),Je(e),v(`face`)}function Qe(e){if(e.length>0&&!e.includes(`https://www.googleapis.com/auth/calendar.events`)){z(!0);return}if(z(!1),U&&S){let e=[S.firstName.trim(),S.lastName.trim()].filter(Boolean).join(` `);ce(null),R(!1),fe(!0),je({assistantId:U,userName:e||void 0,assistantName:P?.name?.trim()||void 0}).then(e=>{e.scheduled&&(R(!0),ce(It(e.start,e.timeZone)))}).finally(()=>fe(!1))}v(`meeting`)}if([`different`,`personality`,`integration`,`letschat`,`meeting`,`looking`,`results`,`suggestions`,`finishing`].includes(l)&&S){let e=[`meeting`,`looking`,`results`,`suggestions`,`finishing`].includes(l);return(0,X.jsx)(`div`,{ref:d,"data-theme":`dark`,className:`relative h-full overflow-hidden`,children:(0,X.jsxs)(Rt,{size:f,children:[(0,X.jsx)(Gr,{eyesBumpNonce:B,peekLevel:[`looking`,`results`,`suggestions`,`finishing`].includes(l)?be:0,darkBg:e,showBottomEyes:!e&&l!==`different`,eyesEntrance:l===`personality`}),l===`different`&&(0,X.jsx)(Qn,{onContinue:()=>v(`personality`),onBack:()=>y(`intro`),onForward:x}),l===`personality`&&(0,X.jsx)(_r,{values:te,onValueChange:(e,t)=>I(n=>({...n,[e]:t})),locked:ne,onContinue:()=>{ne||(Ve(!0),Re.current=Pt({awaitAssistantId:W,values:te,userName:S?.firstName?.trim()||void 0,assistantName:P?.name?.trim()||void 0}).finally(()=>Ve(!1)),ie(!0)),v(`integration`)},onBack:()=>y(`different`),onForward:x}),l===`integration`&&(0,X.jsx)(rr,{onClaim:()=>v(Ee?`looking`:`letschat`),onBumpEyes:()=>ye(e=>e+1),onBack:()=>y(`personality`),onForward:x}),l===`letschat`&&(0,X.jsx)(vr,{assistantId:U,assistantReady:Oe,hatchError:ke,onConnected:Qe,missingCalendarScope:ve,onRetry:()=>z(!1),onSkip:()=>{z(!1),v(`looking`,`skipped`)},onBack:()=>y(`integration`),onForward:x}),l===`meeting`&&(0,X.jsx)(Dr,{scheduledTime:oe??void 0,awaitingTime:le,onDone:()=>v(`looking`),onBack:()=>y(`letschat`),onForward:x}),l===`looking`&&(0,X.jsx)(Pr,{onDone:()=>v(Ue?`suggestions`:`results`),onBack:()=>y(Ee?`integration`:`letschat`),onAdvance:e=>xe(Math.min(e+1,4)),onForward:x,ready:!He}),l===`results`&&(0,X.jsx)(Ir,{claims:G.claims,loading:He,onContinue:e=>{let t=new Set(e);Le(G.claims.filter(e=>!t.has(e.claim)).map(e=>e.claim));let n=Pe.current?[]:G.droppedClaims,r=[...e,...n];L&&U&&r.length>0&&(n.length>0&&J(!0),K.current=At({assistantId:U,conversationId:L,removedClaims:r,rejectedAll:!1})),v(`suggestions`)},onRejectAll:()=>{Le([]),L&&U&&(J(!0),K.current=At({assistantId:U,conversationId:L,removedClaims:G.claims.map(e=>e.claim),rejectedAll:!0})),v(`suggestions`,`skipped`)},onBack:()=>y(`looking`),onForward:x}),l===`suggestions`&&(0,X.jsx)(Br,{installedPlugins:G.installedPlugins,pluginCatalog:G.pluginCatalog,disabled:M,onStart:async()=>{if(Ce(Se.suggestions,{userId:n,outcome:`completed`}),Be){m([]),u(`finishing`);return}await qe()},onBack:()=>y(Ue?`looking`:`results`),onForward:x}),l===`suggestions`&&!1,l===`finishing`&&(0,X.jsx)(Fr,{ready:!Be,onDone:()=>void qe()})]})})}return l===`existing`?(0,X.jsx)(Jr,{assistantName:D?.assistantName??null,onKeep:()=>{Ce(Se.existing,{userId:n,outcome:`completed`}),_e(n),F.checkAssistant(U??void 0).finally(()=>{e(se.assistant,{replace:!0})})},onRedo:()=>{let e=k;e&&(j.current=!0,Ce(Se.existing,{userId:n,outcome:`skipped`}),T(e),Je(e),m([]),_(`face`))},onBack:()=>{A(null),y(`form`)}}):l===`intro`&&S?(0,X.jsx)(Nn,{firstName:S.firstName,assistantName:P?.name,onContinue:()=>v(`different`),onBack:()=>y(`face`),onForward:x}):l===`face`&&S?(0,X.jsx)(xn,{voiceEnabled:Ae,assistantId:U,onContinue:e=>{ee(e),v(`intro`)},onBack:()=>y(`form`),onForward:x}):(0,X.jsx)(gn,{initialFirstName:t?.firstName??``,initialLastName:t?.lastName??``,onSubmit:Ze})}export{Qr as ResearchOnboardingRoute};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-BQVYX8n_.js";import{m as r,u as i}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./shield-check-C3mmA0Pk.js";import{t as s}from"./is-electron-y5bNUVyG.js";import{f as c,i as l,n as u}from"./auth-store-yYPy4QuG.js";import{_ as d}from"./native-biometric-DG8Pfu_V.js";import{u as f}from"./routes-D4ff4ONd.js";import{c as p,d as m,f as h,l as g,p as _,u as v}from"./prefs-CzauL-hH.js";import{Ra as y,gn as b}from"./index-D5iUyXUl.js";import{n as x,t as S}from"./consent-controls-a3lLNrbR.js";var C=e(t(),1),w={},T={"2026-06-22":[`Introduces Together AI as a new managed model provider`]};function E(e){return w[e]??[]}function D(e){return T[e]??[]}var O=a();function k(){let e=i(),[t]=r(),a=u.use.user()?.id??null,w=u.use.logout(),T=s(),k=l(),[A,j]=_(),[M,N]=v(),[P,F]=m(),[I,L]=h(),[R]=p(),[z]=g(),B=P??!0,V=I??!0,[H]=(0,C.useState)(()=>!A),[U]=(0,C.useState)(()=>!M),[W]=(0,C.useState)(()=>!R),[G]=(0,C.useState)(()=>!z),K=!H&&!U&&!W&&!G,q=H||K,J=U||K,Y=W||K,X=G||K,Z=!K&&!H&&!U,Q=K?`Terms & privacy`:Z?`Review your privacy preferences`:`Updated terms`,$=K?`Review your terms and privacy preferences anytime.`:Z?`Confirm your privacy preferences to continue.`:`We've updated our terms. Please review and accept to continue.`,ee=(0,C.useCallback)(()=>{c({userId:a,tos:A,privacy:M,shareAnalytics:Y?B:null,shareDiagnostics:X?V:null,hasPlatformSession:k}),e(d(t.get(`returnTo`),f.assistant),{replace:!0})},[M,k,e,t,B,V,Y,X,A,a]),te=(0,C.useCallback)(async()=>{await w(),y(f.account.login)},[w]),ne=q&&!A||J&&!M;return(0,O.jsx)(b,{showCreatureFooter:!1,children:(0,O.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${T?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[(0,O.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full border border-[var(--border-subtle)] bg-[var(--surface-lift)]`,style:{animation:`fadeInUp 0.5s ease-out 0.05s both`},children:(0,O.jsx)(o,{className:`h-6 w-6 text-[var(--content-secondary)]`,strokeWidth:1.75})}),(0,O.jsx)(`h1`,{className:`mt-5 ${T?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,style:{animation:`fadeInUp 0.5s ease-out 0.12s both`},children:Q}),(0,O.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${T?`mt-3`:`mt-3.5`}`,style:{animation:`fadeInUp 0.5s ease-out 0.2s both`},children:$}),(Y||X)&&(0,O.jsx)(x,{electron:T,showAnalytics:Y,showDiagnostics:X,shareAnalytics:B,shareDiagnostics:V,onShareAnalyticsChange:F,onShareDiagnosticsChange:L,className:`mt-9 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.28s both`}}),(J||q)&&(0,O.jsx)(S,{electron:T,showPrivacy:J,showTos:q,privacyConsent:M,tosAccepted:A,onPrivacyChange:N,onTosChange:j,privacyNotes:J?D(`2026-06-22`):[],tosNotes:q?E(`2026-06-08`):[],className:`mt-6 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.36s both`}}),(0,O.jsxs)(`div`,{className:`mt-9 flex w-full flex-col ${T?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.44s both`},children:[(0,O.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:ne,onClick:ee,className:T?void 0:`h-11 text-base`,children:`Continue`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:te,className:T?void 0:`h-11 text-base`,children:`Log out`})]})]})})}export{k as ReviewTermsScreen};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-CW7wKp2r.js";import{m as r,u as i}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./shield-check-C3mmA0Pk.js";import{t as s}from"./is-electron-y5bNUVyG.js";import{f as c,i as l,n as u}from"./auth-store-Lzg3kiaw.js";import{_ as d}from"./native-biometric-DG8Pfu_V.js";import{u as f}from"./routes-D4ff4ONd.js";import{c as p,d as m,f as h,l as g,p as _,u as v}from"./prefs-CzauL-hH.js";import{Ba as y,hn as b}from"./index-C7ix_asE.js";import{n as x,t as S}from"./consent-controls-HYKKj225.js";var C=e(t(),1),w={},T={"2026-06-22":[`Introduces Together AI as a new managed model provider`]};function E(e){return w[e]??[]}function D(e){return T[e]??[]}var O=a();function k(){let e=i(),[t]=r(),a=u.use.user()?.id??null,w=u.use.logout(),T=s(),k=l(),[A,j]=_(),[M,N]=v(),[P,F]=m(),[I,L]=h(),[R]=p(),[z]=g(),B=P??!0,V=I??!0,[H]=(0,C.useState)(()=>!A),[U]=(0,C.useState)(()=>!M),[W]=(0,C.useState)(()=>!R),[G]=(0,C.useState)(()=>!z),K=!H&&!U&&!W&&!G,q=H||K,J=U||K,Y=W||K,X=G||K,Z=!K&&!H&&!U,Q=K?`Terms & privacy`:Z?`Review your privacy preferences`:`Updated terms`,$=K?`Review your terms and privacy preferences anytime.`:Z?`Confirm your privacy preferences to continue.`:`We've updated our terms. Please review and accept to continue.`,ee=(0,C.useCallback)(()=>{c({userId:a,tos:A,privacy:M,shareAnalytics:Y?B:null,shareDiagnostics:X?V:null,hasPlatformSession:k}),e(d(t.get(`returnTo`),f.assistant),{replace:!0})},[M,k,e,t,B,V,Y,X,A,a]),te=(0,C.useCallback)(async()=>{await w(),y(f.account.login)},[w]),ne=q&&!A||J&&!M;return(0,O.jsx)(b,{showCreatureFooter:!1,children:(0,O.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${T?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[(0,O.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full border border-[var(--border-subtle)] bg-[var(--surface-lift)]`,style:{animation:`fadeInUp 0.5s ease-out 0.05s both`},children:(0,O.jsx)(o,{className:`h-6 w-6 text-[var(--content-secondary)]`,strokeWidth:1.75})}),(0,O.jsx)(`h1`,{className:`mt-5 ${T?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,style:{animation:`fadeInUp 0.5s ease-out 0.12s both`},children:Q}),(0,O.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${T?`mt-3`:`mt-3.5`}`,style:{animation:`fadeInUp 0.5s ease-out 0.2s both`},children:$}),(Y||X)&&(0,O.jsx)(x,{electron:T,showAnalytics:Y,showDiagnostics:X,shareAnalytics:B,shareDiagnostics:V,onShareAnalyticsChange:F,onShareDiagnosticsChange:L,className:`mt-9 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.28s both`}}),(J||q)&&(0,O.jsx)(S,{electron:T,showPrivacy:J,showTos:q,privacyConsent:M,tosAccepted:A,onPrivacyChange:N,onTosChange:j,privacyNotes:J?D(`2026-06-22`):[],tosNotes:q?E(`2026-06-08`):[],className:`mt-6 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.36s both`}}),(0,O.jsxs)(`div`,{className:`mt-9 flex w-full flex-col ${T?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.44s both`},children:[(0,O.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:ne,onClick:ee,className:T?void 0:`h-11 text-base`,children:`Continue`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:te,className:T?void 0:`h-11 text-base`,children:`Log out`})]})]})})}export{k as ReviewTermsScreen};
@@ -1,3 +1,3 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{c as t,i as n}from"./local-settings-C-dW2vkq.js";import{t as r}from"./react-DJZBPgpf.js";import{t as i}from"./createLucideIcon-Bjb-Kuq7.js";import{n as a,t as o}from"./create-selectors-8NePGNlX.js";import{n as s}from"./typed-storage-CiZjryGu.js";import{a as c}from"./diagnostics-DbnQqLDx.js";import{l}from"./chat-markdown-message-DdvPHLTI.js";import{t as u}from"./conversation-store-CnRrUeSu.js";import{s as ee,u as d}from"./messages-Bb68dDXK.js";import{C as f,D as p,n as te,t as ne,w as re,x as ie}from"./chat-BDhsGoUo.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,r)=>{let i=t();if(y(i)){if(!r?.canStartFromIdle)return;e({phase:`thinking`,statusText:n??null,lastTerminalReason:null});return}i.phase!==`awaiting_user_input`&&e({phase:`thinking`,statusText:n??null})},recoverFromAwaitingUserInput:()=>{t().phase===`awaiting_user_input`&&e({phase:`thinking`})},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){if(/^image\/jpe?g$/i.test(e))return`jpg`;let t=e.slice(6).toLowerCase();return/^[a-z0-9]+$/.test(t)?t:`jpg`}function Pe(e,t=`image/jpeg`){let n=`attachment`,r=e.trim()||n,i=Ne(t),a=r.match(/\.([^./\\]+)$/)?.[1]?.toLowerCase();return a===i||i===`jpg`&&a===`jpeg`?r:`${r.replace(/\.[^./\\]+$/,``)||n}.${i}`}async function Fe(e){if(!Me(e)||await Le(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 Ie(e)}catch{return{status:`failed`,error:`Couldn't resize this image for upload. Try a smaller image.`}}try{let n;try{n=await ze(t,e.size)}catch{n=null}if(!n||!je(e)&&n.size>=e.size)return{status:`failed`,error:`Couldn't resize this image for upload. Try a smaller image.`};let r=n.type.startsWith(`image/`)?n.type:`image/jpeg`;return{status:`resized`,file:new File([n],Pe(e.name,r),{type:r,lastModified:e.lastModified})}}finally{t.close()}}async function Ie(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 Le(e){if(!Re(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 Re(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 ze(e,t){let n=e.width*e.height,r=null;if(n<=De)for(let t of Ee){let n=await w(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 w(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 w(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 T(e){return`${Be}${e}`}function Ve(e){let t=n(T(e),``);if(!t)return new Map;try{let e=JSON.parse(t);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 E(e,n){t(T(e),JSON.stringify(Object.fromEntries(n)))}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 D=new Map,O=null,k=new Map,A=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()?D.set(e,t):D.delete(e),O&&E(O,D)},clearDraft:e=>{D.delete(e),O&&E(O,D)},handleConversationSwitch:({previousKey:n,nextKey:r})=>{if(!(n!==null&&n!==r)||!n)return;let i=t().input;i.trim()?D.set(n,i):D.delete(n);let a=(r&&D.get(r))??``;e({input:a,restoredDraftConversationId:a.length>0&&r?r:null}),O&&E(O,D)},loadAssistantDrafts:(n,r)=>{if(O&&O!==n){let n=t().input;r&&(n.trim()?D.set(r,n):D.delete(r)),E(O,D),e({input:``,restoredDraftConversationId:null})}D=Ve(n),O=n},clearRestoredDraftNotice:()=>{e({restoredDraftConversationId:null})},restoreDraftIfEmpty:n=>{let r=D.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 Fe(r);if(A.has(t.localId)){A.delete(t.localId);return}if(i.status===`failed`&&r.size>52428800){j(e,t.localId,i.error);return}let a=i.status===`failed`?r:i.file;if(a.size>52428800){j(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(A.has(t.localId)){A.delete(t.localId);return}if(!o.ok){j(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,d=o.sizeBytes??a.size,f=a;if(u.startsWith(`image/`)&&u!==s){let e=await l(n,o.id);if(A.has(t.localId)){A.delete(t.localId);return}e&&(f=e)}let p=null;try{p=URL.createObjectURL(f),k.set(t.localId,p)}catch{p=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:d,previewUrl:p,thumbnailUrl:null}:e)}))}catch{if(A.has(t.localId)){A.delete(t.localId);return}j(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`&&A.add(t),{attachments:e.attachments.filter(e=>e.localId!==t)}}),qe(t)},resetAttachments:()=>{e(e=>{for(let t of e.attachments)t.kind===`uploading`&&A.add(t.localId);return{attachments:[],attachmentLastError:null}})},fullReset:()=>{e(e=>{for(let t of e.attachments)t.kind===`uploading`&&A.add(t.localId);return{attachments:[],attachmentLastError:null}}),k.forEach(e=>URL.revokeObjectURL(e)),k.clear()},dismissAttachmentError:()=>{e({attachmentLastError:null})}}));function j(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=k.get(e);t&&(URL.revokeObjectURL(t),k.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 M=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 N(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=N(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`,_t=`daily_limit_reached`;function vt(e){return e?.errorCategory?e.errorCategory.endsWith(ht):e?.code===ft}function yt(e){return e?.errorCategory?e.errorCategory.endsWith(gt):!1}function bt(e){return e?.errorCategory?e.errorCategory.endsWith(_t):!1}function xt(e){return bt(e)?`daily_limit`:vt(e)?`managed_credits`:yt(e)?`provider_billing`:null}function P(e){return xt(e)!==null||e?.code===pt||e?.displayAs===`modal`}function St(e){return!!e&&!P(e)}function Ct(e){return e?.code===mt}var wt={pendingSecret:null,isSubmittingSecret:!1,secretSaved:!1,pendingConfirmation:null,isSubmittingConfirmation:!1,pendingContactRequest:null,isSubmittingContactRequest:!1,contactRequestAccepted:!1,pendingQuestion:null,isSubmittingQuestion:!1,isQuestionCardDismissed:!1,inlineConfirmationToolCallId:null,pendingAcpConnect:null,dismissedAcpConnectToolUseIds:new Set,pendingAcpContinue:!1,unknownNudgeToolCallIds:new Set},F=o(a()((e,t)=>({...wt,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}),showAcpConnect:t=>e(e=>e.dismissedAcpConnectToolUseIds.has(t.toolUseId)?{}:{pendingAcpConnect:t}),dismissAcpConnect:()=>e(e=>({pendingAcpConnect:null,dismissedAcpConnectToolUseIds:e.pendingAcpConnect?new Set(e.dismissedAcpConnectToolUseIds).add(e.pendingAcpConnect.toolUseId):e.dismissedAcpConnectToolUseIds})),requestAcpContinue:()=>e({pendingAcpContinue:!0}),clearAcpContinue:()=>e({pendingAcpContinue:!1}),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(wt)})));function Tt(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{c as t,i as n}from"./local-settings-C-dW2vkq.js";import{t as r}from"./react-DJZBPgpf.js";import{t as i}from"./createLucideIcon-Bjb-Kuq7.js";import{n as a,t as o}from"./create-selectors-8NePGNlX.js";import{n as s}from"./typed-storage-CiZjryGu.js";import{a as c}from"./diagnostics-DbnQqLDx.js";import{l}from"./chat-markdown-message-CjK8FRpm.js";import{t as u}from"./conversation-store-CnRrUeSu.js";import{s as ee,u as d}from"./messages-Bb68dDXK.js";import{C as f,D as p,n as te,t as ne,w as re,x as ie}from"./chat-CNlH625o.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,r)=>{let i=t();if(y(i)){if(!r?.canStartFromIdle)return;e({phase:`thinking`,statusText:n??null,lastTerminalReason:null});return}i.phase!==`awaiting_user_input`&&e({phase:`thinking`,statusText:n??null})},recoverFromAwaitingUserInput:()=>{t().phase===`awaiting_user_input`&&e({phase:`thinking`})},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){if(/^image\/jpe?g$/i.test(e))return`jpg`;let t=e.slice(6).toLowerCase();return/^[a-z0-9]+$/.test(t)?t:`jpg`}function Pe(e,t=`image/jpeg`){let n=`attachment`,r=e.trim()||n,i=Ne(t),a=r.match(/\.([^./\\]+)$/)?.[1]?.toLowerCase();return a===i||i===`jpg`&&a===`jpeg`?r:`${r.replace(/\.[^./\\]+$/,``)||n}.${i}`}async function Fe(e){if(!Me(e)||await Le(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 Ie(e)}catch{return{status:`failed`,error:`Couldn't resize this image for upload. Try a smaller image.`}}try{let n;try{n=await ze(t,e.size)}catch{n=null}if(!n||!je(e)&&n.size>=e.size)return{status:`failed`,error:`Couldn't resize this image for upload. Try a smaller image.`};let r=n.type.startsWith(`image/`)?n.type:`image/jpeg`;return{status:`resized`,file:new File([n],Pe(e.name,r),{type:r,lastModified:e.lastModified})}}finally{t.close()}}async function Ie(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 Le(e){if(!Re(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 Re(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 ze(e,t){let n=e.width*e.height,r=null;if(n<=De)for(let t of Ee){let n=await w(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 w(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 w(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 T(e){return`${Be}${e}`}function Ve(e){let t=n(T(e),``);if(!t)return new Map;try{let e=JSON.parse(t);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 E(e,n){t(T(e),JSON.stringify(Object.fromEntries(n)))}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 D=new Map,O=null,k=new Map,A=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()?D.set(e,t):D.delete(e),O&&E(O,D)},clearDraft:e=>{D.delete(e),O&&E(O,D)},handleConversationSwitch:({previousKey:n,nextKey:r})=>{if(!(n!==null&&n!==r)||!n)return;let i=t().input;i.trim()?D.set(n,i):D.delete(n);let a=(r&&D.get(r))??``;e({input:a,restoredDraftConversationId:a.length>0&&r?r:null}),O&&E(O,D)},loadAssistantDrafts:(n,r)=>{if(O&&O!==n){let n=t().input;r&&(n.trim()?D.set(r,n):D.delete(r)),E(O,D),e({input:``,restoredDraftConversationId:null})}D=Ve(n),O=n},clearRestoredDraftNotice:()=>{e({restoredDraftConversationId:null})},restoreDraftIfEmpty:n=>{let r=D.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 Fe(r);if(A.has(t.localId)){A.delete(t.localId);return}if(i.status===`failed`&&r.size>52428800){j(e,t.localId,i.error);return}let a=i.status===`failed`?r:i.file;if(a.size>52428800){j(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(A.has(t.localId)){A.delete(t.localId);return}if(!o.ok){j(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,d=o.sizeBytes??a.size,f=a;if(u.startsWith(`image/`)&&u!==s){let e=await l(n,o.id);if(A.has(t.localId)){A.delete(t.localId);return}e&&(f=e)}let p=null;try{p=URL.createObjectURL(f),k.set(t.localId,p)}catch{p=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:d,previewUrl:p,thumbnailUrl:null}:e)}))}catch{if(A.has(t.localId)){A.delete(t.localId);return}j(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`&&A.add(t),{attachments:e.attachments.filter(e=>e.localId!==t)}}),qe(t)},resetAttachments:()=>{e(e=>{for(let t of e.attachments)t.kind===`uploading`&&A.add(t.localId);return{attachments:[],attachmentLastError:null}})},fullReset:()=>{e(e=>{for(let t of e.attachments)t.kind===`uploading`&&A.add(t.localId);return{attachments:[],attachmentLastError:null}}),k.forEach(e=>URL.revokeObjectURL(e)),k.clear()},dismissAttachmentError:()=>{e({attachmentLastError:null})}}));function j(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=k.get(e);t&&(URL.revokeObjectURL(t),k.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 M=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 N(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=N(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`,_t=`daily_limit_reached`;function vt(e){return e?.errorCategory?e.errorCategory.endsWith(ht):e?.code===ft}function yt(e){return e?.errorCategory?e.errorCategory.endsWith(gt):!1}function bt(e){return e?.errorCategory?e.errorCategory.endsWith(_t):!1}function xt(e){return bt(e)?`daily_limit`:vt(e)?`managed_credits`:yt(e)?`provider_billing`:null}function P(e){return xt(e)!==null||e?.code===pt||e?.displayAs===`modal`}function St(e){return!!e&&!P(e)}function Ct(e){return e?.code===mt}var wt={pendingSecret:null,isSubmittingSecret:!1,secretSaved:!1,pendingConfirmation:null,isSubmittingConfirmation:!1,pendingContactRequest:null,isSubmittingContactRequest:!1,contactRequestAccepted:!1,pendingQuestion:null,isSubmittingQuestion:!1,isQuestionCardDismissed:!1,inlineConfirmationToolCallId:null,pendingAcpConnect:null,dismissedAcpConnectToolUseIds:new Set,pendingAcpContinue:!1,unknownNudgeToolCallIds:new Set},F=o(a()((e,t)=>({...wt,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}),showAcpConnect:t=>e(e=>e.dismissedAcpConnectToolUseIds.has(t.toolUseId)?{}:{pendingAcpConnect:t}),dismissAcpConnect:()=>e(e=>({pendingAcpConnect:null,dismissedAcpConnectToolUseIds:e.pendingAcpConnect?new Set(e.dismissedAcpConnectToolUseIds).add(e.pendingAcpConnect.toolUseId):e.dismissedAcpConnectToolUseIds})),requestAcpContinue:()=>e({pendingAcpContinue:!0}),clearAcpContinue:()=>e({pendingAcpContinue:!1}),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(wt)})));function Tt(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 Et(e){let t=[];for(let n of e?.contentBlocks??[])n.type===`text`&&t.push(n.text);return Tt(t)}function Dt(e){if(!(!e||e.length===0))return e.map(e=>{let{previewUrl:t,thumbnailUrl:n}=d(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 I(e){let t=e[e.length-1];return!!t&&t.role===`assistant`}function Ot(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 L(e,t){return e.findIndex(e=>e.role===`assistant`&&(e.id===t||!!e.mergedMessageIds?.includes(t)))}function R(e,t){if(!t||e.id===t)return e;let n=e.mergedMessageIds??[];return n.includes(t)?e:{...e,mergedMessageIds:[...n,t]}}function z(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 kt(e,t,n){return e.map(e=>e.id===t?{...e,queuePosition:n}:e)}function At(e,t){return e.map(e=>e.id===t?{...e,queueStatus:void 0,queuePosition:void 0}:e)}function jt(e,t){return e.filter(e=>e.id!==t)}function Mt(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 Nt(e,t,n){n&&e[e.length-1]?.type===t.type?e[e.length-1]=t:e.push(t)}function B(e,t,n,r){let i=R(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)),Nt(s,{type:`text`,text:a[a.length-1]},c);let l=[...e];return l[t]={...i,textSegments:a,contentOrder:o,contentBlocks:s},l}function V(e,t,n,r){let i=R(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)),Nt(s,{type:`thinking`,thinking:a[a.length-1]},c);let l=[...e];return l[t]={...i,thinkingSegments:a,contentOrder:o,contentBlocks:s},l}function Pt(e,t,n,r,i=Date.now()){if(n){let a=L(e,n);if(a>=0)return B(e,a,t,n);if(I(e))return B(e,e.length-1,t,n);let o=r?.();return o?B([...e,o],e.length,t,n):Mt(e,t,n,i)}return I(e)?B(e,e.length-1,t,void 0):Mt(e,t,n,i)}function Ft(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 It(e,t,n,r,i=Date.now()){if(n){let a=L(e,n);if(a>=0)return V(e,a,t,n);if(I(e))return V(e,e.length-1,t,n);let o=r?.();return o?V([...e,o],e.length,t,n):Ft(e,t,n,i)}return I(e)?V(e,e.length-1,t,void 0):Ft(e,t,n,i)}function Lt(e,t=Date.now()){let n=!1,r=e.map(e=>{if(e.role!==`assistant`)return e;let r=z(e,t);return r?(n=!0,{...e,...r}):e});return n?r:e}function Rt(e,t,n=Date.now()){let r=e[e.length-1],i=Dt(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=z(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 zt(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 Bt(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=zt(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 Vt(e,t=Date.now()){let n=e.length-1,r=e[n];if(!r||r.role!==`assistant`)return e;let i=z(r,t);if(!(Et(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 H(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 U(e,t,n,r){let i=R(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:H(i.contentBlocks,r)},o}return o[t]={...i,toolCalls:[...i.toolCalls??[],n],contentOrder:[...i.contentOrder??[],{type:`toolCall`,id:n.id}],contentBlocks:H(i.contentBlocks,n)},o}function Ht(e,t,n,r=Date.now()){if(n){let r=L(e,n);if(r>=0)return U(e,r,t,n);if(I(e))return U(e,e.length-1,t,n)}else if(I(e))return U(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 Ut(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},...t.errorCode===void 0?{}:{errorCode:t.errorCode},completedAt:t.completedAt??Date.now(),streamedOutput:void 0};c[r]=l;let u=[...e];return u[n]={...i,toolCalls:c,contentBlocks:H(i.contentBlocks,l)},u}var Wt=16384;function Gt(e){return e.length<=16384?e:e.slice(e.length-Wt)}function Kt(e,t){if(!t.chunk)return e;let n=-1,r=-1;if(t.toolUseId){if(t.messageId){let i=L(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:Gt((a.streamedOutput??``)+t.chunk)},s=[...i.toolCalls];s[r]=o;let c=[...e];return c[n]={...i,toolCalls:s,contentBlocks:H(i.contentBlocks,o)},c}function qt(e,t,n,r=Date.now()){let i=-1;if(n&&(i=L(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=R(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:N(r.contentBlocks,t)}}return a}function Jt(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:N(i.contentBlocks,c)},l}return e}function Yt(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 Xt(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:N(e[r].contentBlocks,a)},o}return e}var Zt=[`choice`,`oauth_connect`,`form`,`confirmation`,`file_upload`,`card`,`list`,`table`,`browser_view`,`task_preferences`];function Qt(e){return e==null||e.hasPendingConfirmation||e.hasUncompletedVisibleSurface}function $t(e,t){let n=!1,r=e.map(e=>{let r=ie(e,e=>e.pendingConfirmation?.requestId===t?{...e,pendingConfirmation:void 0}:e);return r!==e&&(n=!0),r});return n?r:e}function en(e){let t=!1,n=e.map(e=>{let n=ie(e,e=>e.pendingConfirmation?{...e,pendingConfirmation:void 0}:e);return n!==e&&(t=!0),n});return t?n:e}function tn(e,t){let n=new Set;for(let e of t)if(e.surfaces)for(let t of e.surfaces)re(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 nn(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(!Zt.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 rn(e,t,n){return e&&ne[e]||t||n}function W(e){return typeof e==`string`?e:void 0}function an(e){return typeof e==`boolean`?e:void 0}function on(e){return Array.isArray(e)?e:void 0}function sn(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function G(e){return Array.isArray(e)?e:void 0}function cn(e){return{requestId:typeof e.requestId==`string`?e.requestId:``,label:W(e.label),service:W(e.service),field:W(e.field),description:W(e.description),placeholder:W(e.placeholder),allowOneTimeSend:an(e.allowOneTimeSend),allowedTools:on(e.allowedTools),allowedDomains:on(e.allowedDomains),purpose:W(e.purpose)}}function ln(e){let t={requestId:typeof e.requestId==`string`?e.requestId:``,title:W(e.title),description:W(e.description),toolName:W(e.toolName),riskLevel:W(e.riskLevel),riskReason:W(e.riskReason),allowlistOptions:G(e.allowlistOptions),scopeOptions:G(e.scopeOptions),directoryScopeOptions:G(e.directoryScopeOptions),persistentDecisionsAllowed:an(e.persistentDecisionsAllowed),input:sn(e.input),toolUseId:W(e.toolUseId)};return{confData:t,state:{...t,confirmLabel:W(e.confirmLabel),denyLabel:W(e.denyLabel)}}}function un(){return`turn-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function dn(e,t){let n=Date.parse(e);return Number.isFinite(n)?n:typeof t==`number`?t:0}function fn(e,t,n){switch(t.type){case`assistant_text_delta`:return Pt(e,t.text,t.messageId,void 0,n);case`assistant_thinking_delta`:return It(e,t.thinking,t.messageId,void 0,n);case`message_complete`:return Rt(e,t,n);case`user_message_echo`:return Bt(e,{text:t.text,messageId:t.messageId,clientMessageId:t.clientMessageId},n);case`assistant_activity_state`:return t.phase===`idle`?Lt(e,n):e;case`conversation_error`:return Vt(e,n);case`tool_use_preview_start`:return Ht(e,{id:t.toolUseId,name:t.toolName,input:{},previewStartedAt:typeof t.previewStartedAt==`number`?t.previewStartedAt:n},t.messageId,n);case`tool_use_start`:return Ht(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 Ut(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,errorCode:t.errorCode,completedAt:`completedAt`in t&&typeof t.completedAt==`number`?t.completedAt:n});case`tool_output_chunk`:return t.chunk?Kt(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=f(r),qt(e,r,t.messageId,n)}case`ui_surface_update`:return Jt(e,t.surfaceId,t.data);case`ui_surface_dismiss`:return Yt(e,t.surfaceId);case`ui_surface_complete`:return Xt(e,t.surfaceId,t.summary);case`confirmation_request`:return te(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`?$t(e,t.requestId):e;default:return e}}function pn(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 mn(e,t){let{seq:n}=t;if(typeof n==`number`&&typeof e.seq==`number`&&n<=e.seq)return e;let r=dn(t.emittedAt,n),i=fn(e.messages,t.message,r),a=typeof n==`number`?Math.max(e.seq??-1,n):e.seq??null,o=pn(e.processing,t.message,n);return{...e,messages:i,seq:a,processing:o}}function hn(e,t){return t.reduce(mn,e)}function gn(e,t){return t===null?e:hn(e,t)}function _n(e){return[...new Set([e.id,...e.mergedMessageIds??[]].filter(e=>typeof e==`string`&&e.length>0))]}function K(e){let t=_n(e);return e.clientMessageId&&!t.includes(e.clientMessageId)?[...t,e.clientMessageId]:t}var vn={hasMore:!1,oldestTimestamp:null,isLoadingOlder:!1};function yn(){return{snapshot:null,optimisticSends:[],error:null,notice:null,isLoadingHistory:!0,transcriptPagination:{...vn},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 q(e,t){return typeof t==`function`?t(e):t}function bn(e,t){if(e.length===0)return e;let n=new Map;for(let e of t)for(let t of K(e))n.has(t)||n.set(t,e);let r=e.filter(e=>{let t;for(let r of K(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 J=o(a()((e,t)=>({...yn(),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=gn(r,a);e(e=>({snapshot:o,optimisticSends:bn(e.optimisticSends,o.messages)}))},applyEnvelopeToSnapshot:t=>e(e=>e.snapshot?{snapshot:mn(e.snapshot,t)}:{}),addOptimisticSend:t=>e(e=>({optimisticSends:[...e.optimisticSends,t]})),setOptimisticSends:t=>e(e=>({optimisticSends:q(e.optimisticSends,t)})),patchSnapshotMessages:t=>e(e=>e.snapshot?{snapshot:{...e.snapshot,messages:t(e.snapshot.messages)}}:{}),setError:t=>e(e=>({error:q(e.error,t)})),setNotice:t=>e(e=>({notice:q(e.notice,t)})),setIsLoadingHistory:t=>e({isLoadingHistory:t}),setTranscriptPagination:t=>e(e=>({transcriptPagination:q(e.transcriptPagination,t)})),setContextWindowUsage:t=>e(e=>({contextWindowUsage:q(e.contextWindowUsage,t)})),setCompactionCircuitOpenUntil:t=>e(e=>({compactionCircuitOpenUntil:q(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=F.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}),M.getState().handleConversationSwitch({previousKey:a??null,nextKey:r}),we.getState().resetTurn(),F.getState().resetAll(),o?M.getState().fullReset():M.getState().resetAttachments();let l=s?ut(n):i.contextWindowUsageByConversation;e({snapshot:null,optimisticSends:[],ephemeralMetaResults:[],error:P(i.error)?i.error:null,notice:null,isLoadingHistory:!0,transcriptPagination:{...vn},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 xn(e,t){if(t.length===0)return e;let n=new Map;for(let e of t)for(let t of K(e))n.has(t)||n.set(t,e);let r=[],i=new Set;for(let t of e){let e;for(let r of K(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 Sn(){let e=J.use.snapshot(),t=J.use.optimisticSends(),n=J.use.dismissedSurfaceIds();return(0,le.useMemo)(()=>xn(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 Cn(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 wn(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:wn(t)}function Tn(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 En(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 Dn(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 On(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 kn(e,t=``){let n=e.toLowerCase(),r=t.replace(/\s+/g,` `).trim(),i=Cn(r),a=Z(e,r);if(a)return Tn(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 An(e,t=``,n){let r=Z(e,t);if(r)return En(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 jn(e){return e.split(/[_-]+/).filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)}function Mn(e,t=``){let n=Z(e,t);if(n)return Dn(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 Nn=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 Pn(e){if(!e)return``;let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n===-1?t:t.slice(n+1)}function Fn(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=Fn(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(),Nn),activity:i,iconName:`terminal`};case`str_replace_editor`:case`text_editor`:{let e=Q(n,`command`).toLowerCase(),t=Pn(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 ${jn(e)}`:`Running tool`,info:``,activity:i,iconName:`bolt`}}}function In(e){return $(e.name,e.input)}var Ln=[{open:`<thinking>`,close:`</thinking>`},{open:`<think>`,close:`</think>`}];function Rn(e){return Ln.some(t=>e.includes(t.open))}function zn(e){if(!Rn(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 Ln){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 Bn(e){return typeof e.id==`string`&&e.id.length>0}function Vn(e){return e.some(e=>e.type===`text`&&Rn(e.text))?e.flatMap(e=>{let t=e.type===`text`?zn(e.text):null;return t?t.map(e=>e.type===`thinking`?{type:`thinking`,thinking:e.thinking}:{type:`text`,text:e.text}):[e]}):e}function Hn(e,t){let n=t?.splitInlineThinking?Vn(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(!Bn(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 Un(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;Wn(e)||(n.push(e),t.push({kind:`toolCall`,toolCall:e}))}return{cardItems:t,toolCalls:n}}function Wn(e){return!e.pendingConfirmation&&(e.name===`ui_show`||e.name===`ui_update`||e.name===`ui_dismiss`)}function Gn(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 Kn(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 qn(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 Jn(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 Yn=new Set([`low`,`medium`,`high`]);function Xn(e){let t=e?.toLowerCase();return t&&Yn.has(t)?t:`medium`}function Zn(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 Qn(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 $n(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 er={unknown:2,low:0,medium:1,high:2},tr={none:-1,low:0,medium:1,high:2};function nr(e,t,n){return e?.toLowerCase()!==`auto`||!n?!0:(er[(t??``).toLowerCase()]??-1)<=(tr[n.toLowerCase()]??-1)}function rr(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 ir(e,t){return e===`sandbox_auto_approve`?{displayLevel:`workspace`,inherentRisk:t}:{displayLevel:t??`unknown`}}export{Je as $,tn as A,I as B,xn as C,$t as D,K as E,Qt as F,St as G,F as H,At as I,at as J,P as K,Ot as L,ln as M,cn as N,en as O,rn as P,Ye as Q,jt as R,Sn as S,_n as T,xt as U,Et as V,Ct as W,Qe as X,et as Y,Xe as Z,An as _,Qn as a,ve as at,jn as b,Un as c,pe as ct,Jn as d,fe as dt,M as et,Kn as f,ce as ft,On as g,$ as h,ae as ht,$n as i,xe as it,un as j,nn as k,Hn as l,he as lt,In as m,oe as mt,rr as n,Ce as nt,Xn as o,ye as ot,Gn as p,se as pt,dt as q,Zn as r,we as rt,nr as s,_e as st,ir as t,v as tt,qn as u,me as ut,Mn as v,J as w,Y as x,kn as y,kt as z};