1import{r,j as e}from"./animation-CddyXVCz.js";import{r as P}from"./index-PGJMoIYN.js";import{u as $,B as y,X as z,h as p,Y as M,a4 as A}from"./index-CGKNpi9E.js";import{g as W}from"./CareerGPSPage-ZODWO-mQ.js";import"./react-vendor-CbN3pvl2.js";import"./supabase-iKSPld20.js";import"./docgen-Bp8WKBAE.js";import"./query-DPqpbKNH.js";import"./ProGate-BWEPDFOZ.js";import"./Tooltip-c3l9LscW.js";const B={certification:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-300",course:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300",tutorial:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300",book:"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",community:"bg-fuchsia-100 text-fuchsia-700 dark:bg-fuchsia-900/30 dark:text-fuchsia-300"},I=()=>e.jsxs("div",{className:"space-y-3 animate-pulse",children:[e.jsx("div",{className:"h-16 rounded-2xl bg-slate-200 dark:bg-slate-700"}),Array.from({length:4}).map((l,n)=>e.jsxs("div",{className:"rounded-2xl border border-slate-200 p-4 dark:border-slate-700",children:[e.jsx("div",{className:"mb-2 h-4 w-2/3 rounded bg-slate-200 dark:bg-slate-700"}),e.jsx("div",{className:"mb-2 h-3 w-1/3 rounded bg-slate-200 dark:bg-slate-700"}),e.jsx("div",{className:"h-3 w-full rounded bg-slate-200 dark:bg-slate-700"})]},n))]}),J=({isOpen:l,onClose:n,anchorEl:d,skill:c,currentLevel:x,targetRole:m,userExperienceYears:f})=>{const{toast:L}=$(),g=r.useRef(null),[s,C]=r.useState(null),[E,h]=r.useState(!1),[k,j]=r.useState(null),[v,R]=r.useState({top:0,left:0}),N=async()=>{h(!0),j(null);try{const t=await W({skill:c,currentLevel:x,targetRole:m,userExperienceYears:f});C(t)}catch(t){const a=t instanceof Error?t.message:"Failed to load resources";j(a),L.error("Learning resources unavailable",a)}finally{h(!1)}};r.useEffect(()=>{l&&N()},[l,c,m,x,f]),r.useEffect(()=>{if(!l||!d)return;const t=()=>{const a=d.getBoundingClientRect(),o=420,i=16,u=Math.min(Math.max(i,a.left+a.width/2-o/2),window.innerWidth-o-i),b=Math.min(a.bottom+12,window.innerHeight-120);R({top:b,left:u})};return t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[l,d]),r.useEffect(()=>{if(!l)return;const t=o=>{o.key==="Escape"&&n()},a=o=>{var w;const i=o.target,u=d==null?void 0:d.contains(i),b=(w=g.current)==null?void 0:w.contains(i);!u&&!b&&n()};return document.addEventListener("keydown",t),document.addEventListener("mousedown",a),()=>{document.removeEventListener("keydown",t),document.removeEventListener("mousedown",a)}},[l,n,d]);const S=r.useMemo(()=>(s==null?void 0:s.resources.filter(t=>t.recommended).length)??0,[s]);return!l||!d||typeof document>"u"?null:P.createPortal(e.jsxs("div",{ref:g,className:"fixed z-[60] w-[min(420px,calc(100vw-32px))] rounded-[24px] border border-slate-200 bg-white p-4 shadow-2xl dark:border-slate-700 dark:bg-slate-900 animate-in fade-in duration-200",style:{to
1p:v.top,left:v.left},role:"dialog","aria-label":`Learning resources for ${c}`,children:[e.jsxs("div",{className:"mb-4 flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.2em] text-blue-600 dark:text-blue-300",children:"Skill Sprint"}),e.jsx("h3",{className:"mt-1 text-lg font-bold text-slate-900 dark:text-slate-100",children:c}),e.jsxs("p",{className:"mt-1 text-xs text-slate-500 dark:text-slate-400",children:["For ",m," ⢠",x," level ⢠",S," top picks"]})]}),e.jsx(y,{variant:"ghost",size:"sm",className:"h-auto rounded-full p-2",onClick:n,"aria-label":"Close resources",children:e.jsx(z,{className:"h-4 w-4"})})]}),E?e.jsx(I,{}):k?e.jsxs(p,{className:"space-y-3 border border-rose-200 bg-rose-50/70 dark:border-rose-900/40 dark:bg-rose-950/20",children:[e.jsx("p",{className:"text-sm text-rose-700 dark:text-rose-300",children:k}),e.jsx(y,{variant:"primary",size:"sm",onClick:()=>{N()},children:"Try Again"})]}):s?e.jsxs("div",{className:"space-y-4",children:[e.jsxs(p,{className:"space-y-2 border border-blue-100 bg-gradient-to-r from-blue-50 to-indigo-50 dark:border-blue-900/30 dark:from-blue-950/20 dark:to-indigo-950/20",children:[e.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.18em] text-blue-600 dark:text-blue-300",children:"Quick Win"}),e.jsx("p",{className:"text-sm text-slate-700 dark:text-slate-300",children:s.quickWin})]}),e.jsx("div",{className:"max-h-[360px] space-y-3 overflow-y-auto pr-1",children:s.resources.map(t=>e.jsxs("div",{className:"rounded-2xl border border-slate-200 p-4 dark:border-slate-700",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("h4",{className:"font-semibold text-slate-900 dark:text-slate-100",children:t.name}),t.recommended&&e.jsx("span",{className:"rounded-full bg-blue-100 px-2 py-0.5 text-[10px] font-bold uppercase text-blue-700 dark:bg-blue-900/30 dark:text-blue-300",children:"Recommended"})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs",children:[e.jsx("span",{className:`rounded-full px-2 py-1 font-semibold ${B[t.type]||"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300"}`,children:t.platform}),e.jsx("span",{className:"rounded-full bg-slate-100 px-2 py-1 font-semibold text-slate-600 dark:bg-slate-800 dark:text-slate-300",children:t.price}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-slate-500 dark:text-slate-400",children:[e.jsx(M,{className:"h-3.5 w-3.5"}),t.duration]})]})]}),e.jsxs("a",{href:t.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-sm font-semibold text-blue-600 hover:text-blue-700 dark:text-blue-300 dark:hover:text-blue-200",children:[e.jsx(A,{className:"h-4 w-4"}),"Open"]})]}),e.jsx("p",{className:"mt-3 text-sm text-slate-600 dark:text-slate-300",children:t.description})]},`${t.name}-${t.platform}`))}),s.certifications.length>0&&e.jsxs(p,{className:"space-y-3",children:[e.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.18em] text-slate-400",children:"Relevant Certifications"}),s.certifications.map(t=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-2xl bg-slate-50 px-3 py-3 dark:bg-slate-800/70",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-slate-900 dark:text-slate-100",children:t.name}),e.jsxs("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:[t.provider," ⢠",t.value," value"]})]}),e.jsx("a",{href:t.url,target:"_blank",rel:"noreferrer",className:"text-sm font-semibold text-blue-600 hover:text-blue-700 dark:text-blue-300 dark:hover:text-blue-200",children:"View"})]},`${t.name}-${t.provider}`))]})]}):e.jsx("div",{className:"flex items-center justify-center py-6 text-sm text-slate-500 dark:text-slate-400",children:"No resources yet."})]}),document.body)};export{J as LearningResourcesPopover,J 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.