import{j as i}from"./vendor-react-wBh_31cN.js";import{d as c,G as r}from"./index-dNe6i2rS.js";import{L as m}from"./label-gPWmc6ow.js";import{_ as x,Z as h,aa as f}from"./vendor-icons-BUUmD6ht.js";function j(s,a){if(a<=7)return Array.from({length:a},(t,n)=>n+1);const e=[1];s>3&&e.push("ellipsis");const o=Math.max(2,s-1),l=Math.min(a-1,s+1);for(let t=o;t<=l;t+=1)e.push(t);return s<a-2&&e.push("ellipsis"),e.push(a),e}function d({currentPage:s,totalPages:a,onChange:e,disabled:o=!1,className:l}){const t=j(s,a);return i.jsxs("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:c("flex items-center gap-0.5",l),children:[i.jsx(r,{variant:"ghost",size:"icon",disabled:o||s<=1,onClick:()=>e(s-1),"aria-label":"Go to previous page",children:i.jsx(x,{className:"size-4"})}),t.map((n,p)=>n==="ellipsis"?i.jsx("span",{"aria-hidden":!0,className:"flex size-8 items-center justify-center",children:i.jsx(h,{className:"size-4"})},`ellipsis-${p}`):i.jsx(r,{variant:n===s?"outline":"ghost",size:"icon",disabled:o,onClick:()=>e(n),"aria-current":n===s?"page":void 0,children:n},n)),i.jsx(r,{variant:"ghost",size:"icon",disabled:o||s>=a,onClick:()=>e(s+1),"aria-label":"Go to next page",children:i.jsx(f,{className:"size-4"})})]})}function N({className:s,...a}){return i.jsxs("div",{className:c("flex flex-row items-center justify-center gap-2",s),children:[i.jsx(m,{className:"whitespace-nowrap text-xs",children:"go to page"}),i.jsx(d,{...a})]})}export{N as P,d as a};
