/*
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 { __extends } from "tslib";
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
 */
var FinancialOverlay = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(FinancialOverlay, _super);
    function FinancialOverlay() {
        var _this = _super.call(this) || this;
        _this.x5 = false;
        _this.x5 = false;
        return _this;
    }
    FinancialOverlay.prototype.get_en = function () {
        return true;
    };
    FinancialOverlay.prototype.np = function (a, b, c, d) {
        _super.prototype.np.call(this, a, b, c, d);
        if (this.ub != null && typeCast(ISortingAxis_$type, this.ub) !== null) {
            this.ub.i$i();
        }
        this.us.b0.e(this.hk);
        this.x6();
        if (this.uu != null) {
            this.uu.c1();
        }
        this.pr(true);
    };
    FinancialOverlay.prototype.get_gl = function () {
        return true;
    };
    FinancialOverlay.prototype.pa = function (a, b, c, d) {
        switch (b) {
            case "FastItemsSource":
                this.x5 = false;
                break;
            case FinancialOverlay.$$p[0]:
                this.x5 = false;
                this.pr(false);
                this.om();
                break;
            case "XAxis":
                this.x5 = false;
                break;
        }
        _super.prototype.pa.call(this, a, b, c, d);
    };
    FinancialOverlay.prototype.bu = function () {
        if (this.bv == 0) {
            return 1;
        }
        else {
            return _super.prototype.bu.call(this);
        }
    };
    FinancialOverlay.prototype.f5 = function (a, b) {
        if (this.f4(a, b)) {
            return true;
        }
        return false;
    };
    FinancialOverlay.prototype.ac = function () {
        _super.prototype.ac.call(this);
        this.pr(false);
    };
    FinancialOverlay.prototype.fp = function (a) {
        var b = this.c7 != null ? this.c7.indexOf(a) : -1;
        var c = this.cg.by;
        c = c.copy();
        var d = this.cg.bx;
        var e = new Rect(0, 0, 0, 1, 1);
        var f = this.ts(this.cg);
        var g = new ScalerParams(0, e, e, this.ub.ch, f);
        var h = new ScalerParams(0, e, e, this.uu.ch, f);
        h.b = this.h3();
        if (b >= 0 && Rect.l_op_Inequality(c, null) && Rect.l_op_Inequality(d, null)) {
            if (this.ub != null) {
                var i = this.ub.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.uu != null && this.u6 != null && this.u5 != null && b < this.u6.count && b < this.u5.count) {
                var j = this.uu.ej(this.u6.item(b), h);
                var k = this.uu.ej(this.u5.item(b), h);
                if (!isNaN_(j) && !isNaN_(k)) {
                    var 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.co.au(this.cv, c, true);
        }
        return b >= 0;
    };
    FinancialOverlay.prototype.aq = function (a) {
        if (a != null && a == this.uu && this.u6 != null && this.u5 != null) {
            return new AxisRange(this.u6.minimum, this.u5.maximum);
        }
        return null;
    };
    FinancialOverlay.$t = markType(FinancialOverlay, 'FinancialOverlay', FinancialSeries.$);
    FinancialOverlay.$$p = markDep(DependencyProperty, PropertyMetadata, FinancialOverlay, 'raisePropertyChanged', ['IgnoreFirst:x7:x9', [1, 0]]);
    return FinancialOverlay;
}(FinancialSeries));
export { FinancialOverlay };
