/*
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 { Series } from "./Series";
import { NumericXAxis } from "./NumericXAxis";
import { DependencyProperty } from "igniteui-react-core";
import { NumericYAxis } from "./NumericYAxis";
import { Color } from "igniteui-react-core";
import { ScatterFrame } from "./ScatterFrame";
import { KDTree2D } from "./KDTree2D";
import { typeGetValue, runOn, delegateRemove, typeCast, delegateCombine, markType, markDep, toNullable } from "igniteui-react-core";
import { Rect } from "igniteui-react-core";
import { IFastItemsSource_$type } from "igniteui-react-core";
import { SeriesView } from "./SeriesView";
import { List$1 } from "igniteui-react-core";
import { KDPointData } from "./KDPointData";
import { ScalerParams } from "./ScalerParams";
import { ProgressiveLoadStatusEventArgs } from "./ProgressiveLoadStatusEventArgs";
import { SearchArgs } from "./SearchArgs";
import { KDTreeNode2D } from "./KDTreeNode2D";
import { AxisRange } from "./AxisRange";
import { PropertyMetadata } from "igniteui-react-core";
import { truncate, isNaN_, isInfinity, logBase, intDivide } from "igniteui-react-core";
import { boxArray$1, arrayShallowClone } from "igniteui-react-core";
import { dateNow } from "igniteui-react-core";
import { RenderingContext } from "igniteui-react-core";
import { CanvasViewRenderer } from "igniteui-react-core";
import { Rectangle } from "igniteui-react-core";
/**
 * @hidden
 */
