import{m as M,n as P,dA as D,dC as I,f as g,q as R,r as U,t as B,j as r,v as C,w as z,y as X,dg as E,o as T,F as H,B as $,P as K}from"./index-6c48ebe4.js";import{T as N,t as A,a as x}from"./TableRow-31f0a4a1.js";import{u as V}from"./useMediaQuery-00a4851f.js";import{T as _}from"./TableContainer-45046f6e.js";import{T as q,a as Q,b as G}from"./TableHead-37e5318b.js";import{c as J}from"./Grow-3d640bff.js";import{T as Y}from"./TablePagination-cd240560.js";function Z(t){return String(t).match(/[\d.\-+]*\s*(.*)/)[1]||""}function tt(t){return parseFloat(t)}function et(t){return M("MuiSkeleton",t)}P("MuiSkeleton",["root","text","rectangular","rounded","circular","pulse","wave","withChildren","fitContent","heightAuto"]);const at=t=>{const{classes:a,variant:e,animation:o,hasChildren:n,width:l,height:s}=t;return z({root:["root",e,o,n&&"withChildren",n&&!l&&"fitContent",n&&!s&&"heightAuto"]},et,a)},k=D`
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }

  100% {
    opacity: 1;
  }
`,j=D`
  0% {
    transform: translateX(-100%);
  }

  50% {
    /* +0.5s of delay between each loop */
    transform: translateX(100%);
  }

  100% {
    transform: translateX(100%);
  }
`,ot=typeof k!="string"?I`
        animation: ${k} 2s ease-in-out 0.5s infinite;
      `:null,rt=typeof j!="string"?I`
        &::after {
          animation: ${j} 2s linear 0.5s infinite;
        }
      `:null,nt=g("span",{name:"MuiSkeleton",slot:"Root",overridesResolver:(t,a)=>{const{ownerState:e}=t;return[a.root,a[e.variant],e.animation!==!1&&a[e.animation],e.hasChildren&&a.withChildren,e.hasChildren&&!e.width&&a.fitContent,e.hasChildren&&!e.height&&a.heightAuto]}})(R(({theme:t})=>{const a=Z(t.shape.borderRadius)||"px",e=tt(t.shape.borderRadius);return{display:"block",backgroundColor:t.vars?t.vars.palette.Skeleton.bg:X(t.palette.text.primary,t.palette.mode==="light"?.11:.13),height:"1.2em",variants:[{props:{variant:"text"},style:{marginTop:0,marginBottom:0,height:"auto",transformOrigin:"0 55%",transform:"scale(1, 0.60)",borderRadius:`${e}${a}/${Math.round(e/.6*10)/10}${a}`,"&:empty:before":{content:'"\\00a0"'}}},{props:{variant:"circular"},style:{borderRadius:"50%"}},{props:{variant:"rounded"},style:{borderRadius:(t.vars||t).shape.borderRadius}},{props:({ownerState:o})=>o.hasChildren,style:{"& > *":{visibility:"hidden"}}},{props:({ownerState:o})=>o.hasChildren&&!o.width,style:{maxWidth:"fit-content"}},{props:({ownerState:o})=>o.hasChildren&&!o.height,style:{height:"auto"}},{props:{animation:"pulse"},style:ot||{animation:`${k} 2s ease-in-out 0.5s infinite`}},{props:{animation:"wave"},style:{position:"relative",overflow:"hidden",WebkitMaskImage:"-webkit-radial-gradient(white, black)","&::after":{background:`linear-gradient(
                90deg,
                transparent,
                ${(t.vars||t).palette.action.hover},
                transparent
              )`,content:'""',position:"absolute",transform:"translateX(-100%)",bottom:0,left:0,right:0,top:0}}},{props:{animation:"wave"},style:rt||{"&::after":{animation:`${j} 2s linear 0.5s infinite`}}}]}})),st=U.forwardRef(function(a,e){const o=B({props:a,name:"MuiSkeleton"}),{animation:n="pulse",className:l,component:s="span",height:c,style:p,variant:u="text",width:m,...d}=o,f={...o,animation:n,component:s,variant:u,hasChildren:!!d.children},v=at(f);return r.jsx(nt,{as:s,ref:e,className:C(v.root,l),ownerState:f,...d,style:{width:m,height:c,...p}})}),it=st,lt=J(r.jsx("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownward");function ct(t){return M("MuiTableSortLabel",t)}const dt=P("MuiTableSortLabel",["root","active","icon","iconDirectionDesc","iconDirectionAsc","directionDesc","directionAsc"]),w=dt,pt=t=>{const{classes:a,direction:e,active:o}=t,n={root:["root",o&&"active",`direction${T(e)}`],icon:["icon",`iconDirection${T(e)}`]};return z(n,ct,a)},ft=g(E,{name:"MuiTableSortLabel",slot:"Root",overridesResolver:(t,a)=>{const{ownerState:e}=t;return[a.root,e.active&&a.active]}})(R(({theme:t})=>({cursor:"pointer",display:"inline-flex",justifyContent:"flex-start",flexDirection:"inherit",alignItems:"center","&:focus":{color:(t.vars||t).palette.text.secondary},"&:hover":{color:(t.vars||t).palette.text.secondary,[`& .${w.icon}`]:{opacity:.5}},[`&.${w.active}`]:{color:(t.vars||t).palette.text.primary,[`& .${w.icon}`]:{opacity:1,color:(t.vars||t).palette.text.secondary}}}))),ht=g("span",{name:"MuiTableSortLabel",slot:"Icon",overridesResolver:(t,a)=>{const{ownerState:e}=t;return[a.icon,a[`iconDirection${T(e.direction)}`]]}})(R(({theme:t})=>({fontSize:18,marginRight:4,marginLeft:4,opacity:0,transition:t.transitions.create(["opacity","transform"],{duration:t.transitions.duration.shorter}),userSelect:"none",variants:[{props:{direction:"desc"},style:{transform:"rotate(0deg)"}},{props:{direction:"asc"},style:{transform:"rotate(180deg)"}}]}))),ut=U.forwardRef(function(a,e){const o=B({props:a,name:"MuiTableSortLabel"}),{active:n=!1,children:l,className:s,direction:c="asc",hideSortIcon:p=!1,IconComponent:u=lt,...m}=o,d={...o,active:n,direction:c,hideSortIcon:p,IconComponent:u},f=pt(d);return r.jsxs(ft,{className:C(f.root,s),component:"span",disableRipple:!0,ownerState:d,ref:e,...m,children:[l,p&&!n?null:r.jsx(ht,{as:u,className:C(f.icon),ownerState:d})]})}),bt=ut,S=g(N,{shouldForwardProp:t=>t!=="sticky"&&t!=="left"})(({theme:t,width:a,sticky:e,left:o})=>({[`&.${A.head}`]:{backgroundColor:"#F2F4F7",width:a,maxWidth:a,fontSize:"14px",textAlign:"start",color:t.palette.primary.main,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",position:e?"sticky":"static",left:e?o:"auto",zIndex:e?2:1},[`&.${A.body}`]:{textAlign:"start",fontSize:"14px",borderBottom:"1px solid rgba(0, 0, 0, 0.1)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",width:a,maxWidth:a,position:e?"sticky":"static",left:e?o:"auto",background:e?"#fff":"inherit",zIndex:e?1:0}})),L=(t,a)=>{const e=a[t];if(!(e!=null&&e.sticky))return{sticky:!1,left:0};let o=0;for(let n=0;n<t;n++){const l=a[n];if(l!=null&&l.sticky){const s=l.width;if(typeof s=="number")o+=s;else if(typeof s=="string"){const c=parseInt(s,10);isNaN(c)||(o+=c)}}}return{sticky:!0,left:o}},mt=g(x)(({theme:t})=>({"&:nth-of-type(odd)":{backgroundColor:t.palette.common.white},"&:last-child td, &:last-child th":{}}));function Tt({columns:t=[],rows:a=[],loading:e,count:o,page:n,pageSize:l,showPagination:s=!0,containerHeight:c="100%",handleSort:p,handleChangePage:u,handleChangeRowsPerPage:m}){const d=H(),f=V(d.breakpoints.down("sm")),v=i=>{p&&p(i)};return r.jsxs($,{sx:{overflowX:"auto"},children:[r.jsx(_,{component:K,children:r.jsxs(q,{sx:{minWidth:f?300:700},"aria-label":"responsive table",children:[r.jsx(Q,{children:r.jsx(mt,{children:t&&t.map((i,b)=>{const{sticky:y,left:h}=L(b,t);return r.jsx(S,{width:i.width,sticky:y,left:h,children:i.sortable&&i.field?r.jsx(bt,{onClick:()=>v(i.field),children:i.title}):i.title},b)})})}),r.jsx(G,{children:e?Array.from(Array(3)).map((i,b)=>r.jsx(x,{children:Array.from(Array(t.length)).map((y,h)=>r.jsx(S,{children:r.jsx(it,{height:80})},h))},b)):a.length?a.map((i,b)=>i&&r.jsx(x,{children:t.map((y,h)=>{const{sticky:F,left:O}=L(h,t),W=y.field||Object.keys(i)[h];return r.jsx(S,{sticky:F,left:O,children:i[W]},h)})},b)):r.jsx(x,{children:r.jsx(N,{colSpan:t.length,align:"center",sx:{padding:5},children:"Empty Data"})})})]})}),s&&r.jsx($,{sx:{display:"flex",justifyContent:"center",my:2},children:r.jsx(Y,{rowsPerPageOptions:[10,20,50,100],component:"div",count:o,rowsPerPage:l,page:n-1,onPageChange:u,onRowsPerPageChange:m})})]})}export{Tt as T};
