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

196 lines
4.6 KiB
JavaScript

// Metro module 10 (f11).
let __getTotalRequireTime, c30_2;
let __getTotalRequireTime2 = globalThis.globalThis.__getTotalRequireTime;
if (__getTotalRequireTime2 == null) {
__getTotalRequireTime2 = () => 0;
}
__getTotalRequireTime = __getTotalRequireTime2;
c30_2 = typeof globalThis.performance !== "undefined";
class AppStartPerformance {
constructor() {
const r8 = {
__proto__: new.target.prototype,
isTracing_: true,
endTime_: Date.now() + 15000,
lastImportDuration: 0,
logGroups: null
};
r8.logGroups = [{
index: 0,
timestamp: Date.now(),
logs: [],
nativeLogs: []
}];
r8.logs = r8.logGroups[0].logs;
r8.prefix = "";
return r8;
}
get isTracing() {
const r0 = c30_2 ? !this.isTracing_ : !c30_2;
let r7 = !r0;
if (!r0) {
let r13 = !(Date.now() > this.endTime_);
if (!r13) {
this.isTracing_ = false;
r13 = false;
}
r7 = r13;
}
return r7;
}
get endTime() {
return this.endTime_;
}
set endTime(a0) {
this.endTime_ = a0;
this.isTracing_ = true;
}
resumeTracing() {
if (!this.isTracing) {
this.logGroups.unshift({
index: this.logGroups.length,
timestamp: Date.now(),
logs: [],
nativeLogs: []
});
this.logs = this.logGroups[0].logs;
}
this.endTime = Date.now() + 10000;
}
mark(a0, a1, a2) {
if (this.isTracing) {
this.logs.push({
emoji: a0,
prefix: `${this.prefix}`,
log: a1,
delta: a2,
timestamp: Date.now()
});
this.addImportLogDetail();
}
}
markAndLog(a0, a1, a2, a3) {
a0.log(a2);
if (this.isTracing) {
this.logs.push({
emoji: a1,
prefix: this.prefix,
log: a2,
delta: a3,
timestamp: Date.now()
});
this.addImportLogDetail();
}
}
addImportLogDetail() {
const lastImportDuration = __getTotalRequireTime();
if (lastImportDuration - this.lastImportDuration > 25) {
this.addDetail("JS Imports", Math.ceil(lastImportDuration) + "ms");
this.lastImportDuration = lastImportDuration;
}
}
markWithDelta(a0, a1) {
const r12 = this.logs[this.logs.length - 1];
this.mark(a0, a1, r12 != null ? r12.timestamp != null ? Date.now() - r12.timestamp : void 0 : void 0);
}
markAt(a0, a1, a2) {
let length;
if (this.isTracing) {
const r6 = 0 < this.logs.length;
let r0 = 0;
let r2 = 0;
if (r6) {
do {
const timestamp = this.logs[r0].timestamp;
const r1 = r0;
if (timestamp != null) {
r2 = r1;
if (timestamp > a2) {
break;
}
}
r0 = r1 + 1;
length = this.logs.length;
r2 = r0;
} while (r2 < length);
}
const logs = this.logs;
let prefix = this.logs[r2]?.prefix;
if (prefix == null) {
prefix = "";
}
logs.splice(r2, 0, {
emoji: a0,
log: a1,
timestamp: a2,
prefix
});
}
}
addDetail(a0, a1) {
if (this.isTracing) {
this.logs.push({
emoji: this.logs[this.logs.length - 1].emoji,
prefix: this.prefix,
log: ` ↪ ${a0} ${a1}`
});
}
}
time(a0, a1, a2) {
if (this.isTracing) {
const prefix = this.prefix;
this.mark(a0, `Start ${a1}`);
this.prefix = this.prefix + "| ";
const r20 = Date.now();
const r22 = a2();
const r26 = Date.now() - r20;
this.prefix = prefix;
this.mark(a0, `Finish ${a1}`, r26);
return r22;
}
return a2();
}
async timeAsync(c12101_0, c12101_1, c12101_2) {
let r75;
const _this = this;
let c23429_1;
let c28546_0, c28546_1, c28546_2;
L12: {
c23429_1 = void 0;
c28546_0 = void 0;
c28546_1 = void 0;
c28546_2 = void 0;
if (_this.isTracing) {
_this.mark(c12101_0, `Start ${c12101_1}`);
c28546_0 = Date.now();
c28546_1 = await c12101_2();
c28546_2 = Date.now() - c28546_0;
_this.mark(c12101_0, `Finish ${c12101_1}`, c28546_2);
r75 = c28546_1;
break L12;
}
return c12101_2();
}
return r75;
}
setServerTrace(a0) {
this.logGroups[0].serverTrace = a0;
}
}
const r53 = {
__proto__: AppStartPerformance.prototype,
isTracing_: true,
endTime_: Date.now() + 15000,
lastImportDuration: 0,
logGroups: null
};
r53.logGroups = [{
index: 0,
timestamp: Date.now(),
logs: [],
nativeLogs: []
}];
r53.logs = r53.logGroups[0].logs;
r53.prefix = "";
export default r53;