/*
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 { CategoryFramePreparer } from "./CategoryFramePreparer";
import { ISupportsMarkers_$type } from "./ISupportsMarkers";
import { IProvidesViewport_$type } from "./IProvidesViewport";
import { ISupportsErrorBars_$type } from "./ISupportsErrorBars";
import { IBucketizer_$type } from "./IBucketizer";
import { DefaultCategoryTrendlineHost } from "./DefaultCategoryTrendlineHost";
import { IHasCategoryTrendline_$type } from "./IHasCategoryTrendline";
import { DefaultSingleValueProvider } from "./DefaultSingleValueProvider";
import { IHasSingleValueCategory_$type } from "./IHasSingleValueCategory";
import { Rect } from "igniteui-angular-core";
import { typeCast, Point_$type, markType } from "igniteui-angular-core";
import { isNaN_, isInfinity } from "igniteui-angular-core";
/**
 * @hidden
 */
var BarFramePreparer = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(BarFramePreparer, _super);
    function BarFramePreparer(a) {
        var _rest = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            _rest[_i - 1] = arguments[_i];
        }
        var _this = this;
        a = (a == void 0) ? 0 : a;
        switch (a) {
            case 0:
                {
                    var c = _rest[0];
                    var d = [c, typeCast(ISupportsMarkers_$type, c), typeCast(IProvidesViewport_$type, c), typeCast(ISupportsErrorBars_$type, c), typeCast(IBucketizer_$type, c)];
                    {
                        var f = d[0];
                        var g = d[1];
                        var h = d[2];
                        var i = d[3];
                        var j = d[4];
                        _this = _super.call(this, 1, f, g, h, i, j) || this;
                        _this.ac = new DefaultCategoryTrendlineHost();
                        if (typeCast(IHasCategoryTrendline_$type, f) !== null) {
                            _this.ac = typeCast(IHasCategoryTrendline_$type, f);
                        }
                        _this.ad = new DefaultSingleValueProvider();
                        if (typeCast(IHasSingleValueCategory_$type, f) !== null) {
                            _this.ad = typeCast(IHasSingleValueCategory_$type, f);
                        }
                    }
                }
                break;
            case 1:
                {
                    var c = _rest[0];
                    var d = _rest[1];
                    var e = _rest[2];
                    var f = _rest[3];
                    var g = _rest[4];
                    _this = _super.call(this, 1, c, d, e, f, g) || this;
                    _this.ac = new DefaultCategoryTrendlineHost();
                    if (typeCast(IHasCategoryTrendline_$type, c) !== null) {
                        _this.ac = typeCast(IHasCategoryTrendline_$type, c);
                    }
                    _this.ad = new DefaultSingleValueProvider();
                    if (typeCast(IHasSingleValueCategory_$type, c) !== null) {
                        _this.ad = typeCast(IHasSingleValueCategory_$type, c);
                    }
                }
                break;
        }
        return _this;
    }
    BarFramePreparer.prototype.l = function (a, b, c, d, e, f) {
        var g = b[1];
        var h = b[0];
        var i = new Rect(0, g - 5, h - 5, 11, 11);
        if (!isNaN_(g) && !isNaN_(h) && !isInfinity(g) && !isInfinity(h) && c.tryAdd(i)) {
            a.p.add({ $type: Point_$type, x: g, y: h });
            this.c.updateMarkerTemplate(e, d, f);
            return true;
        }
        return false;
    };
    BarFramePreparer.prototype.w = function (a, b, c) {
        if (this.ac.trendLineType == 0 || this.ac.trendlinePreparer == null || this.ac.trendLinePeriod < 1) {
            return;
        }
        this.ac.trendlinePreparer.prepareLine(this.ac, a, b, c);
    };
    BarFramePreparer.$t = markType(BarFramePreparer, 'BarFramePreparer', CategoryFramePreparer.$);
    return BarFramePreparer;
}(CategoryFramePreparer));
export { BarFramePreparer };
