/*
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 { 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
 */
export let NumericYAxis = /*@__PURE__*/ (() => {
    class NumericYAxis extends StraightNumericAxisBase {
        a4() {
            return new NumericYAxisView(this);
        }
        constructor() {
            super();
            this.ab = NumericYAxis.$;
            this.k0 = this.ky();
        }
        av() {
            return new VerticalAxisLabelPanel();
        }
        get_cp() {
            return true;
        }
        ei() {
            return this.j7().height;
        }
        ej(a, b) {
            if (this.nj != null) {
                return this.nj.p(a, b);
            }
            return this.ni.p(a, b);
        }
        hn(a, b, c, d) {
            if (this.nj != null) {
                this.nj.v(a, b, c, d);
                return;
            }
            this.ni.v(a, b, c, d);
        }
        hm(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);
        }
        em(a, b) {
            if (this.nj != null) {
                return this.nj.q(a, b);
            }
            return this.ni.q(a, b);
        }
        ho(a, b, c, d) {
            if (this.nj != null) {
                this.nj.j(a, b, c, d);
                return;
            }
            this.ni.j(a, b, c, d);
        }
        n0(a, b) {
            if (this.bi == null || isNaN_(a) || isNaN_(b)) {
                return;
            }
            let c = this.no(a, this);
            let d = this.no(b, this);
            if (isNaN_(c) || isNaN_(d)) {
                return;
            }
            this.bi.t3 = new Rect(0, this.bi.t3.x, d, this.bi.t3.width, c - d);
        }
        ky() {
            let a = super.ky();
            a.b.c = (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.mg();
                    }
                }
            };
            a.k = (b, c, d) => this.hq(c, d, b.z, b.b, false);
            a.l = (b, c, d, e) => this.hr(c, d, e, b.z);
            a.m = (b, c) => {
                let d = b.y;
                let e = new ScalerParams(0, b.aa, b.z, this.ci, d);
                return this.ej(c, e);
            };
            a.q = (b, c) => true;
            a.j = (b) => this.im(b.t, b.n, b.z, b.a, true);
            a.e = (b) => {
                b.n = this.az != null && (this.az.location == 7 || this.az.location == 3) ? b.z.right : b.z.left;
                let c = b.y;
                let d = new ScalerParams(0, b.aa, b.z, this.ci, c);
                if (this.aj != null && this.aj.bi != null) {
                    let e = b.n;
                    let f = b.r;
                    let 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 = (b, c, d) => {
                let e = Math.round(c);
                return e >= Math.floor(b.z.top) && e <= Math.ceil(b.z.bottom);
            };
            return a;
        }
        k1(a, b, c, d) {
            let e = d;
            let f = super.k1(a, b, c, d);
            let g = new ScalerParams(0, b, a, this.ch, c);
            let h = NaN;
            let 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);
            }
            let j = Math.min(h, i);
            let k = Math.max(h, i);
            this.l0 = j;
            this.lz = k;
            let l = ((() => {
                let $ret = new RangeInfo();
                $ret.d = j;
                $ret.c = k;
                $ret.b = e.height;
                return $ret;
            })());
            f.k.add(l);
            return f;
        }
        h9(a) {
            super.h9(a);
            let b = this.bi != null ? this.bi.tn : Rect.empty;
            let c = this.kd;
            let d = this.j8();
            let e = this.j7();
            let f = this.k0.c(a, c, b, d, e);
            if (f != null) {
                this.lv = f.f.m;
                this.ly = f.f.l;
            }
        }
        ip(a, b) {
            super.ip(a, b);
            if (b.height != a.height) {
                this.c1();
            }
        }
        get_a2() {
            return 1;
        }
        get a2() {
            return this.get_a2();
        }
        k3() {
            if (this.li) {
                return new VerticalLogarithmicScaler();
            }
            switch (this.nh) {
                case 0: return new FastVerticalLinearScaler();
                case 1: return new VerticalLogarithmicScaler();
            }
            return null;
        }
        j$d(a, b) {
            return this.em.apply(this, arguments);
        }
        j$c(a, b) {
            return this.ej.apply(this, arguments);
        }
        j$e(a, b, c, d, e) {
            this.hm.apply(this, arguments);
        }
        j$f(a, b, c, d) {
            this.hn.apply(this, arguments);
        }
        j$g(a, b, c, d) {
            this.ho.apply(this, arguments);
        }
        get j$b() {
            return this.ch;
        }
        j$a() {
            return this.ag.apply(this, arguments);
        }
    }
    NumericYAxis.$t = /*@__PURE__*/ markType(NumericYAxis, 'NumericYAxis', StraightNumericAxisBase.$, [IScaler_$type]);
    return NumericYAxis;
})();
/**
 * @hidden
 */
export let NumericYAxisView = /*@__PURE__*/ (() => {
    class NumericYAxisView extends StraightNumericAxisBaseView {
        constructor(a) {
            super(a);
            this.bl = null;
            this.bl = a;
        }
        aj() {
            super.aj();
            this.a.jw = AxisDefaults.h;
        }
    }
    NumericYAxisView.$t = /*@__PURE__*/ markType(NumericYAxisView, 'NumericYAxisView', StraightNumericAxisBaseView.$);
    return NumericYAxisView;
})();
