/*
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 { ShapeSeriesBase } from "./ShapeSeriesBase";
import { ShapeAxisInfoCache } from "./ShapeAxisInfoCache";
import { StyleSelector } from "./StyleSelector";
import { DependencyProperty } from "igniteui-react-core";
import { Style } from "igniteui-react-core";
import { MarkerType_$type } from "./MarkerType";
import { DataTemplate } from "igniteui-react-core";
import { Brush } from "igniteui-react-core";
import { CollisionAvoidanceType_$type } from "./CollisionAvoidanceType";
import { MarkerOutlineMode_$type } from "./MarkerOutlineMode";
import { MarkerFillMode_$type } from "./MarkerFillMode";
import { Rect } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { Base, runOn, enumGetBox, Number_$type, typeCast, fromEnum, markType, markDep, PointUtil } from "igniteui-react-core";
import { Dictionary$2 } from "igniteui-react-core";
import { OwnedPoint } from "./OwnedPoint";
import { ShapeSeriesViewBase } from "./ShapeSeriesViewBase";
import { Marker } from "./Marker";
import { MarkerSeries } from "./MarkerSeries";
import { BrushUtil } from "igniteui-react-core";
import { DataContext } from "igniteui-react-core";
import { HashPool$2 } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { RectUtil } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { DeviceUtils } from "igniteui-react-core";
import { isNaN_, isInfinity } from "igniteui-react-core";
import { NumericMarkerManager } from "./NumericMarkerManager";
import { DataTemplateMeasureInfo } from "igniteui-react-core";
import { Size } from "igniteui-react-core";
import { DataTemplatePassInfo } from "igniteui-react-core";
import { DataTemplateRenderInfo } from "igniteui-react-core";
import { MarkerVisualData } from "./MarkerVisualData";
import { stringIsNullOrEmpty } from "igniteui-react-core";
/**
 * @hidden
 */
