/*
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 { 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 { ScatterItemSearchMode_$type } from "./ScatterItemSearchMode";
import { ScatterErrorBarSettings } from "./ScatterErrorBarSettings";
import { HighlightingInfo } from "./HighlightingInfo";
import { ScatterFrame } from "./ScatterFrame";
import { Base, runOn, delegateCombine, enumGetBox, Number_$type, typeCast, fromEnum, Point_$type, markType, markDep, PointUtil } 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 { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay";
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 { GeometryUtil } from "igniteui-react-core";
import { HashPool$2 } from "igniteui-react-core";
import { DataContext } from "igniteui-react-core";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { ScatterTrendLineManager } from "./ScatterTrendLineManager";
import { Thickness } from "igniteui-react-core";
import { Size } from "igniteui-react-core";
import { AssigningScatterStyleEventArgs } from "./AssigningScatterStyleEventArgs";
import { AssigningScatterMarkerStyleEventArgs } from "./AssigningScatterMarkerStyleEventArgs";
import { SeriesRenderManager } from "./SeriesRenderManager";
import { ErrorBarsHelper } from "./ErrorBarsHelper";
import { PathGeometry } from "igniteui-react-core";
import { DataLegendSeriesValueInfo } from "igniteui-react-core";
import { DataLegendSeriesContext } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { truncate, isNaN_, isInfinity } from "igniteui-react-core";
import { boxArray$1, arrayShallowClone } from "igniteui-react-core";
import { Path } from "igniteui-react-core";
import { DataTemplateMeasureInfo } from "igniteui-react-core";
import { NumericMarkerManager } from "./NumericMarkerManager";
import { stringIsNullOrEmpty } from "igniteui-react-core";
/**
 * @hidden
 */
