import { useMemo as a } from "../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import d from "./usePagination.js";
import { isString as i, isUndefined as f } from "../../../../utils/value/is.js";
const C = (n) => i(n.next), h = (n) => i(n.prev), S = (n, u) => {
  const c = a(() => {
    const e = [], P = () => e.length, g = () => {
      e.length = 0;
    }, m = (t) => ({ cursor: e[t - 1] }), s = (t, r) => {
      const o = e[r - 1];
      (r === 1 || r === (e.length || 1) + 1) && f(o) && (e[r - 1] = t ? decodeURIComponent(t) : void 0);
    };
    return { getPageCount: P, getPageParams: m, resetPageCount: g, updatePagination: (t, r, o) => {
      C(o) && s(o.next, t + 1), h(o) && s(o.prev, t - 1);
    } };
  }, []);
  return d(c, n, u);
};
export {
  S as default,
  C as hasNextPage,
  h as hasPrevPage
};
