/*
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.zn = null;
            this.w3 = null;
            this.w2 = null;
            this.w4 = null;
            this.zl = { $type: Point_$type, x: NaN, y: NaN };
            this.w5 = false;
            this.zn = { $type: Point_$type, x: NaN, y: NaN };
            this.yq();
        }
        cq() {
            return new AnnotationLayerView(this);
        }
        qw(a) {
            super.qw(a);
            this.w1 = a;
        }
        w9(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.w6;
        }
        b0() {
            if (this.b1 == 0) {
                return 1;
            }
            else {
                return super.b0();
            }
        }
        get_fe() {
            return this.xb || this.xc;
        }
        get_isUsableInLegend() {
            return this.xc;
        }
        q4(a, b, c, d) {
            super.q4(a, b, c, d);
            switch (b) {
                case "SeriesViewer":
                    let e = c;
                    let f = d;
                    if (e != null) {
                        this.yp(e.series);
                        let g = e.series;
                        g.collectionChanged = delegateRemove(g.collectionChanged, runOn(this, this.ym));
                        if (typeCast(XamDataChart.$, e) !== null) {
                            let h = e;
                            this.yo(h.axes);
                            let i = h.axes;
                            i.collectionChanged = delegateRemove(i.collectionChanged, runOn(this, this.yc));
                        }
                    }
                    if (f != null) {
                        this.yk(f.series);
                        let j = f.series;
                        j.collectionChanged = delegateCombine(j.collectionChanged, runOn(this, this.ym));
                        if (typeCast(XamDataChart.$, f) !== null) {
                            let k = f;
                            this.yj(k.axes);
                            let l = k.axes;
                            l.collectionChanged = delegateCombine(l.collectionChanged, runOn(this, this.yc));
                        }
                    }
                    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.u2 = null;
                        this.u6 = null;
                    }
                    if (this.c9 != null) {
                        this.c9.o0();
                    }
                    this.rm(true);
                    break;
                case "TransitionProgress":
                    this.w4.c(this.jo, this.w3, this.w2);
                    if (this.d3(this.ct)) {
                        return;
                    }
                    if (this.jo == 1) {
                        this.yl(this.w2, this.ct);
                        this.qj();
                    }
                    else {
                        this.yl(this.w4, 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.zn = this.zm;
                    this.qm(this.zm);
                    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.yq();
                    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.rm(true);
                    break;
            }
        }
        yp(a) {
            for (let b of fromEnum(a)) {
                if (!(b == this)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.yn));
                }
            }
            this.rm(true);
        }
        yo(a) {
            for (let b of fromEnum(a)) {
                b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.yd));
            }
            this.rm(true);
        }
        yk(a) {
            for (let b of fromEnum(a)) {
                if (!(b == this)) {
                    b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.yn));
                }
            }
            this.rm(true);
        }
        yj(a) {
            for (let b of fromEnum(a)) {
                b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.yd));
            }
            this.rm(true);
        }
        w7(a) {
            if (a == null) {
                return false;
            }
            return true;
        }
        yd(a, b) {
            if (this.w7(a)) {
                this.yf(a, b.animate);
            }
        }
        w8(a) {
            if (a == null) {
                return false;
            }
            if (a.eq) {
                return false;
            }
            return true;
        }
        yn(a, b) {
            if (this.w8(a)) {
                this.yg(a, b.animate);
            }
        }
        yf(a, b) {
        }
        yg(a, b) {
        }
        ym(a, b) {
            this.yh(b);
        }
        yc(a, b) {
            this.ye(b);
        }
        zb() {
            if (this.u2 != null) {
                return this.u2;
            }
            return this.u8;
        }
        zc() {
            if (this.u6 != null) {
                return this.u6;
            }
            return this.vo;
        }
        ye(a) {
            if (a.oldItems != null) {
                for (let b of fromEn(a.oldItems)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.yd));
                }
            }
            if (a.newItems != null) {
                for (let c of fromEn(a.newItems)) {
                    c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.yd));
                }
            }
            this.rm(true);
        }
        yh(a) {
            if (a.oldItems != null) {
                for (let b of fromEn(a.oldItems)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.yn));
                }
            }
            if (a.newItems != null) {
                for (let c of fromEn(a.newItems)) {
                    c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.yn));
                }
            }
            this.rm(true);
        }
        sk(a, b) {
            this.rm(false);
        }
        sj(a, b) {
            this.rm(true);
        }
        rn(a) {
            super.rn(a);
            if (this.d3(this.ct)) {
                return;
            }
            if (this.gd(a) && !this.gp) {
                let b = this.w3;
                if (this.d1()) {
                    if (this.da.g) {
                        this.da.t();
                    }
                    this.w3 = this.w4;
                    this.w4 = b;
                }
                else {
                    this.w3 = this.w2;
                    this.w2 = b;
                }
                this.yi(this.w2, this.ct);
                this.r0();
            }
            else {
                if (!this.gp) {
                    this.yi(this.w2, this.ct);
                }
                this.yl(this.w2, this.ct);
            }
        }
        get_eq() {
            return true;
        }
        yi(a, b) {
        }
        yl(a, b) {
            this.qs();
            this.w1.b4();
        }
        yb(a) {
            let b = { $type: Point_$type, x: this.zl.x, y: this.zl.y };
            if (a.isVertical) {
                if (isNaN_(this.zl.y)) {
                    return new Tuple$2(Boolean_$type, Point_$type, false, b);
                }
                if (isNaN_(this.zl.x)) {
                    b.x = 0;
                    return new Tuple$2(Boolean_$type, Point_$type, true, b);
                }
            }
            else {
                if (isNaN_(this.zl.x)) {
                    return new Tuple$2(Boolean_$type, Point_$type, false, b);
                }
                if (isNaN_(this.zl.y)) {
                    b.y = 0;
                    return new Tuple$2(Boolean_$type, Point_$type, true, b);
                }
            }
            return new Tuple$2(Boolean_$type, Point_$type, true, b);
        }
        qm(a) {
            super.qm(a);
            if (isNaN_(this.zn.x) && isNaN_(this.zn.y)) {
                if (isNaN_(a.x) && isNaN_(a.y)) {
                    this.w1.b3();
                    return;
                }
                else {
                    this.w1.b5();
                    this.zl = a;
                }
            }
            else {
                this.w1.b5();
                this.zl = this.zn;
            }
            this.rm(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;
        }
        xm() {
            if (isNaN_(this.xp)) {
                switch (this.wp) {
                    case 1: return this.xg();
                    case 2: return this.xj();
                    case 4: return this.xi();
                }
            }
            return this.xp;
        }
        xl() {
            if (isNaN_(this.xo)) {
                return this.xe;
            }
            return this.xo;
        }
        xn() {
            if (isNaN_(this.xq)) {
                return this.xe;
            }
            return this.xq;
        }
        ww() {
            switch (this.ws) {
                case 0: return this.wt();
            }
            return this.ws;
        }
        wx() {
            switch (this.wz) {
                case 0: return this.wp;
            }
            return this.wz;
        }
        wy() {
            switch (this.w0) {
                case 0: return this.wp;
            }
            return this.w0;
        }
        zh() {
            if (this.zj == null) {
                if (this.vv == null) {
                    return this.zf();
                }
                return this.vv;
            }
            return this.zj;
        }
        zi() {
            if (this.zk == null) {
                if (this.vv == null) {
                    return this.zg();
                }
                return this.vv;
            }
            return this.zk;
        }
        wt() {
            return 0;
        }
        wu() {
            return this.wt();
        }
        wv() {
            return this.wt();
        }
        xg() {
            return NaN;
        }
        xj() {
            return NaN;
        }
        xi() {
            return NaN;
        }
        xh() {
            return NaN;
        }
        xk() {
            return NaN;
        }
        zf() {
            return null;
        }
        zg() {
            return null;
        }
        yq() {
            this.wp = this.ww();
            this.xe = this.xm();
            this.wq = this.wx();
            this.xd = this.xl();
            this.wr = this.wy();
            this.xf = this.xn();
            this.zd = this.zh();
            this.ze = this.zi();
        }
        get_g8() {
            return this.xa;
        }
        get xa() {
            return this.w5;
        }
        set xa(a) {
            let b = this.w5;
            this.w5 = a;
            this.raisePropertyChanged("ShouldRenderAsOverlay", b, this.w5);
        }
    }
    AnnotationLayer.$t = /*@__PURE__*/ markType(AnnotationLayer, 'AnnotationLayer', Series.$);
    AnnotationLayer.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, AnnotationLayer, 'raisePropertyChanged', ['ActualAppearanceMode:wp:yr', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualHorizontalAppearanceMode:wq:ys', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualHorizontalDashArray:zd:yt', [DoubleCollection.$], 'ActualHorizontalShiftAmount:xd:yu', [1, NaN], 'ActualShiftAmount:xe:yv', [1, NaN], 'ActualVerticalAppearanceMode:wr:yw', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualVerticalDashArray:ze:yx', [DoubleCollection.$], 'ActualVerticalShiftAmount:xf:yy', [1, NaN], 'AppearanceMode:ws:yz', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'CursorPosition:zm:y0', [Point_$type, { $type: Point_$type, x: NaN, y: NaN }], 'HorizontalAppearanceMode:wz:y1', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'HorizontalDashArray:zj:y2', [DoubleCollection.$], 'HorizontalShiftAmount:xo:y3', [1, NaN], 'IsDefaultCrosshairDisabled:w6:y4', [0, true], 'ShiftAmount:xp:y5', [1, NaN], 'UseIndex:xb:y6', [0, false], 'UseLegend:xc:y7', [0, false], 'VerticalAppearanceMode:w0:y8', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'VerticalDashArray:zk:y9', [DoubleCollection.$], 'VerticalShiftAmount:xq:za', [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.zl = { $type: Point_$type, x: NaN, y: NaN };
                this.b0.rm(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;
})();
