/*
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 { XYChart } from "./XYChart";
import { typeCast, runOn, delegateCombine, enumGetBox, markType, TypeRegistrar, getInstanceType } from "igniteui-react-core/ES5/type";
import { CategoryChartType_$type } from "./CategoryChartType";
import { CategorySeriesMarkerCollisionAvoidance_$type } from "./CategorySeriesMarkerCollisionAvoidance";
import { CategoryTransitionInMode_$type } from "./CategoryTransitionInMode";
import { TransitionInSpeedType_$type } from "./TransitionInSpeedType";
import { CategoryXAxis } from "./CategoryXAxis";
import { List$1 } from "igniteui-react-core/ES5/List$1";
import { DataSeriesType_$type } from "igniteui-react-core/ES5/DataSeriesType";
import { NumericYAxis } from "./NumericYAxis";
import { IDataSeriesAdapterRule_$type } from "igniteui-react-core/ES5/IDataSeriesAdapterRule";
import { SimpleCategorySeriesRule } from "igniteui-react-core/ES5/SimpleCategorySeriesRule";
import { SubCollectionsRule } from "igniteui-react-core/ES5/SubCollectionsRule";
import { Series } from "./Series";
import { HorizontalAnchoredCategorySeries } from "./HorizontalAnchoredCategorySeries";
import { ArrayExtension } from "igniteui-react-core/ES5/ArrayExtension";
import { Brush } from "igniteui-react-core/ES5/Brush";
import { AxisLabelSettings } from "./AxisLabelSettings";
import { stringIsNullOrEmpty } from "igniteui-react-core/ES5/string";
/**
 * @hidden
 */
