/*
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 "./HighlightingInfo";
import { ScatterFrame } from "./ScatterFrame";
import { Base, enumGetBox, Number_$type, typeCast, fromEnum, Point_$type, runOn, 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 { 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 { 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 {
        constructor() {
            super();
            this.p3 = null;
            this.qg = null;
            this.qh = null;
            this.st = null;
            this.su = null;
            this.qb = 1;
            this.po = null;
            this.pp = null;
            this.p8 = null;
            this.qa = null;
            this.p7 = null;
            this.ql = false;
            this.qk = false;
            this.pz = null;
            this.p0 = null;
            this.assigningScatterStyle = null;
            this.assigningScatterMarkerStyle = null;
            this.qf = null;
            this.p9 = null;
            this.p6 = null;
            this.qc = this.qd();
            this.qf = new ScatterSeriesRenderManager();
            this.p9 = new ScatterFrame();
            this.su = Rect.empty;
            this.st = Rect.empty;
        }
        bp() {
            return new ScatterBaseView(this);
        }
        ji() {
            super.ji();
            this.xAxis = null;
            this.yAxis = null;
        }
        kk(a) {
            super.kk(a);
            this.p4 = a;
        }
        get_dj() {
            return true;
        }
        ag() {
            return [this.xAxis, this.yAxis];
        }
        gt(a, b) {
            let c = this.ic(b);
            if (c == ScatterBase.$$p[8]) {
                return this.gu(a, b, this.rf);
            }
            if (c == ScatterBase.$$p[10]) {
                return this.gu(a, b, this.rj);
            }
            return null;
        }
        ct(a, b, c) {
            if (!this.hasMarkers) {
                return false;
            }
            let d = this.xAxis;
            let e = new ScalerParams(1, this.b6.os, this.n6, d.ca);
            e.c = this.getEffectiveViewport1(this.bs);
            let f = this.yAxis;
            let g = new ScalerParams(1, this.b6.os, this.n6, f.ca);
            g.c = this.getEffectiveViewport1(this.bs);
            a.clear();
            this.oh.cf((h) => {
                if (h._visibility == 0) {
                    let i = new SeriesPointOfInterest();
                    let j = h.n;
                    let k = h.o;
                    if (j < this.n6.left || j > this.n6.right || k < this.n6.top || k > this.n6.bottom) {
                        return;
                    }
                    i.b = d.d2(j, e);
                    i.c = f.d2(k, g);
                    i.a = h.content;
                    a.add(i);
                }
            });
            return true;
        }
        bj() {
            if (this.bk == 0) {
                if (this.q3 <= 2000) {
                    return 1;
                }
                else {
                    return super.bj();
                }
            }
            else {
                return super.bj();
            }
        }
        n4(a) {
            if (!this.hasMarkers || !this.ok()) {
                return Rect.empty;
            }
            let b = this.oh.by(this.no(a));
            if (b != null) {
                return this.oh.cp(b);
            }
            return Rect.empty;
        }
        dy(a, b) {
            if (this.ol(a, b)) {
                return true;
            }
            return false;
        }
        get qi() {
            return this.qg;
        }
        set qi(a) {
            if (this.qg != a) {
                let b = this.qi;
                this.qg = a;
                this.raisePropertyChanged("XColumn", b, this.qi);
            }
        }
        get qj() {
            return this.qh;
        }
        set qj(a) {
            if (this.qh != a) {
                let b = this.qj;
                this.qh = a;
                this.raisePropertyChanged("YColumn", b, this.qj);
            }
        }
        get sq() {
            return this.c(ScatterBase.r7);
        }
        set sq(a) {
            this.h(ScatterBase.r7, a);
        }
        get GetErrorBarsXAxis() {
            return this.xAxis;
        }
        get GetErrorBarsYAxis() {
            return this.yAxis;
        }
        j2() {
            super.j2();
            if (this.xAxis != null) {
                this.xAxis.hc(false);
            }
            if (this.yAxis != null) {
                this.yAxis.hc(false);
            }
        }
        kp(a, b, c, d) {
            super.kp(a, b, c, d);
            if (this.p4.cx.g$b(a, b, c, d)) {
                this.k3(false);
                this.ka();
            }
            switch (b) {
                case "FastItemsSource":
                    if (typeCast(IFastItemsSource_$type, c) != null) {
                        c.deregisterColumn(this.qi);
                        c.deregisterColumn(this.qj);
                        this.qi = null;
                        this.qj = null;
                    }
                    if (typeCast(IFastItemsSource_$type, d) != null) {
                        this.qi = this.ca(this.rf);
                        this.qj = this.ca(this.rj);
                    }
                    if ((this.yAxis != null && !this.yAxis.cn()) || (this.xAxis != null && !this.xAxis.cn())) {
                        this.k3(false);
                    }
                    break;
                case ScatterBase.$$p[7]:
                    if (c != null) {
                        c.bx(this);
                    }
                    if (d != null) {
                        d.ck(this);
                    }
                    if ((this.xAxis != null && !this.xAxis.cn()) || (d == null && c != null)) {
                        this.k3(false);
                    }
                    this.ka();
                    break;
                case ScatterBase.$$p[9]:
                    if (c != null) {
                        c.bx(this);
                    }
                    if (d != null) {
                        d.ck(this);
                    }
                    if ((this.yAxis != null && !this.yAxis.cn()) || (d == null && c != null)) {
                        this.k3(false);
                    }
                    this.ka();
                    break;
                case ScatterBase.$$p[8]:
                    if (this.cd != null) {
                        this.cd.deregisterColumn(this.qi);
                        this.qi = this.ca(this.rf);
                    }
                    break;
                case "XColumn":
                    this.p4.cx.g$i();
                    if (this.xAxis != null && !this.xAxis.cn()) {
                        this.k3(false);
                    }
                    break;
                case ScatterBase.$$p[10]:
                    if (this.cd != null) {
                        this.cd.deregisterColumn(this.qj);
                        this.qj = this.ca(this.rj);
                    }
                    break;
                case "YColumn":
                    this.p4.cx.g$i();
                    if (this.yAxis != null && !this.yAxis.cn()) {
                        this.k3(false);
                    }
                    break;
                case ScatterBase.$$p[5]:
                    this.k3(false);
                    this.ka();
                    break;
                case ScatterBase.$$p[6]:
                    this.k3(false);
                    this.ka();
                    break;
                case "TransitionProgress":
                    this.qa.c(this.fw, this.p8, this.p7);
                    this.rl();
                    try {
                        if (this.cp(this.bs)) {
                            return;
                        }
                        if ((Math.round(this.fw * 100000) / 100000) == 1) {
                            this.r5(this.p7, this.p4);
                        }
                        else {
                            this.r5(this.qa, this.p4);
                        }
                        if (this.b6 != null) {
                            this.b6.k7(this);
                        }
                    }
                    finally {
                        this.r6();
                    }
                    break;
                case "TrendLineBrush":
                    this.lg();
                    break;
                case ScatterBase.$$p[0]:
                    if (this.p5 != null) {
                        this.p5.r = this;
                    }
                    this.k3(false);
                    this.ka();
                    break;
                case "TrendLineType":
                    this.ka();
                    break;
                case ScatterBase.$$p[2]:
                    this.ql = this.qt();
                    this.k3(false);
                    break;
                case ScatterBase.$$p[1]:
                    this.qk = this.qs();
                    this.k3(false);
                    break;
                case ScatterBase.$$p[3]:
                    this.qc = this.qd();
                    break;
            }
        }
        qt() {
            return this.qp;
        }
        qs() {
            return this.qo;
        }
        qn(a) {
            if (typeCast(NumericYAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        qm(a) {
            if (typeCast(NumericXAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        r6() {
            this.st = Rect.empty;
            this.su = Rect.empty;
        }
        rl() {
            let a = this.getViewInfo(this.st, this.su);
            this.st = a.p0;
            this.su = a.p1;
        }
        qr(a, b) {
            if (b != 3) {
                return true;
            }
            if (a == null) {
                return true;
            }
            if (this.rf == a || this.rj == a) {
                return true;
            }
            return false;
        }
        jo(a, b, c, d) {
            let e = false;
            if (!this.qr(d, a)) {
                return;
            }
            this.p4.cx.g$e(a, b, c, d);
            if (this.xAxis != null && !this.xAxis.cn()) {
                e = true;
            }
            if (this.yAxis != null && !this.yAxis.cn()) {
                e = true;
            }
            if (e) {
                this.k3(true);
            }
        }
        rx(a) {
            this.ry(a, null);
        }
        ry(a, b) {
            let c = this.qi != null ? this.qi.count : 0;
            let d = this.qj != null ? this.qj.count : 0;
            let e = Math.min(c, d);
            if (e <= this.q3) {
                a.m.clear();
                let f = new List$1(OwnedPoint.$, 0);
                for (let g of fromEnum(a.u.values)) {
                    f.add(g);
                }
                let h = this.cd;
                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 });
                        }
                    }
                }
            }
        }
        ao(a) {
            if (a != null && a == this.xAxis && this.qi != null) {
                return new AxisRange(this.qi.minimum, this.qi.maximum);
            }
            if (a != null && a == this.yAxis && this.qj != null) {
                return new AxisRange(this.qj.minimum, this.qj.maximum);
            }
            return null;
        }
        gq(a) {
            let b = this.f9(a);
            if (this.cd != null && b >= 0 && b < this.cd.count) {
                return this.cd.item(b);
            }
            return null;
        }
        get qc() {
            return this.qb;
        }
        set qc(a) {
            let b = this.qb;
            this.qb = a;
            if (b != this.qb) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.qb));
            }
        }
        qd() {
            if (this.qe != 0) {
                return this.qe;
            }
            return this.qq ? 4 : 1;
        }
        f9(a) {
            let b = truncate(Math.round(this.e4(a)));
            return b;
        }
        e4(a) {
            switch (this.qc) {
                case 1: return this.qz(a);
                case 3: return this.q0(a);
                case 2: return this.qx(a);
                case 4: return this.qy(a);
            }
            return -1;
        }
        qy(a) {
            return this.q1(a, false);
        }
        qx(a) {
            let b = this.no(a);
            let c = b.x;
            let d = b.y;
            if (this.cd == null || this.xAxis == null || this.yAxis == null || this.qi == null || this.qj == null) {
                return -1;
            }
            if (this.cd.count > this.q2) {
                return -1;
            }
            this.ro();
            let e = this.po;
            let f = this.pp;
            if (e == null || f == null) {
                return -1;
            }
            let g = 1.7976931348623157E+308;
            let h = -1;
            for (let i = 0; i < this.qi.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;
        }
        ro() {
            let a = this.bs.bv;
            let b = this.bs.bu;
            let c = this.getEffectiveViewport();
            if (this.p3 == null) {
                return;
            }
            let d = new ScalerParams(0, a, b, this.p3.d, c);
            let e = ((() => {
                let $ret = new ScalerParams(0, a, b, this.p3.e, c);
                $ret.b = this.fa();
                return $ret;
            })());
            if (this.po == null || this.pp == null) {
                let f = arrayShallowClone(this.qi.asArray());
                let g = arrayShallowClone(this.qj.asArray());
                this.xAxis.gt(boxArray$1(f), 0, f.length, d);
                this.yAxis.gt(boxArray$1(g), 0, g.length, e);
                this.po = f;
                this.pp = g;
            }
        }
        get_qq() {
            return false;
        }
        get qq() {
            return this.get_qq();
        }
        q1(a, b) {
            if (!this.qq) {
                return -1;
            }
            let c = { $type: Point_$type, x: 0, y: 0 };
            let d = true;
            let e = this.p7;
            if (this.cn()) {
                e = this.qa;
            }
            if (e == null) {
                return -1;
            }
            if (e.m == null) {
                return -1;
            }
            if (this.cd == null || this.cd.count > this.q2) {
                return -1;
            }
            this.ro();
            let f = this.po;
            let g = this.pp;
            if (f == null || g == null) {
                return -1;
            }
            let h = this.no(a);
            let i = 1.7976931348623157E+308;
            let j = -1;
            for (let k = 0; k < this.po.length; k++) {
                let l = { $type: Point_$type, x: this.po[k], y: this.pp[k] };
                if (k > 0) {
                    if (!b || e.j.containsKey(this.cd.item(k)) || e.j.containsKey(this.cd.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.po[j], y: this.pp[j] };
                let o = { $type: Point_$type, x: this.po[j - 1], y: this.pp[j - 1] };
                if (!b || (e.j.containsKey(this.cd.item(j)) && e.j.containsKey(this.cd.item(j - 1)))) {
                    let p = GeometryUtil.h(h, o, n);
                    return (j - 1) + p;
                }
                else if (e.j.containsKey(this.cd.item(j))) {
                    return j;
                }
                else {
                    return j - 1;
                }
            }
            return -1;
        }
        q0(a) {
            return this.q1(a, true);
        }
        qz(a) {
            let b = null;
            let c = 1.7976931348623157E+308;
            let d = this.no(a);
            let e = d.x;
            let f = d.y;
            if (this.p4.cy.e > this.q2) {
                return -1;
            }
            this.p4.c5((g) => {
                if (g._visibility == 0) {
                    let h = this.p4.cp(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;
        }
        nt(a, b, c) {
            if (this.xAxis == null || this.yAxis == null || this.qi == null || this.qj == null) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            let d = this.bs.bv;
            let e = this.bs.bu;
            let f = this.getEffectiveViewport();
            let g = new ScalerParams(0, d, e, this.xAxis.ca, f);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yAxis.ca, f);
                $ret.b = this.fa();
                return $ret;
            })());
            if (b) {
                let i = this.e4(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.cd.count - 1) {
                    k = this.cd.count - 1;
                }
                if (j > this.cd.count - 1) {
                    j = this.cd.count - 1;
                }
                if (k == j) {
                    let l = this.xAxis.dz(this.qi.item(j), g);
                    let m = this.yAxis.dz(this.qj.item(j), h);
                    return { $type: Point_$type, x: l, y: m };
                }
                let n = i - Math.floor(i);
                let o = this.xAxis.dz(this.qi.item(j), g);
                let p = this.yAxis.dz(this.qj.item(j), h);
                let q = this.xAxis.dz(this.qi.item(k), g);
                let r = this.yAxis.dz(this.qj.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.f9(a);
                if (u == -1) {
                    return { $type: Point_$type, x: NaN, y: NaN };
                }
                let v = this.xAxis.dz(this.qi.item(u), g);
                let w = this.yAxis.dz(this.qj.item(u), h);
                return { $type: Point_$type, x: v, y: w };
            }
        }
        dq(a) {
            let b = this.b6 != null ? this.b6.os : Rect.empty;
            b = b.copy();
            let c = this.b6 != null ? this.b6.o7 : Rect.empty;
            let d = new Rect(0, 0, 0, 1, 1);
            let e = this.n0(this.bs);
            let f = new ScalerParams(0, d, d, this.xAxis.ca, e);
            let g = ((() => {
                let $ret = new ScalerParams(0, d, d, this.yAxis.ca, e);
                $ret.b = this.fa();
                return $ret;
            })());
            let h = !b.isEmpty && !c.isEmpty && this.cd != null ? this.cd.indexOf(a) : -1;
            let i = this.xAxis != null && this.qi != null && h < this.qi.count ? this.xAxis.dz(this.qi.item(h), f) : NaN;
            let j = this.yAxis != null && this.qj != null && h < this.qj.count ? this.yAxis.dz(this.qj.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.b1 != null) {
                this.b1.ap(this.b6, b, true);
            }
            return h >= 0;
        }
        ln(a, b) {
            this.k3(false);
        }
        lo(a, b) {
            this.k3(false);
        }
        rm(a, b, c, d, e) {
            b.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, c);
            let f = this.getEffectiveViewport1(a);
            let g = this.cd;
            let h;
            let i;
            let j = ((() => {
                let $ret = new ScalerParams(0, d, e, this.p3.d, f);
                $ret.c = this.getEffectiveViewport1(a);
                return $ret;
            })());
            let k = ((() => {
                let $ret = new ScalerParams(0, d, e, this.p3.e, f);
                $ret.c = this.getEffectiveViewport1(a);
                $ret.b = this.fa();
                return $ret;
            })());
            let l = false;
            let m = 0;
            if (this.b6 != null) {
                if (this.b6.ea()) {
                    let n = this.b6.ik(d, j);
                    l = n.c;
                    m = n.d;
                }
            }
            for (let o = 0; o < c; o++) {
                h = this.qi.item(o);
                i = this.qj.item(o);
                let p = { $type: Point_$type, x: this.p3.a.dz(h, j), y: this.p3.b.dz(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;
                        })()));
                    }
                }
            }
        }
        ru(a, b) {
            this.po = null;
            this.pp = null;
            a.j.clear();
            a.n.clear();
            a.h.clear();
            a.l.clear();
            a.i.clear();
            a.k.clear();
            let c = Math.min(this.qi != null ? this.qi.count : 0, this.qj != null ? this.qj.count : 0);
            let d = b.bv;
            let e = b.bu;
            let f = this.getEffectiveViewport1(b);
            let g = new ScalerParams(0, d, e, this.xAxis.ca, f);
            g.c = this.getEffectiveViewport1(b);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yAxis.ca, f);
                $ret.b = this.fa();
                return $ret;
            })());
            h.c = this.getEffectiveViewport1(b);
            if (c < 1) {
                return;
            }
            this.p3 = ((() => {
                let $ret = new ScatterAxisInfoCache();
                $ret.a = this.xAxis;
                $ret.b = this.yAxis;
                $ret.d = this.xAxis.ca;
                $ret.e = this.yAxis.ca;
                $ret.c = this.cd;
                return $ret;
            })());
            let i = b;
            if (c <= this.q3) {
                this.rm(i, a, c, d, e);
            }
            if (this.ok()) {
                b.cv.l(a.j, this.q3, d, e, this.fq);
            }
            let j = ((() => {
                let $ret = new Clipper(0, e, false);
                $ret.i = a.n;
                return $ret;
            })());
            let k = this.ny(b);
            let l = this.xAxis.d2(k.left, g);
            let m = this.xAxis.d2(k.right, g);
            b.cx.h(a.n, this.trendLineType, this.qi, this.qj, this.trendLinePeriod, (n) => this.xAxis.dz(n, g), (n) => this.yAxis.dz(n, h), ((() => {
                let $ret = new TrendResolutionParams();
                $ret.b = this.fq;
                $ret.f = e;
                $ret.g = d;
                return $ret;
            })()), j, l, m);
            this.rs(a, b);
        }
        jl(a, b) {
            super.jl(a, b);
            let c = b;
            c.c4(a);
        }
        get_da() {
            return true;
        }
        px(a, b, c) {
            return null;
        }
        py(a, b, c) {
            let d = this.p7;
            if (this.cn()) {
                d = this.qa;
            }
            let e = this.p4.by(this.no(b));
            let f = -1;
            if (e == null) {
                if (a != null) {
                    f = this.cd.indexOf(a);
                }
                else {
                    return null;
                }
            }
            else {
                f = e.ak;
            }
            if (f == -1) {
                return null;
            }
            let 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;
        }
        n7() {
            if (this.oi != 1 && this.oi != 13) {
                let a = this.oh.cq();
                let b = (a.width / 2) + (this.on / 2);
                let c = (a.height / 2) + (this.on / 2);
                return new Thickness(1, b, c, b, c);
            }
            return new Thickness(1, 0, 0, 0, 0);
        }
        pw(a, b, c) {
            let d = new HighlightingInfo();
            d.b = this;
            d.h = 0;
            d.g = this.cd.count - 1;
            d.d = true;
            if (c != null && c.h == d.h && c.g == d.g) {
                return c;
            }
            return d;
        }
        au(a, b, c) {
            if (this.cu && this.dl(this.be) && !c) {
                let d = this.px(a, b, this.pz);
                this.pz = d;
                return d;
            }
            else {
                let e = this.pw(a, b, this.pz);
                this.pz = e;
                return e;
            }
        }
        av(a, b, c) {
            if (this.dl(this.be) && !c) {
                let d = this.py(a, b, this.p0);
                this.p0 = d;
                return d;
            }
            else {
                let e = this.pw(a, b, this.p0);
                e.e = true;
                this.p0 = e;
                return e;
            }
        }
        qv() {
            return (this.assigningScatterStyle != null && this.ql) || (this.be != 1);
        }
        qu() {
            return (this.assigningScatterMarkerStyle != null && this.qk) || (this.be != 1);
        }
        r5(a, b) {
            let c = b.bu;
            this.p3 = ((() => {
                let $ret = new ScatterAxisInfoCache();
                $ret.a = this.xAxis;
                $ret.b = this.yAxis;
                $ret.d = this.xAxis.ca;
                $ret.e = this.yAxis.ca;
                return $ret;
            })());
            if (this.ok()) {
                b.cv.j(a.j, this.om);
                if (this.qu()) {
                    this.rn(b, a);
                }
            }
            b.cm();
            let d = ((() => {
                let $ret = new Clipper(1, NaN, c.bottom, NaN, c.top, false);
                $ret.i = b.cx.g$j.ak;
                return $ret;
            })());
            b.cx.g$h(a.n, d);
            this.r2(a, b);
        }
        pr(a, b) {
            return this.ps(a, b);
        }
        ps(a, b) {
            if (b < a || a < 0 || a > this.qi.count || b < 0 || b > this.qi.count) {
                return null;
            }
            let c = new Array((b - a) + 1);
            for (let d = a; d <= b; d++) {
                let e = d;
                c[d - a] = this.cd.item(d);
            }
            return c;
        }
        rn(a, b) {
            a.b3 = true;
            this.qf.aw(this, this.qu(), runOn(this, this.pr));
            let c = this.qf.d;
            let d = c != null;
            let e = this.getEffectiveViewport1(a);
            let f = this.cd == null ? 0 : this.cd.count;
            this.p4.cf((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.rp(h, f, a.q);
                    }
                    this.qf.ac(g, i);
                }
            });
        }
        rq(a, b, c) {
            let d = this.be != 1;
            this.qf.ay(this.qf.b, a, b, false);
            this.qf.ab(this.es);
            let e = this.qf.av;
            let f = null;
            let g = this.cd;
            if (d && this.b6 != null) {
                f = this.b6.az.getHighlightingInfo(this, g, e.o, e.n, false);
                e.b = f;
            }
            e.f = c;
            this.r0(e);
            this.qf.z(this, f, c, d, a < 0);
        }
        rp(a, b, c) {
            let d = this.be != 1;
            this.qf.ay(this.qf.d, a, b, true);
            this.qf.aa(this.es);
            let e = this.qf.au;
            let f = null;
            let g = this.cd;
            let h = null;
            if (d && this.b6 != null) {
                f = this.b6.az.getHighlightingInfo(this, g, e.o, e.n, true);
                if (this.b6.az.isCrossSeriesHighlight(this)) {
                    h = this.b6.az.getHighlightingInfo(this, g, e.o, e.n, true);
                }
                e.b = f;
            }
            e.f = c;
            this.rz(e);
            this.qf.y(this, f, c, d, e.m, this.b6.az.totalHighlightingProgress);
        }
        r0(a) {
            if (this.assigningScatterStyle != null && this.ql) {
                this.assigningScatterStyle(this, a);
            }
        }
        rz(a) {
            if (this.assigningScatterMarkerStyle != null && this.qk) {
                this.assigningScatterMarkerStyle(this, a);
            }
        }
        rs(a, b) {
            let c = new ErrorBarsHelper(this, b);
            if (this.p5 == null) {
                return;
            }
            let d = this.p5.u;
            let e = this.p5.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.rv(k, c, d, h, i, true);
                            h = l.p3;
                            i = l.p4;
                            break;
                        case 0:
                            let m = this.rt(k, c, d, h, i, true);
                            h = m.p3;
                            i = m.p4;
                            break;
                        case 2:
                            let n = this.rr(k, c, d, j, h, i, true);
                            h = n.p4;
                            i = n.p5;
                            break;
                        case 3:
                            let o = this.rw(c, d, f, h, i, true);
                            f = o.p2;
                            h = o.p3;
                            i = o.p4;
                            break;
                        case 4:
                            let p = this.rt(k, c, d, h, i, true);
                            h = p.p3;
                            i = p.p4;
                            break;
                    }
                    ;
                    let q = new OwnedPoint();
                    q.c = c.l(d, this.p3.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.rv(k, c, e, h, i, false);
                            h = r.p3;
                            i = r.p4;
                            break;
                        case 0:
                            let s = this.rt(k, c, e, h, i, false);
                            h = s.p3;
                            i = s.p4;
                            break;
                        case 2:
                            let t = this.rr(k, c, e, j, h, i, false);
                            h = t.p4;
                            i = t.p5;
                            break;
                        case 3:
                            let u = this.rw(c, e, g, h, i, false);
                            g = u.p2;
                            h = u.p3;
                            i = u.p4;
                            break;
                        case 4:
                            let v = this.rt(k, c, e, h, i, false);
                            h = v.p3;
                            i = v.p4;
                            break;
                    }
                    ;
                    let w = new OwnedPoint();
                    w.c = c.m(e, this.p3.b, k.c, g);
                    w.a = k.a;
                    a.l.addItem(j, w);
                    a.k.addItem(j, [h, i]);
                }
            }
        }
        rv(a, b, c, d, e, f) {
            if (f) {
                let g;
                let h, i;
                i = this.p3.a;
                if (this.p5.s == 0) {
                    g = a.c.x;
                    h = this.p3.a;
                }
                else {
                    g = a.c.y;
                    h = this.p3.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.p3.b;
                if (this.p5.t == 0) {
                    k = a.c.x;
                    l = this.p3.a;
                }
                else {
                    k = a.c.y;
                    l = this.p3.b;
                }
                let n = b.f(k, c, l, m, d, e);
                d = n.p4;
                e = n.p5;
            }
            return {
                p3: d,
                p4: e
            };
        }
        rt(a, b, c, d, e, f) {
            if (f) {
                let g = b.j(a.c.x, c, this.p3.a, d, e);
                d = g.p3;
                e = g.p4;
            }
            else {
                let h = b.j(a.c.y, c, this.p3.b, d, e);
                d = h.p3;
                e = h.p4;
            }
            return {
                p3: d,
                p4: e
            };
        }
        rr(a, b, c, d, e, f, g) {
            let h = c.getItemColumn();
            let i = this.cd.indexOf(d);
            if (h != null && i < h.count) {
                let j = h.item(i);
                if (g) {
                    let k = b.h(a.c.x, j, this.p3.a, e, f);
                    e = k.p3;
                    f = k.p4;
                }
                else {
                    let l = b.h(a.c.y, j, this.p3.b, e, f);
                    e = l.p3;
                    f = l.p4;
                }
            }
            else {
                e = NaN;
                f = NaN;
            }
            return {
                p4: e,
                p5: f
            };
        }
        rw(a, b, c, d, e, f) {
            let g = a.i(b, c);
            c = g.p1;
            if (f) {
                let h = a.k(c, b, this.p3.a, d, e);
                d = h.p3;
                e = h.p4;
            }
            else {
                let i = a.k(c, b, this.p3.b, d, e);
                d = i.p3;
                e = i.p4;
            }
            return {
                p2: c,
                p3: d,
                p4: e
            };
        }
        r2(a, b) {
            if (!b.o() || this.p5 == null) {
                b.c6();
                return;
            }
            this.r3(a, b);
            this.r4(a, b);
        }
        r3(a, b) {
            b.c2();
            let c = new ErrorBarsHelper(this, b);
            let d = new PathGeometry();
            let e = this.p5.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.p5.o == 1 || this.p5.o == 2) {
                            c.d(d, i, g, true);
                        }
                        if (this.p5.o == 1 || this.p5.o == 3) {
                            c.d(d, i, h, false);
                        }
                    }
                }
            }
            b.c7(d);
        }
        r4(a, b) {
            b.c3();
            let c = new ErrorBarsHelper(this, b);
            let d = new PathGeometry();
            let e = this.p5.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.p5.p == 1 || this.p5.p == 2) {
                            c.e(d, i, g, true);
                        }
                        if (this.p5.p == 1 || this.p5.p == 3) {
                            c.e(d, i, h, false);
                        }
                    }
                }
            }
        }
        ec(a, b, c) {
            let d = true;
            if (!super.ec(a, b, c) || b.isEmpty || a.isEmpty || this.xAxis == null || this.yAxis == null || this.xAxis.bh == null || this.yAxis.bh == null || this.qi == null || this.qj == null || this.qi.count == 0 || this.qj.count == 0 || this.cd == null || this.cd.count != this.qi.count || this.cd.count != this.qj.count || this.xAxis.bh == null || this.yAxis.bh == null || this.xAxis.kd == this.xAxis.kc || this.yAxis.kd == this.yAxis.kc) {
                d = false;
            }
            return d;
        }
        getViewInfo(a, b) {
            if (!this.st.isEmpty && !this.su.isEmpty) {
                a = this.st;
                b = this.su;
                return {
                    p0: a,
                    p1: b
                };
            }
            a = this.bs.bu;
            b = this.bs.bv;
            return {
                p0: a,
                p1: b
            };
        }
        k4(a) {
            this.rl();
            try {
                if (this.cp(this.bs)) {
                    return;
                }
                if (this.cd != null && this.cd.count > this.q3) {
                    a = false;
                }
                if (this.dr(a) && !this.dv) {
                    let b = this.p8;
                    if (this.cn()) {
                        if (this.b7.g) {
                            this.b7.t();
                        }
                        this.p8 = this.qa;
                        this.qa = b;
                    }
                    else {
                        this.p8 = this.p7;
                        this.p7 = b;
                    }
                    this.ru(this.p7, this.p4);
                    this.lb();
                }
                else {
                    if (!this.dv) {
                        this.ru(this.p7, this.p4);
                    }
                    this.r5(this.p7, this.p4);
                }
            }
            finally {
                this.r6();
            }
        }
        lg() {
            super.lg();
            if (this.gi < 0) {
                return;
            }
            this.p4.da();
        }
        k5(a, b) {
            super.k5(a, b);
            if (!this.d2) {
                this.bs.a2(b);
                return;
            }
            this.bs.a2(b);
            if (this.cp(this.br)) {
                return;
            }
            let c = typeCast(ScatterBaseView.$, this.br);
            if (!this.dw) {
                this.p9 = new ScatterFrame();
                this.ru(this.p9, c);
            }
            this.dw = false;
            this.r5(this.p9, c);
            this.d2 = false;
        }
        k2(a, b, c, d, e) {
            super.k2(a, b, c, d, e);
            let f = this.a3.a$h.item(d);
            let g = f;
            f.a1(c);
            if (this.cp(g)) {
                return;
            }
            if (this.p6 == null) {
                this.p6 = new ScatterFrame();
            }
            this.ru(this.p6, g);
            this.r5(this.p6, g);
        }
        r1(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);
            }
        }
        pq(a, b, c, d, e) {
            if (c == null || c.length != this.p3.c.count) {
                c = new Array(this.p3.c.count);
                for (let f = 0; f < this.p3.c.count; f++) {
                    c[f] = PointUtil.create();
                }
            }
            let g = this.getEffectiveViewport1(a);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.xAxis.ca, g);
                $ret.c = this.getEffectiveViewport1(a);
                return $ret;
            })());
            let i = ((() => {
                let $ret = new ScalerParams(0, d, e, this.yAxis.ca, g);
                $ret.c = this.getEffectiveViewport1(a);
                $ret.b = this.fa();
                return $ret;
            })());
            let j = this.ny(a);
            let k = this.p3.a.d2(j.left, h);
            let l = this.p3.a.d2(j.right, h);
            let m = this.p3.b.d2(j.bottom, i);
            let n = this.p3.b.d2(j.top, i);
            if (this.p3.d) {
                let o = k;
                k = l;
                l = o;
            }
            if (this.p3.e) {
                let p = m;
                m = n;
                n = p;
            }
            let q = this.p3;
            let r = q.a;
            let s = q.b;
            let t;
            let u;
            let v = this.qi;
            let w = this.qj;
            let x = false;
            let y = 0;
            let z = 0;
            if (this.b6 != null) {
                if (this.b6.ea()) {
                    let aa = this.b6.ik(d, h);
                    x = aa.c;
                    y = aa.d;
                    z = r.d2(0 + y, h);
                    let ab = r.d2(0, h);
                    z -= ab;
                }
            }
            for (let ac = 0; ac < this.p3.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.dz(t, h);
                        c[ac].y = s.dz(u, i);
                    }
                    else {
                        if ((t + z) >= k && (t + z) <= l && u >= m && u <= n) {
                            c[ac].x = r.dz(t, h) + y;
                            c[ac].y = s.dz(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.dz(t, h);
                        c[ac].y = s.dz(u, i);
                    }
                    else {
                        c[ac].x = NaN;
                        c[ac].y = NaN;
                    }
                }
            }
            return c;
        }
        qw(a, b) {
            if (b == null) {
                b = new List$1(Number_$type, 2, a.e);
            }
            else {
                b.clear();
            }
            let c = 0;
            let d = this.cd;
            for (let e of fromEnum(a.c)) {
                b.add(d.indexOf(e));
            }
            return b;
        }
        jv(a) {
            super.jv(a);
            this.a5.exportTrendlineData(this, a, this.p4.cx.g$j);
        }
        fa() {
            return Series.fb(this.qj, null);
        }
    }
    ScatterBase.$t = /*@__PURE__*/ markType(ScatterBase, 'ScatterBase', MarkerSeries.$, [ISupportsErrorBars_$type, ITrendLineSeries_$type]);
    ScatterBase.r7 = /*@__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:p5:r8', [ScatterErrorBarSettings.$, null], 'IsCustomScatterMarkerStyleAllowed:qo:r9', [0, false], 'IsCustomScatterStyleAllowed:qp:sa', [0, false], 'ItemSearchMode:qe:sb', [ScatterItemSearchMode_$type, /*@__PURE__*/ enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:q2:sc', [1, 10000], 'MarkerCollisionAvoidance:pv:sd', [CollisionAvoidanceType_$type, /*@__PURE__*/ enumGetBox(CollisionAvoidanceType_$type, 0)], 'MaximumMarkers:q3:se', [1, 400], 'XAxis::sm', [NumericXAxis.$, null], 'XMemberPath:rf:sn', [2, null], 'YAxis::so', [NumericYAxis.$, null], 'YMemberPath:rj:sp', [2, null], 'TrendLineType::sk', [TrendLineType_$type, /*@__PURE__*/ enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness::sj', [1, 1.5], 'TrendLinePeriod::si', [1, 7], 'TrendLineBrush::sf', [Brush.$, null], 'TrendLineZIndex:q4:sl', [1, 1001], 'TrendLineDashArray:sr:sg', [DoubleCollection.$], 'TrendLineDashCap:ss:sh', [PenLineCap_$type, /*@__PURE__*/ enumGetBox(PenLineCap_$type, 0)]]);
    return ScatterBase;
})();
/**
 * @hidden
 */
