import{u as f,b as j,j as e}from"./index-D9pJRAs5.js";import{$ as u}from"./ui-CtYVlq7P.js";function g({data:c,columns:x,onRowClick:r,emptyMessage:m,isLoading:h=!1}){const{t:o}=f(),{theme:b}=j(),a=b.mode==="dark",p=m||o("common.noData");return h?e.jsx("div",{className:"w-full space-y-4",children:[1,2,3].map(t=>e.jsx("div",{className:`h-16 rounded-xl animate-pulse ${a?"bg-slate-800":"bg-slate-100"}`},t))}):!c||c.length===0?e.jsx("div",{className:`flex flex-col items-center justify-center py-16 rounded-2xl border-2 border-dashed ${a?"border-slate-800 bg-slate-900/50":"border-slate-200 bg-slate-50"}`,children:e.jsx("p",{className:`text-sm font-medium ${a?"text-slate-400":"text-slate-50"}`,children:p})}):e.jsxs("div",{className:"w-full",children:[e.jsx("div",{className:`hidden md:block rounded-2xl border overflow-hidden shadow-sm ${a?"border-slate-800 bg-slate-900/60":"border-slate-200 bg-white"}`,children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:`${a?"bg-slate-800/80":"bg-slate-50"} border-b ${a?"border-slate-700":"border-slate-100"}`,children:[x.map((t,n)=>e.jsx("th",{className:`px-6 py-4 text-left text-xs font-bold uppercase tracking-wider ${a?"text-slate-400":"text-slate-500"} ${t.className||""}`,children:t.header},n)),r&&e.jsx("th",{className:"px-6 py-4 w-10"})]})}),e.jsx("tbody",{className:`divide-y ${a?"divide-slate-800":"divide-slate-100"}`,children:c.map((t,n)=>e.jsxs("tr",{onClick:()=>r==null?void 0:r(t),className:`group transition-all duration-200 ${r?"cursor-pointer":""} ${a?"hover:bg-slate-800/60":"hover:bg-slate-50/80 hover:shadow-inner"}`,children:[x.map((s,i)=>{let d;if(s.cell)d=s.cell(t);else if(s.render){const l=s.accessorKey||s.accessor;d=s.render(t[l],t)}else{const l=s.accessorKey||s.accessor;d=t[l]}return e.jsx("td",{className:`px-6 py-4 text-sm font-medium ${a?"text-slate-300":"text-slate-700"} ${s.className||""}`,children:d},i)}),r&&e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsx(u,{className:"h-4 w-4 opacity-0 group-hover:opacity-100 transition-opacity text-slate-400"})})]},n))})]})})}),e.jsx("div",{className:"md:hidden space-y-4",children:c.map((t,n)=>e.jsx("div",{onClick:()=>r==null?void 0:r(t),className:`rounded-2xl p-5 border shadow-sm ${a?"bg-slate-900 border-slate-800":"bg-white border-slate-200"} ${r?"active:scale-[0.98] transition-transform":""}`,children:e.jsx("div",{className:"flex flex-col gap-3",children:x.map((s,i)=>{let d;if(s.cell)d=s.cell(t);else if(s.render){const l=s.accessorKey||s.accessor;d=s.render(t[l],t)}else{const l=s.accessorKey||s.accessor;d=t[l]}return i===0?e.jsx("div",{className:"mb-2",children:e.jsx("h3",{className:`text-lg font-bold ${a?"text-white":"text-slate-900"}`,children:d})},i):e.jsxs("div",{className:"flex justify-between items-center py-1 border-b border-dashed border-gray-100 dark:border-gray-800 last:border-0",children:[e.jsx("span",{className:`text-xs font-semibold uppercase tracking-wide ${a?"text-slate-500":"text-slate-400"}`,children:s.mobileLabel||s.header}),e.jsx("div",{className:`text-sm font-medium text-right ${a?"text-slate-300":"text-slate-700"}`,children:d})]},i)})})},n))})]})}export{g as M};
