/*
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 } 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 { 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 { 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.cn.eu;
            return {
                p0: a,
                p1: b,
                p2: c,
                p3: d
            };
        }
        e(a) {
            let b = this.a.bs;
            let c = this.a.br;
            let d = this.a.cn.nd;
            if (b.isEmpty || c.isEmpty || d == null || this.a.cn.bz == null || this.a.cn.bz.count == 0) {
                this.b = 0;
                return;
            }
            let e = Math.floor(d.ll(c, b));
            let f = Math.ceil(d.lk(c, b));
            if (d.ca) {
                f = Math.ceil(d.ll(c, b));
                e = Math.floor(d.lk(c, b));
            }
            if (f < e) {
                f = d.j7 + f;
            }
            let g = this.a.cn.nf;
            let h = g != null ? g.lr : 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.nl = null;
            this.nj = new RadialFrame(3);
            this.nk = new RadialFrame(3);
            this.ni = new RadialFrame(3);
            this.ng = null;
            this.nl = new SeriesRenderer$2(RadialFrame.$, RadialBaseView.$, 1, runOn(this, this.nw), runOn(this, this.nx), runOn(this, this.ca), runOn(this, this.jt), runOn(this, this.nv), (a) => this.nh.co.e(this.eu));
        }
        i2(a) {
            super.i2(a);
            this.nh = a;
        }
        nv() {
            if (this.bt.g) {
                this.bt.t();
            }
        }
        get categoryAxis() {
            return this.nd;
        }
        ap() {
            return this.nd;
        }
        np(a) {
            if (!this.hasMarkers) {
                return false;
            }
            let b = this.nd;
            let c = new ScalerParams(1, this.bs.n2, this.l8, b.ca);
            c.c = this.getEffectiveViewport1(this.bi);
            let d = this.nf;
            let e = new ScalerParams(1, this.bs.n2, this.l8, d.ca);
            e.c = this.getEffectiveViewport1(this.bi);
            a.clear();
            this.ma.cc((f) => {
                if (f._visibility == 0) {
                    let g = new SeriesPointOfInterest();
                    let h = f.n;
                    let i = f.o;
                    if (h < this.l8.left || h > this.l8.right || i < this.l8.top || i > this.l8.bottom) {
                        return;
                    }
                    g.b = b.d1(h, c);
                    g.c = d.d1(i, e);
                    g.d = b.fl(f.ak);
                    g.a = f.content;
                    a.add(g);
                }
            });
            return true;
        }
        get_c2() {
            return true;
        }
        ag() {
            return [this.nd, this.nf];
        }
        j1(a, b) {
            this.nh.co.e(this.eu);
            this.jl(false);
        }
        j0(a, b) {
            this.nh.co.e(this.eu);
            this.jl(false);
        }
        i7(a, b, c, d) {
            super.i7(a, b, c, d);
            switch (b) {
                case "SeriesViewer":
                    if (c != null && d == null) {
                        if (this.nd != null) {
                            this.nd.bx(this);
                        }
                        if (this.nf != null) {
                            this.nf.bx(this);
                        }
                    }
                    if (c == null && d != null) {
                        if (this.nd != null) {
                            this.nd.ck(this);
                        }
                        if (this.nf != null) {
                            this.nf.ck(this);
                        }
                    }
                    this.nh.co.e(this.eu);
                    this.jl(false);
                    break;
                case RadialBase.$$p[0]:
                    if (this.nd != null && this.nf != null) {
                        this.ng = new RadialAxes(this.nf, this.nd);
                    }
                    if (c != null) {
                        c.bx(this);
                    }
                    if (d != null) {
                        d.ck(this);
                    }
                    this.nh.co.e(this.eu);
                    this.jl(false);
                    break;
                case RadialBase.$$p[2]:
                    if (this.nd != null && this.nf != null) {
                        this.ng = new RadialAxes(this.nf, this.nd);
                    }
                    if (c != null) {
                        c.bx(this);
                    }
                    if (d != null) {
                        d.ck(this);
                    }
                    this.nh.co.e(this.eu);
                    if (this.nf == null || !this.nf.cn()) {
                        this.jl(false);
                    }
                    break;
                case "SyncLink":
                    if (this.bn != null && this.bs != null) {
                        this.nh.co.e(this.eu);
                        this.jl(false);
                    }
                    break;
                case "TransitionProgress":
                    this.nk.c(this.ez, this.nj, this.ni);
                    if (this.cc(this.bi)) {
                        return;
                    }
                    if (this.ez == 1) {
                        this.nx(this.ni, this.nh);
                    }
                    else {
                        this.nx(this.nk, this.nh);
                    }
                    if (this.bs != null) {
                        this.bs.ko(this);
                    }
                    break;
                case RadialBase.$$p[1]:
                    this.jl(false);
                    this.it();
                    break;
                case "VisibilityProxy":
                    if (EnumUtil.getEnumValue(Visibility_$type, c) != 0 && EnumUtil.getEnumValue(Visibility_$type, d) == 0) {
                        this.nh.co.e(this.eu);
                    }
                    break;
            }
        }
        nn(a) {
            if (typeCast(NumericRadiusAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        nm(a) {
            if (typeCast(CategoryAngleAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        fp(a) {
            let b = this.e8(a);
            return b >= 0 && this.bz != null && b < this.bz.count ? this.bz.item(b) : null;
        }
        nq(a) {
            let b = this.bi.bs;
            let c = this.bi.br;
            if (this.nd != null && !b.isEmpty && !c.isEmpty && this.ng != null) {
                let d = this.ng.c(a);
                if (d < 0) {
                    d += Math.PI * 2;
                }
                if (d > Math.PI * 2) {
                    d -= Math.PI * 2;
                }
                return d;
            }
            return NaN;
        }
        eb(a) {
            let b = this.bi.bs;
            let c = this.bi.br;
            let d = -1;
            if (this.nd != null && !b.isEmpty && !c.isEmpty && this.ng != null) {
                let e = this.ng.c(a);
                if (e < 0) {
                    e += Math.PI * 2;
                }
                if (e > Math.PI * 2) {
                    e -= Math.PI * 2;
                }
                let f = this.nd.getUnscaledAngle(e);
                if (this.nd.categoryMode != 0) {
                    f -= 0.5;
                }
                d = f;
            }
            return d;
        }
        e8(a) {
            let b = truncate(Math.round(this.eb(a)));
            if (this.bz != null && b == this.bz.count) {
                b = 0;
            }
            return b;
        }
        c9(a) {
            return false;
        }
        ik() {
            super.ik();
            if (this.nd != null) {
                this.nd.hb(false);
            }
            if (this.nf != null) {
                this.nf.hb(false);
            }
        }
        dw(a, b, c) {
            let d = true;
            let e = c;
            if (!super.dw(a, b, c) || !c.l() || b.isEmpty || a.isEmpty || this.nd == null || this.nd.itemsSource == null || this.nf == null || this.ng == null || this.bz == null || this.nd.bh == null || this.nf.bh == null || this.nf.kc == this.nf.kb) {
                e.co.b = 0;
                d = false;
            }
            return d;
        }
        jm(a) {
            let b;
            let c;
            let d = this.getViewInfo(c, b);
            c = d.p0;
            b = d.p1;
            if (!this.dw(c, b, this.bi)) {
                this.h3(true, this.bi);
                return;
            }
            let e = new SeriesRenderingArguments(this, c, b, a, this.de);
            let f = this.nl.g(e, this.nj, this.ni, this.nk, this.nh);
            this.nj = f.p1;
            this.ni = f.p2;
            this.nk = f.p3;
        }
        nr() {
            let a = 0;
            for (let b of fromEnum(this.bs.series)) {
                if (b == this) {
                    return a;
                }
                let c = typeCast(RadialBase.$, b);
                if (c != null && c.nd == this.nd && c.preferredCategoryMode(c.nd) == 2) {
                    a++;
                }
            }
            return -1;
        }
    }
    RadialBase.$t = /*@__PURE__*/ markType(RadialBase, 'RadialBase', MarkerSeries.$, [IHasCategoryModePreference_$type]);
    RadialBase.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, RadialBase, 'raisePropertyChanged', ['AngleAxis:nd:ny', [CategoryAngleAxis.$, null], 'ClipSeriesToBounds:no:nz', [0, false], 'ValueAxis:nf:n0', [NumericRadiusAxis.$, null]]);
    return RadialBase;
})();
/**
 * @hidden
 */
export let RadialBaseView = /*@__PURE__*/ (() => {
    class RadialBaseView extends MarkerSeriesView {
        constructor(a) {
            super(a);
            this.co = null;
            this.cn = null;
            this.cp = null;
            this.cq = 0;
            this.cr = null;
            this.cn = a;
            this.cp = new Pool$1(Marker.$);
            this.cf(this.cp);
        }
        cc(a) {
            this.cp.c(a);
        }
    }
    RadialBaseView.$t = /*@__PURE__*/ markType(RadialBaseView, 'RadialBaseView', MarkerSeriesView.$);
    return RadialBaseView;
})();
//# sourceMappingURL=RadialBucketCalculator_combined.js.map
