/*
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 { Base, markType, runOn, EnumUtil, typeCast, fromEnum, markDep } from "igniteui-react-core";
import { IBucketizer_$type } from "./IBucketizer";
import { NotImplementedException } from "igniteui-react-core";
import { CategoryAngleAxis } from "./CategoryAngleAxis";
import { NumericRadiusAxis } from "./NumericRadiusAxis";
import { truncate, intDivide } from "igniteui-react-core";
import { MarkerSeries } from "./MarkerSeries";
import { IHasCategoryModePreference_$type } from "./IHasCategoryModePreference";
import { SeriesRenderer$2 } from "./SeriesRenderer$2";
import { RadialFrame } from "./RadialFrame";
import { DependencyProperty } from "igniteui-react-core";
import { HighlightingInfo } from "./HighlightingInfo";
import { RadialSeriesRenderManager } from "./RadialSeriesRenderManager";
import { SeriesPointOfInterest } from "./SeriesPointOfInterest";
import { ScalerParams } from "./ScalerParams";
import { Marker } from "./Marker";
import { MarkerSeriesView } from "./MarkerSeriesView";
import { RadialAxes } from "./RadialAxes";
import { Visibility_$type } from "igniteui-react-core";
import { SeriesRenderingArguments } from "./SeriesRenderingArguments";
import { PropertyMetadata } from "igniteui-react-core";
import { round10N } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
/**
 * @hidden
 */
export let RadialBucketCalculator = /*@__PURE__*/ (() => {
    class RadialBucketCalculator extends Base {
        constructor(a) {
            super();
            this.a = null;
            this.c = 0;
            this.d = 0;
            this.b = 0;
            this.a = a;
        }
        getBucket(a) {
            throw new NotImplementedException(0);
        }
        getBucketWithoutUnknowns(a) {
            return this.getBucket(a);
        }
        getErrorBucket(a, b) {
            return NaN;
        }
        getBucketInfo(a, b, c, d) {
            a = this.c;
            b = this.d;
            c = this.b;
            d = this.a.cr.fq;
            return {
                p0: a,
                p1: b,
                p2: c,
                p3: d
            };
        }
        e(a) {
            let b = this.a.bv;
            let c = this.a.bu;
            let d = this.a.cr.pr;
            if (b.isEmpty || c.isEmpty || d == null || this.a.cr.cd == null || this.a.cr.cd.count == 0) {
                this.b = 0;
                return;
            }
            let e = Math.floor(d.lm(c, b));
            let f = Math.ceil(d.ll(c, b));
            if (d.ca) {
                f = Math.ceil(d.lm(c, b));
                e = Math.floor(d.ll(c, b));
            }
            if (f < e) {
                f = d.j8 + f;
            }
            let g = this.a.cr.py;
            let h = g != null ? g.ls : 0.75;
            let i = Math.min(c.width, c.height) * 0.5 * (h) * 2 * Math.PI;
            let j = Math.floor((f - e + 1) * a / i);
            this.b = truncate(Math.max(1, j));
            this.c = truncate(Math.max(0, Math.floor(e / this.b) - 1));
            this.d = truncate(Math.ceil(f / this.b));
        }
        cacheValues() {
        }
        unCacheValues() {
        }
    }
    RadialBucketCalculator.$t = /*@__PURE__*/ markType(RadialBucketCalculator, 'RadialBucketCalculator', Base.$, [IBucketizer_$type]);
    return RadialBucketCalculator;
})();
/**
 * @hidden
 */
