/*
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 { 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";
import { Color } from "igniteui-angular-core";
/**
 * @hidden
 */
export class StepLineSeries extends HorizontalAnchoredCategorySeries {
    constructor() {
        super();
        this.qh = null;
        this.qh = new CategoryLineRasterizer();
        this.ab = StepLineSeries.$;
    }
    bf() {
        return new StepLineSeriesView(this);
    }
    getHostReferenceValue() {
        return this.eh();
    }
    iu(a) {
        super.iu(a);
        this.qi = a;
    }
    ac() {
        super.ac();
    }
    preferredCategoryMode(a) {
        return typeCast(ISortingAxis_$type, a) !== null ? 0 : 1;
    }
    get_ck() {
        return true;
    }
    hv(a, b) {
        super.hv(a, b);
        let c = b;
        c.c7();
    }
    bd() {
        if (this.be == 0) {
            return 2;
        }
        else {
            return super.bd();
        }
    }
    ef(a, b, c, d, e, f, g, h) {
        let i = NaN;
        if (c >= 0 && c < b.count) {
            i = b.item(c);
        }
        let 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;
    }
    qj(a, b, c, d, e, f) {
        let 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);
    }
    oo(a, b) {
        super.oo(a, b);
        let c = b.bs;
        let d = b.br;
        let e = this.getEffectiveViewport1(b);
        let f = typeCast(ISortingAxis_$type, this.py) != null;
        let g = this.py.b8;
        let h = 0;
        if (this.py != null) {
            h = 0.5 * this.py.getCategorySize(c, d, e);
        }
        let i = a.f;
        let j = 2 * i.count;
        let k = new List$1(Array_$type, 2, j);
        if (!this.py.b8) {
            for (let l = 0; l < j; l++) {
                let m = new Array(4);
                m[0] = this.qj(l, false, a, h, g, f);
                m[1] = a.f._inner[(intDivide(l, 2))][1];
                m[2] = this.qj(l, true, a, h, g, f);
                m[3] = a.f._inner[(intDivide(l, 2))][2];
                k.add(m);
            }
        }
        else {
            for (let n = 0; n < j; n++) {
                let o = new Array(4);
                o[0] = this.qj(n, true, a, h, g, f);
                o[1] = a.f._inner[(intDivide(n, 2))][1];
                o[2] = this.qj(n, true, a, h, g, f);
                o[3] = a.f._inner[(intDivide(n, 2))][2];
                k.add(o);
            }
        }
        let p = typeCast(StepLineSeriesView.$, b);
        let q = p.cn.d;
        this.ne.x(this, this.nz(), this.py, runOn(this, this.m0), this.n7(b), this.n8(b));
        let r = false;
        let s = this.ne.c;
        if (s != null) {
            r = true;
        }
        if (r) {
            let t = new ScalerParams(0, b.bs, b.br, this.py.b8, e);
            this.ok(i, -1, this.valueColumn.count, this.py, t, b.n);
        }
        let u = p.dd;
        let v = p.de;
        let w = p.dc;
        this.ne.ae(u, true, false, true, false);
        this.ne.ae(v, true, false, true, false);
        this.ne.ae(w, false, true, false, false);
        w._opacity = 0.75 * this.ne.i;
        if (b.cr(a)) {
            p.c8(j, k, false, 1, this.ow(k, j - 1, b.br, b.bs), q, this.eu);
            b.cu(a);
        }
    }
    get currentCategoryMode() {
        return this.preferredCategoryMode(this.py);
    }
    get useHighMarkerFidelity() {
        return this.n2;
    }
}
StepLineSeries.$t = markType(StepLineSeries, 'StepLineSeries', HorizontalAnchoredCategorySeries.$, [IIsCategoryBased_$type]);
/**
 * @hidden
 */
export class StepLineSeriesView extends AnchoredCategorySeriesView {
    constructor(a) {
        super(a);
        this.c6 = null;
        this.dg = new Path();
        this.df = new Path();
        this.dh = new Path();
        this.db = new Path();
        this.da = new Path();
        this.c9 = new Path();
        this.c6 = a;
    }
    get dd() {
        return this.dg;
    }
    get de() {
        return this.dh;
    }
    get dc() {
        return this.df;
    }
    c7() {
        this.df.ak = null;
        this.dg.ak = null;
        this.dh.ak = null;
        this.an();
    }
    c8(a, b, c, d, e, f, g) {
        this.c6.qh.a = typeCast(ISortingAxis_$type, this.cp.fetchXAxis()) !== null ? true : false;
        this.c6.qh.m(this.dg, this.df, this.dh, a, b, c, d, e, f, g);
        this.an();
    }
    a9() {
        super.a9();
        this.da.ak = this.dg.ak;
        this.db.ak = this.dh.ak;
        this.c9.ak = this.df.ak;
        let a = this.bl();
        this.da._stroke = a;
        this.da.ac = this.e.ey + 3;
        this.db._stroke = a;
        this.db.ac = this.e.ey + 3;
        this.c9._fill = a;
        this.c9._opacity = 1;
    }
    a3(a, b) {
        super.a3(a, b);
        if (a.d) {
            if (b) {
                a.s(this.c9);
                a.s(this.da);
                a.s(this.db);
            }
            else {
                a.s(this.df);
                a.s(this.dg);
                a.s(this.dh);
            }
        }
    }
    ai(a) {
        super.ai(a);
        this.e.a2.exportPathData(a, this.dg, "lowerShape", ["Lower", "Main"]);
        this.e.a2.exportPathData(a, this.dh, "upperShape", ["Upper"]);
        this.e.a2.exportPathData(a, this.df, "translucentShape", ["Translucent"]);
    }
    ac() {
        let a = new Color();
        a.colorString = "rgba(95,95,95,0.5)";
        this.e.la = a;
        this.e.ev = 3;
        this.e.ew = 1;
        this.e.ex = 4;
        this.e.du = false;
    }
}
StepLineSeriesView.$t = markType(StepLineSeriesView, 'StepLineSeriesView', AnchoredCategorySeriesView.$);
//# sourceMappingURL=StepLineSeries_combined.js.map