var CategoryChart = /** @class */ (function (_super) {
    tslib_1.__extends(CategoryChart, _super);
    function CategoryChart() {
        var _this = _super.call(this) || this;
        _this.p1 = 1000;
        _this.o5 = null;
        _this.op = 9;
        _this.or = 1;
        _this.o9 = false;
        _this.ot = 0;
        _this.o3 = 0;
        _this.pi = 0;
        _this.pj = 0;
        _this.ph = 0;
        _this.pk = 0;
        _this.pl = NaN;
        _this.pb = false;
        _this.p2 = 10;
        _this.pn = NaN;
        _this.pm = NaN;
        _this.po = 0;
        _this.ol = null;
        _this.om = null;
        _this.pa = true;
        _this.o7 = false;
        _this.o8 = false;
        _this.f6();
        return _this;
    }
    CategoryChart.prototype.gj = function () {
        _super.prototype.gj.call(this);
        if (this.dataChart == null) {
            return;
        }
        var a = this.dataChart.bn.i.e();
        this.on = a.d;
        this.oo = a.e;
        if (this.nx == null) {
            this.nx = a.k;
        }
        if (this.n4 == null) {
            this.n4 = a.k;
        }
    };
    CategoryChart.prototype.gl = function (a, b) {
        _super.prototype.gl.call(this, a, b);
        a.fg = this.p3;
        a.bv = this.o6;
    };
    CategoryChart.prototype.g2 = function (a, b, c) {
        var _this = this;
        _super.prototype.g2.call(this, a, b, c);
        switch (a) {
            case "TransitionInDuration":
                this.qs(function (d) { return d.fg = _this.p3; });
                break;
            case "TransitionInEasingFunction":
                this.qs(function (d) { return d.bv = _this.o6; });
                break;
        }
    };
    Object.defineProperty(CategoryChart.prototype, "p3", {
        get: function () {
            return this.p1;
        },
        set: function (a) {
            var b = this.p3;
            if (a != b) {
                this.p1 = a;
                this.g1("TransitionInDuration", b, this.p3);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "o6", {
        get: function () {
            return this.o5;
        },
        set: function (a) {
            var b = this.o6;
            if (a != b) {
                this.o5 = a;
                this.g1("TransitionInEasingFunction", b, this.o6);
            }
        },
        enumerable: true,
        configurable: true
    });
    CategoryChart.prototype.p6 = function () {
        var cvd_ = this.dj();
        cvd_.scaleByViewport();
        return (cvd_.serialize());
    };
    CategoryChart.prototype.ge = function (a) {
        _super.prototype.ge.call(this, a);
        a.cd = this.bg;
    };
    CategoryChart.prototype.gk = function (a, b) {
        _super.prototype.gk.call(this, a, b);
        var c = typeCast(HorizontalAnchoredCategorySeries.$, a);
        if (c == null) {
            return;
        }
        c.ot = this.os;
        c.nr = this.pe;
        c.na = this.ou;
        c.bp = this.o4;
        c.trendLineBrush = ArrayExtension.getModulus$1(Brush.$, this.o, b);
        c.trendLineType = this.av;
        c.trendLineThickness = this.c6;
        c.lu = this.ai(a, b);
        if (a.cz) {
            a.jb(ArrayExtension.getModulus$1(Brush.$, this.on, b), ArrayExtension.getModulus$1(Brush.$, this.oo, b));
        }
    };
    CategoryChart.prototype.ov = function () {
        return new CategoryXAxis();
    };
    CategoryChart.prototype.oz = function () {
        return new NumericYAxis();
    };
    CategoryChart.prototype.f3 = function () {
        this.xAxis = this.ov();
        this.xAxis.name = "xAxis";
        var a = this.xAxis;
        a.propertyChanged = delegateCombine(a.propertyChanged, runOn(this, this.qu));
        this.yAxis = this.oz();
        this.yAxis.name = "yAxis";
        var b = this.yAxis;
        b.propertyChanged = delegateCombine(b.propertyChanged, runOn(this, this.qv));
        if (this.xAxis.aw == null) {
            this.xAxis.aw = new AxisLabelSettings();
        }
        if (this.yAxis.aw == null) {
            this.yAxis.aw = new AxisLabelSettings();
        }
    };
    CategoryChart.prototype.m3 = function (a) {
        _super.prototype.m3.call(this, a);
        a.jh = this.pf;
    };
    Object.defineProperty(CategoryChart.prototype, "oq", {
        get: function () {
            return this.op;
        },
        set: function (a) {
            if (a != this.op) {
                var b = this.oq;
                this.op = a;
                this.g1("ChartType", enumGetBox(CategoryChartType_$type, b), enumGetBox(CategoryChartType_$type, this.oq));
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "os", {
        get: function () {
            return this.or;
        },
        set: function (a) {
            var b = this.os;
            if (a != b) {
                this.or = a;
                this.g1("MarkerCollisionAvoidance", enumGetBox(CategorySeriesMarkerCollisionAvoidance_$type, b), enumGetBox(CategorySeriesMarkerCollisionAvoidance_$type, this.os));
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "pe", {
        get: function () {
            return this.o9;
        },
        set: function (a) {
            var b = this.pe;
            if (a != b) {
                this.o9 = a;
                this.g1("IsTransitionInEnabled", b, this.pe);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "ou", {
        get: function () {
            return this.ot;
        },
        set: function (a) {
            var b = this.ou;
            if (a != b) {
                this.ot = a;
                this.g1("TransitionInMode", enumGetBox(CategoryTransitionInMode_$type, b), enumGetBox(CategoryTransitionInMode_$type, this.ou));
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "o4", {
        get: function () {
            return this.o3;
        },
        set: function (a) {
            var b = this.o4;
            if (a != b) {
                this.o3 = a;
                this.g1("TransitionInSpeedType", enumGetBox(TransitionInSpeedType_$type, b), enumGetBox(TransitionInSpeedType_$type, this.o4));
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "ps", {
        get: function () {
            return this.pi;
        },
        set: function (a) {
            var b = this.ps;
            if (a != b) {
                this.pi = a;
                this.g1("XAxisInterval", b, this.ps);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "pt", {
        get: function () {
            return this.pj;
        },
        set: function (a) {
            var b = this.pt;
            if (a != b) {
                this.pj = a;
                this.g1("XAxisMinorInterval", b, this.pt);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "pr", {
        get: function () {
            return this.ph;
        },
        set: function (a) {
            var b = this.pr;
            if (a != b) {
                this.ph = a;
                this.g1("XAxisGap", b, this.pr);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "pu", {
        get: function () {
            return this.pk;
        },
        set: function (a) {
            var b = this.pu;
            if (a != b) {
                this.pk = a;
                this.g1("XAxisOverlap", b, this.pu);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "px", {
        get: function () {
            return this.pl;
        },
        set: function (a) {
            var b = this.px;
            if (a != b) {
                this.pl = a;
                this.g1("YAxisInterval", b, this.px);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "pg", {
        get: function () {
            return this.pb;
        },
        set: function (a) {
            var b = this.pg;
            if (a != b) {
                this.pb = a;
                this.g1("YAxisIsLogarithmic", b, this.pg);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "p4", {
        get: function () {
            return this.p2;
        },
        set: function (a) {
            var b = this.p4;
            if (a != b) {
                this.p2 = a;
                this.g1("YAxisLogarithmBase", b, this.p4);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "pz", {
        get: function () {
            return this.pn;
        },
        set: function (a) {
            var b = this.pz;
            if (a != b) {
                this.pn = a;
                this.g1("YAxisMinimumValue", b, this.pz);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "py", {
        get: function () {
            return this.pm;
        },
        set: function (a) {
            var b = this.py;
            if (a != b) {
                this.pm = a;
                this.g1("YAxisMaximumValue", b, this.py);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "p0", {
        get: function () {
            return this.po;
        },
        set: function (a) {
            var b = this.p0;
            if (a != b) {
                this.po = a;
                this.g1("YAxisMinorInterval", b, this.p0);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "pq", {
        get: function () {
            return this.xAxis.k4;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "pp", {
        get: function () {
            return this.xAxis.k3;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "pw", {
        get: function () {
            return this.yAxis.jx;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "pv", {
        get: function () {
            return this.yAxis.jw;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "on", {
        get: function () {
            return this.ol;
        },
        set: function (a) {
            var b = this.on;
            if (a != b) {
                this.ol = a;
                this.g1("NegativeBrushes", b, this.on);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "oo", {
        get: function () {
            return this.om;
        },
        set: function (a) {
            var b = this.oo;
            if (a != b) {
                this.om = a;
                this.g1("NegativeOutlines", b, this.oo);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "pf", {
        get: function () {
            return this.pa;
        },
        set: function (a) {
            var b = this.pf;
            if (a != b) {
                this.pa = a;
                this.g1("YAxisAbbreviateLargeNumbers", b, this.pf);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "pc", {
        get: function () {
            return this.o7;
        },
        set: function (a) {
            var b = this.pc;
            if (a != b) {
                this.o7 = a;
                this.g1("IsCategoryHighlightingEnabled", b, this.pc);
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "pd", {
        get: function () {
            return this.o8;
        },
        set: function (a) {
            var b = this.pd;
            if (a != b) {
                this.o8 = a;
                this.g1("IsItemHighlightingEnabled", b, this.pd);
            }
        },
        enumerable: true,
        configurable: true
    });
    CategoryChart.prototype.get_b5 = function () {
        var a = new List$1(DataSeriesType_$type, 0);
        if (TypeRegistrar.isRegistered("AreaSeries")) {
            a.add(2);
        }
        if (TypeRegistrar.isRegistered("ColumnSeries")) {
            a.add(1);
        }
        if (TypeRegistrar.isRegistered("LineSeries")) {
            a.add(0);
        }
        if (TypeRegistrar.isRegistered("PointSeries")) {
            a.add(10);
        }
        if (TypeRegistrar.isRegistered("SplineSeries")) {
            a.add(6);
        }
        if (TypeRegistrar.isRegistered("SplineAreaSeries")) {
            a.add(7);
        }
        if (TypeRegistrar.isRegistered("StepAreaSeries")) {
            a.add(5);
        }
        if (TypeRegistrar.isRegistered("StepLineSeries")) {
            a.add(4);
        }
        if (TypeRegistrar.isRegistered("WaterfallSeries")) {
            a.add(8);
        }
        return a;
    };
    Object.defineProperty(CategoryChart.prototype, "b5", {
        get: function () {
            return this.get_b5();
        },
        enumerable: true,
        configurable: true
    });
    CategoryChart.prototype.qu = function (a, b) {
        switch (b.propertyName) {
            case "ActualMinimum":
                this.g8("XAxisActualMinimum");
                break;
            case "ActualMaximum":
                this.g8("XAxisActualMaximum");
                break;
        }
    };
    CategoryChart.prototype.qv = function (a, b) {
        switch (b.propertyName) {
            case "ActualMinimumValue":
                this.g8("YAxisActualMinimum");
                break;
            case "ActualMaximumValue":
                this.g8("YAxisActualMaximum");
                break;
        }
    };
    CategoryChart.prototype.hj = function () {
        _super.prototype.hj.call(this);
        this.xAxis.e2 = this.kn == null ? XYChart.kv(this.xAxis, this.v.dataSeries) : this.kn;
        this.xAxis.itemsSource = this.dataChart != null && this.dataChart.series.count > 0 ? this.dataChart.series._inner[0].itemsSource : null;
    };
    Object.defineProperty(CategoryChart.prototype, "xAxis", {
        get: function () {
            return this._xAxis;
        },
        set: function (a) {
            this._xAxis = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CategoryChart.prototype, "yAxis", {
        get: function () {
            return this._yAxis;
        },
        set: function (a) {
            this._yAxis = a;
        },
        enumerable: true,
        configurable: true
    });
    CategoryChart.prototype.oy = function (a, b) {
        switch (a) {
            case 2: return this.ar(1);
            case 3: return this.ar(10);
            case 0: return this.ar(0);
            case 1: return this.ar(2);
            case 6: return this.ar(6);
            case 7: return this.ar(7);
            case 4: return this.ar(4);
            case 5: return this.ar(5);
            case 8: return this.ar(8);
            case 9: return this.ox(b);
            default: return this.ar(1);
        }
    };
    CategoryChart.prototype.ox = function (a) {
        return this.ar(a);
    };
    CategoryChart.prototype.u = function (a) {
        switch (this.oq) {
            case 1: return 2;
            case 0: return 0;
            case 3: return 10;
            case 6: return 6;
            case 7: return 7;
            case 5: return 5;
            case 4: return 4;
            case 8: return 8;
            case 9: return a.suggestedSeries;
            default:
            case 2: return 1;
        }
    };
    CategoryChart.prototype.aq = function (a, b) {
        var c = this.oy(this.oq, a.suggestedSeries);
        c.o6 = a.findMatchingHint(0).path;
        c.xAxis = this.xAxis;
        c.yAxis = this.yAxis;
        return c;
    };
    CategoryChart.prototype.hh = function (a) {
        if (a.suggestedSecondaryAxis == 2) {
            this.yAxis.jm = true;
            this.yAxis.j9 = 10;
        }
    };
    CategoryChart.prototype.hk = function () {
        this.yAxis.jm = this.pg;
        this.yAxis.j9 = this.p4;
    };
    CategoryChart.prototype.get_b4 = function () {
        return ((function () {
            var $ret = new List$1(IDataSeriesAdapterRule_$type, 0);
            $ret.add(new SimpleCategorySeriesRule());
            $ret.add(new SubCollectionsRule());
            return $ret;
        })());
    };
    Object.defineProperty(CategoryChart.prototype, "b4", {
        get: function () {
            return this.get_b4();
        },
        enumerable: true,
        configurable: true
    });
    CategoryChart.prototype.f1 = function (a, b) {
        var c = typeCast(HorizontalAnchoredCategorySeries.$, a);
        if (c != null) {
            c.ot = this.os;
            c.lu = this.ai(a, b);
        }
    };
    CategoryChart.prototype.qs = function (a) {
        this.qt(function (b, c) { return a(b); });
    };
    CategoryChart.prototype.qt = function (a) {
        if (this.dataChart == null) {
            return;
        }
        for (var b = 0; b < this.dataChart.series.count; b++) {
            var c = typeCast(HorizontalAnchoredCategorySeries.$, this.dataChart.series._inner[b]);
            if (c == null) {
                continue;
            }
            a(c, b);
        }
    };
    CategoryChart.prototype.h7 = function () {
        return this.xAxis;
    };
    CategoryChart.prototype.h8 = function () {
        return this.yAxis;
    };
    CategoryChart.prototype.o1 = function () {
        return this.ar(30);
    };
    CategoryChart.prototype.o2 = function () {
        return this.ar(31);
    };
    CategoryChart.prototype.b1 = function (a, b) {
        var c = _super.prototype.b1.call(this, a, b);
        if (c != null) {
            var d = new List$1(Series.$, 0);
            if (this.o7) {
                d.add(this.o1());
            }
            if (this.o8) {
                d.add(this.o2());
            }
            for (var e = 0; e < d.count; e++) {
                var f = d._inner[e];
                f.name = a + getInstanceType(f).typeName;
                c.add(f);
            }
        }
        return c;
    };
    CategoryChart.prototype.ho = function (a, b, c) {
        _super.prototype.ho.call(this, a, b, c);
        if (this.v.dataSeries.count > 0) {
            if (stringIsNullOrEmpty(this.ea)) {
                this.ac.setXMemberPath(a, c.getMemberPathFor(16));
            }
            if (stringIsNullOrEmpty(this.ec)) {
                this.ac.setYMemberPath(a, c.getMemberPathFor(0));
            }
            if (stringIsNullOrEmpty(this.d6)) {
                this.ac.setLabelMemberPath(a, c.getMemberPathFor(0));
            }
            if (stringIsNullOrEmpty(this.d3)) {
                this.ac.setContentMemberPath(a, c.getMemberPathFor(0));
            }
        }
    };
    CategoryChart.prototype.g1 = function (a, b, c) {
        var _this = this;
        _super.prototype.g1.call(this, a, b, c);
        switch (a) {
            case "ChartType":
                this.hj();
                break;
            case "MarkerCollisionAvoidance":
                this.qs(function (d) { return d.ot = _this.os; });
                break;
            case "IsTransitionInEnabled":
                this.qs(function (d) { return d.nr = _this.pe; });
                break;
            case "TransitionInMode":
                this.qs(function (d) { return d.na = _this.ou; });
                break;
            case "TransitionInSpeedType":
                this.qs(function (d) { return d.bp = _this.o4; });
                break;
            case "XAxisInterval":
                this.xAxis.kz = this.ps;
                break;
            case "XAxisMinorInterval":
                this.xAxis.k0 = this.pt;
                break;
            case "XAxisGap":
                this.xAxis.jh = this.pr;
                break;
            case "XAxisOverlap":
                this.xAxis.jo = this.pu;
                break;
            case "YAxisInterval":
                this.yAxis.j1 = this.px;
                break;
            case "YAxisIsLogarithmic":
                this.yAxis.jm = this.pg;
                break;
            case "YAxisLogarithmBase":
                this.yAxis.j9 = this.p4;
                break;
            case "YAxisMinimumValue":
                this.yAxis.j5 = this.pz;
                break;
            case "YAxisMaximumValue":
                this.yAxis.j4 = this.py;
                break;
            case "YAxisMinorInterval":
                this.yAxis.j6 = this.p0;
                break;
            case "NegativeBrushes":
            case "NegativeOutlines":
                this.qt(function (d, e) {
                    if (d.cz) {
                        d.jb(ArrayExtension.getModulus$1(Brush.$, _this.on, e), ArrayExtension.getModulus$1(Brush.$, _this.oo, e));
                    }
                });
                break;
            case "YAxisAbbreviateLargeNumbers":
                this.m9(function (d) { return d.jh = _this.pf; });
                break;
            case "IsCategoryHighlightingEnabled":
            case "IsItemHighlightingEnabled":
                this.hj();
                break;
        }
    };
    CategoryChart.$t = markType(CategoryChart, 'CategoryChart', XYChart.$);
    return CategoryChart;
}(XYChart));
export { CategoryChart };
