1import{bg as g,by as e,d7 as q,bz as R,d8 as Ae,cZ as _,bM as y,bN as S,cI as Q,bY as M,cC as F,bG as V,d0 as z,cT as P,ch as Y,bA as Te,d9 as te,da as se,bT as re,bQ as Ie,db as Le,bR as be,dc as Ne,dd as Re,de as De,df as Me,dg as Fe,cx as ve,cG as Pe,cJ as we,cH as Oe,dh as G,di as K,dj as X,dk as Z,c3 as U,bH as ye,dl as Se,dm as _e,c1 as qe,dn as Ue,dp as Je,bw as Ve,cE as We,cD as ie,dq as He,dr as ze,c$ as ke,ds as Be,c2 as $e,bO as Qe}from"./index-Cwb4f_ZN.js";import{S as Ce}from"./scroll-area-B2V-0fNE.js";import{C as Ye}from"./chevron-left-CRo1wy-8.js";import{S as le,a as ne,b as ce,c as oe,d as B}from"./select-BLWfIZrQ.js";import{u as Ge}from"./useMutation-D1x3VdQq.js";import{D as Ke,d as Xe,a as Ze,b as es,c as ss}from"./dialog-DKnNPpAd.js";import{F as ts,a as de,b as me,c as xe,d as he,e as as}from"./form-BEGUF7DJ.js";import{T as rs}from"./textarea-C8kD5rVU.js";import{C as is}from"./checkbox-o_-aXc5h.js";import{T as ls,a as ns,b as ue,c as pe}from"./tabs-COQq90U9.js";import{J as ge}from"./JobDetailContent-ChaWPrV7.js";import{P as $}from"./progress-CnAuug9F.js";import{S as cs,L as os}from"./SkillsMatchAnalysisPanel-azFvQLXs.js";import{D as ds}from"./DomainAlignmentBar-CIvT5i53.js";import{C as O}from"./circle-check-big-DWUYhsru.js";import{I as ms}from"./info-DsueHBgr.js";import{T as xs}from"./trophy-DWQgN0Fb.js";import{M as ae}from"./map-pin-cJoTDtQx.js";import{C as hs}from"./circle-x-CydmyBk-.js";import{u as us,t as ps}from"./zod-CbUPx1zs.js";import{Q as J}from"./api-CTEacpu_.js";import{i as gs}from"./schema-D5nAxvpm.js";import{B as ee}from"./building-DhheY3x5.js";import{T as js,a as fs}from"./thumbs-up-vE9EZGAK.js";import{A as Ee}from"./activity-TLxC3VP_.js";import{E as bs}from"./external-link-DnxCMsJ4.js";import{f as je}from"./formatDistanceToNow-By2TIgq3.js";import{f as Ns}from"./format-BAchTnH7.js";import{u as vs}from"./useSSE-Cj-wxarE.js";import"./index-BdQq_4o_.js";import"./label-DrsxaWN8.js";import"./SkillsDisplay-CRm8KaSl.js";import"./salaryFormatter-DwExcZrW.js";import"./companyConstants-B5navsLl.js";import"./euro-CPQQhcl1.js";import"./en-US-4RaJY4CL.js";import"./endOfMonth-CuagxU1g.js";function ws({children:a,className:i,showArrows:d=!0,snapEnabled:h=!0,gap:t="gap-6"}){const u=g.useRef(null),[j,b]=g.useState(!1),[T,c]=g.useState(!1),[A,C]=g.useState(!1),[r,k]=g.useState(!1),n=()=>{const N=u.current;if(!N)return;const{scrollLeft:f,scrollWidth:D,clientWidth:E}=N,o=D>E,s=f>10;b(o&&s),C(o&&s);const l=f<D-E-10;c(o&&l),k(o&&l)};g.useEffect(()=>{n();const N=u.current;if(!N)return;const f=new ResizeObserver(n);return f.observe(N),N.addEventListener("scroll",n),window.addEventListener("resize",n),()=>{f.disconnect(),N.removeEventListener("scroll",n),window.removeEventListener("resize",n)}},[a]);const I=N=>{const f=u.current;if(!f)return;const D=f.clientWidth*.8,E=N==="left"?f.scrollLeft-D:f.scrollLeft+D;f.scrollTo({left:E,behavior:"smooth"})};return e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:q("absolute left-0 top-0 bottom-0 w-24 pointer-events-none z-10 transition-opacity duration-300","bg-gradient-to-r from-white dark:from-gray-950 to-transparent",j?"opacity-100":"opacity-0")}),e.jsx("div",{className:q("absolute right-0 top-0 bottom-0 w-24 pointer-events-none z-10 transition-opacity duration-300","bg-gradient-to-l from-white dark:from-gray-950 to-transparent",T?"opacity-100":"opacity-0")}),d&&e.jsx(R,{variant:"outline",size:"icon",className:q("absolute left-2 top-1/2 -translate-y-1/2 z-20 transition-all duration-300 shadow-lg","bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900",A?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:()=>I("left"),"data-testid":"scroll-left-button",children:e.jsx(Ye,{className:"h-4 w-4"})}),d&&e.jsx(R,{variant:"outline",size:"icon",className:q("absolute right-2 top-1/2 -translate-y-1/2 z-20 transition-all duration-300 shadow-lg","bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900",r?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:()=>I("right"),"data-testid":"scroll-right-button",children:e.jsx(Ae,{className:"h-4 w-4"})}),e.jsx("div",{ref:u,className:q("overflow-x-auto pb-4",h&&"scroll-smooth snap-x snap-mandatory","[&::-webkit-scrollbar]:h-2","[&::-webkit-scrollbar-track]:bg-gray-100 dark:[&::-webkit-scrollbar-track]:bg-gray-800","[&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-thumb]:bg-gray-600","[&::-webkit-scrollbar-thumb]:rounded-full","[&::-webkit-scrollbar-thumb]:hover:bg-gray-400 dark:[&::-webkit-scrollbar-thumb]:hover:bg-gray-500",i),children:e.jsx("div",{className:q("flex",t,h&&"[&>*]:snap-start"),children:a})})]})}const ys={"Skills Match (50%)":{icon:V,color:"text-blue-600",label:"Skills"},"Seniority (10%)":{icon:Ne,color:"text-indigo-600",label:"Seniority"},"Experience (10%)":{icon:te,color:"text-green-600",label:"Experience"},"Title Match (5%)":{icon:be,color:"text-cyan-600",label:"Title"},"Education (5%)":{icon:Le,color:"text-purple-600",label:"Education"},"Location (10%)":{icon:ae,color:"text-orange-600",label:"Location"},"Cultural Fit (5%)":{icon:Ie,color:"text-pink-600",label:"Culture"},"Achievements (5%)":{icon:xs,color:"text-yellow-600",label:"Achievements"}};function Ss(a){return a>=70?{label:"Strong",variant:"default",bgColor:"bg-green-500",textColor:"text-green-600"}:a>
1=50?{label:"Good",variant:"secondary",bgColor:"bg-amber-500",textColor:"text-amber-600"}:{label:"Needs Work",variant:"destructive",bgColor:"bg-red-500",textColor:"text-red-600"}}function ks(a){return a>0&&a<=1?Math.round(a*100):Math.round(a)}function Cs({scores:a}){return e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:Object.entries(a).map(([i,d])=>{const h=ks(d),t=ys[i]||{icon:V,color:"text-gray-600",label:i.replace(/[()%0-9]/g,"").trim()},u=t.icon,j=Ss(h);return e.jsx(Re,{children:e.jsxs(De,{children:[e.jsx(Me,{asChild:!0,children:e.jsxs(y,{className:"relative overflow-hidden cursor-pointer hover:shadow-md transition-shadow","data-testid":`score-card-${t.label.toLowerCase()}`,children:[e.jsx("div",{className:`absolute top-0 left-0 w-1 h-full ${j.bgColor}`}),e.jsxs(S,{className:"p-3 pl-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(u,{className:`h-4 w-4 ${t.color}`}),e.jsx("span",{className:"text-xs font-medium text-muted-foreground truncate",children:t.label})]}),e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"text-xl font-bold",children:[Math.round(h),"%"]}),e.jsx(P,{variant:j.variant,className:"text-xs",children:j.label})]}),e.jsx($,{value:h,className:"h-1.5"})]})]})}),e.jsxs(Fe,{children:[e.jsxs("p",{className:"text-sm",children:[t.label,": ",Math.round(h),"%"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:h>=80?"Excellent match for this dimension":h>=60?"Good alignment, minor gaps possible":h>=40?"Moderate fit, room for growth":"Area to focus on for similar roles"})]})]})},i)})})}function Es({filters:a}){if(!a||a.length===0)return null;const i=a.filter(t=>t.passed&&t.rule!=="job_quality").length,d=a.filter(t=>t.rule!=="job_quality").length,h=d>0?i/d*100:0;return e.jsxs(y,{"data-testid":"pre-screen-section",children:[e.jsx(M,{children:e.jsxs(F,{className:"flex items-center gap-2 text-base",children:[e.jsx(O,{className:"h-4 w-4 text-emerald-500"}),"Pre-Screen Results"]})}),e.jsxs(S,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"p-1.5 bg-green-100 dark:bg-green-900 rounded",children:e.jsx(O,{className:"h-4 w-4 text-green-600 dark:text-green-400"})}),e.jsxs("span",{className:"text-sm font-medium",children:[i,"/",d," criteria met"]})]}),e.jsx($,{value:h,className:"h-2 flex-1 max-w-[200px]"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:a.map((t,u)=>{const j=t.rule==="job_quality",b=t.passed&&!j;return e.jsx(y,{className:`border-l-4 ${j?"border-l-orange-500":b?"border-l-green-500":"border-l-amber-500"}`,"data-testid":`pre-screen-filter-${u}`,children:e.jsxs(S,{className:"p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[j?e.jsx(se,{className:"h-4 w-4 text-orange-500 mt-0.5 shrink-0"}):b?e.jsx(O,{className:"h-4 w-4 text-green-500 mt-0.5 shrink-0"}):e.jsx(hs,{className:"h-4 w-4 text-amber-500 mt-0.5 shrink-0"}),e.jsx("span",{className:"font-medium text-sm capitalize",children:t.rule.replace(/_/g," ")})]}),e.jsx(P,{variant:j?"destructive":b?"default":"secondary",className:"text-xs shrink-0",children:j?"Note":b?"Met":"Not Met"})]}),e.jsx("p",{className:"text-xs text-muted-foreground ml-6",children:t.reason})]})},u)})})]})]})}function As({summary:a,missingSkills:i}){if(!(a!=null&&a.summary))return null;const d=i==null?void 0:i.find(h=>h.learnability==="quick");return e.jsxs(y,{className:"border-l-4 border-l-primary bg-gradient-to-r from-primary/5 to-transparent","data-testid":"candidate-summary-section",children:[e.jsx(M,{children:e.jsxs(F,{className:"flex items-center gap-2 text-base",children:[e.jsx(os,{className:"h-4 w-4 text-primary"}),"Your Personalized Summary"]})}),e.jsxs(S,{className:"space-y-4",children:[e.jsx("p",{className:"text-sm leading-relaxed text-foreground",children:a.summary}),a.topStrengths&&a.topStrengths.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-muted-foreground mb-2 uppercase tracking-wide",children:"Your Strengths"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:a.topStrengths.map((h,t)=>e.jsxs(P,{variant:"secondary",className:"bg-green-50 text-green-700 dark:bg-green-900/20 dark:text-green-400",children:[e.jsx(O,{className:"h-3 w-3 mr-1"}),h]},t))})]}),a.keyGaps&&a.keyGaps.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-muted-foreground mb-2 uppercase tracking-wide",children:"Areas to Develop"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:a.keyGaps.map((h,t)=>e.jsxs(P,{variant:"outline",className:"border-amber-300 text-amber-700 dark:border-amber-700 dark:text-amber-400",children:[e.jsx(te,{className:"h-3 w-3 mr-1"}),h]},t))})]}),d&&e.jsxs("div",{className:"bg-primary/5 rounded-md p-3 border border-primary/20 dark:bg-primary/10 dark:border-primary/30",children:[e.jsx(re,{className:"h-3.5 w-3.5 text-primary inline mr-1"}),e.jsxs("span",{className:"text-sm",children:["Adding ",d.skill," could make you a significantly stronger match for this and similar roles."]})]}),a.actionableAdvice&&a.actionableAdvice.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-semibold text-muted-foreground mb-2 uppercase tracking-wide",children:"Next Steps"}),e.jsx("ul",{className:"space-y-1.5",children:a.actionableAdvice.map((h,t)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[e.jsx(re,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),h]},t))})]})]})]})}function Ts({applicationId:a}){var E;const[i,d]=g.useState("Loading your match analysis..."),[h,t]=g.useState(0),[u,j]=g.useState(!1),[b,T]=g.useState(!1),{data:c,isLoading:A,error:C}=_({queryKey:["/api/candidates/applications",a,"match-results"],queryFn:async()=>{const o=await fetch(`/api/candidates/applications/${a}/match-results`,{credentials:"include"});if(o.status===202){const s=await o.json();return d(s.status==="queued"?"Analysis queued for generation...":"Generating your match analysis..."),T(!0),{status:s.status,estimatedSeconds:s.estimatedSeconds}}if(T(!1),!o.ok)throw new Error("Failed to fetch match results");return o.json()},staleTime:300*1e3,refetchInterval:b?2e3:!1,refetchIntervalInBackgroun
1d:!1});if(g.useEffect(()=>{if((c==null?void 0:c.status)==="complete"){j(!1),t(0);return}if(!u&&(A||(c==null?void 0:c.status)==="generating"||(c==null?void 0:c.status)==="queued")&&(j(!0),t(10)),!u)return;const s=[{time:500,text:"Checking for cached analysis...",progress:15},{time:2e3,text:"Analyzing your profile match...",progress:30},{time:4e3,text:"Comparing skills and experience...",progress:50},{time:6e3,text:"Evaluating cultural alignment...",progress:65},{time:8e3,text:"Generating insights...",progress:80},{time:12e3,text:"Almost there...",progress:90}].map(({time:l,text:m,progress:w})=>setTimeout(()=>{(c==null?void 0:c.status)!=="complete"&&(d(m),t(w))},l));return()=>s.forEach(l=>clearTimeout(l))},[A,u,c==null?void 0:c.status]),C)return e.jsx(y,{className:"border-destructive","data-testid":"match-results-error",children:e.jsx(S,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3 text-destructive",children:[e.jsx(Q,{className:"h-5 w-5"}),e.jsx("span",{children:"Unable to load match results. Please try again later."})]})})});if(A||(c==null?void 0:c.status)==="generating"||(c==null?void 0:c.status)==="queued")return e.jsxs(y,{"data-testid":"match-results-loading",children:[e.jsx(M,{children:e.jsxs(F,{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-5 w-5 text-primary animate-pulse"}),"Analyzing Your Match"]})}),e.jsxs(S,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:i}),e.jsxs("span",{className:"text-muted-foreground",children:[h,"%"]})]}),e.jsx($,{value:h,className:"h-2"})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 mt-6",children:[e.jsx(z,{className:"h-24 w-full"}),e.jsx(z,{className:"h-24 w-full"}),e.jsx(z,{className:"h-24 w-full"}),e.jsx(z,{className:"h-24 w-full"})]}),e.jsx("p",{className:"text-sm text-muted-foreground text-center mt-4",children:"This typically takes 5-10 seconds for first-time analysis"})]})]});if(!(c!=null&&c.analysis))return e.jsx(y,{"data-testid":"match-results-unavailable",children:e.jsx(S,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(Q,{className:"h-5 w-5"}),e.jsx("span",{children:"Match analysis is not available for this application."})]})})});const r=c.analysis,k=r.dimensionBreakdowns||{},n=k==null?void 0:k.skills,I=Array.isArray(n==null?void 0:n.matched)?n.matched:[],N=Array.isArray(n==null?void 0:n.missing)?n.missing:[],f=Array.isArray(r.preFilterInclusion)?r.preFilterInclusion:[],D=Array.isArray(r.gapAnalysis)?r.gapAnalysis:[];return e.jsxs("div",{className:"space-y-6","data-testid":"match-results-complete",children:[e.jsxs(y,{children:[e.jsx(M,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(F,{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-5 w-5 text-primary"}),"Your Match Score"]}),e.jsxs(P,{variant:r.overallScore>=80?"default":r.overallScore>=60?"secondary":"outline",className:"text-lg px-3 py-1","data-testid":"overall-score-badge",children:[r.overallScore.toFixed(0),"%"]})]})}),e.jsxs(S,{className:"space-y-4",children:[e.jsx($,{value:r.overallScore,className:"h-3"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:r.overallScore>=80?"You're a strong match for this position!":r.overallScore>=60?"You have a good foundation for this role.":"There are some areas where you could strengthen your profile."}),e.jsx(ds,{score:(E=r.breakdown)==null?void 0:E.vectorSimilarityScore})]})]}),r.candidateSummary&&e.jsx(As,{summary:r.candidateSummary,missingSkills:N}),r.scores&&Object.keys(r.scores).length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Match Breakdown by Dimension"}),e.jsx(Cs,{scores:r.scores})]}),f.length>0&&e.jsx(Es,{filters:f}),I.length>0&&e.jsxs(y,{"data-testid":"matched-skills-section",children:[e.jsxs(M,{children:[e.jsxs(F,{className:"flex items-center gap-2 text-base",children:[e.jsx(O,{className:"h-4 w-4 text-emerald-500"}),"Your Matching Skills"]}),e.jsx("div",{className:"mt-1",children:e.jsx(cs,{directMatchCount:n==null?void 0:n.directMatchCount,relatedMatchCount:n==null?void 0:n.relatedMatchCount,matchedCount:I.length,missingCount:N.length,height:"h-1.5"})})]}),e.jsx(S,{children:(()=>{const o=new Map,s=n==null?void 0:n.transferable;if(s)for(const v of s)o.set(v.toSkill.toLowerCase(),v.fromSkill);const l=[],m=[];for(const v of I.slice(0,15)){const L=v,W=L.viaSkill,p=o.get(v.skill.toLowerCase()),H=W||p;
1L.isDirect===!1||L.isDirect===void 0&&H!==void 0?m.push({...v,viaSkill:H,relatedScore:L.relatedScore}):l.push(v)}const w=l.length>0&&m.length>0;return e.jsxs("div",{className:"space-y-3",children:[w?e.jsxs(e.Fragment,{children:[l.length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-xs font-medium text-muted-foreground flex items-center gap-1",children:[e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-emerald-500"}),"Direct matches (",l.length,")"]}),e.jsx("div",{className:"space-y-1 pl-3",children:l.map((v,L)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{className:"h-3.5 w-3.5 text-emerald-500 shrink-0"}),e.jsx("span",{className:"text-sm",children:v.skill})]},L))})]}),m.length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-xs font-medium text-muted-foreground flex items-center gap-1",children:[e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-blue-400"}),"Related matches (",m.length,")"]}),e.jsx("div",{className:"space-y-1.5 pl-3",children:m.map((v,L)=>e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(Y,{className:"h-3.5 w-3.5 text-blue-400 shrink-0"}),e.jsxs("span",{className:"text-sm",children:["â ",v.skill]}),v.viaSkill&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Te,{className:"h-3 w-3"}),"you have ",e.jsx("span",{className:"font-medium text-foreground",children:v.viaSkill})]}),typeof v.relatedScore=="number"&&e.jsxs("span",{className:"text-xs text-muted-foreground","data-testid":`related-score-${v.skill}`,children:["(related, ",v.relatedScore.toFixed(2),")"]})]},L))})]})]}):e.jsxs("div",{className:"space-y-1",children:[I.slice(0,15).map((v,L)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{className:"h-3.5 w-3.5 text-emerald-500 shrink-0"}),e.jsx("span",{className:"text-sm",children:v.skill})]},L)),(n==null?void 0:n.relatedMatchCount)!==void 0&&n.relatedMatchCount>0&&e.jsxs("p",{className:"text-xs text-muted-foreground pt-1",children:[e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-blue-400 mr-1"}),n.relatedMatchCount," of these matched via related skills in our taxonomy."]})]}),I.length>15&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["+",I.length-15," more skills matched"]})]})})()})]}),N.length>0&&e.jsxs(y,{"data-testid":"skills-gap-section",children:[e.jsx(M,{children:e.jsxs(F,{className:"flex items-center gap-2 text-base",children:[e.jsx(te,{className:"h-4 w-4 text-amber-500"}),"Skills to Develop",N.some(o=>o.learnability==="extensive")&&e.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"(some require significant investment)"})]})}),e.jsxs(S,{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Developing these skills could strengthen your profile for similar roles:"}),e.jsxs("div",{className:"space-y-2",children:[[...N].sort((o,s)=>{const l={critical:0,important:1,beneficial:2};return(l[o.importance??""]??2)-(l[s.importance??""]??2)}).slice(0,10).map((o,s)=>{const l=o.learnability==="quick"?"Quick to learn":o.learnability==="extensive"?"Extensive investment":"Moderate to learn",m=o.learnability==="quick"?"text-emerald-600 dark:text-emerald-400":o.learnability==="extensive"?"text-red-600 dark:text-red-400":"text-amber-600 dark:text-amber-400",w=o.importance==="critical"?e.jsx(Q,{className:"h-3.5 w-3.5 text-destructive shrink-0"}):o.importance==="important"?e.jsx(se,{className:"h-3.5 w-3.5 text-amber-600 dark:text-amber-400 shrink-0"}):e.jsx(ms,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"});return e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[w,e.jsx("span",{className:"bg-amber-50 text-amber-700 dark:bg-amber-900/20 dark:text-amber-400 text-xs rounded-md px-2 py-0.5",children:o.skill}),o.learnability&&e.jsxs("span",{className:`text-xs ${m}`,children:["· ",l]})]}),o.alternatives&&o.alternatives.length>0&&e.jsxs("p",{className:"text-xs text-muted-foreground ml-5",children:["You already have ",o.alternatives.join(", "),", which is related â a head start."]})]},s)}),N.length>10&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["+",N.length-10," more skills"]})]})]})]}),(n==null?void 0:n.transferable)&&n.transferable.length>0&&e.jsxs(y,{"data-testid":"transferable-skills-section",children:[e.jsx(M,{children:e.jsxs(F,{className:"flex items-center gap-2 text-base",children:[e.jsx(O,{className:"h-4 w-4 text-blue-500"}
1),"Skills That Count Toward This Role"]})}),e.jsx(S,{className:"flex flex-wrap gap-2",children:n.transferable.map((o,s)=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(P,{className:"bg-blue-50 text-blue-700 dark:bg-blue-900/20 dark:text-blue-400",children:o.fromSkill}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["relates to ",o.toSkill]})]},s))})]}),D.length>0&&e.jsxs(y,{"data-testid":"gap-analysis-section",children:[e.jsx(M,{children:e.jsxs(F,{className:"flex items-center gap-2 text-base",children:[e.jsx(se,{className:"h-4 w-4 text-amber-500"}),"Areas for Consideration"]})}),e.jsx(S,{children:e.jsx("ul",{className:"space-y-2",children:D.slice(0,4).map((o,s)=>e.jsxs("li",{className:"text-sm text-muted-foreground",children:[e.jsxs("span",{className:"font-medium text-foreground",children:[o.category||o.gap,":"]})," ",o.impact||o.gap]},s))})})]}),c.generatedAt&&e.jsxs("p",{className:"text-xs text-muted-foreground text-center","data-testid":"generated-at",children:["Analysis generated on ",new Date(c.generatedAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit"})]})]})}const Is=gs.pick({jobId:!0,coverLetter:!0}).extend({includeInterviewResults:Ue().default(!1)});function Ls({jobId:a,isOpen:i,onClose:d,__typed:h=!0,__phase:t="5c"}){var L,W;const{user:u}=ve(),{toast:j}=Pe(),b=we(),[T,c]=g.useState(!1),[A,C]=g.useState("details");g.useEffect(()=>{},[]);const{data:r,isLoading:k,error:n}=_({queryKey:J.jobPublic(a),queryFn:async()=>{const p=await fetch(`/api/jobs/public/${a}`,{credentials:"include"});if(!p.ok)throw new Error("Failed to fetch job");return p.json()},enabled:!!a&&i}),{data:I=[]}=_({queryKey:J.candidateApplications(),enabled:!!u&&u.role==="candidate"}),N=I.some(p=>p.jobId===a),f=I.find(p=>p.jobId===a),{data:D=[]}=_({queryKey:J.mockInterviewSessions(),enabled:!!u&&u.role==="candidate"}),E=D.find(p=>p.jobId===a),s=E?E.status==="completed"?{text:"Retake Interview",variant:"outline"}:E.answers&&E.answers.length>0?{text:"Continue Interview",variant:"outline"}:{text:"Practice Interview",variant:"outline"}:{text:"Practice Interview",variant:"outline"},l=(E==null?void 0:E.status)==="completed",m=us({resolver:ps(Is),defaultValues:{jobId:a,coverLetter:"",includeInterviewResults:!1}}),w=Ge({mutationFn:async p=>Oe("/api/applications",{method:"POST",body:JSON.stringify(p)}),onSuccess:()=>
1{j({title:"Application submitted",description:"Your application has been successfully submitted."}),b.invalidateQueries({queryKey:J.candidateApplications()}),c(!1),m.reset()},onError:p=>{const H=p instanceof Error?p.message:"Failed to submit application";j({title:"Error",description:H,variant:"destructive"})}}),v=p=>{w.mutate(p)};return k?e.jsx(G,{open:i,onOpenChange:d,children:e.jsxs(K,{side:"right",className:"w-[1200px] sm:max-w-none p-0 flex flex-col",children:[e.jsx(X,{className:"p-6 border-b",children:e.jsx(Z,{children:"Loading Job Details..."})}),e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-base-primary"})})]})}):n||!r?e.jsx(G,{open:i,onOpenChange:d,children:e.jsxs(K,{side:"right",className:"w-[1200px] sm:max-w-none p-0 flex flex-col",children:[e.jsx(X,{className:"p-6 border-b",children:e.jsx(Z,{children:"Job Unavailable"})}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-6",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-gray-100 flex items-center justify-center mb-4",children:e.jsx(ee,{className:"w-8 h-8 text-gray-400"})}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"This job is no longer available"}),e.jsx("p",{className:"text-gray-500 text-center max-w-md mb-6",children:"The job posting may have been removed or is no longer accepting applications."}),e.jsx(R,{onClick:d,variant:"outline",children:"Close"})]})]})}):e.jsx(e.Fragment,{children:e.jsx(G,{open:i,onOpenChange:d,children:e.jsxs(K,{side:"right",className:"w-[1200px] sm:max-w-none p-0 flex flex-col overflow-hidden",children:[e.jsx(X,{className:"sr-only",children:e.jsx(Z,{children:r.title})}),e.jsx(Ce,{className:"h-full flex-1 overflow-auto",children:e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex justify-between items-start gap-6 mb-6 pr-10",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("h1",{className:"text-2xl font-bold text-base-text mb-2",children:r.title}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-base-text-muted text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ee,{className:"w-4 h-4"}),e.jsx("span",{className:"font-medium",children:((L=r.companyProfile)==null?void 0:L.companyName)||"Company"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"w-4 h-4"}),e.jsx("span",{children:r.location})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{className:"w-4 h-4"}),e.jsxs("span",{children:["Posted ",new Date(r.createdAt).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ye,{className:"w-4 h-4"}),e.jsxs("span",{children:[r.viewCount||0," views"]})]})]})]}),(u==null?void 0:u.role)==="candidate"&&e.jsxs("div",{className:"flex gap-3 flex-shrink-0 items-center",children:[((W=f==null?void 0:f.interviewScheduled)==null?void 0:W.start)&&e.jsxs(P,{className:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900/30 dark:text-indigo-300 border-0 py-1.5 px-3",children:[e.jsx(Se,{className:"w-4 h-4 mr-1.5"}),"Interview: ",new Date(f.interviewScheduled.start).toLocaleString("en-US",{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})]}),N?e.jsxs(R,{variant:"default",disabled:!0,children:[e.jsx(O,{className:"w-4 h-4 mr-2"}),"Already Applied"]}):e.jsxs(Ke,{open:T,onOpenChange:c,children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(R,{variant:"default",children:[e.jsx(_e,{className:"w-4 h-4 mr-2"}),"Apply Now"]})}),e.jsxs(Ze,{className:"sm:max-w-[600px]",children:[e.jsx(es,{children:e.jsxs(ss,{children:["Apply for ",r.title]})}),e.jsx(ts,{...m,children:e.jsxs("form",{onSubmit:m.handleSubmit(v),className:"space-y-4",children:[e.jsx(de,{control:m.control,name:"coverLetter",render:({field:p})=>e.jsxs(me,{children:[e.jsx(xe,{children:"Cover Letter (Optional)"}),e.jsx(he,{children:e.jsx(rs,{placeholder:"Tell us why you're interested in this role...",className:"min-h-[150px]",...p})}),e.jsx(as,{})]})}),l&&e.jsx(de,{control:m.control,name:"includeInterviewResults",render:({field:p})=>e.jsxs(me,{className:"flex flex-row items-start space-x-3 space-y-0",children:[e.jsx(he,{children:e.jsx(is,{checked:p.value,onCheckedChange:p.onChange})}),e.jsxs("div",{className:"space-y-1 leading-none",children:[e.jsx(xe,{children:"Include interview results"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Share your mock interview performance with the employer"})]})]})}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx(R,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(R,{type:"submit",disabled:w.isPending,children:w.isPending?"Submitting...":"Submit Application"})]})]})})]})]}),e.jsxs(R,{variant:"outline",onClick:()=>{window.location.href=`/mock-interview/${a}/${encodeURIComponent(r.title)}`},children:[e.jsx(qe,{className:"w-4 h-4 mr-2"}),s.text]})]})]}),N&&f?e.jsxs(ls,{value:A,onValueChange:p=>C(p),className:"w-full",children:[e.jsxs(ns,{className:"grid w-full grid-cols-2 mb-6",children:[e.jsxs(ue,{value:"details","data-testid":"tab-job-details",children:[e.jsx(ee,{className:"w-4 h-4 mr-2"}),"Job Details"]}
1),e.jsxs(ue,{value:"match-results","data-testid":"tab-match-results",children:[e.jsx(V,{className:"w-4 h-4 mr-2"}),"Match Results"]})]}),e.jsx(pe,{value:"details",children:e.jsx(ge,{job:r,showHeader:!1,isModal:!0})}),e.jsx(pe,{value:"match-results",children:A==="match-results"&&e.jsx(Ts,{applicationId:f.id})})]}):e.jsx(ge,{job:r,showHeader:!1,isModal:!0})]})})]})})})}const x={APPLIED:"applied",VIEWED:"viewed",INTERVIEW_REQUESTED:"interview_requested",INTERVIEW_SCHEDULED:"interview_planned",OFFER:"offer",REJECTED:"rejected",HIRED:"hired"};function Rs(a){const i=String(a).toLowerCase().trim();return i==="applied"||i==="submitted"||i==="new"?x.APPLIED:i==="viewed"||i==="under_review"||i==="reviewed"?x.VIEWED:i==="interview_requested"||i==="shortlisted"?x.INTERVIEW_REQUESTED:i==="interview_scheduled"||i==="interview_planned"||i==="scheduled"||i==="confirmed"?x.INTERVIEW_SCHEDULED:i==="offer"||i==="offer_extended"?x.OFFER:i==="rejected"||i==="not_selected"?x.REJECTED:i==="hired"||i==="accepted"||i==="offer_made"||i==="offer_accepted"?x.HIRED:x.APPLIED}const Ds={[x.APPLIED]:"Applied",[x.VIEWED]:"Under Review",[x.INTERVIEW_REQUESTED]:"Interview requested",[x.INTERVIEW_SCHEDULED]:"Interview scheduled",[x.OFFER]:"Offer Received",[x.REJECTED]:"Not Selected",[x.HIRED]:"Hired"},fe=Ds,Ms={[x.APPLIED]:"bg-violet-100 text-violet-800 dark:bg-violet-900/30 dark:text-violet-300",[x.VIEWED]:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300",[x.INTERVIEW_REQUESTED]:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",[x.INTERVIEW_SCHEDULED]:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900/30 dark:text-indigo-300",[x.OFFER]:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300",[x.REJECTED]:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300",[x.HIRED]:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300"},Fs={[x.APPLIED]:Ee,[x.VIEWED]:ye,[x.INTERVIEW_REQUESTED]:Ne,[x.INTERVIEW_SCHEDULED]:U,[x.OFFER]:ze,[x.REJECTED]:fs,[x.HIRED]:js};function Ps({status:a,applications:i,onViewApplication:d}){const h=Fs[a]||Ee;return e.jsxs("div",{className:"min-w-[320px] flex-shrink-0",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{className:"h-5 w-5 text-gray-600"}),e.jsx("h3",{className:"font-semibold text-gray-900",children:fe[a]})]}),e.jsx(P,{className:"ml-2 bg-violet-100 text-violet-800 dark:bg-violet-900/40 dark:text-violet-300",children:i.length})]}),e.jsx(Ce,{className:"h-[calc(100vh-250px)]",children:e.jsxs("div",{className:"space-y-3 pr-4",children:[i.map(t=>{var u,j,b,T,c,A;return e.jsx(y,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>d(t),"data-application-id":t.id,children:e.jsxs(S,{className:"p-4",children:[e.jsx("div",{className:"mb-3",children:e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"font-medium text-gray-900 line-clamp-1 mb-1",children:t.jobTitle||((u=t.job)==null?void 0:u.title)||"Job Title"}),e.jsx("p",{className:"text-sm text-gray-600 line-clamp-1",children:t.companyName||((b=(j=t.job)==null?void 0:j.companyProfile)==null?void 0:b.companyName)||((T=t.company)==null?void 0:T.name)||"Company"})]}),e.jsx(P,{className:`ml-3 ${Ms[a]||"bg-gray-100 text-gray-800"}`,variant:"secondary",children:fe[a]||"Unknown"})]})}),e.jsxs("div",{className:"space-y-1 text-sm text-gray-600 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ae,{className:"h-3 w-3"}),e.jsx("span",{className:"line-clamp-1",children:t.jobLocation||((c=t.job)==null?void 0:c.location)||"Location not specified"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ke,{className:"h-3 w-3"}),e.jsxs("span",{children:["Applied ",je(new Date(t.appliedAt),{addSuffix:!0})]})]}),t.statusUpdatedAt&&String(t.statusUpdatedAt)!==String(t.appliedAt)&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(U,{className:"h-3 w-3"}),e.jsxs("span",{children:["Updated ",je(new Date(t.statusUpdatedAt),{addSuffix:!0})]})]}),((A=t.interviewScheduled)==null?void 0:A.start)&&e.jsxs("div",{className:"flex items-center gap-1 text-indigo-600 font-medium",children:[e.jsx(Se,{className:"h-3 w-3"}),e.jsxs("span",{children:["Interview: ",Ns(new Date(t.interviewScheduled.start),"MMM d, yyyy h:mm a")]})]})]}),e.jsxs("div",{className:"flex gap-2 mt-3 pt-3 border-t",children:[e.jsxs(R,{size:"sm",variant:"outline",onClick:C=>{C.stopPropagation(),t.jobId&&window.dispatchEvent(new CustomEvent("openJobModal",{detail:{jobId:t.jobId}}))},className:"flex-1 text-xs",children:[e.jsx(bs,{className:"w-3 h-3 mr-1"}),"View Job"]}),a===x.INTERVIEW_REQUESTED&&e.jsxs(R,{size:"sm",variant:"default",onClick:C=>{C.stopPropagation(),sessionStorage.setItem("previousJobPage","/my-applications"),window.location.href=`/interview-scheduling/${t.jobId}`},className:"flex-1 text-xs bg-purple-600 hover:bg-purple-700",children:[e.jsx(U,{className:"w-3 h-3 mr-1"}),t.pendingReschedule?"Reschedule":"Schedule"]}),a===x.INTERVIEW_SCHEDULED&&t.pendingReschedule&&e.jsxs(R,{size:"sm",variant:"default",onClick:C=>{C.stopPropagation(),sessionStorage.setItem("previousJobPage","/my-applications"),window.location.href=`/interview-scheduling/${t.jobId}`},className:"flex-1 text-xs bg-purple-600 hover:bg-purple-700",children:[e.jsx(U,{className:"w-3 h-3 mr-1"}),"Reschedule"]})]})]})},t.id)}),i.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-500",children:e.jsx("p",{children:"No applications in this stage"})})]})})]})}
1function Os({__typed:a=!0,__phase:i="5b"}={}){we(),g.useEffect(()=>{},[]);const[d,h]=g.useState({}),[t,u]=g.useState(null),[j,b]=g.useState(!1),T=Je(),[,c]=Ve();g.useEffect(()=>{const l=m=>{u(m.detail.jobId),b(!0)};return window.addEventListener("openJobModal",l),()=>{window.removeEventListener("openJobModal",l)}},[]);const A=g.useCallback(s=>{const l=new URLSearchParams;return Object.entries(s).forEach(([m,w])=>{w&&w.trim()!==""&&l.append(m,w)}),l.toString()},[]),C=g.useMemo(()=>A(d),[d,A]),{data:r=[],isLoading:k}=_({queryKey:J.candidateApplications(C),queryFn:async()=>{const s=C?`/api/applications/candidate?${C}`:"/api/applications/candidate",l=await fetch(s);if(!l.ok)throw new Error("Failed to fetch candidate applications");const m=await l.json();return m.success?m.data:m},enabled:!0,refetchInterval:6e4,staleTime:3e4,refetchOnWindowFocus:!0,refetchOnMount:!0,placeholderData:s=>s});g.useEffect(()=>{if(!T||r.length===0)return;const s=new URLSearchParams(T),l=s.get("applicationId"),m=s.get("open")==="true";if(l&&m){const w=r.find(v=>v.id===l);w&&(sessionStorage.setItem("previousJobPage","/my-applications"),sessionStorage.setItem("jobModalOrigin","my-applications"),u(w.jobId),b(!0),c("/my-applications",{replace:!0}))}},[T,r,c]);const n=g.useCallback((s,l)=>{h(m=>({...m,[s]:l}))},[]),I=g.useCallback(()=>{h({})},[]),N=r.reduce((s,l)=>{const m=Rs(l.statusV2||"applied");return s[m]||(s[m]=[]),s[m].push(l),s},{}),f=s=>{sessionStorage.setItem("previousJobPage","/my-applications"),sessionStorage.setItem("jobModalOrigin","my-applications"),u(s.jobId),b(!0)},D=()=>{b(!1),u(null)};if(k)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("p",{className:"text-gray-500",children:"Loading applications..."})});const E=Array.from(new Set(r.map(s=>{var l,m,w;return s.companyName||((m=(l=s.job)==null?void 0:l.companyProfile)==null?void 0:m.companyName)||((w=s.company)==null?void 0:w.name)}).filter(s=>!!s))),o=Array.from(new Set(r.map(s=>{var l;return s.jobTitle||((l=s.job)==null?void 0:l.title)}).filter(s=>!!s)));return e.jsxs("div",{className:"h-full",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"My Applications"}),e.jsx("p",{className:"text-gray-600 mt-1",children:"Track your application progress through the hiring process"})]}),e.jsxs(y,{className:"mb-6",children:[e.jsx(M,{children:e.jsxs(F,{className:"flex items-center gap-2",children:[e.jsx(We,{className:"h-5 w-5"}),"Filter Applications"]})}),e.jsx(S,{children:e.jsxs("div",{className:"flex flex-wrap gap-4 items-end",children:[e.jsxs("div",{className:"min-w-[200px]",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Filter by Company"}),e.jsxs(le,{value:d.companyName||"",onValueChange:s=>n("companyName",s==="all"?void 0:s),children:[e.jsx(ne,{children:e.jsx(ce,{placeholder:"All Companies"})}),e.jsxs(oe,{children:[e.jsx(B,{value:"all",children:"All Companies"}),[...E].sort((s,l)=>s.localeCompare(l)).map(s=>e.jsx(B,{value:s||"",children:s},s))]})]})]}),e.jsxs("div",{className:"min-w-[200px]",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Job Title"}),e.jsxs(le,{value:d.jobTitle||"",onValueChange:s=>n("jobTitle",s==="all"?void 0:s),children:[e.jsx(ne,{children:e.jsx(ce,{placeholder:"All Job Titles"})}),e.jsxs(oe,{children:[e.jsx(B,{value:"all",children:"All Job Titles"}),[...o].sort((s,l)=>s.localeCompare(l)).map(s=>e.jsx(B,{value:s||"",children:s},s))]})]})]}),e.jsxs("div",{className:"min-w-[150px]",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Applied From"}),e.jsx(ie,{type:"date",value:d.dateFrom||"",onChange:s=>n("dateFrom",s.target.value),placeholder:"Start date"})]}),e.jsxs("div",{className:"min-w-[150px]",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Applied To"}),e.jsx(ie,{type:"date",value:d.dateTo||"",onChange:s=>n("dateTo",s.target.value),placeholder:"End date"})]}),Object.keys(d).some(s=>d[s])&&e.jsxs(R,{variant:"outline",onClick:I,className:"flex items-center gap-2",children:[e.jsx(He,{className:"h-4 w-4"}),"Clear Filters"]})]})})]}),e.jsx("div",{className:"overflow-hidden",children:e.jsx(ws,{gap:"gap-6",children:Object.values(x).map(s=>e.jsx(Ps,{status:s,applications:N[s]||[],onViewApplication:f},s))})}),t&&e.jsx(Ls,{jobId:t,isOpen:j,onClose:D})]})}function wt(){const{isAuthenticated:a,isLoading:i,user:d}=ve(),{isConnected:h}=vs();console.log("[MY-APPLICATIONS] ð SSE Connected:",h);const{data:t,isLoading:u,refetch:j}=_({queryKey:["/api/applications/candidate"],queryFn:async()=>{console.log("[MY APPLICATIONS] Fetching candidate applications...");const r=await fetch("/api/applications/candidate");if(!r.ok)throw new Error("Failed to fetch applications");const k=await r.json();return console.log("[MY APPLICATIONS] Received applications:",k.map(n=>({id:n.id,status:n.statusV2}))),k},enabled:!!d&&d.role==="candidate",staleTime:0,gcTime:1800*1e3,refetchOnWindowFocus:!0,refetchOnMount:!1,refetchOnReconnect:!1}),{data:b=[]}=_({queryKey:["/api/mock-interview"],queryFn:async()=>{const r=await fetch("/api/mock-interview");if(!r.ok)throw new Error("Failed to fetch practice interview sessions");return r.json()},enabled:!!d&&d.role==="candidate"&&!!(t!=null&&t.length),staleTime:900*1e3,gcTime:1800*1e3,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1});if(i||u)return e.jsx("div",{className:"min-h-screen bg-base-background flex items-center justify-center",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-base-primary"})});if(!a||!d||d.role!=="candidate")return null;const T=(t==null?void 0:t.length)||0,c=(t==null?void 0:t.filter(r=>{var k;return["interview_requested","interview_planned"].includes(((k=r.statusV2)==null?void 0:k.toLowerCase())||"")}).length)||0,A=(b==null?void 0:b.length)||0,C=(t==null?void 0:t.filter(r=>{var k;return["applied","viewed"].includes(((k=r.statusV2)==null?void 0:k.toLowerCase())||"")}).length)||0;return e.jsx(Be,{activeRoute:"/my-applications",children:e.jsx("div",{children:e.jsx("div",{className:"p-8",children:e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-2xl font-bold text-base-text",children:"My Applications"}),e.jsx("p",{className:"text-base-text-muted mt-2",children:"Track the status of your job applications and interviews"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6 mb-8",children:[e.jsx(y,{className:"border-base-gray-200",children:e.jsx(S,{className:"p-6",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"w-12 h-12 bg-base-primary rounded-lg flex items-center justify-center",children:e.jsx(be,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"ml-4",children:[e.jsx("div",{className:"text-2xl font-bold text-base-text",children:T}),e.jsx("div",{className:"text-sm text-base-text-muted",children:"Total Applications"})]})]})})}),e.jsx(y,{className:"border-base-gray-200",children:e.jsx(S,{className:"p-6",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"w-12 h-12 bg-purple-500 rounded-lg flex items-center justify-center",children:e.jsx(U,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"ml-4",children:[e.jsx("div",{className:"text-2xl font-bold text-base-text",children:c}),e.jsx("div",{className:"text-sm text-base-text-muted",children:"Interview Opportunities"})]})]})})}),e.jsx(y,{className:"border-base-gray-200",children:e.jsx(S,{className:"p-6",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"w-12 h-12 bg-green-500 rounded-lg flex items-center justify-center",children:e.jsx(O,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"ml-4",children:[e.jsx("div",{className:"text-2xl font-bold text-base-text",children:A}),e.jsx("div",{className:"text-sm text-base-text-muted",children:"Practice Interviews"})]})]})})}),e.jsx(y,{className:"border-base-gray-200",children:e.jsx(S,{className:"p-6",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"w-12 h-12 bg-yellow-500 rounded-lg flex items-center justify-center",children:e.jsx(ke,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"ml-4",children:[e.jsx("div",{className:"text-2xl font-bold text-base-text",children:C}),e.jsx("div",{className:"text-sm text-base-text-muted",children:"Under Review"})]})]})})})]}),(t==null?void 0:t.length)===0?e.jsx(y,{className:"border-base-gray-200",children:e.jsxs(S,{className:"p-12 text-center",children:[e.jsx($e,{className:"w-16 h-16 text-base-gray-400 mx-auto mb-4"}),e.jsx("h3",{className:"text-xl font-semibold text-base-text mb-2",children:"No Applications Yet"}),e.jsx("p",{className:"text-base-text-muted mb-6",children:"You haven't applied to any jobs yet. Start exploring opportunities!"}),e.jsx(Qe,{to:"/job-search",children:e.jsx(R,{className:"bg-base-primary hover:bg-base-primary-hover text-white",children:"Browse Jobs"})})]})}):e.jsx(Os,{})]})})})})}export{wt as default}; 2//# sourceMappingURL=my-applications-D6l_I321.js.map
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.