/*
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 { Base, typeCast, markType, Array_$type, Number_$type, Point_$type, enumGetBox, runOn, delegateCombine, fromEnum, markDep } from "igniteui-angular-core";
import { IBucketizer_$type } from "./IBucketizer";
import { ArgumentNullException } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { ISortingAxis_$type } from "./ISortingAxis";
import { ScalerParams } from "./ScalerParams";
import { Series } from "./Series";
import { truncate, intDivide, isNaN_, isInfinity } from "igniteui-angular-core";
import { FramePreparer } from "./FramePreparer";
import { IIsCategoryBased_$type } from "./IIsCategoryBased";
import { List$1 } from "igniteui-angular-core";
import { ISupportsMarkers_$type } from "./ISupportsMarkers";
import { IProvidesViewport_$type } from "./IProvidesViewport";
import { ISupportsErrorBars_$type } from "./ISupportsErrorBars";
import { CategoryFrame } from "./CategoryFrame";
import { PreparationParams } from "./PreparationParams";
import { IDateTimeAxis_$type } from "./IDateTimeAxis";
import { NumericAxisBase } from "./NumericAxisBase";
import { IHasCategoryTrendline_$type } from "./IHasCategoryTrendline";
import { IHasSingleValueCategory_$type } from "./IHasSingleValueCategory";
import { DefaultCategoryTrendlineHost } from "./DefaultCategoryTrendlineHost";
import { DefaultSingleValueProvider } from "./DefaultSingleValueProvider";
import { SingleValuesHolder } from "./SingleValuesHolder";
import { MarkerSeries } from "./MarkerSeries";
import { IHasCategoryModePreference_$type } from "./IHasCategoryModePreference";
import { ICategorySeriesInteractionManager_$type } from "./ICategorySeriesInteractionManager";
import { DVContainer } from "igniteui-angular-core";
import { DependencyProperty } from "igniteui-angular-core";
import { CategoryCollisionMode_$type } from "./CategoryCollisionMode";
import { CategoryTransitionInMode_$type } from "./CategoryTransitionInMode";
import { HighlightingInfo } from "igniteui-angular-core";
import { CategoryTransitionSourceFramePreparer } from "./CategoryTransitionSourceFramePreparer";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { Marker } from "./Marker";
import { MarkerSeriesView } from "./MarkerSeriesView";
import { CategorySeriesRenderManager } from "./CategorySeriesRenderManager";
import { Pool$1 } from "igniteui-angular-core";
import { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay";
import { DoubleCollection } from "igniteui-angular-core";
import { Clipper } from "igniteui-angular-core";
import { ChartSelection } from "./ChartSelection";
import { PropertyMetadata } from "igniteui-angular-core";
import { round10N } from "igniteui-angular-core";
/**
 * @hidden
 */
export let CategoryBucketCalculator = /*@__PURE__*/ (() => {
    class CategoryBucketCalculator extends Base {
        constructor(a) {
            super();
            this.c = null;
            this.e = 0;
            this.f = 0;
            this.d = 0;
            if (a == null) {
                throw new ArgumentNullException(0, "view");
            }
            this.c = a;
            this.e = -1;
            this.d = 0;
        }
        getBucket(a) {
            return null;
        }
        getBucketWithoutUnknowns(a) {
            return this.getBucket(a);
        }
        getErrorBucket(a, b) {
            return NaN;
        }
        g(a) {
            let b = this.c.ca;
            let c = this.c.b9;
            let d = this.c.db;
            let e = typeCast(CategoryAxisBase.$, d.fetchXAxis());
            let f = d.dp;
            if (b.isEmpty || c.isEmpty || e == null || f == null || f.count == 0) {
                this.d = 0;
                return;
            }
            let g = d.getEffectiveViewport1(this.c);
            let h = d.wt(this.c);
            let i = typeCast(ISortingAxis_$type, e);
            if (i == null || i.i$b == null) {
                let j = new ScalerParams(0, b, c, e.df, g);
                let k = Math.floor(e.fw(h.left, j));
                let l = Math.ceil(e.fw(h.right, j));
                if (e.df) {
                    l = Math.ceil(e.fw(h.left, j));
                    k = Math.floor(e.fw(h.right, j));
                }
                l = Math.min(l, e.o6 - 1);
                let m = Math.floor((l - k + 1) * a / h.width);
                this.d = truncate(Math.max(1, m));
                this.e = truncate(Math.max(0, Math.floor(k / this.d) - 1));
                this.f = truncate(Math.ceil(l / this.d));
            }
            else {
                this.e = i.i$e(b, c, g, h);
                this.f = i.i$g(b, c, g, h);
                this.d = 1;
            }
        }
        getBucketInfo(a, b, c, d) {
            a = this.e;
            b = this.f;
            c = this.d;
            d = this.c.db.ie;
            return {
                p0: a,
                p1: b,
                p2: c,
                p3: d
            };
        }
        cacheValues() {
        }
        unCacheValues() {
        }
    }
    CategoryBucketCalculator.$t = markType(CategoryBucketCalculator, 'CategoryBucketCalculator', Base.$, [IBucketizer_$type]);
    return CategoryBucketCalculator;
})();
/**
 * @hidden
 */
