decord/source/modules/markup/PlatformMarkupRules.native.tsx

422 lines
12 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 6869
// Function ID: 6870
2026-07-29 08:29:29 +00:00
// Name: match
2026-08-24 06:08:38 +00:00
// Dependencies: [17, 6870, 4037, 4095, 6852, 1435, 6853, 6936, 4511, 1236, 6856, 2]
2026-07-29 08:29:29 +00:00
// Exports: decorateWithIcon
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
// Module 6869 (match)
import set from "set" /* 2 */;
import get_ActivityIndicator from "get ActivityIndicator" /* 17 */;
import getAvatarURLDefault from "getAvatarURL" /* 1435 */;
import parseRawEmojiObjectDefault from "parseRawEmojiObject" /* 4037 */;
import tDefault from "t" /* 4095 */;
import getGameMediaRefURLDefault from "getGameMediaRefURL" /* 4511 */;
import textRegexpDefault from "textRegexp" /* 6852 */;
import getChannelDefault from "getChannel" /* 6853 */;
import regExpDefault from "regExp" /* 6856 */;
import getGameMentionData from "getGameMentionData" /* 6936 */;
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
const Image = get_ActivityIndicator.Image;
2026-07-23 10:11:24 +00:00
const re4 = /^[\u200B-\u200D\uFEFF\u180E\u061C]/;
2026-08-05 07:35:12 +00:00
obj = { escape: obj, invisibleUnicode: null, text: null, emoji: null, customEmoji: null, channelMention: null, gameMention: null, channelOrMessageUrl: null, mediaPostLink: null, attachmentLink: null, silentPrefix: null };
2026-07-20 16:05:17 +00:00
obj = {
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["\\"],
2026-07-20 16:05:17 +00:00
match(arg0, allowEscape) {
if (false === allowEscape.allowEscape) {
return null;
} else {
const match = /^\\([^0-9A-Za-z\s])/.exec(arg0);
if (null == match) {
let tmp3 = match;
} else {
tmp3 = null;
if (!obj.hasSurrogates(match[0])) {
const _JSON = JSON;
const json = JSON.stringify(match[0]);
tmp3 = null;
}
2026-08-24 06:08:38 +00:00
obj = parseRawEmojiObjectDefault;
2026-07-20 16:05:17 +00:00
}
return tmp3;
}
}
};
obj = {};
2026-08-24 06:08:38 +00:00
let merged = Object.assign(tDefault.defaultRules.escape);
2026-07-29 08:29:29 +00:00
obj.requiredFirstCharacters = undefined;
obj.match = function match(arg0) {
2026-07-20 16:05:17 +00:00
return regex.exec(arg0);
};
2026-07-29 08:29:29 +00:00
obj.parse = function parse() {
2026-07-23 10:11:24 +00:00
return { type: "text", content: "" };
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
obj[1] = obj;
obj[2] = {
2026-07-20 16:05:17 +00:00
parse(arg0, arg1, nested) {
if (nested.nested) {
2026-07-29 08:29:29 +00:00
let obj = { content: null };
obj[0] = arg0[0];
2026-07-20 16:05:17 +00:00
return obj;
} else {
2026-08-24 06:08:38 +00:00
obj = parseRawEmojiObjectDefault;
2026-07-20 16:05:17 +00:00
const result = obj.maybeTranslateSurrogatesToInlineEmoji(arg0[0]);
if (null == result) {
2026-07-29 08:29:29 +00:00
obj = { content: null };
obj[0] = arg0[0];
2026-07-20 16:05:17 +00:00
let tmp9 = obj;
} else {
2026-08-24 06:08:38 +00:00
obj1 = {};
2026-07-20 16:05:17 +00:00
const merged = Object.assign(nested);
2026-07-29 08:29:29 +00:00
obj1.nested = true;
2026-07-20 16:05:17 +00:00
tmp9 = arg1(result, obj1);
}
return tmp9;
}
}
};
2026-07-29 08:29:29 +00:00
obj[3] = {
2026-07-20 16:05:17 +00:00
parse(content) {
2026-08-24 06:08:38 +00:00
let obj = parseRawEmojiObjectDefault;
2026-07-20 16:05:17 +00:00
obj = { type: "emoji", content: content[0], surrogate: obj.convertNameToSurrogate(content[1]) };
return obj;
}
};
2026-07-29 08:29:29 +00:00
obj[4] = {
2026-08-24 06:08:38 +00:00
order: textRegexpDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return /^<(a)?:(\w+):(\d+)>/.exec(arg0);
},
parse(arg0, arg1, disableAnimatedEmoji) {
[, tmp, tmp2, tmp3] = arg0;
let flag = disableAnimatedEmoji.disableAnimatedEmoji;
if (flag === undefined) {
flag = false;
}
2026-08-24 06:08:38 +00:00
let obj = getAvatarURLDefault;
2026-07-20 16:05:17 +00:00
obj = { id: tmp3, animated: "a" === tmp, size: 48 };
let emojiURL = obj.getEmojiURL(obj);
2026-08-24 06:08:38 +00:00
const emojiURL1 = getAvatarURLDefault.getEmojiURL({ id: tmp3, animated: false, size: 48 });
2026-07-29 08:29:29 +00:00
obj = { id: tmp3, alt: tmp2, src: null, frozenSrc: null };
2026-07-20 16:05:17 +00:00
if (flag) {
emojiURL = emojiURL1;
}
2026-07-29 08:29:29 +00:00
obj[2] = emojiURL;
obj[3] = emojiURL1;
return obj;
2026-07-20 16:05:17 +00:00
}
};
2026-07-29 08:29:29 +00:00
obj[5] = {
2026-07-20 16:05:17 +00:00
parse(arg0, arg1, arg2) {
2026-08-24 06:08:38 +00:00
const channelMention = getChannelDefault.channelMention;
2026-07-20 16:05:17 +00:00
const parsed = channelMention.parse(arg0, arg1, arg2);
const obj = {};
const merged = Object.assign(parsed);
2026-07-29 08:29:29 +00:00
const content = parsed.content;
let mapped = content;
if (null != content) {
mapped = content;
2026-08-04 21:03:28 +00:00
if (typeof content !== "string") {
2026-07-29 08:29:29 +00:00
const _Array = Array;
let arr2 = content;
if (!(content instanceof Array)) {
const items = [content];
arr2 = items;
}
mapped = arr2.map((type) => {
let tmp = type;
if ("channel" === type.type) {
const obj = {};
const merged = Object.assign(type);
const assetSource = closure_3.resolveAssetSource(callback(table[1]).getChannelMentionIcon(type.iconType));
let uri;
if (assetSource != null) {
uri = assetSource.uri;
}
obj.icon = uri;
tmp = obj;
const obj2 = callback(table[1]);
}
return tmp;
});
}
}
obj.content = mapped;
const inContent = parsed.inContent;
let mapped1 = inContent;
if (null != inContent) {
mapped1 = inContent;
2026-08-04 21:03:28 +00:00
if (typeof inContent !== "string") {
2026-07-29 08:29:29 +00:00
const _Array2 = Array;
let arr4 = inContent;
if (!(inContent instanceof Array)) {
const items1 = [inContent];
arr4 = items1;
}
mapped1 = arr4.map((type) => {
let tmp = type;
if ("channel" === type.type) {
const obj = {};
const merged = Object.assign(type);
const assetSource = closure_3.resolveAssetSource(callback(table[1]).getChannelMentionIcon(type.iconType));
let uri;
if (assetSource != null) {
uri = assetSource.uri;
}
obj.icon = uri;
tmp = obj;
const obj2 = callback(table[1]);
}
return tmp;
});
}
}
obj.inContent = mapped1;
2026-07-20 16:05:17 +00:00
return obj;
}
};
2026-07-29 08:29:29 +00:00
obj[6] = {
2026-08-06 08:05:19 +00:00
parse(closure_0, arg1, channelId) {
2026-08-24 06:08:38 +00:00
let obj = getGameMentionData;
2026-08-06 08:05:19 +00:00
const gameMentionData = obj.getGameMentionData(tmp);
let gameIcon;
if (gameMentionData != null) {
gameIcon = gameMentionData.gameIcon;
}
2026-08-24 06:08:38 +00:00
obj = { type: "gameMention", gameId: tmp, channelId: channelId.channelId, icon: getGameMediaRefURLDefault(tmp, gameIcon, { size: 32 }), displayName: null };
2026-08-06 08:05:19 +00:00
let gameName;
if (gameMentionData != null) {
gameName = gameMentionData.gameName;
2026-08-05 07:35:12 +00:00
}
2026-08-06 08:05:19 +00:00
if (gameName == null) {
const intl = tmp2(1236).intl;
gameName = intl.string(tmp2(1236).t["11pdXZ"]);
}
obj[4] = gameName;
return obj;
2026-08-05 07:35:12 +00:00
}
};
obj[7] = {
2026-07-20 16:05:17 +00:00
parse(arg0, arg1, arg2) {
2026-08-24 06:08:38 +00:00
const channelOrMessageUrl = getChannelDefault.channelOrMessageUrl;
2026-07-20 16:05:17 +00:00
const parsed = channelOrMessageUrl.parse(arg0, arg1, arg2);
const obj = {};
const merged = Object.assign(parsed);
2026-07-29 08:29:29 +00:00
const content = parsed.content;
let mapped = content;
if (null != content) {
mapped = content;
2026-08-04 21:03:28 +00:00
if (typeof content !== "string") {
2026-07-29 08:29:29 +00:00
const _Array = Array;
let arr2 = content;
if (!(content instanceof Array)) {
const items = [content];
arr2 = items;
}
mapped = arr2.map((type) => {
let tmp = type;
if ("channel" === type.type) {
const obj = {};
const merged = Object.assign(type);
const assetSource = closure_3.resolveAssetSource(callback(table[1]).getChannelMentionIcon(type.iconType));
let uri;
if (assetSource != null) {
uri = assetSource.uri;
}
obj.icon = uri;
tmp = obj;
const obj2 = callback(table[1]);
}
return tmp;
});
}
}
obj.content = mapped;
const inContent = parsed.inContent;
let mapped1 = inContent;
if (null != inContent) {
mapped1 = inContent;
2026-08-04 21:03:28 +00:00
if (typeof inContent !== "string") {
2026-07-29 08:29:29 +00:00
const _Array2 = Array;
let arr4 = inContent;
if (!(inContent instanceof Array)) {
const items1 = [inContent];
arr4 = items1;
}
mapped1 = arr4.map((type) => {
let tmp = type;
if ("channel" === type.type) {
const obj = {};
const merged = Object.assign(type);
const assetSource = closure_3.resolveAssetSource(callback(table[1]).getChannelMentionIcon(type.iconType));
let uri;
if (assetSource != null) {
uri = assetSource.uri;
}
obj.icon = uri;
tmp = obj;
const obj2 = callback(table[1]);
}
return tmp;
});
}
}
obj.inContent = mapped1;
2026-07-20 16:05:17 +00:00
return obj;
}
};
2026-08-05 07:35:12 +00:00
obj[8] = {
2026-07-20 16:05:17 +00:00
parse(arg0, arg1, arg2) {
2026-08-24 06:08:38 +00:00
const mediaPostLink = getChannelDefault.mediaPostLink;
2026-07-20 16:05:17 +00:00
const parsed = mediaPostLink.parse(arg0, arg1, arg2);
2026-07-29 08:29:29 +00:00
let obj = {};
let merged = Object.assign(parsed);
const content = parsed.content;
let mapped = content;
if (null != content) {
mapped = content;
2026-08-04 21:03:28 +00:00
if (typeof content !== "string") {
2026-07-29 08:29:29 +00:00
const _Array = Array;
let arr2 = content;
if (!(content instanceof Array)) {
const items = [content];
arr2 = items;
}
mapped = arr2.map((type) => {
let tmp = type;
if ("channel" === type.type) {
const obj = {};
const merged = Object.assign(type);
const assetSource = closure_3.resolveAssetSource(callback(table[1]).getChannelMentionIcon(type.iconType));
let uri;
if (assetSource != null) {
uri = assetSource.uri;
}
obj.icon = uri;
tmp = obj;
const obj2 = callback(table[1]);
}
return tmp;
});
}
}
obj.content = mapped;
const inContent = parsed.inContent;
let mapped1 = inContent;
if (null != inContent) {
mapped1 = inContent;
2026-08-04 21:03:28 +00:00
if (typeof inContent !== "string") {
2026-07-29 08:29:29 +00:00
const _Array2 = Array;
let arr4 = inContent;
if (!(inContent instanceof Array)) {
const items1 = [inContent];
arr4 = items1;
}
mapped1 = arr4.map((type) => {
let tmp = type;
if ("channel" === type.type) {
const obj = {};
const merged = Object.assign(type);
const assetSource = closure_3.resolveAssetSource(callback(table[1]).getChannelMentionIcon(type.iconType));
let uri;
if (assetSource != null) {
uri = assetSource.uri;
}
obj.icon = uri;
tmp = obj;
const obj2 = callback(table[1]);
}
return tmp;
});
}
}
obj.inContent = mapped1;
2026-07-20 16:05:17 +00:00
return obj;
}
};
2026-08-05 07:35:12 +00:00
obj[9] = {
2026-07-20 16:05:17 +00:00
parse(arg0, arg1, arg2) {
2026-08-24 06:08:38 +00:00
const attachmentLink = regExpDefault.attachmentLink;
2026-07-20 16:05:17 +00:00
return attachmentLink.parse(arg0, arg1, arg2);
}
};
2026-07-23 10:11:24 +00:00
let obj1 = {
2026-08-24 06:08:38 +00:00
order: textRegexpDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["<"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return /^<(a)?:(\w+):(\d+)>/.exec(arg0);
},
parse(arg0, arg1, disableAnimatedEmoji) {
[, tmp, tmp2, tmp3] = arg0;
let flag = disableAnimatedEmoji.disableAnimatedEmoji;
if (flag === undefined) {
flag = false;
}
2026-08-24 06:08:38 +00:00
let obj = getAvatarURLDefault;
2026-07-20 16:05:17 +00:00
obj = { id: tmp3, animated: "a" === tmp, size: 48 };
let emojiURL = obj.getEmojiURL(obj);
2026-08-24 06:08:38 +00:00
const emojiURL1 = getAvatarURLDefault.getEmojiURL({ id: tmp3, animated: false, size: 48 });
2026-07-29 08:29:29 +00:00
obj = { id: tmp3, alt: tmp2, src: null, frozenSrc: null };
2026-07-20 16:05:17 +00:00
if (flag) {
emojiURL = emojiURL1;
}
2026-07-29 08:29:29 +00:00
obj[2] = emojiURL;
obj[3] = emojiURL1;
return obj;
2026-07-20 16:05:17 +00:00
}
};
2026-08-05 07:35:12 +00:00
obj[10] = {
2026-08-24 06:08:38 +00:00
order: textRegexpDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["@"],
match(arg0) {
return /^(@silent(?![^\s]))/.exec(arg0);
},
parse(content) {
return { type: "text", content: content[0] };
}
};
let obj2 = {
2026-08-24 06:08:38 +00:00
order: textRegexpDefault.order,
2026-07-23 10:11:24 +00:00
requiredFirstCharacters: ["@"],
2026-07-20 16:05:17 +00:00
match(arg0) {
return /^(@silent(?![^\s]))/.exec(arg0);
},
parse(content) {
return { type: "text", content: content[0] };
}
};
2026-08-24 06:08:38 +00:00
let result = set.fileFinishedImporting("modules/markup/PlatformMarkupRules.native.tsx");
2026-07-20 16:05:17 +00:00
export default obj;
2026-08-04 21:03:28 +00:00
export const decorateWithIcon = function decorateWithIcon(str) {
let mapped = str;
if (null != str) {
mapped = str;
if (typeof str !== "string") {
2026-07-29 08:29:29 +00:00
const _Array = Array;
2026-08-04 21:03:28 +00:00
let arr2 = str;
if (!(str instanceof Array)) {
const items = [str];
2026-07-29 08:29:29 +00:00
arr2 = items;
}
mapped = arr2.map((type) => {
let tmp = type;
if ("channel" === type.type) {
const obj = {};
const merged = Object.assign(type);
const assetSource = closure_3.resolveAssetSource(callback(table[1]).getChannelMentionIcon(type.iconType));
let uri;
if (assetSource != null) {
uri = assetSource.uri;
}
obj.icon = uri;
tmp = obj;
const obj2 = callback(table[1]);
}
return tmp;
});
}
}
return mapped;
};