/*
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.uw = null;
            this.us = null;
            this.uy = null;
            this.uu = 0;
        }
        get ux() {
            if (this.uw == null) {
                this.uw = DVContainer.instance.createInstance(IHorizontalAnchoredCategorySeriesInteractionManager_$type, () => this.cn.n);
            }
            return this.uw;
        }
        kx() {
            super.kx();
            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();
            }
        }
        rs() {
            return this.us;
        }
        sd() {
            return this.uy;
        }
        p1(a) {
            if (this.rt == null || this.rt.m.count == 0 || !this.hasMarkers || !this.qj()) {
                return Rect.empty;
            }
            return this.ux.d$d(this, this.rt.m, a, runOn(this, this.va));
        }
        va(a) {
            return this.tl.c9(a);
        }
        u2(a, b, c) {
            return this.ux.d$c(this, this.sd(), a, b, c);
        }
        ah(a) {
            return this.ux.d$a(this, this.rt.f, this.st(this.b0), this.su(this.b0), a);
        }
        ai(a) {
            return this.ux.d$b(this, this.rt.f, this.st(this.b0), this.su(this.b0), a);
        }
        ex(a, b) {
            if (this.ew(a, b)) {
                return true;
            }
            if (this.qk(a, b)) {
                return true;
            }
            return false;
        }
        getOffsetValue() {
            return this.ry.r(this.rs(), this.b0.bv, this.b0.bu, this.getEffectiveViewport1(this.b0));
        }
        getCategoryWidth() {
            let a = this.getEffectiveViewport1(this.b0);
            return this.rs().getCategorySize(this.b0.bv, this.b0.bu, a);
        }
        gl(a, b, c) {
            if (this.cd == null) {
                return NaN;
            }
            let d = this.getEffectiveViewport1(this.b0);
            let e = this.rs();
            if (e == null) {
                return NaN;
            }
            let f = new ScalerParams(0, this.cd.s9, this.b0.bu, e.cg, d);
            let g = this.ry.r(e, this.cd.s9, this.b0.bu, d);
            return this.gn(this.valueColumn, a, e, f, g, runOn(this, this.sr), b, c);
        }
        hl(a, b) {
            return this.hm(a, b, this.rs(), runOn(this, this.sr), this.valueColumn);
        }
        hj(a, b) {
            return this.hk(a, b, this.rs(), runOn(this, this.sr), this.valueColumn);
        }
        f5(a, b, c, d, e) {
            if (this.valueColumn == null) {
                return Number.POSITIVE_INFINITY;
            }
            return this.f6(a, b, this.rs(), d, e, this.valueColumn.count, runOn(this, this.sr));
        }
        pq(a, b, c) {
            if (this.rs() == null || this.sd() == null) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            return this.ps(a, b, c, this.ry.r(this.rs(), this.b0.bv, this.b0.bu, this.getEffectiveViewport1(this.b0)), this.sd(), this.rs(), null, null, null);
        }
        fetchXAxis() {
            return this.us;
        }
        fetchYAxis() {
            return this.uy;
        }
        t8(a) {
            this.xAxis = typeCast(CategoryAxisBase.$, a);
        }
        t9(a) {
            this.yAxis = typeCast(NumericYAxis.$, a);
        }
        sn() {
            return this.uy != null && this.uy.c0();
        }
        u6(a) {
            this.us = a;
        }
        u7(a) {
            this.uy = a;
        }
        rm(a, b) {
            return this.ti(a, b, this.us);
        }
        l7(a, b, c, d) {
            switch (b) {
                case HorizontalAnchoredCategorySeries.$$p[0]:
                    this.u6(this.xAxis);
                    if (this.tl.c3) {
                        this.tl.c2 = CategoryTrendLineManagerFactory.a(this.tl.c2, this.us, this.nd, this, this.cn);
                    }
                    break;
                case "TrendLineType":
                    let e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                    if (e != 0) {
                        this.tl.c2 = CategoryTrendLineManagerFactory.a(this.tl.c2, this.us, this.nd, this, this.cn);
                    }
                    break;
            }
            super.l7(a, b, c, d);
            switch (b) {
                case HorizontalAnchoredCategorySeries.$$p[0]:
                    if (c != d) {
                        this.k4(typeCast(Axis.$, c));
                        this.mc(typeCast(Axis.$, d));
                        this.u6(this.xAxis);
                        this.r2.cr.g(this.fv);
                        this.ml(false);
                        this.ls();
                    }
                    break;
                case HorizontalAnchoredCategorySeries.$$p[1]:
                    if (c != d) {
                        this.k4(typeCast(Axis.$, c));
                        this.mc(typeCast(Axis.$, d));
                        this.u7(this.yAxis);
                        if (this.cd != null) {
                            this.cd.l5();
                        }
                        this.r2.cr.g(this.fv);
                        this.sn();
                        this.ml(false);
                        this.ls();
                    }
                    break;
                case "CategoryMode":
                    if (this.xAxis != null) {
                        this.xAxis.l4(true);
                    }
                    break;
            }
        }
        k3(a, b, c, d) {
            super.k3(a, b, c, d);
            if (this.us != null && typeCast(ISortingAxis_$type, this.us) !== null) {
                this.us.i$i();
            }
            switch (a) {
                case 4:
                    if (this.us != null) {
                        this.us.c0();
                    }
                    if (this.uy != null && !this.uy.c0()) {
                        this.ml(true);
                    }
                    break;
                case 1:
                    if (this.us != null) {
                        this.us.c0();
                    }
                    if (this.uy != null && !this.uy.c0()) {
                        this.ml(true);
                    }
                    break;
                case 0:
                    if (this.us != null) {
                        this.us.c0();
                    }
                    if (this.uy != null && !this.uy.c0()) {
                        this.ml(true);
                    }
                    break;
                case 2:
                    if (this.tx != null && this.tl.cr.d > 0 && this.uy != null && !this.uy.c0()) {
                        this.ml(true);
                    }
                    break;
                case 3:
                    if (d == this.tx) {
                        if (this.us != null) {
                            this.us.c0();
                        }
                        if (this.uy != null && !this.uy.c0()) {
                            this.ml(true);
                        }
                    }
                    break;
            }
        }
        u0(a) {
            if (typeCast(CategoryXAxis.$, a) !== null || a.cd) {
                return true;
            }
            return false;
        }
        u1(a) {
            if (typeCast(NumericYAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        get uv() {
            return this.uu;
        }
        set uv(a) {
            let b = this.uv;
            if (a != b) {
                this.uu = a;
                this.raisePropertyChanged("CategoryMode", enumGetBox(CategoryMode_$type, b), enumGetBox(CategoryMode_$type, this.uv));
            }
        }
        get useHighMarkerFidelity() {
            return this.so;
        }
    }
    HorizontalAnchoredCategorySeries.$t = markType(HorizontalAnchoredCategorySeries, 'HorizontalAnchoredCategorySeries', AnchoredCategorySeries.$);
    HorizontalAnchoredCategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, HorizontalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::u8', [CategoryAxisBase.$, null], 'YAxis::u9', [NumericYAxis.$, null]]);
    return HorizontalAnchoredCategorySeries;
})();
