"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useLogic = void 0;
const usePagination_1 = __importDefault(require("@mui/material/usePagination"));
const useViewportType_1 = require("../../useViewportType");
const useLogic = ({ count = 1, page, onChange, siblingCount = 1, ...restProps }) => {
    const { isMobile } = (0, useViewportType_1.useViewportType)();
    const { items } = (0, usePagination_1.default)({
        count,
        page,
        siblingCount: isMobile ? 0 : siblingCount,
    });
    const onItemClick = (itemPage, onClick, event) => {
        if (onChange && itemPage) {
            onChange({}, itemPage);
        }
        onClick(event);
    };
    return { onItemClick, items, restProps };
};
exports.useLogic = useLogic;
