/*
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 { FinancialChartDropDownControlView } from "./FinancialChartDropDownControlView";
import { EnumUtil, markType } from "igniteui-angular-core";
import { FinancialIndicatorType_$type } from "./FinancialIndicatorType";
import { FinancialOverlayType_$type } from "./FinancialOverlayType";
import { TrendLineType_$type } from "igniteui-angular-core";
import { FinancialChartVolumeType_$type } from "./FinancialChartVolumeType";
import { FinancialIndicatorTypeCollection } from "./FinancialIndicatorTypeCollection";
import { FinancialOverlayTypeCollection } from "./FinancialOverlayTypeCollection";
import { stringIsNullOrEmpty } from "igniteui-angular-core";
/**
 * @hidden
 */
var FinancialChartIndicatorMenuView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(FinancialChartIndicatorMenuView, _super);
    function FinancialChartIndicatorMenuView() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    FinancialChartIndicatorMenuView.prototype.f = function (a, b, c, d) {
        _super.prototype.f.call(this, a, b, c, d);
    };
    FinancialChartIndicatorMenuView.prototype.k = function (a) {
        _super.prototype.k.call(this, a);
        var b = a;
        if (b.tagName != "LI") {
            return;
        }
        var c = b.parentNode.parentNode;
        var d;
        var e = false;
        switch (c.getAttribute("data-value")) {
            case "FinancialOverlayType":
                d = FinancialOverlayType_$type;
                e = false;
                break;
            case "TrendLineType":
                d = TrendLineType_$type;
                e = true;
                break;
            case "FinancialChartVolumeType":
                d = FinancialChartVolumeType_$type;
                e = true;
                break;
            default:
            case "FinancialIndicatorType":
                d = FinancialIndicatorType_$type;
                e = false;
                break;
        }
        var f = b.classList.toggle("checked");
        var g = b.parentNode;
        if (e) {
            for (var h = 0; h < g.children.length; h++) {
                var i = g.children.item(h);
                if (i != b) {
                    i.classList.remove("checked");
                }
            }
            var j = f ? b.getAttribute("data-value") : "None";
            if (stringIsNullOrEmpty(j)) {
                return;
            }
            var k = EnumUtil.parse(d, j, true);
            if (d == FinancialChartVolumeType_$type) {
                this.l.i = EnumUtil.getEnumValue(FinancialChartVolumeType_$type, k);
            }
            else {
                this.l.l = EnumUtil.getEnumValue(TrendLineType_$type, k);
            }
        }
        else {
            if (d == FinancialIndicatorType_$type) {
                this.l.j = new FinancialIndicatorTypeCollection(0);
                ;
            }
            else {
                this.l.k = new FinancialOverlayTypeCollection(0);
            }
            for (var l = 0; l < g.children.length; l++) {
                var m = g.children.item(l);
                if (m.classList.contains("checked")) {
                    var n = m.getAttribute("data-value");
                    if (stringIsNullOrEmpty(n)) {
                        continue;
                    }
                    var o = EnumUtil.parse(d, n, true);
                    if (d == FinancialIndicatorType_$type) {
                        var p = EnumUtil.getEnumValue(FinancialIndicatorType_$type, o);
                        this.l.j.add(p);
                    }
                    else {
                        var q = EnumUtil.getEnumValue(FinancialOverlayType_$type, o);
                        this.l.k.add(q);
                    }
                }
            }
        }
        this.a.onSelectionChanged();
    };
    Object.defineProperty(FinancialChartIndicatorMenuView.prototype, "l", {
        get: function () {
            return this.a;
        },
        enumerable: false,
        configurable: true
    });
    FinancialChartIndicatorMenuView.$t = markType(FinancialChartIndicatorMenuView, 'FinancialChartIndicatorMenuView', FinancialChartDropDownControlView.$);
    return FinancialChartIndicatorMenuView;
}(FinancialChartDropDownControlView));
export { FinancialChartIndicatorMenuView };
