/*
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 { __extends } from "tslib";
import { HorizontalAnchoredCategorySeries } from "./HorizontalAnchoredCategorySeries";
import { CategoryLineRasterizer } from "./CategoryLineRasterizer";
import { typeCast, Array_$type, runOn, markType } from "igniteui-react-core";
import { ISortingAxis_$type } from "./ISortingAxis";
import { List$1 } from "igniteui-react-core";
import { Path } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { ChartSelection } from "./ChartSelection";
import { intDivide, isNaN_ } from "igniteui-react-core";
import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView";
import { Defaults } from "./Defaults";
/**
 * @hidden
 */
var StepAreaSeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(StepAreaSeries, _super);
    function StepAreaSeries() {
        var _this = _super.call(this) || this;
        _this.acu = null;
        _this.acu = new CategoryLineRasterizer();
        _this.ab = StepAreaSeries.$;
        return _this;
    }
    StepAreaSeries.prototype.bj = function () {
        return new StepAreaSeries();
    };
    StepAreaSeries.prototype.cs = function () {
        return new StepAreaSeriesView(this);
    };
    StepAreaSeries.prototype.qz = function (a) {
        _super.prototype.qz.call(this, a);
        this.acv = a;
    };
    StepAreaSeries.prototype.get_ev = function () {
        return true;
    };
    StepAreaSeries.prototype.get_eu = function () {
        return true;
    };
    StepAreaSeries.prototype.get_f1 = function () {
        return true;
    };
    StepAreaSeries.prototype.get_fl = function () {
        return true;
    };
    StepAreaSeries.prototype.cy = function () {
        if (this.cz == 0) {
            return 2;
        }
        return _super.prototype.cy.call(this);
    };
    StepAreaSeries.prototype.preferredCategoryMode = function (a) {
        return typeCast(ISortingAxis_$type, a) !== null ? 0 : 1;
    };
    StepAreaSeries.prototype.o5 = function (a, b) {
        _super.prototype.o5.call(this, a, b);
        var c = b;
        c.dg();
    };
    StepAreaSeries.prototype.acw = 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.y2 = function () {
        return 1;
    };
    StepAreaSeries.prototype.iv = 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.b2 = function () {
        if (this.b3 == 0) {
            return 2;
        }
        else {
            return _super.prototype.b2.call(this);
        }
    };
    StepAreaSeries.prototype.aai = function (a, b) {
        var _this = this;
        _super.prototype.aai.call(this, a, b);
        var c = b.by;
        var d = b.bx;
        var e = this.getEffectiveViewport1(b);
        var f = typeCast(ISortingAxis_$type, this.acb) != null;
        var g = this.acb != null ? 0.5 * this.acb.getCategorySize(c, d, e) : 0;
        if (this.acb != null && this.acb.ch) {
            g = -g;
        }
        var h = a.f.count * 2;
        var i = new List$1(Array_$type, 2, h);
        this.y0.a2(this, this.zk(), runOn(this, this.yk), this.zt(b), this.zu(b));
        var j = false;
        var k = this.y0.b;
        if (k != null) {
            j = true;
        }
        for (var l = 0; l < h; l++) {
            var m = new Array(4);
            m[0] = this.acw(l, false, a, g, f);
            m[1] = a.f._inner[(intDivide(l, 2))][1];
            m[2] = this.acw(l, true, a, g, f);
            m[3] = a.f._inner[(intDivide(l, 2))][2];
            i.add(m);
        }
        var n = this.y1.cw.d;
        if (j) {
            var o = new ScalerParams(0, b.by, b.bx, this.acb.ch, e);
            this.aae(i, -1, this.valueColumn.count, this.acb, o, b.q, -1);
        }
        var p = typeCast(StepAreaSeriesView.$, b);
        var q = p.du;
        var r = p.dv;
        var s = p.ds;
        var t = p.dt;
        this.y0.ad(q, true, false, true, true);
        this.y0.ad(r, true, false, true, true);
        this.y0.ad(s, false, true, false, false);
        this.y0.ad(t, false, true, false, false);
        if (b.c0(a)) {
            p.di(h, i, false, n, this.id, function (u, v, w, x, y) { return _this.abr(u, 2 * a.f.count, b); }, 1, this.aas(i, i.count - 1, b.bx, b.by, true));
            b.c3(a);
        }
        var u = this.fetchYAxis();
        p.ds._opacity = this.y0.j * this.h9;
        p.dt._opacity = 0.5 * this.y0.j * this.h9;
    };
    StepAreaSeries.prototype.p2 = function (a, b, c) {
        this.aaa(a, b, c, this.yr, 1);
    };
    StepAreaSeries.prototype.ak = function (a, b) {
        var c = new List$1(ChartSelection.$, 0);
        this.p2(a, c, b);
        return c.toArray();
    };
    Object.defineProperty(StepAreaSeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.zo;
        },
        enumerable: false,
        configurable: true
    });
    StepAreaSeries.$t = markType(StepAreaSeries, 'StepAreaSeries', HorizontalAnchoredCategorySeries.$);
    return StepAreaSeries;
}(HorizontalAnchoredCategorySeries));
export { StepAreaSeries };
/**
 * @hidden
 */
var StepAreaSeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(StepAreaSeriesView, _super);
    function StepAreaSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.df = null;
        _this.dn = new Path();
        _this.dq = new Path();
        _this.dp = new Path();
        _this.dr = new Path();
        _this.dj = new Path();
        _this.dl = new Path();
        _this.dk = new Path();
        _this.dm = new Path();
        _this.df = a;
        return _this;
    }
    StepAreaSeriesView.prototype.au = function () {
        _super.prototype.au.call(this);
        if (!this.q) {
            this.df.w8 = Defaults.c;
        }
    };
    Object.defineProperty(StepAreaSeriesView.prototype, "ds", {
        get: function () {
            return this.dn;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(StepAreaSeriesView.prototype, "du", {
        get: function () {
            return this.dq;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(StepAreaSeriesView.prototype, "dt", {
        get: function () {
            return this.dp;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(StepAreaSeriesView.prototype, "dv", {
        get: function () {
            return this.dr;
        },
        enumerable: false,
        configurable: true
    });
    StepAreaSeriesView.prototype.dg = function () {
        this.dn.an = null;
        this.dp.an = null;
        this.dq.an = null;
        this.dr.an = null;
        this.as();
    };
    StepAreaSeriesView.prototype.dh = function (a, b, c, d, e, f, g) {
        this.dh(a, b, c, d, e, f, g);
    };
    StepAreaSeriesView.prototype.di = function (a, b, c, d, e, f, g, h) {
        this.df.acu.a = typeCast(ISortingAxis_$type, this.cy.fetchXAxis()) !== null ? true : false;
        this.df.acu.j(this.dn, this.dq, this.dp, this.dr, a, b, c, d, e, f, g, h);
        this.as();
    };
    StepAreaSeriesView.prototype.be = function () {
        _super.prototype.be.call(this);
        this.dj.an = this.dn.an;
        this.dl.an = this.dq.an;
        this.dk.an = this.dp.an;
        this.dm.an = this.dr.an;
        var a = this.br();
        this.dj._fill = a;
        this.dj._opacity = 1;
        this.dk._fill = a;
        this.dk._opacity = 1;
        this.dl._stroke = a;
        this.dl.ad = this.e.ie + 3;
        this.dm._stroke = a;
        this.dm.ad = this.e.ie + 3;
    };
    StepAreaSeriesView.prototype.a8 = function (a, b) {
        _super.prototype.a8.call(this, a, b);
        if (b) {
            a.t(this.dj);
            a.t(this.dk);
            a.t(this.dl);
            a.t(this.dm);
        }
        else {
            a.t(this.dn);
            a.t(this.dp);
            a.t(this.dq);
            a.t(this.dr);
        }
    };
    StepAreaSeriesView.prototype.an = function (a) {
        _super.prototype.an.call(this, a);
        this.e.bc.exportPathData(a, this.dq, "lowerShape", ["Lower"]);
        this.e.bc.exportPathData(a, this.dr, "upperShape", ["Upper", "Main"]);
        this.e.bc.exportPathData(a, this.dp, "translucentShape", ["Translucent"]);
        this.e.bc.exportPathData(a, this.dn, "fillShape", ["Fill"]);
    };
    StepAreaSeriesView.$t = markType(StepAreaSeriesView, 'StepAreaSeriesView', AnchoredCategorySeriesView.$);
    return StepAreaSeriesView;
}(AnchoredCategorySeriesView));
export { StepAreaSeriesView };
