/*
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 { __extends } from "tslib";
import { Series } from "./Series";
import { DependencyProperty } from "igniteui-angular-core";
import { IEnumerable_$type, runOn, delegateCombine, delegateRemove, typeCast, Point_$type, markType, markDep } from "igniteui-angular-core";
import { NumericXAxis } from "./NumericXAxis";
import { NumericYAxis } from "./NumericYAxis";
import { IFastItemsSource_$type } from "igniteui-angular-core";
import { Triangulator } from "igniteui-angular-core";
import { TriangulationStatusEventArgs } from "igniteui-angular-core";
import { FastItemsSource } from "igniteui-angular-core";
import { SeriesViewer } from "./SeriesViewer";
import { Axis } from "./Axis";
import { AxisRange } from "./AxisRange";
import { DataLegendSeriesValueInfo } from "igniteui-angular-core";
import { DataLegendSeriesContext } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
/**
 * @hidden
 */
var ScatterTriangulationSeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ScatterTriangulationSeries, _super);
    function ScatterTriangulationSeries() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.w3 = null;
        _this.w4 = null;
        _this.xc = false;
        _this.wz = null;
        _this.triangulationStatusChanged = null;
        _this.xf = null;
        _this.w0 = null;
        _this.w1 = null;
        _this.w2 = null;
        return _this;
    }
    ScatterTriangulationSeries.prototype.o2 = function () {
        _super.prototype.o2.call(this);
        this.ww = null;
        this.wx = null;
    };
    ScatterTriangulationSeries.prototype.kq = function (a, b) {
        var c = this.nd(b);
        if (c == ScatterTriangulationSeries.$$p[8]) {
            return this.kr(a, b, this.xy);
        }
        if (c == ScatterTriangulationSeries.$$p[12]) {
            return this.kr(a, b, this.x6);
        }
        return _super.prototype.kq.call(this, a, b);
    };
    ScatterTriangulationSeries.prototype.md = function (a) {
        var b = this.nd(a);
        if (b == ScatterTriangulationSeries.$$p[8]) {
            return this.xy;
        }
        if (b == ScatterTriangulationSeries.$$p[12]) {
            return this.x6;
        }
        return _super.prototype.md.call(this, a);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "w9", {
        get: function () {
            return this.w3;
        },
        set: function (a) {
            var b = this.w9 != a;
            if (b) {
                var c = this.w9;
                this.w3 = a;
                this.raisePropertyChanged("XColumn", c, this.w9);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "xa", {
        get: function () {
            return this.w4;
        },
        set: function (a) {
            var b = this.xa != a;
            if (b) {
                var c = this.xa;
                this.w4 = a;
                this.raisePropertyChanged("YColumn", c, this.xa);
            }
        },
        enumerable: false,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.rq = function (a) {
        var b = this.dn != null && this.xb == null && this.xf == null && this.w9 != null && this.xa != null && this.w9.count >= 3 && this.xa.count >= 3 && !this.xc;
        if (b) {
            this.ya();
            this.xc = true;
        }
    };
    ScatterTriangulationSeries.prototype.ya = function () {
        this.wz = new Triangulator(this.dn.count, this.w9, this.xa);
        var a = this.wz;
        a.triangulationStatusChanged = delegateCombine(a.triangulationStatusChanged, runOn(this, this.yb));
        this.wz.y();
    };
    ScatterTriangulationSeries.prototype.x8 = function () {
        if (this.wz == null) {
            return;
        }
        this.wz.r();
        var a = this.wz;
        a.triangulationStatusChanged = delegateRemove(a.triangulationStatusChanged, runOn(this, this.yb));
        this.wz = null;
    };
    ScatterTriangulationSeries.prototype.yb = function (a, b) {
        var _this = this;
        if (this.triangulationStatusChanged != null) {
            this.triangulationStatusChanged(this, new TriangulationStatusEventArgs(b.currentStatus));
        }
        if (b.currentStatus >= 100) {
            if (this.wz == null) {
                return;
            }
            var c = this.wz;
            c.triangulationStatusChanged = delegateRemove(c.triangulationStatusChanged, runOn(this, this.yb));
            this.xf = this.wz.n();
            this.wz = null;
            var d = ((function () {
                var $ret = new FastItemsSource();
                $ret.e = _this.xf;
                return $ret;
            })());
            this.w6 = this.w5(d, "v1");
            this.w7 = this.w5(d, "v2");
            this.w8 = this.w5(d, "v3");
            this.rp(false);
        }
    };
    ScatterTriangulationSeries.prototype.w5 = function (a, b) {
        if (b == null) {
            return a.registerColumnInt(null, null, false);
        }
        var c = null;
        var d = SeriesViewer.cu(b, this.coercionMethods);
        c = d.a;
        return a.registerColumnInt(b, c, this.expectFunctions);
    };
    ScatterTriangulationSeries.prototype.q7 = function (a, b, c, d) {
        var _this = this;
        _super.prototype.q7.call(this, a, b, c, d);
        switch (b) {
            case ScatterTriangulationSeries.$$p[6]:
            case ScatterTriangulationSeries.$$p[10]:
            case ScatterTriangulationSeries.$$p[7]:
            case ScatterTriangulationSeries.$$p[11]:
                this.qd();
                break;
            case "FastItemsSource":
                var e = typeCast(IFastItemsSource_$type, c);
                if (e != null) {
                    e.deregisterColumn(this.w9);
                    e.deregisterColumn(this.xa);
                    this.w9 = null;
                    this.xa = null;
                }
                this.x9();
                var f = typeCast(IFastItemsSource_$type, d);
                if (f != null) {
                    this.w9 = this.dk(this.xy);
                    this.xa = this.dk(this.x6);
                }
                this.rp(this.gg && c != null);
                break;
            case ScatterTriangulationSeries.$$p[8]:
                if (this.dn != null) {
                    this.dn.deregisterColumn(this.w9);
                    this.w9 = this.dk(this.xy);
                }
                this.x9();
                this.rp(false);
                this.qj();
                break;
            case ScatterTriangulationSeries.$$p[12]:
                if (this.dn != null) {
                    this.dn.deregisterColumn(this.xa);
                    this.xa = this.dk(this.x6);
                }
                this.x9();
                this.rp(false);
                this.qj();
                break;
            case ScatterTriangulationSeries.$$p[5]:
                if (c != null) {
                    (typeCast(Axis.$, c)).b0(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ct(this);
                }
                if ((this.ww != null && !this.ww.c1()) || (d == null && c != null)) {
                    this.rp(false);
                }
                this.qj();
                break;
            case ScatterTriangulationSeries.$$p[9]:
                if (c != null) {
                    (typeCast(Axis.$, c)).b0(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ct(this);
                }
                if ((this.wx != null && !this.wx.c1()) || (d == null && c != null)) {
                    this.rp(false);
                }
                this.qj();
                break;
            case ScatterTriangulationSeries.$$p[4]:
                if (this.trianglesSource != null) {
                    this.x8();
                    this.xb = ((function () {
                        var $ret = new FastItemsSource();
                        $ret.e = _this.trianglesSource;
                        return $ret;
                    })());
                }
                else {
                    this.xb = null;
                }
                break;
            case ScatterTriangulationSeries.$$p[0]:
                var g = typeCast(IFastItemsSource_$type, c);
                if (g != null) {
                    g.deregisterColumn(this.w6);
                    g.deregisterColumn(this.w7);
                    g.deregisterColumn(this.w8);
                    this.w6 = null;
                    this.w7 = null;
                    this.w8 = null;
                }
                var h = typeCast(IFastItemsSource_$type, d);
                if (h != null) {
                    this.w6 = this.w5(h, this.xm);
                    this.w7 = this.w5(h, this.xo);
                    this.w8 = this.w5(h, this.xq);
                }
                this.rp(false);
                this.qj();
                break;
            case ScatterTriangulationSeries.$$p[1]:
                if (this.xb != null) {
                    this.xb.deregisterColumn(this.w6);
                    this.w6 = this.w5(this.xb, this.xm);
                }
                this.rp(false);
                this.qj();
                break;
            case ScatterTriangulationSeries.$$p[2]:
                if (this.xb != null) {
                    this.xb.deregisterColumn(this.w7);
                    this.w7 = this.w5(this.xb, this.xo);
                }
                this.rp(false);
                this.qj();
                break;
            case ScatterTriangulationSeries.$$p[3]:
                if (this.xb != null) {
                    this.xb.deregisterColumn(this.w8);
                    this.w8 = this.w5(this.xb, this.xq);
                }
                this.rp(false);
                this.qj();
                break;
            case "XColumn":
                if (this.ww != null) {
                    this.ww.c1();
                }
                break;
            case "YColumn":
                if (this.wx != null) {
                    this.wx.c1();
                }
                break;
        }
    };
    ScatterTriangulationSeries.prototype.xe = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.xd = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.he = function (a, b, c) {
        return _super.prototype.he.call(this, a, b, c) && this.dn != null && this.ww != null && this.wx != null && this.ww.bi != null && this.wx.bi != null && a.width > 0 && a.height > 0 && this.w6 != null && this.w6.count > 0 && this.w7 != null && this.w7.count > 0 && this.w8 != null && this.w8.count > 0 && this.w9 != null && this.w9.count > 0 && this.xa != null && this.xa.count > 0;
    };
    ScatterTriangulationSeries.prototype.x9 = function () {
        if (this.trianglesSource == null) {
            this.xf = null;
            this.w6 = null;
            this.w7 = null;
            this.w8 = null;
            this.xc = false;
        }
    };
    ScatterTriangulationSeries.prototype.p9 = function () {
        _super.prototype.p9.call(this);
        if (this.ww != null) {
            this.ww.ia();
        }
        if (this.wx != null) {
            this.wx.ia();
        }
    };
    ScatterTriangulationSeries.prototype.pb = function (a, b, c, d) {
        _super.prototype.pb.call(this, a, b, c, d);
        this.x9();
        this.rp(false);
    };
    ScatterTriangulationSeries.prototype.ay = function (a) {
        if (a != null && a == this.ww && this.w9 != null) {
            return new AxisRange(this.w9.minimum, this.w9.maximum);
        }
        if (a != null && a == this.wx && this.xa != null) {
            return new AxisRange(this.xa.minimum, this.xa.maximum);
        }
        return null;
    };
    ScatterTriangulationSeries.prototype.sp = function (a, b) {
        this.rp(false);
    };
    ScatterTriangulationSeries.prototype.so = function (a, b) {
        this.rp(false);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "w6", {
        get: function () {
            return this.w0;
        },
        set: function (a) {
            var b = this.w6 != a;
            if (b) {
                var c = this.w6;
                this.w0 = a;
                this.raisePropertyChanged("TriangleVertexColumn1", c, this.w6);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "w7", {
        get: function () {
            return this.w1;
        },
        set: function (a) {
            var b = this.w7 != a;
            if (b) {
                var c = this.w7;
                this.w1 = a;
                this.raisePropertyChanged("TriangleVertexColumn2", c, this.w7);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "w8", {
        get: function () {
            return this.w2;
        },
        set: function (a) {
            var b = this.w8 != a;
            if (b) {
                var c = this.w8;
                this.w2 = a;
                this.raisePropertyChanged("TriangleVertexColumn3", c, this.w8);
            }
        },
        enumerable: false,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.get_fx = function () {
        return true;
    };
    ScatterTriangulationSeries.prototype.get_fl = function () {
        return true;
    };
    ScatterTriangulationSeries.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = { $type: Point_$type, x: a, y: b };
        var d = this.kn(c);
        var e = d == null ? NaN : this.ix(d, "XMemberPath");
        var f = d == null ? NaN : this.ix(d, "YMemberPath");
        var g = new DataLegendSeriesValueInfo();
        g.l = e;
        g.a = 13;
        g.q = "X";
        g.r = this.xy != null ? this.xy : "X";
        g.s = this.xu != null ? this.xu : "X:";
        g.t = this.xw != null ? this.xw : "";
        var h = new DataLegendSeriesValueInfo();
        h.l = f;
        h.a = 14;
        h.q = "Y";
        h.r = this.x6 != null ? this.x6 : "Y";
        h.s = this.x2 != null ? this.x2 : "Y:";
        h.t = this.x4 != null ? this.x4 : "";
        var i = new DataLegendSeriesContext();
        i.e = ((function () {
            var $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
            $ret.add(g);
            $ret.add(h);
            return $ret;
        })());
        i.h = this.mc();
        return i;
    };
    ScatterTriangulationSeries.$t = markType(ScatterTriangulationSeries, 'ScatterTriangulationSeries', Series.$);
    ScatterTriangulationSeries.$$p = markDep(DependencyProperty, PropertyMetadata, ScatterTriangulationSeries, 'raisePropertyChanged', ['FastTrianglesSource:xb:yc', [IFastItemsSource_$type, null], 'TriangleVertexMemberPath1:xm:ye', [2, null], 'TriangleVertexMemberPath2:xo:yf', [2, null], 'TriangleVertexMemberPath3:xq:yg', [2, null], 'TrianglesSource::yd', [IEnumerable_$type, null], 'XAxis:ww:yh', [NumericXAxis.$, null], 'XMemberAsLegendLabel:xu:yi', [2, null], 'XMemberAsLegendUnit:xw:yj', [2, null], 'XMemberPath:xy:yk', [2, null], 'YAxis:wx:yl', [NumericYAxis.$, null], 'YMemberAsLegendLabel:x2:ym', [2, null], 'YMemberAsLegendUnit:x4:yn', [2, null], 'YMemberPath:x6:yo', [2, null]]);
    return ScatterTriangulationSeries;
}(Series));
export { ScatterTriangulationSeries };
