/*
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 { 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
 */
var RadialBucketCalculator = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(RadialBucketCalculator, _super);
    function RadialBucketCalculator(a) {
        var _this = _super.call(this) || this;
        _this.a = null;
        _this.c = 0;
        _this.d = 0;
        _this.b = 0;
        _this.a = a;
        return _this;
    }
    RadialBucketCalculator.prototype.getBucket = function (a) {
        throw new NotImplementedException(0);
    };
    RadialBucketCalculator.prototype.getBucketWithoutUnknowns = function (a) {
        return this.getBucket(a);
    };
    RadialBucketCalculator.prototype.getErrorBucket = function (a, b) {
        return NaN;
    };
    RadialBucketCalculator.prototype.getBucketInfo = function (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
        };
    };
    RadialBucketCalculator.prototype.e = function (a) {
        var b = this.a.bv;
        var c = this.a.bu;
        var 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;
        }
        var e = Math.floor(d.lm(c, b));
        var 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;
        }
        var g = this.a.cr.py;
        var h = g != null ? g.ls : 0.75;
        var i = Math.min(c.width, c.height) * 0.5 * (h) * 2 * Math.PI;
        var 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));
    };
    RadialBucketCalculator.prototype.cacheValues = function () {
    };
    RadialBucketCalculator.prototype.unCacheValues = function () {
    };
    RadialBucketCalculator.$t = markType(RadialBucketCalculator, 'RadialBucketCalculator', Base.$, [IBucketizer_$type]);
    return RadialBucketCalculator;
}(Base));
export { RadialBucketCalculator };
/**
 * @hidden
 */
