/*
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.o6 = false;
        this.o6 = false;
    }
    ho(a, b, c, d) {
        super.ho(a, b, c, d);
        if (this.lw != null && typeCast(ISortingAxis_$type, this.lw) !== null) {
            this.lw.i$i();
        }
        this.mc.bs.e(this.eo);
        this.o7();
        if (this.mg != null) {
            this.mg.ck();
        }
        this.i1(true);
    }
    get_ds() {
        return true;
    }
    get ds() {
        return this.get_ds();
    }
    io(a, b, c, d) {
        switch (b) {
            case "FastItemsSource":
                this.o6 = false;
                break;
            case FinancialOverlay.$$p[0]:
                this.o6 = false;
                this.i1(false);
                this.h8();
                break;
            case "XAxis":
                this.o6 = false;
                break;
        }
        super.io(a, b, c, d);
    }
    bd() {
        if (this.be == 0) {
            return 1;
        }
        else {
            return super.bd();
        }
    }
    de(a, b) {
        if (this.dd(a, b)) {
            return true;
        }
        return false;
    }
    ac() {
        super.ac();
        this.i1(false);
    }
    c6(a) {
        let b = this.bz != null ? this.bz.indexOf(a) : -1;
        let c = this.bi.bq;
        c = c.copy();
        let d = this.bi.bp;
        let e = new Rect(0, 0, 0, 1, 1);
        let f = this.lg(this.bi);
        let g = new ScalerParams(0, e, e, this.lw.b8, f);
        let h = new ScalerParams(0, e, e, this.mg.b8, f);
        if (b >= 0 && Rect.l_op_Inequality(c, null) && Rect.l_op_Inequality(d, null)) {
            if (this.lw != null) {
                let i = this.lw.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.mg != null && this.mm != null && this.mk != null && b < this.mm.count && b < this.mk.count) {
                let j = this.mg.dt(this.mm.item(b), h);
                let k = this.mg.dt(this.mk.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.mg && this.mm != null && this.mk != null) {
            return new AxisRange(this.mm.minimum, this.mk.maximum);
        }
        return null;
    }
}
FinancialOverlay.$t = markType(FinancialOverlay, 'FinancialOverlay', FinancialSeries.$);
Type.dep(DependencyProperty, PropertyMetadata, FinancialOverlay, 'raisePropertyChanged', ['IgnoreFirst:o8:pa', [1, 0]]);
/*<BeginStatics Name="Infragistics.Controls.Charts.FinancialOverlay" />*/
/*<EndStatics Name="Infragistics.Controls.Charts.FinancialOverlay" />*/
