/*
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 { __extends } from "tslib";
import { AnchoredCategorySeries } from "./AnchoredCategorySeries";
import { IHorizontalAnchoredCategorySeriesInteractionManager_$type } from "./IHorizontalAnchoredCategorySeriesInteractionManager";
import { DVContainer } from "igniteui-react-core";
import { runOn, Point_$type, typeCast, EnumUtil, enumGetBox, markType, markDep } from "igniteui-react-core";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { DependencyProperty } from "igniteui-react-core";
import { NumericYAxis } from "./NumericYAxis";
import { CategoryMode_$type } from "./CategoryMode";
import { Axis } from "./Axis";
import { Rect } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { TrendLineType_$type } from "igniteui-react-core";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
import { ISortingAxis_$type } from "./ISortingAxis";
import { CategoryXAxis } from "./CategoryXAxis";
import { PropertyMetadata } from "igniteui-react-core";
/**
 * @hidden
 */
var HorizontalAnchoredCategorySeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(HorizontalAnchoredCategorySeries, _super);
    function HorizontalAnchoredCategorySeries() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.yz = null;
        _this.yv = null;
        _this.y1 = null;
        _this.yx = 0;
        return _this;
    }
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "y0", {
        get: function () {
            var _this = this;
            if (this.yz == null) {
                this.yz = DVContainer.instance.createInstance(IHorizontalAnchoredCategorySeriesInteractionManager_$type, function () { return _this.c9.n; });
            }
            return this.yz;
        },
        enumerable: false,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.prototype.ng = function () {
        _super.prototype.ng.call(this);
        this.xAxis = null;
        this.yAxis = null;
    };
    HorizontalAnchoredCategorySeries.prototype.ce = function () {
        return 1;
    };
    HorizontalAnchoredCategorySeries.prototype.cf = function () {
        if (this.yAxis != null && this.yAxis.ch) {
            return 4;
        }
        return 3;
    };
    HorizontalAnchoredCategorySeries.prototype.bx = function () {
        if (this.by == 0) {
            return 1;
        }
        else {
            return _super.prototype.bx.call(this);
        }
    };
    HorizontalAnchoredCategorySeries.prototype.vl = function () {
        return this.yv;
    };
    HorizontalAnchoredCategorySeries.prototype.v6 = function () {
        return this.y1;
    };
    HorizontalAnchoredCategorySeries.prototype.tu = function (a) {
        if (this.vm == null || this.vm.m.count == 0 || !this.hasMarkers || !this.uc()) {
            return Rect.empty;
        }
        return this.y0.d$d(this, this.vm.m, a, runOn(this, this.zd));
    };
    HorizontalAnchoredCategorySeries.prototype.zd = function (a) {
        return this.xf.dc(a);
    };
    HorizontalAnchoredCategorySeries.prototype.y5 = function (a, b, c) {
        return this.y0.d$c(this, this.v6(), a, b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.ah = function (a) {
        return this.y0.d$a(this, this.vm.f, this.wn(this.cj), this.wo(this.cj), a);
    };
    HorizontalAnchoredCategorySeries.prototype.ai = function (a) {
        return this.y0.d$b(this, this.vm.f, this.wn(this.cj), this.wo(this.cj), a);
    };
    HorizontalAnchoredCategorySeries.prototype.f4 = function (a, b) {
        if (this.f3(a, b)) {
            return true;
        }
        if (this.ud(a, b)) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.getOffsetValue = function () {
        return this.vr.r(this.vl(), this.cj.by, this.cj.bx, this.getEffectiveViewport1(this.cj));
    };
    HorizontalAnchoredCategorySeries.prototype.getCategoryWidth = function () {
        var a = this.getEffectiveViewport1(this.cj);
        return this.vl().getCategorySize(this.cj.by, this.cj.bx, a);
    };
    HorizontalAnchoredCategorySeries.prototype.h9 = function (a, b, c) {
        if (this.cy == null) {
            return NaN;
        }
        var d = this.getEffectiveViewport1(this.cj);
        var e = this.vl();
        if (e == null) {
            return NaN;
        }
        var f = new ScalerParams(0, this.cy.tn, this.cj.bx, e.ch, d);
        var g = this.vr.r(e, this.cy.tn, this.cj.bx, d);
        return this.ib(this.valueColumn, a, e, f, g, runOn(this, this.wl), b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.jf = function (a, b) {
        return this.jg(a, b, this.vl(), runOn(this, this.wl), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.jd = function (a, b) {
        return this.je(a, b, this.vl(), runOn(this, this.wl), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.ht = function (a, b, c, d, e) {
        if (this.valueColumn == null) {
            return Number.POSITIVE_INFINITY;
        }
        return this.hu(a, b, this.vl(), d, e, this.valueColumn.count, runOn(this, this.wl));
    };
    HorizontalAnchoredCategorySeries.prototype.th = function (a, b, c) {
        if (this.vl() == null || this.v6() == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        return this.tj(a, b, c, this.vr.r(this.vl(), this.cj.by, this.cj.bx, this.getEffectiveViewport1(this.cj)), this.v6(), this.vl(), null, null, null);
    };
    HorizontalAnchoredCategorySeries.prototype.fetchXAxis = function () {
        return this.yv;
    };
    HorizontalAnchoredCategorySeries.prototype.fetchYAxis = function () {
        return this.y1;
    };
    HorizontalAnchoredCategorySeries.prototype.x9 = function (a) {
        this.xAxis = typeCast(CategoryAxisBase.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.ya = function (a) {
        this.yAxis = typeCast(NumericYAxis.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.wh = function () {
        return this.y1 != null && this.y1.c1();
    };
    HorizontalAnchoredCategorySeries.prototype.y9 = function (a) {
        this.yv = a;
    };
    HorizontalAnchoredCategorySeries.prototype.za = function (a) {
        this.y1 = a;
    };
    HorizontalAnchoredCategorySeries.prototype.vf = function (a, b) {
        return this.xc(a, b, this.yv);
    };
    HorizontalAnchoredCategorySeries.prototype.o8 = function (a, b, c, d) {
        switch (b) {
            case HorizontalAnchoredCategorySeries.$$p[0]:
                this.y9(this.xAxis);
                if (this.xf.c6) {
                    this.xf.c5 = CategoryTrendLineManagerFactory.a(this.xf.c5, this.yv, this.qr, this, this.c9);
                }
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.xf.c5 = CategoryTrendLineManagerFactory.a(this.xf.c5, this.yv, this.qr, this, this.c9);
                }
                break;
        }
        _super.prototype.o8.call(this, a, b, c, d);
        switch (b) {
            case HorizontalAnchoredCategorySeries.$$p[0]:
                if (c != d) {
                    this.np(typeCast(Axis.$, c));
                    this.pf(typeCast(Axis.$, d));
                    this.y9(this.xAxis);
                    this.vv.cu.g(this.hj);
                    this.pp(false);
                    this.ol();
                }
                break;
            case HorizontalAnchoredCategorySeries.$$p[1]:
                if (c != d) {
                    this.np(typeCast(Axis.$, c));
                    this.pf(typeCast(Axis.$, d));
                    this.za(this.yAxis);
                    if (this.cy != null) {
                        this.cy.mf();
                    }
                    this.vv.cu.g(this.hj);
                    this.wh();
                    this.pp(false);
                    this.ol();
                }
                break;
            case "CategoryMode":
                if (this.xAxis != null) {
                    this.xAxis.l5(true);
                }
                break;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.no = function (a, b, c, d) {
        _super.prototype.no.call(this, a, b, c, d);
        if (this.yv != null && typeCast(ISortingAxis_$type, this.yv) !== null) {
            this.yv.i$i();
        }
        switch (a) {
            case 4:
                if (this.yv != null) {
                    this.yv.c1();
                }
                if (this.y1 != null && !this.y1.c1()) {
                    this.pp(true);
                }
                break;
            case 1:
                if (this.yv != null) {
                    this.yv.c1();
                }
                if (this.y1 != null && !this.y1.c1()) {
                    this.pp(true);
                }
                break;
            case 0:
                if (this.yv != null) {
                    this.yv.c1();
                }
                if (this.y1 != null && !this.y1.c1()) {
                    this.pp(true);
                }
                break;
            case 2:
                if (this.xv != null && this.xf.cu.d > 0 && this.y1 != null && !this.y1.c1()) {
                    this.pp(true);
                }
                break;
            case 3:
                if (d == this.xv) {
                    if (this.yv != null) {
                        this.yv.c1();
                    }
                    if (this.y1 != null && !this.y1.c1()) {
                        this.pp(true);
                    }
                }
                break;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.y3 = function (a) {
        if (typeCast(CategoryXAxis.$, a) !== null || a.ce) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.y4 = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "yy", {
        get: function () {
            return this.yx;
        },
        set: function (a) {
            var b = this.yy;
            if (a != b) {
                this.yx = a;
                this.raisePropertyChanged("CategoryMode", enumGetBox(CategoryMode_$type, b), enumGetBox(CategoryMode_$type, this.yy));
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.wi;
        },
        enumerable: false,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.$t = markType(HorizontalAnchoredCategorySeries, 'HorizontalAnchoredCategorySeries', AnchoredCategorySeries.$);
    HorizontalAnchoredCategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, HorizontalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::zb', [CategoryAxisBase.$, null], 'YAxis::zc', [NumericYAxis.$, null]]);
    return HorizontalAnchoredCategorySeries;
}(AnchoredCategorySeries));
export { HorizontalAnchoredCategorySeries };
