"use strict";const n=require("react/jsx-runtime"),g=require("./NiceTabs-DcbYFIWR.cjs");function v(e,a,l){const r=[];if(a<=1)return a===1&&r.push(1),r;const o=Math.max(2,e-l),c=Math.min(a-1,e+l);r.push(1),o>2&&r.push("dots");for(let s=o;s<=c;s++)r.push(s);return c<a-1&&r.push("dots"),r.push(a),r}const y=({page:e,totalPages:a,onChange:l,showInfo:r,siblingCount:o=1,size:c="md",showFirstLast:s,showJumpInput:p,jumpInputLabel:h,showPageSize:m,pageSizeOptions:d,pageSize:x,onPageSizeChange:b,disabled:t,className:f,style:N})=>{const _=v(e,a,o);return n.jsxs("nav",{className:`nice-pagination nice-pagination--${c} ${f||""}`,style:N,"aria-label":"Pagination",children:[s&&n.jsx("button",{className:"nice-pagination__btn",disabled:t||e<=1,onClick:()=>l(1),"aria-label":"First page",title:"First page",children:"⏮"}),n.jsx("button",{className:"nice-pagination__btn",disabled:t||e<=1,onClick:()=>l(e-1),"aria-label":"Previous",children:n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 20 20",fill:"currentColor",children:n.jsx("path",{fillRule:"evenodd",d:"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z",clipRule:"evenodd"})})}),_.map((i,u)=>i==="dots"?n.jsx("span",{className:"nice-pagination__ellipsis",children:"…"},`dots-${u}`):n.jsx("button",{className:`nice-pagination__btn ${i===e?"nice-pagination__btn--active":""}`,disabled:t,onClick:()=>l(i),"aria-current":i===e?"page":void 0,children:i},i)),n.jsx("button",{className:"nice-pagination__btn",disabled:t||e>=a,onClick:()=>l(e+1),"aria-label":"Next",children:n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 20 20",fill:"currentColor",children:n.jsx("path",{fillRule:"evenodd",d:"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z",clipRule:"evenodd"})})}),s&&n.jsx("button",{className:"nice-pagination__btn",disabled:t||e>=a,onClick:()=>l(a),"aria-label":"Last page",title:"Last page",children:"⏭"}),r&&n.jsxs("span",{className:"nice-pagination__info",children:[e," / ",a]}),p&&n.jsxs("span",{className:"nice-pagination__jump",style:{display:"inline-flex",alignItems:"center",gap:6,marginLeft:8},children:[n.jsx("span",{style:{fontSize:"0.85rem",color:"var(--text-secondary)"},children:h??"Go to"}),n.jsx(g.NiceNumberInput,{size:c==="lg"?"md":"sm",min:1,max:a,step:1,value:e,disabled:t,onChange:i=>{const u=typeof i=="number"?i:Number(i);if(!Number.isNaN(u)){const j=Math.max(1,Math.min(a,Math.floor(u)));l(j)}}})]}),m&&d&&d.length>0&&n.jsx("select",{className:"nice-pagination__size",value:x??d[0],disabled:t,onChange:i=>b?.(Number(i.target.value)),style:{marginLeft:8,padding:"4px 8px",border:"1px solid var(--border-color)",borderRadius:6,background:"var(--bg-primary)",color:"var(--text-primary)",font:"inherit",fontSize:"0.85rem"},"aria-label":"Rows per page",children:d.map(i=>n.jsxs("option",{value:i,children:[i," / page"]},i))})]})};exports.NicePagination=y;
