/*
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 { CalcFunctionUtilities } from "./CalcFunctionUtilities";
import { ExcelCalcErrorValue } from "./ExcelCalcErrorValue";
import { markType } from "igniteui-angular-core";
import { tryParseBool } from "igniteui-angular-core";
/**
 * @hidden
 */
var UltraCalcFunctionXor = /** @class */ (function (_super) {
    tslib_1.__extends(UltraCalcFunctionXor, _super);
    function UltraCalcFunctionXor() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UltraCalcFunctionXor.prototype.evaluate = function (a, b) {
        var c = 0;
        var d = CalcFunctionUtilities.p(b);
        try {
            this._ad(d, a, b, true);
            if (d.count == 0) {
                return new ExcelCalcValue(new ExcelCalcErrorValue(1));
            }
            var _loop_1 = function (e) {
                var f = d._inner[e];
                if (f.isError) {
                    return { value: new ExcelCalcValue(f.toErrorValue()) };
                }
                var g;
                if (f.isString) {
                    if (!((function () { var h = tryParseBool(f.toString(), g); g = h.p1; return h.ret; })())) {
                        return { value: new ExcelCalcValue(new ExcelCalcErrorValue(1)) };
                    }
                }
                else {
                    g = f._toBoolean1();
                }
                if (g) {
                    c++;
                }
            };
            for (var e = 0; e < d.count; e++) {
                var state_1 = _loop_1(e);
                if (typeof state_1 === "object")
                    return state_1.value;
            }
            return new ExcelCalcValue(c % 2 == 0 ? false : true);
        }
        finally {
            CalcFunctionUtilities.ad(d);
        }
    };
    UltraCalcFunctionXor.prototype.get_maxArgs = function () {
        return 0x7FFFFFFF;
    };
    Object.defineProperty(UltraCalcFunctionXor.prototype, "maxArgs", {
        get: function () {
            return this.get_maxArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionXor.prototype.get_minArgs = function () {
        return 1;
    };
    Object.defineProperty(UltraCalcFunctionXor.prototype, "minArgs", {
        get: function () {
            return this.get_minArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionXor.prototype.get_name = function () {
        return "xor";
    };
    Object.defineProperty(UltraCalcFunctionXor.prototype, "name", {
        get: function () {
            return this.get_name();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionXor.prototype.doesParameterAllowIntermediateResultArray = function (a, b) {
        return (b == false);
    };
    UltraCalcFunctionXor.$t = markType(UltraCalcFunctionXor, 'UltraCalcFunctionXor', BuiltInFunctionBase.$);
    return UltraCalcFunctionXor;
}(BuiltInFunctionBase));
export { UltraCalcFunctionXor };
//# sourceMappingURL=UltraCalcFunctionXor.js.map