import{c as k,j as r,v as C}from"./index-oE_2MbI2.js";import{T as S,a as R,b as T,c as H,d as L,e as z}from"./table-BFE5Uyhx.js";import{n as D}from"./ArrowDown-Day-BlQM.js";import{i as E}from"./ArrowUp-Bc1LEzvX.js";function I(y){const e=k.c(29),{columns:s,data:f,sortKey:u,sortDirection:x,onSort:i,onRowClick:n,rowClassName:c}=y;let p;e[0]!==x?(p=function(t,h){return r.jsx("div",{className:"w-4 flex items-center justify-center",children:h&&x&&(x==="asc"?r.jsx(E,{size:16,className:"text-muted-foreground transition-colors"}):r.jsx(D,{size:16,className:"text-muted-foreground transition-colors"}))})},e[0]=x,e[1]=p):p=e[1];const b=p;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=function(t,h){let N="px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider";return t===h-1&&(N="px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider w-8"),N},e[2]=d):d=e[2];const a=d;let o;if(e[3]!==s||e[4]!==i||e[5]!==b||e[6]!==u){let l;e[8]!==s.length||e[9]!==i||e[10]!==b||e[11]!==u?(l=(t,h)=>{const N=u===t.id;return r.jsx(S,{className:C(a(h,s.length),"group transition-colors select-none",t.sortable&&"hover:bg-accent cursor-pointer",t.rowClassName,t.cellClassName),onClick:t.sortable&&i?()=>i(t.id):void 0,children:r.jsxs("span",{className:"flex items-center gap-1",children:[t.header,t.sortable&&b(t.id,N)]})},t.id)},e[8]=s.length,e[9]=i,e[10]=b,e[11]=u,e[12]=l):l=e[12],o=s.map(l),e[3]=s,e[4]=i,e[5]=b,e[6]=u,e[7]=o}else o=e[7];let g;e[13]!==o?(g=r.jsx(R,{className:"border-b-0",children:r.jsx(T,{className:"h-9 hover:bg-transparent border-b border-border",children:o})}),e[13]=o,e[14]=g):g=e[14];let j;if(e[15]!==s||e[16]!==f||e[17]!==n||e[18]!==c){let l;e[20]!==s||e[21]!==n||e[22]!==c?(l=(t,h)=>{const N=c?.(t);return r.jsx(T,{"data-row-index":h,className:C("group/data-row transition-colors border-b-0 hover:bg-accent/50",n?"cursor-pointer":"",N),onClick:n?()=>n(t):void 0,children:s.map(m=>r.jsx(H,{className:C("px-5 py-4 h-16 align-middle text-sm text-foreground",m.cellClassName,m.wrap?"whitespace-normal wrap-break-word":""),children:r.jsx("div",{className:C(m.wrap?"w-full":"min-w-0 w-full",!m.wrap&&"truncate overflow-hidden whitespace-nowrap"),children:m.render?m.render(t):m.accessor?m.accessor(t):null})},m.id))},h)},e[20]=s,e[21]=n,e[22]=c,e[23]=l):l=e[23],j=f.map(l),e[15]=s,e[16]=f,e[17]=n,e[18]=c,e[19]=j}else j=e[19];let w;e[24]!==j?(w=r.jsx(L,{children:j}),e[24]=j,e[25]=w):w=e[25];let v;return e[26]!==g||e[27]!==w?(v=r.jsxs(z,{className:"w-full border-collapse",children:[g,w]}),e[26]=g,e[27]=w,e[28]=v):v=e[28],v}function W(y){const e=k.c(12),{columns:s,data:f,isLoading:u,sortKey:x,sortDirection:i,onSort:n,onRowClick:c,emptyState:p}=y;if(u===void 0?!1:u){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx("div",{className:"text-muted-foreground",children:"Loading..."})}),e[0]=a):a=e[0],a}if(f.length===0){let a;e[1]!==p?(a=p||r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"No items found"}),e[1]=p,e[2]=a):a=e[2];let o;return e[3]!==a?(o=r.jsx("div",{className:"flex items-center justify-center h-full",children:a}),e[3]=a,e[4]=o):o=e[4],o}let d;return e[5]!==s||e[6]!==f||e[7]!==c||e[8]!==n||e[9]!==i||e[10]!==x?(d=r.jsx("div",{className:"flex-1 overflow-auto",children:r.jsx(I,{columns:s,data:f,sortKey:x,sortDirection:i,onSort:n,onRowClick:c})}),e[5]=s,e[6]=f,e[7]=c,e[8]=n,e[9]=i,e[10]=x,e[11]=d):d=e[11],d}export{W as C};
