@vellumai/web 0.11.1-staging.2 → 0.11.1
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/{access-C97H-xHb.js → access-BJiXpwUJ.js} +1 -1
- package/dist/assets/{account-page-Cflmw8J6.js → account-page-DP2HVinz.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-BZ36-1N5.js → acp-run-detail-panel-C_M19m8P.js} +1 -1
- package/dist/assets/{activity-steps-panel-KMiSlUt3.js → activity-steps-panel-BsmwWzP1.js} +1 -1
- package/dist/assets/{add-credits-modal-Daz6j8gm.js → add-credits-modal-3Rsd1ZeS.js} +1 -1
- package/dist/assets/{ai-page-DPVi-dhB.js → ai-page-B9mJkV_p.js} +1 -1
- package/dist/assets/{app-card-JHbWefmm.js → app-card-DgDV-yMd.js} +1 -1
- package/dist/assets/{assistant-status-panel-CLMAEQ-v.js → assistant-status-panel-Bt_19-BI.js} +1 -1
- package/dist/assets/{auth-store-w_EmIQP7.js → auth-store-BwKMFgpK.js} +1 -1
- package/dist/assets/{background-task-actions-yrapeY1n.js → background-task-actions-DX0pUvY9.js} +1 -1
- package/dist/assets/{background-task-detail-panel-BV9Y227f.js → background-task-detail-panel-DqXuwo9q.js} +1 -1
- package/dist/assets/{billing-page-CmkTn62f.js → billing-page-CED96NEp.js} +1 -1
- package/dist/assets/{bookmarks-page-B2JvSaKf.js → bookmarks-page-Bk04EUIg.js} +1 -1
- package/dist/assets/{browser-CpgSNbEp.js → browser-Bses4IN3.js} +1 -1
- package/dist/assets/{build-state-DDUJ0MId.js → build-state-DPMhQpLB.js} +1 -1
- package/dist/assets/{channels-page-route-DAp7F6ed.js → channels-page-route-BooWFQMp.js} +1 -1
- package/dist/assets/{chat-markdown-message-B3Qo04ug.js → chat-markdown-message-f4cLJfax.js} +1 -1
- package/dist/assets/{checkout-continuation-DRPQwh5V.js → checkout-continuation-CcuqWhhp.js} +1 -1
- package/dist/assets/{checkout-page-B8CJoCWQ.js → checkout-page-BateK-Nf.js} +1 -1
- package/dist/assets/{client-identity-BSG341dO.js → client-identity-bdtPpHZK.js} +1 -1
- package/dist/assets/{command-palette-DH_ybPTY.js → command-palette-B3TVIQUH.js} +1 -1
- package/dist/assets/{command-palette-window-page-KoC7mrpM.js → command-palette-window-page-Bp9WplfA.js} +1 -1
- package/dist/assets/{contacts-page-route-BJBOnSQK.js → contacts-page-route--hTzWT8X.js} +1 -1
- package/dist/assets/{conversation-navigation-tj2ntPAn.js → conversation-navigation-D63NJmBl.js} +1 -1
- package/dist/assets/{conversation-queries-str0jfqv.js → conversation-queries-3taor2DZ.js} +1 -1
- package/dist/assets/{credentials-page-DFm5A_Dj.js → credentials-page-CYBmOQhl.js} +1 -1
- package/dist/assets/{debug-page-6DjAgWtl.js → debug-page-CHuby9yt.js} +1 -1
- package/dist/assets/{developer-page-dHmIDclp.js → developer-page-CUJqTs2_.js} +1 -1
- package/dist/assets/{diagnostics-BE1IgjfV.js → diagnostics-CLHyv7Xw.js} +1 -1
- package/dist/assets/{doctor-handoff-store-ClS6J-b-.js → doctor-handoff-store-DWNbuW3P.js} +1 -1
- package/dist/assets/{document-viewer-page-DJFR9XhM.js → document-viewer-page-_jndOS7P.js} +1 -1
- package/dist/assets/{emails-page-Ro1_IIiv.js → emails-page-Bqr8Buvt.js} +1 -1
- package/dist/assets/{first-run-scope-CZm4WhC7.js → first-run-scope-7wWjJ4Tn.js} +1 -1
- package/dist/assets/{funnel-events-BAmjKdwH.js → funnel-events-RT_kdQHK.js} +1 -1
- package/dist/assets/{general-page-BH3Zl4tV.js → general-page-DoAKoumC.js} +1 -1
- package/dist/assets/{handle-logout-C_CDLqjS.js → handle-logout-BTgnSSUm.js} +1 -1
- package/dist/assets/{haptics-agodX1nl.js → haptics-rJpeBta-.js} +1 -1
- package/dist/assets/{hatching-screen-CziT_eEj.js → hatching-screen-Q59qvj8_.js} +1 -1
- package/dist/assets/{home-page-route-BSHvc0DH.js → home-page-route-TPR5p3LW.js} +1 -1
- package/dist/assets/{hosting-screen-D6gwvyR3.js → hosting-screen-DRrmkmoO.js} +1 -1
- package/dist/assets/{index-D-NVGcvg.js → index-Ch9eoFem.js} +2 -2
- package/dist/assets/{ingest-DiiwFQfV.js → ingest-BbV11WbG.js} +1 -1
- package/dist/assets/{inspect-page-D0xZPslr.js → inspect-page-D_9E5ham.js} +1 -1
- package/dist/assets/{integrations-page-DuKFioaA.js → integrations-page-CnjTLjpf.js} +1 -1
- package/dist/assets/{library-detail-page-BmD8ODsN.js → library-detail-page-CKWN2cc7.js} +1 -1
- package/dist/assets/{library-page-B1_J428q.js → library-page-CuNX2WgS.js} +1 -1
- package/dist/assets/{local-runtime-upgrade-1CLFIVes.js → local-runtime-upgrade-JwVgn034.js} +1 -1
- package/dist/assets/{login-flow-BnCQjNXm.js → login-flow-llpmkEjN.js} +1 -1
- package/dist/assets/login-page-SG4TPVDu.js +1 -0
- package/dist/assets/{logout-page-BguUo424.js → logout-page-CBGk_cSN.js} +1 -1
- package/dist/assets/{logs-layout-BiZ4JakR.js → logs-layout-B4EPBuaC.js} +1 -1
- package/dist/assets/{memory-page-route-DwmCqWRb.js → memory-page-route-C8nIc6Mb.js} +1 -1
- package/dist/assets/{memory-router-playground-page-Bl-5j5de.js → memory-router-playground-page-ftfbkFhf.js} +1 -1
- package/dist/assets/{messages-BsXTJIIe.js → messages-BzNSqJQx.js} +1 -1
- package/dist/assets/{mobile-sidebar-drawer-Cp72bTDC.js → mobile-sidebar-drawer-BnxfQaDB.js} +1 -1
- package/dist/assets/native-anchor-BiuEQHcy.js +1 -0
- package/dist/assets/{native-biometric-CTR2Zi2w.js → native-biometric-B96mgKGP.js} +1 -1
- package/dist/assets/{navigation-resolver-CIICT6n9.js → navigation-resolver-Lxhf-tbn.js} +1 -1
- package/dist/assets/{notifications-page-CD8OVGKw.js → notifications-page-BAYd0t-0.js} +1 -1
- package/dist/assets/{open-workspace-file-DYklNHQ0.js → open-workspace-file-DucrTmt3.js} +2 -2
- package/dist/assets/{pairing-page-_kskNw0h.js → pairing-page-BRPUYbzJ.js} +1 -1
- package/dist/assets/{plans-page-D924rN93.js → plans-page-BxebYucs.js} +1 -1
- package/dist/assets/{platform-detection-BY5uzLL8.js → platform-detection-a_IB3-0w.js} +1 -1
- package/dist/assets/{platform-login-notice-DIS8PWXu.js → platform-login-notice-D-yQLWUo.js} +1 -1
- package/dist/assets/{platform-loopback-page-BTr35x9U.js → platform-loopback-page-DESnWJYO.js} +1 -1
- package/dist/assets/{privacy-page-BGXaPgBR.js → privacy-page-sZhcJ3uB.js} +1 -1
- package/dist/assets/{privacy-screen-znr9P7PH.js → privacy-screen-D2EBZTX8.js} +1 -1
- package/dist/assets/{provider-callback-page-Bn1Tp_ej.js → provider-callback-page-BZlfsT4J.js} +1 -1
- package/dist/assets/{provider-signup-page-C5z8x-YS.js → provider-signup-page-D5mOXHww.js} +1 -1
- package/dist/assets/{research-onboarding-route-DpC0dKBR.js → research-onboarding-route-ZOwRvfGs.js} +1 -1
- package/dist/assets/{retire-confirm-dialog-BFbPH66U.js → retire-confirm-dialog-m6ORm5Pq.js} +1 -1
- package/dist/assets/{review-terms-screen-W08isuCB.js → review-terms-screen-zzdu4AQi.js} +1 -1
- package/dist/assets/{risk-FjW-m05l.js → risk-uPLh5W5z.js} +1 -1
- package/dist/assets/{routes-DOTByxnJ.js → routes-BP00Ewbf.js} +5 -5
- package/dist/assets/{runtime-upgrade-banner-4PNA3XVR.js → runtime-upgrade-banner-yZYtWxoJ.js} +1 -1
- package/dist/assets/{schedules-page-BSr0-mjB.js → schedules-page-BQSGUmn5.js} +1 -1
- package/dist/assets/{select-assistant-screen-DAkhS0wl.js → select-assistant-screen-B5N_TUcG.js} +1 -1
- package/dist/assets/{session-corner-action-CqofVz_i.js → session-corner-action-vhb51vd3.js} +1 -1
- package/dist/assets/{settings-layout-DcuaK8qu.js → settings-layout-BtT0532M.js} +1 -1
- package/dist/assets/{share-feedback-modal-Dy0GRvA9.js → share-feedback-modal-DO6_oaZg.js} +1 -1
- package/dist/assets/{sidebar-tree-DrZXY5Iz.js → sidebar-tree-D6fHs4GK.js} +1 -1
- package/dist/assets/signup-page-DqfStkXZ.js +1 -0
- package/dist/assets/{site-favicon-CA7jaNnH.js → site-favicon-Dh1OTgFr.js} +1 -1
- package/dist/assets/{skill-detail-page-BCPN6NmR.js → skill-detail-page-SvM2JKKY.js} +1 -1
- package/dist/assets/{subagent-detail-panel-jOUXcDnl.js → subagent-detail-panel-jp0r0ZFk.js} +1 -1
- package/dist/assets/{subagent-store-C8qemfgn.js → subagent-store-DyKwOIj_.js} +1 -1
- package/dist/assets/{system-events-page-DEQyyquu.js → system-events-page-Cg0uMSMs.js} +1 -1
- package/dist/assets/{tool-detail-panel-86ruMQAQ.js → tool-detail-panel-CXcjfDGo.js} +1 -1
- package/dist/assets/{transcript-message-body-shared-CT5pk4wz.js → transcript-message-body-shared-woOFNF_q.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-DmStvNCn.js → upgrade-cancel-page-D8is9-gw.js} +1 -1
- package/dist/assets/{upgrade-success-page-jOEtujYa.js → upgrade-success-page-3W1VuHqB.js} +1 -1
- package/dist/assets/{use-checkout-dismiss-refresh-BZXXQef1.js → use-checkout-dismiss-refresh-BkIzNk6B.js} +1 -1
- package/dist/assets/{use-command-palette-sections-DWCppiPf.js → use-command-palette-sections-CAmbyguu.js} +1 -1
- package/dist/assets/{use-edge-swipe-sMxDzAcb.js → use-edge-swipe-Gst62FjL.js} +1 -1
- package/dist/assets/{use-edge-swipe-back-Dbz1hC9g.js → use-edge-swipe-back-D12vbvly.js} +1 -1
- package/dist/assets/{use-ios-app-nudge-DiqQWH5O.js → use-ios-app-nudge-CrBEIZ8w.js} +1 -1
- package/dist/assets/{use-is-org-ready-BbqlQFXw.js → use-is-org-ready-zouQ5CN4.js} +1 -1
- package/dist/assets/{use-onboarding-login-xZhWGmky.js → use-onboarding-login-X8pB53cV.js} +1 -1
- package/dist/assets/{use-platform-assistant-id-BnFEQQeS.js → use-platform-assistant-id-CIoqMsyh.js} +1 -1
- package/dist/assets/{use-platform-gate-D9hR3R0n.js → use-platform-gate-CqEOGZtI.js} +1 -1
- package/dist/assets/use-return-to-short-circuit-B295pgoV.js +1 -0
- package/dist/assets/{use-sticky-profiles-GTUzoFP4.js → use-sticky-profiles-bdq2XW7H.js} +1 -1
- package/dist/assets/{use-subagent-card-data-Cu_-lx6d.js → use-subagent-card-data-B8JTa5rQ.js} +1 -1
- package/dist/assets/{voice-list-BMMz4e4M.js → voice-list-CCLkiF-c.js} +1 -1
- package/dist/assets/{voice-page-4AS-Fm6W.js → voice-page-Bvgm-7L8.js} +1 -1
- package/dist/assets/{welcome-screen-B-88csxO.js → welcome-screen-Cga6YuF9.js} +1 -1
- package/dist/assets/{workspace-page-b8SfI_28.js → workspace-page-BFJO59Ch.js} +1 -1
- package/dist/index.html +43 -43
- package/package.json +1 -1
- package/dist/assets/login-page-BnF7_s7c.js +0 -1
- package/dist/assets/native-anchor-BpfRwc60.js +0 -1
- package/dist/assets/signup-page-B6mmAQJU.js +0 -1
- package/dist/assets/use-return-to-short-circuit-B1mhvgIq.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-Dy5001j6.js";import{u as r}from"./chunk-5KNZJZUH-Bsoom5--.js";import{c as i,g as a,n as o}from"./QueryClientProvider-CMu7CkQU.js";import{t as s}from"./useQuery-Bz-fbQ-m.js";import{t as c}from"./useMutation-CXGTrp4W.js";import{t as l}from"./jsx-runtime-D3ZM-ToX.js";import{t as u}from"./typography-DEI9Ra9z.js";import{t as d}from"./createLucideIcon-CAM1RhH8.js";import{t as f}from"./arrow-right-B-jRJNWP.js";import{t as p}from"./check-sC49_hjU.js";import{t as m}from"./circle-alert-DVCpoZrc.js";import{t as h}from"./circle-check-CjGnAahM.js";import{t as g}from"./coins-Hrmb9tmj.js";import{n as _,t as v}from"./sliders-horizontal-slneqAyY.js";import{t as y}from"./hard-drive-CncrDZ7V.js";import{t as b}from"./info-CYiVdnQV.js";import{t as x}from"./loader-circle-BzJ2kz3F.js";import{t as S}from"./triangle-alert--e3n47gm.js";import{t as C}from"./notice-DCp7WO3L.js";import{t as w}from"./modal-DwsThLGg.js";import{n as T}from"./toast-DR7D7Uma.js";import{t as E}from"./confirm-dialog-DZX6LhLy.js";import{t as D}from"./dropdown-DswWMJhz.js";import{n as O}from"./resolved-assistants-store-8HQDfxZh.js";import{Z as k,d as A,et as j,f as M,l as ee,u as N}from"./auth-store-w_EmIQP7.js";import{C as P,x as te}from"./native-biometric-CTR2Zi2w.js";import{d as F}from"./routes-GmNvdtLW.js";import{n as ne}from"./use-assistant-avatar--4s_vvar.js";import{r as I}from"./use-is-org-ready-BbqlQFXw.js";import{n as L,r as R}from"./browser-CpgSNbEp.js";import{$ as re,C as ie,O as ae,at as oe,c as se,ct as ce,et as le,it as ue,jt as de,l as fe,lt as pe,nt as z,ot as me,r as he,rt as ge,st as _e,tt as ve,ut as B,y as ye}from"./react-query.gen-BVTEjHsw.js";import{t as V}from"./avatar-bundled-components-CTd294ra.js";import{r as be}from"./use-avatar-accent-var-BaftJG7F.js";import{t as H}from"./misc-CAQM4FGM.js";import{n as xe,t as U}from"./avatar-tone-4L7foPzW.js";import{t as Se}from"./chat-avatar-CIF_o6y5.js";import{t as Ce}from"./avatar-renderer-3EVhZ7TB.js";import{n as we}from"./use-bundled-avatar-components-IQw2k8-g.js";import{c as Te,i as Ee,l as De,n as W,r as Oe,t as ke}from"./machine-sizes-D0oAlF9f.js";import{a as Ae,i as je,n as Me,r as Ne,t as Pe}from"./provisioning-targets-CT4slXZJ.js";import{t as Fe}from"./environment-store-Bbx4f6SQ.js";var Ie=d(`computer`,[[`rect`,{width:`14`,height:`8`,x:`5`,y:`2`,rx:`2`,key:`wc9tft`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h2`,key:`rwmk9e`}],[`path`,{d:`M12 18h6`,key:`aqd8w3`}]]),G=e(t(),1),K=l();function Le({icon:e}){return(0,K.jsx)(`span`,{className:`flex h-11 w-11 items-center justify-center rounded-full`,style:{backgroundColor:`color-mix(in oklab, var(--system-negative-strong) 12%, transparent)`},children:(0,K.jsx)(e,{className:`h-5 w-5`,style:{color:`var(--system-negative-strong)`},"aria-hidden":`true`})})}var Re={fontFamily:`var(--font-serif)`,fontSize:`32px`,fontWeight:400,lineHeight:1.2,letterSpacing:`0.64px`};function ze({title:e,subtitle:t}){return(0,K.jsxs)(`header`,{className:`flex flex-col items-center gap-2 pt-12 text-center`,children:[(0,K.jsx)(`h2`,{className:`text-[var(--content-emphasised)]`,style:Re,children:e}),t&&(0,K.jsx)(`p`,{className:`text-[14px] font-normal text-[var(--content-secondary)]`,children:t})]})}var Be=[{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}],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}];function q({variant:e=`full`}){let t=we();return t?(0,K.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`creature-corners`,className:`pointer-events-none absolute inset-0 select-none`,children:(e===`top`?Ve:Be).map((e,n)=>(0,K.jsx)(`span`,{className:`absolute ${e.position}`,style:{rotate:`${e.rotate}deg`},children:(0,K.jsx)(Ce,{components:t,bodyShapeId:e.bodyShape,eyeStyleId:e.eyeStyle,colorId:e.color,size:e.size})},n))}):null}var J={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.`},He={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.`},Ue={upgrade:J,downgrade:He,change:He};function Y(e=`upgrade`){return Ue[e]}function X(e,t=!0){let{data:n}=s({...he(),enabled:t&&e==null}),{data:r}=s({...ae({path:{id:e??``}}),enabled:t&&e!=null});return e==null?n:r}function We({assistantId:e,direction:t}){let i=r(),a=X(e,I())?.name||`your assistant`;return(0,K.jsxs)(`div`,{className:`relative flex min-h-[320px] flex-col items-center justify-center overflow-hidden px-8 pb-16 [animation:onboarding-step-in_350ms_ease-out] motion-reduce:[animation:none]`,children:[(0,K.jsx)(q,{variant:`full`}),(0,K.jsxs)(`div`,{className:`relative flex w-full flex-col items-center`,children:[(0,K.jsx)(ze,{title:`You're all set!`,subtitle:Y(t).completeSubtitle}),(0,K.jsx)(`div`,{className:`mt-10 flex w-full flex-col items-center gap-10`,children:(0,K.jsxs)(n,{variant:`primary`,"data-testid":`onboarding-complete-return`,onClick:()=>{e!=null&&j(e),i(F.assistant,{replace:!0})},children:[`Return to `,a]})})]})]})}function Z(e=!0,t){let n=X(t,e),r=t??n?.id,{data:i,isError:a,isFetching:o,dataUpdatedAt:c,errorUpdatedAt:l}=s({...se({path:{assistant_id:r??``}}),enabled:e&&!!r});return{assistant:n,assistantId:r,domains:i,domainsError:a,domainsFetching:o,domainsUpdatedAt:c,domainsErrorUpdatedAt:l}}var Ge=1e3,Ke=1e4,qe=2500,Je=2e3,Ye=1e4,Xe=[`machine_size`,`subdomain`,`non_field_errors`],Ze={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.`},Qe={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 $e(e,t,n=`upgrade`){if(e&&typeof e==`object`){let t=e;if(typeof t.error==`string`){let e=(n===`upgrade`?void 0:Qe[t.error])??Ze[t.error];if(e)return e}for(let e of Xe){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 et=`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`,tt=`text-[11px] font-medium text-[var(--content-secondary)]`;function nt({onExit:e,machineBusy:t=!1,assistantId:r}){let i=o(),a=Fe.use.emailRootDomain(),{assistant:s,assistantId:l,domains:u}=Z(!0,r),d=u?.results[0],[f,p]=(0,G.useState)(``),[m,h]=(0,G.useState)(`hi`),[g,_]=(0,G.useState)(!1);(0,G.useEffect)(()=>{if(!g){if(d){p(d.subdomain),_(!0);return}!s?.handle||f||(p(s.handle),_(!0))}},[s?.handle,d,g,f]);let[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(!1),S=c(oe()),T=!!d||b,E=S.isPending||b;return(0,G.useEffect)(()=>{if(!b)return;let t=setTimeout(e,800);return()=>clearTimeout(t)},[b,e]),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(w.Body,{className:`animate-[onboarding-step-in_350ms_ease-out] space-y-6 pb-0 motion-reduce:animate-none`,children:[(0,K.jsx)(q,{variant:`top`}),(0,K.jsx)(ze,{title:`Assistant Email`,subtitle:`Set up an email for your assistant.`}),(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`label`,{htmlFor:`onboarding-email-prefix`,className:tt,children:`Prefix`}),(0,K.jsx)(`input`,{id:`onboarding-email-prefix`,value:m,onChange:e=>h(e.target.value.toLowerCase().trim()),disabled:E||T,readOnly:T,placeholder:`hi`,className:`${et} w-24`})]}),(0,K.jsx)(`span`,{className:`flex h-8 items-center text-[var(--content-secondary)]`,children:`@`}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,K.jsx)(`label`,{htmlFor:`onboarding-email-handle`,className:tt,children:`Handle (public)`}),(0,K.jsx)(`input`,{id:`onboarding-email-handle`,value:f,onChange:e=>{p(e.target.value.toLowerCase().trim()),v&&y(null)},disabled:E||T,readOnly:T,autoFocus:!0,placeholder:`my-assistant`,"aria-invalid":!!v,className:`${et} w-full min-w-0`})]}),(0,K.jsxs)(`span`,{className:`flex h-8 shrink-0 items-center text-[14px] text-[var(--content-tertiary)]`,children:[`.`,a]})]}),v&&(0,K.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:v}),T&&(0,K.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`This domain has been set and cannot be changed.`})]}),t&&!T&&(0,K.jsx)(C,{tone:`neutral`,children:`Your assistant is restarting — you can set the domain in a moment.`}),!T&&(0,K.jsx)(C,{tone:`info`,className:`border-transparent bg-[var(--surface-active)]`,children:(0,K.jsx)(`span`,{className:`font-medium text-[var(--content-tertiary)]`,children:`You won't be able to change the handle once set.`})}),b?(0,K.jsx)(C,{tone:`success`,children:`Domain set — redirecting…`}):null]}),(0,K.jsx)(w.Footer,{className:`items-center pt-6`,children:T?(0,K.jsx)(n,{variant:`primary`,"data-testid":`onboarding-domain-continue`,onClick:e,children:`Continue`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(n,{variant:`outlined`,"data-testid":`onboarding-domain-skip`,disabled:E,onClick:()=>{E||S.mutate({body:{skipped:!0}},{onSuccess:e,onError:()=>e()})},children:`Skip`}),(0,K.jsx)(n,{variant:`primary`,"data-testid":`onboarding-domain-set`,disabled:!f||E||t,onClick:()=>{E||t||!f||S.mutate({body:{subdomain:f,...m?{email_username:m}:{}}},{onSuccess:()=>{y(null),x(!0),i.invalidateQueries({queryKey:ye()}),i.invalidateQueries({queryKey:fe({path:{assistant_id:l??``}})}),i.invalidateQueries({queryKey:ce()})},onError:e=>{y($e(e,`Couldn't register that subdomain. Try a different one.`))}})},children:`Next`})]})})]})}function rt({onGoToBilling:e,direction:t}){return(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-6 py-10 text-center`,children:[(0,K.jsx)(Le,{icon:m}),(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(u,{variant:`title-small`,as:`h1`,children:`Couldn't reach billing`}),(0,K.jsx)(u,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:Y(t).fetchErrorBody})]}),(0,K.jsx)(n,{variant:`primary`,"data-testid":`onboarding-go-to-billing`,onClick:e,children:`Go to billing`})]})}function Q(e){let t=e/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function $(e){return`${Q(e)}/mo`}function it(e){return`${e>0?`+`:`−`}${Q(Math.abs(e))}/mo`}function at(e){return`${e} GB storage`}function ot(e){return`${Q(e*100)} of bundled credits`}function st(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:Ee[n.machineSize],to:Ee[r]}):n.machineSize!==t.machineSize&&a.push({key:`machine`,label:`Machine`,from:n.machineSize==null?void 0:Ee[n.machineSize],to:Ee[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:`Credits`,from:i.from,to:i.to}),a}var ct=60,lt=ct*2;function ut({imageUrl:e,animateIn:t=!0}){return(0,K.jsxs)(`div`,{"aria-hidden":!0,"data-testid":`takeover-backdrop`,className:`pointer-events-none absolute inset-0 overflow-hidden${t?` provision-avatar-reveal`:``}`,children:[(0,K.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(${ct}px)`,width:`calc(100% + ${lt*2}px)`,height:`calc(100% + ${lt*2}px)`}}),(0,K.jsx)(`div`,{className:`absolute inset-0 bg-black/55`})]})}function dt(e){let t=e?.match(/^credits_(\d+)$/)?.[1];return t==null?null:Number(t)}function ft(e,t){if(t!=null)return e?.credit_tiers?.find(e=>e.tier===t)}function pt(e){let t=I(),{data:n}=s({...re(),enabled:t&&e});return n?.plans.find(e=>e.id===`pro`)}function mt(e,t){return t==null?0:ft(e,t)?.credits_usd??dt(t)}function ht(e){let t=pt(e!=null);if(e==null||t==null)return null;let n;if(e.kind===`package`){let r=t.packages.find(t=>t.key===e.packageKey);n=r?.credits_usd??ft(t,r?.credit_tier)?.credits_usd}else n=ft(t,e.creditTier)?.credits_usd;return n==null?null:{fromUsd:0,toUsd:n}}function gt(e){let t=pt(e!=null);if(e==null)return null;let n=mt(t,e.fromTier),r=mt(t,e.toTier);return n==null||r==null?null:{fromUsd:n,toUsd:r}}function _t(e){let t=O.use.activeAssistantId(),n=e===void 0?t:e,{components:r,traits:i,customImageUrl:a,isLoading:o}=ne(n),s=(0,G.useMemo)(()=>A(),[M()]),c=s!=null&&N(s)?s:null,l=n!=null&&!o,u=c!=null&&(n==null||n===c.assistantId),d=u&&!(l&&(r!=null||i!=null||a!=null))?c:null,f=d?d.components:r,p=d?d.traits:i,m=d?null:a,h=l||u,g=be(f,p)??(m?null:(f??V).colors?.[0]?.hex??null);return{tintHex:h&&g?xe(g):U,backdropImageUrl:h?m:null,ready:h,avatar:{components:f,traits:p,customImageUrl:m}}}function vt(e,t){let[n,r]=(0,G.useState)(e),i=(0,G.useRef)(0);return(0,G.useEffect)(()=>{i.current=performance.now()},[]),(0,G.useEffect)(()=>{if(t<=0||e===n)return;let a=t-(performance.now()-i.current);if(a<=0){i.current=performance.now(),r(e);return}let o=setTimeout(()=>{i.current=performance.now(),r(e)},a);return()=>clearTimeout(o)},[e,n,t]),t<=0?e:n}var yt=`--takeover-surface`,bt=`var(${yt},${U})`,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,G.useState)(()=>Et(typeof window>`u`?1/0:window.innerHeight));return(0,G.useEffect)(()=>{let e=()=>t(Et(window.innerHeight));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}var Ot={machine:_,storage:y,credits:g},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=we(),o=Dt(),s=t===`working`||t===`settling`;return(0,K.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,K.jsxs)(`div`,{className:`provision-avatar-stage`,children:[(0,K.jsx)(`div`,{"data-testid":`provision-avatar-placeholder`,className:`provision-avatar-placeholder${i?` is-resolved`:``}`}),(0,K.jsx)(`div`,{className:`provision-avatar-layer`,children:(0,K.jsx)(`div`,{className:`provision-avatar-current`,children:(0,K.jsx)(`div`,{className:`provision-avatar-strain`,children:i&&(0,K.jsx)(`div`,{className:`provision-avatar-reveal`,children:(0,K.jsx)(Se,{components:r.components??a,traits:r.traits,customImageUrl:r.customImageUrl,size:o,isAssistantBusy:s})})})})})]}),(0,K.jsx)(`div`,{className:`provision-avatar-shadow`})]})}function Mt({status:e,caption:t}){return(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5`,children:[(0,K.jsx)(`h1`,{className:`text-[var(--content-emphasised)]`,style:Re,children:e}),t&&(0,K.jsx)(u,{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 s=null;return i?s=`Complete`:a&&(s=`Pending`),(0,K.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,K.jsx)(`span`,{className:`hidden h-6 w-6 shrink-0 items-center justify-center min-[420px]:flex`,children:(0,K.jsx)(e,{className:`h-3.5 w-3.5 text-[var(--content-tertiary)]`,"aria-hidden":`true`})}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 text-left wrap-anywhere`,children:[(0,K.jsx)(`span`,{className:`text-[12px] font-medium leading-tight text-[var(--content-tertiary)]`,children:t}),(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-[14px] font-medium leading-[18px] text-[var(--content-emphasised)]`,children:[n&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{children:n}),(0,K.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,K.jsx)(f,{className:`h-3 w-3 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":`true`})]}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{children:r}),i?(0,K.jsx)(p,{"data-testid":`chip-check`,className:`h-3.5 w-3.5 shrink-0 text-[var(--system-positive-strong)]`,"aria-hidden":`true`}):a&&(0,K.jsx)(x,{"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`})]}),s&&(0,K.jsx)(`span`,{className:`sr-only`,children:s})]})]})]})}function Pt({label:e}){return(0,K.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,K.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({intent:e,creditsChange:t,targets:n,fromSnapshot:r,machineFloor:i,landed:a,allDone:o=!1,creditsOnly:s=!1}){let c=ht(e),l=gt(t),u=c??l,d=st({targets:n,fromSnapshot:r,machineFloor:i,credits:u==null?null:{from:$(u.fromUsd*100),to:$(u.toUsd*100)}}),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,G.useState)(p),h=p===m?``:`${p} complete`;return f.length===0?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ft,{testId:`resource-chips`,wide:f.length>=3,children:f.map(e=>{let t=o||It(e.key,a);return(0,K.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,K.jsx)(`p`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`chip-announcement`,children:h})]})}function Rt({intent:e}){if(e.kind===`package`)return(0,K.jsx)(Ft,{children:(0,K.jsx)(Pt,{label:`${e.packageKey.charAt(0).toUpperCase()+e.packageKey.slice(1)} package`})});let t=[e.machineTier,e.storageTier,e.creditTier].filter(e=>e!=null).length;return(0,K.jsxs)(Ft,{wide:t>=3,children:[e.machineTier!=null&&(0,K.jsx)(Nt,{icon:_,label:`Machine`,to:W[e.machineTier]??e.machineTier}),e.storageTier!=null&&(0,K.jsx)(Nt,{icon:y,label:`Storage`,to:e.storageTier.toUpperCase()}),e.creditTier!=null&&(0,K.jsx)(Pt,{label:`${e.creditTier.replace(`credits_`,``)} credits`})]})}function zt({state:e,direction:t,softWaiting:r,intent:i,creditsChange:a,targets:o,fromSnapshot:s,machineFloor:c,landed:l,celebrating:u,onCelebrationEnd:d,assistantId:f,escapeAvailable:p,onEscape:m,onPhaseChange:h,kickError:g,confirm:_,dwellMs:v=qe,phaseMinMs:y=900}){let b=Y(t),x=(0,G.useRef)(d);(0,G.useEffect)(()=>{x.current=d},[d]);let S=vt(e,y),C=S===`DONE`||S===`NOT_APPLICABLE`,w=S===`RESIZING`?`WAITING`:S,T=(0,G.useRef)(h);(0,G.useEffect)(()=>{T.current=h},[h]),(0,G.useEffect)(()=>{T.current?.(S)},[S]);let{tintHex:E,backdropImageUrl:D}=_t(f),O=u&&C;return(0,G.useEffect)(()=>{if(!O)return;let e=setTimeout(()=>x.current(),v);return()=>clearTimeout(e)},[O,v]),(0,K.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]:E,backgroundColor:bt},children:[D&&(0,K.jsx)(ut,{imageUrl:D}),(0,K.jsx)(jt,{assistantId:f,mode:At(S,r),downsizing:t===`downgrade`}),(0,K.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()},w)]});function k(e=`Continue in the background`){return p?(0,K.jsx)(n,{variant:`ghost`,"data-testid":`provisioning-escape`,onClick:m,children:e}):null}function A({allDone:e=!1,creditsOnly:t=!1}={}){return(0,K.jsx)(Lt,{intent:i,creditsChange:a,targets:o,fromSnapshot:s,machineFloor:c,landed:l,allDone:e,creditsOnly:t})}function j(){if(S===`CONFIRMING`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Mt,{status:b.confirmingStatus,caption:`This might take a couple seconds.`}),i&&(0,K.jsx)(Rt,{intent:i}),k()]});if(S===`WAITING`||S===`RESIZING`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Mt,{status:b.waitingStatus,caption:r?`Still working — this can take a minute or two.`:`This might take a couple seconds.`}),A(),k()]});if(S===`DONE`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Mt,{status:`All done!`}),A({allDone:!0})]});if(S===`NOT_APPLICABLE`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Mt,{status:`Your plan is ready`}),A({allDone:!0,creditsOnly:!0})]});if(S===`STALLED`){let e=g!=null;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Mt,{status:e?b.snagStatus:`This is taking longer than expected`,caption:e?$e(g,b.snagCaption,t):`This may take a couple of minutes.`}),A(),e?k(`Retry in the background`):k()]})}return S===`CONFIRM_TIMEOUT`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Mt,{status:b.confirmTimeoutStatus,caption:b.confirmTimeoutCaption}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,K.jsx)(n,{variant:`outlined`,"data-testid":`onboarding-go-to-billing`,onClick:_.onGoToBilling,children:`Go to billing`}),(0,K.jsx)(n,{variant:`primary`,"data-testid":`onboarding-retry`,onClick:_.onRetry,children:`Try again`})]})]}):null}}function Bt(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&&!Ae(n,i);if(Ae(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 Vt=2e3,Ht=1e3,Ut=[`DONE`,`NOT_APPLICABLE`,`CONFIRM_TIMEOUT`],Wt={assistantId:null,machine:null,storage:null};function Gt({open:e,canLowerResources:t=!1,verdictRecheckMs:n=Ye}){let r=o(),l=I(),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(0),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(null),[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(null),[S,C]=(0,G.useState)(null),[w,T]=(0,G.useState)(null),[E,D]=(0,G.useState)(Wt),[O,A]=(0,G.useState)(null),[j,M]=(0,G.useState)(!1),ee=(0,G.useRef)(!1),N=(0,G.useRef)(!1),P=(0,G.useRef)(0),[te,F]=(0,G.useState)(!1),[ne,L]=(0,G.useState)(null),[R,re]=(0,G.useState)(null),[oe,se]=(0,G.useState)(null),[le,ue]=(0,G.useState)(()=>Date.now()),[de,fe]=(0,G.useState)(!0);(0,G.useEffect)(()=>{e||(d(!1),p(0),h(null),_(null),y(null),F(!1),L(null),re(null),se(null),fe(!0),x(null),C(null),T(null),D(Wt),A(null),M(!1),ee.current=!1,N.current=!1,P.current+=1)},[e]),(0,G.useEffect)(()=>{e&&(h(Date.now()),r.invalidateQueries({queryKey:B()}),r.invalidateQueries({queryKey:ce()}))},[e,r]);let z=g!=null,ge=s({...pe(),refetchInterval:e=>e.state.data?.plan_id===`pro`||u?!1:Ge,refetchIntervalInBackground:!1,enabled:e&&l&&!z}),ve=(m!=null&&ge.dataUpdatedAt>=m?ge.data?.plan_id:null)??null;(0,G.useEffect)(()=>{if(!e||z||ve!==`pro`)return;let t=Date.now();_(t),ue(t)},[e,z,ve]),(0,G.useEffect)(()=>{if(!e||z)return;let t=setTimeout(()=>d(!0),Ke);return()=>clearTimeout(t)},[e,z,f]);let ye=(0,G.useCallback)(()=>{d(!1),p(e=>e+1),k.getState().fetchOrganizations(),r.invalidateQueries({queryKey:B()})},[r]),V=(0,G.useCallback)(()=>{let e=Date.now();y(e),ue(e)},[]),{mutate:be}=c(me()),H=(0,G.useCallback)(e=>{let t=P.current;be({},{onSuccess:n=>{t===P.current&&(A(null),Me(n)?N.current?A({error:n.reason??`no_active_pro`}):(N.current=!0,M(!0),e===`escape`&&V()):(x(n.state),e===`escape`&&V()))},onError:e=>{t===P.current&&A(e)}})},[be,V]);(0,G.useEffect)(()=>{!e||!l||!z||ee.current||(ee.current=!0,H(`auto`))},[e,l,z,H]),(0,G.useEffect)(()=>{if(!j)return;let e=P.current,t=setTimeout(()=>{M(!1),e===P.current&&H(`auto`)},Je);return()=>clearTimeout(t)},[j,H]);let xe=(0,G.useCallback)(()=>H(`escape`),[H]),U=s({..._e(),enabled:e&&l&&z}),Se=de?Vt:!1,Ce=s({...he(),enabled:e&&l&&z,refetchInterval:e=>e.state.data?.id==null?Se:!1,retry:!1}),we=z&&m!=null&&U.dataUpdatedAt>=m,Ee=we&&!U.isPending&&!U.isFetching,W=(we?U.data?.primary_assistant_id:null)??(U.isPending?null:Ce.data?.id??null),Oe=s({...ae({path:{id:W??`unresolved`}}),enabled:e&&l&&z&&W!=null,refetchInterval:Se,retry:!1}),Fe=ie({path:{id:W??`unresolved`}}),Ie=s({...Fe,enabled:e&&l&&z&&W!=null,refetchInterval:Se,retry:!1}),K=(0,G.useRef)(0),[Le,Re]=(0,G.useState)(0),ze=a(Fe.queryKey);(0,G.useEffect)(()=>r.getQueryCache().subscribe(t=>{if(!(t.type!==`updated`||t.query.queryHash!==ze)){if(t.action.type===`fetch`)K.current+=1;else if(t.action.type===`success`&&!t.action.manual){let n=K.current,r=e&&Ne(t.action.data);i.schedule(()=>{Re(n),r&&(F(!0),L(W))})}}}),[r,ze,e,W]);let Be=Ne(Ie.data),Ve=ne===W,q=U.data,J=(0,G.useMemo)(()=>q?{machineSize:Te(q.max_machine_tier),storageGib:q.selected_storage_gib??null}:null,[q]),He=q!=null&&q.max_machine_tier==null?ke:null,Ue=q?q.domain_setup_available&&q.primary_assistant_id!=null:void 0,Y=Oe.data,X=(0,G.useMemo)(()=>Y?{machineSize:Y.machine_size??null,storageGib:Y.provisioned_storage_gib??null}:null,[Y]),We=oe===W,Z=(0,G.useMemo)(()=>{let e=Pe(J,X),t=J?.machineSize??He;if(t==null)return e;let n=X?.machineSize??null;if(n==null)return{...e,machine:!1};let r=(We?R?.machineSize:null)??n,i=De(t)<De(r);return{...e,machine:i?De(n)<=De(t):De(n)>=De(t)}},[J,X,R,We,He]),qe=Ae(J,X),Xe=w===W;(0,G.useEffect)(()=>{e&&(qe?(C(e=>e!=null&&Xe?e:Date.now()),T(W)):(C(null),T(null)))},[e,qe,W,Xe]);let Ze=E.assistantId===W;(0,G.useEffect)(()=>{if(!e)return;let t=K.current;D(e=>{let n=e.assistantId===W?e:Wt,r=Z.machine?n.machine??t:null,i=Z.storage?n.storage??t:null;return e.assistantId===W&&e.machine===r&&e.storage===i?e:{assistantId:W,machine:r,storage:i}})},[e,Z,W]);let Qe=(0,G.useMemo)(()=>{let e=je(Ie.data),t=e=>e!=null&&Ze&&Le>e;return{machine:Z.machine&&!e.machine&&t(E.machine),storage:Z.storage&&!e.storage&&t(E.storage)}},[Z,E,Ze,Le,Ie.data]);(0,G.useEffect)(()=>{!e||!X||R!=null&&We||(re(X),se(W))},[e,X,W,R,We]);let $e=v??g,et=$e==null?null:Math.max(0,le-$e),tt=!t,{state:nt,softWaiting:rt}=Bt({planId:z?`pro`:ve,targets:J,actuals:X,initialActuals:We?R:null,resizeOperationInFlight:Be,sawOperation:te&&Ve,msSinceWatchStart:et,confirmExpired:u,serverVerdict:b,statusObservedSinceTargetsMet:S!=null&&Xe&&Ie.dataUpdatedAt>S,targetsProveNoop:tt}),Q=Ut.includes(nt),$=e&&z&&!Q;(0,G.useEffect)(()=>{fe($)},[$]),(0,G.useEffect)(()=>{if(!e||!z||Q)return;let t=setInterval(()=>ue(Date.now()),Ht);return()=>clearInterval(t)},[e,z,Q]);let it=!tt&&(b===`started`||b===`in_progress`)&&!(te&&Ve);return(0,G.useEffect)(()=>{if(!e||!z||Q||!it)return;let t=setInterval(()=>H(`auto`),n);return()=>clearInterval(t)},[e,z,Q,it,n,H]),{state:nt,softWaiting:rt,targets:J,actualsSnapshot:R,machineFloor:He,landed:Qe,assistantId:W,domainStepAvailable:Ue,onboardingSettled:Ee,confirmError:!z&&ge.isError,targetsError:z&&U.isError&&(!q||!we),escapeEligible:et!=null&&et>=6e4,retryConfirm:ye,kickProvisioning:xe,kickError:O}}var Kt=200,qt=380;function Jt(){return typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0}var Yt=e=>e===`WAITING`||e===`RESIZING`||e===`STALLED`,Xt=e=>e===`DONE`||e===`NOT_APPLICABLE`,Zt={machineSize:null,storageGib:null};function Qt({open:e,onClose:t,dwellMs:n,phaseMinMs:r,mode:i=`checkout`,resizeContext:a}){let s=i===`resize`,c=o(),[l,u]=(0,G.useState)(`provisioning`),[d,f]=(0,G.useState)(`idle`),p=(0,G.useRef)([]),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(null),[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(!1),S=s?a?.direction:void 0,C=Y(S),D=Gt({open:e,canLowerResources:s?a?.canLowerResources===!0:!1}),O=(0,G.useRef)(!1);(0,G.useEffect)(()=>{if(e){O.current=!0,h(s?null:P()),y(e=>e??Date.now());return}p.current.forEach(clearTimeout),p.current=[],u(`provisioning`),f(`idle`),_(null),y(null),x(!1),O.current&&(O.current=!1,ee())},[e,s]),(0,G.useEffect)(()=>()=>{p.current.forEach(clearTimeout)},[]),(0,G.useEffect)(()=>{l===`complete`&&te()},[l]);let k=Yt(D.state),A=Xt(g??D.state),{targets:j,assistantId:M,domainStepAvailable:N,onboardingSettled:F}=D,ne=s?a?.fromSnapshot:void 0,I=D.actualsSnapshot,L={machineSize:ne?.machineSize??I?.machineSize??null,storageGib:ne?.storageGib??I?.storageGib??null},{tintHex:R,backdropImageUrl:re}=_t(M),ie=s&&N===!0,{domains:ae,domainsError:oe,domainsFetching:se,domainsUpdatedAt:ce,domainsErrorUpdatedAt:le}=Z(e&&ie,M),ue=(ae?.results.length??0)>0,de=(0,G.useRef)(null);(0,G.useEffect)(()=>{if(!e){de.current=null;return}!ie||M==null||de.current!==M&&(de.current=M,c.invalidateQueries({queryKey:fe({path:{assistant_id:M}})}))},[e,ie,M,c]);let pe=!se&&(v!=null&&ce>=v||v!=null&&!!oe&&le>=v),[z,me]=(0,G.useState)(!1),he=F&&(!ie||pe);(0,G.useEffect)(()=>{if(!e){me(!1);return}he&&me(!0)},[e,he]);let ge=(0,G.useCallback)(()=>{let e=s?N===!0&&!ue?`domain`:`complete`:N===!1?`complete`:`domain`;if(Jt()){u(e);return}f(`covering`),p.current.push(setTimeout(()=>{u(e),f(`revealing`),p.current.push(setTimeout(()=>f(`idle`),qt))},Kt))},[N,s,ue]),_e=(0,G.useCallback)(()=>{x(!0)},[]),ve=(0,G.useCallback)(()=>{D.kickProvisioning(),T.info(D.kickError==null?C.backgroundExitToast:C.backgroundRetryToast),x(!1),t()},[D,t,C]),B=(0,G.useCallback)(()=>{x(!1)},[]),ye=l===`provisioning`&&(D.confirmError||D.targetsError),V=l===`provisioning`&&!ye,be=V&&!A,H=`transition-[background-color] duration-300 ease-out${V?` bg-black p-0`:``}`,xe=V?`[animation:fadeIn_0.45s_ease-out_both]`:d===`revealing`?`[animation:fadeInUp_0.42s_ease-out_0.12s_both]`:`[animation:fadeIn_0.25s_ease-out_both]`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(w.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,K.jsxs)(w.Content,{size:`md`,hideCloseButton:l!==`complete`,dismissOnOverlayClick:!be,onEscapeKeyDown:be?e=>e.preventDefault():void 0,onInteractOutside:be?e=>e.preventDefault():void 0,"data-theme":V?`dark`:void 0,overlayClassName:H,className:V?`overflow-y-auto inset-0 max-w-none w-screen h-screen max-h-none rounded-none border-0`:`overflow-hidden`,style:{[yt]:R},children:[(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col motion-reduce:[animation:none] ${xe}`,children:U()},l),d!==`idle`&&(0,K.jsx)(`div`,{"aria-hidden":!0,"data-testid":`takeover-exit-sheet`,className:`pointer-events-none fixed inset-0 z-50 ${d===`covering`?`[animation:fadeIn_200ms_ease-in_both]`:`[animation:fadeIn_380ms_ease-out_both_reverse]`}`,style:{backgroundColor:bt},children:re&&(0,K.jsx)(ut,{imageUrl:re,animateIn:!1})})]})}),(0,K.jsx)(E,{open:b&&k,title:`Continue in the background?`,message:C.backgroundConfirmMessage,confirmLabel:`Continue`,cancelLabel:`Keep waiting`,onConfirm:ve,onCancel:B})]});function U(){return l===`provisioning`?D.confirmError||D.targetsError?(0,K.jsx)(rt,{onGoToBilling:t,direction:S}):(0,K.jsx)(zt,{state:D.state,direction:S,softWaiting:D.softWaiting,intent:m,creditsChange:s?a?.credits:void 0,targets:j??Zt,fromSnapshot:L,machineFloor:D.machineFloor,landed:D.landed,celebrating:z,onCelebrationEnd:ge,assistantId:M,escapeAvailable:k&&D.escapeEligible,onEscape:_e,onPhaseChange:_,kickError:D.kickError,confirm:{onRetry:D.retryConfirm,onGoToBilling:t},dwellMs:n,phaseMinMs:r}):l===`domain`?(0,K.jsx)(nt,{machineBusy:k,assistantId:M,onExit:()=>u(`complete`)}):(0,K.jsx)(We,{assistantId:M,direction:S})}}function $t(e){return e!=null&&!e.customized}function en(e){return $t(e)?e.name:`Custom`}var tn=[`mighty`,`super`,`ultra`],nn=[`free`,...tn];function rn(e){return nn.indexOf(e)}function an(e,t){if(e===null)return`upgrade`;let n=rn(e),r=rn(t);return n===-1||r===-1?`upgrade`:r===n?`current`:r<n?`downgrade`:`upgrade`}function on(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>tn.indexOf(e.key)-tn.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 sn={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 cn({tier:e,size:t=40}){let n=sn[e]??sn.free,r=we();return(0,K.jsx)(`div`,{"aria-hidden":!0,className:`inline-flex shrink-0`,children:r?(0,K.jsx)(Ce,{components:r,bodyShapeId:n.bodyShape,colorId:n.color,size:t}):(0,K.jsx)(`div`,{style:{width:t,height:t}})})}var ln=`Small`;function un(e){return e?.machine_size?Ee[e.machine_size]??e.machine_size:ln}function dn(e){let t=e?.credits_usd??0,n=e?.storage_gib??4;return[{icon:Ie,label:`${un(e)} Machine`},{icon:g,label:`${Q(t*100)} credits`},{icon:y,label:`${n} GB`}]}function fn(e,t=[]){let n=e?.credits_usd??0,r=e?.storage_gib??4,i=Oe[e?.machine_size??`small`];return[`${un(e)} machine${i?` (${i})`:``}`,at(r),ot(n),...t]}var pn={machine:`Configurable machine size`,storage:`Configurable storage`,credits:`Pay-as-you-go and bundled credits`};function mn(e,t){let n=[`${e.machineTier?W[e.machineTier]??t.machine_tiers.find(t=>t.tier===e.machineTier)?.label??e.machineTier:ln} Machine`];if(e.storageGib!=null&&n.push(`${e.storageGib} GB`),e.creditTier!=null){let r=ft(t,e.creditTier)?.credits_usd??dt(e.creditTier);n.push(r==null?`Credit bundle`:`${r} credits/mo`)}return n}function hn(e,t){let n=new Set([pn.machine]);return e.storageGib!=null&&n.add(pn.storage),e.creditTier!=null&&n.add(pn.credits),[...mn(e,t),...t.included_features.filter(e=>!n.has(e))]}var gn=`billing-portal-return-snapshot`;function _n(e){try{sessionStorage.removeItem(gn),sessionStorage.setItem(gn,JSON.stringify(e))}catch{}}function vn(){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 yn(){try{sessionStorage.removeItem(gn)}catch{}}function bn(e){return e?{cancel_at_period_end:e.cancel_at_period_end,cancel_at:e.cancel_at??null,plan_id:e.plan_id}:null}function xn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function Sn(e){return e?e.cancel_at??e.current_period_end??null:null}function Cn(e){let t=o();return(0,G.useEffect)(()=>R(()=>{t.invalidateQueries(pe())}),[t]),de({onSuccess:t=>{e&&_n(e),L(t.portal_url)},onError:()=>{T.error(`Couldn't open the billing portal. Please try again.`,{id:`billing-portal-session-error`})}})}function wn(e){return e.disabled===!0}function Tn({machineTiers:e,storageTiers:t,selectedMachineTier:n,selectedStorageTier:r,onMachineTierChange:i,onStorageTierChange:a,currentMachinePriceCents:o,currentStoragePriceCents:s}){let c=(0,G.useMemo)(()=>e.map(e=>{let t=W[e.tier]??e.label,n=o==null?`+${$(e.price_cents)}`:e.price_cents===o?`(${$(e.price_cents)}, current)`:it(e.price_cents-o);return{value:e.tier,label:`${t} ${n}`,disabled:wn(e)}}),[e,o]),l=(0,G.useMemo)(()=>t.map(e=>{let t=s==null?`+${$(e.price_cents)}`:e.price_cents===s?`(${$(e.price_cents)}, current)`:it(e.price_cents-s);return{value:e.tier,label:`${e.storage_gib} GB ${t}`,disabled:wn(e)}}),[t,s]);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(u,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:`Machine`}),(0,K.jsx)(`span`,{title:`Determines the CPU and memory allocated to your assistant`,children:(0,K.jsx)(b,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,K.jsx)(D,{"aria-label":`Machine tier`,placeholder:`Select a machine tier`,value:n??``,onChange:i,options:c})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(u,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:`Storage`}),(0,K.jsx)(`span`,{title:`Persistent disk space for your assistant's files and data`,children:(0,K.jsx)(b,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,K.jsx)(D,{"aria-label":`Storage tier`,placeholder:`Select a storage tier`,value:r??``,onChange:a,options:l})]})]})}var En=new Set([`active`,`trialing`,`past_due`]);function Dn(e){return e.plan_id!==`base`&&e.cancel_at_period_end!==!0&&!e.cancel_at&&e.status!=null&&En.has(e.status)}var On=[`target_plan_id`,`confirm`,`machine_tier`,`storage_tier`,`credit_tier`,`package`,`non_field_errors`];function kn(e,t){if(e&&typeof e==`object`){for(let t of On)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 An(e,t){let n=e.filter(e=>!wn(e));return t!==null&&n.some(e=>e.tier===t)?t:n[0]?.tier??null}function jn(e,t,n){return t===void 0?n:t!==null&&(t===n||e.some(e=>e.tier===t))?t:null}function Mn(e){return e.length?Math.min(...e.map(e=>e.price_cents)):0}function Nn(){let e=o(),t=c(ge());return{changePackage:async n=>{try{let r=await t.mutateAsync({body:{package:n}});return await Promise.all([e.invalidateQueries({queryKey:B()}),e.invalidateQueries({queryKey:le()}),e.invalidateQueries({queryKey:ce()})]),r}catch(e){return T.error(kn(e,`Failed to change your plan. Please try again.`)),null}},isPending:t.isPending}}function Pn({enabled:e=!0}={}){let t=o(),n=I(),r=e&&n,i=s({...pe(),enabled:r}),a=i.data,l=a!=null&&a.plan_id!==`base`,u=s({..._e(),enabled:r&&l}),d=s({...re(),enabled:r&&l}).data?.plans.find(e=>e.id===`pro`)?.machine_tiers??[],f=e=>d.find(t=>t.tier===e)?.price_cents??null,p=c(z()),m=c(ue()),h=c(ve()),g={machineTier:u.data?.max_machine_tier??null,storageTier:u.data?.selected_storage_tier??null,storageGib:u.data?.selected_storage_gib??null,creditTier:a?.selected_credit_tier??null},_=a!=null&&a.plan_id!==`base`&&a.status!=null&&En.has(a.status)&&a.cancel_at_period_end!==!0&&!a.cancel_at,v=!l||!u.isPending,y=!l||u.isSuccess&&u.data!=null&&!u.isFetching&&u.dataUpdatedAt>=i.dataUpdatedAt,b=p.isPending||m.isPending||h.isPending,x=()=>Promise.all([t.invalidateQueries({queryKey:B()}),t.invalidateQueries({queryKey:ce()}),t.invalidateQueries({queryKey:le()})]);return{changeTiers:async e=>{let t=e.machineTier!==g.machineTier,n=e.storageTier!==g.storageTier,r=e.creditTier!==g.creditTier,i=f(e.machineTier),a=f(g.machineTier),o=t&&i!=null&&a!=null&&i<a,s=[];if(t&&s.push(new Promise(t=>{p.mutate({body:{machine_tier:e.machineTier}},{onSuccess:()=>t({dimension:`machine`,ok:!0}),onError:e=>t({dimension:`machine`,ok:!1,error:e})})})),n&&s.push(new Promise(t=>{m.mutate({body:{storage_tier:e.storageTier}},{onSuccess:()=>t({dimension:`storage`,ok:!0}),onError:e=>t({dimension:`storage`,ok:!1,error:e})})})),r&&s.push(new Promise(t=>{h.mutate({body:{credit_tier:e.creditTier}},{onSuccess:()=>t({dimension:`credit`,ok:!0}),onError:e=>t({dimension:`credit`,ok:!1,error:e})})})),s.length===0)return{needsResize:!1,creditChanged:!1};let c=await Promise.all(s);await x();let l=c.some(e=>e.ok&&e.dimension===`machine`)&&!o,u=c.some(e=>e.ok&&e.dimension===`storage`),d=l||u,_=c.some(e=>e.ok&&e.dimension===`credit`),v=c.filter(e=>!e.ok);if(v.length>0){let e=v.map(e=>kn(e.error,`Failed to update ${e.dimension} tier.`)).join(` `);return T.error(e),d||_?{needsResize:d,creditChanged:_}:null}return{needsResize:d,creditChanged:_}},isPending:b,current:g,eligible:_,currentReady:v,currentKnown:y,primaryAssistantId:y?u.data?.primary_assistant_id??null:null}}var Fn=`__none__`,In=`No extra credits`;function Ln(e){let{proPlan:t,seed:n,machineTier:r,storageTier:i,creditChoice:a}=e,o=t.machine_tiers,s=t.storage_tiers,c=t.credit_tiers??[],l=o.find(e=>e.tier===r)??null,u=s.find(e=>e.tier===i)??null,d=a&&a!==`__none__`?c.find(e=>e.tier===a)??null:null,f=n==null?null:o.find(e=>e.tier===n.machineTier)??null,p=n==null?null:s.find(e=>e.tier===n.storageTier)??null,m=n!=null&&n.creditTier!=null?c.find(e=>e.tier===n.creditTier)??null:null,h=n!=null&&n.machineTier!=null&&f==null,g=n!=null&&p==null,_=[{key:`base`,label:`Platform fee: ${$(t.base_price_cents)}`,changed:!1}];if(l!=null){let e=n!=null&&!h&&f?.tier!==l.tier;_.push({key:`machine`,label:l.description,previousLabel:e&&f!=null?f.description:void 0,changed:e})}if(u!=null){let e=n!=null&&!g&&p?.tier!==u.tier;_.push({key:`storage`,label:at(u.storage_gib),previousLabel:e&&p!=null?at(p.storage_gib):void 0,changed:e})}let v=a===`__none__`?In:d==null?null:ot(d.credits_usd);if(v!=null){let e=n!=null&&(n.creditTier??`__none__`)!==a,t=n?.creditTier==null?In:m==null?void 0:ot(m.credits_usd);_.push({key:`credit`,label:v,previousLabel:e?t:void 0,changed:e})}let y=t.base_price_cents+(l?.price_cents??0)+(u?.price_cents??0)+(d?.price_cents??0),b=h||g||n!=null&&n.creditTier!=null&&m==null;if(n==null||b)return{totalCents:y,previousTotalCents:null,deltaCents:null,rows:_};let x=t.base_price_cents+(f?.price_cents??0)+(p?.price_cents??0)+(m?.price_cents??0);return{totalCents:y,previousTotalCents:x,deltaCents:y-x,rows:_}}function Rn(e){return(0,K.jsxs)(`span`,{className:`text-[12px] font-medium text-[var(--content-disabled)]`,children:[`+`,$(e)]})}function zn({open:e,proPlan:t,pending:r,currentStorageGib:i,initialSelection:a,onClose:o,onContinue:s}){let c=e?a??null:null,[l,u]=(0,G.useState)(()=>c?.machineTier??``),[d,f]=(0,G.useState)(()=>c?.storageTier??``),[p,m]=(0,G.useState)(()=>c?c.creditTier??`__none__`:``),[_,b]=(0,G.useState)({open:e,initialSelection:a});(_.open!==e||_.initialSelection!==a)&&(b({open:e,initialSelection:a}),u(c?.machineTier??``),f(c?.storageTier??``),m(c?c.creditTier??`__none__`:``));let x=t.machine_tiers,S=(0,G.useMemo)(()=>t.storage_tiers.filter(e=>!e.legacy||e.tier===a?.storageTier),[t.storage_tiers,a?.storageTier]),C=t.credit_tiers??[],T=(0,G.useMemo)(()=>(t.credit_tiers??[]).filter(e=>!e.legacy),[t.credit_tiers]),E=e=>wn(e)||e.legacy&&e.tier!==a?.storageTier||i!=null&&e.storage_gib<i,O=x.map(e=>({value:e.tier,label:e.description,icon:(0,K.jsx)(Ie,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:Rn(e.price_cents),disabled:wn(e)})),k=S.map(e=>({value:e.tier,label:e.label,icon:(0,K.jsx)(y,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:Rn(e.price_cents),disabled:E(e)})),A=p&&p!==`__none__`?C.find(e=>e.tier===p)??null:null,j=A?.legacy?A:null,M=[{value:Fn,label:In,icon:(0,K.jsx)(g,{className:`h-4 w-4`,"aria-hidden":!0})},...T.map(e=>({value:e.tier,label:e.label,icon:(0,K.jsx)(g,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:Rn(e.price_cents)})),...j?[{value:j.tier,label:j.label,icon:(0,K.jsx)(g,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:Rn(j.price_cents),disabled:!0}]:[]],ee=x.find(e=>e.tier===l)??null,N=d!==``&&d===a?.storageTier,P=S.find(e=>e.tier===d&&(N||!E(e)))??null,te=p===`__none__`||p===a?.creditTier||T.some(e=>e.tier===p),F=p!==``&&te?p:null,ne=ee!=null&&P!=null&&F!=null,I=a!=null&&l===(a.machineTier??``)&&d===a.storageTier&&p===(a.creditTier??`__none__`),L=(0,G.useMemo)(()=>Ln({proPlan:t,seed:a??null,machineTier:l,storageTier:d,creditChoice:p}),[t,a,l,d,p]);return(0,K.jsx)(w.Root,{open:e,onOpenChange:e=>{e||o()},children:(0,K.jsx)(w.Content,{size:`lg`,"data-theme":`light`,hideCloseButton:!0,overlayClassName:`backdrop-blur-[2px]`,className:`max-w-[820px] md:min-h-[min(608px,calc(100vh-4rem))]`,children:(0,K.jsx)(w.Body,{className:`p-4`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-8 md:flex-row md:gap-12`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6 md:flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`flex shrink-0 items-center justify-center rounded-xl bg-[var(--surface-active)] p-[14px]`,children:(0,K.jsx)(v,{className:`h-6 w-6 text-[var(--content-emphasised)]`,"aria-hidden":!0})}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,K.jsx)(w.Title,{className:`text-[16px] font-medium text-[var(--content-emphasised)]`,children:`Create a custom plan`}),(0,K.jsx)(w.Description,{className:`mt-0 text-[14px] font-medium leading-[18px] text-[var(--content-tertiary)]`,children:`Just better.`})]})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-secondary)]`,children:`Select a machine size:`}),(0,K.jsx)(D,{"aria-label":`Machine size`,placeholder:`Select a machine size`,value:l,onChange:u,options:O})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-secondary)]`,children:`Select storage:`}),(0,K.jsx)(D,{"aria-label":`Storage`,placeholder:`Select storage`,value:d,onChange:f,options:k})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-secondary)]`,children:`Bundle some credits:`}),(0,K.jsx)(D,{"aria-label":`Credit bundle`,placeholder:`Select a credit bundle`,value:p,onChange:m,options:M})]})]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-16 md:pt-[5px]`,children:[(0,K.jsx)(`span`,{className:`text-[16px] font-medium text-[var(--content-emphasised)]`,children:`Recap`}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`text-[24px] font-medium text-[var(--content-default)]`,children:$(L.totalCents)}),L.deltaCents!=null&&L.deltaCents!==0&&L.previousTotalCents!=null&&(0,K.jsxs)(`span`,{className:`text-[12px] font-medium ${L.deltaCents>0?`text-[var(--system-positive-strong)]`:`text-[var(--system-negative-strong)]`}`,children:[it(L.deltaCents),` compared to previous (`,Q(L.previousTotalCents),`)`]}),(0,K.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-tertiary)]`,children:`Total`})]}),(0,K.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,K.jsx)(`span`,{className:`text-[12px] font-medium text-[var(--content-tertiary)]`,children:`Your selection:`}),(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:L.rows.map(e=>(0,K.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[e.previousLabel!=null&&(0,K.jsxs)(`div`,{className:`relative flex w-fit items-start gap-2`,children:[(0,K.jsx)(h,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-disabled)]`,"aria-hidden":!0}),(0,K.jsx)(`s`,{className:`text-[14px] font-medium leading-[18px] text-[var(--content-disabled)] no-underline`,children:e.previousLabel}),(0,K.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute -left-1 right-0 top-[9px] h-px bg-[var(--content-disabled)]`})]}),(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(h,{className:`mt-0.5 h-4 w-4 shrink-0 ${e.changed?`text-[var(--system-positive-strong)]`:`text-[var(--content-secondary)]`}`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`text-[14px] font-medium leading-[18px] text-[var(--content-secondary)]`,children:e.label})]})]},e.key))}),(0,K.jsx)(n,{variant:`primary`,fullWidth:!0,disabled:!ne||I||r,onClick:()=>{!ne||I||r||s({machineTier:ee.tier,storageTier:P.tier,creditTier:F===`__none__`?null:F})},children:`Continue`}),(0,K.jsx)(n,{variant:`ghost`,fullWidth:!0,disabled:r,onClick:o,children:`Cancel`})]})]})]})})})})}function Bn({className:e,"data-testid":t,children:n}){return(0,K.jsx)(`div`,{"aria-hidden":!0,"data-testid":t,className:H(`flex size-[52px] shrink-0 items-center justify-center rounded-xl`,e),children:n})}var Vn=32;function Hn(){let{ready:e,avatar:t}=_t();return(0,K.jsx)(Bn,{"data-testid":`assistant-avatar-tile`,className:`bg-[var(--surface-active)]`,children:e?(0,K.jsx)(Se,{components:t.components,traits:t.traits,customImageUrl:t.customImageUrl,size:Vn}):null})}var Un={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:`Stronger performance for heavier workloads.`,cta:`Go Super`,priceCaption:`Billed monthly`,extraFeatures:[`Assistant email and subdomain`]},ultra:{tagline:`Built for sustained, high-demand work.`,cta:`Unleash Ultra`,priceCaption:`Billed monthly`,extraFeatures:[`Assistant email and subdomain`]}};function Wn(e){return Un[e]}function Gn(e){return`Downgrade to ${e}`}var Kn=`Billed monthly · prorated difference charged today`,qn=`Billed monthly · prorated difference charged today or credited next invoice`,Jn=`Billed monthly · prorated credit on your next invoice`,Yn=`Your machine downsizes now and your storage stays. No refund.`,Xn=`Continue`,Zn=`The plan includes`,Qn=`Your plan will include`;function $n(e,t,n){let r=n?Wn(n)?.tagline??``:``;switch(e){case`downgrade`:return{title:Gn(t),subtitle:``,priceCaption:Jn,checklistHeading:Qn,note:Yn,confirmLabel:Gn(t),destructive:!0};case`switch`:return{title:`Switch to ${t}`,subtitle:r,priceCaption:qn,checklistHeading:Zn,note:``,confirmLabel:Xn,destructive:!1};default:return{title:`Upgrade to ${t}`,subtitle:r,priceCaption:Kn,checklistHeading:Zn,note:``,confirmLabel:Xn,destructive:!1}}}function er({open:e,relation:t,packageName:r,targetPackage:i,pending:a,onCancel:o,onConfirm:s}){let c=(0,G.useRef)(null),l=(0,G.useId)(),d=$n(t,r,i?.key??null),f=i?{price:$(i.total_price_cents),highlights:fn(i,Wn(i.key)?.extraFeatures??[])}:null,p=d.subtitle,m=d.note?{"aria-describedby":l}:p?{}:{"aria-describedby":void 0};return(0,K.jsx)(w.Root,{open:e,onOpenChange:e=>{!e&&!a&&o()},children:(0,K.jsxs)(w.Content,{size:`sm`,hideCloseButton:!0,className:`gap-4 p-4 max-w-[421px]`,onOpenAutoFocus:e=>{e.preventDefault(),c.current?.focus()},...m,children:[(0,K.jsxs)(w.Header,{className:`flex-row items-center gap-3 p-0 pb-2`,children:[d.destructive?(0,K.jsx)(Bn,{"data-testid":`package-switch-warning-tile`,className:`bg-[var(--system-negative-weak)]`,children:(0,K.jsx)(S,{className:`size-6 text-[var(--system-negative-strong)]`})}):(0,K.jsx)(Hn,{}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,K.jsx)(w.Title,{className:`text-title-small text-[var(--content-emphasised)] [&>span]:whitespace-normal`,children:d.title}),p?(0,K.jsx)(w.Description,{className:`mt-0 text-body-medium-default text-[var(--content-tertiary)]`,children:p}):null]})]}),f?(0,K.jsxs)(w.Body,{className:`flex flex-col gap-4 p-0`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsx)(u,{as:`p`,variant:`title-large`,className:`text-[var(--content-default)]`,children:f.price}),(0,K.jsx)(u,{as:`p`,variant:`label-medium-default`,className:`leading-[15px] text-[var(--content-tertiary)]`,children:d.priceCaption})]}),(0,K.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,K.jsx)(u,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,children:d.checklistHeading}),(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:f.highlights.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(h,{className:`size-4 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,K.jsx)(u,{as:`span`,variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]},e))})]}):null,d.note?(0,K.jsx)(u,{id:l,as:`p`,variant:`body-medium-default`,className:`text-[var(--content-secondary)]`,children:d.note}):null,(0,K.jsxs)(w.Footer,{className:`flex-col gap-4 p-0`,children:[(0,K.jsx)(n,{fullWidth:!0,variant:d.destructive?`danger`:`primary`,onClick:s,disabled:a,"data-testid":`confirm-package-switch-button`,children:d.confirmLabel}),(0,K.jsx)(n,{ref:c,fullWidth:!0,variant:`ghost`,onClick:o,disabled:a,children:`Cancel`})]})]})})}function tr(){let e=o();(0,G.useEffect)(()=>R(()=>{e.invalidateQueries({queryKey:B()}),e.invalidateQueries({queryKey:le()}),e.invalidateQueries({queryKey:ce()})}),[e])}export{an as A,un as C,$t as D,tn as E,Z as F,X as I,it as M,Q as N,on as O,$ as P,mn as S,cn as T,xn as _,zn as a,Cn as b,En as c,Mn as d,jn as f,yn as g,bn as h,Wn as i,Qt as j,en as k,kn as l,Tn as m,er as n,Pn as o,An as p,Gn as r,Nn as s,tr as t,Dn as u,Sn as v,dn as w,hn as x,vn as y};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-Dy5001j6.js";import{u as r}from"./chunk-5KNZJZUH-Bsoom5--.js";import{c as i,g as a,n as o}from"./QueryClientProvider-CMu7CkQU.js";import{t as s}from"./useQuery-Bz-fbQ-m.js";import{t as c}from"./useMutation-CXGTrp4W.js";import{t as l}from"./jsx-runtime-D3ZM-ToX.js";import{t as u}from"./typography-DEI9Ra9z.js";import{t as d}from"./createLucideIcon-CAM1RhH8.js";import{t as f}from"./arrow-right-B-jRJNWP.js";import{t as p}from"./check-sC49_hjU.js";import{t as m}from"./circle-alert-DVCpoZrc.js";import{t as h}from"./circle-check-CjGnAahM.js";import{t as g}from"./coins-Hrmb9tmj.js";import{n as _,t as v}from"./sliders-horizontal-slneqAyY.js";import{t as y}from"./hard-drive-CncrDZ7V.js";import{t as b}from"./info-CYiVdnQV.js";import{t as x}from"./loader-circle-BzJ2kz3F.js";import{t as S}from"./triangle-alert--e3n47gm.js";import{t as C}from"./notice-DCp7WO3L.js";import{t as w}from"./modal-DwsThLGg.js";import{n as T}from"./toast-DR7D7Uma.js";import{t as E}from"./confirm-dialog-DZX6LhLy.js";import{t as D}from"./dropdown-DswWMJhz.js";import{n as O}from"./resolved-assistants-store-8HQDfxZh.js";import{Z as k,d as A,et as j,f as M,l as ee,u as N}from"./auth-store-BwKMFgpK.js";import{C as P,x as te}from"./native-biometric-B96mgKGP.js";import{d as F}from"./routes-GmNvdtLW.js";import{n as ne}from"./use-assistant-avatar--4s_vvar.js";import{r as I}from"./use-is-org-ready-zouQ5CN4.js";import{n as L,r as R}from"./browser-Bses4IN3.js";import{$ as re,C as ie,O as ae,at as oe,c as se,ct as ce,et as le,it as ue,jt as de,l as fe,lt as pe,nt as z,ot as me,r as he,rt as ge,st as _e,tt as ve,ut as B,y as ye}from"./react-query.gen-BVTEjHsw.js";import{t as V}from"./avatar-bundled-components-CTd294ra.js";import{r as be}from"./use-avatar-accent-var-BaftJG7F.js";import{t as H}from"./misc-CAQM4FGM.js";import{n as xe,t as U}from"./avatar-tone-4L7foPzW.js";import{t as Se}from"./chat-avatar-CIF_o6y5.js";import{t as Ce}from"./avatar-renderer-3EVhZ7TB.js";import{n as we}from"./use-bundled-avatar-components-IQw2k8-g.js";import{c as Te,i as Ee,l as De,n as W,r as Oe,t as ke}from"./machine-sizes-D0oAlF9f.js";import{a as Ae,i as je,n as Me,r as Ne,t as Pe}from"./provisioning-targets-CT4slXZJ.js";import{t as Fe}from"./environment-store-Bbx4f6SQ.js";var Ie=d(`computer`,[[`rect`,{width:`14`,height:`8`,x:`5`,y:`2`,rx:`2`,key:`wc9tft`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h2`,key:`rwmk9e`}],[`path`,{d:`M12 18h6`,key:`aqd8w3`}]]),G=e(t(),1),K=l();function Le({icon:e}){return(0,K.jsx)(`span`,{className:`flex h-11 w-11 items-center justify-center rounded-full`,style:{backgroundColor:`color-mix(in oklab, var(--system-negative-strong) 12%, transparent)`},children:(0,K.jsx)(e,{className:`h-5 w-5`,style:{color:`var(--system-negative-strong)`},"aria-hidden":`true`})})}var Re={fontFamily:`var(--font-serif)`,fontSize:`32px`,fontWeight:400,lineHeight:1.2,letterSpacing:`0.64px`};function ze({title:e,subtitle:t}){return(0,K.jsxs)(`header`,{className:`flex flex-col items-center gap-2 pt-12 text-center`,children:[(0,K.jsx)(`h2`,{className:`text-[var(--content-emphasised)]`,style:Re,children:e}),t&&(0,K.jsx)(`p`,{className:`text-[14px] font-normal text-[var(--content-secondary)]`,children:t})]})}var Be=[{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}],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}];function q({variant:e=`full`}){let t=we();return t?(0,K.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`creature-corners`,className:`pointer-events-none absolute inset-0 select-none`,children:(e===`top`?Ve:Be).map((e,n)=>(0,K.jsx)(`span`,{className:`absolute ${e.position}`,style:{rotate:`${e.rotate}deg`},children:(0,K.jsx)(Ce,{components:t,bodyShapeId:e.bodyShape,eyeStyleId:e.eyeStyle,colorId:e.color,size:e.size})},n))}):null}var J={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.`},He={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.`},Ue={upgrade:J,downgrade:He,change:He};function Y(e=`upgrade`){return Ue[e]}function X(e,t=!0){let{data:n}=s({...he(),enabled:t&&e==null}),{data:r}=s({...ae({path:{id:e??``}}),enabled:t&&e!=null});return e==null?n:r}function We({assistantId:e,direction:t}){let i=r(),a=X(e,I())?.name||`your assistant`;return(0,K.jsxs)(`div`,{className:`relative flex min-h-[320px] flex-col items-center justify-center overflow-hidden px-8 pb-16 [animation:onboarding-step-in_350ms_ease-out] motion-reduce:[animation:none]`,children:[(0,K.jsx)(q,{variant:`full`}),(0,K.jsxs)(`div`,{className:`relative flex w-full flex-col items-center`,children:[(0,K.jsx)(ze,{title:`You're all set!`,subtitle:Y(t).completeSubtitle}),(0,K.jsx)(`div`,{className:`mt-10 flex w-full flex-col items-center gap-10`,children:(0,K.jsxs)(n,{variant:`primary`,"data-testid":`onboarding-complete-return`,onClick:()=>{e!=null&&j(e),i(F.assistant,{replace:!0})},children:[`Return to `,a]})})]})]})}function Z(e=!0,t){let n=X(t,e),r=t??n?.id,{data:i,isError:a,isFetching:o,dataUpdatedAt:c,errorUpdatedAt:l}=s({...se({path:{assistant_id:r??``}}),enabled:e&&!!r});return{assistant:n,assistantId:r,domains:i,domainsError:a,domainsFetching:o,domainsUpdatedAt:c,domainsErrorUpdatedAt:l}}var Ge=1e3,Ke=1e4,qe=2500,Je=2e3,Ye=1e4,Xe=[`machine_size`,`subdomain`,`non_field_errors`],Ze={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.`},Qe={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 $e(e,t,n=`upgrade`){if(e&&typeof e==`object`){let t=e;if(typeof t.error==`string`){let e=(n===`upgrade`?void 0:Qe[t.error])??Ze[t.error];if(e)return e}for(let e of Xe){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 et=`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`,tt=`text-[11px] font-medium text-[var(--content-secondary)]`;function nt({onExit:e,machineBusy:t=!1,assistantId:r}){let i=o(),a=Fe.use.emailRootDomain(),{assistant:s,assistantId:l,domains:u}=Z(!0,r),d=u?.results[0],[f,p]=(0,G.useState)(``),[m,h]=(0,G.useState)(`hi`),[g,_]=(0,G.useState)(!1);(0,G.useEffect)(()=>{if(!g){if(d){p(d.subdomain),_(!0);return}!s?.handle||f||(p(s.handle),_(!0))}},[s?.handle,d,g,f]);let[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(!1),S=c(oe()),T=!!d||b,E=S.isPending||b;return(0,G.useEffect)(()=>{if(!b)return;let t=setTimeout(e,800);return()=>clearTimeout(t)},[b,e]),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(w.Body,{className:`animate-[onboarding-step-in_350ms_ease-out] space-y-6 pb-0 motion-reduce:animate-none`,children:[(0,K.jsx)(q,{variant:`top`}),(0,K.jsx)(ze,{title:`Assistant Email`,subtitle:`Set up an email for your assistant.`}),(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`label`,{htmlFor:`onboarding-email-prefix`,className:tt,children:`Prefix`}),(0,K.jsx)(`input`,{id:`onboarding-email-prefix`,value:m,onChange:e=>h(e.target.value.toLowerCase().trim()),disabled:E||T,readOnly:T,placeholder:`hi`,className:`${et} w-24`})]}),(0,K.jsx)(`span`,{className:`flex h-8 items-center text-[var(--content-secondary)]`,children:`@`}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,K.jsx)(`label`,{htmlFor:`onboarding-email-handle`,className:tt,children:`Handle (public)`}),(0,K.jsx)(`input`,{id:`onboarding-email-handle`,value:f,onChange:e=>{p(e.target.value.toLowerCase().trim()),v&&y(null)},disabled:E||T,readOnly:T,autoFocus:!0,placeholder:`my-assistant`,"aria-invalid":!!v,className:`${et} w-full min-w-0`})]}),(0,K.jsxs)(`span`,{className:`flex h-8 shrink-0 items-center text-[14px] text-[var(--content-tertiary)]`,children:[`.`,a]})]}),v&&(0,K.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:v}),T&&(0,K.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`This domain has been set and cannot be changed.`})]}),t&&!T&&(0,K.jsx)(C,{tone:`neutral`,children:`Your assistant is restarting — you can set the domain in a moment.`}),!T&&(0,K.jsx)(C,{tone:`info`,className:`border-transparent bg-[var(--surface-active)]`,children:(0,K.jsx)(`span`,{className:`font-medium text-[var(--content-tertiary)]`,children:`You won't be able to change the handle once set.`})}),b?(0,K.jsx)(C,{tone:`success`,children:`Domain set — redirecting…`}):null]}),(0,K.jsx)(w.Footer,{className:`items-center pt-6`,children:T?(0,K.jsx)(n,{variant:`primary`,"data-testid":`onboarding-domain-continue`,onClick:e,children:`Continue`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(n,{variant:`outlined`,"data-testid":`onboarding-domain-skip`,disabled:E,onClick:()=>{E||S.mutate({body:{skipped:!0}},{onSuccess:e,onError:()=>e()})},children:`Skip`}),(0,K.jsx)(n,{variant:`primary`,"data-testid":`onboarding-domain-set`,disabled:!f||E||t,onClick:()=>{E||t||!f||S.mutate({body:{subdomain:f,...m?{email_username:m}:{}}},{onSuccess:()=>{y(null),x(!0),i.invalidateQueries({queryKey:ye()}),i.invalidateQueries({queryKey:fe({path:{assistant_id:l??``}})}),i.invalidateQueries({queryKey:ce()})},onError:e=>{y($e(e,`Couldn't register that subdomain. Try a different one.`))}})},children:`Next`})]})})]})}function rt({onGoToBilling:e,direction:t}){return(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-6 py-10 text-center`,children:[(0,K.jsx)(Le,{icon:m}),(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,K.jsx)(u,{variant:`title-small`,as:`h1`,children:`Couldn't reach billing`}),(0,K.jsx)(u,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:Y(t).fetchErrorBody})]}),(0,K.jsx)(n,{variant:`primary`,"data-testid":`onboarding-go-to-billing`,onClick:e,children:`Go to billing`})]})}function Q(e){let t=e/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function $(e){return`${Q(e)}/mo`}function it(e){return`${e>0?`+`:`−`}${Q(Math.abs(e))}/mo`}function at(e){return`${e} GB storage`}function ot(e){return`${Q(e*100)} of bundled credits`}function st(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:Ee[n.machineSize],to:Ee[r]}):n.machineSize!==t.machineSize&&a.push({key:`machine`,label:`Machine`,from:n.machineSize==null?void 0:Ee[n.machineSize],to:Ee[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:`Credits`,from:i.from,to:i.to}),a}var ct=60,lt=ct*2;function ut({imageUrl:e,animateIn:t=!0}){return(0,K.jsxs)(`div`,{"aria-hidden":!0,"data-testid":`takeover-backdrop`,className:`pointer-events-none absolute inset-0 overflow-hidden${t?` provision-avatar-reveal`:``}`,children:[(0,K.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(${ct}px)`,width:`calc(100% + ${lt*2}px)`,height:`calc(100% + ${lt*2}px)`}}),(0,K.jsx)(`div`,{className:`absolute inset-0 bg-black/55`})]})}function dt(e){let t=e?.match(/^credits_(\d+)$/)?.[1];return t==null?null:Number(t)}function ft(e,t){if(t!=null)return e?.credit_tiers?.find(e=>e.tier===t)}function pt(e){let t=I(),{data:n}=s({...re(),enabled:t&&e});return n?.plans.find(e=>e.id===`pro`)}function mt(e,t){return t==null?0:ft(e,t)?.credits_usd??dt(t)}function ht(e){let t=pt(e!=null);if(e==null||t==null)return null;let n;if(e.kind===`package`){let r=t.packages.find(t=>t.key===e.packageKey);n=r?.credits_usd??ft(t,r?.credit_tier)?.credits_usd}else n=ft(t,e.creditTier)?.credits_usd;return n==null?null:{fromUsd:0,toUsd:n}}function gt(e){let t=pt(e!=null);if(e==null)return null;let n=mt(t,e.fromTier),r=mt(t,e.toTier);return n==null||r==null?null:{fromUsd:n,toUsd:r}}function _t(e){let t=O.use.activeAssistantId(),n=e===void 0?t:e,{components:r,traits:i,customImageUrl:a,isLoading:o}=ne(n),s=(0,G.useMemo)(()=>A(),[M()]),c=s!=null&&N(s)?s:null,l=n!=null&&!o,u=c!=null&&(n==null||n===c.assistantId),d=u&&!(l&&(r!=null||i!=null||a!=null))?c:null,f=d?d.components:r,p=d?d.traits:i,m=d?null:a,h=l||u,g=be(f,p)??(m?null:(f??V).colors?.[0]?.hex??null);return{tintHex:h&&g?xe(g):U,backdropImageUrl:h?m:null,ready:h,avatar:{components:f,traits:p,customImageUrl:m}}}function vt(e,t){let[n,r]=(0,G.useState)(e),i=(0,G.useRef)(0);return(0,G.useEffect)(()=>{i.current=performance.now()},[]),(0,G.useEffect)(()=>{if(t<=0||e===n)return;let a=t-(performance.now()-i.current);if(a<=0){i.current=performance.now(),r(e);return}let o=setTimeout(()=>{i.current=performance.now(),r(e)},a);return()=>clearTimeout(o)},[e,n,t]),t<=0?e:n}var yt=`--takeover-surface`,bt=`var(${yt},${U})`,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,G.useState)(()=>Et(typeof window>`u`?1/0:window.innerHeight));return(0,G.useEffect)(()=>{let e=()=>t(Et(window.innerHeight));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}var Ot={machine:_,storage:y,credits:g},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=we(),o=Dt(),s=t===`working`||t===`settling`;return(0,K.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,K.jsxs)(`div`,{className:`provision-avatar-stage`,children:[(0,K.jsx)(`div`,{"data-testid":`provision-avatar-placeholder`,className:`provision-avatar-placeholder${i?` is-resolved`:``}`}),(0,K.jsx)(`div`,{className:`provision-avatar-layer`,children:(0,K.jsx)(`div`,{className:`provision-avatar-current`,children:(0,K.jsx)(`div`,{className:`provision-avatar-strain`,children:i&&(0,K.jsx)(`div`,{className:`provision-avatar-reveal`,children:(0,K.jsx)(Se,{components:r.components??a,traits:r.traits,customImageUrl:r.customImageUrl,size:o,isAssistantBusy:s})})})})})]}),(0,K.jsx)(`div`,{className:`provision-avatar-shadow`})]})}function Mt({status:e,caption:t}){return(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5`,children:[(0,K.jsx)(`h1`,{className:`text-[var(--content-emphasised)]`,style:Re,children:e}),t&&(0,K.jsx)(u,{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 s=null;return i?s=`Complete`:a&&(s=`Pending`),(0,K.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,K.jsx)(`span`,{className:`hidden h-6 w-6 shrink-0 items-center justify-center min-[420px]:flex`,children:(0,K.jsx)(e,{className:`h-3.5 w-3.5 text-[var(--content-tertiary)]`,"aria-hidden":`true`})}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 text-left wrap-anywhere`,children:[(0,K.jsx)(`span`,{className:`text-[12px] font-medium leading-tight text-[var(--content-tertiary)]`,children:t}),(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-[14px] font-medium leading-[18px] text-[var(--content-emphasised)]`,children:[n&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{children:n}),(0,K.jsx)(`span`,{className:`sr-only`,children:`to`}),(0,K.jsx)(f,{className:`h-3 w-3 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":`true`})]}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{children:r}),i?(0,K.jsx)(p,{"data-testid":`chip-check`,className:`h-3.5 w-3.5 shrink-0 text-[var(--system-positive-strong)]`,"aria-hidden":`true`}):a&&(0,K.jsx)(x,{"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`})]}),s&&(0,K.jsx)(`span`,{className:`sr-only`,children:s})]})]})]})}function Pt({label:e}){return(0,K.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,K.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({intent:e,creditsChange:t,targets:n,fromSnapshot:r,machineFloor:i,landed:a,allDone:o=!1,creditsOnly:s=!1}){let c=ht(e),l=gt(t),u=c??l,d=st({targets:n,fromSnapshot:r,machineFloor:i,credits:u==null?null:{from:$(u.fromUsd*100),to:$(u.toUsd*100)}}),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,G.useState)(p),h=p===m?``:`${p} complete`;return f.length===0?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ft,{testId:`resource-chips`,wide:f.length>=3,children:f.map(e=>{let t=o||It(e.key,a);return(0,K.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,K.jsx)(`p`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`chip-announcement`,children:h})]})}function Rt({intent:e}){if(e.kind===`package`)return(0,K.jsx)(Ft,{children:(0,K.jsx)(Pt,{label:`${e.packageKey.charAt(0).toUpperCase()+e.packageKey.slice(1)} package`})});let t=[e.machineTier,e.storageTier,e.creditTier].filter(e=>e!=null).length;return(0,K.jsxs)(Ft,{wide:t>=3,children:[e.machineTier!=null&&(0,K.jsx)(Nt,{icon:_,label:`Machine`,to:W[e.machineTier]??e.machineTier}),e.storageTier!=null&&(0,K.jsx)(Nt,{icon:y,label:`Storage`,to:e.storageTier.toUpperCase()}),e.creditTier!=null&&(0,K.jsx)(Pt,{label:`${e.creditTier.replace(`credits_`,``)} credits`})]})}function zt({state:e,direction:t,softWaiting:r,intent:i,creditsChange:a,targets:o,fromSnapshot:s,machineFloor:c,landed:l,celebrating:u,onCelebrationEnd:d,assistantId:f,escapeAvailable:p,onEscape:m,onPhaseChange:h,kickError:g,confirm:_,dwellMs:v=qe,phaseMinMs:y=900}){let b=Y(t),x=(0,G.useRef)(d);(0,G.useEffect)(()=>{x.current=d},[d]);let S=vt(e,y),C=S===`DONE`||S===`NOT_APPLICABLE`,w=S===`RESIZING`?`WAITING`:S,T=(0,G.useRef)(h);(0,G.useEffect)(()=>{T.current=h},[h]),(0,G.useEffect)(()=>{T.current?.(S)},[S]);let{tintHex:E,backdropImageUrl:D}=_t(f),O=u&&C;return(0,G.useEffect)(()=>{if(!O)return;let e=setTimeout(()=>x.current(),v);return()=>clearTimeout(e)},[O,v]),(0,K.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]:E,backgroundColor:bt},children:[D&&(0,K.jsx)(ut,{imageUrl:D}),(0,K.jsx)(jt,{assistantId:f,mode:At(S,r),downsizing:t===`downgrade`}),(0,K.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()},w)]});function k(e=`Continue in the background`){return p?(0,K.jsx)(n,{variant:`ghost`,"data-testid":`provisioning-escape`,onClick:m,children:e}):null}function A({allDone:e=!1,creditsOnly:t=!1}={}){return(0,K.jsx)(Lt,{intent:i,creditsChange:a,targets:o,fromSnapshot:s,machineFloor:c,landed:l,allDone:e,creditsOnly:t})}function j(){if(S===`CONFIRMING`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Mt,{status:b.confirmingStatus,caption:`This might take a couple seconds.`}),i&&(0,K.jsx)(Rt,{intent:i}),k()]});if(S===`WAITING`||S===`RESIZING`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Mt,{status:b.waitingStatus,caption:r?`Still working — this can take a minute or two.`:`This might take a couple seconds.`}),A(),k()]});if(S===`DONE`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Mt,{status:`All done!`}),A({allDone:!0})]});if(S===`NOT_APPLICABLE`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Mt,{status:`Your plan is ready`}),A({allDone:!0,creditsOnly:!0})]});if(S===`STALLED`){let e=g!=null;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Mt,{status:e?b.snagStatus:`This is taking longer than expected`,caption:e?$e(g,b.snagCaption,t):`This may take a couple of minutes.`}),A(),e?k(`Retry in the background`):k()]})}return S===`CONFIRM_TIMEOUT`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Mt,{status:b.confirmTimeoutStatus,caption:b.confirmTimeoutCaption}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,K.jsx)(n,{variant:`outlined`,"data-testid":`onboarding-go-to-billing`,onClick:_.onGoToBilling,children:`Go to billing`}),(0,K.jsx)(n,{variant:`primary`,"data-testid":`onboarding-retry`,onClick:_.onRetry,children:`Try again`})]})]}):null}}function Bt(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&&!Ae(n,i);if(Ae(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 Vt=2e3,Ht=1e3,Ut=[`DONE`,`NOT_APPLICABLE`,`CONFIRM_TIMEOUT`],Wt={assistantId:null,machine:null,storage:null};function Gt({open:e,canLowerResources:t=!1,verdictRecheckMs:n=Ye}){let r=o(),l=I(),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(0),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(null),[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(null),[S,C]=(0,G.useState)(null),[w,T]=(0,G.useState)(null),[E,D]=(0,G.useState)(Wt),[O,A]=(0,G.useState)(null),[j,M]=(0,G.useState)(!1),ee=(0,G.useRef)(!1),N=(0,G.useRef)(!1),P=(0,G.useRef)(0),[te,F]=(0,G.useState)(!1),[ne,L]=(0,G.useState)(null),[R,re]=(0,G.useState)(null),[oe,se]=(0,G.useState)(null),[le,ue]=(0,G.useState)(()=>Date.now()),[de,fe]=(0,G.useState)(!0);(0,G.useEffect)(()=>{e||(d(!1),p(0),h(null),_(null),y(null),F(!1),L(null),re(null),se(null),fe(!0),x(null),C(null),T(null),D(Wt),A(null),M(!1),ee.current=!1,N.current=!1,P.current+=1)},[e]),(0,G.useEffect)(()=>{e&&(h(Date.now()),r.invalidateQueries({queryKey:B()}),r.invalidateQueries({queryKey:ce()}))},[e,r]);let z=g!=null,ge=s({...pe(),refetchInterval:e=>e.state.data?.plan_id===`pro`||u?!1:Ge,refetchIntervalInBackground:!1,enabled:e&&l&&!z}),ve=(m!=null&&ge.dataUpdatedAt>=m?ge.data?.plan_id:null)??null;(0,G.useEffect)(()=>{if(!e||z||ve!==`pro`)return;let t=Date.now();_(t),ue(t)},[e,z,ve]),(0,G.useEffect)(()=>{if(!e||z)return;let t=setTimeout(()=>d(!0),Ke);return()=>clearTimeout(t)},[e,z,f]);let ye=(0,G.useCallback)(()=>{d(!1),p(e=>e+1),k.getState().fetchOrganizations(),r.invalidateQueries({queryKey:B()})},[r]),V=(0,G.useCallback)(()=>{let e=Date.now();y(e),ue(e)},[]),{mutate:be}=c(me()),H=(0,G.useCallback)(e=>{let t=P.current;be({},{onSuccess:n=>{t===P.current&&(A(null),Me(n)?N.current?A({error:n.reason??`no_active_pro`}):(N.current=!0,M(!0),e===`escape`&&V()):(x(n.state),e===`escape`&&V()))},onError:e=>{t===P.current&&A(e)}})},[be,V]);(0,G.useEffect)(()=>{!e||!l||!z||ee.current||(ee.current=!0,H(`auto`))},[e,l,z,H]),(0,G.useEffect)(()=>{if(!j)return;let e=P.current,t=setTimeout(()=>{M(!1),e===P.current&&H(`auto`)},Je);return()=>clearTimeout(t)},[j,H]);let xe=(0,G.useCallback)(()=>H(`escape`),[H]),U=s({..._e(),enabled:e&&l&&z}),Se=de?Vt:!1,Ce=s({...he(),enabled:e&&l&&z,refetchInterval:e=>e.state.data?.id==null?Se:!1,retry:!1}),we=z&&m!=null&&U.dataUpdatedAt>=m,Ee=we&&!U.isPending&&!U.isFetching,W=(we?U.data?.primary_assistant_id:null)??(U.isPending?null:Ce.data?.id??null),Oe=s({...ae({path:{id:W??`unresolved`}}),enabled:e&&l&&z&&W!=null,refetchInterval:Se,retry:!1}),Fe=ie({path:{id:W??`unresolved`}}),Ie=s({...Fe,enabled:e&&l&&z&&W!=null,refetchInterval:Se,retry:!1}),K=(0,G.useRef)(0),[Le,Re]=(0,G.useState)(0),ze=a(Fe.queryKey);(0,G.useEffect)(()=>r.getQueryCache().subscribe(t=>{if(!(t.type!==`updated`||t.query.queryHash!==ze)){if(t.action.type===`fetch`)K.current+=1;else if(t.action.type===`success`&&!t.action.manual){let n=K.current,r=e&&Ne(t.action.data);i.schedule(()=>{Re(n),r&&(F(!0),L(W))})}}}),[r,ze,e,W]);let Be=Ne(Ie.data),Ve=ne===W,q=U.data,J=(0,G.useMemo)(()=>q?{machineSize:Te(q.max_machine_tier),storageGib:q.selected_storage_gib??null}:null,[q]),He=q!=null&&q.max_machine_tier==null?ke:null,Ue=q?q.domain_setup_available&&q.primary_assistant_id!=null:void 0,Y=Oe.data,X=(0,G.useMemo)(()=>Y?{machineSize:Y.machine_size??null,storageGib:Y.provisioned_storage_gib??null}:null,[Y]),We=oe===W,Z=(0,G.useMemo)(()=>{let e=Pe(J,X),t=J?.machineSize??He;if(t==null)return e;let n=X?.machineSize??null;if(n==null)return{...e,machine:!1};let r=(We?R?.machineSize:null)??n,i=De(t)<De(r);return{...e,machine:i?De(n)<=De(t):De(n)>=De(t)}},[J,X,R,We,He]),qe=Ae(J,X),Xe=w===W;(0,G.useEffect)(()=>{e&&(qe?(C(e=>e!=null&&Xe?e:Date.now()),T(W)):(C(null),T(null)))},[e,qe,W,Xe]);let Ze=E.assistantId===W;(0,G.useEffect)(()=>{if(!e)return;let t=K.current;D(e=>{let n=e.assistantId===W?e:Wt,r=Z.machine?n.machine??t:null,i=Z.storage?n.storage??t:null;return e.assistantId===W&&e.machine===r&&e.storage===i?e:{assistantId:W,machine:r,storage:i}})},[e,Z,W]);let Qe=(0,G.useMemo)(()=>{let e=je(Ie.data),t=e=>e!=null&&Ze&&Le>e;return{machine:Z.machine&&!e.machine&&t(E.machine),storage:Z.storage&&!e.storage&&t(E.storage)}},[Z,E,Ze,Le,Ie.data]);(0,G.useEffect)(()=>{!e||!X||R!=null&&We||(re(X),se(W))},[e,X,W,R,We]);let $e=v??g,et=$e==null?null:Math.max(0,le-$e),tt=!t,{state:nt,softWaiting:rt}=Bt({planId:z?`pro`:ve,targets:J,actuals:X,initialActuals:We?R:null,resizeOperationInFlight:Be,sawOperation:te&&Ve,msSinceWatchStart:et,confirmExpired:u,serverVerdict:b,statusObservedSinceTargetsMet:S!=null&&Xe&&Ie.dataUpdatedAt>S,targetsProveNoop:tt}),Q=Ut.includes(nt),$=e&&z&&!Q;(0,G.useEffect)(()=>{fe($)},[$]),(0,G.useEffect)(()=>{if(!e||!z||Q)return;let t=setInterval(()=>ue(Date.now()),Ht);return()=>clearInterval(t)},[e,z,Q]);let it=!tt&&(b===`started`||b===`in_progress`)&&!(te&&Ve);return(0,G.useEffect)(()=>{if(!e||!z||Q||!it)return;let t=setInterval(()=>H(`auto`),n);return()=>clearInterval(t)},[e,z,Q,it,n,H]),{state:nt,softWaiting:rt,targets:J,actualsSnapshot:R,machineFloor:He,landed:Qe,assistantId:W,domainStepAvailable:Ue,onboardingSettled:Ee,confirmError:!z&&ge.isError,targetsError:z&&U.isError&&(!q||!we),escapeEligible:et!=null&&et>=6e4,retryConfirm:ye,kickProvisioning:xe,kickError:O}}var Kt=200,qt=380;function Jt(){return typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0}var Yt=e=>e===`WAITING`||e===`RESIZING`||e===`STALLED`,Xt=e=>e===`DONE`||e===`NOT_APPLICABLE`,Zt={machineSize:null,storageGib:null};function Qt({open:e,onClose:t,dwellMs:n,phaseMinMs:r,mode:i=`checkout`,resizeContext:a}){let s=i===`resize`,c=o(),[l,u]=(0,G.useState)(`provisioning`),[d,f]=(0,G.useState)(`idle`),p=(0,G.useRef)([]),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(null),[v,y]=(0,G.useState)(null),[b,x]=(0,G.useState)(!1),S=s?a?.direction:void 0,C=Y(S),D=Gt({open:e,canLowerResources:s?a?.canLowerResources===!0:!1}),O=(0,G.useRef)(!1);(0,G.useEffect)(()=>{if(e){O.current=!0,h(s?null:P()),y(e=>e??Date.now());return}p.current.forEach(clearTimeout),p.current=[],u(`provisioning`),f(`idle`),_(null),y(null),x(!1),O.current&&(O.current=!1,ee())},[e,s]),(0,G.useEffect)(()=>()=>{p.current.forEach(clearTimeout)},[]),(0,G.useEffect)(()=>{l===`complete`&&te()},[l]);let k=Yt(D.state),A=Xt(g??D.state),{targets:j,assistantId:M,domainStepAvailable:N,onboardingSettled:F}=D,ne=s?a?.fromSnapshot:void 0,I=D.actualsSnapshot,L={machineSize:ne?.machineSize??I?.machineSize??null,storageGib:ne?.storageGib??I?.storageGib??null},{tintHex:R,backdropImageUrl:re}=_t(M),ie=s&&N===!0,{domains:ae,domainsError:oe,domainsFetching:se,domainsUpdatedAt:ce,domainsErrorUpdatedAt:le}=Z(e&&ie,M),ue=(ae?.results.length??0)>0,de=(0,G.useRef)(null);(0,G.useEffect)(()=>{if(!e){de.current=null;return}!ie||M==null||de.current!==M&&(de.current=M,c.invalidateQueries({queryKey:fe({path:{assistant_id:M}})}))},[e,ie,M,c]);let pe=!se&&(v!=null&&ce>=v||v!=null&&!!oe&&le>=v),[z,me]=(0,G.useState)(!1),he=F&&(!ie||pe);(0,G.useEffect)(()=>{if(!e){me(!1);return}he&&me(!0)},[e,he]);let ge=(0,G.useCallback)(()=>{let e=s?N===!0&&!ue?`domain`:`complete`:N===!1?`complete`:`domain`;if(Jt()){u(e);return}f(`covering`),p.current.push(setTimeout(()=>{u(e),f(`revealing`),p.current.push(setTimeout(()=>f(`idle`),qt))},Kt))},[N,s,ue]),_e=(0,G.useCallback)(()=>{x(!0)},[]),ve=(0,G.useCallback)(()=>{D.kickProvisioning(),T.info(D.kickError==null?C.backgroundExitToast:C.backgroundRetryToast),x(!1),t()},[D,t,C]),B=(0,G.useCallback)(()=>{x(!1)},[]),ye=l===`provisioning`&&(D.confirmError||D.targetsError),V=l===`provisioning`&&!ye,be=V&&!A,H=`transition-[background-color] duration-300 ease-out${V?` bg-black p-0`:``}`,xe=V?`[animation:fadeIn_0.45s_ease-out_both]`:d===`revealing`?`[animation:fadeInUp_0.42s_ease-out_0.12s_both]`:`[animation:fadeIn_0.25s_ease-out_both]`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(w.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,K.jsxs)(w.Content,{size:`md`,hideCloseButton:l!==`complete`,dismissOnOverlayClick:!be,onEscapeKeyDown:be?e=>e.preventDefault():void 0,onInteractOutside:be?e=>e.preventDefault():void 0,"data-theme":V?`dark`:void 0,overlayClassName:H,className:V?`overflow-y-auto inset-0 max-w-none w-screen h-screen max-h-none rounded-none border-0`:`overflow-hidden`,style:{[yt]:R},children:[(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col motion-reduce:[animation:none] ${xe}`,children:U()},l),d!==`idle`&&(0,K.jsx)(`div`,{"aria-hidden":!0,"data-testid":`takeover-exit-sheet`,className:`pointer-events-none fixed inset-0 z-50 ${d===`covering`?`[animation:fadeIn_200ms_ease-in_both]`:`[animation:fadeIn_380ms_ease-out_both_reverse]`}`,style:{backgroundColor:bt},children:re&&(0,K.jsx)(ut,{imageUrl:re,animateIn:!1})})]})}),(0,K.jsx)(E,{open:b&&k,title:`Continue in the background?`,message:C.backgroundConfirmMessage,confirmLabel:`Continue`,cancelLabel:`Keep waiting`,onConfirm:ve,onCancel:B})]});function U(){return l===`provisioning`?D.confirmError||D.targetsError?(0,K.jsx)(rt,{onGoToBilling:t,direction:S}):(0,K.jsx)(zt,{state:D.state,direction:S,softWaiting:D.softWaiting,intent:m,creditsChange:s?a?.credits:void 0,targets:j??Zt,fromSnapshot:L,machineFloor:D.machineFloor,landed:D.landed,celebrating:z,onCelebrationEnd:ge,assistantId:M,escapeAvailable:k&&D.escapeEligible,onEscape:_e,onPhaseChange:_,kickError:D.kickError,confirm:{onRetry:D.retryConfirm,onGoToBilling:t},dwellMs:n,phaseMinMs:r}):l===`domain`?(0,K.jsx)(nt,{machineBusy:k,assistantId:M,onExit:()=>u(`complete`)}):(0,K.jsx)(We,{assistantId:M,direction:S})}}function $t(e){return e!=null&&!e.customized}function en(e){return $t(e)?e.name:`Custom`}var tn=[`mighty`,`super`,`ultra`],nn=[`free`,...tn];function rn(e){return nn.indexOf(e)}function an(e,t){if(e===null)return`upgrade`;let n=rn(e),r=rn(t);return n===-1||r===-1?`upgrade`:r===n?`current`:r<n?`downgrade`:`upgrade`}function on(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>tn.indexOf(e.key)-tn.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 sn={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 cn({tier:e,size:t=40}){let n=sn[e]??sn.free,r=we();return(0,K.jsx)(`div`,{"aria-hidden":!0,className:`inline-flex shrink-0`,children:r?(0,K.jsx)(Ce,{components:r,bodyShapeId:n.bodyShape,colorId:n.color,size:t}):(0,K.jsx)(`div`,{style:{width:t,height:t}})})}var ln=`Small`;function un(e){return e?.machine_size?Ee[e.machine_size]??e.machine_size:ln}function dn(e){let t=e?.credits_usd??0,n=e?.storage_gib??4;return[{icon:Ie,label:`${un(e)} Machine`},{icon:g,label:`${Q(t*100)} credits`},{icon:y,label:`${n} GB`}]}function fn(e,t=[]){let n=e?.credits_usd??0,r=e?.storage_gib??4,i=Oe[e?.machine_size??`small`];return[`${un(e)} machine${i?` (${i})`:``}`,at(r),ot(n),...t]}var pn={machine:`Configurable machine size`,storage:`Configurable storage`,credits:`Pay-as-you-go and bundled credits`};function mn(e,t){let n=[`${e.machineTier?W[e.machineTier]??t.machine_tiers.find(t=>t.tier===e.machineTier)?.label??e.machineTier:ln} Machine`];if(e.storageGib!=null&&n.push(`${e.storageGib} GB`),e.creditTier!=null){let r=ft(t,e.creditTier)?.credits_usd??dt(e.creditTier);n.push(r==null?`Credit bundle`:`${r} credits/mo`)}return n}function hn(e,t){let n=new Set([pn.machine]);return e.storageGib!=null&&n.add(pn.storage),e.creditTier!=null&&n.add(pn.credits),[...mn(e,t),...t.included_features.filter(e=>!n.has(e))]}var gn=`billing-portal-return-snapshot`;function _n(e){try{sessionStorage.removeItem(gn),sessionStorage.setItem(gn,JSON.stringify(e))}catch{}}function vn(){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 yn(){try{sessionStorage.removeItem(gn)}catch{}}function bn(e){return e?{cancel_at_period_end:e.cancel_at_period_end,cancel_at:e.cancel_at??null,plan_id:e.plan_id}:null}function xn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function Sn(e){return e?e.cancel_at??e.current_period_end??null:null}function Cn(e){let t=o();return(0,G.useEffect)(()=>R(()=>{t.invalidateQueries(pe())}),[t]),de({onSuccess:t=>{e&&_n(e),L(t.portal_url)},onError:()=>{T.error(`Couldn't open the billing portal. Please try again.`,{id:`billing-portal-session-error`})}})}function wn(e){return e.disabled===!0}function Tn({machineTiers:e,storageTiers:t,selectedMachineTier:n,selectedStorageTier:r,onMachineTierChange:i,onStorageTierChange:a,currentMachinePriceCents:o,currentStoragePriceCents:s}){let c=(0,G.useMemo)(()=>e.map(e=>{let t=W[e.tier]??e.label,n=o==null?`+${$(e.price_cents)}`:e.price_cents===o?`(${$(e.price_cents)}, current)`:it(e.price_cents-o);return{value:e.tier,label:`${t} ${n}`,disabled:wn(e)}}),[e,o]),l=(0,G.useMemo)(()=>t.map(e=>{let t=s==null?`+${$(e.price_cents)}`:e.price_cents===s?`(${$(e.price_cents)}, current)`:it(e.price_cents-s);return{value:e.tier,label:`${e.storage_gib} GB ${t}`,disabled:wn(e)}}),[t,s]);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(u,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:`Machine`}),(0,K.jsx)(`span`,{title:`Determines the CPU and memory allocated to your assistant`,children:(0,K.jsx)(b,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,K.jsx)(D,{"aria-label":`Machine tier`,placeholder:`Select a machine tier`,value:n??``,onChange:i,options:c})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(u,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:`Storage`}),(0,K.jsx)(`span`,{title:`Persistent disk space for your assistant's files and data`,children:(0,K.jsx)(b,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,K.jsx)(D,{"aria-label":`Storage tier`,placeholder:`Select a storage tier`,value:r??``,onChange:a,options:l})]})]})}var En=new Set([`active`,`trialing`,`past_due`]);function Dn(e){return e.plan_id!==`base`&&e.cancel_at_period_end!==!0&&!e.cancel_at&&e.status!=null&&En.has(e.status)}var On=[`target_plan_id`,`confirm`,`machine_tier`,`storage_tier`,`credit_tier`,`package`,`non_field_errors`];function kn(e,t){if(e&&typeof e==`object`){for(let t of On)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 An(e,t){let n=e.filter(e=>!wn(e));return t!==null&&n.some(e=>e.tier===t)?t:n[0]?.tier??null}function jn(e,t,n){return t===void 0?n:t!==null&&(t===n||e.some(e=>e.tier===t))?t:null}function Mn(e){return e.length?Math.min(...e.map(e=>e.price_cents)):0}function Nn(){let e=o(),t=c(ge());return{changePackage:async n=>{try{let r=await t.mutateAsync({body:{package:n}});return await Promise.all([e.invalidateQueries({queryKey:B()}),e.invalidateQueries({queryKey:le()}),e.invalidateQueries({queryKey:ce()})]),r}catch(e){return T.error(kn(e,`Failed to change your plan. Please try again.`)),null}},isPending:t.isPending}}function Pn({enabled:e=!0}={}){let t=o(),n=I(),r=e&&n,i=s({...pe(),enabled:r}),a=i.data,l=a!=null&&a.plan_id!==`base`,u=s({..._e(),enabled:r&&l}),d=s({...re(),enabled:r&&l}).data?.plans.find(e=>e.id===`pro`)?.machine_tiers??[],f=e=>d.find(t=>t.tier===e)?.price_cents??null,p=c(z()),m=c(ue()),h=c(ve()),g={machineTier:u.data?.max_machine_tier??null,storageTier:u.data?.selected_storage_tier??null,storageGib:u.data?.selected_storage_gib??null,creditTier:a?.selected_credit_tier??null},_=a!=null&&a.plan_id!==`base`&&a.status!=null&&En.has(a.status)&&a.cancel_at_period_end!==!0&&!a.cancel_at,v=!l||!u.isPending,y=!l||u.isSuccess&&u.data!=null&&!u.isFetching&&u.dataUpdatedAt>=i.dataUpdatedAt,b=p.isPending||m.isPending||h.isPending,x=()=>Promise.all([t.invalidateQueries({queryKey:B()}),t.invalidateQueries({queryKey:ce()}),t.invalidateQueries({queryKey:le()})]);return{changeTiers:async e=>{let t=e.machineTier!==g.machineTier,n=e.storageTier!==g.storageTier,r=e.creditTier!==g.creditTier,i=f(e.machineTier),a=f(g.machineTier),o=t&&i!=null&&a!=null&&i<a,s=[];if(t&&s.push(new Promise(t=>{p.mutate({body:{machine_tier:e.machineTier}},{onSuccess:()=>t({dimension:`machine`,ok:!0}),onError:e=>t({dimension:`machine`,ok:!1,error:e})})})),n&&s.push(new Promise(t=>{m.mutate({body:{storage_tier:e.storageTier}},{onSuccess:()=>t({dimension:`storage`,ok:!0}),onError:e=>t({dimension:`storage`,ok:!1,error:e})})})),r&&s.push(new Promise(t=>{h.mutate({body:{credit_tier:e.creditTier}},{onSuccess:()=>t({dimension:`credit`,ok:!0}),onError:e=>t({dimension:`credit`,ok:!1,error:e})})})),s.length===0)return{needsResize:!1,creditChanged:!1};let c=await Promise.all(s);await x();let l=c.some(e=>e.ok&&e.dimension===`machine`)&&!o,u=c.some(e=>e.ok&&e.dimension===`storage`),d=l||u,_=c.some(e=>e.ok&&e.dimension===`credit`),v=c.filter(e=>!e.ok);if(v.length>0){let e=v.map(e=>kn(e.error,`Failed to update ${e.dimension} tier.`)).join(` `);return T.error(e),d||_?{needsResize:d,creditChanged:_}:null}return{needsResize:d,creditChanged:_}},isPending:b,current:g,eligible:_,currentReady:v,currentKnown:y,primaryAssistantId:y?u.data?.primary_assistant_id??null:null}}var Fn=`__none__`,In=`No extra credits`;function Ln(e){let{proPlan:t,seed:n,machineTier:r,storageTier:i,creditChoice:a}=e,o=t.machine_tiers,s=t.storage_tiers,c=t.credit_tiers??[],l=o.find(e=>e.tier===r)??null,u=s.find(e=>e.tier===i)??null,d=a&&a!==`__none__`?c.find(e=>e.tier===a)??null:null,f=n==null?null:o.find(e=>e.tier===n.machineTier)??null,p=n==null?null:s.find(e=>e.tier===n.storageTier)??null,m=n!=null&&n.creditTier!=null?c.find(e=>e.tier===n.creditTier)??null:null,h=n!=null&&n.machineTier!=null&&f==null,g=n!=null&&p==null,_=[{key:`base`,label:`Platform fee: ${$(t.base_price_cents)}`,changed:!1}];if(l!=null){let e=n!=null&&!h&&f?.tier!==l.tier;_.push({key:`machine`,label:l.description,previousLabel:e&&f!=null?f.description:void 0,changed:e})}if(u!=null){let e=n!=null&&!g&&p?.tier!==u.tier;_.push({key:`storage`,label:at(u.storage_gib),previousLabel:e&&p!=null?at(p.storage_gib):void 0,changed:e})}let v=a===`__none__`?In:d==null?null:ot(d.credits_usd);if(v!=null){let e=n!=null&&(n.creditTier??`__none__`)!==a,t=n?.creditTier==null?In:m==null?void 0:ot(m.credits_usd);_.push({key:`credit`,label:v,previousLabel:e?t:void 0,changed:e})}let y=t.base_price_cents+(l?.price_cents??0)+(u?.price_cents??0)+(d?.price_cents??0),b=h||g||n!=null&&n.creditTier!=null&&m==null;if(n==null||b)return{totalCents:y,previousTotalCents:null,deltaCents:null,rows:_};let x=t.base_price_cents+(f?.price_cents??0)+(p?.price_cents??0)+(m?.price_cents??0);return{totalCents:y,previousTotalCents:x,deltaCents:y-x,rows:_}}function Rn(e){return(0,K.jsxs)(`span`,{className:`text-[12px] font-medium text-[var(--content-disabled)]`,children:[`+`,$(e)]})}function zn({open:e,proPlan:t,pending:r,currentStorageGib:i,initialSelection:a,onClose:o,onContinue:s}){let c=e?a??null:null,[l,u]=(0,G.useState)(()=>c?.machineTier??``),[d,f]=(0,G.useState)(()=>c?.storageTier??``),[p,m]=(0,G.useState)(()=>c?c.creditTier??`__none__`:``),[_,b]=(0,G.useState)({open:e,initialSelection:a});(_.open!==e||_.initialSelection!==a)&&(b({open:e,initialSelection:a}),u(c?.machineTier??``),f(c?.storageTier??``),m(c?c.creditTier??`__none__`:``));let x=t.machine_tiers,S=(0,G.useMemo)(()=>t.storage_tiers.filter(e=>!e.legacy||e.tier===a?.storageTier),[t.storage_tiers,a?.storageTier]),C=t.credit_tiers??[],T=(0,G.useMemo)(()=>(t.credit_tiers??[]).filter(e=>!e.legacy),[t.credit_tiers]),E=e=>wn(e)||e.legacy&&e.tier!==a?.storageTier||i!=null&&e.storage_gib<i,O=x.map(e=>({value:e.tier,label:e.description,icon:(0,K.jsx)(Ie,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:Rn(e.price_cents),disabled:wn(e)})),k=S.map(e=>({value:e.tier,label:e.label,icon:(0,K.jsx)(y,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:Rn(e.price_cents),disabled:E(e)})),A=p&&p!==`__none__`?C.find(e=>e.tier===p)??null:null,j=A?.legacy?A:null,M=[{value:Fn,label:In,icon:(0,K.jsx)(g,{className:`h-4 w-4`,"aria-hidden":!0})},...T.map(e=>({value:e.tier,label:e.label,icon:(0,K.jsx)(g,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:Rn(e.price_cents)})),...j?[{value:j.tier,label:j.label,icon:(0,K.jsx)(g,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:Rn(j.price_cents),disabled:!0}]:[]],ee=x.find(e=>e.tier===l)??null,N=d!==``&&d===a?.storageTier,P=S.find(e=>e.tier===d&&(N||!E(e)))??null,te=p===`__none__`||p===a?.creditTier||T.some(e=>e.tier===p),F=p!==``&&te?p:null,ne=ee!=null&&P!=null&&F!=null,I=a!=null&&l===(a.machineTier??``)&&d===a.storageTier&&p===(a.creditTier??`__none__`),L=(0,G.useMemo)(()=>Ln({proPlan:t,seed:a??null,machineTier:l,storageTier:d,creditChoice:p}),[t,a,l,d,p]);return(0,K.jsx)(w.Root,{open:e,onOpenChange:e=>{e||o()},children:(0,K.jsx)(w.Content,{size:`lg`,"data-theme":`light`,hideCloseButton:!0,overlayClassName:`backdrop-blur-[2px]`,className:`max-w-[820px] md:min-h-[min(608px,calc(100vh-4rem))]`,children:(0,K.jsx)(w.Body,{className:`p-4`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-8 md:flex-row md:gap-12`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6 md:flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`flex shrink-0 items-center justify-center rounded-xl bg-[var(--surface-active)] p-[14px]`,children:(0,K.jsx)(v,{className:`h-6 w-6 text-[var(--content-emphasised)]`,"aria-hidden":!0})}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,K.jsx)(w.Title,{className:`text-[16px] font-medium text-[var(--content-emphasised)]`,children:`Create a custom plan`}),(0,K.jsx)(w.Description,{className:`mt-0 text-[14px] font-medium leading-[18px] text-[var(--content-tertiary)]`,children:`Just better.`})]})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-secondary)]`,children:`Select a machine size:`}),(0,K.jsx)(D,{"aria-label":`Machine size`,placeholder:`Select a machine size`,value:l,onChange:u,options:O})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-secondary)]`,children:`Select storage:`}),(0,K.jsx)(D,{"aria-label":`Storage`,placeholder:`Select storage`,value:d,onChange:f,options:k})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-secondary)]`,children:`Bundle some credits:`}),(0,K.jsx)(D,{"aria-label":`Credit bundle`,placeholder:`Select a credit bundle`,value:p,onChange:m,options:M})]})]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-16 md:pt-[5px]`,children:[(0,K.jsx)(`span`,{className:`text-[16px] font-medium text-[var(--content-emphasised)]`,children:`Recap`}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`text-[24px] font-medium text-[var(--content-default)]`,children:$(L.totalCents)}),L.deltaCents!=null&&L.deltaCents!==0&&L.previousTotalCents!=null&&(0,K.jsxs)(`span`,{className:`text-[12px] font-medium ${L.deltaCents>0?`text-[var(--system-positive-strong)]`:`text-[var(--system-negative-strong)]`}`,children:[it(L.deltaCents),` compared to previous (`,Q(L.previousTotalCents),`)`]}),(0,K.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-tertiary)]`,children:`Total`})]}),(0,K.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,K.jsx)(`span`,{className:`text-[12px] font-medium text-[var(--content-tertiary)]`,children:`Your selection:`}),(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:L.rows.map(e=>(0,K.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[e.previousLabel!=null&&(0,K.jsxs)(`div`,{className:`relative flex w-fit items-start gap-2`,children:[(0,K.jsx)(h,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-disabled)]`,"aria-hidden":!0}),(0,K.jsx)(`s`,{className:`text-[14px] font-medium leading-[18px] text-[var(--content-disabled)] no-underline`,children:e.previousLabel}),(0,K.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute -left-1 right-0 top-[9px] h-px bg-[var(--content-disabled)]`})]}),(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(h,{className:`mt-0.5 h-4 w-4 shrink-0 ${e.changed?`text-[var(--system-positive-strong)]`:`text-[var(--content-secondary)]`}`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`text-[14px] font-medium leading-[18px] text-[var(--content-secondary)]`,children:e.label})]})]},e.key))}),(0,K.jsx)(n,{variant:`primary`,fullWidth:!0,disabled:!ne||I||r,onClick:()=>{!ne||I||r||s({machineTier:ee.tier,storageTier:P.tier,creditTier:F===`__none__`?null:F})},children:`Continue`}),(0,K.jsx)(n,{variant:`ghost`,fullWidth:!0,disabled:r,onClick:o,children:`Cancel`})]})]})]})})})})}function Bn({className:e,"data-testid":t,children:n}){return(0,K.jsx)(`div`,{"aria-hidden":!0,"data-testid":t,className:H(`flex size-[52px] shrink-0 items-center justify-center rounded-xl`,e),children:n})}var Vn=32;function Hn(){let{ready:e,avatar:t}=_t();return(0,K.jsx)(Bn,{"data-testid":`assistant-avatar-tile`,className:`bg-[var(--surface-active)]`,children:e?(0,K.jsx)(Se,{components:t.components,traits:t.traits,customImageUrl:t.customImageUrl,size:Vn}):null})}var Un={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:`Stronger performance for heavier workloads.`,cta:`Go Super`,priceCaption:`Billed monthly`,extraFeatures:[`Assistant email and subdomain`]},ultra:{tagline:`Built for sustained, high-demand work.`,cta:`Unleash Ultra`,priceCaption:`Billed monthly`,extraFeatures:[`Assistant email and subdomain`]}};function Wn(e){return Un[e]}function Gn(e){return`Downgrade to ${e}`}var Kn=`Billed monthly · prorated difference charged today`,qn=`Billed monthly · prorated difference charged today or credited next invoice`,Jn=`Billed monthly · prorated credit on your next invoice`,Yn=`Your machine downsizes now and your storage stays. No refund.`,Xn=`Continue`,Zn=`The plan includes`,Qn=`Your plan will include`;function $n(e,t,n){let r=n?Wn(n)?.tagline??``:``;switch(e){case`downgrade`:return{title:Gn(t),subtitle:``,priceCaption:Jn,checklistHeading:Qn,note:Yn,confirmLabel:Gn(t),destructive:!0};case`switch`:return{title:`Switch to ${t}`,subtitle:r,priceCaption:qn,checklistHeading:Zn,note:``,confirmLabel:Xn,destructive:!1};default:return{title:`Upgrade to ${t}`,subtitle:r,priceCaption:Kn,checklistHeading:Zn,note:``,confirmLabel:Xn,destructive:!1}}}function er({open:e,relation:t,packageName:r,targetPackage:i,pending:a,onCancel:o,onConfirm:s}){let c=(0,G.useRef)(null),l=(0,G.useId)(),d=$n(t,r,i?.key??null),f=i?{price:$(i.total_price_cents),highlights:fn(i,Wn(i.key)?.extraFeatures??[])}:null,p=d.subtitle,m=d.note?{"aria-describedby":l}:p?{}:{"aria-describedby":void 0};return(0,K.jsx)(w.Root,{open:e,onOpenChange:e=>{!e&&!a&&o()},children:(0,K.jsxs)(w.Content,{size:`sm`,hideCloseButton:!0,className:`gap-4 p-4 max-w-[421px]`,onOpenAutoFocus:e=>{e.preventDefault(),c.current?.focus()},...m,children:[(0,K.jsxs)(w.Header,{className:`flex-row items-center gap-3 p-0 pb-2`,children:[d.destructive?(0,K.jsx)(Bn,{"data-testid":`package-switch-warning-tile`,className:`bg-[var(--system-negative-weak)]`,children:(0,K.jsx)(S,{className:`size-6 text-[var(--system-negative-strong)]`})}):(0,K.jsx)(Hn,{}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,K.jsx)(w.Title,{className:`text-title-small text-[var(--content-emphasised)] [&>span]:whitespace-normal`,children:d.title}),p?(0,K.jsx)(w.Description,{className:`mt-0 text-body-medium-default text-[var(--content-tertiary)]`,children:p}):null]})]}),f?(0,K.jsxs)(w.Body,{className:`flex flex-col gap-4 p-0`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsx)(u,{as:`p`,variant:`title-large`,className:`text-[var(--content-default)]`,children:f.price}),(0,K.jsx)(u,{as:`p`,variant:`label-medium-default`,className:`leading-[15px] text-[var(--content-tertiary)]`,children:d.priceCaption})]}),(0,K.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,K.jsx)(u,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,children:d.checklistHeading}),(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:f.highlights.map(e=>(0,K.jsxs)(`li`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(h,{className:`size-4 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,K.jsx)(u,{as:`span`,variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]},e))})]}):null,d.note?(0,K.jsx)(u,{id:l,as:`p`,variant:`body-medium-default`,className:`text-[var(--content-secondary)]`,children:d.note}):null,(0,K.jsxs)(w.Footer,{className:`flex-col gap-4 p-0`,children:[(0,K.jsx)(n,{fullWidth:!0,variant:d.destructive?`danger`:`primary`,onClick:s,disabled:a,"data-testid":`confirm-package-switch-button`,children:d.confirmLabel}),(0,K.jsx)(n,{ref:c,fullWidth:!0,variant:`ghost`,onClick:o,disabled:a,children:`Cancel`})]})]})})}function tr(){let e=o();(0,G.useEffect)(()=>R(()=>{e.invalidateQueries({queryKey:B()}),e.invalidateQueries({queryKey:le()}),e.invalidateQueries({queryKey:ce()})}),[e])}export{an as A,un as C,$t as D,tn as E,Z as F,X as I,it as M,Q as N,on as O,$ as P,mn as S,cn as T,xn as _,zn as a,Cn as b,En as c,Mn as d,jn as f,yn as g,bn as h,Wn as i,Qt as j,en as k,kn as l,Tn as m,er as n,Pn as o,An as p,Gn as r,Nn as s,tr as t,Dn as u,Sn as v,dn as w,hn as x,vn as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{n}from"./QueryClientProvider-CMu7CkQU.js";import{t as r}from"./useQuery-Bz-fbQ-m.js";import{t as i}from"./createLucideIcon-CAM1RhH8.js";import{t as a}from"./calendar-RYdAv74D.js";import{t as o}from"./globe-BDvXuPkw.js";import{t as s}from"./layout-grid-PPpVK0nJ.js";import{t as c}from"./message-square-zCNXaHYX.js";import{t as l}from"./monitor-B5vtTCxm.js";import{t as u}from"./settings-DyEBEqeQ.js";import{n as d,t as f}from"./create-selectors-B-P03-8K.js";import{dt as p,f as m,h,r as g}from"./local-mode-9zpgPNoq.js";import{t as _}from"./is-electron-7N7iyz1y.js";import{n as v}from"./resolved-assistants-store-8HQDfxZh.js";import{i as y}from"./utils-C-YNXdkX.js";import{i as b,n as x}from"./api-errors-SZKDzMLE.js";import{$ as S,Q as C,ct as w,rt as T,tt as E}from"./auth-store-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{n}from"./QueryClientProvider-CMu7CkQU.js";import{t as r}from"./useQuery-Bz-fbQ-m.js";import{t as i}from"./createLucideIcon-CAM1RhH8.js";import{t as a}from"./calendar-RYdAv74D.js";import{t as o}from"./globe-BDvXuPkw.js";import{t as s}from"./layout-grid-PPpVK0nJ.js";import{t as c}from"./message-square-zCNXaHYX.js";import{t as l}from"./monitor-B5vtTCxm.js";import{t as u}from"./settings-DyEBEqeQ.js";import{n as d,t as f}from"./create-selectors-B-P03-8K.js";import{dt as p,f as m,h,r as g}from"./local-mode-9zpgPNoq.js";import{t as _}from"./is-electron-7N7iyz1y.js";import{n as v}from"./resolved-assistants-store-8HQDfxZh.js";import{i as y}from"./utils-C-YNXdkX.js";import{i as b,n as x}from"./api-errors-SZKDzMLE.js";import{$ as S,Q as C,ct as w,rt as T,tt as E}from"./auth-store-BwKMFgpK.js";import{nt as D}from"./sdk.gen-DVW3wpbx.js";import{rr as O}from"./sdk.gen-BySz4QYj.js";import{d as k}from"./routes-GmNvdtLW.js";import{i as A,r as ee}from"./use-is-org-ready-zouQ5CN4.js";import{a as te,i as j,r as M}from"./feature-flag-catalog-CWHnoWvT.js";import{t as N}from"./client-feature-flag-store-Bg5XEI2b.js";import{t as P}from"./haptics-rJpeBta-.js";import{F as ne}from"./react-query.gen-BVTEjHsw.js";import{s as F}from"./chat-BIJEFb5u.js";var I=i(`contact`,[[`path`,{d:`M16 2v2`,key:`scm5qe`}],[`path`,{d:`M7 22v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2`,key:`1waht3`}],[`path`,{d:`M8 2v2`,key:`pbkmx`}],[`circle`,{cx:`12`,cy:`11`,r:`3`,key:`itu57m`}],[`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`,key:`12vinp`}]]),L=i(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),R=e(t(),1);function z({sessionStatus:e,hasPlatformSession:t}){let r=n(),i=ee(),a=T(e)&&!p()&&(t||!m())&&i,o=N.use.multiPlatformAssistant();v.use.selectedAssistantId(),v.use.assistants();let s=C(),c=o&&!p()&&s?S(s):null,l=c&&!g().some(e=>e.assistantId===c)?c:null,{data:u}=w({enabled:a,selectedPlatformAssistantId:l});(0,R.useEffect)(()=>{E.setInputs({sessionStatus:e,hasPlatformSession:t,queryClient:r,selectedPlatformAssistantId:l,isOrgReady:i}),E.respondToInputs()},[e,t,r,l,i]),(0,R.useEffect)(()=>{u&&E.applyServerResult(u)},[u])}var B=`0.8.5`,V=5e3,H=6e4;function U(e,t=!0){return y(B)&&t?{staleTime:e,refetchInterval:!1}:{staleTime:V,refetchInterval:V}}function W(){return U(H)}function G(e){return U(1/0,e)}var K=new Set(Object.keys(M)),q=new Set(Object.keys(j));async function J(e){let t=N.getState().scopeKey,{data:n,error:r,response:i}=await D({throwOnError:!1,signal:e});if(x(i,r,`Failed to fetch client feature flags`),!i.ok||!n)throw b(r,i);return{scopeKey:t,flags:n.flags}}function Y(e){let t={},n={};for(let[r,i]of Object.entries(e)){let e=te(r);typeof i==`boolean`&&K.has(e)?t[e]=i:typeof i==`string`&&q.has(e)&&(n[e]=i)}return{boolFlags:t,stringFlags:n}}function X(e,t=!1){let n=G(t),i=A(),a=N.use.scopeKey(),o=e&&!h(),s=o&&i===`ready`,{data:c,isError:l}=r({queryKey:ne(),queryFn:({signal:e})=>J(e),enabled:s,...n,refetchOnWindowFocus:!1,refetchOnReconnect:!1});(0,R.useEffect)(()=>{if(c?.flags){let{boolFlags:e,stringFlags:t}=Y(c.flags),n=N.getState();n.setFlags(e,c.scopeKey),Object.keys(t).length>0&&n.setStringFlags(t,c.scopeKey);return}e&&(!o||i===`unavailable`||l)&&N.getState().settleWithoutServerValues(a)},[a,c,e,l,o,i])}var Z=f(d((e,t)=>({isOpen:!1,open:()=>e({isOpen:!0}),close:()=>e({isOpen:!1}),toggle:()=>e({isOpen:!t().isOpen})})));async function re(){if(!_())return!1;let e=window.vellum?.commandPalette?.open;return e?(await e(),!0):!1}async function ie(){_()&&await window.vellum?.commandPalette?.dismiss()}async function ae(e){_()&&await window.vellum?.commandPalette?.select(e)}var Q={query:``,queryTokens:[],results:{conversations:[],memories:[],schedules:[],contacts:[]}};function oe(e,t){return e||t.split(/\s+/).filter(e=>e.length>0)}async function se(e,t,n){let r=n?.limit??10;try{let{data:i,response:a}=await O({path:{assistant_id:e},query:{q:t,limit:r,categories:`conversations,schedules,contacts`},throwOnError:!1,signal:n?.signal});return!a?.ok||!i?Q:{query:i.query,queryTokens:oe(i.queryTokens,i.query),results:i.results}}catch(n){return n instanceof DOMException&&n.name===`AbortError`||console.error(`[global-search] search failed`,{assistantId:e,query:t,err:n}),Q}}var ce=150,le=2,$=[];function ue({itemCount:e,onSelect:t,assistantId:n,isOpen:r,onClose:i}){let a=Z.use.isOpen(),o=r??a,s=Z.use.open(),c=Z.use.close(),[l,u]=(0,R.useState)(``),[d,f]=(0,R.useState)(0),[p,m]=(0,R.useState)(!1),[h,g]=(0,R.useState)(null),[_,v]=(0,R.useState)($),y=(0,R.useRef)(()=>0);(0,R.useLayoutEffect)(()=>{y.current=typeof e==`function`?e:()=>e});let b=(0,R.useRef)(null),x=(0,R.useRef)(null),S=(0,R.useCallback)(()=>{b.current&&=(clearTimeout(b.current),null),x.current?.abort(),x.current=null},[]),C=(0,R.useCallback)(()=>{s(),f(0)},[s]),w=(0,R.useCallback)(()=>{c(),u(``),f(0),m(!1),g(null),v($),S(),i?.()},[c,S,i]),T=(0,R.useCallback)(()=>{o?w():C()},[o,w,C]);(0,R.useEffect)(()=>{o||(u(``),f(0),m(!1),g(null),v($),S())},[o,S]);let E=(0,R.useCallback)(e=>{S();let t=e.trim();if(t.length<le||!n){m(!1),g(null),v($);return}m(!0),b.current=setTimeout(()=>{if(!n){m(!1);return}let e=new AbortController;x.current=e,se(n,t,{signal:e.signal}).then(t=>{x.current===e&&(g(t.results),v(t.queryTokens),m(!1))}).catch(()=>{x.current===e&&m(!1)})},ce)},[S,n]),D=(0,R.useCallback)(e=>{u(e),f(0),E(e)},[E]);return(0,R.useEffect)(()=>()=>{x.current?.abort(),b.current&&clearTimeout(b.current)},[]),{isOpen:o,query:l,selectedIndex:d,isSearching:p,searchResults:h,searchTokens:_,open:C,close:w,toggle:T,setQuery:D,handleKeyDown:(0,R.useCallback)(e=>{if(e.key===`k`&&(e.metaKey||e.ctrlKey)){e.preventDefault(),w();return}let n=y.current();switch(e.key){case`ArrowDown`:e.preventDefault(),n>0&&f(e=>Math.min(e+1,n-1));break;case`ArrowUp`:e.preventDefault(),f(e=>Math.max(e-1,0));break;case`Enter`:e.preventDefault(),n>0&&t?.(d);break;case`Escape`:e.preventDefault(),w();break}},[t,d,w])}}function de(e){return{id:`actions`,label:`Actions`,items:[{id:`action-new-conversation`,icon:L,title:`New Conversation`,shortcutHint:_()?`⌘N`:`⌘⇧O`},{id:`action-current-conversation`,icon:l,title:`Current Conversation`,shortcutHint:`⌘⇧N`},{id:`action-settings`,icon:u,title:`Settings`,shortcutHint:`⌘,`},{id:`action-library`,icon:s,title:`Library`},{id:`action-intelligence`,icon:o,title:e}]}}function fe(e,t){let n=[],r=e.conversations.filter(e=>!t.has(e.id)).map(e=>({id:`search-conv-${e.id}`,icon:c,title:e.title??`Untitled`,snippet:e.excerpt||void 0}));r.length>0&&n.push({id:`search-conversations`,label:`Conversations`,items:r});let i=e.schedules.map(e=>({id:`search-schedule-${e.id}`,icon:a,title:e.name,subtitle:e.expression??e.message}));i.length>0&&n.push({id:`search-schedules`,label:`Schedules`,items:i});let o=e.contacts.map(e=>({id:`search-contact-${e.id}`,icon:I,title:e.displayName,subtitle:e.notes??void 0}));return o.length>0&&n.push({id:`search-contacts`,label:`Contacts`,items:o}),n}function pe(e){return{id:`conversations`,label:`Recent`,items:e.slice(0,5).map(e=>({id:`conv-${e.conversationId}`,icon:c,title:e.title??`Untitled`,subtitle:e.lastMessageAt?F(e.lastMessageAt):void 0}))}}function me(e,t){switch(e.id){case`action-new-conversation`:t.startNewConversation();break;case`action-current-conversation`:P.light(),t.navigate(k.assistant);break;case`action-settings`:P.light(),t.navigateToSettings();break;case`action-intelligence`:P.light(),t.navigate(k.identity);break;case`action-library`:P.light(),t.navigate(k.library.root);break;default:if(e.id.startsWith(`conv-`)){let n=e.id.slice(5);t.switchConversation(n)}else if(e.id.startsWith(`search-conv-`)){let n=e.id.slice(12);t.switchConversation(n)}else e.id.startsWith(`search-schedule-`)?(P.light(),t.navigate(k.schedules.detail(e.id.slice(16)))):e.id.startsWith(`search-contact-`)&&(P.light(),t.navigate(k.identity));break}}function he({assistantId:e,assistantName:t,conversations:n,activeConversationId:r,startNewConversation:i,switchConversation:a,navigate:o,navigateToSettings:s,isOpen:c,onClose:l,onItemSelect:u}){let d=(0,R.useMemo)(()=>{let e=de(t??`Assistant`),r=pe(n);return[e,...r.items.length>0?[r]:[]]},[n,t]),f=(0,R.useMemo)(()=>new Set(n.slice(0,5).map(e=>e.conversationId)),[n]),p=(0,R.useCallback)(e=>{if(u){u(e);return}me(e,{startNewConversation:i,switchConversation:a,navigate:o,activeConversationId:r,navigateToSettings:s})},[i,a,o,r,s,u]),m=(0,R.useRef)([]),h=(0,R.useRef)(()=>{}),g=ue({itemCount:()=>m.current.reduce((e,t)=>e+t.items.length,0),onSelect:(0,R.useCallback)(e=>{let t=e;for(let e of m.current){if(t<e.items.length){let n=e.items[t];p(n),h.current();return}t-=e.items.length}},[p]),assistantId:e,isOpen:c,onClose:l});(0,R.useLayoutEffect)(()=>{h.current=g.close});let _=(0,R.useMemo)(()=>{if(!g.query.trim())return d;let e=g.query.toLowerCase().trim();return d.map(t=>({...t,items:t.items.filter(t=>t.title.toLowerCase().includes(e))})).filter(e=>e.items.length>0)},[d,g.query]),v=(0,R.useMemo)(()=>{let e=g.searchResults?fe(g.searchResults,f):[];return[..._,...e]},[_,g.searchResults,f]);return(0,R.useLayoutEffect)(()=>{m.current=v}),{commandPalette:g,mergedSections:v,handleItemSelect:(0,R.useCallback)(e=>{p(e),h.current()},[p])}}export{Z as a,z as c,ae as i,L as l,ie as n,X as o,re as r,W as s,he as t,I as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./haptics-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./haptics-rJpeBta-.js";import{t as r}from"./pointer-QlIwQKYH.js";var i=e(t(),1),a=.5,o=100,s=.3,c=.7,l=10,u=.3;function d(e){return Math.min(o,e*s)}function f(e){return e*a}function p(e){return e instanceof Element?e.closest(`input, textarea, select, [contenteditable]:not([contenteditable="false"]), [data-message-text]`)!==null:!1}function m(e,t,n){return!(e>f(t)||n&&e>20)}function h(e,t){return Math.abs(t)>Math.abs(e)*c}function g(e,t){return Math.abs(e)<l&&Math.abs(t)<l?`pending`:h(e,t)||e<=0?`cancel`:`confirm`}function _(e,t){return e<=t?e:t+(e-t)*u}function v(e,t){return Math.min(0,e-t)}function y(e,t){return e>=t}function b(e,t){for(let n=0;n<e.length;n+=1){let r=e[n];if(r&&r.identifier===t)return r}return null}function x({enabled:e,onConfirm:t,onMove:a,onCommit:o,onCancel:s}){let c=(0,i.useRef)(null),l=(0,i.useRef)(e),u=(0,i.useRef)({onConfirm:t,onMove:a,onCommit:o,onCancel:s});(0,i.useLayoutEffect)(()=>{l.current=e,u.current={onConfirm:t,onMove:a,onCommit:o,onCancel:s}}),(0,i.useEffect)(()=>{if(!r())return;let e=()=>d(window.innerWidth),t=e=>{c.current=null,u.current.onCancel(e)},i=e=>{if(!l.current||c.current||e.touches.length!==1)return;let t=e.touches[0];t&&m(t.clientX,window.innerWidth,p(e.target))&&(c.current={touchId:t.identifier,startX:t.clientX,startY:t.clientY,confirmed:!1,hasFiredHaptic:!1})},a=r=>{let i=c.current;if(!i)return;if(r.touches.length>1){t(!1);return}let a=b(r.touches,i.touchId);if(!a)return;let o=a.clientX-i.startX,s=a.clientY-i.startY;if(!i.confirmed){let e=g(o,s);if(e===`pending`)return;if(e===`cancel`){t(!1);return}i.confirmed=!0,u.current.onConfirm?.()}let l=e();if(h(o,s)&&o<l){t(!0);return}o>=l&&!i.hasFiredHaptic&&(i.hasFiredHaptic=!0,n.light()),u.current.onMove(o,l,a.clientX)},o=n=>{let r=c.current;if(!r)return;let i=b(n.changedTouches,r.touchId),a=i?i.clientX-r.startX:0,o=e();r.confirmed&&y(a,o)?(c.current=null,u.current.onCommit(a,o)):r.confirmed?t(!0):t(!1)},s=()=>{t(c.current?.confirmed??!1)};return document.addEventListener(`touchstart`,i,{passive:!0}),document.addEventListener(`touchmove`,a,{passive:!0}),document.addEventListener(`touchend`,o,{passive:!0}),document.addEventListener(`touchcancel`,s,{passive:!0}),()=>{c.current=null,document.removeEventListener(`touchstart`,i),document.removeEventListener(`touchmove`,a),document.removeEventListener(`touchend`,o),document.removeEventListener(`touchcancel`,s)}},[])}export{_ as n,x as r,v as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{n,r}from"./use-edge-swipe-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{n,r}from"./use-edge-swipe-Gst62FjL.js";import{t as i}from"./edge-swipe-arbiter-store-D9XJTxJJ.js";var a=e(t(),1),o=200,s=180,c=200,l=.25,u=50;function d(e){e.style.transition=``,e.style.transform=``,e.style.willChange=``,e.style.opacity=``}function f({containerRef:e,onBack:t,enabled:f,navKey:p}){let m=(0,a.useRef)(t);(0,a.useLayoutEffect)(()=>{m.current=t},[t]);let h=(0,a.useRef)(!1),g=(0,a.useRef)(new Set),_=(0,a.useRef)(!1),v=i.use.registerBackOwner(),y=i.use.unregisterBackOwner();(0,a.useEffect)(()=>{if(f)return v(),y},[f,v,y]),(0,a.useEffect)(()=>{_.current=!1;let t=g.current;return()=>{_.current=!0;for(let e of t)clearTimeout(e);t.clear();let n=e.current;n&&d(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 ${o}ms ease-out`,x(e,0);let t=()=>{e.removeEventListener(`transitionend`,t),d(e)};e.addEventListener(`transitionend`,t,{once:!0}),b(()=>d(e),o+u)},C=e=>{e.style.transition=`transform ${s}ms ease-in`,x(e,window.innerWidth);let t=!1,n=()=>{if(t||_.current)return;t=!0,e.removeEventListener(`transitionend`,n);let r=-(window.innerWidth*l);e.style.transition=`none`,e.style.transform=`translateX(${r}px)`,e.style.opacity=`0`,e.offsetWidth,h.current=!0,m.current(),b(()=>{h.current&&(h.current=!1,d(e))},c*2)};e.addEventListener(`transitionend`,n,{once:!0}),b(n,s+u)};r({enabled:f,onConfirm:()=>{let t=e.current;t&&(t.style.transition=`none`,t.style.willChange=`transform`)},onMove:(t,r)=>{let i=e.current;i&&x(i,n(t,r))},onCommit:()=>{let t=e.current;if(!t){m.current();return}C(t)},onCancel:t=>{let n=e.current;n&&(t?S(n):d(n))}}),(0,a.useLayoutEffect)(()=>{if(!h.current)return;h.current=!1;let t=e.current;if(!t)return;let n=!1,r=()=>{n||(n=!0,t.removeEventListener(`transitionend`,r),d(t))};t.style.transition=`transform ${c}ms ease-out, opacity ${c}ms ease-out`,t.style.transform=``,t.style.opacity=``,t.addEventListener(`transitionend`,r,{once:!0});let i=setTimeout(r,c+u);return()=>{clearTimeout(i),t.removeEventListener(`transitionend`,r),d(t)}},[p,e])}export{f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{o as t,r as n,s as r,t as i}from"./local-settings-C-dW2vkq.js";import{s as a}from"./device-settings-DXp9L4iB.js";import{t as o}from"./react-BFJW0bSv.js";import{t as s}from"./button-Dy5001j6.js";import{t as c}from"./jsx-runtime-D3ZM-ToX.js";import{t as l}from"./createLucideIcon-CAM1RhH8.js";import{t as u}from"./checkbox-BZTUJtxM.js";import{t as d}from"./triangle-alert--e3n47gm.js";import{t as f}from"./notice-DCp7WO3L.js";import"./src-BAS7a2RG.js";import{t as p}from"./modal-DwsThLGg.js";import{i as m,t as h}from"./api-C8TlQNEU.js";import{i as g,r as _}from"./typed-storage-C-R1po3l.js";import{t as v}from"./client-feature-flag-store-Bg5XEI2b.js";import{n as y,r as b,t as x}from"./theme-preferences-LQuLaIA6.js";import{t as S}from"./use-bus-subscription-CyRPH_gr.js";import{o as C}from"./funnel-events-BAmjKdwH.js";var w=l(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),T=l(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]);function ee(){return v.use.stringFlags().proactiveTips??`off`}function te(e){return e===`on`}function E(e){return e===void 0||typeof e==`number`&&Number.isFinite(e)}function D(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.shownCount==`number`&&Number.isFinite(t.shownCount)&&E(t.dismissedAt)&&E(t.lastShownAt)}function O(e){let t=JSON.parse(e);if(!t||typeof t!=`object`||Array.isArray(t))return null;let n={};for(let[e,r]of Object.entries(t))D(r)&&(n[e]=r);return n}function k(e){let t=Number(e);return Number.isFinite(t)&&t>=0?t:null}var A=_({key:`device:tips:records`,scope:`device`,parse:O,serialize:JSON.stringify,fallback:{}}),ne=_({key:`device:tips:enabled`,scope:`device`,parse:g,serialize:String,fallback:!0}),j=_({key:`device:tips:first_seen_at`,scope:`device`,parse:k,serialize:String,fallback:0});function re(){j.load()===0&&j.save(Date.now())}function ie(e,t){let n=A.load(),r=n[e];A.save({...n,[e]:{...r,lastShownAt:t,shownCount:(r?.shownCount??0)+1}})}function ae(e,t){let n=A.load(),r=n[e];A.save({...n,[e]:{...r,dismissedAt:t,shownCount:r?.shownCount??0}})}var oe=`proactive-tips-v1`,se={impression:0,learn_more:1,dismiss:2,dont_show_again:3,click:4,completion:5};function M(e,t,n){C({stepName:t,stepIndex:se[t]},{funnelVersion:oe,screen:e,variant:n})}var N=e(o(),1);function P(){let e=v.use.velvet(),[t,n]=(0,N.useState)(()=>y({velvetEnabled:e}));return(0,N.useEffect)(()=>{n(y({velvetEnabled:e}))},[e]),(0,N.useEffect)(()=>a(`theme`,()=>{n(y({velvetEnabled:e}))}),[e]),(0,N.useEffect)(()=>{x(t)},[t]),{theme:t,setThemePreference:e=>{n(e),b(e)}}}var F=6e4;function I(e){return!!(e?.enabled&&e.effectivelyLocked)}function L(e){return I(e)?e.acknowledged&&!e.overrideActive:!1}function R(e){return!!(e&&I(e)&&!e.acknowledged&&!e.overrideActive)}function z(e){return!!(e?.enabled&&e.state===`warning`)}function B(e){return R(e)?`acknowledgement-required`:L(e)?`cleanup`:z(e)?`warning`:`inactive`}function V({monitorEnabled:e,hasResolvedStatus:t,status:n}){return!e||!t?null:R(n)?`acknowledgement-required`:null}function H(e){return`Storage cleanup mode must be acknowledged before sending messages.`}function U(e,t){return e===t?!0:!e||!t?!1:e.enabled===t.enabled&&e.state===t.state&&e.locked===t.locked&&e.acknowledged===t.acknowledged&&e.overrideActive===t.overrideActive&&e.effectivelyLocked===t.effectivelyLocked&&e.lockId===t.lockId&&e.usagePercent===t.usagePercent&&e.thresholdPercent===t.thresholdPercent&&e.path===t.path&&e.lastCheckedAt===t.lastCheckedAt&&e.error===t.error&&e.blockedCapabilities.length===t.blockedCapabilities.length&&e.blockedCapabilities.every((e,n)=>e===t.blockedCapabilities[n])}function W(e){return e?.usagePercent==null||!Number.isFinite(e.usagePercent)?`Unknown`:`${Math.round(e.usagePercent)}%`}var G={assistantId:null,status:null,hasResolvedStatus:!1};function ce(e,t){return e instanceof Error?e:Error(t)}function le({assistantId:e,enabled:t,refreshKey:n,cadenceMs:r=F}){let[i,a]=(0,N.useState)(G),[o,s]=(0,N.useState)(!1),[c,l]=(0,N.useState)(null),u=(0,N.useRef)(e),d=(0,N.useRef)(t),f=(0,N.useRef)(0),p=(0,N.useRef)(0);(0,N.useLayoutEffect)(()=>{u.current=e,d.current=t}),(0,N.useEffect)(()=>{f.current+=1,a(G),l(null),s(!1)},[e,t]);let g=(0,N.useCallback)((e,t)=>d.current&&u.current===e&&f.current===t,[]),_=(0,N.useCallback)((e,t,n,r)=>{g(e,r)&&a(r=>r.assistantId===e&&r.hasResolvedStatus===n&&U(r.status,t)?r:{assistantId:e,status:t,hasResolvedStatus:n})},[g]),v=(0,N.useCallback)(()=>{f.current+=1,a(G)},[]),y=(0,N.useCallback)(async()=>{let n=e;if(!t||!n){v();return}let r=f.current,i=p.current+1;p.current=i;try{let e=await m(n);if(p.current!==i)return;if(!e.ok){_(n,null,!1,r);return}_(n,e.data.status,!0,r)}catch{if(p.current!==i)return;_(n,null,!1,r)}},[e,_,v,t]);(0,N.useEffect)(()=>{if(!t||!e)return;y();let n=window.setInterval(()=>{y()},r);return()=>{window.clearInterval(n)}},[e,r,t,y,n]),S(`app.resume`,()=>{y()});let b=(0,N.useCallback)(n=>{if(!t||!e){v();return}let r=f.current+1;f.current=r,s(!1),l(null),_(e,n,!0,r)},[e,_,v,t]);S(`sse.event`,e=>{let t=e.message;t.type===`disk_pressure_status_changed`&&b(t.status)});let x=(0,N.useCallback)(async()=>{let n=e;if(!t||!n){v();return}let r=f.current+1;f.current=r,s(!0),l(null);try{let e=await h(n);if(!e.ok)throw Error(`Failed to acknowledge assistant disk pressure.`);if(!g(n,r))return;let t=f.current+1;f.current=t,_(n,e.data.status,!0,t),s(!1)}catch(e){g(n,r)&&l(ce(e,`Failed to acknowledge assistant disk pressure.`))}finally{g(n,r)&&s(!1)}},[e,_,v,t,g]),C=t&&i.assistantId===e?i.status:null,w=!!(t&&e&&i.assistantId===e&&i.hasResolvedStatus);return{status:C,mode:(0,N.useMemo)(()=>B(C),[C]),hasResolvedStatus:w,isAcknowledging:o,acknowledgeError:c,acknowledge:x,applyStatusEvent:b,refresh:y}}var K=c();function ue(e){let{status:t,mode:n,isAcknowledging:r=!1,acknowledgeError:i,onAcknowledge:a,onDismissWarning:o,onReviewWorkspaceData:c,onUpgradeStorage:l}=e,[m,h]=(0,N.useState)(!1),[g,_]=(0,N.useState)(!1),v=W(t);if(n===`warning`){let e=t.usagePercent??0;return(0,K.jsx)(f,{tone:`warning`,title:`Your storage is almost full`,icon:(0,K.jsx)(w,{className:`h-4 w-4`,"aria-hidden":`true`}),onDismiss:o?()=>o(g):void 0,className:`p-4`,"data-testid":`disk-pressure-banner`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--surface-active)]`,children:(0,K.jsx)(`div`,{className:`h-full rounded-full transition-[width] duration-300`,style:{width:`${e}%`,backgroundColor:`var(--system-mid-strong)`}})}),(0,K.jsx)(`span`,{className:`text-body-medium-default shrink-0 tabular-nums text-[color:var(--system-mid-strong)]`,children:v})]}),(0,K.jsx)(`p`,{className:`m-0`,children:`Free up space or add more storage to avoid interruptions.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[c&&(0,K.jsx)(s,{variant:`outlined`,size:`compact`,onClick:c,children:`Manage Storage`}),l&&(0,K.jsx)(s,{variant:`outlined`,size:`compact`,onClick:l,children:`Upgrade`}),o?(0,K.jsx)(u,{className:`ml-auto`,checked:g,onCheckedChange:e=>_(e===!0),label:`Don't show again`,"data-testid":`disk-pressure-banner-dont-show-again`}):null]})]})})}if(n===`cleanup`){let e=t.usagePercent??0;return(0,K.jsx)(f,{tone:`warning`,title:`Cleanup mode is active`,icon:(0,K.jsx)(w,{className:`h-4 w-4`,"aria-hidden":`true`}),className:`p-4`,"data-testid":`disk-pressure-banner`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--surface-active)]`,children:(0,K.jsx)(`div`,{className:`h-full rounded-full transition-[width] duration-300`,style:{width:`${e}%`,backgroundColor:`var(--system-mid-strong)`}})}),(0,K.jsx)(`span`,{className:`text-body-medium-default shrink-0 tabular-nums text-[color:var(--system-mid-strong)]`,children:v})]}),(0,K.jsx)(`p`,{className:`m-0`,children:`Prompt your assistant to free up space before it runs out and enters a locked state.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c&&(0,K.jsx)(s,{variant:`outlined`,size:`compact`,onClick:c,children:`Manage Storage`}),l&&(0,K.jsx)(s,{variant:`outlined`,size:`compact`,onClick:l,children:`Upgrade`})]})]})})}let y=t.usagePercent??0;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(f,{tone:`error`,title:`Storage is critically low`,icon:(0,K.jsx)(w,{className:`h-4 w-4`,"aria-hidden":`true`}),className:`p-4`,"data-testid":`disk-pressure-banner`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--surface-active)]`,children:(0,K.jsx)(`div`,{className:`h-full rounded-full transition-[width] duration-300`,style:{width:`${y}%`,backgroundColor:`var(--system-negative-strong)`}})}),(0,K.jsx)(`span`,{className:`text-body-medium-default shrink-0 tabular-nums text-[color:var(--system-negative-strong)]`,children:v})]}),(0,K.jsx)(`p`,{className:`m-0`,children:`Your assistant will enter a locked state if it runs out of storage.`}),i?(0,K.jsx)(`span`,{className:`text-[var(--system-negative-strong)]`,role:`alert`,children:i}):null,(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,K.jsx)(s,{variant:`primary`,size:`compact`,onClick:()=>h(!0),children:`Review`})})]})}),(0,K.jsx)(p.Root,{open:m,onOpenChange:e=>{e||h(!1)},children:(0,K.jsxs)(p.Content,{size:`sm`,children:[(0,K.jsx)(p.Header,{children:(0,K.jsx)(p.Title,{icon:d,children:`Storage is critically low`})}),(0,K.jsx)(p.Body,{children:(0,K.jsx)(p.Description,{children:`Your assistant will enter a locked state if it runs out of storage. You should either prompt your assistant to free up space or increase your storage.`})}),(0,K.jsxs)(p.Footer,{children:[l&&(0,K.jsx)(s,{variant:`outlined`,onClick:()=>{h(!1),l()},children:`Upgrade`}),(0,K.jsx)(s,{variant:`primary`,disabled:r,onClick:()=>{a(),h(!1)},children:r?`Acknowledging...`:`Acknowledge`})]})]})})]})}var de=_({key:`device:cmd_enter_to_send`,scope:`device`,parse:g,serialize:String,fallback:!1}),fe=_({key:`device:show_context_window_indicator`,scope:`device`,parse:g,serialize:String,fallback:!1}),q=`app.iosNudge.downloaded`,J=`app.iosNudge.bannerDismissed`,Y=`app.iosNudge.assistantTurnsSeen`,pe=`https://apps.apple.com/us/app/vellum-assistant/id6759934423`;function me(){return i(q,!1)}function X(){t(q,!0)}function he(){return i(J,!1)}function Z(){t(J,!0)}function Q(){return Math.max(0,n(Y,0))}function ge(e=1){e<=0||r(Y,Q()+e)}function _e(){let[e,t]=(0,N.useState)(!1),[n,r]=(0,N.useState)(!1);(0,N.useEffect)(()=>{t(me()),r(he())},[]);let i=(0,N.useCallback)(()=>{$(),X(),t(!0)},[]),a=(0,N.useCallback)(()=>{Z(),r(!0)},[]);return{bannerShouldShow:!e&&!n,handleDownload:i,handleBannerDismiss:a}}function $(){window.open(pe,`_blank`,`noopener,noreferrer`)}export{w as C,T as S,A as _,X as a,te as b,ue as c,V as d,P as f,ie as g,ae as h,_e as i,le as l,re as m,$ as n,de as o,M as p,Q as r,fe as s,ge as t,H as u,ne as v,ee as x,j as y};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{o as t,r as n,s as r,t as i}from"./local-settings-C-dW2vkq.js";import{s as a}from"./device-settings-DXp9L4iB.js";import{t as o}from"./react-BFJW0bSv.js";import{t as s}from"./button-Dy5001j6.js";import{t as c}from"./jsx-runtime-D3ZM-ToX.js";import{t as l}from"./createLucideIcon-CAM1RhH8.js";import{t as u}from"./checkbox-BZTUJtxM.js";import{t as d}from"./triangle-alert--e3n47gm.js";import{t as f}from"./notice-DCp7WO3L.js";import"./src-BAS7a2RG.js";import{t as p}from"./modal-DwsThLGg.js";import{i as m,t as h}from"./api-C8TlQNEU.js";import{i as g,r as _}from"./typed-storage-C-R1po3l.js";import{t as v}from"./client-feature-flag-store-Bg5XEI2b.js";import{n as y,r as b,t as x}from"./theme-preferences-LQuLaIA6.js";import{t as S}from"./use-bus-subscription-CyRPH_gr.js";import{o as C}from"./funnel-events-RT_kdQHK.js";var w=l(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),T=l(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]);function ee(){return v.use.stringFlags().proactiveTips??`off`}function te(e){return e===`on`}function E(e){return e===void 0||typeof e==`number`&&Number.isFinite(e)}function D(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return typeof t.shownCount==`number`&&Number.isFinite(t.shownCount)&&E(t.dismissedAt)&&E(t.lastShownAt)}function O(e){let t=JSON.parse(e);if(!t||typeof t!=`object`||Array.isArray(t))return null;let n={};for(let[e,r]of Object.entries(t))D(r)&&(n[e]=r);return n}function k(e){let t=Number(e);return Number.isFinite(t)&&t>=0?t:null}var A=_({key:`device:tips:records`,scope:`device`,parse:O,serialize:JSON.stringify,fallback:{}}),ne=_({key:`device:tips:enabled`,scope:`device`,parse:g,serialize:String,fallback:!0}),j=_({key:`device:tips:first_seen_at`,scope:`device`,parse:k,serialize:String,fallback:0});function re(){j.load()===0&&j.save(Date.now())}function ie(e,t){let n=A.load(),r=n[e];A.save({...n,[e]:{...r,lastShownAt:t,shownCount:(r?.shownCount??0)+1}})}function ae(e,t){let n=A.load(),r=n[e];A.save({...n,[e]:{...r,dismissedAt:t,shownCount:r?.shownCount??0}})}var oe=`proactive-tips-v1`,se={impression:0,learn_more:1,dismiss:2,dont_show_again:3,click:4,completion:5};function M(e,t,n){C({stepName:t,stepIndex:se[t]},{funnelVersion:oe,screen:e,variant:n})}var N=e(o(),1);function P(){let e=v.use.velvet(),[t,n]=(0,N.useState)(()=>y({velvetEnabled:e}));return(0,N.useEffect)(()=>{n(y({velvetEnabled:e}))},[e]),(0,N.useEffect)(()=>a(`theme`,()=>{n(y({velvetEnabled:e}))}),[e]),(0,N.useEffect)(()=>{x(t)},[t]),{theme:t,setThemePreference:e=>{n(e),b(e)}}}var F=6e4;function I(e){return!!(e?.enabled&&e.effectivelyLocked)}function L(e){return I(e)?e.acknowledged&&!e.overrideActive:!1}function R(e){return!!(e&&I(e)&&!e.acknowledged&&!e.overrideActive)}function z(e){return!!(e?.enabled&&e.state===`warning`)}function B(e){return R(e)?`acknowledgement-required`:L(e)?`cleanup`:z(e)?`warning`:`inactive`}function V({monitorEnabled:e,hasResolvedStatus:t,status:n}){return!e||!t?null:R(n)?`acknowledgement-required`:null}function H(e){return`Storage cleanup mode must be acknowledged before sending messages.`}function U(e,t){return e===t?!0:!e||!t?!1:e.enabled===t.enabled&&e.state===t.state&&e.locked===t.locked&&e.acknowledged===t.acknowledged&&e.overrideActive===t.overrideActive&&e.effectivelyLocked===t.effectivelyLocked&&e.lockId===t.lockId&&e.usagePercent===t.usagePercent&&e.thresholdPercent===t.thresholdPercent&&e.path===t.path&&e.lastCheckedAt===t.lastCheckedAt&&e.error===t.error&&e.blockedCapabilities.length===t.blockedCapabilities.length&&e.blockedCapabilities.every((e,n)=>e===t.blockedCapabilities[n])}function W(e){return e?.usagePercent==null||!Number.isFinite(e.usagePercent)?`Unknown`:`${Math.round(e.usagePercent)}%`}var G={assistantId:null,status:null,hasResolvedStatus:!1};function ce(e,t){return e instanceof Error?e:Error(t)}function le({assistantId:e,enabled:t,refreshKey:n,cadenceMs:r=F}){let[i,a]=(0,N.useState)(G),[o,s]=(0,N.useState)(!1),[c,l]=(0,N.useState)(null),u=(0,N.useRef)(e),d=(0,N.useRef)(t),f=(0,N.useRef)(0),p=(0,N.useRef)(0);(0,N.useLayoutEffect)(()=>{u.current=e,d.current=t}),(0,N.useEffect)(()=>{f.current+=1,a(G),l(null),s(!1)},[e,t]);let g=(0,N.useCallback)((e,t)=>d.current&&u.current===e&&f.current===t,[]),_=(0,N.useCallback)((e,t,n,r)=>{g(e,r)&&a(r=>r.assistantId===e&&r.hasResolvedStatus===n&&U(r.status,t)?r:{assistantId:e,status:t,hasResolvedStatus:n})},[g]),v=(0,N.useCallback)(()=>{f.current+=1,a(G)},[]),y=(0,N.useCallback)(async()=>{let n=e;if(!t||!n){v();return}let r=f.current,i=p.current+1;p.current=i;try{let e=await m(n);if(p.current!==i)return;if(!e.ok){_(n,null,!1,r);return}_(n,e.data.status,!0,r)}catch{if(p.current!==i)return;_(n,null,!1,r)}},[e,_,v,t]);(0,N.useEffect)(()=>{if(!t||!e)return;y();let n=window.setInterval(()=>{y()},r);return()=>{window.clearInterval(n)}},[e,r,t,y,n]),S(`app.resume`,()=>{y()});let b=(0,N.useCallback)(n=>{if(!t||!e){v();return}let r=f.current+1;f.current=r,s(!1),l(null),_(e,n,!0,r)},[e,_,v,t]);S(`sse.event`,e=>{let t=e.message;t.type===`disk_pressure_status_changed`&&b(t.status)});let x=(0,N.useCallback)(async()=>{let n=e;if(!t||!n){v();return}let r=f.current+1;f.current=r,s(!0),l(null);try{let e=await h(n);if(!e.ok)throw Error(`Failed to acknowledge assistant disk pressure.`);if(!g(n,r))return;let t=f.current+1;f.current=t,_(n,e.data.status,!0,t),s(!1)}catch(e){g(n,r)&&l(ce(e,`Failed to acknowledge assistant disk pressure.`))}finally{g(n,r)&&s(!1)}},[e,_,v,t,g]),C=t&&i.assistantId===e?i.status:null,w=!!(t&&e&&i.assistantId===e&&i.hasResolvedStatus);return{status:C,mode:(0,N.useMemo)(()=>B(C),[C]),hasResolvedStatus:w,isAcknowledging:o,acknowledgeError:c,acknowledge:x,applyStatusEvent:b,refresh:y}}var K=c();function ue(e){let{status:t,mode:n,isAcknowledging:r=!1,acknowledgeError:i,onAcknowledge:a,onDismissWarning:o,onReviewWorkspaceData:c,onUpgradeStorage:l}=e,[m,h]=(0,N.useState)(!1),[g,_]=(0,N.useState)(!1),v=W(t);if(n===`warning`){let e=t.usagePercent??0;return(0,K.jsx)(f,{tone:`warning`,title:`Your storage is almost full`,icon:(0,K.jsx)(w,{className:`h-4 w-4`,"aria-hidden":`true`}),onDismiss:o?()=>o(g):void 0,className:`p-4`,"data-testid":`disk-pressure-banner`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--surface-active)]`,children:(0,K.jsx)(`div`,{className:`h-full rounded-full transition-[width] duration-300`,style:{width:`${e}%`,backgroundColor:`var(--system-mid-strong)`}})}),(0,K.jsx)(`span`,{className:`text-body-medium-default shrink-0 tabular-nums text-[color:var(--system-mid-strong)]`,children:v})]}),(0,K.jsx)(`p`,{className:`m-0`,children:`Free up space or add more storage to avoid interruptions.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[c&&(0,K.jsx)(s,{variant:`outlined`,size:`compact`,onClick:c,children:`Manage Storage`}),l&&(0,K.jsx)(s,{variant:`outlined`,size:`compact`,onClick:l,children:`Upgrade`}),o?(0,K.jsx)(u,{className:`ml-auto`,checked:g,onCheckedChange:e=>_(e===!0),label:`Don't show again`,"data-testid":`disk-pressure-banner-dont-show-again`}):null]})]})})}if(n===`cleanup`){let e=t.usagePercent??0;return(0,K.jsx)(f,{tone:`warning`,title:`Cleanup mode is active`,icon:(0,K.jsx)(w,{className:`h-4 w-4`,"aria-hidden":`true`}),className:`p-4`,"data-testid":`disk-pressure-banner`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--surface-active)]`,children:(0,K.jsx)(`div`,{className:`h-full rounded-full transition-[width] duration-300`,style:{width:`${e}%`,backgroundColor:`var(--system-mid-strong)`}})}),(0,K.jsx)(`span`,{className:`text-body-medium-default shrink-0 tabular-nums text-[color:var(--system-mid-strong)]`,children:v})]}),(0,K.jsx)(`p`,{className:`m-0`,children:`Prompt your assistant to free up space before it runs out and enters a locked state.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c&&(0,K.jsx)(s,{variant:`outlined`,size:`compact`,onClick:c,children:`Manage Storage`}),l&&(0,K.jsx)(s,{variant:`outlined`,size:`compact`,onClick:l,children:`Upgrade`})]})]})})}let y=t.usagePercent??0;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(f,{tone:`error`,title:`Storage is critically low`,icon:(0,K.jsx)(w,{className:`h-4 w-4`,"aria-hidden":`true`}),className:`p-4`,"data-testid":`disk-pressure-banner`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`div`,{className:`h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--surface-active)]`,children:(0,K.jsx)(`div`,{className:`h-full rounded-full transition-[width] duration-300`,style:{width:`${y}%`,backgroundColor:`var(--system-negative-strong)`}})}),(0,K.jsx)(`span`,{className:`text-body-medium-default shrink-0 tabular-nums text-[color:var(--system-negative-strong)]`,children:v})]}),(0,K.jsx)(`p`,{className:`m-0`,children:`Your assistant will enter a locked state if it runs out of storage.`}),i?(0,K.jsx)(`span`,{className:`text-[var(--system-negative-strong)]`,role:`alert`,children:i}):null,(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,K.jsx)(s,{variant:`primary`,size:`compact`,onClick:()=>h(!0),children:`Review`})})]})}),(0,K.jsx)(p.Root,{open:m,onOpenChange:e=>{e||h(!1)},children:(0,K.jsxs)(p.Content,{size:`sm`,children:[(0,K.jsx)(p.Header,{children:(0,K.jsx)(p.Title,{icon:d,children:`Storage is critically low`})}),(0,K.jsx)(p.Body,{children:(0,K.jsx)(p.Description,{children:`Your assistant will enter a locked state if it runs out of storage. You should either prompt your assistant to free up space or increase your storage.`})}),(0,K.jsxs)(p.Footer,{children:[l&&(0,K.jsx)(s,{variant:`outlined`,onClick:()=>{h(!1),l()},children:`Upgrade`}),(0,K.jsx)(s,{variant:`primary`,disabled:r,onClick:()=>{a(),h(!1)},children:r?`Acknowledging...`:`Acknowledge`})]})]})})]})}var de=_({key:`device:cmd_enter_to_send`,scope:`device`,parse:g,serialize:String,fallback:!1}),fe=_({key:`device:show_context_window_indicator`,scope:`device`,parse:g,serialize:String,fallback:!1}),q=`app.iosNudge.downloaded`,J=`app.iosNudge.bannerDismissed`,Y=`app.iosNudge.assistantTurnsSeen`,pe=`https://apps.apple.com/us/app/vellum-assistant/id6759934423`;function me(){return i(q,!1)}function X(){t(q,!0)}function he(){return i(J,!1)}function Z(){t(J,!0)}function Q(){return Math.max(0,n(Y,0))}function ge(e=1){e<=0||r(Y,Q()+e)}function _e(){let[e,t]=(0,N.useState)(!1),[n,r]=(0,N.useState)(!1);(0,N.useEffect)(()=>{t(me()),r(he())},[]);let i=(0,N.useCallback)(()=>{$(),X(),t(!0)},[]),a=(0,N.useCallback)(()=>{Z(),r(!0)},[]);return{bannerShouldShow:!e&&!n,handleDownload:i,handleBannerDismiss:a}}function $(){window.open(pe,`_blank`,`noopener,noreferrer`)}export{w as C,T as S,A as _,X as a,te as b,ue as c,V as d,P as f,ie as g,ae as h,_e as i,le as l,re as m,$ as n,de as o,M as p,Q as r,fe as s,ge as t,H as u,ne as v,ee as x,j as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Q as e,Y as t,Z as n,i as r,n as i,nt as a}from"./auth-store-
|
|
1
|
+
import{Q as e,Y as t,Z as n,i as r,n as i,nt as a}from"./auth-store-BwKMFgpK.js";var o=5e3;function s(e,t,n){return!n||e!=null?`ready`:t===`error`?`unavailable`:`resolving`}function c(){return s(e(),n.use.status(),r())}function l(){return s(t(),n.getState().status,a(i.getState().platformSession))}function u(){return c()===`ready`}export{c as i,l as n,u as r,o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{l as n}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as r}from"./is-electron-7N7iyz1y.js";import{p as i}from"./native-biometric-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{l as n}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as r}from"./is-electron-7N7iyz1y.js";import{p as i}from"./native-biometric-B96mgKGP.js";import{d as a}from"./routes-GmNvdtLW.js";import{i as o}from"./navigation-resolver-Lxhf-tbn.js";import{t as s}from"./build-state-DPMhQpLB.js";import{n as c}from"./login-flow-llpmkEjN.js";var l=e(t(),1);function u(e){let t=n(),[u,d]=(0,l.useState)(!1),[f,p]=(0,l.useState)(null),m=(0,l.useRef)(0);return{loading:u,error:f,login:async()=>{let n=e??o(s({sessionSettled:!0,isAuthenticated:!0}),t.pathname),r=++m.current;p(null),d(!0);try{await i(c,`${a.account.providerCallback}?returnTo=${encodeURIComponent(n)}`,{returnTo:n})}catch{if(r!==m.current)return;p(`Something went wrong. Please try again.`),d(!1)}},cancel:()=>{m.current++,d(!1),p(null),r()&&window.vellum?.auth?.cancelOAuth()}}}export{u as t};
|
package/dist/assets/{use-platform-assistant-id-BnFEQQeS.js → use-platform-assistant-id-CIoqMsyh.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{q as n}from"./auth-store-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{q as n}from"./auth-store-BwKMFgpK.js";var r=e(t(),1);function i(e,t){let[i,a]=(0,r.useState)({platformAssistantId:null,isLoading:!1,error:null});return(0,r.useEffect)(()=>{if(!t||!e){a({platformAssistantId:null,isLoading:!1,error:null});return}let r=!0;return a({platformAssistantId:null,isLoading:!0,error:null}),n(e).then(e=>{r&&a({platformAssistantId:e,isLoading:!1,error:null})}).catch(e=>{r&&a({platformAssistantId:null,isLoading:!1,error:e instanceof Error?e:Error(String(e))})}),()=>{r=!1}},[e,t]),i}export{i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{f as n,m as r}from"./local-mode-9zpgPNoq.js";import{ht as i,i as a,o}from"./auth-store-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{f as n,m as r}from"./local-mode-9zpgPNoq.js";import{ht as i,i as a,o}from"./auth-store-BwKMFgpK.js";var s=e(t(),1);function c(){let e=i.use.assistantState();return!!(e.kind===`self_hosted`||e.kind===`active`&&e.isLocal)}function l(){let e=i.use.assistantState();return e.kind===`active`&&!e.isLocal}function u(){let e=i.use.assistantState();return e.kind===`loading`||e.kind===`initializing`||e.kind===`cleaning_up`}function d(e={}){let t=p(e);return t===`pending`?`disabled`:t}function f(e={}){let t=p(e),n=m(t===`pending`,e.settleTimeoutMs??5e3);return t===`pending`&&n?`disabled`:t}function p(e){let t=a(),i=o(),s=r(),l=c(),u=i?`disabled`:`pending`;return e.platformHostedOnly?l?`gated`:t?`full`:u:n()&&s?`gated`:t?`full`:u}function m(e,t){let[n,r]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{if(!e){r(!1);return}let n=setTimeout(()=>r(!0),t);return()=>{clearTimeout(n)}},[e,t]),n}export{f as a,d as i,c as n,u as r,l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{m as n,n as r}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as i}from"./jsx-runtime-D3ZM-ToX.js";import{t as a}from"./loader-circle-BzJ2kz3F.js";import{a as o,s}from"./auth-store-BwKMFgpK.js";import{T as c}from"./native-biometric-B96mgKGP.js";import{d as l}from"./routes-GmNvdtLW.js";import{a as u}from"./use-platform-gate-CqEOGZtI.js";import{t as d}from"./hard-navigate-V2EFapkk.js";import{a as f,o as p}from"./login-flow-llpmkEjN.js";var m=i();function h(){return(0,m.jsx)(a,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`,"aria-label":`Loading`})}var g=e(t(),1);function _({to:e}){let t=f(e);return(0,g.useEffect)(()=>{t&&d(e)},[t,e]),t?null:(0,m.jsx)(r,{to:e,replace:!0})}function v(){let[e]=n(),t=o(),r=s(),i=u(),a=e.get(`returnTo`),d=c(a,l.assistant);if(!a)return{kind:`proceed`,returnTo:null};if(r)return{kind:`wait`};if(!t)return{kind:`proceed`,returnTo:d};if(p(d)){if(i===`pending`)return{kind:`wait`};if(i===`disabled`)return{kind:`proceed`,returnTo:d}}return{kind:`redirect`,node:(0,m.jsx)(_,{to:d})}}export{h as n,v as t};
|