var RadialBase = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(RadialBase, _super);
    function RadialBase() {
        var _this = _super.call(this) || this;
        _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), function (a) { return _this.p0.cs.e(_this.fq); });
        return _this;
    }
    RadialBase.prototype.kk = function (a) {
        _super.prototype.kk.call(this, a);
        this.p0 = a;
    };
    RadialBase.prototype.qr = function () {
        if (this.b7.g) {
            this.b7.t();
        }
    };
    Object.defineProperty(RadialBase.prototype, "categoryAxis", {
        get: function () {
            return this.pr;
        },
        enumerable: true,
        configurable: true
    });
    RadialBase.prototype.aq = function () {
        return this.pr;
    };
    RadialBase.prototype.po = function (a, b) {
        return null;
    };
    RadialBase.prototype.ct = function (a, b, c) {
        var _this = this;
        if (!this.hasMarkers) {
            return false;
        }
        var d = this.pr;
        var e = new ScalerParams(1, this.b6.os, this.n6, d.ca);
        e.c = this.getEffectiveViewport1(this.bs);
        var f = this.py;
        var g = new ScalerParams(1, this.b6.os, this.n6, f.ca);
        g.c = this.getEffectiveViewport1(this.bs);
        a.clear();
        this.oh.cf(function (h) {
            if (h._visibility == 0) {
                var i = new SeriesPointOfInterest();
                var j = h.n;
                var k = h.o;
                if (j < _this.n6.left || j > _this.n6.right || k < _this.n6.top || k > _this.n6.bottom) {
                    return;
                }
                var l = void 0;
                var m = void 0;
                var 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;
    };
    RadialBase.prototype.qm = function (a, b) {
        if (b >= 0) {
            return round10N(a, b).toString();
        }
        else {
            return a.toString();
        }
    };
    RadialBase.prototype.get_dh = function () {
        return true;
    };
    RadialBase.prototype.get_da = function () {
        return true;
    };
    RadialBase.prototype.pt = function (a, b, c) {
        var 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;
    };
    RadialBase.prototype.pu = function (a, b, c) {
        var d = this.p0.cs.c;
        var e = this.p0.cs.d;
        var f = this.p0.cs.b;
        var g = this.p1;
        if (this.cn()) {
            g = this.p3;
        }
        var h = this.cd.count;
        var i = this.pr;
        var j = -1;
        var k = -1;
        var 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;
        }
        var m = new HighlightingInfo();
        m.b = this;
        m.h = j;
        m.g = k;
        return m;
    };
    RadialBase.prototype.pv = function (a, b, c) {
        var d = this.p0.cs.c;
        var e = this.p0.cs.d;
        var f = this.p0.cs.b;
        var g = this.p1;
        if (this.cn()) {
            g = this.p3;
        }
        var h = this.cd.count;
        var i = this.pr;
        var j = -1;
        var k = -1;
        var 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;
        }
        var m = new HighlightingInfo();
        m.e = true;
        m.b = this;
        m.h = j;
        m.g = k;
        return m;
    };
    RadialBase.prototype.au = function (a, b, c) {
        if (this.cu && this.dl(this.be) && !c) {
            var d = this.pu(a, b, this.pw);
            this.pw = d;
            return d;
        }
        else {
            var e = this.pt(a, b, this.pw);
            this.pw = e;
            return e;
        }
    };
    RadialBase.prototype.av = function (a, b, c) {
        if (this.dl(this.be) && !c) {
            var d = this.pv(a, b, this.px);
            this.px = d;
            return d;
        }
        else {
            var e = this.pt(a, b, this.px);
            e.e = true;
            this.px = e;
            return e;
        }
    };
    RadialBase.prototype.qg = function () {
        return (this.assigningRadialStyle != null && this.p7) || (this.be != 1);
    };
    RadialBase.prototype.qf = function () {
        return (this.assigningRadialMarkerStyle != null && this.p6) || (this.be != 1);
    };
    RadialBase.prototype.qu = function (a) {
        if (this.assigningRadialStyle != null && this.p7) {
            this.assigningRadialStyle(this, a);
        }
    };
    RadialBase.prototype.qt = function (a) {
        if (this.assigningRadialMarkerStyle != null && this.p6) {
            this.assigningRadialMarkerStyle(this, a);
        }
    };
    RadialBase.prototype.qi = function (a) {
        return a.cs.b;
    };
    RadialBase.prototype.qj = function (a) {
        return a.cs.c;
    };
    RadialBase.prototype.ag = function () {
        return [this.pr, this.py];
    };
    RadialBase.prototype.lo = function (a, b) {
        this.p0.cs.e(this.fq);
        this.k3(false);
    };
    RadialBase.prototype.ln = function (a, b) {
        this.p0.cs.e(this.fq);
        this.k3(false);
    };
    RadialBase.prototype.kp = function (a, b, c, d) {
        _super.prototype.kp.call(this, 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;
        }
    };
    RadialBase.prototype.qe = function () {
        return this.qc;
    };
    RadialBase.prototype.qd = function () {
        return this.qb;
    };
    RadialBase.prototype.p9 = function (a) {
        if (typeCast(NumericRadiusAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    RadialBase.prototype.p8 = function (a) {
        if (typeCast(CategoryAngleAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    RadialBase.prototype.gq = function (a) {
        var b = this.f9(a);
        return b >= 0 && this.cd != null && b < this.cd.count ? this.cd.item(b) : null;
    };
    RadialBase.prototype.qh = function (a) {
        var b = this.bs.bv;
        var c = this.bs.bu;
        if (this.pr != null && !b.isEmpty && !c.isEmpty && this.pz != null) {
            var 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;
    };
    RadialBase.prototype.e4 = function (a) {
        var b = this.bs.bv;
        var c = this.bs.bu;
        var d = -1;
        if (this.pr != null && !b.isEmpty && !c.isEmpty && this.pz != null) {
            var e = this.pz.c(a);
            if (e < 0) {
                e += Math.PI * 2;
            }
            if (e > Math.PI * 2) {
                e -= Math.PI * 2;
            }
            var f = this.pr.getUnscaledAngle(e);
            if (this.pr.categoryMode != 0) {
                f -= 0.5;
            }
            d = f;
        }
        return d;
    };
    RadialBase.prototype.f9 = function (a) {
        var b = truncate(Math.round(this.e4(a)));
        if (this.cd != null && b == this.cd.count) {
            b = 0;
        }
        return b;
    };
    RadialBase.prototype.dq = function (a) {
        return false;
    };
    RadialBase.prototype.j2 = function () {
        _super.prototype.j2.call(this);
        if (this.pr != null) {
            this.pr.hc(false);
        }
        if (this.py != null) {
            this.py.hc(false);
        }
    };
    RadialBase.prototype.ec = function (a, b, c) {
        var d = true;
        var e = c;
        if (!_super.prototype.ec.call(this, 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;
    };
    RadialBase.prototype.k4 = function (a) {
        var b;
        var c;
        var d = this.getViewInfo(c, b);
        c = d.p0;
        b = d.p1;
        if (!this.ec(c, b, this.bs)) {
            this.jl(true, this.bs);
            return;
        }
        var e = new SeriesRenderingArguments(this, c, b, a, this.dv);
        var 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;
    };
    RadialBase.prototype.qk = function () {
        var e_1, _a;
        var a = 0;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.b6.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                if (b == this) {
                    return a;
                }
                var c = typeCast(RadialBase.$, b);
                if (c != null && c.pr == this.pr && c.preferredCategoryMode(c.pr) == 2) {
                    a++;
                }
            }
        }
        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;
            }
        }
        return -1;
    };
    RadialBase.$t = markType(RadialBase, 'RadialBase', MarkerSeries.$, [IHasCategoryModePreference_$type]);
    RadialBase.$$p = 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;
}(MarkerSeries));
export { RadialBase };
/**
 * @hidden
 */
var RadialBaseView = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(RadialBaseView, _super);
    function RadialBaseView(a) {
        var _this = _super.call(this, a) || this;
        _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);
        return _this;
    }
    RadialBaseView.prototype.cf = function (a) {
        this.ct.c(a);
    };
    RadialBaseView.$t = markType(RadialBaseView, 'RadialBaseView', MarkerSeriesView.$);
    return RadialBaseView;
}(MarkerSeriesView));
export { RadialBaseView };
//# sourceMappingURL=RadialBucketCalculator_combined.js.map
