/*
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 { DependencyProperty } from "igniteui-react-core";
import { ConsolidatedItemsPosition_$type } from "./ConsolidatedItemsPosition";
import { runOn, enumGetBox, markType, markDep, fromEnum } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { Rectangle } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_, isInfinity } from "igniteui-react-core";
import { AnchoredCategorySeriesView } from "./AnchoredCategorySeriesView";
import { DeviceUtils } from "igniteui-react-core";
/**
 * @hidden
 */
export let ColumnSeries = /*@__PURE__*/ (() => {
    class ColumnSeries extends HorizontalAnchoredCategorySeries {
        constructor() {
            super();
            this.tc = null;
            this.s7 = 0;
            this.ab = ColumnSeries.$;
            this.sq = 2;
        }
        bp() {
            return new ColumnSeriesView(this);
        }
        kk(a) {
            super.kk(a);
            this.s6 = a;
        }
        bv() {
            if (this.bw == 0) {
                return 2;
            }
            return super.bv();
        }
        p4() {
            return 1;
        }
        get_cu() {
            return true;
        }
        preferredCategoryMode(a) {
            return this.sq;
        }
        n2(a) {
            if (this.tc == null) {
                this.tc = runOn(this, this.s9);
            }
            let b = this.st != null ? this.st : this.yAxis;
            let c = this.sn;
            return this.rr.c$d(this, a, c, b, this.pv, this.qu(this.bs), this.qv(this.bs), this.tc);
        }
        dy(a, b) {
            if (this.d1(a, b)) {
                return true;
            }
            if (this.ol(a, b)) {
                return true;
            }
            return false;
        }
        jl(a, b) {
            super.jl(a, b);
            let c = b;
            if (a && c.db != null) {
                c.db.count = 0;
            }
        }
        e9() {
            return this.sn.j0(this.bs.bv, this.bs.bu, this.getEffectiveViewport1(this.bs));
        }
        rc(a, b) {
            super.rc(a, b);
            let c = a.f;
            if (!b.t()) {
                return;
            }
            let d = b.bv;
            let e = b.bu;
            let f = this.getEffectiveViewport1(b);
            let g = new ScalerParams(0, d, e, this.st.ca, f);
            g.b = this.fa();
            let h = new ScalerParams(0, d, e, this.sn.ca, f);
            let i = this.st;
            let j = i.dz(i.kn, g);
            let k = this.sn.j0(d, e, f);
            let l = this.sn;
            let m = b;
            if (isNaN_(k) || isInfinity(k)) {
                m.db.count = 0;
                return;
            }
            this.p2.a0(this, this.qm(), runOn(this, this.po), this.qu(b), this.qv(b));
            this.p2.r = this.ta;
            this.p2.s = this.tb;
            this.p2.k = this.ta;
            this.p2.l = this.tb;
            let n = false;
            let o = this.p2.b;
            if (o != null) {
                n = true;
            }
            let p = this.sn.cf;
            let q = p ? this.sn : null;
            let r = this.valueColumn.count;
            let s = this.qu(b);
            let t = 0;
            for (let u = 0; u < c.count; ++u) {
                let v = c._inner[u][0] - 0.5 * k;
                let w = this.s9(c._inner[u]);
                let x = j;
                w = Math.max(w, -100);
                x = Math.min(x, e.bottom + 100);
                let y = Math.abs(x - w);
                if (isInfinity(y)) {
                    continue;
                }
                let z = m.db.item(t);
                t++;
                z.width = k;
                z.height = y;
                if (n) {
                    this.q8(c, u, r, l, h, b.q);
                }
                if (z.dataContext != null) {
                    let aa = z.dataContext;
                    if (s == 1) {
                        let ab = this.p2.au(r, u)[0];
                        if (ab >= 0 && ab < this.cd.count) {
                            if (q != null && q.i$b != null && q.i$b.count > ab) {
                                ab = q.i$b._inner[ab];
                            }
                            aa.item = this.cd.item(ab);
                        }
                    }
                    else {
                        aa.item = null;
                    }
                }
                this.p2.ad(z, false, false, false, false);
                z.am = this.p2.k;
                z.an = this.p2.l;
                m.dg(z, v, Math.min(x, w));
            }
            m.db.count = t;
            b.cy(a);
        }
        get s8() {
            return this.s7;
        }
        set s8(a) {
            if (this.s8 != a) {
                let b = this.s8;
                this.s7 = a;
                this.raisePropertyChanged("ConsolidatedColumnVerticalPosition", enumGetBox(ConsolidatedItemsPosition_$type, b), enumGetBox(ConsolidatedItemsPosition_$type, this.s8));
            }
        }
        s9(a) {
            if (a == null || a.length < 3) {
                return NaN;
            }
            switch (this.s8) {
                case 0: return a[1];
                case 1: return a[2];
                case 2: return (a[1] + a[2]) / 2;
                case 3:
                    let b = (a[1] + a[2]) / 2;
                    if (this.yAxis == null) {
                        return b;
                    }
                    let c = this.yAxis.d2(b, new ScalerParams(1, this.b6.o8, this.b6.o7, this.yAxis.ca));
                    if (c < this.yAxis.kn) {
                        return a[2];
                    }
                    else {
                        return a[1];
                    }
                case 4:
                    let d = (a[1] + a[2]) / 2;
                    let e = this.yAxis.d2(d, new ScalerParams(1, this.b6.o8, this.b6.o7, this.yAxis.ca));
                    if (this.yAxis == null) {
                        return d;
                    }
                    if (e < this.yAxis.kn) {
                        return a[1];
                    }
                    else {
                        return a[2];
                    }
                default: return (a[1] + a[2]) / 2;
            }
        }
        get useHighMarkerFidelity() {
            return this.qp;
        }
    }
    ColumnSeries.$t = /*@__PURE__*/ markType(ColumnSeries, 'ColumnSeries', HorizontalAnchoredCategorySeries.$);
    ColumnSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ColumnSeries, 'raisePropertyChanged', ['RadiusX:ta:tg', [1, 0], 'RadiusY:tb:th', [1, 0]]);
    return ColumnSeries;
})();
/**
 * @hidden
 */
