/*
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 { __extends } from "tslib";
import { CategoryTrendLineManager } from "./CategoryTrendLineManager";
import { List$1 } from "igniteui-angular-core";
import { Point_$type, markType } from "igniteui-angular-core";
import { BarTrendFitCalculator } from "./BarTrendFitCalculator";
import { TrendAverageCalculator } from "./TrendAverageCalculator";
/**
 * @hidden
 */
var BarTrendLineManager = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(BarTrendLineManager, _super);
    function BarTrendLineManager() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    BarTrendLineManager.prototype.prepareLineCore = function (a, b, c, d, e, f, g) {
        var h = g.d * g.c;
        var i = g.e * g.c;
        var j = new List$1(Point_$type, 0);
        if (b == 0) {
            this.a = null;
            this.d.clear();
            return;
        }
        if (this.c(b)) {
            this.d.clear();
            this.a = BarTrendFitCalculator.a(j, b, g, this.a, c.count, function (k) { return c.item(k); }, function (k) { return k + 1; }, e, function (k) { return f(k - 1); }, h + 1, i + 1);
        }
        if (this.b(b)) {
            this.a = null;
            TrendAverageCalculator.b(b, this.d, c, d);
            for (var k = g.d; k <= g.e; k += 1) {
                var l = k * g.c;
                if (l >= 0 && l < this.d.count) {
                    var m = e(this.d._inner[l]);
                    var n = f(l);
                    j.add({ $type: Point_$type, x: m, y: n + g.a });
                }
            }
        }
        this.e(j, g, a);
    };
    BarTrendLineManager.$t = markType(BarTrendLineManager, 'BarTrendLineManager', CategoryTrendLineManager.$);
    return BarTrendLineManager;
}(CategoryTrendLineManager));
export { BarTrendLineManager };
