/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import * as tslib_1 from "tslib";
import { Calendar } from "igniteui-angular-core";
import { callStaticConstructors, markType } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { CalendarEraInfo } from "./CalendarEraInfo";
import { ArgumentException } from "igniteui-angular-core";
import { ArgumentOutOfRangeException } from "igniteui-angular-core";
import { dateFromValues } from "igniteui-angular-core";
/**
 * @hidden
 */
var JapaneseCalendar = /** @class */ (function (_super) {
    tslib_1.__extends(JapaneseCalendar, _super);
    function JapaneseCalendar() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    JapaneseCalendar.staticInit = function () {
        JapaneseCalendar._l = [4, 3, 2, 1];
        var a = new List$1(CalendarEraInfo.$, 0);
        a.add(new CalendarEraInfo(5, 2019, 5, 1, 2018, 1, 7981, "令和", "令", "R"));
        a.add(new CalendarEraInfo(4, 1989, 1, 8, 1988, 1, 31, "平成", "平", "H"));
        a.add(new CalendarEraInfo(3, 1926, 12, 25, 1925, 1, 64, "昭和", "昭", "S"));
        a.add(new CalendarEraInfo(2, 1912, 7, 30, 1911, 1, 15, "大正", "大", "T"));
        a.add(new CalendarEraInfo(1, 1868, 1, 1, 1867, 1, 45, "明治", "明", "M"));
        JapaneseCalendar._k = a.toArray();
    };
    JapaneseCalendar.prototype._getEraInfo = function (a) {
        var b = CalendarEraInfo.c(JapaneseCalendar._k, a);
        return b < 0 ? null : JapaneseCalendar._k[b];
    };
    JapaneseCalendar.prototype.get_eras = function () {
        return JapaneseCalendar._l;
    };
    JapaneseCalendar.prototype.addMonths = function (a, b) {
        var c = _super.prototype.addMonths.call(this, a, b);
        if (c < JapaneseCalendar._m) {
            throw new ArgumentException(0);
        }
        return c;
    };
    JapaneseCalendar.prototype.addYears = function (a, b) {
        var c = _super.prototype.addYears.call(this, a, b);
        if (c < JapaneseCalendar._m) {
            throw new ArgumentException(0);
        }
        return c;
    };
    JapaneseCalendar.prototype.getDaysInMonth = function (a, b, c) {
        var d = CalendarEraInfo.d(JapaneseCalendar._k, a, c);
        return _super.prototype.getDaysInMonth.call(this, d, b, 0);
    };
    JapaneseCalendar.prototype.getDaysInYear = function (a, b) {
        var c = CalendarEraInfo.d(JapaneseCalendar._k, a, b);
        return c % 4 != 0 || (c % 100 == 0 && c % 400 != 0) ? 365 : 366;
    };
    JapaneseCalendar.prototype.getEra = function (a) {
        for (var b = 0; b < JapaneseCalendar._k.length; b++) {
            if (JapaneseCalendar._k[b].a <= a) {
                return JapaneseCalendar._k[b].b;
            }
        }
        throw new ArgumentOutOfRangeException(0);
    };
    JapaneseCalendar.prototype.getYear = function (a) {
        for (var b = 0; b < JapaneseCalendar._k.length; b++) {
            if (JapaneseCalendar._k[b].a <= a) {
                return _super.prototype.getYear.call(this, a) - JapaneseCalendar._k[b].e;
            }
        }
        throw new ArgumentOutOfRangeException(0);
    };
    JapaneseCalendar.prototype.toDateTime = function (a, b, c, d, e, f, g, h) {
        var i = CalendarEraInfo.d(JapaneseCalendar._k, a, h);
        var j = dateFromValues(i, b, c, d, e, f, g);
        if (j < JapaneseCalendar._m) {
            throw new ArgumentOutOfRangeException(0);
        }
        return j;
    };
    JapaneseCalendar.$t = markType(JapaneseCalendar, 'JapaneseCalendar', Calendar.$);
    JapaneseCalendar._l = null;
    JapaneseCalendar._k = null;
    JapaneseCalendar._m = dateFromValues(1868, 9, 8, 0, 0, 0, 0);
    return JapaneseCalendar;
}(Calendar));
export { JapaneseCalendar };
(function (v) { callStaticConstructors(); })(true);
//# sourceMappingURL=JapaneseCalendar.js.map