/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __extends, __generator, __values } from "tslib";
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
 */
var Arc = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(Arc, _super);
    function Arc() {
        var _this = _super.call(this) || this;
        _this.jh = null;
        _this.jf = null;
        _this.jk = 0;
        _this.ab = Arc.$;
        return _this;
    }
    Arc.prototype.a3 = function () {
        return new ArcView(this);
    };
    Arc.prototype.go = function (a) {
        _super.prototype.go.call(this, a);
        this.jg = a;
    };
    Object.defineProperty(Arc.prototype, "ji", {
        get: function () {
            return this.jh;
        },
        set: function (a) {
            var b = this.jh;
            this.jh = a;
            this.jg.b8(b, this.jh);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(Arc.prototype, "jl", {
        get: function () {
            if (this.ji != null) {
                return this.ji.i;
            }
            return 0;
        },
        enumerable: false,
        configurable: true
    });
    Arc.prototype.gk = function (a, b) {
        _super.prototype.gk.call(this, a, b);
        if (this.ji != null) {
            this.ji.c.ax.bu(a, b);
        }
    };
    Arc.prototype.fz = function (a, b) {
        if (this.ji != null && this.ji.d != null) {
            _super.prototype.fz.call(this, a, b);
            var c = this.jj(a);
            if (c != null) {
                this.ji.d.bj(c, b);
            }
        }
    };
    Arc.prototype.g2 = function (a, b) {
        if (this.ji != null && this.ji.d != null) {
            _super.prototype.g2.call(this, a, b);
            var c = this.jj(a);
            if (c != null) {
                this.ji.d.b5(c, b);
            }
        }
    };
    Arc.prototype.jj = function (a) {
        var e_1, _a;
        try {
            for (var _b = __values(fromEnum(this.jf.g)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                if (b.b == a) {
                    return b;
                }
            }
        }
        catch (e_1_1) {
            e_1 = { error: e_1_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_1)
                    throw e_1.error;
            }
        }
        return null;
    };
    Arc.prototype.g1 = function (a) {
        if (this.b9) {
            this.gr();
            this.gz();
            this.gy();
        }
    };
    Arc.prototype.gr = function () {
        if (this.actualItemsSource == null || this.bm == null) {
            this.bx.count = 0;
            return;
        }
        var a = this.co.count;
        var b = this.cn.count > 0;
        var c = PieChartBase.dh(this.c4);
        var d = PieChartBase.dh(this.c4);
        this.dm = a;
        if (b) {
            a++;
        }
        for (var e = 0; e < a; e++) {
            var f = false;
            var g = void 0;
            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);
            }
            var 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);
        }
    };
    Arc.prototype.gy = function () {
        var e_2, _a;
        var _this = this;
        var 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);
        var _loop_1 = function (b) {
            var c = new ContentControl();
            var d = this_1.dp(b);
            var e = b.b0;
            var f = b.isOthersSlice ? this_1.e6 : (this_1.bs != null && this_1.bs.count > 0) ? this_1.bs.item(this_1.co._inner[b.a5]) : null;
            f = (f == null && this_1.br.count > 0) ? this_1.br.item(this_1.co._inner[b.a5]) : f;
            c.content = ((function () {
                var $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;
            })());
            var g = c.content;
            if (this_1.a6 != null) {
                var h = this_1.a6(g);
                if (h != null) {
                    g.legendLabel = h.toString();
                }
            }
            if (this_1.aq != null && !g.isOthersSlice) {
                var i = this_1.aq.i(g);
                g.legendLabel = i;
            }
            if (this_1.ar != null && g.isOthersSlice) {
                var j = this_1.ar.i(g);
                g.legendLabel = j;
            }
            if (this_1.legendItemTemplate != null) {
                c.ah = this_1.legendItemTemplate;
            }
            this_1.cl.add(c);
        };
        var this_1 = this;
        try {
            for (var _b = __values(fromEnum(this.bx.a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                _loop_1(b);
            }
        }
        catch (e_2_1) {
            e_2 = { error: e_2_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_2)
                    throw e_2.error;
            }
        }
        if (a.isItemwise) {
            var k = a;
            k.createLegendItemsInsert(this.cl, this.ji.c);
        }
    };
    Arc.prototype.gs = function (a, b, c, d) {
        _super.prototype.gs.call(this, 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":
                var e = typeCast(IChartLegend_$type, c);
                if (e != null && this.ji != null && this.ji.c != null) {
                    e.clearLegendItemsForSeries(this.ji.c);
                }
                break;
        }
    };
    Arc.prototype.jn = function () {
        return this.a4.ad();
    };
    Arc.$t = markType(Arc, 'Arc', PieChartBase.$);
    Arc.$$p = markDep(DependencyProperty, PropertyMetadata, Arc, 'gu', ['EndAngle:jm:jp', [1, 360]]);
    return Arc;
}(PieChartBase));
export { Arc };
/**
 * @hidden
 */
var ArcItem = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ArcItem, _super);
    function ArcItem() {
        var _this = _super.call(this) || this;
        _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);
        return _this;
    }
    ArcItem.prototype.o = function (a, b) {
        var e_3, _a;
        var c = 0;
        var d = 0;
        var e = new List$1(Number_$type, 0);
        var f = new List$1(Number_$type, 0);
        var g = new List$1(Base.$, 0);
        this.g.clear();
        if (this.h == null) {
            return;
        }
        var h = new FastItemsSource();
        h.e = this.h;
        var i = this.f(h, this.n);
        if (i == null || i.count == 0) {
            h.deregisterColumn(i);
            h.m();
            return;
        }
        try {
            for (var _b = __values(fromEnum(i)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var j = _c.value;
                if (isNaN_(j) || isInfinity(j) || j <= 0) {
                    continue;
                }
                c = c + j;
            }
        }
        catch (e_3_1) {
            e_3 = { error: e_3_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_3)
                    throw e_3.error;
            }
        }
        for (var k = 0; k < i.count; k++) {
            var l = i.item(k);
            if (isNaN_(l) || isInfinity(l) || l <= 0) {
                continue;
            }
            var m = this.c == 1 ? l / c : l;
            var 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);
            }
        }
        var o = e.count;
        var p = f.count > 0;
        var q = PieChartBase.dh(a);
        var r = PieChartBase.dh(a);
        if (p) {
            o++;
        }
        var _loop_2 = function (s) {
            var t = false;
            var u = void 0;
            if (s == o - 1 && p) {
                u = d;
                t = true;
            }
            else {
                u = i.item(e._inner[s]);
            }
            var v = 1;
            if (v == 1) {
                r += PieChartBase.dh(Math.abs(u) * b / c);
            }
            else {
                r -= PieChartBase.dh(Math.abs(u) * b / c);
            }
            this_2.g.add(((function () {
                var $ret = new SliceItem();
                $ret.e = q;
                $ret.d = r - q;
                $ret.g = t ? g : h.item(e._inner[s]);
                return $ret;
            })()));
            q = r;
        };
        var this_2 = this;
        for (var s = 0; s < o; s++) {
            _loop_2(s);
        }
        h.deregisterColumn(i);
        h.m();
    };
    ArcItem.prototype.f = function (a, b) {
        var c = null;
        return a.registerColumn(b, c, false);
    };
    ArcItem.prototype.p = function (a) {
        var b = this.e == null ? a : this.e.e;
        var c = this.e == null ? 360 : this.e.d;
        this.o(b, c);
    };
    ArcItem.prototype.q = function (a) {
        var _this = this;
        this.g.clear();
        var _loop_3 = function (b) {
            var c = a.bx.item(b);
            this_3.g.add(((function () {
                var $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;
            })()));
        };
        var this_3 = this;
        for (var b = 0; b < a.bx.count; b++) {
            _loop_3(b);
        }
    };
    ArcItem.$t = markType(ArcItem, 'ArcItem');
    return ArcItem;
}(Base));
export { ArcItem };
/**
 * @hidden
 */
