var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { DatePickerTranslations, Internationalization } from './../../constants/constants';
import { bindable, bindingMode, customElement } from "aurelia-framework";
import { I18N } from "aurelia-i18n";
import { isDisabled } from "./calendar-utils";
import { DateUtils } from '../../utils/date-utils';
import { UIRangePickerSelectionMode } from './ui-range-picker';
export var MonthsPage = (function () {
    function MonthsPage(i18n, dateUtils) {
        this.i18n = i18n;
        this.dateUtils = dateUtils;
        this.selection = UIRangePickerSelectionMode.Day;
        this.translations = Internationalization.datePickerTranslationsEN;
        this.isAttached = false;
    }
    MonthsPage.prototype.attached = function () {
        this.isAttached = true;
    };
    MonthsPage.prototype.getMonth = function (month) {
        var newDate = this.dateUtils.setMonths(this.date, month);
        var classes = [];
        if (this.config) {
            if (this.selection == UIRangePickerSelectionMode.MonthToMonth) {
                if (isArray(this.config.date)) {
                    if (this.dateUtils.isAfter(this.dateUtils.getStartOfDay(this.dateUtils.getStartOfMonth(newDate)), this.dateUtils.getStartOfDay(this.dateUtils.getStartOfMonth(this.config.date[0]))) &&
                        this.dateUtils.isBefore(this.dateUtils.getStartOfDay(this.dateUtils.getStartOfMonth(newDate)), this.dateUtils.getStartOfDay(this.dateUtils.getStartOfMonth(this.config.date[1])))) {
                        classes.push("select-hilight");
                    }
                    if (this.dateUtils.isSameMonth(this.config.date[0], newDate)) {
                        classes.push("select-start");
                    }
                    if (this.dateUtils.isSameMonth(this.config.date[1], newDate)) {
                        classes.push("select-end");
                    }
                }
            }
            else {
                if ((isDate(this.config.date) && this.dateUtils.isSameMonth(newDate, this.config.date)) ||
                    (isArray(this.config.date) && this.dateUtils.isSameMonth(newDate, this.config.date[0]))) {
                    classes.push("selected");
                }
            }
            if (isDisabled(__assign({ disabled: [] }, this.config), newDate, this.dateUtils)) {
                classes.push("disabled");
            }
        }
        return { date: newDate, classes: classes.join(" ") };
    };
    __decorate([
        bindable(),
        __metadata("design:type", Date)
    ], MonthsPage.prototype, "date", void 0);
    __decorate([
        bindable(),
        __metadata("design:type", Object)
    ], MonthsPage.prototype, "config", void 0);
    __decorate([
        bindable({ defaultBindingMode: bindingMode.oneTime }),
        __metadata("design:type", String)
    ], MonthsPage.prototype, "selection", void 0);
    __decorate([
        bindable(),
        __metadata("design:type", DatePickerTranslations)
    ], MonthsPage.prototype, "translations", void 0);
    MonthsPage = __decorate([
        customElement("months-page"),
        __metadata("design:paramtypes", [I18N, DateUtils])
    ], MonthsPage);
    return MonthsPage;
}());

//# sourceMappingURL=months-page.js.map
