/*
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, Point_$type, toNullable, String_$type, fromEnum, markType } from "igniteui-angular-core";
import { ISeriesInteractionManager_$type } from "./ISeriesInteractionManager";
import { Dictionary$2 } from "igniteui-angular-core";
import { SeriesView } from "./SeriesView";
import { ScalerParams } from "./ScalerParams";
import { List$1 } from "igniteui-angular-core";
import { GeometryUtil } from "igniteui-angular-core";
import { PolygonUtil } from "igniteui-angular-core";
import { RectUtil } from "igniteui-angular-core";
import { BrushUtil } from "igniteui-angular-core";
import { Color } from "igniteui-angular-core";
import { truncate, isNaN_ } from "igniteui-angular-core";
import { boxArray$1 } from "igniteui-angular-core";
import { stringIsNullOrEmpty } from "igniteui-angular-core";
/**
 * @hidden
 */
export let SeriesInteractionManager = /*@__PURE__*/ (() => {
    class SeriesInteractionManager extends Base {
        constructor() {
            super(...arguments);
            this.a = null;
            this.b = null;
            this.a$p = null;
            this.a$c = false;
            this.i = false;
            this.c = false;
            this.d = false;
            this.e = true;
            this.f = false;
            this._toolTipObject = null;
            this.p = null;
            this.t = null;
            this.o = null;
            this.j = false;
            this.k = new Dictionary$2(String_$type, SeriesView.$, 0);
        }
        a$j(a, b, c, d, e, f, g, h) {
            if (d == null) {
                return Number.POSITIVE_INFINITY;
            }
            if (c < 0 || c > g - 1) {
                return Number.POSITIVE_INFINITY;
            }
            let i;
            let j = NaN;
            let k = NaN;
            let l = NaN;
            let m = NaN;
            if (d.cm) {
                let n = d;
                i = h(b);
                let o = truncate(Math.floor(i));
                let p = truncate(Math.ceil(i));
                m = i - o;
                if (o >= 0 && o < g) {
                    let q = n.i$d(n.i$b._inner[o]);
                    j = d.ei(q, e) + f;
                }
                else {
                    j = NaN;
                }
                if (p >= 0 && p < g) {
                    let r = n.i$d(n.i$b._inner[p]);
                    k = d.ei(r, e) + f;
                }
                else {
                    k = NaN;
                }
                if (isNaN_(j) && !isNaN_(k)) {
                    j = k;
                }
                if (isNaN_(k) && !isNaN_(j)) {
                    k = j;
                }
                if (c >= 0 && c < g) {
                    let s = n.i$d(n.i$b._inner[c]);
                    l = d.ei(s, e) + f;
                }
            }
            else {
                i = a.f5(b);
                let t = truncate(Math.floor(i));
                let u = truncate(Math.ceil(i));
                m = i - t;
                if (t >= 0 && t < g) {
                    j = d.ei(t, e) + f;
                }
                else {
                    j = NaN;
                }
                if (u >= 0 && u < g) {
                    k = d.ei(u, e) + f;
                }
                else {
                    k = NaN;
                }
                if (isNaN_(j) && !isNaN_(k)) {
                    j = k;
                }
                if (isNaN_(k) && !isNaN_(j)) {
                    k = j;
                }
                if (c >= 0 && c < g) {
                    l = d.ei(c, e) + f;
                }
            }
            let v = j + m * (k - j);
            return Math.abs(l - v);
        }
        a$l(a, b, c, d, e, f, g, h, i) {
            let j = NaN;
            if (d >= 0 && d < c.count) {
                j = c.item(d);
            }
            let k = NaN;
            if (e >= 0 && e < c.count) {
                k = c.item(e);
            }
            if (g == 0) {
                return k;
            }
            if (f == c.count - 1) {
                return j;
            }
            if (isNaN_(k) && h != 0 && b <= 0.5 && !i) {
                return j;
            }
            if (isNaN_(j) && h != 0 && b >= 0.5 && !i) {
                return k;
            }
            return j * (1 - b) + k * b;
        }
        a$a(a, b, c, d, e, f, g) {
            if (b == null) {
                return null;
            }
            let h = -1;
            let i = -1;
            if (b.cm) {
                let j = a.pg(f);
                let k = -1;
                let l = b.cg;
                let m = a.b0.bu.right * 2;
                k = SeriesInteractionManager.n(c, j, l, m);
                if (k < 0) {
                    k = ~k;
                    k--;
                }
                if (k < 0) {
                    k = 0;
                }
                if (k > c.count - 1) {
                    k = c.count - 1;
                }
                let n = k;
                let o = k + 1;
                if (o > c.count - 1) {
                    o = c.count - 1;
                }
                h = n;
                i = o;
            }
            else {
                let p = a.hj(f, g);
                let q = a.hh(f, g);
                let r = truncate(Math.floor(p / d));
                let s = truncate(Math.floor(q / d));
                h = r - e;
                i = s - e;
                if (i == h) {
                    i++;
                }
            }
            if (h < 0) {
                h = 0;
            }
            if (h > c.count - 1) {
                h = c.count - 1;
            }
            if (i < 0) {
                i = 0;
            }
            if (i > c.count - 1) {
                i = c.count - 1;
            }
            if (h < 0 || i < 0) {
                return null;
            }
            let t = c._inner[h];
            let u = c._inner[i];
            let v = new Array(2);
            v[0] = t;
            v[1] = u;
            return v;
        }
        static n(a, b, c, d) {
            let e = 0;
            let f = a.count - 1;
            while (e <= f) {
                let g = (e + ((f - e) >> 1));
                let h;
                let i = a.item(g);
                if (c) {
                    h = (d - b.x) < (d - i[0]) ? -1 : ((d - b.x) > (d - i[0]) ? 1 : 0);
                }
                else {
                    h = b.x < i[0] ? -1 : (b.x > i[0] ? 1 : 0);
                }
                if (h < 0) {
                    f = g - 1;
                }
                else if (h > 0) {
                    e = g + 1;
                }
                else {
                    return g;
                }
            }
            return ~e;
        }
        a$o(a, b, c, d, e, f) {
            if (d == null) {
                return -1;
            }
            let g = d.cm;
            let h = a.e8;
            let i = null;
            if (g) {
                i = d;
            }
            let j = -1;
            let k = -1;
            let l = -1;
            if (g) {
                j = e(b);
                if (isNaN_(j)) {
                    return -1;
                }
                k = truncate(Math.floor(j));
                l = truncate(Math.ceil(j));
            }
            else {
                j = a.f5(b);
                if (isNaN_(j)) {
                    return -1;
                }
                k = truncate(Math.floor(j));
                l = truncate(Math.ceil(j));
            }
            if (f == null) {
                return -1;
            }
            if (k < 0 || k > f.count - 1) {
                return -1;
            }
            if (!c) {
                return k;
            }
            let m = NaN;
            if (g && !h) {
                if (k < i.i$b.count && i.i$b._inner[k] < f.count) {
                    m = f.item(i.i$b._inner[k]);
                }
            }
            else {
                m = f.item(k);
            }
            while (isNaN_(m)) {
                k--;
                if (k < 0 || k > f.count - 1) {
                    return -1;
                }
                if (g && !h) {
                    m = f.item(i.i$b._inner[k]);
                }
                else {
                    m = f.item(k);
                }
            }
            return k;
        }
        a$m(a, b, c, d, e, f, g, h, i) {
            if (b == null) {
                return NaN;
            }
            let j = a.e8;
            let k = a.hk(c, i, d, g, b);
            let l = a.hi(c, i, d, g, b);
            let m = a.f3(c, k, d, e, f);
            let n = a.f3(c, l, d, e, f);
            let o = k;
            let p = l;
            let q = d.cm;
            if (q && !j) {
                let r = d;
                if (k >= 0 && k < r.i$b.count) {
                    k = r.i$b._inner[k];
                }
                if (l >= 0 && k < r.i$b.count) {
                    l = r.i$b._inner[l];
                }
            }
            let s = m / (n + m);
            if (m == 0) {
                s = 0;
            }
            if (n == 0) {
                s = 1;
            }
            if (!h) {
                if (n <= m) {
                    if (l >= 0 && l < b.count) {
                        return b.item(l);
                    }
                }
                else {
                    if (k >= 0 && k < b.count) {
                        return b.item(k);
                    }
                }
                return NaN;
            }
            return a.f9(s, b, k, l, o, p, f, q);
        }
        a$d(a, b, c) {
            let d = a.ai(b);
            let e = a.ah(b);
            if (d == null) {
                return false;
            }
            for (let f = 0; f < d.length; f++) {
                let g = d[f];
                if (g == null || g.length != 2) {
                    continue;
                }
                if (GeometryUtil.a(b, g[0], g[1], a.fu / 2 + a.f8(c))) {
                    return true;
                }
                if (e != null && f < e.length) {
                    let h = e[f];
                    if (h == null || h.length != 2) {
                        continue;
                    }
                    if (GeometryUtil.a(b, h[0], h[1], a.fu / 2 + a.f8(c))) {
                        return true;
                    }
                    if (GeometryUtil.a(b, g[0], h[0], a.fu / 2 + a.f8(c))) {
                        return true;
                    }
                    if (GeometryUtil.a(b, g[1], h[1], a.fu / 2 + a.f8(c))) {
                        return true;
                    }
                    let i = new Array(5);
                    i[0] = h[0];
                    i[1] = h[1];
                    i[2] = g[1];
                    i[3] = g[0];
                    i[4] = h[0];
                    if (PolygonUtil.b(boxArray$1(i), b)) {
                        return true;
                    }
                }
            }
            return false;
        }
        a$e(a, b, c, d) {
            if (d == null) {
                return false;
            }
            for (let e = 0; e < d.c.count; e++) {
                let f = d.c._inner[e];
                for (let g = 0; g < f._segments.count; g++) {
                    let h = f._segments._inner[g];
                    if (GeometryUtil.b(b, f._startPoint, h._points, a.f8(c))) {
                        return true;
                    }
                }
            }
            return false;
        }
        a$f(a, b, c) {
            if (c == null) {
                return false;
            }
            if (c.c.count > 0) {
                let d = c.c._inner[0];
                if (d._segments.count > 0) {
                    let e = d._segments._inner[0];
                    if (PolygonUtil.b(e._points, b)) {
                        return true;
                    }
                }
            }
            return false;
        }
        a$n(a, b, c, d, e, f) {
            let g = a.e8;
            let h = d.cm;
            let i = null;
            if (h) {
                i = d;
            }
            let j = -1;
            let k = -1;
            let l = -1;
            if (h) {
                j = e(b);
                if (isNaN_(j)) {
                    return -1;
                }
                k = truncate(Math.floor(j));
                l = truncate(Math.ceil(j));
            }
            else {
                j = a.f5(b);
                if (isNaN_(j)) {
                    return -1;
                }
                k = truncate(Math.floor(j));
                l = truncate(Math.ceil(j));
            }
            if (f == null) {
                return -1;
            }
            if (l < 0 || l > f.count - 1) {
                return -1;
            }
            if (!c) {
                return l;
            }
            let m = NaN;
            if (h && !g) {
                if (l < i.i$b.count && i.i$b._inner[l] < f.count) {
                    m = f.item(i.i$b._inner[l]);
                }
            }
            else {
                m = f.item(l);
            }
            while (isNaN_(m)) {
                l++;
                if (l < 0 || l > f.count - 1) {
                    return -1;
                }
                if (h && !g) {
                    m = f.item(i.i$b._inner[l]);
                }
                else {
                    m = f.item(l);
                }
            }
            return l;
        }
        a$k(a, b, c) {
            let d = a.b0.bv;
            let e = a.b0.bu;
            if (d.isEmpty || e.isEmpty || c == null) {
                return -1;
            }
            let f = a.getEffectiveViewport1(a.b0);
            let g = null;
            if (c.cm) {
                g = c;
            }
            let h = new ScalerParams(0, d, e, c.cg, f);
            if (a.cd == null) {
                return -1;
            }
            h.c = a.getEffectiveViewport1(a.b0);
            let i = a.pq(a.b0);
            let j = 0;
            if (c.co) {
                let k = c.el(i.top, h);
                let l = c.el(i.bottom, h);
                let m = (b.y - d.top) / d.height;
                j = k + ((l - k) * m);
            }
            else {
                if (c.cb) {
                    let n = c.el(i.left, h);
                    let o = c.el(i.right, h);
                    let p = (b.x - d.left) / d.width;
                    j = n + ((o - n) * p);
                }
                else {
                    let q = a.pg(b);
                    j = c.el(q.x, h);
                }
            }
            if (c.cd) {
            }
            let r = g.i$c(j);
            return r;
        }
        a$g(a, b, c) {
            let d = a.pv(b);
            if (d.isEmpty) {
                return false;
            }
            let e = RectUtil.r(d, a.f8(c));
            return e.containsPoint(b);
        }
        a$al(a, b, c, d, e, f, g, h, i, j) {
            if (f == null || g == null || a.b0 == null || a.b0.bv.isEmpty || a.b0.bu.isEmpty) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            let k = a.getEffectiveViewport1(a.b0);
            let l = new ScalerParams(0, a.b0.bv, a.b0.bu, f.cg, k);
            if (f.co) {
                l.b = a.gc();
            }
            l.c = a.getEffectiveViewport1(a.b0);
            let m = a.b0;
            let n = a.pq(m);
            let o;
            if (g.co) {
                o = b.y;
                o = n.top + n.height * (o - m.bv.top) / m.bv.height;
            }
            else {
                o = b.x;
                o = n.left + n.width * (o - m.bv.left) / m.bv.width;
            }
            if (!c && g != null) {
                let p;
                let q;
                if (i != null) {
                    p = i(b, d);
                }
                else {
                    p = a.hj(b, d);
                }
                if (j != null) {
                    q = j(b, d);
                }
                else {
                    q = a.hh(b, d);
                }
                if (p == -1 && q == -1) {
                    return { $type: Point_$type, x: NaN, y: NaN };
                }
                let r = new ScalerParams(0, m.bv, m.bu, g.cg, k);
                r.c = a.cd.sj;
                let s = a.f3(b, p, g, r, e);
                let t = a.f3(b, q, g, r, e);
                let u = q;
                let v = p;
                if (g.cm) {
                    let w = g;
                    if (u >= 0 && u < w.i$b.count) {
                        u = w.i$d(w.i$b._inner[truncate(u)]);
                    }
                    if (v >= 0 && v < w.i$b.count) {
                        v = w.i$d(w.i$b._inner[truncate(v)]);
                    }
                }
                if ((t + s) != 0) {
                    let x = t / (s + t);
                    if (Math.abs(x - 0.5) < 1E-07) {
                        t = s;
                    }
                }
                if (t <= s) {
                    o = g.ei(u, r) + e;
                }
                else {
                    o = g.ei(v, r) + e;
                }
            }
            else {
                if (g.ca && !g.cd && g.categoryMode != 0) {
                    let y = 0.5 * g.getCategorySize(m.bv, m.bu, a.getEffectiveViewport1(m));
                    if (a.isVertical) {
                        y = y * -1;
                    }
                    if (g.cg) {
                        y = y * -1;
                    }
                    o -= y;
                    o += e;
                }
            }
            let z;
            if (h != null) {
                z = h(b, c, d);
            }
            else {
                z = a.gj(b, c, d);
            }
            let aa = f.ei(z, l);
            if (g.co) {
                return { $type: Point_$type, x: aa, y: o };
            }
            else {
                return { $type: Point_$type, x: o, y: aa };
            }
        }
        a$s() {
            this.a = null;
            this.b = null;
        }
        a$v(a, b, c, d, e, f, g, h, i) {
            if (d) {
                return;
            }
            if (a.cd.eo() && !f) {
                return;
            }
            if (a.bk == 1) {
                return;
            }
            if (a.cd == null) {
                return;
            }
            let j = a.cd.bo;
            let k = j == 2 || j == 3 || j == 4;
            let l = j == 2 || j == 4;
            if (!g) {
                if (k) {
                    e = false;
                }
            }
            if ((a.c2 && a.c5) || g) {
                l = false;
            }
            if (j == 2) {
                h = false;
            }
            if (j == 3) {
                h = true;
            }
            let m = null;
            let n = null;
            let o = a.cd.a3;
            let p = a.cd.cr;
            let q = (f && g) || (f && !k) || i || (l && !h);
            let r = !q && (g || e || (k && !l) || (k && l && h));
            let s = (f && (!k || g)) || i || (!a.c5 && k && l && !h);
            let t = !s && (e || (k && a.c5) || (!a.c5 && k && !l) || (!a.c5 && k && l && h));
            if (q && this.a != null) {
                m = this.a;
            }
            else {
                m = a.aw(b, c, g);
                if (this.a != null && this.a != m) {
                    if (a.cd != null) {
                        o.endHighlight(this.a);
                    }
                }
                this.a = m;
            }
            if (a.hasMarkers) {
                if (s && this.b != null) {
                    n = this.b;
                }
                else {
                    n = a.ax(b, c, g);
                    if (this.b != null && this.b != n) {
                        o.endHighlight(this.b);
                    }
                    this.b = n;
                }
            }
            if (q) {
                o.endHighlight(m);
            }
            else {
                if (r) {
                    if (m != null && m.d) {
                        m.c = g || !k;
                    }
                    o.startHighlight(m);
                }
            }
            if (s) {
                if (n != null) {
                    o.endHighlight(n);
                }
            }
            else {
                if (t) {
                    if (n != null) {
                        o.startHighlight(n);
                    }
                }
            }
            this.q(a);
        }
        q(a) {
            if (a.cd != null) {
                let b = a.cd.cr;
                if (!b.f() && b.r > 0) {
                    b.v();
                }
                if (b.r == 0) {
                    a.cd.ol(1);
                }
            }
        }
        a$i(a, b, c, d, e, f, g) {
            if (a.bk == 3 || a.bk == 2) {
                return c;
            }
            else if (a.bk == 5 || a.bk == 4) {
                let h = 0;
                if (b != null) {
                    h = b.f;
                }
                if (h > 1) {
                    h = 1;
                }
                if (d > 1) {
                    d = 1;
                }
                if (e > 1) {
                    e = 1;
                }
                h = h - Math.max(d, e);
                c = f + (1 + h) * (1 - f);
                return c;
            }
            else {
                return c;
            }
        }
        a$ak(a, b, c) {
            if (a.bk == 3 || a.bk == 2) {
                let d = 0;
                if (b != null) {
                    d = b.f;
                }
                let e = d;
                e = e * 0.5;
                return this.s(c, e);
            }
            else if (a.bk == 5 || a.bk == 4) {
                return c;
            }
            else {
                return c;
            }
        }
        s(a, b) {
            if (a == null) {
                return a;
            }
            if (b == 0) {
                return a;
            }
            return BrushUtil.l(a, b);
        }
        a$y(a, b, c, d, e) {
            let f = a.b0;
            f.am();
            this.a$c = true;
            let g = a.hz(c, b);
            this.a$p = g;
            if (!e && a.cd != null && !a.as.c) {
                this.r(a, b, g, d);
            }
            this.c = false;
            if (a.ep && g == null) {
                this.c = true;
            }
            if (a.cd != null && !this.c) {
                if (a.ep) {
                    this.d = true;
                }
                this.a$v(a, g, a.po(b), e, true, false, false, a == a.cd.bk, false);
                a.cd.mw(a, g, d);
            }
        }
        a$ai(a, b) {
            let c = null;
            let d = null;
            let e;
            let f = ((() => { let g = a.cd.cq.f(b, false, e, false); e = g.p2; return g.ret; })());
            if (f != a) {
                if (this.a$c) {
                    this.a$z(a, b, null, null, false);
                }
                if (a.cd != null) {
                    a.cd.od(b);
                }
                return;
            }
            c = e;
            if (a.cd != null) {
                a.cd.od(b);
            }
            if (!this.a$c) {
                this.a$y(a, b, c, d, false);
            }
            this.a$ab(a, b, c, d, false);
        }
        a$ab(a, b, c, d, e) {
            this.a$c = true;
            let f = a.hz(c, b);
            if (!e) {
                this.r(a, b, f, d);
            }
            if (f != null) {
                this.a$p = f;
            }
            if (a.cd != null && f != null && this.c) {
                this.c = false;
                this.d = true;
                this.a$v(a, f, a.po(b), e, true, false, false, a == a.cd.bk, false);
                a.cd.mw(a, f, d);
            }
            if (a.cd != null && (!a.ep || f != null) && !this.c) {
                this.a$v(a, f, a.po(b), e, true, false, false, a == a.cd.bk, false);
                a.cd.m0(a, f, d);
            }
            if (f == null && !this.c && a.ep) {
                this.a$v(a, f, a.po(b), e, false, true, false, a == a.cd.bk, false);
                a.cd.mx(a, this.a$p, d);
                this.d = false;
                this.c = true;
            }
        }
        a$z(a, b, c, d, e) {
            a.b0.an();
            this.a$c = false;
            let f = this.a$p;
            a.b0.ap();
            if (a.cd != null && (this.d || !a.ep)) {
                this.d = false;
                this.c = false;
                this.a$v(a, f, a.po(b), e, false, true, false, a == a.cd.bk, false);
                a.cd.mx(a, f, d);
            }
        }
        a$w(a, b, c, d) {
            this.i = true;
            if (a.cd != null) {
                a.cd.my(a, a.hz(c, b), d);
            }
        }
        a$aa(a, b, c, d) {
            this.i = false;
            if (a.cd != null) {
                a.cd.mz(a, a.hz(c, b), d);
            }
        }
        a$x(a, b, c, d) {
            if (a.b0.s) {
                return;
            }
            if (this.i) {
                this.a$aa(a, b, c, d);
            }
            if (this.a$c) {
                this.a$z(a, b, c, d, false);
            }
        }
        a$ac(a, b, c, d) {
            if (a.cd != null) {
                a.cd.m1(a, a.hz(c, b), d);
            }
        }
        a$ad(a, b, c, d) {
            if (a.cd != null) {
                a.cd.m2(a, a.hz(c, b), d);
            }
        }
        get g() {
            return this.c;
        }
        set g(a) {
            this.c = a;
        }
        get a$b() {
            return this.d;
        }
        set a$b(a) {
            this.d = a;
        }
        r(a, b, c, d) {
            let e = false;
            if (a.cd != null) {
                e = a.cd.d8;
            }
            if (e) {
                return;
            }
            if (a.cd == null || a.cd.dy) {
                return;
            }
            this.j = true;
            this.t = b;
            this.o = c;
            a.b0.d.item = c;
            a.b0.d.itemLabel = a.hv(c);
            let f = a.cd.r8();
            let pos_ = { $type: Point_$type, x: b.x + 15 + f.x, y: b.y + 15 + f.y };
            let context_ = a.b0.d;
            let g = false;
            if (this._toolTipObject != null) {
                g = (this._toolTipObject._inPointer);
                this._toolTipObject._inPointer = false;
            }
            if (this._toolTipObject != null) {
                if (this.f || g) {
                    this.f = false;
                    this._toolTipObject.remove();
                    this._toolTipObject.setStyleProperty("position", "absolute");
                    this._toolTipObject.addClass(a.cd.j6);
                    a.cd.kw(this._toolTipObject);
                    this._toolTipObject.hide();
                }
                if (this.e) {
                    a.cd.kw(this._toolTipObject);
                    this.e = false;
                }
                context_.hideOthers = true;
                if ((this._toolTipObject.updateToolTip && !this._toolTipObject.updateToolTip(context_))) {
                    this.a$u(a);
                }
                let h = window.pageXOffset;
                let i = window.pageYOffset;
                let j = document.documentElement.clientWidth;
                let k = document.documentElement.clientHeight;
                let l = this._toolTipObject.outerWidthWithMargin();
                let m = this._toolTipObject.outerHeightWithMargin();
                let n = pos_.x;
                let o = pos_.y;
                let p = 5;
                let q = 30;
                if (l + n - h + p > j) {
                    pos_.x -= q;
                    pos_.x -= l;
                }
                if (m + o - i + p > k) {
                    pos_.y -= q;
                    pos_.y -= m;
                }
                this._toolTipObject.setOffset(pos_.x, pos_.y);
            }
        }
        a$ah(a, b, c) {
            this.j = true;
            let d = { $type: Point_$type, x: b.x + a.b0.bu.left, y: b.y + a.b0.bu.top };
            let e = a.hz(null, d);
            if (a.b0.d != null) {
                a.b0.d.series = a;
                a.b0.d.item = e;
            }
            let tooltip_ = this._toolTipObject;
            let context_ = a.b0.d;
            let f = false;
            if (this._toolTipObject != null) {
                f = (this._toolTipObject._inPointer);
                this._toolTipObject._inPointer = false;
            }
            if (context_ != null) {
                context_.hideOthers = false;
            }
            if ((!this.f || f) && tooltip_ != null) {
                this.f = true;
                tooltip_.remove();
                tooltip_.setStyleProperty("position", "relative");
                tooltip_.setStyleProperty("top", "");
                tooltip_.setStyleProperty("left", "");
                tooltip_.removeClass(a.cd.j6);
            }
            if (this._toolTipObject != null) {
                if (tooltip_.updateToolTip) {
                    tooltip_.updateToolTip(context_);
                }
                ;
            }
            if (tooltip_ != null) {
                c(tooltip_);
            }
        }
        a$q(a) {
            let b = "<div class='ui-chart-default-tooltip-content'><span";
            let c = this.a$r(a);
            if (!stringIsNullOrEmpty(c)) {
                b += " style='color:" + c + "'";
            }
            b += ">" + a.title + "</span></div>";
            return b;
        }
        h(a, b) {
            let c = a != null && Color.e(toNullable(Color.$, a.color), toNullable(Color.$, null));
            c = c && a.color.l > 0;
            c = c && Color.d(a.color, b);
            return !c;
        }
        a$r(a) {
            let b = new Color();
            let c = a != null && a.cd != null && a.cd.cq != null && a.cd.cq.j != null ? a.cd.cq.j.ae : null;
            c.startCSSQuery();
            b.colorString = c.getCssDefaultPropertyValue("ui-chart-pointer-tooltip", "background-color");
            c.endCSSQuery();
            if (!this.h(a.o1, b)) {
                return a.o1._fill;
            }
            if (!this.h(a.oy, b)) {
                return a.oy._fill;
            }
            return null;
        }
        a$u(a) {
            if (this._toolTipObject != null && this.j) {
                this.j = false;
                let context_ = a.b0.d;
                if (this._toolTipObject.hideToolTip) {
                    this._toolTipObject.hideToolTip(context_);
                }
                ;
            }
        }
        a$aj(a, b) {
            let c = this._toolTipObject;
            this.p = null;
            this._toolTipObject = null;
            if (typeof b === 'string') {
                this.p = b;
            }
            else {
                this._toolTipObject = b;
                if (this._toolTipObject != null) {
                    this._toolTipObject.setStyleProperty("position", "absolute");
                    this._toolTipObject.setStyleProperty("top", "0px");
                    this._toolTipObject.setStyleProperty("left", "0px");
                    this._toolTipObject.setStyleProperty("z-index", "10000");
                    this._toolTipObject.setStyleProperty("pointer-events", "none");
                    let d = a.o1 != null && Color.e(toNullable(Color.$, a.o1.color), toNullable(Color.$, null)) && a.o1.color.l > 0;
                    if (d) {
                        this._toolTipObject.setStyleProperty("border-color", a.o1._fill);
                    }
                }
                else {
                    if (!this.e && c != null) {
                        a.cd.n4(c);
                        this.e = true;
                    }
                }
            }
        }
        a$ag(a) {
        }
        get a$h() {
            return this.k;
        }
        a$t(a, b, c, d, e) {
            let f;
            if (!((() => { let g = this.k.tryGetValue(d, f); f = g.p1; return g.ret; })())) {
                f = a.by();
                f.q = true;
                f.p = true;
                if (a.cd != null) {
                    f.a = a.cd.ak;
                    a.cd.ak.l(f);
                }
                f.as();
                f.ad = d;
                this.k.item(d, f);
            }
            f.v = e;
            f.bu = b;
            f.bt = c;
        }
        a$af(a, b, c) {
            let d;
            let e = c;
            if (e == null) {
                e = a.cd;
            }
            if (((() => { let f = this.k.tryGetValue(b, d); d = f.p1; return f.ret; })())) {
                if (e != null) {
                    d.a = null;
                    e.ak.r(d);
                }
                this.k.removeItem(b);
            }
        }
        a$ae(a, b) {
            let c = new List$1(String_$type, 0);
            for (let d of fromEnum(this.k.keys)) {
                c.add(d);
            }
            for (let e = 0; e < c.count; e++) {
                this.a$af(a, c._inner[e], b);
            }
        }
    }
    SeriesInteractionManager.$t = markType(SeriesInteractionManager, 'SeriesInteractionManager', Base.$, [ISeriesInteractionManager_$type]);
    return SeriesInteractionManager;
})();
