/*
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 { RefBase } from "./RefBase";
import { typeCast, markType } from "igniteui-angular-core";
import { ExcelCalcEngine } from "./ExcelCalcEngine";
import { ExcelReferenceError } from "./ExcelReferenceError";
import { CalcUtilities } from "./CalcUtilities";
/**
 * @hidden
 */
export class UltraCalcFunctionIndirect extends BuiltInFunctionBase {
    evaluate(a, b) {
        let c = null;
        if (b == 2) {
            c = a.pop();
        }
        let d = a.pop();
        if (d.isError) {
            return d;
        }
        if (c != null && c.isError) {
            return c;
        }
        let e = d.toString();
        let f = c == null ? true : c._toBoolean1();
        let g = f ? 1 : 0;
        let h = typeCast(RefBase.$, ExcelCalcEngine.b(a._k));
        if (h == null) {
            return new ExcelCalcValue(ExcelReferenceError._a2);
        }
        let i = CalcUtilities.f(e, h._w, h._ao, h._u, h._t, g);
        return new ExcelCalcValue(i);
    }
    get_name() {
        return "indirect";
    }
    get name() {
        return this.get_name();
    }
    get_minArgs() {
        return 1;
    }
    get minArgs() {
        return this.get_minArgs();
    }
    get_maxArgs() {
        return 2;
    }
    get maxArgs() {
        return this.get_maxArgs();
    }
}
UltraCalcFunctionIndirect.$t = markType(UltraCalcFunctionIndirect, 'UltraCalcFunctionIndirect', BuiltInFunctionBase.$);
//# sourceMappingURL=UltraCalcFunctionIndirect.js.map