/*
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.ach = null;
            this.acd = null;
            this.acj = null;
            this.acf = 0;
        }
        get aci() {
            if (this.ach == null) {
                this.ach = DVContainer.instance.createInstance(IHorizontalAnchoredCategorySeriesInteractionManager_$type, () => this.dr.n);
            }
            return this.ach;
        }
        o2() {
            super.o2();
            this.xAxis = null;
            this.yAxis = null;
        }
        ck() {
            return 1;
        }
        cl() {
            if (this.yAxis != null && this.yAxis.ch) {
                return 4;
            }
            return 3;
        }
        b2() {
            if (this.b3 == 0) {
                return 1;
            }
            else {
                return super.b2();
            }
        }
        ys() {
            return this.acd;
        }
        y9() {
            return this.acj;
        }
        wp(a) {
            if (this.yu == null || this.yu.n.count == 0 || !this.hasMarkers || !this.xg()) {
                return Rect.empty;
            }
            return this.aci.d$d(this, this.yu.n, a, runOn(this, this.acv));
        }
        acv(a) {
            return this.aav.de(a);
        }
        acn(a, b, c) {
            return this.aci.d$c(this, this.y9(), a, b, c);
        }
        aj(a) {
            return this.aci.d$a(this, this.yu.f, this.zv(this.cv), this.zw(this.cv), a);
        }
        al(a) {
            return this.aci.d$b(this, this.yu.f, this.zv(this.cv), this.zw(this.cv), a);
        }
        gw(a, b) {
            if (this.gv(a, b)) {
                return true;
            }
            if (this.xh(a, b)) {
                return true;
            }
            return false;
        }
        getOffsetValue() {
            return this.yz.r(this.ys(), this.cv.by, this.cv.bx, this.getEffectiveViewport1(this.cv));
        }
        getCategoryWidth() {
            let a = this.getEffectiveViewport1(this.cv);
            return this.ys().getCategorySize(this.cv.by, this.cv.bx, a);
        }
        i5(a, b, c) {
            if (this.db == null) {
                return NaN;
            }
            let d = this.getEffectiveViewport1(this.cv);
            let e = this.ys();
            if (e == null) {
                return NaN;
            }
            let f = new ScalerParams(0, this.db.v4, this.cv.bx, e.ch, d);
            let g = this.yz.r(e, this.db.v4, this.cv.bx, d);
            return this.i7(this.valueColumn, a, e, f, g, runOn(this, this.zt), b, c);
        }
        ka(a, b) {
            return this.kb(a, b, this.ys(), runOn(this, this.zt), this.valueColumn);
        }
        j8(a, b) {
            return this.j9(a, b, this.ys(), runOn(this, this.zt), this.valueColumn);
        }
        ip(a, b, c, d, e) {
            if (this.valueColumn == null) {
                return Number.POSITIVE_INFINITY;
            }
            return this.iq(a, b, this.ys(), d, e, this.valueColumn.count, runOn(this, this.zt));
        }
        wc(a, b, c) {
            if (this.ys() == null || this.y9() == null) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            return this.we(a, b, c, this.yz.r(this.ys(), this.cv.by, this.cv.bx, this.getEffectiveViewport1(this.cv)), this.y9(), this.ys(), null, null, null);
        }
        fetchXAxis() {
            return this.acd;
        }
        fetchYAxis() {
            return this.acj;
        }
        abr(a) {
            this.xAxis = typeCast(CategoryAxisBase.$, a);
        }
        abs(a) {
            this.yAxis = typeCast(NumericYAxis.$, a);
        }
        zp() {
            return this.acj != null && this.acj.c1();
        }
        acr(a) {
            this.acd = a;
        }
        acs(a) {
            this.acj = a;
        }
        ym(a, b) {
            return this.aas(a, b, this.acd);
        }
        q9(a, b, c, d) {
            switch (b) {
                case HorizontalAnchoredCategorySeries.$$p[0]:
                    this.acr(this.xAxis);
                    if (this.aav.c8) {
                        this.aav.c7 = CategoryTrendLineManagerFactory.a(this.aav.c7, this.acd, this.sv, this, this.dr);
                    }
                    break;
                case "TrendLineType":
                    let e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                    if (e != 0) {
                        this.aav.c7 = CategoryTrendLineManagerFactory.a(this.aav.c7, this.acd, this.sv, this, this.dr);
                    }
                    break;
            }
            super.q9(a, b, c, d);
            switch (b) {
                case HorizontalAnchoredCategorySeries.$$p[0]:
                    if (c != d) {
                        this.pc(typeCast(Axis.$, c));
                        this.rh(typeCast(Axis.$, d));
                        this.acr(this.xAxis);
                        this.y3.cw.g(this.id);
                        this.rr(false);
                        this.ql();
                    }
                    break;
                case HorizontalAnchoredCategorySeries.$$p[1]:
                    if (c != d) {
                        this.pc(typeCast(Axis.$, c));
                        this.rh(typeCast(Axis.$, d));
                        this.acs(this.yAxis);
                        if (this.db != null) {
                            this.db.n2();
                        }
                        this.y3.cw.g(this.id);
                        this.zp();
                        this.rr(false);
                        this.ql();
                    }
                    break;
                case "CategoryMode":
                    if (this.xAxis != null) {
                        this.xAxis.ma(true);
                    }
                    break;
            }
        }
        pb(a, b, c, d) {
            super.pb(a, b, c, d);
            if (this.acd != null && typeCast(ISortingAxis_$type, this.acd) !== null) {
                this.acd.i$i();
            }
            switch (a) {
                case 4:
                    if (this.acd != null) {
                        this.acd.c1();
                    }
                    if (this.acj != null && !this.acj.c1()) {
                        this.rr(true);
                    }
                    break;
                case 1:
                    if (this.acd != null) {
                        this.acd.c1();
                    }
                    if (this.acj != null && !this.acj.c1()) {
                        this.rr(true);
                    }
                    break;
                case 0:
                    if (this.acd != null) {
                        this.acd.c1();
                    }
                    if (this.acj != null && !this.acj.c1()) {
                        this.rr(true);
                    }
                    break;
                case 2:
                    if (this.abd != null && this.aav.cw.d > 0 && this.acj != null && !this.acj.c1()) {
                        this.rr(true);
                    }
                    break;
                case 3:
                    if (d == this.abd) {
                        if (this.acd != null) {
                            this.acd.c1();
                        }
                        if (this.acj != null && !this.acj.c1()) {
                            this.rr(true);
                        }
                    }
                    break;
            }
        }
        acl(a) {
            if (typeCast(CategoryXAxis.$, a) !== null || a.ce) {
                return true;
            }
            return false;
        }
        acm(a) {
            if (typeCast(NumericYAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        get acg() {
            return this.acf;
        }
        set acg(a) {
            let b = this.acg;
            if (a != b) {
                this.acf = a;
                this.raisePropertyChanged("CategoryMode", enumGetBox(CategoryMode_$type, b), enumGetBox(CategoryMode_$type, this.acg));
            }
        }
        get useHighMarkerFidelity() {
            return this.zq;
        }
    }
    HorizontalAnchoredCategorySeries.$t = markType(HorizontalAnchoredCategorySeries, 'HorizontalAnchoredCategorySeries', AnchoredCategorySeries.$);
    HorizontalAnchoredCategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, HorizontalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::act', [CategoryAxisBase.$, null], 'YAxis::acu', [NumericYAxis.$, null]]);
    return HorizontalAnchoredCategorySeries;
})();
