1import{ca as w,h as C,ax as I,ay as x,r as o,j as e,S as s,aH as j,B as g,aK as f,cb as S,cc as L,aL as F}from"./main-DngGJsB2.js";import{u as B}from"./useForm-3Mfodt_Z.js";import{C as k}from"./checkbox-ChBL8I71.js";import{L as m}from"./label-BaLgOeLY.js";import"./index-CvqPqS3G.js";import"./index-DgSfE7Wb.js";const $=f({fullName:F().min(2,"Full name must be at least 2 characters"),email:L("Invalid email address"),consent:S(!0,{message:"This consent is required to participate in the interview"})});function O(){const{applicationId:i,roundId:d,interviewId:h}=w.useParams(),u=C(),p=I(),{data:N,isLoading:v}=x(p.public.getPublicApplication.queryOptions({applicationId:i})),{data:t,isLoading:b}=x({...p.public.getPublicCandidateByApplication.queryOptions({applicationId:i}),enabled:!!i}),y=v&&!N||b&&!t,l=o.useMemo(()=>t?.firstName&&t?.lastName?`${t.firstName} ${t.lastName}`:"",[t]),c=o.useMemo(()=>t?.email??"",[t]),n=B({defaultValues:{fullName:l,email:c,consent:!1},validators:{onSubmit:$},onSubmit:async()=>{await u({to:"/i/$applicationId/$roundId/$interviewId/setup",params:{applicationId:i,roundId:d,interviewId:h}})}});return o.useEffect(()=>{(l||c)&&(n.setFieldValue("fullName",l),n.setFieldValue("email",c))},[l,c,n]),y?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(s,{className:"h-6 w-48"}),e.jsx(s,{className:"h-4 w-80"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(s,{className:"h-4 w-20"}),e.jsx(s,{className:"h-10 w-full"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(s,{className:"h-4 w-24"}),e.jsx(s,{className:"h-10 w-full"})]}),e.jsx("div",{className:"space-y-2",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(s,{className:"size-5 shrink-0"}),e.jsx(s,{className:"h-5 flex-1"})]})}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsx(s,{className:"h-10 w-20"}),e.jsx(s,{className:"h-10 w-24"})]})]})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"mb-1 font-semibold text-base",children:"Confirming your details"}),e.jsx("p",{className:"mb-4 text-muted-foreground text-sm",children:"Please confirm your information before we begin the interview"})]}),e.jsxs("form",{onSubmit:a=>{a.preventDefault(),a.stopPropagation(),n.handleSubmit()},className:"space-y-6",children:[e.jsx(n.Field,{name:"fullName",children:a=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:a.name,children:"Full Name"}),e.jsx(j,{id:a.name,name:a.name,value:a.state.value,onBlur:a.handleBlur,onChange:r=>a.handleChange(r.target.value),placeholder:"John Doe",className:"mt-1 shadow-none"}),a.state.meta.errors.length>0&&e.jsx("p",{className:"text-destructive text-sm",children:typeof a.state.meta.errors[0]=="string"?a.state.meta.errors[0]:a.state.meta.errors[0]?.message||String(a.state.meta.errors[0])})]})}),e.jsx(n.Field,{name:"email",children:a=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(m,{htmlFor:a.name,children:"Email Address"}),e.jsx(j,{id:a.name,name:a.name,type:"email",value:a.state.value,onBlur:a.handleBlur,onChange:r=>a.handleChange(r.target.value),placeholder:"[email protected]",className:"shadow-none"}),a.state.meta.errors.length>0&&e.jsx("p",{className:"text-destructive text-sm",children:typeof a.state.meta.errors[0]=="string"?a.state.meta.errors[0]:a.state.meta.errors[0]?.message||String(a.state.meta.errors[0])})]})}),e.jsx(n.Field,{name:"consent",children:a=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex gap-3",children:[e.jsx(k,{id:a.name,checked:a.state.value,onCheckedChange:r=>a.handleChange(r===!0),className:"mt-1 shrink-0"}),e.jsx(m,{htmlFor:a.name,className:"font-normal text-sm leading-relaxed",children:"I agree to the recording and processing of this interview for hiring purposes. I understand that my responses will be reviewed by the hiring team."})]}),a.state.meta.errors.length>0&&e.jsx("p",{className:"text-destructive text-sm",children:typeof a.state.meta.errors[0]=="string"?a.state.meta.errors[0]:a.state.meta.errors[0]?.message||String(a.state.meta.errors[0])})]})}),e.jsxs("div",{className:"flex items-center justify-between pt-2",children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>u({to:"/i/$applicationId/$roundId/$interviewId",params:{applicationId:i,roundId:d,interviewId:h}}),children:"Back"}),e.jsx(n.Subscribe,{selector:a=>[a.canSubmit,a.isSubmitting],children:([a,r])=>e.jsx(g,{type:"submit",disabled:!a||r,children:r?"Saving...":"Continue"})})]})]})]})}export{O as component};
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.