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

167 lines
4.3 KiB
JavaScript

// Metro module 170 (f171).
import { PerformanceEventTiming } from "./PerformanceEventTiming";
import { PerformanceLongTaskTiming } from "./TaskAttributionTiming";
import { PerformanceMark, PerformanceMeasure } from "./PerformanceMarkTemplate";
import { PerformanceResourceTiming } from "./PerformanceResourceTiming";
import { PerformanceEntry } from "./PerformanceEntry";
let c180_2 = {
MARK: 1,
MEASURE: 2,
EVENT: 3,
LONGTASK: 4,
RESOURCE: 5
};
export { c180_2 as RawPerformanceEntryTypeValues };
export function rawToPerformanceEntry(a0) {
const entryType = a0.entryType;
if (c180_2.EVENT === entryType) {
return new PerformanceEventTiming({
name: a0.name,
startTime: a0.startTime,
duration: a0.duration,
processingStart: a0.processingStart,
processingEnd: a0.processingEnd,
interactionId: a0.interactionId
});
}
if (c180_2.LONGTASK === entryType) {
return new PerformanceLongTaskTiming({
name: a0.name,
startTime: a0.startTime,
duration: a0.duration
});
}
if (c180_2.MARK === entryType) {
return new PerformanceMark(a0.name, {
startTime: a0.startTime
});
}
if (c180_2.MEASURE === entryType) {
return new PerformanceMeasure({
name: a0.name,
startTime: a0.startTime,
duration: a0.duration
});
}
if (c180_2.RESOURCE === entryType) {
let fetchStart = a0.fetchStart;
if (fetchStart == null) {
fetchStart = 0;
}
let requestStart = a0.requestStart;
if (requestStart == null) {
requestStart = 0;
}
let connectStart = a0.connectStart;
if (connectStart == null) {
connectStart = 0;
}
let connectEnd = a0.connectEnd;
if (connectEnd == null) {
connectEnd = 0;
}
let responseStart = a0.responseStart;
if (responseStart == null) {
responseStart = 0;
}
let responseEnd = a0.responseEnd;
if (responseEnd == null) {
responseEnd = 0;
}
let responseStatus = a0.responseStatus;
if (responseStatus == null) {
responseStatus = 0;
}
let contentType = a0.contentType;
if (contentType == null) {
contentType = "";
}
let encodedBodySize = a0.encodedBodySize;
if (encodedBodySize == null) {
encodedBodySize = 0;
}
let decodedBodySize = a0.decodedBodySize;
if (decodedBodySize == null) {
decodedBodySize = 0;
}
return new PerformanceResourceTiming({
name: a0.name,
startTime: a0.startTime,
duration: a0.duration,
fetchStart,
requestStart,
connectStart,
connectEnd,
responseStart,
responseEnd,
responseStatus,
contentType,
encodedBodySize,
decodedBodySize
});
}
const entryType2 = a0.entryType;
const MARK = c180_2.MARK;
let r22 = "mark";
if (MARK !== entryType2) {
const MEASURE = c180_2.MEASURE;
r22 = "measure";
if (MEASURE !== entryType2) {
const EVENT = c180_2.EVENT;
r22 = "event";
if (EVENT !== entryType2) {
const LONGTASK = c180_2.LONGTASK;
r22 = "longtask";
if (LONGTASK !== entryType2) {
const RESOURCE = c180_2.RESOURCE;
r22 = "resource";
if (RESOURCE !== entryType2) {
throw new TypeError(`rawToPerformanceEntryType: unexpected performance entry type received: ${entryType2}`);
}
}
}
}
}
return new PerformanceEntry(r22, {
name: a0.name,
startTime: a0.startTime,
duration: a0.duration
});
}
export function rawToPerformanceEntryType(a0) {
if (c180_2.MARK === a0) {
return "mark";
}
if (c180_2.MEASURE === a0) {
return "measure";
}
if (c180_2.EVENT === a0) {
return "event";
}
if (c180_2.LONGTASK === a0) {
return "longtask";
}
if (c180_2.RESOURCE === a0) {
return "resource";
}
throw new TypeError(`rawToPerformanceEntryType: unexpected performance entry type received: ${a0}`);
}
export function performanceEntryTypeToRaw(a0) {
if (a0 === "mark") {
return c180_2.MARK;
}
if (a0 === "measure") {
return c180_2.MEASURE;
}
if (a0 === "event") {
return c180_2.EVENT;
}
if (a0 === "longtask") {
return c180_2.LONGTASK;
}
if (a0 === "resource") {
return c180_2.RESOURCE;
}
throw new TypeError(`performanceEntryTypeToRaw: unexpected performance entry type received: ${a0}`);
}