/*
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 { RadialBucketCalculator } from "./RadialBucketCalculator";
import { markType, typeCast, Point_$type, runOn, delegateCombine, enumGetBox, markDep } from "igniteui-react-core";
import { isNaN_, intDivide, isInfinity } from "igniteui-react-core";
import { RadialBase } from "./RadialBase";
import { CategoryLineRasterizer } from "./CategoryLineRasterizer";
import { DependencyProperty } from "igniteui-react-core";
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 { RadialFrame } from "./RadialFrame";
import { ProportionalCategoryAngleAxis } from "./ProportionalCategoryAngleAxis";
import { ScalerParams } from "./ScalerParams";
import { Rect } from "igniteui-react-core";
import { FastItemCoalescingColumn } from "./FastItemCoalescingColumn";
import { List$1 } from "igniteui-react-core";
import { SeriesLayerPropertyOverlay } from "./SeriesLayerPropertyOverlay";
import { DataLegendSeriesValueInfo } from "igniteui-react-core";
import { DataLegendSeriesContext } from "igniteui-react-core";
import { AxisRange } from "./AxisRange";
import { IFastItemsSource_$type } from "igniteui-react-core";
import { NumericAxisBase } from "./NumericAxisBase";
import { RadialBaseView } from "./RadialBaseView";
import { ChartSelection } from "./ChartSelection";
import { CollisionRect } from "igniteui-react-core";
import { CollisionAvoider } from "./CollisionAvoider";
import { Clipper } from "igniteui-react-core";
import { TrendResolutionParams } from "./TrendResolutionParams";
import { RadialTrendLineManager } from "./RadialTrendLineManager";
import { CategoryMarkerManager } from "./CategoryMarkerManager";
import { PropertyMetadata } from "igniteui-react-core";
import { stringIsNullOrEmpty } from "igniteui-react-core";
/**
 * @hidden
 */
