/*
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 { Base, runOn, Number_$type, enumGetBox, Point_$type, typeCast, fromEnum, markType, markDep } from "igniteui-angular-core";
import { PolarAxisInfoCache } from "./PolarAxisInfoCache";
import { SeriesRenderer$2 } from "./SeriesRenderer$2";
import { PolarFrame } from "./PolarFrame";
import { DependencyProperty } from "igniteui-angular-core";
import { NumericAngleAxis } from "./NumericAngleAxis";
import { NumericRadiusAxis } from "./NumericRadiusAxis";
import { TrendLineType_$type } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { PenLineCap_$type } from "igniteui-angular-core";
import { DoubleCollection } from "igniteui-angular-core";
import { ScatterItemSearchMode_$type } from "./ScatterItemSearchMode";
import { HighlightingInfo } from "./HighlightingInfo";
import { List$1 } from "igniteui-angular-core";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { ScalerParams } from "./ScalerParams";
import { Rect } from "igniteui-angular-core";
import { Marker } from "./Marker";
import { MarkerSeriesView } from "./MarkerSeriesView";
import { PolarAxes } from "./PolarAxes";
import { IFastItemsSource_$type } from "igniteui-angular-core";
import { SeriesRenderingArguments } from "./SeriesRenderingArguments";
import { AxisRange } from "./AxisRange";
import { Dictionary$2 } from "igniteui-angular-core";
import { OwnedPoint } from "./OwnedPoint";
import { GeometryUtil } from "igniteui-angular-core";
import { DataContext } from "igniteui-angular-core";
import { HashPool$2 } from "igniteui-angular-core";
import { Clipper } from "igniteui-angular-core";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { PolarTrendLineManager } from "./PolarTrendLineManager";
import { AssigningPolarStyleEventArgs } from "./AssigningPolarStyleEventArgs";
import { AssigningPolarMarkerStyleEventArgs } from "./AssigningPolarMarkerStyleEventArgs";
import { SeriesRenderManager } from "./SeriesRenderManager";
import { DataLegendSeriesValueInfo } from "igniteui-angular-core";
import { DataLegendSeriesContext } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { truncate, isNaN_, isInfinity } from "igniteui-angular-core";
import { Defaults } from "./Defaults";
import { NumericMarkerManager } from "./NumericMarkerManager";
import { GeometryGroup } from "igniteui-angular-core";
import { stringIsNullOrEmpty } from "igniteui-angular-core";
/**
 * @hidden
 */
