import t from"@babel/runtime/helpers/defineProperty";import o from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/helpers/objectWithoutProperties";import{forwardRef as r,useState as i}from"react";import a from"classnames";import{makeStyles as l,TableContainer as n}from"@material-ui/core";import{jsx as c}from"react/jsx-runtime";var s=["stickyHeader","className","stickyColumn","classes"];function b(t,o){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);o&&(r=r.filter((function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),e.push.apply(e,r)}return e}var p="top",u="right",m="bottom",d="left",g="both",h=l((function(t){return{root:function(o){return{borderTop:o.isStickyHeader?"1px solid ".concat(t.palette.primary.text9):"none","& .MuiTable-root .MuiTableHead-root .MuiTableRow-head":{position:(o.top||o.bothVertical)&&"sticky",zIndex:2,top:0,boxShadow:(o.top||o.bothVertical)&&"0px 16px 10px ".concat(t.palette.background.b4)},"& .MuiTable-root .MuiTableFooter-root":{"&:before":{content:(o.bottom||o.bothVertical)&&"no-open-quote",position:"absolute",bottom:-1,width:"inherit",height:"16px",background:"linear-gradient(360deg, rgba(44, 44, 44, 0) 0%, ".concat(t.palette.background.b4," 100%)"),transform:"matrix(1, 0, 0, -1, 0, 0)"}},"& .MuiTable-root .MuiTableHead-root .MuiTableRow-head .stickyCell, & .MuiTable-root .MuiTableBody-root .MuiTableRow-root .stickyCell":{"&:after":{content:(o.left||o.bothHorizontal)&&"no-open-quote",position:"absolute",top:0,right:"-16px",width:"16px",height:"100%",background:"linear-gradient(270deg, rgba(44, 44, 44, 0) 0%, ".concat(t.palette.background.b4," 100%)")}},"& .MuiTable-root .MuiTableHead-root .MuiTableRow-head .stickyEmptyCell, & .MuiTable-root .MuiTableBody-root .MuiTableRow-root .stickyEmptyCell":{background:(o.right||o.bothHorizontal)&&"linear-gradient(90deg, rgba(44, 44, 44, 0) 0%, ".concat(t.palette.background.b4," 100%)")}}}}})),f=r((function(r,l){var f=r.stickyHeader,y=r.className,P=r.stickyColumn,T=r.classes,k=e(r,s),M=i(f?m:""),O=o(M,2),w=O[0],j=O[1],x=i(P?u:""),H=o(x,2),v=H[0],S=H[1],C=h({top:w===p,bottom:w===m,bothVertical:w===g,left:v===d,right:v===u,bothHorizontal:v===g,isStickyHeader:f}),R=function(t){var o=t.scroll,e=t.clientParam,r=t.scrollParam,i=t.setScrollPosition,a=t.gradientPositions;0===o?i(a[0]):Math.ceil(o)+e===r?i(a[1]):i(g)};return c(n,function(o){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?b(Object(r),!0).forEach((function(e){t(o,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(t){Object.defineProperty(o,t,Object.getOwnPropertyDescriptor(r,t))}))}return o}({onScroll:function(t){f?R({scroll:t.target.scrollTop,clientParam:t.target.clientHeight,scrollParam:t.target.scrollHeight,setScrollPosition:j,gradientPositions:[m,p]}):P&&R({scroll:t.target.scrollLeft,clientParam:t.target.clientWidth,scrollParam:t.target.scrollWidth,setScrollPosition:S,gradientPositions:[u,d]})},className:a(C.root,y,null==T?void 0:T.root),ref:l},k))}));export{f as TableContainer};
