/*
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-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
 */
var HorizontalAnchoredCategorySeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(HorizontalAnchoredCategorySeries, _super);
    function HorizontalAnchoredCategorySeries() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.ach = null;
        _this.acd = null;
        _this.acj = null;
        _this.acf = 0;
        return _this;
    }
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "aci", {
        get: function () {
            var _this = this;
            if (this.ach == null) {
                this.ach = DVContainer.instance.createInstance(IHorizontalAnchoredCategorySeriesInteractionManager_$type, function () { return _this.dr.n; });
            }
            return this.ach;
        },
        enumerable: false,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.prototype.o2 = function () {
        _super.prototype.o2.call(this);
        this.xAxis = null;
        this.yAxis = null;
    };
    HorizontalAnchoredCategorySeries.prototype.ck = function () {
        return 1;
    };
    HorizontalAnchoredCategorySeries.prototype.cl = function () {
        if (this.yAxis != null && this.yAxis.ch) {
            return 4;
        }
        return 3;
    };
    HorizontalAnchoredCategorySeries.prototype.b2 = function () {
        if (this.b3 == 0) {
            return 1;
        }
        else {
            return _super.prototype.b2.call(this);
        }
    };
    HorizontalAnchoredCategorySeries.prototype.ys = function () {
        return this.acd;
    };
    HorizontalAnchoredCategorySeries.prototype.y9 = function () {
        return this.acj;
    };
    HorizontalAnchoredCategorySeries.prototype.wp = function (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));
    };
    HorizontalAnchoredCategorySeries.prototype.acv = function (a) {
        return this.aav.de(a);
    };
    HorizontalAnchoredCategorySeries.prototype.acn = function (a, b, c) {
        return this.aci.d$c(this, this.y9(), a, b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.aj = function (a) {
        return this.aci.d$a(this, this.yu.f, this.zv(this.cv), this.zw(this.cv), a);
    };
    HorizontalAnchoredCategorySeries.prototype.al = function (a) {
        return this.aci.d$b(this, this.yu.f, this.zv(this.cv), this.zw(this.cv), a);
    };
    HorizontalAnchoredCategorySeries.prototype.gw = function (a, b) {
        if (this.gv(a, b)) {
            return true;
        }
        if (this.xh(a, b)) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.getOffsetValue = function () {
        return this.yz.r(this.ys(), this.cv.by, this.cv.bx, this.getEffectiveViewport1(this.cv));
    };
    HorizontalAnchoredCategorySeries.prototype.getCategoryWidth = function () {
        var a = this.getEffectiveViewport1(this.cv);
        return this.ys().getCategorySize(this.cv.by, this.cv.bx, a);
    };
    HorizontalAnchoredCategorySeries.prototype.i5 = function (a, b, c) {
        if (this.db == null) {
            return NaN;
        }
        var d = this.getEffectiveViewport1(this.cv);
        var e = this.ys();
        if (e == null) {
            return NaN;
        }
        var f = new ScalerParams(0, this.db.v4, this.cv.bx, e.ch, d);
        var 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);
    };
    HorizontalAnchoredCategorySeries.prototype.ka = function (a, b) {
        return this.kb(a, b, this.ys(), runOn(this, this.zt), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.j8 = function (a, b) {
        return this.j9(a, b, this.ys(), runOn(this, this.zt), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.ip = function (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));
    };
    HorizontalAnchoredCategorySeries.prototype.wc = function (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);
    };
    HorizontalAnchoredCategorySeries.prototype.fetchXAxis = function () {
        return this.acd;
    };
    HorizontalAnchoredCategorySeries.prototype.fetchYAxis = function () {
        return this.acj;
    };
    HorizontalAnchoredCategorySeries.prototype.abr = function (a) {
        this.xAxis = typeCast(CategoryAxisBase.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.abs = function (a) {
        this.yAxis = typeCast(NumericYAxis.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.zp = function () {
        return this.acj != null && this.acj.c1();
    };
    HorizontalAnchoredCategorySeries.prototype.acr = function (a) {
        this.acd = a;
    };
    HorizontalAnchoredCategorySeries.prototype.acs = function (a) {
        this.acj = a;
    };
    HorizontalAnchoredCategorySeries.prototype.ym = function (a, b) {
        return this.aas(a, b, this.acd);
    };
    HorizontalAnchoredCategorySeries.prototype.q9 = function (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":
                var 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.prototype.q9.call(this, 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;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.pb = function (a, b, c, d) {
        _super.prototype.pb.call(this, 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;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.acl = function (a) {
        if (typeCast(CategoryXAxis.$, a) !== null || a.ce) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.acm = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "acg", {
        get: function () {
            return this.acf;
        },
        set: function (a) {
            var b = this.acg;
            if (a != b) {
                this.acf = a;
                this.raisePropertyChanged("CategoryMode", enumGetBox(CategoryMode_$type, b), enumGetBox(CategoryMode_$type, this.acg));
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.zq;
        },
        enumerable: false,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.$t = markType(HorizontalAnchoredCategorySeries, 'HorizontalAnchoredCategorySeries', AnchoredCategorySeries.$);
    HorizontalAnchoredCategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, HorizontalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::act', [CategoryAxisBase.$, null], 'YAxis::acu', [NumericYAxis.$, null]]);
    return HorizontalAnchoredCategorySeries;
}(AnchoredCategorySeries));
export { HorizontalAnchoredCategorySeries };
