1import{r,a1 as Pe,j as e,D as oe,E as b,ab as xa,a0 as fa,u as ga,au as ya,cp as ja,Q as Ve,U as ge,n as Q,V as Ge,H as va,ak as Se,aS as Na,aU as ba,q as pt,y as xt,a8 as T,ay as Ca,B as h,aY as ye,am as wa,$ as ka,ae as ft,t as Pa,a4 as Sa,a7 as Da,bM as $a,c8 as L,z as gt,bb as _e,L as m,I as x,e as H,f as Qe,A as je,X as ve,N as Ke,aO as Ne,T as be,af as Ce,h as Aa,O as Ea,bN as Fa,bO as Ra,bL as yt,w as Ta,bP as Ma,bQ as Ze,bR as Oa,bS as Ya,aK as jt,aB as Ba,R as Je,a as Xe,b as K,d as Z,az as J,W as La,Y as za,Z as Ua,_ as Wa,at as vt,aE as Nt}from"./index-DM8ih7Eo.js";import{T as X}from"./textarea-DZz7IWo3.js";import{P as qa}from"./progress-BAGuK22w.js";import{S as bt,a as Ct,b as wt,c as kt,d as we}from"./select-B4LUwNgZ.js";import{A as Pt}from"./address-autocomplete-CT-qb6lW.js";import{D as Ha}from"./dog-C9Y1po30.js";import{P as St}from"./party-popper-vBQD8TYe.js";import{C as ke}from"./camera-BVcckLES.js";import{C as Va}from"./chevron-left-Bk-ioDes.js";import{C as Dt}from"./circle-check-big-Dp4oBKq5.js";const $t=["#3B82F6","#10B981","#F59E0B","#EC4899","#8B5CF6","#06B6D4","#F97316"];function At({trigger:y,duration:f=3e3,pieceCount:v=50,onComplete:M}){const[I,d]=r.useState([]),[E,u]=r.useState(!1),O=r.useCallback(()=>Array.from({length:v},(p,le)=>({id:le,x:Math.random()*100,color:$t[Math.floor(Math.random()*$t.length)],size:Math.random()*8+4,rotation:Math.random()*360,delay:Math.random()*.5})),[v]);return r.useEffect(()=>{if(y&&!E){u(!0),d(O()),Pe("celebration");const p=setTimeout(()=>{u(!1),d([]),M?.()},f);return()=>clearTimeout(p)}},[y,E,f,O,M]),e.jsx(oe,{children:E&&e.jsx("div",{className:"fixed inset-0 pointer-events-none z-50 overflow-hidden",children:I.map(p=>e.jsx(b.div,{initial:{x:`${p.x}vw`,y:-20,rotate:0,scale:1,opacity:1},animate:{y:"110vh",rotate:p.rotation+720,opacity:[1,1,1,0]},exit:{opacity:0},transition:{duration:2.5+Math.random(),delay:p.delay,ease:[.25,.46,.45,.94]},style:{position:"absolute",width:p.size,height:p.size*.6,backgroundColor:p.color,borderRadius:2}},p.id))})})}function Ga({show:y,message:f,icon:v}){return e.jsx(oe,{children:y&&e.jsx(b.div,{initial:{scale:0,opacity:0,y:20},animate:{scale:1,opacity:1,y:0},exit:{scale:0,opacity:0,y:-20},transition:{type:"spring",damping:15,stiffness:300},className:"fixed bottom-32 sm:bottom-24 left-1/2 -translate-x-1/2 z-50 max-w-[90vw]",children:e.jsxs("div",{className:"bg-gradient-to-r from-primary/90 to-primary px-6 py-3 rounded-full shadow-lg flex items-center gap-2 text-primary-foreground",children:[v,e.jsx("span",{className:"font-medium",children:f})]})})})}function _a({show:y,title:f,description:v,onClose:M}){return r.useEffect(()=>{if(y){const I=setTimeout(()=>{M?.()},4e3);return()=>clearTimeout(I)}},[y,M]),e.jsx(oe,{children:y&&e.jsx(b.div,{initial:{x:300,opacity:0},animate:{x:0,opacity:1},exit:{x:300,opacity:0},transition:{type:"spring",damping:20,stiffness:300},className:"fixed top-20 right-4 z-50 max-w-sm",children:e.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-xl p-4 flex items-start gap-3",children:[e.jsx(b.div,{initial:{scale:0,rotate:-180},animate:{scale:1,rotate:0},transition:{type:"spring",delay:.2,damping:10},className:"w-10 h-10 rounded-full bg-gradient-to-br from-amber-400 to-amber-600 flex items-center justify-center shrink-0",children:e.jsx(xa,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-foreground",children:f}),e.jsx("p",{className:"text-sm text-muted-foreground",children:v})]})]})})})}function Qa({show:y}){return e.jsx(oe,{children:y&&e.jsx(b.svg,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{type:"spring",damping:12,stiffness:200},className:"w-5 h-5 text-green-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx(b.path,{initial:{pathLength:0},animate:{pathLength:1},transition:{duration:.4,delay:.2},d:"M5 13l4 4L19 7"})})})}function Ka(y){return y.toLowerCase().includes("dob")||y.toLowerCase().includes("dateofbirth")}const Za=["Great start! Your household info is saved.","Awesome! Kids' essentials captured.","Fantastic! Medical info secured.","Nice work! Finances documented.","You did it! Guide complete!"],Ja={0:{title:"Foundation Set!",description:"Your household info is the bedrock of your guide."}
1,2:{title:"Halfway There!",description:"You're making your family more prepared every step."},4:{title:"Guide Complete!",description:"Your family now has a comprehensive operations guide."}},Et=["You're doing great!","Keep going, you've got this!","Almost there!","Your family will thank you!","Every detail matters!"],S=[{id:0,title:"Your Household",description:"Start with the basics - this is your family's foundation",subtitle:"You're taking an important step for your family",icon:va,time:"2 min",fields:[{key:"ownerName",label:"Your Name",placeholder:"First and last name"},{key:"ownerPhone",label:"Your Phone",placeholder:"555-123-4567"},{key:"ownerDOB",label:"Your Date of Birth (optional)",placeholder:"MM/DD/YYYY"},{key:"hasSpouse",label:"Add Spouse/Partner?",placeholder:"",type:"toggle"},{key:"spouseName",label:"Spouse/Partner Name",placeholder:"First and last name"},{key:"spousePhone",label:"Spouse/Partner Phone",placeholder:"555-123-4567"},{key:"spouseEmail",label:"Spouse/Partner Email (optional)",placeholder:"[email protected]"},{key:"spouseDOB",label:"Spouse/Partner Date of Birth (optional)",placeholder:"MM/DD/YYYY"},{key:"primaryEmergencyContact",label:"Primary Emergency Contact",placeholder:"Who should be called first?",type:"select",options:["Me","My Spouse/Partner","Someone Else"]},{key:"otherEmergencyName",label:"Emergency Contact Name",placeholder:"e.g., Mom, Sister, Best Friend"},{key:"otherEmergencyPhone",label:"Emergency Contact Phone",placeholder:"555-123-4567"},{key:"homeAddress",label:"Home Address",placeholder:"123 Main St, City, State ZIP"},{key:"accessNotes",label:"Home Access Notes (optional)",placeholder:"Gate code: 1234, spare key under mat"}]},{id:1,title:"Children Essentials",description:"Help household members understand what makes your kids unique",subtitle:"Every parent knows these details matter",icon:Se,time:"2 min",fields:[{key:"child1Name",label:"Child's Name",placeholder:"First and last name"},{key:"child1DOB",label:"Date of Birth",placeholder:"MM/DD/YYYY"},{key:"child1Allergies",label:"Allergies or Medications",placeholder:"None, or list any allergies/meds"},{key:"child1CalmingCue",label:"What calms them down?",placeholder:"e.g., favorite stuffed animal, a song, back rubs"}]},{id:2,title:"Medical Snapshot",description:"Peace of mind knowing health info is documented",subtitle:"Halfway there - you're doing amazing!",icon:Na,time:"1.5 min",fields:[{key:"primaryPhysician",label:"Primary Physician",placeholder:"Dr. Name"},{key:"physicianPhone",label:"Physician Phone",placeholder:"555-123-4567"},{key:"insuranceLocation",label:"Where are insurance cards?",placeholder:"e.g., wallet, file cabinet, uploaded to app"},{key:"criticalConditions",label:"Critical Health Conditions",placeholder:"None, or list conditions"}]},{id:3,title:"Financial Continuity",description:"Ensure bills get paid and life continues smoothly",subtitle:"Almost done - just one more after this!",icon:ba,time:"1.5 min",fields:[{key:"mainBank",label:"Main Bank & Account Type",placeholder:"e.g., Chase Checking"},{key:"essentialAutopays",label:"Essential Autopays",placeholder:"Mortgage, utilities, insurance - what must keep running?"}]},{id:4,title:"Pets & Household",description:"Don't forget the furry family members!",subtitle:"Last step - you've got this!",icon:Ha,time:"1.5 min",fields:[{key:"petNames",label:"Pet Names & Types",placeholder:"e.g., Buddy (golden retriever), Whiskers (cat)"},{key:"petFeeding",label:"Feeding Routine",placeholder:"e.g., 1 cup morning and evening, treats at noon"},{key:"vetInfo",label:"Vet Name & Phone",placeholder:"e.g., Happy Paws Vet, 555-123-4567"}]}];function cs(){const[,y]=fa(),{toast:f}=ga(),{user:v}=ya(),{isOwner:M}=ja(),I=()=>{const a=new URLSearchParams(window.location.search).get("step");if(a!==null){const s=parseInt(a,10);if(!isNaN(s)&&s>=0&&s<S.length)return s}return 0},[d,E]=r.useState(I),[u,O]=r.useState({}),[p,le]=r.useState([]),[Y,ce]=r.useState(!1),[V,De]=r.useState(!1),[de,Ft]=r.useState(""),[ee,Rt]=r.useState(""),[Tt,Mt]=r.useState(!1),[B,te]=r.useState(null),[Ie,ae]=r.useState(null),[G,et]=r.useState(!1),_=r.useRef(null),[se,$e]=r.useState(1),[ie,Ae]=r.useState(1),[z,Ee]=r.useState(0),[U,Fe]=r.useState(0),[F,tt]=r.useState({}),[Ot,Re]=r.useState({}),D=r.useRef({}),[at,me]=r.useState(!1),[Yt,Bt]=r.useState(""),[Lt,st]=r.useState(!1),[Te,it]=r.useState(null),[zt,nt]=r.useState(!1);r.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[d]);const[Ut,Me]=r.useState(!1),[ne,W]=r.useState("age_gate"),[rt,Oe]=r.useState(!1),[he,Ye]=r.useState(!1),[ue,Be]=r.useState(!1),[Wt,ot]=r.useState(!1),[qt,lt]=r.useState(!1),Le=r.useRef(null),ct=r.useRef(!1),{data:w}=Ve({queryKey:["/api/quick-start"]}),{data:Ht,isLoading:Vt}=Ve({queryKey:["/api/consent/status"]}),{data:ze=[]}=Ve({queryKey:["/api/reminders/companions"]}),dt=Ht?.parentalConsent?.status==="verified",k=d===1&&!dt&&!Vt;r.useEffect(()=>{if(w&&!ct.current){if(ct.current=!0,new URLSearchParams(window.location.search).get("step")===null){const C=w.currentStep||0,N=S.length-1;E(C>N?N:C)}const s=w.stepData||{},i=s[0]||{};if(!i.ownerName&&v){const C=v.firstName&&v.lastName?`${v.firstName} ${v.lastName}`:v.firstName||"";C&&(s[0]={...i,ownerName:C})}O(s),le(w.completedSteps||[]),ce(w.isCompleted||!1);const c=w.stepData?.[1]||{};let j=1;
1Object.keys(c).forEach(C=>{const N=C.match(/^child(\d+)/);if(N){const A=parseInt(N[1],10);A>j&&(j=A)}}),$e(j);const n=w.stepData?.[4]||{};let g=1;Object.keys(n).forEach(C=>{const N=C.match(/^pet(\d+)/);if(N){const A=parseInt(N[1],10);A>g&&(g=A)}}),Ae(g);const R=w.stepData?.[0]||{};R.spouseName&&De(!0);let qe=0;Object.keys(R).forEach(C=>{const N=C.match(/^backupContact(\d+)/);if(N){const A=parseInt(N[1],10);A>qe&&(qe=A)}}),Ee(qe);const pa=w.stepData?.[2]||{};let He=0;Object.keys(pa).forEach(C=>{const N=C.match(/^additionalDoctor(\d+)/);if(N){const A=parseInt(N[1],10);A>He&&(He=A)}}),Fe(He)}},[w,v]);const $=ge({mutationFn:async t=>Q("POST","/api/quick-start",t),onError:t=>{console.error("[Quick Start] Save failed:",t.message),f({title:"Auto-save failed",description:"Your changes may not be saved. Please try again.",variant:"destructive"})}}),Ue=ge({mutationFn:async t=>Q("POST","/api/access-shares",{guestName:t.guestName,guestEmail:t.guestEmail,role:"companion",status:"pending"}),onSuccess:()=>{Mt(!0),f({title:"Invitation sent!",description:`${de} will receive an email to join your vault.`}),Ge.invalidateQueries({queryKey:["/api/access-shares"]})},onError:t=>{f({title:"Failed to send invitation",description:t.message||"Please try again later.",variant:"destructive"})}}),pe=ge({mutationFn:async t=>{const{stepId:a,flaggedForCompanion:s,targetCompanionId:i}=t,c=S[a]?.title||`Step ${a+1}`;return Q("POST","/api/reminders",{moduleId:"quick-start",sectionId:`step-${a}`,note:`Continue with: ${c}`,flaggedForCompanion:s||!1,targetCompanionId:i||null})},onSuccess:(t,a)=>
1{if(Ge.invalidateQueries({predicate:s=>Array.isArray(s.queryKey)&&typeof s.queryKey[0]=="string"&&s.queryKey[0].startsWith("/api/reminders")}),a.flaggedForCompanion){const s=a.targetCompanionName||"your companion";f({title:"Flagged for companion",description:`${s} will see this in their task list.`})}else f({title:"Reminder saved",description:"You can find this in your 'Come Back Later' list on the dashboard."})},onError:()=>{f({title:"Failed to save reminder",description:"Please try again.",variant:"destructive"})}}),re=r.useCallback(async t=>{if(!t||t.length<8)return te(null),ae(null),_.current=null,null;et(!0);const a=(async()=>{try{return(await(await fetch(`/api/referral/validate/${encodeURIComponent(t)}`,{credentials:"include"})).json()).valid?(te(!0),ae(null),!0):(te(!1),ae("This code is not valid or has reached its limit"),!1)}catch{return te(!1),ae("Could not verify code"),!1}finally{et(!1),_.current=null}})();return _.current=a,a},[]),Gt=r.useCallback(async t=>!t||t.length<8?null:B!==null&&!G?B:_.current?_.current:re(t),[B,G,re]),_t=r.useCallback(async t=>{if(!(!t||t.length<4))try{await fetch("/api/referral/store-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t}),credentials:"include"}),await fetch("/api/referral/process-signup",{method:"POST",credentials:"include"}),console.log("[REFERRAL] Processed referral code:",t)}catch(a){console.error("[REFERRAL] Failed to process referral code:",a)}},[]);r.useEffect(()=>{w&&u[0]?.referralCode&&u[0].referralCode.length>=8&&B===null&&!G&&re(u[0].referralCode)},[w,u,B,G,re]);const We=ge({mutationFn:async t=>{const s=await(await Q("POST","/api/consent/parental/initiate",{verificationMethod:"knowledge_based"})).json(),{consentId:i}=s;return Q("POST","/api/consent/parental/verify",{consentId:i,acceptedTerms:t.acceptedTerms,acceptedPrivacy:t.acceptedPrivacy})},onSuccess:()=>{Ge.invalidateQueries({queryKey:["/api/consent/status"]}),W("complete"),f({title:"Consent Verified",description:"You can now add and manage children's information."})},onError:t=>{f({title:"Verification Failed",description:t.message||"Failed to verify consent. Please try again.",variant:"destructive"})}}),Qt=()=>{if(!he||!ue){f({title:"Please accept all terms",description:"You must accept the Terms of Service and Privacy Policy to continue.",variant:"destructive"});return}We.mutate({acceptedTerms:he,acceptedPrivacy:ue})},Kt=t=>{t||(Me(!1),ne!=="complete"||(W("age_gate"),Oe(!1),Ye(!1),Be(!1)))},Zt=()=>{Me(!1),W("age_gate"),Oe(!1),Ye(!1),Be(!1)},Jt=()=>{if(!de.trim()||!ee.trim()){f({title:"Please fill in both fields",description:"Name and email are required to send an invitation.",variant:"destructive"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(ee)){f({title:"Invalid email",description:"Please enter a valid email address.",variant:"destructive"});return}Ue.mutate({guestName:de,guestEmail:ee})},Xt=()=>{se<10&&$e(t=>t+1)},It=t=>{if(t>1&&t<=se){const a=u[1]||{},s={...a};Object.keys(s).forEach(c=>{c.startsWith(`child${t}`)&&delete s[c]});for(let c=t+1;c<=se;c++){const j=c-1;Object.keys(a).forEach(n=>{if(n.startsWith(`child${c}`)){const g=n.replace(`child${c}`,"");s[`child${j}${g}`]=a[n],delete s[n]}})}const i={...u,1:s};O(i),$e(c=>c-1),$.mutate({currentStep:d,completedSteps:p,isCompleted:Y,stepData:i})}},ea=t=>[{key:`child${t}Name`,label:t===1?"Child's Name":`Child ${t}'s Name`,placeholder:"First and last name"},{key:`child${t}Relationship`,label:"Relationship",placeholder:"Son, Daughter, Stepson, etc.",type:"select",options:["Son","Daughter","Stepson","Stepdaughter","Foster Child","Grandchild","Other"]},{key:`child${t}DOB`,label:"Date of Birth",placeholder:"MM/DD/YYYY"},{key:`child${t}Allergies`,label:"Allergies or Medications",placeholder:"None, or list any allergies/meds"},{key:`child${t}CalmingCue`,label:"What calms them down?",placeholder:"e.g., favorite stuffed animal, a song, back rubs"}],ta=()=>{ie<10&&Ae(t=>t+1)},aa=t=>{if(t>1&&t<=ie){const a=u[4]||{},s={...a};Object.keys(s).forEach(c=>{c.startsWith(`pet${t}`)&&delete s[c]});for(let c=t+1;c<=ie;c++){const j=c-1;
1Object.keys(a).forEach(n=>{if(n.startsWith(`pet${c}`)){const g=n.replace(`pet${c}`,"");s[`pet${j}${g}`]=a[n],delete s[n]}})}const i={...u,4:s};O(i),Ae(c=>c-1),$.mutate({currentStep:d,completedSteps:p,isCompleted:Y,stepData:i})}},sa=()=>{z<10&&Ee(t=>t+1)},ia=t=>{if(t>=1&&t<=z){const a=u[0]||{},s={...a},i={};for(let n=1;n<=z;n++)n!==t&&(i[n]={},Object.keys(a).forEach(g=>{if(g.startsWith(`backupContact${n}`)){const R=g.replace(`backupContact${n}`,"");i[n][R]=a[g]}}));Object.keys(s).forEach(n=>{n.match(/^backupContact\d+/)&&delete s[n]});let c=1;for(let n=1;n<=z;n++)n!==t&&i[n]&&(Object.entries(i[n]).forEach(([g,R])=>{s[`backupContact${c}${g}`]=R}),c++);const j={...u,0:s};O(j),Ee(n=>n-1),$.mutate({currentStep:d,completedSteps:p,isCompleted:Y,stepData:j})}},na=()=>{U<10&&Fe(t=>t+1)},ra=t=>{if(t>=1&&t<=U){const a=u[2]||{},s={...a},i={};for(let n=1;n<=U;n++)n!==t&&(i[n]={},Object.keys(a).forEach(g=>{if(g.startsWith(`additionalDoctor${n}`)){const R=g.replace(`additionalDoctor${n}`,"");i[n][R]=a[g]}}));Object.keys(s).forEach(n=>{n.match(/^additionalDoctor\d+/)&&delete s[n]});let c=1;for(let n=1;n<=U;n++)n!==t&&i[n]&&(Object.entries(i[n]).forEach(([g,R])=>{s[`additionalDoctor${c}${g}`]=R}),c++);const j={...u,2:s};O(j),Fe(n=>n-1),$.mutate({currentStep:d,completedSteps:p,isCompleted:Y,stepData:j})}},xe=async(t,a)=>{if(!a.type.startsWith("image/")){f({title:"Invalid file type",description:"Please upload an image file (JPG, PNG, or GIF)",variant:"destructive"});return}const s=URL.createObjectURL(a);Re(i=>({...i,[t]:s})),tt(i=>({...i,[t]:!0}));try{const i=await Q("POST","/api/uploads/request-url",{name:a.name,size:a.size,contentType:a.type});if(!i.ok)throw new Error("Failed to get upload URL");const{uploadURL:c,objectPath:j}=await i.json(),n=await fetch(c,{method:"PUT",body:a,headers:{"Content-Type":a.type},mode:"cors"});if(!n.ok)throw console.error("Upload to storage failed:",n.status,n.statusText),new Error(`Storage upload failed: ${n.status}`);o(t,j)}catch(i){console.error("Upload error:",i),Re(c=>{const j={...c};return delete j[t],j}),f({title:"Upload failed",description:"Failed to upload photo. Please try again.",variant:"destructive"})}finally{tt(i=>({...i,[t]:!1}))}},fe=t=>{o(t,""),Re(s=>{const i={...s};return delete i[t],i});const a=D.current[t];a&&(a.value="")},P=t=>Ot[t]||l[t]||null,oa=t=>[{key:`pet${t}Name`,label:t===1?"Pet Name & Type":`Pet ${t} Name & Type`,placeholder:"e.g., Buddy (golden retriever)"},{key:`pet${t}Feeding`,label:"Feeding Routine",placeholder:"e.g., 1 cup morning and evening, treats at noon"},{key:`pet${t}VetInfo`,label:"Vet Name & Phone",placeholder:"e.g., Happy Paws Vet, 555-123-4567"},{key:`pet${t}Notes`,label:"Notes",placeholder:"e.g., Loves belly rubs, scared of thunder",isTextarea:!0}],la=t=>t.toLowerCase().includes("phone"),o=(t,a)=>{let s=a;la(t)?s=H(a):Ka(t)&&(s=Qe(a));const i={...u,[d]:{...u[d],[t]:s}};O(i),Le.current&&clearTimeout(Le.current),Le.current=setTimeout(()=>{$.mutate({currentStep:d,completedSteps:p,isCompleted:Y,stepData:i},{onSuccess:()=>{nt(!0),setTimeout(()=>nt(!1),2e3)}})},1e3)},ca=t=>{const a=u[t];return a?Object.keys(a).filter(i=>i!=="referralCode").some(i=>{const c=a[i];return typeof c=="string"?c.trim().length>0:Array.isArray(c)?c.length>0:c!=null&&c!==!1}):!1},mt=(t,a,s)=>{if(!(!s&&!a)&&(s&&(Bt(Za[t]||"Great progress!"),st(!0),setTimeout(()=>st(!1),3e3)),a&&s&&me(!0),s)){const i=Ja[t];i&&setTimeout(()=>{it(i)},500)}},da=async()=>{const t=Array.from(new Set([...p,d]));le(t);const a=d;d===0&&u[0]?.referralCode&&await Gt(u[0].referralCode)===!0&&await _t(u[0].referralCode);const s=ca(a);if(d<S.length-1){const i=d+1;E(i),$.mutate({currentStep:i,completedSteps:t,isCompleted:!1,stepData:u},{onSuccess:()=>{mt(a,!1,s)}})}else ce(!0),$.mutate({currentStep:d,completedSteps:t,isCompleted:!0,stepData:u},{onSuccess:()=>{mt(a,!0,s)}})},ma=()=>{if(d>0){const t=d-1;E(t),$.mutate({currentStep:t,completedSteps:p,isCompleted:!1,stepData:u})}else y("/dashboard")},ht=()=>{if(d<S.length-1){const t=d+1;E(t),$.mutate({currentStep:t,completedSteps:p,isCompleted:!1,stepData:u})}else ce(!0),$.mutate({currentStep:d,completedSteps:p,isCompleted:!0,stepData:u})},ha=()=>{Pe("tap"),y("/dashboard")},l=u[d]||{},q=S[d],ut=(d+1)/S.length*100,ua=S.slice(d).reduce((t,a)=>t+parseFloat(a.time),0);return r.useEffect(()=>{Y&&me(!0)},[Y]),Y?e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-background flex items-center justify-center p-4",children:[e.jsx(At,{trigger:at,onComplete:()=>me(!1),pieceCount:80}),e.jsx(b.div,{initial:{opacity:0,scale:.9}
1,animate:{opacity:1,scale:1},className:"max-w-lg w-full",children:e.jsxs(pt,{className:"border-primary/20 overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary/0 via-primary/20 to-primary/0 animate-pulse"}),e.jsxs(xt,{className:"pt-6 text-center space-y-4 relative",children:[e.jsx(b.div,{initial:{scale:0,rotate:-180},animate:{scale:1,rotate:0},transition:{delay:.2,type:"spring",stiffness:200,damping:10},className:"w-16 h-16 mx-auto rounded-full bg-gradient-to-br from-green-500 to-emerald-600 flex items-center justify-center shadow-lg shadow-green-500/30",children:e.jsx(St,{className:"w-8 h-8 text-white"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("h1",{className:"text-xl font-bold",children:"Great First Step!"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"You've captured the essentials - now explore each module to build a complete guide."})]}),e.jsxs("div",{className:"bg-primary/5 rounded-lg p-3 space-y-1 text-left",children:[e.jsx("p",{className:"text-xs text-muted-foreground font-medium mb-1",children:"What you've started:"}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-2 gap-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx(T,{className:"w-3 h-3 text-primary shrink-0"}),e.jsx("span",{children:"Emergency contacts"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx(T,{className:"w-3 h-3 text-primary shrink-0"}),e.jsx("span",{children:"Children's basics"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx(T,{className:"w-3 h-3 text-primary shrink-0"}),e.jsx("span",{children:"Medical snapshot"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx(T,{className:"w-3 h-3 text-primary shrink-0"}),e.jsx("span",{children:"Financial overview"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx(T,{className:"w-3 h-3 text-primary shrink-0"}),e.jsx("span",{children:"Pet care basics"})]})]})]}),e.jsx("div",{className:"bg-amber-500/10 border border-amber-500/20 rounded-lg p-3 text-left",children:e.jsxs("p",{className:"text-xs text-amber-700 dark:text-amber-400",children:[e.jsx("strong",{children:"This is just the beginning."})," Each module has much more to explore."]})}),e.jsxs("div",{className:"bg-muted/30 rounded-lg p-3 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-left",children:[e.jsx(Ca,{className:"w-4 h-4 text-primary shrink-0"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Invite someone you trust to access your vault"})]}),e.jsx(h,{variant:"outline",size:"sm",className:"shrink-0 text-xs",onClick:()=>{Pe("tap"),y("/access")},"data-testid":"button-invite-member",children:"Invite"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs(h,{onClick:ha,className:"w-full gap-2","data-testid":"button-go-to-dashboard",children:["Explore the Modules",e.jsx(ye,{className:"w-4 h-4"})]}),e.jsxs(h,{variant:"outline",onClick:()=>{ce(!1),E(0)},className:"w-full gap-2","data-testid":"button-edit-quick-start",children:[e.jsx(wa,{className:"w-4 h-4"}),"Edit My Info"]})]})]})]})})]}):e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-background",children:[e.jsx("header",{className:"sticky top-0 z-50 bg-background/80 backdrop-blur-sm border-b",children:e.jsxs("div",{className:"max-w-2xl mx-auto px-4 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-primary to-primary/60 flex items-center justify-center",children:e.jsx(ka,{className:"w-4 h-4 text-primary-foreground"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-sm font-semibold",children:"Quick Start"}),e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(ft,{className:"w-3 h-3"}),"~",ua.toFixed(0)," min remaining"]})]})]}),e.jsx(h,{variant:"ghost",size:"sm",onClick:()=>{Pe("tap"),y("/dashboard")},"data-testid":"button-skip-to-dashboard",children:"Skip for now"})]}),e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary/20 via-primary/40 to-primary/20 blur-md rounded-full",style:{width:`${ut}%`,transition:"width 0.5s ease-out"}}),e.jsx(qa,{value:ut,className:"h-2.5 relative"})]}),e.jsx("div",{className:"flex items-center justify-between",children:S.map((t,a)=>e.jsx(b.div,{initial:!1,animate:{scale:p.includes(a)?[1,1.2,1]:1},transition:{duration:.3},className:`flex items-center justify-center w-6 h-6 rounded-full text-xs font-medium transition-all ${p.includes(a)?"bg-primary text-primary-foreground":a===d?"bg-primary/20 text-primary border-2 border-primary":"bg-muted text-muted-foreground"}`,children:p.includes(a)?e.jsx(T,{className:"w-3 h-3"}):a+1},t.id))}),e.jsxs("div",{className:"flex justify-between items-center text-xs",children:[e.jsxs("span",{className:"text-muted-foreground",children:["Step ",d+1," of ",S.length]}),e.jsxs("div",{className:"flex items-center gap-2",children:[zt&&e.jsxs(b.span,{initial:{opacity:0,x:10}
1,animate:{opacity:1,x:0},exit:{opacity:0},className:"text-green-500 flex items-center gap-1",children:[e.jsx(Qa,{show:!0}),"Saved"]}),e.jsx("span",{className:"text-primary font-medium",children:Et[d%Et.length]})]})]})]})]})}),e.jsx("main",{className:"max-w-2xl mx-auto px-4 py-8",children:e.jsx(oe,{mode:"wait",children:e.jsxs(b.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.2},children:[e.jsxs(pt,{className:"border-border/50 overflow-hidden",children:[e.jsx(Pa,{className:"pb-4",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsxs(b.div,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},transition:{type:"spring",stiffness:200,damping:15},className:"w-12 h-12 rounded-xl bg-gradient-to-br from-primary/20 to-primary/5 flex items-center justify-center shrink-0 relative",children:[e.jsx(q.icon,{className:"w-6 h-6 text-primary"}),p.includes(d)&&e.jsx(b.div,{initial:{scale:0},animate:{scale:1},className:"absolute -top-1 -right-1 w-5 h-5 bg-green-500 rounded-full flex items-center justify-center",children:e.jsx(T,{className:"w-3 h-3 text-white"})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(Sa,{className:"text-xl",children:q.title}),e.jsxs(Da,{variant:"secondary",className:"text-xs",children:[e.jsx(ft,{className:"w-3 h-3 mr-1"}),q.time]})]}),e.jsx($a,{className:"mt-1",children:q.description}),q.subtitle&&e.jsx(b.p,{initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:.2},className:"text-xs text-primary font-medium mt-2",children:q.subtitle})]})]})}),e.jsx(L,{}),e.jsxs(xt,{className:"pt-6 space-y-5 relative",children:[k&&e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/95 backdrop-blur-sm rounded-lg",children:e.jsxs("div",{className:"text-center p-8 max-w-md",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-destructive/10 flex items-center justify-center mx-auto mb-4",children:e.jsx(gt,{className:"w-8 h-8 text-destructive"})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:M?"Parental Consent Required":"Child Data Not Available"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:M?"To protect children's privacy under COPPA regulations, you must verify your parental consent before adding children's information.":"The vault owner hasn't set up parental consent for children's information yet. Please contact the vault owner to enable this feature."}),e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-4",children:[e.jsx(_e,{className:"w-4 h-4 text-primary"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"COPPA Compliant Protection"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[M&&e.jsxs(h,{className:"gap-2 w-full",onClick:()=>Me(!0),"data-testid":"button-setup-consent-quickstart",children:[e.jsx(_e,{className:"w-4 h-4"}),"Set Up Parental Consent"]}),e.jsx(h,{variant:"outline",size:"sm",onClick:ht,"data-testid":"button-skip-step",children:"Skip This Step"})]})]})}),d===0?e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-medium text-sm text-muted-foreground uppercase tracking-wide",children:"About You"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"ownerName",children:"Your Name"}),e.jsx(x,{id:"ownerName",placeholder:"First and last name",value:l.ownerName??"",onChange:t=>o("ownerName",t.target.value),"data-testid":"input-ownerName"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"ownerPhone",children:"Your Phone"}),e.jsx(x,{id:"ownerPhone",type:"tel",inputMode:"tel",autoComplete:"tel",placeholder:"555-123-4567",value:l.ownerPhone||"",onChange:t=>o("ownerPhone",H(t.target.value)),"data-testid":"input-ownerPhone"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"ownerDOB",children:"Your Date of Birth (optional)"}),e.jsx(x,{id:"ownerDOB",placeholder:"MM/DD/YYYY",value:l.ownerDOB||"",onChange:t=>o("ownerDOB",Qe(t.target.value)),"data-testid":"input-ownerDOB"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{children:"Your Photo (optional)"}),e.jsxs("div",{className:"flex items-center gap-3",children:[P("ownerPhoto")?e.jsxs("div",{className:"relative",children:[e.jsx(je,{className:"w-16 h-16",children:e.jsx("img",{src:P("ownerPhoto"),alt:"Your photo",className:"w-full h-full object-cover rounded-full"})}),e.jsx(h,{type:"button",size:"icon",variant:"secondary",className:"absolute -top-1 -right-1 w-5 h-5 rounded-full",onClick:()=>fe("ownerPhoto"),"data-testid":"button-remove-owner-photo",children:e.jsx(ve,{className:"w-3 h-3"})})]}):e.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center",children:e.jsx(ke,{className:"w-6 h-6 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("input",{type:"file",accept:"image/*",ref:t=>{D.current.ownerPhoto=t},onChange:t=>{const a=t.target.files?.[0];a&&xe("ownerPhoto",a)},className:"hidden","data-testid":"input-owner-photo"}),e.jsx(h,{type:"button",variant:"outline",size:"sm",onClick:()=>D.current.ownerPhoto?.click(),disabled:F.ownerPhoto,"data-testid":"button-upload-owner-photo",children:F.ownerPhoto?"Uploading...":P("ownerPhoto")?"Change":"Add Photo"})]})]})]}),e.jsxs("div",{className:"space-y-2 pt-2",children:[e.jsx(m,{htmlFor:"referralCode",children:"Referral Code (optional)"}),e.jsxs("div",{className:"relative",children:[e.jsx(x,{id:"referralCode",placeholder:"Enter code if you have one",value:l.referralCode||"",onChange:t=>{o("referralCode",t.target.value.toUpperCase()),te(null),ae(null),_.current=null},onBlur:t=>re(t.target.value),className:B===!0?"border-green-500 pr-8":B===!1?"border-red-500 pr-8":"","data-testid":"input-referralCode"}),G&&e.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2",children:e.jsx(Ke,{className:"w-4 h-4 animate-spin text-muted-foreground"})}),B===!0&&!G&&e.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2",children:e.jsx(T,{className:"w-4 h-4 text-green-500"})})]}),Ie&&e.jsx("p",{className:"text-xs text-destructive",children:Ie}),B===!0&&e.jsx("p",{className:"text-xs text-green-600 dark:text-green-400",children:"Valid code! You'll both get a free month when you subscribe."}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Got a code from a friend? Enter it here to get a free month once you subscribe."})]})]}),e.jsx(L,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium text-sm",children:"Add Spouse/Partner?"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Include your partner in the household"})]}),e.jsx(h,{variant:V||l.spouseName?"default":"outline",size:"sm",onClick:()=>{De(!V&&!l.spouseName),(V||l.spouseName)&&(o("spouseName",""),o("spousePhone",""),o("spouseEmail",""),o("spouseDOB",""),De(!1))},"data-testid":"button-toggle-spouse",children:V||l.spouseName?"Remove":"Add"})]}),(V||l.spouseName)&&e.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"spouseName",children:"Spouse/Partner Name"}),e.jsx(x,{id:"spouseName",placeholder:"First and last name",value:l.spouseName||"",onChange:t=>o("spouseName",t.target.value),"data-testid":"input-spouseName"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"spousePhone",children:"Spouse/Partner Phone"}),e.jsx(x,{id:"spousePhone",type:"tel",inputMode:"tel",autoComplete:"tel",placeholder:"555-123-4567",value:l.spousePhone||"",onChange:t=>o("spousePhone",H(t.target.value)),"data-testid":"input-spousePhone"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"spouseEmail",children:"Spouse/Partner Email (optional)"}),e.jsx(x,{id:"spouseEmail",type:"email",inputMode:"email",autoComplete:"email",placeholder:"[email protected]",value:l.spouseEmail||"",onChange:t=>o("spouseEmail",t.target.value),"data-testid":"input-spouseEmail"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"spouseDOB",children:"Spouse/Partner Date of Birth (optional)"}),e.jsx(x,{id:"spouseDOB",placeholder:"MM/DD/YYYY",value:l.spouseDOB||"",onChange:t=>o("spouseDOB",Qe(t.target.value)),"data-testid":"input-spouseDOB"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{children:"Spouse/Partner Photo (optional)"}),e.jsxs("div",{className:"flex items-center gap-3",children:[P("spousePhoto")?e.jsxs("div",{className:"relative",children:[e.jsx(je,{className:"w-16 h-16",children:e.jsx("img",{src:P("spousePhoto"),alt:"Spouse photo",className:"w-full h-full object-cover rounded-full"})}),e.jsx(h,{type:"button",size:"icon",variant:"secondary",className:"absolute -top-1 -right-1 w-5 h-5 rounded-full",onClick:()=>fe("spousePhoto"),"data-testid":"button-remove-spouse-photo",children:e.jsx(ve,{className:"w-3 h-3"})})]}):e.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center",children:e.jsx(ke,{className:"w-6 h-6 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("input",{type:"file",accept:"image/*",ref:t=>{D.current.spousePhoto=t},onChange:t=>{const a=t.target.files?.[0];a&&xe("spousePhoto",a)},className:"hidden","data-testid":"input-spouse-photo"}),e.jsx(h,{type:"button",variant:"outline",size:"sm",onClick:()=>D.current.spousePhoto?.click(),disabled:F.spousePhoto,"data-testid":"button-upload-spouse-photo",children:F.spousePhoto?"Uploading...":P("spousePhoto")?"Change":"Add Photo"})]})]})]}),l.spouseEmail&&e.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[e.jsx(Ne,{id:"inviteSpouseAsCompanion",checked:l.inviteSpouseAsCompanion==="true",onCheckedChange:t=>o("inviteSpouseAsCompanion",t?"true":"false"),"data-testid":"checkbox-invite-spouse-companion"}),e.jsx(m,{htmlFor:"inviteSpouseAsCompanion",className:"text-sm font-normal cursor-pointer",children:"Invite as companion (full vault access)"})]})]})]}),e.jsx(L,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-medium text-sm text-muted-foreground uppercase tracking-wide",children:"Emergency Contacts"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"primaryEmergencyContact",children:"Who should be called first in an emergency?"}),e.jsxs(bt,{value:l.primaryEmergencyContact||"",onValueChange:t=>o("primaryEmergencyContact",t),children:[e.jsx(Ct,{"data-testid":"select-primaryEmergencyContact",children:e.jsx(wt,{placeholder:"Select primary contact"})}),e.jsxs(kt,{children:[e.jsx(we,{value:"Me",children:"Me"}),(V||l.spouseName)&&e.jsx(we,{value:"My Spouse/Partner",children:"My Spouse/Partner"}),e.jsx(we,{value:"Someone Else",children:"Someone Else"})]})]})]}),l.primaryEmergencyContact==="Someone Else"&&e.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-primary/20",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"otherEmergencyName",children:"Primary Contact Name"}),e.jsx(x,{id:"otherEmergencyName",placeholder:"e.g., Mom, Sister, Best Friend",value:l.otherEmergencyName||"",onChange:t=>o("otherEmergencyName",t.target.value),"data-testid":"input-otherEmergencyName"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"otherEmergencyPhone",children:"Primary Contact Phone"}),e.jsx(x,{id:"otherEmergencyPhone",placeholder:"555-123-4567",value:l.otherEmergencyPhone||"",onChange:t=>o("otherEmergencyPhone",H(t.target.value)),"data-testid":"input-otherEmergencyPhone"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"otherEmergencyRelationship",children:"Relationship (optional)"}),e.jsx(x,{id:"otherEmergencyRelationship",placeholder:"e.g., Mother, Sister, Neighbor",value:l.otherEmergencyRelationship||"",onChange:t=>o("otherEmergencyRelationship",t.target.value),"data-testid":"input-otherEmergencyRelationship"})]})]}),z>
10&&e.jsxs("div",{className:"space-y-4 mt-4",children:[e.jsx("h4",{className:"font-medium text-sm text-muted-foreground",children:"Backup Emergency Contacts"}),Array.from({length:z},(t,a)=>a+1).map(t=>e.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-muted/40",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["Backup Contact ",t]}),e.jsxs(h,{variant:"ghost",size:"sm",onClick:()=>ia(t),className:"text-muted-foreground hover:text-destructive h-8 px-2","data-testid":`button-remove-backup-contact-${t}`,children:[e.jsx(be,{className:"w-4 h-4 mr-1"}),"Remove"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:`backupContact${t}Name`,children:"Name"}),e.jsx(x,{id:`backupContact${t}Name`,placeholder:"Contact's name",value:l[`backupContact${t}Name`]||"",onChange:a=>o(`backupContact${t}Name`,a.target.value),"data-testid":`input-backupContact${t}Name`})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:`backupContact${t}Phone`,children:"Phone"}),e.jsx(x,{id:`backupContact${t}Phone`,placeholder:"555-123-4567",value:l[`backupContact${t}Phone`]||"",onChange:a=>o(`backupContact${t}Phone`,H(a.target.value)),"data-testid":`input-backupContact${t}Phone`})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:`backupContact${t}Relationship`,children:"Relationship (optional)"}),e.jsx(x,{id:`backupContact${t}Relationship`,placeholder:"e.g., Grandmother, Aunt, Neighbor",value:l[`backupContact${t}Relationship`]||"",onChange:a=>o(`backupContact${t}Relationship`,a.target.value),"data-testid":`input-backupContact${t}Relationship`})]})]},`backup-contact-${t}`))]}),z<10&&e.jsxs(h,{type:"button",variant:"outline",size:"sm",onClick:sa,className:"w-full mt-2","data-testid":"button-add-backup-contact",children:[e.jsx(Ce,{className:"w-4 h-4 mr-2"}),"Add Additional Emergency Contact"]})]}),e.jsx(L,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-medium text-sm text-muted-foreground uppercase tracking-wide",children:"Home"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"homeAddress",children:"Home Address"}),e.jsx(Pt,{value:l.homeAddress||"",onChange:(t,a,s)=>{o("homeAddress",t),a&&o("homeAddressLat",a),s&&o("homeAddressLon",s)},placeholder:"123 Main St, City, State ZIP","data-testid":"input-homeAddress"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"accessNotes",children:"Home Access Notes (optional)"}),e.jsx(X,{id:"accessNotes",placeholder:"Gate code: 1234, spare key under mat",value:l.accessNotes||"",onChange:t=>o("accessNotes",t.target.value),className:"min-h-[80px]","data-testid":"input-accessNotes"})]})]})]}):d===1?e.jsxs(e.Fragment,{children:[Array.from({length:se},(t,a)=>a+1).map(t=>e.jsxs("div",{className:"space-y-4",children:[t>1&&e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsx(L,{className:"flex-1"}),e.jsxs(h,{variant:"ghost",size:"sm",onClick:()=>It(t),className:"ml-2 text-muted-foreground hover:text-destructive",disabled:k,"data-testid":`button-remove-child-${t}`,children:[e.jsx(be,{className:"w-4 h-4 mr-1"}),"Remove"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{children:"Photo (optional)"}),e.jsxs("div",{className:"flex items-center gap-4",children:[P(`child${t}Photo`)?e.jsxs("div",{className:"relative",children:[e.jsx(je,{className:"w-16 h-16",children:e.jsx("img",{src:P(`child${t}Photo`),alt:"Preview",className:"w-full h-full object-cover rounded-full"})}),e.jsx(h,{type:"button",size:"icon",variant:"secondary",className:"absolute -top-1 -right-1 w-5 h-5 rounded-full",onClick:()=>fe(`child${t}Photo`),disabled:k,"data-testid":`button-remove-child-${t}-photo`,children:e.jsx(ve,{className:"w-3 h-3"})})]}):e.jsx("div",{className:"w-16 h-16 rounded-full border-2 border-dashed border-muted-foreground/30 flex items-center justify-center cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>!k&&D.current[`child${t}Photo`]?.click(),children:F[`child${t}Photo`]?e.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-primary border-t-transparent roun
1ded-full"}):e.jsx(ke,{className:"w-5 h-5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("input",{ref:a=>{D.current[`child${t}Photo`]=a},type:"file",accept:"image/*",onChange:a=>{const s=a.target.files?.[0];s&&xe(`child${t}Photo`,s)},className:"hidden","data-testid":`input-child-${t}-photo`}),e.jsx(h,{type:"button",variant:"outline",size:"sm",onClick:()=>D.current[`child${t}Photo`]?.click(),disabled:F[`child${t}Photo`]||k,"data-testid":`button-upload-child-${t}-photo`,children:F[`child${t}Photo`]?"Uploading...":P(`child${t}Photo`)?"Change":"Add Photo"})]})]})]}),ea(t).map(a=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:a.key,children:a.label}),a.key.includes("Allergies")?e.jsx(X,{id:a.key,placeholder:a.placeholder,value:l[a.key]||"",onChange:s=>o(a.key,s.target.value),className:"min-h-[80px]","data-testid":`input-${a.key}`,disabled:k}):a.type==="select"?e.jsxs(bt,{value:l[a.key]||"",onValueChange:s=>o(a.key,s),disabled:k,children:[e.jsx(Ct,{"data-testid":`select-${a.key}`,children:e.jsx(wt,{placeholder:a.placeholder})}),e.jsx(kt,{children:(a.options||[]).map(s=>e.jsx(we,{value:s,children:s},s))})]}):e.jsx(x,{id:a.key,placeholder:a.placeholder,value:l[a.key]||"",onChange:s=>o(a.key,s.target.value),"data-testid":`input-${a.key}`,disabled:k})]},a.key))]},`child-${t}`)),se<10&&e.jsx("div",{className:"pt-2",children:e.jsxs(h,{variant:"outline",onClick:Xt,className:"w-full gap-2",disabled:k,"data-testid":"button-add-another-child",children:[e.jsx(Ce,{className:"w-4 h-4"}),"Add Another Child"]})})]}):d===2?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-medium text-sm text-muted-foreground uppercase tracking-wide",children:"Primary Care"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"primaryPhysician",children:"Primary Physician"}),e.jsx(x,{id:"primaryPhysician",placeholder:"Dr. Name",value:l.primaryPhysician||"",onChange:t=>o("primaryPhysician",t.target.value),"data-testid":"input-primaryPhysician"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"physicianPhone",children:"Physician Phone"}),e.jsx(x,{id:"physicianPhone",placeholder:"555-123-4567",value:l.physicianPhone||"",onChange:t=>o("physicianPhone",H(t.target.value)),"data-testid":"input-physicianPhone"})]})]}),e.jsx(L,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("h3",{className:"font-medium text-sm text-muted-foreground uppercase tracking-wide",children:"Specialists & Other Doctors"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Add any specialists your family sees regularly (pediatric dentist, allergist, dermatologist, etc.)"}),U>0&&e.jsx("div",{className:"space-y-4",children:Array.from({length:U},(t,a)=>a+1).map(t=>e.jsxs("div",{className:"space-y-4 pl-4 border-l-2 border-muted/40",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-sm font-medium",children:["Specialist ",t]}),e.jsxs(h,{variant:"ghost",size:"sm",onClick:()=>ra(t),className:"text-muted-foreground hover:text-destructive h-8 px-2","data-testid":`button-remove-doctor-${t}`,children:[e.jsx(be,{className:"w-4 h-4 mr-1"}),"Remove"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:`additionalDoctor${t}Name`,children:"Doctor Name"}),e.jsx(x,{id:`additionalDoctor${t}Name`,placeholder:"Dr. Name",value:l[`additionalDoctor${t}Name`]||"",onChange:a=>o(`additionalDoctor${t}Name`,a.target.value),"data-testid":`input-additionalDoctor${t}Name`})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:`additionalDoctor${t}Specialty`,children:"Specialty"}),e.jsx(x,{id:`additionalDoctor${t}Specialty`,placeholder:"e.g., Pediatric Dentist, Allergist, Cardiologist",value:l[`additionalDoctor${t}Specialty`]||"",onChange:a=>o(`additionalDoctor${t}Specialty`,a.target.value),"data-testid":`input-additionalDoctor${t}Specialty`})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:`additionalDoctor${t}Phone`,children:"Phone"}),e.jsx(x,{id:`additionalDoctor${t}Phone`,placeholder:"555-123-4567",value:l[`additionalDoctor${t}Phone`]||"",onChange:a=>o(`additionalDoctor${t}Phone`,H(a.target.value)),"data-testid":`input-additionalDoctor${t}Phone`})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:`additionalDoctor${t}Notes`,children:"Notes (optional)"}),e.jsx(X,{id:`additionalDoctor${t}Notes`,placeholder:"e.g., See every 6 months for Sarah's allergies, takes our insurance",value:l[`additionalDoctor${t}Notes`]||"",onChange:a=>o(`additionalDoctor${t}
1Notes`,a.target.value),className:"min-h-[60px]","data-testid":`input-additionalDoctor${t}Notes`})]})]},`doctor-${t}`))}),U<10&&e.jsxs(h,{type:"button",variant:"outline",size:"sm",onClick:na,className:"w-full mt-2","data-testid":"button-add-doctor",children:[e.jsx(Ce,{className:"w-4 h-4 mr-2"}),"Add Specialist / Doctor"]})]}),e.jsx(L,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-medium text-sm text-muted-foreground uppercase tracking-wide",children:"Insurance & Conditions"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"insuranceLocation",children:"Where are insurance cards?"}),e.jsx(x,{id:"insuranceLocation",placeholder:"e.g., wallet, file cabinet, uploaded to app",value:l.insuranceLocation||"",onChange:t=>o("insuranceLocation",t.target.value),"data-testid":"input-insuranceLocation"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:"criticalConditions",children:"Critical Health Conditions"}),e.jsx(X,{id:"criticalConditions",placeholder:"None, or list conditions",value:l.criticalConditions||"",onChange:t=>o("criticalConditions",t.target.value),className:"min-h-[80px]","data-testid":"input-criticalConditions"})]})]})]}):d===4?e.jsxs(e.Fragment,{children:[Array.from({length:ie},(t,a)=>a+1).map(t=>e.jsxs("div",{className:"space-y-4",children:[t>1&&e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsx(L,{className:"flex-1"}),e.jsxs(h,{variant:"ghost",size:"sm",onClick:()=>aa(t),className:"ml-2 text-muted-foreground hover:text-destructive","data-testid":`button-remove-pet-${t}`,children:[e.jsx(be,{className:"w-4 h-4 mr-1"}),"Remove"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{children:"Photo (optional)"}),e.jsxs("div",{className:"flex items-center gap-4",children:[P(`pet${t}Photo`)?e.jsxs("div",{className:"relative",children:[e.jsx(je,{className:"w-16 h-16",children:e.jsx("img",{src:P(`pet${t}Photo`),alt:"Preview",className:"w-full h-full object-cover rounded-full"})}),e.jsx(h,{type:"button",size:"icon",variant:"secondary",className:"absolute -top-1 -right-1 w-5 h-5 rounded-full",onClick:()=>fe(`pet${t}Photo`),"data-testid":`button-remove-pet-${t}-photo`,children:e.jsx(ve,{className:"w-3 h-3"})})]}):e.jsx("div",{className:"w-16 h-16 rounded-full border-2 border-dashed border-muted-foreground/30 flex items-center justify-center cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>D.current[`pet${t}Photo`]?.click(),children:F[`pet${t}Photo`]?e.jsx("div",{className:"animate-spin w-4 h-4 border-2 border-primary border-t-transparent rounded-full"}):e.jsx(ke,{className:"w-5 h-5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("input",{ref:a=>{D.current[`pet${t}Photo`]=a},type:"file",accept:"image/*",onChange:a=>{const s=a.target.files?.[0];s&&xe(`pet${t}Photo`,s)},className:"hidden","data-testid":`input-pet-${t}-photo`}),e.jsx(h,{type:"button",variant:"outline",size:"sm",onClick:()=>D.current[`pet${t}Photo`]?.click(),disabled:F[`pet${t}Photo`],"data-testid":`button-upload-pet-${t}-photo`,children:F[`pet${t}Photo`]?"Uploading...":P(`pet${t}Photo`)?"Change":"Add Photo"})]})]})]}),oa(t).map(a=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:a.key,children:a.label}),a.isTextarea?e.jsx(X,{id:a.key,placeholder:a.placeholder,value:l[a.key]||"",onChange:s=>o(a.key,s.target.value),className:"min-h-[80px]","data-testid":`input-${a.key}`}):e.jsx(x,{id:a.key,placeholder:a.placeholder,value:l[a.key]||"",onChange:s=>o(a.key,s.target.value),"data-testid":`input-${a.key}`})]},a.key))]},`pet-${t}`)),ie<10&&e.jsx("div",{className:"pt-2",children:e.jsxs(h,{variant:"outline",onClick:ta,className:"w-full gap-2","data-testid":"button-add-another-pet",children:[e.jsx(Ce,{className:"w-4 h-4"}),"Add Another Pet"]})})]}):q.fields.map(t=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:t.key,children:t.label}),t.key.includes("Notes")||t.key.includes("Reason")||t.key.includes("Allergies")||t.key.includes("Autopays")?e.jsx(X,{id:t.key,placeholder:t.placeholder,value:l[t.key]||"",onChange:a=>o(t.key,a.target.value),className:"min-h-[80px]","data-testid":`input-${t.key}`,disabled:k}):t.key==="homeAddress"?e.jsx(Pt,{value:l[t.key]||"",onChange:(a,s,i)=>{o(t.key,a),s&&o("homeAddressLat",s),i&&o("homeAddressLon",i)},placeholder:t.placeholder,"data-testid":`input-${t.key}`}):e.jsx(x,{id:t.key,placeholder:t.placeholder,value:l[t.key]||"",onChange:a=>o(t.key,a.target.value),"data-testid":`input-${t.key}`,disabled:k})]},t.key)),d===0&&e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"my-6"}),e.jsxs("div",{className:"bg-muted/30 rounded-xl p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(Aa,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-medium text-sm",children:"Invite Your Partner or Co-Parent"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Build this vault together. Companions get full access to add, edit, and manage all information."})]})]}),Tt?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary bg-primary/5 rounded-lg p-3",children:[e.jsx(T,{className:"w-4 h-4"}),e.jsxs("span",{children:["Invitation sent to ",ee]})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(m,{htmlFor:"companionName",className:"text-xs",children:"Their Name"}),e.jsx(x,{id:"companionName",placeholder:"Partner's name",value:de,onChange:t=>Ft(t.target.value),"data-testid":"input-companion-name"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(m,{htmlFor:"companionEmail",className:"text-xs",children:"Their Email"}),e.jsx(x,{id:"companionEmail",type:"email",placeholder:"[email protected]",value:ee,onChange:t=>Rt(t.target.value),"data-testid":"input-companion-email"})]})]}),e.jsx(h,{variant:"outline",className:"w-full gap-2",onClick:Jt,disabled:Ue.isPending,"data-testid":"button-invite-companion",children:Ue.isPending?e.jsxs(e.Fragment,{children:[e.jsx(Ke,{className:"w-4 h-4 animate-spin"}),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ea,{className:"w-4 h-4"}),"Send Invitation"]})}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Optional -
1you can always invite them later from Access Management"})]})]})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between mt-6 gap-4",children:[e.jsxs(h,{variant:"ghost",onClick:ma,className:"gap-1","data-testid":"button-back",children:[e.jsx(Va,{className:"w-4 h-4"}),"Back"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(Fa,{children:[e.jsx(Ra,{asChild:!0,children:e.jsxs(h,{variant:"ghost",className:"gap-1 text-amber-600 dark:text-amber-500",disabled:pe.isPending,"data-testid":"button-remind-me",children:[e.jsx(yt,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Remind me later"}),ze.length>0&&e.jsx(Ta,{className:"w-3 h-3 ml-1"})]})}),e.jsxs(Ma,{align:"end",className:"w-56",children:[e.jsxs(Ze,{onClick:()=>pe.mutate({stepId:d}),"data-testid":"menu-remind-me",children:[e.jsx(yt,{className:"w-4 h-4 mr-2"}),"Remind me later"]}),ze.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Oa,{}),e.jsxs(Ya,{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(jt,{className:"w-3 h-3"}),"Flag for companion"]}),ze.map(t=>e.jsxs(Ze,{onClick:()=>pe.mutate({stepId:d,flaggedForCompanion:!0,targetCompanionId:t.id,targetCompanionName:t.name}),"data-testid":`menu-flag-companion-${t.id}`,children:[e.jsx(jt,{className:"w-4 h-4 mr-2 text-primary"}),t.name]},t.id)),e.jsxs(Ze,{onClick:()=>pe.mutate({stepId:d,flaggedForCompanion:!0,targetCompanionId:null,targetCompanionName:"All companions"}),"data-testid":"menu-flag-all-companions",children:[e.jsx(Se,{className:"w-4 h-4 mr-2 text-primary"}),"All companions"]})]})]})]}),e.jsx(h,{variant:"ghost",onClick:ht,className:"text-muted-foreground","data-testid":"button-skip-step",children:"Skip this step"}),e.jsx(h,{onClick:da,className:"gap-1","data-testid":"button-next",disabled:k,children:d===S.length-1?e.jsxs(e.Fragment,{children:["Complete",e.jsx(T,{className:"w-4 h-4"})]}):e.jsxs(e.Fragment,{children:["Next",e.jsx(Ba,{className:"w-4 h-4"})]})})]})]}),e.jsx("div",{className:"flex items-center justify-center gap-2 mt-8",children:S.map((t,a)=>{const s=a===1&&!dt;return e.jsx("button",{onClick:()=>{if(s){f({title:"Parental Consent Required",description:"You must verify parental consent before accessing children's information.",variant:"destructive"});return}E(a),$.mutate({currentStep:a,completedSteps:p,isCompleted:Y,stepData:u})},className:`w-2 h-2 rounded-full transition-all ${a===d?"w-6 bg-primary":p.includes(a)?"bg-primary/60":"bg-muted-foreground/30"} ${s?"opacity-50 cursor-not-allowed":""}`,"data-testid":`indicator-step-${a}`,disabled:s},t.id)})})]},d)})}),e.jsx(Je,{open:Ut,onOpenChange:Kt,children:e.jsxs(Xe,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[ne==="age_gate"&&e.jsxs(e.Fragment,{children:[e.jsx(K,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(Se,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx(Z,{children:"Age Verification"}),e.jsx(J,{children:"Please confirm you are a parent or legal guardian"})]})]})}),e.jsxs("div",{className:"space-y-4 pt-4",children:[e.jsxs(La,{children:[e.jsx(za,{className:"h-4 w-4"}),e.jsx(Ua,{children:"Important"}),e.jsx(Wa,{children:"This application collects information about children under 13. Under COPPA, we require verifiable parental consent first."})]}),e.jsxs("div",{className:"p-4 bg-muted/50 rounded-md space-y-4",children:[e.jsx("p",{className:"font-medium text-sm",children:"Before continuing, please confirm:"}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ne,{id:"age-confirm-dialog",checked:rt,onCheckedChange:t=>Oe(t),"data-testid":"checkbox-age-confirm-dialog"}),e.jsx(m,{htmlFor:"age-confirm-dialog",className:"text-sm leading-tight cursor-pointer",children:"I confirm that I am at least 18 years of age and am the parent or legal guardian of any children whose information I will add to this application."})]})]}),e.jsxs(h,{onClick:()=>W("intro"),disabled:!rt,className:"w-full","data-testid":"button-continue-age-gate-dialog",children:["Continue",e.jsx(ye,{className:"ml-2 h-4 w-4"})]}),e.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"By continuing, you acknowledge that providing false information may violate federal law."})]})]}),ne==="intro"&&e.jsxs(e.Fragment,{children:[e.jsx(K,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(_e,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx(Z,{children:"Child Data Protection"}),e.jsx(J,{children:"Protecting your children's information is our priority"})]})]})}),e.jsxs("div",{className:"space-y-4 pt-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Under COPPA, we need your consent before collecting information about your children (names, ages, routines, medical info). Your data is encrypted and never shared without permission."}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[e.jsxs("div",{className:"p-2 bg-muted/50 rounded-md",children:[e.jsx(Se,{className:"h-4 w-4 mx-auto mb-1 text-primary"}),e.jsx("p",{className:"text-xs font-medium",children:"Child Profiles"})]}),e.jsxs("div",{className:"p-2 bg-muted/50 rounded-md",children:[e.jsx(vt,{className:"h-4 w-4 mx-auto mb-1 text-primary"}),e.jsx("p",{className:"text-xs font-medium",children:"Documentation"})]}),e.jsxs("div",{className:"p-2 bg-muted/50 rounded-md",children:[e.jsx(gt,{className:"h-4 w-4 mx-auto mb-1 text-primary"}),e.jsx("p",{className:"text-xs font-medium",children:"Data Protection"})]})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:"Your Rights:"}
1)," Review data, request deletion, withdraw consent (30-day deletion), control third-party access."]}),e.jsxs("div",{className:"flex gap-3 pt-1",children:[e.jsx(h,{variant:"outline",onClick:()=>W("age_gate"),"data-testid":"button-back-age-gate-dialog",children:"Back"}),e.jsxs(h,{onClick:()=>W("review"),className:"flex-1","data-testid":"button-continue-intro-dialog",children:["Continue",e.jsx(ye,{className:"ml-2 h-4 w-4"})]})]})]})]}),ne==="review"&&e.jsxs(e.Fragment,{children:[e.jsx(K,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(vt,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx(Z,{children:"Review and Consent"}),e.jsx(J,{children:"Please review and accept our terms to complete verification"})]})]})}),e.jsxs("div",{className:"space-y-4 pt-4",children:[e.jsxs("div",{className:"space-y-3 p-3 bg-muted/50 rounded-md text-sm max-h-40 overflow-y-auto",children:[e.jsx("h4",{className:"font-semibold text-xs",children:"Consent Agreement"}),e.jsx("p",{className:"text-xs",children:"By providing this consent, I confirm that:"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-xs",children:[e.jsx("li",{children:"I am the parent/legal guardian of the children whose information will be stored."}),e.jsx("li",{children:"I understand FamilyHaven will collect and store personal information about my children."}),e.jsx("li",{children:"I can withdraw consent at any time, and data will be deleted within 30 days."}),e.jsx("li",{children:"Third-party services won't access my children's data unless I enable it."})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ne,{id:"terms-dialog",checked:he,onCheckedChange:t=>Ye(t),"data-testid":"checkbox-accept-terms-dialog"}),e.jsxs(m,{htmlFor:"terms-dialog",className:"text-sm leading-tight cursor-pointer",children:["I agree to the ",e.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:t=>{t.preventDefault(),ot(!0)},children:"Terms of Service"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ne,{id:"privacy-dialog",checked:ue,onCheckedChange:t=>Be(t),"data-testid":"checkbox-accept-privacy-dialog"}),e.jsxs(m,{htmlFor:"privacy-dialog",className:"text-sm leading-tight cursor-pointer",children:["I have read and accept the ",e.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:t=>{t.preventDefault(),lt(!0)},children:"Privacy Policy"})]})]})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(h,{variant:"outline",onClick:()=>W("intro"),"data-testid":"button-back-intro-dialog",children:"Back"}),e.jsx(h,{onClick:Qt,disabled:!he||!ue||We.isPending,className:"flex-1","data-testid":"button-submit-consent-dialog",children:We.isPending?e.jsxs(e.Fragment,{children:[e.jsx(Ke,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Dt,{className:"mr-2 h-4 w-4"}),"Complete Verification"]})})]})]})]}),ne==="complete"&&e.jsxs(e.Fragment,{children:[e.jsxs(K,{className:"text-center",children:[e.jsx("div",{className:"mx-auto h-16 w-16 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center mb-4",children:e.jsx(Dt,{className:"h-8 w-8 text-green-600 dark:text-green-400"})}),e.jsx(Z,{className:"text-center",children:"Consent Verified!"}),e.jsx(J,{className:"text-center",children:"You can now add and manage your children's information"})]}),e.jsx("div",{className:"pt-4",children:e.jsxs(h,{onClick:Zt,className:"w-full","data-testid":"button-continue-consent-complete-dialog",children:["Continue to Add Children",e.jsx(ye,{className:"ml-2 h-4 w-4"})]})})]})]})}),e.jsx(Je,{open:Wt,onOpenChange:ot,children:e.jsxs(Xe,{className:"max-w-2xl max-h-[80vh]",children:[e.jsxs(K,{children:[e.jsx(Z,{children:"Terms of Service"}),e.jsx(J,{children:"Please review our terms of service"})]}),e.jsx(Nt,{className:"h-[60vh] pr-4",children:e.jsxs("div",{className:"space-y-4 text-sm",children:[e.jsx("h3",{className:"font-semibold",children:"1. Acceptance of Terms"}),e.jsx("p",{children:"By accessing and using FamilyHaven, you accept and agree to be bound by the terms and provisions of this agreement. These Terms are governed by the laws of the State of Arizona, United States."}),e.jsx("h3",{className:"font-semibold",children:"2. Description of Service"}),e.jsx("p",{children:"FamilyHaven provides a secure digital vault for documenting family information, routines, and important details for parents and household members. FamilyHaven is not an emergency service, monitoring service, or alerting system and should not be relied upon in urgent or life-threatening situations."}),e.jsx("h3",{className:"font-semibold",children:"3. User Responsibilities"}),e.jsx("p",{children:"You are responsible for maintaining the confidentiality of your account and for all activities that occur under your account. You are also responsible for the actions of companions or household members you grant access to."}),e.jsx("h3",{className:"font-semibold",children:"4. Children's Privacy (COPPA)"}),e.jsx("p",{children:"We comply with the Children's Online Privacy Protection Act (COPPA). We require verifiable parental consent before collecting personal information about children under 13. Parents may review, request deleti
1on of, or refuse further collection of their child's information. Parental consent must be re-verified annually."}),e.jsx("h3",{className:"font-semibold",children:"5. AI Features & Limitations"}),e.jsx("p",{children:"AI features are provided for assistance and convenience only. AI responses may not always be accurate and should not replace professional medical, legal, or financial advice. AI features must not be relied upon during emergencies."}),e.jsx("h3",{className:"font-semibold",children:"6. Data Security"}),e.jsx("p",{children:"We implement comprehensive security measures including envelope encryption with per-vault keys and AES-256-GCM encryption."}),e.jsx("h3",{className:"font-semibold",children:"7. Limitation of Liability"}),e.jsx("p",{children:"FamilyHaven shall not be liable for any indirect, incidental, special, consequential, or punitive damages. Our total liability is limited to amounts paid in the preceding 12 months or $100, whichever is greater."}),e.jsx("h3",{className:"font-semibold",children:"8. Dispute Resolution"}),e.jsx("p",{children:"Disputes are resolved through binding arbitration in Arizona. You may opt out within 30 days of accepting these Terms by emailing [email protected]."}),e.jsx("p",{className:"pt-4 text-primary",children:e.jsx("a",{href:"/terms-of-service",target:"_blank",rel:"noopener noreferrer",className:"hover:underline",children:"Read the complete Terms of Service â"})})]})})]})}),e.jsx(Je,{open:qt,onOpenChange:lt,children:e.jsxs(Xe,{className:"max-w-2xl max-h-[80vh]",children:[e.jsxs(K,{children:[e.jsx(Z,{children:"Privacy Policy"}),e.jsx(J,{children:"Our privacy practices"})]}),e.jsx(Nt,{className:"h-[60vh] pr-4",children:e.jsxs("div",{className:"space-y-4 text-sm",children:[e.jsx("h3",{className:"font-semibold",children:"1. Information We Collect"}),e.jsx("p",{children:"We collect information you provide directly, including account information, family profiles, routines, and documentation you choose to store. We act as both data controller (account data) and data processor (vault content you control)."}),e.jsx("h3",{className:"font-semibold",children:"2. How We Use Your Information"}),e.jsx("p",{children:"We use your information to provide and improve our services, communicate with you, and ensure the security of your account. Your content is not used to train AI models."}),e.jsx("h3",{className:"font-semibold",children:"3. Children's Information (COPPA)"}),e.jsx("p",{children:"We collect information about children only with verified parental consent. Parents can review, modify, or delete their children's information at any time by contacting [email protected]. Parental consent must be re-verified annually."}),e.jsx("h3",{className:"font-semibold",children:"4. Data Sharing"}),e.jsx("p",{children:"We do not sell your personal information. We only share data with service providers who help operate our platform, and only when you explicitly authorize it or when required by law."}),e.jsx("h3",{className:"font-semibold",children:"5. Data Security"}),e.jsx("p",{children:"We implement envelope encryption with per-vault unique keys, AES-256-GCM encryption, PBKDF2 key derivation (100,000 iterations), and detailed audit logging."}),e.jsx("h3",{className:"font-semibold",children:"6. Your Rights"}),e.jsx("p",{children:"You have the right to access, correct, export, or delete your personal information. California residents have additional rights under CCPA/CPRA. You can withdraw consent for data collection at any time."}),e.jsx("h3",{className:"font-semibold",children:"7. Governing Law"}),e.jsx("p",{children:"This Privacy Policy is governed by the laws of the State of Arizona, United States."}),e.jsx("p",{className:"pt-4 text-primary",children:e.jsx("a",{href:"/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"hover:underline",children:"Read the complete Privacy Policy â"})})]})})]})}),e.jsx(At,{trigger:at,onComplete:()=>me(!1),pieceCount:60}),e.jsx(Ga,{show:Lt,message:Yt,icon:e.jsx(St,{className:"w-4 h-4"})}),e.jsx(_a,{show:Te!==null,title:Te?.title||"",description:Te?.description||"",onClose:()=>it(null)})]})}export{cs as default};
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.