import{Q as b,bV as $,O as i,D as r,aw as w,S as g,K as u,aA as d,R as s,bF as k,bH as M,an as _,bL as z,bM as A,bN as O,bO as y}from"./index-CNZMR1GT.js";import{x as v,y as F,z as B}from"./index-DsSWFirV.js";const T=x=>{var m;const t=b({maxShowPage:4,defaultPageSize:30,defaultCurrent:1,hideOnSinglePage:!0},x),[n,S]=$({pageSize:t.defaultPageSize,current:t.defaultCurrent});(m=t.setResetCallback)==null||m.call(t,()=>{S("current",t.defaultCurrent)});const a=i(()=>Math.ceil(t.total/n.pageSize)),f=i(()=>{const e=n.current,c=Math.max(2,e-Math.floor(t.maxShowPage/2));return Array.from({length:e-c},(P,h)=>c+h)}),p=i(()=>{const e=n.current,c=Math.min(a()-1,e+Math.floor(t.maxShowPage/2));return Array.from({length:c-e},(P,h)=>e+1+h)}),C=i(()=>Array.from({length:a()},(e,c)=>1+c)),o={"@initial":"sm","@md":"md"},l=e=>{var c;S("current",e),(c=t.onChange)==null||c.call(t,e)};return r(g,{get when(){return!t.hideOnSinglePage||a()>1},get children(){return r(w,{spacing:"$1",get children(){return[r(g,{get when(){return n.current!==1},get children(){return[r(u,{size:o,get colorScheme(){return t.colorScheme},onClick:()=>{l(1)},px:"$3",children:"1"}),r(d,{size:o,get icon(){return r(v,{})},"aria-label":"Previous",get colorScheme(){return t.colorScheme},onClick:()=>{l(n.current-1)},w:"2rem !important"})]}}),r(s,{get each(){return f()},children:e=>r(u,{size:o,get colorScheme(){return t.colorScheme},onClick:()=>{l(e)},px:e>10?"$2_5":"$3",children:e})}),r(k,{size:o,variant:"unstyled",get defaultValue(){return n.current},onChange:e=>{l(+e)},get children(){return[r(M,{as:u,size:o,width:"auto",px:"$1",variant:"solid",get colorScheme(){return t.colorScheme},get children(){return[r(_,{get px(){return n.current>10?"$1_5":"$2"},get children(){return n.current}}),r(F,{})]}}),r(z,{minW:"80px",get children(){return r(A,{get children(){return r(s,{get each(){return C()},children:e=>r(O,{value:e,get children(){return r(y,{px:"$2",children:e})}})})}})}})]}}),r(s,{get each(){return p()},children:e=>r(u,{size:o,get colorScheme(){return t.colorScheme},onClick:()=>{l(e)},px:e>10?"$2_5":"$3",children:e})}),r(g,{get when(){return n.current!==a()},get children(){return[r(d,{size:o,get icon(){return r(B,{})},"aria-label":"Next",get colorScheme(){return t.colorScheme},onClick:()=>{l(n.current+1)},w:"2rem !important"}),r(u,{size:o,get colorScheme(){return t.colorScheme},onClick:()=>{l(a())},get px(){return a()>10?"$2_5":"$3"},get children(){return a()}})]}})]}})}})};export{T as P};