var RingSeriesBase = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(RingSeriesBase, _super);
    function RingSeriesBase() {
        var _this = _super.call(this) || this;
        _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 = function (a, b) { return _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 = function (a, b) { return _this.cv(b.action, b.position, b.count, b.propertyName); };
        return _this;
    }
    RingSeriesBase.prototype.c6 = function (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));
        }
    };
    Object.defineProperty(RingSeriesBase.prototype, "el", {
        get: function () {
            if (this.ek != null) {
                return this.ek;
            }
            if (this.ax != null && this.ax.cg != null) {
                return this.ax.cg;
            }
            return null;
        },
        set: function (a) {
            var b = this.el;
            if (this.ek != null && a != this.ek) {
                a = this.ek;
            }
            this.c6("SelectedStyleResolved", b, a);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "co", {
        get: function () {
            return this.bd;
        },
        set: function (a) {
            var b = this.bd;
            this.bd = a;
            this.c6("TextStyle", b, a);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "da", {
        get: function () {
            return typeCast(DataTemplate.$, this.c(RingSeriesBase.dp));
        },
        set: function (a) {
            this.h(RingSeriesBase.dp, a);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "a3", {
        get: function () {
            return this.c(RingSeriesBase.df);
        },
        set: function (a) {
            this.a2 = true;
            this.h(RingSeriesBase.df, a);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "a4", {
        get: function () {
            if (!this.a2) {
                return this.ax.ax;
            }
            else {
                return this.a3;
            }
        },
        enumerable: false,
        configurable: true
    });
    RingSeriesBase.prototype.c4 = function (a, b, c, d) {
        if (b == RingSeriesBase.$$p[4]) {
            this.ay = ((function () {
                var $ret = new FastItemsSource();
                $ret.e = d;
                return $ret;
            })());
        }
        if (b == RingSeriesBase.$$p[1]) {
            if (typeCast(FastItemsSource.$, c) != null) {
                var e = (typeCast(FastItemsSource.$, c));
                e.event = delegateRemove(e.event, this.bb);
                this.a1 = false;
            }
            if (typeCast(FastItemsSource.$, d) != null) {
                var 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;
        }
    };
    Object.defineProperty(RingSeriesBase.prototype, "container", {
        get: function () {
            return this.ax;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "isStacked", {
        get: function () {
            return false;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "isVertical", {
        get: function () {
            return false;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "isUsableInLegend", {
        get: function () {
            return true;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "hasMarkers", {
        get: function () {
            return false;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "hasSubItems", {
        get: function () {
            return false;
        },
        enumerable: false,
        configurable: true
    });
    RingSeriesBase.prototype.cv = function (a, b, c, d) {
        this.c3();
    };
    RingSeriesBase.prototype.av = function () {
        return new RingSeriesBaseView(this);
    };
    RingSeriesBase.prototype.c1 = function (a) {
    };
    RingSeriesBase.prototype.c5 = function (a) {
        this.aw.n(a);
    };
    RingSeriesBase.prototype.cu = function () {
        if (this.aw != null) {
            this.aw.i();
        }
    };
    Object.defineProperty(RingSeriesBase.prototype, "isLayer", {
        get: function () {
            return false;
        },
        enumerable: false,
        configurable: true
    });
    RingSeriesBase.prototype.cy = function (a, b) {
        this.cw(new NotifyCollectionChangedEventArgs(1, 0, b, a));
    };
    RingSeriesBase.prototype.c0 = function (a, b, c) {
        this.cw(new NotifyCollectionChangedEventArgs(2, 2, c, b, a));
    };
    RingSeriesBase.prototype.cx = function () {
        this.cw(new NotifyCollectionChangedEventArgs(0, 4));
    };
    RingSeriesBase.prototype.cz = function (a, b) {
        this.cw(new NotifyCollectionChangedEventArgs(1, 1, b, a));
    };
    RingSeriesBase.prototype.cw = function (a) {
        if (this.ay != null) {
            this.ay.handleCollectionChanged(a);
        }
    };
    RingSeriesBase.prototype.resolveLegendIndex = function () {
        return -1;
    };
    RingSeriesBase.prototype.forSubItems = function (a) {
    };
    Object.defineProperty(RingSeriesBase.prototype, "a0", {
        get: function () {
            if (this.az == null) {
                this.az = new SRProvider(this.aw.g);
            }
            return this.az;
        },
        enumerable: false,
        configurable: true
    });
    RingSeriesBase.prototype.cj = function () {
        var 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, function (a, b) { return (typeCast(RingSeriesBase.$, a)).c6("LabelTemplate", b.oldValue, b.newValue); }));
    RingSeriesBase.df = DependencyProperty.i("IsSurfaceInteractionDisabled", Boolean_$type, RingSeriesBase.$, new PropertyMetadata(2, false, function (a, b) { return 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;
}(Control));
export { RingSeriesBase };
/**
 * @hidden
 */
var Ring = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(Ring, _super);
    function Ring() {
        var _this = _super.call(this) || this;
        _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 = ((function () {
            var $ret = new RingControl();
            $ret.ai = _this;
            return $ret;
        })());
        _this.g = new List$1(ArcItem.$, 0);
        _this.e = true;
        return _this;
    }
    Object.defineProperty(Ring.prototype, "ringControl", {
        get: function () {
            return this._ringControl;
        },
        set: function (a) {
            this._ringControl = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(Ring.prototype, "c", {
        get: function () {
            return this.b;
        },
        set: function (a) {
            this.b = a;
            this.b.aw.h(this.ringControl);
            if (this.ringControl != null) {
                this.ringControl.ak.s(a);
            }
        },
        enumerable: false,
        configurable: true
    });
    Ring.prototype.f = function () {
        if (this.ringControl != null && this.ringControl.ak.d()) {
            var a = void 0, b = void 0;
            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;
    };
    Ring.prototype.o = function () {
        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;
        }
    };
    Ring.prototype.l = function (source_, a, b) {
        this.ringControl.as(source_, a, b);
    };
    Ring.prototype.k = function (source_) {
        this.ringControl.ar(source_);
    };
    Ring.prototype.m = function (source_, a, b) {
        this.ringControl.at(source_, a, b);
    };
    Ring.prototype.n = function (source_, a, b, c) {
        this.ringControl.au(source_, a, b, c);
    };
    Ring.$t = markType(Ring, 'Ring');
    return Ring;
}(Base));
export { Ring };
/**
 * @hidden
 */
var RingCollection = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(RingCollection, _super);
    function RingCollection() {
        return _super.call(this, Ring.$, 0) || this;
    }
    RingCollection.prototype.p = function () {
        var e_4, _a;
        try {
            for (var _b = __values(fromEnum(this)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var a = _c.value;
                if (a.e) {
                    var b = 0;
                    var 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;
                }
            }
        }
        catch (e_4_1) {
            e_4 = { error: e_4_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_4)
                    throw e_4.error;
            }
        }
        _super.prototype.p.call(this);
    };
    RingCollection.prototype.u = function (a) {
        var 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.prototype.u.call(this, a);
    };
    RingCollection.$t = markType(RingCollection, 'RingCollection', ObservableCollection$1.$.specialize(Ring.$));
    return RingCollection;
}(ObservableCollection$1));
export { RingCollection };
/**
 * @hidden
 */
var RingControl = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(RingControl, _super);
    function RingControl() {
        var _this = _super.call(this) || this;
        _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 = ((function () {
            var $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;
        })());
        return _this;
    }
    Object.defineProperty(RingControl.prototype, "al", {
        get: function () {
            return this.ai.c;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(RingControl.prototype, "ai", {
        get: function () {
            return this.ah;
        },
        set: function (a) {
            this.ah = a;
            if (this.ah == null) {
                this.ak.s(null);
            }
            else {
                this.ak.s(this.ah.c);
            }
        },
        enumerable: false,
        configurable: true
    });
    RingControl.prototype.aj = function () {
        return new RingControlView(this);
    };
    RingControl.prototype.ax = function (a) {
    };
    RingControl.prototype.az = function (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));
        }
    };
    RingControl.prototype.aw = function () {
        this.an();
    };
    RingControl.prototype.an = function () {
        var e_5, _a;
        if (this.ao == null) {
            return false;
        }
        if (!this.ak.d()) {
            return false;
        }
        var a = 0;
        var b = false;
        try {
            for (var _b = __values(fromEnum(this.ao)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                var 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++;
            }
        }
        catch (e_5_1) {
            e_5 = { error: e_5_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_5)
                    throw e_5.error;
            }
        }
        this.arcs.count = a;
        return b;
    };
    RingControl.prototype.ay = function (a) {
        this.ak.w(a);
    };
    RingControl.prototype.av = function () {
        this.ak.q();
    };
    RingControl.prototype.ap = function () {
        return this.ak.j();
    };
    RingControl.prototype.as = function (source_, a, b) {
        for (var c = 0; c < this.arcs.count; c++) {
            this.arcs.item(c).f7(source_, a, b);
        }
    };
    RingControl.prototype.ar = function (source_) {
        for (var a = 0; a < this.arcs.count; a++) {
            this.arcs.item(a).f5(source_);
        }
    };
    RingControl.prototype.at = function (source_, a, b) {
        for (var c = 0; c < this.arcs.count; c++) {
            this.arcs.item(c).f8(source_, a, b);
        }
    };
    RingControl.prototype.au = function (source_, a, b, c) {
        for (var 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;
}(Control));
export { RingControl };
/**
 * @hidden
 */
var RingSeriesCollection = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(RingSeriesCollection, _super);
    function RingSeriesCollection() {
        return _super.call(this, RingSeriesBase.$, 0) || this;
    }
    RingSeriesCollection.$t = markType(RingSeriesCollection, 'RingSeriesCollection', ObservableCollection$1.$.specialize(RingSeriesBase.$));
    return RingSeriesCollection;
}(ObservableCollection$1));
export { RingSeriesCollection };
/**
 * @hidden
 */
var SliceItem = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(SliceItem, _super);
    function SliceItem() {
        var _this = _super.call(this) || this;
        _this.e = 0;
        _this.d = 0;
        _this.a = null;
        _this.f = 0;
        _this.b = null;
        _this.g = null;
        _this.c = false;
        return _this;
    }
    SliceItem.$t = markType(SliceItem, 'SliceItem');
    return SliceItem;
}(Base));
export { SliceItem };
/**
 * @hidden
 */
var SliceCollection = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(SliceCollection, _super);
    function SliceCollection() {
        var _this = _super.call(this, SliceItem.$, 0) || this;
        _this.ae = false;
        _this.ag = false;
        return _this;
    }
    SliceCollection.prototype.r = function (a, b) {
        if (this.contains(b)) {
            return;
        }
        var c = this.ah(b.b);
        if (c != -1) {
            _super.prototype.x.call(this, c, b);
        }
        else {
            _super.prototype.r.call(this, a, b);
            if (this.ae) {
                if (this.ag) {
                    b.b.isSelected = true;
                }
                else {
                    b.b.isExploded = true;
                }
            }
        }
    };
    SliceCollection.prototype.x = function (a, b) {
        if (this.ae) {
            if (this.ag) {
                this._inner[a].b.isSelected = false;
            }
            else {
                this._inner[a].b.isExploded = false;
            }
        }
        _super.prototype.x.call(this, a, b);
    };
    SliceCollection.prototype.u = function (a) {
        var b = this._inner[a];
        _super.prototype.u.call(this, a);
        if (this.ae) {
            if (this.ag) {
                b.b.isSelected = false;
            }
            else {
                b.b.isExploded = false;
            }
        }
    };
    SliceCollection.prototype.remove = function (a) {
        var b = this.ah(a.b);
        if (b != -1) {
            this.u(b);
            return true;
        }
        else {
            return false;
        }
    };
    SliceCollection.prototype.p = function () {
        while (this.count > 0) {
            this.u(0);
        }
    };
    SliceCollection.prototype.ah = function (a) {
        for (var 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;
}(ObservableCollection$1));
export { SliceCollection };
/**
 * @hidden
 */
var XamDoughnutChart = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(XamDoughnutChart, _super);
    function XamDoughnutChart() {
        var _this = _super.call(this) || this;
        _this.al = new RingSeriesCollection();
        _this.aj = new RingCollection();
        _this.ap = ((function () {
            var $ret = new SliceCollection();
            $ret.ae = true;
            $ret.ag = true;
            return $ret;
        })());
        _this.ao = ((function () {
            var $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;
        var a = _this.at();
        _this.bv(a);
        a.s();
        _this.ab = XamDoughnutChart.$;
        _this.ah = function (b, c) { return _this.bz(b, c.propertyName, c.oldValue, c.newValue); };
        _this.propertyUpdated = delegateCombine(_this.propertyUpdated, _this.ah);
        var b = _this.series;
        b.collectionChanged = delegateCombine(b.collectionChanged, runOn(_this, _this.b6));
        return _this;
    }
    Object.defineProperty(XamDoughnutChart.prototype, "ak", {
        get: function () {
            return this.aj;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(XamDoughnutChart.prototype, "series", {
        get: function () {
            return this.al;
        },
        enumerable: false,
        configurable: true
    });
    XamDoughnutChart.prototype.b6 = function (a, b) {
        var e_6, _a;
        var c = new List$1(RingSeriesBase.$, 0);
        if (b.oldItems != null) {
            try {
                for (var _b = __values(fromEn(b.oldItems)), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var d = _c.value;
                    if (b.newItems == null || !b.newItems.contains(d)) {
                        d.cu();
                        this.au.w(d);
                    }
                }
            }
            catch (e_6_1) {
                e_6 = { error: e_6_1 };
            }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return))
                        _a.call(_b);
                }
                finally {
                    if (e_6)
                        throw e_6.error;
                }
            }
        }
        this.bx();
        this.b2();
    };
    Object.defineProperty(XamDoughnutChart.prototype, "a3", {
        get: function () {
            return this.c(XamDoughnutChart.cc);
        },
        set: function (a) {
            this.h(XamDoughnutChart.cc, a);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(XamDoughnutChart.prototype, "ar", {
        get: function () {
            return this.ap;
        },
        set: function (a) {
            this.ap.clear();
            this.ap.ae = false;
            this.ap = a;
            this.ap.ae = true;
            this.ap.ag = true;
            for (var b = 0; b < this.ap.count; b++) {
                this.ap._inner[b].b.isSelected = true;
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(XamDoughnutChart.prototype, "aq", {
        get: function () {
            return this.ao;
        },
        set: function (a) {
            this.ao.clear();
            this.ao.ae = false;
            this.ao = a;
            this.ao.ae = true;
            this.ao.ag = false;
            for (var b = 0; b < this.ao.count; b++) {
                this.ao._inner[b].b.isExploded = true;
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(XamDoughnutChart.prototype, "a4", {
        get: function () {
            return this.a0;
        },
        set: function (a) {
            var b = this.a0;
            this.a0 = a;
            this.b1("PixelScalingRatio", b, this.a0);
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(XamDoughnutChart.prototype, "a1", {
        get: function () {
            return this.az;
        },
        set: function (a) {
            var b = this.az;
            this.az = a;
            this.b1("ActualPixelScalingRatio", b, this.az);
        },
        enumerable: false,
        configurable: true
    });
    XamDoughnutChart.prototype.destroy = function () {
        var e_7, _a;
        this.au.v(null);
        try {
            for (var _b = __values(fromEnum(this.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var a = _c.value;
                a.cu();
            }
        }
        catch (e_7_1) {
            e_7 = { error: e_7_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_7)
                    throw e_7.error;
            }
        }
    };
    XamDoughnutChart.prototype.b5 = function (a, b) {
        if (b) {
            this.ar.add(a);
        }
        else {
            this.ar.remove(a);
        }
    };
    XamDoughnutChart.prototype.bj = function (a, b) {
        if (b) {
            this.aq.add(a);
        }
        else {
            this.aq.remove(a);
        }
    };
    XamDoughnutChart.prototype.bz = function (a, b, c, d) {
        var e_8, _a, e_9, _b, e_10, _c, e_11, _d, e_12, _e;
        switch (b) {
            case XamDoughnutChart.$$p[5]:
                try {
                    for (var _f = __values(fromEnum(this.series)), _g = _f.next(); !_g.done; _g = _f.next()) {
                        var e = _g.value;
                        e.el = d;
                    }
                }
                catch (e_8_1) {
                    e_8 = { error: e_8_1 };
                }
                finally {
                    try {
                        if (_g && !_g.done && (_a = _f.return))
                            _a.call(_f);
                    }
                    finally {
                        if (e_8)
                            throw e_8.error;
                    }
                }
                break;
            case XamDoughnutChart.$$p[0]:
                for (var f = 0; f < this.aj.count; f++) {
                    try {
                        for (var _h = (e_9 = void 0, __values(fromEnum(this.aj._inner[f].ringControl.arcs.a))), _j = _h.next(); !_j.done; _j = _h.next()) {
                            var g = _j.value;
                            g.b8 = this.av;
                        }
                    }
                    catch (e_9_1) {
                        e_9 = { error: e_9_1 };
                    }
                    finally {
                        try {
                            if (_j && !_j.done && (_b = _h.return))
                                _b.call(_h);
                        }
                        finally {
                            if (e_9)
                                throw e_9.error;
                        }
                    }
                }
                break;
            case XamDoughnutChart.$$p[1]:
                for (var h = 0; h < this.aj.count; h++) {
                    try {
                        for (var _k = (e_10 = void 0, __values(fromEnum(this.aj._inner[h].ringControl.arcs.a))), _l = _k.next(); !_l.done; _l = _k.next()) {
                            var i = _l.value;
                            i.b9 = this.aw;
                        }
                    }
                    catch (e_10_1) {
                        e_10 = { error: e_10_1 };
                    }
                    finally {
                        try {
                            if (_l && !_l.done && (_c = _k.return))
                                _c.call(_k);
                        }
                        finally {
                            if (e_10)
                                throw e_10.error;
                        }
                    }
                }
                break;
            case "PixelScalingRatio":
                var j = DeviceUtils.a(this.a4);
                if (isNaN_(j)) {
                    this.a1 = 1;
                }
                else {
                    this.a1 = j;
                }
                break;
            case "ActualPixelScalingRatio":
                try {
                    for (var _m = __values(fromEnum(this.aj)), _o = _m.next(); !_o.done; _o = _m.next()) {
                        var k = _o.value;
                        try {
                            for (var _p = (e_12 = void 0, __values(fromEnum(k.ringControl.arcs.a))), _q = _p.next(); !_q.done; _q = _p.next()) {
                                var l = _q.value;
                                l.c2 = this.a1;
                            }
                        }
                        catch (e_12_1) {
                            e_12 = { error: e_12_1 };
                        }
                        finally {
                            try {
                                if (_q && !_q.done && (_e = _p.return))
                                    _e.call(_p);
                            }
                            finally {
                                if (e_12)
                                    throw e_12.error;
                            }
                        }
                    }
                }
                catch (e_11_1) {
                    e_11 = { error: e_11_1 };
                }
                finally {
                    try {
                        if (_o && !_o.done && (_d = _m.return))
                            _d.call(_m);
                    }
                    finally {
                        if (e_11)
                            throw e_11.error;
                    }
                }
                break;
        }
    };
    XamDoughnutChart.prototype.at = function () {
        return new XamDoughnutChartView(this);
    };
    XamDoughnutChart.prototype.bv = function (a) {
        this.au = a;
    };
    XamDoughnutChart.prototype.b2 = function () {
        this.by();
        this.b4();
        this.b3();
        this.bw();
        this.au.z();
    };
    XamDoughnutChart.prototype.b4 = function () {
        var e_13, _a;
        try {
            for (var _b = __values(fromEnum(this.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var a = _c.value;
                a.c8();
            }
        }
        catch (e_13_1) {
            e_13 = { error: e_13_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_13)
                    throw e_13.error;
            }
        }
    };
    XamDoughnutChart.prototype.bw = function () {
        var a = this.au.ab;
        if (a.isEmpty || a.width == 0 || a.height == 0) {
            return;
        }
        var b = { $type: Point_$type, x: a.width / 2, y: a.height / 2 };
        var c = Math.min(a.width / 2, a.height / 2);
        var 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;
            }
        }
        var e = this.a3 * c / 100 * d;
        this.au.x(e * 2, e * 2);
        this.au.u(b.x - e, b.y - e);
    };
    XamDoughnutChart.prototype.b3 = function () {
        var e_14, _a, e_15, _b;
        var a = false;
        try {
            for (var _c = __values(fromEnum(this.aj)), _d = _c.next(); !_d.done; _d = _c.next()) {
                var b = _d.value;
                if (b.f()) {
                    a = true;
                }
            }
        }
        catch (e_14_1) {
            e_14 = { error: e_14_1 };
        }
        finally {
            try {
                if (_d && !_d.done && (_a = _c.return))
                    _a.call(_c);
            }
            finally {
                if (e_14)
                    throw e_14.error;
            }
        }
        if (a) {
            try {
                for (var _e = __values(fromEnum(this.aj)), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var c = _f.value;
                    c.c.aw.l();
                }
            }
            catch (e_15_1) {
                e_15 = { error: e_15_1 };
            }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return))
                        _b.call(_e);
                }
                finally {
                    if (e_15)
                        throw e_15.error;
                }
            }
        }
    };
    XamDoughnutChart.prototype.by = function () {
        var e_16, _a;
        var a = this.au.ab;
        if (a.isEmpty || a.width == 0 || a.height == 0) {
            return;
        }
        var b = { $type: Point_$type, x: a.width / 2, y: a.height / 2 };
        var c = Math.min(a.width / 2, a.height / 2);
        var d = Math.max(a.width / 2, a.height / 2);
        if (a.width > a.height) {
            c = c + d;
            d = c - d;
            c = c - d;
        }
        var e = ((100 - this.a3) / 100 * c) / this.aj.count;
        var f = ((100 - this.a3) / 100 * d) / this.aj.count;
        var g = this.a3 * c / 100;
        var h = this.a3 * d / 100;
        var i = 1;
        try {
            for (var _b = __values(fromEnum(this.aj)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var j = _c.value;
                var k = (g + (e * i));
                var 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++;
            }
        }
        catch (e_16_1) {
            e_16 = { error: e_16_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_16)
                    throw e_16.error;
            }
        }
    };
    XamDoughnutChart.prototype.bx = function () {
        var e_17, _a;
        this.aq.clear();
        this.ar.clear();
        this.aj.clear();
        this.au.j();
        this.au.i();
        var a = 0;
        for (var b = 0; b < this.series.count; b++) {
            var c = this.series._inner[b];
            c.ax = this;
            this.au.h(c);
            var series_ = c;
            series_.externalObject.sychronizeCollections();
            var d = c.au();
            try {
                for (var _b = (e_17 = void 0, __values(fromEnum(d))), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var e = _c.value;
                    e.d = this;
                    e.j = a;
                    this.aj.add(e);
                    a++;
                }
            }
            catch (e_17_1) {
                e_17 = { error: e_17_1 };
            }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return))
                        _a.call(_b);
                }
                finally {
                    if (e_17)
                        throw e_17.error;
                }
            }
        }
    };
    XamDoughnutChart.prototype.bt = function () {
        if (this.au != null) {
            this.height = this.au.ab.height;
            this.width = this.au.ab.width;
        }
        this.b2();
    };
    XamDoughnutChart.prototype.bu = function (a, b) {
        var c = a;
        var d = c.ji.c;
        if (d.a4) {
            return;
        }
        if (this.sliceClick != null) {
            this.sliceClick(a, b);
        }
    };
    XamDoughnutChart.prototype.b1 = function (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));
        }
    };
    XamDoughnutChart.prototype.onDetachedFromUI = function () {
        var e_18, _a, e_19, _b;
        this.au.r();
        for (var a = 0; a < this.aj.count; a++) {
            try {
                for (var _c = (e_18 = void 0, __values(fromEnum(this.aj._inner[a].ringControl.arcs.a))), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var b = _d.value;
                    b.onDetachedFromUI();
                }
            }
            catch (e_18_1) {
                e_18 = { error: e_18_1 };
            }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return))
                        _a.call(_c);
                }
                finally {
                    if (e_18)
                        throw e_18.error;
                }
            }
            try {
                for (var _e = (e_19 = void 0, __values(fromEnum(this.aj._inner[a].ringControl.arcs.b))), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var c = _f.value;
                    c.onDetachedFromUI();
                }
            }
            catch (e_19_1) {
                e_19 = { error: e_19_1 };
            }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return))
                        _b.call(_e);
                }
                finally {
                    if (e_19)
                        throw e_19.error;
                }
            }
        }
    };
    XamDoughnutChart.prototype.onAttachedToUI = function () {
        var e_20, _a, e_21, _b;
        this.au.q();
        for (var a = 0; a < this.aj.count; a++) {
            try {
                for (var _c = (e_20 = void 0, __values(fromEnum(this.aj._inner[a].ringControl.arcs.a))), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var b = _d.value;
                    b.onAttachedToUI();
                }
            }
            catch (e_20_1) {
                e_20 = { error: e_20_1 };
            }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return))
                        _a.call(_c);
                }
                finally {
                    if (e_20)
                        throw e_20.error;
                }
            }
            try {
                for (var _e = (e_21 = void 0, __values(fromEnum(this.aj._inner[a].ringControl.arcs.b))), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var c = _f.value;
                    c.onAttachedToUI();
                }
            }
            catch (e_21_1) {
                e_21 = { error: e_21_1 };
            }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return))
                        _b.call(_e);
                }
                finally {
                    if (e_21)
                        throw e_21.error;
                }
            }
        }
    };
    XamDoughnutChart.prototype.provideContainer = function (a) {
        this.au.v(a);
    };
    XamDoughnutChart.prototype.notifyResized = function () {
        this.au.y();
    };
    XamDoughnutChart.prototype.bd = function () {
        return this.au.g();
    };
    XamDoughnutChart.prototype.cf = function () {
        return this.au.aa;
    };
    XamDoughnutChart.prototype.a2 = function () {
        return this.au.d;
    };
    XamDoughnutChart.prototype.bk = function () {
        var a;
        var b;
        for (var c = 0; c < this.series.count; c++) {
            b = this.series._inner[c].au();
            for (var d = 0; d < b.count; d++) {
                a = b._inner[d].ringControl.ak.h();
                for (var e = 0; e < a.count; e++) {
                    a._inner[e].f0();
                }
            }
        }
    };
    XamDoughnutChart.prototype.bs = function () {
        if (this.holeDimensionsChanged != null) {
            this.holeDimensionsChanged(this, new HoleDimensionsChangedEventArgs(this.cf(), this.a2()));
        }
    };
    XamDoughnutChart.prototype.as = function () {
        var a = new DoughnutChartVisualData();
        a.series = new RingSeriesVisualDataList();
        a.viewport = RectData.b(this.au.ab);
        this.au.o(a);
        return a;
    };
    XamDoughnutChart.prototype.bc = function () {
        var a = this.as();
        a.scaleByViewport();
        return a.serialize();
    };
    XamDoughnutChart.prototype._ay = function (a) {
        var _a, _b, b, e_22_1;
        var e_22, _c;
        return __generator(this, function (_d) {
            switch (_d.label) {
                case 0:
                    _d.trys.push([0, 5, 6, 7]);
                    _a = __values(fromEnum(this.series)), _b = _a.next();
                    _d.label = 1;
                case 1:
                    if (!!_b.done)
                        return [3 /*break*/, 4];
                    b = _b.value;
                    if (!PieChartBase.ck(a, b.itemsSource))
                        return [3 /*break*/, 3];
                    return [4 /*yield*/, b];
                case 2:
                    _d.sent();
                    _d.label = 3;
                case 3:
                    _b = _a.next();
                    return [3 /*break*/, 1];
                case 4: return [3 /*break*/, 7];
                case 5:
                    e_22_1 = _d.sent();
                    e_22 = { error: e_22_1 };
                    return [3 /*break*/, 7];
                case 6:
                    try {
                        if (_b && !_b.done && (_c = _a.return))
                            _c.call(_a);
                    }
                    finally {
                        if (e_22)
                            throw e_22.error;
                    }
                    return [7 /*endfinally*/];
                case 7: return [2 /*return*/];
            }
        });
    };
    XamDoughnutChart.prototype.ay = function (a) {
        var _this = this;
        return toEnum(function () { return _this._ay(a); });
    };
    XamDoughnutChart.prototype.bm = function (source_, a, b) {
        var e_23, _a;
        try {
            for (var _b = __values(fromEnum(this.ay(source_))), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                c.cy(a, b);
            }
        }
        catch (e_23_1) {
            e_23 = { error: e_23_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_23)
                    throw e_23.error;
            }
        }
    };
    XamDoughnutChart.prototype.bp = function (source_, a, b, c) {
        var e_24, _a;
        try {
            for (var _b = __values(fromEnum(this.ay(source_))), _c = _b.next(); !_c.done; _c = _b.next()) {
                var d = _c.value;
                d.c0(a, b, c);
            }
        }
        catch (e_24_1) {
            e_24 = { error: e_24_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_24)
                    throw e_24.error;
            }
        }
    };
    XamDoughnutChart.prototype.bl = function (source_) {
        var e_25, _a;
        try {
            for (var _b = __values(fromEnum(this.ay(source_))), _c = _b.next(); !_c.done; _c = _b.next()) {
                var a = _c.value;
                a.cx();
            }
        }
        catch (e_25_1) {
            e_25 = { error: e_25_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_25)
                    throw e_25.error;
            }
        }
    };
    XamDoughnutChart.prototype.bn = function (source_, a, b) {
        var e_26, _a;
        try {
            for (var _b = __values(fromEnum(this.ay(source_))), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                c.cz(a, b);
            }
        }
        catch (e_26_1) {
            e_26 = { error: e_26_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_26)
                    throw e_26.error;
            }
        }
    };
    XamDoughnutChart.$t = markType(XamDoughnutChart, 'XamDoughnutChart', Control.$, [INotifyPropertyChanged_$type, ILegendOwner_$type]);
    XamDoughnutChart.cc = DependencyProperty.i("InnerExtent", Number_$type, XamDoughnutChart.$, new PropertyMetadata(2, 40, function (a, b) {
        var 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;
}(Control));
export { XamDoughnutChart };
/**
 * @hidden
 */
var ArcView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ArcView, _super);
    function ArcView(a) {
        var _this = _super.call(this, a) || this;
        _this.b6 = null;
        _this.b6 = a;
        return _this;
    }
    ArcView.prototype.b8 = function (a, b) {
        this.e.series = this.b6.ji.c;
    };
    ArcView.prototype.b7 = function () {
        return this.f;
    };
    ArcView.prototype.b9 = function () {
        this.bc();
        this.bt = new Brush();
        var a = this.c.v();
        this.bt._fill = a.rootWrapper.getStyleProperty("color");
    };
    ArcView.$t = markType(ArcView, 'ArcView', PieChartBaseView.$);
    return ArcView;
}(PieChartBaseView));
export { ArcView };
/**
 * @hidden
 */
