"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    getCurrentPagesRange: ()=>getCurrentPagesRange
});
const minimumPage = 0;
function getCurrentPagesRange(page, desiredNumberOfPages, maxPage) {
    let range = buildRange(page, desiredNumberOfPages);
    range = shiftRightIfNeeded(range);
    range = shiftLeftIfNeeded(range, maxPage);
    return buildCurrentPages(range);
}
function buildRange(page, desiredNumberOfPages) {
    const isEven = desiredNumberOfPages % 2 === 0;
    const leftCapacity = Math.floor(desiredNumberOfPages / 2);
    const rightCapacity = isEven ? leftCapacity - 1 : leftCapacity;
    const start = page - leftCapacity;
    const end = page + rightCapacity;
    return {
        start,
        end
    };
}
function shiftRightIfNeeded(range) {
    const leftExcess = Math.max(minimumPage - range.start, 0);
    const start = range.start + leftExcess;
    const end = range.end + leftExcess;
    return {
        start,
        end
    };
}
function shiftLeftIfNeeded(range, maxPage) {
    const rightExcess = Math.max(range.end - maxPage, 0);
    const start = Math.max(range.start - rightExcess, minimumPage);
    const end = range.end - rightExcess;
    return {
        start,
        end
    };
}
function buildCurrentPages(range) {
    const currentPages = [];
    for(let counter = range.start; counter <= range.end; ++counter)currentPages.push(counter);
    return currentPages;
}
exports.getCurrentPagesRange = __webpack_exports__.getCurrentPagesRange;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "getCurrentPagesRange"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
