/*
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 { PieChartBase } from "./PieChartBase";
import { DependencyProperty } from "igniteui-angular-core";
import { PieChartBaseView } from "./PieChartBaseView";
import { Base, Number_$type, typeCast, fromEnum, markType, markDep, IEnumerable_$type, INotifyPropertyChanged_$type, PropertyChangedEventArgs, Point_$type, delegateCombine, enumGetBox, EnumUtil, Delegate_$type, Array_$type, Boolean_$type, delegateRemove, runOn, fromEn, toEnum } from "igniteui-angular-core";
import { Control } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { NotifyCollectionChangedEventArgs } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { FastItemsSource } from "igniteui-angular-core";
import { IChartLegend_$type } from "igniteui-angular-core";
import { ContentControl } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { PieSliceDataContext } from "./PieSliceDataContext";
import { UIElement } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { Visibility_$type } from "igniteui-angular-core";
import { OthersCategoryType_$type } from "igniteui-angular-core";
import { BrushCollection } from "igniteui-angular-core";
import { isNaN_, isInfinity, intDivide } from "igniteui-angular-core";
import { ILegendSeries_$type } from "igniteui-angular-core";
import { ILegendTemplateProvider_$type } from "igniteui-angular-core";
import { LabelsPosition_$type } from "./LabelsPosition";
import { Style } from "igniteui-angular-core";
import { LeaderLineType_$type } from "./LeaderLineType";
import { DataTemplate } from "igniteui-angular-core";
import { ILegendOwner_$type } from "igniteui-angular-core";
import { SRProvider } from "igniteui-angular-core";
import { PropertyUpdatedEventArgs } from "igniteui-angular-core";
import { stringIsNullOrWhiteSpace } from "igniteui-angular-core";
import { Size } from "igniteui-angular-core";
import { ObservableCollection$1 } from "igniteui-angular-core";
import { DomRenderer_$type } from "igniteui-angular-core";
import { DeviceUtils } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { HoleDimensionsChangedEventArgs } from "./HoleDimensionsChangedEventArgs";
import { DoughnutChartVisualData } from "./DoughnutChartVisualData";
import { RingSeriesVisualDataList } from "./RingSeriesVisualDataList";
import { RectData } from "igniteui-angular-core";
import { Dictionary$2 } from "igniteui-angular-core";
import { PieLegendTemplates } from "./PieLegendTemplates";
import { BrushUtil } from "igniteui-angular-core";
import { FontUtil } from "igniteui-angular-core";
import { DOMEventProxy } from "igniteui-angular-core";
import { SliceVisualData } from "./SliceVisualData";
import { RingSeriesVisualData } from "./RingSeriesVisualData";
import { RingVisualDataList } from "./RingVisualDataList";
import { RingVisualData } from "./RingVisualData";
import { ArcVisualDataList } from "./ArcVisualDataList";
import { ArcVisualData } from "./ArcVisualData";
import { SliceVisualDataList } from "./SliceVisualDataList";
import { PointData } from "igniteui-angular-core";
import { AppearanceHelper } from "igniteui-angular-core";
import { PathVisualData } from "igniteui-angular-core";
import { DoughnutChartLabelVisualData } from "./DoughnutChartLabelVisualData";
import { RectUtil } from "igniteui-angular-core";
import { SizeData } from "igniteui-angular-core";
/**
 * @hidden
 */
export let Arc = /*@__PURE__*/ (() => {
    class Arc extends PieChartBase {
        constructor() {
            super();
            this.jh = null;
            this.jf = null;
            this.jk = 0;
            this.ab = Arc.$;
        }
        a3() {
            return new ArcView(this);
        }
        go(a) {
            super.go(a);
            this.jg = a;
        }
        get ji() {
            return this.jh;
        }
        set ji(a) {
            let b = this.jh;
            this.jh = a;
            this.jg.b8(b, this.jh);
        }
        get jl() {
            if (this.ji != null) {
                return this.ji.i;
            }
            return 0;
        }
        gk(a, b) {
            super.gk(a, b);
            if (this.ji != null) {
                this.ji.c.ax.bu(a, b);
            }
        }
        fz(a, b) {
            if (this.ji != null && this.ji.d != null) {
                super.fz(a, b);
                let c = this.jj(a);
                if (c != null) {
                    this.ji.d.bj(c, b);
                }
            }
        }
        g2(a, b) {
            if (this.ji != null && this.ji.d != null) {
                super.g2(a, b);
                let c = this.jj(a);
                if (c != null) {
                    this.ji.d.b5(c, b);
                }
            }
        }
        jj(a) {
            for (let b of fromEnum(this.jf.g)) {
                if (b.b == a) {
                    return b;
                }
            }
            return null;
        }
        g1(a) {
            if (this.b9) {
                this.gr();
                this.gz();
                this.gy();
            }
        }
        gr() {
            if (this.actualItemsSource == null || this.bm == null) {
                this.bx.count = 0;
                return;
            }
            let a = this.co.count;
            let b = this.cn.count > 0;
            let c = PieChartBase.dh(this.c4);
            let d = PieChartBase.dh(this.c4);
            this.dm = a;
            if (b) {
                a++;
            }
            for (let e = 0; e < a; e++) {
                let f = false;
                let g;
                if (e == a - 1 && b) {
                    g = this.de;
                    f = true;
                }
                else {
                    g = this.bv.item(this.co._inner[e]);
                }
                if (this.i3 == 1) {
                    d += PieChartBase.dh(Math.abs(g) * this.jm / this.dj);
                }
                else {
                    d -= PieChartBase.dh(Math.abs(g) * this.jm / this.dj);
                }
                let h = this.bx.item(e);
                if (this.c1 >= 100) {
                    h._visibility = 1;
                }
                else {
                    h._visibility = 0;
                }
                h.aw = true;
                h.a3 = c;
                h.ax = d;
                h.a1 = h.a0 = this.c1;
                h.isOthersSlice = f;
                h.ay = this.c0;
                h.a5 = e;
                h.dataContext = f ? this.cm : this.bm.item(this.co._inner[e]);
                h.isExploded = this.explodedSlices.contains(e);
                h.isSelected = this.selectedSlices.contains(e);
                c = d;
                h.aw = false;
            }
            this.bx.count = a;
            if (this.jf != null) {
                this.jf.q(this);
            }
        }
        gy() {
            let a = typeCast(IChartLegend_$type, this.legend);
            if (a == null) {
                return;
            }
            if (this.br == null || this.br.count == 0 || ((this.ji != null && this.ji.c != null) && (this.ji.d != null && !this.ji.d.series.contains(this.ji.c)))) {
                a.clearLegendItemsForSeries(this.ji.c);
                return;
            }
            this.cl = new List$1(UIElement.$, 0);
            for (let b of fromEnum(this.bx.a)) {
                let c = new ContentControl();
                let d = this.dp(b);
                let e = b.b0;
                let f = b.isOthersSlice ? this.e6 : (this.bs != null && this.bs.count > 0) ? this.bs.item(this.co._inner[b.a5]) : null;
                f = (f == null && this.br.count > 0) ? this.br.item(this.co._inner[b.a5]) : f;
                c.content = ((() => {
                    let $ret = new PieSliceDataContext();
                    $ret.series = this.ji.c;
                    $ret.slice = b;
                    $ret.item = b.dataContext;
                    $ret.itemBrush = e;
                    $ret.legendLabel = f != null ? f.toString() : null;
                    $ret.itemLabel = d != null ? d.toString() : null;
                    $ret.percentValue = this.c9(b);
                    $ret.isOthersSlice = b.isOthersSlice;
                    return $ret;
                })());
                let g = c.content;
                if (this.a6 != null) {
                    let h = this.a6(g);
                    if (h != null) {
                        g.legendLabel = h.toString();
                    }
                }
                if (this.aq != null && !g.isOthersSlice) {
                    let i = this.aq.i(g);
                    g.legendLabel = i;
                }
                if (this.ar != null && g.isOthersSlice) {
                    let j = this.ar.i(g);
                    g.legendLabel = j;
                }
                if (this.legendItemTemplate != null) {
                    c.ah = this.legendItemTemplate;
                }
                this.cl.add(c);
            }
            if (a.isItemwise) {
                let k = a;
                k.createLegendItemsInsert(this.cl, this.ji.c);
            }
        }
        gs(a, b, c, d) {
            super.gs(a, b, c, d);
            switch (b) {
                case Arc.$$p[0]:
                    this.jk = d;
                    this.gr();
                    this.gq();
                    this.gz();
                    this.gx();
                    break;
                case "RadiusFactor":
                    if (this.ji != null && this.ji.d != null) {
                        this.ji.d.bw();
                    }
                    break;
                case "Legend":
                    let e = typeCast(IChartLegend_$type, c);
                    if (e != null && this.ji != null && this.ji.c != null) {
                        e.clearLegendItemsForSeries(this.ji.c);
                    }
                    break;
            }
        }
        jn() {
            return this.a4.ad();
        }
    }
    Arc.$t = markType(Arc, 'Arc', PieChartBase.$);
    Arc.$$p = markDep(DependencyProperty, PropertyMetadata, Arc, 'gu', ['EndAngle:jm:jp', [1, 360]]);
    return Arc;
})();
/**
 * @hidden
 */
