/*
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 { CategorySeries } from "./CategorySeries";
import { IIsCategoryBased_$type } from "./IIsCategoryBased";
import { IHasSingleValueCategory_$type } from "./IHasSingleValueCategory";
import { IHasCategoryTrendline_$type } from "./IHasCategoryTrendline";
import { ITrendLineSeries_$type } from "./ITrendLineSeries";
import { IAnchoredCategorySeriesInteractionManager_$type } from "./IAnchoredCategorySeriesInteractionManager";
import { DVContainer } from "igniteui-react-core";
import { Point_$type, enumGetBox, typeCast, runOn, delegateCombine, markType, markDep } from "igniteui-react-core";
import { DependencyProperty } from "igniteui-react-core";
import { Series } from "./Series";
import { TrendLineType_$type } from "igniteui-react-core";
import { Brush } from "igniteui-react-core";
import { PenLineCap_$type } from "igniteui-react-core";
import { DoubleCollection } from "igniteui-react-core";
import { CategoryFrame } from "./CategoryFrame";
import { ICategoryScaler_$type } from "./ICategoryScaler";
import { IScaler_$type } from "./IScaler";
import { CategorySeriesView } from "./CategorySeriesView";
import { CategorySeriesMarkerCollisionAvoidance_$type } from "./CategorySeriesMarkerCollisionAvoidance";
import { ConsolidatedItemHitTestBehavior_$type } from "./ConsolidatedItemHitTestBehavior";
import { CategoryFramePreparer } from "./CategoryFramePreparer";
import { DataLegendSeriesValueInfo } from "igniteui-react-core";
import { DataLegendSeriesContext } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { Rect } from "igniteui-react-core";
import { ISortingAxis_$type } from "./ISortingAxis";
import { IFastItemsSource_$type } from "igniteui-react-core";
import { NumericAxisBase } from "./NumericAxisBase";
import { CategoryBucketCalculator } from "./CategoryBucketCalculator";
import { AxisRange } from "./AxisRange";
import { NumericYAxis } from "./NumericYAxis";
import { ScalerParams } from "./ScalerParams";
import { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay";
import { CategoryMarkerManager } from "./CategoryMarkerManager";
import { CollisionAvoider } from "./CollisionAvoider";
import { NonCollisionAvoider } from "./NonCollisionAvoider";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { PropertyMetadata } from "igniteui-react-core";
import { truncate, isNaN_, isInfinity } from "igniteui-react-core";
import { CategoryTrendLineManagerFactory } from "./CategoryTrendLineManagerFactory";
/**
 * @hidden
 */
var AnchoredCategorySeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(AnchoredCategorySeries, _super);
    function AnchoredCategorySeries() {
        var _this = _super.call(this) || this;
        _this.aah = null;
        _this.aam = false;
        _this.aaj = null;
        _this.aae = null;
        _this.aat = null;
        _this.aas = null;
        _this.aal = true;
        _this.aan = 0;
        _this.aao = 0;
        _this.yp = new CategoryFramePreparer(1, _this, _this.yt, _this, _this, _this.yt.cw);
        return _this;
    }
    Object.defineProperty(AnchoredCategorySeries.prototype, "aai", {
        get: function () {
            var _this = this;
            if (this.aah == null) {
                this.aah = DVContainer.instance.createInstance(IAnchoredCategorySeriesInteractionManager_$type, function () { return _this.dp.n; });
            }
            return this.aah;
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeries.prototype.getHostReferenceValue = function () {
        return this.iw();
    };
    AnchoredCategorySeries.prototype.mb = function () {
        return AnchoredCategorySeries.$$p[5];
    };
    AnchoredCategorySeries.prototype.cq = function () {
        var a = new AnchoredCategorySeriesView(this);
        return a;
    };
    AnchoredCategorySeries.prototype.qw = function (a) {
        _super.prototype.qw.call(this, a);
        this.aad = a;
    };
    AnchoredCategorySeries.prototype.ko = function (a, b) {
        var c = this.na(b);
        if (c == AnchoredCategorySeries.$$p[5]) {
            return this.kp(a, b, this.aa3);
        }
        if (c == AnchoredCategorySeries.$$p[1]) {
            return this.kp(a, b, this.aav);
        }
        return _super.prototype.ko.call(this, a, b);
    };
    AnchoredCategorySeries.prototype.ma = function (a) {
        var b = this.na(a);
        if (b == AnchoredCategorySeries.$$p[5]) {
            return this.aa3;
        }
        if (b == AnchoredCategorySeries.$$p[1]) {
            return this.aav;
        }
        return _super.prototype.ma.call(this, a);
    };
    Object.defineProperty(AnchoredCategorySeries.prototype, "valueColumn", {
        get: function () {
            return this.aaj;
        },
        set: function (a) {
            if (this.aaj != a) {
                var b = this.aaj;
                this.aaj = a;
                if (!this.aam) {
                    this.raisePropertyChanged("ValueColumn", b, this.aaj);
                }
            }
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeries.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = new DataLegendSeriesValueInfo();
        c.a = 0;
        c.l = this.i3({ $type: Point_$type, x: a, y: b }, false, false);
        c.r = this.aa3 != null ? this.aa3 : "Value";
        c.q = "Value";
        c.s = this.aaz != null ? this.aaz : "V:";
        c.t = this.aa1 != null ? this.aa1 : "";
        var d = new DataLegendSeriesContext();
        d.e = ((function () {
            var $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
            $ret.add(c);
            return $ret;
        })());
        d.h = this.l9();
        return d;
    };
    Object.defineProperty(AnchoredCategorySeries.prototype, "abq", {
        get: function () {
            return this.c(AnchoredCategorySeries.abc);
        },
        set: function (a) {
            this.h(AnchoredCategorySeries.abc, a);
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeries.prototype.gb = function (a) {
        var b = new Rect(0, 0, 0, 1, 1);
        var c = this.fetchXAxis();
        var d = this.fetchYAxis();
        var e = this.we(this.ct);
        var f = c != null ? this.yp.r(typeCast(ICategoryScaler_$type, c), b, b, e) : 0;
        return this.aai.c$a(this, this.valueColumn, c, d, f, a);
    };
    AnchoredCategorySeries.prototype.aaa = function (a, b, c) {
        if (b < a || a < 0 || a > this.valueColumn.count || b < 0 || b > this.valueColumn.count || c == null) {
            return null;
        }
        var d = new Array((b - a) + 1);
        var e = c.cn;
        var f = null;
        if (e) {
            f = c.i$b;
        }
        for (var g = a; g <= b; g++) {
            var h = g;
            if (e) {
                h = f._inner[h];
            }
            d[g - a] = this.dl.item(g);
        }
        return d;
    };
    AnchoredCategorySeries.prototype.q4 = function (a, b, c, d) {
        _super.prototype.q4.call(this, a, b, c, d);
        if (this.aad.c8 && this.aad.c7.g$b(a, b, c, d)) {
            var e = false;
            if (b == "FastItemsSource") {
                e = this.ge && c != null;
            }
            this.rm(e);
            this.qg();
        }
        switch (b) {
            case AnchoredCategorySeries.$$p[3]:
            case AnchoredCategorySeries.$$p[4]:
                this.qa();
                break;
            case "FastItemsSource":
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    c.deregisterColumn(this.valueColumn);
                    this.valueColumn = null;
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    this.valueColumn = this.di(this.aa3);
                }
                var f = typeCast(NumericAxisBase.$, this.fetchYAxis());
                if (f != null && !f.c1()) {
                    this.aad.cw.g(this.ib);
                    this.rm(this.ge && c != null);
                }
                break;
            case AnchoredCategorySeries.$$p[5]:
                if (this.dl != null) {
                    this.dl.deregisterColumn(this.valueColumn);
                    this.valueColumn = this.di(this.aa3);
                }
                this.aat = this.aa3;
                break;
            case AnchoredCategorySeries.$$p[1]:
                this.aas = this.aav;
                this.rm(true);
                break;
            case "ValueColumn":
                if (this.aad.c8) {
                    this.aad.c7.g$i();
                }
                var g = typeCast(NumericAxisBase.$, this.fetchYAxis());
                if (g != null && !g.c1()) {
                    this.aad.cw.g(this.ib);
                    this.rm(this.ge && this.d5);
                }
                this.abb();
                this.sg();
                break;
            case "TrendLineBrush":
                this.ra(b);
                break;
            case "ErrorBarSettings":
                this.rm(false);
                break;
            case "TrendLineType":
                this.qg();
                break;
            case AnchoredCategorySeries.$$p[2]:
                this.rm(false);
                break;
        }
    };
    AnchoredCategorySeries.prototype.ax = function (a) {
        if (this.valueColumn == null || this.valueColumn.count == 0) {
            return null;
        }
        if (a == this.fetchXAxis()) {
            return new AxisRange(0, this.valueColumn.count - 1);
        }
        if (a == this.fetchYAxis()) {
            return new AxisRange(this.valueColumn.minimum, this.valueColumn.maximum);
        }
        return null;
    };
    AnchoredCategorySeries.prototype.o8 = function (a, b, c, d) {
        switch (a) {
            case 4:
            case 1:
            case 0:
                this.aad.cw.g(this.ib);
                break;
        }
        if (this.aad.c8) {
            this.aad.c7.g$e(a, b, c, d);
        }
        this.abb();
        this.sg();
        if (a == 0 || a == 2 || a == 3 || a == 4) {
            this.aal = true;
        }
        else if (a == 1) {
            for (var e = b; e < b + c; e++) {
                this.aan += this.valueColumn.item(e);
            }
            this.aao = this.aan / this.valueColumn.count;
        }
    };
    AnchoredCategorySeries.prototype.zk = function () {
        return this.aap(this.yt);
    };
    AnchoredCategorySeries.prototype.aap = function (a) {
        var b = 0;
        var c = a.by;
        var d = a.bx;
        var e = this.getEffectiveViewport1(a);
        var f = typeCast(NumericYAxis.$, this.fetchYAxis());
        if (!c.isEmpty && !d.isEmpty && f != null) {
            var g = new ScalerParams(0, c, d, f.ch, e);
            if (f.cp) {
                g.b = this.iw();
            }
            b = f.ek(f.l8, g);
        }
        return b;
    };
    AnchoredCategorySeries.prototype.aa9 = function (a, b, c) {
        var d = this.aap(c);
        if (a.count > 0) {
            var e = d;
            a.add({ $type: Point_$type, x: a._inner[a.count - 1].x, y: e });
            a.add({ $type: Point_$type, x: a._inner[0].x, y: e });
        }
    };
    AnchoredCategorySeries.prototype.aab = function (a, b, c, d) {
        return this.aac(a, b, c, d, false);
    };
    AnchoredCategorySeries.prototype.aac = function (a, b, c, d, e) {
        return CategorySeries.ye(a, b, c, d, e);
    };
    AnchoredCategorySeries.prototype.f9 = function () {
        return this.highlightedItemsSource != null || this.aav != null;
    };
    AnchoredCategorySeries.prototype.hr = function () {
        var a = _super.prototype.hr.call(this);
        {
            var b = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.ad = "ValueMemberPath";
                $ret.p = true;
                $ret.y = "HighlightedValueMemberPath";
                $ret.q = true;
                return $ret;
            })());
            b.valueResolving = delegateCombine(b.valueResolving, runOn(this, this.aa5));
            a.add(b);
        }
        return a;
    };
    AnchoredCategorySeries.prototype.aa5 = function (a, b) {
        if (this.aav != null) {
            b.value = this.aav;
            return;
        }
        b.value = this.aa3;
    };
    AnchoredCategorySeries.prototype.hc = function (a, b, c) {
        var d = _super.prototype.hc.call(this, a, b, c);
        var e = c;
        if (this.valueColumn == null || this.valueColumn.count == 0 || e.cw.d < 1) {
            d = false;
        }
        return d;
    };
    AnchoredCategorySeries.prototype.o2 = function (a, b) {
        _super.prototype.o2.call(this, a, b);
        var c = b;
        c.c2();
        if (c.c8) {
            c.c7.g$d();
        }
    };
    AnchoredCategorySeries.prototype.z0 = function (a, b) {
        _super.prototype.z0.call(this, a, b);
        this.yq(b).d(a, b);
    };
    AnchoredCategorySeries.prototype.z3 = function (a, b) {
        _super.prototype.z3.call(this, a, b);
        var c = typeCast(AnchoredCategorySeriesView.$, b);
        c.b7 = true;
        if (c.c8) {
            c.c7.g$g(a.q);
        }
        if (this.w7()) {
            CategoryMarkerManager.e(this, a.n, b.cz, this.w9);
            this.zx(b, a);
            b.cr();
        }
        this.aa6(a, b);
    };
    AnchoredCategorySeries.prototype.rl = function (a, b, c, d, e) {
        _super.prototype.rl.call(this, a, b, c, d, e);
        var f = this.a9.a$j.item(d);
        var g = f;
        g.cw.g(this.ib);
        f.a3(c);
        if (this.d3(g)) {
            return;
        }
        if (this.aae == null) {
            this.aae = new CategoryFrame(3);
        }
        this.aae.v();
        this.z0(this.aae, g);
        this.z3(this.aae, g);
    };
    AnchoredCategorySeries.prototype.aa6 = function (a, b) {
    };
    AnchoredCategorySeries.prototype.sa = function () {
        _super.prototype.sa.call(this);
        if (this.index < 0) {
            return;
        }
        this.aad.dc();
        if (this.trendLineBrush != null) {
            this.aad.da();
        }
        else {
            this.aad.c9();
        }
    };
    AnchoredCategorySeries.prototype.ku = function (a, b) {
        if (this.aad.c8 && a == this.aad.c7.g$j) {
            return null;
        }
        return _super.prototype.ku.call(this, a, b);
    };
    Object.defineProperty(AnchoredCategorySeries.prototype, "currentCategoryMode", {
        get: function () {
            return this.preferredCategoryMode(typeCast(CategoryAxisBase.$, this.yj()));
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(AnchoredCategorySeries.prototype, "scaler", {
        get: function () {
            return typeCast(ICategoryScaler_$type, this.yj());
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(AnchoredCategorySeries.prototype, "yScaler", {
        get: function () {
            return typeCast(IScaler_$type, this.yz());
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(AnchoredCategorySeries.prototype, "bucketizer", {
        get: function () {
            return this.aad.cw;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(AnchoredCategorySeries.prototype, "currentMode2Index", {
        get: function () {
            return this.zo();
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeries.prototype.provideCollisionDetector = function () {
        if (this.aaf == 1) {
            return new CollisionAvoider();
        }
        return NonCollisionAvoider.b;
    };
    Object.defineProperty(AnchoredCategorySeries.prototype, "trendlinePreparer", {
        get: function () {
            return this.aad.c8 ? this.aad.c7 : null;
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeries.prototype.pu = function (a) {
        _super.prototype.pu.call(this, a);
        if (this.aad.c8) {
            this.bb.exportTrendlineData(this, a, this.aad.c7.g$j);
        }
    };
    AnchoredCategorySeries.prototype.kl = function (a) {
        var _this = this;
        var b = this.fetchXAxis();
        var c = this.fetchYAxis();
        return this.aai.c$b(this, a, this.zl(this.ct), this.valueColumn, b, c, this.aag == 1, function (d) { return _super.prototype.kl.call(_this, d); });
    };
    Object.defineProperty(AnchoredCategorySeries.prototype, "mayContainUnknowns", {
        get: function () {
            return this.valueColumn == null || this.valueColumn.mayContainUnknowns;
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeries.prototype.iw = function () {
        return Series.ix(this.valueColumn, typeCast(ISortingAxis_$type, this.fetchXAxis()));
    };
    AnchoredCategorySeries.prototype.get_aar = function () {
        return 0;
    };
    Object.defineProperty(AnchoredCategorySeries.prototype, "aar", {
        get: function () {
            return this.get_aar();
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeries.prototype.ay = function (a) {
        if (a.isEmpty && this.c9 != null) {
            a = this.c9.vl;
        }
        if (this.valueColumn == null) {
            return null;
        }
        var b = this.wc(this.ct);
        var c = this.yj();
        var d = new ScalerParams(0, a, this.c9.v0, c.ch, this.getEffectiveViewport());
        var e = (c.en(b.left, d));
        var f = (c.en(b.right, d));
        if (c.ch) {
            var g = e;
            e = f;
            f = g;
        }
        e -= this.aar;
        f += this.aar;
        var h = null;
        if (c.cn) {
            h = c;
            e = h.i$f(e);
            f = h.i$f(f);
        }
        else {
            e = Math.floor(e);
            f = Math.ceil(f);
        }
        if (isNaN_(e) || isNaN_(f)) {
            return null;
        }
        e = Math.max(0, Math.min(this.valueColumn.count - 1, e));
        f = Math.max(0, Math.min(this.valueColumn.count - 1, f));
        var i = 1.7976931348623157E+308;
        var j = -1.7976931348623157E+308;
        if (truncate(e) <= truncate(f)) {
            for (var k = truncate(e); k <= truncate(f); k++) {
                var l = k;
                if (h != null) {
                    l = h.i$b._inner[k];
                }
                var m = this.valueColumn.item(l);
                if (this.valueColumn.mayContainUnknowns) {
                    if (isInfinity(m) || isNaN_(m)) {
                        continue;
                    }
                }
                i = Math.min(i, m);
                j = Math.max(j, m);
            }
        }
        var n = new AxisRange(i, j);
        n = this.aw(n, this.yz(), a);
        return n;
    };
    AnchoredCategorySeries.prototype.abb = function () {
        this.ik = this.valueColumn == null || this.valueColumn.count == 0 ? NaN : this.valueColumn.item(this.valueColumn.count - 1);
    };
    AnchoredCategorySeries.prototype.aba = function () {
        if (this.aal) {
            this.aan = 0;
            for (var a = 0; a < this.valueColumn.count; a++) {
                this.aan += this.valueColumn.item(a);
            }
            this.aao = this.aan / this.valueColumn.count;
            this.aal = false;
        }
    };
    AnchoredCategorySeries.prototype.i6 = function (a, b) {
        if (b == null || !b.cj) {
            return NaN;
        }
        var c = this.yz();
        if (b != c) {
            return NaN;
        }
        var d = this.ap(a);
        if (c.cp) {
            return d[1];
        }
        else {
            return d[0];
        }
    };
    AnchoredCategorySeries.prototype.ap = function (a) {
        var b = NaN;
        switch (a) {
            case 5:
            case 2:
                b = this.valueColumn.maximum;
                break;
            case 4:
            case 1:
                b = this.valueColumn.minimum;
                break;
            case 6:
            case 3:
                if (this.aal) {
                    this.aba();
                }
                b = this.aao;
                break;
        }
        var c = this.yz();
        if (c.cp) {
            return [NaN, b];
        }
        else {
            return [b, NaN];
        }
    };
    AnchoredCategorySeries.prototype.v8 = function (a) {
        var b = NaN;
        switch (a) {
            case 5:
            case 2:
                b = this.valueColumn.maximum;
                break;
            case 4:
            case 1:
                b = this.valueColumn.minimum;
                break;
            case 6:
            case 3:
                if (this.aal) {
                    this.aba();
                }
                b = this.aao;
                break;
        }
        if (isNaN_(b)) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        var c = this.yz();
        var d = this.getEffectiveViewport1(this.ct);
        var e = new ScalerParams(0, this.ct.by, this.ct.bx, c.ch, d);
        if (c.cp) {
            e.b = this.iw();
        }
        e.c = d;
        if (c.cp) {
            return { $type: Point_$type, x: NaN, y: c.ek(b, e) };
        }
        else {
            return { $type: Point_$type, x: c.ek(b, e), y: NaN };
        }
    };
    AnchoredCategorySeries.prototype.v9 = function (a) {
        var b = this.yz();
        var c = this.getEffectiveViewport1(this.ct);
        var d = new ScalerParams(0, this.ct.by, this.ct.bx, b.ch, c);
        if (b.cp) {
            d.b = this.iw();
        }
        d.c = c;
        if (b.cp) {
            return { $type: Point_$type, x: NaN, y: b.ek(a[1], d) };
        }
        else {
            return { $type: Point_$type, x: b.ek(a[0], d), y: NaN };
        }
    };
    Object.defineProperty(AnchoredCategorySeries.prototype, "useHighMarkerFidelity", {
        get: function () {
            return this.zg;
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeries.$t = markType(AnchoredCategorySeries, 'AnchoredCategorySeries', CategorySeries.$, [IIsCategoryBased_$type, IHasSingleValueCategory_$type, IHasCategoryTrendline_$type, ITrendLineSeries_$type]);
    AnchoredCategorySeries.abc = DependencyProperty.i("ActualTrendLineBrush", Brush.$, AnchoredCategorySeries.$, new PropertyMetadata(2, null, function (a, b) { return a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue); }));
    AnchoredCategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, AnchoredCategorySeries, 'raisePropertyChanged', ['ConsolidatedItemHitTestBehavior:aag:abd', [ConsolidatedItemHitTestBehavior_$type, enumGetBox(ConsolidatedItemHitTestBehavior_$type, 0)], 'HighlightedValueMemberPath:aav:abe', [2, null], 'MarkerCollisionAvoidance:aaf:abf', [CategorySeriesMarkerCollisionAvoidance_$type, enumGetBox(CategorySeriesMarkerCollisionAvoidance_$type, 1)], 'ValueMemberAsLegendLabel:aaz:abn', [2, null], 'ValueMemberAsLegendUnit:aa1:abo', [2, null], 'ValueMemberPath:aa3:abp', [2, null], 'TrendLineType::abl', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::abk', [1, 1.5], 'TrendLinePeriod::abj', [1, 7], 'TrendLineBrush::abg', [Brush.$, null], 'TrendLineZIndex:aaq:abm', [1, 1001], 'TrendLineDashArray:abr:abh', [DoubleCollection.$], 'TrendLineDashCap:abs:abi', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
    return AnchoredCategorySeries;
}(CategorySeries));
export { AnchoredCategorySeries };
/**
 * @hidden
 */
var AnchoredCategoryBucketCalculator = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(AnchoredCategoryBucketCalculator, _super);
    function AnchoredCategoryBucketCalculator(a) {
        var _this = _super.call(this, a) || this;
        _this.i = null;
        _this.h = null;
        _this.j = 0;
        _this.i = a;
        return _this;
    }
    AnchoredCategoryBucketCalculator.prototype.getBucketWithoutUnknowns = function (a) {
        var b = this.h;
        var c = this.j;
        var d = a * this.d;
        var e = d + this.d - 1;
        var f = c - 1;
        d = d < f ? d : f;
        e = e < f ? e : f;
        var g = 1.7976931348623157E+308;
        var h = -1.7976931348623157E+308;
        var i = true;
        for (var j = d; j <= e; ++j) {
            var k = b[j];
            g = g < k ? g : k;
            h = h > k ? h : k;
            i = false;
        }
        if (!i) {
            return [0.5 * (d + e), g, h];
        }
        return [0.5 * (d + e), NaN, NaN];
    };
    AnchoredCategoryBucketCalculator.prototype.getBucket = function (a) {
        var b = this.h;
        var c = this.j;
        var d = a * this.d;
        var e = d + this.d - 1;
        var f = c - 1;
        d = d < f ? d : f;
        e = e < f ? e : f;
        var g = 0;
        var h = 0;
        var i = true;
        for (var j = d; j <= e; ++j) {
            var k = b[j];
            if (!i) {
                if (!isNaN_(k)) {
                    g = g < k ? g : k;
                    h = h > k ? h : k;
                }
            }
            else {
                if (!isNaN_(k)) {
                    g = k;
                    h = k;
                    i = false;
                }
            }
        }
        if (!i) {
            return [0.5 * (d + e), g, h];
        }
        return [0.5 * (d + e), NaN, NaN];
    };
    AnchoredCategoryBucketCalculator.prototype.cacheValues = function () {
        this.j = this.i.c5.valueColumn.count;
        this.h = this.i.c5.valueColumn.asArray();
    };
    AnchoredCategoryBucketCalculator.prototype.unCacheValues = function () {
        this.h = null;
    };
    AnchoredCategoryBucketCalculator.$t = markType(AnchoredCategoryBucketCalculator, 'AnchoredCategoryBucketCalculator', CategoryBucketCalculator.$);
    return AnchoredCategoryBucketCalculator;
}(CategoryBucketCalculator));
export { AnchoredCategoryBucketCalculator };
/**
 * @hidden
 */
var AnchoredCategorySeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(AnchoredCategorySeriesView, _super);
    function AnchoredCategorySeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.c5 = null;
        _this.c6 = null;
        _this.c5 = a;
        return _this;
    }
    Object.defineProperty(AnchoredCategorySeriesView.prototype, "c7", {
        get: function () {
            if (this.c6 == null) {
                this.c6 = CategoryTrendLineManagerFactory.a(this.c6, this.e.az(), this.e.so, this.e, this.e.dp);
            }
            return this.c6;
        },
        set: function (a) {
            this.c6 = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(AnchoredCategorySeriesView.prototype, "c8", {
        get: function () {
            return this.c6 != null;
        },
        enumerable: false,
        configurable: true
    });
    AnchoredCategorySeriesView.prototype.dc = function () {
        this.c5.abq = null;
    };
    AnchoredCategorySeriesView.prototype.da = function () {
        this.c5.abq = this.c5.trendLineBrush;
    };
    AnchoredCategorySeriesView.prototype.c9 = function () {
        this.c5.abq = this.c5.u2;
    };
    AnchoredCategorySeriesView.prototype.cx = function () {
        return new AnchoredCategoryBucketCalculator(this);
    };
    AnchoredCategorySeriesView.prototype.db = function () {
        this.cw.cacheValues();
    };
    AnchoredCategorySeriesView.prototype.dd = function () {
        this.cw.unCacheValues();
    };
    AnchoredCategorySeriesView.prototype.de = function (a) {
        var b = this.cz.item(a);
        return this.cu(b);
    };
    AnchoredCategorySeriesView.prototype.a7 = function (a, b) {
        if (a.d) {
            if (this.c5.trendLineType != 0 && !b) {
                var c = this.c7.g$j;
                c.ad = this.c5.trendLineThickness;
                c._stroke = this.c5.abq;
                c.ai = this.c5.abr;
                c.aj = this.c5.abs;
                a.v(c);
            }
        }
        _super.prototype.a7.call(this, a, b);
    };
    AnchoredCategorySeriesView.prototype.getDefaultTooltipTemplate = function () {
        return this.c5.aai.c$c(this.e, this.c5.aa3);
    };
    AnchoredCategorySeriesView.$t = markType(AnchoredCategorySeriesView, 'AnchoredCategorySeriesView', CategorySeriesView.$);
    return AnchoredCategorySeriesView;
}(CategorySeriesView));
export { AnchoredCategorySeriesView };
