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