/*
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 { BuiltInFunctionBase } from "./BuiltInFunctionBase";
import { ExcelCalcValue } from "./ExcelCalcValue";
import { markType } from "igniteui-angular-core";
import { ExcelCalcErrorValue } from "./ExcelCalcErrorValue";
import { nullableIsNull } from "igniteui-angular-core";
/**
 * @hidden
 */
var UltraCalcFunctionDays = /** @class */ (function (_super) {
    tslib_1.__extends(UltraCalcFunctionDays, _super);
    function UltraCalcFunctionDays() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UltraCalcFunctionDays.prototype.evaluate = function (a, b) {
        var c = a.pop();
        var d = a.pop();
        var e, f;
        if (d.isString) {
            var g_1;
            if (((function () { var h = d._aj(d._a0, g_1); g_1 = h.p1; return h.ret; })()) == false) {
                return new ExcelCalcValue(new ExcelCalcErrorValue(1));
            }
            e = ((function (h) { return !nullableIsNull(h) ? h.value : -1; })(ExcelCalcValue._dateTimeToExcelDate(d._o, g_1)));
        }
        else {
            e = d._toDouble3();
        }
        if (c.isString) {
            var h_1;
            if (((function () { var i = c._aj(c._a0, h_1); h_1 = i.p1; return i.ret; })()) == false) {
                return new ExcelCalcValue(new ExcelCalcErrorValue(1));
            }
            f = ((function (i) { return !nullableIsNull(i) ? i.value : -1; })(ExcelCalcValue._dateTimeToExcelDate(c._o, h_1)));
        }
        else {
            f = c._toDouble3();
        }
        var i = 2958466;
        if (f < 0 || f >= i || e < 0 || e >= i) {
            return new ExcelCalcValue(new ExcelCalcErrorValue(4));
        }
        var j = Math.floor(e) - Math.floor(f);
        return new ExcelCalcValue(j);
    };
    UltraCalcFunctionDays.prototype.get_maxArgs = function () {
        return 2;
    };
    Object.defineProperty(UltraCalcFunctionDays.prototype, "maxArgs", {
        get: function () {
            return this.get_maxArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionDays.prototype.get_minArgs = function () {
        return 2;
    };
    Object.defineProperty(UltraCalcFunctionDays.prototype, "minArgs", {
        get: function () {
            return this.get_minArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionDays.prototype.get_name = function () {
        return "days";
    };
    Object.defineProperty(UltraCalcFunctionDays.prototype, "name", {
        get: function () {
            return this.get_name();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionDays.$t = markType(UltraCalcFunctionDays, 'UltraCalcFunctionDays', BuiltInFunctionBase.$);
    return UltraCalcFunctionDays;
}(BuiltInFunctionBase));
export { UltraCalcFunctionDays };
//# sourceMappingURL=UltraCalcFunctionDays.js.map