/*
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 } from "tslib";
import { RadialBucketCalculator } from "./RadialBucketCalculator";
import { markType, typeCast, Point_$type, runOn, delegateCombine, enumGetBox, markDep } from "igniteui-angular-core";
import { isNaN_, intDivide, isInfinity } from "igniteui-angular-core";
import { RadialBase } from "./RadialBase";
import { CategoryLineRasterizer } from "./CategoryLineRasterizer";
import { DependencyProperty } from "igniteui-angular-core";
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 { RadialFrame } from "./RadialFrame";
import { ProportionalCategoryAngleAxis } from "./ProportionalCategoryAngleAxis";
import { ScalerParams } from "./ScalerParams";
import { Rect } from "igniteui-angular-core";
import { FastItemCoalescingColumn } from "./FastItemCoalescingColumn";
import { List$1 } from "igniteui-angular-core";
import { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay";
import { DataLegendSeriesValueInfo } from "igniteui-angular-core";
import { DataLegendSeriesContext } from "igniteui-angular-core";
import { AxisRange } from "./AxisRange";
import { IFastItemsSource_$type } from "igniteui-angular-core";
import { NumericAxisBase } from "./NumericAxisBase";
import { RadialBaseView } from "./RadialBaseView";
import { ChartSelection } from "./ChartSelection";
import { CollisionRect } from "igniteui-angular-core";
import { CollisionAvoider } from "./CollisionAvoider";
import { Clipper } from "igniteui-angular-core";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { RadialTrendLineManager } from "./RadialTrendLineManager";
import { CategoryMarkerManager } from "./CategoryMarkerManager";
import { PropertyMetadata } from "igniteui-angular-core";
import { stringIsNullOrEmpty } from "igniteui-angular-core";
/**
 * @hidden
 */
var AnchoredRadialBucketCalculator = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(AnchoredRadialBucketCalculator, _super);
    function AnchoredRadialBucketCalculator(a) {
        var _this = _super.call(this, a) || this;
        _this.f = null;
        _this.f = a;
        return _this;
    }
    AnchoredRadialBucketCalculator.prototype.getBucket = function (a) {
        var b = this.f.c1.ab8;
        var c = Math.min(a * this.b, b.count - 1);
        var d = Math.min(c + this.b - 1, b.count - 1);
        var e = NaN;
        var f = NaN;
        for (var g = c; g <= d; ++g) {
            var h = b.item(g);
            if (!isNaN_(e)) {
                if (!isNaN_(h)) {
                    e = Math.min(e, h);
                    f = Math.max(f, h);
                }
            }
            else {
                e = h;
                f = h;
            }
        }
        if (!isNaN_(e)) {
            return [0.5 * (c + d), e, f, 0];
        }
        return [0.5 * (c + d), NaN, NaN, 0];
    };
    AnchoredRadialBucketCalculator.$t = markType(AnchoredRadialBucketCalculator, 'AnchoredRadialBucketCalculator', RadialBucketCalculator.$);
    return AnchoredRadialBucketCalculator;
}(RadialBucketCalculator));
export { AnchoredRadialBucketCalculator };
/**
 * @hidden
 */
var AnchoredRadialSeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(AnchoredRadialSeries, _super);
    function AnchoredRadialSeries() {
        var _this = _super.call(this) || this;
        _this.ab3 = null;
        _this.acd = false;
        _this.ab7 = null;
        _this.ado = { $type: Point_$type, x: 0, y: 0 };
        _this.ab5 = null;
        _this.ab4 = null;
        _this.ab9 = false;
        _this.ab5 = new RadialFrame(3);
        _this.ab3 = new CategoryLineRasterizer();
        return _this;
    }
    AnchoredRadialSeries.prototype.cs = function () {
        return new AnchoredRadialSeriesView(this);
    };
    AnchoredRadialSeries.prototype.o2 = function () {
        _super.prototype.o2.call(this);
        this.yz = null;
        this.y5 = null;
    };
    AnchoredRadialSeries.prototype.me = function () {
        return AnchoredRadialSeries.$$p[4];
    };
    AnchoredRadialSeries.prototype.kq = function (a, b) {
        var c = this.nd(b);
        if (c == AnchoredRadialSeries.$$p[4]) {
            return this.kr(a, b, this.acx);
        }
        if (c == AnchoredRadialSeries.$$p[0]) {
            return this.kr(a, b, this.acp);
        }
        return _super.prototype.kq.call(this, a, b);
    };
    AnchoredRadialSeries.prototype.md = function (a) {
        var b = this.nd(a);
        if (b == AnchoredRadialSeries.$$p[4]) {
            return this.acx;
        }
        if (b == AnchoredRadialSeries.$$p[0]) {
            return this.acp;
        }
        return _super.prototype.md.call(this, a);
    };
    AnchoredRadialSeries.prototype.jc = function (a) {
        if (a == this.y7) {
            return this.z9(this.ab8.count - 1, this.ab8.item(this.ab8.count - 1));
        }
        return _super.prototype.jc.call(this, a);
    };
    AnchoredRadialSeries.prototype.kt = function (a) {
        if (this.yz != null && this.yz.cl) {
            if (a == this.yz.othersIndex) {
                return this.y7;
            }
        }
        return _super.prototype.kt.call(this, a);
    };
    AnchoredRadialSeries.prototype.q1 = function (a) {
        _super.prototype.q1.call(this, a);
        this.ab2 = a;
    };
    AnchoredRadialSeries.prototype.ka = function (a, b) {
        return this.kb(a, b, this.yz, null, this.ab8);
    };
    AnchoredRadialSeries.prototype.j8 = function (a, b) {
        return this.j9(a, b, this.yz, null, this.ab8);
    };
    AnchoredRadialSeries.prototype.ip = function (a, b, c, d, e) {
        if (this.ab8 == null) {
            return Number.POSITIVE_INFINITY;
        }
        return this.iq(a, b, this.yz, d, e, this.ab8.count, null);
    };
    AnchoredRadialSeries.prototype.i5 = function (a, b, c) {
        var d = this.getEffectiveViewport1(this.cv);
        var e = this.acj(this.yz, this.cv.by, this.cv.bx, d);
        var f = new ScalerParams(0, this.cv.by, this.cv.bx, this.yz.ch, d);
        f.c = this.db.wk;
        var g = this.ab8;
        if (this.acd && typeCast(FastItemCoalescingColumn.$, g) !== null) {
            g = new FastItemCoalescingColumn(this.yz, g.c, false);
        }
        return this.i7(g, a, this.yz, f, e, null, b, c);
    };
    AnchoredRadialSeries.prototype.wc = function (a, b, c) {
        if (this.y5 == null || this.yz == null || this.cv == null || this.cv.by.isEmpty || this.cv.bx.isEmpty) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        var d = this.getEffectiveViewport1(this.cv);
        var e = new ScalerParams(0, this.cv.by, this.cv.bx, this.y5.ch, d);
        e.c = this.getEffectiveViewport1(this.cv);
        var f = this.i5(a, b, c);
        f = this.y5.el(f, e);
        var g = this.y8.c(a, this.cv.by, this.cv.bx, d);
        if (!b && this.yz != null) {
            var h = this.ka(a, c);
            var i = this.j8(a, c);
            var j = this.acj(this.yz, this.cv.by, this.cv.bx, d);
            var k = new ScalerParams(0, this.cv.by, this.cv.bx, this.yz.ch, d);
            k.c = this.db.wk;
            var l = this.ip(a, h, this.yz, k, j);
            var m = this.ip(a, i, this.yz, k, j);
            if (this.yz.cl) {
                if (m <= l) {
                    j = this.aci(i, this.yz, this.cv.by, this.cv.bx, d);
                    if (isNaN_(j)) {
                        j = 0;
                    }
                    g = this.yz.el(i, k) + j;
                }
                else {
                    j = this.aci(h, this.yz, this.cv.by, this.cv.bx, d);
                    if (isNaN_(j)) {
                        j = 0;
                    }
                    g = this.yz.el(h, k) + j;
                }
            }
            else {
                if (m <= l) {
                    g = this.yz.el(i, k) + j;
                }
                else {
                    g = this.yz.el(h, k) + j;
                }
            }
        }
        var n = this.y8.d(g, f, this.cv.by, this.cv.bx, this.cv.getEffectiveViewport());
        var o = this.y8.e(g, f, this.cv.by, this.cv.bx, this.cv.getEffectiveViewport());
        return { $type: Point_$type, x: n, y: o };
    };
    AnchoredRadialSeries.prototype.gb = function () {
        return this.highlightedItemsSource != null || this.acp != null;
    };
    AnchoredRadialSeries.prototype.ht = function () {
        var a = _super.prototype.ht.call(this);
        {
            var b = ((function () {
                var $ret = new SeriesLayerPropertyOverlay();
                $ret.ad = "ValueMemberPath";
                $ret.p = true;
                $ret.y = "HighlightedValueMemberPath";
                $ret.q = true;
                return $ret;
            })());
            b.valueResolving = delegateCombine(b.valueResolving, runOn(this, this.ac3));
            a.add(b);
        }
        return a;
    };
    AnchoredRadialSeries.prototype.ac3 = function (a, b) {
        if (this.acp != null) {
            b.value = this.acp;
            return;
        }
        b.value = this.acx;
    };
    Object.defineProperty(AnchoredRadialSeries.prototype, "ab8", {
        get: function () {
            return this.ab7;
        },
        set: function (a) {
            if (this.ab7 != a) {
                var b = this.ab7;
                this.ab7 = a;
                this.raisePropertyChanged("ValueColumn", b, this.ab7);
            }
        },
        enumerable: false,
        configurable: true
    });
    AnchoredRadialSeries.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = new DataLegendSeriesValueInfo();
        c.a = 0;
        this.acd = true;
        c.l = this.i5({ $type: Point_$type, x: a, y: b }, false, false);
        this.acd = false;
        c.q = "Value";
        c.r = this.acx != null ? this.acx : "Value";
        c.s = this.act != null ? this.act : "V:";
        c.t = this.acv != null ? this.acv : "";
        var d = new DataLegendSeriesContext();
        d.e = ((function () {
            var $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
            $ret.add(c);
            return $ret;
        })());
        d.h = this.mc();
        return d;
    };
    Object.defineProperty(AnchoredRadialSeries.prototype, "adk", {
        get: function () {
            return this.c(AnchoredRadialSeries.ac7);
        },
        set: function (a) {
            this.h(AnchoredRadialSeries.ac7, a);
        },
        enumerable: false,
        configurable: true
    });
    AnchoredRadialSeries.prototype.ay = function (a) {
        if (a != null && a == this.yz && this.ab8 != null && this.ab8.count > 0) {
            return new AxisRange(0, this.ab8.count - 1);
        }
        if (a != null && a == this.y5 && this.ab8 != null && this.ab8.count > 0) {
            return new AxisRange(this.ab8.minimum, this.ab8.maximum);
        }
        return null;
    };
    AnchoredRadialSeries.prototype.z9 = function (a, b) {
        if (this.ach) {
            var c = this.ab8.c;
            if (a < 0) {
                return _super.prototype.z9.call(this, a, b);
            }
            if (a > c.count - 1) {
                if (typeCast(ProportionalCategoryAngleAxis.$, this.yz) !== null) {
                    var d = this.ab8;
                    return d.f;
                }
                return _super.prototype.z9.call(this, a, b);
            }
            return c.item(a);
        }
        else {
            return _super.prototype.z9.call(this, a, b);
        }
    };
    AnchoredRadialSeries.prototype.dk = function (a) {
        var b = _super.prototype.dk.call(this, a);
        this.ab9 = false;
        if (this.yz != null && this.yz.cl) {
            this.ab9 = true;
            b = new FastItemCoalescingColumn(this.yz, b, this.ach);
        }
        return b;
    };
    AnchoredRadialSeries.prototype.ac1 = function (a, b) {
        if (this.ab9) {
            var c = b;
            var d = c.c;
            a.deregisterColumn(d);
        }
        else {
            a.deregisterColumn(b);
        }
    };
    AnchoredRadialSeries.prototype.q9 = function (a, b, c, d) {
        _super.prototype.q9.call(this, a, b, c, d);
        if (this.ab2.c2.g$b(a, b, c, d)) {
            this.rr(false);
            this.ql();
        }
        var e = typeCast(NumericAxisBase.$, this.y5);
        switch (b) {
            case AnchoredRadialSeries.$$p[2]:
            case AnchoredRadialSeries.$$p[3]:
                this.qf();
                break;
            case AnchoredRadialSeries.$$p[1]:
            case RadialBase.$$p[0]:
                if (this.ab8 != null) {
                    this.ac1(this.dn, this.ab8);
                    this.ab8 = this.dk(this.acx);
                }
                break;
            case "FastItemsSource":
                if (typeCast(IFastItemsSource_$type, c) !== null) {
                    this.ac1(c, this.ab8);
                    this.ab8 = null;
                }
                if (typeCast(IFastItemsSource_$type, d) !== null) {
                    this.ab8 = this.dk(this.acx);
                    this.ab2.cx.e(this.id);
                }
                if (e != null && !e.c1()) {
                    this.ab2.cx.e(this.id);
                    this.rr(this.gg && c != null);
                }
                break;
            case AnchoredRadialSeries.$$p[4]:
                if (this.dn != null) {
                    this.ac1(this.dn, this.ab8);
                    this.ab8 = this.dk(this.acx);
                }
                break;
            case "ValueColumn":
                if (e != null && !e.c1()) {
                    this.ab2.cx.e(this.id);
                    this.rr(this.gg && this.d7);
                }
                break;
            case "TrendLineBrush":
                this.rf(b);
                break;
            case "TrendLineType":
                this.ql();
                break;
        }
    };
    AnchoredRadialSeries.prototype.pb = function (a, b, c, d) {
        _super.prototype.pb.call(this, a, b, c, d);
        switch (a) {
            case 4:
            case 1:
            case 0:
                this.ab2.cx.e(this.id);
                break;
        }
        this.ab2.c2.g$e(a, b, c, d);
        switch (a) {
            case 4:
                if (this.y5 != null && !this.y5.c1()) {
                    this.rr(true);
                }
                break;
            case 1:
                if (this.y5 != null && !this.y5.c1()) {
                    this.rr(true);
                }
                break;
            case 0:
                if (this.y5 != null && !this.y5.c1()) {
                    this.rr(true);
                }
                break;
            case 2:
                if (this.acx != null && this.ab2.cx.b > 0 && this.y5 != null && !this.y5.c1()) {
                    this.rr(true);
                }
                break;
            case 3:
                if (d == this.acx) {
                    if (this.y5 != null && !this.y5.c1()) {
                        this.rr(true);
                    }
                }
                break;
        }
    };
    AnchoredRadialSeries.prototype.he = function (a, b, c) {
        var d = _super.prototype.he.call(this, a, b, c);
        var e = c;
        if (this.dn == null || this.dn.count == 0 || this.yz == null || this.ab8 == null || this.yz.lj == 0 || this.y5 == null || isInfinity(this.y5.l4) || isInfinity(this.y5.l3) || e.cx.b < 1) {
            d = false;
        }
        return d;
    };
    AnchoredRadialSeries.prototype.getOffsetValue = function () {
        return this.acj(this.yz, this.cv.by, this.cv.bx, this.getEffectiveViewport1(this.cv));
    };
    AnchoredRadialSeries.prototype.getCategoryWidth = function () {
        return this.yz.getCategorySize(this.cv.by, this.cv.bx, this.getEffectiveViewport1(this.cv));
    };
    AnchoredRadialSeries.prototype.get_ace = function () {
        return false;
    };
    Object.defineProperty(AnchoredRadialSeries.prototype, "ace", {
        get: function () {
            return this.get_ace();
        },
        enumerable: false,
        configurable: true
    });
    AnchoredRadialSeries.prototype.get_ek = function () {
        return true;
    };
    AnchoredRadialSeries.prototype.get_f5 = function () {
        return this.y5 != null && this.y5.ch;
    };
    AnchoredRadialSeries.prototype.acj = function (a, b, c, d) {
        var e = 0;
        var f = this.preferredCategoryMode(a);
        if (f == 0 && a.categoryMode != 0) {
            f = 1;
        }
        switch (f) {
            case 0:
                e = 0;
                break;
            case 1:
                e = 0.5 * a.getCategorySize(b, c, d);
                break;
            case 2:
                e = a.getGroupCenter(this.z8(), b, c, d);
                break;
        }
        if (a.ch) {
            e = -e;
        }
        return e;
    };
    AnchoredRadialSeries.prototype.aci = function (a, b, c, d, e) {
        var f = 0;
        var g = this.preferredCategoryMode(b);
        if (g == 0 && b.categoryMode != 0) {
            g = 1;
        }
        switch (g) {
            case 0:
                f = 0;
                break;
            case 1:
                f = 0.5 * b.m7(a, c, d, e);
                break;
            case 2:
                f = b.m6(a, this.z8(), c, d, e);
                break;
        }
        if (b.ch) {
            f = -f;
        }
        return f;
    };
    AnchoredRadialSeries.prototype.ac2 = function (a, b, c, d) {
        var _this = this;
        if (d == 0) {
            this.p4(a, b, c);
            return;
        }
        var e = this.cv.by;
        var f = this.cv.bx;
        var g = this.getEffectiveViewport1(this.cv);
        var h = this.wj(this.cv);
        var i = this.y5.k5(f, e, g, h);
        var j = this.yz != null && this.yz.cl;
        var k = new CollisionRect(0, a);
        var _loop_1 = function (l) {
            var m = typeCast(RadialBaseView.$, this_1.cv);
            var n = m.cx.getBucket(l);
            var o = this_1.acj(this_1.yz, e, f, g);
            if (j) {
                o = this_1.aci(l, this_1.yz, e, f, g);
                if (isNaN_(o)) {
                    o = 0;
                }
            }
            n[0] = this_1.yz.getScaledAngle(n[0]) + o;
            var p = Math.min(this_1.y8.b.od(n[2]), i.maxLength);
            var q = this_1.y8.d(n[0], p, e, f, g);
            var r = this_1.y8.e(n[0], p, e, f, g);
            if (k.containsLocation(q, r)) {
                if (c == 7 || c == 6) {
                    b.add(((function () {
                        var $ret = new ChartSelection();
                        $ret.series = _this;
                        return $ret;
                    })()));
                    return { value: void 0 };
                }
                else if (c == 2 || c == 1) {
                    b.add(((function () {
                        var $ret = new ChartSelection();
                        $ret.item = _this.dn.item(l);
                        return $ret;
                    })()));
                }
                else {
                    b.add(((function () {
                        var $ret = new ChartSelection();
                        $ret.item = _this.dn.item(l);
                        $ret.series = _this;
                        return $ret;
                    })()));
                }
            }
        };
        var this_1 = this;
        for (var l = 0; l < this.dn.count; l++) {
            var state_1 = _loop_1(l);
            if (typeof state_1 === "object")
                return state_1.value;
        }
    };
    AnchoredRadialSeries.prototype.get_acg = function () {
        return false;
    };
    Object.defineProperty(AnchoredRadialSeries.prototype, "acg", {
        get: function () {
            return this.get_acg();
        },
        enumerable: false,
        configurable: true
    });
    AnchoredRadialSeries.prototype.get_aca = function () {
        return false;
    };
    Object.defineProperty(AnchoredRadialSeries.prototype, "aca", {
        get: function () {
            return this.get_aca();
        },
        enumerable: false,
        configurable: true
    });
    AnchoredRadialSeries.prototype.aa9 = function (a, b) {
        var _this = this;
        var c = b.by;
        var d = b.bx;
        var e = this.getEffectiveViewport1(b);
        var f = this.yz;
        var g = this.y5;
        var h = g.l4;
        var i = g.l3;
        a.f.clear();
        a.n.clear();
        a.q.clear();
        var j = this.xg();
        var k = 0;
        var l = b;
        var m = f.cl;
        var n = new CollisionAvoider();
        var o = 0;
        var p = 0;
        var q = b.cx.d;
        o = this.acj(f, c, d, e);
        l.c2.i = this.y5.n7;
        l.c2.h = this.y5.n6;
        l.c2.j = function (r, s) { return _this.ack(r, s, c, d, e); };
        l.c2.k = function (r, s) { return _this.acl(r, s, c, d, e); };
        var r = ((function () {
            var $ret = new Clipper(0, d, false);
            $ret.i = a.q;
            return $ret;
        })());
        var s = ((function () {
            var $ret = new TrendResolutionParams();
            $ret.e = b.cx.b;
            $ret.f = b.cx.c;
            $ret.g = q;
            $ret.a = o;
            $ret.d = _this.id;
            $ret.i = d;
            $ret.h = e;
            $ret.j = c;
            return $ret;
        })());
        l.c2.l(a.q, this.ab6, this.ab8, this.acn, function (t) { return _this.yz.getScaledAngle(t); }, function (t) { return _this.y5.od(t); }, s, r);
        var t = true;
        if (this.acf(b)) {
            q--;
        }
        for (var u = b.cx.c; u <= q; ++u) {
            var v = u;
            if (v * b.cx.b >= this.yz.lj) {
                v -= intDivide((this.yz.lj), b.cx.b);
            }
            var w = b.cx.getBucket(v);
            p = 0;
            if (m) {
                p = this.z0(v, c, d, e);
            }
            w[3] = p;
            if (!isNaN_(w[0])) {
                var x = false;
                if (m) {
                    o = this.aci(v, f, c, d, e);
                    if (isNaN_(o)) {
                        o = 0;
                        x = true;
                    }
                }
                w[0] = f.getScaledAngle(w[0]) + o;
                if (w[1] < h || w[1] > i) {
                    if (this.acg) {
                        if (w[1] > i && this.aca) {
                        }
                        else {
                            x = true;
                        }
                    }
                    else {
                        if (w[1] > i && this.aca) {
                        }
                        else {
                            continue;
                        }
                    }
                }
                if (x) {
                    w[1] = NaN;
                    w[2] = NaN;
                }
                w[1] = g.od(w[1]);
                if (b.cx.b > 1) {
                    if (w[2] < h || w[2] > i) {
                        continue;
                    }
                    w[2] = g.od(w[2]);
                }
                else {
                    w[2] = w[1];
                }
                if ((isNaN_(w[1]) || isNaN_(w[2])) && t && this.ace && this.acc()) {
                    q++;
                }
                else {
                    t = false;
                }
                a.f.add(w);
                if (j) {
                    var y = Math.min(v * b.cx.b, this.dn.count - 1);
                    var z = false;
                    if (this.yz.cl) {
                        var aa = this.yz;
                        var ab = aa.hasOthersCategory && (v * b.cx.b) == this.yz.lj - 1;
                        z = ab;
                    }
                    var ac = this.y8.d(w[0], w[1], c, d, e);
                    var ad = this.y8.e(w[0], w[1], c, d, e);
                    var ae = new Rect(0, ac - 5, ad - 5, 11, 11);
                    if (!isNaN_(ac) && !isNaN_(ad) && !isInfinity(ac) && !isInfinity(ad) && n.tryAdd(ae)) {
                        a.n.add({ $type: Point_$type, x: w[0], y: w[1] });
                        var af = b.cy.item(k);
                        af.al = v;
                        af.ak = y;
                        af.content.item = this.dn.item(y);
                        if (z) {
                            af.ak = this.dn.count;
                            var ag = this.yz;
                            af.content.item = this.y7;
                        }
                        ++k;
                    }
                }
            }
            else {
                if (t && this.ace && this.acc()) {
                    q++;
                }
            }
        }
        b.cy.count = k;
        return;
    };
    AnchoredRadialSeries.prototype.ack = function (a, b, c, d, e) {
        return this.y8.d(a, b, c, d, e);
    };
    AnchoredRadialSeries.prototype.acl = function (a, b, c, d, e) {
        return this.y8.e(a, b, c, d, e);
    };
    AnchoredRadialSeries.prototype.acf = function (a) {
        var b = a;
        return !this.ace && b.cx.c == 0 && b.cx.d == this.yz.lj;
    };
    AnchoredRadialSeries.prototype.ab1 = function (a, b, c) {
        var d = null;
        var e = c.by;
        var f = c.bx;
        if (b > -1 && !e.isEmpty && !f.isEmpty) {
            var g = a._inner[0][0] < f.left - 2000 ? f.left - 10 : NaN;
            var h = f.bottom + 10;
            var i = a._inner[b][0] > f.right + 2000 ? f.right + 10 : NaN;
            var j = f.top - 10;
            d = new Clipper(1, g, h, i, j, false);
        }
        return d;
    };
    AnchoredRadialSeries.prototype.ac6 = function (a, b, c, d, e) {
        if (a.count > 0 && d.count > 0) {
            if (!e || this.acb()) {
                a.add(this.ado);
                a.add(a._inner[0]);
                d.add(this.ado);
                d.add(d._inner[0]);
            }
        }
    };
    AnchoredRadialSeries.prototype.acc = function () {
        return !this.acb();
    };
    AnchoredRadialSeries.prototype.acb = function () {
        var a = this.cv.by;
        return !a.containsPoint({ $type: Point_$type, x: 0.5, y: 0.5 });
    };
    AnchoredRadialSeries.prototype.o5 = function (a, b) {
        _super.prototype.o5.call(this, a, b);
        var c = b;
        if (a) {
            c.cy.clear();
        }
        c.c2.g$d();
    };
    AnchoredRadialSeries.prototype.abc = function (a, b) {
        this.qx();
        var c = b.by;
        var d = b.bx;
        var e = this.getEffectiveViewport1(b);
        var f = this.wj(b);
        var g = b;
        g.c2.g$g(a.q);
        var h = new List$1(Point_$type, 0);
        for (var i = 0; i < a.n.count; i++) {
            var j = a.n._inner[i];
            var k = this.y8.d(j.x, j.y, c, d, e);
            var l = this.y8.e(j.x, j.y, c, d, e);
            var m = { $type: Point_$type, x: k, y: l };
            h.add(m);
        }
        CategoryMarkerManager.e(this, h, g.cy, this.xi);
        this.ac0(b, a);
        g.cr();
        this.acz(d, c, e, f, g);
    };
    AnchoredRadialSeries.prototype.ab0 = function (a, b, c) {
        if (b < a || a < 0 || a > this.ab8.count || b < 0 || b > this.ab8.count || c == null) {
            return null;
        }
        var d = new Array((b - a) + 1);
        var e = c.cn;
        var f = null;
        if (e) {
            f = c.i$b;
        }
        for (var g = a; g <= b; g++) {
            var h = g;
            if (e) {
                h = f._inner[h];
            }
            d[g - a] = this.dn.item(g);
        }
        return d;
    };
    AnchoredRadialSeries.prototype.ac4 = function (a, b, c, d, e, f) {
        var g = this.bx != 1;
        var h = this.cp != 1;
        var i = this.co != 1;
        var j = this.d2;
        this.zg.a3(this.zg.d, d.cn, a, b, c, d, e, f, true);
        this.zg.aa(this.ib);
        var k = this.zg.ax;
        var l = null;
        var m = null;
        var n = null;
        var o = this.dn;
        var p = null;
        var q = null;
        var r = null;
        if (j && this.db != null && !k.e) {
            var s = this.vo(k.z);
            var t = this.vp(k.z);
            this.zg.ag = s;
            this.zg.ah = t;
            k.aa = s;
            k.ab = t;
        }
        if (g && this.db != null) {
            l = this.db.dl.getHighlightingInfo(this, o, k.z, k.y, true);
            if (this.db.dl.isCrossContextHighlight(this)) {
                p = this.db.dl.getHighlightingInfo(this, o, k.z, k.y, true);
            }
            k.c = l;
        }
        if (h && this.db != null) {
            m = this.db.dm.getHighlightingInfo(this, o, k.z, k.y, true);
            if (m == null && this.bn != null) {
                m = this.db.dm.getHighlightingInfo(this.bn, this.bn.dn, k.z, k.y, true);
            }
            if (this.db.dm.isCrossContextHighlight(this)) {
                q = this.db.dm.getHighlightingInfo(this, o, k.z, k.y, true);
            }
            k.d = m;
        }
        if (i && this.db != null) {
            n = this.db.dk.getHighlightingInfo(this, o, k.z, k.y, true);
            if (this.db.dk.isCrossContextHighlight(this)) {
                r = this.db.dk.getHighlightingInfo(this, o, k.z, k.y, true);
            }
            k.b = n;
        }
        k.h = f;
        this.aba(k);
        this.zg.y(this, l, m, n, f, g, h, i, k.v, this.db.dl.totalHighWaterMark, k.x, this.db.dm.totalHighWaterMark, k.t, this.db.dk.totalHighWaterMark);
    };
    AnchoredRadialSeries.prototype.ac5 = function (a, b, c, d, e, f) {
        var g = this.bx != 1;
        var h = this.cp != 1;
        var i = this.cp != 1;
        var j = this.d2;
        this.zg.a3(this.zg.b, d.cn, a, b, c, d, e, f, false);
        this.zg.ab(this.ib);
        var k = this.zg.ay;
        var l = null;
        var m = null;
        var n = null;
        var o = this.dn;
        if (j && this.db != null && !k.e) {
            var p = this.vn(k.z);
            var q = this.vq(k.z);
            this.zg.ag = p;
            this.zg.ah = q;
            k.aa = p;
            k.ab = q;
        }
        if (g && this.db != null) {
            l = this.db.dl.getHighlightingInfo(this, o, k.z, k.y, false);
            k.c = l;
        }
        if (h && this.db != null) {
            m = this.db.dm.getHighlightingInfo(this, o, k.z, k.y, false);
            if (m == null && this.bn != null) {
                m = this.db.dm.getHighlightingInfo(this.bn, this.bn.dn, k.z, k.y, false);
            }
            k.d = m;
        }
        k.h = f;
        this.abb(k);
        this.zg.z(this, l, m, n, f, g, h, i, b < 0);
    };
    AnchoredRadialSeries.prototype.ac0 = function (a, b) {
        a.b7 = true;
        this.zg.a1(this, this.zw(), runOn(this, this.yn), this.z6(a), this.z7(a));
        var c = this.zg.d;
        var d = c != null;
        var e = this.yz;
        if (e == null) {
            return;
        }
        var f = this.getEffectiveViewport1(a);
        var g = new ScalerParams(0, a.by, a.bx, e.ch, f);
        var h = this.dn == null ? 0 : this.dn.count;
        var i = a;
        var j = b.f;
        var k = i.cx.c;
        var l = i.cx.d;
        var m = i.cx.b;
        var n = k * m;
        for (var o = 0; o < a.cy.count; o++) {
            var p = a.cy.item(o);
            var q = p.content;
            if (d) {
                var r = p.al;
                this.ac4(j, r, h, e, g, a.q);
            }
            this.zg.ac(p, q);
        }
    };
    AnchoredRadialSeries.prototype.acz = function (a, b, c, d, e) {
        e.c3(a, b, c, d);
    };
    AnchoredRadialSeries.prototype.sh = function () {
        _super.prototype.sh.call(this);
        if (this.index < 0) {
            return;
        }
        this.ab2.c4();
    };
    AnchoredRadialSeries.prototype.kx = function (a, b) {
        if (a == this.ab2.c2.g$j) {
            return null;
        }
        return _super.prototype.kx.call(this, a, b);
    };
    AnchoredRadialSeries.prototype.gd = function (a) {
        var b = this.cv.by;
        b = b.copy();
        var c = this.cv.bx;
        var d = !b.isEmpty && !c.isEmpty && this.dn != null ? this.dn.indexOf(a) : -1;
        if (this.yz == null || this.ab8 == null || this.y5 == null) {
            return false;
        }
        if (d < 0 || d > this.ab8.count - 1) {
            return false;
        }
        var e = this.yz.getScaledAngle(d);
        var f = this.y5.od(this.ab8.item(d));
        if (isNaN_(f)) {
            f = (this.y5.n6 + this.y5.n7) / 2;
        }
        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.c3 != null) {
            this.c3.au(this.db, b, true);
        }
        return d >= 0;
    };
    AnchoredRadialSeries.prototype.rt = function (a, b) {
        _super.prototype.rt.call(this, a, b);
        if (!this.g0) {
            this.cv.a4(b);
            return;
        }
        this.cv.a4(b);
        var c = typeCast(AnchoredRadialSeriesView.$, this.cu);
        c.cx.e(this.id);
        if (this.d5(this.cu)) {
            return;
        }
        if (!this.gs) {
            this.ab5 = new RadialFrame(3);
            this.aa9(this.ab5, c);
        }
        this.gs = false;
        this.abc(this.ab5, c);
        this.g0 = false;
    };
    AnchoredRadialSeries.prototype.rq = function (a, b, c, d, e) {
        _super.prototype.rq.call(this, a, b, c, d, e);
        var f = this.ba.a$j.item(d);
        var g = f;
        g.cx.e(this.id);
        f.a3(c);
        if (this.d5(g)) {
            return;
        }
        if (this.ab4 == null) {
            this.ab4 = new RadialFrame(3);
        }
        this.ab4.v();
        this.aa9(this.ab4, g);
        this.abc(this.ab4, g);
    };
    AnchoredRadialSeries.prototype.pz = function (a) {
        _super.prototype.pz.call(this, a);
        this.bc.exportTrendlineData(this, a, this.ab2.c2.g$j);
    };
    AnchoredRadialSeries.$t = markType(AnchoredRadialSeries, 'AnchoredRadialSeries', RadialBase.$);
    AnchoredRadialSeries.ac7 = DependencyProperty.i("ActualTrendLineBrush", Brush.$, AnchoredRadialSeries.$, new PropertyMetadata(2, null, function (a, b) { return a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue); }));
    AnchoredRadialSeries.$$p = markDep(DependencyProperty, PropertyMetadata, AnchoredRadialSeries, 'raisePropertyChanged', ['HighlightedValueMemberPath:acp:ac8', [2, null], 'UseCategoryNormalizedValues:ach:adg', [0, false], 'ValueMemberAsLegendLabel:act:adh', [2, null], 'ValueMemberAsLegendUnit:acv:adi', [2, null], 'ValueMemberPath:acx:adj', [2, null], 'TrendLineType:ab6:ade', [TrendLineType_$type, enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness:acm:add', [1, 1.5], 'TrendLinePeriod:acn:adc', [1, 7], 'TrendLineZIndex:aco:adf', [1, 1], 'TrendLineBrush:adl:ac9', [Brush.$, null], 'TrendLineDashArray:adm:ada', [DoubleCollection.$], 'TrendLineDashCap:adn:adb', [PenLineCap_$type, enumGetBox(PenLineCap_$type, 0)]]);
    return AnchoredRadialSeries;
}(RadialBase));
export { AnchoredRadialSeries };
/**
 * @hidden
 */
var AnchoredRadialSeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(AnchoredRadialSeriesView, _super);
    function AnchoredRadialSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.c1 = null;
        _this.c2 = null;
        _this.cx = new AnchoredRadialBucketCalculator(_this);
        _this.c1 = a;
        _this.c2 = new RadialTrendLineManager();
        return _this;
    }
    AnchoredRadialSeriesView.prototype.c3 = function (a, b, c, d) {
    };
    AnchoredRadialSeriesView.prototype.c4 = function () {
        this.c1.adk = null;
        if (this.c1.adl != null) {
            this.c1.adk = this.c1.adl;
        }
        else {
            this.c1.adk = this.c1.u9;
        }
    };
    AnchoredRadialSeriesView.prototype.a7 = function (a, b) {
        if (a.d) {
            if (!b) {
            }
            if (this.c1.ab6 != 0 && !b) {
                var c = this.c2.g$j;
                c.ad = this.c1.acm;
                c._stroke = this.c1.adk;
                c.ai = this.c1.adm;
                c.aj = this.c1.adn;
                a.v(c);
            }
        }
        _super.prototype.a7.call(this, a, b);
    };
    AnchoredRadialSeriesView.prototype.getDefaultTooltipTemplate = function () {
        var a = "<div class='ui-chart-default-tooltip-content'>";
        if (this.c1.yz.f2 != null) {
            a += "<span>${item." + this.c1.yz.f2 + "}</span><br/>";
        }
        a += "<span";
        var b = this.e.ba.a$u(this.e);
        if (!stringIsNullOrEmpty(b)) {
            a += " style='color:" + b + "'";
        }
        a += ">" + this.c1.title + ": </span><span class='ui-priority-primary'>" + "${item." + this.c1.acx + "}</span></div>";
        return a;
    };
    AnchoredRadialSeriesView.$t = markType(AnchoredRadialSeriesView, 'AnchoredRadialSeriesView', RadialBaseView.$);
    return AnchoredRadialSeriesView;
}(RadialBaseView));
export { AnchoredRadialSeriesView };
