/*
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 { 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
 */
export let UltraCalcFunctionXor = /*@__PURE__*/ (() => {
    class UltraCalcFunctionXor extends BuiltInFunctionBase {
        evaluate(a, b) {
            let c = 0;
            let d = CalcFunctionUtilities.p(b);
            try {
                this._ad(d, a, b, true);
                if (d.count == 0) {
                    return new ExcelCalcValue(new ExcelCalcErrorValue(1));
                }
                for (let e = 0; e < d.count; e++) {
                    let f = d._inner[e];
                    if (f.isError) {
                        return new ExcelCalcValue(f.toErrorValue());
                    }
                    let g;
                    if (f.isString) {
                        if (!((() => { let h = tryParseBool(f.toString(), g); g = h.p1; return h.ret; })())) {
                            return new ExcelCalcValue(new ExcelCalcErrorValue(1));
                        }
                    }
                    else {
                        g = f._toBoolean1();
                    }
                    if (g) {
                        c++;
                    }
                }
                return new ExcelCalcValue(c % 2 == 0 ? false : true);
            }
            finally {
                CalcFunctionUtilities.ad(d);
            }
        }
        get_maxArgs() {
            return 0x7FFFFFFF;
        }
        get maxArgs() {
            return this.get_maxArgs();
        }
        get_minArgs() {
            return 1;
        }
        get minArgs() {
            return this.get_minArgs();
        }
        get_name() {
            return "xor";
        }
        get name() {
            return this.get_name();
        }
        doesParameterAllowIntermediateResultArray(a, b) {
            return (b == false);
        }
    }
    UltraCalcFunctionXor.$t = markType(UltraCalcFunctionXor, 'UltraCalcFunctionXor', BuiltInFunctionBase.$);
    return UltraCalcFunctionXor;
})();
