import{r as l,j as e}from"./@radix-DP6vWzyx.js";import{u as c,S as x,a as y,b as v}from"./form-schemas-1AyOCx90.js";import{A as j,I as U,P as h,U as b,S as _}from"./UsageReason-DVceN14P.js";import{i as g,ax as C,aS as P,j as w,aw as A,S as E}from"./index-QQb7wQEC.js";import{c as F}from"./@tanstack-BUCbhJyH.js";import"./check-circle-Dwxliy1Z.js";import"./url-D5le3J4q.js";import"./@react-router-BMhZulnd.js";import"./UpdatePasswordSchemas-DckMEkFf.js";import"./zod-D89GC_vc.js";import"./index.esm-cuVep_NJ.js";import"./gcp-7M2Yf3ZK.js";import"./kubernetes--g7r02Zu.js";import"./rocket-CONEmRmB.js";import"./@reactflow-8U9qNlMR.js";const S=l.createContext(null);function H({children:t,initialUser:a}){const[n,r]=l.useState(a||{});return e.jsx(S.Provider,{value:{user:n,setUser:r},children:t})}function d(){const t=l.useContext(S);if(t===null)throw new Error("useSurveyUserContext must be used within an SurveyUserProvider");return t}function D({user:t}){var u,i;const{setSurveyStep:a}=c(),{setUser:n}=d();function r({fullName:s,getUpdates:m,email:o}){n(p=>({...p,...o?{email:o}:{email:null},full_name:s,email_opted_in:m})),a(2)}return e.jsx(j,{email:(u=t.metadata)==null?void 0:u.email,fullName:(i=t.body)==null?void 0:i.full_name,submitHandler:r})}function I(){const{user:t}=d(),{setSurveyStep:a}=c(),{toast:n}=g(),r=F(),{mutate:u}=C({onSuccess:async()=>{await r.invalidateQueries({queryKey:P()}),a(s=>s+1)},onError:s=>{s instanceof Error&&n({status:"error",emphasis:"subtle",icon:e.jsx(w,{className:"h-5 w-5 shrink-0 fill-error-700"}),description:s.message,rounded:!0})}});function i({other:s,providers:m,otherVal:o}){const f={infra_providers:s?[...m,o]:m,finished_onboarding_survey:!0};u({...t,user_metadata:{...t.user_metadata,...f}})}return e.jsx(U,{submitHandler:i})}function R({user:t}){const{setSurveyStep:a}=c(),{setUser:n}=d();function r({primaryUse:u}){const i={primary_use:u};n(s=>({...s,user_metadata:{...s.user_metadata,...i}})),a(3)}return e.jsx(h,{user:t,submitHandler:r})}function k(){const{setSurveyStep:t}=c(),{setUser:a}=d();function n({usageReason:r,comparison_tools:u,otherTool:i,otherToolVal:s}){const m={usage_reason:r,...!!u&&{comparing_tools:i&&s?[...u,s]:u}};a(o=>({...o,user_metadata:{...o.user_metadata,...m}})),t(o=>o+1)}return e.jsx(b,{submitHandler:n})}function M(){const{data:t,isPending:a,isError:n}=A({throwOnError:!0}),{surveyStep:r}=c();return n?null:a?e.jsx(E,{className:"h-[300px]"}):e.jsx(e.Fragment,{children:e.jsxs(H,{children:[e.jsx(x,{stepAmount:5}),r===1&&e.jsx(D,{user:t}),r===2&&e.jsx(R,{user:t}),r===3&&e.jsx(k,{}),r===4&&e.jsx(I,{}),r===5&&e.jsx(_,{}),r===6&&e.jsx(y,{subHeader:"Your ZenML account is now updated",displayBody:!1,username:t.name})]})})}function $(){return e.jsx("div",{children:e.jsx(v,{children:e.jsx(M,{})})})}export{$ as default};
