/*
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 { Series } from "./Series";
import { DependencyProperty } from "igniteui-react-core";
import { IEnumerable_$type, runOn, delegateCombine, delegateRemove, typeCast, 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 { PropertyMetadata } from "igniteui-react-core";
/**
 * @hidden
 */
export let ScatterTriangulationSeries = /*@__PURE__*/ (() => {
    class ScatterTriangulationSeries extends Series {
        constructor() {
            super(...arguments);
            this.mh = null;
            this.mi = null;
            this.mq = false;
            this.md = null;
            this.triangulationStatusChanged = null;
            this.mt = null;
            this.me = null;
            this.mf = null;
            this.mg = null;
        }
        h1() {
            super.h1();
            this.ma = null;
            this.mb = null;
        }
        fs(a, b) {
            let c = this.g2(b);
            if (c == ScatterTriangulationSeries.$$p[6]) {
                return this.ft(a, b, this.m8);
            }
            if (c == ScatterTriangulationSeries.$$p[8]) {
                return this.ft(a, b, this.nc);
            }
            return super.fs(a, b);
        }
        get mn() {
            return this.mh;
        }
        set mn(a) {
            let b = this.mn != a;
            if (b) {
                let c = this.mn;
                this.mh = a;
                this.raisePropertyChanged("XColumn", c, this.mn);
            }
        }
        get mo() {
            return this.mi;
        }
        set mo(a) {
            let b = this.mo != a;
            if (b) {
                let c = this.mo;
                this.mi = a;
                this.raisePropertyChanged("YColumn", c, this.mo);
            }
        }
        jm(a) {
            let b = this.bz != null && this.mp == null && this.mt == null && this.mn != null && this.mo != null && this.mn.count >= 3 && this.mo.count >= 3 && !this.mq;
            if (b) {
                this.ng();
                this.mq = true;
            }
        }
        ng() {
            this.md = new Triangulator(this.bz.count, this.mn, this.mo);
            let a = this.md;
            a.triangulationStatusChanged = delegateCombine(a.triangulationStatusChanged, runOn(this, this.nh));
            this.md.y();
        }
        ne() {
            if (this.md == null) {
                return;
            }
            this.md.r();
            let a = this.md;
            a.triangulationStatusChanged = delegateRemove(a.triangulationStatusChanged, runOn(this, this.nh));
            this.md = null;
        }
        nh(a, b) {
            if (this.triangulationStatusChanged != null) {
                this.triangulationStatusChanged(this, new TriangulationStatusEventArgs(b.currentStatus));
            }
            if (b.currentStatus >= 100) {
                if (this.md == null) {
                    return;
                }
                let c = this.md;
                c.triangulationStatusChanged = delegateRemove(c.triangulationStatusChanged, runOn(this, this.nh));
                this.mt = this.md.n();
                this.md = null;
                let d = ((() => {
                    let $ret = new FastItemsSource();
                    $ret.e = this.mt;
                    return $ret;
                })());
                this.mk = this.mj(d, "v1");
                this.ml = this.mj(d, "v2");
                this.mm = this.mj(d, "v3");
                this.jl(false);
            }
        }
        mj(a, b) {
            if (b == null) {
                return a.registerColumnInt(null, null, false);
            }
            let c = null;
            let d = SeriesViewer.bn(b, this.coercionMethods);
            c = d.a;
            return a.registerColumnInt(b, c, this.expectFunctions);
        }
        i7(a, b, c, d) {
            super.i7(a, b, c, d);
            switch (b) {
                case "FastItemsSource":
                    let e = typeCast(IFastItemsSource_$type, c);
                    if (e != null) {
                        e.deregisterColumn(this.mn);
                        e.deregisterColumn(this.mo);
                        this.mn = null;
                        this.mo = null;
                    }
                    this.nf();
                    let f = typeCast(IFastItemsSource_$type, d);
                    if (f != null) {
                        this.mn = this.bw(this.m8);
                        this.mo = this.bw(this.nc);
                    }
                    this.jl(false);
                    break;
                case ScatterTriangulationSeries.$$p[6]:
                    if (this.bz != null) {
                        this.bz.deregisterColumn(this.mn);
                        this.mn = this.bw(this.m8);
                    }
                    this.nf();
                    this.jl(false);
                    this.it();
                    break;
                case ScatterTriangulationSeries.$$p[8]:
                    if (this.bz != null) {
                        this.bz.deregisterColumn(this.mo);
                        this.mo = this.bw(this.nc);
                    }
                    this.nf();
                    this.jl(false);
                    this.it();
                    break;
                case ScatterTriangulationSeries.$$p[5]:
                    if (c != null) {
                        (typeCast(Axis.$, c)).bx(this);
                    }
                    if (d != null) {
                        (typeCast(Axis.$, d)).ck(this);
                    }
                    if ((this.ma != null && !this.ma.cn()) || (d == null && c != null)) {
                        this.jl(false);
                    }
                    this.it();
                    break;
                case ScatterTriangulationSeries.$$p[7]:
                    if (c != null) {
                        (typeCast(Axis.$, c)).bx(this);
                    }
                    if (d != null) {
                        (typeCast(Axis.$, d)).ck(this);
                    }
                    if ((this.mb != null && !this.mb.cn()) || (d == null && c != null)) {
                        this.jl(false);
                    }
                    this.it();
                    break;
                case ScatterTriangulationSeries.$$p[1]:
                    if (this.trianglesSource != null) {
                        this.ne();
                        this.mp = ((() => {
                            let $ret = new FastItemsSource();
                            $ret.e = this.trianglesSource;
                            return $ret;
                        })());
                    }
                    else {
                        this.mp = null;
                    }
                    break;
                case ScatterTriangulationSeries.$$p[0]:
                    let g = typeCast(IFastItemsSource_$type, c);
                    if (g != null) {
                        g.deregisterColumn(this.mk);
                        g.deregisterColumn(this.ml);
                        g.deregisterColumn(this.mm);
                        this.mk = null;
                        this.ml = null;
                        this.mm = null;
                    }
                    let h = typeCast(IFastItemsSource_$type, d);
                    if (h != null) {
                        this.mk = this.mj(h, this.m0);
                        this.ml = this.mj(h, this.m2);
                        this.mm = this.mj(h, this.m4);
                    }
                    this.jl(false);
                    this.it();
                    break;
                case ScatterTriangulationSeries.$$p[2]:
                    if (this.mp != null) {
                        this.mp.deregisterColumn(this.mk);
                        this.mk = this.mj(this.mp, this.m0);
                    }
                    this.jl(false);
                    this.it();
                    break;
                case ScatterTriangulationSeries.$$p[3]:
                    if (this.mp != null) {
                        this.mp.deregisterColumn(this.ml);
                        this.ml = this.mj(this.mp, this.m2);
                    }
                    this.jl(false);
                    this.it();
                    break;
                case ScatterTriangulationSeries.$$p[4]:
                    if (this.mp != null) {
                        this.mp.deregisterColumn(this.mm);
                        this.mm = this.mj(this.mp, this.m4);
                    }
                    this.jl(false);
                    this.it();
                    break;
                case "XColumn":
                    if (this.ma != null) {
                        this.ma.cn();
                    }
                    break;
                case "YColumn":
                    if (this.mb != null) {
                        this.mb.cn();
                    }
                    break;
            }
        }
        ms(a) {
            if (typeCast(NumericYAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        mr(a) {
            if (typeCast(NumericXAxis.$, a) !== null) {
                return true;
            }
            return false;
        }
        dw(a, b, c) {
            return super.dw(a, b, c) && this.bz != null && this.ma != null && this.mb != null && this.ma.bh != null && this.mb.bh != null && a.width > 0 && a.height > 0 && this.mk != null && this.mk.count > 0 && this.ml != null && this.ml.count > 0 && this.mm != null && this.mm.count > 0 && this.mn != null && this.mn.count > 0 && this.mo != null && this.mo.count > 0;
        }
        nf() {
            if (this.trianglesSource == null) {
                this.mt = null;
                this.mk = null;
                this.ml = null;
                this.mm = null;
                this.mq = false;
            }
        }
        ik() {
            super.ik();
            if (this.ma != null) {
                this.ma.ha();
            }
            if (this.mb != null) {
                this.mb.ha();
            }
        }
        h6(a, b, c, d) {
            super.h6(a, b, c, d);
            this.nf();
            this.jl(false);
        }
        an(a) {
            if (a != null && a == this.ma && this.mn != null) {
                return new AxisRange(this.mn.minimum, this.mn.maximum);
            }
            if (a != null && a == this.mb && this.mo != null) {
                return new AxisRange(this.mo.minimum, this.mo.maximum);
            }
            return null;
        }
        j1(a, b) {
            this.jl(false);
        }
        j0(a, b) {
            this.jl(false);
        }
        get mk() {
            return this.me;
        }
        set mk(a) {
            let b = this.mk != a;
            if (b) {
                let c = this.mk;
                this.me = a;
                this.raisePropertyChanged("TriangleVertexColumn1", c, this.mk);
            }
        }
        get ml() {
            return this.mf;
        }
        set ml(a) {
            let b = this.ml != a;
            if (b) {
                let c = this.ml;
                this.mf = a;
                this.raisePropertyChanged("TriangleVertexColumn2", c, this.ml);
            }
        }
        get mm() {
            return this.mg;
        }
        set mm(a) {
            let b = this.mm != a;
            if (b) {
                let c = this.mm;
                this.mg = a;
                this.raisePropertyChanged("TriangleVertexColumn3", c, this.mm);
            }
        }
        get_c5() {
            return true;
        }
    }
    ScatterTriangulationSeries.$t = /*@__PURE__*/ markType(ScatterTriangulationSeries, 'ScatterTriangulationSeries', Series.$);
    ScatterTriangulationSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ScatterTriangulationSeries, 'raisePropertyChanged', ['FastTrianglesSource:mp:ni', [IFastItemsSource_$type, null], 'TrianglesSource::nj', [IEnumerable_$type, null], 'TriangleVertexMemberPath1:m0:nk', [2, null], 'TriangleVertexMemberPath2:m2:nl', [2, null], 'TriangleVertexMemberPath3:m4:nm', [2, null], 'XAxis:ma:nn', [NumericXAxis.$, null], 'XMemberPath:m8:no', [2, null], 'YAxis:mb:np', [NumericYAxis.$, null], 'YMemberPath:nc:nq', [2, null]]);
    return ScatterTriangulationSeries;
})();
//# sourceMappingURL=ScatterTriangulationSeries.js.map
