/*
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 * as tslib_1 from "tslib";
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
 */
var AnnotationLayer = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(AnnotationLayer, _super);
    function AnnotationLayer() {
        var _this = _super.call(this) || this;
        _this.pc = null;
        _this.ob = null;
        _this.oa = null;
        _this.oc = null;
        _this.pa = { $type: Point_$type, x: NaN, y: NaN };
        _this.od = false;
        _this.pc = { $type: Point_$type, x: NaN, y: NaN };
        return _this;
    }
    AnnotationLayer.prototype.bp = function () {
        return new AnnotationLayerView(this);
    };
    AnnotationLayer.prototype.kk = function (a) {
        _super.prototype.kk.call(this, a);
        this.n9 = a;
    };
    AnnotationLayer.prototype.oh = function (a) {
        if (a == null) {
            return false;
        }
        if (a.cx) {
            return false;
        }
        if (a.dm) {
            return false;
        }
        if (a == this) {
            return false;
        }
        return a.ec(a.bs.bu, a.bs.bv, a.bs);
    };
    AnnotationLayer.prototype.get_c1 = function () {
        return this.oe;
    };
    AnnotationLayer.prototype.bj = function () {
        if (this.bk == 0) {
            return 1;
        }
        else {
            return _super.prototype.bj.call(this);
        }
    };
    AnnotationLayer.prototype.get_db = function () {
        return this.oj || this.ok;
    };
    AnnotationLayer.prototype.get_isUsableInLegend = function () {
        return this.ok;
    };
    AnnotationLayer.prototype.kp = function (a, b, c, d) {
        _super.prototype.kp.call(this, a, b, c, d);
        switch (b) {
            case "SeriesViewer":
                var e = c;
                var f = d;
                if (e != null) {
                    this.o3(e.series);
                    var g = e.series;
                    g.collectionChanged = delegateRemove(g.collectionChanged, runOn(this, this.o0));
                    if (typeCast(XamDataChart.$, e) !== null) {
                        var h = e;
                        this.o2(h.axes);
                        var i = h.axes;
                        i.collectionChanged = delegateRemove(i.collectionChanged, runOn(this, this.oq));
                    }
                }
                if (f != null) {
                    this.oy(f.series);
                    var j = f.series;
                    j.collectionChanged = delegateCombine(j.collectionChanged, runOn(this, this.o0));
                    if (typeCast(XamDataChart.$, f) !== null) {
                        var k = f;
                        this.ox(k.axes);
                        var l = k.axes;
                        l.collectionChanged = delegateCombine(l.collectionChanged, runOn(this, this.oq));
                    }
                }
                break;
            case AnnotationLayer.$$p[3]:
            case AnnotationLayer.$$p[2]:
                if (this.db) {
                    if (this.gi == -1) {
                        this.gi = XamDataChart.qw(this);
                    }
                }
                else {
                    this.gi = -1;
                    this.m9 = null;
                    this.na = null;
                }
                if (this.b6 != null) {
                    this.b6.j5();
                }
                this.k3(true);
                break;
            case "TransitionProgress":
                this.oc.c(this.fw, this.ob, this.oa);
                if (this.cp(this.bs)) {
                    return;
                }
                if (this.fw == 1) {
                    this.oz(this.oa, this.bs);
                }
                else {
                    this.oz(this.oc, this.bs);
                }
                if (this.b6 != null) {
                    this.b6.k7(this);
                }
                break;
            case AnnotationLayer.$$p[1]:
                if (this.b6 != null) {
                    this.b6.j3();
                }
                break;
            case AnnotationLayer.$$p[0]:
                this.pc = this.pb;
                this.ke(this.pb);
                break;
            case "ShouldRenderAsOverlay":
                if (this.b6 != null) {
                    this.bs.ak(this.b6);
                    this.bs.ag(this.b6);
                }
                break;
        }
    };
    AnnotationLayer.prototype.o3 = function (a) {
        var e_1, _a;
        try {
            for (var _b = tslib_1.__values(fromEnum(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                if (!(b == this)) {
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.o1));
                }
            }
        }
        catch (e_1_1) {
            e_1 = { error: e_1_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_1)
                    throw e_1.error;
            }
        }
        this.k3(true);
    };
    AnnotationLayer.prototype.o2 = function (a) {
        var e_2, _a;
        try {
            for (var _b = tslib_1.__values(fromEnum(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.or));
            }
        }
        catch (e_2_1) {
            e_2 = { error: e_2_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_2)
                    throw e_2.error;
            }
        }
        this.k3(true);
    };
    AnnotationLayer.prototype.oy = function (a) {
        var e_3, _a;
        try {
            for (var _b = tslib_1.__values(fromEnum(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                if (!(b == this)) {
                    b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.o1));
                }
            }
        }
        catch (e_3_1) {
            e_3 = { error: e_3_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_3)
                    throw e_3.error;
            }
        }
        this.k3(true);
    };
    AnnotationLayer.prototype.ox = function (a) {
        var e_4, _a;
        try {
            for (var _b = tslib_1.__values(fromEnum(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                b.renderRequested = delegateCombine(b.renderRequested, runOn(this, this.or));
            }
        }
        catch (e_4_1) {
            e_4 = { error: e_4_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_4)
                    throw e_4.error;
            }
        }
        this.k3(true);
    };
    AnnotationLayer.prototype.of = function (a) {
        if (a == null) {
            return false;
        }
        return true;
    };
    AnnotationLayer.prototype.or = function (a, b) {
        if (this.of(a)) {
            this.ot(a, b.animate);
        }
    };
    AnnotationLayer.prototype.og = function (a) {
        if (a == null) {
            return false;
        }
        if (a.cx) {
            return false;
        }
        return true;
    };
    AnnotationLayer.prototype.o1 = function (a, b) {
        if (this.og(a)) {
            this.ou(a, b.animate);
        }
    };
    AnnotationLayer.prototype.ot = function (a, b) {
    };
    AnnotationLayer.prototype.ou = function (a, b) {
    };
    AnnotationLayer.prototype.o0 = function (a, b) {
        this.ov(b);
    };
    AnnotationLayer.prototype.oq = function (a, b) {
        this.os(b);
    };
    AnnotationLayer.prototype.o8 = function () {
        if (this.m9 != null) {
            return this.m9;
        }
        return this.nb;
    };
    AnnotationLayer.prototype.o9 = function () {
        if (this.na != null) {
            return this.na;
        }
        return this.ng;
    };
    AnnotationLayer.prototype.os = function (a) {
        var e_5, _a, e_6, _b;
        if (a.oldItems != null) {
            try {
                for (var _c = tslib_1.__values(fromEn(a.oldItems)), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var b = _d.value;
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.or));
                }
            }
            catch (e_5_1) {
                e_5 = { error: e_5_1 };
            }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return))
                        _a.call(_c);
                }
                finally {
                    if (e_5)
                        throw e_5.error;
                }
            }
        }
        if (a.newItems != null) {
            try {
                for (var _e = tslib_1.__values(fromEn(a.newItems)), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var c = _f.value;
                    c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.or));
                }
            }
            catch (e_6_1) {
                e_6 = { error: e_6_1 };
            }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return))
                        _b.call(_e);
                }
                finally {
                    if (e_6)
                        throw e_6.error;
                }
            }
        }
        this.k3(true);
    };
    AnnotationLayer.prototype.ov = function (a) {
        var e_7, _a, e_8, _b;
        if (a.oldItems != null) {
            try {
                for (var _c = tslib_1.__values(fromEn(a.oldItems)), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var b = _d.value;
                    b.renderRequested = delegateRemove(b.renderRequested, runOn(this, this.o1));
                }
            }
            catch (e_7_1) {
                e_7 = { error: e_7_1 };
            }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return))
                        _a.call(_c);
                }
                finally {
                    if (e_7)
                        throw e_7.error;
                }
            }
        }
        if (a.newItems != null) {
            try {
                for (var _e = tslib_1.__values(fromEn(a.newItems)), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var c = _f.value;
                    c.renderRequested = delegateCombine(c.renderRequested, runOn(this, this.o1));
                }
            }
            catch (e_8_1) {
                e_8 = { error: e_8_1 };
            }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return))
                        _b.call(_e);
                }
                finally {
                    if (e_8)
                        throw e_8.error;
                }
            }
        }
        this.k3(true);
    };
    AnnotationLayer.prototype.lo = function (a, b) {
        this.k3(false);
    };
    AnnotationLayer.prototype.ln = function (a, b) {
        this.k3(true);
    };
    AnnotationLayer.prototype.k4 = function (a) {
        _super.prototype.k4.call(this, a);
        if (this.cp(this.bs)) {
            return;
        }
        if (this.dr(a) && !this.dv) {
            var b = this.ob;
            if (this.cn()) {
                if (this.b7.g) {
                    this.b7.t();
                }
                this.ob = this.oc;
                this.oc = b;
            }
            else {
                this.ob = this.oa;
                this.oa = b;
            }
            this.ow(this.oa, this.bs);
            this.lb();
        }
        else {
            if (!this.dv) {
                this.ow(this.oa, this.bs);
            }
            this.oz(this.oa, this.bs);
        }
    };
    AnnotationLayer.prototype.get_cx = function () {
        return true;
    };
    AnnotationLayer.prototype.ow = function (a, b) {
    };
    AnnotationLayer.prototype.oz = function (a, b) {
        this.n9.b1();
    };
    AnnotationLayer.prototype.op = function (a) {
        var b = { $type: Point_$type, x: this.pa.x, y: this.pa.y };
        if (a.isVertical) {
            if (isNaN_(this.pa.y)) {
                return new Tuple$2(Boolean_$type, Point_$type, false, b);
            }
            if (isNaN_(this.pa.x)) {
                b.x = 0;
                return new Tuple$2(Boolean_$type, Point_$type, true, b);
            }
        }
        else {
            if (isNaN_(this.pa.x)) {
                return new Tuple$2(Boolean_$type, Point_$type, false, b);
            }
            if (isNaN_(this.pa.y)) {
                b.y = 0;
                return new Tuple$2(Boolean_$type, Point_$type, true, b);
            }
        }
        return new Tuple$2(Boolean_$type, Point_$type, true, b);
    };
    AnnotationLayer.prototype.ke = function (a) {
        _super.prototype.ke.call(this, a);
        if (isNaN_(this.pc.x) && isNaN_(this.pc.y)) {
            if (isNaN_(a.x) && isNaN_(a.y)) {
                this.n9.b0();
                return;
            }
            else {
                this.n9.b2();
                this.pa = a;
            }
        }
        else {
            this.n9.b2();
            this.pa = this.pc;
        }
        this.k3(true);
    };
    AnnotationLayer.prototype.ec = function (a, b, c) {
        var d = _super.prototype.ec.call(this, a, b, c);
        if (!this.bs.t()) {
            d = false;
            return d;
        }
        return d;
    };
    AnnotationLayer.prototype.get_d8 = function () {
        return this.oi;
    };
    Object.defineProperty(AnnotationLayer.prototype, "oi", {
        get: function () {
            return this.od;
        },
        set: function (a) {
            var b = this.od;
            this.od = a;
            this.raisePropertyChanged("ShouldRenderAsOverlay", b, this.od);
        },
        enumerable: true,
        configurable: true
    });
    AnnotationLayer.$t = markType(AnnotationLayer, 'AnnotationLayer', Series.$);
    AnnotationLayer.$$p = markDep(DependencyProperty, PropertyMetadata, AnnotationLayer, 'raisePropertyChanged', ['CursorPosition:pb:o4', [Point_$type, { $type: Point_$type, x: NaN, y: NaN }], 'IsDefaultCrosshairDisabled:oe:o5', [0, true], 'UseIndex:oj:o6', [0, false], 'UseLegend:ok:o7', [0, false]]);
    return AnnotationLayer;
}(Series));
export { AnnotationLayer };
/**
 * @hidden
 */
