/*
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 * as tslib_1 from "tslib";
import { MarkerSeries } from "./MarkerSeries";
import { ISupportsErrorBars_$type } from "./ISupportsErrorBars";
import { ITrendLineSeries_$type } from "./ITrendLineSeries";
import { ScatterAxisInfoCache } from "./ScatterAxisInfoCache";
import { NumericXAxis } from "./NumericXAxis";
import { DependencyProperty } from "igniteui-react-core";
import { NumericYAxis } from "./NumericYAxis";
import { Series } from "./Series";
import { TrendLineType_$type } from "igniteui-react-core";
import { Brush } from "igniteui-react-core";
import { PenLineCap_$type } from "igniteui-react-core";
import { DoubleCollection } from "igniteui-react-core";
import { CollisionAvoidanceType_$type } from "./CollisionAvoidanceType";
import { ScatterErrorBarSettings } from "./ScatterErrorBarSettings";
import { ScatterFrame } from "./ScatterFrame";
import { Base, enumGetBox, Number_$type, typeCast, fromEnum, Point_$type, markType, markDep, PointUtil, runOn } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { ScalerParams } from "./ScalerParams";
import { Rect } from "igniteui-react-core";
import { Marker } from "./Marker";
import { MarkerSeriesView } from "./MarkerSeriesView";
import { IFastItemsSource_$type } from "igniteui-react-core";
import { Clipper } from "igniteui-react-core";
import { OwnedPoint } from "./OwnedPoint";
import { Dictionary$2 } from "igniteui-react-core";
import { AxisRange } from "./AxisRange";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { ScatterTrendLineManager } from "./ScatterTrendLineManager";
import { ErrorBarsHelper } from "./ErrorBarsHelper";
import { PathGeometry } from "igniteui-react-core";
import { HashPool$2 } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_, isInfinity } from "igniteui-react-core";
import { Path } from "igniteui-react-core";
import { DataTemplateMeasureInfo } from "igniteui-react-core";
import { Size } from "igniteui-react-core";
import { NumericMarkerManager } from "./NumericMarkerManager";
import { stringIsNullOrEmpty } from "igniteui-react-core";
/**
 * @hidden
 */
