/*
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, String_$type, markType } from "./type";
import { ISummaryResult_$type } from "./ISummaryResult";
import { List$1 } from "./List$1";
import { Dictionary$2 } from "./Dictionary$2";
/**
 * @hidden
 */
var SectionData = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(SectionData, _super);
    function SectionData() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.p = false;
        _this.ae = 0;
        _this.af = 0;
        _this.ad = 0;
        _this.e = null;
        _this.f = null;
        _this.i = null;
        _this.j = null;
        _this.h = null;
        _this.g = null;
        _this.aa = 0;
        _this.ah = 0;
        _this.ag = 0;
        _this.u = 0;
        _this.d = null;
        _this.v = 0;
        _this.b = null;
        _this.t = -1;
        _this.c = null;
        _this.a = null;
        _this.m = true;
        _this.l = null;
        return _this;
    }
    Object.defineProperty(SectionData.prototype, "z", {
        get: function () {
            return this.t;
        },
        set: function (a) {
            this.t = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SectionData.prototype, "ac", {
        get: function () {
            return this.af + this.c.length - this.u;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SectionData.prototype, "ab", {
        get: function () {
            return this.ac + this.d[this.x()] - 1;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SectionData.prototype, "q", {
        get: function () {
            if (!this.r) {
                return false;
            }
            for (var a = 0; a < this.c.length; a++) {
                if (!this.c[a]) {
                    return false;
                }
            }
            return true;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(SectionData.prototype, "r", {
        get: function () {
            return this.m;
        },
        set: function (a) {
            this.m = a;
        },
        enumerable: true,
        configurable: true
    });
    SectionData.prototype.ai = function (a, b) {
        this.aj(a, b, this.e.length);
    };
    SectionData.prototype.aj = function (a, b, c) {
        switch (a) {
            case 0:
                this.c = new Array(1);
                this.a = new Array(1);
                break;
            case 1:
                this.c = new Array(c);
                this.a = new Array(c);
                break;
        }
        for (var d = 0; d < this.c.length; d++) {
            this.c[d] = b;
        }
    };
    SectionData.s = function (a) {
        var b = new List$1(Dictionary$2.$.specialize(String_$type, ISummaryResult_$type), 0);
        if (a != null) {
            for (var c = 0; c < a.length; c++) {
                if (a[c] == null) {
                    continue;
                }
                if (b.count == 0) {
                    b.add(new Dictionary$2(String_$type, ISummaryResult_$type, 0));
                }
                for (var d = 0; d < b.count; d++) {
                    if (!b._inner[d].containsKey(a[c].propertyName)) {
                        b._inner[d].addItem(a[c].propertyName, a[c]);
                        break;
                    }
                    else if (d == b.count - 1) {
                        b.add(new Dictionary$2(String_$type, ISummaryResult_$type, 0));
                    }
                }
            }
        }
        return b;
    };
    SectionData.prototype.k = function (a) {
        if (a >= this.af && a < this.af + this.c.length) {
            return 1;
        }
        if (a >= this.af + this.c.length && a < this.af + this.c.length + this.ah) {
            return 5;
        }
        if (a > this.ad - this.v - this.ag && a <= this.ad - this.v) {
            return 5;
        }
        if (a > this.ad - this.v && a <= this.ad) {
            return 2;
        }
        return 0;
    };
    SectionData.prototype.y = function (a) {
        var b = -1;
        if (a >= this.af + this.c.length && a < this.af + this.c.length + this.ah) {
            b = a - (this.af + this.c.length);
        }
        if (a > this.ad - this.v - this.ag && a <= this.ad - this.v) {
            b = a - (this.ad - this.v - this.ag + 1);
        }
        return b;
    };
    SectionData.prototype.w = function () {
        var a = 0;
        if (this.a != null) {
            for (var b = 0; b < this.a.length; b++) {
                if (this.a[b] != null) {
                    a++;
                }
            }
        }
        return a;
    };
    SectionData.prototype.x = function () {
        if (this.a != null) {
            for (var a = 0; a < this.a.length; a++) {
                if (this.a[a] != null) {
                    return a;
                }
            }
        }
        return 0;
    };
    SectionData.prototype.n = function () {
        return this.d[this.d.length - 1] > 0;
    };
    SectionData.prototype.am = function (a) {
        for (var b = 0; b < this.g.length; b++) {
            if (this.g[b] == null) {
                continue;
            }
            var c = this.j[b];
            var d = SectionData.s(c);
            for (var e = 0; e < d.count; e++) {
                var f = new Array(d._inner[e].count);
                d._inner[e].values.copyTo(f, 0);
                this.g[b].a[e].summaryResults = f;
                if (a != null) {
                    a(this.g[b].a[e]);
                }
            }
        }
    };
    SectionData.prototype.ak = function (a, b) {
        if (a == null || a.rowType != 5) {
            return;
        }
        if (b < 0 && b >= this.g[a.level - 1].a.length) {
            return;
        }
        this.g[a.level - 1].a[b] = a;
    };
    SectionData.prototype.o = function () {
        for (var a = 0; a < this.g.length; a++) {
            if (this.g[a] != null) {
                for (var b = 0; b < this.g[a].a.length; b++) {
                    if (this.g[a].a[b] != null) {
                        return true;
                    }
                }
            }
        }
        return false;
    };
    SectionData.prototype.an = function (a, b, c) {
        c.summaryIndex = b;
        this.j[a][b] = c;
        if (this.p && this.l != null) {
            this.l.j[a][b] = c;
        }
    };
    SectionData.prototype.al = function (a, b) {
        for (var c = a - 1; c >= 0; c--) {
            if (this.h[c] != -1) {
                this.h[c] += b;
            }
        }
    };
    SectionData.$t = markType(SectionData, 'SectionData');
    return SectionData;
}(Base));
export { SectionData };
//# sourceMappingURL=SectionData.js.map