var AnnotationLayerView = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(AnnotationLayerView, _super);
    function AnnotationLayerView(a) {
        var _this = _super.call(this, a) || this;
        _this.bx = null;
        _this.by = false;
        _this.bz = -1;
        _this.bx = a;
        return _this;
    }
    AnnotationLayerView.prototype.b3 = function () {
        if (this.by) {
            this.by = false;
            this.bz = -1;
            this.bx.pa = { $type: Point_$type, x: NaN, y: NaN };
            this.bx.k3(true);
        }
    };
    AnnotationLayerView.prototype.b0 = function () {
        this.by = true;
        if (this.e.f5 != null) {
            this.e.f5.setTimeout(runOn(this, this.b3), 300);
        }
        else {
            this.bz = window.setTimeout(runOn(this, this.b3), 300);
        }
    };
    AnnotationLayerView.prototype.b2 = function () {
        if (this.by == true) {
            this.by = false;
            if (this.bz != -1) {
                window.clearTimeout(this.bz);
                this.bz = -1;
            }
        }
    };
    AnnotationLayerView.prototype.b1 = function () {
        this.aq();
    };
    AnnotationLayerView.$t = markType(AnnotationLayerView, 'AnnotationLayerView', SeriesView.$);
    return AnnotationLayerView;
}(SeriesView));
export { AnnotationLayerView };
//# sourceMappingURL=AnnotationLayer_combined.js.map
