1import{r as _,cR as he,bU as be,cS as pe,x as fe,j as e,q as ae,k as le,ab as ge,aq as oe,aM as ve,b as c,y as ee,aE as ye,m as je,b1 as ke,bQ as Ne,cL as te,av as re,ap as se}from"./react-vendor-bcN6ZJx6.js";import{y as K,u as we,B as X,I as _e}from"./index-C8TfN4cr.js";import{S as V}from"./skeleton-tjq2tA9r.js";import"./ui-vendor-BA32w1ww.js";import"./supabase-vendor-DNBNrwrO.js";function Ce(a){const[l,d]=_.useState([]),[n,p]=_.useState([]),[v,k]=_.useState([]),[B,i]=_.useState(!0),[L,x]=_.useState(null),f=_.useRef(0),g=_.useCallback(async()=>{const z=++f.current;i(!0),x(null);const y=K.from("path_topic_groups").select("*").eq("is_active",!0).order("sort_order"),G=K.from("path_lessons").select("*, path_lesson_tabs(id, tab_title, content_type, sort_order)").eq("is_active",!0).order("sort_order"),h=a?K.from("path_user_progress").select("*").eq("user_id",a):Promise.resolve({data:[],error:null}),[A,u,j]=await Promise.all([y,G,h]);if(z!==f.current)return;const m=A.error||u.error||j.error;if(m){d([]),p([]),k([]),x(m.message),i(!1);return}const N=(u.data||[]).map(b=>({...b,path_lesson_tabs:[...b.path_lesson_tabs||[]].sort((S,P)=>S.sort_order-P.sort_order)})),R=new Map;(j.data||[]).filter(b=>!!b.lesson_id).sort((b,S)=>String(b.updated_at??"").localeCompare(String(S.updated_at??""))).forEach(b=>R.set(b.lesson_id,b)),d(A.data||[]),p(N),k([...R.values()]),i(!1)},[a]);return _.useEffect(()=>{g()},[g]),{groups:l,lessons:n,progress:v,loading:B,error:L,refresh:g}}const Q=[{id:"easy-tv",label:"Easy TV",levelLabel:"Levels 1â3",match:["Easy TV"],icon:he,classes:{card:"border-amber-200/90 bg-gradient-to-br from-amber-50 via-white to-orange-50/70 before:bg-amber-300/30 after:bg-gradient-to-r after:from-amber-300 after:to-orange-400 hover:border-amber-400 dark:border-amber-800/70 dark:from-amber-950/40 dark:via-card dark:to-orange-950/20 dark:before:bg-amber-500/15 dark:hover:border-amber-600",active:"border-amber-500 shadow-[0_16px_36px_-20px_rgba(245,158,11,0.8)] ring-2 ring-amber-200 dark:ring-amber-800",icon:"bg-gradient-to-br from-amber-100 to-orange-100 text-amber-600 ring-amber-200/80 shadow-amber-200/70 dark:from-amber-900/70 dark:to-orange-900/50 dark:text-amber-300 dark:ring-amber-700/60 dark:shadow-none"}},{id:"tv-movies",label:"TV & Movies",levelLabel:"Levels 3â6",match:["Movies","TV Programs","TV & Movies"],icon:be,classes:{card:"border-teal-200/90 bg-gradient-to-br from-teal-50 via-white to-cyan-50/70 before:bg-teal-300/30 after:bg-gradient-to-r after:from-teal-300 after:to-cyan-400 hover:border-teal-400 dark:border-teal-800/70 dark:from-teal-950/40 dark:via-card dark:to-cyan-950/20 dark:before:bg-teal-500/15 dark:hover:border-teal-600",active:"border-teal-500 shadow-[0_16px_36px_-20px_rgba(20,184,166,0.8)] ring-2 ring-teal-200 dark:ring-teal-800",icon:"bg-gradient-to-br from-teal-100 to-cyan-100 text-teal-600 ring-teal-200/80 shadow-teal-200/70 dark:from-teal-900/70 dark:to-cyan-900/50 dark:text-teal-300 dark:ring-teal-700/60 dark:shadow-none"}},{id:"skills",label:"Skills",levelLabel:"Levels 2â4",match:["Language Skills"],icon:pe,classes:{card:"border-sky-200/90 bg-gradient-to-br from-sky-50 via-white to-blue-50/70 before:bg-sky-300/30 after:bg-gradient-to-r after:from-sky-300 after:to-blue-400 hover:border-sky-400 dark:border-sky-800/70 dark:from-sky-950/40 dark:via-card dark:to-blue-950/20 dark:before:bg-sky-500/15 dark:hover:border-sky-600",active:"border-sky-500 shadow-[0_16px_36px_-20px_rgba(14,165,233,0.8)] ring-2 ring-sky-200 dark:ring-sky-800",icon:"bg-gradient-to-br from-sky-100 to-blue-100 text-sky-600 ring-sky-200/80 shadow-sky-200/70 dark:from-sky-900/70 dark:to-blue-900/50 dark:text-sky-300 dark:ring-sky-700/60 dark:shadow-none"}},{id:"academic",label:"Academic",levelLabel:"Levels 3â6",match:["Academic","Timed Reading"],icon:fe,classes:{card:"border-violet-200/90 bg-gradient-to-br from-violet-50 via-white to-fuchsia-50/60 before:bg-violet-300/30 after:bg-gradient-to-r after:from-violet-300 after:to-fuchsia-400 hover:border-violet-400 dark:border-violet-800/70 dark:from-violet-950/40 dark:via-card dark:to-fuchsia-950/20 dark:before:bg-violet-500/15 dark:hover:border-violet-600",active:"border-violet-500 shadow-[0_16px_36px_-20px_rgba(139,92,246,0.8)] ring-2 ring-violet-200 dark:ring-violet-800",icon:"bg-gradient-to-br from-violet-100 to-fuchsia-100 text-violet-600 ring-violet-200/80 shadow-violet-200/70 dark:from-violet-900/70 dark:to-fuchsia-900/50 dark:text-violet-300 dark:ring-violet-700/60 dark:shadow-none"}}],H=["A1","A2","B1","B1+","B2","C1","Unknown"];function C(a){if(a)return Q.find(l=>l.match.includes(a))}function Le(a){if(!a)return null;const l=H.indexOf(a.trim());return l>=0&&l<6?l+1:null}const ze={british:"GB",american:"US",canadian:"CA",australian:"AU"};function Se(a){return a?ze[a.trim().toLowerCase()]||a.trim():""}function Te({lesson:a,progress:l,onClick:d}){var f,g,z,y;const n=(l==null?void 0:l.status)==="completed",p=(l==null?void 0:l.score)==null?null:Math.round(l.score<=1?l.score*100:l.score),v=((f=a.cefr)==null?void 0:f.trim())||"",k=Le(v),B=k?`Level ${k}${v?` (${v})`:""}`:v||a.difficulty||"Má»i trình Äá»",i=Se(a.accent),L=((g=a.topics)==null?void 0:g[0])||((z=a.communication_functions)==null?void 0:z[0])||((y=a.situations)==null?void 0:y[0])||"----",x=a.source_collection||a.source_category||"Listening English";return e.jsxs("button",{type:"button",onClick:d,className:"group flex w-full items-stretch gap-3 rounded-2xl border bg-card p-3 text-left shadow-sm transition-all hover:-translate-y-0.5 hover:border-primary/40 hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:[e.jsxs("div",{className:"relative w-24 shrink-0 overflow-hidden rounded-xl bg-muted sm:w-28",children:[a.thumbnail_url?e.jsx("img",{src:a.thumbnail_url,alt:"",loading:"lazy",className:"absolute inset-0 h-full w-full object-cover transition-transform duration-300 group-hover:scale-[1.04]"}):e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gradient-to-br from-primary/15 to-primary/5",children:e.jsx(ae,{size:28,weight:"duotone",className:"text-primary/70"})}),e.jsx("div",{className:"absolute inset-x-0 top-0 truncate bg-foreground
1/75 px-1.5 py-0.5 text-[8px] font-black uppercase tracking-wide text-white",children:x}),n?e.jsxs("span",{className:"absolute bottom-1.5 left-1.5 flex items-center gap-0.5 rounded-md bg-emerald-500 px-1.5 py-0.5 text-[9px] font-bold text-white shadow-sm",children:[e.jsx(le,{size:10,weight:"fill"})," Äã há»c"]}):null]}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col py-0.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h3",{className:"line-clamp-1 text-sm font-black leading-snug text-foreground",children:a.title}),p!==null?e.jsxs("span",{className:"shrink-0 text-[11px] font-bold text-emerald-600",children:[p,"%"]}):null]}),e.jsxs("p",{className:"mt-1 line-clamp-1 text-[11px] font-semibold text-muted-foreground",children:["Chá»§ Äá»: ",L]}),e.jsxs("p",{className:"mt-1 flex items-center gap-2 text-[11px] font-semibold text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ge,{size:12})," ",a.estimated_minutes," phút"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(oe,{size:12,weight:"fill",className:"text-amber-500"})," ",a.xp_reward," XP"]})]}),e.jsxs("div",{className:"mt-auto flex items-end justify-between gap-2 pt-2",children:[e.jsx("span",{className:"text-[11px] font-bold text-primary",children:B}),e.jsxs("span",{className:"flex items-center gap-2",children:[i?e.jsx("span",{className:"text-[11px] font-black text-muted-foreground",children:i}):null,e.jsx("span",{className:"flex size-7 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-sm transition-transform group-hover:translate-x-0.5",children:e.jsx(ve,{size:14,weight:"bold"})})]})]})]})]})}function Ee({group:a,thumbnailUrl:l,lessonCount:d,active:n,onClick:p}){const v=a.color||"#46a758";return e.jsxs("button",{type:"button",onClick:p,"aria-pressed":n,className:`w-36 shrink-0 overflow-hidden rounded-lg border bg-card text-left shadow-sm transition-all hover:-translate-y-0.5 hover:shadow-md focus-visible:outline-none sm:w-40 ${n?"border-primary ring-2 ring-primary/30":"hover:border-primary/40"}`,children:[e.jsxs("div",{className:"relative aspect-[4/3] w-full overflow-hidden bg-muted",children:[l?e.jsx("img",{src:l,alt:"",loading:"lazy",className:"h-full w-full object-cover"}):e.jsx("div",{className:"flex h-full items-center justify-center bg-gradient-to-br from-primary/15 to-primary/5",children:e.jsx(ae,{size:30,weight:"duotone",className:"text-primary/70"})}),e.jsx("div",{className:"absolute inset-x-0 top-0 truncate px-2 py-1 text-[10px] font-black uppercase tracking-wide text-white",style:{backgroundColor:v},children:a.name}),e.jsxs("span",{className:"absolute bottom-2 left-2 rounded-md bg-white/95 px-1.5 py-0.5 text-[10px] font-bold text-foreground shadow-sm",children:[d," bà i"]})]}),e.jsx("div",{className:"line-clamp-1 px-2.5 py-2 text-xs font-bold text-foreground",children:a.name})]})}const O=24;function Me(a){const l=(a.path_lesson_tabs||[]).map(d=>d.content_type.toLowerCase());return l.some(d=>d.includes("listen")||d.includes("audio")||d.includes("media"))?"listening":l.some(d=>d.includes("vocab"))?"vocabulary":l.some(d=>d.includes("quiz"))?"quiz":"practice"}function F(a){var l;return((l=a.cefr)==null?void 0:l.trim())||"Unknown"}function Pe({onNavigate:a}){const{user:l}=we(),{groups:d,lessons:n,progress:p,loading:v,error:k,refresh:B}=Ce(l==null?void 0:l.id),[i,L]=c.useState(null),[x,f]=c.useState(null),[g,z]=c.useState(!1),[y,G]=c.useState(!1),[h,A]=c.useState("level"),[u,j]=c.useState(null),[m,N]=c.useState(null),[R,b]=c.useState(""),[S,P]=c.useState(O),I=c.useDeferredValue(R.trim().toLowerCase()),D=c.useMemo(()=>new Map(d.map(t=>[t.id,t])),[d]),Y=c.useMemo(()=>new Map(p.map(t=>[t.lesson_id,t])),[p]),T=c.useMemo(()=>{const t=new Map;return[...n].sort((s,o)=>s.sort_order-o.sort_order).forEach(s=>{const o=t.get(s.group_id);o?(o.lessonCount+=1,!o.thumbnailUrl&&s.thumbnail_url&&(o.thumbnailUrl=s.thumbnail_url),!o.category&&s.source_category&&(o.category=s.source_category)):t.set(s.group_id,{category:s.source_category||null,thumbnailUrl:s.thumbnail_url||null,lessonCount:1})}),t},[n]),ne=c.useMemo(()=>{const t=new Map;
1return n.forEach(r=>{const s=C(r.source_category);s&&t.set(s.id,(t.get(s.id)||0)+1)}),t},[n]),E=c.useMemo(()=>{if(!u&&!m)return null;const t=new Map;return n.forEach(r=>{var w;const s=!u||F(r)===u,o=!m||((w=r.topics)==null?void 0:w.some($=>$.trim()===m));s&&o&&t.set(r.group_id,(t.get(r.group_id)||0)+1)}),t},[u,m,n]),Z=c.useMemo(()=>d.filter(t=>{var r,s;return!T.has(t.id)||E&&!E.has(t.id)?!1:i?((s=C((r=T.get(t.id))==null?void 0:r.category))==null?void 0:s.id)===i:!0}),[i,E,T,d]),ie=c.useMemo(()=>{const t=new Map;return n.forEach(r=>{var o;if(i&&((o=C(r.source_category))==null?void 0:o.id)!==i||x&&r.group_id!==x)return;const s=F(r);t.set(s,(t.get(s)||0)+1)}),[...t.entries()].map(([r,s])=>({value:r,count:s})).sort((r,s)=>H.indexOf(r.value)-H.indexOf(s.value))},[x,i,n]),J=c.useMemo(()=>{const t=new Map;return n.forEach(r=>{var s;i&&((s=C(r.source_category))==null?void 0:s.id)!==i||x&&r.group_id!==x||new Set((r.topics||[]).map(o=>o.trim()).filter(Boolean)).forEach(o=>{t.set(o,(t.get(o)||0)+1)})}),[...t.entries()].map(([r,s])=>({value:r,count:s})).sort((r,s)=>s.count-r.count||r.value.localeCompare(s.value))},[x,i,n]),q=c.useMemo(()=>n.filter(t=>{var r;return!i||((r=C(t.source_category))==null?void 0:r.id)===i}).filter(t=>!x||t.group_id===x).filter(t=>!u||F(t)===u).filter(t=>{var r;return!m||((r=t.topics)==null?void 0:r.some(s=>s.trim()===m))}).filter(t=>I?[t.title,t.description,t.source_category,t.source_collection,t.cefr,...t.topics||[],...t.situations||[]].join(" ").toLowerCase().includes(I):!0).sort((t,r)=>String(t.source_collection||"").localeCompare(String(r.source_collection||""))||t.sort_order-r.sort_order||t.title.localeCompare(r.title)),[u,x,m,i,I,n]);c.useEffect(()=>{P(O)},[u,x,m,i,I]);const ce=n.filter(t=>{var r;return((r=Y.get(t.id))==null?void 0:r.status)==="completed"}).length,de=p.reduce((t,r)=>t+Number(r.xp_earned||0),0),ue=c.useCallback(t=>{const r=i===t?null:t;L(r),f(s=>{var w,$;return!s||!r||(($=C((w=T.get(s))==null?void 0:w.category))==null?void 0:$.id)===r?s:null}),r&&u&&!n.some(s=>{var o;return((o=C(s.source_category))==null?void 0:o.id)===r&&F(s)===u})&&j(null),r&&m&&!n.some(s=>{var o,w;return((o=C(s.source_category))==null?void 0:o.id)===r&&((w=s.topics)==null?void 0:w.some($=>$.trim()===m))})&&N(null),z(!1)},[u,m,i,T,n]),me=c.useCallback(t=>{f(r=>r===t.id?null:t.id)},[]),W=c.useCallback(t=>{A(t),t==="level"?N(null):j(null)},[]),xe=c.useCallback(t=>{const r=D.get(t.group_id);a("learning-lesson",{lessonId:t.id,lessonName:t.title,lessonType:Me(t),unitName:t.source_collection||(r==null?void 0:r.name)||t.source_category||"Listening English",passThreshold:Number(t.pass_threshold??.7)})},[D,a]),M=Q.find(t=>t.id===i)||null,U=x?D.get(x):null;return v?e.jsxs("div",{className:"space-y-6 pb-20",children:[e.jsx(V,{className:"h-44 rounded-3xl"}),e.jsx(V,{className:"h-40 rounded-2xl"}),e.jsx(V,{className:"h-32 rounded-2xl"}),e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:[0,1,2,3,4,5].map(t=>e.jsx(V,{className:"h-28 rounded-2xl"},t))})]}):k?e.jsxs("div",{className:"rounded-3xl border border-destructive/20 bg-destructive/5 px-5 py-12 text-center",children:[e.jsx(ee,{size:46,className:"mx-auto text-destructive/60"}),e.jsx("h2",{className:"mt-4 text-lg font-black",children:"Chưa thá» tải lá» trình"}),e.jsx("p",{className:"mx-auto mt-2 max-w-md text-sm leading-6 text-muted-foreground",children:k}),e.jsx(X,{variant:"outline",className:"mt-5 rounded-xl",onClick:()=>void B(),children:"Thá» tải lại"})]}):n.length===0?e.jsxs("div",{className:"rounded-3xl border border-dashed bg-muted/20 px-5 py-14 text-center",children:[e.jsx(ye,{size:46,className:"mx-auto text-muted-foreground"}),e.jsx("h2",{className:"mt-4 text-lg font-black",children:"Kho bà i há»c Äang ÄÆ°á»£c cáºp nháºt"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Chưa có bà i há»c Äang hoạt Äá»ng trong schema vocab-dictation."})]}):e.jsxs("div",{className:"space-y-7 pb-20 sm:space-y-8",children:[e.jsxs("section",{className:"relative isolate overflow-hidden rounded-3xl border bg-gradient-to-br from-emerald-50 via-white to-sky-50 px-5 py-7 shadow-sm sm:px-8 sm:py-10",children:[e.jsx("div",{className:"absolute -right-20 -top-24 size-72 roun
1ded-full bg-primary/10 blur-3xl"}),e.jsx("div",{className:"absolute -bottom-28 left-1/3 size-64 rounded-full bg-sky-300/20 blur-3xl"}),e.jsxs("div",{className:"relative grid gap-7 lg:grid-cols-[1fr_auto] lg:items-end",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-black uppercase tracking-[0.18em] text-primary",children:[e.jsx(ee,{size:17,weight:"fill"})," Listening library"]}),e.jsx("h1",{className:"mt-3 max-w-3xl text-3xl font-black tracking-tight text-foreground sm:text-5xl",children:"Lá» trình nghe theo Äiá»u bạn muá»n chinh phục"}),e.jsx("p",{className:"mt-3 max-w-2xl text-sm leading-6 text-muted-foreground sm:text-base",children:"Chá»n dạng bà i há»c và trình Äá» phù hợp. Má»i bà i kết hợp video, transcript, từ vá»±ng và bà i táºp."})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 rounded-2xl border bg-white/70 p-3 shadow-sm backdrop-blur",children:[e.jsxs("div",{className:"px-2 text-center",children:[e.jsx("div",{className:"text-xl font-black text-foreground",children:n.length}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:"bà i há»c"})]}),e.jsxs("div",{className:"border-x px-2 text-center",children:[e.jsx("div",{className:"text-xl font-black text-foreground",children:ce}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Äã há»c"})]}),e.jsxs("div",{className:"px-2 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1 text-xl font-black text-foreground",children:[e.jsx(oe,{size:16,weight:"fill",className:"text-amber-500"}),de]}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:"XP"})]})]})]})]}),l?null:e.jsxs("div",{className:"flex flex-col gap-3 rounded-2xl border border-primary/15 bg-primary/5 p-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(je,{size:22,className:"mt-0.5 shrink-0 text-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold",children:"Bạn Äang há»c á» chế Äá» khách"}),e.jsx("p",{className:"mt-0.5 text-xs leading-5 text-muted-foreground",children:"ÄÄng nháºp Äá» lưu Äiá»m và XP trên má»i thiết bá»."})]})]}),e.jsx(X,{size:"sm",variant:"outline",className:"shrink-0 rounded-lg",onClick:()=>a("login"),children:"ÄÄng nháºp Äá» lưu"})]}),e.jsxs("section",{"aria-labelledby":"type-title",children:[e.jsxs("div",{className:"mb-4 flex items-end justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-black uppercase tracking-[0.16em] text-primary",children:"Khám phá ná»i dung"}),e.jsx("h2",{id:"type-title",className:"mt-1 text-2xl font-black",children:"Chá»n 1 trong 4 dạng bà i há»c"})]}),M?e.jsx("button",{type:"button",onClick:()=>{L(null),f(null),j(null),N(null)},className:"shrink-0 text-xs font-bold text-primary hover:underline",children:"Xem tất cả"}):null]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:Q.map((t,r)=>{const s=t.icon,o=i===t.id;return e.jsxs("button",{type:"button",onClick:()=>ue(t.id),"aria-pressed":o,className:`group relative isolate flex min-h-48 flex-col items-center overflow-hidden rounded-3xl border-2 px-4 py-5 text-center shadow-[0_8px_24px_-18px_rgba(15,23,42,0.45)] transition-[transform,box-shadow,border-color] duration-300 before:absolute before:-right-10 before:-top-10 before:-z-10 before:size-36 before:rounded-full before:blur-2xl after:absolute after:inset-x-10 after:top-0 after:h-1 after:rounded-b-full hover:-translate-y-1 hover:shadow-[0_18px_38px_-22px_rgba(15,23,42,0.5)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 motion-reduce:transform-none ${t.classes.card} ${o?t.classes.active:""}`,children:[e.jsx("span",{"aria-hidden":"true",className:"absolute right-4 top-3 text-[10px] font-black tracking-[0.18em] text-foreground/20",children:String(r+1).padStart(2,"0")}),e.jsxs("span",{className:`relative flex size-14 items-center justify-center rounded-2xl ring-1 shadow-[0_10px_24px_-12px_currentColor] transition-transform duration-300 group-hover:-rotate-3 group-hover:scale-105 motion-reduce:transform-none ${t.classes.icon}`,children:[e.jsx(s,{size:28,weight:"duotone"}),e.jsx("span",{className:"absolute -right-1 -top-1 size-3 rounded-full border-2 border-white bg-current opacity-70 dark:border-card"})]}),e.jsx("span",{className:"mt-4 text-lg font-black leading-tight text-foreground",children:t.label}),e.jsx("span",{className:"mt-1 text-[11px] font-bold uppercase tracking-[0.08em] text-muted-foreground",children:t.levelLabel}),e.jsxs("span",{className:`mt-auto rounded-full px-2.5 py-1 text-[10px] font-black ring-1 ${t.classes.icon}`,children:[ne.get(t.id)||0," bà i"]})]},t.id)})})]}),e.jsxs("section",{className:"space-y-4 rounded-2xl border bg-card p-4 shadow-sm sm:p-5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"inline-flex min-w-0 max-w-full gap-1 overflow-x-auto rounded-xl bg-muted p-1 scrollbar-hide","aria-label":"Chá»n kiá»u bá» lá»c",children:[e.jsxs("button",{type:"button",onClick:()=>W("level"),"aria-pressed":h==="level",className:`flex shrink-0 items-center gap-2 rounded-lg px-3 py-2 text-sm font-black transition-colors ${h==="level"?"bg-card text-primary shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(ke,{size:19,weight:"fill"}),"Lá»c theo trình Äá»"]}),e.jsxs("button",{type:"button",onClick:()=>W("topic"),"aria-pressed":h==="topic",className:`flex shrink-0 items-center gap-2 rounded-lg px-3 py-2 text-sm font-black transition-colors ${h==="topic"?"bg-card text-primary shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(Ne,{size:19,weight:"fill"}),"Lá»c theo chá»§ Äá»"]})]}),h==="topic"&&J.length>6?e.jsxs("button",{type:"button",onClick:()=>G(t=>!t),"aria-expanded":y,className:"flex shrink-0 items-center gap-1 rounded-full border px-3 py-1.5 text-xs font-bold text-foreground transition-colors hover:border-primary/40 hover:text-primary",children:[y?"Thu gá»n":"Xem tất cả",y?e.jsx(te,{size:14,weight:"bold"}):e.jsx(re,{size:14,weight:"bold"})]}):null]}),e.jsxs("div",{className:h==="topic"&&y?"flex flex-wrap gap-2 pb-1":"flex gap-2 overflow-x-auto pb-1 scrollbar-hide",children:[e.jsx("button",{type:"button",onClick:()=>h==="level"?j(null):N(null),"aria-pressed":h==="level"?u===null:m===null,className:`shrink-0 rounded-full border px-3 py-1.5 text-xs font-bold ${(h==="level"?u===null:m===null)?"border-primary bg-primary text-primary-foreground":"hover:border-primary/40"}`,children:"Tất cả"}),(h==="level"?ie:J).map(t=>e.jsxs("button",{type:"button",onClick:()=>h==="level"?j(t.value):N(t.value),"aria-pressed":(h==="level"?u:m)===t.value,className:`shrink-0 rounded-full border px-3 py-1.5 text-xs font-bold ${(h==="level"?u:m)===t.value?"border-primary bg-primary text-primary-foreground":"hover:border-primary/40"}`,children:[t.value," ",e.jsx("span",{className:"opacity-65",children:t.count})]},t.value))]},h),e.jsxs("div",{className:"relative",children:[e.jsx(se,{size:18,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.jsx(_e,{value:R,onChange:t=>b(t.target.value),placeholder:"Tìm bà i, chá»§ Äá» hoặc series...","aria-label":"Tìm bà i há»c",className:"h-11 rounded-xl pl-10"})]}),e.jsxs("div",{className:"border-t pt-4","aria-labelledby":"series-title",children:[e.jsxs("div",{className:"mb-3 flex items-end justify-between gap-4",children:[e.jsxs("h2",{id:"series-title",className:"text-sm font-black",children:["Chá»n series",M?` · ${M.label}`:"",":",e.jsxs("span",{className:"ml-2 text-xs font-semibold text-muted-foreground",children:[Z.length," series"]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[U?e.jsx("button",{type:"button",onClick:()=>f(null),className:"text-xs font-bold text-primary hover:underline",children:"Bá» chá»n"}):null,e.jsxs("button",{type:"button",onClick:()=>z(t=>!t),"aria-expanded":g,className:"flex items-center gap-1 rounded-full border px-3 py-1.5 text-xs font-bold text-foreground transition-colors hover:border-primary/40 hover:text-primary",children:[g?"Thu gá»n":"Xem tất cả",g?e.jsx(te,{size:14,weight:"bold"}):e.jsx(re,{size:14,weight:"bold"})]})]})]}),e.jsx("div",{className:g?"flex flex-wrap justify-center gap-3 pb-1":"flex gap-3 overflow-x-auto pb-1 scrollbar-hide",children:Z.map(t=>{const r=T.get(t.id);return e.jsx(Ee,{group:t,thumbnailUrl:r==null?void 0:r.thumbnailUrl,lessonCount:(E==null?void 0:E.get(t.id))??(r==null?void 0:r.lessonCount)??0,active:x===t.id,onClick:()=>me(t)},t.id)})})]})]}),e.jsxs("section",{"aria-labelledby":"lesson-results-title",children:[e.jsxs("div",{className:"mb-4 flex items-end justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-black uppercase tracking-[0.14em] text-primary",children:(U==null?void 0:U.name)||m||(M==null?void 0:M.label)||u||"Má»i dạng bà i"}),e.jsx("h2",{id:"lesson-results-title",className:"mt-1 text-xl font-black sm:text-2xl",children:"Bà i há»c phù hợp"})]}),e.jsxs("span",{className:"shrink-0 text-xs font-semibold text-muted-foreground",children:[q.length," bà i"]})]}),q.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3",children:q.slice(0,S).map(t=>e.jsx(Te,{lesson:t,progress:Y.get(t.id),onClick:()=>xe(t)},t.id))}),S<q.length?e.jsx("div",{className:"mt-6 text-center",children:e.jsxs(X,{variant:"outline",size:"lg",className:"rounded-xl",onClick:()=>P(t=>t+O),children:["Xem thêm ",Math.min(O,q.length-S)," bà i"]})}):null]}):e.jsxs("div",{className:"rounded-2xl border border-dashed bg-muted/20 px-5 py-12 text-center",children:[e.jsx(se,{size:38,className:"mx-auto text-muted-foreground"}),e.jsx("h3",{className:"mt-3 font-black",children:"Không tìm thấy bà i phù hợp"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Hãy thá» bá» bá»t bá» lá»c hoặc dùng từ khóa khác."}),e.jsx(X,{variant:"ghost",className:"mt-3 rounded-xl",onClick:()=>{b(""),j(null),N(null),L(null),f(null)},children:"Xóa bá» lá»c"})]})]}),e.jsxs("div",{className:"flex items-center justify-center gap-2 rounded-2xl bg-muted/30 px-4 py-3 text-center text-xs text-muted-foreground",children:[e.jsx(le,{size:16,weight:"fill",className:"text-primary"}),"Tiến Äá» ÄÆ°á»£c lưu riêng cho từng bà i; bạn có thá» bắt Äầu á» bất kỳ trình Äá» nà o."]})]})}export{Pe as LearningPath};
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.