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