/*
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, markType } from "igniteui-angular-core";
import { AssigningCategoryStyleEventArgs } from "./AssigningCategoryStyleEventArgs";
import { AssigningCategoryMarkerStyleEventArgs } from "./AssigningCategoryMarkerStyleEventArgs";
import { DeviceUtils } from "igniteui-angular-core";
import { truncate } from "igniteui-angular-core";
/**
 * @hidden
 */
var CategorySeriesRenderManager = /** @class */ (function (_super) {
    tslib_1.__extends(CategorySeriesRenderManager, _super);
    function CategorySeriesRenderManager() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.ah = null;
        _this.ai = null;
        _this.l = 0;
        _this.an = null;
        _this.ap = 0;
        _this.j = 0;
        _this.k = 0;
        _this.i = 0;
        _this.h = 0;
        _this.ar = 0;
        _this.aq = 0;
        _this.al = null;
        _this.am = null;
        _this.r = 0;
        _this.ao = null;
        _this.as = 0;
        _this.p = 0;
        _this.q = 0;
        _this.o = 0;
        _this.n = 0;
        _this.au = 0;
        _this.at = 0;
        _this.aj = null;
        _this.ak = null;
        _this.m = 0;
        _this.f = false;
        _this.e = false;
        _this.af = null;
        _this.ag = null;
        _this.g = 0;
        _this.c = null;
        _this.b = null;
        _this.d = null;
        _this.s = 0;
        _this.t = 0;
        return _this;
    }
    CategorySeriesRenderManager.prototype.w = function (a, b, c, d, e) {
        this.s = d;
        this.t = e;
        this.e = false;
        this.aj = a.mv;
        this.ak = a.mw;
        this.m = 1;
        this.af = this.aj;
        this.ag = this.ak;
        this.g = this.m;
        var f = b;
        this.b = null;
        if (f) {
            this.b = new AssigningCategoryMarkerStyleEventArgs();
            this.b.i = 0;
            this.b.k = 0;
            if (a.bs != null && a.b9) {
                this.b.i = a.bs.az.maxMarkerHighlightingProgress;
                this.b.k = a.bs.az.sumMarkerHighlightingProgress;
            }
            this.b.a = c;
        }
    };
    CategorySeriesRenderManager.prototype.x = function (a, b, c, d, e, f) {
        this.s = e;
        this.t = f;
        this.f = false;
        this.al = a.k3;
        this.am = a.k4;
        this.r = a.ey;
        this.ao = a.lb;
        this.as = a.lc;
        this.p = 0;
        this.q = 0;
        this.o = 1;
        this.n = a.es;
        this.au = a.le;
        this.at = a.ld;
        this.ah = this.al;
        this.ai = this.am;
        this.l = this.r;
        this.an = this.ao;
        this.ap = this.as;
        this.j = this.p;
        this.k = this.q;
        this.i = this.o;
        this.h = this.n;
        this.ar = this.au;
        this.aq = this.at;
        this.d = c;
        var g = b;
        this.c = null;
        if (g) {
            this.c = new AssigningCategoryStyleEventArgs();
            this.c.i = 0;
            this.c.k = 0;
            if (a.bs != null && a.b9) {
                this.c.i = a.bs.az.maxHighlightingProgress;
                this.c.k = a.bs.az.sumHighlightingProgress;
            }
            this.c.a = d;
        }
    };
    CategorySeriesRenderManager.prototype.ae = function (a, b, c, d, e) {
        var f = this.ah;
        if (e) {
            f = this.ai;
        }
        if (c) {
            a._fill = f;
        }
        else {
            if (b) {
                a._stroke = f;
            }
            else {
                a._fill = f;
                a._stroke = this.ai;
            }
            a.ac = this.l;
            a.ai = this.an;
            a.ad = this.ap;
            if (d) {
            }
        }
        a._opacity = this.i;
    };
    CategorySeriesRenderManager.prototype.ad = function (a, b) {
        a._opacity = this.g;
        b.itemBrush = this.af;
        b.actualItemBrush = b.itemBrush;
        b.outline = this.ag;
        b.thickness = DeviceUtils.g(2);
    };
    CategorySeriesRenderManager.prototype.a = function (a, b) {
        var c = this.s;
        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.t * c, a - 1);
        f[1] = Math.min(e + this.t * c, a - 1);
        return f;
    };
    CategorySeriesRenderManager.prototype.u = function (a) {
        if (a == null) {
            return;
        }
        if (a.b == null) {
            return;
        }
        this.ah = a.b.a0.a$ai(a.b, a, this.ah);
        this.ai = a.b.a0.a$ai(a.b, a, this.ai);
    };
    CategorySeriesRenderManager.prototype.v = function (a) {
        if (a == null) {
            return;
        }
        if (a.b == null) {
            return;
        }
        this.af = a.b.a0.a$ai(a.b, a, this.af);
        this.ag = a.b.a0.a$ai(a.b, a, this.ag);
    };
    CategorySeriesRenderManager.prototype.y = function (a, b, c, d, e, f, g, h, i) {
        if (d == -1) {
            if (b) {
                a.c = true;
                a.h = f.e9();
                a.g = f.e8();
            }
            else {
                a.c = false;
                a.m = 0;
                a.l = e - 1;
            }
        }
        else {
            if (b) {
                var longStart_ = truncate(f.dz(c._inner[d][0], g));
                var longEnd_ = longStart_;
                if (d + 1 < c.count) {
                    longEnd_ = truncate(f.dz(c._inner[d + 1][0], g));
                }
                a.c = true;
                a.h = (new Date(longStart_));
                a.g = (new Date(longEnd_));
                if (f.b8) {
                    var j = a.g;
                    a.g = a.h;
                    a.h = j;
                }
                if (i) {
                    a.m = d;
                    a.l = d;
                }
                else {
                    var k = this.a(e, d);
                    a.m = k[0];
                    a.l = k[1];
                }
            }
            else {
                if (i) {
                    a.m = d;
                    a.l = d;
                }
                else {
                    var l = this.a(e, d);
                    a.c = false;
                    a.m = l[0];
                    a.l = l[1];
                }
            }
        }
    };
    CategorySeriesRenderManager.prototype.ac = function (a, b, c, d, e, f, g) {
        this.ah = this.al;
        this.ai = this.am;
        this.l = this.r;
        this.an = this.ao;
        this.ap = this.as;
        this.j = this.p;
        this.k = this.q;
        this.i = this.o;
        var h = this.c;
        var i = d.cd;
        this.y(h, i, a, b, c, d, e, f, false);
        h.n = this.ah;
        h.o = this.ai;
        h.r = this.l;
        h.s = this.an;
        h.t = this.ap;
        h.p = this.j;
        h.q = this.k;
        h.j = this.i;
        h.e = this.f;
        h.d = false;
    };
    CategorySeriesRenderManager.prototype.aa = function (a, b, c) {
        var d = this.c;
        this.ah = d.n;
        this.ai = d.o;
        this.l = d.r;
        this.an = d.s;
        this.ap = d.t;
        this.j = d.p;
        this.k = d.q;
        this.i = d.j;
        if (c && !d.d && !b) {
            this.u(a);
        }
    };
    CategorySeriesRenderManager.prototype.ab = function (a, b, c, d, e, f, g) {
        this.af = this.aj;
        this.ag = this.ak;
        this.g = this.m;
        var h = this.b;
        var i = d.cd;
        this.y(h, i, a, b, c, d, e, f, true);
        h.n = this.af;
        h.o = this.ag;
        h.j = this.g;
        h.e = this.e;
        h.d = false;
    };
    CategorySeriesRenderManager.prototype.z = function (a, b, c) {
        var d = this.b;
        this.af = d.n;
        this.ag = d.o;
        this.g = d.j;
        if (c && !d.d && !b) {
            this.v(a);
        }
    };
    CategorySeriesRenderManager.$t = markType(CategorySeriesRenderManager, 'CategorySeriesRenderManager');
    return CategorySeriesRenderManager;
}(Base));
export { CategorySeriesRenderManager };
//# sourceMappingURL=CategorySeriesRenderManager.js.map