var ScatterBase = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(ScatterBase, _super);
    function ScatterBase() {
        var _this = _super.call(this) || this;
        _this.nh = null;
        _this.np = null;
        _this.nr = null;
        _this.o8 = null;
        _this.o9 = null;
        _this.nm = null;
        _this.no = null;
        _this.nl = null;
        _this.nn = null;
        _this.nk = null;
        _this.nn = new ScatterFrame();
        _this.o9 = Rect.empty;
        _this.o8 = Rect.empty;
        return _this;
    }
    ScatterBase.prototype.bf = function () {
        return new ScatterBaseView(this);
    };
    ScatterBase.prototype.h1 = function () {
        _super.prototype.h1.call(this);
        this.xAxis = null;
        this.yAxis = null;
    };
    ScatterBase.prototype.i2 = function (a) {
        _super.prototype.i2.call(this, a);
        this.ni = a;
    };
    ScatterBase.prototype.get_c4 = function () {
        return true;
    };
    ScatterBase.prototype.ag = function () {
        return [this.xAxis, this.yAxis];
    };
    ScatterBase.prototype.fs = function (a, b) {
        var c = this.g2(b);
        if (c == ScatterBase.$$p[4]) {
            return this.ft(a, b, this.n4);
        }
        if (c == ScatterBase.$$p[6]) {
            return this.ft(a, b, this.n8);
        }
        return null;
    };
    ScatterBase.prototype.ch = function (a, b, c) {
        var _this = this;
        if (!this.hasMarkers) {
            return false;
        }
        var d = this.xAxis;
        var e = new ScalerParams(1, this.bs.n2, this.l8, d.ca);
        e.c = this.getEffectiveViewport1(this.bi);
        var f = this.yAxis;
        var g = new ScalerParams(1, this.bs.n2, this.l8, f.ca);
        g.c = this.getEffectiveViewport1(this.bi);
        a.clear();
        this.ma.cc(function (h) {
            if (h._visibility == 0) {
                var i = new SeriesPointOfInterest();
                var j = h.n;
                var k = h.o;
                if (j < _this.l8.left || j > _this.l8.right || k < _this.l8.top || k > _this.l8.bottom) {
                    return;
                }
                i.b = d.d1(j, e);
                i.c = f.d1(k, g);
                i.a = h.content;
                a.add(i);
            }
        });
        return true;
    };
    ScatterBase.prototype.bd = function () {
        if (this.be == 0) {
            if (this.nx <= 2000) {
                return 1;
            }
            else {
                return _super.prototype.bd.call(this);
            }
        }
        else {
            return _super.prototype.bd.call(this);
        }
    };
    ScatterBase.prototype.l6 = function (a) {
        if (!this.hasMarkers || !this.md()) {
            return Rect.empty;
        }
        var b = this.ma.bv(this.lq(a));
        if (b != null) {
            return this.ma.cm(b);
        }
        return Rect.empty;
    };
    ScatterBase.prototype.dh = function (a, b) {
        if (this.me(a, b)) {
            return true;
        }
        return false;
    };
    Object.defineProperty(ScatterBase.prototype, "nq", {
        get: function () {
            return this.np;
        },
        set: function (a) {
            if (this.np != a) {
                var b = this.nq;
                this.np = a;
                this.raisePropertyChanged("XColumn", b, this.nq);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScatterBase.prototype, "ns", {
        get: function () {
            return this.nr;
        },
        set: function (a) {
            if (this.nr != a) {
                var b = this.ns;
                this.nr = a;
                this.raisePropertyChanged("YColumn", b, this.ns);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScatterBase.prototype, "o5", {
        get: function () {
            return this.c(ScatterBase.oq);
        },
        set: function (a) {
            this.h(ScatterBase.oq, a);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScatterBase.prototype, "GetErrorBarsXAxis", {
        get: function () {
            return this.xAxis;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(ScatterBase.prototype, "GetErrorBarsYAxis", {
        get: function () {
            return this.yAxis;
        },
        enumerable: true,
        configurable: true
    });
    ScatterBase.prototype.ik = function () {
        _super.prototype.ik.call(this);
        if (this.xAxis != null) {
            this.xAxis.hb(false);
        }
        if (this.yAxis != null) {
            this.yAxis.hb(false);
        }
    };
    ScatterBase.prototype.i7 = function (a, b, c, d) {
        _super.prototype.i7.call(this, a, b, c, d);
        if (this.ni.ct.g$b(a, b, c, d)) {
            this.jl(false);
            this.it();
        }
        switch (b) {
            case "FastItemsSource":
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    c.deregisterColumn(this.nq);
                    c.deregisterColumn(this.ns);
                    this.nq = null;
                    this.ns = null;
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    this.nq = this.bw(this.n4);
                    this.ns = this.bw(this.n8);
                }
                if ((this.yAxis != null && !this.yAxis.cn()) || (this.xAxis != null && !this.xAxis.cn())) {
                    this.jl(false);
                }
                break;
            case ScatterBase.$$p[3]:
                if (c != null) {
                    c.bx(this);
                }
                if (d != null) {
                    d.ck(this);
                }
                if ((this.xAxis != null && !this.xAxis.cn()) || (d == null && c != null)) {
                    this.jl(false);
                }
                this.it();
                break;
            case ScatterBase.$$p[5]:
                if (c != null) {
                    c.bx(this);
                }
                if (d != null) {
                    d.ck(this);
                }
                if ((this.yAxis != null && !this.yAxis.cn()) || (d == null && c != null)) {
                    this.jl(false);
                }
                this.it();
                break;
            case ScatterBase.$$p[4]:
                if (this.bz != null) {
                    this.bz.deregisterColumn(this.nq);
                    this.nq = this.bw(this.n4);
                }
                break;
            case "XColumn":
                this.ni.ct.g$i();
                if (this.xAxis != null && !this.xAxis.cn()) {
                    this.jl(false);
                }
                break;
            case ScatterBase.$$p[6]:
                if (this.bz != null) {
                    this.bz.deregisterColumn(this.ns);
                    this.ns = this.bw(this.n8);
                }
                break;
            case "YColumn":
                this.ni.ct.g$i();
                if (this.yAxis != null && !this.yAxis.cn()) {
                    this.jl(false);
                }
                break;
            case ScatterBase.$$p[1]:
                this.jl(false);
                this.it();
                break;
            case ScatterBase.$$p[2]:
                this.jl(false);
                this.it();
                break;
            case "TransitionProgress":
                this.no.c(this.ez, this.nm, this.nl);
                this.oa();
                try {
                    if (this.cc(this.bi)) {
                        return;
                    }
                    if ((Math.round(this.ez * 100000) / 100000) == 1) {
                        this.oo(this.nl, this.ni);
                    }
                    else {
                        this.oo(this.no, this.ni);
                    }
                    if (this.bs != null) {
                        this.bs.ko(this);
                    }
                }
                finally {
                    this.op();
                }
                break;
            case "TrendLineBrush":
                this.jw();
                break;
            case ScatterBase.$$p[0]:
                if (this.nj != null) {
                    this.nj.r = this;
                }
                this.jl(false);
                this.it();
                break;
            case "TrendLineType":
                this.it();
                break;
        }
    };
    ScatterBase.prototype.nu = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterBase.prototype.nt = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterBase.prototype.op = function () {
        this.o8 = Rect.empty;
        this.o9 = Rect.empty;
    };
    ScatterBase.prototype.oa = function () {
        var a = this.getViewInfo(this.o8, this.o9);
        this.o8 = a.p0;
        this.o9 = a.p1;
    };
    ScatterBase.prototype.nv = function (a, b) {
        if (b != 3) {
            return true;
        }
        if (a == null) {
            return true;
        }
        if (this.n4 == a || this.n8 == a) {
            return true;
        }
        return false;
    };
    ScatterBase.prototype.h6 = function (a, b, c, d) {
        var e = false;
        if (!this.nv(d, a)) {
            return;
        }
        this.ni.ct.g$e(a, b, c, d);
        if (this.xAxis != null && !this.xAxis.cn()) {
            e = true;
        }
        if (this.yAxis != null && !this.yAxis.cn()) {
            e = true;
        }
        if (e) {
            this.jl(true);
        }
    };
    ScatterBase.prototype.oi = function (a) {
        this.oj(a, null);
    };
    ScatterBase.prototype.oj = function (a, b) {
        var e_1, _a, e_2, _b;
        var c = this.nq != null ? this.nq.count : 0;
        var d = this.ns != null ? this.ns.count : 0;
        var e = Math.min(c, d);
        if (e <= this.nx) {
            a.m.clear();
            var f = new List$1(OwnedPoint.$, 0);
            try {
                for (var _c = tslib_1.__values(fromEnum(a.u.values)), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var g = _d.value;
                    f.add(g);
                }
            }
            catch (e_1_1) {
                e_1 = { error: e_1_1 };
            }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return))
                        _a.call(_c);
                }
                finally {
                    if (e_1)
                        throw e_1.error;
                }
            }
            var h_1 = this.bz;
            f.aa(function (i, j) {
                var k = h_1.indexOf(i.a);
                var l = h_1.indexOf(j.a);
                if (k < l) {
                    return -1;
                }
                if (k > l) {
                    return 1;
                }
                return 0;
            });
            if (b != null) {
                b.i = a.m;
            }
            try {
                for (var _e = tslib_1.__values(fromEnum(f)), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var i = _f.value;
                    if (h_1.indexOf(i.a) >= 0) {
                        if (b != null) {
                            b.j(i.c);
                        }
                        else {
                            a.m.add({ $type: Point_$type, x: i.c.x, y: i.c.y });
                        }
                    }
                }
            }
            catch (e_2_1) {
                e_2 = { error: e_2_1 };
            }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return))
                        _b.call(_e);
                }
                finally {
                    if (e_2)
                        throw e_2.error;
                }
            }
        }
    };
    ScatterBase.prototype.an = function (a) {
        if (a != null && a == this.xAxis && this.nq != null) {
            return new AxisRange(this.nq.minimum, this.nq.maximum);
        }
        if (a != null && a == this.yAxis && this.ns != null) {
            return new AxisRange(this.ns.minimum, this.ns.maximum);
        }
        return null;
    };
    ScatterBase.prototype.fp = function (a) {
        return null;
    };
    ScatterBase.prototype.e8 = function (a) {
        return -1;
    };
    ScatterBase.prototype.c9 = function (a) {
        var _this = this;
        var b = this.bs != null ? this.bs.n2 : Rect.empty;
        b = b.copy();
        var c = this.bs != null ? this.bs.oh : Rect.empty;
        var d = new Rect(0, 0, 0, 1, 1);
        var e = this.l2(this.bi);
        var f = new ScalerParams(0, d, d, this.xAxis.ca, e);
        var g = ((function () {
            var $ret = new ScalerParams(0, d, d, _this.yAxis.ca, e);
            $ret.b = _this.eh();
            return $ret;
        })());
        var h = !b.isEmpty && !c.isEmpty && this.bz != null ? this.bz.indexOf(a) : -1;
        var i = this.xAxis != null && this.nq != null && h < this.nq.count ? this.xAxis.dy(this.nq.item(h), f) : NaN;
        var j = this.yAxis != null && this.ns != null && h < this.ns.count ? this.yAxis.dy(this.ns.item(h), g) : NaN;
        if (!isNaN_(i)) {
            if (i < b.left + 0.1 * b.width) {
                i = i + 0.4 * b.width;
                b.x = i - 0.5 * b.width;
            }
            if (i > b.right - 0.1 * b.width) {
                i = i - 0.4 * b.width;
                b.x = i - 0.5 * b.width;
            }
        }
        if (!isNaN_(j)) {
            if (j < b.top + 0.1 * b.height) {
                j = j + 0.4 * b.height;
                b.y = j - 0.5 * b.height;
            }
            if (j > b.bottom - 0.1 * b.height) {
                j = j - 0.4 * b.height;
                b.y = j - 0.5 * b.height;
            }
        }
        if (this.bn != null) {
            this.bn.ap(this.bs, b, true);
        }
        return h >= 0;
    };
    ScatterBase.prototype.j0 = function (a, b) {
        this.jl(false);
    };
    ScatterBase.prototype.j1 = function (a, b) {
        this.jl(false);
    };
    ScatterBase.prototype.ob = function (a, b, c, d, e) {
        var _this = this;
        b.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, c);
        var f = this.getEffectiveViewport1(a);
        var g = this.bz;
        var h;
        var i;
        var j = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.nh.d, f);
            $ret.c = _this.getEffectiveViewport1(a);
            return $ret;
        })());
        var k = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.nh.e, f);
            $ret.c = _this.getEffectiveViewport1(a);
            $ret.b = _this.eh();
            return $ret;
        })());
        var l = false;
        var m = 0;
        if (this.bs != null) {
            if (this.bs.d1()) {
                var n = this.bs.h4(d, j);
                l = n.c;
                m = n.d;
            }
        }
        var _loop_1 = function (o) {
            h = this_1.nq.item(o);
            i = this_1.ns.item(o);
            var p = { $type: Point_$type, x: this_1.nh.a.dy(h, j), y: this_1.nh.b.dy(i, k) };
            if (l) {
                if (p.x < e.left || p.x > e.right) {
                    if (p.x + m >= e.left && p.x + m <= e.right) {
                        p = { $type: Point_$type, x: p.x + m, y: i };
                    }
                }
            }
            if (!isInfinity(p.x) && !isInfinity(p.y)) {
                var q_1 = g.item(o);
                if (!b.g.containsKey(q_1)) {
                    var r_1 = { $type: Point_$type, x: h, y: i };
                    var s_1 = { $type: Point_$type, x: p.x, y: p.y };
                    b.g.addItem(q_1, ((function () {
                        var $ret = new OwnedPoint();
                        $ret.a = q_1;
                        $ret.b = r_1;
                        $ret.c = s_1;
                        return $ret;
                    })()));
                }
            }
        };
        var this_1 = this;
        for (var o = 0; o < c; o++) {
            _loop_1(o);
        }
    };
    ScatterBase.prototype.of = function (a, b) {
        var _this = this;
        a.j.clear();
        a.n.clear();
        a.h.clear();
        a.l.clear();
        a.i.clear();
        a.k.clear();
        var c = Math.min(this.nq != null ? this.nq.count : 0, this.ns != null ? this.ns.count : 0);
        var d = b.bs;
        var e = b.br;
        var f = this.getEffectiveViewport1(b);
        var g = new ScalerParams(0, d, e, this.xAxis.ca, f);
        g.c = this.getEffectiveViewport1(b);
        var h = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.yAxis.ca, f);
            $ret.b = _this.eh();
            return $ret;
        })());
        ;
        h.c = this.getEffectiveViewport1(b);
        if (c < 1) {
            return;
        }
        this.nh = ((function () {
            var $ret = new ScatterAxisInfoCache();
            $ret.a = _this.xAxis;
            $ret.b = _this.yAxis;
            $ret.d = _this.xAxis.ca;
            $ret.e = _this.yAxis.ca;
            $ret.c = _this.bz;
            return $ret;
        })());
        var i = b;
        if (c <= this.nx) {
            this.ob(i, a, c, d, e);
        }
        if (this.md()) {
            b.cr.l(a.j, this.nx, d, e, this.eu);
        }
        var j = ((function () {
            var $ret = new Clipper(0, e, false);
            $ret.i = a.n;
            return $ret;
        })());
        var k = this.l0(b);
        var l = this.xAxis.d1(k.left, g);
        var m = this.xAxis.d1(k.right, g);
        b.ct.h(a.n, this.trendLineType, this.nq, this.ns, this.trendLinePeriod, function (n) { return _this.xAxis.dy(n, g); }, function (n) { return _this.yAxis.dy(n, h); }, ((function () {
            var $ret = new TrendResolutionParams();
            $ret.b = _this.eu;
            $ret.f = e;
            $ret.g = d;
            return $ret;
        })()), j, l, m);
        this.od(a, b);
    };
    ScatterBase.prototype.h3 = function (a, b) {
        _super.prototype.h3.call(this, a, b);
        var c = b;
        c.c0(a);
    };
    ScatterBase.prototype.oo = function (a, b) {
        var _this = this;
        var c = b.br;
        this.nh = ((function () {
            var $ret = new ScatterAxisInfoCache();
            $ret.a = _this.xAxis;
            $ret.b = _this.yAxis;
            $ret.d = _this.xAxis.ca;
            $ret.e = _this.yAxis.ca;
            return $ret;
        })());
        if (this.md()) {
            b.cr.j(a.j, this.mf);
        }
        b.cj();
        var d = ((function () {
            var $ret = new Clipper(1, NaN, c.bottom, NaN, c.top, false);
            $ret.i = b.ct.g$j.ak;
            return $ret;
        })());
        b.ct.g$h(a.n, d);
        this.ol(a, b);
    };
    ScatterBase.prototype.od = function (a, b) {
        var e_3, _a;
        var c = new ErrorBarsHelper(this, b);
        if (this.nj == null) {
            return;
        }
        var d = this.nj.u;
        var e = this.nj.v;
        var f = 0;
        var g = 0;
        var h = 0;
        var i = 0;
        try {
            for (var _b = tslib_1.__values(fromEnum(a.j.keys)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var j = _c.value;
                var k = a.j.item(j);
                if (d != null) {
                    switch (d.getCalculatorType()) {
                        case 1:
                            var l = this.og(k, c, d, h, i, true);
                            h = l.p3;
                            i = l.p4;
                            break;
                        case 0:
                            var m = this.oe(k, c, d, h, i, true);
                            h = m.p3;
                            i = m.p4;
                            break;
                        case 2:
                            var n = this.oc(k, c, d, j, h, i, true);
                            h = n.p4;
                            i = n.p5;
                            break;
                        case 3:
                            var o = this.oh(c, d, f, h, i, true);
                            f = o.p2;
                            h = o.p3;
                            i = o.p4;
                            break;
                        case 4:
                            var p = this.oe(k, c, d, h, i, true);
                            h = p.p3;
                            i = p.p4;
                            break;
                    }
                    ;
                    var q = new OwnedPoint();
                    q.c = c.l(d, this.nh.a, k.c, f);
                    ;
                    q.a = k.a;
                    a.h.addItem(j, q);
                    a.i.addItem(j, [h, i]);
                }
                if (e != null) {
                    switch (e.getCalculatorType()) {
                        case 1:
                            var r = this.og(k, c, e, h, i, false);
                            h = r.p3;
                            i = r.p4;
                            break;
                        case 0:
                            var s = this.oe(k, c, e, h, i, false);
                            h = s.p3;
                            i = s.p4;
                            break;
                        case 2:
                            var t = this.oc(k, c, e, j, h, i, false);
                            h = t.p4;
                            i = t.p5;
                            break;
                        case 3:
                            var u = this.oh(c, e, g, h, i, false);
                            g = u.p2;
                            h = u.p3;
                            i = u.p4;
                            break;
                        case 4:
                            var v = this.oe(k, c, e, h, i, false);
                            h = v.p3;
                            i = v.p4;
                            break;
                    }
                    ;
                    var w = new OwnedPoint();
                    w.c = c.m(e, this.nh.b, k.c, g);
                    ;
                    w.a = k.a;
                    a.l.addItem(j, w);
                    a.k.addItem(j, [h, i]);
                }
            }
        }
        catch (e_3_1) {
            e_3 = { error: e_3_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_3)
                    throw e_3.error;
            }
        }
    };
    ScatterBase.prototype.og = function (a, b, c, d, e, f) {
        if (f) {
            var g = void 0;
            var h = void 0, i = void 0;
            i = this.nh.a;
            if (this.nj.s == 0) {
                g = a.c.x;
                h = this.nh.a;
            }
            else {
                g = a.c.y;
                h = this.nh.b;
            }
            var j = b.f(g, c, h, i, d, e);
            d = j.p4;
            e = j.p5;
        }
        else {
            var k = void 0;
            var l = void 0, m = void 0;
            m = this.nh.b;
            if (this.nj.t == 0) {
                k = a.c.x;
                l = this.nh.a;
            }
            else {
                k = a.c.y;
                l = this.nh.b;
            }
            var n = b.f(k, c, l, m, d, e);
            d = n.p4;
            e = n.p5;
        }
        return {
            p3: d,
            p4: e
        };
    };
    ScatterBase.prototype.oe = function (a, b, c, d, e, f) {
        if (f) {
            var g = b.j(a.c.x, c, this.nh.a, d, e);
            d = g.p3;
            e = g.p4;
        }
        else {
            var h = b.j(a.c.y, c, this.nh.b, d, e);
            d = h.p3;
            e = h.p4;
        }
        return {
            p3: d,
            p4: e
        };
    };
    ScatterBase.prototype.oc = function (a, b, c, d, e, f, g) {
        var h = c.getItemColumn();
        var i = this.bz.indexOf(d);
        if (h != null && i < h.count) {
            var j = h.item(i);
            if (g) {
                var k = b.h(a.c.x, j, this.nh.a, e, f);
                e = k.p3;
                f = k.p4;
            }
            else {
                var l = b.h(a.c.y, j, this.nh.b, e, f);
                e = l.p3;
                f = l.p4;
            }
        }
        else {
            e = f = NaN;
        }
        return {
            p4: e,
            p5: f
        };
    };
    ScatterBase.prototype.oh = function (a, b, c, d, e, f) {
        var g = a.i(b, c);
        c = g.p1;
        if (f) {
            var h = a.k(c, b, this.nh.a, d, e);
            d = h.p3;
            e = h.p4;
        }
        else {
            var i = a.k(c, b, this.nh.b, d, e);
            d = i.p3;
            e = i.p4;
        }
        return {
            p2: c,
            p3: d,
            p4: e
        };
    };
    ScatterBase.prototype.ol = function (a, b) {
        if (!b.l() || this.nj == null) {
            b.c1();
            return;
        }
        this.om(a, b);
        this.on(a, b);
    };
    ScatterBase.prototype.om = function (a, b) {
        var e_4, _a;
        b.cy();
        var c = new ErrorBarsHelper(this, b);
        var d = new PathGeometry();
        var e = this.nj.u;
        try {
            for (var _b = tslib_1.__values(fromEnum(a.j.keys)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var f = _c.value;
                if (e != null && a.i.containsKey(f)) {
                    var g = a.i.item(f)[0];
                    var h = a.i.item(f)[1];
                    if (!isNaN_(g) && !isNaN_(h)) {
                        var i = a.h.item(f).c;
                        if (this.nj.o == 1 || this.nj.o == 2) {
                            c.d(d, i, g, true);
                        }
                        if (this.nj.o == 1 || this.nj.o == 3) {
                            c.d(d, i, h, false);
                        }
                    }
                }
            }
        }
        catch (e_4_1) {
            e_4 = { error: e_4_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_4)
                    throw e_4.error;
            }
        }
        b.c2(d);
    };
    ScatterBase.prototype.on = function (a, b) {
        var e_5, _a;
        b.cz();
        var c = new ErrorBarsHelper(this, b);
        var d = new PathGeometry();
        var e = this.nj.v;
        try {
            for (var _b = tslib_1.__values(fromEnum(a.j.keys)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var f = _c.value;
                if (e != null && a.k.containsKey(f)) {
                    var g = a.k.item(f)[0];
                    var h = a.k.item(f)[1];
                    if (!isNaN_(g) && !isNaN_(h)) {
                        var i = a.l.item(f).c;
                        if (this.nj.p == 1 || this.nj.p == 2) {
                            c.e(d, i, g, true);
                        }
                        if (this.nj.p == 1 || this.nj.p == 3) {
                            c.e(d, i, h, false);
                        }
                    }
                }
            }
        }
        catch (e_5_1) {
            e_5 = { error: e_5_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_5)
                    throw e_5.error;
            }
        }
    };
    ScatterBase.prototype.dw = function (a, b, c) {
        var d = true;
        if (!_super.prototype.dw.call(this, a, b, c) || b.isEmpty || a.isEmpty || this.xAxis == null || this.yAxis == null || this.xAxis.bh == null || this.yAxis.bh == null || this.nq == null || this.ns == null || this.nq.count == 0 || this.ns.count == 0 || this.bz == null || this.bz.count != this.nq.count || this.bz.count != this.ns.count || this.xAxis.bh == null || this.yAxis.bh == null || this.xAxis.kc == this.xAxis.kb || this.yAxis.kc == this.yAxis.kb) {
            d = false;
        }
        return d;
    };
    ScatterBase.prototype.getViewInfo = function (a, b) {
        if (!this.o8.isEmpty && !this.o9.isEmpty) {
            a = this.o8;
            b = this.o9;
            return {
                p0: a,
                p1: b
            };
        }
        a = this.bi.br;
        b = this.bi.bs;
        return {
            p0: a,
            p1: b
        };
    };
    ScatterBase.prototype.jm = function (a) {
        this.oa();
        try {
            if (this.cc(this.bi)) {
                return;
            }
            if (this.bz != null && this.bz.count > this.nx) {
                a = false;
            }
            if (this.da(a) && !this.de) {
                var b = this.nm;
                if (this.ca()) {
                    if (this.bt.g) {
                        this.bt.t();
                    }
                    this.nm = this.no;
                    this.no = b;
                }
                else {
                    this.nm = this.nl;
                    this.nl = b;
                }
                this.of(this.nl, this.ni);
                this.jt();
            }
            else {
                if (!this.de) {
                    this.of(this.nl, this.ni);
                }
                this.oo(this.nl, this.ni);
            }
        }
        finally {
            this.op();
        }
    };
    ScatterBase.prototype.jw = function () {
        _super.prototype.jw.call(this);
        if (this.fh < 0) {
            return;
        }
        this.ni.c5();
    };
    ScatterBase.prototype.jn = function (a, b) {
        _super.prototype.jn.call(this, a, b);
        if (!this.dl) {
            this.bi.az(b);
            return;
        }
        this.bi.az(b);
        if (this.cc(this.bh)) {
            return;
        }
        var c = typeCast(ScatterBaseView.$, this.bh);
        if (!this.df) {
            this.nn = new ScatterFrame();
            this.of(this.nn, c);
        }
        this.df = false;
        this.oo(this.nn, c);
        this.dl = false;
    };
    ScatterBase.prototype.jk = function (a, b, c, d, e) {
        _super.prototype.jk.call(this, a, b, c, d, e);
        var f = this.a0.a$h.item(d);
        var g = f;
        f.ay(c);
        if (this.cc(g)) {
            return;
        }
        if (this.nk == null) {
            this.nk = new ScatterFrame();
        }
        this.of(this.nk, g);
        this.oo(this.nk, g);
    };
    ScatterBase.prototype.ok = function (a, b) {
        var e_6, _a, e_7, _b;
        var c = new List$1(Base.$, 0);
        try {
            for (var _c = tslib_1.__values(fromEnum(b.c)), _d = _c.next(); !_d.done; _d = _c.next()) {
                var d = _d.value;
                if (!a.containsKey(d)) {
                    c.add1(d);
                }
            }
        }
        catch (e_6_1) {
            e_6 = { error: e_6_1 };
        }
        finally {
            try {
                if (_d && !_d.done && (_a = _c.return))
                    _a.call(_c);
            }
            finally {
                if (e_6)
                    throw e_6.error;
            }
        }
        try {
            for (var _e = tslib_1.__values(fromEnum(c)), _f = _e.next(); !_f.done; _f = _e.next()) {
                var e = _f.value;
                b.g(e);
            }
        }
        catch (e_7_1) {
            e_7 = { error: e_7_1 };
        }
        finally {
            try {
                if (_f && !_f.done && (_b = _e.return))
                    _b.call(_e);
            }
            finally {
                if (e_7)
                    throw e_7.error;
            }
        }
    };
    ScatterBase.prototype.nd = function (a, b, c, d, e) {
        var _this = this;
        if (c == null || c.length != this.nh.c.count) {
            c = new Array(this.nh.c.count);
            for (var f = 0; f < this.nh.c.count; f++) {
                c[f] = PointUtil.create();
            }
        }
        var g = this.getEffectiveViewport1(a);
        var h = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.xAxis.ca, g);
            $ret.c = _this.getEffectiveViewport1(a);
            return $ret;
        })());
        var i = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.yAxis.ca, g);
            $ret.c = _this.getEffectiveViewport1(a);
            $ret.b = _this.eh();
            return $ret;
        })());
        var j = this.l0(a);
        var k = this.nh.a.d1(j.left, h);
        var l = this.nh.a.d1(j.right, h);
        var m = this.nh.b.d1(j.bottom, i);
        var n = this.nh.b.d1(j.top, i);
        if (this.nh.d) {
            var o = k;
            k = l;
            l = o;
        }
        if (this.nh.e) {
            var p = m;
            m = n;
            n = p;
        }
        var q = this.nh;
        var r = q.a;
        var s = q.b;
        var t;
        var u;
        var v = this.nq;
        var w = this.ns;
        var x = false;
        var y = 0;
        var z = 0;
        if (this.bs != null) {
            if (this.bs.d1()) {
                var aa = this.bs.h4(d, h);
                x = aa.c;
                y = aa.d;
                z = r.d1(0 + y, h);
                var ab = r.d1(0, h);
                z -= ab;
            }
        }
        for (var ac = 0; ac < this.nh.c.count; ac++) {
            t = v.item(ac);
            u = w.item(ac);
            if (x) {
                if (t >= k && t <= l && u >= m && u <= n) {
                    c[ac].x = r.dy(t, h);
                    c[ac].y = s.dy(u, i);
                }
                else {
                    if ((t + z) >= k && (t + z) <= l && u >= m && u <= n) {
                        c[ac].x = r.dy(t, h) + y;
                        c[ac].y = s.dy(u, i);
                    }
                    else {
                        c[ac].x = NaN;
                        c[ac].y = NaN;
                    }
                }
            }
            else {
                if (t >= k && t <= l && u >= m && u <= n) {
                    c[ac].x = r.dy(t, h);
                    c[ac].y = s.dy(u, i);
                }
                else {
                    c[ac].x = NaN;
                    c[ac].y = NaN;
                }
            }
        }
        return c;
    };
    ScatterBase.prototype.nw = function (a, b) {
        var e_8, _a;
        if (b == null) {
            b = new List$1(Number_$type, 2, a.e);
        }
        else {
            b.clear();
        }
        var c = 0;
        var d = this.bz;
        try {
            for (var _b = tslib_1.__values(fromEnum(a.c)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var e = _c.value;
                b.add(d.indexOf(e));
            }
        }
        catch (e_8_1) {
            e_8 = { error: e_8_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_8)
                    throw e_8.error;
            }
        }
        return b;
    };
    ScatterBase.prototype.ic = function (a) {
        _super.prototype.ic.call(this, a);
        this.a2.exportTrendlineData(this, a, this.ni.ct.g$j);
    };
    ScatterBase.prototype.eh = function () {
        return Series.ei(this.ns, null);
    };
    ScatterBase.$t = markType(ScatterBase, 'ScatterBase', MarkerSeries.$, [ISupportsErrorBars_$type, ITrendLineSeries_$type]);
    ScatterBase.oq = DependencyProperty.i("ActualTrendLineBrush", Brush.$, ScatterBase.$, new PropertyMetadata(2, null, function (a, b) { return a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue); }));
    ScatterBase.$$p = markDep(DependencyProperty, PropertyMetadata, ScatterBase, 'raisePropertyChanged', ['ErrorBarSettings:nj:or', [ScatterErrorBarSettings.$, null], 'MarkerCollisionAvoidance:ne:os', [CollisionAvoidanceType_$type, enumGetBox(CollisionAvoidanceType_$type, 0)], 'MaximumMarkers:nx:ot', [1, 400], 'XAxis::o1', [NumericXAxis.$, null], 'XMemberPath:n4:o2', [2, null], 'YAxis::o3', [NumericYAxis.$, null], 'YMemberPath:n8:o4', [2, null], 'TrendLineType::oz', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::oy', [1, 1.5], 'TrendLinePeriod::ox', [1, 7], 'TrendLineBrush::ou', [Brush.$, null], 'TrendLineZIndex:ny:o0', [1, 1001], 'TrendLineDashArray:o6:ov', [DoubleCollection.$], 'TrendLineDashCap:o7:ow', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
    return ScatterBase;
}(MarkerSeries));
export { ScatterBase };
/**
 * @hidden
 */