export let CategoryFramePreparerBase = /*@__PURE__*/ (() => {
    class CategoryFramePreparerBase extends FramePreparer {
        constructor(a, ..._rest) {
            a = (a == void 0) ? 0 : a;
            switch (a) {
                case 0:
                    {
                        let c = _rest[0];
                        let d = [c, typeCast(ISupportsMarkers_$type, c), typeCast(IProvidesViewport_$type, c), typeCast(ISupportsErrorBars_$type, c), typeCast(IBucketizer_$type, c)];
                        {
                            let f = d[0];
                            let g = d[1];
                            let h = d[2];
                            let i = d[3];
                            let j = d[4];
                            super(1, g, h, i);
                            this.g = null;
                            this.h = null;
                            this.m = false;
                            this.o = new List$1(Array_$type, 0);
                            this.p = new List$1(Number_$type, 0);
                            this.n = new List$1(Number_$type, 0);
                            this.h = f;
                            this.g = j;
                        }
                    }
                    break;
                case 1:
                    {
                        let c = _rest[0];
                        let d = _rest[1];
                        let e = _rest[2];
                        let f = _rest[3];
                        let g = _rest[4];
                        super(1, d, e, f);
                        this.g = null;
                        this.h = null;
                        this.m = false;
                        this.o = new List$1(Array_$type, 0);
                        this.p = new List$1(Number_$type, 0);
                        this.n = new List$1(Number_$type, 0);
                        this.h = c;
                        this.g = g;
                    }
                    break;
            }
        }
        i(a) {
            let b = new PreparationParams();
            b.f = this.h.useHighMarkerFidelity;
            b.b = this.h.scaler;
            b.c = this.h.yScaler;
            b.d = typeCast(ISortingAxis_$type, b.b);
            b.a = typeCast(CategoryFrame.$, a);
            if (b.a == null || b.b == null || b.c == null) {
                return null;
            }
            let c;
            let d;
            let e;
            let f;
            let g = this.g.getBucketInfo(c, d, e, f);
            c = g.p0;
            d = g.p1;
            e = g.p2;
            f = g.p3;
            b.k = c;
            b.l = d;
            b.j = e;
            b.i = f;
            if (b.l < b.k) {
                return null;
            }
            let h;
            let i;
            let j;
            let k = this.a.getViewInfo(i, h);
            i = k.p0;
            h = k.p1;
            j = this.a.getEffectiveViewport();
            let l = this.a.getMainContentViewport();
            b.p = h;
            b.o = i;
            b.n = j;
            b.m = l;
            if (Rect.l_op_Equality(b.p, Rect.empty) || Rect.l_op_Equality(b.o, Rect.empty)) {
                return null;
            }
            if (this.h != null && (typeCast(Series.$, this.h) !== null && this.h.isFragment) && this.g != null) {
                b.e = true;
            }
            return b;
        }
        r(a, b, c, d) {
            return a.getSeriesOffset(b, c, d, this.h.currentMode2Index, this.h.currentCategoryMode);
        }
        s(a) {
            return this.r(a.b, a.p, a.o, a.n);
        }
        d(a, b) {
            let c = this.i(a);
            if (c == null || this.g == null) {
                return;
            }
            c.a.h.clear();
            c.a.m.clear();
            c.a.p.clear();
            c.a.s.clear();
            c.a.k.clear();
            c.a.j.clear();
            c.a.i.clear();
            if (c.a.o != null) {
                c.a.o.clear();
            }
            let d = this.c.shouldDisplayMarkers;
            let e = false;
            let f = this.s(c);
            let g = this.j(c);
            if (c.d != null && c.d.i$b != null && c.d.i$b.count != g.e) {
                return;
            }
            if (c.d != null && c.d.i$a) {
                c.d.i$h();
            }
            this.g.cacheValues();
            if (this.m && c.d != null && c.d.i$b.count > 0) {
                let h = c.d.i$b._inner[c.k];
                this.z(g, h, true, c.e);
                while ((isNaN_(g.c) || isNaN_(g.d)) && c.k > 0) {
                    c.k = c.k - 1;
                    h = c.d.i$b._inner[c.k];
                    this.z(g, h, true, c.e);
                }
                let i = c.d.i$b._inner[c.l];
                this.z(g, i, true, c.e);
                while ((isNaN_(g.c) || isNaN_(g.d)) && c.l < g.e - 1) {
                    c.l = c.l + 1;
                    i = c.d.i$b._inner[c.l];
                    this.z(g, i, true, c.e);
                }
            }
            if (this.m && c.d == null) {
                let j = c.k;
                let k = this.g.getBucket(j);
                while ((isNaN_(k[1]) || isNaN_(k[2])) && c.k > 0) {
                    c.k = c.k - 1;
                    j = c.k;
                    k = this.g.getBucket(j);
                }
                let l = c.l;
                k = this.g.getBucket(l);
                while ((isNaN_(k[1]) || isNaN_(k[2])) && c.l < (intDivide(g.e, c.j))) {
                    c.l = c.l + 1;
                    l = c.l;
                    k = this.g.getBucket(l);
                }
            }
            this.w(c, g, f);
            let m = this.t(c, g, f, d, e);
            this.c.updateMarkerCount(m);
            this.v(typeCast(CategoryFrame.$, a), b, c);
            this.g.unCacheValues();
            return;
        }
        v(a, b, c) {
        }
        get q() {
            return this.o;
        }
        t(a, b, c, d, e) {
            let f = 0;
            let g = false;
            let h = null;
            let i = false;
            let j = a.d != null;
            let k = a.p;
            let l = a.o;
            let m = typeCast(NumericAxisBase.$, a.c) !== null && a.c.pc;
            let n = a.f;
            let o = this.h.mayContainUnknowns;
            let p = this.o;
            let q = this.n;
            let r = this.p;
            p.clear();
            q.clear();
            r.clear();
            let s = this.g;
            let t = this.h.provideCollisionDetector();
            let u = 0;
            let v = a.n;
            let w = new ScalerParams(0, k, l, a.b.j$b, v);
            let x = ((() => {
                let $ret = new ScalerParams(0, k, l, a.c.j$b, v);
                $ret.b = typeCast(Series.$, this.h) !== null ? this.h.i0() : NaN;
                return $ret;
            })());
            if (j) {
                u = a.b.j$d(2, w) - a.b.j$d(1, w);
                i = this.k();
            }
            let y = a.k;
            let z = a.l;
            let aa = a.a.h;
            let ab = typeCast(IDateTimeAxis_$type, a.b);
            if (ab != null) {
                ab.StartTimeCursor();
            }
            for (let ac = y; ac <= z; ++ac) {
                let ad;
                if (!j) {
                    if (!o) {
                        ad = s.getBucketWithoutUnknowns(ac);
                    }
                    else {
                        ad = s.getBucket(ac);
                    }
                }
                else {
                    ad = ((() => { let ae = this.f(a, ac, b, u, g, h, c); ac = ae.p1; g = ae.p4; h = ae.p5; return ae.ret; })());
                }
                let ae = !m || (m && ad[1] > 0);
                let af = ad[0];
                if (!j || !isNaN_(ad[0])) {
                    aa.add(ad);
                    if (j) {
                        if (a.a.o == null) {
                            a.a.o = new List$1(Number_$type, 0);
                        }
                        a.a.o.add(ac * a.j);
                    }
                    if (g && i) {
                        if (h != null) {
                            aa.add(h);
                            if (j) {
                                if (a.a.o == null) {
                                    a.a.o = new List$1(Number_$type, 0);
                                }
                                a.a.o.add(ac * a.j);
                            }
                        }
                    }
                    if (d && ae) {
                        let ag = ac * a.j;
                        let ah = ag;
                        if (j && a.d.i$b != null && ag >= 0 && ag < a.d.i$b.count) {
                            ag = a.d.i$b._inner[ag];
                        }
                        let ai = new Array(ad.length);
                        ai[0] = ad[0];
                        ai[1] = ad[1];
                        ai[2] = ad[2];
                        if (n && ag < b.e) {
                            ai = new Array(ad.length);
                            ai[0] = af;
                            this.z(b, ag, true, a.e);
                            ai[1] = b.c;
                            ai[2] = b.d;
                        }
                        p.add(ai);
                        q.add(a.a.h.count - 1);
                        r.add(ag);
                    }
                }
            }
            if (ab != null) {
                ab.ResetTimeCursor();
            }
            this.y(a, c, j, w, x, e, d);
            if (d) {
                let aj = p.count;
                let ak;
                for (let al = 0; al < aj; al++) {
                    ak = p._inner[al];
                    if (this.l(a.a, ak, t, Math.min(r._inner[al], b.e - 1), f, q._inner[al])) {
                        ++f;
                    }
                }
            }
            return f;
        }
        k() {
            if (typeCast(Series.$, this.h) !== null) {
                return this.h.ex;
            }
            return false;
        }
        f(a, b, c, d, e, f, g) {
            let h;
            f = null;
            e = false;
            let i = typeCast(CategorySeries.$, this.h);
            let j = a.o;
            let k = a.p;
            let l = a.n;
            let m = new ScalerParams(0, k, j, a.b.j$b, l);
            let n = new ScalerParams(0, k, j, a.c.j$b, l);
            let o = a.e;
            if (a.d == null || a.d.i$b == null || a.d.i$b.count == 0) {
                return {
                    ret: [NaN, NaN, NaN],
                    p1: b,
                    p4: e,
                    p5: f
                };
            }
            if (i != null && i.dp != null && i.dp.count < a.d.i$b.count) {
                return {
                    ret: [NaN, NaN, NaN],
                    p1: b,
                    p4: e,
                    p5: f
                };
            }
            let p = a.d.i$b._inner[b];
            let q = a.d.i$d(p);
            let r = q;
            this.z(c, p, false, o);
            while (b < a.l) {
                p = a.d.i$b._inner[b + 1];
                r = a.d.i$d(p);
                this.z(c, p, true, o);
                if (r - q >= d || isNaN_(c.c) || isNaN_(c.d)) {
                    if (e) {
                        let s = a.d.i$b._inner[b];
                        this.z(c, s, true, o);
                        f = [a.b.j$c(q, m), c.c, c.d];
                    }
                    break;
                }
                if (!e && this.k()) {
                    let t = a.d.i$b._inner[b];
                    this.z(c, t, true, o);
                    let u = [a.b.j$c(q, m), c.c, c.d];
                    if (!isNaN_(u[0])) {
                        if (!isNaN_(u[1]) && !isNaN_(u[2])) {
                            if (a.d != null) {
                                u[0] = u[0] + g;
                            }
                            a.a.h.add(u);
                            if (a.d != null) {
                                if (a.a.o == null) {
                                    a.a.o = new List$1(Number_$type, 0);
                                }
                                a.a.o.add(b);
                            }
                            e = true;
                        }
                        else {
                            break;
                        }
                    }
                }
                b++;
                this.u(c, p, o);
            }
            let v = NaN;
            if (!isNaN_(q)) {
                v = a.b.j$c(q, m);
            }
            h = this.e(v, c);
            return {
                ret: h,
                p1: b,
                p4: e,
                p5: f
            };
        }
        y(a, b, c, d, e, f, g) {
            let h = a.j;
            let i = a.a.h.count;
            let j = a.a.h;
            let k = this.o;
            let l = k.count;
            if (f) {
                let m = a.c.j$c(a.c.p5, e);
                a.c.j$f(a.a.m, 0, a.a.m.count, e);
                let n = a.a.m;
                let o = n.count;
                for (let p = 0; p < n.count; p++) {
                    n._inner[p] = Math.abs(n._inner[p] - m);
                }
            }
        }
        w(a, b, c) {
        }
    }
    CategoryFramePreparerBase.$t = markType(CategoryFramePreparerBase, 'CategoryFramePreparerBase', FramePreparer.$);
    return CategoryFramePreparerBase;
})();
/**
 * @hidden
 */
