"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),h=require("react"),u=require("../../utils/cn/cn.cjs.js"),e=require("../../src/components/Pagination/pagination.module.css"),m=require("../Icon/Icon.cjs.js"),d=require("../Icon/constants.cjs.js"),N=require("../Typography/Typography.cjs.js"),_=(r,n,c)=>{if(n<=c)return Array.from({length:n},(a,i)=>i+1);const l=Math.floor(c/2);let o=Math.max(1,r-l),s=o+c-1;return s>n&&(s=n,o=s-c+1),Array.from({length:c},(a,i)=>o+i)},x=({page:r,pagesCount:n,visiblePagesLimit:c,disabled:l,onPageChange:o})=>{const s=h.useMemo(()=>_(r,n,c),[r,n,c]);return t.jsxs("div",{className:e.root,children:[t.jsx("button",{className:u.cn(e.arrow,e.arrowPrev),onClick:()=>o(r-1),disabled:l||r<=1,"aria-label":"Previous page",children:t.jsx(m.Icon,{name:d.EIconName.ARROW_BACK,className:e.icon})}),s.map(a=>t.jsx("button",{className:u.cn(e.page,a===r&&e.activePage),onClick:()=>o(a),children:t.jsx(N.Typography,{defaultVariant:"labelXl",weight:"regular",children:a.toString().padStart(2,"0")})},a)),t.jsx("button",{className:u.cn(e.arrow,e.arrowNext),onClick:()=>o(r+1),disabled:l||r>=n,"aria-label":"Next page",children:t.jsx(m.Icon,{name:d.EIconName.ARROW_FORWARD,className:e.icon})})]})};exports.Pagination=x;