export let HighDensityScatterSeries = /*@__PURE__*/ (() => {
    class HighDensityScatterSeries extends Series {
        constructor() {
            super();
            this.om = null;
            this.oo = null;
            this.pu = 0;
            this.oq = false;
            this.pa = 0;
            this.o9 = 0;
            this.o8 = 0;
            this.o7 = 255;
            this.o6 = 0;
            this.o5 = 0;
            this.pd = 255;
            this.pc = 0;
            this.pb = 0;
            this.oe = null;
            this.oj = null;
            this.ok = null;
            this.of = null;
            this.oh = null;
            this.os = false;
            this.pv = 0;
            this.px = 0;
            this.pr = 0;
            this.pq = 0;
            this.progressiveLoadStatusChanged = null;
            this.ox = null;
            this.o3 = 0;
            this.o2 = 0;
            this.o4 = 0;
            this.pg = 0;
            this.pe = 0;
            this.pf = 0;
            this.ph = 0;
            this.pj = 0;
            this.pl = 0;
            this.pk = 0;
            this.pi = 0;
            this.oz = 0;
            this.o0 = 0;
            this.o1 = 0;
            this.oy = 0;
            this.pt = 0;
            this.ps = 0;
            this.ob = null;
            this.pw = 0;
            this.or = false;
            this._itemIndexes = null;
            this.oc = null;
            this.n9 = null;
            this.ol = null;
            this.ab = HighDensityScatterSeries.$;
            this.dn = false;
        }
        get_dj() {
            return true;
        }
        get on() {
            return this.om;
        }
        set on(a) {
            if (this.om != a) {
                let b = this.on;
                this.om = a;
                this.raisePropertyChanged("XColumn", b, this.on);
            }
        }
        gt(a, b) {
            let c = this.ic(b);
            if (c == HighDensityScatterSeries.$$p[8]) {
                return this.gu(a, b, this.qc);
            }
            if (c == HighDensityScatterSeries.$$p[10]) {
                return this.gu(a, b, this.qg);
            }
            return super.gt(a, b);
        }
        get op() {
            return this.oo;
        }
        set op(a) {
            if (this.oo != a) {
                let b = this.op;
                this.oo = a;
                this.raisePropertyChanged("YColumn", b, this.op);
            }
        }
        qu() {
            if (this.oe == null) {
                return;
            }
            this.oe.s();
            let a = this.oe;
            a.progressiveThunkCompleted = delegateRemove(a.progressiveThunkCompleted, runOn(this, this.qi));
            this.oe = null;
        }
        kp(a, b, c, d) {
            super.kp(a, b, c, d);
            switch (b) {
                case "SeriesViewer":
                    if (this.b6 != null) {
                        let e = this.getEffectiveViewport1(this.bs);
                        this.or = !e.isEmpty;
                    }
                    break;
                case "FastItemsSource":
                    this.qu();
                    if (typeCast(IFastItemsSource_$type, c) != null) {
                        c.deregisterColumn(this.on);
                        c.deregisterColumn(this.op);
                        this.on = null;
                        this.op = null;
                    }
                    if (typeCast(IFastItemsSource_$type, d) != null) {
                        this.on = this.ca(this.qc);
                        this.op = this.ca(this.qg);
                    }
                    if ((this.oi != null && !this.oi.cn()) || (this.og != null && !this.og.cn())) {
                        this.k3(false);
                    }
                    this.kb();
                    break;
                case HighDensityScatterSeries.$$p[7]:
                    let f = this.of;
                    this.of = this.og;
                    this.qu();
                    if (f != null) {
                        f.rangeChanged = delegateRemove(f.rangeChanged, runOn(this, this.ql));
                    }
                    if (this.of != null) {
                        let g = this.of;
                        g.rangeChanged = delegateCombine(g.rangeChanged, runOn(this, this.ql));
                    }
                    if (c != null) {
                        c.bx(this);
                    }
                    if (d != null) {
                        d.ck(this);
                    }
                    if ((this.og != null && !this.og.cn()) || (d == null && c != null)) {
                        this.k3(false);
                    }
                    break;
                case HighDensityScatterSeries.$$p[9]:
                    let h = this.oh;
                    this.oh = this.oi;
                    this.qu();
                    if (h != null) {
                        h.rangeChanged = delegateRemove(h.rangeChanged, runOn(this, this.ql));
                    }
                    if (this.oh != null) {
                        let i = this.oh;
                        i.rangeChanged = delegateCombine(i.rangeChanged, runOn(this, this.ql));
                    }
                    if (c != null) {
                        c.bx(this);
                    }
                    if (d != null) {
                        d.ck(this);
                    }
                    if ((this.oi != null && !this.oi.cn()) || (d == null && c != null)) {
                        this.k3(false);
                    }
                    break;
                case "MouseOverEnabled":
                    this.os = this.dn;
                    this.k3(false);
                    break;
                case HighDensityScatterSeries.$$p[8]:
                    if (this.cd != null) {
                        this.cd.deregisterColumn(this.on);
                        this.on = this.ca(this.qc);
                    }
                    break;
                case "XColumn":
                    this.qu();
                    if (this.og != null && !this.og.cn()) {
                        this.k3(false);
                    }
                    this.kb();
                    break;
                case HighDensityScatterSeries.$$p[10]:
                    if (this.cd != null) {
                        this.cd.deregisterColumn(this.op);
                        this.op = this.ca(this.qg);
                    }
                    break;
                case "YColumn":
                    this.qu();
                    if (this.oi != null && !this.oi.cn()) {
                        this.k3(false);
                    }
                    this.kb();
                    break;
                case HighDensityScatterSeries.$$p[6]:
                    this.qu();
                    this.k3(false);
                    this.ka();
                    break;
                case HighDensityScatterSeries.$$p[3]:
                    this.k3(false);
                    this.ka();
                    break;
                case HighDensityScatterSeries.$$p[1]:
                    this.k3(false);
                    this.ka();
                    break;
                case HighDensityScatterSeries.$$p[0]:
                case HighDensityScatterSeries.$$p[2]:
                    if (!this.od.b1(this.q9, this.q8)) {
                        return;
                    }
                    this.pa = this.q9.o;
                    this.o9 = this.q9.n;
                    this.o8 = this.q9.m;
                    this.o7 = this.q8.o;
                    this.o6 = this.q8.n;
                    this.o5 = this.q8.m;
                    this.pd = this.o7 - this.pa;
                    this.pc = this.o6 - this.o9;
                    this.pb = this.o5 - this.o8;
                    this.k3(false);
                    this.ka();
                    break;
                case HighDensityScatterSeries.$$p[4]:
                    this.pu = Math.max(typeGetValue(d) - 1, 0);
                    this.oq = this.pu > 0;
                    this.k3(false);
                    this.ka();
                    break;
                case HighDensityScatterSeries.$$p[5]:
                    this.k3(false);
                    this.ka();
                    break;
            }
        }
        ou(a) {
            if (typeCast(NumericYAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        ot(a) {
            if (typeCast(NumericXAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        ql(a, b) {
            this.qu();
            this.k3(false);
        }
        ec(a, b, c) {
            let d = super.ec(a, b, c);
            if (this.oi == null || this.og == null || this.og.bh == null || this.oi.bh == null || this.op == null || this.on == null || this.op.count < 1 || this.on.count < 1 || this.op.count != this.on.count || this.og.kd == this.og.kc || this.oi.kd == this.oi.kc || this.n6.isEmpty) {
                d = false;
            }
            return d;
        }
        get p1() {
            return this.pv;
        }
        set p1(a) {
            let b = this.pv;
            this.pv = a;
            this.raisePropertyChanged("ProgressiveStatus", b, this.pv);
        }
        k4(a) {
            super.k4(a);
            this.qn(a, this.bs);
        }
        qn(a, b) {
            if (this.cp(b)) {
                return;
            }
            if (this.oe == null && !this.ow) {
                let c = new List$1(KDPointData.$, 2, this.on.count);
                let d = this.og;
                let e = this.oi;
                let f = new Rect(0, 0, 0, 1, 1);
                let g = new Rect(0, 0, 0, 1, 1);
                let h = new ScalerParams(1, f, g, d.ca);
                let i = new ScalerParams(1, f, g, e.ca);
                let j;
                let k;
                for (let l = 0; l < this.on.count; l++) {
                    j = d.dz(this.on.item(l), h);
                    k = e.dz(this.op.item(l), i);
                    if (!isNaN_(j) && !isNaN_(k) && !isInfinity(j) && !isInfinity(k)) {
                        c.add(((() => {
                            let $ret = new KDPointData();
                            $ret.a = j;
                            $ret.b = k;
                            $ret.c = l;
                            return $ret;
                        })()));
                    }
                }
                if (this.ov) {
                    this.pq = 1;
                    this.pr = truncate(logBase(c.count, 2)) + 3;
                    this.p1 = truncate(((this.pq / this.pr) * 100));
                    if (this.progressiveLoadStatusChanged != null) {
                        this.progressiveLoadStatusChanged(this, new ProgressiveLoadStatusEventArgs(this.p1));
                    }
                    this.oe = KDTree2D.b(c.toArray(), 1);
                    let m = this.oe;
                    m.progressiveThunkCompleted = delegateCombine(m.progressiveThunkCompleted, runOn(this, this.qi));
                    if (!this.oe.f(this.f5)) {
                        let n = this.oe;
                        n.progressiveThunkCompleted = delegateRemove(n.progressiveThunkCompleted, runOn(this, this.qi));
                    }
                    this.ka();
                }
                else {
                    let o = dateNow();
                    this.oe = new KDTree2D(0, c.toArray(), 1);
                    let p = dateNow();
                }
            }
            if (this.ov && !this.ow) {
                this.qo(b);
            }
            else {
                this.qp(b);
            }
        }
        jo(a, b, c, d) {
            super.jo(a, b, c, d);
            this.qu();
            let e = false;
            if (this.og != null && !this.og.cn()) {
                e = true;
            }
            if (this.oi != null && !this.oi.cn()) {
                e = true;
            }
            if (e) {
                this.k3(false);
            }
            this.kb();
        }
        qk(a) {
            let b = a;
            let c = this.pt * this.ps;
            if (this.os) {
                if (this._itemIndexes == null || this._itemIndexes.length != c) {
                    this._itemIndexes = new Array(c);
                    for (let d = 0; d < c; d++) {
                        this._itemIndexes[d] = 0;
                    }
                }
                else {
                    for (let e = 0; e < c; e++) {
                        this._itemIndexes[e] = 0;
                    }
                }
            }
        }
        qp(a) {
            let b;
            let c;
            let d = null;
            if (a.q) {
                d = this._itemIndexes;
            }
            let e = a.getViewInfo(c, b);
            c = e.p0;
            b = e.p1;
            let f = a;
            let g = this.getEffectiveViewport1(a);
            this.oj = new ScalerParams(0, b, c, this.of.ca, g);
            this.ok = new ScalerParams(0, b, c, this.oh.ca, g);
            this.qj(a);
            this.qk(a);
            let h = this.pt * this.ps;
            if (this.oc == null || this.oc.length != h) {
                this.oc = new Array(h);
                this.n9 = new Array(h);
            }
            let i = this.oc.length;
            let j = this.oc;
            let k = this.n9;
            for (let l = 0; l < i; l++) {
                j[l] = 0;
                k[l] = 0;
            }
            this.px = truncate(Math.round(this.fq));
            this.ob = f.by();
            let m = this.ob.length;
            let n = this.ob;
            for (let o = 0; o < m; o++) {
                n[o] = 0;
            }
            let p = this.po;
            let q = this.pn;
            if (isNaN_(p) || isInfinity(p)) {
                p = 0;
            }
            if (isNaN_(q) || isInfinity(q)) {
                q = 50;
            }
            this.o3 = Math.min(p, q);
            this.o2 = Math.max(p, q);
            if (this.o3 < 0) {
                this.o3 = 0;
            }
            if (this.o2 < 0) {
                this.o2 = 0;
            }
            this.o4 = this.o2 - this.o3;
            if (this.ow) {
                this.qm(a);
            }
            else {
                this.qw(a);
            }
            f.b9();
            if (a.q) {
                this._itemIndexes = d;
                this.od.ca();
            }
        }
        qo(a) {
            if (this.oe == null) {
                return;
            }
            this.qp(a);
        }
        qi(a, b) {
            this.od.b8(() => {
                if (this.pq < this.pr - 1) {
                    this.pq++;
                }
                this.p1 = truncate(((this.pq / this.pr) * 100));
                if (this.progressiveLoadStatusChanged != null) {
                    this.progressiveLoadStatusChanged(this, new ProgressiveLoadStatusEventArgs(this.p1));
                }
                this.qo(this.bs);
                this.ka();
                if (this.oe != null) {
                    if (!this.oe.f(this.f5)) {
                        let c = this.oe;
                        c.progressiveThunkCompleted = delegateRemove(c.progressiveThunkCompleted, runOn(this, this.qi));
                        this.p1 = 100;
                        if (this.progressiveLoadStatusChanged != null) {
                            this.progressiveLoadStatusChanged(this, new ProgressiveLoadStatusEventArgs(this.p1));
                        }
                    }
                }
            });
        }
        qm(a) {
            let b = arrayShallowClone(this.on.asArray());
            this.og.gt(boxArray$1(b), 0, b.length, this.oj);
            let c = arrayShallowClone(this.op.asArray());
            this.pw = 0;
            let d = this.pu;
            let e = this.oq;
            let f = this.oc.length;
            this.oi.gt(boxArray$1(c), 0, c.length, this.ok);
            let g = 255 << 24 | truncate(this.pa) << 16 | truncate(this.o9) << 8 | truncate(this.o8);
            for (let h = 0; h < b.length; h++) {
                let i = truncate(b[h]);
                let j = truncate(c[h]);
                i = truncate(Math.floor(i));
                j = truncate(Math.floor(j));
                if (i < 0 || i >= this.pt || j < 0 || j >= this.ps) {
                    continue;
                }
                if (e) {
                    let k = i - d;
                    let l = i + d;
                    l = l > (this.pt - 1) ? (this.pt - 1) : l;
                    k = k < 0 ? 0 : k;
                    let m = j + d;
                    let n = j - d;
                    for (let o = k; o <= l; o++) {
                        for (let p = n; p <= m; p++) {
                            let q = (p * this.pt) + o;
                            if (q < 0 || q > f - 1) {
                                continue;
                            }
                            this.oc[q] = this.oc[q] + 1;
                            this.n9[q] = 1;
                            this.pw++;
                            if (this.os) {
                                this._itemIndexes[q] = h + 1;
                            }
                        }
                    }
                }
                else {
                    let r = (j * this.pt) + i;
                    this.oc[r] = this.oc[r] + 1;
                    this.n9[r] = 1;
                    this.pw++;
                    if (this.os) {
                        this._itemIndexes[r] = h + 1;
                    }
                }
            }
            this.qq();
        }
        qw(a) {
            let b;
            let c;
            let d = a.getViewInfo(b, c);
            b = d.p0;
            c = d.p1;
            if (this.oe == null) {
                return;
            }
            if (this.ox == null) {
                this.ox = new List$1(KDTreeNode2D.$, 2, truncate(Math.round(b.width * b.height)));
            }
            else {
                this.ox.clear();
            }
            let e = c.left;
            let f = c.right;
            let g = c.top;
            let h = c.bottom;
            this.pk = c.top;
            this.pi = c.height;
            this.pj = c.left;
            this.pl = c.width;
            this.pg = b.top;
            this.pe = b.height;
            this.pf = b.left;
            this.ph = b.width;
            let i = this.getEffectiveViewport1(a);
            this.oz = (i.left - this.pf) / this.ph;
            this.o0 = (i.top - this.pg) / this.pe;
            let j = (i.right - this.pf) / this.ph;
            this.o1 = j - this.oz;
            let k = (i.bottom - this.pg) / this.pe;
            this.oy = k - this.o0;
            if (this.or) {
                e = (e - this.oz) / this.o1;
                f = (f - this.oz) / this.o1;
                g = (g - this.o0) / this.oy;
                h = (h - this.o0) / this.oy;
            }
            let l = this.fq / b.width * c.width;
            let m = this.fq / b.height * c.height;
            let n = Math.min(l, m);
            let o = ((() => {
                let $ret = new SearchArgs();
                $ret.c = e;
                $ret.a = f;
                $ret.d = g;
                $ret.b = h;
                $ret.e = l;
                $ret.f = m;
                $ret.g = 0x7FFFFFFF;
                return $ret;
            })());
            this.oe.t(this.ox, o, 0, 1, 0, 1);
            let p;
            this.pw = 0;
            for (let q = 0; q < this.ox.count; q++) {
                p = this.ox._inner[q];
                this.qr(p);
            }
            this.qq();
        }
        qr(a) {
            if (a.g) {
                return;
            }
            let b = a.e != null && a.e.a;
            let c = a.a == null ? 0 : a.a.length;
            let d = (a.h - c) + 1;
            if (b && d > 0) {
            }
            else {
                d = 1;
            }
            this.qt(a.b, d, b, a.e);
            if (c > 0 && !b) {
                let e;
                for (let f = 0; f < c; f++) {
                    e = a.a[f];
                    this.qt(e, d, false, a.e);
                }
            }
            if (a.e != null) {
                a.e.a = false;
            }
        }
        dq(a) {
            let b = this.b6 != null ? this.b6.os : Rect.empty;
            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.og.ca, e);
            let g = new ScalerParams(0, d, d, this.oi.ca, e);
            let h = !b.isEmpty && !c.isEmpty && this.cd != null ? this.cd.indexOf(a) : -1;
            let i = this.og != null && this.on != null && h < this.on.count ? this.og.dz(this.on.item(h), f) : NaN;
            let j = this.oi != null && this.op != null && h < this.op.count ? this.oi.dz(this.op.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;
        }
        qt(a, b, c, d) {
            let e = this.pz(b);
            let f = a.c;
            let g = this.pu;
            if (c) {
                let h = d.d;
                let i = d.b;
                let j = d.e;
                let k = d.c;
                if (this.or) {
                    h = this.oz + this.o1 * h;
                    i = this.oz + this.o1 * i;
                    j = this.o0 + this.oy * j;
                    k = this.o0 + this.oy * k;
                }
                let l = truncate((this.pf + this.ph * (h - this.pj) / this.pl));
                let m = truncate((this.pf + this.ph * (i - this.pj) / this.pl));
                let n = truncate((this.pg + this.pe * (j - this.pk) / this.pi));
                let o = truncate((this.pg + this.pe * (k - this.pk) / this.pi));
                l = truncate(Math.floor(l));
                m = truncate(Math.floor(m));
                n = truncate(Math.floor(n));
                o = truncate(Math.floor(o));
                if (this.oq) {
                    l -= g;
                    m += g;
                    n -= g;
                    o += g;
                }
                let p = ((m - l) + 1) * ((o - n) + 1);
                let q = b / p;
                let r = q;
                for (let s = l; s <= m; s++) {
                    for (let t = n; t <= o; t++) {
                        this.qs(f, s, t, q, r);
                    }
                }
            }
            else {
                let u = a.a;
                let v = a.b;
                if (this.or) {
                    u = this.oz + this.o1 * u;
                    v = this.o0 + this.oy * v;
                }
                let w = truncate((this.pf + this.ph * (u - this.pj) / this.pl));
                let x = truncate((this.pg + this.pe * (v - this.pk) / this.pi));
                w = truncate(Math.floor(w));
                x = truncate(Math.floor(x));
                if (this.oq) {
                    let y = w - g;
                    let z = w + g;
                    let aa = x + g;
                    let ab = x - g;
                    let ac = ((z - y) + 1) * ((aa - ab) + 1);
                    let ad = b / ac;
                    let ae = ad;
                    for (let af = y; af <= z; af++) {
                        for (let ag = ab; ag <= aa; ag++) {
                            this.qs(f, af, ag, ad, ae);
                        }
                    }
                }
                else {
                    this.qs(f, w, x, b, 1);
                }
            }
        }
        py(a, b) {
            return truncate((Math.floor(255 * b))) << 24 | truncate(Math.floor(b * (this.pa + a * this.pd))) << 16 | truncate(Math.floor(b * (this.o9 + a * this.pc))) << 8 | truncate(Math.floor(b * (this.o8 + a * this.pb)));
        }
        pz(a) {
            return 255 << 24 | truncate(Math.floor((this.pa + a * this.pd))) << 16 | truncate(Math.floor((this.o9 + a * this.pc))) << 8 | truncate(Math.floor((this.o8 + a * this.pb)));
        }
        pm(a) {
            return (a >> 24 & 255) / 255;
        }
        qs(a, b, c, d, e) {
            if (b < 0 || b >= this.pt || c < 0 || c >= this.ps) {
                return;
            }
            let f = (c * this.pt) + b;
            this.oc[f] = this.oc[f] + d;
            this.n9[f] = this.n9[f] + e;
            if (this.os) {
                this._itemIndexes[f] = a + 1;
            }
            this.pw += truncate(d);
        }
        qq() {
            let a = 0;
            let b = 0;
            let c = this.o4;
            let d = this.o3;
            let e = this.o2;
            let f = this.oc.length;
            let g = this.oc;
            let h = this.n9;
            let i = this.ob;
            let j = NaN;
            let k = NaN;
            let l = 0;
            let m = 0;
            for (let n = 0; n < f; n++) {
                a = g[n];
                if (a != 0) {
                    b = h[n];
                    if (a >= e) {
                        a = 1;
                    }
                    else if (a <= d) {
                        a = 0;
                    }
                    else {
                        a = (a - d) / (c);
                    }
                    if (b > 1) {
                        b = 1;
                    }
                    if (b < 0.2) {
                        b = 0.2;
                    }
                    if (j != a || k != b) {
                        l = this.py(a, b);
                        j = a;
                        k = b;
                    }
                    i[m] = l >> 16 & 255;
                    i[m + 1] = l >> 8 & 255;
                    i[m + 2] = l & 255;
                    i[m + 3] = l >> 24 & 255;
                }
                m += 4;
            }
        }
        qj(a) {
            let b = a;
            b.b6();
        }
        bp() {
            return new HighDensityScatterSeriesView(this);
        }
        kk(a) {
            super.kk(a);
            this.od = a;
        }
        ao(a) {
            if (a != null && a == this.og && this.on != null) {
                return new AxisRange(this.on.minimum, this.on.maximum);
            }
            if (a != null && a == this.oi && this.op != null) {
                return new AxisRange(this.op.minimum, this.op.maximum);
            }
            return null;
        }
        ln(a, b) {
            if (this.b6 != null) {
                let c = this.getEffectiveViewport1(this.bs);
                this.or = !c.isEmpty;
            }
            this.k3(false);
        }
        lo(a, b) {
            this.k3(false);
        }
        gq(a) {
            if (!this.os || this._itemIndexes == null || this.b6 == null || this.cd == null || this._itemIndexes.length != (this.pt * this.ps)) {
                return null;
            }
            let b = this.b6.os;
            let c = (a.x - b.left) / b.width;
            let d = (a.y - b.top) / b.height;
            let e = truncate(Math.round(this.n6.left + (this.n6.width * c)));
            let f = truncate(Math.round(this.n6.top + (this.n6.height * d)));
            let g = this.p2(e, f);
            if (g < 0 || g > this._itemIndexes.length - 1) {
                return null;
            }
            let h = this._itemIndexes[g] - 1;
            if (h < 0 || h > this.cd.count) {
                return null;
            }
            return this.cd.item(h);
        }
        p2(a, b) {
            let c = (this.pt * b) + a;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            let d = 1;
            c = (this.pt * (b - d)) + a;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            c = (this.pt * (b + d)) + a;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            c = (this.pt * (b)) + a - 1;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            c = (this.pt * (b)) + a + 1;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            c = (this.pt * (b - d)) + a - 1;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            c = (this.pt * (b + d)) + a + 1;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            c = (this.pt * (b - d)) + a + 1;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            c = (this.pt * (b + d)) + a - 1;
            if (c > 0 && c < this._itemIndexes.length && this._itemIndexes[c] > 0) {
                return c;
            }
            return 0;
        }
        qv(a, b, c) {
            this.ob = a;
            this.pt = b;
            this.ps = c;
        }
        get_d6() {
            return true;
        }
        set_d6(a) {
            super.set_d6(a);
        }
        jl(a, b) {
            super.jl(a, b);
            this.od.b7();
            if (this.br != null) {
                this.br.b7();
            }
            this.ka();
        }
        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(HighDensityScatterSeriesView.$, this.br);
            let d = new ScatterFrame();
            this.qn(false, 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.ol == null) {
                this.ol = new ScatterFrame();
            }
            this.qn(false, f);
        }
        ji() {
            super.ji();
            this.og = null;
            this.oi = null;
        }
    }
    HighDensityScatterSeries.$t = /*@__PURE__*/ markType(HighDensityScatterSeries, 'HighDensityScatterSeries', Series.$);
    HighDensityScatterSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, HighDensityScatterSeries, 'raisePropertyChanged', ['HeatMaximumColor:q8:qx', [Color.$, null], 'HeatMaximum:pn:qy', [1, 50], 'HeatMinimumColor:q9:qz', [Color.$, null], 'HeatMinimum:po:q0', [1, 0], 'PointExtent:p0:q1', [1, 1], 'ProgressiveLoad:ov:q2', [0, true], 'UseBruteForce:ow:q3', [0, false], 'XAxis:og:q4', [NumericXAxis.$, null], 'XMemberPath:qc:q5', [2, null], 'YAxis:oi:q6', [NumericYAxis.$, null], 'YMemberPath:qg:q7', [2, null]]);
    return HighDensityScatterSeries;
})();
/**
 * @hidden
 */
export let HighDensityScatterSeriesView = /*@__PURE__*/ (() => {
    class HighDensityScatterSeriesView extends SeriesView {
        constructor(a) {
            super(a);
            this.bz = null;
            this.bx = null;
            this.b5 = 0;
            this.b4 = 0;
            this.b2 = null;
            this.b3 = null;
            this.b0 = null;
            this.bz = a;
        }
        as() {
            super.as();
            if (!this.q) {
                this.e.fq = 4;
                this.bz.q9 = Color.u(255, 238, 88, 121);
                this.bz.q8 = Color.u(255, 139, 91, 177);
            }
        }
        ca() {
            this.bz.qv(this.bx, this.b5, this.b4);
        }
        b6() {
            if (this.b2 == null) {
                this.b2 = this.e.f5.createElement("canvas");
                let a = this.e.f5.get2DCanvasContext(this.b2);
                this.b0 = new RenderingContext(new CanvasViewRenderer(), a);
            }
            let b;
            if (this.p) {
                b = this.bu;
            }
            else {
                b = this.e.b6.ox();
            }
            let c = truncate(Math.round(b.left));
            let d = truncate(Math.round(b.top));
            let e = truncate(Math.round(b.width));
            let f = truncate(Math.round(b.height));
            let g = this.b5;
            let h = this.b4;
            this.b5 = e;
            this.b4 = f;
            if (g != this.b5 || h != this.b4 || this.bx == null) {
                this.b2.setAttribute("width", e.toString());
                this.b2.setAttribute("height", f.toString());
                this.b3 = this.b0.g().getImageData(0, 0, e, f);
                let imageDataArray_ = this.b3.data;
                this.bx = imageDataArray_;
            }
            this.bz.qv(this.bx, this.b5, this.b4);
        }
        by() {
            return this.bx;
        }
        b9() {
            let a = truncate(Math.round(this.bu.left));
            let b = truncate(Math.round(this.bu.left));
            let c = truncate(Math.round(this.bu.width));
            let d = truncate(Math.round(this.bu.height));
            this.b0.g().putImageData(this.b3, 0, 0);
            this.aq();
        }
        b8(a) {
            if (this.e.f5 != null) {
                this.e.f5.setTimeout(a, 0);
            }
            else {
                window.setTimeout(a, 0);
            }
        }
        a6(a, b) {
            super.a6(a, b);
            if (b) {
                if (!this.bz.dn) {
                    return;
                }
                let c = new Rectangle();
                c.n = this.bu.left;
                c.o = this.bu.top;
                c.width = this.bu.width;
                c.height = this.bu.height;
                c._fill = this.bo();
                a.v(c);
                return;
            }
            if (this.b2 == null) {
                return;
            }
            let d = truncate(Math.round(this.bu.left));
            let e = truncate(Math.round(this.bu.top));
            let f = truncate(Math.round(this.bu.width));
            let g = truncate(Math.round(this.bu.height));
            this.k.n(this.b2.getNativeElement(), this.e._opacity, d, e, f, g, d, e, f, g);
        }
        b1(a, b) {
            return Color.e(toNullable(Color.$, a), toNullable(Color.$, null)) && Color.e(toNullable(Color.$, b), toNullable(Color.$, null));
        }
        b7() {
            if (this.bx != null) {
                for (let a = 0; a < this.bx.length; a++) {
                    this.bx[a] = 0;
                }
                this.b9();
            }
        }
        al(a) {
            super.al(a);
            if (this.bx == null) {
                this.e.a5.exportSeriesPixelsData(a, null, this.b5, this.b4);
                return;
            }
            let b = new Array(intDivide(this.bx.length, 4));
            let c;
            for (let d = 0; d < intDivide(this.bx.length, 4); d++) {
                c = d * 4;
                b[d] = this.bx[c + 3] << 24 | this.bx[c] << 16 | this.bx[c + 1] << 8 | this.bx[c + 2];
            }
            this.e.a5.exportSeriesPixelsData(a, b, this.b5, this.b4);
        }
    }
    HighDensityScatterSeriesView.$t = /*@__PURE__*/ markType(HighDensityScatterSeriesView, 'HighDensityScatterSeriesView', SeriesView.$);
    return HighDensityScatterSeriesView;
})();
//# sourceMappingURL=HighDensityScatterSeries_combined.js.map
