"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "useQuarters", {
    enumerable: true,
    get: function() {
        return useQuarters;
    }
});
var _react = require("react");
var _utils = require("../utils");
var _types = require("../store/types");
var useQuarters = function useQuarters(param) {
    var date = param.date, value = param.value, eventList = param.eventList, disabledList = param.disabledList, min = param.min, max = param.max, includeEdgeDates = param.includeEdgeDates;
    return (0, _react.useMemo)(function() {
        var quarters = _utils.QUARTER_NAMES.map(function(quarterName) {
            var _quarterDates_quarterName = _utils.quarterDates[quarterName], monthIndex = _quarterDates_quarterName.monthIndex, day = _quarterDates_quarterName.day;
            return {
                quarterName: quarterName,
                isCurrent: (0, _utils.isCurrentQuarter)(date, monthIndex),
                isSelected: Array.isArray(value) ? Boolean(value.find(function(v) {
                    return (0, _utils.isSelectedMonth)(date, monthIndex, v);
                })) : (0, _utils.isSelectedMonth)(date, monthIndex, value),
                inRange: Array.isArray(value) ? (0, _utils.isDateInRange)(date.year, monthIndex, day, value) : false,
                date: {
                    year: date.year,
                    monthIndex: monthIndex,
                    day: 1
                }
            };
        });
        if ((eventList === null || eventList === void 0 ? void 0 : eventList.length) || (disabledList === null || disabledList === void 0 ? void 0 : disabledList.length) || max || min) {
            var modifiedQuarters = (0, _utils.getDatesWithModifications)({
                dates: quarters,
                type: _types.CalendarState.Quarters,
                min: min,
                max: max,
                includeEdgeDates: includeEdgeDates,
                eventList: eventList,
                disabledList: disabledList
            });
            return (0, _utils.getMatrix)(modifiedQuarters, 2);
        }
        return (0, _utils.getMatrix)(quarters, 2);
    }, [
        date,
        value,
        eventList,
        disabledList,
        max,
        min
    ]);
};
