@mycadet/web 0.12.8 → 0.12.9

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 (208) hide show
  1. package/dist/assets/{a2a-invite-S74k5mzP.js → a2a-invite-QwLkdzoC.js} +1 -1
  2. package/dist/assets/{about-page-DyXvah3b.js → about-page-B_JVAkzb.js} +1 -1
  3. package/dist/assets/{account-page-Bto5XueR.js → account-page-CogcrHfl.js} +1 -1
  4. package/dist/assets/{account-shell-CcrYy1Gi.js → account-shell-CaNt5YTy.js} +1 -1
  5. package/dist/assets/{acp-run-detail-panel-6rMAmeGf.js → acp-run-detail-panel-CP2w6xWq.js} +1 -1
  6. package/dist/assets/{activation-list-route-DEc7Nydy.js → activation-list-route-DhFybN08.js} +1 -1
  7. package/dist/assets/{activity-redirect-page-Fj-SvRGq.js → activity-redirect-page-CXQh1ANc.js} +1 -1
  8. package/dist/assets/{activity-steps-panel-CPMerTsn.js → activity-steps-panel-B_e7fo5d.js} +1 -1
  9. package/dist/assets/{add-credits-modal-zPPHPAJC.js → add-credits-modal-9QAiKkzN.js} +1 -1
  10. package/dist/assets/add-credits-modal-Ix6EeRaW.js +1 -0
  11. package/dist/assets/{ai-page-DpOLL1Cf.js → ai-page-B2OQRNjs.js} +1 -1
  12. package/dist/assets/{all-chats-page-route-C-XHiLQy.js → all-chats-page-route-DyAsat0t.js} +1 -1
  13. package/dist/assets/{android-billing-handoff-DKLezn_S.js → android-billing-handoff-CNDHANI3.js} +1 -1
  14. package/dist/assets/{animated-stat-square-BU2cZ2yE.js → animated-stat-square-dwxhuRgk.js} +1 -1
  15. package/dist/assets/{api-key-screen-DjKTR4Wr.js → api-key-screen-sXJo9h2L.js} +1 -1
  16. package/dist/assets/{app-CGffgaON.js → app-BNxKtvfM.js} +33 -33
  17. package/dist/assets/{app-info-Dzir1MF3.js → app-info-BWhtZVwd.js} +1 -1
  18. package/dist/assets/{archive-redirect-page-B35h0qMl.js → archive-redirect-page-8VfIdYbY.js} +1 -1
  19. package/dist/assets/{assistant-handle-modal-CCjfVewp.js → assistant-handle-modal-BEF0aNRE.js} +1 -1
  20. package/dist/assets/{assistant-inbox-page-route-gDwC5zAt.js → assistant-inbox-page-route-C2cqOdmg.js} +1 -1
  21. package/dist/assets/{assistant-status-panel-B4KyLsgX.js → assistant-status-panel-DCxA9DDF.js} +1 -1
  22. package/dist/assets/auth-store-CDCjQtV1.js +1 -0
  23. package/dist/assets/{auth-welcome-screen-D3ES6d_K.js → auth-welcome-screen-EpKCTMv_.js} +1 -1
  24. package/dist/assets/avatar-bundled-components-DjgVURNE.js +1 -0
  25. package/dist/assets/{avatar-random-GdFF3KT1.js → avatar-random-BnJhjNyL.js} +1 -1
  26. package/dist/assets/{await-org-header-settled-B8OULI5x.js → await-org-header-settled-DIN659KU.js} +1 -1
  27. package/dist/assets/{background-task-detail-panel-D-gfV8cA.js → background-task-detail-panel-CK5CkHAh.js} +1 -1
  28. package/dist/assets/{billing-page-DpBwQzdt.js → billing-page-DxzuCWv_.js} +3 -3
  29. package/dist/assets/{billing-redirect-page-eAiiFN78.js → billing-redirect-page-3KVpziky.js} +1 -1
  30. package/dist/assets/{bookmarks-page-CSlXo0sR.js → bookmarks-page-DU4zQI88.js} +1 -1
  31. package/dist/assets/{bundle-confirm-page-Bcm9pKNZ.js → bundle-confirm-page-BF_TkeTV.js} +1 -1
  32. package/dist/assets/camera-capture-overlay-T0uYBvOu.js +1 -0
  33. package/dist/assets/{channel-transcript-panel-DPuZkTwm.js → channel-transcript-panel-B1TEFqiF.js} +1 -1
  34. package/dist/assets/{channels-page-route-Cny62l_j.js → channels-page-route-DeocXDqs.js} +1 -1
  35. package/dist/assets/{chat-info-panel-D17faG13.js → chat-info-panel-lH_eTIGQ.js} +1 -1
  36. package/dist/assets/{checkout-continuation-7dEznmik.js → checkout-continuation-syD1rPaq.js} +1 -1
  37. package/dist/assets/{checkout-page-p7LdgQze.js → checkout-page-CDxb2TKu.js} +1 -1
  38. package/dist/assets/checkout-return-target-Kr5OSzWN.js +1 -0
  39. package/dist/assets/{cloud-export-97vA7Pm2.js → cloud-export-BomC8LTr.js} +1 -1
  40. package/dist/assets/{cloud-loopback-page-D2BotkZe.js → cloud-loopback-page-CKanLlm2.js} +1 -1
  41. package/dist/assets/command-palette-B7s1-xLZ.js +1 -0
  42. package/dist/assets/{command-palette-BT_juy2T.js → command-palette-CCerSENn.js} +1 -1
  43. package/dist/assets/{command-palette-window-page-BEOnIIIB.js → command-palette-window-page-DB4W1uBp.js} +1 -1
  44. package/dist/assets/{community-page-DSFCzNlP.js → community-page-JCjpT273.js} +1 -1
  45. package/dist/assets/{companion-accent-BnQ_HHAs.js → companion-accent-DNqagkeK.js} +1 -1
  46. package/dist/assets/{companion-dock-zones-page-Cwk-m5lx.js → companion-dock-zones-page-B5FQh1TR.js} +1 -1
  47. package/dist/assets/{companion-layout-C8BAml92.js → companion-layout-BJ70ZoB6.js} +1 -1
  48. package/dist/assets/{companion-popover-9C2r1GyG.js → companion-popover-ojFFv5gc.js} +1 -1
  49. package/dist/assets/{companion-popover-page-Slqq_QRZ.js → companion-popover-page-CcjHgR5K.js} +1 -1
  50. package/dist/assets/{companion-surface-2FTY6hzz.js → companion-surface-BheNXy_6.js} +1 -1
  51. package/dist/assets/{companion-surface-page-BCDuCzpC.js → companion-surface-page-BxYp5tfL.js} +1 -1
  52. package/dist/assets/{companion-tour-entry-BdZ_ZZY5.js → companion-tour-entry-Cv7pdZrq.js} +1 -1
  53. package/dist/assets/{companion-watch-frame-page-BXLCktNV.js → companion-watch-frame-page-3M8uEp9f.js} +1 -1
  54. package/dist/assets/{connect-page-DqXNWB3e.js → connect-page-B3uUGMgH.js} +1 -1
  55. package/dist/assets/{consent-controls-VUQpPjpF.js → consent-controls-C5hiZrsf.js} +1 -1
  56. package/dist/assets/{contacts-gateway-M0SEA0Ls.js → contacts-gateway-FWhhciZa.js} +1 -1
  57. package/dist/assets/{contacts-page-route-ciiisSbk.js → contacts-page-route-GziPFmXf.js} +1 -1
  58. package/dist/assets/{copy-button-06ZBxF-g.js → copy-button-SNK3X3Q6.js} +1 -1
  59. package/dist/assets/{credential-entry-page-CZTFQmW3.js → credential-entry-page-SwWWNGX8.js} +1 -1
  60. package/dist/assets/{credentials-page-bcb6LbyX.js → credentials-page-DRfwESO-.js} +1 -1
  61. package/dist/assets/{csv-preview-B8vxTOAh.js → csv-preview-U7XwAhlX.js} +1 -1
  62. package/dist/assets/{danger-zone-redirect-page-C-53yyHV.js → danger-zone-redirect-page-BV0lGnl_.js} +1 -1
  63. package/dist/assets/{debug-page-2DthUX8Q.js → debug-page-DwtjfO0H.js} +1 -1
  64. package/dist/assets/deploy-dialogs-7b-AY3wa.js +1 -0
  65. package/dist/assets/{deploy-dialogs-CaZCOLcW.js → deploy-dialogs-DDe4zOdX.js} +1 -1
  66. package/dist/assets/{desktop-preview-content-Bx5_gQqm.js → desktop-preview-content-_pIEbVde.js} +2 -2
  67. package/dist/assets/{desktop-status-L9sA78zU.js → desktop-status-DmWWnzqE.js} +1 -1
  68. package/dist/assets/{desktop-viewer-Gsp9ciNF.js → desktop-viewer-B9Vcq1Ei.js} +1 -1
  69. package/dist/assets/{detail-card-DXYh92lS.js → detail-card-DF9nj6Gj.js} +1 -1
  70. package/dist/assets/{detail-panel-stop-button-JQH92FSa.js → detail-panel-stop-button-D3b4nxcG.js} +1 -1
  71. package/dist/assets/{detail-primitives-PCZSBjkS.js → detail-primitives-LOD0kRZ4.js} +1 -1
  72. package/dist/assets/{developer-page-f8SdDLWI.js → developer-page-BQ5bGk-4.js} +1 -1
  73. package/dist/assets/{devices-redirect-page-rOcV02dL.js → devices-redirect-page-Bn2y0m1x.js} +1 -1
  74. package/dist/assets/{dictation-overlay-page-BPYJcuF5.js → dictation-overlay-page-DPR2rDDh.js} +1 -1
  75. package/dist/assets/document-load-BTXflX5D.js +1 -0
  76. package/dist/assets/{document-load-Cx6SmMsX.js → document-load-BziXWGTc.js} +1 -1
  77. package/dist/assets/{document-viewer-page-buw3L7Qh.js → document-viewer-page-B-2c3m5R.js} +1 -1
  78. package/dist/assets/{emails-page-CRcIGJMH.js → emails-page-CgiQD0Sv.js} +1 -1
  79. package/dist/assets/{file-diff-view-BPGy665x.js → file-diff-view-8ciHw9A7.js} +1 -1
  80. package/dist/assets/{file-view-mode-BjICMrIT.js → file-view-mode-BjjBnpYU.js} +1 -1
  81. package/dist/assets/{general-page-CtS_CU7C.js → general-page-DIQRLvou.js} +1 -1
  82. package/dist/assets/{hatching-screen-SRp857Tl.js → hatching-screen-Dbp76r0P.js} +1 -1
  83. package/dist/assets/{hosting-screen-BBK1bOi2.js → hosting-screen-fTZt7kCM.js} +1 -1
  84. package/dist/assets/{identity-page-route-BjuOZBNC.js → identity-page-route-CHM3oI-k.js} +1 -1
  85. package/dist/assets/{inspect-page-yQXS977E.js → inspect-page-BHs6vilE.js} +3 -3
  86. package/dist/assets/{integrations-page-8saNghxG.js → integrations-page-CeK7nrkI.js} +1 -1
  87. package/dist/assets/{intelligence-layout-C4fUSmw1.js → intelligence-layout-UKSuU3yD.js} +1 -1
  88. package/dist/assets/{intelligence-layout-slots-store-CdCFMdty.js → intelligence-layout-slots-store-yq8xZ_lC.js} +1 -1
  89. package/dist/assets/{keyboard-shortcuts-redirect-page-6vmXYM08.js → keyboard-shortcuts-redirect-page-BfgCJJ8W.js} +1 -1
  90. package/dist/assets/{latest-assistant-text-Dp8nFLYg.js → latest-assistant-text-BbUF-ZjG.js} +1 -1
  91. package/dist/assets/{library-detail-page-BHsng9gW.js → library-detail-page-DCVP6Thc.js} +1 -1
  92. package/dist/assets/{library-page-EGcuUr9r.js → library-page-DemxnENP.js} +1 -1
  93. package/dist/assets/{login-page-CjFFBEfP.js → login-page-DJCWMJPS.js} +1 -1
  94. package/dist/assets/{logout-page-CTk1D8H1.js → logout-page-rrrf5aYw.js} +1 -1
  95. package/dist/assets/{logs-layout-DcUsHX4i.js → logs-layout-CU-5OL3A.js} +1 -1
  96. package/dist/assets/{markdown-preview-BVK8h-Vm.js → markdown-preview-h2xJTbi7.js} +1 -1
  97. package/dist/assets/{media-preview-DMvBX4tR.js → media-preview-6Dw68M9L.js} +1 -1
  98. package/dist/assets/{memory-page-route-DmcTly3j.js → memory-page-route-BZYeOOeW.js} +1 -1
  99. package/dist/assets/{memory-router-playground-page-BKIKjicw.js → memory-router-playground-page-CsN1IIJA.js} +1 -1
  100. package/dist/assets/{message-files-panel-ffUSMnCt.js → message-files-panel-CNC5v1w7.js} +1 -1
  101. package/dist/assets/mutation-error-CAyH2x36.js +1 -0
  102. package/dist/assets/native-attachment-pickers-BjVoKEUQ.js +1 -0
  103. package/dist/assets/native-file-CYAEPXYN.js +1 -0
  104. package/dist/assets/{notifications-page-uL-24dgJ.js → notifications-page-B3Em-VQu.js} +1 -1
  105. package/dist/assets/{oauth-complete-page-CeSrrc5l.js → oauth-complete-page-BJObwKje.js} +1 -1
  106. package/dist/assets/{oauth-popup-complete-page-B2YWDBhK.js → oauth-popup-complete-page-dpJtFUH5.js} +1 -1
  107. package/dist/assets/paired-cloud-identity-D6ABqHK-.js +1 -0
  108. package/dist/assets/{pairing-page-BKpPzHgF.js → pairing-page-dZeno0_m.js} +1 -1
  109. package/dist/assets/password-reset-page-IPvSLWAz.js +1 -0
  110. package/dist/assets/{pdf-file-preview-yZHctfTY.js → pdf-file-preview-C68i9dU6.js} +1 -1
  111. package/dist/assets/{permission-guide-page-BiIbMRw2.js → permission-guide-page-BTU82Ybk.js} +1 -1
  112. package/dist/assets/{permission-setup-C3D0R4tU.js → permission-setup-DohBLdCl.js} +1 -1
  113. package/dist/assets/{personality-page-C9zAoDC4.js → personality-page-BIMzWgMh.js} +1 -1
  114. package/dist/assets/{personality-page-B0t7PCzh.js → personality-page-_k2z41Bt.js} +1 -1
  115. package/dist/assets/{personality-sliders-Cz11kvVy.js → personality-sliders-DGNY8Rnd.js} +1 -1
  116. package/dist/assets/{plans-page-Cyy_VAfs.js → plans-page-pq5hy60L.js} +1 -1
  117. package/dist/assets/{plugin-detail-page-MHjzhIjU.js → plugin-detail-page-BbA4_EQi.js} +1 -1
  118. package/dist/assets/{plugins-page-CGd4eA0h.js → plugins-page-DxdhU21Z.js} +1 -1
  119. package/dist/assets/plugins-surface-DQ6HNFGt.js +1 -0
  120. package/dist/assets/{preview-error-B_SkKxgl.js → preview-error-DhG_s3C0.js} +1 -1
  121. package/dist/assets/{privacy-page-BH7VrzNO.js → privacy-page-BqiHHg7j.js} +1 -1
  122. package/dist/assets/{privacy-screen-DRUImDBf.js → privacy-screen-Dq4eUoIO.js} +1 -1
  123. package/dist/assets/{profile-card-eeDPrAqN.js → profile-card-CkTa3Y8i.js} +1 -1
  124. package/dist/assets/{provider-callback-page-C25nZdj2.js → provider-callback-page-Bmu6iHxa.js} +1 -1
  125. package/dist/assets/{provider-key-DCXewaJg.js → provider-key-DBdqn0Gt.js} +1 -1
  126. package/dist/assets/{provider-signup-page-BFYxSU4D.js → provider-signup-page-JIh0XKV5.js} +1 -1
  127. package/dist/assets/{quick-input-page-BWyYCc6N.js → quick-input-page-ALtrRR05.js} +1 -1
  128. package/dist/assets/{research-mock-page-DT6p-Af5.js → research-mock-page-C8n5xPsy.js} +1 -1
  129. package/dist/assets/{research-onboarding-route-B3KTgEuk.js → research-onboarding-route-BgMvaYdY.js} +1 -1
  130. package/dist/assets/{review-terms-screen-CBbhXbba.js → review-terms-screen-CnIUYPfa.js} +1 -1
  131. package/dist/assets/routes-Ct3akvBN.js +1 -0
  132. package/dist/assets/{schedules-BklxG5oV.js → schedules-D8f5wsZc.js} +1 -1
  133. package/dist/assets/{schedules-page-D_2A6U2f.js → schedules-page-B8PnXfuh.js} +1 -1
  134. package/dist/assets/{security-redirect-page-424yJDDE.js → security-redirect-page-L5VVUkhf.js} +1 -1
  135. package/dist/assets/{select-assistant-screen-B2waFR5c.js → select-assistant-screen-Bm0waz2L.js} +1 -1
  136. package/dist/assets/{self-hosted-servers-Du7ejILs.js → self-hosted-servers-BxHLMpeP.js} +1 -1
  137. package/dist/assets/{service-form-controls-BzzepR1w.js → service-form-controls-BcaLg3mN.js} +1 -1
  138. package/dist/assets/{setting-row-Har-4ZuZ.js → setting-row-3-QGMKbV.js} +1 -1
  139. package/dist/assets/{settings-divider-fXUzEDBM.js → settings-divider-D1gYuSPt.js} +1 -1
  140. package/dist/assets/{settings-layout-Bh6Tfq82.js → settings-layout-Cuol1Jld.js} +1 -1
  141. package/dist/assets/share-feedback-modal-CdzyF0gl.js +1 -0
  142. package/dist/assets/{share-feedback-modal-q27kCbAf.js → share-feedback-modal-O62ToKHM.js} +1 -1
  143. package/dist/assets/{sidebar-tree-DpyD-Fdr.js → sidebar-tree-D1pphm3H.js} +1 -1
  144. package/dist/assets/{signup-page-B2QNQ-OW.js → signup-page-6gPB7H4i.js} +1 -1
  145. package/dist/assets/{signup-shell-BJfIr9N8.js → signup-shell-I1tsWrB2.js} +1 -1
  146. package/dist/assets/{skill-detail-page-DWc5Pj07.js → skill-detail-page-CaaPoNXG.js} +1 -1
  147. package/dist/assets/{skill-detail-panel-DOpFqxJk.js → skill-detail-panel-CVrIAGi1.js} +1 -1
  148. package/dist/assets/{skill-removal-dialog-B-Hb8zf4.js → skill-removal-dialog-DVzlADbq.js} +1 -1
  149. package/dist/assets/{skills-page-COVvjwYi.js → skills-page-BjmHcl-i.js} +1 -1
  150. package/dist/assets/{sounds-page-DB5YcVc4.js → sounds-page-DM_LZFsH.js} +1 -1
  151. package/dist/assets/{start-screen-FL2Ia1Ar.js → start-screen-Dh8Xc1ux.js} +1 -1
  152. package/dist/assets/{step-detail-header-CuTbSKtU.js → step-detail-header-C1U-HS14.js} +1 -1
  153. package/dist/assets/{stt-language-picker-modal-BjXK4fmX.js → stt-language-picker-modal-BWPQXHbg.js} +1 -1
  154. package/dist/assets/{subagent-detail-panel-DLgSr_E8.js → subagent-detail-panel-BEHD2vOf.js} +1 -1
  155. package/dist/assets/{superpowers-page-CscgKzE0.js → superpowers-page-Civ1dred.js} +1 -1
  156. package/dist/assets/{system-events-page-CNdWB8DB.js → system-events-page-DQQD-yh4.js} +1 -1
  157. package/dist/assets/{system-events-redirect-page-CRcNF9hG.js → system-events-redirect-page-CMQWTWeS.js} +1 -1
  158. package/dist/assets/{tabular-grid-CejyLbWr.js → tabular-grid-Crdhci1a.js} +1 -1
  159. package/dist/assets/{teleport-gateway-client-CnEsY6jD.js → teleport-gateway-client-zRxDIHvy.js} +1 -1
  160. package/dist/assets/{text-preview-CNTf9DBr.js → text-preview-CCRT6NMb.js} +1 -1
  161. package/dist/assets/{theme-stage-page-CYKLJ4g7.js → theme-stage-page-BKDKhybd.js} +1 -1
  162. package/dist/assets/{tiptap-document-editor-B7WZaMjw.js → tiptap-document-editor-DMBoEpva.js} +1 -1
  163. package/dist/assets/{tool-detail-panel-DlHI8dvX.js → tool-detail-panel-BR7h2ROn.js} +1 -1
  164. package/dist/assets/tool-detail-panel-DCdX_SBO.js +1 -0
  165. package/dist/assets/{trait-cycle-row-BctewJVE.js → trait-cycle-row-Lgkm9R8c.js} +1 -1
  166. package/dist/assets/{upgrade-cancel-page-jDoqH3zX.js → upgrade-cancel-page-DEIK5f2e.js} +1 -1
  167. package/dist/assets/{upgrade-success-page-CaUf2wkq.js → upgrade-success-page-Dt9lxhGP.js} +1 -1
  168. package/dist/assets/{usage-redirect-page-BAgziC1P.js → usage-redirect-page-BMvSf6Bj.js} +1 -1
  169. package/dist/assets/{use-app-delete-DeDK3zNm.js → use-app-delete-NTNPyRFw.js} +1 -1
  170. package/dist/assets/{use-assistant-identity-details-Ku8Yexur.js → use-assistant-identity-details-20XTojNX.js} +1 -1
  171. package/dist/assets/{use-channel-trust-floors-Dw7093F3.js → use-channel-trust-floors-sx-Gm1Em.js} +1 -1
  172. package/dist/assets/{use-checkout-dismiss-refresh-D-DceYdb.js → use-checkout-dismiss-refresh-C7kMkxS1.js} +1 -1
  173. package/dist/assets/{use-edge-swipe-back-C9BhPjNd.js → use-edge-swipe-back-D92U2q-N.js} +1 -1
  174. package/dist/assets/{use-hotkey-recorder-CaKGUrs_.js → use-hotkey-recorder-BRdHU8pS.js} +1 -1
  175. package/dist/assets/{use-invite-link-dialog-DwZSXJdy.js → use-invite-link-dialog-CbFJAi4C.js} +1 -1
  176. package/dist/assets/{use-plugins-list-PsghpbJo.js → use-plugins-list-BQG0kv-t.js} +1 -1
  177. package/dist/assets/{use-return-to-short-circuit-oXJVLQ5r.js → use-return-to-short-circuit-Dqo3POFE.js} +1 -1
  178. package/dist/assets/{use-side-list-room-BPMo-0-m.js → use-side-list-room-BL6BAMEB.js} +1 -1
  179. package/dist/assets/{use-skill-actions-DdykFGoL.js → use-skill-actions-Ch-wHH29.js} +1 -1
  180. package/dist/assets/{use-skill-detail-files-Cx9IY9kI.js → use-skill-detail-files-Chj_ePZG.js} +1 -1
  181. package/dist/assets/use-supports-credentials-settings-Dv49IKbZ.js +1 -0
  182. package/dist/assets/{voice-page-DUXZHnnu.js → voice-page-CcybrzXj.js} +1 -1
  183. package/dist/assets/{wake-detail-panel-qrpIcnpA.js → wake-detail-panel-BNA47SoV.js} +1 -1
  184. package/dist/assets/{weather-forecast-display-Bjrjg54J.js → weather-forecast-display-BGKTfbzy.js} +1 -1
  185. package/dist/assets/{welcome-screen-C-7GbST1.js → welcome-screen-nz_FAiGA.js} +1 -1
  186. package/dist/assets/{workflow-detail-panel-BAeI7O0P.js → workflow-detail-panel-DRoeaq6c.js} +1 -1
  187. package/dist/assets/{workspace-page-WKaE0JcI.js → workspace-page-ClGrsRBZ.js} +1 -1
  188. package/dist/assets/{xlsx-preview-HzWjwDAj.js → xlsx-preview-z2rPKBuW.js} +1 -1
  189. package/dist/index.html +1 -1
  190. package/package.json +1 -1
  191. package/dist/assets/add-credits-modal-DD_BJhmr.js +0 -1
  192. package/dist/assets/auth-store-BVApYFfc.js +0 -1
  193. package/dist/assets/avatar-bundled-components-Drkl7JyC.js +0 -1
  194. package/dist/assets/camera-capture-overlay-BF2ncbf2.js +0 -1
  195. package/dist/assets/checkout-return-target-CSJF-o8i.js +0 -1
  196. package/dist/assets/command-palette-2v-4uw_p.js +0 -1
  197. package/dist/assets/deploy-dialogs-BXmWQL7g.js +0 -1
  198. package/dist/assets/document-load-dMbILFST.js +0 -1
  199. package/dist/assets/mutation-error-oXzAul2s.js +0 -1
  200. package/dist/assets/native-attachment-pickers-D94Qe9-T.js +0 -1
  201. package/dist/assets/native-file-BAJbUfaG.js +0 -1
  202. package/dist/assets/paired-cloud-identity-B45tIpgK.js +0 -1
  203. package/dist/assets/password-reset-page-B9xxvNOh.js +0 -1
  204. package/dist/assets/plugins-surface-CxIHR2Dv.js +0 -1
  205. package/dist/assets/routes-D5cM5I_f.js +0 -1
  206. package/dist/assets/share-feedback-modal-B12QCt5f.js +0 -1
  207. package/dist/assets/tool-detail-panel-uk4Ie38C.js +0 -1
  208. package/dist/assets/use-supports-credentials-settings-CaBKQ60M.js +0 -1
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$S as t,$i as n,$u as r,Ad as i,BS as a,By as o,CC as s,Di as c,Fc as l,Fd as u,Gx as d,IS as f,Id as p,Iu as m,JS as h,Lu as g,Md as _,Nd as v,Oi as y,Pd as b,RS as x,Vn as S,Xd as C,YS as w,Yd as ee,Zo as T,fC as E,ib as te,id as D,jd as O,ju as k,kd as A,ki as ne,nb as re,nu as j,s_ as M,th as ie,u_ as ae,zS as N,zd as oe,zy as se}from"./app-CGffgaON.js";import{f as ce,t as P,x as F}from"./react-BJ4PZBJN.js";import{Jn as le,Zn as I,er as L,ir as ue,k as R,or as de,w as z}from"./vendor-CezcraPH.js";import{D as fe,Ji as pe,Ra as me,Ui as he,Vn as ge,Ya as B,fr as _e,pi as ve,xr as ye,zi as be}from"./icons-Dwi7aA1Y.js";import{c as xe,i as V,l as H,n as U,r as Se,t as Ce}from"./machine-sizes-DZLd-6DF.js";import{a as we,i as Te,n as Ee,r as De,t as Oe}from"./provisioning-targets-DKc5ORwj.js";var W=B(`computer`,[[`rect`,{width:`14`,height:`8`,x:`5`,y:`2`,rx:`2`,key:`wc9tft`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h2`,key:`rwmk9e`}],[`path`,{d:`M12 18h6`,key:`aqd8w3`}]]),G=e(F(),1),K=P();function ke({icon:e}){return(0,K.jsx)(`span`,{className:`flex h-11 w-11 items-center justify-center rounded-full`,style:{backgroundColor:`color-mix(in oklab, var(--system-negative-strong) 12%, transparent)`},children:(0,K.jsx)(e,{className:`h-5 w-5`,style:{color:`var(--system-negative-strong)`},"aria-hidden":`true`})})}var Ae={fontFamily:`var(--font-serif)`,fontSize:`32px`,fontWeight:400,lineHeight:1.2,letterSpacing:`0.64px`};function je({title:e,subtitle:t}){return(0,K.jsxs)(`header`,{className:`flex flex-col items-center gap-2 pt-12 text-center`,children:[(0,K.jsx)(`h2`,{className:`text-[var(--content-emphasised)]`,style:Ae,children:e}),t&&(0,K.jsx)(`p`,{className:`text-[14px] font-normal text-[var(--content-secondary)]`,children:t})]})}var q=[{bodyShape:`star`,eyeStyle:`curious`,color:`yellow`,size:103,position:`-left-[28px] -top-[33px]`,rotate:180},{bodyShape:`star`,eyeStyle:`curious`,color:`orange`,size:109,position:`left-[63%] -top-[62px] -translate-x-1/2`,rotate:-8},{bodyShape:`blob`,eyeStyle:`grumpy`,color:`green`,size:76,position:`-right-[25px] top-[60px]`,rotate:1},{bodyShape:`stack`,eyeStyle:`gentle`,color:`purple`,size:110,position:`-left-[39px] top-[74%]`,rotate:0},{bodyShape:`urchin`,eyeStyle:`goofy`,color:`pink`,size:137,position:`-right-[42px] -bottom-[40px]`,rotate:180},{bodyShape:`sprout`,eyeStyle:`curious`,color:`orange`,size:72,position:`left-[37%] -bottom-[22px] -translate-x-1/2`,rotate:0}],Me=[{bodyShape:`star`,eyeStyle:`curious`,color:`yellow`,size:103,position:`-left-[28px] -top-[33px]`,rotate:180},{bodyShape:`star`,eyeStyle:`curious`,color:`orange`,size:109,position:`left-[63%] -top-[62px] -translate-x-1/2`,rotate:-8},{bodyShape:`blob`,eyeStyle:`grumpy`,color:`green`,size:76,position:`-right-[25px] top-[60px]`,rotate:1}];function Ne({variant:e=`full`}){let t=c();return t?(0,K.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`creature-corners`,className:`pointer-events-none absolute inset-0 select-none`,children:(e===`top`?Me:q).map((e,n)=>(0,K.jsx)(`span`,{className:`absolute ${e.position}`,style:{rotate:`${e.rotate}deg`},children:(0,K.jsx)(S,{components:t,bodyShapeId:e.bodyShape,eyeStyleId:e.eyeStyle,colorId:e.color,size:e.size})},n))}):null}var Pe={waitingStatus:`Upgrading your assistant…`,snagStatus:`We hit a snag upgrading your assistant`,snagCaption:`Retry in the background and we'll keep working on your upgrade.`,confirmingStatus:`Confirming your upgrade…`,confirmTimeoutStatus:`Still confirming your upgrade`,confirmTimeoutCaption:`Your payment went through safely. This can take a minute.`,backgroundConfirmMessage:`Your assistant is still upgrading. Chatting won't be available until it finishes. You can keep waiting here, or continue and we'll let you know when it's ready.`,backgroundExitToast:`Your upgrade continues in the background.`,backgroundRetryToast:`We'll retry your upgrade in the background.`,completeSubtitle:`Enjoy the new found power.`,fetchErrorBody:`We hit a problem checking your subscription. Your upgrade may still be processing. Return to billing to refresh.`},Fe={waitingStatus:`Updating your assistant…`,snagStatus:`We hit a snag updating your assistant`,snagCaption:`Retry in the background and we'll keep working on your plan change.`,confirmingStatus:`Confirming your plan change…`,confirmTimeoutStatus:`Still confirming your plan change`,confirmTimeoutCaption:`Your plan change was submitted. This can take a minute.`,backgroundConfirmMessage:`Your assistant is still updating. Chatting won't be available until it finishes. You can keep waiting here, or continue and we'll let you know when it's ready.`,backgroundExitToast:`Your plan change continues in the background.`,backgroundRetryToast:`We'll retry your plan change in the background.`,completeSubtitle:`Your plan changes are live.`,fetchErrorBody:`We hit a problem checking your subscription. Your plan change may still be processing. Return to billing to refresh.`},Ie={upgrade:Pe,downgrade:Fe,change:Fe};function Le(e=`upgrade`){return Ie[e]}function Re(e,t=!0){let{data:n}=I({...k(),enabled:t&&e==null}),{data:r}=I({...D({path:{id:e??``}}),enabled:t&&e!=null});return e==null?n:r}function ze({assistantId:e,direction:t}){let n=ce(),{t:r}=z(`settings`),i=Re(e,ie())?.name||r(`completeState.assistantFallbackName`);return(0,K.jsxs)(`div`,{className:`relative flex min-h-[320px] flex-col items-center justify-center overflow-hidden px-8 pb-16 [animation:onboarding-step-in_350ms_ease-out] motion-reduce:[animation:none]`,children:[(0,K.jsx)(Ne,{variant:`full`}),(0,K.jsxs)(`div`,{className:`relative flex w-full flex-col items-center`,children:[(0,K.jsx)(je,{title:r(`completeState.title`),subtitle:Le(t).completeSubtitle}),(0,K.jsx)(`div`,{className:`mt-10 flex w-full flex-col items-center gap-10`,children:(0,K.jsx)(s,{variant:`primary`,"data-testid":`onboarding-complete-return`,onClick:()=>{e!=null&&M(e),n(d.assistant,{replace:!0})},children:r(`completeState.returnTo`,{assistantName:i})})})]})]})}function Be({onGoToBilling:e,direction:t}){let{t:n}=z(`settings`);return(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-6 py-10 text-center`,children:[(0,K.jsx)(ke,{icon:he}),(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(E,{variant:`title-small`,as:`h1`,children:n(`errorStates.fetchErrorTitle`)}),(0,K.jsx)(E,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:Le(t).fetchErrorBody})]}),(0,K.jsx)(s,{variant:`primary`,"data-testid":`onboarding-go-to-billing`,onClick:e,children:n(`errorStates.goToBilling`)})]})}function J(e){let{targets:t,fromSnapshot:n,machineFloor:r,credits:i}=e,a=[];return t.machineSize==null?r!=null&&n.machineSize!=null&&n.machineSize!==r&&a.push({key:`machine`,label:`Machine`,from:V[n.machineSize],to:V[r]}):n.machineSize!==t.machineSize&&a.push({key:`machine`,label:`Machine`,from:n.machineSize==null?void 0:V[n.machineSize],to:V[t.machineSize]}),t.storageGib!=null&&(n.storageGib==null||t.storageGib>n.storageGib)&&a.push({key:`storage`,label:`Storage`,from:n.storageGib==null?void 0:`${n.storageGib} GB`,to:`${t.storageGib} GB`}),i!=null&&a.push({key:`credits`,label:i.label??`Credits`,from:i.from,to:i.to}),a}var Y=220;function Ve({items:e,visible:t=!0,toWord:n,className:r=``,testId:i=`upgrade-metrics`}){let[a,o]=(0,G.useState)(!1);(0,G.useEffect)(()=>{let e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)},[]);let s=t&&a;return(0,K.jsx)(`div`,{"aria-hidden":!t,"data-testid":i,"data-visible":t?`true`:`false`,className:`flex flex-col items-center gap-3 md:flex-row md:items-stretch md:gap-0 ${r}`,children:e.map((e,t)=>(0,K.jsxs)(`div`,{"data-testid":e.key?`chip-${e.key}`:void 0,className:`flex flex-col items-center gap-1 px-6 transition-[opacity,transform] duration-500 ease-out motion-reduce:transition-none ${s?`translate-y-0 opacity-100`:`translate-y-2 opacity-0`} ${t>0?`md:border-l md:border-[var(--border-subtle)]`:``}`,style:{transitionDelay:s?`${t*Y}ms`:`0ms`},children:[(0,K.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-[0.08em] text-[var(--content-tertiary)]`,children:e.label}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 whitespace-nowrap text-[var(--content-emphasised)]`,style:{fontFamily:`var(--font-serif)`,fontSize:`20px`,lineHeight:1.2},children:[e.from!=null&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:e.from}),n&&(0,K.jsx)(`span`,{className:`sr-only`,children:n}),(0,K.jsx)(me,{className:`size-3.5 text-[var(--content-tertiary)]`,"aria-hidden":`true`})]}),(0,K.jsx)(`span`,{children:e.to}),e.landed&&(0,K.jsx)(pe,{"data-testid":`chip-check`,className:`size-3.5 text-[var(--system-positive-strong)]`,"aria-hidden":`true`}),e.status&&(0,K.jsx)(`span`,{className:`sr-only`,children:e.status})]})]},e.key??e.label))})}var He=48;function Ue(e,t,n,r,i){let a=i*i,o=a*i;return .5*(2*t+(-e+n)*i+(2*e-5*t+4*n-r)*a+(-e+3*t-3*n+r)*o)}function X(e,t,n){let r=e.map(e=>({x:e.fx*t,y:e.fy*n,size:e.fs*n})),i=[],a=[],o=[],s=[],c=[],l=[],u=0;for(let e=0;e<r.length-1;e++){let t=r[Math.max(0,e-1)],n=r[e],c=r[e+1],l=r[Math.min(r.length-1,e+2)],d=e===r.length-2?He+1:He;for(let e=0;e<d;e++){let r=e/He,d=Ue(t.x,n.x,c.x,l.x,r),f=Ue(t.y,n.y,c.y,l.y,r);i.length>0&&(u+=Math.hypot(d-i[i.length-1],f-a[a.length-1])),i.push(d),a.push(f),o.push(n.size+(c.size-n.size)*r),s.push(u)}}for(let e=0;e<i.length;e++){let t=Math.max(0,e-1),n=Math.min(i.length-1,e+1),r=i[n]-i[t],o=a[n]-a[t],s=Math.hypot(r,o)||1;c.push(r/s),l.push(o/s)}return{length:u,at:e=>{let t=Math.min(u,Math.max(0,e)),n=0,r=s.length-1;for(;n<r;){let e=n+r>>1;s[e]<t?n=e+1:r=e}let d=Math.max(1,n),f=d-1,p=s[d]-s[f]||1,m=(t-s[f])/p,h=c[f]+(c[d]-c[f])*m,g=l[f]+(l[d]-l[f])*m,_=Math.hypot(h,g)||1;return{x:i[f]+(i[d]-i[f])*m,y:a[f]+(a[d]-a[f])*m,tx:h/_,ty:g/_,size:o[f]+(o[d]-o[f])*m}}}}function Z(e,t){if(t<=0)return 0;let n=e%t;return n<0?n+t:n}function Q(e,t){let n=[],r=0;for(;r<e.length;)n.push(r),r+=Math.max(1,e.at(r).size*t);return n}var We={around:[{fx:.2,fy:-.16,fs:.02},{fx:.23,fy:0,fs:.024},{fx:.34,fy:.12,fs:.03},{fx:.52,fy:.19,fs:.037},{fx:.7,fy:.26,fs:.046},{fx:.85,fy:.4,fs:.058},{fx:.88,fy:.56,fs:.074},{fx:.76,fy:.71,fs:.095},{fx:.56,fy:.82,fs:.12},{fx:.4,fy:.93,fs:.15},{fx:.3,fy:1.08,fs:.185},{fx:.24,fy:1.28,fs:.22}],below:[{fx:1.16,fy:0,fs:.03},{fx:.95,fy:.06,fs:.036},{fx:.68,fy:.16,fs:.048},{fx:.4,fy:.3,fs:.065},{fx:.22,fy:.47,fs:.09},{fx:.32,fy:.64,fs:.125},{fx:.56,fy:.8,fs:.17},{fx:.58,fy:.98,fs:.22},{fx:.46,fy:1.22,fs:.27},{fx:.36,fy:1.5,fs:.3}]},Ge={around:.24,below:.32},Ke=.95,qe=.95,Je=1,Ye=8,Xe=20260922,Ze=50;function Qe({className:e=``,layout:t=`around`,flow:n=`down`,speed:r=1,lanes:i=3,paused:a=!1}){let o=c(),s=(0,G.useRef)(null),l=(0,G.useRef)({flow:n,speed:r,paused:a});return(0,G.useEffect)(()=>{l.current={flow:n,speed:r,paused:a}},[n,r,a]),(0,G.useEffect)(()=>{let e=s.current;if(!e||!o)return;let n=e.getContext(`2d`);if(!n)return;let r=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,a=0,c=0,u=null,d=1/0,f=[],p=0,m=new Map,h=(e,t)=>{let n=Math.max(1,Math.round(t/Ye))*Ye,r=`${e.bodyIdx}-${e.eyeIdx}-${e.colorIdx}-${n}`,i=m.get(r);if(i!==void 0)return i;let a=y(o,e.bodyIdx,e.eyeIdx,e.colorIdx,n);return m.set(r,a),a},g=()=>{let r=e.getBoundingClientRect();if(r.width===0||r.height===0||Math.abs(r.width-a)<1&&Math.abs(r.height-c)<1)return;let s=u,l=f.map(e=>e.distance);a=r.width,c=r.height;let p=Math.min(2,window.devicePixelRatio||1);e.width=Math.round(a*p),e.height=Math.round(c*p),n.setTransform(p,0,0,p,0,0),u=X(We[t],a,c),d=c*Ge[t];let m=ne(Xe),h=e=>(m()*2-1)*e,g=-1;if(f=[],Q(u,Ke).forEach((e,t)=>{let n=t%2==0?0:.5;for(let t=0;t<i;t++){let r=Math.floor(m()*o.colors.length);r===g&&(r=(r+1)%o.colors.length),g=r,f.push({distance:e,lane:t-(i-1)/2+n,jitterAlong:h(.08),jitterAcross:h(.12),sizeScale:.85+m()*.3,rotate:h(10)*Math.PI/180,phase:m()*Math.PI*2,bodyIdx:Math.floor(m()*o.bodyShapes.length),eyeIdx:Math.floor(m()*o.eyeStyles.length),colorIdx:r})}}),s&&s.length>0){let e=u.length/s.length;f.forEach((t,n)=>{let r=l[n];r!==void 0&&(t.distance=Z(r*e,u.length))})}},_=e=>{if(!u)return;let t=p?Math.min(Ze,e-p):0;p=e;let{flow:i,speed:o,paused:s}=l.current,m=r||s?0:(i===`down`?1:-1)*o*Je*(t/1e3);n.clearRect(0,0,a,c);for(let t of f){if(m!==0){let e=u.at(t.distance).size;t.distance=Z(t.distance+m*e,u.length)}let i=u.at(t.distance),a=Math.min(d,i.size*t.sizeScale),o=(t.lane*qe+t.jitterAcross)*i.size,s=t.jitterAlong*i.size,c=i.x+i.ty*o+i.tx*s,l=i.y-i.tx*o+i.ty*s,f=h(t,a);if(!f)continue;let p=r?0:Math.sin(e*.001+t.phase)*1.4,g=r?0:Math.sin(e*8e-4+t.phase*2)*.025;n.save(),n.translate(c,l+p),n.rotate(t.rotate+g),n.drawImage(f,-a/2,-a/2,a,a),n.restore()}};g();let v=new ResizeObserver(()=>{g(),r&&_(performance.now())});v.observe(e);let b=0;if(r)_(performance.now());else{let e=t=>{_(t),b=requestAnimationFrame(e)};b=requestAnimationFrame(e)}return()=>{cancelAnimationFrame(b),v.disconnect()}},[o,i,t]),(0,K.jsx)(`canvas`,{ref:s,"aria-hidden":`true`,"data-testid":`upgrade-stream`,className:`pointer-events-none block h-full w-full ${e}`})}function $(e,t){if(t!=null)return e?.credit_tiers?.find(e=>e.tier===t)}function $e(e){let t=e?.match(/^credits_(\d+)$/)?.[1];return t==null?null:Number(t)}function et(e){let t=ie(),{data:n}=I({...A(),enabled:t&&e});return n?.plans.find(e=>e.id===`pro`)}function tt(e,t){return t==null?0:$(e,t)?.credits_usd??$e(t)}function nt(e,t){return t==null?null:$(e,t)?.label}function rt(e){let t=et(e!=null);if(e==null||t==null)return null;let n,r;if(e.kind===`package`){let i=t.packages.find(t=>t.key===e.packageKey),a=$(t,i?.credit_tier);n=i?.credits_usd??a?.credits_usd,r=i?.usage_label??a?.label??void 0}else{let i=$(t,e.creditTier);n=i?.credits_usd,r=i?.label}return n==null?null:{fromLabel:null,toLabel:r}}function it(e){let t=et(e!=null);return e==null||tt(t,e.fromTier)==null||tt(t,e.toTier)==null?null:{fromLabel:nt(t,e.fromTier),toLabel:nt(t,e.toTier)}}function at(e,t){let[n,r]=(0,G.useState)(e),i=(0,G.useRef)(0);return(0,G.useEffect)(()=>{i.current=performance.now()},[]),(0,G.useEffect)(()=>{if(t<=0||e===n)return;let a=t-(performance.now()-i.current);if(a<=0){i.current=performance.now(),r(e);return}let o=setTimeout(()=>{i.current=performance.now(),r(e)},a);return()=>clearTimeout(o)},[e,n,t]),t<=0?e:n}var ot=1e3,st=1e4,ct=2500,lt=2e3,ut=1e4,dt=[`machine_size`,`subdomain`,`non_field_errors`],ft={subdomain_taken:`That subdomain is already taken. Try another.`,assistant_already_has_domain:`Your assistant already has a custom domain.`,no_assistant_to_attach_domain:`We couldn't find an assistant to attach this domain to.`,exceeds_machine_tier:`That machine size isn't available on your plan.`,provisioning_submission_failed:`We couldn't queue your upgrade just now. Try again in a moment.`,no_active_pro:`We couldn't confirm your Pro plan yet. Try again in a moment.`,no_provisionable_assistants:`We couldn't find an assistant to upgrade yet. Try again in a moment.`},pt={provisioning_submission_failed:`We couldn't queue your plan change just now. Try again in a moment.`,no_provisionable_assistants:`We couldn't find an assistant to update yet. Try again in a moment.`};function mt(e,t,n=`upgrade`){if(e&&typeof e==`object`){let t=e;if(typeof t.error==`string`){let e=(n===`upgrade`?void 0:pt[t.error])??ft[t.error];if(e)return e}for(let e of dt){let n=t[e];if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}if(typeof t.detail==`string`)return t.detail}return t}var ht=`#ffffff`;function gt({status:e,caption:t}){return(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5`,children:[(0,K.jsx)(`h1`,{className:`text-[var(--content-emphasised)]`,style:Ae,children:e}),t&&(0,K.jsx)(E,{variant:`body-medium-lighter`,as:`p`,className:`max-w-sm text-[var(--content-secondary)]`,children:t})]})}function _t(e,t){return e===`credits`?!0:t?.[e]===!0}function vt(e,t){if(e==null)return null;let n=t(`provisioningState.noExtraUsage`),r=e.toLabel===null?n:e.toLabel;return r==null?null:{label:t(`provisioningState.usageLabel`),from:e.fromLabel===null?n:e.fromLabel,to:r}}function yt({intent:e,creditsChange:t,targets:n,fromSnapshot:r,machineFloor:i,landed:a,allDone:o=!1,creditsOnly:s=!1}){let{t:c}=z(`settings`),l=rt(e),u=it(t),d=J({targets:n,fromSnapshot:r,machineFloor:i,credits:vt(l??u,c)}),f=s?d.filter(e=>e.key===`credits`):d,p=f.filter(e=>o||_t(e.key,a)).map(e=>e.label).join(`, `),[m]=(0,G.useState)(p),h=p===m?``:c(`provisioningState.dimensionsComplete`,{dimensions:p});return f.length===0?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ve,{items:f.map(e=>{let t=o||_t(e.key,a);return{key:e.key,label:e.label,from:e.from??null,to:e.to,landed:t,status:c(t?`provisioningState.statusComplete`:`provisioningState.statusPending`)}}),testId:`resource-chips`,toWord:c(`provisioningState.srOnlyTo`)}),(0,K.jsx)(`p`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`chip-announcement`,children:h})]})}function bt({intent:e}){let{t}=z(`settings`),n=rt(e.kind===`custom`?e:null);if(e.kind===`package`){let n=e.packageKey.charAt(0).toUpperCase()+e.packageKey.slice(1);return(0,K.jsx)(Ve,{testId:`resource-chips`,items:[{key:`package`,label:t(`provisioningState.packageLabel`),from:null,to:n}]})}let r=[];return e.machineTier!=null&&r.push({key:`machine`,label:t(`provisioningState.machineLabel`),from:null,to:U[e.machineTier]??e.machineTier}),e.storageTier!=null&&r.push({key:`storage`,label:t(`provisioningState.storageLabel`),from:null,to:e.storageTier.toUpperCase()}),e.creditTier!=null&&n?.toLabel!=null&&r.push({key:`credits`,label:t(`provisioningState.usageLabel`),from:null,to:n.toLabel}),r.length===0?null:(0,K.jsx)(Ve,{testId:`resource-chips`,items:r})}function xt({state:e,direction:t,softWaiting:n,intent:r,creditsChange:i,targets:a,fromSnapshot:o,machineFloor:c,landed:l,celebrating:u,onCelebrationEnd:d,escapeAvailable:f,onEscape:p,onPhaseChange:m,kickError:h,confirm:g,dwellMs:_=ct,phaseMinMs:v=900}){let{t:y}=z(`settings`),b=Le(t),x=(0,G.useRef)(d);(0,G.useEffect)(()=>{x.current=d},[d]);let S=at(e,v),C=S===`DONE`||S===`NOT_APPLICABLE`,w=S===`RESIZING`?`WAITING`:S,ee=(0,G.useRef)(m);(0,G.useEffect)(()=>{ee.current=m},[m]),(0,G.useEffect)(()=>{ee.current?.(S)},[S]);let T=u&&C;(0,G.useEffect)(()=>{if(!T)return;let e=setTimeout(()=>x.current(),_);return()=>clearTimeout(e)},[T,_]);let E=j(),te=S===`STALLED`,D=(0,K.jsx)(`div`,{className:`relative z-10 flex w-full flex-col items-center gap-6 [animation:onboarding-step-in_420ms_ease-out] motion-reduce:[animation:none]`,children:A()},w);if(E)return(0,K.jsxs)(`div`,{"data-testid":`provisioning-takeover`,"data-theme":`light`,className:`relative flex h-full min-h-[420px] w-full flex-col overflow-hidden text-center`,style:{backgroundColor:ht},children:[(0,K.jsx)(`div`,{className:`px-6 pb-8 pt-16`,children:D}),(0,K.jsx)(`div`,{className:`relative min-h-0 flex-1`,children:(0,K.jsx)(Qe,{className:`absolute inset-0`,layout:`below`,paused:te})})]});return(0,K.jsxs)(`div`,{"data-testid":`provisioning-takeover`,"data-theme":`light`,className:`relative flex h-full min-h-[420px] w-full flex-col items-center justify-center overflow-hidden px-6 py-10 text-center`,style:{backgroundColor:ht},children:[(0,K.jsx)(Qe,{className:`absolute inset-0`,layout:`around`,paused:te}),(0,K.jsx)(`div`,{className:`relative z-10 mr-[16%] flex w-full max-w-2xl flex-col items-center`,children:D})]});function O(e=y(`provisioningState.continueInBackground`)){return f?(0,K.jsx)(s,{variant:`ghost`,"data-testid":`provisioning-escape`,onClick:p,children:e}):null}function k({allDone:e=!1,creditsOnly:t=!1}={}){return(0,K.jsx)(yt,{intent:r,creditsChange:i,targets:a,fromSnapshot:o,machineFloor:c,landed:l,allDone:e,creditsOnly:t})}function A(){if(S===`CONFIRMING`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gt,{status:b.confirmingStatus,caption:y(`provisioningState.confirmingCaption`)}),r&&(0,K.jsx)(bt,{intent:r}),O()]});if(S===`WAITING`||S===`RESIZING`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gt,{status:b.waitingStatus,caption:y(n?`provisioningState.waitingCaptionLong`:`provisioningState.waitingCaptionShort`)}),k(),O()]});if(S===`DONE`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gt,{status:y(`provisioningState.allDoneStatus`)}),k({allDone:!0})]});if(S===`NOT_APPLICABLE`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gt,{status:y(`provisioningState.planReadyStatus`)}),k({allDone:!0,creditsOnly:!0})]});if(S===`STALLED`){let e=h!=null;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gt,{status:e?b.snagStatus:y(`provisioningState.takingLongerStatus`),caption:e?mt(h,b.snagCaption,t):y(`provisioningState.stalledCaption`)}),k(),e?O(y(`provisioningState.retryInBackground`)):O()]})}return S===`CONFIRM_TIMEOUT`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gt,{status:b.confirmTimeoutStatus,caption:b.confirmTimeoutCaption}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,K.jsx)(s,{variant:`outlined`,"data-testid":`onboarding-go-to-billing`,onClick:g.onGoToBilling,children:y(`provisioningState.goToBilling`)}),(0,K.jsx)(s,{variant:`primary`,"data-testid":`onboarding-retry`,onClick:g.onRetry,children:y(`provisioningState.tryAgain`)})]})]}):null}}function St(e=!0,t){let n=Re(t,e),r=t??n?.id,{data:i,isError:a,isFetching:o,dataUpdatedAt:s,errorUpdatedAt:c}=I({...m({path:{assistant_id:r??``}}),enabled:e&&!!r});return{assistant:n,assistantId:r,domains:i,domainsError:a,domainsFetching:o,domainsUpdatedAt:s,domainsErrorUpdatedAt:c}}function Ct(e){let{planId:t,targets:n,actuals:r,initialActuals:i,resizeOperationInFlight:a,sawOperation:o,msSinceWatchStart:s,confirmExpired:c,serverVerdict:l=null,statusObservedSinceTargetsMet:u=!0,targetsProveNoop:d=!0}=e;if(t!==`pro`)return{state:c?`CONFIRM_TIMEOUT`:`CONFIRMING`,softWaiting:!1};let f=o||a,p=l===`started`||l===`in_progress`,m=o||d&&u;if(!a){let e=p?m:f||l===`already_done`||i!=null&&!we(n,i);if(we(n,r)){if(e)return{state:`DONE`,softWaiting:!1};if(!p&&(d||l===`not_applicable`))return{state:`NOT_APPLICABLE`,softWaiting:!1}}else{if(l===`already_done`)return{state:`DONE`,softWaiting:!1};if(l===`not_applicable`)return{state:`NOT_APPLICABLE`,softWaiting:!1}}}return s!=null&&s>=9e4?{state:`STALLED`,softWaiting:!1}:f||l===`started`||l===`in_progress`?{state:`RESIZING`,softWaiting:!1}:{state:`WAITING`,softWaiting:s!=null&&s>=3e4}}var wt=2e3,Tt=1e3,Et=[`DONE`,`NOT_APPLICABLE`,`CONFIRM_TIMEOUT`],Dt={assistantId:null,machine:null,storage:null};function Ot({open:e,canLowerResources:t=!1,verdictRecheckMs:n=ut}){let i=L(),a=ie(),[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(0),[d,f]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),[g,y]=(0,G.useState)(null),[x,S]=(0,G.useState)(null),[C,w]=(0,G.useState)(null),[ee,T]=(0,G.useState)(null),[E,te]=(0,G.useState)(Dt),[O,A]=(0,G.useState)(null),[ne,re]=(0,G.useState)(!1),j=(0,G.useRef)(!1),M=(0,G.useRef)(!1),N=(0,G.useRef)(0),[oe,se]=(0,G.useState)(!1),[ce,P]=(0,G.useState)(null),[F,R]=(0,G.useState)(null),[z,fe]=(0,G.useState)(null),[pe,me]=(0,G.useState)(()=>Date.now()),[he,ge]=(0,G.useState)(!0);(0,G.useEffect)(()=>{e||(s(!1),l(0),f(null),h(null),y(null),se(!1),P(null),R(null),fe(null),ge(!0),S(null),w(null),T(null),te(Dt),A(null),re(!1),j.current=!1,M.current=!1,N.current+=1)},[e]),(0,G.useEffect)(()=>{e&&(f(Date.now()),i.invalidateQueries({queryKey:p()}),i.invalidateQueries({queryKey:b()}))},[e,i]);let B=m!=null,_e=I({...u(),refetchInterval:e=>e.state.data?.plan_id===`pro`||o?!1:ot,refetchIntervalInBackground:!1,enabled:e&&a&&!B}),ve=(d!=null&&_e.dataUpdatedAt>=d?_e.data?.plan_id:null)??null;(0,G.useEffect)(()=>{if(!e||B||ve!==`pro`)return;let t=Date.now();h(t),me(t)},[e,B,ve]),(0,G.useEffect)(()=>{if(!e||B)return;let t=setTimeout(()=>s(!0),st);return()=>clearTimeout(t)},[e,B,c]);let ye=(0,G.useCallback)(()=>{s(!1),l(e=>e+1),ae.getState().fetchOrganizations(),i.invalidateQueries({queryKey:p()})},[i]),be=(0,G.useCallback)(()=>{let e=Date.now();y(e),me(e)},[]),{mutate:V}=le(_()),U=(0,G.useCallback)(e=>{let t=N.current;V({},{onSuccess:n=>{t===N.current&&(A(null),Ee(n)?M.current?A({error:n.reason??`no_active_pro`}):(M.current=!0,re(!0),e===`escape`&&be()):(S(n.state),e===`escape`&&be()))},onError:e=>{t===N.current&&A(e)}})},[V,be]);(0,G.useEffect)(()=>{!e||!a||!B||j.current||(j.current=!0,U(`auto`))},[e,a,B,U]),(0,G.useEffect)(()=>{if(!ne)return;let e=N.current,t=setTimeout(()=>{re(!1),e===N.current&&U(`auto`)},lt);return()=>clearTimeout(t)},[ne,U]);let Se=(0,G.useCallback)(()=>U(`escape`),[U]),W=I({...v(),enabled:e&&a&&B}),K=he?wt:!1,ke=I({...k(),enabled:e&&a&&B,refetchInterval:e=>e.state.data?.id==null?K:!1,retry:!1}),Ae=B&&d!=null&&W.dataUpdatedAt>=d,je=Ae&&!W.isPending&&!W.isFetching,q=(Ae?W.data?.primary_assistant_id:null)??(W.isPending?null:ke.data?.id??null),Me=I({...D({path:{id:q??`unresolved`}}),enabled:e&&a&&B&&q!=null,refetchInterval:K,retry:!1}),Ne=r({path:{id:q??`unresolved`}}),Pe=I({...Ne,enabled:e&&a&&B&&q!=null,refetchInterval:K,retry:!1}),Fe=(0,G.useRef)(0),[Ie,Le]=(0,G.useState)(0),Re=de(Ne.queryKey);(0,G.useEffect)(()=>i.getQueryCache().subscribe(t=>{if(!(t.type!==`updated`||t.query.queryHash!==Re)){if(t.action.type===`fetch`)Fe.current+=1;else if(t.action.type===`success`&&!t.action.manual){let n=Fe.current,r=e&&De(t.action.data);ue.schedule(()=>{Le(n),r&&(se(!0),P(q))})}}}),[i,Re,e,q]);let ze=De(Pe.data),Be=ce===q,J=W.data,Y=(0,G.useMemo)(()=>J?{machineSize:xe(J.max_machine_tier),storageGib:J.selected_storage_gib??null}:null,[J]),Ve=J!=null&&J.max_machine_tier==null?Ce:null,He=J?J.domain_setup_available&&J.primary_assistant_id!=null:void 0,Ue=Me.data,X=(0,G.useMemo)(()=>Ue?{machineSize:Ue.machine_size??null,storageGib:Ue.provisioned_storage_gib??null}:null,[Ue]),Z=z===q,Q=(0,G.useMemo)(()=>{let e=Oe(Y,X),t=Y?.machineSize??Ve;if(t==null)return e;let n=X?.machineSize??null;if(n==null)return{...e,machine:!1};let r=(Z?F?.machineSize:null)??n,i=H(t)<H(r);return{...e,machine:i?H(n)<=H(t):H(n)>=H(t)}},[Y,X,F,Z,Ve]),We=we(Y,X),Ge=ee===q;(0,G.useEffect)(()=>{e&&(We?(w(e=>e!=null&&Ge?e:Date.now()),T(q)):(w(null),T(null)))},[e,We,q,Ge]);let Ke=E.assistantId===q;(0,G.useEffect)(()=>{if(!e)return;let t=Fe.current;te(e=>{let n=e.assistantId===q?e:Dt,r=Q.machine?n.machine??t:null,i=Q.storage?n.storage??t:null;return e.assistantId===q&&e.machine===r&&e.storage===i?e:{assistantId:q,machine:r,storage:i}})},[e,Q,q]);let qe=(0,G.useMemo)(()=>{let e=Te(Pe.data),t=e=>e!=null&&Ke&&Ie>e;return{machine:Q.machine&&!e.machine&&t(E.machine),storage:Q.storage&&!e.storage&&t(E.storage)}},[Q,E,Ke,Ie,Pe.data]);(0,G.useEffect)(()=>{!e||!X||F!=null&&Z||(R(X),fe(q))},[e,X,q,F,Z]);let Je=g??m,Ye=Je==null?null:Math.max(0,pe-Je),Xe=!t,{state:Ze,softWaiting:Qe}=Ct({planId:B?`pro`:ve,targets:Y,actuals:X,initialActuals:Z?F:null,resizeOperationInFlight:ze,sawOperation:oe&&Be,msSinceWatchStart:Ye,confirmExpired:o,serverVerdict:x,statusObservedSinceTargetsMet:C!=null&&Ge&&Pe.dataUpdatedAt>C,targetsProveNoop:Xe}),$=Et.includes(Ze),$e=e&&B&&!$;(0,G.useEffect)(()=>{ge($e)},[$e]),(0,G.useEffect)(()=>{if(!e||!B||$)return;let t=setInterval(()=>me(Date.now()),Tt);return()=>clearInterval(t)},[e,B,$]);let et=!Xe&&(x===`started`||x===`in_progress`)&&!(oe&&Be);return(0,G.useEffect)(()=>{if(!e||!B||$||!et)return;let t=setInterval(()=>U(`auto`),n);return()=>clearInterval(t)},[e,B,$,et,n,U]),{state:Ze,softWaiting:Qe,targets:Y,actualsSnapshot:F,machineFloor:Ve,landed:qe,assistantId:q,domainStepAvailable:He,onboardingSettled:je,confirmError:!B&&_e.isError,targetsError:B&&W.isError&&(!J||!Ae),escapeEligible:Ye!=null&&Ye>=6e4,retryConfirm:ye,kickProvisioning:Se,kickError:O}}var kt=200,At=380;function jt(){return typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0}var Mt=e=>e===`WAITING`||e===`RESIZING`||e===`STALLED`,Nt=e=>e===`DONE`||e===`NOT_APPLICABLE`,Pt={machineSize:null,storageGib:null};function Ft({open:e,onClose:t,dwellMs:n,phaseMinMs:r,mode:i=`checkout`,resizeContext:o}){let{t:s}=z(`settings`),c=i===`resize`,l=L(),u=ce(),[f,p]=(0,G.useState)(`provisioning`),[m,h]=(0,G.useState)(`idle`),_=(0,G.useRef)([]),[v,y]=(0,G.useState)(null),[b,S]=(0,G.useState)(null),[C,w]=(0,G.useState)(null),[ee,T]=(0,G.useState)(!1),E=c?o?.direction:void 0,D=Le(E),O=Ot({open:e,canLowerResources:c?o?.canLowerResources===!0:!1});(0,G.useEffect)(()=>{if(e){y(c?null:te()),w(e=>e??Date.now());return}_.current.forEach(clearTimeout),_.current=[],p(`provisioning`),h(`idle`),S(null),w(null),T(!1)},[e,c]),(0,G.useEffect)(()=>()=>{_.current.forEach(clearTimeout)},[]),(0,G.useEffect)(()=>{f===`complete`&&re()},[f]);let k=Mt(O.state),A=Nt(b??O.state),{targets:ne,assistantId:j,domainStepAvailable:M,onboardingSettled:ie}=O,ae=c?o?.fromSnapshot:void 0,oe=O.actualsSnapshot,se={machineSize:ae?.machineSize??oe?.machineSize??null,storageGib:ae?.storageGib??oe?.storageGib??null},P=c&&M===!0,{domains:F,domainsError:le,domainsFetching:I,domainsUpdatedAt:ue,domainsErrorUpdatedAt:R}=St(e&&P,j),de=(F?.results.length??0)>0,fe=(0,G.useRef)(null);(0,G.useEffect)(()=>{if(!e){fe.current=null;return}!P||j==null||fe.current!==j&&(fe.current=j,l.invalidateQueries({queryKey:g({path:{assistant_id:j}})}))},[e,P,j,l]);let pe=!I&&(C!=null&&ue>=C||C!=null&&!!le&&R>=C),[me,he]=(0,G.useState)(!1),ge=ie&&(!P||pe);(0,G.useEffect)(()=>{if(!e){he(!1);return}ge&&he(!0)},[e,ge]);let B=(0,G.useCallback)(()=>{re(),t(),u(d.assistantInbox,{replace:!0})},[u,t]),_e=(0,G.useCallback)(()=>{if(c?M===!0&&!de:M!==!1){B();return}if(jt()){p(`complete`);return}h(`covering`),_.current.push(setTimeout(()=>{p(`complete`),h(`revealing`),_.current.push(setTimeout(()=>h(`idle`),At))},kt))},[M,c,de,B]),ve=(0,G.useCallback)(()=>{T(!0)},[]),ye=(0,G.useCallback)(()=>{O.kickProvisioning(),N.info(O.kickError==null?D.backgroundExitToast:D.backgroundRetryToast),T(!1),t()},[O,t,D]),be=(0,G.useCallback)(()=>{T(!1)},[]),xe=f===`provisioning`&&(O.confirmError||O.targetsError),V=f===`provisioning`&&!xe,H=V&&!A,U=`transition-[background-color] duration-300 ease-out${V?` bg-white p-0`:``}`,Se=V?`[animation:fadeIn_0.45s_ease-out_both]`:m===`revealing`?`[animation:fadeInUp_0.42s_ease-out_0.12s_both]`:`[animation:fadeIn_0.25s_ease-out_both]`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(a.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,K.jsxs)(a.Content,{size:`md`,hideCloseButton:f!==`complete`,dismissOnOverlayClick:!H,onEscapeKeyDown:H?e=>e.preventDefault():void 0,onInteractOutside:H?e=>e.preventDefault():void 0,overlayClassName:U,className:V?`overflow-y-auto inset-0 max-w-none w-screen h-screen max-h-none rounded-none border-0`:`overflow-hidden`,children:[(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col motion-reduce:[animation:none] ${Se}`,children:Ce()},f),m!==`idle`&&(0,K.jsx)(`div`,{"aria-hidden":!0,"data-testid":`takeover-exit-sheet`,className:`pointer-events-none fixed inset-0 z-50 ${m===`covering`?`[animation:fadeIn_200ms_ease-in_both]`:`[animation:fadeIn_380ms_ease-out_both_reverse]`}`,style:{backgroundColor:`#ffffff`}})]})}),(0,K.jsx)(x,{open:ee&&k,title:s(`billingOnboardingModal.backgroundConfirmTitle`),message:D.backgroundConfirmMessage,confirmLabel:s(`billingOnboardingModal.backgroundConfirmContinue`),cancelLabel:s(`billingOnboardingModal.backgroundConfirmKeepWaiting`),onConfirm:ye,onCancel:be})]});function Ce(){return f===`provisioning`?O.confirmError||O.targetsError?(0,K.jsx)(Be,{onGoToBilling:t,direction:E}):(0,K.jsx)(xt,{state:O.state,direction:E,softWaiting:O.softWaiting,intent:v,creditsChange:c?o?.credits:void 0,targets:ne??Pt,fromSnapshot:se,machineFloor:O.machineFloor,landed:O.landed,celebrating:me,onCelebrationEnd:_e,escapeAvailable:k&&O.escapeEligible,onEscape:ve,onPhaseChange:S,kickError:O.kickError,confirm:{onRetry:O.retryConfirm,onGoToBilling:t},dwellMs:n,phaseMinMs:r}):(0,K.jsx)(ze,{assistantId:j,direction:E})}}var It=[`too_expensive`,`missing_features`,`switched_service`,`unused`,`too_complex`,`low_quality`,`customer_service`,`other`],Lt={too_expensive:`cancelReasonSurvey.optionTooExpensive`,missing_features:`cancelReasonSurvey.optionMissingFeatures`,switched_service:`cancelReasonSurvey.optionSwitchedService`,unused:`cancelReasonSurvey.optionUnused`,too_complex:`cancelReasonSurvey.optionTooComplex`,low_quality:`cancelReasonSurvey.optionLowQuality`,customer_service:`cancelReasonSurvey.optionCustomerService`,other:`cancelReasonSurvey.optionOther`},Rt=1e3,zt={feedback:null,comment:``};function Bt(e){return e.feedback!=null}function Vt(e){let t=e.feedback===`other`?e.comment.trim():``;return{feedback:e.feedback,comment:t||null}}function Ht({value:e,onChange:n,disabled:r}){let{t:i}=z(`settings`);return(0,K.jsxs)(`div`,{className:`mt-5 space-y-3`,"data-testid":`cancel-reason-survey`,children:[(0,K.jsx)(E,{as:`p`,variant:`body-medium-default`,children:i(`cancelReasonSurvey.title`)}),(0,K.jsx)(w,{value:e.feedback??``,onValueChange:t=>n({...e,feedback:t===``?null:t}),name:`cancel-reason`,disabled:r,"aria-label":i(`cancelReasonSurvey.title`),children:It.map(e=>(0,K.jsx)(h,{value:e,label:i(Lt[e])},e))}),e.feedback===`other`?(0,K.jsx)(t,{label:i(`cancelReasonSurvey.otherLabel`),placeholder:i(`cancelReasonSurvey.otherPlaceholder`),value:e.comment,onChange:t=>n({...e,comment:t.target.value}),maxLength:Rt,rows:3,disabled:r,fullWidth:!0,"data-testid":`cancel-reason-comment`}):null]})}function Ut(e){return e!=null&&!e.customized}function Wt(e){return Ut(e)?e.name:`Custom`}var Gt=[`mighty`,`super`,`ultra`],Kt=[`free`,...Gt];function qt(e){return Kt.indexOf(e)}function Jt(e,t){if(e===null)return`upgrade`;let n=qt(e),r=qt(t);return n===-1||r===-1?`upgrade`:r===n?`current`:r<n?`downgrade`:`upgrade`}function Yt(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>Gt.indexOf(e.key)-Gt.indexOf(t.key));if(!t)return n[0];let r=n.findIndex(e=>e.key===t);return r===-1?n[0]:r>=n.length-1?null:n[r+1]}var Xt={free:{bodyShape:`ninja`,eyeStyle:`angry`,color:`yellow`},mighty:{bodyShape:`cloud`,eyeStyle:`grumpy`,color:`green`},super:{bodyShape:`urchin`,eyeStyle:`goofy`,color:`teal`},ultra:{bodyShape:`sprout`,eyeStyle:`curious`,color:`orange`}};function Zt({tier:e,size:t=40}){let n=Xt[e]??Xt.free,r=c();return(0,K.jsx)(`div`,{"aria-hidden":!0,className:`inline-flex shrink-0`,children:r?(0,K.jsx)(S,{components:r,bodyShapeId:n.bodyShape,colorId:n.color,size:t}):(0,K.jsx)(`div`,{style:{width:t,height:t}})})}var Qt={free:{tagline:`Get to know your assistant.`,cta:`Start Free`,priceCaption:`Forever`},mighty:{tagline:`More capacity for consistent use.`,cta:`Power Up`,priceCaption:`Billed monthly`,recommended:!0},super:{tagline:`Do more, think less about the how.`,cta:`Go Super`,priceCaption:`Billed monthly`,extraFeatures:[`Assistant email and subdomain`]},ultra:{tagline:`Your second brain, running full speed.`,cta:`Unleash Ultra`,priceCaption:`Billed monthly`,extraFeatures:[`Assistant email and subdomain`]}};function $t(e){return Qt[e]}function en(e){return`Downgrade to ${e}`}function tn(e){let t=e/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function nn(e){return`${tn(e)}/mo`}function rn(e){return`${tn(e)}/month`}function an(e){return`${e>0?`+`:`−`}${tn(Math.abs(e))}/mo`}function on(e){return`${e} GB storage`}function sn(e){return`${tn(e*100)} of bundled credits`}var cn=`Small`;function ln(e){return e?.machine_size?V[e.machine_size]??e.machine_size:cn}function un(e,t){let n=$t(e.key)?.extraFeatures??[];return[{icon:W,label:`${ln(e)} Machine`},{icon:ye,label:`${e.storage_gib} GB Storage`},{icon:ve,label:t},...n.map(e=>({icon:ge,label:e}))]}function dn(){return[{icon:W,label:`${cn} Machine`},{icon:ye,label:`4 GB Storage`},{icon:ve,label:`Pay as you go credits`}]}function fn(e,t=[]){let n=e?.credits_usd??0,r=e?.storage_gib??4,i=Se[e?.machine_size??`small`];return[`${ln(e)} machine${i?` (${i})`:``}`,on(r),e?.usage_label??sn(n),...t]}var pn={machine:`Configurable machine size`,storage:`Configurable storage`,credits:`Pay-as-you-go and bundled credits`};function mn(e,t){let n=[`${e.machineTier?U[e.machineTier]??t.machine_tiers.find(t=>t.tier===e.machineTier)?.label??e.machineTier:cn} Machine`];if(e.storageGib!=null&&n.push(`${e.storageGib} GB`),e.creditTier!=null){let r=$(t,e.creditTier)?.label,i=$e(e.creditTier);n.push(r??(i==null?`Credit bundle`:`${i} credits/mo`))}return n}function hn(e,t){let n=new Set([pn.machine]);return e.storageGib!=null&&n.add(pn.storage),e.creditTier!=null&&n.add(pn.credits),[...mn(e,t),...t.included_features.filter(e=>!n.has(e))]}function gn(e){return e.disabled===!0}function _n({machineTiers:e,storageTiers:t,selectedMachineTier:n,selectedStorageTier:r,onMachineTierChange:i,onStorageTierChange:a,currentMachinePriceCents:o,currentStoragePriceCents:s}){let{t:c}=z(`settings`),l=(0,G.useMemo)(()=>e.map(e=>{let t=U[e.tier]??e.label,n=o==null?c(`tierPicker.priceAddon`,{price:nn(e.price_cents)}):e.price_cents===o?c(`tierPicker.priceCurrent`,{price:nn(e.price_cents)}):an(e.price_cents-o);return{value:e.tier,label:c(`tierPicker.machineOption`,{label:t,priceLabel:n}),disabled:gn(e)}}),[e,o,c]),u=(0,G.useMemo)(()=>t.map(e=>{let t=s==null?c(`tierPicker.priceAddon`,{price:nn(e.price_cents)}):e.price_cents===s?c(`tierPicker.priceCurrent`,{price:nn(e.price_cents)}):an(e.price_cents-s);return{value:e.tier,label:c(`tierPicker.storageOption`,{gib:e.storage_gib,priceLabel:t}),disabled:gn(e)}}),[t,s,c]);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(E,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:c(`tierPicker.machineLabel`)}),(0,K.jsx)(`span`,{title:c(`tierPicker.machineTooltip`),children:(0,K.jsx)(_e,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,K.jsx)(f,{"aria-label":c(`tierPicker.machineAriaLabel`),placeholder:c(`tierPicker.machinePlaceholder`),value:n??``,onChange:i,options:l})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(E,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:c(`tierPicker.storageLabel`)}),(0,K.jsx)(`span`,{title:c(`tierPicker.storageTooltip`),children:(0,K.jsx)(_e,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,K.jsx)(f,{"aria-label":c(`tierPicker.storageAriaLabel`),placeholder:c(`tierPicker.storagePlaceholder`),value:r??``,onChange:a,options:u})]})]})}var vn=new Set([`active`,`trialing`,`past_due`]);function yn(e){return e.plan_id!==`base`&&e.cancel_at_period_end!==!0&&!e.cancel_at&&e.status!=null&&vn.has(e.status)}function bn(e){return e?.status!=null&&vn.has(e.status)}var xn=[`target_plan_id`,`confirm`,`machine_tier`,`storage_tier`,`credit_tier`,`package`,`non_field_errors`];function Sn(e,t){if(e&&typeof e==`object`){for(let t of xn)if(t in e){let n=e[t];if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}if(`detail`in e&&typeof e.detail==`string`)return e.detail}return t}function Cn(e,t){let n=e.filter(e=>!gn(e));return t!==null&&n.some(e=>e.tier===t)?t:n[0]?.tier??null}function wn(e,t,n){return t===void 0?n:t!==null&&(t===n||e.some(e=>e.tier===t))?t:null}function Tn(e){return e.length?Math.min(...e.map(e=>e.price_cents)):0}function En(){let e=L();return async t=>{try{let n=await t.mutateAsync();return await e.invalidateQueries({queryKey:p()}),t.onSuccess(n),n}catch(e){return N.error(Sn(e,t.errorFallback()),{id:t.errorToastId}),null}}}var Dn=`billing-portal-return-snapshot`;function On(e){try{sessionStorage.removeItem(Dn),sessionStorage.setItem(Dn,JSON.stringify(e))}catch{}}function kn(){if(typeof sessionStorage>`u`)return null;try{let e=sessionStorage.getItem(Dn);if(!e)return null;let t=JSON.parse(e);return typeof t.cancel_at_period_end!=`boolean`||typeof t.plan_id!=`string`?null:{cancel_at_period_end:t.cancel_at_period_end,cancel_at:t.cancel_at??null,plan_id:t.plan_id}}catch{return null}}function An(){try{sessionStorage.removeItem(Dn)}catch{}}function jn(e){return e?{cancel_at_period_end:e.cancel_at_period_end,cancel_at:e.cancel_at??null,plan_id:e.plan_id}:null}function Mn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function Nn(e){return e?e.cancel_at??e.current_period_end??null:null}function Pn(e){let t=L();return(0,G.useEffect)(()=>o(()=>{t.invalidateQueries(u())}),[t]),ee({onSuccess:t=>{e&&On(e),se(t.portal_url)},onError:()=>{N.error(R(`settings:useBillingPortalSession.openError`),{id:`billing-portal-session-error`})}})}function Fn(){let e=C(),t=En();return{cancelSubscription:n=>t({mutateAsync:()=>e.mutateAsync({body:n}),onSuccess:e=>{let t=e.cancel_at?Mn(e.cancel_at):R(`settings:useCancelSubscription.endOfBillingPeriod`);N.info(R(`settings:useCancelSubscription.canceledToast`,{date:t}),{id:`subscription-cancel`})},errorToastId:`subscription-cancel-error`,errorFallback:()=>R(`settings:useCancelSubscription.cancelFailedToast`)}),isPending:e.isPending}}function In(e){return Promise.all([e.invalidateQueries({queryKey:p()}),e.invalidateQueries({queryKey:i()}),e.invalidateQueries({queryKey:b()}),e.invalidateQueries({queryKey:oe()})])}function Ln({enabled:e=!0}={}){let t=L(),{t:n}=z(`settings`),[r,i]=(0,G.useState)(null),a=(0,G.useRef)(!1),[o,s]=(0,G.useState)(!1),c=ie(),l=e&&c,d=I({...u(),enabled:l}),f=d.data,p=f!=null&&f.plan_id!==`base`,m=I({...v(),enabled:l&&p}),h=I({...A(),enabled:l&&p}).data?.plans.find(e=>e.id===`pro`)?.machine_tiers??[],g=e=>h.find(t=>t.tier===e)?.price_cents??null,_=le(O()),y={machineTier:m.data?.max_machine_tier??null,storageTier:m.data?.selected_storage_tier??null,storageGib:m.data?.selected_storage_gib??null,creditTier:f?.selected_credit_tier??null,hasPlatformFee:f?.has_platform_fee??!0},b=f!=null&&f.plan_id!==`base`&&f.status!=null&&vn.has(f.status)&&f.cancel_at_period_end!==!0&&!f.cancel_at,x=!p||!m.isPending,S=!p||m.isSuccess&&m.data!=null&&!m.isFetching&&m.dataUpdatedAt>=d.dataUpdatedAt,C=o||_.isPending,w=async(e,t=y)=>{if(a.current)return null;a.current=!0,s(!0);try{return await ee(e,t)}finally{a.current=!1,s(!1)}},ee=async(e,r)=>{i(null);let a=e=>(i(e),N.error(e),null),[o,s]=await Promise.all([d.refetch(),m.refetch()]),c=o.data,l=s.data;if(o.isError||s.isError||c==null||l==null)return a(n(`customPlanModal.changeFailed`));let u={machineTier:l.max_machine_tier??null,storageTier:l.selected_storage_tier??null,storageGib:l.selected_storage_gib??null,creditTier:c.selected_credit_tier??null,hasPlatformFee:c.has_platform_fee??!0},f={machineTier:e.machineTier===r.machineTier?u.machineTier:e.machineTier,storageTier:e.storageTier===r.storageTier&&u.storageTier!=null?u.storageTier:e.storageTier,creditTier:e.creditTier===r.creditTier?u.creditTier:e.creditTier},p=f.machineTier!==u.machineTier,h=f.storageTier!==u.storageTier,v=f.creditTier!==u.creditTier,y=!u.hasPlatformFee,b=g(f.machineTier),x=g(u.machineTier),S=p&&b!=null&&x!=null&&b<x;if(!p&&!h&&!v&&!y)return{needsResize:!1,creditChanged:!1};let C;try{C=(await _.mutateAsync({body:{machine_tier:f.machineTier,storage_tier:f.storageTier,credit_tier:f.creditTier}})).status}catch(e){return a(Sn(e,n(`customPlanModal.changeFailed`)))}return await In(t),C===`no_op`?{needsResize:!1,creditChanged:!1}:{needsResize:h||p&&!S,creditChanged:v}};return{changeTiers:w,isPending:C,error:r,current:y,eligible:b,currentReady:x,currentKnown:S,primaryAssistantId:S?m.data?.primary_assistant_id??null:null}}function Rn(){let e=L(),{t}=z(`settings`),n=le(O());return{changePackage:async r=>{try{let t=await n.mutateAsync({body:{package:r}});return await In(e),t}catch(e){return N.error(Sn(e,t(`customPlanModal.changeFailed`))),null}},isPending:n.isPending}}function zn({className:e,"data-testid":t,children:n}){return(0,K.jsx)(`div`,{"aria-hidden":!0,"data-testid":t,className:T(`flex size-[52px] shrink-0 items-center justify-center rounded-xl`,e),children:n})}var Bn=32;function Vn(){let{ready:e,components:t,traits:r,customImageUrl:i}=l();return(0,K.jsx)(zn,{"data-testid":`assistant-avatar-tile`,className:`bg-[var(--surface-active)]`,children:e?(0,K.jsx)(n,{components:t,traits:r,customImageUrl:i,size:Bn}):null})}var Hn=`Billed monthly · prorated difference charged today`,Un=`Billed monthly · prorated difference charged today or credited next invoice`,Wn=`Billed monthly · prorated credit on your next invoice`,Gn=`Your machine downsizes now and your storage stays. No refund.`,Kn=`Continue`,qn=`The plan includes`,Jn=`Your plan will include`;function Yn(e,t,n){let r=n?$t(n)?.tagline??``:``;switch(e){case`downgrade`:return{title:en(t),subtitle:``,priceCaption:Wn,checklistHeading:Jn,note:Gn,confirmLabel:en(t),destructive:!0};case`switch`:return{title:`Switch to ${t}`,subtitle:r,priceCaption:Un,checklistHeading:qn,note:``,confirmLabel:Kn,destructive:!1};default:return{title:`Upgrade to ${t}`,subtitle:r,priceCaption:Hn,checklistHeading:qn,note:``,confirmLabel:Kn,destructive:!1}}}function Xn({open:e,relation:t,packageName:n,targetPackage:r,pending:i,onCancel:o,onConfirm:c}){let{t:l}=z(`settings`),u=(0,G.useRef)(null),d=(0,G.useId)(),f=Yn(t,n,r?.key??null),p=r?{price:nn(r.total_price_cents),highlights:fn(r,$t(r.key)?.extraFeatures??[])}:null,m=f.subtitle,h=f.note?{"aria-describedby":d}:m?{}:{"aria-describedby":void 0};return(0,K.jsx)(a.Root,{open:e,onOpenChange:e=>{!e&&!i&&o()},children:(0,K.jsxs)(a.Content,{size:`sm`,hideCloseButton:!0,className:`gap-4 p-4 max-w-[421px]`,onOpenAutoFocus:e=>{e.preventDefault(),u.current?.focus()},...h,children:[(0,K.jsxs)(a.Header,{className:`flex-row items-center gap-3 p-0 pb-2`,children:[f.destructive?(0,K.jsx)(zn,{"data-testid":`package-switch-warning-tile`,className:`bg-[var(--system-negative-weak)]`,children:(0,K.jsx)(fe,{className:`size-6 text-[var(--system-negative-strong)]`})}):(0,K.jsx)(Vn,{}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,K.jsx)(a.Title,{className:`text-title-small text-[var(--content-emphasised)] [&>span]:whitespace-normal`,children:f.title}),m?(0,K.jsx)(a.Description,{className:`mt-0 text-body-medium-default text-[var(--content-tertiary)]`,children:m}):null]})]}),p?(0,K.jsxs)(a.Body,{className:`flex flex-col gap-4 p-0`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsx)(E,{as:`p`,variant:`title-large`,className:`text-[var(--content-default)]`,children:p.price}),(0,K.jsx)(E,{as:`p`,variant:`label-medium-default`,className:`leading-[15px] text-[var(--content-tertiary)]`,children:f.priceCaption})]}),(0,K.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,K.jsx)(E,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,children:f.checklistHeading}),(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:p.highlights.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(be,{className:`size-4 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,K.jsx)(E,{as:`span`,variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]},e))})]}):null,f.note?(0,K.jsx)(E,{id:d,as:`p`,variant:`body-medium-default`,className:`text-[var(--content-secondary)]`,children:f.note}):null,(0,K.jsxs)(a.Footer,{className:`flex-col gap-4 p-0`,children:[(0,K.jsx)(s,{fullWidth:!0,variant:f.destructive?`danger`:`primary`,onClick:c,disabled:i,"data-testid":`confirm-package-switch-button`,children:f.confirmLabel}),(0,K.jsx)(s,{ref:u,fullWidth:!0,variant:`ghost`,onClick:o,disabled:i,children:l(`packageSwitchConfirmModal.cancel`)})]})]})})}function Zn(){let e=L();(0,G.useEffect)(()=>o(()=>{In(e)}),[e])}export{nn as A,Ht as B,hn as C,un as D,ln as E,Gt as F,Re as G,Bt as H,Ut as I,W as K,Yt as L,on as M,$t as N,an as O,Zt as P,Wt as R,gn as S,dn as T,Vt as U,zt as V,Ft as W,yn as _,In as a,Cn as b,An as c,kn as d,Pn as f,bn as g,Sn as h,Ln as i,rn as j,tn as k,Mn as l,vn as m,Xn as n,Fn as o,En as p,Rn as r,jn as s,Zn as t,Nn as u,Tn as v,mn as w,_n as x,wn as y,Jt as z};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$S as t,$i as n,$u as r,Ad as i,BS as a,By as o,CC as s,Di as c,Fc as l,Fd as u,Gx as d,IS as f,Id as p,Iu as m,JS as h,Lu as g,Md as _,Nd as v,Oi as y,Pd as b,RS as x,Vn as S,Xd as C,YS as w,Yd as ee,Zo as T,fC as E,ib as te,id as D,jd as O,ju as k,kd as A,ki as ne,nb as re,nu as j,s_ as M,th as ie,u_ as ae,zS as N,zd as oe,zy as se}from"./app-BNxKtvfM.js";import{f as ce,t as P,x as F}from"./react-BJ4PZBJN.js";import{Jn as le,Zn as I,er as L,ir as ue,k as R,or as de,w as z}from"./vendor-CezcraPH.js";import{D as fe,Ji as pe,Ra as me,Ui as he,Vn as ge,Ya as B,fr as _e,pi as ve,xr as ye,zi as be}from"./icons-Dwi7aA1Y.js";import{c as xe,i as V,l as H,n as U,r as Se,t as Ce}from"./machine-sizes-DZLd-6DF.js";import{a as we,i as Te,n as Ee,r as De,t as Oe}from"./provisioning-targets-DKc5ORwj.js";var W=B(`computer`,[[`rect`,{width:`14`,height:`8`,x:`5`,y:`2`,rx:`2`,key:`wc9tft`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h2`,key:`rwmk9e`}],[`path`,{d:`M12 18h6`,key:`aqd8w3`}]]),G=e(F(),1),K=P();function ke({icon:e}){return(0,K.jsx)(`span`,{className:`flex h-11 w-11 items-center justify-center rounded-full`,style:{backgroundColor:`color-mix(in oklab, var(--system-negative-strong) 12%, transparent)`},children:(0,K.jsx)(e,{className:`h-5 w-5`,style:{color:`var(--system-negative-strong)`},"aria-hidden":`true`})})}var Ae={fontFamily:`var(--font-serif)`,fontSize:`32px`,fontWeight:400,lineHeight:1.2,letterSpacing:`0.64px`};function je({title:e,subtitle:t}){return(0,K.jsxs)(`header`,{className:`flex flex-col items-center gap-2 pt-12 text-center`,children:[(0,K.jsx)(`h2`,{className:`text-[var(--content-emphasised)]`,style:Ae,children:e}),t&&(0,K.jsx)(`p`,{className:`text-[14px] font-normal text-[var(--content-secondary)]`,children:t})]})}var q=[{bodyShape:`star`,eyeStyle:`curious`,color:`yellow`,size:103,position:`-left-[28px] -top-[33px]`,rotate:180},{bodyShape:`star`,eyeStyle:`curious`,color:`orange`,size:109,position:`left-[63%] -top-[62px] -translate-x-1/2`,rotate:-8},{bodyShape:`blob`,eyeStyle:`grumpy`,color:`green`,size:76,position:`-right-[25px] top-[60px]`,rotate:1},{bodyShape:`stack`,eyeStyle:`gentle`,color:`purple`,size:110,position:`-left-[39px] top-[74%]`,rotate:0},{bodyShape:`urchin`,eyeStyle:`goofy`,color:`pink`,size:137,position:`-right-[42px] -bottom-[40px]`,rotate:180},{bodyShape:`sprout`,eyeStyle:`curious`,color:`orange`,size:72,position:`left-[37%] -bottom-[22px] -translate-x-1/2`,rotate:0}],Me=[{bodyShape:`star`,eyeStyle:`curious`,color:`yellow`,size:103,position:`-left-[28px] -top-[33px]`,rotate:180},{bodyShape:`star`,eyeStyle:`curious`,color:`orange`,size:109,position:`left-[63%] -top-[62px] -translate-x-1/2`,rotate:-8},{bodyShape:`blob`,eyeStyle:`grumpy`,color:`green`,size:76,position:`-right-[25px] top-[60px]`,rotate:1}];function Ne({variant:e=`full`}){let t=c();return t?(0,K.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`creature-corners`,className:`pointer-events-none absolute inset-0 select-none`,children:(e===`top`?Me:q).map((e,n)=>(0,K.jsx)(`span`,{className:`absolute ${e.position}`,style:{rotate:`${e.rotate}deg`},children:(0,K.jsx)(S,{components:t,bodyShapeId:e.bodyShape,eyeStyleId:e.eyeStyle,colorId:e.color,size:e.size})},n))}):null}var Pe={waitingStatus:`Upgrading your assistant…`,snagStatus:`We hit a snag upgrading your assistant`,snagCaption:`Retry in the background and we'll keep working on your upgrade.`,confirmingStatus:`Confirming your upgrade…`,confirmTimeoutStatus:`Still confirming your upgrade`,confirmTimeoutCaption:`Your payment went through safely. This can take a minute.`,backgroundConfirmMessage:`Your assistant is still upgrading. Chatting won't be available until it finishes. You can keep waiting here, or continue and we'll let you know when it's ready.`,backgroundExitToast:`Your upgrade continues in the background.`,backgroundRetryToast:`We'll retry your upgrade in the background.`,completeSubtitle:`Enjoy the new found power.`,fetchErrorBody:`We hit a problem checking your subscription. Your upgrade may still be processing. Return to billing to refresh.`},Fe={waitingStatus:`Updating your assistant…`,snagStatus:`We hit a snag updating your assistant`,snagCaption:`Retry in the background and we'll keep working on your plan change.`,confirmingStatus:`Confirming your plan change…`,confirmTimeoutStatus:`Still confirming your plan change`,confirmTimeoutCaption:`Your plan change was submitted. This can take a minute.`,backgroundConfirmMessage:`Your assistant is still updating. Chatting won't be available until it finishes. You can keep waiting here, or continue and we'll let you know when it's ready.`,backgroundExitToast:`Your plan change continues in the background.`,backgroundRetryToast:`We'll retry your plan change in the background.`,completeSubtitle:`Your plan changes are live.`,fetchErrorBody:`We hit a problem checking your subscription. Your plan change may still be processing. Return to billing to refresh.`},Ie={upgrade:Pe,downgrade:Fe,change:Fe};function Le(e=`upgrade`){return Ie[e]}function Re(e,t=!0){let{data:n}=I({...k(),enabled:t&&e==null}),{data:r}=I({...D({path:{id:e??``}}),enabled:t&&e!=null});return e==null?n:r}function ze({assistantId:e,direction:t}){let n=ce(),{t:r}=z(`settings`),i=Re(e,ie())?.name||r(`completeState.assistantFallbackName`);return(0,K.jsxs)(`div`,{className:`relative flex min-h-[320px] flex-col items-center justify-center overflow-hidden px-8 pb-16 [animation:onboarding-step-in_350ms_ease-out] motion-reduce:[animation:none]`,children:[(0,K.jsx)(Ne,{variant:`full`}),(0,K.jsxs)(`div`,{className:`relative flex w-full flex-col items-center`,children:[(0,K.jsx)(je,{title:r(`completeState.title`),subtitle:Le(t).completeSubtitle}),(0,K.jsx)(`div`,{className:`mt-10 flex w-full flex-col items-center gap-10`,children:(0,K.jsx)(s,{variant:`primary`,"data-testid":`onboarding-complete-return`,onClick:()=>{e!=null&&M(e),n(d.assistant,{replace:!0})},children:r(`completeState.returnTo`,{assistantName:i})})})]})]})}function Be({onGoToBilling:e,direction:t}){let{t:n}=z(`settings`);return(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-6 py-10 text-center`,children:[(0,K.jsx)(ke,{icon:he}),(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(E,{variant:`title-small`,as:`h1`,children:n(`errorStates.fetchErrorTitle`)}),(0,K.jsx)(E,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:Le(t).fetchErrorBody})]}),(0,K.jsx)(s,{variant:`primary`,"data-testid":`onboarding-go-to-billing`,onClick:e,children:n(`errorStates.goToBilling`)})]})}function J(e){let{targets:t,fromSnapshot:n,machineFloor:r,credits:i}=e,a=[];return t.machineSize==null?r!=null&&n.machineSize!=null&&n.machineSize!==r&&a.push({key:`machine`,label:`Machine`,from:V[n.machineSize],to:V[r]}):n.machineSize!==t.machineSize&&a.push({key:`machine`,label:`Machine`,from:n.machineSize==null?void 0:V[n.machineSize],to:V[t.machineSize]}),t.storageGib!=null&&(n.storageGib==null||t.storageGib>n.storageGib)&&a.push({key:`storage`,label:`Storage`,from:n.storageGib==null?void 0:`${n.storageGib} GB`,to:`${t.storageGib} GB`}),i!=null&&a.push({key:`credits`,label:i.label??`Credits`,from:i.from,to:i.to}),a}var Y=220;function Ve({items:e,visible:t=!0,toWord:n,className:r=``,testId:i=`upgrade-metrics`}){let[a,o]=(0,G.useState)(!1);(0,G.useEffect)(()=>{let e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)},[]);let s=t&&a;return(0,K.jsx)(`div`,{"aria-hidden":!t,"data-testid":i,"data-visible":t?`true`:`false`,className:`flex flex-col items-center gap-3 md:flex-row md:items-stretch md:gap-0 ${r}`,children:e.map((e,t)=>(0,K.jsxs)(`div`,{"data-testid":e.key?`chip-${e.key}`:void 0,className:`flex flex-col items-center gap-1 px-6 transition-[opacity,transform] duration-500 ease-out motion-reduce:transition-none ${s?`translate-y-0 opacity-100`:`translate-y-2 opacity-0`} ${t>0?`md:border-l md:border-[var(--border-subtle)]`:``}`,style:{transitionDelay:s?`${t*Y}ms`:`0ms`},children:[(0,K.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-[0.08em] text-[var(--content-tertiary)]`,children:e.label}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 whitespace-nowrap text-[var(--content-emphasised)]`,style:{fontFamily:`var(--font-serif)`,fontSize:`20px`,lineHeight:1.2},children:[e.from!=null&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:e.from}),n&&(0,K.jsx)(`span`,{className:`sr-only`,children:n}),(0,K.jsx)(me,{className:`size-3.5 text-[var(--content-tertiary)]`,"aria-hidden":`true`})]}),(0,K.jsx)(`span`,{children:e.to}),e.landed&&(0,K.jsx)(pe,{"data-testid":`chip-check`,className:`size-3.5 text-[var(--system-positive-strong)]`,"aria-hidden":`true`}),e.status&&(0,K.jsx)(`span`,{className:`sr-only`,children:e.status})]})]},e.key??e.label))})}var He=48;function Ue(e,t,n,r,i){let a=i*i,o=a*i;return .5*(2*t+(-e+n)*i+(2*e-5*t+4*n-r)*a+(-e+3*t-3*n+r)*o)}function X(e,t,n){let r=e.map(e=>({x:e.fx*t,y:e.fy*n,size:e.fs*n})),i=[],a=[],o=[],s=[],c=[],l=[],u=0;for(let e=0;e<r.length-1;e++){let t=r[Math.max(0,e-1)],n=r[e],c=r[e+1],l=r[Math.min(r.length-1,e+2)],d=e===r.length-2?He+1:He;for(let e=0;e<d;e++){let r=e/He,d=Ue(t.x,n.x,c.x,l.x,r),f=Ue(t.y,n.y,c.y,l.y,r);i.length>0&&(u+=Math.hypot(d-i[i.length-1],f-a[a.length-1])),i.push(d),a.push(f),o.push(n.size+(c.size-n.size)*r),s.push(u)}}for(let e=0;e<i.length;e++){let t=Math.max(0,e-1),n=Math.min(i.length-1,e+1),r=i[n]-i[t],o=a[n]-a[t],s=Math.hypot(r,o)||1;c.push(r/s),l.push(o/s)}return{length:u,at:e=>{let t=Math.min(u,Math.max(0,e)),n=0,r=s.length-1;for(;n<r;){let e=n+r>>1;s[e]<t?n=e+1:r=e}let d=Math.max(1,n),f=d-1,p=s[d]-s[f]||1,m=(t-s[f])/p,h=c[f]+(c[d]-c[f])*m,g=l[f]+(l[d]-l[f])*m,_=Math.hypot(h,g)||1;return{x:i[f]+(i[d]-i[f])*m,y:a[f]+(a[d]-a[f])*m,tx:h/_,ty:g/_,size:o[f]+(o[d]-o[f])*m}}}}function Z(e,t){if(t<=0)return 0;let n=e%t;return n<0?n+t:n}function Q(e,t){let n=[],r=0;for(;r<e.length;)n.push(r),r+=Math.max(1,e.at(r).size*t);return n}var We={around:[{fx:.2,fy:-.16,fs:.02},{fx:.23,fy:0,fs:.024},{fx:.34,fy:.12,fs:.03},{fx:.52,fy:.19,fs:.037},{fx:.7,fy:.26,fs:.046},{fx:.85,fy:.4,fs:.058},{fx:.88,fy:.56,fs:.074},{fx:.76,fy:.71,fs:.095},{fx:.56,fy:.82,fs:.12},{fx:.4,fy:.93,fs:.15},{fx:.3,fy:1.08,fs:.185},{fx:.24,fy:1.28,fs:.22}],below:[{fx:1.16,fy:0,fs:.03},{fx:.95,fy:.06,fs:.036},{fx:.68,fy:.16,fs:.048},{fx:.4,fy:.3,fs:.065},{fx:.22,fy:.47,fs:.09},{fx:.32,fy:.64,fs:.125},{fx:.56,fy:.8,fs:.17},{fx:.58,fy:.98,fs:.22},{fx:.46,fy:1.22,fs:.27},{fx:.36,fy:1.5,fs:.3}]},Ge={around:.24,below:.32},Ke=.95,qe=.95,Je=1,Ye=8,Xe=20260922,Ze=50;function Qe({className:e=``,layout:t=`around`,flow:n=`down`,speed:r=1,lanes:i=3,paused:a=!1}){let o=c(),s=(0,G.useRef)(null),l=(0,G.useRef)({flow:n,speed:r,paused:a});return(0,G.useEffect)(()=>{l.current={flow:n,speed:r,paused:a}},[n,r,a]),(0,G.useEffect)(()=>{let e=s.current;if(!e||!o)return;let n=e.getContext(`2d`);if(!n)return;let r=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,a=0,c=0,u=null,d=1/0,f=[],p=0,m=new Map,h=(e,t)=>{let n=Math.max(1,Math.round(t/Ye))*Ye,r=`${e.bodyIdx}-${e.eyeIdx}-${e.colorIdx}-${n}`,i=m.get(r);if(i!==void 0)return i;let a=y(o,e.bodyIdx,e.eyeIdx,e.colorIdx,n);return m.set(r,a),a},g=()=>{let r=e.getBoundingClientRect();if(r.width===0||r.height===0||Math.abs(r.width-a)<1&&Math.abs(r.height-c)<1)return;let s=u,l=f.map(e=>e.distance);a=r.width,c=r.height;let p=Math.min(2,window.devicePixelRatio||1);e.width=Math.round(a*p),e.height=Math.round(c*p),n.setTransform(p,0,0,p,0,0),u=X(We[t],a,c),d=c*Ge[t];let m=ne(Xe),h=e=>(m()*2-1)*e,g=-1;if(f=[],Q(u,Ke).forEach((e,t)=>{let n=t%2==0?0:.5;for(let t=0;t<i;t++){let r=Math.floor(m()*o.colors.length);r===g&&(r=(r+1)%o.colors.length),g=r,f.push({distance:e,lane:t-(i-1)/2+n,jitterAlong:h(.08),jitterAcross:h(.12),sizeScale:.85+m()*.3,rotate:h(10)*Math.PI/180,phase:m()*Math.PI*2,bodyIdx:Math.floor(m()*o.bodyShapes.length),eyeIdx:Math.floor(m()*o.eyeStyles.length),colorIdx:r})}}),s&&s.length>0){let e=u.length/s.length;f.forEach((t,n)=>{let r=l[n];r!==void 0&&(t.distance=Z(r*e,u.length))})}},_=e=>{if(!u)return;let t=p?Math.min(Ze,e-p):0;p=e;let{flow:i,speed:o,paused:s}=l.current,m=r||s?0:(i===`down`?1:-1)*o*Je*(t/1e3);n.clearRect(0,0,a,c);for(let t of f){if(m!==0){let e=u.at(t.distance).size;t.distance=Z(t.distance+m*e,u.length)}let i=u.at(t.distance),a=Math.min(d,i.size*t.sizeScale),o=(t.lane*qe+t.jitterAcross)*i.size,s=t.jitterAlong*i.size,c=i.x+i.ty*o+i.tx*s,l=i.y-i.tx*o+i.ty*s,f=h(t,a);if(!f)continue;let p=r?0:Math.sin(e*.001+t.phase)*1.4,g=r?0:Math.sin(e*8e-4+t.phase*2)*.025;n.save(),n.translate(c,l+p),n.rotate(t.rotate+g),n.drawImage(f,-a/2,-a/2,a,a),n.restore()}};g();let v=new ResizeObserver(()=>{g(),r&&_(performance.now())});v.observe(e);let b=0;if(r)_(performance.now());else{let e=t=>{_(t),b=requestAnimationFrame(e)};b=requestAnimationFrame(e)}return()=>{cancelAnimationFrame(b),v.disconnect()}},[o,i,t]),(0,K.jsx)(`canvas`,{ref:s,"aria-hidden":`true`,"data-testid":`upgrade-stream`,className:`pointer-events-none block h-full w-full ${e}`})}function $(e,t){if(t!=null)return e?.credit_tiers?.find(e=>e.tier===t)}function $e(e){let t=e?.match(/^credits_(\d+)$/)?.[1];return t==null?null:Number(t)}function et(e){let t=ie(),{data:n}=I({...A(),enabled:t&&e});return n?.plans.find(e=>e.id===`pro`)}function tt(e,t){return t==null?0:$(e,t)?.credits_usd??$e(t)}function nt(e,t){return t==null?null:$(e,t)?.label}function rt(e){let t=et(e!=null);if(e==null||t==null)return null;let n,r;if(e.kind===`package`){let i=t.packages.find(t=>t.key===e.packageKey),a=$(t,i?.credit_tier);n=i?.credits_usd??a?.credits_usd,r=i?.usage_label??a?.label??void 0}else{let i=$(t,e.creditTier);n=i?.credits_usd,r=i?.label}return n==null?null:{fromLabel:null,toLabel:r}}function it(e){let t=et(e!=null);return e==null||tt(t,e.fromTier)==null||tt(t,e.toTier)==null?null:{fromLabel:nt(t,e.fromTier),toLabel:nt(t,e.toTier)}}function at(e,t){let[n,r]=(0,G.useState)(e),i=(0,G.useRef)(0);return(0,G.useEffect)(()=>{i.current=performance.now()},[]),(0,G.useEffect)(()=>{if(t<=0||e===n)return;let a=t-(performance.now()-i.current);if(a<=0){i.current=performance.now(),r(e);return}let o=setTimeout(()=>{i.current=performance.now(),r(e)},a);return()=>clearTimeout(o)},[e,n,t]),t<=0?e:n}var ot=1e3,st=1e4,ct=2500,lt=2e3,ut=1e4,dt=[`machine_size`,`subdomain`,`non_field_errors`],ft={subdomain_taken:`That subdomain is already taken. Try another.`,assistant_already_has_domain:`Your assistant already has a custom domain.`,no_assistant_to_attach_domain:`We couldn't find an assistant to attach this domain to.`,exceeds_machine_tier:`That machine size isn't available on your plan.`,provisioning_submission_failed:`We couldn't queue your upgrade just now. Try again in a moment.`,no_active_pro:`We couldn't confirm your Pro plan yet. Try again in a moment.`,no_provisionable_assistants:`We couldn't find an assistant to upgrade yet. Try again in a moment.`},pt={provisioning_submission_failed:`We couldn't queue your plan change just now. Try again in a moment.`,no_provisionable_assistants:`We couldn't find an assistant to update yet. Try again in a moment.`};function mt(e,t,n=`upgrade`){if(e&&typeof e==`object`){let t=e;if(typeof t.error==`string`){let e=(n===`upgrade`?void 0:pt[t.error])??ft[t.error];if(e)return e}for(let e of dt){let n=t[e];if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}if(typeof t.detail==`string`)return t.detail}return t}var ht=`#ffffff`;function gt({status:e,caption:t}){return(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5`,children:[(0,K.jsx)(`h1`,{className:`text-[var(--content-emphasised)]`,style:Ae,children:e}),t&&(0,K.jsx)(E,{variant:`body-medium-lighter`,as:`p`,className:`max-w-sm text-[var(--content-secondary)]`,children:t})]})}function _t(e,t){return e===`credits`?!0:t?.[e]===!0}function vt(e,t){if(e==null)return null;let n=t(`provisioningState.noExtraUsage`),r=e.toLabel===null?n:e.toLabel;return r==null?null:{label:t(`provisioningState.usageLabel`),from:e.fromLabel===null?n:e.fromLabel,to:r}}function yt({intent:e,creditsChange:t,targets:n,fromSnapshot:r,machineFloor:i,landed:a,allDone:o=!1,creditsOnly:s=!1}){let{t:c}=z(`settings`),l=rt(e),u=it(t),d=J({targets:n,fromSnapshot:r,machineFloor:i,credits:vt(l??u,c)}),f=s?d.filter(e=>e.key===`credits`):d,p=f.filter(e=>o||_t(e.key,a)).map(e=>e.label).join(`, `),[m]=(0,G.useState)(p),h=p===m?``:c(`provisioningState.dimensionsComplete`,{dimensions:p});return f.length===0?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ve,{items:f.map(e=>{let t=o||_t(e.key,a);return{key:e.key,label:e.label,from:e.from??null,to:e.to,landed:t,status:c(t?`provisioningState.statusComplete`:`provisioningState.statusPending`)}}),testId:`resource-chips`,toWord:c(`provisioningState.srOnlyTo`)}),(0,K.jsx)(`p`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`chip-announcement`,children:h})]})}function bt({intent:e}){let{t}=z(`settings`),n=rt(e.kind===`custom`?e:null);if(e.kind===`package`){let n=e.packageKey.charAt(0).toUpperCase()+e.packageKey.slice(1);return(0,K.jsx)(Ve,{testId:`resource-chips`,items:[{key:`package`,label:t(`provisioningState.packageLabel`),from:null,to:n}]})}let r=[];return e.machineTier!=null&&r.push({key:`machine`,label:t(`provisioningState.machineLabel`),from:null,to:U[e.machineTier]??e.machineTier}),e.storageTier!=null&&r.push({key:`storage`,label:t(`provisioningState.storageLabel`),from:null,to:e.storageTier.toUpperCase()}),e.creditTier!=null&&n?.toLabel!=null&&r.push({key:`credits`,label:t(`provisioningState.usageLabel`),from:null,to:n.toLabel}),r.length===0?null:(0,K.jsx)(Ve,{testId:`resource-chips`,items:r})}function xt({state:e,direction:t,softWaiting:n,intent:r,creditsChange:i,targets:a,fromSnapshot:o,machineFloor:c,landed:l,celebrating:u,onCelebrationEnd:d,escapeAvailable:f,onEscape:p,onPhaseChange:m,kickError:h,confirm:g,dwellMs:_=ct,phaseMinMs:v=900}){let{t:y}=z(`settings`),b=Le(t),x=(0,G.useRef)(d);(0,G.useEffect)(()=>{x.current=d},[d]);let S=at(e,v),C=S===`DONE`||S===`NOT_APPLICABLE`,w=S===`RESIZING`?`WAITING`:S,ee=(0,G.useRef)(m);(0,G.useEffect)(()=>{ee.current=m},[m]),(0,G.useEffect)(()=>{ee.current?.(S)},[S]);let T=u&&C;(0,G.useEffect)(()=>{if(!T)return;let e=setTimeout(()=>x.current(),_);return()=>clearTimeout(e)},[T,_]);let E=j(),te=S===`STALLED`,D=(0,K.jsx)(`div`,{className:`relative z-10 flex w-full flex-col items-center gap-6 [animation:onboarding-step-in_420ms_ease-out] motion-reduce:[animation:none]`,children:A()},w);if(E)return(0,K.jsxs)(`div`,{"data-testid":`provisioning-takeover`,"data-theme":`light`,className:`relative flex h-full min-h-[420px] w-full flex-col overflow-hidden text-center`,style:{backgroundColor:ht},children:[(0,K.jsx)(`div`,{className:`px-6 pb-8 pt-16`,children:D}),(0,K.jsx)(`div`,{className:`relative min-h-0 flex-1`,children:(0,K.jsx)(Qe,{className:`absolute inset-0`,layout:`below`,paused:te})})]});return(0,K.jsxs)(`div`,{"data-testid":`provisioning-takeover`,"data-theme":`light`,className:`relative flex h-full min-h-[420px] w-full flex-col items-center justify-center overflow-hidden px-6 py-10 text-center`,style:{backgroundColor:ht},children:[(0,K.jsx)(Qe,{className:`absolute inset-0`,layout:`around`,paused:te}),(0,K.jsx)(`div`,{className:`relative z-10 mr-[16%] flex w-full max-w-2xl flex-col items-center`,children:D})]});function O(e=y(`provisioningState.continueInBackground`)){return f?(0,K.jsx)(s,{variant:`ghost`,"data-testid":`provisioning-escape`,onClick:p,children:e}):null}function k({allDone:e=!1,creditsOnly:t=!1}={}){return(0,K.jsx)(yt,{intent:r,creditsChange:i,targets:a,fromSnapshot:o,machineFloor:c,landed:l,allDone:e,creditsOnly:t})}function A(){if(S===`CONFIRMING`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gt,{status:b.confirmingStatus,caption:y(`provisioningState.confirmingCaption`)}),r&&(0,K.jsx)(bt,{intent:r}),O()]});if(S===`WAITING`||S===`RESIZING`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gt,{status:b.waitingStatus,caption:y(n?`provisioningState.waitingCaptionLong`:`provisioningState.waitingCaptionShort`)}),k(),O()]});if(S===`DONE`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gt,{status:y(`provisioningState.allDoneStatus`)}),k({allDone:!0})]});if(S===`NOT_APPLICABLE`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gt,{status:y(`provisioningState.planReadyStatus`)}),k({allDone:!0,creditsOnly:!0})]});if(S===`STALLED`){let e=h!=null;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gt,{status:e?b.snagStatus:y(`provisioningState.takingLongerStatus`),caption:e?mt(h,b.snagCaption,t):y(`provisioningState.stalledCaption`)}),k(),e?O(y(`provisioningState.retryInBackground`)):O()]})}return S===`CONFIRM_TIMEOUT`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gt,{status:b.confirmTimeoutStatus,caption:b.confirmTimeoutCaption}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,K.jsx)(s,{variant:`outlined`,"data-testid":`onboarding-go-to-billing`,onClick:g.onGoToBilling,children:y(`provisioningState.goToBilling`)}),(0,K.jsx)(s,{variant:`primary`,"data-testid":`onboarding-retry`,onClick:g.onRetry,children:y(`provisioningState.tryAgain`)})]})]}):null}}function St(e=!0,t){let n=Re(t,e),r=t??n?.id,{data:i,isError:a,isFetching:o,dataUpdatedAt:s,errorUpdatedAt:c}=I({...m({path:{assistant_id:r??``}}),enabled:e&&!!r});return{assistant:n,assistantId:r,domains:i,domainsError:a,domainsFetching:o,domainsUpdatedAt:s,domainsErrorUpdatedAt:c}}function Ct(e){let{planId:t,targets:n,actuals:r,initialActuals:i,resizeOperationInFlight:a,sawOperation:o,msSinceWatchStart:s,confirmExpired:c,serverVerdict:l=null,statusObservedSinceTargetsMet:u=!0,targetsProveNoop:d=!0}=e;if(t!==`pro`)return{state:c?`CONFIRM_TIMEOUT`:`CONFIRMING`,softWaiting:!1};let f=o||a,p=l===`started`||l===`in_progress`,m=o||d&&u;if(!a){let e=p?m:f||l===`already_done`||i!=null&&!we(n,i);if(we(n,r)){if(e)return{state:`DONE`,softWaiting:!1};if(!p&&(d||l===`not_applicable`))return{state:`NOT_APPLICABLE`,softWaiting:!1}}else{if(l===`already_done`)return{state:`DONE`,softWaiting:!1};if(l===`not_applicable`)return{state:`NOT_APPLICABLE`,softWaiting:!1}}}return s!=null&&s>=9e4?{state:`STALLED`,softWaiting:!1}:f||l===`started`||l===`in_progress`?{state:`RESIZING`,softWaiting:!1}:{state:`WAITING`,softWaiting:s!=null&&s>=3e4}}var wt=2e3,Tt=1e3,Et=[`DONE`,`NOT_APPLICABLE`,`CONFIRM_TIMEOUT`],Dt={assistantId:null,machine:null,storage:null};function Ot({open:e,canLowerResources:t=!1,verdictRecheckMs:n=ut}){let i=L(),a=ie(),[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(0),[d,f]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),[g,y]=(0,G.useState)(null),[x,S]=(0,G.useState)(null),[C,w]=(0,G.useState)(null),[ee,T]=(0,G.useState)(null),[E,te]=(0,G.useState)(Dt),[O,A]=(0,G.useState)(null),[ne,re]=(0,G.useState)(!1),j=(0,G.useRef)(!1),M=(0,G.useRef)(!1),N=(0,G.useRef)(0),[oe,se]=(0,G.useState)(!1),[ce,P]=(0,G.useState)(null),[F,R]=(0,G.useState)(null),[z,fe]=(0,G.useState)(null),[pe,me]=(0,G.useState)(()=>Date.now()),[he,ge]=(0,G.useState)(!0);(0,G.useEffect)(()=>{e||(s(!1),l(0),f(null),h(null),y(null),se(!1),P(null),R(null),fe(null),ge(!0),S(null),w(null),T(null),te(Dt),A(null),re(!1),j.current=!1,M.current=!1,N.current+=1)},[e]),(0,G.useEffect)(()=>{e&&(f(Date.now()),i.invalidateQueries({queryKey:p()}),i.invalidateQueries({queryKey:b()}))},[e,i]);let B=m!=null,_e=I({...u(),refetchInterval:e=>e.state.data?.plan_id===`pro`||o?!1:ot,refetchIntervalInBackground:!1,enabled:e&&a&&!B}),ve=(d!=null&&_e.dataUpdatedAt>=d?_e.data?.plan_id:null)??null;(0,G.useEffect)(()=>{if(!e||B||ve!==`pro`)return;let t=Date.now();h(t),me(t)},[e,B,ve]),(0,G.useEffect)(()=>{if(!e||B)return;let t=setTimeout(()=>s(!0),st);return()=>clearTimeout(t)},[e,B,c]);let ye=(0,G.useCallback)(()=>{s(!1),l(e=>e+1),ae.getState().fetchOrganizations(),i.invalidateQueries({queryKey:p()})},[i]),be=(0,G.useCallback)(()=>{let e=Date.now();y(e),me(e)},[]),{mutate:V}=le(_()),U=(0,G.useCallback)(e=>{let t=N.current;V({},{onSuccess:n=>{t===N.current&&(A(null),Ee(n)?M.current?A({error:n.reason??`no_active_pro`}):(M.current=!0,re(!0),e===`escape`&&be()):(S(n.state),e===`escape`&&be()))},onError:e=>{t===N.current&&A(e)}})},[V,be]);(0,G.useEffect)(()=>{!e||!a||!B||j.current||(j.current=!0,U(`auto`))},[e,a,B,U]),(0,G.useEffect)(()=>{if(!ne)return;let e=N.current,t=setTimeout(()=>{re(!1),e===N.current&&U(`auto`)},lt);return()=>clearTimeout(t)},[ne,U]);let Se=(0,G.useCallback)(()=>U(`escape`),[U]),W=I({...v(),enabled:e&&a&&B}),K=he?wt:!1,ke=I({...k(),enabled:e&&a&&B,refetchInterval:e=>e.state.data?.id==null?K:!1,retry:!1}),Ae=B&&d!=null&&W.dataUpdatedAt>=d,je=Ae&&!W.isPending&&!W.isFetching,q=(Ae?W.data?.primary_assistant_id:null)??(W.isPending?null:ke.data?.id??null),Me=I({...D({path:{id:q??`unresolved`}}),enabled:e&&a&&B&&q!=null,refetchInterval:K,retry:!1}),Ne=r({path:{id:q??`unresolved`}}),Pe=I({...Ne,enabled:e&&a&&B&&q!=null,refetchInterval:K,retry:!1}),Fe=(0,G.useRef)(0),[Ie,Le]=(0,G.useState)(0),Re=de(Ne.queryKey);(0,G.useEffect)(()=>i.getQueryCache().subscribe(t=>{if(!(t.type!==`updated`||t.query.queryHash!==Re)){if(t.action.type===`fetch`)Fe.current+=1;else if(t.action.type===`success`&&!t.action.manual){let n=Fe.current,r=e&&De(t.action.data);ue.schedule(()=>{Le(n),r&&(se(!0),P(q))})}}}),[i,Re,e,q]);let ze=De(Pe.data),Be=ce===q,J=W.data,Y=(0,G.useMemo)(()=>J?{machineSize:xe(J.max_machine_tier),storageGib:J.selected_storage_gib??null}:null,[J]),Ve=J!=null&&J.max_machine_tier==null?Ce:null,He=J?J.domain_setup_available&&J.primary_assistant_id!=null:void 0,Ue=Me.data,X=(0,G.useMemo)(()=>Ue?{machineSize:Ue.machine_size??null,storageGib:Ue.provisioned_storage_gib??null}:null,[Ue]),Z=z===q,Q=(0,G.useMemo)(()=>{let e=Oe(Y,X),t=Y?.machineSize??Ve;if(t==null)return e;let n=X?.machineSize??null;if(n==null)return{...e,machine:!1};let r=(Z?F?.machineSize:null)??n,i=H(t)<H(r);return{...e,machine:i?H(n)<=H(t):H(n)>=H(t)}},[Y,X,F,Z,Ve]),We=we(Y,X),Ge=ee===q;(0,G.useEffect)(()=>{e&&(We?(w(e=>e!=null&&Ge?e:Date.now()),T(q)):(w(null),T(null)))},[e,We,q,Ge]);let Ke=E.assistantId===q;(0,G.useEffect)(()=>{if(!e)return;let t=Fe.current;te(e=>{let n=e.assistantId===q?e:Dt,r=Q.machine?n.machine??t:null,i=Q.storage?n.storage??t:null;return e.assistantId===q&&e.machine===r&&e.storage===i?e:{assistantId:q,machine:r,storage:i}})},[e,Q,q]);let qe=(0,G.useMemo)(()=>{let e=Te(Pe.data),t=e=>e!=null&&Ke&&Ie>e;return{machine:Q.machine&&!e.machine&&t(E.machine),storage:Q.storage&&!e.storage&&t(E.storage)}},[Q,E,Ke,Ie,Pe.data]);(0,G.useEffect)(()=>{!e||!X||F!=null&&Z||(R(X),fe(q))},[e,X,q,F,Z]);let Je=g??m,Ye=Je==null?null:Math.max(0,pe-Je),Xe=!t,{state:Ze,softWaiting:Qe}=Ct({planId:B?`pro`:ve,targets:Y,actuals:X,initialActuals:Z?F:null,resizeOperationInFlight:ze,sawOperation:oe&&Be,msSinceWatchStart:Ye,confirmExpired:o,serverVerdict:x,statusObservedSinceTargetsMet:C!=null&&Ge&&Pe.dataUpdatedAt>C,targetsProveNoop:Xe}),$=Et.includes(Ze),$e=e&&B&&!$;(0,G.useEffect)(()=>{ge($e)},[$e]),(0,G.useEffect)(()=>{if(!e||!B||$)return;let t=setInterval(()=>me(Date.now()),Tt);return()=>clearInterval(t)},[e,B,$]);let et=!Xe&&(x===`started`||x===`in_progress`)&&!(oe&&Be);return(0,G.useEffect)(()=>{if(!e||!B||$||!et)return;let t=setInterval(()=>U(`auto`),n);return()=>clearInterval(t)},[e,B,$,et,n,U]),{state:Ze,softWaiting:Qe,targets:Y,actualsSnapshot:F,machineFloor:Ve,landed:qe,assistantId:q,domainStepAvailable:He,onboardingSettled:je,confirmError:!B&&_e.isError,targetsError:B&&W.isError&&(!J||!Ae),escapeEligible:Ye!=null&&Ye>=6e4,retryConfirm:ye,kickProvisioning:Se,kickError:O}}var kt=200,At=380;function jt(){return typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0}var Mt=e=>e===`WAITING`||e===`RESIZING`||e===`STALLED`,Nt=e=>e===`DONE`||e===`NOT_APPLICABLE`,Pt={machineSize:null,storageGib:null};function Ft({open:e,onClose:t,dwellMs:n,phaseMinMs:r,mode:i=`checkout`,resizeContext:o}){let{t:s}=z(`settings`),c=i===`resize`,l=L(),u=ce(),[f,p]=(0,G.useState)(`provisioning`),[m,h]=(0,G.useState)(`idle`),_=(0,G.useRef)([]),[v,y]=(0,G.useState)(null),[b,S]=(0,G.useState)(null),[C,w]=(0,G.useState)(null),[ee,T]=(0,G.useState)(!1),E=c?o?.direction:void 0,D=Le(E),O=Ot({open:e,canLowerResources:c?o?.canLowerResources===!0:!1});(0,G.useEffect)(()=>{if(e){y(c?null:te()),w(e=>e??Date.now());return}_.current.forEach(clearTimeout),_.current=[],p(`provisioning`),h(`idle`),S(null),w(null),T(!1)},[e,c]),(0,G.useEffect)(()=>()=>{_.current.forEach(clearTimeout)},[]),(0,G.useEffect)(()=>{f===`complete`&&re()},[f]);let k=Mt(O.state),A=Nt(b??O.state),{targets:ne,assistantId:j,domainStepAvailable:M,onboardingSettled:ie}=O,ae=c?o?.fromSnapshot:void 0,oe=O.actualsSnapshot,se={machineSize:ae?.machineSize??oe?.machineSize??null,storageGib:ae?.storageGib??oe?.storageGib??null},P=c&&M===!0,{domains:F,domainsError:le,domainsFetching:I,domainsUpdatedAt:ue,domainsErrorUpdatedAt:R}=St(e&&P,j),de=(F?.results.length??0)>0,fe=(0,G.useRef)(null);(0,G.useEffect)(()=>{if(!e){fe.current=null;return}!P||j==null||fe.current!==j&&(fe.current=j,l.invalidateQueries({queryKey:g({path:{assistant_id:j}})}))},[e,P,j,l]);let pe=!I&&(C!=null&&ue>=C||C!=null&&!!le&&R>=C),[me,he]=(0,G.useState)(!1),ge=ie&&(!P||pe);(0,G.useEffect)(()=>{if(!e){he(!1);return}ge&&he(!0)},[e,ge]);let B=(0,G.useCallback)(()=>{re(),t(),u(d.assistantInbox,{replace:!0})},[u,t]),_e=(0,G.useCallback)(()=>{if(c?M===!0&&!de:M!==!1){B();return}if(jt()){p(`complete`);return}h(`covering`),_.current.push(setTimeout(()=>{p(`complete`),h(`revealing`),_.current.push(setTimeout(()=>h(`idle`),At))},kt))},[M,c,de,B]),ve=(0,G.useCallback)(()=>{T(!0)},[]),ye=(0,G.useCallback)(()=>{O.kickProvisioning(),N.info(O.kickError==null?D.backgroundExitToast:D.backgroundRetryToast),T(!1),t()},[O,t,D]),be=(0,G.useCallback)(()=>{T(!1)},[]),xe=f===`provisioning`&&(O.confirmError||O.targetsError),V=f===`provisioning`&&!xe,H=V&&!A,U=`transition-[background-color] duration-300 ease-out${V?` bg-white p-0`:``}`,Se=V?`[animation:fadeIn_0.45s_ease-out_both]`:m===`revealing`?`[animation:fadeInUp_0.42s_ease-out_0.12s_both]`:`[animation:fadeIn_0.25s_ease-out_both]`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(a.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,K.jsxs)(a.Content,{size:`md`,hideCloseButton:f!==`complete`,dismissOnOverlayClick:!H,onEscapeKeyDown:H?e=>e.preventDefault():void 0,onInteractOutside:H?e=>e.preventDefault():void 0,overlayClassName:U,className:V?`overflow-y-auto inset-0 max-w-none w-screen h-screen max-h-none rounded-none border-0`:`overflow-hidden`,children:[(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col motion-reduce:[animation:none] ${Se}`,children:Ce()},f),m!==`idle`&&(0,K.jsx)(`div`,{"aria-hidden":!0,"data-testid":`takeover-exit-sheet`,className:`pointer-events-none fixed inset-0 z-50 ${m===`covering`?`[animation:fadeIn_200ms_ease-in_both]`:`[animation:fadeIn_380ms_ease-out_both_reverse]`}`,style:{backgroundColor:`#ffffff`}})]})}),(0,K.jsx)(x,{open:ee&&k,title:s(`billingOnboardingModal.backgroundConfirmTitle`),message:D.backgroundConfirmMessage,confirmLabel:s(`billingOnboardingModal.backgroundConfirmContinue`),cancelLabel:s(`billingOnboardingModal.backgroundConfirmKeepWaiting`),onConfirm:ye,onCancel:be})]});function Ce(){return f===`provisioning`?O.confirmError||O.targetsError?(0,K.jsx)(Be,{onGoToBilling:t,direction:E}):(0,K.jsx)(xt,{state:O.state,direction:E,softWaiting:O.softWaiting,intent:v,creditsChange:c?o?.credits:void 0,targets:ne??Pt,fromSnapshot:se,machineFloor:O.machineFloor,landed:O.landed,celebrating:me,onCelebrationEnd:_e,escapeAvailable:k&&O.escapeEligible,onEscape:ve,onPhaseChange:S,kickError:O.kickError,confirm:{onRetry:O.retryConfirm,onGoToBilling:t},dwellMs:n,phaseMinMs:r}):(0,K.jsx)(ze,{assistantId:j,direction:E})}}var It=[`too_expensive`,`missing_features`,`switched_service`,`unused`,`too_complex`,`low_quality`,`customer_service`,`other`],Lt={too_expensive:`cancelReasonSurvey.optionTooExpensive`,missing_features:`cancelReasonSurvey.optionMissingFeatures`,switched_service:`cancelReasonSurvey.optionSwitchedService`,unused:`cancelReasonSurvey.optionUnused`,too_complex:`cancelReasonSurvey.optionTooComplex`,low_quality:`cancelReasonSurvey.optionLowQuality`,customer_service:`cancelReasonSurvey.optionCustomerService`,other:`cancelReasonSurvey.optionOther`},Rt=1e3,zt={feedback:null,comment:``};function Bt(e){return e.feedback!=null}function Vt(e){let t=e.feedback===`other`?e.comment.trim():``;return{feedback:e.feedback,comment:t||null}}function Ht({value:e,onChange:n,disabled:r}){let{t:i}=z(`settings`);return(0,K.jsxs)(`div`,{className:`mt-5 space-y-3`,"data-testid":`cancel-reason-survey`,children:[(0,K.jsx)(E,{as:`p`,variant:`body-medium-default`,children:i(`cancelReasonSurvey.title`)}),(0,K.jsx)(w,{value:e.feedback??``,onValueChange:t=>n({...e,feedback:t===``?null:t}),name:`cancel-reason`,disabled:r,"aria-label":i(`cancelReasonSurvey.title`),children:It.map(e=>(0,K.jsx)(h,{value:e,label:i(Lt[e])},e))}),e.feedback===`other`?(0,K.jsx)(t,{label:i(`cancelReasonSurvey.otherLabel`),placeholder:i(`cancelReasonSurvey.otherPlaceholder`),value:e.comment,onChange:t=>n({...e,comment:t.target.value}),maxLength:Rt,rows:3,disabled:r,fullWidth:!0,"data-testid":`cancel-reason-comment`}):null]})}function Ut(e){return e!=null&&!e.customized}function Wt(e){return Ut(e)?e.name:`Custom`}var Gt=[`mighty`,`super`,`ultra`],Kt=[`free`,...Gt];function qt(e){return Kt.indexOf(e)}function Jt(e,t){if(e===null)return`upgrade`;let n=qt(e),r=qt(t);return n===-1||r===-1?`upgrade`:r===n?`current`:r<n?`downgrade`:`upgrade`}function Yt(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>Gt.indexOf(e.key)-Gt.indexOf(t.key));if(!t)return n[0];let r=n.findIndex(e=>e.key===t);return r===-1?n[0]:r>=n.length-1?null:n[r+1]}var Xt={free:{bodyShape:`ninja`,eyeStyle:`angry`,color:`yellow`},mighty:{bodyShape:`cloud`,eyeStyle:`grumpy`,color:`green`},super:{bodyShape:`urchin`,eyeStyle:`goofy`,color:`teal`},ultra:{bodyShape:`sprout`,eyeStyle:`curious`,color:`orange`}};function Zt({tier:e,size:t=40}){let n=Xt[e]??Xt.free,r=c();return(0,K.jsx)(`div`,{"aria-hidden":!0,className:`inline-flex shrink-0`,children:r?(0,K.jsx)(S,{components:r,bodyShapeId:n.bodyShape,colorId:n.color,size:t}):(0,K.jsx)(`div`,{style:{width:t,height:t}})})}var Qt={free:{tagline:`Get to know your assistant.`,cta:`Start Free`,priceCaption:`Forever`},mighty:{tagline:`More capacity for consistent use.`,cta:`Power Up`,priceCaption:`Billed monthly`,recommended:!0},super:{tagline:`Do more, think less about the how.`,cta:`Go Super`,priceCaption:`Billed monthly`,extraFeatures:[`Assistant email and subdomain`]},ultra:{tagline:`Your second brain, running full speed.`,cta:`Unleash Ultra`,priceCaption:`Billed monthly`,extraFeatures:[`Assistant email and subdomain`]}};function $t(e){return Qt[e]}function en(e){return`Downgrade to ${e}`}function tn(e){let t=e/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function nn(e){return`${tn(e)}/mo`}function rn(e){return`${tn(e)}/month`}function an(e){return`${e>0?`+`:`−`}${tn(Math.abs(e))}/mo`}function on(e){return`${e} GB storage`}function sn(e){return`${tn(e*100)} of bundled credits`}var cn=`Small`;function ln(e){return e?.machine_size?V[e.machine_size]??e.machine_size:cn}function un(e,t){let n=$t(e.key)?.extraFeatures??[];return[{icon:W,label:`${ln(e)} Machine`},{icon:ye,label:`${e.storage_gib} GB Storage`},{icon:ve,label:t},...n.map(e=>({icon:ge,label:e}))]}function dn(){return[{icon:W,label:`${cn} Machine`},{icon:ye,label:`4 GB Storage`},{icon:ve,label:`Pay as you go credits`}]}function fn(e,t=[]){let n=e?.credits_usd??0,r=e?.storage_gib??4,i=Se[e?.machine_size??`small`];return[`${ln(e)} machine${i?` (${i})`:``}`,on(r),e?.usage_label??sn(n),...t]}var pn={machine:`Configurable machine size`,storage:`Configurable storage`,credits:`Pay-as-you-go and bundled credits`};function mn(e,t){let n=[`${e.machineTier?U[e.machineTier]??t.machine_tiers.find(t=>t.tier===e.machineTier)?.label??e.machineTier:cn} Machine`];if(e.storageGib!=null&&n.push(`${e.storageGib} GB`),e.creditTier!=null){let r=$(t,e.creditTier)?.label,i=$e(e.creditTier);n.push(r??(i==null?`Credit bundle`:`${i} credits/mo`))}return n}function hn(e,t){let n=new Set([pn.machine]);return e.storageGib!=null&&n.add(pn.storage),e.creditTier!=null&&n.add(pn.credits),[...mn(e,t),...t.included_features.filter(e=>!n.has(e))]}function gn(e){return e.disabled===!0}function _n({machineTiers:e,storageTiers:t,selectedMachineTier:n,selectedStorageTier:r,onMachineTierChange:i,onStorageTierChange:a,currentMachinePriceCents:o,currentStoragePriceCents:s}){let{t:c}=z(`settings`),l=(0,G.useMemo)(()=>e.map(e=>{let t=U[e.tier]??e.label,n=o==null?c(`tierPicker.priceAddon`,{price:nn(e.price_cents)}):e.price_cents===o?c(`tierPicker.priceCurrent`,{price:nn(e.price_cents)}):an(e.price_cents-o);return{value:e.tier,label:c(`tierPicker.machineOption`,{label:t,priceLabel:n}),disabled:gn(e)}}),[e,o,c]),u=(0,G.useMemo)(()=>t.map(e=>{let t=s==null?c(`tierPicker.priceAddon`,{price:nn(e.price_cents)}):e.price_cents===s?c(`tierPicker.priceCurrent`,{price:nn(e.price_cents)}):an(e.price_cents-s);return{value:e.tier,label:c(`tierPicker.storageOption`,{gib:e.storage_gib,priceLabel:t}),disabled:gn(e)}}),[t,s,c]);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(E,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:c(`tierPicker.machineLabel`)}),(0,K.jsx)(`span`,{title:c(`tierPicker.machineTooltip`),children:(0,K.jsx)(_e,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,K.jsx)(f,{"aria-label":c(`tierPicker.machineAriaLabel`),placeholder:c(`tierPicker.machinePlaceholder`),value:n??``,onChange:i,options:l})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(E,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:c(`tierPicker.storageLabel`)}),(0,K.jsx)(`span`,{title:c(`tierPicker.storageTooltip`),children:(0,K.jsx)(_e,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,K.jsx)(f,{"aria-label":c(`tierPicker.storageAriaLabel`),placeholder:c(`tierPicker.storagePlaceholder`),value:r??``,onChange:a,options:u})]})]})}var vn=new Set([`active`,`trialing`,`past_due`]);function yn(e){return e.plan_id!==`base`&&e.cancel_at_period_end!==!0&&!e.cancel_at&&e.status!=null&&vn.has(e.status)}function bn(e){return e?.status!=null&&vn.has(e.status)}var xn=[`target_plan_id`,`confirm`,`machine_tier`,`storage_tier`,`credit_tier`,`package`,`non_field_errors`];function Sn(e,t){if(e&&typeof e==`object`){for(let t of xn)if(t in e){let n=e[t];if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}if(`detail`in e&&typeof e.detail==`string`)return e.detail}return t}function Cn(e,t){let n=e.filter(e=>!gn(e));return t!==null&&n.some(e=>e.tier===t)?t:n[0]?.tier??null}function wn(e,t,n){return t===void 0?n:t!==null&&(t===n||e.some(e=>e.tier===t))?t:null}function Tn(e){return e.length?Math.min(...e.map(e=>e.price_cents)):0}function En(){let e=L();return async t=>{try{let n=await t.mutateAsync();return await e.invalidateQueries({queryKey:p()}),t.onSuccess(n),n}catch(e){return N.error(Sn(e,t.errorFallback()),{id:t.errorToastId}),null}}}var Dn=`billing-portal-return-snapshot`;function On(e){try{sessionStorage.removeItem(Dn),sessionStorage.setItem(Dn,JSON.stringify(e))}catch{}}function kn(){if(typeof sessionStorage>`u`)return null;try{let e=sessionStorage.getItem(Dn);if(!e)return null;let t=JSON.parse(e);return typeof t.cancel_at_period_end!=`boolean`||typeof t.plan_id!=`string`?null:{cancel_at_period_end:t.cancel_at_period_end,cancel_at:t.cancel_at??null,plan_id:t.plan_id}}catch{return null}}function An(){try{sessionStorage.removeItem(Dn)}catch{}}function jn(e){return e?{cancel_at_period_end:e.cancel_at_period_end,cancel_at:e.cancel_at??null,plan_id:e.plan_id}:null}function Mn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function Nn(e){return e?e.cancel_at??e.current_period_end??null:null}function Pn(e){let t=L();return(0,G.useEffect)(()=>o(()=>{t.invalidateQueries(u())}),[t]),ee({onSuccess:t=>{e&&On(e),se(t.portal_url)},onError:()=>{N.error(R(`settings:useBillingPortalSession.openError`),{id:`billing-portal-session-error`})}})}function Fn(){let e=C(),t=En();return{cancelSubscription:n=>t({mutateAsync:()=>e.mutateAsync({body:n}),onSuccess:e=>{let t=e.cancel_at?Mn(e.cancel_at):R(`settings:useCancelSubscription.endOfBillingPeriod`);N.info(R(`settings:useCancelSubscription.canceledToast`,{date:t}),{id:`subscription-cancel`})},errorToastId:`subscription-cancel-error`,errorFallback:()=>R(`settings:useCancelSubscription.cancelFailedToast`)}),isPending:e.isPending}}function In(e){return Promise.all([e.invalidateQueries({queryKey:p()}),e.invalidateQueries({queryKey:i()}),e.invalidateQueries({queryKey:b()}),e.invalidateQueries({queryKey:oe()})])}function Ln({enabled:e=!0}={}){let t=L(),{t:n}=z(`settings`),[r,i]=(0,G.useState)(null),a=(0,G.useRef)(!1),[o,s]=(0,G.useState)(!1),c=ie(),l=e&&c,d=I({...u(),enabled:l}),f=d.data,p=f!=null&&f.plan_id!==`base`,m=I({...v(),enabled:l&&p}),h=I({...A(),enabled:l&&p}).data?.plans.find(e=>e.id===`pro`)?.machine_tiers??[],g=e=>h.find(t=>t.tier===e)?.price_cents??null,_=le(O()),y={machineTier:m.data?.max_machine_tier??null,storageTier:m.data?.selected_storage_tier??null,storageGib:m.data?.selected_storage_gib??null,creditTier:f?.selected_credit_tier??null,hasPlatformFee:f?.has_platform_fee??!0},b=f!=null&&f.plan_id!==`base`&&f.status!=null&&vn.has(f.status)&&f.cancel_at_period_end!==!0&&!f.cancel_at,x=!p||!m.isPending,S=!p||m.isSuccess&&m.data!=null&&!m.isFetching&&m.dataUpdatedAt>=d.dataUpdatedAt,C=o||_.isPending,w=async(e,t=y)=>{if(a.current)return null;a.current=!0,s(!0);try{return await ee(e,t)}finally{a.current=!1,s(!1)}},ee=async(e,r)=>{i(null);let a=e=>(i(e),N.error(e),null),[o,s]=await Promise.all([d.refetch(),m.refetch()]),c=o.data,l=s.data;if(o.isError||s.isError||c==null||l==null)return a(n(`customPlanModal.changeFailed`));let u={machineTier:l.max_machine_tier??null,storageTier:l.selected_storage_tier??null,storageGib:l.selected_storage_gib??null,creditTier:c.selected_credit_tier??null,hasPlatformFee:c.has_platform_fee??!0},f={machineTier:e.machineTier===r.machineTier?u.machineTier:e.machineTier,storageTier:e.storageTier===r.storageTier&&u.storageTier!=null?u.storageTier:e.storageTier,creditTier:e.creditTier===r.creditTier?u.creditTier:e.creditTier},p=f.machineTier!==u.machineTier,h=f.storageTier!==u.storageTier,v=f.creditTier!==u.creditTier,y=!u.hasPlatformFee,b=g(f.machineTier),x=g(u.machineTier),S=p&&b!=null&&x!=null&&b<x;if(!p&&!h&&!v&&!y)return{needsResize:!1,creditChanged:!1};let C;try{C=(await _.mutateAsync({body:{machine_tier:f.machineTier,storage_tier:f.storageTier,credit_tier:f.creditTier}})).status}catch(e){return a(Sn(e,n(`customPlanModal.changeFailed`)))}return await In(t),C===`no_op`?{needsResize:!1,creditChanged:!1}:{needsResize:h||p&&!S,creditChanged:v}};return{changeTiers:w,isPending:C,error:r,current:y,eligible:b,currentReady:x,currentKnown:S,primaryAssistantId:S?m.data?.primary_assistant_id??null:null}}function Rn(){let e=L(),{t}=z(`settings`),n=le(O());return{changePackage:async r=>{try{let t=await n.mutateAsync({body:{package:r}});return await In(e),t}catch(e){return N.error(Sn(e,t(`customPlanModal.changeFailed`))),null}},isPending:n.isPending}}function zn({className:e,"data-testid":t,children:n}){return(0,K.jsx)(`div`,{"aria-hidden":!0,"data-testid":t,className:T(`flex size-[52px] shrink-0 items-center justify-center rounded-xl`,e),children:n})}var Bn=32;function Vn(){let{ready:e,components:t,traits:r,customImageUrl:i}=l();return(0,K.jsx)(zn,{"data-testid":`assistant-avatar-tile`,className:`bg-[var(--surface-active)]`,children:e?(0,K.jsx)(n,{components:t,traits:r,customImageUrl:i,size:Bn}):null})}var Hn=`Billed monthly · prorated difference charged today`,Un=`Billed monthly · prorated difference charged today or credited next invoice`,Wn=`Billed monthly · prorated credit on your next invoice`,Gn=`Your machine downsizes now and your storage stays. No refund.`,Kn=`Continue`,qn=`The plan includes`,Jn=`Your plan will include`;function Yn(e,t,n){let r=n?$t(n)?.tagline??``:``;switch(e){case`downgrade`:return{title:en(t),subtitle:``,priceCaption:Wn,checklistHeading:Jn,note:Gn,confirmLabel:en(t),destructive:!0};case`switch`:return{title:`Switch to ${t}`,subtitle:r,priceCaption:Un,checklistHeading:qn,note:``,confirmLabel:Kn,destructive:!1};default:return{title:`Upgrade to ${t}`,subtitle:r,priceCaption:Hn,checklistHeading:qn,note:``,confirmLabel:Kn,destructive:!1}}}function Xn({open:e,relation:t,packageName:n,targetPackage:r,pending:i,onCancel:o,onConfirm:c}){let{t:l}=z(`settings`),u=(0,G.useRef)(null),d=(0,G.useId)(),f=Yn(t,n,r?.key??null),p=r?{price:nn(r.total_price_cents),highlights:fn(r,$t(r.key)?.extraFeatures??[])}:null,m=f.subtitle,h=f.note?{"aria-describedby":d}:m?{}:{"aria-describedby":void 0};return(0,K.jsx)(a.Root,{open:e,onOpenChange:e=>{!e&&!i&&o()},children:(0,K.jsxs)(a.Content,{size:`sm`,hideCloseButton:!0,className:`gap-4 p-4 max-w-[421px]`,onOpenAutoFocus:e=>{e.preventDefault(),u.current?.focus()},...h,children:[(0,K.jsxs)(a.Header,{className:`flex-row items-center gap-3 p-0 pb-2`,children:[f.destructive?(0,K.jsx)(zn,{"data-testid":`package-switch-warning-tile`,className:`bg-[var(--system-negative-weak)]`,children:(0,K.jsx)(fe,{className:`size-6 text-[var(--system-negative-strong)]`})}):(0,K.jsx)(Vn,{}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,K.jsx)(a.Title,{className:`text-title-small text-[var(--content-emphasised)] [&>span]:whitespace-normal`,children:f.title}),m?(0,K.jsx)(a.Description,{className:`mt-0 text-body-medium-default text-[var(--content-tertiary)]`,children:m}):null]})]}),p?(0,K.jsxs)(a.Body,{className:`flex flex-col gap-4 p-0`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsx)(E,{as:`p`,variant:`title-large`,className:`text-[var(--content-default)]`,children:p.price}),(0,K.jsx)(E,{as:`p`,variant:`label-medium-default`,className:`leading-[15px] text-[var(--content-tertiary)]`,children:f.priceCaption})]}),(0,K.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,K.jsx)(E,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,children:f.checklistHeading}),(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:p.highlights.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(be,{className:`size-4 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,K.jsx)(E,{as:`span`,variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]},e))})]}):null,f.note?(0,K.jsx)(E,{id:d,as:`p`,variant:`body-medium-default`,className:`text-[var(--content-secondary)]`,children:f.note}):null,(0,K.jsxs)(a.Footer,{className:`flex-col gap-4 p-0`,children:[(0,K.jsx)(s,{fullWidth:!0,variant:f.destructive?`danger`:`primary`,onClick:c,disabled:i,"data-testid":`confirm-package-switch-button`,children:f.confirmLabel}),(0,K.jsx)(s,{ref:u,fullWidth:!0,variant:`ghost`,onClick:o,disabled:i,children:l(`packageSwitchConfirmModal.cancel`)})]})]})})}function Zn(){let e=L();(0,G.useEffect)(()=>o(()=>{In(e)}),[e])}export{nn as A,Ht as B,hn as C,un as D,ln as E,Gt as F,Re as G,Bt as H,Ut as I,W as K,Yt as L,on as M,$t as N,an as O,Zt as P,Wt as R,gn as S,dn as T,Vt as U,zt as V,Ft as W,yn as _,In as a,Cn as b,An as c,kn as d,Pn as f,bn as g,Sn as h,Ln as i,rn as j,tn as k,Mn as l,vn as m,Xn as n,Fn as o,En as p,Rn as r,jn as s,Zn as t,Nn as u,Tn as v,mn as w,_n as x,wn as y,Jt as z};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ja as t,Xa as n,Za as r,to as i,zi as a}from"./app-CGffgaON.js";import{x as o}from"./react-BJ4PZBJN.js";var s=e(o(),1),c=.25;function l(e){e.style.transition=``,e.style.transform=``,e.style.willChange=``,e.style.opacity=``}function u({containerRef:e,onBack:o,enabled:u,navKey:d,prefetchHref:f}){let p=(0,s.useRef)(o);(0,s.useLayoutEffect)(()=>{p.current=o},[o]);let m=(0,s.useRef)(f);(0,s.useLayoutEffect)(()=>{m.current=f},[f]);let h=(0,s.useRef)(!1),g=(0,s.useRef)(new Set),_=(0,s.useRef)(!1),v=t.use.registerBackOwner(),y=t.use.unregisterBackOwner();(0,s.useEffect)(()=>{if(u)return v(),y},[u,v,y]),(0,s.useEffect)(()=>{_.current=!1;let t=g.current;return()=>{_.current=!0;for(let e of t)clearTimeout(e);t.clear();let n=e.current;n&&l(n)}},[e]);let b=(e,t)=>{let n=setTimeout(()=>{g.current.delete(n),_.current||e()},t);g.current.add(n)},x=(e,t)=>{e.style.transform=t===0?``:`translateX(${t}px)`},S=e=>{e.style.transition=`transform 200ms ${i}`,x(e,0);let t=()=>{e.removeEventListener(`transitionend`,t),l(e)};e.addEventListener(`transitionend`,t,{once:!0}),b(()=>l(e),250)},C=e=>{e.style.transition=`transform 150ms ${i}`,x(e,window.innerWidth);let t=!1,n=()=>{if(t||_.current)return;t=!0,e.removeEventListener(`transitionend`,n);let r=-(window.innerWidth*c);e.style.transition=`none`,e.style.transform=`translateX(${r}px)`,e.style.opacity=`0`,e.offsetWidth,h.current=!0,p.current(),b(()=>{h.current&&(h.current=!1,l(e))},400)};e.addEventListener(`transitionend`,n,{once:!0}),b(n,200)};r({enabled:u,onConfirm:()=>{a(m.current);let t=e.current;t&&(t.style.transition=`none`,t.style.willChange=`transform`)},onMove:(t,r)=>{let i=e.current;i&&x(i,n(t,r))},onCommit:()=>{let t=e.current;if(!t){p.current();return}C(t)},onCancel:t=>{let n=e.current;n&&(t?S(n):l(n))}}),(0,s.useLayoutEffect)(()=>{if(!h.current)return;h.current=!1;let t=e.current;if(!t)return;let n=!1,r=()=>{n||(n=!0,t.removeEventListener(`transitionend`,r),l(t))};t.style.transition=`transform 200ms ${i}, opacity 200ms ${i}`,t.style.transform=``,t.style.opacity=``,t.addEventListener(`transitionend`,r,{once:!0});let a=setTimeout(r,250);return()=>{clearTimeout(a),t.removeEventListener(`transitionend`,r),l(t)}},[d,e])}export{u as t};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ja as t,Xa as n,Za as r,to as i,zi as a}from"./app-BNxKtvfM.js";import{x as o}from"./react-BJ4PZBJN.js";var s=e(o(),1),c=.25;function l(e){e.style.transition=``,e.style.transform=``,e.style.willChange=``,e.style.opacity=``}function u({containerRef:e,onBack:o,enabled:u,navKey:d,prefetchHref:f}){let p=(0,s.useRef)(o);(0,s.useLayoutEffect)(()=>{p.current=o},[o]);let m=(0,s.useRef)(f);(0,s.useLayoutEffect)(()=>{m.current=f},[f]);let h=(0,s.useRef)(!1),g=(0,s.useRef)(new Set),_=(0,s.useRef)(!1),v=t.use.registerBackOwner(),y=t.use.unregisterBackOwner();(0,s.useEffect)(()=>{if(u)return v(),y},[u,v,y]),(0,s.useEffect)(()=>{_.current=!1;let t=g.current;return()=>{_.current=!0;for(let e of t)clearTimeout(e);t.clear();let n=e.current;n&&l(n)}},[e]);let b=(e,t)=>{let n=setTimeout(()=>{g.current.delete(n),_.current||e()},t);g.current.add(n)},x=(e,t)=>{e.style.transform=t===0?``:`translateX(${t}px)`},S=e=>{e.style.transition=`transform 200ms ${i}`,x(e,0);let t=()=>{e.removeEventListener(`transitionend`,t),l(e)};e.addEventListener(`transitionend`,t,{once:!0}),b(()=>l(e),250)},C=e=>{e.style.transition=`transform 150ms ${i}`,x(e,window.innerWidth);let t=!1,n=()=>{if(t||_.current)return;t=!0,e.removeEventListener(`transitionend`,n);let r=-(window.innerWidth*c);e.style.transition=`none`,e.style.transform=`translateX(${r}px)`,e.style.opacity=`0`,e.offsetWidth,h.current=!0,p.current(),b(()=>{h.current&&(h.current=!1,l(e))},400)};e.addEventListener(`transitionend`,n,{once:!0}),b(n,200)};r({enabled:u,onConfirm:()=>{a(m.current);let t=e.current;t&&(t.style.transition=`none`,t.style.willChange=`transform`)},onMove:(t,r)=>{let i=e.current;i&&x(i,n(t,r))},onCommit:()=>{let t=e.current;if(!t){p.current();return}C(t)},onCancel:t=>{let n=e.current;n&&(t?S(n):l(n))}}),(0,s.useLayoutEffect)(()=>{if(!h.current)return;h.current=!1;let t=e.current;if(!t)return;let n=!1,r=()=>{n||(n=!0,t.removeEventListener(`transitionend`,r),l(t))};t.style.transition=`transform 200ms ${i}, opacity 200ms ${i}`,t.style.transform=``,t.style.opacity=``,t.addEventListener(`transitionend`,r,{once:!0});let a=setTimeout(r,250);return()=>{clearTimeout(a),t.removeEventListener(`transitionend`,r),l(t)}},[d,e])}export{u as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{ba as t,vg as n,xa as r,ya as i}from"./app-CGffgaON.js";import{x as a}from"./react-BJ4PZBJN.js";var o=e(a(),1),s={ArrowUp:`Up`,ArrowDown:`Down`,ArrowLeft:`Left`,ArrowRight:`Right`,Enter:`Return`,NumpadEnter:`Return`,Space:`Space`,Tab:`Tab`,Escape:`Escape`,Backspace:`Backspace`,Delete:`Delete`,Insert:`Insert`,Home:`Home`,End:`End`,PageUp:`PageUp`,PageDown:`PageDown`,Minus:`-`,Equal:`=`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Semicolon:`;`,Quote:`'`,Backquote:"`",Comma:`,`,Period:`.`,Slash:`/`},c=new Set([`MetaLeft`,`MetaRight`,`ControlLeft`,`ControlRight`,`AltLeft`,`AltRight`,`ShiftLeft`,`ShiftRight`]),l=e=>{let t=e.code;return c.has(t)?null:/^Key[A-Z]$/.test(t)?t.slice(3):/^Digit[0-9]$/.test(t)?t.slice(5):/^Numpad[0-9]$/.test(t)?`num${t.slice(6)}`:/^F[0-9]{1,2}$/.test(t)?t:s[t]??null},u=(e,t=`macos`)=>{let n=l(e);if(n===null)return null;let r=[];return t===`windows`||t===`linux`?(e.ctrlKey&&r.push(`CmdOrCtrl`),e.metaKey&&r.push(`Super`)):(e.metaKey&&r.push(`CmdOrCtrl`),e.ctrlKey&&r.push(`Control`)),e.altKey&&r.push(`Alt`),e.shiftKey&&r.push(`Shift`),[...r,n].join(`+`)},d={macos:new Set([`Command`,`Cmd`,`CommandOrControl`]),windows:new Set([`Control`,`Ctrl`,`CommandOrControl`]),linux:new Set([`Control`,`Ctrl`,`CommandOrControl`])},f=(e,t=`macos`)=>{let n=d[t],r=e.split(`+`).map(e=>n.has(e)?`CmdOrCtrl`:e),i=r.pop()??``;return[...new Set(r)].sort().concat(i).join(`+`)},p=(e,t,n,r=`macos`)=>{if(n===``)return null;let i=f(n,r);return e.find(e=>e.key!==t&&e.accelerator!==``&&f(e.accelerator,r)===i)??null};function m(e){let a=e?.onBound,[s,c]=(0,o.useState)([]),[l,d]=(0,o.useState)(null),[f,m]=(0,o.useState)(null),h=(0,o.useCallback)(()=>{i().then(c)},[]);(0,o.useEffect)(()=>(h(),t(c)),[h]);let g=(0,o.useCallback)(()=>{d(null),m(null)},[]);return(0,o.useEffect)(()=>{if(l===null)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.code===`Escape`){g();return}let t=n()??`macos`,i=u(e,t);if(i===null)return;let o=p(s,l,i,t);if(o!==null){m({key:l,label:o.label});return}r(l,i).then(()=>{a?.(l),h()}).catch(()=>{h()}),g()};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[l,s,a,h,g]),{catalog:s,recordingKey:l,conflict:f,startRecording:(0,o.useCallback)(e=>{m(null),d(e)},[]),stopRecording:g,resetHotkey:(0,o.useCallback)(e=>{let t=p(s,e,s.find(t=>t.key===e)?.defaultAccelerator??``,n()??`macos`);if(t!==null){d(null),m({key:e,label:t.label});return}g(),r(e,null).then(h)},[s,h,g]),removeHotkey:(0,o.useCallback)(e=>{g(),r(e,``).then(h)},[h,g])}}export{m as t};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{ba as t,vg as n,xa as r,ya as i}from"./app-BNxKtvfM.js";import{x as a}from"./react-BJ4PZBJN.js";var o=e(a(),1),s={ArrowUp:`Up`,ArrowDown:`Down`,ArrowLeft:`Left`,ArrowRight:`Right`,Enter:`Return`,NumpadEnter:`Return`,Space:`Space`,Tab:`Tab`,Escape:`Escape`,Backspace:`Backspace`,Delete:`Delete`,Insert:`Insert`,Home:`Home`,End:`End`,PageUp:`PageUp`,PageDown:`PageDown`,Minus:`-`,Equal:`=`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Semicolon:`;`,Quote:`'`,Backquote:"`",Comma:`,`,Period:`.`,Slash:`/`},c=new Set([`MetaLeft`,`MetaRight`,`ControlLeft`,`ControlRight`,`AltLeft`,`AltRight`,`ShiftLeft`,`ShiftRight`]),l=e=>{let t=e.code;return c.has(t)?null:/^Key[A-Z]$/.test(t)?t.slice(3):/^Digit[0-9]$/.test(t)?t.slice(5):/^Numpad[0-9]$/.test(t)?`num${t.slice(6)}`:/^F[0-9]{1,2}$/.test(t)?t:s[t]??null},u=(e,t=`macos`)=>{let n=l(e);if(n===null)return null;let r=[];return t===`windows`||t===`linux`?(e.ctrlKey&&r.push(`CmdOrCtrl`),e.metaKey&&r.push(`Super`)):(e.metaKey&&r.push(`CmdOrCtrl`),e.ctrlKey&&r.push(`Control`)),e.altKey&&r.push(`Alt`),e.shiftKey&&r.push(`Shift`),[...r,n].join(`+`)},d={macos:new Set([`Command`,`Cmd`,`CommandOrControl`]),windows:new Set([`Control`,`Ctrl`,`CommandOrControl`]),linux:new Set([`Control`,`Ctrl`,`CommandOrControl`])},f=(e,t=`macos`)=>{let n=d[t],r=e.split(`+`).map(e=>n.has(e)?`CmdOrCtrl`:e),i=r.pop()??``;return[...new Set(r)].sort().concat(i).join(`+`)},p=(e,t,n,r=`macos`)=>{if(n===``)return null;let i=f(n,r);return e.find(e=>e.key!==t&&e.accelerator!==``&&f(e.accelerator,r)===i)??null};function m(e){let a=e?.onBound,[s,c]=(0,o.useState)([]),[l,d]=(0,o.useState)(null),[f,m]=(0,o.useState)(null),h=(0,o.useCallback)(()=>{i().then(c)},[]);(0,o.useEffect)(()=>(h(),t(c)),[h]);let g=(0,o.useCallback)(()=>{d(null),m(null)},[]);return(0,o.useEffect)(()=>{if(l===null)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.code===`Escape`){g();return}let t=n()??`macos`,i=u(e,t);if(i===null)return;let o=p(s,l,i,t);if(o!==null){m({key:l,label:o.label});return}r(l,i).then(()=>{a?.(l),h()}).catch(()=>{h()}),g()};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[l,s,a,h,g]),{catalog:s,recordingKey:l,conflict:f,startRecording:(0,o.useCallback)(e=>{m(null),d(e)},[]),stopRecording:g,resetHotkey:(0,o.useCallback)(e=>{let t=p(s,e,s.find(t=>t.key===e)?.defaultAccelerator??``,n()??`macos`);if(t!==null){d(null),m({key:e,label:t.label});return}g(),r(e,null).then(h)},[s,h,g]),removeHotkey:(0,o.useCallback)(e=>{g(),r(e,``).then(h)},[h,g])}}export{m as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{BS as t,CC as n,Ep as r,Hp as i,Ny as a,QS as o,Qa as s,Ya as c,fC as l}from"./app-CGffgaON.js";import{t as u,x as d}from"./react-BJ4PZBJN.js";import{Jn as f,er as p,w as m}from"./vendor-CezcraPH.js";import{Fn as h,Ji as g,Yn as _,i as v,li as y,tr as b}from"./icons-Dwi7aA1Y.js";import{t as x}from"./a2a-invite-S74k5mzP.js";var S=e(d(),1),C=u(),w=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function T({open:e,onClose:t,children:r,title:i}){let{t:a}=m(),o=(0,S.useRef)(null),l=(0,S.useRef)(null),u=(0,S.useRef)(t);(0,S.useEffect)(()=>{u.current=t});let{dragOffset:d,isDragging:f,onTouchStart:p,onTouchMove:h,onTouchEnd:g,onTouchCancel:_}=c({enabled:e,onSwipeLeft:t});return s(e),(0,S.useEffect)(()=>{if(!e)return;l.current?.focus();let t=e=>{if(e.key===`Escape`&&!e.defaultPrevented){e.preventDefault(),u.current();return}if(e.key!==`Tab`||!o.current)return;let t=o.current.querySelectorAll(w),n=t[0],r=t[t.length-1];if(!n||!r){e.preventDefault();return}let i=document.activeElement,a=o.current.contains(i);e.shiftKey?(!a||i===n)&&(e.preventDefault(),r.focus()):(!a||i===r)&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e]),e?(0,C.jsxs)(`div`,{ref:o,className:`fixed inset-0`,style:{zIndex:40},role:`dialog`,"aria-modal":`true`,"aria-label":i,children:[(0,C.jsx)(`button`,{type:`button`,"aria-label":a(`sideListDrawer.closeSidebarAria`),className:`absolute inset-0 h-full w-full cursor-default`,style:{background:`rgba(0, 0, 0, 0.4)`,zIndex:40},onClick:t}),(0,C.jsxs)(`aside`,{className:`relative flex h-full w-[80vw] max-w-xs flex-col shadow-xl`,style:{background:`var(--surface-lift)`,borderRight:`1px solid var(--border-base)`,zIndex:50,paddingTop:`var(--safe-area-inset-top, env(safe-area-inset-top, 0px))`,paddingBottom:`var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))`,paddingLeft:`var(--safe-area-inset-left, env(safe-area-inset-left, 0px))`,transform:`translateX(${d}px)`,transition:f?`none`:`transform 200ms ease-out`,touchAction:`pan-y`},onTouchStart:p,onTouchMove:h,onTouchEnd:g,onTouchCancel:_,children:[(0,C.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b px-4 py-3`,style:{borderColor:`var(--border-base)`},children:[(0,C.jsx)(`span`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:i}),(0,C.jsx)(n,{ref:l,type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,C.jsx)(v,{"aria-hidden":!0}),onClick:t,"aria-label":a(`sideListDrawer.closeAria`),tintColor:`var(--content-tertiary)`})]}),(0,C.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:r})]})]}):null}function E({onClick:e}){let{t}=m();return(0,C.jsx)(n,{type:`button`,variant:`ghost`,iconOnly:(0,C.jsx)(h,{"aria-hidden":!0}),onClick:e,"aria-label":t(`sideListDrawer.openSidebarAria`),tintColor:`var(--content-secondary)`})}function D(e){let t=e-Date.now();if(t<=0)return`Expired`;let n=Math.ceil(t/(1e3*60*60*24));return n===1?`Expires in 1 day`:`Expires in ${n} days`}function O({open:e,assistantId:r,onClose:s}){let{t:c}=m(),{copy:u,copied:d,reset:p}=a({errorMessage:`Couldn't copy the invite link.`}),h=(0,S.useRef)(!1),v=f({...i({path:{assistant_id:r}})}),b=(0,S.useRef)(v.mutate);(0,S.useLayoutEffect)(()=>{b.current=v.mutate});let w=(0,S.useRef)(v.reset);(0,S.useLayoutEffect)(()=>{w.current=v.reset}),(0,S.useEffect)(()=>{e&&!h.current&&b.current({path:{assistant_id:r}}),h.current=e},[e,r]);let T=(0,S.useCallback)(()=>{w.current(),p(),s()},[s,p]),E=v.isSuccess&&v.data.token?x({senderAssistantId:r,token:v.data.token}):``;return(0,C.jsx)(t.Root,{open:e,onOpenChange:e=>{e||T()},children:(0,C.jsxs)(t.Content,{size:`sm`,children:[(0,C.jsx)(t.Header,{children:(0,C.jsx)(t.Title,{children:c(`generateInviteLinkDialog.title`)})}),(0,C.jsx)(t.Body,{children:v.isPending?(0,C.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[(0,C.jsx)(_,{className:`h-4 w-4 animate-spin`}),c(`generateInviteLinkDialog.creating`)]}):v.isError?(0,C.jsxs)(`div`,{className:`space-y-3`,children:[(0,C.jsx)(`p`,{role:`alert`,className:`!m-0 text-body-medium-lighter`,style:{color:`var(--system-negative-strong)`},children:c(`generateInviteLinkDialog.createFailed`)}),(0,C.jsx)(n,{variant:`outlined`,onClick:()=>v.mutate({path:{assistant_id:r}}),children:c(`generateInviteLinkDialog.tryAgain`)})]}):v.isSuccess?(0,C.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,C.jsx)(l,{variant:`body-medium-lighter`,style:{color:`var(--content-secondary)`},children:c(`generateInviteLinkDialog.shareHint`)}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(o,{type:`text`,readOnly:!0,value:E,fullWidth:!0,wrapperClassName:`flex-1`,className:`font-mono`,onFocus:e=>e.currentTarget.select()}),(0,C.jsx)(n,{variant:`outlined`,iconOnly:d?(0,C.jsx)(g,{}):(0,C.jsx)(y,{}),iconOnlyGlyphClassName:`[&_svg]:size-4`,expandOnMobile:!1,onClick:()=>u(E),"aria-label":c(`generateInviteLinkDialog.copyAriaLabel`),className:`h-9 w-9 shrink-0`})]}),v.data.expiresAt!=null&&(0,C.jsx)(l,{variant:`body-small-default`,style:{color:`var(--content-tertiary)`},children:D(v.data.expiresAt)})]}):null}),(0,C.jsx)(t.Footer,{children:(0,C.jsx)(n,{variant:`outlined`,onClick:T,children:c(`generateInviteLinkDialog.done`)})})]})})}function k({onClick:e}){let{t}=m();return(0,C.jsx)(n,{variant:`outlined`,size:`compact`,leftIcon:(0,C.jsx)(b,{className:`h-3.5 w-3.5`}),onClick:e,children:t(`shareConnectionLinkButton.label`)})}function A(e){let t=p(),[n,i]=(0,S.useState)(!1);return{isOpen:n,open:(0,S.useCallback)(()=>{i(!0)},[]),close:(0,S.useCallback)(()=>{i(!1),t.invalidateQueries({queryKey:r({path:{assistant_id:e}})})},[t,e])}}export{E as a,T as i,k as n,O as r,A as t};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{BS as t,CC as n,Ep as r,Hp as i,Ny as a,QS as o,Qa as s,Ya as c,fC as l}from"./app-BNxKtvfM.js";import{t as u,x as d}from"./react-BJ4PZBJN.js";import{Jn as f,er as p,w as m}from"./vendor-CezcraPH.js";import{Fn as h,Ji as g,Yn as _,i as v,li as y,tr as b}from"./icons-Dwi7aA1Y.js";import{t as x}from"./a2a-invite-QwLkdzoC.js";var S=e(d(),1),C=u(),w=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function T({open:e,onClose:t,children:r,title:i}){let{t:a}=m(),o=(0,S.useRef)(null),l=(0,S.useRef)(null),u=(0,S.useRef)(t);(0,S.useEffect)(()=>{u.current=t});let{dragOffset:d,isDragging:f,onTouchStart:p,onTouchMove:h,onTouchEnd:g,onTouchCancel:_}=c({enabled:e,onSwipeLeft:t});return s(e),(0,S.useEffect)(()=>{if(!e)return;l.current?.focus();let t=e=>{if(e.key===`Escape`&&!e.defaultPrevented){e.preventDefault(),u.current();return}if(e.key!==`Tab`||!o.current)return;let t=o.current.querySelectorAll(w),n=t[0],r=t[t.length-1];if(!n||!r){e.preventDefault();return}let i=document.activeElement,a=o.current.contains(i);e.shiftKey?(!a||i===n)&&(e.preventDefault(),r.focus()):(!a||i===r)&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e]),e?(0,C.jsxs)(`div`,{ref:o,className:`fixed inset-0`,style:{zIndex:40},role:`dialog`,"aria-modal":`true`,"aria-label":i,children:[(0,C.jsx)(`button`,{type:`button`,"aria-label":a(`sideListDrawer.closeSidebarAria`),className:`absolute inset-0 h-full w-full cursor-default`,style:{background:`rgba(0, 0, 0, 0.4)`,zIndex:40},onClick:t}),(0,C.jsxs)(`aside`,{className:`relative flex h-full w-[80vw] max-w-xs flex-col shadow-xl`,style:{background:`var(--surface-lift)`,borderRight:`1px solid var(--border-base)`,zIndex:50,paddingTop:`var(--safe-area-inset-top, env(safe-area-inset-top, 0px))`,paddingBottom:`var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))`,paddingLeft:`var(--safe-area-inset-left, env(safe-area-inset-left, 0px))`,transform:`translateX(${d}px)`,transition:f?`none`:`transform 200ms ease-out`,touchAction:`pan-y`},onTouchStart:p,onTouchMove:h,onTouchEnd:g,onTouchCancel:_,children:[(0,C.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b px-4 py-3`,style:{borderColor:`var(--border-base)`},children:[(0,C.jsx)(`span`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:i}),(0,C.jsx)(n,{ref:l,type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,C.jsx)(v,{"aria-hidden":!0}),onClick:t,"aria-label":a(`sideListDrawer.closeAria`),tintColor:`var(--content-tertiary)`})]}),(0,C.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:r})]})]}):null}function E({onClick:e}){let{t}=m();return(0,C.jsx)(n,{type:`button`,variant:`ghost`,iconOnly:(0,C.jsx)(h,{"aria-hidden":!0}),onClick:e,"aria-label":t(`sideListDrawer.openSidebarAria`),tintColor:`var(--content-secondary)`})}function D(e){let t=e-Date.now();if(t<=0)return`Expired`;let n=Math.ceil(t/(1e3*60*60*24));return n===1?`Expires in 1 day`:`Expires in ${n} days`}function O({open:e,assistantId:r,onClose:s}){let{t:c}=m(),{copy:u,copied:d,reset:p}=a({errorMessage:`Couldn't copy the invite link.`}),h=(0,S.useRef)(!1),v=f({...i({path:{assistant_id:r}})}),b=(0,S.useRef)(v.mutate);(0,S.useLayoutEffect)(()=>{b.current=v.mutate});let w=(0,S.useRef)(v.reset);(0,S.useLayoutEffect)(()=>{w.current=v.reset}),(0,S.useEffect)(()=>{e&&!h.current&&b.current({path:{assistant_id:r}}),h.current=e},[e,r]);let T=(0,S.useCallback)(()=>{w.current(),p(),s()},[s,p]),E=v.isSuccess&&v.data.token?x({senderAssistantId:r,token:v.data.token}):``;return(0,C.jsx)(t.Root,{open:e,onOpenChange:e=>{e||T()},children:(0,C.jsxs)(t.Content,{size:`sm`,children:[(0,C.jsx)(t.Header,{children:(0,C.jsx)(t.Title,{children:c(`generateInviteLinkDialog.title`)})}),(0,C.jsx)(t.Body,{children:v.isPending?(0,C.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[(0,C.jsx)(_,{className:`h-4 w-4 animate-spin`}),c(`generateInviteLinkDialog.creating`)]}):v.isError?(0,C.jsxs)(`div`,{className:`space-y-3`,children:[(0,C.jsx)(`p`,{role:`alert`,className:`!m-0 text-body-medium-lighter`,style:{color:`var(--system-negative-strong)`},children:c(`generateInviteLinkDialog.createFailed`)}),(0,C.jsx)(n,{variant:`outlined`,onClick:()=>v.mutate({path:{assistant_id:r}}),children:c(`generateInviteLinkDialog.tryAgain`)})]}):v.isSuccess?(0,C.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,C.jsx)(l,{variant:`body-medium-lighter`,style:{color:`var(--content-secondary)`},children:c(`generateInviteLinkDialog.shareHint`)}),(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(o,{type:`text`,readOnly:!0,value:E,fullWidth:!0,wrapperClassName:`flex-1`,className:`font-mono`,onFocus:e=>e.currentTarget.select()}),(0,C.jsx)(n,{variant:`outlined`,iconOnly:d?(0,C.jsx)(g,{}):(0,C.jsx)(y,{}),iconOnlyGlyphClassName:`[&_svg]:size-4`,expandOnMobile:!1,onClick:()=>u(E),"aria-label":c(`generateInviteLinkDialog.copyAriaLabel`),className:`h-9 w-9 shrink-0`})]}),v.data.expiresAt!=null&&(0,C.jsx)(l,{variant:`body-small-default`,style:{color:`var(--content-tertiary)`},children:D(v.data.expiresAt)})]}):null}),(0,C.jsx)(t.Footer,{children:(0,C.jsx)(n,{variant:`outlined`,onClick:T,children:c(`generateInviteLinkDialog.done`)})})]})})}function k({onClick:e}){let{t}=m();return(0,C.jsx)(n,{variant:`outlined`,size:`compact`,leftIcon:(0,C.jsx)(b,{className:`h-3.5 w-3.5`}),onClick:e,children:t(`shareConnectionLinkButton.label`)})}function A(e){let t=p(),[n,i]=(0,S.useState)(!1);return{isOpen:n,open:(0,S.useCallback)(()=>{i(!0)},[]),close:(0,S.useCallback)(()=>{i(!1),t.invalidateQueries({queryKey:r({path:{assistant_id:e}})})},[t,e])}}export{E as a,T as i,k as n,O as r,A as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Fg as t,Jc as n,Jm as r,Km as i,Zn as a,Zo as o,cy as s,om as c,sm as l,sy as u,zS as d}from"./app-CGffgaON.js";import{t as f,x as p}from"./react-BJ4PZBJN.js";import{Zn as m,er as h,k as g,w as _}from"./vendor-CezcraPH.js";var v=e(p(),1),y=f(),b={sm:`h-7 w-7`,md:`h-8 w-8 text-3xl`};function x({external:e=!1,icon:t,iconUrl:n,iconSrc:r,size:i=`sm`,className:a}){let[s,c]=(0,v.useState)(!1),l=r??n;(0,v.useEffect)(()=>{c(!1)},[l]);let u=t||(e?`📦`:`🧩`),d=!!l&&!s;return(0,y.jsx)(`span`,{className:o(`flex shrink-0 items-center justify-center`,b[i],a),children:d?(0,y.jsx)(`img`,{src:l,alt:``,"aria-hidden":!0,loading:`lazy`,className:`h-full w-full object-contain`,onError:()=>c(!0)}):u})}function S(e){return e!==void 0&&e.startsWith(`https://`)}function C(e,t){let n=e.map(e=>({name:e.name,description:e.description??void 0,status:`installed`,external:void 0,version:e.version??void 0,path:e.path,issues:e.issues,enabled:e.enabled,icon:e.icon,hasIcon:e.hasIcon,iconVersion:e.iconVersion})),r=new Set(n.map(e=>e.name)),i=t.filter(e=>!r.has(e.name)).map(e=>({name:e.name,description:e.description,status:`available`,external:!0,path:e.path,...S(e.icon)?{iconUrl:e.icon}:{icon:e.icon}}));return[...n,...i]}function w(e,t){let n=t.trim().toLowerCase();return n?[e.name,e.description].some(e=>e?.toLowerCase().includes(n)):!0}function T(e){return[...e].sort((e,t)=>{let n=e.status===`installed`;return n===(t.status===`installed`)?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1})}function E(e,t){switch(t){case`all`:return e;case`available`:return e.filter(e=>e.status===`available`);case`installed`:return e.filter(e=>e.status===`installed`);case`active`:return e.filter(e=>e.status===`installed`&&e.enabled!==!1);case`off`:return e.filter(e=>e.status===`installed`&&e.enabled===!1)}}function D(e){return e?e.slice(0,7):`unknown`}var O=`plugin.uninstall.mcp_oauth_credentials_unchecked`;function k(e,t){for(let n of e??[])d.warning(t(n===O?`pluginToast.mcpOAuthCredentialsUnchecked`:`pluginToast.cleanupWarning`))}function A(e,t){let{t:r}=_(`intelligence`),a=h(),o=i({onSuccess:(i,o)=>{let s=o.path.name;n(a,e,s),t?.onRemoved?.(s),t?.announceWarnings!==!1&&k(i?.warnings,r)},onError:(e,n)=>{t?.onRemoveError?.(n.path.name,e)}}),s=o.mutate;return{remove:(0,v.useCallback)(t=>{s({path:{assistant_id:e,name:t}})},[e,s]),isRemoving:o.isPending,isRemoveError:o.isError}}function j(e,t,i){let{t:a}=_(`intelligence`),o=h(),s=r({onSuccess:()=>{n(o,e,t),i?.onInstalled?.(),i?.announceInstall!==!1&&d.success(a(`pluginToast.installed`,{name:t||a(`pluginToast.pluginFallback`)}))}}),c=A(e,{onRemoved:()=>i?.onRemoved?.()});return{install:()=>{s.mutate({path:{assistant_id:e},body:{name:t}})},installAsync:()=>s.mutateAsync({path:{assistant_id:e},body:{name:t}}),remove:()=>{c.remove(t)},isInstalling:s.isPending,isRemoving:c.isRemoving,isInstallError:s.isError,isRemoveError:c.isRemoveError}}var M=`0.10.5`;function N(){return t(M)}function P(e,t,n,r){let i=N(),{data:a}=m({queryKey:[`pluginIcon`,e,t,r],queryFn:async()=>{let{data:n,error:r}=await u({path:{assistant_id:e,name:t},parseAs:`blob`,throwOnError:!1});if(r||!(n instanceof Blob))throw Error(`Failed to load plugin icon`);return n},enabled:!!(i&&n&&r),staleTime:1/0,retry:!1}),[o,s]=(0,v.useState)(void 0);return(0,v.useEffect)(()=>{if(!a){s(void 0);return}let e=URL.createObjectURL(a);return s(e),()=>{URL.revokeObjectURL(e)}},[a]),o}var F=300*1e3,I=[],L=[],R=`system`;async function z(e,t,n){let r=await s({path:{assistant_id:e},query:{q:void 0,category:t},signal:n,throwOnError:!1});if(r.response?.status===404)return{plugins:[]};if(!r.response?.ok)throw Error(g(`usePluginsList.failureMessage`,{ns:`intelligence`}));return r.data??{plugins:[]}}function B(e,t){let[n,r]=(0,v.useState)({assistantId:e,latched:!1}),i=n.assistantId===e?n.latched:!1;return n.assistantId!==e&&r({assistantId:e,latched:!1}),(0,v.useEffect)(()=>{t&&r(t=>t.assistantId===e&&t.latched?t:{assistantId:e,latched:!0})},[e,t]),i||t}function V(e,t=null,n=!0){let r=t??void 0,i=m({queryKey:c({path:{assistant_id:e},query:{q:void 0,category:r}}),queryFn:({signal:t})=>z(e,r,t),enabled:!!e&&n,staleTime:F}),o=m({...a(e),enabled:!!e&&n&&t!==null}),s=m({...l({path:{assistant_id:e},query:{q:void 0}}),enabled:!!e&&n,staleTime:F}),u=(0,v.useMemo)(()=>{let e=t===null?i.data?.plugins:o.data?.plugins??i.data?.plugins;return new Set((e??I).map(e=>e.name))},[t,o.data?.plugins,i.data?.plugins]),d=(0,v.useMemo)(()=>{let e=i.data?.plugins??I,n=s.data?.matches??L;return T(C(e,(t===null?n:n.filter(e=>(e.category??`system`)===t)).filter(e=>!u.has(e.name))))},[i.data?.plugins,s.data?.matches,t,u]),f=t===null?i.data:o.data,p=B(e,f?.categoryCounts!==void 0),g=B(e,(f?.plugins??I).some(e=>e.enabled!==void 0)),_=h(),y=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(y.current===e||!s.isSuccess)return;let t=f?.plugins;if(!t?.length)return;let n=new Map((s.data?.matches??L).map(e=>[e.name,e.category]));t.some(e=>{let t=n.get(e.name);return t!=null&&t!==`system`&&(e.category??`system`)===`system`})&&(y.current=e,_.invalidateQueries({queryKey:c({path:{assistant_id:e},query:{q:void 0}})}))},[e,s.isSuccess,s.data?.matches,f?.plugins,_]),{items:d,isLoading:i.isLoading,catalogLoading:s.isLoading,isError:i.isError,installedLoaded:i.data!==void 0,isFetching:i.isFetching||s.isFetching,catalogError:s.isError,categorySupported:p,pluginToggleSupported:g,installedCategoryCounts:f?.categoryCounts,installedPlugins:f?.plugins??I,installedTotal:f?.totalCount,catalogMatches:s.data?.matches??L,unfilteredInstalledNames:u}}export{A as a,w as c,j as i,D as l,V as n,k as o,P as r,E as s,R as t,x as u};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Fg as t,Jc as n,Jm as r,Km as i,Zn as a,Zo as o,cy as s,om as c,sm as l,sy as u,zS as d}from"./app-BNxKtvfM.js";import{t as f,x as p}from"./react-BJ4PZBJN.js";import{Zn as m,er as h,k as g,w as _}from"./vendor-CezcraPH.js";var v=e(p(),1),y=f(),b={sm:`h-7 w-7`,md:`h-8 w-8 text-3xl`};function x({external:e=!1,icon:t,iconUrl:n,iconSrc:r,size:i=`sm`,className:a}){let[s,c]=(0,v.useState)(!1),l=r??n;(0,v.useEffect)(()=>{c(!1)},[l]);let u=t||(e?`📦`:`🧩`),d=!!l&&!s;return(0,y.jsx)(`span`,{className:o(`flex shrink-0 items-center justify-center`,b[i],a),children:d?(0,y.jsx)(`img`,{src:l,alt:``,"aria-hidden":!0,loading:`lazy`,className:`h-full w-full object-contain`,onError:()=>c(!0)}):u})}function S(e){return e!==void 0&&e.startsWith(`https://`)}function C(e,t){let n=e.map(e=>({name:e.name,description:e.description??void 0,status:`installed`,external:void 0,version:e.version??void 0,path:e.path,issues:e.issues,enabled:e.enabled,icon:e.icon,hasIcon:e.hasIcon,iconVersion:e.iconVersion})),r=new Set(n.map(e=>e.name)),i=t.filter(e=>!r.has(e.name)).map(e=>({name:e.name,description:e.description,status:`available`,external:!0,path:e.path,...S(e.icon)?{iconUrl:e.icon}:{icon:e.icon}}));return[...n,...i]}function w(e,t){let n=t.trim().toLowerCase();return n?[e.name,e.description].some(e=>e?.toLowerCase().includes(n)):!0}function T(e){return[...e].sort((e,t)=>{let n=e.status===`installed`;return n===(t.status===`installed`)?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1})}function E(e,t){switch(t){case`all`:return e;case`available`:return e.filter(e=>e.status===`available`);case`installed`:return e.filter(e=>e.status===`installed`);case`active`:return e.filter(e=>e.status===`installed`&&e.enabled!==!1);case`off`:return e.filter(e=>e.status===`installed`&&e.enabled===!1)}}function D(e){return e?e.slice(0,7):`unknown`}var O=`plugin.uninstall.mcp_oauth_credentials_unchecked`;function k(e,t){for(let n of e??[])d.warning(t(n===O?`pluginToast.mcpOAuthCredentialsUnchecked`:`pluginToast.cleanupWarning`))}function A(e,t){let{t:r}=_(`intelligence`),a=h(),o=i({onSuccess:(i,o)=>{let s=o.path.name;n(a,e,s),t?.onRemoved?.(s),t?.announceWarnings!==!1&&k(i?.warnings,r)},onError:(e,n)=>{t?.onRemoveError?.(n.path.name,e)}}),s=o.mutate;return{remove:(0,v.useCallback)(t=>{s({path:{assistant_id:e,name:t}})},[e,s]),isRemoving:o.isPending,isRemoveError:o.isError}}function j(e,t,i){let{t:a}=_(`intelligence`),o=h(),s=r({onSuccess:()=>{n(o,e,t),i?.onInstalled?.(),i?.announceInstall!==!1&&d.success(a(`pluginToast.installed`,{name:t||a(`pluginToast.pluginFallback`)}))}}),c=A(e,{onRemoved:()=>i?.onRemoved?.()});return{install:()=>{s.mutate({path:{assistant_id:e},body:{name:t}})},installAsync:()=>s.mutateAsync({path:{assistant_id:e},body:{name:t}}),remove:()=>{c.remove(t)},isInstalling:s.isPending,isRemoving:c.isRemoving,isInstallError:s.isError,isRemoveError:c.isRemoveError}}var M=`0.10.5`;function N(){return t(M)}function P(e,t,n,r){let i=N(),{data:a}=m({queryKey:[`pluginIcon`,e,t,r],queryFn:async()=>{let{data:n,error:r}=await u({path:{assistant_id:e,name:t},parseAs:`blob`,throwOnError:!1});if(r||!(n instanceof Blob))throw Error(`Failed to load plugin icon`);return n},enabled:!!(i&&n&&r),staleTime:1/0,retry:!1}),[o,s]=(0,v.useState)(void 0);return(0,v.useEffect)(()=>{if(!a){s(void 0);return}let e=URL.createObjectURL(a);return s(e),()=>{URL.revokeObjectURL(e)}},[a]),o}var F=300*1e3,I=[],L=[],R=`system`;async function z(e,t,n){let r=await s({path:{assistant_id:e},query:{q:void 0,category:t},signal:n,throwOnError:!1});if(r.response?.status===404)return{plugins:[]};if(!r.response?.ok)throw Error(g(`usePluginsList.failureMessage`,{ns:`intelligence`}));return r.data??{plugins:[]}}function B(e,t){let[n,r]=(0,v.useState)({assistantId:e,latched:!1}),i=n.assistantId===e?n.latched:!1;return n.assistantId!==e&&r({assistantId:e,latched:!1}),(0,v.useEffect)(()=>{t&&r(t=>t.assistantId===e&&t.latched?t:{assistantId:e,latched:!0})},[e,t]),i||t}function V(e,t=null,n=!0){let r=t??void 0,i=m({queryKey:c({path:{assistant_id:e},query:{q:void 0,category:r}}),queryFn:({signal:t})=>z(e,r,t),enabled:!!e&&n,staleTime:F}),o=m({...a(e),enabled:!!e&&n&&t!==null}),s=m({...l({path:{assistant_id:e},query:{q:void 0}}),enabled:!!e&&n,staleTime:F}),u=(0,v.useMemo)(()=>{let e=t===null?i.data?.plugins:o.data?.plugins??i.data?.plugins;return new Set((e??I).map(e=>e.name))},[t,o.data?.plugins,i.data?.plugins]),d=(0,v.useMemo)(()=>{let e=i.data?.plugins??I,n=s.data?.matches??L;return T(C(e,(t===null?n:n.filter(e=>(e.category??`system`)===t)).filter(e=>!u.has(e.name))))},[i.data?.plugins,s.data?.matches,t,u]),f=t===null?i.data:o.data,p=B(e,f?.categoryCounts!==void 0),g=B(e,(f?.plugins??I).some(e=>e.enabled!==void 0)),_=h(),y=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(y.current===e||!s.isSuccess)return;let t=f?.plugins;if(!t?.length)return;let n=new Map((s.data?.matches??L).map(e=>[e.name,e.category]));t.some(e=>{let t=n.get(e.name);return t!=null&&t!==`system`&&(e.category??`system`)===`system`})&&(y.current=e,_.invalidateQueries({queryKey:c({path:{assistant_id:e},query:{q:void 0}})}))},[e,s.isSuccess,s.data?.matches,f?.plugins,_]),{items:d,isLoading:i.isLoading,catalogLoading:s.isLoading,isError:i.isError,installedLoaded:i.data!==void 0,isFetching:i.isFetching||s.isFetching,catalogError:s.isError,categorySupported:p,pluginToggleSupported:g,installedCategoryCounts:f?.categoryCounts,installedPlugins:f?.plugins??I,installedTotal:f?.totalCount,catalogMatches:s.data?.matches??L,unfilteredInstalledNames:u}}export{A as a,w as c,j as i,D as l,V as n,k as o,P as r,E as s,R as t,x as u};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Gx as t,Sh as n,_h as r,bb as i,cl as a,fl as o,sl as s,wh as c}from"./app-CGffgaON.js";import{_ as l,r as u,t as d,x as f}from"./react-BJ4PZBJN.js";import{w as p}from"./vendor-CezcraPH.js";import{Yn as m}from"./icons-Dwi7aA1Y.js";var h=d();function g(){let{t:e}=p(`account`);return(0,h.jsx)(m,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`,"aria-label":e(`authWaitSpinner.loading`)})}var _=e(f(),1);function v({to:e}){let t=a(e);return(0,_.useEffect)(()=>{t&&o(e)},[t,e]),t?null:(0,h.jsx)(u,{to:e,replace:!0})}function y(){let[e]=l(),a=n(),o=c(),u=r(),d=e.get(`returnTo`),f=i(d,t.assistant);if(!d)return{kind:`proceed`,returnTo:null};if(o)return{kind:`wait`};if(!a)return{kind:`proceed`,returnTo:f};if(s(f)){if(u===`pending`)return{kind:`wait`};if(u===`disabled`)return{kind:`proceed`,returnTo:f}}return{kind:`redirect`,node:(0,h.jsx)(v,{to:f})}}export{g as n,y as t};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Gx as t,Sh as n,_h as r,bb as i,cl as a,fl as o,sl as s,wh as c}from"./app-BNxKtvfM.js";import{_ as l,r as u,t as d,x as f}from"./react-BJ4PZBJN.js";import{w as p}from"./vendor-CezcraPH.js";import{Yn as m}from"./icons-Dwi7aA1Y.js";var h=d();function g(){let{t:e}=p(`account`);return(0,h.jsx)(m,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`,"aria-label":e(`authWaitSpinner.loading`)})}var _=e(f(),1);function v({to:e}){let t=a(e);return(0,_.useEffect)(()=>{t&&o(e)},[t,e]),t?null:(0,h.jsx)(u,{to:e,replace:!0})}function y(){let[e]=l(),a=n(),o=c(),u=r(),d=e.get(`returnTo`),f=i(d,t.assistant);if(!d)return{kind:`proceed`,returnTo:null};if(o)return{kind:`wait`};if(!a)return{kind:`proceed`,returnTo:f};if(s(f)){if(u===`pending`)return{kind:`wait`};if(u===`disabled`)return{kind:`proceed`,returnTo:f}}return{kind:`redirect`,node:(0,h.jsx)(v,{to:f})}}export{g as n,y as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ia as t,La as n}from"./app-CGffgaON.js";import{x as r}from"./react-BJ4PZBJN.js";var i=e(r(),1),a=640;function o(){let{ref:e,size:r}=t(),o=r.w<=0,s=n(o),c=(o?s.w:r.w)>=a,[l,u]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{c&&u(!1)},[c]),{paneRef:e,hasRoomForList:c,drawerOpen:l,openDrawer:(0,i.useCallback)(()=>u(!0),[]),closeDrawer:(0,i.useCallback)(()=>u(!1),[])}}export{o as t};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ia as t,La as n}from"./app-BNxKtvfM.js";import{x as r}from"./react-BJ4PZBJN.js";var i=e(r(),1),a=640;function o(){let{ref:e,size:r}=t(),o=r.w<=0,s=n(o),c=(o?s.w:r.w)>=a,[l,u]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{c&&u(!1)},[c]),{paneRef:e,hasRoomForList:c,drawerOpen:l,openDrawer:(0,i.useCallback)(()=>u(!0),[]),closeDrawer:(0,i.useCallback)(()=>u(!1),[])}}export{o as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Sy as t,Ym as n,aS as r,h as i,iC as a,iS as o,sS as s,uC as c}from"./app-CGffgaON.js";import{t as l,x as u}from"./react-BJ4PZBJN.js";import{Jn as d,er as f,k as p,w as m}from"./vendor-CezcraPH.js";import{Cr as h,P as g,Pt as _,Ya as v,b as y,ha as b}from"./icons-Dwi7aA1Y.js";var x=v(`box`,[[`path`,{d:`M21 8a2 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:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),S=e(u(),1),C=l(),w={cadet:x,clawhub:h,skillssh:g,custom:y,"assistant-memory":b};function T(e,t){switch(e){case`cadet`:return`Cadet`;case`clawhub`:return`Clawhub`;case`skillssh`:return`skills.sh`;case`custom`:return t(`skillOriginBadge.custom`);case`assistant-memory`:return t(`skillOriginBadge.assistantMemory`)}}function E({origin:e}){let{t}=m(`intelligence`),n=e in w?{label:T(e,t),icon:w[e]}:{label:e.replace(/-/g,` `),icon:_};return(0,C.jsx)(a,{tone:`neutral`,leftIcon:(0,S.createElement)(n.icon),className:`capitalize`,children:n.label})}function D(e){return e.kind===`installed`||e.kind===`bundled`}function O(e){return e.kind===`catalog`}function k({icon:e,iconColor:t=`var(--content-tertiary)`,title:n,subtitle:r,children:i}){return(0,C.jsx)(c.Root,{children:(0,C.jsxs)(c.Body,{className:`flex flex-col items-center justify-center py-16 text-center`,children:[(0,C.jsx)(e,{className:`mb-3 h-8 w-8`,style:{color:t},"aria-hidden":!0}),(0,C.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:n}),(0,C.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:r}),i]})})}async function A(e,n,i){let{data:a,error:c,response:l}=await t({path:{assistant_id:e},body:i?{slug:n,version:i}:{slug:n},throwOnError:!1}),u=p(`installSkill.failureMessage`,{ns:`intelligence`});if(r(l,c,u),!l.ok)throw new o(l.status,s(c,l,u));return a??{ok:!0}}function j(e,{onRemoved:t}={}){let r=f(),[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(null),[l,u]=(0,S.useState)(null),p=(0,S.useCallback)(()=>{i(r,e)},[e,r]),m=d({mutationFn:t=>A(e,t),onMutate:e=>o(e),onSettled:()=>{o(null),p()}}),h=n({onMutate:e=>c(e.path.id),onSuccess:()=>{t?.()},onSettled:()=>{c(null),p()}}),g=(0,S.useCallback)(e=>{m.mutate(e.slug??e.id)},[m]),_=(0,S.useCallback)(e=>{u(e)},[]),v=(0,S.useCallback)(()=>{l&&(h.mutate({path:{assistant_id:e,id:l.id}}),u(null))},[e,l,h]),y=(0,S.useCallback)(()=>{u(null)},[]);return{handleInstall:g,handleRemove:_,isInstallingSkill:(0,S.useCallback)(e=>a===(e.slug??e.id),[a]),isRemovingSkill:(0,S.useCallback)(e=>s===e.id,[s]),skillPendingRemoval:l,confirmRemove:v,cancelRemove:y}}export{E as a,D as i,k as n,x as o,O as r,j as t};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Sy as t,Ym as n,aS as r,h as i,iC as a,iS as o,sS as s,uC as c}from"./app-BNxKtvfM.js";import{t as l,x as u}from"./react-BJ4PZBJN.js";import{Jn as d,er as f,k as p,w as m}from"./vendor-CezcraPH.js";import{Cr as h,P as g,Pt as _,Ya as v,b as y,ha as b}from"./icons-Dwi7aA1Y.js";var x=v(`box`,[[`path`,{d:`M21 8a2 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:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),S=e(u(),1),C=l(),w={cadet:x,clawhub:h,skillssh:g,custom:y,"assistant-memory":b};function T(e,t){switch(e){case`cadet`:return`Cadet`;case`clawhub`:return`Clawhub`;case`skillssh`:return`skills.sh`;case`custom`:return t(`skillOriginBadge.custom`);case`assistant-memory`:return t(`skillOriginBadge.assistantMemory`)}}function E({origin:e}){let{t}=m(`intelligence`),n=e in w?{label:T(e,t),icon:w[e]}:{label:e.replace(/-/g,` `),icon:_};return(0,C.jsx)(a,{tone:`neutral`,leftIcon:(0,S.createElement)(n.icon),className:`capitalize`,children:n.label})}function D(e){return e.kind===`installed`||e.kind===`bundled`}function O(e){return e.kind===`catalog`}function k({icon:e,iconColor:t=`var(--content-tertiary)`,title:n,subtitle:r,children:i}){return(0,C.jsx)(c.Root,{children:(0,C.jsxs)(c.Body,{className:`flex flex-col items-center justify-center py-16 text-center`,children:[(0,C.jsx)(e,{className:`mb-3 h-8 w-8`,style:{color:t},"aria-hidden":!0}),(0,C.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:n}),(0,C.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:r}),i]})})}async function A(e,n,i){let{data:a,error:c,response:l}=await t({path:{assistant_id:e},body:i?{slug:n,version:i}:{slug:n},throwOnError:!1}),u=p(`installSkill.failureMessage`,{ns:`intelligence`});if(r(l,c,u),!l.ok)throw new o(l.status,s(c,l,u));return a??{ok:!0}}function j(e,{onRemoved:t}={}){let r=f(),[a,o]=(0,S.useState)(null),[s,c]=(0,S.useState)(null),[l,u]=(0,S.useState)(null),p=(0,S.useCallback)(()=>{i(r,e)},[e,r]),m=d({mutationFn:t=>A(e,t),onMutate:e=>o(e),onSettled:()=>{o(null),p()}}),h=n({onMutate:e=>c(e.path.id),onSuccess:()=>{t?.()},onSettled:()=>{c(null),p()}}),g=(0,S.useCallback)(e=>{m.mutate(e.slug??e.id)},[m]),_=(0,S.useCallback)(e=>{u(e)},[]),v=(0,S.useCallback)(()=>{l&&(h.mutate({path:{assistant_id:e,id:l.id}}),u(null))},[e,l,h]),y=(0,S.useCallback)(()=>{u(null)},[]);return{handleInstall:g,handleRemove:_,isInstallingSkill:(0,S.useCallback)(e=>a===(e.slug??e.id),[a]),isRemovingSkill:(0,S.useCallback)(e=>s===e.id,[s]),skillPendingRemoval:l,confirmRemove:v,cancelRemove:y}}export{E as a,D as i,k as n,x as o,O as r,j as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Gx as t,Zo as n,_m as r,gm as i,nC as a}from"./app-CGffgaON.js";import{n as o,t as s,x as c}from"./react-BJ4PZBJN.js";import{Zn as l,w as u}from"./vendor-CezcraPH.js";import{Ra as d}from"./icons-Dwi7aA1Y.js";var f=s();function p({skill:e,className:r,onNavigate:i}){let{t:s}=u();return e.origin!==`assistant-memory`||!e.sourceConversationId?null:(0,f.jsxs)(o,{to:t.conversation(e.sourceConversationId),onClick:i,className:n(a({tone:`quiet`}),`inline-flex w-fit items-center gap-1 text-body-small-default text-[var(--content-tertiary)]`,r),children:[s(`skillLineageLink.label`),(0,f.jsx)(d,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0})]})}var m=e(c(),1);function h(e,t){return t??e.find(e=>e.name===`SKILL.md`)?.path??null}function g(e,t){let[n,a]=(0,m.useState)(null),o=l({...r({path:{assistant_id:e??``,id:t}}),select:e=>e??null,enabled:!!e}),s=(0,m.useMemo)(()=>o.data?.files??[],[o.data]),c=(0,m.useMemo)(()=>s.find(e=>e.name===`SKILL.md`),[s]),u=h(s,n),d=l({...i({path:{assistant_id:e??``,id:t},query:{path:u??``}}),select:e=>e??null,enabled:!!(e&&u)});return{fileEntries:s,skillMd:c,selectedPath:n,setSelectedPath:a,activePath:u,activeFile:s.find(e=>e.path===u),isFilesLoading:o.isLoading,isFilesPending:o.isPending,fileContent:d.data?.content??null,isBinary:!!d.data?.isBinary,isContentLoading:d.isLoading,isContentPending:d.isPending}}export{p as n,g as t};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Gx as t,Zo as n,_m as r,gm as i,nC as a}from"./app-BNxKtvfM.js";import{n as o,t as s,x as c}from"./react-BJ4PZBJN.js";import{Zn as l,w as u}from"./vendor-CezcraPH.js";import{Ra as d}from"./icons-Dwi7aA1Y.js";var f=s();function p({skill:e,className:r,onNavigate:i}){let{t:s}=u();return e.origin!==`assistant-memory`||!e.sourceConversationId?null:(0,f.jsxs)(o,{to:t.conversation(e.sourceConversationId),onClick:i,className:n(a({tone:`quiet`}),`inline-flex w-fit items-center gap-1 text-body-small-default text-[var(--content-tertiary)]`,r),children:[s(`skillLineageLink.label`),(0,f.jsx)(d,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0})]})}var m=e(c(),1);function h(e,t){return t??e.find(e=>e.name===`SKILL.md`)?.path??null}function g(e,t){let[n,a]=(0,m.useState)(null),o=l({...r({path:{assistant_id:e??``,id:t}}),select:e=>e??null,enabled:!!e}),s=(0,m.useMemo)(()=>o.data?.files??[],[o.data]),c=(0,m.useMemo)(()=>s.find(e=>e.name===`SKILL.md`),[s]),u=h(s,n),d=l({...i({path:{assistant_id:e??``,id:t},query:{path:u??``}}),select:e=>e??null,enabled:!!(e&&u)});return{fileEntries:s,skillMd:c,selectedPath:n,setSelectedPath:a,activePath:u,activeFile:s.find(e=>e.path===u),isFilesLoading:o.isLoading,isFilesPending:o.isPending,fileContent:d.data?.content??null,isBinary:!!d.data?.isBinary,isContentLoading:d.isLoading,isContentPending:d.isPending}}export{p as n,g as t};
@@ -0,0 +1 @@
1
+ import{Pg as e}from"./app-BNxKtvfM.js";var t=`0.10.8`;function n(n){return e(t,n)}export{n as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$o as t,$x as n,BS as r,CC as i,Du as a,Dv as o,Em as s,Eu as c,G as l,Gt as u,Gx as d,HS as f,IS as p,K as m,Kx as h,Mo as g,OC as _,VS as v,Wt as y,Y as b,Yx as x,ZS as S,Zx as C,_s as w,af as T,bl as E,bs as D,es as ee,gl as O,gs as k,hl as te,hs as ne,is as re,jS as ie,kx as ae,ml as oe,mp as se,ms as A,nC as ce,ns as le,of as ue,pl as j,pp as de,ps as fe,q as pe,qt as me,rs as he,sf as ge,th as _e,ts as ve,vs as M,yC as ye,ys as N,zS as P}from"./app-CGffgaON.js";import{_ as be,n as xe,r as F,t as Se,x as Ce}from"./react-BJ4PZBJN.js";import{Zn as I,er as we,w as L}from"./vendor-CezcraPH.js";import{La as Te,fr as R}from"./icons-Dwi7aA1Y.js";import{t as z}from"./detail-card-DXYh92lS.js";import{t as Ee}from"./stt-language-picker-modal-BjXK4fmX.js";import{t as De}from"./use-hotkey-recorder-CaKGUrs_.js";var B=e(Ce(),1),V=Se();function H({label:e,selected:t,recording:n=!1,onClick:r}){return(0,V.jsxs)(`button`,{type:`button`,onClick:r,className:[`inline-flex items-center gap-2 rounded-lg border px-3 py-1.5 text-body-medium-lighter transition-colors`,`border-[var(--border-subtle)]`,t?`bg-[var(--surface-active)]`:`bg-[var(--surface-lift)] hover:bg-[var(--surface-hover)]`,n?`animate-pulse`:``].filter(Boolean).join(` `),children:[(0,V.jsx)(`span`,{className:[`inline-block h-2.5 w-2.5 rounded-full border`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)]`].join(` `)}),(0,V.jsx)(`span`,{className:`text-[var(--content-default)]`,children:e})]})}function Oe(){let{t:e}=L(`settings`),{available:t,currentCode:n,configuredProviderId:r,selectLanguage:a,selecting:o}=pe(l()),[s,c]=(0,B.useState)(!1);return t?(0,V.jsxs)(z,{title:e(`listeningLanguageCard.title`),subtitle:e(`listeningLanguageCard.subtitle`),children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`span`,{className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`,children:b(n,r)}),(0,V.jsx)(i,{variant:`outlined`,onClick:()=>c(!0),className:`shrink-0`,children:e(`listeningLanguageCard.change`)})]}),(0,V.jsx)(Ee,{open:s,onOpenChange:c,title:e(`listeningLanguageCard.title`),currentCode:n,configuredProviderId:r,selectLanguage:a,selecting:o})]}):null}var U=`flux`;function W(e){return e===`cadet`}function ke(e,t){let n=e?.trim().toLowerCase();return!n||n===`multi`||t===void 0?!0:t.includes(n.split(`-`)[0]??n)}function Ae(){let{t:e}=L(`settings`),t=we(),n=_e(),r=l(),[i,a]=(0,B.useState)(!1),{data:c}=I({...de({path:{assistant_id:r}}),enabled:n,staleTime:3e4}),u=c?.services?.stt,{data:d}=I({...s({path:{assistant_id:r}}),enabled:n,staleTime:5*6e4}),f=u?.roles?.liveVoice?.provider??u?.provider,p=d?.providers?.find(e=>e.id===f),m=p?.modelFamilies?.includes(U)??!1;if(!f||!m)return null;let h=ke(u?.language,p?.turnDetectionLanguages),g=u?.roles?.liveVoice,_=g?g.model:u?.providers?.[f]?.model,v=_===void 0?W(f)&&h:_===U,y=async n=>{a(!0);try{let{response:e}=await o({path:{assistant_id:r},body:{services:{stt:{roles:{liveVoice:{provider:f,model:n?U:p?.baseModelFamily}}}}},throwOnError:!1});if(!e?.ok)throw Error(String(e?.status??``));await t.invalidateQueries({queryKey:se({path:{assistant_id:r}})})}catch{P.error(e(`voicePage.turnDetectionFailed`))}finally{a(!1)}};return(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e(`voicePage.turnDetectionLabel`)}),(0,V.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(h?`voicePage.turnDetectionDescription`:`voicePage.turnDetectionLanguageUnsupported`)}),(0,V.jsx)(S,{checked:v,disabled:i||!h&&!v,onChange:e=>void y(e),"aria-label":e(`voicePage.turnDetectionLabel`)})]})}function G(){return!x(`voiceStartConfirmationSkipped`,!1)}function je(){let{t:e}=L(`settings`),[t,r]=(0,B.useState)(G);return(0,B.useEffect)(()=>n(`voiceStartConfirmationSkipped`,()=>{r(G())}),[]),(0,V.jsx)(S,{checked:t,onChange:e=>{r(e),C(`voiceStartConfirmationSkipped`,!e)},label:e(`voiceStartConfirmationToggle.label`),helperText:e(`voiceStartConfirmationToggle.description`)})}var K=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,q=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--system-negative-strong)]`,Me=2;function J(e){let t=[];return e.ctrlKey&&t.push(`control`),e.altKey&&t.push(`option`),e.shiftKey&&t.push(`shift`),e.metaKey&&t.push(`command`),D(t)}function Ne(){let{t:e}=L(`settings`),n=ne(),r=t(e=>e.registered)===!1,[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)([]),[d,f]=(0,B.useState)(!1),p=(0,B.useRef)(null),m=(0,B.useCallback)(async()=>{o((await T())?.inputMonitoring.status??null)},[]);(0,B.useEffect)(()=>{m();let e=setInterval(()=>{m()},2e3);return()=>{clearInterval(e)}},[m]);let h=(0,B.useCallback)(()=>{ge(`inputMonitoring`).then(m)},[m]),g=(0,B.useCallback)(()=>{ue(`inputMonitoring`).then(m)},[m]),_=(0,B.useCallback)(e=>{k(e),c(!1),u([]),f(!1),e.kind!==`off`&&h()},[h]),v=(0,B.useCallback)(()=>{c(!0),u([]),f(!1),requestAnimationFrame(()=>{p.current?.focus()})},[]),y=(0,B.useCallback)(()=>{c(!1),u([]),f(!1)},[]),b=(0,B.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){y();return}u(J(e))},[y]),x=(0,B.useCallback)(e=>{if(s&&!(J(e).length>0)){if(l.length>=Me){_({kind:`modifierOnly`,modifiers:l});return}u([]),f(!0)}},[_,l,s]);(0,B.useEffect)(()=>{if(!s)return;let e=e=>{p.current&&!p.current.contains(e.target)&&y()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[y,s]);let S=A(n),C=n.kind===`modifierOnly`&&!S,w=n.kind!==`off`,E=n.kind===`modifierOnly`&&n.modifiers.includes(`control`)&&n.modifiers.includes(`option`),D=a===`granted`;return(0,V.jsx)(z,{title:e(`voiceKeyCard.title`),subtitle:e(`voiceKeyCard.subtitle`),children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{ref:p,tabIndex:s?0:-1,onKeyDown:s?b:void 0,onKeyUp:s?x:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[(0,V.jsx)(H,{label:e(`voiceKeyCard.fnLabel`),selected:S,onClick:()=>_(fe)}),s?(0,V.jsx)(H,{label:l.length>0?N(l):e(`voiceKeyCard.recordingPrompt`),selected:!0,recording:!0,onClick:y}):(0,V.jsx)(H,{label:n.kind===`modifierOnly`&&!S?N(n.modifiers):e(`voiceKeyCard.customLabel`),selected:C,onClick:v}),(0,V.jsx)(H,{label:e(`voiceKeyCard.offLabel`),selected:!w,onClick:()=>_({kind:`off`})})]}),d&&(0,V.jsxs)(`div`,{className:K,children:[(0,V.jsx)(R,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:e(`voiceKeyCard.customHint`)})]}),w&&a!==null&&!D&&(0,V.jsxs)(`div`,{className:`flex flex-col items-start gap-2 pt-1`,children:[(0,V.jsxs)(`div`,{className:q,children:[(0,V.jsx)(R,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:e(`voiceKeyCard.needsInputMonitoring`)})]}),(0,V.jsx)(i,{variant:`outlined`,onClick:g,children:e(`voiceKeyCard.allowInputMonitoring`)})]}),w&&D&&r&&(0,V.jsxs)(`div`,{className:q,children:[(0,V.jsx)(R,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:e(`voiceKeyCard.refusedNote`)})]}),S&&(0,V.jsxs)(`div`,{className:K,children:[(0,V.jsx)(R,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:e(`voiceKeyCard.fnDictationNote`)})]}),E&&(0,V.jsxs)(`div`,{className:K,children:[(0,V.jsx)(R,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:e(`voiceKeyCard.voiceOverNote`)})]}),w&&(0,V.jsx)(`div`,{className:`pt-2`,children:(0,V.jsx)(je,{})})]})})}function Pe({assistantId:e,open:t,onOpenChange:n}){return(0,V.jsx)(r.Root,{open:t,onOpenChange:n,children:(0,V.jsx)(r.Content,{size:`md`,children:(0,V.jsx)(Fe,{assistantId:e,onDone:()=>n(!1)})})})}function Fe({assistantId:e,onDone:t}){let{t:n}=L(),{available:a,currentModel:o,selectModel:s,selecting:c}=g(e);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(r.Header,{children:[(0,V.jsx)(r.Title,{children:n(`voicePickerModal.title`)}),a&&(0,V.jsx)(r.Description,{children:`Uses Cadet credits, through providers like ElevenLabs and Deepgram.`})]}),(0,V.jsx)(r.Body,{children:(0,V.jsx)(u,{assistantId:e,filterBySource:!0,value:o,onChange:s,autoScrollToSelected:!0})}),(0,V.jsxs)(r.Footer,{className:`items-center justify-between gap-3`,children:[(0,V.jsx)(m,{}),(0,V.jsx)(i,{variant:`primary`,onClick:t,disabled:c,className:`shrink-0`,children:n(`voicePickerModal.done`)})]})]})}function Ie(){let{t:e}=L(`settings`),t=l(),{available:n,settled:r,voices:a,currentModel:o}=g(t),s=a.find(e=>e.model===o)??a[0],[c,u]=(0,B.useState)(!1),d=ae.use.name(),f=d?e(`voicePickerCard.titleWithName`,{name:d}):e(`voicePickerCard.title`);return r?n&&s?(0,V.jsxs)(z,{title:f,subtitle:e(`voicePickerCard.creditsNote`),children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(y,{description:s.description,className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`}),(0,V.jsx)(i,{variant:`outlined`,onClick:()=>u(!0),className:`shrink-0`,children:e(`voicePickerCard.changeButton`)})]}),(0,V.jsx)(Pe,{assistantId:t,open:c,onOpenChange:u})]}):(0,V.jsx)(z,{title:f,children:(0,V.jsx)(me,{})}):(0,V.jsx)(z,{title:f,children:(0,V.jsx)(ie,{as:`span`,role:`status`,"aria-label":e(`voicePickerCard.loadingAria`),className:`block h-9 w-48`})})}var Le=[{prefKey:`showUserTranscript`,label:`Show the words you say`,description:`Live transcription while you speak.`},{prefKey:`showAssistantTranscript`,label:`Show the words the assistant says`,description:`Text alongside the spoken response.`}],Re=`We recommend keeping both off to start. It feels more like a real conversation.`;function ze(){let{t:e}=L();return(0,V.jsx)(`span`,{className:`shrink-0 rounded-full bg-[var(--surface-active)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:e(`voiceTranscriptToggles.recommendedOff`)})}function Be({label:e,description:t,showBadge:n,checked:r,onChange:i}){return(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e}),n?(0,V.jsx)(ze,{}):null]}),t?(0,V.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t}):null]}),(0,V.jsx)(S,{checked:r,onChange:i,"aria-label":e})]})}function Ve({showDescription:e=!1,showRecommendedBadge:t=!1}){let{t:n}=L(),r=a.use.showUserTranscript(),i=a.use.showAssistantTranscript(),o=a.use.setShowUserTranscript(),s=a.use.setShowAssistantTranscript(),c={showUserTranscript:{checked:r,onChange:o},showAssistantTranscript:{checked:i,onChange:s}},l=(e,t)=>n(e===`showUserTranscript`?`voiceTranscriptToggles.userTranscriptLabel`:`voiceTranscriptToggles.assistantTranscriptLabel`,t),u=(e,t)=>n(e===`showUserTranscript`?`voiceTranscriptToggles.userTranscriptDescription`:`voiceTranscriptToggles.assistantTranscriptDescription`,t);return(0,V.jsx)(V.Fragment,{children:Le.map(n=>{let r=c[n.prefKey];return(0,V.jsx)(Be,{label:l(n.prefKey,n.label),description:e?u(n.prefKey,n.description):void 0,showBadge:t,checked:r.checked,onChange:r.onChange},n.prefKey)})})}var Y=`text-body-small-default text-[var(--content-tertiary)]`;function He(){let[e]=be(),t=e.get(`tab`);return t===`sounds`?(0,V.jsx)(F,{replace:!0,to:d.settings.sounds}):t===`services`?(0,V.jsx)(F,{replace:!0,to:d.settings.ai}):(0,V.jsx)(Ue,{})}function Ue(){let{t:e}=L(`settings`);return(0,V.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,V.jsxs)(X,{heading:e(`voicePage.sectionOutputHeading`),description:e(`voicePage.sectionOutputDescription`),children:[(0,V.jsx)(Ie,{}),(0,V.jsx)(We,{})]}),(0,V.jsxs)(X,{heading:e(`voicePage.sectionInputHeading`),description:e(`voicePage.sectionInputDescription`),children:[(0,V.jsx)(Ke,{}),(0,V.jsx)(Oe,{}),E()?(0,V.jsx)(Ne,{}):(0,V.jsx)(Ye,{}),(0,V.jsx)(Xe,{})]}),(0,V.jsx)(X,{heading:e(`voicePage.sectionCaptionsHeading`),children:(0,V.jsx)(Ge,{})})]})}function We(){let{t:e}=L(`settings`),{available:t}=g(l());return t?(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:[(0,V.jsx)(R,{className:`h-3.5 w-3.5 shrink-0 text-[var(--content-quiet)]`}),(0,V.jsx)(`span`,{children:e(`voicePage.speechServicesBannerPrompt`)}),(0,V.jsxs)(xe,{to:`${d.settings.ai}#text-to-speech`,className:_(ce({tone:`quiet`}),`inline-flex items-center gap-1 text-[var(--content-secondary)] decoration-[var(--border-element)] underline-offset-2`),children:[e(`voicePage.speechServicesBannerLink`),(0,V.jsx)(Te,{className:`h-3 w-3`})]})]}):null}function X({heading:e,description:t,children:n}){return(0,V.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsx)(`h2`,{className:`text-label-medium-default uppercase tracking-wide text-[var(--content-tertiary)]`,children:e}),t&&(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:t})]}),n]})}function Ge(){let{t:e}=L(`settings`);return(0,V.jsx)(z,{title:e(`voicePage.captionsTitle`),subtitle:e(`voicePage.captionsSubtitle`),children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsx)(Ve,{showDescription:!0}),(0,V.jsx)(`p`,{className:`${Y} pt-1`,children:e(`voicePage.captionsRecommendation`,Re)})]})})}var Z=``;function Ke(){let{t:e}=L(`settings`),[t,n]=(0,B.useState)([]),[r,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(()=>j()),u=(0,B.useCallback)(async()=>{if(!navigator.mediaDevices?.enumerateDevices)return;let e=await oe();a(e.needsPermission),n(e.devices),s(e.known)},[]),d=(0,B.useCallback)(async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop()}catch{}u()},[u]);(0,B.useEffect)(()=>{u();let e=navigator.mediaDevices;if(!e?.addEventListener)return;let t=()=>void u();return e.addEventListener(`devicechange`,t),()=>e.removeEventListener(`devicechange`,t)},[u]);let f=(0,B.useMemo)(()=>{let n=t.map((t,n)=>({value:t.deviceId,label:t.label||e(`voicePage.microphoneFallbackLabel`,{index:n+1})})),r=c!==Z&&!n.some(e=>e.value===c);return[{value:null,label:e(`voicePage.systemDefault`)},...n,...r?[{value:c,label:e(o?`voicePage.savedMicrophoneNotConnected`:`voicePage.savedMicrophone`)}]:[]]},[t,c,o,e]),m=(0,B.useCallback)(e=>{l(e),te(e)},[]);(0,B.useEffect)(()=>O(()=>{l(j())}),[]);let h=c===Z?null:c;return(0,V.jsx)(z,{title:e(`voicePage.microphoneTitle`),subtitle:e(`voicePage.microphoneSubtitle`),children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,V.jsx)(`div`,{className:`max-w-xs`,children:(0,V.jsx)(p,{options:f,value:h,onChange:m,onSelectNone:()=>m(Z),"aria-label":e(`voicePage.microphoneAriaLabel`)})}),r&&(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(i,{variant:`outlined`,onClick:d,children:e(`voicePage.allowMicrophoneAccess`)}),(0,V.jsx)(`span`,{className:Y,children:e(`voicePage.grantMicrophoneAccessHint`)})]})]})})}var qe=new Set([`Control`,`Alt`,`Shift`,`Meta`]),Q=`toggleVoice`,Je=[{label:`Ctrl+Shift`,activator:{kind:`modifierOnly`,modifiers:[`control`,`shift`]}},{label:`Alt`,activator:{kind:`modifierOnly`,modifiers:[`option`]}}];function Ye(){let{t:e}=L(`settings`),t=h(),[n,r]=(0,B.useState)(()=>le()),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)([]),[c,l]=(0,B.useState)(!1),u=(0,B.useRef)(null),d=(0,B.useMemo)(()=>{let e=ve();return[{label:w(e),activator:e}]},[]),f=n.kind!==`off`,p=(0,B.useCallback)(e=>{r(e),re(e),a(!1),s([]),l(!1)},[]),m=De({onBound:()=>p({kind:`off`})}),g=m.catalog.find(e=>e.key===Q)?.accelerator??``,_=m.recordingKey===Q,v=he()?Je:[],y=(0,B.useCallback)(e=>{p(e),m.removeHotkey(Q)},[m,p]),b=(0,B.useCallback)(()=>{p({kind:`off`}),m.removeHotkey(Q)},[m,p]),x=(0,B.useCallback)(()=>{a(!0),s([]),l(!1),requestAnimationFrame(()=>{u.current?.focus()})},[]),C=(0,B.useCallback)(()=>{a(!1),s([]),l(!1)},[]),T=(0,B.useCallback)(e=>{let t=[];return e.ctrlKey&&t.push(`control`),e.altKey&&t.push(`option`),e.shiftKey&&t.push(`shift`),e.metaKey&&t.push(`command`),t},[]),E=(0,B.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){C();return}let t=T(e);if(qe.has(e.key)){l(!1),s(D(t));return}if(t.length===0){l(!0);return}p({kind:`key`,label:e.key.length===1?e.key.toUpperCase():e.key,modifiers:D(t)})},[C,T,p]),O=(0,B.useCallback)(e=>{i&&T(e).length===0&&o.length>0&&(s([]),l(!0))},[T,i,o]);(0,B.useEffect)(()=>{if(!i)return;let e=e=>{u.current&&!u.current.contains(e.target)&&C()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[C,i]);let k=f&&!d.some(e=>M(e.activator,n));return t?(0,V.jsx)(z,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitleDesktop`),children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[v.map(e=>(0,V.jsx)(H,{label:e.label,selected:M(e.activator,n),onClick:()=>y(e.activator)},e.label)),(0,V.jsx)(H,{label:_?e(`voicePage.recordingPrompt`):g?(0,V.jsx)(ye,{accelerator:g}):e(`voicePage.customKey`),selected:g!==``,recording:_,onClick:_?m.stopRecording:()=>m.startRecording(Q)}),(0,V.jsx)(H,{label:e(`voicePage.offKeyLabel`),selected:n.kind===`off`&&!g&&!_,onClick:b})]}),m.conflict?.key===Q&&(0,V.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,V.jsx)(R,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:e(`voicePage.shortcutConflict`,{command:m.conflict.label})})]})]})}):(0,V.jsx)(z,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitle`),children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsx)(S,{checked:f,onChange:e=>{p(e?ee():{kind:`off`})},label:e(`voicePage.enableVoiceShortcut`)}),f&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsx)(`span`,{className:Y,children:e(`voicePage.activationKeyLabel`)}),(0,V.jsxs)(`div`,{ref:u,tabIndex:i?0:-1,onKeyDown:i?E:void 0,onKeyUp:i?O:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[d.map(e=>(0,V.jsx)(H,{label:e.label,selected:M(e.activator,n),onClick:()=>p(e.activator)},e.label)),i?(0,V.jsx)(H,{label:o.length>0?N(o):e(`voicePage.pressShortcut`),selected:!0,recording:!0,onClick:C}):(0,V.jsx)(H,{label:k?w(n):e(`voicePage.customKey`),selected:k,onClick:x})]}),c&&(0,V.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,V.jsx)(R,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:e(`voicePage.shortcutChordHint`)})]}),f&&(0,V.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,V.jsx)(R,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:e(`voicePage.focusedTabNote`)})]})]})]})})}function Xe(){let{t:e}=L(`settings`),t=a.use.pauseBeforeReplyMs(),n=a.use.setPauseBeforeReplyMs(),r=a.use.interruptSensitivity(),o=a.use.setInterruptSensitivity(),s=(0,B.useMemo)(()=>[{value:`low`,label:e(`voicePage.interruptSensitivityLow`)},{value:`medium`,label:e(`voicePage.interruptSensitivityMedium`)},{value:`high`,label:e(`voicePage.interruptSensitivityHigh`)}],[e]),l=t!==null||r!==null;return(0,V.jsx)(z,{title:e(`voicePage.turnTakingTitle`),subtitle:e(`voicePage.turnTakingSubtitle`),children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,V.jsx)(Ae,{}),(0,V.jsx)($,{label:e(`voicePage.pauseBeforeReplyLabel`),description:e(`voicePage.pauseBeforeReplyDescription`),isDefault:t===null,children:(0,V.jsx)(`div`,{className:`max-w-xs`,children:(0,V.jsx)(v,{value:(t??1200)/1e3,onValueChange:e=>{typeof e==`number`&&n(Math.round(e*1e3))},min:500/1e3,max:c/1e3,step:.1,showValue:!0,formatValue:e=>`${(typeof e==`number`?e:e[0]).toFixed(1)}s`,"aria-label":e(`voicePage.pauseBeforeReplyAriaLabel`)})})}),(0,V.jsx)($,{label:e(`voicePage.interruptSensitivityLabel`),description:e(`voicePage.interruptSensitivityDescription`),isDefault:r===null,children:(0,V.jsx)(`div`,{className:`max-w-xs`,children:(0,V.jsx)(f,{items:s,value:r??`medium`,onChange:o,ariaLabel:e(`voicePage.interruptSensitivityAriaLabel`)})})}),l&&(0,V.jsx)(`div`,{children:(0,V.jsx)(i,{variant:`outlined`,onClick:()=>{n(null),o(null)},children:e(`voicePage.resetToDefaults`)})})]})})}function $({label:e,description:t,isDefault:n,children:r}){let{t:i}=L(`settings`);return(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e}),n&&(0,V.jsx)(`span`,{className:`shrink-0 rounded-full bg-[var(--surface-active)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:i(`voicePage.defaultBadge`)})]}),(0,V.jsx)(`p`,{className:Y,children:t}),r]})}export{He as VoicePage};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$o as t,$x as n,BS as r,CC as i,Du as a,Dv as o,Em as s,Eu as c,G as l,Gt as u,Gx as d,HS as f,IS as p,K as m,Kx as h,Mo as g,OC as _,VS as v,Wt as y,Y as b,Yx as x,ZS as S,Zx as C,_s as w,af as T,bl as E,bs as D,es as ee,gl as O,gs as k,hl as te,hs as ne,is as re,jS as ie,kx as ae,ml as oe,mp as se,ms as A,nC as ce,ns as le,of as ue,pl as j,pp as de,ps as fe,q as pe,qt as me,rs as he,sf as ge,th as _e,ts as ve,vs as M,yC as ye,ys as N,zS as P}from"./app-BNxKtvfM.js";import{_ as be,n as xe,r as F,t as Se,x as Ce}from"./react-BJ4PZBJN.js";import{Zn as I,er as we,w as L}from"./vendor-CezcraPH.js";import{La as Te,fr as R}from"./icons-Dwi7aA1Y.js";import{t as z}from"./detail-card-DF9nj6Gj.js";import{t as Ee}from"./stt-language-picker-modal-BWPQXHbg.js";import{t as De}from"./use-hotkey-recorder-BRdHU8pS.js";var B=e(Ce(),1),V=Se();function H({label:e,selected:t,recording:n=!1,onClick:r}){return(0,V.jsxs)(`button`,{type:`button`,onClick:r,className:[`inline-flex items-center gap-2 rounded-lg border px-3 py-1.5 text-body-medium-lighter transition-colors`,`border-[var(--border-subtle)]`,t?`bg-[var(--surface-active)]`:`bg-[var(--surface-lift)] hover:bg-[var(--surface-hover)]`,n?`animate-pulse`:``].filter(Boolean).join(` `),children:[(0,V.jsx)(`span`,{className:[`inline-block h-2.5 w-2.5 rounded-full border`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)]`].join(` `)}),(0,V.jsx)(`span`,{className:`text-[var(--content-default)]`,children:e})]})}function Oe(){let{t:e}=L(`settings`),{available:t,currentCode:n,configuredProviderId:r,selectLanguage:a,selecting:o}=pe(l()),[s,c]=(0,B.useState)(!1);return t?(0,V.jsxs)(z,{title:e(`listeningLanguageCard.title`),subtitle:e(`listeningLanguageCard.subtitle`),children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`span`,{className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`,children:b(n,r)}),(0,V.jsx)(i,{variant:`outlined`,onClick:()=>c(!0),className:`shrink-0`,children:e(`listeningLanguageCard.change`)})]}),(0,V.jsx)(Ee,{open:s,onOpenChange:c,title:e(`listeningLanguageCard.title`),currentCode:n,configuredProviderId:r,selectLanguage:a,selecting:o})]}):null}var U=`flux`;function W(e){return e===`cadet`}function ke(e,t){let n=e?.trim().toLowerCase();return!n||n===`multi`||t===void 0?!0:t.includes(n.split(`-`)[0]??n)}function Ae(){let{t:e}=L(`settings`),t=we(),n=_e(),r=l(),[i,a]=(0,B.useState)(!1),{data:c}=I({...de({path:{assistant_id:r}}),enabled:n,staleTime:3e4}),u=c?.services?.stt,{data:d}=I({...s({path:{assistant_id:r}}),enabled:n,staleTime:5*6e4}),f=u?.roles?.liveVoice?.provider??u?.provider,p=d?.providers?.find(e=>e.id===f),m=p?.modelFamilies?.includes(U)??!1;if(!f||!m)return null;let h=ke(u?.language,p?.turnDetectionLanguages),g=u?.roles?.liveVoice,_=g?g.model:u?.providers?.[f]?.model,v=_===void 0?W(f)&&h:_===U,y=async n=>{a(!0);try{let{response:e}=await o({path:{assistant_id:r},body:{services:{stt:{roles:{liveVoice:{provider:f,model:n?U:p?.baseModelFamily}}}}},throwOnError:!1});if(!e?.ok)throw Error(String(e?.status??``));await t.invalidateQueries({queryKey:se({path:{assistant_id:r}})})}catch{P.error(e(`voicePage.turnDetectionFailed`))}finally{a(!1)}};return(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e(`voicePage.turnDetectionLabel`)}),(0,V.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(h?`voicePage.turnDetectionDescription`:`voicePage.turnDetectionLanguageUnsupported`)}),(0,V.jsx)(S,{checked:v,disabled:i||!h&&!v,onChange:e=>void y(e),"aria-label":e(`voicePage.turnDetectionLabel`)})]})}function G(){return!x(`voiceStartConfirmationSkipped`,!1)}function je(){let{t:e}=L(`settings`),[t,r]=(0,B.useState)(G);return(0,B.useEffect)(()=>n(`voiceStartConfirmationSkipped`,()=>{r(G())}),[]),(0,V.jsx)(S,{checked:t,onChange:e=>{r(e),C(`voiceStartConfirmationSkipped`,!e)},label:e(`voiceStartConfirmationToggle.label`),helperText:e(`voiceStartConfirmationToggle.description`)})}var K=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,q=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--system-negative-strong)]`,Me=2;function J(e){let t=[];return e.ctrlKey&&t.push(`control`),e.altKey&&t.push(`option`),e.shiftKey&&t.push(`shift`),e.metaKey&&t.push(`command`),D(t)}function Ne(){let{t:e}=L(`settings`),n=ne(),r=t(e=>e.registered)===!1,[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)([]),[d,f]=(0,B.useState)(!1),p=(0,B.useRef)(null),m=(0,B.useCallback)(async()=>{o((await T())?.inputMonitoring.status??null)},[]);(0,B.useEffect)(()=>{m();let e=setInterval(()=>{m()},2e3);return()=>{clearInterval(e)}},[m]);let h=(0,B.useCallback)(()=>{ge(`inputMonitoring`).then(m)},[m]),g=(0,B.useCallback)(()=>{ue(`inputMonitoring`).then(m)},[m]),_=(0,B.useCallback)(e=>{k(e),c(!1),u([]),f(!1),e.kind!==`off`&&h()},[h]),v=(0,B.useCallback)(()=>{c(!0),u([]),f(!1),requestAnimationFrame(()=>{p.current?.focus()})},[]),y=(0,B.useCallback)(()=>{c(!1),u([]),f(!1)},[]),b=(0,B.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){y();return}u(J(e))},[y]),x=(0,B.useCallback)(e=>{if(s&&!(J(e).length>0)){if(l.length>=Me){_({kind:`modifierOnly`,modifiers:l});return}u([]),f(!0)}},[_,l,s]);(0,B.useEffect)(()=>{if(!s)return;let e=e=>{p.current&&!p.current.contains(e.target)&&y()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[y,s]);let S=A(n),C=n.kind===`modifierOnly`&&!S,w=n.kind!==`off`,E=n.kind===`modifierOnly`&&n.modifiers.includes(`control`)&&n.modifiers.includes(`option`),D=a===`granted`;return(0,V.jsx)(z,{title:e(`voiceKeyCard.title`),subtitle:e(`voiceKeyCard.subtitle`),children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{ref:p,tabIndex:s?0:-1,onKeyDown:s?b:void 0,onKeyUp:s?x:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[(0,V.jsx)(H,{label:e(`voiceKeyCard.fnLabel`),selected:S,onClick:()=>_(fe)}),s?(0,V.jsx)(H,{label:l.length>0?N(l):e(`voiceKeyCard.recordingPrompt`),selected:!0,recording:!0,onClick:y}):(0,V.jsx)(H,{label:n.kind===`modifierOnly`&&!S?N(n.modifiers):e(`voiceKeyCard.customLabel`),selected:C,onClick:v}),(0,V.jsx)(H,{label:e(`voiceKeyCard.offLabel`),selected:!w,onClick:()=>_({kind:`off`})})]}),d&&(0,V.jsxs)(`div`,{className:K,children:[(0,V.jsx)(R,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:e(`voiceKeyCard.customHint`)})]}),w&&a!==null&&!D&&(0,V.jsxs)(`div`,{className:`flex flex-col items-start gap-2 pt-1`,children:[(0,V.jsxs)(`div`,{className:q,children:[(0,V.jsx)(R,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:e(`voiceKeyCard.needsInputMonitoring`)})]}),(0,V.jsx)(i,{variant:`outlined`,onClick:g,children:e(`voiceKeyCard.allowInputMonitoring`)})]}),w&&D&&r&&(0,V.jsxs)(`div`,{className:q,children:[(0,V.jsx)(R,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:e(`voiceKeyCard.refusedNote`)})]}),S&&(0,V.jsxs)(`div`,{className:K,children:[(0,V.jsx)(R,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:e(`voiceKeyCard.fnDictationNote`)})]}),E&&(0,V.jsxs)(`div`,{className:K,children:[(0,V.jsx)(R,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:e(`voiceKeyCard.voiceOverNote`)})]}),w&&(0,V.jsx)(`div`,{className:`pt-2`,children:(0,V.jsx)(je,{})})]})})}function Pe({assistantId:e,open:t,onOpenChange:n}){return(0,V.jsx)(r.Root,{open:t,onOpenChange:n,children:(0,V.jsx)(r.Content,{size:`md`,children:(0,V.jsx)(Fe,{assistantId:e,onDone:()=>n(!1)})})})}function Fe({assistantId:e,onDone:t}){let{t:n}=L(),{available:a,currentModel:o,selectModel:s,selecting:c}=g(e);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(r.Header,{children:[(0,V.jsx)(r.Title,{children:n(`voicePickerModal.title`)}),a&&(0,V.jsx)(r.Description,{children:`Uses Cadet credits, through providers like ElevenLabs and Deepgram.`})]}),(0,V.jsx)(r.Body,{children:(0,V.jsx)(u,{assistantId:e,filterBySource:!0,value:o,onChange:s,autoScrollToSelected:!0})}),(0,V.jsxs)(r.Footer,{className:`items-center justify-between gap-3`,children:[(0,V.jsx)(m,{}),(0,V.jsx)(i,{variant:`primary`,onClick:t,disabled:c,className:`shrink-0`,children:n(`voicePickerModal.done`)})]})]})}function Ie(){let{t:e}=L(`settings`),t=l(),{available:n,settled:r,voices:a,currentModel:o}=g(t),s=a.find(e=>e.model===o)??a[0],[c,u]=(0,B.useState)(!1),d=ae.use.name(),f=d?e(`voicePickerCard.titleWithName`,{name:d}):e(`voicePickerCard.title`);return r?n&&s?(0,V.jsxs)(z,{title:f,subtitle:e(`voicePickerCard.creditsNote`),children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(y,{description:s.description,className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`}),(0,V.jsx)(i,{variant:`outlined`,onClick:()=>u(!0),className:`shrink-0`,children:e(`voicePickerCard.changeButton`)})]}),(0,V.jsx)(Pe,{assistantId:t,open:c,onOpenChange:u})]}):(0,V.jsx)(z,{title:f,children:(0,V.jsx)(me,{})}):(0,V.jsx)(z,{title:f,children:(0,V.jsx)(ie,{as:`span`,role:`status`,"aria-label":e(`voicePickerCard.loadingAria`),className:`block h-9 w-48`})})}var Le=[{prefKey:`showUserTranscript`,label:`Show the words you say`,description:`Live transcription while you speak.`},{prefKey:`showAssistantTranscript`,label:`Show the words the assistant says`,description:`Text alongside the spoken response.`}],Re=`We recommend keeping both off to start. It feels more like a real conversation.`;function ze(){let{t:e}=L();return(0,V.jsx)(`span`,{className:`shrink-0 rounded-full bg-[var(--surface-active)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:e(`voiceTranscriptToggles.recommendedOff`)})}function Be({label:e,description:t,showBadge:n,checked:r,onChange:i}){return(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e}),n?(0,V.jsx)(ze,{}):null]}),t?(0,V.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t}):null]}),(0,V.jsx)(S,{checked:r,onChange:i,"aria-label":e})]})}function Ve({showDescription:e=!1,showRecommendedBadge:t=!1}){let{t:n}=L(),r=a.use.showUserTranscript(),i=a.use.showAssistantTranscript(),o=a.use.setShowUserTranscript(),s=a.use.setShowAssistantTranscript(),c={showUserTranscript:{checked:r,onChange:o},showAssistantTranscript:{checked:i,onChange:s}},l=(e,t)=>n(e===`showUserTranscript`?`voiceTranscriptToggles.userTranscriptLabel`:`voiceTranscriptToggles.assistantTranscriptLabel`,t),u=(e,t)=>n(e===`showUserTranscript`?`voiceTranscriptToggles.userTranscriptDescription`:`voiceTranscriptToggles.assistantTranscriptDescription`,t);return(0,V.jsx)(V.Fragment,{children:Le.map(n=>{let r=c[n.prefKey];return(0,V.jsx)(Be,{label:l(n.prefKey,n.label),description:e?u(n.prefKey,n.description):void 0,showBadge:t,checked:r.checked,onChange:r.onChange},n.prefKey)})})}var Y=`text-body-small-default text-[var(--content-tertiary)]`;function He(){let[e]=be(),t=e.get(`tab`);return t===`sounds`?(0,V.jsx)(F,{replace:!0,to:d.settings.sounds}):t===`services`?(0,V.jsx)(F,{replace:!0,to:d.settings.ai}):(0,V.jsx)(Ue,{})}function Ue(){let{t:e}=L(`settings`);return(0,V.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,V.jsxs)(X,{heading:e(`voicePage.sectionOutputHeading`),description:e(`voicePage.sectionOutputDescription`),children:[(0,V.jsx)(Ie,{}),(0,V.jsx)(We,{})]}),(0,V.jsxs)(X,{heading:e(`voicePage.sectionInputHeading`),description:e(`voicePage.sectionInputDescription`),children:[(0,V.jsx)(Ke,{}),(0,V.jsx)(Oe,{}),E()?(0,V.jsx)(Ne,{}):(0,V.jsx)(Ye,{}),(0,V.jsx)(Xe,{})]}),(0,V.jsx)(X,{heading:e(`voicePage.sectionCaptionsHeading`),children:(0,V.jsx)(Ge,{})})]})}function We(){let{t:e}=L(`settings`),{available:t}=g(l());return t?(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:[(0,V.jsx)(R,{className:`h-3.5 w-3.5 shrink-0 text-[var(--content-quiet)]`}),(0,V.jsx)(`span`,{children:e(`voicePage.speechServicesBannerPrompt`)}),(0,V.jsxs)(xe,{to:`${d.settings.ai}#text-to-speech`,className:_(ce({tone:`quiet`}),`inline-flex items-center gap-1 text-[var(--content-secondary)] decoration-[var(--border-element)] underline-offset-2`),children:[e(`voicePage.speechServicesBannerLink`),(0,V.jsx)(Te,{className:`h-3 w-3`})]})]}):null}function X({heading:e,description:t,children:n}){return(0,V.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsx)(`h2`,{className:`text-label-medium-default uppercase tracking-wide text-[var(--content-tertiary)]`,children:e}),t&&(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:t})]}),n]})}function Ge(){let{t:e}=L(`settings`);return(0,V.jsx)(z,{title:e(`voicePage.captionsTitle`),subtitle:e(`voicePage.captionsSubtitle`),children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsx)(Ve,{showDescription:!0}),(0,V.jsx)(`p`,{className:`${Y} pt-1`,children:e(`voicePage.captionsRecommendation`,Re)})]})})}var Z=``;function Ke(){let{t:e}=L(`settings`),[t,n]=(0,B.useState)([]),[r,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(()=>j()),u=(0,B.useCallback)(async()=>{if(!navigator.mediaDevices?.enumerateDevices)return;let e=await oe();a(e.needsPermission),n(e.devices),s(e.known)},[]),d=(0,B.useCallback)(async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop()}catch{}u()},[u]);(0,B.useEffect)(()=>{u();let e=navigator.mediaDevices;if(!e?.addEventListener)return;let t=()=>void u();return e.addEventListener(`devicechange`,t),()=>e.removeEventListener(`devicechange`,t)},[u]);let f=(0,B.useMemo)(()=>{let n=t.map((t,n)=>({value:t.deviceId,label:t.label||e(`voicePage.microphoneFallbackLabel`,{index:n+1})})),r=c!==Z&&!n.some(e=>e.value===c);return[{value:null,label:e(`voicePage.systemDefault`)},...n,...r?[{value:c,label:e(o?`voicePage.savedMicrophoneNotConnected`:`voicePage.savedMicrophone`)}]:[]]},[t,c,o,e]),m=(0,B.useCallback)(e=>{l(e),te(e)},[]);(0,B.useEffect)(()=>O(()=>{l(j())}),[]);let h=c===Z?null:c;return(0,V.jsx)(z,{title:e(`voicePage.microphoneTitle`),subtitle:e(`voicePage.microphoneSubtitle`),children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,V.jsx)(`div`,{className:`max-w-xs`,children:(0,V.jsx)(p,{options:f,value:h,onChange:m,onSelectNone:()=>m(Z),"aria-label":e(`voicePage.microphoneAriaLabel`)})}),r&&(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(i,{variant:`outlined`,onClick:d,children:e(`voicePage.allowMicrophoneAccess`)}),(0,V.jsx)(`span`,{className:Y,children:e(`voicePage.grantMicrophoneAccessHint`)})]})]})})}var qe=new Set([`Control`,`Alt`,`Shift`,`Meta`]),Q=`toggleVoice`,Je=[{label:`Ctrl+Shift`,activator:{kind:`modifierOnly`,modifiers:[`control`,`shift`]}},{label:`Alt`,activator:{kind:`modifierOnly`,modifiers:[`option`]}}];function Ye(){let{t:e}=L(`settings`),t=h(),[n,r]=(0,B.useState)(()=>le()),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)([]),[c,l]=(0,B.useState)(!1),u=(0,B.useRef)(null),d=(0,B.useMemo)(()=>{let e=ve();return[{label:w(e),activator:e}]},[]),f=n.kind!==`off`,p=(0,B.useCallback)(e=>{r(e),re(e),a(!1),s([]),l(!1)},[]),m=De({onBound:()=>p({kind:`off`})}),g=m.catalog.find(e=>e.key===Q)?.accelerator??``,_=m.recordingKey===Q,v=he()?Je:[],y=(0,B.useCallback)(e=>{p(e),m.removeHotkey(Q)},[m,p]),b=(0,B.useCallback)(()=>{p({kind:`off`}),m.removeHotkey(Q)},[m,p]),x=(0,B.useCallback)(()=>{a(!0),s([]),l(!1),requestAnimationFrame(()=>{u.current?.focus()})},[]),C=(0,B.useCallback)(()=>{a(!1),s([]),l(!1)},[]),T=(0,B.useCallback)(e=>{let t=[];return e.ctrlKey&&t.push(`control`),e.altKey&&t.push(`option`),e.shiftKey&&t.push(`shift`),e.metaKey&&t.push(`command`),t},[]),E=(0,B.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){C();return}let t=T(e);if(qe.has(e.key)){l(!1),s(D(t));return}if(t.length===0){l(!0);return}p({kind:`key`,label:e.key.length===1?e.key.toUpperCase():e.key,modifiers:D(t)})},[C,T,p]),O=(0,B.useCallback)(e=>{i&&T(e).length===0&&o.length>0&&(s([]),l(!0))},[T,i,o]);(0,B.useEffect)(()=>{if(!i)return;let e=e=>{u.current&&!u.current.contains(e.target)&&C()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[C,i]);let k=f&&!d.some(e=>M(e.activator,n));return t?(0,V.jsx)(z,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitleDesktop`),children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[v.map(e=>(0,V.jsx)(H,{label:e.label,selected:M(e.activator,n),onClick:()=>y(e.activator)},e.label)),(0,V.jsx)(H,{label:_?e(`voicePage.recordingPrompt`):g?(0,V.jsx)(ye,{accelerator:g}):e(`voicePage.customKey`),selected:g!==``,recording:_,onClick:_?m.stopRecording:()=>m.startRecording(Q)}),(0,V.jsx)(H,{label:e(`voicePage.offKeyLabel`),selected:n.kind===`off`&&!g&&!_,onClick:b})]}),m.conflict?.key===Q&&(0,V.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,V.jsx)(R,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:e(`voicePage.shortcutConflict`,{command:m.conflict.label})})]})]})}):(0,V.jsx)(z,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitle`),children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsx)(S,{checked:f,onChange:e=>{p(e?ee():{kind:`off`})},label:e(`voicePage.enableVoiceShortcut`)}),f&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsx)(`span`,{className:Y,children:e(`voicePage.activationKeyLabel`)}),(0,V.jsxs)(`div`,{ref:u,tabIndex:i?0:-1,onKeyDown:i?E:void 0,onKeyUp:i?O:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[d.map(e=>(0,V.jsx)(H,{label:e.label,selected:M(e.activator,n),onClick:()=>p(e.activator)},e.label)),i?(0,V.jsx)(H,{label:o.length>0?N(o):e(`voicePage.pressShortcut`),selected:!0,recording:!0,onClick:C}):(0,V.jsx)(H,{label:k?w(n):e(`voicePage.customKey`),selected:k,onClick:x})]}),c&&(0,V.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,V.jsx)(R,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:e(`voicePage.shortcutChordHint`)})]}),f&&(0,V.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,V.jsx)(R,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,V.jsx)(`span`,{children:e(`voicePage.focusedTabNote`)})]})]})]})})}function Xe(){let{t:e}=L(`settings`),t=a.use.pauseBeforeReplyMs(),n=a.use.setPauseBeforeReplyMs(),r=a.use.interruptSensitivity(),o=a.use.setInterruptSensitivity(),s=(0,B.useMemo)(()=>[{value:`low`,label:e(`voicePage.interruptSensitivityLow`)},{value:`medium`,label:e(`voicePage.interruptSensitivityMedium`)},{value:`high`,label:e(`voicePage.interruptSensitivityHigh`)}],[e]),l=t!==null||r!==null;return(0,V.jsx)(z,{title:e(`voicePage.turnTakingTitle`),subtitle:e(`voicePage.turnTakingSubtitle`),children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,V.jsx)(Ae,{}),(0,V.jsx)($,{label:e(`voicePage.pauseBeforeReplyLabel`),description:e(`voicePage.pauseBeforeReplyDescription`),isDefault:t===null,children:(0,V.jsx)(`div`,{className:`max-w-xs`,children:(0,V.jsx)(v,{value:(t??1200)/1e3,onValueChange:e=>{typeof e==`number`&&n(Math.round(e*1e3))},min:500/1e3,max:c/1e3,step:.1,showValue:!0,formatValue:e=>`${(typeof e==`number`?e:e[0]).toFixed(1)}s`,"aria-label":e(`voicePage.pauseBeforeReplyAriaLabel`)})})}),(0,V.jsx)($,{label:e(`voicePage.interruptSensitivityLabel`),description:e(`voicePage.interruptSensitivityDescription`),isDefault:r===null,children:(0,V.jsx)(`div`,{className:`max-w-xs`,children:(0,V.jsx)(f,{items:s,value:r??`medium`,onChange:o,ariaLabel:e(`voicePage.interruptSensitivityAriaLabel`)})})}),l&&(0,V.jsx)(`div`,{children:(0,V.jsx)(i,{variant:`outlined`,onClick:()=>{n(null),o(null)},children:e(`voicePage.resetToDefaults`)})})]})})}function $({label:e,description:t,isDefault:n,children:r}){let{t:i}=L(`settings`);return(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e}),n&&(0,V.jsx)(`span`,{className:`shrink-0 rounded-full bg-[var(--surface-active)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:i(`voicePage.defaultBadge`)})]}),(0,V.jsx)(`p`,{className:Y,children:t}),r]})}export{He as VoicePage};
@@ -1 +1 @@
1
- import{Gn as e,Tn as t,wn as n}from"./app-CGffgaON.js";import{t as r}from"./react-BJ4PZBJN.js";import{w as i}from"./vendor-CezcraPH.js";import{$ as a}from"./icons-Dwi7aA1Y.js";var o=r();function s({payload:n,onClose:r}){let{t:s}=i(`chat`),u=t(n.body);return(0,o.jsx)(e,{Glyph:a,title:n.title||s(`wakeDetailPanel.title`),closeLabel:s(`wakeDetailPanel.closeAria`),closeVariant:`outlined`,onClose:r,children:(0,o.jsxs)(`dl`,{className:`flex flex-col gap-5`,children:[u.workflow&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.workflow`),children:u.workflow}),u.runStatus&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.runStatus`),children:(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:u.runStatus})}),u.result&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.result`),children:(0,o.jsx)(c,{result:u.result})}),u.rest&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.details`),children:(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:u.rest})}),n.metadata.length>0&&(0,o.jsx)(`div`,{className:`flex flex-col gap-5`,children:n.metadata.map(e=>(0,o.jsx)(l,{label:e.label,children:e.value},e.label))})]})})}function c({result:e}){let t=n(e);return t?(0,o.jsx)(`div`,{className:`flex flex-col gap-4`,children:t.map((e,t)=>(0,o.jsx)(`div`,{className:t>0?`flex flex-col gap-2 border-t border-[var(--border-hover)] pt-4`:`flex flex-col gap-2`,children:e.map(e=>(0,o.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,o.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:e.key}),(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:e.value})]},e.key))},t))}):(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:e})}function l({label:e,children:t}){return(0,o.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`dt`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:e}),(0,o.jsx)(`dd`,{className:`text-body-medium-default text-[var(--content-default)]`,children:t})]})}export{s as WakeDetailPanel};
1
+ import{Gn as e,Tn as t,wn as n}from"./app-BNxKtvfM.js";import{t as r}from"./react-BJ4PZBJN.js";import{w as i}from"./vendor-CezcraPH.js";import{$ as a}from"./icons-Dwi7aA1Y.js";var o=r();function s({payload:n,onClose:r}){let{t:s}=i(`chat`),u=t(n.body);return(0,o.jsx)(e,{Glyph:a,title:n.title||s(`wakeDetailPanel.title`),closeLabel:s(`wakeDetailPanel.closeAria`),closeVariant:`outlined`,onClose:r,children:(0,o.jsxs)(`dl`,{className:`flex flex-col gap-5`,children:[u.workflow&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.workflow`),children:u.workflow}),u.runStatus&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.runStatus`),children:(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:u.runStatus})}),u.result&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.result`),children:(0,o.jsx)(c,{result:u.result})}),u.rest&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.details`),children:(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:u.rest})}),n.metadata.length>0&&(0,o.jsx)(`div`,{className:`flex flex-col gap-5`,children:n.metadata.map(e=>(0,o.jsx)(l,{label:e.label,children:e.value},e.label))})]})})}function c({result:e}){let t=n(e);return t?(0,o.jsx)(`div`,{className:`flex flex-col gap-4`,children:t.map((e,t)=>(0,o.jsx)(`div`,{className:t>0?`flex flex-col gap-2 border-t border-[var(--border-hover)] pt-4`:`flex flex-col gap-2`,children:e.map(e=>(0,o.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,o.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:e.key}),(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:e.value})]},e.key))},t))}):(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:e})}function l({label:e,children:t}){return(0,o.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`dt`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:e}),(0,o.jsx)(`dd`,{className:`text-body-medium-default text-[var(--content-default)]`,children:t})]})}export{s as WakeDetailPanel};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$t as t,Qt as n,Xt as r,Zo as i,Zt as a}from"./app-CGffgaON.js";import{t as o,x as s}from"./react-BJ4PZBJN.js";import{w as c}from"./vendor-CezcraPH.js";import{Ci as l,Si as u,V as d,_i as f,bi as p,c as m,ni as h,tt as g,vi as _,vn as v,xi as y}from"./icons-Dwi7aA1Y.js";var b=e(s(),1),x={"sun.max.fill":{icon:d,className:`text-orange-500`},"cloud.sun.fill":{icon:_,className:`text-amber-400`},"moon.fill":{icon:v,className:`text-blue-400`},"cloud.moon.fill":{icon:y,className:`text-blue-400`},"cloud.fill":{icon:f,className:`text-stone-400`},"cloud.rain.fill":{icon:p,className:`text-blue-400`},snowflake:{icon:g,className:`text-blue-300`},"cloud.bolt.fill":{icon:u,className:`text-orange-500`},"cloud.fog.fill":{icon:l,className:`text-stone-400`}},S={sunny:{icon:d,className:`text-orange-500`},clear:{icon:d,className:`text-orange-500`},"partly cloudy":{icon:_,className:`text-amber-400`},"mostly sunny":{icon:_,className:`text-amber-400`},cloudy:{icon:f,className:`text-stone-400`},overcast:{icon:f,className:`text-stone-400`},rainy:{icon:p,className:`text-blue-400`},rain:{icon:p,className:`text-blue-400`},drizzle:{icon:p,className:`text-blue-400`},snow:{icon:g,className:`text-blue-300`},snowy:{icon:g,className:`text-blue-300`},thunderstorm:{icon:u,className:`text-orange-500`},thunder:{icon:u,className:`text-orange-500`},foggy:{icon:l,className:`text-stone-400`},fog:{icon:l,className:`text-stone-400`},mist:{icon:l,className:`text-stone-400`},hazy:{icon:l,className:`text-stone-400`},night:{icon:v,className:`text-blue-400`},"mainly clear":{icon:d,className:`text-orange-500`},"mostly cloudy":{icon:f,className:`text-stone-400`},breezy:{icon:m,className:`text-stone-400`},windy:{icon:m,className:`text-stone-400`},cool:{icon:f,className:`text-stone-400`},warm:{icon:d,className:`text-orange-500`},hot:{icon:d,className:`text-orange-500`},cold:{icon:g,className:`text-blue-300`},"cold snap":{icon:g,className:`text-blue-300`},"warm, mostly sunny":{icon:_,className:`text-amber-400`},"cooler, breezy":{icon:m,className:`text-stone-400`}},C={icon:f,className:`text-stone-400`};function w(e){let t=x[e];if(t)return t;let n=e.toLowerCase(),r=S[n];if(r)return r;for(let[e,t]of Object.entries(S))if(n.includes(e))return t;return C}function T(e){if(typeof e==`string`){let t=e.match(/^(\d+)\s*mph\s*(.*)/i);if(t)return{speed:Number(t[1]),direction:t[2]?.trim()||void 0}}return{}}function E(e){let i;if(typeof e.location==`string`)i=e.location;else{let t=n(e.location);t&&typeof t.name==`string`&&(i=t.name)}if(!i)return null;let o=n(e.current),s=a(o?.temp)??a(e.currentTemp)??a(e.temperature)??a(e.temp),c=a(o?.feelsLike)??a(o?.feels_like)??a(o?.apparentTemperature)??a(e.feelsLike)??a(e.feels_like)??a(e.apparentTemperature),l=t(o?.condition)??t(e.condition),u=a(o?.humidity)??a(e.humidity),d=T(o?.wind??e.wind),f=a(o?.windSpeed)??a(o?.wind_speed)??a(e.windSpeed)??a(e.wind_speed)??d.speed,p=t(o?.windDirection)??t(o?.wind_direction)??t(e.windDirection)??t(e.wind_direction)??d.direction,m=n(e.units),h=t(m?.temperature)??t(o?.unit)??t(e.unit)??`F`,g=t(m?.speed)??t(e.windUnit)??t(e.wind_unit),_=r(e.hourly).map((e,n)=>({id:t(e.id)??String(n),time:t(e.time)??``,icon:t(e.icon)??t(e.condition)??`cloud.fill`,temp:a(e.tempC)??a(e.temp)??a(e.temperature),tempC:a(e.tempC)})),v=r([e.forecast,e.daily,e.days].find(Array.isArray)).map((e,n)=>({id:t(e.id)??String(n),day:t(e.day)??t(e.date),dayLabel:t(e.dayLabel)??t(e.date),icon:t(e.icon)??t(e.condition)??`cloud.fill`,low:a(e.low),high:a(e.high),lowC:a(e.lowC),highC:a(e.highC),precip:a(e.precip)??a(e.precipitation)??a(e.precipitationProbability),condition:t(e.condition)}));return{location:i,currentTemp:s,feelsLike:c,condition:l,humidity:u,windSpeed:f,windDirection:p,windUnit:g,unit:h,hourly:_.length>0?_:void 0,forecast:v.length>0?v:void 0}}function D(e){return e*9/5+32}function O(e){return(e-32)*5/9}function k(e,t,n){if(e===void 0)return null;let r=e;return t&&!n&&(r=O(e)),!t&&n&&(r=D(e)),`${Math.round(r)}`}function A(e,t,n){return e.tempC===void 0?e.temp===void 0?null:k(e.temp,t,n):k(e.tempC,!1,n)}function j(e,t,n){return e.lowC===void 0?k(e.low,t,n):k(e.lowC,!1,n)}function M(e,t,n){return e.highC===void 0?k(e.high,t,n):k(e.highC,!1,n)}var N=o();function P({icon:e,size:t=20}){let{icon:n,className:r}=w(e);return(0,N.jsx)(n,{width:t,height:t,className:r})}function F({useFahrenheit:e,onToggle:t}){let{t:n}=c(`chat`);return(0,N.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border border-[var(--border-element)]`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(!0),className:i(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-[var(--primary-base)] text-[var(--content-inset)]`:`bg-transparent text-[var(--content-quiet)]`),children:n(`weatherForecastDisplay.fahrenheit`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(!1),className:i(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-transparent text-[var(--content-quiet)]`:`bg-[var(--primary-base)] text-[var(--content-inset)]`),children:n(`weatherForecastDisplay.celsius`)})]})}function I({data:e,sourceIsFahrenheit:t,useFahrenheit:n,onToggle:r}){let{t:i}=c(`chat`),a=e.location,o=k(e.currentTemp,t,n),s=k(e.feelsLike,t,n),l=n?`F`:`C`,u=e.forecast?.[0],d=u?M(u,t,n):null,f=u?j(u,t,n):null,p=null;return e.windSpeed!==void 0&&(p=`${Math.round(e.windSpeed)} ${e.windUnit??`mph`}`,e.windDirection&&(p=`${e.windDirection} ${p}`)),(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:a}),o!==null&&(0,N.jsxs)(`div`,{className:`mt-1 text-4xl font-light text-[var(--content-default)]`,children:[o,`°`,l]}),e.condition&&(0,N.jsx)(`div`,{className:`mt-0.5 text-body-small-default text-[var(--content-quiet)]`,children:e.condition})]}),(0,N.jsx)(F,{useFahrenheit:n,onToggle:r})]}),(0,N.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3`,children:[s!==null&&(0,N.jsx)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:i(`weatherForecastDisplay.feelsLike`,{temp:s})}),d!==null&&f!==null&&(0,N.jsx)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:i(`weatherForecastDisplay.highLow`,{high:d,low:f})}),p&&(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,N.jsx)(m,{width:12,height:12}),p]}),e.humidity!==void 0&&(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,N.jsx)(h,{width:12,height:12}),e.humidity,`%`]})]})]})}function L({hourly:e,sourceIsFahrenheit:t,useFahrenheit:n}){let{t:r}=c(`chat`);return(0,N.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,N.jsx)(`div`,{className:`flex gap-3 overflow-x-auto`,children:e.map((e,i)=>{let a=e.time.toLowerCase()===`now`,o=A(e,t,n);return(0,N.jsxs)(`div`,{className:`flex min-w-[3rem] shrink-0 flex-col items-center gap-1`,children:[(0,N.jsx)(`span`,{className:a?`text-body-small-emphasised text-[var(--content-default)]`:`text-label-medium-default text-[var(--content-quiet)]`,children:a?r(`weatherForecastDisplay.now`):e.time}),(0,N.jsx)(P,{icon:e.icon,size:18}),o!==null&&(0,N.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-default)]`,children:[o,`°`]})]},e.id??i)})})})}function R({forecast:e,currentTemp:t,sourceIsFahrenheit:n,useFahrenheit:r}){let{globalMin:a,globalMax:o}=(0,b.useMemo)(()=>{let t=1/0,n=-1/0;for(let r of e){let e=r.lowC??r.low,i=r.highC??r.high;e!==void 0&&e<t&&(t=e),i!==void 0&&i>n&&(n=i)}return{globalMin:t===1/0?0:t,globalMax:n===-1/0?100:n}},[e]),s=o-a||1;return(0,N.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,N.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map((e,c)=>{let l=e.dayLabel??e.day??`Day ${c+1}`,u=l.toLowerCase()===`today`,d=j(e,n,r),f=M(e,n,r),p=e.precip,m=e.lowC??e.low??a,h=e.highC??e.high??o,g=(m-a)/s*100,_=(h-a)/s*100,v=Math.max(_-g,2),y=null;if(u&&t!==void 0){let r=(e.lowC!==void 0||e.highC!==void 0)&&n?(t-32)*5/9:t;y=h===m?50:(Math.max(m,Math.min(h,r))-m)/(h-m)*100}return(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:i(`w-12 shrink-0 truncate text-body-small-default`,u?`text-[var(--content-default)]`:`text-[var(--content-quiet)]`),children:l}),(0,N.jsxs)(`div`,{className:`flex w-10 shrink-0 items-center justify-center gap-0.5`,children:[(0,N.jsx)(P,{icon:e.icon,size:16}),p!==void 0&&p>0&&(0,N.jsxs)(`span`,{className:`text-label-small-default text-blue-400`,children:[Math.round(p),`%`]})]}),(0,N.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-faint)]`,children:d===null?`--`:`${d}°`}),(0,N.jsxs)(`div`,{className:`relative h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--border-subtle)]`,children:[(0,N.jsx)(`div`,{className:`absolute top-0 h-full rounded-full bg-[var(--primary-base)]`,style:{left:`${g}%`,width:`${v}%`}}),y!==null&&(0,N.jsx)(`div`,{className:`absolute top-1/2 h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-[var(--aux-white)] bg-[var(--aux-white)] shadow-sm`,style:{left:`${g+y/100*v}%`}})]}),(0,N.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-default)]`,children:f===null?`--`:`${f}°`})]},e.id??c)})})})}function z({templateData:e,fallback:t}){let n=(0,b.useMemo)(()=>E(e),[e]),r=n?.unit?.toUpperCase()===`F`||n?.unit?.toLowerCase()===`fahrenheit`,[i,a]=(0,b.useState)(null),o=i??r;return!n||n.currentTemp===void 0&&!n.forecast?.length?t??null:(0,N.jsxs)(`div`,{className:`mt-3`,children:[(0,N.jsx)(I,{data:n,sourceIsFahrenheit:r,useFahrenheit:o,onToggle:a}),n.hourly&&n.hourly.length>0&&(0,N.jsx)(L,{hourly:n.hourly,sourceIsFahrenheit:r,useFahrenheit:o}),n.forecast&&n.forecast.length>0&&(0,N.jsx)(R,{forecast:n.forecast,currentTemp:n.currentTemp,sourceIsFahrenheit:r,useFahrenheit:o})]})}export{z as WeatherForecastDisplay};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$t as t,Qt as n,Xt as r,Zo as i,Zt as a}from"./app-BNxKtvfM.js";import{t as o,x as s}from"./react-BJ4PZBJN.js";import{w as c}from"./vendor-CezcraPH.js";import{Ci as l,Si as u,V as d,_i as f,bi as p,c as m,ni as h,tt as g,vi as _,vn as v,xi as y}from"./icons-Dwi7aA1Y.js";var b=e(s(),1),x={"sun.max.fill":{icon:d,className:`text-orange-500`},"cloud.sun.fill":{icon:_,className:`text-amber-400`},"moon.fill":{icon:v,className:`text-blue-400`},"cloud.moon.fill":{icon:y,className:`text-blue-400`},"cloud.fill":{icon:f,className:`text-stone-400`},"cloud.rain.fill":{icon:p,className:`text-blue-400`},snowflake:{icon:g,className:`text-blue-300`},"cloud.bolt.fill":{icon:u,className:`text-orange-500`},"cloud.fog.fill":{icon:l,className:`text-stone-400`}},S={sunny:{icon:d,className:`text-orange-500`},clear:{icon:d,className:`text-orange-500`},"partly cloudy":{icon:_,className:`text-amber-400`},"mostly sunny":{icon:_,className:`text-amber-400`},cloudy:{icon:f,className:`text-stone-400`},overcast:{icon:f,className:`text-stone-400`},rainy:{icon:p,className:`text-blue-400`},rain:{icon:p,className:`text-blue-400`},drizzle:{icon:p,className:`text-blue-400`},snow:{icon:g,className:`text-blue-300`},snowy:{icon:g,className:`text-blue-300`},thunderstorm:{icon:u,className:`text-orange-500`},thunder:{icon:u,className:`text-orange-500`},foggy:{icon:l,className:`text-stone-400`},fog:{icon:l,className:`text-stone-400`},mist:{icon:l,className:`text-stone-400`},hazy:{icon:l,className:`text-stone-400`},night:{icon:v,className:`text-blue-400`},"mainly clear":{icon:d,className:`text-orange-500`},"mostly cloudy":{icon:f,className:`text-stone-400`},breezy:{icon:m,className:`text-stone-400`},windy:{icon:m,className:`text-stone-400`},cool:{icon:f,className:`text-stone-400`},warm:{icon:d,className:`text-orange-500`},hot:{icon:d,className:`text-orange-500`},cold:{icon:g,className:`text-blue-300`},"cold snap":{icon:g,className:`text-blue-300`},"warm, mostly sunny":{icon:_,className:`text-amber-400`},"cooler, breezy":{icon:m,className:`text-stone-400`}},C={icon:f,className:`text-stone-400`};function w(e){let t=x[e];if(t)return t;let n=e.toLowerCase(),r=S[n];if(r)return r;for(let[e,t]of Object.entries(S))if(n.includes(e))return t;return C}function T(e){if(typeof e==`string`){let t=e.match(/^(\d+)\s*mph\s*(.*)/i);if(t)return{speed:Number(t[1]),direction:t[2]?.trim()||void 0}}return{}}function E(e){let i;if(typeof e.location==`string`)i=e.location;else{let t=n(e.location);t&&typeof t.name==`string`&&(i=t.name)}if(!i)return null;let o=n(e.current),s=a(o?.temp)??a(e.currentTemp)??a(e.temperature)??a(e.temp),c=a(o?.feelsLike)??a(o?.feels_like)??a(o?.apparentTemperature)??a(e.feelsLike)??a(e.feels_like)??a(e.apparentTemperature),l=t(o?.condition)??t(e.condition),u=a(o?.humidity)??a(e.humidity),d=T(o?.wind??e.wind),f=a(o?.windSpeed)??a(o?.wind_speed)??a(e.windSpeed)??a(e.wind_speed)??d.speed,p=t(o?.windDirection)??t(o?.wind_direction)??t(e.windDirection)??t(e.wind_direction)??d.direction,m=n(e.units),h=t(m?.temperature)??t(o?.unit)??t(e.unit)??`F`,g=t(m?.speed)??t(e.windUnit)??t(e.wind_unit),_=r(e.hourly).map((e,n)=>({id:t(e.id)??String(n),time:t(e.time)??``,icon:t(e.icon)??t(e.condition)??`cloud.fill`,temp:a(e.tempC)??a(e.temp)??a(e.temperature),tempC:a(e.tempC)})),v=r([e.forecast,e.daily,e.days].find(Array.isArray)).map((e,n)=>({id:t(e.id)??String(n),day:t(e.day)??t(e.date),dayLabel:t(e.dayLabel)??t(e.date),icon:t(e.icon)??t(e.condition)??`cloud.fill`,low:a(e.low),high:a(e.high),lowC:a(e.lowC),highC:a(e.highC),precip:a(e.precip)??a(e.precipitation)??a(e.precipitationProbability),condition:t(e.condition)}));return{location:i,currentTemp:s,feelsLike:c,condition:l,humidity:u,windSpeed:f,windDirection:p,windUnit:g,unit:h,hourly:_.length>0?_:void 0,forecast:v.length>0?v:void 0}}function D(e){return e*9/5+32}function O(e){return(e-32)*5/9}function k(e,t,n){if(e===void 0)return null;let r=e;return t&&!n&&(r=O(e)),!t&&n&&(r=D(e)),`${Math.round(r)}`}function A(e,t,n){return e.tempC===void 0?e.temp===void 0?null:k(e.temp,t,n):k(e.tempC,!1,n)}function j(e,t,n){return e.lowC===void 0?k(e.low,t,n):k(e.lowC,!1,n)}function M(e,t,n){return e.highC===void 0?k(e.high,t,n):k(e.highC,!1,n)}var N=o();function P({icon:e,size:t=20}){let{icon:n,className:r}=w(e);return(0,N.jsx)(n,{width:t,height:t,className:r})}function F({useFahrenheit:e,onToggle:t}){let{t:n}=c(`chat`);return(0,N.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border border-[var(--border-element)]`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(!0),className:i(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-[var(--primary-base)] text-[var(--content-inset)]`:`bg-transparent text-[var(--content-quiet)]`),children:n(`weatherForecastDisplay.fahrenheit`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(!1),className:i(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-transparent text-[var(--content-quiet)]`:`bg-[var(--primary-base)] text-[var(--content-inset)]`),children:n(`weatherForecastDisplay.celsius`)})]})}function I({data:e,sourceIsFahrenheit:t,useFahrenheit:n,onToggle:r}){let{t:i}=c(`chat`),a=e.location,o=k(e.currentTemp,t,n),s=k(e.feelsLike,t,n),l=n?`F`:`C`,u=e.forecast?.[0],d=u?M(u,t,n):null,f=u?j(u,t,n):null,p=null;return e.windSpeed!==void 0&&(p=`${Math.round(e.windSpeed)} ${e.windUnit??`mph`}`,e.windDirection&&(p=`${e.windDirection} ${p}`)),(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:a}),o!==null&&(0,N.jsxs)(`div`,{className:`mt-1 text-4xl font-light text-[var(--content-default)]`,children:[o,`°`,l]}),e.condition&&(0,N.jsx)(`div`,{className:`mt-0.5 text-body-small-default text-[var(--content-quiet)]`,children:e.condition})]}),(0,N.jsx)(F,{useFahrenheit:n,onToggle:r})]}),(0,N.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3`,children:[s!==null&&(0,N.jsx)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:i(`weatherForecastDisplay.feelsLike`,{temp:s})}),d!==null&&f!==null&&(0,N.jsx)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:i(`weatherForecastDisplay.highLow`,{high:d,low:f})}),p&&(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,N.jsx)(m,{width:12,height:12}),p]}),e.humidity!==void 0&&(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,N.jsx)(h,{width:12,height:12}),e.humidity,`%`]})]})]})}function L({hourly:e,sourceIsFahrenheit:t,useFahrenheit:n}){let{t:r}=c(`chat`);return(0,N.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,N.jsx)(`div`,{className:`flex gap-3 overflow-x-auto`,children:e.map((e,i)=>{let a=e.time.toLowerCase()===`now`,o=A(e,t,n);return(0,N.jsxs)(`div`,{className:`flex min-w-[3rem] shrink-0 flex-col items-center gap-1`,children:[(0,N.jsx)(`span`,{className:a?`text-body-small-emphasised text-[var(--content-default)]`:`text-label-medium-default text-[var(--content-quiet)]`,children:a?r(`weatherForecastDisplay.now`):e.time}),(0,N.jsx)(P,{icon:e.icon,size:18}),o!==null&&(0,N.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-default)]`,children:[o,`°`]})]},e.id??i)})})})}function R({forecast:e,currentTemp:t,sourceIsFahrenheit:n,useFahrenheit:r}){let{globalMin:a,globalMax:o}=(0,b.useMemo)(()=>{let t=1/0,n=-1/0;for(let r of e){let e=r.lowC??r.low,i=r.highC??r.high;e!==void 0&&e<t&&(t=e),i!==void 0&&i>n&&(n=i)}return{globalMin:t===1/0?0:t,globalMax:n===-1/0?100:n}},[e]),s=o-a||1;return(0,N.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,N.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map((e,c)=>{let l=e.dayLabel??e.day??`Day ${c+1}`,u=l.toLowerCase()===`today`,d=j(e,n,r),f=M(e,n,r),p=e.precip,m=e.lowC??e.low??a,h=e.highC??e.high??o,g=(m-a)/s*100,_=(h-a)/s*100,v=Math.max(_-g,2),y=null;if(u&&t!==void 0){let r=(e.lowC!==void 0||e.highC!==void 0)&&n?(t-32)*5/9:t;y=h===m?50:(Math.max(m,Math.min(h,r))-m)/(h-m)*100}return(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:i(`w-12 shrink-0 truncate text-body-small-default`,u?`text-[var(--content-default)]`:`text-[var(--content-quiet)]`),children:l}),(0,N.jsxs)(`div`,{className:`flex w-10 shrink-0 items-center justify-center gap-0.5`,children:[(0,N.jsx)(P,{icon:e.icon,size:16}),p!==void 0&&p>0&&(0,N.jsxs)(`span`,{className:`text-label-small-default text-blue-400`,children:[Math.round(p),`%`]})]}),(0,N.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-faint)]`,children:d===null?`--`:`${d}°`}),(0,N.jsxs)(`div`,{className:`relative h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--border-subtle)]`,children:[(0,N.jsx)(`div`,{className:`absolute top-0 h-full rounded-full bg-[var(--primary-base)]`,style:{left:`${g}%`,width:`${v}%`}}),y!==null&&(0,N.jsx)(`div`,{className:`absolute top-1/2 h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-[var(--aux-white)] bg-[var(--aux-white)] shadow-sm`,style:{left:`${g+y/100*v}%`}})]}),(0,N.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-default)]`,children:f===null?`--`:`${f}°`})]},e.id??c)})})})}function z({templateData:e,fallback:t}){let n=(0,b.useMemo)(()=>E(e),[e]),r=n?.unit?.toUpperCase()===`F`||n?.unit?.toLowerCase()===`fahrenheit`,[i,a]=(0,b.useState)(null),o=i??r;return!n||n.currentTemp===void 0&&!n.forecast?.length?t??null:(0,N.jsxs)(`div`,{className:`mt-3`,children:[(0,N.jsx)(I,{data:n,sourceIsFahrenheit:r,useFahrenheit:o,onToggle:a}),n.hourly&&n.hourly.length>0&&(0,N.jsx)(L,{hourly:n.hourly,sourceIsFahrenheit:r,useFahrenheit:o}),n.forecast&&n.forecast.length>0&&(0,N.jsx)(R,{forecast:n.forecast,currentTemp:n.currentTemp,sourceIsFahrenheit:r,useFahrenheit:o})]})}export{z as WeatherForecastDisplay};
@@ -1 +1 @@
1
- import{Ai as e,Gx as t,lx as n}from"./app-CGffgaON.js";import{f as r,t as i}from"./react-BJ4PZBJN.js";import{w as a}from"./vendor-CezcraPH.js";import{t as o}from"./auth-welcome-screen-D3ES6d_K.js";var s=i();function c(){let{t:i}=a(`onboarding`),c=r();return(0,s.jsx)(o,{secondary:{label:i(`welcome.continueWithoutAccount`),onSelect:()=>{n()?c(t.selectAssistant,e):c(t.onboarding.hosting,e)}}})}export{c as WelcomeScreen};
1
+ import{Ai as e,Gx as t,lx as n}from"./app-BNxKtvfM.js";import{f as r,t as i}from"./react-BJ4PZBJN.js";import{w as a}from"./vendor-CezcraPH.js";import{t as o}from"./auth-welcome-screen-EpKCTMv_.js";var s=i();function c(){let{t:i}=a(`onboarding`),c=r();return(0,s.jsx)(o,{secondary:{label:i(`welcome.continueWithoutAccount`),onSelect:()=>{n()?c(t.selectAssistant,e):c(t.onboarding.hosting,e)}}})}export{c as WelcomeScreen};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Bn as t,CC as n,Di as r,Gn as i,Jn as a,Ln as o,Vn as s,fC as c,gu as l,hu as u,mu as d}from"./app-CGffgaON.js";import{t as f,x as p}from"./react-BJ4PZBJN.js";import{d as m,f as h,s as g,w as _}from"./vendor-CezcraPH.js";import{Aa as v,D as y,Gi as b,Ha as x,Ki as S,o as C,y as w,zi as T}from"./icons-Dwi7aA1Y.js";import{n as E,r as D,t as O}from"./animated-stat-square-BU2cZ2yE.js";import{o as k,t as A}from"./detail-primitives-PCZSBjkS.js";import{t as j}from"./detail-panel-stop-button-JQH92FSa.js";import{t as M}from"./status-badge-pill-CND5rJPR.js";var N=e(p(),1),P=f();function F({title:e,body:t,emptyText:n}){return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(k,{as:`h3`,children:e}),t?(0,P.jsx)(A,{label:e,children:(0,P.jsx)(c,{variant:`body-medium-lighter`,as:`p`,className:`whitespace-pre-wrap break-words leading-relaxed text-[var(--content-default)]`,children:t})}):(0,P.jsx)(a,{placement:`section`,children:n})]})}function I({leaf:e}){let{t}=_(`chat`),n=e.status===`running`?t(`workflowLeafDetail.running`):t(`workflowLeafDetail.noResultSummary`);return(0,P.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,P.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,P.jsx)(O,{icon:(0,P.jsx)(x,{}),target:e.inputTokens??0,format:e=>E(Math.round(e)),label:t(`workflowLeafDetail.input`)}),(0,P.jsx)(O,{icon:(0,P.jsx)(D,{}),target:e.outputTokens??0,format:e=>E(Math.round(e)),label:t(`workflowLeafDetail.output`)})]}),(0,P.jsx)(F,{title:t(`workflowLeafDetail.prompt`),body:e.promptSummary,emptyText:t(`workflowLeafDetail.noPromptSummary`)}),(0,P.jsx)(F,{title:t(`workflowLeafDetail.result`),body:e.resultSummary,emptyText:n})]})}function L({status:e}){return(0,P.jsx)(M,{color:u(e),label:l(e)})}function R(e){switch(e){case`completed`:return`var(--system-positive-strong)`;case`failed`:return`var(--system-negative-strong)`;case`cancelled`:return`var(--content-secondary)`;default:return`var(--primary-base)`}}function z(e){switch(e){case`completed`:return`Completed`;case`failed`:return`Failed`;case`cancelled`:return`Cancelled`;default:return`Running`}}function B({status:e}){return(0,P.jsx)(M,{color:R(e),label:z(e)})}function V({status:e}){let{t}=_(`chat`),n=g(),r=`h-3.5 w-3.5 shrink-0`,i;return i=e===`running`?(0,P.jsx)(o,{className:`shrink-0`,dotSize:4,gap:2}):e===`completed`?(0,P.jsx)(T,{className:r,style:{color:`var(--system-positive-strong)`}}):e===`failed`?(0,P.jsx)(y,{className:r,style:{color:`var(--system-negative-strong)`}}):(0,P.jsx)(v,{className:r,style:{color:`var(--content-secondary)`},role:`img`,"aria-label":t(`workflowSubagentRow.cancelledAria`)}),(0,P.jsx)(h,{mode:`wait`,initial:!1,children:(0,P.jsx)(m.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:n?{duration:0}:{duration:.15,ease:[.16,1,.3,1]},className:`flex shrink-0 items-center`,children:i},e)})}function H({runId:e,leaf:n,components:r,onSelect:i}){let{t:a}=_(`chat`),o=n.label??`Subagent ${n.seq}`,l=n.promptSummary,u=t(`${e}:${n.seq}`);return(0,P.jsx)(`button`,{type:`button`,onClick:i,"aria-label":a(`workflowSubagentRow.openDetailsAria`,{title:o}),className:`flex w-full cursor-pointer items-center justify-between gap-2 rounded-[6px] px-2 py-1.5 text-left transition-colors hover:bg-[var(--surface-overlay)]`,children:(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,P.jsx)(V,{status:n.status}),r?(0,P.jsx)(s,{components:r,bodyShapeId:u.bodyShape,eyeStyleId:u.eyeStyle,colorId:u.color,size:16}):(0,P.jsx)(`div`,{style:{width:16,height:16,flexShrink:0},"aria-hidden":!0}),(0,P.jsx)(c,{variant:`body-medium-default`,title:o,className:`max-w-[60%] shrink-0 truncate text-[var(--content-default)]`,children:o}),l&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-[var(--content-tertiary)] opacity-10`,children:`|`}),(0,P.jsx)(c,{variant:`body-medium-lighter`,title:l,className:`min-w-0 truncate text-[var(--content-tertiary)]`,children:l})]})]})})}function U({entry:e,onClose:o,onStop:l,onRequestJournal:u}){let{t:f}=_(`chat`),p=d(e.status),h=g(),v=e.label??e.runId,y=e.agentsSpawned||e.leaves.size,T=r(),A=[...e.leaves.values()].sort((e,t)=>e.seq-t.seq),[M,F]=(0,N.useState)(null),[R,z]=(0,N.useState)(e.runId);R!==e.runId&&(z(e.runId),F(null));let V=M==null?void 0:e.leaves.get(M),U=V?t(`${e.runId}:${V.seq}`):void 0,W=(0,N.useCallback)(()=>F(null),[]),G=V?V.label??`Subagent ${V.seq}`:``,K=V?G:v,q=p?`live`:`final`;return(0,N.useEffect)(()=>{u?.(e.runId)},[e.runId,q,u]),(0,P.jsx)(i,{headerAbove:V&&(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-[var(--border-hover)] px-5 py-3`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:W,title:v,className:`min-w-0 shrink cursor-pointer truncate text-left text-[var(--content-default)] hover:underline`,children:(0,P.jsx)(c,{variant:`body-small-default`,as:`span`,children:v})}),(0,P.jsx)(b,{className:`h-2.5 w-2.5 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":!0}),(0,P.jsx)(c,{variant:`body-small-default`,as:`span`,title:G,className:`min-w-0 shrink truncate text-[var(--content-secondary)]`,children:G})]}),icon:(0,P.jsxs)(P.Fragment,{children:[V&&(0,P.jsx)(n,{variant:`outlined`,iconOnly:(0,P.jsx)(S,{}),onClick:W,"aria-label":f(`workflowDetailPanel.backToSubagentsAria`),tooltip:f(`workflowDetailPanel.back`),className:`shrink-0`}),V?T&&U?(0,P.jsx)(s,{components:T,bodyShapeId:U.bodyShape,eyeStyleId:U.eyeStyle,colorId:U.color,size:32}):(0,P.jsx)(`div`,{style:{width:32,height:32,flexShrink:0},"aria-hidden":!0}):(0,P.jsx)(C,{className:`h-5 w-5 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0})]}),title:K,headerTrailing:V?(0,P.jsx)(B,{status:V.status}):(0,P.jsx)(L,{status:e.status}),headerActions:p&&l?(0,P.jsx)(j,{onStop:()=>l(e.runId),ariaLabel:f(`workflowDetailPanel.stopWorkflow`)}):void 0,closeLabel:f(`workflowDetailPanel.closeDetail`),onClose:o,children:(0,P.jsx)(m.div,{className:`flex flex-col gap-5`,initial:{opacity:0},animate:{opacity:1},transition:h?{duration:0}:{duration:.18,ease:[.16,1,.3,1]},children:V?(0,P.jsx)(I,{leaf:V}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,P.jsx)(O,{icon:(0,P.jsx)(x,{}),target:e.inputTokens,format:e=>E(Math.round(e)),label:f(`workflowDetailPanel.input`)}),(0,P.jsx)(O,{icon:(0,P.jsx)(D,{}),target:e.outputTokens,format:e=>E(Math.round(e)),label:f(`workflowDetailPanel.output`)}),(0,P.jsx)(O,{icon:(0,P.jsx)(w,{}),target:y,format:e=>E(Math.round(e)),label:f(`workflowDetailPanel.agents`)})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(k,{as:`h3`,children:f(`workflowDetailPanel.subagents`)}),A.length===0?(0,P.jsx)(a,{placement:`section`,children:f(`workflowDetailPanel.noSubagentsYet`)}):(0,P.jsx)(`div`,{className:`flex flex-col gap-1`,children:A.map(t=>(0,P.jsx)(H,{runId:e.runId,leaf:t,components:T,onSelect:()=>F(t.seq)},t.seq))})]})]})},V?String(V.seq):`list`)})}export{U as WorkflowDetailPanel};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Bn as t,CC as n,Di as r,Gn as i,Jn as a,Ln as o,Vn as s,fC as c,gu as l,hu as u,mu as d}from"./app-BNxKtvfM.js";import{t as f,x as p}from"./react-BJ4PZBJN.js";import{d as m,f as h,s as g,w as _}from"./vendor-CezcraPH.js";import{Aa as v,D as y,Gi as b,Ha as x,Ki as S,o as C,y as w,zi as T}from"./icons-Dwi7aA1Y.js";import{n as E,r as D,t as O}from"./animated-stat-square-dwxhuRgk.js";import{o as k,t as A}from"./detail-primitives-LOD0kRZ4.js";import{t as j}from"./detail-panel-stop-button-D3b4nxcG.js";import{t as M}from"./status-badge-pill-CND5rJPR.js";var N=e(p(),1),P=f();function F({title:e,body:t,emptyText:n}){return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(k,{as:`h3`,children:e}),t?(0,P.jsx)(A,{label:e,children:(0,P.jsx)(c,{variant:`body-medium-lighter`,as:`p`,className:`whitespace-pre-wrap break-words leading-relaxed text-[var(--content-default)]`,children:t})}):(0,P.jsx)(a,{placement:`section`,children:n})]})}function I({leaf:e}){let{t}=_(`chat`),n=e.status===`running`?t(`workflowLeafDetail.running`):t(`workflowLeafDetail.noResultSummary`);return(0,P.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,P.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,P.jsx)(O,{icon:(0,P.jsx)(x,{}),target:e.inputTokens??0,format:e=>E(Math.round(e)),label:t(`workflowLeafDetail.input`)}),(0,P.jsx)(O,{icon:(0,P.jsx)(D,{}),target:e.outputTokens??0,format:e=>E(Math.round(e)),label:t(`workflowLeafDetail.output`)})]}),(0,P.jsx)(F,{title:t(`workflowLeafDetail.prompt`),body:e.promptSummary,emptyText:t(`workflowLeafDetail.noPromptSummary`)}),(0,P.jsx)(F,{title:t(`workflowLeafDetail.result`),body:e.resultSummary,emptyText:n})]})}function L({status:e}){return(0,P.jsx)(M,{color:u(e),label:l(e)})}function R(e){switch(e){case`completed`:return`var(--system-positive-strong)`;case`failed`:return`var(--system-negative-strong)`;case`cancelled`:return`var(--content-secondary)`;default:return`var(--primary-base)`}}function z(e){switch(e){case`completed`:return`Completed`;case`failed`:return`Failed`;case`cancelled`:return`Cancelled`;default:return`Running`}}function B({status:e}){return(0,P.jsx)(M,{color:R(e),label:z(e)})}function V({status:e}){let{t}=_(`chat`),n=g(),r=`h-3.5 w-3.5 shrink-0`,i;return i=e===`running`?(0,P.jsx)(o,{className:`shrink-0`,dotSize:4,gap:2}):e===`completed`?(0,P.jsx)(T,{className:r,style:{color:`var(--system-positive-strong)`}}):e===`failed`?(0,P.jsx)(y,{className:r,style:{color:`var(--system-negative-strong)`}}):(0,P.jsx)(v,{className:r,style:{color:`var(--content-secondary)`},role:`img`,"aria-label":t(`workflowSubagentRow.cancelledAria`)}),(0,P.jsx)(h,{mode:`wait`,initial:!1,children:(0,P.jsx)(m.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:n?{duration:0}:{duration:.15,ease:[.16,1,.3,1]},className:`flex shrink-0 items-center`,children:i},e)})}function H({runId:e,leaf:n,components:r,onSelect:i}){let{t:a}=_(`chat`),o=n.label??`Subagent ${n.seq}`,l=n.promptSummary,u=t(`${e}:${n.seq}`);return(0,P.jsx)(`button`,{type:`button`,onClick:i,"aria-label":a(`workflowSubagentRow.openDetailsAria`,{title:o}),className:`flex w-full cursor-pointer items-center justify-between gap-2 rounded-[6px] px-2 py-1.5 text-left transition-colors hover:bg-[var(--surface-overlay)]`,children:(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,P.jsx)(V,{status:n.status}),r?(0,P.jsx)(s,{components:r,bodyShapeId:u.bodyShape,eyeStyleId:u.eyeStyle,colorId:u.color,size:16}):(0,P.jsx)(`div`,{style:{width:16,height:16,flexShrink:0},"aria-hidden":!0}),(0,P.jsx)(c,{variant:`body-medium-default`,title:o,className:`max-w-[60%] shrink-0 truncate text-[var(--content-default)]`,children:o}),l&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-[var(--content-tertiary)] opacity-10`,children:`|`}),(0,P.jsx)(c,{variant:`body-medium-lighter`,title:l,className:`min-w-0 truncate text-[var(--content-tertiary)]`,children:l})]})]})})}function U({entry:e,onClose:o,onStop:l,onRequestJournal:u}){let{t:f}=_(`chat`),p=d(e.status),h=g(),v=e.label??e.runId,y=e.agentsSpawned||e.leaves.size,T=r(),A=[...e.leaves.values()].sort((e,t)=>e.seq-t.seq),[M,F]=(0,N.useState)(null),[R,z]=(0,N.useState)(e.runId);R!==e.runId&&(z(e.runId),F(null));let V=M==null?void 0:e.leaves.get(M),U=V?t(`${e.runId}:${V.seq}`):void 0,W=(0,N.useCallback)(()=>F(null),[]),G=V?V.label??`Subagent ${V.seq}`:``,K=V?G:v,q=p?`live`:`final`;return(0,N.useEffect)(()=>{u?.(e.runId)},[e.runId,q,u]),(0,P.jsx)(i,{headerAbove:V&&(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-[var(--border-hover)] px-5 py-3`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:W,title:v,className:`min-w-0 shrink cursor-pointer truncate text-left text-[var(--content-default)] hover:underline`,children:(0,P.jsx)(c,{variant:`body-small-default`,as:`span`,children:v})}),(0,P.jsx)(b,{className:`h-2.5 w-2.5 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":!0}),(0,P.jsx)(c,{variant:`body-small-default`,as:`span`,title:G,className:`min-w-0 shrink truncate text-[var(--content-secondary)]`,children:G})]}),icon:(0,P.jsxs)(P.Fragment,{children:[V&&(0,P.jsx)(n,{variant:`outlined`,iconOnly:(0,P.jsx)(S,{}),onClick:W,"aria-label":f(`workflowDetailPanel.backToSubagentsAria`),tooltip:f(`workflowDetailPanel.back`),className:`shrink-0`}),V?T&&U?(0,P.jsx)(s,{components:T,bodyShapeId:U.bodyShape,eyeStyleId:U.eyeStyle,colorId:U.color,size:32}):(0,P.jsx)(`div`,{style:{width:32,height:32,flexShrink:0},"aria-hidden":!0}):(0,P.jsx)(C,{className:`h-5 w-5 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0})]}),title:K,headerTrailing:V?(0,P.jsx)(B,{status:V.status}):(0,P.jsx)(L,{status:e.status}),headerActions:p&&l?(0,P.jsx)(j,{onStop:()=>l(e.runId),ariaLabel:f(`workflowDetailPanel.stopWorkflow`)}):void 0,closeLabel:f(`workflowDetailPanel.closeDetail`),onClose:o,children:(0,P.jsx)(m.div,{className:`flex flex-col gap-5`,initial:{opacity:0},animate:{opacity:1},transition:h?{duration:0}:{duration:.18,ease:[.16,1,.3,1]},children:V?(0,P.jsx)(I,{leaf:V}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,P.jsx)(O,{icon:(0,P.jsx)(x,{}),target:e.inputTokens,format:e=>E(Math.round(e)),label:f(`workflowDetailPanel.input`)}),(0,P.jsx)(O,{icon:(0,P.jsx)(D,{}),target:e.outputTokens,format:e=>E(Math.round(e)),label:f(`workflowDetailPanel.output`)}),(0,P.jsx)(O,{icon:(0,P.jsx)(w,{}),target:y,format:e=>E(Math.round(e)),label:f(`workflowDetailPanel.agents`)})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(k,{as:`h3`,children:f(`workflowDetailPanel.subagents`)}),A.length===0?(0,P.jsx)(a,{placement:`section`,children:f(`workflowDetailPanel.noSubagentsYet`)}):(0,P.jsx)(`div`,{className:`flex flex-col gap-1`,children:A.map(t=>(0,P.jsx)(H,{runId:e.runId,leaf:t,components:T,onSelect:()=>F(t.seq)},t.seq))})]})]})},V?String(V.seq):`list`)})}export{U as WorkflowDetailPanel};