/*
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 { AnnotationLayer } from "./AnnotationLayer";
import { DependencyProperty } from "igniteui-angular-core";
import { Series } from "./Series";
import { FinalValueSelectionMode_$type } from "./FinalValueSelectionMode";
import { Brush } from "igniteui-angular-core";
import { Thickness } from "igniteui-angular-core";
import { FinalValueLayerFrame } from "./FinalValueLayerFrame";
import { List$1 } from "igniteui-angular-core";
import { Axis } from "./Axis";
import { Dictionary$2 } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { AxisAnnotation } from "./AxisAnnotation";
import { Base, enumGetBox, fromEnum, Point_$type, markType, markDep } from "igniteui-angular-core";
import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager";
import { PropertyMetadata } from "igniteui-angular-core";
import { DeviceUtils } from "igniteui-angular-core";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { BrushUtil } from "igniteui-angular-core";
/**
 * @hidden
 */
export let FinalValueLayer = /*@__PURE__*/ (() => {
    class FinalValueLayer extends AnnotationLayer {
        constructor() {
            super();
            this.axisAnnotationFormatLabel = null;
            this.aal = null;
            this.aak = null;
            let a = new FinalValueLayerFrame();
            let b = new FinalValueLayerFrame();
            let c = new FinalValueLayerFrame();
            let d = this.kh / 1000;
            this.xm = a;
            this.xl = b;
            this.xn = c;
            this.ab = FinalValueLayer.$;
        }
        bk() {
            return new FinalValueLayer();
        }
        get_es() {
            return true;
        }
        ct() {
            return new FinalValueLayerView(this);
        }
        q7(a) {
            super.q7(a);
            this.aag = a;
        }
        get abq() {
            return new Thickness(1, this.aao, this.aaq, this.aap, this.aan);
        }
        aaj() {
            return this.axisAnnotationFormatLabel != null;
        }
        y1(a, b) {
            if (this.aai == null || this.aai == a) {
                if (!this.a1.c) {
                    this.ry(b);
                }
            }
        }
        y3(a, b) {
            super.y3(a, b);
            let c = a;
            c.f.clear();
            c.r.clear();
            c.q.clear();
            c.ac.clear();
            c.p.clear();
            c.ab.clear();
            c.h.clear();
            c.g.clear();
            c.i.clear();
            c.k.clear();
            c.m.clear();
            c.l.clear();
            c.j.clear();
            c.n.clear();
            c.o.clear();
            c.t.clear();
            c.s.clear();
            c.u.clear();
            c.w.clear();
            c.y.clear();
            c.x.clear();
            c.v.clear();
            c.z.clear();
            c.aa.clear();
            if (this.xs(this.aai)) {
                this.aa7(this.aai, c);
            }
            else {
                for (let d of fromEnum(this.dc.series)) {
                    if (this.xs(d)) {
                        this.aa7(d, c);
                    }
                    if (d.isStacked) {
                        d.p9((e) => {
                            if (this.xs(e)) {
                                this.aa7(e, c);
                            }
                            if (e.ei) {
                                e.p7((f) => {
                                    if (this.xs(f)) {
                                        this.aa7(f, c);
                                    }
                                    return true;
                                });
                            }
                            return true;
                        });
                    }
                    if (d.ei) {
                        d.p7((e) => {
                            if (this.xs(e)) {
                                this.aa7(e, c);
                            }
                            return true;
                        });
                    }
                }
            }
        }
        xs(a) {
            if (!super.xs(a)) {
                return false;
            }
            if (this.aa4 != null) {
                if (a.isFragment) {
                    let b = a.nh();
                    if (!Base.equalsStatic(this.aa4, b)) {
                        return false;
                    }
                }
                else {
                    if (!Base.equalsStatic(this.aa4, a.name)) {
                        return false;
                    }
                }
            }
            return true;
        }
        qv() {
            super.qv();
            if (!this.a1.c && !this.d4()) {
                return;
            }
            if (this.d4()) {
                this.aa8(this.xn, false);
            }
            else {
                this.aa8(this.xl, false);
            }
        }
        abp(a) {
            let b = NaN;
            let c = NaN;
            let d = this.aah;
            if (d == 0) {
                d = 1;
            }
            let e = false;
            if (d == 2) {
                e = true;
            }
            if (a.isVertical) {
                let f = a.a0();
                if (f != null) {
                    if (d == 1 || d == 2) {
                        let g = this.wt(this.cw);
                        if (f.df) {
                            c = a.wr({ $type: Point_$type, x: g.right, y: g.bottom }).y;
                        }
                        else {
                            c = a.wr({ $type: Point_$type, x: g.right, y: g.top }).y;
                        }
                    }
                    else {
                        if (f.df) {
                            c = 1;
                        }
                        else {
                            c = 0;
                        }
                    }
                }
                return a.wm({ $type: Point_$type, x: 0, y: c }, e, true);
            }
            else {
                let h = a.a0();
                if (h != null) {
                    if (d == 1 || d == 2) {
                        let i = this.wt(this.cw);
                        if (h.df) {
                            b = a.wr({ $type: Point_$type, x: i.left, y: i.top }).x;
                        }
                        else {
                            b = a.wr({ $type: Point_$type, x: i.right, y: i.top }).x;
                        }
                    }
                    else {
                        if (h.df) {
                            b = 0;
                        }
                        else {
                            b = 1;
                        }
                    }
                }
                if (a.e8) {
                    return a.wm({ $type: Point_$type, x: b, y: 0 }, e, true);
                }
                else {
                    return a.wm({ $type: Point_$type, x: b, y: 0 }, e, true);
                }
            }
        }
        aa7(a, b) {
            let c = this.abp(a);
            let d = this.wr(c);
            let e = this.vj;
            if (e == null) {
                e = this.vp;
            }
            if (e == null) {
                e = a.vj;
                if (e != null) {
                    e = this.aag.co(e);
                }
            }
            AxisAnnotationFrameManager.c(b, c, a, this.dc, this.getEffectiveViewport(), e, this.abm, this.aam, this.abo, this.abn, this.abq, this.aar, this.abm, this.aam, this.abo, this.abn, this.abq, this.aar, this._visibility == 0 && a.isVertical, this._visibility == 0 && !a.isVertical);
        }
        aa8(a, b) {
            let c = false;
            if (this.aak == null) {
                c = true;
                this.aal = new List$1(Axis.$, 0);
                this.aak = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
            }
            AxisAnnotationFrameManager.d(this, a, c, this.aak, this.aal, b, this.aas, this.aas, this.axisAnnotationFormatLabel, this.axisAnnotationFormatLabel);
        }
        y6(a, b) {
            super.y6(a, b);
            if (this.d4()) {
                this.aa8(this.xn, true);
            }
            else {
                this.aa8(this.xl, false);
            }
        }
        gb() {
            return true;
        }
        rg(a, b, c, d) {
            super.rg(a, b, c, d);
            switch (b) {
                case FinalValueLayer.$$p[11]:
                case FinalValueLayer.$$p[12]:
                    this.ry(true);
                    break;
                case FinalValueLayer.$$p[1]:
                case FinalValueLayer.$$p[0]:
                case FinalValueLayer.$$p[3]:
                case FinalValueLayer.$$p[5]:
                case FinalValueLayer.$$p[7]:
                case FinalValueLayer.$$p[6]:
                case FinalValueLayer.$$p[4]:
                case "Visibility":
                case FinalValueLayer.$$p[8]:
                case FinalValueLayer.$$p[9]:
                case FinalValueLayer.$$p[10]:
                    this.ry(true);
                    break;
                case "SeriesViewer":
                    let e = this.aal;
                    let f = this.aak;
                    if (f != null) {
                        for (let g of fromEnum(f)) {
                            let h = g.value;
                            h.c((i) => g.key.ar.remove(i));
                            h.clear();
                        }
                        e.clear();
                        f.clear();
                    }
                    break;
            }
        }
        pb(a, b) {
            super.pb(a, b);
            if (a) {
                AxisAnnotationFrameManager.b(this.xl);
                this.aa8(this.xl, false);
            }
        }
    }
    FinalValueLayer.$t = markType(FinalValueLayer, 'FinalValueLayer', AnnotationLayer.$);
    FinalValueLayer.$$p = markDep(DependencyProperty, PropertyMetadata, FinalValueLayer, 'raisePropertyChanged', ['AxisAnnotationBackgroundCornerRadius:aam:aa9', [1, DeviceUtils.g(3)], 'AxisAnnotationBackground:abm:aba', [Brush.$, null], 'AxisAnnotationInterpolatedValuePrecision:aas:abb', [1, -1], 'AxisAnnotationOutline:abn:abc', [Brush.$, null], 'AxisAnnotationPaddingBottom:aan:abd', [1, NaN], 'AxisAnnotationPaddingLeft:aao:abe', [1, NaN], 'AxisAnnotationPaddingRight:aap:abf', [1, NaN], 'AxisAnnotationPaddingTop:aaq:abg', [1, NaN], 'AxisAnnotationStrokeThickness:aar:abh', [1, NaN], 'AxisAnnotationTextColor:abo:abi', [Brush.$, null], 'FinalValueSelectionMode:aah:abj', [FinalValueSelectionMode_$type, enumGetBox(FinalValueSelectionMode_$type, 0)], 'TargetSeriesName:aa4:abk', [2, null], 'TargetSeries:aai:abl', [Series.$, null]]);
    return FinalValueLayer;
})();
/**
 * @hidden
 */
export let FinalValueLayerView = /*@__PURE__*/ (() => {
    class FinalValueLayerView extends AnnotationLayerView {
        constructor(a) {
            super(a);
            this.cn = null;
            this.cn = a;
        }
        a4() {
            super.a4();
        }
        co(a) {
            if (a == null) {
                return a;
            }
            return BrushUtil.o(a, 0.1);
        }
        ax(a) {
            super.ax(a);
        }
    }
    FinalValueLayerView.$t = markType(FinalValueLayerView, 'FinalValueLayerView', AnnotationLayerView.$);
    return FinalValueLayerView;
})();
