import{r as o,j as e}from"./main-pzSpmpV2.js";import{u as b,g as c,h as C,i as M,j as T,k as f,l as F,m as V,n as y}from"./data-table-column-header-DXeZFhtt.js";import{T as D,a as N,b as a,c as P,d as v,e as i}from"./table-Di4jwPel.js";import{S as H}from"./spinner-BwGdrg0I.js";function B({columns:n,data:g,isLoading:m=!1,toolbar:d}){var r;const[u,x]=o.useState({}),[h,j]=o.useState({}),[R,S]=o.useState([]),[p,w]=o.useState([]),l=b({data:g,columns:n,state:{sorting:p,columnVisibility:h,rowSelection:u,columnFilters:R},enableRowSelection:!0,onRowSelectionChange:x,onSortingChange:w,onColumnFiltersChange:S,onColumnVisibilityChange:j,getCoreRowModel:y(),getFilteredRowModel:V(),getPaginationRowModel:F(),getSortedRowModel:f(),getFacetedRowModel:T(),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{B as D};
//# sourceMappingURL=data-table-CFJjNL4R.js.map
