/*
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, delegateCombine, Number_$type, enumGetBox, Point_$type, typeCast, fromEnum, markType, markDep } from "igniteui-react-core";
import { PolarAxisInfoCache } from "./PolarAxisInfoCache";
import { SeriesRenderer$2 } from "./SeriesRenderer$2";
import { PolarFrame } from "./PolarFrame";
import { DependencyProperty } from "igniteui-react-core";
import { NumericAngleAxis } from "./NumericAngleAxis";
import { NumericRadiusAxis } from "./NumericRadiusAxis";
import { TrendLineType_$type } from "igniteui-react-core";
import { Brush } from "igniteui-react-core";
import { PenLineCap_$type } from "igniteui-react-core";
import { DoubleCollection } from "igniteui-react-core";
import { ScatterItemSearchMode_$type } from "./ScatterItemSearchMode";
import { HighlightingInfo } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { ScalerParams } from "./ScalerParams";
import { Rect } from "igniteui-react-core";
import { Marker } from "./Marker";
import { MarkerSeriesView } from "./MarkerSeriesView";
import { PolarAxes } from "./PolarAxes";
import { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay";
import { IFastItemsSource_$type } from "igniteui-react-core";
import { SeriesRenderingArguments } from "./SeriesRenderingArguments";
import { AxisRange } from "./AxisRange";
import { Dictionary$2 } from "igniteui-react-core";
import { OwnedPoint } from "./OwnedPoint";
import { GeometryUtil } from "igniteui-react-core";
import { DataContext } from "igniteui-react-core";
import { HashPool$2 } from "igniteui-react-core";
import { Clipper } from "igniteui-react-core";
import { PolarTrendLineManager } from "./PolarTrendLineManager";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { AssigningPolarStyleEventArgs } from "./AssigningPolarStyleEventArgs";
import { AssigningPolarMarkerStyleEventArgs } from "./AssigningPolarMarkerStyleEventArgs";
import { SeriesRenderManager } from "./SeriesRenderManager";
import { DataLegendSeriesValueInfo } from "igniteui-react-core";
import { DataLegendSeriesContext } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { truncate, isNaN_, isInfinity } from "igniteui-react-core";
import { Defaults } from "./Defaults";
import { NumericMarkerManager } from "./NumericMarkerManager";
import { GeometryGroup } from "igniteui-react-core";
import { stringIsNullOrEmpty } from "igniteui-react-core";
/**
 * @hidden
 */
