/*
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 { AnchoredCategorySeries } from "./AnchoredCategorySeries";
import { IHorizontalAnchoredCategorySeriesInteractionManager_$type } from "./IHorizontalAnchoredCategorySeriesInteractionManager";
import { DVContainer } from "igniteui-angular-core";
import { runOn, Point_$type, typeCast, EnumUtil, enumGetBox, markType, markDep } from "igniteui-angular-core";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { DependencyProperty } from "igniteui-angular-core";
import { NumericYAxis } from "./NumericYAxis";
import { CategoryMode_$type } from "./CategoryMode";
import { Axis } from "./Axis";
import { Rect } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { TrendLineType_$type } from "igniteui-angular-core";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
import { ISortingAxis_$type } from "./ISortingAxis";
import { CategoryXAxis } from "./CategoryXAxis";
import { PropertyMetadata } from "igniteui-angular-core";
/**
 * @hidden
 */
export let HorizontalAnchoredCategorySeries = /*@__PURE__*/ (() => {
    class HorizontalAnchoredCategorySeries extends AnchoredCategorySeries {
        constructor() {
            super(...arguments);
            this.ur = null;
            this.un = null;
            this.ut = null;
            this.up = 0;
        }
        get us() {
            if (this.ur == null) {
                this.ur = DVContainer.instance.createInstance(IHorizontalAnchoredCategorySeriesInteractionManager_$type, () => this.cn.n);
            }
            return this.ur;
        }
        ku() {
            super.ku();
            this.xAxis = null;
            this.yAxis = null;
        }
        bv() {
            return 1;
        }
        bw() {
            if (this.yAxis != null && this.yAxis.cg) {
                return 4;
            }
            return 3;
        }
        bp() {
            if (this.bq == 0) {
                return 1;
            }
            else {
                return super.bp();
            }
        }
        rn() {
            return this.un;
        }
        r8() {
            return this.ut;
        }
        pw(a) {
            if (this.ro == null || this.ro.m.count == 0 || !this.hasMarkers || !this.qe()) {
                return Rect.empty;
            }
            return this.us.d$d(this, this.ro.m, a, runOn(this, this.u5));
        }
        u5(a) {
            return this.tg.c9(a);
        }
        ux(a, b, c) {
            return this.us.d$c(this, this.r8(), a, b, c);
        }
        ah(a) {
            return this.us.d$a(this, this.ro.f, this.so(this.b0), this.sp(this.b0), a);
        }
        ai(a) {
            return this.us.d$b(this, this.ro.f, this.so(this.b0), this.sp(this.b0), a);
        }
        ev(a, b) {
            if (this.eu(a, b)) {
                return true;
            }
            if (this.qf(a, b)) {
                return true;
            }
            return false;
        }
        getOffsetValue() {
            return this.rt.r(this.rn(), this.b0.bv, this.b0.bu, this.getEffectiveViewport1(this.b0));
        }
        getCategoryWidth() {
            let a = this.getEffectiveViewport1(this.b0);
            return this.rn().getCategorySize(this.b0.bv, this.b0.bu, a);
        }
        gj(a, b, c) {
            if (this.cd == null) {
                return NaN;
            }
            let d = this.getEffectiveViewport1(this.b0);
            let e = this.rn();
            if (e == null) {
                return NaN;
            }
            let f = new ScalerParams(0, this.cd.sf, this.b0.bu, e.cg, d);
            let g = this.rt.r(e, this.cd.sf, this.b0.bu, d);
            return this.gl(this.valueColumn, a, e, f, g, runOn(this, this.sm), b, c);
        }
        hj(a, b) {
            return this.hk(a, b, this.rn(), runOn(this, this.sm), this.valueColumn);
        }
        hh(a, b) {
            return this.hi(a, b, this.rn(), runOn(this, this.sm), this.valueColumn);
        }
        f3(a, b, c, d, e) {
            if (this.valueColumn == null) {
                return Number.POSITIVE_INFINITY;
            }
            return this.f4(a, b, this.rn(), d, e, this.valueColumn.count, runOn(this, this.sm));
        }
        pl(a, b, c) {
            if (this.rn() == null || this.r8() == null) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            return this.pn(a, b, c, this.rt.r(this.rn(), this.b0.bv, this.b0.bu, this.getEffectiveViewport1(this.b0)), this.r8(), this.rn(), null, null, null);
        }
        fetchXAxis() {
            return this.un;
        }
        fetchYAxis() {
            return this.ut;
        }
        t3(a) {
            this.xAxis = typeCast(CategoryAxisBase.$, a);
        }
        t4(a) {
            this.yAxis = typeCast(NumericYAxis.$, a);
        }
        si() {
            return this.ut != null && this.ut.c0();
        }
        u1(a) {
            this.un = a;
        }
        u2(a) {
            this.ut = a;
        }
        rh(a, b) {
            return this.td(a, b, this.un);
        }
        l3(a, b, c, d) {
            switch (b) {
                case HorizontalAnchoredCategorySeries.$$p[0]:
                    this.u1(this.xAxis);
                    if (this.tg.c3) {
                        this.tg.c2 = CategoryTrendLineManagerFactory.a(this.tg.c2, this.un, this.m9, this, this.cn);
                    }
                    break;
                case "TrendLineType":
                    let e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                    if (e != 0) {
                        this.tg.c2 = CategoryTrendLineManagerFactory.a(this.tg.c2, this.un, this.m9, this, this.cn);
                    }
                    break;
            }
            super.l3(a, b, c, d);
            switch (b) {
                case HorizontalAnchoredCategorySeries.$$p[0]:
                    if (c != d) {
                        this.k1(typeCast(Axis.$, c));
                        this.l8(typeCast(Axis.$, d));
                        this.u1(this.xAxis);
                        this.rx.cr.g(this.ft);
                        this.mh(false);
                        this.lo();
                    }
                    break;
                case HorizontalAnchoredCategorySeries.$$p[1]:
                    if (c != d) {
                        this.k1(typeCast(Axis.$, c));
                        this.l8(typeCast(Axis.$, d));
                        this.u2(this.yAxis);
                        if (this.cd != null) {
                            this.cd.li();
                        }
                        this.rx.cr.g(this.ft);
                        this.si();
                        this.mh(false);
                        this.lo();
                    }
                    break;
                case "CategoryMode":
                    if (this.xAxis != null) {
                        this.xAxis.l4(true);
                    }
                    break;
            }
        }
        k0(a, b, c, d) {
            super.k0(a, b, c, d);
            if (this.un != null && typeCast(ISortingAxis_$type, this.un) !== null) {
                this.un.i$i();
            }
            switch (a) {
                case 4:
                    if (this.un != null) {
                        this.un.c0();
                    }
                    if (this.ut != null && !this.ut.c0()) {
                        this.mh(true);
                    }
                    break;
                case 1:
                    if (this.un != null) {
                        this.un.c0();
                    }
                    if (this.ut != null && !this.ut.c0()) {
                        this.mh(true);
                    }
                    break;
                case 0:
                    if (this.un != null) {
                        this.un.c0();
                    }
                    if (this.ut != null && !this.ut.c0()) {
                        this.mh(true);
                    }
                    break;
                case 2:
                    if (this.ts != null && this.tg.cr.d > 0 && this.ut != null && !this.ut.c0()) {
                        this.mh(true);
                    }
                    break;
                case 3:
                    if (d == this.ts) {
                        if (this.un != null) {
                            this.un.c0();
                        }
                        if (this.ut != null && !this.ut.c0()) {
                            this.mh(true);
                        }
                    }
                    break;
            }
        }
        uv(a) {
            if (typeCast(CategoryXAxis.$, a) !== null || a.cd) {
                return true;
            }
            return false;
        }
        uw(a) {
            if (typeCast(NumericYAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        get uq() {
            return this.up;
        }
        set uq(a) {
            let b = this.uq;
            if (a != b) {
                this.up = a;
                this.raisePropertyChanged("CategoryMode", enumGetBox(CategoryMode_$type, b), enumGetBox(CategoryMode_$type, this.uq));
            }
        }
        get useHighMarkerFidelity() {
            return this.sj;
        }
    }
    HorizontalAnchoredCategorySeries.$t = markType(HorizontalAnchoredCategorySeries, 'HorizontalAnchoredCategorySeries', AnchoredCategorySeries.$);
    HorizontalAnchoredCategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, HorizontalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::u3', [CategoryAxisBase.$, null], 'YAxis::u4', [NumericYAxis.$, null]]);
    return HorizontalAnchoredCategorySeries;
})();
