/*
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";
/**
 * @hidden
 */
var UltraCalcFunctionSeriesSum = /** @class */ (function (_super) {
    tslib_1.__extends(UltraCalcFunctionSeriesSum, _super);
    function UltraCalcFunctionSeriesSum() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UltraCalcFunctionSeriesSum.prototype.evaluate = function (a, b) {
        var c = this._getArguments(a, b - 3, true);
        c.reverse();
        var d = a.pop();
        if (d.isError) {
            return new ExcelCalcValue(d.toErrorValue());
        }
        var e = d._toInt();
        d = a.pop();
        if (d.isError) {
            return new ExcelCalcValue(d.toErrorValue());
        }
        var f = d._toInt();
        d = a.pop();
        if (d.isError) {
            return new ExcelCalcValue(d.toErrorValue());
        }
        var g = d._toDouble3();
        var h = f;
        var i = 0;
        for (var k = 0; k < c.length; k++) {
            var j = c[k];
            if (j.isError) {
                return new ExcelCalcValue(j.toErrorValue());
            }
            var l = j._toDouble3();
            var m = l * Math.pow(g, h);
            i += m;
            h += e;
        }
        return new ExcelCalcValue(i);
    };
    UltraCalcFunctionSeriesSum.prototype.canParameterBeEnumerable = function (a) {
        return a == 3;
    };
    UltraCalcFunctionSeriesSum.prototype.get_name = function () {
        return "seriessum";
    };
    Object.defineProperty(UltraCalcFunctionSeriesSum.prototype, "name", {
        get: function () {
            return this.get_name();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionSeriesSum.prototype.get_minArgs = function () {
        return 4;
    };
    Object.defineProperty(UltraCalcFunctionSeriesSum.prototype, "minArgs", {
        get: function () {
            return this.get_minArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionSeriesSum.prototype.get_maxArgs = function () {
        return 4;
    };
    Object.defineProperty(UltraCalcFunctionSeriesSum.prototype, "maxArgs", {
        get: function () {
            return this.get_maxArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionSeriesSum.prototype.doesParameterAllowIntermediateResultArray = function (a, b) {
        return (b == false);
    };
    UltraCalcFunctionSeriesSum.$t = markType(UltraCalcFunctionSeriesSum, 'UltraCalcFunctionSeriesSum', BuiltInFunctionBase.$);
    return UltraCalcFunctionSeriesSum;
}(BuiltInFunctionBase));
export { UltraCalcFunctionSeriesSum };
//# sourceMappingURL=UltraCalcFunctionSeriesSum.js.map