decord/source/modules/debug/serializeAppStartLogs.tsx
github-actions da5b5e5efe chore: update source for alpha 346.6
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
2026-09-12 13:45:10 +00:00

249 lines
7.1 KiB
TypeScript

// Module ID: 10321
// Function ID: 10322
// Name: serializeAppStartLogs
// Dependencies: [10, 12, 7883, 2]
// Exports: default
// Module 10321 (serializeAppStartLogs)
import _modDef12 from "module_12" /* 12 */;
import ThreadUtils from "ThreadUtils" /* 7883 */;
import size from "module_2" /* 2 */;
function getDisplayName(tag) {
if (null == tag.tag) {
let str3 = tag.label;
} else {
const _HermesInternal = HermesInternal;
str3 = "" + tag.label + " " + tag.tag;
}
let str4 = str3;
if (str3.includes("_START")) {
str4 = `Start ${str3.replace("_START", "")}`;
}
let text = str4;
if (str4.includes("_END")) {
text = `Finish ${str4.replace("_END", "")}`;
}
return text;
}
let result = size.fileFinishedImporting("modules/debug/serializeAppStartLogs.tsx");
export default function serializeAppStartLogs(arg0) {
closure_0 = arg0;
let flag = arg1;
if (arg1 === undefined) {
flag = true;
}
let flag2 = arg2;
if (arg2 === undefined) {
flag2 = true;
}
const logGroups = flag(flag2[0]).logGroups;
let mapped = logGroups.map((item) => {
({ index, timestamp, logs, nativeLogs, serverTrace } = item);
let tmp = timestamp;
if (0 === index) {
const found = _modDef12.find(logs, (log) => {
log = log.log;
return log.indexOf("Logger loaded") >= 0;
});
let timestamp1;
if (found != null) {
timestamp1 = found.timestamp;
}
if (timestamp1 == null) {
timestamp1 = closure_0;
}
tmp = timestamp1;
}
const substr = logs.slice();
const set = new Set(nativeLogs.map(getDisplayName));
let prefix = "";
closure_5 = [];
item = nativeLogs.forEach((tag) => {
if (null == tag.tag) {
let str3 = tag.label;
} else {
const _HermesInternal = HermesInternal;
str3 = "" + tag.label + " " + tag.tag;
}
let str4 = str3;
if (str3.includes("_START")) {
str4 = `Start ${str3.replace("_START", "")}`;
}
let str7 = str4;
if (str4.includes("_END")) {
str7 = `Finish ${str4.replace("_END", "")}`;
}
let tmp2 = num2;
if (!num2) {
tmp2 = !tag.autoGenerated;
}
let startsWithResult = str7.startsWith("Start ");
if (startsWithResult) {
startsWithResult = !str7.includes("RUN_JS_BUNDLE");
}
if (startsWithResult) {
startsWithResult = set.has(str7.replace("Start ", "Finish "));
}
let tmp5 = tmp2;
let num = 0;
if (str7.startsWith("Finish ")) {
tmp5 = tmp2;
num = 0;
if (!str7.includes("RUN_JS_BUNDLE")) {
tmp5 = tmp2;
num = 0;
if (set.has(str7.replace("Finish ", "Start "))) {
prefix = prefix.substring(2);
const arr = closure_5.pop();
tmp5 = tmp2;
num = 0;
if (null != arr) {
const diff = tag.timestamp - arr.timestamp;
let tmp11 = tmp2;
if (!tmp2) {
let tmp12 = diff > 5;
if (tmp12) {
const items = ["GET_CONSTANTS", "CONVERT_CONSTANTS"];
tmp12 = !items.some((item) => str7.includes(item));
}
tmp11 = tmp12;
}
arr.shouldKeep = arr.shouldKeep || tmp11;
tmp5 = tmp11;
num = diff;
}
}
}
}
const obj = { emoji: "\u2615", timestamp: tag.timestamp, delta: null, prefix: null, log: null, shouldKeep: null };
let tmp13;
if (num > 0) {
tmp13 = num;
}
obj.delta = tmp13;
obj.prefix = prefix;
obj.log = str7;
obj.shouldKeep = tmp5;
let num4 = 0;
let num5 = 0;
if (0 < timestamp1.length) {
while (true) {
let timestamp = arr2[num4].timestamp;
if (null == timestamp) {
num4 = num4 + 1;
num5 = num4;
if (num4 >= arr2.length) {
break;
}
} else {
num5 = num4;
if (timestamp > obj.timestamp) {
break;
}
}
break;
}
}
timestamp1.splice(num5, 0, obj);
if (startsWithResult) {
prefix = `${closure_4}| `;
closure_5.push(obj);
}
});
closure_6 = false;
const found1 = substr.filter((log) => {
let tmp = !closure_6;
if (closure_6) {
log = log.log;
tmp = !log.includes("\u21AA");
}
if (tmp) {
let tmp3 = !num3;
if (!num3) {
tmp3 = "\u{1F3A8}" === log.emoji;
}
if (!tmp3) {
tmp3 = false === log.shouldKeep;
}
closure_6 = tmp3;
tmp = !tmp3;
}
return tmp;
});
timestamp1 = tmp;
let num2;
let num3;
let items = [];
let num = 0;
if (0 < found1.length) {
while (true) {
let tmp9 = found1[num];
let sum = num + 1;
let tmp11 = found1[sum];
let tmp12 = num;
if (null != tmp11) {
let str = tmp9.log;
if (tmp11.log === str.replace("Start ", "Finish ")) {
let str2 = tmp11.log;
tmp11.log = str2.replace("Finish ", "");
let arr2 = items.push(tmp11);
tmp12 = sum;
num = tmp12 + 1;
if (num >= found1.length) {
break;
}
}
}
let arr3 = items.push(tmp9);
}
}
const mapped = items.map((timestamp) => {
let str = "";
if (null != timestamp.timestamp) {
const result = (timestamp.timestamp - timestamp1) / 1000;
str = result.toFixed(3);
}
const obj = { totalTime: str, deltaTime: null, log: null };
let str2 = "";
if (null != timestamp.delta) {
const _String = String;
const _Math = Math;
str2 = String(Math.round(timestamp.delta));
}
obj.deltaTime = str2;
let str3 = "";
if (timestamp.emoji.length > 0) {
const _HermesInternal = HermesInternal;
str3 = "" + timestamp.emoji + " ";
}
obj.log = "" + str3 + timestamp.prefix + timestamp.log + "\n";
return obj;
});
num2 = _modDef12.max(mapped.map((totalTime) => totalTime.totalTime.length));
if (num2 == null) {
num2 = 0;
}
num3 = _modDef12.max(mapped.map((deltaTime) => deltaTime.deltaTime.length));
if (num3 == null) {
num3 = 0;
}
const mapped1 = mapped.map((item) => {
({ totalTime, deltaTime, log } = item);
const obj = flag(flag2[1]);
const padStartResult = flag(flag2[1]).padStart(totalTime, num2);
return "" + padStartResult + " " + flag(flag2[1]).padStart(deltaTime, num3) + " " + log;
});
const sum1 = index + 1;
const joined = mapped1.join("");
const combined = "Trace #" + sum1 + " started " + ThreadUtils.getTimestampString(timestamp) + "\n" + joined;
let sum2 = combined;
if (null != serverTrace) {
let _HermesInternal = HermesInternal;
sum2 = combined + "\n Server trace for trace #" + index + 1 + serverTrace;
}
return sum2;
});
return mapped.join("\n\n");
};