/*
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 { 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.vj = null;
        _this.vj = new CategoryLineRasterizer();
        _this.ab = StepAreaSeries.$;
        return _this;
    }
    StepAreaSeries.prototype.by = function () {
        return new StepAreaSeriesView(this);
    };
    StepAreaSeries.prototype.l4 = function (a) {
        _super.prototype.l4.call(this, a);
        this.vk = a;
    };
    StepAreaSeries.prototype.get_dg = function () {
        return true;
    };
    StepAreaSeries.prototype.get_df = function () {
        return true;
    };
    StepAreaSeries.prototype.get_ek = function () {
        return true;
    };
    StepAreaSeries.prototype.get_d5 = function () {
        return true;
    };
    StepAreaSeries.prototype.b4 = function () {
        if (this.b5 == 0) {
            return 2;
        }
        return _super.prototype.b4.call(this);
    };
    StepAreaSeries.prototype.preferredCategoryMode = function (a) {
        return typeCast(ISortingAxis_$type, a) !== null ? 0 : 1;
    };
    StepAreaSeries.prototype.k2 = function (a, b) {
        _super.prototype.k2.call(this, a, b);
        var c = b;
        c.db();
    };
    StepAreaSeries.prototype.vl = 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.r7 = function () {
        return 1;
    };
    StepAreaSeries.prototype.gd = 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.bq = function () {
        if (this.br == 0) {
            return 2;
        }
        else {
            return _super.prototype.bq.call(this);
        }
    };
    StepAreaSeries.prototype.tf = function (a, b) {
        var _this = this;
        _super.prototype.tf.call(this, a, b);
        var c = b.bv;
        var d = b.bu;
        var e = this.getEffectiveViewport1(b);
        var f = typeCast(ISortingAxis_$type, this.u0) != null;
        var g = this.u0 != null ? 0.5 * this.u0.getCategorySize(c, d, e) : 0;
        if (this.u0 != null && this.u0.ch) {
            g = -g;
        }
        var h = a.f.count * 2;
        var i = new List$1(Array_$type, 2, h);
        this.r5.a2(this, this.sp(), runOn(this, this.rq), this.sx(b), this.sy(b));
        var j = false;
        var k = this.r5.b;
        if (k != null) {
            j = true;
        }
        for (var l = 0; l < h; l++) {
            var m = new Array(4);
            m[0] = this.vl(l, false, a, g, f);
            m[1] = a.f._inner[(intDivide(l, 2))][1];
            m[2] = this.vl(l, true, a, g, f);
            m[3] = a.f._inner[(intDivide(l, 2))][2];
            i.add(m);
        }
        var n = this.r6.cr.d;
        if (j) {
            var o = new ScalerParams(0, b.bv, b.bu, this.u0.ch, e);
            this.tb(i, -1, this.valueColumn.count, this.u0, o, b.q);
        }
        var p = typeCast(StepAreaSeriesView.$, b);
        var q = p.dp;
        var r = p.dq;
        var s = p.dm;
        var t = p.dn;
        this.r5.ad(q, true, false, true, true);
        this.r5.ad(r, true, false, true, true);
        this.r5.ad(s, false, true, false, false);
        this.r5.ad(t, false, true, false, false);
        if (b.cv(a)) {
            p.dd(h, i, false, n, this.fx, function (u, v, w, x, y) { return _this.uh(u, 2 * a.f.count, b); }, 1, this.to(i, i.count - 1, b.bu, b.bv, true));
            b.cy(a);
        }
        var u = this.fetchYAxis();
        p.dm._opacity = this.r5.j * this.fu;
        p.dn._opacity = 0.5 * this.r5.j * this.fu;
    };
    Object.defineProperty(StepAreaSeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.ss;
        },
        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.da = null;
        _this.di = new Path();
        _this.dk = new Path();
        _this.dj = new Path();
        _this.dl = new Path();
        _this.de = new Path();
        _this.dg = new Path();
        _this.df = new Path();
        _this.dh = new Path();
        _this.da = a;
        return _this;
    }
    StepAreaSeriesView.prototype.as = function () {
        _super.prototype.as.call(this);
        if (!this.q) {
            this.da.ql = Defaults.c;
        }
    };
    Object.defineProperty(StepAreaSeriesView.prototype, "dm", {
        get: function () {
            return this.di;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(StepAreaSeriesView.prototype, "dp", {
        get: function () {
            return this.dk;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(StepAreaSeriesView.prototype, "dn", {
        get: function () {
            return this.dj;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(StepAreaSeriesView.prototype, "dq", {
        get: function () {
            return this.dl;
        },
        enumerable: false,
        configurable: true
    });
    StepAreaSeriesView.prototype.db = function () {
        this.di.an = null;
        this.dj.an = null;
        this.dk.an = null;
        this.dl.an = null;
        this.aq();
    };
    StepAreaSeriesView.prototype.dc = function (a, b, c, d, e, f, g) {
        this.dc(a, b, c, d, e, f, g);
    };
    StepAreaSeriesView.prototype.dd = function (a, b, c, d, e, f, g, h) {
        this.da.vj.a = typeCast(ISortingAxis_$type, this.ct.fetchXAxis()) !== null ? true : false;
        this.da.vj.j(this.di, this.dk, this.dj, this.dl, a, b, c, d, e, f, g, h);
        this.aq();
    };
    StepAreaSeriesView.prototype.bc = function () {
        _super.prototype.bc.call(this);
        this.de.an = this.di.an;
        this.dg.an = this.dk.an;
        this.df.an = this.dj.an;
        this.dh.an = this.dl.an;
        var a = this.bo();
        this.de._fill = a;
        this.de._opacity = 1;
        this.df._fill = a;
        this.df._opacity = 1;
        this.dg._stroke = a;
        this.dg.ad = this.e.fy + 3;
        this.dh._stroke = a;
        this.dh.ad = this.e.fy + 3;
    };
    StepAreaSeriesView.prototype.a6 = function (a, b) {
        _super.prototype.a6.call(this, a, b);
        if (b) {
            a.t(this.de);
            a.t(this.df);
            a.t(this.dg);
            a.t(this.dh);
        }
        else {
            a.t(this.di);
            a.t(this.dj);
            a.t(this.dk);
            a.t(this.dl);
        }
    };
    StepAreaSeriesView.prototype.al = function (a) {
        _super.prototype.al.call(this, a);
        this.e.a9.exportPathData(a, this.dk, "lowerShape", ["Lower"]);
        this.e.a9.exportPathData(a, this.dl, "upperShape", ["Upper", "Main"]);
        this.e.a9.exportPathData(a, this.dj, "translucentShape", ["Translucent"]);
        this.e.a9.exportPathData(a, this.di, "fillShape", ["Fill"]);
    };
    StepAreaSeriesView.$t = markType(StepAreaSeriesView, 'StepAreaSeriesView', AnchoredCategorySeriesView.$);
    return StepAreaSeriesView;
}(AnchoredCategorySeriesView));
export { StepAreaSeriesView };
