/*
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 * as tslib_1 from "tslib";
import { AnchoredRadialSeries } from "./AnchoredRadialSeries";
import { DependencyProperty } from "igniteui-react-core";
import { Point_$type, runOn, markType, markDep, fromEnum } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { Path } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { PathGeometry } from "igniteui-react-core";
import { ViewportUtils } from "./ViewportUtils";
import { SliceCoords } from "./SliceCoords";
import { PathFigure } from "igniteui-react-core";
import { LineSegment } from "igniteui-react-core";
import { ArcSegment } from "igniteui-react-core";
import { Size } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { AnchoredRadialSeriesView } from "./AnchoredRadialSeriesView";
import { DeviceUtils } from "igniteui-react-core";
import { DataContext } from "igniteui-react-core";
/**
 * @hidden
 */
var RadialPieSeries = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(RadialPieSeries, _super);
    function RadialPieSeries() {
        var _this = _super.call(this) || this;
        _this.ab = RadialPieSeries.$;
        return _this;
    }
    RadialPieSeries.prototype.bp = function () {
        return new RadialPieSeriesView(this);
    };
    RadialPieSeries.prototype.kk = function (a) {
        _super.prototype.kk.call(this, a);
        this.r6 = a;
    };
    RadialPieSeries.prototype.preferredCategoryMode = function (a) {
        return a != null && a == this.pr ? 2 : 0;
    };
    RadialPieSeries.prototype.jl = function (a, b) {
        _super.prototype.jl.call(this, a, b);
        var c = b;
        if (a && c.c1 != null) {
            c.c1.count = 0;
        }
    };
    RadialPieSeries.prototype.e9 = function () {
        return this.pr.j0(this.bs.bv, this.bs.bu, this.getEffectiveViewport1(this.bs));
    };
    RadialPieSeries.prototype.get_cu = function () {
        return true;
    };
    RadialPieSeries.prototype.qv = function (a, b) {
        _super.prototype.qv.call(this, a, b);
        var c = b;
        var d = b.bv;
        var e = b.bu;
        var f = this.getEffectiveViewport1(b);
        var g = this.ny(b);
        var h = this.py.jp(e, d, f, g);
        var i = a.f;
        var j = this.py;
        var k = Math.max(0, 0.5 * j.lr);
        var l = k;
        l = Math.max(l, h.minLength);
        var m = this.pr.j0(d, e, f);
        var n = { $type: Point_$type, x: 0.5, y: 0.5 };
        var o = this.r7;
        var p = this.r8;
        var q = (o > 0 && p > 0);
        var r = this.q9.count;
        this.p4.a0(this, this.qg(), runOn(this, this.po), this.qi(b), this.qj(b));
        this.p4.r = this.r7;
        this.p4.s = this.r8;
        this.p4.k = this.r7;
        this.p4.l = this.r8;
        var s = false;
        var t = this.p4.b;
        if (t != null) {
            s = true;
        }
        var u = this.pr;
        var v = new ScalerParams(1, b.bv, b.bu, u.ca);
        v.c = this.getEffectiveViewport();
        var w = 0;
        for (var x = 0; x < i.count; ++x) {
            var y = c.c1.item(x);
            var z = i._inner[x][0];
            var aa = Math.min(i._inner[x][2], h.maxLength);
            if (s) {
                this.rq(i, x, r, u, v, b.q);
            }
            var ab = this.p4.k;
            var ac = this.p4.l;
            q = (ab > 0 && ac > 0);
            var ad = null;
            if (q) {
                ad = this.sd(d, e, z - (m * 0.5), z + (m * 0.5), l, aa, n, ab, ac);
            }
            else {
                ad = this.se(d, e, z - (m * 0.5), z + (m * 0.5), l, aa, n);
            }
            y.ak = ad;
            this.p4.ad(y, false, false, false, false);
            var ae = i._inner[x][2];
            if (ae > w) {
                w = ae;
            }
        }
        c.cu = ViewportUtils.d(w, d, e);
        c.cv = { $type: Point_$type, x: ViewportUtils.c(n.x, d, e), y: ViewportUtils.f(n.y, d, e) };
        c.c1.count = i.count;
        c.c6();
    };
    RadialPieSeries.prototype.se = function (a, b, c, d, e, f, g) {
        var h = SliceCoords.b(a, b, c, d, e, f, g);
        var i = new PathFigure();
        i._startPoint = h.d;
        i._isClosed = true;
        i._segments.add(((function () {
            var $ret = new LineSegment(1);
            $ret.c = h.f;
            return $ret;
        })()));
        i._segments.add(((function () {
            var $ret = new ArcSegment();
            $ret.e = h.h;
            $ret.f = h.n;
            $ret.d = 1;
            $ret.b = h.c;
            return $ret;
        })()));
        i._segments.add(((function () {
            var $ret = new LineSegment(1);
            $ret.c = h.j;
            return $ret;
        })()));
        i._segments.add(((function () {
            var $ret = new ArcSegment();
            $ret.e = h.d;
            $ret.f = h.m;
            $ret.d = 0;
            $ret.b = h.c;
            return $ret;
        })()));
        var j = new PathGeometry();
        j.c.add(i);
        return j;
    };
    RadialPieSeries.prototype.sd = function (a, b, c, d, e, f, g, h, i) {
        var j = SliceCoords.a(a, b, c, d, e, f, g, h, i);
        if (j == null) {
            return this.se(a, b, c, d, e, f, g);
        }
        var k = new PathFigure();
        k._startPoint = j.d;
        k._isClosed = true;
        var l = ((c + ((d - c) * 0.5)) * 180 / Math.PI) + 90;
        var m = new Size(1, j.l.width * (e / f), j.l.height * (e / f));
        k._segments.add(((function () {
            var $ret = new ArcSegment();
            $ret.e = j.e;
            $ret.f = m;
            $ret.c = l;
            $ret.d = 1;
            $ret.b = false;
            return $ret;
        })()));
        k._segments.add(((function () {
            var $ret = new LineSegment(1);
            $ret.c = j.f;
            return $ret;
        })()));
        k._segments.add(((function () {
            var $ret = new ArcSegment();
            $ret.e = j.g;
            $ret.f = j.l;
            $ret.c = l;
            $ret.d = 1;
            $ret.b = false;
            return $ret;
        })()));
        k._segments.add(((function () {
            var $ret = new ArcSegment();
            $ret.e = j.h;
            $ret.f = j.n;
            $ret.d = 1;
            $ret.b = j.c;
            return $ret;
        })()));
        k._segments.add(((function () {
            var $ret = new ArcSegment();
            $ret.e = j.i;
            $ret.f = j.l;
            $ret.c = l;
            $ret.d = 1;
            $ret.b = false;
            return $ret;
        })()));
        k._segments.add(((function () {
            var $ret = new LineSegment(1);
            $ret.c = j.j;
            return $ret;
        })()));
        k._segments.add(((function () {
            var $ret = new ArcSegment();
            $ret.e = j.k;
            $ret.f = m;
            $ret.c = l;
            $ret.d = 1;
            $ret.b = false;
            return $ret;
        })()));
        k._segments.add(((function () {
            var $ret = new ArcSegment();
            $ret.e = j.d;
            $ret.f = j.m;
            $ret.d = 0;
            $ret.b = j.c;
            return $ret;
        })()));
        var n = new PathGeometry();
        n.c.add(k);
        return n;
    };
    RadialPieSeries.prototype.kp = function (a, b, c, d) {
        _super.prototype.kp.call(this, a, b, c, d);
        switch (b) {
            case RadialPieSeries.$$p[0]:
            case RadialPieSeries.$$p[1]:
                this.km();
                break;
        }
    };
    RadialPieSeries.$t = markType(RadialPieSeries, 'RadialPieSeries', AnchoredRadialSeries.$);
    RadialPieSeries.$$p = markDep(DependencyProperty, PropertyMetadata, RadialPieSeries, 'raisePropertyChanged', ['RadiusX:r7:sb', [1, 2], 'RadiusY:r8:sc', [1, 2]]);
    return RadialPieSeries;
}(AnchoredRadialSeries));
export { RadialPieSeries };
/**
 * @hidden
 */
var RadialPieSeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(RadialPieSeriesView, _super);
    function RadialPieSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.c0 = null;
        _this.c1 = null;
        _this.c2 = null;
        _this.c7 = new Path();
        _this.c0 = a;
        _this.c1 = ((function () {
            var $ret = new Pool$1(Path.$);
            $ret.create = runOn(_this, _this.c8);
            $ret.activate = runOn(_this, _this.c3);
            $ret.disactivate = runOn(_this, _this.c5);
            $ret.destroy = runOn(_this, _this.c4);
            return $ret;
        })());
        return _this;
    }
    RadialPieSeriesView.prototype.as = function () {
        _super.prototype.as.call(this);
        this.c2 = new List$1(Path.$, 0);
        if (!this.q) {
            this.e.fq = 4;
            this.e.bx = 1;
            this.e.fv = DeviceUtils.g(1);
        }
    };
    RadialPieSeriesView.prototype.c8 = function () {
        var _this = this;
        var a = ((function () {
            var $ret = new Path();
            $ret.dataContext = ((function () {
                var $ret = new DataContext();
                $ret.series = _this.e;
                return $ret;
            })());
            return $ret;
        })());
        this.c2.add(a);
        a._visibility = 1;
        return a;
    };
    RadialPieSeriesView.prototype.c3 = function (a) {
        a._visibility = 0;
    };
    RadialPieSeriesView.prototype.c5 = function (a) {
        a._visibility = 1;
    };
    RadialPieSeriesView.prototype.c4 = function (a) {
        this.c2.remove(a);
    };
    RadialPieSeriesView.prototype.be = function (a, b) {
        _super.prototype.be.call(this, a, b);
        var c = a;
    };
    RadialPieSeriesView.prototype.ac = function (a) {
        return this.c2._inner[a];
    };
    RadialPieSeriesView.prototype.ab = function (a) {
        var b = this.c2._inner[a];
        this.c7._visibility = b._visibility;
        this.c7.ak = b.ak;
        var c = this.bp(a);
        this.c7._fill = c;
        this.c7._stroke = c;
        this.c7.ac = this.e.eu;
        return this.c7;
    };
    RadialPieSeriesView.prototype.a6 = function (a, b) {
        _super.prototype.a6.call(this, a, b);
        if (a.d) {
            for (var c = 0; c < this.c2.count; c++) {
                var d = this.aa(c, b);
                a.s(d);
            }
        }
    };
    RadialPieSeriesView.prototype.c6 = function () {
        this.aq();
    };
    RadialPieSeriesView.prototype.al = function (a) {
        var e_1, _a;
        _super.prototype.al.call(this, a);
        var b = 0;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.c1.a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                this.e.a5.exportPathData(a, c, "slice" + b, ["Main", "Fill"]);
                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;
            }
        }
    };
    RadialPieSeriesView.$t = markType(RadialPieSeriesView, 'RadialPieSeriesView', AnchoredRadialSeriesView.$);
    return RadialPieSeriesView;
}(AnchoredRadialSeriesView));
export { RadialPieSeriesView };
//# sourceMappingURL=RadialPieSeries_combined.js.map