var ScatterBase = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ScatterBase, _super);
    function ScatterBase() {
        var _this = _super.call(this) || this;
        _this.vu = null;
        _this.v8 = null;
        _this.v9 = null;
        _this.zc = null;
        _this.zd = null;
        _this.v3 = 1;
        _this.vf = null;
        _this.vg = null;
        _this.v0 = null;
        _this.v2 = null;
        _this.vy = null;
        _this.we = false;
        _this.wd = false;
        _this.vq = null;
        _this.vr = null;
        _this.assigningScatterStyle = null;
        _this.assigningScatterMarkerStyle = null;
        _this.v7 = null;
        _this.v1 = null;
        _this.vx = null;
        _this.wc = true;
        _this.wr = 0;
        _this.ws = 0;
        _this.wt = 0;
        _this.wu = 0;
        _this.v4 = _this.v5();
        _this.v7 = new ScatterSeriesRenderManager();
        _this.v1 = new ScatterFrame();
        _this.zd = Rect.empty;
        _this.zc = Rect.empty;
        return _this;
    }
    ScatterBase.prototype.cg = function () {
        return new ScatterBaseView(this);
    };
    ScatterBase.prototype.ng = function () {
        _super.prototype.ng.call(this);
        this.xAxis = null;
        this.yAxis = null;
    };
    ScatterBase.prototype.o0 = function (a) {
        _super.prototype.o0.call(this, a);
        this.vv = a;
    };
    ScatterBase.prototype.get_e9 = function () {
        return true;
    };
    ScatterBase.prototype.ag = function () {
        return [this.xAxis, this.yAxis];
    };
    ScatterBase.prototype.ju = function (a, b) {
        var c = this.lv(b);
        if (c == ScatterBase.$$p[12]) {
            return this.jv(a, b, this.xl);
        }
        if (c == ScatterBase.$$p[16]) {
            return this.jv(a, b, this.xt);
        }
        return null;
    };
    ScatterBase.prototype.ds = function (a, b, c, d) {
        var _this = this;
        if (!this.hasMarkers) {
            return false;
        }
        var e = this.xAxis;
        var f = new ScalerParams(1, this.cy.tn, this.tw, e.ch);
        f.c = this.getEffectiveViewport1(this.cj);
        var g = this.yAxis;
        var h = new ScalerParams(1, this.cy.tn, this.tw, g.ch);
        h.c = this.getEffectiveViewport1(this.cj);
        a.clear();
        this.t9.ci(function (i) {
            if (i._visibility == 0) {
                var j = new SeriesPointOfInterest();
                var k = i.n;
                var l = i.o;
                if (k < _this.tw.left || k > _this.tw.right || l < _this.tw.top || l > _this.tw.bottom) {
                    return;
                }
                j.b = e.em(k, f);
                j.c = g.em(l, h);
                j.a = i.content;
                a.add(j);
            }
        });
        return true;
    };
    ScatterBase.prototype.bx = function () {
        if (this.by == 0) {
            if (this.w1 <= 2000) {
                return 1;
            }
            else {
                return _super.prototype.bx.call(this);
            }
        }
        else {
            return _super.prototype.bx.call(this);
        }
    };
    ScatterBase.prototype.tu = function (a) {
        if (!this.hasMarkers || !this.uc()) {
            return Rect.empty;
        }
        var b = this.t9.b1(this.tc(a));
        if (b != null) {
            return this.t9.cs(b);
        }
        return Rect.empty;
    };
    ScatterBase.prototype.f4 = function (a, b) {
        if (this.ud(a, b)) {
            return true;
        }
        return false;
    };
    Object.defineProperty(ScatterBase.prototype, "wa", {
        get: function () {
            return this.v8;
        },
        set: function (a) {
            if (this.v8 != a) {
                var b = this.wa;
                this.v8 = a;
                this.raisePropertyChanged("XColumn", b, this.wa);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterBase.prototype, "wb", {
        get: function () {
            return this.v9;
        },
        set: function (a) {
            if (this.v9 != a) {
                var b = this.wb;
                this.v9 = a;
                this.raisePropertyChanged("YColumn", b, this.wb);
            }
        },
        enumerable: false,
        configurable: true
    });
    ScatterBase.prototype.fn = function () {
        return this.highlightedItemsSource != null || (this.w5 != null && this.w7 != null);
    };
    ScatterBase.prototype.wp = function () {
        return false;
    };
    ScatterBase.prototype.g0 = function () {
        var a = _super.prototype.g0.call(this);
        {
            var b = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.ad = "YMemberPath";
                $ret.p = true;
                $ret.y = "HighlightedYMemberPath";
                $ret.q = true;
                return $ret;
            })());
            b.valueResolving = delegateCombine(b.valueResolving, runOn(this, this.x0));
            a.add(b);
        }
        {
            var c = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.ad = "XMemberPath";
                $ret.p = true;
                $ret.y = "HighlightedXMemberPath";
                $ret.q = true;
                return $ret;
            })());
            c.valueResolving = delegateCombine(c.valueResolving, runOn(this, this.xz));
            a.add(c);
        }
        if (this.wp()) {
            var d = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "DashArray";
                $ret.p = true;
                $ret.x = ((function () {
                    var $ret = new DoubleCollection();
                    $ret.add(5);
                    $ret.add(5);
                    return $ret;
                })());
                $ret.q = true;
                return $ret;
            })());
            a.add(d);
        }
        if (!this.wp()) {
            var e = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "Brush";
                $ret.p = true;
                $ret.y = "ActualBrush";
                $ret.q = true;
                return $ret;
            })());
            e.valueResolving = delegateCombine(e.valueResolving, runOn(this, this.px));
            a.add(e);
        }
        if (!this.wp()) {
            var f = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "Outline";
                $ret.p = true;
                $ret.y = "ActualOutline";
                $ret.q = true;
                return $ret;
            })());
            f.valueResolving = delegateCombine(f.valueResolving, runOn(this, this.px));
            a.add(f);
        }
        return a;
    };
    ScatterBase.prototype.xz = function (a, b) {
        if (this.w5 != null) {
            b.value = this.w5;
            return;
        }
        b.value = this.xl;
    };
    ScatterBase.prototype.x0 = function (a, b) {
        if (this.w7 != null) {
            b.value = this.w7;
            return;
        }
        b.value = this.xt;
    };
    Object.defineProperty(ScatterBase.prototype, "y9", {
        get: function () {
            return this.c(ScatterBase.yk);
        },
        set: function (a) {
            this.h(ScatterBase.yk, a);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterBase.prototype, "GetErrorBarsXAxis", {
        get: function () {
            return this.xAxis;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterBase.prototype, "GetErrorBarsYAxis", {
        get: function () {
            return this.yAxis;
        },
        enumerable: false,
        configurable: true
    });
    ScatterBase.prototype.ob = function () {
        _super.prototype.ob.call(this);
        if (this.xAxis != null) {
            this.xAxis.h8(false);
        }
        if (this.yAxis != null) {
            this.yAxis.h8(false);
        }
    };
    ScatterBase.prototype.o8 = function (a, b, c, d) {
        _super.prototype.o8.call(this, a, b, c, d);
        if (this.vv.c0.g$b(a, b, c, d)) {
            this.pp(false);
            this.ol();
        }
        switch (b) {
            case "FastItemsSource":
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    c.deregisterColumn(this.wa);
                    c.deregisterColumn(this.wb);
                    this.wa = null;
                    this.wb = null;
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    this.wa = this.c3(this.xl);
                    this.wb = this.c3(this.xt);
                }
                if ((this.yAxis != null && !this.yAxis.c1()) || (this.xAxis != null && !this.xAxis.c1())) {
                    this.pp(this.fq && c != null);
                }
                break;
            case ScatterBase.$$p[9]:
                if (c != null) {
                    c.b0(this);
                }
                if (d != null) {
                    d.ct(this);
                }
                if ((this.xAxis != null && !this.xAxis.c1()) || (d == null && c != null)) {
                    this.pp(false);
                }
                this.ol();
                break;
            case ScatterBase.$$p[13]:
                if (c != null) {
                    c.b0(this);
                }
                if (d != null) {
                    d.ct(this);
                }
                if ((this.yAxis != null && !this.yAxis.c1()) || (d == null && c != null)) {
                    this.pp(false);
                }
                this.ol();
                break;
            case ScatterBase.$$p[12]:
                if (this.c6 != null) {
                    this.c6.deregisterColumn(this.wa);
                    this.wa = this.c3(this.xl);
                }
                break;
            case "XColumn":
                this.vv.c0.g$i();
                if (this.xAxis != null && !this.xAxis.c1()) {
                    this.pp(this.fq && this.dn);
                }
                break;
            case ScatterBase.$$p[16]:
                if (this.c6 != null) {
                    this.c6.deregisterColumn(this.wb);
                    this.wb = this.c3(this.xt);
                }
                break;
            case "YColumn":
                this.vv.c0.g$i();
                if (this.yAxis != null && !this.yAxis.c1()) {
                    this.pp(this.fq && this.dn);
                }
                break;
            case ScatterBase.$$p[7]:
                this.pp(false);
                this.ol();
                break;
            case ScatterBase.$$p[8]:
                this.pp(false);
                this.ol();
                break;
            case "TransitionProgress":
                this.v2.c(this.iv, this.v0, this.vy);
                this.xv();
                try {
                    if (this.dl(this.cj)) {
                        return;
                    }
                    if ((Math.round(this.iv * 100000) / 100000) == 1) {
                        this.yh(this.vy, this.vv);
                    }
                    else {
                        this.yh(this.v2, this.vv);
                    }
                    if (this.cy != null) {
                        this.cy.on(this);
                    }
                }
                finally {
                    this.yi();
                }
                break;
            case "TrendLineBrush":
                this.pe(b);
                break;
            case ScatterBase.$$p[0]:
                if (this.vw != null) {
                    this.vw.r = this;
                }
                this.pp(false);
                this.ol();
                break;
            case "TrendLineType":
                this.ol();
                break;
            case ScatterBase.$$p[4]:
                this.we = this.wm();
                this.pp(false);
                break;
            case ScatterBase.$$p[3]:
                this.wd = this.wl();
                this.pp(false);
                break;
            case ScatterBase.$$p[5]:
                this.v4 = this.v5();
                break;
        }
    };
    ScatterBase.prototype.wm = function () {
        return this.wi;
    };
    ScatterBase.prototype.wl = function () {
        return this.wh;
    };
    ScatterBase.prototype.wg = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterBase.prototype.wf = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterBase.prototype.yi = function () {
        this.zc = Rect.empty;
        this.zd = Rect.empty;
    };
    ScatterBase.prototype.xv = function () {
        var a = this.getViewInfo(this.zc, this.zd);
        this.zc = a.p0;
        this.zd = a.p1;
    };
    ScatterBase.prototype.wk = function (a, b) {
        if (b != 3) {
            return true;
        }
        if (a == null) {
            return true;
        }
        if (this.xl == a || this.xt == a) {
            return true;
        }
        return false;
    };
    ScatterBase.prototype.no = function (a, b, c, d) {
        var e = false;
        if (!this.wk(d, a)) {
            return;
        }
        this.vv.c0.g$e(a, b, c, d);
        if (this.xAxis != null && !this.xAxis.c1()) {
            e = true;
        }
        if (this.yAxis != null && !this.yAxis.c1()) {
            e = true;
        }
        if (a == 0 || a == 2 || a == 3 || a == 4) {
            this.wc = true;
        }
        else if (a == 1) {
            for (var f = b; f < b + c; f++) {
                this.wr += this.wa.item(f);
                this.ws += this.wb.item(f);
            }
            this.wt = this.wr / this.wa.count;
            this.wu = this.ws / this.wb.count;
        }
        if (e) {
            this.pp(true);
        }
    };
    ScatterBase.prototype.x9 = function (a) {
        this.ya(a, null);
    };
    ScatterBase.prototype.ya = function (a, b) {
        var e_1, _a, e_2, _b;
        var c = this.wa != null ? this.wa.count : 0;
        var d = this.wb != null ? this.wb.count : 0;
        var e = Math.min(c, d);
        if (e <= this.w1) {
            a.m.clear();
            var f = new List$1(OwnedPoint.$, 0);
            try {
                for (var _c = __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.c6;
            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 = __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.aq = function (a) {
        if (a != null && a == this.xAxis && this.wa != null) {
            return new AxisRange(this.wa.minimum, this.wa.maximum);
        }
        if (a != null && a == this.yAxis && this.wb != null) {
            return new AxisRange(this.wb.minimum, this.wb.maximum);
        }
        return null;
    };
    ScatterBase.prototype.jr = function (a) {
        var b = this.i8(a);
        if (this.c6 != null && b >= 0 && b < this.c6.count) {
            return this.c6.item(b);
        }
        return null;
    };
    Object.defineProperty(ScatterBase.prototype, "v4", {
        get: function () {
            return this.v3;
        },
        set: function (a) {
            var b = this.v3;
            this.v3 = a;
            if (b != this.v3) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.v3));
            }
        },
        enumerable: false,
        configurable: true
    });
    ScatterBase.prototype.v5 = function () {
        if (this.v6 != 0) {
            return this.v6;
        }
        return this.wj ? 4 : 1;
    };
    ScatterBase.prototype.i8 = function (a) {
        var b = truncate(Math.round(this.hv(a)));
        return b;
    };
    ScatterBase.prototype.hv = function (a) {
        switch (this.v4) {
            case 1: return this.wx(a);
            case 3: return this.wy(a);
            case 2: return this.wv(a);
            case 4: return this.ww(a);
        }
        return -1;
    };
    ScatterBase.prototype.ww = function (a) {
        return this.wz(a, false);
    };
    ScatterBase.prototype.wv = function (a) {
        var b = this.tc(a);
        var c = b.x;
        var d = b.y;
        if (this.c6 == null || this.xAxis == null || this.yAxis == null || this.wa == null || this.wb == null) {
            return -1;
        }
        if (this.c6.count > this.w0) {
            return -1;
        }
        this.xy();
        var e = this.vf;
        var f = this.vg;
        if (e == null || f == null) {
            return -1;
        }
        var g = 1.7976931348623157E+308;
        var h = -1;
        for (var i = 0; i < this.wa.count; i++) {
            var j = e[i];
            var k = f[i];
            var l = (c - j) * (c - j) + (d - k) * (d - k);
            if (l < g) {
                g = l;
                h = i;
            }
        }
        return h;
    };
    ScatterBase.prototype.xy = function () {
        var _this = this;
        var a = this.cj.by;
        var b = this.cj.bx;
        var c = this.getEffectiveViewport();
        if (this.vu == null) {
            return;
        }
        var d = new ScalerParams(0, a, b, this.vu.d, c);
        var e = ((function () {
            var $ret = new ScalerParams(0, a, b, _this.vu.e, c);
            $ret.b = _this.h2();
            return $ret;
        })());
        if (this.vf == null || this.vg == null) {
            var f = arrayShallowClone(this.wa.asArray());
            var g = arrayShallowClone(this.wb.asArray());
            this.xAxis.hn(boxArray$1(f), 0, f.length, d);
            this.yAxis.hn(boxArray$1(g), 0, g.length, e);
            this.vf = f;
            this.vg = g;
        }
    };
    ScatterBase.prototype.get_wj = function () {
        return false;
    };
    Object.defineProperty(ScatterBase.prototype, "wj", {
        get: function () {
            return this.get_wj();
        },
        enumerable: false,
        configurable: true
    });
    ScatterBase.prototype.wz = function (a, b) {
        if (!this.wj) {
            return -1;
        }
        var c = { $type: Point_$type, x: 0, y: 0 };
        var d = true;
        var e = this.vz();
        if (e == null) {
            return -1;
        }
        if (e.m == null) {
            return -1;
        }
        if (this.c6 == null || this.c6.count > this.w0) {
            return -1;
        }
        this.xy();
        var f = this.vf;
        var g = this.vg;
        if (f == null || g == null) {
            return -1;
        }
        var h = this.tc(a);
        var i = 1.7976931348623157E+308;
        var j = -1;
        for (var k = 0; k < this.vf.length; k++) {
            var l = { $type: Point_$type, x: this.vf[k], y: this.vg[k] };
            if (k > 0) {
                if (!b || e.j.containsKey(this.c6.item(k)) || e.j.containsKey(this.c6.item(k - 1))) {
                    var m = GeometryUtil.d(h, c, l);
                    if (m < i) {
                        i = m;
                        j = k;
                    }
                }
            }
            c = l;
        }
        if (j >= 0) {
            var n = { $type: Point_$type, x: this.vf[j], y: this.vg[j] };
            var o = { $type: Point_$type, x: this.vf[j - 1], y: this.vg[j - 1] };
            if (!b || (e.j.containsKey(this.c6.item(j)) && e.j.containsKey(this.c6.item(j - 1)))) {
                var p = GeometryUtil.h(h, o, n);
                return (j - 1) + p;
            }
            else if (e.j.containsKey(this.c6.item(j))) {
                return j;
            }
            else {
                return j - 1;
            }
        }
        return -1;
    };
    ScatterBase.prototype.wy = function (a) {
        return this.wz(a, true);
    };
    ScatterBase.prototype.wx = function (a) {
        var _this = this;
        var b = null;
        var c = 1.7976931348623157E+308;
        var d = this.tc(a);
        var e = d.x;
        var f = d.y;
        if (this.vv.c1.e > this.w0) {
            return -1;
        }
        this.vv.c8(function (g) {
            if (g._visibility == 0) {
                var h = _this.vv.cs(g);
                var i = h.left + h.width / 2;
                var j = h.top + h.height / 2;
                var k = (e - i) * (e - i) + (f - j) * (f - j);
                if (k < c) {
                    c = k;
                    b = g;
                }
            }
        });
        if (b != null) {
            return b.ak;
        }
        return -1;
    };
    ScatterBase.prototype.th = function (a, b, c) {
        var _this = this;
        if (this.xAxis == null || this.yAxis == null || this.wa == null || this.wb == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        var d = this.cj.by;
        var e = this.cj.bx;
        var f = this.getEffectiveViewport();
        var g = new ScalerParams(0, d, e, this.xAxis.ch, f);
        var h = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.yAxis.ch, f);
            $ret.b = _this.h2();
            return $ret;
        })());
        if (b) {
            var i = this.hv(a);
            if (i == -1) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            var j = truncate(Math.floor(i));
            var k = truncate(Math.ceil(i));
            if (j < 0) {
                j = 0;
            }
            if (k < 0) {
                k = 0;
            }
            if (k > this.c6.count - 1) {
                k = this.c6.count - 1;
            }
            if (j > this.c6.count - 1) {
                j = this.c6.count - 1;
            }
            if (k == j) {
                var l = this.xAxis.ej(this.wa.item(j), g);
                var m = this.yAxis.ej(this.wb.item(j), h);
                return { $type: Point_$type, x: l, y: m };
            }
            var n = i - Math.floor(i);
            var o = this.xAxis.ej(this.wa.item(j), g);
            var p = this.yAxis.ej(this.wb.item(j), h);
            var q = this.xAxis.ej(this.wa.item(k), g);
            var r = this.yAxis.ej(this.wb.item(k), h);
            var s = q - o;
            var t = r - p;
            return { $type: Point_$type, x: o + s * n, y: p + t * n };
        }
        else {
            var u = this.i8(a);
            if (u == -1) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            var v = this.xAxis.ej(this.wa.item(u), g);
            var w = this.yAxis.ej(this.wb.item(u), h);
            return { $type: Point_$type, x: v, y: w };
        }
    };
    ScatterBase.prototype.fo = function (a) {
        var _this = this;
        var b = this.cy != null ? this.cy.tn : Rect.empty;
        b = b.copy();
        var c = this.cy != null ? this.cy.t2 : Rect.empty;
        var d = new Rect(0, 0, 0, 1, 1);
        var e = this.tq(this.cj);
        var f = new ScalerParams(0, d, d, this.xAxis.ch, e);
        var g = ((function () {
            var $ret = new ScalerParams(0, d, d, _this.yAxis.ch, e);
            $ret.b = _this.h2();
            return $ret;
        })());
        var h = !b.isEmpty && !c.isEmpty && this.c6 != null ? this.c6.indexOf(a) : -1;
        var i = this.xAxis != null && this.wa != null && h < this.wa.count ? this.xAxis.ej(this.wa.item(h), f) : NaN;
        var j = this.yAxis != null && this.wb != null && h < this.wb.count ? this.yAxis.ej(this.wb.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.cr != null) {
            this.cr.au(this.cy, b, true);
        }
        return h >= 0;
    };
    ScatterBase.prototype.qm = function (a, b) {
        this.pp(false);
    };
    ScatterBase.prototype.qn = function (a, b) {
        this.pp(false);
    };
    ScatterBase.prototype.vz = function () {
        var a = this.vy;
        if (this.dj()) {
            if (this.cz.g) {
                this.cz.t();
            }
            a = this.v2;
        }
        return a;
    };
    ScatterBase.prototype.xw = 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.c6;
        var h;
        var i;
        var j = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.vu.d, f);
            $ret.c = _this.getEffectiveViewport1(a);
            return $ret;
        })());
        var k = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.vu.e, f);
            $ret.c = _this.getEffectiveViewport1(a);
            $ret.b = _this.h2();
            return $ret;
        })());
        var l = false;
        var m = 0;
        if (this.cy != null) {
            if (this.cy.fb()) {
                var n = this.cy.lo(d, j);
                l = n.c;
                m = n.d;
            }
        }
        var _loop_1 = function (o) {
            h = this_1.wa.item(o);
            i = this_1.wb.item(o);
            var p = { $type: Point_$type, x: this_1.vu.a.ej(h, j), y: this_1.vu.b.ej(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.x6 = function (a, b) {
        var _this = this;
        this.vf = null;
        this.vg = null;
        a.j.clear();
        a.n.clear();
        a.h.clear();
        a.l.clear();
        a.i.clear();
        a.k.clear();
        var c = Math.min(this.wa != null ? this.wa.count : 0, this.wb != null ? this.wb.count : 0);
        var d = b.by;
        var e = b.bx;
        var f = this.getEffectiveViewport1(b);
        var g = new ScalerParams(0, d, e, this.xAxis.ch, f);
        g.c = this.getEffectiveViewport1(b);
        var h = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.yAxis.ch, f);
            $ret.b = _this.h2();
            return $ret;
        })());
        h.c = this.getEffectiveViewport1(b);
        if (c < 1) {
            return;
        }
        this.vu = ((function () {
            var $ret = new ScatterAxisInfoCache();
            $ret.a = _this.xAxis;
            $ret.b = _this.yAxis;
            $ret.d = _this.xAxis.ch;
            $ret.e = _this.yAxis.ch;
            $ret.c = _this.c6;
            return $ret;
        })());
        var i = b;
        if (c <= this.w1) {
            this.xw(i, a, c, d, e);
        }
        if (this.uc()) {
            b.cy.l(a.j, this.w1, d, e, this.hj);
        }
        var j = ((function () {
            var $ret = new Clipper(0, e, false);
            $ret.i = a.n;
            return $ret;
        })());
        var k = this.to(b);
        var l = this.xAxis.em(k.left, g);
        var m = this.xAxis.em(k.right, g);
        b.c0.h(a.n, this.trendLineType, this.wa, this.wb, this.trendLinePeriod, function (n) { return _this.xAxis.ej(n, g); }, function (n) { return _this.yAxis.ej(n, h); }, ((function () {
            var $ret = new TrendResolutionParams();
            $ret.d = _this.hj;
            $ret.h = e;
            $ret.i = d;
            return $ret;
        })()), j, l, m);
        this.x4(a, b);
    };
    ScatterBase.prototype.nj = function (a, b) {
        _super.prototype.nj.call(this, a, b);
        var c = b;
        c.c7(a);
    };
    ScatterBase.prototype.get_es = function () {
        return true;
    };
    ScatterBase.prototype.vo = function (a, b, c) {
        return null;
    };
    ScatterBase.prototype.vp = function (a, b, c) {
        var d = this.vz();
        var e = this.vv.b1(this.tc(b));
        var f = -1;
        if (e == null) {
            if (a != null) {
                f = this.c6.indexOf(a);
            }
            else {
                return null;
            }
        }
        else {
            f = e.ak;
        }
        if (f == -1) {
            return null;
        }
        var g = new HighlightingInfo();
        g.b = this;
        g.h = f;
        g.g = f;
        g.d = false;
        g.e = true;
        if (c != null && c.h == g.h && c.g == g.g) {
            return c;
        }
        return g;
    };
    ScatterBase.prototype.ty = function (a, b) {
        if (this.ua != 1 && this.ua != 13) {
            var c = this.t9.ct();
            var d = (c.width / 2) + (this.uf / 2);
            var e = (c.height / 2) + (this.uf / 2);
            var f = d;
            var g = d;
            var h = e;
            var i = e;
            if (a == 2 || a == 4) {
                f = 0;
            }
            if (a == 2 || a == 3) {
                g = 0;
            }
            if (b == 2 || b == 3) {
                h = 0;
            }
            if (b == 2 || b == 4) {
                i = 0;
            }
            return new Thickness(1, f, h, g, i);
        }
        return new Thickness(1, 0, 0, 0, 0);
    };
    ScatterBase.prototype.vn = function (a, b, c) {
        var d = new HighlightingInfo();
        d.b = this;
        d.h = 0;
        d.g = this.c6.count - 1;
        d.d = true;
        if (c != null && c.h == d.h && c.g == d.g) {
            return c;
        }
        return d;
    };
    ScatterBase.prototype.ax = function (a, b, c) {
        if (this.du && this.fc(this.bs) && !c) {
            var d = this.vo(a, b, this.vq);
            this.vq = d;
            return d;
        }
        else {
            var e = this.vn(a, b, this.vq);
            this.vq = e;
            return e;
        }
    };
    ScatterBase.prototype.ay = function (a, b, c) {
        if (this.fc(this.bs) && !c) {
            var d = this.vp(a, b, this.vr);
            this.vr = d;
            return d;
        }
        else {
            var e = this.vn(a, b, this.vr);
            e.e = true;
            this.vr = e;
            return e;
        }
    };
    ScatterBase.prototype.wo = function () {
        return (this.assigningScatterStyle != null && this.we) || (this.bs != 1);
    };
    ScatterBase.prototype.wn = function () {
        return (this.assigningScatterMarkerStyle != null && this.wd) || (this.bs != 1);
    };
    ScatterBase.prototype.yh = function (a, b) {
        var _this = this;
        this.ow();
        var c = b.bx;
        this.vu = ((function () {
            var $ret = new ScatterAxisInfoCache();
            $ret.a = _this.xAxis;
            $ret.b = _this.yAxis;
            $ret.d = _this.xAxis.ch;
            $ret.e = _this.yAxis.ch;
            return $ret;
        })());
        if (this.uc()) {
            b.cy.j(a.j, this.ue);
            if (this.wn()) {
                this.xx(b, a);
            }
        }
        b.cp();
        var d = ((function () {
            var $ret = new Clipper(1, NaN, c.bottom, NaN, c.top, false);
            $ret.i = b.c0.g$j.an;
            return $ret;
        })());
        b.c0.g$h(a.n, d);
        this.ye(a, b);
    };
    ScatterBase.prototype.vi = function (a, b) {
        return this.vj(a, b);
    };
    ScatterBase.prototype.vj = function (a, b) {
        if (b < a || a < 0 || a > this.wa.count || b < 0 || b > this.wa.count) {
            return null;
        }
        var c = new Array((b - a) + 1);
        for (var d = a; d <= b; d++) {
            var e = d;
            c[d - a] = this.c6.item(d);
        }
        return c;
    };
    ScatterBase.prototype.xx = function (a, b) {
        var _this = this;
        a.b6 = true;
        this.v7.ay(this, this.wn(), runOn(this, this.vi));
        var c = this.v7.d;
        var d = c != null;
        var e = this.getEffectiveViewport1(a);
        var f = this.c6 == null ? 0 : this.c6.count;
        this.vv.ci(function (g) {
            if (g._visibility == 0) {
                var h = g.ak;
                var i = g.content;
                if (i == null) {
                    i = new DataContext();
                    g.content = i;
                }
                if (d) {
                    _this.x1(h, f, a.q);
                }
                _this.v7.ac(g, i);
            }
        });
    };
    ScatterBase.prototype.x2 = function (a, b, c) {
        var d = this.bs != 1;
        this.v7.a0(this.v7.b, a, b, false);
        this.v7.ab(this.hh);
        var e = this.v7.ax;
        var f = null;
        var g = this.c6;
        if (d && this.cy != null) {
            f = this.cy.a7.getHighlightingInfo(this, g, e.o, e.n, false);
            e.b = f;
        }
        e.f = c;
        this.yc(e);
        this.v7.z(this, f, c, d, a < 0);
    };
    ScatterBase.prototype.x1 = function (a, b, c) {
        var d = this.bs != 1;
        this.v7.a0(this.v7.d, a, b, true);
        this.v7.aa(this.hh);
        var e = this.v7.aw;
        var f = null;
        var g = this.c6;
        var h = null;
        if (d && this.cy != null) {
            f = this.cy.a7.getHighlightingInfo(this, g, e.o, e.n, true);
            if (this.cy.a7.isCrossSeriesHighlight(this)) {
                h = this.cy.a7.getHighlightingInfo(this, g, e.o, e.n, true);
            }
            e.b = f;
        }
        e.f = c;
        this.yb(e);
        this.v7.y(this, f, c, d, e.m, this.cy.a7.totalHighlightingProgress);
    };
    ScatterBase.prototype.yc = function (a) {
        if (this.assigningScatterStyle != null && this.we) {
            this.assigningScatterStyle(this, a);
        }
    };
    ScatterBase.prototype.yb = function (a) {
        if (this.assigningScatterMarkerStyle != null && this.wd) {
            this.assigningScatterMarkerStyle(this, a);
        }
    };
    ScatterBase.prototype.x4 = function (a, b) {
        var e_3, _a;
        var c = new ErrorBarsHelper(this, b);
        if (this.vw == null) {
            return;
        }
        var d = this.vw.u;
        var e = this.vw.v;
        var f = 0;
        var g = 0;
        var h = 0;
        var i = 0;
        try {
            for (var _b = __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.x7(k, c, d, h, i, true);
                            h = l.p3;
                            i = l.p4;
                            break;
                        case 0:
                            var m = this.x5(k, c, d, h, i, true);
                            h = m.p3;
                            i = m.p4;
                            break;
                        case 2:
                            var n = this.x3(k, c, d, j, h, i, true);
                            h = n.p4;
                            i = n.p5;
                            break;
                        case 3:
                            var o = this.x8(c, d, f, h, i, true);
                            f = o.p2;
                            h = o.p3;
                            i = o.p4;
                            break;
                        case 4:
                            var p = this.x5(k, c, d, h, i, true);
                            h = p.p3;
                            i = p.p4;
                            break;
                    }
                    ;
                    var q = new OwnedPoint();
                    q.c = c.l(d, this.vu.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.x7(k, c, e, h, i, false);
                            h = r.p3;
                            i = r.p4;
                            break;
                        case 0:
                            var s = this.x5(k, c, e, h, i, false);
                            h = s.p3;
                            i = s.p4;
                            break;
                        case 2:
                            var t = this.x3(k, c, e, j, h, i, false);
                            h = t.p4;
                            i = t.p5;
                            break;
                        case 3:
                            var u = this.x8(c, e, g, h, i, false);
                            g = u.p2;
                            h = u.p3;
                            i = u.p4;
                            break;
                        case 4:
                            var v = this.x5(k, c, e, h, i, false);
                            h = v.p3;
                            i = v.p4;
                            break;
                    }
                    ;
                    var w = new OwnedPoint();
                    w.c = c.m(e, this.vu.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.x7 = function (a, b, c, d, e, f) {
        if (f) {
            var g = void 0;
            var h = void 0, i = void 0;
            i = this.vu.a;
            if (this.vw.s == 0) {
                g = a.c.x;
                h = this.vu.a;
            }
            else {
                g = a.c.y;
                h = this.vu.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.vu.b;
            if (this.vw.t == 0) {
                k = a.c.x;
                l = this.vu.a;
            }
            else {
                k = a.c.y;
                l = this.vu.b;
            }
            var n = b.f(k, c, l, m, d, e);
            d = n.p4;
            e = n.p5;
        }
        return {
            p3: d,
            p4: e
        };
    };
    ScatterBase.prototype.x5 = function (a, b, c, d, e, f) {
        if (f) {
            var g = b.j(a.c.x, c, this.vu.a, d, e);
            d = g.p3;
            e = g.p4;
        }
        else {
            var h = b.j(a.c.y, c, this.vu.b, d, e);
            d = h.p3;
            e = h.p4;
        }
        return {
            p3: d,
            p4: e
        };
    };
    ScatterBase.prototype.x3 = function (a, b, c, d, e, f, g) {
        var h = c.getItemColumn();
        var i = this.c6.indexOf(d);
        if (h != null && i < h.count) {
            var j = h.item(i);
            if (g) {
                var k = b.h(a.c.x, j, this.vu.a, e, f);
                e = k.p3;
                f = k.p4;
            }
            else {
                var l = b.h(a.c.y, j, this.vu.b, e, f);
                e = l.p3;
                f = l.p4;
            }
        }
        else {
            e = NaN;
            f = NaN;
        }
        return {
            p4: e,
            p5: f
        };
    };
    ScatterBase.prototype.x8 = 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.vu.a, d, e);
            d = h.p3;
            e = h.p4;
        }
        else {
            var i = a.k(c, b, this.vu.b, d, e);
            d = i.p3;
            e = i.p4;
        }
        return {
            p2: c,
            p3: d,
            p4: e
        };
    };
    ScatterBase.prototype.ye = function (a, b) {
        if (!b.o() || this.vw == null) {
            b.c9();
            return;
        }
        this.yf(a, b);
        this.yg(a, b);
    };
    ScatterBase.prototype.yf = function (a, b) {
        var e_4, _a;
        b.c5();
        var c = new ErrorBarsHelper(this, b);
        var d = new PathGeometry();
        var e = this.vw.u;
        try {
            for (var _b = __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.vw.o == 1 || this.vw.o == 2) {
                            c.d(d, i, g, true);
                        }
                        if (this.vw.o == 1 || this.vw.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.da(d);
    };
    ScatterBase.prototype.yg = function (a, b) {
        var e_5, _a;
        b.c6();
        var c = new ErrorBarsHelper(this, b);
        var d = new PathGeometry();
        var e = this.vw.v;
        try {
            for (var _b = __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.vw.p == 1 || this.vw.p == 2) {
                            c.e(d, i, g, true);
                        }
                        if (this.vw.p == 1 || this.vw.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.gl = function (a, b, c) {
        var d = true;
        if (!_super.prototype.gl.call(this, a, b, c) || b.isEmpty || a.isEmpty || this.xAxis == null || this.yAxis == null || this.xAxis.bi == null || this.yAxis.bi == null || this.wa == null || this.wb == null || this.wa.count == 0 || this.wb.count == 0 || this.c6 == null || this.c6.count != this.wa.count || this.c6.count != this.wb.count || this.xAxis.bi == null || this.yAxis.bi == null || this.xAxis.lx == this.xAxis.lw || this.yAxis.lx == this.yAxis.lw) {
            d = false;
        }
        return d;
    };
    ScatterBase.prototype.getViewInfo = function (a, b) {
        if (!this.zc.isEmpty && !this.zd.isEmpty) {
            a = this.zc;
            b = this.zd;
            return {
                p0: a,
                p1: b
            };
        }
        a = this.cj.bx;
        b = this.cj.by;
        return {
            p0: a,
            p1: b
        };
    };
    ScatterBase.prototype.pq = function (a) {
        _super.prototype.pq.call(this, a);
        this.xv();
        try {
            if (this.dl(this.cj)) {
                return;
            }
            if (this.c6 != null && this.c6.count > this.w1) {
                a = false;
            }
            if (this.fp(a) && !this.f0) {
                var b = this.v0;
                if (this.dj()) {
                    if (this.cz.g) {
                        this.cz.t();
                    }
                    this.v0 = this.v2;
                    this.v2 = b;
                }
                else {
                    this.v0 = this.vy;
                    this.vy = b;
                }
                this.x6(this.vy, this.vv);
                this.p3();
            }
            else {
                if (!this.f0) {
                    this.x6(this.vy, this.vv);
                }
                this.yh(this.vy, this.vv);
            }
        }
        finally {
            this.yi();
        }
    };
    ScatterBase.prototype.qd = function () {
        _super.prototype.qd.call(this);
        if (this.index < 0) {
            return;
        }
        this.vv.dd();
    };
    ScatterBase.prototype.pr = function (a, b) {
        _super.prototype.pr.call(this, a, b);
        if (!this.f8) {
            this.cj.a4(b);
            return;
        }
        this.cj.a4(b);
        if (this.dl(this.ci)) {
            return;
        }
        var c = typeCast(ScatterBaseView.$, this.ci);
        if (!this.f1) {
            this.v1 = new ScatterFrame();
            this.x6(this.v1, c);
        }
        this.f1 = false;
        this.yh(this.v1, c);
        this.f8 = false;
    };
    ScatterBase.prototype.po = function (a, b, c, d, e) {
        _super.prototype.po.call(this, a, b, c, d, e);
        var f = this.a7.a$h.item(d);
        var g = f;
        f.a3(c);
        if (this.dl(g)) {
            return;
        }
        if (this.vx == null) {
            this.vx = new ScatterFrame();
        }
        this.x6(this.vx, g);
        this.yh(this.vx, g);
    };
    ScatterBase.prototype.yd = function (a, b) {
        var e_6, _a, e_7, _b;
        var c = new List$1(Base.$, 0);
        try {
            for (var _c = __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 = __values(fromEnum(c)), _f = _e.next(); !_f.done; _f = _e.next()) {
                var e = _f.value;
                b.h(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.vh = function (a, b, c, d, e) {
        var _this = this;
        if (c == null || c.length != this.vu.c.count) {
            c = new Array(this.vu.c.count);
            for (var f = 0; f < this.vu.c.count; f++) {
                c[f] = PointUtil.create();
            }
        }
        var g = this.getEffectiveViewport1(a);
        var h = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.xAxis.ch, g);
            $ret.c = _this.getEffectiveViewport1(a);
            return $ret;
        })());
        var i = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.yAxis.ch, g);
            $ret.c = _this.getEffectiveViewport1(a);
            $ret.b = _this.h2();
            return $ret;
        })());
        var j = this.to(a);
        var k = this.vu.a.em(j.left, h);
        var l = this.vu.a.em(j.right, h);
        var m = this.vu.b.em(j.bottom, i);
        var n = this.vu.b.em(j.top, i);
        if (this.vu.d) {
            var o = k;
            k = l;
            l = o;
        }
        if (this.vu.e) {
            var p = m;
            m = n;
            n = p;
        }
        var q = this.vu;
        var r = q.a;
        var s = q.b;
        var t;
        var u;
        var v = this.wa;
        var w = this.wb;
        var x = false;
        var y = 0;
        var z = 0;
        if (this.cy != null) {
            if (this.cy.fb()) {
                var aa = this.cy.lo(d, h);
                x = aa.c;
                y = aa.d;
                z = r.em(0 + y, h);
                var ab = r.em(0, h);
                z -= ab;
            }
        }
        for (var ac = 0; ac < this.vu.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.ej(t, h);
                    c[ac].y = s.ej(u, i);
                }
                else {
                    if ((t + z) >= k && (t + z) <= l && u >= m && u <= n) {
                        c[ac].x = r.ej(t, h) + y;
                        c[ac].y = s.ej(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.ej(t, h);
                    c[ac].y = s.ej(u, i);
                }
                else {
                    c[ac].x = NaN;
                    c[ac].y = NaN;
                }
            }
        }
        return c;
    };
    ScatterBase.prototype.wq = 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.c6;
        try {
            for (var _b = __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.n1 = function (a) {
        _super.prototype.n1.call(this, a);
        this.a9.exportTrendlineData(this, a, this.vv.c0.g$j);
    };
    ScatterBase.prototype.h2 = function () {
        return Series.h3(this.wb, null);
    };
    ScatterBase.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = { $type: Point_$type, x: a, y: b };
        var d = this.jr(c);
        var e = d == null ? NaN : this.h1(d, "XMemberPath");
        var f = d == null ? NaN : this.h1(d, "YMemberPath");
        var g = new DataLegendSeriesValueInfo();
        g.l = e;
        g.a = 13;
        g.p = "X";
        g.q = this.xl != null ? this.xl : "X";
        g.r = this.xh != null ? this.xh : "X:";
        g.s = this.xj != null ? this.xj : "";
        var h = new DataLegendSeriesValueInfo();
        h.l = f;
        h.a = 14;
        h.p = "Y";
        h.q = this.xt != null ? this.xt : "Y";
        h.r = this.xp != null ? this.xp : "Y:";
        h.s = this.xr != null ? this.xr : "";
        var i = new DataLegendSeriesContext();
        i.f = ((function () {
            var $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
            $ret.add(g);
            $ret.add(h);
            return $ret;
        })());
        i.b = this.aw();
        return i;
    };
    ScatterBase.prototype.yj = function () {
        if (this.wc) {
            this.wr = 0;
            this.ws = 0;
            for (var a = 0; a < this.wa.count; a++) {
                this.wr += this.wa.item(a);
                this.ws += this.wb.item(a);
            }
            this.wt = this.wr / this.wa.count;
            this.wu = this.ws / this.wb.count;
            this.wc = false;
        }
    };
    ScatterBase.prototype.ic = function (a, b) {
        if (b == null || !b.cj) {
            return NaN;
        }
        if (b != this.xAxis && b != this.yAxis) {
            return NaN;
        }
        var c = this.am(a);
        if (b.cp) {
            return c[1];
        }
        else {
            return c[0];
        }
    };
    ScatterBase.prototype.am = function (a) {
        var b = NaN;
        var c = NaN;
        switch (a) {
            case 5:
            case 2:
                b = this.wa.maximum;
                c = this.wb.maximum;
                break;
            case 4:
            case 1:
                b = this.wa.minimum;
                c = this.wb.minimum;
                break;
            case 6:
            case 3:
                if (this.wc) {
                    this.yj();
                }
                b = this.wt;
                c = this.wu;
                break;
        }
        return [b, c];
    };
    ScatterBase.prototype.tl = function (a) {
        var b = this.getEffectiveViewport1(this.cj);
        var c = new ScalerParams(0, this.cj.by, this.cj.bx, this.xAxis.ch, b);
        c.c = b;
        var d = isNaN_(a[0]) ? NaN : this.xAxis.ej(a[0], c);
        c = new ScalerParams(0, this.cj.by, this.cj.bx, this.yAxis.ch, b);
        c.b = this.h2();
        c.c = b;
        var e = isNaN_(a[1]) ? NaN : this.yAxis.ej(a[1], c);
        return { $type: Point_$type, x: d, y: e };
    };
    ScatterBase.prototype.tk = function (a) {
        var b = this.am(a);
        return this.tl(b);
    };
    ScatterBase.$t = markType(ScatterBase, 'ScatterBase', MarkerSeries.$, [ISupportsErrorBars_$type, ITrendLineSeries_$type]);
    ScatterBase.yk = 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:vw:yl', [ScatterErrorBarSettings.$, null], 'HighlightedXMemberPath:w5:ym', [2, null], 'HighlightedYMemberPath:w7:yn', [2, null], 'IsCustomScatterMarkerStyleAllowed:wh:yo', [0, false], 'IsCustomScatterStyleAllowed:wi:yp', [0, false], 'ItemSearchMode:v6:yq', [ScatterItemSearchMode_$type, enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:w0:yr', [1, 10000], 'MarkerCollisionAvoidance:vm:ys', [CollisionAvoidanceType_$type, enumGetBox(CollisionAvoidanceType_$type, 0)], 'MaximumMarkers:w1:yt', [1, 400], 'XAxis::y1', [NumericXAxis.$, null], 'XMemberAsLegendLabel:xh:y2', [2, null], 'XMemberAsLegendUnit:xj:y3', [2, null], 'XMemberPath:xl:y4', [2, null], 'YAxis::y5', [NumericYAxis.$, null], 'YMemberAsLegendLabel:xp:y6', [2, null], 'YMemberAsLegendUnit:xr:y7', [2, null], 'YMemberPath:xt:y8', [2, null], 'TrendLineType::yz', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::yy', [1, 1.5], 'TrendLinePeriod::yx', [1, 7], 'TrendLineBrush::yu', [Brush.$, null], 'TrendLineZIndex:w2:y0', [1, 1001], 'TrendLineDashArray:za:yv', [DoubleCollection.$], 'TrendLineDashCap:zb:yw', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
    return ScatterBase;
}(MarkerSeries));
export { ScatterBase };
/**
 * @hidden
 */
var ScatterSeriesRenderManager = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ScatterSeriesRenderManager, _super);
    function ScatterSeriesRenderManager() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.aw = null;
        _this.ax = null;
        return _this;
    }
    ScatterSeriesRenderManager.prototype.c = function () {
        this.aw = new AssigningScatterMarkerStyleEventArgs();
        return this.aw;
    };
    ScatterSeriesRenderManager.prototype.a = function () {
        this.ax = new AssigningScatterStyleEventArgs();
        return this.ax;
    };
    ScatterSeriesRenderManager.prototype.ay = function (a, b, c) {
        this.w(a, b, c);
    };
    ScatterSeriesRenderManager.prototype.az = function (a, b, c) {
        this.x(a, b, c);
    };
    ScatterSeriesRenderManager.prototype.a0 = function (a, b, c, d) {
        if (b == -1) {
            a.c = false;
            a.o = 0;
            a.n = c - 1;
        }
        else {
            if (d) {
                a.o = b;
                a.n = b;
            }
            else {
                a.c = false;
                a.o = b;
                a.n = b;
            }
        }
    };
    ScatterSeriesRenderManager.$t = markType(ScatterSeriesRenderManager, 'ScatterSeriesRenderManager', SeriesRenderManager.$);
    return ScatterSeriesRenderManager;
}(SeriesRenderManager));
export { ScatterSeriesRenderManager };
/**
 * @hidden
 */
