/*
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 { FinancialSeries } from "./FinancialSeries";
import { DependencyProperty } from "igniteui-angular-core";
import { ISortingAxis_$type } from "./ISortingAxis";
import { typeCast, markType, markDep } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { AxisRange } from "./AxisRange";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_ } from "igniteui-angular-core";
/**
 * @hidden
 */
export class FinancialOverlay extends FinancialSeries {
    constructor() {
        super();
        this.pi = false;
        this.pi = false;
    }
    hy(a, b, c, d) {
        super.hy(a, b, c, d);
        if (this.l8 != null && typeCast(ISortingAxis_$type, this.l8) !== null) {
            this.l8.i$i();
        }
        this.mo.bu.e(this.eu);
        this.pj();
        if (this.mt != null) {
            this.mt.cl();
        }
        this.jd(true);
    }
    get_dv() {
        return true;
    }
    iz(a, b, c, d) {
        switch (b) {
            case "FastItemsSource":
                this.pi = false;
                break;
            case FinancialOverlay.$$p[0]:
                this.pi = false;
                this.jd(false);
                this.ik();
                break;
            case "XAxis":
                this.pi = false;
                break;
        }
        super.iz(a, b, c, d);
    }
    bd() {
        if (this.be == 0) {
            return 1;
        }
        else {
            return super.bd();
        }
    }
    dh(a, b) {
        if (this.dg(a, b)) {
            return true;
        }
        return false;
    }
    ac() {
        super.ac();
        this.jd(false);
    }
    c9(a) {
        let b = this.bz != null ? this.bz.indexOf(a) : -1;
        let c = this.bi.bs;
        c = c.copy();
        let d = this.bi.br;
        let e = new Rect(0, 0, 0, 1, 1);
        let f = this.ls(this.bi);
        let g = new ScalerParams(0, e, e, this.l8.b8, f);
        let h = new ScalerParams(0, e, e, this.mt.b8, f);
        h.b = this.eh();
        if (b >= 0 && Rect.l_op_Inequality(c, null) && Rect.l_op_Inequality(d, null)) {
            if (this.l8 != null) {
                let i = this.l8.dw(b, g);
                if (i < c.left + 0.1 * c.width) {
                    i = i + 0.4 * c.width;
                }
                if (i > c.right - 0.1 * c.width) {
                    i = i - 0.4 * c.width;
                }
                c.x = i - 0.5 * c.width;
            }
            if (this.mt != null && this.m0 != null && this.my != null && b < this.m0.count && b < this.my.count) {
                let j = this.mt.dw(this.m0.item(b), h);
                let k = this.mt.dw(this.my.item(b), h);
                if (!isNaN_(j) && !isNaN_(k)) {
                    let l = Math.abs(j - k);
                    if (c.height < l) {
                        c.height = l;
                        c.y = Math.min(j, k);
                    }
                    else {
                        if (j < c.top + 0.1 * c.height) {
                            j = j + 0.4 * c.height;
                        }
                        if (j > c.bottom - 0.1 * c.height) {
                            j = j - 0.4 * c.height;
                        }
                        c.y = j - 0.5 * c.height;
                    }
                }
            }
            this.bn.ap(this.bs, c, true);
        }
        return b >= 0;
    }
    an(a) {
        if (a != null && a == this.mt && this.m0 != null && this.my != null) {
            return new AxisRange(this.m0.minimum, this.my.maximum);
        }
        return null;
    }
}
FinancialOverlay.$t = markType(FinancialOverlay, 'FinancialOverlay', FinancialSeries.$);
FinancialOverlay.$$p = markDep(DependencyProperty, PropertyMetadata, FinancialOverlay, 'raisePropertyChanged', ['IgnoreFirst:pk:pm', [1, 0]]);
//# sourceMappingURL=FinancialOverlay.js.map