1import{j as t}from"./jsx-runtime.ClnS1p2w.js";import{D as T,a as I,b as L,c as k,d as D}from"./dialog.l3y2hJke.js";import{r as p}from"./index.BGi2BMPw.js";import{B as f}from"./button.oVCp6icH.js";import"./js.cookie.CR4gOKBE.js";import"./_sentry-release-injection-file.Cy5OIf2L.js";import{b as F,t as A,a as N}from"./analytics.D_5kSLBd.js";import{S as v,a as B,s as G,b as U}from"./savings-center-navigation.BosKsnmE.js";import{R as P}from"./responsive-combobox.2h9Dwks8.js";import{U as _,g as V}from"./us-states.N2gqZIB_.js";import{R as y,a as b}from"./radio-group.BTcejjMU.js";import{L as j}from"./label.CMKY9CBi.js";import{U as z}from"./constants.CI97EUic.js";import{R as H}from"./responsive-select.BJQwiFkS.js";import{I as W}from"./input.CyK4rWpS.js";import{u as Y,a as M,F as K,b as $,c as X,e as q}from"./zod.DRdOV96k.js";import{L as J}from"./loader-circle._HLGeb2L.js";import{o as Q,s as w}from"./types.D57tg0F-.js";import{A as Z}from"./arrow-left-icon.BDMx0nyW.js";import{s as ee,a as te}from"./header.Dd89UZvK.js";import{c as le}from"./facebook-analytics.CH9WpZvX.js";import{L as se}from"./login-form.CaUjm_et.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="ea7a11b9-1049-4c5b-94e5-a88ef2102920",e._sentryDebugIdIdentifier="sentry-dbid-ea7a11b9-1049-4c5b-94e5-a88ef2102920")}catch{}})();const h="GetStarted",ae=[{value:-1,label:"Not born yet"},{value:0,label:"newborn"},{value:1,label:"1 year old"},{value:2,label:"2 years old"},{value:3,label:"3 years old"},{value:4,label:"4 years old"},{value:5,label:"5 years old"},{value:6,label:"6 years old"},{value:7,label:"7 years old"},{value:8,label:"8 years old"},{value:9,label:"9 years old"},{value:10,label:"10 years old"},{value:11,label:"11 years old"},{value:12,label:"12 years old"},{value:13,label:"13 years old"},{value:14,label:"14 years old"},{value:15,label:"15 years old"},{value:16,label:"16 years old"},{value:17,label:"17 years old"},{value:18,label:"18+ years old"}],oe=[{value:v.PrivateUniversity,label:"Private university"},{value:v.OutOfStatePublic,label:"Out of state public university"},{value:v.InStatePublic,label:"In state public university"},{value:v.CommunityCollege,label:"Community college"},{value:v.NotSure,label:"Not sure"}],ie=[{value:"learn",label:"I want to learn more about college savings"},{value:"open-a-plan",label:"I want to open a 529 plan"}];var a=(e=>(e[e.Step1_StateStep=1]="Step1_StateStep",e[e.Step2_UserTypeStep=2]="Step2_UserTypeStep",e[e.Step3_Children=3]="Step3_Children",e[e.Step4_CollegeType=4]="Step4_CollegeType",e[e.Step5_NextStep=5]="Step5_NextStep",e[e.Step6_Email=6]="Step6_Email",e))(a||{});const S=({step:e,value:s})=>{F({flowName:h,stepName:a[e],value:s})},ne=({data:e,setData:s,continueToNextStep:o})=>{const i=()=>{S({step:a.Step1_StateStep,value:e.stateId}),o()};return t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx(P,{options:_,selectedOption:_.find(l=>l.id===e.stateId)||null,onOptionChange:l=>{l&&s({...e,stateId:l.id})},placeholder:"Select a state",triggerButtonClassName:"mb-[30px]",autoFocus:!0}),t.jsx(f,{id:"getStartedStep1Continue",size:"lg",onClick:i,className:"w-full mt-auto",disabled:!e.stateId,children:"Continue"})]})},re=(e,s,o=!1)=>t.jsxs("div",{className:"flex items-center",children:[t.jsx(b,{value:e,id:e,autoFocus:o}),t.jsx(j,{htmlFor:e,className:"pl-[10px] py-[5px] cursor-pointer text-body-main",children:s})]},e),pe=({data:e,setData:s,continueToNextStep:o})=>{const i=()=>{S({step:a.Step2_UserTypeStep,value:e.userType}),o()};return t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx(y,{defaultValue:e.userType,onValueChange:l=>{s({...e,userType:l})},className:"mb-[30px]",autoFocus:!0,children:z.map(l=>re(l.value,l.label))}),t.jsx(f,{id:"getStartedStep2Continue",size:"lg",onClick:i,className:"w-full mt-auto",disabled:!e.userType,children:"Continue"})]})},ce=ae.map(e=>({label:e.label,value:e.value.toString()})),de=({data:e,setData:s,continueToNextStep:o})=>{const i=()=>{S({step:a.Step3_Children,value:e.childAge?.toString()}),o()};return t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx(H,{options:ce,selectedValue:e.childAge?.toString(),onSelect:l=>{s({...e,childAge:parseInt(l)}
1)},placeholder:"Select your childâs age...",scroll:!0,triggerClassName:"mb-[30px]",autoFocus:!0}),t.jsx(f,{id:"getStartedStep3Continue",size:"lg",onClick:i,className:"w-full mt-auto",disabled:e.childAge===void 0,children:"Continue"})]})},ue=(e,s,o=!1)=>t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"relative flex items-center justify-center",children:t.jsx(b,{value:e,id:e,autoFocus:o})}),t.jsx(j,{htmlFor:e,className:"pl-[10px] py-[5px] cursor-pointer text-body-main",children:s})]},e),me=({data:e,setData:s,continueToNextStep:o})=>{const i=()=>{S({step:a.Step4_CollegeType,value:e.collegeType}),o()};return t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx(y,{defaultValue:e.collegeType,onValueChange:l=>{s({...e,collegeType:l})},className:"mb-[30px] space-y-0",autoFocus:!0,children:oe.map((l,c)=>ue(l.value,l.label,c===0))}),t.jsx(f,{id:"getStartedStep4Continue",size:"lg",onClick:i,className:"w-full mt-auto",disabled:!e.collegeType,children:"Continue"})]})},fe=(e,s,o=!1)=>t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"relative flex items-center justify-center",children:t.jsx(b,{value:e,id:e,autoFocus:o})}),t.jsx(j,{htmlFor:e,className:"pl-[10px] py-[5px] cursor-pointer text-body-main",children:s})]},e),Se=({data:e,setData:s,continueToNextStep:o})=>{const i=()=>{S({step:a.Step5_NextStep,value:e.nextStep}),o()};return t.jsxs("div",{className:"flex-1 flex flex-col",children:[t.jsx(y,{defaultValue:e.nextStep,onValueChange:l=>{s({...e,nextStep:l})},className:"mb-[30px] space-y-0",autoFocus:!0,children:ie.map((l,c)=>fe(l.value,l.label,c===0))}),t.jsx(f,{id:"getStartedStep5Continue",size:"lg",onClick:i,className:"w-full mt-auto",disabled:!e.nextStep,children:"Continue"})]})},ge=({data:e,finish:s})=>{const[o,i]=p.useState(!1),l=Q({email:w().optional()}),c=Y({resolver:M(l),defaultValues:{email:""}}),g=async d=>{try{if(i(!0),d.email&&d.email.trim()!==""&&!w().email().safeParse(d.email).success){c.setError("email",{message:"Please enter a valid email address"});return}S({step:a.Step6_Email,value:"entered"}),await s({...e,email:d.email||""})}finally{i(!1)}},r=async()=>{try{i(!0),S({step:a.Step6_Email,value:"skipped"}),await s({...e})}finally{i(!1)}};return t.jsx("div",{className:"flex-1 flex flex-col",children:t.jsx(K,{...c,children:t.jsxs("form",{onSubmit:c.handleSubmit(g),className:"flex-1 flex flex-col",children:[t.jsx($,{control:c.control,name:"email",render:({field:d})=>t.jsxs(X,{children:[t.jsx(W,{...d,type:"email",placeholder:"Your Email",autoFocus:!0,className:"mb-[30px]"}),t.jsx(q,{})]})}),t.jsxs("div",{className:"flex flex-col gap-[10px] w-full mt-auto",children:[t.jsxs(f,{id:"getStartedStep5Continue",type:"submit",size:"lg",className:"w-full",disabled:o,children:[o&&t.jsx(J,{className:"mr-2 h-4 w-4 animate-spin"}),"Continue"]}),t.jsx(f,{type:"button",variant:"ghost",size:"lg",className:"w-full",disabled:o,onClick:r,children:"Skip"})]})]})})})},E=new Map([[a.Step1_StateStep,{title:"Where do you live?",description:"This will help us find the right 529 plans for you."}],[a.Step2_UserTypeStep,{title:"What role best describes you?",description:"Knowing this will help us better customize your experience."}],[a.Step3_Children,{title:"How old is your child?",description:"Knowing this will help us to make better recommendation."}],[a.Step4_CollegeType,{title:"What type of higher education are you saving for?",description:"This will help us provide more tailored recommendations for your savings goals."}],[a.Step5_NextStep,{title:"What would you like to do today?",description:"This will help us provide you with the most relevant information."}],[a.Step6_Email,{title:"What is your email address?",description:"Access our Savings Center to compare 529 plans, project college costs, and create a plan to afford college."}]]),xe=p.forwardRef((e,s)=>{const o=async()=>{const n=await V();n&&n.id&&m({...u,stateId:n.id})};p.useImperativeHandle(s,()=>({openGetStartedOrSavingsCenter:n=>{l(n)}}));const i=n=>{m({stateId:n,userType:void 0,childAge:void 0,collegeType:void 0,nextStep:void 0,email:void 0}),n?d(a.Step2_UserTypeStep):(d(a.Step1_StateStep),o()),g(!0),A({flowName:h})},l=n=>{B()||i(n)};p.useEffect(()=>{ee(l)},[]);
1const[c,g]=p.useState(!1),[r,d]=p.useState(a.Step1_StateStep),[u,m]=p.useState({stateId:void 0,userType:void 0,childAge:void 0,collegeType:void 0,nextStep:void 0,email:void 0}),O=()=>{r!==a.Step1_StateStep&&d(r-1)},x=()=>{r===a.Step6_Email?C(u):d(r+1)},C=async n=>{await G({stateId:n.stateId,userType:n.userType,childAge:n.childAge,collegeType:n.collegeType,nextStep:n.nextStep,email:n.email},"savings_center"),m(n),le(),await U({fromGetStartedFlow:!0}),g(!1),N({flowName:h,lastStep:a[r],isCompleted:!0})},R=n=>{n||N({flowName:h,lastStep:a[r],isCompleted:!1}),g(n)};return t.jsx(T,{open:c,onOpenChange:R,children:t.jsxs(I,{className:"small-desktop:h-[650px]",children:[t.jsxs(L,{children:[t.jsxs(k,{className:"flex flex-col",children:[t.jsxs("span",{className:"text-body-caption font-body mb-[10px]",children:["Step ",r.valueOf()," of 6"]}),t.jsx("span",{className:"text-title-md font-title",children:E.get(r)?.title})]}),t.jsx(D,{children:E.get(r)?.description})]}),t.jsxs("div",{className:"flex-1 flex",children:[r===a.Step1_StateStep&&t.jsx(ne,{data:u,setData:m,continueToNextStep:x}),r===a.Step2_UserTypeStep&&t.jsx(pe,{data:u,setData:m,continueToNextStep:x}),r===a.Step3_Children&&t.jsx(de,{data:u,setData:m,continueToNextStep:x}),r===a.Step4_CollegeType&&t.jsx(me,{data:u,setData:m,continueToNextStep:x}),r===a.Step5_NextStep&&t.jsx(Se,{data:u,setData:m,continueToNextStep:x}),r===a.Step6_Email&&t.jsx(ge,{data:u,finish:C})]}),r!==a.Step1_StateStep&&t.jsxs("button",{id:"getStartedDialogBackButton",onClick:()=>O(),className:"absolute left-[20px] top-[20px] rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[t.jsx(Z,{}),t.jsx("span",{className:"sr-only",children:"Back"})]})]})})}),ve=p.forwardRef((e,s)=>{p.useEffect(()=>{te(o)}),p.useImperativeHandle(s,()=>({open:()=>{l(!0)}}));const o=()=>{l(!0)},[i,l]=p.useState(!1);return t.jsx(T,{open:i,onOpenChange:c=>l(c),children:t.jsxs(I,{className:"",children:[t.jsxs(L,{children:[t.jsx(k,{className:"flex flex-col",children:"Welcome back"}),t.jsx(D,{children:"Log in to Saving For College"})]}),t.jsx("div",{className:"flex-1 flex flex-col",children:t.jsx(se,{})})]})})}),Ve=({})=>{const e=p.useRef(null),s=p.useRef(null),o=()=>{e.current?.open()},i=l=>{s.current?.openGetStartedOrSavingsCenter(l.detail.stateId)};return p.useEffect(()=>(window.dialogEventBus?.addEventListener("openLoginDialog",o),window.dialogEventBus?.addEventListener("openGetStartedDialog",i),window.dialogEventBus&&window.dialogEventBus.markListenersReady(),()=>{window.dialogEventBus?.removeEventListener("openLoginDialog",o),window.dialogEventBus?.removeEventListener("openGetStartedDialog",i)}),[]),t.jsxs(t.Fragment,{children:[t.jsx(ve,{ref:e}),t.jsx(xe,{ref:s})]})},ze=()=>{window.dialogEventBus?.dispatchEvent(new Event("openLoginDialog"))},He=e=>{window.dialogEventBus?.dispatchEvent(new CustomEvent("openGetStartedDialog",{detail:{stateId:e}}))};export{Ve as C,ze as a,He as o};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.