/*
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 { ExcelCalcErrorValue } from "./ExcelCalcErrorValue";
import { typeCast, markType } from "igniteui-angular-core";
import { CellCalcReference } from "./CellCalcReference";
import { WorksheetRegion } from "./WorksheetRegion";
import { ReadOnlyCollection$1 } from "igniteui-angular-core";
import { TempCellCalcReference } from "./TempCellCalcReference";
import { ExcelCalcEngine } from "./ExcelCalcEngine";
/**
 * @hidden
 */
var UltraCalcFunctionColumn = /** @class */ (function (_super) {
    tslib_1.__extends(UltraCalcFunctionColumn, _super);
    function UltraCalcFunctionColumn() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UltraCalcFunctionColumn.prototype.evaluate = function (a, b) {
        var c;
        if (b == 0) {
            c = UltraCalcFunctionColumn._ak(a._k);
        }
        else {
            var d = a.pop();
            if (d.isReference == false) {
                if (d.isError) {
                    return d;
                }
                return new ExcelCalcValue(new ExcelCalcErrorValue(1));
            }
            c = UltraCalcFunctionColumn._ak(d.toReference());
        }
        if (c == -1) {
            return new ExcelCalcValue(new ExcelCalcErrorValue(0));
        }
        return new ExcelCalcValue(c);
    };
    UltraCalcFunctionColumn._ak = function (a) {
        var b = ExcelCalcEngine.u(a);
        var c = typeCast(CellCalcReference.$, b);
        if (c != null) {
            return c._ao + 1;
        }
        var d = typeCast(WorksheetRegion.$, b);
        if (d != null) {
            return d.firstColumn + 1;
        }
        var e = typeCast(ReadOnlyCollection$1.$.specialize(WorksheetRegion.$), b);
        if (e != null) {
            if (e.count != 1) {
                return -1;
            }
            return e.item(0).firstColumn + 1;
        }
        var f = typeCast(TempCellCalcReference.$, b);
        if (f != null) {
            return f._ao + 1;
        }
        return -1;
    };
    UltraCalcFunctionColumn.prototype.get_name = function () {
        return "column";
    };
    Object.defineProperty(UltraCalcFunctionColumn.prototype, "name", {
        get: function () {
            return this.get_name();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionColumn.prototype.get_minArgs = function () {
        return 0;
    };
    Object.defineProperty(UltraCalcFunctionColumn.prototype, "minArgs", {
        get: function () {
            return this.get_minArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionColumn.prototype.get_maxArgs = function () {
        return 1;
    };
    Object.defineProperty(UltraCalcFunctionColumn.prototype, "maxArgs", {
        get: function () {
            return this.get_maxArgs();
        },
        enumerable: true,
        configurable: true
    });
    UltraCalcFunctionColumn.prototype._v = function (a) {
        return false;
    };
    UltraCalcFunctionColumn.$t = markType(UltraCalcFunctionColumn, 'UltraCalcFunctionColumn', BuiltInFunctionBase.$);
    return UltraCalcFunctionColumn;
}(BuiltInFunctionBase));
export { UltraCalcFunctionColumn };
//# sourceMappingURL=UltraCalcFunctionColumn.js.map