/*
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 * as tslib_1 from "tslib";
import { IndicatorCalculationStrategy } from "./IndicatorCalculationStrategy";
import { String_$type, toEnum, fromEnum, markType } from "igniteui-react-core/ES5/type";
import { List$1 } from "igniteui-react-core/ES5/List$1";
import { isNaN_, isInfinity } from "igniteui-react-core/ES5/number";
/**
 * @hidden
 */
var ForceIndexIndicatorStrategy = /** @class */ (function (_super) {
    tslib_1.__extends(ForceIndexIndicatorStrategy, _super);
    function ForceIndexIndicatorStrategy() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ForceIndexIndicatorStrategy.prototype.b = function (a, b) {
        var c = new List$1(String_$type, 0);
        c.add("CloseColumn");
        c.add("VolumeColumn");
        c.o(b.a.c);
        return c;
    };
    ForceIndexIndicatorStrategy.prototype._c = function (a) {
        var b, c, d, e, f;
        return tslib_1.__generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    b = 0;
                    c = a.closeColumn;
                    d = a.volumeColumn;
                    e = a.indicatorColumn;
                    if (c != null && d != null) {
                        b = Math.min(c.count, d.count);
                    }
                    if (!(b > 0)) return [3 /*break*/, 2];
                    return [4 /*yield*/, 0];
                case 1:
                    _a.sent();
                    _a.label = 2;
                case 2:
                    f = 1;
                    _a.label = 3;
                case 3:
                    if (!(f < b)) return [3 /*break*/, 6];
                    return [4 /*yield*/, d.item(f) * (c.item(f) - c.item(f - 1))];
                case 4:
                    _a.sent();
                    _a.label = 5;
                case 5:
                    ++f;
                    return [3 /*break*/, 3];
                case 6: return [2 /*return*/];
            }
        });
    };
    ForceIndexIndicatorStrategy.prototype.c = function (a) {
        var _this = this;
        return toEnum(function () { return _this._c(a); });
    };
    ForceIndexIndicatorStrategy.prototype.a = function (a, b) {
        var e_1, _a;
        var c = this.c(a);
        var d = a.period;
        var e = a.indicatorColumn;
        if (d != 0 && !isNaN_(d) && !isInfinity(d)) {
            c = b.a.b(c, a.period);
        }
        var f = 0;
        try {
            for (var _b = tslib_1.__values(fromEnum(c)), _d = _b.next(); !_d.done; _d = _b.next()) {
                var g = _d.value;
                e.item(f, g);
                ++f;
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (_d && !_d.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_1) throw e_1.error; }
        }
        return true;
    };
    ForceIndexIndicatorStrategy.$t = markType(ForceIndexIndicatorStrategy, 'ForceIndexIndicatorStrategy', IndicatorCalculationStrategy.$);
    return ForceIndexIndicatorStrategy;
}(IndicatorCalculationStrategy));
export { ForceIndexIndicatorStrategy };