export let ArcItem = /*@__PURE__*/ (() => {
    class ArcItem extends Base {
        constructor() {
            super();
            this.d = null;
            this.b = null;
            this.n = null;
            this.l = 0;
            this.m = 0;
            this.k = 0;
            this.i = 0;
            this.j = 0;
            this.c = 0;
            this.a = null;
            this.g = null;
            this.e = null;
            this.h = null;
            this.k = 0;
            this.i = 360;
            this.g = new List$1(SliceItem.$, 0);
        }
        o(a, b) {
            let c = 0;
            let d = 0;
            let e = new List$1(Number_$type, 0);
            let f = new List$1(Number_$type, 0);
            let g = new List$1(Base.$, 0);
            this.g.clear();
            if (this.h == null) {
                return;
            }
            let h = new FastItemsSource();
            h.e = this.h;
            let i = this.f(h, this.n);
            if (i == null || i.count == 0) {
                h.deregisterColumn(i);
                h.m();
                return;
            }
            for (let j of fromEnum(i)) {
                if (isNaN_(j) || isInfinity(j) || j <= 0) {
                    continue;
                }
                c = c + j;
            }
            for (let k = 0; k < i.count; k++) {
                let l = i.item(k);
                if (isNaN_(l) || isInfinity(l) || l <= 0) {
                    continue;
                }
                let m = this.c == 1 ? l / c : l;
                let n = this.c == 1 ? this.j / 100 : this.j;
                if (m <= n) {
                    d = d + l;
                    f.add(k);
                    g.add1(h.item(k));
                }
                else {
                    e.add(k);
                }
            }
            let o = e.count;
            let p = f.count > 0;
            let q = PieChartBase.dh(a);
            let r = PieChartBase.dh(a);
            if (p) {
                o++;
            }
            for (let s = 0; s < o; s++) {
                let t = false;
                let u;
                if (s == o - 1 && p) {
                    u = d;
                    t = true;
                }
                else {
                    u = i.item(e._inner[s]);
                }
                let v = 1;
                if (v == 1) {
                    r += PieChartBase.dh(Math.abs(u) * b / c);
                }
                else {
                    r -= PieChartBase.dh(Math.abs(u) * b / c);
                }
                this.g.add(((() => {
                    let $ret = new SliceItem();
                    $ret.e = q;
                    $ret.d = r - q;
                    $ret.g = t ? g : h.item(e._inner[s]);
                    return $ret;
                })()));
                q = r;
            }
            h.deregisterColumn(i);
            h.m();
        }
        f(a, b) {
            let c = null;
            return a.registerColumn(b, c, false);
        }
        p(a) {
            let b = this.e == null ? a : this.e.e;
            let c = this.e == null ? 360 : this.e.d;
            this.o(b, c);
        }
        q(a) {
            this.g.clear();
            for (let b = 0; b < a.bx.count; b++) {
                let c = a.bx.item(b);
                this.g.add(((() => {
                    let $ret = new SliceItem();
                    $ret.e = c.a3;
                    $ret.d = c.ax - c.a3;
                    $ret.f = b;
                    $ret.a = this;
                    $ret.g = c.dataContext;
                    $ret.c = c.isOthersSlice;
                    $ret.b = c;
                    return $ret;
                })()));
            }
        }
    }
    ArcItem.$t = markType(ArcItem, 'ArcItem');
    return ArcItem;
})();
/**
 * @hidden
 */
