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