import{j as n,r as a}from"./router.chunk.YsRm4bSN.js";import{_ as __}from"./wordpress.chunk.BVds2GcU.js";import{c as e,B as s}from"./main.chunk.N-eZ2ybB.js";import{aT as r}from"./icons.chunk.BwnSC3zE.js";import{S as o,a as d,b as i,c as l,e as t}from"./select.chunk.BdL8rppi.js";const u=({className:a,...s})=>n.jsx("nav",{role:"navigation","aria-label":"pagination",className:e("growfund-mx-auto growfund-flex growfund-w-full growfund-justify-center",a),...s});u.displayName="Pagination";const c=a.forwardRef(({className:a,...s},r)=>n.jsx("ul",{ref:r,className:e("growfund-flex growfund-flex-row growfund-items-center growfund-gap-1",a),...s}));c.displayName="PaginationContent";const g=a.forwardRef(({className:a,...s},r)=>n.jsx("li",{ref:r,className:e("",a),...s}));g.displayName="PaginationItem";const f=({className:a,isActive:r,disabled:o,onClick:d,size:i="icon",...l})=>n.jsx(s,{"aria-current":r?"page":void 0,type:"button",variant:"outline",size:i,className:e(r&&"growfund-bg-background-fill-brand growfund-text-fg-light growfund-typo-tiny",a),disabled:o,onClick:d,children:l.children});f.displayName="PaginationLink";const w=({className:a,disabled:s,...r})=>n.jsx(f,{"aria-label":"Go to previous page",size:"default",className:e("growfund-gap-1 growfund-typo-tiny",a),disabled:s,...r,children:n.jsx("span",{children:__("Prev","growfund")})});w.displayName="PaginationPrevious";const m=({className:a,...s})=>n.jsx(f,{"aria-label":"Go to next page",size:"default",className:e("growfund-gap-1 growfund-typo-tiny",a),...s,children:n.jsx("span",{children:__("Next","growfund")})});m.displayName="PaginationNext";const h=({className:a,...s})=>n.jsx("span",{"aria-hidden":!0,className:e("growfund-flex growfund-h-9 growfund-w-9 growfund-items-center growfund-justify-center growfund-bg-background-white growfund-border growfund-border-border growfund-rounded-md",a),...s,children:n.jsx(r,{className:"growfund-h-4 growfund-w-4"})});function p({totalItems:a,onPageChange:e,itemsPerPage:s,currentPage:r}){const p=Math.max(Math.ceil(a/s),1);return p<2?null:n.jsxs("div",{className:"growfund-flex growfund-justify-between growfund-w-full",children:[n.jsxs("div",{className:"growfund-flex growfund-items-center growfund-gap-2 growfund-typo-tiny",children:[n.jsx("span",{children:__("Page","growfund")}),n.jsxs(o,{value:r.toString(),onValueChange:n=>{e(Number(n))},children:[n.jsx(d,{className:"growfund-min-w-[3.625rem] growfund-max-w-[5rem] growfund-bg-background-white growfund-rounded-md",children:n.jsx(i,{placeholder:r.toString()})}),n.jsx(l,{children:Array.from({length:p},(a,e)=>n.jsx(t,{value:(e+1).toString(),children:e+1},e+1))})]}),n.jsx("span",{children:__("of","growfund")}),n.jsx("span",{children:p})]}),n.jsx(u,{className:"growfund-w-full",children:n.jsxs(c,{className:"growfund-w-full growfund-flex growfund-justify-end",children:[n.jsx(g,{children:n.jsx(w,{onClick:()=>{e(r-1)},disabled:1===r})}),(()=>{const n=[],a=[];for(let e=Math.max(2,r-2);e<=Math.min(p-1,r+2);e++)n.push(e);return r-2>2?a.push(1,"..."):a.push(1),a.push(...n),r+2<p-1?a.push("...",p):a.push(p),a})().map((a,s)=>{if("..."===a)return n.jsx(g,{className:"[&_>span]:growfund-bg-transparent [&_>span]:growfund-border-none",children:n.jsx(h,{})},s);const o=a,d=o===r;return n.jsx(g,{children:n.jsx(f,{onClick:()=>{e(o)},isActive:d,children:o})},s)}),n.jsx(g,{children:n.jsx(m,{onClick:()=>{e(r+1)},disabled:r===p})})]})})]})}h.displayName="PaginationEllipsis";export{p as P};
