/*
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 { StreamingIndicatorCalculationStrategy } from "./StreamingIndicatorCalculationStrategy";
import { String_$type, toEnum, fromEnum, markType } from "igniteui-react-core/ES2015/type";
import { List$1 } from "igniteui-react-core/ES2015/List$1";
import { isNaN_ } from "igniteui-react-core/ES2015/number";
/**
 * @hidden
 */
export class PercentKCalculationStrategy extends StreamingIndicatorCalculationStrategy {
    b(a, b) {
        let c = new List$1(String_$type, 0);
        c.add("HighColumn");
        c.add("LowColumn");
        c.add("CloseColumn");
        return c;
    }
    *_c(a, b) {
        let c = a.period;
        let d = a.highColumn;
        let e = a.lowColumn;
        for (let f = 0; f < a.count; f++) {
            let g = Math.min(c, f);
            let h = -1.7976931348623157E+308;
            let i = 1.7976931348623157E+308;
            for (let j = 0; j < g; j++) {
                if (!isNaN_(d.item(f - j))) {
                    h = Math.max(h, d.item(f - j));
                }
                if (!isNaN_(e.item(f - j))) {
                    i = Math.min(i, e.item(f - j));
                }
            }
            yield b.i((a.closeColumn.item(f) - i) / (h - i) * 100);
        }
    }
    c(a, b) {
        return toEnum(() => this._c(a, b));
    }
    a(a, b) {
        let c = 0;
        for (let d of fromEnum(this.c(a, b))) {
            a.indicatorColumn.item(c, d);
            c++;
        }
        return true;
    }
}
PercentKCalculationStrategy.$t = markType(PercentKCalculationStrategy, 'PercentKCalculationStrategy', StreamingIndicatorCalculationStrategy.$);
