/*
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";
/**
 * @hidden
 */
export class NumericYAxis extends StraightNumericAxisBase {
    constructor() {
        super();
        this.ab = NumericYAxis.$;
        this.jf = this.jd();
    }
    a1() {
        return new NumericYAxisView(this);
    }
    as() {
        return new VerticalAxisLabelPanel();
    }
    get_cf() {
        return true;
    }
    dv() {
        return this.i1.height;
    }
    dw(a, b) {
        if (this.le != null) {
            return this.le.p(a, b);
        }
        return this.ld.p(a, b);
    }
    gn(a, b, c, d) {
        if (this.le != null) {
            this.le.v(a, b, c, d);
            return;
        }
        this.ld.v(a, b, c, d);
    }
    gm(a, b, c, d, e) {
        if (this.le != null) {
            this.le.u(a, b, c, d, e);
            return;
        }
        this.ld.u(a, b, c, d, e);
    }
    dz(a, b) {
        if (this.le != null) {
            return this.le.q(a, b);
        }
        return this.ld.q(a, b);
    }
    go(a, b, c, d) {
        if (this.le != null) {
            this.le.j(a, b, c, d);
            return;
        }
        this.ld.j(a, b, c, d);
    }
    lv(a, b) {
        if (this.bf == null || a == NaN || b == NaN) {
            return;
        }
        let c = this.lj(a, this);
        let d = this.lj(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);
    }
    jd() {
        let a = super.jd();
        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.ht();
                }
            }
        };
        a.k = (b, c, d) => this.gq(c, d, b.z, b.b, false);
        a.l = (b, c, d, e) => this.gr(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.dw(c, e);
        };
        a.q = (b, c) => true;
        a.j = (b) => this.hf(b.t, b.n, b.z, b.a, true);
        a.e = (b) => {
            b.n = this.aw != null && (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.ha(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;
    }
    jg(a, b, c, d) {
        let e = d;
        let f = super.jg(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.j3;
        }
        else if (this.b8 && b.bottom == 1) {
            h = this.j3;
        }
        if (isNaN_(h)) {
            h = this.dz(e.bottom, g);
        }
        if (isNaN_(i)) {
            i = this.dz(e.top, g);
        }
        let j = Math.min(h, i);
        let k = Math.max(h, i);
        this.j7 = j;
        this.j6 = 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;
    }
    g7(a) {
        super.g7(a);
        let b = this.bf != null ? this.bf.mq : Rect.empty;
        let c = this.i1;
        let d = this.iw();
        let e = this.iv();
        let f = this.jf.c(a, c, b, d, e);
        if (f != null) {
            this.j2 = f.f.m;
            this.j5 = f.f.l;
        }
    }
    hh(a, b) {
        super.hh(a, b);
        if (b.height != a.height) {
            this.cl();
        }
    }
    get_az() {
        return 1;
    }
    get az() {
        return this.get_az();
    }
    ji() {
        if (this.jt) {
            return new VerticalLogarithmicScaler();
        }
        switch (this.lc) {
            case 0: return new FastVerticalLinearScaler();
            case 1: return new VerticalLogarithmicScaler();
        }
        return null;
    }
    j$c(a, b) {
        return this.dz.apply(this, arguments);
    }
    j$b(a, b) {
        return this.dw.apply(this, arguments);
    }
    j$d(a, b, c, d, e) {
        this.gm.apply(this, arguments);
    }
    j$e(a, b, c, d) {
        this.gn.apply(this, arguments);
    }
    j$f(a, b, c, d) {
        this.go.apply(this, arguments);
    }
    get j$a() {
        return this.b8;
    }
}
NumericYAxis.$t = markType(NumericYAxis, 'NumericYAxis', StraightNumericAxisBase.$, [IScaler_$type]);
/**
 * @hidden
 */
export class NumericYAxisView extends StraightNumericAxisBaseView {
    constructor(a) {
        super(a);
        this.bi = null;
        this.bi = a;
    }
}
NumericYAxisView.$t = markType(NumericYAxisView, 'NumericYAxisView', StraightNumericAxisBaseView.$);
//# sourceMappingURL=NumericYAxis_combined.js.map