var PolarBase = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(PolarBase, _super);
    function PolarBase() {
        var _this = _super.call(this) || this;
        _this.vt = null;
        _this.vk = null;
        _this.vr = null;
        _this.y9 = null;
        _this.y8 = null;
        _this.v5 = null;
        _this.wc = null;
        _this.wd = null;
        _this.vx = new PolarFrame();
        _this.vz = new PolarFrame();
        _this.vv = new PolarFrame();
        _this.vq = null;
        _this.wv = null;
        _this.v1 = 1;
        _this.wh = false;
        _this.wg = false;
        _this.wa = null;
        _this.wb = null;
        _this.assigningPolarStyle = null;
        _this.assigningPolarMarkerStyle = null;
        _this.v0 = null;
        _this.vy = null;
        _this.vu = null;
        _this.v0 = new PolarSeriesRenderManager();
        _this.v2 = _this.v3();
        _this.vy = new PolarFrame();
        _this.vz.x = runOn(_this, _this.y7);
        _this.vx.x = runOn(_this, _this.y7);
        _this.vv.x = runOn(_this, _this.y7);
        _this.v5 = new SeriesRenderer$2(PolarFrame.$, PolarBaseView.$, 0, runOn(_this, _this.x8), runOn(_this, _this.yc), runOn(_this, _this.dk), runOn(_this, _this.p5), runOn(_this, _this.x1));
        return _this;
    }
    PolarBase.prototype.cd = function () {
        return new PolarBaseView(this);
    };
    PolarBase.prototype.o2 = function (a) {
        _super.prototype.o2.call(this, a);
        this.vs = a;
    };
    PolarBase.prototype.nh = function () {
        _super.prototype.nh.call(this);
        this.vo = null;
        this.vp = null;
    };
    PolarBase.prototype.get_e3 = function () {
        return true;
    };
    PolarBase.prototype.dt = function (a, b, c, d) {
        var _this = this;
        if (!this.hasMarkers) {
            return false;
        }
        var e = this.vo;
        var f = new ScalerParams(1, this.cv.tr, this.ty, e.ch);
        f.c = this.getEffectiveViewport1(this.cg);
        var g = this.vp;
        var h = new ScalerParams(1, this.cv.tr, this.ty, g.ch);
        h.c = this.getEffectiveViewport1(this.cg);
        a.clear();
        this.ub.ci(function (i) {
            if (i._visibility == 0) {
                var j = new SeriesPointOfInterest();
                var k = i.n;
                var l = i.o;
                if (k < _this.ty.left || k > _this.ty.right || l < _this.ty.top || l > _this.ty.bottom) {
                    return;
                }
                var m = void 0;
                var n = void 0;
                var o = _this.vq.f(k, l, _this.cg.by, _this.cg.bx, 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.x1 = function () {
        if (this.cw.g) {
            this.cw.t();
        }
    };
    PolarBase.prototype.x3 = function () {
        this.vq.e(this.vt.w, this.we, this.wf, this.y9, this.y8, function (a, b) { return Math.cos(b); }, function (a, b) { return Math.sin(b); }, true);
    };
    PolarBase.prototype.fo = function () {
        return this.highlightedItemsSource != null || (this.xj != null && this.xh != null);
    };
    PolarBase.prototype.wt = function () {
        return false;
    };
    PolarBase.prototype.g1 = function () {
        var a = _super.prototype.g1.call(this);
        {
            var b = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.ad = "AngleMemberPath";
                $ret.p = true;
                $ret.y = "HighlightedAngleMemberPath";
                $ret.q = true;
                return $ret;
            })());
            b.valueResolving = delegateCombine(b.valueResolving, runOn(this, this.x4));
            a.add(b);
        }
        {
            var c = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.ad = "RadiusMemberPath";
                $ret.p = true;
                $ret.y = "HighlightedRadiusMemberPath";
                $ret.q = true;
                return $ret;
            })());
            c.valueResolving = delegateCombine(c.valueResolving, runOn(this, this.x5));
            a.add(c);
        }
        if (this.wt()) {
            var d = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "DashArray";
                $ret.p = true;
                $ret.x = ((function () {
                    var $ret = new DoubleCollection();
                    $ret.add(5);
                    $ret.add(5);
                    return $ret;
                })());
                $ret.q = true;
                return $ret;
            })());
            a.add(d);
        }
        if (!this.wt()) {
            var e = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "Brush";
                $ret.p = true;
                $ret.y = "ActualBrush";
                $ret.q = true;
                return $ret;
            })());
            e.valueResolving = delegateCombine(e.valueResolving, runOn(this, this.pz));
            a.add(e);
        }
        if (!this.wt()) {
            var f = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.r = true;
                $ret.ad = "Outline";
                $ret.p = true;
                $ret.y = "ActualOutline";
                $ret.q = true;
                return $ret;
            })());
            f.valueResolving = delegateCombine(f.valueResolving, runOn(this, this.pz));
            a.add(f);
        }
        return a;
    };
    PolarBase.prototype.x5 = function (a, b) {
        if (this.xj != null) {
            b.value = this.xj;
            return;
        }
        b.value = this.xw;
    };
    PolarBase.prototype.x4 = function (a, b) {
        if (this.xh != null) {
            b.value = this.xh;
            return;
        }
        b.value = this.xe;
    };
    Object.defineProperty(PolarBase.prototype, "we", {
        get: function () {
            return this.wc;
        },
        set: function (a) {
            if (this.wc != a) {
                var b = this.we;
                this.wc = a;
                this.raisePropertyChanged("AngleColumn", b, this.we);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(PolarBase.prototype, "wf", {
        get: function () {
            return this.wd;
        },
        set: function (a) {
            if (this.wd != a) {
                var b = this.wf;
                this.wd = a;
                this.raisePropertyChanged("RadiusColumn", b, this.wf);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(PolarBase.prototype, "y2", {
        get: function () {
            return this.c(PolarBase.yd);
        },
        set: function (a) {
            this.h(PolarBase.yd, a);
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.vw = function () {
        var a = this.vv;
        if (this.dk()) {
            if (this.cw.g) {
                this.cw.t();
            }
            a = this.vz;
        }
        return a;
    };
    PolarBase.prototype.oc = function () {
        _super.prototype.oc.call(this);
        if (this.vp != null) {
            this.vp.h8(false);
        }
        if (this.vo != null) {
            this.vo.h8(false);
        }
    };
    PolarBase.prototype.np = function (a, b, c, d) {
        var e = false;
        this.vs.cy.g$e(a, b, c, d);
        if (this.vo != null && !this.vo.c1()) {
            e = true;
        }
        if (this.vp != null && !this.vp.c1()) {
            e = true;
        }
        if (e) {
            this.pr(true);
        }
    };
    PolarBase.prototype.qo = function (a, b) {
        this.pr(false);
    };
    PolarBase.prototype.qp = function (a, b) {
        this.pr(false);
    };
    PolarBase.prototype.gm = function (a, b, c) {
        var d = true;
        if (!_super.prototype.gm.call(this, a, b, c) || !c.o() || b.isEmpty || a.isEmpty || this.vo == null || this.vp == null || this.we == null || this.wf == null || this.we.count == 0 || this.wf.count == 0 || this.c7 == null || this.c7.count != this.we.count || this.c7.count != this.wf.count || this.vq == null || this.vo.bi == null || this.vp.bi == null || this.vo.lx == this.vo.lw || this.vp.lx == this.vp.lw) {
            d = false;
        }
        return d;
    };
    PolarBase.prototype.ps = function (a) {
        _super.prototype.ps.call(this, a);
        var b;
        var c;
        var d = this.getViewInfo(c, b);
        c = d.p0;
        b = d.p1;
        if (!this.gm(c, b, this.cg)) {
            this.nk(true, this.cg);
            return;
        }
        this.y9 = b;
        this.y8 = c;
        this.vr = new PolarAxisInfoCache(this.vo, this.vp, this.c7);
        var e = new SeriesRenderingArguments(this, c, b, a, this.f1);
        var f = this.v5.g(e, this.vx, this.vv, this.vz, this.vs);
        this.vx = f.p1;
        this.vv = f.p2;
        this.vz = f.p3;
    };
    PolarBase.prototype.y7 = function (a) {
        var b = this.vq.h(a.x, a.y, this.y9, this.y8, this.vr.e, this.vr.d, this.vr.g, this.vr.f, this.vr.i, this.vr.h);
        return b;
    };
    PolarBase.prototype.aq = function (a) {
        if (a != null && a == this.vo && this.we != null) {
            return new AxisRange(this.we.minimum, this.we.maximum);
        }
        if (a != null && a == this.vp && this.wf != null) {
            return new AxisRange(this.wf.minimum, this.wf.maximum);
        }
        return null;
    };
    PolarBase.prototype.fp = function (a) {
        var b = this.cg.by;
        b = b.copy();
        var c = this.cg.bx;
        var d = !b.isEmpty && !c.isEmpty && this.c7 != null ? this.c7.indexOf(a) : -1;
        if (this.vo == null || this.we == null || this.vp == null || this.wf == null) {
            return false;
        }
        if (d < 0 || d > this.we.count - 1 || d > this.wf.count - 1) {
            return false;
        }
        var e = this.vo.getScaledAngle(this.we.item(d));
        var f = this.vp.nu(this.wf.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.co != null) {
            this.co.au(this.cv, b, true);
        }
        return d >= 0;
    };
    PolarBase.prototype.js = function (a) {
        var b = this.i9(a);
        if (this.c7 != null && b >= 0 && b < this.c7.count) {
            return this.c7.item(b);
        }
        return null;
    };
    PolarBase.prototype.i9 = function (a) {
        var b = truncate(Math.round(this.hw(a)));
        return b;
    };
    PolarBase.prototype.hw = function (a) {
        switch (this.v2) {
            case 1: return this.wz(a);
            case 3: return this.w0(a);
            case 2: return this.wx(a);
            case 4: return this.wy(a);
        }
        return -1;
    };
    PolarBase.prototype.wy = function (a) {
        return this.w1(a, false);
    };
    PolarBase.prototype.wx = function (a) {
        var b = this.te(a);
        var c = b.x;
        var d = b.y;
        if (this.c7 == null || this.vo == null || this.vp == null || this.we == null || this.wf == null) {
            return -1;
        }
        if (this.c7.count > this.w3) {
            return -1;
        }
        if (!this.wl()) {
            return -1;
        }
        var e = this.wv;
        var f = 1.7976931348623157E+308;
        var g = -1;
        for (var h = 0; h < this.we.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.wl = function () {
        var a = this.vv;
        if (this.dk()) {
            a = this.vz;
        }
        if (a == null || a.w.count == 0) {
            return false;
        }
        this.wv = a.w;
        return true;
    };
    PolarBase.prototype.w1 = function (a, b) {
        if (!this.wo) {
            return -1;
        }
        var c = { $type: Point_$type, x: 0, y: 0 };
        var d = true;
        var e = this.vv;
        if (this.dk()) {
            e = this.vz;
        }
        if (e == null) {
            return -1;
        }
        if (e.m == null) {
            return -1;
        }
        if (this.c7 == null || this.c7.count > this.w3) {
            return -1;
        }
        if (!this.wl()) {
            return -1;
        }
        var f = this.wv;
        var g = this.te(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.c7.item(j)) || e.j.containsKey(this.c7.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.c7.item(i)) && e.j.containsKey(this.c7.item(i - 1)))) {
                var o = GeometryUtil.i(g, n, m);
                return (i - 1) + o;
            }
            else if (e.j.containsKey(this.c7.item(i))) {
                return i;
            }
            else {
                return i - 1;
            }
        }
        return -1;
    };
    PolarBase.prototype.w0 = function (a) {
        return this.w1(a, true);
    };
    PolarBase.prototype.wz = function (a) {
        var _this = this;
        var b = null;
        var c = 1.7976931348623157E+308;
        var d = this.te(a);
        var e = d.x;
        var f = d.y;
        if (this.vs.cz.e > this.w3) {
            return -1;
        }
        this.vs.c2(function (g) {
            if (g._visibility == 0) {
                var h = _this.vs.cs(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.tj = function (a, b, c) {
        var _this = this;
        if (this.vo == null || this.vp == null || this.we == null || this.wf == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        var d = this.cg.by;
        var e = this.cg.bx;
        var f = this.getEffectiveViewport();
        var g = new ScalerParams(0, d, e, this.vo.ch, f);
        var h = ((function () {
            var $ret = new ScalerParams(0, d, e, _this.vp.ch, f);
            $ret.b = _this.h3();
            return $ret;
        })());
        if (b) {
            var i = this.hw(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.c7.count - 1) {
                k = this.c7.count - 1;
            }
            if (j > this.c7.count - 1) {
                j = this.c7.count - 1;
            }
            if (k == j) {
                return this.vq.h(this.we.item(j), this.wf.item(j), d, e, this.vr.e, this.vr.d, this.vr.g, this.vr.f, this.vr.i, this.vr.h);
            }
            var l = i - Math.floor(i);
            var m = this.vq.h(this.we.item(j), this.wf.item(j), d, e, this.vr.e, this.vr.d, this.vr.g, this.vr.f, this.vr.i, this.vr.h);
            var n = this.vq.h(this.we.item(k), this.wf.item(k), d, e, this.vr.e, this.vr.d, this.vr.g, this.vr.f, this.vr.i, this.vr.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.i9(a);
            if (u == -1) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            return this.vq.h(this.we.item(u), this.wf.item(u), d, e, this.vr.e, this.vr.d, this.vr.g, this.vr.f, this.vr.i, this.vr.h);
        }
    };
    PolarBase.prototype.ag = function () {
        return [this.vo, this.vp];
    };
    PolarBase.prototype.jv = function (a, b) {
        var c = this.lw(b);
        if (c == PolarBase.$$p[3]) {
            return this.jw(a, b, this.xe);
        }
        if (c == PolarBase.$$p[15]) {
            return this.jw(a, b, this.xw);
        }
        return _super.prototype.jv.call(this, a, b);
    };
    PolarBase.prototype.pa = function (a, b, c, d) {
        _super.prototype.pa.call(this, a, b, c, d);
        if (this.vs.cy.g$b(a, b, c, d)) {
            this.pr(false);
            this.om();
        }
        switch (b) {
            case "FastItemsSource":
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    c.deregisterColumn(this.we);
                    c.deregisterColumn(this.wf);
                    this.we = null;
                    this.wf = null;
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    this.we = this.c4(this.xe);
                    this.wf = this.c4(this.xw);
                }
                if ((this.vp != null && !this.vp.c1()) || (this.vo != null && !this.vo.c1())) {
                    this.pr(this.fr && c != null);
                }
                break;
            case PolarBase.$$p[0]:
                if (this.vo != null && this.vp != null) {
                    this.vq = new PolarAxes(this.vp, this.vo);
                }
                if (c != null) {
                    c.b0(this);
                }
                if (d != null) {
                    d.ct(this);
                }
                if (this.vo != null && !this.vo.c1()) {
                    this.pr(false);
                }
                else if (c != null && d == null) {
                    this.nk(true, this.cg);
                }
                break;
            case PolarBase.$$p[12]:
                if (this.vo != null && this.vp != null) {
                    this.vq = new PolarAxes(this.vp, this.vo);
                }
                if (c != null) {
                    c.b0(this);
                }
                if (d != null) {
                    d.ct(this);
                }
                if (this.vp != null && !this.vp.c1()) {
                    this.pr(false);
                }
                else if (c != null && d == null) {
                    this.nk(true, this.cg);
                }
                if (this.vo != null && !this.vo.c1()) {
                    this.vo.h4();
                }
                break;
            case PolarBase.$$p[3]:
                if (this.c7 != null) {
                    this.c7.deregisterColumn(this.we);
                    this.we = this.c4(this.xe);
                }
                break;
            case "AngleColumn":
                this.vs.cy.g$i();
                if (this.vo != null && !this.vo.c1()) {
                    this.pr(this.fr && this.dp);
                }
                break;
            case PolarBase.$$p[15]:
                if (this.c7 != null) {
                    this.c7.deregisterColumn(this.wf);
                    this.wf = this.c4(this.xw);
                }
                break;
            case "RadiusColumn":
                this.vs.cy.g$i();
                if (this.vp != null && !this.vp.c1()) {
                    this.pr(this.fr && this.dp);
                }
                break;
            case PolarBase.$$p[16]:
                this.pr(false);
                this.om();
                break;
            case PolarBase.$$p[11]:
                this.pr(false);
                this.om();
                break;
            case "TransitionProgress":
                this.vr = new PolarAxisInfoCache(this.vo, this.vp, this.c7);
                this.y9 = this.cg.by;
                this.y8 = this.cg.bx;
                this.vz.v = this.wu;
                this.vz.c(this.iw, this.vx, this.vv);
                if (this.dm(this.cg)) {
                    return;
                }
                if (this.iw == 1) {
                    this.yc(this.vv, this.vs);
                    this.op();
                }
                else {
                    this.yc(this.vz, this.vs);
                }
                if (this.cv != null) {
                    this.cv.or(this);
                }
                break;
            case "TrendLineBrush":
                this.pg(b);
                break;
            case PolarBase.$$p[4]:
                this.pr(false);
                this.om();
                break;
            case "TrendLineType":
                this.om();
                break;
            case PolarBase.$$p[8]:
                this.wh = this.wq();
                this.pr(false);
                break;
            case PolarBase.$$p[7]:
                this.wg = this.wp();
                this.pr(false);
                break;
            case PolarBase.$$p[9]:
                this.v2 = this.v3();
                break;
        }
    };
    Object.defineProperty(PolarBase.prototype, "v2", {
        get: function () {
            return this.v1;
        },
        set: function (a) {
            var b = this.v1;
            this.v1 = a;
            if (b != this.v1) {
                this.raisePropertyChanged("ActualItemSearchMode", enumGetBox(ScatterItemSearchMode_$type, b), enumGetBox(ScatterItemSearchMode_$type, this.v1));
            }
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.v3 = function () {
        if (this.v4 != 0) {
            return this.v4;
        }
        return this.wo ? 4 : 1;
    };
    PolarBase.prototype.get_wo = function () {
        return false;
    };
    Object.defineProperty(PolarBase.prototype, "wo", {
        get: function () {
            return this.get_wo();
        },
        enumerable: false,
        configurable: true
    });
    PolarBase.prototype.wq = function () {
        return this.wn;
    };
    PolarBase.prototype.wp = function () {
        return this.wm;
    };
    PolarBase.prototype.wj = function (a) {
        if (typeCast(NumericRadiusAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    PolarBase.prototype.wi = function (a) {
        if (typeCast(NumericAngleAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    PolarBase.prototype.nk = function (a, b) {
        _super.prototype.nk.call(this, a, b);
        var c = b;
        if (a) {
            c.cz.clear();
        }
        c.cy.g$d();
    };
    PolarBase.prototype.vl = 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.x0 = function (a, b, c, d) {
        a.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, b);
        var e = this.c7;
        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.we.item(f), y: this_1.wf.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.x8 = function (a, b) {
        var _this = this;
        var c = b.by;
        var d = b.bx;
        a.j.clear();
        a.n.clear();
        var e = Math.min(this.we != null ? this.we.count : 0, this.wf != null ? this.wf.count : 0);
        if (e < 1) {
            return;
        }
        this.vr = new PolarAxisInfoCache(this.vo, this.vp, this.c7);
        this.vt = a;
        this.y8 = d;
        this.y9 = c;
        b.cw.l(a.j, this.w4, c, d, this.hk);
        if (e <= this.w4) {
            this.x0(a, e, c, d);
        }
        var f = this.vl(d, a.n);
        var g = Math.min(this.vo.lx, this.vo.lw);
        var h = Math.max(this.vo.lw, this.vo.lx);
        b.cy.i = this.wu;
        b.cy.h = 0;
        b.cy.k = this.vp.no;
        b.cy.j = this.vp.nn;
        b.cy.l = function (i, j) { return _this.vq.c(i, j, c, d, Math.cos); };
        b.cy.m = function (i, j) { return _this.vq.d(i, j, c, d, Math.sin); };
        var i = new List$1(Number_$type, 0);
        for (var j = 0; j < this.we.count; j++) {
            if (this.we.item(j) >= g && this.we.item(j) <= h) {
                i.add(this.we.item(j));
            }
        }
        var k = this.wf;
        if (i.count != this.we.count) {
            k = new List$1(Number_$type, 0);
            for (var l = 0; l < this.we.count; l++) {
                if (this.we.item(l) >= g && this.we.item(l) <= h) {
                    k.add(this.wf.item(l));
                }
            }
        }
        b.cy.n(a.n, this.v6, i, k, this.w5, runOn(this.vo, this.vo.getScaledAngle), runOn(this.vp, this.vp.nu), ((function () {
            var $ret = new TrendResolutionParams();
            $ret.d = _this.hk;
            $ret.h = d;
            $ret.i = c;
            return $ret;
        })()), f, g, h);
    };
    PolarBase.prototype.get_et = function () {
        return true;
    };
    PolarBase.prototype.v8 = function (a, b, c) {
        return null;
    };
    PolarBase.prototype.v9 = function (a, b, c) {
        var d = this.vw();
        var e = this.vs.b1(this.te(b));
        var f = -1;
        if (e == null) {
            if (a != null) {
                f = this.c7.indexOf(a);
            }
            else {
                return null;
            }
        }
        else {
            f = e.ak;
        }
        if (f == -1) {
            return null;
        }
        var g = new HighlightingInfo();
        g.i = this;
        g.g = f;
        g.f = f;
        g.c = false;
        g.d = true;
        if (c != null && c.g == g.g && c.f == g.f) {
            return c;
        }
        return g;
    };
    PolarBase.prototype.v7 = function (a, b, c) {
        var d = new HighlightingInfo();
        d.i = this;
        d.g = 0;
        d.f = this.c7.count - 1;
        d.c = true;
        if (c != null && c.g == d.g && c.f == d.f) {
            return c;
        }
        return d;
    };
    PolarBase.prototype.c0 = function (a, b, c) {
        if (this.dv && this.fd(this.bp) && !c) {
            var d = this.v8(a, b, this.wa);
            this.wa = d;
            return d;
        }
        else {
            var e = this.v7(a, b, this.wa);
            this.wa = e;
            return e;
        }
    };
    PolarBase.prototype.c1 = function (a, b, c) {
        if (this.fd(this.bp) && !c) {
            var d = this.v9(a, b, this.wb);
            this.wb = d;
            return d;
        }
        else {
            var e = this.v7(a, b, this.wb);
            e.d = true;
            this.wb = e;
            return e;
        }
    };
    PolarBase.prototype.ws = function () {
        return (this.assigningPolarStyle != null && this.wh) || (this.bp != 1);
    };
    PolarBase.prototype.wr = function () {
        return (this.assigningPolarMarkerStyle != null && this.wg) || (this.bp != 1);
    };
    PolarBase.prototype.yc = function (a, b) {
        this.oy();
        var c = b.by;
        var d = b.bx;
        var e = this.getEffectiveViewport1(b);
        var f = this.tq(b);
        this.vr = new PolarAxisInfoCache(this.vo, this.vp, this.c7);
        if (this.ue()) {
            b.cw.j(a.j, this.ug);
            if (this.wr()) {
                this.x2(b, a);
            }
        }
        b.cp();
        var g = this.vl(d, b.cy.g$j.an);
        b.cy.g$h(a.n, g);
        this.xz(d, c, e, f, b);
    };
    PolarBase.prototype.vi = function (a, b) {
        return this.vj(a, b);
    };
    PolarBase.prototype.vj = function (a, b) {
        if (b < a || a < 0 || a > this.we.count || b < 0 || b > this.we.count) {
            return null;
        }
        var c = new Array((b - a) + 1);
        for (var d = a; d <= b; d++) {
            var e = d;
            c[d - a] = this.c7.item(d);
        }
        return c;
    };
    PolarBase.prototype.x2 = function (a, b) {
        var _this = this;
        a.b6 = true;
        this.v0.ay(this, this.wr(), runOn(this, this.vi));
        var c = this.v0.d;
        var d = c != null;
        var e = this.getEffectiveViewport1(a);
        var f = this.c7 == null ? 0 : this.c7.count;
        this.vs.ci(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.x6(h, f, a.q);
                }
                _this.v0.ac(g, i);
            }
        });
    };
    PolarBase.prototype.x7 = function (a, b, c) {
        var d = this.bp != 1;
        this.v0.a0(this.v0.b, a, b, false);
        this.v0.ab(this.hi);
        var e = this.v0.ax;
        var f = null;
        var g = this.c7;
        if (d && this.cv != null) {
            f = this.cv.c2.getHighlightingInfo(this, g, e.o, e.n, false);
            e.b = f;
        }
        e.f = c;
        this.ya(e);
        this.v0.z(this, f, c, d, a < 0);
    };
    PolarBase.prototype.x6 = function (a, b, c) {
        var d = this.bp != 1;
        this.v0.a0(this.v0.d, a, b, true);
        this.v0.aa(this.hi);
        var e = this.v0.aw;
        var f = null;
        var g = this.c7;
        var h = null;
        if (d && this.cv != null) {
            f = this.cv.c2.getHighlightingInfo(this, g, e.o, e.n, true);
            if (this.cv.c2.isCrossContextHighlight(this)) {
                h = this.cv.c2.getHighlightingInfo(this, g, e.o, e.n, true);
            }
            e.b = f;
        }
        e.f = c;
        this.x9(e);
        this.v0.y(this, f, c, d, e.l, this.cv.c2.sumHighlightingProgress);
    };
    PolarBase.prototype.ya = function (a) {
        if (this.assigningPolarStyle != null && this.wh) {
            this.assigningPolarStyle(this, a);
        }
    };
    PolarBase.prototype.x9 = function (a) {
        if (this.assigningPolarMarkerStyle != null && this.wg) {
            this.assigningPolarMarkerStyle(this, a);
        }
    };
    PolarBase.prototype.xz = function (a, b, c, d, e) {
        e.c1(a, b, c, d);
    };
    PolarBase.prototype.qf = function () {
        _super.prototype.qf.call(this);
        if (this.index < 0) {
            return;
        }
        this.vs.c4();
    };
    PolarBase.prototype.pt = function (a, b) {
        _super.prototype.pt.call(this, a, b);
        if (!this.f9) {
            this.cg.a4(b);
            return;
        }
        this.cg.a4(b);
        if (this.dm(this.cf)) {
            return;
        }
        var c = this.cf;
        if (!this.f2) {
            this.vy = new PolarFrame();
            this.x8(this.vy, c);
        }
        this.f2 = false;
        this.yc(this.vy, c);
        this.f9 = false;
    };
    PolarBase.prototype.pq = function (a, b, c, d, e) {
        _super.prototype.pq.call(this, a, b, c, d, e);
        var f = this.a3.a$h.item(d);
        var g = f;
        f.a3(c);
        if (this.dm(g)) {
            return;
        }
        if (this.vu == null) {
            this.vu = new PolarFrame();
        }
        this.x8(this.vu, g);
        this.yc(this.vu, g);
    };
    PolarBase.prototype.yb = 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.vh = function (a, b, c) {
        this.x3();
        return this.vt.w.toArray();
    };
    PolarBase.prototype.ww = function (a) {
        var e_3, _a;
        var b = new List$1(Number_$type, 0);
        var c = this.c7;
        try {
            for (var _b = __values(fromEnum(this.vs.cz.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.y6 = function (a) {
        return { $type: Point_$type, x: this.we.item(a), y: this.wf.item(a) };
    };
    PolarBase.prototype.n2 = function (a) {
        _super.prototype.n2.call(this, a);
        this.a5.exportTrendlineData(this, a, this.vs.cy.g$j);
    };
    PolarBase.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = { $type: Point_$type, x: a, y: b };
        var d = this.js(c);
        var e = d == null ? NaN : this.h2(d, "RadiusMemberPath");
        var f = d == null ? NaN : this.h2(d, "AngleMemberPath");
        var g = new DataLegendSeriesValueInfo();
        g.l = e;
        g.a = 11;
        g.q = this.xw != null ? this.xw : "Radius";
        g.p = "Radius";
        g.r = this.xs != null ? this.xs : "R:";
        g.s = this.xu != null ? this.xu : "";
        var h = new DataLegendSeriesValueInfo();
        h.l = f;
        h.a = 10;
        h.q = this.xe != null ? this.xe : "Angle";
        h.p = "Angle";
        h.r = this.xa != null ? this.xa : "A:";
        h.s = this.xc != null ? this.xc : "";
        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.yd = 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:vo:ye', [NumericAngleAxis.$, null], 'AngleMemberAsLegendLabel:xa:yf', [2, null], 'AngleMemberAsLegendUnit:xc:yg', [2, null], 'AngleMemberPath:xe:yh', [2], 'ClipSeriesToBounds:wk:yi', [0, false], 'HighlightedAngleMemberPath:xh:yj', [2, null], 'HighlightedRadiusMemberPath:xj:yk', [2, null], 'IsCustomPolarMarkerStyleAllowed:wm:yl', [0, false], 'IsCustomPolarStyleAllowed:wn:ym', [0, false], 'ItemSearchMode:v4:yn', [ScatterItemSearchMode_$type, enumGetBox(ScatterItemSearchMode_$type, 0)], 'ItemSearchThreshold:w3:yo', [1, 10000], 'MaximumMarkers:w4:yp', [1, 400], 'RadiusAxis:vp:yq', [NumericRadiusAxis.$, null], 'RadiusMemberAsLegendLabel:xs:yr', [2, null], 'RadiusMemberAsLegendUnit:xu:ys', [2, null], 'RadiusMemberPath:xw:yt', [2], 'UseCartesianInterpolation:wu:y1', [0, true], 'TrendLineType:v6:yz', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness:w2:yy', [1, 1.5], 'TrendLinePeriod:w5:yx', [1, 7], 'TrendLineZIndex:w6:y0', [1, 1], 'TrendLineBrush:y3:yu', [Brush.$, null], 'TrendLineDashArray:y4:yv', [DoubleCollection.$], 'TrendLineDashCap:y5:yw', [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.cx = null;
        _this.cw = null;
        _this.cy = null;
        _this.cz = null;
        _this.cx = a;
        _this.cz = new HashPool$2(Base.$, Marker.$);
        _this.ck(_this.cz);
        _this.cy = new PolarTrendLineManager();
        return _this;
    }
    PolarBaseView.prototype.au = function () {
        _super.prototype.au.call(this);
        this.cw = this.cv();
        if (!this.q) {
            this.cx.w4 = 1000;
            this.b4.uc = Defaults.e;
        }
    };
    PolarBaseView.prototype.c2 = function (a) {
        this.cz.g(a);
    };
    PolarBaseView.prototype.cv = function () {
        var _this = this;
        var a = new NumericMarkerManager(0, function (b) { return _this.cz.item(b); }, function (b) { return _this.cx.vr.c.item(b); }, runOn(this, this.c3), runOn(this, this.cu), runOn(this, this.c0));
        a.n = true;
        a.p = runOn(this.cx, this.cx.y6);
        return a;
    };
    PolarBaseView.prototype.c3 = function (a) {
        this.cx.yb(a, this.cz);
    };
    PolarBaseView.prototype.cu = function () {
        return this.cx.vh(this.cz, this.by, this.bx);
    };
    PolarBaseView.prototype.c0 = function () {
        return this.cx.ww(this.cz);
    };
    PolarBaseView.prototype.c1 = function (a, b, c, d) {
        if (this.cx.wk) {
            var e = new GeometryGroup();
            this.cx.vp.n2(e, a, b, c, d);
        }
        else {
        }
    };
    PolarBaseView.prototype.c4 = function () {
        if (this.cx.y3 != null) {
            this.cx.y2 = this.cx.y3;
        }
        else {
            this.cx.y2 = this.cx.su;
        }
    };
    PolarBaseView.prototype.ci = function (a) {
        this.cz.f(a);
    };
    PolarBaseView.prototype.a7 = function (a, b) {
        if (a.d) {
            if (this.cx.v6 != 0 && !b) {
                var c = this.cy.g$j;
                c.ad = this.cx.w2;
                c._stroke = this.cx.y2;
                c.aj = this.cx.y5;
                c.ai = this.cx.y4;
                a.v(c);
            }
        }
        _super.prototype.a7.call(this, a, b);
    };
    PolarBaseView.prototype.c5 = function () {
        return Rect.empty;
    };
    PolarBaseView.prototype.getDefaultTooltipTemplate = function () {
        var a = "<div class='ui-chart-default-tooltip-content'><span>" + "${item." + this.cx.xe + "}" + "</span><br/><span";
        var b = this.e.a3.a$r(this.e);
        if (!stringIsNullOrEmpty(b)) {
            a += " style='color:" + b + "'";
        }
        a += ">" + this.cx.title + ": </span><span class='ui-priority-primary'>" + "${item." + this.cx.xw + "}</span></div>";
        return a;
    };
    PolarBaseView.$t = markType(PolarBaseView, 'PolarBaseView', MarkerSeriesView.$);
    return PolarBaseView;
}(MarkerSeriesView));
export { PolarBaseView };
