/*
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 { SeriesRenderManager } from "./SeriesRenderManager";
import { AssigningCategoryMarkerStyleEventArgs } from "./AssigningCategoryMarkerStyleEventArgs";
import { AssigningCategoryStyleEventArgs } from "./AssigningCategoryStyleEventArgs";
import { markType } from "igniteui-angular-core";
import { truncate } from "igniteui-angular-core";
/**
 * @hidden
 */
var CategorySeriesRenderManager = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(CategorySeriesRenderManager, _super);
    function CategorySeriesRenderManager() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.az = 0;
        _this.a0 = 0;
        _this.ax = null;
        _this.ay = null;
        return _this;
    }
    CategorySeriesRenderManager.prototype.c = function () {
        this.ax = new AssigningCategoryMarkerStyleEventArgs();
        return this.ax;
    };
    CategorySeriesRenderManager.prototype.a = function () {
        this.ay = new AssigningCategoryStyleEventArgs();
        return this.ay;
    };
    CategorySeriesRenderManager.prototype.a1 = function (a, b, c, d, e) {
        this.az = d;
        this.a0 = e;
        this.w(a, b, c);
    };
    CategorySeriesRenderManager.prototype.a2 = function (a, b, c, d, e) {
        this.az = d;
        this.a0 = e;
        this.x(a, b, c);
    };
    CategorySeriesRenderManager.prototype.aw = function (a, b) {
        var c = this.az;
        var d = Math.min(b * c, a - 1);
        var e = Math.min(d + c - 1, a - 1);
        var f = new Array(2);
        f[0] = Math.min(d + this.a0 * c, a - 1);
        f[1] = Math.min(e + this.a0 * c, a - 1);
        return f;
    };
    CategorySeriesRenderManager.prototype.a3 = function (a, b, c, d, e, f, g, h, i, j) {
        if (d == -1) {
            if (b) {
                a.e = true;
                a.j = f.hi();
                a.i = f.hh();
            }
            else {
                a.e = false;
                a.z = 0;
                a.y = e - 1;
            }
        }
        else {
            if (b) {
                var longStart_ = truncate(f.fw(c._inner[d][0], g));
                var longEnd_ = longStart_;
                if (d + 1 < c.count) {
                    longEnd_ = truncate(f.fw(c._inner[d + 1][0], g));
                }
                a.e = true;
                a.j = (new Date(longStart_));
                a.i = (new Date(longEnd_));
                if (f.df) {
                    var k = a.i;
                    a.i = a.j;
                    a.j = k;
                }
                if (i) {
                    a.z = j;
                    a.y = j;
                }
                else {
                    a.z = j;
                    a.y = j;
                }
            }
            else {
                if (i) {
                    var l = this.aw(e, d);
                    a.z = j;
                    a.y = j;
                }
                else {
                    var m = this.aw(e, d);
                    a.e = false;
                    a.z = m[0];
                    a.y = m[1];
                }
            }
        }
    };
    CategorySeriesRenderManager.$t = markType(CategorySeriesRenderManager, 'CategorySeriesRenderManager', SeriesRenderManager.$);
    return CategorySeriesRenderManager;
}(SeriesRenderManager));
export { CategorySeriesRenderManager };
