import{r as e}from"./rolldown-runtime-CpWojdLp.js";import{n as t,t as n}from"./jsx-runtime-B6e-FjZo.js";import{Ar as r,At as i,Ht as a,On as o,gn as s}from"./app-figJB8d1.js";import{t as c}from"./table-query-CCivnVO7.js";var l=r(),u=n();function d(e){let t=(0,l.c)(51),{pagination:n,only:r,paramName:o}=e,s=o===void 0?`page`:o,{t:d}=a(),{current_page:f,last_page:p,per_page:m,total:h}=n,g;t[0]!==f||t[1]!==p||t[2]!==r||t[3]!==s?(g=e=>{e<1||e>p||e===f||c({[s]:e<=1?null:String(e)},{only:r,resetPage:!1,pageParamName:s})},t[0]=f,t[1]=p,t[2]=r,t[3]=s,t[4]=g):g=t[4];let _=g,v=h===0?0:(f-1)*m+1,y=h===0?0:Math.min(f*m,h),b;t[5]===d?b=t[6]:(b=d(`Showing`),t[5]=d,t[6]=b);let x;t[7]===v?x=t[8]:(x=(0,u.jsx)(`span`,{className:`font-medium text-foreground`,children:v}),t[7]=v,t[8]=x);let S;t[9]===y?S=t[10]:(S=(0,u.jsx)(`span`,{className:`font-medium text-foreground`,children:y}),t[9]=y,t[10]=S);let C;t[11]===d?C=t[12]:(C=d(`of`),t[11]=d,t[12]=C);let w;t[13]===h?w=t[14]:(w=(0,u.jsx)(`span`,{className:`font-medium text-foreground`,children:h}),t[13]=h,t[14]=w);let T;t[15]!==b||t[16]!==x||t[17]!==S||t[18]!==C||t[19]!==w?(T=(0,u.jsxs)(`span`,{children:[b,` `,x,`–`,S,` `,C,` `,w]}),t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T):T=t[20];let E;t[21]!==f||t[22]!==_?(E=()=>_(f-1),t[21]=f,t[22]=_,t[23]=E):E=t[23];let D=f<=1,O;t[24]===d?O=t[25]:(O=d(`Previous page`),t[24]=d,t[25]=O);let k;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,u.jsx)(i,{direction:`back`,style:`chevron`,className:`size-4`}),t[26]=k):k=t[26];let A;t[27]!==D||t[28]!==O||t[29]!==E?(A=(0,u.jsx)(`button`,{type:`button`,onClick:E,disabled:D,"aria-label":O,className:`flex size-6 items-center justify-center rounded-md border bg-card text-foreground transition hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40`,children:k}),t[27]=D,t[28]=O,t[29]=E,t[30]=A):A=t[30];let j;t[31]!==f||t[32]!==p?(j=(0,u.jsxs)(`span`,{className:`px-2 tabular-nums`,children:[f,` / `,p]}),t[31]=f,t[32]=p,t[33]=j):j=t[33];let M;t[34]!==f||t[35]!==_?(M=()=>_(f+1),t[34]=f,t[35]=_,t[36]=M):M=t[36];let N=f>=p,P;t[37]===d?P=t[38]:(P=d(`Next page`),t[37]=d,t[38]=P);let F;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,u.jsx)(i,{direction:`forward`,style:`chevron`,className:`size-4`}),t[39]=F):F=t[39];let I;t[40]!==M||t[41]!==N||t[42]!==P?(I=(0,u.jsx)(`button`,{type:`button`,onClick:M,disabled:N,"aria-label":P,className:`flex size-6 items-center justify-center rounded-md border bg-card text-foreground transition hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40`,children:F}),t[40]=M,t[41]=N,t[42]=P,t[43]=I):I=t[43];let L;t[44]!==A||t[45]!==j||t[46]!==I?(L=(0,u.jsxs)(`div`,{className:`flex items-center gap-1`,children:[A,j,I]}),t[44]=A,t[45]=j,t[46]=I,t[47]=L):L=t[47];let R;return t[48]!==L||t[49]!==T?(R=(0,u.jsxs)(`div`,{className:`flex min-h-8 items-center justify-between gap-3 border-t bg-muted/20 px-4 py-1.5 text-xs text-muted-foreground`,children:[T,L]}),t[48]=L,t[49]=T,t[50]=R):R=t[50],R}var f=e(t(),1);function p(e){let t=(0,l.c)(19),{placeholder:n,initialValue:r,paramName:i,only:d}=e,p=r===void 0?``:r,m=i===void 0?`q`:i,{t:h}=a(),g;t[0]!==n||t[1]!==h?(g=n??h(`Search…`),t[0]=n,t[1]=h,t[2]=g):g=t[2];let _=g,[v,y]=(0,f.useState)(p),b=(0,f.useRef)(!0),x,S;t[3]!==d||t[4]!==m||t[5]!==v?(x=()=>{if(b.current){b.current=!1;return}let e=window.setTimeout(()=>{let e=v.trim();c({[m]:e===``?null:e},{only:d})},250);return()=>window.clearTimeout(e)},S=[v,m,d],t[3]=d,t[4]=m,t[5]=v,t[6]=x,t[7]=S):(x=t[6],S=t[7]),(0,f.useEffect)(x,S);let C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,u.jsx)(o,{className:`pointer-events-none absolute start-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),t[8]=C):C=t[8];let w;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>y(e.target.value),t[9]=w):w=t[9];let T;t[10]!==_||t[11]!==v?(T=(0,u.jsx)(`input`,{type:`search`,value:v,onChange:w,placeholder:_,className:`h-7 w-full rounded-md border border-input bg-card ps-8 pe-7 text-xs shadow-xs transition outline-none placeholder:text-muted-foreground focus:border-ring focus:ring-2 focus:ring-ring/20`}),t[10]=_,t[11]=v,t[12]=T):T=t[12];let E;t[13]!==h||t[14]!==v?(E=v!==``&&(0,u.jsx)(`button`,{type:`button`,onClick:()=>y(``),"aria-label":h(`Clear search`),className:`absolute end-1.5 top-1/2 -translate-y-1/2 rounded p-1 text-muted-foreground transition hover:text-foreground`,children:(0,u.jsx)(s,{className:`size-3.5`})}),t[13]=h,t[14]=v,t[15]=E):E=t[15];let D;return t[16]!==T||t[17]!==E?(D=(0,u.jsxs)(`div`,{className:`relative w-full max-w-xs`,children:[C,T,E]}),t[16]=T,t[17]=E,t[18]=D):D=t[18],D}export{d as n,p as t};