export let CategoryFramePreparer = /*@__PURE__*/ (() => {
    class CategoryFramePreparer extends CategoryFramePreparerBase {
        constructor(a, ..._rest) {
            a = (a == void 0) ? 0 : a;
            switch (a) {
                case 0:
                    {
                        let c = _rest[0];
                        let d = [c, typeCast(ISupportsMarkers_$type, c), typeCast(IProvidesViewport_$type, c), typeCast(ISupportsErrorBars_$type, c), typeCast(IBucketizer_$type, c)];
                        {
                            let f = d[0];
                            let g = d[1];
                            let h = d[2];
                            let i = d[3];
                            let j = d[4];
                            super(1, f, g, h, i, j);
                            this.aa = new DefaultCategoryTrendlineHost();
                            this.ab = new DefaultSingleValueProvider();
                            this.ac = null;
                            this.ad = null;
                            this.ac = this.aa;
                            if (typeCast(IHasCategoryTrendline_$type, f) !== null) {
                                this.ac = typeCast(IHasCategoryTrendline_$type, f);
                            }
                            this.ad = this.ab;
                            if (typeCast(IHasSingleValueCategory_$type, f) !== null) {
                                this.ad = typeCast(IHasSingleValueCategory_$type, f);
                            }
                        }
                    }
                    break;
                case 1:
                    {
                        let c = _rest[0];
                        let d = _rest[1];
                        let e = _rest[2];
                        let f = _rest[3];
                        let g = _rest[4];
                        super(1, c, d, e, f, g);
                        this.aa = new DefaultCategoryTrendlineHost();
                        this.ab = new DefaultSingleValueProvider();
                        this.ac = null;
                        this.ad = null;
                        this.ac = this.aa;
                        if (typeCast(IHasCategoryTrendline_$type, c) !== null) {
                            this.ac = typeCast(IHasCategoryTrendline_$type, c);
                        }
                        this.ad = this.ab;
                        if (typeCast(IHasSingleValueCategory_$type, c) !== null) {
                            this.ad = typeCast(IHasSingleValueCategory_$type, c);
                        }
                    }
                    break;
            }
        }
        l(a, b, c, d, e, f) {
            let g = b[0];
            let h = b[1];
            let i = new Rect(0, g - 5, h - 5, 11, 11);
            if (!isNaN_(g) && !isNaN_(h) && !isInfinity(g) && !isInfinity(h) && c.tryAdd(i)) {
                a.p.add({ $type: Point_$type, x: g, y: h });
                this.c.updateMarkerTemplate(e, d, f);
                return true;
            }
            return false;
        }
        j(a) {
            let b = new SingleValuesHolder();
            let c = this.ad.valueColumn;
            b.f = c;
            return b;
        }
        x(a, b, c, d, e, f) {
            if (d) {
                b[0] = b[0] + c;
            }
            else {
                b[0] = a.b.j$c(b[0], e) + c;
            }
            b[1] = a.c.j$c(b[1], f);
            if (a.j > 1 || d) {
                b[2] = a.c.j$c(b[2], f);
            }
            else {
                b[2] = b[1];
            }
        }
        y(a, b, c, d, e, f, g) {
            super.y(a, b, c, d, e, f, g);
            let h = a.j;
            let i = a.a.h.count;
            let j = a.a.h;
            let k = this.q;
            let l = k.count;
            let m = new List$1(Number_$type, 0);
            if (!c) {
                m.add(0);
            }
            let n = new List$1(Number_$type, 0);
            n.add(1);
            if (c || h > 1) {
                n.add(2);
            }
            a.b.j$e(j, m, 0, i, d);
            a.c.j$e(j, n, 0, i, e);
            for (let o = 0; o < i; o++) {
                j._inner[o][0] = j._inner[o][0] + b;
            }
            if (h == 1 && !c) {
                for (let p = 0; p < i; p++) {
                    j._inner[p][2] = j._inner[p][1];
                }
            }
            if (g) {
                a.b.j$e(k, m, 0, l, d);
                a.c.j$e(k, n, 0, l, e);
                for (let q = 0; q < l; q++) {
                    k._inner[q][0] = k._inner[q][0] + b;
                }
                if (h == 1 && !c) {
                    for (let r = 0; r < l; r++) {
                        k._inner[r][2] = k._inner[r][1];
                    }
                }
            }
        }
        w(a, b, c) {
            if (this.ac.trendLineType == 0 || this.ac.trendlinePreparer == null || this.ac.trendLinePeriod < 1) {
                return;
            }
            this.ac.trendlinePreparer.prepareLine(this.ac, a, b, c);
        }
        z(a, b, c, d) {
            let e = a;
            let f = e.f;
            let g = f.item(b);
            let h = g;
            if (d) {
                let i = this.g.getBucket(b);
                g = i[1];
                h = i[1];
            }
            if (c) {
                e.c = g;
                e.d = h;
            }
            else {
                e.a = g;
                e.b = h;
            }
        }
        u(a, b, c) {
            let d = a;
            let e = d.f;
            if (b < e.count) {
                let f;
                if (c) {
                    let g = this.g.getBucket(b);
                    f = g[1];
                }
                else {
                    f = e.item(b);
                }
                d.a = Math.min(d.a, f);
                d.b = Math.max(d.b, f);
            }
        }
        e(a, b) {
            let c = b;
            return [a, c.a, c.b];
        }
    }
    CategoryFramePreparer.$t = markType(CategoryFramePreparer, 'CategoryFramePreparer', CategoryFramePreparerBase.$);
    return CategoryFramePreparer;
})();
/**
 * @hidden
 */
