import{c as f,j as n,b as j}from"./app-BiexncSX.js";import{c as x}from"./utils-DvRnx1Xn.js";import{b as N}from"./button-Cwvd_D5X.js";import{C as b}from"./chevron-left-CfTNJLZd.js";import{C as v}from"./chevron-right-D-bIFB2o.js";import{E as S}from"./ellipsis-BcGSaUdp.js";import{a as _,b as P,c as w,e as y,S as z,d as $}from"./select-Oi4we0ay.js";import{L as C}from"./label-BACPLsln.js";function E(l){const e=f.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=x("mx-auto flex w-full justify-center",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=n.jsx("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function L(l){const e=f.c(8);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=x("flex flex-row items-center gap-1",t),e[3]=t,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=n.jsx("ul",{"data-slot":"pagination-content",className:a,...s}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i}function h(l){const e=f.c(4);let t;e[0]!==l?({...t}=l,e[0]=l,e[1]=t):t=e[1];let s;return e[2]!==t?(s=n.jsx("li",{"data-slot":"pagination-item",...t}),e[2]=t,e[3]=s):s=e[3],s}function g(l){const e=f.c(14);let t,s,a,i;e[0]!==l?({className:t,isActive:s,size:i,...a}=l,e[0]=l,e[1]=t,e[2]=s,e[3]=a,e[4]=i):(t=e[1],s=e[2],a=e[3],i=e[4]);const o=i===void 0?"icon":i,r=s?"page":void 0;let c;e[5]!==t||e[6]!==s||e[7]!==o?(c=x(N({variant:s?"outline":"ghost",size:o}),t),e[5]=t,e[6]=s,e[7]=o,e[8]=c):c=e[8];let m;return e[9]!==s||e[10]!==a||e[11]!==r||e[12]!==c?(m=n.jsx("a",{"aria-current":r,"data-slot":"pagination-link","data-active":s,className:c,...a}),e[9]=s,e[10]=a,e[11]=r,e[12]=c,e[13]=m):m=e[13],m}function R(l){const e=f.c(10);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=x("gap-1 px-2.5 sm:pl-2.5",t),e[3]=t,e[4]=a):a=e[4];let i,o;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(b,{}),o=n.jsx("span",{className:"hidden sm:block",children:"Previous"}),e[5]=i,e[6]=o):(i=e[5],o=e[6]);let r;return e[7]!==s||e[8]!==a?(r=n.jsxs(g,{"aria-label":"Go to previous page",size:"default",className:a,...s,children:[i,o]}),e[7]=s,e[8]=a,e[9]=r):r=e[9],r}function G(l){const e=f.c(10);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=x("gap-1 px-2.5 sm:pr-2.5",t),e[3]=t,e[4]=a):a=e[4];let i,o;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("span",{className:"hidden sm:block",children:"Next"}),o=n.jsx(v,{}),e[5]=i,e[6]=o):(i=e[5],o=e[6]);let r;return e[7]!==s||e[8]!==a?(r=n.jsxs(g,{"aria-label":"Go to next page",size:"default",className:a,...s,children:[i,o]}),e[7]=s,e[8]=a,e[9]=r):r=e[9],r}function T(l){const e=f.c(10);let t,s;e[0]!==l?({className:t,...s}=l,e[0]=l,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let a;e[3]!==t?(a=x("flex size-9 items-center justify-center",t),e[3]=t,e[4]=a):a=e[4];let i,o;e[5]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(S,{className:"size-4"}),o=n.jsx("span",{className:"sr-only",children:"More pages"}),e[5]=i,e[6]=o):(i=e[5],o=e[6]);let r;return e[7]!==s||e[8]!==a?(r=n.jsxs("span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:a,...s,children:[i,o]}),e[7]=s,e[8]=a,e[9]=r):r=e[9],r}function K(l){const e=f.c(12),{links:t,meta:s}=l,a=I;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(C,{className:"text-sm text-muted-foreground",children:"  Rows per page"}),e[0]=i):i=e[0];const o=String(s.per_page);let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=n.jsx(_,{className:"w-20",size:"sm",children:n.jsx(P,{})}),e[1]=r):r=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(w,{children:n.jsx(y,{children:[5,10,25,50,100].map(A)})}),e[2]=c):c=e[2];let m;e[3]!==o?(m=n.jsxs("div",{className:"flex items-center gap-2",children:[i,n.jsxs(z,{value:o,onValueChange:a,children:[r,c]})]}),e[3]=o,e[4]=m):m=e[4];let p;e[5]!==t?(p=t.map(V),e[5]=t,e[6]=p):p=e[6];let u;e[7]!==p?(u=n.jsx(E,{className:"mx-0 w-auto",children:n.jsx(L,{children:p})}),e[7]=p,e[8]=u):u=e[8];let d;return e[9]!==m||e[10]!==u?(d=n.jsxs("div",{className:"flex flex-col sm:flex-row items-center w-full justify-center gap-8 pt-4",children:[m,u]}),e[9]=m,e[10]=u,e[11]=d):d=e[11],d}function V(l,e){return l.label.includes("Previous")?n.jsx(h,{children:n.jsx(R,{size:"sm",href:l.url||"",className:l.url?"":"opacity-50 pointer-events-none"})},e):l.label.includes("Next")?n.jsx(h,{children:n.jsx(G,{size:"sm",href:l.url||"",className:l.url?"":"opacity-50 pointer-events-none"})},e):l.label==="..."?n.jsx(h,{children:n.jsx(T,{})},e):n.jsx(h,{children:n.jsx(g,{size:"sm",isActive:l.active,href:l.url||"",children:l.label})},e)}function A(l){return n.jsx($,{value:String(l),children:l},l)}function I(l){const e=new URLSearchParams(window.location.search);e.set("per_page",l),e.set("page","1"),j.visit(`${window.location.pathname}?${e.toString()}`,{preserveState:!0,replace:!0})}export{K as T};