export let AnchoredRadialBucketCalculator = /*@__PURE__*/ (() => {
    class AnchoredRadialBucketCalculator extends RadialBucketCalculator {
        constructor(a) {
            super(a);
            this.f = null;
            this.f = a;
        }
        getBucket(a) {
            let b = this.f.c1.ab6;
            let c = Math.min(a * this.b, b.count - 1);
            let d = Math.min(c + this.b - 1, b.count - 1);
            let e = NaN;
            let f = NaN;
            for (let g = c; g <= d; ++g) {
                let 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 = /*@__PURE__*/ markType(AnchoredRadialBucketCalculator, 'AnchoredRadialBucketCalculator', RadialBucketCalculator.$);
    return AnchoredRadialBucketCalculator;
})();
/**
 * @hidden
 */
export let AnchoredRadialSeries = /*@__PURE__*/ (() => {
    class AnchoredRadialSeries extends RadialBase {
        cs() {
            return new AnchoredRadialSeriesView(this);
        }
        o2() {
            super.o2();
            this.yx = null;
            this.y3 = null;
        }
        me() {
            return AnchoredRadialSeries.$$p[4];
        }
        kq(a, b) {
            let c = this.nd(b);
            if (c == AnchoredRadialSeries.$$p[4]) {
                return this.kr(a, b, this.acv);
            }
            if (c == AnchoredRadialSeries.$$p[0]) {
                return this.kr(a, b, this.acn);
            }
            return super.kq(a, b);
        }
        md(a) {
            let b = this.nd(a);
            if (b == AnchoredRadialSeries.$$p[4]) {
                return this.acv;
            }
            if (b == AnchoredRadialSeries.$$p[0]) {
                return this.acn;
            }
            return super.md(a);
        }
        jc(a) {
            if (a == this.y5) {
                return this.z7(this.ab6.count - 1, this.ab6.item(this.ab6.count - 1));
            }
            return super.jc(a);
        }
        kt(a) {
            if (this.yx != null && this.yx.cl) {
                if (a == this.yx.othersIndex) {
                    return this.y5;
                }
            }
            return super.kt(a);
        }
        qz(a) {
            super.qz(a);
            this.ab0 = a;
        }
        constructor() {
            super();
            this.ab1 = null;
            this.acb = false;
            this.ab5 = null;
            this.adm = { $type: Point_$type, x: 0, y: 0 };
            this.ab3 = null;
            this.ab2 = null;
            this.ab7 = false;
            this.ab3 = new RadialFrame(3);
            this.ab1 = new CategoryLineRasterizer();
        }
        ka(a, b) {
            return this.kb(a, b, this.yx, null, this.ab6);
        }
        j8(a, b) {
            return this.j9(a, b, this.yx, null, this.ab6);
        }
        ip(a, b, c, d, e) {
            if (this.ab6 == null) {
                return Number.POSITIVE_INFINITY;
            }
            return this.iq(a, b, this.yx, d, e, this.ab6.count, null);
        }
        i5(a, b, c) {
            let d = this.getEffectiveViewport1(this.cv);
            let e = this.ach(this.yx, this.cv.by, this.cv.bx, d);
            let f = new ScalerParams(0, this.cv.by, this.cv.bx, this.yx.ch, d);
            f.c = this.db.wj;
            let g = this.ab6;
            if (this.acb && typeCast(FastItemCoalescingColumn.$, g) !== null) {
                g = new FastItemCoalescingColumn(this.yx, g.c, false);
            }
            return this.i7(g, a, this.yx, f, e, null, b, c);
        }
        wa(a, b, c) {
            if (this.y3 == null || this.yx == null || this.cv == null || this.cv.by.isEmpty || this.cv.bx.isEmpty) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            let d = this.getEffectiveViewport1(this.cv);
            let e = new ScalerParams(0, this.cv.by, this.cv.bx, this.y3.ch, d);
            e.c = this.getEffectiveViewport1(this.cv);
            let f = this.i5(a, b, c);
            f = this.y3.el(f, e);
            let g = this.y6.c(a, this.cv.by, this.cv.bx, d);
            if (!b && this.yx != null) {
                let h = this.ka(a, c);
                let i = this.j8(a, c);
                let j = this.ach(this.yx, this.cv.by, this.cv.bx, d);
                let k = new ScalerParams(0, this.cv.by, this.cv.bx, this.yx.ch, d);
                k.c = this.db.wj;
                let l = this.ip(a, h, this.yx, k, j);
                let m = this.ip(a, i, this.yx, k, j);
                if (this.yx.cl) {
                    if (m <= l) {
                        j = this.acg(i, this.yx, this.cv.by, this.cv.bx, d);
                        if (isNaN_(j)) {
                            j = 0;
                        }
                        g = this.yx.el(i, k) + j;
                    }
                    else {
                        j = this.acg(h, this.yx, this.cv.by, this.cv.bx, d);
                        if (isNaN_(j)) {
                            j = 0;
                        }
                        g = this.yx.el(h, k) + j;
                    }
                }
                else {
                    if (m <= l) {
                        g = this.yx.el(i, k) + j;
                    }
                    else {
                        g = this.yx.el(h, k) + j;
                    }
                }
            }
            let n = this.y6.d(g, f, this.cv.by, this.cv.bx, this.cv.getEffectiveViewport());
            let o = this.y6.e(g, f, this.cv.by, this.cv.bx, this.cv.getEffectiveViewport());
            return { $type: Point_$type, x: n, y: o };
        }
        gb() {
            return this.highlightedItemsSource != null || this.acn != null;
        }
        ht() {
            let a = super.ht();
            {
                let b = ((() => {
                    let $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.ac1));
                a.add(b);
            }
            return a;
        }
        ac1(a, b) {
            if (this.acn != null) {
                b.value = this.acn;
                return;
            }
            b.value = this.acv;
        }
        get ab6() {
            return this.ab5;
        }
        set ab6(a) {
            if (this.ab5 != a) {
                let b = this.ab5;
                this.ab5 = a;
                this.raisePropertyChanged("ValueColumn", b, this.ab5);
            }
        }
        getDataLegendSeriesContextAt(a, b) {
            let c = new DataLegendSeriesValueInfo();
            c.a = 0;
            this.acb = true;
            c.l = this.i5({ $type: Point_$type, x: a, y: b }, false, false);
            this.acb = false;
            c.q = "Value";
            c.r = this.acv != null ? this.acv : "Value";
            c.s = this.acr != null ? this.acr : "V:";
            c.t = this.act != null ? this.act : "";
            let d = new DataLegendSeriesContext();
            d.e = ((() => {
                let $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
                $ret.add(c);
                return $ret;
            })());
            d.h = this.mc();
            return d;
        }
        get adi() {
            return this.c(AnchoredRadialSeries.ac5);
        }
        set adi(a) {
            this.h(AnchoredRadialSeries.ac5, a);
        }
        ay(a) {
            if (a != null && a == this.yx && this.ab6 != null && this.ab6.count > 0) {
                return new AxisRange(0, this.ab6.count - 1);
            }
            if (a != null && a == this.y3 && this.ab6 != null && this.ab6.count > 0) {
                return new AxisRange(this.ab6.minimum, this.ab6.maximum);
            }
            return null;
        }
        z7(a, b) {
            if (this.acf) {
                let c = this.ab6.c;
                if (a < 0) {
                    return super.z7(a, b);
                }
                if (a > c.count - 1) {
                    if (typeCast(ProportionalCategoryAngleAxis.$, this.yx) !== null) {
                        let d = this.ab6;
                        return d.f;
                    }
                    return super.z7(a, b);
                }
                return c.item(a);
            }
            else {
                return super.z7(a, b);
            }
        }
        dk(a) {
            let b = super.dk(a);
            this.ab7 = false;
            if (this.yx != null && this.yx.cl) {
                this.ab7 = true;
                b = new FastItemCoalescingColumn(this.yx, b, this.acf);
            }
            return b;
        }
        acz(a, b) {
            if (this.ab7) {
                let c = b;
                let d = c.c;
                a.deregisterColumn(d);
            }
            else {
                a.deregisterColumn(b);
            }
        }
        q7(a, b, c, d) {
            super.q7(a, b, c, d);
            if (this.ab0.c2.g$b(a, b, c, d)) {
                this.rp(false);
                this.qj();
            }
            let e = typeCast(NumericAxisBase.$, this.y3);
            switch (b) {
                case AnchoredRadialSeries.$$p[2]:
                case AnchoredRadialSeries.$$p[3]:
                    this.qd();
                    break;
                case AnchoredRadialSeries.$$p[1]:
                case RadialBase.$$p[0]:
                    if (this.ab6 != null) {
                        this.acz(this.dn, this.ab6);
                        this.ab6 = this.dk(this.acv);
                    }
                    break;
                case "FastItemsSource":
                    if (typeCast(IFastItemsSource_$type, c) !== null) {
                        this.acz(c, this.ab6);
                        this.ab6 = null;
                    }
                    if (typeCast(IFastItemsSource_$type, d) !== null) {
                        this.ab6 = this.dk(this.acv);
                        this.ab0.cx.e(this.id);
                    }
                    if (e != null && !e.c1()) {
                        this.ab0.cx.e(this.id);
                        this.rp(this.gg && c != null);
                    }
                    break;
                case AnchoredRadialSeries.$$p[4]:
                    if (this.dn != null) {
                        this.acz(this.dn, this.ab6);
                        this.ab6 = this.dk(this.acv);
                    }
                    break;
                case "ValueColumn":
                    if (e != null && !e.c1()) {
                        this.ab0.cx.e(this.id);
                        this.rp(this.gg && this.d7);
                    }
                    break;
                case "TrendLineBrush":
                    this.rd(b);
                    break;
                case "TrendLineType":
                    this.qj();
                    break;
            }
        }
        pb(a, b, c, d) {
            super.pb(a, b, c, d);
            switch (a) {
                case 4:
                case 1:
                case 0:
                    this.ab0.cx.e(this.id);
                    break;
            }
            this.ab0.c2.g$e(a, b, c, d);
            switch (a) {
                case 4:
                    if (this.y3 != null && !this.y3.c1()) {
                        this.rp(true);
                    }
                    break;
                case 1:
                    if (this.y3 != null && !this.y3.c1()) {
                        this.rp(true);
                    }
                    break;
                case 0:
                    if (this.y3 != null && !this.y3.c1()) {
                        this.rp(true);
                    }
                    break;
                case 2:
                    if (this.acv != null && this.ab0.cx.b > 0 && this.y3 != null && !this.y3.c1()) {
                        this.rp(true);
                    }
                    break;
                case 3:
                    if (d == this.acv) {
                        if (this.y3 != null && !this.y3.c1()) {
                            this.rp(true);
                        }
                    }
                    break;
            }
        }
        he(a, b, c) {
            let d = super.he(a, b, c);
            let e = c;
            if (this.dn == null || this.dn.count == 0 || this.yx == null || this.ab6 == null || this.yx.lj == 0 || this.y3 == null || isInfinity(this.y3.l4) || isInfinity(this.y3.l3) || e.cx.b < 1) {
                d = false;
            }
            return d;
        }
        getOffsetValue() {
            return this.ach(this.yx, this.cv.by, this.cv.bx, this.getEffectiveViewport1(this.cv));
        }
        getCategoryWidth() {
            return this.yx.getCategorySize(this.cv.by, this.cv.bx, this.getEffectiveViewport1(this.cv));
        }
        get_acc() {
            return false;
        }
        get acc() {
            return this.get_acc();
        }
        get_ek() {
            return true;
        }
        get_f5() {
            return this.y3 != null && this.y3.ch;
        }
        ach(a, b, c, d) {
            let e = 0;
            let 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.z6(), b, c, d);
                    break;
            }
            if (a.ch) {
                e = -e;
            }
            return e;
        }
        acg(a, b, c, d, e) {
            let f = 0;
            let 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.z6(), c, d, e);
                    break;
            }
            if (b.ch) {
                f = -f;
            }
            return f;
        }
        ac0(a, b, c, d) {
            if (d == 0) {
                this.p2(a, b, c);
                return;
            }
            let e = this.cv.by;
            let f = this.cv.bx;
            let g = this.getEffectiveViewport1(this.cv);
            let h = this.wh(this.cv);
            let i = this.y3.k5(f, e, g, h);
            let j = this.yx != null && this.yx.cl;
            let k = new CollisionRect(0, a);
            for (let l = 0; l < this.dn.count; l++) {
                let m = typeCast(RadialBaseView.$, this.cv);
                let n = m.cx.getBucket(l);
                let o = this.ach(this.yx, e, f, g);
                if (j) {
                    o = this.acg(l, this.yx, e, f, g);
                    if (isNaN_(o)) {
                        o = 0;
                    }
                }
                n[0] = this.yx.getScaledAngle(n[0]) + o;
                let p = Math.min(this.y6.b.od(n[2]), i.maxLength);
                let q = this.y6.d(n[0], p, e, f, g);
                let r = this.y6.e(n[0], p, e, f, g);
                if (k.containsLocation(q, r)) {
                    if (c == 7 || c == 6) {
                        b.add(((() => {
                            let $ret = new ChartSelection();
                            $ret.series = this;
                            return $ret;
                        })()));
                        return;
                    }
                    else if (c == 2 || c == 1) {
                        b.add(((() => {
                            let $ret = new ChartSelection();
                            $ret.item = this.dn.item(l);
                            return $ret;
                        })()));
                    }
                    else {
                        b.add(((() => {
                            let $ret = new ChartSelection();
                            $ret.item = this.dn.item(l);
                            $ret.series = this;
                            return $ret;
                        })()));
                    }
                }
            }
        }
        get_ace() {
            return false;
        }
        get ace() {
            return this.get_ace();
        }
        get_ab8() {
            return false;
        }
        get ab8() {
            return this.get_ab8();
        }
        aa7(a, b) {
            let c = b.by;
            let d = b.bx;
            let e = this.getEffectiveViewport1(b);
            let f = this.yx;
            let g = this.y3;
            let h = g.l4;
            let i = g.l3;
            a.f.clear();
            a.n.clear();
            a.q.clear();
            let j = this.xe();
            let k = 0;
            let l = b;
            let m = f.cl;
            let n = new CollisionAvoider();
            let o = 0;
            let p = 0;
            let q = b.cx.d;
            o = this.ach(f, c, d, e);
            l.c2.i = this.y3.n7;
            l.c2.h = this.y3.n6;
            l.c2.j = (r, s) => this.aci(r, s, c, d, e);
            l.c2.k = (r, s) => this.acj(r, s, c, d, e);
            let r = ((() => {
                let $ret = new Clipper(0, d, false);
                $ret.i = a.q;
                return $ret;
            })());
            let s = ((() => {
                let $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.ab4, this.ab6, this.acl, (t) => this.yx.getScaledAngle(t), (t) => this.y3.od(t), s, r);
            let t = true;
            if (this.acd(b)) {
                q--;
            }
            for (let u = b.cx.c; u <= q; ++u) {
                let v = u;
                if (v * b.cx.b >= this.yx.lj) {
                    v -= intDivide((this.yx.lj), b.cx.b);
                }
                let w = b.cx.getBucket(v);
                p = 0;
                if (m) {
                    p = this.zy(v, c, d, e);
                }
                w[3] = p;
                if (!isNaN_(w[0])) {
                    let x = false;
                    if (m) {
                        o = this.acg(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.ace) {
                            if (w[1] > i && this.ab8) {
                            }
                            else {
                                x = true;
                            }
                        }
                        else {
                            if (w[1] > i && this.ab8) {
                            }
                            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.acc && this.aca()) {
                        q++;
                    }
                    else {
                        t = false;
                    }
                    a.f.add(w);
                    if (j) {
                        let y = Math.min(v * b.cx.b, this.dn.count - 1);
                        let z = false;
                        if (this.yx.cl) {
                            let aa = this.yx;
                            let ab = aa.hasOthersCategory && (v * b.cx.b) == this.yx.lj - 1;
                            z = ab;
                        }
                        let ac = this.y6.d(w[0], w[1], c, d, e);
                        let ad = this.y6.e(w[0], w[1], c, d, e);
                        let 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] });
                            let 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;
                                let ag = this.yx;
                                af.content.item = this.y5;
                            }
                            ++k;
                        }
                    }
                }
                else {
                    if (t && this.acc && this.aca()) {
                        q++;
                    }
                }
            }
            b.cy.count = k;
            return;
        }
        aci(a, b, c, d, e) {
            return this.y6.d(a, b, c, d, e);
        }
        acj(a, b, c, d, e) {
            return this.y6.e(a, b, c, d, e);
        }
        acd(a) {
            let b = a;
            return !this.acc && b.cx.c == 0 && b.cx.d == this.yx.lj;
        }
        abz(a, b, c) {
            let d = null;
            let e = c.by;
            let f = c.bx;
            if (b > -1 && !e.isEmpty && !f.isEmpty) {
                let g = a._inner[0][0] < f.left - 2000 ? f.left - 10 : NaN;
                let h = f.bottom + 10;
                let i = a._inner[b][0] > f.right + 2000 ? f.right + 10 : NaN;
                let j = f.top - 10;
                d = new Clipper(1, g, h, i, j, false);
            }
            return d;
        }
        ac4(a, b, c, d, e) {
            if (a.count > 0 && d.count > 0) {
                if (!e || this.ab9()) {
                    a.add(this.adm);
                    a.add(a._inner[0]);
                    d.add(this.adm);
                    d.add(d._inner[0]);
                }
            }
        }
        aca() {
            return !this.ab9();
        }
        ab9() {
            let a = this.cv.by;
            return !a.containsPoint({ $type: Point_$type, x: 0.5, y: 0.5 });
        }
        o5(a, b) {
            super.o5(a, b);
            let c = b;
            if (a) {
                c.cy.clear();
            }
            c.c2.g$d();
        }
        aba(a, b) {
            this.qv();
            let c = b.by;
            let d = b.bx;
            let e = this.getEffectiveViewport1(b);
            let f = this.wh(b);
            let g = b;
            g.c2.g$g(a.q);
            let h = new List$1(Point_$type, 0);
            for (let i = 0; i < a.n.count; i++) {
                let j = a.n._inner[i];
                let k = this.y6.d(j.x, j.y, c, d, e);
                let l = this.y6.e(j.x, j.y, c, d, e);
                let m = { $type: Point_$type, x: k, y: l };
                h.add(m);
            }
            CategoryMarkerManager.e(this, h, g.cy, this.xg);
            this.acy(b, a);
            g.cr();
            this.acx(d, c, e, f, g);
        }
        aby(a, b, c) {
            if (b < a || a < 0 || a > this.ab6.count || b < 0 || b > this.ab6.count || c == null) {
                return null;
            }
            let d = new Array((b - a) + 1);
            let e = c.cn;
            let f = null;
            if (e) {
                f = c.i$b;
            }
            for (let g = a; g <= b; g++) {
                let h = g;
                if (e) {
                    h = f._inner[h];
                }
                d[g - a] = this.dn.item(g);
            }
            return d;
        }
        ac2(a, b, c, d, e, f) {
            let g = this.bx != 1;
            let h = this.cp != 1;
            let i = this.co != 1;
            let j = this.d2;
            this.ze.a3(this.ze.d, d.cn, a, b, c, d, e, f, true);
            this.ze.aa(this.ib);
            let k = this.ze.ax;
            let l = null;
            let m = null;
            let n = null;
            let o = this.dn;
            let p = null;
            let q = null;
            let r = null;
            if (j && this.db != null && !k.e) {
                let s = this.vm(k.z);
                let t = this.vn(k.z);
                this.ze.ag = s;
                this.ze.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.aa8(k);
            this.ze.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);
        }
        ac3(a, b, c, d, e, f) {
            let g = this.bx != 1;
            let h = this.cp != 1;
            let i = this.cp != 1;
            let j = this.d2;
            this.ze.a3(this.ze.b, d.cn, a, b, c, d, e, f, false);
            this.ze.ab(this.ib);
            let k = this.ze.ay;
            let l = null;
            let m = null;
            let n = null;
            let o = this.dn;
            if (j && this.db != null && !k.e) {
                let p = this.vl(k.z);
                let q = this.vo(k.z);
                this.ze.ag = p;
                this.ze.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.aa9(k);
            this.ze.z(this, l, m, n, f, g, h, i, b < 0);
        }
        acy(a, b) {
            a.b7 = true;
            this.ze.a1(this, this.zu(), runOn(this, this.yl), this.z4(a), this.z5(a));
            let c = this.ze.d;
            let d = c != null;
            let e = this.yx;
            if (e == null) {
                return;
            }
            let f = this.getEffectiveViewport1(a);
            let g = new ScalerParams(0, a.by, a.bx, e.ch, f);
            let h = this.dn == null ? 0 : this.dn.count;
            let i = a;
            let j = b.f;
            let k = i.cx.c;
            let l = i.cx.d;
            let m = i.cx.b;
            let n = k * m;
            for (let o = 0; o < a.cy.count; o++) {
                let p = a.cy.item(o);
                let q = p.content;
                if (d) {
                    let r = p.al;
                    this.ac2(j, r, h, e, g, a.q);
                }
                this.ze.ac(p, q);
            }
        }
        acx(a, b, c, d, e) {
            e.c3(a, b, c, d);
        }
        sf() {
            super.sf();
            if (this.index < 0) {
                return;
            }
            this.ab0.c4();
        }
        kx(a, b) {
            if (a == this.ab0.c2.g$j) {
                return null;
            }
            return super.kx(a, b);
        }
        gd(a) {
            let b = this.cv.by;
            b = b.copy();
            let c = this.cv.bx;
            let d = !b.isEmpty && !c.isEmpty && this.dn != null ? this.dn.indexOf(a) : -1;
            if (this.yx == null || this.ab6 == null || this.y3 == null) {
                return false;
            }
            if (d < 0 || d > this.ab6.count - 1) {
                return false;
            }
            let e = this.yx.getScaledAngle(d);
            let f = this.y3.od(this.ab6.item(d));
            if (isNaN_(f)) {
                f = (this.y3.n6 + this.y3.n7) / 2;
            }
            let g = 0.5 + (Math.cos(e) * f);
            let h = 0.5 + (Math.sin(e) * f);
            if (!isNaN_(g)) {
                if (g < b.left + 0.1 * b.width) {
                    g = g + 0.4 * b.width;
                    b.x = g - 0.5 * b.width;
                }
                if (g > b.right - 0.1 * b.width) {
                    g = g - 0.4 * b.width;
                    b.x = g - 0.5 * b.width;
                }
            }
            if (!isNaN_(h)) {
                if (h < b.top + 0.1 * b.height) {
                    h = h + 0.4 * b.height;
                    b.y = h - 0.5 * b.height;
                }
                if (h > b.bottom - 0.1 * b.height) {
                    h = h - 0.4 * b.height;
                    b.y = h - 0.5 * b.height;
                }
            }
            if (this.c3 != null) {
                this.c3.au(this.db, b, true);
            }
            return d >= 0;
        }
        rr(a, b) {
            super.rr(a, b);
            if (!this.g0) {
                this.cv.a4(b);
                return;
            }
            this.cv.a4(b);
            let c = typeCast(AnchoredRadialSeriesView.$, this.cu);
            c.cx.e(this.id);
            if (this.d5(this.cu)) {
                return;
            }
            if (!this.gs) {
                this.ab3 = new RadialFrame(3);
                this.aa7(this.ab3, c);
            }
            this.gs = false;
            this.aba(this.ab3, c);
            this.g0 = false;
        }
        ro(a, b, c, d, e) {
            super.ro(a, b, c, d, e);
            let f = this.ba.a$j.item(d);
            let g = f;
            g.cx.e(this.id);
            f.a3(c);
            if (this.d5(g)) {
                return;
            }
            if (this.ab2 == null) {
                this.ab2 = new RadialFrame(3);
            }
            this.ab2.v();
            this.aa7(this.ab2, g);
            this.aba(this.ab2, g);
        }
        px(a) {
            super.px(a);
            this.bc.exportTrendlineData(this, a, this.ab0.c2.g$j);
        }
    }
    AnchoredRadialSeries.$t = /*@__PURE__*/ markType(AnchoredRadialSeries, 'AnchoredRadialSeries', RadialBase.$);
    AnchoredRadialSeries.ac5 = /*@__PURE__*/ DependencyProperty.i("ActualTrendLineBrush", Brush.$, AnchoredRadialSeries.$, /*@__PURE__*/ new PropertyMetadata(2, null, (a, b) => a.raisePropertyChanged("ActualTrendLineBrush", b.oldValue, b.newValue)));
    AnchoredRadialSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, AnchoredRadialSeries, 'raisePropertyChanged', ['HighlightedValueMemberPath:acn:ac6', [2, null], 'UseCategoryNormalizedValues:acf:ade', [0, false], 'ValueMemberAsLegendLabel:acr:adf', [2, null], 'ValueMemberAsLegendUnit:act:adg', [2, null], 'ValueMemberPath:acv:adh', [2, null], 'TrendLineType:ab4:adc', [TrendLineType_$type, /*@__PURE__*/ enumGetBox(TrendLineType_$type, 0)], 'TrendLineThickness:ack:adb', [1, 1.5], 'TrendLinePeriod:acl:ada', [1, 7], 'TrendLineZIndex:acm:add', [1, 1], 'TrendLineBrush:adj:ac7', [Brush.$, null], 'TrendLineDashArray:adk:ac8', [DoubleCollection.$], 'TrendLineDashCap:adl:ac9', [PenLineCap_$type, /*@__PURE__*/ enumGetBox(PenLineCap_$type, 0)]]);
    return AnchoredRadialSeries;
})();
/**
 * @hidden
 */
