igniteui-angular-charts
Version:
Ignite UI Angular charting components for building rich data visualizations for modern web apps.
1,568 lines (1,567 loc) • 46.9 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __extends, __values } from "tslib";
import { Base, Point_$type, Array_$type, toNullable, String_$type, fromEnum, markType } from "igniteui-angular-core";
import { ISeriesInteractionManager_$type } from "./ISeriesInteractionManager";
import { HighlightingInfo } from "igniteui-angular-core";
import { Dictionary$2 } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { SeriesView } from "./SeriesView";
import { ScalerParams } from "./ScalerParams";
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
*/
var SeriesInteractionManager = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(SeriesInteractionManager, _super);
function SeriesInteractionManager() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.a = null;
_this.b = null;
_this.o = new Dictionary$2(Base.$, List$1.$.specialize(HighlightingInfo.$), 0);
_this.n = new Dictionary$2(Base.$, List$1.$.specialize(HighlightingInfo.$), 0);
_this.c = false;
_this.p = null;
_this.a$s = null;
_this.a$e = false;
_this.k = false;
_this.d = false;
_this.e = false;
_this.f = true;
_this.g = false;
_this._toolTipObject = null;
_this.v = null;
_this.ac = null;
_this.u = null;
_this.l = false;
_this.m = new Dictionary$2(String_$type, SeriesView.$, 0);
return _this;
}
SeriesInteractionManager.prototype.a$m = function (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;
}
var i;
var j = NaN;
var k = NaN;
var l = NaN;
var m = NaN;
if (d.cn) {
var n = d;
i = h(b);
var o = truncate(Math.floor(i));
var p = truncate(Math.ceil(i));
m = i - o;
if (o >= 0 && o < g) {
var q = n.i$d(n.i$b._inner[o]);
j = d.el(q, e) + f;
}
else {
j = NaN;
}
if (p >= 0 && p < g) {
var r = n.i$d(n.i$b._inner[p]);
k = d.el(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) {
var s = n.i$d(n.i$b._inner[c]);
l = d.el(s, e) + f;
}
}
else {
i = a.iq(b);
var t = truncate(Math.floor(i));
var u = truncate(Math.ceil(i));
m = i - t;
if (t >= 0 && t < g) {
j = d.el(t, e) + f;
}
else {
j = NaN;
}
if (u > g - 1 && a.fs) {
u = 0;
}
if (u >= 0 && u < g) {
k = d.el(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.el(c, e) + f;
}
}
var v = j + m * (k - j);
return Math.abs(l - v);
};
SeriesInteractionManager.prototype.a$o = function (a, b, c, d, e, f, g, h, i) {
var j = NaN;
if (d >= 0 && d < c.count) {
j = c.item(d);
}
var 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;
};
SeriesInteractionManager.prototype.a$b = function (a, b, c, d, e, f, g) {
if (b == null) {
return null;
}
var h = -1;
var i = -1;
var j = this.a$a(a, b, c, d, e, f, g);
if (b.b9) {
c = this.q(c);
}
if (j == null) {
return null;
}
h = j[0];
i = j[1];
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;
}
var k = c._inner[h];
var l = c._inner[i];
var m = new Array(2);
m[0] = k;
m[1] = l;
return m;
};
SeriesInteractionManager.prototype.a$a = function (a, b, c, d, e, f, g) {
if (b == null) {
return null;
}
var h = -1;
var i = -1;
if (b.cn || b.cl) {
var j = a.v6(f);
var k = -1;
var l = b.ch;
var m = a.cv.bx.right * 2;
if (b.b9) {
var n = b.d5(f);
j = { $type: Point_$type, x: n, y: 0 };
c = this.q(c);
}
k = SeriesInteractionManager.t(c, j, l, m);
if (k < 0) {
k = ~k;
k--;
}
if (k < 0) {
k = 0;
}
if (k > c.count - 1) {
k = c.count - 1;
}
var o = k;
var p = k + 1;
if (p > c.count - 1) {
p = c.count - 1;
}
h = o;
i = p;
}
else {
var q = a.j9(f, g);
var r = a.j7(f, g);
var s = truncate(Math.floor(q / d));
var t = truncate(Math.floor(r / d));
h = s - e;
i = t - e;
if (i == h) {
i++;
}
}
return [h, i];
};
SeriesInteractionManager.prototype.q = function (a) {
var b = NaN;
var c = -1;
for (var d = 0; d < a.count; d++) {
var e = a._inner[d];
if (isNaN_(b)) {
b = e[0];
}
else {
var f = e[0];
if (f < b) {
c = d;
break;
}
}
}
if (c == -1) {
return a;
}
var g = new List$1(Array_$type, 0);
for (var h = c; h < a.count; h++) {
g.add(a._inner[h]);
}
for (var i = 0; i < c; i++) {
g.add(a._inner[i]);
}
return g;
};
SeriesInteractionManager.t = function (a, b, c, d) {
var e = 0;
var f = a.count - 1;
while (e <= f) {
var g = (e + ((f - e) >> 1));
var h = void 0;
var 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;
};
SeriesInteractionManager.prototype.a$r = function (a, b, c, d, e, f) {
if (d == null) {
return -1;
}
var g = d.cn;
var h = a.hc;
var i = null;
if (g) {
i = d;
}
var j = -1;
var k = -1;
var 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.iq(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;
}
var 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;
};
SeriesInteractionManager.prototype.a$p = function (a, b, c, d, e, f, g, h, i) {
if (b == null) {
return NaN;
}
var j = a.hc;
var k = a.ka(c, i, d, g, b);
var l = a.j8(c, i, d, g, b);
var m = a.io(c, k, d, e, f);
var n = a.io(c, l, d, e, f);
var o = k;
var p = l;
var q = d.cn;
if (q && !j) {
var 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];
}
}
var 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.iu(s, b, k, l, o, p, f, q);
};
SeriesInteractionManager.prototype.a$f = function (a, b, c) {
var d = a.al(b);
var e = a.aj(b);
if (d == null) {
return false;
}
for (var f = 0; f < d.length; f++) {
var g = d[f];
if (g == null || g.length != 2) {
continue;
}
if (GeometryUtil.d(b, g[0], g[1], a.id / 2 + a.it(c))) {
return true;
}
if (e != null && f < e.length) {
var h = e[f];
if (h == null || h.length != 2) {
continue;
}
if (GeometryUtil.d(b, h[0], h[1], a.id / 2 + a.it(c))) {
return true;
}
if (GeometryUtil.d(b, g[0], h[0], a.id / 2 + a.it(c))) {
return true;
}
if (GeometryUtil.d(b, g[1], h[1], a.id / 2 + a.it(c))) {
return true;
}
var 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;
};
SeriesInteractionManager.prototype.a$g = function (a, b, c, d) {
if (d == null) {
return false;
}
for (var e = 0; e < d.c.count; e++) {
var f = d.c._inner[e];
for (var g = 0; g < f._segments.count; g++) {
var h = f._segments._inner[g];
if (GeometryUtil.e(b, f._startPoint, h._points, a.it(c))) {
return true;
}
}
}
return false;
};
SeriesInteractionManager.prototype.a$h = function (a, b, c) {
if (c == null) {
return false;
}
if (c.c.count > 0) {
var d = c.c._inner[0];
if (d._segments.count > 0) {
var e = d._segments._inner[0];
if (PolygonUtil.b(e._points, b)) {
return true;
}
}
}
return false;
};
SeriesInteractionManager.prototype.a$q = function (a, b, c, d, e, f) {
var g = a.hc;
var h = d.cn;
var i = null;
if (h) {
i = d;
}
var j = -1;
var k = -1;
var 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.iq(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) {
if (a.fs) {
if (l > f.count - 1) {
return 0;
}
}
return -1;
}
if (!c) {
return l;
}
var 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;
};
SeriesInteractionManager.prototype.a$n = function (a, b, c) {
var d = a.cv.by;
var e = a.cv.bx;
if (d.isEmpty || e.isEmpty || c == null) {
return -1;
}
var f = a.getEffectiveViewport1(a.cv);
var g = null;
if (c.cn) {
g = c;
}
var h = new ScalerParams(0, d, e, c.ch, f);
if (a.db == null) {
return -1;
}
h.c = a.getEffectiveViewport1(a.cv);
var i = a.wi(a.cv);
var j = 0;
if (c.cp) {
var k = c.eo(i.top, h);
var l = c.eo(i.bottom, h);
var m = (b.y - d.top) / d.height;
j = k + ((l - k) * m);
}
else {
if (c.cc) {
var n = c.eo(i.left, h);
var o = c.eo(i.right, h);
var p = (b.x - d.left) / d.width;
j = n + ((o - n) * p);
}
else {
var q = a.v6(b);
j = c.eo(q.x, h);
}
}
if (c.ce) {
}
var r = g.i$c(j);
return r;
};
SeriesInteractionManager.prototype.a$i = function (a, b, c) {
var d = a.wn(b);
if (d.isEmpty) {
return false;
}
var e = RectUtil.r(d, a.it(c));
return e.containsPoint(b);
};
SeriesInteractionManager.prototype.a$au = function (a, b, c, d, e, f, g, h, i, j) {
if (f == null || g == null || a.cv == null || a.cv.by.isEmpty || a.cv.bx.isEmpty) {
return { $type: Point_$type, x: NaN, y: NaN };
}
var k = a.getEffectiveViewport1(a.cv);
var l = new ScalerParams(0, a.cv.by, a.cv.bx, f.ch, k);
if (f.cp) {
l.b = a.ix();
}
l.c = a.getEffectiveViewport1(a.cv);
var m = a.cv;
var n = a.wi(m);
var o;
if (g.cp) {
o = b.y;
o = n.top + n.height * (o - m.by.top) / m.by.height;
}
else {
o = b.x;
o = n.left + n.width * (o - m.by.left) / m.by.width;
}
if (!c && g != null) {
var p = void 0;
var q = void 0;
if (i != null) {
p = i(b, d);
}
else {
p = a.j9(b, d);
}
if (j != null) {
q = j(b, d);
}
else {
q = a.j7(b, d);
}
if (p == -1 && q == -1) {
return { $type: Point_$type, x: NaN, y: NaN };
}
var r = new ScalerParams(0, m.by, m.bx, g.ch, k);
r.c = a.db.v8;
var s = a.io(b, p, g, r, e);
var t = a.io(b, q, g, r, e);
var u = q;
var v = p;
if (g.cn) {
var 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) {
var x = t / (s + t);
if (Math.abs(x - 0.5) < 1E-07) {
t = s;
}
}
if (t <= s) {
o = g.el(u, r) + e;
}
else {
o = g.el(v, r) + e;
}
}
else {
if (g.cb && !g.ce && g.categoryMode != 0) {
var y = 0.5 * g.getCategorySize(m.by, m.bx, a.getEffectiveViewport1(m));
if (a.isVertical) {
y = y * -1;
}
if (g.ch) {
y = y * -1;
}
o -= y;
o += e;
}
}
var z;
if (h != null) {
z = h(b, c, d);
}
else {
z = a.i4(b, c, d);
}
var aa = f.el(z, l);
if (g.cp) {
return { $type: Point_$type, x: aa, y: o };
}
else {
return { $type: Point_$type, x: o, y: aa };
}
};
SeriesInteractionManager.prototype.a$y = function () {
this.a = null;
this.b = null;
};
Object.defineProperty(SeriesInteractionManager.prototype, "a$d", {
get: function () {
return this.o.count > 0;
},
enumerable: false,
configurable: true
});
SeriesInteractionManager.prototype.a$x = function (a, b, c) {
if (!this.o.containsKey(b)) {
var d = new List$1(HighlightingInfo.$, 0);
var e = new HighlightingInfo();
e.d = true;
e.i = a;
e.g = c;
e.f = c;
e.b = false;
d.add(e);
e = new HighlightingInfo();
e.d = false;
e.i = a;
e.g = c;
e.f = c;
e.b = false;
d.add(e);
this.o.item(b, d);
a.db.dm.startHighlight(d._inner[0]);
a.db.dm.startHighlight(d._inner[1]);
if (a.gd) {
a.pt();
}
this.y(a);
}
};
SeriesInteractionManager.prototype.a$v = function (a) {
if (!this.c) {
this.c = true;
var b = new List$1(HighlightingInfo.$, 0);
var c = new HighlightingInfo();
c.d = true;
c.i = a;
c.c = true;
c.g = 0;
c.f = a.dn.count - 1;
c.b = false;
b.add(c);
c = new HighlightingInfo();
c.d = false;
c.i = a;
c.c = true;
c.g = 0;
c.f = a.dn.count - 1;
c.b = false;
b.add(c);
this.p = b;
a.db.dm.startHighlight(b._inner[0]);
a.db.dm.startHighlight(b._inner[1]);
if (a.gd) {
a.pt();
}
this.y(a);
}
};
SeriesInteractionManager.prototype.a$ao = function (a) {
if (this.c) {
this.c = false;
var b = this.p;
this.p = null;
a.db.dm.endHighlight(b._inner[0]);
a.db.dm.endHighlight(b._inner[1]);
if (a.gd) {
a.pt();
}
this.y(a);
}
};
SeriesInteractionManager.prototype.a$an = function (a, b, c) {
if (this.o.containsKey(b)) {
var d = this.o.item(b);
this.o.removeItem(b);
a.db.dm.endHighlight(d._inner[0]);
a.db.dm.endHighlight(d._inner[1]);
if (a.gd) {
a.pt();
}
this.y(a);
}
};
SeriesInteractionManager.prototype.a$w = function (a, b, c) {
if (!this.n.containsKey(b)) {
var d = new List$1(HighlightingInfo.$, 0);
var e = new HighlightingInfo();
e.d = true;
e.i = a;
e.g = c;
e.f = c;
e.b = false;
d.add(e);
e = new HighlightingInfo();
e.d = false;
e.i = a;
e.g = c;
e.f = c;
e.b = false;
d.add(e);
this.n.item(b, d);
a.db.dk.startHighlight(d._inner[0]);
a.db.dk.startHighlight(d._inner[1]);
if (a.gd) {
a.pt();
}
this.x(a);
}
};
SeriesInteractionManager.prototype.a$am = function (a, b, c) {
if (this.n.containsKey(b)) {
var d = this.n.item(b);
this.n.removeItem(b);
a.db.dk.endHighlight(d._inner[0]);
a.db.dk.endHighlight(d._inner[1]);
if (a.gd) {
a.pt();
}
this.x(a);
}
};
SeriesInteractionManager.prototype.a$ab = function (a, b, c, d, e, f, g, h, i) {
if (d) {
return;
}
if (a.db.fn() && !f) {
return;
}
if (a.bx == 1) {
return;
}
if (a.db == null) {
return;
}
var j = a.db.bv;
var k = j == 2 || j == 3 || j == 4;
var l = j == 2 || j == 4;
if (!g) {
if (k) {
e = false;
}
}
if ((a.ed && a.ej) || g) {
l = false;
}
if (j == 2) {
h = false;
}
if (j == 3) {
h = true;
}
var m = null;
var n = null;
var o = a.db.dl;
var p = a.db.dc;
var q = (f && g) || (f && !k) || i || (l && !h);
var r = !q && (g || e || (k && !l) || (k && l && h));
var s = (f && (!k || g)) || i || (!a.ej && k && l && !h);
var t = !s && (e || (k && a.ej) || (!a.ej && k && !l) || (!a.ej && k && l && h));
if (q && this.a != null) {
m = this.a;
}
else {
m = a.dg(b, c, g);
if (this.a != null && this.a != m) {
if (a.db != null) {
o.endHighlight(this.a);
}
}
this.a = m;
}
if (a.hasMarkers) {
if (s && this.b != null) {
n = this.b;
}
else {
n = a.dh(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.c) {
m.b = g || !k;
}
o.startHighlight(m);
}
}
if (s) {
if (n != null) {
o.endHighlight(n);
}
}
else {
if (t) {
if (n != null) {
o.startHighlight(n);
}
}
}
this.w(a);
};
SeriesInteractionManager.prototype.w = function (a) {
if (a.db != null) {
var b = a.db.dc;
if (!b.f() && b.r > 0) {
b.v();
}
if (b.r == 0) {
var c = a.db.ge(1);
while (c) {
c = a.db.ge(0);
c = a.db.ge(1);
}
}
}
};
SeriesInteractionManager.prototype.y = function (a) {
if (a.db != null) {
var b = a.db.de;
if (!b.f() && b.r > 0) {
b.v();
}
if (b.r == 0) {
var c = a.db.gf(1);
while (c) {
c = a.db.gf(0);
c = a.db.gf(1);
}
}
}
};
SeriesInteractionManager.prototype.x = function (a) {
if (a.db != null) {
var b = a.db.db;
if (!b.f() && b.r > 0) {
b.v();
}
if (b.r == 0) {
var c = a.db.gd(1);
while (c) {
c = a.db.gd(0);
c = a.db.gd(1);
}
}
}
};
SeriesInteractionManager.prototype.a$k = function (a, b, c, d, e, f, g, h, i, j, k, l, m) {
if (a.bx != 5 && a.bx != 4 && a.cp != 3 && a.co != 3) {
return e;
}
else if (a.bx == 5 || a.bx == 4 || a.cp == 3 || a.co == 3) {
var n = 0;
var o = 0;
var p = 0;
if (b != null) {
n = b.e;
}
if (c != null) {
o = c.e;
}
if (d != null) {
p = d.e;
}
if (n > 1) {
n = 1;
}
if (o > 1) {
o = 1;
}
if (p > 1) {
p = 1;
}
if (f > 1) {
f = 1;
}
if (g > 1) {
g = 1;
}
if (h > 1) {
h = 1;
}
if (i > 1) {
i = 1;
}
if (j > 1) {
j = 1;
}
if (k > 1) {
k = 1;
}
var q = Math.max(f, g);
var r = Math.max(h, i);
var s = Math.max(j, k);
if (a.bx != 4 && a.bx != 5) {
q = 0;
n = 0;
}
if (a.cp != 3) {
r = 0;
o = 0;
}
if (a.co != 3) {
s = 0;
p = 0;
}
var t = Math.max(q, Math.max(r, s));
n = n - t;
o = o - t;
p = p - t;
var u = Math.max(n, Math.max(o, p));
e = l + (1 + u) * (1 - l);
return e;
}
else {
return e;
}
};
SeriesInteractionManager.prototype.a$at = function (a, b, c, d, e, f, g, h, i, j, k, l) {
if (l && (a.cp == 7 || a.co == 7 || a.cp == 8 || a.co == 8 || a.cp == 5 || a.co == 5 || a.cp == 6 || a.co == 6)) {
var m = 0;
var n = 0;
var o = 0;
if (c != null) {
n = c.e;
}
if (d != null) {
o = d.e;
}
if (a.cp != 7 && a.cp != 8 && a.cp != 5 && a.cp != 6) {
n = 0;
}
if (a.co != 7 && a.co != 8 && a.co != 5 && a.co != 6) {
o = 0;
}
var p = a.vi;
if (this.j(a.cp, l)) {
p = a.vg;
}
if (this.j(a.co, l)) {
p = a.vg;
}
var q = Math.max(m, Math.max(o, n));
k = this.ab(a, k, p, q);
}
if (!l && (a.cp == 10 || a.co == 9 || a.cp == 9 || a.co == 10)) {
var r = 0;
var s = 0;
var t = 0;
if (c != null) {
s = c.e;
}
if (d != null) {
t = d.e;
}
if (a.cp != 10 && a.cp != 9) {
s = 0;
}
if (a.co != 10 && a.co != 9) {
t = 0;
}
var u = a.vi;
if (this.j(a.cp, l)) {
u = a.vg;
}
if (this.j(a.co, l)) {
u = a.vg;
}
var v = Math.max(r, Math.max(t, s));
k = this.ab(a, k, u, v);
}
if ((a.cp == 4 || a.co == 4)) {
var w = 0;
var x = 0;
var y = 0;
if (b != null) {
w = b.e;
}
if (c != null) {
x = c.e;
}
if (d != null) {
y = d.e;
}
if (w > 1) {
w = 1;
}
if (x > 1) {
x = 1;
}
if (y > 1) {
y = 1;
}
if (e > 1) {
e = 1;
}
if (f > 1) {
f = 1;
}
if (g > 1) {
g = 1;
}
if (h > 1) {
h = 1;
}
if (i > 1) {
i = 1;
}
if (j > 1) {
j = 1;
}
var z = Math.max(e, f);
var aa = Math.max(g, h);
var ab = Math.max(i, j);
{
z = 0;
w = 0;
}
if (a.cp != 4) {
aa = 0;
x = 0;
}
if (a.co != 4) {
ab = 0;
y = 0;
}
var ac = Math.max(z, Math.max(aa, ab));
w = w - ac;
x = x - ac;
y = y - ac;
var ad = Math.max(w, Math.max(x, y));
ad = Math.abs(ad);
var ae = BrushUtil.t(k);
k = this.ab(a, k, ae, ad);
}
if (a.bx == 3 || a.bx == 2 || a.cp == 2 || a.co == 2) {
var af = 0;
var ag = 0;
var ah = 0;
if (b != null) {
af = b.e;
}
if (c != null) {
ag = c.e;
}
if (d != null) {
ah = d.e;
}
if (a.bx != 3 && a.bx != 2) {
af = 0;
}
if (a.cp != 2) {
ag = 0;
}
if (a.co != 2) {
ah = 0;
}
var ai = Math.max(af, Math.max(ah, ag));
ai = ai * 0.5;
k = this.aa(k, ai);
}
return k;
};
SeriesInteractionManager.prototype.j = function (a, b) {
if (b) {
return a == 6 || a == 5;
}
return a == 9;
};
SeriesInteractionManager.prototype.a$l = function (a, b, c, d, e) {
if (a.cp == 7 || a.co == 7 || a.cp == 5 || a.co == 5 || a.co == 11 || a.cp == 11) {
var f = 0;
var g = 0;
var h = 0;
if (c != null) {
g = c.e;
}
if (d != null) {
h = d.e;
}
if (a.cp != 7 && a.cp != 5 && a.cp != 11) {
g = 0;
}
if (a.co != 7 && a.co != 5 && a.co != 11) {
h = 0;
}
var i = Math.max(f, Math.max(h, g));
var j = e * 4;
if (j == 0) {
j = 4;
}
e = e + i * (j - e);
}
return e;
};
SeriesInteractionManager.prototype.aa = function (a, b) {
if (a == null) {
return a;
}
if (b == 0) {
return a;
}
return BrushUtil.m(a, b);
};
SeriesInteractionManager.prototype.ab = function (a, b, c, d) {
if (a != null && a.actualLayers != null && a.actualLayers.count > 0) {
c = a.vz(c);
}
var e = BrushUtil.l(b, d, c, 0);
return e;
};
SeriesInteractionManager.prototype.a$ae = function (a, b, c, d, e) {
var f = a.cv;
f.ao();
this.a$e = true;
var g = a.kw(c, b);
this.a$s = g;
if (!e && a.db != null && !a.a1.c) {
this.z(a, b, g, d);
}
this.d = false;
if (a.gg && g == null) {
this.d = true;
}
if (a.db != null && !this.d) {
if (a.gg) {
this.e = true;
}
this.a$ab(a, g, a.wg(b), e, true, false, false, a == a.db.bq, false);
a.db.pv(a, g, d, b);
}
};
SeriesInteractionManager.prototype.a$ar = function (a, b) {
var c = null;
var d = null;
var e;
var f = ((function () { var g = a.db.c9.f(b, false, e, false); e = g.p2; return g.ret; })());
if (f != a) {
if (this.a$e) {
this.a$af(a, b, null, null, false);
}
if (a.db != null) {
a.db.rh(b);
}
return;
}
c = e;
if (a.db != null) {
a.db.rh(b);
}
if (!this.a$e) {
this.a$ae(a, b, c, d, false);
}
this.a$ah(a, b, c, d, false);
};
SeriesInteractionManager.prototype.a$ah = function (a, b, c, d, e) {
this.a$e = true;
var f = a.kw(c, b);
if (!e) {
this.z(a, b, f, d);
}
if (f != null) {
this.a$s = f;
}
if (a.db != null && f != null && this.d) {
this.d = false;
this.e = true;
this.a$ab(a, f, a.wg(b), e, true, false, false, a == a.db.bq, false);
a.db.pv(a, f, d, b);
}
if (a.db != null && (!a.gg || f != null) && !this.d) {
this.a$ab(a, f, a.wg(b), e, true, false, false, a == a.db.bq, false);
a.db.pz(a, f, d, b);
}
if (f == null && !this.d && a.gg) {
this.a$ab(a, f, a.wg(b), e, false, true, false, a == a.db.bq, false);
a.db.pw(a, this.a$s, d, b);
this.e = false;
this.d = true;
}
};
SeriesInteractionManager.prototype.a$af = function (a, b, c, d, e) {
a.cv.ap();
this.a$e = false;
var f = this.a$s;
a.cv.ar();
if (a.db != null && (this.e || !a.gg)) {
this.e = false;
this.d = false;
this.a$ab(a, f, a.wg(b), e, false, true, false, a == a.db.bq, false);
a.db.pw(a, f, d, b);
}
};
SeriesInteractionManager.prototype.a$ac = function (a, b, c, d) {
this.k = true;
if (a.db != null) {
a.db.px(a, a.kw(c, b), d, b);
}
};
SeriesInteractionManager.prototype.a$ag = function (a, b, c, d) {
this.k = false;
if (a.db != null) {
a.db.py(a, a.kw(c, b), d, b);
}
};
SeriesInteractionManager.prototype.a$ad = function (a, b, c, d) {
if (a.cv.s) {
return;
}
if (this.k) {
this.a$ag(a, b, c, d);
}
if (this.a$e) {
this.a$af(a, b, c, d, false);
}
};
SeriesInteractionManager.prototype.a$ai = function (a, b, c, d) {
if (a.db != null) {
a.db.p0(a, a.kw(c, b), d, b);
}
};
SeriesInteractionManager.prototype.a$aj = function (a, b, c, d) {
if (a.db != null) {
a.db.p1(a, a.kw(c, b), d, b);
}
};
Object.defineProperty(SeriesInteractionManager.prototype, "h", {
get: function () {
return this.d;
},
set: function (a) {
this.d = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(SeriesInteractionManager.prototype, "a$c", {
get: function () {
return this.e;
},
set: function (a) {
this.e = a;
},
enumerable: false,
configurable: true
});
SeriesInteractionManager.prototype.z = function (a, b, c, d) {
var e = false;
if (a.db != null) {
e = a.db.e5;
}
if (e) {
return;
}
if (a.db == null || a.db.eu) {
return;
}
this.l = true;
this.ac = b;
this.u = c;
a.cv.d.item = c;
a.cv.d.itemLabel = a.ko(c);
var f = a.db.vx();
var pos_ = { $type: Point_$type, x: b.x + 15 + f.x, y: b.y + 15 + f.y };
var context_ = a.cv.d;
var g = false;
if (this._toolTipObject != null) {
g = (this._toolTipObject._inPointer);
this._toolTipObject._inPointer = false;
}
if (this._toolTipObject != null) {
if (this.g || g) {
this.g = false;
this._toolTipObject.remove();
this._toolTipObject.setStyleProperty("position", "absolute");
this._toolTipObject.addClass(a.db.md);
a.db.m7(this._toolTipObject);
this._toolTipObject.hide();
}
if (this.f) {
a.db.m7(this._toolTipObject);
this.f = false;
}
context_.hideOthers = true;
if ((this._toolTipObject.updateToolTip && !this._toolTipObject.updateToolTip(context_))) {
this.a$aa(a);
}
var h = window.pageXOffset;
var i = window.pageYOffset;
var j = document.documentElement.clientWidth;
var k = document.documentElement.clientHeight;
var l = this._toolTipObject.outerWidthWithMargin();
var m = this._toolTipObject.outerHeightWithMargin();
var n = pos_.x;
var o = pos_.y;
var p = 5;
var 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);
}
};
SeriesInteractionManager.prototype.a$aq = function (a, b, c) {
this.l = true;
var d = { $type: Point_$type, x: b.x + a.cv.bx.left, y: b.y + a.cv.bx.top };
var e = a.kw(null, d);
if (a.cv.d != null) {
a.cv.d.series = a;
a.cv.d.item = e;
}
var tooltip_ = this._toolTipObject;
var context_ = a.cv.d;
var f = false;
if (this._toolTipObject != null) {
f = (this._toolTipObject._inPointer);
this._toolTipObject._inPointer = false;
}
if (context_ != null) {
context_.hideOthers = false;
}
if ((!this.g || f) && tooltip_ != null) {
this.g = true;
tooltip_.remove();
tooltip_.setStyleProperty("position", "relative");
tooltip_.setStyleProperty("top", "");
tooltip_.setStyleProperty("left", "");
tooltip_.removeClass(a.db.md);
}
if (this._toolTipObject != null) {
if (tooltip_.updateToolTip) {
tooltip_.updateToolTip(context_);
}
;
}
if (tooltip_ != null) {
c(tooltip_);
}
};
SeriesInteractionManager.prototype.a$t = function (a) {
var b = "<div class='ui-chart-default-tooltip-content'><span";
var c = this.a$u(a);
if (!stringIsNullOrEmpty(c)) {
b += " style='color:" + c + "'";
}
b += ">" + a.title + "</span></div>";
return b;
};
SeriesInteractionManager.prototype.i = function (a, b) {
var 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;
};
SeriesInteractionManager.prototype.a$u = function (a) {
var b = new Color();
var c = a != null && a.db != null && a.db.c9 != null && a.db.c9.j != null ? a.db.c9.j.ae : null;
c.startCSSQuery();
b.colorString = c.getCssDefaultPropertyValue("ui-chart-pointer-tooltip", "background-color");
c.endCSSQuery();
if (!this.i(a.vc, b)) {
return a.vc._fill;
}
if (!this.i(a.u8, b)) {
return a.u8._fill;
}
return null;
};
SeriesInteractionManager.prototype.a$aa = function (a) {
if (this._toolTipObject != null && this.l) {
this.l = false;
var context_ = a.cv.d;
if (this._toolTipObject.hideToolTip) {
this._toolTipObject.hideToolTip(context_);
}
;
}
};
SeriesInteractionManager.prototype.a$as = function (a, b) {
var c = this._toolTipObject;
this.v = null;
this._toolTipObject = null;
if (typeof b === 'string') {
this.v = 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");
var d = a.vc != null && Color.e(toNullable(Color.$, a.vc.color), toNullable(Color.$, null)) && a.vc.color.l > 0;
if (d) {
this._toolTipObject.setStyleProperty("border-color", a.vc._fill);
}
}
else {
if (!this.f && c != null) {
a.db.q6(c);
this.f = true;
}
}
}
};
SeriesInteractionManager.prototype.a$ap = function (a) {
};
Object.defineProperty(SeriesInteractionManager.prototype, "a$j", {
get: function () {
return this.m;
},
enumerable: false,
configurable: true
});
SeriesInteractionManager.prototype.a$z = function (a, b, c, d, e) {
var _this = this;
var f;
if (!((function () { var g = _this.m.tryGetValue(d, f); f = g.p1; return g.ret; })())) {
f = a.ct();
f.q = true;
f.p = true;
if (a.db != null) {
f.a = a.db.ak;
a.db.ak.o(f);
}
f.au();
f.ad = d;
this.m.item(d, f);
}
f.v = e;
f.bx = b;
f.bw = c;
};
SeriesInteractionManager.prototype.a$al = function (a, b, c) {
var _this = this;
var d;
var e = c;
if (e == null) {
e = a.db;
}
if (((function () { var f = _this.m.tryGetValue(b, d); d = f.p1; return f.ret; })())) {
if (e != null) {
d.a = null;
e.ak.u(d);
}
this.m.removeItem(b);
}
};
SeriesInteractionManager.prototype.a$ak = function (a, b) {
var e_1, _a;
var c = new List$1(String_$type, 0);
try {
for (var _b = __values(fromEnum(this.m.keys)), _c = _b.next(); !_c.done; _c = _b.next()) {
var d = _c.value;
c.add(d);
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_1)
throw e_1.error;
}
}
for (var e = 0; e < c.count; e++) {
this.a$al(a, c._inner[e], b);
}
};
SeriesInteractionManager.$t = markType(SeriesInteractionManager, 'SeriesInteractionManager', Base.$, [ISeriesInteractionManager_$type]);
return SeriesInteractionManager;
}(Base));
export { SeriesInteractionManager };