/*
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 { LinearScaler } from "./LinearScaler";
import { NumericScaler } from "./NumericScaler";
import { markType } from "igniteui-react-core/ES5/type";
import { ArrayAccessHelper } from "igniteui-react-core/ES5/ArrayAccessHelper";
/**
 * @hidden
 */
var VerticalLinearScaler = /** @class */ (function (_super) {
    tslib_1.__extends(VerticalLinearScaler, _super);
    function VerticalLinearScaler() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    VerticalLinearScaler.prototype.q = function (a, b) {
        if (!b.c.isEmpty) {
            var c = b.e.top + b.e.height * (a - b.d.top) / b.d.height;
            c = (c * b.d.height) + b.d.top;
            c = this.ae(c, NumericScaler.ac, b.c, b.a);
            return c;
        }
        return this.ae(a, b.e, b.d, b.a);
    };
    VerticalLinearScaler.prototype.p = function (a, b) {
        if (!b.c.isEmpty) {
            var c = this.ad(a, NumericScaler.ac, b.c, b.a);
            c = (c - b.d.top) / b.d.height;
            c = b.d.top + b.d.height * (c - b.e.top) / b.e.height;
            return c;
        }
        return this.ad(a, b.e, b.d, b.a);
    };
    VerticalLinearScaler.prototype.v = function (a, b, c, d) {
        var e;
        var f = d.e;
        var g = d.d;
        var h = d.c;
        var i = d.a;
        var j = !h.isEmpty;
        var k = this.m;
        var l = this.o;
        var m = h.top;
        var n = h.height;
        var o = f.top;
        var p = f.height;
        var q = g.top;
        var r = g.height;
        var s = 0;
        var t = 1;
        var u = ArrayAccessHelper.b(a);
        var v = false;
        if (u != null) {
            v = true;
        }
        for (var w = b; w < c; w++) {
            if (v) {
                e = u[w];
            }
            else {
                e = a.item(w);
            }
            if (j) {
                var x = (e - l) / (k);
                if (!i) {
                    x = 1 - x;
                }
                x = m + n * (x - s) / t;
                var y = (x - (o * r)) / p;
                if (v) {
                    u[w] = y;
                }
                else {
                    a.item(w, y);
                }
            }
            else {
                var z = (e - l) / (k);
                if (!i) {
                    z = 1 - z;
                }
                z = q + r * (z - o) / p;
                if (v) {
                    u[w] = z;
                }
                else {
                    a.item(w, z);
                }
            }
        }
    };
    VerticalLinearScaler.prototype.ad = function (a, b, c, d) {
        var e = (a - this.o) / (this.m);
        if (!d) {
            e = 1 - e;
        }
        return c.top + c.height * (e - b.top) / b.height;
    };
    VerticalLinearScaler.prototype.ae = function (a, b, c, d) {
        var e = b.top + b.height * (a - c.top) / c.height;
        if (!d) {
            e = 1 - e;
        }
        return this.o + e * (this.m);
    };
    VerticalLinearScaler.$t = markType(VerticalLinearScaler, 'VerticalLinearScaler', LinearScaler.$);
    return VerticalLinearScaler;
}(LinearScaler));
export { VerticalLinearScaler };
