/*
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/ES2015/type";
import { VerticalAxisLabelPanel } from "./VerticalAxisLabelPanel";
import { Rect } from "igniteui-react-core/ES2015/Rect";
import { ScalerParams } from "./ScalerParams";
import { RangeInfo } from "./RangeInfo";
import { VerticalLogarithmicScaler } from "./VerticalLogarithmicScaler";
import { FastVerticalLinearScaler } from "./FastVerticalLinearScaler";
import { isNaN_ } from "igniteui-react-core/ES2015/number";
import { StraightNumericAxisBaseView } from "./StraightNumericAxisBaseView";
export class NumericYAxis extends StraightNumericAxisBase {
    constructor() {
        super();
        this.ab = NumericYAxis.$;
        this.i7 = this.i5();
    }
    a1() {
        return new NumericYAxisView(this);
    }
    as() {
        return new VerticalAxisLabelPanel();
    }
    get_ce() {
        return true;
    }
    get ce() {
        return this.get_ce();
    }
    ds() {
        return this.it.height;
    }
    dt(a, b) {
        if (this.k6 != null) {
            return this.k6.p(a, b);
        }
        return this.k5.p(a, b);
    }
    gg(a, b, c, d) {
        if (this.k6 != null) {
            this.k6.v(a, b, c, d);
            return;
        }
        this.k5.v(a, b, c, d);
    }
    gf(a, b, c, d, e) {
        if (this.k6 != null) {
            this.k6.u(a, b, c, d, e);
            return;
        }
        this.k5.u(a, b, c, d, e);
    }
    dw(a, b) {
        if (this.k6 != null) {
            return this.k6.q(a, b);
        }
        return this.k5.q(a, b);
    }
    gh(a, b, c, d) {
        if (this.k6 != null) {
            this.k6.j(a, b, c, d);
            return;
        }
        this.k5.j(a, b, c, d);
    }
    ln(a, b) {
        if (this.bf == null || a == NaN || b == NaN) {
            return;
        }
        let c = this.lb(a, this);
        let d = this.lb(b, this);
        if (c == NaN || d == NaN) {
            return;
        }
        this.bf.my = new Rect(0, this.bf.my.x, d, this.bf.my.width, c - d);
    }
    i5() {
        let a = super.i5();
        a.b.c = (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.hp();
                }
            }
        };
        a.k = (b, c, d) => this.gj(c, d, b.z, b.b, false);
        a.l = (b, c, d, e) => this.gk(c, d, e, b.z);
        a.m = (b, c) => {
            let d = b.y;
            let e = new ScalerParams(0, b.aa, b.z, this.b9, d);
            return this.dt(c, e);
        };
        a.q = (b, c) => true;
        a.j = (b) => this.g8(b.t, b.n, b.z, b.a, true);
        a.e = (b) => {
            b.n = (this.aw.location == 7 || this.aw.location == 3) ? b.z.right : b.z.left;
            let c = b.y;
            let d = new ScalerParams(0, b.aa, b.z, this.b9, c);
            if (this.ag != null && this.ag.bf != null) {
                let e = b.n;
                let f = b.r;
                let g = this.g3(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;
    }
    i8(a, b, c, d) {
        let e = d;
        let f = super.i8(a, b, c, d);
        let g = new ScalerParams(0, b, a, this.b8, c);
        let h = NaN;
        let i = NaN;
        if (!this.b8 && b.top == 0) {
            i = this.jv;
        }
        else if (this.b8 && b.bottom == 1) {
            h = this.jv;
        }
        if (isNaN_(h)) {
            h = this.dw(e.bottom, g);
        }
        if (isNaN_(i)) {
            i = this.dw(e.top, g);
        }
        let j = Math.min(h, i);
        let k = Math.max(h, i);
        this.jz = j;
        this.jy = 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;
    }
    g0(a) {
        super.g0(a);
        let b = this.bf != null ? this.bf.mk : Rect.empty;
        let c = this.it;
        let d = this.io();
        let e = this.im();
        let f = this.i7.c(a, c, b, d, e);
        if (f != null) {
            this.ju = f.f.m;
            this.jx = f.f.l;
        }
    }
    ha(a, b) {
        super.ha(a, b);
        if (b.height != a.height) {
            this.ck();
        }
    }
    get_az() {
        return 1;
    }
    get az() {
        return this.get_az();
    }
    ja() {
        if (this.jl) {
            return new VerticalLogarithmicScaler();
        }
        switch (this.k4) {
            case 0: return new FastVerticalLinearScaler();
            case 1: return new VerticalLogarithmicScaler();
        }
        return null;
    }
    j$c(a, b) {
        return this.dw.apply(this, arguments);
    }
    j$b(a, b) {
        return this.dt.apply(this, arguments);
    }
    j$d(a, b, c, d, e) {
        this.gf.apply(this, arguments);
    }
    j$e(a, b, c, d) {
        this.gg.apply(this, arguments);
    }
    j$f(a, b, c, d) {
        this.gh.apply(this, arguments);
    }
    get j$a() {
        return this.b8;
    }
}
NumericYAxis.$t = markType(NumericYAxis, 'NumericYAxis', StraightNumericAxisBase.$, [IScaler_$type]);
export class NumericYAxisView extends StraightNumericAxisBaseView {
    constructor(a) {
        super(a);
        this.bh = null;
        this.bh = a;
    }
}
NumericYAxisView.$t = markType(NumericYAxisView, 'NumericYAxisView', StraightNumericAxisBaseView.$);
