import{r as o,j as e}from"./main-C5rJoLCl.js";import{u as w,f as c,a as C,g as M,b as f,c as T,d as F,e as V,h as y}from"./data-table-column-header-Bzq2hgMJ.js";import{T as D,a as N,b as a,c as P,d as v,e as i}from"./table-C_lg7wFA.js";import{S as H}from"./spinner-zDOxBldC.js";function I({columns:n,data:g,isLoading:m=!1,toolbar:d}){var r;const[u,x]=o.useState({}),[h,R]=o.useState({}),[S,j]=o.useState([]),[b,p]=o.useState([]),l=w({data:g,columns:n,state:{sorting:b,columnVisibility:h,rowSelection:u,columnFilters:S},enableRowSelection:!0,onRowSelectionChange:x,onSortingChange:p,onColumnFiltersChange:j,onColumnVisibilityChange:R,getCoreRowModel:y(),getFilteredRowModel:V(),getPaginationRowModel:F(),getSortedRowModel:T(),getFacetedRowModel:f(),getFacetedUniqueValues:M()});return e.jsxs("div",{className:"space-y-4",children:[d&&e.jsx("div",{children:d(l)}),e.jsx("div",{className:"rounded-md border",children:e.jsxs(D,{children:[e.jsx(N,{children:l.getHeaderGroups().map(s=>e.jsx(a,{children:s.headers.map(t=>e.jsx(P,{colSpan:t.colSpan,children:t.isPlaceholder?null:c(t.column.columnDef.header,t.getContext())},t.id))},s.id))}),e.jsx(v,{children:m?e.jsx(a,{children:e.jsx(i,{colSpan:n.length,className:"h-24 text-center",children:e.jsx(H,{children:"Loading..."})})}):(r=l.getRowModel().rows)!=null&&r.length?l.getRowModel().rows.map(s=>e.jsx(a,{"data-state":s.getIsSelected()&&"selected",children:s.getVisibleCells().map(t=>e.jsx(i,{children:c(t.column.columnDef.cell,t.getContext())},t.id))},s.id)):e.jsx(a,{children:e.jsx(i,{colSpan:n.length,className:"h-24 text-center",children:"No results."})})})]})}),e.jsx(C,{table:l})]})}export{I as D};
//# sourceMappingURL=data-table-C_-HmCg7.js.map
