/*
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, Point_$type, markType } from "igniteui-react-core";
import { ViewportUtils } from "./ViewportUtils";
import { isNaN_ } from "igniteui-react-core";
/**
 * @hidden
 */
export let RadialAxes = /*@__PURE__*/ (() => {
    class RadialAxes extends Base {
        constructor(a, b) {
            super();
            this.b = null;
            this.a = null;
            this.h = { $type: Point_$type, x: 0.5, y: 0.5 };
            this.b = a;
            this.a = b;
        }
        d(a, b, c, d, e) {
            let f = this.h.x + (b * Math.cos(a));
            return ViewportUtils.e(f, c, d, e);
        }
        f(a, b, c, d, e, f, g) {
            let h = Math.min(b != null ? b.count : 0, c != null ? c.count : 0);
            let i = false;
            if (a.count == h) {
                i = true;
            }
            let j;
            let k;
            let l = this.h.x;
            let m = this.h.y;
            let n;
            let o;
            for (let p = 0; p < h; p++) {
                j = this.a.getScaledAngle(b.item(p));
                k = this.b.nv(c.item(p));
                n = l + (k * f(p, j));
                o = m + (k * g(p, j));
                n = e.left + e.width * (n - d.left) / d.width;
                o = e.top + e.height * (o - d.top) / d.height;
                if (!i) {
                    a.add({ $type: Point_$type, x: n, y: o });
                }
                else {
                    a.item(p, { $type: Point_$type, x: n, y: o });
                }
            }
        }
        g(a, b, c, d, e, f, g) {
            let h = ViewportUtils.b(a, c, d, e);
            let i = ViewportUtils.g(b, c, d, e);
            let j = Math.sqrt(Math.pow(h - this.h.x, 2) + Math.pow(i - this.h.y, 2));
            let k = Math.acos((h - this.h.x) / j);
            if (j == 0 && isNaN_(k)) {
                k = 0;
            }
            if ((i - this.h.y) < 0) {
                k = (2 * Math.PI) - k;
            }
            f = this.a.getUnscaledAngle(k);
            g = this.b.nx(j);
            return {
                p5: f,
                p6: g
            };
        }
        e(a, b, c, d, e) {
            let f = this.h.y + (b * Math.sin(a));
            return ViewportUtils.i(f, c, d, e);
        }
        c(a, b, c, d) {
            let e = { $type: Point_$type, x: ViewportUtils.e(this.h.x, b, c, d), y: ViewportUtils.i(this.h.y, b, c, d) };
            let f = { $type: Point_$type, x: ViewportUtils.e(a.x, b, c, d), y: ViewportUtils.i(a.y, b, c, d) };
            let g = Math.sqrt(Math.pow(f.x - e.x, 2) + Math.pow(f.y - e.y, 2));
            let h = Math.acos((f.x - e.x) / g);
            if ((f.y - e.y) < 0) {
                h = (2 * Math.PI) - h;
            }
            return h;
        }
    }
    RadialAxes.$t = /*@__PURE__*/ markType(RadialAxes, 'RadialAxes');
    return RadialAxes;
})();
