/*
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.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 };
        return _this;
    }
    AnnotationLayer.prototype.bf = function () {
        return new AnnotationLayerView(this);
    };
    AnnotationLayer.prototype.i2 = function (a) {
        _super.prototype.i2.call(this, a);
        this.ma = a;
    };
    AnnotationLayer.prototype.mi = function (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);
    };
    AnnotationLayer.prototype.get_cm = function () {
        return this.mf;
    };
    AnnotationLayer.prototype.bd = function () {
        if (this.be == 0) {
            return 1;
        }
        else {
            return _super.prototype.bd.call(this);
        }
    };
    AnnotationLayer.prototype.get_cw = function () {
        return this.mk || this.ml;
    };
    AnnotationLayer.prototype.get_isUsableInLegend = function () {
        return this.ml;
    };
    AnnotationLayer.prototype.i7 = function (a, b, c, d) {
        _super.prototype.i7.call(this, a, b, c, d);
        switch (b) {
            case "SeriesViewer":
                var e = c;
                var f = d;
                if (e != null) {
                    this.m4(e.series);
                    var g = e.series;
                    g.collectionChanged = delegateRemove(g.collectionChanged, runOn(this, this.m1));
                    if (typeCast(XamDataChart.$, e) !== null) {
                        var h = e;
                        this.m3(h.axes);
                        var i = h.axes;
                        i.collectionChanged = delegateRemove(i.collectionChanged, runOn(this, this.mr));
                    }
                }
                if (f != null) {
                    this.mz(f.series);
                    var j = f.series;
                    j.collectionChanged = delegateCombine(j.collectionChanged, runOn(this, this.m1));
                    if (typeCast(XamDataChart.$, f) !== null) {
                        var k = f;
                        this.my(k.axes);
                        var 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;
        }
    };
    AnnotationLayer.prototype.m4 = 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.m2));
                }
            }
        }
        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.jl(true);
    };
    AnnotationLayer.prototype.m3 = 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.ms));
            }
        }
        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.jl(true);
    };
    AnnotationLayer.prototype.mz = 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.m2));
                }
            }
        }
        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.jl(true);
    };
    AnnotationLayer.prototype.my = 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.ms));
            }
        }
        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.jl(true);
    };
    AnnotationLayer.prototype.mg = function (a) {
        if (a == null) {
            return false;
        }
        return true;
    };
    AnnotationLayer.prototype.ms = function (a, b) {
        if (this.mg(a)) {
            this.mu(a, b.animate);
        }
    };
    AnnotationLayer.prototype.mh = function (a) {
        if (a == null) {
            return false;
        }
        if (a.cj) {
            return false;
        }
        return true;
    };
    AnnotationLayer.prototype.m2 = function (a, b) {
        if (this.mh(a)) {
            this.mv(a, b.animate);
        }
    };
    AnnotationLayer.prototype.mu = function (a, b) {
    };
    AnnotationLayer.prototype.mv = function (a, b) {
    };
    AnnotationLayer.prototype.m1 = function (a, b) {
        this.mw(b);
    };
    AnnotationLayer.prototype.mr = function (a, b) {
        this.mt(b);
    };
    AnnotationLayer.prototype.m9 = function () {
        if (this.lb != null) {
            return this.lb;
        }
        return this.ld;
    };
    AnnotationLayer.prototype.na = function () {
        if (this.lc != null) {
            return this.lc;
        }
        return this.li;
    };
    AnnotationLayer.prototype.mt = 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.ms));
                }
            }
            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.ms));
                }
            }
            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.jl(true);
    };
    AnnotationLayer.prototype.mw = 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.m2));
                }
            }
            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.m2));
                }
            }
            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.jl(true);
    };
    AnnotationLayer.prototype.j1 = function (a, b) {
        this.jl(false);
    };
    AnnotationLayer.prototype.j0 = function (a, b) {
        this.jl(true);
    };
    AnnotationLayer.prototype.jm = function (a) {
        _super.prototype.jm.call(this, a);
        if (this.cc(this.bi)) {
            return;
        }
        if (this.da(a) && !this.de) {
            var 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);
        }
    };
    AnnotationLayer.prototype.get_cj = function () {
        return true;
    };
    AnnotationLayer.prototype.mx = function (a, b) {
    };
    AnnotationLayer.prototype.m0 = function (a, b) {
        this.ma.by();
    };
    AnnotationLayer.prototype.mq = function (a) {
        var 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);
    };
    AnnotationLayer.prototype.ix = function (a) {
        _super.prototype.ix.call(this, 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);
    };
    AnnotationLayer.prototype.dw = function (a, b, c) {
        var d = _super.prototype.dw.call(this, a, b, c);
        if (!this.bi.q()) {
            d = false;
            return d;
        }
        return d;
    };
    AnnotationLayer.prototype.get_ds = function () {
        return this.mj;
    };
    Object.defineProperty(AnnotationLayer.prototype, "mj", {
        get: function () {
            return this.me;
        },
        set: function (a) {
            var b = this.me;
            this.me = a;
            this.raisePropertyChanged("ShouldRenderAsOverlay", b, this.me);
        },
        enumerable: true,
        configurable: true
    });
    AnnotationLayer.$t = markType(AnnotationLayer, 'AnnotationLayer', Series.$);
    AnnotationLayer.$$p = 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;
}(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.bu = null;
        _this.bv = false;
        _this.bw = -1;
        _this.bu = a;
        return _this;
    }
    AnnotationLayerView.prototype.b0 = function () {
        if (this.bv) {
            this.bv = false;
            this.bw = -1;
            this.bu.nb = { $type: Point_$type, x: NaN, y: NaN };
            this.bu.jl(true);
        }
    };
    AnnotationLayerView.prototype.bx = function () {
        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);
        }
    };
    AnnotationLayerView.prototype.bz = function () {
        if (this.bv == true) {
            this.bv = false;
            if (this.bw != -1) {
                window.clearTimeout(this.bw);
                this.bw = -1;
            }
        }
    };
    AnnotationLayerView.prototype.by = function () {
        this.an();
    };
    AnnotationLayerView.$t = markType(AnnotationLayerView, 'AnnotationLayerView', SeriesView.$);
    return AnnotationLayerView;
}(SeriesView));
export { AnnotationLayerView };
//# sourceMappingURL=AnnotationLayer_combined.js.map
