/*
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.d1 = null;
            this.dy = 0;
            this.dx = new List$1(Number_$type, 0);
        }
        ae() {
            return new RadialAxisLabelPanelView(this);
        }
        ck(a) {
            super.ck(a);
            this.dv = a;
        }
        get dw() {
            return !this.am;
        }
        df() {
            return this.ao && (!this.ay || this.bo() == -180);
        }
        dg() {
            return !this.az;
        }
        b5(a) {
            super.b5(a);
            if (this.dy % 360 == 0 || this.am) {
                this.dv.a5();
            }
            else {
                this.dv.a4(a);
            }
        }
        bo() {
            let a = super.bo();
            if (this.dw) {
                a -= (this.dy * 180) / Math.PI;
            }
            return a;
        }
        de() {
            return this.bo() % 360 != 0;
        }
        dd() {
            if (this.ad != null && this.ad.b0 != null && this.ad.b0.ga) {
                return false;
            }
            if (this.am) {
                return true;
            }
            let a = this.dy * 180 / Math.PI;
            if (a < 30 || a > 330 || (a > 150 && a < 210)) {
                return true;
            }
            return false;
        }
        cp(a, b) {
            let c = b * Math.PI / 180;
            let d = Math.abs(Math.sin(c));
            if (this.ad.a3 != null && this.ad.a3.c == 4) {
                d = d * -1;
            }
            this.dv.a6(a, b, d);
        }
        d0() {
            let a = 1.7976931348623157E+308;
            for (let b of fromEnum(this.bd)) {
                a = Math.min(b.c, a);
            }
            return a;
        }
        dz() {
            let a = -1.7976931348623157E+308;
            for (let b of fromEnum(this.bd)) {
                a = Math.max(b.c, a);
            }
            return a;
        }
        dt(a, b) {
            let c;
            if (this.ad.df) {
                c = this.d0();
            }
            else {
                c = this.dz();
            }
            let d = new List$1(Number_$type, 0);
            let e = new List$1(Boolean_$type, 0);
            for (let f = 0; f < this.bd.count; f++) {
                let g = this.bd._inner[f];
                if (g.c == c && !g.a) {
                    d.add(this.bd.indexOf(g));
                }
            }
            this.dx = d;
            let h = new List$1(Rect.$, 0);
            for (let i = 0; i < a.count; i++) {
                let j = a._inner[i];
                let k = this.bd._inner[i].a;
                if (!this.dx.contains(i)) {
                    h.add(j);
                    e.add(k);
                }
            }
            this.ao = this.an(h, e);
        }
        au(a, b) {
            if (this.dx.contains(a)) {
                return false;
            }
            else {
                return super.au(a, b);
            }
        }
        du() {
            this.dx = new List$1(Number_$type, 0);
            super.du();
        }
        ai() {
            return 5;
        }
        a1(a) {
            return a == 5 || a == 4 || a == 1 || a == 0;
        }
        cc() {
        }
    }
    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.i(0.5, this.a.c8, this.a.c7, this.a.ad != null ? this.a.ad.nw() : Rect.empty);
            this.a.j = ((() => {
                let $ret = new RotateTransform();
                $ret.j = (this.a3.dy * 180) / Math.PI;
                $ret.k = this.a3.d1.x;
                $ret.l = (this.a3.d1.y * a.height) + b;
                return $ret;
            })());
        }
        am() {
            super.am();
            this.a.c9(new Size(1, this.a.c4.width, this.a.c4.height));
        }
    }
    RadialAxisLabelPanelView.$t = markType(RadialAxisLabelPanelView, 'RadialAxisLabelPanelView', HorizontalAxisLabelPanelBaseView.$);
    return RadialAxisLabelPanelView;
})();