export let ColumnSeriesView = /*@__PURE__*/ (() => {
    class ColumnSeriesView extends AnchoredCategorySeriesView {
        constructor(a) {
            super(a);
            this.da = null;
            this.dc = null;
            this.dh = new Rectangle();
            this.db = null;
            this.da = a;
            this.db = ((() => {
                let $ret = new Pool$1(Rectangle.$);
                $ret.create = runOn(this, this.di);
                $ret.activate = runOn(this, this.dd);
                $ret.disactivate = runOn(this, this.df);
                $ret.destroy = runOn(this, this.de);
                return $ret;
            })());
        }
        as() {
            super.as();
            this.dc = new List$1(Rectangle.$, 0);
            if (!this.q) {
                this.e.fq = 4;
                this.e.bx = 1;
                this.e.fv = DeviceUtils.g(1);
            }
        }
        di() {
            let a = new Rectangle();
            this.dc.add(a);
            a._visibility = 1;
            return a;
        }
        dd(a) {
            a._visibility = 0;
        }
        df(a) {
            a._visibility = 1;
        }
        de(a) {
            this.dc.remove(a);
        }
        dg(a, b, c) {
            if (!this.isDirty) {
                this.aq();
            }
            a.o = c;
            a.n = b;
        }
        ac(a) {
            return this.dc._inner[a];
        }
        ab(a) {
            let b = this.dc._inner[a];
            this.dh._visibility = b._visibility;
            this.dh.n = b.n;
            this.dh.o = b.o;
            this.dh.width = b.width;
            this.dh.height = b.height;
            let c = this.bp(a);
            this.dh._fill = c;
            this.dh._stroke = c;
            this.dh.ac = this.e.eu + 3;
            return this.dh;
        }
        a6(a, b) {
            super.a6(a, b);
            if (a.d) {
                for (let c = 0; c < this.dc.count; c++) {
                    let d = this.aa(c, b);
                    this.bd(d, c, b);
                    a.v(d);
                }
            }
        }
        al(a) {
            super.al(a);
            let b = 0;
            let c = new List$1(Rectangle.$, 0);
            for (let d of fromEnum(this.db.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.a5.exportRectangleData(a, e, "column" + b, ["Main", "Fill"]);
            }
            b++;
        }
    }
    ColumnSeriesView.$t = /*@__PURE__*/ markType(ColumnSeriesView, 'ColumnSeriesView', AnchoredCategorySeriesView.$);
    return ColumnSeriesView;
})();
//# sourceMappingURL=ColumnSeries_combined.js.map
