"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "useYears", {
    enumerable: true,
    get: function() {
        return useYears;
    }
});
const _react = require("react");
const _utils = require("../utils");
const _types = require("../store/types");
const useYears = ({ date, value, startYear, eventList, disabledList, min, max, includeEdgeDates })=>(0, _react.useMemo)(()=>{
        // type-coverage:ignore-next-line
        const years = Array.from(Array(_utils.YEAR_RENDER_COUNT), (_, i)=>{
            const yearValue = startYear + i;
            return {
                isCurrent: (0, _utils.isCurrentYear)(startYear + i),
                isSelected: Array.isArray(value) ? Boolean(value.find((v)=>(0, _utils.isSelectedYear)(yearValue, v))) : (0, _utils.isSelectedYear)(yearValue, value),
                inRange: Array.isArray(value) ? (0, _utils.isDateInRange)(yearValue, 0, 1, value) : false,
                date: {
                    year: yearValue,
                    monthIndex: 0,
                    day: 1
                },
                yearValue
            };
        });
        if (eventList?.length || disabledList?.length || max || min) {
            const modifiedMonths = (0, _utils.getDatesWithModifications)({
                dates: years,
                type: _types.CalendarState.Years,
                min,
                max,
                includeEdgeDates,
                eventList,
                disabledList
            });
            return (0, _utils.getMatrix)(modifiedMonths, 3);
        }
        return (0, _utils.getMatrix)(years, 3);
    }, [
        date,
        startYear,
        value,
        eventList,
        disabledList,
        max,
        min
    ]);