var RingControlView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(RingControlView, _super);
    function RingControlView(a) {
        var _this = _super.call(this) || this;
        _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;
        return _this;
    }
    RingControlView.prototype.a = function () {
        var 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;
    };
    RingControlView.prototype.l = function (a) {
        var b = this.e.item(a).rootWrapper;
        if (b != null) {
            b.show();
        }
        this.g.add(a);
    };
    RingControlView.prototype.n = function (a) {
        var b = this.e.item(a).rootWrapper;
        if (b != null) {
            b.hide();
        }
        this.g.remove(a);
    };
    RingControlView.prototype.m = function (a) {
        this.o(a);
        this.f.remove(a);
    };
    RingControlView.prototype.h = function () {
        return this.f;
    };
    RingControlView.prototype.r = function () {
    };
    RingControlView.prototype.aa = function () {
        this.b.aw();
    };
    RingControlView.prototype.t = function (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);
        }
    };
    RingControlView.prototype.w = function (a) {
        var e_27, _a, e_28, _b;
        if (a == null) {
            this.b.arcs.count = 0;
            try {
                for (var _c = __values(fromEnum(this.f)), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var b = _d.value;
                    b.destroy();
                }
            }
            catch (e_27_1) {
                e_27 = { error: e_27_1 };
            }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return))
                        _a.call(_c);
                }
                finally {
                    if (e_27)
                        throw e_27.error;
                }
            }
            this.f.clear();
            this.e.clear();
            this.g.clear();
            return;
        }
        this.i = a;
        this.i.rootWrapper.setStyleProperty("position", "relative");
        try {
            for (var _e = __values(fromEnum(this.f)), _f = _e.next(); !_f.done; _f = _e.next()) {
                var c = _f.value;
                var d = this.e.item(c);
                this.i.append(d.rootWrapper);
                c.jg.b9();
            }
        }
        catch (e_28_1) {
            e_28 = { error: e_28_1 };
        }
        finally {
            try {
                if (_f && !_f.done && (_b = _e.return))
                    _b.call(_e);
            }
            finally {
                if (e_28)
                    throw e_28.error;
            }
        }
        this.aa();
    };
    RingControlView.prototype.z = function (a) {
        var 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");
    };
    RingControlView.prototype.k = function (a, b) {
        b.setStyleProperty("width", a.width.toString() + "px");
        b.setStyleProperty("height", a.height.toString() + "px");
    };
    RingControlView.prototype.u = function (a, b) {
        b.setStyleProperty("top", a.o.toString() + "px");
        b.setStyleProperty("left", a.n.toString() + "px");
    };
    RingControlView.prototype.o = function (a) {
        var b = this.e.item(a);
        b.rootWrapper.remove();
        this.e.removeItem(a);
        a.provideContainer(null);
    };
    RingControlView.prototype.ab = function (a) {
        this.k(a, a.jn().rootWrapper);
        a.gb(a.width, a.height);
    };
    RingControlView.prototype.d = function () {
        return this.i != null;
    };
    RingControlView.prototype.q = function () {
    };
    RingControlView.prototype.s = function (a) {
        this.c = a;
        if (a != null) {
            a.propertyUpdated = delegateCombine(a.propertyUpdated, runOn(this, this.y));
        }
    };
    RingControlView.prototype.y = function (a, b) {
        switch (b.propertyName) {
            case "LabelExtent":
                for (var c = 0; c < this.f.count; c++) {
                    this.f._inner[c].db = b.newValue;
                }
                break;
            case "LabelMemberPath":
                for (var d = 0; d < this.f.count; d++) {
                    this.f._inner[d].ej = b.newValue;
                }
                break;
            case "LabelsPosition":
                for (var e = 0; e < this.f.count; e++) {
                    this.f._inner[e].az = EnumUtil.getEnumValue(LabelsPosition_$type, b.newValue);
                }
                break;
            case "LabelTemplate":
                for (var f = 0; f < this.f.count; f++) {
                    this.f._inner[f].hc = b.newValue;
                }
                break;
            case "ValueMemberPath":
                for (var g = 0; g < this.f.count; g++) {
                    this.f._inner[g].fv = b.newValue;
                }
                break;
            case "ToolTip":
                for (var h = 0; h < this.f.count; h++) {
                    this.f._inner[h].dr = b.newValue;
                }
                break;
            case "LeaderLineVisibility":
                for (var i = 0; i < this.f.count; i++) {
                    this.f._inner[i].je = EnumUtil.getEnumValue(Visibility_$type, b.newValue);
                }
                break;
            case "LeaderLineStyle":
                for (var j = 0; j < this.f.count; j++) {
                    this.f._inner[j].ja = b.newValue;
                }
                break;
            case "LeaderLineType":
                for (var k = 0; k < this.f.count; k++) {
                    this.f._inner[k].a0 = EnumUtil.getEnumValue(LeaderLineType_$type, b.newValue);
                }
                break;
            case "LeaderLineMargin":
                for (var l = 0; l < this.f.count; l++) {
                    this.f._inner[l].dc = b.newValue;
                }
                break;
            case "OthersCategoryThreshold":
                for (var m = 0; m < this.f.count; m++) {
                    this.f._inner[m].dd = b.newValue;
                }
                break;
            case "OthersCategoryType":
                for (var n = 0; n < this.f.count; n++) {
                    this.f._inner[n].a2 = EnumUtil.getEnumValue(OthersCategoryType_$type, b.newValue);
                }
                break;
            case "OthersCategoryText":
                for (var o = 0; o < this.f.count; o++) {
                    this.f._inner[o].e6 = b.newValue;
                }
                break;
            case "OthersCategoryStyle":
                for (var p = 0; p < this.f.count; p++) {
                    this.f._inner[p].jb = b.newValue;
                }
                break;
            case "Legend":
                for (var q = 0; q < this.f.count; q++) {
                    this.f._inner[q].legend = b.newValue;
                }
                break;
            case "LegendItemTemplate":
                for (var r = 0; r < this.f.count; r++) {
                    this.f._inner[r].legendItemTemplate = b.newValue;
                }
                break;
            case "LegendItemBadgeTemplate":
                for (var s = 0; s < this.f.count; s++) {
                    this.f._inner[s].legendItemBadgeTemplate = b.newValue;
                }
                break;
            case "Outlines":
                for (var t = 0; t < this.f.count; t++) {
                    this.f._inner[t].an = b.newValue;
                }
                break;
            case "Brushes":
                for (var u = 0; u < this.f.count; u++) {
                    this.f._inner[u].am = b.newValue;
                }
                break;
            case "SelectedStyle":
                for (var v = 0; v < this.f.count; v++) {
                    this.f._inner[v].jc = b.newValue;
                }
                break;
            case "SelectedStyleResolved":
                for (var w = 0; w < this.f.count; w++) {
                    this.f._inner[w].jc = b.newValue;
                }
                break;
            case "RadiusFactor":
                for (var x = 0; x < this.f.count; x++) {
                    this.f._inner[x].dg = b.newValue;
                }
                break;
        }
    };
    RingControlView.prototype.p = function () {
        var e_29, _a;
        try {
            for (var _b = __values(fromEnum(this.f)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var a = _c.value;
                a.f0();
            }
        }
        catch (e_29_1) {
            e_29 = { error: e_29_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_29)
                    throw e_29.error;
            }
        }
    };
    RingControlView.prototype.j = function () {
        return this.i;
    };
    RingControlView.prototype.v = function (a, b) {
        this.b.n = a;
        this.b.o = b;
        this.x();
    };
    RingControlView.prototype.x = function () {
        for (var a = 0; a < this.f.count; a++) {
            var b = this.f._inner[a];
            this.t(b, 0, 0);
        }
    };
    RingControlView.$t = markType(RingControlView, 'RingControlView');
    return RingControlView;
}(Base));
export { RingControlView };
/**
 * @hidden
 */
