Files
discord-decomp/sources/modules/markup/PlatformMarkupRules.native.tsx
2026-07-28 01:06:53 +03:00

276 lines
12 KiB
TypeScript

/* Metro module 6646; source: modules/markup/PlatformMarkupRules.native.tsx; dependencies: [27, 6647, 3797, 3855, 6629, 1423, 6631, 6634, 2] */
import AvatarUtils from '../../utils/AvatarUtils.tsx'; /* Metro dependency 1423 */
import UnicodeEmojis from '../emojis/UnicodeEmojis.tsx'; /* Metro dependency 3797 */
import Module03855 from '../../by-id/module-03855.js'; /* Metro dependency 3855 */
import MarkupChannelMentionRule from './MarkupChannelMentionRule.tsx'; /* Metro dependency 6631 */
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 */
function _fun52571(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#52571, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6824:6, offset: 0x01330e3b, size: 483 bytes, params: 8, frame: 20
const env0_0 = require;
const decorateWithIcon = function(a0) {
var r0;
var value = a0;
if (value == null) {
r0 = value;
} else if (typeof value === 'string') {
r0 = value;
} else {
value = (value instanceof global.Array ? value : [value]).map(_fun52573);
r0 = value;
}
return r0;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_4 = RegExp('^[\\u200B-\\u200D\\uFEFF\\u180E\\u061C]', '');
object = {};
object.escape = {requiredFirstCharacters: ['\\'], match: match_52574};
const object3 = {};
copyDataProperties(object3, (Module03855).defaultRules.escape, undefined);
object3['requiredFirstCharacters'] = undefined;
object3['match'] = match_52575;
object3['parse'] = function() {
return {'type': 'text', 'content': ''};
};
object.invisibleUnicode = object3;
object.text = {parse: parse_52577};
object.emoji = {parse: parse_52578};
const object6 = {};
object6.order = (importDefault(6629) /* metro dependency 6629: MarkupTextRule */).order;
object6.requiredFirstCharacters = ['<'];
object6.match = function(a0) {
return RegExp('^<(a)?:(\\w+):(\\d+)>', '').exec(a0);
};
object6.parse = parse_52580;
object.customEmoji = object6;
object.channelMention = {parse: parse_52581};
object.channelOrMessageUrl = {parse: parse_52582};
object.mediaPostLink = {parse: parse_52583};
object.attachmentLink = {parse: function(a0, a1, a2) {
return importDefault(dependencyMap[7]).attachmentLink.parse(a0, a1, a2);
}};
const object8 = {};
object8.order = (importDefault(6629) /* metro dependency 6629: MarkupTextRule */).order;
object8.requiredFirstCharacters = ['@'];
object8.match = function(a0) {
return RegExp('^(@silent(?![^\\s]))', '').exec(a0);
};
object8.parse = function(a0) {
return {type: 'text', content: a0[0]};
};
object.silentPrefix = object8;
(FileImportTrackerModule).fileFinishedImporting('modules/markup/PlatformMarkupRules.native.tsx');
exports.default = object;
function decorateWithIcon(a0) { // fn#52572, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6824:151, offset: 0x0133101e, size: 74 bytes, params: 2, frame: 12
var r0;
let value = a0;
if (value == null) {
r0 = value;
} else if (typeof value === 'string') {
r0 = value;
} else {
value = (value instanceof global.Array ? value : [value]).map(_fun52573);
r0 = value;
}
return r0;
function _fun52573(a0) { // fn#52573, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6824:249, offset: 0x01331068, size: 116 bytes, params: 2, frame: 17
var r0;
var object;
var value2;
var resolveAssetSource;
var value3;
var moduleValue;
let value = a0;
if (value.type !== 'channel') {
r0 = value;
} else {
object = {};
copyDataProperties(object, value, undefined);
value2 = environment.__proto__;
resolveAssetSource = Image.resolveAssetSource;
value3 = undefined;
moduleValue = require(6647) /* metro dependency 6647: ChannelUtils */;
value = Reflect.apply(resolveAssetSource, Image, [moduleValue.getChannelMentionIcon(value.iconType)]);
object['icon'] = value == null ? value3 : value.uri;
r0 = object;
}
return r0;
}
}
function match_52574(a0, {allowEscape}) { // fn#52574, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6824:434, offset: 0x013310dc, size: 152 bytes, params: 3, frame: 14
var r0;
var defaultImport;
var value4;
if (allowEscape === false) {
return null;
}
const value = RegExp('^\\\\([^0-9A-Za-z\\s])', '').exec(a0);
if (value == null) {
r0 = value;
} else {
defaultImport = importDefault(3797) /* metro dependency 3797: UnicodeEmojis */;
if (defaultImport.hasSurrogates(value[0])) {
r0 = null;
} else {
value4 = global.JSON.stringify(value[0]);
r0 = value4.includes('\\ud') ? null : value;
}
}
return r0;
}
function match_52575(a0) { // fn#52575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6824:695, offset: 0x01331174, size: 23 bytes, params: 2, frame: 11
return env0_4.exec(a0);
}
function parse_52577(a0, a1, a2) { // fn#52577, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6824:752, offset: 0x0133119b, size: 126 bytes, params: 4, frame: 16
var r0;
var object;
if (a2.nested) {
return {content: a0[0]};
}
var value;
const value2 = (UnicodeEmojis).maybeTranslateSurrogatesToInlineEmoji(a0[0]);
if (value2 == null) {
r0 = {content: a0[0]};
} else {
object = {};
copyDataProperties(object, a2, value);
object['nested'] = true;
value = a1(value2, object);
r0 = value;
}
return r0;
}
function parse_52578(a0) { // fn#52578, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6824:917, offset: 0x01331219, size: 73 bytes, params: 2, frame: 12
let value = UnicodeEmojis;
value = value.convertNameToSurrogate(a0[1]);
return {type: 'emoji', content: a0[0], surrogate: value};
}
function parse_52580(a0, a1, {disableAnimatedEmoji}) { // fn#52580, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6824:1119, offset: 0x01331280, size: 259 bytes, params: 4, frame: 20
var r0;
var r1;
var r11;
var r4;
var r5;
var item3;
var value3;
var item4;
var value4;
var item5;
var value5;
const iterator = a0[Symbol.iterator]();
const iterator2 = iterator.next;
let item2 = Reflect.apply(iterator2, iterator, []);
let item = item2.value;
item2 = item2.done ? undefined : iterator;
let value = undefined;
const value2 = item2 === value;
if (value2) {
r0 = item2;
r1 = value2;
r11 = value;
} else {
item3 = Reflect.apply(iterator2, item2, []);
item = item3.value;
item3 = item3.done ? undefined : item2;
value3 = item3 === value;
if (value3) {
r0 = item3;
r1 = value3;
r11 = value;
} else {
r0 = item3;
r1 = value3;
r11 = item;
}
}
if (r1) {
r4 = value;
} else {
item4 = Reflect.apply(iterator2, r0, []);
item = item4.value;
item4 = item4.done ? undefined : r0;
value4 = item4 === value;
if (value4) {
r0 = item4;
r1 = value4;
r4 = value;
} else {
r0 = item4;
r1 = value4;
r4 = item;
}
}
if (r1) {
r5 = value;
} else {
item5 = Reflect.apply(iterator2, r0, []);
item = item5.value;
item5 = item5.done ? undefined : r0;
value5 = item5 === value;
if (value5) {
r0 = item5;
r1 = value5;
r5 = value;
} else {
r0 = item5;
r1 = value5;
r5 = item;
}
}
if (!r1) {
r0.return();
}
disableAnimatedEmoji = !(disableAnimatedEmoji === value) && disableAnimatedEmoji;
const defaultImport = AvatarUtils;
let getEmojiURL = defaultImport.getEmojiURL;
const value8 = Reflect.apply(getEmojiURL, defaultImport, [{id: r5, animated: r11 === 'a', size: 48}]);
getEmojiURL = defaultImport.getEmojiURL;
value = Reflect.apply(getEmojiURL, value, [{'id': null, 'animated': false, 'size': 48, id: r5}]);
return {id: r5, alt: r4, src: disableAnimatedEmoji ? value : value8, frozenSrc: value};
}
function parse_52581(a0, a1, a2) { // fn#52581, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6824:1334, offset: 0x01331383, size: 110 bytes, params: 4, frame: 17
const value2 = (MarkupChannelMentionRule).channelMention.parse(a0,
a1, a2);
const object = {};
copyDataProperties(object, value2, undefined);
const decorateWithIconBinding = decorateWithIcon;
object['content'] = decorateWithIconBinding(value2.content);
object['inContent'] = decorateWithIconBinding(value2.inContent);
return object;
}
function parse_52582(a0, a1, a2) { // fn#52582, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6824:1501, offset: 0x013313f1, size: 110 bytes, params: 4, frame: 17
const value2 = (MarkupChannelMentionRule).channelOrMessageUrl.parse(a0,
a1, a2);
const object = {};
copyDataProperties(object, value2, undefined);
const decorateWithIconBinding = decorateWithIcon;
object['content'] = decorateWithIconBinding(value2.content);
object['inContent'] = decorateWithIconBinding(value2.inContent);
return object;
}
function parse_52583(a0, a1, a2) { // fn#52583, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6824:1667, offset: 0x0133145f, size: 110 bytes, params: 4, frame: 17
const value2 = (MarkupChannelMentionRule).mediaPostLink.parse(a0,
a1, a2);
const object = {};
copyDataProperties(object, value2, undefined);
const decorateWithIconBinding = decorateWithIcon;
object['content'] = decorateWithIconBinding(value2.content);
object['inContent'] = decorateWithIconBinding(value2.inContent);
return object;
}
}
global.__d(_fun52571, 6646, [27, 6647, 3797, 3855, 6629, 1423, 6631, 6634,
2]) /* metro module 6646, dependencies: [27, 6647, 3797, 3855, 6629, 1423, 6631, 6634, 2] */;