/*
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, __values } from "tslib";
import { AnchoredRadialSeries } from "./AnchoredRadialSeries";
import { DependencyProperty } from "igniteui-react-core";
import { Defaults } from "./Defaults";
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 { PathFigure } from "igniteui-react-core";
import { PolyLineSegment } from "igniteui-react-core";
import { ViewportUtils } from "./ViewportUtils";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_ } from "igniteui-react-core";
import { AnchoredRadialSeriesView } from "./AnchoredRadialSeriesView";
/**
 * @hidden
 */
var RadialColumnSeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(RadialColumnSeries, _super);
    function RadialColumnSeries() {
        var _this = _super.call(this) || this;
        _this.ab = RadialColumnSeries.$;
        return _this;
    }
    RadialColumnSeries.prototype.bc = function () {
        return new RadialColumnSeries();
    };
    RadialColumnSeries.prototype.get_ee = function () {
        return true;
    };
    RadialColumnSeries.prototype.get_ez = function () {
        return true;
    };
    RadialColumnSeries.prototype.iq = function () {
        if (!isNaN_(this.ip)) {
            return _super.prototype.iq.call(this);
        }
        return Defaults.h;
    };
    RadialColumnSeries.prototype.cd = function () {
        return new RadialColumnSeriesView(this);
    };
    RadialColumnSeries.prototype.o2 = function (a) {
        _super.prototype.o2.call(this, a);
        this.yb = a;
    };
    RadialColumnSeries.prototype.ac = function () {
        _super.prototype.ac.call(this);
        this.pr(false);
    };
    RadialColumnSeries.prototype.pa = function (a, b, c, d) {
        _super.prototype.pa.call(this, a, b, c, d);
        switch (b) {
            case RadialColumnSeries.$$p[0]:
            case RadialColumnSeries.$$p[1]:
                this.o4();
                break;
        }
    };
    RadialColumnSeries.prototype.preferredCategoryMode = function (a) {
        return a != null && a == this.vk ? 2 : 0;
    };
    RadialColumnSeries.prototype.nk = function (a, b) {
        _super.prototype.nk.call(this, a, b);
        var c = b;
        if (a) {
            c.c4.count = 0;
        }
    };
    RadialColumnSeries.prototype.get_dv = function () {
        return true;
    };
    RadialColumnSeries.prototype.h1 = function () {
        return this.vk.k4(this.cg.by, this.cg.bx, this.getEffectiveViewport1(this.cg));
    };
    RadialColumnSeries.prototype.wq = function (a, b) {
        _super.prototype.wq.call(this, a, b);
        var c = a.f;
        var d = b.by;
        var e = b.bx;
        var f = this.getEffectiveViewport1(b);
        var g = this.tq(b);
        var h = this.vm.k1(e, d, f, g);
        var i = b;
        var j = this.vm;
        var k = Math.max(0, 0.5 * j.nn);
        k = Math.max(k, h.minLength * 0.9);
        var l = ViewportUtils.d(k, d, e);
        var m = this.vk.k4(d, e, f);
        var n = Math.max(0.1 * this.vm.no, k);
        var o = this.vn.d(0, n, d, e);
        var p = this.vn.e(0, n, d, e);
        var q = this.vn.d(m, n, d, e);
        var r = this.vn.e(m, n, d, e);
        var s = Math.sqrt((o - q) * (o - q) + (p - r) * (p - r));
        var t = { $type: Point_$type, x: ViewportUtils.c(0.5, d, e), y: ViewportUtils.f(0.5, d, e) };
        var u = this.w4.count;
        this.vt.a2(this, this.wa(), runOn(this, this.vh), this.wd(b), this.we(b));
        this.vt.r = this.yc;
        this.vt.s = this.yd;
        this.vt.k = this.yc;
        this.vt.l = this.yd;
        var v = false;
        var w = this.vt.b;
        if (w != null) {
            v = true;
        }
        var x = this.vk;
        var y = new ScalerParams(1, b.by, b.bx, x.ch);
        y.c = this.getEffectiveViewport();
        for (var z = 0; z < c.count; ++z) {
            var aa = Math.min(a.f._inner[z][2], h.maxLength * 1.1);
            var ab = this.vn.d(a.f._inner[z][0], aa, d, e);
            var ac = this.vn.e(a.f._inner[z][0], aa, d, e);
            var ad = Math.sqrt((ab - t.x) * (ab - t.x) + (ac - t.y) * (ac - t.y));
            var ae = ad;
            var af = l;
            if (v) {
                this.xs(c, z, u, x, y, b.q);
            }
            var ag = this.vt.k;
            var ah = this.vt.l;
            var ai = a.f._inner[z][0] - (Math.PI / 2);
            var aj = i.c4.item(z);
            var ak = 0 - (s / 2);
            var al = (s / 2);
            var am = Math.max(af, ae);
            var an = Math.min(af, ae);
            var ao = Math.cos(ai);
            var ap = Math.sin(ai);
            var aq = { $type: Point_$type, x: t.x + (ak * ao - am * ap), y: t.y + (ak * ap + am * ao) };
            var ar = { $type: Point_$type, x: t.x + (al * ao - am * ap), y: t.y + (al * ap + am * ao) };
            var as = { $type: Point_$type, x: t.x + (al * ao - an * ap), y: t.y + (al * ap + an * ao) };
            var at = { $type: Point_$type, x: t.x + (ak * ao - an * ap), y: t.y + (ak * ap + an * ao) };
            var au = new PathGeometry();
            var av = new PathFigure();
            av._startPoint = aq;
            av._isClosed = true;
            var aw = new PolyLineSegment();
            aw._points.add(ar);
            aw._points.add(as);
            aw._points.add(at);
            av._segments.add(aw);
            au.c.add(av);
            aj.an = au;
            this.vt.ad(aj, false, false, false, false);
        }
        i.c4.count = c.count;
        this.yb.c9();
    };
    RadialColumnSeries.$t = markType(RadialColumnSeries, 'RadialColumnSeries', AnchoredRadialSeries.$);
    RadialColumnSeries.$$p = markDep(DependencyProperty, PropertyMetadata, RadialColumnSeries, 'raisePropertyChanged', ['RadiusX:yc:yg', [1, 0], 'RadiusY:yd:yh', [1, 0]]);
    return RadialColumnSeries;
}(AnchoredRadialSeries));
export { RadialColumnSeries };
/**
 * @hidden
 */
var RadialColumnSeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(RadialColumnSeriesView, _super);
    function RadialColumnSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.c3 = null;
        _this.c4 = null;
        _this.c5 = null;
        _this.db = new Path();
        _this.c3 = a;
        _this.c4 = ((function () {
            var $ret = new Pool$1(Path.$);
            $ret.create = runOn(_this, _this.dc);
            $ret.activate = runOn(_this, _this.c6);
            $ret.disactivate = runOn(_this, _this.c8);
            $ret.destroy = runOn(_this, _this.c7);
            return $ret;
        })());
        return _this;
    }
    RadialColumnSeriesView.prototype.au = function () {
        _super.prototype.au.call(this);
        this.c5 = new List$1(Path.$, 0);
        if (!this.q) {
            this.cu.uc = Defaults.c;
            this.cu.iv = Defaults.i;
        }
    };
    RadialColumnSeriesView.prototype.dc = function () {
        var a = new Path();
        this.c5.add(a);
        a._visibility = 1;
        return a;
    };
    RadialColumnSeriesView.prototype.c6 = function (a) {
        a._visibility = 0;
    };
    RadialColumnSeriesView.prototype.c8 = function (a) {
        a._visibility = 1;
    };
    RadialColumnSeriesView.prototype.c7 = function (a) {
        this.c5.remove(a);
    };
    RadialColumnSeriesView.prototype.da = function (a, b, c, d, e, f) {
        this.as();
    };
    RadialColumnSeriesView.prototype.bg = function (a, b) {
        _super.prototype.bg.call(this, a, b);
        var c = a;
    };
    RadialColumnSeriesView.prototype.bh = function (a, b) {
        _super.prototype.bh.call(this, a, b);
        var c = a;
    };
    RadialColumnSeriesView.prototype.ac = function (a) {
        return this.c5._inner[a];
    };
    RadialColumnSeriesView.prototype.ab = function (a) {
        var b = this.c5._inner[a];
        this.db._visibility = b._visibility;
        this.db.an = b.an;
        var c = this.bs(a);
        this.db._fill = c;
        this.db._stroke = c;
        this.db.ad = this.e.hl + 3;
        return this.db;
    };
    RadialColumnSeriesView.prototype.a8 = function (a, b) {
        _super.prototype.a8.call(this, a, b);
        if (a.d) {
            for (var c = 0; c < this.c5.count; c++) {
                var d = this.aa(c, b);
                this.bf(d, c, b);
                a.t(d);
            }
        }
    };
    RadialColumnSeriesView.prototype.an = function (a) {
        var e_1, _a;
        _super.prototype.an.call(this, a);
        var b = 0;
        try {
            for (var _b = __values(fromEnum(this.c4.a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                this.e.a5.exportPathData(a, c, "column" + 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;
            }
        }
    };
    RadialColumnSeriesView.prototype.c9 = function () {
        this.as();
    };
    RadialColumnSeriesView.$t = markType(RadialColumnSeriesView, 'RadialColumnSeriesView', AnchoredRadialSeriesView.$);
    return RadialColumnSeriesView;
}(AnchoredRadialSeriesView));
export { RadialColumnSeriesView };
