Files
discord-decomp/sources/utils/EmojiUtilsPlatformed.native.tsx
2026-07-28 01:06:53 +03:00

200 lines
11 KiB
TypeScript

/* Metro module 7171; source: utils/EmojiUtilsPlatformed.native.tsx; dependencies: [57, 5, 27, 3798, 4092, 477, 22, 1423, 7172, 1475, 4000, 7211, 7216, 2] */
import Module00005 from '../by-id/module-00005.js'; /* Metro dependency 5 */
import Module00057 from '../by-id/module-00057.js'; /* Metro dependency 57 */
import TwemojiNpm from '../external/node_modules/.pnpm/@[email protected]/node_modules/@discordapp/twemoji/dist/twemoji.npm.js'; /* Metro dependency 3798 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as PlatformUtilsModule from './PlatformUtils.tsx'; /* Metro dependency 477 */
import * as BurstReactionFirstSendActionSheetModule from '../components_native/reactions/BurstReactionFirstSendActionSheet.tsx'; /* Metro dependency 7211 */
function _fun57583(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57583, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7349:6, offset: 0x013e9948, size: 263 bytes, params: 8, frame: 20
const env0_0 = require;
const getURL2 = getURL;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactNativeModule;
const env0_5 = value.NativeModules;
const env0_6 = value.processColor;
object = {};
object.getURL = (importDefault(7216) /* metro dependency 7216: MemoizerUtils */).makeMemoizer(getURL2);
object.filterUnsupportedEmojis = function(a0) {
var r0;
var value = a0;
if (require(dependencyMap[5]).isAndroid()) {
r0 = value;
} else {
value = importDefault(dependencyMap[6]).filter(value, _fun57590);
r0 = value;
}
return r0;
};
object.applyPlatformToThemedEmojiColorPalette = applyPlatformToThemedEmojiColorPalette;
object.getEmojiColors = function() {
return _getEmojiColors_57585.apply(this, arguments);
};
object.triggerFullscreenAnimation = triggerFullscreenAnimation;
(FileImportTrackerModule).fileFinishedImporting('utils/EmojiUtilsPlatformed.native.tsx');
exports.default = object;
function getURL(a0) { // fn#57584, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7349:171, offset: 0x013e9a4f, size: 108 bytes, params: 2, frame: 14
var r0;
var value;
if (a0 == null) {
value = TwemojiNpm.convert.toCodePoint(a0);
value = 'asset:/emoji-' + value + '.png';
r0 = value;
} else {
value = require(477) /* metro dependency 477: PlatformUtils */;
value = value.isAndroid();
if (value) {
value = TwemojiNpm.convert.toCodePoint(a0);
value = 'asset:/emoji-' + value + '.png';
r0 = value;
} else {
r0 = '';
}
}
return r0;
}
function _getEmojiColors_57585() { // fn#57585, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7349:277, offset: 0x013e9abb, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun57587).apply(this, arguments);
function* _fun57587(a0) { // fn#57587, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7349:330, offset: 0x013e9af4, size: 285 bytes, params: 2, frame: 18
var environment;
var r6;
var binding;
var value4;
let value = undefined;
if (false) {
return value;
}
const id = a0.id;
let name = a0.name;
if (id != null) {
value = environment.__proto__.__proto__;
value = env2_1(env2_2[7]);
value = value.getEmojiURL({'id': null, 'size': 32, 'animated': false, id: id});
r6 = value;
} else {
value = environment.__proto__.__proto__;
value = env2_8(name);
r6 = value;
}
if (r6 !== '') {
value = environment.__proto__.__proto__;
binding = env2_0;
value = undefined;
value4 = binding(env2_2[9]);
yield value4.getPaletteForAvatar(r6);
} else {
value = environment.__proto__.__proto__;
var ImageManager = env2_5.ImageManager;
var getEmojiBase64 = ImageManager.getEmojiBase64;
name = a0.name;
var EMOJI_IN_ANIMATION_SIZE = env2_0(env2_2[8]).EMOJI_IN_ANIMATION_SIZE;
yield Reflect.apply(getEmojiBase64, ImageManager, [name, EMOJI_IN_ANIMATION_SIZE]);
if (false) {
return undefined;
}
value = 'data:image/png;base64,' + value;
r6 = value;
value = environment.__proto__.__proto__;
binding = env2_0;
value = undefined;
value4 = binding(env2_2[9]);
yield value4.getPaletteForAvatar(r6);
}
const value5 = undefined;
if (false) {
return value5;
}
return value5 == null ? value : value5.map(_fun57588);
function _fun57588(a0) { // fn#57588, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7349:620, offset: 0x013e9c11, size: 76 bytes, params: 2, frame: 17
const value = environment.__proto__.__proto__.__proto__;
const value2 = env3_3(a0, 3);
return env3_0(env3_2[10]).rgbToHex(value2[0], value2[1], value2[2]);
}
}
}
function filterUnsupportedEmojis(a0) { // fn#57589, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7349:787, offset: 0x013e9c5d, size: 84 bytes, params: 2, frame: 15
var r0;
let value = a0;
if (PlatformUtilsModule.isAndroid()) {
r0 = value;
} else {
value = (importDefault(22) /* metro dependency 22 */).filter(value, _fun57590);
r0 = value;
}
return r0;
function _fun57590({unicodeVersion}) { // fn#57590, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7349:870, offset: 0x013e9cb1, size: 530 bytes, params: 2, frame: 15
let value = environment.__proto__;
value = require(4092) /* metro dependency 4092: DeviceUtils */;
value = value.getSystemVersionMajor();
const systemVersionMinor = (require(4092) /* metro dependency 4092: DeviceUtils */).getSystemVersionMinor();
return !(unicodeVersion > 8) || (unicodeVersion === 9 ? value > 10 || value === 10 && systemVersionMinor >= 2 : unicodeVersion === 10 ? value > 11 || value === 11 && systemVersionMinor >= 1 : unicodeVersion === 11 ? value > 12 || value === 12 && systemVersionMinor >= 1 : unicodeVersion === 12 || unicodeVersion === 12.1 ? value > 13 || value === 13 && systemVersionMinor >= 2 : unicodeVersion === 13 ? value > 14 || value === 14 && systemVersionMinor >= 2 : unicodeVersion === 13.1 ? value > 14 || value === 14 && systemVersionMinor >= 5 : unicodeVersion === 14 ? value > 15 || value === 15 && systemVersionMinor >= 4 : unicodeVersion === 15 ? value > 16 || value === 16 && systemVersionMinor >= 4 : unicodeVersion === 15.1 ? value > 17 || value === 17 && systemVersionMinor >= 4 : !(unicodeVersion !== 16) && (value > 18 || value === 18 && systemVersionMinor >= 4));
}
}
function applyPlatformToThemedEmojiColorPalette({palette, shouldProcessMobileColors}) { // fn#57591, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7349:1452, offset: 0x013e9ec3, size: 275 bytes, params: 2, frame: 19
var accentColor;
var backgroundColor;
var highlightColor;
var opacity;
var LIGHT;
var DARK;
var object;
var object2;
var processColorBinding;
var object3;
shouldProcessMobileColors = !(shouldProcessMobileColors === undefined) && shouldProcessMobileColors;
if (shouldProcessMobileColors) {
if (palette == null) {
return palette;
}
LIGHT = palette.LIGHT;
DARK = palette.DARK;
object = {};
object2 = {};
processColorBinding = processColor;
accentColor = LIGHT?.accentColor;
object2.accentColor = processColorBinding(accentColor);
processColorBinding = processColor;
backgroundColor = LIGHT?.backgroundColor;
object2.backgroundColor = processColorBinding(backgroundColor);
processColorBinding = processColor;
highlightColor = LIGHT?.highlightColor;
object2.highlightColor = processColorBinding(highlightColor);
opacity = LIGHT?.opacity;
object2.opacity = opacity;
object.LIGHT = object2;
object3 = {};
processColorBinding = processColor;
accentColor = DARK?.accentColor;
object3.accentColor = processColorBinding(accentColor);
processColorBinding = processColor;
backgroundColor = DARK?.backgroundColor;
object3.backgroundColor = processColorBinding(backgroundColor);
processColorBinding = processColor;
highlightColor = DARK?.highlightColor;
object3.highlightColor = processColorBinding(highlightColor);
opacity = DARK?.opacity;
object3.opacity = opacity;
object.DARK = object3;
return object;
}
return palette;
}
function triggerFullscreenAnimation({channelId, messageId, emoji}) { // fn#57593, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7349:2087, offset: 0x013e9fd6, size: 72 bytes, params: 2, frame: 15
BurstReactionFirstSendActionSheetModule.openBurstReactionFirstSendActionSheet({channelId: channelId,
messageId: messageId, emoji: emoji});
}
}
global.__d(_fun57583, 7171, [57, 5, 27, 3798, 4092, 477, 22, 1423, 7172, 1475, 4000, 7211, 7216,
2]) /* metro module 7171, dependencies: [57, 5, 27, 3798, 4092, 477, 22, 1423, 7172, 1475, 4000, 7211, 7216, 2] */;