export let RingSeriesBase = /*@__PURE__*/ (() => {
    class RingSeriesBase extends Control {
        constructor() {
            super();
            this.as = null;
            this.ax = null;
            this.propertyChanged = null;
            this.propertyUpdated = null;
            this.bd = null;
            this.a2 = false;
            this.a1 = false;
            this.bb = null;
            this.eh = null;
            this.aw = null;
            this.c9 = null;
            this.az = null;
            this.eh = { $type: Point_$type, x: 0, y: 0 };
            this.as = (a, b) => this.c4(a, b.propertyName, b.oldValue, b.newValue);
            this.propertyUpdated = delegateCombine(this.propertyUpdated, this.as);
            this.aw = this.av();
            this.c1(this.aw);
            this.aw.k();
            this.bb = (a, b) => this.cv(b.action, b.position, b.count, b.propertyName);
        }
        c6(a, b, c) {
            if (this.propertyChanged != null) {
                this.propertyChanged(this, new PropertyChangedEventArgs(a));
            }
            if (this.propertyUpdated != null) {
                this.propertyUpdated(this, new PropertyUpdatedEventArgs(a, b, c));
            }
        }
        get el() {
            if (this.ek != null) {
                return this.ek;
            }
            if (this.ax != null && this.ax.cg != null) {
                return this.ax.cg;
            }
            return null;
        }
        set el(a) {
            let b = this.el;
            if (this.ek != null && a != this.ek) {
                a = this.ek;
            }
            this.c6("SelectedStyleResolved", b, a);
        }
        get co() {
            return this.bd;
        }
        set co(a) {
            let b = this.bd;
            this.bd = a;
            this.c6("TextStyle", b, a);
        }
        get da() {
            return typeCast(DataTemplate.$, this.c(RingSeriesBase.dp));
        }
        set da(a) {
            this.h(RingSeriesBase.dp, a);
        }
        get a3() {
            return this.c(RingSeriesBase.df);
        }
        set a3(a) {
            this.a2 = true;
            this.h(RingSeriesBase.df, a);
        }
        get a4() {
            if (!this.a2) {
                return this.ax.ax;
            }
            else {
                return this.a3;
            }
        }
        c4(a, b, c, d) {
            if (b == RingSeriesBase.$$p[4]) {
                this.ay = ((() => {
                    let $ret = new FastItemsSource();
                    $ret.e = d;
                    return $ret;
                })());
            }
            if (b == RingSeriesBase.$$p[1]) {
                if (typeCast(FastItemsSource.$, c) != null) {
                    let e = (typeCast(FastItemsSource.$, c));
                    e.event = delegateRemove(e.event, this.bb);
                    this.a1 = false;
                }
                if (typeCast(FastItemsSource.$, d) != null) {
                    let f = (typeCast(FastItemsSource.$, d));
                    f.event = delegateCombine(f.event, this.bb);
                    this.a1 = true;
                }
                this.c3();
            }
            switch (b) {
                case RingSeriesBase.$$p[32]:
                    this.el = d;
                    break;
                case RingSeriesBase.$$p[36]:
                    this.c3();
                    break;
                case RingSeriesBase.$$p[23]:
                    this.c3();
                    break;
            }
        }
        get container() {
            return this.ax;
        }
        get isStacked() {
            return false;
        }
        get isVertical() {
            return false;
        }
        get isUsableInLegend() {
            return true;
        }
        get hasMarkers() {
            return false;
        }
        get hasSubItems() {
            return false;
        }
        cv(a, b, c, d) {
            this.c3();
        }
        av() {
            return new RingSeriesBaseView(this);
        }
        c1(a) {
        }
        c5(a) {
            this.aw.n(a);
        }
        cu() {
            if (this.aw != null) {
                this.aw.i();
            }
        }
        get isFragment() {
            return false;
        }
        get isLayer() {
            return false;
        }
        cy(a, b) {
            this.cw(new NotifyCollectionChangedEventArgs(1, 0, b, a));
        }
        c0(a, b, c) {
            this.cw(new NotifyCollectionChangedEventArgs(2, 2, c, b, a));
        }
        cx() {
            this.cw(new NotifyCollectionChangedEventArgs(0, 4));
        }
        cz(a, b) {
            this.cw(new NotifyCollectionChangedEventArgs(1, 1, b, a));
        }
        cw(a) {
            if (this.ay != null) {
                this.ay.handleCollectionChanged(a);
            }
        }
        resolveLegendIndex() {
            return -1;
        }
        forSubItems(a) {
        }
        get a0() {
            if (this.az == null) {
                this.az = new SRProvider(this.aw.g);
            }
            return this.az;
        }
        cj() {
            let a = this.a0.b7;
            if (stringIsNullOrWhiteSpace(a)) {
                a = "Others";
            }
            return this.ca != null ? this.ca : a;
        }
    }
    RingSeriesBase.$t = markType(RingSeriesBase, 'RingSeriesBase', Control.$, [INotifyPropertyChanged_$type, ILegendSeries_$type, ILegendTemplateProvider_$type]);
    RingSeriesBase.dp = DependencyProperty.i("LabelTemplate", DataTemplate.$, RingSeriesBase.$, new PropertyMetadata(2, null, (a, b) => (typeCast(RingSeriesBase.$, a)).c6("LabelTemplate", b.oldValue, b.newValue)));
    RingSeriesBase.df = DependencyProperty.i("IsSurfaceInteractionDisabled", Boolean_$type, RingSeriesBase.$, new PropertyMetadata(2, false, (a, b) => a.c6("IsSurfaceInteractionDisabled", b.oldValue, b.newValue)));
    RingSeriesBase.$$p = markDep(DependencyProperty, PropertyMetadata, RingSeriesBase, 'c6', ['Brushes:ak:db', [BrushCollection.$, null], 'FastItemsSource:ay:dc', [FastItemsSource.$], 'FormatLabel:aq:dd', [Delegate_$type], 'FormatLegendLabel:ar:de', [Delegate_$type], 'ItemsSource::dg', [IEnumerable_$type, null], 'LabelExtent:a6:dh', [1, 10], 'LabelFormat:bl:di', [2, null], 'LabelFormatSpecifiers:ag:dj', [Array_$type, null], 'LabelInnerColor:ef:dk', [Brush.$, null], 'LabelMemberPath:bp:dl', [2], 'LabelOuterColor:eg:dm', [Brush.$, null], 'LabelsPosition:an:dn', [LabelsPosition_$type, enumGetBox(LabelsPosition_$type, 1)], 'LeaderLineMargin:a7:dq', [1, 6], 'LeaderLineStyle:ei:dr', [Style.$, null], 'LeaderLineType:ao:ds', [LeaderLineType_$type, enumGetBox(LeaderLineType_$type, 0)], 'LeaderLineVisibility:en:dt', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'LegendItemBadgeTemplate::du', [DataTemplate.$, null], 'LegendItemTemplate::dv', [DataTemplate.$, null], 'LegendLabelFormat:b0:dw', [2, null], 'LegendLabelFormatSpecifiers:ah:dx', [Array_$type, null], 'LegendLabelMemberPath:b3:dy', [2], 'LegendOthersLabelFormat:b5:dz', [2, null], 'LegendOthersLabelFormatSpecifiers:ai:d0', [Array_$type, null], 'Legend::d1', [IChartLegend_$type, null], 'OthersCategoryStyle:ej:d2', [Style.$, null], 'OthersCategoryText:ca:d3', [2, null], 'OthersCategoryThreshold:a8:d4', [1, 3], 'OthersCategoryType:ap:d5', [OthersCategoryType_$type, enumGetBox(OthersCategoryType_$type, 1)], 'OthersLabelFormat:ce:d6', [2, null], 'OthersLabelFormatSpecifiers:aj:d7', [Array_$type, null], 'Outlines:al:d8', [BrushCollection.$, null], 'RadiusFactor:a9:d9', [1, 0.9], 'SelectedStyle:ek:ea', [Style.$, null], 'StartAngle:ba:eb', [1, 0], 'ToolTip::ec', [4, null], 'ToolTipStyle:em:ed', [Style.$, null], 'ValueMemberPath:cs:ee', [2, null]]);
    return RingSeriesBase;
})();
/**
 * @hidden
 */
export let Ring = /*@__PURE__*/ (() => {
    class Ring extends Base {
        constructor() {
            super();
            this.j = 0;
            this.h = 0;
            this.q = new Size();
            this.p = null;
            this._ringControl = null;
            this.b = null;
            this.i = 0;
            this.g = null;
            this.d = null;
            this.e = false;
            this.p = { $type: Point_$type, x: 0, y: 0 };
            this.q = new Size(1, 0, 0);
            this.ringControl = ((() => {
                let $ret = new RingControl();
                $ret.ai = this;
                return $ret;
            })());
            this.g = new List$1(ArcItem.$, 0);
            this.e = true;
        }
        get ringControl() {
            return this._ringControl;
        }
        set ringControl(a) {
            this._ringControl = a;
        }
        get c() {
            return this.b;
        }
        set c(a) {
            this.b = a;
            this.b.aw.h(this.ringControl);
            if (this.ringControl != null) {
                this.ringControl.ak.s(a);
            }
        }
        f() {
            if (this.ringControl != null && this.ringControl.ak.d()) {
                let a, b;
                a = this.p.x - this.c.eh.x;
                b = this.p.y - this.c.eh.y;
                this.ringControl.ak.v(a, b);
                return this.ringControl.an();
            }
            return false;
        }
        o() {
            if (this.ringControl != null) {
                this.ringControl.width = this.q.width;
                this.ringControl.height = this.q.height;
                this.c.aw.h(this.ringControl);
                this.ringControl.ao = this.g;
            }
        }
        l(source_, a, b) {
            this.ringControl.as(source_, a, b);
        }
        k(source_) {
            this.ringControl.ar(source_);
        }
        m(source_, a, b) {
            this.ringControl.at(source_, a, b);
        }
        n(source_, a, b, c) {
            this.ringControl.au(source_, a, b, c);
        }
    }
    Ring.$t = markType(Ring, 'Ring');
    return Ring;
})();
/**
 * @hidden
 */