export let PolarBase = /*@__PURE__*/ (() => {
    class PolarBase extends MarkerSeries {
        constructor() {
            super();
            this.r7 = null;
            this.rt = null;
            this.r5 = null;
            this.u9 = null;
            this.u8 = null;
            this.sj = null;
            this.sl = null;
            this.sm = null;
            this.sb = new PolarFrame();
            this.sd = new PolarFrame();
            this.r9 = new PolarFrame();
            this.r4 = null;
            this.s3 = null;
            this.sf = 1;
            this.sq = false;
            this.sp = false;
            this.r0 = null;
            this.r1 = null;
            this.assigningPolarStyle = null;
            this.assigningPolarMarkerStyle = null;
            this.se = null;
            this.sc = null;
            this.r8 = null;
            this.se = new PolarSeriesRenderManager();
            this.sg = this.sh();
            this.sc = new PolarFrame();
            this.sd.x = runOn(this, this.u7);
            this.sb.x = runOn(this, this.u7);
            this.r9.x = runOn(this, this.u7);
            this.sj = new SeriesRenderer$2(PolarFrame.$, PolarBaseView.$, 0, runOn(this, this.ua), runOn(this, this.ue), runOn(this, this.cw), runOn(this, this.mw), runOn(this, this.t5));
        }
        by() {
            return new PolarBaseView(this);
        }
        l4(a) {
            super.l4(a);
            this.r6 = a;
        }
        kz() {
            super.kz();
            this.r2 = null;
            this.r3 = null;
        }
        get_d9() {
            return true;
        }
        c2(a, b, c, d) {
            if (!this.hasMarkers) {
                return false;
            }
            let e = this.r2;
            let f = new ScalerParams(1, this.ce.ta, this.p7, e.cg);
            f.c = this.getEffectiveViewport1(this.b1);
            let g = this.r3;
            let h = new ScalerParams(1, this.ce.ta, this.p7, g.cg);
            h.c = this.getEffectiveViewport1(this.b1);
            a.clear();
            this.qk.cf((i) => {
                if (i._visibility == 0) {
                    let j = new SeriesPointOfInterest();
                    let k = i.n;
                    let l = i.o;
                    if (k < this.p7.left || k > this.p7.right || l < this.p7.top || l > this.p7.bottom) {
                        return;
                    }
                    let m;
                    let n;
                    let o = this.r4.f(k, l, this.b1.bv, this.b1.bu, m, n);
                    m = o.p4;
                    n = o.p5;
                    j.b = m;
                    j.c = n;
                    j.a = i.content;
                    a.add(j);
                }
            });
            return true;
        }
        t5() {
            if (this.cf.g) {
                this.cf.t();
            }
        }
        t7() {
            this.r4.e(this.r7.w, this.sn, this.so, this.u9, this.u8, (a, b) => Math.cos(b), (a, b) => Math.sin(b), true);
        }
        get sn() {
            return this.sl;
        }
        set sn(a) {
            if (this.sl != a) {
                let b = this.sn;
                this.sl = a;
                this.raisePropertyChanged("AngleColumn", b, this.sn);
            }
        }
        get so() {
            return this.sm;
        }
        set so(a) {
            if (this.sm != a) {
                let b = this.so;
                this.sm = a;
                this.raisePropertyChanged("RadiusColumn", b, this.so);
            }
        }
        get u2() {
            return this.c(PolarBase.uf);
        }
        set u2(a) {
            this.h(PolarBase.uf, a);
        }
        sa() {
            let a = this.r9;
            if (this.cw()) {
                if (this.cf.g) {
                    this.cf.t();
                }
                a = this.sd;
            }
            return a;
        }
        lk() {
            super.lk();
            if (this.r3 != null) {
                this.r3.h7(false);
            }
            if (this.r2 != null) {
                this.r2.h7(false);
            }
        }
        k5(a, b, c, d) {
            let e = false;
            this.r6.cv.g$e(a, b, c, d);
            if (this.r2 != null && !this.r2.c0()) {
                e = true;
            }
            if (this.r3 != null && !this.r3.c0()) {
                e = true;
            }
            if (e) {
                this.mn(true);
            }
        }
        na(a, b) {
            this.mn(false);
        }
        nb(a, b) {
            this.mn(false);
        }
        fd(a, b, c) {
            let d = true;
            if (!super.fd(a, b, c) || !c.o() || b.isEmpty || a.isEmpty || this.r2 == null || this.r3 == null || this.sn == null || this.so == null || this.sn.count == 0 || this.so.count == 0 || this.cl == null || this.cl.count != this.sn.count || this.cl.count != this.so.count || this.r4 == null || this.r2.bh == null || this.r3.bh == null || this.r2.lw == this.r2.lv || this.r3.lw == this.r3.lv) {
                d = false;
            }
            return d;
        }
        mo(a) {
            let b;
            let c;
            let d = this.getViewInfo(c, b);
            c = d.p0;
            b = d.p1;
            if (!this.fd(c, b, this.b1)) {
                this.k2(true, this.b1);
                return;
            }
            this.u9 = b;
            this.u8 = c;
            this.r5 = new PolarAxisInfoCache(this.r2, this.r3, this.cl);
            let e = new SeriesRenderingArguments(this, c, b, a, this.ew);
            let f = this.sj.g(e, this.sb, this.r9, this.sd, this.r6);
            this.sb = f.p1;
            this.r9 = f.p2;
            this.sd = f.p3;
        }
        u7(a) {
            let b = this.r4.h(a.x, a.y, this.u9, this.u8, this.r5.e, this.r5.d, this.r5.g, this.r5.f, this.r5.i, this.r5.h);
            return b;
        }
        aq(a) {
            if (a != null && a == this.r2 && this.sn != null) {
                return new AxisRange(this.sn.minimum, this.sn.maximum);
            }
            if (a != null && a == this.r3 && this.so != null) {
                return new AxisRange(this.so.minimum, this.so.maximum);
            }
            return null;
        }
        eq(a) {
            let b = this.b1.bv;
            b = b.copy();
            let c = this.b1.bu;
            let d = !b.isEmpty && !c.isEmpty && this.cl != null ? this.cl.indexOf(a) : -1;
            if (this.r2 == null || this.sn == null || this.r3 == null || this.so == null) {
                return false;
            }
            if (d < 0 || d > this.sn.count - 1 || d > this.so.count - 1) {
                return false;
            }
            let e = this.r2.getScaledAngle(this.sn.item(d));
            let f = this.r3.nt(this.so.item(d));
            let g = 0.5 + (Math.cos(e) * f);
            let h = 0.5 + (Math.sin(e) * f);
            if (!isNaN_(g)) {
                if (g < b.left + 0.1 * b.width) {
                    g = g + 0.4 * b.width;
                    b.x = g - 0.5 * b.width;
                }
                if (g > b.right - 0.1 * b.width) {
                    g = g - 0.4 * b.width;
                    b.x = g - 0.5 * b.width;
                }
            }
            if (!isNaN_(h)) {
                if (h < b.top + 0.1 * b.height) {
                    h = h + 0.4 * b.height;
                    b.y = h - 0.5 * b.height;
                }
                if (h > b.bottom - 0.1 * b.height) {
                    h = h - 0.4 * b.height;
                    b.y = h - 0.5 * b.height;
                }
            }
            if (this.b9 != null) {
                this.b9.au(this.ce, b, true);
            }
            return d >= 0;
        }
        hy(a) {
            let b = this.hi(a);
            if (this.cl != null && b >= 0 && b < this.cl.count) {
                return this.cl.item(b);
            }
            return null;
        }
        hi(a) {
            let b = truncate(Math.round(this.f9(a)));
            return b;
        }
        f9(a) {
            switch (this.sg) {
                case 1: return this.s7(a);
                case 3: return this.s8(a);
                case 2: return this.s5(a);
                case 4: return this.s6(a);
            }
            return -1;
        }
        s6(a) {
            return this.s9(a, false);
        }
        s5(a) {
            let b = this.pn(a);
            let c = b.x;
            let d = b.y;
            if (this.cl == null || this.r2 == null || this.r3 == null || this.sn == null || this.so == null) {
                return -1;
            }
            if (this.cl.count > this.tb) {
                return -1;
            }
            if (!this.su()) {
                return -1;
            }
            let e = this.s3;
            let f = 1.7976931348623157E+308;
            let g = -1;
            for (let h = 0; h < this.sn.count; h++) {
                let i = e._inner[h].x;
                let j = e._inner[h].y;
                let k = (c - i) * (c - i) + (d - j) * (d - j);
                if (k < f) {
                    f = k;
                    g = h;
                }
            }
            return g;
        }
        su() {
            let a = this.r9;
            if (this.cw()) {
                a = this.sd;
            }
            if (a == null || a.w.count == 0) {
                return false;
            }
            this.s3 = a.w;
            return true;
        }
        s9(a, b) {
            if (!this.sx) {
                return -1;
            }
            let c = { $type: Point_$type, x: 0, y: 0 };
            let d = true;
            let e = this.r9;
            if (this.cw()) {
                e = this.sd;
            }
            if (e == null) {
                return -1;
            }
            if (e.m == null) {
                return -1;
            }
            if (this.cl == null || this.cl.count > this.tb) {
                return -1;
            }
            if (!this.su()) {
                return -1;
            }
            let f = this.s3;
            let g = this.pn(a);
            let h = 1.7976931348623157E+308;
            let i = -1;
            for (let j = 0; j < f.count; j++) {
                let k = f._inner[j];
                if (j > 0) {
                    if (isNaN_(k.x) || isNaN_(k.y) || isNaN_(c.x) || isNaN_(c.y)) {
                        c = k;
                        continue;
                    }
                    if (!b || e.j.containsKey(this.cl.item(j)) || e.j.containsKey(this.cl.item(j - 1))) {
                        let l = GeometryUtil.d(g, c, k);
                        if (l < h) {
                            h = l;
                            i = j;
                        }
                    }
                }
                c = k;
            }
            if (i >= 0) {
                let m = f._inner[i];
                let n = f._inner[i - 1];
                if (!b || (e.j.containsKey(this.cl.item(i)) && e.j.containsKey(this.cl.item(i - 1)))) {
                    let o = GeometryUtil.h(g, n, m);
                    return (i - 1) + o;
                }
                else if (e.j.containsKey(this.cl.item(i))) {
                    return i;
                }
                else {
                    return i - 1;
                }
            }
            return -1;
        }
        s8(a) {
            return this.s9(a, true);
        }
        s7(a) {
            let b = null;
            let c = 1.7976931348623157E+308;
            let d = this.pn(a);
            let e = d.x;
            let f = d.y;
            if (this.r6.cw.e > this.tb) {
                return -1;
            }
            this.r6.cz((g) => {
                if (g._visibility == 0) {
                    let h = this.r6.cp(g);
                    let i = h.left + h.width / 2;
                    let j = h.top + h.height / 2;
                    let k = (e - i) * (e - i) + (f - j) * (f - j);
                    if (k < c) {
                        c = k;
                        b = g;
                    }
                }
            });
            if (b != null) {
                return b.ak;
            }
            return -1;
        }
        ps(a, b, c) {
            if (this.r2 == null || this.r3 == null || this.sn == null || this.so == null) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            let d = this.b1.bv;
            let e = this.b1.bu;
            let f = this.getEffectiveViewport();
            let g = new ScalerParams(0, d, e, this.r2.cg, f);
            let h = ((() => {
                let $ret = new ScalerParams(0, d, e, this.r3.cg, f);
                $ret.b = this.gg();
                return $ret;
            })());
            if (b) {
                let i = this.f9(a);
                if (i == -1) {
                    return { $type: Point_$type, x: NaN, y: NaN };
                }
                let j = truncate(Math.floor(i));
                let k = truncate(Math.ceil(i));
                if (j < 0) {
                    j = 0;
                }
                if (k < 0) {
                    k = 0;
                }
                if (k > this.cl.count - 1) {
                    k = this.cl.count - 1;
                }
                if (j > this.cl.count - 1) {
                    j = this.cl.count - 1;
                }
                if (k == j) {
                    return this.r4.h(this.sn.item(j), this.so.item(j), d, e, this.r5.e, this.r5.d, this.r5.g, this.r5.f, this.r5.i, this.r5.h);
                }
                let l = i - Math.floor(i);
                let m = this.r4.h(this.sn.item(j), this.so.item(j), d, e, this.r5.e, this.r5.d, this.r5.g, this.r5.f, this.r5.i, this.r5.h);
                let n = this.r4.h(this.sn.item(k), this.so.item(k), d, e, this.r5.e, this.r5.d, this.r5.g, this.r5.f, this.r5.i, this.r5.h);
                let o = m.x;
                let p = m.y;
                let q = n.x;
                let r = n.y;
                let s = q - o;
                let t = r - p;
                return { $type: Point_$type, x: o + s * l, y: p + t * l };
            }
            else {
                let u = this.hi(a);
                if (u == -1) {
                    return { $type: Point_$type, x: NaN, y: NaN };
                }
                return this.r4.h(this.sn.item(u), this.so.item(u), d, e, this.r5.e, this.r5.d, this.r5.g, this.r5.f, this.r5.i, this.r5.h);
            }
        }
        ag() {
            return [this.r2, this.r3];
        }
        h1(a, b) {
            let c = this.jv(b);
            if (c == PolarBase.$$p[3]) {
                return this.h2(a, b, this.tm);
            }
            if (c == PolarBase.$$p[13]) {
                return this.h2(a, b, this.t0);
            }
            return super.h1(a, b);
        }
        l9(a, b, c, d) {
            super.l9(a, b, c, d);
            if (this.r6.cv.g$b(a, b, c, d)) {
                this.mn(false);
                this.lu();
            }
            switch (b) {
                case "FastItemsSource":
                    if (typeCast(IFastItemsSource_$type, c) != null) {
                        c.deregisterColumn(this.sn);
                        c.deregisterColumn(this.so);
                        this.sn = null;
                        this.so = null;
                    }
                    if (typeCast(IFastItemsSource_$type, d) != null) {
                        this.sn = this.ci(this.tm);
                        this.so = this.ci(this.t0);
                    }
                    if ((this.r3 != null && !this.r3.c0()) || (this.r2 != null && !this.r2.c0())) {
                        this.mn(false);
                    }
                    break;
                case PolarBase.$$p[0]:
                    if (this.r2 != null && this.r3 != null) {
                        this.r4 = new PolarAxes(this.r3, this.r2);
                    }
                    if (c != null) {
                        c.bz(this);
                    }
                    if (d != null) {
                        d.cs(this);
                    }
                    if (this.r2 != null && !this.r2.c0()) {
                        this.mn(false);
                    }
                    else if (c != null && d == null) {
                        this.k2(true, this.b1);
                    }
                    break;
                case PolarBase.$$p[10]:
                    if (this.r2 != null && this.r3 != null) {
                        this.r4 = new PolarAxes(this.r3, this.r2);
                    }
                    if (c != null) {
                        c.bz(this);
                    }
                    if (d != null) {
                        d.cs(this);
                    }
                    if (this.r3 != null && !this.r3.c0()) {
                        this.mn(false);
                    }
                    else if (c != null && d == null) {
                        this.k2(true, this.b1);
                    }
                    if (this.r2 != null && !this.r2.c0()) {
                        this.r2.h3();
                    }
                    break;
                case PolarBase.$$p[3]:
                    if (this.cl != null) {
                        this.cl.deregisterColumn(this.sn);
                        this.sn = this.ci(this.tm);
                    }
                    break;
                case "AngleColumn":
                    this.r6.cv.g$i();
                    if (this.r2 != null && !this.r2.c0()) {
                        this.mn(false);
                    }
                    break;
                case PolarBase.$$p[13]:
                    if (this.cl != null) {
                        this.cl.deregisterColumn(this.so);
                        this.so = this.ci(this.t0);
                    }
                    break;
                case "RadiusColumn":
                    this.r6.cv.g$i();
                    if (this.r3 != null && !this.r3.c0()) {
                        this.mn(false);
                    }
                    break;
                case PolarBase.$$p[14]:
                    this.mn(false);
                    this.lu();
                    break;
                case PolarBase.$$p[9]:
                    this.mn(false);
                    this.lu();
                    break;
                case "TransitionProgress":
                    this.r5 = new PolarAxisInfoCache(this.r2, this.r3, this.cl);
                    this.u9 = this.b1.bv;
                    this.u8 = this.b1.bu;
                    this.sd.v = this.s2;
                    this.sd.c(this.g5, this.sb, this.r9);
                    if (this.cy(this.b1)) {
                        return;
                    }
                    if (this.g5 == 1) {
                        this.ue(this.r9, this.r6);
                    }
                    else {
                        this.ue(this.sd, this.r6);
                    }
                    if (this.ce != null) {
                        this.ce.ob(this);
                    }
                    break;
                case "TrendLineBrush":
                    this.m1();
                    break;
                case PolarBase.$$p[4]:
                    this.mn(false);
                    this.lu();
                    break;
                case "TrendLineType":
                    this.lu();
                    break;
                case PolarBase.$$p[6]:
                    this.sq = this.sz();
                    this.mn(false);
                    break;
                case PolarBase.$$p[5]:
                    this.sp = this.sy();
                    this.mn(false);
                    break;
                case PolarBase.$$p[7]:
                    this.sg = this.sh();
                    break;
            }
        }
        get sg() {
            return this.sf;
        }
        set sg(a) {
            let b = this.sf;
            this.sf = a;
            if (b != this.sf) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.sf));
            }
        }
        sh() {
            if (this.si != 0) {
                return this.si;
            }
            return this.sx ? 4 : 1;
        }
        get_sx() {
            return false;
        }
        get sx() {
            return this.get_sx();
        }
        sz() {
            return this.sw;
        }
        sy() {
            return this.sv;
        }
        ss(a) {
            if (typeCast(NumericRadiusAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        sr(a) {
            if (typeCast(NumericAngleAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        k2(a, b) {
            super.k2(a, b);
            let c = b;
            if (a) {
                c.cw.clear();
            }
            c.cv.g$d();
        }
        ru(a, b) {
            let c = a.top - 10;
            let d = a.bottom + 10;
            let e = a.left - 10;
            let f = a.right + 10;
            let g = ((() => {
                let $ret = new Clipper(1, e, d, f, c, false);
                $ret.i = b;
                return $ret;
            })());
            return g;
        }
        t4(a, b, c, d) {
            a.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, b);
            let e = this.cl;
            for (let f = 0; f < b; f++) {
                let g = a.w._inner[f];
                if (!isInfinity(g.x) && !isInfinity(g.y)) {
                    let h = { $type: Point_$type, x: this.sn.item(f), y: this.so.item(f) };
                    let i = { $type: Point_$type, x: g.x, y: g.y };
                    a.g.addItem(e.item(f), ((() => {
                        let $ret = new OwnedPoint();
                        $ret.a = e.item(f);
                        $ret.b = h;
                        $ret.c = i;
                        return $ret;
                    })()));
                }
            }
        }
        ua(a, b) {
            let c = b.bv;
            let d = b.bu;
            a.j.clear();
            a.n.clear();
            let e = Math.min(this.sn != null ? this.sn.count : 0, this.so != null ? this.so.count : 0);
            if (e < 1) {
                return;
            }
            this.r5 = new PolarAxisInfoCache(this.r2, this.r3, this.cl);
            this.r7 = a;
            this.u8 = d;
            this.u9 = c;
            b.ct.l(a.j, this.tc, c, d, this.fx);
            if (e <= this.tc) {
                this.t4(a, e, c, d);
            }
            let f = this.ru(d, a.n);
            let g = Math.min(this.r2.lw, this.r2.lv);
            let h = Math.max(this.r2.lv, this.r2.lw);
            b.cv.i = this.s2;
            b.cv.h = 0;
            b.cv.k = this.r3.nn;
            b.cv.j = this.r3.nm;
            b.cv.l = (i, j) => this.r4.c(i, j, c, d, Math.cos);
            b.cv.m = (i, j) => this.r4.d(i, j, c, d, Math.sin);
            let i = new List$1(Number_$type, 0);
            for (let j = 0; j < this.sn.count; j++) {
                if (this.sn.item(j) >= g && this.sn.item(j) <= h) {
                    i.add(this.sn.item(j));
                }
            }
            let k = this.so;
            if (i.count != this.sn.count) {
                k = new List$1(Number_$type, 0);
                for (let l = 0; l < this.sn.count; l++) {
                    if (this.sn.item(l) >= g && this.sn.item(l) <= h) {
                        k.add(this.so.item(l));
                    }
                }
            }
            b.cv.n(a.n, this.sk, i, k, this.td, runOn(this.r2, this.r2.getScaledAngle), runOn(this.r3, this.r3.nt), ((() => {
                let $ret = new TrendResolutionParams();
                $ret.b = this.fx;
                $ret.f = d;
                $ret.g = c;
                return $ret;
            })()), f, g, h);
        }
        get_d0() {
            return true;
        }
        ry(a, b, c) {
            return null;
        }
        rz(a, b, c) {
            let d = this.sa();
            let e = this.r6.by(this.pn(b));
            let f = -1;
            if (e == null) {
                if (a != null) {
                    f = this.cl.indexOf(a);
                }
                else {
                    return null;
                }
            }
            else {
                f = e.ak;
            }
            if (f == -1) {
                return null;
            }
            let g = new HighlightingInfo();
            g.b = this;
            g.h = f;
            g.g = f;
            g.d = false;
            g.e = true;
            if (c != null && c.h == g.h && c.g == g.g) {
                return c;
            }
            return g;
        }
        rx(a, b, c) {
            let d = new HighlightingInfo();
            d.b = this;
            d.h = 0;
            d.g = this.cl.count - 1;
            d.d = true;
            if (c != null && c.h == d.h && c.g == d.g) {
                return c;
            }
            return d;
        }
        ax(a, b, c) {
            if (this.c3 && this.ei(this.bl) && !c) {
                let d = this.ry(a, b, this.r0);
                this.r0 = d;
                return d;
            }
            else {
                let e = this.rx(a, b, this.r0);
                this.r0 = e;
                return e;
            }
        }
        ay(a, b, c) {
            if (this.ei(this.bl) && !c) {
                let d = this.rz(a, b, this.r1);
                this.r1 = d;
                return d;
            }
            else {
                let e = this.rx(a, b, this.r1);
                e.e = true;
                this.r1 = e;
                return e;
            }
        }
        s1() {
            return (this.assigningPolarStyle != null && this.sq) || (this.bl != 1);
        }
        s0() {
            return (this.assigningPolarMarkerStyle != null && this.sp) || (this.bl != 1);
        }
        ue(a, b) {
            let c = b.bv;
            let d = b.bu;
            let e = this.getEffectiveViewport1(b);
            let f = this.pz(b);
            this.r5 = new PolarAxisInfoCache(this.r2, this.r3, this.cl);
            if (this.qn()) {
                b.ct.j(a.j, this.qp);
                if (this.s0()) {
                    this.t6(b, a);
                }
            }
            b.cm();
            let g = this.ru(d, b.cv.g$j.an);
            b.cv.g$h(a.n, g);
            this.t3(d, c, e, f, b);
        }
        rr(a, b) {
            return this.rs(a, b);
        }
        rs(a, b) {
            if (b < a || a < 0 || a > this.sn.count || b < 0 || b > this.sn.count) {
                return null;
            }
            let c = new Array((b - a) + 1);
            for (let d = a; d <= b; d++) {
                let e = d;
                c[d - a] = this.cl.item(d);
            }
            return c;
        }
        t6(a, b) {
            a.b3 = true;
            this.se.ay(this, this.s0(), runOn(this, this.rr));
            let c = this.se.d;
            let d = c != null;
            let e = this.getEffectiveViewport1(a);
            let f = this.cl == null ? 0 : this.cl.count;
            this.r6.cf((g) => {
                if (g._visibility == 0) {
                    let h = g.ak;
                    let i = g.content;
                    if (i == null) {
                        i = new DataContext();
                        g.content = i;
                    }
                    if (d) {
                        this.t8(h, f, a.q);
                    }
                    this.se.ac(g, i);
                }
            });
        }
        t9(a, b, c) {
            let d = this.bl != 1;
            this.se.a0(this.se.b, a, b, false);
            this.se.ab(this.fv);
            let e = this.se.ax;
            let f = null;
            let g = this.cl;
            if (d && this.ce != null) {
                f = this.ce.a7.getHighlightingInfo(this, g, e.o, e.n, false);
                e.b = f;
            }
            e.f = c;
            this.uc(e);
            this.se.z(this, f, c, d, a < 0);
        }
        t8(a, b, c) {
            let d = this.bl != 1;
            this.se.a0(this.se.d, a, b, true);
            this.se.aa(this.fv);
            let e = this.se.aw;
            let f = null;
            let g = this.cl;
            let h = null;
            if (d && this.ce != null) {
                f = this.ce.a7.getHighlightingInfo(this, g, e.o, e.n, true);
                if (this.ce.a7.isCrossSeriesHighlight(this)) {
                    h = this.ce.a7.getHighlightingInfo(this, g, e.o, e.n, true);
                }
                e.b = f;
            }
            e.f = c;
            this.ub(e);
            this.se.y(this, f, c, d, e.l, this.ce.a7.sumHighlightingProgress);
        }
        uc(a) {
            if (this.assigningPolarStyle != null && this.sq) {
                this.assigningPolarStyle(this, a);
            }
        }
        ub(a) {
            if (this.assigningPolarMarkerStyle != null && this.sp) {
                this.assigningPolarMarkerStyle(this, a);
            }
        }
        t3(a, b, c, d, e) {
            e.cy(a, b, c, d);
        }
        m1() {
            super.m1();
            if (this.index < 0) {
                return;
            }
            this.r6.c1();
        }
        mp(a, b) {
            super.mp(a, b);
            if (!this.e3) {
                this.b1.a2(b);
                return;
            }
            this.b1.a2(b);
            if (this.cy(this.b0)) {
                return;
            }
            let c = this.b0;
            if (!this.ex) {
                this.sc = new PolarFrame();
                this.ua(this.sc, c);
            }
            this.ex = false;
            this.ue(this.sc, c);
            this.e3 = false;
        }
        mm(a, b, c, d, e) {
            super.mm(a, b, c, d, e);
            let f = this.a7.a$h.item(d);
            let g = f;
            f.a1(c);
            if (this.cy(g)) {
                return;
            }
            if (this.r8 == null) {
                this.r8 = new PolarFrame();
            }
            this.ua(this.r8, g);
            this.ue(this.r8, g);
        }
        ud(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);
            }
        }
        rq(a, b, c) {
            this.t7();
            return this.r7.w.toArray();
        }
        s4(a) {
            let b = new List$1(Number_$type, 0);
            let c = this.cl;
            for (let d of fromEnum(this.r6.cw.c)) {
                b.add(c.indexOf(d));
            }
            return b;
        }
        u6(a) {
            return { $type: Point_$type, x: this.sn.item(a), y: this.so.item(a) };
        }
        lc(a) {
            super.lc(a);
            this.a9.exportTrendlineData(this, a, this.r6.cv.g$j);
        }
        getDataLegendSeriesContextAt(a, b) {
            let c = { $type: Point_$type, x: a, y: b };
            let d = this.hy(c);
            let e = d == null ? NaN : this.gf(d, "RadiusMemberPath");
            let f = d == null ? NaN : this.gf(d, "AngleMemberPath");
            let g = new DataLegendSeriesValueInfo();
            g.l = e;
            g.a = 11;
            g.q = this.t0 != null ? this.t0 : "Radius";
            g.p = "Radius";
            g.r = this.tw != null ? this.tw : "R:";
            g.s = this.ty != null ? this.ty : "";
            let h = new DataLegendSeriesValueInfo();
            h.l = f;
            h.a = 10;
            h.q = this.tm != null ? this.tm : "Angle";
            h.p = "Angle";
            h.r = this.ti != null ? this.ti : "A:";
            h.s = this.tk != null ? this.tk : "";
            let i = new DataLegendSeriesContext();
            i.f = ((() => {
                let $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
                $ret.add(g);
                $ret.add(h);
                return $ret;
            })());
            i.b = this.aw();
            return i;
        }
    }
    PolarBase.$t = markType(PolarBase, 'PolarBase', MarkerSeries.$);
    PolarBase.uf = DependencyProperty.i("ActualTrendLineBrush", Brush.$, PolarBase.$, new PropertyMetadata(2, null, (a, b) => a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue)));
    PolarBase.$$p = markDep(DependencyProperty, PropertyMetadata, PolarBase, 'raisePropertyChanged', ['AngleAxis:r2:ug', [NumericAngleAxis.$, null], 'AngleMemberAsLegendLabel:ti:uh', [2, null], 'AngleMemberAsLegendUnit:tk:ui', [2, null], 'AngleMemberPath:tm:uj', [2], 'ClipSeriesToBounds:st:uk', [0, false], 'IsCustomPolarMarkerStyleAllowed:sv:ul', [0, false], 'IsCustomPolarStyleAllowed:sw:um', [0, false], 'ItemSearchMode:si:un', [ScatterItemSearchMode_$type, enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:tb:uo', [1, 10000], 'MaximumMarkers:tc:up', [1, 400], 'RadiusAxis:r3:uq', [NumericRadiusAxis.$, null], 'RadiusMemberAsLegendLabel:tw:ur', [2, null], 'RadiusMemberAsLegendUnit:ty:us', [2, null], 'RadiusMemberPath:t0:ut', [2], 'UseCartesianInterpolation:s2:u1', [0, true], 'TrendLineType:sk:uz', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness:ta:uy', [1, 1.5], 'TrendLinePeriod:td:ux', [1, 7], 'TrendLineZIndex:te:u0', [1, 1], 'TrendLineBrush:u3:uu', [Brush.$, null], 'TrendLineDashArray:u4:uv', [DoubleCollection.$], 'TrendLineDashCap:u5:uw', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
    return PolarBase;
})();
/**
 * @hidden
 */
export let PolarSeriesRenderManager = /*@__PURE__*/ (() => {
    class PolarSeriesRenderManager extends SeriesRenderManager {
        constructor() {
            super(...arguments);
            this.aw = null;
            this.ax = null;
        }
        c() {
            this.aw = new AssigningPolarMarkerStyleEventArgs();
            return this.aw;
        }
        a() {
            this.ax = new AssigningPolarStyleEventArgs();
            return this.ax;
        }
        ay(a, b, c) {
            this.w(a, b, c);
        }
        az(a, b, c) {
            this.x(a, b, c);
        }
        a0(a, b, c, d) {
            if (b == -1) {
                a.c = false;
                a.o = 0;
                a.n = c - 1;
            }
            else {
                if (d) {
                    a.o = b;
                    a.n = b;
                }
                else {
                    a.c = false;
                    a.o = b;
                    a.n = b;
                }
            }
        }
    }
    PolarSeriesRenderManager.$t = markType(PolarSeriesRenderManager, 'PolarSeriesRenderManager', SeriesRenderManager.$);
    return PolarSeriesRenderManager;
})();
/**
 * @hidden
 */
export let PolarBaseView = /*@__PURE__*/ (() => {
    class PolarBaseView extends MarkerSeriesView {
        constructor(a) {
            super(a);
            this.cu = null;
            this.ct = null;
            this.cv = null;
            this.cw = null;
            this.cu = a;
            this.cw = new HashPool$2(Base.$, Marker.$);
            this.ch(this.cw);
            this.cv = new PolarTrendLineManager();
        }
        as() {
            super.as();
            this.ct = this.cs();
            if (!this.q) {
                this.cu.tc = 1000;
                this.b1.ql = Defaults.e;
            }
        }
        cz(a) {
            this.cw.g(a);
        }
        cs() {
            let a = new NumericMarkerManager(0, (b) => this.cw.item(b), (b) => this.cu.r5.c.item(b), runOn(this, this.c0), runOn(this, this.cr), runOn(this, this.cx));
            a.n = true;
            a.p = runOn(this.cu, this.cu.u6);
            return a;
        }
        c0(a) {
            this.cu.ud(a, this.cw);
        }
        cr() {
            return this.cu.rq(this.cw, this.bv, this.bu);
        }
        cx() {
            return this.cu.s4(this.cw);
        }
        cy(a, b, c, d) {
            if (this.cu.st) {
                let e = new GeometryGroup();
                this.cu.r3.n1(e, a, b, c, d);
            }
            else {
            }
        }
        c1() {
            if (this.cu.u3 != null) {
                this.cu.u2 = this.cu.u3;
            }
            else {
                this.cu.u2 = this.cu.o5;
            }
        }
        cf(a) {
            this.cw.f(a);
        }
        a5(a, b) {
            if (a.d) {
                if (this.cu.sk != 0 && !b) {
                    let c = this.cv.g$j;
                    c.ad = this.cu.ta;
                    c._stroke = this.cu.u2;
                    c.aj = this.cu.u5;
                    c.ai = this.cu.u4;
                    a.v(c);
                }
            }
            super.a5(a, b);
        }
        c2() {
            return Rect.empty;
        }
        getDefaultTooltipTemplate() {
            let a = "<div class='ui-chart-default-tooltip-content'><span>" + "${item." + this.cu.tm + "}" + "</span><br/><span";
            let b = this.e.a7.a$r(this.e);
            if (!stringIsNullOrEmpty(b)) {
                a += " style='color:" + b + "'";
            }
            a += ">" + this.cu.title + ": </span><span class='ui-priority-primary'>" + "${item." + this.cu.t0 + "}</span></div>";
            return a;
        }
    }
    PolarBaseView.$t = markType(PolarBaseView, 'PolarBaseView', MarkerSeriesView.$);
    return PolarBaseView;
})();
