/*
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";
import { Color } from "igniteui-react-core";
/**
 * @hidden
 */
var StepLineSeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(StepLineSeries, _super);
    function StepLineSeries() {
        var _this = _super.call(this) || this;
        _this.ze = null;
        _this.ze = new CategoryLineRasterizer();
        _this.ab = StepLineSeries.$;
        return _this;
    }
    StepLineSeries.prototype.get_ex = function () {
        return true;
    };
    StepLineSeries.prototype.get_fe = function () {
        return true;
    };
    StepLineSeries.prototype.get_ey = function () {
        return true;
    };
    StepLineSeries.prototype.cg = function () {
        return new StepLineSeriesView(this);
    };
    StepLineSeries.prototype.wg = function () {
        return true;
    };
    StepLineSeries.prototype.o0 = function (a) {
        _super.prototype.o0.call(this, a);
        this.zf = a;
    };
    StepLineSeries.prototype.ac = function () {
        _super.prototype.ac.call(this);
    };
    StepLineSeries.prototype.preferredCategoryMode = function (a) {
        return typeCast(ISortingAxis_$type, a) !== null ? 0 : 1;
    };
    StepLineSeries.prototype.get_d9 = function () {
        return true;
    };
    StepLineSeries.prototype.nj = function (a, b) {
        _super.prototype.nj.call(this, a, b);
        var c = b;
        c.de();
    };
    StepLineSeries.prototype.bx = function () {
        if (this.by == 0) {
            return 2;
        }
        else {
            return _super.prototype.bx.call(this);
        }
    };
    StepLineSeries.prototype.hz = 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;
    };
    StepLineSeries.prototype.zg = function (a, b, c, d, e, f) {
        var g;
        if (b) {
            if (f) {
                g = (a & 1) == 0;
                if (g || (intDivide(a, 2)) + 1 < 0) {
                    return c.f._inner[(intDivide(a, 2))][0];
                }
                if (c.f.count == (intDivide(a, 2)) + 1) {
                    return c.f._inner[(intDivide(a, 2))][0];
                }
                return c.f._inner[(intDivide(a, 2)) + 1][0];
            }
            g = (a & 1) == 0;
            return c.f._inner[(intDivide(a, 2))][0] + (g ? d : -d);
        }
        if (f) {
            g = (a & 1) == 0;
            if (g || ((intDivide(a, 2)) + 1) >= c.f.count) {
                return c.f._inner[(intDivide(a, 2))][0];
            }
            if (c.f.count == (intDivide(a, 2)) + 1) {
                return c.f._inner[(intDivide(a, 2))][0];
            }
            return c.f._inner[(intDivide(a, 2)) + 1][0];
        }
        g = (a & 1) == 0;
        return c.f._inner[(intDivide(a, 2))][0] + (g ? -d : d);
    };
    StepLineSeries.prototype.w5 = function (a, b) {
        _super.prototype.w5.call(this, a, b);
        var c = b.by;
        var d = b.bx;
        var e = this.getEffectiveViewport1(b);
        var f = typeCast(ISortingAxis_$type, this.yv) != null;
        var g = this.yv.ch;
        var h = 0;
        if (this.yv != null) {
            h = 0.5 * this.yv.getCategorySize(c, d, e);
        }
        var i = a.f;
        var j = 2 * i.count;
        var k = new List$1(Array_$type, 2, j);
        if (!this.yv.ch) {
            for (var l = 0; l < j; l++) {
                var m = new Array(4);
                m[0] = this.zg(l, false, a, h, g, f);
                m[1] = a.f._inner[(intDivide(l, 2))][1];
                m[2] = this.zg(l, true, a, h, g, f);
                m[3] = a.f._inner[(intDivide(l, 2))][2];
                k.add(m);
            }
        }
        else {
            for (var n = 0; n < j; n++) {
                var o = new Array(4);
                o[0] = this.zg(n, true, a, h, g, f);
                o[1] = a.f._inner[(intDivide(n, 2))][1];
                o[2] = this.zg(n, true, a, h, g, f);
                o[3] = a.f._inner[(intDivide(n, 2))][2];
                k.add(o);
            }
        }
        var p = typeCast(StepLineSeriesView.$, b);
        var q = p.cu.d;
        this.vu.a2(this, this.we(), runOn(this, this.vf), this.wn(b), this.wo(b));
        var r = false;
        var s = this.vu.b;
        if (s != null) {
            r = true;
        }
        if (r) {
            var t = new ScalerParams(0, b.by, b.bx, this.yv.ch, e);
            this.w1(i, -1, this.valueColumn.count, this.yv, t, b.q);
        }
        var u = p.dk;
        var v = p.dl;
        var w = p.dj;
        this.vu.ad(u, true, false, true, false);
        this.vu.ad(v, true, false, true, false);
        this.vu.ad(w, false, true, false, false);
        w._opacity = 0.75 * this.vu.j;
        if (b.cy(a)) {
            p.df(j, k, false, 1, this.xd(k, j - 1, b.bx, b.by), q, this.hj);
            b.c1(a);
        }
    };
    Object.defineProperty(StepLineSeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.wi;
        },
        enumerable: false,
        configurable: true
    });
    StepLineSeries.$t = markType(StepLineSeries, 'StepLineSeries', HorizontalAnchoredCategorySeries.$);
    return StepLineSeries;
}(HorizontalAnchoredCategorySeries));
export { StepLineSeries };
/**
 * @hidden
 */
var StepLineSeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(StepLineSeriesView, _super);
    function StepLineSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.dd = null;
        _this.dn = new Path();
        _this.dm = new Path();
        _this.dp = new Path();
        _this.di = new Path();
        _this.dh = new Path();
        _this.dg = new Path();
        _this.dd = a;
        return _this;
    }
    StepLineSeriesView.prototype.au = function () {
        _super.prototype.au.call(this);
        if (!this.q) {
            this.dd.ua = Defaults.c;
        }
    };
    Object.defineProperty(StepLineSeriesView.prototype, "dk", {
        get: function () {
            return this.dn;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(StepLineSeriesView.prototype, "dl", {
        get: function () {
            return this.dp;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(StepLineSeriesView.prototype, "dj", {
        get: function () {
            return this.dm;
        },
        enumerable: false,
        configurable: true
    });
    StepLineSeriesView.prototype.de = function () {
        this.dm.an = null;
        this.dn.an = null;
        this.dp.an = null;
        this.as();
    };
    StepLineSeriesView.prototype.df = function (a, b, c, d, e, f, g) {
        this.dd.ze.a = typeCast(ISortingAxis_$type, this.cw.fetchXAxis()) !== null ? true : false;
        this.dd.ze.m(this.dn, this.dm, this.dp, a, b, c, d, e, f, g);
        this.as();
    };
    StepLineSeriesView.prototype.be = function () {
        _super.prototype.be.call(this);
        this.dh.an = this.dn.an;
        this.di.an = this.dp.an;
        this.dg.an = this.dm.an;
        var a = this.br();
        this.dh._stroke = a;
        this.dh.ad = this.e.hk + 3;
        this.di._stroke = a;
        this.di.ad = this.e.hk + 3;
        this.dg._fill = a;
        this.dg._opacity = 1;
    };
    StepLineSeriesView.prototype.a8 = function (a, b) {
        _super.prototype.a8.call(this, a, b);
        if (a.d) {
            if (b) {
                a.t(this.dg);
                a.t(this.dh);
                a.t(this.di);
            }
            else {
                a.t(this.dm);
                a.t(this.dn);
                a.t(this.dp);
            }
        }
    };
    StepLineSeriesView.prototype.an = function (a) {
        _super.prototype.an.call(this, a);
        this.e.a9.exportPathData(a, this.dn, "lowerShape", ["Lower", "Main"]);
        this.e.a9.exportPathData(a, this.dp, "upperShape", ["Upper"]);
        this.e.a9.exportPathData(a, this.dm, "translucentShape", ["Translucent"]);
    };
    StepLineSeriesView.prototype.af = function () {
        var a = new Color();
        a.colorString = "rgba(95,95,95,0.5)";
        this.e.s6 = a;
        this.e.ir = 3;
        this.e.is = 1;
        this.e.it = 4;
        this.e.gj = false;
    };
    StepLineSeriesView.$t = markType(StepLineSeriesView, 'StepLineSeriesView', AnchoredCategorySeriesView.$);
    return StepLineSeriesView;
}(AnchoredCategorySeriesView));
export { StepLineSeriesView };
