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

131 lines
3.7 KiB
JavaScript

// Metro module 6379 (f6380).
import { GLOBAL_OBJ } from "./Module6369";
import { snipLine } from "./Module6377";
import { addNonEnumerableProperty } from "./addNonEnumerableProperty_6374";
let c4076_2 = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
export function addContextToFrame(a0, a1, r10 = 5) {
if (a1.lineno !== void 0) {
const length = a0.length;
const r18 = Math.max(Math.min(length - 1, a1.lineno - 1), 0);
a1.pre_context = a0.slice(Math.max(0, r18 - r10), r18).map((item) => snipLine(item, 0));
a1.context_line = snipLine(a0[Math.min(length - 1, r18)], a1.colno || 0);
a1.post_context = a0.slice(Math.min(r18 + 1, length), r18 + 1 + r10).map((item) => snipLine(item, 0));
}
}
export function addExceptionMechanism(a0, a1) {
const r2 = a0.exception ? a0.exception.values ? a0.exception.values[0] : void 0 : void 0;
if (r2) {
const mechanism = r2.mechanism;
r2.mechanism = {
type: "generic",
handled: true,
...mechanism,
...a1
};
if (a1 && "data" in a1) {
r2.mechanism.data = {
...mechanism && mechanism.data,
...a1.data
};
}
}
}
export function addExceptionTypeValue(a0, a1, a2) {
const exception = a0.exception || {};
a0.exception = exception;
const values = exception.values || [];
exception.values = values;
const r5 = values[0] || {};
values[0] = r5;
if (!r5.value) {
r5.value = a1 ? a1 : "";
}
if (!r5.type) {
r5.type = a2 ? a2 : "Error";
}
}
export function arrayify(a0) {
return Array.isArray(a0) ? a0 : [a0];
}
export function checkOrSetAlreadyCaught(a0) {
if ((function isAlreadyCaptured(a0) {
let __sentry_captured__;
try {
__sentry_captured__ = a0.__sentry_captured__;
} catch ($e) {
return void 0;
}
return __sentry_captured__;
})(a0)) {
return true;
}
try {
addNonEnumerableProperty(a0, "__sentry_captured__", true);
} catch ($e) {}
return false;
}
export function getEventDescription(a0) {
const { message, event_id } = a0;
if (message) {
return message;
}
const r4 = a0.exception ? a0.exception.values ? a0.exception.values[0] : void 0 : void 0;
return r4 ? r4.type && r4.value ? `${r4.type}: ${r4.value}` : r4.type || r4.value || event_id || "<unknown>" : event_id ? event_id : "<unknown>";
}
export function parseSemver(a0) {
const r11 = a0.match(c4076_2) || [];
let r5 = r11[1];
const r13 = parseInt;
if (!r5) {
r5 = "";
}
const r8 = r13(r5, 10);
let r14 = r11[2];
const r15 = parseInt;
if (!r14) {
r14 = "";
}
const r7 = r15(r14, 10);
let r16 = r11[3];
const r17 = parseInt;
if (!r16) {
r16 = "";
}
const r18 = r17(r16, 10);
return {
buildmetadata: r11[5],
major: isNaN(r8) ? void 0 : r8,
minor: isNaN(r7) ? void 0 : r7,
patch: isNaN(r18) ? void 0 : r18,
prerelease: r11[4]
};
}
export function uuid4() {
let r18;
const msCrypto = GLOBAL_OBJ.crypto || GLOBAL_OBJ.msCrypto;
let getRandomByte2 = () => 16 * Math.random();
L13: {
L11: {
try {
if (msCrypto && msCrypto.randomUUID) {
r18 = msCrypto.randomUUID().replace(/-/g, "");
break L11;
}
if (!(msCrypto ? msCrypto.getRandomValues : msCrypto)) {
break L13;
}
getRandomByte2 = () => {
const uint8Array = new Uint8Array(1);
msCrypto.getRandomValues(uint8Array);
return uint8Array[0];
};
break L13;
} catch ($e) {
break L13;
}
}
return r18;
}
return "10000000100040008000100000000000".replace(/[018]/g, (a0) => (a0 ^ (15 & getRandomByte2()) >> a0 / 4).toString(16));
}