export let RadialBase = /*@__PURE__*/ (() => {
    class RadialBase extends MarkerSeries {
        constructor() {
            super();
            this.p4 = null;
            this.p5 = null;
            this.p7 = false;
            this.p6 = false;
            this.pw = null;
            this.px = null;
            this.assigningRadialStyle = null;
            this.assigningRadialMarkerStyle = null;
            this.p2 = new RadialFrame(3);
            this.p3 = new RadialFrame(3);
            this.p1 = new RadialFrame(3);
            this.pz = null;
            this.p4 = new RadialSeriesRenderManager();
            this.p5 = new SeriesRenderer$2(RadialFrame.$, RadialBaseView.$, 1, runOn(this, this.qs), runOn(this, this.qv), runOn(this, this.cn), runOn(this, this.lb), runOn(this, this.qr), (a) => this.p0.cs.e(this.fq));
        }
        kk(a) {
            super.kk(a);
            this.p0 = a;
        }
        qr() {
            if (this.b7.g) {
                this.b7.t();
            }
        }
        get categoryAxis() {
            return this.pr;
        }
        aq() {
            return this.pr;
        }
        po(a, b) {
            return null;
        }
        ct(a, b, c) {
            if (!this.hasMarkers) {
                return false;
            }
            let d = this.pr;
            let e = new ScalerParams(1, this.b6.os, this.n6, d.ca);
            e.c = this.getEffectiveViewport1(this.bs);
            let f = this.py;
            let g = new ScalerParams(1, this.b6.os, this.n6, f.ca);
            g.c = this.getEffectiveViewport1(this.bs);
            a.clear();
            this.oh.cf((h) => {
                if (h._visibility == 0) {
                    let i = new SeriesPointOfInterest();
                    let j = h.n;
                    let k = h.o;
                    if (j < this.n6.left || j > this.n6.right || k < this.n6.top || k > this.n6.bottom) {
                        return;
                    }
                    let l;
                    let m;
                    let n = this.pz.g(j, k, this.bs.bv, this.bs.bu, l, m);
                    l = n.p4;
                    m = n.p5;
                    i.b = l;
                    i.c = m;
                    if (b) {
                        i.d = this.qm(i.c, c);
                    }
                    else {
                        i.d = d.fm(h.ak);
                    }
                    i.a = h.content;
                    a.add(i);
                }
            });
            return true;
        }
        qm(a, b) {
            if (b >= 0) {
                return round10N(a, b).toString();
            }
            else {
                return a.toString();
            }
        }
        get_dh() {
            return true;
        }
        get_da() {
            return true;
        }
        pt(a, b, c) {
            let d = new HighlightingInfo();
            d.b = this;
            d.h = 0;
            d.g = this.cd.count - 1;
            d.d = true;
            if (c != null && c.h == d.h && c.g == d.g) {
                return c;
            }
            return d;
        }
        pu(a, b, c) {
            let d = this.p0.cs.c;
            let e = this.p0.cs.d;
            let f = this.p0.cs.b;
            let g = this.p1;
            if (this.cn()) {
                g = this.p3;
            }
            let h = this.cd.count;
            let i = this.pr;
            let j = -1;
            let k = -1;
            let l = this.f9(b);
            j = truncate(Math.floor((intDivide(l, f)))) * f;
            k = j + (f - 1);
            if (c != null && c.h == j && c.g == k) {
                return c;
            }
            let m = new HighlightingInfo();
            m.b = this;
            m.h = j;
            m.g = k;
            return m;
        }
        pv(a, b, c) {
            let d = this.p0.cs.c;
            let e = this.p0.cs.d;
            let f = this.p0.cs.b;
            let g = this.p1;
            if (this.cn()) {
                g = this.p3;
            }
            let h = this.cd.count;
            let i = this.pr;
            let j = -1;
            let k = -1;
            let l = this.f9(b);
            j = truncate(Math.floor((intDivide(l, f)))) * f;
            k = j + (f - 1);
            if (c != null && c.h == j && c.g == k) {
                return c;
            }
            let m = new HighlightingInfo();
            m.e = true;
            m.b = this;
            m.h = j;
            m.g = k;
            return m;
        }
        au(a, b, c) {
            if (this.cu && this.dl(this.be) && !c) {
                let d = this.pu(a, b, this.pw);
                this.pw = d;
                return d;
            }
            else {
                let e = this.pt(a, b, this.pw);
                this.pw = e;
                return e;
            }
        }
        av(a, b, c) {
            if (this.dl(this.be) && !c) {
                let d = this.pv(a, b, this.px);
                this.px = d;
                return d;
            }
            else {
                let e = this.pt(a, b, this.px);
                e.e = true;
                this.px = e;
                return e;
            }
        }
        qg() {
            return (this.assigningRadialStyle != null && this.p7) || (this.be != 1);
        }
        qf() {
            return (this.assigningRadialMarkerStyle != null && this.p6) || (this.be != 1);
        }
        qu(a) {
            if (this.assigningRadialStyle != null && this.p7) {
                this.assigningRadialStyle(this, a);
            }
        }
        qt(a) {
            if (this.assigningRadialMarkerStyle != null && this.p6) {
                this.assigningRadialMarkerStyle(this, a);
            }
        }
        qi(a) {
            return a.cs.b;
        }
        qj(a) {
            return a.cs.c;
        }
        ag() {
            return [this.pr, this.py];
        }
        lo(a, b) {
            this.p0.cs.e(this.fq);
            this.k3(false);
        }
        ln(a, b) {
            this.p0.cs.e(this.fq);
            this.k3(false);
        }
        kp(a, b, c, d) {
            super.kp(a, b, c, d);
            switch (b) {
                case "SeriesViewer":
                    if (c != null && d == null) {
                        if (this.pr != null) {
                            this.pr.bx(this);
                        }
                        if (this.py != null) {
                            this.py.bx(this);
                        }
                    }
                    if (c == null && d != null) {
                        if (this.pr != null) {
                            this.pr.ck(this);
                        }
                        if (this.py != null) {
                            this.py.ck(this);
                        }
                    }
                    this.p0.cs.e(this.fq);
                    this.k3(false);
                    break;
                case RadialBase.$$p[0]:
                    if (this.pr != null && this.py != null) {
                        this.pz = new RadialAxes(this.py, this.pr);
                    }
                    if (c != null) {
                        c.bx(this);
                    }
                    if (d != null) {
                        d.ck(this);
                    }
                    this.p0.cs.e(this.fq);
                    this.k3(false);
                    break;
                case RadialBase.$$p[4]:
                    if (this.pr != null && this.py != null) {
                        this.pz = new RadialAxes(this.py, this.pr);
                    }
                    if (c != null) {
                        c.bx(this);
                    }
                    if (d != null) {
                        d.ck(this);
                    }
                    this.p0.cs.e(this.fq);
                    if (this.py == null || !this.py.cn()) {
                        this.k3(false);
                    }
                    break;
                case "SyncLink":
                    if (this.b1 != null && this.b6 != null) {
                        this.p0.cs.e(this.fq);
                        this.k3(false);
                    }
                    break;
                case "TransitionProgress":
                    this.p3.c(this.fw, this.p2, this.p1);
                    if (this.cp(this.bs)) {
                        return;
                    }
                    if (this.fw == 1) {
                        this.qv(this.p1, this.p0);
                    }
                    else {
                        this.qv(this.p3, this.p0);
                    }
                    if (this.b6 != null) {
                        this.b6.k7(this);
                    }
                    break;
                case RadialBase.$$p[1]:
                    this.k3(false);
                    this.ka();
                    break;
                case "VisibilityProxy":
                    if (EnumUtil.getEnumValue(Visibility_$type, c) != 0 && EnumUtil.getEnumValue(Visibility_$type, d) == 0) {
                        this.p0.cs.e(this.fq);
                    }
                    break;
                case RadialBase.$$p[3]:
                    this.p7 = this.qe();
                    this.k3(false);
                    break;
                case RadialBase.$$p[2]:
                    this.p6 = this.qd();
                    this.k3(false);
                    break;
            }
        }
        qe() {
            return this.qc;
        }
        qd() {
            return this.qb;
        }
        p9(a) {
            if (typeCast(NumericRadiusAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        p8(a) {
            if (typeCast(CategoryAngleAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        gq(a) {
            let b = this.f9(a);
            return b >= 0 && this.cd != null && b < this.cd.count ? this.cd.item(b) : null;
        }
        qh(a) {
            let b = this.bs.bv;
            let c = this.bs.bu;
            if (this.pr != null && !b.isEmpty && !c.isEmpty && this.pz != null) {
                let d = this.pz.c(a);
                if (d < 0) {
                    d += Math.PI * 2;
                }
                if (d > Math.PI * 2) {
                    d -= Math.PI * 2;
                }
                return d;
            }
            return NaN;
        }
        e4(a) {
            let b = this.bs.bv;
            let c = this.bs.bu;
            let d = -1;
            if (this.pr != null && !b.isEmpty && !c.isEmpty && this.pz != null) {
                let e = this.pz.c(a);
                if (e < 0) {
                    e += Math.PI * 2;
                }
                if (e > Math.PI * 2) {
                    e -= Math.PI * 2;
                }
                let f = this.pr.getUnscaledAngle(e);
                if (this.pr.categoryMode != 0) {
                    f -= 0.5;
                }
                d = f;
            }
            return d;
        }
        f9(a) {
            let b = truncate(Math.round(this.e4(a)));
            if (this.cd != null && b == this.cd.count) {
                b = 0;
            }
            return b;
        }
        dq(a) {
            return false;
        }
        j2() {
            super.j2();
            if (this.pr != null) {
                this.pr.hc(false);
            }
            if (this.py != null) {
                this.py.hc(false);
            }
        }
        ec(a, b, c) {
            let d = true;
            let e = c;
            if (!super.ec(a, b, c) || !c.o() || b.isEmpty || a.isEmpty || this.pr == null || this.pr.itemsSource == null || this.py == null || this.pz == null || this.cd == null || this.pr.bh == null || this.py.bh == null || this.py.kd == this.py.kc) {
                e.cs.b = 0;
                d = false;
            }
            return d;
        }
        k4(a) {
            let b;
            let c;
            let d = this.getViewInfo(c, b);
            c = d.p0;
            b = d.p1;
            if (!this.ec(c, b, this.bs)) {
                this.jl(true, this.bs);
                return;
            }
            let e = new SeriesRenderingArguments(this, c, b, a, this.dv);
            let f = this.p5.g(e, this.p2, this.p1, this.p3, this.p0);
            this.p2 = f.p1;
            this.p1 = f.p2;
            this.p3 = f.p3;
        }
        qk() {
            let a = 0;
            for (let b of fromEnum(this.b6.series)) {
                if (b == this) {
                    return a;
                }
                let c = typeCast(RadialBase.$, b);
                if (c != null && c.pr == this.pr && c.preferredCategoryMode(c.pr) == 2) {
                    a++;
                }
            }
            return -1;
        }
    }
    RadialBase.$t = /*@__PURE__*/ markType(RadialBase, 'RadialBase', MarkerSeries.$, [IHasCategoryModePreference_$type]);
    RadialBase.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, RadialBase, 'raisePropertyChanged', ['AngleAxis:pr:qw', [CategoryAngleAxis.$, null], 'ClipSeriesToBounds:qa:qx', [0, false], 'IsCustomRadialMarkerStyleAllowed:qb:qy', [0, false], 'IsCustomRadialStyleAllowed:qc:qz', [0, false], 'ValueAxis:py:q0', [NumericRadiusAxis.$, null]]);
    return RadialBase;
})();
/**
 * @hidden
 */
export let RadialBaseView = /*@__PURE__*/ (() => {
    class RadialBaseView extends MarkerSeriesView {
        constructor(a) {
            super(a);
            this.cs = null;
            this.cr = null;
            this.ct = null;
            this.cu = 0;
            this.cv = null;
            this.cr = a;
            this.ct = new Pool$1(Marker.$);
            this.ci(this.ct);
        }
        cf(a) {
            this.ct.c(a);
        }
    }
    RadialBaseView.$t = /*@__PURE__*/ markType(RadialBaseView, 'RadialBaseView', MarkerSeriesView.$);
    return RadialBaseView;
})();
//# sourceMappingURL=RadialBucketCalculator_combined.js.map
