import"react";import{useMemo as v}from"react";var g="...",p=(n,r)=>{let e=r-n+1;return Array.from({length:e},(c,t)=>t+n)},P=({totalCount:n,pageSize:r,siblingCount:e=1,currentPage:c})=>v(()=>{let o=Math.ceil(n/r);if(e+5>=o)return p(1,o);let i=Math.max(c-e,1),u=Math.min(c+e,o),m=i>2,s=u<o-2,a=1,f=o;if(!m&&s){let d=3+2*e;return[...p(1,d),g,o]}if(m&&!s){let d=3+2*e,x=p(o-d+1,o);return[a,g,...x]}if(m&&s){let d=p(i,u);return[a,g,...d,g,f]}},[n,r,e,c]);import y from"@emotion/styled";var I=y.ul`
  display: flex;
  align-items: center;
  justify-content: center;
  list-style-type: none;
`,h=y.li`
  padding: 0 12px;
  height: 32px;
  min-width: 32px;
  text-align: center;
  margin: auto 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;

  ${({disabled:n})=>n&&`
    pointer-events: none;

    &:hover {
      background-color: transparent;
      cursor: default;
    }
  `}

  &.dots:hover {
    background-color: transparent;
    cursor: default;
  }
  &:hover {
    background-color: var(--bad-colors-muted);
    cursor: pointer;
  }

  &.selected {
    background-color: var(--bad-colors-muted);
  }

  &.disabled {
  }
`;import{ChevronLeftIcon as C,ChevronRightIcon as S}from"@chakra-ui/icons";import{Box as R,Flex as b}from"@chakra-ui/react";import{jsx as l,jsxs as D}from"react/jsx-runtime";var w=n=>{let{onPageChange:r,totalCount:e,siblingCount:c=1,currentPage:t,pageSize:o,className:k}=n,i=P({currentPage:t,totalCount:e,siblingCount:c,pageSize:o});if(t===0||i.length<2)return null;let u=()=>{r(t+1)},m=()=>{r(t-1)},s=i[i.length-1];return D(b,{align:"center",children:[l(R,{children:l(C,{boxSize:6,onClick:t===1?()=>{}:m,opacity:t===1?.1:1,cursor:t===1?"not-allowed":"pointer"})}),l(I,{children:i.map((a,f)=>a===g?l(h,{className:"dots",children:"\u2026"},f):l(h,{className:a===t?"selected":"",onClick:a===t?()=>{}:()=>r(a),children:a},f))}),l(R,{children:l(S,{boxSize:6,onClick:t===s?()=>{}:u,opacity:t===s?.1:1,cursor:t===s?"not-allowed":"pointer"})})]})},$=w;export{$ as default};
