decord/alpha/source/utils/web/DesktopNativeUtils.tsx

2707 lines
88 KiB
TypeScript
Raw Normal View History

// Module ID: 5735
// Function ID: 5736
// Name: DesktopNativeUtils
// Dependencies: [32, 5, 1074, 38, 4652, 1364, 510, 5736, 1935, 4, 5737, 5738, 1366, 1271, 4748, 2]
2026-07-20 16:05:17 +00:00
// Module 5735 (DesktopNativeUtils)
import logger_Logger from "logger/Logger" /* 4 */;
import Storage3 from "Storage" /* 510 */;
import GameDetectionTypes from "GameDetectionTypes" /* 1935 */;
import Client from "Client" /* 4652 */;
import discord_common_DiscordNative from "discord_common/DiscordNative" /* 4748 */;
import DomainMigrationUtils from "DomainMigrationUtils" /* 5736 */;
import IPCEvents from "IPCEvents" /* 5737 */;
import _slicedToArray from "module_32" /* 32 */;
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
2026-07-23 10:11:24 +00:00
const FileExtensionUtils = tmp2(5738);
require = fn;
2026-07-29 08:29:29 +00:00
function sanitizeFilename(arg0) {
try {
const _decodeURIComponent = decodeURIComponent;
const str2 = decodeURIComponent(arg0);
const str4 = decodeURIComponent(arg0).replace(re20, "$1");
return decodeURIComponent(arg0).replace(re20, "$1").replace(/(.+)@([a-zA-Z0-9]+)$/, "$1.$2").replace(re19, "_");
2026-07-29 08:29:29 +00:00
} catch (err) {
const str9 = str.replace(re21, "$1");
return str.replace(re21, "$1").replace(/(.+)%40([a-zA-Z0-9]+)$/, "$1.$2").replace(re19, "_");
2026-07-29 08:29:29 +00:00
}
}
function getFileData() {
const self = this;
const apply = closure_27.apply;
2026-07-29 08:29:29 +00:00
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
}
let closure_27 = async function _getFileData() {
const _fetch = fetch;
const _Request = Request;
const request = new Request(closure_0, { method: "GET", mode: "cors" });
closure_129_0 = await fetch(request);
closure_130_1(closure_130_2[3])(200 === closure_129_0.status, "Data fetch unsuccessful");
closure_129_1 = await closure_129_0.arrayBuffer();
closure_130_1(closure_130_2[3])(null != closure_129_1, "Data is null");
return closure_129_1;
};
function getImageData(arg0) {
2026-07-20 16:05:17 +00:00
return getFileData(arg0);
}
let closure_29 = async function _transcodeImageToPng(arg0, type) {
closure_0 = arg0;
c6 = 0;
c7 = 0;
c5 = 0;
return (async (arg0, value) => {
if (c7 === 2) {
c7 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
} else if (tmp7 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
obj2 = { value, done: true };
return obj2;
2026-08-08 06:10:11 +00:00
} else {
return { value: "HermesInternal", done: null };
}
} else {
try {
c7 = 2;
if (0 === c6) {
if (arg0 === 1) {
2026-08-08 06:10:11 +00:00
c7 = 3;
throw value;
2026-08-08 06:10:11 +00:00
} else if (arg0 === 2) {
c7 = 3;
const obj3 = { value, done: true };
return obj3;
2026-08-08 06:10:11 +00:00
} else {
closure_3 = tmp3;
closure_2 = tmp5;
closure_130_0 = undefined;
closure_130_1 = undefined;
let context;
closure_130_3 = undefined;
const _Blob = Blob;
const items = [closure_0];
const obj4 = { type };
const blob = new Blob(items, obj4);
c6 = 1;
c7 = 1;
const obj5 = { value: globalThis.createImageBitmap(blob), done: false };
return obj5;
}
} else if (1 === tmp8) {
if (arg0 === 1) {
2026-08-08 06:10:11 +00:00
c7 = 3;
throw value;
} else if (arg0 === 2) {
c7 = 3;
const obj6 = { value, done: true };
return obj6;
} else {
closure_130_0 = value;
c5 = 1;
const offscreenCanvas = new globalThis.OffscreenCanvas(closure_130_0.width, closure_130_0.height);
closure_130_1 = offscreenCanvas;
context = closure_130_1.getContext("2d");
closure_131_1(closure_131_2[3])(null != context, "Failed to acquire 2d context for image transcode");
context.drawImage(closure_130_0, 0, 0);
c6 = 3;
c7 = 1;
const obj7 = { value: closure_130_1.convertToBlob({ type: "image/png" }), done: false };
return obj7;
2026-08-08 06:10:11 +00:00
}
} else if (2 === tmp8) {
c5 = 0;
closure_130_0.close();
throw closure_4;
} else if (3 === tmp8) {
if (arg0 === 1) {
c7 = 3;
throw value;
} else if (arg0 === 2) {
c5 = 0;
closure_130_0.close();
c7 = 3;
const obj8 = { value, done: true };
return obj8;
2026-08-08 06:10:11 +00:00
} else {
closure_130_3 = value;
c6 = 4;
c7 = 1;
const obj9 = { value: closure_130_3.arrayBuffer(), done: false };
return obj9;
2026-08-08 06:10:11 +00:00
}
} else if (arg0 === 1) {
c7 = 3;
throw value;
} else if (arg0 === 2) {
c5 = 0;
closure_130_0.close();
c7 = 3;
const obj10 = { value, done: true };
return obj10;
} else {
c5 = 0;
closure_130_0.close();
c7 = 3;
const obj = { value, done: true };
return obj;
}
} catch (tmp25) {
closure_4 = tmp25;
if (tmp4 === c5) {
c7 = tmp2;
throw tmp25;
} else {
c6 = tmp;
2026-08-08 06:10:11 +00:00
}
}
}
})();
};
2026-07-20 16:05:17 +00:00
function normalizeRunningGame(id) {
let tmp = arg1;
if (arg1 === undefined) {
2026-08-08 06:10:11 +00:00
tmp = closure_13;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let str = id.id;
if (str == null) {
str = "";
2026-07-20 16:05:17 +00:00
}
const obj = { id: tmp[str], nativeProcessObserverId: null, name: null, origGameName: null, processName: null, hidden: null, elevated: null, sandboxed: null, lastFocused: null, exePath: null, exeName: null, cmdLine: null, distributor: null, sku: null, pid: null, pidPath: null, gameMetadata: null, windowHandle: null, fullscreenType: null, isLauncher: null, executableFingerprint: null };
2026-07-29 08:29:29 +00:00
let str2 = id.id;
if (str2 == null) {
str2 = "";
2026-07-20 16:05:17 +00:00
}
obj.nativeProcessObserverId = parseInt(str2, 10);
2026-07-20 16:05:17 +00:00
let name = id.gameName;
2026-07-29 08:29:29 +00:00
if (name == null) {
2026-07-20 16:05:17 +00:00
name = id.name;
}
obj.name = name;
({ origGameName: obj.origGameName, name: name2 } = id);
2026-07-29 08:29:29 +00:00
if (name2 == null) {
name2 = "";
}
obj.processName = name2;
({ hidden: obj.hidden, elevated: obj.elevated, sandboxed } = id);
2026-07-29 08:29:29 +00:00
if (sandboxed == null) {
sandboxed = false;
2026-07-20 16:05:17 +00:00
}
obj.sandboxed = sandboxed;
({ lastFocused: obj.lastFocused, exePath: obj.exePath, exeName: obj.exeName, cmdLine: obj.cmdLine, distributor: obj.distributor, sku: obj.sku, pid: obj.pid, pidPath } = id);
2026-07-29 08:29:29 +00:00
if (pidPath == null) {
2026-07-20 16:05:17 +00:00
pidPath = [];
}
obj.pidPath = pidPath;
({ gameMetadata: obj.gameMetadata, windowHandle } = id);
2026-07-29 08:29:29 +00:00
if (windowHandle == null) {
windowHandle = null;
2026-07-20 16:05:17 +00:00
}
obj.windowHandle = windowHandle;
2026-07-20 16:05:17 +00:00
let UNKNOWN = id.fullscreenType;
2026-07-29 08:29:29 +00:00
if (UNKNOWN == null) {
UNKNOWN = Client.RunningProcessFullscreenType.UNKNOWN;
2026-07-29 08:29:29 +00:00
}
obj.fullscreenType = UNKNOWN;
2026-07-29 08:29:29 +00:00
let flag = id.isLauncher;
if (flag == null) {
flag = false;
2026-07-20 16:05:17 +00:00
}
obj.isLauncher = flag;
obj.executableFingerprint = id.executableFingerprint;
2026-07-20 16:05:17 +00:00
return obj;
}
function backwardCompatSend(APP_ASYNC_INDEX_TSX_LOADED) {
if (obj.isDesktop()) {
2026-07-29 08:29:29 +00:00
try {
obj2.sendIPC(APP_ASYNC_INDEX_TSX_LOADED);
2026-07-29 08:29:29 +00:00
} catch (err) {
}
2026-07-20 16:05:17 +00:00
}
}
const NativeFeatures = fn(1074).NativeFeatures;
const set = new Set(["jpg", "jpeg", "jfif", "png"]);
2026-08-08 06:10:11 +00:00
const set1 = new Set(["webp", "avif"]);
const set2 = new Set(["jpg", "jpeg", "jfif", "png", "webp", "gif", "tiff", "bmp", "avif"]);
let closure_10 = null;
2026-07-20 16:05:17 +00:00
let buildNumber = null;
let moduleVersions = null;
2026-08-08 06:10:11 +00:00
let closure_13 = {};
let global = false;
2026-08-08 06:10:11 +00:00
let closure_15 = {};
2026-07-20 16:05:17 +00:00
if (null != DiscordNative) {
2026-07-23 10:11:24 +00:00
let app = DiscordNative.app;
let parts = app.getVersion().split(".");
closure_10 = parts.map((item) => parseInt(item));
2026-07-20 16:05:17 +00:00
const app2 = DiscordNative.app;
moduleVersions = app2.getModuleVersions();
const app3 = DiscordNative.app;
buildNumber = app3.getBuildNumber();
2026-07-23 10:11:24 +00:00
let str = app.getVersion();
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
new Set(["discord_erlpack", "discord_game_utils", "discord_rpc", "discord_spellcheck", "discord_utils", "discord_voice"]);
2026-08-08 06:10:11 +00:00
let c16 = false;
let discordIsElevated = null;
2026-07-23 10:11:24 +00:00
const lastImageSaveDirectory = "lastImageSaveDirectory";
2026-08-08 06:10:11 +00:00
const re19 = /[<>:"/\\|?*@]/g;
const re20 = /(\.[a-zA-Z0-9]+):[^.]*$/;
const re21 = /(\.[a-zA-Z0-9]+)%3A.+$/;
const re22 = /[^a-zA-Z0-9]/g;
const re23 = /\.[^.]*$/;
const SaveImageResult = { SAVED: "saved", CANCELED: "canceled", ERRORED: "errored" };
let obj2 = {
2026-08-24 06:08:38 +00:00
requireModule(discord_voice) {
if (global) {
2026-08-24 06:08:38 +00:00
if (closure_15.hasOwnProperty(discord_voice)) {
if (null != tmp[discord_voice]) {
return tmp[discord_voice];
2026-07-20 16:05:17 +00:00
}
}
}
const nativeModules = DiscordNative.nativeModules;
2026-08-24 06:08:38 +00:00
const requireModuleResult = nativeModules.requireModule(discord_voice);
if (global) {
2026-08-24 06:08:38 +00:00
closure_15[discord_voice] = requireModuleResult;
2026-07-20 16:05:17 +00:00
}
return requireModuleResult;
},
ensureModule(discord_voice) {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
const nativeModules = DiscordNative.nativeModules;
let ensureModuleResult = nativeModules.ensureModule(discord_voice);
} else {
const _Error = Error;
const error = new Error("not embedded");
2026-07-20 16:05:17 +00:00
ensureModuleResult = Promise.reject(error);
}
return ensureModuleResult;
}
};
Object.defineProperty(obj2, "canBootstrapNewUpdater", { get: () => DiscordNative.nativeModules.canBootstrapNewUpdater || false, set: undefined });
obj2.getCrashReporterMetadata = function getCrashReporterMetadata() {
2026-07-20 16:05:17 +00:00
const crashReporter = DiscordNative.crashReporter;
return crashReporter.getMetadata();
};
obj2.getSetting = function getSetting(arg0, arg1) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
return (async () => {
settings = settings.settings;
await settings.get(closure_0, closure_1);
2026-08-04 21:03:28 +00:00
return arg1;
2026-07-20 16:05:17 +00:00
})();
};
obj2.beforeUnload = function beforeUnload() {
2026-07-20 16:05:17 +00:00
const self = this;
2026-07-29 08:29:29 +00:00
try {
const requireModuleResult = self.requireModule("discord_overlay2");
2026-07-20 16:05:17 +00:00
let reset = requireModuleResult;
2026-07-29 08:29:29 +00:00
if (requireModuleResult) {
2026-07-20 16:05:17 +00:00
reset = requireModuleResult.reset;
}
if (reset) {
2026-07-29 08:29:29 +00:00
requireModuleResult.reset();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let destroyHostProcess = requireModuleResult;
2026-07-20 16:05:17 +00:00
if (requireModuleResult) {
2026-07-29 08:29:29 +00:00
destroyHostProcess = requireModuleResult.disconnectAllProcesses;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (destroyHostProcess) {
2026-07-20 16:05:17 +00:00
destroyHostProcess = requireModuleResult.destroyHostProcess;
}
if (destroyHostProcess) {
2026-07-29 08:29:29 +00:00
const result = requireModuleResult.disconnectAllProcesses();
requireModuleResult.destroyHostProcess();
}
const powerMonitor = DiscordNative.powerMonitor;
powerMonitor.removeAllListeners();
const _window = window;
const _window2 = window;
let supportsFeatureResult = window.location.origin === window.GLOBAL_ENV.MIGRATION_SOURCE_ORIGIN;
if (supportsFeatureResult) {
2026-08-24 06:08:38 +00:00
const Storage = Storage3.Storage;
supportsFeatureResult = true !== Storage.get(DomainMigrationUtils.DOMAIN_MIGRATION_SUCCESS_KEY);
2026-07-29 08:29:29 +00:00
}
if (supportsFeatureResult) {
2026-07-20 16:05:17 +00:00
supportsFeatureResult = self.supportsFeature(NativeFeatures.USER_DATA_CACHE);
}
if (supportsFeatureResult) {
2026-07-29 08:29:29 +00:00
const userDataCache = DiscordNative.userDataCache;
2026-08-24 06:08:38 +00:00
const Storage2 = Storage3.Storage;
2026-07-29 08:29:29 +00:00
userDataCache.cacheUserData(Storage2.stringify());
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
} catch (err) {
2026-07-20 16:05:17 +00:00
}
};
obj2.inputEventRegister = function inputEventRegister(parsed, arr, arg2, arg3) {
2026-07-20 16:05:17 +00:00
const discordUtils = this.getDiscordUtils();
parsed = parseInt("" + parsed);
discordUtils.inputEventRegister(parsed, arr.map((item) => {
[tmp, tmp2, tmp3] = item;
2026-08-04 21:03:28 +00:00
if (typeof tmp3 === "string") {
2026-07-20 16:05:17 +00:00
const items = [tmp, tmp2, tmp3];
let items1 = items;
} else {
items1 = [tmp, tmp2];
}
return items1;
}), arg2, arg3);
};
obj2.inputEventUnregister = function inputEventUnregister(match) {
2026-07-20 16:05:17 +00:00
const discordUtils = this.getDiscordUtils();
discordUtils.inputEventUnregister(parseInt(match));
2026-07-20 16:05:17 +00:00
};
obj2.setOnInputEventCallback = function setOnInputEventCallback(arg0) {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-29 08:29:29 +00:00
const self = this;
const discordUtils = this.getDiscordUtils();
2026-07-20 16:05:17 +00:00
discordUtils.inputWatchAll(arg0);
}
};
obj2.setFocused = function setFocused(arg0) {
2026-07-20 16:05:17 +00:00
const discordUtils = this.getDiscordUtils();
discordUtils.inputSetFocused(arg0);
};
obj2.setObservedGamesCallback = function setObservedGamesCallback(mapped, normalizeCallback, arg2, arg3) {
2026-08-24 06:08:38 +00:00
closure_0 = arg2;
2026-07-29 08:29:29 +00:00
try {
const self = this;
2026-08-24 06:08:38 +00:00
closure_13 = {};
c1 = 0;
2026-07-29 08:29:29 +00:00
const discordUtils = this.getDiscordUtils();
mapped = mapped.map((id) => {
const sum = c1 + 1;
c1 = sum;
if (null != id.id) {
2026-08-08 06:10:11 +00:00
closure_13[sum] = id.id;
2026-07-29 08:29:29 +00:00
}
const obj = {};
2026-07-29 08:29:29 +00:00
const merged = Object.assign(id);
obj.cmdline = id.cmdLine;
obj.id = sum;
return obj;
});
2026-08-24 06:08:38 +00:00
closure_2 = closure_13;
2026-07-29 08:29:29 +00:00
let tmp6 = null != arg3;
if (tmp6) {
tmp6 = null != discordUtils.setProcessObserverUserId;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp6) {
const result = discordUtils.setProcessObserverUserId(arg3);
}
normalizeCallback = function normalizeCallback(arr) {
return closure_0(arr.map((item) => normalizeRunningGame(item, closure_1_2)));
2026-07-29 08:29:29 +00:00
};
if (normalizeCallback) {
if (null != discordUtils.setObservedGamesCallback2) {
const result1 = discordUtils.setObservedGamesCallback2(mapped, normalizeCallback);
}
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const result2 = discordUtils.setObservedGamesCallback(mapped, normalizeCallback);
} catch (err) {
2026-07-20 16:05:17 +00:00
}
};
obj2.setProcessObserverCollectExecutableFingerprint = function setProcessObserverCollectExecutableFingerprint(arg0) {
2026-07-20 16:05:17 +00:00
const discordUtils = this.getDiscordUtils();
const setProcessObserverCollectExecutableFingerprint = discordUtils.setProcessObserverCollectExecutableFingerprint;
2026-07-29 08:29:29 +00:00
if (setProcessObserverCollectExecutableFingerprint != null) {
const result = setProcessObserverCollectExecutableFingerprint(arg0);
2026-07-20 16:05:17 +00:00
}
};
obj2.getExecutableFingerprintForProcess = function getExecutableFingerprintForProcess(arg0) {
2026-07-23 10:11:24 +00:00
const self = this;
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
return new Promise((fn) => {
closure_0 = fn;
2026-07-29 08:29:29 +00:00
const discordUtils = self.getDiscordUtils();
2026-07-20 16:05:17 +00:00
let prop;
2026-07-29 08:29:29 +00:00
if (discordUtils != null) {
2026-07-20 16:05:17 +00:00
prop = discordUtils.getExecutableFingerprintForProcess;
}
if (null != prop) {
2026-07-29 08:29:29 +00:00
prop(closure_0, (arg0) => {
2026-07-20 16:05:17 +00:00
let tmp2 = null;
if (null != arg0) {
tmp2 = null;
if ("" !== arg0) {
tmp2 = arg0;
}
}
2026-07-23 10:11:24 +00:00
return closure_0(tmp2);
2026-07-20 16:05:17 +00:00
});
} else {
fn(null);
2026-07-20 16:05:17 +00:00
}
});
};
obj2.setGameDetectionCallback = function setGameDetectionCallback(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const discordUtils = this.getDiscordUtils();
2026-07-29 08:29:29 +00:00
if (discordUtils.setGameDetectionCallback != null) {
const result = setGameDetectionCallback((arr, arr2) => {
const mapped = arr.map((item) => closure_1_30(item));
return closure_0(mapped, arr2.map((item) => closure_1_30(item)));
2026-07-20 16:05:17 +00:00
});
}
};
obj2.setGameDetectionErrorCallback = function setGameDetectionErrorCallback(arg0) {
2026-07-20 16:05:17 +00:00
const discordUtils = this.getDiscordUtils();
2026-07-29 08:29:29 +00:00
if (discordUtils.setGameDetectionErrorCallback != null) {
const result = setGameDetectionErrorCallback(arg0);
2026-07-20 16:05:17 +00:00
}
};
obj2.setRobloxSubgameDetectionConfig = function setRobloxSubgameDetectionConfig(arg0, arg1) {
2026-07-20 16:05:17 +00:00
const discordUtils = this.getDiscordUtils();
const setRobloxSubgameDetectionConfig = discordUtils.setRobloxSubgameDetectionConfig;
2026-07-29 08:29:29 +00:00
if (setRobloxSubgameDetectionConfig != null) {
const result = setRobloxSubgameDetectionConfig(arg0, arg1);
2026-07-20 16:05:17 +00:00
}
};
obj2.checkForRobloxSubgameUpdate = function checkForRobloxSubgameUpdate() {
2026-07-20 16:05:17 +00:00
const discordUtils = this.getDiscordUtils();
const checkForRobloxSubgameUpdate = discordUtils.checkForRobloxSubgameUpdate;
2026-07-29 08:29:29 +00:00
if (checkForRobloxSubgameUpdate != null) {
const result = checkForRobloxSubgameUpdate();
2026-07-20 16:05:17 +00:00
}
};
obj2.setCandidateGamesCallback = function setCandidateGamesCallback(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const discordUtils = this.getDiscordUtils();
const result = discordUtils.setCandidateGamesCallback((arr) => {
closure_0(arr.map((item) => closure_1_30(item)));
2026-07-20 16:05:17 +00:00
});
};
obj2.clearCandidateGamesCallback = function clearCandidateGamesCallback() {
2026-07-20 16:05:17 +00:00
const discordUtils = this.getDiscordUtils();
const result = discordUtils.clearCandidateGamesCallback();
};
obj2.setGameCandidateOverrides = function setGameCandidateOverrides(arr) {
2026-07-20 16:05:17 +00:00
const discordUtils = this.getDiscordUtils();
const result = discordUtils.setGameCandidateOverrides(arr.map((item) => {
const obj = {};
const merged = Object.assign(item);
({ id: obj.gameId, name: obj.gameName } = item);
2026-07-20 16:05:17 +00:00
return obj;
}));
};
obj2.setObserverDebugCallback = function setObserverDebugCallback(arg0, NONE, arg2) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const discordUtils = this.getDiscordUtils();
const result = discordUtils.setObserverDebugCallback((arg0) => closure_0(arg0), NONE, arg2);
2026-07-20 16:05:17 +00:00
};
obj2.clearObserverDebugCallback = function clearObserverDebugCallback() {
2026-07-20 16:05:17 +00:00
const discordUtils = this.getDiscordUtils();
const result = discordUtils.setObserverDebugCallback(null, GameDetectionTypes.GameDetectionDebugLevel.NONE, 0);
2026-07-20 16:05:17 +00:00
};
obj2.shouldDisplayNotifications = function shouldDisplayNotifications() {
2026-07-20 16:05:17 +00:00
const discordUtils = this.getDiscordUtils();
return discordUtils.shouldDisplayNotifications();
};
obj2.getVoiceEngine = function getVoiceEngine() {
2026-07-20 16:05:17 +00:00
const requireModuleResult = this.requireModule("discord_voice");
const require = requireModuleResult;
2026-08-08 06:10:11 +00:00
if (!c16) {
logger_Logger.setNativeLogFn((arg0, arg1, arg2) => {
requireModuleResult.consoleLog(arg1, "[" + arg0 + "] " + arg2);
2026-07-20 16:05:17 +00:00
});
}
2026-08-08 06:10:11 +00:00
c16 = true;
2026-07-20 16:05:17 +00:00
return requireModuleResult;
};
obj2.getDiscordUtils = function getDiscordUtils() {
2026-07-20 16:05:17 +00:00
const self = this;
2026-08-08 06:10:11 +00:00
if (!c16) {
2026-07-29 08:29:29 +00:00
try {
const voiceEngine = self.getVoiceEngine();
} catch (err) {
}
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return self.requireModule("discord_utils");
2026-07-20 16:05:17 +00:00
};
obj2.isSystemDarkMode = function isSystemDarkMode() {
let isWindowsResult = require("PlatformUtils").isWindows();
2026-07-29 08:29:29 +00:00
if (isWindowsResult) {
const self = this;
const discordUtils = this.getDiscordUtils();
2026-07-20 16:05:17 +00:00
const isSystemDarkMode = discordUtils.isSystemDarkMode;
2026-07-29 08:29:29 +00:00
let flag;
if (isSystemDarkMode != null) {
flag = isSystemDarkMode();
}
if (flag == null) {
flag = true;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
isWindowsResult = flag;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return isWindowsResult;
2026-07-20 16:05:17 +00:00
};
obj2.getDiscordIsElevated = function getDiscordIsElevated() {
2026-07-20 16:05:17 +00:00
let tmp = null;
if (obj.isWindows()) {
2026-07-29 08:29:29 +00:00
const self = this;
2026-07-20 16:05:17 +00:00
tmp = null;
2026-07-29 08:29:29 +00:00
if (null != this.getDiscordUtils().getDiscordIsElevated) {
let tmp2 = discordIsElevated;
2026-07-20 16:05:17 +00:00
if (null === discordIsElevated) {
const discordUtils = self.getDiscordUtils();
2026-07-23 10:11:24 +00:00
discordIsElevated = discordUtils.getDiscordIsElevated();
2026-07-29 08:29:29 +00:00
tmp2 = discordIsElevated;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp = tmp2;
2026-07-20 16:05:17 +00:00
}
}
return tmp;
};
obj2.getGameUtils = function getGameUtils() {
2026-07-20 16:05:17 +00:00
return this.requireModule("discord_game_utils");
};
obj2.getCloudSync = function getCloudSync() {
2026-07-20 16:05:17 +00:00
return this.requireModule("discord_cloudsync");
};
obj2.getDispatch = function getDispatch() {
2026-07-20 16:05:17 +00:00
return this.requireModule("discord_dispatch");
};
obj2.setBadge = function setBadge(arg0) {
2026-07-20 16:05:17 +00:00
if ("darwin" === obj.getPlatformName()) {
let str2 = "\u2022";
if (-1 !== arg0) {
str2 = "";
if (arg0 > 0) {
const _HermesInternal = HermesInternal;
str2 = "" + arg0;
}
}
const dock = DiscordNative.app.dock;
dock.setBadge(str2);
} else {
2026-07-29 08:29:29 +00:00
if ("win32" === tmpResult.getPlatformName()) {
const self = this;
this.sendIPC(tmp(5737).IPCEvents.APP_BADGE_SET, arg0);
2026-07-20 16:05:17 +00:00
} else {
if ("linux" === tmpResult2.getPlatformName()) {
2026-07-20 16:05:17 +00:00
const app = DiscordNative.app;
let num = 0;
if (arg0 >= 0) {
num = arg0;
}
app.setBadgeCount(num);
}
tmpResult2 = tmp(1364);
2026-07-20 16:05:17 +00:00
}
tmpResult = tmp(1364);
2026-07-20 16:05:17 +00:00
}
};
obj2.setSystemTrayIcon = function setSystemTrayIcon(arg0) {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-29 08:29:29 +00:00
const self = this;
2026-08-24 06:08:38 +00:00
this.sendIPC(IPCEvents.IPCEvents.SYSTEM_TRAY_SET_ICON, arg0);
2026-07-20 16:05:17 +00:00
}
};
obj2.setThumbarButtons = function setThumbarButtons(arg0) {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
const thumbar = DiscordNative.thumbar;
2026-07-29 08:29:29 +00:00
if (thumbar != null) {
const setThumbarButtons = thumbar.setThumbarButtons;
if (setThumbarButtons != null) {
const self = this;
setThumbarButtons(arg0, this.isSystemDarkMode());
}
2026-07-20 16:05:17 +00:00
}
}
};
obj2.bounceDock = function bounceDock(arg0) {
if (require("PlatformUtils").isPlatformEmbedded) {
const app = DiscordNative.app;
2026-07-20 16:05:17 +00:00
if (null != app.dock) {
2026-07-23 10:11:24 +00:00
let dock = app.dock;
2026-08-24 06:08:38 +00:00
closure_1 = dock.bounce(arg0);
return asyncGeneratorStep(async (arg0, value) => {
2026-07-29 08:29:29 +00:00
if (c3 === 2) {
c3 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-07-29 08:29:29 +00:00
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
obj2 = { value, done: true };
return obj2;
2026-07-29 08:29:29 +00:00
} else {
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c3 = 2;
if (0 === c2) {
if (arg0 === 1) {
c3 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c3 = 3;
const obj3 = { value, done: true };
return obj3;
2026-07-29 08:29:29 +00:00
} else {
value = tmp5;
closure_0 = tmp2;
closure_128_0 = undefined;
2026-07-29 08:29:29 +00:00
c2 = 1;
c3 = 1;
const obj4 = { value, done: false };
return obj4;
2026-07-29 08:29:29 +00:00
}
} else if (arg0 === 1) {
c3 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c3 = 3;
const obj = { value, done: true };
2026-07-29 08:29:29 +00:00
return obj;
} else {
closure_128_0 = value;
const dock = closure_129_0.dock;
dock.cancelBounce(closure_128_0);
2026-07-29 08:29:29 +00:00
c3 = 3;
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} catch (tmp11) {
c3 = tmp;
throw tmp11;
}
}
2026-07-20 16:05:17 +00:00
});
}
}
};
obj2.setSystemTrayApplications = function setSystemTrayApplications(arg0) {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-29 08:29:29 +00:00
const self = this;
2026-08-24 06:08:38 +00:00
this.sendIPC(IPCEvents.IPCEvents.SYSTEM_TRAY_SET_APPLICATIONS, arg0);
2026-07-20 16:05:17 +00:00
}
};
Object.defineProperty(obj2, "architecture", {
2026-07-20 16:05:17 +00:00
get: () => {
let str = "";
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
str = DiscordNative.process.arch;
}
return str;
},
set: undefined
});
Object.defineProperty(obj2, "releaseChannel", {
2026-07-20 16:05:17 +00:00
get: () => {
let str = "";
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
const app = DiscordNative.app;
str = app.getReleaseChannel();
}
return str;
},
set: undefined
});
Object.defineProperty(obj2, "version", { get: () => closure_10, set: undefined });
Object.defineProperty(obj2, "buildNumber", { get: () => closure_11, set: undefined });
Object.defineProperty(obj2, "moduleVersions", { get: () => closure_12, set: undefined });
Object.defineProperty(obj2, "parsedOSRelease", {
2026-07-20 16:05:17 +00:00
get: () => {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
const parts = DiscordNative.os.release.split(".");
let mapped = parts.map((item) => parseInt(item, 10));
2026-07-20 16:05:17 +00:00
} else {
mapped = [];
}
return mapped;
},
set: undefined
});
obj2.copy = function copy(arg0) {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
const clipboard = DiscordNative.clipboard;
clipboard.copy(arg0);
}
};
obj2.copyImage = function copyImage(arg0, arg1) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
return (async (arg0, value) => {
2026-08-08 06:10:11 +00:00
if (c4 === 2) {
c4 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-07-29 08:29:29 +00:00
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
obj2 = { value, done: true };
return obj2;
2026-07-29 08:29:29 +00:00
} else {
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
2026-08-08 06:10:11 +00:00
c4 = 2;
if (0 === c3) {
2026-07-29 08:29:29 +00:00
if (arg0 === 1) {
2026-08-08 06:10:11 +00:00
c4 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
2026-08-08 06:10:11 +00:00
c4 = 3;
const obj3 = { value, done: true };
return obj3;
2026-07-29 08:29:29 +00:00
} else {
dependencyMap = tmp5;
closure_129_0 = undefined;
closure_129_1 = undefined;
closure_129_2 = undefined;
tmp2(38)(closure_0(1364).isPlatformEmbedded, "Copy image method called outside native app");
tmp2(38)(typeof DiscordNative.clipboard.copyImage === "function", "Copy image not supported");
2026-07-29 08:29:29 +00:00
c3 = 1;
2026-08-08 06:10:11 +00:00
c4 = 1;
const obj4 = { value: getImageData(closure_0), done: false };
return obj4;
2026-07-29 08:29:29 +00:00
}
2026-08-08 06:10:11 +00:00
} else if (1 === tmp5) {
if (arg0 === 1) {
c4 = 3;
throw value;
2026-08-08 06:10:11 +00:00
} else if (arg0 === 2) {
c4 = 3;
const obj5 = { value, done: true };
return obj5;
2026-08-08 06:10:11 +00:00
} else {
closure_129_0 = value;
closure_129_1 = closure_0(5738).decideFileExtension(closure_130_0, closure_130_1);
if (null != closure_129_1) {
if (set2.has(closure_129_1)) {
closure_0 = closure_130_1;
if (closure_130_1 == null) {
2026-08-08 06:10:11 +00:00
const _HermesInternal2 = HermesInternal;
closure_0 = "image/" + closure_129_1;
2026-08-08 06:10:11 +00:00
}
c3 = 2;
c4 = 1;
const obj6 = {
value: (function transcodeImageToPng() {
const self = this;
const apply = closure_1_29.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
})(closure_129_0, closure_0),
done: false
};
return obj6;
2026-08-08 06:10:11 +00:00
}
}
if (null == closure_129_1) {
let combined = closure_130_0;
closure_129_2 = combined;
const clipboard2 = DiscordNative.clipboard;
2026-08-08 06:10:11 +00:00
const _Buffer2 = Buffer;
clipboard2.copyImage(Buffer.from(closure_129_0), closure_129_2);
2026-08-08 06:10:11 +00:00
c4 = 3;
}
const _HermesInternal = HermesInternal;
combined = "image." + closure_129_1;
const obj8 = closure_0(5738);
2026-08-08 06:10:11 +00:00
}
2026-07-29 08:29:29 +00:00
} else if (arg0 === 1) {
2026-08-08 06:10:11 +00:00
c4 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
2026-08-08 06:10:11 +00:00
c4 = 3;
const obj7 = { value, done: true };
return obj7;
2026-07-29 08:29:29 +00:00
} else {
closure_129_0 = value;
const clipboard = DiscordNative.clipboard;
2026-08-08 06:10:11 +00:00
const _Buffer = Buffer;
clipboard.copyImage(Buffer.from(closure_129_0), "image.png");
2026-08-08 06:10:11 +00:00
c4 = 3;
const obj = { value: undefined, done: true };
2026-08-08 06:10:11 +00:00
return obj;
2026-07-29 08:29:29 +00:00
}
2026-08-08 06:10:11 +00:00
} catch (tmp42) {
c4 = tmp;
throw tmp42;
2026-07-20 16:05:17 +00:00
}
}
})();
};
obj2.copyImageBlob = function copyImageBlob(arg0, arg1) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
return (async (arg0, value) => {
2026-07-29 08:29:29 +00:00
if (c3 === 2) {
c3 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-07-29 08:29:29 +00:00
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
obj2 = { value, done: true };
return obj2;
2026-07-29 08:29:29 +00:00
} else {
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c3 = 2;
if (0 === c2) {
if (arg0 === 1) {
c3 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c3 = 3;
const obj3 = { value, done: true };
return obj3;
2026-07-29 08:29:29 +00:00
} else {
2026-08-24 06:08:38 +00:00
closure_1 = tmp5;
closure_128_0 = undefined;
2026-07-29 08:29:29 +00:00
c2 = 1;
c3 = 1;
const obj4 = { value: tmp2.arrayBuffer(), done: false };
return obj4;
2026-07-29 08:29:29 +00:00
}
} else if (arg0 === 1) {
c3 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c3 = 3;
const obj = { value, done: true };
2026-07-29 08:29:29 +00:00
return obj;
} else {
closure_128_0 = value;
clipboard = clipboard.clipboard;
2026-07-29 08:29:29 +00:00
const _Buffer = Buffer;
clipboard.copyImage(Buffer.from(closure_128_0), closure_129_1);
2026-07-29 08:29:29 +00:00
c3 = 3;
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} catch (tmp14) {
c3 = tmp;
throw tmp14;
}
}
2026-07-20 16:05:17 +00:00
})();
};
obj2.canSaveImage = function canSaveImage(uri, contentType) {
if (null != uri) {
if (require("PlatformUtils").isPlatformEmbedded) {
const decideFileExtensionResult = tmp(5738).decideFileExtension(uri, contentType);
2026-07-21 22:01:30 +00:00
let hasItem = null == decideFileExtensionResult;
2026-07-20 16:05:17 +00:00
if (!hasItem) {
2026-08-08 06:10:11 +00:00
hasItem = set2.has(decideFileExtensionResult);
2026-07-20 16:05:17 +00:00
}
return hasItem;
}
2026-07-29 08:29:29 +00:00
tmp = require;
2026-07-20 16:05:17 +00:00
}
return false;
};
obj2.saveImage = function saveImage(arg0, arg1, arg2) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
closure_2 = arg2;
return (async (arg0, value) => {
2026-07-29 08:29:29 +00:00
if (c10 === 2) {
c10 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-07-29 08:29:29 +00:00
} else if (tmp7 === 3) {
if (arg0 === 1) {
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
obj2 = { value, done: true };
return obj2;
2026-07-29 08:29:29 +00:00
} else {
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
try {
c10 = 2;
if (0 === c9) {
if (arg0 === 1) {
c10 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c10 = 3;
const obj3 = { value, done: true };
return obj3;
2026-07-29 08:29:29 +00:00
} else {
closure_5 = tmp5;
closure_133_0 = undefined;
closure_133_1 = undefined;
2026-07-29 08:29:29 +00:00
let directory;
closure_133_3 = undefined;
closure_133_4 = undefined;
closure_133_5 = undefined;
png(38)(unknown(1364).isPlatformEmbedded, "Save image method called outside native app");
const tmp84 = png(38);
let tmp54 = closure_0;
const toURLSafeResult = png(1366).toURLSafe(closure_0);
2026-07-29 08:29:29 +00:00
if (null == toURLSafeResult) {
c10 = 3;
const obj4 = { value: constants.ERRORED, done: true };
return obj4;
2026-07-29 08:29:29 +00:00
} else {
const parts = toURLSafeResult.pathname.split("/");
const arr = parts.pop();
unknown = arr;
2026-07-29 08:29:29 +00:00
if (arr == null) {
unknown = "unknown";
2026-07-29 08:29:29 +00:00
}
closure_133_0 = unknown;
const str = sanitizeFilename(unknown);
closure_133_0 = str;
2026-07-29 08:29:29 +00:00
const searchParams = toURLSafeResult.searchParams;
let str2 = searchParams.get("format");
if (null != str2) {
2026-08-24 06:08:38 +00:00
str2 = str2.replace(closure_1_22, "").toLowerCase();
2026-07-29 08:29:29 +00:00
if (str2.length > 0) {
const _HermesInternal2 = HermesInternal;
closure_133_0 = "" + str.replace(closure_1_23, "") + "." + str2;
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
const str3 = str2.replace(closure_1_22, "");
2026-07-29 08:29:29 +00:00
} else if (!str.includes(".")) {
const decideFileExtensionResult = unknown(5738).decideFileExtension(tmp54, closure_1);
dependencyMap = decideFileExtensionResult;
png = dependencyMap;
if (dependencyMap == null) {
png = "png";
2026-07-29 08:29:29 +00:00
}
const _HermesInternal = HermesInternal;
closure_133_0 = "" + str + "." + png;
const obj9 = unknown(5738);
2026-07-29 08:29:29 +00:00
}
tmp54 = getImageData(tmp54);
2026-07-29 08:29:29 +00:00
c9 = 1;
c10 = 1;
}
const obj13 = png(1366);
2026-07-29 08:29:29 +00:00
}
} else if (1 === tmp8) {
if (arg0 === 1) {
c10 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c10 = 3;
const obj5 = { value, done: true };
return obj5;
2026-07-29 08:29:29 +00:00
} else {
closure_133_3 = value;
2026-07-29 08:29:29 +00:00
const _Buffer = Buffer;
closure_133_4 = Buffer.from(closure_133_3);
const Storage2 = unknown(510).Storage;
closure_133_5 = Storage2.get(lastImageSaveDirectory);
if (typeof closure_133_5 !== "string") {
closure_133_5 = undefined;
2026-07-29 08:29:29 +00:00
}
if (typeof tmp3.fileManager.saveWithDialog2 === "function") {
const fileManager = tmp3.fileManager;
c3 = closure_133_5;
if (closure_133_5 == null) {
2026-07-29 08:29:29 +00:00
c3 = undefined;
}
c9 = 3;
c10 = 1;
const obj6 = { value: fileManager.saveWithDialog2(closure_133_4, closure_133_0, c3), done: false };
return obj6;
2026-07-29 08:29:29 +00:00
} else {
2026-08-24 06:08:38 +00:00
c8 = 1;
const fileManager2 = tmp3.fileManager;
c4 = closure_133_5;
if (closure_133_5 == null) {
2026-07-29 08:29:29 +00:00
c4 = undefined;
}
c9 = 4;
c10 = 1;
const obj7 = { value: fileManager2.saveWithDialog(closure_133_4, closure_133_0, c4), done: false };
return obj7;
2026-07-29 08:29:29 +00:00
}
}
} else if (2 === tmp8) {
c8 = 0;
c10 = 3;
const obj8 = { value: constants.ERRORED, done: true };
return obj8;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
if (3 === tmp8) {
if (arg0 === 1) {
c10 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c10 = 3;
const obj10 = { value, done: true };
return obj10;
2026-07-29 08:29:29 +00:00
} else {
closure_133_1 = value;
if (null == value) {
2026-07-29 08:29:29 +00:00
c10 = 3;
const obj11 = { value: constants.ERRORED, done: true };
return obj11;
} else if (closure_133_1.canceledByUser) {
2026-07-29 08:29:29 +00:00
c10 = 3;
const obj12 = { value: constants.CANCELED, done: true };
return obj12;
2026-07-29 08:29:29 +00:00
} else {
directory = closure_133_1.directory;
2026-07-29 08:29:29 +00:00
}
}
} else if (arg0 === 1) {
c10 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c8 = 0;
c10 = 3;
const obj = { value, done: true };
2026-07-29 08:29:29 +00:00
return obj;
} else {
directory = value;
2026-07-29 08:29:29 +00:00
c8 = 0;
}
if (null != directory) {
if ("" !== directory) {
const Storage = unknown(510).Storage;
const result = Storage.set(lastImageSaveDirectory, directory);
const SAVED = constants.SAVED;
2026-07-29 08:29:29 +00:00
}
c10 = 3;
}
const ERRORED = constants.ERRORED;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
} catch (tmp56) {
2026-08-24 06:08:38 +00:00
closure_7 = tmp56;
2026-07-29 08:29:29 +00:00
if (tmp4 === c8) {
c10 = tmp2;
throw tmp56;
} else {
c9 = tmp;
2026-07-20 16:05:17 +00:00
}
}
}
})();
};
obj2.saveFile = function saveFile(arg0, arg1) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
return (async (arg0, value) => {
2026-07-29 08:29:29 +00:00
if (c5 === 2) {
c5 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-07-29 08:29:29 +00:00
} else if (tmp5 === 3) {
if (arg0 === 1) {
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
obj2 = { value, done: true };
return obj2;
2026-07-20 16:05:17 +00:00
} else {
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
} else {
try {
c5 = 2;
if (0 === c4) {
if (arg0 === 1) {
c5 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c5 = 3;
const obj3 = { value, done: true };
return obj3;
2026-07-29 08:29:29 +00:00
} else {
2026-08-24 06:08:38 +00:00
closure_3 = tmp2;
closure_130_0 = undefined;
closure_130_1 = undefined;
closure_130_2 = undefined;
closure_130_3 = undefined;
closure_1(tmp3[3])(unknown(tmp3[5]).isPlatformEmbedded, "Save file method called outside native app");
const tmp29 = closure_1(tmp3[3]);
const toURLSafeResult = closure_1(tmp3[12]).toURLSafe(closure_0);
2026-07-29 08:29:29 +00:00
if (null == toURLSafeResult) {
c5 = 3;
return { value: null, done: true };
} else {
if (closure_1 == null) {
2026-07-29 08:29:29 +00:00
const parts = toURLSafeResult.pathname.split("/");
closure_1 = parts.pop();
}
unknown = closure_1;
2026-07-29 08:29:29 +00:00
if (closure_1 == null) {
unknown = "unknown";
2026-07-29 08:29:29 +00:00
}
closure_130_0 = unknown;
if (null == closure_1) {
closure_130_0 = sanitizeFilename(tmp19);
2026-07-29 08:29:29 +00:00
}
c4 = 1;
c5 = 1;
const obj4 = { value: getFileData(tmp32), done: false };
return obj4;
2026-07-29 08:29:29 +00:00
}
const obj8 = closure_1(tmp3[12]);
tmp32 = closure_0;
2026-07-29 08:29:29 +00:00
}
} else if (1 === tmp6) {
if (arg0 === 1) {
c5 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c5 = 3;
const obj5 = { value, done: true };
return obj5;
2026-07-29 08:29:29 +00:00
} else {
closure_130_1 = value;
2026-07-29 08:29:29 +00:00
const _Buffer = Buffer;
closure_130_2 = Buffer.from(closure_130_1);
fileManager = fileManager.fileManager;
2026-07-29 08:29:29 +00:00
c4 = 2;
c5 = 1;
const obj6 = { value: fileManager.saveWithDialog(closure_130_2, closure_130_0, undefined), done: false };
return obj6;
2026-07-29 08:29:29 +00:00
}
} else if (arg0 === 1) {
c5 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c5 = 3;
const obj7 = { value, done: true };
return obj7;
2026-07-29 08:29:29 +00:00
} else {
closure_130_3 = value;
2026-07-29 08:29:29 +00:00
let tmp9 = null;
if (null != closure_130_3) {
tmp9 = closure_130_3;
2026-07-29 08:29:29 +00:00
}
c5 = 3;
const obj = { value: tmp9, done: true };
2026-07-29 08:29:29 +00:00
return obj;
}
} catch (tmp22) {
c5 = tmp;
throw tmp22;
2026-07-20 16:05:17 +00:00
}
}
})();
};
obj2.downloadMLModelFile = function downloadMLModelFile(arg0, arg1, arg2) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
closure_2 = arg2;
return (async () => {
v1(38)(v3(1364).isPlatformEmbedded, "Download ML model file method called outside native app");
v1(38)(null != v1(1366).toURLSafe(closure_0), "Could not download ML model, fileSrc was not a valid path");
fileManager = fileManager.fileManager;
await fileManager.maybeDownloadMLModelFile(closure_0, closure_1, closure_2);
2026-08-04 21:03:28 +00:00
return arg1;
2026-07-20 16:05:17 +00:00
})();
};
obj2.stopMLModelDownloads = function stopMLModelDownloads() {
2026-07-20 16:05:17 +00:00
const fileManager = DiscordNative.fileManager;
fileManager.stopMLModelDownloads();
};
obj2.canCheckMLModelFilesExist = function canCheckMLModelFilesExist() {
2026-08-04 21:03:28 +00:00
return typeof DiscordNative.fileManager.checkMLModelFilesExist === "function";
2026-07-29 08:29:29 +00:00
};
obj2.checkMLModelFilesExist = function checkMLModelFilesExist(arg0) {
closure_0 = arg0;
return (async () => {
fileManager = fileManager.fileManager;
await fileManager.checkMLModelFilesExist(closure_0);
2026-08-04 21:03:28 +00:00
return arg1;
2026-07-20 16:05:17 +00:00
})();
};
obj2.cleanupUnusedMLModelFiles = function cleanupUnusedMLModelFiles(arg0) {
closure_0 = arg0;
return (async () => {
fileManager = fileManager.fileManager;
await fileManager.cleanupUnusedMLModelFiles(closure_0);
2026-08-04 21:03:28 +00:00
return arg1;
2026-07-20 16:05:17 +00:00
})();
};
obj2.downloadClipsFile = function downloadClipsFile(arg0, arg1, arg2) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
closure_2 = arg2;
return (async () => {
v1(38)(v3(1364).isPlatformEmbedded, "Download clips file method called outside native app");
v1(38)(null != v1(1366).toURLSafe(closure_0), "Could not download clips file, fileSrc was not a valid path");
fileManager = fileManager.fileManager;
await fileManager.maybeDownloadClipsFile(closure_0, closure_1, closure_2);
2026-08-04 21:03:28 +00:00
return arg1;
2026-07-20 16:05:17 +00:00
})();
};
obj2.canCheckClipsFilesExist = function canCheckClipsFilesExist() {
2026-08-04 21:03:28 +00:00
return typeof DiscordNative.fileManager.checkClipsFilesExist === "function";
2026-07-29 08:29:29 +00:00
};
obj2.checkClipsFilesExist = function checkClipsFilesExist(arg0) {
closure_0 = arg0;
return (async () => {
fileManager = fileManager.fileManager;
await fileManager.checkClipsFilesExist(closure_0);
2026-08-04 21:03:28 +00:00
return arg1;
2026-07-20 16:05:17 +00:00
})();
};
obj2.cleanupUnusedClipsFiles = function cleanupUnusedClipsFiles(arg0) {
closure_0 = arg0;
return (async () => {
fileManager = fileManager.fileManager;
await fileManager.cleanupUnusedClipsFiles(closure_0);
2026-08-04 21:03:28 +00:00
return arg1;
2026-07-20 16:05:17 +00:00
})();
};
obj2.getClipsDataDirSync = function getClipsDataDirSync() {
2026-07-20 16:05:17 +00:00
const fileManager = DiscordNative.fileManager;
return fileManager.getClipsDataDirSync();
};
obj2.getClipsSentryDirSync = function getClipsSentryDirSync() {
2026-07-20 16:05:17 +00:00
if (null != DiscordNative.fileManager.getClipsSentryDirSync) {
const fileManager = DiscordNative.fileManager;
return fileManager.getClipsSentryDirSync();
}
};
obj2.downloadOpenH264 = function downloadOpenH264(arg0, arg1, arg2, arg3) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
closure_2 = arg2;
closure_3 = arg3;
return (async () => {
v1(38)(v3(1364).isPlatformEmbedded, "Download OpenH264 file method called outside native app");
v1(38)(null != v1(1366).toURLSafe(closure_0), "Could not download OpenH264, fileSrc was not a valid path");
fileManager = fileManager.fileManager;
await fileManager.maybeDownloadOpenH264(closure_0, closure_1, closure_2, closure_3);
2026-08-04 21:03:28 +00:00
return arg1;
2026-07-20 16:05:17 +00:00
})();
};
obj2.cleanupUnusedOpenH264Files = function cleanupUnusedOpenH264Files(items) {
closure_0 = items;
return (async () => {
fileManager = fileManager.fileManager;
await fileManager.cleanupUnusedOpenH264Files(closure_0);
2026-08-04 21:03:28 +00:00
return arg1;
2026-07-20 16:05:17 +00:00
})();
};
obj2.getOpenH264LibraryPath = function getOpenH264LibraryPath() {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-29 08:29:29 +00:00
const fileManager = DiscordNative.fileManager;
const getOpenH264LibraryPathSync = fileManager.getOpenH264LibraryPathSync;
2026-07-20 16:05:17 +00:00
let openH264LibraryPathSync;
2026-07-29 08:29:29 +00:00
if (getOpenH264LibraryPathSync != null) {
openH264LibraryPathSync = getOpenH264LibraryPathSync();
2026-07-20 16:05:17 +00:00
}
return openH264LibraryPathSync;
}
};
obj2.canCopyImage = function canCopyImage() {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-08-04 21:03:28 +00:00
if (typeof DiscordNative.clipboard.copyImage !== "function") {
2026-07-20 16:05:17 +00:00
return false;
} else {
if (null != tmp) {
const decideFileExtensionResult = FileExtensionUtils.decideFileExtension(tmp, undefined);
2026-07-21 22:01:30 +00:00
if (null != decideFileExtensionResult) {
if (!set.has(decideFileExtensionResult)) {
2026-08-08 06:10:11 +00:00
if (!set1.has(decideFileExtensionResult)) {
return false;
}
2026-07-20 16:05:17 +00:00
}
}
const tmp2Result = FileExtensionUtils;
2026-07-20 16:05:17 +00:00
}
return true;
}
} else {
return false;
}
};
obj2.cut = function cut() {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
const clipboard = DiscordNative.clipboard;
clipboard.cut();
}
};
obj2.paste = function paste() {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
const clipboard = DiscordNative.clipboard;
clipboard.paste();
}
};
obj2.readClipboard = function readClipboard() {
2026-07-20 16:05:17 +00:00
let str = "";
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
const clipboard = DiscordNative.clipboard;
str = clipboard.read();
}
return str;
};
obj2.clipboardHasMixedContent = function clipboardHasMixedContent() {
let isPlatformEmbedded = require("PlatformUtils").isPlatformEmbedded;
2026-07-29 08:29:29 +00:00
if (isPlatformEmbedded) {
const clipboard = DiscordNative.clipboard;
const hasMixedContent = clipboard.hasMixedContent;
let flag;
if (hasMixedContent != null) {
flag = hasMixedContent();
}
if (flag == null) {
flag = false;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
isPlatformEmbedded = flag;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return isPlatformEmbedded;
2026-07-20 16:05:17 +00:00
};
obj2.on = function on(arg0, arg1) {
2026-07-20 16:05:17 +00:00
const ipc = DiscordNative.ipc;
ipc.on(arg0, arg1);
};
obj2.onIPC = function onIPC(arg0, arg1) {
2026-07-20 16:05:17 +00:00
const ipc = DiscordNative.ipc;
ipc.on(arg0, arg1);
};
obj2.invoke = function invoke(arg0) {
2026-07-20 16:05:17 +00:00
const ipc = DiscordNative.ipc;
const items = [arg0, ...HermesBuiltin.copyRestArgs()];
return ipc.invoke.apply(items);
};
obj2.invokeIPC = function invokeIPC(arg0) {
2026-07-20 16:05:17 +00:00
const ipc = DiscordNative.ipc;
const items = [arg0, ...HermesBuiltin.copyRestArgs()];
return ipc.invoke.apply(items);
};
obj2.send = function send(arg0) {
2026-07-20 16:05:17 +00:00
const ipc = DiscordNative.ipc;
const items = [arg0, ...HermesBuiltin.copyRestArgs()];
ipc.send.apply(items);
};
obj2.sendIPC = function sendIPC(APP_BADGE_SET) {
2026-07-20 16:05:17 +00:00
const ipc = DiscordNative.ipc;
const items = [APP_BADGE_SET, ...HermesBuiltin.copyRestArgs()];
ipc.send.apply(items);
};
obj2.isIPCReady = function isIPCReady() {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-29 08:29:29 +00:00
try {
let ipc;
if (DiscordNative != null) {
ipc = tmp.ipc;
}
let tmp4 = null != ipc;
if (tmp4) {
2026-08-04 21:03:28 +00:00
tmp4 = typeof tmp.ipc.send === "function";
2026-07-29 08:29:29 +00:00
}
return tmp4;
} catch (err) {
return false;
2026-07-20 16:05:17 +00:00
}
} else {
return true;
}
};
obj2.waitForIPCReady = function waitForIPCReady() {
2026-07-29 08:29:29 +00:00
let _window = arg1;
if (arg1 === undefined) {
2026-07-20 16:05:17 +00:00
_window = window;
}
2026-07-23 10:11:24 +00:00
const self = this;
return (async (arg0, value) => {
2026-07-29 08:29:29 +00:00
if (c3 === 2) {
c3 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-07-29 08:29:29 +00:00
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
obj2 = { value, done: true };
return obj2;
2026-07-29 08:29:29 +00:00
} else {
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c3 = 2;
if (0 === c2) {
2026-07-29 08:29:29 +00:00
if (arg0 === 1) {
c3 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c3 = 3;
const obj3 = { value, done: true };
return obj3;
2026-07-29 08:29:29 +00:00
} else {
2026-08-24 06:08:38 +00:00
c1 = 1;
closure_0 = tmp2;
closure_128_0 = undefined;
2026-07-29 08:29:29 +00:00
const _Date2 = Date;
const timestamp = Date.now();
closure_128_0 = timestamp;
2026-07-29 08:29:29 +00:00
const _Date3 = Date;
if (Date.now() - timestamp < num) {
if (closure_129_2.isIPCReady()) {
2026-07-29 08:29:29 +00:00
c3 = 3;
return { value: true, done: true };
} else {
const promise = new Promise((callback2) => closure_1_1.requestAnimationFrame(callback2));
c2 = 1;
2026-07-29 08:29:29 +00:00
c3 = 1;
const obj4 = { value: promise, done: false };
return obj4;
2026-07-29 08:29:29 +00:00
}
} else {
c3 = 3;
}
}
} else if (arg0 === 1) {
c3 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 !== 2) {
const _Date = Date;
}
c3 = 3;
const obj = { value, done: true };
2026-07-29 08:29:29 +00:00
return obj;
} catch (tmp19) {
c3 = tmp;
throw tmp19;
2026-07-20 16:05:17 +00:00
}
}
})();
};
obj2.flashFrame = function flashFrame(arg0) {
2026-07-20 16:05:17 +00:00
const _window = DiscordNative.window;
_window.flashFrame(arg0);
};
obj2.webAuthnRegister = function webAuthnRegister(arg0) {
closure_0 = arg0;
return (async () => {
const nativeModules = DiscordNative.nativeModules;
await nativeModules.ensureModule("discord_webauthn");
const webAuthn = DiscordNative.webAuthn;
await webAuthn.webAuthnRegister(closure_128_0);
2026-08-04 21:03:28 +00:00
return arg1;
2026-07-20 16:05:17 +00:00
})();
};
obj2.webAuthnAuthenticate = function webAuthnAuthenticate(arg0) {
closure_0 = arg0;
return (async () => {
const nativeModules = DiscordNative.nativeModules;
await nativeModules.ensureModule("discord_webauthn");
const webAuthn = DiscordNative.webAuthn;
await webAuthn.webAuthnAuthenticate(closure_128_0);
2026-08-04 21:03:28 +00:00
return arg1;
2026-07-20 16:05:17 +00:00
})();
};
obj2.minimize = function minimize(arg0) {
2026-07-20 16:05:17 +00:00
const _window = DiscordNative.window;
_window.minimize(arg0);
};
obj2.restore = function restore(arg0) {
2026-07-20 16:05:17 +00:00
const _window = DiscordNative.window;
_window.restore(arg0);
};
obj2.maximize = function maximize(arg0) {
2026-07-20 16:05:17 +00:00
const _window = DiscordNative.window;
_window.maximize(arg0);
};
obj2.focus = function focus(arg0) {
2026-07-20 16:05:17 +00:00
let flag = arg1;
if (arg1 === undefined) {
flag = false;
}
let isWindowsResult = flag;
if (flag) {
isWindowsResult = require("PlatformUtils").isWindows();
const obj = require("PlatformUtils");
2026-07-20 16:05:17 +00:00
}
if (isWindowsResult) {
2026-07-29 08:29:29 +00:00
const self = this;
this.minimize(null);
2026-07-20 16:05:17 +00:00
}
const _window = DiscordNative.window;
_window.focus(flag, arg0);
};
obj2.blur = function blur() {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
if (null != DiscordNative.window.blur) {
const _window = DiscordNative.window;
_window.blur();
}
}
window.blur();
};
obj2.fullscreen = function fullscreen(arg0) {
2026-07-20 16:05:17 +00:00
const _window = DiscordNative.window;
_window.fullscreen(arg0);
};
obj2.close = function close(arg0) {
2026-07-20 16:05:17 +00:00
const _window = DiscordNative.window;
_window.close(arg0);
};
obj2.clearNavigationHistory = function clearNavigationHistory() {
2026-08-24 06:08:38 +00:00
backwardCompatSend(IPCEvents.IPCEvents.NAVIGATION_HISTORY_CLEAR);
2026-07-20 16:05:17 +00:00
};
obj2.setAlwaysOnTop = function setAlwaysOnTop(arg0, arg1) {
2026-08-04 21:03:28 +00:00
if (typeof DiscordNative.window.setAlwaysOnTop === "function") {
2026-07-29 08:29:29 +00:00
const _window = tmp.window;
2026-07-20 16:05:17 +00:00
_window.setAlwaysOnTop(arg0, arg1);
}
};
obj2.isAlwaysOnTop = function isAlwaysOnTop(arg0) {
closure_0 = arg0;
return (async (arg0, value) => {
2026-07-29 08:29:29 +00:00
if (c2 === 2) {
c2 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-07-29 08:29:29 +00:00
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
obj2 = { value, done: true };
return obj2;
2026-07-29 08:29:29 +00:00
} else {
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c2 = 2;
if (0 === c1) {
if (arg0 === 1) {
c2 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c2 = 3;
const obj3 = { value, done: true };
return obj3;
2026-07-29 08:29:29 +00:00
} else {
2026-08-24 06:08:38 +00:00
closure_0 = tmp2;
closure_128_0 = false;
if (typeof DiscordNative.window.isAlwaysOnTop === "function") {
const _window = DiscordNative.window;
2026-07-29 08:29:29 +00:00
c1 = 1;
c2 = 1;
const obj4 = { value: _window.isAlwaysOnTop(closure_0), done: false };
return obj4;
2026-07-29 08:29:29 +00:00
} else {
c2 = 3;
}
}
} else if (arg0 === 1) {
c2 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 !== 2) {
closure_128_0 = value;
2026-07-29 08:29:29 +00:00
}
c2 = 3;
const obj = { value, done: true };
2026-07-29 08:29:29 +00:00
return obj;
} catch (tmp10) {
c2 = tmp;
throw tmp10;
}
2026-07-20 16:05:17 +00:00
}
})();
};
obj2.showInactive = function showInactive(arg0) {
2026-07-20 16:05:17 +00:00
let showInactive;
2026-07-29 08:29:29 +00:00
if (DiscordNative != null) {
const _window = tmp.window;
if (_window != null) {
2026-07-20 16:05:17 +00:00
showInactive = _window.showInactive;
}
}
2026-08-04 21:03:28 +00:00
if (typeof showInactive === "function") {
2026-07-29 08:29:29 +00:00
const _window2 = tmp.window;
2026-07-20 16:05:17 +00:00
_window2.showInactive(arg0);
}
};
obj2.setMinimumSize = function setMinimumSize(arg0, arg1) {
2026-07-29 08:29:29 +00:00
if (DiscordNative != null) {
2026-07-20 16:05:17 +00:00
const _window = DiscordNative.window;
2026-07-29 08:29:29 +00:00
if (_window != null) {
const setMinimumSize = _window.setMinimumSize;
if (setMinimumSize != null) {
setMinimumSize(arg0, arg1);
}
}
2026-07-20 16:05:17 +00:00
}
};
obj2.setTrafficLightPosition = function setTrafficLightPosition(arg0) {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-29 08:29:29 +00:00
if ("darwin" === tmpResult.getPlatformName()) {
try {
const self = this;
this.sendIPC(tmp(5737).IPCEvents.WINDOW_SET_TRAFFIC_LIGHT_POSITION, arg0);
} catch (err) {
}
}
tmpResult = tmp(1364);
}
};
obj2.setTrafficLightAppearance = function setTrafficLightAppearance(arg0, arg1) {
if (require("PlatformUtils").isPlatformEmbedded) {
if ("darwin" === tmpResult.getPlatformName()) {
try {
const self = this;
this.sendIPC(tmp(5737).IPCEvents.WINDOW_SET_TRAFFIC_LIGHT_APPEARANCE, arg0, arg1);
2026-07-29 08:29:29 +00:00
} catch (err) {
}
2026-07-20 16:05:17 +00:00
}
tmpResult = tmp(1364);
2026-07-20 16:05:17 +00:00
}
};
obj2.purgeMemory = function purgeMemory() {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
const processUtils = DiscordNative.processUtils;
processUtils.purgeMemory();
}
};
obj2.updateCrashReporter = function updateCrashReporter(arg0) {
2026-07-20 16:05:17 +00:00
const crashReporter = DiscordNative.crashReporter;
crashReporter.updateCrashReporter(arg0);
};
obj2.triggerJSException = function triggerJSException(arg0) {
2026-07-20 16:05:17 +00:00
const crashReporter = DiscordNative.crashReporter;
crashReporter.triggerJSException(arg0);
};
obj2.flushDNSCache = function flushDNSCache() {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
const processUtils = DiscordNative.processUtils;
processUtils.flushDNSCache();
}
};
obj2.supportsFeature = function supportsFeature(arg0) {
2026-07-20 16:05:17 +00:00
const features = DiscordNative.features;
2026-07-29 08:29:29 +00:00
return features.supports(arg0);
2026-07-20 16:05:17 +00:00
};
obj2.getEnableHardwareAcceleration = function getEnableHardwareAcceleration() {
const isPlatformEmbedded = require("PlatformUtils").isPlatformEmbedded;
2026-07-29 08:29:29 +00:00
let enableHardwareAcceleration = !isPlatformEmbedded;
if (isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
const gpuSettings = DiscordNative.gpuSettings;
enableHardwareAcceleration = gpuSettings.getEnableHardwareAcceleration();
}
return enableHardwareAcceleration;
};
obj2.setEnableHardwareAcceleration = function setEnableHardwareAcceleration(arg0) {
2026-07-20 16:05:17 +00:00
const gpuSettings = DiscordNative.gpuSettings;
const result = gpuSettings.setEnableHardwareAcceleration(arg0);
};
obj2.setOpenH264Enabled = function setOpenH264Enabled(arg0) {
2026-07-29 08:29:29 +00:00
if (DiscordNative != null) {
2026-07-20 16:05:17 +00:00
const settings = DiscordNative.settings;
2026-07-29 08:29:29 +00:00
if (settings != null) {
if (settings.set != null) {
const result = set("openH264Enabled", arg0);
}
}
2026-07-20 16:05:17 +00:00
}
};
obj2.setChromiumSwitches = function setChromiumSwitches(arg0) {
2026-07-20 16:05:17 +00:00
const gpuSettings = DiscordNative.gpuSettings;
gpuSettings.setChromiumSwitches(arg0);
};
obj2.getOpenOnStart = function getOpenOnStart() {
return (async (arg0, value) => {
app = app.app;
2026-08-04 21:03:28 +00:00
const getOpenOnStart = app.getOpenOnStart;
if (getOpenOnStart != null) {
const openOnStart = getOpenOnStart();
}
await openOnStart;
2026-08-04 21:03:28 +00:00
if (1 === tmp4) {
2026-07-29 08:29:29 +00:00
if (arg0 === 1) {
2026-08-24 06:08:38 +00:00
c3 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
2026-08-04 21:03:28 +00:00
c3 = 3;
return { value, done: true };
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
} else if (arg0 === 1) {
c3 = 3;
throw value;
2026-08-04 21:03:28 +00:00
} else if (arg0 === 2) {
c3 = 3;
return { value, done: true };
} else if (value == null) {
const settings = closure_129_6.settings;
c2 = 1;
c3 = 1;
return { value: settings.get("OPEN_ON_STARTUP", true), done: false };
}
return value;
2026-07-20 16:05:17 +00:00
})();
};
obj2.getGPUDriverVersions = function getGPUDriverVersions() {
2026-07-20 16:05:17 +00:00
if (obj.isWindows()) {
2026-07-29 08:29:29 +00:00
const self = this;
if (null != this.getDiscordUtils().getGPUDriverVersions) {
2026-07-20 16:05:17 +00:00
const discordUtils = self.getDiscordUtils();
let gPUDriverVersions = discordUtils.getGPUDriverVersions();
}
return gPUDriverVersions;
}
gPUDriverVersions = Promise.resolve(Object.freeze({}));
};
obj2.setZoomFactor = function setZoomFactor(arg0) {
let flag = require("PlatformUtils").isPlatformEmbedded;
2026-07-29 08:29:29 +00:00
if (flag) {
2026-07-20 16:05:17 +00:00
const _window = DiscordNative.window;
_window.setZoomFactor(arg0);
flag = true;
}
return flag;
};
obj2.setBackgroundThrottling = function setBackgroundThrottling(arg0) {
2026-07-20 16:05:17 +00:00
if (null != DiscordNative.window.setBackgroundThrottling) {
2026-07-29 08:29:29 +00:00
const _window = tmp.window;
2026-07-20 16:05:17 +00:00
const result = _window.setBackgroundThrottling(arg0);
} else {
2026-07-29 08:29:29 +00:00
const webContents = tmp.window.webContents;
2026-07-20 16:05:17 +00:00
const result1 = webContents.setBackgroundThrottling(arg0);
}
};
obj2.setFocusable = function setFocusable(arg0, arg1) {
2026-08-04 21:03:28 +00:00
if (typeof DiscordNative.window.setFocusable === "function") {
2026-07-29 08:29:29 +00:00
const _window = tmp.window;
2026-07-20 16:05:17 +00:00
_window.setFocusable(arg0, arg1);
}
};
obj2.pauseFrameEvictor = function pauseFrameEvictor() {
2026-07-29 08:29:29 +00:00
const app = DiscordNative.app;
const pauseFrameEvictor = app.pauseFrameEvictor;
if (pauseFrameEvictor != null) {
pauseFrameEvictor();
2026-07-20 16:05:17 +00:00
}
};
obj2.unpauseFrameEvictor = function unpauseFrameEvictor() {
2026-07-29 08:29:29 +00:00
const app = DiscordNative.app;
const unpauseFrameEvictor = app.unpauseFrameEvictor;
if (unpauseFrameEvictor != null) {
unpauseFrameEvictor();
2026-07-20 16:05:17 +00:00
}
};
obj2.getPreferredSystemLanguages = function getPreferredSystemLanguages() {
2026-07-29 08:29:29 +00:00
const app = DiscordNative.app;
const getPreferredSystemLanguages = app.getPreferredSystemLanguages;
2026-07-20 16:05:17 +00:00
let preferredSystemLanguages;
2026-07-29 08:29:29 +00:00
if (getPreferredSystemLanguages != null) {
preferredSystemLanguages = getPreferredSystemLanguages();
2026-07-20 16:05:17 +00:00
}
return preferredSystemLanguages;
};
obj2.getSystemUIDirection = function getSystemUIDirection() {
2026-07-29 08:29:29 +00:00
const app = DiscordNative.app;
const getSystemUIDirection = app.getSystemUIDirection;
let systemUIDirection;
if (getSystemUIDirection != null) {
systemUIDirection = getSystemUIDirection();
}
return systemUIDirection;
};
obj2.getPidFromDesktopSource = function getPidFromDesktopSource(str) {
2026-07-20 16:05:17 +00:00
if (obj.isDesktop()) {
2026-07-29 08:29:29 +00:00
const self = this;
if (null != this.getDiscordUtils().getPidFromWindowHandle) {
2026-07-20 16:05:17 +00:00
let parts;
2026-07-29 08:29:29 +00:00
if (str != null) {
2026-07-20 16:05:17 +00:00
parts = str.split(":");
}
let first;
2026-07-29 08:29:29 +00:00
if (parts != null) {
2026-07-20 16:05:17 +00:00
first = parts[0];
}
if ("window" === first) {
2026-07-29 08:29:29 +00:00
let str5;
if (parts != null) {
str5 = parts[1];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (str5 == null) {
str5 = "";
2026-07-20 16:05:17 +00:00
}
const discordUtils = self.getDiscordUtils();
const pidFromWindowHandle = discordUtils.getPidFromWindowHandle(str5);
2026-07-29 08:29:29 +00:00
let tmp6 = null;
2026-07-20 16:05:17 +00:00
if (null != pidFromWindowHandle) {
2026-07-29 08:29:29 +00:00
tmp6 = null;
2026-07-20 16:05:17 +00:00
if (0 !== pidFromWindowHandle) {
2026-07-29 08:29:29 +00:00
tmp6 = pidFromWindowHandle;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
return tmp6;
2026-07-20 16:05:17 +00:00
} else {
if (first.startsWith("screen")) {
let tmp4 = 1;
} else {
tmp4 = null;
}
return tmp4;
}
}
}
return null;
};
obj2.getDesktopSourceFromPid = function getDesktopSourceFromPid(arg0) {
2026-07-20 16:05:17 +00:00
if (obj.isWindows()) {
2026-07-29 08:29:29 +00:00
const self = this;
if (null != this.getDiscordUtils().getWindowHandleFromPid) {
2026-07-20 16:05:17 +00:00
if (null != arg0) {
const discordUtils = self.getDiscordUtils();
const windowHandleFromPid = discordUtils.getWindowHandleFromPid(arg0);
let joined = null;
if (null != windowHandleFromPid) {
joined = null;
if (0 !== windowHandleFromPid.length) {
2026-07-23 10:11:24 +00:00
const items = ["window", windowHandleFromPid, "0"];
2026-07-20 16:05:17 +00:00
joined = items.join(":");
}
}
return joined;
}
}
}
return null;
};
obj2.generateSessionFromPid = function generateSessionFromPid(arg0) {
2026-07-20 16:05:17 +00:00
const discordUtils = this.getDiscordUtils();
return discordUtils.generateSessionFromPid(arg0);
};
obj2.getAudioPid = function getAudioPid(arg0) {
2026-07-20 16:05:17 +00:00
const self = this;
let audioPid = arg0;
if (null != this.getDiscordUtils().getAudioPid) {
audioPid = arg0;
if (null != arg0) {
const discordUtils = self.getDiscordUtils();
audioPid = discordUtils.getAudioPid(arg0);
}
}
return audioPid;
};
obj2.setForegroundProcess = function setForegroundProcess(arg0) {
2026-07-20 16:05:17 +00:00
const setForegroundProcess = this.getDiscordUtils().setForegroundProcess;
2026-07-29 08:29:29 +00:00
try {
let setForegroundProcessResult = null != setForegroundProcess;
if (setForegroundProcessResult) {
setForegroundProcessResult = setForegroundProcess(arg0);
}
return setForegroundProcessResult;
} catch (err) {
return false;
2026-07-20 16:05:17 +00:00
}
};
obj2.getDiscordMemoryUsage = function getDiscordMemoryUsage() {
2026-07-20 16:05:17 +00:00
const getDiscordMemoryUsage = this.getDiscordUtils().getDiscordMemoryUsage;
let discordMemoryUsage = null;
if (null != getDiscordMemoryUsage) {
discordMemoryUsage = getDiscordMemoryUsage();
}
return discordMemoryUsage;
};
obj2.getDiscordMemoryUsageElectronRenderer = function getDiscordMemoryUsageElectronRenderer() {
2026-07-20 16:05:17 +00:00
const getDiscordMemoryUsageElectronRenderer = this.getDiscordUtils().getDiscordMemoryUsageElectronRenderer;
let discordMemoryUsageElectronRenderer;
2026-07-29 08:29:29 +00:00
if (getDiscordMemoryUsageElectronRenderer != null) {
2026-07-20 16:05:17 +00:00
discordMemoryUsageElectronRenderer = getDiscordMemoryUsageElectronRenderer();
}
return discordMemoryUsageElectronRenderer;
};
obj2.getDiscordMemoryPrivateUsageElectronRenderer = function getDiscordMemoryPrivateUsageElectronRenderer() {
2026-07-20 16:05:17 +00:00
const getDiscordMemoryPrivUsageElectronRenderer = this.getDiscordUtils().getDiscordMemoryPrivUsageElectronRenderer;
let discordMemoryPrivUsageElectronRenderer;
2026-07-29 08:29:29 +00:00
if (getDiscordMemoryPrivUsageElectronRenderer != null) {
2026-07-20 16:05:17 +00:00
discordMemoryPrivUsageElectronRenderer = getDiscordMemoryPrivUsageElectronRenderer();
}
return discordMemoryPrivUsageElectronRenderer;
};
obj2.getDiscordMemoryUsageElectronProcessTypeDetails = function getDiscordMemoryUsageElectronProcessTypeDetails() {
2026-07-20 16:05:17 +00:00
const getDiscordMemoryUsageElectronProcessTypeDetails = this.getDiscordUtils().getDiscordMemoryUsageElectronProcessTypeDetails;
let discordMemoryUsageElectronProcessTypeDetails;
2026-07-29 08:29:29 +00:00
if (getDiscordMemoryUsageElectronProcessTypeDetails != null) {
2026-07-20 16:05:17 +00:00
discordMemoryUsageElectronProcessTypeDetails = getDiscordMemoryUsageElectronProcessTypeDetails();
}
return discordMemoryUsageElectronProcessTypeDetails;
};
obj2.enablePerfMemoryHooks = function enablePerfMemoryHooks(arg0) {
2026-07-20 16:05:17 +00:00
const enablePerfMemoryHooks = this.getDiscordUtils().enablePerfMemoryHooks;
let result;
2026-07-29 08:29:29 +00:00
if (enablePerfMemoryHooks != null) {
2026-07-20 16:05:17 +00:00
result = enablePerfMemoryHooks(arg0);
}
return result;
};
obj2.disablePerfMemoryHooks = function disablePerfMemoryHooks() {
2026-07-20 16:05:17 +00:00
const disablePerfMemoryHooks = this.getDiscordUtils().disablePerfMemoryHooks;
let result;
2026-07-29 08:29:29 +00:00
if (disablePerfMemoryHooks != null) {
2026-07-20 16:05:17 +00:00
result = disablePerfMemoryHooks();
}
return result;
};
obj2.getPerfAttributedMemory = function getPerfAttributedMemory() {
2026-07-20 16:05:17 +00:00
const getPerfAttributedMemory = this.getDiscordUtils().getPerfAttributedMemory;
let perfAttributedMemory;
2026-07-29 08:29:29 +00:00
if (getPerfAttributedMemory != null) {
2026-07-20 16:05:17 +00:00
perfAttributedMemory = getPerfAttributedMemory();
}
return perfAttributedMemory;
};
obj2.getPerfAttributedMemoryCallstacks = function getPerfAttributedMemoryCallstacks(arg0) {
2026-07-20 16:05:17 +00:00
const getPerfAttributedMemoryCallstacks = this.getDiscordUtils().getPerfAttributedMemoryCallstacks;
let perfAttributedMemoryCallstacks;
2026-07-29 08:29:29 +00:00
if (getPerfAttributedMemoryCallstacks != null) {
2026-07-20 16:05:17 +00:00
perfAttributedMemoryCallstacks = getPerfAttributedMemoryCallstacks(arg0);
}
return perfAttributedMemoryCallstacks;
};
obj2.getPerfAttributedMemoryStats = function getPerfAttributedMemoryStats() {
2026-07-20 16:05:17 +00:00
const getPerfAttributedMemoryStats = this.getDiscordUtils().getPerfAttributedMemoryStats;
let perfAttributedMemoryStats;
2026-07-29 08:29:29 +00:00
if (getPerfAttributedMemoryStats != null) {
2026-07-20 16:05:17 +00:00
perfAttributedMemoryStats = getPerfAttributedMemoryStats();
}
return perfAttributedMemoryStats;
};
obj2.startCPUProfiling = function startCPUProfiling(arg0) {
2026-07-20 16:05:17 +00:00
const startCPUProfiling = this.getDiscordUtils().startCPUProfiling;
let startCPUProfilingResult;
2026-07-29 08:29:29 +00:00
if (startCPUProfiling != null) {
2026-07-20 16:05:17 +00:00
startCPUProfilingResult = startCPUProfiling(arg0);
}
return startCPUProfilingResult;
};
obj2.stopCPUProfiling = function stopCPUProfiling() {
2026-07-23 10:11:24 +00:00
const self = this;
return (async (arg0, value) => {
2026-07-29 08:29:29 +00:00
if (c2 === 2) {
c2 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-07-29 08:29:29 +00:00
} else if (tmp3 === 3) {
if (arg0 === 1) {
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
obj2 = { value, done: true };
return obj2;
2026-07-29 08:29:29 +00:00
} else {
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
try {
c2 = 2;
if (0 === c1) {
if (arg0 === 1) {
c2 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c2 = 3;
const obj3 = { value, done: true };
return obj3;
2026-07-29 08:29:29 +00:00
} else {
2026-08-24 06:08:38 +00:00
closure_0 = tmp4;
closure_128_0 = undefined;
const stopCPUProfiling = self.getDiscordUtils().stopCPUProfiling;
2026-07-29 08:29:29 +00:00
let stopCPUProfilingResult;
if (stopCPUProfiling != null) {
stopCPUProfilingResult = stopCPUProfiling();
}
c1 = 1;
c2 = 1;
const obj4 = { value: stopCPUProfilingResult, done: false };
return obj4;
2026-07-29 08:29:29 +00:00
}
} else if (arg0 === 1) {
c2 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c2 = 3;
const obj = { value, done: true };
2026-07-29 08:29:29 +00:00
return obj;
} else {
closure_128_0 = value;
if (null == closure_128_0) {
2026-07-29 08:29:29 +00:00
const _Error = Error;
const error = new Error("Failed to stop CPU profiling");
2026-07-29 08:29:29 +00:00
Promise.reject(error);
} else {
const _JSON = JSON;
const parsed = JSON.parse(closure_128_0);
2026-07-29 08:29:29 +00:00
}
c2 = 3;
}
} catch (tmp21) {
c2 = tmp;
throw tmp21;
}
2026-07-20 16:05:17 +00:00
}
})();
};
obj2.gzipAndBase64Encode = function gzipAndBase64Encode(arg0) {
2026-07-20 16:05:17 +00:00
const gzipAndBase64Encode = this.getDiscordUtils().gzipAndBase64Encode;
let gzipAndBase64EncodeResult;
2026-07-29 08:29:29 +00:00
if (gzipAndBase64Encode != null) {
2026-07-20 16:05:17 +00:00
gzipAndBase64EncodeResult = gzipAndBase64Encode(arg0);
}
2026-07-29 08:29:29 +00:00
if (gzipAndBase64EncodeResult == null) {
2026-07-20 16:05:17 +00:00
gzipAndBase64EncodeResult = Promise.resolve(null);
}
return gzipAndBase64EncodeResult;
};
obj2.showOpenDialog = function showOpenDialog(properties) {
2026-07-20 16:05:17 +00:00
const fileManager = DiscordNative.fileManager;
return fileManager.showOpenDialog({ properties });
};
obj2.flushStorageData = function flushStorageData() {
if (require("PlatformUtils").isPlatformEmbedded) {
let _Promise1 = new _Promise((fn, arg1) => {
closure_0 = fn;
2026-08-24 06:08:38 +00:00
closure_1 = arg1;
if (null != DiscordNative.processUtils.flushStorageData) {
const processUtils = DiscordNative.processUtils;
2026-07-20 16:05:17 +00:00
processUtils.flushStorageData((arg0) => {
if (null != arg0) {
const _Error = Error;
const error = new Error(arg0);
let tmp2 = closure_1(error);
2026-07-20 16:05:17 +00:00
} else {
tmp2 = closure_0();
2026-07-20 16:05:17 +00:00
}
return tmp2;
});
} else {
fn();
2026-07-20 16:05:17 +00:00
}
});
} else {
_Promise1 = _Promise.resolve();
2026-07-20 16:05:17 +00:00
}
return _Promise1;
2026-07-20 16:05:17 +00:00
};
obj2.flushCookies = function flushCookies() {
if (require("PlatformUtils").isPlatformEmbedded) {
let _Promise1 = new _Promise((fn, arg1) => {
closure_0 = fn;
2026-08-24 06:08:38 +00:00
closure_1 = arg1;
if (null != DiscordNative.processUtils.flushCookies) {
const processUtils = DiscordNative.processUtils;
2026-07-20 16:05:17 +00:00
processUtils.flushCookies((arg0) => {
if (null != arg0) {
const _Error = Error;
const error = new Error(arg0);
let tmp2 = closure_1(error);
2026-07-20 16:05:17 +00:00
} else {
tmp2 = closure_0();
2026-07-20 16:05:17 +00:00
}
return tmp2;
});
} else {
fn();
2026-07-20 16:05:17 +00:00
}
});
} else {
_Promise1 = _Promise.resolve();
2026-07-20 16:05:17 +00:00
}
return _Promise1;
2026-07-20 16:05:17 +00:00
};
obj2.setCrashInformation = function setCrashInformation(arg0, arg1) {
let isPlatformEmbedded = require("PlatformUtils").isPlatformEmbedded;
2026-07-20 16:05:17 +00:00
if (isPlatformEmbedded) {
let setCrashInformation;
2026-07-29 08:29:29 +00:00
if (DiscordNative != null) {
2026-07-20 16:05:17 +00:00
const processUtils = DiscordNative.processUtils;
2026-07-29 08:29:29 +00:00
if (processUtils != null) {
2026-07-20 16:05:17 +00:00
setCrashInformation = processUtils.setCrashInformation;
}
}
isPlatformEmbedded = null != setCrashInformation;
}
if (isPlatformEmbedded) {
const processUtils2 = DiscordNative.processUtils;
processUtils2.setCrashInformation(arg0, arg1);
}
};
obj2.blockDisplaySleep = function blockDisplaySleep() {
2026-07-20 16:05:17 +00:00
let blockDisplaySleepResult = null;
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
blockDisplaySleepResult = null;
if (null != DiscordNative.powerSaveBlocker) {
const powerSaveBlocker = DiscordNative.powerSaveBlocker;
blockDisplaySleepResult = powerSaveBlocker.blockDisplaySleep();
}
}
return blockDisplaySleepResult;
};
obj2.unblockDisplaySleep = function unblockDisplaySleep(arg0) {
let isPlatformEmbedded = require("PlatformUtils").isPlatformEmbedded;
2026-07-20 16:05:17 +00:00
if (isPlatformEmbedded) {
isPlatformEmbedded = null != DiscordNative.powerSaveBlocker;
}
if (isPlatformEmbedded) {
const powerSaveBlocker = DiscordNative.powerSaveBlocker;
powerSaveBlocker.unblockDisplaySleep(arg0);
}
};
obj2.cleanupDisplaySleep = function cleanupDisplaySleep() {
let isPlatformEmbedded = require("PlatformUtils").isPlatformEmbedded;
2026-07-20 16:05:17 +00:00
if (isPlatformEmbedded) {
isPlatformEmbedded = null != DiscordNative.powerSaveBlocker;
}
if (isPlatformEmbedded) {
const powerSaveBlocker = DiscordNative.powerSaveBlocker;
powerSaveBlocker.cleanupDisplaySleep();
}
};
obj2.relaunch = function relaunch() {
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
const app = DiscordNative.app;
app.relaunch();
}
};
obj2.makeChunkedRequest = function makeChunkedRequest(arg0, array, arg2) {
_require = "" + require("HTTPUtils").getAPIBaseURL() + arg0;
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
if (null == DiscordNative.http) {
const _Error2 = Error;
let error = new Error("HTTP module not available");
2026-07-20 16:05:17 +00:00
return Promise.reject(error);
} else {
obj2 = { maxBps: 8000, chunkInterval: 50, contentType: "application/json" };
2026-07-20 16:05:17 +00:00
const merged = Object.assign(arg2);
({ method: importDefault, token: dependencyMap, chunkInterval } = obj2);
const contentType = obj2.contentType;
2026-07-20 16:05:17 +00:00
let json = array;
if ("application/json" === contentType) {
const _JSON = JSON;
json = JSON.stringify(array);
}
const result = obj2.maxBps * (chunkInterval / 1000);
2026-07-20 16:05:17 +00:00
const _Math = Math;
const rounded = Math.ceil(json.length / result);
const _Array = Array;
array = new Array(rounded);
for (let num2 = 0; num2 < rounded; num2 = num2 + 1) {
let result1 = num2 * result;
array[num2] = json.substring(result1, result1 + result);
}
const promise = new Promise((arg0, arg1) => {
closure_0 = arg0;
2026-08-24 06:08:38 +00:00
closure_1 = arg1;
if (null != DiscordNative.http) {
const http = DiscordNative.http;
const obj = { method, chunkInterval, contentType, token };
2026-07-20 16:05:17 +00:00
const chunkedRequest = http.makeChunkedRequest(closure_0, array, obj, (arg0, status) => {
if (null != arg0) {
let tmp4 = closure_1(arg0);
2026-07-20 16:05:17 +00:00
} else if (status.status >= 400) {
const _Error = Error;
const error = new Error(status.body);
tmp4 = closure_1(error);
2026-07-20 16:05:17 +00:00
} else {
closure_0(status);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp4;
2026-07-20 16:05:17 +00:00
});
}
});
return promise;
}
} else {
2026-07-23 10:11:24 +00:00
let _Error = Error;
2026-07-20 16:05:17 +00:00
const error1 = new Error("Not embedded!");
return Promise.reject(error1);
}
let obj = require("HTTPUtils");
2026-07-20 16:05:17 +00:00
};
obj2.submitLiveCrashReport = function submitLiveCrashReport(arg0) {
2026-07-20 16:05:17 +00:00
if (obj.isWindows()) {
2026-07-29 08:29:29 +00:00
const self = this;
if (null != this.getDiscordUtils().submitLiveCrashReport) {
2026-07-20 16:05:17 +00:00
const crashReporterMetadata = self.getCrashReporterMetadata();
const app = DiscordNative.app;
let sentry;
const releaseChannel = app.getReleaseChannel();
2026-07-29 08:29:29 +00:00
if (crashReporterMetadata != null) {
2026-07-20 16:05:17 +00:00
sentry = crashReporterMetadata.sentry;
}
const discordUtils = self.getDiscordUtils();
obj2 = {};
2026-07-20 16:05:17 +00:00
const merged = Object.assign(sentry);
const merged1 = Object.assign(arg0);
return discordUtils.submitLiveCrashReport(releaseChannel, obj2);
2026-07-20 16:05:17 +00:00
}
}
return Promise.resolve();
};
obj2.crash = function crash(arg0) {
2026-07-20 16:05:17 +00:00
const crash = this.getDiscordUtils().crash;
let flag = null != crash;
if (flag) {
crash(arg0);
flag = true;
}
return flag;
};
obj2.setApplicationBackgroundColor = function setApplicationBackgroundColor(arg0) {
2026-08-24 06:08:38 +00:00
this.sendIPC(IPCEvents.IPCEvents.SETTINGS_UPDATE_BACKGROUND_COLOR, arg0);
2026-07-20 16:05:17 +00:00
};
obj2.initializeExitHook = function initializeExitHook() {
2026-07-20 16:05:17 +00:00
const initializeExitHook = this.getDiscordUtils().initializeExitHook;
if (null != initializeExitHook) {
initializeExitHook();
}
};
obj2.initializeWERHandler = function initializeWERHandler() {
2026-07-20 16:05:17 +00:00
const initializeWERHandler = this.getDiscordUtils().initializeWERHandler;
if (null != initializeWERHandler) {
initializeWERHandler();
}
};
obj2.pollQueueMetrics = function pollQueueMetrics(arg0) {
2026-07-20 16:05:17 +00:00
const pollQueueMetrics = this.getDiscordUtils().pollQueueMetrics;
if (null != pollQueueMetrics) {
pollQueueMetrics(arg0);
}
};
obj2.asyncify = function asyncify(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-20 16:05:17 +00:00
return new Promise((arg0) => {
closure_0(arg0);
2026-07-20 16:05:17 +00:00
});
};
obj2.IsGameDisplayModeUpdateSupported = function IsGameDisplayModeUpdateSupported() {
2026-07-20 16:05:17 +00:00
return null != this.getDiscordUtils().gameDisplayModeUpdate;
};
obj2.GameDisplayModeUpdate = function GameDisplayModeUpdate(arg0) {
2026-07-20 16:05:17 +00:00
const gameDisplayModeUpdate = this.getDiscordUtils().gameDisplayModeUpdate;
let result = null != gameDisplayModeUpdate && null != arg0;
if (result) {
result = gameDisplayModeUpdate(arg0);
}
return result;
};
obj2.GameDisplayModeIsGameSupported = function GameDisplayModeIsGameSupported(arg0) {
2026-07-20 16:05:17 +00:00
const gameDisplayModeIsSupported = this.getDiscordUtils().gameDisplayModeIsSupported;
let result = null != gameDisplayModeIsSupported && null != arg0;
if (result) {
result = gameDisplayModeIsSupported(arg0);
}
return result;
};
obj2.GetWindowFullscreenTypeByPid = function GetWindowFullscreenTypeByPid(arg0, arg1, arg2) {
2026-07-20 16:05:17 +00:00
const getWindowFullscreenTypeByPid = this.getDiscordUtils().getWindowFullscreenTypeByPid;
let windowFullscreenTypeByPid = null;
if (0 !== arg0) {
windowFullscreenTypeByPid = null;
if (null != getWindowFullscreenTypeByPid) {
windowFullscreenTypeByPid = null;
if (null != arg1) {
windowFullscreenTypeByPid = getWindowFullscreenTypeByPid(arg0, arg1);
}
}
}
if (-1 === windowFullscreenTypeByPid) {
windowFullscreenTypeByPid = null;
}
2026-07-29 08:29:29 +00:00
if (windowFullscreenTypeByPid == null) {
windowFullscreenTypeByPid = arg2;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (windowFullscreenTypeByPid == null) {
windowFullscreenTypeByPid = Client.RunningProcessFullscreenType.UNKNOWN;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return windowFullscreenTypeByPid;
2026-07-20 16:05:17 +00:00
};
obj2.GetWindowFullscreenTypeExtraByPid = function GetWindowFullscreenTypeExtraByPid(arg0, arg1) {
2026-07-20 16:05:17 +00:00
const getWindowFullscreenTypeExtraByPid = this.getDiscordUtils().getWindowFullscreenTypeExtraByPid;
if (null != getWindowFullscreenTypeExtraByPid) {
if (null != arg1) {
let windowFullscreenTypeExtraByPid = getWindowFullscreenTypeExtraByPid(arg0, arg1);
}
return windowFullscreenTypeExtraByPid;
}
windowFullscreenTypeExtraByPid = { quns: Client.QueryUserNotificationState.QUNS_UNKNOWN };
2026-07-20 16:05:17 +00:00
};
obj2.SetGPUBoostEnabledByPid = function SetGPUBoostEnabledByPid(arg0, arg1) {
2026-07-20 16:05:17 +00:00
const setGPUBoostEnabledByPid = this.getDiscordUtils().setGPUBoostEnabledByPid;
let result = null != setGPUBoostEnabledByPid;
if (result) {
result = setGPUBoostEnabledByPid(arg0, arg1);
}
return result;
};
obj2.SetSystemServicePerformanceMonitorEnabled = function SetSystemServicePerformanceMonitorEnabled(arg0, arg1) {
2026-07-20 16:05:17 +00:00
const setSystemServicePerformanceMonitorEnabled = this.getDiscordUtils().setSystemServicePerformanceMonitorEnabled;
let result = null != setSystemServicePerformanceMonitorEnabled;
if (result) {
result = setSystemServicePerformanceMonitorEnabled(arg0, arg1);
}
return result;
};
obj2.GetSystemServicePerformanceMonitorSnapshot = function GetSystemServicePerformanceMonitorSnapshot(arg0) {
closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const getSystemServicePerformanceMonitorSnapshot = this.getDiscordUtils().getSystemServicePerformanceMonitorSnapshot;
if (null == getSystemServicePerformanceMonitorSnapshot) {
const systemServiceNotAvailableError = new discord_common_DiscordNative.SystemServiceNotAvailableError();
2026-07-20 16:05:17 +00:00
return Promise.reject(systemServiceNotAvailableError);
} else {
const promise = new Promise((arg0, arg1) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg1;
2026-07-20 16:05:17 +00:00
const timeout = setTimeout(() => {
const error = new Error("Timed out waiting for performance snapshot");
return closure_0(error);
2026-07-20 16:05:17 +00:00
}, 1000);
});
const promise3 = new Promise((arg0, arg1) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
2026-07-23 10:11:24 +00:00
getSystemServicePerformanceMonitorSnapshot(closure_0, (arg0) => {
2026-07-20 16:05:17 +00:00
if ("null" !== arg0) {
2026-07-29 08:29:29 +00:00
try {
const _JSON = JSON;
closure_0(JSON.parse(arg0));
2026-07-29 08:29:29 +00:00
} catch (tmp11) {
let tmp12Result = globalThis;
const _Error2 = Error;
if (tmp11 instanceof Error) {
let message = tmp11.message;
} else {
const _String = String;
message = String(tmp11);
}
const error = new Error("Invalid performance snapshot JSON: " + message);
tmp12Result = closure_1(error);
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
} else {
const _Error = Error;
2026-07-29 08:29:29 +00:00
const error1 = new Error("Performance snapshot not available");
closure_1(error1);
2026-07-20 16:05:17 +00:00
}
});
});
const items = [promise3, promise];
2026-07-20 16:05:17 +00:00
return Promise.race(items).finally(() => clearTimeout(closure_1));
}
};
obj2.IsHardwareAcceleratedGPUSchedulingEnabled = function IsHardwareAcceleratedGPUSchedulingEnabled() {
2026-07-20 16:05:17 +00:00
const isHardwareAcceleratedGPUSchedulingEnabled = this.getDiscordUtils().isHardwareAcceleratedGPUSchedulingEnabled;
let result = null != isHardwareAcceleratedGPUSchedulingEnabled;
if (result) {
result = isHardwareAcceleratedGPUSchedulingEnabled();
}
return result;
};
obj2.AcquireGlobalLock = function AcquireGlobalLock(arg0) {
2026-07-20 16:05:17 +00:00
const acquireGlobalLock = this.getDiscordUtils().acquireGlobalLock;
if (null != acquireGlobalLock) {
return acquireGlobalLock(arg0);
}
};
obj2.SetServiceChannel = function SetServiceChannel(arg0) {
2026-07-20 16:05:17 +00:00
const setServiceChannel = this.getDiscordUtils().setServiceChannel;
if (null != setServiceChannel) {
setServiceChannel(arg0);
}
};
obj2.IsSystemServiceInstalled = function IsSystemServiceInstalled() {
2026-07-20 16:05:17 +00:00
const isSystemServiceInstalled = this.getDiscordUtils().isSystemServiceInstalled;
return null != isSystemServiceInstalled ? isSystemServiceInstalled() : undefined;
};
obj2.CanSystemServiceBeInstalled = function CanSystemServiceBeInstalled() {
2026-07-20 16:05:17 +00:00
const canSystemServiceBeInstalled = this.getDiscordUtils().canSystemServiceBeInstalled;
return null != canSystemServiceBeInstalled ? canSystemServiceBeInstalled() : undefined;
};
obj2.InstallSystemService = function InstallSystemService() {
2026-07-20 16:05:17 +00:00
const installSystemService = this.getDiscordUtils().installSystemService;
if (null != installSystemService) {
let installSystemServiceResult = installSystemService();
} else {
const _Error = Error;
const error = new Error("System service native not available");
2026-07-20 16:05:17 +00:00
installSystemServiceResult = Promise.reject(error);
}
return installSystemServiceResult;
};
obj2.DoesSystemServiceHaveUpdate = function DoesSystemServiceHaveUpdate() {
2026-07-20 16:05:17 +00:00
const doesSystemServiceHaveUpdate = this.getDiscordUtils().doesSystemServiceHaveUpdate;
if (null != doesSystemServiceHaveUpdate) {
let result = doesSystemServiceHaveUpdate();
} else {
const _Error = Error;
const error = new Error("System service native not available");
2026-07-20 16:05:17 +00:00
result = Promise.reject(error);
}
return result;
};
obj2.UpdateSystemService = function UpdateSystemService() {
2026-07-20 16:05:17 +00:00
const updateSystemService = this.getDiscordUtils().updateSystemService;
if (null != updateSystemService) {
let updateSystemServiceResult = updateSystemService();
} else {
const _Error = Error;
const error = new Error("System service native not available");
2026-07-20 16:05:17 +00:00
updateSystemServiceResult = Promise.reject(error);
}
return updateSystemServiceResult;
};
obj2.UninstallSystemService = function UninstallSystemService() {
2026-07-20 16:05:17 +00:00
const uninstallSystemService = this.getDiscordUtils().uninstallSystemService;
if (null != uninstallSystemService) {
let result = uninstallSystemService();
} else {
const _Error = Error;
const error = new Error("System service native not available");
2026-07-20 16:05:17 +00:00
result = Promise.reject(error);
}
return result;
};
obj2.InputEventServiceSetStatusCallback = function InputEventServiceSetStatusCallback(arg0) {
2026-07-20 16:05:17 +00:00
const inputEventServiceSetStatusCallback = this.getDiscordUtils().inputEventServiceSetStatusCallback;
if (null != inputEventServiceSetStatusCallback) {
const result = inputEventServiceSetStatusCallback(arg0);
}
};
obj2.InputEventServiceSetAllowed = function InputEventServiceSetAllowed(arg0) {
2026-07-20 16:05:17 +00:00
const inputEventServiceSetAllowed = this.getDiscordUtils().inputEventServiceSetAllowed;
if (null != inputEventServiceSetAllowed) {
return inputEventServiceSetAllowed(arg0);
}
};
obj2.ToolServiceSetStatusCallback = function ToolServiceSetStatusCallback(arg0) {
2026-07-20 16:05:17 +00:00
const toolServiceSetStatusCallback = this.getDiscordUtils().toolServiceSetStatusCallback;
if (null != toolServiceSetStatusCallback) {
const result = toolServiceSetStatusCallback(arg0);
}
};
obj2.ToolServiceSetAllowed = function ToolServiceSetAllowed(arg0) {
2026-07-20 16:05:17 +00:00
const toolServiceSetAllowed = this.getDiscordUtils().toolServiceSetAllowed;
if (null != toolServiceSetAllowed) {
return toolServiceSetAllowed(arg0);
}
};
obj2.isModuleVersionAtLeast = function isModuleVersionAtLeast(arg0, stable) {
2026-08-08 06:10:11 +00:00
let items = closure_10;
if (closure_10 == null) {
2026-07-29 08:29:29 +00:00
items = [0, 0, 0];
}
const items1 = [...items];
const moduleVersions = this.moduleVersions;
let num;
if (moduleVersions != null) {
num = moduleVersions[arg0];
}
if (num == null) {
num = 0;
}
items1.push(num);
stable = stable[this.releaseChannel];
if (stable == null) {
2026-07-20 16:05:17 +00:00
stable = stable.stable;
}
2026-07-29 08:29:29 +00:00
const entries = items1.entries();
const obj = entries[Symbol.iterator]();
2026-07-29 08:29:29 +00:00
while (obj !== undefined) {
let tmp6 = _slicedToArray(tmp4, 2);
2026-07-29 08:29:29 +00:00
[tmp7, tmp9] = tmp6;
if (tmp9 > stable[tmp7]) {
obj.return();
let flag2 = true;
return true;
} else if (tmp10 < stable[tmp8]) {
obj.return();
let flag = false;
return false;
2026-07-20 16:05:17 +00:00
}
}
return true;
};
obj2.fetchRiotGamesLiveClientData = function fetchRiotGamesLiveClientData(arg0) {
let obj = arg1;
2026-07-20 16:05:17 +00:00
if (arg1 === undefined) {
obj = {};
}
if (require("PlatformUtils").isPlatformEmbedded) {
2026-07-20 16:05:17 +00:00
if (null == DiscordNative.riotGames) {
const _Error2 = Error;
const error = new Error("Riot Games module not available");
2026-07-20 16:05:17 +00:00
let rejectResult = Promise.reject(error);
} else {
2026-07-29 08:29:29 +00:00
const riotGames = tmp6.riotGames;
2026-07-20 16:05:17 +00:00
rejectResult = riotGames.fetchLiveClientData(arg0, obj);
}
} else {
const _Error = Error;
const error1 = new Error("Not embedded!");
return Promise.reject(error1);
}
};
obj2.readCs2GsiToken = function readCs2GsiToken(arg0) {
2026-07-30 10:14:41 +00:00
if (obj.isWindows()) {
const cs2Gsi = DiscordNative.cs2Gsi;
let cs2GsiToken;
if (cs2Gsi != null) {
cs2GsiToken = cs2Gsi.readCs2GsiToken(arg0);
}
if (cs2GsiToken == null) {
cs2GsiToken = Promise.resolve(null);
}
let resolved = cs2GsiToken;
} else {
resolved = Promise.resolve(null);
}
return resolved;
};
obj2.writeCs2GsiConfig = function writeCs2GsiConfig(arg0, arg1, arg2) {
2026-07-30 10:14:41 +00:00
if (obj.isWindows()) {
const cs2Gsi = DiscordNative.cs2Gsi;
let writeCs2GsiConfigResult;
if (cs2Gsi != null) {
writeCs2GsiConfigResult = cs2Gsi.writeCs2GsiConfig(arg0, arg1, arg2);
}
if (writeCs2GsiConfigResult == null) {
writeCs2GsiConfigResult = Promise.resolve(false);
}
let resolved = writeCs2GsiConfigResult;
} else {
resolved = Promise.resolve(false);
}
return resolved;
};
obj2.deleteCs2GsiConfig = function deleteCs2GsiConfig(arg0) {
2026-07-30 10:14:41 +00:00
if (obj.isWindows()) {
const cs2Gsi = DiscordNative.cs2Gsi;
let deleteCs2GsiConfigResult;
if (cs2Gsi != null) {
deleteCs2GsiConfigResult = cs2Gsi.deleteCs2GsiConfig(arg0);
}
if (deleteCs2GsiConfigResult == null) {
deleteCs2GsiConfigResult = Promise.resolve(false);
}
let resolved = deleteCs2GsiConfigResult;
} else {
resolved = Promise.resolve(false);
}
return resolved;
};
obj2.debugLogCs2GsiPayload = function debugLogCs2GsiPayload(arg0) {
2026-07-30 10:14:41 +00:00
if (obj.isWindows()) {
const cs2Gsi = DiscordNative.cs2Gsi;
let result;
if (cs2Gsi != null) {
result = cs2Gsi.debugLogCs2GsiPayload(arg0);
}
if (result == null) {
result = Promise.resolve();
}
let resolved = result;
} else {
resolved = Promise.resolve();
}
return resolved;
};
obj2.appViewed = function appViewed() {
2026-07-20 16:05:17 +00:00
if (obj.isDesktop()) {
2026-07-29 08:29:29 +00:00
const self = this;
2026-07-20 16:05:17 +00:00
const _performance = performance;
performance.mark("app_viewed");
2026-08-24 06:08:38 +00:00
this.sendIPC(IPCEvents.IPCEvents.APP_VIEWED);
2026-07-20 16:05:17 +00:00
}
};
obj2.appFirstRenderAfterReadyPayload = function appFirstRenderAfterReadyPayload(arg0) {
2026-07-20 16:05:17 +00:00
if (obj.isDesktop()) {
2026-07-29 08:29:29 +00:00
const self = this;
2026-07-20 16:05:17 +00:00
const _performance = performance;
performance.mark("app_first_render_after_ready_payload");
2026-08-24 06:08:38 +00:00
this.sendIPC(IPCEvents.IPCEvents.APP_FIRST_RENDER_AFTER_READY_PAYLOAD, arg0);
2026-07-20 16:05:17 +00:00
}
};
obj2.appLoaded = function appLoaded() {
2026-08-24 06:08:38 +00:00
backwardCompatSend(IPCEvents.IPCEvents.APP_LOADED);
2026-07-20 16:05:17 +00:00
};
obj2.indexLoadedAsync = function indexLoadedAsync() {
2026-08-24 06:08:38 +00:00
backwardCompatSend(IPCEvents.IPCEvents.APP_ASYNC_INDEX_TSX_LOADED);
2026-07-20 16:05:17 +00:00
};
obj2.setUseRequireModuleCache = function setUseRequireModuleCache(arg0) {
global = arg0;
2026-07-20 16:05:17 +00:00
};
obj2.GetSystemGpuStats = function GetSystemGpuStats(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-23 10:11:24 +00:00
const self = this;
return (async (arg0, value) => {
2026-07-29 08:29:29 +00:00
if (c3 === 2) {
c3 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
2026-07-29 08:29:29 +00:00
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
obj2 = { value, done: true };
return obj2;
2026-07-20 16:05:17 +00:00
} else {
2026-09-01 10:26:29 +00:00
return { value: "HermesInternal", done: null };
2026-07-20 16:05:17 +00:00
}
} else {
2026-07-29 08:29:29 +00:00
try {
c3 = 2;
if (0 === c2) {
2026-07-29 08:29:29 +00:00
if (arg0 === 1) {
c3 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c3 = 3;
const obj3 = { value, done: true };
return obj3;
2026-07-29 08:29:29 +00:00
} else {
2026-08-24 06:08:38 +00:00
closure_1 = tmp5;
closure_128_0 = undefined;
if (tmp2(c2[5]).isPlatformEmbedded) {
c2 = 1;
2026-07-29 08:29:29 +00:00
c3 = 1;
const obj4 = { value: self.ensureModule("discord_media"), done: false };
return obj4;
2026-07-29 08:29:29 +00:00
} else {
c3 = 3;
const obj5 = { value: [], done: true };
return obj5;
2026-07-29 08:29:29 +00:00
}
}
} else if (arg0 === 1) {
c3 = 3;
throw value;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 2) {
c3 = 3;
const obj = { value, done: true };
2026-07-29 08:29:29 +00:00
return obj;
} else {
closure_128_0 = closure_129_1.requireModule("discord_media");
2026-07-29 08:29:29 +00:00
let getGpuStats;
if (closure_128_0 != null) {
getGpuStats = closure_128_0.getGpuStats;
2026-07-29 08:29:29 +00:00
}
if (null == getGpuStats) {
const items = [];
} else {
const gpuStats = closure_128_0.getGpuStats(closure_129_0);
2026-07-29 08:29:29 +00:00
gpuStats.catch(() => []);
}
c3 = 3;
}
} catch (tmp13) {
c3 = tmp;
throw tmp13;
}
2026-07-20 16:05:17 +00:00
}
})();
};
const size = fn(2);
let result = size.fileFinishedImporting("utils/web/DesktopNativeUtils.tsx");
2026-07-20 16:05:17 +00:00
export default obj2;
export { SaveImageResult };
2026-07-20 16:05:17 +00:00
export { sanitizeFilename };
export { getFileData };
export { getImageData };
export const NativePermissionRequestType = { Camera: 0, [0]: "Camera", Microphone: 1, [1]: "Microphone", Photo: 2, [2]: "Photo", InputMonitoring: 3, [3]: "InputMonitoring", ScreenRecording: 4, [4]: "ScreenRecording" };