/*
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 { Base, fromEnum, Point_$type, markType, getEnumerator } from "igniteui-react-core/ES5/type";
import { TrendCalculators } from "igniteui-react-core/ES5/TrendCalculators";
import { NotImplementedException } from "igniteui-react-core/ES5/NotImplementedException";
var TrendAverageCalculator = /** @class */ (function (_super) {
    tslib_1.__extends(TrendAverageCalculator, _super);
    function TrendAverageCalculator() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    TrendAverageCalculator.a = function (a, b, c) {
        var d;
        switch (a) {
            case 9:
            case 10:
            case 11:
            case 13:
                if (c < 1) {
                    c = 1;
                }
                break;
        }
        switch (a) {
            case 9:
                d = TrendCalculators.e(b, c);
                break;
            case 10:
                d = TrendCalculators.b(b, c);
                break;
            case 11:
                d = TrendCalculators.c(b, c);
                break;
            case 12:
                d = TrendCalculators.a(b);
                break;
            case 13:
                d = TrendCalculators.g(b, c);
                break;
            default: throw new NotImplementedException(0);
        }
        return d;
    };
    TrendAverageCalculator.b = function (a, b, c, d) {
        if (b.count == 0) {
            var e = TrendAverageCalculator.a(a, c, d);
            try {
                for (var _a = tslib_1.__values(fromEnum(e)), _b = _a.next(); !_b.done; _b = _a.next()) {
                    var f = _b.value;
                    b.add(f);
                }
            }
            catch (e_1_1) { e_1 = { error: e_1_1 }; }
            finally {
                try {
                    if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
                }
                finally { if (e_1) throw e_1.error; }
            }
        }
        var e_1, _c;
    };
    TrendAverageCalculator.c = function (a, b, c, d, e) {
        if (b.count == 0) {
            var f = getEnumerator(TrendAverageCalculator.a(a, c, e));
            var g = getEnumerator(TrendAverageCalculator.a(a, d, e));
            while (f.moveNext() && g.moveNext()) {
                b.add({ $type: Point_$type, x: f.current, y: g.current });
            }
        }
    };
    TrendAverageCalculator.$t = markType(TrendAverageCalculator, 'TrendAverageCalculator');
    return TrendAverageCalculator;
}(Base));
export { TrendAverageCalculator };
