/*
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 { Base, Point_$type, markType } from "igniteui-angular-core";
import { LeastSquaresFit } from "igniteui-angular-core";
import { NotImplementedException } from "igniteui-angular-core";
import { isNaN_, isInfinity } from "igniteui-angular-core";
/**
 * @hidden
 */
export let TrendFitCalculator = /*@__PURE__*/ (() => {
    class TrendFitCalculator extends Base {
        static a(a, b, c, d, e, f, g, h, i, j, k) {
            if (d == null) {
                switch (b) {
                    case 1:
                        d = LeastSquaresFit.k(e, f, g);
                        break;
                    case 2:
                        d = LeastSquaresFit.o(e, f, g);
                        break;
                    case 3:
                        d = LeastSquaresFit.i(e, f, g);
                        break;
                    case 4:
                        d = LeastSquaresFit.p(e, f, g);
                        break;
                    case 5:
                        d = LeastSquaresFit.q(e, f, g);
                        break;
                    case 7:
                        d = LeastSquaresFit.j(e, f, g);
                        break;
                    case 6:
                        d = LeastSquaresFit.l(e, f, g);
                        break;
                    case 8:
                        d = LeastSquaresFit.n(e, f, g);
                        break;
                    default: throw new NotImplementedException(0);
                }
            }
            if (d == null) {
                return null;
            }
            for (let l = 0; l < c.f.width; l += 2) {
                let m = l / (c.f.width - 1);
                let n = j + m * (k - j);
                let o = NaN;
                switch (b) {
                    case 1:
                        o = LeastSquaresFit.ad(d, n);
                        break;
                    case 2:
                        o = LeastSquaresFit.ah(d, n);
                        break;
                    case 3:
                        o = LeastSquaresFit.ab(d, n);
                        break;
                    case 4:
                        o = LeastSquaresFit.ai(d, n);
                        break;
                    case 5:
                        o = LeastSquaresFit.aj(d, n);
                        break;
                    case 7:
                        o = LeastSquaresFit.ac(d, n);
                        break;
                    case 6:
                        o = LeastSquaresFit.ae(d, n);
                        break;
                    case 8:
                        o = LeastSquaresFit.ag(d, n);
                        break;
                    default: throw new NotImplementedException(0);
                }
                n = h(n);
                o = i(o);
                if (!isNaN_(o) && !isInfinity(o)) {
                    a.add({ $type: Point_$type, x: n + c.a, y: o });
                }
            }
            return d;
        }
    }
    TrendFitCalculator.$t = markType(TrendFitCalculator, 'TrendFitCalculator');
    return TrendFitCalculator;
})();
