"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculateDotNumber = void 0;
// eslint-disable-next-line import/prefer-default-export
exports.calculateDotNumber = (noOfPage, currentPage, noOfDots = 7) => {
    let leftDots = 0;
    let rightDots = 0;
    const middlePointOfDots = Math.ceil(noOfDots / 2);
    if (currentPage > middlePointOfDots - 1 && !(currentPage + (middlePointOfDots - 1) > noOfPage)) {
        leftDots = currentPage - (middlePointOfDots - 1);
    }
    else if (currentPage + (middlePointOfDots - 1) > noOfPage) {
        leftDots = currentPage - ((middlePointOfDots - (noOfPage - currentPage)) + 2);
    }
    if (currentPage < middlePointOfDots) {
        rightDots = noOfPage - (middlePointOfDots + 1);
    }
    else if (currentPage >= middlePointOfDots
        && currentPage + (middlePointOfDots - 1) <= noOfPage) {
        rightDots = noOfPage - (currentPage + (middlePointOfDots - 1));
    }
    return {
        left: leftDots,
        right: rightDots,
    };
};
//# sourceMappingURL=pagination.js.map