var RingSeriesBaseView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(RingSeriesBaseView, _super);
    function RingSeriesBaseView(a) {
        var _this = _super.call(this) || this;
        _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;
        return _this;
    }
    RingSeriesBaseView.prototype.k = function () {
        this.c.legendItemTemplate = ((function () {
            var $ret = new DataTemplate();
            $ret.render = PieLegendTemplates.e;
            $ret.measure = PieLegendTemplates.c;
            return $ret;
        })());
        this.c.legendItemBadgeTemplate = ((function () {
            var $ret = new DataTemplate();
            $ret.render = PieLegendTemplates.d;
            $ret.measure = PieLegendTemplates.f;
            return $ret;
        })());
    };
    RingSeriesBaseView.prototype.h = function (a) {
        if (!this.f.contains(a)) {
            this.f.add(a);
        }
        if (this.g != null && (a.ap() != this.g)) {
            a.ay(this.g);
        }
    };
    RingSeriesBaseView.prototype.j = function (a, b, c, d, e) {
        var f = BrushUtil.f("chart", a, b, c);
        b = f.p2;
        c = f.p3;
        var g = new Array(b.count * 2);
        for (var h = 0; h < g.length; h += 2) {
            g[h] = "#fff";
            g[h + 1] = b.item(intDivide(h, 2))._fill;
        }
        var i = BrushUtil.f("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
        };
    };
    RingSeriesBaseView.prototype.n = function (a) {
        var e_30, _a, e_31, _b;
        if (a == null) {
            try {
                for (var _c = __values(fromEnum(this.f)), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var b = _d.value;
                    b.ay(null);
                }
            }
            catch (e_30_1) {
                e_30 = { error: e_30_1 };
            }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return))
                        _a.call(_c);
                }
                finally {
                    if (e_30)
                        throw e_30.error;
                }
            }
            return;
        }
        this.g = a;
        var c;
        var d;
        var e;
        var f;
        var 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;
        }
        try {
            for (var _e = __values(fromEnum(this.f)), _f = _e.next(); !_f.done; _f = _e.next()) {
                var h = _f.value;
                h.ay(this.g);
            }
        }
        catch (e_31_1) {
            e_31 = { error: e_31_1 };
        }
        finally {
            try {
                if (_f && !_f.done && (_b = _e.return))
                    _b.call(_e);
            }
            finally {
                if (e_31)
                    throw e_31.error;
            }
        }
    };
    RingSeriesBaseView.prototype.e = function () {
        return true;
    };
    RingSeriesBaseView.prototype.i = function () {
        this.n(null);
    };
    RingSeriesBaseView.prototype.l = function () {
        for (var a = 0; a < this.f.count; a++) {
            var b = this.f._inner[a];
            for (var c = 0; c < b.arcs.a.count; c++) {
                var d = b.arcs.a._inner[c];
                d.f0();
            }
        }
    };
    RingSeriesBaseView.prototype.m = function (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;
}(Base));
export { RingSeriesBaseView };
/**
 * @hidden
 */
