/*
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-react-core";
import { Series } from "./Series";
import { FinalValueSelectionMode_$type } from "./FinalValueSelectionMode";
import { Brush } from "igniteui-react-core";
import { Thickness } from "igniteui-react-core";
import { FinalValueLayerFrame } from "./FinalValueLayerFrame";
import { List$1 } from "igniteui-react-core";
import { Axis } from "./Axis";
import { Dictionary$2 } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { AxisAnnotation } from "./AxisAnnotation";
import { Base, enumGetBox, fromEnum, Point_$type, markType, markDep } from "igniteui-react-core";
import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager";
import { PropertyMetadata } from "igniteui-react-core";
import { DeviceUtils } from "igniteui-react-core";
import { AnnotationLayerView } from "./AnnotationLayerView";
import { BrushUtil } from "igniteui-react-core";
/**
 * @hidden
 */
export let FinalValueLayer = /*@__PURE__*/ (() => {
    class FinalValueLayer extends AnnotationLayer {
        bi() {
            return new FinalValueLayer();
        }
        get_eo() {
            return true;
        }
        constructor() {
            super();
            this.axisAnnotationFormatLabel = null;
            this.zu = null;
            this.zt = null;
            let a = new FinalValueLayerFrame();
            let b = new FinalValueLayerFrame();
            let c = new FinalValueLayerFrame();
            let d = this.kb / 1000;
            this.w3 = a;
            this.w2 = b;
            this.w4 = c;
            this.ab = FinalValueLayer.$;
        }
        cq() {
            return new FinalValueLayerView(this);
        }
        qw(a) {
            super.qw(a);
            this.zp = a;
        }
        get aaz() {
            return new Thickness(1, this.zx, this.zz, this.zy, this.zw);
        }
        zs() {
            return this.axisAnnotationFormatLabel != null;
        }
        yg(a, b) {
            if (this.zr == null || this.zr == a) {
                if (!this.a0.c) {
                    this.rm(b);
                }
            }
        }
        yi(a, b) {
            super.yi(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.w9(this.zr)) {
                this.aag(this.zr, c);
            }
            else {
                for (let d of fromEnum(this.c9.series)) {
                    if (this.w9(d)) {
                        this.aag(d, c);
                    }
                    if (d.isStacked) {
                        d.py((e) => {
                            if (this.w9(e)) {
                                this.aag(e, c);
                            }
                            if (e.ee) {
                                e.pw((f) => {
                                    if (this.w9(f)) {
                                        this.aag(f, c);
                                    }
                                    return true;
                                });
                            }
                            return true;
                        });
                    }
                    if (d.ee) {
                        d.pw((e) => {
                            if (this.w9(e)) {
                                this.aag(e, c);
                            }
                            return true;
                        });
                    }
                }
            }
        }
        w9(a) {
            if (!super.w9(a)) {
                return false;
            }
            if (this.aad != null) {
                if (a.e9) {
                    let b = a.m9();
                    if (!Base.equalsStatic(this.aad, b)) {
                        return false;
                    }
                }
                else {
                    if (!Base.equalsStatic(this.aad, a.name)) {
                        return false;
                    }
                }
            }
            return true;
        }
        qk() {
            super.qk();
            if (!this.a0.c && !this.d1()) {
                return;
            }
            if (this.d1()) {
                this.aah(this.w4, false);
            }
            else {
                this.aah(this.w2, false);
            }
        }
        aay(a) {
            let b = NaN;
            let c = NaN;
            let d = this.zq;
            if (d == 0) {
                d = 1;
            }
            let e = false;
            if (d == 2) {
                e = true;
            }
            if (a.isVertical) {
                let f = a.az();
                if (f != null) {
                    if (d == 1 || d == 2) {
                        let g = this.wc(this.ct);
                        if (f.ch) {
                            c = a.wa({ $type: Point_$type, x: g.right, y: g.bottom }).y;
                        }
                        else {
                            c = a.wa({ $type: Point_$type, x: g.right, y: g.top }).y;
                        }
                    }
                    else {
                        if (f.ch) {
                            c = 1;
                        }
                        else {
                            c = 0;
                        }
                    }
                }
                return a.v5({ $type: Point_$type, x: 0, y: c }, e, true);
            }
            else {
                let h = a.az();
                if (h != null) {
                    if (d == 1 || d == 2) {
                        let i = this.wc(this.ct);
                        if (h.ch) {
                            b = a.wa({ $type: Point_$type, x: i.left, y: i.top }).x;
                        }
                        else {
                            b = a.wa({ $type: Point_$type, x: i.right, y: i.top }).x;
                        }
                    }
                    else {
                        if (h.ch) {
                            b = 0;
                        }
                        else {
                            b = 1;
                        }
                    }
                }
                if (a.e4) {
                    return a.v5({ $type: Point_$type, x: b, y: 0 }, e, true);
                }
                else {
                    return a.v5({ $type: Point_$type, x: b, y: 0 }, e, true);
                }
            }
        }
        aag(a, b) {
            let c = this.aay(a);
            let d = this.wa(c);
            let e = this.u2;
            if (e == null) {
                e = this.u8;
            }
            if (e == null) {
                e = a.u2;
                if (e != null) {
                    e = this.zp.b8(e);
                }
            }
            AxisAnnotationFrameManager.c(b, c, a, this.c9, this.getEffectiveViewport(), e, this.aav, this.zv, this.aax, this.aaw, this.aaz, this.z0, this.aav, this.zv, this.aax, this.aaw, this.aaz, this.z0, this._visibility == 0 && a.isVertical, this._visibility == 0 && !a.isVertical);
        }
        aah(a, b) {
            let c = false;
            if (this.zt == null) {
                c = true;
                this.zu = new List$1(Axis.$, 0);
                this.zt = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
            }
            AxisAnnotationFrameManager.d(this, a, c, this.zt, this.zu, b, this.z1, this.z1, this.axisAnnotationFormatLabel, this.axisAnnotationFormatLabel);
        }
        yl(a, b) {
            super.yl(a, b);
            if (this.d1()) {
                this.aah(this.w4, true);
            }
            else {
                this.aah(this.w2, false);
            }
        }
        f8() {
            return true;
        }
        q4(a, b, c, d) {
            super.q4(a, b, c, d);
            switch (b) {
                case FinalValueLayer.$$p[11]:
                case FinalValueLayer.$$p[12]:
                    this.rm(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.rm(true);
                    break;
                case "SeriesViewer":
                    let e = this.zu;
                    let f = this.zt;
                    if (f != null) {
                        for (let g of fromEnum(f)) {
                            let h = g.value;
                            h.c((i) => g.key.an.remove(i));
                            h.clear();
                        }
                        e.clear();
                        f.clear();
                    }
                    break;
            }
        }
        o2(a, b) {
            super.o2(a, b);
            if (a) {
                AxisAnnotationFrameManager.b(this.w2);
                this.aah(this.w2, false);
            }
        }
    }
    FinalValueLayer.$t = /*@__PURE__*/ markType(FinalValueLayer, 'FinalValueLayer', AnnotationLayer.$);
    FinalValueLayer.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, FinalValueLayer, 'raisePropertyChanged', ['AxisAnnotationBackgroundCornerRadius:zv:aai', [1, /*@__PURE__*/ DeviceUtils.g(3)], 'AxisAnnotationBackground:aav:aaj', [Brush.$, null], 'AxisAnnotationInterpolatedValuePrecision:z1:aak', [1, -1], 'AxisAnnotationOutline:aaw:aal', [Brush.$, null], 'AxisAnnotationPaddingBottom:zw:aam', [1, NaN], 'AxisAnnotationPaddingLeft:zx:aan', [1, NaN], 'AxisAnnotationPaddingRight:zy:aao', [1, NaN], 'AxisAnnotationPaddingTop:zz:aap', [1, NaN], 'AxisAnnotationStrokeThickness:z0:aaq', [1, NaN], 'AxisAnnotationTextColor:aax:aar', [Brush.$, null], 'FinalValueSelectionMode:zq:aas', [FinalValueSelectionMode_$type, /*@__PURE__*/ enumGetBox(FinalValueSelectionMode_$type, 0)], 'TargetSeriesName:aad:aat', [2, null], 'TargetSeries:zr:aau', [Series.$, null]]);
    return FinalValueLayer;
})();
/**
 * @hidden
 */
export let FinalValueLayerView = /*@__PURE__*/ (() => {
    class FinalValueLayerView extends AnnotationLayerView {
        constructor(a) {
            super(a);
            this.b7 = null;
            this.b7 = a;
        }
        au() {
            super.au();
        }
        b8(a) {
            if (a == null) {
                return a;
            }
            return BrushUtil.m(a, 0.1);
        }
        an(a) {
            super.an(a);
        }
    }
    FinalValueLayerView.$t = /*@__PURE__*/ markType(FinalValueLayerView, 'FinalValueLayerView', AnnotationLayerView.$);
    return FinalValueLayerView;
})();