var ScatterBaseView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ScatterBaseView, _super);
    function ScatterBaseView(a) {
        var _this = _super.call(this, a) || this;
        _this.cy = null;
        _this.cw = null;
        _this.cz = null;
        _this.c4 = null;
        _this.df = null;
        _this.dg = null;
        _this.c0 = null;
        _this.de = null;
        _this.c1 = null;
        _this.cz = a;
        _this.c1 = new HashPool$2(Base.$, Marker.$);
        _this.ck(_this.c1);
        _this.c0 = new ScatterTrendLineManager();
        return _this;
    }
    ScatterBaseView.prototype.au = function () {
        _super.prototype.au.call(this);
        this.cy = this.cx();
        this.df = new Path();
        this.dg = new Path();
        if (!this.q) {
            this.cz.w1 = 2000;
        }
    };
    ScatterBaseView.prototype.dh = function (a) {
        if (this.de == null) {
            this.de = new DataTemplateMeasureInfo();
            this.de.context = this.k.h();
        }
        this.de.width = a.width;
        this.de.height = a.height;
        this.de.data = a.content;
        var b = a.ah;
        if (b.measure != null) {
            b.measure(this.de);
        }
        return new Size(1, this.de.width, this.de.height);
    };
    ScatterBaseView.prototype.cx = function () {
        var _this = this;
        var a = new NumericMarkerManager(1, function (b) { return _this.c1.item(b); }, function (b) { return _this.cz.vu.c.item(b); }, runOn(this, this.dc), runOn(this, this.cu), runOn(this, this.c2), function () { return _this.cz.vm; });
        a.q = runOn(this, this.dh);
        return a;
    };
    ScatterBaseView.prototype.dc = function (a) {
        this.cz.yd(a, this.c1);
    };
    ScatterBaseView.prototype.c3 = function () {
        return this.b7;
    };
    ScatterBaseView.prototype.cv = function () {
        return this.cw;
    };
    ScatterBaseView.prototype.cu = function () {
        this.cw = this.cz.vh(this, this.c1, this.cw, this.by, this.bx);
        return this.cw;
    };
    ScatterBaseView.prototype.c2 = function () {
        this.c4 = this.cz.wq(this.c1, this.c4);
        return this.c4;
    };
    ScatterBaseView.prototype.c5 = function () {
    };
    ScatterBaseView.prototype.da = function (a) {
    };
    ScatterBaseView.prototype.c6 = function () {
    };
    ScatterBaseView.prototype.db = function (a) {
    };
    ScatterBaseView.prototype.dd = function () {
        if (this.cz.trendLineBrush != null) {
            this.cz.y9 = this.cz.trendLineBrush;
        }
        else {
            this.cz.y9 = this.cz.ss;
        }
    };
    ScatterBaseView.prototype.ci = function (a) {
        this.c1.f(a);
    };
    ScatterBaseView.prototype.c8 = function (a) {
        this.c1.g(a);
    };
    ScatterBaseView.prototype.c9 = function () {
    };
    ScatterBaseView.prototype.a7 = function (a, b) {
        _super.prototype.a7.call(this, a, b);
        if (a.d) {
            if (this.cz.trendLineType != 0 && !b) {
                var c = this.c0.g$j;
                c.ad = this.cz.trendLineThickness;
                c._stroke = this.cz.y9;
                c.ai = this.cz.za;
                c.aj = this.cz.zb;
                a.v(c);
            }
        }
    };
    ScatterBaseView.prototype.c7 = function (a) {
        if (a) {
            this.c9();
            this.c1.clear();
        }
        this.c0.g$d();
        this.as();
    };
    ScatterBaseView.prototype.getDefaultTooltipTemplate = function () {
        var a = "<div class='ui-chart-default-tooltip-content'><span";
        var b = this.e.a7.a$r(this.e);
        if (!stringIsNullOrEmpty(b)) {
            a += " style='color:" + b + "'";
        }
        a += ">" + this.cz.title + "</span><br/><span>" + "x: </span><span class='ui-priority-primary'>${item." + this.cz.xl + "}</span><br/><span>" + "y: </span><span class='ui-priority-primary'>${item." + this.cz.xt + "}</span></div>";
        return a;
    };
    ScatterBaseView.$t = markType(ScatterBaseView, 'ScatterBaseView', MarkerSeriesView.$);
    return ScatterBaseView;
}(MarkerSeriesView));
export { ScatterBaseView };
