/*
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 { 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 "igniteui-react-core";
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
 */
export let ScatterBase = /*@__PURE__*/ (() => {
    class ScatterBase extends MarkerSeries {
        cd() {
            return new ScatterBaseView(this);
        }
        nh() {
            super.nh();
            this.xAxis = null;
            this.yAxis = null;
        }
        o2(a) {
            super.o2(a);
            this.vs = a;
        }
        get_fa() {
            return true;
        }
        ag() {
            return [this.xAxis, this.yAxis];
        }
        jv(a, b) {
            let c = this.lw(b);
            if (c == ScatterBase.$$p[12]) {
                return this.jw(a, b, this.xn);
            }
            if (c == ScatterBase.$$p[16]) {
                return this.jw(a, b, this.xv);
            }
            return null;
        }
        dt(a, b, c, d) {
            if (!this.hasMarkers) {
                return false;
            }
            let e = this.xAxis;
            let f = new ScalerParams(1, this.cv.tr, this.ty, e.ch);
            f.c = this.getEffectiveViewport1(this.cg);
            let g = this.yAxis;
            let h = new ScalerParams(1, this.cv.tr, this.ty, g.ch);
            h.c = this.getEffectiveViewport1(this.cg);
            a.clear();
            this.ub.ci((i) => {
                if (i._visibility == 0) {
                    let j = new SeriesPointOfInterest();
                    let k = i.n;
                    let l = i.o;
                    if (k < this.ty.left || k > this.ty.right || l < this.ty.top || l > this.ty.bottom) {
                        return;
                    }
                    j.b = e.em(k, f);
                    j.c = g.em(l, h);
                    j.a = i.content;
                    a.add(j);
                }
            });
            return true;
        }
        bu() {
            if (this.bv == 0) {
                if (this.w3 <= 2000) {
                    return 1;
                }
                else {
                    return super.bu();
                }
            }
            else {
                return super.bu();
            }
        }
        tw(a) {
            if (!this.hasMarkers || !this.ue()) {
                return Rect.empty;
            }
            let b = this.ub.b1(this.te(a));
            if (b != null) {
                return this.ub.cs(b);
            }
            return Rect.empty;
        }
        f5(a, b) {
            if (this.uf(a, b)) {
                return true;
            }
            return false;
        }
        constructor() {
            super();
            this.vr = null;
            this.wa = null;
            this.wb = null;
            this.ze = null;
            this.zf = null;
            this.v0 = 1;
            this.vh = null;
            this.vi = null;
            this.vx = null;
            this.vz = null;
            this.vv = null;
            this.wg = false;
            this.wf = false;
            this.v8 = null;
            this.v9 = null;
            this.assigningScatterStyle = null;
            this.assigningScatterMarkerStyle = null;
            this.v4 = null;
            this.vy = null;
            this.vu = null;
            this.we = true;
            this.wt = 0;
            this.wu = 0;
            this.wv = 0;
            this.ww = 0;
            this.v1 = this.v2();
            this.v4 = new ScatterSeriesRenderManager();
            this.vy = new ScatterFrame();
            this.zf = Rect.empty;
            this.ze = Rect.empty;
        }
        get wc() {
            return this.wa;
        }
        set wc(a) {
            if (this.wa != a) {
                let b = this.wc;
                this.wa = a;
                this.raisePropertyChanged("XColumn", b, this.wc);
            }
        }
        get wd() {
            return this.wb;
        }
        set wd(a) {
            if (this.wb != a) {
                let b = this.wd;
                this.wb = a;
                this.raisePropertyChanged("YColumn", b, this.wd);
            }
        }
        fo() {
            return this.highlightedItemsSource != null || (this.w7 != null && this.w9 != null);
        }
        wr() {
            return false;
        }
        g1() {
            let a = super.g1();
            {
                let b = ((() => {
                    let $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.x2));
                a.add(b);
            }
            {
                let c = ((() => {
                    let $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.x1));
                a.add(c);
            }
            if (this.wr()) {
                let d = ((() => {
                    let $ret = new SeriesLayerPropertyOverlay();
                    $ret.r = true;
                    $ret.ad = "DashArray";
                    $ret.p = true;
                    $ret.x = ((() => {
                        let $ret = new DoubleCollection();
                        $ret.add(5);
                        $ret.add(5);
                        return $ret;
                    })());
                    $ret.q = true;
                    return $ret;
                })());
                a.add(d);
            }
            if (!this.wr()) {
                let e = ((() => {
                    let $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.pz));
                a.add(e);
            }
            if (!this.wr()) {
                let f = ((() => {
                    let $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.pz));
                a.add(f);
            }
            return a;
        }
        x1(a, b) {
            if (this.w7 != null) {
                b.value = this.w7;
                return;
            }
            b.value = this.xn;
        }
        x2(a, b) {
            if (this.w9 != null) {
                b.value = this.w9;
                return;
            }
            b.value = this.xv;
        }
        get zb() {
            return this.c(ScatterBase.ym);
        }
        set zb(a) {
            this.h(ScatterBase.ym, a);
        }
        get GetErrorBarsXAxis() {
            return this.xAxis;
        }
        get GetErrorBarsYAxis() {
            return this.yAxis;
        }
        oc() {
            super.oc();
            if (this.xAxis != null) {
                this.xAxis.h8(false);
            }
            if (this.yAxis != null) {
                this.yAxis.h8(false);
            }
        }
        pa(a, b, c, d) {
            super.pa(a, b, c, d);
            if (this.vs.c0.g$b(a, b, c, d)) {
                this.pr(false);
                this.om();
            }
            switch (b) {
                case "FastItemsSource":
                    if (typeCast(IFastItemsSource_$type, c) != null) {
                        c.deregisterColumn(this.wc);
                        c.deregisterColumn(this.wd);
                        this.wc = null;
                        this.wd = null;
                    }
                    if (typeCast(IFastItemsSource_$type, d) != null) {
                        this.wc = this.c4(this.xn);
                        this.wd = this.c4(this.xv);
                    }
                    if ((this.yAxis != null && !this.yAxis.c1()) || (this.xAxis != null && !this.xAxis.c1())) {
                        this.pr(this.fr && 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.pr(false);
                    }
                    this.om();
                    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.pr(false);
                    }
                    this.om();
                    break;
                case ScatterBase.$$p[12]:
                    if (this.c7 != null) {
                        this.c7.deregisterColumn(this.wc);
                        this.wc = this.c4(this.xn);
                    }
                    break;
                case "XColumn":
                    this.vs.c0.g$i();
                    if (this.xAxis != null && !this.xAxis.c1()) {
                        this.pr(this.fr && this.dp);
                    }
                    break;
                case ScatterBase.$$p[16]:
                    if (this.c7 != null) {
                        this.c7.deregisterColumn(this.wd);
                        this.wd = this.c4(this.xv);
                    }
                    break;
                case "YColumn":
                    this.vs.c0.g$i();
                    if (this.yAxis != null && !this.yAxis.c1()) {
                        this.pr(this.fr && this.dp);
                    }
                    break;
                case ScatterBase.$$p[7]:
                    this.pr(false);
                    this.om();
                    break;
                case ScatterBase.$$p[8]:
                    this.pr(false);
                    this.om();
                    break;
                case "TransitionProgress":
                    this.vz.c(this.iw, this.vx, this.vv);
                    this.xx();
                    try {
                        if (this.dm(this.cg)) {
                            return;
                        }
                        if ((Math.round(this.iw * 100000) / 100000) == 1) {
                            this.yj(this.vv, this.vs);
                        }
                        else {
                            this.yj(this.vz, this.vs);
                        }
                        if (this.cv != null) {
                            this.cv.or(this);
                        }
                    }
                    finally {
                        this.yk();
                    }
                    break;
                case "TrendLineBrush":
                    this.pg(b);
                    break;
                case ScatterBase.$$p[0]:
                    if (this.vt != null) {
                        this.vt.r = this;
                    }
                    this.pr(false);
                    this.om();
                    break;
                case "TrendLineType":
                    this.om();
                    break;
                case ScatterBase.$$p[4]:
                    this.wg = this.wo();
                    this.pr(false);
                    break;
                case ScatterBase.$$p[3]:
                    this.wf = this.wn();
                    this.pr(false);
                    break;
                case ScatterBase.$$p[5]:
                    this.v1 = this.v2();
                    break;
            }
        }
        wo() {
            return this.wk;
        }
        wn() {
            return this.wj;
        }
        wi(a) {
            if (typeCast(NumericYAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        wh(a) {
            if (typeCast(NumericXAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        yk() {
            this.ze = Rect.empty;
            this.zf = Rect.empty;
        }
        xx() {
            let a = this.getViewInfo(this.ze, this.zf);
            this.ze = a.p0;
            this.zf = a.p1;
        }
        wm(a, b) {
            if (b != 3) {
                return true;
            }
            if (a == null) {
                return true;
            }
            if (this.xn == a || this.xv == a) {
                return true;
            }
            return false;
        }
        np(a, b, c, d) {
            let e = false;
            if (!this.wm(d, a)) {
                return;
            }
            this.vs.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.we = true;
            }
            else if (a == 1) {
                for (let f = b; f < b + c; f++) {
                    this.wt += this.wc.item(f);
                    this.wu += this.wd.item(f);
                }
                this.wv = this.wt / this.wc.count;
                this.ww = this.wu / this.wd.count;
            }
            if (e) {
                this.pr(true);
            }
        }
        yb(a) {
            this.yc(a, null);
        }
        yc(a, b) {
            let c = this.wc != null ? this.wc.count : 0;
            let d = this.wd != null ? this.wd.count : 0;
            let e = Math.min(c, d);
            if (e <= this.w3) {
                a.m.clear();
                let f = new List$1(OwnedPoint.$, 0);
                for (let g of fromEnum(a.u.values)) {
                    f.add(g);
                }
                let h = this.c7;
                f.aa((i, j) => {
                    let k = h.indexOf(i.a);
                    let l = h.indexOf(j.a);
                    if (k < l) {
                        return -1;
                    }
                    if (k > l) {
                        return 1;
                    }
                    return 0;
                });
                if (b != null) {
                    b.i = a.m;
                }
                for (let i of fromEnum(f)) {
                    if (h.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 });
                        }
                    }
                }
            }
        }
        aq(a) {
            if (a != null && a == this.xAxis && this.wc != null) {
                return new AxisRange(this.wc.minimum, this.wc.maximum);
            }
            if (a != null && a == this.yAxis && this.wd != null) {
                return new AxisRange(this.wd.minimum, this.wd.maximum);
            }
            return null;
        }
        js(a) {
            let b = this.i9(a);
            if (this.c7 != null && b >= 0 && b < this.c7.count) {
                return this.c7.item(b);
            }
            return null;
        }
        get v1() {
            return this.v0;
        }
        set v1(a) {
            let b = this.v0;
            this.v0 = a;
            if (b != this.v0) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.v0));
            }
        }
        v2() {
            if (this.v3 != 0) {
                return this.v3;
            }
            return this.wl ? 4 : 1;
        }
        i9(a) {
            let b = truncate(Math.round(this.hw(a)));
            return b;
        }
        hw(a) {
            switch (this.v1) {
                case 1: return this.wz(a);
                case 3: return this.w0(a);
                case 2: return this.wx(a);
                case 4: return this.wy(a);
            }
            return -1;
        }
        wy(a) {
            return this.w1(a, false);
        }
        wx(a) {
            let b = this.te(a);
            let c = b.x;
            let d = b.y;
            if (this.c7 == null || this.xAxis == null || this.yAxis == null || this.wc == null || this.wd == null) {
                return -1;
            }
            if (this.c7.count > this.w2) {
                return -1;
            }
            this.x0();
            let e = this.vh;
            let f = this.vi;
            if (e == null || f == null) {
                return -1;
            }
            let g = 1.7976931348623157E+308;
            let h = -1;
            for (let i = 0; i < this.wc.count; i++) {
                let j = e[i];
                let k = f[i];
                let l = (c - j) * (c - j) + (d - k) * (d - k);
                if (l < g) {
                    g = l;
                    h = i;
                }
            }
            return h;
        }
        x0() {
            let a = this.cg.by;
            let b = this.cg.bx;
            let c = this.getEffectiveViewport();
            if (this.vr == null) {
                return;
            }
            let d = new ScalerParams(0, a, b, this.vr.d, c);
            let e = ((() => {
                let $ret = new ScalerParams(0, a, b, this.vr.e, c);
                $ret.b = this.h3();
                return $ret;
            })());
            if (this.vh == null || this.vi == null) {
                let f = arrayShallowClone(this.wc.asArray());
                let g = arrayShallowClone(this.wd.asArray());
                this.xAxis.hn(boxArray$1(f), 0, f.length, d);
                this.yAxis.hn(boxArray$1(g), 0, g.length, e);
                this.vh = f;
                this.vi = g;
            }
        }
        get_wl() {
            return false;
        }
        get wl() {
            return this.get_wl();
        }
        w1(a, b) {
            if (!this.wl) {
                return -1;
            }
            let c = { $type: Point_$type, x: 0, y: 0 };
            let d = true;
            let e = this.vw();
            if (e == null) {
                return -1;
            }
            if (e.m == null) {
                return -1;
            }
            if (this.c7 == null || this.c7.count > this.w2) {
                return -1;
            }
            this.x0();
            let f = this.vh;
            let g = this.vi;
            if (f == null || g == null) {
                return -1;
            }
            let h = this.te(a);
            let i = 1.7976931348623157E+308;
            let j = -1;
            for (let k = 0; k < this.vh.length; k++) {
                let l = { $type: Point_$type, x: this.vh[k], y: this.vi[k] };
                if (k > 0) {
                    if (!b || e.j.containsKey(this.c7.item(k)) || e.j.containsKey(this.c7.item(k - 1))) {
                        let m = GeometryUtil.d(h, c, l);
                        if (m < i) {
                            i = m;
                            j = k;
                        }
                    }
                }
                c = l;
            }
            if (j >= 0) {
                let n = { $type: Point_$type, x: this.vh[j], y: this.vi[j] };
                let o = { $type: Point_$type, x: this.vh[j - 1], y: this.vi[j - 1] };
                if (!b || (e.j.containsKey(this.c7.item(j)) && e.j.containsKey(this.c7.item(j - 1)))) {
                    let p = GeometryUtil.i(h, o, n);
                    return (j - 1) + p;
                }
                else if (e.j.containsKey(this.c7.item(j))) {
                    return j;
                }
                else {
                    return j - 1;
                }
            }
            return -1;
        }
        w0(a) {
            return this.w1(a, true);
        }
        wz(a) {
            let b = null;
            let c = 1.7976931348623157E+308;
            let d = this.te(a);
            let e = d.x;
            let f = d.y;
            if (this.vs.c1.e > this.w2) {
                return -1;
            }
            this.vs.c8((g) => {
                if (g._visibility == 0) {
                    let h = this.vs.cs(g);
                    let i = h.left + h.width / 2;
                    let j = h.top + h.height / 2;
                    let k = (e - i) * (e - i) + (f - j) * (f - j);
                    if (k < c) {
                        c = k;
                        b = g;
                    }
                }
            });
            if (b != null) {
                return b.ak;
            }
            return -1;
        }
        tj(a, b, c) {
            if (this.xAxis == null || this.yAxis == null || this.wc == null || this.wd == null) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            let d = this.cg.by;
            let e = this.cg.bx;
            let f = this.getEffectiveViewport();
            let g = new ScalerParams(0, d, e, this.xAxis.ch, f);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yAxis.ch, f);
                $ret.b = this.h3();
                return $ret;
            })());
            if (b) {
                let i = this.hw(a);
                if (i == -1) {
                    return { $type: Point_$type, x: NaN, y: NaN };
                }
                let j = truncate(Math.floor(i));
                let k = truncate(Math.ceil(i));
                if (j < 0) {
                    j = 0;
                }
                if (k < 0) {
                    k = 0;
                }
                if (k > this.c7.count - 1) {
                    k = this.c7.count - 1;
                }
                if (j > this.c7.count - 1) {
                    j = this.c7.count - 1;
                }
                if (k == j) {
                    let l = this.xAxis.ej(this.wc.item(j), g);
                    let m = this.yAxis.ej(this.wd.item(j), h);
                    return { $type: Point_$type, x: l, y: m };
                }
                let n = i - Math.floor(i);
                let o = this.xAxis.ej(this.wc.item(j), g);
                let p = this.yAxis.ej(this.wd.item(j), h);
                let q = this.xAxis.ej(this.wc.item(k), g);
                let r = this.yAxis.ej(this.wd.item(k), h);
                let s = q - o;
                let t = r - p;
                return { $type: Point_$type, x: o + s * n, y: p + t * n };
            }
            else {
                let u = this.i9(a);
                if (u == -1) {
                    return { $type: Point_$type, x: NaN, y: NaN };
                }
                let v = this.xAxis.ej(this.wc.item(u), g);
                let w = this.yAxis.ej(this.wd.item(u), h);
                return { $type: Point_$type, x: v, y: w };
            }
        }
        fp(a) {
            let b = this.cv != null ? this.cv.tr : Rect.empty;
            b = b.copy();
            let c = this.cv != null ? this.cv.t6 : Rect.empty;
            let d = new Rect(0, 0, 0, 1, 1);
            let e = this.ts(this.cg);
            let f = new ScalerParams(0, d, d, this.xAxis.ch, e);
            let g = ((() => {
                let $ret = new ScalerParams(0, d, d, this.yAxis.ch, e);
                $ret.b = this.h3();
                return $ret;
            })());
            let h = !b.isEmpty && !c.isEmpty && this.c7 != null ? this.c7.indexOf(a) : -1;
            let i = this.xAxis != null && this.wc != null && h < this.wc.count ? this.xAxis.ej(this.wc.item(h), f) : NaN;
            let j = this.yAxis != null && this.wd != null && h < this.wd.count ? this.yAxis.ej(this.wd.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.co != null) {
                this.co.au(this.cv, b, true);
            }
            return h >= 0;
        }
        qo(a, b) {
            this.pr(false);
        }
        qp(a, b) {
            this.pr(false);
        }
        vw() {
            let a = this.vv;
            if (this.dk()) {
                if (this.cw.g) {
                    this.cw.t();
                }
                a = this.vz;
            }
            return a;
        }
        xy(a, b, c, d, e) {
            b.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, c);
            let f = this.getEffectiveViewport1(a);
            let g = this.c7;
            let h;
            let i;
            let j = ((() => {
                let $ret = new ScalerParams(0, d, e, this.vr.d, f);
                $ret.c = this.getEffectiveViewport1(a);
                return $ret;
            })());
            let k = ((() => {
                let $ret = new ScalerParams(0, d, e, this.vr.e, f);
                $ret.c = this.getEffectiveViewport1(a);
                $ret.b = this.h3();
                return $ret;
            })());
            let l = false;
            let m = 0;
            if (this.cv != null) {
                if (this.cv.fc()) {
                    let n = this.cv.lp(d, j);
                    l = n.c;
                    m = n.d;
                }
            }
            for (let o = 0; o < c; o++) {
                h = this.wc.item(o);
                i = this.wd.item(o);
                let p = { $type: Point_$type, x: this.vr.a.ej(h, j), y: this.vr.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)) {
                    let q = g.item(o);
                    if (!b.g.containsKey(q)) {
                        let r = { $type: Point_$type, x: h, y: i };
                        let s = { $type: Point_$type, x: p.x, y: p.y };
                        b.g.addItem(q, ((() => {
                            let $ret = new OwnedPoint();
                            $ret.a = q;
                            $ret.b = r;
                            $ret.c = s;
                            return $ret;
                        })()));
                    }
                }
            }
        }
        x8(a, b) {
            this.vh = null;
            this.vi = null;
            a.j.clear();
            a.n.clear();
            a.h.clear();
            a.l.clear();
            a.i.clear();
            a.k.clear();
            let c = Math.min(this.wc != null ? this.wc.count : 0, this.wd != null ? this.wd.count : 0);
            let d = b.by;
            let e = b.bx;
            let f = this.getEffectiveViewport1(b);
            let g = new ScalerParams(0, d, e, this.xAxis.ch, f);
            g.c = this.getEffectiveViewport1(b);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yAxis.ch, f);
                $ret.b = this.h3();
                return $ret;
            })());
            h.c = this.getEffectiveViewport1(b);
            if (c < 1) {
                return;
            }
            this.vr = ((() => {
                let $ret = new ScatterAxisInfoCache();
                $ret.a = this.xAxis;
                $ret.b = this.yAxis;
                $ret.d = this.xAxis.ch;
                $ret.e = this.yAxis.ch;
                $ret.c = this.c7;
                return $ret;
            })());
            let i = b;
            if (c <= this.w3) {
                this.xy(i, a, c, d, e);
            }
            if (this.ue()) {
                b.cy.l(a.j, this.w3, d, e, this.hk);
            }
            let j = ((() => {
                let $ret = new Clipper(0, e, false);
                $ret.i = a.n;
                return $ret;
            })());
            let k = this.tq(b);
            let l = this.xAxis.em(k.left, g);
            let m = this.xAxis.em(k.right, g);
            b.c0.h(a.n, this.trendLineType, this.wc, this.wd, this.trendLinePeriod, (n) => this.xAxis.ej(n, g), (n) => this.yAxis.ej(n, h), ((() => {
                let $ret = new TrendResolutionParams();
                $ret.d = this.hk;
                $ret.h = e;
                $ret.i = d;
                return $ret;
            })()), j, l, m);
            this.x6(a, b);
        }
        nk(a, b) {
            super.nk(a, b);
            let c = b;
            c.c7(a);
        }
        get_et() {
            return true;
        }
        v6(a, b, c) {
            return null;
        }
        v7(a, b, c) {
            let d = this.vw();
            let e = this.vs.b1(this.te(b));
            let f = -1;
            if (e == null) {
                if (a != null) {
                    f = this.c7.indexOf(a);
                }
                else {
                    return null;
                }
            }
            else {
                f = e.ak;
            }
            if (f == -1) {
                return null;
            }
            let g = new HighlightingInfo();
            g.i = this;
            g.g = f;
            g.f = f;
            g.c = false;
            g.d = true;
            if (c != null && c.g == g.g && c.f == g.f) {
                return c;
            }
            return g;
        }
        t0(a, b) {
            if (this.uc != 1 && this.uc != 13) {
                let c = this.ub.ct();
                let d = (c.width / 2) + (this.uh / 2);
                let e = (c.height / 2) + (this.uh / 2);
                let f = d;
                let g = d;
                let h = e;
                let 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);
        }
        v5(a, b, c) {
            let d = new HighlightingInfo();
            d.i = this;
            d.g = 0;
            d.f = this.c7.count - 1;
            d.c = true;
            if (c != null && c.g == d.g && c.f == d.f) {
                return c;
            }
            return d;
        }
        c0(a, b, c) {
            if (this.dv && this.fd(this.bp) && !c) {
                let d = this.v6(a, b, this.v8);
                this.v8 = d;
                return d;
            }
            else {
                let e = this.v5(a, b, this.v8);
                this.v8 = e;
                return e;
            }
        }
        c1(a, b, c) {
            if (this.fd(this.bp) && !c) {
                let d = this.v7(a, b, this.v9);
                this.v9 = d;
                return d;
            }
            else {
                let e = this.v5(a, b, this.v9);
                e.d = true;
                this.v9 = e;
                return e;
            }
        }
        wq() {
            return (this.assigningScatterStyle != null && this.wg) || (this.bp != 1);
        }
        wp() {
            return (this.assigningScatterMarkerStyle != null && this.wf) || (this.bp != 1);
        }
        yj(a, b) {
            this.oy();
            let c = b.bx;
            this.vr = ((() => {
                let $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.ue()) {
                b.cy.j(a.j, this.ug);
                if (this.wp()) {
                    this.xz(b, a);
                }
            }
            b.cp();
            let d = ((() => {
                let $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.yg(a, b);
        }
        vk(a, b) {
            return this.vl(a, b);
        }
        vl(a, b) {
            if (b < a || a < 0 || a > this.wc.count || b < 0 || b > this.wc.count) {
                return null;
            }
            let c = new Array((b - a) + 1);
            for (let d = a; d <= b; d++) {
                let e = d;
                c[d - a] = this.c7.item(d);
            }
            return c;
        }
        xz(a, b) {
            a.b6 = true;
            this.v4.ay(this, this.wp(), runOn(this, this.vk));
            let c = this.v4.d;
            let d = c != null;
            let e = this.getEffectiveViewport1(a);
            let f = this.c7 == null ? 0 : this.c7.count;
            this.vs.ci((g) => {
                if (g._visibility == 0) {
                    let h = g.ak;
                    let i = g.content;
                    if (i == null) {
                        i = new DataContext();
                        g.content = i;
                    }
                    if (d) {
                        this.x3(h, f, a.q);
                    }
                    this.v4.ac(g, i);
                }
            });
        }
        x4(a, b, c) {
            let d = this.bp != 1;
            this.v4.a0(this.v4.b, a, b, false);
            this.v4.ab(this.hi);
            let e = this.v4.ax;
            let f = null;
            let g = this.c7;
            if (d && this.cv != null) {
                f = this.cv.c2.getHighlightingInfo(this, g, e.o, e.n, false);
                e.b = f;
            }
            e.f = c;
            this.ye(e);
            this.v4.z(this, f, c, d, a < 0);
        }
        x3(a, b, c) {
            let d = this.bp != 1;
            this.v4.a0(this.v4.d, a, b, true);
            this.v4.aa(this.hi);
            let e = this.v4.aw;
            let f = null;
            let g = this.c7;
            let h = null;
            if (d && this.cv != null) {
                f = this.cv.c2.getHighlightingInfo(this, g, e.o, e.n, true);
                if (this.cv.c2.isCrossContextHighlight(this)) {
                    h = this.cv.c2.getHighlightingInfo(this, g, e.o, e.n, true);
                }
                e.b = f;
            }
            e.f = c;
            this.yd(e);
            this.v4.y(this, f, c, d, e.m, this.cv.c2.totalHighlightingProgress);
        }
        ye(a) {
            if (this.assigningScatterStyle != null && this.wg) {
                this.assigningScatterStyle(this, a);
            }
        }
        yd(a) {
            if (this.assigningScatterMarkerStyle != null && this.wf) {
                this.assigningScatterMarkerStyle(this, a);
            }
        }
        x6(a, b) {
            let c = new ErrorBarsHelper(this, b);
            if (this.vt == null) {
                return;
            }
            let d = this.vt.u;
            let e = this.vt.v;
            let f = 0;
            let g = 0;
            let h = 0;
            let i = 0;
            for (let j of fromEnum(a.j.keys)) {
                let k = a.j.item(j);
                if (d != null) {
                    switch (d.getCalculatorType()) {
                        case 1:
                            let l = this.x9(k, c, d, h, i, true);
                            h = l.p3;
                            i = l.p4;
                            break;
                        case 0:
                            let m = this.x7(k, c, d, h, i, true);
                            h = m.p3;
                            i = m.p4;
                            break;
                        case 2:
                            let n = this.x5(k, c, d, j, h, i, true);
                            h = n.p4;
                            i = n.p5;
                            break;
                        case 3:
                            let o = this.ya(c, d, f, h, i, true);
                            f = o.p2;
                            h = o.p3;
                            i = o.p4;
                            break;
                        case 4:
                            let p = this.x7(k, c, d, h, i, true);
                            h = p.p3;
                            i = p.p4;
                            break;
                    }
                    ;
                    let q = new OwnedPoint();
                    q.c = c.l(d, this.vr.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:
                            let r = this.x9(k, c, e, h, i, false);
                            h = r.p3;
                            i = r.p4;
                            break;
                        case 0:
                            let s = this.x7(k, c, e, h, i, false);
                            h = s.p3;
                            i = s.p4;
                            break;
                        case 2:
                            let t = this.x5(k, c, e, j, h, i, false);
                            h = t.p4;
                            i = t.p5;
                            break;
                        case 3:
                            let u = this.ya(c, e, g, h, i, false);
                            g = u.p2;
                            h = u.p3;
                            i = u.p4;
                            break;
                        case 4:
                            let v = this.x7(k, c, e, h, i, false);
                            h = v.p3;
                            i = v.p4;
                            break;
                    }
                    ;
                    let w = new OwnedPoint();
                    w.c = c.m(e, this.vr.b, k.c, g);
                    w.a = k.a;
                    a.l.addItem(j, w);
                    a.k.addItem(j, [h, i]);
                }
            }
        }
        x9(a, b, c, d, e, f) {
            if (f) {
                let g;
                let h, i;
                i = this.vr.a;
                if (this.vt.s == 0) {
                    g = a.c.x;
                    h = this.vr.a;
                }
                else {
                    g = a.c.y;
                    h = this.vr.b;
                }
                let j = b.f(g, c, h, i, d, e);
                d = j.p4;
                e = j.p5;
            }
            else {
                let k;
                let l, m;
                m = this.vr.b;
                if (this.vt.t == 0) {
                    k = a.c.x;
                    l = this.vr.a;
                }
                else {
                    k = a.c.y;
                    l = this.vr.b;
                }
                let n = b.f(k, c, l, m, d, e);
                d = n.p4;
                e = n.p5;
            }
            return {
                p3: d,
                p4: e
            };
        }
        x7(a, b, c, d, e, f) {
            if (f) {
                let g = b.j(a.c.x, c, this.vr.a, d, e);
                d = g.p3;
                e = g.p4;
            }
            else {
                let h = b.j(a.c.y, c, this.vr.b, d, e);
                d = h.p3;
                e = h.p4;
            }
            return {
                p3: d,
                p4: e
            };
        }
        x5(a, b, c, d, e, f, g) {
            let h = c.getItemColumn();
            let i = this.c7.indexOf(d);
            if (h != null && i < h.count) {
                let j = h.item(i);
                if (g) {
                    let k = b.h(a.c.x, j, this.vr.a, e, f);
                    e = k.p3;
                    f = k.p4;
                }
                else {
                    let l = b.h(a.c.y, j, this.vr.b, e, f);
                    e = l.p3;
                    f = l.p4;
                }
            }
            else {
                e = NaN;
                f = NaN;
            }
            return {
                p4: e,
                p5: f
            };
        }
        ya(a, b, c, d, e, f) {
            let g = a.i(b, c);
            c = g.p1;
            if (f) {
                let h = a.k(c, b, this.vr.a, d, e);
                d = h.p3;
                e = h.p4;
            }
            else {
                let i = a.k(c, b, this.vr.b, d, e);
                d = i.p3;
                e = i.p4;
            }
            return {
                p2: c,
                p3: d,
                p4: e
            };
        }
        yg(a, b) {
            if (!b.o() || this.vt == null) {
                b.c9();
                return;
            }
            this.yh(a, b);
            this.yi(a, b);
        }
        yh(a, b) {
            b.c5();
            let c = new ErrorBarsHelper(this, b);
            let d = new PathGeometry();
            let e = this.vt.u;
            for (let f of fromEnum(a.j.keys)) {
                if (e != null && a.i.containsKey(f)) {
                    let g = a.i.item(f)[0];
                    let h = a.i.item(f)[1];
                    if (!isNaN_(g) && !isNaN_(h)) {
                        let i = a.h.item(f).c;
                        if (this.vt.o == 1 || this.vt.o == 2) {
                            c.d(d, i, g, true);
                        }
                        if (this.vt.o == 1 || this.vt.o == 3) {
                            c.d(d, i, h, false);
                        }
                    }
                }
            }
            b.da(d);
        }
        yi(a, b) {
            b.c6();
            let c = new ErrorBarsHelper(this, b);
            let d = new PathGeometry();
            let e = this.vt.v;
            for (let f of fromEnum(a.j.keys)) {
                if (e != null && a.k.containsKey(f)) {
                    let g = a.k.item(f)[0];
                    let h = a.k.item(f)[1];
                    if (!isNaN_(g) && !isNaN_(h)) {
                        let i = a.l.item(f).c;
                        if (this.vt.p == 1 || this.vt.p == 2) {
                            c.e(d, i, g, true);
                        }
                        if (this.vt.p == 1 || this.vt.p == 3) {
                            c.e(d, i, h, false);
                        }
                    }
                }
            }
        }
        gm(a, b, c) {
            let d = true;
            if (!super.gm(a, b, c) || b.isEmpty || a.isEmpty || this.xAxis == null || this.yAxis == null || this.xAxis.bi == null || this.yAxis.bi == null || this.wc == null || this.wd == null || this.wc.count == 0 || this.wd.count == 0 || this.c7 == null || this.c7.count != this.wc.count || this.c7.count != this.wd.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;
        }
        getViewInfo(a, b) {
            if (!this.ze.isEmpty && !this.zf.isEmpty) {
                a = this.ze;
                b = this.zf;
                return {
                    p0: a,
                    p1: b
                };
            }
            a = this.cg.bx;
            b = this.cg.by;
            return {
                p0: a,
                p1: b
            };
        }
        ps(a) {
            super.ps(a);
            this.xx();
            try {
                if (this.dm(this.cg)) {
                    return;
                }
                if (this.c7 != null && this.c7.count > this.w3) {
                    a = false;
                }
                if (this.fq(a) && !this.f1) {
                    let b = this.vx;
                    if (this.dk()) {
                        if (this.cw.g) {
                            this.cw.t();
                        }
                        this.vx = this.vz;
                        this.vz = b;
                    }
                    else {
                        this.vx = this.vv;
                        this.vv = b;
                    }
                    this.x8(this.vv, this.vs);
                    this.p5();
                }
                else {
                    if (!this.f1) {
                        this.x8(this.vv, this.vs);
                    }
                    this.yj(this.vv, this.vs);
                }
            }
            finally {
                this.yk();
            }
        }
        qf() {
            super.qf();
            if (this.index < 0) {
                return;
            }
            this.vs.dd();
        }
        pt(a, b) {
            super.pt(a, b);
            if (!this.f9) {
                this.cg.a4(b);
                return;
            }
            this.cg.a4(b);
            if (this.dm(this.cf)) {
                return;
            }
            let c = typeCast(ScatterBaseView.$, this.cf);
            if (!this.f2) {
                this.vy = new ScatterFrame();
                this.x8(this.vy, c);
            }
            this.f2 = false;
            this.yj(this.vy, c);
            this.f9 = false;
        }
        pq(a, b, c, d, e) {
            super.pq(a, b, c, d, e);
            let f = this.a3.a$h.item(d);
            let g = f;
            f.a3(c);
            if (this.dm(g)) {
                return;
            }
            if (this.vu == null) {
                this.vu = new ScatterFrame();
            }
            this.x8(this.vu, g);
            this.yj(this.vu, g);
        }
        yf(a, b) {
            let c = new List$1(Base.$, 0);
            for (let d of fromEnum(b.c)) {
                if (!a.containsKey(d)) {
                    c.add1(d);
                }
            }
            for (let e of fromEnum(c)) {
                b.h(e);
            }
        }
        vj(a, b, c, d, e) {
            if (c == null || c.length != this.vr.c.count) {
                c = new Array(this.vr.c.count);
                for (let f = 0; f < this.vr.c.count; f++) {
                    c[f] = PointUtil.create();
                }
            }
            let g = this.getEffectiveViewport1(a);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.xAxis.ch, g);
                $ret.c = this.getEffectiveViewport1(a);
                return $ret;
            })());
            let i = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yAxis.ch, g);
                $ret.c = this.getEffectiveViewport1(a);
                $ret.b = this.h3();
                return $ret;
            })());
            let j = this.tq(a);
            let k = this.vr.a.em(j.left, h);
            let l = this.vr.a.em(j.right, h);
            let m = this.vr.b.em(j.bottom, i);
            let n = this.vr.b.em(j.top, i);
            if (this.vr.d) {
                let o = k;
                k = l;
                l = o;
            }
            if (this.vr.e) {
                let p = m;
                m = n;
                n = p;
            }
            let q = this.vr;
            let r = q.a;
            let s = q.b;
            let t;
            let u;
            let v = this.wc;
            let w = this.wd;
            let x = false;
            let y = 0;
            let z = 0;
            if (this.cv != null) {
                if (this.cv.fc()) {
                    let aa = this.cv.lp(d, h);
                    x = aa.c;
                    y = aa.d;
                    z = r.em(0 + y, h);
                    let ab = r.em(0, h);
                    z -= ab;
                }
            }
            for (let ac = 0; ac < this.vr.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;
        }
        ws(a, b) {
            if (b == null) {
                b = new List$1(Number_$type, 2, a.e);
            }
            else {
                b.clear();
            }
            let c = 0;
            let d = this.c7;
            for (let e of fromEnum(a.c)) {
                b.add(d.indexOf(e));
            }
            return b;
        }
        n2(a) {
            super.n2(a);
            this.a5.exportTrendlineData(this, a, this.vs.c0.g$j);
        }
        h3() {
            return Series.h4(this.wd, null);
        }
        getDataLegendSeriesContextAt(a, b) {
            let c = { $type: Point_$type, x: a, y: b };
            let d = this.js(c);
            let e = d == null ? NaN : this.h2(d, "XMemberPath");
            let f = d == null ? NaN : this.h2(d, "YMemberPath");
            let g = new DataLegendSeriesValueInfo();
            g.l = e;
            g.a = 13;
            g.p = "X";
            g.q = this.xn != null ? this.xn : "X";
            g.r = this.xj != null ? this.xj : "X:";
            g.s = this.xl != null ? this.xl : "";
            let h = new DataLegendSeriesValueInfo();
            h.l = f;
            h.a = 14;
            h.p = "Y";
            h.q = this.xv != null ? this.xv : "Y";
            h.r = this.xr != null ? this.xr : "Y:";
            h.s = this.xt != null ? this.xt : "";
            let i = new DataLegendSeriesContext();
            i.f = ((() => {
                let $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
                $ret.add(g);
                $ret.add(h);
                return $ret;
            })());
            i.b = this.aw();
            return i;
        }
        yl() {
            if (this.we) {
                this.wt = 0;
                this.wu = 0;
                for (let a = 0; a < this.wc.count; a++) {
                    this.wt += this.wc.item(a);
                    this.wu += this.wd.item(a);
                }
                this.wv = this.wt / this.wc.count;
                this.ww = this.wu / this.wd.count;
                this.we = false;
            }
        }
        id(a, b) {
            if (b == null || !b.cj) {
                return NaN;
            }
            if (b != this.xAxis && b != this.yAxis) {
                return NaN;
            }
            let c = this.am(a);
            if (b.cp) {
                return c[1];
            }
            else {
                return c[0];
            }
        }
        am(a) {
            let b = NaN;
            let c = NaN;
            switch (a) {
                case 5:
                case 2:
                    b = this.wc.maximum;
                    c = this.wd.maximum;
                    break;
                case 4:
                case 1:
                    b = this.wc.minimum;
                    c = this.wd.minimum;
                    break;
                case 6:
                case 3:
                    if (this.we) {
                        this.yl();
                    }
                    b = this.wv;
                    c = this.ww;
                    break;
            }
            return [b, c];
        }
        tn(a) {
            let b = this.getEffectiveViewport1(this.cg);
            let c = new ScalerParams(0, this.cg.by, this.cg.bx, this.xAxis.ch, b);
            c.c = b;
            let d = isNaN_(a[0]) ? NaN : this.xAxis.ej(a[0], c);
            c = new ScalerParams(0, this.cg.by, this.cg.bx, this.yAxis.ch, b);
            c.b = this.h3();
            c.c = b;
            let e = isNaN_(a[1]) ? NaN : this.yAxis.ej(a[1], c);
            return { $type: Point_$type, x: d, y: e };
        }
        tm(a) {
            let b = this.am(a);
            return this.tn(b);
        }
    }
    ScatterBase.$t = /*@__PURE__*/ markType(ScatterBase, 'ScatterBase', MarkerSeries.$, [ISupportsErrorBars_$type, ITrendLineSeries_$type]);
    ScatterBase.ym = /*@__PURE__*/ DependencyProperty.i("ActualTrendLineBrush", Brush.$, ScatterBase.$, /*@__PURE__*/ new PropertyMetadata(2, null, (a, b) => a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue)));
    ScatterBase.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ScatterBase, 'raisePropertyChanged', ['ErrorBarSettings:vt:yn', [ScatterErrorBarSettings.$, null], 'HighlightedXMemberPath:w7:yo', [2, null], 'HighlightedYMemberPath:w9:yp', [2, null], 'IsCustomScatterMarkerStyleAllowed:wj:yq', [0, false], 'IsCustomScatterStyleAllowed:wk:yr', [0, false], 'ItemSearchMode:v3:ys', [ScatterItemSearchMode_$type, /*@__PURE__*/ enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:w2:yt', [1, 10000], 'MarkerCollisionAvoidance:vo:yu', [CollisionAvoidanceType_$type, /*@__PURE__*/ enumGetBox(CollisionAvoidanceType_$type, 0)], 'MaximumMarkers:w3:yv', [1, 400], 'XAxis::y3', [NumericXAxis.$, null], 'XMemberAsLegendLabel:xj:y4', [2, null], 'XMemberAsLegendUnit:xl:y5', [2, null], 'XMemberPath:xn:y6', [2, null], 'YAxis::y7', [NumericYAxis.$, null], 'YMemberAsLegendLabel:xr:y8', [2, null], 'YMemberAsLegendUnit:xt:y9', [2, null], 'YMemberPath:xv:za', [2, null], 'TrendLineType::y1', [TrendLineType_$type, /*@__PURE__*/ enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::y0', [1, 1.5], 'TrendLinePeriod::yz', [1, 7], 'TrendLineBrush::yw', [Brush.$, null], 'TrendLineZIndex:w4:y2', [1, 1001], 'TrendLineDashArray:zc:yx', [DoubleCollection.$], 'TrendLineDashCap:zd:yy', [PenLineCap_$type, /*@__PURE__*/ enumGetBox(PenLineCap_$type, 0)]]);
    return ScatterBase;
})();
/**
 * @hidden
 */
