import{j as e}from"./ui-vendor-CJlQk0Tq.js";import{r as s}from"./react-vendor-f6QdChhz.js";import{K as r}from"./index-CUIxi1yy.js";const a=s.forwardRef(({className:a,topScrollbar:t,...l},o)=>{const d=s.useRef(null),c=s.useRef(null),n=s.useRef(null),[i,f]=s.useState(!1),m=s.useCallback(e=>{n.current=e,"function"==typeof o?o(e):o&&(o.current=e)},[o]);return s.useEffect(()=>{if(!t)return;const e=c.current,s=d.current;if(!e||!s)return;const r=()=>{s&&(s.scrollLeft=e.scrollLeft)},a=()=>{e&&(e.scrollLeft=s.scrollLeft)},l=()=>{if(!s||!e)return;const r=s.scrollWidth,a=s.clientWidth;f(r>a+1);const t=e.firstElementChild;t&&(t.style.width=`${r}px`,t.style.height="1px"),e.scrollLeft=s.scrollLeft};e.addEventListener("scroll",r,{passive:!0}),s.addEventListener("scroll",a,{passive:!0});const o=new ResizeObserver(l);return n.current&&o.observe(n.current),o.observe(s),window.addEventListener("resize",l),l(),()=>{e.removeEventListener("scroll",r),s.removeEventListener("scroll",a),o.disconnect(),window.removeEventListener("resize",l)}},[t]),e.jsxs("div",{className:"relative w-full",children:[t&&i&&e.jsx("div",{ref:c,className:"mb-2 overflow-x-auto overflow-y-hidden","aria-hidden":"true",children:e.jsx("div",{})}),e.jsx("div",{ref:d,className:"w-full overflow-auto",children:e.jsx("table",{ref:m,className:r("w-full caption-bottom text-sm",a),...l})})]})});a.displayName="Table";const t=s.forwardRef(({className:s,...a},t)=>e.jsx("thead",{ref:t,className:r("[&_tr]:border-b",s),...a}));t.displayName="TableHeader";const l=s.forwardRef(({className:s,...a},t)=>e.jsx("tbody",{ref:t,className:r("[&_tr:last-child]:border-0",s),...a}));l.displayName="TableBody";s.forwardRef(({className:s,...a},t)=>e.jsx("tfoot",{ref:t,className:r("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...a})).displayName="TableFooter";const o=s.forwardRef(({className:s,...a},t)=>e.jsx("tr",{ref:t,className:r("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...a}));o.displayName="TableRow";const d=s.forwardRef(({className:s,...a},t)=>e.jsx("th",{ref:t,className:r("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...a}));d.displayName="TableHead";const c=s.forwardRef(({className:s,...a},t)=>e.jsx("td",{ref:t,className:r("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...a}));c.displayName="TableCell";const n=s.forwardRef(({className:s,...a},t)=>e.jsx("caption",{ref:t,className:r("mt-4 text-sm text-muted-foreground",s),...a}));n.displayName="TableCaption";export{a as T,t as a,o as b,d as c,l as d,c as e,n as f};