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

60 lines
1.6 KiB
JavaScript

// Metro module 13348 (f13349).
import { createMemoizedNumberFormat } from "./Module13265";
import { currencies } from "./Module13349";
const isSupportedCurrency = function isSupportedCurrency(a0, a1) {
const r5 = a1 === void 0 ? "en" : a1;
L7: {
L5: {
try {
const r14 = (0, createMemoizedNumberFormat)(r5, {
style: "currency",
currencyDisplay: "name",
currency: a0
}).format(123);
if (r14.substring(0, 3) === a0) {
break L7;
}
if (r14.substring(r14.length - 3) !== a0) {
break L5;
}
break L7;
} catch ($e) {
break L7;
}
}
return true;
}
return false;
};
export function getSupportedCurrencies(a0) {
const r8 = [];
const r23 = 0 < currencies.length;
let r2 = 0;
if (r23) {
do {
const r15 = currencies[r2];
const length = r15.length;
const r3 = r2;
if (length === 3) {
if (isSupportedCurrency(r15, a0)) {
r8.push(r15);
}
} else if (r15.length === 5 && r15[3] === "~") {
let r29 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(r15[2]);
const r31 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(r15[4]);
while (r29 <= r31) {
const r19 = r15.substring(0, 2) + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[r29];
const isSupportedCurrency2 = isSupportedCurrency(r19, a0);
const r36 = r29;
if (isSupportedCurrency2) {
r8.push(r19);
}
r29 = r36 + 1;
}
}
r2 = r3 + 1;
} while (r2 < currencies.length);
}
return r8;
}