export let RingCollection = /*@__PURE__*/ (() => {
    class RingCollection extends ObservableCollection$1 {
        constructor() {
            super(Ring.$, 0);
        }
        p() {
            for (let a of fromEnum(this)) {
                if (a.e) {
                    let b = 0;
                    let c = a.ringControl.arcs.count;
                    while (b < c) {
                        a.ringControl.arcs.destroy(a.ringControl.arcs.item(b));
                        b++;
                    }
                    a.ringControl.arcs.count = 0;
                    a.ringControl = null;
                }
            }
            super.p();
        }
        u(a) {
            let b = this._inner[a];
            if (b.e) {
                b.ringControl.arcs.destroy(b.ringControl.arcs.item(a));
                b.ringControl.arcs.count = 0;
                b.ringControl = null;
            }
            super.u(a);
        }
    }
    RingCollection.$t = markType(RingCollection, 'RingCollection', ObservableCollection$1.$.specialize(Ring.$));
    return RingCollection;
})();
/**
 * @hidden
 */
export let RingControl = /*@__PURE__*/ (() => {
    class RingControl extends Control {
        constructor() {
            super();
            this.ak = null;
            this.ah = null;
            this.arcs = null;
            this.ao = null;
            this.a0 = null;
            this.propertyChanged = null;
            this.propertyUpdated = null;
            this.ab = RingControl.$;
            this.ak = this.aj();
            this.ax(this.ak);
            this.ak.r();
            this.arcs = ((() => {
                let $ret = new Pool$1(Arc.$);
                $ret.create = runOn(this.ak, this.ak.a);
                $ret.activate = runOn(this.ak, this.ak.l);
                $ret.disactivate = runOn(this.ak, this.ak.n);
                $ret.destroy = runOn(this.ak, this.ak.m);
                return $ret;
            })());
        }
        get al() {
            return this.ai.c;
        }
        get ai() {
            return this.ah;
        }
        set ai(a) {
            this.ah = a;
            if (this.ah == null) {
                this.ak.s(null);
            }
            else {
                this.ak.s(this.ah.c);
            }
        }
        aj() {
            return new RingControlView(this);
        }
        ax(a) {
        }
        az(a, b, c) {
            if (this.propertyChanged != null) {
                this.propertyChanged(this, new PropertyChangedEventArgs(a));
            }
            if (this.propertyUpdated != null) {
                this.propertyUpdated(this, new PropertyUpdatedEventArgs(a, b, c));
            }
        }
        aw() {
            this.an();
        }
        an() {
            if (this.ao == null) {
                return false;
            }
            if (!this.ak.d()) {
                return false;
            }
            let a = 0;
            let b = false;
            for (let c of fromEnum(this.ao)) {
                let d = this.arcs.item(a);
                d.jf = c;
                if (d.da != this.ai.h) {
                    d.da = this.ai.h;
                }
                if ((d.width != this.ai.q.width || d.height != this.ai.q.height) && d.a4.s()) {
                    d.width = this.ai.q.width;
                    d.height = this.ai.q.height;
                    this.ak.ab(d);
                    b = true;
                }
                if (d.di != c.k) {
                    d.di = c.k;
                }
                if (d.jm != c.i) {
                    d.jm = c.i;
                }
                if (d.itemsSource != c.h) {
                    d.itemsSource = c.h;
                }
                if (d.am != c.a) {
                    d.am = c.a;
                }
                this.ak.t(d, 0, 0);
                a++;
            }
            this.arcs.count = a;
            return b;
        }
        ay(a) {
            this.ak.w(a);
        }
        av() {
            this.ak.q();
        }
        ap() {
            return this.ak.j();
        }
        as(source_, a, b) {
            for (let c = 0; c < this.arcs.count; c++) {
                this.arcs.item(c).f7(source_, a, b);
            }
        }
        ar(source_) {
            for (let a = 0; a < this.arcs.count; a++) {
                this.arcs.item(a).f5(source_);
            }
        }
        at(source_, a, b) {
            for (let c = 0; c < this.arcs.count; c++) {
                this.arcs.item(c).f8(source_, a, b);
            }
        }
        au(source_, a, b, c) {
            for (let d = 0; d < this.arcs.count; d++) {
                this.arcs.item(d).f9(source_, a, b, c);
            }
        }
    }
    RingControl.$t = markType(RingControl, 'RingControl', Control.$, [INotifyPropertyChanged_$type]);
    return RingControl;
})();
/**
 * @hidden
 */
export let RingSeriesCollection = /*@__PURE__*/ (() => {
    class RingSeriesCollection extends ObservableCollection$1 {
        constructor() {
            super(RingSeriesBase.$, 0);
        }
    }
    RingSeriesCollection.$t = markType(RingSeriesCollection, 'RingSeriesCollection', ObservableCollection$1.$.specialize(RingSeriesBase.$));
    return RingSeriesCollection;
})();
/**
 * @hidden
 */
export let SliceItem = /*@__PURE__*/ (() => {
    class SliceItem extends Base {
        constructor() {
            super();
            this.e = 0;
            this.d = 0;
            this.a = null;
            this.f = 0;
            this.b = null;
            this.g = null;
            this.c = false;
        }
    }
    SliceItem.$t = markType(SliceItem, 'SliceItem');
    return SliceItem;
})();
/**
 * @hidden
 */
export let SliceCollection = /*@__PURE__*/ (() => {
    class SliceCollection extends ObservableCollection$1 {
        constructor() {
            super(SliceItem.$, 0);
            this.ae = false;
            this.ag = false;
        }
        r(a, b) {
            if (this.contains(b)) {
                return;
            }
            let c = this.ah(b.b);
            if (c != -1) {
                super.x(c, b);
            }
            else {
                super.r(a, b);
                if (this.ae) {
                    if (this.ag) {
                        b.b.isSelected = true;
                    }
                    else {
                        b.b.isExploded = true;
                    }
                }
            }
        }
        x(a, b) {
            if (this.ae) {
                if (this.ag) {
                    this._inner[a].b.isSelected = false;
                }
                else {
                    this._inner[a].b.isExploded = false;
                }
            }
            super.x(a, b);
        }
        u(a) {
            let b = this._inner[a];
            super.u(a);
            if (this.ae) {
                if (this.ag) {
                    b.b.isSelected = false;
                }
                else {
                    b.b.isExploded = false;
                }
            }
        }
        remove(a) {
            let b = this.ah(a.b);
            if (b != -1) {
                this.u(b);
                return true;
            }
            else {
                return false;
            }
        }
        p() {
            while (this.count > 0) {
                this.u(0);
            }
        }
        ah(a) {
            for (let b = 0; b < this.count; b++) {
                if (this._inner[b].b == a) {
                    return b;
                }
            }
            return -1;
        }
    }
    SliceCollection.$t = markType(SliceCollection, 'SliceCollection', ObservableCollection$1.$.specialize(SliceItem.$));
    return SliceCollection;
})();
/**
 * @hidden
 */
