@vellumai/web 0.12.2-dev.202609182015.188de8a → 0.12.2-dev.202609182114.335fa56
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-BkJsiMCk.js → a2a-invite-Ci3O-UuB.js} +1 -1
- package/dist/assets/{about-page-DKz6hc6m.js → about-page-B-7lyYEB.js} +1 -1
- package/dist/assets/{account-page-D2086vlm.js → account-page-CGtIVDfJ.js} +1 -1
- package/dist/assets/{account-shell-BzbAvUcW.js → account-shell-DLy0Ad5J.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-D1q28OPn.js → acp-run-detail-panel-D1WXDwZ3.js} +1 -1
- package/dist/assets/{activation-list-route-CymK18w2.js → activation-list-route-B5Ewg5yz.js} +1 -1
- package/dist/assets/{activity-redirect-page-DCcfRUi_.js → activity-redirect-page-2lUB6VgV.js} +1 -1
- package/dist/assets/{activity-steps-panel-BYjkiE5D.js → activity-steps-panel-Ba9xwFXj.js} +1 -1
- package/dist/assets/add-credits-modal-DqL2PtAm.js +1 -0
- package/dist/assets/{add-credits-modal-4Etl1PAt.js → add-credits-modal-xD_fI3hc.js} +1 -1
- package/dist/assets/{ai-page-CkrearYq.js → ai-page-BBz-BfyC.js} +1 -1
- package/dist/assets/{android-billing-handoff-B_bu7Rr8.js → android-billing-handoff-BBh13NBZ.js} +1 -1
- package/dist/assets/{api-key-screen-STe5cIxn.js → api-key-screen-DLdU9-qN.js} +1 -1
- package/dist/assets/{app-BfK0IQIk.js → app-BBUxTj9g.js} +65 -65
- package/dist/assets/{app-info-mmyV2q32.js → app-info-CtXHTQ8I.js} +1 -1
- package/dist/assets/{archive-redirect-page-BB3zYu05.js → archive-redirect-page-CR1hXS8u.js} +1 -1
- package/dist/assets/{assistant-handle-modal-CgnaRG-5.js → assistant-handle-modal-BAfB5jfI.js} +1 -1
- package/dist/assets/{assistant-inbox-page-route-CZEp6qpH.js → assistant-inbox-page-route-BCzsw_dR.js} +1 -1
- package/dist/assets/{assistant-inbox-upgrade-body-gHf4cLXK.js → assistant-inbox-upgrade-body-DqRg_E8P.js} +1 -1
- package/dist/assets/{assistant-status-panel-BTvZ573v.js → assistant-status-panel-CXtpB-3s.js} +1 -1
- package/dist/assets/auth-store-VfQBlZjf.js +1 -0
- package/dist/assets/{auth-welcome-screen-BTwCPZYQ.js → auth-welcome-screen-eEmmCa7a.js} +1 -1
- package/dist/assets/avatar-bundled-components-CBxBRJHT.js +1 -0
- package/dist/assets/{avatar-random-Bu1JUc-m.js → avatar-random-CmFgdVYy.js} +2 -2
- package/dist/assets/{await-org-header-settled-DIoy1_Jd.js → await-org-header-settled-rFkQnSY1.js} +1 -1
- package/dist/assets/{background-task-detail-panel-DJsB3oAn.js → background-task-detail-panel-CujUAl64.js} +1 -1
- package/dist/assets/{billing-page-KdEbDnk2.js → billing-page-C3fvhOOQ.js} +3 -3
- package/dist/assets/{billing-redirect-page-B0JXbuDV.js → billing-redirect-page-CKl8d4sb.js} +1 -1
- package/dist/assets/{bookmarks-page-VALGfihg.js → bookmarks-page-B2YSfE6-.js} +1 -1
- package/dist/assets/{bundle-confirm-page-CaLFi7ku.js → bundle-confirm-page-gJCzHRKr.js} +1 -1
- package/dist/assets/{channel-transcript-panel-D4KVRmwh.js → channel-transcript-panel-D5L38TzO.js} +1 -1
- package/dist/assets/{channels-page-route-COc0hysG.js → channels-page-route-afqHw3N0.js} +1 -1
- package/dist/assets/{chat-info-panel-pW2_d9mO.js → chat-info-panel-DTA_-olk.js} +1 -1
- package/dist/assets/{checkout-continuation-9qrV5c78.js → checkout-continuation-5Jtm_JrA.js} +1 -1
- package/dist/assets/{checkout-page-DxpEqYIc.js → checkout-page-DULnZwd9.js} +1 -1
- package/dist/assets/checkout-return-target-DWik-led.js +1 -0
- package/dist/assets/{command-palette-E9QrPenm.js → command-palette-BD0yvfbb.js} +1 -1
- package/dist/assets/command-palette-CVX6w4zo.js +1 -0
- package/dist/assets/{command-palette-window-page-CZXCfB57.js → command-palette-window-page-Bk5U7P1e.js} +1 -1
- package/dist/assets/common-2tBLDaGA.js +1 -0
- package/dist/assets/common-BbH8TVsn.js +1 -0
- package/dist/assets/common-CLiCbaO-.js +1 -0
- package/dist/assets/{common-c9S--s7Z.js → common-WxNH1jIH.js} +1 -1
- package/dist/assets/{community-page-Cj2Wd0lm.js → community-page-CUQ3qu-V.js} +1 -1
- package/dist/assets/{companion-accent-DDGqoGt7.js → companion-accent-BYoVCdU1.js} +1 -1
- package/dist/assets/{companion-dock-zones-page-DTi3NZqD.js → companion-dock-zones-page-sX6B3NE_.js} +1 -1
- package/dist/assets/{companion-layout-oDK2JvY4.js → companion-layout-33AE1gia.js} +1 -1
- package/dist/assets/{companion-popover-DbIXR8Bk.js → companion-popover-TujVt-Ar.js} +1 -1
- package/dist/assets/{companion-popover-page-BSLD45sw.js → companion-popover-page-ByBb4sHd.js} +1 -1
- package/dist/assets/{companion-surface-page-BO8ktCPi.js → companion-surface-page-BbWzCHgm.js} +1 -1
- package/dist/assets/{companion-watch-frame-page-DFn5w5vu.js → companion-watch-frame-page-BIETd4hp.js} +1 -1
- package/dist/assets/{connect-page-Do1DxTJR.js → connect-page-BO1XQJwf.js} +1 -1
- package/dist/assets/{consent-controls-D99GwSSN.js → consent-controls-DZjKfsjW.js} +1 -1
- package/dist/assets/{contacts-gateway-BC6WaVFg.js → contacts-gateway-B5O7Ne74.js} +1 -1
- package/dist/assets/{contacts-page-route-CXW0fKwC.js → contacts-page-route-CWQ8xq2e.js} +1 -1
- package/dist/assets/{copy-button-CmwoARVB.js → copy-button-BIeybJYd.js} +1 -1
- package/dist/assets/{credential-entry-page-DfXFeMIN.js → credential-entry-page-BRvUcU5-.js} +1 -1
- package/dist/assets/{credentials-page-DRVB3E60.js → credentials-page-BCpKSirx.js} +1 -1
- package/dist/assets/{csv-preview-CiaeYC20.js → csv-preview-sSdnMx-6.js} +1 -1
- package/dist/assets/{danger-zone-redirect-page-B4c2l_0r.js → danger-zone-redirect-page-521j5Kuo.js} +1 -1
- package/dist/assets/{debug-page-CvyE149B.js → debug-page-Ci2myxA0.js} +1 -1
- package/dist/assets/deploy-dialogs-pkluahDA.js +1 -0
- package/dist/assets/{deploy-dialogs-mEenw05v.js → deploy-dialogs-u3yfw8HJ.js} +1 -1
- package/dist/assets/{desktop-preview-content-DWlmtZ40.js → desktop-preview-content-DYVVZr2w.js} +2 -2
- package/dist/assets/{desktop-status-u4hV53HS.js → desktop-status-B4ofrNCE.js} +1 -1
- package/dist/assets/{desktop-viewer-CFOGac24.js → desktop-viewer-CxxkXSPF.js} +1 -1
- package/dist/assets/{detail-card-CZVSMSNs.js → detail-card-BhMBZjzu.js} +1 -1
- package/dist/assets/{detail-panel-stop-button-CoA_583J.js → detail-panel-stop-button-BXvuwM0g.js} +1 -1
- package/dist/assets/detail-primitives-Bh6NmCv7.js +1 -0
- package/dist/assets/{developer-page-Co9T6jqJ.js → developer-page-CC5VjRqN.js} +1 -1
- package/dist/assets/{devices-redirect-page-CbXvqz4V.js → devices-redirect-page-sytJWmif.js} +1 -1
- package/dist/assets/{dictation-overlay-page-DohFzjtT.js → dictation-overlay-page-wEGaipQM.js} +1 -1
- package/dist/assets/document-load-C91qCZur.js +1 -0
- package/dist/assets/{document-load-DGt33NFw.js → document-load-Cxy5V3Q3.js} +1 -1
- package/dist/assets/{document-viewer-page-DMRNTqY7.js → document-viewer-page-CF5Qsyn0.js} +1 -1
- package/dist/assets/{emails-page-CgbmlG_-.js → emails-page-CF5E8gMK.js} +1 -1
- package/dist/assets/{file-diff-view-D0X_TuVO.js → file-diff-view-DeCwZxAs.js} +1 -1
- package/dist/assets/{file-editor-vMWOc28f.js → file-editor-kOM9p3-b.js} +1 -1
- package/dist/assets/{general-page-DRoY1Iej.js → general-page-CHuT-gI-.js} +1 -1
- package/dist/assets/{hatching-screen-BNJtdwkK.js → hatching-screen-CRUvQYM3.js} +1 -1
- package/dist/assets/{hosting-screen-BZRT7l7I.js → hosting-screen-cKl8LkVn.js} +1 -1
- package/dist/assets/{identity-page-route-CFrCh_KE.js → identity-page-route-A6PcJJKj.js} +1 -1
- package/dist/assets/{inspect-page-BHkl8Ibk.js → inspect-page-C98uAPdc.js} +3 -3
- package/dist/assets/{integrations-page-BYqa4ZWD.js → integrations-page-C8x-gkb9.js} +1 -1
- package/dist/assets/{intelligence-layout-eis9JaHj.js → intelligence-layout-ChW1oIoj.js} +1 -1
- package/dist/assets/intelligence-layout-slots-store-D8qMofvo.js +1 -0
- package/dist/assets/{keyboard-shortcuts-redirect-page-Lb1SQwRg.js → keyboard-shortcuts-redirect-page-BYcDZHs7.js} +1 -1
- package/dist/assets/{latest-assistant-text-T4hNgVuv.js → latest-assistant-text-Dnh6k0g4.js} +1 -1
- package/dist/assets/{library-detail-page-CWDBsQis.js → library-detail-page-DRUffaFd.js} +1 -1
- package/dist/assets/{library-page-Mg60THux.js → library-page-dNnf_D2k.js} +1 -1
- package/dist/assets/local-mode-DI-seN56.js +1 -0
- package/dist/assets/{login-page-DQCXCIr1.js → login-page-BPkEvkFD.js} +1 -1
- package/dist/assets/{logout-page-7dYOYnPb.js → logout-page-D3opSUZI.js} +1 -1
- package/dist/assets/{logs-layout-CY2j2fvO.js → logs-layout-ZkvUiVsu.js} +1 -1
- package/dist/assets/{markdown-preview-CfEjiWNm.js → markdown-preview-MnyvCMa3.js} +1 -1
- package/dist/assets/{media-preview-BaQUTRiQ.js → media-preview-BQxdPaMe.js} +1 -1
- package/dist/assets/{memory-page-route-C03izhfJ.js → memory-page-route-6Xr4vUpi.js} +1 -1
- package/dist/assets/{memory-router-playground-page-DdjGQ-b9.js → memory-router-playground-page-CaTWoBrm.js} +1 -1
- package/dist/assets/{message-files-panel-DCFWS80s.js → message-files-panel-CL8oaeEs.js} +1 -1
- package/dist/assets/{metric-card-BPdD5GIY.js → metric-card-Bk5HVUSj.js} +1 -1
- package/dist/assets/native-attachment-pickers-DSMoNnpj.js +1 -0
- package/dist/assets/native-file-BsIX0824.js +1 -0
- package/dist/assets/{notifications-page-BrufA0ep.js → notifications-page-BwawEEVb.js} +1 -1
- package/dist/assets/{oauth-complete-page-CU0ZFKgo.js → oauth-complete-page-E8VFzbV8.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-CWV5_KjG.js → oauth-popup-complete-page-BPruZqf-.js} +1 -1
- package/dist/assets/paired-platform-identity-DC-PSt-z.js +1 -0
- package/dist/assets/{pairing-page-BWvSec2z.js → pairing-page-pUxc_Q6w.js} +1 -1
- package/dist/assets/password-reset-page-D_XJ_720.js +1 -0
- package/dist/assets/{pdf-file-preview-BDNFrYwL.js → pdf-file-preview-CcYLZEEX.js} +1 -1
- package/dist/assets/{personality-page-BeDOP0Yx.js → personality-page-D7ltEpyD.js} +1 -1
- package/dist/assets/{personality-page-BgCVuORF.js → personality-page-DJ8ZQNex.js} +1 -1
- package/dist/assets/{personality-sliders-DPrI9-Un.js → personality-sliders-B_qi0jNr.js} +1 -1
- package/dist/assets/{plans-page-Dulw9Q1k.js → plans-page-DjMkYu8P.js} +1 -1
- package/dist/assets/{platform-loopback-page-SyOClPdC.js → platform-loopback-page-B7YadjAM.js} +1 -1
- package/dist/assets/{plugin-detail-page-ycy32YsM.js → plugin-detail-page-DJHgAPt-.js} +1 -1
- package/dist/assets/{plugins-page-6VvPNQ_q.js → plugins-page-t9j6WJsi.js} +1 -1
- package/dist/assets/plugins-surface-DY7rojgP.js +1 -0
- package/dist/assets/{preview-error-CYKkv16g.js → preview-error-CTmJUZ1U.js} +1 -1
- package/dist/assets/{privacy-page-CFrLoQuJ.js → privacy-page-CcVYTYFw.js} +1 -1
- package/dist/assets/{privacy-screen-BuIFw79d.js → privacy-screen-D6KWda_d.js} +1 -1
- package/dist/assets/{profile-card-DOKegb-a.js → profile-card-B0q-4VDK.js} +1 -1
- package/dist/assets/{provider-callback-page-CPnDutdc.js → provider-callback-page-DUPzWdsn.js} +1 -1
- package/dist/assets/{provider-key-AVs0qMXM.js → provider-key-Bt_1m-Ip.js} +1 -1
- package/dist/assets/{provider-signup-page-DTPzoL0u.js → provider-signup-page-Dyube2uE.js} +1 -1
- package/dist/assets/{quick-input-page-B0ICyEgU.js → quick-input-page-phOYFcWE.js} +1 -1
- package/dist/assets/{referral-modal-1zPoMtxP.js → referral-modal-BpEe6RfT.js} +1 -1
- package/dist/assets/referral-modal-YlLIteDB.js +1 -0
- package/dist/assets/{research-mock-page-D-e9x0aU.js → research-mock-page-3sH3Ojod.js} +1 -1
- package/dist/assets/{research-onboarding-route-DtHB29VX.js → research-onboarding-route-W8ZOplPi.js} +1 -1
- package/dist/assets/{review-terms-screen-BbXyCCa7.js → review-terms-screen-p7rIoNoi.js} +1 -1
- package/dist/assets/routes-vi064rNI.js +1 -0
- package/dist/assets/{schedules-DfRCZ1RP.js → schedules-G-fQS88Z.js} +1 -1
- package/dist/assets/{schedules-page-Dcpdy1n1.js → schedules-page-Bz8dQuZ9.js} +1 -1
- package/dist/assets/{security-redirect-page-BqN7nDmC.js → security-redirect-page-nqyQ-l9I.js} +1 -1
- package/dist/assets/{select-assistant-screen-D7lOSn8K.js → select-assistant-screen-DTbgqPJ8.js} +1 -1
- package/dist/assets/{self-hosted-servers-mfRYC3V6.js → self-hosted-servers-TGCgx_Zl.js} +1 -1
- package/dist/assets/{service-form-controls-yfiFapqu.js → service-form-controls-BYas0Fj1.js} +1 -1
- package/dist/assets/{setting-row-hz10CsiO.js → setting-row-DeKbamTb.js} +1 -1
- package/dist/assets/{settings-divider-BTsvGg8f.js → settings-divider-fX1al4v0.js} +1 -1
- package/dist/assets/{settings-layout-CJfkUjGu.js → settings-layout-_uQXbZvN.js} +1 -1
- package/dist/assets/share-feedback-modal-BbfX56Tb.js +1 -0
- package/dist/assets/{share-feedback-modal-CxxySevk.js → share-feedback-modal-Bgjk4m6g.js} +1 -1
- package/dist/assets/{sidebar-tree-Bu-uVPbk.js → sidebar-tree-BxII4vqO.js} +1 -1
- package/dist/assets/{signup-page-NLKt0-kE.js → signup-page--iXCz-aP.js} +1 -1
- package/dist/assets/{signup-shell-DU-HQ4Is.js → signup-shell-D2m_KGDx.js} +1 -1
- package/dist/assets/{skill-detail-page-D2ynj5TG.js → skill-detail-page-DApsFagl.js} +1 -1
- package/dist/assets/{skill-detail-panel-CkzKPc65.js → skill-detail-panel-D2ghwCqP.js} +1 -1
- package/dist/assets/{skill-removal-dialog-Cf4V-l2v.js → skill-removal-dialog-C3KKFPCH.js} +1 -1
- package/dist/assets/{skills-page-q_IVfLb3.js → skills-page-CMueiEEK.js} +1 -1
- package/dist/assets/{sounds-page-CtaSO0c4.js → sounds-page-CaRGElXh.js} +1 -1
- package/dist/assets/{start-screen-DeowChgG.js → start-screen-C380uTIT.js} +1 -1
- package/dist/assets/{stt-language-picker-modal-MgMG4vnJ.js → stt-language-picker-modal-wNybXxLn.js} +1 -1
- package/dist/assets/{subagent-detail-panel-CkE-6d0V.js → subagent-detail-panel--lLPuYen.js} +1 -1
- package/dist/assets/{superpowers-page-11wxZ3sf.js → superpowers-page-CwGBMECu.js} +1 -1
- package/dist/assets/{system-events-page-NUG1UJD3.js → system-events-page-CbQnTv1L.js} +1 -1
- package/dist/assets/{system-events-redirect-page-DbsB8RE5.js → system-events-redirect-page-DRZUqIqZ.js} +1 -1
- package/dist/assets/{text-preview-qkNRFUQt.js → text-preview-CYUN4rc9.js} +1 -1
- package/dist/assets/{theme-stage-page-Vy0XYtTa.js → theme-stage-page-ic-Boi69.js} +1 -1
- package/dist/assets/{tiptap-document-editor-D3VgM1Ce.js → tiptap-document-editor-SsIwSFSZ.js} +1 -1
- package/dist/assets/tool-detail-panel-CKZ_M0Qj.js +1 -0
- package/dist/assets/{tool-detail-panel-kkHVCqRn.js → tool-detail-panel-XwRKFU13.js} +3 -3
- package/dist/assets/{trait-cycle-row-BlgCseYI.js → trait-cycle-row-DNn4F74m.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-s6e4nG1l.js → upgrade-cancel-page-DqQHOlQ0.js} +1 -1
- package/dist/assets/{upgrade-success-page-D6SM1pxp.js → upgrade-success-page-tVasRCy_.js} +1 -1
- package/dist/assets/{usage-redirect-page-BNYnnsnf.js → usage-redirect-page-D3aVssCL.js} +1 -1
- package/dist/assets/{use-app-delete-CQbN9rtt.js → use-app-delete-DtftSu08.js} +1 -1
- package/dist/assets/{use-assistant-identity-details-CrhYb7qF.js → use-assistant-identity-details-BHojBIzM.js} +1 -1
- package/dist/assets/{use-checkout-dismiss-refresh-q4n835g5.js → use-checkout-dismiss-refresh-DbSG9nq4.js} +1 -1
- package/dist/assets/{use-edge-swipe-back-CeKk6gy9.js → use-edge-swipe-back-Dx2dMUF5.js} +1 -1
- package/dist/assets/{use-hotkey-recorder-BA2YaGIX.js → use-hotkey-recorder-DHnuMF6T.js} +1 -1
- package/dist/assets/{use-invite-link-dialog-6IXyqacJ.js → use-invite-link-dialog-DNFvVMTr.js} +1 -1
- package/dist/assets/{use-plugins-list-CHpcMGs_.js → use-plugins-list-D0KJteNK.js} +1 -1
- package/dist/assets/{use-return-to-short-circuit-2kdbf5Q4.js → use-return-to-short-circuit-CFPNKSTK.js} +1 -1
- package/dist/assets/{use-side-list-room-BhFIS5Le.js → use-side-list-room-BEt4nE6h.js} +1 -1
- package/dist/assets/{use-skill-actions-Kdf5x1HU.js → use-skill-actions-C7qa2xLE.js} +1 -1
- package/dist/assets/{use-skill-detail-files-DAyyrFN5.js → use-skill-detail-files-_1GQxDTx.js} +1 -1
- package/dist/assets/use-supports-credentials-settings-ChozdHJ0.js +1 -0
- package/dist/assets/{use-transcript-message-by-id-D3l5WRCF.js → use-transcript-message-by-id-BaIMdiwS.js} +1 -1
- package/dist/assets/{voice-page-faAl_Nti.js → voice-page-BJ51XPpw.js} +1 -1
- package/dist/assets/{wake-detail-panel-WzSOhew8.js → wake-detail-panel-DkAaJeZE.js} +1 -1
- package/dist/assets/{weather-forecast-display-DIwophHB.js → weather-forecast-display-ty6o7LuP.js} +1 -1
- package/dist/assets/{welcome-screen-DCDAeMA9.js → welcome-screen-B9BqQr5N.js} +1 -1
- package/dist/assets/{workflow-detail-panel-CtBcOGfQ.js → workflow-detail-panel--kczknYa.js} +1 -1
- package/dist/assets/{workspace-page-DBInjaOS.js → workspace-page-G1xUhgr7.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/add-credits-modal-DNsSoNjD.js +0 -1
- package/dist/assets/auth-store-EAev0DJN.js +0 -1
- package/dist/assets/avatar-bundled-components-DhB1DyLm.js +0 -1
- package/dist/assets/checkout-return-target-CI8LVYVE.js +0 -1
- package/dist/assets/command-palette-Cmcx1U8W.js +0 -1
- package/dist/assets/common-B1Nsu-f_.js +0 -1
- package/dist/assets/common-BOcNovqr.js +0 -1
- package/dist/assets/common-B_WI9sIg.js +0 -1
- package/dist/assets/deploy-dialogs-DCxRLpl7.js +0 -1
- package/dist/assets/detail-primitives-f9ovBHes.js +0 -1
- package/dist/assets/document-load-D5E61ZgQ.js +0 -1
- package/dist/assets/intelligence-layout-slots-store-Cg1S2hhY.js +0 -1
- package/dist/assets/local-mode-C2LpbCQF.js +0 -1
- package/dist/assets/native-attachment-pickers-CenfaGLR.js +0 -1
- package/dist/assets/native-file-L8dxZeiL.js +0 -1
- package/dist/assets/paired-platform-identity-6K-FDEvo.js +0 -1
- package/dist/assets/password-reset-page-GkXM4m0d.js +0 -1
- package/dist/assets/plugins-surface-BKEqqJBL.js +0 -1
- package/dist/assets/referral-modal-C-PDjzho.js +0 -1
- package/dist/assets/routes-PhQIek7i.js +0 -1
- package/dist/assets/share-feedback-modal-yqSXIF2c.js +0 -1
- package/dist/assets/tool-detail-panel-DSA9JyHJ.js +0 -1
- package/dist/assets/use-supports-credentials-settings-CRzbQVNd.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$m as t,$v as n,Ai as r,Bl as i,Bm as a,CS as o,Fl as s,Gm as c,Iv as l,Jy as u,Km as d,Lv as f,NS as p,Ni as m,Nu as h,Pu as g,Rm as _,Su as v,Vm as y,Xn as b,Ym as x,_u as S,aS as C,du as w,fi as T,fs as E,fu as D,fx as O,gu as k,hu as ee,iS as A,jl as j,lS as M,lo as N,mS as P,mu as te,pl as ne,ps as re,pu as ie,rS as ae,sg as F,tS as I,ty as oe,uS as se,ug as ce,vl as le,vu as ue,xS as L,yl as de,yu as fe,zm as pe}from"./app-BfK0IQIk.js";import{I as R,Jn as me,Zn as z,er as B,ir as he,j as V,or as ge}from"./vendor-ajttH1pP.js";import{f as _e,t as ve,x as ye}from"./react-B9IgSVeK.js";import{D as be,Ji as H,Ra as xe,Ui as U,Vn as Se,Ya as Ce,Yn as we,ci as Te,fr as W,pi as Ee,xr as De,zi as Oe}from"./icons-C0wyat6T.js";import{c as ke,i as G,l as Ae,n as je,r as Me,t as Ne}from"./machine-sizes-3x95p4n1.js";import{a as Pe,i as Fe,n as Ie,r as Le,t as Re}from"./provisioning-targets-DdCpl6ZX.js";var ze=Ce(`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`}]]),K=e(ye(),1),q=ve();function Be({icon:e}){return(0,q.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,q.jsx)(e,{className:`h-5 w-5`,style:{color:`var(--system-negative-strong)`},"aria-hidden":`true`})})}var J={fontFamily:`var(--font-serif)`,fontSize:`32px`,fontWeight:400,lineHeight:1.2,letterSpacing:`0.64px`};function Y({title:e,subtitle:t}){return(0,q.jsxs)(`header`,{className:`flex flex-col items-center gap-2 pt-12 text-center`,children:[(0,q.jsx)(`h2`,{className:`text-[var(--content-emphasised)]`,style:J,children:e}),t&&(0,q.jsx)(`p`,{className:`text-[14px] font-normal text-[var(--content-secondary)]`,children:t})]})}var Ve=[{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}],He=[{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 Ue({variant:e=`full`}){let t=T();return t?(0,q.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`creature-corners`,className:`pointer-events-none absolute inset-0 select-none`,children:(e===`top`?He:Ve).map((e,n)=>(0,q.jsx)(`span`,{className:`absolute ${e.position}`,style:{rotate:`${e.rotate}deg`},children:(0,q.jsx)(b,{components:t,bodyShapeId:e.bodyShape,eyeStyleId:e.eyeStyle,colorId:e.color,size:e.size})},n))}):null}var X={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.`},Z={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.`},Q={upgrade:X,downgrade:Z,change:Z};function We(e=`upgrade`){return Q[e]}function Ge(e,t=!0){let{data:n}=z({...ne(),enabled:t&&e==null}),{data:r}=z({...i({path:{id:e??``}}),enabled:t&&e!=null});return e==null?n:r}function Ke({assistantId:e,direction:n}){let r=_e(),{t:i}=V(`settings`),a=Ge(e,t())?.name||i(`completeState.assistantFallbackName`);return(0,q.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,q.jsx)(Ue,{variant:`full`}),(0,q.jsxs)(`div`,{className:`relative flex w-full flex-col items-center`,children:[(0,q.jsx)(Y,{title:i(`completeState.title`),subtitle:We(n).completeSubtitle}),(0,q.jsx)(`div`,{className:`mt-10 flex w-full flex-col items-center gap-10`,children:(0,q.jsx)(p,{variant:`primary`,"data-testid":`onboarding-complete-return`,onClick:()=>{e!=null&&F(e),r(O.assistant,{replace:!0})},children:i(`completeState.returnTo`,{assistantName:a})})})]})]})}function qe(e=!0,t){let n=Ge(t,e),r=t??n?.id,{data:i,isError:a,isFetching:o,dataUpdatedAt:s,errorUpdatedAt:c}=z({...le({path:{assistant_id:r??``}}),enabled:e&&!!r});return{assistant:n,assistantId:r,domains:i,domainsError:a,domainsFetching:o,domainsUpdatedAt:s,domainsErrorUpdatedAt:c}}var Je=1e3,Ye=1e4,Xe=2500,Ze=2e3,Qe=1e4,$e=[`machine_size`,`subdomain`,`non_field_errors`],et={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.`},tt={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 nt(e,t,n=`upgrade`){if(e&&typeof e==`object`){let t=e;if(typeof t.error==`string`){let e=(n===`upgrade`?void 0:tt[t.error])??et[t.error];if(e)return e}for(let e of $e){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 $=`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`,rt=`text-[11px] font-medium text-[var(--content-secondary)]`;function it({onExit:e,machineBusy:t=!1,assistantId:n}){let{t:i}=V(`settings`),a=B(),o=r.use.emailRootDomain(),{assistant:s,assistantId:c,domains:l}=qe(!0,n),u=l?.results[0],[d,f]=(0,K.useState)(``),[m,h]=(0,K.useState)(`hi`),[g,_]=(0,K.useState)(!1);(0,K.useEffect)(()=>{if(!g){if(u){f(u.subdomain),_(!0);return}!s?.handle||d||(f(s.handle),_(!0))}},[s?.handle,u,g,d]);let[v,y]=(0,K.useState)(null),[b,x]=(0,K.useState)(!1),w=me(te()),T=!!u||b,E=w.isPending||b;return(0,K.useEffect)(()=>{if(!b)return;let t=setTimeout(e,800);return()=>clearTimeout(t)},[b,e]),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(C.Body,{className:`animate-[onboarding-step-in_350ms_ease-out] space-y-6 pb-0 motion-reduce:animate-none`,children:[(0,q.jsx)(Ue,{variant:`top`}),(0,q.jsx)(Y,{title:i(`domainStep.title`),subtitle:i(`domainStep.subtitle`)}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`label`,{htmlFor:`onboarding-email-prefix`,className:rt,children:i(`domainStep.prefixLabel`)}),(0,q.jsx)(`input`,{id:`onboarding-email-prefix`,value:m,onChange:e=>h(e.target.value.toLowerCase().trim()),disabled:E||T,readOnly:T,placeholder:i(`domainStep.emailUsernamePlaceholder`),className:`${$} w-24`})]}),(0,q.jsx)(`span`,{className:`flex h-8 items-center text-[var(--content-secondary)]`,children:`@`}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,q.jsx)(`label`,{htmlFor:`onboarding-email-handle`,className:rt,children:i(`domainStep.handleLabel`)}),(0,q.jsx)(`input`,{id:`onboarding-email-handle`,value:d,onChange:e=>{f(e.target.value.toLowerCase().trim()),v&&y(null)},disabled:E||T,readOnly:T,autoFocus:!0,placeholder:i(`domainStep.subdomainExamplePlaceholder`),"aria-invalid":!!v,className:`${$} w-full min-w-0`})]}),(0,q.jsxs)(`span`,{className:`flex h-8 shrink-0 items-center text-[14px] text-[var(--content-tertiary)]`,children:[`.`,o]})]}),v&&(0,q.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:v}),T&&(0,q.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:i(`domainStep.domainLockedMessage`)})]}),t&&!T&&(0,q.jsx)(L,{tone:`neutral`,children:i(`domainStep.machineBusyNotice`)}),!T&&(0,q.jsx)(L,{tone:`info`,className:`border-transparent bg-[var(--surface-active)]`,children:(0,q.jsx)(`span`,{className:`font-medium text-[var(--content-tertiary)]`,children:i(`domainStep.handleImmutableNotice`)})}),b?(0,q.jsx)(L,{tone:`success`,children:i(`domainStep.domainSetRedirecting`)}):null]}),(0,q.jsx)(C.Footer,{className:`items-center pt-6`,children:T?(0,q.jsx)(p,{variant:`primary`,"data-testid":`onboarding-domain-continue`,onClick:e,children:i(`domainStep.continue`)}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{variant:`outlined`,"data-testid":`onboarding-domain-skip`,disabled:E,onClick:()=>{E||w.mutate({body:{skipped:!0}},{onSuccess:e,onError:()=>e()})},children:i(`domainStep.skip`)}),(0,q.jsx)(p,{variant:`primary`,"data-testid":`onboarding-domain-set`,disabled:!d||E||t,onClick:()=>{E||t||!d||w.mutate({body:{subdomain:d,...m?{email_username:m}:{}}},{onSuccess:()=>{y(null),x(!0),a.invalidateQueries({queryKey:j()}),a.invalidateQueries({queryKey:de({path:{assistant_id:c??``}})}),a.invalidateQueries({queryKey:S()})},onError:e=>{y(nt(e,i(`domainStep.registerSubdomainFailed`)))}})},children:i(`domainStep.next`)})]})})]})}function at({onGoToBilling:e,direction:t}){let{t:n}=V(`settings`);return(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-6 py-10 text-center`,children:[(0,q.jsx)(Be,{icon:U}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(o,{variant:`title-small`,as:`h1`,children:n(`errorStates.fetchErrorTitle`)}),(0,q.jsx)(o,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:We(t).fetchErrorBody})]}),(0,q.jsx)(p,{variant:`primary`,"data-testid":`onboarding-go-to-billing`,onClick:e,children:n(`errorStates.goToBilling`)})]})}function ot(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 st=60,ct=st*2;function lt({imageUrl:e,animateIn:t=!0}){return(0,q.jsxs)(`div`,{"aria-hidden":!0,"data-testid":`takeover-backdrop`,className:`pointer-events-none absolute inset-0 overflow-hidden${t?` provision-avatar-reveal`:``}`,children:[(0,q.jsx)(`img`,{src:e,alt:``,decoding:`async`,draggable:!1,className:`absolute left-1/2 top-1/2 max-w-none -translate-x-1/2 -translate-y-1/2 object-cover object-center`,style:{filter:`blur(${st}px)`,width:`calc(100% + ${ct*2}px)`,height:`calc(100% + ${ct*2}px)`}}),(0,q.jsx)(`div`,{className:`absolute inset-0 bg-black/55`})]})}function ut(e,t){if(t!=null)return e?.credit_tiers?.find(e=>e.tier===t)}function dt(e){let t=e?.match(/^credits_(\d+)$/)?.[1];return t==null?null:Number(t)}function ft(e){let n=t(),{data:r}=z({...w(),enabled:n&&e});return r?.plans.find(e=>e.id===`pro`)}function pt(e,t){return t==null?0:ut(e,t)?.credits_usd??dt(t)}function mt(e,t){return t==null?null:ut(e,t)?.label}function ht(e){let t=ft(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=ut(t,i?.credit_tier);n=i?.credits_usd??a?.credits_usd,r=i?.usage_label??a?.label??void 0}else{let i=ut(t,e.creditTier);n=i?.credits_usd,r=i?.label}return n==null?null:{fromLabel:null,toLabel:r}}function gt(e){let t=ft(e!=null);return e==null||pt(t,e.fromTier)==null||pt(t,e.toTier)==null?null:{fromLabel:mt(t,e.fromTier),toLabel:mt(t,e.toTier)}}function _t(e){let t=u.use.activeAssistantId(),n=e===void 0?t:e,{components:r,traits:i,customImageUrl:o,state:s,isLoading:l}=c(n),f=(0,K.useMemo)(()=>a(),[y()]),p=f!=null&&pe(f)?f:null,m=n!=null&&!l,h=p!=null&&(n==null||n===p.assistantId),g=h&&!(m&&(r!=null||i!=null||o!=null))?p:null,_=g?g.components:r,v=g?g.traits:i,b=g?null:o,S=m||h,C=d({state:g?null:s,components:_,traits:v,customImageUrl:b})??(b?null:x[0]?.hex??null);return{tintHex:S&&C?re(C):E,backdropImageUrl:S?b:null,ready:S,avatar:{components:_,traits:v,customImageUrl:b}}}function vt(e,t){let[n,r]=(0,K.useState)(e),i=(0,K.useRef)(0);return(0,K.useEffect)(()=>{i.current=performance.now()},[]),(0,K.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 yt=`--takeover-surface`,bt=`var(${yt},${E})`,xt=`color-mix(in srgb, var(--content-emphasised) 10%, transparent)`,St=240,Ct=1.414,wt=[{minHeight:680,size:St},{minHeight:600,size:184}],Tt=132;function Et(e){for(let t of wt)if(e>=t.minHeight)return t.size;return Tt}function Dt(){let[e,t]=(0,K.useState)(()=>Et(typeof window>`u`?1/0:window.innerHeight));return(0,K.useEffect)(()=>{let e=()=>t(Et(window.innerHeight));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}var Ot={machine:Te,storage:De,credits:Ee},kt={idle:``,working:` is-working`,settling:` is-settling`,stalled:` is-stalled`,grown:` is-evolved`};function At(e,t){return e===`DONE`||e===`NOT_APPLICABLE`?`grown`:e===`STALLED`?`stalled`:e===`WAITING`||e===`RESIZING`?t?`settling`:`working`:`idle`}function jt({assistantId:e,mode:t,downsizing:n=!1}){let{avatar:r,ready:i}=_t(e),a=T(),o=Dt(),s=t===`working`||t===`settling`;return(0,q.jsxs)(`div`,{"aria-hidden":!0,className:`provision-avatar-evolve relative z-10 flex flex-col items-center${kt[i?t:`idle`]}${n?` is-downsizing`:``}`,style:{"--provision-avatar-size":`${o}px`,"--provision-avatar-growth":Ct},children:[(0,q.jsxs)(`div`,{className:`provision-avatar-stage`,children:[(0,q.jsx)(`div`,{"data-testid":`provision-avatar-placeholder`,className:`provision-avatar-placeholder${i?` is-resolved`:``}`}),(0,q.jsx)(`div`,{className:`provision-avatar-layer`,children:(0,q.jsx)(`div`,{className:`provision-avatar-current`,children:(0,q.jsx)(`div`,{className:`provision-avatar-strain`,children:i&&(0,q.jsx)(`div`,{className:`provision-avatar-reveal`,children:(0,q.jsx)(m,{components:r.components??a,traits:r.traits,customImageUrl:r.customImageUrl,size:o,isAssistantBusy:s})})})})})]}),(0,q.jsx)(`div`,{className:`provision-avatar-shadow`})]})}function Mt({status:e,caption:t}){return(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5`,children:[(0,q.jsx)(`h1`,{className:`text-[var(--content-emphasised)]`,style:J,children:e}),t&&(0,q.jsx)(o,{variant:`body-medium-lighter`,as:`p`,className:`max-w-sm text-[var(--content-secondary)]`,children:t})]})}function Nt({icon:e,label:t,from:n,to:r,done:i=!1,pending:a=!1,testId:o}){let{t:s}=V(`settings`),c=null;return i?c=s(`provisioningState.statusComplete`):a&&(c=s(`provisioningState.statusPending`)),(0,q.jsxs)(`div`,{"data-testid":o,className:`flex min-w-0 flex-auto items-center gap-2 rounded-lg px-2 py-1.5${a?` opacity-70`:``}`,style:{backgroundColor:xt},children:[(0,q.jsx)(`span`,{className:`hidden h-6 w-6 shrink-0 items-center justify-center min-[420px]:flex`,children:(0,q.jsx)(e,{className:`h-3.5 w-3.5 text-[var(--content-tertiary)]`,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 text-left wrap-anywhere`,children:[(0,q.jsx)(`span`,{className:`text-[12px] font-medium leading-tight text-[var(--content-tertiary)]`,children:t}),(0,q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-[14px] font-medium leading-[18px] text-[var(--content-emphasised)]`,children:[n&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{children:n}),(0,q.jsx)(`span`,{className:`sr-only`,children:s(`provisioningState.srOnlyTo`)}),(0,q.jsx)(xe,{className:`h-3 w-3 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":`true`})]}),(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,q.jsx)(`span`,{children:r}),i?(0,q.jsx)(H,{"data-testid":`chip-check`,className:`h-3.5 w-3.5 shrink-0 text-[var(--system-positive-strong)]`,"aria-hidden":`true`}):a&&(0,q.jsx)(we,{"data-testid":`chip-spinner`,className:`h-3.5 w-3.5 shrink-0 animate-spin text-[var(--content-tertiary)] motion-reduce:animate-none`,"aria-hidden":`true`})]}),c&&(0,q.jsx)(`span`,{className:`sr-only`,children:c})]})]})]})}function Pt({label:e}){return(0,q.jsx)(`span`,{className:`rounded-lg px-3 py-2 text-[14px] text-[var(--content-emphasised)]`,style:{backgroundColor:xt},children:e})}function Ft({children:e,wide:t=!1,testId:n}){return(0,q.jsx)(`div`,{"data-testid":n,className:`flex w-full ${t?`max-w-2xl`:`max-w-sm`} items-stretch justify-center gap-2`,children:e})}function It(e,t){return e===`credits`?!0:t?.[e]===!0}function Lt(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 Rt({intent:e,creditsChange:t,targets:n,fromSnapshot:r,machineFloor:i,landed:a,allDone:o=!1,creditsOnly:s=!1}){let{t:c}=V(`settings`),l=ht(e),u=gt(t),d=ot({targets:n,fromSnapshot:r,machineFloor:i,credits:Lt(l??u,c)}),f=s?d.filter(e=>e.key===`credits`):d,p=f.filter(e=>o||It(e.key,a)).map(e=>e.label).join(`, `),[m]=(0,K.useState)(p),h=p===m?``:c(`provisioningState.dimensionsComplete`,{dimensions:p});return f.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Ft,{testId:`resource-chips`,wide:f.length>=3,children:f.map(e=>{let t=o||It(e.key,a);return(0,q.jsx)(Nt,{testId:`chip-${e.key}`,icon:Ot[e.key],label:e.label,from:e.from,to:e.to,done:t,pending:!t},e.key)})}),(0,q.jsx)(`p`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`chip-announcement`,children:h})]})}function zt({intent:e}){let{t}=V(`settings`),n=ht(e.kind===`custom`?e:null);if(e.kind===`package`)return(0,q.jsx)(Ft,{children:(0,q.jsx)(Pt,{label:t(`provisioningState.packageChip`,{name:e.packageKey.charAt(0).toUpperCase()+e.packageKey.slice(1)})})});let r=[e.machineTier,e.storageTier,e.creditTier].filter(e=>e!=null).length;return(0,q.jsxs)(Ft,{wide:r>=3,children:[e.machineTier!=null&&(0,q.jsx)(Nt,{icon:Te,label:t(`provisioningState.machineLabel`),to:je[e.machineTier]??e.machineTier}),e.storageTier!=null&&(0,q.jsx)(Nt,{icon:De,label:t(`provisioningState.storageLabel`),to:e.storageTier.toUpperCase()}),e.creditTier!=null&&n?.toLabel!=null&&(0,q.jsx)(Pt,{label:n.toLabel})]})}function Bt({state:e,direction:t,softWaiting:n,intent:r,creditsChange:i,targets:a,fromSnapshot:o,machineFloor:s,landed:c,celebrating:l,onCelebrationEnd:u,assistantId:d,escapeAvailable:f,onEscape:m,onPhaseChange:h,kickError:g,confirm:_,dwellMs:v=Xe,phaseMinMs:y=900}){let{t:b}=V(`settings`),x=We(t),S=(0,K.useRef)(u);(0,K.useEffect)(()=>{S.current=u},[u]);let C=vt(e,y),w=C===`DONE`||C===`NOT_APPLICABLE`,T=C===`RESIZING`?`WAITING`:C,E=(0,K.useRef)(h);(0,K.useEffect)(()=>{E.current=h},[h]),(0,K.useEffect)(()=>{E.current?.(C)},[C]);let{tintHex:D,backdropImageUrl:O}=_t(d),k=l&&w;return(0,K.useEffect)(()=>{if(!k)return;let e=setTimeout(()=>S.current(),v);return()=>clearTimeout(e)},[k,v]),(0,q.jsxs)(`div`,{"data-theme":`dark`,className:`provision-surface-settle relative flex h-full min-h-[420px] w-full flex-col items-center [justify-content:safe_center] gap-10 px-6 py-10 text-center`,style:{[yt]:D,backgroundColor:bt},children:[O&&(0,q.jsx)(lt,{imageUrl:O}),(0,q.jsx)(jt,{assistantId:d,mode:At(C,n),downsizing:t===`downgrade`}),(0,q.jsx)(`div`,{className:`relative z-10 flex min-h-[144px] w-full flex-col items-center gap-8 [animation:onboarding-step-in_420ms_ease-out] motion-reduce:[animation:none]`,children:j()},T)]});function ee(e=b(`provisioningState.continueInBackground`)){return f?(0,q.jsx)(p,{variant:`ghost`,"data-testid":`provisioning-escape`,onClick:m,children:e}):null}function A({allDone:e=!1,creditsOnly:t=!1}={}){return(0,q.jsx)(Rt,{intent:r,creditsChange:i,targets:a,fromSnapshot:o,machineFloor:s,landed:c,allDone:e,creditsOnly:t})}function j(){if(C===`CONFIRMING`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:x.confirmingStatus,caption:b(`provisioningState.confirmingCaption`)}),r&&(0,q.jsx)(zt,{intent:r}),ee()]});if(C===`WAITING`||C===`RESIZING`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:x.waitingStatus,caption:b(n?`provisioningState.waitingCaptionLong`:`provisioningState.waitingCaptionShort`)}),A(),ee()]});if(C===`DONE`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:b(`provisioningState.allDoneStatus`)}),A({allDone:!0})]});if(C===`NOT_APPLICABLE`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:b(`provisioningState.planReadyStatus`)}),A({allDone:!0,creditsOnly:!0})]});if(C===`STALLED`){let e=g!=null;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:e?x.snagStatus:b(`provisioningState.takingLongerStatus`),caption:e?nt(g,x.snagCaption,t):b(`provisioningState.stalledCaption`)}),A(),e?ee(b(`provisioningState.retryInBackground`)):ee()]})}return C===`CONFIRM_TIMEOUT`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:x.confirmTimeoutStatus,caption:x.confirmTimeoutCaption}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,q.jsx)(p,{variant:`outlined`,"data-testid":`onboarding-go-to-billing`,onClick:_.onGoToBilling,children:b(`provisioningState.goToBilling`)}),(0,q.jsx)(p,{variant:`primary`,"data-testid":`onboarding-retry`,onClick:_.onRetry,children:b(`provisioningState.tryAgain`)})]})]}):null}}function Vt(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&&!Pe(n,i);if(Pe(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 Ht=2e3,Ut=1e3,Wt=[`DONE`,`NOT_APPLICABLE`,`CONFIRM_TIMEOUT`],Gt={assistantId:null,machine:null,storage:null};function Kt({open:e,canLowerResources:n=!1,verdictRecheckMs:r=Qe}){let a=B(),o=t(),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(0),[f,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(null),[g,_]=(0,K.useState)(null),[v,y]=(0,K.useState)(null),[b,x]=(0,K.useState)(null),[C,w]=(0,K.useState)(null),[T,E]=(0,K.useState)(Gt),[D,O]=(0,K.useState)(null),[A,j]=(0,K.useState)(!1),M=(0,K.useRef)(!1),N=(0,K.useRef)(!1),P=(0,K.useRef)(0),[te,re]=(0,K.useState)(!1),[ie,ae]=(0,K.useState)(null),[F,I]=(0,K.useState)(null),[oe,se]=(0,K.useState)(null),[le,L]=(0,K.useState)(()=>Date.now()),[de,pe]=(0,K.useState)(!0);(0,K.useEffect)(()=>{e||(l(!1),d(0),p(null),h(null),_(null),re(!1),ae(null),I(null),se(null),pe(!0),y(null),x(null),w(null),E(Gt),O(null),j(!1),M.current=!1,N.current=!1,P.current+=1)},[e]),(0,K.useEffect)(()=>{e&&(p(Date.now()),a.invalidateQueries({queryKey:fe()}),a.invalidateQueries({queryKey:S()}))},[e,a]);let R=m!=null,V=z({...ue(),refetchInterval:e=>e.state.data?.plan_id===`pro`||c?!1:Je,refetchIntervalInBackground:!1,enabled:e&&o&&!R}),_e=(f!=null&&V.dataUpdatedAt>=f?V.data?.plan_id:null)??null;(0,K.useEffect)(()=>{if(!e||R||_e!==`pro`)return;let t=Date.now();h(t),L(t)},[e,R,_e]),(0,K.useEffect)(()=>{if(!e||R)return;let t=setTimeout(()=>l(!0),Ye);return()=>clearTimeout(t)},[e,R,u]);let ve=(0,K.useCallback)(()=>{l(!1),d(e=>e+1),ce.getState().fetchOrganizations(),a.invalidateQueries({queryKey:fe()})},[a]),ye=(0,K.useCallback)(()=>{let e=Date.now();_(e),L(e)},[]),{mutate:be}=me(ee()),H=(0,K.useCallback)(e=>{let t=P.current;be({},{onSuccess:n=>{t===P.current&&(O(null),Ie(n)?N.current?O({error:n.reason??`no_active_pro`}):(N.current=!0,j(!0),e===`escape`&&ye()):(y(n.state),e===`escape`&&ye()))},onError:e=>{t===P.current&&O(e)}})},[be,ye]);(0,K.useEffect)(()=>{!e||!o||!R||M.current||(M.current=!0,H(`auto`))},[e,o,R,H]),(0,K.useEffect)(()=>{if(!A)return;let e=P.current,t=setTimeout(()=>{j(!1),e===P.current&&H(`auto`)},Ze);return()=>clearTimeout(t)},[A,H]);let xe=(0,K.useCallback)(()=>H(`escape`),[H]),U=z({...k(),enabled:e&&o&&R}),Se=de?Ht:!1,Ce=z({...ne(),enabled:e&&o&&R,refetchInterval:e=>e.state.data?.id==null?Se:!1,retry:!1}),we=R&&f!=null&&U.dataUpdatedAt>=f,Te=we&&!U.isPending&&!U.isFetching,W=(we?U.data?.primary_assistant_id:null)??(U.isPending?null:Ce.data?.id??null),Ee=z({...i({path:{id:W??`unresolved`}}),enabled:e&&o&&R&&W!=null,refetchInterval:Se,retry:!1}),De=s({path:{id:W??`unresolved`}}),Oe=z({...De,enabled:e&&o&&R&&W!=null,refetchInterval:Se,retry:!1}),G=(0,K.useRef)(0),[je,Me]=(0,K.useState)(0),ze=ge(De.queryKey);(0,K.useEffect)(()=>a.getQueryCache().subscribe(t=>{if(!(t.type!==`updated`||t.query.queryHash!==ze)){if(t.action.type===`fetch`)G.current+=1;else if(t.action.type===`success`&&!t.action.manual){let n=G.current,r=e&&Le(t.action.data);he.schedule(()=>{Me(n),r&&(re(!0),ae(W))})}}}),[a,ze,e,W]);let q=Le(Oe.data),Be=ie===W,J=U.data,Y=(0,K.useMemo)(()=>J?{machineSize:ke(J.max_machine_tier),storageGib:J.selected_storage_gib??null}:null,[J]),Ve=J!=null&&J.max_machine_tier==null?Ne:null,He=J?J.domain_setup_available&&J.primary_assistant_id!=null:void 0,Ue=Ee.data,X=(0,K.useMemo)(()=>Ue?{machineSize:Ue.machine_size??null,storageGib:Ue.provisioned_storage_gib??null}:null,[Ue]),Z=oe===W,Q=(0,K.useMemo)(()=>{let e=Re(Y,X),t=Y?.machineSize??Ve;if(t==null)return e;let n=X?.machineSize??null;if(n==null)return{...e,machine:!1};let r=(Z?F?.machineSize:null)??n,i=Ae(t)<Ae(r);return{...e,machine:i?Ae(n)<=Ae(t):Ae(n)>=Ae(t)}},[Y,X,F,Z,Ve]),We=Pe(Y,X),Ge=C===W;(0,K.useEffect)(()=>{e&&(We?(x(e=>e!=null&&Ge?e:Date.now()),w(W)):(x(null),w(null)))},[e,We,W,Ge]);let Ke=T.assistantId===W;(0,K.useEffect)(()=>{if(!e)return;let t=G.current;E(e=>{let n=e.assistantId===W?e:Gt,r=Q.machine?n.machine??t:null,i=Q.storage?n.storage??t:null;return e.assistantId===W&&e.machine===r&&e.storage===i?e:{assistantId:W,machine:r,storage:i}})},[e,Q,W]);let qe=(0,K.useMemo)(()=>{let e=Fe(Oe.data),t=e=>e!=null&&Ke&&je>e;return{machine:Q.machine&&!e.machine&&t(T.machine),storage:Q.storage&&!e.storage&&t(T.storage)}},[Q,T,Ke,je,Oe.data]);(0,K.useEffect)(()=>{!e||!X||F!=null&&Z||(I(X),se(W))},[e,X,W,F,Z]);let Xe=g??m,$e=Xe==null?null:Math.max(0,le-Xe),et=!n,{state:tt,softWaiting:nt}=Vt({planId:R?`pro`:_e,targets:Y,actuals:X,initialActuals:Z?F:null,resizeOperationInFlight:q,sawOperation:te&&Be,msSinceWatchStart:$e,confirmExpired:c,serverVerdict:v,statusObservedSinceTargetsMet:b!=null&&Ge&&Oe.dataUpdatedAt>b,targetsProveNoop:et}),$=Wt.includes(tt),rt=e&&R&&!$;(0,K.useEffect)(()=>{pe(rt)},[rt]),(0,K.useEffect)(()=>{if(!e||!R||$)return;let t=setInterval(()=>L(Date.now()),Ut);return()=>clearInterval(t)},[e,R,$]);let it=!et&&(v===`started`||v===`in_progress`)&&!(te&&Be);return(0,K.useEffect)(()=>{if(!e||!R||$||!it)return;let t=setInterval(()=>H(`auto`),r);return()=>clearInterval(t)},[e,R,$,it,r,H]),{state:tt,softWaiting:nt,targets:Y,actualsSnapshot:F,machineFloor:Ve,landed:qe,assistantId:W,domainStepAvailable:He,onboardingSettled:Te,confirmError:!R&&V.isError,targetsError:R&&U.isError&&(!J||!we),escapeEligible:$e!=null&&$e>=6e4,retryConfirm:ve,kickProvisioning:xe,kickError:D}}var qt=200,Jt=380;function Yt(){return typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0}var Xt=e=>e===`WAITING`||e===`RESIZING`||e===`STALLED`,Zt=e=>e===`DONE`||e===`NOT_APPLICABLE`,Qt={machineSize:null,storageGib:null};function $t({open:e,onClose:t,dwellMs:r,phaseMinMs:i,mode:a=`checkout`,resizeContext:o}){let{t:s}=V(`settings`),c=a===`resize`,l=B(),[u,d]=(0,K.useState)(`provisioning`),[f,p]=(0,K.useState)(`idle`),m=(0,K.useRef)([]),[h,g]=(0,K.useState)(null),[v,y]=(0,K.useState)(null),[b,x]=(0,K.useState)(null),[S,w]=(0,K.useState)(!1),T=c?o?.direction:void 0,E=We(T),D=Kt({open:e,canLowerResources:c?o?.canLowerResources===!0:!1}),O=(0,K.useRef)(!1);(0,K.useEffect)(()=>{if(e){O.current=!0,g(c?null:oe()),x(e=>e??Date.now());return}m.current.forEach(clearTimeout),m.current=[],d(`provisioning`),p(`idle`),y(null),x(null),w(!1),O.current&&(O.current=!1,_())},[e,c]),(0,K.useEffect)(()=>()=>{m.current.forEach(clearTimeout)},[]),(0,K.useEffect)(()=>{u===`complete`&&n()},[u]);let k=Xt(D.state),ee=Zt(v??D.state),{targets:j,assistantId:M,domainStepAvailable:N,onboardingSettled:P}=D,te=c?o?.fromSnapshot:void 0,ne=D.actualsSnapshot,re={machineSize:te?.machineSize??ne?.machineSize??null,storageGib:te?.storageGib??ne?.storageGib??null},{tintHex:ie,backdropImageUrl:F}=_t(M),I=c&&N===!0,{domains:se,domainsError:ce,domainsFetching:le,domainsUpdatedAt:ue,domainsErrorUpdatedAt:L}=qe(e&&I,M),fe=(se?.results.length??0)>0,pe=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!e){pe.current=null;return}!I||M==null||pe.current!==M&&(pe.current=M,l.invalidateQueries({queryKey:de({path:{assistant_id:M}})}))},[e,I,M,l]);let R=!le&&(b!=null&&ue>=b||b!=null&&!!ce&&L>=b),[me,z]=(0,K.useState)(!1),he=P&&(!I||R);(0,K.useEffect)(()=>{if(!e){z(!1);return}he&&z(!0)},[e,he]);let ge=(0,K.useCallback)(()=>{let e=c?N===!0&&!fe?`domain`:`complete`:N===!1?`complete`:`domain`;if(Yt()){d(e);return}p(`covering`),m.current.push(setTimeout(()=>{d(e),p(`revealing`),m.current.push(setTimeout(()=>p(`idle`),Jt))},qt))},[N,c,fe]),_e=(0,K.useCallback)(()=>{w(!0)},[]),ve=(0,K.useCallback)(()=>{D.kickProvisioning(),A.info(D.kickError==null?E.backgroundExitToast:E.backgroundRetryToast),w(!1),t()},[D,t,E]),ye=(0,K.useCallback)(()=>{w(!1)},[]),be=u===`provisioning`&&(D.confirmError||D.targetsError),H=u===`provisioning`&&!be,xe=H&&!ee,U=`transition-[background-color] duration-300 ease-out${H?` bg-black p-0`:``}`,Se=H?`[animation:fadeIn_0.45s_ease-out_both]`:f===`revealing`?`[animation:fadeInUp_0.42s_ease-out_0.12s_both]`:`[animation:fadeIn_0.25s_ease-out_both]`;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(C.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,q.jsxs)(C.Content,{size:`md`,hideCloseButton:u!==`complete`,dismissOnOverlayClick:!xe,onEscapeKeyDown:xe?e=>e.preventDefault():void 0,onInteractOutside:xe?e=>e.preventDefault():void 0,"data-theme":H?`dark`:void 0,overlayClassName:U,className:H?`overflow-y-auto inset-0 max-w-none w-screen h-screen max-h-none rounded-none border-0`:`overflow-hidden`,style:{[yt]:ie},children:[(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col motion-reduce:[animation:none] ${Se}`,children:Ce()},u),f!==`idle`&&(0,q.jsx)(`div`,{"aria-hidden":!0,"data-testid":`takeover-exit-sheet`,className:`pointer-events-none fixed inset-0 z-50 ${f===`covering`?`[animation:fadeIn_200ms_ease-in_both]`:`[animation:fadeIn_380ms_ease-out_both_reverse]`}`,style:{backgroundColor:bt},children:F&&(0,q.jsx)(lt,{imageUrl:F,animateIn:!1})})]})}),(0,q.jsx)(ae,{open:S&&k,title:s(`billingOnboardingModal.backgroundConfirmTitle`),message:E.backgroundConfirmMessage,confirmLabel:s(`billingOnboardingModal.backgroundConfirmContinue`),cancelLabel:s(`billingOnboardingModal.backgroundConfirmKeepWaiting`),onConfirm:ve,onCancel:ye})]});function Ce(){return u===`provisioning`?D.confirmError||D.targetsError?(0,q.jsx)(at,{onGoToBilling:t,direction:T}):(0,q.jsx)(Bt,{state:D.state,direction:T,softWaiting:D.softWaiting,intent:h,creditsChange:c?o?.credits:void 0,targets:j??Qt,fromSnapshot:re,machineFloor:D.machineFloor,landed:D.landed,celebrating:me,onCelebrationEnd:ge,assistantId:M,escapeAvailable:k&&D.escapeEligible,onEscape:_e,onPhaseChange:y,kickError:D.kickError,confirm:{onRetry:D.retryConfirm,onGoToBilling:t},dwellMs:r,phaseMinMs:i}):u===`domain`?(0,q.jsx)(it,{machineBusy:k,assistantId:M,onExit:()=>d(`complete`)}):(0,q.jsx)(Ke,{assistantId:M,direction:T})}}function en(e){return e!=null&&!e.customized}function tn(e){return en(e)?e.name:`Custom`}var nn=[`mighty`,`super`,`ultra`],rn=[`free`,...nn];function an(e){return rn.indexOf(e)}function on(e,t){if(e===null)return`upgrade`;let n=an(e),r=an(t);return n===-1||r===-1?`upgrade`:r===n?`current`:r<n?`downgrade`:`upgrade`}function sn(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>nn.indexOf(e.key)-nn.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 cn=[`too_expensive`,`missing_features`,`switched_service`,`unused`,`too_complex`,`low_quality`,`customer_service`,`other`],ln={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`},un=1e3,dn={feedback:null,comment:``};function fn(e){return e.feedback!=null}function pn(e){let t=e.feedback===`other`?e.comment.trim():``;return{feedback:e.feedback,comment:t||null}}function mn({value:e,onChange:t,disabled:n}){let{t:r}=V(`settings`);return(0,q.jsxs)(`div`,{className:`mt-5 space-y-3`,"data-testid":`cancel-reason-survey`,children:[(0,q.jsx)(o,{as:`p`,variant:`body-medium-default`,children:r(`cancelReasonSurvey.title`)}),(0,q.jsx)(se,{value:e.feedback??``,onValueChange:n=>t({...e,feedback:n===``?null:n}),name:`cancel-reason`,disabled:n,"aria-label":r(`cancelReasonSurvey.title`),children:cn.map(e=>(0,q.jsx)(M,{value:e,label:r(ln[e])},e))}),e.feedback===`other`?(0,q.jsx)(P,{label:r(`cancelReasonSurvey.otherLabel`),placeholder:r(`cancelReasonSurvey.otherPlaceholder`),value:e.comment,onChange:n=>t({...e,comment:n.target.value}),maxLength:un,rows:3,disabled:n,fullWidth:!0,"data-testid":`cancel-reason-comment`}):null]})}var hn={free:{bodyShape:`ninja`,eyeStyle:`angry`,color:`yellow`},mighty:{bodyShape:`blob`,eyeStyle:`grumpy`,color:`green`},super:{bodyShape:`urchin`,eyeStyle:`goofy`,color:`teal`},ultra:{bodyShape:`sprout`,eyeStyle:`curious`,color:`orange`}};function gn({tier:e,size:t=40}){let n=hn[e]??hn.free,r=T();return(0,q.jsx)(`div`,{"aria-hidden":!0,className:`inline-flex shrink-0`,children:r?(0,q.jsx)(b,{components:r,bodyShapeId:n.bodyShape,colorId:n.color,size:t}):(0,q.jsx)(`div`,{style:{width:t,height:t}})})}var _n={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 vn(e){return _n[e]}function yn(e){return`Downgrade to ${e}`}function bn(e){let t=e/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function xn(e){return`${bn(e)}/mo`}function Sn(e){return`${bn(e)}/month`}function Cn(e){return`${e>0?`+`:`−`}${bn(Math.abs(e))}/mo`}function wn(e){return`${e} GB storage`}function Tn(e){return`${bn(e*100)} of bundled credits`}var En=`Small`;function Dn(e){return e?.machine_size?G[e.machine_size]??e.machine_size:En}function On(e,t){let n=vn(e.key)?.extraFeatures??[];return[{icon:ze,label:`${Dn(e)} Machine`},{icon:De,label:`${e.storage_gib} GB Storage`},{icon:Ee,label:t},...n.map(e=>({icon:Se,label:e}))]}function kn(){return[{icon:ze,label:`${En} Machine`},{icon:De,label:`4 GB Storage`},{icon:Ee,label:`Pay as you go credits`}]}function An(e,t=[]){let n=e?.credits_usd??0,r=e?.storage_gib??4,i=Me[e?.machine_size??`small`];return[`${Dn(e)} machine${i?` (${i})`:``}`,wn(r),e?.usage_label??Tn(n),...t]}var jn={machine:`Configurable machine size`,storage:`Configurable storage`,credits:`Pay-as-you-go and bundled credits`};function Mn(e,t){let n=[`${e.machineTier?je[e.machineTier]??t.machine_tiers.find(t=>t.tier===e.machineTier)?.label??e.machineTier:En} Machine`];if(e.storageGib!=null&&n.push(`${e.storageGib} GB`),e.creditTier!=null){let r=ut(t,e.creditTier)?.label,i=dt(e.creditTier);n.push(r??(i==null?`Credit bundle`:`${i} credits/mo`))}return n}function Nn(e,t){let n=new Set([jn.machine]);return e.storageGib!=null&&n.add(jn.storage),e.creditTier!=null&&n.add(jn.credits),[...Mn(e,t),...t.included_features.filter(e=>!n.has(e))]}function Pn(e){return e.disabled===!0}function Fn({machineTiers:e,storageTiers:t,selectedMachineTier:n,selectedStorageTier:r,onMachineTierChange:i,onStorageTierChange:a,currentMachinePriceCents:s,currentStoragePriceCents:c}){let{t:l}=V(`settings`),u=(0,K.useMemo)(()=>e.map(e=>{let t=je[e.tier]??e.label,n=s==null?l(`tierPicker.priceAddon`,{price:xn(e.price_cents)}):e.price_cents===s?l(`tierPicker.priceCurrent`,{price:xn(e.price_cents)}):Cn(e.price_cents-s);return{value:e.tier,label:l(`tierPicker.machineOption`,{label:t,priceLabel:n}),disabled:Pn(e)}}),[e,s,l]),d=(0,K.useMemo)(()=>t.map(e=>{let t=c==null?l(`tierPicker.priceAddon`,{price:xn(e.price_cents)}):e.price_cents===c?l(`tierPicker.priceCurrent`,{price:xn(e.price_cents)}):Cn(e.price_cents-c);return{value:e.tier,label:l(`tierPicker.storageOption`,{gib:e.storage_gib,priceLabel:t}),disabled:Pn(e)}}),[t,c,l]);return(0,q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(o,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:l(`tierPicker.machineLabel`)}),(0,q.jsx)(`span`,{title:l(`tierPicker.machineTooltip`),children:(0,q.jsx)(W,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,q.jsx)(I,{"aria-label":l(`tierPicker.machineAriaLabel`),placeholder:l(`tierPicker.machinePlaceholder`),value:n??``,onChange:i,options:u})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(o,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:l(`tierPicker.storageLabel`)}),(0,q.jsx)(`span`,{title:l(`tierPicker.storageTooltip`),children:(0,q.jsx)(W,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,q.jsx)(I,{"aria-label":l(`tierPicker.storageAriaLabel`),placeholder:l(`tierPicker.storagePlaceholder`),value:r??``,onChange:a,options:d})]})]})}var In=new Set([`active`,`trialing`,`past_due`]);function Ln(e){return e.plan_id!==`base`&&e.cancel_at_period_end!==!0&&!e.cancel_at&&e.status!=null&&In.has(e.status)}function Rn(e){return e?.status!=null&&In.has(e.status)}var zn=[`target_plan_id`,`confirm`,`machine_tier`,`storage_tier`,`credit_tier`,`package`,`non_field_errors`];function Bn(e,t){if(e&&typeof e==`object`){for(let t of zn)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 Vn(e,t){let n=e.filter(e=>!Pn(e));return t!==null&&n.some(e=>e.tier===t)?t:n[0]?.tier??null}function Hn(e,t,n){return t===void 0?n:t!==null&&(t===n||e.some(e=>e.tier===t))?t:null}function Un(e){return e.length?Math.min(...e.map(e=>e.price_cents)):0}function Wn(){let e=B();return async t=>{try{let n=await t.mutateAsync();return await e.invalidateQueries({queryKey:fe()}),t.onSuccess(n),n}catch(e){return A.error(Bn(e,t.errorFallback()),{id:t.errorToastId}),null}}}var Gn=`billing-portal-return-snapshot`;function Kn(e){try{sessionStorage.removeItem(Gn),sessionStorage.setItem(Gn,JSON.stringify(e))}catch{}}function qn(){if(typeof sessionStorage>`u`)return null;try{let e=sessionStorage.getItem(Gn);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 Jn(){try{sessionStorage.removeItem(Gn)}catch{}}function Yn(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 Xn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function Zn(e){return e?e.cancel_at??e.current_period_end??null:null}function Qn(e){let t=B();return(0,K.useEffect)(()=>f(()=>{t.invalidateQueries(ue())}),[t]),h({onSuccess:t=>{e&&Kn(e),l(t.portal_url)},onError:()=>{A.error(R(`settings:useBillingPortalSession.openError`),{id:`billing-portal-session-error`})}})}function $n(){let e=g(),t=Wn();return{cancelSubscription:n=>t({mutateAsync:()=>e.mutateAsync({body:n}),onSuccess:e=>{let t=e.cancel_at?Xn(e.cancel_at):R(`settings:useCancelSubscription.endOfBillingPeriod`);A.info(R(`settings:useCancelSubscription.canceledToast`,{date:t}),{id:`subscription-cancel`})},errorToastId:`subscription-cancel-error`,errorFallback:()=>R(`settings:useCancelSubscription.cancelFailedToast`)}),isPending:e.isPending}}function er(e){return Promise.all([e.invalidateQueries({queryKey:fe()}),e.invalidateQueries({queryKey:D()}),e.invalidateQueries({queryKey:S()}),e.invalidateQueries({queryKey:v()})])}function tr({enabled:e=!0}={}){let n=B(),{t:r}=V(`settings`),[i,a]=(0,K.useState)(null),o=(0,K.useRef)(!1),[s,c]=(0,K.useState)(!1),l=t(),u=e&&l,d=z({...ue(),enabled:u}),f=d.data,p=f!=null&&f.plan_id!==`base`,m=z({...k(),enabled:u&&p}),h=z({...w(),enabled:u&&p}).data?.plans.find(e=>e.id===`pro`)?.machine_tiers??[],g=e=>h.find(t=>t.tier===e)?.price_cents??null,_=me(ie()),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&&In.has(f.status)&&f.cancel_at_period_end!==!0&&!f.cancel_at,b=!p||!m.isPending,x=!p||m.isSuccess&&m.data!=null&&!m.isFetching&&m.dataUpdatedAt>=d.dataUpdatedAt,S=s||_.isPending,C=async(e,t=v)=>{if(o.current)return null;o.current=!0,c(!0);try{return await T(e,t)}finally{o.current=!1,c(!1)}},T=async(e,t)=>{a(null);let i=e=>(a(e),A.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 i(r(`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===t.machineTier?u.machineTier:e.machineTier,storageTier:e.storageTier===t.storageTier&&u.storageTier!=null?u.storageTier:e.storageTier,creditTier:e.creditTier===t.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 i(Bn(e,r(`customPlanModal.changeFailed`)))}return await er(n),C===`no_op`?{needsResize:!1,creditChanged:!1}:{needsResize:h||p&&!S,creditChanged:v}};return{changeTiers:C,isPending:S,error:i,current:v,eligible:y,currentReady:b,currentKnown:x,primaryAssistantId:x?m.data?.primary_assistant_id??null:null}}function nr(){let e=B(),{t}=V(`settings`),n=me(ie());return{changePackage:async r=>{try{let t=await n.mutateAsync({body:{package:r}});return await er(e),t}catch(e){return A.error(Bn(e,t(`customPlanModal.changeFailed`))),null}},isPending:n.isPending}}function rr({className:e,"data-testid":t,children:n}){return(0,q.jsx)(`div`,{"aria-hidden":!0,"data-testid":t,className:N(`flex size-[52px] shrink-0 items-center justify-center rounded-xl`,e),children:n})}var ir=32;function ar(){let{ready:e,avatar:t}=_t();return(0,q.jsx)(rr,{"data-testid":`assistant-avatar-tile`,className:`bg-[var(--surface-active)]`,children:e?(0,q.jsx)(m,{components:t.components,traits:t.traits,customImageUrl:t.customImageUrl,size:ir}):null})}var or=`Billed monthly · prorated difference charged today`,sr=`Billed monthly · prorated difference charged today or credited next invoice`,cr=`Billed monthly · prorated credit on your next invoice`,lr=`Your machine downsizes now and your storage stays. No refund.`,ur=`Continue`,dr=`The plan includes`,fr=`Your plan will include`;function pr(e,t,n){let r=n?vn(n)?.tagline??``:``;switch(e){case`downgrade`:return{title:yn(t),subtitle:``,priceCaption:cr,checklistHeading:fr,note:lr,confirmLabel:yn(t),destructive:!0};case`switch`:return{title:`Switch to ${t}`,subtitle:r,priceCaption:sr,checklistHeading:dr,note:``,confirmLabel:ur,destructive:!1};default:return{title:`Upgrade to ${t}`,subtitle:r,priceCaption:or,checklistHeading:dr,note:``,confirmLabel:ur,destructive:!1}}}function mr({open:e,relation:t,packageName:n,targetPackage:r,pending:i,onCancel:a,onConfirm:s}){let{t:c}=V(`settings`),l=(0,K.useRef)(null),u=(0,K.useId)(),d=pr(t,n,r?.key??null),f=r?{price:xn(r.total_price_cents),highlights:An(r,vn(r.key)?.extraFeatures??[])}:null,m=d.subtitle,h=d.note?{"aria-describedby":u}:m?{}:{"aria-describedby":void 0};return(0,q.jsx)(C.Root,{open:e,onOpenChange:e=>{!e&&!i&&a()},children:(0,q.jsxs)(C.Content,{size:`sm`,hideCloseButton:!0,className:`gap-4 p-4 max-w-[421px]`,onOpenAutoFocus:e=>{e.preventDefault(),l.current?.focus()},...h,children:[(0,q.jsxs)(C.Header,{className:`flex-row items-center gap-3 p-0 pb-2`,children:[d.destructive?(0,q.jsx)(rr,{"data-testid":`package-switch-warning-tile`,className:`bg-[var(--system-negative-weak)]`,children:(0,q.jsx)(be,{className:`size-6 text-[var(--system-negative-strong)]`})}):(0,q.jsx)(ar,{}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,q.jsx)(C.Title,{className:`text-title-small text-[var(--content-emphasised)] [&>span]:whitespace-normal`,children:d.title}),m?(0,q.jsx)(C.Description,{className:`mt-0 text-body-medium-default text-[var(--content-tertiary)]`,children:m}):null]})]}),f?(0,q.jsxs)(C.Body,{className:`flex flex-col gap-4 p-0`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,q.jsx)(o,{as:`p`,variant:`title-large`,className:`text-[var(--content-default)]`,children:f.price}),(0,q.jsx)(o,{as:`p`,variant:`label-medium-default`,className:`leading-[15px] text-[var(--content-tertiary)]`,children:d.priceCaption})]}),(0,q.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,q.jsx)(o,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,children:d.checklistHeading}),(0,q.jsx)(`ul`,{className:`flex flex-col gap-2`,children:f.highlights.map(e=>(0,q.jsxs)(`li`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(Oe,{className:`size-4 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,q.jsx)(o,{as:`span`,variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]},e))})]}):null,d.note?(0,q.jsx)(o,{id:u,as:`p`,variant:`body-medium-default`,className:`text-[var(--content-secondary)]`,children:d.note}):null,(0,q.jsxs)(C.Footer,{className:`flex-col gap-4 p-0`,children:[(0,q.jsx)(p,{fullWidth:!0,variant:d.destructive?`danger`:`primary`,onClick:s,disabled:i,"data-testid":`confirm-package-switch-button`,children:d.confirmLabel}),(0,q.jsx)(p,{ref:l,fullWidth:!0,variant:`ghost`,onClick:a,disabled:i,children:c(`packageSwitchConfirmModal.cancel`)})]})]})})}function hr(){let e=B();(0,K.useEffect)(()=>f(()=>{er(e)}),[e])}export{xn as A,en as B,Nn as C,On as D,Dn as E,mn as F,qe as G,tn as H,dn as I,Ge as K,fn as L,wn as M,vn as N,Cn as O,gn as P,pn as R,Pn as S,kn as T,on as U,sn as V,$t as W,Ln as _,er as a,Vn as b,Jn as c,qn as d,Qn as f,Rn as g,Bn as h,tr as i,Sn as j,bn as k,Xn as l,In as m,mr as n,$n as o,Wn as p,ze as q,nr as r,Yn as s,hr as t,Zn as u,Un as v,Mn as w,Fn as x,Hn as y,nn as z};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$m as t,$v as n,Ai as r,Bl as i,Bm as a,CS as o,Fl as s,Gm as c,Iv as l,Jy as u,Km as d,Lv as f,NS as p,Ni as m,Nu as h,Pu as g,Rm as _,Su as v,Vm as y,Xn as b,Ym as x,_u as S,aS as C,du as w,fi as T,fs as E,fu as D,fx as O,gu as k,hu as ee,iS as A,jl as j,lS as M,lo as N,mS as P,mu as te,pl as ne,ps as re,pu as ie,rS as ae,sg as F,tS as I,ty as oe,uS as se,ug as ce,vl as le,vu as ue,xS as L,yl as de,yu as fe,zm as pe}from"./app-BBUxTj9g.js";import{I as R,Jn as me,Zn as z,er as B,ir as he,j as V,or as ge}from"./vendor-ajttH1pP.js";import{f as _e,t as ve,x as ye}from"./react-B9IgSVeK.js";import{D as be,Ji as H,Ra as xe,Ui as U,Vn as Se,Ya as Ce,Yn as we,ci as Te,fr as W,pi as Ee,xr as De,zi as Oe}from"./icons-C0wyat6T.js";import{c as ke,i as G,l as Ae,n as je,r as Me,t as Ne}from"./machine-sizes-3x95p4n1.js";import{a as Pe,i as Fe,n as Ie,r as Le,t as Re}from"./provisioning-targets-DdCpl6ZX.js";var ze=Ce(`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`}]]),K=e(ye(),1),q=ve();function Be({icon:e}){return(0,q.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,q.jsx)(e,{className:`h-5 w-5`,style:{color:`var(--system-negative-strong)`},"aria-hidden":`true`})})}var J={fontFamily:`var(--font-serif)`,fontSize:`32px`,fontWeight:400,lineHeight:1.2,letterSpacing:`0.64px`};function Y({title:e,subtitle:t}){return(0,q.jsxs)(`header`,{className:`flex flex-col items-center gap-2 pt-12 text-center`,children:[(0,q.jsx)(`h2`,{className:`text-[var(--content-emphasised)]`,style:J,children:e}),t&&(0,q.jsx)(`p`,{className:`text-[14px] font-normal text-[var(--content-secondary)]`,children:t})]})}var Ve=[{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}],He=[{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 Ue({variant:e=`full`}){let t=T();return t?(0,q.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`creature-corners`,className:`pointer-events-none absolute inset-0 select-none`,children:(e===`top`?He:Ve).map((e,n)=>(0,q.jsx)(`span`,{className:`absolute ${e.position}`,style:{rotate:`${e.rotate}deg`},children:(0,q.jsx)(b,{components:t,bodyShapeId:e.bodyShape,eyeStyleId:e.eyeStyle,colorId:e.color,size:e.size})},n))}):null}var X={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.`},Z={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.`},Q={upgrade:X,downgrade:Z,change:Z};function We(e=`upgrade`){return Q[e]}function Ge(e,t=!0){let{data:n}=z({...ne(),enabled:t&&e==null}),{data:r}=z({...i({path:{id:e??``}}),enabled:t&&e!=null});return e==null?n:r}function Ke({assistantId:e,direction:n}){let r=_e(),{t:i}=V(`settings`),a=Ge(e,t())?.name||i(`completeState.assistantFallbackName`);return(0,q.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,q.jsx)(Ue,{variant:`full`}),(0,q.jsxs)(`div`,{className:`relative flex w-full flex-col items-center`,children:[(0,q.jsx)(Y,{title:i(`completeState.title`),subtitle:We(n).completeSubtitle}),(0,q.jsx)(`div`,{className:`mt-10 flex w-full flex-col items-center gap-10`,children:(0,q.jsx)(p,{variant:`primary`,"data-testid":`onboarding-complete-return`,onClick:()=>{e!=null&&F(e),r(O.assistant,{replace:!0})},children:i(`completeState.returnTo`,{assistantName:a})})})]})]})}function qe(e=!0,t){let n=Ge(t,e),r=t??n?.id,{data:i,isError:a,isFetching:o,dataUpdatedAt:s,errorUpdatedAt:c}=z({...le({path:{assistant_id:r??``}}),enabled:e&&!!r});return{assistant:n,assistantId:r,domains:i,domainsError:a,domainsFetching:o,domainsUpdatedAt:s,domainsErrorUpdatedAt:c}}var Je=1e3,Ye=1e4,Xe=2500,Ze=2e3,Qe=1e4,$e=[`machine_size`,`subdomain`,`non_field_errors`],et={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.`},tt={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 nt(e,t,n=`upgrade`){if(e&&typeof e==`object`){let t=e;if(typeof t.error==`string`){let e=(n===`upgrade`?void 0:tt[t.error])??et[t.error];if(e)return e}for(let e of $e){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 $=`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`,rt=`text-[11px] font-medium text-[var(--content-secondary)]`;function it({onExit:e,machineBusy:t=!1,assistantId:n}){let{t:i}=V(`settings`),a=B(),o=r.use.emailRootDomain(),{assistant:s,assistantId:c,domains:l}=qe(!0,n),u=l?.results[0],[d,f]=(0,K.useState)(``),[m,h]=(0,K.useState)(`hi`),[g,_]=(0,K.useState)(!1);(0,K.useEffect)(()=>{if(!g){if(u){f(u.subdomain),_(!0);return}!s?.handle||d||(f(s.handle),_(!0))}},[s?.handle,u,g,d]);let[v,y]=(0,K.useState)(null),[b,x]=(0,K.useState)(!1),w=me(te()),T=!!u||b,E=w.isPending||b;return(0,K.useEffect)(()=>{if(!b)return;let t=setTimeout(e,800);return()=>clearTimeout(t)},[b,e]),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(C.Body,{className:`animate-[onboarding-step-in_350ms_ease-out] space-y-6 pb-0 motion-reduce:animate-none`,children:[(0,q.jsx)(Ue,{variant:`top`}),(0,q.jsx)(Y,{title:i(`domainStep.title`),subtitle:i(`domainStep.subtitle`)}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`label`,{htmlFor:`onboarding-email-prefix`,className:rt,children:i(`domainStep.prefixLabel`)}),(0,q.jsx)(`input`,{id:`onboarding-email-prefix`,value:m,onChange:e=>h(e.target.value.toLowerCase().trim()),disabled:E||T,readOnly:T,placeholder:i(`domainStep.emailUsernamePlaceholder`),className:`${$} w-24`})]}),(0,q.jsx)(`span`,{className:`flex h-8 items-center text-[var(--content-secondary)]`,children:`@`}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,q.jsx)(`label`,{htmlFor:`onboarding-email-handle`,className:rt,children:i(`domainStep.handleLabel`)}),(0,q.jsx)(`input`,{id:`onboarding-email-handle`,value:d,onChange:e=>{f(e.target.value.toLowerCase().trim()),v&&y(null)},disabled:E||T,readOnly:T,autoFocus:!0,placeholder:i(`domainStep.subdomainExamplePlaceholder`),"aria-invalid":!!v,className:`${$} w-full min-w-0`})]}),(0,q.jsxs)(`span`,{className:`flex h-8 shrink-0 items-center text-[14px] text-[var(--content-tertiary)]`,children:[`.`,o]})]}),v&&(0,q.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:v}),T&&(0,q.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:i(`domainStep.domainLockedMessage`)})]}),t&&!T&&(0,q.jsx)(L,{tone:`neutral`,children:i(`domainStep.machineBusyNotice`)}),!T&&(0,q.jsx)(L,{tone:`info`,className:`border-transparent bg-[var(--surface-active)]`,children:(0,q.jsx)(`span`,{className:`font-medium text-[var(--content-tertiary)]`,children:i(`domainStep.handleImmutableNotice`)})}),b?(0,q.jsx)(L,{tone:`success`,children:i(`domainStep.domainSetRedirecting`)}):null]}),(0,q.jsx)(C.Footer,{className:`items-center pt-6`,children:T?(0,q.jsx)(p,{variant:`primary`,"data-testid":`onboarding-domain-continue`,onClick:e,children:i(`domainStep.continue`)}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{variant:`outlined`,"data-testid":`onboarding-domain-skip`,disabled:E,onClick:()=>{E||w.mutate({body:{skipped:!0}},{onSuccess:e,onError:()=>e()})},children:i(`domainStep.skip`)}),(0,q.jsx)(p,{variant:`primary`,"data-testid":`onboarding-domain-set`,disabled:!d||E||t,onClick:()=>{E||t||!d||w.mutate({body:{subdomain:d,...m?{email_username:m}:{}}},{onSuccess:()=>{y(null),x(!0),a.invalidateQueries({queryKey:j()}),a.invalidateQueries({queryKey:de({path:{assistant_id:c??``}})}),a.invalidateQueries({queryKey:S()})},onError:e=>{y(nt(e,i(`domainStep.registerSubdomainFailed`)))}})},children:i(`domainStep.next`)})]})})]})}function at({onGoToBilling:e,direction:t}){let{t:n}=V(`settings`);return(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-6 py-10 text-center`,children:[(0,q.jsx)(Be,{icon:U}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(o,{variant:`title-small`,as:`h1`,children:n(`errorStates.fetchErrorTitle`)}),(0,q.jsx)(o,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:We(t).fetchErrorBody})]}),(0,q.jsx)(p,{variant:`primary`,"data-testid":`onboarding-go-to-billing`,onClick:e,children:n(`errorStates.goToBilling`)})]})}function ot(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 st=60,ct=st*2;function lt({imageUrl:e,animateIn:t=!0}){return(0,q.jsxs)(`div`,{"aria-hidden":!0,"data-testid":`takeover-backdrop`,className:`pointer-events-none absolute inset-0 overflow-hidden${t?` provision-avatar-reveal`:``}`,children:[(0,q.jsx)(`img`,{src:e,alt:``,decoding:`async`,draggable:!1,className:`absolute left-1/2 top-1/2 max-w-none -translate-x-1/2 -translate-y-1/2 object-cover object-center`,style:{filter:`blur(${st}px)`,width:`calc(100% + ${ct*2}px)`,height:`calc(100% + ${ct*2}px)`}}),(0,q.jsx)(`div`,{className:`absolute inset-0 bg-black/55`})]})}function ut(e,t){if(t!=null)return e?.credit_tiers?.find(e=>e.tier===t)}function dt(e){let t=e?.match(/^credits_(\d+)$/)?.[1];return t==null?null:Number(t)}function ft(e){let n=t(),{data:r}=z({...w(),enabled:n&&e});return r?.plans.find(e=>e.id===`pro`)}function pt(e,t){return t==null?0:ut(e,t)?.credits_usd??dt(t)}function mt(e,t){return t==null?null:ut(e,t)?.label}function ht(e){let t=ft(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=ut(t,i?.credit_tier);n=i?.credits_usd??a?.credits_usd,r=i?.usage_label??a?.label??void 0}else{let i=ut(t,e.creditTier);n=i?.credits_usd,r=i?.label}return n==null?null:{fromLabel:null,toLabel:r}}function gt(e){let t=ft(e!=null);return e==null||pt(t,e.fromTier)==null||pt(t,e.toTier)==null?null:{fromLabel:mt(t,e.fromTier),toLabel:mt(t,e.toTier)}}function _t(e){let t=u.use.activeAssistantId(),n=e===void 0?t:e,{components:r,traits:i,customImageUrl:o,state:s,isLoading:l}=c(n),f=(0,K.useMemo)(()=>a(),[y()]),p=f!=null&&pe(f)?f:null,m=n!=null&&!l,h=p!=null&&(n==null||n===p.assistantId),g=h&&!(m&&(r!=null||i!=null||o!=null))?p:null,_=g?g.components:r,v=g?g.traits:i,b=g?null:o,S=m||h,C=d({state:g?null:s,components:_,traits:v,customImageUrl:b})??(b?null:x[0]?.hex??null);return{tintHex:S&&C?re(C):E,backdropImageUrl:S?b:null,ready:S,avatar:{components:_,traits:v,customImageUrl:b}}}function vt(e,t){let[n,r]=(0,K.useState)(e),i=(0,K.useRef)(0);return(0,K.useEffect)(()=>{i.current=performance.now()},[]),(0,K.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 yt=`--takeover-surface`,bt=`var(${yt},${E})`,xt=`color-mix(in srgb, var(--content-emphasised) 10%, transparent)`,St=240,Ct=1.414,wt=[{minHeight:680,size:St},{minHeight:600,size:184}],Tt=132;function Et(e){for(let t of wt)if(e>=t.minHeight)return t.size;return Tt}function Dt(){let[e,t]=(0,K.useState)(()=>Et(typeof window>`u`?1/0:window.innerHeight));return(0,K.useEffect)(()=>{let e=()=>t(Et(window.innerHeight));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}var Ot={machine:Te,storage:De,credits:Ee},kt={idle:``,working:` is-working`,settling:` is-settling`,stalled:` is-stalled`,grown:` is-evolved`};function At(e,t){return e===`DONE`||e===`NOT_APPLICABLE`?`grown`:e===`STALLED`?`stalled`:e===`WAITING`||e===`RESIZING`?t?`settling`:`working`:`idle`}function jt({assistantId:e,mode:t,downsizing:n=!1}){let{avatar:r,ready:i}=_t(e),a=T(),o=Dt(),s=t===`working`||t===`settling`;return(0,q.jsxs)(`div`,{"aria-hidden":!0,className:`provision-avatar-evolve relative z-10 flex flex-col items-center${kt[i?t:`idle`]}${n?` is-downsizing`:``}`,style:{"--provision-avatar-size":`${o}px`,"--provision-avatar-growth":Ct},children:[(0,q.jsxs)(`div`,{className:`provision-avatar-stage`,children:[(0,q.jsx)(`div`,{"data-testid":`provision-avatar-placeholder`,className:`provision-avatar-placeholder${i?` is-resolved`:``}`}),(0,q.jsx)(`div`,{className:`provision-avatar-layer`,children:(0,q.jsx)(`div`,{className:`provision-avatar-current`,children:(0,q.jsx)(`div`,{className:`provision-avatar-strain`,children:i&&(0,q.jsx)(`div`,{className:`provision-avatar-reveal`,children:(0,q.jsx)(m,{components:r.components??a,traits:r.traits,customImageUrl:r.customImageUrl,size:o,isAssistantBusy:s})})})})})]}),(0,q.jsx)(`div`,{className:`provision-avatar-shadow`})]})}function Mt({status:e,caption:t}){return(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5`,children:[(0,q.jsx)(`h1`,{className:`text-[var(--content-emphasised)]`,style:J,children:e}),t&&(0,q.jsx)(o,{variant:`body-medium-lighter`,as:`p`,className:`max-w-sm text-[var(--content-secondary)]`,children:t})]})}function Nt({icon:e,label:t,from:n,to:r,done:i=!1,pending:a=!1,testId:o}){let{t:s}=V(`settings`),c=null;return i?c=s(`provisioningState.statusComplete`):a&&(c=s(`provisioningState.statusPending`)),(0,q.jsxs)(`div`,{"data-testid":o,className:`flex min-w-0 flex-auto items-center gap-2 rounded-lg px-2 py-1.5${a?` opacity-70`:``}`,style:{backgroundColor:xt},children:[(0,q.jsx)(`span`,{className:`hidden h-6 w-6 shrink-0 items-center justify-center min-[420px]:flex`,children:(0,q.jsx)(e,{className:`h-3.5 w-3.5 text-[var(--content-tertiary)]`,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 text-left wrap-anywhere`,children:[(0,q.jsx)(`span`,{className:`text-[12px] font-medium leading-tight text-[var(--content-tertiary)]`,children:t}),(0,q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-[14px] font-medium leading-[18px] text-[var(--content-emphasised)]`,children:[n&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{children:n}),(0,q.jsx)(`span`,{className:`sr-only`,children:s(`provisioningState.srOnlyTo`)}),(0,q.jsx)(xe,{className:`h-3 w-3 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":`true`})]}),(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,q.jsx)(`span`,{children:r}),i?(0,q.jsx)(H,{"data-testid":`chip-check`,className:`h-3.5 w-3.5 shrink-0 text-[var(--system-positive-strong)]`,"aria-hidden":`true`}):a&&(0,q.jsx)(we,{"data-testid":`chip-spinner`,className:`h-3.5 w-3.5 shrink-0 animate-spin text-[var(--content-tertiary)] motion-reduce:animate-none`,"aria-hidden":`true`})]}),c&&(0,q.jsx)(`span`,{className:`sr-only`,children:c})]})]})]})}function Pt({label:e}){return(0,q.jsx)(`span`,{className:`rounded-lg px-3 py-2 text-[14px] text-[var(--content-emphasised)]`,style:{backgroundColor:xt},children:e})}function Ft({children:e,wide:t=!1,testId:n}){return(0,q.jsx)(`div`,{"data-testid":n,className:`flex w-full ${t?`max-w-2xl`:`max-w-sm`} items-stretch justify-center gap-2`,children:e})}function It(e,t){return e===`credits`?!0:t?.[e]===!0}function Lt(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 Rt({intent:e,creditsChange:t,targets:n,fromSnapshot:r,machineFloor:i,landed:a,allDone:o=!1,creditsOnly:s=!1}){let{t:c}=V(`settings`),l=ht(e),u=gt(t),d=ot({targets:n,fromSnapshot:r,machineFloor:i,credits:Lt(l??u,c)}),f=s?d.filter(e=>e.key===`credits`):d,p=f.filter(e=>o||It(e.key,a)).map(e=>e.label).join(`, `),[m]=(0,K.useState)(p),h=p===m?``:c(`provisioningState.dimensionsComplete`,{dimensions:p});return f.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Ft,{testId:`resource-chips`,wide:f.length>=3,children:f.map(e=>{let t=o||It(e.key,a);return(0,q.jsx)(Nt,{testId:`chip-${e.key}`,icon:Ot[e.key],label:e.label,from:e.from,to:e.to,done:t,pending:!t},e.key)})}),(0,q.jsx)(`p`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`chip-announcement`,children:h})]})}function zt({intent:e}){let{t}=V(`settings`),n=ht(e.kind===`custom`?e:null);if(e.kind===`package`)return(0,q.jsx)(Ft,{children:(0,q.jsx)(Pt,{label:t(`provisioningState.packageChip`,{name:e.packageKey.charAt(0).toUpperCase()+e.packageKey.slice(1)})})});let r=[e.machineTier,e.storageTier,e.creditTier].filter(e=>e!=null).length;return(0,q.jsxs)(Ft,{wide:r>=3,children:[e.machineTier!=null&&(0,q.jsx)(Nt,{icon:Te,label:t(`provisioningState.machineLabel`),to:je[e.machineTier]??e.machineTier}),e.storageTier!=null&&(0,q.jsx)(Nt,{icon:De,label:t(`provisioningState.storageLabel`),to:e.storageTier.toUpperCase()}),e.creditTier!=null&&n?.toLabel!=null&&(0,q.jsx)(Pt,{label:n.toLabel})]})}function Bt({state:e,direction:t,softWaiting:n,intent:r,creditsChange:i,targets:a,fromSnapshot:o,machineFloor:s,landed:c,celebrating:l,onCelebrationEnd:u,assistantId:d,escapeAvailable:f,onEscape:m,onPhaseChange:h,kickError:g,confirm:_,dwellMs:v=Xe,phaseMinMs:y=900}){let{t:b}=V(`settings`),x=We(t),S=(0,K.useRef)(u);(0,K.useEffect)(()=>{S.current=u},[u]);let C=vt(e,y),w=C===`DONE`||C===`NOT_APPLICABLE`,T=C===`RESIZING`?`WAITING`:C,E=(0,K.useRef)(h);(0,K.useEffect)(()=>{E.current=h},[h]),(0,K.useEffect)(()=>{E.current?.(C)},[C]);let{tintHex:D,backdropImageUrl:O}=_t(d),k=l&&w;return(0,K.useEffect)(()=>{if(!k)return;let e=setTimeout(()=>S.current(),v);return()=>clearTimeout(e)},[k,v]),(0,q.jsxs)(`div`,{"data-theme":`dark`,className:`provision-surface-settle relative flex h-full min-h-[420px] w-full flex-col items-center [justify-content:safe_center] gap-10 px-6 py-10 text-center`,style:{[yt]:D,backgroundColor:bt},children:[O&&(0,q.jsx)(lt,{imageUrl:O}),(0,q.jsx)(jt,{assistantId:d,mode:At(C,n),downsizing:t===`downgrade`}),(0,q.jsx)(`div`,{className:`relative z-10 flex min-h-[144px] w-full flex-col items-center gap-8 [animation:onboarding-step-in_420ms_ease-out] motion-reduce:[animation:none]`,children:j()},T)]});function ee(e=b(`provisioningState.continueInBackground`)){return f?(0,q.jsx)(p,{variant:`ghost`,"data-testid":`provisioning-escape`,onClick:m,children:e}):null}function A({allDone:e=!1,creditsOnly:t=!1}={}){return(0,q.jsx)(Rt,{intent:r,creditsChange:i,targets:a,fromSnapshot:o,machineFloor:s,landed:c,allDone:e,creditsOnly:t})}function j(){if(C===`CONFIRMING`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:x.confirmingStatus,caption:b(`provisioningState.confirmingCaption`)}),r&&(0,q.jsx)(zt,{intent:r}),ee()]});if(C===`WAITING`||C===`RESIZING`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:x.waitingStatus,caption:b(n?`provisioningState.waitingCaptionLong`:`provisioningState.waitingCaptionShort`)}),A(),ee()]});if(C===`DONE`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:b(`provisioningState.allDoneStatus`)}),A({allDone:!0})]});if(C===`NOT_APPLICABLE`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:b(`provisioningState.planReadyStatus`)}),A({allDone:!0,creditsOnly:!0})]});if(C===`STALLED`){let e=g!=null;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:e?x.snagStatus:b(`provisioningState.takingLongerStatus`),caption:e?nt(g,x.snagCaption,t):b(`provisioningState.stalledCaption`)}),A(),e?ee(b(`provisioningState.retryInBackground`)):ee()]})}return C===`CONFIRM_TIMEOUT`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:x.confirmTimeoutStatus,caption:x.confirmTimeoutCaption}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,q.jsx)(p,{variant:`outlined`,"data-testid":`onboarding-go-to-billing`,onClick:_.onGoToBilling,children:b(`provisioningState.goToBilling`)}),(0,q.jsx)(p,{variant:`primary`,"data-testid":`onboarding-retry`,onClick:_.onRetry,children:b(`provisioningState.tryAgain`)})]})]}):null}}function Vt(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&&!Pe(n,i);if(Pe(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 Ht=2e3,Ut=1e3,Wt=[`DONE`,`NOT_APPLICABLE`,`CONFIRM_TIMEOUT`],Gt={assistantId:null,machine:null,storage:null};function Kt({open:e,canLowerResources:n=!1,verdictRecheckMs:r=Qe}){let a=B(),o=t(),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(0),[f,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(null),[g,_]=(0,K.useState)(null),[v,y]=(0,K.useState)(null),[b,x]=(0,K.useState)(null),[C,w]=(0,K.useState)(null),[T,E]=(0,K.useState)(Gt),[D,O]=(0,K.useState)(null),[A,j]=(0,K.useState)(!1),M=(0,K.useRef)(!1),N=(0,K.useRef)(!1),P=(0,K.useRef)(0),[te,re]=(0,K.useState)(!1),[ie,ae]=(0,K.useState)(null),[F,I]=(0,K.useState)(null),[oe,se]=(0,K.useState)(null),[le,L]=(0,K.useState)(()=>Date.now()),[de,pe]=(0,K.useState)(!0);(0,K.useEffect)(()=>{e||(l(!1),d(0),p(null),h(null),_(null),re(!1),ae(null),I(null),se(null),pe(!0),y(null),x(null),w(null),E(Gt),O(null),j(!1),M.current=!1,N.current=!1,P.current+=1)},[e]),(0,K.useEffect)(()=>{e&&(p(Date.now()),a.invalidateQueries({queryKey:fe()}),a.invalidateQueries({queryKey:S()}))},[e,a]);let R=m!=null,V=z({...ue(),refetchInterval:e=>e.state.data?.plan_id===`pro`||c?!1:Je,refetchIntervalInBackground:!1,enabled:e&&o&&!R}),_e=(f!=null&&V.dataUpdatedAt>=f?V.data?.plan_id:null)??null;(0,K.useEffect)(()=>{if(!e||R||_e!==`pro`)return;let t=Date.now();h(t),L(t)},[e,R,_e]),(0,K.useEffect)(()=>{if(!e||R)return;let t=setTimeout(()=>l(!0),Ye);return()=>clearTimeout(t)},[e,R,u]);let ve=(0,K.useCallback)(()=>{l(!1),d(e=>e+1),ce.getState().fetchOrganizations(),a.invalidateQueries({queryKey:fe()})},[a]),ye=(0,K.useCallback)(()=>{let e=Date.now();_(e),L(e)},[]),{mutate:be}=me(ee()),H=(0,K.useCallback)(e=>{let t=P.current;be({},{onSuccess:n=>{t===P.current&&(O(null),Ie(n)?N.current?O({error:n.reason??`no_active_pro`}):(N.current=!0,j(!0),e===`escape`&&ye()):(y(n.state),e===`escape`&&ye()))},onError:e=>{t===P.current&&O(e)}})},[be,ye]);(0,K.useEffect)(()=>{!e||!o||!R||M.current||(M.current=!0,H(`auto`))},[e,o,R,H]),(0,K.useEffect)(()=>{if(!A)return;let e=P.current,t=setTimeout(()=>{j(!1),e===P.current&&H(`auto`)},Ze);return()=>clearTimeout(t)},[A,H]);let xe=(0,K.useCallback)(()=>H(`escape`),[H]),U=z({...k(),enabled:e&&o&&R}),Se=de?Ht:!1,Ce=z({...ne(),enabled:e&&o&&R,refetchInterval:e=>e.state.data?.id==null?Se:!1,retry:!1}),we=R&&f!=null&&U.dataUpdatedAt>=f,Te=we&&!U.isPending&&!U.isFetching,W=(we?U.data?.primary_assistant_id:null)??(U.isPending?null:Ce.data?.id??null),Ee=z({...i({path:{id:W??`unresolved`}}),enabled:e&&o&&R&&W!=null,refetchInterval:Se,retry:!1}),De=s({path:{id:W??`unresolved`}}),Oe=z({...De,enabled:e&&o&&R&&W!=null,refetchInterval:Se,retry:!1}),G=(0,K.useRef)(0),[je,Me]=(0,K.useState)(0),ze=ge(De.queryKey);(0,K.useEffect)(()=>a.getQueryCache().subscribe(t=>{if(!(t.type!==`updated`||t.query.queryHash!==ze)){if(t.action.type===`fetch`)G.current+=1;else if(t.action.type===`success`&&!t.action.manual){let n=G.current,r=e&&Le(t.action.data);he.schedule(()=>{Me(n),r&&(re(!0),ae(W))})}}}),[a,ze,e,W]);let q=Le(Oe.data),Be=ie===W,J=U.data,Y=(0,K.useMemo)(()=>J?{machineSize:ke(J.max_machine_tier),storageGib:J.selected_storage_gib??null}:null,[J]),Ve=J!=null&&J.max_machine_tier==null?Ne:null,He=J?J.domain_setup_available&&J.primary_assistant_id!=null:void 0,Ue=Ee.data,X=(0,K.useMemo)(()=>Ue?{machineSize:Ue.machine_size??null,storageGib:Ue.provisioned_storage_gib??null}:null,[Ue]),Z=oe===W,Q=(0,K.useMemo)(()=>{let e=Re(Y,X),t=Y?.machineSize??Ve;if(t==null)return e;let n=X?.machineSize??null;if(n==null)return{...e,machine:!1};let r=(Z?F?.machineSize:null)??n,i=Ae(t)<Ae(r);return{...e,machine:i?Ae(n)<=Ae(t):Ae(n)>=Ae(t)}},[Y,X,F,Z,Ve]),We=Pe(Y,X),Ge=C===W;(0,K.useEffect)(()=>{e&&(We?(x(e=>e!=null&&Ge?e:Date.now()),w(W)):(x(null),w(null)))},[e,We,W,Ge]);let Ke=T.assistantId===W;(0,K.useEffect)(()=>{if(!e)return;let t=G.current;E(e=>{let n=e.assistantId===W?e:Gt,r=Q.machine?n.machine??t:null,i=Q.storage?n.storage??t:null;return e.assistantId===W&&e.machine===r&&e.storage===i?e:{assistantId:W,machine:r,storage:i}})},[e,Q,W]);let qe=(0,K.useMemo)(()=>{let e=Fe(Oe.data),t=e=>e!=null&&Ke&&je>e;return{machine:Q.machine&&!e.machine&&t(T.machine),storage:Q.storage&&!e.storage&&t(T.storage)}},[Q,T,Ke,je,Oe.data]);(0,K.useEffect)(()=>{!e||!X||F!=null&&Z||(I(X),se(W))},[e,X,W,F,Z]);let Xe=g??m,$e=Xe==null?null:Math.max(0,le-Xe),et=!n,{state:tt,softWaiting:nt}=Vt({planId:R?`pro`:_e,targets:Y,actuals:X,initialActuals:Z?F:null,resizeOperationInFlight:q,sawOperation:te&&Be,msSinceWatchStart:$e,confirmExpired:c,serverVerdict:v,statusObservedSinceTargetsMet:b!=null&&Ge&&Oe.dataUpdatedAt>b,targetsProveNoop:et}),$=Wt.includes(tt),rt=e&&R&&!$;(0,K.useEffect)(()=>{pe(rt)},[rt]),(0,K.useEffect)(()=>{if(!e||!R||$)return;let t=setInterval(()=>L(Date.now()),Ut);return()=>clearInterval(t)},[e,R,$]);let it=!et&&(v===`started`||v===`in_progress`)&&!(te&&Be);return(0,K.useEffect)(()=>{if(!e||!R||$||!it)return;let t=setInterval(()=>H(`auto`),r);return()=>clearInterval(t)},[e,R,$,it,r,H]),{state:tt,softWaiting:nt,targets:Y,actualsSnapshot:F,machineFloor:Ve,landed:qe,assistantId:W,domainStepAvailable:He,onboardingSettled:Te,confirmError:!R&&V.isError,targetsError:R&&U.isError&&(!J||!we),escapeEligible:$e!=null&&$e>=6e4,retryConfirm:ve,kickProvisioning:xe,kickError:D}}var qt=200,Jt=380;function Yt(){return typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0}var Xt=e=>e===`WAITING`||e===`RESIZING`||e===`STALLED`,Zt=e=>e===`DONE`||e===`NOT_APPLICABLE`,Qt={machineSize:null,storageGib:null};function $t({open:e,onClose:t,dwellMs:r,phaseMinMs:i,mode:a=`checkout`,resizeContext:o}){let{t:s}=V(`settings`),c=a===`resize`,l=B(),[u,d]=(0,K.useState)(`provisioning`),[f,p]=(0,K.useState)(`idle`),m=(0,K.useRef)([]),[h,g]=(0,K.useState)(null),[v,y]=(0,K.useState)(null),[b,x]=(0,K.useState)(null),[S,w]=(0,K.useState)(!1),T=c?o?.direction:void 0,E=We(T),D=Kt({open:e,canLowerResources:c?o?.canLowerResources===!0:!1}),O=(0,K.useRef)(!1);(0,K.useEffect)(()=>{if(e){O.current=!0,g(c?null:oe()),x(e=>e??Date.now());return}m.current.forEach(clearTimeout),m.current=[],d(`provisioning`),p(`idle`),y(null),x(null),w(!1),O.current&&(O.current=!1,_())},[e,c]),(0,K.useEffect)(()=>()=>{m.current.forEach(clearTimeout)},[]),(0,K.useEffect)(()=>{u===`complete`&&n()},[u]);let k=Xt(D.state),ee=Zt(v??D.state),{targets:j,assistantId:M,domainStepAvailable:N,onboardingSettled:P}=D,te=c?o?.fromSnapshot:void 0,ne=D.actualsSnapshot,re={machineSize:te?.machineSize??ne?.machineSize??null,storageGib:te?.storageGib??ne?.storageGib??null},{tintHex:ie,backdropImageUrl:F}=_t(M),I=c&&N===!0,{domains:se,domainsError:ce,domainsFetching:le,domainsUpdatedAt:ue,domainsErrorUpdatedAt:L}=qe(e&&I,M),fe=(se?.results.length??0)>0,pe=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!e){pe.current=null;return}!I||M==null||pe.current!==M&&(pe.current=M,l.invalidateQueries({queryKey:de({path:{assistant_id:M}})}))},[e,I,M,l]);let R=!le&&(b!=null&&ue>=b||b!=null&&!!ce&&L>=b),[me,z]=(0,K.useState)(!1),he=P&&(!I||R);(0,K.useEffect)(()=>{if(!e){z(!1);return}he&&z(!0)},[e,he]);let ge=(0,K.useCallback)(()=>{let e=c?N===!0&&!fe?`domain`:`complete`:N===!1?`complete`:`domain`;if(Yt()){d(e);return}p(`covering`),m.current.push(setTimeout(()=>{d(e),p(`revealing`),m.current.push(setTimeout(()=>p(`idle`),Jt))},qt))},[N,c,fe]),_e=(0,K.useCallback)(()=>{w(!0)},[]),ve=(0,K.useCallback)(()=>{D.kickProvisioning(),A.info(D.kickError==null?E.backgroundExitToast:E.backgroundRetryToast),w(!1),t()},[D,t,E]),ye=(0,K.useCallback)(()=>{w(!1)},[]),be=u===`provisioning`&&(D.confirmError||D.targetsError),H=u===`provisioning`&&!be,xe=H&&!ee,U=`transition-[background-color] duration-300 ease-out${H?` bg-black p-0`:``}`,Se=H?`[animation:fadeIn_0.45s_ease-out_both]`:f===`revealing`?`[animation:fadeInUp_0.42s_ease-out_0.12s_both]`:`[animation:fadeIn_0.25s_ease-out_both]`;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(C.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,q.jsxs)(C.Content,{size:`md`,hideCloseButton:u!==`complete`,dismissOnOverlayClick:!xe,onEscapeKeyDown:xe?e=>e.preventDefault():void 0,onInteractOutside:xe?e=>e.preventDefault():void 0,"data-theme":H?`dark`:void 0,overlayClassName:U,className:H?`overflow-y-auto inset-0 max-w-none w-screen h-screen max-h-none rounded-none border-0`:`overflow-hidden`,style:{[yt]:ie},children:[(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col motion-reduce:[animation:none] ${Se}`,children:Ce()},u),f!==`idle`&&(0,q.jsx)(`div`,{"aria-hidden":!0,"data-testid":`takeover-exit-sheet`,className:`pointer-events-none fixed inset-0 z-50 ${f===`covering`?`[animation:fadeIn_200ms_ease-in_both]`:`[animation:fadeIn_380ms_ease-out_both_reverse]`}`,style:{backgroundColor:bt},children:F&&(0,q.jsx)(lt,{imageUrl:F,animateIn:!1})})]})}),(0,q.jsx)(ae,{open:S&&k,title:s(`billingOnboardingModal.backgroundConfirmTitle`),message:E.backgroundConfirmMessage,confirmLabel:s(`billingOnboardingModal.backgroundConfirmContinue`),cancelLabel:s(`billingOnboardingModal.backgroundConfirmKeepWaiting`),onConfirm:ve,onCancel:ye})]});function Ce(){return u===`provisioning`?D.confirmError||D.targetsError?(0,q.jsx)(at,{onGoToBilling:t,direction:T}):(0,q.jsx)(Bt,{state:D.state,direction:T,softWaiting:D.softWaiting,intent:h,creditsChange:c?o?.credits:void 0,targets:j??Qt,fromSnapshot:re,machineFloor:D.machineFloor,landed:D.landed,celebrating:me,onCelebrationEnd:ge,assistantId:M,escapeAvailable:k&&D.escapeEligible,onEscape:_e,onPhaseChange:y,kickError:D.kickError,confirm:{onRetry:D.retryConfirm,onGoToBilling:t},dwellMs:r,phaseMinMs:i}):u===`domain`?(0,q.jsx)(it,{machineBusy:k,assistantId:M,onExit:()=>d(`complete`)}):(0,q.jsx)(Ke,{assistantId:M,direction:T})}}function en(e){return e!=null&&!e.customized}function tn(e){return en(e)?e.name:`Custom`}var nn=[`mighty`,`super`,`ultra`],rn=[`free`,...nn];function an(e){return rn.indexOf(e)}function on(e,t){if(e===null)return`upgrade`;let n=an(e),r=an(t);return n===-1||r===-1?`upgrade`:r===n?`current`:r<n?`downgrade`:`upgrade`}function sn(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>nn.indexOf(e.key)-nn.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 cn=[`too_expensive`,`missing_features`,`switched_service`,`unused`,`too_complex`,`low_quality`,`customer_service`,`other`],ln={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`},un=1e3,dn={feedback:null,comment:``};function fn(e){return e.feedback!=null}function pn(e){let t=e.feedback===`other`?e.comment.trim():``;return{feedback:e.feedback,comment:t||null}}function mn({value:e,onChange:t,disabled:n}){let{t:r}=V(`settings`);return(0,q.jsxs)(`div`,{className:`mt-5 space-y-3`,"data-testid":`cancel-reason-survey`,children:[(0,q.jsx)(o,{as:`p`,variant:`body-medium-default`,children:r(`cancelReasonSurvey.title`)}),(0,q.jsx)(se,{value:e.feedback??``,onValueChange:n=>t({...e,feedback:n===``?null:n}),name:`cancel-reason`,disabled:n,"aria-label":r(`cancelReasonSurvey.title`),children:cn.map(e=>(0,q.jsx)(M,{value:e,label:r(ln[e])},e))}),e.feedback===`other`?(0,q.jsx)(P,{label:r(`cancelReasonSurvey.otherLabel`),placeholder:r(`cancelReasonSurvey.otherPlaceholder`),value:e.comment,onChange:n=>t({...e,comment:n.target.value}),maxLength:un,rows:3,disabled:n,fullWidth:!0,"data-testid":`cancel-reason-comment`}):null]})}var hn={free:{bodyShape:`ninja`,eyeStyle:`angry`,color:`yellow`},mighty:{bodyShape:`blob`,eyeStyle:`grumpy`,color:`green`},super:{bodyShape:`urchin`,eyeStyle:`goofy`,color:`teal`},ultra:{bodyShape:`sprout`,eyeStyle:`curious`,color:`orange`}};function gn({tier:e,size:t=40}){let n=hn[e]??hn.free,r=T();return(0,q.jsx)(`div`,{"aria-hidden":!0,className:`inline-flex shrink-0`,children:r?(0,q.jsx)(b,{components:r,bodyShapeId:n.bodyShape,colorId:n.color,size:t}):(0,q.jsx)(`div`,{style:{width:t,height:t}})})}var _n={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 vn(e){return _n[e]}function yn(e){return`Downgrade to ${e}`}function bn(e){let t=e/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function xn(e){return`${bn(e)}/mo`}function Sn(e){return`${bn(e)}/month`}function Cn(e){return`${e>0?`+`:`−`}${bn(Math.abs(e))}/mo`}function wn(e){return`${e} GB storage`}function Tn(e){return`${bn(e*100)} of bundled credits`}var En=`Small`;function Dn(e){return e?.machine_size?G[e.machine_size]??e.machine_size:En}function On(e,t){let n=vn(e.key)?.extraFeatures??[];return[{icon:ze,label:`${Dn(e)} Machine`},{icon:De,label:`${e.storage_gib} GB Storage`},{icon:Ee,label:t},...n.map(e=>({icon:Se,label:e}))]}function kn(){return[{icon:ze,label:`${En} Machine`},{icon:De,label:`4 GB Storage`},{icon:Ee,label:`Pay as you go credits`}]}function An(e,t=[]){let n=e?.credits_usd??0,r=e?.storage_gib??4,i=Me[e?.machine_size??`small`];return[`${Dn(e)} machine${i?` (${i})`:``}`,wn(r),e?.usage_label??Tn(n),...t]}var jn={machine:`Configurable machine size`,storage:`Configurable storage`,credits:`Pay-as-you-go and bundled credits`};function Mn(e,t){let n=[`${e.machineTier?je[e.machineTier]??t.machine_tiers.find(t=>t.tier===e.machineTier)?.label??e.machineTier:En} Machine`];if(e.storageGib!=null&&n.push(`${e.storageGib} GB`),e.creditTier!=null){let r=ut(t,e.creditTier)?.label,i=dt(e.creditTier);n.push(r??(i==null?`Credit bundle`:`${i} credits/mo`))}return n}function Nn(e,t){let n=new Set([jn.machine]);return e.storageGib!=null&&n.add(jn.storage),e.creditTier!=null&&n.add(jn.credits),[...Mn(e,t),...t.included_features.filter(e=>!n.has(e))]}function Pn(e){return e.disabled===!0}function Fn({machineTiers:e,storageTiers:t,selectedMachineTier:n,selectedStorageTier:r,onMachineTierChange:i,onStorageTierChange:a,currentMachinePriceCents:s,currentStoragePriceCents:c}){let{t:l}=V(`settings`),u=(0,K.useMemo)(()=>e.map(e=>{let t=je[e.tier]??e.label,n=s==null?l(`tierPicker.priceAddon`,{price:xn(e.price_cents)}):e.price_cents===s?l(`tierPicker.priceCurrent`,{price:xn(e.price_cents)}):Cn(e.price_cents-s);return{value:e.tier,label:l(`tierPicker.machineOption`,{label:t,priceLabel:n}),disabled:Pn(e)}}),[e,s,l]),d=(0,K.useMemo)(()=>t.map(e=>{let t=c==null?l(`tierPicker.priceAddon`,{price:xn(e.price_cents)}):e.price_cents===c?l(`tierPicker.priceCurrent`,{price:xn(e.price_cents)}):Cn(e.price_cents-c);return{value:e.tier,label:l(`tierPicker.storageOption`,{gib:e.storage_gib,priceLabel:t}),disabled:Pn(e)}}),[t,c,l]);return(0,q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(o,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:l(`tierPicker.machineLabel`)}),(0,q.jsx)(`span`,{title:l(`tierPicker.machineTooltip`),children:(0,q.jsx)(W,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,q.jsx)(I,{"aria-label":l(`tierPicker.machineAriaLabel`),placeholder:l(`tierPicker.machinePlaceholder`),value:n??``,onChange:i,options:u})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(o,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:l(`tierPicker.storageLabel`)}),(0,q.jsx)(`span`,{title:l(`tierPicker.storageTooltip`),children:(0,q.jsx)(W,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,q.jsx)(I,{"aria-label":l(`tierPicker.storageAriaLabel`),placeholder:l(`tierPicker.storagePlaceholder`),value:r??``,onChange:a,options:d})]})]})}var In=new Set([`active`,`trialing`,`past_due`]);function Ln(e){return e.plan_id!==`base`&&e.cancel_at_period_end!==!0&&!e.cancel_at&&e.status!=null&&In.has(e.status)}function Rn(e){return e?.status!=null&&In.has(e.status)}var zn=[`target_plan_id`,`confirm`,`machine_tier`,`storage_tier`,`credit_tier`,`package`,`non_field_errors`];function Bn(e,t){if(e&&typeof e==`object`){for(let t of zn)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 Vn(e,t){let n=e.filter(e=>!Pn(e));return t!==null&&n.some(e=>e.tier===t)?t:n[0]?.tier??null}function Hn(e,t,n){return t===void 0?n:t!==null&&(t===n||e.some(e=>e.tier===t))?t:null}function Un(e){return e.length?Math.min(...e.map(e=>e.price_cents)):0}function Wn(){let e=B();return async t=>{try{let n=await t.mutateAsync();return await e.invalidateQueries({queryKey:fe()}),t.onSuccess(n),n}catch(e){return A.error(Bn(e,t.errorFallback()),{id:t.errorToastId}),null}}}var Gn=`billing-portal-return-snapshot`;function Kn(e){try{sessionStorage.removeItem(Gn),sessionStorage.setItem(Gn,JSON.stringify(e))}catch{}}function qn(){if(typeof sessionStorage>`u`)return null;try{let e=sessionStorage.getItem(Gn);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 Jn(){try{sessionStorage.removeItem(Gn)}catch{}}function Yn(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 Xn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function Zn(e){return e?e.cancel_at??e.current_period_end??null:null}function Qn(e){let t=B();return(0,K.useEffect)(()=>f(()=>{t.invalidateQueries(ue())}),[t]),h({onSuccess:t=>{e&&Kn(e),l(t.portal_url)},onError:()=>{A.error(R(`settings:useBillingPortalSession.openError`),{id:`billing-portal-session-error`})}})}function $n(){let e=g(),t=Wn();return{cancelSubscription:n=>t({mutateAsync:()=>e.mutateAsync({body:n}),onSuccess:e=>{let t=e.cancel_at?Xn(e.cancel_at):R(`settings:useCancelSubscription.endOfBillingPeriod`);A.info(R(`settings:useCancelSubscription.canceledToast`,{date:t}),{id:`subscription-cancel`})},errorToastId:`subscription-cancel-error`,errorFallback:()=>R(`settings:useCancelSubscription.cancelFailedToast`)}),isPending:e.isPending}}function er(e){return Promise.all([e.invalidateQueries({queryKey:fe()}),e.invalidateQueries({queryKey:D()}),e.invalidateQueries({queryKey:S()}),e.invalidateQueries({queryKey:v()})])}function tr({enabled:e=!0}={}){let n=B(),{t:r}=V(`settings`),[i,a]=(0,K.useState)(null),o=(0,K.useRef)(!1),[s,c]=(0,K.useState)(!1),l=t(),u=e&&l,d=z({...ue(),enabled:u}),f=d.data,p=f!=null&&f.plan_id!==`base`,m=z({...k(),enabled:u&&p}),h=z({...w(),enabled:u&&p}).data?.plans.find(e=>e.id===`pro`)?.machine_tiers??[],g=e=>h.find(t=>t.tier===e)?.price_cents??null,_=me(ie()),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&&In.has(f.status)&&f.cancel_at_period_end!==!0&&!f.cancel_at,b=!p||!m.isPending,x=!p||m.isSuccess&&m.data!=null&&!m.isFetching&&m.dataUpdatedAt>=d.dataUpdatedAt,S=s||_.isPending,C=async(e,t=v)=>{if(o.current)return null;o.current=!0,c(!0);try{return await T(e,t)}finally{o.current=!1,c(!1)}},T=async(e,t)=>{a(null);let i=e=>(a(e),A.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 i(r(`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===t.machineTier?u.machineTier:e.machineTier,storageTier:e.storageTier===t.storageTier&&u.storageTier!=null?u.storageTier:e.storageTier,creditTier:e.creditTier===t.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 i(Bn(e,r(`customPlanModal.changeFailed`)))}return await er(n),C===`no_op`?{needsResize:!1,creditChanged:!1}:{needsResize:h||p&&!S,creditChanged:v}};return{changeTiers:C,isPending:S,error:i,current:v,eligible:y,currentReady:b,currentKnown:x,primaryAssistantId:x?m.data?.primary_assistant_id??null:null}}function nr(){let e=B(),{t}=V(`settings`),n=me(ie());return{changePackage:async r=>{try{let t=await n.mutateAsync({body:{package:r}});return await er(e),t}catch(e){return A.error(Bn(e,t(`customPlanModal.changeFailed`))),null}},isPending:n.isPending}}function rr({className:e,"data-testid":t,children:n}){return(0,q.jsx)(`div`,{"aria-hidden":!0,"data-testid":t,className:N(`flex size-[52px] shrink-0 items-center justify-center rounded-xl`,e),children:n})}var ir=32;function ar(){let{ready:e,avatar:t}=_t();return(0,q.jsx)(rr,{"data-testid":`assistant-avatar-tile`,className:`bg-[var(--surface-active)]`,children:e?(0,q.jsx)(m,{components:t.components,traits:t.traits,customImageUrl:t.customImageUrl,size:ir}):null})}var or=`Billed monthly · prorated difference charged today`,sr=`Billed monthly · prorated difference charged today or credited next invoice`,cr=`Billed monthly · prorated credit on your next invoice`,lr=`Your machine downsizes now and your storage stays. No refund.`,ur=`Continue`,dr=`The plan includes`,fr=`Your plan will include`;function pr(e,t,n){let r=n?vn(n)?.tagline??``:``;switch(e){case`downgrade`:return{title:yn(t),subtitle:``,priceCaption:cr,checklistHeading:fr,note:lr,confirmLabel:yn(t),destructive:!0};case`switch`:return{title:`Switch to ${t}`,subtitle:r,priceCaption:sr,checklistHeading:dr,note:``,confirmLabel:ur,destructive:!1};default:return{title:`Upgrade to ${t}`,subtitle:r,priceCaption:or,checklistHeading:dr,note:``,confirmLabel:ur,destructive:!1}}}function mr({open:e,relation:t,packageName:n,targetPackage:r,pending:i,onCancel:a,onConfirm:s}){let{t:c}=V(`settings`),l=(0,K.useRef)(null),u=(0,K.useId)(),d=pr(t,n,r?.key??null),f=r?{price:xn(r.total_price_cents),highlights:An(r,vn(r.key)?.extraFeatures??[])}:null,m=d.subtitle,h=d.note?{"aria-describedby":u}:m?{}:{"aria-describedby":void 0};return(0,q.jsx)(C.Root,{open:e,onOpenChange:e=>{!e&&!i&&a()},children:(0,q.jsxs)(C.Content,{size:`sm`,hideCloseButton:!0,className:`gap-4 p-4 max-w-[421px]`,onOpenAutoFocus:e=>{e.preventDefault(),l.current?.focus()},...h,children:[(0,q.jsxs)(C.Header,{className:`flex-row items-center gap-3 p-0 pb-2`,children:[d.destructive?(0,q.jsx)(rr,{"data-testid":`package-switch-warning-tile`,className:`bg-[var(--system-negative-weak)]`,children:(0,q.jsx)(be,{className:`size-6 text-[var(--system-negative-strong)]`})}):(0,q.jsx)(ar,{}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,q.jsx)(C.Title,{className:`text-title-small text-[var(--content-emphasised)] [&>span]:whitespace-normal`,children:d.title}),m?(0,q.jsx)(C.Description,{className:`mt-0 text-body-medium-default text-[var(--content-tertiary)]`,children:m}):null]})]}),f?(0,q.jsxs)(C.Body,{className:`flex flex-col gap-4 p-0`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,q.jsx)(o,{as:`p`,variant:`title-large`,className:`text-[var(--content-default)]`,children:f.price}),(0,q.jsx)(o,{as:`p`,variant:`label-medium-default`,className:`leading-[15px] text-[var(--content-tertiary)]`,children:d.priceCaption})]}),(0,q.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,q.jsx)(o,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,children:d.checklistHeading}),(0,q.jsx)(`ul`,{className:`flex flex-col gap-2`,children:f.highlights.map(e=>(0,q.jsxs)(`li`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(Oe,{className:`size-4 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,q.jsx)(o,{as:`span`,variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]},e))})]}):null,d.note?(0,q.jsx)(o,{id:u,as:`p`,variant:`body-medium-default`,className:`text-[var(--content-secondary)]`,children:d.note}):null,(0,q.jsxs)(C.Footer,{className:`flex-col gap-4 p-0`,children:[(0,q.jsx)(p,{fullWidth:!0,variant:d.destructive?`danger`:`primary`,onClick:s,disabled:i,"data-testid":`confirm-package-switch-button`,children:d.confirmLabel}),(0,q.jsx)(p,{ref:l,fullWidth:!0,variant:`ghost`,onClick:a,disabled:i,children:c(`packageSwitchConfirmModal.cancel`)})]})]})})}function hr(){let e=B();(0,K.useEffect)(()=>f(()=>{er(e)}),[e])}export{xn as A,en as B,Nn as C,On as D,Dn as E,mn as F,qe as G,tn as H,dn as I,Ge as K,fn as L,wn as M,vn as N,Cn as O,gn as P,pn as R,Pn as S,kn as T,on as U,sn as V,$t as W,Ln as _,er as a,Vn as b,Jn as c,qn as d,Qn as f,Rn as g,Bn as h,tr as i,Sn as j,bn as k,Xn as l,In as m,mr as n,$n as o,Wn as p,ze as q,nr as r,Yn as s,hr as t,Zn as u,Un as v,Mn as w,Fn as x,Hn as y,nn as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{da as t,fa as n,ga as r,la as i,vi as a}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{da as t,fa as n,ga as r,la as i,vi as a}from"./app-BBUxTj9g.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=i.use.registerBackOwner(),y=i.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 ${r}`,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 ${r}`,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)};n({enabled:u,onConfirm:()=>{a(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,i=()=>{n||(n=!0,t.removeEventListener(`transitionend`,i),l(t))};t.style.transition=`transform 200ms ${r}, opacity 200ms ${r}`,t.style.transform=``,t.style.opacity=``,t.addEventListener(`transitionend`,i,{once:!0});let a=setTimeout(i,250);return()=>{clearTimeout(a),t.removeEventListener(`transitionend`,i),l(t)}},[d,e])}export{u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Gi as t,Ui as n,Wi as r,xh as i}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Gi as t,Ui as n,Wi as r,xh as i}from"./app-BBUxTj9g.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(),r(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 n=i()??`macos`,r=u(e,n);if(r===null)return;let o=p(s,l,r,n);if(o!==null){m({key:l,label:o.label});return}t(l,r).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 n=p(s,e,s.find(t=>t.key===e)?.defaultAccelerator??``,i()??`macos`);if(n!==null){d(null),m({key:e,label:n.label});return}g(),t(e,null).then(h)},[s,h,g]),removeHotkey:(0,o.useCallback)(e=>{g(),t(e,``).then(h)},[h,g])}}export{m as t};
|
package/dist/assets/{use-invite-link-dialog-6IXyqacJ.js → use-invite-link-dialog-DNFvVMTr.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Af as t,Am as n,Av as r,B_ as i,CS as a,Df as o,Dm as s,Ex as c,Fd as l,H_ as u,Mf as d,NS as f,Of as p,Om as m,Ox as h,Qd as g,Rh as _,Tx as v,U_ as y,V_ as b,Zd as ee,_ as te,aS as x,b as S,bs as C,iS as w,jf as T,pS as E,pf as D,v as ne,x as re,y as ie,ys as O}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Af as t,Am as n,Av as r,B_ as i,CS as a,Df as o,Dm as s,Ex as c,Fd as l,H_ as u,Mf as d,NS as f,Of as p,Om as m,Ox as h,Qd as g,Rh as _,Tx as v,U_ as y,V_ as b,Zd as ee,_ as te,aS as x,b as S,bs as C,iS as w,jf as T,pS as E,pf as D,v as ne,x as re,y as ie,ys as O}from"./app-BBUxTj9g.js";import{Jn as k,Zn as A,er as j,j as M}from"./vendor-ajttH1pP.js";import{t as N,x as P}from"./react-B9IgSVeK.js";import{Ji as F,Yn as I,li as L,tr as R}from"./icons-C0wyat6T.js";import{t as z}from"./a2a-invite-Ci3O-UuB.js";var B=e(P(),1),V=N(),H=[`no_one`,`guardian_only`,`trusted_contacts`,`any_contact`,`strangers`],U=`trusted_contacts`,W=new Set([`platform`,`a2a`]),G=new Set([`vellum`,`whatsapp`]);function K(e){return G.has(e)}function q(e){return t=>{w.error(t instanceof Error?t.message:e)}}function J(e){return typeof e==`string`&&H.includes(e)}function Y(e){return W.has(e)}function X(e){return(e?.policies??[]).filter(e=>!Y(e.channelType)&&!K(e.channelType)).map(e=>({...e,policy:J(e.policy)?e.policy:`trusted_contacts`}))}async function Z(e,t,n,r){if(Y(t))throw new v(403,`Channel "${t}" is internal and is not user-configurable.`);let{data:i,error:a,response:o}=await l({path:{assistant_id:e,channel_type:t},body:{policy:n,note:r??null},throwOnError:!1});if(c(o,a,`Failed to save channel policy.`),!o.ok)throw new v(o.status,h(a,o,`Failed to save channel policy.`));if(!i?.policy)throw new v(500,`Gateway returned no policy in response.`);return i.policy}var ae=`0.10.0`;function Q(){return _(ae)}function oe(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 se({open:e,assistantId:t,onClose:n}){let{t:i}=M(),{copy:s,copied:c,reset:l}=r({errorMessage:`Couldn't copy the invite link.`}),u=(0,B.useRef)(!1),d=k({...o({path:{assistant_id:t}})}),p=(0,B.useRef)(d.mutate);(0,B.useLayoutEffect)(()=>{p.current=d.mutate});let m=(0,B.useRef)(d.reset);(0,B.useLayoutEffect)(()=>{m.current=d.reset}),(0,B.useEffect)(()=>{e&&!u.current&&p.current({path:{assistant_id:t}}),u.current=e},[e,t]);let h=(0,B.useCallback)(()=>{m.current(),l(),n()},[n,l]),g=d.isSuccess&&d.data.token?z({senderAssistantId:t,token:d.data.token}):``;return(0,V.jsx)(x.Root,{open:e,onOpenChange:e=>{e||h()},children:(0,V.jsxs)(x.Content,{size:`sm`,children:[(0,V.jsx)(x.Header,{children:(0,V.jsx)(x.Title,{children:i(`generateInviteLinkDialog.title`)})}),(0,V.jsx)(x.Body,{children:d.isPending?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[(0,V.jsx)(I,{className:`h-4 w-4 animate-spin`}),i(`generateInviteLinkDialog.creating`)]}):d.isError?(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`p`,{role:`alert`,className:`!m-0 text-body-medium-lighter`,style:{color:`var(--system-negative-strong)`},children:i(`generateInviteLinkDialog.createFailed`)}),(0,V.jsx)(f,{variant:`outlined`,onClick:()=>d.mutate({path:{assistant_id:t}}),children:i(`generateInviteLinkDialog.tryAgain`)})]}):d.isSuccess?(0,V.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,V.jsx)(a,{variant:`body-medium-lighter`,style:{color:`var(--content-secondary)`},children:i(`generateInviteLinkDialog.shareHint`)}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(E,{type:`text`,readOnly:!0,value:g,fullWidth:!0,wrapperClassName:`flex-1`,className:`font-mono`,onFocus:e=>e.currentTarget.select()}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>s(g),"aria-label":i(`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:c?(0,V.jsx)(F,{className:`h-4 w-4`}):(0,V.jsx)(L,{className:`h-4 w-4`})})]}),d.data.expiresAt!=null&&(0,V.jsx)(a,{variant:`body-small-default`,style:{color:`var(--content-tertiary)`},children:oe(d.data.expiresAt)})]}):null}),(0,V.jsx)(x.Footer,{children:(0,V.jsx)(f,{variant:`outlined`,onClick:h,children:i(`generateInviteLinkDialog.done`)})})]})})}function ce({onClick:e}){let{t}=M();return(0,V.jsx)(f,{variant:`outlined`,size:`compact`,leftIcon:(0,V.jsx)(R,{className:`h-3.5 w-3.5`}),onClick:e,children:t(`shareConnectionLinkButton.label`)})}function le(e){let t=j(),n=Q(),r=(0,B.useMemo)(()=>({path:{assistant_id:e}}),[e]),i=(0,B.useMemo)(()=>C(r),[r]),a=A({...O(r),enabled:n,select:X}),o=(0,B.useMemo)(()=>{let e={};for(let t of a.data??[])m(t.channelType)&&(e[t.channelType]=t.policy);return e},[a.data]),s=k({mutationFn:({channelKey:t,policy:n})=>Z(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:i}),onError:q(`Failed to save channel policy`)}),c=(0,B.useCallback)((e,t)=>{s.mutate({channelKey:e,policy:t})},[s]);return n?{policies:o,savingKey:s.isPending?s.variables?.channelKey??null:null,isLoading:a.isPending,isError:a.isError,onChange:c}:{policies:void 0,savingKey:null,isLoading:!1,isError:!1,onChange:void 0}}var ue=`0.11.5-dev.202608242314.38e0513`;function de(){return _(ue)}var fe=`0.11.5-dev.202608252008.65007aa`;function pe(){return _(fe)}var $={slack:b,telegram:u,discord:i,email:void 0,phone:y},me={slack:`useAssistantChannels.setupPrompt.slack`,telegram:`useAssistantChannels.setupPrompt.telegram`,discord:`useAssistantChannels.setupPrompt.discord`,email:`useAssistantChannels.setupPrompt.email`,phone:`useAssistantChannels.setupPrompt.phone`},he={slack:`useAssistantChannels.finishPrompt.slack`,telegram:`useAssistantChannels.finishPrompt.telegram`,discord:`useAssistantChannels.finishPrompt.discord`,email:`useAssistantChannels.finishPrompt.email`,phone:`useAssistantChannels.finishPrompt.phone`},ge=15e3;function _e({assistantId:e,onStartSetupConversation:n}){let{t:r}=M(`common`),i=j(),a=(0,B.useMemo)(()=>({path:{assistant_id:e}}),[e]),o=(0,B.useMemo)(()=>g(a),[a]),s=de(),c=pe(),l=(0,B.useMemo)(()=>ve(s),[s]),u=A({...ee(a),enabled:!!e,refetchInterval:ge,select:e=>e.snapshots}),f=(0,B.useMemo)(()=>ye(u.data??[],l,c),[u.data,l,c]),m=f.some(e=>e.key===`slack`&&e.configured),h=A({...t(a),enabled:m,select:e=>e.threadMode}),_=le(e),v=(0,B.useCallback)(()=>i.invalidateQueries({queryKey:o}),[i,o]),y=k({mutationFn:async t=>{let n=$[t];if(!n)throw Error(`No route clears ${t} credentials.`);await n({path:{assistant_id:e},throwOnError:!0})},onSettled:(t,n,r)=>{v(),r===`slack`&&re(i,e)}}),b=ne({assistantId:e}),x=ie({assistantId:e}),C=A({...p(a),enabled:!!e&&c}),w=S({assistantId:e}),E=te({assistantId:e}),D=k({...d(),onSuccess:()=>{i.invalidateQueries({queryKey:T(a)})}}),O=x.mutate,N=(0,B.useCallback)(e=>{O(e)},[O]),P=b.mutate,F=(0,B.useCallback)(e=>{P(e)},[P]),I=w.mutate,L=(0,B.useCallback)((e,t)=>{I({botToken:e,appToken:t})},[I]),R=D.mutate,z=(0,B.useCallback)(t=>{R({path:{assistant_id:e},body:{threadMode:t}})},[R,e]),V=E.mutateAsync,H=(0,B.useCallback)(async(e,t)=>{await V({accountSid:e,authToken:t})},[V]),U=(0,B.useCallback)((e,t=!1)=>{n&&n(r(t?he[e]:me[e]))},[n,r]),W=y.mutate,G=(0,B.useCallback)(e=>{W(e)},[W]);return{channels:f,pendingChannelKey:y.isPending?y.variables??null:null,slackThreadMode:h.data,slackThreadModePending:D.isPending,channelPolicies:_.policies,policySavingKey:_.savingKey,policiesLoading:_.isLoading,policiesError:_.isError,onChannelPolicyChange:_.onChange,onSetup:n?U:void 0,onDisconnect:G,onSaveTelegramToken:F,telegramSaveStatus:b.status,telegramSaveError:b.error?.message??null,onSaveDiscordToken:N,discordSaveStatus:x.status,discordSaveError:x.error?.message??null,discordInviteUrl:x.data?.data?.inviteUrl??C.data?.inviteUrl,onSaveSlackConfig:L,slackSaveStatus:w.status,slackSaveError:w.error?.message??null,onSlackThreadModeChange:z,onSaveTwilioCredentials:H}}function ve(e){return e?s:s.filter(e=>e!==`discord`)}function ye(e,t,r){let i=new Map;for(let t of e)i.set(t.channel,t);return t.map(e=>{let t=i.get(e);return{key:e,status:be(t),configured:t?.setupStatus===`ready`,canDisconnect:$[e]!==void 0&&(e!==`discord`||r),canManualEntry:n[e].credentialForm!==void 0&&(e!==`discord`||r),health:t?.health,address:t?.channelHandle??void 0}})}function be(e){return e?e.ready?`ready`:e.setupStatus===`not_configured`?`not_configured`:`incomplete`:`not_configured`}function xe(e){let t=j(),[n,r]=(0,B.useState)(!1);return{isOpen:n,open:(0,B.useCallback)(()=>{r(!0)},[]),close:(0,B.useCallback)(()=>{r(!1),t.invalidateQueries({queryKey:D({path:{assistant_id:e}})})},[t,e])}}export{Q as a,q as c,se as i,U as l,_e as n,Z as o,ce as r,X as s,xe as t,H as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Gf as t,Is as n,Kf as r,Np as i,Rh as a,ar as o,av as s,iS as c,iv as l,jp as u,lo as d}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Gf as t,Is as n,Kf as r,Np as i,Rh as a,ar as o,av as s,iS as c,iv as l,jp as u,lo as d}from"./app-BBUxTj9g.js";import{I as f,Zn as p,er as m,j as h}from"./vendor-ajttH1pP.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),c=r??n;(0,v.useEffect)(()=>{s(!1)},[c]);let l=t||(e?`📦`:`🧩`),u=!!c&&!o;return(0,y.jsx)(`span`,{className:d(`flex shrink-0 items-center justify-center`,b[i],a),children:u?(0,y.jsx)(`img`,{src:c,alt:``,"aria-hidden":!0,loading:`lazy`,className:`h-full w-full object-contain`,onError:()=>s(!0)}):l})}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??[])c.warning(t(n===O?`pluginToast.mcpOAuthCredentialsUnchecked`:`pluginToast.cleanupWarning`))}function A(e,t){let{t:r}=h(`intelligence`),i=m(),a=u({onSuccess:(a,o)=>{let s=o.path.name;n(i,e,s),t?.onRemoved?.(s),k(a?.warnings,r)},onError:(e,n)=>{t?.onRemoveError?.(n.path.name)}}),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,r){let{t:a}=h(`intelligence`),o=m(),s=i({onSuccess:()=>{n(o,e,t),r?.onInstalled?.(),r?.announceInstall!==!1&&c.success(a(`pluginToast.installed`,{name:t||a(`pluginToast.pluginFallback`)}))}}),l=A(e,{onRemoved:()=>r?.onRemoved?.()});return{install:()=>{s.mutate({path:{assistant_id:e},body:{name:t}})},installAsync:()=>s.mutateAsync({path:{assistant_id:e},body:{name:t}}),remove:()=>{l.remove(t)},isInstalling:s.isPending,isRemoving:l.isRemoving,isInstallError:s.isError,isRemoveError:l.isRemoveError}}var M=`0.10.5`;function N(){return a(M)}function P(e,t,n,r){let i=N(),{data:a}=p({queryKey:[`pluginIcon`,e,t,r],queryFn:async()=>{let{data:n,error:r}=await l({path:{assistant_id:e,name:t},parseAs:`blob`,throwOnError:!1});if(r||!(n instanceof Blob))throw Error(`Failed to load plugin icon`);return n},enabled:!!(i&&n&&r),staleTime:1/0,retry:!1}),[o,s]=(0,v.useState)(void 0);return(0,v.useEffect)(()=>{if(!a){s(void 0);return}let e=URL.createObjectURL(a);return s(e),()=>{URL.revokeObjectURL(e)}},[a]),o}var F=300*1e3,I=[],L=[],R=`system`;async function z(e,t,n){let r=await s({path:{assistant_id:e},query:{q:void 0,category:t},signal:n,throwOnError:!1});if(r.response?.status===404)return{plugins:[]};if(!r.response?.ok)throw Error(f(`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,n=null,i=!0){let a=n??void 0,s=p({queryKey:t({path:{assistant_id:e},query:{q:void 0,category:a}}),queryFn:({signal:t})=>z(e,a,t),enabled:!!e&&i,staleTime:F}),c=p({...o(e),enabled:!!e&&i&&n!==null}),l=p({...r({path:{assistant_id:e},query:{q:void 0}}),enabled:!!e&&i,staleTime:F}),u=(0,v.useMemo)(()=>{let e=n===null?s.data?.plugins:c.data?.plugins??s.data?.plugins;return new Set((e??I).map(e=>e.name))},[n,c.data?.plugins,s.data?.plugins]),d=(0,v.useMemo)(()=>{let e=s.data?.plugins??I,t=l.data?.matches??L;return T(C(e,(n===null?t:t.filter(e=>(e.category??`system`)===n)).filter(e=>!u.has(e.name))))},[s.data?.plugins,l.data?.matches,n,u]),f=n===null?s.data:c.data,h=B(e,f?.categoryCounts!==void 0),g=B(e,(f?.plugins??I).some(e=>e.enabled!==void 0)),_=m(),y=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(y.current===e||!l.isSuccess)return;let n=f?.plugins;if(!n?.length)return;let r=new Map((l.data?.matches??L).map(e=>[e.name,e.category]));n.some(e=>{let t=r.get(e.name);return t!=null&&t!==`system`&&(e.category??`system`)===`system`})&&(y.current=e,_.invalidateQueries({queryKey:t({path:{assistant_id:e},query:{q:void 0}})}))},[e,l.isSuccess,l.data?.matches,f?.plugins,_]),{items:d,isLoading:s.isLoading,catalogLoading:l.isLoading,isError:s.isError,installedLoaded:s.data!==void 0,isFetching:s.isFetching||l.isFetching,catalogError:l.isError,categorySupported:h,pluginToggleSupported:g,installedCategoryCounts:f?.categoryCounts,installedPlugins:f?.plugins??I,installedTotal:f?.totalCount,catalogMatches:l.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{$s as t,Qs as n,Zp as r,fx as i,gy as a,im as o,nm as s,rc as c}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$s as t,Qs as n,Zp as r,fx as i,gy as a,im as o,nm as s,rc as c}from"./app-BBUxTj9g.js";import{j as l}from"./vendor-ajttH1pP.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=n(e);return(0,_.useEffect)(()=>{t&&c(e)},[t,e]),t?null:(0,h.jsx)(d,{to:e,replace:!0})}function y(){let[e]=u(),n=s(),c=o(),l=r(),d=e.get(`returnTo`),f=a(d,i.assistant);if(!d)return{kind:`proceed`,returnTo:null};if(c)return{kind:`wait`};if(!n)return{kind:`proceed`,returnTo:f};if(t(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{$i as t,NS as n,Qi as r,pa as i,ua as a}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$i as t,NS as n,Qi as r,pa as i,ua as a}from"./app-BBUxTj9g.js";import{j as o}from"./vendor-ajttH1pP.js";import{t as s,x as c}from"./react-B9IgSVeK.js";import{Fn as l,i as u}from"./icons-C0wyat6T.js";var d=e(c(),1),f=s(),p=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function m({open:e,onClose:t,children:r,title:s}){let{t:c}=o(),l=(0,d.useRef)(null),m=(0,d.useRef)(null),h=(0,d.useRef)(t);(0,d.useEffect)(()=>{h.current=t});let{dragOffset:g,isDragging:_,onTouchStart:v,onTouchMove:y,onTouchEnd:b,onTouchCancel:x}=a({enabled:e,onSwipeLeft:t});return i(e),(0,d.useEffect)(()=>{if(!e)return;m.current?.focus();let t=e=>{if(e.key===`Escape`&&!e.defaultPrevented){e.preventDefault(),h.current();return}if(e.key!==`Tab`||!l.current)return;let t=l.current.querySelectorAll(p),n=t[0],r=t[t.length-1];if(!n||!r){e.preventDefault();return}let i=document.activeElement,a=l.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,f.jsxs)(`div`,{ref:l,className:`fixed inset-0`,style:{zIndex:40},role:`dialog`,"aria-modal":`true`,"aria-label":s,children:[(0,f.jsx)(`button`,{type:`button`,"aria-label":c(`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,f.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(${g}px)`,transition:_?`none`:`transform 200ms ease-out`,touchAction:`pan-y`},onTouchStart:v,onTouchMove:y,onTouchEnd:b,onTouchCancel:x,children:[(0,f.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b px-4 py-3`,style:{borderColor:`var(--border-base)`},children:[(0,f.jsx)(`span`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:s}),(0,f.jsx)(n,{ref:m,type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,f.jsx)(u,{"aria-hidden":!0}),onClick:t,"aria-label":c(`sideListDrawer.closeAria`),tintColor:`var(--content-tertiary)`})]}),(0,f.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:r})]})]}):null}function h({onClick:e}){let{t}=o();return(0,f.jsx)(n,{type:`button`,variant:`ghost`,iconOnly:(0,f.jsx)(l,{"aria-hidden":!0}),onClick:e,"aria-label":t(`sideListDrawer.openSidebarAria`),tintColor:`var(--content-secondary)`})}var g=640;function _(){let{ref:e,size:n}=r(),i=n.w<=0,a=t(i),o=(i?a.w:n.w)>=g,[s,c]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{o&&c(!1)},[o]),{paneRef:e,hasRoomForList:o,drawerOpen:s,openDrawer:(0,d.useCallback)(()=>c(!0),[]),closeDrawer:(0,d.useCallback)(()=>c(!1),[])}}export{m as n,h as r,_ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ex as t,Ox as n,Pp as r,SS as i,Tx as a,gS as o,p as s,yv as c}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ex as t,Ox as n,Pp as r,SS as i,Tx as a,gS as o,p as s,yv as c}from"./app-BBUxTj9g.js";import{I as l,Jn as u,er as d,j as f}from"./vendor-ajttH1pP.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}=f(`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:u}=await c({path:{assistant_id:e},body:i?{slug:r,version:i}:{slug:r},throwOnError:!1}),d=l(`installSkill.failureMessage`,{ns:`intelligence`});if(t(u,s,d),!u.ok)throw new a(u.status,n(s,u,d));return o??{ok:!0}}function j(e,{onRemoved:t}={}){let n=d(),[i,a]=(0,S.useState)(null),[o,c]=(0,S.useState)(null),[l,f]=(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=>{f(e)},[]),v=(0,S.useCallback)(()=>{l&&(h.mutate({path:{assistant_id:e,id:l.id}}),f(null))},[e,l,h]),y=(0,S.useCallback)(()=>{f(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-DAyyrFN5.js → use-skill-detail-files-_1GQxDTx.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{fx as t,lo as n,np as r,tp as i}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{fx as t,lo as n,np as r,tp as i}from"./app-BBUxTj9g.js";import{Zn as a,j as o}from"./vendor-ajttH1pP.js";import{n as s,t as c,x as l}from"./react-B9IgSVeK.js";import{Ra as u}from"./icons-C0wyat6T.js";var d=c();function f({skill:e,className:r,onNavigate:i}){let{t:a}=o();return e.origin!==`assistant-memory`||!e.sourceConversationId?null:(0,d.jsxs)(s,{to:t.conversation(e.sourceConversationId),onClick:i,className:n(`inline-flex w-fit items-center gap-1 text-body-small-default text-[var(--content-tertiary)] transition-colors hover:text-[var(--content-secondary)] hover:underline`,r),children:[a(`skillLineageLink.label`),(0,d.jsx)(u,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0})]})}var p=e(l(),1);function m(e,t){return t??e.find(e=>e.name===`SKILL.md`)?.path??null}function h(e,t){let[n,o]=(0,p.useState)(null),s=a({...r({path:{assistant_id:e??``,id:t}}),select:e=>e??null,enabled:!!e}),c=(0,p.useMemo)(()=>s.data?.files??[],[s.data]),l=(0,p.useMemo)(()=>c.find(e=>e.name===`SKILL.md`),[c]),u=m(c,n),d=a({...i({path:{assistant_id:e??``,id:t},query:{path:u??``}}),select:e=>e??null,enabled:!!(e&&u)});return{fileEntries:c,skillMd:l,selectedPath:n,setSelectedPath:o,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{f as n,h as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Lh as e}from"./app-BBUxTj9g.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{Er as t,dm as n}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Er as t,dm as n}from"./app-BBUxTj9g.js";import{x as r}from"./react-B9IgSVeK.js";var i=e(r(),1);function a(e){let r=t();return(0,i.useMemo)(()=>{if(e)return r.find(t=>n(t).includes(e))},[r,e])}export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$m as t,Ao as n,Do as r,Eo as i,Gu as a,Jt as o,NS as s,Oo as c,To as l,Uu as u,Wa as d,Xb as f,Xx as p,Yt as m,Zt as h,aS as g,ac as _,cl as v,dc as y,do as b,dp as x,ef as S,et as C,fS as w,fo as T,fx as E,go as D,ho as O,iS as k,ic as A,it as j,jo as M,kS as ee,ko as N,ll as P,mo as te,nt as F,oS as ne,oc as re,po as ie,px as ae,sS as oe,sc as se,tS as ce,tf as le,tt as ue,w_ as de,wo as fe}from"./app-BfK0IQIk.js";import{Zn as I,er as pe,j as L}from"./vendor-ajttH1pP.js";import{_ as me,n as he,r as R,t as ge,x as _e}from"./react-B9IgSVeK.js";import{La as ve,fr as z}from"./icons-C0wyat6T.js";import{t as B}from"./detail-card-CZVSMSNs.js";import{t as ye}from"./stt-language-picker-modal-MgMG4vnJ.js";import{t as be}from"./use-hotkey-recorder-BA2YaGIX.js";var V=e(_e(),1),H=ge();function U({label:e,selected:t,recording:n=!1,onClick:r}){return(0,H.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,H.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,H.jsx)(`span`,{className:`text-[var(--content-default)]`,children:e})]})}function xe(){let{t:e}=L(`settings`),{available:t,currentCode:n,configuredProviderId:r,selectLanguage:i,selecting:a}=F(C()),[o,c]=(0,V.useState)(!1);return t?(0,H.jsxs)(B,{title:e(`listeningLanguageCard.title`),subtitle:e(`listeningLanguageCard.subtitle`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`span`,{className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`,children:j(n,r)}),(0,H.jsx)(s,{variant:`outlined`,onClick:()=>c(!0),className:`shrink-0`,children:e(`listeningLanguageCard.change`)})]}),(0,H.jsx)(ye,{open:o,onOpenChange:c,title:e(`listeningLanguageCard.title`),currentCode:n,configuredProviderId:r,selectLanguage:i,selecting:a})]}):null}var W=`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}=L(`settings`),n=pe(),r=t(),i=C(),[a,o]=(0,V.useState)(!1),{data:s}=I({...S({path:{assistant_id:i}}),enabled:r,staleTime:3e4}),c=s?.services?.stt,{data:l}=I({...x({path:{assistant_id:i}}),enabled:r,staleTime:5*6e4}),u=c?.roles?.liveVoice?.provider??c?.provider,d=l?.providers?.find(e=>e.id===u),f=d?.modelFamilies?.includes(W)??!1;if(!u||!f)return null;let p=Ce(c?.language,d?.turnDetectionLanguages),m=c?.roles?.liveVoice,h=m?m.model:c?.providers?.[u]?.model,g=h===void 0?Se(u)&&p:h===W,_=async t=>{o(!0);try{let{response:e}=await de({path:{assistant_id:i},body:{services:{stt:{roles:{liveVoice:{provider:u,model:t?W:d?.baseModelFamily}}}}},throwOnError:!1});if(!e?.ok)throw Error(String(e?.status??``));await n.invalidateQueries({queryKey:le({path:{assistant_id:i}})})}catch{k.error(e(`voicePage.turnDetectionFailed`))}finally{o(!1)}};return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e(`voicePage.turnDetectionLabel`)}),(0,H.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(p?`voicePage.turnDetectionDescription`:`voicePage.turnDetectionLanguageUnsupported`)}),(0,H.jsx)(w,{checked:g,disabled:a||!p&&!g,onChange:e=>void _(e),"aria-label":e(`voicePage.turnDetectionLabel`)})]})}var G=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,K=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--system-negative-strong)]`,Te=2;function q(e){let t=[];return e.ctrlKey&&t.push(`control`),e.altKey&&t.push(`option`),e.shiftKey&&t.push(`shift`),e.metaKey&&t.push(`command`),M(t)}function Ee(){let{t:e}=L(`settings`),t=i(),o=b(e=>e.registered)===!1,[c,d]=(0,V.useState)(null),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)([]),[g,_]=(0,V.useState)(!1),v=(0,V.useRef)(null),y=(0,V.useCallback)(async()=>{d((await u())?.inputMonitoring.status??null)},[]);(0,V.useEffect)(()=>{y();let e=setInterval(()=>{y()},2e3);return()=>{clearInterval(e)}},[y]);let x=(0,V.useCallback)(()=>{a(`inputMonitoring`).then(y)},[y]),S=(0,V.useCallback)(e=>{r(e),p(!1),h([]),_(!1),e.kind!==`off`&&x()},[x]),C=(0,V.useCallback)(()=>{p(!0),h([]),_(!1),requestAnimationFrame(()=>{v.current?.focus()})},[]),w=(0,V.useCallback)(()=>{p(!1),h([]),_(!1)},[]),T=(0,V.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){w();return}h(q(e))},[w]),E=(0,V.useCallback)(e=>{if(f&&!(q(e).length>0)){if(m.length>=Te){S({kind:`modifierOnly`,modifiers:m});return}h([]),_(!0)}},[S,m,f]);(0,V.useEffect)(()=>{if(!f)return;let e=e=>{v.current&&!v.current.contains(e.target)&&w()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[w,f]);let D=l(t),O=t.kind===`modifierOnly`&&!D,k=t.kind!==`off`,A=t.kind===`modifierOnly`&&t.modifiers.includes(`control`)&&t.modifiers.includes(`option`),j=c===`granted`;return(0,H.jsx)(B,{title:e(`voiceKeyCard.title`),subtitle:e(`voiceKeyCard.subtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{ref:v,tabIndex:f?0:-1,onKeyDown:f?T:void 0,onKeyUp:f?E:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[(0,H.jsx)(U,{label:e(`voiceKeyCard.fnLabel`),selected:D,onClick:()=>S(fe)}),f?(0,H.jsx)(U,{label:m.length>0?n(m):e(`voiceKeyCard.recordingPrompt`),selected:!0,recording:!0,onClick:w}):(0,H.jsx)(U,{label:t.kind===`modifierOnly`&&!D?n(t.modifiers):e(`voiceKeyCard.customLabel`),selected:O,onClick:C}),(0,H.jsx)(U,{label:e(`voiceKeyCard.offLabel`),selected:!k,onClick:()=>S({kind:`off`})})]}),g&&(0,H.jsxs)(`div`,{className:G,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.customHint`)})]}),k&&c!==null&&!j&&(0,H.jsxs)(`div`,{className:`flex flex-col items-start gap-2 pt-1`,children:[(0,H.jsxs)(`div`,{className:K,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.needsInputMonitoring`)})]}),(0,H.jsx)(s,{variant:`outlined`,onClick:x,children:e(`voiceKeyCard.allowInputMonitoring`)})]}),k&&j&&o&&(0,H.jsxs)(`div`,{className:K,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.refusedNote`)})]}),D&&(0,H.jsxs)(`div`,{className:G,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.fnDictationNote`)})]}),A&&(0,H.jsxs)(`div`,{className:G,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.voiceOverNote`)})]})]})})}function De({assistantId:e,open:t,onOpenChange:n}){return(0,H.jsx)(g.Root,{open:t,onOpenChange:n,children:(0,H.jsx)(g.Content,{size:`md`,children:(0,H.jsx)(Oe,{assistantId:e,onDone:()=>n(!1)})})})}function Oe({assistantId:e,onDone:t}){let{t:n}=L(),{available:r,currentModel:i,selectModel:a,selecting:o}=d(e);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(g.Header,{children:[(0,H.jsx)(g.Title,{children:n(`voicePickerModal.title`)}),r&&(0,H.jsx)(g.Description,{children:`Uses Vellum credits, through providers like ElevenLabs and Deepgram.`})]}),(0,H.jsx)(g.Body,{children:(0,H.jsx)(m,{assistantId:e,filterBySource:!0,value:i,onChange:a,autoScrollToSelected:!0})}),(0,H.jsxs)(g.Footer,{className:`items-center justify-between gap-3`,children:[(0,H.jsx)(ue,{}),(0,H.jsx)(s,{variant:`primary`,onClick:t,disabled:o,className:`shrink-0`,children:n(`voicePickerModal.done`)})]})]})}function ke(){let{t:e}=L(`settings`),t=C(),{available:n,settled:r,voices:i,currentModel:a}=d(t),c=i.find(e=>e.model===a)??i[0],[l,u]=(0,V.useState)(!1),m=f.use.name(),g=m?e(`voicePickerCard.titleWithName`,{name:m}):e(`voicePickerCard.title`);return r?n&&c?(0,H.jsxs)(B,{title:g,subtitle:e(`voicePickerCard.creditsNote`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(o,{description:c.description,className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`}),(0,H.jsx)(s,{variant:`outlined`,onClick:()=>u(!0),className:`shrink-0`,children:e(`voicePickerCard.changeButton`)})]}),(0,H.jsx)(De,{assistantId:t,open:l,onOpenChange:u})]}):(0,H.jsx)(B,{title:g,children:(0,H.jsx)(h,{})}):(0,H.jsx)(B,{title:g,children:(0,H.jsx)(p,{as:`span`,role:`status`,"aria-label":e(`voicePickerCard.loadingAria`),className:`block h-9 w-48`})})}var Ae=[{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.`}],je=`We recommend keeping both off to start. It feels more like a real conversation.`;function Me(){let{t:e}=L();return(0,H.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 Ne({label:e,description:t,showBadge:n,checked:r,onChange:i}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e}),n?(0,H.jsx)(Me,{}):null]}),t?(0,H.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t}):null]}),(0,H.jsx)(w,{checked:r,onChange:i,"aria-label":e})]})}function Pe({showDescription:e=!1,showRecommendedBadge:t=!1}){let{t:n}=L(),r=P.use.showUserTranscript(),i=P.use.showAssistantTranscript(),a=P.use.setShowUserTranscript(),o=P.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,H.jsx)(H.Fragment,{children:Ae.map(n=>{let r=s[n.prefKey];return(0,H.jsx)(Ne,{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 J=`text-body-small-default text-[var(--content-tertiary)]`;function Fe(){let[e]=me(),t=e.get(`tab`);return t===`sounds`?(0,H.jsx)(R,{replace:!0,to:E.settings.sounds}):t===`services`?(0,H.jsx)(R,{replace:!0,to:E.settings.ai}):(0,H.jsx)(Ie,{})}function Ie(){let{t:e}=L(`settings`);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,H.jsxs)(Y,{heading:e(`voicePage.sectionOutputHeading`),description:e(`voicePage.sectionOutputDescription`),children:[(0,H.jsx)(ke,{}),(0,H.jsx)(Le,{})]}),(0,H.jsxs)(Y,{heading:e(`voicePage.sectionInputHeading`),description:e(`voicePage.sectionInputDescription`),children:[(0,H.jsx)(Re,{}),(0,H.jsx)(xe,{}),y()?(0,H.jsx)(Ee,{}):(0,H.jsx)(Ve,{}),(0,H.jsx)(He,{})]}),(0,H.jsx)(Y,{heading:e(`voicePage.sectionCaptionsHeading`),children:(0,H.jsx)(X,{})})]})}function Le(){let{t:e}=L(`settings`),{available:t}=d(C());return t?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:[(0,H.jsx)(z,{className:`h-3.5 w-3.5 shrink-0 text-[var(--content-quiet)]`}),(0,H.jsx)(`span`,{children:e(`voicePage.speechServicesBannerPrompt`)}),(0,H.jsxs)(he,{to:`${E.settings.ai}#text-to-speech`,className:`inline-flex items-center gap-1 text-[var(--content-secondary)] underline decoration-[var(--border-element)] underline-offset-2 hover:text-[var(--content-default)]`,children:[e(`voicePage.speechServicesBannerLink`),(0,H.jsx)(ve,{className:`h-3 w-3`})]})]}):null}function Y({heading:e,description:t,children:n}){return(0,H.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`h2`,{className:`text-label-medium-default uppercase tracking-wide text-[var(--content-tertiary)]`,children:e}),t&&(0,H.jsx)(`p`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:t})]}),n]})}function X(){let{t:e}=L(`settings`);return(0,H.jsx)(B,{title:e(`voicePage.captionsTitle`),subtitle:e(`voicePage.captionsSubtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(Pe,{showDescription:!0}),(0,H.jsx)(`p`,{className:`${J} pt-1`,children:e(`voicePage.captionsRecommendation`,je)})]})})}var Z=``;function Re(){let{t:e}=L(`settings`),[t,n]=(0,V.useState)([]),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(!1),[c,l]=(0,V.useState)(()=>A()),u=(0,V.useCallback)(async()=>{if(!navigator.mediaDevices?.enumerateDevices)return;let e=await _();i(e.needsPermission),n(e.devices),o(e.known)},[]),d=(0,V.useCallback)(async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop()}catch{}u()},[u]);(0,V.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,V.useMemo)(()=>{let n=t.map((t,n)=>({value:t.deviceId,label:t.label||e(`voicePage.microphoneFallbackLabel`,{index:n+1})})),r=c!==Z&&!n.some(e=>e.value===c);return[{value:null,label:e(`voicePage.systemDefault`)},...n,...r?[{value:c,label:e(a?`voicePage.savedMicrophoneNotConnected`:`voicePage.savedMicrophone`)}]:[]]},[t,c,a,e]),p=(0,V.useCallback)(e=>{l(e),re(e)},[]);(0,V.useEffect)(()=>se(()=>{l(A())}),[]);let m=c===Z?null:c;return(0,H.jsx)(B,{title:e(`voicePage.microphoneTitle`),subtitle:e(`voicePage.microphoneSubtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(ce,{options:f,value:m,onChange:p,onSelectNone:()=>p(Z),"aria-label":e(`voicePage.microphoneAriaLabel`)})}),r&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(s,{variant:`outlined`,onClick:d,children:e(`voicePage.allowMicrophoneAccess`)}),(0,H.jsx)(`span`,{className:J,children:e(`voicePage.grantMicrophoneAccessHint`)})]})]})})}var ze=new Set([`Control`,`Alt`,`Shift`,`Meta`]),Q=`toggleVoice`,Be=[{label:`Ctrl+Shift`,activator:{kind:`modifierOnly`,modifiers:[`control`,`shift`]}},{label:`Alt`,activator:{kind:`modifierOnly`,modifiers:[`option`]}}];function Ve(){let{t:e}=L(`settings`),t=ae(),[r,i]=(0,V.useState)(()=>te()),[a,o]=(0,V.useState)(!1),[s,l]=(0,V.useState)([]),[u,d]=(0,V.useState)(!1),f=(0,V.useRef)(null),p=(0,V.useMemo)(()=>{let e=ie();return[{label:c(e),activator:e}]},[]),m=r.kind!==`off`,h=(0,V.useCallback)(e=>{i(e),D(e),o(!1),l([]),d(!1)},[]),g=be({onBound:()=>h({kind:`off`})}),_=g.catalog.find(e=>e.key===Q)?.accelerator??``,v=g.recordingKey===Q,y=O()?Be:[],b=(0,V.useCallback)(e=>{h(e),g.removeHotkey(Q)},[g,h]),x=(0,V.useCallback)(()=>{h({kind:`off`}),g.removeHotkey(Q)},[g,h]),S=(0,V.useCallback)(()=>{o(!0),l([]),d(!1),requestAnimationFrame(()=>{f.current?.focus()})},[]),C=(0,V.useCallback)(()=>{o(!1),l([]),d(!1)},[]),E=(0,V.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},[]),k=(0,V.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){C();return}let t=E(e);if(ze.has(e.key)){d(!1),l(M(t));return}if(t.length===0){d(!0);return}h({kind:`key`,label:e.key.length===1?e.key.toUpperCase():e.key,modifiers:M(t)})},[C,E,h]),A=(0,V.useCallback)(e=>{a&&E(e).length===0&&s.length>0&&(l([]),d(!0))},[E,a,s]);(0,V.useEffect)(()=>{if(!a)return;let e=e=>{f.current&&!f.current.contains(e.target)&&C()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[C,a]);let j=m&&!p.some(e=>N(e.activator,r));return t?(0,H.jsx)(B,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitleDesktop`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[y.map(e=>(0,H.jsx)(U,{label:e.label,selected:N(e.activator,r),onClick:()=>b(e.activator)},e.label)),(0,H.jsx)(U,{label:v?e(`voicePage.recordingPrompt`):_?(0,H.jsx)(ee,{accelerator:_}):e(`voicePage.customKey`),selected:_!==``,recording:v,onClick:v?g.stopRecording:()=>g.startRecording(Q)}),(0,H.jsx)(U,{label:e(`voicePage.offKeyLabel`),selected:r.kind===`off`&&!_&&!v,onClick:x})]}),g.conflict?.key===Q&&(0,H.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voicePage.shortcutConflict`,{command:g.conflict.label})})]})]})}):(0,H.jsx)(B,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(w,{checked:m,onChange:e=>{h(e?T():{kind:`off`})},label:e(`voicePage.enableVoiceShortcut`)}),m&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`span`,{className:J,children:e(`voicePage.activationKeyLabel`)}),(0,H.jsxs)(`div`,{ref:f,tabIndex:a?0:-1,onKeyDown:a?k:void 0,onKeyUp:a?A:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[p.map(e=>(0,H.jsx)(U,{label:e.label,selected:N(e.activator,r),onClick:()=>h(e.activator)},e.label)),a?(0,H.jsx)(U,{label:s.length>0?n(s):e(`voicePage.pressShortcut`),selected:!0,recording:!0,onClick:C}):(0,H.jsx)(U,{label:j?c(r):e(`voicePage.customKey`),selected:j,onClick:S})]}),u&&(0,H.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voicePage.shortcutChordHint`)})]}),m&&(0,H.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voicePage.focusedTabNote`)})]})]})]})})}function He(){let{t:e}=L(`settings`),t=P.use.pauseBeforeReplyMs(),n=P.use.setPauseBeforeReplyMs(),r=P.use.interruptSensitivity(),i=P.use.setInterruptSensitivity(),a=(0,V.useMemo)(()=>[{value:`low`,label:e(`voicePage.interruptSensitivityLow`)},{value:`medium`,label:e(`voicePage.interruptSensitivityMedium`)},{value:`high`,label:e(`voicePage.interruptSensitivityHigh`)}],[e]),o=t!==null||r!==null;return(0,H.jsx)(B,{title:e(`voicePage.turnTakingTitle`),subtitle:e(`voicePage.turnTakingSubtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,H.jsx)(we,{}),(0,H.jsx)($,{label:e(`voicePage.pauseBeforeReplyLabel`),description:e(`voicePage.pauseBeforeReplyDescription`),isDefault:t===null,children:(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(ne,{value:(t??1200)/1e3,onValueChange:e=>{typeof e==`number`&&n(Math.round(e*1e3))},min:500/1e3,max:v/1e3,step:.1,showValue:!0,formatValue:e=>`${(typeof e==`number`?e:e[0]).toFixed(1)}s`,"aria-label":e(`voicePage.pauseBeforeReplyAriaLabel`)})})}),(0,H.jsx)($,{label:e(`voicePage.interruptSensitivityLabel`),description:e(`voicePage.interruptSensitivityDescription`),isDefault:r===null,children:(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(oe,{items:a,value:r??`medium`,onChange:i,ariaLabel:e(`voicePage.interruptSensitivityAriaLabel`)})})}),o&&(0,H.jsx)(`div`,{children:(0,H.jsx)(s,{variant:`outlined`,onClick:()=>{n(null),i(null)},children:e(`voicePage.resetToDefaults`)})})]})})}function $({label:e,description:t,isDefault:n,children:r}){let{t:i}=L(`settings`);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e}),n&&(0,H.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,H.jsx)(`p`,{className:J,children:t}),r]})}export{Fe as VoicePage};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$m as t,Ao as n,Do as r,Eo as i,Gu as a,Jt as o,NS as s,Oo as c,To as l,Uu as u,Wa as d,Xb as f,Xx as p,Yt as m,Zt as h,aS as g,ac as _,cl as v,dc as y,do as b,dp as x,ef as S,et as C,fS as w,fo as T,fx as E,go as D,ho as O,iS as k,ic as A,it as j,jo as M,kS as ee,ko as N,ll as P,mo as te,nt as F,oS as ne,oc as re,po as ie,px as ae,sS as oe,sc as se,tS as ce,tf as le,tt as ue,w_ as de,wo as fe}from"./app-BBUxTj9g.js";import{Zn as I,er as pe,j as L}from"./vendor-ajttH1pP.js";import{_ as me,n as he,r as R,t as ge,x as _e}from"./react-B9IgSVeK.js";import{La as ve,fr as z}from"./icons-C0wyat6T.js";import{t as B}from"./detail-card-BhMBZjzu.js";import{t as ye}from"./stt-language-picker-modal-wNybXxLn.js";import{t as be}from"./use-hotkey-recorder-DHnuMF6T.js";var V=e(_e(),1),H=ge();function U({label:e,selected:t,recording:n=!1,onClick:r}){return(0,H.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,H.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,H.jsx)(`span`,{className:`text-[var(--content-default)]`,children:e})]})}function xe(){let{t:e}=L(`settings`),{available:t,currentCode:n,configuredProviderId:r,selectLanguage:i,selecting:a}=F(C()),[o,c]=(0,V.useState)(!1);return t?(0,H.jsxs)(B,{title:e(`listeningLanguageCard.title`),subtitle:e(`listeningLanguageCard.subtitle`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`span`,{className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`,children:j(n,r)}),(0,H.jsx)(s,{variant:`outlined`,onClick:()=>c(!0),className:`shrink-0`,children:e(`listeningLanguageCard.change`)})]}),(0,H.jsx)(ye,{open:o,onOpenChange:c,title:e(`listeningLanguageCard.title`),currentCode:n,configuredProviderId:r,selectLanguage:i,selecting:a})]}):null}var W=`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}=L(`settings`),n=pe(),r=t(),i=C(),[a,o]=(0,V.useState)(!1),{data:s}=I({...S({path:{assistant_id:i}}),enabled:r,staleTime:3e4}),c=s?.services?.stt,{data:l}=I({...x({path:{assistant_id:i}}),enabled:r,staleTime:5*6e4}),u=c?.roles?.liveVoice?.provider??c?.provider,d=l?.providers?.find(e=>e.id===u),f=d?.modelFamilies?.includes(W)??!1;if(!u||!f)return null;let p=Ce(c?.language,d?.turnDetectionLanguages),m=c?.roles?.liveVoice,h=m?m.model:c?.providers?.[u]?.model,g=h===void 0?Se(u)&&p:h===W,_=async t=>{o(!0);try{let{response:e}=await de({path:{assistant_id:i},body:{services:{stt:{roles:{liveVoice:{provider:u,model:t?W:d?.baseModelFamily}}}}},throwOnError:!1});if(!e?.ok)throw Error(String(e?.status??``));await n.invalidateQueries({queryKey:le({path:{assistant_id:i}})})}catch{k.error(e(`voicePage.turnDetectionFailed`))}finally{o(!1)}};return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e(`voicePage.turnDetectionLabel`)}),(0,H.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(p?`voicePage.turnDetectionDescription`:`voicePage.turnDetectionLanguageUnsupported`)}),(0,H.jsx)(w,{checked:g,disabled:a||!p&&!g,onChange:e=>void _(e),"aria-label":e(`voicePage.turnDetectionLabel`)})]})}var G=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,K=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--system-negative-strong)]`,Te=2;function q(e){let t=[];return e.ctrlKey&&t.push(`control`),e.altKey&&t.push(`option`),e.shiftKey&&t.push(`shift`),e.metaKey&&t.push(`command`),M(t)}function Ee(){let{t:e}=L(`settings`),t=i(),o=b(e=>e.registered)===!1,[c,d]=(0,V.useState)(null),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)([]),[g,_]=(0,V.useState)(!1),v=(0,V.useRef)(null),y=(0,V.useCallback)(async()=>{d((await u())?.inputMonitoring.status??null)},[]);(0,V.useEffect)(()=>{y();let e=setInterval(()=>{y()},2e3);return()=>{clearInterval(e)}},[y]);let x=(0,V.useCallback)(()=>{a(`inputMonitoring`).then(y)},[y]),S=(0,V.useCallback)(e=>{r(e),p(!1),h([]),_(!1),e.kind!==`off`&&x()},[x]),C=(0,V.useCallback)(()=>{p(!0),h([]),_(!1),requestAnimationFrame(()=>{v.current?.focus()})},[]),w=(0,V.useCallback)(()=>{p(!1),h([]),_(!1)},[]),T=(0,V.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){w();return}h(q(e))},[w]),E=(0,V.useCallback)(e=>{if(f&&!(q(e).length>0)){if(m.length>=Te){S({kind:`modifierOnly`,modifiers:m});return}h([]),_(!0)}},[S,m,f]);(0,V.useEffect)(()=>{if(!f)return;let e=e=>{v.current&&!v.current.contains(e.target)&&w()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[w,f]);let D=l(t),O=t.kind===`modifierOnly`&&!D,k=t.kind!==`off`,A=t.kind===`modifierOnly`&&t.modifiers.includes(`control`)&&t.modifiers.includes(`option`),j=c===`granted`;return(0,H.jsx)(B,{title:e(`voiceKeyCard.title`),subtitle:e(`voiceKeyCard.subtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{ref:v,tabIndex:f?0:-1,onKeyDown:f?T:void 0,onKeyUp:f?E:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[(0,H.jsx)(U,{label:e(`voiceKeyCard.fnLabel`),selected:D,onClick:()=>S(fe)}),f?(0,H.jsx)(U,{label:m.length>0?n(m):e(`voiceKeyCard.recordingPrompt`),selected:!0,recording:!0,onClick:w}):(0,H.jsx)(U,{label:t.kind===`modifierOnly`&&!D?n(t.modifiers):e(`voiceKeyCard.customLabel`),selected:O,onClick:C}),(0,H.jsx)(U,{label:e(`voiceKeyCard.offLabel`),selected:!k,onClick:()=>S({kind:`off`})})]}),g&&(0,H.jsxs)(`div`,{className:G,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.customHint`)})]}),k&&c!==null&&!j&&(0,H.jsxs)(`div`,{className:`flex flex-col items-start gap-2 pt-1`,children:[(0,H.jsxs)(`div`,{className:K,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.needsInputMonitoring`)})]}),(0,H.jsx)(s,{variant:`outlined`,onClick:x,children:e(`voiceKeyCard.allowInputMonitoring`)})]}),k&&j&&o&&(0,H.jsxs)(`div`,{className:K,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.refusedNote`)})]}),D&&(0,H.jsxs)(`div`,{className:G,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.fnDictationNote`)})]}),A&&(0,H.jsxs)(`div`,{className:G,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.voiceOverNote`)})]})]})})}function De({assistantId:e,open:t,onOpenChange:n}){return(0,H.jsx)(g.Root,{open:t,onOpenChange:n,children:(0,H.jsx)(g.Content,{size:`md`,children:(0,H.jsx)(Oe,{assistantId:e,onDone:()=>n(!1)})})})}function Oe({assistantId:e,onDone:t}){let{t:n}=L(),{available:r,currentModel:i,selectModel:a,selecting:o}=d(e);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(g.Header,{children:[(0,H.jsx)(g.Title,{children:n(`voicePickerModal.title`)}),r&&(0,H.jsx)(g.Description,{children:`Uses Vellum credits, through providers like ElevenLabs and Deepgram.`})]}),(0,H.jsx)(g.Body,{children:(0,H.jsx)(m,{assistantId:e,filterBySource:!0,value:i,onChange:a,autoScrollToSelected:!0})}),(0,H.jsxs)(g.Footer,{className:`items-center justify-between gap-3`,children:[(0,H.jsx)(ue,{}),(0,H.jsx)(s,{variant:`primary`,onClick:t,disabled:o,className:`shrink-0`,children:n(`voicePickerModal.done`)})]})]})}function ke(){let{t:e}=L(`settings`),t=C(),{available:n,settled:r,voices:i,currentModel:a}=d(t),c=i.find(e=>e.model===a)??i[0],[l,u]=(0,V.useState)(!1),m=f.use.name(),g=m?e(`voicePickerCard.titleWithName`,{name:m}):e(`voicePickerCard.title`);return r?n&&c?(0,H.jsxs)(B,{title:g,subtitle:e(`voicePickerCard.creditsNote`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(o,{description:c.description,className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`}),(0,H.jsx)(s,{variant:`outlined`,onClick:()=>u(!0),className:`shrink-0`,children:e(`voicePickerCard.changeButton`)})]}),(0,H.jsx)(De,{assistantId:t,open:l,onOpenChange:u})]}):(0,H.jsx)(B,{title:g,children:(0,H.jsx)(h,{})}):(0,H.jsx)(B,{title:g,children:(0,H.jsx)(p,{as:`span`,role:`status`,"aria-label":e(`voicePickerCard.loadingAria`),className:`block h-9 w-48`})})}var Ae=[{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.`}],je=`We recommend keeping both off to start. It feels more like a real conversation.`;function Me(){let{t:e}=L();return(0,H.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 Ne({label:e,description:t,showBadge:n,checked:r,onChange:i}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e}),n?(0,H.jsx)(Me,{}):null]}),t?(0,H.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t}):null]}),(0,H.jsx)(w,{checked:r,onChange:i,"aria-label":e})]})}function Pe({showDescription:e=!1,showRecommendedBadge:t=!1}){let{t:n}=L(),r=P.use.showUserTranscript(),i=P.use.showAssistantTranscript(),a=P.use.setShowUserTranscript(),o=P.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,H.jsx)(H.Fragment,{children:Ae.map(n=>{let r=s[n.prefKey];return(0,H.jsx)(Ne,{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 J=`text-body-small-default text-[var(--content-tertiary)]`;function Fe(){let[e]=me(),t=e.get(`tab`);return t===`sounds`?(0,H.jsx)(R,{replace:!0,to:E.settings.sounds}):t===`services`?(0,H.jsx)(R,{replace:!0,to:E.settings.ai}):(0,H.jsx)(Ie,{})}function Ie(){let{t:e}=L(`settings`);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,H.jsxs)(Y,{heading:e(`voicePage.sectionOutputHeading`),description:e(`voicePage.sectionOutputDescription`),children:[(0,H.jsx)(ke,{}),(0,H.jsx)(Le,{})]}),(0,H.jsxs)(Y,{heading:e(`voicePage.sectionInputHeading`),description:e(`voicePage.sectionInputDescription`),children:[(0,H.jsx)(Re,{}),(0,H.jsx)(xe,{}),y()?(0,H.jsx)(Ee,{}):(0,H.jsx)(Ve,{}),(0,H.jsx)(He,{})]}),(0,H.jsx)(Y,{heading:e(`voicePage.sectionCaptionsHeading`),children:(0,H.jsx)(X,{})})]})}function Le(){let{t:e}=L(`settings`),{available:t}=d(C());return t?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:[(0,H.jsx)(z,{className:`h-3.5 w-3.5 shrink-0 text-[var(--content-quiet)]`}),(0,H.jsx)(`span`,{children:e(`voicePage.speechServicesBannerPrompt`)}),(0,H.jsxs)(he,{to:`${E.settings.ai}#text-to-speech`,className:`inline-flex items-center gap-1 text-[var(--content-secondary)] underline decoration-[var(--border-element)] underline-offset-2 hover:text-[var(--content-default)]`,children:[e(`voicePage.speechServicesBannerLink`),(0,H.jsx)(ve,{className:`h-3 w-3`})]})]}):null}function Y({heading:e,description:t,children:n}){return(0,H.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`h2`,{className:`text-label-medium-default uppercase tracking-wide text-[var(--content-tertiary)]`,children:e}),t&&(0,H.jsx)(`p`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:t})]}),n]})}function X(){let{t:e}=L(`settings`);return(0,H.jsx)(B,{title:e(`voicePage.captionsTitle`),subtitle:e(`voicePage.captionsSubtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(Pe,{showDescription:!0}),(0,H.jsx)(`p`,{className:`${J} pt-1`,children:e(`voicePage.captionsRecommendation`,je)})]})})}var Z=``;function Re(){let{t:e}=L(`settings`),[t,n]=(0,V.useState)([]),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(!1),[c,l]=(0,V.useState)(()=>A()),u=(0,V.useCallback)(async()=>{if(!navigator.mediaDevices?.enumerateDevices)return;let e=await _();i(e.needsPermission),n(e.devices),o(e.known)},[]),d=(0,V.useCallback)(async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop()}catch{}u()},[u]);(0,V.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,V.useMemo)(()=>{let n=t.map((t,n)=>({value:t.deviceId,label:t.label||e(`voicePage.microphoneFallbackLabel`,{index:n+1})})),r=c!==Z&&!n.some(e=>e.value===c);return[{value:null,label:e(`voicePage.systemDefault`)},...n,...r?[{value:c,label:e(a?`voicePage.savedMicrophoneNotConnected`:`voicePage.savedMicrophone`)}]:[]]},[t,c,a,e]),p=(0,V.useCallback)(e=>{l(e),re(e)},[]);(0,V.useEffect)(()=>se(()=>{l(A())}),[]);let m=c===Z?null:c;return(0,H.jsx)(B,{title:e(`voicePage.microphoneTitle`),subtitle:e(`voicePage.microphoneSubtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(ce,{options:f,value:m,onChange:p,onSelectNone:()=>p(Z),"aria-label":e(`voicePage.microphoneAriaLabel`)})}),r&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(s,{variant:`outlined`,onClick:d,children:e(`voicePage.allowMicrophoneAccess`)}),(0,H.jsx)(`span`,{className:J,children:e(`voicePage.grantMicrophoneAccessHint`)})]})]})})}var ze=new Set([`Control`,`Alt`,`Shift`,`Meta`]),Q=`toggleVoice`,Be=[{label:`Ctrl+Shift`,activator:{kind:`modifierOnly`,modifiers:[`control`,`shift`]}},{label:`Alt`,activator:{kind:`modifierOnly`,modifiers:[`option`]}}];function Ve(){let{t:e}=L(`settings`),t=ae(),[r,i]=(0,V.useState)(()=>te()),[a,o]=(0,V.useState)(!1),[s,l]=(0,V.useState)([]),[u,d]=(0,V.useState)(!1),f=(0,V.useRef)(null),p=(0,V.useMemo)(()=>{let e=ie();return[{label:c(e),activator:e}]},[]),m=r.kind!==`off`,h=(0,V.useCallback)(e=>{i(e),D(e),o(!1),l([]),d(!1)},[]),g=be({onBound:()=>h({kind:`off`})}),_=g.catalog.find(e=>e.key===Q)?.accelerator??``,v=g.recordingKey===Q,y=O()?Be:[],b=(0,V.useCallback)(e=>{h(e),g.removeHotkey(Q)},[g,h]),x=(0,V.useCallback)(()=>{h({kind:`off`}),g.removeHotkey(Q)},[g,h]),S=(0,V.useCallback)(()=>{o(!0),l([]),d(!1),requestAnimationFrame(()=>{f.current?.focus()})},[]),C=(0,V.useCallback)(()=>{o(!1),l([]),d(!1)},[]),E=(0,V.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},[]),k=(0,V.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){C();return}let t=E(e);if(ze.has(e.key)){d(!1),l(M(t));return}if(t.length===0){d(!0);return}h({kind:`key`,label:e.key.length===1?e.key.toUpperCase():e.key,modifiers:M(t)})},[C,E,h]),A=(0,V.useCallback)(e=>{a&&E(e).length===0&&s.length>0&&(l([]),d(!0))},[E,a,s]);(0,V.useEffect)(()=>{if(!a)return;let e=e=>{f.current&&!f.current.contains(e.target)&&C()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[C,a]);let j=m&&!p.some(e=>N(e.activator,r));return t?(0,H.jsx)(B,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitleDesktop`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[y.map(e=>(0,H.jsx)(U,{label:e.label,selected:N(e.activator,r),onClick:()=>b(e.activator)},e.label)),(0,H.jsx)(U,{label:v?e(`voicePage.recordingPrompt`):_?(0,H.jsx)(ee,{accelerator:_}):e(`voicePage.customKey`),selected:_!==``,recording:v,onClick:v?g.stopRecording:()=>g.startRecording(Q)}),(0,H.jsx)(U,{label:e(`voicePage.offKeyLabel`),selected:r.kind===`off`&&!_&&!v,onClick:x})]}),g.conflict?.key===Q&&(0,H.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voicePage.shortcutConflict`,{command:g.conflict.label})})]})]})}):(0,H.jsx)(B,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(w,{checked:m,onChange:e=>{h(e?T():{kind:`off`})},label:e(`voicePage.enableVoiceShortcut`)}),m&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`span`,{className:J,children:e(`voicePage.activationKeyLabel`)}),(0,H.jsxs)(`div`,{ref:f,tabIndex:a?0:-1,onKeyDown:a?k:void 0,onKeyUp:a?A:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[p.map(e=>(0,H.jsx)(U,{label:e.label,selected:N(e.activator,r),onClick:()=>h(e.activator)},e.label)),a?(0,H.jsx)(U,{label:s.length>0?n(s):e(`voicePage.pressShortcut`),selected:!0,recording:!0,onClick:C}):(0,H.jsx)(U,{label:j?c(r):e(`voicePage.customKey`),selected:j,onClick:S})]}),u&&(0,H.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voicePage.shortcutChordHint`)})]}),m&&(0,H.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voicePage.focusedTabNote`)})]})]})]})})}function He(){let{t:e}=L(`settings`),t=P.use.pauseBeforeReplyMs(),n=P.use.setPauseBeforeReplyMs(),r=P.use.interruptSensitivity(),i=P.use.setInterruptSensitivity(),a=(0,V.useMemo)(()=>[{value:`low`,label:e(`voicePage.interruptSensitivityLow`)},{value:`medium`,label:e(`voicePage.interruptSensitivityMedium`)},{value:`high`,label:e(`voicePage.interruptSensitivityHigh`)}],[e]),o=t!==null||r!==null;return(0,H.jsx)(B,{title:e(`voicePage.turnTakingTitle`),subtitle:e(`voicePage.turnTakingSubtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,H.jsx)(we,{}),(0,H.jsx)($,{label:e(`voicePage.pauseBeforeReplyLabel`),description:e(`voicePage.pauseBeforeReplyDescription`),isDefault:t===null,children:(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(ne,{value:(t??1200)/1e3,onValueChange:e=>{typeof e==`number`&&n(Math.round(e*1e3))},min:500/1e3,max:v/1e3,step:.1,showValue:!0,formatValue:e=>`${(typeof e==`number`?e:e[0]).toFixed(1)}s`,"aria-label":e(`voicePage.pauseBeforeReplyAriaLabel`)})})}),(0,H.jsx)($,{label:e(`voicePage.interruptSensitivityLabel`),description:e(`voicePage.interruptSensitivityDescription`),isDefault:r===null,children:(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(oe,{items:a,value:r??`medium`,onChange:i,ariaLabel:e(`voicePage.interruptSensitivityAriaLabel`)})})}),o&&(0,H.jsx)(`div`,{children:(0,H.jsx)(s,{variant:`outlined`,onClick:()=>{n(null),i(null)},children:e(`voicePage.resetToDefaults`)})})]})})}function $({label:e,description:t,isDefault:n,children:r}){let{t:i}=L(`settings`);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e}),n&&(0,H.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,H.jsx)(`p`,{className:J,children:t}),r]})}export{Fe as VoicePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Tn as e,er as t,wn as n}from"./app-
|
|
1
|
+
import{Tn as e,er as t,wn as n}from"./app-BBUxTj9g.js";import{j as r}from"./vendor-ajttH1pP.js";import{t as i}from"./react-B9IgSVeK.js";import{$ as a}from"./icons-C0wyat6T.js";var o=i();function s({payload:n,onClose:i}){let{t:s}=r(`chat`),u=e(n.body);return(0,o.jsx)(t,{Glyph:a,title:n.title||s(`wakeDetailPanel.title`),closeLabel:s(`wakeDetailPanel.close`),closeTooltip:s(`wakeDetailPanel.close`),closeVariant:`outlined`,onClose:i,children:(0,o.jsxs)(`dl`,{className:`flex flex-col gap-6`,children:[u.workflow&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.workflow`),children:u.workflow}),u.runStatus&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.runStatus`),children:(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:u.runStatus})}),u.result&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.result`),children:(0,o.jsx)(c,{result:u.result})}),u.rest&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.details`),children:(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:u.rest})}),n.metadata.length>0&&(0,o.jsx)(`div`,{className:`flex flex-col gap-6`,children:n.metadata.map(e=>(0,o.jsx)(l,{label:e.label,children:e.value},e.label))})]})})}function c({result:e}){let t=n(e);return t?(0,o.jsx)(`div`,{className:`flex flex-col gap-4`,children:t.map((e,t)=>(0,o.jsx)(`div`,{className:t>0?`flex flex-col gap-2 border-t border-[var(--border-hover)] pt-4`:`flex flex-col gap-2`,children:e.map(e=>(0,o.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,o.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e.key}),(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:e.value})]},e.key))},t))}):(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:e})}function l({label:e,children:t}){return(0,o.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`dt`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:e}),(0,o.jsx)(`dd`,{className:`text-body-medium-default text-[var(--content-default)]`,children:t})]})}export{s as WakeDetailPanel};
|
package/dist/assets/{weather-forecast-display-DIwophHB.js → weather-forecast-display-ty6o7LuP.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{en as t,lo as n,nn as r,rn as i,tn as a}from"./app-BfK0IQIk.js";import{j as o}from"./vendor-ajttH1pP.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 n;if(typeof e.location==`string`)n=e.location;else{let t=r(e.location);t&&typeof t.name==`string`&&(n=t.name)}if(!n)return null;let o=r(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=i(o?.condition)??i(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=i(o?.windDirection)??i(o?.wind_direction)??i(e.windDirection)??i(e.wind_direction)??d.direction,m=r(e.units),h=i(m?.temperature)??i(o?.unit)??i(e.unit)??`F`,g=i(m?.speed)??i(e.windUnit)??i(e.wind_unit),_=t(e.hourly).map((e,t)=>({id:i(e.id)??String(t),time:i(e.time)??``,icon:i(e.icon)??i(e.condition)??`cloud.fill`,temp:a(e.tempC)??a(e.temp)??a(e.temperature),tempC:a(e.tempC)})),v=t([e.forecast,e.daily,e.days].find(Array.isArray)).map((e,t)=>({id:i(e.id)??String(t),day:i(e.day)??i(e.date),dayLabel:i(e.dayLabel)??i(e.date),icon:i(e.icon)??i(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:i(e.condition)}));return{location:n,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:r}=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:n(`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:r(`weatherForecastDisplay.fahrenheit`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(!1),className:n(`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:r(`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:r,useFahrenheit:i}){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,r,i),f=M(e,r,i),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 n=(e.lowC!==void 0||e.highC!==void 0)&&r?(t-32)*5/9:t;y=h===m?50:(Math.max(m,Math.min(h,n))-m)/(h-m)*100}return(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:n(`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{en as t,lo as n,nn as r,rn as i,tn as a}from"./app-BBUxTj9g.js";import{j as o}from"./vendor-ajttH1pP.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 n;if(typeof e.location==`string`)n=e.location;else{let t=r(e.location);t&&typeof t.name==`string`&&(n=t.name)}if(!n)return null;let o=r(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=i(o?.condition)??i(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=i(o?.windDirection)??i(o?.wind_direction)??i(e.windDirection)??i(e.wind_direction)??d.direction,m=r(e.units),h=i(m?.temperature)??i(o?.unit)??i(e.unit)??`F`,g=i(m?.speed)??i(e.windUnit)??i(e.wind_unit),_=t(e.hourly).map((e,t)=>({id:i(e.id)??String(t),time:i(e.time)??``,icon:i(e.icon)??i(e.condition)??`cloud.fill`,temp:a(e.tempC)??a(e.temp)??a(e.temperature),tempC:a(e.tempC)})),v=t([e.forecast,e.daily,e.days].find(Array.isArray)).map((e,t)=>({id:i(e.id)??String(t),day:i(e.day)??i(e.date),dayLabel:i(e.dayLabel)??i(e.date),icon:i(e.icon)??i(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:i(e.condition)}));return{location:n,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:r}=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:n(`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:r(`weatherForecastDisplay.fahrenheit`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(!1),className:n(`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:r(`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:r,useFahrenheit:i}){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,r,i),f=M(e,r,i),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 n=(e.lowC!==void 0||e.highC!==void 0)&&r?(t-32)*5/9:t;y=h===m?50:(Math.max(m,Math.min(h,n))-m)/(h-m)*100}return(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:n(`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};
|