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

577 lines
17 KiB
JavaScript

// Metro module 1390 (f1391).
import * as _checkBoxedPrimitive from "./checkBoxedPrimitive";
import * as _isBuffer from "./isBuffer";
import * as _Module1409 from "./Module1409";
let getOwnPropertyDescriptors2, c1151_2, c1151_3, c1151_4, stylizeWithColor, stylizeNoColor, formatValue, formatProperty, _excluded, c1151_11, callbackifyOnRejected;
const inspect = function inspect(key, a1) {
const r7 = {
seen: [],
stylize: stylizeNoColor
};
if (arguments.length >= 3) {
r7.depth = arguments[2];
}
if (arguments.length >= 4) {
r7.colors = arguments[3];
}
if (typeof a1 === "boolean") {
r7.showHidden = a1;
} else if (a1) {
exports._extend(r7, a1);
}
if (r7.showHidden === void 0) {
r7.showHidden = false;
}
if (r7.depth === void 0) {
r7.depth = 2;
}
if (r7.colors === void 0) {
r7.colors = false;
}
if (r7.customInspect === void 0) {
r7.customInspect = true;
}
if (r7.colors) {
r7.stylize = stylizeWithColor;
}
return formatValue(r7, key, r7.depth);
};
stylizeWithColor = function stylizeWithColor(a0, a1) {
const r5 = inspect.styles[a1];
return r5 ? "\x1b[" + inspect.colors[r5][0] + "m" + a0 + "\x1b[" + inspect.colors[r5][1] + "m" : a0;
};
stylizeNoColor = function stylizeNoColor(a0, a1) {
return a0;
};
formatValue = function formatValue(a0, value, depth) {
let r190, r196, r232;
let c13018_0, c13018_1, c13018_2, c13018_3, c13018_4;
L6: {
c13018_0 = a0;
c13018_1 = value;
c13018_2 = depth;
if (a0.customInspect && value && typeof value.inspect === "function" && value.inspect !== exports.inspect) {
if (value.constructor && value.constructor.prototype === value) {
break L6;
}
const r308 = value.inspect(depth, a0);
let r309 = r308;
if (typeof r309 !== "string") {
r309 = formatValue(a0, r308, depth);
}
return r309;
}
}
const r42 = value === void 0 ? a0.stylize("undefined", "undefined") : typeof value === "string" ? a0.stylize("'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, "\"") + "'", "string") : typeof value === "number" ? a0.stylize("" + value, "number") : typeof value === "boolean" ? a0.stylize("" + value, "boolean") : value === null ? a0.stylize("null", "null") : void 0;
if (r42) {
return r42;
}
const r74 = Object.keys(value);
const r25 = {};
let c13019_0 = r25;
r74.forEach(function(item, index) {
c13019_0[item] = true;
});
c13018_3 = r25;
const r24 = a0.showHidden ? Object.getOwnPropertyNames(value) : r74;
let r82 = typeof value === "object";
const r4 = (typeof value === "object" ? value !== null : r82) && (Object.prototype.toString.call(value) === "[object Error]" || value instanceof Error);
L31: {
if (r4) {
if (!(r24.indexOf("message") >= 0) && !(r24.indexOf("description") >= 0)) {
break L31;
}
return "[" + Error.prototype.toString.call(value) + "]";
}
}
if (r24.length === 0) {
if (typeof value === "function") {
return a0.stylize(`[Function${value.name ? ": " + value.name : ""}]`, "special");
}
if ((typeof value === "object" ? value !== null : r82) && Object.prototype.toString.call(value) === "[object RegExp]") {
return a0.stylize.call(a0, RegExp.prototype.toString.call(value), "regexp");
}
if ((typeof value === "object" ? value !== null : r82) && Object.prototype.toString.call(value) === "[object Date]") {
return a0.stylize.call(a0, Date.prototype.toString.call(value), "date");
}
if ((typeof value === "object" ? value !== null : r82) && (Object.prototype.toString.call(value) === "[object Error]" || value instanceof Error)) {
return "[" + Error.prototype.toString.call(value) + "]";
}
}
let r125 = false;
c13018_4 = false;
let r126 = ["{", "}"];
if (Array.isArray(value)) {
c13018_4 = true;
r126 = ["[", "]"];
r125 = true;
}
let r131 = "";
let r23 = typeof value === "function" ? ` [Function${value.name ? ": " + value.name : ""}]` : "";
if ((typeof value === "object" ? value !== null : r82) && Object.prototype.toString.call(value) === "[object RegExp]") {
r23 = " " + RegExp.prototype.toString.call(value);
}
if ((typeof value === "object" ? value !== null : r82) && Object.prototype.toString.call(value) === "[object Date]") {
r23 = " " + Date.prototype.toUTCString.call(value);
}
if ((typeof value === "object" ? value !== null : r82) && (Object.prototype.toString.call(value) === "[object Error]" || value instanceof Error)) {
r23 = ` ${"[" + Error.prototype.toString.call(value)}]`;
}
L140: {
L107: {
if (r24.length === 0) {
if (r125 && value.length != 0) {
break L107;
}
r190 = r126[0] + r23 + r126[1];
break L140;
}
}
if (depth < 0) {
if (typeof value === "object") {
r82 = value !== null;
}
if (r82) {
r82 = Object.prototype.toString.call(value) === "[object RegExp]";
}
const stylize = a0.stylize;
r232 = r82 ? stylize.call(a0, RegExp.prototype.toString.call(value), "regexp") : stylize.call(a0, "[Object]", "special");
} else {
a0.seen.push(value);
if (r125) {
let c13020_0 = a0;
let c13020_1 = value;
let c13020_2 = depth;
let c13020_3 = r25;
const r198 = [];
let c13020_4 = r198;
const length = value.length;
const r200 = 0 < length;
let r0 = 0;
if (r200) {
do {
const r28 = String(r0);
const hasOwnProperty = Object.prototype.hasOwnProperty;
const r1 = r0;
if (hasOwnProperty.call(value, r28)) {
r198.push(formatProperty(a0, value, depth, r25, String(r1), true));
} else {
r198.push("");
}
r0 = r1 + 1;
} while (r0 < length);
}
r24.forEach(function(item) {
if (!item.match(/^\d+$/)) {
c13020_4.push(formatProperty(c13020_0, c13020_1, c13020_2, c13020_3, item, true));
}
});
r196 = r198;
} else {
r196 = r24.map(function(item) {
return formatProperty(c13018_0, c13018_1, c13018_2, c13018_3, item, c13018_4);
});
}
a0.seen.pop();
const r219 = r196.reduce(function(acc, item) {
item.indexOf("\n") >= 0;
return acc + item.replace(/\u001b\[\d\d?m/g, "").length + 1;
}, 0);
const r221 = r196;
if (r219 > 60) {
const r233 = r126[0];
if (r23 !== "") {
r131 = r23 + "\n ";
}
r232 = r233 + r131 + " " + r221.join(",\n ") + " " + r126[1];
} else {
r232 = r126[0] + r23 + " " + r221.join(", ") + " " + r126[1];
}
}
r190 = r232;
}
return r190;
};
formatProperty = function formatProperty(a0, a1, a2, a3, a4, a5) {
let r21, r46;
const r12 = Object.getOwnPropertyDescriptor(a1, a4) || {
value: a1[a4]
};
const { get, set } = r12;
if (get) {
const stylize = a0.stylize;
r21 = set ? stylize.call(a0, "[Getter/Setter]", "special") : stylize.call(a0, "[Getter]", "special");
} else {
r21 = set ? a0.stylize("[Setter]", "special") : void 0;
}
let r35 = Object.prototype.hasOwnProperty.call(a3, a4) ? void 0 : "[" + a4 + "]";
if (!r21) {
if (a0.seen.indexOf(r12.value) < 0) {
const r51 = a2 === null ? formatValue(a0, r12.value, null) : formatValue(a0, r12.value, a2 - 1);
const r56 = r51.indexOf("\n");
let r59 = r51;
if (r56 > -1) {
const r16 = r51.split("\n");
r59 = a5 ? r16.map(function(item) {
return " " + item;
}).join("\n").slice(2) : "\n" + r16.map(function(item) {
return " " + item;
}).join("\n");
}
r46 = r59;
} else {
r46 = a0.stylize("[Circular]", "special");
}
r21 = r46;
}
if (r35 === void 0) {
if (a5 && a4.match(/^\d+$/)) {
return r21;
}
const r79 = JSON.stringify("" + a4);
r35 = r79.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/) ? a0.stylize(r79.slice(1, -1), "name") : a0.stylize(r79.replace(/'/g, "\\'").replace(/\\"/g, "\"").replace(/(^"|"$)/g, "'"), "string");
}
return r35 + ": " + r21;
};
callbackifyOnRejected = function callbackifyOnRejected(a0, a1) {
let r2 = a0;
if (!a0) {
const error = new Error("Promise was rejected with a falsy value");
error.reason = a0;
r2 = error;
}
return a1(r2);
};
getOwnPropertyDescriptors2 = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(a0) {
const r6 = Object.keys(a0);
const r12 = {};
const length = r6.length;
let r0 = 0;
if (0 < length) {
do {
r12[r6[r0]] = Object.getOwnPropertyDescriptor(a0, r6[r0]);
r0 = r0 + 1;
} while (r0 < r6.length);
}
return r12;
};
c1151_2 = /%[sdj%]/g;
export const format = function(a0) {
let r22, r51;
let c13021_0, c13021_1, c13021_2;
if (typeof a0 === "string") {
c13021_0 = 1;
c13021_1 = arguments;
const length = arguments.length;
c13021_2 = length;
let r38 = String(a0).replace(c1151_2, function(a0) {
let r16;
if (a0 === "%%") {
return "%";
}
if (c13021_0 >= c13021_2) {
return a0;
}
if (a0 === "%s") {
const r29 = String;
const r32 = +c13021_0;
c13021_0 = r32 + 1;
return r29(c13021_1[r32]);
}
if (a0 === "%d") {
const r20 = Number;
const r23 = +c13021_0;
c13021_0 = r23 + 1;
return r20(c13021_1[r23]);
}
if (a0 === "%j") {
try {
const r3 = JSON;
const r14 = +c13021_0;
c13021_0 = r14 + 1;
r16 = r3.stringify(c13021_1[r14]);
} catch ($e) {
return "[Circular]";
}
return r16;
}
return a0;
});
let r40 = arguments[c13021_0];
const r41 = c13021_0;
let r43 = r38;
if (r41 < length) {
do {
const r44 = r40;
const r15 = r38;
const r47 = r44 !== null ? (typeof r44 === "object" ? r44 !== null : typeof r44 === "object") ? r15 + (" " + inspect(r44)) : r15 + (" " + r44) : r15 + (" " + r44);
const r50 = c13021_0 + 1;
c13021_0 = r50;
r40 = arguments[r50];
r51 = c13021_0;
r38 = r47;
r43 = r38;
} while (r51 < length);
}
return r43;
}
const r8 = [];
c13021_0 = 0;
if (0 < arguments.length) {
do {
r8.push(inspect(arguments[c13021_0]));
r22 = c13021_0 + 1;
c13021_0 = r22;
} while (r22 < arguments.length);
}
return r8.join(" ");
};
export const deprecate = function(a0, c13022_1) {
let c13022_2;
if (typeof globalThis.process !== "undefined" && globalThis.process.noDeprecation === true) {
return a0;
}
if (typeof globalThis.process === "undefined") {
return function() {
return exports.deprecate(a0, c13022_1).apply(this, arguments);
};
}
c13022_2 = false;
return function deprecated() {
if (!c13022_2) {
if (globalThis.process.throwDeprecation) {
throw new Error(c13022_1);
}
const traceDeprecation = globalThis.process.traceDeprecation;
const r6 = console;
if (traceDeprecation) {
r6.trace(c13022_1);
} else {
r6.error(c13022_1);
}
c13022_2 = true;
}
return a0.apply(this, arguments);
};
};
c1151_3 = {};
c1151_4 = /^$/;
if (globalThis.process.env.NODE_DEBUG) {
c1151_4 = new RegExp("^" + globalThis.process.env.NODE_DEBUG.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase() + "$", "i");
}
export function isArray(a0) {
return Array.isArray(a0);
}
export function isBoolean(a0) {
return typeof a0 === "boolean";
}
export function isNull(a0) {
return a0 === null;
}
export function isNumber(a0) {
return typeof a0 === "number";
}
export function isString(a0) {
return typeof a0 === "string";
}
export function isUndefined(a0) {
return a0 === void 0;
}
export function isRegExp(a0) {
return (typeof a0 === "object" ? a0 !== null : typeof a0 === "object") && Object.prototype.toString.call(a0) === "[object RegExp]";
}
export function isObject(a0) {
return typeof a0 === "object" ? a0 !== null : typeof a0 === "object";
}
export function isDate(a0) {
return (typeof a0 === "object" ? a0 !== null : typeof a0 === "object") && Object.prototype.toString.call(a0) === "[object Date]";
}
export function isError(a0) {
return (typeof a0 === "object" ? a0 !== null : typeof a0 === "object") && (Object.prototype.toString.call(a0) === "[object Error]" || a0 instanceof Error);
}
export function isFunction(a0) {
return typeof a0 === "function";
}
export const debuglog = function(a0) {
let pid;
let c13023_0 = a0;
const r6 = a0.toUpperCase();
c13023_0 = r6;
if (!c1151_3[r6]) {
if (c1151_4.test(r6)) {
pid = globalThis.process.pid;
c1151_3[r6] = function() {
console.error("%s %d: %s", c13023_0, pid, exports.format.apply(exports, arguments));
};
} else {
c1151_3[r6] = function() {};
}
}
return c1151_3[r6];
};
export { inspect };
inspect.colors = {
bold: [1, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
white: [37, 39],
grey: [90, 39],
black: [30, 39],
blue: [34, 39],
cyan: [36, 39],
green: [32, 39],
magenta: [35, 39],
red: [31, 39],
yellow: [33, 39]
};
inspect.styles = {
special: "cyan",
number: "yellow",
boolean: "yellow",
undefined: "grey",
null: "bold",
string: "green",
date: "magenta",
regexp: "red"
};
exports.types = _checkBoxedPrimitive;
export function isNullOrUndefined(a0) {
return a0 == null;
}
export function isSymbol(a0) {
return typeof a0 === "symbol";
}
exports.types.isRegExp = isRegExp;
exports.types.isDate = isDate;
exports.types.isNativeError = isError;
export function isPrimitive(a0) {
return a0 === null || typeof a0 === "boolean" || typeof a0 === "number" || typeof a0 === "string" || typeof a0 === "symbol" || a0 === void 0;
}
exports.isBuffer = _isBuffer;
_excluded = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
export const log = function() {
const r6 = console;
const date = new Date();
const hours = date.getHours();
const r8 = [hours < 10 ? "0" + hours.toString(10) : hours.toString(10), , ,];
const minutes = date.getMinutes();
r8[1] = minutes < 10 ? "0" + minutes.toString(10) : minutes.toString(10);
const seconds = date.getSeconds();
r8[2] = seconds < 10 ? "0" + seconds.toString(10) : seconds.toString(10);
const r40 = r8.join(":");
r6.log("%s - %s", [date.getDate(), _excluded[date.getMonth()], r40].join(" "), exports.format.apply(exports, arguments));
};
export { _Module1409 as inherits };
export const _extend = function(a0, a1) {
let r14;
if (a1 && (typeof a1 === "object" ? a1 !== null : typeof a1 === "object")) {
const r5 = Object.keys(a1);
const r10 = +r5.length;
let r11 = r10 - 1;
if (r10) {
do {
a0[r5[r11]] = a1[r5[r11]];
r14 = +r11;
r11 = r14 - 1;
} while (r14);
}
return a0;
}
return a0;
};
c1151_11 = typeof globalThis.Symbol !== "undefined" ? Symbol("util.promisify.custom") : void 0;
exports.promisify = function promisify(a0) {
let c13024_0 = a0;
if (typeof a0 !== "function") {
throw new TypeError("The \"original\" argument must be of type Function");
}
if (c1151_11 && a0[c1151_11]) {
const value = a0[c1151_11];
if (typeof value !== "function") {
throw new TypeError("The \"util.promisify.custom\" argument must be of type Function");
}
Object.defineProperty(value, c1151_11, {
value,
enumerable: false,
writable: false,
configurable: true
});
return value;
}
const n = function n() {
let c24403_0, c24403_1;
const promise = new Promise(function(resolve, reject) {
c24403_0 = resolve;
c24403_1 = reject;
});
const r7 = [];
const length = arguments.length;
let r6 = 0;
if (0 < length) {
do {
r7.push(arguments[r6]);
r6 = r6 + 1;
} while (r6 < arguments.length);
}
r7.push(function(a0, a1) {
if (a0) {
c24403_1(a0);
} else {
c24403_0(a1);
}
});
try {
c13024_0.apply(this, r7);
} catch ($e) {
c24403_1($e);
}
return promise;
};
Object.setPrototypeOf(n, Object.getPrototypeOf(a0));
if (c1151_11) {
Object.defineProperty(n, c1151_11, {
value: n,
enumerable: false,
writable: false,
configurable: true
});
}
return Object.defineProperties(n, getOwnPropertyDescriptors2(a0));
};
exports.promisify.custom = c1151_11;
export function callbackify(a0) {
let c13025_0 = a0;
if (typeof a0 !== "function") {
throw new TypeError("The \"original\" argument must be of type Function");
}
const callbackified = function callbackified() {
const r9 = [];
const length = arguments.length;
let r0 = 0;
if (0 < length) {
do {
r9.push(arguments[r0]);
r0 = r0 + 1;
} while (r0 < arguments.length);
}
const r21 = r9.pop();
let c24404_0 = r21;
if (typeof r21 !== "function") {
throw new TypeError("The last argument must be of type Function");
}
const _this = this;
const cb2 = function cb() {
return c24404_0.apply(_this, arguments);
};
c13025_0.apply(this, r9).then(function(result) {
globalThis.process.nextTick(cb2.bind(null, null, result));
}, function(a0) {
globalThis.process.nextTick(callbackifyOnRejected.bind(null, a0, cb2));
});
};
Object.setPrototypeOf(callbackified, Object.getPrototypeOf(a0));
Object.defineProperties(callbackified, getOwnPropertyDescriptors2(a0));
return callbackified;
}