export let ScatterPolygonSeries = /*@__PURE__*/ (() => {
    class ScatterPolygonSeries extends ShapeSeriesBase {
        constructor() {
            super();
            this.rb = null;
            this.q8 = new ScalerParams(1, ScatterPolygonSeries.sg, ScatterPolygonSeries.sg, false);
            this.q9 = new ScalerParams(1, ScatterPolygonSeries.sg, ScatterPolygonSeries.sg, false);
            this.q3 = 1;
            this.qz = 1;
            this.ab = ScatterPolygonSeries.$;
        }
        pi() {
            return this.rd();
        }
        qh(a) {
            let b = a;
            b.cv(this.si);
            b.cw(this.rc);
            super.qh(a);
            if (this.cp(a)) {
                return;
            }
            let c, d;
            let e = a.getViewInfo(c, d);
            c = e.p0;
            d = e.p1;
            let f = this.getEffectiveViewport1(a);
            this.q8 = new ScalerParams(1, d, c, this.oq.ca);
            this.q8.c = f;
            this.q9 = new ScalerParams(1, d, c, this.os.ca);
            this.q9.c = f;
            if (c.width < 1 || c.height < 1) {
                return;
            }
            this.rb = ((() => {
                let $ret = new ShapeAxisInfoCache();
                $ret.a = this.oq;
                $ret.b = this.os;
                $ret.e = this.oq.ca;
                $ret.f = this.os.ca;
                $ret.d = this.cd;
                $ret.c = this.o0;
                return $ret;
            })());
            if (this.rd()) {
                let g = new Dictionary$2(Base.$, OwnedPoint.$, 0);
                b.dd.l(g, 400, d, c, this.fq);
                b.dd.j(g, false);
                if (this.pg()) {
                    this.ru(a);
                }
            }
        }
        ru(a) {
            a.dh = true;
            this.ox.aw(this, this.pg(), runOn(this, this.of));
            let b = this.ox.d;
            let c = b != null;
            let d = this.getEffectiveViewport1(a);
            let e = this.cd == null ? 0 : this.cd.count;
            a.dq((f) => {
                if (f._visibility == 0) {
                    let g = f.ak;
                    let h = f.content;
                    if (h == null) {
                        h = new DataContext();
                        f.content = h;
                    }
                    if (c) {
                        this.qc(g, e, a.q);
                    }
                    this.ox.ac(f, h);
                }
            });
        }
        rd() {
            return this.rw != null && ((this.q7 != 1 && this.q7 != 0) || this.rx != null);
        }
        bp() {
            return new ScatterPolygonSeriesView(this);
        }
        kk(a) {
            super.kk(a);
            this.ra = a;
        }
        get_hasMarkers() {
            return true;
        }
        ne() {
            return this.sc;
        }
        nf() {
            return this.sd;
        }
        lu() {
            return this.rw;
        }
        fc() {
            return this.rf;
        }
        get q4() {
            return this.q3;
        }
        set q4(a) {
            this.q3 = a;
        }
        q6() {
            if (this.q5 == 0) {
                return 1;
            }
            return this.q5;
        }
        lj(a) {
            super.lj(a);
            this.q5 = a;
        }
        get q0() {
            return this.qz;
        }
        set q0(a) {
            this.qz = a;
        }
        q2() {
            if (this.q1 == 0) {
                return 1;
            }
            return this.q1;
        }
        li(a) {
            super.li(a);
            this.q1 = a;
        }
        lg() {
            super.lg();
            if (this.rx != null) {
                this.ra.dp();
            }
            else {
                let a = MarkerSeries.oj(this, this.q7);
                let b = MarkerSeries.os(a);
                if (b == null) {
                    this.rw = MarkerSeries.o6;
                }
                else {
                    this.ra.dl(b);
                }
            }
            if (this.se != null) {
                this.ra.dm();
            }
            else {
                if (this.q7 == 13) {
                    this.sc = this.bs.bq();
                }
                else {
                    if (this.q0 != 2) {
                        if (this.b6 != null) {
                            let c = this.b6.oa(this.gi);
                            if (!isNaN_(this.et) && this.et != 1) {
                                c = BrushUtil.n(c, this.et);
                            }
                            this.sc = c;
                        }
                        else {
                            this.sc = null;
                        }
                    }
                }
            }
            if (this.sf != null) {
                this.ra.dn();
            }
            else {
                if (this.q7 == 13) {
                    this.sd = this.bs.bq();
                }
                else {
                    if (this.q5 == 2) {
                        this.sd = this.sc;
                    }
                    else {
                        this.sd = this.b6 == null ? null : this.b6.ob(this.gi);
                    }
                }
            }
            if (this.q0 == 2 && this.se == null && this.q7 != 13) {
                if (this.sd != null) {
                    let d = this.sd;
                    if (!isNaN_(this.et) && this.et != 1) {
                        d = BrushUtil.n(d, this.et);
                    }
                    this.sc = d;
                }
                else {
                    this.sc = null;
                }
            }
        }
        kf() {
            super.kf();
            this.q4 = this.q6();
            this.q0 = this.q2();
        }
        kp(a, b, c, d) {
            super.kp(a, b, c, d);
            switch (b) {
                case ScatterPolygonSeries.$$p[3]:
                case ScatterPolygonSeries.$$p[11]:
                case ScatterPolygonSeries.$$p[7]:
                case ScatterPolygonSeries.$$p[9]:
                case ScatterPolygonSeries.$$p[10]:
                    this.lg();
                    this.k3(false);
                    break;
                case ScatterPolygonSeries.$$p[6]:
                    this.q4 = this.q6();
                    this.lg();
                    this.k3(false);
                    break;
                case ScatterPolygonSeries.$$p[5]:
                    this.q0 = this.q2();
                    this.lg();
                    this.k3(false);
                    break;
                case ScatterPolygonSeries.$$p[2]:
                    if (c == MarkerSeries.o6 || d == MarkerSeries.o6 || (c == null || d != null)) {
                        this.ra.dr();
                        this.k3(false);
                    }
                    this.k3(false);
                    this.ka();
                    break;
                case ScatterPolygonSeries.$$p[12]:
                    this.ra.cv(this.si);
                    this.k3(false);
                    this.ka();
                    break;
                case ScatterPolygonSeries.$$p[13]:
                    this.ra.cw(this.rc);
                    this.k3(false);
                    this.ka();
                    break;
                case ScatterPolygonSeries.$$p[4]:
                    this.k3(false);
                    this.ka();
                    break;
            }
        }
        as(a, b) {
            let c = this.ra.b1(a);
            let d = null;
            if (c != null) {
                d = c.content;
            }
            if (d != null) {
                return d;
            }
            return super.as(a, b);
        }
        rv(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);
            }
        }
        ct(a, b, c) {
            if (!this.hasMarkers) {
                return false;
            }
            let d = this.oq;
            let e = new ScalerParams(1, this.b6.os, this.n6, d.ca);
            e.c = this.getEffectiveViewport1(this.bs);
            let f = this.os;
            let g = new ScalerParams(1, this.b6.os, this.n6, f.ca);
            g.c = this.getEffectiveViewport1(this.bs);
            a.clear();
            this.ra.dq((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;
        }
        qx(a, b, c, d, e) {
            if (c == null || c.length != this.rb.d.count) {
                c = new Array(this.rb.d.count);
                for (let f = 0; f < this.rb.d.count; f++) {
                    c[f] = PointUtil.create();
                }
            }
            let g = ((() => {
                let $ret = new ScalerParams(1, d, e, this.oq.ca);
                $ret.c = this.getEffectiveViewport1(a);
                return $ret;
            })());
            let h = ((() => {
                let $ret = new ScalerParams(1, d, e, this.os.ca);
                $ret.c = this.getEffectiveViewport1(a);
                return $ret;
            })());
            let i = this.ny(a);
            let j = this.rb.a.d2(i.left, g);
            let k = this.rb.a.d2(i.right, g);
            let l = this.rb.b.d2(i.bottom, h);
            let m = this.rb.b.d2(i.top, h);
            if (this.rb.e) {
                let n = j;
                j = k;
                k = n;
            }
            if (this.rb.f) {
                let o = l;
                l = m;
                m = o;
            }
            let p = this.rb;
            let q = p.a;
            let r = p.b;
            let s;
            let t;
            let u = g.d.left;
            let v = g.d.right;
            let w = h.d.top;
            let x = h.d.bottom;
            for (let y = 0; y < this.rb.d.count; y++) {
                s = 0;
                t = 0;
                let z = null;
                let aa = a.b9.tryGetValue(y, z);
                z = aa.p1;
                if (z == null) {
                    c[y].x = NaN;
                    c[y].y = NaN;
                }
                else {
                    let ab = z.c;
                    let ac = RectUtil.l(ab);
                    s = ac.x;
                    t = ac.y;
                    if (s >= u && s <= v && t >= w && t <= x) {
                        c[y].x = s;
                        c[y].y = t;
                    }
                    else {
                        c[y].x = NaN;
                        c[y].y = NaN;
                    }
                }
            }
            return c;
        }
        re(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));
                c++;
            }
            return b;
        }
    }
    ScatterPolygonSeries.$t = /*@__PURE__*/ markType(ScatterPolygonSeries, 'ScatterPolygonSeries', ShapeSeriesBase.$);
    ScatterPolygonSeries.sg = /*@__PURE__*/ new Rect(0, 0, 0, 1, 1);
    ScatterPolygonSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ScatterPolygonSeries, 'raisePropertyChanged', ['ActualMarkerBrush:sc:ry', [Brush.$], 'ActualMarkerOutline:sd:rz', [Brush.$], 'ActualMarkerTemplate:rw:r0', [DataTemplate.$, null], 'MarkerBrush:se:r1', [Brush.$], 'MarkerCollisionAvoidance:qy:r2', [CollisionAvoidanceType_$type, /*@__PURE__*/ enumGetBox(CollisionAvoidanceType_$type, 0)], 'MarkerFillMode:q1:r3', [MarkerFillMode_$type, /*@__PURE__*/ enumGetBox(MarkerFillMode_$type, 0)], 'MarkerOutlineMode:q5:r4', [MarkerOutlineMode_$type, /*@__PURE__*/ enumGetBox(MarkerOutlineMode_$type, 0)], 'MarkerOutline:sf:r5', [Brush.$], 'MarkerStyle:sh:r6', [Style.$], 'MarkerTemplate:rx:r7', [DataTemplate.$, null], 'MarkerThickness:rf:r8', [1, /*@__PURE__*/ DeviceUtils.g(2)], 'MarkerType:q7:r9', [MarkerType_$type, /*@__PURE__*/ enumGetBox(MarkerType_$type, 1)], 'ShapeStyle:si:sa', [Style.$, null], 'ShapeStyleSelector:rc:sb', [StyleSelector.$, null]]);
    return ScatterPolygonSeries;
})();
/**
 * @hidden
 */