export let XamDoughnutChart = /*@__PURE__*/ (() => {
    class XamDoughnutChart extends Control {
        constructor() {
            super();
            this.al = new RingSeriesCollection();
            this.aj = new RingCollection();
            this.ap = ((() => {
                let $ret = new SliceCollection();
                $ret.ae = true;
                $ret.ag = true;
                return $ret;
            })());
            this.ao = ((() => {
                let $ret = new SliceCollection();
                $ret.ae = true;
                $ret.ag = false;
                return $ret;
            })());
            this.ah = null;
            this.a0 = NaN;
            this.az = 1;
            this.au = null;
            this.sliceClick = null;
            this.propertyChanged = null;
            this.propertyUpdated = null;
            this.holeDimensionsChanged = null;
            let a = this.at();
            this.bv(a);
            a.s();
            this.ab = XamDoughnutChart.$;
            this.ah = (b, c) => this.bz(b, c.propertyName, c.oldValue, c.newValue);
            this.propertyUpdated = delegateCombine(this.propertyUpdated, this.ah);
            let b = this.series;
            b.collectionChanged = delegateCombine(b.collectionChanged, runOn(this, this.b6));
        }
        get ak() {
            return this.aj;
        }
        get series() {
            return this.al;
        }
        b6(a, b) {
            let c = new List$1(RingSeriesBase.$, 0);
            if (b.oldItems != null) {
                for (let d of fromEn(b.oldItems)) {
                    if (b.newItems == null || !b.newItems.contains(d)) {
                        d.cu();
                        this.au.w(d);
                    }
                }
            }
            this.bx();
            this.b2();
        }
        get a3() {
            return this.c(XamDoughnutChart.cc);
        }
        set a3(a) {
            this.h(XamDoughnutChart.cc, a);
        }
        get ar() {
            return this.ap;
        }
        set ar(a) {
            this.ap.clear();
            this.ap.ae = false;
            this.ap = a;
            this.ap.ae = true;
            this.ap.ag = true;
            for (let b = 0; b < this.ap.count; b++) {
                this.ap._inner[b].b.isSelected = true;
            }
        }
        get aq() {
            return this.ao;
        }
        set aq(a) {
            this.ao.clear();
            this.ao.ae = false;
            this.ao = a;
            this.ao.ae = true;
            this.ao.ag = false;
            for (let b = 0; b < this.ao.count; b++) {
                this.ao._inner[b].b.isExploded = true;
            }
        }
        get a4() {
            return this.a0;
        }
        set a4(a) {
            let b = this.a0;
            this.a0 = a;
            this.b1("PixelScalingRatio", b, this.a0);
        }
        get a1() {
            return this.az;
        }
        set a1(a) {
            let b = this.az;
            this.az = a;
            this.b1("ActualPixelScalingRatio", b, this.az);
        }
        destroy() {
            this.au.v(null);
            for (let a of fromEnum(this.series)) {
                a.cu();
            }
        }
        b5(a, b) {
            if (b) {
                this.ar.add(a);
            }
            else {
                this.ar.remove(a);
            }
        }
        bj(a, b) {
            if (b) {
                this.aq.add(a);
            }
            else {
                this.aq.remove(a);
            }
        }
        bz(a, b, c, d) {
            switch (b) {
                case XamDoughnutChart.$$p[5]:
                    for (let e of fromEnum(this.series)) {
                        e.el = d;
                    }
                    break;
                case XamDoughnutChart.$$p[0]:
                    for (let f = 0; f < this.aj.count; f++) {
                        for (let g of fromEnum(this.aj._inner[f].ringControl.arcs.a)) {
                            g.b8 = this.av;
                        }
                    }
                    break;
                case XamDoughnutChart.$$p[1]:
                    for (let h = 0; h < this.aj.count; h++) {
                        for (let i of fromEnum(this.aj._inner[h].ringControl.arcs.a)) {
                            i.b9 = this.aw;
                        }
                    }
                    break;
                case "PixelScalingRatio":
                    let j = DeviceUtils.a(this.a4);
                    if (isNaN_(j)) {
                        this.a1 = 1;
                    }
                    else {
                        this.a1 = j;
                    }
                    break;
                case "ActualPixelScalingRatio":
                    for (let k of fromEnum(this.aj)) {
                        for (let l of fromEnum(k.ringControl.arcs.a)) {
                            l.c2 = this.a1;
                        }
                    }
                    break;
            }
        }
        at() {
            return new XamDoughnutChartView(this);
        }
        bv(a) {
            this.au = a;
        }
        b2() {
            this.by();
            this.b4();
            this.b3();
            this.bw();
            this.au.z();
        }
        b4() {
            for (let a of fromEnum(this.series)) {
                a.c8();
            }
        }
        bw() {
            let a = this.au.ab;
            if (a.isEmpty || a.width == 0 || a.height == 0) {
                return;
            }
            let b = { $type: Point_$type, x: a.width / 2, y: a.height / 2 };
            let c = Math.min(a.width / 2, a.height / 2);
            let d = 0.9;
            if (this.series.count > 0) {
                d = this.series._inner[0].a9;
                if (isNaN_(d) || isInfinity(d) || d < 0) {
                    d = 0;
                }
                else if (d > 1) {
                    d = 1;
                }
            }
            let e = this.a3 * c / 100 * d;
            this.au.x(e * 2, e * 2);
            this.au.u(b.x - e, b.y - e);
        }
        b3() {
            let a = false;
            for (let b of fromEnum(this.aj)) {
                if (b.f()) {
                    a = true;
                }
            }
            if (a) {
                for (let c of fromEnum(this.aj)) {
                    c.c.aw.l();
                }
            }
        }
        by() {
            let a = this.au.ab;
            if (a.isEmpty || a.width == 0 || a.height == 0) {
                return;
            }
            let b = { $type: Point_$type, x: a.width / 2, y: a.height / 2 };
            let c = Math.min(a.width / 2, a.height / 2);
            let d = Math.max(a.width / 2, a.height / 2);
            if (a.width > a.height) {
                c = c + d;
                d = c - d;
                c = c - d;
            }
            let e = ((100 - this.a3) / 100 * c) / this.aj.count;
            let f = ((100 - this.a3) / 100 * d) / this.aj.count;
            let g = this.a3 * c / 100;
            let h = this.a3 * d / 100;
            let i = 1;
            for (let j of fromEnum(this.aj)) {
                let k = (g + (e * i));
                let l = (h + (f * i));
                j.i = e;
                j.q = new Size(1, k * 2, l * 2);
                j.p = { $type: Point_$type, x: b.x - k, y: b.y - l };
                j.h = 100 - (e / k * 100);
                j.o();
                i++;
            }
        }
        bx() {
            this.aq.clear();
            this.ar.clear();
            this.aj.clear();
            this.au.j();
            this.au.i();
            let a = 0;
            for (let b = 0; b < this.series.count; b++) {
                let c = this.series._inner[b];
                c.ax = this;
                this.au.h(c);
                let series_ = c;
                series_.externalObject.sychronizeCollections();
                let d = c.au();
                for (let e of fromEnum(d)) {
                    e.d = this;
                    e.j = a;
                    this.aj.add(e);
                    a++;
                }
            }
        }
        bt() {
            if (this.au != null) {
                this.height = this.au.ab.height;
                this.width = this.au.ab.width;
            }
            this.b2();
        }
        bu(a, b) {
            let c = a;
            let d = c.ji.c;
            if (d.a4) {
                return;
            }
            if (this.sliceClick != null) {
                this.sliceClick(a, b);
            }
        }
        b1(a, b, c) {
            if (this.propertyChanged != null) {
                this.propertyChanged(this, new PropertyChangedEventArgs(a));
            }
            if (this.propertyUpdated != null) {
                this.propertyUpdated(this, new PropertyUpdatedEventArgs(a, b, c));
            }
        }
        onDetachedFromUI() {
            this.au.r();
            for (let a = 0; a < this.aj.count; a++) {
                for (let b of fromEnum(this.aj._inner[a].ringControl.arcs.a)) {
                    b.onDetachedFromUI();
                }
                for (let c of fromEnum(this.aj._inner[a].ringControl.arcs.b)) {
                    c.onDetachedFromUI();
                }
            }
        }
        onAttachedToUI() {
            this.au.q();
            for (let a = 0; a < this.aj.count; a++) {
                for (let b of fromEnum(this.aj._inner[a].ringControl.arcs.a)) {
                    b.onAttachedToUI();
                }
                for (let c of fromEnum(this.aj._inner[a].ringControl.arcs.b)) {
                    c.onAttachedToUI();
                }
            }
        }
        provideContainer(a) {
            this.au.v(a);
        }
        notifyResized() {
            this.au.y();
        }
        bd() {
            return this.au.g();
        }
        cf() {
            return this.au.aa;
        }
        a2() {
            return this.au.d;
        }
        bk() {
            let a;
            let b;
            for (let c = 0; c < this.series.count; c++) {
                b = this.series._inner[c].au();
                for (let d = 0; d < b.count; d++) {
                    a = b._inner[d].ringControl.ak.h();
                    for (let e = 0; e < a.count; e++) {
                        a._inner[e].f0();
                    }
                }
            }
        }
        bs() {
            if (this.holeDimensionsChanged != null) {
                this.holeDimensionsChanged(this, new HoleDimensionsChangedEventArgs(this.cf(), this.a2()));
            }
        }
        as() {
            let a = new DoughnutChartVisualData();
            a.series = new RingSeriesVisualDataList();
            a.viewport = RectData.b(this.au.ab);
            this.au.o(a);
            return a;
        }
        bc() {
            let a = this.as();
            a.scaleByViewport();
            return a.serialize();
        }
        *_ay(a) {
            for (let b of fromEnum(this.series)) {
                if (PieChartBase.ck(a, b.itemsSource)) {
                    yield b;
                }
            }
        }
        ay(a) {
            return toEnum(() => this._ay(a));
        }
        bm(source_, a, b) {
            for (let c of fromEnum(this.ay(source_))) {
                c.cy(a, b);
            }
        }
        bp(source_, a, b, c) {
            for (let d of fromEnum(this.ay(source_))) {
                d.c0(a, b, c);
            }
        }
        bl(source_) {
            for (let a of fromEnum(this.ay(source_))) {
                a.cx();
            }
        }
        bn(source_, a, b) {
            for (let c of fromEnum(this.ay(source_))) {
                c.cz(a, b);
            }
        }
    }
    XamDoughnutChart.$t = markType(XamDoughnutChart, 'XamDoughnutChart', Control.$, [INotifyPropertyChanged_$type, ILegendOwner_$type]);
    XamDoughnutChart.cc = DependencyProperty.i("InnerExtent", Number_$type, XamDoughnutChart.$, new PropertyMetadata(2, 40, (a, b) => {
        let c = b.newValue;
        if (c < 0 || c > 100) {
            if (b.oldValue != null) {
                a.a3 = b.oldValue;
            }
            return;
        }
        a.b2();
        a.b1("InnerExtent", b.oldValue, b.newValue);
    }));
    XamDoughnutChart.$$p = markDep(DependencyProperty, PropertyMetadata, XamDoughnutChart, 'b1', ['AllowSliceExplosion:av:b8', [0, true], 'AllowSliceSelection:aw:b9', [0, true], 'CenterData:a5:ca', [4, null], 'CenterDataTemplate:b7:cb', [DataTemplate.$, null], 'IsSurfaceInteractionDisabled:ax:cd', [0, false], 'SelectedStyle:cg:ce', [Style.$, null]]);
    return XamDoughnutChart;
})();
/**
 * @hidden
 */
