/*
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 { HorizontalAxisLabelPanelBase } from "./HorizontalAxisLabelPanelBase";
import { Number_$type, fromEnum, Boolean_$type, markType } from "igniteui-angular-core";
import { Size } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { HorizontalAxisLabelPanelBaseView } from "./HorizontalAxisLabelPanelBaseView";
import { TransformGroup } from "igniteui-angular-core";
import { RotateTransform } from "igniteui-angular-core";
import { TranslateTransform } from "igniteui-angular-core";
import { ViewportUtils } from "./ViewportUtils";
/**
 * @hidden
 */
export let RadialAxisLabelPanel = /*@__PURE__*/ (() => {
    class RadialAxisLabelPanel extends HorizontalAxisLabelPanelBase {
        constructor() {
            super(...arguments);
            this.dy = null;
            this.dv = 0;
            this.du = new List$1(Number_$type, 0);
        }
        ae() {
            return new RadialAxisLabelPanelView(this);
        }
        ch(a) {
            super.ch(a);
            this.ds = a;
        }
        get dt() {
            return !this.am;
        }
        dc() {
            return this.ao && (!this.av || this.bl() == -180);
        }
        dd() {
            return !this.aw;
        }
        b2(a) {
            super.b2(a);
            if (this.dv % 360 == 0 || this.am) {
                this.ds.a5();
            }
            else {
                this.ds.a4(a);
            }
        }
        bl() {
            let a = super.bl();
            if (this.dt) {
                a -= (this.dv * 180) / Math.PI;
            }
            return a;
        }
        db() {
            return this.bl() % 360 != 0;
        }
        da() {
            if (this.ad != null && this.ad.bh != null && this.ad.bh.eu) {
                return false;
            }
            if (this.am) {
                return true;
            }
            let a = this.dv * 180 / Math.PI;
            if (a < 30 || a > 330 || (a > 150 && a < 210)) {
                return true;
            }
            return false;
        }
        cm(a, b) {
            let c = b * Math.PI / 180;
            let d = Math.abs(Math.sin(c));
            if (this.ad.ay != null && this.ad.ay.c == 4) {
                d = d * -1;
            }
            this.ds.a6(a, b, d);
        }
        dx() {
            let a = 1.7976931348623157E+308;
            for (let b of fromEnum(this.ba)) {
                a = Math.min(b.c, a);
            }
            return a;
        }
        dw() {
            let a = -1.7976931348623157E+308;
            for (let b of fromEnum(this.ba)) {
                a = Math.max(b.c, a);
            }
            return a;
        }
        dq(a, b) {
            let c;
            if (this.ad.cg) {
                c = this.dx();
            }
            else {
                c = this.dw();
            }
            let d = new List$1(Number_$type, 0);
            let e = new List$1(Boolean_$type, 0);
            for (let f = 0; f < this.ba.count; f++) {
                let g = this.ba._inner[f];
                if (g.c == c && !g.a) {
                    d.add(this.ba.indexOf(g));
                }
            }
            this.du = d;
            let h = new List$1(Rect.$, 0);
            for (let i = 0; i < a.count; i++) {
                let j = a._inner[i];
                let k = this.ba._inner[i].a;
                if (!this.du.contains(i)) {
                    h.add(j);
                    e.add(k);
                }
            }
            this.ao = this.an(h, e);
        }
        at(a, b) {
            if (this.du.contains(a)) {
                return false;
            }
            else {
                return super.at(a, b);
            }
        }
        dr() {
            this.du = new List$1(Number_$type, 0);
            super.dr();
        }
        ai() {
            return 5;
        }
        ay(a) {
            return a == 5 || a == 4 || a == 1 || a == 0;
        }
        b9() {
        }
    }
    RadialAxisLabelPanel.$t = markType(RadialAxisLabelPanel, 'RadialAxisLabelPanel', HorizontalAxisLabelPanelBase.$);
    return RadialAxisLabelPanel;
})();
/**
 * @hidden
 */
export let RadialAxisLabelPanelView = /*@__PURE__*/ (() => {
    class RadialAxisLabelPanelView extends HorizontalAxisLabelPanelBaseView {
        constructor(a) {
            super(a);
            this.a3 = null;
            this.a3 = a;
        }
        a6(a, b, c) {
            let d = this.m(a);
            let e = this.l(a);
            let f = new TransformGroup();
            f.j.add(((() => {
                let $ret = new RotateTransform();
                $ret.j = b;
                $ret.k = d / 2;
                $ret.l = e / 2;
                return $ret;
            })()));
            f.j.add(((() => {
                let $ret = new TranslateTransform();
                $ret.j = d / -2;
                $ret.k = d / 2 * c;
                return $ret;
            })()));
            a.j = f;
        }
        a5() {
            this.a.j = null;
        }
        a4(a) {
            let b = ViewportUtils.f(0.5, this.a.c5, this.a.c4);
            this.a.j = ((() => {
                let $ret = new RotateTransform();
                $ret.j = (this.a3.dv * 180) / Math.PI;
                $ret.k = this.a3.dy.x;
                $ret.l = (this.a3.dy.y * a.height) + b;
                return $ret;
            })());
        }
        am() {
            super.am();
            this.a.c6(new Size(1, this.a.c1.width, this.a.c1.height));
        }
    }
    RadialAxisLabelPanelView.$t = markType(RadialAxisLabelPanelView, 'RadialAxisLabelPanelView', HorizontalAxisLabelPanelBaseView.$);
    return RadialAxisLabelPanelView;
})();
