@vellumai/web 0.12.2-dev.202609171225.565e464 → 0.12.2-dev.202609171516.2acdfd4

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 (318) hide show
  1. package/dist/assets/{a2a-invite-DBlDzShH.js → a2a-invite-S3W5OUQ8.js} +1 -1
  2. package/dist/assets/{about-page-DdLu4gin.js → about-page-C-GtkgKQ.js} +1 -1
  3. package/dist/assets/{account-page-CRCayJE1.js → account-page-Die0k4p1.js} +1 -1
  4. package/dist/assets/{account-shell-CIfUqVu1.js → account-shell-Dbc4GLZ8.js} +1 -1
  5. package/dist/assets/{acp-run-detail-panel-Be03WYUS.js → acp-run-detail-panel-DPmp98_U.js} +1 -1
  6. package/dist/assets/{activation-list-route-BiHOPkuW.js → activation-list-route-BWHGEsqz.js} +1 -1
  7. package/dist/assets/{activity-redirect-page-DM_5_I_D.js → activity-redirect-page-Bma7Mr49.js} +1 -1
  8. package/dist/assets/{activity-steps-panel-BXkDyFqw.js → activity-steps-panel-BWbcrAVW.js} +1 -1
  9. package/dist/assets/add-credits-modal-BcdNESW9.js +1 -0
  10. package/dist/assets/{add-credits-modal-CzEGqiQb.js → add-credits-modal-CxCacGMD.js} +1 -1
  11. package/dist/assets/{ai-page-BhWTbyQ2.js → ai-page-CQHFCjDW.js} +1 -1
  12. package/dist/assets/{android-billing-handoff-Cbg8fsR3.js → android-billing-handoff-Cw1ysvIK.js} +1 -1
  13. package/dist/assets/{api-key-screen-VGgQ3yZn.js → api-key-screen-BpmbJA0E.js} +1 -1
  14. package/dist/assets/app-1VZKPehC.js +392 -0
  15. package/dist/assets/app-DI85lCVu.css +2 -0
  16. package/dist/assets/{app-info-Clahy-Wt.js → app-info-BJtkRDIh.js} +1 -1
  17. package/dist/assets/{archive-redirect-page-DebwOmzE.js → archive-redirect-page-DjM6Ok_I.js} +1 -1
  18. package/dist/assets/assistant-inbox-B75G_OgY.js +1 -0
  19. package/dist/assets/assistant-inbox-BsS-suY6.js +1 -0
  20. package/dist/assets/assistant-inbox-ByPTwOwm.js +1 -0
  21. package/dist/assets/assistant-inbox-Di1LvnFM.js +1 -0
  22. package/dist/assets/{assistant-status-panel-B1FR7MM1.js → assistant-status-panel-DK9S4lgz.js} +1 -1
  23. package/dist/assets/auth-store-CjHqgBLP.js +1 -0
  24. package/dist/assets/{auth-welcome-screen-BeA5CpIk.js → auth-welcome-screen-BH65QcYU.js} +1 -1
  25. package/dist/assets/avatar-bundled-components-DqvuXI-O.js +1 -0
  26. package/dist/assets/{avatar-random-CWz7C9rs.js → avatar-random-LVBo5QRK.js} +2 -2
  27. package/dist/assets/{await-org-header-settled-BOJkVf_1.js → await-org-header-settled-B_cb553t.js} +1 -1
  28. package/dist/assets/{background-task-detail-panel-t9FRp_-Z.js → background-task-detail-panel-CdxsK6NR.js} +1 -1
  29. package/dist/assets/{billing-page-CL0Pdh_3.js → billing-page-Bgn6BG8V.js} +3 -3
  30. package/dist/assets/{billing-redirect-page-DDf6m-FK.js → billing-redirect-page-WDSWKFH7.js} +1 -1
  31. package/dist/assets/{bookmarks-page-UXQyS5kQ.js → bookmarks-page-DsV__cWA.js} +1 -1
  32. package/dist/assets/{bundle-confirm-page-Wg-3XwhK.js → bundle-confirm-page-CDZlExeH.js} +1 -1
  33. package/dist/assets/{channel-transcript-panel-HxUNeT8p.js → channel-transcript-panel-frtM8o3q.js} +1 -1
  34. package/dist/assets/{channels-page-route-Cz5m59Qi.js → channels-page-route-CUiTCk9h.js} +1 -1
  35. package/dist/assets/{chat-info-panel-DEanOgSg.js → chat-info-panel-ClI6ebj_.js} +1 -1
  36. package/dist/assets/{checkout-continuation-BKsgghES.js → checkout-continuation-BulwKXnr.js} +1 -1
  37. package/dist/assets/{checkout-page-C73ixDgx.js → checkout-page-CkK93wwA.js} +1 -1
  38. package/dist/assets/checkout-return-target-HspBICEX.js +1 -0
  39. package/dist/assets/{command-palette-DvhQJQSH.js → command-palette-CBFRny7u.js} +1 -1
  40. package/dist/assets/command-palette-DgmFO89K.js +1 -0
  41. package/dist/assets/{command-palette-window-page-DGDhA-B4.js → command-palette-window-page-BXAR42Mw.js} +1 -1
  42. package/dist/assets/{community-page-Dob0FV5_.js → community-page-CwpmiKhU.js} +1 -1
  43. package/dist/assets/{companion-accent-la8ZJ6IC.js → companion-accent-ubCKO3aQ.js} +1 -1
  44. package/dist/assets/{companion-dock-zones-page-CFJTproC.js → companion-dock-zones-page-DVZ6O5Z3.js} +1 -1
  45. package/dist/assets/{companion-layout-BuxIBkh-.js → companion-layout-DgqqJvcL.js} +1 -1
  46. package/dist/assets/{companion-popover-BBqEGBTZ.js → companion-popover-Cf5ITFsQ.js} +1 -1
  47. package/dist/assets/{companion-popover-page-Ck2zhqqG.js → companion-popover-page-BlP-q73q.js} +1 -1
  48. package/dist/assets/{companion-surface-page-D7cjO06j.js → companion-surface-page-CPoC6fzh.js} +1 -1
  49. package/dist/assets/{companion-watch-frame-page-pWwGxOZY.js → companion-watch-frame-page-D-fKHmac.js} +1 -1
  50. package/dist/assets/{connect-page-lW4ZEcOf.js → connect-page-BOOhRdAN.js} +1 -1
  51. package/dist/assets/{consent-controls--WNBdiwt.js → consent-controls-i0ai4F7A.js} +1 -1
  52. package/dist/assets/{contacts-gateway-CWKximoP.js → contacts-gateway-DM6gZwP0.js} +1 -1
  53. package/dist/assets/{contacts-page-route-8Nysvlx4.js → contacts-page-route-CJGWxEi9.js} +1 -1
  54. package/dist/assets/{copy-button-DPlyOF7A.js → copy-button-CgZo1eck.js} +1 -1
  55. package/dist/assets/{credential-entry-page-CRLQ3v95.js → credential-entry-page-BxcbnzCG.js} +1 -1
  56. package/dist/assets/{credentials-page-CcY2zM5u.js → credentials-page-dWp6pto9.js} +1 -1
  57. package/dist/assets/{csv-preview-Cx1awfot.js → csv-preview-Dh7oKdWY.js} +1 -1
  58. package/dist/assets/{danger-zone-redirect-page-CduOjFC8.js → danger-zone-redirect-page-Bca3uiwU.js} +1 -1
  59. package/dist/assets/{debug-page-B5rdWQOa.js → debug-page-Bu4cg9mR.js} +2 -2
  60. package/dist/assets/deploy-dialogs-BAboaRnq.js +1 -0
  61. package/dist/assets/{deploy-dialogs-Bcjd9rq0.js → deploy-dialogs-CirCIMHR.js} +1 -1
  62. package/dist/assets/{desktop-preview-content-V-sOQVf4.js → desktop-preview-content-1z7Kwmap.js} +2 -2
  63. package/dist/assets/{desktop-status-Br7Q6i6P.js → desktop-status-DWRR_4vI.js} +1 -1
  64. package/dist/assets/{desktop-viewer-DffX_ioO.js → desktop-viewer-Dt7CPtW_.js} +1 -1
  65. package/dist/assets/{detail-card-BkqRteiy.js → detail-card-N-3EizQA.js} +1 -1
  66. package/dist/assets/{detail-panel-stop-button-B-4csyQj.js → detail-panel-stop-button-Ba-HusQL.js} +1 -1
  67. package/dist/assets/{detail-primitives-ChhRyu-L.js → detail-primitives-C1Ob8_w-.js} +1 -1
  68. package/dist/assets/{developer-page-BHH-G3vb.js → developer-page-Bt0eUMWA.js} +1 -1
  69. package/dist/assets/{devices-redirect-page-Ci4S4x-o.js → devices-redirect-page-C-DVpVwD.js} +1 -1
  70. package/dist/assets/{dictation-overlay-page-DFWMmpSF.js → dictation-overlay-page-B9lCjIKF.js} +1 -1
  71. package/dist/assets/{document-load-BK4EO7RZ.js → document-load-DQjnTl3_.js} +1 -1
  72. package/dist/assets/document-load-i1Uz5oSB.js +1 -0
  73. package/dist/assets/{document-viewer-page-8sDnK841.js → document-viewer-page-BRH2RPiM.js} +1 -1
  74. package/dist/assets/{emails-page-DO9ZE3jU.js → emails-page-CSmJe_xG.js} +1 -1
  75. package/dist/assets/environment-store-D8RAr0eS.js +1 -0
  76. package/dist/assets/{esm-CkWCRmp8.js → esm-45XxzHqL.js} +1 -1
  77. package/dist/assets/esm-B7iJfc7t.js +2 -0
  78. package/dist/assets/esm-BWzYRgnz.js +2 -0
  79. package/dist/assets/esm-CfVieSav.js +2 -0
  80. package/dist/assets/{esm-DcW4PisK.js → esm-D9JqyPky.js} +1 -1
  81. package/dist/assets/esm-DKymu7Df.js +1 -0
  82. package/dist/assets/esm-Ddnm4FUm.js +1 -0
  83. package/dist/assets/esm-DmK6yYdC.js +2 -0
  84. package/dist/assets/{esm-hzkaqWNK.js → esm-DqCKqYab.js} +2 -2
  85. package/dist/assets/esm-UCoXmowf.js +2 -0
  86. package/dist/assets/{file-diff-view-C9bCfhOV.js → file-diff-view-BRdlQZkN.js} +1 -1
  87. package/dist/assets/{file-editor-CfRnh-Mo.js → file-editor-BX1bpi1D.js} +1 -1
  88. package/dist/assets/{general-page-DjjeWAtL.js → general-page-BdUgCSrY.js} +2 -2
  89. package/dist/assets/{hatching-screen-B9jbVOd6.js → hatching-screen-Cyc4lAWR.js} +1 -1
  90. package/dist/assets/{hosting-screen-CGLHzAHy.js → hosting-screen-CxMtePfp.js} +1 -1
  91. package/dist/assets/{identity-page-route-BuLKelGC.js → identity-page-route-D29k81bP.js} +1 -1
  92. package/dist/assets/{inspect-page-DKNTTk-0.js → inspect-page-DEGfta5A.js} +3 -3
  93. package/dist/assets/integrations-page-B8iLgQIE.js +1 -0
  94. package/dist/assets/{intelligence-layout-SSf_CqAg.js → intelligence-layout-IUVPVrdn.js} +1 -1
  95. package/dist/assets/intelligence-layout-slots-store-XQzWB59M.js +1 -0
  96. package/dist/assets/{keyboard-shortcuts-redirect-page-CO4tE0_q.js → keyboard-shortcuts-redirect-page-Qw3OAks0.js} +1 -1
  97. package/dist/assets/{latest-assistant-text-dvDZFw6m.js → latest-assistant-text-h1N5LrMh.js} +1 -1
  98. package/dist/assets/{library-detail-page-B7-d8yHD.js → library-detail-page-JAcdR7kZ.js} +1 -1
  99. package/dist/assets/{library-page-D2GjaHzY.js → library-page-ByrTE5_6.js} +1 -1
  100. package/dist/assets/local-mode-Du2OBjZk.js +1 -0
  101. package/dist/assets/{login-page-CFgNabXb.js → login-page-6RcOKK22.js} +1 -1
  102. package/dist/assets/{logout-page-DwDFjp0Z.js → logout-page-DblYRW1m.js} +1 -1
  103. package/dist/assets/{logs-layout-BBZ9RAjZ.js → logs-layout-JhpEkfWZ.js} +1 -1
  104. package/dist/assets/{markdown-preview-CaBuvjCf.js → markdown-preview-CQ8WsJp3.js} +1 -1
  105. package/dist/assets/{media-preview-BoHSPjgq.js → media-preview-jOhlUdZb.js} +1 -1
  106. package/dist/assets/{memory-page-route-BYhuTazu.js → memory-page-route-DxLUR0GU.js} +1 -1
  107. package/dist/assets/{memory-router-playground-page-0MqBO297.js → memory-router-playground-page-DnqroUdj.js} +1 -1
  108. package/dist/assets/{message-files-panel-DQG3vRZi.js → message-files-panel-CQXlAZSX.js} +1 -1
  109. package/dist/assets/{metric-card-CfWDowxR.js → metric-card-cwfFB3Mr.js} +1 -1
  110. package/dist/assets/native-attachment-pickers-Dx58AZMz.js +1 -0
  111. package/dist/assets/native-file-Cnb6cLcA.js +1 -0
  112. package/dist/assets/{notifications-page-DKf_7eYc.js → notifications-page-Cqk19BBS.js} +1 -1
  113. package/dist/assets/{oauth-complete-page-cDoKH693.js → oauth-complete-page-Cytjrlev.js} +1 -1
  114. package/dist/assets/{oauth-popup-complete-page-Cp0vjEmH.js → oauth-popup-complete-page-P4Bx_GGh.js} +1 -1
  115. package/dist/assets/paired-platform-identity-CBHLqzfc.js +1 -0
  116. package/dist/assets/{pairing-page-skO554fH.js → pairing-page-C6gyWuXk.js} +1 -1
  117. package/dist/assets/password-reset-page-b9lhYbnM.js +1 -0
  118. package/dist/assets/{pdf-file-preview-DC5vOcs5.js → pdf-file-preview-Cjqls9OB.js} +1 -1
  119. package/dist/assets/{peeking-eyes-C795qorf.js → peeking-eyes-DCaqSJCC.js} +1 -1
  120. package/dist/assets/{personality-page-fO74T0hs.js → personality-page-C7ihlk1-.js} +1 -1
  121. package/dist/assets/{personality-page-BkCqu5OB.js → personality-page-NyfVynFa.js} +1 -1
  122. package/dist/assets/{personality-sliders-sAKu2C74.js → personality-sliders-C_ZdkwBn.js} +1 -1
  123. package/dist/assets/{plans-page-C5BxyaZO.js → plans-page-DFg4RE9c.js} +1 -1
  124. package/dist/assets/{platform-loopback-page-CrowCjnc.js → platform-loopback-page-D-thw1dN.js} +1 -1
  125. package/dist/assets/{plugin-detail-page-DdUXGKxQ.js → plugin-detail-page-BocQQKq6.js} +1 -1
  126. package/dist/assets/{plugins-page-DfMdsxPx.js → plugins-page-9rzZkoF8.js} +1 -1
  127. package/dist/assets/plugins-surface-yiUYWamb.js +1 -0
  128. package/dist/assets/{preview-error-vi2B-l2a.js → preview-error-BQEuSx7t.js} +1 -1
  129. package/dist/assets/{privacy-page-znT2Mvu5.js → privacy-page-ZeP7TZlN.js} +1 -1
  130. package/dist/assets/{privacy-screen-Dofd5Mz8.js → privacy-screen-BkFw7Pu-.js} +1 -1
  131. package/dist/assets/{provider-callback-page-BjwoQL8R.js → provider-callback-page-BaCGoR4x.js} +1 -1
  132. package/dist/assets/{provider-key-CFsemHfe.js → provider-key-BBTgZXQf.js} +1 -1
  133. package/dist/assets/{provider-signup-page-Cqs--Pss.js → provider-signup-page-Cc9uU7ie.js} +1 -1
  134. package/dist/assets/{quick-input-page-RhvkuA-a.js → quick-input-page-6AUpuRi4.js} +1 -1
  135. package/dist/assets/referral-modal-BJtDqTIF.js +1 -0
  136. package/dist/assets/{referral-modal-D3YmuUji.js → referral-modal-DzFsyTZk.js} +1 -1
  137. package/dist/assets/{rehype-katex-Cj-PIKJ4.js → rehype-katex-BQU1WTFV.js} +1 -1
  138. package/dist/assets/{research-mock-page-DtY0W-jo.js → research-mock-page-C6VY1afT.js} +1 -1
  139. package/dist/assets/{research-onboarding-route-8bvvxnvF.js → research-onboarding-route-B2oGvSgp.js} +1 -1
  140. package/dist/assets/{review-terms-screen-DlpazHw3.js → review-terms-screen-fZspq6BZ.js} +1 -1
  141. package/dist/assets/routes-DuJD7qzp.js +1 -0
  142. package/dist/assets/{schedules-DzyEr3no.js → schedules-C04f-6Zm.js} +1 -1
  143. package/dist/assets/{schedules-page-CR1ee93h.js → schedules-page-BfrYYaXP.js} +1 -1
  144. package/dist/assets/{security-redirect-page-C3bkYPpB.js → security-redirect-page-tYsg653n.js} +1 -1
  145. package/dist/assets/{select-assistant-screen-Dzrgh4-3.js → select-assistant-screen-4oMPXLnw.js} +1 -1
  146. package/dist/assets/{self-hosted-servers-C9NSM8gD.js → self-hosted-servers-NoIpSFa0.js} +1 -1
  147. package/dist/assets/{service-form-controls-BtX2YnjY.js → service-form-controls-QNDXDZpl.js} +1 -1
  148. package/dist/assets/{setting-row-Dhzhn9MB.js → setting-row-DmOMKJOa.js} +1 -1
  149. package/dist/assets/settings-BPhWFoj2.js +3 -0
  150. package/dist/assets/settings-BUU_urKv.js +3 -0
  151. package/dist/assets/settings-D2CnDcqG.js +3 -0
  152. package/dist/assets/settings-DTZCnHDa.js +3 -0
  153. package/dist/assets/{settings-divider-D9PQS5sY.js → settings-divider-B1o1lqXE.js} +1 -1
  154. package/dist/assets/{settings-layout-DgPLIzdo.js → settings-layout-DYeE5r8J.js} +1 -1
  155. package/dist/assets/share-feedback-modal-BI3wZ75P.js +1 -0
  156. package/dist/assets/{share-feedback-modal-B7VbR0v7.js → share-feedback-modal-HPQobFda.js} +2 -2
  157. package/dist/assets/{sidebar-tree-J3jVmAh0.js → sidebar-tree-BWZv1YnG.js} +1 -1
  158. package/dist/assets/{signup-page-26zBZOTJ.js → signup-page-DR87-D9g.js} +1 -1
  159. package/dist/assets/{signup-shell-BqsMKj0N.js → signup-shell-CMGC2T8z.js} +1 -1
  160. package/dist/assets/{skill-detail-page-xDrQtE_K.js → skill-detail-page-DjI3DAnL.js} +1 -1
  161. package/dist/assets/{skill-detail-panel-CbQ0z2ls.js → skill-detail-panel-r4ZZch2L.js} +1 -1
  162. package/dist/assets/{skill-removal-dialog-CTrw0VTo.js → skill-removal-dialog-CBxV3DND.js} +1 -1
  163. package/dist/assets/{skills-page-DyoAyL-Y.js → skills-page-BqL6Gc_u.js} +1 -1
  164. package/dist/assets/{sounds-page-DN6yTY9n.js → sounds-page-vEFfSpER.js} +1 -1
  165. package/dist/assets/{start-screen-hgI5Ztmj.js → start-screen-DEpQFKsn.js} +1 -1
  166. package/dist/assets/{stt-language-picker-modal-5mPezSwB.js → stt-language-picker-modal-DxX07bYt.js} +1 -1
  167. package/dist/assets/{subagent-detail-panel-Dq6cXS-i.js → subagent-detail-panel-htjjpHcd.js} +1 -1
  168. package/dist/assets/{superpowers-page-B9eA7_2A.js → superpowers-page-kVaKuF1h.js} +1 -1
  169. package/dist/assets/{system-events-page-B2JPqyrn.js → system-events-page-DsggXWm5.js} +1 -1
  170. package/dist/assets/{system-events-redirect-page-C3FW7lke.js → system-events-redirect-page-nkvMfQUL.js} +1 -1
  171. package/dist/assets/{text-preview-cPzlZljx.js → text-preview-Zq3e6oAx.js} +1 -1
  172. package/dist/assets/{theme-stage-page-l6bxpzmD.js → theme-stage-page-Bljw4QZW.js} +1 -1
  173. package/dist/assets/{tiptap-document-editor-DZcFWtPf.js → tiptap-document-editor-xgudHmFv.js} +1 -1
  174. package/dist/assets/{tool-detail-panel-dCPxQfT2.js → tool-detail-panel-C_YQ2oSL.js} +1 -1
  175. package/dist/assets/tool-detail-panel-D_HPzTu7.js +1 -0
  176. package/dist/assets/{trait-cycle-row-CEqSGPz2.js → trait-cycle-row-B-vau_0l.js} +1 -1
  177. package/dist/assets/{upgrade-cancel-page-B-D_oeBx.js → upgrade-cancel-page-BSs3JiLK.js} +1 -1
  178. package/dist/assets/{upgrade-success-page-DCwSI4N0.js → upgrade-success-page-CIl9nqZ-.js} +1 -1
  179. package/dist/assets/{usage-redirect-page-DKaEQTLK.js → usage-redirect-page-CSF19svH.js} +1 -1
  180. package/dist/assets/{use-app-delete-Cl7y_3Ka.js → use-app-delete-DiPjRLRa.js} +1 -1
  181. package/dist/assets/{use-assistant-identity-details-DBNlc3LO.js → use-assistant-identity-details-DNwuuLLH.js} +1 -1
  182. package/dist/assets/{use-checkout-dismiss-refresh-D13I69hb.js → use-checkout-dismiss-refresh-9thdnSxg.js} +1 -1
  183. package/dist/assets/{use-edge-swipe-back-DW3HRHcT.js → use-edge-swipe-back-Bjgkaw_i.js} +1 -1
  184. package/dist/assets/{use-hotkey-recorder-Di3iXQJb.js → use-hotkey-recorder-BQ9JKgzA.js} +1 -1
  185. package/dist/assets/{use-invite-link-dialog-BSufG3vr.js → use-invite-link-dialog-CPA5JA2d.js} +1 -1
  186. package/dist/assets/{use-platform-assistant-id-CKhExZPC.js → use-platform-assistant-id-DmUopUSF.js} +1 -1
  187. package/dist/assets/use-plugins-list-wWWZEj81.js +1 -0
  188. package/dist/assets/{use-return-to-short-circuit-BIecKROR.js → use-return-to-short-circuit-XtwjM2wL.js} +1 -1
  189. package/dist/assets/{use-side-list-room-C4-lrJ7T.js → use-side-list-room-CwvpgAra.js} +1 -1
  190. package/dist/assets/{use-skill-actions-B3-h8aTL.js → use-skill-actions-DmsYHPlR.js} +1 -1
  191. package/dist/assets/{use-skill-detail-files-Bp1ZrmrD.js → use-skill-detail-files-zzQYy1s6.js} +1 -1
  192. package/dist/assets/use-supports-credentials-settings-DzCL7C5c.js +1 -0
  193. package/dist/assets/{use-transcript-message-by-id-CWtKMTjb.js → use-transcript-message-by-id-D7Yfrafc.js} +1 -1
  194. package/dist/assets/{vendor-DUzxlXbu.js → vendor-Dc7Mo5cU.js} +2 -2
  195. package/dist/assets/{voice-page-CUbLB1IH.js → voice-page-CG_8l-4I.js} +1 -1
  196. package/dist/assets/{wake-detail-panel-DXNbDu7k.js → wake-detail-panel-BZUN3Ank.js} +1 -1
  197. package/dist/assets/{weather-forecast-display-Dx_JDnVC.js → weather-forecast-display-DI-mNOgk.js} +1 -1
  198. package/dist/assets/{web-SBJYIwk0.js → web-B3OlhPmj.js} +1 -1
  199. package/dist/assets/{web-BIq0eRiB.js → web-Bmo-aiin.js} +1 -1
  200. package/dist/assets/{web-Dq2IVkFl.js → web-Btp6i3fG.js} +1 -1
  201. package/dist/assets/{web-8nc1FdUf.js → web-CPQ5LCS4.js} +1 -1
  202. package/dist/assets/{web-nBaaP7qv.js → web-CnwjfqVv.js} +1 -1
  203. package/dist/assets/{web-DaIUYGHw.js → web-D1m41k7P.js} +1 -1
  204. package/dist/assets/{web-BgEkRgce.js → web-DNTG9B77.js} +1 -1
  205. package/dist/assets/{web-DGjg0P8a.js → web-DRd5wEPc.js} +1 -1
  206. package/dist/assets/{web-BMzfWFM-.js → web-DWh6C3OS.js} +1 -1
  207. package/dist/assets/welcome-screen-DpgIpbIr.js +1 -0
  208. package/dist/assets/{workflow-detail-panel-CTOW3eOK.js → workflow-detail-panel-CUaM-3zz.js} +1 -1
  209. package/dist/assets/{workspace-page-DBWsGAaO.js → workspace-page-Vurh3q8D.js} +1 -1
  210. package/dist/index.html +3 -3
  211. package/package.json +1 -1
  212. package/dist/assets/add-credits-modal-Bjj5IcfD.js +0 -1
  213. package/dist/assets/app-BFMKh-Wt.css +0 -2
  214. package/dist/assets/app-n7D5Q-HS.js +0 -392
  215. package/dist/assets/auth-store-C6J2aPKg.js +0 -1
  216. package/dist/assets/avatar-bundled-components-L3rXWeWJ.js +0 -1
  217. package/dist/assets/checkout-return-target-DDDp8tMv.js +0 -1
  218. package/dist/assets/command-palette-Bqkpugfw.js +0 -1
  219. package/dist/assets/deploy-dialogs-CoLI4cjl.js +0 -1
  220. package/dist/assets/document-load-BRhCAhb0.js +0 -1
  221. package/dist/assets/environment-store-BeKdNCDQ.js +0 -1
  222. package/dist/assets/esm-BGKIdtva.js +0 -2
  223. package/dist/assets/esm-CeA0xUzc.js +0 -2
  224. package/dist/assets/esm-CskPvois.js +0 -2
  225. package/dist/assets/esm-DC5Xk3B0.js +0 -2
  226. package/dist/assets/esm-DbCpCgyJ.js +0 -1
  227. package/dist/assets/esm-DtH_yADh.js +0 -1
  228. package/dist/assets/esm-hhBjqEXz.js +0 -2
  229. package/dist/assets/integrations-page-DyiqZ_kn.js +0 -1
  230. package/dist/assets/intelligence-layout-slots-store-DqHNLKm3.js +0 -1
  231. package/dist/assets/local-mode-CMLuHoSn.js +0 -1
  232. package/dist/assets/native-attachment-pickers-Ck3NxYSR.js +0 -1
  233. package/dist/assets/native-file-D0OMqAkq.js +0 -1
  234. package/dist/assets/paired-platform-identity-DskZXcWX.js +0 -1
  235. package/dist/assets/password-reset-page-Dr8OrlGm.js +0 -1
  236. package/dist/assets/plugins-surface-BL69ztAA.js +0 -1
  237. package/dist/assets/referral-modal-WPGRXuLA.js +0 -1
  238. package/dist/assets/routes-DaWUVprK.js +0 -1
  239. package/dist/assets/settings-BaBLTX_4.js +0 -3
  240. package/dist/assets/settings-DYkeeCDS.js +0 -3
  241. package/dist/assets/settings-DrC1YWLC.js +0 -3
  242. package/dist/assets/settings-zLCbPrgt.js +0 -3
  243. package/dist/assets/share-feedback-modal-8OzEECo-.js +0 -1
  244. package/dist/assets/tool-detail-panel-Mme2rbul.js +0 -1
  245. package/dist/assets/use-plugins-list-BTPeAWTb.js +0 -1
  246. package/dist/assets/use-supports-credentials-settings-D1R1OKic.js +0 -1
  247. package/dist/assets/welcome-screen-bgD2LcV9.js +0 -1
  248. /package/dist/assets/{account-Cb-DyELI.js → account-B_JHsQ7Y.js} +0 -0
  249. /package/dist/assets/{account-RgxzlOwE.js → account-BdE9xiiS.js} +0 -0
  250. /package/dist/assets/{account-C8xg8kR6.js → account-DByPcLAh.js} +0 -0
  251. /package/dist/assets/{activation-fQ2w8k-_.js → activation-C0jvOpIw.js} +0 -0
  252. /package/dist/assets/{activation-Bgezxtsd.js → activation-CjfObHN6.js} +0 -0
  253. /package/dist/assets/{activation-Dq1qihrb.js → activation-Cs9FZ7su.js} +0 -0
  254. /package/dist/assets/{activation-tasks-DDUN5H65.js → activation-tasks-BIdR8oB6.js} +0 -0
  255. /package/dist/assets/{activation-tasks-v6hBb3kp.js → activation-tasks-BqMm-gES.js} +0 -0
  256. /package/dist/assets/{activation-tasks-BOXaCIAc.js → activation-tasks-D9QFkLUX.js} +0 -0
  257. /package/dist/assets/{build.umd-B4nySx9q.js → build.umd-CuYKVYcE.js} +0 -0
  258. /package/dist/assets/{channels-1fPalZ3Q.js → channels-BgmDV3yg.js} +0 -0
  259. /package/dist/assets/{channels-zwQvxHhS.js → channels-ButPDaP1.js} +0 -0
  260. /package/dist/assets/{channels-DUGt-c_s.js → channels-DJOsCglQ.js} +0 -0
  261. /package/dist/assets/{channels-Bp6785EE.js → channels-ao_qpzfd.js} +0 -0
  262. /package/dist/assets/{chat-CBbKX2hh.js → chat-BZM-_HVA.js} +0 -0
  263. /package/dist/assets/{chat-Cp6r9FuL.js → chat-DBnTHdZ_.js} +0 -0
  264. /package/dist/assets/{chat-CVcAmb4G.js → chat-Ddhqy6p0.js} +0 -0
  265. /package/dist/assets/{chat-DaQ9msXY.js → chat-JLp9gz-v.js} +0 -0
  266. /package/dist/assets/{common-twS-Xtq8.js → common-2SsDXv7P.js} +0 -0
  267. /package/dist/assets/{common-ue46KSet.js → common-BmacJcGg.js} +0 -0
  268. /package/dist/assets/{common-DbDGhUk1.js → common-CHUeQ07r.js} +0 -0
  269. /package/dist/assets/{common-B9fnih0e.js → common-CO-ZzXVu.js} +0 -0
  270. /package/dist/assets/{contacts-CwnIjST-.js → contacts-B1fs29IO.js} +0 -0
  271. /package/dist/assets/{contacts-7s5uUt1u.js → contacts-BC3u20ot.js} +0 -0
  272. /package/dist/assets/{contacts-Bb43JJJN.js → contacts-D-hYt1vp.js} +0 -0
  273. /package/dist/assets/{contacts-CNaEZ-fL.js → contacts-DZ0dUPpj.js} +0 -0
  274. /package/dist/assets/{credential-requests-J6rR1d8i.js → credential-requests-BTzncfcX.js} +0 -0
  275. /package/dist/assets/{credential-requests-BXKQ_K8b.js → credential-requests-Bbo1KiQ2.js} +0 -0
  276. /package/dist/assets/{credential-requests-BOCpSsQ3.js → credential-requests-DarWjx1l.js} +0 -0
  277. /package/dist/assets/{credential-requests-CoE9Lb8S.js → credential-requests-a3ty_CQg.js} +0 -0
  278. /package/dist/assets/{definitions-BfnfKapN.js → definitions-Dw0S2Kue.js} +0 -0
  279. /package/dist/assets/{definitions-C8lsOLos.js → definitions-uW59_E3r.js} +0 -0
  280. /package/dist/assets/{home-Dn0m9kBd.js → home-Ba50-ePU.js} +0 -0
  281. /package/dist/assets/{home-BVIzMQck.js → home-Dn83lNtr.js} +0 -0
  282. /package/dist/assets/{home-CCaaP5mz.js → home-uNCEHYNU.js} +0 -0
  283. /package/dist/assets/{home-DpWJt0sR.js → home-vNakvxwE.js} +0 -0
  284. /package/dist/assets/{intelligence-DGasqUYG.js → intelligence-BMwNCKUJ.js} +0 -0
  285. /package/dist/assets/{intelligence-CoqqSgFj.js → intelligence-C5iGRZnx.js} +0 -0
  286. /package/dist/assets/{intelligence-DsAUVOAd.js → intelligence-DbBmLA-o.js} +0 -0
  287. /package/dist/assets/{intelligence-2OGzDFvC.js → intelligence-onjWaSVH.js} +0 -0
  288. /package/dist/assets/{library-BfKxaPf0.js → library-BBlMmqjc.js} +0 -0
  289. /package/dist/assets/{library-DrPeM0_h.js → library-CuIWcirl.js} +0 -0
  290. /package/dist/assets/{library-t0vQjS7N.js → library-D6ctLR6f.js} +0 -0
  291. /package/dist/assets/{library-DO9JsNSy.js → library-x7Mvyr0R.js} +0 -0
  292. /package/dist/assets/{logs-M2b1TrMN.js → logs-BXyEWdqc.js} +0 -0
  293. /package/dist/assets/{logs-BuCPf34Y.js → logs-CaCTiIdg.js} +0 -0
  294. /package/dist/assets/{logs-C5iN-fuK.js → logs-DHQGGOtW.js} +0 -0
  295. /package/dist/assets/{logs-oZIjcpgE.js → logs-ZfHst0hW.js} +0 -0
  296. /package/dist/assets/{onboarding-DIUBmWBM.js → onboarding-BUIzSjep.js} +0 -0
  297. /package/dist/assets/{onboarding-Ce_CYrXg.js → onboarding-CBjJUBPn.js} +0 -0
  298. /package/dist/assets/{onboarding-By9JR2qu.js → onboarding-CzFJhucy.js} +0 -0
  299. /package/dist/assets/{onboarding-Bz72aOnk.js → onboarding-Muv5Kils.js} +0 -0
  300. /package/dist/assets/{pdf-BKWEs79u.js → pdf-DREAlG2U.js} +0 -0
  301. /package/dist/assets/{remote-web-DlydCzEK.js → remote-web-DBfjp6wl.js} +0 -0
  302. /package/dist/assets/{remote-web-yIqbgeYo.js → remote-web-DOZ-eyQZ.js} +0 -0
  303. /package/dist/assets/{remote-web-D_8aBk2_.js → remote-web-Dq6aZsrk.js} +0 -0
  304. /package/dist/assets/{remote-web-CdqK_lTu.js → remote-web-WaHVTMrL.js} +0 -0
  305. /package/dist/assets/{schedules-Bny8l_CP.js → schedules-B0L8TyFP.js} +0 -0
  306. /package/dist/assets/{schedules-KPfLvypq.js → schedules-CGZ6Nccv.js} +0 -0
  307. /package/dist/assets/{schedules-uSjJ_EjR.js → schedules-DoE9PC23.js} +0 -0
  308. /package/dist/assets/{schedules-cg2MRom9.js → schedules-UJxl03Ec.js} +0 -0
  309. /package/dist/assets/{terminal-DgXT91mg.js → terminal-BA49Abnn.js} +0 -0
  310. /package/dist/assets/{terminal-CM_nhgrt.js → terminal-BfdRfPO0.js} +0 -0
  311. /package/dist/assets/{terminal-CacAJB1i.js → terminal-CqxnRkP7.js} +0 -0
  312. /package/dist/assets/{terminal-CmV3W_IT.js → terminal-CrttnvS1.js} +0 -0
  313. /package/dist/assets/{workspace-hqnPWewF.js → workspace-AKEeEFWF.js} +0 -0
  314. /package/dist/assets/{workspace-9CiV_W5c.js → workspace-BYx3S57B.js} +0 -0
  315. /package/dist/assets/{workspace-DWS-BW9d.js → workspace-Cnq3vrii.js} +0 -0
  316. /package/dist/assets/{workspace-uAp0lLvq.js → workspace-fMhuS1x9.js} +0 -0
  317. /package/dist/assets/{xterm-DdbteOXE.js → xterm-B1tCoG0n.js} +0 -0
  318. /package/dist/assets/{xterm-addon-fit-LbAazlGK.js → xterm-addon-fit-CcSybFjN.js} +0 -0
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/esm-BGKIdtva.js","assets/react-B9IgSVeK.js","assets/rolldown-runtime-BM3Ffeng.js","assets/vendor-DUzxlXbu.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$_ as t,$h as n,$m as r,A as i,Ab as a,Ai as o,Ax as s,Cg as c,Cl as l,Cp as u,Di as d,Dx as f,Dy as p,Ex as m,Ey as h,Fh as g,Fi as _,Fm as v,Fs as y,Fx as b,Fy as x,Gb as S,Gh as C,Gm as w,Hm as T,Hx as E,Ib as D,Ii as O,Ix as k,Ju as A,Kb as j,Ky as M,Lb as N,Li as P,M as F,Mg as I,Mh as ee,Mx as L,My as te,Nx as ne,Om as re,Op as ie,Ox as R,Pb as ae,Ph as oe,Pi as se,Py as ce,Qb as le,Qh as ue,R as de,Rb as fe,Rm as pe,Ry as me,Sb as he,Sl as ge,Tp as _e,Ub as ve,Um as ye,Ux as z,Va as be,Vb as xe,Vm as Se,Wm as Ce,Wx as we,Wy as Te,Xb as Ee,Xr as De,Xu as Oe,Yb as ke,Yc as Ae,Yl as je,Yu as Me,Zx as Ne,_b as Pe,_g as Fe,_h as Ie,_l as Le,_u as Re,ag as ze,ah as Be,bl as Ve,bm as He,ch as Ue,cn as We,cu as Ge,db as Ke,di as qe,dn as Je,et as Ye,ev as Xe,fb as Ze,fg as Qe,fh as $e,fx as et,gg as tt,gh as nt,gl as rt,gu as it,gx as B,hl as at,hu as ot,hx as st,iS as ct,ib as lt,if as ut,ih as dt,iu as ft,ix as pt,j as mt,jg as ht,jp as gt,ju as _t,ki as vt,kr as yt,ld as bt,lh as xt,ln as St,lu as Ct,mb as wt,ml as Tt,mn as V,mu as Et,nh as Dt,no as Ot,ob as kt,og as At,oh as jt,ox as Mt,pg as Nt,ph as Pt,pl as Ft,ql as It,qm as Lt,qu as Rt,rh as zt,rv as Bt,sh as Vt,sl as Ht,tS as H,th as Ut,tx as Wt,ux as Gt,vg as Kt,vl as qt,vu as Jt,vy as Yt,wg as Xt,wp as Zt,wx as Qt,yl as $t,yu as en,yx as tn,z as nn,za as rn,zg as U,zx as an,zy as on}from"./app-n7D5Q-HS.js";import{E as sn,I as W,Jn as cn,N as G,Q as ln,Zn as K,_ as un,er as q,f as dn,g as fn,j as J,k as pn}from"./vendor-DUzxlXbu.js";import{_ as mn,f as hn,n as gn,t as _n,v as vn,x as yn}from"./react-B9IgSVeK.js";import{B as bn,Ca as xn,E as Sn,Et as Cn,Hi as wn,Ja as Tn,Jn as Y,Ki as En,Q as Dn,Ri as On,Tt as kn,_n as An,br as jn,ci as Mn,gr as Nn,i as Pn,kt as Fn,nt as In,qi as Ln,vn as Rn}from"./icons-DxrLl-Dj.js";import{t as X}from"./detail-card-BkqRteiy.js";import{t as zn}from"./environment-store-BeKdNCDQ.js";import{t as Bn}from"./app-info-Clahy-Wt.js";import{a as Vn,i as Hn,l as Un,o as Wn}from"./machine-sizes--PLzvcMG.js";import{t as Gn}from"./format-countdown-Dceq8qd-.js";import{a as Kn,i as qn,n as Jn,r as Yn,t as Xn}from"./assistant-status-panel-B1FR7MM1.js";import{t as Zn}from"./trait-cycle-row-CEqSGPz2.js";import{n as Qn,r as $n,t as er}from"./settings-divider-D9PQS5sY.js";import{t as tr}from"./use-hotkey-recorder-Di3iXQJb.js";var nr=Tn(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),rr=Tn(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),ir=Tn(`vibrate`,[[`path`,{d:`m2 8 2 2-2 2 2 2-2 2`,key:`sv1b1`}],[`path`,{d:`m22 8-2 2 2 2-2 2 2 2`,key:`101i4y`}],[`rect`,{width:`8`,height:`14`,x:`8`,y:`5`,rx:`1`,key:`1oyrl4`}]]),Z=e(yn(),1),Q=_n();function ar(){let{t:e}=J(`settings`),t=U.use.velvet(),{theme:n,setThemePreference:r}=qe(),i=[{value:`system`,label:e(`themePicker.system`),icon:(0,Q.jsx)(Rn,{className:`h-4 w-4`})},{value:`light`,label:e(`themePicker.light`),icon:(0,Q.jsx)(bn,{className:`h-4 w-4`})},{value:`dark`,label:e(`themePicker.dark`),icon:(0,Q.jsx)(An,{className:`h-4 w-4`})},...t?[{value:`velvet`,label:e(`themePicker.velvet`),icon:(0,Q.jsx)(Nn,{className:`h-4 w-4`})}]:[]];return(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`themePicker.title`)}),(0,Q.jsx)(`div`,{className:`mt-2 max-w-[360px]`,children:(0,Q.jsx)(s,{ariaLabel:e(`themePicker.ariaLabel`),value:n,onChange:r,items:i})})]})}var or=Se,sr=`Please choose a different handle.`;async function cr(e,t){let{data:n,error:r,response:i}=await Fe({path:{id:e},body:{handle:t},throwOnError:!1});if(!i)return{kind:`error`,message:le(r,void 0,`Failed to save handle.`)??`Failed to save handle.`};if(i.ok&&n)return{kind:`ok`,data:n};if(i.status===409){let{message:e}=w(r,`handle`,or.taken);return{kind:`taken`,message:e}}if(i.status===400){let{code:e,message:t}=w(r,`handle`,sr);return{kind:`invalid`,code:e,message:t}}return{kind:`error`,message:le(r,i,`Failed to save handle.`)}}async function lr(e,t,n){let{data:r,error:i,response:a}=await Qe({path:{assistant_id:e},query:{handle:t},signal:n,throwOnError:!1});if(Ee(a,i,`Failed to check handle availability.`),!a.ok||!r)throw new ke(a.status,a.status===429?`Too many checks — try again in a moment.`:le(i,a,`Failed to check handle availability.`));return{available:r.available,code:r.code??null,message:r.message??null}}function ur(e){return/\d{2,}$/.test(e)}var dr=300,fr=1400;function pr({initialHandle:e,inputLabel:t,helperText:n,idleHelperText:r,checkAvailable:i,save:a,onSaved:o,saveSuccessToast:s,fieldId:c}){let{t:l}=J(),[u,d]=(0,Z.useState)(e),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(`idle`),[y,b]=(0,Z.useState)(null),x=dn(),S=(0,Z.useRef)(null),C=(0,Z.useMemo)(()=>u.trim().toLowerCase(),[u]),w=C===e.toLowerCase();(0,Z.useEffect)(()=>{if(w||C.length===0){g(!1),S.current?.abort();return}let e=new AbortController;S.current?.abort(),S.current=e,g(!0);let t=window.setTimeout(async()=>{try{let t=await i(C,e.signal);e.signal.aborted||m(t)}catch(t){e.signal.aborted||b(t instanceof Error?t.message:l(`profileCard.checkAvailabilityFailed`))}finally{e.signal.aborted||g(!1)}},dr);return()=>{window.clearTimeout(t),e.abort()}},[C,w,i,l]);let T=(()=>{if(y)return y;if(p&&!p.available){let e=p.code;return p.message??(e?or[e]:l(`profileCard.chooseDifferentHandle`))}return null})(),E=T?n:w?r??null:h?l(`profileCard.checkingAvailability`):p?.available?l(`profileCard.availableHelper`):null,D=!w&&!h&&p?.available!==!1&&_!==`saving`,O=(0,Z.useCallback)(async()=>{if(!D)return;v(`saving`),b(null);let e=await a(C);if(e.kind===`ok`){v(`saved`),o(e.data),f.success(s),window.setTimeout(()=>v(`idle`),fr);return}if(e.kind===`taken`){v(`idle`),m({available:!1,code:`taken`,message:e.message});return}if(e.kind===`invalid`){v(`idle`),m({available:!1,code:e.code,message:e.message});return}v(`error`),b(e.message),f.error(e.message)},[D,C,o,a,s]),A=(()=>{if(w&&u.length>0||u.length===0)return null;let e=h?`checking`:p?.available?`available`:p?.available===!1?`invalid`:null;return e?(0,Q.jsx)(un,{mode:`wait`,initial:!1,children:(0,Q.jsxs)(fn.span,{initial:x?!1:{opacity:0,scale:.85},animate:{opacity:1,scale:1},exit:x?void 0:{opacity:0,scale:.85},transition:{duration:.14,ease:`easeOut`},className:`flex items-center`,"aria-hidden":e!==`available`&&e!==`invalid`,children:[e===`checking`&&(0,Q.jsx)(Y,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),e===`available`&&(0,Q.jsx)(Ln,{className:`h-4 w-4 text-[var(--system-positive-strong)]`,"aria-label":l(`profileCard.available`)}),e===`invalid`&&(0,Q.jsx)(wn,{className:`h-4 w-4 text-[var(--system-negative-strong)]`,"aria-label":l(`profileCard.notAvailable`)})]},e)}):null})(),j=(()=>{switch(_){case`saving`:return(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(Y,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),l(`profileCard.saving`)]});case`saved`:return(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(Ln,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),l(`profileCard.saved`)]});default:return l(`profileCard.save`)}})();return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(k,{label:t,value:u,onChange:e=>{d(e.target.value.replace(/\s+/g,``)),m(null),b(null)},autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,maxLength:30,leftIcon:(0,Q.jsx)(`span`,{className:`select-none font-mono text-[var(--content-tertiary)]`,"aria-hidden":!0,children:`@`}),rightIcon:A,errorText:T??void 0,helperText:E??void 0,"aria-invalid":!!T,fullWidth:!0,"data-testid":`${c}-input`}),(!w||_!==`idle`)&&(0,Q.jsx)(`div`,{className:`flex justify-end`,children:(0,Q.jsx)(H,{variant:`primary`,size:`compact`,onClick:O,disabled:!D,"aria-live":`polite`,"data-testid":`${c}-save`,children:j})})]})}function mr({initial:e,onSaved:t}){let{t:n}=J(),r=ie.use.refreshSession(),i=ur(e.username)?n(`profileCard.userHandleIdleAutoGenerated`):void 0,a=(0,Z.useCallback)(async e=>await Ce({username:e}),[]),o=(0,Z.useCallback)((e,t)=>T(e,t),[]),s=(0,Z.useCallback)(e=>{t(e),r()},[t,r]);return(0,Q.jsx)(pr,{initialHandle:e.username,inputLabel:n(`profileCard.userHandleLabel`),helperText:n(`profileCard.handleHelper`),idleHelperText:i,checkAvailable:o,save:a,onSaved:s,saveSuccessToast:n(`profileCard.profileUpdated`),fieldId:`user-handle`})}function hr({assistant:e,onSaved:t}){let{t:n}=J(),r=e.handle??``,i=K({...Ae({path:{assistant_id:e.id}})}).data?.results?.[0],a=!!i&&i.subdomain.toLowerCase()===r.toLowerCase(),o=r.length===0?n(`profileCard.assistantHandleIdleEmpty`):void 0,s=(0,Z.useCallback)(async t=>await cr(e.id,t),[e.id]),c=(0,Z.useCallback)((t,n)=>lr(e.id,t,n),[e.id]);return a?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(k,{label:n(`profileCard.assistantHandleLabel`),value:r,readOnly:!0,disabled:!0,leftIcon:(0,Q.jsx)(`span`,{className:`select-none font-mono text-[var(--content-tertiary)]`,"aria-hidden":!0,children:`@`}),fullWidth:!0,"data-testid":`assistant-handle-input`}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:(0,Q.jsx)(G,{i18nKey:`profileCard.handleLocked`,components:{releaseLink:(0,Q.jsx)(gn,{to:`${D.channels}?setup=email&release=1`,className:`text-[var(--content-link)] underline hover:text-[var(--content-link-hover)]`})}})})]}):(0,Q.jsx)(pr,{initialHandle:r,inputLabel:n(`profileCard.assistantHandleLabel`),helperText:n(`profileCard.handleHelper`),idleHelperText:o,checkAvailable:c,save:s,onSaved:t,saveSuccessToast:n(`profileCard.assistantHandleUpdated`),fieldId:`assistant-handle`})}function gr(){let{t:e}=J();return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,"aria-busy":!0,"aria-live":`polite`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(tn,{className:`h-3 w-16`}),(0,Q.jsx)(tn,{className:`h-9 w-full rounded-md`}),(0,Q.jsx)(tn,{className:`h-3 w-72`})]}),(0,Q.jsx)(tn,{className:`h-9 w-full rounded-md`}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(tn,{className:`h-3 w-60`}),(0,Q.jsx)(tn,{className:`h-7 w-16 rounded-md`})]}),(0,Q.jsx)(`span`,{className:`sr-only`,children:e(`profileCard.loading`)})]})}function _r(){return(0,Q.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`})}function vr({assistant:e,showHandles:t=!0,children:n}={}){let{t:r}=J(),i=ie.use.user?.()?.email??null;return(0,Q.jsx)(X,{title:r(`profileCard.title`),subtitle:r(`profileCard.subtitle`),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[i&&(0,Q.jsx)(`div`,{className:`max-w-[420px]`,children:(0,Q.jsx)(k,{label:r(`profileCard.emailLabel`),value:i,disabled:!0,readOnly:!0})}),t&&(0,Q.jsxs)(Q.Fragment,{children:[i&&(0,Q.jsx)(_r,{}),(0,Q.jsx)(yr,{assistant:e})]}),n!=null&&(0,Q.jsxs)(Q.Fragment,{children:[(i||t)&&(0,Q.jsx)(_r,{}),n]})]})})}function yr({assistant:e}){let[t,n]=(0,Z.useState)(null),[r,i]=(0,Z.useState)(null),a=dn(),[o,s]=(0,Z.useState)(e??null);return(0,Z.useEffect)(()=>{s(e??null)},[e]),(0,Z.useEffect)(()=>{let e=!1;return ye().then(t=>{e||n(t)}).catch(t=>{e||i(t instanceof Error?t.message:`Failed to load profile.`)}),()=>{e=!0}},[]),r?(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:r}):t?(0,Q.jsxs)(fn.div,{initial:a?!1:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.22,ease:`easeOut`},className:`flex flex-col gap-6`,children:[(0,Q.jsx)(mr,{initial:t,onSaved:n}),o&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Q.jsx)(hr,{assistant:o,onSaved:s})]})]}):(0,Q.jsx)(gr,{})}var br=.5,xr={dazed:.55,bashful:.4},Sr=.224,Cr=`var(--surface-sunken)`,wr=64;function Tr(e){return xr[e]??br}function Er(e,t,n,r){let i=e?.eyeStyles.find(e=>e.id===t);if(!i||i.paths.length===0)return null;let a=o(i.paths.map(e=>vt(e.svgPath)));if(a.w<=0||a.h<=0)return null;let s=n*(r?br:Tr(t)),c=Math.min(s/a.w,s/a.h),l=n/2-(a.x+a.w/2)*c,u=n/2-(a.y+a.h/2)*c;return{paths:i.paths,transform:`matrix(${c},0,0,${c},${l},${u})`}}function Dr({components:e,eyeStyle:t,color:n,primary:r=!1,fieldColor:i,size:a=wr,className:o}){let s=(0,Z.useMemo)(()=>Er(e,t,a,r),[e,t,a,r]),c=e?.colors.find(e=>e.id===n)?.hex,l=i??c,u=a*Sr;return(0,Q.jsxs)(`svg`,{"aria-hidden":`true`,"data-testid":`app-icon-preview`,className:o,width:a,height:a,viewBox:`0 0 ${a} ${a}`,style:{display:`block`,flexShrink:0},children:[(0,Q.jsx)(`rect`,{"data-testid":`app-icon-preview-field`,width:a,height:a,rx:u,ry:u,fill:l??Cr}),s?(0,Q.jsx)(`g`,{"data-testid":`app-icon-preview-eyes`,transform:s.transform,children:s.paths.map((e,t)=>(0,Q.jsx)(`path`,{d:e.svgPath,fill:e.color},t))}):null]})}var Or={production:`#4C9B50`,staging:`#E9C91A`,dev:`#FF88C9`};d.eyeStyles.find(e=>e.id===`quirky`);var kr=`avatar-eyes-`,Ar={eyeStyle:`quirky`,color:`green`};function jr(e,t){return`${kr}${e}-${t}`}function Mr(e){if(e===null||e.kind!==`character`)return null;let t=e.traits;return v(t)?jr(t.eyeStyle,t.color):null}function Nr(e){return e!==null&&e.startsWith(kr)}function Pr(e){if(e===null||!Nr(e))return null;let t=e.slice(12),n=t.indexOf(`-`);return n<=0||n===t.length-1?null:{eyeStyle:t.slice(0,n),color:t.slice(n+1)}}function Fr(e,t){let n=Mr(e);return{target:n,availableMatch:t.supported&&n!==null&&t.available.includes(n)}}var Ir=160;function Lr(e,t,n){return t<=0?0:(e+n+t)%t}function Rr(e,t){let n=e?.findIndex(e=>e.id===t)??-1;return n>=0?n:0}function zr({open:e,onClose:t,components:n,currentIcon:r,targetIcon:i,canSyncAvatar:a,availableIcons:o,onApply:s,onReset:c}){let{t:l}=J(`settings`),u=Vt(),[d,f]=(0,Z.useState)(0),[p,m]=(0,Z.useState)(0),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(!1),y=a?Pr(i):null;(0,Z.useEffect)(()=>{if(!e)return;let t=Pr(r)??Pr(i)??Ar;f(Rr(n?.eyeStyles,t.eyeStyle)),m(Rr(n?.colors,t.color)),v(!1)},[e,n,r,i]);let b=n?.eyeStyles[d],x=n?.colors[p],S=b?.id??Ar.eyeStyle,C=x?.id??Ar.color,w=jr(S,C),T=w!==r&&o.includes(w),E=async e=>{g(!0),v(!1);try{await e()?t():v(!0)}finally{g(!1)}};return(0,Q.jsx)(R.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,Q.jsxs)(R.Content,{size:`sm`,"data-testid":`app-icon-modal`,children:[(0,Q.jsx)(R.Header,{children:(0,Q.jsx)(R.Title,{children:l(`appIcon.title`)})}),(0,Q.jsxs)(R.Body,{className:`space-y-4`,children:[(0,Q.jsx)(`div`,{className:`flex justify-center`,children:(0,Q.jsx)(`div`,{className:`rounded-2xl bg-[var(--surface-sunken)] p-6`,children:(0,Q.jsx)(Dr,{components:n,eyeStyle:S,color:C,size:Ir})})}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(Zn,{label:l(`appIcon.eyes`),value:S,onPrev:()=>f(Lr(d,n?.eyeStyles.length??0,-1)),onNext:()=>f(Lr(d,n?.eyeStyles.length??0,1))}),(0,Q.jsx)(Zn,{label:l(`appIcon.color`),value:C,colorHex:x?.hex,onPrev:()=>m(Lr(p,n?.colors.length??0,-1)),onNext:()=>m(Lr(p,n?.colors.length??0,1))})]}),y===null?null:(0,Q.jsx)(H,{type:`button`,variant:`outlined`,fullWidth:!0,disabled:h,onClick:()=>{y!==null&&(f(Rr(n?.eyeStyles,y.eyeStyle)),m(Rr(n?.colors,y.color)),v(!1))},children:l(`appIcon.matchAvatar`)}),(0,Q.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:l(u?`appIcon.androidApplyNote`:`appIcon.note`)}),_?(0,Q.jsx)(`p`,{role:`alert`,className:`text-body-small-lighter text-[color:var(--content-negative)]`,children:l(u?`appIcon.androidError`:`appIcon.error`)}):null]}),(0,Q.jsxs)(R.Footer,{children:[r===null?null:(0,Q.jsx)(H,{type:`button`,variant:`outlined`,disabled:h,onClick:()=>void E(c),children:l(`appIcon.reset`)}),(0,Q.jsx)(H,{type:`button`,variant:`primary`,disabled:h||!T,onClick:()=>void E(()=>s(w)),children:l(`appIcon.apply`)})]})]})})}var Br=`AppIcon`,Vr=pn(Br);function Hr(){return{supported:!1,current:null,available:[]}}function Ur(){return Ut()&&sn.isPluginAvailable(Br)}async function Wr(){if(!Ur())return Hr();try{let{supported:e,current:t,available:n}=await Vr.getState();return{supported:e===!0,current:typeof t==`string`?t:null,available:n??[]}}catch(e){return S(e,{context:`app_icon_get_state`,bestEffort:!0}),Hr()}}async function Gr(e){if(!Ur())return!1;try{let{ok:t,error:n}=await Vr.set({name:e});return t===!0?!0:(S(Error(n??`setAlternateIconName failed`),{context:`app_icon_set`,bestEffort:!0}),!1)}catch(e){return S(e,{context:`app_icon_set`,bestEffort:!0}),!1}}var Kr={supported:!1,current:null,available:[]};function qr(e,t){return e.supported===t.supported&&e.current===t.current&&e.available.length===t.available.length&&e.available.every((e,n)=>e===t.available[n])}var Jr=et(ln()((e,t)=>({snapshot:Kr,setSnapshot:n=>{qr(t().snapshot,n)||e({snapshot:n})}}))),Yr=[];function Xr(e){let t=Ue(),n=Vt(),r=U.use.androidAvatarAppIcon(),i=t||n&&r,{state:a}=He(e),o=Jr.use.snapshot(),s=Jr.use.setSnapshot(),c=(0,Z.useCallback)(async()=>{if(!i)return s(Kr),Kr;let e=await Wr();return s(e),e},[i,s]);(0,Z.useEffect)(()=>{c()},[c]),_t(`app.resume`,()=>{c()});let l=i&&o.supported,{target:u,availableMatch:d}=Fr(a,o),f=d&&u!==o.current,p=o.available,m=(0,Z.useCallback)(async e=>{if(!l||!p.includes(e))return!1;await Gr(e);let t=await c();return t.supported&&t.current===e},[l,p,c]),h=(0,Z.useCallback)(async()=>{if(!l)return!1;await Gr(null);let e=await c();return e.supported&&e.current===null},[l,c]);return{enabled:l,currentIcon:l?o.current:null,targetIcon:l?u:null,availableIcons:l?p:Yr,canSyncAvatar:f,apply:m,reset:h}}var Zr=[`ai.vocify-inc.vellum-assistant-ios`,`ai.vellum.assistant`],Qr={"":`production`,".staging":`staging`,".dev":`dev`};function $r(e){for(let t of Zr){if(!e.startsWith(t))continue;let n=Qr[e.slice(t.length)];if(n)return n}return null}async function ei(){try{let{App:e}=await vn(async()=>{let{App:e}=await import(`./esm-BGKIdtva.js`);return{App:e}},__vite__mapDeps([0,1,2,3])),{id:t}=await e.getInfo();return $r(t)}catch(e){return console.debug(`[shell-environment] no native shell identity:`,e),null}}function ti(){let[e,t]=(0,Z.useState)();return(0,Z.useEffect)(()=>{let e=!0;return ei().then(n=>{e&&t(n)}),()=>{e=!1}},[]),e}var ni=32,ri={dev:{displayP3:`color(display-p3 0.9387 0.55755 0.7777)`,srgb:Or.dev},staging:{displayP3:`color(display-p3 0.89313 0.79283 0.2841)`,srgb:Or.staging}},ii={local:`dev`,dev:`dev`,staging:`staging`};function ai(){return typeof CSS>`u`||typeof CSS.supports!=`function`?!1:CSS.supports(`color`,`color(display-p3 1 1 1)`)}function oi(e){if(e)return ai()?e.displayP3:e.srgb}function si(e){if(e)return e;if(e===null)return ii.local}function ci(e,t){let n=si(e);if(!n)return;let r=ri[n];return t?r?.srgb:oi(r)}function li(){let e=Yt.use.activeAssistantId(),t=Xr(e);return t.enabled?(0,Q.jsx)(ui,{assistantId:e,sync:t}):null}function ui({assistantId:e,sync:t}){let{t:n}=J(`settings`),{components:r}=He(e),i=De(),a=ti(),o=Vt(),[s,c]=(0,Z.useState)(!1),l=r??i,u=Pr(t.currentIcon),d=u??Ar,f=u===null;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Q.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:n(`appIcon.title`)}),(0,Q.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:n(`appIcon.description`)})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3`,children:[(0,Q.jsx)(Dr,{components:l,eyeStyle:d.eyeStyle,color:d.color,primary:f,fieldColor:f?ci(a,o):void 0,size:ni}),(0,Q.jsx)(H,{variant:`outlined`,onClick:()=>c(!0),children:n(`appIcon.change`)})]})]}),(0,Q.jsx)(zr,{open:s,onClose:()=>c(!1),components:l,currentIcon:t.currentIcon,targetIcon:t.targetIcon,canSyncAvatar:t.canSyncAvatar,availableIcons:t.availableIcons,onApply:t.apply,onReset:t.reset})]})}var di=Ht({query:{hosting:`platform`}});function fi(){let{t:e}=J(`settings`),t=Ye(),n=K(di),r=n.data?.results??[];return n.isPending||r.length<2?null:(0,Q.jsx)(X,{title:e(`assistantPicker.title`),subtitle:e(`assistantPicker.subtitle`),children:(0,Q.jsx)(`div`,{className:`space-y-2`,children:r.map(n=>{let r=n.id===t;return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-lg border px-4 py-3 ${r?`border-[var(--border-focus)] bg-[var(--surface-lift)]`:`border-[var(--border-base)] bg-[var(--surface-default)]`}`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(Rn,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:n.name||e(`assistantPicker.unnamed`)}),n.status!==`active`&&(0,Q.jsx)(an,{tone:`warning`,children:n.status})]})})]}),(0,Q.jsx)(`div`,{className:`shrink-0`,children:r?(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-body-small-default text-[var(--system-positive-default)]`,children:[(0,Q.jsx)(Ln,{className:`h-4 w-4`}),e(`assistantPicker.active`)]}):(0,Q.jsx)(H,{variant:`outlined`,size:`compact`,disabled:n.status!==`active`,onClick:()=>{ee(n.id),f.success(e(`assistantPicker.switchedToast`))},children:e(`assistantPicker.switch`)})})]},n.id)})})})}var pi=[0,300,600,3600,10800,86400,259200,604800,1209600,2592e3],mi=new Set([300,600]);function hi(e,t){if(e===0)return t(`assistantSleepPolicy.neverSleep`);let n=Math.floor(e/86400),r=Math.floor(e%86400/3600);if(n>0&&r>0)return t(`assistantSleepPolicy.daysHours`,{days:n,hours:r});if(n>0)return t(`assistantSleepPolicy.days`,{days:n});if(r>0)return t(`assistantSleepPolicy.hours`,{hours:r});let i=Math.floor(e/60);return i>0?t(`assistantSleepPolicy.minutes`,{minutes:i}):t(`assistantSleepPolicy.seconds`,{seconds:e})}function gi(e,t){switch(e){case 0:return t(`assistantSleepPolicy.presetNever`);case 300:return t(`assistantSleepPolicy.preset5Min`);case 600:return t(`assistantSleepPolicy.preset10Min`);case 3600:return t(`assistantSleepPolicy.preset1Hour`);case 10800:return t(`assistantSleepPolicy.preset3Hours`);case 86400:return t(`assistantSleepPolicy.preset1Day`);case 259200:return t(`assistantSleepPolicy.preset3Days`);case 604800:return t(`assistantSleepPolicy.preset7Days`);case 1209600:return t(`assistantSleepPolicy.preset14Days`);case 2592e3:return t(`assistantSleepPolicy.preset30Days`);default:return hi(e,t)}}function _i({assistantId:e}){let{t}=J(`settings`),n=q(),r=zn.use.isNonProduction(),i=(0,Z.useMemo)(()=>pi.filter(e=>!mi.has(e)||r),[r]),{data:a,isLoading:o,isError:s}=K($t({path:{id:e}})),c=(0,Z.useMemo)(()=>a?.idle_timeout_seconds??259200,[a]),[l,u]=(0,Z.useState)(null),d=l??c,p=l!==null,m=Ct({onSuccess:()=>{f.success(t(`assistantSleepPolicy.savedToast`)),u(null),n.invalidateQueries({queryKey:Ve({path:{id:e}})})},onError:()=>{f.error(t(`assistantSleepPolicy.saveErrorToast`))}});return o?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(Y,{className:`h-4 w-4 animate-spin`}),t(`assistantSleepPolicy.loading`)]}):s?(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:t(`assistantSleepPolicy.loadError`)}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:t(`assistantSleepPolicy.idleTimeout`)}),(0,Q.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:t(`assistantSleepPolicy.idleTimeoutDescription`)}),(0,Q.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:i.map(e=>(0,Q.jsx)(H,{variant:`outlined`,active:d===e,onClick:()=>u(e),children:gi(e,t)},e))}),(0,Q.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:t(`assistantSleepPolicy.current`,{duration:hi(d,t)})})]}),p&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(H,{variant:`primary`,leftIcon:m.isPending?(0,Q.jsx)(Y,{className:`animate-spin`}):void 0,onClick:()=>m.mutate({path:{id:e},body:{idle_timeout_seconds:d}}),disabled:m.isPending,children:t(`assistantSleepPolicy.save`)}),(0,Q.jsx)(H,{variant:`outlined`,onClick:()=>u(null),disabled:m.isPending,children:t(`assistantSleepPolicy.cancel`)})]})]})}function vi(e,t,n){let r=[e.version];return e.version===n&&r.push(W(`settings:assistantUpgrades.latestSuffix`)),t&&e.version===t&&r.push(W(`settings:assistantUpgrades.currentSuffix`)),r.join(` `)}var yi=3e3;function bi({version:e,assistantId:t}){let{onTap:n,message:r}=qn(t);return(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`block min-w-0 break-all text-left text-body-medium-lighter text-[var(--content-default)]`,onClick:n,children:e??`—`}),r&&(0,Q.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-accent)]`,children:r})]})}function xi({assistantId:e,currentVersion:t,releaseChannel:n,onUpgradeComplete:r}){let{t:i}=J(`settings`),a=bt.use.rollbackEnabled(),o=U.use.previewChannel(),s=q(),l=_(n,o),u=l===`preview`,[d,p]=(0,Z.useState)(!1),h=(0,Z.useRef)(null),[g,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(null),T=e=>e&&h.current&&e===h.current?(queueMicrotask(()=>{w(i(x?`assistantUpgrades.successRolledBack`:`assistantUpgrades.successUpdated`,{version:h.current})),p(!1),h.current=null,v(null),f.success(i(x?`assistantUpgrades.toastRollbackComplete`:`assistantUpgrades.toastUpdateComplete`),{id:`runtime-upgrade-complete`,tone:`strong`}),r?.()}),!1):yi;K({...Le({path:{id:e}}),refetchInterval:d?e=>T(e.state.data?.current_release_version):!1});let{data:E,isLoading:D}=K(ft({query:{channel:l}})),O=E?.find(e=>e.is_stable!==!1)??E?.[0],k=g??O?.version??null,A=(0,Z.useMemo)(()=>{if(!a||!k||!t)return!1;let e=Ie(k),n=Ie(t);return!e||!n?!1:nt(e,n)<0},[a,k,t]),j=(0,Z.useMemo)(()=>{if(!k)return!1;if(!t)return!0;let e=Ie(k),n=Ie(t);if(!e||!n)return k!==t;let r=nt(e,n);return a?r!==0:r>0},[a,k,t]),M=cn({mutationFn:async t=>{let{data:n}=await c({path:{id:e},body:t,throwOnError:!0});return n}}),N=cn({mutationFn:async t=>{let{data:n}=await Kt({path:{id:e},body:t,throwOnError:!0});return n}}),P=async()=>{b(!1),w(null);let t=a?k??void 0:void 0;try{if(A){let e=await N.mutateAsync({version:t});h.current=e.version??t??null,f.success(e.detail||i(`assistantUpgrades.toastRollbackInitiated`,{version:t}))}else{let e=await M.mutateAsync({version:t});if(e.detail?.includes(`Already on the latest`)){f.warning(e.detail);return}h.current=e.version??t??null,f.success(e.detail||i(`assistantUpgrades.toastUpdateInitiated`,{version:e.version??t??i(`assistantUpgrades.latest`)}))}S(A),p(!0),s.invalidateQueries({queryKey:qt({path:{id:e}})})}catch{f.error(i(A?`assistantUpgrades.toastRollbackFailed`:`assistantUpgrades.toastUpdateFailed`))}},F=i(u?`assistantUpgrades.previewRelease`:j?A?`assistantUpgrades.rollbackTo`:`assistantUpgrades.updateTo`:`assistantUpgrades.selected`);return(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:i(`assistantUpgrades.current`)}),(0,Q.jsx)(bi,{version:t,assistantId:e})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:F}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 md:flex-row md:items-center md:gap-4`,children:[(0,Q.jsx)(`span`,{className:`block min-w-0 flex-1`,children:D?(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(Y,{className:`h-3 w-3 animate-spin`}),i(`assistantUpgrades.loading`)]}):E&&E.length>0?a?(0,Q.jsx)(Qt,{value:k??``,onChange:e=>v(e===O?.version?null:e),disabled:d||M.isPending||N.isPending,options:E.map(e=>({value:e.version,label:vi(e,t,O?.version)}))}):(0,Q.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:O?vi(O,t,O.version):`—`}):i(`assistantUpgrades.noReleases`)}),(0,Q.jsx)(H,{variant:A?`outlined`:`primary`,className:`min-w-[160px] shrink-0`,leftIcon:M.isPending||N.isPending||d?(0,Q.jsx)(Y,{className:`animate-spin`}):(0,Q.jsx)(Fn,{}),onClick:()=>b(!0),disabled:!j||M.isPending||N.isPending||d||D||!E?.length,children:i(d?x?`assistantUpgrades.rollingBack`:`assistantUpgrades.updating`:A?`assistantUpgrades.rollback`:u?`assistantUpgrades.updatePreview`:`assistantUpgrades.update`)})]})]})]}),u&&(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:(0,Q.jsx)(G,{ns:`settings`,i18nKey:`assistantUpgrades.usingPreviewReleases`,components:{stableLink:(0,Q.jsx)(`a`,{href:`#preview-release-channel`,className:`text-[var(--primary-base)] underline-offset-2 hover:underline`})}})}),!j&&t&&k&&!D&&(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:C??i(`assistantUpgrades.alreadyOnVersion`)}),(0,Q.jsx)(m,{open:y,title:i(A?`assistantUpgrades.confirmRollbackTitle`:u?`assistantUpgrades.confirmPreviewTitle`:`assistantUpgrades.confirmUpdateTitle`),message:A?i(`assistantUpgrades.confirmRollbackMessage`,{version:k??i(`assistantUpgrades.unknown`)}):i(u?`assistantUpgrades.confirmPreviewMessage`:`assistantUpgrades.confirmUpdateMessage`,{version:k??i(`assistantUpgrades.latest`)}),confirmLabel:i(A?`assistantUpgrades.rollback`:u?`assistantUpgrades.updatePreview`:`assistantUpgrades.update`),onConfirm:P,onCancel:()=>b(!1)})]})}function Si({assistantId:e,currentVersion:t,onUpgradeComplete:n}){let{t:r}=J(`settings`),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),{data:c,isLoading:l}=K(ft({query:{stable:!0,limit:100}})),u=(0,Z.useMemo)(()=>se(c),[c]),d=u?.version,p=t?O(t,d):!!d,h=P({assistantId:e,targetVersion:d});return(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:r(`assistantUpgrades.current`)}),(0,Q.jsx)(bi,{version:t,assistantId:e})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:r(`assistantUpgrades.updateTo`)}),(0,Q.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:l?r(`assistantUpgrades.loading`):d&&u?vi(u,t,d):r(`assistantUpgrades.noReleases`)})]})]}),(0,Q.jsx)(H,{variant:`primary`,className:`min-w-[160px]`,leftIcon:h.isPending?(0,Q.jsx)(Y,{className:`animate-spin`}):(0,Q.jsx)(Fn,{}),onClick:()=>a(!0),disabled:h.isPending||l||!d||!p,children:h.isPending?r(`assistantUpgrades.updating`):d?r(`assistantUpgrades.updateToVersion`,{version:d}):r(`assistantUpgrades.update`)}),o&&(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:o}),!o&&!p&&d&&!l&&(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:r(`assistantUpgrades.alreadyOnVersion`)}),(0,Q.jsx)(m,{open:i,title:r(`assistantUpgrades.confirmUpdateTitle`),message:r(`assistantUpgrades.confirmUpdateMessage`,{version:d??r(`assistantUpgrades.latest`)}),confirmLabel:r(`assistantUpgrades.update`),onConfirm:async()=>{a(!1),s(null);try{s(r(`assistantUpgrades.successUpdated`,{version:(await h.upgrade()).version??d??r(`assistantUpgrades.latest`)})),f.success(r(`assistantUpgrades.toastUpdateComplete`),{id:`runtime-upgrade-complete`,tone:`strong`}),n?.()}catch(e){f.error(e instanceof Error?e.message:r(`assistantUpgrades.toastUpdateFailed`))}},onCancel:()=>a(!1)})]})}function Ci(){let{t:e}=J(`settings`),t=_e({platformHostedOnly:!0}),n=Zt(),r=ie.use.user()?.id??null,i=ie.use.logout(),[a,o]=(0,Z.useState)(!1),s=Et({onSuccess:async()=>{f.success(e(`deleteAccountSection.toastRequested`)),pe(r),await i(),y(D.account.login)},onError:()=>{f.error(e(`deleteAccountSection.toastFailed`))}}),c=t===`full`&&n;return(0,Z.useEffect)(()=>{c&&a&&o(!1)},[c,a]),t===`gated`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`deleteAccountSection.title`)}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`deleteAccountSection.description`)}),(0,Q.jsx)(`div`,{className:`mt-1`,children:t===`disabled`?(0,Q.jsx)(V,{children:e(`deleteAccountSection.platformLoginNotice`)}):(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(H,{variant:`dangerOutline`,onClick:()=>o(!0),disabled:s.isPending||c,className:`self-start`,children:e(`deleteAccountSection.deleteMyAccount`)}),c&&(0,Q.jsx)(Y,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`})]})})]}),(0,Q.jsx)(m,{open:a,title:e(`deleteAccountSection.confirmTitle`),message:e(`deleteAccountSection.confirmMessage`),confirmLabel:e(`deleteAccountSection.confirmLabel`),destructive:!0,onConfirm:()=>{if(c){o(!1);return}o(!1),s.mutate({})},onCancel:()=>o(!1)})]})}function wi({title:e,subtitle:t,benefits:n,ctaLabel:r,ctaLeftIcon:i,onAction:a}){return(0,Q.jsx)(X,{title:e,subtitle:t,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`ul`,{className:`space-y-3`,children:n.map(({icon:e,text:t})=>(0,Q.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md`,style:{background:`var(--surface-base)`},children:(0,Q.jsx)(e,{size:14,style:{color:`var(--content-secondary)`},"aria-hidden":!0})}),(0,Q.jsx)(`span`,{className:`text-body-medium-lighter text-[color:var(--content-secondary)]`,children:t})]},t))}),(0,Q.jsx)(H,{variant:`primary`,size:`regular`,leftIcon:i,onClick:a,className:`self-start`,children:r})]})})}function Ti({promotion:e}){let{t}=J(`settings`),{appName:n,target:r}=e;return(0,Z.useEffect)(()=>{St(`settings`,r)},[r]),(0,Q.jsx)(wi,{title:n===null?t(`nativeAppCard.titleGeneric`):t(`nativeAppCard.title`,{appName:n}),subtitle:n===null?t(`nativeAppCard.subtitleGeneric`):t(`nativeAppCard.subtitle`,{appName:n}),benefits:[{icon:xn,text:t(`nativeAppCard.benefitPush`)},{icon:nr,text:t(`nativeAppCard.benefitBiometric`)},{icon:ir,text:t(`nativeAppCard.benefitHaptics`)},{icon:In,text:t(`nativeAppCard.benefitHomeScreen`)}],ctaLabel:t(`nativeAppCard.download`),ctaLeftIcon:(0,Q.jsx)(In,{size:16}),onAction:()=>{We(`click`,`settings`,r),F(r),i(r)}})}function Ei(){let e=Be(),t=dt(),n=zt(),r=jt();return!e&&!t&&!n&&!r?null:(0,Q.jsx)(Ti,{promotion:mt(e||t?`ios`:n?`android`:null)})}var Di=`0.10.0`;function Oi(){return Pt(Di)}var ki=`/v1/remote-web/pairing-challenge`,Ai=`/v1/remote-web/pairing-verification`,ji=`/v1/remote-web/pairing-requests`,Mi=`${ji}/approve`,Ni=`${ji}/deny`;function Pi(){return W(`settings:pairDeviceClient.connectivityHint`)}var Fi=class extends Error{hint;status;code;constructor(e,t={}){super(e),this.name=`PairDeviceError`,this.hint=t.hint,this.status=t.status,this.code=t.code}},Ii=5e3;function Li(){if(typeof window>`u`)return null;let e=x(),t=p(e);return t?{base:`${window.location.origin}${t}`,assistantName:e?.name?.trim()||null,ingressUrl:e?.ingressUrl?.trim()||null}:null}function Ri(e){let t=e?.error?.message;return typeof t==`string`&&t.trim()?t:null}function zi(e){let t=e?.error?.code;return typeof t==`string`&&t?t:void 0}async function Bi(e,t,n,r){let i;try{i=await fetch(e,{...t,signal:n})}catch(e){throw j(e)?e:new Fi(W(`settings:pairDeviceClient.networkError`))}let a=await i.json().catch(()=>null);if(!i.ok)throw new Fi(Ri(a)??W(`settings:pairDeviceClient.httpError`,{status:i.status}),{hint:r,status:i.status,code:zi(a)});if(typeof a!=`object`||!a)throw new Fi(W(`settings:pairDeviceClient.unexpectedResponse`));return a}function Vi(e,t,n,r){return Bi(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)},n,r)}async function Hi(e){let{base:t,publicBaseUrl:n,signal:r}=e,i=await Vi(`${t}${ki}`,{publicBaseUrl:n},r,Pi());try{await Vi(`${t}${Ai}`,{userCode:i.userCode},r,Pi())}catch(e){let n=AbortSignal.timeout(Ii);throw j(e)?Ui(t,i.userCode,n):await Ui(t,i.userCode,r?AbortSignal.any([r,n]):n),e}return{pairUrl:Mt(i),expiresAt:i.expiresAt}}async function Ui(e,t,n){try{let r=(await Wi({base:e,signal:n})).find(e=>e.userCode===t);r&&await qi({base:e,requestId:r.requestId,signal:n})}catch(e){if(j(e))return;S(e,{context:`pair-device-orphan-cleanup`,bestEffort:!0})}}async function Wi(e){let t=await Bi(`${e.base}${ji}`,{method:`GET`},e.signal);return Array.isArray(t.requests)?t.requests:[]}async function Gi(e,t){await Vi(`${t.base}${e}`,{requestId:t.requestId},t.signal)}function Ki(e){return Gi(Mi,e)}function qi(e){return Gi(Ni,e)}var Ji=Object.defineProperty,Yi=Object.getOwnPropertySymbols,Xi=Object.prototype.hasOwnProperty,Zi=Object.prototype.propertyIsEnumerable,Qi=(e,t,n)=>t in e?Ji(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$i=(e,t)=>{for(var n in t||={})Xi.call(t,n)&&Qi(e,n,t[n]);if(Yi)for(var n of Yi(t))Zi.call(t,n)&&Qi(e,n,t[n]);return e},ea=(e,t)=>{var n={};for(var r in e)Xi.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Yi)for(var r of Yi(e))t.indexOf(r)<0&&Zi.call(e,r)&&(n[r]=e[r]);return n},ta;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(ta||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(ta||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(ta||={});var na=ta,ra={L:na.QrCode.Ecc.LOW,M:na.QrCode.Ecc.MEDIUM,Q:na.QrCode.Ecc.QUARTILE,H:na.QrCode.Ecc.HIGH},ia=128,aa=`L`,oa=`#FFFFFF`,sa=`#000000`,ca=!1,la=1,ua=4,da=0,fa=.1;function pa(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function ma(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function ha(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*fa),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function ga(e,t){return t==null?e?ua:da:Math.max(Math.floor(t),0)}function _a({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=Z.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...na.QrSegment.makeSegments(t)),e),[]);return na.QrCode.encodeSegments(r,ra[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=Z.useMemo(()=>{let e=c.getModules(),t=ga(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:ha(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var va=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),ya=Z.forwardRef(function(e,t){let n=e,{value:r,size:i=ia,level:a=aa,bgColor:o=oa,fgColor:s=sa,includeMargin:c=ca,minVersion:l=la,boostLevel:u,marginSize:d,imageSettings:f}=n,p=ea(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=ea(p,[`style`]),g=f?.src,_=Z.useRef(null),v=Z.useRef(null),y=Z.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=Z.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=_a({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});Z.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=ma(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,va?t.fill(new Path2D(pa(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),Z.useEffect(()=>{x(!1)},[g]);let E=$i({height:i,width:i},m),D=null;return g!=null&&(D=Z.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),Z.createElement(Z.Fragment,null,Z.createElement(`canvas`,$i({style:E,height:i,width:i,ref:y,role:`img`},h)),D)});ya.displayName=`QRCodeCanvas`;var ba=Z.forwardRef(function(e,t){let n=e,{value:r,size:i=ia,level:a=aa,bgColor:o=oa,fgColor:s=sa,includeMargin:c=ca,minVersion:l=la,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=ea(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=_a({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=ma(g,v.excavation)),b=Z.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=pa(y,h);return Z.createElement(`svg`,$i({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&Z.createElement(`title`,null,d),Z.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),Z.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});ba.displayName=`QRCodeSVG`;function xa(e,t){return!Number.isFinite(t)||t<=0?e(`pairDeviceReady.singleUse`):e(`pairDeviceReady.expiresIn`,{time:Gn(t)})}function Sa({pairUrl:e,remainingMs:t,expired:n,copied:r,onCopy:i}){let{t:a}=J(`settings`);return n?(0,Q.jsx)(z,{tone:`warning`,title:a(`pairDeviceReady.expiredTitle`),children:a(`pairDeviceReady.expiredBody`)}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`div`,{className:`w-fit rounded-lg bg-white p-3`,children:(0,Q.jsx)(ba,{value:e,size:192,level:`M`,title:a(`pairDeviceReady.qrTitle`)})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`code`,{"data-testid":`pair-device-url`,className:`min-w-0 flex-1 truncate rounded-md bg-[var(--surface-active)] px-2.5 py-1.5 text-body-small-default text-[var(--content-secondary)]`,children:e}),(0,Q.jsx)(H,{variant:`outlined`,size:`compact`,leftIcon:r?(0,Q.jsx)(Ln,{}):(0,Q.jsx)(Mn,{}),onClick:()=>i(e),children:a(r?`pairDeviceReady.copiedButton`:`pairDeviceReady.copyButton`)})]}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:xa(a,t)})]})}function Ca(e){return/iPhone|iPod/.test(e)?`iPhone`:/iPad/.test(e)||/Macintosh/.test(e)&&/Mobile/.test(e)?`iPad`:/Android/.test(e)?`Android`:/Macintosh|Mac OS X/.test(e)?`macOS`:/Windows/.test(e)?`Windows`:/CrOS/.test(e)?`ChromeOS`:/Linux/.test(e)?`Linux`:null}function wa(e){return/Edg\/|EdgA\/|EdgiOS\//.test(e)?`Edge`:/OPR\/|OPiOS\//.test(e)?`Opera`:/Firefox\/|FxiOS\//.test(e)?`Firefox`:/Chrome\/|CriOS\//.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:null}function Ta(e){if(!e||e.trim()===``)return null;let t=Ca(e),n=wa(e);return t===null&&n===null?null:{browser:n,os:t}}var Ea=5e3,Da=6e4;function Oa({pollWhilePairing:e=!1,revalidateKey:t,isExpanded:n=!1}={}){let[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),d=(0,Z.useRef)(!0),f=(0,Z.useRef)(0);(0,Z.useEffect)(()=>(d.current=!0,()=>{d.current=!1}),[]);let p=(0,Z.useCallback)((e=x()?.assistantId)=>{if(!e)return;i(t=>t&&t.assistantId!==e?null:t);let t=++f.current;wt(e).then(n=>{!d.current||t!==f.current||i(n.ok?{assistantId:e,devices:n.devices}:null)})},[]),m=Yt.use.selectedAssistantId()??x()?.assistantId;(0,Z.useEffect)(()=>{o(null),u(null),p(m)},[m,p]);let h=(0,Z.useRef)(t);(0,Z.useEffect)(()=>{t!==h.current&&(h.current=t,p(m))},[t,m,p]);let g=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{if(e&&!s){g.current=!0;let e=setInterval(()=>p(),Ea);return()=>clearInterval(e)}!e&&g.current&&(g.current=!1,p())},[e,s,p]);let _=(r?.devices.length??0)>0;(0,Z.useEffect)(()=>{if(!n||!_||e||s)return;let t=setInterval(()=>p(),Da);return()=>clearInterval(t)},[n,_,e,s,p]);let v=(0,Z.useCallback)(e=>{u(null),o(e)},[]),y=(0,Z.useCallback)(()=>{o(null),u(null)},[]),b=(0,Z.useCallback)(()=>{!r||!a||s||(c(!0),u(null),Pe(r.assistantId,a.hashedDeviceId).then(e=>{d.current&&(c(!1),e.ok?(o(null),p()):u(e.error))}))},[r,a,s,p]);return{devices:r?.devices??null,confirmTarget:a,isRevoking:s,revokeError:l,requestRevoke:v,cancelRevoke:y,confirmRevoke:b}}var ka=600*1e3,Aa=`paired-devices`;function ja(e){return e.slice(0,12)}function Ma(e,t){return t?t.charAt(0).toUpperCase()+t.slice(1):e(`pairedDevicesSection.platformUnknown`)}function Na(e,t){if(typeof t.clientReportedName==`string`&&t.clientReportedName.trim()!==``)return{name:t.clientReportedName,isRealIdentity:!0};let n=Ta(t.pairingUserAgent);if(n!==null){let{browser:t,os:r}=n;return t!==null&&r!==null?{name:e(`pairedDevicesSection.browserOnOs`,{browser:t,os:r}),isRealIdentity:!0}:{name:t??r??``,isRealIdentity:!0}}return{name:Ma(e,t.platform),isRealIdentity:!1}}function Pa(e,t){return t===null?e(`pairedDevicesSection.dateUnknown`):new Date(t).toLocaleDateString(fe())}function Fa(e,t){let n=Pa(e,t.issuedAt);return t.lastUsedAt===null?e(`pairedDevicesSection.pairedLine`,{paired:n}):Date.now()-t.lastUsedAt<=ka?e(`pairedDevicesSection.pairedActiveLine`,{paired:n}):e(`pairedDevicesSection.pairedAndUsedLine`,{paired:n,lastUsed:Qn(t.lastUsedAt)})}function Ia({pollWhilePairing:e=!1,revalidateKey:t}={}){let{t:n}=J(`settings`),[r,i]=(0,Z.useState)(!1),a=Oa({pollWhilePairing:e,revalidateKey:t,isExpanded:r}),{devices:o,confirmTarget:s}=a;$n(o?.some(e=>e.lastUsedAt!==null)??!1);let c=(0,Z.useMemo)(()=>o===null?null:[...o].sort((e,t)=>(t.lastUsedAt??0)-(e.lastUsedAt??0)),[o]);return c===null||c.length===0?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(B.Root,{type:`multiple`,value:r?[Aa]:[],onValueChange:e=>i(e.includes(Aa)),children:(0,Q.jsxs)(B.Item,{value:Aa,children:[(0,Q.jsxs)(B.Trigger,{className:`group flex w-full items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:n(`pairedDevicesSection.title`,{count:c.length})}),(0,Q.jsx)(En,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,Q.jsx)(B.Content,{children:(0,Q.jsx)(`div`,{className:`mt-3 flex flex-col gap-3`,children:c.map(e=>{let t=Na(n,e);return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1 text-body-medium-default text-[var(--content-secondary)]`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,title:t.isRealIdentity?e.hashedDeviceId:void 0,children:t.name}),!t.isRealIdentity&&(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-[var(--content-tertiary)]`,title:e.hashedDeviceId,children:ja(e.hashedDeviceId)}),e.isCurrentHost&&(0,Q.jsx)(`span`,{className:`shrink-0 text-[var(--content-tertiary)]`,children:`· ${n(`pairedDevicesSection.thisMachine`)}`})]}),(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:Fa(n,e)})]}),(0,Q.jsx)(H,{variant:`dangerOutline`,size:`compact`,className:`shrink-0`,disabled:e.isCurrentHost===!0,title:e.isCurrentHost?n(`pairedDevicesSection.hostRevokeDisabledTitle`):void 0,onClick:()=>a.requestRevoke(e),children:n(`pairedDevicesSection.revokeButton`)})]},e.hashedDeviceId)})})})]})}),(0,Q.jsx)(m,{open:s!==null,title:n(`pairedDevicesSection.confirmTitle`),message:s&&(0,Q.jsxs)(Q.Fragment,{children:[n(`pairedDevicesSection.confirmMessageNamed`,{name:Na(n,s).name,hash:ja(s.hashedDeviceId)}),a.revokeError&&(0,Q.jsx)(`span`,{className:`mt-2 block text-[var(--system-negative-strong)]`,children:a.revokeError})]}),confirmLabel:n(`pairedDevicesSection.revokeButton`),destructive:!0,isPending:a.isRevoking,onConfirm:a.confirmRevoke,onCancel:a.cancelRevoke})]})}var La=5e3;function Ra(e,t){return e.length===t.length&&t.every((t,n)=>e[n]?.requestId===t.requestId)}function za(e,t){let[n,r]=(0,Z.useState)([]),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(null),u=(0,Z.useRef)(null),d=(0,Z.useRef)(null),[f,p]=(0,Z.useState)(e);e!==f&&(p(e),r([]),a(null),s(null),l(null)),(0,Z.useEffect)(()=>()=>{d.current?.abort(),d.current=null},[e]),(0,Z.useEffect)(()=>{let t=async()=>{u.current?.abort();let t=new AbortController;u.current=t;try{let n=await Wi({base:e,signal:t.signal});if(t.signal.aborted)return;r(e=>Ra(e,n)?e:n),l(e=>e&&!e.sticky&&!n.some(t=>t.requestId===e.requestId)?null:e),s(null)}catch(e){if(t.signal.aborted)return;if(e instanceof Fi){s(e.message);return}S(e,{context:`pair-device-pending-requests-poll`}),s(W(`settings:usePendingPairingRequests.pollErrorFallback`))}};t();let n=setInterval(()=>void t(),La);return()=>{clearInterval(n),u.current?.abort()}},[e]);let m=(0,Z.useCallback)(async(n,i)=>{if(d.current)return;let o=new AbortController;d.current=o,a({requestId:n,action:i}),l(null);let s=()=>{u.current?.abort(),r(e=>e.filter(e=>e.requestId!==n))};try{if(await(i===`approve`?Ki:qi)({base:e,requestId:n,signal:o.signal}),o.signal.aborted)return;s(),i===`approve`&&t?.()}catch(e){if(o.signal.aborted)return;e instanceof Fi?i===`deny`&&e.status===409&&e.code===`ALREADY_APPROVED`?(s(),t?.(),l({requestId:n,message:W(`settings:usePendingPairingRequests.denyAlreadyApproved`),sticky:!0})):e.status===404||e.status===410?s():l({requestId:n,message:e.message}):(S(e,{context:`pair-device-pending-request-action`}),l({requestId:n,message:W(`settings:usePendingPairingRequests.actionErrorFallback`)}))}finally{d.current===o&&(d.current=null),o.signal.aborted||a(null)}},[e,t]),h=(0,Z.useCallback)(e=>m(e,`approve`),[m]),g=(0,Z.useCallback)(e=>m(e,`deny`),[m]);return{requests:n,actingOn:i,error:c?.message??o,approve:h,deny:g}}function Ba({base:e,onApproved:t}){let{t:n}=J(`settings`),{requests:r,actingOn:i,error:a,approve:o,deny:s}=za(e,t);return $n(r.length>0),r.length===0&&!a?null:(0,Q.jsxs)(`section`,{className:`flex flex-col gap-3 border-t border-[var(--border-element)] pt-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:n(`pendingPairingRequests.title`)}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:n(`pendingPairingRequests.instruction`)})]}),a&&(0,Q.jsx)(z,{tone:`error`,title:a}),r.length>0&&(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2`,children:r.map(e=>{let t=i!==null&&i.requestId===e.requestId?i.action:null,r=t===`approve`,a=t===`deny`;return(0,Q.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-lg border border-[var(--border-element)] p-3`,children:[(0,Q.jsx)(`code`,{className:ct(`rounded-md bg-[var(--surface-active)] text-body-small-default text-[color:var(--content-primary)]`,`w-fit px-2.5 py-1.5 text-title-medium tracking-wide text-[color:var(--content-emphasised)]`),children:e.userCode}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e.viaEdgeProxy===!1?n(`pendingPairingRequests.requestedMetaHost`,{when:Qn(e.requestedAt)}):n(`pendingPairingRequests.requestedMeta`,{when:Qn(e.requestedAt),ip:e.requesterIp})}),e.requesterUserAgent&&(0,Q.jsx)(`p`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,title:e.requesterUserAgent,children:e.requesterUserAgent})]}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(H,{variant:`primary`,size:`compact`,disabled:i!==null,"aria-busy":r||void 0,leftIcon:r?(0,Q.jsx)(Y,{className:`animate-spin`}):void 0,onClick:()=>void o(e.requestId),children:n(`pendingPairingRequests.approveButton`)}),(0,Q.jsx)(H,{variant:`dangerOutline`,size:`compact`,disabled:i!==null,"aria-busy":a||void 0,leftIcon:a?(0,Q.jsx)(Y,{className:`animate-spin`}):void 0,onClick:()=>void s(e.requestId),children:n(`pendingPairingRequests.denyButton`)})]})]},e.requestId)})})]})}function Va({onRefresh:e,isRefreshing:t,labelled:n=!1}){let{t:r}=J(`settings`),i=r(`tunnelStatusRow.refreshLabel`),a=(0,Q.jsx)(Fn,{className:t?`animate-spin`:void 0});return n?(0,Q.jsx)(H,{variant:`outlined`,size:`compact`,leftIcon:a,disabled:t,onClick:e,children:i}):(0,Q.jsx)(H,{variant:`ghost`,size:`compact`,iconOnly:a,"aria-label":i,disabled:t,onClick:e})}function Ha(e){return`publicBaseUrl`in e&&e.publicBaseUrl?e.publicBaseUrl:null}function Ua(e){return`checkedAt`in e&&e.checkedAt?e.checkedAt:null}function Wa(e,t){let n=t?.trim();return n?`vellum tunnel ${Ka(n)} --provider ${e}`:`vellum tunnel --provider ${e}`}var Ga=/^[A-Za-z0-9._-]+$/;function Ka(e){return Ga.test(e)?e:`'${e.replace(/'/g,`'\\''`)}'`}var qa={checking:`var(--content-tertiary)`,stopped:`var(--content-tertiary)`,healthy:`var(--system-positive-strong)`,unpairable:`var(--system-mid-strong)`,unreachable:`var(--system-mid-strong)`,foreign:`var(--system-negative-strong)`},Ja=`text-body-small-default text-[var(--content-tertiary)]`,Ya=`truncate ${Ja}`;function Xa({status:e,onRefresh:t,isRefreshing:n,assistantName:r=null}){let{t:i}=J(`settings`);if(e.kind===`unconfigured`||e.kind===`unavailable`)return null;let a=Ua(e),o=Ha(e),s=`provider`in e?e.provider:void 0,c=`detail`in e?e.detail:void 0;return(0,Q.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg border border-[var(--border-element)] px-3 py-2.5`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`mt-1.5 inline-block h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:qa[e.kind]}}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-default)]`,children:Za(e,i)}),c&&(0,Q.jsx)(`p`,{className:Ya,title:c,children:c}),s&&(0,Q.jsx)(`p`,{className:Ja,children:(0,Q.jsx)(G,{i18nKey:e.kind===`stopped`?`tunnelStatusRow.stoppedRestart`:`tunnelStatusRow.restartHint`,ns:`settings`,values:{command:Wa(s,r)},components:{code:(0,Q.jsx)(`code`,{className:ct(`rounded-md bg-[var(--surface-active)] text-body-small-default text-[color:var(--content-primary)]`,`px-1.5 py-0.5`)})}})}),o&&(0,Q.jsx)(`p`,{className:Ya,title:o,children:o}),a&&(0,Q.jsx)(`p`,{className:Ja,children:i(`tunnelStatusRow.checkedAt`,{when:Qn(a)})})]}),(0,Q.jsx)(Va,{onRefresh:t,isRefreshing:n})]})}function Za(e,t){switch(e.kind){case`checking`:return t(`tunnelStatusRow.checkingStatus`);case`stopped`:return t(`tunnelStatusRow.stoppedStatus`);case`healthy`:return t(`tunnelStatusRow.healthyStatus`);case`unpairable`:return t(`tunnelStatusRow.unpairableStatus`);case`unreachable`:return t(`tunnelStatusRow.unreachableStatus`);case`foreign`:return e.servingAssistantName?t(`tunnelStatusRow.foreignStatusNamed`,{name:e.servingAssistantName}):t(`tunnelStatusRow.foreignStatus`)}}var Qa=`vellum:pair-device:public-base-url`;function $a(e){let t=e?.trim();if(t)return{url:t,source:`tunnel`};let n=Wt(Qa,``).trim();return n?{url:n,source:`stored`}:{url:``,source:`none`}}function eo(e,t){let n=(0,Z.useMemo)(()=>$a(t),[t]),[r,i]=(0,Z.useState)(null),o=r??n.url,[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)({kind:`idle`}),[d,f]=(0,Z.useState)(()=>Date.now()),p=(0,Z.useRef)(null);(0,Z.useEffect)(()=>()=>p.current?.abort(),[]),(0,Z.useEffect)(()=>{if(l.kind!==`ready`)return;f(Date.now());let e=setInterval(()=>f(Date.now()),1e3);return()=>clearInterval(e)},[l]);let m=(0,Z.useCallback)(e=>{i(e),c(null)},[]),h=(0,Z.useCallback)(()=>{if(!e)return;let t=o.trim(),n=Gt(t);if(!n.ok){c(a(n.reason,t));return}c(null),p.current?.abort();let r=new AbortController;p.current=r,u({kind:`minting`}),(async()=>{try{let t=await Hi({base:e,publicBaseUrl:n.url,signal:r.signal});if(r.signal.aborted)return;pt(Qa,n.url),u({kind:`ready`,pairUrl:t.pairUrl,expiresAtMs:Date.parse(t.expiresAt)})}catch(e){if(r.signal.aborted)return;if(e instanceof Fi){u({kind:`error`,message:e.message,hint:e.hint});return}S(e,{context:`pair-device-mint`}),u({kind:`error`,message:W(`settings:usePairDevice.mintErrorFallback`)})}})()},[e,o]),g=l.kind===`ready`?Math.max(0,l.expiresAtMs-d):0,_=l.kind===`ready`&&g<=0;return{publicBaseUrl:o,setPublicBaseUrl:m,prefillSource:n.source,inputError:s,phase:l,remainingMs:g,expired:_,generate:h}}var to=`0.11.6`;function no(e){return $e(to,e)}function ro(e){let t=Ye(),n=no(t),r=re(),i=e&&n&&r,{data:a,isFetching:o,refetch:s}=K({...ut({path:{assistant_id:t}}),enabled:i,staleTime:0,refetchOnWindowFocus:!1}),c=(0,Z.useCallback)(()=>{i&&s()},[i,s]);return{status:io(a,o),isRefreshing:o,refresh:c}}function io(e,t){if(!e)return t?{kind:`checking`}:{kind:`unavailable`};let{lastTunnel:n}=e,r=e.publicBaseUrl??``,i=e.checkedAt??``,a=n?{provider:n.provider}:{};switch(e.state){case`unconfigured`:return{kind:`unconfigured`};case`stopped`:return{kind:`stopped`,...a,...n?{publicBaseUrl:n.publicBaseUrl}:{}};case`healthy`:return{kind:`healthy`,publicBaseUrl:r,checkedAt:i};case`unpairable`:case`unreachable`:return{kind:e.state,publicBaseUrl:r,checkedAt:i,...e.detail?{detail:e.detail}:{},...a};case`foreign`:return{kind:`foreign`,publicBaseUrl:r,checkedAt:i,...e.servingAssistantName?{servingAssistantName:e.servingAssistantName}:{},...a};default:return{kind:`unavailable`}}}var ao=`tailscale`,oo=`public-url`,so=new Set([`unpairable`,`unreachable`,`foreign`]),co=`vellum tunnel --help`,lo=ae(D.docs.pairADevice);function uo(){let{t:e}=J(`settings`),n=Li(),r=Oi(),i=U.use.pairedDevicesUI(),a=ro(r&&n!==null),o=a.status.kind!==`unavailable`;_t(`app.resume`,()=>{a.refresh()}),$n(Ua(a.status)!==null);let s=a.status.kind===`stopped`?null:Ha(a.status),c=eo(n?.base??null,o?s:n?.ingressUrl??null),[l,u]=(0,Z.useState)(0),[d,f]=(0,Z.useState)(!1),{copy:p,copied:m}=t({errorMessage:e(`pairDeviceCard.copyError`)});if(!n||!r)return null;let h=n.assistantName??e(`pairDeviceCard.subtitleFallbackName`),{phase:g}=c,_=g.kind===`minting`,v=g.kind===`ready`,y=c.prefillSource===`tunnel`,b=o?a.status.kind===`unconfigured`:c.prefillSource===`none`&&c.publicBaseUrl.trim()===``,x=b&&o,S=o&&so.has(a.status.kind),C=e(_?`pairDeviceCard.generateButtonMinting`:v?`pairDeviceCard.generateButtonRegenerate`:S?`pairDeviceCard.generateButtonWarned`:`pairDeviceCard.generateButton`),w=o&&s!==null,T=d||c.inputError!==null,E=(0,Q.jsx)(H,{variant:S?`outlined`:`primary`,className:`self-start`,disabled:_||c.publicBaseUrl.trim()===``,onClick:c.generate,children:C}),D=(0,Q.jsx)(k,{label:e(`pairDeviceCard.publicUrlLabel`),fullWidth:!0,placeholder:e(`pairDeviceCard.publicUrlPlaceholder`),helperText:e(y?`pairDeviceCard.publicUrlHelperTunnel`:`pairDeviceCard.publicUrlHelper`),value:c.publicBaseUrl,errorText:c.inputError??void 0,disabled:_,onChange:e=>{f(!0),c.setPublicBaseUrl(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c.generate())}});return(0,Q.jsx)(X,{title:e(`pairDeviceCard.title`),subtitle:e(`pairDeviceCard.subtitle`,{name:h}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[b&&(0,Q.jsx)(z,{tone:`info`,title:e(`pairDeviceCard.noTunnelTitle`),actions:x?(0,Q.jsx)(Va,{onRefresh:a.refresh,isRefreshing:a.isRefreshing,labelled:!0}):void 0,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`p`,{children:e(`pairDeviceCard.noTunnelWhy`,{name:h})}),(0,Q.jsx)(`code`,{className:ct(`rounded-md bg-[var(--surface-active)] text-body-small-default text-[color:var(--content-primary)]`,`w-fit max-w-full overflow-x-auto px-2.5 py-1.5`),children:Wa(ao,n.assistantName)}),(0,Q.jsx)(`p`,{children:e(`pairDeviceCard.noTunnelNext`)}),(0,Q.jsx)(`p`,{children:(0,Q.jsx)(G,{i18nKey:`pairDeviceCard.noTunnelMore`,ns:`settings`,values:{command:co},components:{code:(0,Q.jsx)(`code`,{className:ct(`rounded-md bg-[var(--surface-active)] text-body-small-default text-[color:var(--content-primary)]`,`px-1.5 py-0.5`)})}})})]})}),(0,Q.jsx)(Xa,{status:a.status,onRefresh:a.refresh,isRefreshing:a.isRefreshing,assistantName:n.assistantName}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-3`,children:w?(0,Q.jsxs)(Q.Fragment,{children:[E,(0,Q.jsx)(B.Root,{type:`single`,collapsible:!0,value:T?oo:``,onValueChange:e=>f(e===oo),children:(0,Q.jsxs)(B.Item,{value:oo,children:[(0,Q.jsxs)(B.Trigger,{className:`group flex w-full items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:e(`pairDeviceCard.publicUrlDisclosure`)}),(0,Q.jsx)(En,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,Q.jsx)(B.Content,{children:(0,Q.jsx)(`div`,{className:`mt-3`,children:D})})]})})]}):(0,Q.jsxs)(Q.Fragment,{children:[D,E]})}),g.kind===`error`&&(0,Q.jsx)(z,{tone:`error`,title:g.message,children:g.hint}),v&&(0,Q.jsx)(Sa,{pairUrl:g.pairUrl,remainingMs:c.remainingMs,expired:c.expired,copied:m,onCopy:p}),(0,Q.jsx)(Ba,{base:n.base,onApproved:()=>u(e=>e+1)}),i&&(0,Q.jsx)(Ia,{pollWhilePairing:v&&!c.expired,revalidateKey:l}),(0,Q.jsx)(`a`,{href:lo,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Bt(e,lo),className:`self-start text-body-medium-default text-[var(--content-tertiary)] underline hover:text-[var(--content-default)]`,children:e(`pairDeviceCard.learnMore`)})]})})}function fo(e){return[{scope:`global`,title:e(`shortcutsSections.globalTitle`),description:e(`shortcutsSections.globalDescription`)},{scope:`menu`,title:e(`shortcutsSections.appTitle`),description:e(`shortcutsSections.appDescription`)}]}function po({hotkey:e,recording:t,conflictLabel:n,alternateBinding:r,onStartRecording:i,onCancelRecording:a,onReset:o,onRemove:s}){let{t:c}=J(`settings`),l=e.accelerator===``,u=e.override!==null;return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-2`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`div`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e.label}),n!==null&&(0,Q.jsx)(`div`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:c(`shortcutsSections.alreadyUsedBy`,{label:n})})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[r,t?(0,Q.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:c(`shortcutsSections.recordingHint`)}):l?(0,Q.jsx)(`span`,{className:`text-body-small-default italic text-[var(--content-disabled)]`,children:c(`shortcutsSections.none`)}):(0,Q.jsx)(Ne,{accelerator:e.accelerator}),t?(0,Q.jsx)(H,{variant:`ghost`,size:`compact`,onClick:a,children:c(`shortcutsSections.cancel`)}):(0,Q.jsx)(H,{variant:`outlined`,size:`compact`,onClick:i,"aria-label":c(`shortcutsSections.recordShortcutAriaLabel`,{label:e.label}),children:c(`shortcutsSections.record`)}),(0,Q.jsx)(H,{variant:`ghost`,size:`compact`,disabled:!u,leftIcon:(0,Q.jsx)(kn,{className:`h-3.5 w-3.5`}),onClick:o,"aria-label":c(`shortcutsSections.resetShortcutAriaLabel`,{label:e.label})}),(0,Q.jsx)(H,{variant:`ghost`,size:`compact`,disabled:l,leftIcon:(0,Q.jsx)(Pn,{className:`h-3.5 w-3.5`}),onClick:s,"aria-label":c(`shortcutsSections.removeBindingAriaLabel`,{label:e.label})})]})]})}function mo(){let{t:e}=J(`settings`),{catalog:t,recordingKey:n,conflict:r,startRecording:i,stopRecording:a,resetHotkey:o,removeHotkey:s}=tr(),c=(0,Z.useMemo)(()=>fo(e).map(e=>({...e,commands:t.filter(t=>t.rebindable&&t.scope===e.scope)})).filter(e=>e.commands.length>0),[t,e]);return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[r!==null&&(0,Q.jsxs)(z,{tone:`warning`,children:[e(`shortcutsSections.conflictNoticePrefix`,{label:r.label}),` `,e(n===null?`shortcutsSections.conflictResetHint`:`shortcutsSections.conflictRecordingHint`)]}),c.map(e=>(0,Q.jsxs)(we,{bordered:!0,children:[(0,Q.jsxs)(`div`,{className:`mb-2`,children:[(0,Q.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e.title}),(0,Q.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:e.commands.map(e=>(0,Q.jsx)(po,{hotkey:e,recording:n===e.key,conflictLabel:r!==null&&r.key===e.key?r.label:null,onStartRecording:()=>i(e.key),onCancelRecording:a,onReset:()=>o(e.key),onRemove:()=>s(e.key)},e.key))})]},e.scope))]})}async function ho(){if(!N())return!1;let e=window.vellum;return e?.launchAtLogin?e.launchAtLogin.get():!1}async function go(e){if(!N())return;let t=window.vellum;t?.launchAtLogin&&await t.launchAtLogin.set(e)}function _o(){let{t:e}=J(`settings`),t=de.useValue(),n=nn.useValue(),i=!Ot(),a=r();return(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`preferencesModal.composerTitle`)}),(0,Q.jsxs)(`div`,{className:`mt-2 space-y-4`,children:[i&&(0,Q.jsx)(b,{checked:t,onChange:de.save,label:e(a?`preferencesModal.sendWithCmdEnter`:`preferencesModal.sendWithCtrlEnter`),helperText:e(a?`preferencesModal.sendWithCmdEnterHelper`:`preferencesModal.sendWithCtrlEnterHelper`)}),(0,Q.jsx)(b,{checked:n,onChange:nn.save,label:e(`preferencesModal.showContextWindow`),helperText:e(`preferencesModal.showContextWindowHelper`)})]})]})}function vo(){let{t:e}=J(`settings`),[t,n]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{ho().then(n)},[]);let r=async e=>{n(e);try{await go(e)}catch{n(!e)}};return(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`preferencesModal.launchAtLoginTitle`)}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(Dt()===`windows`?`preferencesModal.launchAtLoginDescriptionWindows`:`preferencesModal.launchAtLoginDescription`)}),(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(b,{checked:t,onChange:e=>void r(e),"aria-label":e(`preferencesModal.launchAtLoginAriaLabel`)})})]})}function yo({open:e,onClose:t}){let{t:n}=J(`settings`);return(0,Q.jsx)(R.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,Q.jsxs)(R.Content,{size:`lg`,children:[(0,Q.jsxs)(R.Header,{children:[(0,Q.jsx)(R.Title,{children:n(`preferencesModal.title`)}),(0,Q.jsx)(R.Description,{children:n(`preferencesModal.description`)})]}),(0,Q.jsx)(R.Body,{children:(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[N()&&(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:n(`preferencesModal.keyboardShortcutsTitle`)}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:n(`preferencesModal.keyboardShortcutsDescription`)}),(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(mo,{})})]}),(0,Q.jsx)(_o,{}),N()&&(0,Q.jsx)(vo,{})]})})]})})}function bo(e){return e===`preview`?`preview`:`stable`}function xo(e,t){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:n.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function So(e){return e.filter(e=>e.ready_to_use)}function Co(e){return e?.feature_enabled===!1}function wo({assistantId:e,onComplete:t}){let{t:n}=J(`settings`),r=U.use.previewChannel(),i=q(),[a,o]=(0,Z.useState)(),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),[d,p]=(0,Z.useState)(`restore_backup`),[m,h]=(0,Z.useState)(``),g=at({path:{assistant_id:e}}),_=rt({path:{assistant_id:e}}),v=qt({path:{id:e}}),{data:y,isLoading:b,isError:x}=K({...g,enabled:r,retry:!1}),S=(0,Z.useMemo)(()=>So(y?.preview_backups??[]),[y?.preview_backups]),C=S[0],w=S.find(e=>e.snapshot_name===m)??C,T=()=>{i.invalidateQueries({queryKey:_}),i.invalidateQueries({queryKey:v}),t?.()},E=cn(Ft()),D=cn(Tt()),O=bo(y?.current_channel),k=E.isPending||D.isPending,A=k||Co(y)||!y?.latest_preview_release,j=d===`restore_backup`&&!w;if((0,Z.useEffect)(()=>{o(O===`preview`?`release-channel`:void 0)},[O]),!r)return null;let M=y?.standard_upgrade_available??!1;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(B.Root,{type:`single`,collapsible:!0,value:a,onValueChange:e=>o(e||void 0),className:`mt-5 border-t border-[var(--border-base)] pt-5`,children:(0,Q.jsxs)(B.Item,{value:`release-channel`,id:`preview-release-channel`,children:[(0,Q.jsxs)(B.Trigger,{className:`group justify-between gap-3`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:n(`previewReleaseChannel.title`)}),y&&(0,Q.jsx)(an,{tone:O===`preview`?`warning`:`neutral`,children:n(O===`preview`?`previewReleaseChannel.preview`:`previewReleaseChannel.stable`)})]}),(0,Q.jsx)(En,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,Q.jsx)(B.Content,{children:(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[b&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(Y,{className:`h-4 w-4 animate-spin`}),n(`previewReleaseChannel.loading`)]}),x&&(0,Q.jsx)(z,{tone:`error`,title:n(`previewReleaseChannel.loadErrorTitle`),children:n(`previewReleaseChannel.loadErrorBody`)}),y&&(0,Q.jsxs)(Q.Fragment,{children:[Co(y)&&(0,Q.jsx)(z,{tone:`neutral`,title:n(`previewReleaseChannel.unavailableTitle`),children:n(`previewReleaseChannel.unavailableBody`)}),O===`stable`?(0,Q.jsx)(To,{status:y,isChangingChannel:k,optInDisabled:A,onOptIn:()=>c(!0)}):(0,Q.jsx)(Eo,{status:y,isChangingChannel:k,onOptOut:()=>{let e=C;h(e?.snapshot_name??``),p(e?`restore_backup`:M?`standard_upgrade`:`restore_backup`),u(!0)}})]})]})})]})}),(0,Q.jsx)(Oo,{open:s,isPending:E.isPending,previewVersion:y?.latest_preview_release?.version,onConfirm:async()=>{try{let t=await E.mutateAsync({path:{assistant_id:e}});f.success(t.detail||n(`previewReleaseChannel.previewEnabledToast`)),c(!1),T()}catch(e){f.error(le(e,void 0,n(`previewReleaseChannel.previewEnableFailedToast`)))}},onCancel:()=>c(!1)}),(0,Q.jsx)(ko,{open:l,backups:S,mode:d,selectedSnapshotName:w?.snapshot_name??``,isPending:D.isPending,restoreModeDisabled:j,standardUpgradeAvailable:M,onModeChange:p,onSnapshotChange:h,onConfirm:async()=>{if(!j)try{let t=await D.mutateAsync({path:{assistant_id:e},body:d===`restore_backup`?{mode:`restore_backup`,snapshot_name:w?.snapshot_name}:{mode:`standard_upgrade`}});f.success(t.detail||n(`previewReleaseChannel.stableEnabledToast`)),u(!1),T()}catch(e){f.error(le(e,void 0,`Could not switch to Stable.`))}},onCancel:()=>u(!1)})]})}function To({status:e,isChangingChannel:t,optInDisabled:n,onOptIn:r}){let{t:i}=J(`settings`);return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(Do,{status:e}),!e.latest_preview_release&&(0,Q.jsx)(z,{tone:`neutral`,title:i(`previewReleaseChannel.noPreviewTitle`),children:i(`previewReleaseChannel.noPreviewBody`)}),(0,Q.jsx)(H,{variant:`outlined`,leftIcon:t?(0,Q.jsx)(Y,{className:`animate-spin`}):(0,Q.jsx)(Cn,{}),disabled:n,onClick:r,children:i(`previewReleaseChannel.optIn`)})]})}function Eo({status:e,isChangingChannel:t,onOptOut:n}){let{t:r}=J(`settings`);return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(Do,{status:e}),(0,Q.jsx)(H,{variant:`outlined`,leftIcon:t?(0,Q.jsx)(Y,{className:`animate-spin`}):(0,Q.jsx)(kn,{}),disabled:t,onClick:n,children:r(`previewReleaseChannel.switchBack`)})]})}function Do({status:e}){let{t}=J(`settings`);return(0,Q.jsxs)(`dl`,{className:`grid gap-3 text-body-medium-lighter sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:t(`previewReleaseChannel.latestStable`)}),(0,Q.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_stable_release?.version??t(`previewReleaseChannel.none`)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:t(`previewReleaseChannel.latestPreview`)}),(0,Q.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_preview_release?.version??t(`previewReleaseChannel.none`)})]})]})}function Oo({open:e,isPending:t,previewVersion:n,onConfirm:r,onCancel:i}){let{t:a}=J(`settings`);return(0,Q.jsx)(R.Root,{open:e,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(R.Content,{size:`md`,hideCloseButton:t,children:[(0,Q.jsxs)(R.Header,{icon:Sn,children:[(0,Q.jsx)(R.Title,{children:a(`previewReleaseChannel.optInTitle`)}),(0,Q.jsx)(R.Description,{children:a(`previewReleaseChannel.optInDescription`)})]}),(0,Q.jsx)(R.Body,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(z,{tone:`warning`,title:a(`previewReleaseChannel.dataLossTitle`),children:a(`previewReleaseChannel.dataLossBody`)}),(0,Q.jsxs)(`ol`,{className:`list-decimal space-y-2 pl-5 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,Q.jsx)(`li`,{children:a(`previewReleaseChannel.optInStep1`)}),(0,Q.jsx)(`li`,{children:a(`previewReleaseChannel.optInStep2`,{version:n??a(`previewReleaseChannel.latest`)})}),(0,Q.jsx)(`li`,{children:a(`previewReleaseChannel.optInStep3`)})]})]})}),(0,Q.jsxs)(R.Footer,{children:[(0,Q.jsx)(H,{variant:`outlined`,disabled:t,onClick:i,children:a(`previewReleaseChannel.cancel`)}),(0,Q.jsx)(H,{variant:`primary`,disabled:t,leftIcon:t?(0,Q.jsx)(Y,{className:`animate-spin`}):(0,Q.jsx)(Cn,{}),onClick:r,children:a(t?`previewReleaseChannel.switching`:`previewReleaseChannel.takeBackupAndSwitch`)})]})]})})}function ko({open:e,backups:t,mode:n,selectedSnapshotName:r,isPending:i,restoreModeDisabled:a,standardUpgradeAvailable:o,onModeChange:s,onSnapshotChange:c,onConfirm:l,onCancel:u}){let{t:d}=J(`settings`),f=d(`previewReleaseChannel.unknownDate`);return(0,Q.jsx)(R.Root,{open:e,onOpenChange:e=>!e&&u(),children:(0,Q.jsxs)(R.Content,{size:`md`,hideCloseButton:i,children:[(0,Q.jsxs)(R.Header,{icon:Sn,children:[(0,Q.jsx)(R.Title,{children:d(`previewReleaseChannel.optOutTitle`)}),(0,Q.jsx)(R.Description,{children:d(`previewReleaseChannel.optOutDescription`)})]}),(0,Q.jsx)(R.Body,{children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(ne,{value:n,onValueChange:s,disabled:i,"aria-label":d(`previewReleaseChannel.returnMethodAriaLabel`),children:[(0,Q.jsx)(L,{value:`restore_backup`,disabled:t.length===0,label:d(`previewReleaseChannel.restoreBackupLabel`),helperText:d(`previewReleaseChannel.restoreBackupHelper`)}),(0,Q.jsx)(L,{value:`standard_upgrade`,disabled:!o,label:d(`previewReleaseChannel.standardUpgradeLabel`),helperText:d(o?`previewReleaseChannel.standardUpgradeHelper`:`previewReleaseChannel.standardUpgradeUnavailable`)})]}),n===`restore_backup`&&t.length>0&&(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-medium-default text-[var(--content-secondary)]`,children:[d(`previewReleaseChannel.safetyBackup`),(0,Q.jsx)(Qt,{value:r,onChange:c,disabled:i,options:t.map(e=>{let t=e.source_release_version?d(`previewReleaseChannel.stableBackupLabel`,{version:e.source_release_version}):e.snapshot_name;return{value:e.snapshot_name,label:d(`previewReleaseChannel.backupOptionLabel`,{name:t,date:xo(e.created_at,f)})}})})]}),n===`restore_backup`&&t.length===0&&!o&&(0,Q.jsx)(z,{tone:`error`,title:d(`previewReleaseChannel.requiresBackupTitle`),children:d(`previewReleaseChannel.requiresBackupBody`)}),n===`standard_upgrade`&&(0,Q.jsx)(z,{tone:`error`,title:d(`previewReleaseChannel.mayNotSurviveTitle`),children:d(`previewReleaseChannel.mayNotSurviveBody`)})]})}),(0,Q.jsxs)(R.Footer,{children:[(0,Q.jsx)(H,{variant:`outlined`,disabled:i,onClick:u,children:d(`previewReleaseChannel.cancel`)}),(0,Q.jsx)(H,{variant:n===`standard_upgrade`?`danger`:`primary`,disabled:i||a||n===`standard_upgrade`&&!o,leftIcon:i?(0,Q.jsx)(Y,{className:`animate-spin`}):(0,Q.jsx)(Fn,{}),onClick:l,children:d(i?`previewReleaseChannel.switching`:`previewReleaseChannel.switchToStable`)})]})]})})}function Ao(){let{t:e}=J(`settings`),t=ie.use.user(),n=(0,Z.useCallback)(e=>{Me(e),window.location.reload()},[]);if(!Oe(t))return null;let r=A(),i=Rt(),a=i.version??e(`previewUiChannel.versionUnknown`);return(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`previewUiChannel.title`)}),(0,Q.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`previewUiChannel.description`)}),(0,Q.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(i.channel===`preview`?`previewUiChannel.runningPreview`:`previewUiChannel.runningStable`,{version:a})}),r&&i.channel===`stable`&&(0,Q.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`previewUiChannel.unavailableHint`)})]}),(0,Q.jsx)(`div`,{className:`shrink-0`,children:(0,Q.jsx)(b,{checked:r,onChange:n,"aria-label":e(r?`previewUiChannel.onAriaLabel`:`previewUiChannel.offAriaLabel`)})})]})}var jo=new Set([`exceeds_machine_tier`,`exceeds_storage_tier`]);function Mo(e,t){return e&&typeof e==`object`&&!Array.isArray(e)&&`error`in e&&typeof e.error==`string`&&jo.has(e.error)?`That size isn't available on your plan.`:le(e,void 0,t)}function No({assistant:e,healthz:t,healthzLoading:n,healthzFetching:r,healthzPolling:i,refetch:a,refetchUntilResized:o}){let{t:s}=J(`settings`),c=hn(),l=K(je()),u=l.data,d=!e.is_local,p=u?.plan_id===`pro`,m=K({...It(),enabled:p}),h=e.machine_size||`small`,g=Vn(m.data?.max_machine_tier??null),_=(0,Z.useMemo)(()=>Wn(g,h,(0,Q.jsx)(an,{tone:`positive`,children:s(`resizeCard.current`)})),[g,h,s]),v=m.data?.selected_storage_gib??null,[y,b]=(0,Z.useState)(!1),x=g.length>0?g[g.length-1]:null,[S,C]=(0,Z.useState)(null),w=S??x??h,[T,E]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(null),A=Ge({onSuccess:(e,n)=>{f.success(s(`resizeCard.toastStarted`),{id:`assistant-resize`}),k(null),C(null),b(!1),n.body?.machine_size==null?a():o(t)},onError:e=>{k(Mo(e,s(`resizeCard.resizeFailed`)))}});if(l.isError&&u==null)return(0,Q.jsx)(X,{id:`storage-resources`,title:s(`resizeCard.title`),subtitle:s(`resizeCard.subtitle`),children:(0,Q.jsx)(z,{tone:`error`,children:s(`resizeCard.subscriptionLoadError`)})});let j=p&&g.includes(w)&&w!==h?w:null,M=p&&v!=null&&!0,N=p&&g.length>0&&Un(h)<Un(g[g.length-1]),P=A.isPending||i,F=v==null?t?.disk?.totalMb??null:v*1024,I=t?.disk&&F!=null?{value:t.disk.usedMb,max:F,caption:s(`resizeCard.usedOf`,{used:Xn(t.disk.usedMb),total:Xn(F)})}:null,ee=t?.cpu?{value:t.cpu.currentPercent,max:100,caption:`${t.cpu.currentPercent.toFixed(1)}%`}:null,L=t?.memory?{value:t.memory.currentMb,max:t.memory.maxMb,caption:s(`resizeCard.usedOf`,{used:Xn(t.memory.currentMb),total:Xn(t.memory.maxMb)})}:null,te=(0,Q.jsx)(H,{variant:`ghost`,size:`compact`,onClick:()=>E(!0),children:s(`resizeCard.resize`)}),ne=d?p?M?(0,Q.jsxs)(`button`,{type:`button`,disabled:P,onClick:()=>b(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,Q.jsx)(Dn,{className:`h-3.5 w-3.5`}),s(`resizeCard.increaseStorage`)]}):(0,Q.jsx)(H,{variant:`ghost`,size:`compact`,disabled:P,onClick:()=>b(!0),children:s(`resizeCard.resize`)}):te:null,re=d?p?N?(0,Q.jsxs)(`button`,{type:`button`,disabled:P,onClick:()=>b(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,Q.jsx)(Dn,{className:`h-3.5 w-3.5`}),s(`resizeCard.increaseSize`)]}):(0,Q.jsx)(H,{variant:`ghost`,size:`compact`,disabled:P,onClick:()=>b(!0),children:s(`resizeCard.resize`)}):te:null;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{id:`storage-resources`,title:s(`resizeCard.title`),subtitle:s(`resizeCard.subtitle`),compactAccessory:!0,accessory:(0,Q.jsx)(H,{variant:`ghost`,size:`compact`,iconOnly:r||i?(0,Q.jsx)(Y,{className:`animate-spin`}):(0,Q.jsx)(Fn,{}),tooltip:s(i?`resizeCard.applyingResize`:`resizeCard.refreshMetrics`),"aria-label":s(`resizeCard.refreshMetrics`),disabled:r||i,onClick:()=>void a()}),children:(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-[1fr_2fr]`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,Q.jsx)(jn,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:s(`resizeCard.disk`)})]}),ne]}),(0,Q.jsxs)(`div`,{className:`mt-auto flex flex-col gap-1 pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:s(`resizeCard.storage`)}),I?(0,Q.jsx)(Kn,{value:I.value,max:I.max,caption:I.caption}):n?(0,Q.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Q.jsx)(Y,{className:`h-3 w-3 animate-spin`})}):(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:s(`resizeCard.unavailable`)})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,Q.jsx)(rr,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:s(`resizeCard.machine`)}),(0,Q.jsx)(an,{tone:`neutral`,children:Hn[h]})]}),re]}),(0,Q.jsxs)(`div`,{className:`mt-auto grid grid-cols-2 gap-3 pt-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:s(`resizeCard.cpu`)}),ee?(0,Q.jsx)(Kn,{value:ee.value,max:ee.max,caption:ee.caption}):n?(0,Q.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Q.jsx)(Y,{className:`h-3 w-3 animate-spin`})}):(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:s(`resizeCard.memory`)}),L?(0,Q.jsx)(Kn,{value:L.value,max:L.max,caption:L.caption}):n?(0,Q.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Q.jsx)(Y,{className:`h-3 w-3 animate-spin`})}):(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]})]})]})]})}),(0,Q.jsx)(R.Root,{open:T,onOpenChange:e=>{e||E(!1)},children:(0,Q.jsxs)(R.Content,{size:`sm`,children:[(0,Q.jsxs)(R.Header,{children:[(0,Q.jsx)(R.Title,{children:s(`resizeCard.upgradeTitle`)}),(0,Q.jsx)(R.Description,{children:s(`resizeCard.upgradeDescription`)})]}),(0,Q.jsxs)(R.Footer,{children:[(0,Q.jsx)(H,{variant:`ghost`,onClick:()=>E(!1),children:s(`resizeCard.cancel`)}),(0,Q.jsx)(H,{onClick:()=>{E(!1),c(D.plans)},children:s(`resizeCard.upgrade`)})]})]})}),(0,Q.jsx)(R.Root,{open:y,onOpenChange:e=>{e||(b(!1),C(null),k(null))},children:(0,Q.jsxs)(R.Content,{size:`sm`,children:[(0,Q.jsxs)(R.Header,{icon:rr,children:[(0,Q.jsx)(R.Title,{children:s(`resizeCard.modalTitle`)}),(0,Q.jsx)(R.Description,{children:s(`resizeCard.modalDescription`)})]}),(0,Q.jsx)(R.Body,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[g.length===0?(0,Q.jsx)(z,{tone:`warning`,children:s(`resizeCard.noMachineTier`)}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-secondary)]`,children:s(`resizeCard.machineSize`)}),(0,Q.jsx)(Qt,{options:_,value:w,onChange:C,"aria-label":s(`resizeCard.machineSizeAriaLabel`),"data-testid":`resize-machine-size`})]}),M?(0,Q.jsx)(z,{tone:`info`,children:s(`resizeCard.storageExpandTo`,{to:v})}):(0,Q.jsx)(z,{tone:`neutral`,children:s(`resizeCard.storageUnchanged`)}),O&&(0,Q.jsx)(z,{tone:`error`,children:O})]})}),(0,Q.jsxs)(R.Footer,{className:`items-center justify-between`,children:[(0,Q.jsx)(`span`,{className:`text-label-small-default text-[var(--content-tertiary)]`,children:(0,Q.jsx)(G,{ns:`settings`,i18nKey:`resizeCard.needMore`,components:{upgradeLink:(0,Q.jsx)(gn,{to:D.plans,className:`text-[var(--content-secondary)] underline decoration-[var(--border-element)] underline-offset-2 transition-colors hover:text-[var(--content-default)]`,onClick:()=>b(!1)})}})}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(H,{variant:`ghost`,onClick:()=>{b(!1),C(null),k(null)},children:s(`resizeCard.cancel`)}),(0,Q.jsx)(H,{disabled:j==null&&!M||P,leftIcon:P?(0,Q.jsx)(Y,{className:`animate-spin`}):void 0,onClick:()=>{k(null);let t={};j!=null&&(t.machine_size=j),M&&v!=null&&(t.storage_gib=v),A.mutate({path:{id:e.id},body:t})},children:s(O?`resizeCard.retry`:`resizeCard.apply`)})]})]})]})})]})}function Po({assistantId:e}){let{t}=J(`settings`),n=hn(),r=q(),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(H,{variant:`dangerOutline`,onClick:()=>a(!0),className:`shrink-0`,children:t(`retireAssistant.button`)}),(0,Q.jsx)(rn,{open:i,isPending:o,onConfirm:async()=>{s(!0);let t=await be(r,e);if(t.ok){a(!1),n(t.nextRoute,{replace:!0});return}f.error(t.error),s(!1),a(!1)},onCancel:()=>a(!1)})]})}var Fo=`UTC.Africa/Cairo.Africa/Johannesburg.Africa/Lagos.Africa/Nairobi.America/Anchorage.America/Argentina/Buenos_Aires.America/Bogota.America/Chicago.America/Denver.America/Halifax.America/Lima.America/Los_Angeles.America/Mexico_City.America/New_York.America/Phoenix.America/Santiago.America/Sao_Paulo.America/Toronto.America/Vancouver.Asia/Bangkok.Asia/Dubai.Asia/Hong_Kong.Asia/Jakarta.Asia/Jerusalem.Asia/Karachi.Asia/Kolkata.Asia/Kuala_Lumpur.Asia/Manila.Asia/Seoul.Asia/Shanghai.Asia/Singapore.Asia/Taipei.Asia/Tokyo.Australia/Melbourne.Australia/Perth.Australia/Sydney.Europe/Amsterdam.Europe/Athens.Europe/Berlin.Europe/Brussels.Europe/Dublin.Europe/Istanbul.Europe/Lisbon.Europe/London.Europe/Madrid.Europe/Moscow.Europe/Paris.Europe/Rome.Europe/Stockholm.Europe/Vienna.Europe/Warsaw.Europe/Zurich.Pacific/Auckland.Pacific/Honolulu`.split(`.`);function Io(){let e=Intl;if(typeof e.supportedValuesOf==`function`)try{let t=e.supportedValuesOf(`timeZone`);if(t.length>0)return[...t].sort()}catch{}return[...Fo].sort()}function Lo(e,t,n){let r=parseInt(n??`0`,10);if(r>59)return null;let i=parseInt(t??`0`,10)*60+r;return(e===`-`?-1:1)*i}function Ro(e){let t=e.split(`/`),n=(t[t.length-1]??e).replace(/_/g,` `),r=t.length>1?(t[0]??``).replace(/_/g,` `):``,i=0,a=``;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??`GMT`;a=t.startsWith(`GMT`)||t.startsWith(`UTC`)?t:`GMT ${t}`;let n=t.match(/([+-])(\d{1,2})(?::(\d{2}))?/);n&&(i=Lo(n[1],n[2],n[3])??0)}catch{return null}return{identifier:e,city:n,region:r,offsetLabel:a,offsetMinutes:i}}function zo(){return Io().map(e=>Ro(e)).filter(e=>e!==null)}function Bo(e){try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e,hour:`numeric`,minute:`2-digit`,hour12:!0}).format(new Date)}catch{return``}}function Vo(e,t){if(!e)return t;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`long`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value;if(t)return t}catch{}return e.replace(/_/g,` `)}function Ho(e){if(e===`utc`||e===`gmt`)return 0;let t=e.match(/^(?:utc|gmt)?\s*([+-])(\d{1,2})(?::?(\d{2}))?$/);if(!t)return null;let n=Lo(t[1],t[2],t[3]);return n!==null&&Math.abs(n)<=840?n:null}var Uo=200,Wo=[];function Go({value:e,onChange:t}){let{t:n}=J(`settings`),[r,i]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(!1),s=(0,Z.useMemo)(()=>a?zo():Wo,[a]),c=r.trim().toLowerCase(),l=(0,Z.useMemo)(()=>{let e=Ho(c);return(c?s.filter(t=>e===null?t.city.toLowerCase().includes(c)||t.region.toLowerCase().includes(c)||t.offsetLabel.toLowerCase().includes(c)||t.identifier.toLowerCase().includes(c):t.offsetMinutes===e):s).slice(0,Uo)},[s,c]),u=(0,Z.useMemo)(()=>l.map(e=>e.identifier),[l]),d=(0,Z.useMemo)(()=>{if(!e)return``;let t=e.split(`/`);return(t[t.length-1]??e).replace(/_/g,` `)},[e]);return(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 md:flex-row md:items-center md:justify-between md:gap-4`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:n(`timezonePicker.timezone`)}),(0,Q.jsxs)(st.Root,{className:`w-full md:max-w-[280px]`,options:u,value:e,onSelect:t,onOpenChange:e=>{if(e){o(!0);return}i(``)},autoActivateFirst:c.length>0,children:[(0,Q.jsx)(st.Input,{type:`text`,"aria-label":n(`timezonePicker.timezone`),value:r,placeholder:d||n(`timezonePicker.searchPlaceholder`),onChange:e=>i(e.target.value),fullWidth:!0}),(0,Q.jsx)(st.List,{"aria-label":n(`timezonePicker.timezonesAriaLabel`),className:`absolute left-0 right-0 top-full z-20 mt-1 max-h-[240px] rounded-md border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-lg`,emptyState:(0,Q.jsx)(`p`,{className:`px-3 py-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:n(`timezonePicker.noMatches`)}),children:l.map(e=>(0,Q.jsxs)(st.Option,{value:e.identifier,className:ct(`flex w-full items-center justify-between gap-3 px-3 py-2`,`text-body-medium-lighter text-[var(--content-default)] transition-colors`,`hover:bg-[var(--surface-active)]`,`data-[active]:bg-[var(--surface-active)] aria-selected:bg-[var(--surface-active)]`),children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`truncate text-body-medium-default`,children:e.city}),e.region&&(0,Q.jsx)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.region})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(`span`,{children:Bo(e.identifier)}),(0,Q.jsx)(`span`,{children:e.offsetLabel})]})]},e.identifier))})]})]}),(0,Q.jsx)(er,{}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:n(`timezonePicker.zoneName`)}),(0,Q.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:Vo(e,n(`timezonePicker.notSet`))})]})]})}function Ko(){let{t:e}=J(`settings`),t=Yt.use.activeAssistantId(),[n,r]=(0,Z.useState)(()=>xe(`timezone`,``)),i=(0,Z.useRef)(t);(0,Z.useEffect)(()=>{i.current=t},[t]);let a=(0,Z.useRef)(!1),o=(0,Z.useRef)(null),s=(0,Z.useRef)(()=>{}),c=e=>{if(a.current){o.current=e;return}let t=i.current;if(!t){o.current=null;return}a.current=!0,o.current=null,I.patch({url:`/v1/assistants/{assistant_id}/config`,path:{assistant_id:t},body:{ui:{userTimezone:e}},throwOnError:!0}).catch(e=>{S(e,{context:`settings-timezone-override`})}).finally(()=>{a.current=!1;let e=o.current;o.current=null,e!==null&&s.current(e)})};return(0,Z.useEffect)(()=>{s.current=c}),(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`timezoneSection.title`)}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`timezoneSection.description`)}),(0,Q.jsx)(`div`,{className:`mt-1`,children:(0,Q.jsx)(Go,{value:n,onChange:e=>{r(e),ve(`timezone`,e),c(e)}})})]})}var qo=[0,1,2,3,4,5,6];function Jo(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),t,n));return`${i.getHours().toString().padStart(2,`0`)}:${i.getMinutes().toString().padStart(2,`0`)}`}function Yo(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),t,n);return`${i.getUTCHours().toString().padStart(2,`0`)}:${i.getUTCMinutes().toString().padStart(2,`0`)}`}function Xo(){return Intl.DateTimeFormat(void 0,{timeZoneName:`short`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??``}function Zo(e){let t=e?.schedule?.window.start??`06:00`,n=e?.schedule?.window.end??`08:00`;return{enabled:e?.enabled??!0,timezone:`UTC`,frequency:e?.schedule?.frequency??`weekly`,daysOfWeek:e?.schedule?.days_of_week??[0],daysOfMonth:e?.schedule?.days_of_month??[],windowStart:Jo(t),windowEnd:Jo(n)}}function Qo({assistantId:e}){let{t}=J(`settings`),n=q(),r=[t(`updateWindowPolicy.dayMon`),t(`updateWindowPolicy.dayTue`),t(`updateWindowPolicy.dayWed`),t(`updateWindowPolicy.dayThu`),t(`updateWindowPolicy.dayFri`),t(`updateWindowPolicy.daySat`),t(`updateWindowPolicy.daySun`)],{data:i,isLoading:a,isError:o}=K(ge({path:{id:e}})),c=(0,Z.useMemo)(()=>Zo(i),[i]),[u,d]=(0,Z.useState)(null),p=u??c,m=u!==null,h=(0,Z.useMemo)(()=>Xo(),[]),[g,_]=(0,Z.useState)(null),v=g??p.daysOfMonth.join(`, `),y=cn({mutationFn:async t=>{let{data:n}=await Xt({path:{id:e},body:t,throwOnError:!0});return n}}),x=e=>{d(t=>({...t??c,...e}))},S=e=>{x({daysOfWeek:p.daysOfWeek.includes(e)?p.daysOfWeek.filter(t=>t!==e):[...p.daysOfWeek,e].sort((e,t)=>e-t)})},C=e=>e.split(`,`).map(e=>parseInt(e.trim(),10)).filter(e=>!isNaN(e)&&e>=1&&e<=31);return a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(Y,{className:`h-4 w-4 animate-spin`}),t(`updateWindowPolicy.loading`)]}):o?(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:t(`updateWindowPolicy.loadError`)}):(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(b,{checked:p.enabled,onChange:e=>x({enabled:e}),label:t(`updateWindowPolicy.automaticUpdates`),helperText:t(`updateWindowPolicy.automaticUpdatesHelper`)}),p.enabled&&(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:t(`updateWindowPolicy.frequency`)}),(0,Q.jsx)(`div`,{className:`max-w-[400px]`,children:(0,Q.jsx)(s,{ariaLabel:t(`updateWindowPolicy.frequency`),value:p.frequency,onChange:e=>{e!==`monthly`&&_(null),x({frequency:e})},items:[{value:`daily`,label:t(`updateWindowPolicy.daily`)},{value:`weekly`,label:t(`updateWindowPolicy.weekly`)},{value:`monthly`,label:t(`updateWindowPolicy.monthly`)}]})})]}),p.frequency===`weekly`&&(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:t(`updateWindowPolicy.daysOfWeek`)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:qo.map(e=>(0,Q.jsx)(H,{variant:`outlined`,size:`compact`,active:p.daysOfWeek.includes(e),onClick:()=>S(e),children:r[e]},e))})]}),p.frequency===`monthly`&&(0,Q.jsx)(k,{label:t(`updateWindowPolicy.daysOfMonth`),type:`text`,value:v,onChange:e=>_(e.target.value),onBlur:e=>{let t=C(e.target.value);x({daysOfMonth:t}),_(t.join(`, `))},placeholder:t(`updateWindowPolicy.daysOfMonthPlaceholder`),helperText:t(`updateWindowPolicy.daysOfMonthHelper`),className:`w-48`}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:h?t(`updateWindowPolicy.updateWindowWithTz`,{tz:h}):t(`updateWindowPolicy.updateWindow`)}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(k,{type:`time`,value:p.windowStart,onChange:e=>x({windowStart:e.target.value})}),(0,Q.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:t(`updateWindowPolicy.to`)}),(0,Q.jsx)(k,{type:`time`,value:p.windowEnd,onChange:e=>x({windowEnd:e.target.value})})]})]})]}),(0,Q.jsx)(H,{variant:`primary`,leftIcon:y.isPending?(0,Q.jsx)(Y,{className:`animate-spin`}):void 0,onClick:async()=>{let r=p.frequency===`monthly`&&g!==null?C(g):p.daysOfMonth;try{await y.mutateAsync({enabled:p.enabled,timezone:`UTC`,schedule:{frequency:p.frequency,days_of_week:p.frequency===`weekly`?p.daysOfWeek:[],days_of_month:p.frequency===`monthly`?r:[],window:{start:Yo(p.windowStart),end:Yo(p.windowEnd)}}}),f.success(t(`updateWindowPolicy.toastSaved`)),d(null),_(null),n.invalidateQueries({queryKey:l({path:{id:e}})})}catch{f.error(t(`updateWindowPolicy.toastSaveFailed`))}},disabled:y.isPending||!m,children:t(`updateWindowPolicy.savePolicy`)})]})}function $o({assistantId:e,open:t,onClose:n}){let{t:r}=J(`settings`);return(0,Q.jsx)(R.Root,{open:t,onOpenChange:e=>{e||n()},children:(0,Q.jsxs)(R.Content,{size:`md`,children:[(0,Q.jsxs)(R.Header,{children:[(0,Q.jsx)(R.Title,{children:r(`updateWindowModal.title`)}),(0,Q.jsx)(R.Description,{children:r(`updateWindowModal.description`)})]}),(0,Q.jsx)(R.Body,{children:(0,Q.jsx)(Qo,{assistantId:e})})]})})}function es(e){if(typeof e==`object`&&e&&`code`in e){let t=e.code;if(typeof t==`string`)return t}}function ts({open:e,onOpenChange:t}){let{t:n}=J(`settings`),r=q(),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(null),u=(0,Z.useRef)(!1),d=(0,Z.useRef)(e),p=()=>r.invalidateQueries({queryKey:en()}),m=e=>{ht({path:{id:e}}).catch(()=>void 0).finally(()=>void p())},h=ot({onSuccess:e=>{if(!d.current){m(e.factor_id);return}a(e)},onError:e=>{let r=es(e);r===`no_workos_account`?f.error(n(`enrollTotpModal.toastNoWorkosAccount`)):r===`throttled`||r===`workos_rate_limited`?f.error(n(`enrollTotpModal.toastThrottled`)):r===`factor_limit_reached`?f.error(n(`enrollTotpModal.toastFactorLimitReached`)):f.error(n(`enrollTotpModal.toastStartFailed`)),t(!1)}}),g=Re({onSuccess:e=>{e.valid?(u.current=!0,f.success(n(`enrollTotpModal.toastEnabled`)),p(),t(!1)):l(n(`enrollTotpModal.errorCodeMismatch`))},onError:e=>{let r=es(e);if(r===`challenge_already_verified`){u.current=!0,f.success(n(`enrollTotpModal.toastEnabled`)),p(),t(!1);return}if(r===`challenge_expired`||r===`challenge_not_found`){i&&m(i.factor_id),a(null),s(``),l(n(`enrollTotpModal.errorSessionExpired`)),h.mutate({});return}if(r===`throttled`||r===`workos_rate_limited`){l(n(`enrollTotpModal.errorThrottledInline`));return}l(n(`enrollTotpModal.errorVerifyFailed`))}});(0,Z.useEffect)(()=>{d.current=e,e&&(u.current=!1,a(null),s(``),l(null),h.mutate({}))},[e]);let _=e=>{!e&&g.isPending||(!e&&i&&!u.current&&m(i.factor_id),t(e))},v=()=>{i&&Xe(i.secret,{successMessage:n(`enrollTotpModal.copySuccess`),errorMessage:n(`enrollTotpModal.copyError`)})},y=()=>{!i||o.length!==6||g.isPending||(l(null),g.mutate({body:{challenge_id:i.challenge_id,code:o}}))};return(0,Q.jsx)(R.Root,{open:e,onOpenChange:_,children:(0,Q.jsxs)(R.Content,{size:`sm`,children:[(0,Q.jsxs)(R.Header,{children:[(0,Q.jsx)(R.Title,{children:n(`enrollTotpModal.title`)}),(0,Q.jsx)(R.Description,{children:n(`enrollTotpModal.description`)})]}),(0,Q.jsx)(R.Body,{children:i===null?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,Q.jsx)(Y,{className:`h-5 w-5 animate-spin text-[var(--content-tertiary)]`})}):(0,Q.jsxs)(`form`,{className:`flex flex-col items-center gap-4`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,Q.jsx)(`img`,{src:i.qr_code,alt:n(`enrollTotpModal.qrCodeAlt`),className:`h-44 w-44 rounded-lg bg-white p-2`}),(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:n(`enrollTotpModal.manualKeyHint`)}),(0,Q.jsxs)(`button`,{type:`button`,onClick:v,className:`flex cursor-pointer items-center gap-2 self-start font-mono text-body-small-default text-[var(--content-default)] hover:text-[var(--content-emphasised)]`,children:[(0,Q.jsx)(`span`,{className:`break-all text-left`,children:i.secret}),(0,Q.jsx)(Mn,{className:`h-3.5 w-3.5 shrink-0`})]})]}),(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,Q.jsx)(`label`,{htmlFor:`totp-code`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:n(`enrollTotpModal.codeLabel`)}),(0,Q.jsx)(k,{id:`totp-code`,inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:6,placeholder:n(`enrollTotpModal.codePlaceholder`),value:o,onChange:e=>s(e.target.value.replace(/\D/g,``).slice(0,6))}),c&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--system-negative-strong)]`,children:c})]})]})}),(0,Q.jsxs)(R.Footer,{children:[(0,Q.jsx)(H,{variant:`outlined`,onClick:()=>_(!1),disabled:g.isPending,children:n(`enrollTotpModal.cancel`)}),(0,Q.jsx)(H,{onClick:y,disabled:i===null||o.length!==6||g.isPending,children:g.isPending?n(`enrollTotpModal.verifying`):n(`enrollTotpModal.verify`)})]})]})})}function ns(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function rs(){let{t:e}=J(`settings`),t=q(),[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(null),o=K({...Jt()}),s=o.data??[],c=()=>t.invalidateQueries({queryKey:en()}),l=it({onSuccess:()=>{f.success(e(`twoFactorSection.toastRemoved`)),c()},onError:t=>{if(es(t)===`factor_not_found`){c();return}f.error(e(`twoFactorSection.toastRemoveFailed`))}});return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[o.isPending?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(Y,{className:`h-4 w-4 animate-spin`}),(0,Q.jsx)(`span`,{className:`text-body-medium-default`,children:e(`twoFactorSection.loading`)})]}):o.isError?(0,Q.jsx)(z,{tone:`error`,children:(0,Q.jsx)(G,{ns:`settings`,i18nKey:`twoFactorSection.loadError`,components:{retryButton:(0,Q.jsx)(`button`,{type:`button`,className:`cursor-pointer underline`,onClick:()=>void o.refetch()})}})}):s.length===0?(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`twoFactorSection.emptyDescription`)}):(0,Q.jsx)(`ul`,{className:`flex flex-col divide-y divide-[var(--border-base)]`,children:s.map(t=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(In,{className:`h-5 w-5 shrink-0 text-[var(--content-tertiary)]`}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`twoFactorSection.authenticatorApp`)}),(0,Q.jsxs)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:[t.user,t.created_at?e(`twoFactorSection.addedOn`,{date:ns(t.created_at)}):``]})]})]}),(0,Q.jsx)(H,{variant:`dangerOutline`,onClick:()=>a(t),disabled:l.isPending,children:e(`twoFactorSection.remove`)})]},t.id))}),!o.isPending&&!o.isError&&s.length===0&&(0,Q.jsx)(H,{onClick:()=>r(!0),className:`self-start`,children:e(`twoFactorSection.addAuthenticatorApp`)}),(0,Q.jsx)(ts,{open:n,onOpenChange:r}),(0,Q.jsx)(m,{open:i!==null,title:e(`twoFactorSection.removeDialogTitle`),message:e(`twoFactorSection.removeDialogMessage`),confirmLabel:e(`twoFactorSection.removeDialogConfirm`),destructive:!0,onConfirm:()=>{i&&l.mutate({path:{id:i.id}}),a(null)},onCancel:()=>a(null)})]})}var $=class extends Error{code;constructor(e,t){super(t),this.name=`TeleportError`,this.code=e}},is=`local`,as=`docker`,os=`vellum`;function ss(e){switch((e??``).toLowerCase()){case is:return`local`;case as:return`docker`;case os:return`managed`;default:return`other`}}function cs(e){let t=ss(e);return t===`managed`?`local`:t===`local`?`platform`:null}function ls(e){switch(e){case`docker`:return`teleportCard.moveToDocker`;case`platform`:return`teleportCard.moveToPlatform`;case`local`:return`teleportCard.moveToLocal`}}var us={macos:`Macos`,windows:`Windows`,linux:`Linux`};function ds(e,t=`macos`){switch(e){case`docker`:return`teleportCard.dockerDescription${us[t]}`;case`platform`:return`teleportCard.platformDescription`;case`local`:return`teleportCard.localDescription${us[t]}`}}function fs(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.reason!==`version_mismatch`)return null;let n=t.bundle_compat,r=t.target_runtime_version;if(!n||typeof n!=`object`||typeof r!=`string`)return null;let i=n,a=i.min_runtime_version;if(typeof a!=`string`)return null;let o=typeof i.max_runtime_version==`string`?i.max_runtime_version:null;return`Cannot import: bundle requires runtime ${o?`${a}–${o}`:`${a}+`}, but this local runtime is ${r}. Update your local runtime before importing.`}var ps=3600*1e3;function ms(e,t=Date.now(),n=ps){for(let r of e){if(!r)continue;let e=Date.parse(r);if(Number.isNaN(e))continue;let i=t-e;if(i>=0&&i<=n)return!0}return!1}function hs(e){return e.filter(e=>e.ready_to_use!==!1).map(e=>e.created_at)}function gs(e,t){return e.some(e=>e.snapshot_name===t&&e.ready_to_use===!0)}async function _s(e,t){let n=Number(e.headers.get(`Content-Length`)??0);if(!e.body||!t||n<=0){let n=await e.arrayBuffer();return t?.(1),n}let r=e.body.getReader(),i=[],a=0;for(;;){let{done:e,value:o}=await r.read();if(e)break;i.push(o),a+=o.length,t(a/n)}let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return t(1),o.buffer}function vs(e){let t=p(e);if(!t)throw new $(`local_assistant_not_found`,`Assistant ${e.assistantId} has no resolved local gateway.`);return`${window.location.origin}${t}`}async function ys(e,t){let n=await Ke(e.assistantId),r=await fetch(`${t}/auth/token`,{method:`POST`,headers:{Authorization:`Bearer ${n}`}});if(!r.ok)throw new $(`not_signed_in`,`Gateway token request failed (HTTP ${r.status}).`);let{token:i}=await r.json();return i}async function bs(e,t){let n=vs(e),r=await ys(e,n),i=await fetch(`${n}/v1/migrations/export`,{method:`POST`,headers:{Authorization:`Bearer ${r}`}});if(!i.ok)throw new $(`export_failed`,`Export failed (HTTP ${i.status}).`);return _s(i,t)}async function xs(e,t){let n=vs(e),r=await ys(e,n),i=await fetch(`${n}/v1/migrations/import`,{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:new Blob([t],{type:`application/octet-stream`})});if(!i.ok)throw new $(`import_failed`,`Import failed (HTTP ${i.status}).`);let a=await Ts(i);if(a&&a.success===!1)throw new $(`import_failed`,a.error??`Import reported failure`)}async function Ss(e){let t=vs(e),n=await ys(e,t),r=await fetch(`${t}/v1/backups/create`,{method:`POST`,headers:{Authorization:`Bearer ${n}`}});if(!r.ok)throw new $(`backup_failed`,W(`settings:teleportCard.backupLocalFailed`,{status:r.status}));let i=await Ts(r);if(i&&i.success===!1)throw new $(`backup_failed`,W(`settings:teleportCard.backupLocalReportedFailure`))}async function Cs(e,t){let{data:n,response:r}=await I.post({url:`/v1/assistants/{assistant_id}/migrations/export-to-gcs/`,path:{assistant_id:e},body:{upload_url:t},throwOnError:!1}),i=r?.status??0;if(!(r?.ok??!1)&&i!==202)throw new $(`export_failed`,`Export failed (HTTP ${i}).`);let a=n?.job_id;if(!a)throw new $(`export_failed`,`Export accepted but no job ID was returned.`);return a}async function ws(e,t){let{data:n,response:r}=await I.get({url:`/v1/assistants/{assistant_id}/migrations/jobs/{job_id}`,path:{assistant_id:e,job_id:t},throwOnError:!1}),i=r?.status??0;if(i>=500)return`processing`;if(!(r?.ok??!1))throw new $(`export_job_failed`,`Job status check failed (HTTP ${i})`);let a=n;if(a?.status===`failed`)throw new $(`export_job_failed`,a.error??`Export job failed`);return a?.status??`processing`}async function Ts(e){try{return await e.json()}catch{return null}}async function Es(e,t={}){let n=ss(e.cloud);if(n===`managed`)return ks(e.assistantId,t);if(n===`local`)return Ss(e);throw new $(`backup_failed`,W(`settings:teleportCard.backupUnsupported`))}async function Ds(e){let t=await At({path:{assistant_id:e},throwOnError:!1});if(!(t.response?.ok??!1))throw new $(`backup_failed`,W(`settings:teleportCard.backupListFailed`,{status:t.response?.status??0}));let n=t.data?.backups;return Array.isArray(n)?n:[]}var Os=e=>new Promise(t=>setTimeout(t,e));async function ks(e,t){if(ms(hs(await Ds(e))))return;let n=await ze({path:{assistant_id:e},throwOnError:!1});if(!(n.response?.ok??!1))throw new $(`backup_failed`,W(`settings:teleportCard.backupCreateFailed`,{status:n.response?.status??0}));let r=n.data,i=r?.snapshot_name;if(!i)throw new $(`backup_failed`,W(`settings:teleportCard.backupNoSnapshotName`));if(r?.ready_to_use===!0)return;let a=t.readyTimeoutMs??6e5,o=t.readyPollIntervalMs??5e3,s=Date.now()+a;for(;Date.now()<s;)if(await Os(o),gs(await Ds(e),i))return;throw new $(`backup_failed`,W(`settings:teleportCard.backupNotReady`,{snapshot:i,seconds:Math.round(a/1e3)}))}var As=new Set([500,502,503,504]),js=3,Ms=e=>new Promise(t=>setTimeout(t,e));async function Ns(e,t=new Set){for(let n=0;n<=js;n++){let{response:r,data:i,error:a}=await e(),o=r?.status??0;if(n<js&&As.has(o)&&!t.has(o)){await Ms(2**n*1e3);continue}return{status:o,data:i,error:a}}throw new $(`unknown`,`Unexpected retry loop exit`)}async function Ps(e,t){let n={operation:`upload`};e&&(n.min_runtime_version=e,n.max_runtime_version=null),t&&(n.consumer=t);let{status:r,data:i}=await Ns(()=>I.post({url:`/v1/migrations/signed-url/`,body:n,throwOnError:!1}),new Set([404,503]));if(r===503||r===404)throw new $(`export_failed`,`Signed URL uploads are not available — the platform may not support this feature yet.`);if(r!==201)throw new $(`export_failed`,`Migration request failed (HTTP ${r}).`);let a=i;return{url:a.url,bundleKey:a.bundle_key,expiresAt:a.expires_at}}async function Fs(e,t){let{status:n,data:r,error:i}=await Ns(()=>I.post({url:`/v1/migrations/signed-url/`,body:{operation:`download`,bundle_key:e,target_runtime_version:t},throwOnError:!1}),new Set([422]));if(n===422){let e=fs(i);if(e)throw new $(`version_mismatch`,e)}if(n!==200&&n!==201)throw new $(`import_failed`,`Migration request failed (HTTP ${n}).`);return r.url}async function Is(e,t,n){for(let r=0;r<=js;r++){let i=await Ls(e,t,n);if(r<js&&As.has(i)){await Ms(2**r*1e3),n?.(0);continue}if(i<200||i>=300)throw new $(`export_failed`,`Bundle upload failed (HTTP ${i}).`);return}}function Ls(e,t,n){return new Promise((r,i)=>{let a=new XMLHttpRequest;a.open(`PUT`,e),a.setRequestHeader(`Content-Type`,`application/octet-stream`),a.timeout=36e5,n&&(a.upload.onprogress=e=>{e.lengthComputable&&n(e.loaded/e.total)}),a.onload=()=>{n?.(1),r(a.status)},a.onerror=()=>i(new $(`export_failed`,`Bundle upload failed.`)),a.ontimeout=()=>i(new $(`export_timed_out`,`Bundle upload timed out.`)),a.send(t)})}async function Rs(e,t){for(let n=0;n<=js;n++){let r=await fetch(e,{method:`GET`});if(n<js&&As.has(r.status)){await Ms(2**n*1e3),t?.(0);continue}if(!r.ok)throw new $(`import_failed`,`Bundle download failed (HTTP ${r.status}).`);return _s(r,t)}throw new $(`import_failed`,`Unexpected retry loop exit`)}async function zs(e){let{status:t,data:n,error:r}=await Ns(()=>I.post({url:`/v1/migrations/import-from-gcs/`,body:{bundle_key:e},throwOnError:!1}));return{status:t,body:n??r??null}}async function Bs(e){let{status:t,data:n}=await Ns(()=>I.get({url:`/v1/migrations/jobs/{job_id}/`,path:{job_id:e},throwOnError:!1}));if(t!==200)throw new $(`import_failed`,`Job status check failed (HTTP ${t})`);let r=n??{};return{status:typeof r.status==`string`?r.status:`unknown`,jobId:typeof r.job_id==`string`?r.job_id:null,error:typeof r.error==`string`?r.error:null}}var Vs=5e3,Hs=36e5,Us=5*6e4,Ws=30,Gs=e=>new Promise(t=>setTimeout(t,e));function Ks(){let e=hn(),t=q(),n=x(),r=cs(n?.cloud),[i,a]=(0,Z.useState)({kind:`idle`}),[o,s]=(0,Z.useState)(!1),c=(0,Z.useRef)(null),l=(0,Z.useRef)(null),u=(0,Z.useCallback)(e=>{a({kind:`transferring`,step:e,progress:null})},[]),d=(0,Z.useCallback)(e=>{a(t=>t.kind===`transferring`?{...t,progress:e}:t)},[]),f=(0,Z.useCallback)(async()=>{if(!(!n||!r)){l.current={id:n.assistantId,kind:ss(n.cloud)===`managed`?`managed`:`local`,createdFresh:!1};try{if(u(W(`settings:teleportCard.backupStep`)),await Es(n),r===`platform`)await qs(n,u,d,c);else if(r===`local`)await Js(n,u,d,c);else throw new $(`unknown`,W(`settings:teleportCard.unsupportedDestination`));a({kind:`verifying`})}catch(e){a({kind:`failed`,error:W(`settings:teleportCard.teleportFailed`,{message:e instanceof $||e instanceof Error?e.message:W(`settings:teleportCard.teleportFailedUnknown`)})}),S(e,{context:`teleport-execute`}),await Xs(t,c.current,l.current,`teleport-execute-cleanup`),c.current=null}}},[n,r,u,d,t]),p=(0,Z.useCallback)(()=>s(!0),[]),m=(0,Z.useCallback)(()=>s(!1),[]),h=(0,Z.useCallback)(()=>{s(!1),f()},[f]),g=(0,Z.useCallback)(()=>{c.current=null,l.current=null,a({kind:`idle`})},[]);return{destination:r,phase:i,confirmOpen:o,requestTeleport:p,cancelConfirm:m,confirm:h,confirmAndSwitch:(0,Z.useCallback)(()=>{let n=c.current,r=l.current;n&&(async()=>{try{let e=ie.getState();n.kind===`managed`?await e.connectPlatformAssistant(n.id):(await e.connectLocalAssistant(n.id),Lt(n.id,{onError:e=>S(e,{context:`teleport-inject-platform-identity`})}))}catch(e){a({kind:`failed`,error:W(`settings:teleportCard.switchFailed`,{message:e instanceof Error?e.message:W(`settings:teleportCard.switchFailedUnknown`)})}),S(e,{context:`teleport-confirm-switch`});return}r&&be(t,r.id).then(e=>{e.ok||S(Error(e.error),{context:`teleport-retire-source`})}),g(),e(D.assistant,{replace:!0})})()},[e,g,t]),cancelTeleport:(0,Z.useCallback)(()=>{let e=c.current,n=l.current;c.current=null,l.current=null,a({kind:`idle`}),Xs(t,e,n,`teleport-cancel-retire-target`)},[t]),reset:g}}async function qs(e,t,r,i){t(W(`settings:teleportCard.stepExportingLocal`));let a=await bs(e,r);t(W(`settings:teleportCard.stepResolvingOrganization`));let o=await Qs();t(W(`settings:teleportCard.stepCheckingExisting`));let s=(await Nt({query:{hosting:`platform`},throwOnError:!1})).data?.results?.[0];if(s)throw new $(`existing_platform_assistant`,W(`settings:teleportCard.existingPlatformAssistant`,{id:s.id}));t(W(`settings:teleportCard.stepUploading`));let c=await Ps(e.resources?.runtimeVersion);await Is(c.url,a,r),t(W(`settings:teleportCard.stepSettingUpCloud`));let l=await n(void 0,`create`);if(!l.ok)throw new $(`import_failed`,W(`settings:teleportCard.cloudSetupFailed`));if(l.status===200)throw new $(`existing_platform_assistant`,W(`settings:teleportCard.existingPlatformAssistant`,{id:l.data.id}));let u=l.data.id;await lt({assistantId:u,name:l.data.name,cloud:`vellum`,runtimeUrl:he(),hatchedAt:l.data.created??new Date().toISOString(),organizationId:o}),await kt(e.assistantId),i.current={id:u,kind:`managed`,createdFresh:!0},t(W(`settings:teleportCard.stepFinalizingCloud`)),await $s(u),t(W(`settings:teleportCard.stepImportingToCloud`));let d=await zs(c.bundleKey);if(d.status<200||d.status>=300){let e=d.body;throw new $(`import_failed`,e?.error??W(`settings:teleportCard.importFailedHttp`,{status:d.status}))}if(d.status===202){let e=d.body?.job_id;if(!e)throw new $(`import_failed`,W(`settings:teleportCard.importNoJobId`));await ec(e)}else{let e=d.body;if(e&&e.success===!1)throw new $(`import_failed`,e.error??W(`settings:teleportCard.importReportedFailure`))}}async function Js(e,t,n,r){t(W(`settings:teleportCard.stepPreparingExport`));let i=await Ps(await Zs(e.assistantId),`runtime`);t(W(`settings:teleportCard.stepExportingCloud`));let a=await Cs(e.assistantId,i.url);await tc(e.assistantId,a),t(W(`settings:teleportCard.stepPreparingLocal`));let{assistant:o,createdFresh:s}=await nc();r.current={id:o.assistantId,kind:`local`,createdFresh:s};let c=await Ys(o,s);if(!c)throw new $(`local_assistant_not_found`,W(`settings:teleportCard.localRuntimeVersionUnknown`));t(W(`settings:teleportCard.stepPreparingImport`));let l=await Fs(i.bundleKey,c);t(W(`settings:teleportCard.stepDownloading`));let u=await Rs(l,n);t(W(`settings:teleportCard.stepImporting`)),await ic(o,u),await kt(e.assistantId)}async function Ys(e,t){if(e.resources?.runtimeVersion)return e.resources.runtimeVersion;if(t)return(await Bn())?.version??void 0}async function Xs(e,t,n,r){if(t?.createdFresh){let n=await be(e,t.id);n.ok||S(Error(n.error),{context:r})}n&&await kt(n.id)}async function Zs(e){let t=await ue(e);return t.ok?t.data.version??void 0:void 0}async function Qs(){let e=g.getState();e.organizations.length===0&&await e.fetchOrganizations();let t=g.getState().organizations,n=oe();if(n&&t.some(e=>e.id===n))return n;if(t.length===0)throw new $(`no_organizations`,W(`settings:teleportCard.noOrganizations`));if(t.length>1)throw new $(`multiple_organizations`,W(`settings:teleportCard.multipleOrganizations`));let r=t[0].id;return g.getState().setCurrentOrganizationId(r),r}async function $s(e){let t=Date.now();for(;Date.now()-t<Us;){let{data:t,response:n}=await tt({path:{id:e},throwOnError:!1});if(n?.ok&&t?.state===`active`)return;await Gs(Vs)}}async function ec(e){let t=Date.now();for(;Date.now()-t<Hs;){await Gs(Vs);let t=await Bs(e);if(t.status===`complete`)return;if(t.status===`failed`)throw new $(`import_failed`,t.error??W(`settings:teleportCard.importJobFailed`))}throw new $(`import_failed`,W(`settings:teleportCard.importTimedOut`))}async function tc(e,t){let n=Date.now();for(;Date.now()-n<Hs;)if(await Gs(Vs),await ws(e,t)===`complete`)return;throw new $(`export_timed_out`,W(`settings:teleportCard.exportTimedOut`))}async function nc(){let e=await Ze(void 0,void 0);if(!e.ok)throw new $(`local_assistant_not_found`,e.error??W(`settings:teleportCard.localCreateFailed`));await M();let t=e.assistantId?h().find(t=>t.assistantId===e.assistantId):rc();if(!t)throw new $(`local_assistant_not_found`,W(`settings:teleportCard.localNotFound`));return{assistant:t,createdFresh:!0}}function rc(){return h().slice().sort((e,t)=>(t.hatchedAt??``).localeCompare(e.hatchedAt??``))[0]}async function ic(e,t){let n;for(let r=0;r<Ws;r++)try{await xs(e,t);return}catch(e){n=e,await Gs(1e3)}throw n instanceof Error?n:new $(`import_failed`,W(`settings:teleportCard.importFailed`))}function ac(){let{t:e}=J(`settings`),t=Ks(),{destination:n,phase:r}=t,i=U.use.teleport(),a=_e();return!n||a===`gated`||r.kind===`idle`&&n===`platform`&&!i?null:(0,Q.jsxs)(X,{title:e(`teleportCard.title`),subtitle:e(`teleportCard.subtitle`),children:[r.kind===`idle`&&a===`disabled`&&(0,Q.jsx)(V,{children:e(`teleportCard.loginNotice`)}),r.kind===`idle`&&a===`full`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(ds(n,Dt()))}),(0,Q.jsx)(H,{variant:`outlined`,className:`self-start`,onClick:t.requestTeleport,children:e(ls(n))})]}),r.kind===`transferring`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r.progress==null&&(0,Q.jsx)(Y,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:r.step})]}),r.progress!=null&&(0,Q.jsx)(E,{value:r.progress,"aria-label":e(`teleportCard.progressAriaLabel`),className:`max-w-[240px]`})]}),r.kind===`verifying`&&(0,Q.jsx)(z,{tone:`success`,icon:(0,Q.jsx)(On,{className:`h-4 w-4`}),title:e(`teleportCard.verifyTitle`),actions:(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(H,{variant:`primary`,onClick:t.confirmAndSwitch,children:e(`teleportCard.confirmAndSwitch`)}),(0,Q.jsx)(H,{variant:`outlined`,onClick:t.cancelTeleport,children:e(`teleportCard.cancel`)})]})}),r.kind===`failed`&&(0,Q.jsx)(z,{tone:`error`,title:r.error,actions:(0,Q.jsx)(H,{variant:`outlined`,onClick:t.reset,children:e(`teleportCard.tryAgain`)})}),(0,Q.jsx)(m,{open:t.confirmOpen,title:e(ls(n)),message:e(`teleportCard.confirmMessage`),confirmLabel:e(`teleportCard.confirmLabel`),onConfirm:t.confirm,onCancel:t.cancelConfirm})]})}function oc(){let{t:e}=J(`settings`),{assistant:t,healthz:n,healthzLoading:r,healthzFetching:i,healthzPolling:a,refetch:o,refetchUntilResized:s}=Jn(),c=U.use.multiPlatformAssistant(),l=U.use.accountMfa(),d=bt.use.settingsSleepPolicy(),f=gt(),p=xt(),m=on()||f||Te()||p,h=hn(),g=_e(),_=_e({platformHostedOnly:!0}),v=u(),y=yt({assistantId:t?.id??null,enabled:_===`full`&&v}),[b,S]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(!1),[E,O]=mn();(0,Z.useEffect)(()=>{if(E.get(`preferences`)!==`open`)return;let e=new URLSearchParams(E);e.delete(`preferences`),O(e,{replace:!0}),T(!0)},[E,O]);let k=t?.is_local&&!on()?null:t,A=x(),j=on()&&!!t&&!!A&&me(A),M=j,P=j&&!Te(),F=_===`full`&&!!k||P&&!!t;(0,Z.useEffect)(()=>{!t||window.location.hash!==`#storage-resources`||requestAnimationFrame(()=>{document.getElementById(`storage-resources`)?.scrollIntoView({block:`start`})})},[t]);let I=n?.version??t?.current_release_version??null,ee=()=>{let e=ce();if(Te()&&!p&&e){let t=new URLSearchParams({register:C()}),n=te();n&&t.set(`name`,n);let r=new URL(e).origin;window.location.assign(`${r}${D.selectAssistant}?${t.toString()}`);return}h(`${D.selectAssistant}?noAutoSkip=1`)},L=(g===`full`||M)&&!!k||g===`disabled`&&!M,ne=_!==`gated`;return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[y.status&&y.mode!==`inactive`&&(0,Q.jsx)(Je,{status:y.status,mode:y.mode,isAcknowledging:y.isAcknowledging,acknowledgeError:y.acknowledgeError?.message??null,onAcknowledge:()=>void y.acknowledge(),onReviewWorkspaceData:()=>void h(`${D.workspace}?sort=size`),onUpgradeStorage:_===`full`?()=>void h(D.plans):null}),(0,Q.jsxs)(vr,{assistant:v?k:null,showHandles:f&&g===`full`,children:[(0,Q.jsx)(Ko,{}),l&&g!==`gated`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`generalPage.twoFactorTitle`)}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.twoFactorDescription`)}),(0,Q.jsx)(`div`,{className:`mt-1`,children:g===`disabled`?(0,Q.jsx)(V,{children:e(`generalPage.twoFactorLoginNotice`)}):(0,Q.jsx)(rs,{})})]})]})]}),(0,Q.jsx)(X,{title:e(`generalPage.versionTitle`),subtitle:e(`generalPage.versionSubtitle`),accessory:_===`full`&&k?(0,Q.jsx)(H,{variant:`outlined`,onClick:()=>S(!0),children:e(`generalPage.updateWindow`)}):void 0,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[_===`full`&&k&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xi,{assistantId:k.id,currentVersion:I,releaseChannel:k.release_channel,onUpgradeComplete:()=>{o()}}),(0,Q.jsx)(wo,{assistantId:k.id,onComplete:()=>{o()}})]}),P&&t&&(0,Q.jsx)(Si,{assistantId:t.id,currentVersion:I,onUpgradeComplete:()=>{o()}}),!F&&t&&(0,Q.jsxs)(`div`,{className:`grid grid-cols-[140px_minmax(0,1fr)] gap-y-3`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.current`)}),(0,Q.jsx)(Yn,{version:I,loading:r&&!t.current_release_version,assistantId:t.id??null})]}),_===`disabled`&&!P&&(0,Q.jsx)(V,{children:e(`generalPage.updatesLoginNotice`)}),(0,Q.jsx)(Ao,{})]})}),_===`full`&&k&&(0,Q.jsx)($o,{assistantId:k.id,open:b,onClose:()=>S(!1)}),_===`full`&&t&&(0,Q.jsx)(No,{assistant:t,healthz:n,healthzLoading:r,healthzFetching:i,healthzPolling:a,refetch:o,refetchUntilResized:s}),_===`disabled`&&(0,Q.jsx)(X,{id:`storage-resources`,title:e(`generalPage.computeResourcesTitle`),subtitle:e(`generalPage.computeResourcesSubtitle`),children:(0,Q.jsx)(V,{children:e(`generalPage.computeResourcesLoginNotice`)})}),(0,Q.jsx)(X,{title:e(`generalPage.preferencesTitle`),subtitle:e(`generalPage.preferencesSubtitle`),accessory:(0,Q.jsx)(H,{variant:`outlined`,onClick:()=>T(!0),children:e(`generalPage.customize`)}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsx)(ar,{}),(0,Q.jsx)(li,{})]})}),(0,Q.jsx)(yo,{open:w,onClose:()=>T(!1)}),(0,Q.jsx)(Ei,{}),(0,Q.jsx)(uo,{}),_===`full`&&k&&d&&(0,Q.jsx)(X,{title:e(`generalPage.sleepPolicyTitle`),subtitle:e(`generalPage.sleepPolicySubtitle`),children:(0,Q.jsx)(_i,{assistantId:k.id})}),_===`disabled`&&d&&(0,Q.jsx)(X,{title:e(`generalPage.sleepPolicyTitle`),subtitle:e(`generalPage.sleepPolicySubtitle`),children:(0,Q.jsx)(V,{children:e(`generalPage.sleepPolicyLoginNotice`)})}),c&&!m&&(0,Q.jsx)(fi,{}),m&&(0,Q.jsx)(X,{title:e(`generalPage.switchAssistantTitle`),subtitle:e(`generalPage.switchAssistantSubtitle`),accessory:(0,Q.jsx)(H,{variant:`outlined`,onClick:ee,children:e(`generalPage.chooseAssistant`)})}),N()&&(0,Q.jsx)(ac,{}),(L||ne)&&(0,Q.jsx)(X,{variant:`danger`,title:e(`generalPage.dangerZoneTitle`),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[L&&(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`generalPage.retireAssistantTitle`)}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.retireAssistantDescription`)}),(0,Q.jsx)(`div`,{className:`mt-1`,children:(g===`full`||M)&&k?(0,Q.jsx)(Po,{assistantId:k.id}):(0,Q.jsx)(V,{children:e(`generalPage.retireAssistantLoginNotice`)})})]}),L&&ne&&(0,Q.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Q.jsx)(Ci,{})]})})]})}export{oc as GeneralPage};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/esm-DmK6yYdC.js","assets/react-B9IgSVeK.js","assets/rolldown-runtime-BM3Ffeng.js","assets/vendor-Dc7Mo5cU.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$_ as t,$h as n,$m as r,A as i,Ab as a,Ai as o,Ax as s,Cg as c,Cl as l,Cp as u,Di as d,Dx as f,Dy as p,Ex as m,Ey as h,Fh as g,Fi as _,Fm as v,Fs as y,Fx as b,Fy as x,Gb as S,Gh as C,Gm as w,Hm as T,Hx as E,Ib as D,Ii as O,Ix as k,Ju as A,Kb as j,Ky as M,Lb as N,Li as P,M as F,Mg as I,Mh as ee,Mx as L,My as te,Nx as ne,Om as re,Op as ie,Ox as R,Pb as ae,Ph as oe,Pi as se,Py as ce,Qb as le,Qh as ue,R as de,Rb as fe,Rm as pe,Ry as me,Sb as he,Sl as ge,Tp as _e,Ub as ve,Um as ye,Ux as z,Va as be,Vb as xe,Vm as Se,Wm as Ce,Wx as we,Wy as Te,Xb as Ee,Xr as De,Xu as Oe,Yb as ke,Yc as Ae,Yl as je,Yu as Me,Zx as Ne,_b as Pe,_g as Fe,_h as Ie,_l as Le,_u as Re,ag as ze,ah as Be,bl as Ve,bm as He,ch as Ue,cn as We,cu as Ge,db as Ke,di as qe,dn as Je,et as Ye,ev as Xe,fb as Ze,fg as Qe,fh as $e,fx as et,gg as tt,gh as nt,gl as rt,gu as it,gx as B,hl as at,hu as ot,hx as st,iS as ct,ib as lt,if as ut,ih as dt,iu as ft,ix as pt,j as mt,jg as ht,jp as gt,ju as _t,ki as vt,kr as yt,ld as bt,lh as xt,ln as St,lu as Ct,mb as wt,ml as Tt,mn as V,mu as Et,nh as Dt,no as Ot,ob as kt,og as At,oh as jt,ox as Mt,pg as Nt,ph as Pt,pl as Ft,ql as It,qm as Lt,qu as Rt,rh as zt,rv as Bt,sh as Vt,sl as Ht,tS as H,th as Ut,tx as Wt,ux as Gt,vg as Kt,vl as qt,vu as Jt,vy as Yt,wg as Xt,wp as Zt,wx as Qt,yl as $t,yu as en,yx as tn,z as nn,za as rn,zg as U,zx as an,zy as on}from"./app-1VZKPehC.js";import{E as sn,I as W,Jn as cn,N as G,Q as ln,Zn as K,_ as un,er as q,f as dn,g as fn,j as J,k as pn}from"./vendor-Dc7Mo5cU.js";import{_ as mn,f as hn,n as gn,t as _n,v as vn,x as yn}from"./react-B9IgSVeK.js";import{B as bn,Ca as xn,E as Sn,Et as Cn,Hi as wn,Ja as Tn,Jn as Y,Ki as En,Q as Dn,Ri as On,Tt as kn,_n as An,br as jn,ci as Mn,gr as Nn,i as Pn,kt as Fn,nt as In,qi as Ln,vn as Rn}from"./icons-DxrLl-Dj.js";import{t as X}from"./detail-card-N-3EizQA.js";import{t as zn}from"./environment-store-D8RAr0eS.js";import{t as Bn}from"./app-info-BJtkRDIh.js";import{a as Vn,i as Hn,l as Un,o as Wn}from"./machine-sizes--PLzvcMG.js";import{t as Gn}from"./format-countdown-Dceq8qd-.js";import{a as Kn,i as qn,n as Jn,r as Yn,t as Xn}from"./assistant-status-panel-DK9S4lgz.js";import{t as Zn}from"./trait-cycle-row-B-vau_0l.js";import{n as Qn,r as $n,t as er}from"./settings-divider-B1o1lqXE.js";import{t as tr}from"./use-hotkey-recorder-BQ9JKgzA.js";var nr=Tn(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),rr=Tn(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),ir=Tn(`vibrate`,[[`path`,{d:`m2 8 2 2-2 2 2 2-2 2`,key:`sv1b1`}],[`path`,{d:`m22 8-2 2 2 2-2 2 2 2`,key:`101i4y`}],[`rect`,{width:`8`,height:`14`,x:`8`,y:`5`,rx:`1`,key:`1oyrl4`}]]),Z=e(yn(),1),Q=_n();function ar(){let{t:e}=J(`settings`),t=U.use.velvet(),{theme:n,setThemePreference:r}=qe(),i=[{value:`system`,label:e(`themePicker.system`),icon:(0,Q.jsx)(Rn,{className:`h-4 w-4`})},{value:`light`,label:e(`themePicker.light`),icon:(0,Q.jsx)(bn,{className:`h-4 w-4`})},{value:`dark`,label:e(`themePicker.dark`),icon:(0,Q.jsx)(An,{className:`h-4 w-4`})},...t?[{value:`velvet`,label:e(`themePicker.velvet`),icon:(0,Q.jsx)(Nn,{className:`h-4 w-4`})}]:[]];return(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`themePicker.title`)}),(0,Q.jsx)(`div`,{className:`mt-2 max-w-[360px]`,children:(0,Q.jsx)(s,{ariaLabel:e(`themePicker.ariaLabel`),value:n,onChange:r,items:i})})]})}var or=Se,sr=`Please choose a different handle.`;async function cr(e,t){let{data:n,error:r,response:i}=await Fe({path:{id:e},body:{handle:t},throwOnError:!1});if(!i)return{kind:`error`,message:le(r,void 0,`Failed to save handle.`)??`Failed to save handle.`};if(i.ok&&n)return{kind:`ok`,data:n};if(i.status===409){let{message:e}=w(r,`handle`,or.taken);return{kind:`taken`,message:e}}if(i.status===400){let{code:e,message:t}=w(r,`handle`,sr);return{kind:`invalid`,code:e,message:t}}return{kind:`error`,message:le(r,i,`Failed to save handle.`)}}async function lr(e,t,n){let{data:r,error:i,response:a}=await Qe({path:{assistant_id:e},query:{handle:t},signal:n,throwOnError:!1});if(Ee(a,i,`Failed to check handle availability.`),!a.ok||!r)throw new ke(a.status,a.status===429?`Too many checks — try again in a moment.`:le(i,a,`Failed to check handle availability.`));return{available:r.available,code:r.code??null,message:r.message??null}}function ur(e){return/\d{2,}$/.test(e)}var dr=300,fr=1400;function pr({initialHandle:e,inputLabel:t,helperText:n,idleHelperText:r,checkAvailable:i,save:a,onSaved:o,saveSuccessToast:s,fieldId:c}){let{t:l}=J(),[u,d]=(0,Z.useState)(e),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(`idle`),[y,b]=(0,Z.useState)(null),x=dn(),S=(0,Z.useRef)(null),C=(0,Z.useMemo)(()=>u.trim().toLowerCase(),[u]),w=C===e.toLowerCase();(0,Z.useEffect)(()=>{if(w||C.length===0){g(!1),S.current?.abort();return}let e=new AbortController;S.current?.abort(),S.current=e,g(!0);let t=window.setTimeout(async()=>{try{let t=await i(C,e.signal);e.signal.aborted||m(t)}catch(t){e.signal.aborted||b(t instanceof Error?t.message:l(`profileCard.checkAvailabilityFailed`))}finally{e.signal.aborted||g(!1)}},dr);return()=>{window.clearTimeout(t),e.abort()}},[C,w,i,l]);let T=(()=>{if(y)return y;if(p&&!p.available){let e=p.code;return p.message??(e?or[e]:l(`profileCard.chooseDifferentHandle`))}return null})(),E=T?n:w?r??null:h?l(`profileCard.checkingAvailability`):p?.available?l(`profileCard.availableHelper`):null,D=!w&&!h&&p?.available!==!1&&_!==`saving`,O=(0,Z.useCallback)(async()=>{if(!D)return;v(`saving`),b(null);let e=await a(C);if(e.kind===`ok`){v(`saved`),o(e.data),f.success(s),window.setTimeout(()=>v(`idle`),fr);return}if(e.kind===`taken`){v(`idle`),m({available:!1,code:`taken`,message:e.message});return}if(e.kind===`invalid`){v(`idle`),m({available:!1,code:e.code,message:e.message});return}v(`error`),b(e.message),f.error(e.message)},[D,C,o,a,s]),A=(()=>{if(w&&u.length>0||u.length===0)return null;let e=h?`checking`:p?.available?`available`:p?.available===!1?`invalid`:null;return e?(0,Q.jsx)(un,{mode:`wait`,initial:!1,children:(0,Q.jsxs)(fn.span,{initial:x?!1:{opacity:0,scale:.85},animate:{opacity:1,scale:1},exit:x?void 0:{opacity:0,scale:.85},transition:{duration:.14,ease:`easeOut`},className:`flex items-center`,"aria-hidden":e!==`available`&&e!==`invalid`,children:[e===`checking`&&(0,Q.jsx)(Y,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),e===`available`&&(0,Q.jsx)(Ln,{className:`h-4 w-4 text-[var(--system-positive-strong)]`,"aria-label":l(`profileCard.available`)}),e===`invalid`&&(0,Q.jsx)(wn,{className:`h-4 w-4 text-[var(--system-negative-strong)]`,"aria-label":l(`profileCard.notAvailable`)})]},e)}):null})(),j=(()=>{switch(_){case`saving`:return(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(Y,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),l(`profileCard.saving`)]});case`saved`:return(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(Ln,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),l(`profileCard.saved`)]});default:return l(`profileCard.save`)}})();return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(k,{label:t,value:u,onChange:e=>{d(e.target.value.replace(/\s+/g,``)),m(null),b(null)},autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,maxLength:30,leftIcon:(0,Q.jsx)(`span`,{className:`select-none font-mono text-[var(--content-tertiary)]`,"aria-hidden":!0,children:`@`}),rightIcon:A,errorText:T??void 0,helperText:E??void 0,"aria-invalid":!!T,fullWidth:!0,"data-testid":`${c}-input`}),(!w||_!==`idle`)&&(0,Q.jsx)(`div`,{className:`flex justify-end`,children:(0,Q.jsx)(H,{variant:`primary`,size:`compact`,onClick:O,disabled:!D,"aria-live":`polite`,"data-testid":`${c}-save`,children:j})})]})}function mr({initial:e,onSaved:t}){let{t:n}=J(),r=ie.use.refreshSession(),i=ur(e.username)?n(`profileCard.userHandleIdleAutoGenerated`):void 0,a=(0,Z.useCallback)(async e=>await Ce({username:e}),[]),o=(0,Z.useCallback)((e,t)=>T(e,t),[]),s=(0,Z.useCallback)(e=>{t(e),r()},[t,r]);return(0,Q.jsx)(pr,{initialHandle:e.username,inputLabel:n(`profileCard.userHandleLabel`),helperText:n(`profileCard.handleHelper`),idleHelperText:i,checkAvailable:o,save:a,onSaved:s,saveSuccessToast:n(`profileCard.profileUpdated`),fieldId:`user-handle`})}function hr({assistant:e,onSaved:t}){let{t:n}=J(),r=e.handle??``,i=K({...Ae({path:{assistant_id:e.id}})}).data?.results?.[0],a=!!i&&i.subdomain.toLowerCase()===r.toLowerCase(),o=r.length===0?n(`profileCard.assistantHandleIdleEmpty`):void 0,s=(0,Z.useCallback)(async t=>await cr(e.id,t),[e.id]),c=(0,Z.useCallback)((t,n)=>lr(e.id,t,n),[e.id]);return a?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(k,{label:n(`profileCard.assistantHandleLabel`),value:r,readOnly:!0,disabled:!0,leftIcon:(0,Q.jsx)(`span`,{className:`select-none font-mono text-[var(--content-tertiary)]`,"aria-hidden":!0,children:`@`}),fullWidth:!0,"data-testid":`assistant-handle-input`}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:(0,Q.jsx)(G,{i18nKey:`profileCard.handleLocked`,components:{releaseLink:(0,Q.jsx)(gn,{to:`${D.channels}?setup=email&release=1`,className:`text-[var(--content-link)] underline hover:text-[var(--content-link-hover)]`})}})})]}):(0,Q.jsx)(pr,{initialHandle:r,inputLabel:n(`profileCard.assistantHandleLabel`),helperText:n(`profileCard.handleHelper`),idleHelperText:o,checkAvailable:c,save:s,onSaved:t,saveSuccessToast:n(`profileCard.assistantHandleUpdated`),fieldId:`assistant-handle`})}function gr(){let{t:e}=J();return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,"aria-busy":!0,"aria-live":`polite`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(tn,{className:`h-3 w-16`}),(0,Q.jsx)(tn,{className:`h-9 w-full rounded-md`}),(0,Q.jsx)(tn,{className:`h-3 w-72`})]}),(0,Q.jsx)(tn,{className:`h-9 w-full rounded-md`}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(tn,{className:`h-3 w-60`}),(0,Q.jsx)(tn,{className:`h-7 w-16 rounded-md`})]}),(0,Q.jsx)(`span`,{className:`sr-only`,children:e(`profileCard.loading`)})]})}function _r(){return(0,Q.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`})}function vr({assistant:e,showHandles:t=!0,children:n}={}){let{t:r}=J(),i=ie.use.user?.()?.email??null;return(0,Q.jsx)(X,{title:r(`profileCard.title`),subtitle:r(`profileCard.subtitle`),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[i&&(0,Q.jsx)(`div`,{className:`max-w-[420px]`,children:(0,Q.jsx)(k,{label:r(`profileCard.emailLabel`),value:i,disabled:!0,readOnly:!0})}),t&&(0,Q.jsxs)(Q.Fragment,{children:[i&&(0,Q.jsx)(_r,{}),(0,Q.jsx)(yr,{assistant:e})]}),n!=null&&(0,Q.jsxs)(Q.Fragment,{children:[(i||t)&&(0,Q.jsx)(_r,{}),n]})]})})}function yr({assistant:e}){let[t,n]=(0,Z.useState)(null),[r,i]=(0,Z.useState)(null),a=dn(),[o,s]=(0,Z.useState)(e??null);return(0,Z.useEffect)(()=>{s(e??null)},[e]),(0,Z.useEffect)(()=>{let e=!1;return ye().then(t=>{e||n(t)}).catch(t=>{e||i(t instanceof Error?t.message:`Failed to load profile.`)}),()=>{e=!0}},[]),r?(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:r}):t?(0,Q.jsxs)(fn.div,{initial:a?!1:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.22,ease:`easeOut`},className:`flex flex-col gap-6`,children:[(0,Q.jsx)(mr,{initial:t,onSaved:n}),o&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Q.jsx)(hr,{assistant:o,onSaved:s})]})]}):(0,Q.jsx)(gr,{})}var br=.5,xr={dazed:.55,bashful:.4},Sr=.224,Cr=`var(--surface-sunken)`,wr=64;function Tr(e){return xr[e]??br}function Er(e,t,n,r){let i=e?.eyeStyles.find(e=>e.id===t);if(!i||i.paths.length===0)return null;let a=o(i.paths.map(e=>vt(e.svgPath)));if(a.w<=0||a.h<=0)return null;let s=n*(r?br:Tr(t)),c=Math.min(s/a.w,s/a.h),l=n/2-(a.x+a.w/2)*c,u=n/2-(a.y+a.h/2)*c;return{paths:i.paths,transform:`matrix(${c},0,0,${c},${l},${u})`}}function Dr({components:e,eyeStyle:t,color:n,primary:r=!1,fieldColor:i,size:a=wr,className:o}){let s=(0,Z.useMemo)(()=>Er(e,t,a,r),[e,t,a,r]),c=e?.colors.find(e=>e.id===n)?.hex,l=i??c,u=a*Sr;return(0,Q.jsxs)(`svg`,{"aria-hidden":`true`,"data-testid":`app-icon-preview`,className:o,width:a,height:a,viewBox:`0 0 ${a} ${a}`,style:{display:`block`,flexShrink:0},children:[(0,Q.jsx)(`rect`,{"data-testid":`app-icon-preview-field`,width:a,height:a,rx:u,ry:u,fill:l??Cr}),s?(0,Q.jsx)(`g`,{"data-testid":`app-icon-preview-eyes`,transform:s.transform,children:s.paths.map((e,t)=>(0,Q.jsx)(`path`,{d:e.svgPath,fill:e.color},t))}):null]})}var Or={production:`#4C9B50`,staging:`#E9C91A`,dev:`#FF88C9`};d.eyeStyles.find(e=>e.id===`quirky`);var kr=`avatar-eyes-`,Ar={eyeStyle:`quirky`,color:`green`};function jr(e,t){return`${kr}${e}-${t}`}function Mr(e){if(e===null||e.kind!==`character`)return null;let t=e.traits;return v(t)?jr(t.eyeStyle,t.color):null}function Nr(e){return e!==null&&e.startsWith(kr)}function Pr(e){if(e===null||!Nr(e))return null;let t=e.slice(12),n=t.indexOf(`-`);return n<=0||n===t.length-1?null:{eyeStyle:t.slice(0,n),color:t.slice(n+1)}}function Fr(e,t){let n=Mr(e);return{target:n,availableMatch:t.supported&&n!==null&&t.available.includes(n)}}var Ir=160;function Lr(e,t,n){return t<=0?0:(e+n+t)%t}function Rr(e,t){let n=e?.findIndex(e=>e.id===t)??-1;return n>=0?n:0}function zr({open:e,onClose:t,components:n,currentIcon:r,targetIcon:i,canSyncAvatar:a,availableIcons:o,onApply:s,onReset:c}){let{t:l}=J(`settings`),u=Vt(),[d,f]=(0,Z.useState)(0),[p,m]=(0,Z.useState)(0),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(!1),y=a?Pr(i):null;(0,Z.useEffect)(()=>{if(!e)return;let t=Pr(r)??Pr(i)??Ar;f(Rr(n?.eyeStyles,t.eyeStyle)),m(Rr(n?.colors,t.color)),v(!1)},[e,n,r,i]);let b=n?.eyeStyles[d],x=n?.colors[p],S=b?.id??Ar.eyeStyle,C=x?.id??Ar.color,w=jr(S,C),T=w!==r&&o.includes(w),E=async e=>{g(!0),v(!1);try{await e()?t():v(!0)}finally{g(!1)}};return(0,Q.jsx)(R.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,Q.jsxs)(R.Content,{size:`sm`,"data-testid":`app-icon-modal`,children:[(0,Q.jsx)(R.Header,{children:(0,Q.jsx)(R.Title,{children:l(`appIcon.title`)})}),(0,Q.jsxs)(R.Body,{className:`space-y-4`,children:[(0,Q.jsx)(`div`,{className:`flex justify-center`,children:(0,Q.jsx)(`div`,{className:`rounded-2xl bg-[var(--surface-sunken)] p-6`,children:(0,Q.jsx)(Dr,{components:n,eyeStyle:S,color:C,size:Ir})})}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(Zn,{label:l(`appIcon.eyes`),value:S,onPrev:()=>f(Lr(d,n?.eyeStyles.length??0,-1)),onNext:()=>f(Lr(d,n?.eyeStyles.length??0,1))}),(0,Q.jsx)(Zn,{label:l(`appIcon.color`),value:C,colorHex:x?.hex,onPrev:()=>m(Lr(p,n?.colors.length??0,-1)),onNext:()=>m(Lr(p,n?.colors.length??0,1))})]}),y===null?null:(0,Q.jsx)(H,{type:`button`,variant:`outlined`,fullWidth:!0,disabled:h,onClick:()=>{y!==null&&(f(Rr(n?.eyeStyles,y.eyeStyle)),m(Rr(n?.colors,y.color)),v(!1))},children:l(`appIcon.matchAvatar`)}),(0,Q.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:l(u?`appIcon.androidApplyNote`:`appIcon.note`)}),_?(0,Q.jsx)(`p`,{role:`alert`,className:`text-body-small-lighter text-[color:var(--content-negative)]`,children:l(u?`appIcon.androidError`:`appIcon.error`)}):null]}),(0,Q.jsxs)(R.Footer,{children:[r===null?null:(0,Q.jsx)(H,{type:`button`,variant:`outlined`,disabled:h,onClick:()=>void E(c),children:l(`appIcon.reset`)}),(0,Q.jsx)(H,{type:`button`,variant:`primary`,disabled:h||!T,onClick:()=>void E(()=>s(w)),children:l(`appIcon.apply`)})]})]})})}var Br=`AppIcon`,Vr=pn(Br);function Hr(){return{supported:!1,current:null,available:[]}}function Ur(){return Ut()&&sn.isPluginAvailable(Br)}async function Wr(){if(!Ur())return Hr();try{let{supported:e,current:t,available:n}=await Vr.getState();return{supported:e===!0,current:typeof t==`string`?t:null,available:n??[]}}catch(e){return S(e,{context:`app_icon_get_state`,bestEffort:!0}),Hr()}}async function Gr(e){if(!Ur())return!1;try{let{ok:t,error:n}=await Vr.set({name:e});return t===!0?!0:(S(Error(n??`setAlternateIconName failed`),{context:`app_icon_set`,bestEffort:!0}),!1)}catch(e){return S(e,{context:`app_icon_set`,bestEffort:!0}),!1}}var Kr={supported:!1,current:null,available:[]};function qr(e,t){return e.supported===t.supported&&e.current===t.current&&e.available.length===t.available.length&&e.available.every((e,n)=>e===t.available[n])}var Jr=et(ln()((e,t)=>({snapshot:Kr,setSnapshot:n=>{qr(t().snapshot,n)||e({snapshot:n})}}))),Yr=[];function Xr(e){let t=Ue(),n=Vt(),r=U.use.androidAvatarAppIcon(),i=t||n&&r,{state:a}=He(e),o=Jr.use.snapshot(),s=Jr.use.setSnapshot(),c=(0,Z.useCallback)(async()=>{if(!i)return s(Kr),Kr;let e=await Wr();return s(e),e},[i,s]);(0,Z.useEffect)(()=>{c()},[c]),_t(`app.resume`,()=>{c()});let l=i&&o.supported,{target:u,availableMatch:d}=Fr(a,o),f=d&&u!==o.current,p=o.available,m=(0,Z.useCallback)(async e=>{if(!l||!p.includes(e))return!1;await Gr(e);let t=await c();return t.supported&&t.current===e},[l,p,c]),h=(0,Z.useCallback)(async()=>{if(!l)return!1;await Gr(null);let e=await c();return e.supported&&e.current===null},[l,c]);return{enabled:l,currentIcon:l?o.current:null,targetIcon:l?u:null,availableIcons:l?p:Yr,canSyncAvatar:f,apply:m,reset:h}}var Zr=[`ai.vocify-inc.vellum-assistant-ios`,`ai.vellum.assistant`],Qr={"":`production`,".staging":`staging`,".dev":`dev`};function $r(e){for(let t of Zr){if(!e.startsWith(t))continue;let n=Qr[e.slice(t.length)];if(n)return n}return null}async function ei(){try{let{App:e}=await vn(async()=>{let{App:e}=await import(`./esm-DmK6yYdC.js`);return{App:e}},__vite__mapDeps([0,1,2,3])),{id:t}=await e.getInfo();return $r(t)}catch(e){return console.debug(`[shell-environment] no native shell identity:`,e),null}}function ti(){let[e,t]=(0,Z.useState)();return(0,Z.useEffect)(()=>{let e=!0;return ei().then(n=>{e&&t(n)}),()=>{e=!1}},[]),e}var ni=32,ri={dev:{displayP3:`color(display-p3 0.9387 0.55755 0.7777)`,srgb:Or.dev},staging:{displayP3:`color(display-p3 0.89313 0.79283 0.2841)`,srgb:Or.staging}},ii={local:`dev`,dev:`dev`,staging:`staging`};function ai(){return typeof CSS>`u`||typeof CSS.supports!=`function`?!1:CSS.supports(`color`,`color(display-p3 1 1 1)`)}function oi(e){if(e)return ai()?e.displayP3:e.srgb}function si(e){if(e)return e;if(e===null)return ii.local}function ci(e,t){let n=si(e);if(!n)return;let r=ri[n];return t?r?.srgb:oi(r)}function li(){let e=Yt.use.activeAssistantId(),t=Xr(e);return t.enabled?(0,Q.jsx)(ui,{assistantId:e,sync:t}):null}function ui({assistantId:e,sync:t}){let{t:n}=J(`settings`),{components:r}=He(e),i=De(),a=ti(),o=Vt(),[s,c]=(0,Z.useState)(!1),l=r??i,u=Pr(t.currentIcon),d=u??Ar,f=u===null;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Q.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:n(`appIcon.title`)}),(0,Q.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:n(`appIcon.description`)})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3`,children:[(0,Q.jsx)(Dr,{components:l,eyeStyle:d.eyeStyle,color:d.color,primary:f,fieldColor:f?ci(a,o):void 0,size:ni}),(0,Q.jsx)(H,{variant:`outlined`,onClick:()=>c(!0),children:n(`appIcon.change`)})]})]}),(0,Q.jsx)(zr,{open:s,onClose:()=>c(!1),components:l,currentIcon:t.currentIcon,targetIcon:t.targetIcon,canSyncAvatar:t.canSyncAvatar,availableIcons:t.availableIcons,onApply:t.apply,onReset:t.reset})]})}var di=Ht({query:{hosting:`platform`}});function fi(){let{t:e}=J(`settings`),t=Ye(),n=K(di),r=n.data?.results??[];return n.isPending||r.length<2?null:(0,Q.jsx)(X,{title:e(`assistantPicker.title`),subtitle:e(`assistantPicker.subtitle`),children:(0,Q.jsx)(`div`,{className:`space-y-2`,children:r.map(n=>{let r=n.id===t;return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-lg border px-4 py-3 ${r?`border-[var(--border-focus)] bg-[var(--surface-lift)]`:`border-[var(--border-base)] bg-[var(--surface-default)]`}`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(Rn,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:n.name||e(`assistantPicker.unnamed`)}),n.status!==`active`&&(0,Q.jsx)(an,{tone:`warning`,children:n.status})]})})]}),(0,Q.jsx)(`div`,{className:`shrink-0`,children:r?(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-body-small-default text-[var(--system-positive-default)]`,children:[(0,Q.jsx)(Ln,{className:`h-4 w-4`}),e(`assistantPicker.active`)]}):(0,Q.jsx)(H,{variant:`outlined`,size:`compact`,disabled:n.status!==`active`,onClick:()=>{ee(n.id),f.success(e(`assistantPicker.switchedToast`))},children:e(`assistantPicker.switch`)})})]},n.id)})})})}var pi=[0,300,600,3600,10800,86400,259200,604800,1209600,2592e3],mi=new Set([300,600]);function hi(e,t){if(e===0)return t(`assistantSleepPolicy.neverSleep`);let n=Math.floor(e/86400),r=Math.floor(e%86400/3600);if(n>0&&r>0)return t(`assistantSleepPolicy.daysHours`,{days:n,hours:r});if(n>0)return t(`assistantSleepPolicy.days`,{days:n});if(r>0)return t(`assistantSleepPolicy.hours`,{hours:r});let i=Math.floor(e/60);return i>0?t(`assistantSleepPolicy.minutes`,{minutes:i}):t(`assistantSleepPolicy.seconds`,{seconds:e})}function gi(e,t){switch(e){case 0:return t(`assistantSleepPolicy.presetNever`);case 300:return t(`assistantSleepPolicy.preset5Min`);case 600:return t(`assistantSleepPolicy.preset10Min`);case 3600:return t(`assistantSleepPolicy.preset1Hour`);case 10800:return t(`assistantSleepPolicy.preset3Hours`);case 86400:return t(`assistantSleepPolicy.preset1Day`);case 259200:return t(`assistantSleepPolicy.preset3Days`);case 604800:return t(`assistantSleepPolicy.preset7Days`);case 1209600:return t(`assistantSleepPolicy.preset14Days`);case 2592e3:return t(`assistantSleepPolicy.preset30Days`);default:return hi(e,t)}}function _i({assistantId:e}){let{t}=J(`settings`),n=q(),r=zn.use.isNonProduction(),i=(0,Z.useMemo)(()=>pi.filter(e=>!mi.has(e)||r),[r]),{data:a,isLoading:o,isError:s}=K($t({path:{id:e}})),c=(0,Z.useMemo)(()=>a?.idle_timeout_seconds??259200,[a]),[l,u]=(0,Z.useState)(null),d=l??c,p=l!==null,m=Ct({onSuccess:()=>{f.success(t(`assistantSleepPolicy.savedToast`)),u(null),n.invalidateQueries({queryKey:Ve({path:{id:e}})})},onError:()=>{f.error(t(`assistantSleepPolicy.saveErrorToast`))}});return o?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(Y,{className:`h-4 w-4 animate-spin`}),t(`assistantSleepPolicy.loading`)]}):s?(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:t(`assistantSleepPolicy.loadError`)}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`label`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:t(`assistantSleepPolicy.idleTimeout`)}),(0,Q.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:t(`assistantSleepPolicy.idleTimeoutDescription`)}),(0,Q.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:i.map(e=>(0,Q.jsx)(H,{variant:`outlined`,active:d===e,onClick:()=>u(e),children:gi(e,t)},e))}),(0,Q.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:t(`assistantSleepPolicy.current`,{duration:hi(d,t)})})]}),p&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(H,{variant:`primary`,leftIcon:m.isPending?(0,Q.jsx)(Y,{className:`animate-spin`}):void 0,onClick:()=>m.mutate({path:{id:e},body:{idle_timeout_seconds:d}}),disabled:m.isPending,children:t(`assistantSleepPolicy.save`)}),(0,Q.jsx)(H,{variant:`outlined`,onClick:()=>u(null),disabled:m.isPending,children:t(`assistantSleepPolicy.cancel`)})]})]})}function vi(e,t,n){let r=[e.version];return e.version===n&&r.push(W(`settings:assistantUpgrades.latestSuffix`)),t&&e.version===t&&r.push(W(`settings:assistantUpgrades.currentSuffix`)),r.join(` `)}var yi=3e3;function bi({version:e,assistantId:t}){let{onTap:n,message:r}=qn(t);return(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`button`,{type:`button`,className:`block min-w-0 break-all text-left text-body-medium-lighter text-[var(--content-default)]`,onClick:n,children:e??`—`}),r&&(0,Q.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-accent)]`,children:r})]})}function xi({assistantId:e,currentVersion:t,releaseChannel:n,onUpgradeComplete:r}){let{t:i}=J(`settings`),a=bt.use.rollbackEnabled(),o=U.use.previewChannel(),s=q(),l=_(n,o),u=l===`preview`,[d,p]=(0,Z.useState)(!1),h=(0,Z.useRef)(null),[g,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(null),T=e=>e&&h.current&&e===h.current?(queueMicrotask(()=>{w(i(x?`assistantUpgrades.successRolledBack`:`assistantUpgrades.successUpdated`,{version:h.current})),p(!1),h.current=null,v(null),f.success(i(x?`assistantUpgrades.toastRollbackComplete`:`assistantUpgrades.toastUpdateComplete`),{id:`runtime-upgrade-complete`,tone:`strong`}),r?.()}),!1):yi;K({...Le({path:{id:e}}),refetchInterval:d?e=>T(e.state.data?.current_release_version):!1});let{data:E,isLoading:D}=K(ft({query:{channel:l}})),O=E?.find(e=>e.is_stable!==!1)??E?.[0],k=g??O?.version??null,A=(0,Z.useMemo)(()=>{if(!a||!k||!t)return!1;let e=Ie(k),n=Ie(t);return!e||!n?!1:nt(e,n)<0},[a,k,t]),j=(0,Z.useMemo)(()=>{if(!k)return!1;if(!t)return!0;let e=Ie(k),n=Ie(t);if(!e||!n)return k!==t;let r=nt(e,n);return a?r!==0:r>0},[a,k,t]),M=cn({mutationFn:async t=>{let{data:n}=await c({path:{id:e},body:t,throwOnError:!0});return n}}),N=cn({mutationFn:async t=>{let{data:n}=await Kt({path:{id:e},body:t,throwOnError:!0});return n}}),P=async()=>{b(!1),w(null);let t=a?k??void 0:void 0;try{if(A){let e=await N.mutateAsync({version:t});h.current=e.version??t??null,f.success(e.detail||i(`assistantUpgrades.toastRollbackInitiated`,{version:t}))}else{let e=await M.mutateAsync({version:t});if(e.detail?.includes(`Already on the latest`)){f.warning(e.detail);return}h.current=e.version??t??null,f.success(e.detail||i(`assistantUpgrades.toastUpdateInitiated`,{version:e.version??t??i(`assistantUpgrades.latest`)}))}S(A),p(!0),s.invalidateQueries({queryKey:qt({path:{id:e}})})}catch{f.error(i(A?`assistantUpgrades.toastRollbackFailed`:`assistantUpgrades.toastUpdateFailed`))}},F=i(u?`assistantUpgrades.previewRelease`:j?A?`assistantUpgrades.rollbackTo`:`assistantUpgrades.updateTo`:`assistantUpgrades.selected`);return(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:i(`assistantUpgrades.current`)}),(0,Q.jsx)(bi,{version:t,assistantId:e})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:F}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 md:flex-row md:items-center md:gap-4`,children:[(0,Q.jsx)(`span`,{className:`block min-w-0 flex-1`,children:D?(0,Q.jsxs)(`span`,{className:`flex items-center gap-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(Y,{className:`h-3 w-3 animate-spin`}),i(`assistantUpgrades.loading`)]}):E&&E.length>0?a?(0,Q.jsx)(Qt,{value:k??``,onChange:e=>v(e===O?.version?null:e),disabled:d||M.isPending||N.isPending,options:E.map(e=>({value:e.version,label:vi(e,t,O?.version)}))}):(0,Q.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:O?vi(O,t,O.version):`—`}):i(`assistantUpgrades.noReleases`)}),(0,Q.jsx)(H,{variant:A?`outlined`:`primary`,className:`min-w-[160px] shrink-0`,leftIcon:M.isPending||N.isPending||d?(0,Q.jsx)(Y,{className:`animate-spin`}):(0,Q.jsx)(Fn,{}),onClick:()=>b(!0),disabled:!j||M.isPending||N.isPending||d||D||!E?.length,children:i(d?x?`assistantUpgrades.rollingBack`:`assistantUpgrades.updating`:A?`assistantUpgrades.rollback`:u?`assistantUpgrades.updatePreview`:`assistantUpgrades.update`)})]})]})]}),u&&(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:(0,Q.jsx)(G,{ns:`settings`,i18nKey:`assistantUpgrades.usingPreviewReleases`,components:{stableLink:(0,Q.jsx)(`a`,{href:`#preview-release-channel`,className:`text-[var(--primary-base)] underline-offset-2 hover:underline`})}})}),!j&&t&&k&&!D&&(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:C??i(`assistantUpgrades.alreadyOnVersion`)}),(0,Q.jsx)(m,{open:y,title:i(A?`assistantUpgrades.confirmRollbackTitle`:u?`assistantUpgrades.confirmPreviewTitle`:`assistantUpgrades.confirmUpdateTitle`),message:A?i(`assistantUpgrades.confirmRollbackMessage`,{version:k??i(`assistantUpgrades.unknown`)}):i(u?`assistantUpgrades.confirmPreviewMessage`:`assistantUpgrades.confirmUpdateMessage`,{version:k??i(`assistantUpgrades.latest`)}),confirmLabel:i(A?`assistantUpgrades.rollback`:u?`assistantUpgrades.updatePreview`:`assistantUpgrades.update`),onConfirm:P,onCancel:()=>b(!1)})]})}function Si({assistantId:e,currentVersion:t,onUpgradeComplete:n}){let{t:r}=J(`settings`),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),{data:c,isLoading:l}=K(ft({query:{stable:!0,limit:100}})),u=(0,Z.useMemo)(()=>se(c),[c]),d=u?.version,p=t?O(t,d):!!d,h=P({assistantId:e,targetVersion:d});return(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:r(`assistantUpgrades.current`)}),(0,Q.jsx)(bi,{version:t,assistantId:e})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:r(`assistantUpgrades.updateTo`)}),(0,Q.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:l?r(`assistantUpgrades.loading`):d&&u?vi(u,t,d):r(`assistantUpgrades.noReleases`)})]})]}),(0,Q.jsx)(H,{variant:`primary`,className:`min-w-[160px]`,leftIcon:h.isPending?(0,Q.jsx)(Y,{className:`animate-spin`}):(0,Q.jsx)(Fn,{}),onClick:()=>a(!0),disabled:h.isPending||l||!d||!p,children:h.isPending?r(`assistantUpgrades.updating`):d?r(`assistantUpgrades.updateToVersion`,{version:d}):r(`assistantUpgrades.update`)}),o&&(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:o}),!o&&!p&&d&&!l&&(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:r(`assistantUpgrades.alreadyOnVersion`)}),(0,Q.jsx)(m,{open:i,title:r(`assistantUpgrades.confirmUpdateTitle`),message:r(`assistantUpgrades.confirmUpdateMessage`,{version:d??r(`assistantUpgrades.latest`)}),confirmLabel:r(`assistantUpgrades.update`),onConfirm:async()=>{a(!1),s(null);try{s(r(`assistantUpgrades.successUpdated`,{version:(await h.upgrade()).version??d??r(`assistantUpgrades.latest`)})),f.success(r(`assistantUpgrades.toastUpdateComplete`),{id:`runtime-upgrade-complete`,tone:`strong`}),n?.()}catch(e){f.error(e instanceof Error?e.message:r(`assistantUpgrades.toastUpdateFailed`))}},onCancel:()=>a(!1)})]})}function Ci(){let{t:e}=J(`settings`),t=_e({platformHostedOnly:!0}),n=Zt(),r=ie.use.user()?.id??null,i=ie.use.logout(),[a,o]=(0,Z.useState)(!1),s=Et({onSuccess:async()=>{f.success(e(`deleteAccountSection.toastRequested`)),pe(r),await i(),y(D.account.login)},onError:()=>{f.error(e(`deleteAccountSection.toastFailed`))}}),c=t===`full`&&n;return(0,Z.useEffect)(()=>{c&&a&&o(!1)},[c,a]),t===`gated`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`deleteAccountSection.title`)}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`deleteAccountSection.description`)}),(0,Q.jsx)(`div`,{className:`mt-1`,children:t===`disabled`?(0,Q.jsx)(V,{children:e(`deleteAccountSection.platformLoginNotice`)}):(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(H,{variant:`dangerOutline`,onClick:()=>o(!0),disabled:s.isPending||c,className:`self-start`,children:e(`deleteAccountSection.deleteMyAccount`)}),c&&(0,Q.jsx)(Y,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`})]})})]}),(0,Q.jsx)(m,{open:a,title:e(`deleteAccountSection.confirmTitle`),message:e(`deleteAccountSection.confirmMessage`),confirmLabel:e(`deleteAccountSection.confirmLabel`),destructive:!0,onConfirm:()=>{if(c){o(!1);return}o(!1),s.mutate({})},onCancel:()=>o(!1)})]})}function wi({title:e,subtitle:t,benefits:n,ctaLabel:r,ctaLeftIcon:i,onAction:a}){return(0,Q.jsx)(X,{title:e,subtitle:t,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`ul`,{className:`space-y-3`,children:n.map(({icon:e,text:t})=>(0,Q.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md`,style:{background:`var(--surface-base)`},children:(0,Q.jsx)(e,{size:14,style:{color:`var(--content-secondary)`},"aria-hidden":!0})}),(0,Q.jsx)(`span`,{className:`text-body-medium-lighter text-[color:var(--content-secondary)]`,children:t})]},t))}),(0,Q.jsx)(H,{variant:`primary`,size:`regular`,leftIcon:i,onClick:a,className:`self-start`,children:r})]})})}function Ti({promotion:e}){let{t}=J(`settings`),{appName:n,target:r}=e;return(0,Z.useEffect)(()=>{St(`settings`,r)},[r]),(0,Q.jsx)(wi,{title:n===null?t(`nativeAppCard.titleGeneric`):t(`nativeAppCard.title`,{appName:n}),subtitle:n===null?t(`nativeAppCard.subtitleGeneric`):t(`nativeAppCard.subtitle`,{appName:n}),benefits:[{icon:xn,text:t(`nativeAppCard.benefitPush`)},{icon:nr,text:t(`nativeAppCard.benefitBiometric`)},{icon:ir,text:t(`nativeAppCard.benefitHaptics`)},{icon:In,text:t(`nativeAppCard.benefitHomeScreen`)}],ctaLabel:t(`nativeAppCard.download`),ctaLeftIcon:(0,Q.jsx)(In,{size:16}),onAction:()=>{We(`click`,`settings`,r),F(r),i(r)}})}function Ei(){let e=Be(),t=dt(),n=zt(),r=jt();return!e&&!t&&!n&&!r?null:(0,Q.jsx)(Ti,{promotion:mt(e||t?`ios`:n?`android`:null)})}var Di=`0.10.0`;function Oi(){return Pt(Di)}var ki=`/v1/remote-web/pairing-challenge`,Ai=`/v1/remote-web/pairing-verification`,ji=`/v1/remote-web/pairing-requests`,Mi=`${ji}/approve`,Ni=`${ji}/deny`;function Pi(){return W(`settings:pairDeviceClient.connectivityHint`)}var Fi=class extends Error{hint;status;code;constructor(e,t={}){super(e),this.name=`PairDeviceError`,this.hint=t.hint,this.status=t.status,this.code=t.code}},Ii=5e3;function Li(){if(typeof window>`u`)return null;let e=x(),t=p(e);return t?{base:`${window.location.origin}${t}`,assistantName:e?.name?.trim()||null,ingressUrl:e?.ingressUrl?.trim()||null}:null}function Ri(e){let t=e?.error?.message;return typeof t==`string`&&t.trim()?t:null}function zi(e){let t=e?.error?.code;return typeof t==`string`&&t?t:void 0}async function Bi(e,t,n,r){let i;try{i=await fetch(e,{...t,signal:n})}catch(e){throw j(e)?e:new Fi(W(`settings:pairDeviceClient.networkError`))}let a=await i.json().catch(()=>null);if(!i.ok)throw new Fi(Ri(a)??W(`settings:pairDeviceClient.httpError`,{status:i.status}),{hint:r,status:i.status,code:zi(a)});if(typeof a!=`object`||!a)throw new Fi(W(`settings:pairDeviceClient.unexpectedResponse`));return a}function Vi(e,t,n,r){return Bi(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)},n,r)}async function Hi(e){let{base:t,publicBaseUrl:n,signal:r}=e,i=await Vi(`${t}${ki}`,{publicBaseUrl:n},r,Pi());try{await Vi(`${t}${Ai}`,{userCode:i.userCode},r,Pi())}catch(e){let n=AbortSignal.timeout(Ii);throw j(e)?Ui(t,i.userCode,n):await Ui(t,i.userCode,r?AbortSignal.any([r,n]):n),e}return{pairUrl:Mt(i),expiresAt:i.expiresAt}}async function Ui(e,t,n){try{let r=(await Wi({base:e,signal:n})).find(e=>e.userCode===t);r&&await qi({base:e,requestId:r.requestId,signal:n})}catch(e){if(j(e))return;S(e,{context:`pair-device-orphan-cleanup`,bestEffort:!0})}}async function Wi(e){let t=await Bi(`${e.base}${ji}`,{method:`GET`},e.signal);return Array.isArray(t.requests)?t.requests:[]}async function Gi(e,t){await Vi(`${t.base}${e}`,{requestId:t.requestId},t.signal)}function Ki(e){return Gi(Mi,e)}function qi(e){return Gi(Ni,e)}var Ji=Object.defineProperty,Yi=Object.getOwnPropertySymbols,Xi=Object.prototype.hasOwnProperty,Zi=Object.prototype.propertyIsEnumerable,Qi=(e,t,n)=>t in e?Ji(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$i=(e,t)=>{for(var n in t||={})Xi.call(t,n)&&Qi(e,n,t[n]);if(Yi)for(var n of Yi(t))Zi.call(t,n)&&Qi(e,n,t[n]);return e},ea=(e,t)=>{var n={};for(var r in e)Xi.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Yi)for(var r of Yi(e))t.indexOf(r)<0&&Zi.call(e,r)&&(n[r]=e[r]);return n},ta;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(ta||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(ta||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(ta||={});var na=ta,ra={L:na.QrCode.Ecc.LOW,M:na.QrCode.Ecc.MEDIUM,Q:na.QrCode.Ecc.QUARTILE,H:na.QrCode.Ecc.HIGH},ia=128,aa=`L`,oa=`#FFFFFF`,sa=`#000000`,ca=!1,la=1,ua=4,da=0,fa=.1;function pa(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function ma(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function ha(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*fa),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function ga(e,t){return t==null?e?ua:da:Math.max(Math.floor(t),0)}function _a({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=Z.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...na.QrSegment.makeSegments(t)),e),[]);return na.QrCode.encodeSegments(r,ra[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=Z.useMemo(()=>{let e=c.getModules(),t=ga(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:ha(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var va=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),ya=Z.forwardRef(function(e,t){let n=e,{value:r,size:i=ia,level:a=aa,bgColor:o=oa,fgColor:s=sa,includeMargin:c=ca,minVersion:l=la,boostLevel:u,marginSize:d,imageSettings:f}=n,p=ea(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=ea(p,[`style`]),g=f?.src,_=Z.useRef(null),v=Z.useRef(null),y=Z.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=Z.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=_a({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});Z.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=ma(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,va?t.fill(new Path2D(pa(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),Z.useEffect(()=>{x(!1)},[g]);let E=$i({height:i,width:i},m),D=null;return g!=null&&(D=Z.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),Z.createElement(Z.Fragment,null,Z.createElement(`canvas`,$i({style:E,height:i,width:i,ref:y,role:`img`},h)),D)});ya.displayName=`QRCodeCanvas`;var ba=Z.forwardRef(function(e,t){let n=e,{value:r,size:i=ia,level:a=aa,bgColor:o=oa,fgColor:s=sa,includeMargin:c=ca,minVersion:l=la,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=ea(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=_a({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=ma(g,v.excavation)),b=Z.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=pa(y,h);return Z.createElement(`svg`,$i({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&Z.createElement(`title`,null,d),Z.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),Z.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});ba.displayName=`QRCodeSVG`;function xa(e,t){return!Number.isFinite(t)||t<=0?e(`pairDeviceReady.singleUse`):e(`pairDeviceReady.expiresIn`,{time:Gn(t)})}function Sa({pairUrl:e,remainingMs:t,expired:n,copied:r,onCopy:i}){let{t:a}=J(`settings`);return n?(0,Q.jsx)(z,{tone:`warning`,title:a(`pairDeviceReady.expiredTitle`),children:a(`pairDeviceReady.expiredBody`)}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`div`,{className:`w-fit rounded-lg bg-white p-3`,children:(0,Q.jsx)(ba,{value:e,size:192,level:`M`,title:a(`pairDeviceReady.qrTitle`)})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`code`,{"data-testid":`pair-device-url`,className:`min-w-0 flex-1 truncate rounded-md bg-[var(--surface-active)] px-2.5 py-1.5 text-body-small-default text-[var(--content-secondary)]`,children:e}),(0,Q.jsx)(H,{variant:`outlined`,size:`compact`,leftIcon:r?(0,Q.jsx)(Ln,{}):(0,Q.jsx)(Mn,{}),onClick:()=>i(e),children:a(r?`pairDeviceReady.copiedButton`:`pairDeviceReady.copyButton`)})]}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:xa(a,t)})]})}function Ca(e){return/iPhone|iPod/.test(e)?`iPhone`:/iPad/.test(e)||/Macintosh/.test(e)&&/Mobile/.test(e)?`iPad`:/Android/.test(e)?`Android`:/Macintosh|Mac OS X/.test(e)?`macOS`:/Windows/.test(e)?`Windows`:/CrOS/.test(e)?`ChromeOS`:/Linux/.test(e)?`Linux`:null}function wa(e){return/Edg\/|EdgA\/|EdgiOS\//.test(e)?`Edge`:/OPR\/|OPiOS\//.test(e)?`Opera`:/Firefox\/|FxiOS\//.test(e)?`Firefox`:/Chrome\/|CriOS\//.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:null}function Ta(e){if(!e||e.trim()===``)return null;let t=Ca(e),n=wa(e);return t===null&&n===null?null:{browser:n,os:t}}var Ea=5e3,Da=6e4;function Oa({pollWhilePairing:e=!1,revalidateKey:t,isExpanded:n=!1}={}){let[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),d=(0,Z.useRef)(!0),f=(0,Z.useRef)(0);(0,Z.useEffect)(()=>(d.current=!0,()=>{d.current=!1}),[]);let p=(0,Z.useCallback)((e=x()?.assistantId)=>{if(!e)return;i(t=>t&&t.assistantId!==e?null:t);let t=++f.current;wt(e).then(n=>{!d.current||t!==f.current||i(n.ok?{assistantId:e,devices:n.devices}:null)})},[]),m=Yt.use.selectedAssistantId()??x()?.assistantId;(0,Z.useEffect)(()=>{o(null),u(null),p(m)},[m,p]);let h=(0,Z.useRef)(t);(0,Z.useEffect)(()=>{t!==h.current&&(h.current=t,p(m))},[t,m,p]);let g=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{if(e&&!s){g.current=!0;let e=setInterval(()=>p(),Ea);return()=>clearInterval(e)}!e&&g.current&&(g.current=!1,p())},[e,s,p]);let _=(r?.devices.length??0)>0;(0,Z.useEffect)(()=>{if(!n||!_||e||s)return;let t=setInterval(()=>p(),Da);return()=>clearInterval(t)},[n,_,e,s,p]);let v=(0,Z.useCallback)(e=>{u(null),o(e)},[]),y=(0,Z.useCallback)(()=>{o(null),u(null)},[]),b=(0,Z.useCallback)(()=>{!r||!a||s||(c(!0),u(null),Pe(r.assistantId,a.hashedDeviceId).then(e=>{d.current&&(c(!1),e.ok?(o(null),p()):u(e.error))}))},[r,a,s,p]);return{devices:r?.devices??null,confirmTarget:a,isRevoking:s,revokeError:l,requestRevoke:v,cancelRevoke:y,confirmRevoke:b}}var ka=600*1e3,Aa=`paired-devices`;function ja(e){return e.slice(0,12)}function Ma(e,t){return t?t.charAt(0).toUpperCase()+t.slice(1):e(`pairedDevicesSection.platformUnknown`)}function Na(e,t){if(typeof t.clientReportedName==`string`&&t.clientReportedName.trim()!==``)return{name:t.clientReportedName,isRealIdentity:!0};let n=Ta(t.pairingUserAgent);if(n!==null){let{browser:t,os:r}=n;return t!==null&&r!==null?{name:e(`pairedDevicesSection.browserOnOs`,{browser:t,os:r}),isRealIdentity:!0}:{name:t??r??``,isRealIdentity:!0}}return{name:Ma(e,t.platform),isRealIdentity:!1}}function Pa(e,t){return t===null?e(`pairedDevicesSection.dateUnknown`):new Date(t).toLocaleDateString(fe())}function Fa(e,t){let n=Pa(e,t.issuedAt);return t.lastUsedAt===null?e(`pairedDevicesSection.pairedLine`,{paired:n}):Date.now()-t.lastUsedAt<=ka?e(`pairedDevicesSection.pairedActiveLine`,{paired:n}):e(`pairedDevicesSection.pairedAndUsedLine`,{paired:n,lastUsed:Qn(t.lastUsedAt)})}function Ia({pollWhilePairing:e=!1,revalidateKey:t}={}){let{t:n}=J(`settings`),[r,i]=(0,Z.useState)(!1),a=Oa({pollWhilePairing:e,revalidateKey:t,isExpanded:r}),{devices:o,confirmTarget:s}=a;$n(o?.some(e=>e.lastUsedAt!==null)??!1);let c=(0,Z.useMemo)(()=>o===null?null:[...o].sort((e,t)=>(t.lastUsedAt??0)-(e.lastUsedAt??0)),[o]);return c===null||c.length===0?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(B.Root,{type:`multiple`,value:r?[Aa]:[],onValueChange:e=>i(e.includes(Aa)),children:(0,Q.jsxs)(B.Item,{value:Aa,children:[(0,Q.jsxs)(B.Trigger,{className:`group flex w-full items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:n(`pairedDevicesSection.title`,{count:c.length})}),(0,Q.jsx)(En,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,Q.jsx)(B.Content,{children:(0,Q.jsx)(`div`,{className:`mt-3 flex flex-col gap-3`,children:c.map(e=>{let t=Na(n,e);return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1 text-body-medium-default text-[var(--content-secondary)]`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,title:t.isRealIdentity?e.hashedDeviceId:void 0,children:t.name}),!t.isRealIdentity&&(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-[var(--content-tertiary)]`,title:e.hashedDeviceId,children:ja(e.hashedDeviceId)}),e.isCurrentHost&&(0,Q.jsx)(`span`,{className:`shrink-0 text-[var(--content-tertiary)]`,children:`· ${n(`pairedDevicesSection.thisMachine`)}`})]}),(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:Fa(n,e)})]}),(0,Q.jsx)(H,{variant:`dangerOutline`,size:`compact`,className:`shrink-0`,disabled:e.isCurrentHost===!0,title:e.isCurrentHost?n(`pairedDevicesSection.hostRevokeDisabledTitle`):void 0,onClick:()=>a.requestRevoke(e),children:n(`pairedDevicesSection.revokeButton`)})]},e.hashedDeviceId)})})})]})}),(0,Q.jsx)(m,{open:s!==null,title:n(`pairedDevicesSection.confirmTitle`),message:s&&(0,Q.jsxs)(Q.Fragment,{children:[n(`pairedDevicesSection.confirmMessageNamed`,{name:Na(n,s).name,hash:ja(s.hashedDeviceId)}),a.revokeError&&(0,Q.jsx)(`span`,{className:`mt-2 block text-[var(--system-negative-strong)]`,children:a.revokeError})]}),confirmLabel:n(`pairedDevicesSection.revokeButton`),destructive:!0,isPending:a.isRevoking,onConfirm:a.confirmRevoke,onCancel:a.cancelRevoke})]})}var La=5e3;function Ra(e,t){return e.length===t.length&&t.every((t,n)=>e[n]?.requestId===t.requestId)}function za(e,t){let[n,r]=(0,Z.useState)([]),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(null),u=(0,Z.useRef)(null),d=(0,Z.useRef)(null),[f,p]=(0,Z.useState)(e);e!==f&&(p(e),r([]),a(null),s(null),l(null)),(0,Z.useEffect)(()=>()=>{d.current?.abort(),d.current=null},[e]),(0,Z.useEffect)(()=>{let t=async()=>{u.current?.abort();let t=new AbortController;u.current=t;try{let n=await Wi({base:e,signal:t.signal});if(t.signal.aborted)return;r(e=>Ra(e,n)?e:n),l(e=>e&&!e.sticky&&!n.some(t=>t.requestId===e.requestId)?null:e),s(null)}catch(e){if(t.signal.aborted)return;if(e instanceof Fi){s(e.message);return}S(e,{context:`pair-device-pending-requests-poll`}),s(W(`settings:usePendingPairingRequests.pollErrorFallback`))}};t();let n=setInterval(()=>void t(),La);return()=>{clearInterval(n),u.current?.abort()}},[e]);let m=(0,Z.useCallback)(async(n,i)=>{if(d.current)return;let o=new AbortController;d.current=o,a({requestId:n,action:i}),l(null);let s=()=>{u.current?.abort(),r(e=>e.filter(e=>e.requestId!==n))};try{if(await(i===`approve`?Ki:qi)({base:e,requestId:n,signal:o.signal}),o.signal.aborted)return;s(),i===`approve`&&t?.()}catch(e){if(o.signal.aborted)return;e instanceof Fi?i===`deny`&&e.status===409&&e.code===`ALREADY_APPROVED`?(s(),t?.(),l({requestId:n,message:W(`settings:usePendingPairingRequests.denyAlreadyApproved`),sticky:!0})):e.status===404||e.status===410?s():l({requestId:n,message:e.message}):(S(e,{context:`pair-device-pending-request-action`}),l({requestId:n,message:W(`settings:usePendingPairingRequests.actionErrorFallback`)}))}finally{d.current===o&&(d.current=null),o.signal.aborted||a(null)}},[e,t]),h=(0,Z.useCallback)(e=>m(e,`approve`),[m]),g=(0,Z.useCallback)(e=>m(e,`deny`),[m]);return{requests:n,actingOn:i,error:c?.message??o,approve:h,deny:g}}function Ba({base:e,onApproved:t}){let{t:n}=J(`settings`),{requests:r,actingOn:i,error:a,approve:o,deny:s}=za(e,t);return $n(r.length>0),r.length===0&&!a?null:(0,Q.jsxs)(`section`,{className:`flex flex-col gap-3 border-t border-[var(--border-element)] pt-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:n(`pendingPairingRequests.title`)}),(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:n(`pendingPairingRequests.instruction`)})]}),a&&(0,Q.jsx)(z,{tone:`error`,title:a}),r.length>0&&(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2`,children:r.map(e=>{let t=i!==null&&i.requestId===e.requestId?i.action:null,r=t===`approve`,a=t===`deny`;return(0,Q.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-lg border border-[var(--border-element)] p-3`,children:[(0,Q.jsx)(`code`,{className:ct(`rounded-md bg-[var(--surface-active)] text-body-small-default text-[color:var(--content-primary)]`,`w-fit px-2.5 py-1.5 text-title-medium tracking-wide text-[color:var(--content-emphasised)]`),children:e.userCode}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e.viaEdgeProxy===!1?n(`pendingPairingRequests.requestedMetaHost`,{when:Qn(e.requestedAt)}):n(`pendingPairingRequests.requestedMeta`,{when:Qn(e.requestedAt),ip:e.requesterIp})}),e.requesterUserAgent&&(0,Q.jsx)(`p`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,title:e.requesterUserAgent,children:e.requesterUserAgent})]}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(H,{variant:`primary`,size:`compact`,disabled:i!==null,"aria-busy":r||void 0,leftIcon:r?(0,Q.jsx)(Y,{className:`animate-spin`}):void 0,onClick:()=>void o(e.requestId),children:n(`pendingPairingRequests.approveButton`)}),(0,Q.jsx)(H,{variant:`dangerOutline`,size:`compact`,disabled:i!==null,"aria-busy":a||void 0,leftIcon:a?(0,Q.jsx)(Y,{className:`animate-spin`}):void 0,onClick:()=>void s(e.requestId),children:n(`pendingPairingRequests.denyButton`)})]})]},e.requestId)})})]})}function Va({onRefresh:e,isRefreshing:t,labelled:n=!1}){let{t:r}=J(`settings`),i=r(`tunnelStatusRow.refreshLabel`),a=(0,Q.jsx)(Fn,{className:t?`animate-spin`:void 0});return n?(0,Q.jsx)(H,{variant:`outlined`,size:`compact`,leftIcon:a,disabled:t,onClick:e,children:i}):(0,Q.jsx)(H,{variant:`ghost`,size:`compact`,iconOnly:a,"aria-label":i,disabled:t,onClick:e})}function Ha(e){return`publicBaseUrl`in e&&e.publicBaseUrl?e.publicBaseUrl:null}function Ua(e){return`checkedAt`in e&&e.checkedAt?e.checkedAt:null}function Wa(e,t){let n=t?.trim();return n?`vellum tunnel ${Ka(n)} --provider ${e}`:`vellum tunnel --provider ${e}`}var Ga=/^[A-Za-z0-9._-]+$/;function Ka(e){return Ga.test(e)?e:`'${e.replace(/'/g,`'\\''`)}'`}var qa={checking:`var(--content-tertiary)`,stopped:`var(--content-tertiary)`,healthy:`var(--system-positive-strong)`,unpairable:`var(--system-mid-strong)`,unreachable:`var(--system-mid-strong)`,foreign:`var(--system-negative-strong)`},Ja=`text-body-small-default text-[var(--content-tertiary)]`,Ya=`truncate ${Ja}`;function Xa({status:e,onRefresh:t,isRefreshing:n,assistantName:r=null}){let{t:i}=J(`settings`);if(e.kind===`unconfigured`||e.kind===`unavailable`)return null;let a=Ua(e),o=Ha(e),s=`provider`in e?e.provider:void 0,c=`detail`in e?e.detail:void 0;return(0,Q.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg border border-[var(--border-element)] px-3 py-2.5`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`mt-1.5 inline-block h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:qa[e.kind]}}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsx)(`p`,{className:`text-body-small-default text-[var(--content-default)]`,children:Za(e,i)}),c&&(0,Q.jsx)(`p`,{className:Ya,title:c,children:c}),s&&(0,Q.jsx)(`p`,{className:Ja,children:(0,Q.jsx)(G,{i18nKey:e.kind===`stopped`?`tunnelStatusRow.stoppedRestart`:`tunnelStatusRow.restartHint`,ns:`settings`,values:{command:Wa(s,r)},components:{code:(0,Q.jsx)(`code`,{className:ct(`rounded-md bg-[var(--surface-active)] text-body-small-default text-[color:var(--content-primary)]`,`px-1.5 py-0.5`)})}})}),o&&(0,Q.jsx)(`p`,{className:Ya,title:o,children:o}),a&&(0,Q.jsx)(`p`,{className:Ja,children:i(`tunnelStatusRow.checkedAt`,{when:Qn(a)})})]}),(0,Q.jsx)(Va,{onRefresh:t,isRefreshing:n})]})}function Za(e,t){switch(e.kind){case`checking`:return t(`tunnelStatusRow.checkingStatus`);case`stopped`:return t(`tunnelStatusRow.stoppedStatus`);case`healthy`:return t(`tunnelStatusRow.healthyStatus`);case`unpairable`:return t(`tunnelStatusRow.unpairableStatus`);case`unreachable`:return t(`tunnelStatusRow.unreachableStatus`);case`foreign`:return e.servingAssistantName?t(`tunnelStatusRow.foreignStatusNamed`,{name:e.servingAssistantName}):t(`tunnelStatusRow.foreignStatus`)}}var Qa=`vellum:pair-device:public-base-url`;function $a(e){let t=e?.trim();if(t)return{url:t,source:`tunnel`};let n=Wt(Qa,``).trim();return n?{url:n,source:`stored`}:{url:``,source:`none`}}function eo(e,t){let n=(0,Z.useMemo)(()=>$a(t),[t]),[r,i]=(0,Z.useState)(null),o=r??n.url,[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)({kind:`idle`}),[d,f]=(0,Z.useState)(()=>Date.now()),p=(0,Z.useRef)(null);(0,Z.useEffect)(()=>()=>p.current?.abort(),[]),(0,Z.useEffect)(()=>{if(l.kind!==`ready`)return;f(Date.now());let e=setInterval(()=>f(Date.now()),1e3);return()=>clearInterval(e)},[l]);let m=(0,Z.useCallback)(e=>{i(e),c(null)},[]),h=(0,Z.useCallback)(()=>{if(!e)return;let t=o.trim(),n=Gt(t);if(!n.ok){c(a(n.reason,t));return}c(null),p.current?.abort();let r=new AbortController;p.current=r,u({kind:`minting`}),(async()=>{try{let t=await Hi({base:e,publicBaseUrl:n.url,signal:r.signal});if(r.signal.aborted)return;pt(Qa,n.url),u({kind:`ready`,pairUrl:t.pairUrl,expiresAtMs:Date.parse(t.expiresAt)})}catch(e){if(r.signal.aborted)return;if(e instanceof Fi){u({kind:`error`,message:e.message,hint:e.hint});return}S(e,{context:`pair-device-mint`}),u({kind:`error`,message:W(`settings:usePairDevice.mintErrorFallback`)})}})()},[e,o]),g=l.kind===`ready`?Math.max(0,l.expiresAtMs-d):0,_=l.kind===`ready`&&g<=0;return{publicBaseUrl:o,setPublicBaseUrl:m,prefillSource:n.source,inputError:s,phase:l,remainingMs:g,expired:_,generate:h}}var to=`0.11.6`;function no(e){return $e(to,e)}function ro(e){let t=Ye(),n=no(t),r=re(),i=e&&n&&r,{data:a,isFetching:o,refetch:s}=K({...ut({path:{assistant_id:t}}),enabled:i,staleTime:0,refetchOnWindowFocus:!1}),c=(0,Z.useCallback)(()=>{i&&s()},[i,s]);return{status:io(a,o),isRefreshing:o,refresh:c}}function io(e,t){if(!e)return t?{kind:`checking`}:{kind:`unavailable`};let{lastTunnel:n}=e,r=e.publicBaseUrl??``,i=e.checkedAt??``,a=n?{provider:n.provider}:{};switch(e.state){case`unconfigured`:return{kind:`unconfigured`};case`stopped`:return{kind:`stopped`,...a,...n?{publicBaseUrl:n.publicBaseUrl}:{}};case`healthy`:return{kind:`healthy`,publicBaseUrl:r,checkedAt:i};case`unpairable`:case`unreachable`:return{kind:e.state,publicBaseUrl:r,checkedAt:i,...e.detail?{detail:e.detail}:{},...a};case`foreign`:return{kind:`foreign`,publicBaseUrl:r,checkedAt:i,...e.servingAssistantName?{servingAssistantName:e.servingAssistantName}:{},...a};default:return{kind:`unavailable`}}}var ao=`tailscale`,oo=`public-url`,so=new Set([`unpairable`,`unreachable`,`foreign`]),co=`vellum tunnel --help`,lo=ae(D.docs.pairADevice);function uo(){let{t:e}=J(`settings`),n=Li(),r=Oi(),i=U.use.pairedDevicesUI(),a=ro(r&&n!==null),o=a.status.kind!==`unavailable`;_t(`app.resume`,()=>{a.refresh()}),$n(Ua(a.status)!==null);let s=a.status.kind===`stopped`?null:Ha(a.status),c=eo(n?.base??null,o?s:n?.ingressUrl??null),[l,u]=(0,Z.useState)(0),[d,f]=(0,Z.useState)(!1),{copy:p,copied:m}=t({errorMessage:e(`pairDeviceCard.copyError`)});if(!n||!r)return null;let h=n.assistantName??e(`pairDeviceCard.subtitleFallbackName`),{phase:g}=c,_=g.kind===`minting`,v=g.kind===`ready`,y=c.prefillSource===`tunnel`,b=o?a.status.kind===`unconfigured`:c.prefillSource===`none`&&c.publicBaseUrl.trim()===``,x=b&&o,S=o&&so.has(a.status.kind),C=e(_?`pairDeviceCard.generateButtonMinting`:v?`pairDeviceCard.generateButtonRegenerate`:S?`pairDeviceCard.generateButtonWarned`:`pairDeviceCard.generateButton`),w=o&&s!==null,T=d||c.inputError!==null,E=(0,Q.jsx)(H,{variant:S?`outlined`:`primary`,className:`self-start`,disabled:_||c.publicBaseUrl.trim()===``,onClick:c.generate,children:C}),D=(0,Q.jsx)(k,{label:e(`pairDeviceCard.publicUrlLabel`),fullWidth:!0,placeholder:e(`pairDeviceCard.publicUrlPlaceholder`),helperText:e(y?`pairDeviceCard.publicUrlHelperTunnel`:`pairDeviceCard.publicUrlHelper`),value:c.publicBaseUrl,errorText:c.inputError??void 0,disabled:_,onChange:e=>{f(!0),c.setPublicBaseUrl(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c.generate())}});return(0,Q.jsx)(X,{title:e(`pairDeviceCard.title`),subtitle:e(`pairDeviceCard.subtitle`,{name:h}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[b&&(0,Q.jsx)(z,{tone:`info`,title:e(`pairDeviceCard.noTunnelTitle`),actions:x?(0,Q.jsx)(Va,{onRefresh:a.refresh,isRefreshing:a.isRefreshing,labelled:!0}):void 0,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`p`,{children:e(`pairDeviceCard.noTunnelWhy`,{name:h})}),(0,Q.jsx)(`code`,{className:ct(`rounded-md bg-[var(--surface-active)] text-body-small-default text-[color:var(--content-primary)]`,`w-fit max-w-full overflow-x-auto px-2.5 py-1.5`),children:Wa(ao,n.assistantName)}),(0,Q.jsx)(`p`,{children:e(`pairDeviceCard.noTunnelNext`)}),(0,Q.jsx)(`p`,{children:(0,Q.jsx)(G,{i18nKey:`pairDeviceCard.noTunnelMore`,ns:`settings`,values:{command:co},components:{code:(0,Q.jsx)(`code`,{className:ct(`rounded-md bg-[var(--surface-active)] text-body-small-default text-[color:var(--content-primary)]`,`px-1.5 py-0.5`)})}})})]})}),(0,Q.jsx)(Xa,{status:a.status,onRefresh:a.refresh,isRefreshing:a.isRefreshing,assistantName:n.assistantName}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-3`,children:w?(0,Q.jsxs)(Q.Fragment,{children:[E,(0,Q.jsx)(B.Root,{type:`single`,collapsible:!0,value:T?oo:``,onValueChange:e=>f(e===oo),children:(0,Q.jsxs)(B.Item,{value:oo,children:[(0,Q.jsxs)(B.Trigger,{className:`group flex w-full items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:e(`pairDeviceCard.publicUrlDisclosure`)}),(0,Q.jsx)(En,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,Q.jsx)(B.Content,{children:(0,Q.jsx)(`div`,{className:`mt-3`,children:D})})]})})]}):(0,Q.jsxs)(Q.Fragment,{children:[D,E]})}),g.kind===`error`&&(0,Q.jsx)(z,{tone:`error`,title:g.message,children:g.hint}),v&&(0,Q.jsx)(Sa,{pairUrl:g.pairUrl,remainingMs:c.remainingMs,expired:c.expired,copied:m,onCopy:p}),(0,Q.jsx)(Ba,{base:n.base,onApproved:()=>u(e=>e+1)}),i&&(0,Q.jsx)(Ia,{pollWhilePairing:v&&!c.expired,revalidateKey:l}),(0,Q.jsx)(`a`,{href:lo,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Bt(e,lo),className:`self-start text-body-medium-default text-[var(--content-tertiary)] underline hover:text-[var(--content-default)]`,children:e(`pairDeviceCard.learnMore`)})]})})}function fo(e){return[{scope:`global`,title:e(`shortcutsSections.globalTitle`),description:e(`shortcutsSections.globalDescription`)},{scope:`menu`,title:e(`shortcutsSections.appTitle`),description:e(`shortcutsSections.appDescription`)}]}function po({hotkey:e,recording:t,conflictLabel:n,alternateBinding:r,onStartRecording:i,onCancelRecording:a,onReset:o,onRemove:s}){let{t:c}=J(`settings`),l=e.accelerator===``,u=e.override!==null;return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-2`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`div`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e.label}),n!==null&&(0,Q.jsx)(`div`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:c(`shortcutsSections.alreadyUsedBy`,{label:n})})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[r,t?(0,Q.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:c(`shortcutsSections.recordingHint`)}):l?(0,Q.jsx)(`span`,{className:`text-body-small-default italic text-[var(--content-disabled)]`,children:c(`shortcutsSections.none`)}):(0,Q.jsx)(Ne,{accelerator:e.accelerator}),t?(0,Q.jsx)(H,{variant:`ghost`,size:`compact`,onClick:a,children:c(`shortcutsSections.cancel`)}):(0,Q.jsx)(H,{variant:`outlined`,size:`compact`,onClick:i,"aria-label":c(`shortcutsSections.recordShortcutAriaLabel`,{label:e.label}),children:c(`shortcutsSections.record`)}),(0,Q.jsx)(H,{variant:`ghost`,size:`compact`,disabled:!u,leftIcon:(0,Q.jsx)(kn,{className:`h-3.5 w-3.5`}),onClick:o,"aria-label":c(`shortcutsSections.resetShortcutAriaLabel`,{label:e.label})}),(0,Q.jsx)(H,{variant:`ghost`,size:`compact`,disabled:l,leftIcon:(0,Q.jsx)(Pn,{className:`h-3.5 w-3.5`}),onClick:s,"aria-label":c(`shortcutsSections.removeBindingAriaLabel`,{label:e.label})})]})]})}function mo(){let{t:e}=J(`settings`),{catalog:t,recordingKey:n,conflict:r,startRecording:i,stopRecording:a,resetHotkey:o,removeHotkey:s}=tr(),c=(0,Z.useMemo)(()=>fo(e).map(e=>({...e,commands:t.filter(t=>t.rebindable&&t.scope===e.scope)})).filter(e=>e.commands.length>0),[t,e]);return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[r!==null&&(0,Q.jsxs)(z,{tone:`warning`,children:[e(`shortcutsSections.conflictNoticePrefix`,{label:r.label}),` `,e(n===null?`shortcutsSections.conflictResetHint`:`shortcutsSections.conflictRecordingHint`)]}),c.map(e=>(0,Q.jsxs)(we,{bordered:!0,children:[(0,Q.jsxs)(`div`,{className:`mb-2`,children:[(0,Q.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e.title}),(0,Q.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:e.commands.map(e=>(0,Q.jsx)(po,{hotkey:e,recording:n===e.key,conflictLabel:r!==null&&r.key===e.key?r.label:null,onStartRecording:()=>i(e.key),onCancelRecording:a,onReset:()=>o(e.key),onRemove:()=>s(e.key)},e.key))})]},e.scope))]})}async function ho(){if(!N())return!1;let e=window.vellum;return e?.launchAtLogin?e.launchAtLogin.get():!1}async function go(e){if(!N())return;let t=window.vellum;t?.launchAtLogin&&await t.launchAtLogin.set(e)}function _o(){let{t:e}=J(`settings`),t=de.useValue(),n=nn.useValue(),i=!Ot(),a=r();return(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`preferencesModal.composerTitle`)}),(0,Q.jsxs)(`div`,{className:`mt-2 space-y-4`,children:[i&&(0,Q.jsx)(b,{checked:t,onChange:de.save,label:e(a?`preferencesModal.sendWithCmdEnter`:`preferencesModal.sendWithCtrlEnter`),helperText:e(a?`preferencesModal.sendWithCmdEnterHelper`:`preferencesModal.sendWithCtrlEnterHelper`)}),(0,Q.jsx)(b,{checked:n,onChange:nn.save,label:e(`preferencesModal.showContextWindow`),helperText:e(`preferencesModal.showContextWindowHelper`)})]})]})}function vo(){let{t:e}=J(`settings`),[t,n]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{ho().then(n)},[]);let r=async e=>{n(e);try{await go(e)}catch{n(!e)}};return(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`preferencesModal.launchAtLoginTitle`)}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(Dt()===`windows`?`preferencesModal.launchAtLoginDescriptionWindows`:`preferencesModal.launchAtLoginDescription`)}),(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(b,{checked:t,onChange:e=>void r(e),"aria-label":e(`preferencesModal.launchAtLoginAriaLabel`)})})]})}function yo({open:e,onClose:t}){let{t:n}=J(`settings`);return(0,Q.jsx)(R.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,Q.jsxs)(R.Content,{size:`lg`,children:[(0,Q.jsxs)(R.Header,{children:[(0,Q.jsx)(R.Title,{children:n(`preferencesModal.title`)}),(0,Q.jsx)(R.Description,{children:n(`preferencesModal.description`)})]}),(0,Q.jsx)(R.Body,{children:(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[N()&&(0,Q.jsxs)(`section`,{children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:n(`preferencesModal.keyboardShortcutsTitle`)}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:n(`preferencesModal.keyboardShortcutsDescription`)}),(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(mo,{})})]}),(0,Q.jsx)(_o,{}),N()&&(0,Q.jsx)(vo,{})]})})]})})}function bo(e){return e===`preview`?`preview`:`stable`}function xo(e,t){if(!e)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:n.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function So(e){return e.filter(e=>e.ready_to_use)}function Co(e){return e?.feature_enabled===!1}function wo({assistantId:e,onComplete:t}){let{t:n}=J(`settings`),r=U.use.previewChannel(),i=q(),[a,o]=(0,Z.useState)(),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),[d,p]=(0,Z.useState)(`restore_backup`),[m,h]=(0,Z.useState)(``),g=at({path:{assistant_id:e}}),_=rt({path:{assistant_id:e}}),v=qt({path:{id:e}}),{data:y,isLoading:b,isError:x}=K({...g,enabled:r,retry:!1}),S=(0,Z.useMemo)(()=>So(y?.preview_backups??[]),[y?.preview_backups]),C=S[0],w=S.find(e=>e.snapshot_name===m)??C,T=()=>{i.invalidateQueries({queryKey:_}),i.invalidateQueries({queryKey:v}),t?.()},E=cn(Ft()),D=cn(Tt()),O=bo(y?.current_channel),k=E.isPending||D.isPending,A=k||Co(y)||!y?.latest_preview_release,j=d===`restore_backup`&&!w;if((0,Z.useEffect)(()=>{o(O===`preview`?`release-channel`:void 0)},[O]),!r)return null;let M=y?.standard_upgrade_available??!1;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(B.Root,{type:`single`,collapsible:!0,value:a,onValueChange:e=>o(e||void 0),className:`mt-5 border-t border-[var(--border-base)] pt-5`,children:(0,Q.jsxs)(B.Item,{value:`release-channel`,id:`preview-release-channel`,children:[(0,Q.jsxs)(B.Trigger,{className:`group justify-between gap-3`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:n(`previewReleaseChannel.title`)}),y&&(0,Q.jsx)(an,{tone:O===`preview`?`warning`:`neutral`,children:n(O===`preview`?`previewReleaseChannel.preview`:`previewReleaseChannel.stable`)})]}),(0,Q.jsx)(En,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,Q.jsx)(B.Content,{children:(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[b&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(Y,{className:`h-4 w-4 animate-spin`}),n(`previewReleaseChannel.loading`)]}),x&&(0,Q.jsx)(z,{tone:`error`,title:n(`previewReleaseChannel.loadErrorTitle`),children:n(`previewReleaseChannel.loadErrorBody`)}),y&&(0,Q.jsxs)(Q.Fragment,{children:[Co(y)&&(0,Q.jsx)(z,{tone:`neutral`,title:n(`previewReleaseChannel.unavailableTitle`),children:n(`previewReleaseChannel.unavailableBody`)}),O===`stable`?(0,Q.jsx)(To,{status:y,isChangingChannel:k,optInDisabled:A,onOptIn:()=>c(!0)}):(0,Q.jsx)(Eo,{status:y,isChangingChannel:k,onOptOut:()=>{let e=C;h(e?.snapshot_name??``),p(e?`restore_backup`:M?`standard_upgrade`:`restore_backup`),u(!0)}})]})]})})]})}),(0,Q.jsx)(Oo,{open:s,isPending:E.isPending,previewVersion:y?.latest_preview_release?.version,onConfirm:async()=>{try{let t=await E.mutateAsync({path:{assistant_id:e}});f.success(t.detail||n(`previewReleaseChannel.previewEnabledToast`)),c(!1),T()}catch(e){f.error(le(e,void 0,n(`previewReleaseChannel.previewEnableFailedToast`)))}},onCancel:()=>c(!1)}),(0,Q.jsx)(ko,{open:l,backups:S,mode:d,selectedSnapshotName:w?.snapshot_name??``,isPending:D.isPending,restoreModeDisabled:j,standardUpgradeAvailable:M,onModeChange:p,onSnapshotChange:h,onConfirm:async()=>{if(!j)try{let t=await D.mutateAsync({path:{assistant_id:e},body:d===`restore_backup`?{mode:`restore_backup`,snapshot_name:w?.snapshot_name}:{mode:`standard_upgrade`}});f.success(t.detail||n(`previewReleaseChannel.stableEnabledToast`)),u(!1),T()}catch(e){f.error(le(e,void 0,`Could not switch to Stable.`))}},onCancel:()=>u(!1)})]})}function To({status:e,isChangingChannel:t,optInDisabled:n,onOptIn:r}){let{t:i}=J(`settings`);return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(Do,{status:e}),!e.latest_preview_release&&(0,Q.jsx)(z,{tone:`neutral`,title:i(`previewReleaseChannel.noPreviewTitle`),children:i(`previewReleaseChannel.noPreviewBody`)}),(0,Q.jsx)(H,{variant:`outlined`,leftIcon:t?(0,Q.jsx)(Y,{className:`animate-spin`}):(0,Q.jsx)(Cn,{}),disabled:n,onClick:r,children:i(`previewReleaseChannel.optIn`)})]})}function Eo({status:e,isChangingChannel:t,onOptOut:n}){let{t:r}=J(`settings`);return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)(Do,{status:e}),(0,Q.jsx)(H,{variant:`outlined`,leftIcon:t?(0,Q.jsx)(Y,{className:`animate-spin`}):(0,Q.jsx)(kn,{}),disabled:t,onClick:n,children:r(`previewReleaseChannel.switchBack`)})]})}function Do({status:e}){let{t}=J(`settings`);return(0,Q.jsxs)(`dl`,{className:`grid gap-3 text-body-medium-lighter sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:t(`previewReleaseChannel.latestStable`)}),(0,Q.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_stable_release?.version??t(`previewReleaseChannel.none`)})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:t(`previewReleaseChannel.latestPreview`)}),(0,Q.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_preview_release?.version??t(`previewReleaseChannel.none`)})]})]})}function Oo({open:e,isPending:t,previewVersion:n,onConfirm:r,onCancel:i}){let{t:a}=J(`settings`);return(0,Q.jsx)(R.Root,{open:e,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(R.Content,{size:`md`,hideCloseButton:t,children:[(0,Q.jsxs)(R.Header,{icon:Sn,children:[(0,Q.jsx)(R.Title,{children:a(`previewReleaseChannel.optInTitle`)}),(0,Q.jsx)(R.Description,{children:a(`previewReleaseChannel.optInDescription`)})]}),(0,Q.jsx)(R.Body,{children:(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(z,{tone:`warning`,title:a(`previewReleaseChannel.dataLossTitle`),children:a(`previewReleaseChannel.dataLossBody`)}),(0,Q.jsxs)(`ol`,{className:`list-decimal space-y-2 pl-5 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,Q.jsx)(`li`,{children:a(`previewReleaseChannel.optInStep1`)}),(0,Q.jsx)(`li`,{children:a(`previewReleaseChannel.optInStep2`,{version:n??a(`previewReleaseChannel.latest`)})}),(0,Q.jsx)(`li`,{children:a(`previewReleaseChannel.optInStep3`)})]})]})}),(0,Q.jsxs)(R.Footer,{children:[(0,Q.jsx)(H,{variant:`outlined`,disabled:t,onClick:i,children:a(`previewReleaseChannel.cancel`)}),(0,Q.jsx)(H,{variant:`primary`,disabled:t,leftIcon:t?(0,Q.jsx)(Y,{className:`animate-spin`}):(0,Q.jsx)(Cn,{}),onClick:r,children:a(t?`previewReleaseChannel.switching`:`previewReleaseChannel.takeBackupAndSwitch`)})]})]})})}function ko({open:e,backups:t,mode:n,selectedSnapshotName:r,isPending:i,restoreModeDisabled:a,standardUpgradeAvailable:o,onModeChange:s,onSnapshotChange:c,onConfirm:l,onCancel:u}){let{t:d}=J(`settings`),f=d(`previewReleaseChannel.unknownDate`);return(0,Q.jsx)(R.Root,{open:e,onOpenChange:e=>!e&&u(),children:(0,Q.jsxs)(R.Content,{size:`md`,hideCloseButton:i,children:[(0,Q.jsxs)(R.Header,{icon:Sn,children:[(0,Q.jsx)(R.Title,{children:d(`previewReleaseChannel.optOutTitle`)}),(0,Q.jsx)(R.Description,{children:d(`previewReleaseChannel.optOutDescription`)})]}),(0,Q.jsx)(R.Body,{children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(ne,{value:n,onValueChange:s,disabled:i,"aria-label":d(`previewReleaseChannel.returnMethodAriaLabel`),children:[(0,Q.jsx)(L,{value:`restore_backup`,disabled:t.length===0,label:d(`previewReleaseChannel.restoreBackupLabel`),helperText:d(`previewReleaseChannel.restoreBackupHelper`)}),(0,Q.jsx)(L,{value:`standard_upgrade`,disabled:!o,label:d(`previewReleaseChannel.standardUpgradeLabel`),helperText:d(o?`previewReleaseChannel.standardUpgradeHelper`:`previewReleaseChannel.standardUpgradeUnavailable`)})]}),n===`restore_backup`&&t.length>0&&(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-medium-default text-[var(--content-secondary)]`,children:[d(`previewReleaseChannel.safetyBackup`),(0,Q.jsx)(Qt,{value:r,onChange:c,disabled:i,options:t.map(e=>{let t=e.source_release_version?d(`previewReleaseChannel.stableBackupLabel`,{version:e.source_release_version}):e.snapshot_name;return{value:e.snapshot_name,label:d(`previewReleaseChannel.backupOptionLabel`,{name:t,date:xo(e.created_at,f)})}})})]}),n===`restore_backup`&&t.length===0&&!o&&(0,Q.jsx)(z,{tone:`error`,title:d(`previewReleaseChannel.requiresBackupTitle`),children:d(`previewReleaseChannel.requiresBackupBody`)}),n===`standard_upgrade`&&(0,Q.jsx)(z,{tone:`error`,title:d(`previewReleaseChannel.mayNotSurviveTitle`),children:d(`previewReleaseChannel.mayNotSurviveBody`)})]})}),(0,Q.jsxs)(R.Footer,{children:[(0,Q.jsx)(H,{variant:`outlined`,disabled:i,onClick:u,children:d(`previewReleaseChannel.cancel`)}),(0,Q.jsx)(H,{variant:n===`standard_upgrade`?`danger`:`primary`,disabled:i||a||n===`standard_upgrade`&&!o,leftIcon:i?(0,Q.jsx)(Y,{className:`animate-spin`}):(0,Q.jsx)(Fn,{}),onClick:l,children:d(i?`previewReleaseChannel.switching`:`previewReleaseChannel.switchToStable`)})]})]})})}function Ao(){let{t:e}=J(`settings`),t=ie.use.user(),n=(0,Z.useCallback)(e=>{Me(e),window.location.reload()},[]);if(!Oe(t))return null;let r=A(),i=Rt(),a=i.version??e(`previewUiChannel.versionUnknown`);return(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`previewUiChannel.title`)}),(0,Q.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`previewUiChannel.description`)}),(0,Q.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(i.channel===`preview`?`previewUiChannel.runningPreview`:`previewUiChannel.runningStable`,{version:a})}),r&&i.channel===`stable`&&(0,Q.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`previewUiChannel.unavailableHint`)})]}),(0,Q.jsx)(`div`,{className:`shrink-0`,children:(0,Q.jsx)(b,{checked:r,onChange:n,"aria-label":e(r?`previewUiChannel.onAriaLabel`:`previewUiChannel.offAriaLabel`)})})]})}var jo=new Set([`exceeds_machine_tier`,`exceeds_storage_tier`]);function Mo(e,t){return e&&typeof e==`object`&&!Array.isArray(e)&&`error`in e&&typeof e.error==`string`&&jo.has(e.error)?`That size isn't available on your plan.`:le(e,void 0,t)}function No({assistant:e,healthz:t,healthzLoading:n,healthzFetching:r,healthzPolling:i,refetch:a,refetchUntilResized:o}){let{t:s}=J(`settings`),c=hn(),l=K(je()),u=l.data,d=!e.is_local,p=u?.plan_id===`pro`,m=K({...It(),enabled:p}),h=e.machine_size||`small`,g=Vn(m.data?.max_machine_tier??null),_=(0,Z.useMemo)(()=>Wn(g,h,(0,Q.jsx)(an,{tone:`positive`,children:s(`resizeCard.current`)})),[g,h,s]),v=m.data?.selected_storage_gib??null,[y,b]=(0,Z.useState)(!1),x=g.length>0?g[g.length-1]:null,[S,C]=(0,Z.useState)(null),w=S??x??h,[T,E]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(null),A=Ge({onSuccess:(e,n)=>{f.success(s(`resizeCard.toastStarted`),{id:`assistant-resize`}),k(null),C(null),b(!1),n.body?.machine_size==null?a():o(t)},onError:e=>{k(Mo(e,s(`resizeCard.resizeFailed`)))}});if(l.isError&&u==null)return(0,Q.jsx)(X,{id:`storage-resources`,title:s(`resizeCard.title`),subtitle:s(`resizeCard.subtitle`),children:(0,Q.jsx)(z,{tone:`error`,children:s(`resizeCard.subscriptionLoadError`)})});let j=p&&g.includes(w)&&w!==h?w:null,M=p&&v!=null&&!0,N=p&&g.length>0&&Un(h)<Un(g[g.length-1]),P=A.isPending||i,F=v==null?t?.disk?.totalMb??null:v*1024,I=t?.disk&&F!=null?{value:t.disk.usedMb,max:F,caption:s(`resizeCard.usedOf`,{used:Xn(t.disk.usedMb),total:Xn(F)})}:null,ee=t?.cpu?{value:t.cpu.currentPercent,max:100,caption:`${t.cpu.currentPercent.toFixed(1)}%`}:null,L=t?.memory?{value:t.memory.currentMb,max:t.memory.maxMb,caption:s(`resizeCard.usedOf`,{used:Xn(t.memory.currentMb),total:Xn(t.memory.maxMb)})}:null,te=(0,Q.jsx)(H,{variant:`ghost`,size:`compact`,onClick:()=>E(!0),children:s(`resizeCard.resize`)}),ne=d?p?M?(0,Q.jsxs)(`button`,{type:`button`,disabled:P,onClick:()=>b(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,Q.jsx)(Dn,{className:`h-3.5 w-3.5`}),s(`resizeCard.increaseStorage`)]}):(0,Q.jsx)(H,{variant:`ghost`,size:`compact`,disabled:P,onClick:()=>b(!0),children:s(`resizeCard.resize`)}):te:null,re=d?p?N?(0,Q.jsxs)(`button`,{type:`button`,disabled:P,onClick:()=>b(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,Q.jsx)(Dn,{className:`h-3.5 w-3.5`}),s(`resizeCard.increaseSize`)]}):(0,Q.jsx)(H,{variant:`ghost`,size:`compact`,disabled:P,onClick:()=>b(!0),children:s(`resizeCard.resize`)}):te:null;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{id:`storage-resources`,title:s(`resizeCard.title`),subtitle:s(`resizeCard.subtitle`),compactAccessory:!0,accessory:(0,Q.jsx)(H,{variant:`ghost`,size:`compact`,iconOnly:r||i?(0,Q.jsx)(Y,{className:`animate-spin`}):(0,Q.jsx)(Fn,{}),tooltip:s(i?`resizeCard.applyingResize`:`resizeCard.refreshMetrics`),"aria-label":s(`resizeCard.refreshMetrics`),disabled:r||i,onClick:()=>void a()}),children:(0,Q.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-[1fr_2fr]`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,Q.jsx)(jn,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:s(`resizeCard.disk`)})]}),ne]}),(0,Q.jsxs)(`div`,{className:`mt-auto flex flex-col gap-1 pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:s(`resizeCard.storage`)}),I?(0,Q.jsx)(Kn,{value:I.value,max:I.max,caption:I.caption}):n?(0,Q.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Q.jsx)(Y,{className:`h-3 w-3 animate-spin`})}):(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:s(`resizeCard.unavailable`)})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,Q.jsx)(rr,{className:`h-3.5 w-3.5`})}),(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:s(`resizeCard.machine`)}),(0,Q.jsx)(an,{tone:`neutral`,children:Hn[h]})]}),re]}),(0,Q.jsxs)(`div`,{className:`mt-auto grid grid-cols-2 gap-3 pt-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:s(`resizeCard.cpu`)}),ee?(0,Q.jsx)(Kn,{value:ee.value,max:ee.max,caption:ee.caption}):n?(0,Q.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Q.jsx)(Y,{className:`h-3 w-3 animate-spin`})}):(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:s(`resizeCard.memory`)}),L?(0,Q.jsx)(Kn,{value:L.value,max:L.max,caption:L.caption}):n?(0,Q.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Q.jsx)(Y,{className:`h-3 w-3 animate-spin`})}):(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]})]})]})]})}),(0,Q.jsx)(R.Root,{open:T,onOpenChange:e=>{e||E(!1)},children:(0,Q.jsxs)(R.Content,{size:`sm`,children:[(0,Q.jsxs)(R.Header,{children:[(0,Q.jsx)(R.Title,{children:s(`resizeCard.upgradeTitle`)}),(0,Q.jsx)(R.Description,{children:s(`resizeCard.upgradeDescription`)})]}),(0,Q.jsxs)(R.Footer,{children:[(0,Q.jsx)(H,{variant:`ghost`,onClick:()=>E(!1),children:s(`resizeCard.cancel`)}),(0,Q.jsx)(H,{onClick:()=>{E(!1),c(D.plans)},children:s(`resizeCard.upgrade`)})]})]})}),(0,Q.jsx)(R.Root,{open:y,onOpenChange:e=>{e||(b(!1),C(null),k(null))},children:(0,Q.jsxs)(R.Content,{size:`sm`,children:[(0,Q.jsxs)(R.Header,{icon:rr,children:[(0,Q.jsx)(R.Title,{children:s(`resizeCard.modalTitle`)}),(0,Q.jsx)(R.Description,{children:s(`resizeCard.modalDescription`)})]}),(0,Q.jsx)(R.Body,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[g.length===0?(0,Q.jsx)(z,{tone:`warning`,children:s(`resizeCard.noMachineTier`)}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-secondary)]`,children:s(`resizeCard.machineSize`)}),(0,Q.jsx)(Qt,{options:_,value:w,onChange:C,"aria-label":s(`resizeCard.machineSizeAriaLabel`),"data-testid":`resize-machine-size`})]}),M?(0,Q.jsx)(z,{tone:`info`,children:s(`resizeCard.storageExpandTo`,{to:v})}):(0,Q.jsx)(z,{tone:`neutral`,children:s(`resizeCard.storageUnchanged`)}),O&&(0,Q.jsx)(z,{tone:`error`,children:O})]})}),(0,Q.jsxs)(R.Footer,{className:`items-center justify-between`,children:[(0,Q.jsx)(`span`,{className:`text-label-small-default text-[var(--content-tertiary)]`,children:(0,Q.jsx)(G,{ns:`settings`,i18nKey:`resizeCard.needMore`,components:{upgradeLink:(0,Q.jsx)(gn,{to:D.plans,className:`text-[var(--content-secondary)] underline decoration-[var(--border-element)] underline-offset-2 transition-colors hover:text-[var(--content-default)]`,onClick:()=>b(!1)})}})}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(H,{variant:`ghost`,onClick:()=>{b(!1),C(null),k(null)},children:s(`resizeCard.cancel`)}),(0,Q.jsx)(H,{disabled:j==null&&!M||P,leftIcon:P?(0,Q.jsx)(Y,{className:`animate-spin`}):void 0,onClick:()=>{k(null);let t={};j!=null&&(t.machine_size=j),M&&v!=null&&(t.storage_gib=v),A.mutate({path:{id:e.id},body:t})},children:s(O?`resizeCard.retry`:`resizeCard.apply`)})]})]})]})})]})}function Po({assistantId:e}){let{t}=J(`settings`),n=hn(),r=q(),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(H,{variant:`dangerOutline`,onClick:()=>a(!0),className:`shrink-0`,children:t(`retireAssistant.button`)}),(0,Q.jsx)(rn,{open:i,isPending:o,onConfirm:async()=>{s(!0);let t=await be(r,e);if(t.ok){a(!1),n(t.nextRoute,{replace:!0});return}f.error(t.error),s(!1),a(!1)},onCancel:()=>a(!1)})]})}var Fo=`UTC.Africa/Cairo.Africa/Johannesburg.Africa/Lagos.Africa/Nairobi.America/Anchorage.America/Argentina/Buenos_Aires.America/Bogota.America/Chicago.America/Denver.America/Halifax.America/Lima.America/Los_Angeles.America/Mexico_City.America/New_York.America/Phoenix.America/Santiago.America/Sao_Paulo.America/Toronto.America/Vancouver.Asia/Bangkok.Asia/Dubai.Asia/Hong_Kong.Asia/Jakarta.Asia/Jerusalem.Asia/Karachi.Asia/Kolkata.Asia/Kuala_Lumpur.Asia/Manila.Asia/Seoul.Asia/Shanghai.Asia/Singapore.Asia/Taipei.Asia/Tokyo.Australia/Melbourne.Australia/Perth.Australia/Sydney.Europe/Amsterdam.Europe/Athens.Europe/Berlin.Europe/Brussels.Europe/Dublin.Europe/Istanbul.Europe/Lisbon.Europe/London.Europe/Madrid.Europe/Moscow.Europe/Paris.Europe/Rome.Europe/Stockholm.Europe/Vienna.Europe/Warsaw.Europe/Zurich.Pacific/Auckland.Pacific/Honolulu`.split(`.`);function Io(){let e=Intl;if(typeof e.supportedValuesOf==`function`)try{let t=e.supportedValuesOf(`timeZone`);if(t.length>0)return[...t].sort()}catch{}return[...Fo].sort()}function Lo(e,t,n){let r=parseInt(n??`0`,10);if(r>59)return null;let i=parseInt(t??`0`,10)*60+r;return(e===`-`?-1:1)*i}function Ro(e){let t=e.split(`/`),n=(t[t.length-1]??e).replace(/_/g,` `),r=t.length>1?(t[0]??``).replace(/_/g,` `):``,i=0,a=``;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??`GMT`;a=t.startsWith(`GMT`)||t.startsWith(`UTC`)?t:`GMT ${t}`;let n=t.match(/([+-])(\d{1,2})(?::(\d{2}))?/);n&&(i=Lo(n[1],n[2],n[3])??0)}catch{return null}return{identifier:e,city:n,region:r,offsetLabel:a,offsetMinutes:i}}function zo(){return Io().map(e=>Ro(e)).filter(e=>e!==null)}function Bo(e){try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e,hour:`numeric`,minute:`2-digit`,hour12:!0}).format(new Date)}catch{return``}}function Vo(e,t){if(!e)return t;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`long`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value;if(t)return t}catch{}return e.replace(/_/g,` `)}function Ho(e){if(e===`utc`||e===`gmt`)return 0;let t=e.match(/^(?:utc|gmt)?\s*([+-])(\d{1,2})(?::?(\d{2}))?$/);if(!t)return null;let n=Lo(t[1],t[2],t[3]);return n!==null&&Math.abs(n)<=840?n:null}var Uo=200,Wo=[];function Go({value:e,onChange:t}){let{t:n}=J(`settings`),[r,i]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(!1),s=(0,Z.useMemo)(()=>a?zo():Wo,[a]),c=r.trim().toLowerCase(),l=(0,Z.useMemo)(()=>{let e=Ho(c);return(c?s.filter(t=>e===null?t.city.toLowerCase().includes(c)||t.region.toLowerCase().includes(c)||t.offsetLabel.toLowerCase().includes(c)||t.identifier.toLowerCase().includes(c):t.offsetMinutes===e):s).slice(0,Uo)},[s,c]),u=(0,Z.useMemo)(()=>l.map(e=>e.identifier),[l]),d=(0,Z.useMemo)(()=>{if(!e)return``;let t=e.split(`/`);return(t[t.length-1]??e).replace(/_/g,` `)},[e]);return(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 md:flex-row md:items-center md:justify-between md:gap-4`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:n(`timezonePicker.timezone`)}),(0,Q.jsxs)(st.Root,{className:`w-full md:max-w-[280px]`,options:u,value:e,onSelect:t,onOpenChange:e=>{if(e){o(!0);return}i(``)},autoActivateFirst:c.length>0,children:[(0,Q.jsx)(st.Input,{type:`text`,"aria-label":n(`timezonePicker.timezone`),value:r,placeholder:d||n(`timezonePicker.searchPlaceholder`),onChange:e=>i(e.target.value),fullWidth:!0}),(0,Q.jsx)(st.List,{"aria-label":n(`timezonePicker.timezonesAriaLabel`),className:`absolute left-0 right-0 top-full z-20 mt-1 max-h-[240px] rounded-md border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-lg`,emptyState:(0,Q.jsx)(`p`,{className:`px-3 py-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:n(`timezonePicker.noMatches`)}),children:l.map(e=>(0,Q.jsxs)(st.Option,{value:e.identifier,className:ct(`flex w-full items-center justify-between gap-3 px-3 py-2`,`text-body-medium-lighter text-[var(--content-default)] transition-colors`,`hover:bg-[var(--surface-active)]`,`data-[active]:bg-[var(--surface-active)] aria-selected:bg-[var(--surface-active)]`),children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`truncate text-body-medium-default`,children:e.city}),e.region&&(0,Q.jsx)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.region})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(`span`,{children:Bo(e.identifier)}),(0,Q.jsx)(`span`,{children:e.offsetLabel})]})]},e.identifier))})]})]}),(0,Q.jsx)(er,{}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:n(`timezonePicker.zoneName`)}),(0,Q.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:Vo(e,n(`timezonePicker.notSet`))})]})]})}function Ko(){let{t:e}=J(`settings`),t=Yt.use.activeAssistantId(),[n,r]=(0,Z.useState)(()=>xe(`timezone`,``)),i=(0,Z.useRef)(t);(0,Z.useEffect)(()=>{i.current=t},[t]);let a=(0,Z.useRef)(!1),o=(0,Z.useRef)(null),s=(0,Z.useRef)(()=>{}),c=e=>{if(a.current){o.current=e;return}let t=i.current;if(!t){o.current=null;return}a.current=!0,o.current=null,I.patch({url:`/v1/assistants/{assistant_id}/config`,path:{assistant_id:t},body:{ui:{userTimezone:e}},throwOnError:!0}).catch(e=>{S(e,{context:`settings-timezone-override`})}).finally(()=>{a.current=!1;let e=o.current;o.current=null,e!==null&&s.current(e)})};return(0,Z.useEffect)(()=>{s.current=c}),(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`timezoneSection.title`)}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`timezoneSection.description`)}),(0,Q.jsx)(`div`,{className:`mt-1`,children:(0,Q.jsx)(Go,{value:n,onChange:e=>{r(e),ve(`timezone`,e),c(e)}})})]})}var qo=[0,1,2,3,4,5,6];function Jo(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),t,n));return`${i.getHours().toString().padStart(2,`0`)}:${i.getMinutes().toString().padStart(2,`0`)}`}function Yo(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),t,n);return`${i.getUTCHours().toString().padStart(2,`0`)}:${i.getUTCMinutes().toString().padStart(2,`0`)}`}function Xo(){return Intl.DateTimeFormat(void 0,{timeZoneName:`short`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??``}function Zo(e){let t=e?.schedule?.window.start??`06:00`,n=e?.schedule?.window.end??`08:00`;return{enabled:e?.enabled??!0,timezone:`UTC`,frequency:e?.schedule?.frequency??`weekly`,daysOfWeek:e?.schedule?.days_of_week??[0],daysOfMonth:e?.schedule?.days_of_month??[],windowStart:Jo(t),windowEnd:Jo(n)}}function Qo({assistantId:e}){let{t}=J(`settings`),n=q(),r=[t(`updateWindowPolicy.dayMon`),t(`updateWindowPolicy.dayTue`),t(`updateWindowPolicy.dayWed`),t(`updateWindowPolicy.dayThu`),t(`updateWindowPolicy.dayFri`),t(`updateWindowPolicy.daySat`),t(`updateWindowPolicy.daySun`)],{data:i,isLoading:a,isError:o}=K(ge({path:{id:e}})),c=(0,Z.useMemo)(()=>Zo(i),[i]),[u,d]=(0,Z.useState)(null),p=u??c,m=u!==null,h=(0,Z.useMemo)(()=>Xo(),[]),[g,_]=(0,Z.useState)(null),v=g??p.daysOfMonth.join(`, `),y=cn({mutationFn:async t=>{let{data:n}=await Xt({path:{id:e},body:t,throwOnError:!0});return n}}),x=e=>{d(t=>({...t??c,...e}))},S=e=>{x({daysOfWeek:p.daysOfWeek.includes(e)?p.daysOfWeek.filter(t=>t!==e):[...p.daysOfWeek,e].sort((e,t)=>e-t)})},C=e=>e.split(`,`).map(e=>parseInt(e.trim(),10)).filter(e=>!isNaN(e)&&e>=1&&e<=31);return a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(Y,{className:`h-4 w-4 animate-spin`}),t(`updateWindowPolicy.loading`)]}):o?(0,Q.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:t(`updateWindowPolicy.loadError`)}):(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(b,{checked:p.enabled,onChange:e=>x({enabled:e}),label:t(`updateWindowPolicy.automaticUpdates`),helperText:t(`updateWindowPolicy.automaticUpdatesHelper`)}),p.enabled&&(0,Q.jsxs)(`div`,{className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:t(`updateWindowPolicy.frequency`)}),(0,Q.jsx)(`div`,{className:`max-w-[400px]`,children:(0,Q.jsx)(s,{ariaLabel:t(`updateWindowPolicy.frequency`),value:p.frequency,onChange:e=>{e!==`monthly`&&_(null),x({frequency:e})},items:[{value:`daily`,label:t(`updateWindowPolicy.daily`)},{value:`weekly`,label:t(`updateWindowPolicy.weekly`)},{value:`monthly`,label:t(`updateWindowPolicy.monthly`)}]})})]}),p.frequency===`weekly`&&(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:t(`updateWindowPolicy.daysOfWeek`)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:qo.map(e=>(0,Q.jsx)(H,{variant:`outlined`,size:`compact`,active:p.daysOfWeek.includes(e),onClick:()=>S(e),children:r[e]},e))})]}),p.frequency===`monthly`&&(0,Q.jsx)(k,{label:t(`updateWindowPolicy.daysOfMonth`),type:`text`,value:v,onChange:e=>_(e.target.value),onBlur:e=>{let t=C(e.target.value);x({daysOfMonth:t}),_(t.join(`, `))},placeholder:t(`updateWindowPolicy.daysOfMonthPlaceholder`),helperText:t(`updateWindowPolicy.daysOfMonthHelper`),className:`w-48`}),(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:h?t(`updateWindowPolicy.updateWindowWithTz`,{tz:h}):t(`updateWindowPolicy.updateWindow`)}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(k,{type:`time`,value:p.windowStart,onChange:e=>x({windowStart:e.target.value})}),(0,Q.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:t(`updateWindowPolicy.to`)}),(0,Q.jsx)(k,{type:`time`,value:p.windowEnd,onChange:e=>x({windowEnd:e.target.value})})]})]})]}),(0,Q.jsx)(H,{variant:`primary`,leftIcon:y.isPending?(0,Q.jsx)(Y,{className:`animate-spin`}):void 0,onClick:async()=>{let r=p.frequency===`monthly`&&g!==null?C(g):p.daysOfMonth;try{await y.mutateAsync({enabled:p.enabled,timezone:`UTC`,schedule:{frequency:p.frequency,days_of_week:p.frequency===`weekly`?p.daysOfWeek:[],days_of_month:p.frequency===`monthly`?r:[],window:{start:Yo(p.windowStart),end:Yo(p.windowEnd)}}}),f.success(t(`updateWindowPolicy.toastSaved`)),d(null),_(null),n.invalidateQueries({queryKey:l({path:{id:e}})})}catch{f.error(t(`updateWindowPolicy.toastSaveFailed`))}},disabled:y.isPending||!m,children:t(`updateWindowPolicy.savePolicy`)})]})}function $o({assistantId:e,open:t,onClose:n}){let{t:r}=J(`settings`);return(0,Q.jsx)(R.Root,{open:t,onOpenChange:e=>{e||n()},children:(0,Q.jsxs)(R.Content,{size:`md`,children:[(0,Q.jsxs)(R.Header,{children:[(0,Q.jsx)(R.Title,{children:r(`updateWindowModal.title`)}),(0,Q.jsx)(R.Description,{children:r(`updateWindowModal.description`)})]}),(0,Q.jsx)(R.Body,{children:(0,Q.jsx)(Qo,{assistantId:e})})]})})}function es(e){if(typeof e==`object`&&e&&`code`in e){let t=e.code;if(typeof t==`string`)return t}}function ts({open:e,onOpenChange:t}){let{t:n}=J(`settings`),r=q(),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(null),u=(0,Z.useRef)(!1),d=(0,Z.useRef)(e),p=()=>r.invalidateQueries({queryKey:en()}),m=e=>{ht({path:{id:e}}).catch(()=>void 0).finally(()=>void p())},h=ot({onSuccess:e=>{if(!d.current){m(e.factor_id);return}a(e)},onError:e=>{let r=es(e);r===`no_workos_account`?f.error(n(`enrollTotpModal.toastNoWorkosAccount`)):r===`throttled`||r===`workos_rate_limited`?f.error(n(`enrollTotpModal.toastThrottled`)):r===`factor_limit_reached`?f.error(n(`enrollTotpModal.toastFactorLimitReached`)):f.error(n(`enrollTotpModal.toastStartFailed`)),t(!1)}}),g=Re({onSuccess:e=>{e.valid?(u.current=!0,f.success(n(`enrollTotpModal.toastEnabled`)),p(),t(!1)):l(n(`enrollTotpModal.errorCodeMismatch`))},onError:e=>{let r=es(e);if(r===`challenge_already_verified`){u.current=!0,f.success(n(`enrollTotpModal.toastEnabled`)),p(),t(!1);return}if(r===`challenge_expired`||r===`challenge_not_found`){i&&m(i.factor_id),a(null),s(``),l(n(`enrollTotpModal.errorSessionExpired`)),h.mutate({});return}if(r===`throttled`||r===`workos_rate_limited`){l(n(`enrollTotpModal.errorThrottledInline`));return}l(n(`enrollTotpModal.errorVerifyFailed`))}});(0,Z.useEffect)(()=>{d.current=e,e&&(u.current=!1,a(null),s(``),l(null),h.mutate({}))},[e]);let _=e=>{!e&&g.isPending||(!e&&i&&!u.current&&m(i.factor_id),t(e))},v=()=>{i&&Xe(i.secret,{successMessage:n(`enrollTotpModal.copySuccess`),errorMessage:n(`enrollTotpModal.copyError`)})},y=()=>{!i||o.length!==6||g.isPending||(l(null),g.mutate({body:{challenge_id:i.challenge_id,code:o}}))};return(0,Q.jsx)(R.Root,{open:e,onOpenChange:_,children:(0,Q.jsxs)(R.Content,{size:`sm`,children:[(0,Q.jsxs)(R.Header,{children:[(0,Q.jsx)(R.Title,{children:n(`enrollTotpModal.title`)}),(0,Q.jsx)(R.Description,{children:n(`enrollTotpModal.description`)})]}),(0,Q.jsx)(R.Body,{children:i===null?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,Q.jsx)(Y,{className:`h-5 w-5 animate-spin text-[var(--content-tertiary)]`})}):(0,Q.jsxs)(`form`,{className:`flex flex-col items-center gap-4`,onSubmit:e=>{e.preventDefault(),y()},children:[(0,Q.jsx)(`img`,{src:i.qr_code,alt:n(`enrollTotpModal.qrCodeAlt`),className:`h-44 w-44 rounded-lg bg-white p-2`}),(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:n(`enrollTotpModal.manualKeyHint`)}),(0,Q.jsxs)(`button`,{type:`button`,onClick:v,className:`flex cursor-pointer items-center gap-2 self-start font-mono text-body-small-default text-[var(--content-default)] hover:text-[var(--content-emphasised)]`,children:[(0,Q.jsx)(`span`,{className:`break-all text-left`,children:i.secret}),(0,Q.jsx)(Mn,{className:`h-3.5 w-3.5 shrink-0`})]})]}),(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,Q.jsx)(`label`,{htmlFor:`totp-code`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:n(`enrollTotpModal.codeLabel`)}),(0,Q.jsx)(k,{id:`totp-code`,inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:6,placeholder:n(`enrollTotpModal.codePlaceholder`),value:o,onChange:e=>s(e.target.value.replace(/\D/g,``).slice(0,6))}),c&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--system-negative-strong)]`,children:c})]})]})}),(0,Q.jsxs)(R.Footer,{children:[(0,Q.jsx)(H,{variant:`outlined`,onClick:()=>_(!1),disabled:g.isPending,children:n(`enrollTotpModal.cancel`)}),(0,Q.jsx)(H,{onClick:y,disabled:i===null||o.length!==6||g.isPending,children:g.isPending?n(`enrollTotpModal.verifying`):n(`enrollTotpModal.verify`)})]})]})})}function ns(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function rs(){let{t:e}=J(`settings`),t=q(),[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(null),o=K({...Jt()}),s=o.data??[],c=()=>t.invalidateQueries({queryKey:en()}),l=it({onSuccess:()=>{f.success(e(`twoFactorSection.toastRemoved`)),c()},onError:t=>{if(es(t)===`factor_not_found`){c();return}f.error(e(`twoFactorSection.toastRemoveFailed`))}});return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[o.isPending?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:[(0,Q.jsx)(Y,{className:`h-4 w-4 animate-spin`}),(0,Q.jsx)(`span`,{className:`text-body-medium-default`,children:e(`twoFactorSection.loading`)})]}):o.isError?(0,Q.jsx)(z,{tone:`error`,children:(0,Q.jsx)(G,{ns:`settings`,i18nKey:`twoFactorSection.loadError`,components:{retryButton:(0,Q.jsx)(`button`,{type:`button`,className:`cursor-pointer underline`,onClick:()=>void o.refetch()})}})}):s.length===0?(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`twoFactorSection.emptyDescription`)}):(0,Q.jsx)(`ul`,{className:`flex flex-col divide-y divide-[var(--border-base)]`,children:s.map(t=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(In,{className:`h-5 w-5 shrink-0 text-[var(--content-tertiary)]`}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`twoFactorSection.authenticatorApp`)}),(0,Q.jsxs)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:[t.user,t.created_at?e(`twoFactorSection.addedOn`,{date:ns(t.created_at)}):``]})]})]}),(0,Q.jsx)(H,{variant:`dangerOutline`,onClick:()=>a(t),disabled:l.isPending,children:e(`twoFactorSection.remove`)})]},t.id))}),!o.isPending&&!o.isError&&s.length===0&&(0,Q.jsx)(H,{onClick:()=>r(!0),className:`self-start`,children:e(`twoFactorSection.addAuthenticatorApp`)}),(0,Q.jsx)(ts,{open:n,onOpenChange:r}),(0,Q.jsx)(m,{open:i!==null,title:e(`twoFactorSection.removeDialogTitle`),message:e(`twoFactorSection.removeDialogMessage`),confirmLabel:e(`twoFactorSection.removeDialogConfirm`),destructive:!0,onConfirm:()=>{i&&l.mutate({path:{id:i.id}}),a(null)},onCancel:()=>a(null)})]})}var $=class extends Error{code;constructor(e,t){super(t),this.name=`TeleportError`,this.code=e}},is=`local`,as=`docker`,os=`vellum`;function ss(e){switch((e??``).toLowerCase()){case is:return`local`;case as:return`docker`;case os:return`managed`;default:return`other`}}function cs(e){let t=ss(e);return t===`managed`?`local`:t===`local`?`platform`:null}function ls(e){switch(e){case`docker`:return`teleportCard.moveToDocker`;case`platform`:return`teleportCard.moveToPlatform`;case`local`:return`teleportCard.moveToLocal`}}var us={macos:`Macos`,windows:`Windows`,linux:`Linux`};function ds(e,t=`macos`){switch(e){case`docker`:return`teleportCard.dockerDescription${us[t]}`;case`platform`:return`teleportCard.platformDescription`;case`local`:return`teleportCard.localDescription${us[t]}`}}function fs(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.reason!==`version_mismatch`)return null;let n=t.bundle_compat,r=t.target_runtime_version;if(!n||typeof n!=`object`||typeof r!=`string`)return null;let i=n,a=i.min_runtime_version;if(typeof a!=`string`)return null;let o=typeof i.max_runtime_version==`string`?i.max_runtime_version:null;return`Cannot import: bundle requires runtime ${o?`${a}–${o}`:`${a}+`}, but this local runtime is ${r}. Update your local runtime before importing.`}var ps=3600*1e3;function ms(e,t=Date.now(),n=ps){for(let r of e){if(!r)continue;let e=Date.parse(r);if(Number.isNaN(e))continue;let i=t-e;if(i>=0&&i<=n)return!0}return!1}function hs(e){return e.filter(e=>e.ready_to_use!==!1).map(e=>e.created_at)}function gs(e,t){return e.some(e=>e.snapshot_name===t&&e.ready_to_use===!0)}async function _s(e,t){let n=Number(e.headers.get(`Content-Length`)??0);if(!e.body||!t||n<=0){let n=await e.arrayBuffer();return t?.(1),n}let r=e.body.getReader(),i=[],a=0;for(;;){let{done:e,value:o}=await r.read();if(e)break;i.push(o),a+=o.length,t(a/n)}let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return t(1),o.buffer}function vs(e){let t=p(e);if(!t)throw new $(`local_assistant_not_found`,`Assistant ${e.assistantId} has no resolved local gateway.`);return`${window.location.origin}${t}`}async function ys(e,t){let n=await Ke(e.assistantId),r=await fetch(`${t}/auth/token`,{method:`POST`,headers:{Authorization:`Bearer ${n}`}});if(!r.ok)throw new $(`not_signed_in`,`Gateway token request failed (HTTP ${r.status}).`);let{token:i}=await r.json();return i}async function bs(e,t){let n=vs(e),r=await ys(e,n),i=await fetch(`${n}/v1/migrations/export`,{method:`POST`,headers:{Authorization:`Bearer ${r}`}});if(!i.ok)throw new $(`export_failed`,`Export failed (HTTP ${i.status}).`);return _s(i,t)}async function xs(e,t){let n=vs(e),r=await ys(e,n),i=await fetch(`${n}/v1/migrations/import`,{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:new Blob([t],{type:`application/octet-stream`})});if(!i.ok)throw new $(`import_failed`,`Import failed (HTTP ${i.status}).`);let a=await Ts(i);if(a&&a.success===!1)throw new $(`import_failed`,a.error??`Import reported failure`)}async function Ss(e){let t=vs(e),n=await ys(e,t),r=await fetch(`${t}/v1/backups/create`,{method:`POST`,headers:{Authorization:`Bearer ${n}`}});if(!r.ok)throw new $(`backup_failed`,W(`settings:teleportCard.backupLocalFailed`,{status:r.status}));let i=await Ts(r);if(i&&i.success===!1)throw new $(`backup_failed`,W(`settings:teleportCard.backupLocalReportedFailure`))}async function Cs(e,t){let{data:n,response:r}=await I.post({url:`/v1/assistants/{assistant_id}/migrations/export-to-gcs/`,path:{assistant_id:e},body:{upload_url:t},throwOnError:!1}),i=r?.status??0;if(!(r?.ok??!1)&&i!==202)throw new $(`export_failed`,`Export failed (HTTP ${i}).`);let a=n?.job_id;if(!a)throw new $(`export_failed`,`Export accepted but no job ID was returned.`);return a}async function ws(e,t){let{data:n,response:r}=await I.get({url:`/v1/assistants/{assistant_id}/migrations/jobs/{job_id}`,path:{assistant_id:e,job_id:t},throwOnError:!1}),i=r?.status??0;if(i>=500)return`processing`;if(!(r?.ok??!1))throw new $(`export_job_failed`,`Job status check failed (HTTP ${i})`);let a=n;if(a?.status===`failed`)throw new $(`export_job_failed`,a.error??`Export job failed`);return a?.status??`processing`}async function Ts(e){try{return await e.json()}catch{return null}}async function Es(e,t={}){let n=ss(e.cloud);if(n===`managed`)return ks(e.assistantId,t);if(n===`local`)return Ss(e);throw new $(`backup_failed`,W(`settings:teleportCard.backupUnsupported`))}async function Ds(e){let t=await At({path:{assistant_id:e},throwOnError:!1});if(!(t.response?.ok??!1))throw new $(`backup_failed`,W(`settings:teleportCard.backupListFailed`,{status:t.response?.status??0}));let n=t.data?.backups;return Array.isArray(n)?n:[]}var Os=e=>new Promise(t=>setTimeout(t,e));async function ks(e,t){if(ms(hs(await Ds(e))))return;let n=await ze({path:{assistant_id:e},throwOnError:!1});if(!(n.response?.ok??!1))throw new $(`backup_failed`,W(`settings:teleportCard.backupCreateFailed`,{status:n.response?.status??0}));let r=n.data,i=r?.snapshot_name;if(!i)throw new $(`backup_failed`,W(`settings:teleportCard.backupNoSnapshotName`));if(r?.ready_to_use===!0)return;let a=t.readyTimeoutMs??6e5,o=t.readyPollIntervalMs??5e3,s=Date.now()+a;for(;Date.now()<s;)if(await Os(o),gs(await Ds(e),i))return;throw new $(`backup_failed`,W(`settings:teleportCard.backupNotReady`,{snapshot:i,seconds:Math.round(a/1e3)}))}var As=new Set([500,502,503,504]),js=3,Ms=e=>new Promise(t=>setTimeout(t,e));async function Ns(e,t=new Set){for(let n=0;n<=js;n++){let{response:r,data:i,error:a}=await e(),o=r?.status??0;if(n<js&&As.has(o)&&!t.has(o)){await Ms(2**n*1e3);continue}return{status:o,data:i,error:a}}throw new $(`unknown`,`Unexpected retry loop exit`)}async function Ps(e,t){let n={operation:`upload`};e&&(n.min_runtime_version=e,n.max_runtime_version=null),t&&(n.consumer=t);let{status:r,data:i}=await Ns(()=>I.post({url:`/v1/migrations/signed-url/`,body:n,throwOnError:!1}),new Set([404,503]));if(r===503||r===404)throw new $(`export_failed`,`Signed URL uploads are not available — the platform may not support this feature yet.`);if(r!==201)throw new $(`export_failed`,`Migration request failed (HTTP ${r}).`);let a=i;return{url:a.url,bundleKey:a.bundle_key,expiresAt:a.expires_at}}async function Fs(e,t){let{status:n,data:r,error:i}=await Ns(()=>I.post({url:`/v1/migrations/signed-url/`,body:{operation:`download`,bundle_key:e,target_runtime_version:t},throwOnError:!1}),new Set([422]));if(n===422){let e=fs(i);if(e)throw new $(`version_mismatch`,e)}if(n!==200&&n!==201)throw new $(`import_failed`,`Migration request failed (HTTP ${n}).`);return r.url}async function Is(e,t,n){for(let r=0;r<=js;r++){let i=await Ls(e,t,n);if(r<js&&As.has(i)){await Ms(2**r*1e3),n?.(0);continue}if(i<200||i>=300)throw new $(`export_failed`,`Bundle upload failed (HTTP ${i}).`);return}}function Ls(e,t,n){return new Promise((r,i)=>{let a=new XMLHttpRequest;a.open(`PUT`,e),a.setRequestHeader(`Content-Type`,`application/octet-stream`),a.timeout=36e5,n&&(a.upload.onprogress=e=>{e.lengthComputable&&n(e.loaded/e.total)}),a.onload=()=>{n?.(1),r(a.status)},a.onerror=()=>i(new $(`export_failed`,`Bundle upload failed.`)),a.ontimeout=()=>i(new $(`export_timed_out`,`Bundle upload timed out.`)),a.send(t)})}async function Rs(e,t){for(let n=0;n<=js;n++){let r=await fetch(e,{method:`GET`});if(n<js&&As.has(r.status)){await Ms(2**n*1e3),t?.(0);continue}if(!r.ok)throw new $(`import_failed`,`Bundle download failed (HTTP ${r.status}).`);return _s(r,t)}throw new $(`import_failed`,`Unexpected retry loop exit`)}async function zs(e){let{status:t,data:n,error:r}=await Ns(()=>I.post({url:`/v1/migrations/import-from-gcs/`,body:{bundle_key:e},throwOnError:!1}));return{status:t,body:n??r??null}}async function Bs(e){let{status:t,data:n}=await Ns(()=>I.get({url:`/v1/migrations/jobs/{job_id}/`,path:{job_id:e},throwOnError:!1}));if(t!==200)throw new $(`import_failed`,`Job status check failed (HTTP ${t})`);let r=n??{};return{status:typeof r.status==`string`?r.status:`unknown`,jobId:typeof r.job_id==`string`?r.job_id:null,error:typeof r.error==`string`?r.error:null}}var Vs=5e3,Hs=36e5,Us=5*6e4,Ws=30,Gs=e=>new Promise(t=>setTimeout(t,e));function Ks(){let e=hn(),t=q(),n=x(),r=cs(n?.cloud),[i,a]=(0,Z.useState)({kind:`idle`}),[o,s]=(0,Z.useState)(!1),c=(0,Z.useRef)(null),l=(0,Z.useRef)(null),u=(0,Z.useCallback)(e=>{a({kind:`transferring`,step:e,progress:null})},[]),d=(0,Z.useCallback)(e=>{a(t=>t.kind===`transferring`?{...t,progress:e}:t)},[]),f=(0,Z.useCallback)(async()=>{if(!(!n||!r)){l.current={id:n.assistantId,kind:ss(n.cloud)===`managed`?`managed`:`local`,createdFresh:!1};try{if(u(W(`settings:teleportCard.backupStep`)),await Es(n),r===`platform`)await qs(n,u,d,c);else if(r===`local`)await Js(n,u,d,c);else throw new $(`unknown`,W(`settings:teleportCard.unsupportedDestination`));a({kind:`verifying`})}catch(e){a({kind:`failed`,error:W(`settings:teleportCard.teleportFailed`,{message:e instanceof $||e instanceof Error?e.message:W(`settings:teleportCard.teleportFailedUnknown`)})}),S(e,{context:`teleport-execute`}),await Xs(t,c.current,l.current,`teleport-execute-cleanup`),c.current=null}}},[n,r,u,d,t]),p=(0,Z.useCallback)(()=>s(!0),[]),m=(0,Z.useCallback)(()=>s(!1),[]),h=(0,Z.useCallback)(()=>{s(!1),f()},[f]),g=(0,Z.useCallback)(()=>{c.current=null,l.current=null,a({kind:`idle`})},[]);return{destination:r,phase:i,confirmOpen:o,requestTeleport:p,cancelConfirm:m,confirm:h,confirmAndSwitch:(0,Z.useCallback)(()=>{let n=c.current,r=l.current;n&&(async()=>{try{let e=ie.getState();n.kind===`managed`?await e.connectPlatformAssistant(n.id):(await e.connectLocalAssistant(n.id),Lt(n.id,{onError:e=>S(e,{context:`teleport-inject-platform-identity`})}))}catch(e){a({kind:`failed`,error:W(`settings:teleportCard.switchFailed`,{message:e instanceof Error?e.message:W(`settings:teleportCard.switchFailedUnknown`)})}),S(e,{context:`teleport-confirm-switch`});return}r&&be(t,r.id).then(e=>{e.ok||S(Error(e.error),{context:`teleport-retire-source`})}),g(),e(D.assistant,{replace:!0})})()},[e,g,t]),cancelTeleport:(0,Z.useCallback)(()=>{let e=c.current,n=l.current;c.current=null,l.current=null,a({kind:`idle`}),Xs(t,e,n,`teleport-cancel-retire-target`)},[t]),reset:g}}async function qs(e,t,r,i){t(W(`settings:teleportCard.stepExportingLocal`));let a=await bs(e,r);t(W(`settings:teleportCard.stepResolvingOrganization`));let o=await Qs();t(W(`settings:teleportCard.stepCheckingExisting`));let s=(await Nt({query:{hosting:`platform`},throwOnError:!1})).data?.results?.[0];if(s)throw new $(`existing_platform_assistant`,W(`settings:teleportCard.existingPlatformAssistant`,{id:s.id}));t(W(`settings:teleportCard.stepUploading`));let c=await Ps(e.resources?.runtimeVersion);await Is(c.url,a,r),t(W(`settings:teleportCard.stepSettingUpCloud`));let l=await n(void 0,`create`);if(!l.ok)throw new $(`import_failed`,W(`settings:teleportCard.cloudSetupFailed`));if(l.status===200)throw new $(`existing_platform_assistant`,W(`settings:teleportCard.existingPlatformAssistant`,{id:l.data.id}));let u=l.data.id;await lt({assistantId:u,name:l.data.name,cloud:`vellum`,runtimeUrl:he(),hatchedAt:l.data.created??new Date().toISOString(),organizationId:o}),await kt(e.assistantId),i.current={id:u,kind:`managed`,createdFresh:!0},t(W(`settings:teleportCard.stepFinalizingCloud`)),await $s(u),t(W(`settings:teleportCard.stepImportingToCloud`));let d=await zs(c.bundleKey);if(d.status<200||d.status>=300){let e=d.body;throw new $(`import_failed`,e?.error??W(`settings:teleportCard.importFailedHttp`,{status:d.status}))}if(d.status===202){let e=d.body?.job_id;if(!e)throw new $(`import_failed`,W(`settings:teleportCard.importNoJobId`));await ec(e)}else{let e=d.body;if(e&&e.success===!1)throw new $(`import_failed`,e.error??W(`settings:teleportCard.importReportedFailure`))}}async function Js(e,t,n,r){t(W(`settings:teleportCard.stepPreparingExport`));let i=await Ps(await Zs(e.assistantId),`runtime`);t(W(`settings:teleportCard.stepExportingCloud`));let a=await Cs(e.assistantId,i.url);await tc(e.assistantId,a),t(W(`settings:teleportCard.stepPreparingLocal`));let{assistant:o,createdFresh:s}=await nc();r.current={id:o.assistantId,kind:`local`,createdFresh:s};let c=await Ys(o,s);if(!c)throw new $(`local_assistant_not_found`,W(`settings:teleportCard.localRuntimeVersionUnknown`));t(W(`settings:teleportCard.stepPreparingImport`));let l=await Fs(i.bundleKey,c);t(W(`settings:teleportCard.stepDownloading`));let u=await Rs(l,n);t(W(`settings:teleportCard.stepImporting`)),await ic(o,u),await kt(e.assistantId)}async function Ys(e,t){if(e.resources?.runtimeVersion)return e.resources.runtimeVersion;if(t)return(await Bn())?.version??void 0}async function Xs(e,t,n,r){if(t?.createdFresh){let n=await be(e,t.id);n.ok||S(Error(n.error),{context:r})}n&&await kt(n.id)}async function Zs(e){let t=await ue(e);return t.ok?t.data.version??void 0:void 0}async function Qs(){let e=g.getState();e.organizations.length===0&&await e.fetchOrganizations();let t=g.getState().organizations,n=oe();if(n&&t.some(e=>e.id===n))return n;if(t.length===0)throw new $(`no_organizations`,W(`settings:teleportCard.noOrganizations`));if(t.length>1)throw new $(`multiple_organizations`,W(`settings:teleportCard.multipleOrganizations`));let r=t[0].id;return g.getState().setCurrentOrganizationId(r),r}async function $s(e){let t=Date.now();for(;Date.now()-t<Us;){let{data:t,response:n}=await tt({path:{id:e},throwOnError:!1});if(n?.ok&&t?.state===`active`)return;await Gs(Vs)}}async function ec(e){let t=Date.now();for(;Date.now()-t<Hs;){await Gs(Vs);let t=await Bs(e);if(t.status===`complete`)return;if(t.status===`failed`)throw new $(`import_failed`,t.error??W(`settings:teleportCard.importJobFailed`))}throw new $(`import_failed`,W(`settings:teleportCard.importTimedOut`))}async function tc(e,t){let n=Date.now();for(;Date.now()-n<Hs;)if(await Gs(Vs),await ws(e,t)===`complete`)return;throw new $(`export_timed_out`,W(`settings:teleportCard.exportTimedOut`))}async function nc(){let e=await Ze(void 0,void 0);if(!e.ok)throw new $(`local_assistant_not_found`,e.error??W(`settings:teleportCard.localCreateFailed`));await M();let t=e.assistantId?h().find(t=>t.assistantId===e.assistantId):rc();if(!t)throw new $(`local_assistant_not_found`,W(`settings:teleportCard.localNotFound`));return{assistant:t,createdFresh:!0}}function rc(){return h().slice().sort((e,t)=>(t.hatchedAt??``).localeCompare(e.hatchedAt??``))[0]}async function ic(e,t){let n;for(let r=0;r<Ws;r++)try{await xs(e,t);return}catch(e){n=e,await Gs(1e3)}throw n instanceof Error?n:new $(`import_failed`,W(`settings:teleportCard.importFailed`))}function ac(){let{t:e}=J(`settings`),t=Ks(),{destination:n,phase:r}=t,i=U.use.teleport(),a=_e();return!n||a===`gated`||r.kind===`idle`&&n===`platform`&&!i?null:(0,Q.jsxs)(X,{title:e(`teleportCard.title`),subtitle:e(`teleportCard.subtitle`),children:[r.kind===`idle`&&a===`disabled`&&(0,Q.jsx)(V,{children:e(`teleportCard.loginNotice`)}),r.kind===`idle`&&a===`full`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(ds(n,Dt()))}),(0,Q.jsx)(H,{variant:`outlined`,className:`self-start`,onClick:t.requestTeleport,children:e(ls(n))})]}),r.kind===`transferring`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r.progress==null&&(0,Q.jsx)(Y,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:r.step})]}),r.progress!=null&&(0,Q.jsx)(E,{value:r.progress,"aria-label":e(`teleportCard.progressAriaLabel`),className:`max-w-[240px]`})]}),r.kind===`verifying`&&(0,Q.jsx)(z,{tone:`success`,icon:(0,Q.jsx)(On,{className:`h-4 w-4`}),title:e(`teleportCard.verifyTitle`),actions:(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(H,{variant:`primary`,onClick:t.confirmAndSwitch,children:e(`teleportCard.confirmAndSwitch`)}),(0,Q.jsx)(H,{variant:`outlined`,onClick:t.cancelTeleport,children:e(`teleportCard.cancel`)})]})}),r.kind===`failed`&&(0,Q.jsx)(z,{tone:`error`,title:r.error,actions:(0,Q.jsx)(H,{variant:`outlined`,onClick:t.reset,children:e(`teleportCard.tryAgain`)})}),(0,Q.jsx)(m,{open:t.confirmOpen,title:e(ls(n)),message:e(`teleportCard.confirmMessage`),confirmLabel:e(`teleportCard.confirmLabel`),onConfirm:t.confirm,onCancel:t.cancelConfirm})]})}function oc(){let{t:e}=J(`settings`),{assistant:t,healthz:n,healthzLoading:r,healthzFetching:i,healthzPolling:a,refetch:o,refetchUntilResized:s}=Jn(),c=U.use.multiPlatformAssistant(),l=U.use.accountMfa(),d=bt.use.settingsSleepPolicy(),f=gt(),p=xt(),m=on()||f||Te()||p,h=hn(),g=_e(),_=_e({platformHostedOnly:!0}),v=u(),y=yt({assistantId:t?.id??null,enabled:_===`full`&&v}),[b,S]=(0,Z.useState)(!1),[w,T]=(0,Z.useState)(!1),[E,O]=mn();(0,Z.useEffect)(()=>{if(E.get(`preferences`)!==`open`)return;let e=new URLSearchParams(E);e.delete(`preferences`),O(e,{replace:!0}),T(!0)},[E,O]);let k=t?.is_local&&!on()?null:t,A=x(),j=on()&&!!t&&!!A&&me(A),M=j,P=j&&!Te(),F=_===`full`&&!!k||P&&!!t;(0,Z.useEffect)(()=>{!t||window.location.hash!==`#storage-resources`||requestAnimationFrame(()=>{document.getElementById(`storage-resources`)?.scrollIntoView({block:`start`})})},[t]);let I=n?.version??t?.current_release_version??null,ee=()=>{let e=ce();if(Te()&&!p&&e){let t=new URLSearchParams({register:C()}),n=te();n&&t.set(`name`,n);let r=new URL(e).origin;window.location.assign(`${r}${D.selectAssistant}?${t.toString()}`);return}h(`${D.selectAssistant}?noAutoSkip=1`)},L=(g===`full`||M)&&!!k||g===`disabled`&&!M,ne=_!==`gated`;return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[y.status&&y.mode!==`inactive`&&(0,Q.jsx)(Je,{status:y.status,mode:y.mode,isAcknowledging:y.isAcknowledging,acknowledgeError:y.acknowledgeError?.message??null,onAcknowledge:()=>void y.acknowledge(),onReviewWorkspaceData:()=>void h(`${D.workspace}?sort=size`),onUpgradeStorage:_===`full`?()=>void h(D.plans):null}),(0,Q.jsxs)(vr,{assistant:v?k:null,showHandles:f&&g===`full`,children:[(0,Q.jsx)(Ko,{}),l&&g!==`gated`&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`generalPage.twoFactorTitle`)}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.twoFactorDescription`)}),(0,Q.jsx)(`div`,{className:`mt-1`,children:g===`disabled`?(0,Q.jsx)(V,{children:e(`generalPage.twoFactorLoginNotice`)}):(0,Q.jsx)(rs,{})})]})]})]}),(0,Q.jsx)(X,{title:e(`generalPage.versionTitle`),subtitle:e(`generalPage.versionSubtitle`),accessory:_===`full`&&k?(0,Q.jsx)(H,{variant:`outlined`,onClick:()=>S(!0),children:e(`generalPage.updateWindow`)}):void 0,children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[_===`full`&&k&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xi,{assistantId:k.id,currentVersion:I,releaseChannel:k.release_channel,onUpgradeComplete:()=>{o()}}),(0,Q.jsx)(wo,{assistantId:k.id,onComplete:()=>{o()}})]}),P&&t&&(0,Q.jsx)(Si,{assistantId:t.id,currentVersion:I,onUpgradeComplete:()=>{o()}}),!F&&t&&(0,Q.jsxs)(`div`,{className:`grid grid-cols-[140px_minmax(0,1fr)] gap-y-3`,children:[(0,Q.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.current`)}),(0,Q.jsx)(Yn,{version:I,loading:r&&!t.current_release_version,assistantId:t.id??null})]}),_===`disabled`&&!P&&(0,Q.jsx)(V,{children:e(`generalPage.updatesLoginNotice`)}),(0,Q.jsx)(Ao,{})]})}),_===`full`&&k&&(0,Q.jsx)($o,{assistantId:k.id,open:b,onClose:()=>S(!1)}),_===`full`&&t&&(0,Q.jsx)(No,{assistant:t,healthz:n,healthzLoading:r,healthzFetching:i,healthzPolling:a,refetch:o,refetchUntilResized:s}),_===`disabled`&&(0,Q.jsx)(X,{id:`storage-resources`,title:e(`generalPage.computeResourcesTitle`),subtitle:e(`generalPage.computeResourcesSubtitle`),children:(0,Q.jsx)(V,{children:e(`generalPage.computeResourcesLoginNotice`)})}),(0,Q.jsx)(X,{title:e(`generalPage.preferencesTitle`),subtitle:e(`generalPage.preferencesSubtitle`),accessory:(0,Q.jsx)(H,{variant:`outlined`,onClick:()=>T(!0),children:e(`generalPage.customize`)}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsx)(ar,{}),(0,Q.jsx)(li,{})]})}),(0,Q.jsx)(yo,{open:w,onClose:()=>T(!1)}),(0,Q.jsx)(Ei,{}),(0,Q.jsx)(uo,{}),_===`full`&&k&&d&&(0,Q.jsx)(X,{title:e(`generalPage.sleepPolicyTitle`),subtitle:e(`generalPage.sleepPolicySubtitle`),children:(0,Q.jsx)(_i,{assistantId:k.id})}),_===`disabled`&&d&&(0,Q.jsx)(X,{title:e(`generalPage.sleepPolicyTitle`),subtitle:e(`generalPage.sleepPolicySubtitle`),children:(0,Q.jsx)(V,{children:e(`generalPage.sleepPolicyLoginNotice`)})}),c&&!m&&(0,Q.jsx)(fi,{}),m&&(0,Q.jsx)(X,{title:e(`generalPage.switchAssistantTitle`),subtitle:e(`generalPage.switchAssistantSubtitle`),accessory:(0,Q.jsx)(H,{variant:`outlined`,onClick:ee,children:e(`generalPage.chooseAssistant`)})}),N()&&(0,Q.jsx)(ac,{}),(L||ne)&&(0,Q.jsx)(X,{variant:`danger`,title:e(`generalPage.dangerZoneTitle`),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[L&&(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`generalPage.retireAssistantTitle`)}),(0,Q.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.retireAssistantDescription`)}),(0,Q.jsx)(`div`,{className:`mt-1`,children:(g===`full`||M)&&k?(0,Q.jsx)(Po,{assistantId:k.id}):(0,Q.jsx)(V,{children:e(`generalPage.retireAssistantLoginNotice`)})})]}),L&&ne&&(0,Q.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Q.jsx)(Ci,{})]})})]})}export{oc as GeneralPage};