import{n as D,o as I,dJ as U,dL as z,f as x,t as $,r as B,v as N,j as r,w as F,x as O,z as E,ds as H,q as k,y as L,H as K,B as P,P as V}from"./index-c3f592b2.js";import{T as W,t as A,a as v}from"./TableRow-974e102e.js";import{u as _}from"./index-88943ce1.js";import{T as q}from"./TableContainer-a7e6bb64.js";import{T as J,a as Q,b as G}from"./TableHead-98885dba.js";import{c as Y}from"./Grow-f61cc5ca.js";import{T as Z}from"./TablePagination-fd957a04.js";function tt(t){return String(t).match(/[\d.\-+]*\s*(.*)/)[1]||""}function et(t){return parseFloat(t)}function ot(t){return D("MuiSkeleton",t)}I("MuiSkeleton",["root","text","rectangular","rounded","circular","pulse","wave","withChildren","fitContent","heightAuto"]);const at=t=>{const{classes:o,variant:e,animation:a,hasChildren:n,width:l,height:i}=t;return O({root:["root",e,a,n&&"withChildren",n&&!l&&"fitContent",n&&!i&&"heightAuto"]},ot,o)},j=U`
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }

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

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

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