PageSourceSearch

https://ezcollegeapp.com/assets/BuildProfile-B-oD4VSS.js

js ezcollegeapp.com collected 2026-10-02 00:50:05 UTC 319,191 bytes, 2 lines download raw bytes

1import{R as Ze,j as t,r as c,e as ir,L as qo,u as Ho,d as Go}from"./react-vendor-B-f7cQeY.js";import{b as Qi,u as Yo}from"./query-vendor-C1qkGTbe.js";import{i as Xi,g as Xs,u as Wo,e as Jo,a as ga,R as Qo}from"./useBuildProfile-C0dN4UpW.js";import{u as Zi,i as Qr,a as _t,K as Ln,n as Xo,s as zn}from"./useKnowledgeFilesQuery-pE1REk1l.js";import{u as Te,b as el,q as Zo,aF as tl,aG as Wr,aH as As,aI as ec,aJ as tc,d as Ut,aK as sc,aL as rc,aM as aa,aN as sl,aO as rl,aP as ac,aQ as nc,aR as ic,aS as lc,aT as oc,t as O,aU as cc,aA as Bn,T as dc}from"./index-Btzst3sR.js";import{d as uc,e as mc,c as Va,A as Pt,a as hc,f as fc}from"./AutoFillButton-CHTJAlBI.js";import{g as xa,a as pc,h as Un,d as al,F as Xr,u as gc,b as xc,C as He,i as bc,c as yc}from"./knowledgeFileErrors-Dg3fN8ew.js";import{X as Tt,g as vc,v as Rt,t as jc,T as na,z as $n,R as cn,u as nl,C as tt,y as Zs,ax as Vn,aB as Nc,aE as Sc,aF as Cc,a3 as il,w as ll,a4 as wc,a7 as ba,x as qe,a2 as Pc,az as Ac,a6 as Tc}from"./icons-vendor-CpH9N2Wl.js";import{n as Ic}from"./planUpgrade-ET6c8Ie5.js";import{B as Q}from"./CustomSelect-D1RdDPHu.js";import{A as vt,a as tr,M as cs,c as sr,d as rr,e as ar,C as Os,E as kc,F as ol,G as Dc,R as Ec,P as Oc,f as _c,h as Mc,T as cl,i as Fc,j as Kn,k as dl,H as ul,l as Rc,o as ya,p as Ar,q as qn,t as Hn,b as xs}from"./buildProfile-C86DYxyG.js";import{C as Gn,g as Lc}from"./profileClassYear-d2pztt3s.js";import{B as zc}from"./Button-DEiua0wb.js";import{R as Bc}from"./ResetProfileModal-CdbDMF9z.js";import"./answerSyncEvents-CnK1OUxs.js";import"./forecastCache-C-WSzD2l.js";import"./recentActivity-CfbWeMjm.js";import"./jspdf-vendor-DFrGCTlk.js";import"./graph-vendor-OV3jTF7R.js";import"./editor-vendor-D2iY5FDI.js";import"./answerSyncCache-DSaqCWqs.js";import"./ContentAwareLoading-B4KTpn5E.js";import"./CustomSelect-BMTKxyDM.js";import"./Input-DZEaSBb_.js";function Uc(e){const s=Math.floor(e/1e3);return s<60?`${s}s`:`${Math.floor(s/60)}m`}const $c={pending:{text:xa("pending")??"queued",classes:"bg-amber-50 text-amber-700",icon:t.jsx("span",{className:"block h-1.5 w-1.5 rounded-full bg-amber-500","aria-hidden":!0})},indexing:{text:xa("indexing")??"analyzing",classes:"bg-blue-50 text-blue-700",icon:t.jsxs(t.Fragment,{children:[t.jsx(Rt,{size:10,className:"motion-safe:animate-spin motion-reduce:hidden","aria-hidden":!0}),t.jsx("span",{className:"hidden motion-reduce:inline","aria-hidden":!0,children:"⠿"})]})},retrying:{text:xa("retrying")??"Failed · Retrying…",classes:"bg-blue-50 text-blue-700",icon:t.jsxs(t.Fragment,{children:[t.jsx(Rt,{size:10,className:"motion-safe:animate-spin motion-reduce:hidden","aria-hidden":!0}),t.jsx("span",{className:"hidden motion-reduce:inline","aria-hidden":!0,children:"⠿"})]})},ready:{text:"ready",classes:"bg-emerald-50 text-emerald-700",icon:t.jsx(vc,{size:10,"aria-hidden":!0})},failed:{text:"failed",classes:"bg-red-50 text-red-700",icon:t.jsx(Tt,{size:10,"aria-hidden":!0})}};function Vc(e){return e==="ready_fallback"?"ready":e==="error"?"failed":e}const Kc={pending:"queued",indexing:"analyzing",retrying:"retrying",ready:"ready",failed:"failed"},ml=({status:e,statusStartedAtMs:s})=>{const{t:r}=Te(),a=Vc(e),n=$c[a],l=`knowledgeFileFailure.status.${Kc[a]}`,o=r(l),f=o===l?n.text:o,[S,j]=Ze.useState(()=>Date.now());Ze.useEffect(()=>{if(a!=="indexing"&&a!=="pending"&&a!=="retrying")return;const h=setInterval(()=>j(Date.now()),1e3);return()=>clearInterval(h)},[a]);const C=(a==="indexing"||a==="pending"||a==="retrying")&&s,d=C?Math.max(0,S-s):0;return t.jsxs("span",{role:"status","aria-live":"polite","data-status":a,className:`inline-flex shrink-0 items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px] font-medium ${n.classes}`,children:[n.icon,t.jsx("span",{children:f}),C&&t.jsx("span",{className:"font-mono opacity-70","data-testid":"kb-elapsed",children:Uc(d)})]})};function qc(){return Array.from(document.querySelectorAll('header, [role="banner"]')).reduce((s,r)=>{const a=r.getBoundingClientRect();return a.top>1||a.bottom<=0||a.bottom>window.innerHeight/2?s:Math.max(s,a.bottom)},0)}function Hc({popoverContentHeight:e,triggerTop:s,triggerBottom:r,viewportTop:a=0,viewportHe
1ight:n,marginPx:l=16,maxHeightPx:o=640,minUsableHeightPx:f=240,stableDecisionHeightPx:S=360}){const j=Math.max(0,n),C=Math.max(0,Math.min(a,j)),d=Math.max(0,j-r-l),h=Math.max(0,s-C-l),v=Math.max(0,Math.min(o,j-C-l*2)),b=Math.max(0,Math.min(e,v)),z=Math.min(v,Math.max(b,Math.min(S,v)))>d&&h>d,H=z?h:d,Z=Math.min(f,H,v),G=Math.max(Z,Math.min(b,H||v));return{openUpward:z,maxHeight:G}}function Gc({open:e,triggerRef:s,panelRef:r,preserveScrollRef:a,dependencies:n=[],resetOpenUpward:l=!1,marginPx:o,maxHeightPx:f,minUsableHeightPx:S,stableDecisionHeightPx:j}){const[C,d]=Ze.useState(l),[h,v]=Ze.useState(null);return Ze.useLayoutEffect(()=>{if(!e){d(l),v(null);return}const b=()=>{const p=r.current,z=(s==null?void 0:s.current)??(p==null?void 0:p.parentElement)??null;if(!z||!p)return;const H=(a==null?void 0:a.current)??null,Z=(H==null?void 0:H.scrollTop)??0,G=p.style.maxHeight,B=p.style.height;p.style.maxHeight="none",p.style.height="auto";const U=p.scrollHeight;p.style.maxHeight=G,p.style.height=B,H&&(H.scrollTop=Z);const q=z.getBoundingClientRect(),ce=Hc({popoverContentHeight:U,triggerTop:q.top,triggerBottom:q.bottom,viewportTop:qc(),viewportHeight:window.innerHeight,marginPx:o,maxHeightPx:f,minUsableHeightPx:S,stableDecisionHeightPx:j});d(ce.openUpward),v(ce.maxHeight)};return b(),window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)}},[e,s,r,a,l,o,f,S,j,...n]),{openUpward:C,maxHeight:h}}function Ka(e){return e==="ready"||e==="ready_fallback"||e==="failed"||e==="error"}const Yc="quota_exceeded",Wc=[];function hl(e){return String(e||"").trim().toLowerCase()===Yc}function qa(e){var r,a,n,l,o,f,S,j;const s=(a=(r=e==null?void 0:e.response)==null?void 0:r.data)==null?void 0:a.detail;return typeof s=="string"?s:Array.isArray(s)?s.map(C=>(C==null?void 0:C.msg)||JSON.stringify(C)).join("; "):((l=(n=e==null?void 0:e.response)==null?void 0:n.data)==null?void 0:l.message)||((f=(o=e==null?void 0:e.response)==null?void 0:o.data)==null?void 0:f.msg_en)||((j=(S=e==null?void 0:e.response)==null?void 0:S.data)==null?void 0:j.msg)||(e==null?void 0:e.message)||""}function Jc(e){var s;return((s=e==null?void 0:e.response)==null?void 0:s.status)===404&&/not\s+found/i.test(qa(e))}function Qc(e){return e?e.quota_exhausted===!0||e.state==="exhausted"?"exhausted":e.state==="available"?"available":"unknown":"unknown"}function Xc(e,s){return s==="exhausted"&&Qr(e.status)&&hl(e.error_message)}function Zc(e){return e==="pro"?null:e==="plus"?"pro":"plus"}function Tr(e,s){if(!e&&!s)return null;const r=al(e);return aa(s,{failure_code:r.failureCode,failure_category:r.category,retryable:!1,recommended_action:(s==null?void 0:s.creditOutcome)==="charged"?"contact_support":"reupload"})}function ed({count:e,canRetry:s,isRetrying:r,upgradeHref:a,onRetry:n}){const{t:l}=Te();return t.jsx("div",{role:"status",className:"kb-quota-notice mb-2 rounded-lg border border-[#F0C779] bg-[#FFF7EA] px-2.5 py-2 text-[#7A3D16]",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"inline-grid h-6 w-6 shrink-0 place-items-center rounded-full bg-[#FBE2C2] text-[#C45B34] ring-1 ring-[#F3C68F]","aria-hidden":!0,children:t.jsx(na,{size:14,strokeWidth:2.4})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-[11px] font-semibold leading-tight",children:l("buildProfile.fileManager.limitReached")}),t.jsx("div",{className:"truncate text-[10px] leading-tight text-[#8A5A32]",children:e===1?l("buildProfile.fileManager.fileSavedPausedSingular",{count:e}):l("buildProfile.fileManager.fileSavedPausedPlural",{count:e})})]}),t.jsx("button",{type:"button",onClick:n,disabled:!s||r,title:l("buildProfile.fileManager.retryAnalysis"),"aria-label":l("buildProfile.fileManager.retryLimitedFiles"),className:"inline-grid h-6 w-6 shrink-0 place-items-center rounded-md text-[#8A5A32] transition-colors hover:bg-[#FBE2C2] disabled:cursor-not-allowed disabled:opacity-50",children:r?t.jsx(Rt,{size:12,className:"motion-safe:animate-spin"}):t.jsx(cn,{size:12})}),a?t.jsxs(qo,{to:a,"data-testid":"kb-upgrade-link",className:"kb-quota-upgrade inl
1ine-flex shrink-0 items-center gap-1 rounded-md bg-[#16335F] px-2 py-1 text-[11px] font-semibold leading-none text-white shadow-[0_5px_10px_rgba(22,51,95,0.16)] transition-colors hover:bg-[#0E4A8A] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#16335F]/20",children:[l("buildProfile.fileManager.upgrade"),t.jsx(nl,{size:10,"aria-hidden":!0})]}):null]})})}function td({count:e,canRetry:s,isRetrying:r,onRetry:a}){const{t:n}=Te();return t.jsx("div",{role:"status","data-testid":"kb-analysis-paused-notice",className:"mb-2 rounded-lg border border-sky-200 bg-sky-50 px-2.5 py-2 text-sky-900",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"inline-grid h-6 w-6 shrink-0 place-items-center rounded-full bg-white text-sky-700 ring-1 ring-sky-200","aria-hidden":!0,children:t.jsx(na,{size:14,strokeWidth:2.4})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-[11px] font-semibold leading-tight",children:n("buildProfile.fileManager.analysisPaused")}),t.jsx("div",{className:"truncate text-[10px] leading-tight text-sky-700",children:e===1?n("buildProfile.fileManager.fileIsSavedRetrySingular",{count:e}):n("buildProfile.fileManager.filesAreSavedRetryPlural",{count:e})})]}),t.jsx("button",{type:"button",onClick:a,disabled:!s||r,title:n("buildProfile.fileManager.retryAnalysis"),"aria-label":n("buildProfile.fileManager.retryPausedAnalysis"),className:"inline-grid h-6 w-6 shrink-0 place-items-center rounded-md text-sky-700 transition-colors hover:bg-white disabled:cursor-not-allowed disabled:opacity-50",children:r?t.jsx(Rt,{size:12,className:"motion-safe:animate-spin"}):t.jsx(cn,{size:12})})]})})}const sd=3,Yn=3;function rd(e){return 800*e}let ad=0;function Ha(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Wn(e){var r;const s=((r=e.split(".").pop())==null?void 0:r.toLowerCase())??"";return["pdf"].includes(s)?t.jsx(Vn,{size:14,className:"shrink-0 text-rose-500"}):["png","jpg","jpeg","gif","webp","svg","heic","heif"].includes(s)?t.jsx(Nc,{size:14,className:"shrink-0 text-violet-500"}):["xls","xlsx","csv"].includes(s)?t.jsx(Sc,{size:14,className:"shrink-0 text-emerald-500"}):["doc","docx","txt","md"].includes(s)?t.jsx(Vn,{size:14,className:"shrink-0 text-blue-500"}):t.jsx(Cc,{size:14,className:"shrink-0 text-slate-400"})}const nd=256;function Ga({name:e,className:s=""}){const[r,a]=c.useState(!1),n=c.useRef(null),[l,o]=c.useState(null),f=c.useCallback(()=>{const S=n.current;if(!S)return;const j=S.getBoundingClientRect(),C=6,d=48,h=window.innerHeight-j.bottom,v=h<d+C&&j.top>h,b=Math.max(8,Math.min(j.left,window.innerWidth-nd-8));o({left:b,top:v?j.top-C:j.bottom+C,flip:v})},[]);return c.useLayoutEffect(()=>{if(r)return f(),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[r,f]),t.jsxs("span",{ref:n,className:`relative block min-w-0 ${s}`,"aria-label":e,tabIndex:0,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onFocus:()=>a(!0),onBlur:()=>a(!1),onClick:()=>a(!0),children:[t.jsx("span",{className:"block truncate",children:e}),r&&l&&typeof document<"u"&&ir.createPortal(t.jsx("span",{role:"tooltip",style:{position:"fixed",left:l.left,top:l.top,transform:l.flip?"translateY(-100%)":void 0},className:"pointer-events-none z-[200] w-max max-w-[16rem] break-all rounded-md border border-slate-200 bg-white px-2 py-1 text-[11px] font-medium leading-snug text-slate-700 shadow-lg",children:e}),document.body)]})}function id(e){const s=Math.floor(e/1e3);return s<60?`${s}s`:`${Math.floor(s/60)}m`}function ld({open:e,onClose:s,onUploadComplete:r}){var kt,Gt;const a=el(),{t:n}=Te(),{data:l}=Zo({enabled:!!a}),{data:o=Wc}=Zi(a,{enabled:e}),f=Qi(),S=c.useMemo(()=>["fileAnalysisQuotaStatus",a],[a]),{data:j}=Yo({queryKey:S,queryFn:async()=>(await Ut.getFileAnalysisQuotaStatus(a)).data,enabled:e&&!!a,staleTime:3e4,retry:1}),{uploadingFiles:C,setUploadingFiles:d}=tl(a,o),[h,v]=c.useState(!1),b=c.useRef(null),p=c.useRef(null),z=c.useRef(null),H=c.useRef(null),[Z,G]=c.useState(new Set),[B,U]=c.useState(new Set),[q,ce]=c.useState(null),ee=c.useRef(new Set),ne=c.useRef(new Map),ie=c.useMemo(()=>{var D,M;return Ic((D=l==null?void 0:l.currentPlan)==null?void 0:D.planCode,(M=l==null?void 0:l.currentPlan)==null?void 0:M.planStatus)},[(kt=l==null?void 0:l.currentPlan)==null?void 0:kt.planCode,(Gt=l==null?void 0:l.currentPlan)==null?void 0:Gt.planStatus]),K=c.useMemo(()=>Zc(ie),[ie]),Ce=K?`/payment?plan=${K}`:null,xe=c.useMemo(()=>Qc(j),[j]),k=o.length>0||C.length>0,I=C.some(D=>D.status==="uploading"||D.status==="pending"||D.status==="indexing"||D.status==="retrying"),[u,y]=c.useState(()=>Date.now());c.useEffect(()=>{if(!I)return;y(Date.now());const D=setInterval(()=>y(Date.now()),1e3);return()=>clearInterval(D)},[I]);const A=c.useMemo(()=>o.map(D=>`${D.id}:${D.status}:${D.error_message??""}`).join("|"),[o]);c.useEffect(()=>{if(!e||!a)return;o.some(M=>Qr(M.status)&&hl(M.error_message))&&f.invalidateQueries({queryKey:S})},[S,o,e,f,a]);const N=D=>{G(M=>{const de=new Set(M);return de.has(D)?de.delete(D):de.add(D),de})},w=async D=>{var M,de;if(a&&!ee.current.has(D)){ee.current.add(D),U(new Set(ee.current)),ce(null);try{const ge=await Ut.getFileStatus(D,a),he=(M=ge.data)==null?void 0:M.status;if(he!=="failed"&&he!=="error"){await _t(f);return}if(!Wr(As(ge.data))){await _t(f);return}await Ut.retryFileIndexing(D,a),ne.current.set(D,(ne.current.get(D)??0)+1),await _t(f)}catch(ge){ce(As((de=ge==null?void 0:ge.response)==null?void 0:de.data)),await _t(f)}finally{ee.current.delete(D),U(new Set(ee.current))}}},X=async D=>{var de,ge;if(!a)return;const M=D.filter(he=>!ee.current.has(he)&&(ne.current.get(he)??0)<1);if(M.length!==0){M.forEach(he=>ee.current.add(he)),U(new Set(ee.current)),ce(null);try{const pe=(await Promise.allSettled(M.map(async ye=>{var ke;const ve=await Ut.getFileStatus(ye,a),ae=(ke=ve.data)==null?void 0:ke.status;ae!=="failed"&&ae!=="error"||Wr(As(ve.data))&&(await Ut.retryFileIndexing(ye,a),ne.current.set(ye,(ne.current.get(ye)??0)+1))}))).find(ye=>ye.status==="rejected");pe&&ce(As((ge=(de=pe.reason)==null?void 0:de.response)==null?void 0:ge.data)),await _t(f)}finally{M.forEach(he=>ee.current.delete(he)),U(new Set(ee.current))}}};c.useEffect(()=>{if(!e)return;function D(M){var ge;const de=M.target;(ge=H.current)!=null&&ge.contains(de)||p.current&&!p.current.contains(de)&&s()}return document.addEventListener("mousedown",D),requestAnimationFrame(()=>{var M;return(M=p.current)==null?void 0:M.focus()}),()=>document.removeEventListener("mousedown",D)},[e,s]);const{openUpward:E,maxHeight:oe}=Gc({open:e,panelRef:p,preserveScrollRef:z,dependencies:[Z.size,A,C.length]}),je=async D=>{const M=D.target.files;!M||M.length===0||!a||(await Nt(Array.from(M)),b.current&&(b.current.value=""))},[Ie,Ae]=c.useState(!1);c.useEffect(()=>{if(!e||!a)return;const D=p.current;if(!D)return;const M=de=>{var ye;if(h)return;const ge=de.target;if(ge&&(ge.tagName==="INPUT"||ge.tagName==="TEXTAREA"||ge.isContentEditable))return;const he=(ye=de.clipboardData)==null?void 0:ye.items;if(!he||he.length===0)return;const pe=[];for(const ve of Array.from(he))if(ve.kind==="file"&&ve.type.startsWith("image/")){const ae=ve.getAsFile();ae&&pe.push(ae)}pe.length!==0&&(de.preventDefault(),Nt(pe))};return D.addEventListener("paste",M),()=>D.removeEventListener("paste",M)},[e,a,h]);const pt=D=>{var M;D.preventDefault(),!h&&(M=D.dataTransfer.types)!=null&&M.includes("Files")&&Ae(!0)},jt=D=>{D.preventDefault(),Ae(!1)},ct=async D=>{if(D.preventDefault(),D.stopPropagation(),Ae(!1),!a||h)return;const M=Array.from(D.dataTransfer.files??[]);M.length!==0&&await Nt(M)},It=async({file:D,key:M},de)=>{const ge=ac();if(nc(ge,"client.file_selected",{filename:D.name,size_bytes:D.size}),D.size>ic){const he=`File too large (${Ha(D.size)} > ${lc}MB)`;return d(pe=>pe.map(ye=>ye.key===M?{...ye,progress:0,status:"failed",error:he,failureFeedback:Tr(he)}:ye)),"failed"}for(let he=1;he<=Yn;he+=1)try{he>1&&d(ve=>ve.map(ae=>ae.key===M?{...ae,progress:0,status:"uploading",error:void 0,failureFeedback:null}:ae));const pe=await Ut.uploadFile(D,a,{traceId:ge,onProgress:(ve,ae)=>{let ke=0;ae&&ae>0?ke=Math.min(99,Math.round(ve/ae*100)):D.size>0&&(ke=Math.min(95,Math.round(ve/D.size*100))),d(gt=>gt.map(De=>De.key===M?{...De,progress:Math.max(De.progress,ke)}:De))}}),ye=oc(pe==null?void 0:pe.data,D);return ye?(d(ve=>ve.map(ae=>ae.key===M?{...ae,...ye}:ae)),zn(f),"success"):(d(ve=>ve.map(ae=>ae.key===M?{...ae,progress:100,status:"failed",error:n("buildProfile.fileManager.uploadNoFileId"),failureFeedback:Tr(n("buildProfile.fileManager.uploadNoFileId"))}:ae)),zn(f),"success")}catch(pe){if(he<Yn&&bc(pe)){await new Promise(ae=>setTimeout(ae,rd(he)));continue}const ye=yc(pe,n("buildProfile.fileManager.uploadFailed")),ve=Tr(ye.message,ye.feedback);return d(ae=>ae.map(ke=>ke.key===M?{...ke,progress:0,status:"failed",error:ye.message,failureFeedback:ve}:ke)),ye.isLimit&&(de==null||de(ye.message)),ye.isLimit?"limit":"failed"}return"failed"},Nt=async D=>{if(h)return;const M=n("docLibrary.formats")||sc,{valid:de,errors:ge}=rc(D,{supportedTypes:M,unsupportedType:n("docLibrary.unsupportedType",{formats:M})||`Unsupported file type. Supported: ${M}`,tooLarge:n("docLibrary.tooLarge")||"File exceeds 50MB limit"});ia(ge);const he=de.map(pe=>({file:pe,key:`upload-${++ad}`}));if(he.length!==0){v(!0);try{d(De=>[...De,...he.map(({file:Ge,key:it})=>({key:it,name:Ge.name,progress:0,status:"uploading",startedAtMs:Date.now()}))]);const pe=[...he],ye=new Set;let ve=!1,ae=!1,ke=null;const gt=async()=>{for(;pe.length>0&&!ae;){const De=pe.shift();if(!De)return;ye.add(De.key);const Ge=await It(De,it=>{ke=it});Ge==="success"&&(ve=!0),Ge==="limit"&&(ae=!0)}};await Promise.all(Array.from({length:Math.min(sd,he.length)},gt)),ke&&d(De=>De.map(Ge=>he.some(it=>it.key===Ge.key)&&!ye.has(Ge.key)?{...Ge,progress:0,status:"failed",error:ke??void 0}:Ge)),await _t(f),ve&&(r==null||r())}finally{b.current&&(b.current.value=""),v(!1)}}},[Ue,ze]=c.useState(null),[ue,be]=c.useState(null),[P,te]=c.useState(!1),[_,we]=c.useState(""),[L,re]=c.useState(null),[g,Ne]=c.useState(!1),me=n("docLibrary.clearAllConfirmPhrase")||"CLEAR",st=(n("docLibrary.clearAllTypePrompt",{phrase:me})||`Type ${me} to confirm`).split(me),dt=c.useRef(null),rt=c.useRef(null);c.useEffect(()=>()=>{dt.current&&clearTimeout(dt.current),rt.current&&clearTimeout(rt.current)},[]);const ia=c.useCallback(D=>{D.length!==0&&(be(D.join(`
2`)),rt.current&&clearTimeout(rt.current),rt.current=setTimeout(()=>be(null),5e3))},[]),Ht=async D=>{var ve;if(!a)return;const M=((ve=o.find(ae=>ae.id===D))==null?void 0:ve.name)??"file",de=[Ln,a],ge=["knowledgeFiles",a],he=f.getQueryData(de)??o,pe=f.getQueryData(ge),ye=he.filter(ae=>ae.id!==D);try{await Promise.all([f.cancelQueries({queryKey:de}),f.cancelQueries({queryKey:ge})]),ze(null),f.setQueryData(de,ye),f.setQueryData(ge,ae=>ae&&{...ae,data:Array.isArray(ae.data)?ae.data.filter(ke=>ke.id!==D):[]}),await Ut.deleteFile(D,a)}catch(ae){if(Jc(ae))ze(null);else{f.setQueryData(de,he),pe&&f.setQueryData(ge,pe);const ke=qa(ae)||n("buildProfile.fileManager.deleteFailed");throw ze({name:M,message:ke}),dt.current&&clearTimeout(dt.current),dt.current=setTimeout(()=>ze(null),4e3),ae}}r==null||r(),_t(f).catch(ae=>{console.warn("Failed to refresh knowledge files after deletion",ae)})},dr=async()=>
2{if(!a||o.length===0||_.trim()!==me)return;const D=[Ln,a],M=["knowledgeFiles",a],de=f.getQueryData(D)??o,ge=f.getQueryData(M);Ne(!0);try{await Promise.all([f.cancelQueries({queryKey:D}),f.cancelQueries({queryKey:M})]),ze(null),re(null),f.setQueryData(D,[]),f.setQueryData(M,he=>he&&{...he,data:[]}),await Ut.deleteAllFiles(a),te(!1),we(""),r==null||r(),await _t(f),f.invalidateQueries({queryKey:["agentProfile"]})}catch(he){f.setQueryData(D,de),ge&&f.setQueryData(M,ge);const pe=qa(he)||n("buildProfile.fileManager.deleteAllFailed");re(Un(pe)??pe)}finally{Ne(!1)}},ur=t.jsxs(t.Fragment,{children:[st[0],t.jsx("span",{className:"rounded-md border border-rose-200 bg-rose-50 px-1.5 py-0.5 font-bold tracking-normal text-rose-700",children:me}),st.slice(1).join(me)]}),ut=c.useMemo(()=>{const D=o.filter(M=>!Ka(M.status)).map(M=>M.id).sort();return new Set(D.slice(0,3))},[o]),at=c.useMemo(()=>o.filter(D=>Xc(D,xe)).map(D=>D.id),[xe,o]),St=c.useMemo(()=>o.filter(D=>Qr(D.status)&&pc(D.error_message)==="system"&&Wr(As(D))).map(D=>D.id),[o]),Ms=at.some(D=>(ne.current.get(D)??0)<1),nt=at.some(D=>B.has(D)),Fs=St.some(D=>(ne.current.get(D)??0)<1),Rs=St.some(D=>B.has(D));if(!e)return null;const Ls=oe?{maxHeight:oe,...k?{height:oe}:{}}:void 0;return t.jsxs("div",{ref:p,tabIndex:-1,className:`absolute left-0 z-[100] flex w-[min(18rem,calc(100vw-2rem))] flex-col overflow-hidden rounded-xl border border-slate-200 bg-white p-4 shadow-lg outline-none ${E?"bottom-full mb-2":"top-full mt-2"}`,style:Ls,children:[t.jsxs("div",{className:"mb-3 flex items-center justify-between gap-2",children:[t.jsx("h3",{className:"min-w-0 truncate text-sm font-semibold text-slate-800",children:n("buildProfile.fileManager.myDocuments")}),t.jsx("button",{onClick:s,className:"rounded p-0.5 text-slate-400 hover:text-slate-600",children:t.jsx(Tt,{size:16})})]}),t.jsxs("label",{"data-testid":"kb-dropzone","data-drag-active":Ie||void 0,onDragOver:pt,onDragEnter:pt,onDragLeave:jt,onDrop:ct,className:`mb-3 flex items-center justify-center gap-2 rounded-lg border-2 border-dashed px-3 py-2 text-sm transition-colors ${h?"cursor-not-allowed border-slate-300 text-slate-500 opacity-50":Ie?"cursor-copy border-[#16335F] bg-[#E2ECF8] text-[#16335F]":"cursor-pointer border-slate-300 text-slate-500 hover:border-[#16335F]/40 hover:bg-[#EEF3FB]"}`,children:[t.jsx(jc,{size:16}),n(h?"buildProfile.fileManager.uploadingEllipsis":Ie?"buildProfile.fileManager.dropToUpload":"buildProfile.fileManager.uploadOrDrop"),t.jsx("input",{ref:b,type:"file",className:"hidden",accept:ec,multiple:!0,onChange:je,disabled:h})]}),Ue&&t.jsxs("div",{"data-testid":"kb-delete-error",role:"alert",className:"mb-2 flex items-start gap-1.5 rounded-md bg-red-50 px-2 py-1.5 text-[10px] text-red-700",children:[t.jsx(Tt,{size:12,className:"mt-0.5 shrink-0"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"font-medium",children:["Couldn't delete ",Ue.name]}),t.jsx("div",{className:"break-words opacity-80",children:Un(Ue.message)??Ue.message})]}),t.jsx("button",{type:"button",onClick:()=>ze(null),className:"shrink-0 rounded p-0.5 text-red-400 hover:text-red-600","aria-label":n("buildProfile.fileManager.dismiss"),children:t.jsx(Tt,{size:10})})]}),ue&&t.jsxs("div",{"data-testid":"kb-upload-validation-error",role:"alert",className:"mb-2 flex items-start gap-1.5 rounded-md bg-red-50 px-2 py-1.5 text-[10px] text-red-700",children:[t.jsx(na,{size:12,className:"mt-0.5 shrink-0"}),t.jsx("div",{className:"min-w-0 flex-1 whitespace-pre-line",children:ue}),t.jsx("button",{type:"button",onClick:()=>be(null),className:"shrink-0 rounded p-0.5 text-red-400 hover:text-red-600","aria-label":n("buildProfile.fileManager.dismiss"),children:t.jsx(Tt,{size:10})})]}),at.length>0&&t.jsx(ed,{count:at.length,canRetry:Ms,isRetrying:nt,upgradeHref:Ce,onRetry:()=>X(at)}),St.length>0&&t.jsx(td,{count:St.length,canRetry:Fs,isRetrying:Rs,onRetry:()=>X(St)}),(()=>{const D=tc(C,o);return D.length===0?null:t.jsx("ul",{className:"mb-2 space-y-1",children:D.map(M=>{const de=!!M.error,ge=M.error?al(M.error):null,he=Tr(M.error,M.failureFeedback),pe
2=M.status==="uploading",ye=pe?"pending":M.status,ve=M.created_at?Date.parse(M.created_at):M.startedAtMs??null,ae=ve?` ${id(Math.max(0,u-ve))}`:"";return t.jsxs("li",{"data-testid":"kb-upload-placeholder","data-upload-status":M.status,className:`rounded-lg px-2 py-1.5 ${de?"bg-red-50":"bg-slate-50"}`,children:[t.jsxs("div",{className:"flex items-center gap-2",children:[de?t.jsx(Tt,{size:12,className:"shrink-0 text-red-500"}):t.jsx(Rt,{size:12,"data-status-tone":pe?"uploading":void 0,className:`shrink-0 motion-safe:animate-spin ${pe?"text-violet-600":"text-[#16335F]"}`}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx(Ga,{name:M.name,className:"block text-xs text-slate-600"}),pe&&t.jsxs("span",{className:"block text-[10px] font-medium text-violet-700",children:[n("buildProfile.fileManager.uploading"),ae]}),ge&&t.jsxs("span",{className:"block text-[10px] text-red-600",children:[t.jsx("span",{className:"font-medium",children:n("knowledgeFileFailure.notUploadedPrefix")})," · ",n(`knowledgeFileFailure.${ge.detailKey}.reason`)]})]}),de&&ge?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-red-100 px-1.5 py-0.5 text-[10px] font-medium text-red-700",children:[t.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-red-500","aria-hidden":!0}),n(`knowledgeFileFailure.pill.${ge.detailKey}`)]}),t.jsx("button",{onClick:()=>d(ke=>ke.filter(gt=>gt.key!==M.key)),className:"shrink-0 rounded p-0.5 text-slate-400 hover:text-slate-600","aria-label":n("knowledgeFileFailure.actions.delete"),children:t.jsx(Tt,{size:12})})]}):pe?t.jsxs("span",{className:"shrink-0 text-[10px] text-violet-500",children:[M.progress,"%"]}):t.jsx(ml,{status:ye,statusStartedAtMs:M.created_at?Date.parse(M.created_at):M.startedAtMs??null})]}),he&&t.jsx(Xr,{feedback:he,context:"upload",compact:!0})]},M.key)})})})(),q&&t.jsx(Xr,{feedback:q,context:"upload",compact:!0}),t.jsx("div",{ref:z,"data-testid":"kb-file-list-scroll",className:"min-h-0 flex-1 overflow-y-auto pr-1",children:o.length===0&&C.length===0?t.jsx("p",{className:"py-4 text-center text-xs text-slate-400",children:n("buildProfile.fileManager.noFilesUploaded")}):t.jsx("ul",{className:"space-y-1",children:o.map(D=>t.jsx(od,{file:D,userId:a,hotPollEnabled:ut.has(D.id),isExpanded:Z.has(D.id),isRetrying:B.has(D.id),retryCount:ne.current.get(D.id)??0,showQuotaLimitUi:xe==="exhausted",onToggleExpand:N,onRetry:w,onDelete:Ht},D.id))})}),o.length>0&&t.jsx("div",{className:"-mx-4 -mb-4 mt-3 shrink-0 border-t border-rose-100 bg-gradient-to-r from-rose-50/90 via-white to-white px-4 py-3",children:t.jsxs("div",{className:"flex items-center justify-between gap-2.5",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.08em] text-rose-600",children:n("docLibrary.clearAllDangerZone")||"Danger zone"}),t.jsxs("div",{className:"mt-0.5 text-[10px] leading-snug text-slate-500",children:[n("docLibrary.clearAllFooterBeforeCount")||"Delete all"," ",t.jsx("span",{className:"font-semibold tabular-nums text-rose-600",children:o.length})," ",n("docLibrary.clearAllFooterAfterCount")||"uploaded files. This cannot be undone."]})]}),t.jsxs("button",{type:"button",onClick:()=>{we(""),re(null),te(!0)},disabled:h||g,title:n("docLibrary.clearAll")||"Delete all","aria-label":n("docLibrary.clearAll")||"Delete all",className:"inline-flex h-8 shrink-0 items-center gap-1 rounded-lg border border-rose-200 bg-white px-2.5 text-[11px] font-semibold text-rose-600 shadow-[0_1px_2px_rgba(15,23,42,0.04)] transition hover:-translate-y-px hover:border-rose-300 hover:bg-rose-50 hover:text-rose-700 hover:shadow-[0_2px_8px_rgba(190,24,93,0.12)] active:translate-y-0 disabled:cursor-not-allowed disabled:border-slate-200 disabled:text-slate-300 disabled:shadow-none disabled:hover:translate-y-0 disabled:hover:bg-white disabled:hover:text-slate-300",children:[t.jsx($n,{size:12}),n("docLibrary.clearAll")||"Delete all"]})]})}),P&&typeof document<"u"&&ir.createPortal(t.jsx("div",{ref:H,role:"dialog","aria-modal":"true","aria-labelledby":"profile-clear-all-title",className:"fixed inset-0 z-[130] flex items-center justify-center bg-slate-950/40 px-4",children:t.jsxs("div",{className:"w-full max-w-sm rounded-xl border border-rose-200 bg-white p-4 shadow-2xl",children:[t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-rose-50 text-rose-600",children:t.jsx($n,{size:18})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h4",{id:"profile-clear-all-title",className:"text-sm font-semibold text-slate-900",children:n("docLibrary.clearAllDialogTitle")||"Clear all documents?"}),t.jsx("p",{className:"mt-1 text-xs leading-5 text-slate-600",children:n("docLibrary.clearAllDialogBody",{count:o.length})||`This will permanently delete ${o.length} documents and remove their analysis data.`})]})]}),t.jsx("label",{className:"mt-4 block text-[11px] font-semibold uppercase tracking-[0.08em] text-slate-500",children:ur}
2),t.jsx("input",{type:"text",value:_,onChange:D=>we(D.target.value),placeholder:me,className:"mt-1.5 w-full rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800 outline-none transition focus:border-rose-300 focus:ring-2 focus:ring-rose-100",disabled:g,autoFocus:!0}),L&&t.jsx("div",{className:"mt-2 text-xs font-medium text-rose-600",children:L}),t.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[t.jsx("button",{type:"button",onClick:()=>{g||(te(!1),we(""),re(null))},disabled:g,className:"rounded-lg border border-slate-200 bg-white px-3 py-2 text-xs font-semibold text-slate-600 transition-colors hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-60",children:n("docLibrary.clearAllCancel")||"Cancel"}),t.jsxs("button",{type:"button",onClick:dr,disabled:_.trim()!==me||g,className:"inline-flex items-center gap-1.5 rounded-lg bg-rose-600 px-3 py-2 text-xs font-semibold text-white transition-colors hover:bg-rose-700 disabled:cursor-not-allowed disabled:bg-rose-200",children:[g&&t.jsx(Rt,{size:13,className:"motion-safe:animate-spin"}),g?n("docLibrary.clearAllDeleting")||"Deleting...":n("docLibrary.clearAllConfirm")||"Delete all"]})]})]})}),document.body)]})}const Jn={orange:{pill:"bg-orange-100 text-orange-700",dot:"bg-orange-600",reason:"text-orange-700",box:"bg-orange-50 text-orange-800",btn:"bg-orange-600 hover:bg-orange-700"},sky:{pill:"bg-sky-50 text-sky-700",dot:"bg-sky-500",reason:"text-sky-700",box:"bg-sky-50 text-sky-800",btn:"bg-sky-700 hover:bg-sky-800"},brown:{pill:"bg-[#FBFDFF] text-[#8A4B20] ring-1 ring-[#E7EDF5]",dot:"bg-[#C45B34]",reason:"text-[#8A4B20]",box:"bg-[#FBFDFF] text-[#8A4B20]",btn:"bg-[#8A4B20] hover:bg-[#6d3b19]"}},od=({file:e,userId:s,hotPollEnabled:r,isExpanded:a,isRetrying:n,retryCount:l,showQuotaLimitUi:o,onToggleExpand:f,onRetry:S,onDelete:j})=>{const{t:C}=Te(),d=gc(e.id,s,{enabled:r}),h=d!=null&&d.status?Xo(d.status):void 0,v=Ka(h)?h:Ka(e.status)?e.status:h??e.status,b=(d==null?void 0:d.updated_at)??e.updated_at??null,p=(d==null?void 0:d.error_message)??e.error_message,z=(d==null?void 0:d.error_code)??e.error_code,H=aa(d,e),Z=sl(H),G=Qr(v),B=G?xc(z,p):null,U=o&&(B==null?void 0:B.category)==="quota",q=(B==null?void 0:B.category)==="system",ce=B?Jn[B.tone]:Jn.orange,ee=(B==null?void 0:B.tone)==="orange",ne=(B==null?void 0:B.canRetry)===!0&&(Z==="retry"||Z==="none"&&(H==null?void 0:H.retryable)!==!1),ie=Z==="retry"&&!ne?()=>S(e.id):void 0,K=B?C(`knowledgeFileFailure.pill.${B.pillKey}`):"",Ce=B?C(`knowledgeFileFailure.${B.detailKey}.reason`):"",xe=B?C(`knowledgeFileFailure.${B.detailKey}.why`):"",k=B?C(`knowledgeFileFailure.${B.detailKey}.do`):"";return t.jsxs("li",{"data-testid":"kb-file-row","data-file-id":e.id,"data-status":v,"data-failure-category":(B==null?void 0:B.category)??void 0,"data-limit-reached":U||void 0,"data-system-failure":q||void 0,className:`rounded-lg transition-colors ${U||q?"":"hover:bg-slate-50"}`,children:[t.jsx("div",{className:`rounded-lg px-2 py-1.5 ${U?"kb-quota-file bg-[#FBFDFF] ring-1 ring-[#E7EDF5]":q?"bg-sky-50/70 ring-1 ring-sky-100":""}`,children:G&&B?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2",children:[Wn(e.name),t.jsx(Ga,{name:e.name,className:"text-xs font-medium leading-none text-slate-700"}),t.jsx("div",{className:"shrink-0",children:t.jsx(He,{onConfirm:()=>j(e.id),size:12})})]}),t.jsxs("div",{className:"mt-1 flex items-center gap-1.5 pl-5",children:[ee&&t.jsx("button",{type:"button","data-testid":"kb-failed-expand",onClick:()=>f(e.id),className:"shrink-0 rounded p-0.5 text-slate-400 hover:text-slate-600","aria-label":a?C("knowledgeFileFailure.aria.collapse",{name:e.name}):C("knowledgeFileFailure.aria.expand",{name:e.name}),"aria-expanded":a,children:a?t.jsx(tt,{size:12}):t.jsx(Zs,{size:12})}),t.jsxs("span",{className:`inline-flex shrink-0 items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px] font-semibold ${ce.pill}`,children:[B.tone==="orange"?t.jsx(na,{size:11,"aria-hidden":!0}):t.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${ce.dot}`,"aria-hidden":!0}),K]}),t.jsxs("span",{className:"min-w-0 truncate text-[10px] text-slate-500",children:[t.jsxs("span",{className:"font-medium text-emerald-600",children:["✓ ",C("knowledgeFileFailure.savedPrefix")]})," · ",t.jsx("span",{className:ce.reason,children:Ce})]}),t.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-slate-400",children:Ha(e.size)})]})]}):t.jsxs("div",{className:"flex items-center gap-2",children:[Wn(e.name),t.jsx(Ga,{name:e.name,className:"flex-1 text-xs font-medium leading-none text-slate-700"}),t.jsx(ml,{status:v,statusStartedAtMs:b?Date.parse(b):Date.parse(e.created_at)}),t.jsx("span",{className:"shrink-0 text-[10px] text-slate-400",children:Ha(e.size)}),t.jsx("div",{className:"shrink-0",children:t.jsx(He,{onConfirm:()=>j(e.id),size:12})})]})}),rl(H)&&(G||(H==null?void 0:H.creditOutcome)==="pending_review")&&t.jsx(Xr,{feedback:H,context:"upload",compact:!0,onRetry:ie,retrying:n}),ee&&a&&t.jsxs("div",{className:`mb-1.5 ml-7 mr-2 rounded-md px-2 py-1.5 text-[10px] ${ce.box}`,children:[t.jsxs("div",{className:"break-words leading-snug",children:[t.jsx("div",{className:"font-medium",children:xe||C("buildProfile.fileManager.noDetails")}),k&&t.jsx("div",{className:"mt-0.5 opacity-90",children:k})]}),ne&&t.jsxs("div",{className:"mt-1.5 flex items-center justify-between",children:[l>=1?t.jsx("span",{className:`text-[10px] ${ce.reason}`,children:C("buildProfile.fileManager.retryFailed",{count:l})}):t.jsx("span",{}),t.jsxs("button",{type:"button","data-testid":"kb-retry-button",onClick:()=>S(e.id),disabled:n||l>=1,className:`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[10px] font-medium text-white transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${ce.btn}
2`,children:[n?t.jsx(Rt,{size:10,className:"motion-safe:animate-spin"}):t.jsx(cn,{size:10}),C(n?"knowledgeFileFailure.actions.retrying":"knowledgeFileFailure.actions.retry")]})]})]})]})},cd=e=>e.pending?"bg-amber-500":e.started?"bg-amber-400":"bg-slate-300";function dd({text:e}){const[s,r]=Ze.useState(!1),[a,n]=Ze.useState(null),l=o=>{const f=o.getBoundingClientRect();n({top:f.top-8,left:Math.max(8,Math.min(f.left,window.innerWidth-220-8))}),r(!0)};return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-slate-400 transition hover:bg-slate-100 hover:text-slate-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-300","aria-label":e,onMouseEnter:o=>l(o.currentTarget),onMouseLeave:()=>r(!1),onFocus:o=>l(o.currentTarget),onBlur:()=>r(!1),onClick:o=>o.stopPropagation(),children:t.jsx(ll,{size:15,"aria-hidden":!0})}),s&&a&&typeof document<"u"?ir.createPortal(t.jsx("span",{role:"tooltip",style:{position:"fixed",top:a.top,left:a.left,width:220,zIndex:90,transform:"translateY(-100%)"},className:"pointer-events-none rounded-lg bg-slate-900 px-3 py-2 text-left text-[11px] font-medium leading-snug text-white shadow-lg",children:e}),document.body):null]})}function ud({sections:e,progress:s,fileCount:r=0,activeSection:a,onSectionChange:n,onClearProfile:l,onUploadComplete:o}){const{t:f}=Te(),[S,j]=Ze.useState(!1),[C,d]=Ze.useState(!1),h=Ze.useRef(null);Ze.useEffect(()=>{const z=()=>j(!0);return window.addEventListener("reset-open-file-manager",z),()=>window.removeEventListener("reset-open-file-manager",z)},[]);const v=Ze.useCallback(()=>{var z;(z=h.current)!=null&&z.open&&(h.current.open=!1),d(!1)},[]);Ze.useEffect(()=>{if(!C)return;function z(Z){const G=h.current;if(!(G!=null&&G.open))return;const B=Z.target;B instanceof Element&&B.closest('[role="dialog"]')||G.contains(B)||v()}function H(Z){Z.key==="Escape"&&v()}return document.addEventListener("mousedown",z),document.addEventListener("keydown",H),()=>{document.removeEventListener("mousedown",z),document.removeEventListener("keydown",H)}},[C,v]);const b=()=>{l==null||l()},p=z=>["flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm","transition-[color,background-color] duration-150 ease-[
2cubic-bezier(0.23,1,0.32,1)]",z?"bg-[#16335F]/10 font-semibold text-[#16335F]":"text-slate-500 hover:bg-slate-100 hover:text-slate-700"].join(" ");return t.jsxs("nav",{"aria-label":f("buildProfile.sidebar.ariaLabel"),className:"relative top-0 isolate z-[80] flex w-full shrink-0 flex-col self-start md:sticky md:top-4 md:w-[228px]",children:[t.jsxs("div",{className:"shrink-0 pb-3",children:[t.jsx("p",{className:"mb-2 text-sm font-bold text-[#0B1525]",children:f("buildProfile.sidebar.profileLabel")}),t.jsx("div",{className:"h-1.5 rounded-full bg-slate-200",children:t.jsx("div",{className:"h-1.5 rounded-full bg-[#16335F] transition-all duration-300",style:{width:`${s.percent}%`}})}),t.jsx("p",{className:"mt-2 text-xs text-slate-500",children:f("buildProfile.sidebar.sectionsComplete",{filled:s.filled,total:s.total,percent:s.percent})})]}),t.jsx("div",{className:"py-3",children:t.jsx("ul",{className:"space-y-1",children:e.map(z=>{const H=a===z.id;return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>n(z.id),className:p(H),children:[z.complete?t.jsx(il,{size:14,className:"shrink-0 text-green-500"}):t.jsx("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${cd(z)}`}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:z.label}),z.pending&&t.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em] text-amber-800",children:f("buildProfile.sidebar.pending")})]})},z.id)})})}),t.jsx("div",{className:"h-px shrink-0 bg-slate-300 shadow-[0_1px_0_rgba(255,255,255,0.95)]"}),t.jsxs("div",{className:"shrink-0 pt-4",children:[t.jsxs("div",{className:"relative",children:[t.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[t.jsx("h2",{className:"text-sm font-bold text-[#0B1525]",children:f("buildProfile.sidebar.filesTitle")}),t.jsx("p",{className:"text-[12px] text-slate-500",children:f(r===1?"buildProfile.sidebar.fileReady":"buildProfile.sidebar.fileReadyPlural",{count:r})})]}),t.jsx("button",{type:"button","data-analytics-id":"build_profile_manage_files",onClick:()=>j(z=>!z),className:"mt-2.5 inline-flex w-full items-center justify-center rounded-full bg-[#16335F] px-3 py-2 text-sm font-semibold text-white shadow-sm transition-colors hover:bg-[#0B1525]",children:f("buildProfile.sidebar.uploadFiles")}),t.jsx(ld,{open:S,onClose:()=>j(!1),onUploadComplete:o})]}),t.jsxs("div",{className:"mt-2.5 w-full [&_button]:w-full",children:[t.jsx(uc,{}),t.jsx("div",{className:"mt-2",children:t.jsx(mc,{})})]}),l?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"my-4 h-px bg-slate-300 shadow-[0_1px_0_rgba(255,255,255,0.95)]"}),t.jsxs("details",{ref:h,className:"group",onToggle:z=>d(z.currentTarget.open),children:[t.jsxs("summary",{className:"inline-flex cursor-pointer list-none items-center gap-1 text-sm text-slate-400 hover:text-slate-600 [&::-webkit-details-marker]:hidden",children:[t.jsx(Zs,{size:14,className:"transition-transform group-open:rotate-90","aria-hidden":"true"}),f("clearProfile.advancedSummary")]}),t.jsxs("div",{className:"mt-2 hidden items-center gap-1 pl-4 group-open:flex",children:[t.jsxs("button",{type:"button","data-analytics-id":"build_profile_clear_profile",onClick:b,className:"inline-flex items-center gap-1 whitespace-nowrap rounded-full !bg-rose-600 px-3 py-1.5 text-[13px] font-semibold !text-white shadow-sm transition-colors hover:!bg-rose-700",children:[f("clearProfile.buttonLabel"),t.jsx(nl,{size:12,"aria-hidden":!0})]}),t.jsx(dd,{text:f("clearProfile.cardDescription")})]})]})]}):null]})]})}const dn="text-[11px] font-semibold uppercase tracking-[0.12em] text-amber-800",un="inline-flex h-8 items-center justify-center rounded-xl border !border-slate-300 bg-white px-3 text-xs font-semibold text-slate-600 shadow-[0_1px_2px_rgba(15,23,42,0.04)] transition hover:!border-slate-400 hover:!bg-slate-100 hover:text-slate-700 active:!bg-slate-200/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400/35 focus-visible:ring-offset-1",mn="inline-flex h-8 items-center justify-center rounded-xl border !border-amber-300 bg-white px-3 text-xs font-semibold text-amber-800 shadow-[0_1px_2px_rgba(15,23,42,0.04)] transition hover:!border-amber-400 hover:!bg-amber-200 hover:text-amber-900 active:!bg-amber-300/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-400/40 focu
2s-visible:ring-offset-1",md="mb-4 rounded-2xl border border-amber-200 bg-amber-50/80 px-4 py-4 shadow-sm ring-2 ring-amber-200/80",fl="relative overflow-hidden rounded-xl bg-[#F7F3EE] pl-3 before:absolute before:inset-y-0 before:left-0 before:w-1 before:bg-[#C9A84C]",pl="mt-1.5 text-[12px] font-medium leading-5 text-slate-500";function Is(e,s){return s?`${e} !border-amber-200 !bg-white !text-slate-800 placeholder:!text-amber-600 focus:!border-amber-400 focus:!ring-amber-300`:e}function ks(e,s){return s?`${e} !text-amber-700`:e}function lr(e,s){return s?`${e} !border-rose-400 !bg-rose-50/80 !text-slate-800 placeholder:!text-rose-500 !ring-2 !ring-rose-200 shadow-[0_0_0_1px_rgba(244,63,94,0.12)] focus:!border-rose-500 focus:!ring-rose-300`:e}function or(e,s){return s?`${e} !text-rose-700`:e}const gl=c.createContext(null);function hd({actions:e,children:s}){return t.jsx(gl.Provider,{value:e,children:s})}function us({id:e,title:s,subtitle:r,pendingCount:a=0,onAutoFill:n,autoFillLoading:l}){const{t:o}=Te(),f=c.useContext(gl);return t.jsxs("div",{id:e,className:"mb-3 flex items-center justify-between gap-3 scroll-mt-6",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("h2",{className:"text-xl font-bold text-slate-800",children:s}),a>0&&t.jsx("span",{className:dn,children:o("buildProfile.sidebar.pendingCount",{count:a})})]}),r&&t.jsx("p",{className:"text-[13px] text-slate-500",children:r})]}),(f||n)&&t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[f,n&&t.jsx(Va,{onClick:n,loading:l})]})]})}function fd(e){return Number.isFinite(e)?Math.max(0,Math.min(100,e)):0}function pd(e){const s="h-full rounded-full transition-[width,background-color] duration-500 ease-out";return e==="success"?`${s} bg-[linear-gradient(90deg,#9CC9D8,#16335F,#C9A84C)] shadow-[0_6px_18px_rgba(22,51,95,0.14)]`:e==="muted"?`${s} bg-slate-300`:`${s} bg-[linear-gradient(90deg,#9CC9D8,#16335F,#C9A84C)]`}function gd(e){return e==="success"?"text-[#16335F]":e==="muted"?"text-slate-400":"text-slate-500"}function xd({percent:e,statusLabel:s,tone:r="active",animate:a=!1,hidden:n=!1}){const l=fd(e),o=r==="active"&&a;return n?null:t.jsx("div",{className:"min-w-0 flex-1",children:t.jsxs("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:["min-w-[320px] overflow-hidden rounded-lg border px-3 py-2 transition",o?"border-[#C7D8E7] bg-[linear-gradient(135deg,rgba(255,255,255,0.94),rgba(246,251,253,0.88))] shadow-[0_10px_22px_-20px_rgba(22,51,95,0.42)]":r==="success"?"border-[#C7D8E7] bg-[linear-gradient(135deg,rgba(255,255,255,0.94),rgba(239,247,250,0.9))] shadow-[0_10px_22px_-20px_rgba(22,51,95,0.3)]":"border-transparent bg-transparent px-0 py-0"].join(" "),children:[o?t.jsxs("div",{className:"mb-2 grid gap-1.5",children:[t.jsx("span",{className:"relative h-1.5 w-[72%] overflow-hidden rounded-full bg-[#E8EEF5]",children:t.jsx("span",{className:"absolute inset-0 animate-[ezLoadingLineScan_1.9s_ease-in-out_infinite] bg-[linear-gradient(90deg,transparent,rgba(156,201,216,0.72),transparent)]"})}),t.jsx("span",{className:"relative h-1.5 w-[92%] overflow-hidden rounded-full bg-[#E8EEF5]",children:t.jsx("span",{className:"absolute inset-0 animate-[ezLoadingLineScan_2.1s_ease-in-out_infinite] bg-[linear-gradient(90deg,transparent,rgba(201,168,76,0.3),transparent)]"})})]}):null,r!=="muted"?t.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-[#E8E4D5]",children:t.jsx("div",{className:pd(r),style:{width:`${l}%`}})}):null,t.jsx("div",{className:`mt-2 text-[11px] font-semibold tracking-[0.02em] ${gd(r)}`,children:s})]})})}function hn({title:e="Additional Information",description:s,badgeLabel:r,pendingCount:a=0,defaultOpen:n=!1,reviewFields:l=[],children:o}){const[f,S]=c.useState(n),j=c.useRef(null);return c.useEffect(()=>{const C=j.current;if(!C)return;const d=()=>S(!0);return C.addEventListener("build-profile-open-review-container",d),()=>C.removeEventListener("build-profile-open-review-container",d)},[]),t.jsxs("div",{ref:j,className:"overflow-visible rounded-[18px] border border-slate-200 bg-slate-50/60","data-review-container-fields":l.join(" "),children:[t.jsxs("button",{type:"button",onClick:()=>S(C=>!C),className:"flex w-full items-center justify-between gap-4 px-4 py-4 text-left","aria-expanded":f,children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("h3",{className:"text-[13px] font-bold tracking-wide text-slate-700",children:e}),a>0?t.jsxs("span",{className:dn,children:[a," Pending"]}):null,r?t.jsx("span",{className:"inline-block rounded-full border border-[#16335F]/15 bg-[#EEF3FB] px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.1em] text-[#16335F]",children:r}):null]}),s?t.jsx("p",{className:"mt-1 text-sm text-slate-500",children:s}):null]}),t.jsx(tt,{size:18,className:`shrink-0 text-slate-400 transition-transform ${f?"rotate-180":""}`})]}),f?t.jsx("div",{className:"overflow-visible border-t border-slate-200 px-4 py-4",children:o}):null]})}const Qn=["January","February","March","April","May","June","July","August","September","October","November","December"],bd=["Su","Mo","Tu","We","Th","Fr","Sa"],Xn=280,Zn=320,Vs=12;function yd(e){return typeof e=="string"?e:""}function vd(e){if(!e)return"";const[s,r,a]=e.split("-").map(Number);return new Date(s,r-1,a).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function va(e,s,r){return`${e}-${String(s+1).padStart(2,"0")}-${String(r).padStart(2,"0")}`}
2const Le=({value:e,onChange:s,placeholder:r="Select date...",className:a="",buttonClassName:n=""})=>{const[l,o]=c.useState(!1),[f,S]=c.useState("days"),j=yd(e),C=c.useMemo(()=>{if(j){const[y,A]=j.split("-").map(Number);return{year:y,month:A-1}}const u=new Date;return{year:u.getFullYear(),month:u.getMonth()}},[]),[d,h]=c.useState(C),v=c.useRef(null),b=c.useRef(null),p=c.useRef(null),[z,H]=c.useState({}),Z=c.useCallback(()=>{const u=b.current;if(!u)return;const y=u.getBoundingClientRect(),A=Math.max(Vs,window.innerWidth-Xn-Vs),N=Math.min(Math.max(y.left,Vs),A),X=y.bottom+4+Zn<=window.innerHeight-Vs?y.bottom+4:Math.max(Vs,y.top-Zn-4);H({position:"fixed",top:X,left:N,width:Xn,zIndex:300})},[]);c.useEffect(()=>{if(!l)return;const u=y=>{var X,E;const A=y.target,N=(X=v.current)==null?void 0:X.contains(A),w=(E=p.current)==null?void 0:E.contains(A);!N&&!w&&o(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[l]),c.useEffect(()=>{if(!l)return;const u=y=>{y.key==="Escape"&&o(!1)};return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[l]),c.useEffect(()=>{if(!l)return;Z();const u=()=>Z();return window.addEventListener("resize",u),window.addEventListener("scroll",u,!0),()=>{window.removeEventListener("resize",u),window.removeEventListener("scroll",u,!0)}},[l,Z]);const{year:G,month:B}=d,U=new Date(G,B,1).getDay(),q=new Date(G,B+1,0).getDate(),ce=new Date,ee=va(ce.getFullYear(),ce.getMonth(),ce.getDate()),ne=c.useMemo(()=>{const u=[];let y=Array(U).fill(null);for(let A=1;A<=q;A++)y.push(A),y.length===7&&(u.push(y),y=[]);if(y.length>0){for(;y.length<7;)y.push(null);u.push(y)}return u},[U,q]),ie=()=>{h(u=>u.month===0?{year:u.year-1,month:11}:{year:u.year,month:u.month-1})},K=()=>{h(u=>u.month===11?{year:u.year+1,month:0}:{year:u.year,month:u.month+1})},Ce=u=>{s(va(G,B,u)),o(!1)},xe=()=>{s(""),o(!1)},k=()=>{if(!l&&j){const[u,y]=j.split("-").map(Number);h({year:u,month:y-1})}l||Z(),o(u=>(u&&S("days"),!u))},I=j?vd(j):"";return t.jsxs("div",{ref:v,className:`relative ${a}`,children:[t.jsxs("button",{ref:b,type:"button",onClick:k,className:`flex w-full items-center rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-sm shadow-sm transition focus:border-transparent focus:outline-none focus:ring-2 focus:ring-[#16335F] ${j?"text-slate-800":"text-slate-400"} ${n}`,children:[t.jsx(wc,{size:14,className:"mr-2 shrink-0 text-slate-400"}),t.jsx("span",{className:"flex-1 text-left",children:I||r}),t.jsx(tt,{size:14,className:"ml-2 shrink-0 text-slate-400"})]}),l&&typeof document<"u"&&ir.createPortal(t.jsxs("div",{ref:p,style:z,className:"rounded-xl border border-slate-200 bg-white p-3 shadow-lg",children:[f==="years"&&(()=>{const u=Math.floor(G/12)*12;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[t.jsx("button",{type:"button",onClick:()=>h(y=>({...y,year:y.year-12})),className:"flex h-7 w-7 items-center justify-center rounded-lg hover:bg-slate-100",children:t.jsx(ba,{size:16,className:"text-slate-600"})}),t.jsxs("span",{className:"text-sm font-bold text-slate-800",children:[u," – ",u+11]}),t.jsx("button",{type:"button",onClick:()=>h(y=>({...y,year:y.year+12})),className:"flex h-7 w-7 items-center justify-center rounded-lg hover:bg-slate-100",children:t.jsx(Zs,{size:16,className:"text-slate-600"})})]}),t.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:Array.from({length:12},(y,A)=>u+A).map(y=>t.jsx("button",{type:"button",onClick:()=>{h(A=>({...A,year:y})),S("months")},className:`rounded-lg px-2 py-2 text-xs font-medium transition-colors ${y===G?"bg-[#16335F] text-white":"text-slate-700 hover:bg-[#16335F]/5"}`,children:y},y))})]})})(),f==="months"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[t.jsx("button",{type:"button",onClick:()=>h(u=>({...u,year:u.year-1})),className:"flex h-7 w-7 items-center justify-center rounded-lg hover:bg-slate-100",children:t.jsx(ba,{size:16,className:"text-slate-600"})}),t.jsxs("button",{type:"button",onClick:()=>S("years"),className:"inline-flex items-center gap-1 rounded-lg px-2 py-1 text-sm font-bold text-slate-800 transition-colors hover:bg-[#16335F]/8 border border-transparent hover:border-slate-200",children:[G,t.jsx(tt,{size:12,className:"text-slate-400"})]}),t.jsx("button",{type:"button",onClick:()=>h(u=>({...u,year:u.year+1})),className:"flex h-7 w-7 items-center justify-center rounded-lg hover:bg-slate-100",children:t.jsx(Zs,{size:16,className:"text-slate-600"})})]}),t.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:Qn.map((u,y)=>t.jsx("button",{type:"button",onClick:()=>{h({year:G,month:y}),S("days")},className:`rounded-lg px-2 py-2 text-xs font-medium transition-colors ${y===B?"bg-[#16335F] text-white":"text-slate-700 hover:bg-[#16335F]/5"}`,children:u.slice(0,3)},u))})]}),f==="days"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[t.jsx("button",{type:"button",onClick:ie,className:"flex h-7 w-7 items-center justify-center rounded-lg hover:bg-slate-100",children:t.jsx(ba,{size:16,className:"text-slate-600"})}),t.jsxs("button",{type:"button",onClick:()=>S("months"),className:"inline-flex items-center gap-1 rounded-lg px-2 py-1 text-sm font-semibold text-slate-800 transition-colors hover:bg-[#16335F]/8 hover:text-[#16335F] border border-transparent hover:border-slate-200",children:[Qn[B]," ",G,t.jsx(tt,{size:12,className:"text-slate-400"})]}),t.jsx("button",{type:"button",onClick:K,className:"flex h-7 w-7 items-center justify-center rounded-lg hover:bg-slate-100",children:t.jsx(Zs,{size:16,className:"text-slate-600"})})]}),t.jsx("div",{className:"grid grid-cols-7 gap-0 text-center",children:bd.map(u=>t.jsx("div",{className:"flex h-8 w-8 items-center justify-center text-[11px] font-medium text-slate-400",children:u},u))}),t.jsx("div",{className:"grid grid-cols-7 gap-0 text-center text-sm",children:ne.map((u,y)=>u.map((A,N)=>{if(A===null)return t.jsx("div",{className:"h-8 w-8"},`empty-${y}-${N}`);const w=va(G,B,A),X=w===j,E=w===ee&&!X;let oe="flex h-8 w-8 items-center justify-center rounded-lg cursor-pointer transition-colors ";return X?oe+="bg-[#16335F] text-white font-bold":E?oe+="ring-1 ring-[#16335F]/30 text-[#16335F] font-semibold hover:bg-[#16335F]/5":oe+="text-slate-700 hover:bg-[#16335F]/5",t.jsx("button",{type:"button",onClick:()=>Ce(A),className:oe,children:A},`day-${A}`)}))})]}),j&&t.jsxs("button",{type:"button",onClick:xe,className:"mt-2 flex w-full items-center justify-center rounded-lg border border-slate-200 bg-slate-50 px-2 py-1.5 text-xs font-medium text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700",children:[t.jsx(Tt,{size:12,className:"mr-1"}),"Clear"]})]}),document.body)]})};function Y({suggestion:e,onAccept:s,onDismiss:r}){const{t:a}
2=Te();return!e||!s||!r?null:t.jsxs("div",{"data-pending-field-actions":!0,className:"mt-2 flex items-center gap-2",children:[t.jsx("button",{type:"button",onClick:()=>r(e),className:un,children:a("buildProfile.pendingSuggestions.dismiss")}),t.jsx("button",{type:"button",onClick:()=>s(e),className:mn,children:a("buildProfile.pendingSuggestions.accept")})]})}const jd=150,ei=10;function ft(e){return e.replace(/_([a-z])/g,(s,r)=>r.toUpperCase())}function ot(e,s){if(Array.isArray(e))return e.map(a=>a!==null&&typeof a=="object"?ot(a,s):a);if(e===null||typeof e!="object")return e;const r={};for(const[a,n]of Object.entries(e)){const l=s(a);if(Array.isArray(n)){const o=n.length>0&&typeof n[0]!="object";r[l]=o?n:n.map(f=>f!==null&&typeof f=="object"?ot(f,s):f)}else n!==null&&typeof n=="object"?r[l]=ot(n,s):r[l]=n}return r}function qt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function le(e){return String(e??"").trim().replace(/\s+/g," ").toLowerCase()}function Qs(e){return e==null?!1:typeof e=="string"?e.trim().length>0:Array.isArray(e)?e.length>0:!0}function Ve(e){return e==null?"":typeof e=="string"?e.trim():typeof e=="number"||typeof e=="boolean"?String(e).trim():""}function Nd(e,s){return s!=="country"?!1:le(e.country)===le(kc.country)&&!Qs(e.address)&&!Qs(e.city)&&!Qs(e.state)&&!Qs(e.zipCode)}function Sd(e){const s=ft(e);return s||null}function Cd(e,s){const r=s==null?"":String(s);return e==="activityOtherResponsibilitiesDescription"?r.slice(0,jd):r}function ti(e){return!e||typeof e!="object"?null:{id:qt(),...ot(e,ft)}}function wd(e){return!e||typeof e!="object"?null:{id:qt(),...ot(e,ft)}}function Pd(e){if(!e||typeof e!="object")return null;const s=ot(e,ft);return{id:qt(),relation:s.relation??"",livingStatus:s.livingStatus??"",firstName:s.firstName??"",lastName:s.lastName??"",email:s.email??"",phoneType:s.phoneType??"",phoneNumber:s.phoneNumber??"",occupation:s.occupation??"",employmentStatus:s.employmentStatus??"",employer:s.employer??"",highestEducation:s.highestEducation??"",collegeUniversityAffiliation:s.collegeUniversityAffiliation??""}}function xl(e){if(!e||typeof e!="object")return null;const s=ot(e,ft);return{id:qt(),language:s.language??"",otherLanguageName:s.otherLanguageName??"",proficiency:s.proficiency??""}}function bl(e){if(!e||typeof e!="object")return null;const s=ot(e,ft),r=Ve(s.schoolName);return r?{id:qt(),schoolName:r,fromDate:Ve(s.fromDate),toDate:Ve(s.toDate),reasonForLeaving:Ve(s.reasonForLeaving)}:null}function yl(e){if(!e||typeof e!="object")return null;const s=ot(e,ft),r=Ve(s.collegeName);return r?{id:qt(),collegeName:r,fromDate:Ve(s.fromDate),toDate:Ve(s.toDate),degreeEarned:Ve(s.degreeEarned),courseDetails:Ve(s.courseDetails)}:null}function vl(e){if(!e||typeof e!="object")return null;const s=ot(e,ft),r=Ve(s.subject),a=Ve(s.title);return!r&&!a?null:{id:qt(),subject:r,title:a,level:Ve(s.level),schedule:Ve(s.schedule)}}function Zr(e){if(!e||typeof e!="object")return null;const s=e,r=s.test_type??s.testType;if(!r)return null;const a=s.scores&&typeof s.scores=="object"?s.scores:s,n={};return Object.entries(a).forEach(([l,o])=>{l==="test_type"||l==="testType"||l==="times_taken"||l==="timesTaken"||(n[ft(l)]=o)}),{id:qt(),type:r,timesTaken:s.times_taken??s.timesTaken??null,...n}}function jl(e){if(!e||typeof e!="object")return null;const s=e,r=s.test_type??s.testType;if(!ol.includes(r))return null;const a=Ve(s.expected_sittings??s.expectedSittings),n=s.future_dates??s.futureDates,l=Array.isArray(n)?n.map(o=>Ve(o)).filter(Boolean):[];return!a&&l.length===0?null:{testType:r,plan:{expectedSittings:a,futureDates:l}}}function Ad(e,s,r){const a=Ve(r);if(!a||a===vt)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const n=e[s],l=le(a);if(n.some(S=>le(S)===l))return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const f=s==="additionalInterests"?[...n,a]:[...n.filter(S=>S!==vt),a];return{nextProfile:{...e,[s]:f},changedFields:[s],applied:!0,requiresReview:!1}}function Td(e){if(e.action!=="review_only")return e.action;switch(e.suggestionType){case"scalar_field":return"set_if_empty";case"string_list_item":case"responsibility_list_item":case"circumstance_list_item":return"append_unique";case"future_plan_entry":return"upsert_future_plan";case"language_item":case"family_contact_item":case"secondary_school_item":case"college_coursework_item":case"current_course_item":case"activity_item":case"honor_item":return"append_item";case"test_record":{const s=Zr(e.suggestedValue),r=s==null?void 0:s.type;return r&&Os.includes(r)?"upsert_by_test_type":"append_item"}default:return e.action}}function Ir(e){return[le(e.name),le(e.role),le(e.category)].join("|")}function si(e){return[le(e.name),le(e.level)].join("|")}function ri(e){return[le(e.relation),le(e.firstName),le(e.lastName)].join("|")}function ai(e){return[le(e.language),le(e.otherLanguageName)].join("|")}function ni(e){return[le(e.schoolName),le(e.fromDate)].join("|")}function ii(e){return[le(e.collegeName),le(e.fromDate)].join("|")}function li(e){return[le(e.subject),le(e.title)].join("|")}function Ya(e){const s=le(e.type);if(Os.includes(e.type))return s;const r=le(e.subject),a=le(e.date);return[s,r,a].join("|")}function oi(e){const s=e.type,r=le(s);if(!r)return"";if(s&&Os.includes(s))return r;const a=le(e.subject);switch(s){case"IB":case"Cambridge":return[r,a,le(e.level)].join("|");case"AP":case"SAT_Subject":return[r,a].join("|");default:return Ya(e)}}function Ts(e){return e==null?"":typeof e=="string"?le(e):typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function ci(e,s){const r=new Set([...Object.keys(e),...Object.keys(s)]);r.delete("id");for(const a of r)if(Ts(e[a])!==Ts(s[a]))return!1;return!0}function ss(e,s){return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1,blockedReason:s}}function ls(e,s,r={}){var f,S;const a=Sd(s.fieldKey);if(!a)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const n=!!(r.allowReviewOnly&&s.action==="review_only"),l=!!r.allowReviewOnly,o=Td(s);if(o==="set_if_empty"){const j=Cd(a,s.suggestedValue),C=e[a];if(Ts(C)===Ts(j))return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};if(s.action==="review_only"&&!r.allowReviewOnly)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!0};const h=Nd(e,a)&&le(C)!==le(j);if(!n&&Qs(C)&&!h)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!0};if(C===j)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const v={...e,[a]:j},b=[a];if(a==="activityOtherResponsibilitiesDescription"&&j.trim()){const p=e.activityResponsibilities.filter(z=>z!==vt);p.includes(tr)||(v.activityResponsibilities=[...p,tr],b.push("activityResponsibilities"))}return{nextProfile:v,changedFields:b,applied:!0,requiresReview:!1}}if(s.action==="review_only"&&!r.allowReviewOnly)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!0};if(o==="append_unique")return a!=="additionalInterests"&&a!=="activityResponsibilities"&&a!=="activityCircumstances"?{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1}:Ad(e,a,s.suggestedValue);if(o==="upsert_future_plan"){if(a!=="futurePlansByType")return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const j=jl(s.suggestedValue);if(!j)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const C=e.futurePlansByType[j.testType];return C&&Ts(C)===Ts(j.plan)?{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1}:{nextProfile:{...e,futurePlansByType:{...e.futurePlansByType,[j.testType]:j.plan}},changedFields:["futurePlansByType"],applied:!0,requiresReview:!1}}if(o==="append_item"){if(a==="languages"){const j=xl(s.suggestedValue);if(!j)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const C=le(s.dedupeKey||ai(j));return e.languages.some(h=>le(ai(h))===C)?{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1}:{nextProfile:{...e,languages:[...e.languages,j]},changedFields:["languages"],applied:!0,requiresReview:!1}}if(a==="familyContacts"){const j=Pd(s.suggestedValue);if(!j)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const C=le(s.dedupeKey||ri(j));return e.familyContacts.some(h=>le(ri(h))===C)?{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1}
2:{nextProfile:{...e,familyContacts:[...e.familyContacts,j]},changedFields:["familyContacts"],applied:!0,requiresReview:!1}}if(a==="activities"){const j=ti(s.suggestedValue);if(!j)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const C=le(s.dedupeKey||Ir(j));return e.activities.some(h=>le(Ir(h))===C)?{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1}:e.activities.length>=ei?ss(e,"activities_full"):{nextProfile:{...e,activities:[...e.activities,j]},changedFields:["activities"],applied:!0,requiresReview:!1}}if(a==="honors"){const j=wd(s.suggestedValue);if(!j)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const C=le(s.dedupeKey||si(j));return e.honors.some(h=>le(si(h))===C)?{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1}:{nextProfile:{...e,honors:[...e.honors,j]},changedFields:["honors"],applied:!0,requiresReview:!1}}if(a==="testRecords"){const j=Zr(s.suggestedValue);if(!j)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const C=le(s.dedupeKey||Ya(j));if(e.testRecords.some(b=>le(Ya(b))===C))return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const h=oi(j),v=h?e.testRecords.findIndex(b=>oi(b)===h):-1;if(v!==-1){const b=e.testRecords[v],p={...b,...j,id:b.id};if(ci(b,p))return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};if(!l)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!0};const z=[...e.testRecords];return z[v]=p,{nextProfile:{...e,testRecords:z},changedFields:["testRecords"],applied:!0,requiresReview:!1}}return e.testRecords.length>=cs?ss(e,"test_records_full"):{nextProfile:{...e,testRecords:[...e.testRecords,j]},changedFields:["testRecords"],applied:!0,requiresReview:!1}}if(a==="otherSecondarySchools"){const j=bl(s.suggestedValue);if(!j)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const C=le(s.dedupeKey||ni(j));return e.otherSecondarySchools.some(h=>le(ni(h))===C)?{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1}:e.otherSecondarySchools.length>=sr?ss(e,"secondary_schools_full"):{nextProfile:{...e,otherSecondarySchools:[...e.otherSecondarySchools,j]},changedFields:["otherSecondarySchools"],applied:!0,requiresReview:!1}}if(a==="collegeCoursework"){const j=yl(s.suggestedValue);if(!j)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const C=le(s.dedupeKey||ii(j));if(e.collegeCoursework.some(b=>le(ii(b))===C))return e.hasCollegeCoursework!=="Yes"?{nextProfile:{...e,hasCollegeCoursework:"Yes"},changedFields:["hasCollegeCoursework"],applied:!0,requiresReview:!1}:{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};if(e.collegeCoursework.length>=rr)return ss(e,"college_coursework_full");const h={...e,hasCollegeCoursework:"Yes",collegeCoursework:[...e.collegeCoursework,j]},v=["collegeCoursework"];return e.hasCollegeCoursework!=="Yes"&&v.push("hasCollegeCoursework"),{nextProfile:h,changedFields:v,applied:!0,requiresReview:!1}}if(a==="currentCourses"){const j=vl(s.suggestedValue);if(!j)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const C=le(s.dedupeKey||li(j));return e.currentCourses.some(h=>le(li(h))===C)?{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1}:e.currentCourses.length>=ar?ss(e,"current_courses_full"):{nextProfile:{...e,currentCourses:[...e.currentCourses,j]},changedFields:["currentCourses"],applied:!0,requiresReview:!1}}}if(o==="upsert_activity"&&a==="activities"){const j=ti(s.suggestedValue);if(!j)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const C=le(s.dedupeKey||Ir(j)),d=e.activities.findIndex(b=>le(Ir(b))===C);if(d===-1)return e.activities.length>=ei?ss(e,"activities_full"):{nextProfile:{...e,activities:[...e.activities,j]},changedFields:["activities"],applied:!0,requiresReview:!1};const h=[...e.activities],v=h[d];return h[d]={...v,name:j.name||v.name,category:j.category||v.category,role:j.role||v.role,gradeLevels:(f=j.gradeLevels)!=null&&f.length?j.gradeLevels:v.gradeLevels,hoursPerWeek:j.hoursPerWeek??v.hoursPerWeek,weeksPerYear:j.weeksPerYear??v.weeksPerYear,description:j.description||v.description,organizationName:j.organizationName||v.organizationName,sportTeam:j.sportTeam||v.sportTeam,timingOfParticipation:(S=j.timingOfParticipation)!=null&&S.length?j.timingOfParticipation:v.timingOfParticipation,intendsToParticipateInCollege:j.intendsToParticipateInCollege||v.intendsToParticipateInCollege,id:v.id},{nextProfile:{...e,activities:h},changedFields:["activities"],applied:!0,requiresReview:!1}}if(o==="upsert_by_test_type"&&a==="testRecords"){const j=Zr(s.suggestedValue);if(!j)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};const C=le(j.type),d=e.testRecords.findIndex(p=>le(p.type)===C);if(d===-1)return e.testRecords.length>=cs?ss(e,"test_records_full"):{nextProfile:{...e,testRecords:[...e.testRecords,j]},changedFields:["testRecords"],applied:!0,requiresReview:!1};const h=e.testRecords[d],v={...h,...j,id:h.id};if(ci(h,v))return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!1};if(!l)return{nextProfile:e,changedFields:[],applied:!1,requiresReview:!0};const b=[...e.testRecords];return b[d]=v,{nextProfile:{...e,testRecords:b},changedFields:["testRecords"],applied:!0,requiresReview:!1}}return{nextProfile:e,changedFields:[],applied:!1,requiresReview:s.action==="review_only"}}function Id(e){return e.tab==="testing"&&e.suggestionType==="test_record"}function Nl(e,s,r){return s.reduce((a,n)=>{if(!r.isSupportedInlinePendingSuggestion(n))return a;const l=ls(a,n);return l.applied&&!l.requiresReview?l.nextProfile:a},e)}function di(e,s,r){const a=[],n=[],l=new Set;let o=e;
2return s.forEach(f=>{var j;const S=ls(o,f);if(S.blockedReason){l.add(S.blockedReason);return}if(S.applied&&!S.requiresReview&&r.isSupportedInlinePendingSuggestion(f)){a.push(f),o=S.nextProfile;return}if(S.requiresReview&&((j=r.isReviewableInlinePendingSuggestion)!=null&&j.call(r,f))){a.push(f);return}S.requiresReview&&r.isInlineReviewSuggestion(f)&&n.push(f)}),{inlineSuggestions:a,reviewSuggestions:n,blockedReasons:l}}function fn(e){const s=e.suggestedValue;if(typeof s=="string")return s;if(e.suggestionType==="activity_item"&&s&&typeof s=="object"){const r=ot(s,ft);return[r.name,r.role,r.category].filter(Boolean).join(" · ")}if(e.suggestionType==="family_contact_item"&&s&&typeof s=="object"){const r=ot(s,ft);return[r.relation,[r.firstName,r.lastName].filter(Boolean).join(" ")].filter(Boolean).join(" · ")}if(e.suggestionType==="honor_item"&&s&&typeof s=="object"){const r=ot(s,ft);return[r.name,r.level].filter(Boolean).join(" · ")}if(e.suggestionType==="test_record"&&s&&typeof s=="object"){const r=Zr(s);if(!r)return"Suggested test record";const a=r.subject;return[r.type,a].filter(Boolean).join(" · ")}if(e.suggestionType==="future_plan_entry"&&s&&typeof s=="object"){const r=jl(s);return r?[r.testType,r.plan.expectedSittings?`${r.plan.expectedSittings} planned`:"",...r.plan.futureDates].filter(Boolean).join(" · "):"Suggested future test plan"}if(e.suggestionType==="responsibility_list_item"||e.suggestionType==="circumstance_list_item")return Ve(s)||"Suggested value";if(e.suggestionType==="language_item"&&s&&typeof s=="object"){const r=xl(s);return r?[r.language,r.proficiency].filter(Boolean).join(" · "):"Suggested language"}if(e.suggestionType==="secondary_school_item"&&s&&typeof s=="object"){const r=bl(s);return r?[r.schoolName,r.fromDate,r.toDate].filter(Boolean).join(" · "):"Suggested secondary school"}if(e.suggestionType==="college_coursework_item"&&s&&typeof s=="object"){const r=yl(s);return r?[r.collegeName,r.courseDetails].filter(Boolean).join(" · "):"Suggested college coursework"}if(e.suggestionType==="current_course_item"&&s&&typeof s=="object"){const r=vl(s);return r?[r.title,r.subject,r.level].filter(Boolean).join(" · "):"Suggested current course"}return"Suggested value"}function kd(e){return e.split("_").filter(Boolean).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function _s({suggestions:e,onAccept:s,onDismiss:r}){const{t:a}=Te();return e.length===0?null:t.jsx("div",{className:"mb-4 space-y-3",children:e.map((n,l)=>t.jsx("div",{className:"rounded-2xl border border-amber-200 bg-amber-50/80 px-4 py-4 shadow-sm",children:t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:dn,children:a("buildProfile.pendingSuggestions.pendingAutofill")}),t.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-amber-800",children:kd(n.fieldKey)})]}),t.jsx("p",{className:"mt-2 text-sm font-semibold text-slate-800",children:fn(n)}),n.reason&&t.jsx("p",{className:"mt-2 text-sm leading-6 text-slate-600",children:n.reason})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("button",{type:"button",onClick:()=>r(n),className:un,children:a("buildProfile.pendingSuggestions.dismiss")}),t.jsx("button",{type:"button",onClick:()=>s(n),className:mn,children:a("buildProfile.pendingSuggestions.accept")})]})]})},n.suggestionId||`${n.fieldKey}-${l}`))})}function Dd(e){if(e==null)return"";if(typeof e=="string")return e.trim();if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(s=>String(s??"").trim()).filter(Boolean).join(", ");try{return JSON.stringify(e)}catch{return String(e)}}function W({suggestion:e,onAccept:s,onDismiss:r}){const{t:a}=Te();if(!e||!s||!r)return null;const n=fn(e).trim(),l=Dd(e.suggestedValue),o=n&&n!=="Suggested value"?n:l||a("stragglerUi.reviewPopover.fallbackValue");return t.jsx("div",{className:"mt-2",children:t.jsxs("div",{className:"w-full rounded-2xl border border-rose-200 bg-white px-4 py-3 shadow-[0_18px_48px_-24px_rgba(225,29,72,0.35)] ring-1 ring-rose-100",children:[t.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-rose-700",children:a("stragglerUi.reviewPopover.title")}),t.jsxs("div",{className:"mt-2 rounded-xl bg-rose-50 px-3 py-2",children:[t.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.12em] text-rose-600",children:a("stragglerUi.reviewPopover.suggestedValue")}),t.jsx("p",{className:"mt-1 break-words text-sm font-semibold text-slate-800",children:o})]}),e.reason?t.jsx("p",{className:"mt-2 text-sm leading-6 text-slate-600",children:e.reason}):null,t.jsx(Y,{suggestion:e,onAccept:s,onDismiss:r})]})})}const Ed=["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","District of Columbia","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","N
2orth Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming","American Samoa","Guam","Northern Mariana Islands","Puerto Rico","U.S. Virgin Islands"],ui="mt-1.5 w-full rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-sm text-slate-800 shadow-sm transition placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-[#16335F]",mi="w-full rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-sm text-slate-800 shadow-sm transition placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-[#16335F]",Ks="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500",hi=5,Od=["preferredName","middleName","suffix","hasFormerLegalName","formerFirstName","formerMiddleName","formerLastName","citizenship","preferredPhoneType","preferredPhoneNumber","mobilePhoneNumber","alternatePhoneType","alternatePhoneNumber","citizenshipStatus","commonAppFeeWaiverEligible","otherCitizenships","countryOfBirth","cityOfBirth","stateOfBirth","yearsInUnitedStates","hasValidUsVisa","currentVisaType","otherVisaType","visaNumber","visaIssueDate","intendsToApplyForNewVisa"],qs=[{value:"",label:""},"Yes","No"],_d=[{value:"",label:""},"Jr.","Sr.","II","III","IV","V","VI","Other"],fi=[{value:"",label:""},"Mobile","Home","Work","Other"],Md=[{value:"",label:""},"Female","Male","Intersex","Prefer not to say"],Fd=[{value:"",label:""},"She / her","He / him","They / them","Other","Prefer not to say"],Rd=[{value:"",label:""},"U.S. Citizen","U.S. Dual Citizen","U.S. Permanent Resident","U.S. Resident with Other Status","Non-U.S. Citizen"],Ld=[{value:"",label:""},"F-1","J-1","B-1/B-2","H-4","L-2","O-3","Other"],zd=[{value:"",label:""},"English","Spanish","Mandarin Chinese","Cantonese","French","German","Hindi","Arabic","Korean","Japanese","Portuguese","Russian","Vietnamese","Bengali","Urdu","Tamil","Telugu","Turkish","Italian","Other"],Bd=[{value:"",label:""},"First language","Native / fluent","Proficient","Conversational","Basic"];function Ud(e){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`${e}-${crypto.randomUUID()}`:`${e}-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function $d(){return{id:Ud("personal-language"),language:"",otherLanguageName:"",proficiency:""}}function Vd({profile:e,personalExtension:s,pendingFields:r={},reviewFields:a={},missingFields:n,pendingSuggestions:l=[],onChange:o,onPersonalExtensionChange:f,onAutoFill:S,autoFillLoading:j,pendingCount:C=0,onAcceptPendingSuggestion:d,onDismissPendingSuggestion:h,onAcceptReviewSuggestion:v,onDismissReviewSuggestion:b}){const{t:p}=Te(),[z,H]=c.useState([]),[Z,G]=c.useState(!1),B=c.useRef(null),U=c.useRef(""),q=c.useRef(!1),ce=[{value:"",label:""},...Gn.map(g=>g)],ee=[{value:"",label:""},...Gn.map(g=>g)],ne="build-profile-in-state-tuition-help",ie=[{value:"",label:""},"N/A",...Ed.map(g=>g)],K=c.useCallback(g=>{f({...s,...g})},[f,s]),Ce=c.useCallback(()=>{s.languages.length>=hi||K({languages:[...s.languages,$d()]})},[s.languages,K]),xe=c.useCallback((g,Ne)=>{K({languages:s.languages.map(me=>me.id===g?{...me,...Ne}:me)})},[s.languages,K]),k=c.useCallback(g=>{K({languages:s.languages.filter(Ne=>Ne.id!==g)})},[s.languages,K]),I=g=>({pending:r[g],review:r[g]?void 0:a[g]}),u=(g,Ne=ui)=>{const{pending:me,review:Fe}=I(g),st=me?Is(Ne,!0):lr(Ne,!!Fe);return n!=null&&n.has(g)?`${st} border-rose-300 bg-rose-50 ring-2 ring-rose-200 focus:ring-rose-500`:st},y=g=>{const{pending:Ne,review:me}=I(g),Fe=Ne?ks(Ks,!0):or(Ks,!!me);return n!=null&&n.has(g)?`${Fe} text-rose-600`:Fe},A=g=>Xi(g,e)?t.jsx("span",{className:"text-rose-500",children:"*"}):null,N=g=>{const{pending:Ne,review:me}=I(g);return!Ne&&!!me&&!z.includes(g)},w=(g,Ne)=>{const me=r[g];return me?String(me.suggestedValue??""):Ne},X=w("hasFormerLegalName",s.hasFormerLegalName),E=w("citizenshipStatus",s.citizenshipStatus),oe=E==="Other"?"U.S. Resident with Other Status":E,je=w("commonAppFeeWaiverEligible",s.commonAppFeeWaiverEligible),Ie=w("hasAlternateMailingAddress",s.hasAlternateMailingAddress),Ae=w("sex",s.sex),pt=w("pronouns",s.pronouns),jt=w("hasValidUsVisa",s.hasValidUsVisa),ct=w("currentVisaType",s.currentVisaType),It=X==="Yes",Nt=pt==="Other",Ue=["U.S. Dual Citizen","U.S. Permanent Resident","Non-U.S. Citizen"].includes(oe),ze=oe==="Non-U.S. Citizen",ue=Ie==="Yes",be=ze&&jt==="Yes",P=be&&ct==="Other",te=Od.reduce((g,Ne)=>{const{pending:me,review:Fe}=I(Ne);return g+(me||Fe?1:0)},0)+l.length,_=Object.keys(a).filter(g=>{const{pending:Ne,review:me}=I(g);return!Ne&&!!me}),we=_.map(g=>{var Ne;return`${String(g)}:${((Ne=a[g])==null?void 0:Ne.suggestionId)??""}`}).join("|"),L=g=>{const{pending:Ne,review:me}=I(g);
2if(!Ne&&me){H(Fe=>Fe.includes(g)?Fe.filter(st=>st!==g):[...Fe,g]);return}},re=g=>{const{pending:Ne,review:me}=I(g);return!Ne&&!!me&&z.includes(g)};return c.useEffect(()=>{if(!_.length||!we){U.current="";return}U.current!==we&&(H(_),U.current=we)},[_,we]),c.useEffect(()=>{const g=q.current&&!j;q.current=!!j,!(!g||!_.length)&&H(_)},[_,j]),c.useEffect(()=>{if(z.length===0)return;const g=Ne=>{const me=B.current,Fe=Ne.target;!me||!Fe||z.some(dt=>{const rt=me.querySelector(`[data-review-field="${dt}"]`);return rt==null?void 0:rt.contains(Fe)})||H([])};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[z]),t.jsxs("section",{ref:B,className:"rounded-2xl bg-white p-6 shadow-sm ring-1 ring-black/5",children:[t.jsx(us,{id:"section-personal",title:p("buildProfile.personalInfo.title"),pendingCount:C,onAutoFill:S,autoFillLoading:j}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"rounded-[18px] border border-slate-200 bg-slate-50/60 p-4",children:[t.jsx("div",{className:"mb-3",children:t.jsx("h3",{className:"text-[13px] font-bold tracking-wide text-slate-700",children:p("buildProfile.personalInfo.name")})}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:p("buildProfile.personalInfo.legalName")}),t.jsxs("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"firstName",children:[t.jsxs("label",{className:y("firstName"),children:[p("buildProfile.personalInfo.firstName")," ",A("firstName")]}),t.jsx("input",{type:"text","aria-invalid":(n==null?void 0:n.has("firstName"))||void 0,className:u("firstName"),autoComplete:"new-password",placeholder:p("buildProfile.personalInfo.firstNamePlaceholder"),value:e.firstName,onFocus:()=>L("firstName"),onClick:()=>L("firstName"),onChange:g=>o("firstName",g.target.value)}),t.jsx(Y,{suggestion:r.firstName,onAccept:d,onDismiss:h}),re("firstName")?t.jsx(W,{suggestion:r.firstName?void 0:a.firstName,onAccept:v,onDismiss:b}):null,t.jsx(Pt,{field:"firstName"})]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"lastName",children:[t.jsxs("label",{className:y("lastName"),children:[p("buildProfile.personalInfo.lastName")," ",A("lastName")]}),t.jsx("input",{type:"text","aria-invalid":(n==null?void 0:n.has("lastName"))||void 0,className:u("lastName"),autoComplete:"new-password",placeholder:p("buildProfile.personalInfo.lastNamePlaceholder"),value:e.lastName,onFocus:()=>L("lastName"),onClick:()=>L("lastName"),onChange:g=>o("lastName",g.target.value)}),t.jsx(Y,{suggestion:r.lastName,onAccept:d,onDismiss:h}),re("lastName")?t.jsx(W,{suggestion:r.lastName?void 0:a.lastName,onAccept:v,onDismiss:b}):null,t.jsx(Pt,{field:"lastName"})]})]})]}),t.jsxs("div",{className:"border-t border-slate-200 pt-4",children:[t.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:p("buildProfile.personalInfo.personalDetails")}),t.jsxs("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"gender",onClick:()=>L("gender"),children:[t.jsx("label",{className:y("gender"),children:p("buildProfile.personalInfo.gender")}),t.jsx(Q,{value:e.gender,onChange:g=>o("gender",g),options:Dc.map(g=>g),placeholder:p("buildProfile.personalInfo.select"),className:u("gender",""),suppressOpen:N("gender")}),t.jsx(Y,{suggestion:r.gender,onAccept:d,onDismiss:h}),re("gender")?t.jsx(W,{suggestion:r.gender?void 0:a.gender,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"dateOfBirth",onClick:()=>L("dateOfBirth"),children:[t.jsx("label",{className:y("dateOfBirth"),children:p("buildProfile.personalInfo.dateOfBirth")}),t.jsx(Le,{value:e.dateOfBirth,onChange:g=>o("dateOfBirth",g),placeholder:p("buildProfile.personalInfo.selectDate"),buttonClassName:u("dateOfBirth","")}),t.jsx(Y,{suggestion:r.dateOfBirth,onAccept:d,onDismiss:h}),re("dateOfBirth")?t.jsx(W,{suggestion:r.dateOfBirth?void 0:a.dateOfBirth,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"raceEthnicity",onClick:()=>L("raceEthnicity"),children:[t.jsx("label",{className:y("raceEthnicity"),children:p("buildProfile.personalInfo.raceEthnicity")}),t.jsx(Q,{value:e.raceEthnicity,onChange:g=>o("raceEthnicity",g),options:Ec.map(g=>g),placeholder:p("buildProfile.personalInfo.select"),className:u("raceEthnicity",""),suppressOpen:N("raceEthnicity")}),t.jsx(Y,{suggestion:r.raceEthnicity,onAccept:d,onDismiss:h}),re("raceEthnicity")?t.jsx(W,{suggestion:r.raceEthnicity?void 0:a.raceEthnicity,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"sex",onClick:()=>L("sex"),children:[t.jsxs("label",{className:y("sex"),children:[p("buildProfile.personalInfo.sex")," ",A("sex")]}),t.jsx(Q,{value:Ae,onChange:g=>K({sex:g}),options:Md,placeholder:p("buildProfile.personalInfo.select"),className:u("sex",""),suppressOpen:N("sex")}),t.jsx(Y,{suggestion:r.sex,onAccept:d,onDismiss:h}),re("sex")?t.jsx(W,{suggestion:r.sex?void 0:a.sex,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"pronouns",onClick:()=>L("pronouns"),children:[t.jsx("label",{className:y("pronouns"),children:p("buildProfile.personalInfo.pronouns")}),t.jsx(Q,{value:pt,onChange:g=>K({pronouns:g,otherPronouns:g==="Other"?s.otherPronouns:""}),options:Fd,placeholder:p("buildProfile.personalInfo.select"),className:u("pronouns",""),suppressOpen:N("pronouns")}),t.jsx(Y,{suggestion:r.pronouns,onAccept:d,onDismiss:h}),re("pronouns")?t.jsx(W,{suggestion:r.pronouns?void 0:a.pronouns,onAccept:v,onDismiss:b}):null]}),Nt?t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"otherPronouns",children:[t.jsx("label",{className:y("otherPronouns"),children:p("buildProfile.personalInfo.otherPronouns")}),t.jsx("input",{type:"text",className:u("otherPronouns"),placeholder:p("buildProfile.personalInfo.otherPronounsPlaceholder"),value:w("otherPronouns",s.otherPronouns),onFocus:()=>L("otherPronouns"),onClick:()=>L("otherPronouns"),onChange:g=>K({otherPronouns:g.target.value})}),t.jsx(Y,{suggestion:r.otherPronouns,onAccept:d,onDismiss:h}),re("otherPronouns")?t.jsx(W,{suggestion:r.otherPronouns?void 0:a.otherPronouns,onAccept:v,onDismiss:b}):null]}):null]})]})]})]}),t.jsxs("div",{className:"rounded-[18px] border border-slate-200 bg-slate-50/60 p-4",children:[t.jsx("div",{className:"mb-3",children:t.jsx("h3",{className:"text-[13px] font-bold tracking-wide text-slate-700",children:p("buildProfile.personalInfo.addressGroup")})}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"country",onClick:()=>L("country"),children:[t.jsxs("label",{className:y("country"),children:[p("buildProfile.personalInfo.country")," ",A("country")]}),t.jsx(Q,{value:e.country,onChange:g=>o("country",g),options:ce,placeholder:p("buildProfile.personalInfo.selectCountry"),searchable:!0,className:u("country",""),suppressOpen:N("country")}),t.jsx(Y,{suggestion:r.country,onAccept:d,onDismiss:h}),re("country")?t.jsx(W,{suggestion:r.country?void 0:a.country,onAccept:v,onDismiss:b}):null,t.jsx(Pt,{field:"country"})]}),t.jsxs("div",{className:"group relative z-0 sm:col-span-2 hover:z-30 focus-within:z-30","data-review-field":"address",children:[t.jsxs("label",{className:y("address"),children:[p("buildProfile.personalInfo.address")," ",A("address")]}),t.jsx("input",{type:"text",className:u("address",mi),autoComplete:"new-password",placeholder:p("buildProfile.personalInfo.streetAddress"),value:e.address,onFocus:()=>L("address"),onClick:()=>L("address"),onChange:g=>o("address",g.target.value)}),t.jsx(Y,{suggestion:r.address,onAccept:d,onDismiss:h}),re("address")?t.jsx(W,{suggestion:r.address?void 0:a.address,onAccept:v,onDismiss:b}):null,t.jsx(Pt,{field:"address"})]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"hasAlternateMailingAddress",onClick:()=>L("hasAlternateMailingAddress"),children:[t.jsxs("label",{className:y("hasAlternateMailingAddress"),children:[p("buildProfile.personalInfo.alternateMailingAddress")," ",A("hasAlternateMailingAddress")]}
2),t.jsx(Q,{value:Ie,onChange:g=>K({hasAlternateMailingAddress:g,alternateMailingAddress:g==="Yes"?s.alternateMailingAddress:"",alternateMailingCountry:g==="Yes"?s.alternateMailingCountry:"",alternateMailingCity:"",alternateMailingState:"",alternateMailingZipCode:"",isMailingTemporary:"",mailingFromDate:"",mailingToDate:""}),options:qs,placeholder:p("buildProfile.personalInfo.select"),className:u("hasAlternateMailingAddress",""),suppressOpen:N("hasAlternateMailingAddress")}),t.jsx(Y,{suggestion:r.hasAlternateMailingAddress,onAccept:d,onDismiss:h}),re("hasAlternateMailingAddress")?t.jsx(W,{suggestion:r.hasAlternateMailingAddress?void 0:a.hasAlternateMailingAddress,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 w-full hover:z-30 focus-within:z-30","data-review-field":"inStateTuitionState",onClick:()=>L("inStateTuitionState"),children:[t.jsxs("label",{className:`${y("inStateTuitionState")} inline-flex items-center gap-1.5`,children:[p("buildProfile.personalInfo.inStateTuitionState")," ",A("inStateTuitionState"),t.jsxs("span",{tabIndex:0,"aria-describedby":ne,onMouseEnter:()=>G(!0),onMouseLeave:()=>G(!1),onFocus:()=>G(!0),onBlur:()=>G(!1),onClick:g=>g.stopPropagation(),className:"relative inline-flex h-4 w-4 items-center justify-center rounded-full text-slate-400 outline-none transition hover:text-slate-700 focus-visible:text-slate-700 focus-visible:ring-2 focus-visible:ring-slate-300",children:[t.jsx(ll,{className:"h-3.5 w-3.5","aria-hidden":"true"}),t.jsx("span",{id:ne,role:"tooltip",className:`pointer-events-none absolute bottom-full left-1/2 z-40 mb-2 w-64 -translate-x-1/2 rounded-lg bg-slate-900 px-3 py-2 text-left text-[11px] font-medium normal-case leading-snug tracking-normal text-white shadow-lg transition-opacity ${Z?"opacity-100":"opacity-0"}`,children:p("buildProfile.personalInfo.inStateTuitionHelp")})]})]}),t.jsx(Q,{value:w("inStateTuitionState",e.inStateTuitionState),onChange:g=>o("inStateTuitionState",g),options:ie,placeholder:p("buildProfile.personalInfo.selectState"),searchable:!0,className:u("inStateTuitionState",""),"aria-invalid":(n==null?void 0:n.has("inStateTuitionState"))||void 0,"aria-describedby":ne,suppressOpen:N("inStateTuitionState")}),t.jsx(Y,{suggestion:r.inStateTuitionState,onAccept:d,onDismiss:h}),re("inStateTuitionState")?t.jsx(W,{suggestion:r.inStateTuitionState?void 0:a.inStateTuitionState,onAccept:v,onDismiss:b}):null]}),ue?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"alternateMailingCountry",onClick:()=>L("alternateMailingCountry"),children:[t.jsxs("label",{className:y("alternateMailingCountry"),children:["Alternate Country ",A("alternateMailingCountry")]}),t.jsx(Q,{value:w("alternateMailingCountry",s.alternateMailingCountry),onChange:g=>K({alternateMailingCountry:g}),options:ce,placeholder:p("buildProfile.personalInfo.select"),searchable:!0,className:u("alternateMailingCountry",""),suppressOpen:N("alternateMailingCountry")}),t.jsx(Y,{suggestion:r.alternateMailingCountry,onAccept:d,onDismiss:h}),re("alternateMailingCountry")?t.jsx(W,{suggestion:r.alternateMailingCountry?void 0:a.alternateMailingCountry,onAccept:v,onDismiss:b}):null,t.jsx(Pt,{field:"alternateMailingCountry"})]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"alternateMailingAddress",children:[t.jsxs("label",{className:y("alternateMailingAddress"),children:["Alternate Address ",A("alternateMailingAddress")]}),t.jsx("input",{type:"text",className:u("alternateMailingAddress",mi),value:w("alternateMailingAddress",s.alternateMailingAddress),onFocus:()=>L("alternateMailingAddress"),onClick:()=>L("alternateMailingAddress"),onChange:g=>K({alternateMailingAddress:g.target.value})}),t.jsx(Y,{suggestion:r.alternateMailingAddress,onAccept:d,onDismiss:h}),re("alternateMailingAddress")?t.jsx(W,{suggestion:r.alternateMailingAddress?void 0:a.alternateMailingAddress,onAccept:v,onDismiss:b}):null,t.jsx(Pt,{field:"alternateMailingAddress"})]})]}):null]})]}),t.jsx(hn,{pendingCount:te,description:"Name details, contact details, languages, and residency context.",reviewFields:["preferredName","middleName","suffix","hasFormerLegalName","formerFirstName","formerMiddleName","formerLastName","preferredPhoneType","preferredPhoneNumber","mobilePhoneNumber","alternatePhoneType","alternatePhoneNumber","languages","citizenship","citizenshipStatus","otherCitizenships","countryOfBirth","cityOfBirth","stateOfBirth","yearsInUnitedStates","hasValidUsVisa","intendsToApplyForNewVisa","currentVisaType","otherVisaType","visaNumber","visaIssueDate"],children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:p("buildProfile.personalInfo.nameDetails")}),t.jsxs("div",{className:"mt-3 space-y-4",children:[t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"preferredName",children:[t.jsx("label",{className:y("preferredName"),children:p("buildProfile.personalInfo.preferredName")}),t.jsx("input",{type:"text",className:u("preferredName"),placeholder:p("buildProfile.personalInfo.preferredNamePlaceholder"),value:w("preferredName",s.preferredName),onFocus:()=>L("preferredName"),onClick:()=>L("preferredName"),onChange:g=>K({preferredName:g.target.value})}),t.jsx(Y,{suggestion:r.preferredName,onAccept:d,onDismiss:h}),re("preferredName")?t.jsx(W,{suggestion:r.preferredName?void 0:a.preferredName,onAccept:v,onDismiss:b}):null,t.jsx(Pt,{field:"preferredName"})]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"middleName",children:[t.jsx("label",{className:y("middleName"),children:p("buildProfile.personalInfo.middleName")}
2),t.jsx("input",{type:"text",className:u("middleName"),placeholder:p("buildProfile.personalInfo.middleNamePlaceholder"),value:w("middleName",s.middleName),onFocus:()=>L("middleName"),onClick:()=>L("middleName"),onChange:g=>K({middleName:g.target.value})}),t.jsx(Y,{suggestion:r.middleName,onAccept:d,onDismiss:h}),re("middleName")?t.jsx(W,{suggestion:r.middleName?void 0:a.middleName,onAccept:v,onDismiss:b}):null,t.jsx(Pt,{field:"middleName"})]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"suffix",onClick:()=>L("suffix"),children:[t.jsx("label",{className:y("suffix"),children:p("buildProfile.personalInfo.suffix")}),t.jsx(Q,{value:w("suffix",s.suffix),onChange:g=>K({suffix:g}),options:_d,placeholder:p("buildProfile.personalInfo.select"),className:u("suffix",""),suppressOpen:N("suffix")}),t.jsx(Y,{suggestion:r.suffix,onAccept:d,onDismiss:h}),re("suffix")?t.jsx(W,{suggestion:r.suffix?void 0:a.suffix,onAccept:v,onDismiss:b}):null,t.jsx(Pt,{field:"suffix"})]})]}),t.jsxs("div",{className:"border-t border-slate-200 pt-4",children:[t.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:p("buildProfile.personalInfo.formerName")}),t.jsx("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"hasFormerLegalName",onClick:()=>L("hasFormerLegalName"),children:[t.jsx("label",{className:y("hasFormerLegalName"),children:p("buildProfile.personalInfo.formerLegalName")}),t.jsx(Q,{value:X,onChange:g=>K({hasFormerLegalName:g,formerFirstName:g==="Yes"?s.formerFirstName:"",formerMiddleName:g==="Yes"?s.formerMiddleName:"",formerLastName:g==="Yes"?s.formerLastName:""}),options:qs,placeholder:p("buildProfile.personalInfo.select"),className:u("hasFormerLegalName",""),suppressOpen:N("hasFormerLegalName")}),t.jsx(Y,{suggestion:r.hasFormerLegalName,onAccept:d,onDismiss:h}),re("hasFormerLegalName")?t.jsx(W,{suggestion:r.hasFormerLegalName?void 0:a.hasFormerLegalName,onAccept:v,onDismiss:b}):null]})}),It?t.jsxs("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"formerFirstName",children:[t.jsx("label",{className:y("formerFirstName"),children:p("buildProfile.personalInfo.formerFirstName")}),t.jsx("input",{type:"text",className:u("formerFirstName"),value:w("formerFirstName",s.formerFirstName),onFocus:()=>L("formerFirstName"),onClick:()=>L("formerFirstName"),onChange:g=>K({formerFirstName:g.target.value})}),t.jsx(Y,{suggestion:r.formerFirstName,onAccept:d,onDismiss:h}),re("formerFirstName")?t.jsx(W,{suggestion:r.formerFirstName?void 0:a.formerFirstName,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"formerMiddleName",children:[t.jsx("label",{className:y("formerMiddleName"),children:p("buildProfile.personalInfo.formerMiddleName")}),t.jsx("input",{type:"text",className:u("formerMiddleName"),value:w("formerMiddleName",s.formerMiddleName),onFocus:()=>L("formerMiddleName"),onClick:()=>L("formerMiddleName"),onChange:g=>K({formerMiddleName:g.target.value})}),t.jsx(Y,{suggestion:r.formerMiddleName,onAccept:d,onDismiss:h}),re("formerMiddleName")?t.jsx(W,{suggestion:r.formerMiddleName?void 0:a.formerMiddleName,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"formerLastName",children:[t.jsx("label",{className:y("formerLastName"),children:p("buildProfile.personalInfo.formerLastName")}),t.jsx("input",{type:"text",className:u("formerLastName"),value:w("formerLastName",s.formerLastName),onFocus:()=>L("formerLastName"),onClick:()=>L("formerLastName"),onChange:g=>K({formerLastName:g.target.value})}),t.jsx(Y,{suggestion:r.formerLastName,onAccept:d,onDismiss:h}),re("formerLastName")?t.jsx(W,{suggestion:r.formerLastName?void 0:a.formerLastName,onAccept:v,onDismiss:b}):null]})]}):null]})]})]}),t.jsxs("div",{className:"border-t border-slate-200 pt-4",children:[t.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:p("buildProfile.personalInfo.contact")}),t.jsx("div",{className:"mt-3 max-w-xl",children:t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"mobilePhoneNumber",children:[t.jsx("label",{htmlFor:"profile-mobile-phone",className:y("mobilePhoneNumber"),children:p("buildProfile.personalInfo.mobilePhoneNumber")}),t.jsx(Pt,{field:"mobilePhoneNumber",label:p("buildProfile.personalInfo.mobilePhoneNumber")}),t.jsx("input",{id:"profile-mobile-phone",type:"tel",maxLength:64,"aria-describedby":"profile-mobile-phone-help",className:u("mobilePhoneNumber"),placeholder:p("buildProfile.personalInfo.mobilePhoneNumberPlaceholder"),value:w("mobilePhoneNumber",s.mobilePhoneNumber),onFocus:()=>L("mobilePhoneNumber"),onClick:()=>L("mobilePhoneNumber"),onChange:g=>K({mobilePhoneNumber:g.target.value})}),t.jsx("p",{id:"profile-mobile-phone-help",className:"mt-1 text-xs text-slate-500",children:p("buildProfile.personalInfo.mobilePhoneHelp")}),t.jsx(Y,{suggestion:r.mobilePhoneNumber,onAccept:d,onDismiss:h}),re("mobilePhoneNumber")?t.jsx(W,{suggestion:r.mobilePhoneNumber?void 0:a.mobilePhoneNumber,onAccept:v,onDismiss:b}):null]})}),t.jsxs("div",{className:"mt-3 grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"preferredPhoneType",onClick:()=>L("preferredPhoneType"),children:[t.jsx("label",{className:y("preferredPhoneType"),children:p("buildProfile.personalInfo.preferredPhoneType")}),t.jsx(Q,{value:w("preferredPhoneType",s.preferredPhoneType),onChange:g=>K({preferredPhoneType:g}),options:fi,placeholder:p("buildProfile.personalInfo.select"),className:u("preferredPhoneType",""),suppressOpen:N("preferredPhoneType")}),t.jsx(Y,{suggestion:r.preferredPhoneType,onAccept:d,onDismiss:h}),re("preferredPhoneType")?t.jsx(W,{suggestion:r.preferredPhoneType?void 0:a.preferredPhoneType,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"preferredPhoneNumber",children:[t.jsx("label",{className:y("preferredPhoneNumber"),children:p("buildProfile.personalInfo.preferredPhoneNumber")}),t.jsx("input",{type:"text",className:u("preferredPhoneNumber"),placeholder:p("buildProfile.personalInfo.preferredPhoneNumberPlaceholder"),value:w("preferredPhoneNumber",s.preferredPhoneNumber),onFocus:()=>L("preferredPhoneNumber"),onClick:()=>L("preferredPhoneNumber"),onChange:g=>K({preferredPhoneNumber:g.target.value})}),t.jsx(Y,{suggestion:r.preferredPhoneNumber,onAccept:d,onDismiss:h}),re("preferredPhoneNumber")?t.jsx(W,{suggestion:r.preferredPhoneNumber?void 0:a.preferredPhoneNumber,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"alternatePhoneType",onClick:()=>L("alternatePhoneType"),children:[t.jsx("label",{className:y("alternatePhoneType"),children:p("buildProfile.personalInfo.alternatePhoneType")}),t.jsx(Q,{value:w("alternatePhoneType",s.alternatePhoneType),onChange:g=>K({alternatePhoneType:g}),options:fi,placeholder:p("buildProfile.personalInfo.select"),className:u("alternatePhoneType",""),suppressOpen:N("alternatePhoneType")}),t.jsx(Y,{suggestion:r.alternatePhoneType,onAccept:d,onDismiss:h}),re("alternatePhoneType")?t.jsx(W,{suggestion:r.alternatePhoneType?void 0:a.alternatePhoneType,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"alternatePhoneNumber",children:[t.jsx("label",{className:y("alternatePhoneNumber"),children:p("buildProfile.personalInfo.alternatePhoneNumber")}),t.jsx("input",{type:"text",className:u("alternatePhoneNumber"),placeholder:p("buildProfile.personalInfo.alternatePhoneNumberPlaceholder"),value:w("alternatePhoneNumber",s.alternatePhoneNumber),onFocus:()=>L("alternatePhoneNumber"),onClick:()=>L("alternatePhoneNumber"),onChange:g=>K({alternatePhoneNumber:g.target.value})}),t.jsx(Y,{suggestion:r.alternatePhoneNumber,onAccept:d,onDismiss:h}),re("alternatePhoneNumber")?t.jsx(W,{suggestion:r.alternatePhoneNumber?void 0:a.alternatePhoneNumber,onAccept:v,onDismiss:b}):null]})]})]}),t.jsxs("div",{className:"border-t border-slate-200 pt-4","data-review-field":"languages",children:[t.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:p("buildProfile.personalInfo.languages")}),t.jsx("p",{className:"mt-1 text-sm text-slate-500",children:p("buildProfile.personalInfo.languagesDescription")})]}),s.languages.length>0&&s.languages.length<hi?t.jsxs("button",{type:"button",onClick:Ce,className:"inline-flex items-center gap-1.5 rounded-xl border border-slate-200 bg-white px-3 py-1.5 text-sm font-medium text-slate-700 shadow-sm transition hover:bg-slate-50",children:[t.jsx(qe,{size:14}),p("buildProfile.personalInfo.addLanguage")]}):null]}),l.length>0&&d&&h?t.jsx(_s,{suggestions:l,onAccept:d,onDismiss:h}
2):null,s.languages.length===0?t.jsxs("div",{className:"rounded-xl border border-dashed border-slate-200 px-6 py-6 text-center",children:[t.jsx("p",{className:"text-sm text-slate-500",children:p("buildProfile.personalInfo.noLanguage")}),t.jsxs("button",{type:"button",onClick:Ce,className:"mt-3 inline-flex items-center gap-1.5 rounded-xl bg-[#16335F] px-4 py-2 text-sm font-medium text-white shadow-sm transition hover:bg-[#1a3d72]",children:[t.jsx(qe,{size:16}),p("buildProfile.personalInfo.addLanguage")]})]}):t.jsx("div",{className:"space-y-3",children:s.languages.map((g,Ne)=>t.jsxs("div",{className:"rounded-[16px] border border-slate-200 bg-slate-50/60 p-4",children:[t.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[t.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-[#16335F] text-[11px] font-bold text-white",children:Ne+1}),t.jsx("h4",{className:"flex-1 text-[13px] font-bold tracking-wide text-slate-700",children:p("buildProfile.personalInfo.language")}),t.jsx(He,{onConfirm:()=>k(g.id),size:16})]}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:Ks,children:p("buildProfile.personalInfo.language")}),t.jsx(Q,{value:g.language,onChange:me=>xe(g.id,{language:me,otherLanguageName:me==="Other"?g.otherLanguageName:""}),options:zd,placeholder:p("buildProfile.personalInfo.select"),searchable:!0})]}),g.language==="Other"?t.jsxs("div",{children:[t.jsx("label",{className:Ks,children:p("buildProfile.personalInfo.otherLanguageName")}),t.jsx("input",{type:"text",className:ui,value:g.otherLanguageName,onChange:me=>xe(g.id,{otherLanguageName:me.target.value})})]}):null,t.jsxs("div",{children:[t.jsx("label",{className:Ks,children:p("buildProfile.personalInfo.proficiency")}),t.jsx(Q,{value:g.proficiency,onChange:me=>xe(g.id,{proficiency:me}),options:Bd,placeholder:p("buildProfile.personalInfo.select")})]})]})]},g.id))})]}),t.jsxs("div",{className:"border-t border-slate-200 pt-4",children:[t.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:p("buildProfile.personalInfo.citizenshipResidency")}),t.jsxs("div",{className:"mt-3 space-y-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:p("buildProfile.personalInfo.citizenship")}),t.jsxs("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"citizenship",onClick:()=>L("citizenship"),children:[t.jsx("label",{className:y("citizenship"),children:p("buildProfile.personalInfo.countryOfCitizenship")}),t.jsx(Q,{value:e.citizenship,onChange:g=>o("citizenship",g),options:ee,placeholder:p("buildProfile.personalInfo.select"),searchable:!0,className:u("citizenship",""),suppressOpen:N("citizenship")}),t.jsx(Y,{suggestion:r.citizenship,onAccept:d,onDismiss:h}),re("citizenship")?t.jsx(W,{suggestion:r.citizenship?void 0:a.citizenship,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"citizenshipStatus",onClick:()=>L("citizenshipStatus"),children:[t.jsx("label",{className:y("citizenshipStatus"),children:p("buildProfile.personalInfo.citizenshipStatus")}),t.jsx(Q,{value:oe,onChange:g=>K({citizenshipStatus:g,otherCitizenships:["U.S. Dual Citizen","U.S. Permanent Resident","Non-U.S. Citizen"].includes(g)?s.otherCitizenships:"",hasValidUsVisa:g==="Non-U.S. Citizen"?s.hasValidUsVisa:"",currentVisaType:g==="Non-U.S. Citizen"?s.currentVisaType:"",otherVisaType:g==="Non-U.S. Citizen"?s.otherVisaType:"",visaNumber:g==="Non-U.S. Citizen"?s.visaNumber:"",visaIssueDate:g==="Non-U.S. Citizen"?s.visaIssueDate:"",intendsToApplyForNewVisa:g==="Non-U.S. Citizen"?s.intendsToApplyForNewVisa:""}),options:Rd,placeholder:p("buildProfile.personalInfo.select"),className:u("citizenshipStatus",""),suppressOpen:N("citizenshipStatus")}),t.jsx(Y,{suggestion:r.citizenshipStatus,onAccept:d,onDismiss:h}),re("citizenshipStatus")?t.jsx(W,{suggestion:r.citizenshipStatus?void 0:a.citizenshipStatus,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30 sm:col-span-2","data-review-field":"commonAppFeeWaiverEligible",onClick:()=>L("commonAppFeeWaiverEligible"),children:[t.jsx("label",{className:y("commonAppFeeWaiverEligible"),children:p("buildProfile.personalInfo.commonAppFeeWaiverEligible")}),t.jsx(Q,{value:je,onChange:g=>K({commonAppFeeWaiverEligible:g}),options:qs,placeholder:p("buildProfile.personalInfo.select"),className:u("commonAppFeeWaiverEligible",""),suppressOpen:N("commonAppFeeWaiverEligible")}),t.jsx(Y,{suggestion:r.commonAppFeeWaiverEligible,onAccept:d,onDismiss:h}),re("commonAppFeeWaiverEligible")?t.jsx(W,{suggestion:r.commonAppFeeWaiverEligible?void 0:a.commonAppFeeWaiverEligible,onAccept:v,onDismiss:b}):null]}),Ue?t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"otherCitizenships",children:[t.jsx("label",{className:y("otherCitizenships"),children:p("buildProfile.personalInfo.otherCitizenships")}),t.jsx("input",{type:"text",className:u("otherCitizenships"),placeholder:p("buildProfile.personalInfo.otherCitizenshipsPlaceholder"),value:w("otherCitizenships",s.otherCitizenships),onFocus:()=>L("otherCitizenships"),onClick:()=>L("otherCitizenships"),onChange:g=>K({otherCitizenships:g.target.value})}),t.jsx(Y,{suggestion:r.otherCitizenships,onAccept:d,onDismiss:h}),re("otherCitizenships")?t.jsx(W,{suggestion:r.otherCitizenships?void 0:a.otherCitizenships,onAccept:v,onDismiss:b}):null]}):null]})]}),t.jsxs("div",{className:"border-t border-slate-200 pt-4",children:[t.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:p("buildProfile.personalInfo.birthResidency")}),t.jsxs("div",{className:"mt-3 grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"countryOfBirth",onClick:()=>
2L("countryOfBirth"),children:[t.jsx("label",{className:y("countryOfBirth"),children:p("buildProfile.personalInfo.countryOfBirth")}),t.jsx(Q,{value:w("countryOfBirth",s.countryOfBirth),onChange:g=>K({countryOfBirth:g}),options:ce,placeholder:p("buildProfile.personalInfo.select"),searchable:!0,className:u("countryOfBirth",""),suppressOpen:N("countryOfBirth")}),t.jsx(Y,{suggestion:r.countryOfBirth,onAccept:d,onDismiss:h}),re("countryOfBirth")?t.jsx(W,{suggestion:r.countryOfBirth?void 0:a.countryOfBirth,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"cityOfBirth",children:[t.jsx("label",{className:y("cityOfBirth"),children:p("buildProfile.personalInfo.cityOfBirth")}),t.jsx("input",{type:"text",className:u("cityOfBirth"),value:w("cityOfBirth",s.cityOfBirth),onFocus:()=>L("cityOfBirth"),onClick:()=>L("cityOfBirth"),onChange:g=>K({cityOfBirth:g.target.value})}),t.jsx(Y,{suggestion:r.cityOfBirth,onAccept:d,onDismiss:h}),re("cityOfBirth")?t.jsx(W,{suggestion:r.cityOfBirth?void 0:a.cityOfBirth,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"stateOfBirth",children:[t.jsx("label",{className:y("stateOfBirth"),children:p("buildProfile.personalInfo.stateOfBirth")}),t.jsx("input",{type:"text",className:u("stateOfBirth"),value:w("stateOfBirth",s.stateOfBirth),onFocus:()=>L("stateOfBirth"),onClick:()=>L("stateOfBirth"),onChange:g=>K({stateOfBirth:g.target.value})}),t.jsx(Y,{suggestion:r.stateOfBirth,onAccept:d,onDismiss:h}),re("stateOfBirth")?t.jsx(W,{suggestion:r.stateOfBirth?void 0:a.stateOfBirth,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"yearsInUnitedStates",children:[t.jsx("label",{className:y("yearsInUnitedStates"),children:p("buildProfile.personalInfo.yearsInUs")}),t.jsx("input",{type:"number",min:0,className:u("yearsInUnitedStates"),placeholder:"0",value:w("yearsInUnitedStates",s.yearsInUnitedStates),onFocus:()=>L("yearsInUnitedStates"),onClick:()=>L("yearsInUnitedStates"),onChange:g=>K({yearsInUnitedStates:g.target.value})}),t.jsx(Y,{suggestion:r.yearsInUnitedStates,onAccept:d,onDismiss:h}),re("yearsInUnitedStates")?t.jsx(W,{suggestion:r.yearsInUnitedStates?void 0:a.yearsInUnitedStates,onAccept:v,onDismiss:b}):null]}),ze?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"hasValidUsVisa",onClick:()=>L("hasValidUsVisa"),children:[t.jsx("label",{className:y("hasValidUsVisa"),children:p("buildProfile.personalInfo.hasValidUsVisa")}),t.jsx(Q,{value:jt,onChange:g=>K({hasValidUsVisa:g,currentVisaType:g==="Yes"?s.currentVisaType:"",otherVisaType:g==="Yes"?s.otherVisaType:"",visaNumber:g==="Yes"?s.visaNumber:"",visaIssueDate:g==="Yes"?s.visaIssueDate:""}),options:qs,placeholder:p("buildProfile.personalInfo.select"),className:u("hasValidUsVisa",""),suppressOpen:N("hasValidUsVisa")}),t.jsx(Y,{suggestion:r.hasValidUsVisa,onAccept:d,onDismiss:h}),re("hasValidUsVisa")?t.jsx(W,{suggestion:r.hasValidUsVisa?void 0:a.hasValidUsVisa,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"intendsToApplyForNewVisa",onClick:()=>L("intendsToApplyForNewVisa"),children:[t.jsx("label",{className:y("intendsToApplyForNewVisa"),children:p("buildProfile.personalInfo.intendsNewVisa")}),t.jsx(Q,{value:w("intendsToApplyForNewVisa",s.intendsToApplyForNewVisa),onChange:g=>K({intendsToApplyForNewVisa:g}),options:qs,placeholder:p("buildProfile.personalInfo.select"),className:u("intendsToApplyForNewVisa",""),suppressOpen:N("intendsToApplyForNewVisa")}),t.jsx(Y,{suggestion:r.intendsToApplyForNewVisa,onAccept:d,onDismiss:h}),re("intendsToApplyForNewVisa")?t.jsx(W,{suggestion:r.intendsToApplyForNewVisa?void 0:a.intendsToApplyForNewVisa,onAccept:v,onDismiss:b}):null]}),be?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"currentVisaType",onClick:()=>L("currentVisaType"),children:[t.jsx("label",{className:y("currentVisaType"),children:p("buildProfile.personalInfo.currentVisaType")}),t.jsx(Q,{value:ct,onChange:g=>K({currentVisaType:g,otherVisaType:g==="Other"?s.otherVisaType:""}),options:Ld,placeholder:p("buildProfile.personalInfo.select"),className:u("currentVisaType",""),suppressOpen:N("currentVisaType")}),t.jsx(Y,{suggestion:r.currentVisaType,onAccept:d,onDismiss:h}),re("currentVisaType")?t.jsx(W,{suggestion:r.currentVisaType?void 0:a.currentVisaType,onAccept:v,onDismiss:b}):null]}),P?t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"otherVisaType",children:[t.jsx("label",{className:y("otherVisaType"),children:p("buildProfile.personalInfo.otherVisaType")}),t.jsx("input",{type:"text",className:u("otherVisaType"),value:w("otherVisaType",s.otherVisaType),onFocus:()=>L("otherVisaType"),onClick:()=>L("otherVisaType"),onChange:g=>K({otherVisaType:g.target.value})}),t.jsx(Y,{suggestion:r.otherVisaType,onAccept:d,onDismiss:h}),re("otherVisaType")?t.jsx(W,{suggestion:r.otherVisaType?void 0:a.otherVisaType,onAccept:v,onDismiss:b}):null]}):null,t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"visaNumber",children:[t.jsx("label",{className:y("visaNumber"),children:p("buildProfile.personalInfo.visaNumber")}),t.jsx("input",{type:"text",className:u("visaNumber"),value:w("visaNumber",s.visaNumber),onFocus:()=>L("visaNumber"),onClick:()=>L("visaNumber"),onChange:g=>K({visaNumber:g.target.value})}),t.jsx(Y,{suggestion:r.visaNumber,onAccept:d,onDismiss:h}),re("visaNumber")?t.jsx(W,{suggestion:r.visaNumber?void 0:a.visaNumber,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"visaIssueDate",onClick:()=>L("visaIssueDate"),children:[t.jsx("label",{className:y("visaIssueDate"),children:p("buildProfile.personalInfo.visaIssueDate")}),t.jsx(Le,{value:w("visaIssueDate",s.visaIssueDate),onChange:g=>K({visaIssueDate:g}),placeholder:p("buildProfile.personalInfo.selectDate"),buttonClassName:u("visaIssueDate","")}),t.jsx(Y,{suggestion:r.visaIssueDate,onAccept:d,onDismiss:h}),re("visaIssueDate")?t.jsx(W,{suggestion:r.visaIssueDate?void 0:a.visaIssueDate,onAccept:v,onDismiss:b}):null]})]}):null]}):null]})]})]})]})]})})]})]})}const rs="mt-1.5 w-full rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-sm text-slate-800 shadow-sm transition placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-[#16335F]",Qe="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500",Kd=[{value:"",label:""},"Parent","Mother","Father","Step-parent","Legal Guardian","Grandparent","Other"],qd=[{value:"",label:""},"Living","Deceased","Unknown"],Hd=[{value:"",label:""},"Mobile","Home","Work","Other"],Gd=[{value:"",label:""},"Employed","Self-employed","Retired","Not employed","Unknown"],Yd=[{value:"",label:""},"Did not attend college","Some college","Associate degree","Bachelor degree","Master degree","Doctorate or professional degree","Unknown"],Wd=[{value:"",label:""},"Yes","No"],Jd=[{value:"",label:""},"Married","Separated","Divorced","Single","Widowed","Never married","Other"],Qd=[{value:"",label:""},"Both parents","Parent 1","Parent 2","Legal guardian","Shared equally","Other"],Xd=["parentsMaritalStatus","homeWith"],pi=3;function Zd(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function eu(){return{id:Zd(),relation:"",livingStatus:"",firstName:"",lastName:"",email:"",ph
2oneType:"",phoneNumber:"",occupation:"",employmentStatus:"",employer:"",highestEducation:"",collegeUniversityAffiliation:""}}const mt=(e,s,r)=>({...e,contacts:e.contacts.map(a=>a.id===s?{...a,...r}:a)});function tu({profile:e,pendingSuggestions:s=[],pendingFields:r={},reviewFields:a={},autoFillLoading:n,pendingCount:l=0,onAcceptPendingSuggestion:o,onDismissPendingSuggestion:f,onAcceptReviewSuggestion:S,onDismissReviewSuggestion:j,onChange:C}){const{t:d}=Te(),[h,v]=c.useState(null),b=c.useRef(null),p=c.useRef(""),z=c.useRef(!1),H=k=>({pending:r[k],review:r[k]?void 0:a[k]}),Z=(k,I=rs)=>{const{pending:u,review:y}=H(k);return u?Is(I,!0):lr(I,!!y)},G=k=>{const{pending:I,review:u}=H(k);return I?ks(Qe,!0):or(Qe,!!u)},B=k=>{const{pending:I,review:u}=H(k);return!I&&!!u&&h!==k},U=(k,I)=>{const u=r[k];return u?String(u.suggestedValue??""):I},q=Object.keys(a).filter(k=>{const{pending:I,review:u}=H(k);return!I&&!!u}),ee=Xd.find(k=>q.includes(k))??null??q[0]??null,ne=q.map(k=>{var I;return`${String(k)}:${((I=a[k])==null?void 0:I.suggestionId)??""}`}).join("|"),ie=k=>{const{pending:I,review:u}=H(k);if(!I&&u){v(k);return}v(y=>y===k?null:y)},K=k=>{const{pending:I,review:u}=H(k);return!I&&!!u&&h===k};c.useEffect(()=>{if(!ee||!ne){p.current="";return}p.current!==ne&&(v(ee),p.current=ne)},[ee,ne]),c.useEffect(()=>{const k=z.current&&!n;z.current=!!n,!(!k||!ee)&&v(ee)},[ee,n]),c.useEffect(()=>{if(!h)return;const k=I=>{const u=b.current,y=I.target;if(!u||!y)return;const A=u.querySelector(`[data-review-field="${h}"]`);A!=null&&A.contains(y)||v(null)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[h]);const Ce=c.useCallback(()=>{e.contacts.length>=pi||C({...e,contacts:[...e.contacts,eu()]})},[C,e]),xe=c.useCallback(k=>{C({...e,contacts:e.contacts.filter(I=>I.id!==k)})},[C,e]);return t.jsxs("section",{ref:b,className:"rounded-2xl bg-white p-6 shadow-sm ring-1 ring-black/5",children:[t.jsx(us,{id:"section-family",title:d("buildProfile.sections.family"),pendingCount:l}),s.length>0&&o&&f?t.jsx(_s,{suggestions:s,onAccept:o,onDismiss:f}):null,t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"rounded-[18px] border border-slate-200 bg-slate-50/60 p-4",children:[t.jsx("div",{className:"mb-3",children:t.jsx("h3",{className:"text-[13px] font-bold tracking-wide text-slate-700",children:d("buildProfile.family.household")})}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"parentsMaritalStatus",onClick:()=>ie("parentsMaritalStatus"),children:[t.jsx("label",{className:G("parentsMaritalStatus"),children:d("buildProfile.family.parentsMaritalStatus")}),t.jsx(Q,{value:U("parentsMaritalStatus",e.parentsMaritalStatus),onChange:k=>C({...e,parentsMaritalStatus:k}),options:Jd,placeholder:d("buildProfile.personalInfo.select"),className:Z("parentsMaritalStatus",""),suppressOpen:B("parentsMaritalStatus")}),t.jsx(Y,{suggestion:r.parentsMaritalStatus,onAccept:o,onDismiss:f}),K("parentsMaritalStatus")?t.jsx(W,{suggestion:r.parentsMaritalStatus?void 0:a.parentsMaritalStatus,onAccept:S,onDismiss:j}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"homeWith",onClick:()=>ie("homeWith"),children:[t.jsx("label",{className:G("homeWith"),children:d("buildProfile.family.permanentHomeWith")}),t.jsx(Q,{value:U("homeWith",e.homeWith),onChange:k=>C({...e,homeWith:k}),options:Qd,placeholder:d("buildProfile.personalInfo.select"),className:Z("homeWith",""),suppressOpen:B("homeWith")}),t.jsx(Y,{suggestion:r.homeWith,onAccept:o,onDismiss:f}),K("homeWith")?t.jsx(W,{suggestion:r.homeWith?void 0:a.homeWith,onAccept:S,onDismiss:j}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"siblingsCount",children:[t.jsx("label",{className:G("siblingsCount"),children:d("buildProfile.family.numberOfSiblings")}),t.jsx("input",{type:"number",min:0,className:Z("siblingsCount"),placeholder:"0",value:U("siblingsCount",e.siblingsCount),onFocus:()=>ie("siblingsCount"),onClick:()=>ie("siblingsCount"),onChange:k=>C({...e,siblingsCount:k.target.value})}),t.jsx(Y,{suggestion:r.siblingsCount,onAccept:o,onDismiss:f}),K("siblingsCount")?t.jsx(W,{suggestion:r.siblingsCount?void 0:a.siblingsCount,onAccept:S,onDismiss:j}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"childrenCount",children:[t.jsx("label",{className:G("childrenCount"),children:d("buildProfile.family.hasChildren")}),t.jsx("input",{type:"number",min:0,className:Z("childrenCount"),placeholder:"0",value:U("childrenCount",e.childrenCount),onFocus:()=>ie("childrenCount"),onClick:()=>ie("childrenCount"),onChange:k=>C({...e,childrenCount:k.target.value})}),t.jsx(Y,{suggestion:r.childrenCount,onAccept:o,onDismiss:f}),K("childrenCount")?t.jsx(W,{suggestion:r.childrenCount?void 0:a.childrenCount,onAccept:S,onDismiss:j}):null]})]})]}),e.contacts.length===0?t.jsxs("div",{className:"rounded-xl border border-dashed border-slate-200 px-6 py-8 text-center",children:[t.jsx("p",{className:"text-sm text-slate-500",children:d("buildProfile.family.emptyState")}),t.jsxs("button",{type:"button",onClick:Ce,className:"mt-3 inline-flex items-center gap-1.5 rounded-xl bg-[#16335F] px-4 py-2 text-sm font-medium text-white shadow-sm transition hover:bg-[#1a3d72]",children:[t.jsx(qe,{size:16}),d("buildProfile.family.addParentGuardian")]})]}):null,e.contacts.length>0&&t.jsx("div",{className:"space-y-3",children:e.contacts.map((k,I)=>t.jsxs("div",{className:"rounded-[18px] border border-slate-200 bg-white p-4 shadow-sm",children:[t.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[t.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-[#16335F] text-[11px] font-bold text-white",children:I+1}),t.jsx("h3",{className:"flex-1 text-[13px] font-bold tracking-wide text-slate-700",children:d("buildProfile.family.parentGuardian")}),t.jsx(He,{onConfirm:()=>xe(k.id),size:16})]}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:Qe,children:d("buildProfile.family.relationship")}),t.jsx(Q,{value:k.relation,onChange:u=>C(mt(e,k.id,{relation:u})),options:Kd,placeholder:d("buildProfile.personalInfo.select")})]}),t.jsxs("div",{children:[t.jsx("label",{className:Qe,children:d("buildProfile.family.livingStatus")}),t.jsx(Q,{value:k.livingStatus,onChange:u=>C(mt(e,k.id,{livingStatus:u})),options:qd,placeholder:d("buildProfile.personalInfo.select")})]}),t.jsxs("div",{children:[t.jsx("label",{className:Qe,children:d("buildProfile.family.highe
2stEducation")}),t.jsx(Q,{value:k.highestEducation,onChange:u=>C(mt(e,k.id,{highestEducation:u})),options:Yd,placeholder:d("buildProfile.personalInfo.select")})]}),t.jsxs("div",{children:[t.jsx("label",{className:Qe,children:d("buildProfile.personalInfo.firstName")}),t.jsx("input",{type:"text",className:rs,placeholder:d("buildProfile.personalInfo.firstNamePlaceholder"),value:k.firstName,onChange:u=>C(mt(e,k.id,{firstName:u.target.value}))})]}),t.jsxs("div",{children:[t.jsx("label",{className:Qe,children:d("buildProfile.personalInfo.lastName")}),t.jsx("input",{type:"text",className:rs,placeholder:d("buildProfile.personalInfo.lastNamePlaceholder"),value:k.lastName,onChange:u=>C(mt(e,k.id,{lastName:u.target.value}))})]}),t.jsxs("div",{children:[t.jsx("label",{className:Qe,children:d("buildProfile.family.email")}),t.jsx("input",{type:"email",className:rs,placeholder:d("buildProfile.family.emailPlaceholder"),value:k.email,onChange:u=>C(mt(e,k.id,{email:u.target.value}))})]}),t.jsxs("div",{children:[t.jsx("label",{className:Qe,children:d("buildProfile.family.phoneType")}),t.jsx(Q,{value:k.phoneType,onChange:u=>C(mt(e,k.id,{phoneType:u})),options:Hd,placeholder:d("buildProfile.personalInfo.select")})]}),t.jsxs("div",{children:[t.jsx("label",{className:Qe,children:d("buildProfile.family.phoneNumber")}),t.jsx("input",{type:"tel",className:rs,placeholder:"(555) 555-5555",value:k.phoneNumber,onChange:u=>C(mt(e,k.id,{phoneNumber:u.target.value}))})]}),t.jsxs("div",{children:[t.jsx("label",{className:Qe,children:d("buildProfile.family.employmentStatus")}),t.jsx(Q,{value:k.employmentStatus,onChange:u=>C(mt(e,k.id,{employmentStatus:u})),options:Gd,placeholder:d("buildProfile.personalInfo.select")})]}),t.jsxs("div",{children:[t.jsx("label",{className:Qe,children:d("buildProfile.family.occupation")}),t.jsx("input",{type:"text",className:rs,placeholder:d("buildProfile.family.occupationPlaceholder"),value:k.occupation,onChange:u=>C(mt(e,k.id,{occupation:u.target.value}))})]}),t.jsxs("div",{children:[t.jsx("label",{className:Qe,children:d("buildProfile.family.employer")}),t.jsx("input",{type:"text",className:rs,placeholder:d("buildProfile.family.employerPlaceholder"),value:k.employer,onChange:u=>C(mt(e,k.id,{employer:u.target.value}))})]}),t.jsxs("div",{children:[t.jsx("label",{className:Qe,children:d("buildProfile.family.collegeUniversityEmployer")}),t.jsx(Q,{value:k.collegeUniversityAffiliation,onChange:u=>C(mt(e,k.id,{collegeUniversityAffiliation:u})),options:Wd,placeholder:d("buildProfile.personalInfo.select")})]})]})]},k.id))}),e.contacts.length>0&&e.contacts.length<pi?t.jsxs("button",{type:"button",onClick:Ce,className:"inline-flex items-center gap-1.5 rounded-xl border border-slate-200 bg-white px-4 py-2 text-sm font-medium text-slate-700 shadow-sm transition hover:bg-slate-50",children:[t.jsx(qe,{size:16}),d("buildProfile.family.addParentGuardian")]}):null]})]})}const yt="mt-1.5 w-full rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-sm text-slate-800 shadow-sm transition placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-[#16335F]",Ye="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500",su=["currentSchoolEntryDate","boardingSchool","livesOnCampus","willGraduate","graduationDate","schoolProgressionContext","hasCollegeCoursework","schedulingSystem","applicantDescription","highestDegreeIntended","careerInterest","otherCareerInterest"],ru=["grade","classYear","route","gpaScale","boardingSchool","willGraduate","livesOnCampus","schedulingSystem","hasCollegeCoursework","applicantDescription","highestDegreeIntended","careerInterest"],kr=[{value:"",label:""},"Yes","No"],au=[{value:"",label:""},"First-year student","Transfer student","Gap year student","Home-schooled student","Other"],nu=[{value:"",label:""},"Bachelor degree","Associate degree","Certificate","Master degree","Doctorate or professional degree","Undecided"],iu=[{value:"",label:""},"Arts and media","Business","Computer science","Education","Engineering","Health professions","Law and public service","Science and research","Social sciences","Other"],lu=[{value:"",label:""},"Semester","Trimester","Quarter","Block schedule","Full year","Other"],ou=[{value:"",label:""},"English","Math","Science","History / Social Science","World Language","Arts","Computer Science","Elective","Other"],cu=[{value:"",label:""},"Regular","Honors","Accelerated","AP","IB","Dual Enrollment","College Prep","Other"],du=[{value:"",label:""},"Full Year","Semester 1","Semester 2","Trimester","Quarter","Block","Other"],uu=[{value:"",label:""},"No degree earned","Certificate","Associate degree","Bachelor degree","Other"];function pn(e){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`${e}-${crypto.randomUUID()}`:`${e}-${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function mu(){return{id:pn("secondary-school"),schoolName:"",fromDate:"",toDate:"",reasonForLeaving:""}}
2function hu(){return{id:pn("college-coursework"),collegeName:"",fromDate:"",toDate:"",degreeEarned:"",courseDetails:""}}function fu(){return{id:pn("current-course"),subject:"",title:"",level:"",schedule:""}}function pu({profile:e,educationExtension:s,pendingFields:r={},reviewFields:a={},missingFields:n,pendingSuggestions:l=[],onChange:o,onEducationExtensionChange:f,onAutoFill:S,autoFillLoading:j,pendingCount:C=0,onAcceptPendingSuggestion:d,onDismissPendingSuggestion:h,onAcceptReviewSuggestion:v,onDismissReviewSuggestion:b}){const[p,z]=c.useState(null),H=c.useRef(null),Z=c.useRef(""),G=c.useRef(!1),B=c.useMemo(()=>Lc(e.classYear),[e.classYear]),U=c.useCallback(P=>{f({...s,...P})},[s,f]),q=c.useCallback(()=>{s.otherSecondarySchools.length>=sr||U({otherSecondarySchools:[...s.otherSecondarySchools,mu()]})},[s.otherSecondarySchools,U]),ce=c.useCallback((P,te)=>{U({otherSecondarySchools:s.otherSecondarySchools.map(_=>_.id===P?{..._,...te}:_)})},[s.otherSecondarySchools,U]),ee=c.useCallback(P=>{U({otherSecondarySchools:s.otherSecondarySchools.filter(te=>te.id!==P)})},[s.otherSecondarySchools,U]),ne=c.useCallback(()=>{s.collegeCoursework.length>=rr||U({collegeCoursework:[...s.collegeCoursework,hu()]})},[s.collegeCoursework,U]),ie=c.useCallback((P,te)=>{U({collegeCoursework:s.collegeCoursework.map(_=>_.id===P?{..._,...te}:_)})},[s.collegeCoursework,U]),K=c.useCallback(P=>{U({collegeCoursework:s.collegeCoursework.filter(te=>te.id!==P)})},[s.collegeCoursework,U]),Ce=c.useCallback(()=>{s.currentCourses.length>=ar||U({currentCourses:[...s.currentCourses,fu()]})},[s.currentCourses,U]),xe=c.useCallback((P,te)=>{U({currentCourses:s.currentCourses.map(_=>_.id===P?{..._,...te}:_)})},[s.currentCourses,U]),k=c.useCallback(P=>{U({currentCourses:s.currentCourses.filter(te=>te.id!==P)})},[s.currentCourses,U]),I=P=>({pending:r[P],review:r[P]?void 0:a[P]}),u=P=>{const{pending:te,review:_}=I(P),we=te?Is(yt,!0):lr(yt,!!_);return n!=null&&n.has(P)?`${we} border-rose-300 bg-rose-50 ring-2 ring-rose-200 focus:ring-rose-500`:we},y=P=>{const{pending:te,review:_}=I(P),we=te?ks(Ye,!0):or(Ye,!!_);return n!=null&&n.has(P)?`${we} text-rose-600`:we},A=P=>Xi(P,e)?t.jsx("span",{className:"text-red-500",children:"*"}):null,N=P=>{const{pending:te,review:_}=I(P);return!te&&!!_&&p!==P},w=(P,te)=>{const _=r[P];return _?String(_.suggestedValue??""):te},X=w("boardingSchool",s.boardingSchool),E=w("willGraduate",s.willGraduate),oe=w("hasCollegeCoursework",s.hasCollegeCoursework),je=w("careerInterest",s.careerInterest),Ie=!!(n!=null&&n.has("grade")),Ae=!!(n!=null&&n.has("classYear")),pt=Ie?"build-profile-grade-required-error":void 0,jt=Ae?"build-profile-class-year-required-error":void 0,ct=su.reduce((P,te)=>{const{pending:_,review:we}=I(te);return P+(_||we?1:0)},0),It=Object.keys(a).filter(P=>{const{pending:te,review:_}=I(P);return!te&&!!_}),Ue=ru.find(P=>It.includes(P))??null??It[0]??null,ze=It.map(P=>{var te;return`${String(P)}:${((te=a[P])==null?void 0:te.suggestionId)??""}`}).join("|"),ue=P=>{const{pending:te,review:_}=I(P);if(!te&&_){z(P);return}z(we=>we===P?null:we)},be=P=>{const{pending:te,review:_}=I(P);return!te&&!!_&&p===P};return c.useEffect(()=>{if(!Ue||!ze){Z.current="";return}Z.current!==ze&&(z(Ue),Z.current=ze)},[Ue,ze]),c.useEffect(()=>{const P=G.current&&!j;G.current=!!j,!(!P||!Ue)&&z(Ue)},[Ue,j]),c.useEffect(()=>{if(!p)return;const P=te=>{const _=H.current,we=te.target;if(!_||!we)return;const L=_.querySelector(`[data-review-field="${p}"]`);L!=null&&L.contains(we)||z(null)};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[p]),t.jsxs("section",{ref:H,className:"rounded-2xl bg-white p-6 shadow-sm ring-1 ring-black/5",children:[t.jsx(us,{id:"section-education",title:"Education",pendingCount:C,onAutoFill:S,autoFillLoading:j}),l.length>0&&d&&h&&t.jsx(_s,{suggestions:l,onAccept:d,onDismiss:h}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"rounded-[18px] border border-slate-200 bg-slate-50/60 p-4",children:[t.jsx("div",{className:"mb-3",children:t.jsx("h3",{className:"text-[13px] font-bold tracking-wide text-slate-700",children:O("buildProfile.education.academicOverview")})}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:O("buildProfile.education.currentSchool")}),t.jsxs("div",{className:"mt-3 grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[t.jsxs("div",{className:"group relative z-0 sm:col-span-2 lg:col-span-3 hover:z-30 focus-within:z-30","data-review-field":"currentSchool",children:[t.jsxs("label",{className:y("currentSchool"),children:[O("buildProfile.education.currentSchool")," ",A("currentSchool")]}),t.jsx("input",{type:"text","aria-invalid":(n==null?void 0:n.has("currentSchool"))||void 0,className:u("currentSchool"),autoComplete:"new-password",value:e.currentSchool,onFocus:()=>ue("currentSchool"),onClick:()=>ue("currentSchool"),onChange:P=>o("currentSchool",P.target.value)}),t.jsx(Y,{suggestion:r.currentSchool,onAccept:d,onDismiss:h}),be("currentSchool")?t.jsx(W,{suggestion:r.currentSchool?void 0:a.currentSchool,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"grade",onClick:()=>ue("grade"),children:[t.jsxs("label",{htmlFor:"build-profile-grade-select",className:y("grade"),children:[O("buildProfile.requiredFields.grade")," ",A("grade")]}
2),t.jsx(Q,{id:"build-profile-grade-select",value:e.grade,onChange:P=>o("grade",P),options:Oc.map(P=>P),placeholder:O("buildProfile.personalInfo.select"),className:u("grade"),suppressOpen:N("grade"),"aria-invalid":Ie,"aria-describedby":pt}),Ie?t.jsx("p",{id:pt,className:"sr-only",children:O("buildProfile.requiredFieldMissing",{field:O("buildProfile.requiredFields.grade")})}):null,t.jsx(Y,{suggestion:r.grade,onAccept:d,onDismiss:h}),be("grade")?t.jsx(W,{suggestion:r.grade?void 0:a.grade,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"classYear",onClick:()=>ue("classYear"),children:[t.jsxs("label",{htmlFor:"build-profile-class-year-select",className:y("classYear"),children:[O("buildProfile.requiredFields.classYear")," ",A("classYear")]}),t.jsx(Q,{id:"build-profile-class-year-select",value:e.classYear,onChange:P=>o("classYear",P),options:B,placeholder:O("buildProfile.personalInfo.select"),className:u("classYear"),suppressOpen:N("classYear"),"aria-invalid":Ae,"aria-describedby":jt}),Ae?t.jsx("p",{id:jt,className:"sr-only",children:O("buildProfile.requiredFieldMissing",{field:O("buildProfile.requiredFields.classYear")})}):null,t.jsx(Y,{suggestion:r.classYear,onAccept:d,onDismiss:h}),be("classYear")?t.jsx(W,{suggestion:r.classYear?void 0:a.classYear,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"route",onClick:()=>ue("route"),children:[t.jsx("label",{className:y("route"),children:O("buildProfile.education.route")}),t.jsx(Q,{value:e.route,onChange:P=>o("route",P),options:_c.map(P=>P),placeholder:O("buildProfile.personalInfo.select"),className:u("route"),suppressOpen:N("route")}),t.jsx(Y,{suggestion:r.route,onAccept:d,onDismiss:h}),be("route")?t.jsx(W,{suggestion:r.route?void 0:a.route,onAccept:v,onDismiss:b}):null]})]})]}),t.jsxs("div",{className:"border-t border-slate-200 pt-4",children:[t.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:O("buildProfile.education.academicRecord")}),t.jsxs("div",{className:"mt-3 grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"gpa",children:[t.jsx("label",{className:y("gpa"),children:"GPA"}),t.jsx("input",{type:"text",className:u("gpa"),autoComplete:"new-password",placeholder:O("buildProfile.education.gpaPlaceholder"),value:e.gpa,onFocus:()=>ue("gpa"),onClick:()=>ue("gpa"),onChange:P=>o("gpa",P.target.value)}),t.jsx(Y,{suggestion:r.gpa,onAccept:d,onDismiss:h}),be("gpa")?t.jsx(W,{suggestion:r.gpa?void 0:a.gpa,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"gpaScale",onClick:()=>ue("gpaScale"),children:[t.jsx("label",{className:y("gpaScale"),children:O("buildProfile.education.scale")}),t.jsx(Q,{value:e.gpaScale,onChange:P=>o("gpaScale",P),options:Mc.map(P=>P),placeholder:O("buildProfile.personalInfo.select"),className:u("gpaScale"),suppressOpen:N("gpaScale")}),t.jsx(Y,{suggestion:r.gpaScale,onAccept:d,onDismiss:h}),be("gpaScale")?t.jsx(W,{suggestion:r.gpaScale?void 0:a.gpaScale,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"classRank",children:[t.jsx("label",{className:y("classRank"),children:O("buildProfile.education.classRank")}),t.jsx("input",{type:"text",className:u("classRank"),autoComplete:"new-password",placeholder:O("buildProfile.education.classRankPlaceholder"),value:e.classRank,onFocus:()=>ue("classRank"),onClick:()=>ue("classRank"),onChange:P=>o("classRank",P.target.value)}),t.jsx(Y,{suggestion:r.classRank,onAccept:d,onDismiss:h}),be("classRank")?t.jsx(W,{suggestion:r.classRank?void 0:a.classRank,onAccept:v,onDismiss:b}):null]})]})]})]})]}),t.jsx(hn,{pendingCount:ct,description:O("buildProfile.education.additionalInfoDescription"),reviewFields:["currentSchoolEntryDate","boardingSchool","livesOnCampus","willGraduate","graduationDate","schoolProgressionContext","schedulingSystem","hasCollegeCoursework","applicantDescription","highestDegreeIntended","careerInterest","otherCareerInterest"],children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"rounded-[18px] border border-slate-200 bg-slate-50/60 p-4",children:[t.jsx("div",{className:"mb-3",children:t.jsx("h3",{className:"text-[13px] font-bold tracking-wide text-slate-700",children:O("buildProfile.education.schoolHistory")})}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"currentSchoolEntryDate",children:[t.jsx("label",{className:y("currentSchoolEntryDate"),children:O("buildProfile.education.currentSchoolEntryDate")}),t.jsx("input",{type:"date",className:u("currentSchoolEntryDate"),value:w("currentSchoolEntryDate",s.currentSchoolEntryDate),onFocus:()=>ue("currentSchoolEntryDate"),onClick:()=>ue("currentSchoolEntryDate"),onChange:P=>U({currentSchoolEntryDate:P.target.value})}),t.jsx(Y,{suggestion:r.currentSchoolEntryDate,onAccept:d,onDismiss:h}),be("currentSchoolEntryDate")?t.jsx(W,{suggestion:r.currentSchoolEntryDate?void 0:a.currentSchoolEntryDate,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"boardingSchool",onClick:()=>ue("boardingSchool"),children:[t.jsx("label",{className:y("boardingSchool"),children:O("buildProfile.education.boardingSchool")}),t.jsx(Q,{value:X,onChange:P=>
2U({boardingSchool:P,livesOnCampus:P==="Yes"?s.livesOnCampus:""}),options:kr,placeholder:O("buildProfile.personalInfo.select"),className:u("boardingSchool"),suppressOpen:N("boardingSchool")}),t.jsx(Y,{suggestion:r.boardingSchool,onAccept:d,onDismiss:h}),be("boardingSchool")?t.jsx(W,{suggestion:r.boardingSchool?void 0:a.boardingSchool,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"willGraduate",onClick:()=>ue("willGraduate"),children:[t.jsx("label",{className:y("willGraduate"),children:O("buildProfile.education.willGraduate")}),t.jsx(Q,{value:E,onChange:P=>U({willGraduate:P,graduationDate:P==="Yes"?s.graduationDate:""}),options:kr,placeholder:O("buildProfile.personalInfo.select"),className:u("willGraduate"),suppressOpen:N("willGraduate")}),t.jsx(Y,{suggestion:r.willGraduate,onAccept:d,onDismiss:h}),be("willGraduate")?t.jsx(W,{suggestion:r.willGraduate?void 0:a.willGraduate,onAccept:v,onDismiss:b}):null]}),X==="Yes"?t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"livesOnCampus",onClick:()=>ue("livesOnCampus"),children:[t.jsx("label",{className:y("livesOnCampus"),children:O("buildProfile.education.livesOnCampus")}),t.jsx(Q,{value:w("livesOnCampus",s.livesOnCampus),onChange:P=>U({livesOnCampus:P}),options:kr,placeholder:O("buildProfile.personalInfo.select"),className:u("livesOnCampus"),suppressOpen:N("livesOnCampus")}),t.jsx(Y,{suggestion:r.livesOnCampus,onAccept:d,onDismiss:h}),be("livesOnCampus")?t.jsx(W,{suggestion:r.livesOnCampus?void 0:a.livesOnCampus,onAccept:v,onDismiss:b}):null]}):null,E==="Yes"?t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"graduationDate",children:[t.jsx("label",{className:y("graduationDate"),children:O("buildProfile.education.graduationDate")}),t.jsx("input",{type:"date",className:u("graduationDate"),value:w("graduationDate",s.graduationDate),onFocus:()=>ue("graduationDate"),onClick:()=>ue("graduationDate"),onChange:P=>U({graduationDate:P.target.value})}),t.jsx(Y,{suggestion:r.graduationDate,onAccept:d,onDismiss:h}),be("graduationDate")?t.jsx(W,{suggestion:r.graduationDate?void 0:a.graduationDate,onAccept:v,onDismiss:b}):null]}):null,t.jsxs("div",{className:"group relative z-0 sm:col-span-2 lg:col-span-3 hover:z-30 focus-within:z-30","data-review-field":"schoolProgressionContext",children:[t.jsx("label",{className:y("schoolProgressionContext"),children:O("buildProfile.education.progressionContext")}),t.jsx("textarea",{rows:3,className:u("schoolProgressionContext"),placeholder:O("buildProfile.education.progressionContextPlaceholder"),value:w("schoolProgressionContext",s.schoolProgressionContext),onFocus:()=>ue("schoolProgressionContext"),onClick:()=>ue("schoolProgressionContext"),onChange:P=>U({schoolProgressionContext:P.target.value})}),t.jsx(Y,{suggestion:r.schoolProgressionContext,onAccept:d,onDismiss:h}),be("schoolProgressionContext")?t.jsx(W,{suggestion:r.schoolProgressionContext?void 0:a.schoolProgressionContext,onAccept:v,onDismiss:b}):null]})]}),t.jsxs("div",{className:"mt-4",children:[t.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[t.jsx("h4",{className:"text-[12px] font-bold uppercase tracking-[0.14em] text-slate-500",children:O("buildProfile.education.otherSecondarySchools")}),s.otherSecondarySchools.length>0&&s.otherSecondarySchools.length<sr?t.jsxs("button",{type:"button",onClick:q,className:"inline-flex items-center gap-1.5 rounded-xl border border-slate-200 bg-white px-3 py-1.5 text-sm font-medium text-slate-700 shadow-sm transition hover:bg-slate-50",children:[t.jsx(qe,{size:14}),O("buildProfile.education.addSchool")]}):null]}),s.otherSecondarySchools.length===0?t.jsxs("div",{className:"rounded-xl border border-dashed border-slate-200 px-6 py-6 text-center",children:[t.jsx("p",{className:"text-sm text-slate-500",children:O("buildProfile.education.noSecondarySchool")}),t.jsxs("button",{type:"button",onClick:q,className:"mt-3 inline-flex items-center gap-1.5 rounded-xl bg-[#16335F] px-4 py-2 text-sm font-medium text-white shadow-sm transition hover:bg-[#1a3d72]",children:[t.jsx(qe,{size:16}),O("buildProfile.education.addSchool")]})]}):t.jsx("div",{className:"space-y-3",children:s.otherSecondarySchools.map((P,te)=>t.jsxs("div",{className:"rounded-[16px] border border-slate-200 bg-white p-4 shadow-sm",children:[t.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[t.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-[#16335F] text-[11px] font-bold text-white",children:te+2}),t.jsx("h5",{className:"flex-1 text-[13px] font-bold tracking-wide text-slate-700",children:O("buildProfile.education.secondarySchool")}),t.jsx(He,{onConfirm:()=>ee(P.id),size:16})]}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[t.jsxs("div",{className:"sm:col-span-2",children:[t.jsx("label",{className:Ye,children:O("buildProfile.education.schoolName")}),t.jsx("input",{type:"text",className:yt,value:P.schoolName,onChange:_=>ce(P.id,{schoolName:_.target.value})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Ye,children:O("buildProfile.education.fromDate")}),t.jsx("input",{type:"date",className:yt,value:P.fromDate,onChange:_=>ce(P.id,{fromDate:_.target.value})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Ye,children:O("buildProfile.education.toDate")}),t.jsx("input",{type:"date",className:yt,value:P.toDate,onChange:_=>ce(P.id,{toDate:_.target.value})})]}),t.jsxs("div",{className:"sm:col-span-2",children:[t.jsx("label",{className:Ye,children:O("buildProfile.education.reasonForLeaving")}),t.jsx("textarea",{rows:2,className:yt,value:P.reasonForLeaving,onChange:_=>ce(P.id,{reasonForLeaving:_.target.value})})]})]})]},P.id))})]})]}),t.jsxs("div",{className:"rounded-[18px] border border-slate-200 bg-slate-50/60 p-4",children:[t.jsx("div",{className:"mb-3",children:t.jsx("h3",{className:"text-[13px] font-bold tracking-wide text-slate-700",children:O("buildProfile.education.currentCourses")})}),t.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"schedulingSystem",onClick:()=>ue("schedulingSystem"),children:[t.jsx("label",{className:y("schedulingSystem"),children:O("buildProfile.education.schedulingSystem")}),t.jsx(Q,{value:w("schedulingSystem",s.schedulingSystem),onChange:P=>U({schedulingSystem:P}),options:lu,placeholder:O("buildProfile.personalInfo.select"),className:u("schedulingSystem"),suppressOpen:N("schedulingSystem")}),t.jsx(Y,{suggestion:r.schedulingSystem,onAccept:d,onDismiss:h}),be("schedulingSystem")?t.jsx(W,{suggestion:r.schedulingSystem?void 0:a.schedulingSystem,onAccept:v,onDismiss:b}):null]})}),t.jsxs("div",{className:"mt-4",children:[t.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[t.jsx("h4",{className:"text-[12px] font-bold uppercase tracking-[0.14em] text-slate-500",children:O("buildProfile.education.courseList")}),s.currentCourses.length>0&&s.currentCourses.length<ar?t.jsxs("button",{type:"button",onClick:Ce,className:"inline-flex items-center gap-1.5 rounded-xl border border-slate-200 bg-white px-3 py-1.5 text-sm font-medium text-slate-700 shadow-sm transition hover:bg-slate-50",children:[t.jsx(qe,{size:14}),O("buildProfile.education.addCourse")]}):null]}),s.currentCourses.length===0?t.jsxs("div",{className:"rounded-xl border border-dashed border-slate-200 px-6 py-6 text-center",children:[t.jsx("p",{className:"text-sm text-slate-500",children:O("buildProfile.education.noCurrentCourse")}),t.jsxs("button",{type:"button",onClick:Ce,className:"mt-3 inline-flex items-center gap-1.5 rounded-xl bg-[#16335F] px-4 py-2 text-sm font-medium text-white shadow-sm transition hover:bg-[#1a3d72]",children:[t.jsx(qe,{size:16}),O("buildProfile.education.addCourse")]})]}):t.jsx("div",{className:"space-y-3",children:s.currentCourses.map((P,te)=>t.jsxs("div",{className:"rounded-[16px] border border-slate-200 bg-slate-50/60 p-4",children:[t.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[t.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-[#16335F] text-[11px] font-bold text-white",children:te+1}),t.jsx("h5",{className:"flex-1 text-[13px] font-bold tracking-wide text-slate-700",children:O("buildProfile.education.course")}),t.jsx(He,{onConfirm:()=>k(P.id),size:16})]}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:Ye,children:O("buildProfile.education.subject")}),t.jsx(Q,{value:P.subject,onChange:_=>xe(P.id,{subject:_}),options:ou,placeholder:O("buildProfile.personalInfo.select")})]}),t.jsxs("div",{children:[t.jsx("label",{className:Ye,children:O("buildProfile.education.courseTitle")}),t.jsx("input",{type:"text",className:yt,value:P.title,onChange:_=>xe(P.id,{title:_.target.value})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Ye,children:O("buildProfile.education.level")}),t.jsx(Q,{value:P.level,onChange:_=>xe(P.id,{level:_}),options:cu,placeholder:O("buildProfile.personalInfo.select")})]}),t.jsxs("div",{children:[t.jsx("label",{className:Ye,children:O("buildProfile.education.schedule")}),t.jsx(Q,{value:P.schedule,onChange:_=>xe(P.id,{schedule:_}),options:du,placeholder:O("buildProfile.personalInfo.select")})]})]})]},P.id))})]})]}),t.jsxs("div",{className:"rounded-[18px] border border-slate-200 bg-slate-50/60 p-4",children:[t.jsx("div",{className:"mb-3",children:t.jsx("h3",{className:"text-[13px] font-bold tracking-wide text-slate-700",children:O("buildProfile.education.collegeCoursework")})}),t.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"hasCollegeCoursework",onClick:()=>ue("hasCollegeCoursework"),children:[t.jsx("label",{className:y("hasCollegeCoursework"),children:O("buildProfile.education.anyCollegeCoursework")}),t.jsx(Q,{value:oe,onChange:P=>U({hasCollegeCoursework:P,collegeCoursework:P==="Yes"?s.collegeCoursework:[]}),options:kr,placeholder:O("buildProfile.personalInfo.select"),className:u("hasCollegeCoursework"),suppressOpen:N("hasCollegeCoursework")}),t.jsx(Y,{suggestion:r.hasCollegeCoursework,onAccept:d,onDismiss:h}),be("hasCollegeCoursework")?t.jsx(W,{suggestion:r.hasCollegeCoursework?void 0:a.hasCollegeCoursework,onAccept:v,onDismiss:b}):null]})}),oe==="Yes"?t.jsxs("div",{className:"mt-4",children:[t.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[t.jsx("h4",{className:"text-[12px] font-bold uppercase tracking-[0.14em] text-slate-500",children:O("buildProfile.education.collegeEntries")}),s.collegeCoursework.length>0&&s.collegeCoursework.length<rr?t.jsxs("button",{type:"button",onClick:ne,className:"inline-flex items-center gap-1.5 rounded-xl border border-slate-200 bg-white px-3 py-1.5 text-sm font-medium text-slate-700 shadow-sm transition hover:bg-slate-50",children:[t.jsx(qe,{size:14}),O("buildProfile.education.addCollege")]}):null]}),s.collegeCoursework.length===0?t.jsxs("div",{className:"rounded-xl border border-dashed border-slate-200 px-6 py-6 text-center",children:[t.jsx("p",{className:"text-sm text-slate-500",children:O("buildProfile.education.noCollegeCoursework")}),t.jsxs("button",{type:"button",onClick:ne,className:"mt-3 inline-flex items-center gap-1.5 rounded-xl bg-[#16335F] px-4 py-2 text-sm font-medium text-white shadow-sm transition hover:bg-[#1a3d72]",children:[t.jsx(qe,{size:16}),O("buildProfile.education.addCollege")]})]}):t.jsx("div",{className:"space-y-3",children:s.collegeCoursework.map((P,te)=>t.jsxs("div",{className:"rounded-[16px] border border-slate-200 bg-slate-50/60 p-4",children:[t.jsxs("div",{className:"mb-3 flex items-center gap-3",children:[t.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-[#16335F] text-[11px] font-bold text-white",children:te+1}),t.jsx("h5",{className:"flex-1 text-[13px] font-bold tracking-wide text-slate-700",children:O("buildProfile.education.collegeCoursework")}),t.jsx(He,{onConfirm:()=>K(P.id),size:16})]}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[t.jsxs("div",{className:"sm:col-span-2 lg:col-span-1",children:[t.jsx("label",{className:Ye,children:O("buildProfile.education.collegeName")}
2),t.jsx("input",{type:"text",className:yt,value:P.collegeName,onChange:_=>ie(P.id,{collegeName:_.target.value})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Ye,children:O("buildProfile.education.fromDate")}),t.jsx("input",{type:"date",className:yt,value:P.fromDate,onChange:_=>ie(P.id,{fromDate:_.target.value})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Ye,children:O("buildProfile.education.toDate")}),t.jsx("input",{type:"date",className:yt,value:P.toDate,onChange:_=>ie(P.id,{toDate:_.target.value})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Ye,children:O("buildProfile.education.degreeEarned")}),t.jsx(Q,{value:P.degreeEarned,onChange:_=>ie(P.id,{degreeEarned:_}),options:uu,placeholder:O("buildProfile.personalInfo.select")})]}),t.jsxs("div",{className:"sm:col-span-2",children:[t.jsx("label",{className:Ye,children:O("buildProfile.education.courseDetails")}),t.jsx("textarea",{rows:2,className:yt,value:P.courseDetails,onChange:_=>ie(P.id,{courseDetails:_.target.value})})]})]})]},P.id))})]}):null]}),t.jsxs("div",{className:"rounded-[18px] border border-slate-200 bg-slate-50/60 p-4",children:[t.jsx("div",{className:"mb-3",children:t.jsx("h3",{className:"text-[13px] font-bold tracking-wide text-slate-700",children:O("buildProfile.education.futurePlans")})}),t.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"applicantDescription",onClick:()=>ue("applicantDescription"),children:[t.jsx("label",{className:y("applicantDescription"),children:O("buildProfile.education.applicantType")}),t.jsx(Q,{value:w("applicantDescription",s.applicantDescription),onChange:P=>U({applicantDescription:P}),options:au,placeholder:O("buildProfile.personalInfo.select"),className:u("applicantDescription"),suppressOpen:N("applicantDescription")}),t.jsx(Y,{suggestion:r.applicantDescription,onAccept:d,onDismiss:h}),be("applicantDescription")?t.jsx(W,{suggestion:r.applicantDescription?void 0:a.applicantDescription,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"highestDegreeIntended",onClick:()=>ue("highestDegreeIntended"),children:[t.jsx("label",{className:y("highestDegreeIntended"),children:O("buildProfile.education.highestDegreeIntended")}),t.jsx(Q,{value:w("highestDegreeIntended",s.highestDegreeIntended),onChange:P=>U({highestDegreeIntended:P}),options:nu,placeholder:O("buildProfile.personalInfo.select"),className:u("highestDegreeIntended"),suppressOpen:N("highestDegreeIntended")}),t.jsx(Y,{suggestion:r.highestDegreeIntended,onAccept:d,onDismiss:h}),be("highestDegreeIntended")?t.jsx(W,{suggestion:r.highestDegreeIntended?void 0:a.highestDegreeIntended,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"careerInterest",onClick:()=>ue("careerInterest"),children:[t.jsx("label",{className:y("careerInterest"),children:O("buildProfile.education.careerInterest")}),t.jsx(Q,{value:je,onChange:P=>U({careerInterest:P,otherCareerInterest:P==="Other"?s.otherCareerInterest:""}),options:iu,placeholder:O("buildProfile.personalInfo.select"),className:u("careerInterest"),suppressOpen:N("careerInterest")}),t.jsx(Y,{suggestion:r.careerInterest,onAccept:d,onDismiss:h}),be("careerInterest")?t.jsx(W,{suggestion:r.careerInterest?void 0:a.careerInterest,onAccept:v,onDismiss:b}):null]}),je==="Other"?t.jsxs("div",{className:"group relative z-0 lg:col-span-3 hover:z-30 focus-within:z-30","data-review-field":"otherCareerInterest",children:[t.jsx("label",{className:y("otherCareerInterest"),children:O("buildProfile.education.otherCareerInterest")}),t.jsx("input",{type:"text",className:u("otherCareerInterest"),value:w("otherCareerInterest",s.otherCareerInterest),onFocus:()=>ue("otherCareerInterest"),onClick:()=>ue("otherCareerInterest"),onChange:P=>U({otherCareerInterest:P.target.value})}),t.jsx(Y,{suggestion:r.otherCareerInterest,onAccept:d,onDismiss:h}),be("otherCareerInterest")?t.jsx(W,{suggestion:r.otherCareerInterest?void 0:a.otherCareerInterest,onAccept:v,onDismiss:b}):null]}):null]})]})]})})]})]})}const gu=[{label:"standardized",types:["ACT","SAT"]}
2,{label:"englishProficiency",types:["TOEFL","IELTS","PTE","Duolingo"]},{label:"subjectTests",types:["AP","IB","SAT_Subject","Cambridge"]}];function gi({onAdd:e,disabledTypes:s,totalCount:r,maxCount:a}){const{t:n}=Te(),[l,o]=c.useState(!1),f=c.useRef(null);c.useEffect(()=>{function j(C){f.current&&!f.current.contains(C.target)&&o(!1)}return l&&document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[l]);const S=r>=a;return t.jsxs("div",{className:"relative",ref:f,children:[t.jsxs("button",{type:"button",onClick:()=>!S&&o(!l),disabled:S,className:"inline-flex items-center gap-1.5 rounded-xl bg-[#16335F] px-4 py-2 text-sm font-semibold text-white shadow-sm transition hover:bg-[#1a3d72] disabled:opacity-50 disabled:cursor-not-allowed",children:[t.jsx(qe,{size:15}),n("stragglerUi.addTest.addButton"),t.jsx(tt,{size:13,className:`ml-0.5 transition-transform ${l?"rotate-180":""}`})]}),l&&t.jsx("div",{className:"absolute top-full left-0 mt-2 z-50 min-w-[220px] rounded-xl border border-slate-200 bg-white shadow-lg",children:gu.map((j,C)=>t.jsxs(Ze.Fragment,{children:[C>0&&t.jsx("div",{className:"border-t border-slate-100 my-1"}),t.jsx("div",{className:"px-3.5 pt-2 pb-1 text-[10px] font-bold uppercase tracking-[0.1em] text-slate-400",children:n(`stragglerUi.addTest.groups.${j.label}`)}),j.types.map(d=>{const h=s.includes(d);return t.jsxs("button",{type:"button",disabled:h,onClick:()=>{e(d),o(!1)},className:`flex w-full items-center px-3.5 py-2 text-sm transition ${h?"text-slate-300 cursor-not-allowed":"text-slate-700 hover:bg-[#16335F]/5"}`,children:[cl[d],h&&Os.includes(d)&&t.jsx("span",{className:"ml-auto text-[10px] text-slate-300",children:n("stragglerUi.addTest.added")})]},d)})]},j.label))})]})}const as="w-full rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-sm text-slate-800 shadow-sm transition placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-[#16335F]",ht="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500";function xu({record:e,onChange:s,onDelete:r,onCollapse:a,collapsed:n}){const{t:l}=Te();return t.jsxs("div",{className:`rounded-[18px] border border-slate-200 shadow-sm ${n?"bg-white":"bg-slate-50/60"}`,children:[t.jsxs("div",{className:`flex items-center gap-3 bg-white px-4 py-3 rounded-t-[18px] ${n?"rounded-b-[18px]":"border-b border-slate-200"}`,children:[t.jsx(tt,{size:18,className:`text-[#16335F]/70 cursor-pointer hover:text-[#16335F] transition-transform ${n?"-rotate-90":""}`,onClick:a}),t.jsx("span",{className:"text-base font-bold text-slate-800",children:"ACT"}),t.jsxs("div",{className:"ml-2 flex items-center gap-2",children:[t.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-[0.12em] text-slate-400 whitespace-nowrap",children:l("buildProfile.testing.timesTaken")}),t.jsx("input",{type:"number",min:"0",max:"20",value:e.timesTaken??"",onChange:o=>s({timesTaken:o.target.value?Number(o.target.value):null}),className:`${as} w-16 text-center py-1.5`})]}),t.jsx("div",{className:"ml-auto",children:t.jsx(He,{onConfirm:r})})]}),!n&&t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:ht,children:l("buildProfile.testing.highestComposite")}),t.jsx("input",{type:"number",min:"1",max:"36",value:e.compositeScore??"",onChange:o=>s({compositeScore:o.target.value?Number(o.target.value):null}),className:`${as} mt-1.5`,placeholder:"1–36"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:l("buildProfile.testing.rangeHint",{range:"1–36"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:ht,children:l("buildProfile.testing.dateTaken")}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:e.compositeDate,onChange:o=>s({compositeDate:o})})})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:ht,children:l("buildProfile.testing.highestEnglish")}),t.jsx("input",{type:"number",min:"1",max:"36",value:e.englishScore??"",onChange:o=>s({englishScore:o.target.value?Number(o.target.value):null}),className:`${as} mt-1.5`,placeholder:"1–36"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:l("buildProfile.testing.rangeHint",{range:"1–36"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:ht,children:l("buildProfile.testing.dateTaken")}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:e.englishDate,onChange:o=>s({englishDate:o})})})]}),t.jsxs("div",{children:[t.jsx("label",{className:ht,children:l("buildProfile.testing.highestMath")}),t.jsx("input",{type:"number",min:"1",max:"36",value:e.mathScore??"",onChange:o=>s({mathScore:o.target.value?Number(o.target.value):null}),className:`${as} mt-1.5`,placeholder:"1–36"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:l("buildProfile.testing.rangeHint",{range:"1–36"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:ht,children:l("buildProfile.testing.dateTaken")}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:e.mathDate,onChange:o=>s({mathDate:o})})})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-bold text-slate-700 mb-2",children:l("buildProfile.testing.additionalScores")}),t.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:ht,children:l("buildProfile.testing.highestReading")}),t.jsx("input",{type:"number",min:"1",max:"36",value:e.readingScore??"",onChange:o=>s({readingScore:o.target.value?Number(o.target.value):null}),className:`${as} mt-1.5`,placeholder:"1–36"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:l("buildProfile.testing.rangeHint",{range:"1–36"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:ht,children:l("buildProfile.testing.dateTaken")}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:e.readingDate,onChange:o=>s({readingDate:o})})})]}),t.jsxs("div",{children:[t.jsxs("label",{className:ht,children:[l("buildProfile.testing.highestScience"),t.jsx("span",{className:"ml-1 text-[10px] px-1.5 py-0.5 bg-slate-100 rounded text-slate-400 font-medium",children:l("buildProfile.testing.optional")})]}),t.jsx("input",{type:"number",min:"1",max:"36",value:e.scienceScore??"",onChange:o=>s({scienceScore:o.target.value?Number(o.target.value):null}),className:`${as} mt-1.5`,placeholder:"1–36"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:l("buildProfile.testing.rangeHint",{range:"1–36"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:ht,children:l("buildProfile.testing.dateTaken")}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:e.scienceDate,onChange:o=>s({scienceDate:o})})})]})]})]}),t.jsxs("div",{className:"border-t border-slate-100 pt-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("label",{className:"text-sm font-bold text-slate-700 mb-0",children:l("buildProfile.testing.actWriting")}),t.jsx("button",{type:"button",onClick:()=>s({writingTaken:!e.writingTaken}),className:`relative w-9 h-5 rounded-full transition-colors ${e.writingTaken?"bg-[#16335F]":"bg-slate-300"}`,children:t.jsx("span",{className:`absolute top-[3px] left-[3px] w-3.5 h-3.5 rounded-full bg-white shadow transition-transform ${e.writingTaken?"translate-x-4":""}`})}),t.jsx("span",{className:"text-xs text-slate-500",children:e.writingTaken?l("buildProfile.testing.yes"):l("buildProfile.testing.no")})]}),e.writingTaken&&t.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:ht,children:l("buildProfile.testing.writingScore")}),t.jsx("input",{type:"number",min:"2",max:"12",value:e.writingScore??"",onChange:o=>s({writingScore:o.target.value?Number(o.target.value):null}),className:`${as} mt-1.5`,placeholder:"2–12"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:l("buildProfile.testing.rangeHint",{range:"2–12"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:ht,children:l("buildProfile.testing.dateTaken")}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:e.writingDate,onChange:o=>s({writingDate:o})})})]})]})]})]})]})}const ja="w-full rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-sm text-slate-800 shadow-sm transition placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-[#16335F]",Dr="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500";function bu({record:e,onChange:s,onDelete:r,onCollapse:a,collapsed:n}){const{t:l}=Te(),o=e.ebrwScore!=null&&e.mathScore!=null,f=Number(e.ebrwScore??0)+Number(e.mathScore??0);return t.jsxs("div",{className:`rounded-[18px] border border-slate-200 shadow-sm ${n?"bg-white":"bg-slate-50/60"}`,children:[t.jsxs("div",{className:`flex items-center gap-3 bg-white px-4 py-3 rounded-t-[18px] ${n?"rounded-b-[18px]":"border-b border-slate-200"}`,children:[t.jsx(tt,{size:18,className:`text-[#16335F]/70 cursor-pointer hover:text-[#16335F] transition-transform ${n?"-rotate-90":""}`,onClick:a}),t.jsx("span",{className:"text-base font-bold text-slate-800",children:"SAT"}),t.jsxs("div",{className:"ml-2 flex items-center gap-2",children:[t.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-[0.12em] text-slate-400 whitespace-nowrap",children:l("buildProfile.testing.timesTaken")}),t.jsx("input",{type:"number",min:"0",max:"20",value:e.timesTaken??"",onChange:S=>s({timesTaken:S.target.value?Number(S.target.value):null}),className:`${ja} w-16 text-center py-1.5`})]}),t.jsx("div",{className:"ml-auto",children:t.jsx(He,{onConfirm:r})})]}),!n&&t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:Dr,children:l("buildProfile.testing.ebrw")}),t.jsx("input",{type:"number",min:"200",max:"800",value:e.ebrwScore??"",onChange:S=>s({ebrwScore:S.target.value?Number(S.target.value):null}),className:`${ja} mt-1.5`,placeholder:"200–800"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:l("buildProfile.testing.rangeHint",{range:"200–800"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Dr,children:l("buildProfile.testing.dateTaken")}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:e.ebrwDate,onChange:S=>s({ebrwDate:S})})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Dr,children:l("buildProfile.testing.math")}),t.jsx("input",{type:"number",min:"200",max:"800",value:e.mathScore??"",onChange:S=>s({mathScore:S.target.value?Number(S.target.value):null}),className:`${ja} mt-1.5`,placeholder:"200–800"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:l("buildProfile.testing.rangeHint",{range:"200–800"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Dr,children:l("buildProfile.testing.dateTaken")}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:e.mathDate,onChange:S=>s({mathDate:S})})})]})]}),o&&t.jsxs("p",{className:"mt-2 text-xs text-slate-400 font-medium",children:[l("buildProfile.testing.totalSatLabel")," ",t.jsx("span",{className:"font-bold text-slate-600",children:f})," ",l("buildProfile.testing.satMaxSuffix")]})]})]})}const bs="w-full rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-sm text-slate-800 shadow-sm transition placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-[#16335F]",ys="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500";function yu({record:e,onChange:s,onDelete:r,onCollapse:a,collapsed:n}){const{t:l}=Te();return t.jsxs("div",{className:`rounded-[18px] border border-slate-200 shadow-sm ${n?"bg-white":"bg-slate-50/60"}`,children:[t.jsxs("div",{className:`flex items-center gap-3 bg-white px-4 py-3 rounded-t-[18px] ${n?"rounded-b-[18px]":"border-b border-slate-200"}`,children:[t.jsx(tt,{size:18,className:`text-[#16335F]/70 cursor-pointer hover:text-[#16335F] transition-transform ${n?"-rotate-90":""}`,onClick:a}),t.jsx("span",{className:"text-base font-bold text-slate-800",children:"TOEFL"}),t.jsxs("div",{className:"ml-2 flex items-center gap-2",children:[t.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-[0.12em] text-slate-400 whitespace-nowrap",children:l("buildProfile.testing.timesTaken")}),t.jsx("input",{type:"number",min:"0",max:"20",value:e.timesTaken??"",onChange:o=>s({timesTaken:o.target.value?Number(o.target.value):null}),className:`${bs} w-16 text-center py-1.5`})]}),t.jsx("div",{className:"ml-auto",children:t.jsx(He,{onConfirm:r})})]}),!n&&t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:ys,children:l("buildProfile.testing.highestTotal")}),t.jsx("input",{type:"number",min:"0",max:"120",value:e.totalScore??"",onChange:o=>s({totalScore:o.target.value?Number(o.target.value):null}),className:`${bs} mt-1.5`,placeholder:"0–120"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:l("buildProfile.testing.rangeHint",{range:"0–120"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:ys,children:l("buildProfile.testing.dateTaken")}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:e.totalDate,onChange:o=>s({totalDate:o})})})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-bold text-slate-700 mb-2",children:l("buildProfile.testing.sectionScores")}),t.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:ys,children:l("buildProfile.testing.reading")}),t.jsx("input",{type:"number",min:"0",max:"30",value:e.readingScore??"",onChange:o=>s({readingScore:o.target.value?Number(o.target.value):null}),className:`${bs} mt-1.5 text-center`,placeholder:"0–30"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:"0–30"})]}),t.jsxs("div",{children:[t.jsx("label",{className:ys,children:l("buildProfile.testing.listening")}),t.jsx("input",{type:"number",min:"0",max:"30",value:e.listeningScore??"",onChange:o=>s({listeningScore:o.target.value?Number(o.target.value):null}),className:`${bs} mt-1.5 text-center`,placeholder:"0–30"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:"0–30"})]}),t.jsxs("div",{children:[t.jsx("label",{className:ys,children:l("buildProfile.testing.speaking")}),t.jsx("input",{type:"number",min:"0",max:"30",value:e.speakingScore??"",onChange:o=>s({speakingScore:o.target.value?Number(o.target.value):null}),className:`${bs} mt-1.5 text-center`,placeholder:"0–30"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:"0–30"})]}),t.jsxs("div",{children:[t.jsx("label",{className:ys,children:l("buildProfile.testing.writing")}),t.jsx("input",{type:"number",min:"0",max:"30",value:e.writingScore??"",onChange:o=>s({writingScore:o.target.value?Number(o.target.value):null}),className:`${bs} mt-1.5 text-center`,placeholder:"0–30"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:"0–30"})]})]})]})]})]})}const vs="w-full rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-sm text-slate-800 shadow-sm transition placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-[#16335F]",js="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500";function vu({record:e,onChange:s,onDelete:r,onCollapse:a,collapsed:n}){const{t:l}=Te();return t.jsxs("div",{className:`rounded-[18px] border border-slate-200 shadow-sm ${n?"bg-white":"bg-slate-50/60"}`,children:[t.jsxs("div",{className:`flex items-center gap-3 bg-white px-4 py-3 rounded-t-[18px] ${n?"rounded-b-[18px]":"border-b border-slate-200"}`,children:[t.jsx(tt,{size:18,className:`text-[#16335F]/70 cursor-pointer hover:text-[#16335F] transition-transform ${n?"-rotate-90":""}`,onClick:a}),t.jsx("span",{className:"text-base font-bold text-slate-800",children:l("buildProfile.testing.pteTitle")}),t.jsxs("div",{className:"ml-2 flex items-center gap-2",children:[t.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-[0.12em] text-slate-400 whitespace-
2nowrap",children:l("buildProfile.testing.timesTaken")}),t.jsx("input",{type:"number",min:"0",max:"20",value:e.timesTaken??"",onChange:o=>s({timesTaken:o.target.value?Number(o.target.value):null}),className:`${vs} w-16 text-center py-1.5`})]}),t.jsx("div",{className:"ml-auto",children:t.jsx(He,{onConfirm:r})})]}),!n&&t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:js,children:l("buildProfile.testing.overall")}),t.jsx("input",{type:"number",min:"10",max:"90",value:e.overallScore??"",onChange:o=>s({overallScore:o.target.value?Number(o.target.value):null}),className:`${vs} mt-1.5`,placeholder:"10–90"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:l("buildProfile.testing.rangeHint",{range:"10–90"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:js,children:l("buildProfile.testing.dateTaken")}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:e.overallDate,onChange:o=>s({overallDate:o})})})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-bold text-slate-700 mb-2",children:l("buildProfile.testing.communicativeSkills")}),t.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:js,children:l("buildProfile.testing.listening")}),t.jsx("input",{type:"number",min:"10",max:"90",value:e.listeningScore??"",onChange:o=>s({listeningScore:o.target.value?Number(o.target.value):null}),className:`${vs} mt-1.5 text-center`,placeholder:"10–90"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:"10–90"})]}),t.jsxs("div",{children:[t.jsx("label",{className:js,children:l("buildProfile.testing.reading")}),t.jsx("input",{type:"number",min:"10",max:"90",value:e.readingScore??"",onChange:o=>s({readingScore:o.target.value?Number(o.target.value):null}),className:`${vs} mt-1.5 text-center`,placeholder:"10–90"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:"10–90"})]}),t.jsxs("div",{children:[t.jsx("label",{className:js,children:l("buildProfile.testing.speaking")}),t.jsx("input",{type:"number",min:"10",max:"90",value:e.speakingScore??"",onChange:o=>s({speakingScore:o.target.value?Number(o.target.value):null}),className:`${vs} mt-1.5 text-center`,placeholder:"10–90"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:"10–90"})]}),t.jsxs("div",{children:[t.jsx("label",{className:js,children:l("buildProfile.testing.writing")}),t.jsx("input",{type:"number",min:"10",max:"90",value:e.writingScore??"",onChange:o=>s({writingScore:o.target.value?Number(o.target.value):null}),className:`${vs} mt-1.5 text-center`,placeholder:"10–90"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:"10–90"})]})]})]})]})]})}const Ns="w-full rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-sm text-slate-800 shadow-sm transition placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-[#16335F]",Ss="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500";function ju({record:e,onChange:s,onDelete:r,onCollapse:a,collapsed:n}){const{t:l}=Te();return t.jsxs("div",{className:`rounded-[18px] border border-slate-200 shadow-sm ${n?"bg-white":"bg-slate-50/60"}`,children:[t.jsxs("div",{className:`flex items-center gap-3 bg-white px-4 py-3 rounded-t-[18px] ${n?"rounded-b-[18px]":"border-b border-slate-200"}`,children:[t.jsx(tt,{size:18,className:`text-[#16335F]/70 cursor-pointer hover:text-[#16335F] transition-transform ${n?"-rotate-90":""}`,onClick:a}),t.jsx("span",{className:"text-base font-bold text-slate-800",children:"IELTS"}),t.jsxs("div",{className:"ml-2 flex items-center gap-2",children:[t.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-[0.12em] text-slate-400 whitespace-nowrap",children:l("buildProfile.testing.timesTaken")}),t.jsx("input",{type:"number",min:"0",max:"20",value:e.timesTaken??"",onChange:o=>s({timesTaken:o.target.value?Number(o.target.value):null}),className:`${Ns} w-16 text-center py-1.5`})]}),t.jsx("div",{className:"ml-auto",children:t.jsx(He,{onConfirm:r})})]}),!n&&t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:Ss,children:l("buildProfile.testing.overallBand")}),t.jsx("input",{type:"number",min:"0",max:"9",step:"0.5",value:e.overallBand??"",onChange:o=>s({overallBand:o.target.value?Number(o.target.value):null}),className:`${Ns} mt-1.5`,placeholder:"0–9"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:l("buildProfile.testing.rangeHint",{range:"0–9"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Ss,children:l("buildProfile.testing.dateTaken")}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:e.overallDate,onChange:o=>s({overallDate:o})})})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-bold text-slate-700 mb-2",children:l("buildProfile.testing.bandScores")}),t.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:Ss,children:l("buildProfile.testing.reading")}),t.jsx("input",{type:"number",min:"0",max:"9",step:"0.5",value:e.readingScore??"",onChange:o=>s({readingScore:o.target.value?Number(o.target.value):null}),className:`${Ns} mt-1.5 text-center`,placeholder:"0–9"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:"0–9"})]}),t.jsxs("div",{children:[t.jsx("label",{className:Ss,children:l("buildProfile.testing.listening")}),t.jsx("input",{type:"number",min:"0",max:"9",step:"0.5",value:e.listeningScore??"",onChange:o=>s({listeningScore:o.target.value?Number(o.target.value):null}),className:`${Ns} mt-1.5 text-center`,placeholder:"0–9"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:"0–9"})]}),t.jsxs("div",{children:[t.jsx("label",{className:Ss,children:l("buildProfile.testing.speaking")}),t.jsx("input",{type:"number",min:"0",max:"9",step:"0.5",value:e.speakingScore??"",onChange:o=>s({speakingScore:o.target.value?Number(o.target.value):null}),className:`${Ns} mt-1.5 text-center`,placeholder:"0–9"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:"0–9"})]}),t.jsxs("div",{children:[t.jsx("label",{className:Ss,children:l("buildProfile.testing.writing")}),t.jsx("input",{type:"number",min:"0",max:"9",step:"0.5",value:e.writingScore??"",onChange:o=>s({writingScore:o.target.value?Number(o.target.value):null}),className:`${Ns} mt-1.5 text-center`,placeholder:"0–9"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:"0–9"})]})]})]})]})]})}const Cs="w-full rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-sm text-slate-800 shadow-sm transition placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-[#16335F]",ws="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500";function Nu({record:e,onChange:s,onDelete:r,onCollapse:a,collapsed:n}){const{t:l}=Te();return t.jsxs("div",{className:`rounded-[18px] border border-slate-200 shadow-sm ${n?"bg-white":"bg-slate-50/60"}`,children:[t.jsxs("div",{className:`flex items-center gap-3 bg-white px-4 py-3 rounded-t-[18px] ${n?"rounded-b-[18px]":"border-b border-slate-200"}`,children:[t.jsx(tt,{size:18,className:`text-[#16335F]/70 cursor-pointer hover:text-[#16335F] transition-transform ${n?"-rotate-90":""}`,onClick:a}),t.jsx("span",{className:"text-base font-bold text-slate-800",children:l("buildProfile.testing.duolingoTitle")}),t.jsxs("div",{className:"ml-2 flex items-center gap-2",children:[t.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-[0.12em] text-slate-400 whitespace-nowrap",children:l("buildProfile.testing.timesTaken")}),t.jsx("input",{type:"number",min:"0",max:"20",value:e.timesTaken??"",onChange:o=>s({timesTaken:o.target.value?Number(o.target.value):null}),className:`${Cs} w-16 text-center py-1.5`})]}),t.jsx("div",{className:"ml-auto",children:t.jsx(He,{onConfirm:r})})]}),!n&&t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:ws,children:l("buildProfile.testing.overall")}),t.jsx("input",{type:"number",min:"10",max:"160",value:e.overallScore??"",onChange:o=>s({overallScore:o.target.value?Number(o.target.value):null}),className:`${Cs} mt-1.5`,placeholder:"10–160"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:l("buildProfile.testing.rangeHint",{range:"10–160"})})]}),t.jsxs("div",{children:[t.jsx("label",{className:ws,children:l("buildProfile.testing.dateTaken")}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:e.overallDate,onChange:o=>s({overallDate:o})})})]})]}),t.jsxs("div",{children:[t.jsxs("p",{className:"text-sm font-bold text-slate-700 mb-2",children:[l("buildProfile.testing.subscores"),t.jsx("span",{className:"ml-1 text-[10px] px-1.5 py-0.5 bg-slate-100 rounded text-slate-400 font-medium",children:l("buildProfile.testing.optional")})]}),t.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:ws,children:l("buildProfile.testing.literacy")}),t.jsx("input",{type:"number",min:"10",max:"160",value:e.literacyScore??"",onChange:o=>s({literacyScore:o.target.value?Number(o.target.value):null}),className:`${Cs} mt-1.5 text-center`,placeholder:"10–160"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:"10–160"})]}),t.jsxs("div",{children:[t.jsx("label",{className:ws,children:l("buildProfile.testing.comprehension")}),t.jsx("input",{type:"number",min:"10",max:"160",value:e.comprehensionScore??"",onChange:o=>s({comprehensionScore:o.target.value?Number(o.target.value):null}),className:`${Cs} mt-1.5 text-center`,placeholder:"10–160"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:"10–160"})]}),t.jsxs("div",{children:[t.jsx("label",{className:ws,children:l("buildProfile.testing.conversation")}),t.jsx("input",{type:"number",min:"10",max:"160",value:e.conversationScore??"",onChange:o=>s({conversationScore:o.target.value?Number(o.target.value):null}),className:`${Cs} mt-1.5 text-center`,placeholder:"10–160"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:"10–160"})]}),t.jsxs("div",{children:[t.jsx("label",{className:ws,children:l("buildProfile.testing.production")}),t.jsx("input",{type:"number",min:"10",max:"160",value:e.productionScore??"",onChange:o=>s({productionScore:o.target.value?Number(o.target.value):null}),className:`${Cs} mt-1.5 text-center`,placeholder:"10–160"}),t.jsx("p",{className:"text-[10.5px] text-slate-400 mt-0.5 font-medium",children:"10–160"})]})]})]})]})]})}const Su=["2-D Art and Design","3-D Art and Design","Art History","Drawing","Music Theory","English L
2anguage and Composition","English Literature and Composition","African American Studies","Comparative Government and Politics","European History","Human Geography","Macroeconomics","Microeconomics","Psychology","United States Government and Politics","United States History","World History: Modern","Calculus AB","Calculus BC","Computer Science A","Computer Science Principles","Precalculus","Statistics","Biology","Chemistry","Environmental Science","Physics 1: Algebra-Based","Physics 2: Algebra-Based","Physics C: Electricity and Magnetism","Physics C: Mechanics","Chinese Language and Culture","French Language and Culture","German Language and Culture","Italian Language and Culture","Japanese Language and Culture","Latin","Spanish Language and Culture","Spanish Literature and Culture","Research","Seminar"],Na="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500",Cu=["1","2","3","4","5"];function wu({record:e,onChange:s}){return t.jsxs("div",{className:"flex-1 grid grid-cols-3 gap-3 min-w-0",children:[t.jsxs("div",{children:[t.jsx("label",{className:Na,children:"Subject"}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Q,{value:e.subject,onChange:r=>s({subject:r}),options:[...Su],searchable:!0})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Na,children:"Score"}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Q,{value:e.score!=null?String(e.score):"",onChange:r=>s({score:r?Number(r):null}),options:Cu})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Na,children:"Date"}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:e.date,onChange:r=>s({date:r})})})]})]})}const Pu=["Language A: Literature","Language A: Language and Literature","Language B","Language ab initio","Business Management","Economics","Geography","Global Politics","History","Information Technology in a Global Society","Philosophy","Psychology","Social and Cultural Anthropology","World Religions","Biology","Chemistry","Computer Science","Design Technology","Environmental Systems and Societies","Physics","Sports Exercise and Health Science","Mathematics: Analysis and Approaches","Mathematics: Applications and Interpretation","Dance","Film","Music","Theatre","Visual Arts"],Er="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500",Au=["HL","SL"],Tu=["1","2","3","4","5","6","7"];function Iu({record:e,onChange:s}){return t.jsxs("div",{className:"flex-1 grid grid-cols-4 gap-3 min-w-0",children:[t.jsxs("div",{children:[t.jsx("label",{className:Er,children:"Subject"}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Q,{value:e.subject,onChange:r=>s({subject:r}),options:[...Pu],searchable:!0})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Er,children:"Level"}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Q,{value:e.level,onChange:r=>s({level:r}),options:Au})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Er,children:"Score"}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Q,{value:e.score!=null?String(e.score):"",onChange:r=>s({score:r?Number(r):null}),options:Tu})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Er,children:"Date"}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:e.date,onChange:r=>s({date:r})})})]})]})}const ku=["Literature","U.S. History","World History","Math Level 1","Math Level 2","Biology E/M","Chemistry","Physics","French","German","Spanish","Modern Hebrew","Italian","Latin","French with Listening","German with Listening","Spanish with Listening","Chinese with Listening","Japanese with Listening","Korean with Listening"],Sa="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500",Du=Array.from({length:41},(e,s)=>String(400+s*10));function Eu({record:e,onChange:s}){return t.jsxs("div",{className:"flex-1 grid grid-cols-3 gap-3 min-w-0",children:[t.jsxs("div",{children:[t.jsx("label",{className:Sa,children:"Subject"}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Q,{value:e.subject,onChange:r=>s({subject:r}),options:[...ku],searchable:!0})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Sa,children:"Score"}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Q,{value:e.score!=null?String(e.score):"",onCh
2ange:r=>s({score:r?Number(r):null}),options:Du})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Sa,children:"Date"}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:e.date,onChange:r=>s({date:r})})})]})]})}const Ou=["Mathematics","Further Mathematics","Physics","Chemistry","Biology","Computer Science","Information Technology","Marine Science","Environmental Management","English Language","English Literature","French","Spanish","German","Chinese","Arabic","Urdu","Hindi","Art and Design","Music","Drama","History","Geography","Economics","Business","Accounting","Law","Psychology","Sociology","Divinity","Global Perspectives & Research","Thinking Skills","General Paper"],Or="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500",_u=["AS Level","A Level"],Mu=["A*","A","B","C","D","E","U"];function Fu({record:e,onChange:s}){return t.jsxs("div",{className:"flex-1 grid grid-cols-4 gap-3 min-w-0",children:[t.jsxs("div",{children:[t.jsx("label",{className:Or,children:"Subject"}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Q,{value:e.subject,onChange:r=>s({subject:r}),options:[...Ou],searchable:!0})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Or,children:"Level"}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Q,{value:e.level,onChange:r=>s({level:r}),options:_u})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Or,children:"Grade"}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Q,{value:e.grade,onChange:r=>s({grade:r}),options:Mu})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Or,children:"Date"}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:e.date,onChange:r=>s({date:r})})})]})]})}function Ru({type:e,records:s,onUpdate:r,onDelete:a,onAdd:n,collapsed:l,onToggleCollapse:o}){const{t:f}=Te();return t.jsxs("div",{className:"rounded-[18px] border border-slate-200 bg-slate-50/60 shadow-sm",children:[t.jsxs("div",{className:"flex items-center gap-2 bg-white px-4 py-3 rounded-t-[18px] border-b border-slate-200 cursor-pointer",onClick:o,children:[t.jsx(tt,{size:18,className:`text-[#16335F]/70 transition-transform ${l?"-rotate-90":""}`}),t.jsx("span",{className:"text-xs font-bold text-slate-500 uppercase tracking-[0.12em]",children:f(`stragglerUi.subjectTest.group.${e}`)}),t.jsx("span",{className:"text-xs text-slate-400",children:f("stragglerUi.subjectTest.added",{count:s.length})})]}),!l&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"divide-y divide-slate-100",children:s.map(S=>t.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[Lu(e,S,r),t.jsx("div",{className:"mt-6 flex-shrink-0",children:t.jsx(He,{onConfirm:()=>a(S.id),size:18})})]},S.id))}),t.jsx("div",{className:"px-4 py-3 border-t border-slate-100",children:t.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1.5 text-xs font-semibold text-[#16335F] hover:text-[#1a3d72] transition",children:[t.jsx(qe,{size:13}),f(`stragglerUi.subjectTest.add.${e}`)]})})]})]})}function Lu(e,s,r){const a=n=>r(s.id,n);switch(e){case"AP":return t.jsx(wu,{record:s,onChange:a});case"IB":return t.jsx(Iu,{record:s,onChange:a});case"SAT_Subject":return t.jsx(Eu,{record:s,onChange:a});case"Cambridge":return t.jsx(Fu,{record:s,onChange:a})}}const gn=3,zu=e=>`build_profile_testing_${e}`,_r=()=>({...Fc,futurePlansByType:{}}),Bu=e=>ol.includes(e),Uu=e=>{if(e==null||e==="")return"";const s=Number(e);if(!Number.isFinite(s))return"";const r=Math.max(0,Math.min(gn,Math.trunc(s)));return String(r)},$u=e=>Array.isArray(e)?e.filter(s=>typeof s=="string").map(s=>s.trim()).slice(0,gn):[],Vu=e=>{const s=Uu(e==null?void 0:e.expectedSittings),r=$u(e==null?void 0:e.futureDates),a=s===""&&r.length>0?String(r.length):s,n=a===""?0:Math.min(gn,Number(a));return{expectedSittings:a,futureDates:r.slice(0,n)}},Ku=e=>e.expectedSittings!==""||e.futureDates.some(s=>s.length>0),qu=e=>{if(!e)return _r();try{const s=localStorage.getItem(zu(e));if(!s)return _r();const r=JSON.parse(s),a=r.futurePlansByType&&typeof r.futurePlansByType=="object"?r.futurePlansByType:{},n=Object.entries(a).reduce((l,[o,f])=>{if(!Bu(o))return l;const S=Vu(f);return Ku(S)&&(l[o]=S),l},{});return{..._r(),futurePlansByType:n}}catch{return _r()}},Hu=()=>({...Kn,futureDates:[...Kn.futureDates]}),Gu=["AP","IB","SAT_Subject","Cambridge"],Sl=3,Yu="w-full rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-sm text-slate-800 shadow-sm transition placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-[#16335F]",xi="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500",Wu=[{value:"",label:""},{value:"0",label:"0"},{value:"1",label:"1"},{value:"2",label:"2"},{value:"3",label:"3"}];function Ju(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function Qu(e){const s=Ju();switch(e){case"ACT":return{id:s,type:"ACT",timesTaken:null,compositeScore:null,compositeDate:"",englishScore:null,englishDate:"",mathScore:null,mathDate:"",readingScore:null,readingDate:"",scienceScore:null,scienceDate:"",writingTaken:!1,writingScore:null,writingDate:""};case"SAT":return{id:s,type:"SAT",timesTaken:null,ebrwScore:null,ebrwDate:"",mathScore:null,mathDate:""};case"TOEFL":return{id:s,type:"TOEFL",timesTaken:null,totalScore:null,totalDate:"",readingScore:null,listeningScore:null,speakingScore:null,writingScore:null};case"PTE":return{id:s,type:"PTE",timesTaken:null,overallScore:null,overallDate:"",listeningScore:null,readingScore:null,speakingScore:null,writingScore:null};
2case"IELTS":return{id:s,type:"IELTS",timesTaken:null,overallBand:null,overallDate:"",listeningScore:null,readingScore:null,speakingScore:null,writingScore:null};case"Duolingo":return{id:s,type:"Duolingo",timesTaken:null,overallScore:null,overallDate:"",literacyScore:null,comprehensionScore:null,conversationScore:null,productionScore:null};case"AP":return{id:s,type:"AP",subject:"",score:null,date:""};case"IB":return{id:s,type:"IB",subject:"",level:"",score:null,date:""};case"SAT_Subject":return{id:s,type:"SAT_Subject",subject:"",score:null,date:""};case"Cambridge":return{id:s,type:"Cambridge",subject:"",level:"",grade:"",date:""}}}function bi(e){return Os.includes(e)}function Xu({type:e,plan:s,onChange:r}){const{t:a}=Te(),n=s.expectedSittings===""?0:Number(s.expectedSittings),l=cl[e];return t.jsxs("div",{className:"rounded-[18px] border border-dashed border-slate-200 bg-white px-4 py-4 shadow-sm",children:[t.jsx("div",{className:"mb-4",children:t.jsx("h3",{className:"text-sm font-bold text-slate-800",children:a("buildProfile.testing.futureSittingsTitle",{test:l})})}),t.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:t.jsxs("div",{children:[t.jsx("label",{className:xi,children:a("buildProfile.testing.futureSittingsCount",{test:l})}),t.jsx(Q,{value:s.expectedSittings,onChange:o=>{const f=o===""?0:Number(o),S=Array.from({length:f},(j,C)=>s.futureDates[C]??"");r({expectedSittings:o,futureDates:S})},options:Wu,className:`${Yu} mt-1.5`})]})}),n>0&&t.jsx("div",{className:"mt-4 grid gap-4 lg:grid-cols-2",children:Array.from({length:Math.min(n,Sl)},(o,f)=>t.jsxs("div",{children:[t.jsx("label",{className:xi,children:a("buildProfile.testing.futureDateLabel",{test:l,index:f+1})}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Le,{value:s.futureDates[f]??"",onChange:S=>{const j=Array.from({length:n},(C,d)=>s.futureDates[d]??"");j[f]=S,r({expectedSittings:s.expectedSittings,futureDates:j})}})})]},`${e}-future-date-${f+1}`))})]})}function Zu({profile:e,testingExtension:s,testingUiState:r,pendingSuggestions:a=[],onChange:n,onDeleteRecord:l,onTestingExtensionChange:o,onTestingUiStateChange:f,onAutoFill:S,autoFillLoading:j,pendingCount:C=0,onAcceptPendingSuggestion:d,onDismissPendingSuggestion:h}){const{t:v}=Te(),b=e.testRecords??[],[p,z]=c.useState(()=>new Set((r==null?void 0:r.expandedIds)??[])),[H,Z]=c.useState(()=>new Set((r==null?void 0:r.collapsedGroups)??[]));c.useEffect(()=>{const I=new Set(b.map(y=>y.id));z(y=>{const A=new Set(Array.from(y).filter(N=>I.has(N)));return A.size===y.size?y:A});const u=new Set(b.filter(y=>Gu.includes(y.type)).map(y=>y.type));Z(y=>{const A=new Set(Array.from(y).filter(N=>u.has(N)));return A.size===y.size?y:A})},[b]),c.useEffect(()=>{f==null||f({expandedIds:Array.from(p),collapsedGroups:Array.from(H)})},[H,p,f]);const G=c.useCallback(I=>n("testRecords",I),[n]),B=c.useCallback(I=>{if(b.length>=cs)return;const u=Qu(I);G([...b,u]),z(y=>new Set(y).add(u.id))},[b,G]),U=c.useCallback(I=>{const u=b.filter(y=>y.id!==I);G(u),z(y=>{const A=new Set(y);return A.delete(I),A}),l==null||l(u)},[l,b,G]),q=c.useCallback((I,u)=>{G(b.map(y=>y.id===I?{...y,...u}:y))},[b,G]),ce=c.useCallback((I,u)=>{const y=u.expectedSittings===""?0:Number(u.expectedSittings),A={expectedSittings:u.expectedSittings,futureDates:Array.from({length:Math.min(y,Sl)},(X,E)=>u.futureDates[E]??"")},N=A.expectedSittings!==""||A.futureDates.some(X=>X.trim().length>0),w={...s.futurePlansByType};N?w[I]=A:delete w[I],o({...s,futurePlansByType:w})},[o,s]),ee=c.useCallback(I=>{z(u=>{const y=new Set(u);return y.has(I)?y.delete(I):y.add(I),y})},[]),ne=c.useCallback(I=>{Z(u=>{const y=new Set(u);return y.has(I)?y.delete(I):y.add(I),y})},[]),ie=c.useMemo(()=>Os.filter(I=>b.some(u=>u.type===I)),[b]),K=c.useMemo(()=>b.filter(I=>bi(I.type)),[b]),Ce=c.useMemo(()=>{const I=[],u=["AP","IB","SAT_Subject","Cambridge"];for(const y of u){const A=b.filter(N=>N.type===y);A.length>0&&I.push({type:y,records:A})}return I},[b]),xe=c.useMemo(()=>K.filter(I=>bi(I.type)),[K]);function k(I,u){const y=()=>ee(I.id),A=()=>U(I.id),N=w=>q(I.id,w);switch(I.type){case"ACT":return t.jsx(xu,{record:I,onChange:N,onDelete:A,onCollapse:y,collapsed:u});case"SAT":return t.jsx(bu,{record:I,onChange:N,onDelete:A,onCollapse:y,collapsed:u});case"TOEFL":return t.jsx(yu,{record:I,onChange:N,onDelete:A,onCollapse:y,collapsed:u});case"PTE":return t.jsx(vu,{record:I,onChange:N,onDelete:A,onCollapse:y,collapsed:u});case"IELTS":return t.jsx(ju,{record:I,onChange:N,onDelete:A,onCollapse:y,collapsed:u});case"Duolingo":return t.jsx(Nu,{record:I,onChange:N,onDelete:A,onCollapse:y,collapsed:u});default:return null}}return t.jsxs("section",{className:"rounded-2xl bg-white p-6 shadow-sm ring-1 ring-black/5",children:[t.jsx(us,{id:"section-testing",title:v("buildProfile.sections.testing"),subtitle:b.length>
20?b.length!==1?v("buildProfile.testing.testCountPlural",{count:b.length}):v("buildProfile.testing.testCountSingular",{count:b.length}):void 0,pendingCount:C,onAutoFill:S,autoFillLoading:j}),t.jsxs("div",{"data-review-field":"testRecords",children:[a.length>0&&d&&h&&t.jsx(_s,{suggestions:a,onAccept:d,onDismiss:h}),b.length===0?t.jsxs("div",{className:"rounded-xl border border-dashed border-slate-300 py-10 text-center",children:[t.jsx("div",{className:"mx-auto mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-[#EEF3FB]",children:t.jsx(Pc,{size:20,className:"text-[#16335F]"})}),t.jsx("p",{className:"text-sm font-semibold text-slate-600",children:v("buildProfile.testing.noTestScores")}),t.jsx("p",{className:"mt-1 text-xs text-slate-400",children:v("buildProfile.testing.addTestHint")}),t.jsx("div",{className:"mt-4 flex justify-center",children:t.jsx(gi,{onAdd:B,disabledTypes:[],totalCount:0,maxCount:cs})})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-4",children:[K.map(I=>{const u=!p.has(I.id);return t.jsx("div",{children:k(I,u)},I.id)}),K.length>0&&Ce.length>0&&t.jsxs("div",{className:"relative flex items-center py-1",children:[t.jsx("div",{className:"flex-1 border-t border-dashed border-slate-200"}),t.jsx("span",{className:"mx-3 text-[11px] font-bold uppercase tracking-[0.14em] text-slate-400",children:v("buildProfile.testing.subjectTests")}),t.jsx("div",{className:"flex-1 border-t border-dashed border-slate-200"})]}),Ce.map(({type:I,records:u})=>t.jsx(Ru,{type:I,records:u,onUpdate:q,onDelete:U,onAdd:()=>B(I),collapsed:H.has(I),onToggleCollapse:()=>ne(I)},I))]}),t.jsx("div",{className:"mt-4",children:t.jsx(gi,{onAdd:B,disabledTypes:ie,totalCount:b.length,maxCount:cs})})]}),xe.length>0?t.jsx("div",{className:"mt-4",children:t.jsx(hn,{description:v("buildProfile.testing.futureDatesDescription"),children:t.jsx("div",{className:"space-y-3",children:xe.map(I=>t.jsx(Xu,{type:I.type,plan:s.futurePlansByType[I.type]??Hu(),onChange:u=>ce(I.type,u)},`future-sittings-${I.id}`))})})}):null]})]})}const Ca="mt-1.5 w-full rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-sm text-slate-800 shadow-sm transition placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-[#16335F]",wa="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500",em=[{value:"",label:""},"Yes","No"];function tm({profile:e,academicExtension:s,pendingFields:r={},reviewFields:a={},missingFields:n,pendingSuggestions:l=[],onChange:o,onAcademicExtensionChange:f,onAutoFill:S,autoFillLoading:j,pendingCount:C=0,onAcceptPendingSuggestion:d,onDismissPendingSuggestion:h,onAcceptReviewSuggestion:v,onDismissReviewSuggestion:b}){const{t:p}=Te(),[z,H]=c.useState(""),[Z,G]=c.useState(null),B=c.useRef(null),U=c.useRef(""),q=r.intendedMajor,ce=q?void 0:a.intendedMajor,ee=r.isUndecidedAboutMajor,ne=ee?void 0:a.isUndecidedAboutMajor,ie=r.secondChoiceMajor,K=ie?void 0:a.secondChoiceMajor,Ce=(E,oe)=>{const je=r[E];return je?String(je.suggestedValue??""):oe},xe=Ce("isUndecidedAboutMajor",s.isUndecidedAboutMajor),k=Ce("secondChoiceMajor",s.secondChoiceMajor),I=!!(n!=null&&n.has("intendedMajor")),u=(E,oe,je=!1)=>`${E?ks(wa,!0):or(wa,!!oe)}${je?" text-rose-600":""}`,y=(E,oe,je=Ca,Ie=!1)=>`${E?Is(je,!0):lr(je,!!oe)}${Ie?" border-rose-300 bg-rose-50 ring-2 ring-rose-200 focus:ring-rose-500":""}`,A=(E,oe)=>G(oe?E:null),N=c.useCallback(()=>{const E=z.trim();if(E){if(e.additionalInterests.includes(E)){H("");return}o("additionalInterests",[...e.additionalInterests,E]),H("")}},[z,e.additionalInterests,o]),w=c.useCallback(E=>{o("additionalInterests",e.additionalInterests.filter(oe=>oe!==E))},[e.additionalInterests,o]),X=c.useCallback(E=>{E.key==="Enter"&&(E.preventDefault(),N())},[N]);return c.useEffect(()=>{const E=[["intendedMajor",ce],["isUndecidedAboutMajor",ne],["secondChoiceMajor",K]],oe=E.find(([,Ie])=>!!Ie),je=E.map(([Ie,Ae])=>`${Ie}:${(Ae==null?void 0:Ae.suggestionId)??""}`).join("|");if(!oe||!oe[1]){U.current="",G(null);return}U.current!==je&&(G(oe[0]),U.current=je)},[ce,ne,K]),c.useEffect(()=>{if(!Z)return;const E=oe=>{const je=B.current,Ie=oe.target;if(!je||!Ie)return;const Ae=je.querySelector(`[data-review-field="${Z}"]`);Ae!=null&&Ae.contains(Ie)||G(null)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[Z]),t.jsxs("section",{ref:B,className:"rounded-2xl bg-white p-6 shadow-sm ring-1 ring-black/5",children:[t.jsx(us,{id:"section-academic",title:p("buildProfile.sections.academic"),pendingCount:C,onAutoFill:S,autoFillLoading:j}),l.length>0&&d&&h&&t.jsx(_s,{suggestions:l,onAccept:d,onDismiss:h}),t.jsxs("div",{className:"group relative z-0 mb-4 hover:z-30 focus-within:z-30","data-review-field":"intendedMajor",children:[t.jsxs("label",{className:u(q,ce,I),children:[p("buildProfile.academicInterests.intendedMajor")," ",t.jsx("span",{className:"text-red-500",children:"*"})]}),t.jsx("input",{type:"text","aria-invalid":I||void 0,className:y(q,ce,Ca,I),autoComplete:"new-password",placeholder:p("buildProfile.academicInterests.intendedMajorPlaceholder"),value:e.intendedMajor,onFocus:()=>A("intendedMajor",ce),onClick:()=>A("intendedMajor",ce),onChange:E=>o("intendedMajor",E.target.value)}),t.jsx(Y,{suggestion:q,onAccept:d,onDismiss:h}),Z==="intendedMajor"?t.jsx(W,{suggestion:ce,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"mb-4 grid gap-4 lg:grid-cols-2",children:[t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"isUndecidedAboutMajor",onClick:()=>A("isUndecidedAboutMajor",ne),children:[t.jsx("label",{className:u(ee,ne),children:p("buildProfile.academicInterests.undecidedAboutMajor")}),t.jsx("div",{className:"mt-1.5",children:t.jsx(Q,{value:xe,onChange:E=>f({...s,isUndecidedAboutMajor:E}),options:em.map(E=>E),placeholder:p("buildProfile.personalInfo.select"),className:y(ee,ne,""),suppressOpen:!!(ne&&Z!=="isUndecidedAboutMajor")})}),t.jsx(Y,{suggestion:ee,onAccept:d,onDismiss:h}),Z==="isUndecidedAboutMajor"?t.jsx(W,{suggestion:ne,onAccept:v,onDismiss:b}):null]}),t.jsxs("div",{className:"group relative z-0 hover:z-30 focus-within:z-30","data-review-field":"secondChoiceMajor",children:[t.jsx("label",{className:u(ie,K),children:p("buildProfile.academicInterests.secondChoiceMajor")}),t.jsx("input",{type:"text",className:y(ie,K),placeholder:p("buildProfile.academicInterests.secondChoiceMajorPlaceholder"),value:k,onFocus:()=>A("secondChoiceMajor",K),onClick:()=>A("secondChoiceMajor",K),onChange:E=>f({...s,secondChoiceMajor:E.target.value})}),t.jsx(Y,{suggestion:ie,onAccept:d,onDismiss:h}),Z==="secondChoiceMajor"?t.jsx(W,{suggestion:K,onAccept:v,onDismiss:b}):null]})]}),t.jsxs("div",{"data-review-field":"additionalInterests",children:[t.jsx("label",{className:ks(wa,l.length>0),children:p("buildProfile.academicInterests.additionalInterests")}),e.additionalInterests.length>0&&t.jsx("div",{className:"mt-1.5 flex flex-wrap gap-2",children:e.additionalInterests.map(E=>t.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-[#EEF3FB] px-3 py-1 text-xs font-semibold text-[#16335F]",children:[E,t.jsx("button",{type:"button",onClick:()=>w(E),className:"ml-0.5 text-[#16335F]/60 hover:text-[#16335F]",children:t.jsx(Tt,{size:12})})]},E))}),t.jsxs("div",{className:"mt-1.5 flex gap-2",children:[t.jsx("input",{type:"text",className:Is(Ca,l.length>0),placeholder:p("buildProfile.academicInterests.addInterestPlaceholder"),value:z,onChange:E=>H(E.target.value),onKeyDown:X}),t.jsx("button",{type:"button",onClick:N,className:"mt-1.5 shrink-0 rounded-xl border border-slate-200 bg-white px-4 py-2.5 text-sm font-medium text-slate-700 shadow-sm transition hover:bg-slate-50",children:p("buildProfile.academicInterests.add")})]})]})]})}function Wa(e){const s=e.trim().toLowerCase();return s==="athletics"||s.startsWith("athletics:")}function sm(e){return{category:e,...Wa(e)?{}:{sportTeam:""}}}const $t="w-full rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-sm text-slate-800 shadow-sm transition placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-[#16335F]",Xe="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500",Pa="flex items-start gap-2 rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm text-slate-700 transition hover:border-slate-300 hover:bg-slate-50",rm=[9,10,11,12],yi=10,am=50,nm=100,Aa=150,Ta=150,im=[{value:"",label:""},"Yes","No"],lm=["During school year","During school break","All year"],om=["Archery","Badminton","Baseball","Basketball","Bowling","Boxing","Cheerleading","Cricket","Cross-country","Diving","Equestrian","Fencing","Field Hockey","Figure Skating","Football","Football (non-tackle)","Golf","Gymnastics","Handball","Ice Hockey","Indoor Track","Judo","Lacrosse","Other Sport","Outdoor Track","Racquetball","Rifle","Rock climbing, Bouldering","Rodeo","Rowing (Crew)","Rugby","Sailing","Skiing","Skin Diving","Soccer","Softball","Squash","Swim","Sync. swimming","Table Tennis","Tennis","Track and field","Triathlon","Ultimate Frisbee","Volleyball","Water polo","Weight lifting","Wrestling"],cm=["Assisting family or household members with tasks such as doctors' appointments, bank visits, or visa interviews","Farm work or unpaid work for a family business","Interpreting or translating for family or household members","Managing family or household finances, budget, or paying bills","Providing transportation for family or household members","Taking care of sick, disabled, and/or elderly members of my family or household","Taking care of younger family or household members","Taking care of my own child or children","Working at a paid job to contribute to my household's income",tr,vt],dm=["Commuting 60 minutes or more to and from school each day","Experiencing homelessness or another unstable living situation","Living without consistent heat, power, water, or access to food","Living without reliable or usable internet","Living independently or living on my own (not including boarding school)",vt];function um(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function mm(){return{id:um(),name:"",category:dl[0],role:"",gradeLevels:[],hoursPerWeek:null,weeksPerYear:null,description:"",organizationName:"",sportTeam:"",timingOfParticipation:[],intendsToParticipateInCollege:""}}function hm({profile:e,activitiesExtension:s,pendingSuggestions:r=[],pendingFields:a={},reviewFields:n={},onChange:l,onActivitiesExtensionChange:o,onAutoFill:f,autoFillLoading:S,pendingCount:j=0,onAcceptPendingSuggestion:C,onDismissPendingSuggestion:d,onAcceptReviewSuggestion:h,onDismissReviewSuggestion:v}){const{t:b}=Te(),p=e.activities,[z,H]=c.useState(!1),Z=a.activityOtherResponsibilitiesDescription,G=Z?void 0:n.activityOtherResponsibilitiesDescription,B=Z?String(Z.suggestedValue??""):s.otherResponsibilitiesDescription,U=s.responsibilities.includes(tr)||!!Z||!!G,q=Z?ks(Xe,!0):or(Xe,!!G),ce=Z?Is($t,!0):lr($t,!!G),ee=c.useCallback(A=>{l("activities",A)},[l]),ne=c.useCallback(A=>{o({...s,...A})},[s,o]),ie=c.useCallback((A,N)=>{ee(p.map(w=>w.id===A?{...w,...N}:w))},[p,ee]),K=c.useCallback(()=>{p.length>=yi||ee([...p,mm()])},[p,ee]),Ce=c.useCallback(A=>{ee(p.filter(N=>N.id!==A))},[p,ee]),xe=c.useCallback((A,N)=>{ee(p.map(w=>w.id===A?{...w,...N}:w))},[p,ee]),k=c.useCallback((A,N)=>{const w=p.find(E=>E.id===A);if(!w)return;const X=w.gradeLevels.includes(N)?w.gradeLevels.filter(E=>E!==N):[...w.gradeLevels,N];xe(A,{gradeLevels:X})},[p,xe]),I=c.useCallback((A,N)=>{const w=p.find(oe=>oe.id===A);if(!w)return;const X=w.timingOfParticipation.includes(N);if(N==="All year"){ie(A,{timingOfParticipation:X?[]:["All year"]});return}const E=X?w.timingOfParticipation.filter(oe=>oe!==N):[...w.timingOfParticipation.filter(oe=>oe!=="All year"),N];ie(A,{timingOfParticipation:E})},[p,ie]),u=c.useCallback(A=>{const N=s.responsibilities,w=N.includes(A);if(A===vt){ne({responsibilities:w?[]:[vt],otherResponsibilitiesDescription:""});return}const X=w?N.filter(E=>E!==A):[...N.filter(E=>E!==vt),A];ne({responsibilities:X,otherResponsibilitiesDescription:X.includes(tr)?s.otherResponsibilitiesDescription:""})},[s.otherResponsibilitiesDescription,s.responsibilities,ne]),y=c.useCallback(A=>{const N=s.circumstances,w=N.includes(A);if(A===vt){ne({circumstances:w?[]:[vt]});return}const X=w?N.filter(E=>E!==A):[...N.filter(E=>E!==vt),A];ne({circumstances:X})},[s.circumstances,ne]);return t.jsxs("section",{className:"rounded-2xl bg-white p-6 shadow-sm ring-1 ring-black/5",children:[t.jsx(us,{id:"section-activities",t
2itle:b("buildProfile.sections.activities"),subtitle:`${p.length}/10`,pendingCount:j,onAutoFill:f,autoFillLoading:S}),t.jsxs("div",{"data-review-field":"activities",children:[r.length>0&&C&&d&&t.jsx(_s,{suggestions:r,onAccept:C,onDismiss:d}),p.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[t.jsx("p",{className:"mb-4 text-sm text-slate-400",children:b("buildProfile.activities.emptyState")}),t.jsxs("button",{type:"button",onClick:K,className:"rounded-full border border-[#16335F]/15 bg-[#EEF3FB] px-4 py-1.5 text-xs font-semibold text-[#16335F] transition hover:bg-[#dce6f7]",children:[t.jsx(qe,{className:"mr-1 -ml-0.5 inline-block h-3.5 w-3.5"}),b("buildProfile.activities.addFirst")]})]}):t.jsxs("div",{className:"space-y-4",children:[p.map((A,N)=>t.jsxs("div",{className:"rounded-[18px] border border-slate-200 bg-slate-50/60",children:[t.jsxs("div",{className:"flex items-center gap-3 rounded-t-[18px] border-b border-slate-200 bg-white px-4 py-3",children:[t.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-[#16335F] text-[11px] font-bold text-white",children:N+1}),t.jsx("input",{type:"text",className:`${$t} flex-1`,placeholder:b("buildProfile.activities.activityNamePlaceholder"),value:A.name,onChange:w=>xe(A.id,{name:w.target.value})}),t.jsx(He,{onConfirm:()=>Ce(A.id),size:16})]}),t.jsxs("div",{className:"space-y-4 px-4 py-4",children:[t.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:Xe,children:b("buildProfile.activities.activityType")}),t.jsx(Q,{value:A.category,onChange:w=>xe(A.id,sm(w)),options:dl.map(w=>w),searchable:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:Xe,children:b("buildProfile.activities.positionLeadership")}),t.jsx("input",{type:"text",className:`mt-1.5 ${$t}`,maxLength:am,placeholder:b("buildProfile.activities.positionPlaceholder"),value:A.role,onChange:w=>xe(A.id,{role:w.target.value})})]})]}),t.jsxs("div",{className:`grid gap-4 ${Wa(A.category)?"lg:grid-cols-2":""}`,children:[t.jsxs("div",{children:[t.jsx("label",{className:Xe,children:b("buildProfile.activities.organizationName")}),t.jsx("input",{type:"text",className:`mt-1.5 ${$t}`,maxLength:nm,placeholder:b("buildProfile.activities.organizationPlaceholder"),value:A.organizationName,onChange:w=>ie(A.id,{organizationName:w.target.value})})]}),Wa(A.category)?t.jsxs("div",{children:[t.jsx("label",{className:Xe,children:b("buildProfile.activities.sportTeam")}),t.jsx(Q,{value:A.sportTeam,onChange:w=>ie(A.id,{sportTeam:w}),options:om.map(w=>w),searchable:!0})]}):null]}),t.jsxs("div",{children:[t.jsx("label",{className:Xe,children:b("buildProfile.activities.gradeLevels")}),t.jsx("div",{className:"mt-1.5 flex flex-wrap gap-3",children:rm.map(w=>t.jsxs("label",{className:"flex items-center gap-1.5 text-sm text-slate-700",children:[t.jsx("input",{type:"checkbox",className:"rounded border-slate-300 text-[#16335F] focus:ring-[#16335F]",checked:A.gradeLevels.includes(w),onChange:()=>k(A.id,w)}),w]},w))})]}),t.jsxs("div",{children:[t.jsx("label",{className:Xe,children:b("buildProfile.activities.timingOfParticipation")}),t.jsx("div",{className:"mt-1.5 grid gap-2 sm:grid-cols-3",children:lm.map(w=>t.jsxs("label",{className:Pa,children:[t.jsx("input",{type:"checkbox",className:"mt-0.5 rounded border-slate-300 text-[#16335F] focus:ring-[#16335F]",checked:A.timingOfParticipation.includes(w),onChange:()=>I(A.id,w)}),t.jsx("span",{children:w})]},w))})]}),t.jsxs("div",{className:"grid gap-4 lg:grid-cols-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:Xe,children:b("buildProfile.activities.hoursPerWeek")}),t.jsx("input",{type:"number",className:`mt-1.5 ${$t}`,placeholder:"0",min:0,value:A.hoursPerWeek??"",onChange:w=>xe(A.id,{hoursPerWeek:w.target.value?Number(w.target.value):null})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Xe,children:b("buildProfile.activities.weeksPerYear")}),t.jsx("input",{type:"number",className:`mt-1.5 ${$t}`,placeholder:"0",min:0,value:A.weeksPerYear??"",onChange:w=>xe(A.id,{weeksPerYear:w.target.value?Number(w.target.value):null})})]}),t.jsxs("div",{children:[t.jsx("label",{className:Xe,children:b("buildProfile.activities.continueInCollege")}
2),t.jsx(Q,{value:A.intendsToParticipateInCollege,onChange:w=>ie(A.id,{intendsToParticipateInCollege:w}),options:im,placeholder:b("buildProfile.personalInfo.select")})]})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("label",{className:Xe,children:b("buildProfile.activities.description")}),t.jsxs("span",{className:`text-xs ${A.description.length>Aa?"font-semibold text-rose-500":"text-slate-400"}`,children:[A.description.length,"/",Aa]})]}),t.jsx("textarea",{className:`mt-1.5 ${$t} resize-none`,rows:3,maxLength:Aa,placeholder:b("buildProfile.activities.descriptionPlaceholder"),value:A.description,onChange:w=>xe(A.id,{description:w.target.value})})]})]})]},A.id)),p.length<yi&&t.jsx("div",{className:"flex justify-center pt-1",children:t.jsxs("button",{type:"button",onClick:K,className:"rounded-full border border-[#16335F]/15 bg-[#EEF3FB] px-4 py-1.5 text-xs font-semibold text-[#16335F] transition hover:bg-[#dce6f7]",children:[t.jsx(qe,{className:"mr-1 -ml-0.5 inline-block h-3.5 w-3.5"}),b("buildProfile.activities.addActivity")]})})]}),t.jsx("div",{className:"my-6 border-t border-slate-200"}),t.jsxs("div",{className:"rounded-[18px] border border-slate-200 bg-slate-50/60 p-4",children:[t.jsxs("div",{className:"mb-4",children:[t.jsx("h3",{className:"text-[13px] font-bold tracking-wide text-slate-700",children:b("buildProfile.activities.responsibilitiesCircumstances")}),t.jsx("p",{className:"mt-1 text-sm text-slate-500",children:b("buildProfile.activities.responsibilitiesCircumstancesHelp")})]}),t.jsxs("div",{className:"grid gap-6 xl:grid-cols-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:Xe,children:b("buildProfile.activities.responsibilitiesLabel")}),t.jsx("div",{className:"mt-2 space-y-2",children:cm.map(A=>t.jsxs("label",{className:Pa,children:[t.jsx("input",{type:"checkbox",className:"mt-0.5 rounded border-slate-300 text-[#16335F] focus:ring-[#16335F]",checked:s.responsibilities.includes(A),onChange:()=>u(A)}),t.jsx("span",{children:A})]},A))}),U?t.jsxs("div",{className:"group relative z-0 mt-3 hover:z-30 focus-within:z-30","data-review-field":"activityOtherResponsibilitiesDescription",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("label",{className:q,children:b("buildProfile.activities.otherResponsibilityDescription")}),t.jsxs("span",{className:`text-xs ${B.length>Ta?"font-semibold text-rose-500":"text-slate-400"}`,children:[B.length,"/",Ta]})]}),t.jsx("textarea",{rows:3,maxLength:Ta,className:`mt-1.5 ${ce} resize-none`,placeholder:b("buildProfile.activities.otherResponsibilityPlaceholder"),value:B,onFocus:()=>H(!!G),onClick:()=>H(!!G),onChange:A=>ne({otherResponsibilitiesDescription:A.target.value})}),t.jsx(Y,{suggestion:Z,onAccept:C,onDismiss:d}),z?t.jsx(W,{suggestion:G,onAccept:h,onDismiss:v}):null]}):null]}),t.jsxs("div",{children:[t.jsx("label",{className:Xe,children:b("buildProfile.activities.circumstances")}),t.jsx("div",{className:"mt-2 space-y-2",children:dm.map(A=>t.jsxs("label",{className:Pa,children:[t.jsx("input",{type:"checkbox",className:"mt-0.5 rounded border-slate-300 text-[#16335F] focus:ring-[#16335F]",checked:s.circumstances.includes(A),onChange:()=>y(A)}),t.jsx("span",{children:A})]},A))})]})]})]})]})]})}function Ia({label:e,children:s}){const[r,a]=c.useState(!1);return t.jsxs("div",{className:"mb-5 mt-3 overflow-hidden rounded-xl border border-slate-200 bg-white shadow-[0_1px_2px_rgba(15,23,42,0.04)]",children:[t.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>a(n=>!n),className:"flex w-full cursor-pointer items-center justify-between gap-3 px-4 py-3 text-left text-sm font-semibold text-[#16335F] transition hover:bg-[#f4f7fb] hover:text-[#0B1525] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[#16335F]/25",children:[t.jsx("span",{children:e}),t.jsx(tt,{size:16,"aria-hidden":"true",className:`shrink-0 text-slate-500 transition-transform ${r?"rotate-180":""}`})]}),r?t.jsx("div",{className:"border-t border-slate-200 bg-white",children:s}):null]})}function fm(){const{t:e}=Te();return t.jsx("p",{className:pl,children:e("buildProfile.autofillFilledFromDocuments")})}const Ds=5,pm=new Set(ul);function Es(e){return String(e??"").trim().replace(/\s+/g," ").toLowerCase()}function vi(e){return[...e].sort((s,r)=>s-r).join("|")}function Ja(e){return pm.has(e)?e:"School"}function cr(e,s){if(e.mergedProfileHonorIds.some(a=>s.some(n=>n.id===a))||e.profileHonorId&&s.some(a=>a.id===e.profileHonorId))return!0;const r=Es(e.honor.name);return r.length>0&&s.some(a=>Es(a.name)===r)}function gm(e,s,r=Ds){const a=Math.max(0,r-s.length);let n=0;for(const l of e){if(n>=a)break;cr(l,s)||(n+=1)}return n}function Cl(e,s,r=Ds){const a=Math.max(0,r-s.length),n=[];let l=0;for(const o of e){if(cr(o,s)){n.push(o.key);continue}l<a&&n.length<r&&(n.push(o.key),l+=1)}return n}function xm(e,s,r,a){const n=new Set(s),l=[...r],o=new Set(l.map(f=>
2Es(f.name)).filter(Boolean));for(const f of e.recommendedItems){if(!n.has(f.key)||l.length>=Ds||cr(f,l))continue;const S=Es(f.honor.name);S&&o.has(S)||(l.push({id:a(),name:f.honor.name,level:Ja(f.honor.level),gradeLevels:[...f.honor.gradeLevels]}),S&&o.add(S))}return l}function wl(e,s){const r=s?new Set(s):null;return new Set(e.recommendedItems.filter(a=>!r||r.has(a.key)).flatMap(a=>a.mergedSuggestionIds).filter(a=>!!a))}function Qa(e,s){return e.filter(r=>!s.has(r.suggestionId||""))}function bm(e,s){const r=s.recommendedItems.slice(0,Ds);return r.length===0||e.length!==r.length?!1:r.every((a,n)=>{const l=e[n];return l?Es(l.name)===Es(a.honor.name)&&Ja(l.level)===Ja(a.honor.level)&&vi(l.gradeLevels)===vi(a.honor.gradeLevels):!1})}function Hs(e,s){return!e||e.recommendedItems.length===0||bm(s,e)?!1:e.recommendedItems.some(r=>!cr(r,s))}const Gs=5,ym=[],vm=[{value:9,label:"9"},{value:10,label:"10"},{value:11,label:"11"},{value:12,label:"12"},{value:13,label:"Post-graduate"}],jm="mt-1.5 w-full rounded-xl border border-slate-200 bg-white px-3.5 py-2.5 text-sm text-slate-800 shadow-sm transition placeholder-slate-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-[#16335F]",ka="text-[12px] font-semibold uppercase tracking-[0.14em] text-slate-500",os="inline-flex items-center rounded-md px-2 py-0.5 text-[11px] font-medium leading-4",Da=`${os} bg-slate-100 text-slate-500`,Nm=`${os} bg-[#fbf4e0] text-[#8a6a10]`,Sm=`${os} bg-[#e7f4ec] text-[#1f6b45]`,Ys={international:`${os} bg-[#fdba74] text-[#7c2d12] font-semibold`,national:`${os} bg-[#fed7aa] text-[#9a3412] font-semibold`,stateRegional:`${os} bg-[#e8eef0] text-[#5a6e6b]`,school:`${os} bg-[#F3F0EA] text-[#8a8278]`};function Cm(e){const s=e.trim().toLowerCase();return s.includes("international")?Ys.international:s.includes("national")?Ys.national:s.includes("state")||s.includes("regional")?Ys.stateRegional:s.includes("school")?Ys.school:Ys.national}function wm(e){const s=e.suggestedValue;if(s&&typeof s=="object"){const r=s,a=typeof r.name=="string"?r.name.trim():"",n=typeof r.level=="string"?r.level.trim():"",l=Array.isArray(r.gradeLevels)?r.gradeLevels:r.grade_levels,o=Array.isArray(l)?l.map(f=>Number(f)).filter(f=>Number.isFinite(f)):[];if(a)return{name:a,level:n,gradeLevels:o}}return{name:fn(e),level:"",gradeLevels:[]}}function ji(e,s){const r=e.suggestionId||"";return{key:r?`overflow:${r}`:`overflow:${s}`,source:"suggestion",suggestionId:e.suggestionId??null,honor:wm(e),reason:e.reason??null,mergedSuggestionIds:r?[r]:[],mergedProfileHonorIds:[]}}function Pm(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function Am({profile:e,autofillSummary:s,pendingSuggestions:r=[],onChange:a,onAutoFill:n,autoFillLoading:l,pendingCount:o=0,onAcceptPendingSuggestion:f,onDismissPendingSuggestion:S,onApplySelectedHonors:j,autofilledHonorIds:C}){var A;const{t:d}=Te(),h=e.honors,v=c.useCallback((N,w)=>{a("honors",h.map(X=>X.id===N?{...X,...w}:X))},[h,a]),b=c.useCallback(()=>{if(h.length>=Gs)return;const N={id:Pm(),name:"",level:"School",gradeLevels:[]};a("honors",[...h,N])},[h,a]),p=c.useCallback(N=>{a("honors",h.filter(w=>w.id!==N))},[h,a]),z=c.useCallback((N,w)=>{const X=h.find(oe=>oe.id===N);if(!X)return;const E=X.gradeLevels.includes(w)?X.gradeLevels.filter(oe=>oe!==w):[...X.gradeLevels,w];v(N,{gradeLevels:E})},[h,v]),H=(s==null?void 0:s.recommendedItems)??ym,Z=H.map(N=>N.key).join("|"),[G,B]=c.useState([]),U=Math.max(0,Gs-h.length),q=c.useMemo(()=>s?wl(s):new Set,[s]),ce=c.useMemo(()=>Qa(r,q),[q,r]),ee=c.useMemo(()=>ce.map(ji),[ce]),ne=c.useMemo(()=>r.map(ji),[r]),ie=c.useMemo(()=>new Set([...H,...ee,...ne].filter(N=>cr(N,h)).map(N=>N.key)),[ne,h,ee,H]),K=G.filter(N=>!ie.has(N)).length,Ce=h.map(N=>N.id).join("|");c.useEffect(()=>{B(Cl(H,h,Gs))},[h,Ce,Z,H]);const xe=c.useCallback(N=>{B(w=>{if(w.includes(N))return w.filter(E=>E!==N);const X=ie.has(N);return w.length>=Ds||!X&&w.filter(E=>!ie.has(E)).length>=U?w:[...w,N]})},[ie,U]),k=c.useMemo(()=>{const N=new Map;return r.forEach(w=>{w.suggestionId&&N.set(w.suggestionId,w)}),N},[r]),I=H.length>0,u=c.useCallback(N=>N===13?d("buildProfile.honors.postGraduate"):d("buildProfile.honors.gradeWithNumber",{grade:N}),[d]),y=(N,w)=>{const X=N.mergedSuggestionIds.map(Ae=>k.get(Ae)).find(Boolean),E=ie.has(N.key),oe=N.mergedSuggestionIds.length+N.mergedProfileHonorIds.length>1,je=G.includes(N.key),Ie=!je&&(G.length>=Ds||!E&&K>=U);return t.jsx("div",{className:w,children:t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("label",{className:`flex min-w-0 flex-1 items-start gap-3 ${Ie?"cursor-not-allowed":"cursor-pointer"}`,children:[t.jsx("input",{type:"checkbox",checked:je,disabled:Ie,onCh
2ange:()=>xe(N.key),className:"mt-0.5 h-5 w-5 shrink-0 rounded border-slate-300 accent-[#16335F] text-[#16335F] focus:ring-[#16335F] disabled:cursor-not-allowed disabled:opacity-50"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"text-sm font-semibold text-slate-800",children:N.honor.name}),t.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[N.honor.level?t.jsx("span",{className:Cm(N.honor.level),children:N.honor.level}):null,t.jsx("span",{className:E?Sm:Nm,children:d(E?"buildProfile.honors.alreadyInProfile":"buildProfile.honors.recommendedToAdd")}),oe?t.jsx("span",{className:Da,children:d("buildProfile.honors.mergedRepeatedMentions")}):null,N.honor.gradeLevels.length>0?N.honor.gradeLevels.map(Ae=>t.jsx("span",{className:Da,children:u(Ae)},Ae)):t.jsx("span",{className:Da,children:d("buildProfile.honors.gradeNotSpecified")})]}),N.reason?t.jsx("p",{className:"mt-2 text-sm leading-6 text-slate-600",children:N.reason}):null]})]}),X&&f&&S?t.jsxs("div",{className:"flex items-center gap-2",children:[!E&&t.jsx("button",{type:"button",onClick:()=>f(X),className:mn,children:d("buildProfile.honors.accept")}),t.jsx("button",{type:"button",onClick:()=>S(X),className:un,children:d(E?"buildProfile.honors.dismissDuplicate":"buildProfile.honors.dismiss")})]}):null]})},N.key)};return t.jsxs("section",{className:"rounded-2xl bg-white p-6 shadow-sm ring-1 ring-black/5",children:[t.jsx(us,{id:"section-honors",title:d("buildProfile.sections.honors"),subtitle:`${h.length}/${Gs}`,pendingCount:o,onAutoFill:n,autoFillLoading:l}),t.jsxs("div",{"data-review-field":"honors",children:[!I&&ne.length>0&&t.jsx(Ia,{label:d("buildProfile.honors.otherSuggestions",{count:ne.length}),children:ne.map(N=>y(N,"border-t border-slate-200 px-4 py-4 first:border-t-0"))}),I?t.jsxs("div",{className:md,children:[t.jsxs("div",{className:"flex flex-col gap-3 pb-4 sm:flex-row sm:items-start sm:justify-between",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h3",{className:"text-base font-semibold leading-6 text-slate-800",children:d("buildProfile.honors.recommendedCommonApp5")}),t.jsx("p",{className:"mt-2 min-h-5 text-xs font-medium leading-5 text-slate-500",children:d("buildProfile.honors.selectionLimit",{remaining:U})})]}),s&&j?t.jsx(zc,{type:"button",variant:"ghost",size:"sm",disabled:G.length===0,onClick:()=>j({...s,recommendedItems:[...s.recommendedItems,...ee]},G),children:d("buildProfile.honors.applySelected")}):null]}),t.jsx("div",{className:"border-t border-amber-600/25",children:H.map(N=>y(N,"border-t border-amber-600/20 py-4 first:border-t-0"))})]}):null,I&&((A=s==null?void 0:s.mergedGroups)!=null&&A.length)?t.jsx(Ia,{label:d("buildProfile.honors.viewMergedGroups"),children:s.mergedGroups.map(N=>t.jsxs("div",{className:"border-t border-slate-200 px-4 py-3 first:border-t-0",children:[t.jsx("div",{className:"text-sm font-medium text-slate-800",children:N.label}),N.reason?t.jsx("div",{className:"mt-1 text-xs leading-5 text-slate-500",children:N.reason}):null]},N.key))}):null,I&&ee.length>0?t.jsx(Ia,{label:d("buildProfile.honors.otherSuggestions",{count:ee.length}),children:ee.map(N=>y(N,"border-t border-slate-200 px-4 py-4 first:border-t-0"))}):null,h.length>0&&t.jsx("div",{className:"space-y-3",children:h.map((N,w)=>t.jsxs("div",{className:`flex items-start gap-3 rounded-[14px] border border-slate-200 bg-slate-50/60 px-4 py-3 ${C!=null&&C.has(N.id)?fl:""}`,children:[t.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-[#16335F] text-[11px] font-bold text-white",children:w+1}),t.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[t.jsx("label",{className:ka,children:d("buildProfile.honors.honorTitle")}),t.jsx("input",{type:"text",className:jm,placeholder:d("buildProfile.honors.honorTitlePlaceholder"),value:N.name,onChange:X=>v(N.id,{name:X.target.value})}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx("label",{className:ka,children:d("buildProfile.honors.highestLevelOfRecognition")}),t.jsx(Q,{value:N.level,onChange:X=>v(N.id,{level:X}),options:ul.map(X=>X),placeholder:d("buildProfile.personalInfo.select")})]}),t.jsxs("div",{children:[t.jsx("label",{className:ka,children:d("buildProfile.honors.gradeLevel")}),t.jsx("div",{className:"mt-1.5 flex flex-wrap gap-2",children:vm.map(X=>t.jsxs("label",{className:"flex cursor-pointer items-center gap-1.5 text-sm text-slate-700",children:[t.jsx("input",{type:"checkbox",checked:N.gradeLevels.includes(X.value),onChange:()=>
2z(N.id,X.value),className:"h-4 w-4 rounded border-slate-300 text-[#16335F] focus:ring-[#16335F]"}),X.label]},X.value))})]})]}),C!=null&&C.has(N.id)?t.jsx(fm,{}):null]}),t.jsx(He,{onConfirm:()=>p(N.id),size:16})]},N.id))}),h.length===0&&t.jsxs("div",{className:"rounded-xl border border-dashed border-slate-200 px-6 py-8 text-center",children:[t.jsx("p",{className:"text-sm text-slate-500",children:d("buildProfile.honors.emptyState")}),t.jsxs("button",{type:"button",onClick:b,className:"mt-3 inline-flex items-center gap-1.5 rounded-xl bg-[#16335F] px-4 py-2 text-sm font-medium text-white shadow-sm transition hover:bg-[#1a3d72]",children:[t.jsx(qe,{size:16}),d("buildProfile.honors.addHonor")]})]}),h.length>0&&h.length<Gs&&t.jsxs("button",{type:"button",onClick:b,className:"mt-3 inline-flex items-center gap-1.5 rounded-xl border border-slate-200 bg-white px-4 py-2 text-sm font-medium text-slate-700 shadow-sm transition hover:bg-slate-50",children:[t.jsx(qe,{size:16}),d("buildProfile.honors.addHonor")]})]})]})}const Mr="data-autofilled-mark";function Tm({fields:e,caption:s}){return c.useEffect(()=>{if(typeof document>"u")return;const r=new Map,a=()=>{e.forEach(l=>{const o=String(l),f=document.querySelector(`[data-review-field="${o}"]`),S=r.get(o);if(S&&(S.element!==f||!document.contains(S.element))&&(S.cleanup(),r.delete(o)),r.has(o)||!f||f.getAttribute(Mr)==="1")return;const j=f.className;f.setAttribute(Mr,"1"),f.className=`${j} ${fl}`.trim();const C=document.createElement("p");C.setAttribute(Mr,"caption"),C.className=pl,C.textContent=s,f.appendChild(C),r.set(o,{element:f,cleanup:()=>{C.remove(),f.className=j,f.removeAttribute(Mr)}})})};a();const n=new MutationObserver(a);return n.observe(document.body,{childList:!0,subtree:!0}),()=>{n.disconnect(),r.forEach(l=>l.cleanup())}},[s,e]),null}const Im=["personal","family","education","testing","academic","activities","honors"];function km(e,s,r,a=Im){const n=a.flatMap(l=>s[l]??[]);return Nl(e,n,r)}const Dm=e=>`build_profile_academic_${e}`,Fr=()=>({...Rc}),Em=e=>e==null?!1:typeof e=="string"?e.trim().length>0:!0,Om=e=>{if(!e)return Fr();try{const s=localStorage.getItem(Dm(e));if(!s)return Fr();const r=JSON.parse(s);return{...Fr(),...r}}catch{return Fr()}},Ni=e=>Object.values(e).some(s=>Em(s)),_m=e=>`build_profile_activities_${e}`,Rr=()=>({...ya,byActivityId:{},responsibilities:[...ya.responsibilities],circumstances:[...ya.circumstances]}),Pl=e=>e==null?!1:typeof e=="string"?e.trim().length>0:Array.isArray(e)?e.length>0:!0,Xa=e=>Array.isArray(e)?e.filter(s=>typeof s=="string").map(s=>s.trim()).filter(Boolean):[],Mm=e=>({organizationName:typeof(e==null?void 0:e.organizationName)=="string"?e.organizationName:"",sportTeam:typeof(e==null?void 0:e.sportTeam)=="string"?e.sportTeam:"",timingOfParticipation:Xa(e==null?void 0:e.timingOfParticipation),intendsToParticipateInCollege:typeof(e==null?void 0:e.intendsToParticipateInCollege)=="string"?e.intendsToParticipateInCollege:""}),Fm=e=>{if(!e)return Rr();try{const s=localStorage.getItem(_m(e));if(!s)return Rr();const r=JSON.parse(s),a=Rr(),n=r.byActivityId&&typeof r.byActivityId=="object"?r.byActivityId:{};return{...a,byActivityId:Object.fromEntries(Object.entries(n).filter(([l])=>l.trim().length>0).map(([l,o])=>[l,Mm(o)])),responsibilities:Xa(r.responsibilities),otherResponsibilitiesDescription:typeof r.otherResponsibilitiesDescription=="string"?r.otherResponsibilitiesDescription:"",circumstances:Xa(r.circumstances)}}catch{return Rr()}},Rm=e=>Object.entries(e).some(([s,r])=>s==="timingOfParticipation"?Array.isArray(r)&&r.length>0:Pl(r)),Si=e=>e.responsibilities.length>0||e.circumstances.length>0||Pl(e.otherResponsibilitiesDescription)?!0:Object.values(e.byActivityId).some(s=>Rm(s)),Lm=e=>`build_profile_education_${e}`,Lr=()=>({...Ar,otherSecondarySchools:Ar.otherSecondarySchools.map(e=>({...e})),collegeCoursework:Ar.collegeCoursework.map(e=>({...e})),currentCourses:Ar.currentCourses.map(e=>({...e}))}),lt=e=>e==null?!1:typeof e=="string"?e.trim().length>0:!0,Ea=e=>Object.entries(e).some(([s,r])=>s!=="id"&&lt(r)),zm=e=>({id:typeof(e==null?void 0:e.id)=="string"&&e.id.trim().length>0?e.id:`secondary-school-${Date.now()}-${Math.random().toString(36).slice(2,10)}
2`,schoolName:typeof(e==null?void 0:e.schoolName)=="string"?e.schoolName:"",fromDate:typeof(e==null?void 0:e.fromDate)=="string"?e.fromDate:"",toDate:typeof(e==null?void 0:e.toDate)=="string"?e.toDate:"",reasonForLeaving:typeof(e==null?void 0:e.reasonForLeaving)=="string"?e.reasonForLeaving:""}),Bm=e=>({id:typeof(e==null?void 0:e.id)=="string"&&e.id.trim().length>0?e.id:`current-course-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,subject:typeof(e==null?void 0:e.subject)=="string"?e.subject:"",title:typeof(e==null?void 0:e.title)=="string"?e.title:"",level:typeof(e==null?void 0:e.level)=="string"?e.level:"",schedule:typeof(e==null?void 0:e.schedule)=="string"?e.schedule:""}),Um=e=>({id:typeof(e==null?void 0:e.id)=="string"&&e.id.trim().length>0?e.id:`college-coursework-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,collegeName:typeof(e==null?void 0:e.collegeName)=="string"?e.collegeName:"",fromDate:typeof(e==null?void 0:e.fromDate)=="string"?e.fromDate:"",toDate:typeof(e==null?void 0:e.toDate)=="string"?e.toDate:"",degreeEarned:typeof(e==null?void 0:e.degreeEarned)=="string"?e.degreeEarned:"",courseDetails:typeof(e==null?void 0:e.courseDetails)=="string"?e.courseDetails:""}),$m=e=>{if(!e)return Lr();try{const s=localStorage.getItem(Lm(e));if(!s)return Lr();const r=JSON.parse(s);return{...Lr(),...r,otherSecondarySchools:Array.isArray(r.otherSecondarySchools)?r.otherSecondarySchools.map(n=>zm(n)).filter(n=>Ea(n)):[],collegeCoursework:Array.isArray(r.collegeCoursework)?r.collegeCoursework.map(n=>Um(n)).filter(n=>Ea(n)):[],currentCourses:Array.isArray(r.currentCourses)?r.currentCourses.map(n=>Bm(n)).filter(n=>Ea(n)):[]}}catch{return Lr()}},Oa=["currentSchoolEntryDate","boardingSchool","willGraduate","schedulingSystem","hasCollegeCoursework","applicantDescription","highestDegreeIntended","careerInterest"],_a=e=>Object.entries(e).every(([s,r])=>s==="id"||lt(r)),Ci=e=>{const s=Oa.filter(d=>lt(e[d])).length,r=(e.boardingSchool==="Yes"?1:0)+(e.willGraduate==="Yes"?1:0)+(e.careerInterest==="Other"?1:0)+(e.currentCourses.length>0?e.currentCourses.length*4:1)+(e.hasCollegeCoursework==="Yes"?e.collegeCoursework.length>0?e.collegeCoursework.length*5:1:0)+e.otherSecondarySchools.length*4,a=(e.boardingSchool==="Yes"&&lt(e.livesOnCampus)?1:0)+(e.willGraduate==="Yes"&&lt(e.graduationDate)?1:0)+(e.careerInterest==="Other"&&lt(e.otherCareerInterest)?1:0)+e.currentCourses.reduce((d,h)=>d+Object.entries(h).filter(([v,b])=>v!=="id"&&lt(b)).length,0)+e.collegeCoursework.reduce((d,h)=>d+Object.entries(h).filter(([v,b])=>v!=="id"&&lt(b)).length,0)+e.otherSecondarySchools.reduce((d,h)=>d+Object.entries(h).filter(([v,b])=>v!=="id"&&lt(b)).length,0),n=Oa.length+r,l=s+a,o=e.currentCourses.length>0&&e.currentCourses.every(d=>_a(d)),f=e.hasCollegeCoursework==="No"?!0:e.hasCollegeCoursework==="Yes"?e.collegeCoursework.length>0&&e.collegeCoursework.every(d=>_a(d)):!1,S=(e.boardingSchool!=="Yes"||lt(e.livesOnCampus))&&(e.willGraduate!=="Yes"||lt(e.graduationDate))&&(e.careerInterest!=="Other"||lt(e.otherCareerInterest)),j=s>0||e.currentCourses.length>0||e.collegeCoursework.length>0||e.otherSecondarySchools.length>0,C=Oa.every(d=>lt(e[d]))&&o&&f&&S&&e.otherSecondarySchools.every(d=>_a(d));return{started:j,complete:C,filled:l,total:n,percent:n>0?Math.round(l/n*100):0}},Vm=e=>`build_profile_personal_${e}`,zr=()=>({...qn,languages:qn.languages.map(e=>({...e}))}),Al=e=>e==null?!1:typeof e=="string"?e.trim().length>0:Array.isArray(e)?e.length>0:!0,Km=e=>Object.entries(e).some(([s,r])=>s!=="id"&&Al(r)),qm=e=>({id:typeof(e==null?void 0:e.id)=="string"&&e.id.trim().length>0?e.id:`personal-language-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,language:typeof(e==null?void 0:e.language)=="string"?e.language:"",otherLanguageName:typeof(e==null?void 0:e.otherLanguageName)=="string"?e.otherLanguageName:"",proficiency:typeof(e==null?void 0:e.proficiency)=="string"?e.proficiency:""}),Hm=e=>{if(!e)return zr();try{const s=localStorage.getItem(Vm(e));if(!s)return zr();const r=JSON.parse(s);return{...zr(),...r,languages:Array.isArray(r.languages)?r.languages.map(a=>qm(a)).filter(a=>Km(a)):[]}}catch{return zr()}},wi=e=>Object.values(e).some(s=>Al(s));function Gm(e){return e.replace(/_([a-z])/g,(s,r)=>r.toUpperCase())}function Ym(e){const s=Gm(e);return s||null}function Mt(e){return String(e??"").trim()==="Yes"}function Ma(e){return String(e??"").trim()==="Other"}function Fa(e){return String(e??"").trim()==="Non-U.S. Citizen"}function Wm(e){return["U.S. Dual Citizen","U.S. Permanent Resident","Non-U.S. Citizen"].includes(String(e??"").trim())}function Jm(e,s){switch(s){case"otherPronouns":return Ma(e.pronouns);case"formerFirstName":case"formerMiddleName":case"formerLastName":return Mt(e.hasFormerLegalName);case"otherCitizenships":return Wm(e.citizenshipStatus);case"alternateMailingAddress":case"alternateMailingCity":case"alternateMailingState":case"alternateMailingZipCode":case"alternateMailingCountry":case"isMailingTemporary":return Mt(e.hasAlternateMailingAddress);case"mailingFromDate":case"mailingToDate":return Mt(e.hasAlternateMailingAddress)&&Mt(e.isMailingTemporary);case"hasValidUsVisa":case"intendsToApplyForNewVisa":return Fa(e.citizenshipStatus);case"currentVisaType":case"visaNumber":case"visaIssueDate":return Fa(e.citizenshipStatus)&&Mt(e.hasValidUsVisa);case"otherVisaType":return Fa(e.citizenshipStatus)&&Mt(e.hasValidUsVisa)&&Ma(e.currentVisaType);
2case"livesOnCampus":return Mt(e.boardingSchool);case"graduationDate":return Mt(e.willGraduate);case"otherCareerInterest":return Ma(e.careerInterest);default:return!0}}function Br(e,s){switch(s.suggestionType){case"scalar_field":{const r=Ym(s.fieldKey);return!!(r&&Jm(e,r))}case"college_coursework_item":return Mt(e.hasCollegeCoursework);default:return!0}}function Qm(e){if(typeof document>"u"||!e)return!1;const s=document.querySelector(`[data-review-container-fields~="${e}"]`);return s?(s.dispatchEvent(new CustomEvent("build-profile-open-review-container")),!0):!1}function Pi(e){if(typeof document>"u")return;const s=Array.from(new Set(Array.from(e).filter(Boolean)));let r=!1;s.forEach(a=>{document.querySelector(`[data-review-field="${a}"]`)||Qm(a)&&(r=!0)}),r&&window.setTimeout(()=>{const a=s.map(n=>document.querySelector(`[data-review-field="${n}"]`)).find(Boolean);a==null||a.scrollIntoView({behavior:"smooth",block:"center"})},80)}const Tl=2,Xm=300*1e3;function er(e){return`build_profile_autofill_status_${e}`}function is(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Zm(e){return Array.isArray(e)?e.filter(s=>typeof s=="string"):[]}function Il(e){if(!is(e))return null;const s=As(e),r=typeof e.phase=="string"?e.phase:null,a=typeof e.suggestionCount=="number"?e.suggestionCount:0,n=!!e.canOpenAutofill;return{phase:r,ingestSession:is(e.ingestSession)?e.ingestSession:null,latestJob:is(e.latestJob)?e.latestJob:null,canOpenAutofill:n,suggestionCount:a,readySourceFingerprint:typeof e.readySourceFingerprint=="string"?e.readySourceFingerprint:null,latestSourceFingerprint:typeof e.latestSourceFingerprint=="string"?e.latestSourceFingerprint:null,stale:!!e.stale,currentTab:typeof e.currentTab=="string"?e.currentTab:null,currentTabs:Zm(e.currentTabs),progress:is(e.progress)?e.progress:null,tabProgress:is(e.tabProgress)?e.tabProgress:null,hasReadySuggestions:!!e.hasReadySuggestions||n||a>0,retryAllowed:typeof e.retryAllowed=="boolean"?e.retryAllowed:!1,retryAfterSeconds:typeof e.retryAfterSeconds=="number"?Math.max(0,e.retryAfterSeconds):0,recoveryAttemptsRemaining:typeof e.recoveryAttemptsRemaining=="number"?Math.max(0,e.recoveryAttemptsRemaining):0,failureCode:(s==null?void 0:s.failureCode)??null,failureCategory:(s==null?void 0:s.failureCategory)??null,userMessage:(s==null?void 0:s.userMessage)??null,retryable:(s==null?void 0:s.retryable)??null,recommendedAction:(s==null?void 0:s.recommendedAction)??null,creditOutcome:(s==null?void 0:s.creditOutcome)??null,requestedCredits:(s==null?void 0:s.requestedCredits)??null,availableCredits:(s==null?void 0:s.availableCredits)??null,reservedCredits:(s==null?void 0:s.reservedCredits)??null,chargedCredits:(s==null?void 0:s.chargedCredits)??null,resetAt:(s==null?void 0:s.resetAt)??null,referenceId:(s==null?void 0:s.referenceId)??null}}function kl(e,s){return!e||s<=0||(e.retryAfterSeconds??0)<=0?e:{...e,retryAfterSeconds:Math.max(0,(e.retryAfterSeconds??0)-s)}}function eh(e){if(typeof localStorage>"u")return null;try{return localStorage.getItem(e)}catch{return null}}function th(e){if(typeof sessionStorage>"u")return null;try{return sessionStorage.getItem(e)}catch{return null}}function sh(e,s){if(!(typeof localStorage>"u"))try{localStorage.setItem(e,s)}catch{}}function Za(e){if(typeof localStorage<"u")try{localStorage.removeItem(e)}catch{}if(typeof sessionStorage<"u")try{sessionStorage.removeItem(e)}catch{}}function rh(e){const s=eh(e);if(s)return s;const r=th(e);if(!r)return null;try{localStorage.setItem(e,r)}catch{}return r}function ah(e,s=0){return is(e)?Object.entries(e).reduce((r,[a,n])=>{const l=kl(Il(n),s);return l&&(r[a]=l),r},{}):{}}function Jr(e){if(!e)return null;const s=rh(er(e));if(!s)return null;try{const r=JSON.parse(s);if(!is(r)||r.version!==Tl)return Za(er(e)),null;const a=typeof r.updatedAt=="string"?Date.parse(r.updatedAt):Number.NaN;if(!Number.isFinite(a)||Date.now()-a>Xm)return Za(er(e)),null;const n=Math.max(0,Math.floor((Date.now()-a)/1e3));return{overall:kl(Il(r.overall),n),sections:ah(r.sections,n)}}catch{return null}}function nh(e,s){if(!e)return;const r={version:Tl,updatedAt:new Date().toISOString(),overall:s.overall,sections:s.sections};sh(er(e),JSON.stringify(r))}function Ai(e,s){if(!e)return;const r=Jr(e);nh(e,{overall:"overall"in s?s.overall??null:(r==null?void 0:r.overall)??null,sections:{...(r==null?void 0:r.sections)??{},...s.sections??{}}})}function ih(e){e&&Za(er(e))}const lh=new Set(["collecting","indexing","draining","autofill_running"]),ea=new Set(["pending","running"]),Dl=new Set(["failed_recoverable","failed_credit_remediable","missed_evidence","suggestions_partial"]),Ur=6,en=60,oh=4e4;function tn(e,s=0){return Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e))):s}function $r(e){if(!Number.isFinite(e)||e<=0)return Ur;const s=Math.min(e/oh,1);return tn(Ur+s*(en-Ur),Ur)}function Vr(e){var r;const s=(r=e==null?void 0:e.progress)==null?void 0:r.percent;return typeof s=="number"?Math.max(en,Math.min(99,Math.round(en+s*.4))):72}function ch(e){var r;const s=(r=e==null?void 0:e.tabProgress)==null?void 0:r.resultKind;return Dl.has(String(s??""))}function ds(e){var s,r,a;return e?e.phase==="indexing"||e.phase==="preparing"||ea.has(String(((s=e.progress)==null?void 0:s.status)??""))||ea.has(String(((r=e.latestJob)==null?void 0:r.status)??""))?!0:lh.has(String(((a=e.ingestSession)==null?void 0:a.status)??"")):!1}function sn(e){return e?aa(e.tabProgress,e.latestJob,e.progress,e):null}function dh({overallStatus:e,sectionStatus:s,sectionStatusIsCurrent:r,hasOverallStatusRevision:a}){return ds(e)?e??null:ds(s)||r||!a?s??null:null}function uh(e,s){return!!e&&(ds(e)||(e.retryAfterSeconds??0)>0)}function rn(e,s,r){var a,n,l,o,f,S,j;if(!e)return{phase:"empty",busy:!1,canTrigger:!1,percent:100,statusLabel:s?"Checking autofill":"No suggestions foun
2d",tone:"muted",animate:!1};if(e.stale&&ds(e)){const C=e.phase==="indexing";return{phase:e.phase==="failed"?"failed":C?"indexing":"preparing",busy:!0,canTrigger:!!e.canOpenAutofill,percent:C?$r(r):typeof((a=e.progress)==null?void 0:a.percent)=="number"?Vr(e):$r(r),statusLabel:C?"Reading your files":"Preparing autofill suggestions",tone:e.phase==="failed"?"muted":"active",animate:e.phase!=="failed"}}if(ch(e))return{phase:"failed",busy:!1,canTrigger:!1,percent:100,statusLabel:"Autofill needs attention",tone:"muted",animate:!1};switch(e.phase){case"ready":return{phase:"ready",busy:!1,canTrigger:!!e.canOpenAutofill,percent:100,statusLabel:"Autofill ready",tone:"success",animate:!1};case"failed":return{phase:"failed",busy:!1,canTrigger:!1,percent:typeof((n=e.progress)==null?void 0:n.percent)=="number"?tn(e.progress.percent):0,statusLabel:"Autofill failed",tone:"muted",animate:!1};case"unsupported":return{phase:"unsupported",busy:!1,canTrigger:!1,percent:0,statusLabel:"Autofill unavailable",tone:"muted",animate:!1};case"empty":return{phase:"empty",busy:!1,canTrigger:!1,percent:100,statusLabel:"No suggestions found",tone:"muted",animate:!1};case"preparing":return{phase:"preparing",busy:!0,canTrigger:!1,percent:Vr(e),statusLabel:"Preparing autofill suggestions",tone:"active",animate:!0};case"indexing":return{phase:"indexing",busy:!0,canTrigger:!1,percent:$r(r),statusLabel:"Reading your files",tone:"active",animate:!0}}if(e.canOpenAutofill||e.hasReadySuggestions)return{phase:"ready",busy:!1,canTrigger:!0,percent:100,statusLabel:"Autofill ready",tone:"success",animate:!1};if(((l=e.latestJob)==null?void 0:l.status)==="failed")return{phase:"failed",busy:!1,canTrigger:!1,percent:typeof((o=e.progress)==null?void 0:o.percent)=="number"?tn(e.progress.percent):0,statusLabel:"Autofill failed",tone:"muted",animate:!1};if(ea.has(String(((f=e.progress)==null?void 0:f.status)??""))||ea.has(String(((S=e.latestJob)==null?void 0:S.status)??"")))return{phase:"preparing",busy:!0,canTrigger:!1,percent:Vr(e),statusLabel:"Preparing autofill suggestions",tone:"active",animate:!0};switch((j=e.ingestSession)==null?void 0:j.status){case"collecting":case"indexing":case"draining":return{phase:"indexing",busy:!0,canTrigger:!1,percent:$r(r),statusLabel:"Reading your files",tone:"active",animate:!0};case"autofill_running":return{phase:"preparing",busy:!0,canTrigger:!1,percent:Vr(e),statusLabel:"Preparing autofill suggestions",tone:"active",animate:!0};case"completed":case"completed_with_failures":return{phase:"empty",busy:!1,canTrigger:!1,percent:100,statusLabel:"No suggestions found",tone:"muted",animate:!1};default:return{phase:"failed",busy:!1,canTrigger:!1,percent:0,statusLabel:"Autofill unavailable",tone:"muted",animate:!1}}}function mh(e,s){return s("buildProfile.autofillApplyAllCount",{count:e})}function hh(e){return e||((s,r)=>{const a={"buildProfile.autofillUnavailable":"Autofill unavailable","buildProfile.autofillProcessing":"Processing...","buildProfile.autofillSuggestionSingular":"Suggestion","buildProfile.autofillSuggestionPlural":"Suggestions","buildProfile.autofillTryAgain":"Try Again","buildProfile.autofillRetryLimitReached":"Retry limit reached","buildProfile.autofillFindSuggestions":"AutoFill Generation","buildProfile.autofillGenerateAgain":"Generate again","buildProfile.autofillApplyAll":"AutoFill All"};return s==="buildProfile.autofillRetryIn"?`Try again in ${r==null?void 0:r.seconds}s`:s==="buildProfile.autofillApplyAllCount"?`AutoFill All (${r==null?void 0:r.count})`:s==="buildProfile.autofillReviewSuggestions"?`AutoFill All (${(r==null?void 0:r.count)??""})`.replace(" ()",""):a[s]||s})}function fh({status:e,failureFeedback:s,heroPhase:r,visiblePendingCount:a,suggestionsLoaded:n=!1,loading:l,supported:o,t:f}){const S=s??sn(e),j=sl(S),C=rl(S),d=(e==null?void 0:e.retryAllowed)===!0&&Wr(S),h=C&&!d&&(j==="billing"||j==="support"||(S==null?void 0:S.retryable)===!1||(S==null?void 0:S.retryable)!==!0&&j!=="retry"),v=hh(f),b=o&&(e==null?void 0:e.phase)!=="unsupported"&&!l&&r!=="indexing"&&r!=="preparing"&&a>0?{label:mh(a,v),variant:"apply",disabled:!1,action:"apply"}:null,p=(()=>{var Z,G,B;
2if((e==null?void 0:e.phase)==="unsupported")return{label:v("buildProfile.autofillUnavailable"),variant:"muted",disabled:!0,action:"find"};if(l)return{label:v("buildProfile.autofillProcessing"),variant:"default",disabled:!0,action:"find"};if(C&&h)return{label:v("buildProfile.autofillUnavailable"),variant:"muted",disabled:!0,action:"find"};if(r==="indexing"||r==="preparing")return{label:v("buildProfile.autofillProcessing"),variant:"default",disabled:!0,action:"find"};const z=(Z=e==null?void 0:e.tabProgress)==null?void 0:Z.resultKind,H=Dl.has(String(z??""));return H&&(e!=null&&e.canOpenAutofill)&&!n?{label:v("buildProfile.autofillFindSuggestions"),variant:"default",disabled:!1,action:"find"}:H||(e==null?void 0:e.phase)==="failed"||((G=e==null?void 0:e.latestJob)==null?void 0:G.status)==="failed"?(e.retryAfterSeconds??0)>0&&!h?{label:v("buildProfile.autofillRetryIn",{seconds:e.retryAfterSeconds??0}),variant:"muted",disabled:!0,action:"find"}:h?{label:v("buildProfile.autofillUnavailable"),variant:"muted",disabled:!0,action:"find"}:C&&j==="retry"&&(S==null?void 0:S.retryable)!==!1?{label:v("buildProfile.autofillTryAgain"),variant:"muted",disabled:!1,action:"retry"}:e.retryAllowed===!0?{label:v("buildProfile.autofillTryAgain"),variant:"muted",disabled:!1,action:"retry"}:((B=e==null?void 0:e.tabProgress)==null?void 0:B.retryable)===!1||z==="failed_terminal"?{label:v("buildProfile.autofillUnavailable"),variant:"muted",disabled:!0,action:"find"}:e.retryAllowed===!1&&e.recoveryAttemptsRemaining===0?{label:v("buildProfile.autofillRetryLimitReached"),variant:"muted",disabled:!0,action:"find"}:{label:v("buildProfile.autofillUnavailable"),variant:"muted",disabled:!0,action:"find"}:(e==null?void 0:e.phase)==="empty"||e!=null&&e.canOpenAutofill||e!=null&&e.hasReadySuggestions||((e==null?void 0:e.suggestionCount)??0)>0?{label:v("buildProfile.autofillFindSuggestions"),variant:"default",disabled:!1,action:"find"}:e?{label:v("buildProfile.autofillUnavailable"),variant:"muted",disabled:!0,action:"find"}:{label:v("buildProfile.autofillFindSuggestions"),variant:"default",disabled:!1,action:"find"}})();return b&&(p.action==="find"||p.action==="retry")&&!p.disabled?{generate:{...p,label:v("buildProfile.autofillGenerateAgain"),variant:"muted"},apply:b}:{generate:p,apply:b}}function xn(e){var s,r,a,n,l,o,f,S;return e?[((s=e.latestJob)==null?void 0:s.id)??((r=e.ingestSession)==null?void 0:r.latestAutofillJobId)??"",((a=e.latestJob)==null?void 0:a.sourceFingerprint)??((n=e.ingestSession)==null?void 0:n.latestSourceFingerprint)??"",((l=e.latestJob)==null?void 0:l.status)??"",((o=e.latestJob)==null?void 0:o.finishedAt)??"",((f=e.ingestSession)==null?void 0:f.status)??"",((S=e.ingestSession)==null?void 0:S.completedAt)??""].join("::"):""}function an(e){var s,r;return e?[e.readySourceFingerprint??"",e.latestSourceFingerprint??"",((s=e.latestJob)==null?void 0:s.sourceFingerprint)??"",((r=e.ingestSession)==null?void 0:r.latestSourceFingerprint)??""].find(a=>String(a||"").trim().length>0)??"":""}function El(e){return xn(e).replace(/:/g,"").length>0}const Ol={languages:"personal",familyContacts:"family",otherSecondarySchools:"education",collegeCoursework:"education",currentCourses:"education",testRecords:"testing",futurePlansByType:"testing",intendedMajor:"academic",isUndecidedAboutMajor:"academic",secondChoiceMajor:"academic",additionalInterests:"academic",activities:"activities",activityResponsibilities:"activities",activityCircumstances:"activities",activityOtherResponsibilitiesDescription:"activities",honors:"honors"};function ph(e){if(e===void 0)return"undefined";try{return JSON.stringify(e)}catch{return String(e??"")}}function Ti(e){const s={};return Object.keys(Ol).forEach(r=>{const a=r;s[a]=ph(e[a])}),s}function Ii(e,s){const r=new Set;return e&&Object.entries(s).forEach(([a,n])=>{if(n===e[a])return;const l=Ol[a];l&&r.add(l)}),r}function ns(e,s){const r=xn(s),a=[(s==null?void 0:s.phase)??"",(s==null?void 0:s.suggestionCount)??0,s!=null&&s.hasReadySuggestions?"ready":""].join(":"),n=r.replace(/:/g,"").length>0?r:a;return`${e}::${n}`}function Ws(e,s){const r=an(s);return r?`${e}::source::${r}`:ns(e,s)}function gh({status:e,statusIsCurrent:s,existingInlineCount:r,existingReviewCount:a,restoreKey:n,restoredKeys:l}){return!(!e||!s||e.stale||!e.canOpenAutofill||!e.hasReadySuggestions||r>0||a>0||!n||l.has(n))}function xh(e,s,r=[]){const a=r instanceof Set?r:new Set(Array.from(r));return Xs(s,e).some(n=>!a.has(n))}function bh(e,s){if(Xs(s,e).length>0)return!0;switch(e){case"personal":return s.languages.length===0;case"family":return s.familyContacts.length===0;
2case"education":return s.otherSecondarySchools.length===0&&s.collegeCoursework.length===0&&s.currentCourses.length===0;case"academic":return!String(s.intendedMajor||"").trim()||!String(s.isUndecidedAboutMajor||"").trim()||!String(s.secondChoiceMajor||"").trim()||s.additionalInterests.length===0;case"activities":return s.activities.length===0||s.activityResponsibilities.length===0||s.activityCircumstances.length===0||!String(s.activityOtherResponsibilitiesDescription||"").trim();case"honors":return s.honors.length===0;case"testing":return s.testRecords.length===0||Object.keys(s.futurePlansByType).length===0;default:return!1}}function yh(e){switch(e){case"personal":return["languages"];case"family":return["familyContacts"];case"education":return["otherSecondarySchools","collegeCoursework","currentCourses"];case"academic":return["intendedMajor","isUndecidedAboutMajor","secondChoiceMajor","additionalInterests"];case"activities":return["activities","activityResponsibilities","activityCircumstances","activityOtherResponsibilitiesDescription"];case"honors":return["honors"];case"testing":return["testRecords","futurePlansByType"];default:return[]}}function vh(e,s,r=!1){return yh(e)}function nn(e={}){const s=!!e.force,r=e.refreshAuthorities??s;return{force:s,clearSuggestions:!!e.clearSuggestions,refreshAuthorities:r,refreshFiles:e.refreshFiles??r}}function jh(e,s){const r=nn(e??{}),a=nn(s);return{force:r.force||a.force,clearSuggestions:r.clearSuggestions||a.clearSuggestions,refreshAuthorities:r.refreshAuthorities||a.refreshAuthorities,refreshFiles:r.refreshFiles||a.refreshFiles}}const Nh="build_profile_autofill_hidden_suggestions",Sh="build_profile_autofill_pending_suggestions",Kt=1;function Ft(e){return e.suggestionId||[e.tab,e.fieldKey,e.action,e.dedupeKey||"",JSON.stringify(e.suggestedValue??null)].join("::")}function _l(e){const s=String(e||"").trim();return s?`${Nh}_${s}`:null}function Ml(e){const s=String(e||"").trim();return s?`${Sh}_${s}`:null}function Kr(){return{version:Kt,updatedAt:new Date(0).toISOString(),revisions:{}}}function qr(){return{version:Kt,updatedAt:new Date(0).toISOString(),revisions:{}}}function Fl(e){const s=_l(e);if(!s||typeof localStorage>"u")return Kr();try{const r=localStorage.getItem(s);if(!r)return Kr();const a=JSON.parse(r);return!a||a.version!==Kt||!a.revisions?Kr():{version:Kt,updatedAt:String(a.updatedAt||new Date(0).toISOString()),revisions:Object.fromEntries(Object.entries(a.revisions).map(([n,l])=>[n,Array.isArray(l)?l.filter(o=>typeof o=="string"&&o.trim()):[]]).filter(([n])=>!!String(n).trim()))}}catch{return Kr()}}function bn(e,s){const r=_l(e);if(!r||typeof localStorage>"u")return;const a=s(Fl(e)),n={version:Kt,updatedAt:new Date().toISOString(),revisions:a.revisions};try{localStorage.setItem(r,JSON.stringify(n))}catch{}}function Ch(e){return e?{inlineSuggestions:Array.isArray(e.inlineSuggestions)?e.inlineSuggestions:[],reviewSuggestions:Array.isArray(e.reviewSuggestions)?e.reviewSuggestions:[],honorsSummary:e.honorsSummary??null}:null}function Rl(e){const s=Ml(e);if(!s||typeof localStorage>"u")return qr();try{const r=localStorage.getItem(s);if(!r)return qr();const a=JSON.parse(r);return!a||a.version!==Kt||!a.revisions?qr():{version:Kt,updatedAt:String(a.updatedAt||new Date(0).toISOString()),revisions:Object.fromEntries(Object.entries(a.revisions).map(([n,l])=>[n,Ch(l)]).filter(n=>!!String(n[0]).trim()&&n[1]!=null))}}catch{return qr()}}function Ll(e,s){const r=Ml(e);if(!r||typeof localStorage>"u")return;const a=s(Rl(e)),n={version:Kt,updatedAt:new Date().toISOString(),revisions:a.revisions};try{localStorage.setItem(r,JSON.stringify(n))}catch{}}function wh(e,s){if(!s)return new Set;const r=Fl(e);return new Set(r.revisions[s]||[])}function Ph(e,s,r){zl(e,s,[r])}function zl(e,s,r){const a=Array.from(new Set(Array.from(r).map(n=>n.trim()).filter(Boolean)));!s||a.length===0||bn(e,n=>{const l=new Set(n.revisions[s]||[]);a.forEach(f=>l.add(f));const o=Object.entries(n.revisions).filter(([f])=>f!==s);return o.push([s,Array.from(l).slice(-500)]),{revisions:Object.fromEntries(o.slice(-12))}})}function ki(e,s){s&&bn(e,r=>{const a=Object.entries(r.revisions).filter(([n])=>n!==s);return{revisions:Object.fromEntries(a)}})}function Di(e,s,r){const a=Array.from(new Set(Array.from(r).map(n=>
2n.trim()).filter(Boolean)));!s||a.length===0||bn(e,n=>{const l=n.revisions[s]||[];if(l.length===0)return n;const o=new Set(a),f=l.filter(S=>!o.has(S));if(f.length===0){const S=Object.entries(n.revisions).filter(([j])=>j!==s);return{revisions:Object.fromEntries(S)}}return{revisions:{...n.revisions,[s]:f}}})}function Ah(e,s){return s?Rl(e).revisions[s]??null:null}function Th(e,s,r){s&&Ll(e,a=>{const n=Object.entries(a.revisions).filter(([l])=>l!==s);return n.push([s,r]),{revisions:Object.fromEntries(n.slice(-12))}})}function Ps(e,s){s&&Ll(e,r=>{const a=Object.entries(r.revisions).filter(([n])=>n!==s);return{revisions:Object.fromEntries(a)}})}function Ih(e,s){return s.size===0?e:{...e,suggestions:e.suggestions.filter(r=>!s.has(Ft(r)))}}const kh="family",Dh="Family",Hr=()=>({...Hn,contacts:Hn.contacts.map(e=>({...e}))}),Eh=()=>({relation:"",livingStatus:"",firstName:"",lastName:"",email:"",phoneType:"",phoneNumber:"",occupation:"",employmentStatus:"",employer:"",highestEducation:"",collegeUniversityAffiliation:""}),Oh=e=>`build_profile_family_${e}`,ln=e=>e==null?!1:typeof e=="string"?e.trim().length>0:!0,_h=e=>Object.entries(e).some(([s,r])=>s!=="id"&&ln(r)),Mh=e=>{if(!e)return Hr();try{const s=localStorage.getItem(Oh(e));if(!s)return Hr();const r=JSON.parse(s),a=Hr(),n=Array.isArray(r.contacts)?r.contacts:[],l=Eh();return{...a,...r,contacts:n.map(o=>({id:typeof(o==null?void 0:o.id)=="string"&&o.id.trim().length>0?o.id:`family-contact-${Date.now()}-${Math.random().toString(36).slice(2,10)}`,...l,...o||{}})).filter(_h)}}catch{return Hr()}},Ei=["parentsMaritalStatus","homeWith","siblingsCount"],Oi=["relation","firstName","lastName","email","phoneNumber","highestEducation","occupation"],_i=e=>{const s=Ei.filter(o=>ln(e[o])).length,r=e.contacts.reduce((o,f)=>o+Oi.filter(S=>ln(f[S])).length,0),a=s+r,n=Ei.length+e.contacts.length*Oi.length,l=n>0?Math.round(a/n*100):0;return{id:kh,label:Dh,started:a>0,complete:n>0&&a===n,filled:a,total:n,percent:l}},Bl=e=>({...e}),Ul=e=>({...e}),$l=e=>({...e}),Vl=e=>({...e}),Kl=e=>({...e}),ql=e=>({...e,futureDates:[...e.futureDates]}),Fh=e=>({organizationName:e.organizationName??"",sportTeam:e.sportTeam??"",timingOfParticipation:Array.isArray(e.timingOfParticipation)?[...e.timingOfParticipation]:[],intendsToParticipateInCollege:e.intendsToParticipateInCollege??""}),Rh=e=>({parentsMaritalStatus:e.parentsMaritalStatus,homeWith:e.homeWith,siblingsCount:e.siblingsCount,childrenCount:e.childrenCount,contacts:e.familyContacts.map(Ul)}),Mi=e=>({parentsMaritalStatus:e.parentsMaritalStatus,homeWith:e.homeWith,siblingsCount:e.siblingsCount,childrenCount:e.childrenCount,familyContacts:e.contacts.map(Ul)}),Lh=e=>({preferredName:e.preferredName,middleName:e.middleName,suffix:e.suffix,hasFormerLegalName:e.hasFormerLegalName,formerFirstName:e.formerFirstName,formerMiddleName:e.formerMiddleName,formerLastName:e.formerLastName,preferredPhoneType:e.preferredPhoneType,preferredPhoneNumber:e.preferredPhoneNumber,mobilePhoneNumber:e.mobilePhoneNumber,alternatePhoneType:e.alternatePhoneType,alternatePhoneNumber:e.alternatePhoneNumber,countryOfBirth:e.countryOfBirth,cityOfBirth:e.cityOfBirth,stateOfBirth:e.stateOfBirth,yearsInUnitedStates:e.yearsInUnitedStates,sex:e.sex,pronouns:e.pronouns,otherPronouns:e.otherPronouns,citizenshipStatus:e.citizenshipStatus,commonAppFeeWaiverEligible:e.commonAppFeeWaiverEligible,otherCitizenships:e.otherCitizenships,hasAlternateMailingAddress:e.hasAlternateMailingAddress,alternateMailingAddress:e.alternateMailingAddress,alternateMailingCity:e.alternateMailingCity,alternateMailingState:e.alternateMailingState,alternateMailingZipCode:e.alternateMailingZipCode,alternateMailingCountry:e.alternateMailingCountry,isMailingTemporary:e.isMailingTemporary,mailingFromDate:e.mailingFromDate,mailingToDate:e.mailingToDate,languages:e.languages.map(Bl),hasValidUsVisa:e.hasValidUsVisa,currentVisaType:e.currentVisaType,otherVisaType:e.otherVisaType,visaNumber:e.visaNumber,visaIssueDate:e.visaIssueDate,intendsToApplyForNewVisa:e.intendsToApplyForNewVisa}),Fi=e=>({preferredName:e.preferredName,middleName:e.middleName,suffix:e.suffix,hasFormerLegalName:e.hasFormerLegalName,formerFirstName:e.formerFirstName,formerMiddleName:e.formerMiddleName,formerLastName:e.formerLastName,preferredPhoneType:e.preferredPhoneType,preferredPhoneNumber:e.preferredPhoneNumber,mobilePhoneNumber:e.mobilePhoneNumber,alternatePhoneType:e.alternatePhoneType,alternatePhoneNumber:e.alternatePhoneNumber,countryOfBirth:e.countryOfBirth,
2cityOfBirth:e.cityOfBirth,stateOfBirth:e.stateOfBirth,yearsInUnitedStates:e.yearsInUnitedStates,sex:e.sex,pronouns:e.pronouns,otherPronouns:e.otherPronouns,citizenshipStatus:e.citizenshipStatus,commonAppFeeWaiverEligible:e.commonAppFeeWaiverEligible,otherCitizenships:e.otherCitizenships,hasAlternateMailingAddress:e.hasAlternateMailingAddress,alternateMailingAddress:e.alternateMailingAddress,alternateMailingCity:e.alternateMailingCity,alternateMailingState:e.alternateMailingState,alternateMailingZipCode:e.alternateMailingZipCode,alternateMailingCountry:e.alternateMailingCountry,isMailingTemporary:e.isMailingTemporary,mailingFromDate:e.mailingFromDate,mailingToDate:e.mailingToDate,languages:e.languages.map(Bl),hasValidUsVisa:e.hasValidUsVisa,currentVisaType:e.currentVisaType,otherVisaType:e.otherVisaType,visaNumber:e.visaNumber,visaIssueDate:e.visaIssueDate,intendsToApplyForNewVisa:e.intendsToApplyForNewVisa}),zh=e=>({currentSchoolEntryDate:e.currentSchoolEntryDate,boardingSchool:e.boardingSchool,livesOnCampus:e.livesOnCampus,willGraduate:e.willGraduate,graduationDate:e.graduationDate,schoolProgressionContext:e.schoolProgressionContext,otherSecondarySchools:e.otherSecondarySchools.map($l),hasCollegeCoursework:e.hasCollegeCoursework,collegeCoursework:e.collegeCoursework.map(Vl),schedulingSystem:e.schedulingSystem,currentCourses:e.currentCourses.map(Kl),applicantDescription:e.applicantDescription,highestDegreeIntended:e.highestDegreeIntended,careerInterest:e.careerInterest,otherCareerInterest:e.otherCareerInterest}),Ri=e=>({currentSchoolEntryDate:e.currentSchoolEntryDate,boardingSchool:e.boardingSchool,livesOnCampus:e.livesOnCampus,willGraduate:e.willGraduate,graduationDate:e.graduationDate,schoolProgressionContext:e.schoolProgressionContext,otherSecondarySchools:e.otherSecondarySchools.map($l),hasCollegeCoursework:e.hasCollegeCoursework,collegeCoursework:e.collegeCoursework.map(Vl),schedulingSystem:e.schedulingSystem,currentCourses:e.currentCourses.map(Kl),applicantDescription:e.applicantDescription,highestDegreeIntended:e.highestDegreeIntended,careerInterest:e.careerInterest,otherCareerInterest:e.otherCareerInterest}),Bh=e=>({isUndecidedAboutMajor:e.isUndecidedAboutMajor,secondChoiceMajor:e.secondChoiceMajor}),Li=e=>({isUndecidedAboutMajor:e.isUndecidedAboutMajor,secondChoiceMajor:e.secondChoiceMajor}),Uh=e=>({futurePlansByType:Object.fromEntries(Object.entries(e.futurePlansByType).map(([s,r])=>[s,ql(r)]))}),zi=e=>({futurePlansByType:Object.fromEntries(Object.entries(e.futurePlansByType).map(([s,r])=>[s,ql(r)]))}),$h=e=>({byActivityId:Object.fromEntries(e.activities.map(s=>[s.id,Fh(s)])),responsibilities:[...e.activityResponsibilities],otherResponsibilitiesDescription:e.activityOtherResponsibilitiesDescription,circumstances:[...e.activityCircumstances]}),Bi=(e,s)=>({activities:e.activities.map(r=>{const a=s.byActivityId[r.id];return a?{...r,organizationName:a.organizationName,sportTeam:a.sportTeam,timingOfParticipation:[...a.timingOfParticipation],intendsToParticipateInCollege:a.intendsToParticipateInCollege}:{...r,organizationName:"",sportTeam:"",timingOfParticipation:[],intendsToParticipateInCollege:""}}),activityResponsibilities:[...s.responsibilities],activityOtherResponsibilitiesDescription:s.otherResponsibilitiesDescription,activityCircumstances:[...s.circumstances]}),Vh="text-[11px] font-semibold uppercase tracking-[0.18em] text-slate-400",Ke=["personal","family","education","testing","academic","activities","honors"],Js=["personal","family","education","testing","academic","activities","honors"],Ra={personal:"Personal Information",family:"Family",education:"Education",testing:"Testing",academic:"Academic Interests",activities:"Activities",honors:"Honors & Awards",statement:"Writing"},Kh=["firstName","lastName","gender","dateOfBirth","raceEthnicity","citizenship","country","address","inStateTuitionState","sex","pronouns","otherPronouns","currentSchool","grade","classYear","route","gpa","gpaScale","classRank","intendedMajor","isUndecidedAboutMajor","secondChoiceMajor","preferredName","middleName","suffix","hasFormerLegalName","formerFirstName","formerMiddleName","formerLastName","preferredPhoneType","preferredPhoneNumber","mobilePhoneNumber","alternatePhoneType","alternatePhoneNumber","citizenshipStatus","commonAppFeeWaiverEligible","otherCitizenships","hasAlternateMailingAddress","alternateMailingAddress","alternateMailingCountry","countryOfBirth","cityOfBirth","stateOfBirth","yearsInUnitedStates","hasValidUsVisa","currentVisaType","otherVisaType","visaNumber","visaIssueDate","intendsToApplyForNewVisa","currentSchoolEntryDate","boardingSchool","livesOnCampu
2s","willGraduate","graduationDate","schoolProgressionContext","hasCollegeCoursework","schedulingSystem","applicantDescription","highestDegreeIntended","careerInterest","otherCareerInterest","parentsMaritalStatus","homeWith","siblingsCount","childrenCount","activityOtherResponsibilitiesDescription","additionalInfoChallengesChoice","additionalInfoChallenges","additionalInfoAdditionalChoice","additionalInfoAdditional"],qh=new Set(["additionalInfoChallengesChoice","additionalInfoAdditionalChoice"]);function Hl(e){return qh.has(e)}function Gl(e){const s=String(e??"").trim().toLowerCase();return["yes","y","true"].includes(s)?"yes":["no","n","false"].includes(s)?"no":null}function Yl(e){return e==null?"":String(e)}function Ui(e,s){const r={...e};return s.forEach(a=>{if(a.suggestionType!=="scalar_field")return;const n=At(a.fieldKey);if(!(!n||!nr(n))){if(Hl(n)){r[n]=Gl(a.suggestedValue);return}r[n]=Yl(a.suggestedValue)}}),r}const Hh=new Set(Kh),Gh={firstName:"personal",lastName:"personal",gender:"personal",dateOfBirth:"personal",raceEthnicity:"personal",citizenship:"personal",country:"personal",address:"personal",city:"personal",state:"personal",zipCode:"personal",inStateTuitionState:"personal",preferredName:"personal",middleName:"personal",suffix:"personal",hasFormerLegalName:"personal",formerFirstName:"personal",formerMiddleName:"personal",formerLastName:"personal",preferredPhoneType:"personal",preferredPhoneNumber:"personal",mobilePhoneNumber:"personal",alternatePhoneType:"personal",alternatePhoneNumber:"personal",sex:"personal",pronouns:"personal",otherPronouns:"personal",countryOfBirth:"personal",cityOfBirth:"personal",stateOfBirth:"personal",yearsInUnitedStates:"personal",citizenshipStatus:"personal",commonAppFeeWaiverEligible:"personal",otherCitizenships:"personal",hasAlternateMailingAddress:"personal",alternateMailingAddress:"personal",alternateMailingCity:"personal",alternateMailingState:"personal",alternateMailingZipCode:"personal",alternateMailingCountry:"personal",isMailingTemporary:"personal",mailingFromDate:"personal",mailingToDate:"personal",languages:"personal",hasValidUsVisa:"personal",currentVisaType:"personal",otherVisaType:"personal",visaNumber:"personal",visaIssueDate:"personal",intendsToApplyForNewVisa:"personal",parentsMaritalStatus:"family",homeWith:"family",siblingsCount:"family",childrenCount:"family",familyContacts:"family",currentSchool:"education",grade:"education",classYear:"education",route:"education",gpa:"education",gpaScale:"education",classRank:"education",currentSchoolEntryDate:"education",boardingSchool:"education",livesOnCampus:"education",willGraduate:"education",graduationDate:"education",schoolProgressionContext:"education",otherSecondarySchools:"education",hasCollegeCoursework:"education",collegeCoursework:"education",schedulingSystem:"education",currentCourses:"education",applicantDescription:"education",highestDegreeIntended:"education",careerInterest:"education",otherCareerInterest:"education",intendedMajor:"academic",additionalInterests:"academic",isUndecidedAboutMajor:"academic",secondChoiceMajor:"academic",activities:"activities",activityResponsibilities:"activities",activityOtherResponsibilitiesDescription:"activities",activityCircumstances:"activities",honors:"honors",testRecords:"testing",futurePlansByType:"testing",personalStatement:"statement",personalStatementJson:"statement",additionalInfoChallengesChoice:"statement",additionalInfoChallenges:"statement",additionalInfoAdditionalChoice:"statement",additionalInfoAdditional:"statement"};function Yh(e){return e.replace(/_([a-z])/g,(s,r)=>r.toUpperCase())}function et(e){return String(e??"").trim().replace(/\s+/g," ").toLowerCase()}function Wh(e){return[et(e.relation),et(e.firstName),et(e.lastName)].join("|")}function Jh(e){if(e.dedupeKey)return et(e.dedupeKey);const s=e.suggestedValue;if(!s||typeof s!="object")return"";const r=s;return[et(r.relation),et(r.first_name??r.firstName),et(r.last_name??r.lastName)].join("|")}function Qh(e){return[et(e.language),et(e.otherLanguageName)].join("|")}function Xh(e){if(e.dedupeKey)return et(e.dedupeKey);const s=e.suggestedValue;if(!s||typeof s!="object")return"";const r=s;return[et(r.language),et(r.other_language_name??r.otherLanguageName)].join("|")}function At(e){const s=Yh(e);return s||null}function nr(e){return Hh.has(e)}function Wl(e){if(e.suggestionType!=="scalar_field")return!1;const s=At(e.fieldKey);return!!(s&&nr(s))}function ta(e){switch(e.suggestionType){case"scalar_field":{const s=At(e.fieldKey);return!!(s&&nr(s))}case"language_item":return e.tab==="personal";case"string_list_item":return e.tab==="academic";case"family_contact_item":case"activity_item":case"honor_item":case"test_record":case"future_plan_entry":case"responsibility_list_item":case"circumstance_list_item":return!0;case"secondary_school_item":case"college_coursework_item":case"current_course_item":return e.tab==="education";default:return!1}}function Zh(e,s){let r=e,a=0;
2return s.forEach(n=>{if(!ta(n))return;const l=ls(r,n,{allowReviewOnly:!0});l.blockedReason||!l.applied||(r=l.nextProfile,a+=1)}),a}function $i(e,s){return JSON.stringify(e)===JSON.stringify(s)}function Vi(e,s,r,a){return e&&e.section!==s?{section:s,fields:r,honorIds:a}:{section:s,fields:Array.from(new Set([...(e==null?void 0:e.fields)||[],...r])),honorIds:Array.from(new Set([...(e==null?void 0:e.honorIds)||[],...a]))}}const Gr={isSupportedInlinePendingSuggestion:ta,isInlineReviewSuggestion:Wl,isReviewableInlinePendingSuggestion:Id};function Ki(e,s){const r=new Map;return e.forEach(a=>{r.set(Ft(a),a)}),s.forEach(a=>{r.set(Ft(a),a)}),Array.from(r.values())}const ef=["parentsMaritalStatus","homeWith","siblingsCount"],sa=10,tf=5,La=700,Jl={test_records_full:`Testing is already full (${cs}/${cs}). Delete an existing test record to add this suggestion.`,activities_full:`Activities is already full (${sa}/${sa}). Delete an existing activity to add this suggestion.`,secondary_schools_full:`Other Secondary Schools is already full (${sr}/${sr}). Delete an existing school to add this suggestion.`,college_coursework_full:`College Coursework is already full (${rr}/${rr}). Delete an existing college entry to add this suggestion.`,current_courses_full:`Current Courses is already full (${ar}/${ar}). Delete an existing course to add this suggestion.`},za=4200,Ba={expandedIds:[],collapsedGroups:[]};function Ql(e){return typeof e=="string"&&Ke.includes(e)}function Xl(e){return`build_profile_active_section_${e}`}function qi(e){if(!e||typeof localStorage>"u")return"personal";try{const s=localStorage.getItem(Xl(e));return Ql(s)?s:"personal"}catch{return"personal"}}function sf(e,s){if(!(!e||typeof localStorage>"u"))try{localStorage.setItem(Xl(e),s)}catch{}}function Vt(e){return e==null?!1:typeof e=="string"?e.trim().length>0:Array.isArray(e)?e.length>0:!0}function rf(e,s){return!["firstName","lastName","sex","country","address"].every(a=>Vt(e[a]))||!Vt(s.hasAlternateMailingAddress)?!1:s.hasAlternateMailingAddress!=="Yes"?!0:Vt(s.alternateMailingCountry)&&Vt(s.alternateMailingAddress)}function af(e){return["parentsMaritalStatus","homeWith","siblingsCount"].every(s=>Vt(e[s]))}function nf(e){return["currentSchool","grade","classYear"].every(s=>Vt(e[s]))}function lf(e){return Vt(e.intendedMajor)}function of(e,s,r){var l,o,f,S;const a=r(`buildProfile.sections.${e}`),n=(l=s.tabProgress)==null?void 0:l.resultKind;switch(s.phase){case"failed":return(s.retryAfterSeconds??0)>0?{type:"info",message:r("buildProfile.autofillRetrySectionIn",{section:a,seconds:s.retryAfterSeconds??0})}:s.retryAllowed===!0?{type:"error",message:r("buildProfile.autofillRetrySection",{section:a})}:((o=s.tabProgress)==null?void 0:o.retryable)===!1||n==="failed_terminal"?{type:"error",message:r("buildProfile.autofillSectionUnavailable",{section:a})}:s.retryAllowed===!1&&s.recoveryAttemptsRemaining===0?{type:"error",message:r("buildProfile.autofillSectionRetryLimit",{section:a})}:{type:"error",message:r("buildProfile.autofillRetrySection",{section:a})};case"unsupported":return{type:"info",message:r("buildProfile.autofillSectionUnsupported",{section:a})};case"empty":return n==="completed_already_satisfied"?{type:"info",message:r("buildProfile.autofillSectionAlreadySatisfied",{section:a})}:n==="completed_no_evidence"?{type:"info",message:r("buildProfile.autofillSectionNoEvidence",{section:a})}:{type:"info",message:r("buildProfile.autofillSectionNoSuggestions",{section:a})};case"preparing":return{type:"info",message:r("buildProfile.autofillPreparingNow")};case"indexing":return{type:"info",message:r("buildProfile.autofillFilesIndexing")}}if(((f=s.latestJob)==null?void 0:f.status)==="failed")return{type:"error",message:r("buildProfile.autofillGenerationFailedRefresh")};switch((S=s.ingestSession)==null?void 0:S.status){case"collecting":return{type:"info",message:r("buildProfile.autofillUploadsCollecting")};case"indexing":return{type:"info",message:r("buildProfile.autofillFilesIndexing")};case"draining":return{type:"info",message:r("buildProfile.autofillQuietWindow")};case"autofill_running":return{type:"info",message:r("buildProfile.autofillPreparingNow")};case"completed":case"completed_with_failures":return{type:"info",message:r("buildProfile.autofillSectionNoReadySuggestions",{section:a})};default:return{type:"info",message:r("buildProfile.autofillSectionNotReady",{section:a})}}}function Yr(e){const s=rn(e,!1,0);return uh(e,s.phase)}const Ua=3;function $a(e,s){var S;const r=Number(((S=e==null?void 0:e.response)==null?void 0:S.status)||0),a=r===4
201||r===403,n=!a&&!(e!=null&&e.response),l=a?"STATUS_AUTH_REQUIRED":n?"STATUS_NETWORK_UNAVAILABLE":"STATUS_SERVICE_UNAVAILABLE",f={failureCode:l,failureCategory:a?"authentication":"service",userMessage:a?"Your session could not be verified. Please sign in again.":n?"We could not reach Autofill. Check your connection and try again.":"Autofill status is temporarily unavailable. Please try again.",retryable:!a,recommendedAction:a?"sign_in":"retry"};return{phase:"failed",canOpenAutofill:!1,suggestionCount:0,stale:!1,currentTab:null,currentTabs:[],progress:null,tabProgress:s?{status:"failed",resultKind:a?"failed_terminal":"failed_recoverable",retryable:!a,errorMessage:l,...f}:null,ingestSession:null,latestJob:null,hasReadySuggestions:!1,retryAllowed:!a,retryAfterSeconds:0,recoveryAttemptsRemaining:a?0:1,...f}}function Hi(e,s){let l=0,o=!1,f=0,S=!1;const j=()=>{const C=Math.min(2e3*Math.pow(1.6,l),1e4),d=Math.max(500,C*(1+.25*(Math.random()*2-1)));f=window.setTimeout(async()=>{if(!o){if(S){j();return}l+=1,S=!0;try{await e()}catch(h){console.error("Autofill status poll failed:",h)}finally{S=!1,o||j()}}},d)};return j(),()=>{o=!0,window.clearTimeout(f)}}function ra(e){return xn(e)}function on(e){return El(e)}function Gi(e){return JSON.stringify(e??null)}function Yi(e,s){return e===s?!0:Gi(e)===Gi(s)}
2function Wi(e,s){if(!e)return!1;if(!on(s))return!0;const r=an(e),a=an(s);return r&&a&&r===a?!0:ra(e)===ra(s)}function Ji(e,s,r){if(r.blockedReason)return Jl[r.blockedReason]??null;const{nextProfile:a}=r;return s.suggestionType==="activity_item"&&a.activities.length>e.activities.length&&e.activities.length>=sa?"Activities is already full (10/10). Delete an existing activity to add this suggestion.":s.suggestionType==="honor_item"&&a.honors.length>e.honors.length&&e.honors.length>=tf?"Honors is already full (5/5). Delete an existing honor to add this suggestion.":null}function cf(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2,11)}`}function Mf(){var On,_n,Mn;const{t:e,lang:s}=Te(),r=Ho(),a=Go(),n=el(),{profile:l,profileLoaded:o,updateField:f,updateFields:S,handleSave:j,saveProfileSnapshot:C,pauseAutoSave:d,saveStatus:h,saveError:v,sectionProgress:b,autoSaveEnabled:p,toggleAutoSave:z}=Wo(),{data:H=[],isSuccess:Z}=Zi(n),{uploadingFiles:G}=tl(n,H),B=c.useMemo(()=>cc(H,G),[H,G]),U=Qi(),[q,ce]=c.useState(()=>qi(n)),[ee,ne]=c.useState(!1),[ie,K]=c.useState(!1),[Ce,xe]=c.useState({}),[k,I]=c.useState(()=>{var i;return((i=Jr(n))==null?void 0:i.overall)??null}),[u,y]=c.useState(()=>{var i;return((i=Jr(n))==null?void 0:i.sections)??{}}),A=c.useRef(k),N=c.useRef(u),w=c.useRef(l),X=c.useRef(n),E=c.useRef(0),oe=c.useRef(0),je=c.useRef({}),Ie=c.useRef(0),Ae=c.useRef({}),[pt,jt]=c.useState({}),ct=c.useRef({}),[It,Nt]=c.useState({}),[Ue,ze]=c.useState(0),[ue,be]=c.useState({}),[P,te]=c.useState({}),[_,we]=c.useState({}),[L,re]=c.useState(null),[g,Ne]=c.useState(!1),me=c.useRef(!1),[Fe,st]=c.useState(null),[dt,rt]=c.useState(!1),[ia,Ht]=c.useState(!1),[dr,ur]=c.useState(!1),ut=ds(k),at=!ut,St=c.useRef(Ba),Ms=c.useRef(new Set),nt=c.useRef(new Set),Fs=c.useRef(null),Rs=c.useRef(0),Ls=c.useRef(!1),kt=c.useRef(null),Gt=c.useRef(!1),[D,M]=c.useState(()=>new Set),[de,ge]=c.useState(null),he=c.useCallback(i=>{if(i.length===0||!i.some(T=>ct.current[T]!==!0))return;const x={...ct.current};i.forEach(T=>{x[T]=!0}),ct.current=x,jt(x)},[]),pe=c.useCallback((i,m)=>E.current===i&&X.current===m,[]);c.useEffect(()=>{A.current=k},[k]),c.useEffect(()=>{N.current=u},[u]),c.useEffect(()=>{w.current=l},[l]);const ye=c.useCallback(i=>Yi(A.current,i)?!1:(A.current=i,I(i),Ai(n,{overall:i}),!0),[n]),ve=c.useCallback(i=>{const m={},x=[];if(Js.forEach(J=>{const V=i[J];V&&(x.push(J),!Yi(N.current[J],V)&&(m[J]=V))}),he(x),Object.keys(m).length===0)return!1;const T={...N.current,...m};return N.current=T,y(T),Ai(n,{sections:m}),!0},[he,n]),ae=c.useCallback(()=>{nt.current.clear(),be({}),te({}),we({}),xe({})},[]);c.useEffect(()=>{X.current=n,E.current+=1;const i=Jr(n);A.current=(i==null?void 0:i.overall)??null,N.current=(i==null?void 0:i.sections)??{},ct.current={},ce(qi(n)),I((i==null?void 0:i.overall)??null),y((i==null?void 0:i.sections)??{}),jt({}),Nt({}),nt.current.clear(),be({}),te({}),we({}),xe({})},[n]);const ke=c.useMemo(()=>Bh(l),[l]),gt=c.useMemo(()=>$h(l),[l]),De=c.useMemo(()=>Rh(l),[l]),Ge=c.useMemo(()=>zh(l),[l]),it=c.useMemo(()=>Lh(l),[l]),la=c.useMemo(()=>Uh(l),[l]),oa=c.useMemo(()=>Ti(l),[l]),$e=c.useCallback((i,m)=>{const x=Gh[i];if(!x)return;const T={...l,[i]:m};be(J=>{const V=J[x]||[],F=V.filter(se=>{if(At(se.fieldKey)===i&&se.suggestionType==="scalar_field")return!1;if(i==="additionalInterests"&&se.suggestionType==="string_list_item"&&Array.isArray(m)&&typeof se.suggestedValue=="string")return!m.some(_e=>et(_e)===et(se.suggestedValue));if(i==="languages"&&se.suggestionType==="language_item"&&Array.isArray(m)){const _e=new Set(m.filter(Me=>!!(Me&&typeof Me=="object")).map(Me=>Qh(Me))),We=Xh(se);return!We||!_e.has(We)}return!0});return F.length===V.length?J:{...J,[x]:F}}),te(J=>{const V=J[x]||[],F=V.filter(se=>{if(At(se.fieldKey)!==i||se.suggestionType!=="scalar_field")return!0;const _e=ls(T,se,{allowReviewOnly:!0});return!!(_e.applied||_e.requiresReview||_e.blockedReason)});return F.length===V.length?J:{...J,[x]:F}})},[l]),ms=c.useCallback((i,m)=>{$e(i,m),f(i,m)},[$e,f]),Zl=c.useCallback(i=>
2{Object.entries(i).forEach(([m,x])=>{ke[m]!==x&&$e(m,x)}),S(Li(i))},[ke,$e,S]),eo=c.useCallback(i=>{gt.otherResponsibilitiesDescription!==i.otherResponsibilitiesDescription&&$e("activityOtherResponsibilitiesDescription",i.otherResponsibilitiesDescription),S(Bi(l,i))},[gt,$e,l,S]),to=c.useCallback(i=>{Object.entries(i).forEach(([m,x])=>{Ge[m]!==x&&$e(m,x)}),S(Ri(i))},[$e,Ge,S]),so=c.useCallback(i=>{De.parentsMaritalStatus!==i.parentsMaritalStatus&&$e("parentsMaritalStatus",i.parentsMaritalStatus),De.homeWith!==i.homeWith&&$e("homeWith",i.homeWith),De.siblingsCount!==i.siblingsCount&&$e("siblingsCount",i.siblingsCount),De.childrenCount!==i.childrenCount&&$e("childrenCount",i.childrenCount),De.contacts!==i.contacts&&be(m=>{const x=m.family||[],T=new Set(i.contacts.map(V=>Wh(V))),J=x.filter(V=>{if(V.suggestionType!=="family_contact_item")return!0;const F=Jh(V);return!F||!T.has(F)});return J.length===x.length?m:{...m,family:J}}),S(Mi(i))},[$e,De,S]),ro=c.useCallback(i=>{Object.entries(i).forEach(([m,x])=>{it[m]!==x&&$e(m,x)}),S(Fi(i))},[$e,it,S]),ao=c.useCallback(i=>{S(zi(i))},[S]),no=c.useCallback(i=>{St.current={expandedIds:[...i.expandedIds],collapsedGroups:[...i.collapsedGroups]}},[]);c.useEffect(()=>{St.current=Ba},[n]),c.useEffect(()=>{l.testRecords.length===0&&(St.current=Ba)},[l.testRecords]);const mr=c.useMemo(()=>{if(!at)return l;const i=Ke.flatMap(m=>ue[m]??[]);return Ui(l,i)},[at,ue,l]),Ee=c.useMemo(()=>at?Ke.reduce((i,m)=>(i[m]=(ue[m]||[]).filter(x=>Br(mr,x)),i),{}):{},[at,ue,mr]),Yt=c.useMemo(()=>at?Ke.reduce((i,m)=>(i[m]=(P[m]||[]).filter(x=>Br(mr,x)),i),{}):{},[at,P,mr]);c.useMemo(()=>Ke.reduce((i,m)=>{var x;return i[m]=((x=Ee[m])==null?void 0:x.filter(ta).length)??0,i},{personal:0,family:0,education:0,testing:0,academic:0,activities:0,honors:0,statement:0}),[Ee]);const R=c.useMemo(()=>{const i={};return Ke.forEach(m=>{(Ee[m]||[]).forEach(x=>{if(x.suggestionType!=="scalar_field")return;const T=At(x.fieldKey);!T||!nr(T)||(i[T]=x)})}),i},[Ee]),$=c.useMemo(()=>{const i={};return Ke.forEach(m=>{(Yt[m]||[]).forEach(x=>{if(!Wl(x))return;const T=At(x.fieldKey);!T||!nr(T)||(i[T]=x)})}),i},[Yt]),Dt=c.useCallback(i=>{re(null),ce(i),sf(n,i)},[n]);c.useEffect(()=>{var m;const i=(m=r.state)==null?void 0:m.activeSection;Ql(i)&&Dt(i)},[Dt,r.state]);const Wt=c.useMemo(()=>{const i={...l};return Object.entries(R).forEach(([m,x])=>{if(!x)return;const T=m;if(Hl(T)){i[T]=Gl(x.suggestedValue);return}i[T]=Yl(x.suggestedValue)}),i},[R,l]),Jt=c.useMemo(()=>km(l,Ee,Gr,Ke),[l,Ee]),Ct=c.useMemo(()=>{const i={personal:0,family:0,education:0,testing:0,academic:0,activities:0,honors:0,statement:0};return Ke.reduce((m,x)=>{if(x==="honors"){const V=!!(_.honors&&Hs(_.honors,l.honors));return m[x]=V?1:0,m}if(x==="activities"){if(l.activities.length>=sa)return m[x]=0,m;const V=(Ee.activities||[]).filter(F=>F.suggestionType==="activity_item").length;return m[x]=V>0?1:0,m}if(x==="family"){const V=ef.filter(se=>!Vt(De[se])),F=[...Ee.family||[],...Yt.family||[]];return m[x]=F.filter(se=>{const Oe=At(se.fieldKey);return!!(Oe&&V.includes(Oe))}).length,m}if(x==="testing"||x==="statement")return m[x]=0,m;const T=Xs(Jt,x);if(T.length===0)return m[x]=0,m;const J=[...Ee[x]||[],...Yt[x]||[]];return m[x]=J.filter(V=>{const F=At(V.fieldKey);return!!(F&&T.includes(F))}).length,m},i)},[_.honors,De,l.activities.length,l.honors,Jt,Ee,Yt]),hr=c.useMemo(()=>_i(De),[De]),fr=c.useMemo(()=>Si(gt),[gt]),pr=c.useMemo(()=>Ni(ke),[ke]),gr=c.useMemo(()=>wi(it),[it]),xr=c.useMemo(()=>Ci(Ge),[Ge]),yn=c.useMemo(()=>Object.keys(la.futurePlansByType).length>0,[la]);c.useEffect(()=>{if(!n||!o)return;const i=`build_profile_direct_fields_migrated_${n}`;try{if(localStorage.getItem(i)==="1")return}catch{return}const m={};let x=!1;const T=Mh(n);!hr.started&&_i(T).started&&(Object.assign(m,Mi(T)),x=!0);const J=Hm(n);!gr&&wi(J)&&(Object.assign(m,Fi(J)),x=!0);const V=$m(n);!xr.started&&Ci(V).started&&(Object.assign(m,Ri(V)),x=!0);const F=Om(n);!pr&&Ni(F)&&(Object.assign(m,Li(F)),x=!0);const se=Fm(n);!fr&&Si(se)&&(Object.assign(m,Bi(l,se)),x=!0);const Oe=qu(n);!yn&&Object.keys(Oe.futurePlansByType).length>0&&(Object.assign(m,zi(Oe)),x=!0);try{localStorage.setItem(i,"1")}catch{return}x&&S(m)},[pr,fr,xr.started,hr.started,gr,l,o,yn,S,n]);const Qt=c.useCallback(i=>{const m=`buildProfile.sections.${i}`,x=e(m);return x===m?Ra[i]:x},[e,s]),br=c.useMemo(()=>{const i=new Map(b.map(m=>
2{const x=Ct[m.id]??0;return[m.id,{...m,complete:m.complete&&x===0,started:m.started||x>0,pending:x>0}]}));return Ke.map(m=>{if(m==="personal"){const T=i.get(m);return{id:m,label:Qt(m),complete:rf(Wt,it)&&!(T!=null&&T.pending),started:!!(T!=null&&T.started)||gr,pending:!!(T!=null&&T.pending)}}if(m==="family"){const T=i.get(m);return{...hr,label:Qt(m),complete:af(De)&&!(T!=null&&T.pending),pending:Ct.family>0}}if(m==="education"){const T=i.get(m);return{id:m,label:Qt(m),complete:nf(Wt)&&!(T!=null&&T.pending),started:!!(T!=null&&T.started)||xr.started,pending:!!(T!=null&&T.pending)}}if(m==="activities"){const T=i.get(m);return{id:m,label:Qt(m),complete:!!(T!=null&&T.complete),started:!!(T!=null&&T.started)||fr,pending:!!(T!=null&&T.pending)}}if(m==="academic"){const T=i.get(m);return{id:m,label:Qt(m),complete:lf(Wt)&&!(T!=null&&T.pending),started:!!(T!=null&&T.started)||pr,pending:!!(T!=null&&T.pending)}}return{...i.get(m)||{id:m,complete:!1,started:!1,pending:!1},label:Qt(m)}})},[pr,fr,Ct,xr.started,De,hr,Qt,it,gr,Wt,b]),io=c.useMemo(()=>{const i=br.length,m=br.filter(T=>T.complete).length,x=i>0?Math.round(m/i*100):100;return{filled:m,total:i,percent:x}},[br]),hs=Ke.indexOf(q),ca=hs>0,da=hs<Ke.length-1,yr=c.useCallback(i=>{typeof document>"u"||window.setTimeout(()=>{const m=document.querySelector(`[data-review-field="${String(i)}"]`);if(!m)return;m.scrollIntoView({behavior:"smooth",block:"center"});const x=m.querySelector('input, textarea, button, [tabindex]:not([tabindex="-1"])');window.requestAnimationFrame(()=>{(x||m).focus({preventScroll:!0})})},0)},[]),lo=c.useCallback(()=>{if(!da)return;const i=Ke[hs+1],m=Xs(Jt,q);if(m.length>0){M(x=>new Set([...Array.from(x),...m])),ge({section:q,nextSection:i,fields:m}),yr(m[0]);return}ge(null),Dt(i)},[q,hs,yr,Dt,da,Jt]),oo=c.useCallback(()=>{ca&&(ge(null),Dt(Ke[hs-1]))},[hs,Dt,ca]),co=c.useCallback(()=>{if(!de)return;const{nextSection:i}=de;ge(null),Dt(i)},[Dt,de]),uo=c.useCallback(()=>{const i=de==null?void 0:de.fields[0];i&&yr(i)},[yr,de]);c.useEffect(()=>{const i=new Map;Ke.forEach(m=>{const x=Xs(Jt,m);i.set(m,x)}),M(m=>{if(m.size===0)return m;const x=new Set(Jo(Jt,m,Ke));return x.size===m.size?m:x}),ge(m=>{if(!m)return m;const x=i.get(m.section)??[];return x.length===m.fields.length?m:x.length>0?{...m,fields:x}:null})},[Jt]);const xt=c.useCallback(async()=>{const i=E.current,m=n,x=oe.current+1;oe.current=x;try{const T=await xs.getAutofillStatus();if(!pe(i,m)||oe.current!==x)return;Ie.current=0,ye(T)}catch(T){console.error("Failed to fetch overall autofill status:",T),Ie.current+=1,Ie.current>=Ua&&pe(i,m)&&oe.current===x&&ye($a(T))}},[ye,pe,n]),Lt=c.useCallback(async(i,m={})=>{const x=E.current,T=n,J=(je.current[i]??0)+1;je.current={...je.current,[i]:J},m.silent||Nt(V=>({...V,[i]:!0}));try{const V=await xs.getAutofillStatus(i);if(!pe(x,T)||je.current[i]!==J)return;Ae.current[i]=0,ve({[i]:V})}catch(V){console.error(`Failed to fetch ${i} autofill status:`,V);const F=(Ae.current[i]??0)+1;Ae.current[i]=F,F>=Ua&&pe(x,T)&&je.current[i]===J&&ve({[i]:$a(V,i)})}finally{!m.silent&&pe(x,T)&&je.current[i]===J&&Nt(V=>({...V,[i]:!1}))}},[ve,pe,n]),vr=c.useCallback(async()=>{const i=E.current,m=n,x={},T={...je.current};Js.forEach(F=>{const se=(T[F]??0)+1;T[F]=se,x[F]=se}),je.current=T;const J=await Promise.all(Js.map(async F=>{try{const se=await xs.getAutofillStatus(F);return Ae.current[F]=0,[F,se]}catch(se){console.error(`Failed to fetch ${F} autofill status:`,se);const Oe=(Ae.current[F]??0)+1;return Ae.current[F]=Oe,Oe>=Ua?[F,$a(se,F)]:null}}));if(!pe(i,m))return;const V={};J.forEach(F=>{if(!F)return;const[se,Oe]=F;je.current[se]===x[se]&&(V[se]=Oe)}),ve(V)},[ve,pe,n]),vn=c.useCallback(async i=>{i.clearSuggestions&&ae(),await Promise.all([i.refreshFiles?_t(U):Promise.resolve(),i.refreshAuthorities?U.invalidateQueries({queryKey:["entitlements"]}):Promise.resolve(),i.refreshAuthorities?U.invalidateQueries({queryKey:["subscription","summary"]}):Promise.resolve(),xt(),vr()])},[ae,U,vr,xt]),fs=c.useCallback((i={})=>{const m=nn(i),x=Date.now();if(!(!m.force&&x-Rs.current<3e4)){if(Ls.current){kt.current=jh(kt.current,m);return}Rs.current=x,Ls.current=!0,(async()=>{let T=m;try{for(;T;)await vn(T),T=kt.current,kt.current=null,T&&(Rs.current=Date.now())}finally{Ls.current=!1;const J=kt.current;kt.current=null,J&&fs(J)}})()}},[vn]);c.useEffect(()=>{if(!n)return;const i=()=>{fs({force:!0,clearSuggestions:!0})};return window.addEventListener(Bn,i),()=>window.removeEventListener(Bn,i)},[fs,n]),c.useEffect(()=>{if(!n||!o)return;const i=()=>{typeof document<"u"&&document.visibilityState==="hidden"||fs()};return window.addEventListener("focus",i),window.addEventListener("online",i),document.addEventListener("visibilitychange",i
2),()=>{window.removeEventListener("focus",i),window.removeEventListener("online",i),document.removeEventListener("visibilitychange",i)}},[o,fs,n]),c.useEffect(()=>{!Z||B>0||(A.current=null,N.current={},I(null),y({}),ae(),ih(n))},[ae,B,Z,n]);const zt=u[q]??null,mo=ra(zt),jn=ra(k),jr=Wi(zt,k);c.useEffect(()=>{ut&&ae()},[ae,ut,jn]),c.useEffect(()=>{const i=ut&&(!zt||zt.phase==="empty");jr&&!i||Lt(q,{silent:!0})},[q,mo,zt==null?void 0:zt.phase,jr,jn,ut,Lt]),c.useEffect(()=>{o&&(xt(),vr())},[o,vr,xt]),c.useEffect(()=>{if(!k){xt();return}if(Yr(k))return Hi(()=>xt())},[k,xt]),c.useEffect(()=>{const i=u[q];if(Yr(i)||Yr(k))return Hi(()=>Lt(q,{silent:!0}))},[q,u,k,Lt]);const ho=c.useCallback(async()=>{if(!(!n||ee)){ne(!0);try{if(!await C(l)){st({type:"error",message:"PDF export failed because your latest profile changes could not be saved."});return}await ga(()=>xs.downloadPdf(),{maxRetries:1,baseDelayMs:La})}catch(i){console.error("PDF export failed:",i),st({type:"error",message:"PDF export failed. Please try again after saving your profile."})}finally{ne(!1)}}},[ee,l,C,n]),fo=c.useCallback(async()=>{h==="saving"||!await C(l)||a("/home")},[a,l,C,h]);c.useEffect(()=>{if(!Fe)return;rt(!0);const i=window.setTimeout(()=>rt(!1),za);return()=>window.clearTimeout(i)},[Fe]),c.useEffect(()=>{if(dt||!Fe)return;const i=window.setTimeout(()=>st(null),200);return()=>window.clearTimeout(i)},[dt,Fe]);const Se=c.useCallback(i=>{st(i)},[]),Xt=c.useCallback((i,m)=>{i.forEach(x=>{$e(x,m[x]),f(x,m[x])})},[$e,f]),Nr=c.useCallback((i,m)=>{const x=ns(i,m);return x&&nt.current.add(x),x},[]),Nn=c.useCallback((i,m)=>Hs(i==null?void 0:i.summary,m)?(i==null?void 0:i.summary)??null:null,[]),Sn=c.useCallback((i,m,x)=>{const T=ue[i]||[],J=Nl(x,T,Gr),V=di(J,m.suggestions,Gr),F=Ki(T,V.inlineSuggestions),se=Ki(P[i]||[],V.reviewSuggestions);be(fe=>({...fe,[i]:F})),te(fe=>({...fe,[i]:se}));const Oe=Ui(x,F),_e=F.filter(fe=>Br(Oe,fe)).length+se.filter(fe=>Br(Oe,fe)).length,We=V.blockedReasons.values().next().value,Me=We?Jl[We]:null,Bt=[...F,...se].map(fe=>At(fe.fieldKey)).filter(fe=>!!fe);return{totalPendingCount:_e,blockedMessage:Me,pendingFields:Bt}},[ue,P]),Cn=c.useCallback(i=>{const m=u[i],x=ns(i,m),T=Ws(i,m);ki(n,T),Ps(n,x),nt.current.delete(x),be(J=>({...J,[i]:[]})),te(J=>({...J,[i]:[]})),we(J=>({...J,[i]:null}))},[u,n]),wn=c.useCallback((i,m,x)=>{const T=Nr(i,m);if(!T){nt.current.delete(T);return}const J=w.current,V=di(J,[...x.inlineSuggestions,...x.reviewSuggestions],Gr),F=i==="honors"&&Hs(x.honorsSummary,J.honors)?x.honorsSummary:null;if(V.inlineSuggestions.length===0&&V.reviewSuggestions.length===0&&!F){Ps(n,T),nt.current.delete(T);return}be(se=>({...se,[i]:V.inlineSuggestions})),te(se=>({...se,[i]:V.reviewSuggestions})),we(se=>({...se,[i]:F}))},[Nr,n]);c.useEffect(()=>{const i=Fs.current;if(Fs.current=oa,!o||!i)return;Ii(i,oa).forEach(x=>{Ms.current.add(x)})},[oa,o]),c.useEffect(()=>{!o||ut||Js.forEach(i=>{var Oe,_e;if(pt[i]!==!0)return;const m=u[i],x=ns(i,m),T=Wi(m,k)||!on(k);if(!gh({status:m,statusIsCurrent:T,existingInlineCount:((Oe=ue[i])==null?void 0:Oe.length)??0,existingReviewCount:((_e=P[i])==null?void 0:_e.length)??0,restoreKey:x,restoredKeys:nt.current}))return;const V=Ah(n,x),F=((V==null?void 0:V.inlineSuggestions.length)??0)+((V==null?void 0:V.reviewSuggestions.length)??0),se=i==="honors"&&(V==null?void 0:V.honorsSummary)!=null;m&&V&&(F>0||se)&&wn(i,m,V)})},[u,pt,ue,ut,k,o,wn,P,n]),c.useEffect(()=>{!o||ut||Js.forEach(i=>{const m=u[i],x=ns(i,m);!x||!nt.current.has(x)||Th(n,x,{inlineSuggestions:ue[i]||[],reviewSuggestions:P[i]||[],honorsSummary:i==="honors"?_.honors??null:null})})},[u,_.honors,ue,ut,o,P,n]);const ua=c.useCallback(async(i,m,x=!1)=>{if(!Ce[i]&&!ds(k)){xe(T=>({...T,[i]:!0}));try{const T=m??l,J=Ii(Fs.current,Ti(T)),V=Ms.current.has(i)||J.has(i),F=vh(i,T,V);if(F.length>0){Gt.current=!0;const bt=await C(T,F);if(bt&&(Gt.current=!1),!bt){Ht(!0),Se({type:"error",message:`${Ra[i]} changes could not be saved before autofill.`});return}}const se=u[i],Oe=Object.entries(R).filter(([,bt])=>!!bt).map(([bt])=>bt),_e=xh(i,T,Oe),We=!x&&!_e&&ct.current[i]===!0&&(se==null?void 0:se.canOpenAutofill),Me=We?se:await ga(()=>xs.refreshAutofillForCurrentPrompt(i),{maxRetries:1,baseDelayMs:La});
2if(We||(ve({[i]:Me}),await xt()),!Me.canOpenAutofill||x&&Yr(Me)){ds(Me)||Se(of(i,Me,e));return}const Bt=await ga(()=>xs.getAutofillSuggestions({tab:i}),{maxRetries:1,baseDelayMs:La});if(Bt.stale){const bt=ns(i,Me);nt.current.delete(bt),Ps(n,bt),Lt(i,{silent:!0}),Se({type:"info",message:"Autofill suggestions are being refreshed from your latest files."});return}const fe=Nr(i,Me),Pe=Ws(i,Me);(bh(i,T)||V)&&(ki(n,Pe),Ps(n,fe),nt.current.delete(fe),Ms.current.delete(i));const Je=Bt.tabs[i],Fn=w.current;if(we(bt=>({...bt,[i]:i==="honors"?Nn(Je,Fn.honors):null})),!Je||Je.status==="empty"){Ps(n,fe),Se({type:"info",message:e("buildProfile.autofillSectionNoSuggestions",{section:e(`buildProfile.sections.${i}`)})});return}if(Je.status==="unsupported"){Ps(n,fe),Se({type:"info",message:e("buildProfile.autofillSectionUnsupported",{section:e(`buildProfile.sections.${i}`)})});return}const $o=Ih(Je,wh(n,Pe)),{totalPendingCount:Vo,blockedMessage:Rn,pendingFields:Ko}=Sn(i,$o,Fn);if(Rn){Se({type:"info",message:Rn});return}if(Vo>0){Pi(Ko);return}Se({type:"info",message:`No new autofill suggestions were generated for ${Ra[i]}.`})}catch(T){console.error(`Failed to autofill ${i}:`,T),Se({type:"error",message:"Autofill failed. Please try again."})}finally{xe(T=>({...T,[i]:!1}))}}},[Ce,u,ve,Nn,e,Sn,k,R,l,xt,Lt,Nr,C,Se,n]),po=c.useCallback(async i=>{const m={...l,testRecords:i};if(!await C(m,["testRecords"])){Se({type:"error",message:"Testing changes could not be saved."});return}Cn("testing")},[Cn,l,C,Se]),wt=c.useCallback((i,m)=>{const x=u[i];x&&Ph(n,Ws(i,x),Ft(m))},[u,n]),Pn=c.useCallback((i,m)=>{const x=u[i];x&&Di(n,Ws(i,x),m)},[u,n]),Sr=c.useCallback(()=>me.current?!1:(me.current=!0,Ne(!0),!0),[]),Cr=c.useCallback(()=>{me.current=!1,Ne(!1)},[]),ps=c.useCallback((i,m)=>{const x=Ft(m);be(T=>({...T,[i]:(T[i]||[]).filter(J=>Ft(J)!==x)}))},[]),wr=c.useCallback((i,m)=>{const x=Ft(m);te(T=>({...T,[i]:(T[i]||[]).filter(J=>Ft(J)!==x)}))},[]),Zt=c.useCallback((i,m)=>{wt(i,m),ps(i,m),Se({type:"info",message:"Autofill suggestion dismissed."})},[wt,ps,Se]),es=c.useCallback((i,m)=>{const x=ls(l,m,{allowReviewOnly:!0}),T=Ji(l,m,x);if(T){Se({type:"info",message:T});return}if(wt(i,m),ps(i,m),x.applied){Xt(x.changedFields,x.nextProfile);const J=new Set(l.honors.map(F=>F.id)),V=x.nextProfile.honors.filter(F=>!J.has(F.id)).map(F=>F.id);re(F=>F&&F.section!==i?{section:i,fields:x.changedFields,honorIds:V}:{section:i,fields:Array.from(new Set([...(F==null?void 0:F.fields)||[],...x.changedFields])),honorIds:Array.from(new Set([...(F==null?void 0:F.honorIds)||[],...V]))}),Se({type:"success",message:"Suggestion accepted."});return}Se({type:"info",message:"That suggestion is already reflected in your draft."})},[Xt,wt,l,ps,Se]),zs=c.useCallback((i,m)=>{wt(i,m),wr(i,m),Se({type:"info",message:"Autofill suggestion dismissed."})},[wt,wr,Se]),Bs=c.useCallback((i,m)=>{const x=ls(l,m,{allowReviewOnly:!0}),T=Ji(l,m,x);if(T){Se({type:"info",message:T});return}if(wt(i,m),wr(i,m),x.applied){Xt(x.changedFields,x.nextProfile),re(J=>J&&J.section!==i?{section:i,fields:x.changedFields,honorIds:[]}:{section:i,fields:Array.from(new Set([...(J==null?void 0:J.fields)||[],...x.changedFields])),honorIds:(J==null?void 0:J.honorIds)||[]}),Se({type:"success",message:"Suggestion accepted."});return}Se({type:"info",message:"That suggestion is already reflected in your draft."})},[Xt,wt,l,wr,Se]),An=c.useCallback(i=>{const m=Ee[i]||[],x=Yt[i]||[],T=l,J=[...m.filter(ta)];let V=l;const F=[],se=[],Oe=new Set;if(J.forEach(Pe=>{const Be=ls(V,Pe,{allowReviewOnly:!0});if(Be.blockedReason){i==="activities"&&Be.blockedReason==="activities_full"&&se.push(Pe);return}if(!Be.applied){se.push(Pe);return}V=Be.nextProfile,F.push(Pe),se.push(Pe),Be.changedFields.forEach(Je=>Oe.add(Je))}),se.forEach(Pe=>{wt(i,Pe),ps(i,Pe)}),F.length===0){Se({type:"info",message:"That suggestion is already reflected in your draft."});return}const _e=Array.from(Oe),We=V;Xt(_e,V),Pi(_e);const Me=new Set(T.honors.map(Pe=>Pe.id)),Bt=V.honors.filter(Pe=>!Me.has(Pe.id)).map(Pe=>Pe.id);re(Pe=>Vi(Pe,i,_e,Bt));const fe=se.map(Ft);Se({type:"success",message:e("buildProfile.autofillAppliedCount",{count:F.length,label:e(F.length===1?"buildProfile.autofillSuggestionSingular":"buildProfile.autofillSuggestionPlural")}),actionLabel:e("buildProfile.autofillUndo"),onAction:()=>{const Pe=w.current,Be=_e.filter(Je=>$i(Pe[Je],We[Je]));Be.length>0&&Xt(Be,T),Pn(i,fe),be(Je=>
2({...Je,[i]:m})),te(Je=>({...Je,[i]:x})),re(null)}})},[Xt,wt,e,l,ps,Se,Pn,Ee,Yt]),ma=c.useCallback(async(i,m)=>{if(m.length===0){Se({type:"info",message:"No remaining honors slots are available for these recommendations."});return}if(Sr())try{const x=l.honors,T=ue.honors||[],J=P.honors||[],V=_.honors??i,F=xm(i,m,l.honors,cf);if(F.length===x.length&&F.every((fe,Pe)=>{var Be;return fe.id===((Be=x[Pe])==null?void 0:Be.id)})){Se({type:"info",message:"That suggestion is already reflected in your draft."});return}const se={...l,honors:F};if(!await C(se,["honors"])){Se({type:"error",message:"Selected honors could not be saved. Please try again."});return}const _e=wl(i,m),We=u.honors,Me=We&&El(We)?Ws("honors",We):"";Me&&zl(n,Me,_e),Hs(i,F)||we(fe=>fe.honors==null?fe:{...fe,honors:null}),be(fe=>{const Pe=fe.honors||[],Be=Qa(Pe,_e);return Be.length===Pe.length?fe:{...fe,honors:Be}}),te(fe=>{const Pe=fe.honors||[],Be=Qa(Pe,_e);return Be.length===Pe.length?fe:{...fe,honors:Be}});const Bt=F.filter(fe=>!x.some(Pe=>Pe.id===fe.id)).map(fe=>fe.id);re(fe=>Vi(fe,"honors",["honors"],Bt)),Se({type:"success",message:e("buildProfile.honors.appliedSelected"),actionLabel:e("buildProfile.autofillUndo"),onAction:()=>{$i(w.current.honors,F)&&C({...w.current,honors:x},["honors"]),Me&&Di(n,Me,_e),we(fe=>({...fe,honors:V})),be(fe=>({...fe,honors:T})),te(fe=>({...fe,honors:J})),re(null)}})}finally{Cr()}},[u.honors,_.honors,Sr,Cr,e,ue.honors,l,P.honors,C,Se,n]),gs=h==="failed"?v!=null&&v.trim()&&v.trim()!=="Save failed"?v.trim():"Please try again.":null;c.useEffect(()=>{if(!gs)return;if(Gt.current){Gt.current=!1,Ht(!0);return}Ht(!1);const i=window.setTimeout(()=>Ht(!0),za);return()=>window.clearTimeout(i)},[gs]);const go=h==="saved"?t.jsxs("span",{"aria-live":"polite",className:"pointer-events-none inline-flex h-4 select-none items-center gap-1.5 whitespace-nowrap text-[11px] font-semibold leading-none text-emerald-700",children:[t.jsx(il,{size:12}),e("pagesUi.buildProfile.saved")]}):h==="failed"?t.jsxs("span",{"aria-live":"polite",className:"pointer-events-none inline-flex h-4 select-none items-center gap-1.5 whitespace-nowrap text-[11px] font-semibold leading-none text-rose-700",title:gs?e("pagesUi.buildProfile.saveFailedWithError",{error:gs}):e("pagesUi.buildProfile.saveFailed"),children:[t.jsx(Ac,{size:12}),e("pagesUi.buildProfile.saveFailed")]}):t.jsx("span",{"aria-hidden":"true",className:"invisible inline-flex h-4 select-none items-center gap-1.5 whitespace-nowrap text-[11px] font-semibold leading-none",children:e("pagesUi.buildProfile.saved")}),ha=gs&&!ia?t.jsxs("div",{role:"alert","aria-live":"assertive",className:`fixed left-1/2 z-[1000] flex w-[min(92vw,560px)] -translate-x-1/2 items-start justify-between gap-3 rounded-2xl border border-rose-200/70 bg-white/95 px-5 py-4 text-slate-800 shadow-[0_20px_48px_-24px_rgba(15,23,42,0.45)] backdrop-blur-md transition-all duration-200 ${Fe&&dt?"top-44":"top-24"}`,children:[t.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[t.jsx("span",{className:"mt-2 h-2.5 w-2.5 shrink-0 rounded-full bg-rose-500","aria-hidden":"true"}),t.jsxs("div",{className:"min-w-0 text-left",children:[t.jsx("p",{className:"text-sm font-semibold leading-5 text-slate-900",children:e("pagesUi.buildProfile.saveFailed")}),t.jsx("p",{className:"mt-1 break-words text-sm font-medium leading-5 text-slate-700",children:gs})]})]}),t.jsx("button",{type:"button","aria-label":e("pagesUi.buildProfile.dismissSaveError"),className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-500 transition hover:border-slate-300 hover:text-slate-700",onClick:()=>Ht(!0),children:t.jsx(Tt,{size:15})})]}):null,xo=c.useMemo(()=>({firstName:R.firstName,lastName:R.lastName,gender:R.gender,dateOfBirth:R.dateOfBirth,raceEthnicity:R.raceEthnicity,citizenship:R.citizenship,country:R.country,address:R.address,inStateTuitionState:R.inStateTuitionState,sex:R.sex,pronouns:R.pronouns,otherPronouns:R.otherPronouns,preferredName:R.preferredName,middleName:R.middleName,suffix:R.suffix,hasFormerLegalName:R.hasFormerLegalName,formerFirstName:R.formerFirstName,formerMiddleName:R.formerMiddleName,formerLastName:R.formerLastName,preferredPhoneType:R.preferredPhoneType,preferredPhoneNumber:
2R.preferredPhoneNumber,mobilePhoneNumber:R.mobilePhoneNumber,alternatePhoneType:R.alternatePhoneType,alternatePhoneNumber:R.alternatePhoneNumber,citizenshipStatus:R.citizenshipStatus,commonAppFeeWaiverEligible:R.commonAppFeeWaiverEligible,otherCitizenships:R.otherCitizenships,hasAlternateMailingAddress:R.hasAlternateMailingAddress,alternateMailingAddress:R.alternateMailingAddress,alternateMailingCountry:R.alternateMailingCountry,countryOfBirth:R.countryOfBirth,cityOfBirth:R.cityOfBirth,stateOfBirth:R.stateOfBirth,yearsInUnitedStates:R.yearsInUnitedStates,hasValidUsVisa:R.hasValidUsVisa,currentVisaType:R.currentVisaType,otherVisaType:R.otherVisaType,visaNumber:R.visaNumber,visaIssueDate:R.visaIssueDate,intendsToApplyForNewVisa:R.intendsToApplyForNewVisa}),[R]),bo=c.useMemo(()=>({firstName:$.firstName,lastName:$.lastName,gender:$.gender,dateOfBirth:$.dateOfBirth,raceEthnicity:$.raceEthnicity,citizenship:$.citizenship,country:$.country,address:$.address,inStateTuitionState:$.inStateTuitionState,sex:$.sex,pronouns:$.pronouns,otherPronouns:$.otherPronouns,preferredName:$.preferredName,middleName:$.middleName,suffix:$.suffix,hasFormerLegalName:$.hasFormerLegalName,formerFirstName:$.formerFirstName,formerMiddleName:$.formerMiddleName,formerLastName:$.formerLastName,preferredPhoneType:$.preferredPhoneType,preferredPhoneNumber:$.preferredPhoneNumber,mobilePhoneNumber:$.mobilePhoneNumber,alternatePhoneType:$.alternatePhoneType,alternatePhoneNumber:$.alternatePhoneNumber,citizenshipStatus:$.citizenshipStatus,commonAppFeeWaiverEligible:$.commonAppFeeWaiverEligible,otherCitizenships:$.otherCitizenships,hasAlternateMailingAddress:$.hasAlternateMailingAddress,alternateMailingAddress:$.alternateMailingAddress,alternateMailingCountry:$.alternateMailingCountry,countryOfBirth:$.countryOfBirth,cityOfBirth:$.cityOfBirth,stateOfBirth:$.stateOfBirth,yearsInUnitedStates:$.yearsInUnitedStates,hasValidUsVisa:$.hasValidUsVisa,currentVisaType:$.currentVisaType,otherVisaType:$.otherVisaType,visaNumber:$.visaNumber,visaIssueDate:$.visaIssueDate,intendsToApplyForNewVisa:$.intendsToApplyForNewVisa}),[$]),yo=c.useMemo(()=>({parentsMaritalStatus:R.parentsMaritalStatus,homeWith:R.homeWith,siblingsCount:R.siblingsCount,childrenCount:R.childrenCount}),[R]),vo=c.useMemo(()=>({parentsMaritalStatus:$.parentsMaritalStatus,homeWith:$.homeWith,siblingsCount:$.siblingsCount,childrenCount:$.childrenCount}),[$]),jo=c.useMemo(()=>({currentSchool:R.currentSchool,grade:R.grade,classYear:R.classYear,route:R.route,gpa:R.gpa,gpaScale:R.gpaScale,classRank:R.classRank,currentSchoolEntryDate:R.currentSchoolEntryDate,boardingSchool:R.boardingSchool,livesOnCampus:R.livesOnCampus,willGraduate:R.willGraduate,graduationDate:R.graduationDate,schoolProgressionContext:R.schoolProgressionContext,hasCollegeCoursework:R.hasCollegeCoursework,schedulingSystem:R.schedulingSystem,applicantDescription:R.applicantDescription,highestDegreeIntended:R.highestDegreeIntended,careerInterest:R.careerInterest,otherCareerInterest:R.otherCareerInterest}),[R]),No=c.useMemo(()=>({currentSchool:$.currentSchool,grade:$.grade,classYear:$.classYear,route:$.route,gpa:$.gpa,gpaScale:$.gpaScale,classRank:$.classRank,currentSchoolEntryDate:$.currentSchoolEntryDate,boardingSchool:$.boardingSchool,livesOnCampus:$.livesOnCampus,willGraduate:$.willGraduate,graduationDate:$.graduationDate,schoolProgressionContext:$.schoolProgressionContext,hasCollegeCoursework:$.hasCollegeCoursework,schedulingSystem:$.schedulingSystem,applicantDescription:$.applicantDescription,highestDegreeIntended:$.highestDegreeIntended,careerInterest:$.careerInterest,otherCareerInterest:$.otherCareerInterest}),[$]),So=c.useMemo(()=>({intendedMajor:R.intendedMajor,isUndecidedAboutMajor:R.isUndecidedAboutMajor,secondChoiceMajor:R.secondChoiceMajor}),[R]),Co=c.useMemo(()=>({intendedMajor:$.intendedMajor,isUndecidedAboutMajor:$.isUndecidedAboutMajor,secondChoiceMajor:$.secondChoiceMajor}),[$]),wo=c.useMemo(()=>(Ee.academic||[]).filter(i=>i.suggestionType==="string_list_item"),[Ee.academic]),Po=c.useMemo(()=>(Ee.personal||[]).filter(i=>i.suggestionType==="language_item"),[Ee.personal]),Ao=c.useMemo(()=>(Ee.family||[]).filter(i=>i.suggestionType==="family_contact_item"),[Ee.family]),To=c.useMemo(()=>(Ee.education||[]).filter(i=>i.suggestionType==="secondary_school_item"||i.suggestionType==="college_coursework_item"||i.suggestionType==="current_course_item"),[Ee.education]),Io=Ee.testing||[],ko=c.useMemo(()=>({activityOtherResponsibilitiesDescription:R.activityOtherResponsibilitiesDescription}),[R]),Do=c.useMemo(()=>({activityOtherResponsibilitiesDescription:$.activityOtherResponsibilitiesDescription}),[$]),Eo=c.useMemo(()=>(Ee.activities||[]).filter(i=>i.suggestionType!=="scalar_field"),[Ee.activities]),Oo=Ee.honors||[],ts=at&&Hs(_.honors,l.honors)?_.honors??null:null,Pr=!!Ce[q],Tn=!0,In=on(k),_o=jr||!In,Re=dh({overallStatus:k,sectionStatus:zt,sectionStatusIsCurrent:jr,hasOverallStatusRevision:In}),fa=!!It[q]||!_o&&!ut,Mo=[(Re==null?void 0:Re.phase)??"",((On=Re==null?void 0:Re.ingestSession)==null?void 0:On.openedAt)??"",((_n=Re==null?void 0:Re.ingestSession)==null?void 0:_n.latestSourceFingerprint)??"",((Mn=Re==null?void 0:Re.latestJob)==null?void 0:Mn.sourceFingerprint)??""].join("::");c.useEffect(()=>{if(rn(Re,fa,Ue).phase!=="indexing"){ze(0);return}const m=Date.now();ze(0);const x=window.setInterval(()=>{ze(Date.now()-m)},200);return()=>window.clearInterval(x)},[Mo]);const Et=c.useMemo(()=>rn(Re,fa,Ue),[Re,fa,Ue]),Ot=aa(sn(Re),sn(k)),kn=ts?gm(ts.recommendedItems,l.honors):0,Dn=c.useMemo(()=>fh({status:Re,failureFeedback:Ot,heroPhase:Et.phase,visiblePendingCount:q==="honors"?kn:Zh(l,Ee[q]||[]),suggestionsLoaded:nt.current.has(ns(q,Re)),loading:Pr,supported:Tn,t:e}),[Re,Ot,Pr,q,Tn,Et.phase,kn,e,s,l,Ee]),Us=Dn.generate,$s=Dn.apply,Fo=Et.phase!=="indexing"&&Et.phase!=="preparing",Ro=c.useCallback(()=>
2{if(q==="honors"){if(!ts)return;ma(ts,Cl(ts.recommendedItems,l.honors));return}Sr()&&(An(q),Cr())},[q,Sr,Cr,An,ma,ts,l.honors]),Lo=c.useCallback(()=>{var i;if(!me.current){if(Us.action==="retry"){if((i=Ot==null?void 0:Ot.failureCode)!=null&&i.startsWith("STATUS_")){Promise.all([Lt(q),xt()]);return}ua(q,void 0,!0);return}ua(q)}},[Ot==null?void 0:Ot.failureCode,Us.action,q,ua,xt,Lt]),pa=(de==null?void 0:de.section)===q?de:null,zo=c.useCallback(i=>{const m=`buildProfile.requiredFields.${i}`,x=O(m);return x===m?Qo[i]:x},[]),Bo=pa?pa.fields.map(zo).join(", "):"",En=c.useMemo(()=>!L||L.section!==q?[]:L.fields,[q,L]),Uo=h==="saving"||g||Pr||ee||dr;return t.jsx(hc,{userId:n,source:{kind:"profile"},values:l,ready:o,onSyncStart:d,onBatchBusyChange:K,onSave:(i,m)=>C({...l,[i]:m},i==="preferredPhoneNumber"?["preferredPhoneNumber","preferredPhoneType"]:[i]),children:t.jsx(fc,{held:Uo,children:t.jsxs("div",{className:"min-h-screen bg-[#F7F3EE]",children:[t.jsxs("div",{className:"mx-auto max-w-[1440px] px-4 py-6 sm:px-6 lg:px-8",children:[t.jsxs("div",{className:"mb-6 flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:Vh,children:e("buildProfile.heroEyebrow")}),t.jsx("h1",{className:"mt-1 text-2xl font-black tracking-tight text-[#0B1525]",children:e("buildProfile.heroTitle")})]}),t.jsx("div",{className:"w-full max-w-[760px] lg:w-auto",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-end",children:[t.jsx(xd,{percent:Et.percent,statusLabel:Et.statusLabel,tone:Et.tone,animate:Et.animate,hidden:Fo}),t.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[$s?t.jsx(Va,{analyticsId:"build_profile_autofill_apply_all",onClick:Ro,loading:g,disabled:ie||$s.disabled||g,label:$s.label,variant:$s.variant}):null,t.jsx(Va,{"data-analytics-id":"build_profile_autofill",onClick:Lo,loading:Pr,disabled:ie||Us.disabled||g,busy:Et.busy&&!$s,label:Us.label,variant:Us.variant})]})]}),t.jsx(Xr,{feedback:Ot,context:"autofill"})]})})]}),t.jsxs("div",{className:"flex flex-col items-start gap-8 min-h-[calc(100vh-180px)] md:flex-row",children:[t.jsx(ud,{sections:br,progress:io,fileCount:B,activeSection:q,onSectionChange:Dt,onClearProfile:()=>{ie||ur(!0)},onUploadComplete:()=>{fs({force:!0,clearSuggestions:!0,refreshAuthorities:!1,refreshFiles:!1})}}),t.jsx(hd,{actions:t.jsxs("button",{type:"button","data-analytics-id":"build_profile_export_pdf",onClick:ho,disabled:ie||ee,className:"home-white-action inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-slate-200 bg-white px-3.5 py-1.5 text-[13px] font-semibold text-slate-600 shadow-sm transition-colors disabled:opacity-60",children:[ee?t.jsx(Rt,{size:14,className:"animate-spin"}):t.jsx(Tc,{size:14}),e("pagesUi.buildProfile.exportPdf")]}),children:t.jsxs("div",{className:"w-full min-w-0 flex-1 space-y-6",children:[En.length>0?t.jsx(Tm,{fields:En,caption:e("buildProfile.autofillFilledFromDocuments")}):null,q==="personal"&&t.jsx("div",{"data-build-profile-section":"personal",children:t.jsx(Vd,{personalExtension:it,profile:Wt,pendingFields:xo,reviewFields:bo,missingFields:D,autoFillLoading:Ce.personal,pendingSuggestions:Po,pendingCount:Ct.personal,onAcceptPendingSuggestion:i=>es("personal",i),onDismissPendingSuggestion:i=>Zt("personal",i),onAcceptReviewSuggestion:i=>Bs("personal",i),onDismissReviewSuggestion:i=>zs("personal",i),onPersonalExtensionChange:ro,onChange:ms})}),q==="family"&&t.jsx("div",{"data-build-profile-section":"family",children:t.jsx(tu,{profile:De,pendingSuggestions:Ao,pendingFields:yo,reviewFields:vo,autoFillLoading:Ce.family,pendingCount:Ct.family,onAcceptPendingSuggestion:i=>es("family",i),onDismissPendingSuggestion:i=>Zt("family",i),onAcceptReviewSuggestion:i=>Bs("family",i),onDismissReviewSuggestion:i=>zs("family",i),onChange:so})}),q==="education"&&t.jsx("div",{"data-build-profile-section":"education",children:t.jsx(pu,{profile:Wt,educationExtension:Ge,pendingFields:jo,reviewFields:No,missingFields:D,pendingSuggestions:To,autoFillLoading:Ce.education,pendingCount:Ct.education,onAcceptPendingSuggestion:i=>es("education",i),onDismissPendingSuggestion:i=>Zt("education",i),onAcceptReviewSuggestion:i=>Bs("education",i),onDismissReviewSuggestion:i=>zs("education",i),onEducationExtensionChange:to,onChange:ms})}),q==="testing"&&t.jsx("div",{"data-build-profile-section":"testing",children:t.jsx(Zu,{profile:l,testingExtension:la,testingUiState:St.current,pendingSuggestions:Io,pendingCount:Ct.testing,onAcceptPendingSuggestion:i=>es("testing",i),onDismissPendingSuggestion:i=>Zt("testing",i),onDeleteRecord:po,onTestingExtensionChange:ao,onTestingUiStateChange:no,onChange:ms})}),q==="academic"&&t.jsx("div",{"data-build-profile-section":"academic",children:t.jsx(tm,{academicExtension:ke,profile:Wt,pendingFields:So,reviewFields:Co,missingFields:D,pendingSuggestions:wo,pendingCount:Ct.academic,onAcceptPendingSuggestion:i=>es("academic",i),onDismissPendingSuggestion:i=>Zt("academic",i),onAcceptReviewSuggestion:i=>Bs("academic",i),onDismissReviewSuggestion:i=>
2zs("academic",i),onAcademicExtensionChange:Zl,onChange:ms})}),q==="activities"&&t.jsx("div",{"data-build-profile-section":"activities",children:t.jsx(hm,{activitiesExtension:gt,profile:l,pendingFields:ko,reviewFields:Do,pendingSuggestions:Eo,pendingCount:Ct.activities,onAcceptPendingSuggestion:i=>es("activities",i),onDismissPendingSuggestion:i=>Zt("activities",i),onAcceptReviewSuggestion:i=>Bs("activities",i),onDismissReviewSuggestion:i=>zs("activities",i),onActivitiesExtensionChange:eo,onChange:ms})}),q==="honors"&&t.jsx("div",{"data-build-profile-section":"honors",children:t.jsx(Am,{profile:l,autofillSummary:ts,pendingSuggestions:Oo,pendingCount:Ct.honors,onAcceptPendingSuggestion:i=>es("honors",i),onDismissPendingSuggestion:i=>Zt("honors",i),onApplySelectedHonors:ma,autofilledHonorIds:(L==null?void 0:L.section)==="honors"?new Set(L.honorIds):void 0,onChange:ms})}),pa?t.jsx("div",{role:"alert","aria-live":"assertive",className:"rounded-2xl border border-rose-200 bg-rose-50 px-5 py-4 shadow-sm",children:t.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-bold text-rose-900",children:O("buildProfile.missingRequiredTitle")}),t.jsx("p",{className:"mt-1 text-sm font-medium leading-6 text-rose-800",children:O("buildProfile.missingRequiredBody",{fields:Bo})})]}),t.jsxs("div",{className:"flex shrink-0 flex-wrap gap-2",children:[t.jsx("button",{type:"button","data-analytics-id":"build_profile_review_missing_required",onClick:uo,className:"inline-flex items-center justify-center whitespace-nowrap rounded-full border border-rose-200 bg-white px-4 py-2 text-sm font-semibold text-rose-700 shadow-sm hover:bg-rose-100",children:O("buildProfile.reviewMissing")}),t.jsx("button",{type:"button","data-analytics-id":"build_profile_continue_anyway",onClick:co,className:"inline-flex items-center justify-center whitespace-nowrap rounded-full bg-[#16335F] px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-[#0B1525]",children:O("buildProfile.continueAnyway")})]})]})}):null,t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-x-4 gap-y-4 pb-8",children:[t.jsx("div",{className:"flex min-w-0 items-start gap-3",children:t.jsxs("div",{className:"flex shrink-0 flex-col items-center gap-1.5",children:[t.jsx("button",{type:"button","data-analytics-id":"build_profile_save",onClick:j,disabled:ie||h==="saving",className:"inline-flex min-w-[104px] items-center justify-center gap-2 whitespace-nowrap rounded-full bg-[#16335F] px-6 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-[#0B1525] disabled:opacity-60",children:h==="saving"?t.jsxs(t.Fragment,{children:[t.jsx(Rt,{size:14,className:"animate-spin"}),e("pagesUi.buildProfile.saving")]}):e("pagesUi.buildProfile.save")}),go,t.jsxs("label",{className:"inline-flex cursor-pointer select-none items-center gap-2 whitespace-nowrap",children:[t.jsx("div",{role:"switch","aria-checked":p,tabIndex:0,onClick:()=>z(!p),onKeyDown:i=>{(i.key===" "||i.key==="Enter")&&(i.preventDefault(),z(!p))},className:`relative h-5 w-9 rounded-full transition-colors ${p?"bg-[#16335F]":"bg-slate-300"}`,children:t.jsx("span",{className:`absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white shadow transition-transform ${p?"translate-x-4":""}`})}),t.jsx("span",{className:"text-xs font-medium text-slate-500",children:e("pagesUi.buildProfile.autoSave")})]})]})}),t.jsxs("div",{className:"ml-auto flex flex-wrap items-start justify-end gap-2",children:[ca&&t.jsx("button",{type:"button","data-analytics-id":"build_profile_previous_section",onClick:oo,disabled:ie,className:"home-white-action inline-flex items-center gap-1.5 whitespace-nowrap rounded-full border border-slate-200 bg-white px-4 py-2.5 text-sm font-semibold text-slate-600 shadow-sm transition-colors disabled:opacity-60",children:e("pagesUi.buildProfile.previous")}),da?t.jsx("button",{type:"button","data-analytics-id":"build_profile_next_section",onClick:lo,disabled:ie,className:"inline-flex items-center gap-1.5 whitespace-nowrap rounded-full bg-[#16335F] px-4 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-[#0B1525] disabled:opacity-60",children:e("pagesUi.buildProfile.next")}):t.jsx("button",{type:"button","data-analytics-id":"build_profile_complete",onClick:fo,disabled:ie||h==="saving",className:"inline-flex items-center gap-1.5 whitespace-nowrap rounded-full bg-[#16335F] px-4 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-[#0B1525] disabled:opacity-60",children:e("pagesUi.buildProfile.completeProfile")})]})]})]})})]})]}),t.jsx(Bc,{isOpen:dr,onClose:()=>ur(!1),onToast:(i,m)=>Se({type:m??"success",message:i})}),ha&&typeof document<"u"?ir.createPortal(ha,document.body):ha,t.jsx(dc,{toast:Fe,visible:dt,onDismiss:()=>rt(!1),durationMs:za})]})})},n)}export{Mf 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.