/*
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 { __extends, __values } from "tslib";
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
 */
var PolarBase = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(PolarBase, _super);
    function PolarBase() {
        var _this = _super.call(this) || this;
        _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));
        return _this;
    }
    PolarBase.prototype.by = function () {
        return new PolarBaseView(this);
    };
    PolarBase.prototype.l4 = function (a) {
        _super.prototype.l4.call(this, a);
        this.r6 = a;
    };
    PolarBase.prototype.kz = function () {
        _super.prototype.kz.call(this);
        this.r2 = null;
        this.r3 = null;
    };
    PolarBase.prototype.get_d9 = function () {
        return true;
    };
    PolarBase.prototype.c2 = function (a, b, c, d) {
        var _this = this;
        if (!this.hasMarkers) {
            return false;
        }
        var e = this.r2;
        var f = new ScalerParams(1, this.ce.ta, this.p7, e.cg);
        f.c = this.getEffectiveViewport1(this.b1);
        var g = this.r3;
        var h = new ScalerParams(1, this.ce.ta, this.p7, g.cg);
        h.c = this.getEffectiveViewport1(this.b1);
        a.clear();
        this.qk.cf(function (i) {
            if (i._visibility == 0) {
                var j = new SeriesPointOfInterest();
                var k = i.n;
                var l = i.o;
                if (k < _this.p7.left || k > _this.p7.right || l < _this.p7.top || l > _this.p7.bottom) {
                    return;
                }
                var m = void 0;
                var n = void 0;
                var 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;
    };
    PolarBase.prototype.t5 = function () {
        if (this.cf.g) {
            this.cf.t();
        }
    };
    PolarBase.prototype.t7 = function () {
        this.r4.e(this.r7.w, this.sn, this.so, this.u9, this.u8, function (a, b) { return Math.cos(b); }, function (a, b) { return Math.sin(b); }, true);
    };
    Object.defineProperty(PolarBase.prototype, "sn", {
        get: function () {
            return this.sl;
        },
        set: function (a) {
            if (this.sl != a) {
                var b = this.sn;
                this.sl = a;
                this.raisePropertyChanged("AngleColumn", b, this.sn);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(PolarBase.prototype, "so", {
        get: function () {
            return this.sm;
        },
        set: function (a) {
            if (this.sm != a) {
                var b = this.so;
                this.sm = a;
                this.raisePropertyChanged("RadiusColumn", b, this.so);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(PolarBase.prototype, "u2", {
        get: function () {
            return this.c(PolarBase.uf);
        },
        set: function (a) {
            this.h(PolarBase.uf, a);
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.sa = function () {
        var a = this.r9;
        if (this.cw()) {
            if (this.cf.g) {
                this.cf.t();
            }
            a = this.sd;
        }
        return a;
    };
    PolarBase.prototype.lk = function () {
        _super.prototype.lk.call(this);
        if (this.r3 != null) {
            this.r3.h7(false);
        }
        if (this.r2 != null) {
            this.r2.h7(false);
        }
    };
    PolarBase.prototype.k5 = function (a, b, c, d) {
        var 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);
        }
    };
    PolarBase.prototype.na = function (a, b) {
        this.mn(false);
    };
    PolarBase.prototype.nb = function (a, b) {
        this.mn(false);
    };
    PolarBase.prototype.fd = function (a, b, c) {
        var d = true;
        if (!_super.prototype.fd.call(this, 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;
    };
    PolarBase.prototype.mo = function (a) {
        var b;
        var c;
        var 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);
        var e = new SeriesRenderingArguments(this, c, b, a, this.ew);
        var 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;
    };
    PolarBase.prototype.u7 = function (a) {
        var 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;
    };
    PolarBase.prototype.aq = function (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;
    };
    PolarBase.prototype.eq = function (a) {
        var b = this.b1.bv;
        b = b.copy();
        var c = this.b1.bu;
        var 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;
        }
        var e = this.r2.getScaledAngle(this.sn.item(d));
        var f = this.r3.nt(this.so.item(d));
        var g = 0.5 + (Math.cos(e) * f);
        var 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;
    };
    PolarBase.prototype.hy = function (a) {
        var b = this.hi(a);
        if (this.cl != null && b >= 0 && b < this.cl.count) {
            return this.cl.item(b);
        }
        return null;
    };
    PolarBase.prototype.hi = function (a) {
        var b = truncate(Math.round(this.f9(a)));
        return b;
    };
    PolarBase.prototype.f9 = function (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;
    };
    PolarBase.prototype.s6 = function (a) {
        return this.s9(a, false);
    };
    PolarBase.prototype.s5 = function (a) {
        var b = this.pn(a);
        var c = b.x;
        var 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;
        }
        var e = this.s3;
        var f = 1.7976931348623157E+308;
        var g = -1;
        for (var h = 0; h < this.sn.count; h++) {
            var i = e._inner[h].x;
            var j = e._inner[h].y;
            var k = (c - i) * (c - i) + (d - j) * (d - j);
            if (k < f) {
                f = k;
                g = h;
            }
        }
        return g;
    };
    PolarBase.prototype.su = function () {
        var a = this.r9;
        if (this.cw()) {
            a = this.sd;
        }
        if (a == null || a.w.count == 0) {
            return false;
        }
        this.s3 = a.w;
        return true;
    };
    PolarBase.prototype.s9 = function (a, b) {
        if (!this.sx) {
            return -1;
        }
        var c = { $type: Point_$type, x: 0, y: 0 };
        var d = true;
        var 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;
        }
        var f = this.s3;
        var g = this.pn(a);
        var h = 1.7976931348623157E+308;
        var i = -1;
        for (var j = 0; j < f.count; j++) {
            var 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))) {
                    var l = GeometryUtil.d(g, c, k);
                    if (l < h) {
                        h = l;
                        i = j;
                    }
                }
            }
            c = k;
        }
        if (i >= 0) {
            var m = f._inner[i];
            var n = f._inner[i - 1];
            if (!b || (e.j.containsKey(this.cl.item(i)) && e.j.containsKey(this.cl.item(i - 1)))) {
                var 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;
    };
    PolarBase.prototype.s8 = function (a) {
        return this.s9(a, true);
    };
    PolarBase.prototype.s7 = function (a) {
        var _this = this;
        var b = null;
        var c = 1.7976931348623157E+308;
        var d = this.pn(a);
        var e = d.x;
        var f = d.y;
        if (this.r6.cw.e > this.tb) {
            return -1;
        }
        this.r6.cz(function (g) {
            if (g._visibility == 0) {
                var h = _this.r6.cp(g);
                var i = h.left + h.width / 2;
                var j = h.top + h.height / 2;
                var k = (e - i) * (e - i) + (f - j) * (f - j);
                if (k < c) {
                    c = k;
                    b = g;
                }
            }
        });
        if (b != null) {
            return b.ak;
        }
        return -1;
    };
    PolarBase.prototype.ps = function (a, b, c) {
        var _this = this;
        if (this.r2 == null || this.r3 == null || this.sn == null || this.so == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        var d = this.b1.bv;
        var e = this.b1.bu;
        var f = this.getEffectiveViewport();
        var g = new ScalerParams(0, d, e, this.r2.cg, f);
        var h = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.r3.cg, f);
            $ret.b = _this.gg();
            return $ret;
        })());
        if (b) {
            var i = this.f9(a);
            if (i == -1) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            var j = truncate(Math.floor(i));
            var 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);
            }
            var l = i - Math.floor(i);
            var 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);
            var 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);
            var o = m.x;
            var p = m.y;
            var q = n.x;
            var r = n.y;
            var s = q - o;
            var t = r - p;
            return { $type: Point_$type, x: o + s * l, y: p + t * l };
        }
        else {
            var 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);
        }
    };
    PolarBase.prototype.ag = function () {
        return [this.r2, this.r3];
    };
    PolarBase.prototype.h1 = function (a, b) {
        var 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.prototype.h1.call(this, a, b);
    };
    PolarBase.prototype.l9 = function (a, b, c, d) {
        _super.prototype.l9.call(this, 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;
        }
    };
    Object.defineProperty(PolarBase.prototype, "sg", {
        get: function () {
            return this.sf;
        },
        set: function (a) {
            var b = this.sf;
            this.sf = a;
            if (b != this.sf) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.sf));
            }
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.sh = function () {
        if (this.si != 0) {
            return this.si;
        }
        return this.sx ? 4 : 1;
    };
    PolarBase.prototype.get_sx = function () {
        return false;
    };
    Object.defineProperty(PolarBase.prototype, "sx", {
        get: function () {
            return this.get_sx();
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.sz = function () {
        return this.sw;
    };
    PolarBase.prototype.sy = function () {
        return this.sv;
    };
    PolarBase.prototype.ss = function (a) {
        if (typeCast(NumericRadiusAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    PolarBase.prototype.sr = function (a) {
        if (typeCast(NumericAngleAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    PolarBase.prototype.k2 = function (a, b) {
        _super.prototype.k2.call(this, a, b);
        var c = b;
        if (a) {
            c.cw.clear();
        }
        c.cv.g$d();
    };
    PolarBase.prototype.ru = function (a, b) {
        var c = a.top - 10;
        var d = a.bottom + 10;
        var e = a.left - 10;
        var f = a.right + 10;
        var g = ((function () {
            var $ret = new Clipper(1, e, d, f, c, false);
            $ret.i = b;
            return $ret;
        })());
        return g;
    };
    PolarBase.prototype.t4 = function (a, b, c, d) {
        a.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, b);
        var e = this.cl;
        var _loop_1 = function (f) {
            var g = a.w._inner[f];
            if (!isInfinity(g.x) && !isInfinity(g.y)) {
                var h_1 = { $type: Point_$type, x: this_1.sn.item(f), y: this_1.so.item(f) };
                var i_1 = { $type: Point_$type, x: g.x, y: g.y };
                a.g.addItem(e.item(f), ((function () {
                    var $ret = new OwnedPoint();
                    $ret.a = e.item(f);
                    $ret.b = h_1;
                    $ret.c = i_1;
                    return $ret;
                })()));
            }
        };
        var this_1 = this;
        for (var f = 0; f < b; f++) {
            _loop_1(f);
        }
    };
    PolarBase.prototype.ua = function (a, b) {
        var _this = this;
        var c = b.bv;
        var d = b.bu;
        a.j.clear();
        a.n.clear();
        var 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);
        }
        var f = this.ru(d, a.n);
        var g = Math.min(this.r2.lw, this.r2.lv);
        var 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 = function (i, j) { return _this.r4.c(i, j, c, d, Math.cos); };
        b.cv.m = function (i, j) { return _this.r4.d(i, j, c, d, Math.sin); };
        var i = new List$1(Number_$type, 0);
        for (var j = 0; j < this.sn.count; j++) {
            if (this.sn.item(j) >= g && this.sn.item(j) <= h) {
                i.add(this.sn.item(j));
            }
        }
        var k = this.so;
        if (i.count != this.sn.count) {
            k = new List$1(Number_$type, 0);
            for (var 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), ((function () {
            var $ret = new TrendResolutionParams();
            $ret.b = _this.fx;
            $ret.f = d;
            $ret.g = c;
            return $ret;
        })()), f, g, h);
    };
    PolarBase.prototype.get_d0 = function () {
        return true;
    };
    PolarBase.prototype.ry = function (a, b, c) {
        return null;
    };
    PolarBase.prototype.rz = function (a, b, c) {
        var d = this.sa();
        var e = this.r6.by(this.pn(b));
        var 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;
        }
        var 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;
    };
    PolarBase.prototype.rx = function (a, b, c) {
        var 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;
    };
    PolarBase.prototype.ax = function (a, b, c) {
        if (this.c3 && this.ei(this.bl) && !c) {
            var d = this.ry(a, b, this.r0);
            this.r0 = d;
            return d;
        }
        else {
            var e = this.rx(a, b, this.r0);
            this.r0 = e;
            return e;
        }
    };
    PolarBase.prototype.ay = function (a, b, c) {
        if (this.ei(this.bl) && !c) {
            var d = this.rz(a, b, this.r1);
            this.r1 = d;
            return d;
        }
        else {
            var e = this.rx(a, b, this.r1);
            e.e = true;
            this.r1 = e;
            return e;
        }
    };
    PolarBase.prototype.s1 = function () {
        return (this.assigningPolarStyle != null && this.sq) || (this.bl != 1);
    };
    PolarBase.prototype.s0 = function () {
        return (this.assigningPolarMarkerStyle != null && this.sp) || (this.bl != 1);
    };
    PolarBase.prototype.ue = function (a, b) {
        var c = b.bv;
        var d = b.bu;
        var e = this.getEffectiveViewport1(b);
        var 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();
        var g = this.ru(d, b.cv.g$j.an);
        b.cv.g$h(a.n, g);
        this.t3(d, c, e, f, b);
    };
    PolarBase.prototype.rr = function (a, b) {
        return this.rs(a, b);
    };
    PolarBase.prototype.rs = function (a, b) {
        if (b < a || a < 0 || a > this.sn.count || b < 0 || b > this.sn.count) {
            return null;
        }
        var c = new Array((b - a) + 1);
        for (var d = a; d <= b; d++) {
            var e = d;
            c[d - a] = this.cl.item(d);
        }
        return c;
    };
    PolarBase.prototype.t6 = function (a, b) {
        var _this = this;
        a.b3 = true;
        this.se.ay(this, this.s0(), runOn(this, this.rr));
        var c = this.se.d;
        var d = c != null;
        var e = this.getEffectiveViewport1(a);
        var f = this.cl == null ? 0 : this.cl.count;
        this.r6.cf(function (g) {
            if (g._visibility == 0) {
                var h = g.ak;
                var 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);
            }
        });
    };
    PolarBase.prototype.t9 = function (a, b, c) {
        var d = this.bl != 1;
        this.se.a0(this.se.b, a, b, false);
        this.se.ab(this.fv);
        var e = this.se.ax;
        var f = null;
        var 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);
    };
    PolarBase.prototype.t8 = function (a, b, c) {
        var d = this.bl != 1;
        this.se.a0(this.se.d, a, b, true);
        this.se.aa(this.fv);
        var e = this.se.aw;
        var f = null;
        var g = this.cl;
        var 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);
    };
    PolarBase.prototype.uc = function (a) {
        if (this.assigningPolarStyle != null && this.sq) {
            this.assigningPolarStyle(this, a);
        }
    };
    PolarBase.prototype.ub = function (a) {
        if (this.assigningPolarMarkerStyle != null && this.sp) {
            this.assigningPolarMarkerStyle(this, a);
        }
    };
    PolarBase.prototype.t3 = function (a, b, c, d, e) {
        e.cy(a, b, c, d);
    };
    PolarBase.prototype.m1 = function () {
        _super.prototype.m1.call(this);
        if (this.index < 0) {
            return;
        }
        this.r6.c1();
    };
    PolarBase.prototype.mp = function (a, b) {
        _super.prototype.mp.call(this, a, b);
        if (!this.e3) {
            this.b1.a2(b);
            return;
        }
        this.b1.a2(b);
        if (this.cy(this.b0)) {
            return;
        }
        var 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;
    };
    PolarBase.prototype.mm = function (a, b, c, d, e) {
        _super.prototype.mm.call(this, a, b, c, d, e);
        var f = this.a7.a$h.item(d);
        var 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);
    };
    PolarBase.prototype.ud = function (a, b) {
        var e_1, _a, e_2, _b;
        var c = new List$1(Base.$, 0);
        try {
            for (var _c = __values(fromEnum(b.c)), _d = _c.next(); !_d.done; _d = _c.next()) {
                var d = _d.value;
                if (!a.containsKey(d)) {
                    c.add1(d);
                }
            }
        }
        catch (e_1_1) {
            e_1 = { error: e_1_1 };
        }
        finally {
            try {
                if (_d && !_d.done && (_a = _c.return))
                    _a.call(_c);
            }
            finally {
                if (e_1)
                    throw e_1.error;
            }
        }
        try {
            for (var _e = __values(fromEnum(c)), _f = _e.next(); !_f.done; _f = _e.next()) {
                var e = _f.value;
                b.h(e);
            }
        }
        catch (e_2_1) {
            e_2 = { error: e_2_1 };
        }
        finally {
            try {
                if (_f && !_f.done && (_b = _e.return))
                    _b.call(_e);
            }
            finally {
                if (e_2)
                    throw e_2.error;
            }
        }
    };
    PolarBase.prototype.rq = function (a, b, c) {
        this.t7();
        return this.r7.w.toArray();
    };
    PolarBase.prototype.s4 = function (a) {
        var e_3, _a;
        var b = new List$1(Number_$type, 0);
        var c = this.cl;
        try {
            for (var _b = __values(fromEnum(this.r6.cw.c)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var d = _c.value;
                b.add(c.indexOf(d));
            }
        }
        catch (e_3_1) {
            e_3 = { error: e_3_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_3)
                    throw e_3.error;
            }
        }
        return b;
    };
    PolarBase.prototype.u6 = function (a) {
        return { $type: Point_$type, x: this.sn.item(a), y: this.so.item(a) };
    };
    PolarBase.prototype.lc = function (a) {
        _super.prototype.lc.call(this, a);
        this.a9.exportTrendlineData(this, a, this.r6.cv.g$j);
    };
    PolarBase.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = { $type: Point_$type, x: a, y: b };
        var d = this.hy(c);
        var e = d == null ? NaN : this.gf(d, "RadiusMemberPath");
        var f = d == null ? NaN : this.gf(d, "AngleMemberPath");
        var 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 : "";
        var 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 : "";
        var i = new DataLegendSeriesContext();
        i.f = ((function () {
            var $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, function (a, b) { return 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;
}(MarkerSeries));
export { PolarBase };
/**
 * @hidden
 */
var PolarSeriesRenderManager = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(PolarSeriesRenderManager, _super);
    function PolarSeriesRenderManager() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.aw = null;
        _this.ax = null;
        return _this;
    }
    PolarSeriesRenderManager.prototype.c = function () {
        this.aw = new AssigningPolarMarkerStyleEventArgs();
        return this.aw;
    };
    PolarSeriesRenderManager.prototype.a = function () {
        this.ax = new AssigningPolarStyleEventArgs();
        return this.ax;
    };
    PolarSeriesRenderManager.prototype.ay = function (a, b, c) {
        this.w(a, b, c);
    };
    PolarSeriesRenderManager.prototype.az = function (a, b, c) {
        this.x(a, b, c);
    };
    PolarSeriesRenderManager.prototype.a0 = function (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;
}(SeriesRenderManager));
export { PolarSeriesRenderManager };
/**
 * @hidden
 */
var PolarBaseView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(PolarBaseView, _super);
    function PolarBaseView(a) {
        var _this = _super.call(this, a) || this;
        _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();
        return _this;
    }
    PolarBaseView.prototype.as = function () {
        _super.prototype.as.call(this);
        this.ct = this.cs();
        if (!this.q) {
            this.cu.tc = 1000;
            this.b1.ql = Defaults.e;
        }
    };
    PolarBaseView.prototype.cz = function (a) {
        this.cw.g(a);
    };
    PolarBaseView.prototype.cs = function () {
        var _this = this;
        var a = new NumericMarkerManager(0, function (b) { return _this.cw.item(b); }, function (b) { return _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;
    };
    PolarBaseView.prototype.c0 = function (a) {
        this.cu.ud(a, this.cw);
    };
    PolarBaseView.prototype.cr = function () {
        return this.cu.rq(this.cw, this.bv, this.bu);
    };
    PolarBaseView.prototype.cx = function () {
        return this.cu.s4(this.cw);
    };
    PolarBaseView.prototype.cy = function (a, b, c, d) {
        if (this.cu.st) {
            var e = new GeometryGroup();
            this.cu.r3.n1(e, a, b, c, d);
        }
        else {
        }
    };
    PolarBaseView.prototype.c1 = function () {
        if (this.cu.u3 != null) {
            this.cu.u2 = this.cu.u3;
        }
        else {
            this.cu.u2 = this.cu.o5;
        }
    };
    PolarBaseView.prototype.cf = function (a) {
        this.cw.f(a);
    };
    PolarBaseView.prototype.a5 = function (a, b) {
        if (a.d) {
            if (this.cu.sk != 0 && !b) {
                var 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.prototype.a5.call(this, a, b);
    };
    PolarBaseView.prototype.c2 = function () {
        return Rect.empty;
    };
    PolarBaseView.prototype.getDefaultTooltipTemplate = function () {
        var a = "<div class='ui-chart-default-tooltip-content'><span>" + "${item." + this.cu.tm + "}" + "</span><br/><span";
        var 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;
}(MarkerSeriesView));
export { PolarBaseView };
