import{j as e,e as x}from"./@tanstack-D1KSn3AD.js";import{u as c,S as y,a as v,b as j}from"./SuccessStep-sxqQ6JQZ.js";import{A as h,P as U,a as C}from"./AwarenessChannel-CYtxL_o8.js";import{r as l}from"./@radix-Mqgm9uyP.js";import{f as b,as as w,i as _,ag as A,S as P}from"./index-M2LMbZSu.js";import{u as g}from"./update-current-user-mutation-BmT5R3OW.js";import"./UpdatePasswordSchemas-DGDVsTXq.js";import"./check-circle-B_YRDK8p.js";import"./@react-router-t1nY6c48.js";import"./zod-DWNKqVmj.js";import"./index.esm-5yOGu3_l.js";import"./file-text-C_aOBzo7.js";import"./@reactflow-DOgoC88E.js";const S=l.createContext(null);function E({children:r,initialUser:n}){const[a,t]=l.useState(n||{});return e.jsx(S.Provider,{value:{user:a,setUser:t},children:r})}function d(){const r=l.useContext(S);if(r===null)throw new Error("useSurveyUserContext must be used within an SurveyUserProvider");return r}function F({user:r}){var o,i;const{setSurveyStep:n}=c(),{setUser:a}=d();function t({fullName:s,getUpdates:u,email:m}){a(p=>({...p,...m?{email:m}:{email:null},full_name:s,email_opted_in:u})),n(2)}return e.jsx(h,{email:(o=r.metadata)==null?void 0:o.email,fullName:(i=r.body)==null?void 0:i.full_name,submitHandler:t})}function D({user:r}){const{setSurveyStep:n}=c(),{setUser:a}=d();function t({amountProductionModels:o,primaryUse:i}){const s={models_production:o,primary_use:i};a(u=>({...u,user_metadata:{...u.user_metadata,...s}})),n(3)}return e.jsx(U,{user:r,submitHandler:t})}function H(){const{user:r}=d(),{setSurveyStep:n}=c(),{toast:a}=b(),t=x(),{mutate:o}=g({onSuccess:async()=>{await t.invalidateQueries({queryKey:w()}),n(s=>s+1)},onError:s=>{s instanceof Error&&a({status:"error",emphasis:"subtle",icon:e.jsx(_,{className:"h-5 w-5 shrink-0 fill-error-700"}),description:s.message,rounded:!0})}});function i({other:s,channels:u,otherVal:m}){const f={awareness_channels:s?[...u,m]:u};o({...r,user_metadata:{...r.user_metadata,...f}})}return e.jsx(C,{submitHandler:i})}function M(){const{data:r,isPending:n,isError:a}=A({throwOnError:!0}),{surveyStep:t}=c();return a?null:n?e.jsx(P,{className:"h-[300px]"}):e.jsx(e.Fragment,{children:e.jsxs(E,{children:[e.jsx(y,{stepAmount:3}),t===1&&e.jsx(F,{user:r}),t===2&&e.jsx(D,{user:r}),t===3&&e.jsx(H,{}),t===4&&e.jsx(v,{subHeader:"Your ZenML account is now updated",displayBody:!1,username:r.name})]})})}function Z(){return e.jsx("div",{children:e.jsx(j,{children:e.jsx(M,{})})})}export{Z as default};
