/*
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 { StringBuilder } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { fromEn, markType } from "igniteui-angular-core";
/**
 * @hidden
 */
var UltraCalcFunctionConcatenate = /** @class */ (function (_super) {
    tslib_1.__extends(UltraCalcFunctionConcatenate, _super);
    function UltraCalcFunctionConcatenate() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UltraCalcFunctionConcatenate.prototype.evaluate = function (a, b) {
        var e_1, _a;
        var c = new StringBuilder(0);
        var d = new List$1(ExcelCalcValue.$, 0);
        for (var e = 0; e < b; e++) {
            d.add(a.pop());
        }
        for (var f = d.count; f > 0; f--) {
            var g = d._inner[f - 1];
            if (!true && g.isReference && g.toReference().isEnumerable) {
                var h = g.toReference().references;
                try {
                    for (var _b = (e_1 = void 0, tslib_1.__values(fromEn(h))), _c = _b.next(); !_c.done; _c = _b.next()) {
                        var i = _c.value;
                        if (i.value.isError) {
                            return new ExcelCalcValue(i.value.toErrorValue());
                        }
                        c.l(i.value.toString());
                    }
                }
                catch (e_1_1) { e_1 = { error: e_1_1 }; }
                finally {
                    try {
                        if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
                    }
                    finally { if (e_1) throw e_1.error; }
                }
            }
            else {
                if (g.isError) {
                    return new ExcelCalcValue(g.toErrorValue());
                }
                c.l(g.toString());
            }
        }
        return new ExcelCalcValue(c.toString());
    };
    UltraCalcFunctionConcatenate.prototype.canParameterBeEnumerable = function (a) {
        return true;
    };
    UltraCalcFunctionConcatenate.prototype.get_name = function () {
        return "concatenate";
    };
    Object.defineProperty(UltraCalcFunctionConcatenate.prototype, "name", {
        get: function () {
            return this.get_name();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionConcatenate.prototype.get_minArgs = function () {
        return 1;
    };
    Object.defineProperty(UltraCalcFunctionConcatenate.prototype, "minArgs", {
        get: function () {
            return this.get_minArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionConcatenate.prototype.get_maxArgs = function () {
        return 0x7FFFFFFF;
    };
    Object.defineProperty(UltraCalcFunctionConcatenate.prototype, "maxArgs", {
        get: function () {
            return this.get_maxArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionConcatenate.prototype.doesParameterAllowIntermediateResultArray = function (a, b) {
        return true;
    };
    UltraCalcFunctionConcatenate.$t = markType(UltraCalcFunctionConcatenate, 'UltraCalcFunctionConcatenate', BuiltInFunctionBase.$);
    return UltraCalcFunctionConcatenate;
}(BuiltInFunctionBase));
export { UltraCalcFunctionConcatenate };
//# sourceMappingURL=UltraCalcFunctionConcatenate.js.map