'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@gem-sdk/core"),t=require("react");exports.default=({className:p,setting:l={},style:g})=>{let{defaultCurrent:i=1,total:o=0,pageSize:s=10,align:c,disabled:d=!1}=l,[f,a]=t.useState([]),[n,h]=t.useState(i),u=Math.ceil(o/s);t.useEffect(()=>{h(i)},[i]);let x=e=>{d||h(e)},b=()=>{d||(n<u-5?h(n+5):h(u))},v=()=>{d||(n-5>1?h(n-5):h(1))};return t.useEffect(()=>{let e=[];if(o)for(let r=1;r<u;r++)if(n<=4){if(r<=4)e.push(r);else{3===e.indexOf(n)&&e.push(r),e.push("shortcutNext",u);break}}else if(n>=u-3){if(r<=4)e.unshift(u-r);else{e.unshift(1,"shortcutPrev"),e.push(u);break}}else{e.push(r,"shortcutPrev",n-1,n,n+1,"shortcutNext",u);break}a([...e])},[n,u,o,s]),e.jsx("div",{className:r.cls("gp-w-full",{"gp-text-right":c?.desktop==="right","tablet:gp-text-right":c?.tablet==="right","mobile:gp-text-right":c?.mobile==="right","gp-text-left":c?.desktop==="left","tablet:gp-text-left":c?.tablet==="left","mobile:gp-text-left":c?.mobile==="left","gp-text-center":c?.desktop==="center","tablet:gp-text-center":c?.tablet==="center","mobile:gp-text-center":c?.mobile==="center"}),children:e.jsxs("div",{className:r.cls("inline-flex",p),style:g,children:[e.jsx("div",{className:r.cls("gp-mr-[4px] gp-flex gp-h-8 gp-w-8 gp-select-none gp-items-center gp-justify-center gp-rounded-[2px] gp-border gp-border-solid gp-border-[#d9d9d9] gp-transition-all hover:gp-border-[#40a9ff] hover:gp-fill-[#40a9ff]",{"gp-cursor-pointer":1!==n&&!d,"gp-cursor-not-allowed gp-fill-[#00000040] hover:gp-border-[#d9d9d9] hover:gp-fill-[#00000040]":1===n,"gp-cursor-not-allowed gp-bg-[#f5f5f5] gp-fill-[#cfcfcf] hover:gp-border-[#d9d9d9] hover:gp-fill-[#cfcfcf]":d}),onClick:()=>{!d&&n>1&&h(n-1)},"aria-hidden":"true","data-testid":"prev",children:e.jsx("svg",{className:"gp-h-3 gp-w-3",viewBox:"64 64 896 896","aria-hidden":"true",children:e.jsx("path",{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"})})}),f.map((t,p)=>{if(t)return"shortcutNext"===t?e.jsx("div",{className:r.cls("gp-mx-[4px] gp-flex gp-h-8 gp-w-8 gp-items-center gp-justify-center gp-tracking-[2px] gp-transition-all",{"gp-cursor-pointer":!d,"gp-cursor-not-allowed gp-text-[#00000040]":d}),onClick:b,"aria-hidden":"true",children:"..."},p):"shortcutPrev"===t?e.jsx("div",{className:r.cls("gp-mx-[4px] gp-flex gp-h-8 gp-w-8 gp-items-center gp-justify-center gp-tracking-[2px] gp-transition-all",{"gp-cursor-pointer":!d,"gp-cursor-not-allowed gp-text-[#00000040]":d}),onClick:v,"aria-hidden":"true",children:"..."},p):e.jsx("div",{className:r.cls("gp-mx-[4px] gp-flex gp-h-8 gp-w-8 gp-select-none gp-items-center gp-justify-center gp-rounded-[2px] gp-border gp-border-solid gp-border-[#d9d9d9] gp-transition-all hover:gp-border-[#40a9ff] hover:gp-text-[#40a9ff]",{"gp-cursor-pointer":!d,"gp-border-[#1890ff] gp-text-[#1890ff]":n===t&&!d,"gp-cursor-not-allowed gp-bg-[#f5f5f5] gp-text-[#cfcfcf] hover:gp-border-[#d9d9d9] hover:gp-text-[#cfcfcf]":d}),onClick:()=>x(t),"aria-hidden":"true",children:t},p)}),e.jsx("div",{className:r.cls("gp-ml-[4px] gp-flex gp-h-8 gp-w-8 gp-select-none gp-items-center gp-justify-center gp-rounded-[2px] gp-border gp-border-solid gp-border-[#d9d9d9] gp-transition-all hover:gp-border-[#40a9ff] hover:gp-fill-[#40a9ff]",{"gp-cursor-pointer":n!==u&&!d,"gp-cursor-not-allowed gp-fill-[#00000040] hover:gp-border-[#d9d9d9] hover:gp-fill-[#00000040]":n===u,"gp-cursor-not-allowed gp-bg-[#f5f5f5] gp-fill-[#cfcfcf] hover:gp-border-[#d9d9d9] hover:gp-fill-[#cfcfcf]":d}),onClick:()=>{!d&&n<u&&h(n+1)},"aria-hidden":"true","data-testid":"next",children:e.jsx("svg",{className:"gp-h-3 gp-w-3",viewBox:"64 64 896 896","aria-hidden":"true",children:e.jsx("path",{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"})})})]})})};
