import{r as e}from"./rolldown-runtime-hePW80VL.js";import{o as t}from"./vendor-forms-yQg41KHz.js";import{t as n}from"./vendor-react-CAGJwf-T.js";import{t as r}from"./chevron-left-eM7fgcn2.js";import{t as i}from"./chevron-right-Cd4JszIi.js";import{t as a}from"./x-OubpdBTF.js";import{t as o}from"./utils-Dk_44zMo.js";import{At as s,kt as c,lt as l,w as u}from"./index-Z_bdWDpJ.js";var d=e(t(),1),f=n();function p({placeholder:e=`Search...`,value:t,onChange:n,debounceMs:r=300,className:i}){let[s,c]=(0,d.useState)(t||``),u=(0,d.useRef)(void 0);(0,d.useEffect)(()=>{t!==void 0&&c(t)},[t]);let p=(0,d.useCallback)(e=>{c(e),clearTimeout(u.current),u.current=setTimeout(()=>n(e),r)},[n,r]),m=(0,d.useCallback)(()=>{c(``),clearTimeout(u.current),n(``)},[n]);return(0,f.jsxs)(`div`,{className:o(`relative`,i),children:[(0,f.jsx)(l,{className:`absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]`}),(0,f.jsx)(`input`,{type:`text`,"aria-label":`Search`,placeholder:e,value:s,onChange:e=>p(e.target.value),className:o(`h-9 w-full rounded-lg border border-[var(--color-border)] bg-[var(--color-surface)]`,`pl-9 pr-8 text-sm text-[var(--color-text-primary)] placeholder:text-[var(--color-text-muted)]`,`focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]/30 focus:border-[var(--color-primary-light)]`,`transition-colors duration-[var(--transition-fast)]`)}),s&&(0,f.jsx)(`button`,{"aria-label":`Clear search`,onClick:m,className:`absolute right-2.5 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-slate-100 dark:hover:bg-slate-700 transition-colors`,children:(0,f.jsx)(a,{className:`w-3.5 h-3.5 text-[var(--color-text-muted)]`})})]})}function m({currentPage:e,totalPages:t,totalItems:n,pageSize:a,onPageChange:l,onPageSizeChange:d,pageSizeOptions:p=[10,20,50,100],className:m}){let g=(e-1)*a+1,_=Math.min(e*a,n);return(0,f.jsxs)(`div`,{className:o(`flex items-center justify-between gap-4 py-3`,m),children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-4 text-sm text-[var(--color-text-muted)]`,children:[(0,f.jsxs)(`span`,{children:[`Showing `,(0,f.jsx)(`span`,{className:`font-medium text-[var(--color-text-primary)]`,children:g}),` to`,` `,(0,f.jsx)(`span`,{className:`font-medium text-[var(--color-text-primary)]`,children:_}),` of`,` `,(0,f.jsx)(`span`,{className:`font-medium text-[var(--color-text-primary)]`,children:n}),` results`]}),d&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{children:`Rows:`}),(0,f.jsx)(u,{size:`sm`,value:String(a),onChange:e=>d(Number(e)),options:p.map(e=>({value:String(e),label:String(e)})),className:`w-20`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(h,{onClick:()=>l(1),disabled:e===1,"aria-label":`First page`,children:(0,f.jsx)(s,{className:`w-4 h-4`})}),(0,f.jsx)(h,{onClick:()=>l(e-1),disabled:e===1,"aria-label":`Previous page`,children:(0,f.jsx)(r,{className:`w-4 h-4`})}),(0,f.jsxs)(`span`,{className:`px-3 text-sm text-[var(--color-text-secondary)]`,children:[`Page `,(0,f.jsx)(`span`,{className:`font-medium`,children:e}),` of `,(0,f.jsx)(`span`,{className:`font-medium`,children:t})]}),(0,f.jsx)(h,{onClick:()=>l(e+1),disabled:e===t,"aria-label":`Next page`,children:(0,f.jsx)(i,{className:`w-4 h-4`})}),(0,f.jsx)(h,{onClick:()=>l(t),disabled:e===t,"aria-label":`Last page`,children:(0,f.jsx)(c,{className:`w-4 h-4`})})]})]})}function h({children:e,...t}){return(0,f.jsx)(`button`,{className:o(`inline-flex items-center justify-center w-8 h-8 rounded-md border border-[var(--color-border)]`,`bg-[var(--color-surface)] text-[var(--color-text-secondary)]`,`hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-[var(--color-text-primary)]`,`disabled:opacity-40 disabled:pointer-events-none`,`transition-colors duration-[var(--transition-fast)]`),...t,children:e})}export{p as n,m as t};