/*
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 { 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
 */
export let RadialColumnSeries = /*@__PURE__*/ (() => {
    class RadialColumnSeries extends AnchoredRadialSeries {
        get_dk() {
            return true;
        }
        get_d5() {
            return true;
        }
        gz() {
            if (!isNaN_(this.gy)) {
                return super.gz();
            }
            return Defaults.h;
        }
        by() {
            return new RadialColumnSeriesView(this);
        }
        l4(a) {
            super.l4(a);
            this.uf = a;
        }
        constructor() {
            super();
            this.ab = RadialColumnSeries.$;
        }
        ac() {
            super.ac();
            this.mn(false);
        }
        l9(a, b, c, d) {
            super.l9(a, b, c, d);
            switch (b) {
                case RadialColumnSeries.$$p[0]:
                case RadialColumnSeries.$$p[1]:
                    this.l6();
                    break;
            }
        }
        preferredCategoryMode(a) {
            return a != null && a == this.rt ? 2 : 0;
        }
        k2(a, b) {
            super.k2(a, b);
            let c = b;
            if (a) {
                c.c1.count = 0;
            }
        }
        get_c3() {
            return true;
        }
        ge() {
            return this.rt.k4(this.b1.bv, this.b1.bu, this.getEffectiveViewport1(this.b1));
        }
        sy(a, b) {
            super.sy(a, b);
            let c = a.f;
            let d = b.bv;
            let e = b.bu;
            let f = this.getEffectiveViewport1(b);
            let g = this.pz(b);
            let h = this.r0.k1(e, d, f, g);
            let i = b;
            let j = this.r0;
            let k = Math.max(0, 0.5 * j.nn);
            k = Math.max(k, h.minLength * 0.9);
            let l = ViewportUtils.d(k, d, e);
            let m = this.rt.k4(d, e, f);
            let n = Math.max(0.1 * this.r0.no, k);
            let o = this.r1.d(0, n, d, e);
            let p = this.r1.e(0, n, d, e);
            let q = this.r1.d(m, n, d, e);
            let r = this.r1.e(m, n, d, e);
            let s = Math.sqrt((o - q) * (o - q) + (p - r) * (p - r));
            let t = { $type: Point_$type, x: ViewportUtils.c(0.5, d, e), y: ViewportUtils.f(0.5, d, e) };
            let u = this.tc.count;
            this.r7.a2(this, this.sj(), runOn(this, this.rq), this.sl(b), this.sm(b));
            this.r7.r = this.ug;
            this.r7.s = this.uh;
            this.r7.k = this.ug;
            this.r7.l = this.uh;
            let v = false;
            let w = this.r7.b;
            if (w != null) {
                v = true;
            }
            let x = this.rt;
            let y = new ScalerParams(1, b.bv, b.bu, x.ch);
            y.c = this.getEffectiveViewport();
            for (let z = 0; z < c.count; ++z) {
                let aa = Math.min(a.f._inner[z][2], h.maxLength * 1.1);
                let ab = this.r1.d(a.f._inner[z][0], aa, d, e);
                let ac = this.r1.e(a.f._inner[z][0], aa, d, e);
                let ad = Math.sqrt((ab - t.x) * (ab - t.x) + (ac - t.y) * (ac - t.y));
                let ae = ad;
                let af = l;
                if (v) {
                    this.tx(c, z, u, x, y, b.q);
                }
                let ag = this.r7.k;
                let ah = this.r7.l;
                let ai = a.f._inner[z][0] - (Math.PI / 2);
                let aj = i.c1.item(z);
                let ak = 0 - (s / 2);
                let al = (s / 2);
                let am = Math.max(af, ae);
                let an = Math.min(af, ae);
                let ao = Math.cos(ai);
                let ap = Math.sin(ai);
                let aq = { $type: Point_$type, x: t.x + (ak * ao - am * ap), y: t.y + (ak * ap + am * ao) };
                let ar = { $type: Point_$type, x: t.x + (al * ao - am * ap), y: t.y + (al * ap + am * ao) };
                let as = { $type: Point_$type, x: t.x + (al * ao - an * ap), y: t.y + (al * ap + an * ao) };
                let at = { $type: Point_$type, x: t.x + (ak * ao - an * ap), y: t.y + (ak * ap + an * ao) };
                let au = new PathGeometry();
                let av = new PathFigure();
                av._startPoint = aq;
                av._isClosed = true;
                let 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.r7.ad(aj, false, false, false, false);
            }
            i.c1.count = c.count;
            this.uf.c6();
        }
    }
    RadialColumnSeries.$t = /*@__PURE__*/ markType(RadialColumnSeries, 'RadialColumnSeries', AnchoredRadialSeries.$);
    RadialColumnSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, RadialColumnSeries, 'raisePropertyChanged', ['RadiusX:ug:uk', [1, 0], 'RadiusY:uh:ul', [1, 0]]);
    return RadialColumnSeries;
})();
/**
 * @hidden
 */
export let RadialColumnSeriesView = /*@__PURE__*/ (() => {
    class RadialColumnSeriesView extends AnchoredRadialSeriesView {
        constructor(a) {
            super(a);
            this.c0 = null;
            this.c1 = null;
            this.c2 = null;
            this.c8 = new Path();
            this.c0 = a;
            this.c1 = ((() => {
                let $ret = new Pool$1(Path.$);
                $ret.create = runOn(this, this.c9);
                $ret.activate = runOn(this, this.c3);
                $ret.disactivate = runOn(this, this.c5);
                $ret.destroy = runOn(this, this.c4);
                return $ret;
            })());
        }
        as() {
            super.as();
            this.c2 = new List$1(Path.$, 0);
            if (!this.q) {
                this.cr.ql = Defaults.c;
                this.cr.g4 = Defaults.i;
            }
        }
        c9() {
            let a = new Path();
            this.c2.add(a);
            a._visibility = 1;
            return a;
        }
        c3(a) {
            a._visibility = 0;
        }
        c5(a) {
            a._visibility = 1;
        }
        c4(a) {
            this.c2.remove(a);
        }
        c7(a, b, c, d, e, f) {
            this.aq();
        }
        be(a, b) {
            super.be(a, b);
            let c = a;
        }
        bf(a, b) {
            super.bf(a, b);
            let c = a;
        }
        ac(a) {
            return this.c2._inner[a];
        }
        ab(a) {
            let b = this.c2._inner[a];
            this.c8._visibility = b._visibility;
            this.c8.an = b.an;
            let c = this.bp(a);
            this.c8._fill = c;
            this.c8._stroke = c;
            this.c8.ad = this.e.fy + 3;
            return this.c8;
        }
        a6(a, b) {
            super.a6(a, b);
            if (a.d) {
                for (let c = 0; c < this.c2.count; c++) {
                    let d = this.aa(c, b);
                    this.bd(d, c, b);
                    a.t(d);
                }
            }
        }
        al(a) {
            super.al(a);
            let b = 0;
            for (let c of fromEnum(this.c1.a)) {
                this.e.a9.exportPathData(a, c, "column" + b, ["Main", "Fill"]);
                b++;
            }
        }
        c6() {
            this.aq();
        }
    }
    RadialColumnSeriesView.$t = /*@__PURE__*/ markType(RadialColumnSeriesView, 'RadialColumnSeriesView', AnchoredRadialSeriesView.$);
    return RadialColumnSeriesView;
})();
