/*
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 * as tslib_1 from "tslib";
import { AnchoredCategorySeries } from "./AnchoredCategorySeries";
import { IHorizontalAnchoredCategorySeriesInteractionManager_$type } from "./IHorizontalAnchoredCategorySeriesInteractionManager";
import { DVContainer } from "igniteui-react-core/ES5/DVContainer";
import { Type, runOn, Point_$type, typeCast, EnumUtil, enumGetBox, markType } from "igniteui-react-core/ES5/type";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { DependencyProperty } from "igniteui-react-core/ES5/DependencyProperty";
import { NumericYAxis } from "./NumericYAxis";
import { CategoryMode_$type } from "./CategoryMode";
import { Rect } from "igniteui-react-core/ES5/Rect";
import { ScalerParams } from "./ScalerParams";
import { Axis } from "./Axis";
import { TrendLineType_$type } from "igniteui-react-core/ES5/TrendLineType";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
import { ISortingAxis_$type } from "./ISortingAxis";
import { CategoryXAxis } from "./CategoryXAxis";
import { PropertyMetadata } from "igniteui-react-core/ES5/PropertyMetadata";
var HorizontalAnchoredCategorySeries = /** @class */ (function (_super) {
    tslib_1.__extends(HorizontalAnchoredCategorySeries, _super);
    function HorizontalAnchoredCategorySeries() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.pt = null;
        _this.pp = null;
        _this.pv = null;
        _this.pr = 0;
        return _this;
    }
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "pu", {
        get: function () {
            var _this = this;
            if (this.pt == null) {
                this.pt = DVContainer.instance.createInstance(IHorizontalAnchoredCategorySeriesInteractionManager_$type, function () { return _this.b2.n; });
            }
            return this.pt;
        },
        enumerable: true,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.prototype.hm = function () {
        _super.prototype.hm.call(this);
        this.xAxis = null;
        this.yAxis = null;
    };
    HorizontalAnchoredCategorySeries.prototype.bd = function () {
        if (this.be == 0) {
            return 1;
        }
        else {
            return _super.prototype.bd.call(this);
        }
    };
    HorizontalAnchoredCategorySeries.prototype.mx = function () {
        return this.pp;
    };
    HorizontalAnchoredCategorySeries.prototype.nh = function () {
        return this.pv;
    };
    HorizontalAnchoredCategorySeries.prototype.ln = function (a) {
        if (this.my == null || this.my.m.count == 0 || !this.hasMarkers || !this.lu()) {
            return Rect.empty;
        }
        return this.pu.d$d(this, this.my.m, a, runOn(this, this.p7));
    };
    HorizontalAnchoredCategorySeries.prototype.p7 = function (a) {
        return this.op.c5(a);
    };
    HorizontalAnchoredCategorySeries.prototype.pz = function (a, b, c) {
        return this.pu.d$c(this, this.nh(), a, b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.ah = function (a) {
        return this.pu.d$a(this, this.my.f, this.ny(this.bi), this.nz(this.bi), a);
    };
    HorizontalAnchoredCategorySeries.prototype.ai = function (a) {
        return this.pu.d$b(this, this.my.f, this.ny(this.bi), this.nz(this.bi), a);
    };
    HorizontalAnchoredCategorySeries.prototype.df = function (a, b) {
        if (this.de(a, b)) {
            return true;
        }
        if (this.lv(a, b)) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.getOffsetValue = function () {
        return this.m2.r(this.mx(), this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi));
    };
    HorizontalAnchoredCategorySeries.prototype.getCategoryWidth = function () {
        var a = this.getEffectiveViewport1(this.bi);
        return this.mx().getCategorySize(this.bi.bs, this.bi.br, a);
    };
    HorizontalAnchoredCategorySeries.prototype.ej = function (a, b, c) {
        if (this.bs == null) {
            return NaN;
        }
        var d = this.getEffectiveViewport1(this.bi);
        var e = this.mx();
        var f = new ScalerParams(0, this.bs.mn, this.bi.br, e.b8, d);
        var g = this.m2.r(e, this.bs.mn, this.bi.br, d);
        return this.el(this.valueColumn, a, e, f, g, runOn(this, this.nw), b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.fa = function (a, b) {
        return this.fb(a, b, this.mx(), runOn(this, this.nw), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.e8 = function (a, b) {
        return this.e9(a, b, this.mx(), runOn(this, this.nw), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.d5 = function (a, b, c, d, e) {
        if (this.valueColumn == null) {
            return Number.POSITIVE_INFINITY;
        }
        return this.d6(a, b, this.mx(), d, e, this.valueColumn.count, runOn(this, this.nw));
    };
    HorizontalAnchoredCategorySeries.prototype.lc = function (a, b, c) {
        if (this.mx() == null || this.nh() == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        return this.le(a, b, c, this.m2.r(this.mx(), this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi)), this.nh(), this.mx(), null, null, null);
    };
    HorizontalAnchoredCategorySeries.prototype.fetchXAxis = function () {
        return this.pp;
    };
    HorizontalAnchoredCategorySeries.prototype.fetchYAxis = function () {
        return this.pv;
    };
    HorizontalAnchoredCategorySeries.prototype.o7 = function (a) {
        this.xAxis = typeCast(CategoryAxisBase.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.o8 = function (a) {
        this.yAxis = typeCast(NumericYAxis.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.ns = function () {
        return this.pv != null && this.pv.ck();
    };
    HorizontalAnchoredCategorySeries.prototype.p3 = function (a) {
        this.pp = a;
    };
    HorizontalAnchoredCategorySeries.prototype.p4 = function (a) {
        this.pv = a;
    };
    HorizontalAnchoredCategorySeries.prototype.mr = function (a, b) {
        return this.om(a, b, this.pp);
    };
    HorizontalAnchoredCategorySeries.prototype.ir = function (a, b, c, d) {
        switch (b) {
            case HorizontalAnchoredCategorySeries.$$p[0]:
                this.p3(this.xAxis);
                if (this.op.cz) {
                    this.op.cy = CategoryTrendLineManagerFactory.a(this.op.cy, this.pp, this.jo, this, this.b2);
                }
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.op.cy = CategoryTrendLineManagerFactory.a(this.op.cy, this.pp, this.jo, this, this.b2);
                }
                break;
        }
        _super.prototype.ir.call(this, a, b, c, d);
        switch (b) {
            case HorizontalAnchoredCategorySeries.$$p[0]:
                if (c != d) {
                    this.hs(typeCast(Axis.$, c));
                    this.iw(typeCast(Axis.$, d));
                    this.p3(this.xAxis);
                    this.m6.cn.g(this.eq);
                    this.i4(false);
                    this.ib();
                }
                break;
            case HorizontalAnchoredCategorySeries.$$p[1]:
                if (c != d) {
                    this.hs(typeCast(Axis.$, c));
                    this.iw(typeCast(Axis.$, d));
                    this.p4(this.yAxis);
                    this.m6.cn.g(this.eq);
                    this.ns();
                    this.i4(false);
                    this.ib();
                }
                break;
            case "CategoryMode":
                if (this.xAxis != null) {
                    this.xAxis.kg(true);
                }
                break;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.hr = function (a, b, c, d) {
        _super.prototype.hr.call(this, a, b, c, d);
        if (this.pp != null && typeCast(ISortingAxis_$type, this.pp) !== null) {
            this.pp.i$i();
        }
        switch (a) {
            case 4:
                if (this.pp != null) {
                    this.pp.ck();
                }
                if (this.pv != null && !this.pv.ck()) {
                    this.i4(true);
                }
                break;
            case 1:
                if (this.pp != null) {
                    this.pp.ck();
                }
                if (this.pv != null && !this.pv.ck()) {
                    this.i4(true);
                }
                break;
            case 0:
                if (this.pp != null) {
                    this.pp.ck();
                }
                if (this.pv != null && !this.pv.ck()) {
                    this.i4(true);
                }
                break;
            case 2:
                if (this.o0 != null && this.op.cn.d > 0 && this.pv != null && !this.pv.ck()) {
                    this.i4(true);
                }
                break;
            case 3:
                if (d == this.o0) {
                    if (this.pp != null) {
                        this.pp.ck();
                    }
                    if (this.pv != null && !this.pv.ck()) {
                        this.i4(true);
                    }
                }
                break;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.px = function (a) {
        if (typeCast(CategoryXAxis.$, a) !== null || a.b5) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.py = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "ps", {
        get: function () {
            return this.pr;
        },
        set: function (a) {
            var b = this.ps;
            if (a != b) {
                this.pr = a;
                this.raisePropertyChanged("CategoryMode", enumGetBox(CategoryMode_$type, b), enumGetBox(CategoryMode_$type, this.ps));
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.nt;
        },
        enumerable: true,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.$t = markType(HorizontalAnchoredCategorySeries, 'HorizontalAnchoredCategorySeries', AnchoredCategorySeries.$);
    return HorizontalAnchoredCategorySeries;
}(AnchoredCategorySeries));
export { HorizontalAnchoredCategorySeries };
Type.dep(DependencyProperty, PropertyMetadata, HorizontalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::p5', [CategoryAxisBase.$, null], 'YAxis::p6', [NumericYAxis.$, null]]);