export let CategorySeries = /*@__PURE__*/ (() => {
    class CategorySeries extends MarkerSeries {
        constructor() {
            super();
            this.y9 = null;
            this.zh = null;
            this.zq = false;
            this.zp = false;
            this.assigningCategoryStyle = null;
            this.assigningCategoryMarkerStyle = null;
            this.zn = null;
            this.zo = null;
            this.y6 = new CategoryFrame(3);
            this.y8 = new CategoryFrame(3);
            this.y4 = new CategoryFrame(3);
            this.y7 = new CategoryFrame(3);
            this.zc = null;
            this.zg = null;
            this.zc = new CategorySeriesRenderManager();
            this.zg = new CategoryTransitionSourceFramePreparer();
            this.zq = false;
            this.d3 = false;
            this.zp = false;
            this.ab = CategorySeries.$;
        }
        ct() {
            let a = new CategorySeriesView(this);
            return a;
        }
        get zi() {
            if (this.zh == null) {
                this.zh = DVContainer.instance.createInstance(ICategorySeriesInteractionManager_$type, () => this.ds.n);
            }
            return this.zh;
        }
        ed(a, b, c, d, e) {
            if (!this.hasMarkers) {
                return false;
            }
            let f = this.getEffectiveViewport1(this.cw);
            let g = this.y2();
            let h = new ScalerParams(1, this.dc.xm, this.w2, g.df);
            h.c = f;
            let i = this.zj();
            let j = new ScalerParams(1, this.dc.xm, this.w2, i.df);
            j.c = f;
            let k = this.dc.xm;
            let l = this.w2;
            let m = this.currentMode2Index;
            let n = 0;
            if (g.dc && g.c9) {
                n = g.getSeriesOffset(k, l, f, m, g.categoryMode);
            }
            a.clear();
            this.xg.cw((o) => {
                if (o._visibility == 0) {
                    let p = new SeriesPointOfInterest();
                    let q = o.n;
                    let r = o.o;
                    if (!e && (q < this.w2.left || q > this.w2.right || r < this.w2.top || r > this.w2.bottom)) {
                        return;
                    }
                    if (this.isVertical) {
                        if (g.c8 && !g.dc && g.categoryMode != 0) {
                            p.e = o.ak;
                        }
                        else {
                            p.e = g.fw(r, h);
                        }
                        p.d = i.fw(q, j);
                    }
                    else {
                        if (g.c8 && !g.dc && g.categoryMode != 0) {
                            p.d = o.ak;
                        }
                        else {
                            p.d = g.fw(q, h);
                        }
                        p.e = i.fw(r, j);
                    }
                    p.b = o.content;
                    if (b) {
                        if (this.isVertical) {
                            if (c) {
                                p.f = this.z9(p.d, d);
                            }
                            else {
                                let s = this.jg(o);
                                if (!isNaN_(s)) {
                                    p.f = this.z9(s, d);
                                }
                                else {
                                    p.f = this.z9(p.d, d);
                                }
                            }
                        }
                        else {
                            if (c) {
                                p.f = this.z9(p.e, d);
                            }
                            else {
                                let t = this.jg(o);
                                if (!isNaN_(t)) {
                                    p.f = this.z9(t, d);
                                }
                                else {
                                    p.f = this.z9(p.e, d);
                                }
                            }
                        }
                    }
                    else {
                        let u = this.au(true);
                        if (u != null) {
                            let v = this.kw(o.ak, false);
                            if (v != null) {
                                p.f = u.i(v);
                            }
                            else {
                                p.f = null;
                            }
                        }
                        else {
                            p.f = g.ih(o.ak);
                        }
                    }
                    p.c = o.ak;
                    p.g = this.vq;
                    if (this.ha) {
                        p.g = this.vx(o.ak);
                    }
                    a.add(p);
                }
            });
            return true;
        }
        z9(a, b) {
            let c;
            if (b >= 0) {
                c = round10N(a, b);
            }
            else {
                c = a;
            }
            let d = this.au(false);
            if (d != null) {
                let e = d;
                return e.i(c);
            }
            else {
                return c.toString();
            }
        }
        q7(a) {
            super.q7(a);
            this.zd = a;
        }
        preferredCategoryMode(a) {
            return 0;
        }
        get categoryAxis() {
            return this.y2();
        }
        y2() {
            return this.fetchXAxis();
        }
        zj() {
            return this.fetchYAxis();
        }
        get_em() {
            return true;
        }
        get_f6() {
            return this.zj() != null && this.zj().df;
        }
        get_e0() {
            return true;
        }
        ac() {
            super.ac();
            this.zd.c9.g(this.ie);
        }
        zw() {
            return (this.assigningCategoryStyle != null && this.zq) || (this.by != 1) || this.d3 || (this.cq != 1) || (this.cp != 1);
        }
        zx() {
            return (this.assigningCategoryMarkerStyle != null && this.zp) || (this.by != 1) || this.d3 || (this.cq != 1) || (this.cp != 1);
        }
        aaw(a) {
            if (this.assigningCategoryStyle != null && this.zq) {
                this.assigningCategoryStyle(this, a);
            }
        }
        aav(a) {
            if (this.assigningCategoryMarkerStyle != null && this.zp) {
                this.assigningCategoryMarkerStyle(this, a);
            }
        }
        yw(a, b) {
            return null;
        }
        pb(a, b) {
            super.pb(a, b);
            if (a) {
                this.aai(b);
            }
        }
        bs() {
            let a = super.bs();
            return a;
        }
        qh() {
            super.qh();
            let a = this.fetchXAxis();
            if (a != null) {
                a.k3(false);
            }
            let b = this.fetchYAxis();
            if (b != null) {
                b.k3(false);
            }
        }
        sz(a, b) {
            super.sz(a, b);
            this.zd.c9.g(this.ie);
            this.ry(false);
        }
        sy(a, b) {
            if (this.g2 && this.ju < 0.05 && (this.dc == null || !this.dc.f4())) {
                this.g3 = true;
                this.g6 = false;
                this.gl = false;
            }
            super.sy(a, b);
            this.zd.c9.g(this.ie);
            this.ry(false);
        }
        rg(a, b, c, d) {
            super.rg(a, b, c, d);
            switch (b) {
                case "SeriesViewer":
                    let e = this.fetchYAxis();
                    let f = this.fetchXAxis();
                    if (c != null && d == null) {
                        this.pi(f);
                        this.pi(e);
                    }
                    if (c == null && d != null) {
                        this.ro(f);
                        this.ro(e);
                    }
                    this.zd.c9.g(this.ie);
                    this.ry(false);
                    break;
                case "SyncLink":
                    if (this.c4 != null && this.dc != null) {
                        this.zd.c9.g(this.ie);
                    }
                    this.ry(false);
                    break;
                case "TransitionProgress":
                    this.y8.c(this.ju, this.y6, this.y4);
                    if (this.d7(this.cw)) {
                        return;
                    }
                    if (this.ju == 1) {
                        this.y4.y();
                        this.aax(this.y4, this.zd);
                        if (this.g2) {
                            this.g2 = false;
                            this.pc();
                            this.dd.r = truncate(this.jc());
                            this.dd.b = this.de;
                        }
                        if (this.g5) {
                            this.g5 = false;
                            this.pc();
                            this.dd.r = truncate(this.jc());
                            this.dd.b = this.de;
                            this.q6();
                        }
                        this.qu();
                    }
                    else {
                        this.aax(this.y8, this.zd);
                    }
                    if (this.dc != null) {
                        this.dc.rz(this);
                    }
                    break;
                case "ErrorBarSettings":
                    this.qr();
                    break;
                case CategorySeries.$$p[5]:
                    this.ry(false);
                    break;
                case CategorySeries.$$p[2]:
                    this.zq = this.zs();
                    this.ry(false);
                    break;
                case CategorySeries.$$p[1]:
                    this.zp = this.zr();
                    this.ry(false);
                    break;
            }
        }
        zs() {
            return this.zu;
        }
        zr() {
            return this.zt;
        }
        z3(a) {
            return this.iv(a, this.fetchXAxis());
        }
        get_ft() {
            return typeCast(ISortingAxis_$type, this.y2()) !== null;
        }
        a0() {
            return this.y2();
        }
        j9(a) {
            return this.zi.b$d(this, a);
        }
        kr(a) {
            return this.zi.b$f(this, a);
        }
        j7(a) {
            let b = truncate(Math.round(this.it(a)));
            return b;
        }
        it(a) {
            return this.zi.b$c(this, a);
        }
        di(a, b, c) {
            if (this.f0(this.by) && !c) {
                let d = this.zm(a, b, this.zo);
                this.zo = d;
                return d;
            }
            else {
                let e = this.zk(a, b, this.zo);
                e.d = true;
                this.zo = e;
                return e;
            }
        }
        get_ff() {
            return true;
        }
        o9() {
            super.o9();
            this.zn = null;
            this.zo = null;
        }
        dh(a, b, c) {
            if (this.ef && this.f0(this.by) && !c) {
                let d = this.zl(a, b, this.zn);
                this.zn = d;
                return d;
            }
            else {
                let e = this.zk(a, b, this.zn);
                this.zn = e;
                return e;
            }
        }
        z2() {
            return this.zd.dc.a;
        }
        zm(a, b, c) {
            if (!this.xq()) {
                return null;
            }
            let d = this.y5();
            let e = this.z2();
            return this.zi.b$b(this, e, this.z6(this.cw), this.z5(this.cw), d.h, a, b, c);
        }
        zl(a, b, c) {
            let d = this.z6(this.cw);
            let e = this.z7(this.cw);
            let f = this.z5(this.cw);
            let g = this.y5();
            return this.zi.b$a(this, g.h, g.o, d, e, f, a, b, c);
        }
        zk(a, b, c) {
            let d = new HighlightingInfo();
            d.i = this;
            d.g = 0;
            d.f = this.dp != null ? this.dp.count - 1 : 0;
            d.c = true;
            if (c != null && c.g == d.g && c.f == d.f) {
                return c;
            }
            return d;
        }
        y5() {
            let a = this.y4;
            if (this.d4()) {
                if (this.dd.g) {
                    this.dd.t();
                }
                a = this.y8;
            }
            return a;
        }
        aas(a, b, c, d, e, f, g) {
            let h = this.by != 1;
            let i = this.d3;
            let j = this.cq != 1;
            let k = this.cp != 1;
            this.zc.a3(this.zc.d, d.dm, a, b, c, d, e, f, true, g);
            this.zc.aa(this.ic);
            let l = this.zc.ax;
            let m = null;
            let n = this.dp;
            let o = null;
            let p = null;
            let q = null;
            let r = null;
            let s = null;
            if (i && this.dc != null && !l.e) {
                let t = this.vy(l.z);
                let u = this.vz(l.z);
                this.zc.ae = t;
                this.zc.af = u;
                l.aa = t;
                l.ab = u;
            }
            if (h && this.dc != null) {
                m = this.dc.d0.getHighlightingInfo(this, n, l.z, l.y, true);
                if (this.dc.d0.isCrossContextHighlight(this)) {
                    o = this.dc.d0.getHighlightingInfo(this, n, l.z, l.y, true);
                }
                l.c = m;
            }
            if (j && this.dc != null) {
                p = this.dc.d1.getHighlightingInfo(this, n, l.z, l.y, true);
                if (p == null && this.bo != null) {
                    p = this.dc.d1.getHighlightingInfo(this.bo, this.bo.dp, l.z, l.y, true);
                }
                if (this.dc.d1.isCrossContextHighlight(this)) {
                    r = this.dc.d1.getHighlightingInfo(this, n, l.z, l.y, true);
                }
                l.d = p;
            }
            if (k && this.dc != null) {
                q = this.dc.dz.getHighlightingInfo(this, n, l.z, l.y, true);
                if (this.dc.dz.isCrossContextHighlight(this)) {
                    s = this.dc.dz.getHighlightingInfo(this, n, l.z, l.y, true);
                }
                l.b = q;
            }
            l.h = f;
            this.aav(l);
            this.zc.y(this, m, p, q, f, h, j, k, l.v, this.dc.d0.totalHighWaterMark, l.x, this.dc.d1.totalHighWaterMark, l.t, this.dc.dz.totalHighWaterMark);
        }
        aat(a, b, c, d, e, f, g) {
            let h = this.by != 1;
            let i = this.cq != 1;
            let j = this.cp != 1;
            let k = this.d3;
            this.zc.a3(this.zc.b, d.dm, a, b, c, d, e, f, false, g);
            this.zc.ab(this.ic);
            let l = this.zc.ay;
            let m = null;
            let n = null;
            let o = null;
            let p = this.dp;
            if (k && this.dc != null && !l.e) {
                let q = this.vx(l.z);
                let r = this.v0(l.z);
                this.zc.ag = q;
                this.zc.ah = r;
                l.aa = q;
                l.ab = r;
            }
            if (h && this.dc != null) {
                m = this.dc.d0.getHighlightingInfo(this, p, l.z, l.y, false);
                l.c = m;
            }
            if (i && this.dc != null) {
                n = this.dc.d1.getHighlightingInfo(this, p, l.z, l.y, false);
                if (n == null && this.bo != null) {
                    n = this.dc.d1.getHighlightingInfo(this.bo, this.bo.dp, l.z, l.y, false);
                }
                l.d = n;
            }
            if (j && this.dc != null) {
                o = this.dc.dz.getHighlightingInfo(this, p, l.z, l.y, false);
                if (o == null && this.bo != null) {
                    o = this.dc.dz.getHighlightingInfo(this.bo, this.bo.dp, l.z, l.y, false);
                }
                l.b = o;
            }
            l.h = f;
            this.aaw(l);
            this.zc.z(this, m, n, o, f, h, i, j, b < 0);
        }
        hf(a, b, c) {
            let d = super.hf(a, b, c);
            d = d && this.z1(this.fetchXAxis());
            d = d && this.z1(this.fetchYAxis());
            let e = c;
            if (!c.r() || b.isEmpty || a.isEmpty || this.dp == null) {
                d = false;
            }
            if (!d) {
                e.c9.d = 0;
            }
            return d;
        }
        z1(a) {
            if (a == null || a.b0 == null) {
                return false;
            }
            let b = typeCast(CategoryAxisBase.$, a);
            if (b != null) {
                if (b.itemsSource == null) {
                    return false;
                }
                if (b.o5 < 1) {
                    return false;
                }
            }
            else {
                let c = typeCast(NumericAxisBase.$, a);
                if (c != null) {
                    return c.pr != c.pq;
                }
            }
            return true;
        }
        go() {
            return this.zv;
        }
        gp() {
            return true;
        }
        ze() {
            return 12;
        }
        pc() {
            super.pc();
            this.y6.y();
            this.y4.y();
            this.y8.y();
        }
        rz(a) {
            super.rz(a);
            this.zd.c9.g(this.ie);
            if (this.d7(this.cw)) {
                this.y4.ab();
                this.y8.ab();
                this.y6.ab();
                return;
            }
            if (this.gs) {
                if (this.d4()) {
                    if (this.dd.g) {
                        this.dd.t();
                    }
                    this.aax(this.y8, this.zd);
                }
                else {
                    this.aax(this.y4, this.zd);
                }
                return;
            }
            if (this.gg(a)) {
                let b = this.y6;
                if (this.d4()) {
                    if (this.dd.g) {
                        this.dd.t();
                    }
                    this.y6 = this.y8;
                    this.y8 = b;
                }
                else {
                    this.y6 = this.y4;
                    this.y4 = b;
                }
                let c = false;
                this.aau(this.y4, this.zd);
                if (this.g4) {
                    this.dd.w();
                    this.dd.r = truncate(this.jd());
                    this.dd.b = this.df != null ? this.df : this.de;
                    if (this.g5) {
                        let d = this.y8;
                        this.y8 = this.y6;
                        this.y6 = d;
                        c = true;
                    }
                    this.zg.x(this, this.y6, this.y4, this.isVertical, this.fetchXAxis(), this.fetchYAxis(), this.zf, this.ze(), this.c6, this.c5(), runOn(this, this.z4), this.zd.b9);
                    if (this.g5) {
                        let e = this.y8;
                        this.y8 = this.y6;
                        this.y6 = e;
                    }
                    this.g5 = false;
                }
                if (this.g7) {
                    this.dd.w();
                    this.dd.r = truncate(this.je());
                    this.dd.b = this.dg != null ? this.dg : this.de;
                    if (this.g2) {
                        let f = this.y8;
                        this.y8 = this.y6;
                        this.y6 = f;
                        c = true;
                    }
                    this.zg.x(this, this.y6, this.y4, this.isVertical, this.fetchXAxis(), this.fetchYAxis(), this.zf, this.ze(), this.c6, this.c5(), runOn(this, this.z4), this.zd.b9);
                    let g = this.y4;
                    this.y4 = this.y6;
                    this.y6 = g;
                    if (this.g2) {
                        let h = this.y8;
                        this.y8 = this.y6;
                        this.y6 = h;
                    }
                    this.g2 = false;
                }
                this.eb = false;
                if (!c) {
                    this.o7();
                }
                this.sf();
                if (this.g4) {
                    this.g3 = false;
                    this.g2 = true;
                }
                if (this.g7) {
                    this.g6 = false;
                    this.g5 = true;
                }
            }
            else {
                this.aau(this.y4, this.zd);
                this.aax(this.y4, this.zd);
            }
        }
        c5() {
            return 3;
        }
        c8() {
            let a = this.c5();
            switch (a) {
                case 0: return 0;
                case 1: return 1;
                case 4: return 4;
                case 2: return 2;
                case 3: return 3;
            }
            return 3;
        }
        z4() {
            if (this.isVertical) {
                return this.w2.left;
            }
            return this.w2.bottom;
        }
        zy() {
            return false;
        }
        hu() {
            let a = super.hu();
            if (this.zy()) {
                let b = ((() => {
                    let $ret = new SeriesLayerPropertyOverlay();
                    $ret.r = true;
                    $ret.ad = "DashArray";
                    $ret.p = true;
                    $ret.x = ((() => {
                        let $ret = new DoubleCollection();
                        $ret.add(5);
                        $ret.add(5);
                        return $ret;
                    })());
                    $ret.q = true;
                    return $ret;
                })());
                a.add(b);
            }
            if (!this.zy()) {
                let c = ((() => {
                    let $ret = new SeriesLayerPropertyOverlay();
                    $ret.r = true;
                    $ret.ad = "Brush";
                    $ret.p = true;
                    $ret.y = "ActualBrush";
                    $ret.q = true;
                    return $ret;
                })());
                c.valueResolving = delegateCombine(c.valueResolving, runOn(this, this.r8));
                a.add(c);
            }
            if (!this.zy()) {
                let d = ((() => {
                    let $ret = new SeriesLayerPropertyOverlay();
                    $ret.r = true;
                    $ret.ad = "Outline";
                    $ret.p = true;
                    $ret.y = "ActualOutline";
                    $ret.q = true;
                    return $ret;
                })());
                d.valueResolving = delegateCombine(d.valueResolving, runOn(this, this.r8));
                a.add(d);
            }
            let e = ((() => {
                let $ret = new SeriesLayerPropertyOverlay();
                $ret.p = true;
                $ret.ad = "IsTransitionInEnabled";
                $ret.x = true;
                $ret.q = true;
                return $ret;
            })());
            a.add(e);
            let f = ((() => {
                let $ret = new SeriesLayerPropertyOverlay();
                $ret.p = true;
                $ret.ad = "TransitionInMode";
                $ret.x = enumGetBox(CategoryTransitionInMode_$type, 20);
                $ret.q = true;
                return $ret;
            })());
            a.add(f);
            return a;
        }
        kz() {
            if (this.d4()) {
                return this.bo.y8;
            }
            else {
                return this.bo.y4;
            }
        }
        z8() {
            if (this.bo != null) {
                let a = this.bo;
                return a.z8();
            }
            let b = 0;
            let c = this.fetchXAxis();
            for (let d of fromEnum(this.dc.series)) {
                if (d == this) {
                    return b;
                }
                let e = typeCast(CategorySeries.$, d);
                if (e != null) {
                    let f = typeCast(CategoryAxisBase.$, e.fetchXAxis());
                    if (f == c && e.preferredCategoryMode(f) == 2) {
                        b++;
                    }
                }
            }
            return -1;
        }
        get GetErrorBarsXAxis() {
            return this.fetchXAxis();
        }
        get GetErrorBarsYAxis() {
            return this.fetchYAxis();
        }
        aaj(a, b) {
            this.zc.a1(this, this.zx(), runOn(this, this.yw), this.z5(a), this.z6(a));
            let c = this.zc.d;
            let d = c != null;
            let e = this.y2();
            if (e == null) {
                return;
            }
            let f = this.getEffectiveViewport1(a);
            let g = new ScalerParams(0, a.ca, a.b9, e.df, f);
            let h = this.dp == null ? 0 : this.dp.count;
            let i = a;
            let j = b.h;
            let k = i.c9.e;
            let l = i.c9.f;
            let m = i.c9.d;
            let n = k * m;
            for (let o = 0; o < a.dc.count; o++) {
                let p = a.dc.item(o);
                let q = p.content;
                if (d) {
                    let r = p.al;
                    this.aas(j, r, h, e, g, a.t, p.ak);
                }
                this.zc.ac(p, q);
            }
        }
        aax(a, b) {
            this.q3();
            this.ws = a.ad;
            b.a6();
        }
        aau(a, b) {
            a.x();
        }
        z5(a) {
            return a.c9.d;
        }
        z6(a) {
            return a.c9.e;
        }
        z7(a) {
            return a.c9.f;
        }
        aai(a) {
            let b = a;
            b.dc.count = 0;
        }
        r0(a, b) {
            super.r0(a, b);
            if (!this.g1) {
                this.cw.be(b);
                return;
            }
            let c = typeCast(CategorySeriesView.$, this.cv);
            c.c9.g(this.ie);
            this.cw.be(b);
            if (this.d7(this.cv)) {
                return;
            }
            this.r1();
            this.g1 = false;
        }
        r1() {
            super.r1();
            let a = typeCast(CategorySeriesView.$, this.cv);
            if (!this.gt) {
                this.aau(this.y7, a);
            }
            this.gt = false;
            this.aax(this.y7, a);
        }
        za(a) {
            let b = typeCast(CategorySeriesView.$, a);
            if (b != null && b.t) {
                if (b.s) {
                    return new CategoryFramePreparer(1, typeCast(IIsCategoryBased_$type, this), typeCast(ISupportsMarkers_$type, b), b, this, b.c9);
                }
                else {
                    return new CategoryFramePreparer(1, typeCast(IIsCategoryBased_$type, this), typeCast(ISupportsMarkers_$type, b), this.dc.dp.o, this, b.c9);
                }
            }
            else {
                return this.y9;
            }
        }
        aw(a) {
            if (this.fetchXAxis() == a) {
                return this.fetchYAxis();
            }
            if (this.fetchYAxis() == a) {
                return this.fetchXAxis();
            }
            return null;
        }
        ai() {
            return [this.fetchXAxis(), this.fetchYAxis()];
        }
        static yx(a, b, c, d, e) {
            let f = null;
            if (b > -1 && !d.isEmpty && !c.isEmpty) {
                let g = a._inner[0][0] < c.left - 2000 ? c.left - 10 : NaN;
                let h = c.bottom + 10;
                let i = a._inner[b][0] > c.right + 2000 ? c.right + 10 : NaN;
                let j = c.top - 10;
                f = new Clipper(1, g, h, i, j, e);
            }
            return f;
        }
        aap(a, b, c, d, e) {
            let f = this.dc.x1(this.dc.xr(a));
            let g = this.y2();
            let h = this.zj();
            let i = this.fetchXAxis();
            let j = g == i;
            let k = this.dc.xu(this.w2, this.getEffectiveViewport(), f);
            let l, m;
            let n = this.aal(f, g, j, k, l, m);
            l = n.p4;
            m = n.p5;
            if (d == 0) {
                this.aar(b, l, m, c);
            }
            else {
                let o, p;
                let q = this.aak(f, h, j, k, o, p);
                o = q.p4;
                p = q.p5;
                this.aaq(e, b, l, m, o, p, c);
            }
        }
        aar(a, b, c, d) {
            if (b == -1 || c == -1) {
                return;
            }
            if (d == 7 || d == 6) {
                a.add(((() => {
                    let $ret = new ChartSelection();
                    $ret.series = this;
                    return $ret;
                })()));
                return;
            }
            for (let e = b; e <= c; e++) {
                this.aah(a, e, d);
            }
        }
        aak(a, b, c, d, e, f) {
            let g = new ScalerParams(0, a, this.dc.x4, b.df, this.getEffectiveViewport());
            let h = c ? (b.df ? d.top : d.bottom) : (b.df ? d.right : d.left);
            let i = c ? (b.df ? d.bottom : d.top) : (b.df ? d.left : d.right);
            e = b.fw(h, g);
            f = b.fw(i, g);
            return {
                p4: e,
                p5: f
            };
        }
        aal(a, b, c, d, e, f) {
            let g = new ScalerParams(0, a, this.dc.x4, b.df, this.getEffectiveViewport());
            let h = c ? (b.df ? d.right : d.left) : (b.df ? d.top : d.bottom);
            let i = c ? (b.df ? d.left : d.right) : (b.df ? d.bottom : d.top);
            let j = b.fw(h, g);
            let k = b.fw(i, g);
            let l = this.aam(b, j, k, e, f);
            e = l.p3;
            f = l.p4;
            return {
                p4: e,
                p5: f
            };
        }
        aam(a, b, c, d, e) {
            let f = this.aao(a, b, c, d, e);
            d = f.p3;
            e = f.p4;
            return {
                p3: d,
                p4: e
            };
        }
        aao(a, b, c, d, e) {
            let f = a.ou(this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw));
            let g = a.getCategorySize(this.cw.ca, this.cw.b9, this.getEffectiveViewport1(this.cw));
            let h = (f * a.o7) / g;
            let i = 1 - h;
            let j = f / g;
            let k = 0;
            for (let l = 0; l < a.eh.count; l++) {
                if (!a.eh._inner[l].e0) {
                    continue;
                }
                let m = a.eh._inner[l];
                let n = m;
                let o = n.preferredCategoryMode(a);
                if (o != 2) {
                    continue;
                }
                if (a.eh._inner[l] == this) {
                    break;
                }
                k++;
            }
            let p = a.o7 - k - 1;
            d = Math.max(0, truncate((a.categoryMode == 0 ? Math.ceil(b) : Math.floor(b + (i / 2) + (p * j)))));
            e = Math.min(truncate(Math.floor(c - (i / 2) - (k * j))), this.dp.count - 1);
            return {
                p3: d,
                p4: e
            };
        }
        aan(a, b, c, d, e) {
            d = Math.max(0, truncate((a.categoryMode == 0 ? Math.ceil(b) : Math.ceil(b - 0.5))));
            e = Math.min(truncate((a.categoryMode == 0 ? Math.floor(c) : Math.floor(c - 0.5))), this.dp.count - 1);
            return {
                p3: d,
                p4: e
            };
        }
    }
    CategorySeries.$t = markType(CategorySeries, 'CategorySeries', MarkerSeries.$, [IHasCategoryModePreference_$type, ISupportsErrorBars_$type]);
    CategorySeries.$$p = markDep(DependencyProperty, PropertyMetadata, CategorySeries, 'raisePropertyChanged', ['CategoryCollisionMode:y3:aay', [CategoryCollisionMode_$type, enumGetBox(CategoryCollisionMode_$type, 0)], 'IsCustomCategoryMarkerStyleAllowed:zt:aaz', [0, false], 'IsCustomCategoryStyleAllowed:zu:aa0', [0, false], 'IsTransitionInEnabled:zv:aa1', [0, false], 'TransitionInMode:zf:aa2', [CategoryTransitionInMode_$type, enumGetBox(CategoryTransitionInMode_$type, 0)], 'UseHighMarkerFidelity:z0:aa3', [0, false]]);
    return CategorySeries;
})();
/**
 * @hidden
 */
