/*
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-angular-core";
import { Point_$type, Boolean_$type, runOn, delegateRemove, typeCast, delegateCombine, fromEnum, fromEn, markType, markDep } from "igniteui-angular-core";
import { SeriesView } from "./SeriesView";
import { XamDataChart } from "./XamDataChart";
import { Tuple$2 } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_ } from "igniteui-angular-core";
/**
 * @hidden
 */
var AnnotationLayer = /** @class */ (function (_super) {
    tslib_1.__extends(AnnotationLayer, _super);
    function AnnotationLayer() {
        var _this = _super.call(this) || this;
        _this.m3 = null;
        _this.l2 = null;
        _this.l1 = null;
        _this.l3 = null;
        _this.m1 = { $type: Point_$type, x: NaN, y: NaN };
        _this.l4 = false;
        _this.m3 = { $type: Point_$type, x: NaN, y: NaN };
        return _this;
    }
    AnnotationLayer.prototype.bf = function () {
        return new AnnotationLayerView(this);
    };
    AnnotationLayer.prototype.iu = function (a) {
        _super.prototype.iu.call(this, a);
        this.l0 = a;
    };
    AnnotationLayer.prototype.l8 = 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.l5;
    };
    AnnotationLayer.prototype.bd = function () {
        if (this.be == 0) {
            return 1;
        }
        else {
            return _super.prototype.bd.call(this);
        }
    };
    AnnotationLayer.prototype.get_cw = function () {
        return this.ma || this.mb;
    };
    AnnotationLayer.prototype.get_isUsableInLegend = function () {
        return this.mb;
    };
    AnnotationLayer.prototype.iz = function (a, b, c, d) {
        _super.prototype.iz.call(this, a, b, c, d);
        switch (b) {
            case "SeriesViewer":
                var e = c;
                var f = d;
                if (e != null) {
                    this.mu(e.series);
                    var g = e.series;
                    g.collectionChanged = delegateRemove(g.collectionChanged, runOn(this, this.mr));
                    if (typeCast(XamDataChart.$, e) !== null) {
                        var h = e;
                        this.mt(h.axes);
                        var i = h.axes;
                        i.collectionChanged = delegateRemove(i.collectionChanged, runOn(this, this.mh));
                    }
                }
                if (f != null) {
                    this.mp(f.series);
                    var j = f.series;
                    j.collectionChanged = delegateCombine(j.collectionChanged, runOn(this, this.mr));
                    if (typeCast(XamDataChart.$, f) !== null) {
                        var k = f;
                        this.mo(k.axes);
                        var l = k.axes;
                        l.collectionChanged = delegateCombine(l.collectionChanged, runOn(this, this.mh));
                    }
                }
                break;
            case AnnotationLayer.$$p[3]:
            case AnnotationLayer.$$p[2]:
                if (this.cw) {
                    if (this.fh == -1) {
                        this.fh = XamDataChart.od(this);
                    }
                }
                else {
                    this.fh = -1;
                    this.k3 = null;
                    this.k4 = null;
                }
                if (this.bs != null) {
                    this.bs.ii();
                }
                this.jd(true);
                break;
            case "TransitionProgress":
                this.l3.c(this.ez, this.l2, this.l1);
                if (this.cc(this.bi)) {
                    return;
                }
                if (this.ez == 1) {
                    this.mq(this.l1, this.bi);
                }
                else {
                    this.mq(this.l3, this.bi);
                }
                if (this.bs != null) {
                    this.bs.jj(this);
                }
                break;
            case AnnotationLayer.$$p[1]:
                if (this.bs != null) {
                    this.bs.ig();
                }
                break;
            case AnnotationLayer.$$p[0]:
                this.m3 = this.m2;
                this.ip(this.m2);
                break;
            case "ShouldRenderAsOverlay":
                if (this.bs != null) {
                    this.bi.ah(this.bs);
                    this.bi.ad(this.bs);
                }
                break;
        }
    };
    AnnotationLayer.prototype.mu = 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.ms));
                }
            }
        }
        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.jd(true);
    };
    AnnotationLayer.prototype.mt = 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.mi));
            }
        }
        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.jd(true);
    };
    AnnotationLayer.prototype.mp = 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.ms));
                }
            }
        }
        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.jd(true);
    };
    AnnotationLayer.prototype.mo = 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.mi));
            }
        }
        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.jd(true);
    };
    AnnotationLayer.prototype.l6 = function (a) {
        if (a == null) {
            return false;
        }
        return true;
    };
    AnnotationLayer.prototype.mi = function (a, b) {
        if (this.l6(a)) {
            this.mk(a, b.animate);
        }
    };
    AnnotationLayer.prototype.l7 = function (a) {
        if (a == null) {
            return false;
        }
        if (a.cj) {
            return false;
        }
        return true;
    };
    AnnotationLayer.prototype.ms = function (a, b) {
        if (this.l7(a)) {
            this.ml(a, b.animate);
        }
    };
    AnnotationLayer.prototype.mk = function (a, b) {
    };
    AnnotationLayer.prototype.ml = function (a, b) {
    };
    AnnotationLayer.prototype.mr = function (a, b) {
        this.mm(b);
    };
    AnnotationLayer.prototype.mh = function (a, b) {
        this.mj(b);
    };
    AnnotationLayer.prototype.mz = function () {
        if (this.k3 != null) {
            return this.k3;
        }
        return this.k5;
    };
    AnnotationLayer.prototype.m0 = function () {
        if (this.k4 != null) {
            return this.k4;
        }
        return this.k8;
    };
    AnnotationLayer.prototype.mj = 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.mi));
                }
            }
            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.mi));
                }
            }
            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.jd(true);
    };
    AnnotationLayer.prototype.mm = 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.ms));
                }
            }
            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.ms));
                }
            }
            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.jd(true);
    };
    AnnotationLayer.prototype.jt = function (a, b) {
        this.jd(false);
    };
    AnnotationLayer.prototype.js = function (a, b) {
        this.jd(true);
    };
    AnnotationLayer.prototype.je = function (a) {
        _super.prototype.je.call(this, a);
        if (this.cc(this.bi)) {
            return;
        }
        if (this.da(a) && !this.de) {
            var b = this.l2;
            if (this.ca()) {
                if (this.bt.g) {
                    this.bt.t();
                }
                this.l2 = this.l3;
                this.l3 = b;
            }
            else {
                this.l2 = this.l1;
                this.l1 = b;
            }
            this.mn(this.l1, this.bi);
            this.jl();
        }
        else {
            if (!this.de) {
                this.mn(this.l1, this.bi);
            }
            this.mq(this.l1, this.bi);
        }
    };
    AnnotationLayer.prototype.get_cj = function () {
        return true;
    };
    AnnotationLayer.prototype.mn = function (a, b) {
    };
    AnnotationLayer.prototype.mq = function (a, b) {
        this.l0.by();
    };
    AnnotationLayer.prototype.mg = function (a) {
        var b = { $type: Point_$type, x: this.m1.x, y: this.m1.y };
        if (a.isVertical) {
            if (isNaN_(this.m1.y)) {
                return new Tuple$2(Boolean_$type, Point_$type, false, b);
            }
            if (isNaN_(this.m1.x)) {
                b.x = 0;
                return new Tuple$2(Boolean_$type, Point_$type, true, b);
            }
        }
        else {
            if (isNaN_(this.m1.x)) {
                return new Tuple$2(Boolean_$type, Point_$type, false, b);
            }
            if (isNaN_(this.m1.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.ip = function (a) {
        _super.prototype.ip.call(this, a);
        if (isNaN_(this.m3.x) && isNaN_(this.m3.y)) {
            if (isNaN_(a.x) && isNaN_(a.y)) {
                this.l0.bx();
                return;
            }
            else {
                this.l0.bz();
                this.m1 = a;
            }
        }
        else {
            this.l0.bz();
            this.m1 = this.m3;
        }
        this.jd(true);
    };
    AnnotationLayer.prototype.dw = function (a, b, c) {
        var d = _super.prototype.dw.call(this, a, b, c);
        if (!this.bi.q()) {
            return d = false;
        }
        return d;
    };
    AnnotationLayer.prototype.get_ds = function () {
        return this.l9;
    };
    Object.defineProperty(AnnotationLayer.prototype, "l9", {
        get: function () {
            return this.l4;
        },
        set: function (a) {
            var b = this.l4;
            this.l4 = a;
            this.raisePropertyChanged("ShouldRenderAsOverlay", b, this.l4);
        },
        enumerable: true,
        configurable: true
    });
    AnnotationLayer.$t = markType(AnnotationLayer, 'AnnotationLayer', Series.$);
    AnnotationLayer.$$p = markDep(DependencyProperty, PropertyMetadata, AnnotationLayer, 'raisePropertyChanged', ['CursorPosition:m2:mv', [Point_$type, { $type: Point_$type, x: NaN, y: NaN }], 'IsDefaultCrosshairDisabled:l5:mw', [0, true], 'UseIndex:ma:mx', [0, false], 'UseLegend:mb:my', [0, false]]);
    return AnnotationLayer;
}(Series));
export { AnnotationLayer };
/**
 * @hidden
 */
var AnnotationLayerView = /** @class */ (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.m1 = { $type: Point_$type, x: NaN, y: NaN };
            this.bu.jd(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