/*
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 { HorizontalRangeCategorySeries } from "./HorizontalRangeCategorySeries";
import { DependencyProperty } from "igniteui-angular-core";
import { typeCast, runOn, markType, markDep, fromEnum } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { List$1 } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { Rectangle } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_, isInfinity } from "igniteui-angular-core";
import { RangeCategorySeriesView } from "./RangeCategorySeriesView";
/**
 * @hidden
 */
export class RangeColumnSeries extends HorizontalRangeCategorySeries {
    constructor() {
        super();
        this.ab = RangeColumnSeries.$;
    }
    bf() {
        return new RangeColumnSeriesView(this);
    }
    iu(a) {
        super.iu(a);
        this.pj = a;
    }
    get_nv() {
        return true;
    }
    preferredCategoryMode(a) {
        return 2;
    }
    lu(a) {
        if (this.xAxis == null || this.yAxis == null) {
            return Rect.empty;
        }
        let b = this.lg(a);
        let c = this.bi.bs;
        let d = this.bi.br;
        let e = this.getEffectiveViewport1(this.bi);
        let f = new ScalerParams(0, c, d, this.yAxis.b8, e);
        f.b = this.eh();
        let g = this.aj(this.m6(), this.m7.f, this.n7(this.bi), this.n8(this.bi), a, true);
        if (g == null) {
            return Rect.empty;
        }
        let h = g[0];
        let i = g[1];
        let j = Math.abs(b.x - h[0]);
        let k = Math.abs(b.x - i[0]);
        let l = this.xAxis.jr(c, d, e);
        if (j < k) {
            let m = h[0] - 0.5 * l;
            let n = h[1];
            let o = h[2];
            return new Rect(0, m, Math.min(n, o), l, Math.max(n, o) - Math.min(n, o));
        }
        else {
            let p = i[0] - 0.5 * l;
            let q = i[1];
            let r = i[2];
            return new Rect(0, p, Math.min(q, r), l, Math.max(q, r) - Math.min(q, r));
        }
    }
    dh(a, b) {
        if (this.dk(a, b)) {
            return true;
        }
        if (this.l4(a, b)) {
            return true;
        }
        return false;
    }
    hv(a, b) {
        super.hv(a, b);
        let c = b;
        if (a && c.cz != null) {
            c.cz.count = 0;
        }
    }
    eg() {
        return this.xAxis.jr(this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi));
    }
    oo(a, b) {
        super.oo(a, b);
        let c = typeCast(RangeColumnSeriesView.$, b);
        let d = a.f;
        let e = b.bs;
        let f = b.br;
        let g = this.getEffectiveViewport1(b);
        let h = this.xAxis.jr(e, f, g);
        if (isNaN_(h) || isInfinity(h)) {
            c.cz.count = 0;
            return;
        }
        this.ne.x(this, this.nz(), this.xAxis, runOn(this, this.m0), this.n7(b), this.n8(b));
        this.ne.p = this.pk;
        this.ne.q = this.pl;
        this.ne.j = this.pk;
        this.ne.k = this.pl;
        let i = false;
        let j = this.ne.c;
        if (j != null) {
            i = true;
        }
        let k = this.xAxis.cd;
        let l = this.lowColumn.count;
        let m = this.xAxis;
        let n = new ScalerParams(0, e, f, this.xAxis.b8, g);
        let o = 0;
        for (let p = 0; p < d.count; ++p) {
            let q = d._inner[p][0] - 0.5 * h;
            let r = Math.min(d._inner[p][1], d._inner[p][2]);
            let s = Math.max(d._inner[p][1], d._inner[p][2]);
            let t = Math.abs(s - r);
            if (isInfinity(t)) {
                continue;
            }
            let u = c.cz.item(o);
            o++;
            u.width = h;
            u.height = t;
            if (i) {
                this.ok(d, p, l, m, n, b.n);
            }
            this.ne.ae(u, false, false, false, false);
            u.am = this.ne.j;
            u.an = this.ne.k;
            c.c4(u, q, r);
        }
        c.cz.count = o;
        b.cu(a);
    }
    get useHighMarkerFidelity() {
        return this.n2;
    }
}
RangeColumnSeries.$t = markType(RangeColumnSeries, 'RangeColumnSeries', HorizontalRangeCategorySeries.$);
RangeColumnSeries.$$p = markDep(DependencyProperty, PropertyMetadata, RangeColumnSeries, 'raisePropertyChanged', ['RadiusX:pk:po', [1, 2], 'RadiusY:pl:pp', [1, 2]]);
/**
 * @hidden
 */
export class RangeColumnSeriesView extends RangeCategorySeriesView {
    constructor(a) {
        super(a);
        this.cy = null;
        this.cz = null;
        this.c0 = null;
        this.c5 = new Rectangle();
        this.cy = a;
        this.cz = ((() => {
            let $ret = new Pool$1(Rectangle.$);
            $ret.create = runOn(this, this.c6);
            $ret.activate = runOn(this, this.c1);
            $ret.disactivate = runOn(this, this.c3);
            $ret.destroy = runOn(this, this.c2);
            return $ret;
        })());
    }
    ap() {
        super.ap();
        this.c0 = new List$1(Rectangle.$, 0);
        if (!this.n) {
            this.e.eu = 4;
            this.e.bj = 1;
        }
    }
    c6() {
        let a = new Rectangle();
        this.c0.add(a);
        a._visibility = 1;
        return a;
    }
    c1(a) {
        a._visibility = 0;
    }
    c3(a) {
        a._visibility = 1;
    }
    c2(a) {
        this.c0.remove(a);
    }
    c4(a, b, c) {
        if (!this.isDirty) {
            this.an();
        }
        a.o = c;
        a.n = b;
    }
    z(a) {
        return this.c0._inner[a];
    }
    y(a) {
        let b = this.c0._inner[a];
        this.c5._visibility = b._visibility;
        this.c5.n = b.n;
        this.c5.o = b.o;
        this.c5.width = b.width;
        this.c5.height = b.height;
        let c = this.bm(a);
        this.c5._fill = c;
        this.c5._stroke = c;
        this.c5.ac = this.e.ey + 3;
        return this.c5;
    }
    a3(a, b) {
        super.a3(a, b);
        if (a.d) {
            for (let c = 0; c < this.c0.count; c++) {
                let d = this.x(c, b);
                this.ba(d, c, b);
                a.v(d);
            }
        }
    }
    ai(a) {
        super.ai(a);
        let b = 0;
        let c = new List$1(Rectangle.$, 0);
        for (let d of fromEnum(this.cz.a)) {
            c.add(d);
        }
        c.aa((e, f) => {
            if (e.n < f.n) {
                return -1;
            }
            else if (e.n > f.n) {
                return 1;
            }
            else {
                return 0;
            }
        });
        for (let e of fromEnum(c)) {
            this.e.a2.exportRectangleData(a, e, "column" + b, ["Main", "Fill"]);
        }
        b++;
    }
}
RangeColumnSeriesView.$t = markType(RangeColumnSeriesView, 'RangeColumnSeriesView', RangeCategorySeriesView.$);
//# sourceMappingURL=RangeColumnSeries_combined.js.map