/*
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 { ScatterBase } from "./ScatterBase";
import { DependencyProperty } from "igniteui-react-core";
import { Point_$type, typeCast, markType, markDep } from "igniteui-react-core";
import { ScatterFrame } from "./ScatterFrame";
import { ScatterSplineSeriesView } from "./ScatterSplineSeriesView";
import { Clipper } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { OwnedPoint } from "./OwnedPoint";
import { PathGeometry } from "igniteui-react-core";
import { Numeric } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
/**
 * @hidden
 */
export let ScatterSplineSeries = /*@__PURE__*/ (() => {
    class ScatterSplineSeries extends ScatterBase {
        constructor() {
            super();
            this.ab = ScatterSplineSeries.$;
            this.nm = new ScatterFrame();
            this.no = new ScatterFrame();
            this.nl = new ScatterFrame();
        }
        bf() {
            return new ScatterSplineSeriesView(this);
        }
        i7(a, b, c, d) {
            super.i7(a, b, c, d);
            switch (b) {
                case ScatterSplineSeries.$$p[0]:
                    this.jl(false);
                    this.it();
                    break;
            }
        }
        bd() {
            if (this.be == 0) {
                return 2;
            }
            else {
                return super.bd();
            }
        }
        of(a, b) {
            super.of(a, b);
            a.m.clear();
            a.u.clear();
            let c = b.bs;
            let d = b.br;
            let e = this.getEffectiveViewport1(b);
            let f = this.eu * this.eu;
            let g = Math.min(this.nq != null ? this.nq.count : 0, this.ns != null ? this.ns.count : 0);
            let h = new ScalerParams(0, c, d, this.nh.d, e);
            let i = ((() => {
                let $ret = new ScalerParams(0, c, d, this.nh.e, e);
                $ret.b = this.eh();
                return $ret;
            })());
            let j = (k) => this.nh.a.dy(this.nq.item(k), h);
            let k = (l) => this.nh.b.dy(this.ns.item(l), i);
            let l = ((() => {
                let $ret = new Clipper(0, d, false);
                $ret.i = a.m;
                return $ret;
            })());
            for (let m = 0; m < g;) {
                let n = m;
                ++m;
                while (m < g && this.pa(j, k, n, m) < f) {
                    ++m;
                }
                if (g > this.nx) {
                    l.j(this.pe(j, k, n, m - 1));
                }
                else {
                    let o = new OwnedPoint();
                    o.c = { $type: Point_$type, x: j(n), y: k(n) };
                    o.a = this.bz.item(n);
                    if (!a.u.containsKey(o.a)) {
                        a.u.addItem(o.a, o);
                    }
                }
            }
            if (g > this.nx) {
                l.i = null;
            }
        }
        pe(a, b, c, d) {
            if (c == d) {
                return { $type: Point_$type, x: a(c), y: b(c) };
            }
            let e = 0;
            let f = 0;
            let g = (d - c + 1);
            for (let h = c; h <= d; ++h) {
                e += a(h);
                f += b(h);
            }
            return { $type: Point_$type, x: e / g, y: f / g };
        }
        pa(a, b, c, d) {
            let e = a(d) - a(c);
            let f = b(d) - b(c);
            return e * e + f * f;
        }
        h3(a, b) {
            super.h3(a, b);
            let c = typeCast(ScatterSplineSeriesView.$, b);
            c.c0(false);
        }
        oo(a, b) {
            this.h3(false, b);
            super.oo(a, b);
            this.oi(a);
            let c = typeCast(ScatterSplineSeriesView.$, b);
            c.da.ak = new PathGeometry();
            c.da.ak.c = Numeric.h(a.m.count, (d) => a.m._inner[d].x, (d) => a.m._inner[d].y, this.pb);
        }
    }
    ScatterSplineSeries.$t = /*@__PURE__*/ markType(ScatterSplineSeries, 'ScatterSplineSeries', ScatterBase.$);
    ScatterSplineSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ScatterSplineSeries, 'raisePropertyChanged', ['Stiffness:pb:pd', [1, 0.5]]);
    return ScatterSplineSeries;
})();
//# sourceMappingURL=ScatterSplineSeries.js.map