export let ScatterSeriesRenderManager = /*@__PURE__*/ (() => {
    class ScatterSeriesRenderManager extends SeriesRenderManager {
        constructor() {
            super(...arguments);
            this.au = null;
            this.av = null;
        }
        c() {
            this.au = new AssigningScatterMarkerStyleEventArgs();
            return this.au;
        }
        a() {
            this.av = new AssigningScatterStyleEventArgs();
            return this.av;
        }
        aw(a, b, c) {
            this.w(a, b, c);
        }
        ax(a, b, c) {
            this.x(a, b, c);
        }
        ay(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.cv = null;
            this.ct = null;
            this.cw = null;
            this.c1 = null;
            this.dc = null;
            this.dd = null;
            this.cx = null;
            this.db = null;
            this.cy = null;
            this.cw = a;
            this.cy = new HashPool$2(Base.$, Marker.$);
            this.ch(this.cy);
            this.cx = new ScatterTrendLineManager();
        }
        as() {
            super.as();
            this.cv = this.cu();
            this.dc = new Path();
            this.dd = new Path();
            if (!this.q) {
                this.cw.q3 = 2000;
            }
        }
        de(a) {
            if (this.db == null) {
                this.db = new DataTemplateMeasureInfo();
                this.db.context = this.k.g();
            }
            this.db.width = a.width;
            this.db.height = a.height;
            this.db.data = a.content;
            let b = a.ah;
            if (b.measure != null) {
                b.measure(this.db);
            }
            return new Size(1, this.db.width, this.db.height);
        }
        cu() {
            let a = new NumericMarkerManager(1, (b) => this.cy.item(b), (b) => this.cw.p3.c.item(b), runOn(this, this.c9), runOn(this, this.cr), runOn(this, this.cz), () => this.cw.pv);
            a.q = runOn(this, this.de);
            return a;
        }
        c9(a) {
            this.cw.r1(a, this.cy);
        }
        c0() {
            return this.b4;
        }
        cs() {
            return this.ct;
        }
        cr() {
            this.ct = this.cw.pq(this, this.cy, this.ct, this.bv, this.bu);
            return this.ct;
        }
        cz() {
            this.c1 = this.cw.qw(this.cy, this.c1);
            return this.c1;
        }
        c2() {
        }
        c7(a) {
        }
        c3() {
        }
        c8(a) {
        }
        da() {
            if (this.cw.trendLineBrush != null) {
                this.cw.sq = this.cw.trendLineBrush;
            }
            else {
                this.cw.sq = this.cw.m9;
            }
        }
        cf(a) {
            this.cy.f(a);
        }
        c5(a) {
            this.cy.g(a);
        }
        c6() {
        }
        a5(a, b) {
            super.a5(a, b);
            if (a.d) {
                if (this.cw.trendLineType != 0 && !b) {
                    let c = this.cx.g$j;
                    c.ac = this.cw.trendLineThickness;
                    c._stroke = this.cw.sq;
                    c.ai = this.cw.sr;
                    c.ad = this.cw.ss;
                    a.u(c);
                }
            }
        }
        c4(a) {
            if (a) {
                this.c6();
                this.cy.clear();
            }
            this.cx.g$d();
            this.aq();
        }
        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.cw.gy + "</span><br/><span>" + "x: </span><span class='ui-priority-primary'>${item." + this.cw.rf + "}</span><br/><span>" + "y: </span><span class='ui-priority-primary'>${item." + this.cw.rj + "}</span></div>";
            return a;
        }
    }
    ScatterBaseView.$t = /*@__PURE__*/ markType(ScatterBaseView, 'ScatterBaseView', MarkerSeriesView.$);
    return ScatterBaseView;
})();
//# sourceMappingURL=ScatterBase_combined.js.map
