/*
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, __values } from "tslib";
import { ScatterBase } from "./ScatterBase";
import { IScaleLegendSeries_$type } from "igniteui-react-core";
import { ISupportsSizeScale_$type } from "./ISupportsSizeScale";
import { ISupportsFillScale_$type } from "./ISupportsFillScale";
import { Base, typeCast, Point_$type, fromEnum, markType, markDep, enumGetBox, runOn } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { UIElement } from "igniteui-react-core";
import { ActualRange } from "./ActualRange";
import { DependencyProperty } from "igniteui-react-core";
import { SizeScale } from "./SizeScale";
import { BrushScale } from "./BrushScale";
import { ScatterFrame } from "./ScatterFrame";
import { IChartLegend_$type } from "igniteui-react-core";
import { ValueBrushScale } from "./ValueBrushScale";
import { IFastItemsSource_$type } from "igniteui-react-core";
import { ScatterBaseView } from "./ScatterBaseView";
import { ScalerParams } from "./ScalerParams";
import { Dictionary$2 } from "igniteui-react-core";
import { OwnedPoint } from "./OwnedPoint";
import { BubbleMarkerManager } from "./BubbleMarkerManager";
import { IChartItemLegend_$type } from "igniteui-react-core";
import { IChartScaleLegend_$type } from "igniteui-react-core";
import { ContentControl } from "igniteui-react-core";
import { DataContext } from "igniteui-react-core";
import { DeviceUtils } from "igniteui-react-core";
import { BrushUtil } from "igniteui-react-core";
import { DataLegendSeriesValueInfo } from "igniteui-react-core";
import { DataLegendSeriesContext } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_, isInfinity, logBase } from "igniteui-react-core";
import { stringIsNullOrEmpty } from "igniteui-react-core";
import { BrushSelectionMode_$type } from "./BrushSelectionMode";
import { ScatterTrendLineManager } from "./ScatterTrendLineManager";
import { Defaults } from "./Defaults";
/**
 * @hidden
 */
var BubbleSeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(BubbleSeries, _super);
    function BubbleSeries() {
        var _this = _super.call(this) || this;
        _this.ad6 = null;
        _this.ad5 = null;
        _this.act = null;
        _this.acl = null;
        _this.ack = null;
        _this.acj = null;
        _this.ach = null;
        _this.ab = BubbleSeries.$;
        _this.yt = new ScatterFrame();
        _this.yv = new ScatterFrame();
        _this.yr = new ScatterFrame();
        return _this;
    }
    BubbleSeries.prototype.bi = function () {
        return new BubbleSeries();
    };
    BubbleSeries.prototype.get_eg = function () {
        return true;
    };
    BubbleSeries.prototype.cq = function () {
        return new BubbleSeriesView(this);
    };
    BubbleSeries.prototype.qw = function (a) {
        _super.prototype.qw.call(this, a);
        this.acg = a;
    };
    BubbleSeries.prototype.jj = function () {
        return 0.7;
    };
    BubbleSeries.prototype.ws = function () {
        if (this.wr == 0) {
            return 2;
        }
        return _super.prototype.ws.call(this);
    };
    BubbleSeries.prototype.isAttachedTo = function (a) {
        return this.a4 == a;
    };
    BubbleSeries.prototype.ef = function () {
        return true;
    };
    BubbleSeries.prototype.px = function (a) {
        _super.prototype.px.call(this, a);
        if (this.aco != null && this.act != null && this.act.count > 0) {
            for (var b = 0; b < this.act.count; b++) {
                a(this.act._inner[b]);
            }
        }
    };
    Object.defineProperty(BubbleSeries.prototype, "acn", {
        get: function () {
            return this.acp;
        },
        enumerable: false,
        configurable: true
    });
    BubbleSeries.prototype.get_isColoredItemwise = function () {
        return this.acm != null && this.acm.count > 0;
    };
    BubbleSeries.prototype.ad4 = function (a) {
        var b = typeCast(CustomPaletteBrushScale.$, this.acf);
        var c = typeCast(ValueBrushScale.$, this.acf);
        var d = this.acf;
        if (b != null && this.dl != null) {
            return b.getBrush1(a, this.dl.count);
        }
        else if (c != null) {
            return c.getBrushByIndex(a, this.acm);
        }
        else if (d != null) {
            return d.getBrush(a);
        }
        return null;
    };
    Object.defineProperty(BubbleSeries.prototype, "legendReady", {
        get: function () {
            return this.acp != null && this.acp.count != 0;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BubbleSeries.prototype, "minScaleText", {
        get: function () {
            var a = this.ace(this.aci).b;
            return (Math.round(a * 1000) / 1000).toString();
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BubbleSeries.prototype, "maxScaleText", {
        get: function () {
            var a = this.ace(this.aci).a;
            return (Math.round(a * 1000) / 1000).toString();
        },
        enumerable: false,
        configurable: true
    });
    BubbleSeries.prototype.forScaleColors = function (a) {
        for (var b = 0; b < this.acp.count; b++) {
            if (this.acf == null || !this.acf.isReady) {
                return false;
            }
            var c = NaN;
            if (this.acm != null) {
                c = (this.acm.item(b) - this.acm.minimum) / (this.acm.maximum - this.acm.minimum);
            }
            var d = (this.acp.item(b) - this.acp.minimum) / (this.acp.maximum - this.acp.minimum);
            if (isNaN_(c)) {
                c = 0;
            }
            if (isNaN_(d)) {
                d = c;
            }
            var e = this.x8;
            var f = this.ad4(b);
            var g = f != null ? f : e;
            a(g, d);
        }
        return true;
    };
    BubbleSeries.prototype.ko = function (a, b) {
        var c = this.na(b);
        if (c == BubbleSeries.$$p[5]) {
            return this.kp(a, b, this.ac8);
        }
        if (c == BubbleSeries.$$p[11]) {
            return this.kp(a, b, this.adi);
        }
        if (c == ScatterBase.$$p[12]) {
            return this.kp(a, b, this.aak);
        }
        if (c == ScatterBase.$$p[16]) {
            return this.kp(a, b, this.aas);
        }
        if (c == BubbleSeries.$$p[2]) {
            return this.kp(a, b, this.ac3);
        }
        return _super.prototype.ko.call(this, a, b);
    };
    BubbleSeries.prototype.ma = function (a) {
        var b = this.na(a);
        if (b == BubbleSeries.$$p[5]) {
            return this.ac8;
        }
        if (b == BubbleSeries.$$p[11]) {
            return this.adi;
        }
        if (b == ScatterBase.$$p[12]) {
            return this.aak;
        }
        if (b == ScatterBase.$$p[16]) {
            return this.aas;
        }
        if (b == BubbleSeries.$$p[2]) {
            return this.ac3;
        }
        return _super.prototype.ma.call(this, a);
    };
    Object.defineProperty(BubbleSeries.prototype, "acp", {
        get: function () {
            return this.acl;
        },
        set: function (a) {
            if (this.acl != a) {
                var b = this.acp;
                this.acl = a;
                this.raisePropertyChanged("RadiusColumn", b, this.acp);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BubbleSeries.prototype, "aco", {
        get: function () {
            return this.ack;
        },
        set: function (a) {
            if (this.ack != a) {
                var b = this.aco;
                this.ack = a;
                this.raisePropertyChanged("LabelColumn", b, this.aco);
            }
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(BubbleSeries.prototype, "acm", {
        get: function () {
            return this.acj;
        },
        set: function (a) {
            if (this.acj != a) {
                var b = this.acm;
                this.acj = a;
                this.raisePropertyChanged("FillColumn", b, this.acm);
            }
        },
        enumerable: false,
        configurable: true
    });
    BubbleSeries.prototype.aav = function (a, b, c, d, e) {
        if (c <= this.z0) {
            b.g = new Dictionary$2(Base.$, OwnedPoint.$, 1, c);
        }
        var f = this.z0;
        var g = this.dl;
        var h;
        var i;
        var j = this.getEffectiveViewport1(a);
        var k = new ScalerParams(0, d, e, this.yn.d, j);
        var l = new ScalerParams(0, d, e, this.yn.e, j);
        var m = false;
        var n = 0;
        if (this.c9 != null) {
            if (this.c9.fz()) {
                var o = this.c9.mt(d, k);
                m = o.c;
                n = o.d;
            }
        }
        var _loop_1 = function (p) {
            h = this_1.y8.item(p);
            i = this_1.y9.item(p);
            var q = { $type: Point_$type, x: this_1.yn.a.ek(h, k), y: this_1.yn.b.ek(i, l) };
            if (m) {
                if (q.x < e.left || q.x > e.right) {
                    if (q.x + n >= e.left && q.x + n <= e.right) {
                        q = { $type: Point_$type, x: q.x + n, y: i };
                    }
                }
            }
            if (!isInfinity(q.x) && !isInfinity(q.y)) {
                var r_1 = g.item(p);
                if (c <= f) {
                    if (!b.g.containsKey(r_1)) {
                        var s_1 = { $type: Point_$type, x: h, y: i };
                        b.g.addItem(r_1, ((function () {
                            var $ret = new OwnedPoint();
                            $ret.a = r_1;
                            $ret.b = s_1;
                            $ret.c = q;
                            return $ret;
                        })()));
                    }
                }
            }
        };
        var this_1 = this;
        for (var p = 0; p < c; p++) {
            _loop_1(p);
        }
    };
    BubbleSeries.prototype.aa5 = function (a, b) {
        var c = typeCast(BubbleSeriesView.$, b);
        var d = c.c0;
        d.m = this.acp;
        _super.prototype.aa5.call(this, a, b);
        var e = Math.min(this.y8 != null ? this.y8.count : 0, this.y9 != null ? this.y9.count : 0);
        if (e < 1) {
            return;
        }
        c.dm();
        c.dn();
    };
    BubbleSeries.prototype.adn = function () {
        if (this.c9 == null) {
            return;
        }
        if (this.a4 == null) {
            return;
        }
        if (this.a4.isItemwise) {
            var a = this.a4;
            this.a4.clearLegendItemsForSeries(this);
            this.adm();
            a.renderItemwiseContent(this);
        }
        if (this.a4.isScale) {
            var b = this.a4;
            b.restoreOriginalState();
            b.initializeLegend(this);
        }
    };
    BubbleSeries.acu = function (a, b, c, d, e) {
        if (e <= a || isNaN_(e) || isInfinity(e)) {
            return c;
        }
        if (e >= b) {
            return d;
        }
        var f = c + ((d - c) / (b - a)) * (e - a);
        return f;
    };
    BubbleSeries.acv = function (a, b, c, d, logBase_, e) {
        var f = logBase(e, logBase_);
        var g = logBase(a, logBase_);
        var h = logBase(b, logBase_);
        return BubbleSeries.acu(g, h, c, d, f);
    };
    BubbleSeries.prototype.hc = function (a, b, c) {
        var d = _super.prototype.hc.call(this, a, b, c);
        if (this.acp == null || this.dl == null || this.acp.count == 0 || this.dl.count != this.acp.count) {
            d = false;
        }
        return d;
    };
    BubbleSeries.prototype.zi = function (a, b) {
        if (b != 3) {
            return true;
        }
        if (a == null) {
            return true;
        }
        if (this.aak == a || this.aas == a || this.adi == a) {
            return true;
        }
        return false;
    };
    BubbleSeries.prototype.adm = function () {
        var _this = this;
        var a = typeCast(IChartLegend_$type, this.a4);
        if (a == null || this.dl == null) {
            return;
        }
        this.act = new List$1(UIElement.$, 0);
        var b = typeCast(CustomPaletteBrushScale.$, this.acf);
        var c = typeCast(ValueBrushScale.$, this.acf);
        var d = this.acf;
        var e = this.acd();
        var f = e.b;
        var g = e.a;
        var h = this.dl;
        var _loop_2 = function (i) {
            var j = null;
            if (c != null && this_2.acm != null) {
                var k = this_2.acm.item(i);
                j = c.getBrushByRange(k, f, g);
            }
            else if (b != null) {
                j = b.getBrush1(i, h.count);
            }
            else if (d != null) {
                j = d.getBrush(i);
            }
            var l = new ContentControl();
            var m = this_2.aco != null && this_2.aco.item(i) != null ? this_2.aco.item(i).toString() : "";
            l.content = ((function () {
                var $ret = new DataContext();
                $ret.series = _this;
                $ret.item = h.item(i);
                $ret.itemBrush = j;
                $ret.itemLabel = m;
                return $ret;
            })());
            var n = this_2.sq;
            if (n == null) {
                n = this_2.ct.bn(this_2.cy);
            }
            l.ah = n;
            this_2.act.add(l);
        };
        var this_2 = this;
        for (var i = 0; i < h.count; i++) {
            _loop_2(i);
        }
    };
    BubbleSeries.prototype.o8 = function (a, b, c, d) {
        _super.prototype.o8.call(this, a, b, c, d);
        if (this.aci != null) {
            this.aci.aa();
        }
        if (this.acf != null) {
            this.acf.x();
        }
        this.adn();
    };
    BubbleSeries.prototype.p8 = function () {
        _super.prototype.p8.call(this);
        this.adn();
    };
    BubbleSeries.prototype.qf = function () {
        _super.prototype.qf.call(this);
        this.adn();
    };
    BubbleSeries.prototype.q4 = function (a, b, c, d) {
        var e_1, _a;
        _super.prototype.q4.call(this, a, b, c, d);
        switch (b) {
            case ScatterBase.$$p[10]:
            case ScatterBase.$$p[14]:
            case ScatterBase.$$p[11]:
            case ScatterBase.$$p[15]:
            case BubbleSeries.$$p[9]:
            case BubbleSeries.$$p[10]:
                this.qa();
                break;
            case "FastItemsSource":
                if (this.aci != null) {
                    this.aci.aa();
                }
                if (this.acf != null) {
                    this.acf.x();
                }
                if (typeCast(IFastItemsSource_$type, c) != null) {
                    c.deregisterColumn(this.acp);
                    c.deregisterColumn(this.acm);
                    c.deregisterColumn(this.aco);
                    this.acp = null;
                    this.acm = null;
                    this.aco = null;
                }
                if (typeCast(IFastItemsSource_$type, d) != null) {
                    this.acp = this.di(this.adi);
                    if (!stringIsNullOrEmpty(this.ac3)) {
                        this.acm = this.di(this.ac3);
                    }
                    this.aco = this.dk(this.ac8);
                }
                this.rm(false);
                this.adn();
                break;
            case BubbleSeries.$$p[11]:
                if (this.aci != null) {
                    this.aci.aa();
                }
                if (this.dl != null) {
                    this.dl.deregisterColumn(this.acp);
                    this.acp = this.di(this.adi);
                    this.adn();
                }
                break;
            case "RadiusColumn":
                if (this.aci != null) {
                    this.aci.aa();
                }
                this.yo.c2.g$i();
                this.rm(this.ge && this.d5);
                this.qh();
                break;
            case BubbleSeries.$$p[12]:
                if (c != null) {
                    c.l.remove(this);
                    c.aa();
                }
                if (d != null) {
                    d.l.add(this);
                    d.aa();
                }
                this.rm(false);
                this.qg();
                break;
            case BubbleSeries.$$p[13]:
                this.rm(false);
                this.qg();
                break;
            case "DiscreteLegendItemTemplate":
                this.adn();
                break;
            case BubbleSeries.$$p[3]:
                if (c != null) {
                    c.o.remove(this);
                    c.x();
                }
                if (d != null) {
                    d.o.add(this);
                    d.x();
                }
                this.rm(false);
                this.adn();
                this.qg();
                break;
            case BubbleSeries.$$p[4]:
            case BubbleSeries.$$p[8]:
            case BubbleSeries.$$p[7]:
            case BubbleSeries.$$p[6]:
                this.rm(false);
                this.adn();
                this.qg();
                break;
            case "FillColumn":
                this.rm(this.ge && this.d5);
                this.qg();
                break;
            case BubbleSeries.$$p[2]:
                if (this.acf != null) {
                    this.acf.x();
                }
                if (this.dl != null) {
                    this.dl.deregisterColumn(this.acm);
                    this.acm = this.di(this.ac3);
                    this.adn();
                }
                break;
            case BubbleSeries.$$p[5]:
                if (this.dl != null) {
                    this.dl.deregisterColumn(this.aco);
                    this.aco = this.dk(this.ac8);
                    this.adn();
                }
                break;
            case "ActualLegend":
                var e = typeCast(IChartLegend_$type, c);
                if (e != null && e.isItemwise) {
                    var f = typeCast(IChartItemLegend_$type, e);
                    f.clearLegendItemsForSeries(this);
                }
                if (e != null && e.isScale) {
                    var g = typeCast(IChartScaleLegend_$type, e);
                    var h = true;
                    var i = null;
                    if (this.c9 != null) {
                        try {
                            for (var _b = __values(fromEnum(this.c9.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
                                var j = _c.value;
                                if (j.legend == g) {
                                    i = j;
                                    h = false;
                                }
                            }
                        }
                        catch (e_1_1) {
                            e_1 = { error: e_1_1 };
                        }
                        finally {
                            try {
                                if (_c && !_c.done && (_a = _b.return))
                                    _a.call(_b);
                            }
                            finally {
                                if (e_1)
                                    throw e_1.error;
                            }
                        }
                    }
                    if (h) {
                        g.restoreOriginalState();
                    }
                    else {
                        g.initializeLegend(typeCast(IScaleLegendSeries_$type, i));
                    }
                }
                this.adn();
                break;
            case "SeriesViewer":
                this.adn();
                break;
        }
    };
    BubbleSeries.prototype.updateSizeScaleGlobals = function () {
        var a = new ActualRange();
        a.b = NaN;
        a.a = NaN;
        if (this.acp != null) {
            a.b = this.acp.minimum;
            a.a = this.acp.maximum;
        }
        if (this.aci != null) {
            this.aci.ab(a.b, a.a);
        }
    };
    BubbleSeries.prototype.updateFillScaleGlobals = function () {
        var a = new ActualRange();
        a.b = NaN;
        a.a = NaN;
        if (this.acm != null) {
            a.b = this.acm.minimum;
            a.a = this.acm.maximum;
        }
        if (this.acf != null) {
            this.acf.z(a.b, a.a);
        }
    };
    BubbleSeries.prototype.ace = function (a) {
        var b = new ActualRange();
        b.b = NaN;
        b.a = NaN;
        if (this.acp != null) {
            b.b = this.acp.minimum;
            b.a = this.acp.maximum;
        }
        if (a != null) {
            a.x();
            if (this.acs) {
                b.b = a.globalMinimum;
                b.a = a.globalMaximum;
            }
        }
        return b;
    };
    BubbleSeries.prototype.acd = function () {
        var a = new ActualRange();
        a.b = NaN;
        a.a = NaN;
        if (this.acm != null) {
            a.b = this.acm.minimum;
            a.a = this.acm.maximum;
        }
        var b = typeCast(ValueBrushScale.$, this.acf);
        if (b != null) {
            b.s();
            if (this.acq && this.acf.o.count > 1) {
                a.b = b.q;
                a.a = b.p;
            }
        }
        return a;
    };
    BubbleSeries.prototype.adp = function (a, b, c, d) {
        var e = c.width;
        if (!this.ct.bx.isEmpty) {
            e = this.ct.bx.width;
        }
        else if (this.c9 != null && !this.c9.v0.isEmpty) {
            e = this.c9.v0.width;
        }
        var f = DeviceUtils.c(e);
        this.ach = this.aci || ((function () {
            var $ret = new SizeScale();
            $ret.minimumValue = f / 10;
            $ret.maximumValue = f / 5;
            return $ret;
        })());
        if (this.ach != null) {
            var g = this.ach.minimumValue;
            var h = this.ach.maximumValue;
            var i = this.ach.logarithmBase;
            var j = this.ace(this.ach);
            var k = j.b;
            var l = j.a;
            if (this.ach.isLogarithmic) {
                for (var m = 0; m < b.count; m++) {
                    b._inner[m] = BubbleSeries.acv(k, l, g, h, i, b._inner[m]);
                }
            }
            else {
                for (var n = 0; n < b.count; n++) {
                    b._inner[n] = BubbleSeries.acu(k, l, g, h, b._inner[n]);
                }
            }
        }
        var o = 1;
        o = DeviceUtils.d();
        var p = this.aci == null;
        if (d) {
            var q = c.width / e;
            for (var r = 0; r < b.count; r++) {
                if (p) {
                    b._inner[r] = b._inner[r] / o;
                }
                b._inner[r] = b._inner[r] * q;
            }
        }
        for (var s = 0; s < a.count; s++) {
            var t = a._inner[s];
            if (p && !d) {
                t.width = Math.max(0, b._inner[s] / o);
                t.height = Math.max(0, b._inner[s] / o);
            }
            else {
                t.width = Math.max(0, b._inner[s]);
                t.height = Math.max(0, b._inner[s]);
            }
        }
    };
    BubbleSeries.prototype.ado = function (a) {
        var b = typeCast(BubbleSeriesView.$, this.cs);
        this.acg.b7 = false;
        if (b != null) {
            b.b7 = false;
        }
        var c = typeCast(CustomPaletteBrushScale.$, this.acf);
        var d = typeCast(ValueBrushScale.$, this.acf);
        var e = this.acf;
        var f = this.acd();
        var g = f.b;
        var h = f.a;
        var i = this.acf == null || !this.acf.isReady || (d != null && this.ac3 == null);
        if (i) {
            this.acg.dl();
            if (b != null) {
                b.dl();
            }
            return;
        }
        this.acg.b7 = true;
        if (b != null) {
            b.b7 = true;
        }
        var j = a.count;
        var k = this.dl;
        for (var l = 0; l < j; l++) {
            var m = a._inner[l];
            var n = typeCast(DataContext.$, m.content);
            if (n != null) {
                var o = null;
                var p = k.indexOf(n.item);
                if (c != null) {
                    o = c.getBrush1(p, k.count);
                }
                else if (d != null && this.acm != null) {
                    var q = this.acm.item(p);
                    o = d.getBrushByRange(q, g, h);
                }
                else if (e != null) {
                    o = e.getBrush(p);
                }
                else {
                    if (this.ya == null) {
                        o = this.x8;
                    }
                    else {
                        o = this.ya;
                    }
                }
                var r = null;
                if (this.yb == null) {
                    r = this.x9;
                }
                else {
                    r = this.yb;
                }
                if (this.acr && o != null) {
                    r = o;
                }
                if (r != null && !isNaN_(this.acx)) {
                    r = BrushUtil.m(r, this.acx);
                }
                if (o != null && !isNaN_(this.acw)) {
                    o = BrushUtil.m(o, this.acw);
                }
                n.itemBrush = o;
                n.actualItemBrush = o;
                n.outline = r;
            }
        }
    };
    BubbleSeries.prototype.getDataLegendSeriesContextAt = function (a, b) {
        var c = { $type: Point_$type, x: a, y: b };
        var d = this.kl(c);
        var e = d == null ? NaN : this.iv(d, "XMemberPath");
        var f = d == null ? NaN : this.iv(d, "YMemberPath");
        var g = new DataLegendSeriesValueInfo();
        g.a = 13;
        g.l = e;
        g.q = "X";
        g.r = this.aak != null ? this.aak : "X";
        g.s = this.aag != null ? this.aag : "X:";
        g.t = this.aai != null ? this.aai : "";
        var h = new DataLegendSeriesValueInfo();
        h.l = f;
        h.a = 14;
        h.q = "Y";
        h.r = this.aas != null ? this.aas : "Y";
        h.s = this.aao != null ? this.aao : "Y:";
        h.t = this.aaq != null ? this.aaq : "";
        var i = new DataLegendSeriesContext();
        i.e = ((function () {
            var $ret = new List$1(DataLegendSeriesValueInfo.$, 0);
            $ret.add(g);
            $ret.add(h);
            return $ret;
        })());
        i.h = this.l9();
        if (!stringIsNullOrEmpty(this.adi)) {
            var j = d == null ? NaN : this.iv(d, "RadiusMemberPath");
            var k = new DataLegendSeriesValueInfo();
            k.l = j;
            k.a = 11;
            k.q = "Radius";
            k.r = this.adi != null ? this.adi : "Radius";
            k.s = this.ade != null ? this.ade : "R:";
            k.t = this.adg != null ? this.adg : "";
            i.e.add(k);
        }
        else if (this.ach != null) {
            var l = new DataLegendSeriesValueInfo();
            l.l = this.ach.maximumValue;
            l.a = 11;
            l.q = "Radius";
            l.r = this.adi != null ? this.adi : "Radius";
            l.s = this.ade != null ? this.ade : "R:";
            l.t = this.adg != null ? this.adg : "";
            i.e.add(l);
        }
        if (!stringIsNullOrEmpty(this.ac3)) {
            var m = d == null ? NaN : this.iv(d, "FillMemberPath");
            var n = new DataLegendSeriesValueInfo();
            n.l = m;
            n.a = 12;
            n.q = "Fill";
            n.r = this.ac3 != null ? this.ac3 : "Fill";
            n.s = this.acz != null ? this.acz : "F:";
            n.t = this.ac1 != null ? this.ac1 : "";
            i.e.add(n);
        }
        return i;
    };
    Object.defineProperty(BubbleSeries.prototype, "actualMarkerBrush", {
        get: function () {
            return this.x8;
        },
        enumerable: false,
        configurable: true
    });
    BubbleSeries.$t = markType(BubbleSeries, 'BubbleSeries', ScatterBase.$, [IScaleLegendSeries_$type, ISupportsSizeScale_$type, ISupportsFillScale_$type]);
    BubbleSeries.$$p = markDep(DependencyProperty, PropertyMetadata, BubbleSeries, 'raisePropertyChanged', ['FillMemberAsLegendLabel:acz:adq', [2, null], 'FillMemberAsLegendUnit:ac1:adr', [2, null], 'FillMemberPath:ac3:ads', [2], 'FillScale:acf:adt', [BrushScale.$], 'FillScaleUseGlobalValues:acq:adu', [0, false], 'LabelMemberPath:ac8:adv', [2], 'MarkerBrushBrightness:acw:adw', [1, NaN], 'MarkerOutlineBrightness:acx:adx', [1, NaN], 'MarkerOutlineUsesFillScale:acr:ady', [0, false], 'RadiusMemberAsLegendLabel:ade:adz', [2, null], 'RadiusMemberAsLegendUnit:adg:ad0', [2, null], 'RadiusMemberPath:adi:ad1', [2, null], 'RadiusScale:aci:ad2', [SizeScale.$], 'RadiusScaleUseGlobalValues:acs:ad3', [0, false]]);
    return BubbleSeries;
}(ScatterBase));
export { BubbleSeries };
/**
 * @hidden
 */
var CustomPaletteBrushScale = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(CustomPaletteBrushScale, _super);
    function CustomPaletteBrushScale() {
        return _super.call(this) || this;
    }
    CustomPaletteBrushScale.prototype.getBrush1 = function (a, b) {
        if (this.brushes == null || this.brushes.count == 0) {
            return null;
        }
        if (this.brushSelectionMode == 0) {
            return _super.prototype.getBrush.call(this, a % this.brushes.count);
        }
        var c = BubbleSeries.acu(0, b - 1, 0, this.brushes.count - 1, a);
        return this.ab(c);
    };
    CustomPaletteBrushScale.prototype.get_isReady = function () {
        return this.brushes != null && this.brushes.count > 0;
    };
    CustomPaletteBrushScale.$t = markType(CustomPaletteBrushScale, 'CustomPaletteBrushScale', BrushScale.$);
    CustomPaletteBrushScale.$$p = markDep(DependencyProperty, PropertyMetadata, CustomPaletteBrushScale, 'v', ['BrushSelectionMode', [BrushSelectionMode_$type, enumGetBox(BrushSelectionMode_$type, 0)]]);
    return CustomPaletteBrushScale;
}(BrushScale));
export { CustomPaletteBrushScale };
/**
 * @hidden
 */
var BubbleSeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(BubbleSeriesView, _super);
    function BubbleSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.dk = null;
        _this.dk = a;
        _this.c2 = new ScatterTrendLineManager();
        return _this;
    }
    BubbleSeriesView.prototype.au = function () {
        _super.prototype.au.call(this);
        if (!this.q) {
            this.b4.w1 = Defaults.e;
        }
    };
    BubbleSeriesView.prototype.cz = function () {
        var _this = this;
        return new BubbleMarkerManager(function (a) { return _this.c3.item(a); }, function (a) { return _this.c1.yn.c.item(a); }, runOn(this, this.de), runOn(this, this.cw), runOn(this, this.c4));
    };
    BubbleSeriesView.prototype.dm = function () {
        var a = this.c0;
        this.dk.adp(a.n, a.o, this.bx, this == this.e.cs);
        this.as();
    };
    BubbleSeriesView.prototype.dn = function () {
        var a = this.c0;
        this.dk.ado(a.n);
    };
    BubbleSeriesView.prototype.dl = function () {
        var e_2, _a;
        var a = this.c0;
        try {
            for (var _b = __values(fromEnum(a.n)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                var c = typeCast(DataContext.$, b.content);
                if (c != null) {
                    c.itemBrush = null;
                    c.outline = null;
                }
            }
        }
        catch (e_2_1) {
            e_2 = { error: e_2_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_2)
                    throw e_2.error;
            }
        }
    };
    BubbleSeriesView.prototype.getDefaultTooltipTemplate = function () {
        var a = "<div class='ui-chart-default-tooltip-content'><span";
        var b = this.e.a9.a$u(this.e);
        if (!stringIsNullOrEmpty(b)) {
            a += " style='color:" + b + "'";
        }
        a += ">" + this.dk.title + "</span><br/><span>" + "(${item." + this.dk.aak + "}, ${item." + this.dk.aas + "})</span>";
        if (!stringIsNullOrEmpty(this.dk.adi)) {
            a += "<span>, Radius: ${item." + this.dk.adi + "}</span>";
        }
        a += "</div>";
        return a;
    };
    BubbleSeriesView.$t = markType(BubbleSeriesView, 'BubbleSeriesView', ScatterBaseView.$);
    return BubbleSeriesView;
}(ScatterBaseView));
export { BubbleSeriesView };