var ScatterBaseView = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(ScatterBaseView, _super);
    function ScatterBaseView(a) {
        var _this = _super.call(this, a) || this;
        _this.cr = null;
        _this.cp = null;
        _this.cs = null;
        _this.cx = null;
        _this.c7 = null;
        _this.c8 = null;
        _this.ct = null;
        _this.c6 = null;
        _this.cu = null;
        _this.cs = a;
        _this.cu = new HashPool$2(Base.$, Marker.$);
        _this.ce(_this.cu);
        _this.ct = new ScatterTrendLineManager();
        return _this;
    }
    ScatterBaseView.prototype.ap = function () {
        _super.prototype.ap.call(this);
        this.cr = this.cq();
        this.c7 = new Path();
        this.c8 = new Path();
        if (!this.n) {
            this.cs.nx = 2000;
        }
    };
    ScatterBaseView.prototype.c9 = function (a) {
        if (this.c6 == null) {
            this.c6 = new DataTemplateMeasureInfo();
            this.c6.context = this.h.g();
        }
        this.c6.width = a.width;
        this.c6.height = a.height;
        this.c6.data = a.content;
        var b = a.ah;
        if (b.measure != null) {
            b.measure(this.c6);
        }
        return new Size(1, this.c6.width, this.c6.height);
    };
    ScatterBaseView.prototype.cq = function () {
        var _this = this;
        var a = new NumericMarkerManager(1, function (b) { return _this.cu.item(b); }, function (b) { return _this.cs.nh.c.item(b); }, runOn(this, this.c4), runOn(this, this.cn), runOn(this, this.cv), function () { return _this.cs.ne; });
        a.q = runOn(this, this.c9);
        return a;
    };
    ScatterBaseView.prototype.c4 = function (a) {
        this.cs.ok(a, this.cu);
    };
    ScatterBaseView.prototype.cw = function () {
        return this.b1;
    };
    ScatterBaseView.prototype.co = function () {
        return this.cp;
    };
    ScatterBaseView.prototype.cn = function () {
        this.cp = this.cs.nd(this, this.cu, this.cp, this.bs, this.br);
        return this.cp;
    };
    ScatterBaseView.prototype.cv = function () {
        this.cx = this.cs.nw(this.cu, this.cx);
        return this.cx;
    };
    ScatterBaseView.prototype.cy = function () {
    };
    ScatterBaseView.prototype.c2 = function (a) {
    };
    ScatterBaseView.prototype.cz = function () {
    };
    ScatterBaseView.prototype.c3 = function (a) {
    };
    ScatterBaseView.prototype.c5 = function () {
        if (this.cs.trendLineBrush != null) {
            this.cs.o5 = this.cs.trendLineBrush;
        }
        else {
            this.cs.o5 = this.cs.lb;
        }
    };
    ScatterBaseView.prototype.cc = function (a) {
        this.cu.f(a);
    };
    ScatterBaseView.prototype.c1 = function () {
    };
    ScatterBaseView.prototype.a2 = function (a, b) {
        _super.prototype.a2.call(this, a, b);
        if (a.d) {
            if (this.cs.trendLineType != 0 && !b) {
                var c = this.ct.g$j;
                c.ac = this.cs.trendLineThickness;
                c._stroke = this.cs.o5;
                c.ai = this.cs.o6;
                c.ad = this.cs.o7;
                a.u(c);
            }
        }
    };
    ScatterBaseView.prototype.c0 = function (a) {
        if (a) {
            this.c1();
            this.cu.clear();
        }
        this.ct.g$d();
        this.an();
    };
    ScatterBaseView.prototype.getDefaultTooltipTemplate = function () {
        var a = "<div class='ui-chart-default-tooltip-content'><span";
        var b = this.e.a0.a$q(this.e);
        if (!stringIsNullOrEmpty(b)) {
            a += " style='color:" + b + "'";
        }
        a += ">" + this.cs.fx + "</span><br/><span>" + "x: </span><span class='ui-priority-primary'>${item." + this.cs.n4 + "}</span><br/><span>" + "y: </span><span class='ui-priority-primary'>${item." + this.cs.n8 + "}</span></div>";
        return a;
    };
    ScatterBaseView.$t = markType(ScatterBaseView, 'ScatterBaseView', MarkerSeriesView.$);
    return ScatterBaseView;
}(MarkerSeriesView));
export { ScatterBaseView };
//# sourceMappingURL=ScatterBase_combined.js.map
