/*
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.zu = null;
            this.xa = null;
            this.w9 = null;
            this.xb = null;
            this.zs = { $type: Point_$type, x: NaN, y: NaN };
            this.xc = false;
            this.zu = { $type: Point_$type, x: NaN, y: NaN };
            this.yx();
        }
        cs() {
            return new AnnotationLayerView(this);
        }
        qz(a) {
            super.qz(a);
            this.w8 = a;
        }
        xg(a) {
            if (a == null) {
                return false;
            }
            if (a.es) {
                return false;
            }
            if (a.isValueOverlay) {
                return false;
            }
            if (a == this) {
                return false;
            }
            return a.he(a.cv.bx, a.cv.by, a.cv);
        }
        get_e1() {
            return this.xd;
        }
        b2() {
            if (this.b3 == 0) {
                return 1;
            }
            else {
                return super.b2();
            }
        }
        get_fg() {
            return this.xi || this.xj;
        }
        get_isUsableInLegend() {
            return this.xj;
        }
        q7(a, b, c, d) {
            super.q7(a, b, c, d);
            switch (b) {
                case "SeriesViewer":
                    let e = c;
                    let f = d;
                    if (e != null) {
                        this.yw(e.series);
                        let g = e.series;
                        g.collectionChanged = delegateRemove(g.collectionChanged, runOn(this, this.yt));
                        if (typeCast(XamDataChart.$, e) !== null) {
                            let h = e;
                            this.yv(h.axes);
                            let i = h.axes;
                            i.collectionChanged = delegateRemove(i.collectionChanged, runOn(this, this.yj));
                        }
                    }
                    if (f != null) {
                        this.yr(f.series);
                        let j = f.series;
                        j.collectionChanged = delegateCombine(j.collectionChanged, runOn(this, this.yt));
                        if (typeCast(XamDataChart.$, f) !== null) {
                            let k = f;
                            this.yq(k.axes);
                            let l = k.axes;
                            l.collectionChanged = delegateCombine(l.collectionChanged, runOn(this, this.yj));
                        }
                    }
                    break;
                case AnnotationLayer.$$p[16]:
                case AnnotationLayer.$$p[15]:
                    if (this.fg) {
                        if (this.index == -1) {
                            this.index = XamDataChart.yq(this);
                        }
                    }
                    else {
                        this.index = -1;
                        this.u7 = null;
                        this.vb = null;
                    }
                    if (this.db != null) {
                        this.db.pe();
                    }
                    this.rp(true);
                    break;
                case "TransitionProgress":
                    this.xb.c(this.jq, this.xa, this.w9);
                    if (this.d5(this.cv)) {
                        return;
                    }
                    if (this.jq == 1) {
                        this.ys(this.w9, this.cv);
                        this.qm();
                    }
                    else {
                        this.ys(this.xb, this.cv);
                    }
                    if (this.db != null) {
                        this.db.qo(this);
                    }
                    break;
                case AnnotationLayer.$$p[13]:
                    if (this.db != null) {
                        this.db.o8();
                    }
                    break;
                case AnnotationLayer.$$p[9]:
                    this.zu = this.zt;
                    this.qp(this.zt);
                    break;
                case "ShouldRenderAsOverlay":
                    if (this.db != null) {
                        this.cv.al(this.db);
                        this.cv.ag(this.db);
                    }
                    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.yx();
                    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.rp(true);
                    break;
            }
        }
        yw(a) {
            for (let b of fromEnum(a)) {
                if (!(b == this)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.yu));
                }
            }
            this.rp(true);
        }
        yv(a) {
            for (let b of fromEnum(a)) {
                b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.yk));
            }
            this.rp(true);
        }
        yr(a) {
            for (let b of fromEnum(a)) {
                if (!(b == this)) {
                    b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.yu));
                }
            }
            this.rp(true);
        }
        yq(a) {
            for (let b of fromEnum(a)) {
                b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.yk));
            }
            this.rp(true);
        }
        xe(a) {
            if (a == null) {
                return false;
            }
            return true;
        }
        yk(a, b) {
            if (this.xe(a)) {
                this.ym(a, b.animate);
            }
        }
        xf(a) {
            if (a == null) {
                return false;
            }
            if (a.es) {
                return false;
            }
            return true;
        }
        yu(a, b) {
            if (this.xf(a)) {
                this.yn(a, b.animate);
            }
        }
        ym(a, b) {
        }
        yn(a, b) {
        }
        yt(a, b) {
            this.yo(b);
        }
        yj(a, b) {
            this.yl(b);
        }
        zi() {
            if (this.u7 != null) {
                return this.u7;
            }
            return this.vd;
        }
        zj() {
            if (this.vb != null) {
                return this.vb;
            }
            return this.vt;
        }
        yl(a) {
            if (a.oldItems != null) {
                for (let b of fromEn(a.oldItems)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.yk));
                }
            }
            if (a.newItems != null) {
                for (let c of fromEn(a.newItems)) {
                    c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.yk));
                }
            }
            this.rp(true);
        }
        yo(a) {
            if (a.oldItems != null) {
                for (let b of fromEn(a.oldItems)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.yu));
                }
            }
            if (a.newItems != null) {
                for (let c of fromEn(a.newItems)) {
                    c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.yu));
                }
            }
            this.rp(true);
        }
        sp(a, b) {
            this.rp(false);
        }
        so(a, b) {
            this.rp(true);
        }
        rq(a) {
            super.rq(a);
            if (this.d5(this.cv)) {
                return;
            }
            if (this.gf(a) && !this.gr) {
                let b = this.xa;
                if (this.d3()) {
                    if (this.dc.g) {
                        this.dc.t();
                    }
                    this.xa = this.xb;
                    this.xb = b;
                }
                else {
                    this.xa = this.w9;
                    this.w9 = b;
                }
                this.yp(this.w9, this.cv);
                this.r5();
            }
            else {
                if (!this.gr) {
                    this.yp(this.w9, this.cv);
                }
                this.ys(this.w9, this.cv);
            }
        }
        get_es() {
            return true;
        }
        yp(a, b) {
        }
        ys(a, b) {
            this.qv();
            this.w8.b4();
        }
        yi(a) {
            let b = { $type: Point_$type, x: this.zs.x, y: this.zs.y };
            if (a.isVertical) {
                if (isNaN_(this.zs.y)) {
                    return new Tuple$2(Boolean_$type, Point_$type, false, b);
                }
                if (isNaN_(this.zs.x)) {
                    b.x = 0;
                    return new Tuple$2(Boolean_$type, Point_$type, true, b);
                }
            }
            else {
                if (isNaN_(this.zs.x)) {
                    return new Tuple$2(Boolean_$type, Point_$type, false, b);
                }
                if (isNaN_(this.zs.y)) {
                    b.y = 0;
                    return new Tuple$2(Boolean_$type, Point_$type, true, b);
                }
            }
            return new Tuple$2(Boolean_$type, Point_$type, true, b);
        }
        qp(a) {
            super.qp(a);
            if (isNaN_(this.zu.x) && isNaN_(this.zu.y)) {
                if (isNaN_(a.x) && isNaN_(a.y)) {
                    this.w8.b3();
                    return;
                }
                else {
                    this.w8.b5();
                    this.zs = a;
                }
            }
            else {
                this.w8.b5();
                this.zs = this.zu;
            }
            this.rp(true);
        }
        he(a, b, c) {
            let d = super.he(a, b, c);
            if (this.db == null) {
                return false;
            }
            if (!this.cv.t()) {
                d = false;
                return d;
            }
            return d;
        }
        xt() {
            if (isNaN_(this.xw)) {
                switch (this.ww) {
                    case 1: return this.xn();
                    case 2: return this.xq();
                    case 4: return this.xp();
                }
            }
            return this.xw;
        }
        xs() {
            if (isNaN_(this.xv)) {
                return this.xl;
            }
            return this.xv;
        }
        xu() {
            if (isNaN_(this.xx)) {
                return this.xl;
            }
            return this.xx;
        }
        w3() {
            switch (this.wz) {
                case 0: return this.w0();
            }
            return this.wz;
        }
        w4() {
            switch (this.w6) {
                case 0: return this.ww;
            }
            return this.w6;
        }
        w5() {
            switch (this.w7) {
                case 0: return this.ww;
            }
            return this.w7;
        }
        zo() {
            if (this.zq == null) {
                if (this.v0 == null) {
                    return this.zm();
                }
                return this.v0;
            }
            return this.zq;
        }
        zp() {
            if (this.zr == null) {
                if (this.v0 == null) {
                    return this.zn();
                }
                return this.v0;
            }
            return this.zr;
        }
        w0() {
            return 0;
        }
        w1() {
            return this.w0();
        }
        w2() {
            return this.w0();
        }
        xn() {
            return NaN;
        }
        xq() {
            return NaN;
        }
        xp() {
            return NaN;
        }
        xo() {
            return NaN;
        }
        xr() {
            return NaN;
        }
        zm() {
            return null;
        }
        zn() {
            return null;
        }
        yx() {
            this.ww = this.w3();
            this.xl = this.xt();
            this.wx = this.w4();
            this.xk = this.xs();
            this.wy = this.w5();
            this.xm = this.xu();
            this.zk = this.zo();
            this.zl = this.zp();
        }
        get_ha() {
            return this.xh;
        }
        get xh() {
            return this.xc;
        }
        set xh(a) {
            let b = this.xc;
            this.xc = a;
            this.raisePropertyChanged("ShouldRenderAsOverlay", b, this.xc);
        }
    }
    AnnotationLayer.$t = /*@__PURE__*/ markType(AnnotationLayer, 'AnnotationLayer', Series.$);
    AnnotationLayer.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, AnnotationLayer, 'raisePropertyChanged', ['ActualAppearanceMode:ww:yy', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualHorizontalAppearanceMode:wx:yz', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualHorizontalDashArray:zk:y0', [DoubleCollection.$], 'ActualHorizontalShiftAmount:xk:y1', [1, NaN], 'ActualShiftAmount:xl:y2', [1, NaN], 'ActualVerticalAppearanceMode:wy:y3', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualVerticalDashArray:zl:y4', [DoubleCollection.$], 'ActualVerticalShiftAmount:xm:y5', [1, NaN], 'AppearanceMode:wz:y6', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'CursorPosition:zt:y7', [Point_$type, { $type: Point_$type, x: NaN, y: NaN }], 'HorizontalAppearanceMode:w6:y8', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'HorizontalDashArray:zq:y9', [DoubleCollection.$], 'HorizontalShiftAmount:xv:za', [1, NaN], 'IsDefaultCrosshairDisabled:xd:zb', [0, true], 'ShiftAmount:xw:zc', [1, NaN], 'UseIndex:xi:zd', [0, false], 'UseLegend:xj:ze', [0, false], 'VerticalAppearanceMode:w7:zf', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'VerticalDashArray:zr:zg', [DoubleCollection.$], 'VerticalShiftAmount:xx:zh', [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.zs = { $type: Point_$type, x: NaN, y: NaN };
                this.b0.rp(true);
            }
        }
        b3() {
            this.b1 = true;
            if (this.e.jz != null) {
                this.e.jz.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;
})();
