/*
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 { ScatterDataRule } from "./ScatterDataRule";
import { DataSeries } from "./DataSeries";
import { markType } from "./type";
import { truncate } from "./number";
/**
 * @hidden
 */
export let ShapeDataRule = /*@__PURE__*/ (() => {
    class ShapeDataRule extends ScatterDataRule {
        constructor() {
            super();
            this.priority = 20;
        }
        n(a, b) {
            let c = new DataSeries();
            if (b.u) {
                c.priority = truncate(Math.round(b.q * b.o));
            }
            let d = a.getCurrentDataSource();
            if (b.i.hasPath()) {
                c.addMemberPathHint(b.i);
            }
            if (b.j.hasPath()) {
                c.addMemberPathHint(b.j);
            }
            if (b.h.hasPath()) {
                c.addMemberPathHint(b.h);
            }
            if (b.f.hasPath()) {
                c.addMemberPathHint(b.f);
            }
            if (b.e.hasPath()) {
                c.addMemberPathHint(b.e);
            }
            if (b.g.hasPath()) {
                c.addMemberPathHint(b.g);
            }
            if (b.k == 0) {
                c.suggestedSeries = 24;
            }
            else if (b.k == 3) {
                if (b.x <= this.smallDataSourceThreshold) {
                    if (b.f.hasPath()) {
                        c.suggestedSeries = 17;
                        if (b.v) {
                            c.suggestedSeries = 43;
                        }
                        c.title = this.m(a, b.f.path);
                    }
                    else if (b.c.hasPath()) {
                        c.suggestedSeries = 14;
                        if (b.v) {
                            c.suggestedSeries = 40;
                        }
                        c.title = this.m(a, b.c.path);
                    }
                    else if (b.h.hasPath()) {
                        c.suggestedSeries = 15;
                        if (b.v) {
                            c.suggestedSeries = 41;
                        }
                        c.title = this.m(a, b.h.path);
                    }
                    else {
                        if (b.p <= this.monotonicCheckAmount) {
                            if (b.b.isMonotonic(b.l, b.i.path, this.monotonicCheckAmount) || b.b.isMonotonic(b.l, b.j.path, this.monotonicCheckAmount)) {
                                c.suggestedSeries = 12;
                                if (b.v) {
                                    c.suggestedSeries = 44;
                                }
                            }
                            else {
                                c.suggestedSeries = 11;
                                if (b.v) {
                                    c.suggestedSeries = 38;
                                }
                            }
                        }
                        else {
                            c.suggestedSeries = 11;
                            if (b.v) {
                                c.suggestedSeries = 38;
                            }
                        }
                        c.title = this.l(a, b.i.path, b.j.path);
                    }
                }
                else if (b.x <= this.hugeDataSourceThreshold) {
                    if (b.c.hasPath()) {
                        c.suggestedSeries = 14;
                        if (b.v) {
                            c.suggestedSeries = 40;
                        }
                        c.title = this.m(a, b.c.path);
                    }
                    else if (b.h.hasPath()) {
                        c.suggestedSeries = 15;
                        if (b.v) {
                            c.suggestedSeries = 41;
                        }
                        c.title = this.m(a, b.h.path);
                    }
                    else {
                        c.suggestedSeries = 16;
                        if (b.v) {
                            c.suggestedSeries = 42;
                        }
                        c.title = this.l(a, b.i.path, b.j.path);
                    }
                }
                else {
                    c.suggestedSeries = 16;
                    if (b.v) {
                        c.suggestedSeries = 42;
                    }
                    c.title = this.l(a, b.i.path, b.j.path);
                }
            }
            else if (b.k == 1) {
                c.suggestedSeries = 19;
                if (b.v) {
                    c.suggestedSeries = 39;
                }
            }
            else if (b.k == 2) {
                c.suggestedSeries = 18;
                if (b.v) {
                    c.suggestedSeries = 44;
                }
                if (!b.c.hasPath() || this.c(a, d, b, b.c.path)) {
                    this.o(a, d, b);
                }
                else {
                    if (b.c.hasPath()) {
                        b.c.logarithmicSuggested = a.analyzer.shouldUseLogarithmicScale(d, b.c.path);
                    }
                }
            }
            if (b.c.hasPath()) {
                c.addMemberPathHint(b.c);
            }
            c.suggestedPrimaryAxis = 1;
            c.suggestedSecondaryAxis = 1;
            c.title = a.analyzer.expandCamelCasedWords(c.title);
            a.addDataSeries(c, this);
        }
    }
    ShapeDataRule.$t = markType(ShapeDataRule, 'ShapeDataRule', ScatterDataRule.$);
    return ShapeDataRule;
})();
