/*
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, TypeRegistrar } from "igniteui-angular-core";
import { HorizontalAxisLabelPanel } from "./HorizontalAxisLabelPanel";
import { ScalerParams } from "./ScalerParams";
import { Rect } from "igniteui-angular-core";
import { RangeInfo } from "./RangeInfo";
import { HorizontalLogarithmicScaler } from "./HorizontalLogarithmicScaler";
import { FastHorizontalLinearScaler } from "./FastHorizontalLinearScaler";
import { isNaN_ } from "igniteui-angular-core";
import { StraightNumericAxisBaseView } from "./StraightNumericAxisBaseView";
/**
 * @hidden
 */
export class NumericXAxis extends StraightNumericAxisBase {
    constructor() {
        super();
        this.ab = NumericXAxis.$;
        this.jf = this.jd();
    }
    a1() {
        return new NumericXAxisView(this);
    }
    gs(a) {
        super.gs(a);
        this.lv = a;
    }
    as() {
        if (this.cp) {
            return (TypeRegistrar.create('HorizontalSmartAxisLabelPanel'));
        }
        else {
            return new HorizontalAxisLabelPanel();
        }
    }
    jd() {
        let a = super.jd();
        a.b.c = (b) => {
            if ((this.aw == null || this.aw.visibility == 0) && this.ag != null) {
                this.at.a8 = b;
                if (this.aw != null && (this.aw.location == 4 || this.aw.location == 5)) {
                    this.bf.ht();
                }
            }
        };
        a.k = (b, c, d) => this.hf(c, d, b.z, b.b, false);
        a.l = (b, c, d, e) => this.hg(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.gq(b.t, b.n, b.z, b.a, true);
        a.e = (b) => {
            b.n = b.z.bottom;
            if (this.ag != null && this.ag.bf != null) {
                let c = b.n;
                let d = b.r;
                let e = this.ha(c, d, b.aa, b.z, b.y, b.z.top, b.z.bottom);
                c = e.p0;
                d = e.p1;
                b.n = c;
                b.r = d;
            }
        };
        a.p = (b, c, d) => {
            let e = Math.round(c);
            return e >= Math.floor(b.z.left) && e <= Math.ceil(b.z.right);
        };
        return a;
    }
    dw(a, b) {
        if (this.le != null) {
            return this.le.p(a, b);
        }
        return this.ld.p(a, b);
    }
    dz(a, b) {
        if (this.le != null) {
            return this.le.q(a, b);
        }
        return this.ld.q(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);
    }
    go(a, b, c, d) {
        if (this.le != null) {
            this.le.j(a, b, c, d);
            return;
        }
        this.ld.j(a, b, c, d);
    }
    lw(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, c, this.bf.m4.y, d - c, this.bf.m4.height);
    }
    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.right == 1) {
            i = this.j3;
        }
        else if (this.b8 && b.left == 0) {
            h = this.j3;
        }
        if (isNaN_(h)) {
            h = this.dz(e.left, g);
        }
        if (isNaN_(i)) {
            i = this.dz(e.right, g);
        }
        let j = Math.min(h, i);
        let k = Math.max(h, i);
        this.j7 = j;
        this.j6 = k;
        f.k.add(((() => {
            let $ret = new RangeInfo();
            $ret.d = j;
            $ret.c = k;
            $ret.b = e.width;
            return $ret;
        })()));
        return f;
    }
    g7(a) {
        super.g7(a);
        let b = this.bf != null ? this.bf.mq : Rect.empty;
        let c = !b.isEmpty ? this.i1 : Rect.empty;
        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 0;
    }
    get az() {
        return this.get_az();
    }
    ji() {
        if (this.jt) {
            return new HorizontalLogarithmicScaler();
        }
        switch (this.lc) {
            case 0: return new FastHorizontalLinearScaler();
            case 1: return new HorizontalLogarithmicScaler();
        }
        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;
    }
}
NumericXAxis.$t = markType(NumericXAxis, 'NumericXAxis', StraightNumericAxisBase.$, [IScaler_$type]);
/**
 * @hidden
 */
export class NumericXAxisView extends StraightNumericAxisBaseView {
    constructor(a) {
        super(a);
        this.bi = null;
        this.bi = a;
    }
}
NumericXAxisView.$t = markType(NumericXAxisView, 'NumericXAxisView', StraightNumericAxisBaseView.$);
//# sourceMappingURL=NumericXAxis_combined.js.map