var XamDoughnutChartView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(XamDoughnutChartView, _super);
    function XamDoughnutChartView(a) {
        var _this = _super.call(this) || this;
        _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;
        return _this;
    }
    XamDoughnutChartView.prototype.s = function () {
        this.p();
    };
    XamDoughnutChartView.prototype.z = function () {
    };
    XamDoughnutChartView.prototype.h = function (a) {
        if (!this.c.contains(a)) {
            a.c5(this.e);
            this.c.add(a);
        }
    };
    XamDoughnutChartView.prototype.w = function (a) {
        if (this.c.contains(a)) {
            a.c5(null);
            this.c.remove(a);
        }
    };
    XamDoughnutChartView.prototype.i = function () {
    };
    XamDoughnutChartView.prototype.y = function () {
        if (this.e == null) {
            return;
        }
        this.p();
        var a = this.e.rootWrapper.width();
        var 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();
    };
    XamDoughnutChartView.prototype.v = function (a) {
        if (a == null) {
            if (this.b != null) {
                this.b.av();
            }
            return;
        }
        var b = a;
        this.e = b;
        var c = this.e.rootWrapper.width();
        var 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;
        var e = this.b;
        e.onMouseOver = delegateCombine(e.onMouseOver, runOn(this, this.m));
        var f = this.b;
        f.onMouseLeave = delegateCombine(f.onMouseLeave, runOn(this, this.l));
        var g = this.b;
        g.onMouseDown = delegateCombine(g.onMouseDown, runOn(this, this.k));
        var h = this.b;
        h.onMouseUp = delegateCombine(h.onMouseUp, runOn(this, this.n));
        this.y();
    };
    XamDoughnutChartView.prototype.t = function (a, b, c) {
        for (var d = this.c.count - 1; d >= 0; d--) {
            var e = this.c._inner[d];
            if (e.a4) {
                continue;
            }
            var f = e.aw.f;
            for (var g = 0; g < f.count; g++) {
                var h = f._inner[g];
                var i = h.arcs.a;
                for (var j = 0; j < i.count; j++) {
                    var k = i._inner[j];
                    var l = { $type: Point_$type, x: a.x - k.n, y: a.y - k.o };
                    b(k.a4, l);
                    if (c == "mouseUp") {
                        var m = k.jg.b7();
                        if (m != null) {
                            return;
                        }
                    }
                }
            }
        }
    };
    XamDoughnutChartView.prototype.n = function (a) {
        this.t(a, function (b, c) { return b.al(c); }, "mouseUp");
    };
    XamDoughnutChartView.prototype.k = function (a) {
        this.t(a, function (b, c) { return b.ai(c); }, "mouseDown");
    };
    XamDoughnutChartView.prototype.l = function (a) {
        this.t(a, function (b, c) { return b.aj(c); }, "mouseLeave");
    };
    XamDoughnutChartView.prototype.m = function (a, b, c) {
        this.t(a, function (d, e) { return d.ak(e, b, c); }, "mouseOver");
    };
    XamDoughnutChartView.prototype.g = function () {
        return this.e.rootWrapper.getAttribute("id");
    };
    XamDoughnutChartView.prototype.u = function (a, b) {
        if (!this.ab.isEmpty && this.ab.width != 0 && this.ab.height != 0) {
            var c = this.aa.x;
            var 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();
            }
        }
    };
    XamDoughnutChartView.prototype.x = function (a, b) {
        var c = this.d;
        this.d = a / 2;
        if (c != this.d) {
            this.a.bs();
        }
    };
    XamDoughnutChartView.prototype.j = function () {
    };
    XamDoughnutChartView.prototype.o = function (a) {
        a.width = this.a.width;
        a.height = this.a.height;
        a.holeRadius = this.a.a2();
        for (var 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 (var 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 (var 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();
                    var _loop_4 = function (e) {
                        if (null == this_4.a.series._inner[b].au()._inner[c].g._inner[d].g._inner[e].b) {
                            return "continue";
                        }
                        a.series._inner[b].rings._inner[c].arcs._inner[d].a.add(new SliceVisualData());
                        var f = new SliceVisualData();
                        var g = this_4.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;
                        var h = g.aj;
                        if (null != h) {
                            a.series._inner[b].rings._inner[c].arcs._inner[d].a._inner[e].labelVisualData = ((function () {
                                var $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);
                            }
                        }
                    };
                    var this_4 = this;
                    for (var e = 0; e < this.a.series._inner[b].au()._inner[c].g._inner[d].g.count; e++) {
                        _loop_4(e);
                    }
                }
            }
        }
    };
    XamDoughnutChartView.prototype.p = function () {
        var a = this.a.a4;
        var b = this.a.a1;
        if (!isNaN_(a) && a != 0) {
            return;
        }
        if (window.devicePixelRatio != undefined && window.devicePixelRatio != b) {
            this.a.a1 = window.devicePixelRatio;
        }
    };
    XamDoughnutChartView.prototype.r = function () {
        if (this.b != null && this.e != null) {
            this.b.bh(this.e.rootWrapper, "");
        }
    };
    XamDoughnutChartView.prototype.q = function () {
        this.p();
        if (this.b != null) {
            this.b.at(this.e.rootWrapper, "");
        }
    };
    XamDoughnutChartView.$t = markType(XamDoughnutChartView, 'XamDoughnutChartView');
    return XamDoughnutChartView;
}(Base));
export { XamDoughnutChartView };
