/*
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 { HorizontalAnchoredCategorySeries } from "./HorizontalAnchoredCategorySeries";
import { IIsCategoryBased_$type } from "./IIsCategoryBased";
import { CategoryLineRasterizer } from "./CategoryLineRasterizer";
import { typeCast, Array_$type, runOn, markType } from "igniteui-angular-core";
import { ISortingAxis_$type } from "./ISortingAxis";
import { List$1 } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { intDivide, isNaN_ } from "igniteui-angular-core";
import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView";
/**
 * @hidden
 */
var StepAreaSeries = /** @class */ (function (_super) {
    tslib_1.__extends(StepAreaSeries, _super);
    function StepAreaSeries() {
        var _this = _super.call(this) || this;
        _this.qh = null;
        _this.qh = new CategoryLineRasterizer();
        _this.ab = StepAreaSeries.$;
        return _this;
    }
    StepAreaSeries.prototype.bf = function () {
        return new StepAreaSeriesView(this);
    };
    StepAreaSeries.prototype.getHostReferenceValue = function () {
        return this.eh();
    };
    StepAreaSeries.prototype.iu = function (a) {
        _super.prototype.iu.call(this, a);
        this.qi = a;
    };
    StepAreaSeries.prototype.get_ck = function () {
        return true;
    };
    StepAreaSeries.prototype.preferredCategoryMode = function (a) {
        return typeCast(ISortingAxis_$type, a) !== null ? 0 : 1;
    };
    StepAreaSeries.prototype.hv = function (a, b) {
        _super.prototype.hv.call(this, a, b);
        var c = b;
        c.c7();
    };
    StepAreaSeries.prototype.qj = function (a, b, c, d, e) {
        if (b) {
            if (e) {
                if ((a & 1) == 0 || ((intDivide(a, 2)) + 1) >= c.f.count) {
                    return c.f._inner[(intDivide(a, 2))][0];
                }
                return c.f._inner[(intDivide(a, 2)) + 1][0];
            }
            return c.f._inner[(intDivide(a, 2))][0] + ((a & 1) == 1 ? -d : d);
        }
        if (e) {
            if ((a & 1) == 0 || ((intDivide(a, 2)) + 1) >= c.f.count) {
                return c.f._inner[(intDivide(a, 2))][0];
            }
            return c.f._inner[(intDivide(a, 2)) + 1][0];
        }
        return c.f._inner[(intDivide(a, 2))][0] + ((a & 1) == 0 ? -d : d);
    };
    StepAreaSeries.prototype.ng = function () {
        return 1;
    };
    StepAreaSeries.prototype.ef = function (a, b, c, d, e, f, g, h) {
        var i = NaN;
        if (c >= 0 && c < b.count) {
            i = b.item(c);
        }
        var j = NaN;
        if (d >= 0 && d < b.count) {
            j = b.item(d);
        }
        if (f == 0) {
            return j;
        }
        if (e == b.count - 1) {
            return i;
        }
        if (isNaN_(j) && g != 0 && a <= 0.5 && !h) {
            return i;
        }
        if (isNaN_(i) && g != 0 && a >= 0.5 && !h) {
            return j;
        }
        if (a > 0.5) {
            return j;
        }
        return i;
    };
    StepAreaSeries.prototype.bd = function () {
        if (this.be == 0) {
            return 2;
        }
        else {
            return _super.prototype.bd.call(this);
        }
    };
    StepAreaSeries.prototype.oo = function (a, b) {
        var _this = this;
        _super.prototype.oo.call(this, a, b);
        var c = b.bs;
        var d = b.br;
        var e = this.getEffectiveViewport1(b);
        var f = typeCast(ISortingAxis_$type, this.py) != null;
        var g = this.py != null ? 0.5 * this.py.getCategorySize(c, d, e) : 0;
        if (this.py != null && this.py.b8) {
            g = -g;
        }
        var h = a.f.count * 2;
        var i = new List$1(Array_$type, 2, h);
        this.ne.x(this, this.nz(), this.py, runOn(this, this.m0), this.n7(b), this.n8(b));
        var j = false;
        var k = this.ne.c;
        if (k != null) {
            j = true;
        }
        for (var l = 0; l < h; l++) {
            var m = new Array(4);
            m[0] = this.qj(l, false, a, g, f);
            m[1] = a.f._inner[(intDivide(l, 2))][1];
            m[2] = this.qj(l, true, a, g, f);
            m[3] = a.f._inner[(intDivide(l, 2))][2];
            i.add(m);
        }
        var n = this.nf.cn.d;
        if (j) {
            var o = new ScalerParams(0, b.bs, b.br, this.py.b8, e);
            this.ok(i, -1, this.valueColumn.count, this.py, o, b.n);
        }
        var p = typeCast(StepAreaSeriesView.$, b);
        var q = p.dj;
        var r = p.dl;
        var s = p.df;
        var t = p.dh;
        this.ne.ae(q, true, false, true, true);
        this.ne.ae(r, true, false, true, true);
        this.ne.ae(s, false, true, false, false);
        this.ne.ae(t, false, true, false, false);
        if (b.cr(a)) {
            p.c9(h, i, false, n, this.eu, function (u, v, w, x, y) { return _this.pi(u, 2 * a.f.count, b); }, 1, this.ox(i, i.count - 1, b.br, b.bs, true));
            b.cu(a);
        }
        var u = this.fetchYAxis();
        p.df._opacity = this.d6;
        p.dh._opacity = 0.5 * this.d6;
    };
    Object.defineProperty(StepAreaSeries.prototype, "currentCategoryMode", {
        get: function () {
            return this.preferredCategoryMode(this.py);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(StepAreaSeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.n2;
        },
        enumerable: true,
        configurable: true
    });
    StepAreaSeries.$t = markType(StepAreaSeries, 'StepAreaSeries', HorizontalAnchoredCategorySeries.$, [IIsCategoryBased_$type]);
    return StepAreaSeries;
}(HorizontalAnchoredCategorySeries));
export { StepAreaSeries };
/**
 * @hidden
 */
var StepAreaSeriesView = /** @class */ (function (_super) {
    tslib_1.__extends(StepAreaSeriesView, _super);
    function StepAreaSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.c6 = null;
        _this.de = new Path();
        _this.di = new Path();
        _this.dg = new Path();
        _this.dk = new Path();
        _this.da = new Path();
        _this.dc = new Path();
        _this.db = new Path();
        _this.dd = new Path();
        _this.c6 = a;
        return _this;
    }
    StepAreaSeriesView.prototype.ap = function () {
        _super.prototype.ap.call(this);
        if (!this.n) {
            this.e.bj = 1;
        }
    };
    Object.defineProperty(StepAreaSeriesView.prototype, "df", {
        get: function () {
            return this.de;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(StepAreaSeriesView.prototype, "dj", {
        get: function () {
            return this.di;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(StepAreaSeriesView.prototype, "dh", {
        get: function () {
            return this.dg;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(StepAreaSeriesView.prototype, "dl", {
        get: function () {
            return this.dk;
        },
        enumerable: true,
        configurable: true
    });
    StepAreaSeriesView.prototype.c7 = function () {
        this.de.ak = null;
        this.dg.ak = null;
        this.di.ak = null;
        this.dk.ak = null;
        this.an();
    };
    StepAreaSeriesView.prototype.c8 = function (a, b, c, d, e, f, g) {
        this.c8(a, b, c, d, e, f, g);
    };
    StepAreaSeriesView.prototype.c9 = function (a, b, c, d, e, f, g, h) {
        this.c6.qh.a = typeCast(ISortingAxis_$type, this.cp.fetchXAxis()) !== null ? true : false;
        this.c6.qh.j(this.de, this.di, this.dg, this.dk, a, b, c, d, e, f, g, h);
        this.an();
    };
    StepAreaSeriesView.prototype.a9 = function () {
        _super.prototype.a9.call(this);
        this.da.ak = this.de.ak;
        this.dc.ak = this.di.ak;
        this.db.ak = this.dg.ak;
        this.dd.ak = this.dk.ak;
        var a = this.bl();
        this.da._fill = a;
        this.da._opacity = 1;
        this.db._fill = a;
        this.db._opacity = 1;
        this.dc._stroke = a;
        this.dc.ac = this.e.ey + 3;
        this.dd._stroke = a;
        this.dd.ac = this.e.ey + 3;
    };
    StepAreaSeriesView.prototype.a3 = function (a, b) {
        _super.prototype.a3.call(this, a, b);
        if (b) {
            a.s(this.da);
            a.s(this.db);
            a.s(this.dc);
            a.s(this.dd);
        }
        else {
            a.s(this.de);
            a.s(this.dg);
            a.s(this.di);
            a.s(this.dk);
        }
    };
    StepAreaSeriesView.prototype.ai = function (a) {
        _super.prototype.ai.call(this, a);
        this.e.a2.exportPathData(a, this.di, "lowerShape", ["Lower"]);
        this.e.a2.exportPathData(a, this.dk, "upperShape", ["Upper", "Main"]);
        this.e.a2.exportPathData(a, this.dg, "translucentShape", ["Translucent"]);
        this.e.a2.exportPathData(a, this.de, "fillShape", ["Fill"]);
    };
    StepAreaSeriesView.$t = markType(StepAreaSeriesView, 'StepAreaSeriesView', AnchoredCategorySeriesView.$);
    return StepAreaSeriesView;
}(AnchoredCategorySeriesView));
export { StepAreaSeriesView };
//# sourceMappingURL=StepAreaSeries_combined.js.map