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

65 lines
2.0 KiB
JavaScript

// Metro module 107 (f108).
import { enableNativeCSSParsing } from "./Module27";
const accumulateDifferences = function accumulateDifferences(differences, a1, a2, a3) {
for (const key in a2) {
const nativeValue = a2[key];
if (a3.hasOwnProperty(key)) {
const staticValue = a3[key];
const r32 = typeof nativeValue === "object" ? Array.isArray(nativeValue) ? null : nativeValue : null;
if (r32 != null) {
const r36 = typeof staticValue === "object" ? Array.isArray(staticValue) ? null : staticValue : null;
if (r36 != null) {
a1.push(key);
accumulateDifferences(differences, a1, r32, r36);
a1.pop();
continue;
}
}
if (!(nativeValue === staticValue || enableNativeCSSParsing())) {
differences.push.call(differences, {
path: [...a1, key],
type: "unequal",
nativeValue,
staticValue
});
}
} else {
differences.push.call(differences, {
path: [...a1, key],
type: "missing",
nativeValue
});
}
}
};
export function validate(a0, a1, a2) {
const differences = [];
accumulateDifferences(differences, [], {
bubblingEventTypes: a1.bubblingEventTypes,
directEventTypes: a1.directEventTypes,
uiViewClassName: a1.uiViewClassName,
validAttributes: a1.validAttributes
}, {
bubblingEventTypes: a2.bubblingEventTypes,
directEventTypes: a2.directEventTypes,
uiViewClassName: a2.uiViewClassName,
validAttributes: a2.validAttributes
});
return differences.length === 0 ? {
type: "valid"
} : {
type: "invalid",
differences
};
}
export function stringifyValidationResult(a0, a1) {
return [`StaticViewConfigValidator: Invalid static view config for '${a0}'.`, "", ...a1.differences.map(({ type, path }) => {
if (type === "missing") {
return `- '${path.join(".")}' is missing.`;
}
if (type === "unequal") {
return `- '${path.join(".")}' is the wrong value.`;
}
}), ""].join("\n");
}