export let ArcView = /*@__PURE__*/ (() => {
    class ArcView extends PieChartBaseView {
        constructor(a) {
            super(a);
            this.b6 = null;
            this.b6 = a;
        }
        b8(a, b) {
            this.e.series = this.b6.ji.c;
        }
        b7() {
            return this.f;
        }
        b9() {
            this.bc();
            this.bt = new Brush();
            let a = this.c.v();
            this.bt._fill = a.rootWrapper.getStyleProperty("color");
        }
    }
    ArcView.$t = markType(ArcView, 'ArcView', PieChartBaseView.$);
    return ArcView;
})();
/**
 * @hidden
 */
export let RingControlView = /*@__PURE__*/ (() => {
    class RingControlView extends Base {
        constructor(a) {
            super();
            this.b = null;
            this.f = new List$1(Arc.$, 0);
            this.g = new List$1(Arc.$, 0);
            this.i = null;
            this.e = new Dictionary$2(Arc.$, DomRenderer_$type, 0);
            this.c = null;
            this.b = a;
        }
        a() {
            let a = new Arc();
            a.o = 0;
            a.n = 0;
            a.ji = this.b.ai;
            this.f.add(a);
            this.z(a);
            if (a.fq != this.b.al.co) {
                a.fq = this.b.al.co;
            }
            a.db = this.b.al.a6;
            a.a5 = this.b.al.aq;
            a.ej = this.b.al.bp;
            a.az = this.b.al.an;
            a.hc = this.b.al.da;
            a.fv = this.b.al.cs;
            if (this.b.al.toolTip != null) {
                a.dr = this.b.al.toolTip;
            }
            a.je = this.b.al.en;
            a.ja = this.b.al.ei;
            a.a0 = this.b.al.ao;
            a.dc = this.b.al.a7;
            a.dd = this.b.al.a8;
            a.a2 = this.b.al.ap;
            a.e6 = this.b.al.cj();
            a.jb = this.b.al.ej;
            a.legend = this.b.al.legend;
            a.legendItemTemplate = this.b.al.legendItemTemplate;
            a.legendItemBadgeTemplate = this.b.al.legendItemBadgeTemplate;
            a.an = this.b.al.al;
            a.i0 = this.b.al.ef;
            a.i1 = this.b.al.eg;
            a.di = this.b.al.ba;
            a.am = this.b.al.ak;
            a.jc = this.b.al.el;
            a.cf = true;
            a.dg = this.b.al.a9;
            a.b8 = this.b.al.ax.av;
            a.b9 = this.b.al.ax.aw;
            a.a6 = this.b.al.ar;
            a.ez = this.b.al.b3;
            a.c2 = this.b.al.ax.a1;
            return a;
        }
        l(a) {
            let b = this.e.item(a).rootWrapper;
            if (b != null) {
                b.show();
            }
            this.g.add(a);
        }
        n(a) {
            let b = this.e.item(a).rootWrapper;
            if (b != null) {
                b.hide();
            }
            this.g.remove(a);
        }
        m(a) {
            this.o(a);
            this.f.remove(a);
        }
        h() {
            return this.f;
        }
        r() {
        }
        aa() {
            this.b.aw();
        }
        t(a, b, c) {
            b = b + this.b.n;
            c = c + this.b.o;
            if (this.c != null) {
                b = b + this.c.n;
                c = c + this.c.o;
            }
            if (a.n != b || a.o != c) {
                a.n = b;
                a.o = c;
                this.u(a, this.e.item(a).rootWrapper);
            }
        }
        w(a) {
            if (a == null) {
                this.b.arcs.count = 0;
                for (let b of fromEnum(this.f)) {
                    b.destroy();
                }
                this.f.clear();
                this.e.clear();
                this.g.clear();
                return;
            }
            this.i = a;
            this.i.rootWrapper.setStyleProperty("position", "relative");
            for (let c of fromEnum(this.f)) {
                let d = this.e.item(c);
                this.i.append(d.rootWrapper);
                c.jg.b9();
            }
            this.aa();
        }
        z(a) {
            let b = this.i.createElement("div");
            b.setStyleProperty("position", "absolute");
            this.e.addItem(a, this.i.getSubRenderer(b));
            this.k(a, b);
            this.u(a, b);
            if (this.i != null) {
                this.i.append(b);
            }
            a.provideContainer(this.e.item(a));
            b.setStyleProperty("position", "absolute");
        }
        k(a, b) {
            b.setStyleProperty("width", a.width.toString() + "px");
            b.setStyleProperty("height", a.height.toString() + "px");
        }
        u(a, b) {
            b.setStyleProperty("top", a.o.toString() + "px");
            b.setStyleProperty("left", a.n.toString() + "px");
        }
        o(a) {
            let b = this.e.item(a);
            b.rootWrapper.remove();
            this.e.removeItem(a);
            a.provideContainer(null);
        }
        ab(a) {
            this.k(a, a.jn().rootWrapper);
            a.gb(a.width, a.height);
        }
        d() {
            return this.i != null;
        }
        q() {
        }
        s(a) {
            this.c = a;
            if (a != null) {
                a.propertyUpdated = delegateCombine(a.propertyUpdated, runOn(this, this.y));
            }
        }
        y(a, b) {
            switch (b.propertyName) {
                case "LabelExtent":
                    for (let c = 0; c < this.f.count; c++) {
                        this.f._inner[c].db = b.newValue;
                    }
                    break;
                case "LabelMemberPath":
                    for (let d = 0; d < this.f.count; d++) {
                        this.f._inner[d].ej = b.newValue;
                    }
                    break;
                case "LabelsPosition":
                    for (let e = 0; e < this.f.count; e++) {
                        this.f._inner[e].az = EnumUtil.getEnumValue(LabelsPosition_$type, b.newValue);
                    }
                    break;
                case "LabelTemplate":
                    for (let f = 0; f < this.f.count; f++) {
                        this.f._inner[f].hc = b.newValue;
                    }
                    break;
                case "ValueMemberPath":
                    for (let g = 0; g < this.f.count; g++) {
                        this.f._inner[g].fv = b.newValue;
                    }
                    break;
                case "ToolTip":
                    for (let h = 0; h < this.f.count; h++) {
                        this.f._inner[h].dr = b.newValue;
                    }
                    break;
                case "LeaderLineVisibility":
                    for (let i = 0; i < this.f.count; i++) {
                        this.f._inner[i].je = EnumUtil.getEnumValue(Visibility_$type, b.newValue);
                    }
                    break;
                case "LeaderLineStyle":
                    for (let j = 0; j < this.f.count; j++) {
                        this.f._inner[j].ja = b.newValue;
                    }
                    break;
                case "LeaderLineType":
                    for (let k = 0; k < this.f.count; k++) {
                        this.f._inner[k].a0 = EnumUtil.getEnumValue(LeaderLineType_$type, b.newValue);
                    }
                    break;
                case "LeaderLineMargin":
                    for (let l = 0; l < this.f.count; l++) {
                        this.f._inner[l].dc = b.newValue;
                    }
                    break;
                case "OthersCategoryThreshold":
                    for (let m = 0; m < this.f.count; m++) {
                        this.f._inner[m].dd = b.newValue;
                    }
                    break;
                case "OthersCategoryType":
                    for (let n = 0; n < this.f.count; n++) {
                        this.f._inner[n].a2 = EnumUtil.getEnumValue(OthersCategoryType_$type, b.newValue);
                    }
                    break;
                case "OthersCategoryText":
                    for (let o = 0; o < this.f.count; o++) {
                        this.f._inner[o].e6 = b.newValue;
                    }
                    break;
                case "OthersCategoryStyle":
                    for (let p = 0; p < this.f.count; p++) {
                        this.f._inner[p].jb = b.newValue;
                    }
                    break;
                case "Legend":
                    for (let q = 0; q < this.f.count; q++) {
                        this.f._inner[q].legend = b.newValue;
                    }
                    break;
                case "LegendItemTemplate":
                    for (let r = 0; r < this.f.count; r++) {
                        this.f._inner[r].legendItemTemplate = b.newValue;
                    }
                    break;
                case "LegendItemBadgeTemplate":
                    for (let s = 0; s < this.f.count; s++) {
                        this.f._inner[s].legendItemBadgeTemplate = b.newValue;
                    }
                    break;
                case "Outlines":
                    for (let t = 0; t < this.f.count; t++) {
                        this.f._inner[t].an = b.newValue;
                    }
                    break;
                case "Brushes":
                    for (let u = 0; u < this.f.count; u++) {
                        this.f._inner[u].am = b.newValue;
                    }
                    break;
                case "SelectedStyle":
                    for (let v = 0; v < this.f.count; v++) {
                        this.f._inner[v].jc = b.newValue;
                    }
                    break;
                case "SelectedStyleResolved":
                    for (let w = 0; w < this.f.count; w++) {
                        this.f._inner[w].jc = b.newValue;
                    }
                    break;
                case "RadiusFactor":
                    for (let x = 0; x < this.f.count; x++) {
                        this.f._inner[x].dg = b.newValue;
                    }
                    break;
                case "TextStyle":
                    for (let y = 0; y < this.f.count; y++) {
                        this.f._inner[y].fq = b.newValue;
                    }
                    break;
            }
        }
        p() {
            for (let a of fromEnum(this.f)) {
                a.f0();
            }
        }
        j() {
            return this.i;
        }
        v(a, b) {
            this.b.n = a;
            this.b.o = b;
            this.x();
        }
        x() {
            for (let a = 0; a < this.f.count; a++) {
                let b = this.f._inner[a];
                this.t(b, 0, 0);
            }
        }
    }
    RingControlView.$t = markType(RingControlView, 'RingControlView');
    return RingControlView;
})();
/**
 * @hidden
 */