export let ScatterSeriesRenderManager = /*@__PURE__*/ (() => {
    class ScatterSeriesRenderManager extends SeriesRenderManager {
        constructor() {
            super(...arguments);
            this.aw = null;
            this.ax = null;
        }
        c() {
            this.aw = new AssigningScatterMarkerStyleEventArgs();
            return this.aw;
        }
        a() {
            this.ax = new AssigningScatterStyleEventArgs();
            return this.ax;
        }
        ay(a, b, c) {
            this.w(a, b, c);
        }
        az(a, b, c) {
            this.x(a, b, c);
        }
        a0(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 = /*@__PURE__*/ markType(ScatterSeriesRenderManager, 'ScatterSeriesRenderManager', SeriesRenderManager.$);
    return ScatterSeriesRenderManager;
})();
/**
 * @hidden
 */
export let ScatterBaseView = /*@__PURE__*/ (() => {
    class ScatterBaseView extends MarkerSeriesView {
        constructor(a) {
            super(a);
            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();
        }
        au() {
            super.au();
            this.cy = this.cx();
            this.df = new Path();
            this.dg = new Path();
            if (!this.q) {
                this.cz.w3 = 2000;
            }
        }
        dh(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;
            let b = a.ah;
            if (b.measure != null) {
                b.measure(this.de);
            }
            return new Size(1, this.de.width, this.de.height);
        }
        cx() {
            let a = new NumericMarkerManager(1, (b) => this.c1.item(b), (b) => this.cz.vr.c.item(b), runOn(this, this.dc), runOn(this, this.cu), runOn(this, this.c2), () => this.cz.vo);
            a.q = runOn(this, this.dh);
            return a;
        }
        dc(a) {
            this.cz.yf(a, this.c1);
        }
        c3() {
            return this.b7;
        }
        cv() {
            return this.cw;
        }
        cu() {
            this.cw = this.cz.vj(this, this.c1, this.cw, this.by, this.bx);
            return this.cw;
        }
        c2() {
            this.c4 = this.cz.ws(this.c1, this.c4);
            return this.c4;
        }
        c5() {
        }
        da(a) {
        }
        c6() {
        }
        db(a) {
        }
        dd() {
            if (this.cz.trendLineBrush != null) {
                this.cz.zb = this.cz.trendLineBrush;
            }
            else {
                this.cz.zb = this.cz.su;
            }
        }
        ci(a) {
            this.c1.f(a);
        }
        c8(a) {
            this.c1.g(a);
        }
        c9() {
        }
        a7(a, b) {
            super.a7(a, b);
            if (a.d) {
                if (this.cz.trendLineType != 0 && !b) {
                    let c = this.c0.g$j;
                    c.ad = this.cz.trendLineThickness;
                    c._stroke = this.cz.zb;
                    c.ai = this.cz.zc;
                    c.aj = this.cz.zd;
                    a.v(c);
                }
            }
        }
        c7(a) {
            if (a) {
                this.c9();
                this.c1.clear();
            }
            this.c0.g$d();
            this.as();
        }
        getDefaultTooltipTemplate() {
            let a = "<div class='ui-chart-default-tooltip-content'><span";
            let b = this.e.a3.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.xn + "}</span><br/><span>" + "y: </span><span class='ui-priority-primary'>${item." + this.cz.xv + "}</span></div>";
            return a;
        }
    }
    ScatterBaseView.$t = /*@__PURE__*/ markType(ScatterBaseView, 'ScatterBaseView', MarkerSeriesView.$);
    return ScatterBaseView;
})();