export let ScatterPolygonSeriesView = /*@__PURE__*/ (() => {
    class ScatterPolygonSeriesView extends ShapeSeriesViewBase {
        constructor(a) {
            super(a);
            this.dh = false;
            this.c8 = null;
            this.dj = null;
            this.de = null;
            this.dc = null;
            this.dg = false;
            this.df = null;
            this.dk = null;
            this.c9 = new Marker();
            this.dy = null;
            this.c9 = new Marker();
            this.c9.content = new DataContext();
            this.de = a;
            this.df = new HashPool$2(Base.$, Marker.$);
            this.dk = new List$1(Marker.$, 0);
            this.ds(this.df);
            this.dc = new NumericMarkerManager(1, (b) => this.df.item(b), (b) => this.de.rb.d.item(b), runOn(this, this.dw), runOn(this, this.c7), runOn(this, this.di), () => this.de.qy);
            this.dc.q = runOn(this, this.dz);
        }
        as() {
            super.as();
            if (!this.q) {
                this.e.bx = 8;
            }
        }
        get dd() {
            return this.dc;
        }
        dw(a) {
            this.de.rv(a, this.df);
        }
        c7() {
            this.c8 = this.de.qx(this, this.df, this.c8, this.bv, this.bu);
            return this.c8;
        }
        di() {
            this.dj = this.de.re(this.df, this.dj);
            return this.dj;
        }
        c2(a, b) {
            return this.c3(a, b, true);
        }
        cj(a, b, c) {
            super.cj(a, b, c);
            ShapeSeriesViewBase.ci(this, a, b);
        }
        ch(a, b) {
            let c = a;
            if (c == null) {
                return;
            }
            c.ak = b;
        }
        dq(a) {
            this.df.f(a);
        }
        ds(a) {
            a.create = runOn(this, this.db);
            a.destroy = runOn(this, this.du);
            a.activate = runOn(this, this.dt);
            a.disactivate = runOn(this, this.dv);
        }
        db() {
            let a = new Marker();
            if (!this.dg) {
                a.content = ((() => {
                    let $ret = new DataContext();
                    $ret.series = this.e;
                    return $ret;
                })());
            }
            a.ah = this.e.rw;
            this.dk.add(a);
            return a;
        }
        b1(a) {
            let b = this.da(a, 0);
            if (b == null) {
                b = this.da(a, 3);
            }
            return b;
        }
        da(a, b) {
            let c;
            let d;
            let e;
            let f;
            for (let g = this.dk.count - 1; g >= 0; g--) {
                let h = this.dk._inner[g];
                if (h._visibility == 1 || h._opacity == 0) {
                    continue;
                }
                c = (h.m / 2) + b;
                d = (h.l / 2) + b;
                e = h.ai;
                f = h.aj;
                if ((h.n + e) - c <= a.x && (h.n + e) + c >= a.x && (h.o + f) - d <= a.y && (h.o + f) + d >= a.y) {
                    return h;
                }
            }
            return null;
        }
        du(a) {
            a.content = null;
            this.dk.remove(a);
        }
        dt(a) {
            a._visibility = 0;
        }
        dv(a) {
            if (a.content != null) {
                (typeCast(DataContext.$, a.content)).item = null;
            }
            a._visibility = 1;
        }
        dx(a) {
            this.dg = a;
        }
        bh(a, b) {
            super.bh(a, b);
            if (!this.dh) {
                let c = a;
                let d = c.content;
                if (d != null) {
                    if (this.de.sc != null) {
                        d.actualItemBrush = this.de.sc;
                    }
                    else {
                        d.actualItemBrush = this.b3.m9;
                    }
                    if (this.de.sc != null) {
                        d.outline = this.de.sd;
                    }
                    else {
                        d.outline = this.b3.na;
                    }
                    d.thickness = this.de.rf;
                }
            }
        }
        bi(a, b) {
            super.bi(a, b);
            let c = a;
            this.c9._visibility = c._visibility;
            this.c9.ah = c.ah;
            this.c9.width = c.width;
            this.c9.height = c.height;
            this.c9.m = c.m;
            this.c9.l = c.l;
            this.c9.n = c.n;
            this.c9.o = c.o;
            let d = this.bp(b);
            let e = this.c9.content;
            let f = c.content;
            e.item = f.item;
            e.series = f.series;
            e.thickness = f.thickness;
            if (e != null) {
                e.actualItemBrush = d;
                e.outline = d;
                e.thickness = this.de.rf + 3;
            }
        }
        a5(a, b) {
            super.a5(a, b);
            let c = new DataTemplatePassInfo();
            c.isHitTestRender = b;
            c.context = a.g();
            c.viewportTop = this.bu.top;
            c.viewportLeft = this.bu.left;
            c.viewportWidth = this.bu.width;
            c.viewportHeight = this.bu.height;
            c.passID = "Markers";
            let d = new DataTemplateRenderInfo();
            d.passInfo = c;
            d.isHitTestRender = b;
            let e = new DataTemplateMeasureInfo();
            e.passInfo = c;
            let f = false;
            let g = a.g();
            e.context = g;
            d.context = g;
            let h = 0;
            let i = 0;
            if (this.de.rw != null && this.de.rw.passStarting != null) {
                this.de.rw.passStarting(c);
            }
            for (let j = 0; j < this.dk.count; j++) {
                let k = this.dk._inner[j];
                if (k._visibility == 1) {
                    continue;
                }
                this.bg(k, j, b);
                if (b) {
                    k = this.c9;
                }
                if (!f) {
                    e.width = k.width;
                    e.height = k.height;
                    e.renderOffsetX = 0;
                    e.renderOffsetY = 0;
                    e.renderContext = a;
                    let l = k.ah;
                    if (l.measure != null) {
                        e.data = k.content;
                        l.measure(e);
                        f = e.isConstant;
                        if (f) {
                            h = e.width;
                            i = e.height;
                        }
                    }
                    d.availableWidth = e.width;
                    d.availableHeight = e.height;
                    d.renderOffsetX = e.renderOffsetX;
                    d.renderOffsetY = e.renderOffsetY;
                    d.renderContext = a;
                }
                else {
                    d.availableWidth = h;
                    d.availableHeight = i;
                }
                if (!isNaN_(k.width) && !isInfinity(k.width)) {
                    d.availableWidth = k.width;
                }
                if (!isNaN_(k.height) && !isInfinity(k.height)) {
                    d.availableHeight = k.height;
                }
                a.p(d, k);
                k.m = d.availableWidth;
                k.l = d.availableHeight;
                k.ai = d.renderOffsetX;
                k.aj = d.renderOffsetY;
            }
            if (this.de.rw != null && this.de.rw.passCompleted != null) {
                this.de.rw.passCompleted(c);
            }
        }
        dp() {
            this.de.rw = null;
            this.de.rw = this.de.rx;
        }
        dm() {
            this.de.sc = null;
            if (!isNaN_(this.e.et) && this.e.et != 1) {
                let a = BrushUtil.n(this.de.se, this.e.et);
                this.de.sc = a;
            }
            else {
                this.de.sc = this.de.se;
            }
        }
        dn() {
            this.de.sd = null;
            this.de.sd = this.de.sf;
        }
        dl(a) {
            switch (a) {
                case "CircleMarkerTemplate":
                    this.de.rw = this.de.b6.me;
                    break;
                case "TriangleMarkerTemplate":
                    this.de.rw = this.de.b6.mn;
                    break;
                case "PyramidMarkerTemplate":
                    this.de.rw = this.de.b6.mk;
                    break;
                case "SquareMarkerTemplate":
                    this.de.rw = this.de.b6.ml;
                    break;
                case "DiamondMarkerTemplate":
                    this.de.rw = this.de.b6.mf;
                    break;
                case "PentagonMarkerTemplate":
                    this.de.rw = this.de.b6.mi;
                    break;
                case "HexagonMarkerTemplate":
                    this.de.rw = this.de.b6.mg;
                    break;
                case "TetragramMarkerTemplate":
                    this.de.rw = this.de.b6.mi;
                    break;
                case "PentagramMarkerTemplate":
                    this.de.rw = this.de.b6.mj;
                    break;
                case "HexagramMarkerTemplate":
                    this.de.rw = this.de.b6.mh;
                    break;
            }
        }
        dr() {
            for (let a of fromEnum(this.dk)) {
                a.ah = this.de.rw;
            }
            this.aq();
        }
        dz(a) {
            if (this.dy == null) {
                this.dy = new DataTemplateMeasureInfo();
                this.dy.context = this.k.g();
            }
            this.dy.width = a.width;
            this.dy.height = a.height;
            this.dy.data = a.content;
            let b = a.ah;
            if (b.measure != null) {
                b.measure(this.dy);
            }
            return new Size(1, this.dy.width, this.dy.height);
        }
        al(a) {
            let b = a;
            super.al(b);
            for (let c of fromEnum(this.df.c)) {
                let d = this.df.item(c);
                if (d._visibility != 1) {
                    let e = typeCast(ScatterPolygonSeries.$, this.e);
                    let f = this.e.a5.getMarkerVisualData(e, d, e.rw);
                    b.markerShapes.add(typeCast(MarkerVisualData.$, f));
                }
            }
        }
        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.de.gy + "</span><br/>";
            a += "</div>";
            return a;
        }
    }
    ScatterPolygonSeriesView.$t = /*@__PURE__*/ markType(ScatterPolygonSeriesView, 'ScatterPolygonSeriesView', ShapeSeriesViewBase.$);
    return ScatterPolygonSeriesView;
})();
//# sourceMappingURL=ScatterPolygonSeries_combined.js.map