export let CategorySeriesView = /*@__PURE__*/ (() => {
    class CategorySeriesView extends MarkerSeriesView {
        constructor(a) {
            super(a);
            this.db = null;
            this.de = 0;
            this.c9 = null;
            this.dc = null;
            this.de = -1;
            this.db = a;
            this.c9 = this.da();
            this.dc = ((() => {
                let $ret = new Pool$1(Marker.$);
                $ret.create = runOn(this, this.cg);
                $ret.activate = runOn(this, this.c1);
                $ret.disactivate = runOn(this, this.c3);
                $ret.destroy = runOn(this, this.c2);
                return $ret;
            })());
        }
        dd(a) {
            if (this.de != a.w) {
                return true;
            }
            return false;
        }
        dg(a) {
            this.de = a.w;
        }
        updateMarkerTemplate(a, b, c) {
            if (!this.ch.xs) {
                let d = this.dc.item(a);
                let e = d.content;
                e.item = this.f.dp.item(b);
                d.ak = b;
                d.al = c;
            }
        }
        da() {
            return new CategoryBucketCalculator(this);
        }
        get shouldDisplayMarkers() {
            return this.db.xq();
        }
        updateMarkerCount(a) {
            this.dc.count = a;
        }
        cw(a) {
            this.dc.c(a);
        }
        df() {
        }
    }
    CategorySeriesView.$t = markType(CategorySeriesView, 'CategorySeriesView', MarkerSeriesView.$, [ISupportsMarkers_$type]);
    return CategorySeriesView;
})();
