/*
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-angular-core";
import { VerticalAxisLabelPanel } from "./VerticalAxisLabelPanel";
import { Rect } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { RangeInfo } from "./RangeInfo";
import { VerticalLogarithmicScaler } from "./VerticalLogarithmicScaler";
import { FastVerticalLinearScaler } from "./FastVerticalLinearScaler";
import { isNaN_ } from "igniteui-angular-core";
import { StraightNumericAxisBaseView } from "./StraightNumericAxisBaseView";
import { AxisDefaults } from "./AxisDefaults";
/**
 * @hidden
 */
export let NumericYAxis = /*@__PURE__*/ (() => {
    class NumericYAxis extends StraightNumericAxisBase {
        constructor() {
            super();
            this.ab = NumericYAxis.$;
            this.ky = this.kw();
        }
        a3() {
            return new NumericYAxisView(this);
        }
        au() {
            return new VerticalAxisLabelPanel();
        }
        get_co() {
            return true;
        }
        eh() {
            return this.j6().height;
        }
        ei(a, b) {
            if (this.nh != null) {
                return this.nh.p(a, b);
            }
            return this.ng.p(a, b);
        }
        hm(a, b, c, d) {
            if (this.nh != null) {
                this.nh.v(a, b, c, d);
                return;
            }
            this.ng.v(a, b, c, d);
        }
        hl(a, b, c, d, e) {
            if (this.nh != null) {
                this.nh.u(a, b, c, d, e);
                return;
            }
            this.ng.u(a, b, c, d, e);
        }
        el(a, b) {
            if (this.nh != null) {
                return this.nh.q(a, b);
            }
            return this.ng.q(a, b);
        }
        hn(a, b, c, d) {
            if (this.nh != null) {
                this.nh.j(a, b, c, d);
                return;
            }
            this.ng.j(a, b, c, d);
        }
        ny(a, b) {
            if (this.bh == null || isNaN_(a) || isNaN_(b)) {
                return;
            }
            let c = this.nm(a, this);
            let d = this.nm(b, this);
            if (isNaN_(c) || isNaN_(d)) {
                return;
            }
            this.bh.tp = new Rect(0, this.bh.tp.x, d, this.bh.tp.width, c - d);
        }
        kw() {
            let a = super.kw();
            a.b.c = (b) => {
                if (this.ay == null || this.ay.visibility == 0) {
                    this.av.bg = b;
                    if (this.ay != null && (this.ay.location == 7 || this.ay.location == 6)) {
                        this.bh.l6();
                    }
                }
            };
            a.k = (b, c, d) => this.hp(c, d, b.z, b.b, false);
            a.l = (b, c, d, e) => this.hq(c, d, e, b.z);
            a.m = (b, c) => {
                let d = b.y;
                let e = new ScalerParams(0, b.aa, b.z, this.ch, d);
                return this.ei(c, e);
            };
            a.q = (b, c) => true;
            a.j = (b) => this.il(b.t, b.n, b.z, b.a, true);
            a.e = (b) => {
                b.n = this.ay != null && (this.ay.location == 7 || this.ay.location == 3) ? b.z.right : b.z.left;
                let c = b.y;
                let d = new ScalerParams(0, b.aa, b.z, this.ch, c);
                if (this.ai != null && this.ai.bh != null) {
                    let e = b.n;
                    let f = b.r;
                    let g = this.id(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;
        }
        kz(a, b, c, d) {
            let e = d;
            let f = super.kz(a, b, c, d);
            let g = new ScalerParams(0, b, a, this.cg, c);
            let h = NaN;
            let i = NaN;
            if (!this.cg && b.top == 0) {
                i = this.lu;
            }
            else if (this.cg && b.bottom == 1) {
                h = this.lu;
            }
            if (isNaN_(h)) {
                h = this.el(e.bottom, g);
            }
            if (isNaN_(i)) {
                i = this.el(e.top, g);
            }
            let j = Math.min(h, i);
            let k = Math.max(h, i);
            this.ly = j;
            this.lx = 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;
        }
        h8(a) {
            super.h8(a);
            let b = this.bh != null ? this.bh.s9 : Rect.empty;
            let c = this.kc;
            let d = this.j7();
            let e = this.j6();
            let f = this.ky.c(a, c, b, d, e);
            if (f != null) {
                this.lt = f.f.m;
                this.lw = f.f.l;
            }
        }
        io(a, b) {
            super.io(a, b);
            if (b.height != a.height) {
                this.c0();
            }
        }
        get_a1() {
            return 1;
        }
        get a1() {
            return this.get_a1();
        }
        k1() {
            if (this.lg) {
                return new VerticalLogarithmicScaler();
            }
            switch (this.nf) {
                case 0: return new FastVerticalLinearScaler();
                case 1: return new VerticalLogarithmicScaler();
            }
            return null;
        }
        j$c(a, b) {
            return this.el.apply(this, arguments);
        }
        j$b(a, b) {
            return this.ei.apply(this, arguments);
        }
        j$d(a, b, c, d, e) {
            this.hl.apply(this, arguments);
        }
        j$e(a, b, c, d) {
            this.hm.apply(this, arguments);
        }
        j$f(a, b, c, d) {
            this.hn.apply(this, arguments);
        }
        get j$a() {
            return this.cg;
        }
    }
    NumericYAxis.$t = 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.jv = AxisDefaults.h;
        }
    }
    NumericYAxisView.$t = markType(NumericYAxisView, 'NumericYAxisView', StraightNumericAxisBaseView.$);
    return NumericYAxisView;
})();
