/*
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 { StraightNumericAxisBase } from "./StraightNumericAxisBase";
import { IScaler_$type } from "./IScaler";
import { markType } from "igniteui-react-core/ES5/type";
import { VerticalAxisLabelPanel } from "./VerticalAxisLabelPanel";
import { Rect } from "igniteui-react-core/ES5/Rect";
import { ScalerParams } from "./ScalerParams";
import { RangeInfo } from "./RangeInfo";
import { VerticalLogarithmicScaler } from "./VerticalLogarithmicScaler";
import { FastVerticalLinearScaler } from "./FastVerticalLinearScaler";
import { isNaN_ } from "igniteui-react-core/ES5/number";
import { StraightNumericAxisBaseView } from "./StraightNumericAxisBaseView";
/**
 * @hidden
 */
var NumericYAxis = /** @class */ (function (_super) {
    tslib_1.__extends(NumericYAxis, _super);
    function NumericYAxis() {
        var _this = _super.call(this) || this;
        _this.ab = NumericYAxis.$;
        _this.i8 = _this.i6();
        return _this;
    }
    NumericYAxis.prototype.a1 = function () {
        return new NumericYAxisView(this);
    };
    NumericYAxis.prototype.as = function () {
        return new VerticalAxisLabelPanel();
    };
    NumericYAxis.prototype.get_ce = function () {
        return true;
    };
    NumericYAxis.prototype.ds = function () {
        return this.iu.height;
    };
    NumericYAxis.prototype.dt = function (a, b) {
        if (this.k7 != null) {
            return this.k7.p(a, b);
        }
        return this.k6.p(a, b);
    };
    NumericYAxis.prototype.gh = function (a, b, c, d) {
        if (this.k7 != null) {
            this.k7.v(a, b, c, d);
            return;
        }
        this.k6.v(a, b, c, d);
    };
    NumericYAxis.prototype.gg = function (a, b, c, d, e) {
        if (this.k7 != null) {
            this.k7.u(a, b, c, d, e);
            return;
        }
        this.k6.u(a, b, c, d, e);
    };
    NumericYAxis.prototype.dw = function (a, b) {
        if (this.k7 != null) {
            return this.k7.q(a, b);
        }
        return this.k6.q(a, b);
    };
    NumericYAxis.prototype.gi = function (a, b, c, d) {
        if (this.k7 != null) {
            this.k7.j(a, b, c, d);
            return;
        }
        this.k6.j(a, b, c, d);
    };
    NumericYAxis.prototype.lo = function (a, b) {
        if (this.bf == null || a == NaN || b == NaN) {
            return;
        }
        var c = this.lc(a, this);
        var d = this.lc(b, this);
        if (c == NaN || d == NaN) {
            return;
        }
        this.bf.m4 = new Rect(0, this.bf.m4.x, d, this.bf.m4.width, c - d);
    };
    NumericYAxis.prototype.i6 = function () {
        var _this = this;
        var a = _super.prototype.i6.call(this);
        a.b.c = function (b) {
            if (_this.aw == null || _this.aw.visibility == 0) {
                _this.at.a8 = b;
                if (_this.aw != null && (_this.aw.location == 7 || _this.aw.location == 6)) {
                    _this.bf.ht();
                }
            }
        };
        a.k = function (b, c, d) { return _this.gk(c, d, b.z, b.b, false); };
        a.l = function (b, c, d, e) { return _this.gl(c, d, e, b.z); };
        a.m = function (b, c) {
            var d = b.y;
            var e = new ScalerParams(0, b.aa, b.z, _this.b9, d);
            return _this.dt(c, e);
        };
        a.q = function (b, c) { return true; };
        a.j = function (b) { return _this.g9(b.t, b.n, b.z, b.a, true); };
        a.e = function (b) {
            b.n = _this.aw != null && (_this.aw.location == 7 || _this.aw.location == 3) ? b.z.right : b.z.left;
            var c = b.y;
            var d = new ScalerParams(0, b.aa, b.z, _this.b9, c);
            if (_this.ag != null && _this.ag.bf != null) {
                var e = b.n;
                var f = b.r;
                var g = _this.g4(e, f, b.aa, b.z, b.y, b.z.left, b.z.right);
                e = g.p0;
                f = g.p1;
                b.n = e;
                b.r = f;
            }
        };
        a.p = function (b, c, d) {
            var e = Math.round(c);
            return e >= Math.floor(b.z.top) && e <= Math.ceil(b.z.bottom);
        };
        return a;
    };
    NumericYAxis.prototype.i9 = function (a, b, c, d) {
        var e = d;
        var f = _super.prototype.i9.call(this, a, b, c, d);
        var g = new ScalerParams(0, b, a, this.b8, c);
        var h = NaN;
        var i = NaN;
        if (!this.b8 && b.top == 0) {
            i = this.jw;
        }
        else if (this.b8 && b.bottom == 1) {
            h = this.jw;
        }
        if (isNaN_(h)) {
            h = this.dw(e.bottom, g);
        }
        if (isNaN_(i)) {
            i = this.dw(e.top, g);
        }
        var j = Math.min(h, i);
        var k = Math.max(h, i);
        this.j0 = j;
        this.jz = k;
        var l = ((function () {
            var $ret = new RangeInfo();
            $ret.d = j;
            $ret.c = k;
            $ret.b = e.height;
            return $ret;
        })());
        f.k.add(l);
        return f;
    };
    NumericYAxis.prototype.g1 = function (a) {
        _super.prototype.g1.call(this, a);
        var b = this.bf != null ? this.bf.mq : Rect.empty;
        var c = this.iu;
        var d = this.ip();
        var e = this.io();
        var f = this.i8.c(a, c, b, d, e);
        if (f != null) {
            this.jv = f.f.m;
            this.jy = f.f.l;
        }
    };
    NumericYAxis.prototype.hb = function (a, b) {
        _super.prototype.hb.call(this, a, b);
        if (b.height != a.height) {
            this.ck();
        }
    };
    NumericYAxis.prototype.get_az = function () {
        return 1;
    };
    Object.defineProperty(NumericYAxis.prototype, "az", {
        get: function () {
            return this.get_az();
        },
        enumerable: true,
        configurable: true
    });
    NumericYAxis.prototype.jb = function () {
        if (this.jm) {
            return new VerticalLogarithmicScaler();
        }
        switch (this.k5) {
            case 0: return new FastVerticalLinearScaler();
            case 1: return new VerticalLogarithmicScaler();
        }
        return null;
    };
    NumericYAxis.prototype.j$c = function (a, b) {
        return this.dw.apply(this, arguments);
    };
    NumericYAxis.prototype.j$b = function (a, b) {
        return this.dt.apply(this, arguments);
    };
    NumericYAxis.prototype.j$d = function (a, b, c, d, e) {
        this.gg.apply(this, arguments);
    };
    NumericYAxis.prototype.j$e = function (a, b, c, d) {
        this.gh.apply(this, arguments);
    };
    NumericYAxis.prototype.j$f = function (a, b, c, d) {
        this.gi.apply(this, arguments);
    };
    Object.defineProperty(NumericYAxis.prototype, "j$a", {
        get: function () {
            return this.b8;
        },
        enumerable: true,
        configurable: true
    });
    NumericYAxis.$t = markType(NumericYAxis, 'NumericYAxis', StraightNumericAxisBase.$, [IScaler_$type]);
    return NumericYAxis;
}(StraightNumericAxisBase));
export { NumericYAxis };
/**
 * @hidden
 */
var NumericYAxisView = /** @class */ (function (_super) {
    tslib_1.__extends(NumericYAxisView, _super);
    function NumericYAxisView(a) {
        var _this = _super.call(this, a) || this;
        _this.bh = null;
        _this.bh = a;
        return _this;
    }
    NumericYAxisView.$t = markType(NumericYAxisView, 'NumericYAxisView', StraightNumericAxisBaseView.$);
    return NumericYAxisView;
}(StraightNumericAxisBaseView));
export { NumericYAxisView };