export let AnchoredRadialSeriesView = /*@__PURE__*/ (() => {
    class AnchoredRadialSeriesView extends RadialBaseView {
        constructor(a) {
            super(a);
            this.c1 = null;
            this.c2 = null;
            this.cx = new AnchoredRadialBucketCalculator(this);
            this.c1 = a;
            this.c2 = new RadialTrendLineManager();
        }
        c3(a, b, c, d) {
        }
        c4() {
            this.c1.adi = null;
            if (this.c1.adj != null) {
                this.c1.adi = this.c1.adj;
            }
            else {
                this.c1.adi = this.c1.u7;
            }
        }
        a7(a, b) {
            if (a.d) {
                if (!b) {
                }
                if (this.c1.ab4 != 0 && !b) {
                    let c = this.c2.g$j;
                    c.ad = this.c1.ack;
                    c._stroke = this.c1.adi;
                    c.ai = this.c1.adk;
                    c.aj = this.c1.adl;
                    a.v(c);
                }
            }
            super.a7(a, b);
        }
        getDefaultTooltipTemplate() {
            let a = "<div class='ui-chart-default-tooltip-content'>";
            if (this.c1.yx.f2 != null) {
                a += "<span>${item." + this.c1.yx.f2 + "}</span><br/>";
            }
            a += "<span";
            let 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.acv + "}</span></div>";
            return a;
        }
    }
    AnchoredRadialSeriesView.$t = /*@__PURE__*/ markType(AnchoredRadialSeriesView, 'AnchoredRadialSeriesView', RadialBaseView.$);
    return AnchoredRadialSeriesView;
})();
