import{ei as l,j as r,b_ as o,$ as n,h4 as S}from"./index-46ma1THH.js";const P=({data:t,columns:a,initialState:d,children:p,...x})=>{const{getTableProps:c,getTableBodyProps:g,headerGroups:j,rows:h,prepareRow:b}=l.useTable({columns:a,data:t,initialState:d},l.useGroupBy,l.useSortBy,l.useRowSelect);return t!=null&&t.length?r.jsxs(o,{...x,...c(),children:[r.jsx("thead",{children:j.map(s=>r.jsxs("tr",{...s.getHeaderGroupProps(),children:[s.headers.map(e=>r.jsx(o.HeadCell,{...e.getHeaderProps(e.getSortByToggleProps()),pb:"8px",pt:"0",children:!e.noHeader&&r.jsxs(n,{as:"span",children:[e.render("Header")," ",e.canSort&&!e.disableSortBy&&r.jsx(S,{isSorted:e.isSorted,isSortedDesc:!!e.isSortedDesc})]})})),p&&r.jsx(o.HeadCell,{children:" "})]}))}),r.jsx("tbody",{...g(),children:h.map(s=>(b(s),r.jsxs(o.Row,{...s.getRowProps(),children:[s.cells.map(e=>r.jsx(o.Cell,{...e.getCellProps(),onClick:C=>{var i;return(i=e.column.cellProps)==null?void 0:i.onClick(C,s.original)},children:e.render("Cell")})),p&&r.jsx(o.Cell,{id:"actions",sx:{ml:"8px",position:"sticky",right:0,backgroundColor:"rgba(220, 220, 220, 0.1)",backdropFilter:"blur(1px)"},children:r.jsx(n,{sx:{gap:"10px"},children:p})})]})))})]}):null};export{P as R};