export let RingSeriesBaseView = /*@__PURE__*/ (() => {
    class RingSeriesBaseView extends Base {
        constructor(a) {
            super();
            this.c = null;
            this.f = null;
            this.g = null;
            this.a = null;
            this.b = null;
            this.o = null;
            this.d = null;
            this.f = new List$1(RingControl.$, 0);
            this.c = a;
        }
        k() {
            this.c.legendItemTemplate = ((() => {
                let $ret = new DataTemplate();
                $ret.render = PieLegendTemplates.e;
                $ret.measure = PieLegendTemplates.c;
                return $ret;
            })());
            this.c.legendItemBadgeTemplate = ((() => {
                let $ret = new DataTemplate();
                $ret.render = PieLegendTemplates.d;
                $ret.measure = PieLegendTemplates.f;
                return $ret;
            })());
        }
        h(a) {
            if (!this.f.contains(a)) {
                this.f.add(a);
            }
            if (this.g != null && (a.ap() != this.g)) {
                a.ay(this.g);
            }
        }
        j(a, b, c, d, e) {
            let f = BrushUtil.h("chart", a, b, c);
            b = f.p2;
            c = f.p3;
            let g = new Array(b.count * 2);
            for (let h = 0; h < g.length; h += 2) {
                g[h] = "#fff";
                g[h + 1] = b.item(intDivide(h, 2))._fill;
            }
            let i = BrushUtil.h("doughnut", a, b, c, g);
            b = i.p2;
            c = i.p3;
            d = new Brush();
            d._fill = this.g.rootWrapper.getStyleProperty("color");
            e = FontUtil.getFont(a);
            return {
                p1: b,
                p2: c,
                p3: d,
                p4: e
            };
        }
        n(a) {
            if (a == null) {
                for (let b of fromEnum(this.f)) {
                    b.ay(null);
                }
                return;
            }
            this.g = a;
            let c;
            let d;
            let e;
            let f;
            let g = this.j(this.g, c, d, e, f);
            c = g.p1;
            d = g.p2;
            e = g.p3;
            f = g.p4;
            this.a = c;
            this.b = d;
            this.o = e;
            this.d = f;
            if (this.c.ak == null) {
                this.c.ak = this.a;
            }
            if (this.c.al == null) {
                this.c.al = this.b;
            }
            for (let h of fromEnum(this.f)) {
                h.ay(this.g);
            }
        }
        e() {
            return true;
        }
        i() {
            this.n(null);
        }
        l() {
            for (let a = 0; a < this.f.count; a++) {
                let b = this.f._inner[a];
                for (let c = 0; c < b.arcs.a.count; c++) {
                    let d = b.arcs.a._inner[c];
                    d.f0();
                }
            }
        }
        m(a, b) {
            this.c.n = a;
            this.c.o = b;
            this.c.eh = { $type: Point_$type, x: a, y: b };
        }
    }
    RingSeriesBaseView.$t = markType(RingSeriesBaseView, 'RingSeriesBaseView');
    return RingSeriesBaseView;
})();
/**
 * @hidden
 */
