/*
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.y1 = null;
        _this.yx = null;
        _this.y3 = null;
        _this.yz = 0;
        return _this;
    }
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "y2", {
        get: function () {
            var _this = this;
            if (this.y1 == null) {
                this.y1 = DVContainer.instance.createInstance(IHorizontalAnchoredCategorySeriesInteractionManager_$type, function () { return _this.da.n; });
            }
            return this.y1;
        },
        enumerable: false,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.prototype.nh = function () {
        _super.prototype.nh.call(this);
        this.xAxis = null;
        this.yAxis = null;
    };
    HorizontalAnchoredCategorySeries.prototype.cb = function () {
        return 1;
    };
    HorizontalAnchoredCategorySeries.prototype.cc = function () {
        if (this.yAxis != null && this.yAxis.ch) {
            return 4;
        }
        return 3;
    };
    HorizontalAnchoredCategorySeries.prototype.bu = function () {
        if (this.bv == 0) {
            return 1;
        }
        else {
            return _super.prototype.bu.call(this);
        }
    };
    HorizontalAnchoredCategorySeries.prototype.vn = function () {
        return this.yx;
    };
    HorizontalAnchoredCategorySeries.prototype.v3 = function () {
        return this.y3;
    };
    HorizontalAnchoredCategorySeries.prototype.tw = function (a) {
        if (this.vo == null || this.vo.m.count == 0 || !this.hasMarkers || !this.ue()) {
            return Rect.empty;
        }
        return this.y2.d$d(this, this.vo.m, a, runOn(this, this.zf));
    };
    HorizontalAnchoredCategorySeries.prototype.zf = function (a) {
        return this.xh.dc(a);
    };
    HorizontalAnchoredCategorySeries.prototype.y7 = function (a, b, c) {
        return this.y2.d$c(this, this.v3(), a, b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.ah = function (a) {
        return this.y2.d$a(this, this.vo.f, this.wp(this.cg), this.wq(this.cg), a);
    };
    HorizontalAnchoredCategorySeries.prototype.ai = function (a) {
        return this.y2.d$b(this, this.vo.f, this.wp(this.cg), this.wq(this.cg), a);
    };
    HorizontalAnchoredCategorySeries.prototype.f5 = function (a, b) {
        if (this.f4(a, b)) {
            return true;
        }
        if (this.uf(a, b)) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.getOffsetValue = function () {
        return this.vt.r(this.vn(), this.cg.by, this.cg.bx, this.getEffectiveViewport1(this.cg));
    };
    HorizontalAnchoredCategorySeries.prototype.getCategoryWidth = function () {
        var a = this.getEffectiveViewport1(this.cg);
        return this.vn().getCategorySize(this.cg.by, this.cg.bx, a);
    };
    HorizontalAnchoredCategorySeries.prototype.ia = function (a, b, c) {
        if (this.cv == null) {
            return NaN;
        }
        var d = this.getEffectiveViewport1(this.cg);
        var e = this.vn();
        if (e == null) {
            return NaN;
        }
        var f = new ScalerParams(0, this.cv.tr, this.cg.bx, e.ch, d);
        var g = this.vt.r(e, this.cv.tr, this.cg.bx, d);
        return this.ic(this.valueColumn, a, e, f, g, runOn(this, this.wn), b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.jg = function (a, b) {
        return this.jh(a, b, this.vn(), runOn(this, this.wn), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.je = function (a, b) {
        return this.jf(a, b, this.vn(), runOn(this, this.wn), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.hu = function (a, b, c, d, e) {
        if (this.valueColumn == null) {
            return Number.POSITIVE_INFINITY;
        }
        return this.hv(a, b, this.vn(), d, e, this.valueColumn.count, runOn(this, this.wn));
    };
    HorizontalAnchoredCategorySeries.prototype.tj = function (a, b, c) {
        if (this.vn() == null || this.v3() == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        return this.tl(a, b, c, this.vt.r(this.vn(), this.cg.by, this.cg.bx, this.getEffectiveViewport1(this.cg)), this.v3(), this.vn(), null, null, null);
    };
    HorizontalAnchoredCategorySeries.prototype.fetchXAxis = function () {
        return this.yx;
    };
    HorizontalAnchoredCategorySeries.prototype.fetchYAxis = function () {
        return this.y3;
    };
    HorizontalAnchoredCategorySeries.prototype.yb = function (a) {
        this.xAxis = typeCast(CategoryAxisBase.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.yc = function (a) {
        this.yAxis = typeCast(NumericYAxis.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.wj = function () {
        return this.y3 != null && this.y3.c1();
    };
    HorizontalAnchoredCategorySeries.prototype.zb = function (a) {
        this.yx = a;
    };
    HorizontalAnchoredCategorySeries.prototype.zc = function (a) {
        this.y3 = a;
    };
    HorizontalAnchoredCategorySeries.prototype.vh = function (a, b) {
        return this.xe(a, b, this.yx);
    };
    HorizontalAnchoredCategorySeries.prototype.pa = function (a, b, c, d) {
        switch (b) {
            case HorizontalAnchoredCategorySeries.$$p[0]:
                this.zb(this.xAxis);
                if (this.xh.c6) {
                    this.xh.c5 = CategoryTrendLineManagerFactory.a(this.xh.c5, this.yx, this.qt, this, this.da);
                }
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.xh.c5 = CategoryTrendLineManagerFactory.a(this.xh.c5, this.yx, this.qt, this, this.da);
                }
                break;
        }
        _super.prototype.pa.call(this, a, b, c, d);
        switch (b) {
            case HorizontalAnchoredCategorySeries.$$p[0]:
                if (c != d) {
                    this.nq(typeCast(Axis.$, c));
                    this.ph(typeCast(Axis.$, d));
                    this.zb(this.xAxis);
                    this.vx.cu.g(this.hk);
                    this.pr(false);
                    this.om();
                }
                break;
            case HorizontalAnchoredCategorySeries.$$p[1]:
                if (c != d) {
                    this.nq(typeCast(Axis.$, c));
                    this.ph(typeCast(Axis.$, d));
                    this.zc(this.yAxis);
                    if (this.cv != null) {
                        this.cv.mg();
                    }
                    this.vx.cu.g(this.hk);
                    this.wj();
                    this.pr(false);
                    this.om();
                }
                break;
            case "CategoryMode":
                if (this.xAxis != null) {
                    this.xAxis.l5(true);
                }
                break;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.np = function (a, b, c, d) {
        _super.prototype.np.call(this, a, b, c, d);
        if (this.yx != null && typeCast(ISortingAxis_$type, this.yx) !== null) {
            this.yx.i$i();
        }
        switch (a) {
            case 4:
                if (this.yx != null) {
                    this.yx.c1();
                }
                if (this.y3 != null && !this.y3.c1()) {
                    this.pr(true);
                }
                break;
            case 1:
                if (this.yx != null) {
                    this.yx.c1();
                }
                if (this.y3 != null && !this.y3.c1()) {
                    this.pr(true);
                }
                break;
            case 0:
                if (this.yx != null) {
                    this.yx.c1();
                }
                if (this.y3 != null && !this.y3.c1()) {
                    this.pr(true);
                }
                break;
            case 2:
                if (this.xx != null && this.xh.cu.d > 0 && this.y3 != null && !this.y3.c1()) {
                    this.pr(true);
                }
                break;
            case 3:
                if (d == this.xx) {
                    if (this.yx != null) {
                        this.yx.c1();
                    }
                    if (this.y3 != null && !this.y3.c1()) {
                        this.pr(true);
                    }
                }
                break;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.y5 = function (a) {
        if (typeCast(CategoryXAxis.$, a) !== null || a.ce) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.y6 = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "y0", {
        get: function () {
            return this.yz;
        },
        set: function (a) {
            var b = this.y0;
            if (a != b) {
                this.yz = a;
                this.raisePropertyChanged("CategoryMode", enumGetBox(CategoryMode_$type, b), enumGetBox(CategoryMode_$type, this.y0));
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.wk;
        },
        enumerable: false,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.$t = markType(HorizontalAnchoredCategorySeries, 'HorizontalAnchoredCategorySeries', AnchoredCategorySeries.$);
    HorizontalAnchoredCategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, HorizontalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::zd', [CategoryAxisBase.$, null], 'YAxis::ze', [NumericYAxis.$, null]]);
    return HorizontalAnchoredCategorySeries;
}(AnchoredCategorySeries));
export { HorizontalAnchoredCategorySeries };
