/*
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 { MarkerManagerBase } from "./MarkerManagerBase";
import { List$1 } from "igniteui-react-core";
import { Marker } from "./Marker";
import { Base, Number_$type, Point_$type, fromEnum, markType } from "igniteui-react-core";
import { OwnedPoint } from "./OwnedPoint";
import { boxArray$1 } from "igniteui-react-core";
import { CompareUtil } from "igniteui-react-core";
/**
 * @hidden
 */
var BubbleMarkerManager = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(BubbleMarkerManager, _super);
    function BubbleMarkerManager(a, b, c, d, e) {
        var _this = _super.call(this, a, b, c, d, e) || this;
        _this.m = null;
        _this.o = null;
        _this.n = null;
        _this.o = new List$1(Number_$type, 0);
        _this.n = new List$1(Marker.$, 0);
        return _this;
    }
    BubbleMarkerManager.prototype.l = function (a, b, c, d, e) {
        var f = this.f();
        a.clear();
        this.o.clear();
        this.n.clear();
        var g = new List$1(Number_$type, 0);
        b = Math.max(0, b);
        var h = null;
        this.i(c, d, boxArray$1(f), g);
        if (b >= g.count) {
            h = g;
        }
        else {
            h = new List$1(Number_$type, 0);
            var i = Math.max(8, e);
            var j = this.c(d, g, i, boxArray$1(f));
            var k = new List$1(Number_$type, 1, j.keys);
            if (MarkerManagerBase.b) {
                k.y();
            }
            this.k(b, j, k, h);
        }
        for (var l = 0; l < h.count; ++l) {
            var m = f[h._inner[l]].x;
            var n = f[h._inner[l]].y;
            var o = this.m.item(h._inner[l]);
            this.o.add(o);
            var p = this.h(this.g(h._inner[l]));
            p.content.item = this.g(h._inner[l]);
            p.ak = h._inner[l];
            var q = new OwnedPoint();
            q.a = p.content.item;
            q.c = { $type: Point_$type, x: m, y: n };
            if (!a.containsKey(q.a)) {
                a.addItem(q.a, q);
                this.n.add(p);
            }
        }
    };
    BubbleMarkerManager.prototype.j = function (a, b) {
        var e_1, _a;
        var c = new List$1(Base.$, 1, a.keys);
        if (MarkerManagerBase.b) {
            c.aa(function (d, e) {
                var f = a.item(d);
                var g = a.item(e);
                var h = Math.pow(f.c.x, 2) + Math.pow(f.c.y, 2);
                var i = Math.pow(g.c.x, 2) + Math.pow(g.c.y, 2);
                return CompareUtil.compareToObject(h, i);
            });
        }
        try {
            for (var _b = tslib_1.__values(fromEnum(c)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var d = _c.value;
                var e = a.item(d);
                var f = this.h(e.a);
                f.s = c.indexOf1(d);
                f.n = e.c.x;
                f.o = e.c.y;
            }
        }
        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;
            }
        }
        this.a(a);
    };
    BubbleMarkerManager.$t = markType(BubbleMarkerManager, 'BubbleMarkerManager', MarkerManagerBase.$);
    return BubbleMarkerManager;
}(MarkerManagerBase));
export { BubbleMarkerManager };
//# sourceMappingURL=BubbleMarkerManager.js.map
