/*
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 { StraightNumericAxisBase } from "./StraightNumericAxisBase";
import { IScaler_$type } from "./IScaler";
import { markType } from "igniteui-react-core";
import { VerticalAxisLabelPanel } from "./VerticalAxisLabelPanel";
import { Rect } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { RangeInfo } from "./RangeInfo";
import { VerticalLogarithmicScaler } from "./VerticalLogarithmicScaler";
import { FastVerticalLinearScaler } from "./FastVerticalLinearScaler";
import { isNaN_ } from "igniteui-react-core";
import { StraightNumericAxisBaseView } from "./StraightNumericAxisBaseView";
import { AxisDefaults } from "./AxisDefaults";
/**
 * @hidden
 */
var NumericYAxis = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(NumericYAxis, _super);
    function NumericYAxis() {
        var _this = _super.call(this) || this;
        _this.ab = NumericYAxis.$;
        _this.k0 = _this.ky();
        return _this;
    }
    NumericYAxis.prototype.a4 = function () {
        return new NumericYAxisView(this);
    };
    NumericYAxis.prototype.av = function () {
        return new VerticalAxisLabelPanel();
    };
    NumericYAxis.prototype.get_cp = function () {
        return true;
    };
    NumericYAxis.prototype.ei = function () {
        return this.j7().height;
    };
    NumericYAxis.prototype.ej = function (a, b) {
        if (this.nj != null) {
            return this.nj.p(a, b);
        }
        return this.ni.p(a, b);
    };
    NumericYAxis.prototype.hn = function (a, b, c, d) {
        if (this.nj != null) {
            this.nj.v(a, b, c, d);
            return;
        }
        this.ni.v(a, b, c, d);
    };
    NumericYAxis.prototype.hm = function (a, b, c, d, e) {
        if (this.nj != null) {
            this.nj.u(a, b, c, d, e);
            return;
        }
        this.ni.u(a, b, c, d, e);
    };
    NumericYAxis.prototype.em = function (a, b) {
        if (this.nj != null) {
            return this.nj.q(a, b);
        }
        return this.ni.q(a, b);
    };
    NumericYAxis.prototype.ho = function (a, b, c, d) {
        if (this.nj != null) {
            this.nj.j(a, b, c, d);
            return;
        }
        this.ni.j(a, b, c, d);
    };
    NumericYAxis.prototype.n0 = function (a, b) {
        if (this.bi == null || isNaN_(a) || isNaN_(b)) {
            return;
        }
        var c = this.no(a, this);
        var d = this.no(b, this);
        if (isNaN_(c) || isNaN_(d)) {
            return;
        }
        this.bi.t7 = new Rect(0, this.bi.t7.x, d, this.bi.t7.width, c - d);
    };
    NumericYAxis.prototype.ky = function () {
        var _this = this;
        var a = _super.prototype.ky.call(this);
        a.b.c = function (b) {
            if (_this.az == null || _this.az.visibility == 0) {
                _this.aw.bg = b;
                if (_this.az != null && (_this.az.location == 7 || _this.az.location == 6)) {
                    _this.bi.mh();
                }
            }
        };
        a.k = function (b, c, d) { return _this.hq(c, d, b.z, b.b, false); };
        a.l = function (b, c, d, e) { return _this.hr(c, d, e, b.z); };
        a.m = function (b, c) {
            var d = b.y;
            var e = new ScalerParams(0, b.aa, b.z, _this.ci, d);
            return _this.ej(c, e);
        };
        a.q = function (b, c) { return true; };
        a.j = function (b) { return _this.im(b.t, b.n, b.z, b.a, true); };
        a.e = function (b) {
            b.n = _this.az != null && (_this.az.location == 7 || _this.az.location == 3) ? b.z.right : b.z.left;
            var c = b.y;
            var d = new ScalerParams(0, b.aa, b.z, _this.ci, c);
            if (_this.aj != null && _this.aj.bi != null) {
                var e = b.n;
                var f = b.r;
                var g = _this.ie(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.k1 = function (a, b, c, d) {
        var e = d;
        var f = _super.prototype.k1.call(this, a, b, c, d);
        var g = new ScalerParams(0, b, a, this.ch, c);
        var h = NaN;
        var i = NaN;
        if (!this.ch && b.top == 0) {
            i = this.lw;
        }
        else if (this.ch && b.bottom == 1) {
            h = this.lw;
        }
        if (isNaN_(h)) {
            h = this.em(e.bottom, g);
        }
        if (isNaN_(i)) {
            i = this.em(e.top, g);
        }
        var j = Math.min(h, i);
        var k = Math.max(h, i);
        this.l0 = j;
        this.lz = 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.h9 = function (a) {
        _super.prototype.h9.call(this, a);
        var b = this.bi != null ? this.bi.tr : Rect.empty;
        var c = this.kd;
        var d = this.j8();
        var e = this.j7();
        var f = this.k0.c(a, c, b, d, e);
        if (f != null) {
            this.lv = f.f.m;
            this.ly = f.f.l;
        }
    };
    NumericYAxis.prototype.ip = function (a, b) {
        _super.prototype.ip.call(this, a, b);
        if (b.height != a.height) {
            this.c1();
        }
    };
    NumericYAxis.prototype.get_a2 = function () {
        return 1;
    };
    Object.defineProperty(NumericYAxis.prototype, "a2", {
        get: function () {
            return this.get_a2();
        },
        enumerable: false,
        configurable: true
    });
    NumericYAxis.prototype.k3 = function () {
        if (this.li) {
            return new VerticalLogarithmicScaler();
        }
        switch (this.nh) {
            case 0: return new FastVerticalLinearScaler();
            case 1: return new VerticalLogarithmicScaler();
        }
        return null;
    };
    NumericYAxis.prototype.j$d = function (a, b) {
        return this.em.apply(this, arguments);
    };
    NumericYAxis.prototype.j$c = function (a, b) {
        return this.ej.apply(this, arguments);
    };
    NumericYAxis.prototype.j$e = function (a, b, c, d, e) {
        this.hm.apply(this, arguments);
    };
    NumericYAxis.prototype.j$f = function (a, b, c, d) {
        this.hn.apply(this, arguments);
    };
    NumericYAxis.prototype.j$g = function (a, b, c, d) {
        this.ho.apply(this, arguments);
    };
    Object.defineProperty(NumericYAxis.prototype, "j$b", {
        get: function () {
            return this.ch;
        },
        enumerable: false,
        configurable: true
    });
    NumericYAxis.prototype.j$a = function () {
        return this.ag.apply(this, arguments);
    };
    NumericYAxis.$t = markType(NumericYAxis, 'NumericYAxis', StraightNumericAxisBase.$, [IScaler_$type]);
    return NumericYAxis;
}(StraightNumericAxisBase));
export { NumericYAxis };
/**
 * @hidden
 */
var NumericYAxisView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(NumericYAxisView, _super);
    function NumericYAxisView(a) {
        var _this = _super.call(this, a) || this;
        _this.bo = null;
        _this.bo = a;
        return _this;
    }
    NumericYAxisView.prototype.al = function () {
        _super.prototype.al.call(this);
        this.a.jw = AxisDefaults.h;
    };
    NumericYAxisView.$t = markType(NumericYAxisView, 'NumericYAxisView', StraightNumericAxisBaseView.$);
    return NumericYAxisView;
}(StraightNumericAxisBaseView));
export { NumericYAxisView };
