@vellumai/web 0.12.5-staging.2 → 0.12.5-staging.3
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.
- package/dist/assets/{a2a-invite-2n6gRbID.js → a2a-invite-2DFcr5cK.js} +1 -1
- package/dist/assets/{about-page-N1N2ME9b.js → about-page-CPNBbifd.js} +1 -1
- package/dist/assets/{account-page-DOnTpuZ-.js → account-page-CJ_VtU8O.js} +1 -1
- package/dist/assets/{account-shell-CDePfCVi.js → account-shell-DxLEvbei.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-B3R4i5mk.js → acp-run-detail-panel-CB_kEsnS.js} +1 -1
- package/dist/assets/{activation-list-route-CHvtTpMz.js → activation-list-route-CGW4JxwN.js} +1 -1
- package/dist/assets/{activity-redirect-page-CTTRdkxc.js → activity-redirect-page-BIjoWTCA.js} +1 -1
- package/dist/assets/{activity-steps-panel-DR0Y2oZk.js → activity-steps-panel-DMQrQxtA.js} +1 -1
- package/dist/assets/add-credits-modal-Dv7XHwyy.js +1 -0
- package/dist/assets/{add-credits-modal-Bf3UIKWo.js → add-credits-modal-LuPOq4kF.js} +1 -1
- package/dist/assets/{ai-page-nn0k_IIb.js → ai-page-BYnMIWGK.js} +1 -1
- package/dist/assets/{all-chats-page-route-CPhckAtu.js → all-chats-page-route-nS138Vap.js} +1 -1
- package/dist/assets/{android-billing-handoff-Bdbyo5OG.js → android-billing-handoff-Q1a-ZHj3.js} +1 -1
- package/dist/assets/{animated-stat-square-C1mgqXq8.js → animated-stat-square--YG74D1T.js} +1 -1
- package/dist/assets/{api-key-screen-BRkuexDs.js → api-key-screen-CYEJaUQl.js} +1 -1
- package/dist/assets/app-Dy5YEvtr.css +2 -0
- package/dist/assets/{app-g1TvV-Dl.js → app-XG_RF2yi.js} +55 -55
- package/dist/assets/{app-info-R4Y_BPoT.js → app-info-zQFV6PZi.js} +1 -1
- package/dist/assets/{archive-redirect-page-Cb4LdH50.js → archive-redirect-page-DQbvA1Z-.js} +1 -1
- package/dist/assets/{assistant-handle-modal-BQBleuWg.js → assistant-handle-modal-CbatcZHT.js} +1 -1
- package/dist/assets/{assistant-inbox-page-route-CWQiF8gx.js → assistant-inbox-page-route-CxI0ViyX.js} +1 -1
- package/dist/assets/{assistant-inbox-upgrade-body-D3qYrXZU.js → assistant-inbox-upgrade-body-UUuOySwQ.js} +1 -1
- package/dist/assets/{assistant-status-panel-Dz8eNfbE.js → assistant-status-panel-Db_tR-He.js} +1 -1
- package/dist/assets/auth-store-CpGZaJMT.js +1 -0
- package/dist/assets/{auth-welcome-screen-CYoMdZVW.js → auth-welcome-screen-CCmw8K2q.js} +1 -1
- package/dist/assets/avatar-bundled-components-BOhrT2YY.js +1 -0
- package/dist/assets/{avatar-random-7_b8sN9c.js → avatar-random-ChM4pm8c.js} +2 -2
- package/dist/assets/{await-org-header-settled-BaNRynwI.js → await-org-header-settled-D7gXGNkp.js} +1 -1
- package/dist/assets/{background-task-detail-panel-DyQHMRcX.js → background-task-detail-panel-BfpAZAV7.js} +1 -1
- package/dist/assets/billing-page-D4Aw0uK5.js +3 -0
- package/dist/assets/{billing-redirect-page-DisLOg_5.js → billing-redirect-page-CPoe8Fxo.js} +1 -1
- package/dist/assets/{bookmarks-page-CaKBt1k4.js → bookmarks-page-DabizPXt.js} +1 -1
- package/dist/assets/{bundle-confirm-page-W2r6YW2S.js → bundle-confirm-page--s00f5SK.js} +1 -1
- package/dist/assets/{channel-transcript-panel-DjZfVDU6.js → channel-transcript-panel-kIskgOQO.js} +1 -1
- package/dist/assets/{channels-page-route-fjQyOftI.js → channels-page-route-DBYtimrU.js} +1 -1
- package/dist/assets/{chat-info-panel-CQwSB97L.js → chat-info-panel-C8-aLnsR.js} +1 -1
- package/dist/assets/{checkout-continuation-CGCnWbzu.js → checkout-continuation-DV6qqLmB.js} +1 -1
- package/dist/assets/{checkout-page-DoYMFyd4.js → checkout-page-CDszxDKy.js} +1 -1
- package/dist/assets/checkout-return-target-kOAtAdtD.js +1 -0
- package/dist/assets/{command-palette-D0KYxCnU.js → command-palette-CvSDYYKx.js} +1 -1
- package/dist/assets/{command-palette-window-page-BTVDAM95.js → command-palette-window-page-vfJ8M15E.js} +1 -1
- package/dist/assets/command-palette-xzqumNt2.js +1 -0
- package/dist/assets/{community-page--2IpZpKw.js → community-page-Dnrsh7JC.js} +1 -1
- package/dist/assets/{companion-accent-CBLb9Kpv.js → companion-accent-CbS8BVae.js} +1 -1
- package/dist/assets/{companion-dock-zones-page-DxuMrFf9.js → companion-dock-zones-page-CRsK4Pv9.js} +1 -1
- package/dist/assets/{companion-layout-C6tp_Wvl.js → companion-layout-DCGXuvsw.js} +1 -1
- package/dist/assets/{companion-popover-B7KpH4N8.js → companion-popover-BsoxqJOP.js} +1 -1
- package/dist/assets/{companion-popover-page-YQKBZlNX.js → companion-popover-page-B-tbPgw2.js} +1 -1
- package/dist/assets/{companion-surface-DM4lsh7V.js → companion-surface-Lu_Uj_QW.js} +1 -1
- package/dist/assets/{companion-surface-page-BvvOIZO_.js → companion-surface-page-Cu5KYGHm.js} +1 -1
- package/dist/assets/{companion-tour-entry-BBJtal5R.js → companion-tour-entry-C3txdrPi.js} +1 -1
- package/dist/assets/{companion-watch-frame-page-D_cml_5E.js → companion-watch-frame-page-CxWQHVyd.js} +1 -1
- package/dist/assets/{connect-page-De9qYGFr.js → connect-page-BnIPLsIl.js} +1 -1
- package/dist/assets/{consent-controls-gxLFaZqC.js → consent-controls-CzokWb_V.js} +1 -1
- package/dist/assets/{contacts-gateway-xRhaWZVq.js → contacts-gateway-CXKsci-d.js} +1 -1
- package/dist/assets/{contacts-page-route-DuAdAqXe.js → contacts-page-route-rxGvMBYc.js} +1 -1
- package/dist/assets/{copy-button-DUDzh1nb.js → copy-button-CDraE4Q7.js} +1 -1
- package/dist/assets/{credential-entry-page-DMfgwRck.js → credential-entry-page-CISniD8g.js} +1 -1
- package/dist/assets/{credentials-page-CMgmkOGd.js → credentials-page-CY8AWXDI.js} +1 -1
- package/dist/assets/{csv-preview-CQY-2Dx9.js → csv-preview-CIYuh6hO.js} +1 -1
- package/dist/assets/{danger-zone-redirect-page-yy5xW0mL.js → danger-zone-redirect-page-CvReBloK.js} +1 -1
- package/dist/assets/{debug-page-BU3-JUrT.js → debug-page-Bi_rgZ5l.js} +1 -1
- package/dist/assets/deploy-dialogs-C2piFvJp.js +1 -0
- package/dist/assets/{deploy-dialogs-Daud7Ibu.js → deploy-dialogs-HsxdyBbf.js} +1 -1
- package/dist/assets/{desktop-preview-content-Cg0mJFW9.js → desktop-preview-content-CV1cf7mU.js} +2 -2
- package/dist/assets/{desktop-status-DGbF0l_T.js → desktop-status-DEExfNSz.js} +1 -1
- package/dist/assets/{desktop-viewer-ClERTjPw.js → desktop-viewer-D7Wghl4J.js} +1 -1
- package/dist/assets/{detail-card-uV-Fvv0m.js → detail-card-C7tTQwmv.js} +1 -1
- package/dist/assets/{detail-panel-stop-button-CpIFrlAa.js → detail-panel-stop-button-DnqOX8hL.js} +1 -1
- package/dist/assets/{detail-primitives-BVAXXLTM.js → detail-primitives-wlzeidYY.js} +1 -1
- package/dist/assets/{developer-page-C2US1ngx.js → developer-page-BCRjXz1c.js} +1 -1
- package/dist/assets/{devices-redirect-page-C6LAvhsi.js → devices-redirect-page-7ye90eAr.js} +1 -1
- package/dist/assets/{dictation-overlay-page-4Ws_3jMt.js → dictation-overlay-page-DOBCTXi_.js} +1 -1
- package/dist/assets/{document-load-Bc7bzEgK.js → document-load-C2pkXMId.js} +1 -1
- package/dist/assets/document-load-D-wTWGym.js +1 -0
- package/dist/assets/{document-viewer-page-rYlc99qC.js → document-viewer-page-DOzOlaOx.js} +1 -1
- package/dist/assets/{emails-page-BoKSj0Bi.js → emails-page-BcGsKx08.js} +1 -1
- package/dist/assets/{file-diff-view-D4vpp28T.js → file-diff-view-Cl9aJla4.js} +1 -1
- package/dist/assets/{file-view-mode-CFTpeJXr.js → file-view-mode-B1UgDONH.js} +1 -1
- package/dist/assets/{general-page-CCuGQaED.js → general-page-D5BxF2Og.js} +1 -1
- package/dist/assets/{hatching-screen-DlG-aMJX.js → hatching-screen-6FiOHAnm.js} +1 -1
- package/dist/assets/{hosting-screen-COVzfBVx.js → hosting-screen-CYbWPSH7.js} +1 -1
- package/dist/assets/{identity-page-route-9SdenOmX.js → identity-page-route-B7hLB4vt.js} +1 -1
- package/dist/assets/{inspect-page-9FD0Y4Wu.js → inspect-page-Q3Uns0YC.js} +3 -3
- package/dist/assets/{integrations-page-CXrP8dj3.js → integrations-page-C--xdzQF.js} +1 -1
- package/dist/assets/{intelligence-layout-_R-R-8WX.js → intelligence-layout-5NiOjPJY.js} +1 -1
- package/dist/assets/{intelligence-layout-slots-store-DfpF-AiU.js → intelligence-layout-slots-store-DTzofJ6x.js} +1 -1
- package/dist/assets/{keyboard-shortcuts-redirect-page-CD21JSvn.js → keyboard-shortcuts-redirect-page-BXubnemT.js} +1 -1
- package/dist/assets/{latest-assistant-text-D5_fKeDo.js → latest-assistant-text-C5_QcZxG.js} +1 -1
- package/dist/assets/{library-detail-page-DG-7BXZ4.js → library-detail-page-lz31jiv2.js} +1 -1
- package/dist/assets/{library-page-DRUkvK5M.js → library-page-Cqt_PX2Z.js} +1 -1
- package/dist/assets/local-mode-BdKYdq-q.js +1 -0
- package/dist/assets/{login-page-BqaYnqWg.js → login-page-BcSmXRpH.js} +1 -1
- package/dist/assets/{logout-page-C6QRRvol.js → logout-page-BiLyA8KS.js} +1 -1
- package/dist/assets/{logs-layout-CgZTvfsn.js → logs-layout-DtEdDxuo.js} +1 -1
- package/dist/assets/{markdown-preview-CjIFQp7z.js → markdown-preview-BZ0peNgQ.js} +1 -1
- package/dist/assets/{media-preview-CQ5_mth7.js → media-preview-WLwNLylQ.js} +1 -1
- package/dist/assets/{memory-page-route-CMctq-2Y.js → memory-page-route-ULkaZxE1.js} +1 -1
- package/dist/assets/{memory-router-playground-page-dreB6wRu.js → memory-router-playground-page-BW7vZW_9.js} +1 -1
- package/dist/assets/{message-files-panel-CDRctrdn.js → message-files-panel-CjeAStji.js} +1 -1
- package/dist/assets/native-attachment-pickers-DyuoT-EL.js +1 -0
- package/dist/assets/native-file-xbQpY6mL.js +1 -0
- package/dist/assets/{notifications-page-u4JixJTc.js → notifications-page-CJRzep02.js} +1 -1
- package/dist/assets/{oauth-complete-page-C9Yh4aN1.js → oauth-complete-page-ocdI_rC8.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-T4U79Q12.js → oauth-popup-complete-page-HK8d4Spc.js} +1 -1
- package/dist/assets/paired-platform-identity-BPPyfzDM.js +1 -0
- package/dist/assets/{pairing-page-CmjjyJSK.js → pairing-page-DnBwkmV0.js} +1 -1
- package/dist/assets/password-reset-page-B6LfA1PC.js +1 -0
- package/dist/assets/{pdf-file-preview-BV59QVcL.js → pdf-file-preview-BICwIHq3.js} +1 -1
- package/dist/assets/{permission-guide-page-Zb7kuXV2.js → permission-guide-page-z6AAkvY2.js} +1 -1
- package/dist/assets/{permission-setup-D8C_-pLn.js → permission-setup-DQzKLhBn.js} +1 -1
- package/dist/assets/{personality-page-Bl2WDg64.js → personality-page-CKLYnk7H.js} +1 -1
- package/dist/assets/{personality-page-Cl6IWyFN.js → personality-page-CzJKC8lv.js} +1 -1
- package/dist/assets/{personality-sliders-CHGQlasL.js → personality-sliders-Dd3JGL5I.js} +1 -1
- package/dist/assets/{plans-page-CX_DS3pd.js → plans-page-DDs81rnq.js} +1 -1
- package/dist/assets/{platform-loopback-page-BbAZA0xo.js → platform-loopback-page-BC5gtTbI.js} +1 -1
- package/dist/assets/{plugin-detail-page-Y171rg5Z.js → plugin-detail-page-Dre4KSYH.js} +1 -1
- package/dist/assets/{plugins-page-7JFDRd3d.js → plugins-page-BJhR5JYi.js} +1 -1
- package/dist/assets/plugins-surface-B99o65kn.js +1 -0
- package/dist/assets/{preview-error-DRiLBVjC.js → preview-error-BSpmr-KH.js} +1 -1
- package/dist/assets/{privacy-page-BbzNYunu.js → privacy-page-BUf0Wrj1.js} +1 -1
- package/dist/assets/{privacy-screen-DRWTgt4o.js → privacy-screen-CRkWqj_4.js} +1 -1
- package/dist/assets/{profile-card-BUk3o7SO.js → profile-card-BDi2Aa7O.js} +1 -1
- package/dist/assets/{provider-callback-page-4eckbJpB.js → provider-callback-page-xSMG5fuv.js} +1 -1
- package/dist/assets/{provider-key-CJJJNyHJ.js → provider-key-CY2sGv7V.js} +1 -1
- package/dist/assets/{provider-signup-page-DEgiOj-f.js → provider-signup-page-CYvh6GNB.js} +1 -1
- package/dist/assets/{quick-input-page-DaqK2hi0.js → quick-input-page-Lfrb-P2b.js} +1 -1
- package/dist/assets/referral-modal--kTnJAWn.js +1 -0
- package/dist/assets/{referral-modal-IFQp20cn.js → referral-modal-Bk5N1oeX.js} +1 -1
- package/dist/assets/{research-mock-page-C9fb3mU6.js → research-mock-page-BdpSM2ZV.js} +1 -1
- package/dist/assets/{research-onboarding-route-Cm8d8gDB.js → research-onboarding-route-DLbIS8Fh.js} +1 -1
- package/dist/assets/{review-terms-screen-DMQInhYK.js → review-terms-screen-DXYmPnS3.js} +1 -1
- package/dist/assets/routes-CJexmSc5.js +1 -0
- package/dist/assets/{schedules--58e813j.js → schedules-B_xQSD0K.js} +1 -1
- package/dist/assets/{schedules-page-B6cSKNVA.js → schedules-page--mjVQq8F.js} +1 -1
- package/dist/assets/{security-redirect-page-BP_ofq6j.js → security-redirect-page-CJJqdMen.js} +1 -1
- package/dist/assets/{select-assistant-screen-BG3K7gmK.js → select-assistant-screen-CWrLBgEC.js} +1 -1
- package/dist/assets/{self-hosted-servers-BWwS6drJ.js → self-hosted-servers-ByTPcaPx.js} +1 -1
- package/dist/assets/{service-form-controls-DdqTR20W.js → service-form-controls-DtPD00wU.js} +1 -1
- package/dist/assets/{setting-row-DUPI2E5K.js → setting-row-CaZDTGD2.js} +1 -1
- package/dist/assets/settings-CF0G96O8.js +3 -0
- package/dist/assets/settings-D9aUsORh.js +3 -0
- package/dist/assets/{settings-Bxxp6jKc.js → settings-XqI4_biG.js} +1 -1
- package/dist/assets/{settings-layout-Bwhzzkgd.js → settings-layout-DNdADVFk.js} +1 -1
- package/dist/assets/{settings-B267Hpr6.js → settings-ooHvceam.js} +1 -1
- package/dist/assets/{share-feedback-modal-dOu0B-Md.js → share-feedback-modal-BcKnGtHL.js} +1 -1
- package/dist/assets/share-feedback-modal-DF6Y_Ddr.js +1 -0
- package/dist/assets/{sidebar-tree-EIcBry0H.js → sidebar-tree-BTeywUnh.js} +1 -1
- package/dist/assets/{signup-page-iMX6V56Q.js → signup-page-C3giBlX2.js} +1 -1
- package/dist/assets/{signup-shell-DE0anhe6.js → signup-shell-GSIPLhaj.js} +1 -1
- package/dist/assets/{skill-detail-page-DY4PImw4.js → skill-detail-page-Deqf_hR_.js} +1 -1
- package/dist/assets/{skill-detail-panel-C5ehfnq7.js → skill-detail-panel-Dxor1hrH.js} +1 -1
- package/dist/assets/{skill-removal-dialog-BUKv2Tas.js → skill-removal-dialog-BT--h1By.js} +1 -1
- package/dist/assets/{skills-page-D0nQMb4s.js → skills-page-KhBWpqn3.js} +1 -1
- package/dist/assets/{sounds-page-BHxwlTqF.js → sounds-page-DTRSATq6.js} +1 -1
- package/dist/assets/{start-screen-BNWpr3jU.js → start-screen-xL6YeEfA.js} +1 -1
- package/dist/assets/{step-detail-header-B4fNZIZg.js → step-detail-header-q2pswG-E.js} +1 -1
- package/dist/assets/{stt-language-picker-modal-DfBKJmLh.js → stt-language-picker-modal-oMpmGSKQ.js} +1 -1
- package/dist/assets/{subagent-detail-panel-ByW7jl3W.js → subagent-detail-panel-BbfzXdX1.js} +1 -1
- package/dist/assets/{superpowers-page-D_RuLpvG.js → superpowers-page-Bew1AAic.js} +1 -1
- package/dist/assets/{system-events-page-C7X57xA5.js → system-events-page-CyvA59Rb.js} +1 -1
- package/dist/assets/{system-events-redirect-page-CTGlRdMz.js → system-events-redirect-page-BlGZqWyR.js} +1 -1
- package/dist/assets/{teleport-gateway-client-B-Ymh7N4.js → teleport-gateway-client-ZoYt4yRw.js} +1 -1
- package/dist/assets/{text-preview-DXRIEUbr.js → text-preview-C4goqoCR.js} +1 -1
- package/dist/assets/{theme-stage-page-T1E0J2aJ.js → theme-stage-page-wBctgsW9.js} +1 -1
- package/dist/assets/{tiptap-document-editor-DqmlydKI.js → tiptap-document-editor-9k3KCMGt.js} +1 -1
- package/dist/assets/tool-detail-panel-BXJOMwEr.js +1 -0
- package/dist/assets/{tool-detail-panel-Cy_HQVT-.js → tool-detail-panel-D3kcmDuC.js} +1 -1
- package/dist/assets/{trait-cycle-row-BNqcZU0H.js → trait-cycle-row-Bj1z4vx9.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-BH0iigJ_.js → upgrade-cancel-page-B8aHpJFd.js} +1 -1
- package/dist/assets/{upgrade-success-page-CQTTbbGB.js → upgrade-success-page-Dj6egC1G.js} +1 -1
- package/dist/assets/{usage-redirect-page-4wBYE6Hz.js → usage-redirect-page-Cc7zOqgH.js} +1 -1
- package/dist/assets/{use-app-delete-BqUAzWOi.js → use-app-delete-S-DdyUwn.js} +1 -1
- package/dist/assets/{use-assistant-identity-details-DsO3-hL9.js → use-assistant-identity-details-DT3Hy4pf.js} +1 -1
- package/dist/assets/{use-checkout-dismiss-refresh-DpbPh5Dv.js → use-checkout-dismiss-refresh-DV7QRuSY.js} +1 -1
- package/dist/assets/{use-edge-swipe-back-C_dV-uDl.js → use-edge-swipe-back-BCvtCYFp.js} +1 -1
- package/dist/assets/{use-hotkey-recorder-DSplqHTv.js → use-hotkey-recorder-BIhIsp-5.js} +1 -1
- package/dist/assets/{use-invite-link-dialog-BbFm0xLB.js → use-invite-link-dialog-DQEUmYHq.js} +1 -1
- package/dist/assets/{use-plugins-list-v7ZdJF5y.js → use-plugins-list-DPWrP6Mv.js} +1 -1
- package/dist/assets/{use-return-to-short-circuit-e_HCiNdS.js → use-return-to-short-circuit-BVGVwuLm.js} +1 -1
- package/dist/assets/{use-side-list-room-CJYjHQez.js → use-side-list-room-DH5gDKs9.js} +1 -1
- package/dist/assets/{use-skill-actions-U5IaZ-Z1.js → use-skill-actions-CMoU5oFT.js} +1 -1
- package/dist/assets/{use-skill-detail-files-B2ECj0iR.js → use-skill-detail-files-19-kefs2.js} +1 -1
- package/dist/assets/use-supports-credentials-settings-Bq2yot1y.js +1 -0
- package/dist/assets/{use-transcript-message-by-id-De7Rp17U.js → use-transcript-message-by-id-KYGOx3D6.js} +1 -1
- package/dist/assets/{voice-page-CUNQ2QJA.js → voice-page-Cuy1oc6q.js} +1 -1
- package/dist/assets/{wake-detail-panel-BouMf1FM.js → wake-detail-panel-B6BImUJo.js} +1 -1
- package/dist/assets/{weather-forecast-display-Ea8cYhbQ.js → weather-forecast-display-BvUd--wf.js} +1 -1
- package/dist/assets/{welcome-screen-Bh45FGdD.js → welcome-screen-CtVGX2aV.js} +1 -1
- package/dist/assets/{workflow-detail-panel-BfplcjXd.js → workflow-detail-panel-DMYrbO29.js} +1 -1
- package/dist/assets/{workspace-page-Cn3iFJgb.js → workspace-page-DPWYRJjr.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/add-credits-modal-CjhPCEo3.js +0 -1
- package/dist/assets/app-hw35VYTL.css +0 -2
- package/dist/assets/auth-store-B_1Y9Uid.js +0 -1
- package/dist/assets/avatar-bundled-components-5UFPY9JK.js +0 -1
- package/dist/assets/billing-page-JaprT6Vv.js +0 -3
- package/dist/assets/checkout-return-target-D5A2Rv1t.js +0 -1
- package/dist/assets/command-palette-Lr-NeDCr.js +0 -1
- package/dist/assets/deploy-dialogs-BaSfIbBO.js +0 -1
- package/dist/assets/document-load-CD-0uWA-.js +0 -1
- package/dist/assets/local-mode-CP6E3D3e.js +0 -1
- package/dist/assets/native-attachment-pickers-DGHZuGbD.js +0 -1
- package/dist/assets/native-file-DxOOIrLm.js +0 -1
- package/dist/assets/paired-platform-identity-X_FlXunr.js +0 -1
- package/dist/assets/password-reset-page-CDmQuW9S.js +0 -1
- package/dist/assets/plugins-surface-DAYezPv6.js +0 -1
- package/dist/assets/referral-modal-8IXUqxso.js +0 -1
- package/dist/assets/routes-CkL6GgBk.js +0 -1
- package/dist/assets/settings-Clb97agh.js +0 -3
- package/dist/assets/settings-o6cuYhH5.js +0 -3
- package/dist/assets/share-feedback-modal-fY8BlOwK.js +0 -1
- package/dist/assets/tool-detail-panel-Dqa39U7-.js +0 -1
- package/dist/assets/use-supports-credentials-settings-CMhSepvQ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$y as t,AC as n,BC as r,Bu as i,Cd as a,DC as o,Dc as s,Dd as c,Di as l,Du as u,Ed as d,Ei as f,Hd as p,Iy as m,Jn as h,Ly as g,Od as _,Oi as v,Ou as y,Sd as b,Su as x,Td as S,Ud as C,Wu as w,Xi as T,Yb as E,Yl as D,Yu as O,Zm as k,_C as ee,bd as A,cC as j,fC as M,iC as N,i_ as te,jd as ne,mS as P,mv as re,oC as ie,pC as ae,qi as oe,qo as F,sC as I,s_ as se,tb as ce,wd as le,xd as ue}from"./app-g1TvV-Dl.js";import{$n as L,E as R,Xn as de,cr as fe,j as z,nr as B,or as pe}from"./vendor-DwMhK7fD.js";import{f as me,t as he,x as V}from"./react-B9IgSVeK.js";import{D as ge,Ji as _e,Ra as ve,Ui as ye,Vn as be,Ya as H,fr as xe,pi as U,xr as W,zi as Se}from"./icons-C0wyat6T.js";import{c as Ce,i as G,l as we,n as Te,r as K,t as Ee}from"./machine-sizes-CMoW5pTp.js";import{a as De,i as Oe,n as ke,r as Ae,t as je}from"./provisioning-targets-C2xXAoS3.js";var Me=H(`computer`,[[`rect`,{width:`14`,height:`8`,x:`5`,y:`2`,rx:`2`,key:`wc9tft`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h2`,key:`rwmk9e`}],[`path`,{d:`M12 18h6`,key:`aqd8w3`}]]),q=e(V(),1),J=he();function Ne({icon:e}){return(0,J.jsx)(`span`,{className:`flex h-11 w-11 items-center justify-center rounded-full`,style:{backgroundColor:`color-mix(in oklab, var(--system-negative-strong) 12%, transparent)`},children:(0,J.jsx)(e,{className:`h-5 w-5`,style:{color:`var(--system-negative-strong)`},"aria-hidden":`true`})})}var Pe={fontFamily:`var(--font-serif)`,fontSize:`32px`,fontWeight:400,lineHeight:1.2,letterSpacing:`0.64px`};function Fe({title:e,subtitle:t}){return(0,J.jsxs)(`header`,{className:`flex flex-col items-center gap-2 pt-12 text-center`,children:[(0,J.jsx)(`h2`,{className:`text-[var(--content-emphasised)]`,style:Pe,children:e}),t&&(0,J.jsx)(`p`,{className:`text-[14px] font-normal text-[var(--content-secondary)]`,children:t})]})}var Ie=[{bodyShape:`star`,eyeStyle:`curious`,color:`yellow`,size:103,position:`-left-[28px] -top-[33px]`,rotate:180},{bodyShape:`star`,eyeStyle:`curious`,color:`orange`,size:109,position:`left-[63%] -top-[62px] -translate-x-1/2`,rotate:-8},{bodyShape:`blob`,eyeStyle:`grumpy`,color:`green`,size:76,position:`-right-[25px] top-[60px]`,rotate:1},{bodyShape:`stack`,eyeStyle:`gentle`,color:`purple`,size:110,position:`-left-[39px] top-[74%]`,rotate:0},{bodyShape:`urchin`,eyeStyle:`goofy`,color:`pink`,size:137,position:`-right-[42px] -bottom-[40px]`,rotate:180},{bodyShape:`sprout`,eyeStyle:`curious`,color:`orange`,size:72,position:`left-[37%] -bottom-[22px] -translate-x-1/2`,rotate:0}],Le=[{bodyShape:`star`,eyeStyle:`curious`,color:`yellow`,size:103,position:`-left-[28px] -top-[33px]`,rotate:180},{bodyShape:`star`,eyeStyle:`curious`,color:`orange`,size:109,position:`left-[63%] -top-[62px] -translate-x-1/2`,rotate:-8},{bodyShape:`blob`,eyeStyle:`grumpy`,color:`green`,size:76,position:`-right-[25px] top-[60px]`,rotate:1}];function Re({variant:e=`full`}){let t=f();return t?(0,J.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`creature-corners`,className:`pointer-events-none absolute inset-0 select-none`,children:(e===`top`?Le:Ie).map((e,n)=>(0,J.jsx)(`span`,{className:`absolute ${e.position}`,style:{rotate:`${e.rotate}deg`},children:(0,J.jsx)(h,{components:t,bodyShapeId:e.bodyShape,eyeStyleId:e.eyeStyle,colorId:e.color,size:e.size})},n))}):null}var ze={waitingStatus:`Upgrading your assistant…`,snagStatus:`We hit a snag upgrading your assistant`,snagCaption:`Retry in the background and we'll keep working on your upgrade.`,confirmingStatus:`Confirming your upgrade…`,confirmTimeoutStatus:`Still confirming your upgrade`,confirmTimeoutCaption:`Your payment went through safely. This can take a minute.`,backgroundConfirmMessage:`Your assistant is still upgrading. Chatting won't be available until it finishes. You can keep waiting here, or continue and we'll let you know when it's ready.`,backgroundExitToast:`Your upgrade continues in the background.`,backgroundRetryToast:`We'll retry your upgrade in the background.`,completeSubtitle:`Enjoy the new found power.`,fetchErrorBody:`We hit a problem checking your subscription. Your upgrade may still be processing. Return to billing to refresh.`},Y={waitingStatus:`Updating your assistant…`,snagStatus:`We hit a snag updating your assistant`,snagCaption:`Retry in the background and we'll keep working on your plan change.`,confirmingStatus:`Confirming your plan change…`,confirmTimeoutStatus:`Still confirming your plan change`,confirmTimeoutCaption:`Your plan change was submitted. This can take a minute.`,backgroundConfirmMessage:`Your assistant is still updating. Chatting won't be available until it finishes. You can keep waiting here, or continue and we'll let you know when it's ready.`,backgroundExitToast:`Your plan change continues in the background.`,backgroundRetryToast:`We'll retry your plan change in the background.`,completeSubtitle:`Your plan changes are live.`,fetchErrorBody:`We hit a problem checking your subscription. Your plan change may still be processing. Return to billing to refresh.`},X={upgrade:ze,downgrade:Y,change:Y};function Z(e=`upgrade`){return X[e]}function Be(e,t=!0){let{data:n}=L({...x(),enabled:t&&e==null}),{data:r}=L({...O({path:{id:e??``}}),enabled:t&&e!=null});return e==null?n:r}function Ve({assistantId:e,direction:t}){let n=me(),{t:i}=R(`settings`),a=Be(e,k())?.name||i(`completeState.assistantFallbackName`);return(0,J.jsxs)(`div`,{className:`relative flex min-h-[320px] flex-col items-center justify-center overflow-hidden px-8 pb-16 [animation:onboarding-step-in_350ms_ease-out] motion-reduce:[animation:none]`,children:[(0,J.jsx)(Re,{variant:`full`}),(0,J.jsxs)(`div`,{className:`relative flex w-full flex-col items-center`,children:[(0,J.jsx)(Fe,{title:i(`completeState.title`),subtitle:Z(t).completeSubtitle}),(0,J.jsx)(`div`,{className:`mt-10 flex w-full flex-col items-center gap-10`,children:(0,J.jsx)(r,{variant:`primary`,"data-testid":`onboarding-complete-return`,onClick:()=>{e!=null&&te(e),n(P.assistant,{replace:!0})},children:i(`completeState.returnTo`,{assistantName:a})})})]})]})}function Q(e=!0,t){let n=Be(t,e),r=t??n?.id,{data:i,isError:a,isFetching:o,dataUpdatedAt:s,errorUpdatedAt:c}=L({...u({path:{assistant_id:r??``}}),enabled:e&&!!r});return{assistant:n,assistantId:r,domains:i,domainsError:a,domainsFetching:o,domainsUpdatedAt:s,domainsErrorUpdatedAt:c}}var He=1e3,Ue=1e4,We=2500,Ge=2e3,Ke=1e4,qe=[`machine_size`,`subdomain`,`non_field_errors`],Je={subdomain_taken:`That subdomain is already taken. Try another.`,assistant_already_has_domain:`Your assistant already has a custom domain.`,no_assistant_to_attach_domain:`We couldn't find an assistant to attach this domain to.`,exceeds_machine_tier:`That machine size isn't available on your plan.`,provisioning_submission_failed:`We couldn't queue your upgrade just now. Try again in a moment.`,no_active_pro:`We couldn't confirm your Pro plan yet. Try again in a moment.`,no_provisionable_assistants:`We couldn't find an assistant to upgrade yet. Try again in a moment.`},Ye={provisioning_submission_failed:`We couldn't queue your plan change just now. Try again in a moment.`,no_provisionable_assistants:`We couldn't find an assistant to update yet. Try again in a moment.`};function Xe(e,t,n=`upgrade`){if(e&&typeof e==`object`){let t=e;if(typeof t.error==`string`){let e=(n===`upgrade`?void 0:Ye[t.error])??Je[t.error];if(e)return e}for(let e of qe){let n=t[e];if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}if(typeof t.detail==`string`)return t.detail}return t}var Ze=`h-8 rounded-lg border border-[var(--border-element)] bg-[var(--field-bg)] px-2.5 text-[14px] text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none transition-[border-color] duration-150 focus:border-[var(--border-active)] disabled:cursor-not-allowed disabled:opacity-60`,Qe=`text-[11px] font-medium text-[var(--content-secondary)]`;function $e({onExit:e,machineBusy:t=!1,assistantId:n}){let{t:s}=R(`settings`),c=B(),l=oe.use.emailRootDomain(),{assistant:u,assistantId:f,domains:p}=Q(!0,n),m=p?.results[0],[h,g]=(0,q.useState)(``),[_,v]=(0,q.useState)(`hi`),[b,x]=(0,q.useState)(!1);(0,q.useEffect)(()=>{if(!b){if(m){g(m.subdomain),x(!0);return}!u?.handle||h||(g(u.handle),x(!0))}},[u?.handle,m,b,h]);let[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(!1),E=de(a()),D=!!m||w,O=E.isPending||w;return(0,q.useEffect)(()=>{if(!w)return;let t=setTimeout(e,800);return()=>clearTimeout(t)},[w,e]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(j.Body,{className:`animate-[onboarding-step-in_350ms_ease-out] space-y-6 pb-0 motion-reduce:animate-none`,children:[(0,J.jsx)(Re,{variant:`top`}),(0,J.jsx)(Fe,{title:s(`domainStep.title`),subtitle:s(`domainStep.subtitle`)}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`label`,{htmlFor:`onboarding-email-prefix`,className:Qe,children:s(`domainStep.prefixLabel`)}),(0,J.jsx)(`input`,{id:`onboarding-email-prefix`,value:_,onChange:e=>v(e.target.value.toLowerCase().trim()),disabled:O||D,readOnly:D,placeholder:s(`domainStep.emailUsernamePlaceholder`),className:`${Ze} w-24`})]}),(0,J.jsx)(`span`,{className:`flex h-8 items-center text-[var(--content-secondary)]`,children:`@`}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,J.jsx)(`label`,{htmlFor:`onboarding-email-handle`,className:Qe,children:s(`domainStep.handleLabel`)}),(0,J.jsx)(`input`,{id:`onboarding-email-handle`,value:h,onChange:e=>{g(e.target.value.toLowerCase().trim()),S&&C(null)},disabled:O||D,readOnly:D,autoFocus:!0,placeholder:s(`domainStep.subdomainExamplePlaceholder`),"aria-invalid":!!S,className:`${Ze} w-full min-w-0`})]}),(0,J.jsxs)(`span`,{className:`flex h-8 shrink-0 items-center text-[14px] text-[var(--content-tertiary)]`,children:[`.`,l]})]}),S&&(0,J.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:S}),D&&(0,J.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:s(`domainStep.domainLockedMessage`)})]}),t&&!D&&(0,J.jsx)(o,{tone:`neutral`,children:s(`domainStep.machineBusyNotice`)}),!D&&(0,J.jsx)(o,{tone:`info`,className:`border-transparent bg-[var(--surface-active)]`,children:(0,J.jsx)(`span`,{className:`font-medium text-[var(--content-tertiary)]`,children:s(`domainStep.handleImmutableNotice`)})}),w?(0,J.jsx)(o,{tone:`success`,children:s(`domainStep.domainSetRedirecting`)}):null]}),(0,J.jsx)(j.Footer,{className:`items-center pt-6`,children:D?(0,J.jsx)(r,{variant:`primary`,"data-testid":`onboarding-domain-continue`,onClick:e,children:s(`domainStep.continue`)}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(r,{variant:`outlined`,"data-testid":`onboarding-domain-skip`,disabled:O,onClick:()=>{O||E.mutate({body:{skipped:!0}},{onSuccess:e,onError:()=>e()})},children:s(`domainStep.skip`)}),(0,J.jsx)(r,{variant:`primary`,"data-testid":`onboarding-domain-set`,disabled:!h||O||t,onClick:()=>{O||t||!h||E.mutate({body:{subdomain:h,..._?{email_username:_}:{}}},{onSuccess:()=>{C(null),T(!0),c.invalidateQueries({queryKey:i()}),c.invalidateQueries({queryKey:y({path:{assistant_id:f??``}})}),c.invalidateQueries({queryKey:d()})},onError:e=>{C(Xe(e,s(`domainStep.registerSubdomainFailed`)))}})},children:s(`domainStep.next`)})]})})]})}function et({onGoToBilling:e,direction:t}){let{t:i}=R(`settings`);return(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-6 py-10 text-center`,children:[(0,J.jsx)(Ne,{icon:ye}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(n,{variant:`title-small`,as:`h1`,children:i(`errorStates.fetchErrorTitle`)}),(0,J.jsx)(n,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:Z(t).fetchErrorBody})]}),(0,J.jsx)(r,{variant:`primary`,"data-testid":`onboarding-go-to-billing`,onClick:e,children:i(`errorStates.goToBilling`)})]})}function tt(e){let{targets:t,fromSnapshot:n,machineFloor:r,credits:i}=e,a=[];return t.machineSize==null?r!=null&&n.machineSize!=null&&n.machineSize!==r&&a.push({key:`machine`,label:`Machine`,from:G[n.machineSize],to:G[r]}):n.machineSize!==t.machineSize&&a.push({key:`machine`,label:`Machine`,from:n.machineSize==null?void 0:G[n.machineSize],to:G[t.machineSize]}),t.storageGib!=null&&(n.storageGib==null||t.storageGib>n.storageGib)&&a.push({key:`storage`,label:`Storage`,from:n.storageGib==null?void 0:`${n.storageGib} GB`,to:`${t.storageGib} GB`}),i!=null&&a.push({key:`credits`,label:i.label??`Credits`,from:i.from,to:i.to}),a}var nt=220;function $({items:e,visible:t=!0,toWord:n,className:r=``,testId:i=`upgrade-metrics`}){let[a,o]=(0,q.useState)(!1);(0,q.useEffect)(()=>{let e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)},[]);let s=t&&a;return(0,J.jsx)(`div`,{"aria-hidden":!t,"data-testid":i,"data-visible":t?`true`:`false`,className:`flex flex-col items-center gap-3 md:flex-row md:items-stretch md:gap-0 ${r}`,children:e.map((e,t)=>(0,J.jsxs)(`div`,{"data-testid":e.key?`chip-${e.key}`:void 0,className:`flex flex-col items-center gap-1 px-6 transition-[opacity,transform] duration-500 ease-out motion-reduce:transition-none ${s?`translate-y-0 opacity-100`:`translate-y-2 opacity-0`} ${t>0?`md:border-l md:border-[var(--border-subtle)]`:``}`,style:{transitionDelay:s?`${t*nt}ms`:`0ms`},children:[(0,J.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-[0.08em] text-[var(--content-tertiary)]`,children:e.label}),(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 whitespace-nowrap text-[var(--content-emphasised)]`,style:{fontFamily:`var(--font-serif)`,fontSize:`20px`,lineHeight:1.2},children:[e.from!=null&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:e.from}),n&&(0,J.jsx)(`span`,{className:`sr-only`,children:n}),(0,J.jsx)(ve,{className:`size-3.5 text-[var(--content-tertiary)]`,"aria-hidden":`true`})]}),(0,J.jsx)(`span`,{children:e.to}),e.landed&&(0,J.jsx)(_e,{"data-testid":`chip-check`,className:`size-3.5 text-[var(--system-positive-strong)]`,"aria-hidden":`true`}),e.status&&(0,J.jsx)(`span`,{className:`sr-only`,children:e.status})]})]},e.key??e.label))})}var rt=48;function it(e,t,n,r,i){let a=i*i,o=a*i;return .5*(2*t+(-e+n)*i+(2*e-5*t+4*n-r)*a+(-e+3*t-3*n+r)*o)}function at(e,t,n){let r=e.map(e=>({x:e.fx*t,y:e.fy*n,size:e.fs*n})),i=[],a=[],o=[],s=[],c=[],l=[],u=0;for(let e=0;e<r.length-1;e++){let t=r[Math.max(0,e-1)],n=r[e],c=r[e+1],l=r[Math.min(r.length-1,e+2)],d=e===r.length-2?rt+1:rt;for(let e=0;e<d;e++){let r=e/rt,d=it(t.x,n.x,c.x,l.x,r),f=it(t.y,n.y,c.y,l.y,r);i.length>0&&(u+=Math.hypot(d-i[i.length-1],f-a[a.length-1])),i.push(d),a.push(f),o.push(n.size+(c.size-n.size)*r),s.push(u)}}for(let e=0;e<i.length;e++){let t=Math.max(0,e-1),n=Math.min(i.length-1,e+1),r=i[n]-i[t],o=a[n]-a[t],s=Math.hypot(r,o)||1;c.push(r/s),l.push(o/s)}return{length:u,at:e=>{let t=Math.min(u,Math.max(0,e)),n=0,r=s.length-1;for(;n<r;){let e=n+r>>1;s[e]<t?n=e+1:r=e}let d=Math.max(1,n),f=d-1,p=s[d]-s[f]||1,m=(t-s[f])/p,h=c[f]+(c[d]-c[f])*m,g=l[f]+(l[d]-l[f])*m,_=Math.hypot(h,g)||1;return{x:i[f]+(i[d]-i[f])*m,y:a[f]+(a[d]-a[f])*m,tx:h/_,ty:g/_,size:o[f]+(o[d]-o[f])*m}}}}function ot(e,t){if(t<=0)return 0;let n=e%t;return n<0?n+t:n}function st(e,t){let n=[],r=0;for(;r<e.length;)n.push(r),r+=Math.max(1,e.at(r).size*t);return n}var ct={around:[{fx:.2,fy:-.16,fs:.02},{fx:.23,fy:0,fs:.024},{fx:.34,fy:.12,fs:.03},{fx:.52,fy:.19,fs:.037},{fx:.7,fy:.26,fs:.046},{fx:.85,fy:.4,fs:.058},{fx:.88,fy:.56,fs:.074},{fx:.76,fy:.71,fs:.095},{fx:.56,fy:.82,fs:.12},{fx:.4,fy:.93,fs:.15},{fx:.3,fy:1.08,fs:.185},{fx:.24,fy:1.28,fs:.22}],below:[{fx:1.16,fy:0,fs:.03},{fx:.95,fy:.06,fs:.036},{fx:.68,fy:.16,fs:.048},{fx:.4,fy:.3,fs:.065},{fx:.22,fy:.47,fs:.09},{fx:.32,fy:.64,fs:.125},{fx:.56,fy:.8,fs:.17},{fx:.58,fy:.98,fs:.22},{fx:.46,fy:1.22,fs:.27},{fx:.36,fy:1.5,fs:.3}]},lt={around:.24,below:.32},ut=.95,dt=.95,ft=1,pt=8,mt=20260922,ht=50;function gt({className:e=``,layout:t=`around`,flow:n=`down`,speed:r=1,lanes:i=3,paused:a=!1}){let o=f(),s=(0,q.useRef)(null),c=(0,q.useRef)({flow:n,speed:r,paused:a});return(0,q.useEffect)(()=>{c.current={flow:n,speed:r,paused:a}},[n,r,a]),(0,q.useEffect)(()=>{let e=s.current;if(!e||!o)return;let n=e.getContext(`2d`);if(!n)return;let r=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,a=0,u=0,d=null,f=1/0,p=[],m=0,h=new Map,g=(e,t)=>{let n=Math.max(1,Math.round(t/pt))*pt,r=`${e.bodyIdx}-${e.eyeIdx}-${e.colorIdx}-${n}`,i=h.get(r);if(i!==void 0)return i;let a=l(o,e.bodyIdx,e.eyeIdx,e.colorIdx,n);return h.set(r,a),a},_=()=>{let r=e.getBoundingClientRect();if(r.width===0||r.height===0||Math.abs(r.width-a)<1&&Math.abs(r.height-u)<1)return;let s=d,c=p.map(e=>e.distance);a=r.width,u=r.height;let l=Math.min(2,window.devicePixelRatio||1);e.width=Math.round(a*l),e.height=Math.round(u*l),n.setTransform(l,0,0,l,0,0),d=at(ct[t],a,u),f=u*lt[t];let m=v(mt),h=e=>(m()*2-1)*e,g=-1;if(p=[],st(d,ut).forEach((e,t)=>{let n=t%2==0?0:.5;for(let t=0;t<i;t++){let r=Math.floor(m()*o.colors.length);r===g&&(r=(r+1)%o.colors.length),g=r,p.push({distance:e,lane:t-(i-1)/2+n,jitterAlong:h(.08),jitterAcross:h(.12),sizeScale:.85+m()*.3,rotate:h(10)*Math.PI/180,phase:m()*Math.PI*2,bodyIdx:Math.floor(m()*o.bodyShapes.length),eyeIdx:Math.floor(m()*o.eyeStyles.length),colorIdx:r})}}),s&&s.length>0){let e=d.length/s.length;p.forEach((t,n)=>{let r=c[n];r!==void 0&&(t.distance=ot(r*e,d.length))})}},y=e=>{if(!d)return;let t=m?Math.min(ht,e-m):0;m=e;let{flow:i,speed:o,paused:s}=c.current,l=r||s?0:(i===`down`?1:-1)*o*ft*(t/1e3);n.clearRect(0,0,a,u);for(let t of p){if(l!==0){let e=d.at(t.distance).size;t.distance=ot(t.distance+l*e,d.length)}let i=d.at(t.distance),a=Math.min(f,i.size*t.sizeScale),o=(t.lane*dt+t.jitterAcross)*i.size,s=t.jitterAlong*i.size,c=i.x+i.ty*o+i.tx*s,u=i.y-i.tx*o+i.ty*s,p=g(t,a);if(!p)continue;let m=r?0:Math.sin(e*.001+t.phase)*1.4,h=r?0:Math.sin(e*8e-4+t.phase*2)*.025;n.save(),n.translate(c,u+m),n.rotate(t.rotate+h),n.drawImage(p,-a/2,-a/2,a,a),n.restore()}};_();let b=new ResizeObserver(()=>{_(),r&&y(performance.now())});b.observe(e);let x=0;if(r)y(performance.now());else{let e=t=>{y(t),x=requestAnimationFrame(e)};x=requestAnimationFrame(e)}return()=>{cancelAnimationFrame(x),b.disconnect()}},[o,i,t]),(0,J.jsx)(`canvas`,{ref:s,"aria-hidden":`true`,"data-testid":`upgrade-stream`,className:`pointer-events-none block h-full w-full ${e}`})}function _t(e,t){if(t!=null)return e?.credit_tiers?.find(e=>e.tier===t)}function vt(e){let t=e?.match(/^credits_(\d+)$/)?.[1];return t==null?null:Number(t)}function yt(e){let t=k(),{data:n}=L({...A(),enabled:t&&e});return n?.plans.find(e=>e.id===`pro`)}function bt(e,t){return t==null?0:_t(e,t)?.credits_usd??vt(t)}function xt(e,t){return t==null?null:_t(e,t)?.label}function St(e){let t=yt(e!=null);if(e==null||t==null)return null;let n,r;if(e.kind===`package`){let i=t.packages.find(t=>t.key===e.packageKey),a=_t(t,i?.credit_tier);n=i?.credits_usd??a?.credits_usd,r=i?.usage_label??a?.label??void 0}else{let i=_t(t,e.creditTier);n=i?.credits_usd,r=i?.label}return n==null?null:{fromLabel:null,toLabel:r}}function Ct(e){let t=yt(e!=null);return e==null||bt(t,e.fromTier)==null||bt(t,e.toTier)==null?null:{fromLabel:xt(t,e.fromTier),toLabel:xt(t,e.toTier)}}function wt(e,t){let[n,r]=(0,q.useState)(e),i=(0,q.useRef)(0);return(0,q.useEffect)(()=>{i.current=performance.now()},[]),(0,q.useEffect)(()=>{if(t<=0||e===n)return;let a=t-(performance.now()-i.current);if(a<=0){i.current=performance.now(),r(e);return}let o=setTimeout(()=>{i.current=performance.now(),r(e)},a);return()=>clearTimeout(o)},[e,n,t]),t<=0?e:n}var Tt=`#ffffff`;function Et({status:e,caption:t}){return(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5`,children:[(0,J.jsx)(`h1`,{className:`text-[var(--content-emphasised)]`,style:Pe,children:e}),t&&(0,J.jsx)(n,{variant:`body-medium-lighter`,as:`p`,className:`max-w-sm text-[var(--content-secondary)]`,children:t})]})}function Dt(e,t){return e===`credits`?!0:t?.[e]===!0}function Ot(e,t){if(e==null)return null;let n=t(`provisioningState.noExtraUsage`),r=e.toLabel===null?n:e.toLabel;return r==null?null:{label:t(`provisioningState.usageLabel`),from:e.fromLabel===null?n:e.fromLabel,to:r}}function kt({intent:e,creditsChange:t,targets:n,fromSnapshot:r,machineFloor:i,landed:a,allDone:o=!1,creditsOnly:s=!1}){let{t:c}=R(`settings`),l=St(e),u=Ct(t),d=tt({targets:n,fromSnapshot:r,machineFloor:i,credits:Ot(l??u,c)}),f=s?d.filter(e=>e.key===`credits`):d,p=f.filter(e=>o||Dt(e.key,a)).map(e=>e.label).join(`, `),[m]=(0,q.useState)(p),h=p===m?``:c(`provisioningState.dimensionsComplete`,{dimensions:p});return f.length===0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)($,{items:f.map(e=>{let t=o||Dt(e.key,a);return{key:e.key,label:e.label,from:e.from??null,to:e.to,landed:t,status:c(t?`provisioningState.statusComplete`:`provisioningState.statusPending`)}}),testId:`resource-chips`,toWord:c(`provisioningState.srOnlyTo`)}),(0,J.jsx)(`p`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`chip-announcement`,children:h})]})}function At({intent:e}){let{t}=R(`settings`),n=St(e.kind===`custom`?e:null);if(e.kind===`package`){let n=e.packageKey.charAt(0).toUpperCase()+e.packageKey.slice(1);return(0,J.jsx)($,{testId:`resource-chips`,items:[{key:`package`,label:t(`provisioningState.packageLabel`),from:null,to:n}]})}let r=[];return e.machineTier!=null&&r.push({key:`machine`,label:t(`provisioningState.machineLabel`),from:null,to:Te[e.machineTier]??e.machineTier}),e.storageTier!=null&&r.push({key:`storage`,label:t(`provisioningState.storageLabel`),from:null,to:e.storageTier.toUpperCase()}),e.creditTier!=null&&n?.toLabel!=null&&r.push({key:`credits`,label:t(`provisioningState.usageLabel`),from:null,to:n.toLabel}),r.length===0?null:(0,J.jsx)($,{testId:`resource-chips`,items:r})}function jt({state:e,direction:t,softWaiting:n,intent:i,creditsChange:a,targets:o,fromSnapshot:s,machineFloor:c,landed:l,celebrating:u,onCelebrationEnd:d,escapeAvailable:f,onEscape:p,onPhaseChange:m,kickError:h,confirm:g,dwellMs:_=We,phaseMinMs:v=900}){let{t:y}=R(`settings`),b=Z(t),x=(0,q.useRef)(d);(0,q.useEffect)(()=>{x.current=d},[d]);let S=wt(e,v),C=S===`DONE`||S===`NOT_APPLICABLE`,w=S===`RESIZING`?`WAITING`:S,T=(0,q.useRef)(m);(0,q.useEffect)(()=>{T.current=m},[m]),(0,q.useEffect)(()=>{T.current?.(S)},[S]);let E=u&&C;(0,q.useEffect)(()=>{if(!E)return;let e=setTimeout(()=>x.current(),_);return()=>clearTimeout(e)},[E,_]);let O=D(),k=S===`STALLED`,ee=(0,J.jsx)(`div`,{className:`relative z-10 flex w-full flex-col items-center gap-6 [animation:onboarding-step-in_420ms_ease-out] motion-reduce:[animation:none]`,children:M()},w);if(O)return(0,J.jsxs)(`div`,{"data-testid":`provisioning-takeover`,"data-theme":`light`,className:`relative flex h-full min-h-[420px] w-full flex-col overflow-hidden text-center`,style:{backgroundColor:Tt},children:[(0,J.jsx)(`div`,{className:`px-6 pb-8 pt-16`,children:ee}),(0,J.jsx)(`div`,{className:`relative min-h-0 flex-1`,children:(0,J.jsx)(gt,{className:`absolute inset-0`,layout:`below`,paused:k})})]});return(0,J.jsxs)(`div`,{"data-testid":`provisioning-takeover`,"data-theme":`light`,className:`relative flex h-full min-h-[420px] w-full flex-col items-center justify-center overflow-hidden px-6 py-10 text-center`,style:{backgroundColor:Tt},children:[(0,J.jsx)(gt,{className:`absolute inset-0`,layout:`around`,paused:k}),(0,J.jsx)(`div`,{className:`relative z-10 mr-[16%] flex w-full max-w-2xl flex-col items-center`,children:ee})]});function A(e=y(`provisioningState.continueInBackground`)){return f?(0,J.jsx)(r,{variant:`ghost`,"data-testid":`provisioning-escape`,onClick:p,children:e}):null}function j({allDone:e=!1,creditsOnly:t=!1}={}){return(0,J.jsx)(kt,{intent:i,creditsChange:a,targets:o,fromSnapshot:s,machineFloor:c,landed:l,allDone:e,creditsOnly:t})}function M(){if(S===`CONFIRMING`)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Et,{status:b.confirmingStatus,caption:y(`provisioningState.confirmingCaption`)}),i&&(0,J.jsx)(At,{intent:i}),A()]});if(S===`WAITING`||S===`RESIZING`)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Et,{status:b.waitingStatus,caption:y(n?`provisioningState.waitingCaptionLong`:`provisioningState.waitingCaptionShort`)}),j(),A()]});if(S===`DONE`)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Et,{status:y(`provisioningState.allDoneStatus`)}),j({allDone:!0})]});if(S===`NOT_APPLICABLE`)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Et,{status:y(`provisioningState.planReadyStatus`)}),j({allDone:!0,creditsOnly:!0})]});if(S===`STALLED`){let e=h!=null;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Et,{status:e?b.snagStatus:y(`provisioningState.takingLongerStatus`),caption:e?Xe(h,b.snagCaption,t):y(`provisioningState.stalledCaption`)}),j(),e?A(y(`provisioningState.retryInBackground`)):A()]})}return S===`CONFIRM_TIMEOUT`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Et,{status:b.confirmTimeoutStatus,caption:b.confirmTimeoutCaption}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,J.jsx)(r,{variant:`outlined`,"data-testid":`onboarding-go-to-billing`,onClick:g.onGoToBilling,children:y(`provisioningState.goToBilling`)}),(0,J.jsx)(r,{variant:`primary`,"data-testid":`onboarding-retry`,onClick:g.onRetry,children:y(`provisioningState.tryAgain`)})]})]}):null}}function Mt(e){let{planId:t,targets:n,actuals:r,initialActuals:i,resizeOperationInFlight:a,sawOperation:o,msSinceWatchStart:s,confirmExpired:c,serverVerdict:l=null,statusObservedSinceTargetsMet:u=!0,targetsProveNoop:d=!0}=e;if(t!==`pro`)return{state:c?`CONFIRM_TIMEOUT`:`CONFIRMING`,softWaiting:!1};let f=o||a,p=l===`started`||l===`in_progress`,m=o||d&&u;if(!a){let e=p?m:f||l===`already_done`||i!=null&&!De(n,i);if(De(n,r)){if(e)return{state:`DONE`,softWaiting:!1};if(!p&&(d||l===`not_applicable`))return{state:`NOT_APPLICABLE`,softWaiting:!1}}else{if(l===`already_done`)return{state:`DONE`,softWaiting:!1};if(l===`not_applicable`)return{state:`NOT_APPLICABLE`,softWaiting:!1}}}return s!=null&&s>=9e4?{state:`STALLED`,softWaiting:!1}:f||l===`started`||l===`in_progress`?{state:`RESIZING`,softWaiting:!1}:{state:`WAITING`,softWaiting:s!=null&&s>=3e4}}var Nt=2e3,Pt=1e3,Ft=[`DONE`,`NOT_APPLICABLE`,`CONFIRM_TIMEOUT`],It={assistantId:null,machine:null,storage:null};function Lt({open:e,canLowerResources:t=!1,verdictRecheckMs:n=Ke}){let r=B(),i=k(),[a,o]=(0,q.useState)(!1),[s,l]=(0,q.useState)(0),[u,f]=(0,q.useState)(null),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(null),[v,y]=(0,q.useState)(null),[b,C]=(0,q.useState)(null),[T,E]=(0,q.useState)(null),[D,ee]=(0,q.useState)(It),[A,j]=(0,q.useState)(null),[M,N]=(0,q.useState)(!1),te=(0,q.useRef)(!1),ne=(0,q.useRef)(!1),P=(0,q.useRef)(0),[re,ie]=(0,q.useState)(!1),[ae,oe]=(0,q.useState)(null),[F,I]=(0,q.useState)(null),[ce,ue]=(0,q.useState)(null),[R,z]=(0,q.useState)(()=>Date.now()),[me,he]=(0,q.useState)(!0);(0,q.useEffect)(()=>{e||(o(!1),l(0),f(null),m(null),g(null),ie(!1),oe(null),I(null),ue(null),he(!0),y(null),C(null),E(null),ee(It),j(null),N(!1),te.current=!1,ne.current=!1,P.current+=1)},[e]),(0,q.useEffect)(()=>{e&&(f(Date.now()),r.invalidateQueries({queryKey:_()}),r.invalidateQueries({queryKey:d()}))},[e,r]);let V=p!=null,ge=L({...c(),refetchInterval:e=>e.state.data?.plan_id===`pro`||a?!1:He,refetchIntervalInBackground:!1,enabled:e&&i&&!V}),_e=(u!=null&&ge.dataUpdatedAt>=u?ge.data?.plan_id:null)??null;(0,q.useEffect)(()=>{if(!e||V||_e!==`pro`)return;let t=Date.now();m(t),z(t)},[e,V,_e]),(0,q.useEffect)(()=>{if(!e||V)return;let t=setTimeout(()=>o(!0),Ue);return()=>clearTimeout(t)},[e,V,s]);let ve=(0,q.useCallback)(()=>{o(!1),l(e=>e+1),se.getState().fetchOrganizations(),r.invalidateQueries({queryKey:_()})},[r]),ye=(0,q.useCallback)(()=>{let e=Date.now();g(e),z(e)},[]),{mutate:be}=de(le()),H=(0,q.useCallback)(e=>{let t=P.current;be({},{onSuccess:n=>{t===P.current&&(j(null),ke(n)?ne.current?j({error:n.reason??`no_active_pro`}):(ne.current=!0,N(!0),e===`escape`&&ye()):(y(n.state),e===`escape`&&ye()))},onError:e=>{t===P.current&&j(e)}})},[be,ye]);(0,q.useEffect)(()=>{!e||!i||!V||te.current||(te.current=!0,H(`auto`))},[e,i,V,H]),(0,q.useEffect)(()=>{if(!M)return;let e=P.current,t=setTimeout(()=>{N(!1),e===P.current&&H(`auto`)},Ge);return()=>clearTimeout(t)},[M,H]);let xe=(0,q.useCallback)(()=>H(`escape`),[H]),U=L({...S(),enabled:e&&i&&V}),W=me?Nt:!1,Se=L({...x(),enabled:e&&i&&V,refetchInterval:e=>e.state.data?.id==null?W:!1,retry:!1}),G=V&&u!=null&&U.dataUpdatedAt>=u,Te=G&&!U.isPending&&!U.isFetching,K=(G?U.data?.primary_assistant_id:null)??(U.isPending?null:Se.data?.id??null),Me=L({...O({path:{id:K??`unresolved`}}),enabled:e&&i&&V&&K!=null,refetchInterval:W,retry:!1}),J=w({path:{id:K??`unresolved`}}),Ne=L({...J,enabled:e&&i&&V&&K!=null,refetchInterval:W,retry:!1}),Pe=(0,q.useRef)(0),[Fe,Ie]=(0,q.useState)(0),Le=fe(J.queryKey);(0,q.useEffect)(()=>r.getQueryCache().subscribe(t=>{if(!(t.type!==`updated`||t.query.queryHash!==Le)){if(t.action.type===`fetch`)Pe.current+=1;else if(t.action.type===`success`&&!t.action.manual){let n=Pe.current,r=e&&Ae(t.action.data);pe.schedule(()=>{Ie(n),r&&(ie(!0),oe(K))})}}}),[r,Le,e,K]);let Re=Ae(Ne.data),ze=ae===K,Y=U.data,X=(0,q.useMemo)(()=>Y?{machineSize:Ce(Y.max_machine_tier),storageGib:Y.selected_storage_gib??null}:null,[Y]),Z=Y!=null&&Y.max_machine_tier==null?Ee:null,Be=Y?Y.domain_setup_available&&Y.primary_assistant_id!=null:void 0,Ve=Me.data,Q=(0,q.useMemo)(()=>Ve?{machineSize:Ve.machine_size??null,storageGib:Ve.provisioned_storage_gib??null}:null,[Ve]),We=ce===K,qe=(0,q.useMemo)(()=>{let e=je(X,Q),t=X?.machineSize??Z;if(t==null)return e;let n=Q?.machineSize??null;if(n==null)return{...e,machine:!1};let r=(We?F?.machineSize:null)??n,i=we(t)<we(r);return{...e,machine:i?we(n)<=we(t):we(n)>=we(t)}},[X,Q,F,We,Z]),Je=De(X,Q),Ye=T===K;(0,q.useEffect)(()=>{e&&(Je?(C(e=>e!=null&&Ye?e:Date.now()),E(K)):(C(null),E(null)))},[e,Je,K,Ye]);let Xe=D.assistantId===K;(0,q.useEffect)(()=>{if(!e)return;let t=Pe.current;ee(e=>{let n=e.assistantId===K?e:It,r=qe.machine?n.machine??t:null,i=qe.storage?n.storage??t:null;return e.assistantId===K&&e.machine===r&&e.storage===i?e:{assistantId:K,machine:r,storage:i}})},[e,qe,K]);let Ze=(0,q.useMemo)(()=>{let e=Oe(Ne.data),t=e=>e!=null&&Xe&&Fe>e;return{machine:qe.machine&&!e.machine&&t(D.machine),storage:qe.storage&&!e.storage&&t(D.storage)}},[qe,D,Xe,Fe,Ne.data]);(0,q.useEffect)(()=>{!e||!Q||F!=null&&We||(I(Q),ue(K))},[e,Q,K,F,We]);let Qe=h??p,$e=Qe==null?null:Math.max(0,R-Qe),et=!t,{state:tt,softWaiting:nt}=Mt({planId:V?`pro`:_e,targets:X,actuals:Q,initialActuals:We?F:null,resizeOperationInFlight:Re,sawOperation:re&&ze,msSinceWatchStart:$e,confirmExpired:a,serverVerdict:v,statusObservedSinceTargetsMet:b!=null&&Ye&&Ne.dataUpdatedAt>b,targetsProveNoop:et}),$=Ft.includes(tt),rt=e&&V&&!$;(0,q.useEffect)(()=>{he(rt)},[rt]),(0,q.useEffect)(()=>{if(!e||!V||$)return;let t=setInterval(()=>z(Date.now()),Pt);return()=>clearInterval(t)},[e,V,$]);let it=!et&&(v===`started`||v===`in_progress`)&&!(re&&ze);return(0,q.useEffect)(()=>{if(!e||!V||$||!it)return;let t=setInterval(()=>H(`auto`),n);return()=>clearInterval(t)},[e,V,$,it,n,H]),{state:tt,softWaiting:nt,targets:X,actualsSnapshot:F,machineFloor:Z,landed:Ze,assistantId:K,domainStepAvailable:Be,onboardingSettled:Te,confirmError:!V&&ge.isError,targetsError:V&&U.isError&&(!Y||!G),escapeEligible:$e!=null&&$e>=6e4,retryConfirm:ve,kickProvisioning:xe,kickError:A}}var Rt=200,zt=380;function Bt(){return typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0}var Vt=e=>e===`WAITING`||e===`RESIZING`||e===`STALLED`,Ht=e=>e===`DONE`||e===`NOT_APPLICABLE`,Ut={machineSize:null,storageGib:null};function Wt({open:e,onClose:n,dwellMs:r,phaseMinMs:i,mode:a=`checkout`,resizeContext:o}){let{t:s}=R(`settings`),c=a===`resize`,l=B(),u=me(),d=re.use.assistantInbox(),[f,p]=(0,q.useState)(`provisioning`),[m,h]=(0,q.useState)(`idle`),g=(0,q.useRef)([]),[_,v]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(!1),E=c?o?.direction:void 0,D=Z(E),O=Lt({open:e,canLowerResources:c?o?.canLowerResources===!0:!1});(0,q.useEffect)(()=>{if(e){v(c?null:ce()),C(e=>e??Date.now());return}g.current.forEach(clearTimeout),g.current=[],p(`provisioning`),h(`idle`),x(null),C(null),T(!1)},[e,c]),(0,q.useEffect)(()=>()=>{g.current.forEach(clearTimeout)},[]),(0,q.useEffect)(()=>{f===`complete`&&t()},[f]);let k=Vt(O.state),ee=Ht(b??O.state),{targets:A,assistantId:M,domainStepAvailable:N,onboardingSettled:te}=O,ne=c?o?.fromSnapshot:void 0,ae=O.actualsSnapshot,oe={machineSize:ne?.machineSize??ae?.machineSize??null,storageGib:ne?.storageGib??ae?.storageGib??null},F=c&&N===!0,{domains:se,domainsError:le,domainsFetching:ue,domainsUpdatedAt:L,domainsErrorUpdatedAt:de}=Q(e&&F,M),fe=(se?.results.length??0)>0,z=(0,q.useRef)(null);(0,q.useEffect)(()=>{if(!e){z.current=null;return}!F||M==null||z.current!==M&&(z.current=M,l.invalidateQueries({queryKey:y({path:{assistant_id:M}})}))},[e,F,M,l]);let pe=!ue&&(S!=null&&L>=S||S!=null&&!!le&&de>=S),[he,V]=(0,q.useState)(!1),ge=te&&(!F||pe);(0,q.useEffect)(()=>{if(!e){V(!1);return}ge&&V(!0)},[e,ge]);let _e=(0,q.useCallback)(()=>{t(),n(),u(P.assistantInbox,{replace:!0})},[u,n]),ve=(0,q.useCallback)(()=>{let e=c?N===!0&&!fe?`domain`:`complete`:N===!1?`complete`:`domain`;if(e===`domain`&&d){_e();return}if(Bt()){p(e);return}h(`covering`),g.current.push(setTimeout(()=>{p(e),h(`revealing`),g.current.push(setTimeout(()=>h(`idle`),zt))},Rt))},[N,c,fe,d,_e]),ye=(0,q.useCallback)(()=>{T(!0)},[]),be=(0,q.useCallback)(()=>{O.kickProvisioning(),I.info(O.kickError==null?D.backgroundExitToast:D.backgroundRetryToast),T(!1),n()},[O,n,D]),H=(0,q.useCallback)(()=>{T(!1)},[]),xe=f===`provisioning`&&(O.confirmError||O.targetsError),U=f===`provisioning`&&!xe,W=U&&!ee,Se=`transition-[background-color] duration-300 ease-out${U?` bg-white p-0`:``}`,Ce=U?`[animation:fadeIn_0.45s_ease-out_both]`:m===`revealing`?`[animation:fadeInUp_0.42s_ease-out_0.12s_both]`:`[animation:fadeIn_0.25s_ease-out_both]`;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(j.Root,{open:e,onOpenChange:e=>{e||n()},children:(0,J.jsxs)(j.Content,{size:`md`,hideCloseButton:f!==`complete`,dismissOnOverlayClick:!W,onEscapeKeyDown:W?e=>e.preventDefault():void 0,onInteractOutside:W?e=>e.preventDefault():void 0,overlayClassName:Se,className:U?`overflow-y-auto inset-0 max-w-none w-screen h-screen max-h-none rounded-none border-0`:`overflow-hidden`,children:[(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col motion-reduce:[animation:none] ${Ce}`,children:G()},f),m!==`idle`&&(0,J.jsx)(`div`,{"aria-hidden":!0,"data-testid":`takeover-exit-sheet`,className:`pointer-events-none fixed inset-0 z-50 ${m===`covering`?`[animation:fadeIn_200ms_ease-in_both]`:`[animation:fadeIn_380ms_ease-out_both_reverse]`}`,style:{backgroundColor:`#ffffff`}})]})}),(0,J.jsx)(ie,{open:w&&k,title:s(`billingOnboardingModal.backgroundConfirmTitle`),message:D.backgroundConfirmMessage,confirmLabel:s(`billingOnboardingModal.backgroundConfirmContinue`),cancelLabel:s(`billingOnboardingModal.backgroundConfirmKeepWaiting`),onConfirm:be,onCancel:H})]});function G(){return f===`provisioning`?O.confirmError||O.targetsError?(0,J.jsx)(et,{onGoToBilling:n,direction:E}):(0,J.jsx)(jt,{state:O.state,direction:E,softWaiting:O.softWaiting,intent:_,creditsChange:c?o?.credits:void 0,targets:A??Ut,fromSnapshot:oe,machineFloor:O.machineFloor,landed:O.landed,celebrating:he,onCelebrationEnd:ve,escapeAvailable:k&&O.escapeEligible,onEscape:ye,onPhaseChange:x,kickError:O.kickError,confirm:{onRetry:O.retryConfirm,onGoToBilling:n},dwellMs:r,phaseMinMs:i}):f===`domain`?(0,J.jsx)($e,{machineBusy:k,assistantId:M,onExit:()=>p(`complete`)}):(0,J.jsx)(Ve,{assistantId:M,direction:E})}}function Gt(e){return e!=null&&!e.customized}function Kt(e){return Gt(e)?e.name:`Custom`}var qt=[`mighty`,`super`,`ultra`],Jt=[`free`,...qt];function Yt(e){return Jt.indexOf(e)}function Xt(e,t){if(e===null)return`upgrade`;let n=Yt(e),r=Yt(t);return n===-1||r===-1?`upgrade`:r===n?`current`:r<n?`downgrade`:`upgrade`}function Zt(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>qt.indexOf(e.key)-qt.indexOf(t.key));if(!t)return n[0];let r=n.findIndex(e=>e.key===t);return r===-1?n[0]:r>=n.length-1?null:n[r+1]}var Qt=[`too_expensive`,`missing_features`,`switched_service`,`unused`,`too_complex`,`low_quality`,`customer_service`,`other`],$t={too_expensive:`cancelReasonSurvey.optionTooExpensive`,missing_features:`cancelReasonSurvey.optionMissingFeatures`,switched_service:`cancelReasonSurvey.optionSwitchedService`,unused:`cancelReasonSurvey.optionUnused`,too_complex:`cancelReasonSurvey.optionTooComplex`,low_quality:`cancelReasonSurvey.optionLowQuality`,customer_service:`cancelReasonSurvey.optionCustomerService`,other:`cancelReasonSurvey.optionOther`},en=1e3,tn={feedback:null,comment:``};function nn(e){return e.feedback!=null}function rn(e){let t=e.feedback===`other`?e.comment.trim():``;return{feedback:e.feedback,comment:t||null}}function an({value:e,onChange:t,disabled:r}){let{t:i}=R(`settings`);return(0,J.jsxs)(`div`,{className:`mt-5 space-y-3`,"data-testid":`cancel-reason-survey`,children:[(0,J.jsx)(n,{as:`p`,variant:`body-medium-default`,children:i(`cancelReasonSurvey.title`)}),(0,J.jsx)(ae,{value:e.feedback??``,onValueChange:n=>t({...e,feedback:n===``?null:n}),name:`cancel-reason`,disabled:r,"aria-label":i(`cancelReasonSurvey.title`),children:Qt.map(e=>(0,J.jsx)(M,{value:e,label:i($t[e])},e))}),e.feedback===`other`?(0,J.jsx)(ee,{label:i(`cancelReasonSurvey.otherLabel`),placeholder:i(`cancelReasonSurvey.otherPlaceholder`),value:e.comment,onChange:n=>t({...e,comment:n.target.value}),maxLength:en,rows:3,disabled:r,fullWidth:!0,"data-testid":`cancel-reason-comment`}):null]})}var on={free:{bodyShape:`ninja`,eyeStyle:`angry`,color:`yellow`},mighty:{bodyShape:`cloud`,eyeStyle:`grumpy`,color:`green`},super:{bodyShape:`urchin`,eyeStyle:`goofy`,color:`teal`},ultra:{bodyShape:`sprout`,eyeStyle:`curious`,color:`orange`}};function sn({tier:e,size:t=40}){let n=on[e]??on.free,r=f();return(0,J.jsx)(`div`,{"aria-hidden":!0,className:`inline-flex shrink-0`,children:r?(0,J.jsx)(h,{components:r,bodyShapeId:n.bodyShape,colorId:n.color,size:t}):(0,J.jsx)(`div`,{style:{width:t,height:t}})})}var cn={free:{tagline:`Get to know your assistant.`,cta:`Start Free`,priceCaption:`Forever`},mighty:{tagline:`More capacity for consistent use.`,cta:`Power Up`,priceCaption:`Billed monthly`,recommended:!0},super:{tagline:`Do more, think less about the how.`,cta:`Go Super`,priceCaption:`Billed monthly`,extraFeatures:[`Assistant email and subdomain`]},ultra:{tagline:`Your second brain, running full speed.`,cta:`Unleash Ultra`,priceCaption:`Billed monthly`,extraFeatures:[`Assistant email and subdomain`]}};function ln(e){return cn[e]}function un(e){return`Downgrade to ${e}`}function dn(e){let t=e/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function fn(e){return`${dn(e)}/mo`}function pn(e){return`${dn(e)}/month`}function mn(e){return`${e>0?`+`:`−`}${dn(Math.abs(e))}/mo`}function hn(e){return`${e} GB storage`}function gn(e){return`${dn(e*100)} of bundled credits`}var _n=`Small`;function vn(e){return e?.machine_size?G[e.machine_size]??e.machine_size:_n}function yn(e,t){let n=ln(e.key)?.extraFeatures??[];return[{icon:Me,label:`${vn(e)} Machine`},{icon:W,label:`${e.storage_gib} GB Storage`},{icon:U,label:t},...n.map(e=>({icon:be,label:e}))]}function bn(){return[{icon:Me,label:`${_n} Machine`},{icon:W,label:`4 GB Storage`},{icon:U,label:`Pay as you go credits`}]}function xn(e,t=[]){let n=e?.credits_usd??0,r=e?.storage_gib??4,i=K[e?.machine_size??`small`];return[`${vn(e)} machine${i?` (${i})`:``}`,hn(r),e?.usage_label??gn(n),...t]}var Sn={machine:`Configurable machine size`,storage:`Configurable storage`,credits:`Pay-as-you-go and bundled credits`};function Cn(e,t){let n=[`${e.machineTier?Te[e.machineTier]??t.machine_tiers.find(t=>t.tier===e.machineTier)?.label??e.machineTier:_n} Machine`];if(e.storageGib!=null&&n.push(`${e.storageGib} GB`),e.creditTier!=null){let r=_t(t,e.creditTier)?.label,i=vt(e.creditTier);n.push(r??(i==null?`Credit bundle`:`${i} credits/mo`))}return n}function wn(e,t){let n=new Set([Sn.machine]);return e.storageGib!=null&&n.add(Sn.storage),e.creditTier!=null&&n.add(Sn.credits),[...Cn(e,t),...t.included_features.filter(e=>!n.has(e))]}function Tn(e){return e.disabled===!0}function En({machineTiers:e,storageTiers:t,selectedMachineTier:r,selectedStorageTier:i,onMachineTierChange:a,onStorageTierChange:o,currentMachinePriceCents:s,currentStoragePriceCents:c}){let{t:l}=R(`settings`),u=(0,q.useMemo)(()=>e.map(e=>{let t=Te[e.tier]??e.label,n=s==null?l(`tierPicker.priceAddon`,{price:fn(e.price_cents)}):e.price_cents===s?l(`tierPicker.priceCurrent`,{price:fn(e.price_cents)}):mn(e.price_cents-s);return{value:e.tier,label:l(`tierPicker.machineOption`,{label:t,priceLabel:n}),disabled:Tn(e)}}),[e,s,l]),d=(0,q.useMemo)(()=>t.map(e=>{let t=c==null?l(`tierPicker.priceAddon`,{price:fn(e.price_cents)}):e.price_cents===c?l(`tierPicker.priceCurrent`,{price:fn(e.price_cents)}):mn(e.price_cents-c);return{value:e.tier,label:l(`tierPicker.storageOption`,{gib:e.storage_gib,priceLabel:t}),disabled:Tn(e)}}),[t,c,l]);return(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(n,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:l(`tierPicker.machineLabel`)}),(0,J.jsx)(`span`,{title:l(`tierPicker.machineTooltip`),children:(0,J.jsx)(xe,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,J.jsx)(N,{"aria-label":l(`tierPicker.machineAriaLabel`),placeholder:l(`tierPicker.machinePlaceholder`),value:r??``,onChange:a,options:u})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(n,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:l(`tierPicker.storageLabel`)}),(0,J.jsx)(`span`,{title:l(`tierPicker.storageTooltip`),children:(0,J.jsx)(xe,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,J.jsx)(N,{"aria-label":l(`tierPicker.storageAriaLabel`),placeholder:l(`tierPicker.storagePlaceholder`),value:i??``,onChange:o,options:d})]})]})}var Dn=new Set([`active`,`trialing`,`past_due`]);function On(e){return e.plan_id!==`base`&&e.cancel_at_period_end!==!0&&!e.cancel_at&&e.status!=null&&Dn.has(e.status)}function kn(e){return e?.status!=null&&Dn.has(e.status)}var An=[`target_plan_id`,`confirm`,`machine_tier`,`storage_tier`,`credit_tier`,`package`,`non_field_errors`];function jn(e,t){if(e&&typeof e==`object`){for(let t of An)if(t in e){let n=e[t];if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}if(`detail`in e&&typeof e.detail==`string`)return e.detail}return t}function Mn(e,t){let n=e.filter(e=>!Tn(e));return t!==null&&n.some(e=>e.tier===t)?t:n[0]?.tier??null}function Nn(e,t,n){return t===void 0?n:t!==null&&(t===n||e.some(e=>e.tier===t))?t:null}function Pn(e){return e.length?Math.min(...e.map(e=>e.price_cents)):0}function Fn(){let e=B();return async t=>{try{let n=await t.mutateAsync();return await e.invalidateQueries({queryKey:_()}),t.onSuccess(n),n}catch(e){return I.error(jn(e,t.errorFallback()),{id:t.errorToastId}),null}}}var In=`billing-portal-return-snapshot`;function Ln(e){try{sessionStorage.removeItem(In),sessionStorage.setItem(In,JSON.stringify(e))}catch{}}function Rn(){if(typeof sessionStorage>`u`)return null;try{let e=sessionStorage.getItem(In);if(!e)return null;let t=JSON.parse(e);return typeof t.cancel_at_period_end!=`boolean`||typeof t.plan_id!=`string`?null:{cancel_at_period_end:t.cancel_at_period_end,cancel_at:t.cancel_at??null,plan_id:t.plan_id}}catch{return null}}function zn(){try{sessionStorage.removeItem(In)}catch{}}function Bn(e){return e?{cancel_at_period_end:e.cancel_at_period_end,cancel_at:e.cancel_at??null,plan_id:e.plan_id}:null}function Vn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function Hn(e){return e?e.cancel_at??e.current_period_end??null:null}function Un(e){let t=B();return(0,q.useEffect)(()=>g(()=>{t.invalidateQueries(c())}),[t]),p({onSuccess:t=>{e&&Ln(e),m(t.portal_url)},onError:()=>{I.error(z(`settings:useBillingPortalSession.openError`),{id:`billing-portal-session-error`})}})}function Wn(){let e=C(),t=Fn();return{cancelSubscription:n=>t({mutateAsync:()=>e.mutateAsync({body:n}),onSuccess:e=>{let t=e.cancel_at?Vn(e.cancel_at):z(`settings:useCancelSubscription.endOfBillingPeriod`);I.info(z(`settings:useCancelSubscription.canceledToast`,{date:t}),{id:`subscription-cancel`})},errorToastId:`subscription-cancel-error`,errorFallback:()=>z(`settings:useCancelSubscription.cancelFailedToast`)}),isPending:e.isPending}}function Gn(e){return Promise.all([e.invalidateQueries({queryKey:_()}),e.invalidateQueries({queryKey:ue()}),e.invalidateQueries({queryKey:d()}),e.invalidateQueries({queryKey:ne()})])}function Kn({enabled:e=!0}={}){let t=B(),{t:n}=R(`settings`),[r,i]=(0,q.useState)(null),a=(0,q.useRef)(!1),[o,s]=(0,q.useState)(!1),l=k(),u=e&&l,d=L({...c(),enabled:u}),f=d.data,p=f!=null&&f.plan_id!==`base`,m=L({...S(),enabled:u&&p}),h=L({...A(),enabled:u&&p}).data?.plans.find(e=>e.id===`pro`)?.machine_tiers??[],g=e=>h.find(t=>t.tier===e)?.price_cents??null,_=de(b()),v={machineTier:m.data?.max_machine_tier??null,storageTier:m.data?.selected_storage_tier??null,storageGib:m.data?.selected_storage_gib??null,creditTier:f?.selected_credit_tier??null,hasPlatformFee:f?.has_platform_fee??!0},y=f!=null&&f.plan_id!==`base`&&f.status!=null&&Dn.has(f.status)&&f.cancel_at_period_end!==!0&&!f.cancel_at,x=!p||!m.isPending,C=!p||m.isSuccess&&m.data!=null&&!m.isFetching&&m.dataUpdatedAt>=d.dataUpdatedAt,w=o||_.isPending,T=async(e,t=v)=>{if(a.current)return null;a.current=!0,s(!0);try{return await E(e,t)}finally{a.current=!1,s(!1)}},E=async(e,r)=>{i(null);let a=e=>(i(e),I.error(e),null),[o,s]=await Promise.all([d.refetch(),m.refetch()]),c=o.data,l=s.data;if(o.isError||s.isError||c==null||l==null)return a(n(`customPlanModal.changeFailed`));let u={machineTier:l.max_machine_tier??null,storageTier:l.selected_storage_tier??null,storageGib:l.selected_storage_gib??null,creditTier:c.selected_credit_tier??null,hasPlatformFee:c.has_platform_fee??!0},f={machineTier:e.machineTier===r.machineTier?u.machineTier:e.machineTier,storageTier:e.storageTier===r.storageTier&&u.storageTier!=null?u.storageTier:e.storageTier,creditTier:e.creditTier===r.creditTier?u.creditTier:e.creditTier},p=f.machineTier!==u.machineTier,h=f.storageTier!==u.storageTier,v=f.creditTier!==u.creditTier,y=!u.hasPlatformFee,b=g(f.machineTier),x=g(u.machineTier),S=p&&b!=null&&x!=null&&b<x;if(!p&&!h&&!v&&!y)return{needsResize:!1,creditChanged:!1};let C;try{C=(await _.mutateAsync({body:{machine_tier:f.machineTier,storage_tier:f.storageTier,credit_tier:f.creditTier}})).status}catch(e){return a(jn(e,n(`customPlanModal.changeFailed`)))}return await Gn(t),C===`no_op`?{needsResize:!1,creditChanged:!1}:{needsResize:h||p&&!S,creditChanged:v}};return{changeTiers:T,isPending:w,error:r,current:v,eligible:y,currentReady:x,currentKnown:C,primaryAssistantId:C?m.data?.primary_assistant_id??null:null}}function qn(){let e=B(),{t}=R(`settings`),n=de(b());return{changePackage:async r=>{try{let t=await n.mutateAsync({body:{package:r}});return await Gn(e),t}catch(e){return I.error(jn(e,t(`customPlanModal.changeFailed`))),null}},isPending:n.isPending}}function Jn({className:e,"data-testid":t,children:n}){return(0,J.jsx)(`div`,{"aria-hidden":!0,"data-testid":t,className:F(`flex size-[52px] shrink-0 items-center justify-center rounded-xl`,e),children:n})}var Yn=32;function Xn(){let e=E.use.activeAssistantId(),{components:t,traits:n,customImageUrl:r,isLoading:i}=s(e);return(0,J.jsx)(Jn,{"data-testid":`assistant-avatar-tile`,className:`bg-[var(--surface-active)]`,children:e!=null&&!i?(0,J.jsx)(T,{components:t,traits:n,customImageUrl:r,size:Yn}):null})}var Zn=`Billed monthly · prorated difference charged today`,Qn=`Billed monthly · prorated difference charged today or credited next invoice`,$n=`Billed monthly · prorated credit on your next invoice`,er=`Your machine downsizes now and your storage stays. No refund.`,tr=`Continue`,nr=`The plan includes`,rr=`Your plan will include`;function ir(e,t,n){let r=n?ln(n)?.tagline??``:``;switch(e){case`downgrade`:return{title:un(t),subtitle:``,priceCaption:$n,checklistHeading:rr,note:er,confirmLabel:un(t),destructive:!0};case`switch`:return{title:`Switch to ${t}`,subtitle:r,priceCaption:Qn,checklistHeading:nr,note:``,confirmLabel:tr,destructive:!1};default:return{title:`Upgrade to ${t}`,subtitle:r,priceCaption:Zn,checklistHeading:nr,note:``,confirmLabel:tr,destructive:!1}}}function ar({open:e,relation:t,packageName:i,targetPackage:a,pending:o,onCancel:s,onConfirm:c}){let{t:l}=R(`settings`),u=(0,q.useRef)(null),d=(0,q.useId)(),f=ir(t,i,a?.key??null),p=a?{price:fn(a.total_price_cents),highlights:xn(a,ln(a.key)?.extraFeatures??[])}:null,m=f.subtitle,h=f.note?{"aria-describedby":d}:m?{}:{"aria-describedby":void 0};return(0,J.jsx)(j.Root,{open:e,onOpenChange:e=>{!e&&!o&&s()},children:(0,J.jsxs)(j.Content,{size:`sm`,hideCloseButton:!0,className:`gap-4 p-4 max-w-[421px]`,onOpenAutoFocus:e=>{e.preventDefault(),u.current?.focus()},...h,children:[(0,J.jsxs)(j.Header,{className:`flex-row items-center gap-3 p-0 pb-2`,children:[f.destructive?(0,J.jsx)(Jn,{"data-testid":`package-switch-warning-tile`,className:`bg-[var(--system-negative-weak)]`,children:(0,J.jsx)(ge,{className:`size-6 text-[var(--system-negative-strong)]`})}):(0,J.jsx)(Xn,{}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,J.jsx)(j.Title,{className:`text-title-small text-[var(--content-emphasised)] [&>span]:whitespace-normal`,children:f.title}),m?(0,J.jsx)(j.Description,{className:`mt-0 text-body-medium-default text-[var(--content-tertiary)]`,children:m}):null]})]}),p?(0,J.jsxs)(j.Body,{className:`flex flex-col gap-4 p-0`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,J.jsx)(n,{as:`p`,variant:`title-large`,className:`text-[var(--content-default)]`,children:p.price}),(0,J.jsx)(n,{as:`p`,variant:`label-medium-default`,className:`leading-[15px] text-[var(--content-tertiary)]`,children:f.priceCaption})]}),(0,J.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,J.jsx)(n,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,children:f.checklistHeading}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-2`,children:p.highlights.map(e=>(0,J.jsxs)(`li`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(Se,{className:`size-4 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,J.jsx)(n,{as:`span`,variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]},e))})]}):null,f.note?(0,J.jsx)(n,{id:d,as:`p`,variant:`body-medium-default`,className:`text-[var(--content-secondary)]`,children:f.note}):null,(0,J.jsxs)(j.Footer,{className:`flex-col gap-4 p-0`,children:[(0,J.jsx)(r,{fullWidth:!0,variant:f.destructive?`danger`:`primary`,onClick:c,disabled:o,"data-testid":`confirm-package-switch-button`,children:f.confirmLabel}),(0,J.jsx)(r,{ref:u,fullWidth:!0,variant:`ghost`,onClick:s,disabled:o,children:l(`packageSwitchConfirmModal.cancel`)})]})]})})}function or(){let e=B();(0,q.useEffect)(()=>g(()=>{Gn(e)}),[e])}export{fn as A,Gt as B,wn as C,yn as D,vn as E,an as F,Q as G,Kt as H,tn as I,Be as K,nn as L,hn as M,ln as N,mn as O,sn as P,rn as R,Tn as S,bn as T,Xt as U,Zt as V,Wt as W,On as _,Gn as a,Mn as b,zn as c,Rn as d,Un as f,kn as g,jn as h,Kn as i,pn as j,dn as k,Vn as l,Dn as m,ar as n,Wn as o,Fn as p,Me as q,qn as r,Bn as s,or as t,Hn as u,Pn as v,Cn as w,En as x,Nn as y,qt as z};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$y as t,AC as n,BC as r,Bu as i,Cd as a,DC as o,Dc as s,Dd as c,Di as l,Du as u,Ed as d,Ei as f,Hd as p,Iy as m,Jn as h,Ly as g,Od as _,Oi as v,Ou as y,Sd as b,Su as x,Td as S,Ud as C,Wu as w,Xi as T,Yb as E,Yl as D,Yu as O,Zm as k,_C as ee,bd as A,cC as j,fC as M,iC as N,i_ as te,jd as ne,mS as P,mv as re,oC as ie,pC as ae,qi as oe,qo as F,sC as I,s_ as se,tb as ce,wd as le,xd as ue}from"./app-XG_RF2yi.js";import{$n as L,E as R,Xn as de,cr as fe,j as z,nr as B,or as pe}from"./vendor-DwMhK7fD.js";import{f as me,t as he,x as V}from"./react-B9IgSVeK.js";import{D as ge,Ji as _e,Ra as ve,Ui as ye,Vn as be,Ya as H,fr as xe,pi as U,xr as W,zi as Se}from"./icons-C0wyat6T.js";import{c as Ce,i as G,l as we,n as Te,r as K,t as Ee}from"./machine-sizes-CMoW5pTp.js";import{a as De,i as Oe,n as ke,r as Ae,t as je}from"./provisioning-targets-C2xXAoS3.js";var Me=H(`computer`,[[`rect`,{width:`14`,height:`8`,x:`5`,y:`2`,rx:`2`,key:`wc9tft`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h2`,key:`rwmk9e`}],[`path`,{d:`M12 18h6`,key:`aqd8w3`}]]),q=e(V(),1),J=he();function Ne({icon:e}){return(0,J.jsx)(`span`,{className:`flex h-11 w-11 items-center justify-center rounded-full`,style:{backgroundColor:`color-mix(in oklab, var(--system-negative-strong) 12%, transparent)`},children:(0,J.jsx)(e,{className:`h-5 w-5`,style:{color:`var(--system-negative-strong)`},"aria-hidden":`true`})})}var Pe={fontFamily:`var(--font-serif)`,fontSize:`32px`,fontWeight:400,lineHeight:1.2,letterSpacing:`0.64px`};function Fe({title:e,subtitle:t}){return(0,J.jsxs)(`header`,{className:`flex flex-col items-center gap-2 pt-12 text-center`,children:[(0,J.jsx)(`h2`,{className:`text-[var(--content-emphasised)]`,style:Pe,children:e}),t&&(0,J.jsx)(`p`,{className:`text-[14px] font-normal text-[var(--content-secondary)]`,children:t})]})}var Ie=[{bodyShape:`star`,eyeStyle:`curious`,color:`yellow`,size:103,position:`-left-[28px] -top-[33px]`,rotate:180},{bodyShape:`star`,eyeStyle:`curious`,color:`orange`,size:109,position:`left-[63%] -top-[62px] -translate-x-1/2`,rotate:-8},{bodyShape:`blob`,eyeStyle:`grumpy`,color:`green`,size:76,position:`-right-[25px] top-[60px]`,rotate:1},{bodyShape:`stack`,eyeStyle:`gentle`,color:`purple`,size:110,position:`-left-[39px] top-[74%]`,rotate:0},{bodyShape:`urchin`,eyeStyle:`goofy`,color:`pink`,size:137,position:`-right-[42px] -bottom-[40px]`,rotate:180},{bodyShape:`sprout`,eyeStyle:`curious`,color:`orange`,size:72,position:`left-[37%] -bottom-[22px] -translate-x-1/2`,rotate:0}],Le=[{bodyShape:`star`,eyeStyle:`curious`,color:`yellow`,size:103,position:`-left-[28px] -top-[33px]`,rotate:180},{bodyShape:`star`,eyeStyle:`curious`,color:`orange`,size:109,position:`left-[63%] -top-[62px] -translate-x-1/2`,rotate:-8},{bodyShape:`blob`,eyeStyle:`grumpy`,color:`green`,size:76,position:`-right-[25px] top-[60px]`,rotate:1}];function Re({variant:e=`full`}){let t=f();return t?(0,J.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`creature-corners`,className:`pointer-events-none absolute inset-0 select-none`,children:(e===`top`?Le:Ie).map((e,n)=>(0,J.jsx)(`span`,{className:`absolute ${e.position}`,style:{rotate:`${e.rotate}deg`},children:(0,J.jsx)(h,{components:t,bodyShapeId:e.bodyShape,eyeStyleId:e.eyeStyle,colorId:e.color,size:e.size})},n))}):null}var ze={waitingStatus:`Upgrading your assistant…`,snagStatus:`We hit a snag upgrading your assistant`,snagCaption:`Retry in the background and we'll keep working on your upgrade.`,confirmingStatus:`Confirming your upgrade…`,confirmTimeoutStatus:`Still confirming your upgrade`,confirmTimeoutCaption:`Your payment went through safely. This can take a minute.`,backgroundConfirmMessage:`Your assistant is still upgrading. Chatting won't be available until it finishes. You can keep waiting here, or continue and we'll let you know when it's ready.`,backgroundExitToast:`Your upgrade continues in the background.`,backgroundRetryToast:`We'll retry your upgrade in the background.`,completeSubtitle:`Enjoy the new found power.`,fetchErrorBody:`We hit a problem checking your subscription. Your upgrade may still be processing. Return to billing to refresh.`},Y={waitingStatus:`Updating your assistant…`,snagStatus:`We hit a snag updating your assistant`,snagCaption:`Retry in the background and we'll keep working on your plan change.`,confirmingStatus:`Confirming your plan change…`,confirmTimeoutStatus:`Still confirming your plan change`,confirmTimeoutCaption:`Your plan change was submitted. This can take a minute.`,backgroundConfirmMessage:`Your assistant is still updating. Chatting won't be available until it finishes. You can keep waiting here, or continue and we'll let you know when it's ready.`,backgroundExitToast:`Your plan change continues in the background.`,backgroundRetryToast:`We'll retry your plan change in the background.`,completeSubtitle:`Your plan changes are live.`,fetchErrorBody:`We hit a problem checking your subscription. Your plan change may still be processing. Return to billing to refresh.`},X={upgrade:ze,downgrade:Y,change:Y};function Z(e=`upgrade`){return X[e]}function Be(e,t=!0){let{data:n}=L({...x(),enabled:t&&e==null}),{data:r}=L({...O({path:{id:e??``}}),enabled:t&&e!=null});return e==null?n:r}function Ve({assistantId:e,direction:t}){let n=me(),{t:i}=R(`settings`),a=Be(e,k())?.name||i(`completeState.assistantFallbackName`);return(0,J.jsxs)(`div`,{className:`relative flex min-h-[320px] flex-col items-center justify-center overflow-hidden px-8 pb-16 [animation:onboarding-step-in_350ms_ease-out] motion-reduce:[animation:none]`,children:[(0,J.jsx)(Re,{variant:`full`}),(0,J.jsxs)(`div`,{className:`relative flex w-full flex-col items-center`,children:[(0,J.jsx)(Fe,{title:i(`completeState.title`),subtitle:Z(t).completeSubtitle}),(0,J.jsx)(`div`,{className:`mt-10 flex w-full flex-col items-center gap-10`,children:(0,J.jsx)(r,{variant:`primary`,"data-testid":`onboarding-complete-return`,onClick:()=>{e!=null&&te(e),n(P.assistant,{replace:!0})},children:i(`completeState.returnTo`,{assistantName:a})})})]})]})}function Q(e=!0,t){let n=Be(t,e),r=t??n?.id,{data:i,isError:a,isFetching:o,dataUpdatedAt:s,errorUpdatedAt:c}=L({...u({path:{assistant_id:r??``}}),enabled:e&&!!r});return{assistant:n,assistantId:r,domains:i,domainsError:a,domainsFetching:o,domainsUpdatedAt:s,domainsErrorUpdatedAt:c}}var He=1e3,Ue=1e4,We=2500,Ge=2e3,Ke=1e4,qe=[`machine_size`,`subdomain`,`non_field_errors`],Je={subdomain_taken:`That subdomain is already taken. Try another.`,assistant_already_has_domain:`Your assistant already has a custom domain.`,no_assistant_to_attach_domain:`We couldn't find an assistant to attach this domain to.`,exceeds_machine_tier:`That machine size isn't available on your plan.`,provisioning_submission_failed:`We couldn't queue your upgrade just now. Try again in a moment.`,no_active_pro:`We couldn't confirm your Pro plan yet. Try again in a moment.`,no_provisionable_assistants:`We couldn't find an assistant to upgrade yet. Try again in a moment.`},Ye={provisioning_submission_failed:`We couldn't queue your plan change just now. Try again in a moment.`,no_provisionable_assistants:`We couldn't find an assistant to update yet. Try again in a moment.`};function Xe(e,t,n=`upgrade`){if(e&&typeof e==`object`){let t=e;if(typeof t.error==`string`){let e=(n===`upgrade`?void 0:Ye[t.error])??Je[t.error];if(e)return e}for(let e of qe){let n=t[e];if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}if(typeof t.detail==`string`)return t.detail}return t}var Ze=`h-8 rounded-lg border border-[var(--border-element)] bg-[var(--field-bg)] px-2.5 text-[14px] text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none transition-[border-color] duration-150 focus:border-[var(--border-active)] disabled:cursor-not-allowed disabled:opacity-60`,Qe=`text-[11px] font-medium text-[var(--content-secondary)]`;function $e({onExit:e,machineBusy:t=!1,assistantId:n}){let{t:s}=R(`settings`),c=B(),l=oe.use.emailRootDomain(),{assistant:u,assistantId:f,domains:p}=Q(!0,n),m=p?.results[0],[h,g]=(0,q.useState)(``),[_,v]=(0,q.useState)(`hi`),[b,x]=(0,q.useState)(!1);(0,q.useEffect)(()=>{if(!b){if(m){g(m.subdomain),x(!0);return}!u?.handle||h||(g(u.handle),x(!0))}},[u?.handle,m,b,h]);let[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(!1),E=de(a()),D=!!m||w,O=E.isPending||w;return(0,q.useEffect)(()=>{if(!w)return;let t=setTimeout(e,800);return()=>clearTimeout(t)},[w,e]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(j.Body,{className:`animate-[onboarding-step-in_350ms_ease-out] space-y-6 pb-0 motion-reduce:animate-none`,children:[(0,J.jsx)(Re,{variant:`top`}),(0,J.jsx)(Fe,{title:s(`domainStep.title`),subtitle:s(`domainStep.subtitle`)}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`label`,{htmlFor:`onboarding-email-prefix`,className:Qe,children:s(`domainStep.prefixLabel`)}),(0,J.jsx)(`input`,{id:`onboarding-email-prefix`,value:_,onChange:e=>v(e.target.value.toLowerCase().trim()),disabled:O||D,readOnly:D,placeholder:s(`domainStep.emailUsernamePlaceholder`),className:`${Ze} w-24`})]}),(0,J.jsx)(`span`,{className:`flex h-8 items-center text-[var(--content-secondary)]`,children:`@`}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,J.jsx)(`label`,{htmlFor:`onboarding-email-handle`,className:Qe,children:s(`domainStep.handleLabel`)}),(0,J.jsx)(`input`,{id:`onboarding-email-handle`,value:h,onChange:e=>{g(e.target.value.toLowerCase().trim()),S&&C(null)},disabled:O||D,readOnly:D,autoFocus:!0,placeholder:s(`domainStep.subdomainExamplePlaceholder`),"aria-invalid":!!S,className:`${Ze} w-full min-w-0`})]}),(0,J.jsxs)(`span`,{className:`flex h-8 shrink-0 items-center text-[14px] text-[var(--content-tertiary)]`,children:[`.`,l]})]}),S&&(0,J.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:S}),D&&(0,J.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:s(`domainStep.domainLockedMessage`)})]}),t&&!D&&(0,J.jsx)(o,{tone:`neutral`,children:s(`domainStep.machineBusyNotice`)}),!D&&(0,J.jsx)(o,{tone:`info`,className:`border-transparent bg-[var(--surface-active)]`,children:(0,J.jsx)(`span`,{className:`font-medium text-[var(--content-tertiary)]`,children:s(`domainStep.handleImmutableNotice`)})}),w?(0,J.jsx)(o,{tone:`success`,children:s(`domainStep.domainSetRedirecting`)}):null]}),(0,J.jsx)(j.Footer,{className:`items-center pt-6`,children:D?(0,J.jsx)(r,{variant:`primary`,"data-testid":`onboarding-domain-continue`,onClick:e,children:s(`domainStep.continue`)}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(r,{variant:`outlined`,"data-testid":`onboarding-domain-skip`,disabled:O,onClick:()=>{O||E.mutate({body:{skipped:!0}},{onSuccess:e,onError:()=>e()})},children:s(`domainStep.skip`)}),(0,J.jsx)(r,{variant:`primary`,"data-testid":`onboarding-domain-set`,disabled:!h||O||t,onClick:()=>{O||t||!h||E.mutate({body:{subdomain:h,..._?{email_username:_}:{}}},{onSuccess:()=>{C(null),T(!0),c.invalidateQueries({queryKey:i()}),c.invalidateQueries({queryKey:y({path:{assistant_id:f??``}})}),c.invalidateQueries({queryKey:d()})},onError:e=>{C(Xe(e,s(`domainStep.registerSubdomainFailed`)))}})},children:s(`domainStep.next`)})]})})]})}function et({onGoToBilling:e,direction:t}){let{t:i}=R(`settings`);return(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-6 py-10 text-center`,children:[(0,J.jsx)(Ne,{icon:ye}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(n,{variant:`title-small`,as:`h1`,children:i(`errorStates.fetchErrorTitle`)}),(0,J.jsx)(n,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:Z(t).fetchErrorBody})]}),(0,J.jsx)(r,{variant:`primary`,"data-testid":`onboarding-go-to-billing`,onClick:e,children:i(`errorStates.goToBilling`)})]})}function tt(e){let{targets:t,fromSnapshot:n,machineFloor:r,credits:i}=e,a=[];return t.machineSize==null?r!=null&&n.machineSize!=null&&n.machineSize!==r&&a.push({key:`machine`,label:`Machine`,from:G[n.machineSize],to:G[r]}):n.machineSize!==t.machineSize&&a.push({key:`machine`,label:`Machine`,from:n.machineSize==null?void 0:G[n.machineSize],to:G[t.machineSize]}),t.storageGib!=null&&(n.storageGib==null||t.storageGib>n.storageGib)&&a.push({key:`storage`,label:`Storage`,from:n.storageGib==null?void 0:`${n.storageGib} GB`,to:`${t.storageGib} GB`}),i!=null&&a.push({key:`credits`,label:i.label??`Credits`,from:i.from,to:i.to}),a}var nt=220;function $({items:e,visible:t=!0,toWord:n,className:r=``,testId:i=`upgrade-metrics`}){let[a,o]=(0,q.useState)(!1);(0,q.useEffect)(()=>{let e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)},[]);let s=t&&a;return(0,J.jsx)(`div`,{"aria-hidden":!t,"data-testid":i,"data-visible":t?`true`:`false`,className:`flex flex-col items-center gap-3 md:flex-row md:items-stretch md:gap-0 ${r}`,children:e.map((e,t)=>(0,J.jsxs)(`div`,{"data-testid":e.key?`chip-${e.key}`:void 0,className:`flex flex-col items-center gap-1 px-6 transition-[opacity,transform] duration-500 ease-out motion-reduce:transition-none ${s?`translate-y-0 opacity-100`:`translate-y-2 opacity-0`} ${t>0?`md:border-l md:border-[var(--border-subtle)]`:``}`,style:{transitionDelay:s?`${t*nt}ms`:`0ms`},children:[(0,J.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-[0.08em] text-[var(--content-tertiary)]`,children:e.label}),(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 whitespace-nowrap text-[var(--content-emphasised)]`,style:{fontFamily:`var(--font-serif)`,fontSize:`20px`,lineHeight:1.2},children:[e.from!=null&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:e.from}),n&&(0,J.jsx)(`span`,{className:`sr-only`,children:n}),(0,J.jsx)(ve,{className:`size-3.5 text-[var(--content-tertiary)]`,"aria-hidden":`true`})]}),(0,J.jsx)(`span`,{children:e.to}),e.landed&&(0,J.jsx)(_e,{"data-testid":`chip-check`,className:`size-3.5 text-[var(--system-positive-strong)]`,"aria-hidden":`true`}),e.status&&(0,J.jsx)(`span`,{className:`sr-only`,children:e.status})]})]},e.key??e.label))})}var rt=48;function it(e,t,n,r,i){let a=i*i,o=a*i;return .5*(2*t+(-e+n)*i+(2*e-5*t+4*n-r)*a+(-e+3*t-3*n+r)*o)}function at(e,t,n){let r=e.map(e=>({x:e.fx*t,y:e.fy*n,size:e.fs*n})),i=[],a=[],o=[],s=[],c=[],l=[],u=0;for(let e=0;e<r.length-1;e++){let t=r[Math.max(0,e-1)],n=r[e],c=r[e+1],l=r[Math.min(r.length-1,e+2)],d=e===r.length-2?rt+1:rt;for(let e=0;e<d;e++){let r=e/rt,d=it(t.x,n.x,c.x,l.x,r),f=it(t.y,n.y,c.y,l.y,r);i.length>0&&(u+=Math.hypot(d-i[i.length-1],f-a[a.length-1])),i.push(d),a.push(f),o.push(n.size+(c.size-n.size)*r),s.push(u)}}for(let e=0;e<i.length;e++){let t=Math.max(0,e-1),n=Math.min(i.length-1,e+1),r=i[n]-i[t],o=a[n]-a[t],s=Math.hypot(r,o)||1;c.push(r/s),l.push(o/s)}return{length:u,at:e=>{let t=Math.min(u,Math.max(0,e)),n=0,r=s.length-1;for(;n<r;){let e=n+r>>1;s[e]<t?n=e+1:r=e}let d=Math.max(1,n),f=d-1,p=s[d]-s[f]||1,m=(t-s[f])/p,h=c[f]+(c[d]-c[f])*m,g=l[f]+(l[d]-l[f])*m,_=Math.hypot(h,g)||1;return{x:i[f]+(i[d]-i[f])*m,y:a[f]+(a[d]-a[f])*m,tx:h/_,ty:g/_,size:o[f]+(o[d]-o[f])*m}}}}function ot(e,t){if(t<=0)return 0;let n=e%t;return n<0?n+t:n}function st(e,t){let n=[],r=0;for(;r<e.length;)n.push(r),r+=Math.max(1,e.at(r).size*t);return n}var ct={around:[{fx:.2,fy:-.16,fs:.02},{fx:.23,fy:0,fs:.024},{fx:.34,fy:.12,fs:.03},{fx:.52,fy:.19,fs:.037},{fx:.7,fy:.26,fs:.046},{fx:.85,fy:.4,fs:.058},{fx:.88,fy:.56,fs:.074},{fx:.76,fy:.71,fs:.095},{fx:.56,fy:.82,fs:.12},{fx:.4,fy:.93,fs:.15},{fx:.3,fy:1.08,fs:.185},{fx:.24,fy:1.28,fs:.22}],below:[{fx:1.16,fy:0,fs:.03},{fx:.95,fy:.06,fs:.036},{fx:.68,fy:.16,fs:.048},{fx:.4,fy:.3,fs:.065},{fx:.22,fy:.47,fs:.09},{fx:.32,fy:.64,fs:.125},{fx:.56,fy:.8,fs:.17},{fx:.58,fy:.98,fs:.22},{fx:.46,fy:1.22,fs:.27},{fx:.36,fy:1.5,fs:.3}]},lt={around:.24,below:.32},ut=.95,dt=.95,ft=1,pt=8,mt=20260922,ht=50;function gt({className:e=``,layout:t=`around`,flow:n=`down`,speed:r=1,lanes:i=3,paused:a=!1}){let o=f(),s=(0,q.useRef)(null),c=(0,q.useRef)({flow:n,speed:r,paused:a});return(0,q.useEffect)(()=>{c.current={flow:n,speed:r,paused:a}},[n,r,a]),(0,q.useEffect)(()=>{let e=s.current;if(!e||!o)return;let n=e.getContext(`2d`);if(!n)return;let r=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,a=0,u=0,d=null,f=1/0,p=[],m=0,h=new Map,g=(e,t)=>{let n=Math.max(1,Math.round(t/pt))*pt,r=`${e.bodyIdx}-${e.eyeIdx}-${e.colorIdx}-${n}`,i=h.get(r);if(i!==void 0)return i;let a=l(o,e.bodyIdx,e.eyeIdx,e.colorIdx,n);return h.set(r,a),a},_=()=>{let r=e.getBoundingClientRect();if(r.width===0||r.height===0||Math.abs(r.width-a)<1&&Math.abs(r.height-u)<1)return;let s=d,c=p.map(e=>e.distance);a=r.width,u=r.height;let l=Math.min(2,window.devicePixelRatio||1);e.width=Math.round(a*l),e.height=Math.round(u*l),n.setTransform(l,0,0,l,0,0),d=at(ct[t],a,u),f=u*lt[t];let m=v(mt),h=e=>(m()*2-1)*e,g=-1;if(p=[],st(d,ut).forEach((e,t)=>{let n=t%2==0?0:.5;for(let t=0;t<i;t++){let r=Math.floor(m()*o.colors.length);r===g&&(r=(r+1)%o.colors.length),g=r,p.push({distance:e,lane:t-(i-1)/2+n,jitterAlong:h(.08),jitterAcross:h(.12),sizeScale:.85+m()*.3,rotate:h(10)*Math.PI/180,phase:m()*Math.PI*2,bodyIdx:Math.floor(m()*o.bodyShapes.length),eyeIdx:Math.floor(m()*o.eyeStyles.length),colorIdx:r})}}),s&&s.length>0){let e=d.length/s.length;p.forEach((t,n)=>{let r=c[n];r!==void 0&&(t.distance=ot(r*e,d.length))})}},y=e=>{if(!d)return;let t=m?Math.min(ht,e-m):0;m=e;let{flow:i,speed:o,paused:s}=c.current,l=r||s?0:(i===`down`?1:-1)*o*ft*(t/1e3);n.clearRect(0,0,a,u);for(let t of p){if(l!==0){let e=d.at(t.distance).size;t.distance=ot(t.distance+l*e,d.length)}let i=d.at(t.distance),a=Math.min(f,i.size*t.sizeScale),o=(t.lane*dt+t.jitterAcross)*i.size,s=t.jitterAlong*i.size,c=i.x+i.ty*o+i.tx*s,u=i.y-i.tx*o+i.ty*s,p=g(t,a);if(!p)continue;let m=r?0:Math.sin(e*.001+t.phase)*1.4,h=r?0:Math.sin(e*8e-4+t.phase*2)*.025;n.save(),n.translate(c,u+m),n.rotate(t.rotate+h),n.drawImage(p,-a/2,-a/2,a,a),n.restore()}};_();let b=new ResizeObserver(()=>{_(),r&&y(performance.now())});b.observe(e);let x=0;if(r)y(performance.now());else{let e=t=>{y(t),x=requestAnimationFrame(e)};x=requestAnimationFrame(e)}return()=>{cancelAnimationFrame(x),b.disconnect()}},[o,i,t]),(0,J.jsx)(`canvas`,{ref:s,"aria-hidden":`true`,"data-testid":`upgrade-stream`,className:`pointer-events-none block h-full w-full ${e}`})}function _t(e,t){if(t!=null)return e?.credit_tiers?.find(e=>e.tier===t)}function vt(e){let t=e?.match(/^credits_(\d+)$/)?.[1];return t==null?null:Number(t)}function yt(e){let t=k(),{data:n}=L({...A(),enabled:t&&e});return n?.plans.find(e=>e.id===`pro`)}function bt(e,t){return t==null?0:_t(e,t)?.credits_usd??vt(t)}function xt(e,t){return t==null?null:_t(e,t)?.label}function St(e){let t=yt(e!=null);if(e==null||t==null)return null;let n,r;if(e.kind===`package`){let i=t.packages.find(t=>t.key===e.packageKey),a=_t(t,i?.credit_tier);n=i?.credits_usd??a?.credits_usd,r=i?.usage_label??a?.label??void 0}else{let i=_t(t,e.creditTier);n=i?.credits_usd,r=i?.label}return n==null?null:{fromLabel:null,toLabel:r}}function Ct(e){let t=yt(e!=null);return e==null||bt(t,e.fromTier)==null||bt(t,e.toTier)==null?null:{fromLabel:xt(t,e.fromTier),toLabel:xt(t,e.toTier)}}function wt(e,t){let[n,r]=(0,q.useState)(e),i=(0,q.useRef)(0);return(0,q.useEffect)(()=>{i.current=performance.now()},[]),(0,q.useEffect)(()=>{if(t<=0||e===n)return;let a=t-(performance.now()-i.current);if(a<=0){i.current=performance.now(),r(e);return}let o=setTimeout(()=>{i.current=performance.now(),r(e)},a);return()=>clearTimeout(o)},[e,n,t]),t<=0?e:n}var Tt=`#ffffff`;function Et({status:e,caption:t}){return(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5`,children:[(0,J.jsx)(`h1`,{className:`text-[var(--content-emphasised)]`,style:Pe,children:e}),t&&(0,J.jsx)(n,{variant:`body-medium-lighter`,as:`p`,className:`max-w-sm text-[var(--content-secondary)]`,children:t})]})}function Dt(e,t){return e===`credits`?!0:t?.[e]===!0}function Ot(e,t){if(e==null)return null;let n=t(`provisioningState.noExtraUsage`),r=e.toLabel===null?n:e.toLabel;return r==null?null:{label:t(`provisioningState.usageLabel`),from:e.fromLabel===null?n:e.fromLabel,to:r}}function kt({intent:e,creditsChange:t,targets:n,fromSnapshot:r,machineFloor:i,landed:a,allDone:o=!1,creditsOnly:s=!1}){let{t:c}=R(`settings`),l=St(e),u=Ct(t),d=tt({targets:n,fromSnapshot:r,machineFloor:i,credits:Ot(l??u,c)}),f=s?d.filter(e=>e.key===`credits`):d,p=f.filter(e=>o||Dt(e.key,a)).map(e=>e.label).join(`, `),[m]=(0,q.useState)(p),h=p===m?``:c(`provisioningState.dimensionsComplete`,{dimensions:p});return f.length===0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)($,{items:f.map(e=>{let t=o||Dt(e.key,a);return{key:e.key,label:e.label,from:e.from??null,to:e.to,landed:t,status:c(t?`provisioningState.statusComplete`:`provisioningState.statusPending`)}}),testId:`resource-chips`,toWord:c(`provisioningState.srOnlyTo`)}),(0,J.jsx)(`p`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`chip-announcement`,children:h})]})}function At({intent:e}){let{t}=R(`settings`),n=St(e.kind===`custom`?e:null);if(e.kind===`package`){let n=e.packageKey.charAt(0).toUpperCase()+e.packageKey.slice(1);return(0,J.jsx)($,{testId:`resource-chips`,items:[{key:`package`,label:t(`provisioningState.packageLabel`),from:null,to:n}]})}let r=[];return e.machineTier!=null&&r.push({key:`machine`,label:t(`provisioningState.machineLabel`),from:null,to:Te[e.machineTier]??e.machineTier}),e.storageTier!=null&&r.push({key:`storage`,label:t(`provisioningState.storageLabel`),from:null,to:e.storageTier.toUpperCase()}),e.creditTier!=null&&n?.toLabel!=null&&r.push({key:`credits`,label:t(`provisioningState.usageLabel`),from:null,to:n.toLabel}),r.length===0?null:(0,J.jsx)($,{testId:`resource-chips`,items:r})}function jt({state:e,direction:t,softWaiting:n,intent:i,creditsChange:a,targets:o,fromSnapshot:s,machineFloor:c,landed:l,celebrating:u,onCelebrationEnd:d,escapeAvailable:f,onEscape:p,onPhaseChange:m,kickError:h,confirm:g,dwellMs:_=We,phaseMinMs:v=900}){let{t:y}=R(`settings`),b=Z(t),x=(0,q.useRef)(d);(0,q.useEffect)(()=>{x.current=d},[d]);let S=wt(e,v),C=S===`DONE`||S===`NOT_APPLICABLE`,w=S===`RESIZING`?`WAITING`:S,T=(0,q.useRef)(m);(0,q.useEffect)(()=>{T.current=m},[m]),(0,q.useEffect)(()=>{T.current?.(S)},[S]);let E=u&&C;(0,q.useEffect)(()=>{if(!E)return;let e=setTimeout(()=>x.current(),_);return()=>clearTimeout(e)},[E,_]);let O=D(),k=S===`STALLED`,ee=(0,J.jsx)(`div`,{className:`relative z-10 flex w-full flex-col items-center gap-6 [animation:onboarding-step-in_420ms_ease-out] motion-reduce:[animation:none]`,children:M()},w);if(O)return(0,J.jsxs)(`div`,{"data-testid":`provisioning-takeover`,"data-theme":`light`,className:`relative flex h-full min-h-[420px] w-full flex-col overflow-hidden text-center`,style:{backgroundColor:Tt},children:[(0,J.jsx)(`div`,{className:`px-6 pb-8 pt-16`,children:ee}),(0,J.jsx)(`div`,{className:`relative min-h-0 flex-1`,children:(0,J.jsx)(gt,{className:`absolute inset-0`,layout:`below`,paused:k})})]});return(0,J.jsxs)(`div`,{"data-testid":`provisioning-takeover`,"data-theme":`light`,className:`relative flex h-full min-h-[420px] w-full flex-col items-center justify-center overflow-hidden px-6 py-10 text-center`,style:{backgroundColor:Tt},children:[(0,J.jsx)(gt,{className:`absolute inset-0`,layout:`around`,paused:k}),(0,J.jsx)(`div`,{className:`relative z-10 mr-[16%] flex w-full max-w-2xl flex-col items-center`,children:ee})]});function A(e=y(`provisioningState.continueInBackground`)){return f?(0,J.jsx)(r,{variant:`ghost`,"data-testid":`provisioning-escape`,onClick:p,children:e}):null}function j({allDone:e=!1,creditsOnly:t=!1}={}){return(0,J.jsx)(kt,{intent:i,creditsChange:a,targets:o,fromSnapshot:s,machineFloor:c,landed:l,allDone:e,creditsOnly:t})}function M(){if(S===`CONFIRMING`)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Et,{status:b.confirmingStatus,caption:y(`provisioningState.confirmingCaption`)}),i&&(0,J.jsx)(At,{intent:i}),A()]});if(S===`WAITING`||S===`RESIZING`)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Et,{status:b.waitingStatus,caption:y(n?`provisioningState.waitingCaptionLong`:`provisioningState.waitingCaptionShort`)}),j(),A()]});if(S===`DONE`)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Et,{status:y(`provisioningState.allDoneStatus`)}),j({allDone:!0})]});if(S===`NOT_APPLICABLE`)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Et,{status:y(`provisioningState.planReadyStatus`)}),j({allDone:!0,creditsOnly:!0})]});if(S===`STALLED`){let e=h!=null;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Et,{status:e?b.snagStatus:y(`provisioningState.takingLongerStatus`),caption:e?Xe(h,b.snagCaption,t):y(`provisioningState.stalledCaption`)}),j(),e?A(y(`provisioningState.retryInBackground`)):A()]})}return S===`CONFIRM_TIMEOUT`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Et,{status:b.confirmTimeoutStatus,caption:b.confirmTimeoutCaption}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,J.jsx)(r,{variant:`outlined`,"data-testid":`onboarding-go-to-billing`,onClick:g.onGoToBilling,children:y(`provisioningState.goToBilling`)}),(0,J.jsx)(r,{variant:`primary`,"data-testid":`onboarding-retry`,onClick:g.onRetry,children:y(`provisioningState.tryAgain`)})]})]}):null}}function Mt(e){let{planId:t,targets:n,actuals:r,initialActuals:i,resizeOperationInFlight:a,sawOperation:o,msSinceWatchStart:s,confirmExpired:c,serverVerdict:l=null,statusObservedSinceTargetsMet:u=!0,targetsProveNoop:d=!0}=e;if(t!==`pro`)return{state:c?`CONFIRM_TIMEOUT`:`CONFIRMING`,softWaiting:!1};let f=o||a,p=l===`started`||l===`in_progress`,m=o||d&&u;if(!a){let e=p?m:f||l===`already_done`||i!=null&&!De(n,i);if(De(n,r)){if(e)return{state:`DONE`,softWaiting:!1};if(!p&&(d||l===`not_applicable`))return{state:`NOT_APPLICABLE`,softWaiting:!1}}else{if(l===`already_done`)return{state:`DONE`,softWaiting:!1};if(l===`not_applicable`)return{state:`NOT_APPLICABLE`,softWaiting:!1}}}return s!=null&&s>=9e4?{state:`STALLED`,softWaiting:!1}:f||l===`started`||l===`in_progress`?{state:`RESIZING`,softWaiting:!1}:{state:`WAITING`,softWaiting:s!=null&&s>=3e4}}var Nt=2e3,Pt=1e3,Ft=[`DONE`,`NOT_APPLICABLE`,`CONFIRM_TIMEOUT`],It={assistantId:null,machine:null,storage:null};function Lt({open:e,canLowerResources:t=!1,verdictRecheckMs:n=Ke}){let r=B(),i=k(),[a,o]=(0,q.useState)(!1),[s,l]=(0,q.useState)(0),[u,f]=(0,q.useState)(null),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(null),[v,y]=(0,q.useState)(null),[b,C]=(0,q.useState)(null),[T,E]=(0,q.useState)(null),[D,ee]=(0,q.useState)(It),[A,j]=(0,q.useState)(null),[M,N]=(0,q.useState)(!1),te=(0,q.useRef)(!1),ne=(0,q.useRef)(!1),P=(0,q.useRef)(0),[re,ie]=(0,q.useState)(!1),[ae,oe]=(0,q.useState)(null),[F,I]=(0,q.useState)(null),[ce,ue]=(0,q.useState)(null),[R,z]=(0,q.useState)(()=>Date.now()),[me,he]=(0,q.useState)(!0);(0,q.useEffect)(()=>{e||(o(!1),l(0),f(null),m(null),g(null),ie(!1),oe(null),I(null),ue(null),he(!0),y(null),C(null),E(null),ee(It),j(null),N(!1),te.current=!1,ne.current=!1,P.current+=1)},[e]),(0,q.useEffect)(()=>{e&&(f(Date.now()),r.invalidateQueries({queryKey:_()}),r.invalidateQueries({queryKey:d()}))},[e,r]);let V=p!=null,ge=L({...c(),refetchInterval:e=>e.state.data?.plan_id===`pro`||a?!1:He,refetchIntervalInBackground:!1,enabled:e&&i&&!V}),_e=(u!=null&&ge.dataUpdatedAt>=u?ge.data?.plan_id:null)??null;(0,q.useEffect)(()=>{if(!e||V||_e!==`pro`)return;let t=Date.now();m(t),z(t)},[e,V,_e]),(0,q.useEffect)(()=>{if(!e||V)return;let t=setTimeout(()=>o(!0),Ue);return()=>clearTimeout(t)},[e,V,s]);let ve=(0,q.useCallback)(()=>{o(!1),l(e=>e+1),se.getState().fetchOrganizations(),r.invalidateQueries({queryKey:_()})},[r]),ye=(0,q.useCallback)(()=>{let e=Date.now();g(e),z(e)},[]),{mutate:be}=de(le()),H=(0,q.useCallback)(e=>{let t=P.current;be({},{onSuccess:n=>{t===P.current&&(j(null),ke(n)?ne.current?j({error:n.reason??`no_active_pro`}):(ne.current=!0,N(!0),e===`escape`&&ye()):(y(n.state),e===`escape`&&ye()))},onError:e=>{t===P.current&&j(e)}})},[be,ye]);(0,q.useEffect)(()=>{!e||!i||!V||te.current||(te.current=!0,H(`auto`))},[e,i,V,H]),(0,q.useEffect)(()=>{if(!M)return;let e=P.current,t=setTimeout(()=>{N(!1),e===P.current&&H(`auto`)},Ge);return()=>clearTimeout(t)},[M,H]);let xe=(0,q.useCallback)(()=>H(`escape`),[H]),U=L({...S(),enabled:e&&i&&V}),W=me?Nt:!1,Se=L({...x(),enabled:e&&i&&V,refetchInterval:e=>e.state.data?.id==null?W:!1,retry:!1}),G=V&&u!=null&&U.dataUpdatedAt>=u,Te=G&&!U.isPending&&!U.isFetching,K=(G?U.data?.primary_assistant_id:null)??(U.isPending?null:Se.data?.id??null),Me=L({...O({path:{id:K??`unresolved`}}),enabled:e&&i&&V&&K!=null,refetchInterval:W,retry:!1}),J=w({path:{id:K??`unresolved`}}),Ne=L({...J,enabled:e&&i&&V&&K!=null,refetchInterval:W,retry:!1}),Pe=(0,q.useRef)(0),[Fe,Ie]=(0,q.useState)(0),Le=fe(J.queryKey);(0,q.useEffect)(()=>r.getQueryCache().subscribe(t=>{if(!(t.type!==`updated`||t.query.queryHash!==Le)){if(t.action.type===`fetch`)Pe.current+=1;else if(t.action.type===`success`&&!t.action.manual){let n=Pe.current,r=e&&Ae(t.action.data);pe.schedule(()=>{Ie(n),r&&(ie(!0),oe(K))})}}}),[r,Le,e,K]);let Re=Ae(Ne.data),ze=ae===K,Y=U.data,X=(0,q.useMemo)(()=>Y?{machineSize:Ce(Y.max_machine_tier),storageGib:Y.selected_storage_gib??null}:null,[Y]),Z=Y!=null&&Y.max_machine_tier==null?Ee:null,Be=Y?Y.domain_setup_available&&Y.primary_assistant_id!=null:void 0,Ve=Me.data,Q=(0,q.useMemo)(()=>Ve?{machineSize:Ve.machine_size??null,storageGib:Ve.provisioned_storage_gib??null}:null,[Ve]),We=ce===K,qe=(0,q.useMemo)(()=>{let e=je(X,Q),t=X?.machineSize??Z;if(t==null)return e;let n=Q?.machineSize??null;if(n==null)return{...e,machine:!1};let r=(We?F?.machineSize:null)??n,i=we(t)<we(r);return{...e,machine:i?we(n)<=we(t):we(n)>=we(t)}},[X,Q,F,We,Z]),Je=De(X,Q),Ye=T===K;(0,q.useEffect)(()=>{e&&(Je?(C(e=>e!=null&&Ye?e:Date.now()),E(K)):(C(null),E(null)))},[e,Je,K,Ye]);let Xe=D.assistantId===K;(0,q.useEffect)(()=>{if(!e)return;let t=Pe.current;ee(e=>{let n=e.assistantId===K?e:It,r=qe.machine?n.machine??t:null,i=qe.storage?n.storage??t:null;return e.assistantId===K&&e.machine===r&&e.storage===i?e:{assistantId:K,machine:r,storage:i}})},[e,qe,K]);let Ze=(0,q.useMemo)(()=>{let e=Oe(Ne.data),t=e=>e!=null&&Xe&&Fe>e;return{machine:qe.machine&&!e.machine&&t(D.machine),storage:qe.storage&&!e.storage&&t(D.storage)}},[qe,D,Xe,Fe,Ne.data]);(0,q.useEffect)(()=>{!e||!Q||F!=null&&We||(I(Q),ue(K))},[e,Q,K,F,We]);let Qe=h??p,$e=Qe==null?null:Math.max(0,R-Qe),et=!t,{state:tt,softWaiting:nt}=Mt({planId:V?`pro`:_e,targets:X,actuals:Q,initialActuals:We?F:null,resizeOperationInFlight:Re,sawOperation:re&&ze,msSinceWatchStart:$e,confirmExpired:a,serverVerdict:v,statusObservedSinceTargetsMet:b!=null&&Ye&&Ne.dataUpdatedAt>b,targetsProveNoop:et}),$=Ft.includes(tt),rt=e&&V&&!$;(0,q.useEffect)(()=>{he(rt)},[rt]),(0,q.useEffect)(()=>{if(!e||!V||$)return;let t=setInterval(()=>z(Date.now()),Pt);return()=>clearInterval(t)},[e,V,$]);let it=!et&&(v===`started`||v===`in_progress`)&&!(re&&ze);return(0,q.useEffect)(()=>{if(!e||!V||$||!it)return;let t=setInterval(()=>H(`auto`),n);return()=>clearInterval(t)},[e,V,$,it,n,H]),{state:tt,softWaiting:nt,targets:X,actualsSnapshot:F,machineFloor:Z,landed:Ze,assistantId:K,domainStepAvailable:Be,onboardingSettled:Te,confirmError:!V&&ge.isError,targetsError:V&&U.isError&&(!Y||!G),escapeEligible:$e!=null&&$e>=6e4,retryConfirm:ve,kickProvisioning:xe,kickError:A}}var Rt=200,zt=380;function Bt(){return typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0}var Vt=e=>e===`WAITING`||e===`RESIZING`||e===`STALLED`,Ht=e=>e===`DONE`||e===`NOT_APPLICABLE`,Ut={machineSize:null,storageGib:null};function Wt({open:e,onClose:n,dwellMs:r,phaseMinMs:i,mode:a=`checkout`,resizeContext:o}){let{t:s}=R(`settings`),c=a===`resize`,l=B(),u=me(),d=re.use.assistantInbox(),[f,p]=(0,q.useState)(`provisioning`),[m,h]=(0,q.useState)(`idle`),g=(0,q.useRef)([]),[_,v]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(!1),E=c?o?.direction:void 0,D=Z(E),O=Lt({open:e,canLowerResources:c?o?.canLowerResources===!0:!1});(0,q.useEffect)(()=>{if(e){v(c?null:ce()),C(e=>e??Date.now());return}g.current.forEach(clearTimeout),g.current=[],p(`provisioning`),h(`idle`),x(null),C(null),T(!1)},[e,c]),(0,q.useEffect)(()=>()=>{g.current.forEach(clearTimeout)},[]),(0,q.useEffect)(()=>{f===`complete`&&t()},[f]);let k=Vt(O.state),ee=Ht(b??O.state),{targets:A,assistantId:M,domainStepAvailable:N,onboardingSettled:te}=O,ne=c?o?.fromSnapshot:void 0,ae=O.actualsSnapshot,oe={machineSize:ne?.machineSize??ae?.machineSize??null,storageGib:ne?.storageGib??ae?.storageGib??null},F=c&&N===!0,{domains:se,domainsError:le,domainsFetching:ue,domainsUpdatedAt:L,domainsErrorUpdatedAt:de}=Q(e&&F,M),fe=(se?.results.length??0)>0,z=(0,q.useRef)(null);(0,q.useEffect)(()=>{if(!e){z.current=null;return}!F||M==null||z.current!==M&&(z.current=M,l.invalidateQueries({queryKey:y({path:{assistant_id:M}})}))},[e,F,M,l]);let pe=!ue&&(S!=null&&L>=S||S!=null&&!!le&&de>=S),[he,V]=(0,q.useState)(!1),ge=te&&(!F||pe);(0,q.useEffect)(()=>{if(!e){V(!1);return}ge&&V(!0)},[e,ge]);let _e=(0,q.useCallback)(()=>{t(),n(),u(P.assistantInbox,{replace:!0})},[u,n]),ve=(0,q.useCallback)(()=>{let e=c?N===!0&&!fe?`domain`:`complete`:N===!1?`complete`:`domain`;if(e===`domain`&&d){_e();return}if(Bt()){p(e);return}h(`covering`),g.current.push(setTimeout(()=>{p(e),h(`revealing`),g.current.push(setTimeout(()=>h(`idle`),zt))},Rt))},[N,c,fe,d,_e]),ye=(0,q.useCallback)(()=>{T(!0)},[]),be=(0,q.useCallback)(()=>{O.kickProvisioning(),I.info(O.kickError==null?D.backgroundExitToast:D.backgroundRetryToast),T(!1),n()},[O,n,D]),H=(0,q.useCallback)(()=>{T(!1)},[]),xe=f===`provisioning`&&(O.confirmError||O.targetsError),U=f===`provisioning`&&!xe,W=U&&!ee,Se=`transition-[background-color] duration-300 ease-out${U?` bg-white p-0`:``}`,Ce=U?`[animation:fadeIn_0.45s_ease-out_both]`:m===`revealing`?`[animation:fadeInUp_0.42s_ease-out_0.12s_both]`:`[animation:fadeIn_0.25s_ease-out_both]`;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(j.Root,{open:e,onOpenChange:e=>{e||n()},children:(0,J.jsxs)(j.Content,{size:`md`,hideCloseButton:f!==`complete`,dismissOnOverlayClick:!W,onEscapeKeyDown:W?e=>e.preventDefault():void 0,onInteractOutside:W?e=>e.preventDefault():void 0,overlayClassName:Se,className:U?`overflow-y-auto inset-0 max-w-none w-screen h-screen max-h-none rounded-none border-0`:`overflow-hidden`,children:[(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col motion-reduce:[animation:none] ${Ce}`,children:G()},f),m!==`idle`&&(0,J.jsx)(`div`,{"aria-hidden":!0,"data-testid":`takeover-exit-sheet`,className:`pointer-events-none fixed inset-0 z-50 ${m===`covering`?`[animation:fadeIn_200ms_ease-in_both]`:`[animation:fadeIn_380ms_ease-out_both_reverse]`}`,style:{backgroundColor:`#ffffff`}})]})}),(0,J.jsx)(ie,{open:w&&k,title:s(`billingOnboardingModal.backgroundConfirmTitle`),message:D.backgroundConfirmMessage,confirmLabel:s(`billingOnboardingModal.backgroundConfirmContinue`),cancelLabel:s(`billingOnboardingModal.backgroundConfirmKeepWaiting`),onConfirm:be,onCancel:H})]});function G(){return f===`provisioning`?O.confirmError||O.targetsError?(0,J.jsx)(et,{onGoToBilling:n,direction:E}):(0,J.jsx)(jt,{state:O.state,direction:E,softWaiting:O.softWaiting,intent:_,creditsChange:c?o?.credits:void 0,targets:A??Ut,fromSnapshot:oe,machineFloor:O.machineFloor,landed:O.landed,celebrating:he,onCelebrationEnd:ve,escapeAvailable:k&&O.escapeEligible,onEscape:ye,onPhaseChange:x,kickError:O.kickError,confirm:{onRetry:O.retryConfirm,onGoToBilling:n},dwellMs:r,phaseMinMs:i}):f===`domain`?(0,J.jsx)($e,{machineBusy:k,assistantId:M,onExit:()=>p(`complete`)}):(0,J.jsx)(Ve,{assistantId:M,direction:E})}}function Gt(e){return e!=null&&!e.customized}function Kt(e){return Gt(e)?e.name:`Custom`}var qt=[`mighty`,`super`,`ultra`],Jt=[`free`,...qt];function Yt(e){return Jt.indexOf(e)}function Xt(e,t){if(e===null)return`upgrade`;let n=Yt(e),r=Yt(t);return n===-1||r===-1?`upgrade`:r===n?`current`:r<n?`downgrade`:`upgrade`}function Zt(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>qt.indexOf(e.key)-qt.indexOf(t.key));if(!t)return n[0];let r=n.findIndex(e=>e.key===t);return r===-1?n[0]:r>=n.length-1?null:n[r+1]}var Qt=[`too_expensive`,`missing_features`,`switched_service`,`unused`,`too_complex`,`low_quality`,`customer_service`,`other`],$t={too_expensive:`cancelReasonSurvey.optionTooExpensive`,missing_features:`cancelReasonSurvey.optionMissingFeatures`,switched_service:`cancelReasonSurvey.optionSwitchedService`,unused:`cancelReasonSurvey.optionUnused`,too_complex:`cancelReasonSurvey.optionTooComplex`,low_quality:`cancelReasonSurvey.optionLowQuality`,customer_service:`cancelReasonSurvey.optionCustomerService`,other:`cancelReasonSurvey.optionOther`},en=1e3,tn={feedback:null,comment:``};function nn(e){return e.feedback!=null}function rn(e){let t=e.feedback===`other`?e.comment.trim():``;return{feedback:e.feedback,comment:t||null}}function an({value:e,onChange:t,disabled:r}){let{t:i}=R(`settings`);return(0,J.jsxs)(`div`,{className:`mt-5 space-y-3`,"data-testid":`cancel-reason-survey`,children:[(0,J.jsx)(n,{as:`p`,variant:`body-medium-default`,children:i(`cancelReasonSurvey.title`)}),(0,J.jsx)(ae,{value:e.feedback??``,onValueChange:n=>t({...e,feedback:n===``?null:n}),name:`cancel-reason`,disabled:r,"aria-label":i(`cancelReasonSurvey.title`),children:Qt.map(e=>(0,J.jsx)(M,{value:e,label:i($t[e])},e))}),e.feedback===`other`?(0,J.jsx)(ee,{label:i(`cancelReasonSurvey.otherLabel`),placeholder:i(`cancelReasonSurvey.otherPlaceholder`),value:e.comment,onChange:n=>t({...e,comment:n.target.value}),maxLength:en,rows:3,disabled:r,fullWidth:!0,"data-testid":`cancel-reason-comment`}):null]})}var on={free:{bodyShape:`ninja`,eyeStyle:`angry`,color:`yellow`},mighty:{bodyShape:`cloud`,eyeStyle:`grumpy`,color:`green`},super:{bodyShape:`urchin`,eyeStyle:`goofy`,color:`teal`},ultra:{bodyShape:`sprout`,eyeStyle:`curious`,color:`orange`}};function sn({tier:e,size:t=40}){let n=on[e]??on.free,r=f();return(0,J.jsx)(`div`,{"aria-hidden":!0,className:`inline-flex shrink-0`,children:r?(0,J.jsx)(h,{components:r,bodyShapeId:n.bodyShape,colorId:n.color,size:t}):(0,J.jsx)(`div`,{style:{width:t,height:t}})})}var cn={free:{tagline:`Get to know your assistant.`,cta:`Start Free`,priceCaption:`Forever`},mighty:{tagline:`More capacity for consistent use.`,cta:`Power Up`,priceCaption:`Billed monthly`,recommended:!0},super:{tagline:`Do more, think less about the how.`,cta:`Go Super`,priceCaption:`Billed monthly`,extraFeatures:[`Assistant email and subdomain`]},ultra:{tagline:`Your second brain, running full speed.`,cta:`Unleash Ultra`,priceCaption:`Billed monthly`,extraFeatures:[`Assistant email and subdomain`]}};function ln(e){return cn[e]}function un(e){return`Downgrade to ${e}`}function dn(e){let t=e/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function fn(e){return`${dn(e)}/mo`}function pn(e){return`${dn(e)}/month`}function mn(e){return`${e>0?`+`:`−`}${dn(Math.abs(e))}/mo`}function hn(e){return`${e} GB storage`}function gn(e){return`${dn(e*100)} of bundled credits`}var _n=`Small`;function vn(e){return e?.machine_size?G[e.machine_size]??e.machine_size:_n}function yn(e,t){let n=ln(e.key)?.extraFeatures??[];return[{icon:Me,label:`${vn(e)} Machine`},{icon:W,label:`${e.storage_gib} GB Storage`},{icon:U,label:t},...n.map(e=>({icon:be,label:e}))]}function bn(){return[{icon:Me,label:`${_n} Machine`},{icon:W,label:`4 GB Storage`},{icon:U,label:`Pay as you go credits`}]}function xn(e,t=[]){let n=e?.credits_usd??0,r=e?.storage_gib??4,i=K[e?.machine_size??`small`];return[`${vn(e)} machine${i?` (${i})`:``}`,hn(r),e?.usage_label??gn(n),...t]}var Sn={machine:`Configurable machine size`,storage:`Configurable storage`,credits:`Pay-as-you-go and bundled credits`};function Cn(e,t){let n=[`${e.machineTier?Te[e.machineTier]??t.machine_tiers.find(t=>t.tier===e.machineTier)?.label??e.machineTier:_n} Machine`];if(e.storageGib!=null&&n.push(`${e.storageGib} GB`),e.creditTier!=null){let r=_t(t,e.creditTier)?.label,i=vt(e.creditTier);n.push(r??(i==null?`Credit bundle`:`${i} credits/mo`))}return n}function wn(e,t){let n=new Set([Sn.machine]);return e.storageGib!=null&&n.add(Sn.storage),e.creditTier!=null&&n.add(Sn.credits),[...Cn(e,t),...t.included_features.filter(e=>!n.has(e))]}function Tn(e){return e.disabled===!0}function En({machineTiers:e,storageTiers:t,selectedMachineTier:r,selectedStorageTier:i,onMachineTierChange:a,onStorageTierChange:o,currentMachinePriceCents:s,currentStoragePriceCents:c}){let{t:l}=R(`settings`),u=(0,q.useMemo)(()=>e.map(e=>{let t=Te[e.tier]??e.label,n=s==null?l(`tierPicker.priceAddon`,{price:fn(e.price_cents)}):e.price_cents===s?l(`tierPicker.priceCurrent`,{price:fn(e.price_cents)}):mn(e.price_cents-s);return{value:e.tier,label:l(`tierPicker.machineOption`,{label:t,priceLabel:n}),disabled:Tn(e)}}),[e,s,l]),d=(0,q.useMemo)(()=>t.map(e=>{let t=c==null?l(`tierPicker.priceAddon`,{price:fn(e.price_cents)}):e.price_cents===c?l(`tierPicker.priceCurrent`,{price:fn(e.price_cents)}):mn(e.price_cents-c);return{value:e.tier,label:l(`tierPicker.storageOption`,{gib:e.storage_gib,priceLabel:t}),disabled:Tn(e)}}),[t,c,l]);return(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(n,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:l(`tierPicker.machineLabel`)}),(0,J.jsx)(`span`,{title:l(`tierPicker.machineTooltip`),children:(0,J.jsx)(xe,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,J.jsx)(N,{"aria-label":l(`tierPicker.machineAriaLabel`),placeholder:l(`tierPicker.machinePlaceholder`),value:r??``,onChange:a,options:u})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(n,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:l(`tierPicker.storageLabel`)}),(0,J.jsx)(`span`,{title:l(`tierPicker.storageTooltip`),children:(0,J.jsx)(xe,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,J.jsx)(N,{"aria-label":l(`tierPicker.storageAriaLabel`),placeholder:l(`tierPicker.storagePlaceholder`),value:i??``,onChange:o,options:d})]})]})}var Dn=new Set([`active`,`trialing`,`past_due`]);function On(e){return e.plan_id!==`base`&&e.cancel_at_period_end!==!0&&!e.cancel_at&&e.status!=null&&Dn.has(e.status)}function kn(e){return e?.status!=null&&Dn.has(e.status)}var An=[`target_plan_id`,`confirm`,`machine_tier`,`storage_tier`,`credit_tier`,`package`,`non_field_errors`];function jn(e,t){if(e&&typeof e==`object`){for(let t of An)if(t in e){let n=e[t];if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}if(`detail`in e&&typeof e.detail==`string`)return e.detail}return t}function Mn(e,t){let n=e.filter(e=>!Tn(e));return t!==null&&n.some(e=>e.tier===t)?t:n[0]?.tier??null}function Nn(e,t,n){return t===void 0?n:t!==null&&(t===n||e.some(e=>e.tier===t))?t:null}function Pn(e){return e.length?Math.min(...e.map(e=>e.price_cents)):0}function Fn(){let e=B();return async t=>{try{let n=await t.mutateAsync();return await e.invalidateQueries({queryKey:_()}),t.onSuccess(n),n}catch(e){return I.error(jn(e,t.errorFallback()),{id:t.errorToastId}),null}}}var In=`billing-portal-return-snapshot`;function Ln(e){try{sessionStorage.removeItem(In),sessionStorage.setItem(In,JSON.stringify(e))}catch{}}function Rn(){if(typeof sessionStorage>`u`)return null;try{let e=sessionStorage.getItem(In);if(!e)return null;let t=JSON.parse(e);return typeof t.cancel_at_period_end!=`boolean`||typeof t.plan_id!=`string`?null:{cancel_at_period_end:t.cancel_at_period_end,cancel_at:t.cancel_at??null,plan_id:t.plan_id}}catch{return null}}function zn(){try{sessionStorage.removeItem(In)}catch{}}function Bn(e){return e?{cancel_at_period_end:e.cancel_at_period_end,cancel_at:e.cancel_at??null,plan_id:e.plan_id}:null}function Vn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function Hn(e){return e?e.cancel_at??e.current_period_end??null:null}function Un(e){let t=B();return(0,q.useEffect)(()=>g(()=>{t.invalidateQueries(c())}),[t]),p({onSuccess:t=>{e&&Ln(e),m(t.portal_url)},onError:()=>{I.error(z(`settings:useBillingPortalSession.openError`),{id:`billing-portal-session-error`})}})}function Wn(){let e=C(),t=Fn();return{cancelSubscription:n=>t({mutateAsync:()=>e.mutateAsync({body:n}),onSuccess:e=>{let t=e.cancel_at?Vn(e.cancel_at):z(`settings:useCancelSubscription.endOfBillingPeriod`);I.info(z(`settings:useCancelSubscription.canceledToast`,{date:t}),{id:`subscription-cancel`})},errorToastId:`subscription-cancel-error`,errorFallback:()=>z(`settings:useCancelSubscription.cancelFailedToast`)}),isPending:e.isPending}}function Gn(e){return Promise.all([e.invalidateQueries({queryKey:_()}),e.invalidateQueries({queryKey:ue()}),e.invalidateQueries({queryKey:d()}),e.invalidateQueries({queryKey:ne()})])}function Kn({enabled:e=!0}={}){let t=B(),{t:n}=R(`settings`),[r,i]=(0,q.useState)(null),a=(0,q.useRef)(!1),[o,s]=(0,q.useState)(!1),l=k(),u=e&&l,d=L({...c(),enabled:u}),f=d.data,p=f!=null&&f.plan_id!==`base`,m=L({...S(),enabled:u&&p}),h=L({...A(),enabled:u&&p}).data?.plans.find(e=>e.id===`pro`)?.machine_tiers??[],g=e=>h.find(t=>t.tier===e)?.price_cents??null,_=de(b()),v={machineTier:m.data?.max_machine_tier??null,storageTier:m.data?.selected_storage_tier??null,storageGib:m.data?.selected_storage_gib??null,creditTier:f?.selected_credit_tier??null,hasPlatformFee:f?.has_platform_fee??!0},y=f!=null&&f.plan_id!==`base`&&f.status!=null&&Dn.has(f.status)&&f.cancel_at_period_end!==!0&&!f.cancel_at,x=!p||!m.isPending,C=!p||m.isSuccess&&m.data!=null&&!m.isFetching&&m.dataUpdatedAt>=d.dataUpdatedAt,w=o||_.isPending,T=async(e,t=v)=>{if(a.current)return null;a.current=!0,s(!0);try{return await E(e,t)}finally{a.current=!1,s(!1)}},E=async(e,r)=>{i(null);let a=e=>(i(e),I.error(e),null),[o,s]=await Promise.all([d.refetch(),m.refetch()]),c=o.data,l=s.data;if(o.isError||s.isError||c==null||l==null)return a(n(`customPlanModal.changeFailed`));let u={machineTier:l.max_machine_tier??null,storageTier:l.selected_storage_tier??null,storageGib:l.selected_storage_gib??null,creditTier:c.selected_credit_tier??null,hasPlatformFee:c.has_platform_fee??!0},f={machineTier:e.machineTier===r.machineTier?u.machineTier:e.machineTier,storageTier:e.storageTier===r.storageTier&&u.storageTier!=null?u.storageTier:e.storageTier,creditTier:e.creditTier===r.creditTier?u.creditTier:e.creditTier},p=f.machineTier!==u.machineTier,h=f.storageTier!==u.storageTier,v=f.creditTier!==u.creditTier,y=!u.hasPlatformFee,b=g(f.machineTier),x=g(u.machineTier),S=p&&b!=null&&x!=null&&b<x;if(!p&&!h&&!v&&!y)return{needsResize:!1,creditChanged:!1};let C;try{C=(await _.mutateAsync({body:{machine_tier:f.machineTier,storage_tier:f.storageTier,credit_tier:f.creditTier}})).status}catch(e){return a(jn(e,n(`customPlanModal.changeFailed`)))}return await Gn(t),C===`no_op`?{needsResize:!1,creditChanged:!1}:{needsResize:h||p&&!S,creditChanged:v}};return{changeTiers:T,isPending:w,error:r,current:v,eligible:y,currentReady:x,currentKnown:C,primaryAssistantId:C?m.data?.primary_assistant_id??null:null}}function qn(){let e=B(),{t}=R(`settings`),n=de(b());return{changePackage:async r=>{try{let t=await n.mutateAsync({body:{package:r}});return await Gn(e),t}catch(e){return I.error(jn(e,t(`customPlanModal.changeFailed`))),null}},isPending:n.isPending}}function Jn({className:e,"data-testid":t,children:n}){return(0,J.jsx)(`div`,{"aria-hidden":!0,"data-testid":t,className:F(`flex size-[52px] shrink-0 items-center justify-center rounded-xl`,e),children:n})}var Yn=32;function Xn(){let e=E.use.activeAssistantId(),{components:t,traits:n,customImageUrl:r,isLoading:i}=s(e);return(0,J.jsx)(Jn,{"data-testid":`assistant-avatar-tile`,className:`bg-[var(--surface-active)]`,children:e!=null&&!i?(0,J.jsx)(T,{components:t,traits:n,customImageUrl:r,size:Yn}):null})}var Zn=`Billed monthly · prorated difference charged today`,Qn=`Billed monthly · prorated difference charged today or credited next invoice`,$n=`Billed monthly · prorated credit on your next invoice`,er=`Your machine downsizes now and your storage stays. No refund.`,tr=`Continue`,nr=`The plan includes`,rr=`Your plan will include`;function ir(e,t,n){let r=n?ln(n)?.tagline??``:``;switch(e){case`downgrade`:return{title:un(t),subtitle:``,priceCaption:$n,checklistHeading:rr,note:er,confirmLabel:un(t),destructive:!0};case`switch`:return{title:`Switch to ${t}`,subtitle:r,priceCaption:Qn,checklistHeading:nr,note:``,confirmLabel:tr,destructive:!1};default:return{title:`Upgrade to ${t}`,subtitle:r,priceCaption:Zn,checklistHeading:nr,note:``,confirmLabel:tr,destructive:!1}}}function ar({open:e,relation:t,packageName:i,targetPackage:a,pending:o,onCancel:s,onConfirm:c}){let{t:l}=R(`settings`),u=(0,q.useRef)(null),d=(0,q.useId)(),f=ir(t,i,a?.key??null),p=a?{price:fn(a.total_price_cents),highlights:xn(a,ln(a.key)?.extraFeatures??[])}:null,m=f.subtitle,h=f.note?{"aria-describedby":d}:m?{}:{"aria-describedby":void 0};return(0,J.jsx)(j.Root,{open:e,onOpenChange:e=>{!e&&!o&&s()},children:(0,J.jsxs)(j.Content,{size:`sm`,hideCloseButton:!0,className:`gap-4 p-4 max-w-[421px]`,onOpenAutoFocus:e=>{e.preventDefault(),u.current?.focus()},...h,children:[(0,J.jsxs)(j.Header,{className:`flex-row items-center gap-3 p-0 pb-2`,children:[f.destructive?(0,J.jsx)(Jn,{"data-testid":`package-switch-warning-tile`,className:`bg-[var(--system-negative-weak)]`,children:(0,J.jsx)(ge,{className:`size-6 text-[var(--system-negative-strong)]`})}):(0,J.jsx)(Xn,{}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,J.jsx)(j.Title,{className:`text-title-small text-[var(--content-emphasised)] [&>span]:whitespace-normal`,children:f.title}),m?(0,J.jsx)(j.Description,{className:`mt-0 text-body-medium-default text-[var(--content-tertiary)]`,children:m}):null]})]}),p?(0,J.jsxs)(j.Body,{className:`flex flex-col gap-4 p-0`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,J.jsx)(n,{as:`p`,variant:`title-large`,className:`text-[var(--content-default)]`,children:p.price}),(0,J.jsx)(n,{as:`p`,variant:`label-medium-default`,className:`leading-[15px] text-[var(--content-tertiary)]`,children:f.priceCaption})]}),(0,J.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,J.jsx)(n,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,children:f.checklistHeading}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-2`,children:p.highlights.map(e=>(0,J.jsxs)(`li`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(Se,{className:`size-4 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,J.jsx)(n,{as:`span`,variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]},e))})]}):null,f.note?(0,J.jsx)(n,{id:d,as:`p`,variant:`body-medium-default`,className:`text-[var(--content-secondary)]`,children:f.note}):null,(0,J.jsxs)(j.Footer,{className:`flex-col gap-4 p-0`,children:[(0,J.jsx)(r,{fullWidth:!0,variant:f.destructive?`danger`:`primary`,onClick:c,disabled:o,"data-testid":`confirm-package-switch-button`,children:f.confirmLabel}),(0,J.jsx)(r,{ref:u,fullWidth:!0,variant:`ghost`,onClick:s,disabled:o,children:l(`packageSwitchConfirmModal.cancel`)})]})]})})}function or(){let e=B();(0,q.useEffect)(()=>g(()=>{Gn(e)}),[e])}export{fn as A,Gt as B,wn as C,yn as D,vn as E,an as F,Q as G,Kt as H,tn as I,Be as K,nn as L,hn as M,ln as N,mn as O,sn as P,rn as R,Tn as S,bn as T,Xt as U,Zt as V,Wt as W,On as _,Gn as a,Mn as b,zn as c,Rn as d,Un as f,kn as g,jn as h,Kn as i,pn as j,dn as k,Vn as l,Dn as m,ar as n,Wn as o,Fn as p,Me as q,qn as r,Bn as s,or as t,Hn as u,Pn as v,Cn as w,En as x,Nn as y,qt as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ka as t,Ni as n,Wa as r,Za as i,qa as a}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ka as t,Ni as n,Wa as r,Za as i,qa as a}from"./app-XG_RF2yi.js";import{x as o}from"./react-B9IgSVeK.js";var s=e(o(),1),c=.25;function l(e){e.style.transition=``,e.style.transform=``,e.style.willChange=``,e.style.opacity=``}function u({containerRef:e,onBack:o,enabled:u,navKey:d,prefetchHref:f}){let p=(0,s.useRef)(o);(0,s.useLayoutEffect)(()=>{p.current=o},[o]);let m=(0,s.useRef)(f);(0,s.useLayoutEffect)(()=>{m.current=f},[f]);let h=(0,s.useRef)(!1),g=(0,s.useRef)(new Set),_=(0,s.useRef)(!1),v=r.use.registerBackOwner(),y=r.use.unregisterBackOwner();(0,s.useEffect)(()=>{if(u)return v(),y},[u,v,y]),(0,s.useEffect)(()=>{_.current=!1;let t=g.current;return()=>{_.current=!0;for(let e of t)clearTimeout(e);t.clear();let n=e.current;n&&l(n)}},[e]);let b=(e,t)=>{let n=setTimeout(()=>{g.current.delete(n),_.current||e()},t);g.current.add(n)},x=(e,t)=>{e.style.transform=t===0?``:`translateX(${t}px)`},S=e=>{e.style.transition=`transform 200ms ${i}`,x(e,0);let t=()=>{e.removeEventListener(`transitionend`,t),l(e)};e.addEventListener(`transitionend`,t,{once:!0}),b(()=>l(e),250)},C=e=>{e.style.transition=`transform 150ms ${i}`,x(e,window.innerWidth);let t=!1,n=()=>{if(t||_.current)return;t=!0,e.removeEventListener(`transitionend`,n);let r=-(window.innerWidth*c);e.style.transition=`none`,e.style.transform=`translateX(${r}px)`,e.style.opacity=`0`,e.offsetWidth,h.current=!0,p.current(),b(()=>{h.current&&(h.current=!1,l(e))},400)};e.addEventListener(`transitionend`,n,{once:!0}),b(n,200)};a({enabled:u,onConfirm:()=>{n(m.current);let t=e.current;t&&(t.style.transition=`none`,t.style.willChange=`transform`)},onMove:(n,r)=>{let i=e.current;i&&x(i,t(n,r))},onCommit:()=>{let t=e.current;if(!t){p.current();return}C(t)},onCancel:t=>{let n=e.current;n&&(t?S(n):l(n))}}),(0,s.useLayoutEffect)(()=>{if(!h.current)return;h.current=!1;let t=e.current;if(!t)return;let n=!1,r=()=>{n||(n=!0,t.removeEventListener(`transitionend`,r),l(t))};t.style.transition=`transform 200ms ${i}, opacity 200ms ${i}`,t.style.transform=``,t.style.opacity=``,t.addEventListener(`transitionend`,r,{once:!0});let a=setTimeout(r,250);return()=>{clearTimeout(a),t.removeEventListener(`transitionend`,r),l(t)}},[d,e])}export{u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{_a as t,ga as n,hg as r,va as i}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{_a as t,ga as n,hg as r,va as i}from"./app-XG_RF2yi.js";import{x as a}from"./react-B9IgSVeK.js";var o=e(a(),1),s={ArrowUp:`Up`,ArrowDown:`Down`,ArrowLeft:`Left`,ArrowRight:`Right`,Enter:`Return`,NumpadEnter:`Return`,Space:`Space`,Tab:`Tab`,Escape:`Escape`,Backspace:`Backspace`,Delete:`Delete`,Insert:`Insert`,Home:`Home`,End:`End`,PageUp:`PageUp`,PageDown:`PageDown`,Minus:`-`,Equal:`=`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Semicolon:`;`,Quote:`'`,Backquote:"`",Comma:`,`,Period:`.`,Slash:`/`},c=new Set([`MetaLeft`,`MetaRight`,`ControlLeft`,`ControlRight`,`AltLeft`,`AltRight`,`ShiftLeft`,`ShiftRight`]),l=e=>{let t=e.code;return c.has(t)?null:/^Key[A-Z]$/.test(t)?t.slice(3):/^Digit[0-9]$/.test(t)?t.slice(5):/^Numpad[0-9]$/.test(t)?`num${t.slice(6)}`:/^F[0-9]{1,2}$/.test(t)?t:s[t]??null},u=(e,t=`macos`)=>{let n=l(e);if(n===null)return null;let r=[];return t===`windows`||t===`linux`?(e.ctrlKey&&r.push(`CmdOrCtrl`),e.metaKey&&r.push(`Super`)):(e.metaKey&&r.push(`CmdOrCtrl`),e.ctrlKey&&r.push(`Control`)),e.altKey&&r.push(`Alt`),e.shiftKey&&r.push(`Shift`),[...r,n].join(`+`)},d={macos:new Set([`Command`,`Cmd`,`CommandOrControl`]),windows:new Set([`Control`,`Ctrl`,`CommandOrControl`]),linux:new Set([`Control`,`Ctrl`,`CommandOrControl`])},f=(e,t=`macos`)=>{let n=d[t],r=e.split(`+`).map(e=>n.has(e)?`CmdOrCtrl`:e),i=r.pop()??``;return[...new Set(r)].sort().concat(i).join(`+`)},p=(e,t,n,r=`macos`)=>{if(n===``)return null;let i=f(n,r);return e.find(e=>e.key!==t&&e.accelerator!==``&&f(e.accelerator,r)===i)??null};function m(e){let a=e?.onBound,[s,c]=(0,o.useState)([]),[l,d]=(0,o.useState)(null),[f,m]=(0,o.useState)(null),h=(0,o.useCallback)(()=>{n().then(c)},[]);(0,o.useEffect)(()=>(h(),t(c)),[h]);let g=(0,o.useCallback)(()=>{d(null),m(null)},[]);return(0,o.useEffect)(()=>{if(l===null)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.code===`Escape`){g();return}let t=r()??`macos`,n=u(e,t);if(n===null)return;let o=p(s,l,n,t);if(o!==null){m({key:l,label:o.label});return}i(l,n).then(()=>{a?.(l),h()}).catch(()=>{h()}),g()};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[l,s,a,h,g]),{catalog:s,recordingKey:l,conflict:f,startRecording:(0,o.useCallback)(e=>{m(null),d(e)},[]),stopRecording:g,resetHotkey:(0,o.useCallback)(e=>{let t=p(s,e,s.find(t=>t.key===e)?.defaultAccelerator??``,r()??`macos`);if(t!==null){d(null),m({key:e,label:t.label});return}g(),i(e,null).then(h)},[s,h,g]),removeHotkey:(0,o.useCallback)(e=>{g(),i(e,``).then(h)},[h,g])}}export{m as t};
|
package/dist/assets/{use-invite-link-dialog-BbFm0xLB.js → use-invite-link-dialog-DQEUmYHq.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{AC as t,Ay as n,BC as r,Ga as i,Ja as a,Rp as o,Sp as s,cC as c,gC as l,sC as u}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{AC as t,Ay as n,BC as r,Ga as i,Ja as a,Rp as o,Sp as s,cC as c,gC as l,sC as u}from"./app-XG_RF2yi.js";import{E as d,Xn as f,nr as p}from"./vendor-DwMhK7fD.js";import{t as m,x as h}from"./react-B9IgSVeK.js";import{Fn as g,Ji as _,Yn as v,i as y,li as b,tr as x}from"./icons-C0wyat6T.js";import{t as S}from"./a2a-invite-2DFcr5cK.js";var C=e(h(),1),w=m(),T=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function E({open:e,onClose:t,children:n,title:o}){let{t:s}=d(),c=(0,C.useRef)(null),l=(0,C.useRef)(null),u=(0,C.useRef)(t);(0,C.useEffect)(()=>{u.current=t});let{dragOffset:f,isDragging:p,onTouchStart:m,onTouchMove:h,onTouchEnd:g,onTouchCancel:_}=i({enabled:e,onSwipeLeft:t});return a(e),(0,C.useEffect)(()=>{if(!e)return;l.current?.focus();let t=e=>{if(e.key===`Escape`&&!e.defaultPrevented){e.preventDefault(),u.current();return}if(e.key!==`Tab`||!c.current)return;let t=c.current.querySelectorAll(T),n=t[0],r=t[t.length-1];if(!n||!r){e.preventDefault();return}let i=document.activeElement,a=c.current.contains(i);e.shiftKey?(!a||i===n)&&(e.preventDefault(),r.focus()):(!a||i===r)&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e]),e?(0,w.jsxs)(`div`,{ref:c,className:`fixed inset-0`,style:{zIndex:40},role:`dialog`,"aria-modal":`true`,"aria-label":o,children:[(0,w.jsx)(`button`,{type:`button`,"aria-label":s(`sideListDrawer.closeSidebarAria`),className:`absolute inset-0 h-full w-full cursor-default`,style:{background:`rgba(0, 0, 0, 0.4)`,zIndex:40},onClick:t}),(0,w.jsxs)(`aside`,{className:`relative flex h-full w-[80vw] max-w-xs flex-col shadow-xl`,style:{background:`var(--surface-lift)`,borderRight:`1px solid var(--border-base)`,zIndex:50,paddingTop:`var(--safe-area-inset-top, env(safe-area-inset-top, 0px))`,paddingBottom:`var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))`,paddingLeft:`var(--safe-area-inset-left, env(safe-area-inset-left, 0px))`,transform:`translateX(${f}px)`,transition:p?`none`:`transform 200ms ease-out`,touchAction:`pan-y`},onTouchStart:m,onTouchMove:h,onTouchEnd:g,onTouchCancel:_,children:[(0,w.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b px-4 py-3`,style:{borderColor:`var(--border-base)`},children:[(0,w.jsx)(`span`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:o}),(0,w.jsx)(r,{ref:l,type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,w.jsx)(y,{"aria-hidden":!0}),onClick:t,"aria-label":s(`sideListDrawer.closeAria`),tintColor:`var(--content-tertiary)`})]}),(0,w.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:n})]})]}):null}function D({onClick:e}){let{t}=d();return(0,w.jsx)(r,{type:`button`,variant:`ghost`,iconOnly:(0,w.jsx)(g,{"aria-hidden":!0}),onClick:e,"aria-label":t(`sideListDrawer.openSidebarAria`),tintColor:`var(--content-secondary)`})}function O(e){return t=>{u.error(t instanceof Error?t.message:e)}}function k(e){let t=e-Date.now();if(t<=0)return`Expired`;let n=Math.ceil(t/(1e3*60*60*24));return n===1?`Expires in 1 day`:`Expires in ${n} days`}function A({open:e,assistantId:i,onClose:a}){let{t:s}=d(),{copy:u,copied:p,reset:m}=n({errorMessage:`Couldn't copy the invite link.`}),h=(0,C.useRef)(!1),g=f({...o({path:{assistant_id:i}})}),y=(0,C.useRef)(g.mutate);(0,C.useLayoutEffect)(()=>{y.current=g.mutate});let x=(0,C.useRef)(g.reset);(0,C.useLayoutEffect)(()=>{x.current=g.reset}),(0,C.useEffect)(()=>{e&&!h.current&&y.current({path:{assistant_id:i}}),h.current=e},[e,i]);let T=(0,C.useCallback)(()=>{x.current(),m(),a()},[a,m]),E=g.isSuccess&&g.data.token?S({senderAssistantId:i,token:g.data.token}):``;return(0,w.jsx)(c.Root,{open:e,onOpenChange:e=>{e||T()},children:(0,w.jsxs)(c.Content,{size:`sm`,children:[(0,w.jsx)(c.Header,{children:(0,w.jsx)(c.Title,{children:s(`generateInviteLinkDialog.title`)})}),(0,w.jsx)(c.Body,{children:g.isPending?(0,w.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[(0,w.jsx)(v,{className:`h-4 w-4 animate-spin`}),s(`generateInviteLinkDialog.creating`)]}):g.isError?(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsx)(`p`,{role:`alert`,className:`!m-0 text-body-medium-lighter`,style:{color:`var(--system-negative-strong)`},children:s(`generateInviteLinkDialog.createFailed`)}),(0,w.jsx)(r,{variant:`outlined`,onClick:()=>g.mutate({path:{assistant_id:i}}),children:s(`generateInviteLinkDialog.tryAgain`)})]}):g.isSuccess?(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,w.jsx)(t,{variant:`body-medium-lighter`,style:{color:`var(--content-secondary)`},children:s(`generateInviteLinkDialog.shareHint`)}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(l,{type:`text`,readOnly:!0,value:E,fullWidth:!0,wrapperClassName:`flex-1`,className:`font-mono`,onFocus:e=>e.currentTarget.select()}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>u(E),"aria-label":s(`generateInviteLinkDialog.copyAriaLabel`),className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-[var(--border-base)] hover:bg-[var(--surface-hover)]`,children:p?(0,w.jsx)(_,{className:`h-4 w-4`}):(0,w.jsx)(b,{className:`h-4 w-4`})})]}),g.data.expiresAt!=null&&(0,w.jsx)(t,{variant:`body-small-default`,style:{color:`var(--content-tertiary)`},children:k(g.data.expiresAt)})]}):null}),(0,w.jsx)(c.Footer,{children:(0,w.jsx)(r,{variant:`outlined`,onClick:T,children:s(`generateInviteLinkDialog.done`)})})]})})}function j({onClick:e}){let{t}=d();return(0,w.jsx)(r,{variant:`outlined`,size:`compact`,leftIcon:(0,w.jsx)(x,{className:`h-3.5 w-3.5`}),onClick:e,children:t(`shareConnectionLinkButton.label`)})}function M(e){let t=p(),[n,r]=(0,C.useState)(!1);return{isOpen:n,open:(0,C.useCallback)(()=>{r(!0)},[]),close:(0,C.useCallback)(()=>{r(!1),t.invalidateQueries({queryKey:s({path:{assistant_id:e}})})},[t,e])}}export{E as a,O as i,j as n,D as o,A as r,M as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Hm as t,Mg as n,Wm as r,ay as i,ir as a,iy as o,nm as s,qo as c,rm as l,sC as u,zc as d}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Hm as t,Mg as n,Wm as r,ay as i,ir as a,iy as o,nm as s,qo as c,rm as l,sC as u,zc as d}from"./app-XG_RF2yi.js";import{$n as f,E as p,j as m,nr as h}from"./vendor-DwMhK7fD.js";import{t as g,x as _}from"./react-B9IgSVeK.js";var v=e(_(),1),y=g(),b={sm:`h-7 w-7`,md:`h-8 w-8 text-3xl`};function x({external:e=!1,icon:t,iconUrl:n,iconSrc:r,size:i=`sm`,className:a}){let[o,s]=(0,v.useState)(!1),l=r??n;(0,v.useEffect)(()=>{s(!1)},[l]);let u=t||(e?`📦`:`🧩`),d=!!l&&!o;return(0,y.jsx)(`span`,{className:c(`flex shrink-0 items-center justify-center`,b[i],a),children:d?(0,y.jsx)(`img`,{src:l,alt:``,"aria-hidden":!0,loading:`lazy`,className:`h-full w-full object-contain`,onError:()=>s(!0)}):u})}function S(e){return e!==void 0&&e.startsWith(`https://`)}function C(e,t){let n=e.map(e=>({name:e.name,description:e.description??void 0,status:`installed`,external:void 0,version:e.version??void 0,path:e.path,issues:e.issues,enabled:e.enabled,icon:e.icon,hasIcon:e.hasIcon,iconVersion:e.iconVersion})),r=new Set(n.map(e=>e.name)),i=t.filter(e=>!r.has(e.name)).map(e=>({name:e.name,description:e.description,status:`available`,external:!0,path:e.path,...S(e.icon)?{iconUrl:e.icon}:{icon:e.icon}}));return[...n,...i]}function w(e,t){let n=t.trim().toLowerCase();return n?[e.name,e.description].some(e=>e?.toLowerCase().includes(n)):!0}function T(e){return[...e].sort((e,t)=>{let n=e.status===`installed`;return n===(t.status===`installed`)?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1})}function E(e,t){switch(t){case`all`:return e;case`available`:return e.filter(e=>e.status===`available`);case`installed`:return e.filter(e=>e.status===`installed`);case`active`:return e.filter(e=>e.status===`installed`&&e.enabled!==!1);case`off`:return e.filter(e=>e.status===`installed`&&e.enabled===!1)}}function D(e){return e?e.slice(0,7):`unknown`}var O=`plugin.uninstall.mcp_oauth_credentials_unchecked`;function k(e,t){for(let n of e??[])u.warning(t(n===O?`pluginToast.mcpOAuthCredentialsUnchecked`:`pluginToast.cleanupWarning`))}function A(e,n){let{t:r}=p(`intelligence`),i=h(),a=t({onSuccess:(t,a)=>{let o=a.path.name;d(i,e,o),n?.onRemoved?.(o),n?.announceWarnings!==!1&&k(t?.warnings,r)},onError:(e,t)=>{n?.onRemoveError?.(t.path.name,e)}}),o=a.mutate;return{remove:(0,v.useCallback)(t=>{o({path:{assistant_id:e,name:t}})},[e,o]),isRemoving:a.isPending,isRemoveError:a.isError}}function j(e,t,n){let{t:i}=p(`intelligence`),a=h(),o=r({onSuccess:()=>{d(a,e,t),n?.onInstalled?.(),n?.announceInstall!==!1&&u.success(i(`pluginToast.installed`,{name:t||i(`pluginToast.pluginFallback`)}))}}),s=A(e,{onRemoved:()=>n?.onRemoved?.()});return{install:()=>{o.mutate({path:{assistant_id:e},body:{name:t}})},installAsync:()=>o.mutateAsync({path:{assistant_id:e},body:{name:t}}),remove:()=>{s.remove(t)},isInstalling:o.isPending,isRemoving:s.isRemoving,isInstallError:o.isError,isRemoveError:s.isRemoveError}}var M=`0.10.5`;function N(){return n(M)}function P(e,t,n,r){let i=N(),{data:a}=f({queryKey:[`pluginIcon`,e,t,r],queryFn:async()=>{let{data:n,error:r}=await o({path:{assistant_id:e,name:t},parseAs:`blob`,throwOnError:!1});if(r||!(n instanceof Blob))throw Error(`Failed to load plugin icon`);return n},enabled:!!(i&&n&&r),staleTime:1/0,retry:!1}),[s,c]=(0,v.useState)(void 0);return(0,v.useEffect)(()=>{if(!a){c(void 0);return}let e=URL.createObjectURL(a);return c(e),()=>{URL.revokeObjectURL(e)}},[a]),s}var F=300*1e3,I=[],L=[],R=`system`;async function z(e,t,n){let r=await i({path:{assistant_id:e},query:{q:void 0,category:t},signal:n,throwOnError:!1});if(r.response?.status===404)return{plugins:[]};if(!r.response?.ok)throw Error(m(`usePluginsList.failureMessage`,{ns:`intelligence`}));return r.data??{plugins:[]}}function B(e,t){let[n,r]=(0,v.useState)({assistantId:e,latched:!1}),i=n.assistantId===e?n.latched:!1;return n.assistantId!==e&&r({assistantId:e,latched:!1}),(0,v.useEffect)(()=>{t&&r(t=>t.assistantId===e&&t.latched?t:{assistantId:e,latched:!0})},[e,t]),i||t}function V(e,t=null,n=!0){let r=t??void 0,i=f({queryKey:s({path:{assistant_id:e},query:{q:void 0,category:r}}),queryFn:({signal:t})=>z(e,r,t),enabled:!!e&&n,staleTime:F}),o=f({...a(e),enabled:!!e&&n&&t!==null}),c=f({...l({path:{assistant_id:e},query:{q:void 0}}),enabled:!!e&&n,staleTime:F}),u=(0,v.useMemo)(()=>{let e=t===null?i.data?.plugins:o.data?.plugins??i.data?.plugins;return new Set((e??I).map(e=>e.name))},[t,o.data?.plugins,i.data?.plugins]),d=(0,v.useMemo)(()=>{let e=i.data?.plugins??I,n=c.data?.matches??L;return T(C(e,(t===null?n:n.filter(e=>(e.category??`system`)===t)).filter(e=>!u.has(e.name))))},[i.data?.plugins,c.data?.matches,t,u]),p=t===null?i.data:o.data,m=B(e,p?.categoryCounts!==void 0),g=B(e,(p?.plugins??I).some(e=>e.enabled!==void 0)),_=h(),y=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(y.current===e||!c.isSuccess)return;let t=p?.plugins;if(!t?.length)return;let n=new Map((c.data?.matches??L).map(e=>[e.name,e.category]));t.some(e=>{let t=n.get(e.name);return t!=null&&t!==`system`&&(e.category??`system`)===`system`})&&(y.current=e,_.invalidateQueries({queryKey:s({path:{assistant_id:e},query:{q:void 0}})}))},[e,c.isSuccess,c.data?.matches,p?.plugins,_]),{items:d,isLoading:i.isLoading,catalogLoading:c.isLoading,isError:i.isError,installedLoaded:i.data!==void 0,isFetching:i.isFetching||c.isFetching,catalogError:c.isError,categorySupported:m,pluginToggleSupported:g,installedCategoryCounts:p?.categoryCounts,installedPlugins:p?.plugins??I,installedTotal:p?.totalCount,catalogMatches:c.data?.matches??L,unfilteredInstalledNames:u}}export{A as a,w as c,j as i,D as l,V as n,k as o,P as r,E as s,R as t,x as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{bh as t,gb as n,mS as r,nl as i,ol as a,ph as o,tl as s,vh as c}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{bh as t,gb as n,mS as r,nl as i,ol as a,ph as o,tl as s,vh as c}from"./app-XG_RF2yi.js";import{E as l}from"./vendor-DwMhK7fD.js";import{_ as u,r as d,t as f,x as p}from"./react-B9IgSVeK.js";import{Yn as m}from"./icons-C0wyat6T.js";var h=f();function g(){let{t:e}=l(`account`);return(0,h.jsx)(m,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`,"aria-label":e(`authWaitSpinner.loading`)})}var _=e(p(),1);function v({to:e}){let t=s(e);return(0,_.useEffect)(()=>{t&&a(e)},[t,e]),t?null:(0,h.jsx)(d,{to:e,replace:!0})}function y(){let[e]=u(),a=c(),s=t(),l=o(),d=e.get(`returnTo`),f=n(d,r.assistant);if(!d)return{kind:`proceed`,returnTo:null};if(s)return{kind:`wait`};if(!a)return{kind:`proceed`,returnTo:f};if(i(f)){if(l===`pending`)return{kind:`wait`};if(l===`disabled`)return{kind:`proceed`,returnTo:f}}return{kind:`redirect`,node:(0,h.jsx)(v,{to:f})}}export{g as n,y as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ma as t,Na as n}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ma as t,Na as n}from"./app-XG_RF2yi.js";import{x as r}from"./react-B9IgSVeK.js";var i=e(r(),1),a=640;function o(){let{ref:e,size:r}=t(),o=r.w<=0,s=n(o),c=(o?s.w:r.w)>=a,[l,u]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{c&&u(!1)},[c]),{paneRef:e,hasRoomForList:c,drawerOpen:l,openDrawer:(0,i.useCallback)(()=>u(!0),[]),closeDrawer:(0,i.useCallback)(()=>u(!1),[])}}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{AS as t,DS as n,Gm as r,OC as i,OS as a,SC as o,h as s,yy as c}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{AS as t,DS as n,Gm as r,OC as i,OS as a,SC as o,h as s,yy as c}from"./app-XG_RF2yi.js";import{E as l,Xn as u,j as d,nr as f}from"./vendor-DwMhK7fD.js";import{t as p,x as m}from"./react-B9IgSVeK.js";import{Cr as h,P as g,Pt as _,Ya as v,b as y,ha as b}from"./icons-C0wyat6T.js";var x=v(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),S=e(m(),1),C=p(),w={vellum:x,clawhub:h,skillssh:g,custom:y,"assistant-memory":b};function T(e,t){switch(e){case`vellum`:return`Vellum`;case`clawhub`:return`Clawhub`;case`skillssh`:return`skills.sh`;case`custom`:return t(`skillOriginBadge.custom`);case`assistant-memory`:return t(`skillOriginBadge.assistantMemory`)}}function E({origin:e}){let{t}=l(`intelligence`),n=e in w?{label:T(e,t),icon:w[e]}:{label:e.replace(/-/g,` `),icon:_};return(0,C.jsx)(o,{tone:`neutral`,leftIcon:(0,S.createElement)(n.icon),className:`capitalize`,children:n.label})}function D(e){return e.kind===`installed`||e.kind===`bundled`}function O(e){return e.kind===`catalog`}function k({icon:e,iconColor:t=`var(--content-tertiary)`,title:n,subtitle:r,children:a}){return(0,C.jsx)(i.Root,{children:(0,C.jsxs)(i.Body,{className:`flex flex-col items-center justify-center py-16 text-center`,children:[(0,C.jsx)(e,{className:`mb-3 h-8 w-8`,style:{color:t},"aria-hidden":!0}),(0,C.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:n}),(0,C.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:r}),a]})})}async function A(e,r,i){let{data:o,error:s,response:l}=await c({path:{assistant_id:e},body:i?{slug:r,version:i}:{slug:r},throwOnError:!1}),u=d(`installSkill.failureMessage`,{ns:`intelligence`});if(a(l,s,u),!l.ok)throw new n(l.status,t(s,l,u));return o??{ok:!0}}function j(e,{onRemoved:t}={}){let n=f(),[i,a]=(0,S.useState)(null),[o,c]=(0,S.useState)(null),[l,d]=(0,S.useState)(null),p=(0,S.useCallback)(()=>{s(n,e)},[e,n]),m=u({mutationFn:t=>A(e,t),onMutate:e=>a(e),onSettled:()=>{a(null),p()}}),h=r({onMutate:e=>c(e.path.id),onSuccess:()=>{t?.()},onSettled:()=>{c(null),p()}}),g=(0,S.useCallback)(e=>{m.mutate(e.slug??e.id)},[m]),_=(0,S.useCallback)(e=>{d(e)},[]),v=(0,S.useCallback)(()=>{l&&(h.mutate({path:{assistant_id:e,id:l.id}}),d(null))},[e,l,h]),y=(0,S.useCallback)(()=>{d(null)},[]);return{handleInstall:g,handleRemove:_,isInstallingSkill:(0,S.useCallback)(e=>i===(e.slug??e.id),[i]),isRemovingSkill:(0,S.useCallback)(e=>o===e.id,[o]),skillPendingRemoval:l,confirmRemove:v,cancelRemove:y}}export{E as a,D as i,k as n,x as o,O as r,j as t};
|
package/dist/assets/{use-skill-detail-files-B2ECj0iR.js → use-skill-detail-files-19-kefs2.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{bC as t,fm as n,mS as r,pm as i,qo as a}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{bC as t,fm as n,mS as r,pm as i,qo as a}from"./app-XG_RF2yi.js";import{$n as o,E as s}from"./vendor-DwMhK7fD.js";import{n as c,t as l,x as u}from"./react-B9IgSVeK.js";import{Ra as d}from"./icons-C0wyat6T.js";var f=l();function p({skill:e,className:n,onNavigate:i}){let{t:o}=s();return e.origin!==`assistant-memory`||!e.sourceConversationId?null:(0,f.jsxs)(c,{to:r.conversation(e.sourceConversationId),onClick:i,className:a(t({tone:`quiet`}),`inline-flex w-fit items-center gap-1 text-body-small-default text-[var(--content-tertiary)]`,n),children:[o(`skillLineageLink.label`),(0,f.jsx)(d,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0})]})}var m=e(u(),1);function h(e,t){return t??e.find(e=>e.name===`SKILL.md`)?.path??null}function g(e,t){let[r,a]=(0,m.useState)(null),s=o({...i({path:{assistant_id:e??``,id:t}}),select:e=>e??null,enabled:!!e}),c=(0,m.useMemo)(()=>s.data?.files??[],[s.data]),l=(0,m.useMemo)(()=>c.find(e=>e.name===`SKILL.md`),[c]),u=h(c,r),d=o({...n({path:{assistant_id:e??``,id:t},query:{path:u??``}}),select:e=>e??null,enabled:!!(e&&u)});return{fileEntries:c,skillMd:l,selectedPath:r,setSelectedPath:a,activePath:u,activeFile:c.find(e=>e.path===u),isFilesLoading:s.isLoading,isFilesPending:s.isPending,fileContent:d.data?.content??null,isBinary:!!d.data?.isBinary,isContentLoading:d.isLoading,isContentPending:d.isPending}}export{p as n,g as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jg as e}from"./app-XG_RF2yi.js";var t=`0.10.8`;function n(n){return e(t,n)}export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Dh as t,Dr as n}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Dh as t,Dr as n}from"./app-XG_RF2yi.js";import{x as r}from"./react-B9IgSVeK.js";var i=e(r(),1);function a(e){let r=n();return(0,i.useMemo)(()=>{if(e)return r.find(n=>t(n).includes(e))},[r,e])}export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$S as t,$d as n,$o as r,BC as i,IC as a,Oo as o,Qd as s,Qo as c,Sm as l,WC as u,Xo as d,Yo as f,Zm as p,Zo as m,Zx as h,_u as g,bC as _,cC as v,cl as y,ds as b,ef as x,en as S,es as C,fs as w,gs as T,hC as E,hS as D,hs as O,iC as k,it as A,lC as j,ll as M,lp as N,ls as P,mS as F,ml as ee,ms as I,nt as L,ot as te,ps as R,rn as ne,rt as re,sC as ie,sl as ae,tn as oe,uC as se,ul as ce,up as le,us as ue,vu as z,wv as de}from"./app-g1TvV-Dl.js";import{$n as fe,E as B,nr as pe}from"./vendor-DwMhK7fD.js";import{_ as me,n as he,r as V,t as ge,x as _e}from"./react-B9IgSVeK.js";import{La as ve,fr as H}from"./icons-C0wyat6T.js";import{t as U}from"./detail-card-uV-Fvv0m.js";import{t as ye}from"./stt-language-picker-modal-DfBKJmLh.js";import{t as be}from"./use-hotkey-recorder-DSplqHTv.js";var W=e(_e(),1),G=ge();function K({label:e,selected:t,recording:n=!1,onClick:r}){return(0,G.jsxs)(`button`,{type:`button`,onClick:r,className:[`inline-flex items-center gap-2 rounded-lg border px-3 py-1.5 text-body-medium-lighter transition-colors`,`border-[var(--border-subtle)]`,t?`bg-[var(--surface-active)]`:`bg-[var(--surface-lift)] hover:bg-[var(--surface-hover)]`,n?`animate-pulse`:``].filter(Boolean).join(` `),children:[(0,G.jsx)(`span`,{className:[`inline-block h-2.5 w-2.5 rounded-full border`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)]`].join(` `)}),(0,G.jsx)(`span`,{className:`text-[var(--content-default)]`,children:e})]})}function xe(){let{t:e}=B(`settings`),{available:t,currentCode:n,configuredProviderId:r,selectLanguage:a,selecting:o}=A(L()),[s,c]=(0,W.useState)(!1);return t?(0,G.jsxs)(U,{title:e(`listeningLanguageCard.title`),subtitle:e(`listeningLanguageCard.subtitle`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`,children:te(n,r)}),(0,G.jsx)(i,{variant:`outlined`,onClick:()=>c(!0),className:`shrink-0`,children:e(`listeningLanguageCard.change`)})]}),(0,G.jsx)(ye,{open:s,onOpenChange:c,title:e(`listeningLanguageCard.title`),currentCode:n,configuredProviderId:r,selectLanguage:a,selecting:o})]}):null}var q=`flux`;function Se(e){return e===`vellum`}function Ce(e,t){let n=e?.trim().toLowerCase();return!n||n===`multi`||t===void 0?!0:t.includes(n.split(`-`)[0]??n)}function we(){let{t:e}=B(`settings`),t=pe(),n=p(),r=L(),[i,a]=(0,W.useState)(!1),{data:o}=fe({...N({path:{assistant_id:r}}),enabled:n,staleTime:3e4}),s=o?.services?.stt,{data:c}=fe({...l({path:{assistant_id:r}}),enabled:n,staleTime:5*6e4}),u=s?.roles?.liveVoice?.provider??s?.provider,d=c?.providers?.find(e=>e.id===u),f=d?.modelFamilies?.includes(q)??!1;if(!u||!f)return null;let m=Ce(s?.language,d?.turnDetectionLanguages),h=s?.roles?.liveVoice,g=h?h.model:s?.providers?.[u]?.model,_=g===void 0?Se(u)&&m:g===q,v=async n=>{a(!0);try{let{response:e}=await de({path:{assistant_id:r},body:{services:{stt:{roles:{liveVoice:{provider:u,model:n?q:d?.baseModelFamily}}}}},throwOnError:!1});if(!e?.ok)throw Error(String(e?.status??``));await t.invalidateQueries({queryKey:le({path:{assistant_id:r}})})}catch{ie.error(e(`voicePage.turnDetectionFailed`))}finally{a(!1)}};return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e(`voicePage.turnDetectionLabel`)}),(0,G.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(m?`voicePage.turnDetectionDescription`:`voicePage.turnDetectionLanguageUnsupported`)}),(0,G.jsx)(E,{checked:_,disabled:i||!m&&!_,onChange:e=>void v(e),"aria-label":e(`voicePage.turnDetectionLabel`)})]})}var J=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,Y=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--system-negative-strong)]`,Te=2;function Ee(e){let t=[];return e.ctrlKey&&t.push(`control`),e.altKey&&t.push(`option`),e.shiftKey&&t.push(`shift`),e.metaKey&&t.push(`command`),T(t)}function De(){let{t:e}=B(`settings`),t=b(),r=f(e=>e.registered)===!1,[a,o]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)([]),[p,m]=(0,W.useState)(!1),h=(0,W.useRef)(null),g=(0,W.useCallback)(async()=>{o((await s())?.inputMonitoring.status??null)},[]);(0,W.useEffect)(()=>{g();let e=setInterval(()=>{g()},2e3);return()=>{clearInterval(e)}},[g]);let _=(0,W.useCallback)(()=>{x(`inputMonitoring`).then(g)},[g]),v=(0,W.useCallback)(()=>{n(`inputMonitoring`).then(g)},[g]),y=(0,W.useCallback)(e=>{w(e),l(!1),d([]),m(!1),e.kind!==`off`&&_()},[_]),S=(0,W.useCallback)(()=>{l(!0),d([]),m(!1),requestAnimationFrame(()=>{h.current?.focus()})},[]),C=(0,W.useCallback)(()=>{l(!1),d([]),m(!1)},[]),T=(0,W.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){C();return}d(Ee(e))},[C]),E=(0,W.useCallback)(e=>{if(c&&!(Ee(e).length>0)){if(u.length>=Te){y({kind:`modifierOnly`,modifiers:u});return}d([]),m(!0)}},[y,u,c]);(0,W.useEffect)(()=>{if(!c)return;let e=e=>{h.current&&!h.current.contains(e.target)&&C()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[C,c]);let D=ue(t),k=t.kind===`modifierOnly`&&!D,A=t.kind!==`off`,j=t.kind===`modifierOnly`&&t.modifiers.includes(`control`)&&t.modifiers.includes(`option`),M=a===`granted`;return(0,G.jsx)(U,{title:e(`voiceKeyCard.title`),subtitle:e(`voiceKeyCard.subtitle`),children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{ref:h,tabIndex:c?0:-1,onKeyDown:c?T:void 0,onKeyUp:c?E:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[(0,G.jsx)(K,{label:e(`voiceKeyCard.fnLabel`),selected:D,onClick:()=>y(P)}),c?(0,G.jsx)(K,{label:u.length>0?O(u):e(`voiceKeyCard.recordingPrompt`),selected:!0,recording:!0,onClick:C}):(0,G.jsx)(K,{label:t.kind===`modifierOnly`&&!D?O(t.modifiers):e(`voiceKeyCard.customLabel`),selected:k,onClick:S}),(0,G.jsx)(K,{label:e(`voiceKeyCard.offLabel`),selected:!A,onClick:()=>y({kind:`off`})})]}),p&&(0,G.jsxs)(`div`,{className:J,children:[(0,G.jsx)(H,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:e(`voiceKeyCard.customHint`)})]}),A&&a!==null&&!M&&(0,G.jsxs)(`div`,{className:`flex flex-col items-start gap-2 pt-1`,children:[(0,G.jsxs)(`div`,{className:Y,children:[(0,G.jsx)(H,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:e(`voiceKeyCard.needsInputMonitoring`)})]}),(0,G.jsx)(i,{variant:`outlined`,onClick:v,children:e(`voiceKeyCard.allowInputMonitoring`)})]}),A&&M&&r&&(0,G.jsxs)(`div`,{className:Y,children:[(0,G.jsx)(H,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:e(`voiceKeyCard.refusedNote`)})]}),D&&(0,G.jsxs)(`div`,{className:J,children:[(0,G.jsx)(H,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:e(`voiceKeyCard.fnDictationNote`)})]}),j&&(0,G.jsxs)(`div`,{className:J,children:[(0,G.jsx)(H,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:e(`voiceKeyCard.voiceOverNote`)})]})]})})}function Oe({assistantId:e,open:t,onOpenChange:n}){return(0,G.jsx)(v.Root,{open:t,onOpenChange:n,children:(0,G.jsx)(v.Content,{size:`md`,children:(0,G.jsx)(ke,{assistantId:e,onDone:()=>n(!1)})})})}function ke({assistantId:e,onDone:t}){let{t:n}=B(),{available:r,currentModel:a,selectModel:s,selecting:c}=o(e);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(v.Header,{children:[(0,G.jsx)(v.Title,{children:n(`voicePickerModal.title`)}),r&&(0,G.jsx)(v.Description,{children:`Uses Vellum credits, through providers like ElevenLabs and Deepgram.`})]}),(0,G.jsx)(v.Body,{children:(0,G.jsx)(oe,{assistantId:e,filterBySource:!0,value:a,onChange:s,autoScrollToSelected:!0})}),(0,G.jsxs)(v.Footer,{className:`items-center justify-between gap-3`,children:[(0,G.jsx)(re,{}),(0,G.jsx)(i,{variant:`primary`,onClick:t,disabled:c,className:`shrink-0`,children:n(`voicePickerModal.done`)})]})]})}function Ae(){let{t:e}=B(`settings`),n=L(),{available:r,settled:a,voices:s,currentModel:c}=o(n),l=s.find(e=>e.model===c)??s[0],[u,d]=(0,W.useState)(!1),f=h.use.name(),p=f?e(`voicePickerCard.titleWithName`,{name:f}):e(`voicePickerCard.title`);return a?r&&l?(0,G.jsxs)(U,{title:p,subtitle:e(`voicePickerCard.creditsNote`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(S,{description:l.description,className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`}),(0,G.jsx)(i,{variant:`outlined`,onClick:()=>d(!0),className:`shrink-0`,children:e(`voicePickerCard.changeButton`)})]}),(0,G.jsx)(Oe,{assistantId:n,open:u,onOpenChange:d})]}):(0,G.jsx)(U,{title:p,children:(0,G.jsx)(ne,{})}):(0,G.jsx)(U,{title:p,children:(0,G.jsx)(t,{as:`span`,role:`status`,"aria-label":e(`voicePickerCard.loadingAria`),className:`block h-9 w-48`})})}var je=[{prefKey:`showUserTranscript`,label:`Show the words you say`,description:`Live transcription while you speak.`},{prefKey:`showAssistantTranscript`,label:`Show the words the assistant says`,description:`Text alongside the spoken response.`}],Me=`We recommend keeping both off to start. It feels more like a real conversation.`;function Ne(){let{t:e}=B();return(0,G.jsx)(`span`,{className:`shrink-0 rounded-full bg-[var(--surface-active)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:e(`voiceTranscriptToggles.recommendedOff`)})}function Pe({label:e,description:t,showBadge:n,checked:r,onChange:i}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e}),n?(0,G.jsx)(Ne,{}):null]}),t?(0,G.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t}):null]}),(0,G.jsx)(E,{checked:r,onChange:i,"aria-label":e})]})}function Fe({showDescription:e=!1,showRecommendedBadge:t=!1}){let{t:n}=B(),r=z.use.showUserTranscript(),i=z.use.showAssistantTranscript(),a=z.use.setShowUserTranscript(),o=z.use.setShowAssistantTranscript(),s={showUserTranscript:{checked:r,onChange:a},showAssistantTranscript:{checked:i,onChange:o}},c=(e,t)=>n(e===`showUserTranscript`?`voiceTranscriptToggles.userTranscriptLabel`:`voiceTranscriptToggles.assistantTranscriptLabel`,t),l=(e,t)=>n(e===`showUserTranscript`?`voiceTranscriptToggles.userTranscriptDescription`:`voiceTranscriptToggles.assistantTranscriptDescription`,t);return(0,G.jsx)(G.Fragment,{children:je.map(n=>{let r=s[n.prefKey];return(0,G.jsx)(Pe,{label:c(n.prefKey,n.label),description:e?l(n.prefKey,n.description):void 0,showBadge:t,checked:r.checked,onChange:r.onChange},n.prefKey)})})}var X=`text-body-small-default text-[var(--content-tertiary)]`;function Ie(){let[e]=me(),t=e.get(`tab`);return t===`sounds`?(0,G.jsx)(V,{replace:!0,to:F.settings.sounds}):t===`services`?(0,G.jsx)(V,{replace:!0,to:F.settings.ai}):(0,G.jsx)(Le,{})}function Le(){let{t:e}=B(`settings`);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,G.jsxs)(Z,{heading:e(`voicePage.sectionOutputHeading`),description:e(`voicePage.sectionOutputDescription`),children:[(0,G.jsx)(Ae,{}),(0,G.jsx)(Re,{})]}),(0,G.jsxs)(Z,{heading:e(`voicePage.sectionInputHeading`),description:e(`voicePage.sectionInputDescription`),children:[(0,G.jsx)(Be,{}),(0,G.jsx)(xe,{}),ee()?(0,G.jsx)(De,{}):(0,G.jsx)(Ue,{}),(0,G.jsx)(We,{})]}),(0,G.jsx)(Z,{heading:e(`voicePage.sectionCaptionsHeading`),children:(0,G.jsx)(ze,{})})]})}function Re(){let{t:e}=B(`settings`),{available:t}=o(L());return t?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:[(0,G.jsx)(H,{className:`h-3.5 w-3.5 shrink-0 text-[var(--content-quiet)]`}),(0,G.jsx)(`span`,{children:e(`voicePage.speechServicesBannerPrompt`)}),(0,G.jsxs)(he,{to:`${F.settings.ai}#text-to-speech`,className:u(_({tone:`quiet`}),`inline-flex items-center gap-1 text-[var(--content-secondary)] decoration-[var(--border-element)] underline-offset-2`),children:[e(`voicePage.speechServicesBannerLink`),(0,G.jsx)(ve,{className:`h-3 w-3`})]})]}):null}function Z({heading:e,description:t,children:n}){return(0,G.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`h2`,{className:`text-label-medium-default uppercase tracking-wide text-[var(--content-tertiary)]`,children:e}),t&&(0,G.jsx)(`p`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:t})]}),n]})}function ze(){let{t:e}=B(`settings`);return(0,G.jsx)(U,{title:e(`voicePage.captionsTitle`),subtitle:e(`voicePage.captionsSubtitle`),children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(Fe,{showDescription:!0}),(0,G.jsx)(`p`,{className:`${X} pt-1`,children:e(`voicePage.captionsRecommendation`,Me)})]})})}var Q=``;function Be(){let{t:e}=B(`settings`),[t,n]=(0,W.useState)([]),[r,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(()=>ae()),u=(0,W.useCallback)(async()=>{if(!navigator.mediaDevices?.enumerateDevices)return;let e=await y();a(e.needsPermission),n(e.devices),s(e.known)},[]),d=(0,W.useCallback)(async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop()}catch{}u()},[u]);(0,W.useEffect)(()=>{u();let e=navigator.mediaDevices;if(!e?.addEventListener)return;let t=()=>void u();return e.addEventListener(`devicechange`,t),()=>e.removeEventListener(`devicechange`,t)},[u]);let f=(0,W.useMemo)(()=>{let n=t.map((t,n)=>({value:t.deviceId,label:t.label||e(`voicePage.microphoneFallbackLabel`,{index:n+1})})),r=c!==Q&&!n.some(e=>e.value===c);return[{value:null,label:e(`voicePage.systemDefault`)},...n,...r?[{value:c,label:e(o?`voicePage.savedMicrophoneNotConnected`:`voicePage.savedMicrophone`)}]:[]]},[t,c,o,e]),p=(0,W.useCallback)(e=>{l(e),M(e)},[]);(0,W.useEffect)(()=>ce(()=>{l(ae())}),[]);let m=c===Q?null:c;return(0,G.jsx)(U,{title:e(`voicePage.microphoneTitle`),subtitle:e(`voicePage.microphoneSubtitle`),children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(`div`,{className:`max-w-xs`,children:(0,G.jsx)(k,{options:f,value:m,onChange:p,onSelectNone:()=>p(Q),"aria-label":e(`voicePage.microphoneAriaLabel`)})}),r&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(i,{variant:`outlined`,onClick:d,children:e(`voicePage.allowMicrophoneAccess`)}),(0,G.jsx)(`span`,{className:X,children:e(`voicePage.grantMicrophoneAccessHint`)})]})]})})}var Ve=new Set([`Control`,`Alt`,`Shift`,`Meta`]),$=`toggleVoice`,He=[{label:`Ctrl+Shift`,activator:{kind:`modifierOnly`,modifiers:[`control`,`shift`]}},{label:`Alt`,activator:{kind:`modifierOnly`,modifiers:[`option`]}}];function Ue(){let{t:e}=B(`settings`),t=D(),[n,i]=(0,W.useState)(()=>c()),[o,s]=(0,W.useState)(!1),[l,u]=(0,W.useState)([]),[f,p]=(0,W.useState)(!1),h=(0,W.useRef)(null),g=(0,W.useMemo)(()=>{let e=m();return[{label:R(e),activator:e}]},[]),_=n.kind!==`off`,v=(0,W.useCallback)(e=>{i(e),C(e),s(!1),u([]),p(!1)},[]),y=be({onBound:()=>v({kind:`off`})}),b=y.catalog.find(e=>e.key===$)?.accelerator??``,x=y.recordingKey===$,S=r()?He:[],w=(0,W.useCallback)(e=>{v(e),y.removeHotkey($)},[y,v]),k=(0,W.useCallback)(()=>{v({kind:`off`}),y.removeHotkey($)},[y,v]),A=(0,W.useCallback)(()=>{s(!0),u([]),p(!1),requestAnimationFrame(()=>{h.current?.focus()})},[]),j=(0,W.useCallback)(()=>{s(!1),u([]),p(!1)},[]),M=(0,W.useCallback)(e=>{let t=[];return e.ctrlKey&&t.push(`control`),e.altKey&&t.push(`option`),e.shiftKey&&t.push(`shift`),e.metaKey&&t.push(`command`),t},[]),N=(0,W.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){j();return}let t=M(e);if(Ve.has(e.key)){p(!1),u(T(t));return}if(t.length===0){p(!0);return}v({kind:`key`,label:e.key.length===1?e.key.toUpperCase():e.key,modifiers:T(t)})},[j,M,v]),P=(0,W.useCallback)(e=>{o&&M(e).length===0&&l.length>0&&(u([]),p(!0))},[M,o,l]);(0,W.useEffect)(()=>{if(!o)return;let e=e=>{h.current&&!h.current.contains(e.target)&&j()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[j,o]);let F=_&&!g.some(e=>I(e.activator,n));return t?(0,G.jsx)(U,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitleDesktop`),children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[S.map(e=>(0,G.jsx)(K,{label:e.label,selected:I(e.activator,n),onClick:()=>w(e.activator)},e.label)),(0,G.jsx)(K,{label:x?e(`voicePage.recordingPrompt`):b?(0,G.jsx)(a,{accelerator:b}):e(`voicePage.customKey`),selected:b!==``,recording:x,onClick:x?y.stopRecording:()=>y.startRecording($)}),(0,G.jsx)(K,{label:e(`voicePage.offKeyLabel`),selected:n.kind===`off`&&!b&&!x,onClick:k})]}),y.conflict?.key===$&&(0,G.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,G.jsx)(H,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:e(`voicePage.shortcutConflict`,{command:y.conflict.label})})]})]})}):(0,G.jsx)(U,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitle`),children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(E,{checked:_,onChange:e=>{v(e?d():{kind:`off`})},label:e(`voicePage.enableVoiceShortcut`)}),_&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`span`,{className:X,children:e(`voicePage.activationKeyLabel`)}),(0,G.jsxs)(`div`,{ref:h,tabIndex:o?0:-1,onKeyDown:o?N:void 0,onKeyUp:o?P:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[g.map(e=>(0,G.jsx)(K,{label:e.label,selected:I(e.activator,n),onClick:()=>v(e.activator)},e.label)),o?(0,G.jsx)(K,{label:l.length>0?O(l):e(`voicePage.pressShortcut`),selected:!0,recording:!0,onClick:j}):(0,G.jsx)(K,{label:F?R(n):e(`voicePage.customKey`),selected:F,onClick:A})]}),f&&(0,G.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,G.jsx)(H,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:e(`voicePage.shortcutChordHint`)})]}),_&&(0,G.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,G.jsx)(H,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:e(`voicePage.focusedTabNote`)})]})]})]})})}function We(){let{t:e}=B(`settings`),t=z.use.pauseBeforeReplyMs(),n=z.use.setPauseBeforeReplyMs(),r=z.use.interruptSensitivity(),a=z.use.setInterruptSensitivity(),o=(0,W.useMemo)(()=>[{value:`low`,label:e(`voicePage.interruptSensitivityLow`)},{value:`medium`,label:e(`voicePage.interruptSensitivityMedium`)},{value:`high`,label:e(`voicePage.interruptSensitivityHigh`)}],[e]),s=t!==null||r!==null;return(0,G.jsx)(U,{title:e(`voicePage.turnTakingTitle`),subtitle:e(`voicePage.turnTakingSubtitle`),children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,G.jsx)(we,{}),(0,G.jsx)(Ge,{label:e(`voicePage.pauseBeforeReplyLabel`),description:e(`voicePage.pauseBeforeReplyDescription`),isDefault:t===null,children:(0,G.jsx)(`div`,{className:`max-w-xs`,children:(0,G.jsx)(j,{value:(t??1200)/1e3,onValueChange:e=>{typeof e==`number`&&n(Math.round(e*1e3))},min:500/1e3,max:g/1e3,step:.1,showValue:!0,formatValue:e=>`${(typeof e==`number`?e:e[0]).toFixed(1)}s`,"aria-label":e(`voicePage.pauseBeforeReplyAriaLabel`)})})}),(0,G.jsx)(Ge,{label:e(`voicePage.interruptSensitivityLabel`),description:e(`voicePage.interruptSensitivityDescription`),isDefault:r===null,children:(0,G.jsx)(`div`,{className:`max-w-xs`,children:(0,G.jsx)(se,{items:o,value:r??`medium`,onChange:a,ariaLabel:e(`voicePage.interruptSensitivityAriaLabel`)})})}),s&&(0,G.jsx)(`div`,{children:(0,G.jsx)(i,{variant:`outlined`,onClick:()=>{n(null),a(null)},children:e(`voicePage.resetToDefaults`)})})]})})}function Ge({label:e,description:t,isDefault:n,children:r}){let{t:i}=B(`settings`);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e}),n&&(0,G.jsx)(`span`,{className:`shrink-0 rounded-full bg-[var(--surface-active)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:i(`voicePage.defaultBadge`)})]}),(0,G.jsx)(`p`,{className:X,children:t}),r]})}export{Ie as VoicePage};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$S as t,$d as n,$o as r,BC as i,IC as a,Oo as o,Qd as s,Qo as c,Sm as l,WC as u,Xo as d,Yo as f,Zm as p,Zo as m,Zx as h,_u as g,bC as _,cC as v,cl as y,ds as b,ef as x,en as S,es as C,fs as w,gs as T,hC as E,hS as D,hs as O,iC as k,it as A,lC as j,ll as M,lp as N,ls as P,mS as F,ml as ee,ms as I,nt as L,ot as te,ps as R,rn as ne,rt as re,sC as ie,sl as ae,tn as oe,uC as se,ul as ce,up as le,us as ue,vu as z,wv as de}from"./app-XG_RF2yi.js";import{$n as fe,E as B,nr as pe}from"./vendor-DwMhK7fD.js";import{_ as me,n as he,r as V,t as ge,x as _e}from"./react-B9IgSVeK.js";import{La as ve,fr as H}from"./icons-C0wyat6T.js";import{t as U}from"./detail-card-C7tTQwmv.js";import{t as ye}from"./stt-language-picker-modal-oMpmGSKQ.js";import{t as be}from"./use-hotkey-recorder-BIhIsp-5.js";var W=e(_e(),1),G=ge();function K({label:e,selected:t,recording:n=!1,onClick:r}){return(0,G.jsxs)(`button`,{type:`button`,onClick:r,className:[`inline-flex items-center gap-2 rounded-lg border px-3 py-1.5 text-body-medium-lighter transition-colors`,`border-[var(--border-subtle)]`,t?`bg-[var(--surface-active)]`:`bg-[var(--surface-lift)] hover:bg-[var(--surface-hover)]`,n?`animate-pulse`:``].filter(Boolean).join(` `),children:[(0,G.jsx)(`span`,{className:[`inline-block h-2.5 w-2.5 rounded-full border`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)]`].join(` `)}),(0,G.jsx)(`span`,{className:`text-[var(--content-default)]`,children:e})]})}function xe(){let{t:e}=B(`settings`),{available:t,currentCode:n,configuredProviderId:r,selectLanguage:a,selecting:o}=A(L()),[s,c]=(0,W.useState)(!1);return t?(0,G.jsxs)(U,{title:e(`listeningLanguageCard.title`),subtitle:e(`listeningLanguageCard.subtitle`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`,children:te(n,r)}),(0,G.jsx)(i,{variant:`outlined`,onClick:()=>c(!0),className:`shrink-0`,children:e(`listeningLanguageCard.change`)})]}),(0,G.jsx)(ye,{open:s,onOpenChange:c,title:e(`listeningLanguageCard.title`),currentCode:n,configuredProviderId:r,selectLanguage:a,selecting:o})]}):null}var q=`flux`;function Se(e){return e===`vellum`}function Ce(e,t){let n=e?.trim().toLowerCase();return!n||n===`multi`||t===void 0?!0:t.includes(n.split(`-`)[0]??n)}function we(){let{t:e}=B(`settings`),t=pe(),n=p(),r=L(),[i,a]=(0,W.useState)(!1),{data:o}=fe({...N({path:{assistant_id:r}}),enabled:n,staleTime:3e4}),s=o?.services?.stt,{data:c}=fe({...l({path:{assistant_id:r}}),enabled:n,staleTime:5*6e4}),u=s?.roles?.liveVoice?.provider??s?.provider,d=c?.providers?.find(e=>e.id===u),f=d?.modelFamilies?.includes(q)??!1;if(!u||!f)return null;let m=Ce(s?.language,d?.turnDetectionLanguages),h=s?.roles?.liveVoice,g=h?h.model:s?.providers?.[u]?.model,_=g===void 0?Se(u)&&m:g===q,v=async n=>{a(!0);try{let{response:e}=await de({path:{assistant_id:r},body:{services:{stt:{roles:{liveVoice:{provider:u,model:n?q:d?.baseModelFamily}}}}},throwOnError:!1});if(!e?.ok)throw Error(String(e?.status??``));await t.invalidateQueries({queryKey:le({path:{assistant_id:r}})})}catch{ie.error(e(`voicePage.turnDetectionFailed`))}finally{a(!1)}};return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e(`voicePage.turnDetectionLabel`)}),(0,G.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(m?`voicePage.turnDetectionDescription`:`voicePage.turnDetectionLanguageUnsupported`)}),(0,G.jsx)(E,{checked:_,disabled:i||!m&&!_,onChange:e=>void v(e),"aria-label":e(`voicePage.turnDetectionLabel`)})]})}var J=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,Y=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--system-negative-strong)]`,Te=2;function Ee(e){let t=[];return e.ctrlKey&&t.push(`control`),e.altKey&&t.push(`option`),e.shiftKey&&t.push(`shift`),e.metaKey&&t.push(`command`),T(t)}function De(){let{t:e}=B(`settings`),t=b(),r=f(e=>e.registered)===!1,[a,o]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.useState)([]),[p,m]=(0,W.useState)(!1),h=(0,W.useRef)(null),g=(0,W.useCallback)(async()=>{o((await s())?.inputMonitoring.status??null)},[]);(0,W.useEffect)(()=>{g();let e=setInterval(()=>{g()},2e3);return()=>{clearInterval(e)}},[g]);let _=(0,W.useCallback)(()=>{x(`inputMonitoring`).then(g)},[g]),v=(0,W.useCallback)(()=>{n(`inputMonitoring`).then(g)},[g]),y=(0,W.useCallback)(e=>{w(e),l(!1),d([]),m(!1),e.kind!==`off`&&_()},[_]),S=(0,W.useCallback)(()=>{l(!0),d([]),m(!1),requestAnimationFrame(()=>{h.current?.focus()})},[]),C=(0,W.useCallback)(()=>{l(!1),d([]),m(!1)},[]),T=(0,W.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){C();return}d(Ee(e))},[C]),E=(0,W.useCallback)(e=>{if(c&&!(Ee(e).length>0)){if(u.length>=Te){y({kind:`modifierOnly`,modifiers:u});return}d([]),m(!0)}},[y,u,c]);(0,W.useEffect)(()=>{if(!c)return;let e=e=>{h.current&&!h.current.contains(e.target)&&C()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[C,c]);let D=ue(t),k=t.kind===`modifierOnly`&&!D,A=t.kind!==`off`,j=t.kind===`modifierOnly`&&t.modifiers.includes(`control`)&&t.modifiers.includes(`option`),M=a===`granted`;return(0,G.jsx)(U,{title:e(`voiceKeyCard.title`),subtitle:e(`voiceKeyCard.subtitle`),children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{ref:h,tabIndex:c?0:-1,onKeyDown:c?T:void 0,onKeyUp:c?E:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[(0,G.jsx)(K,{label:e(`voiceKeyCard.fnLabel`),selected:D,onClick:()=>y(P)}),c?(0,G.jsx)(K,{label:u.length>0?O(u):e(`voiceKeyCard.recordingPrompt`),selected:!0,recording:!0,onClick:C}):(0,G.jsx)(K,{label:t.kind===`modifierOnly`&&!D?O(t.modifiers):e(`voiceKeyCard.customLabel`),selected:k,onClick:S}),(0,G.jsx)(K,{label:e(`voiceKeyCard.offLabel`),selected:!A,onClick:()=>y({kind:`off`})})]}),p&&(0,G.jsxs)(`div`,{className:J,children:[(0,G.jsx)(H,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:e(`voiceKeyCard.customHint`)})]}),A&&a!==null&&!M&&(0,G.jsxs)(`div`,{className:`flex flex-col items-start gap-2 pt-1`,children:[(0,G.jsxs)(`div`,{className:Y,children:[(0,G.jsx)(H,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:e(`voiceKeyCard.needsInputMonitoring`)})]}),(0,G.jsx)(i,{variant:`outlined`,onClick:v,children:e(`voiceKeyCard.allowInputMonitoring`)})]}),A&&M&&r&&(0,G.jsxs)(`div`,{className:Y,children:[(0,G.jsx)(H,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:e(`voiceKeyCard.refusedNote`)})]}),D&&(0,G.jsxs)(`div`,{className:J,children:[(0,G.jsx)(H,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:e(`voiceKeyCard.fnDictationNote`)})]}),j&&(0,G.jsxs)(`div`,{className:J,children:[(0,G.jsx)(H,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:e(`voiceKeyCard.voiceOverNote`)})]})]})})}function Oe({assistantId:e,open:t,onOpenChange:n}){return(0,G.jsx)(v.Root,{open:t,onOpenChange:n,children:(0,G.jsx)(v.Content,{size:`md`,children:(0,G.jsx)(ke,{assistantId:e,onDone:()=>n(!1)})})})}function ke({assistantId:e,onDone:t}){let{t:n}=B(),{available:r,currentModel:a,selectModel:s,selecting:c}=o(e);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(v.Header,{children:[(0,G.jsx)(v.Title,{children:n(`voicePickerModal.title`)}),r&&(0,G.jsx)(v.Description,{children:`Uses Vellum credits, through providers like ElevenLabs and Deepgram.`})]}),(0,G.jsx)(v.Body,{children:(0,G.jsx)(oe,{assistantId:e,filterBySource:!0,value:a,onChange:s,autoScrollToSelected:!0})}),(0,G.jsxs)(v.Footer,{className:`items-center justify-between gap-3`,children:[(0,G.jsx)(re,{}),(0,G.jsx)(i,{variant:`primary`,onClick:t,disabled:c,className:`shrink-0`,children:n(`voicePickerModal.done`)})]})]})}function Ae(){let{t:e}=B(`settings`),n=L(),{available:r,settled:a,voices:s,currentModel:c}=o(n),l=s.find(e=>e.model===c)??s[0],[u,d]=(0,W.useState)(!1),f=h.use.name(),p=f?e(`voicePickerCard.titleWithName`,{name:f}):e(`voicePickerCard.title`);return a?r&&l?(0,G.jsxs)(U,{title:p,subtitle:e(`voicePickerCard.creditsNote`),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(S,{description:l.description,className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`}),(0,G.jsx)(i,{variant:`outlined`,onClick:()=>d(!0),className:`shrink-0`,children:e(`voicePickerCard.changeButton`)})]}),(0,G.jsx)(Oe,{assistantId:n,open:u,onOpenChange:d})]}):(0,G.jsx)(U,{title:p,children:(0,G.jsx)(ne,{})}):(0,G.jsx)(U,{title:p,children:(0,G.jsx)(t,{as:`span`,role:`status`,"aria-label":e(`voicePickerCard.loadingAria`),className:`block h-9 w-48`})})}var je=[{prefKey:`showUserTranscript`,label:`Show the words you say`,description:`Live transcription while you speak.`},{prefKey:`showAssistantTranscript`,label:`Show the words the assistant says`,description:`Text alongside the spoken response.`}],Me=`We recommend keeping both off to start. It feels more like a real conversation.`;function Ne(){let{t:e}=B();return(0,G.jsx)(`span`,{className:`shrink-0 rounded-full bg-[var(--surface-active)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:e(`voiceTranscriptToggles.recommendedOff`)})}function Pe({label:e,description:t,showBadge:n,checked:r,onChange:i}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e}),n?(0,G.jsx)(Ne,{}):null]}),t?(0,G.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t}):null]}),(0,G.jsx)(E,{checked:r,onChange:i,"aria-label":e})]})}function Fe({showDescription:e=!1,showRecommendedBadge:t=!1}){let{t:n}=B(),r=z.use.showUserTranscript(),i=z.use.showAssistantTranscript(),a=z.use.setShowUserTranscript(),o=z.use.setShowAssistantTranscript(),s={showUserTranscript:{checked:r,onChange:a},showAssistantTranscript:{checked:i,onChange:o}},c=(e,t)=>n(e===`showUserTranscript`?`voiceTranscriptToggles.userTranscriptLabel`:`voiceTranscriptToggles.assistantTranscriptLabel`,t),l=(e,t)=>n(e===`showUserTranscript`?`voiceTranscriptToggles.userTranscriptDescription`:`voiceTranscriptToggles.assistantTranscriptDescription`,t);return(0,G.jsx)(G.Fragment,{children:je.map(n=>{let r=s[n.prefKey];return(0,G.jsx)(Pe,{label:c(n.prefKey,n.label),description:e?l(n.prefKey,n.description):void 0,showBadge:t,checked:r.checked,onChange:r.onChange},n.prefKey)})})}var X=`text-body-small-default text-[var(--content-tertiary)]`;function Ie(){let[e]=me(),t=e.get(`tab`);return t===`sounds`?(0,G.jsx)(V,{replace:!0,to:F.settings.sounds}):t===`services`?(0,G.jsx)(V,{replace:!0,to:F.settings.ai}):(0,G.jsx)(Le,{})}function Le(){let{t:e}=B(`settings`);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,G.jsxs)(Z,{heading:e(`voicePage.sectionOutputHeading`),description:e(`voicePage.sectionOutputDescription`),children:[(0,G.jsx)(Ae,{}),(0,G.jsx)(Re,{})]}),(0,G.jsxs)(Z,{heading:e(`voicePage.sectionInputHeading`),description:e(`voicePage.sectionInputDescription`),children:[(0,G.jsx)(Be,{}),(0,G.jsx)(xe,{}),ee()?(0,G.jsx)(De,{}):(0,G.jsx)(Ue,{}),(0,G.jsx)(We,{})]}),(0,G.jsx)(Z,{heading:e(`voicePage.sectionCaptionsHeading`),children:(0,G.jsx)(ze,{})})]})}function Re(){let{t:e}=B(`settings`),{available:t}=o(L());return t?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:[(0,G.jsx)(H,{className:`h-3.5 w-3.5 shrink-0 text-[var(--content-quiet)]`}),(0,G.jsx)(`span`,{children:e(`voicePage.speechServicesBannerPrompt`)}),(0,G.jsxs)(he,{to:`${F.settings.ai}#text-to-speech`,className:u(_({tone:`quiet`}),`inline-flex items-center gap-1 text-[var(--content-secondary)] decoration-[var(--border-element)] underline-offset-2`),children:[e(`voicePage.speechServicesBannerLink`),(0,G.jsx)(ve,{className:`h-3 w-3`})]})]}):null}function Z({heading:e,description:t,children:n}){return(0,G.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`h2`,{className:`text-label-medium-default uppercase tracking-wide text-[var(--content-tertiary)]`,children:e}),t&&(0,G.jsx)(`p`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:t})]}),n]})}function ze(){let{t:e}=B(`settings`);return(0,G.jsx)(U,{title:e(`voicePage.captionsTitle`),subtitle:e(`voicePage.captionsSubtitle`),children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(Fe,{showDescription:!0}),(0,G.jsx)(`p`,{className:`${X} pt-1`,children:e(`voicePage.captionsRecommendation`,Me)})]})})}var Q=``;function Be(){let{t:e}=B(`settings`),[t,n]=(0,W.useState)([]),[r,a]=(0,W.useState)(!1),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(()=>ae()),u=(0,W.useCallback)(async()=>{if(!navigator.mediaDevices?.enumerateDevices)return;let e=await y();a(e.needsPermission),n(e.devices),s(e.known)},[]),d=(0,W.useCallback)(async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop()}catch{}u()},[u]);(0,W.useEffect)(()=>{u();let e=navigator.mediaDevices;if(!e?.addEventListener)return;let t=()=>void u();return e.addEventListener(`devicechange`,t),()=>e.removeEventListener(`devicechange`,t)},[u]);let f=(0,W.useMemo)(()=>{let n=t.map((t,n)=>({value:t.deviceId,label:t.label||e(`voicePage.microphoneFallbackLabel`,{index:n+1})})),r=c!==Q&&!n.some(e=>e.value===c);return[{value:null,label:e(`voicePage.systemDefault`)},...n,...r?[{value:c,label:e(o?`voicePage.savedMicrophoneNotConnected`:`voicePage.savedMicrophone`)}]:[]]},[t,c,o,e]),p=(0,W.useCallback)(e=>{l(e),M(e)},[]);(0,W.useEffect)(()=>ce(()=>{l(ae())}),[]);let m=c===Q?null:c;return(0,G.jsx)(U,{title:e(`voicePage.microphoneTitle`),subtitle:e(`voicePage.microphoneSubtitle`),children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(`div`,{className:`max-w-xs`,children:(0,G.jsx)(k,{options:f,value:m,onChange:p,onSelectNone:()=>p(Q),"aria-label":e(`voicePage.microphoneAriaLabel`)})}),r&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(i,{variant:`outlined`,onClick:d,children:e(`voicePage.allowMicrophoneAccess`)}),(0,G.jsx)(`span`,{className:X,children:e(`voicePage.grantMicrophoneAccessHint`)})]})]})})}var Ve=new Set([`Control`,`Alt`,`Shift`,`Meta`]),$=`toggleVoice`,He=[{label:`Ctrl+Shift`,activator:{kind:`modifierOnly`,modifiers:[`control`,`shift`]}},{label:`Alt`,activator:{kind:`modifierOnly`,modifiers:[`option`]}}];function Ue(){let{t:e}=B(`settings`),t=D(),[n,i]=(0,W.useState)(()=>c()),[o,s]=(0,W.useState)(!1),[l,u]=(0,W.useState)([]),[f,p]=(0,W.useState)(!1),h=(0,W.useRef)(null),g=(0,W.useMemo)(()=>{let e=m();return[{label:R(e),activator:e}]},[]),_=n.kind!==`off`,v=(0,W.useCallback)(e=>{i(e),C(e),s(!1),u([]),p(!1)},[]),y=be({onBound:()=>v({kind:`off`})}),b=y.catalog.find(e=>e.key===$)?.accelerator??``,x=y.recordingKey===$,S=r()?He:[],w=(0,W.useCallback)(e=>{v(e),y.removeHotkey($)},[y,v]),k=(0,W.useCallback)(()=>{v({kind:`off`}),y.removeHotkey($)},[y,v]),A=(0,W.useCallback)(()=>{s(!0),u([]),p(!1),requestAnimationFrame(()=>{h.current?.focus()})},[]),j=(0,W.useCallback)(()=>{s(!1),u([]),p(!1)},[]),M=(0,W.useCallback)(e=>{let t=[];return e.ctrlKey&&t.push(`control`),e.altKey&&t.push(`option`),e.shiftKey&&t.push(`shift`),e.metaKey&&t.push(`command`),t},[]),N=(0,W.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){j();return}let t=M(e);if(Ve.has(e.key)){p(!1),u(T(t));return}if(t.length===0){p(!0);return}v({kind:`key`,label:e.key.length===1?e.key.toUpperCase():e.key,modifiers:T(t)})},[j,M,v]),P=(0,W.useCallback)(e=>{o&&M(e).length===0&&l.length>0&&(u([]),p(!0))},[M,o,l]);(0,W.useEffect)(()=>{if(!o)return;let e=e=>{h.current&&!h.current.contains(e.target)&&j()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[j,o]);let F=_&&!g.some(e=>I(e.activator,n));return t?(0,G.jsx)(U,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitleDesktop`),children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[S.map(e=>(0,G.jsx)(K,{label:e.label,selected:I(e.activator,n),onClick:()=>w(e.activator)},e.label)),(0,G.jsx)(K,{label:x?e(`voicePage.recordingPrompt`):b?(0,G.jsx)(a,{accelerator:b}):e(`voicePage.customKey`),selected:b!==``,recording:x,onClick:x?y.stopRecording:()=>y.startRecording($)}),(0,G.jsx)(K,{label:e(`voicePage.offKeyLabel`),selected:n.kind===`off`&&!b&&!x,onClick:k})]}),y.conflict?.key===$&&(0,G.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,G.jsx)(H,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:e(`voicePage.shortcutConflict`,{command:y.conflict.label})})]})]})}):(0,G.jsx)(U,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitle`),children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsx)(E,{checked:_,onChange:e=>{v(e?d():{kind:`off`})},label:e(`voicePage.enableVoiceShortcut`)}),_&&(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`span`,{className:X,children:e(`voicePage.activationKeyLabel`)}),(0,G.jsxs)(`div`,{ref:h,tabIndex:o?0:-1,onKeyDown:o?N:void 0,onKeyUp:o?P:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[g.map(e=>(0,G.jsx)(K,{label:e.label,selected:I(e.activator,n),onClick:()=>v(e.activator)},e.label)),o?(0,G.jsx)(K,{label:l.length>0?O(l):e(`voicePage.pressShortcut`),selected:!0,recording:!0,onClick:j}):(0,G.jsx)(K,{label:F?R(n):e(`voicePage.customKey`),selected:F,onClick:A})]}),f&&(0,G.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,G.jsx)(H,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:e(`voicePage.shortcutChordHint`)})]}),_&&(0,G.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,G.jsx)(H,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,G.jsx)(`span`,{children:e(`voicePage.focusedTabNote`)})]})]})]})})}function We(){let{t:e}=B(`settings`),t=z.use.pauseBeforeReplyMs(),n=z.use.setPauseBeforeReplyMs(),r=z.use.interruptSensitivity(),a=z.use.setInterruptSensitivity(),o=(0,W.useMemo)(()=>[{value:`low`,label:e(`voicePage.interruptSensitivityLow`)},{value:`medium`,label:e(`voicePage.interruptSensitivityMedium`)},{value:`high`,label:e(`voicePage.interruptSensitivityHigh`)}],[e]),s=t!==null||r!==null;return(0,G.jsx)(U,{title:e(`voicePage.turnTakingTitle`),subtitle:e(`voicePage.turnTakingSubtitle`),children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,G.jsx)(we,{}),(0,G.jsx)(Ge,{label:e(`voicePage.pauseBeforeReplyLabel`),description:e(`voicePage.pauseBeforeReplyDescription`),isDefault:t===null,children:(0,G.jsx)(`div`,{className:`max-w-xs`,children:(0,G.jsx)(j,{value:(t??1200)/1e3,onValueChange:e=>{typeof e==`number`&&n(Math.round(e*1e3))},min:500/1e3,max:g/1e3,step:.1,showValue:!0,formatValue:e=>`${(typeof e==`number`?e:e[0]).toFixed(1)}s`,"aria-label":e(`voicePage.pauseBeforeReplyAriaLabel`)})})}),(0,G.jsx)(Ge,{label:e(`voicePage.interruptSensitivityLabel`),description:e(`voicePage.interruptSensitivityDescription`),isDefault:r===null,children:(0,G.jsx)(`div`,{className:`max-w-xs`,children:(0,G.jsx)(se,{items:o,value:r??`medium`,onChange:a,ariaLabel:e(`voicePage.interruptSensitivityAriaLabel`)})})}),s&&(0,G.jsx)(`div`,{children:(0,G.jsx)(i,{variant:`outlined`,onClick:()=>{n(null),a(null)},children:e(`voicePage.resetToDefaults`)})})]})})}function Ge({label:e,description:t,isDefault:n,children:r}){let{t:i}=B(`settings`);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e}),n&&(0,G.jsx)(`span`,{className:`shrink-0 rounded-full bg-[var(--surface-active)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:i(`voicePage.defaultBadge`)})]}),(0,G.jsx)(`p`,{className:X,children:t}),r]})}export{Ie as VoicePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Mn as e,Nn as t,Qn as n}from"./app-
|
|
1
|
+
import{Mn as e,Nn as t,Qn as n}from"./app-XG_RF2yi.js";import{E as r}from"./vendor-DwMhK7fD.js";import{t as i}from"./react-B9IgSVeK.js";import{$ as a}from"./icons-C0wyat6T.js";var o=i();function s({payload:e,onClose:i}){let{t:s}=r(`chat`),u=t(e.body);return(0,o.jsx)(n,{Glyph:a,title:e.title||s(`wakeDetailPanel.title`),closeLabel:s(`wakeDetailPanel.closeAria`),closeVariant:`outlined`,onClose:i,children:(0,o.jsxs)(`dl`,{className:`flex flex-col gap-5`,children:[u.workflow&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.workflow`),children:u.workflow}),u.runStatus&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.runStatus`),children:(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:u.runStatus})}),u.result&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.result`),children:(0,o.jsx)(c,{result:u.result})}),u.rest&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.details`),children:(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:u.rest})}),e.metadata.length>0&&(0,o.jsx)(`div`,{className:`flex flex-col gap-5`,children:e.metadata.map(e=>(0,o.jsx)(l,{label:e.label,children:e.value},e.label))})]})})}function c({result:t}){let n=e(t);return n?(0,o.jsx)(`div`,{className:`flex flex-col gap-4`,children:n.map((e,t)=>(0,o.jsx)(`div`,{className:t>0?`flex flex-col gap-2 border-t border-[var(--border-hover)] pt-4`:`flex flex-col gap-2`,children:e.map(e=>(0,o.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,o.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:e.key}),(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:e.value})]},e.key))},t))}):(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:t})}function l({label:e,children:t}){return(0,o.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`dt`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:e}),(0,o.jsx)(`dd`,{className:`text-body-medium-default text-[var(--content-default)]`,children:t})]})}export{s as WakeDetailPanel};
|
package/dist/assets/{weather-forecast-display-Ea8cYhbQ.js → weather-forecast-display-BvUd--wf.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{cn as t,ln as n,on as r,qo as i,sn as a}from"./app-g1TvV-Dl.js";import{E as o}from"./vendor-DwMhK7fD.js";import{t as s,x as c}from"./react-B9IgSVeK.js";import{Ci as l,Si as u,V as d,_i as f,bi as p,c as m,ni as h,tt as g,vi as _,vn as v,xi as y}from"./icons-C0wyat6T.js";var b=e(c(),1),x={"sun.max.fill":{icon:d,className:`text-orange-500`},"cloud.sun.fill":{icon:_,className:`text-amber-400`},"moon.fill":{icon:v,className:`text-blue-400`},"cloud.moon.fill":{icon:y,className:`text-blue-400`},"cloud.fill":{icon:f,className:`text-stone-400`},"cloud.rain.fill":{icon:p,className:`text-blue-400`},snowflake:{icon:g,className:`text-blue-300`},"cloud.bolt.fill":{icon:u,className:`text-orange-500`},"cloud.fog.fill":{icon:l,className:`text-stone-400`}},S={sunny:{icon:d,className:`text-orange-500`},clear:{icon:d,className:`text-orange-500`},"partly cloudy":{icon:_,className:`text-amber-400`},"mostly sunny":{icon:_,className:`text-amber-400`},cloudy:{icon:f,className:`text-stone-400`},overcast:{icon:f,className:`text-stone-400`},rainy:{icon:p,className:`text-blue-400`},rain:{icon:p,className:`text-blue-400`},drizzle:{icon:p,className:`text-blue-400`},snow:{icon:g,className:`text-blue-300`},snowy:{icon:g,className:`text-blue-300`},thunderstorm:{icon:u,className:`text-orange-500`},thunder:{icon:u,className:`text-orange-500`},foggy:{icon:l,className:`text-stone-400`},fog:{icon:l,className:`text-stone-400`},mist:{icon:l,className:`text-stone-400`},hazy:{icon:l,className:`text-stone-400`},night:{icon:v,className:`text-blue-400`},"mainly clear":{icon:d,className:`text-orange-500`},"mostly cloudy":{icon:f,className:`text-stone-400`},breezy:{icon:m,className:`text-stone-400`},windy:{icon:m,className:`text-stone-400`},cool:{icon:f,className:`text-stone-400`},warm:{icon:d,className:`text-orange-500`},hot:{icon:d,className:`text-orange-500`},cold:{icon:g,className:`text-blue-300`},"cold snap":{icon:g,className:`text-blue-300`},"warm, mostly sunny":{icon:_,className:`text-amber-400`},"cooler, breezy":{icon:m,className:`text-stone-400`}},C={icon:f,className:`text-stone-400`};function w(e){let t=x[e];if(t)return t;let n=e.toLowerCase(),r=S[n];if(r)return r;for(let[e,t]of Object.entries(S))if(n.includes(e))return t;return C}function T(e){if(typeof e==`string`){let t=e.match(/^(\d+)\s*mph\s*(.*)/i);if(t)return{speed:Number(t[1]),direction:t[2]?.trim()||void 0}}return{}}function E(e){let i;if(typeof e.location==`string`)i=e.location;else{let n=t(e.location);n&&typeof n.name==`string`&&(i=n.name)}if(!i)return null;let o=t(e.current),s=a(o?.temp)??a(e.currentTemp)??a(e.temperature)??a(e.temp),c=a(o?.feelsLike)??a(o?.feels_like)??a(o?.apparentTemperature)??a(e.feelsLike)??a(e.feels_like)??a(e.apparentTemperature),l=n(o?.condition)??n(e.condition),u=a(o?.humidity)??a(e.humidity),d=T(o?.wind??e.wind),f=a(o?.windSpeed)??a(o?.wind_speed)??a(e.windSpeed)??a(e.wind_speed)??d.speed,p=n(o?.windDirection)??n(o?.wind_direction)??n(e.windDirection)??n(e.wind_direction)??d.direction,m=t(e.units),h=n(m?.temperature)??n(o?.unit)??n(e.unit)??`F`,g=n(m?.speed)??n(e.windUnit)??n(e.wind_unit),_=r(e.hourly).map((e,t)=>({id:n(e.id)??String(t),time:n(e.time)??``,icon:n(e.icon)??n(e.condition)??`cloud.fill`,temp:a(e.tempC)??a(e.temp)??a(e.temperature),tempC:a(e.tempC)})),v=r([e.forecast,e.daily,e.days].find(Array.isArray)).map((e,t)=>({id:n(e.id)??String(t),day:n(e.day)??n(e.date),dayLabel:n(e.dayLabel)??n(e.date),icon:n(e.icon)??n(e.condition)??`cloud.fill`,low:a(e.low),high:a(e.high),lowC:a(e.lowC),highC:a(e.highC),precip:a(e.precip)??a(e.precipitation)??a(e.precipitationProbability),condition:n(e.condition)}));return{location:i,currentTemp:s,feelsLike:c,condition:l,humidity:u,windSpeed:f,windDirection:p,windUnit:g,unit:h,hourly:_.length>0?_:void 0,forecast:v.length>0?v:void 0}}function D(e){return e*9/5+32}function O(e){return(e-32)*5/9}function k(e,t,n){if(e===void 0)return null;let r=e;return t&&!n&&(r=O(e)),!t&&n&&(r=D(e)),`${Math.round(r)}`}function A(e,t,n){return e.tempC===void 0?e.temp===void 0?null:k(e.temp,t,n):k(e.tempC,!1,n)}function j(e,t,n){return e.lowC===void 0?k(e.low,t,n):k(e.lowC,!1,n)}function M(e,t,n){return e.highC===void 0?k(e.high,t,n):k(e.highC,!1,n)}var N=s();function P({icon:e,size:t=20}){let{icon:n,className:r}=w(e);return(0,N.jsx)(n,{width:t,height:t,className:r})}function F({useFahrenheit:e,onToggle:t}){let{t:n}=o(`chat`);return(0,N.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border border-[var(--border-element)]`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(!0),className:i(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-[var(--primary-base)] text-[var(--content-inset)]`:`bg-transparent text-[var(--content-quiet)]`),children:n(`weatherForecastDisplay.fahrenheit`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(!1),className:i(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-transparent text-[var(--content-quiet)]`:`bg-[var(--primary-base)] text-[var(--content-inset)]`),children:n(`weatherForecastDisplay.celsius`)})]})}function I({data:e,sourceIsFahrenheit:t,useFahrenheit:n,onToggle:r}){let{t:i}=o(`chat`),a=e.location,s=k(e.currentTemp,t,n),c=k(e.feelsLike,t,n),l=n?`F`:`C`,u=e.forecast?.[0],d=u?M(u,t,n):null,f=u?j(u,t,n):null,p=null;return e.windSpeed!==void 0&&(p=`${Math.round(e.windSpeed)} ${e.windUnit??`mph`}`,e.windDirection&&(p=`${e.windDirection} ${p}`)),(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:a}),s!==null&&(0,N.jsxs)(`div`,{className:`mt-1 text-4xl font-light text-[var(--content-default)]`,children:[s,`°`,l]}),e.condition&&(0,N.jsx)(`div`,{className:`mt-0.5 text-body-small-default text-[var(--content-quiet)]`,children:e.condition})]}),(0,N.jsx)(F,{useFahrenheit:n,onToggle:r})]}),(0,N.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3`,children:[c!==null&&(0,N.jsx)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:i(`weatherForecastDisplay.feelsLike`,{temp:c})}),d!==null&&f!==null&&(0,N.jsx)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:i(`weatherForecastDisplay.highLow`,{high:d,low:f})}),p&&(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,N.jsx)(m,{width:12,height:12}),p]}),e.humidity!==void 0&&(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,N.jsx)(h,{width:12,height:12}),e.humidity,`%`]})]})]})}function L({hourly:e,sourceIsFahrenheit:t,useFahrenheit:n}){let{t:r}=o(`chat`);return(0,N.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,N.jsx)(`div`,{className:`flex gap-3 overflow-x-auto`,children:e.map((e,i)=>{let a=e.time.toLowerCase()===`now`,o=A(e,t,n);return(0,N.jsxs)(`div`,{className:`flex min-w-[3rem] shrink-0 flex-col items-center gap-1`,children:[(0,N.jsx)(`span`,{className:a?`text-body-small-emphasised text-[var(--content-default)]`:`text-label-medium-default text-[var(--content-quiet)]`,children:a?r(`weatherForecastDisplay.now`):e.time}),(0,N.jsx)(P,{icon:e.icon,size:18}),o!==null&&(0,N.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-default)]`,children:[o,`°`]})]},e.id??i)})})})}function R({forecast:e,currentTemp:t,sourceIsFahrenheit:n,useFahrenheit:r}){let{globalMin:a,globalMax:o}=(0,b.useMemo)(()=>{let t=1/0,n=-1/0;for(let r of e){let e=r.lowC??r.low,i=r.highC??r.high;e!==void 0&&e<t&&(t=e),i!==void 0&&i>n&&(n=i)}return{globalMin:t===1/0?0:t,globalMax:n===-1/0?100:n}},[e]),s=o-a||1;return(0,N.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,N.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map((e,c)=>{let l=e.dayLabel??e.day??`Day ${c+1}`,u=l.toLowerCase()===`today`,d=j(e,n,r),f=M(e,n,r),p=e.precip,m=e.lowC??e.low??a,h=e.highC??e.high??o,g=(m-a)/s*100,_=(h-a)/s*100,v=Math.max(_-g,2),y=null;if(u&&t!==void 0){let r=(e.lowC!==void 0||e.highC!==void 0)&&n?(t-32)*5/9:t;y=h===m?50:(Math.max(m,Math.min(h,r))-m)/(h-m)*100}return(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:i(`w-12 shrink-0 truncate text-body-small-default`,u?`text-[var(--content-default)]`:`text-[var(--content-quiet)]`),children:l}),(0,N.jsxs)(`div`,{className:`flex w-10 shrink-0 items-center justify-center gap-0.5`,children:[(0,N.jsx)(P,{icon:e.icon,size:16}),p!==void 0&&p>0&&(0,N.jsxs)(`span`,{className:`text-label-small-default text-blue-400`,children:[Math.round(p),`%`]})]}),(0,N.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-faint)]`,children:d===null?`--`:`${d}°`}),(0,N.jsxs)(`div`,{className:`relative h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--border-subtle)]`,children:[(0,N.jsx)(`div`,{className:`absolute top-0 h-full rounded-full bg-[var(--primary-base)]`,style:{left:`${g}%`,width:`${v}%`}}),y!==null&&(0,N.jsx)(`div`,{className:`absolute top-1/2 h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-[var(--aux-white)] bg-[var(--aux-white)] shadow-sm`,style:{left:`${g+y/100*v}%`}})]}),(0,N.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-default)]`,children:f===null?`--`:`${f}°`})]},e.id??c)})})})}function z({templateData:e,fallback:t}){let n=(0,b.useMemo)(()=>E(e),[e]),r=n?.unit?.toUpperCase()===`F`||n?.unit?.toLowerCase()===`fahrenheit`,[i,a]=(0,b.useState)(null),o=i??r;return!n||n.currentTemp===void 0&&!n.forecast?.length?t??null:(0,N.jsxs)(`div`,{className:`mt-3`,children:[(0,N.jsx)(I,{data:n,sourceIsFahrenheit:r,useFahrenheit:o,onToggle:a}),n.hourly&&n.hourly.length>0&&(0,N.jsx)(L,{hourly:n.hourly,sourceIsFahrenheit:r,useFahrenheit:o}),n.forecast&&n.forecast.length>0&&(0,N.jsx)(R,{forecast:n.forecast,currentTemp:n.currentTemp,sourceIsFahrenheit:r,useFahrenheit:o})]})}export{z as WeatherForecastDisplay};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{cn as t,ln as n,on as r,qo as i,sn as a}from"./app-XG_RF2yi.js";import{E as o}from"./vendor-DwMhK7fD.js";import{t as s,x as c}from"./react-B9IgSVeK.js";import{Ci as l,Si as u,V as d,_i as f,bi as p,c as m,ni as h,tt as g,vi as _,vn as v,xi as y}from"./icons-C0wyat6T.js";var b=e(c(),1),x={"sun.max.fill":{icon:d,className:`text-orange-500`},"cloud.sun.fill":{icon:_,className:`text-amber-400`},"moon.fill":{icon:v,className:`text-blue-400`},"cloud.moon.fill":{icon:y,className:`text-blue-400`},"cloud.fill":{icon:f,className:`text-stone-400`},"cloud.rain.fill":{icon:p,className:`text-blue-400`},snowflake:{icon:g,className:`text-blue-300`},"cloud.bolt.fill":{icon:u,className:`text-orange-500`},"cloud.fog.fill":{icon:l,className:`text-stone-400`}},S={sunny:{icon:d,className:`text-orange-500`},clear:{icon:d,className:`text-orange-500`},"partly cloudy":{icon:_,className:`text-amber-400`},"mostly sunny":{icon:_,className:`text-amber-400`},cloudy:{icon:f,className:`text-stone-400`},overcast:{icon:f,className:`text-stone-400`},rainy:{icon:p,className:`text-blue-400`},rain:{icon:p,className:`text-blue-400`},drizzle:{icon:p,className:`text-blue-400`},snow:{icon:g,className:`text-blue-300`},snowy:{icon:g,className:`text-blue-300`},thunderstorm:{icon:u,className:`text-orange-500`},thunder:{icon:u,className:`text-orange-500`},foggy:{icon:l,className:`text-stone-400`},fog:{icon:l,className:`text-stone-400`},mist:{icon:l,className:`text-stone-400`},hazy:{icon:l,className:`text-stone-400`},night:{icon:v,className:`text-blue-400`},"mainly clear":{icon:d,className:`text-orange-500`},"mostly cloudy":{icon:f,className:`text-stone-400`},breezy:{icon:m,className:`text-stone-400`},windy:{icon:m,className:`text-stone-400`},cool:{icon:f,className:`text-stone-400`},warm:{icon:d,className:`text-orange-500`},hot:{icon:d,className:`text-orange-500`},cold:{icon:g,className:`text-blue-300`},"cold snap":{icon:g,className:`text-blue-300`},"warm, mostly sunny":{icon:_,className:`text-amber-400`},"cooler, breezy":{icon:m,className:`text-stone-400`}},C={icon:f,className:`text-stone-400`};function w(e){let t=x[e];if(t)return t;let n=e.toLowerCase(),r=S[n];if(r)return r;for(let[e,t]of Object.entries(S))if(n.includes(e))return t;return C}function T(e){if(typeof e==`string`){let t=e.match(/^(\d+)\s*mph\s*(.*)/i);if(t)return{speed:Number(t[1]),direction:t[2]?.trim()||void 0}}return{}}function E(e){let i;if(typeof e.location==`string`)i=e.location;else{let n=t(e.location);n&&typeof n.name==`string`&&(i=n.name)}if(!i)return null;let o=t(e.current),s=a(o?.temp)??a(e.currentTemp)??a(e.temperature)??a(e.temp),c=a(o?.feelsLike)??a(o?.feels_like)??a(o?.apparentTemperature)??a(e.feelsLike)??a(e.feels_like)??a(e.apparentTemperature),l=n(o?.condition)??n(e.condition),u=a(o?.humidity)??a(e.humidity),d=T(o?.wind??e.wind),f=a(o?.windSpeed)??a(o?.wind_speed)??a(e.windSpeed)??a(e.wind_speed)??d.speed,p=n(o?.windDirection)??n(o?.wind_direction)??n(e.windDirection)??n(e.wind_direction)??d.direction,m=t(e.units),h=n(m?.temperature)??n(o?.unit)??n(e.unit)??`F`,g=n(m?.speed)??n(e.windUnit)??n(e.wind_unit),_=r(e.hourly).map((e,t)=>({id:n(e.id)??String(t),time:n(e.time)??``,icon:n(e.icon)??n(e.condition)??`cloud.fill`,temp:a(e.tempC)??a(e.temp)??a(e.temperature),tempC:a(e.tempC)})),v=r([e.forecast,e.daily,e.days].find(Array.isArray)).map((e,t)=>({id:n(e.id)??String(t),day:n(e.day)??n(e.date),dayLabel:n(e.dayLabel)??n(e.date),icon:n(e.icon)??n(e.condition)??`cloud.fill`,low:a(e.low),high:a(e.high),lowC:a(e.lowC),highC:a(e.highC),precip:a(e.precip)??a(e.precipitation)??a(e.precipitationProbability),condition:n(e.condition)}));return{location:i,currentTemp:s,feelsLike:c,condition:l,humidity:u,windSpeed:f,windDirection:p,windUnit:g,unit:h,hourly:_.length>0?_:void 0,forecast:v.length>0?v:void 0}}function D(e){return e*9/5+32}function O(e){return(e-32)*5/9}function k(e,t,n){if(e===void 0)return null;let r=e;return t&&!n&&(r=O(e)),!t&&n&&(r=D(e)),`${Math.round(r)}`}function A(e,t,n){return e.tempC===void 0?e.temp===void 0?null:k(e.temp,t,n):k(e.tempC,!1,n)}function j(e,t,n){return e.lowC===void 0?k(e.low,t,n):k(e.lowC,!1,n)}function M(e,t,n){return e.highC===void 0?k(e.high,t,n):k(e.highC,!1,n)}var N=s();function P({icon:e,size:t=20}){let{icon:n,className:r}=w(e);return(0,N.jsx)(n,{width:t,height:t,className:r})}function F({useFahrenheit:e,onToggle:t}){let{t:n}=o(`chat`);return(0,N.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border border-[var(--border-element)]`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(!0),className:i(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-[var(--primary-base)] text-[var(--content-inset)]`:`bg-transparent text-[var(--content-quiet)]`),children:n(`weatherForecastDisplay.fahrenheit`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(!1),className:i(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-transparent text-[var(--content-quiet)]`:`bg-[var(--primary-base)] text-[var(--content-inset)]`),children:n(`weatherForecastDisplay.celsius`)})]})}function I({data:e,sourceIsFahrenheit:t,useFahrenheit:n,onToggle:r}){let{t:i}=o(`chat`),a=e.location,s=k(e.currentTemp,t,n),c=k(e.feelsLike,t,n),l=n?`F`:`C`,u=e.forecast?.[0],d=u?M(u,t,n):null,f=u?j(u,t,n):null,p=null;return e.windSpeed!==void 0&&(p=`${Math.round(e.windSpeed)} ${e.windUnit??`mph`}`,e.windDirection&&(p=`${e.windDirection} ${p}`)),(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:a}),s!==null&&(0,N.jsxs)(`div`,{className:`mt-1 text-4xl font-light text-[var(--content-default)]`,children:[s,`°`,l]}),e.condition&&(0,N.jsx)(`div`,{className:`mt-0.5 text-body-small-default text-[var(--content-quiet)]`,children:e.condition})]}),(0,N.jsx)(F,{useFahrenheit:n,onToggle:r})]}),(0,N.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3`,children:[c!==null&&(0,N.jsx)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:i(`weatherForecastDisplay.feelsLike`,{temp:c})}),d!==null&&f!==null&&(0,N.jsx)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:i(`weatherForecastDisplay.highLow`,{high:d,low:f})}),p&&(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,N.jsx)(m,{width:12,height:12}),p]}),e.humidity!==void 0&&(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,N.jsx)(h,{width:12,height:12}),e.humidity,`%`]})]})]})}function L({hourly:e,sourceIsFahrenheit:t,useFahrenheit:n}){let{t:r}=o(`chat`);return(0,N.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,N.jsx)(`div`,{className:`flex gap-3 overflow-x-auto`,children:e.map((e,i)=>{let a=e.time.toLowerCase()===`now`,o=A(e,t,n);return(0,N.jsxs)(`div`,{className:`flex min-w-[3rem] shrink-0 flex-col items-center gap-1`,children:[(0,N.jsx)(`span`,{className:a?`text-body-small-emphasised text-[var(--content-default)]`:`text-label-medium-default text-[var(--content-quiet)]`,children:a?r(`weatherForecastDisplay.now`):e.time}),(0,N.jsx)(P,{icon:e.icon,size:18}),o!==null&&(0,N.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-default)]`,children:[o,`°`]})]},e.id??i)})})})}function R({forecast:e,currentTemp:t,sourceIsFahrenheit:n,useFahrenheit:r}){let{globalMin:a,globalMax:o}=(0,b.useMemo)(()=>{let t=1/0,n=-1/0;for(let r of e){let e=r.lowC??r.low,i=r.highC??r.high;e!==void 0&&e<t&&(t=e),i!==void 0&&i>n&&(n=i)}return{globalMin:t===1/0?0:t,globalMax:n===-1/0?100:n}},[e]),s=o-a||1;return(0,N.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,N.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map((e,c)=>{let l=e.dayLabel??e.day??`Day ${c+1}`,u=l.toLowerCase()===`today`,d=j(e,n,r),f=M(e,n,r),p=e.precip,m=e.lowC??e.low??a,h=e.highC??e.high??o,g=(m-a)/s*100,_=(h-a)/s*100,v=Math.max(_-g,2),y=null;if(u&&t!==void 0){let r=(e.lowC!==void 0||e.highC!==void 0)&&n?(t-32)*5/9:t;y=h===m?50:(Math.max(m,Math.min(h,r))-m)/(h-m)*100}return(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:i(`w-12 shrink-0 truncate text-body-small-default`,u?`text-[var(--content-default)]`:`text-[var(--content-quiet)]`),children:l}),(0,N.jsxs)(`div`,{className:`flex w-10 shrink-0 items-center justify-center gap-0.5`,children:[(0,N.jsx)(P,{icon:e.icon,size:16}),p!==void 0&&p>0&&(0,N.jsxs)(`span`,{className:`text-label-small-default text-blue-400`,children:[Math.round(p),`%`]})]}),(0,N.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-faint)]`,children:d===null?`--`:`${d}°`}),(0,N.jsxs)(`div`,{className:`relative h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--border-subtle)]`,children:[(0,N.jsx)(`div`,{className:`absolute top-0 h-full rounded-full bg-[var(--primary-base)]`,style:{left:`${g}%`,width:`${v}%`}}),y!==null&&(0,N.jsx)(`div`,{className:`absolute top-1/2 h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-[var(--aux-white)] bg-[var(--aux-white)] shadow-sm`,style:{left:`${g+y/100*v}%`}})]}),(0,N.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-default)]`,children:f===null?`--`:`${f}°`})]},e.id??c)})})})}function z({templateData:e,fallback:t}){let n=(0,b.useMemo)(()=>E(e),[e]),r=n?.unit?.toUpperCase()===`F`||n?.unit?.toLowerCase()===`fahrenheit`,[i,a]=(0,b.useState)(null),o=i??r;return!n||n.currentTemp===void 0&&!n.forecast?.length?t??null:(0,N.jsxs)(`div`,{className:`mt-3`,children:[(0,N.jsx)(I,{data:n,sourceIsFahrenheit:r,useFahrenheit:o,onToggle:a}),n.hourly&&n.hourly.length>0&&(0,N.jsx)(L,{hourly:n.hourly,sourceIsFahrenheit:r,useFahrenheit:o}),n.forecast&&n.forecast.length>0&&(0,N.jsx)(R,{forecast:n.forecast,currentTemp:n.currentTemp,sourceIsFahrenheit:r,useFahrenheit:o})]})}export{z as WeatherForecastDisplay};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ki as e,mS as t,px as n}from"./app-
|
|
1
|
+
import{ki as e,mS as t,px as n}from"./app-XG_RF2yi.js";import{E as r}from"./vendor-DwMhK7fD.js";import{f as i,t as a}from"./react-B9IgSVeK.js";import{t as o}from"./auth-welcome-screen-CCmw8K2q.js";var s=a();function c(){let{t:a}=r(`onboarding`),c=i();return(0,s.jsx)(o,{secondary:{label:a(`welcome.continueWithoutAccount`),onSelect:()=>{n()?c(t.selectAssistant,e):c(t.onboarding.hosting,e)}}})}export{c as WelcomeScreen};
|