/*
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";
import { ISortingAxis_$type } from "./ISortingAxis";
import { typeCast, markType, markDep } from "igniteui-react-core";
import { Rect } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { AxisRange } from "./AxisRange";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_ } from "igniteui-react-core";
/**
 * @hidden
 */
export let FinancialOverlay = /*@__PURE__*/ (() => {
    class FinancialOverlay extends FinancialSeries {
        get_du() {
            return true;
        }
        constructor() {
            super();
            this.tu = false;
            this.tu = false;
        }
        k5(a, b, c, d) {
            super.k5(a, b, c, d);
            if (this.qk != null && typeCast(ISortingAxis_$type, this.qk) !== null) {
                this.qk.i$i();
            }
            this.q1.bx.e(this.fx);
            this.tv();
            if (this.q6 != null) {
                this.q6.c1();
            }
            this.mn(true);
        }
        get_fc() {
            return true;
        }
        l9(a, b, c, d) {
            switch (b) {
                case "FastItemsSource":
                    this.tu = false;
                    break;
                case FinancialOverlay.$$p[0]:
                    this.tu = false;
                    this.mn(false);
                    this.lu();
                    break;
                case "XAxis":
                    this.tu = false;
                    break;
            }
            super.l9(a, b, c, d);
        }
        bq() {
            if (this.br == 0) {
                return 1;
            }
            else {
                return super.bq();
            }
        }
        ez(a, b) {
            if (this.ey(a, b)) {
                return true;
            }
            return false;
        }
        ac() {
            super.ac();
            this.mn(false);
        }
        eq(a) {
            let b = this.cl != null ? this.cl.indexOf(a) : -1;
            let c = this.b1.bv;
            c = c.copy();
            let d = this.b1.bu;
            let e = new Rect(0, 0, 0, 1, 1);
            let f = this.p1(this.b1);
            let g = new ScalerParams(0, e, e, this.qk.ch, f);
            let h = new ScalerParams(0, e, e, this.q6.ch, f);
            h.b = this.gg();
            if (b >= 0 && Rect.l_op_Inequality(c, null) && Rect.l_op_Inequality(d, null)) {
                if (this.qk != null) {
                    let i = this.qk.ej(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.q6 != null && this.rf != null && this.re != null && b < this.rf.count && b < this.re.count) {
                    let j = this.q6.ej(this.rf.item(b), h);
                    let k = this.q6.ej(this.re.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.b9.au(this.ce, c, true);
            }
            return b >= 0;
        }
        aq(a) {
            if (a != null && a == this.q6 && this.rf != null && this.re != null) {
                return new AxisRange(this.rf.minimum, this.re.maximum);
            }
            return null;
        }
    }
    FinancialOverlay.$t = /*@__PURE__*/ markType(FinancialOverlay, 'FinancialOverlay', FinancialSeries.$);
    FinancialOverlay.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, FinancialOverlay, 'raisePropertyChanged', ['IgnoreFirst:tw:ty', [1, 0]]);
    return FinancialOverlay;
})();
