import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-DE3RlOCf.js";import{t as r}from"./SimpleSelectField-Dgpobqfy.js";t();var i=e(n(),1),a=[10,25,50,100];function o({count:e,page:t,pageSize:n,totalPages:o,onPageChange:s,onPageSizeChange:c}){let l=o??Math.ceil(e/n);if(l<=1&&e<=n)return null;let u=(t-1)*n+1,d=Math.min(t*n,e),f=[];if(l<=7)for(let e=1;e<=l;e++)f.push(e);else{f.push(1),t>3&&f.push(`...`);for(let e=Math.max(2,t-1);e<=Math.min(l-1,t+1);e++)f.push(e);t<l-2&&f.push(`...`),f.push(l)}return(0,i.jsxs)(`div`,{className:`flex items-center justify-between px-1 py-2 border-t text-xs text-muted-foreground`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(`div`,{className:`w-24`,children:(0,i.jsx)(r,{name:`rows-per-page`,label:`Rows per page`,value:String(n),onValueChange:e=>c(Number(e)),options:a.map(e=>({id:String(e),name:String(e)})),showCustomize:!1})}),(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:e>0?`${u}–${d} of ${e}`:`0 records`})]}),(0,i.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,i.jsx)(`button`,{className:`h-7 w-7 rounded border border-input bg-background flex items-center justify-center disabled:opacity-40`,onClick:()=>s(1),disabled:t===1,title:`First page`,children:`«`}),(0,i.jsx)(`button`,{className:`h-7 w-7 rounded border border-input bg-background flex items-center justify-center disabled:opacity-40`,onClick:()=>s(t-1),disabled:t===1,title:`Previous page`,children:`‹`}),f.map((e,n)=>e===`...`?(0,i.jsx)(`span`,{className:`px-1`,children:`…`},`ellipsis-${n}`):(0,i.jsx)(`button`,{className:`h-7 min-w-[28px] px-1.5 rounded border text-xs ${e===t?`bg-primary text-primary-foreground border-primary font-semibold`:`border-input bg-background hover:bg-muted`}`,onClick:()=>s(e),children:e},e)),(0,i.jsx)(`button`,{className:`h-7 w-7 rounded border border-input bg-background flex items-center justify-center disabled:opacity-40`,onClick:()=>s(t+1),disabled:t===l,title:`Next page`,children:`›`}),(0,i.jsx)(`button`,{className:`h-7 w-7 rounded border border-input bg-background flex items-center justify-center disabled:opacity-40`,onClick:()=>s(l),disabled:t===l,title:`Last page`,children:`»`})]})]})}export{o as t};