/*
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-react-core/ES2015/DependencyProperty";
import { ISortingAxis_$type } from "./ISortingAxis";
import { Type, typeCast, markType } from "igniteui-react-core/ES2015/type";
import { Rect } from "igniteui-react-core/ES2015/Rect";
import { ScalerParams } from "./ScalerParams";
import { AxisRange } from "./AxisRange";
import { PropertyMetadata } from "igniteui-react-core/ES2015/PropertyMetadata";
import { isNaN_ } from "igniteui-react-core/ES2015/number";
export class FinancialOverlay extends FinancialSeries {
    constructor() {
        super();
        this.o9 = false;
        this.o9 = false;
    }
    hr(a, b, c, d) {
        super.hr(a, b, c, d);
        if (this.lz != null && typeCast(ISortingAxis_$type, this.lz) !== null) {
            this.lz.i$i();
        }
        this.mf.bu.e(this.eq);
        this.pa();
        if (this.mk != null) {
            this.mk.ck();
        }
        this.i4(true);
    }
    get_dt() {
        return true;
    }
    ir(a, b, c, d) {
        switch (b) {
            case "FastItemsSource":
                this.o9 = false;
                break;
            case FinancialOverlay.$$p[0]:
                this.o9 = false;
                this.i4(false);
                this.ib();
                break;
            case "XAxis":
                this.o9 = false;
                break;
        }
        super.ir(a, b, c, d);
    }
    bd() {
        if (this.be == 0) {
            return 1;
        }
        else {
            return super.bd();
        }
    }
    df(a, b) {
        if (this.de(a, b)) {
            return true;
        }
        return false;
    }
    ac() {
        super.ac();
        this.i4(false);
    }
    c7(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.lj(this.bi);
        let g = new ScalerParams(0, e, e, this.lz.b8, f);
        let h = new ScalerParams(0, e, e, this.mk.b8, f);
        h.b = this.ed();
        if (b >= 0 && Rect.l_op_Inequality(c, null) && Rect.l_op_Inequality(d, null)) {
            if (this.lz != null) {
                let i = this.lz.dt(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.mk != null && this.mr != null && this.mp != null && b < this.mr.count && b < this.mp.count) {
                let j = this.mk.dt(this.mr.item(b), h);
                let k = this.mk.dt(this.mp.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.mk && this.mr != null && this.mp != null) {
            return new AxisRange(this.mr.minimum, this.mp.maximum);
        }
        return null;
    }
}
FinancialOverlay.$t = markType(FinancialOverlay, 'FinancialOverlay', FinancialSeries.$);
Type.dep(DependencyProperty, PropertyMetadata, FinancialOverlay, 'raisePropertyChanged', ['IgnoreFirst:pb:pd', [1, 0]]);
