Files
discord-decomp/_bundle/ChildListCollection.js
T
2026-11-01 12:12:55 +02:00

77 lines
1.9 KiB
JavaScript

// Metro module 316 (f317).
import _classCallCheck from "./_classCallCheck";
import _createClass from "./_createClass";
import Module38 from "./Module38";
let env328 = {};
const ChildListCollection = function ChildListCollection() {
_classCallCheck(this, ChildListCollection);
this._cellKeyToChildren = new Map();
this._childrenToCellKey = new Map();
};
export default _createClass(ChildListCollection, [{
key: "add",
value: function add(a0, a1) {
Module38(!this._childrenToCellKey.has(a0), "Trying to add already present child list");
let r20 = this._cellKeyToChildren.get(a1);
if (r20 == null) {
r20 = new Set();
}
r20.add(a0);
this._cellKeyToChildren.set(a1, r20);
this._childrenToCellKey.set(a0, a1);
}
}, {
key: "remove",
value: function remove(a0) {
const r10 = this._childrenToCellKey.get(a0);
Module38(r10 != null, "Trying to remove non-present child list");
this._childrenToCellKey.delete(a0);
const r21 = this._cellKeyToChildren.get(r10);
Module38(r21, "_cellKeyToChildren should contain cellKey");
r21.delete(a0);
if (r21.size === 0) {
this._cellKeyToChildren.delete(r10);
}
}
}, {
key: "forEach",
value: function forEach(a0) {
for (const item of this._cellKeyToChildren.values()) {
for (const item2 of item) {
a0(item2);
}
}
}
}, {
key: "forEachInCell",
value: function forEachInCell(a0, a1) {
let r18 = this._cellKeyToChildren.get(a0);
if (r18 == null) {
r18 = [];
}
for (const item of r18) {
a1(item);
}
}
}, {
key: "anyInCell",
value: function anyInCell(a0, a1) {
let r18 = this._cellKeyToChildren.get(a0);
if (r18 == null) {
r18 = [];
}
for (const item of r18) {
if (!a1(item)) {
continue;
}
return true;
}
return false;
}
}, {
key: "size",
value: function size() {
return this._childrenToCellKey.size;
}
}]);