/*
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.wz = null;
            this.uf = null;
            this.ue = null;
            this.ug = null;
            this.wx = { $type: Point_$type, x: NaN, y: NaN };
            this.uh = false;
            this.wz = { $type: Point_$type, x: NaN, y: NaN };
            this.v2();
        }
        cg() {
            return new AnnotationLayerView(this);
        }
        o0(a) {
            super.o0(a);
            this.ud = a;
        }
        ul(a) {
            if (a == null) {
                return false;
            }
            if (a.d6) {
                return false;
            }
            if (a.isValueOverlay) {
                return false;
            }
            if (a == this) {
                return false;
            }
            return a.gl(a.cj.bx, a.cj.by, a.cj);
        }
        get_ef() {
            return this.ui;
        }
        bx() {
            if (this.by == 0) {
                return 1;
            }
            else {
                return super.bx();
            }
        }
        get_et() {
            return this.un || this.uo;
        }
        get_isUsableInLegend() {
            return this.uo;
        }
        o8(a, b, c, d) {
            super.o8(a, b, c, d);
            switch (b) {
                case "SeriesViewer":
                    let e = c;
                    let f = d;
                    if (e != null) {
                        this.v1(e.series);
                        let g = e.series;
                        g.collectionChanged = delegateRemove(g.collectionChanged, runOn(this, this.vy));
                        if (typeCast(XamDataChart.$, e) !== null) {
                            let h = e;
                            this.v0(h.axes);
                            let i = h.axes;
                            i.collectionChanged = delegateRemove(i.collectionChanged, runOn(this, this.vo));
                        }
                    }
                    if (f != null) {
                        this.vw(f.series);
                        let j = f.series;
                        j.collectionChanged = delegateCombine(j.collectionChanged, runOn(this, this.vy));
                        if (typeCast(XamDataChart.$, f) !== null) {
                            let k = f;
                            this.vv(k.axes);
                            let l = k.axes;
                            l.collectionChanged = delegateCombine(l.collectionChanged, runOn(this, this.vo));
                        }
                    }
                    break;
                case AnnotationLayer.$$p[16]:
                case AnnotationLayer.$$p[15]:
                    if (this.et) {
                        if (this.index == -1) {
                            this.index = XamDataChart.v9(this);
                        }
                    }
                    else {
                        this.index = -1;
                        this.ss = null;
                        this.sv = null;
                    }
                    if (this.cy != null) {
                        this.cy.ni();
                    }
                    this.pp(true);
                    break;
                case "TransitionProgress":
                    this.ug.c(this.iv, this.uf, this.ue);
                    if (this.dl(this.cj)) {
                        return;
                    }
                    if (this.iv == 1) {
                        this.vx(this.ue, this.cj);
                    }
                    else {
                        this.vx(this.ug, this.cj);
                    }
                    if (this.cy != null) {
                        this.cy.on(this);
                    }
                    break;
                case AnnotationLayer.$$p[13]:
                    if (this.cy != null) {
                        this.cy.ng();
                    }
                    break;
                case AnnotationLayer.$$p[9]:
                    this.wz = this.wy;
                    this.oq(this.wy);
                    break;
                case "ShouldRenderAsOverlay":
                    if (this.cy != null) {
                        this.cj.al(this.cy);
                        this.cj.ag(this.cy);
                    }
                    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.v2();
                    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.pp(true);
                    break;
            }
        }
        v1(a) {
            for (let b of fromEnum(a)) {
                if (!(b == this)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.vz));
                }
            }
            this.pp(true);
        }
        v0(a) {
            for (let b of fromEnum(a)) {
                b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.vp));
            }
            this.pp(true);
        }
        vw(a) {
            for (let b of fromEnum(a)) {
                if (!(b == this)) {
                    b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.vz));
                }
            }
            this.pp(true);
        }
        vv(a) {
            for (let b of fromEnum(a)) {
                b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.vp));
            }
            this.pp(true);
        }
        uj(a) {
            if (a == null) {
                return false;
            }
            return true;
        }
        vp(a, b) {
            if (this.uj(a)) {
                this.vr(a, b.animate);
            }
        }
        uk(a) {
            if (a == null) {
                return false;
            }
            if (a.d6) {
                return false;
            }
            return true;
        }
        vz(a, b) {
            if (this.uk(a)) {
                this.vs(a, b.animate);
            }
        }
        vr(a, b) {
        }
        vs(a, b) {
        }
        vy(a, b) {
            this.vt(b);
        }
        vo(a, b) {
            this.vq(b);
        }
        wn() {
            if (this.ss != null) {
                return this.ss;
            }
            return this.sw;
        }
        wo() {
            if (this.sv != null) {
                return this.sv;
            }
            return this.s2;
        }
        vq(a) {
            if (a.oldItems != null) {
                for (let b of fromEn(a.oldItems)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.vp));
                }
            }
            if (a.newItems != null) {
                for (let c of fromEn(a.newItems)) {
                    c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.vp));
                }
            }
            this.pp(true);
        }
        vt(a) {
            if (a.oldItems != null) {
                for (let b of fromEn(a.oldItems)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.vz));
                }
            }
            if (a.newItems != null) {
                for (let c of fromEn(a.newItems)) {
                    c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.vz));
                }
            }
            this.pp(true);
        }
        qn(a, b) {
            this.pp(false);
        }
        qm(a, b) {
            this.pp(true);
        }
        pq(a) {
            super.pq(a);
            if (this.dl(this.cj)) {
                return;
            }
            if (this.fp(a) && !this.f0) {
                let b = this.uf;
                if (this.dj()) {
                    if (this.cz.g) {
                        this.cz.t();
                    }
                    this.uf = this.ug;
                    this.ug = b;
                }
                else {
                    this.uf = this.ue;
                    this.ue = b;
                }
                this.vu(this.ue, this.cj);
                this.p3();
            }
            else {
                if (!this.f0) {
                    this.vu(this.ue, this.cj);
                }
                this.vx(this.ue, this.cj);
            }
        }
        get_d6() {
            return true;
        }
        vu(a, b) {
        }
        vx(a, b) {
            this.ow();
            this.ud.b4();
        }
        vn(a) {
            let b = { $type: Point_$type, x: this.wx.x, y: this.wx.y };
            if (a.isVertical) {
                if (isNaN_(this.wx.y)) {
                    return new Tuple$2(Boolean_$type, Point_$type, false, b);
                }
                if (isNaN_(this.wx.x)) {
                    b.x = 0;
                    return new Tuple$2(Boolean_$type, Point_$type, true, b);
                }
            }
            else {
                if (isNaN_(this.wx.x)) {
                    return new Tuple$2(Boolean_$type, Point_$type, false, b);
                }
                if (isNaN_(this.wx.y)) {
                    b.y = 0;
                    return new Tuple$2(Boolean_$type, Point_$type, true, b);
                }
            }
            return new Tuple$2(Boolean_$type, Point_$type, true, b);
        }
        oq(a) {
            super.oq(a);
            if (isNaN_(this.wz.x) && isNaN_(this.wz.y)) {
                if (isNaN_(a.x) && isNaN_(a.y)) {
                    this.ud.b3();
                    return;
                }
                else {
                    this.ud.b5();
                    this.wx = a;
                }
            }
            else {
                this.ud.b5();
                this.wx = this.wz;
            }
            this.pp(true);
        }
        gl(a, b, c) {
            let d = super.gl(a, b, c);
            if (this.cy == null) {
                return false;
            }
            if (!this.cj.t()) {
                d = false;
                return d;
            }
            return d;
        }
        uy() {
            if (isNaN_(this.u1)) {
                switch (this.t1) {
                    case 1: return this.us();
                    case 2: return this.uv();
                    case 4: return this.uu();
                }
            }
            return this.u1;
        }
        ux() {
            if (isNaN_(this.u0)) {
                return this.uq;
            }
            return this.u0;
        }
        uz() {
            if (isNaN_(this.u2)) {
                return this.uq;
            }
            return this.u2;
        }
        t8() {
            switch (this.t4) {
                case 0: return this.t5();
            }
            return this.t4;
        }
        t9() {
            switch (this.ub) {
                case 0: return this.t1;
            }
            return this.ub;
        }
        ua() {
            switch (this.uc) {
                case 0: return this.t1;
            }
            return this.uc;
        }
        wt() {
            if (this.wv == null) {
                if (this.s7 == null) {
                    return this.wr();
                }
                return this.s7;
            }
            return this.wv;
        }
        wu() {
            if (this.ww == null) {
                if (this.s7 == null) {
                    return this.ws();
                }
                return this.s7;
            }
            return this.ww;
        }
        t5() {
            return 0;
        }
        t6() {
            return this.t5();
        }
        t7() {
            return this.t5();
        }
        us() {
            return NaN;
        }
        uv() {
            return NaN;
        }
        uu() {
            return NaN;
        }
        ut() {
            return NaN;
        }
        uw() {
            return NaN;
        }
        wr() {
            return null;
        }
        ws() {
            return null;
        }
        v2() {
            this.t1 = this.t8();
            this.uq = this.uy();
            this.t2 = this.t9();
            this.up = this.ux();
            this.t3 = this.ua();
            this.ur = this.uz();
            this.wp = this.wt();
            this.wq = this.wu();
        }
        get_gh() {
            return this.um;
        }
        get um() {
            return this.uh;
        }
        set um(a) {
            let b = this.uh;
            this.uh = a;
            this.raisePropertyChanged("ShouldRenderAsOverlay", b, this.uh);
        }
    }
    AnnotationLayer.$t = /*@__PURE__*/ markType(AnnotationLayer, 'AnnotationLayer', Series.$);
    AnnotationLayer.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, AnnotationLayer, 'raisePropertyChanged', ['ActualAppearanceMode:t1:v3', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualHorizontalAppearanceMode:t2:v4', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualHorizontalDashArray:wp:v5', [DoubleCollection.$], 'ActualHorizontalShiftAmount:up:v6', [1, NaN], 'ActualShiftAmount:uq:v7', [1, NaN], 'ActualVerticalAppearanceMode:t3:v8', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'ActualVerticalDashArray:wq:v9', [DoubleCollection.$], 'ActualVerticalShiftAmount:ur:wa', [1, NaN], 'AppearanceMode:t4:wb', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'CursorPosition:wy:wc', [Point_$type, { $type: Point_$type, x: NaN, y: NaN }], 'HorizontalAppearanceMode:ub:wd', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'HorizontalDashArray:wv:we', [DoubleCollection.$], 'HorizontalShiftAmount:u0:wf', [1, NaN], 'IsDefaultCrosshairDisabled:ui:wg', [0, true], 'ShiftAmount:u1:wh', [1, NaN], 'UseIndex:un:wi', [0, false], 'UseLegend:uo:wj', [0, false], 'VerticalAppearanceMode:uc:wk', [AnnotationAppearanceMode_$type, /*@__PURE__*/ enumGetBox(AnnotationAppearanceMode_$type, 0)], 'VerticalDashArray:ww:wl', [DoubleCollection.$], 'VerticalShiftAmount:u2:wm', [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.wx = { $type: Point_$type, x: NaN, y: NaN };
                this.b0.pp(true);
            }
        }
        b3() {
            this.b1 = true;
            if (this.e.i4 != null) {
                this.e.i4.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;
})();
