/*
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, runOn, delegateRemove, typeCast, delegateCombine, fromEnum, fromEn, markType, markDep } 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.nd = null;
            this.mc = null;
            this.mb = null;
            this.md = null;
            this.nb = { $type: Point_$type, x: NaN, y: NaN };
            this.me = false;
            this.nd = { $type: Point_$type, x: NaN, y: NaN };
        }
        bf() {
            return new AnnotationLayerView(this);
        }
        i2(a) {
            super.i2(a);
            this.ma = a;
        }
        mi(a) {
            if (a == null) {
                return false;
            }
            if (a.cj) {
                return false;
            }
            if (a.c6) {
                return false;
            }
            if (a == this) {
                return false;
            }
            return a.dw(a.bi.br, a.bi.bs, a.bi);
        }
        get_cm() {
            return this.mf;
        }
        bd() {
            if (this.be == 0) {
                return 1;
            }
            else {
                return super.bd();
            }
        }
        get_cw() {
            return this.mk || this.ml;
        }
        get_isUsableInLegend() {
            return this.ml;
        }
        i7(a, b, c, d) {
            super.i7(a, b, c, d);
            switch (b) {
                case "SeriesViewer":
                    let e = c;
                    let f = d;
                    if (e != null) {
                        this.m4(e.series);
                        let g = e.series;
                        g.collectionChanged = delegateRemove(g.collectionChanged, runOn(this, this.m1));
                        if (typeCast(XamDataChart.$, e) !== null) {
                            let h = e;
                            this.m3(h.axes);
                            let i = h.axes;
                            i.collectionChanged = delegateRemove(i.collectionChanged, runOn(this, this.mr));
                        }
                    }
                    if (f != null) {
                        this.mz(f.series);
                        let j = f.series;
                        j.collectionChanged = delegateCombine(j.collectionChanged, runOn(this, this.m1));
                        if (typeCast(XamDataChart.$, f) !== null) {
                            let k = f;
                            this.my(k.axes);
                            let l = k.axes;
                            l.collectionChanged = delegateCombine(l.collectionChanged, runOn(this, this.mr));
                        }
                    }
                    break;
                case AnnotationLayer.$$p[3]:
                case AnnotationLayer.$$p[2]:
                    if (this.cw) {
                        if (this.fh == -1) {
                            this.fh = XamDataChart.pw(this);
                        }
                    }
                    else {
                        this.fh = -1;
                        this.lb = null;
                        this.lc = null;
                    }
                    if (this.bs != null) {
                        this.bs.jm();
                    }
                    this.jl(true);
                    break;
                case "TransitionProgress":
                    this.md.c(this.ez, this.mc, this.mb);
                    if (this.cc(this.bi)) {
                        return;
                    }
                    if (this.ez == 1) {
                        this.m0(this.mb, this.bi);
                    }
                    else {
                        this.m0(this.md, this.bi);
                    }
                    if (this.bs != null) {
                        this.bs.ko(this);
                    }
                    break;
                case AnnotationLayer.$$p[1]:
                    if (this.bs != null) {
                        this.bs.jk();
                    }
                    break;
                case AnnotationLayer.$$p[0]:
                    this.nd = this.nc;
                    this.ix(this.nc);
                    break;
                case "ShouldRenderAsOverlay":
                    if (this.bs != null) {
                        this.bi.ah(this.bs);
                        this.bi.ad(this.bs);
                    }
                    break;
            }
        }
        m4(a) {
            for (let b of fromEnum(a)) {
                if (!(b == this)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.m2));
                }
            }
            this.jl(true);
        }
        m3(a) {
            for (let b of fromEnum(a)) {
                b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.ms));
            }
            this.jl(true);
        }
        mz(a) {
            for (let b of fromEnum(a)) {
                if (!(b == this)) {
                    b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.m2));
                }
            }
            this.jl(true);
        }
        my(a) {
            for (let b of fromEnum(a)) {
                b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.ms));
            }
            this.jl(true);
        }
        mg(a) {
            if (a == null) {
                return false;
            }
            return true;
        }
        ms(a, b) {
            if (this.mg(a)) {
                this.mu(a, b.animate);
            }
        }
        mh(a) {
            if (a == null) {
                return false;
            }
            if (a.cj) {
                return false;
            }
            return true;
        }
        m2(a, b) {
            if (this.mh(a)) {
                this.mv(a, b.animate);
            }
        }
        mu(a, b) {
        }
        mv(a, b) {
        }
        m1(a, b) {
            this.mw(b);
        }
        mr(a, b) {
            this.mt(b);
        }
        m9() {
            if (this.lb != null) {
                return this.lb;
            }
            return this.ld;
        }
        na() {
            if (this.lc != null) {
                return this.lc;
            }
            return this.li;
        }
        mt(a) {
            if (a.oldItems != null) {
                for (let b of fromEn(a.oldItems)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.ms));
                }
            }
            if (a.newItems != null) {
                for (let c of fromEn(a.newItems)) {
                    c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.ms));
                }
            }
            this.jl(true);
        }
        mw(a) {
            if (a.oldItems != null) {
                for (let b of fromEn(a.oldItems)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.m2));
                }
            }
            if (a.newItems != null) {
                for (let c of fromEn(a.newItems)) {
                    c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.m2));
                }
            }
            this.jl(true);
        }
        j1(a, b) {
            this.jl(false);
        }
        j0(a, b) {
            this.jl(true);
        }
        jm(a) {
            super.jm(a);
            if (this.cc(this.bi)) {
                return;
            }
            if (this.da(a) && !this.de) {
                let b = this.mc;
                if (this.ca()) {
                    if (this.bt.g) {
                        this.bt.t();
                    }
                    this.mc = this.md;
                    this.md = b;
                }
                else {
                    this.mc = this.mb;
                    this.mb = b;
                }
                this.mx(this.mb, this.bi);
                this.jt();
            }
            else {
                if (!this.de) {
                    this.mx(this.mb, this.bi);
                }
                this.m0(this.mb, this.bi);
            }
        }
        get_cj() {
            return true;
        }
        mx(a, b) {
        }
        m0(a, b) {
            this.ma.by();
        }
        mq(a) {
            let b = { $type: Point_$type, x: this.nb.x, y: this.nb.y };
            if (a.isVertical) {
                if (isNaN_(this.nb.y)) {
                    return new Tuple$2(Boolean_$type, Point_$type, false, b);
                }
                if (isNaN_(this.nb.x)) {
                    b.x = 0;
                    return new Tuple$2(Boolean_$type, Point_$type, true, b);
                }
            }
            else {
                if (isNaN_(this.nb.x)) {
                    return new Tuple$2(Boolean_$type, Point_$type, false, b);
                }
                if (isNaN_(this.nb.y)) {
                    b.y = 0;
                    return new Tuple$2(Boolean_$type, Point_$type, true, b);
                }
            }
            return new Tuple$2(Boolean_$type, Point_$type, true, b);
        }
        ix(a) {
            super.ix(a);
            if (isNaN_(this.nd.x) && isNaN_(this.nd.y)) {
                if (isNaN_(a.x) && isNaN_(a.y)) {
                    this.ma.bx();
                    return;
                }
                else {
                    this.ma.bz();
                    this.nb = a;
                }
            }
            else {
                this.ma.bz();
                this.nb = this.nd;
            }
            this.jl(true);
        }
        dw(a, b, c) {
            let d = super.dw(a, b, c);
            if (!this.bi.q()) {
                d = false;
                return d;
            }
            return d;
        }
        get_ds() {
            return this.mj;
        }
        get mj() {
            return this.me;
        }
        set mj(a) {
            let b = this.me;
            this.me = a;
            this.raisePropertyChanged("ShouldRenderAsOverlay", b, this.me);
        }
    }
    AnnotationLayer.$t = /*@__PURE__*/ markType(AnnotationLayer, 'AnnotationLayer', Series.$);
    AnnotationLayer.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, AnnotationLayer, 'raisePropertyChanged', ['CursorPosition:nc:m5', [Point_$type, { $type: Point_$type, x: NaN, y: NaN }], 'IsDefaultCrosshairDisabled:mf:m6', [0, true], 'UseIndex:mk:m7', [0, false], 'UseLegend:ml:m8', [0, false]]);
    return AnnotationLayer;
})();
/**
 * @hidden
 */
export let AnnotationLayerView = /*@__PURE__*/ (() => {
    class AnnotationLayerView extends SeriesView {
        constructor(a) {
            super(a);
            this.bu = null;
            this.bv = false;
            this.bw = -1;
            this.bu = a;
        }
        b0() {
            if (this.bv) {
                this.bv = false;
                this.bw = -1;
                this.bu.nb = { $type: Point_$type, x: NaN, y: NaN };
                this.bu.jl(true);
            }
        }
        bx() {
            this.bv = true;
            if (this.e.e4 != null) {
                this.e.e4.setTimeout(runOn(this, this.b0), 300);
            }
            else {
                this.bw = window.setTimeout(runOn(this, this.b0), 300);
            }
        }
        bz() {
            if (this.bv == true) {
                this.bv = false;
                if (this.bw != -1) {
                    window.clearTimeout(this.bw);
                    this.bw = -1;
                }
            }
        }
        by() {
            this.an();
        }
    }
    AnnotationLayerView.$t = /*@__PURE__*/ markType(AnnotationLayerView, 'AnnotationLayerView', SeriesView.$);
    return AnnotationLayerView;
})();
//# sourceMappingURL=AnnotationLayer_combined.js.map
