/*
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.act = null;
        _this.acp = null;
        _this.acv = null;
        _this.acr = 0;
        return _this;
    }
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "acu", {
        get: function () {
            var _this = this;
            if (this.act == null) {
                this.act = DVContainer.instance.createInstance(IHorizontalAnchoredCategorySeriesInteractionManager_$type, function () { return _this.ds.n; });
            }
            return this.act;
        },
        enumerable: false,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.prototype.o8 = function () {
        _super.prototype.o8.call(this);
        this.xAxis = null;
        this.yAxis = null;
    };
    HorizontalAnchoredCategorySeries.prototype.cl = function () {
        return 1;
    };
    HorizontalAnchoredCategorySeries.prototype.cm = function () {
        if (this.yAxis != null && this.yAxis.df) {
            return 4;
        }
        return 3;
    };
    HorizontalAnchoredCategorySeries.prototype.b3 = function () {
        if (this.b4 == 0) {
            return 1;
        }
        else {
            return _super.prototype.b3.call(this);
        }
    };
    HorizontalAnchoredCategorySeries.prototype.y2 = function () {
        return this.acp;
    };
    HorizontalAnchoredCategorySeries.prototype.zj = function () {
        return this.acv;
    };
    HorizontalAnchoredCategorySeries.prototype.wz = function (a) {
        if (this.y4 == null || this.y4.p.count == 0 || !this.hasMarkers || !this.xq()) {
            return Rect.empty;
        }
        return this.acu.d$d(this, this.y4.p, a, runOn(this, this.ac7));
    };
    HorizontalAnchoredCategorySeries.prototype.ac7 = function (a) {
        return this.aa7.ds(a);
    };
    HorizontalAnchoredCategorySeries.prototype.acz = function (a, b, c) {
        return this.acu.d$c(this, this.zj(), a, b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.aj = function (a) {
        return this.acu.d$a(this, this.y4.h, this.z5(this.cw), this.z6(this.cw), a);
    };
    HorizontalAnchoredCategorySeries.prototype.al = function (a) {
        return this.acu.d$b(this, this.y4.h, this.z5(this.cw), this.z6(this.cw), a);
    };
    HorizontalAnchoredCategorySeries.prototype.gx = function (a, b) {
        if (this.gw(a, b)) {
            return true;
        }
        if (this.xr(a, b)) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.getOffsetValue = function () {
        return this.y9.r(this.y2(), this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw));
    };
    HorizontalAnchoredCategorySeries.prototype.getCategoryWidth = function () {
        var a = this.getEffectiveViewport1(this.cw);
        return this.y2().getCategorySize(this.cw.ca, this.cw.b9, a);
    };
    HorizontalAnchoredCategorySeries.prototype.i8 = function (a, b, c) {
        if (this.dc == null) {
            return NaN;
        }
        var d = this.getEffectiveViewport1(this.cw);
        var e = this.y2();
        if (e == null) {
            return NaN;
        }
        var f = new ScalerParams(0, this.dc.xm, this.cw.b9, e.df, d);
        var g = this.y9.r(e, this.dc.xm, this.cw.b9, d);
        return this.ja(this.valueColumn, a, e, f, g, runOn(this, this.z3), b, c);
    };
    HorizontalAnchoredCategorySeries.prototype.ke = function (a, b) {
        return this.kf(a, b, this.y2(), runOn(this, this.z3), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.kc = function (a, b) {
        return this.kd(a, b, this.y2(), runOn(this, this.z3), this.valueColumn);
    };
    HorizontalAnchoredCategorySeries.prototype.ir = function (a, b, c, d, e) {
        if (this.valueColumn == null) {
            return Number.POSITIVE_INFINITY;
        }
        return this.is(a, b, this.y2(), d, e, this.valueColumn.count, runOn(this, this.z3));
    };
    HorizontalAnchoredCategorySeries.prototype.wm = function (a, b, c) {
        if (this.y2() == null || this.zj() == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        return this.wo(a, b, c, this.y9.r(this.y2(), this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw)), this.zj(), this.y2(), null, null, null);
    };
    HorizontalAnchoredCategorySeries.prototype.fetchXAxis = function () {
        return this.acp;
    };
    HorizontalAnchoredCategorySeries.prototype.fetchYAxis = function () {
        return this.acv;
    };
    HorizontalAnchoredCategorySeries.prototype.ab3 = function (a) {
        this.xAxis = typeCast(CategoryAxisBase.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.ab4 = function (a) {
        this.yAxis = typeCast(NumericYAxis.$, a);
    };
    HorizontalAnchoredCategorySeries.prototype.zz = function () {
        return this.acv != null && this.acv.d2();
    };
    HorizontalAnchoredCategorySeries.prototype.ac3 = function (a) {
        this.acp = a;
    };
    HorizontalAnchoredCategorySeries.prototype.ac4 = function (a) {
        this.acv = a;
    };
    HorizontalAnchoredCategorySeries.prototype.yw = function (a, b) {
        return this.aa4(a, b, this.acp);
    };
    HorizontalAnchoredCategorySeries.prototype.rg = function (a, b, c, d) {
        switch (b) {
            case HorizontalAnchoredCategorySeries.$$p[0]:
                this.ac3(this.xAxis);
                if (this.aa7.dl) {
                    this.aa7.dk = CategoryTrendLineManagerFactory.a(this.aa7.dk, this.acp, this.s3, this, this.ds);
                    this.aa7.dk.g$b = this.trendLineType;
                    this.aa7.dk.g$f = this.trendLinePeriod;
                }
                break;
            case "TrendLineType":
                var e = EnumUtil.getEnumValue(TrendLineType_$type, d);
                if (e != 0) {
                    this.aa7.dk = CategoryTrendLineManagerFactory.a(this.aa7.dk, this.acp, this.s3, this, this.ds);
                    this.aa7.dk.g$b = this.trendLineType;
                    this.aa7.dk.g$f = this.trendLinePeriod;
                }
                break;
        }
        _super.prototype.rg.call(this, a, b, c, d);
        switch (b) {
            case HorizontalAnchoredCategorySeries.$$p[0]:
                if (c != d) {
                    this.pi(typeCast(Axis.$, c));
                    this.ro(typeCast(Axis.$, d));
                    this.ac3(this.xAxis);
                    this.zd.c9.g(this.ie);
                    this.ry(false);
                    this.qr();
                }
                break;
            case HorizontalAnchoredCategorySeries.$$p[1]:
                if (c != d) {
                    this.pi(typeCast(Axis.$, c));
                    this.ro(typeCast(Axis.$, d));
                    this.ac4(this.yAxis);
                    if (this.dc != null) {
                        this.dc.o0();
                    }
                    this.zd.c9.g(this.ie);
                    this.zz();
                    this.ry(false);
                    this.qr();
                }
                break;
            case "CategoryMode":
                if (this.xAxis != null) {
                    this.xAxis.pw(true);
                }
                break;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.ph = function (a, b, c, d) {
        _super.prototype.ph.call(this, a, b, c, d);
        if (this.acp != null && typeCast(ISortingAxis_$type, this.acp) !== null) {
            this.acp.i$i();
        }
        switch (a) {
            case 4:
                if (this.acp != null) {
                    this.acp.d2();
                }
                if (this.acv != null && !this.acv.d2()) {
                    this.ry(true);
                }
                break;
            case 1:
                if (this.acp != null) {
                    this.acp.d2();
                }
                if (this.acv != null && !this.acv.d2()) {
                    this.ry(true);
                }
                break;
            case 0:
                if (this.acp != null) {
                    this.acp.d2();
                }
                if (this.acv != null && !this.acv.d2()) {
                    this.ry(true);
                }
                break;
            case 2:
                if (this.abp != null && this.aa7.c9.d > 0 && this.acv != null && !this.acv.d2()) {
                    this.ry(true);
                }
                break;
            case 3:
                if (d == this.abp) {
                    if (this.acp != null) {
                        this.acp.d2();
                    }
                    if (this.acv != null && !this.acv.d2()) {
                        this.ry(true);
                    }
                }
                break;
        }
    };
    HorizontalAnchoredCategorySeries.prototype.acx = function (a) {
        if (typeCast(CategoryXAxis.$, a) !== null || a.dc) {
            return true;
        }
        return false;
    };
    HorizontalAnchoredCategorySeries.prototype.acy = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "acs", {
        get: function () {
            return this.acr;
        },
        set: function (a) {
            var b = this.acs;
            if (a != b) {
                this.acr = a;
                this.raisePropertyChanged("CategoryMode", enumGetBox(CategoryMode_$type, b), enumGetBox(CategoryMode_$type, this.acs));
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(HorizontalAnchoredCategorySeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.z0;
        },
        enumerable: false,
        configurable: true
    });
    HorizontalAnchoredCategorySeries.$t = markType(HorizontalAnchoredCategorySeries, 'HorizontalAnchoredCategorySeries', AnchoredCategorySeries.$);
    HorizontalAnchoredCategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, HorizontalAnchoredCategorySeries, 'raisePropertyChanged', ['XAxis::ac5', [CategoryAxisBase.$, null], 'YAxis::ac6', [NumericYAxis.$, null]]);
    return HorizontalAnchoredCategorySeries;
}(AnchoredCategorySeries));
export { HorizontalAnchoredCategorySeries };
