/*
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-react-core";
import { IEnumerable_$type, runOn, delegateCombine, delegateRemove, typeCast, Point_$type, markType, markDep } from "igniteui-react-core";
import { NumericXAxis } from "./NumericXAxis";
import { NumericYAxis } from "./NumericYAxis";
import { IFastItemsSource_$type } from "igniteui-react-core";
import { Triangulator } from "igniteui-react-core";
import { TriangulationStatusEventArgs } from "igniteui-react-core";
import { FastItemsSource } from "igniteui-react-core";
import { SeriesViewer } from "./SeriesViewer";
import { Axis } from "./Axis";
import { AxisRange } from "./AxisRange";
import { DataLegendSeriesValueInfo } from "igniteui-react-core";
import { DataLegendSeriesContext } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
/**
 * @hidden
 */
var ScatterTriangulationSeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(ScatterTriangulationSeries, _super);
    function ScatterTriangulationSeries() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.ua = null;
        _this.ub = null;
        _this.uj = false;
        _this.t6 = null;
        _this.triangulationStatusChanged = null;
        _this.um = null;
        _this.t7 = null;
        _this.t8 = null;
        _this.t9 = null;
        return _this;
    }
    ScatterTriangulationSeries.prototype.nh = function () {
        _super.prototype.nh.call(this);
        this.t3 = null;
        this.t4 = null;
    };
    ScatterTriangulationSeries.prototype.jv = function (a, b) {
        var c = this.lw(b);
        if (c == ScatterTriangulationSeries.$$p[8]) {
            return this.jw(a, b, this.u5);
        }
        if (c == ScatterTriangulationSeries.$$p[12]) {
            return this.jw(a, b, this.vd);
        }
        return _super.prototype.jv.call(this, a, b);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "ug", {
        get: function () {
            return this.ua;
        },
        set: function (a) {
            var b = this.ug != a;
            if (b) {
                var c = this.ug;
                this.ua = a;
                this.raisePropertyChanged("XColumn", c, this.ug);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "uh", {
        get: function () {
            return this.ub;
        },
        set: function (a) {
            var b = this.uh != a;
            if (b) {
                var c = this.uh;
                this.ub = a;
                this.raisePropertyChanged("YColumn", c, this.uh);
            }
        },
        enumerable: false,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.ps = function (a) {
        var b = this.c7 != null && this.ui == null && this.um == null && this.ug != null && this.uh != null && this.ug.count >= 3 && this.uh.count >= 3 && !this.uj;
        if (b) {
            this.vh();
            this.uj = true;
        }
    };
    ScatterTriangulationSeries.prototype.vh = function () {
        this.t6 = new Triangulator(this.c7.count, this.ug, this.uh);
        var a = this.t6;
        a.triangulationStatusChanged = delegateCombine(a.triangulationStatusChanged, runOn(this, this.vi));
        this.t6.y();
    };
    ScatterTriangulationSeries.prototype.vf = function () {
        if (this.t6 == null) {
            return;
        }
        this.t6.r();
        var a = this.t6;
        a.triangulationStatusChanged = delegateRemove(a.triangulationStatusChanged, runOn(this, this.vi));
        this.t6 = null;
    };
    ScatterTriangulationSeries.prototype.vi = function (a, b) {
        var _this = this;
        if (this.triangulationStatusChanged != null) {
            this.triangulationStatusChanged(this, new TriangulationStatusEventArgs(b.currentStatus));
        }
        if (b.currentStatus >= 100) {
            if (this.t6 == null) {
                return;
            }
            var c = this.t6;
            c.triangulationStatusChanged = delegateRemove(c.triangulationStatusChanged, runOn(this, this.vi));
            this.um = this.t6.n();
            this.t6 = null;
            var d = ((function () {
                var $ret = new FastItemsSource();
                $ret.e = _this.um;
                return $ret;
            })());
            this.ud = this.uc(d, "v1");
            this.ue = this.uc(d, "v2");
            this.uf = this.uc(d, "v3");
            this.pr(false);
        }
    };
    ScatterTriangulationSeries.prototype.uc = function (a, b) {
        if (b == null) {
            return a.registerColumnInt(null, null, false);
        }
        var c = null;
        var d = SeriesViewer.cg(b, this.coercionMethods);
        c = d.a;
        return a.registerColumnInt(b, c, this.expectFunctions);
    };
    ScatterTriangulationSeries.prototype.pa = function (a, b, c, d) {
        var _this = this;
        _super.prototype.pa.call(this, a, b, c, d);
        switch (b) {
            case "FastItemsSource":
                var e = typeCast(IFastItemsSource_$type, c);
                if (e != null) {
                    e.deregisterColumn(this.ug);
                    e.deregisterColumn(this.uh);
                    this.ug = null;
                    this.uh = null;
                }
                this.vg();
                var f = typeCast(IFastItemsSource_$type, d);
                if (f != null) {
                    this.ug = this.c4(this.u5);
                    this.uh = this.c4(this.vd);
                }
                this.pr(this.fr && c != null);
                break;
            case ScatterTriangulationSeries.$$p[8]:
                if (this.c7 != null) {
                    this.c7.deregisterColumn(this.ug);
                    this.ug = this.c4(this.u5);
                }
                this.vg();
                this.pr(false);
                this.om();
                break;
            case ScatterTriangulationSeries.$$p[12]:
                if (this.c7 != null) {
                    this.c7.deregisterColumn(this.uh);
                    this.uh = this.c4(this.vd);
                }
                this.vg();
                this.pr(false);
                this.om();
                break;
            case ScatterTriangulationSeries.$$p[5]:
                if (c != null) {
                    (typeCast(Axis.$, c)).b0(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ct(this);
                }
                if ((this.t3 != null && !this.t3.c1()) || (d == null && c != null)) {
                    this.pr(false);
                }
                this.om();
                break;
            case ScatterTriangulationSeries.$$p[9]:
                if (c != null) {
                    (typeCast(Axis.$, c)).b0(this);
                }
                if (d != null) {
                    (typeCast(Axis.$, d)).ct(this);
                }
                if ((this.t4 != null && !this.t4.c1()) || (d == null && c != null)) {
                    this.pr(false);
                }
                this.om();
                break;
            case ScatterTriangulationSeries.$$p[4]:
                if (this.trianglesSource != null) {
                    this.vf();
                    this.ui = ((function () {
                        var $ret = new FastItemsSource();
                        $ret.e = _this.trianglesSource;
                        return $ret;
                    })());
                }
                else {
                    this.ui = null;
                }
                break;
            case ScatterTriangulationSeries.$$p[0]:
                var g = typeCast(IFastItemsSource_$type, c);
                if (g != null) {
                    g.deregisterColumn(this.ud);
                    g.deregisterColumn(this.ue);
                    g.deregisterColumn(this.uf);
                    this.ud = null;
                    this.ue = null;
                    this.uf = null;
                }
                var h = typeCast(IFastItemsSource_$type, d);
                if (h != null) {
                    this.ud = this.uc(h, this.ut);
                    this.ue = this.uc(h, this.uv);
                    this.uf = this.uc(h, this.ux);
                }
                this.pr(false);
                this.om();
                break;
            case ScatterTriangulationSeries.$$p[1]:
                if (this.ui != null) {
                    this.ui.deregisterColumn(this.ud);
                    this.ud = this.uc(this.ui, this.ut);
                }
                this.pr(false);
                this.om();
                break;
            case ScatterTriangulationSeries.$$p[2]:
                if (this.ui != null) {
                    this.ui.deregisterColumn(this.ue);
                    this.ue = this.uc(this.ui, this.uv);
                }
                this.pr(false);
                this.om();
                break;
            case ScatterTriangulationSeries.$$p[3]:
                if (this.ui != null) {
                    this.ui.deregisterColumn(this.uf);
                    this.uf = this.uc(this.ui, this.ux);
                }
                this.pr(false);
                this.om();
                break;
            case "XColumn":
                if (this.t3 != null) {
                    this.t3.c1();
                }
                break;
            case "YColumn":
                if (this.t4 != null) {
                    this.t4.c1();
                }
                break;
        }
    };
    ScatterTriangulationSeries.prototype.ul = function (a) {
        if (typeCast(NumericYAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.uk = function (a) {
        if (typeCast(NumericXAxis.$, a) !== null) {
            return true;
        }
        return false;
    };
    ScatterTriangulationSeries.prototype.gm = function (a, b, c) {
        return _super.prototype.gm.call(this, a, b, c) && this.c7 != null && this.t3 != null && this.t4 != null && this.t3.bi != null && this.t4.bi != null && a.width > 0 && a.height > 0 && this.ud != null && this.ud.count > 0 && this.ue != null && this.ue.count > 0 && this.uf != null && this.uf.count > 0 && this.ug != null && this.ug.count > 0 && this.uh != null && this.uh.count > 0;
    };
    ScatterTriangulationSeries.prototype.vg = function () {
        if (this.trianglesSource == null) {
            this.um = null;
            this.ud = null;
            this.ue = null;
            this.uf = null;
            this.uj = false;
        }
    };
    ScatterTriangulationSeries.prototype.oc = function () {
        _super.prototype.oc.call(this);
        if (this.t3 != null) {
            this.t3.h7();
        }
        if (this.t4 != null) {
            this.t4.h7();
        }
    };
    ScatterTriangulationSeries.prototype.np = function (a, b, c, d) {
        _super.prototype.np.call(this, a, b, c, d);
        this.vg();
        this.pr(false);
    };
    ScatterTriangulationSeries.prototype.aq = function (a) {
        if (a != null && a == this.t3 && this.ug != null) {
            return new AxisRange(this.ug.minimum, this.ug.maximum);
        }
        if (a != null && a == this.t4 && this.uh != null) {
            return new AxisRange(this.uh.minimum, this.uh.maximum);
        }
        return null;
    };
    ScatterTriangulationSeries.prototype.qp = function (a, b) {
        this.pr(false);
    };
    ScatterTriangulationSeries.prototype.qo = function (a, b) {
        this.pr(false);
    };
    Object.defineProperty(ScatterTriangulationSeries.prototype, "ud", {
        get: function () {
            return this.t7;
        },
        set: function (a) {
            var b = this.ud != a;
            if (b) {
                var c = this.ud;
                this.t7 = a;
                this.raisePropertyChanged("TriangleVertexColumn1", c, this.ud);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "ue", {
        get: function () {
            return this.t8;
        },
        set: function (a) {
            var b = this.ue != a;
            if (b) {
                var c = this.ue;
                this.t8 = a;
                this.raisePropertyChanged("TriangleVertexColumn2", c, this.ue);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(ScatterTriangulationSeries.prototype, "uf", {
        get: function () {
            return this.t9;
        },
        set: function (a) {
            var b = this.uf != a;
            if (b) {
                var c = this.uf;
                this.t9 = a;
                this.raisePropertyChanged("TriangleVertexColumn3", c, this.uf);
            }
        },
        enumerable: false,
        configurable: true
    });
    ScatterTriangulationSeries.prototype.get_fb = function () {
        return true;
    };
    ScatterTriangulationSeries.prototype.get_ez = function () {
        return true;
    };
    ScatterTriangulationSeries.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = { $type: Point_$type, x: a, y: b };
        var d = this.js(c);
        var e = d == null ? NaN : this.h2(d, "XMemberPath");
        var f = d == null ? NaN : this.h2(d, "YMemberPath");
        var g = new DataLegendSeriesValueInfo();
        g.l = e;
        g.a = 13;
        g.p = "X";
        g.q = this.u5 != null ? this.u5 : "X";
        g.r = this.u1 != null ? this.u1 : "X:";
        g.s = this.u3 != null ? this.u3 : "";
        var h = new DataLegendSeriesValueInfo();
        h.l = f;
        h.a = 14;
        h.p = "Y";
        h.q = this.vd != null ? this.vd : "Y";
        h.r = this.u9 != null ? this.u9 : "Y:";
        h.s = this.vb != null ? this.vb : "";
        var i = new DataLegendSeriesContext();
        i.f = ((function () {
            var $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
            $ret.add(g);
            $ret.add(h);
            return $ret;
        })());
        i.b = this.aw();
        return i;
    };
    ScatterTriangulationSeries.$t = markType(ScatterTriangulationSeries, 'ScatterTriangulationSeries', Series.$);
    ScatterTriangulationSeries.$$p = markDep(DependencyProperty, PropertyMetadata, ScatterTriangulationSeries, 'raisePropertyChanged', ['FastTrianglesSource:ui:vj', [IFastItemsSource_$type, null], 'TriangleVertexMemberPath1:ut:vl', [2, null], 'TriangleVertexMemberPath2:uv:vm', [2, null], 'TriangleVertexMemberPath3:ux:vn', [2, null], 'TrianglesSource::vk', [IEnumerable_$type, null], 'XAxis:t3:vo', [NumericXAxis.$, null], 'XMemberAsLegendLabel:u1:vp', [2, null], 'XMemberAsLegendUnit:u3:vq', [2, null], 'XMemberPath:u5:vr', [2, null], 'YAxis:t4:vs', [NumericYAxis.$, null], 'YMemberAsLegendLabel:u9:vt', [2, null], 'YMemberAsLegendUnit:vb:vu', [2, null], 'YMemberPath:vd:vv', [2, null]]);
    return ScatterTriangulationSeries;
}(Series));
export { ScatterTriangulationSeries };