export let XamDoughnutChartView = /*@__PURE__*/ (() => {
    class XamDoughnutChartView extends Base {
        constructor(a) {
            super();
            this.a = null;
            this.aa = null;
            this.d = 0;
            this.c = null;
            this.ab = null;
            this.f = null;
            this.e = null;
            this.b = null;
            this.ab = Rect.empty;
            this.aa = { $type: Point_$type, x: 0, y: 0 };
            this.d = 0;
            this.c = new List$1(RingSeriesBase.$, 0);
            this.a = a;
        }
        s() {
            this.p();
        }
        z() {
        }
        h(a) {
            if (!this.c.contains(a)) {
                a.c5(this.e);
                this.c.add(a);
            }
        }
        w(a) {
            if (this.c.contains(a)) {
                a.c5(null);
                this.c.remove(a);
            }
        }
        i() {
        }
        y() {
            if (this.e == null) {
                return;
            }
            this.p();
            let a = this.e.rootWrapper.width();
            let b = this.e.rootWrapper.height();
            this.ab = new Rect(0, 0, 0, a, b);
            if (this.b != null) {
                this.b.bl = this.ab;
            }
            this.a.bt();
        }
        v(a) {
            if (a == null) {
                if (this.b != null) {
                    this.b.av();
                }
                return;
            }
            let b = a;
            this.e = b;
            let c = this.e.rootWrapper.width();
            let d = this.e.rootWrapper.height();
            this.ab = new Rect(0, 0, 0, c, d);
            this.b = new DOMEventProxy(this.e.rootWrapper, this.e, false);
            this.b.bl = this.ab;
            let e = this.b;
            e.onMouseOver = delegateCombine(e.onMouseOver, runOn(this, this.m));
            let f = this.b;
            f.onMouseLeave = delegateCombine(f.onMouseLeave, runOn(this, this.l));
            let g = this.b;
            g.onMouseDown = delegateCombine(g.onMouseDown, runOn(this, this.k));
            let h = this.b;
            h.onMouseUp = delegateCombine(h.onMouseUp, runOn(this, this.n));
            this.y();
        }
        t(a, b, c) {
            for (let d = this.c.count - 1; d >= 0; d--) {
                let e = this.c._inner[d];
                if (e.a4) {
                    continue;
                }
                let f = e.aw.f;
                for (let g = 0; g < f.count; g++) {
                    let h = f._inner[g];
                    let i = h.arcs.a;
                    for (let j = 0; j < i.count; j++) {
                        let k = i._inner[j];
                        let l = { $type: Point_$type, x: a.x - k.n, y: a.y - k.o };
                        b(k.a4, l);
                        if (c == "mouseUp") {
                            let m = k.jg.b7();
                            if (m != null) {
                                return;
                            }
                        }
                    }
                }
            }
        }
        n(a) {
            this.t(a, (b, c) => b.al(c), "mouseUp");
        }
        k(a) {
            this.t(a, (b, c) => b.ai(c), "mouseDown");
        }
        l(a) {
            this.t(a, (b, c) => b.aj(c), "mouseLeave");
        }
        m(a, b, c) {
            this.t(a, (d, e) => d.ak(e, b, c), "mouseOver");
        }
        g() {
            return this.e.rootWrapper.getAttribute("id");
        }
        u(a, b) {
            if (!this.ab.isEmpty && this.ab.width != 0 && this.ab.height != 0) {
                let c = this.aa.x;
                let d = this.aa.y;
                this.aa.x = this.ab.width / 2;
                this.aa.y = this.ab.height / 2;
                if (this.aa.x != c || this.aa.y != d) {
                    this.a.bs();
                }
            }
        }
        x(a, b) {
            let c = this.d;
            this.d = a / 2;
            if (c != this.d) {
                this.a.bs();
            }
        }
        j() {
        }
        o(a) {
            a.width = this.a.width;
            a.height = this.a.height;
            a.holeRadius = this.a.a2();
            for (let b = 0; b < this.a.series.count; b++) {
                a.series.add(new RingSeriesVisualData());
                a.series._inner[b].rings = new RingVisualDataList();
                a.series._inner[b].name = this.a.series._inner[b].name;
                a.series._inner[b].labelExtent = this.a.series._inner[b].a6;
                a.series._inner[b].leaderLineMargin = this.a.series._inner[b].a7;
                a.series._inner[b].leaderLineType = EnumUtil.getName(LeaderLineType_$type, this.a.series._inner[b].ao);
                a.series._inner[b].labelsPosition = EnumUtil.getName(LabelsPosition_$type, this.a.series._inner[b].an);
                a.series._inner[b].leaderLineVisibility = this.a.series._inner[b].en == 0;
                for (let c = 0; c < this.a.series._inner[b].au().count; c++) {
                    a.series._inner[b].rings.add(new RingVisualData());
                    a.series._inner[b].rings._inner[c].arcs = new ArcVisualDataList();
                    for (let d = 0; d < this.a.series._inner[b].au()._inner[c].g.count; d++) {
                        a.series._inner[b].rings._inner[c].arcs.add(new ArcVisualData());
                        a.series._inner[b].rings._inner[c].arcs._inner[d].a = new SliceVisualDataList();
                        for (let e = 0; e < this.a.series._inner[b].au()._inner[c].g._inner[d].g.count; e++) {
                            if (null == this.a.series._inner[b].au()._inner[c].g._inner[d].g._inner[e].b) {
                                continue;
                            }
                            a.series._inner[b].rings._inner[c].arcs._inner[d].a.add(new SliceVisualData());
                            let f = new SliceVisualData();
                            let g = this.a.series._inner[b].au()._inner[c].g._inner[d].g._inner[e].b;
                            f.visibility = g._visibility == 0;
                            f.endAngle = g.ax;
                            f.startAngle = g.a3;
                            f.radius = g.a2;
                            f.origin = PointData.b(g.b7);
                            f.explodedOrigin = PointData.b(g.b5);
                            f.index = g.a5;
                            f.isExploded = g.isExploded;
                            f.isSelected = g.isSelected;
                            f.outline = AppearanceHelper.a(g.b1);
                            f.backgroundPath = new PathVisualData(1, "slicePath", g.al.f());
                            a.series._inner[b].rings._inner[c].arcs._inner[d].a._inner[e] = f;
                            let h = g.aj;
                            if (null != h) {
                                a.series._inner[b].rings._inner[c].arcs._inner[d].a._inner[e].labelVisualData = ((() => {
                                    let $ret = new DoughnutChartLabelVisualData();
                                    $ret.labelSize = SizeData.b(RectUtil.z(h.ao));
                                    $ret.labelValue = h.aj.al;
                                    return $ret;
                                })());
                                if (!isNaN_(h.n) && !isNaN_(h.o)) {
                                    a.series._inner[b].rings._inner[c].arcs._inner[d].a._inner[e].labelVisualData.labelPosition = new PointData(h.n, h.o);
                                }
                            }
                        }
                    }
                }
            }
        }
        p() {
            let a = this.a.a4;
            let b = this.a.a1;
            if (!isNaN_(a) && a != 0) {
                return;
            }
            if (window.devicePixelRatio != undefined && window.devicePixelRatio != b) {
                this.a.a1 = window.devicePixelRatio;
            }
        }
        r() {
            if (this.b != null && this.e != null) {
                this.b.bh(this.e.rootWrapper, "");
            }
        }
        q() {
            this.p();
            if (this.b != null) {
                this.b.at(this.e.rootWrapper, "");
            }
        }
    }
    XamDoughnutChartView.$t = markType(XamDoughnutChartView, 'XamDoughnutChartView');
    return XamDoughnutChartView;
})();
