/*
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 { Series } from "./Series";
import { DependencyProperty } from "igniteui-react-core";
import { Point_$type, Boolean_$type, enumGetBox, runOn, delegateRemove, typeCast, delegateCombine, fromEnum, fromEn, markType, markDep } from "igniteui-react-core";
import { AnnotationAppearanceMode_$type } from "./AnnotationAppearanceMode";
import { DoubleCollection } from "igniteui-react-core";
import { SeriesView } from "./SeriesView";
import { XamDataChart } from "./XamDataChart";
import { Tuple$2 } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_ } from "igniteui-react-core";
/**
 * @hidden
 */
export let AnnotationLayer = /*@__PURE__*/ (() => {
    class AnnotationLayer extends Series {
        constructor() {
            super();
            this.zo = null;
            this.w4 = null;
            this.w3 = null;
            this.w5 = null;
            this.zm = { $type: Point_$type, x: NaN, y: NaN };
            this.w6 = false;
            this.zo = { $type: Point_$type, x: NaN, y: NaN };
            this.yr();
        }
        cq() {
            return new AnnotationLayerView(this);
        }
        qx(a) {
            super.qx(a);
            this.w2 = a;
        }
        xa(a) {
            if (a == null) {
                return false;
            }
            if (a.eq) {
                return false;
            }
            if (a.isValueOverlay) {
                return false;
            }
            if (a == this) {
                return false;
            }
            return a.hc(a.ct.bx, a.ct.by, a.ct);
        }
        get_ez() {
            return this.w7;
        }
        b0() {
            if (this.b1 == 0) {
                return 1;
            }
            else {
                return super.b0();
            }
        }
        get_fe() {
            return this.xc || this.xd;
        }
        get_isUsableInLegend() {
            return this.xd;
        }
        q5(a, b, c, d) {
            super.q5(a, b, c, d);
            switch (b) {
                case "SeriesViewer":
                    let e = c;
                    let f = d;
                    if (e != null) {
                        this.yq(e.series);
                        let g = e.series;
                        g.collectionChanged = delegateRemove(g.collectionChanged, runOn(this, this.yn));
                        if (typeCast(XamDataChart.$, e) !== null) {
                            let h = e;
                            this.yp(h.axes);
                            let i = h.axes;
                            i.collectionChanged = delegateRemove(i.collectionChanged, runOn(this, this.yd));
                        }
                    }
                    if (f != null) {
                        this.yl(f.series);
                        let j = f.series;
                        j.collectionChanged = delegateCombine(j.collectionChanged, runOn(this, this.yn));
                        if (typeCast(XamDataChart.$, f) !== null) {
                            let k = f;
                            this.yk(k.axes);
                            let l = k.axes;
                            l.collectionChanged = delegateCombine(l.collectionChanged, runOn(this, this.yd));
                        }
                    }
                    break;
                case AnnotationLayer.$$p[16]:
                case AnnotationLayer.$$p[15]:
                    if (this.fe) {
                        if (this.index == -1) {
                            this.index = XamDataChart.x7(this);
                        }
                    }
                    else {
                        this.index = -1;
                        this.u3 = null;
                        this.u7 = null;
                    }
                    if (this.c9 != null) {
                        this.c9.o0();
                    }
                    this.rn(true);
                    break;
                case "TransitionProgress":
                    this.w5.c(this.jo, this.w4, this.w3);
                    if (this.d3(this.ct)) {
                        return;
                    }
                    if (this.jo == 1) {
                        this.ym(this.w3, this.ct);
                        this.qk();
                    }
                    else {
                        this.ym(this.w5, this.ct);
                    }
                    if (this.c9 != null) {
                        this.c9.qa(this);
                    }
                    break;
                case AnnotationLayer.$$p[13]:
                    if (this.c9 != null) {
                        this.c9.ou();
                    }
                    break;
                case AnnotationLayer.$$p[9]:
                    this.zo = this.zn;
                    this.qn(this.zn);
                    break;
                case "ShouldRenderAsOverlay":
                    if (this.c9 != null) {
                        this.ct.al(this.c9);
                        this.ct.ag(this.c9);
                    }
                    break;
                case AnnotationLayer.$$p[8]:
                case AnnotationLayer.$$p[14]:
                case "DashArray":
                case AnnotationLayer.$$p[10]:
                case AnnotationLayer.$$p[17]:
                case AnnotationLayer.$$p[12]:
                case AnnotationLayer.$$p[19]:
                case AnnotationLayer.$$p[11]:
                case AnnotationLayer.$$p[18]:
                    this.yr();
                    break;
                case AnnotationLayer.$$p[0]:
                case AnnotationLayer.$$p[4]:
                case AnnotationLayer.$$p[1]:
                case AnnotationLayer.$$p[5]:
                case AnnotationLayer.$$p[3]:
                case AnnotationLayer.$$p[7]:
                case AnnotationLayer.$$p[2]:
                case AnnotationLayer.$$p[6]:
                    this.rn(true);
                    break;
            }
        }
        yq(a) {
            for (let b of fromEnum(a)) {
                if (!(b == this)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.yo));
                }
            }
            this.rn(true);
        }
        yp(a) {
            for (let b of fromEnum(a)) {
                b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.ye));
            }
            this.rn(true);
        }
        yl(a) {
            for (let b of fromEnum(a)) {
                if (!(b == this)) {
                    b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.yo));
                }
            }
            this.rn(true);
        }
        yk(a) {
            for (let b of fromEnum(a)) {
                b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.ye));
            }
            this.rn(true);
        }
        w8(a) {
            if (a == null) {
                return false;
            }
            return true;
        }
        ye(a, b) {
            if (this.w8(a)) {
                this.yg(a, b.animate);
            }
        }
        w9(a) {
            if (a == null) {
                return false;
            }
            if (a.eq) {
                return false;
            }
            return true;
        }
        yo(a, b) {
            if (this.w9(a)) {
                this.yh(a, b.animate);
            }
        }
        yg(a, b) {
        }
        yh(a, b) {
        }
        yn(a, b) {
            this.yi(b);
        }
        yd(a, b) {
            this.yf(b);
        }
        zc() {
            if (this.u3 != null) {
                return this.u3;
            }
            return this.u9;
        }
        zd() {
            if (this.u7 != null) {
                return this.u7;
            }
            return this.vp;
        }
        yf(a) {
            if (a.oldItems != null) {
                for (let b of fromEn(a.oldItems)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.ye));
                }
            }
            if (a.newItems != null) {
                for (let c of fromEn(a.newItems)) {
                    c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.ye));
                }
            }
            this.rn(true);
        }
        yi(a) {
            if (a.oldItems != null) {
                for (let b of fromEn(a.oldItems)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.yo));
                }
            }
            if (a.newItems != null) {
                for (let c of fromEn(a.newItems)) {
                    c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.yo));
                }
            }
            this.rn(true);
        }
        sl(a, b) {
            this.rn(false);
        }
        sk(a, b) {
            this.rn(true);
        }
        ro(a) {
            super.ro(a);
            if (this.d3(this.ct)) {
                return;
            }
            if (this.gd(a) && !this.gp) {
                let b = this.w4;
                if (this.d1()) {
                    if (this.da.g) {
                        this.da.t();
                    }
                    this.w4 = this.w5;
                    this.w5 = b;
                }
                else {
                    this.w4 = this.w3;
                    this.w3 = b;
                }
                this.yj(this.w3, this.ct);
                this.r1();
            }
            else {
                if (!this.gp) {
                    this.yj(this.w3, this.ct);
                }
                this.ym(this.w3, this.ct);
            }
        }
        get_eq() {
            return true;
        }
        yj(a, b) {
        }
        ym(a, b) {
            this.qt();
            this.w2.b4();
        }
        yc(a) {
            let b = { $type: Point_$type, x: this.zm.x, y: this.zm.y };
            if (a.isVertical) {
                if (isNaN_(this.zm.y)) {
                    return new Tuple$2(Boolean_$type, Point_$type, false, b);
                }
                if (isNaN_(this.zm.x)) {
                    b.x = 0;
                    return new Tuple$2(Boolean_$type, Point_$type, true, b);
                }
            }
            else {
                if (isNaN_(this.zm.x)) {
                    return new Tuple$2(Boolean_$type, Point_$type, false, b);
                }
                if (isNaN_(this.zm.y)) {
                    b.y = 0;
                    return new Tuple$2(Boolean_$type, Point_$type, true, b);
                }
            }
            return new Tuple$2(Boolean_$type, Point_$type, true, b);
        }
        qn(a) {
            super.qn(a);
            if (isNaN_(this.zo.x) && isNaN_(this.zo.y)) {
                if (isNaN_(a.x) && isNaN_(a.y)) {
                    this.w2.b3();
                    return;
                }
                else {
                    this.w2.b5();
                    this.zm = a;
                }
            }
            else {
                this.w2.b5();
                this.zm = this.zo;
            }
            this.rn(true);
        }
        hc(a, b, c) {
            let d = super.hc(a, b, c);
            if (this.c9 == null) {
                return false;
            }
            if (!this.ct.t()) {
                d = false;
                return d;
            }
            return d;
        }
        xn() {
            if (isNaN_(this.xq)) {
                switch (this.wq) {
                    case 1: return this.xh();
                    case 2: return this.xk();
                    case 4: return this.xj();
                }
            }
            return this.xq;
        }
        xm() {
            if (isNaN_(this.xp)) {
                return this.xf;
            }
            return this.xp;
        }
        xo() {
            if (isNaN_(this.xr)) {
                return this.xf;
            }
            return this.xr;
        }
        wx() {
            switch (this.wt) {
                case 0: return this.wu();
            }
            return this.wt;
        }
        wy() {
            switch (this.w0) {
                case 0: return this.wq;
            }
            return this.w0;
        }
        wz() {
            switch (this.w1) {
                case 0: return this.wq;
            }
            return this.w1;
        }
        zi() {
            if (this.zk == null) {
                if (this.vw == null) {
                    return this.zg();
                }
                return this.vw;
            }
            return this.zk;
        }
        zj() {
            if (this.zl == null) {
                if (this.vw == null) {
                    return this.zh();
                }
                return this.vw;
            }
            return this.zl;
        }
        wu() {
            return 0;
        }
        wv() {
            return this.wu();
        }
        ww() {
            return this.wu();
        }
        xh() {
            return NaN;
        }
        xk() {
            return NaN;
        }
        xj() {
            return NaN;
        }
        xi() {
            return NaN;
        }
        xl() {
            return NaN;
        }
        zg() {
            return null;
        }
        zh() {
            return null;
        }
        yr() {
            this.wq = this.wx();
            this.xf = this.xn();
            this.wr = this.wy();
            this.xe = this.xm();
            this.ws = this.wz();
            this.xg = this.xo();
            this.ze = this.zi();
            this.zf = this.zj();
        }
        get_g8() {
            return this.xb;
        }
        get xb() {
            return this.w6;
        }
        set xb(a) {
            let b = this.w6;
            this.w6 = a;
            this.raisePropertyChanged("ShouldRenderAsOverlay", b, this.w6);
        }
    }
    AnnotationLayer.$t = /*@__PURE__*/ markType(AnnotationLayer, 'AnnotationLayer', Series.$);
    AnnotationLayer.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, AnnotationLayer, 'raisePropertyChanged', ['ActualAppearanceMode:wq:ys', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualHorizontalAppearanceMode:wr:yt', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualHorizontalDashArray:ze:yu', [DoubleCollection.$], 'ActualHorizontalShiftAmount:xe:yv', [1, NaN], 'ActualShiftAmount:xf:yw', [1, NaN], 'ActualVerticalAppearanceMode:ws:yx', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualVerticalDashArray:zf:yy', [DoubleCollection.$], 'ActualVerticalShiftAmount:xg:yz', [1, NaN], 'AppearanceMode:wt:y0', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'CursorPosition:zn:y1', [Point_$type, { $type: Point_$type, x: NaN, y: NaN }], 'HorizontalAppearanceMode:w0:y2', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'HorizontalDashArray:zk:y3', [DoubleCollection.$], 'HorizontalShiftAmount:xp:y4', [1, NaN], 'IsDefaultCrosshairDisabled:w7:y5', [0, true], 'ShiftAmount:xq:y6', [1, NaN], 'UseIndex:xc:y7', [0, false], 'UseLegend:xd:y8', [0, false], 'VerticalAppearanceMode:w1:y9', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'VerticalDashArray:zl:za', [DoubleCollection.$], 'VerticalShiftAmount:xr:zb', [1, NaN]]);
    return AnnotationLayer;
})();
/**
 * @hidden
 */
export let AnnotationLayerView = /*@__PURE__*/ (() => {
    class AnnotationLayerView extends SeriesView {
        constructor(a) {
            super(a);
            this.b0 = null;
            this.b1 = false;
            this.b2 = -1;
            this.b0 = a;
        }
        b6() {
            if (this.b1) {
                this.b1 = false;
                this.b2 = -1;
                this.b0.zm = { $type: Point_$type, x: NaN, y: NaN };
                this.b0.rn(true);
            }
        }
        b3() {
            this.b1 = true;
            if (this.e.jx != null) {
                this.e.jx.setTimeout(runOn(this, this.b6), 300);
            }
            else {
                this.b2 = window.setTimeout(runOn(this, this.b6), 300);
            }
        }
        b5() {
            if (this.b1 == true) {
                this.b1 = false;
                if (this.b2 != -1) {
                    window.clearTimeout(this.b2);
                    this.b2 = -1;
                }
            }
        }
        b4() {
            this.as();
        }
    }
    AnnotationLayerView.$t = /*@__PURE__*/ markType(AnnotationLayerView, 'AnnotationLayerView', SeriesView.$);
    return AnnotationLayerView;
})();
