function processIconMoneyGroup(root) {
if (!root || root.nodeType !== 1) return;
if (root.closest('.player-money__list')) return;
if (root.closest('.trade__give-money-field-wrapper')) return;
if (root.closest('.trade__receive-money-field-wrapper')) return;
if (root.closest('.dialog-money__form')) return;
if (root.closest('.money-input')) return;
let guard = 0;
let changed = true;
while (changed && guard < 30) {
guard++;
changed = false;
const nodes = Array.from(root.childNodes);
for (let i = 0; i < nodes.length; i++) {
const iconNode = nodes[i];
if (!isClientIconSpan(iconNode)) {
continue;
}
let j = i;
let total = 0;
let found = 0;
let parts = [];
while (j < nodes.length) {
const maybeIcon = nodes[j];
const maybeText = nodes[j + 1];
if (!isClientIconSpan(maybeIcon)) break;
if (!maybeText || maybeText.nodeType !== 3) break;
const mult = getIconMultiplier(maybeIcon.textContent);
if (!mult) break;
const raw = getTextNumberPrefix(maybeText.nodeValue);
if (!raw) break;
total += parseNumber(raw) * mult;
found++;
parts.push({
icon: maybeIcon,
text: maybeText,
raw: raw
});
const tail = String(maybeText.nodeValue || '').slice(raw.length);
if (/[^\s\u00A0]/.test(tail)) {
break;
}
j += 2;
}
if (found > 0) {
const result = document.createTextNode(PREFIX_SYMBOL + formatCustom(total));
root.insertBefore(result, parts[0].icon);
for (let k = 0; k < parts.length; k++) {
const p = parts[k];
p.icon.remove();
p.text.nodeValue = p.text.nodeValue.replace(p.raw, '');
if (!p.text.nodeValue.trim()) {
p.text.remove();
}
}
changed = true;
break;
}
}
}
}