"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("vue"),d=require("../../_util/extendsObject.js"),P=require("../../_util/hooks/useState.js"),v=10;function S(n,e){const r={current:n.current,pageSize:n.pageSize};return Object.keys(e&&typeof e=="object"?e:{}).forEach(l=>{const o=n[l];typeof o!="function"&&(r[l]=o)}),r}function m(n,e,r){const a=c.computed(()=>e.value&&typeof e.value=="object"?e.value:{}),l=c.computed(()=>a.value.total||0),[o,f]=P.default(()=>({current:"defaultCurrent"in a.value?a.value.defaultCurrent:1,pageSize:"defaultPageSize"in a.value?a.value.defaultPageSize:v})),i=c.computed(()=>{const t=d.default(o.value,a.value,{total:l.value>0?l.value:n.value}),u=Math.ceil((l.value||n.value)/t.pageSize);return t.current>u&&(t.current=u||1),t}),s=(t,u)=>{e.value!==!1&&f({current:t??1,pageSize:u||i.value.pageSize})},g=(t,u)=>{e.value&&a.value.onChange?.(t,u),s(t,u),r(t,u||i.value.pageSize)};return[c.computed(()=>e.value===!1?{}:{...i.value,onChange:g}),s]}exports.DEFAULT_PAGE_SIZE=v;exports.default=m;exports.getPaginationParam=S;
