import{j as s,w as N,u as b,L as j,k as v,be as y,aB as w,an as C}from"./vendor-BKmmeuxg.js";import{B as _}from"./badge-AQfLLMpR.js";import{B as g}from"./button-BpNwv2aE.js";import{C as k,b as z,e as B}from"./card-D9_SJYq6.js";import{c as l,s as F}from"./utils-DxSsnXxD.js";const R=({rating:e,reviewCount:n,showCount:a=!0,size:i="md",className:c})=>{const x={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},r={sm:"text-xs",md:"text-sm",lg:"text-base"},o=typeof e=="number"&&Number.isFinite(e),m=o?Math.min(Math.max(e,0),5):0;return s.jsxs("div",{className:l("flex items-center gap-1",c),children:[s.jsx("div",{className:"flex items-center",children:[1,2,3,4,5].map(d=>s.jsx(N,{className:l(x[i],d<=m?"fill-yellow-400 text-yellow-400":"fill-gray-200 text-gray-200")},d))}),s.jsx("span",{className:l("font-medium text-gray-700",r[i]),children:o?m.toFixed(1):"—"}),a&&n!==void 0&&s.jsxs("span",{className:l("text-gray-500",r[i]),children:["(",n,")"]})]})},U=({exam:e,variant:n="default",viewType:a="grid",onAddToCart:i,onAddToWishlist:c,className:x})=>{var f,u;const{props:r}=b(),{translate:o}=r,{common:m}=o,d=n==="compact",p=route("exams.details",{slug:e.slug,id:e.id}),t=F(r.system.fields.selling_currency);return s.jsxs(k,{className:l("group",x,a==="list"&&"flex flex-row"),children:[s.jsx(j,{href:p,className:l(a==="list"&&"w-1/3"),children:s.jsxs("div",{className:l("relative overflow-hidden",a==="grid"?"aspect-video":"h-full min-h-[200px]"),children:[e.thumbnail?s.jsx("img",{src:e.thumbnail,alt:e.title,className:"h-full w-full object-cover transition-transform group-hover:scale-105"}):s.jsx("div",{className:"from-primary/20 to-primary/5 flex h-full items-center justify-center bg-gradient-to-br",children:s.jsx("span",{className:"text-primary/30 text-4xl font-bold",children:e.title.charAt(0)})}),e.level&&s.jsx(_,{className:"absolute top-2 left-2 capitalize",children:e.level})]})}),s.jsxs("div",{className:l("flex flex-col",a==="list"&&"flex-1"),children:[s.jsxs(z,{className:"p-4",children:[s.jsx(j,{href:p,children:s.jsx("h3",{className:"group-hover:text-primary mb-2 line-clamp-2 text-lg font-semibold transition-colors",children:e.title})}),!d&&e.short_description&&s.jsx("p",{className:"text-muted-foreground mb-3 line-clamp-2 text-sm",children:e.short_description}),s.jsxs("div",{className:"text-muted-foreground mb-3 flex items-center gap-1 text-sm",children:[s.jsx("span",{children:"by"}),s.jsx("span",{className:"font-medium",children:((u=(f=e.instructor)==null?void 0:f.user)==null?void 0:u.name)||"Instructor"})]}),s.jsxs("div",{className:"text-muted-foreground mb-3 flex flex-wrap items-center gap-3 text-sm",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(v,{className:"h-4 w-4"}),s.jsxs("span",{children:[e.duration_hours,"h ",e.duration_minutes,"m"]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(y,{className:"h-4 w-4"}),s.jsxs("span",{children:[e.enrollments_count||0," students"]})]})]}),e.average_rating!==void 0&&s.jsx(R,{rating:e.average_rating,reviewCount:e.reviews_count,size:"sm",className:"mb-3"})]}),s.jsxs(B,{className:l("flex items-center justify-between border-t p-4",a==="list"&&"mt-auto"),children:[s.jsx("div",{className:"flex items-baseline gap-2",children:e.pricing_type==="free"?m.free:e.discount?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"font-semibold",children:[t==null?void 0:t.symbol,e.discount_price]}),s.jsxs("span",{className:"text-muted-foreground ml-2 text-sm font-medium line-through",children:[t==null?void 0:t.symbol,e.price]})]}):s.jsx(s.Fragment,{children:s.jsxs("span",{className:"font-semibold",children:[t==null?void 0:t.symbol,e.price]})})}),s.jsxs("div",{className:"flex items-center gap-2",children:[c&&s.jsx(g,{variant:"outline",size:"icon",onClick:h=>{h.preventDefault(),c(e)},children:s.jsx(w,{className:"h-4 w-4"})}),i&&e.pricing_type==="paid"&&s.jsx(g,{variant:"default",size:"icon",onClick:h=>{h.preventDefault(),i(e)},children:s.jsx(C,{className:"h-4 w-4"})})]})]})]})]})};export{U as E};