229 lines
11 KiB
TypeScript
229 lines
11 KiB
TypeScript
/* Metro module 11017; source: modules/autocompleter/native/AutocompleteUtils.tsx; dependencies: [31, 27, 1383, 1935, 3793, 1878, 661, 11018, 6625, 33, 4501, 697, 4805, 6526, 3995, 7331, 2] */
|
|
function _fun84394(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#84394, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11203:6, offset: 0x01f482fc, size: 479 bytes, params: 8, frame: 23
|
|
const env0_0 = require;
|
|
const closure = getMentionTextWithUser;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
importAll(31) /* metro dependency 31 */;
|
|
const StyleSheet = (require(27) /* metro dependency 27 */).StyleSheet;
|
|
const env0_3 = (require(1383) /* metro dependency 1383: ChannelRecord */).isGuildSelectableChannelType;
|
|
const guildChannelStore = importDefault(1935) /* metro dependency 1935: GuildChannelStore */;
|
|
const relationshipStore = importDefault(3793) /* metro dependency 3793: RelationshipStore */;
|
|
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
|
|
const env0_7 = (require(661) /* metro dependency 661: Constants */).AutoCompleteResultTypes;
|
|
let value = require(11018) /* metro dependency 11018: ApplicationCommandsConstants */;
|
|
const env0_8 = value.AUTOCOMPLETE_EMOJI_ROW_HEIGHT;
|
|
const env0_9 = value.AUTOCOMPLETE_ROW_HEIGHT;
|
|
value = require(6625) /* metro dependency 6625: ChannelAutocompleteConstants */;
|
|
const env0_10 = value.CHANNEL_SENTINEL;
|
|
const env0_11 = value.EMOJI_SENTINEL;
|
|
const env0_12 = value.MENTION_SENTINEL;
|
|
const env0_13 = (require(33) /* metro dependency 33 */).jsx;
|
|
const env0_14 = StyleSheet.hairlineWidth;
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = value.createStyles;
|
|
const BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE;
|
|
const env0_15 = Reflect.apply(createStyles, value, [{itemDivider: {marginLeft: 16,
|
|
backgroundColor: BORDER_SUBTLE}}]);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/autocompleter/native/AutocompleteUtils.tsx');
|
|
exports.getItemLayout = getItemLayout;
|
|
exports.getAutocompleteResultText = getAutocompleteResultText;
|
|
exports.getMentionTextWithUser = closure;
|
|
exports.getItemSeparator = getItemSeparator;
|
|
exports.getPrefix = function(a0) {
|
|
return a0[0];
|
|
};
|
|
exports.getQuery = function(a0) {
|
|
return a0.slice(1).toLowerCase();
|
|
};
|
|
}
|
|
|
|
function getMentionTextWithUser(a0, a1) { // fn#84395, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11203:504, offset: 0x01f484db, size: 136 bytes, params: 3, frame: 15
|
|
var r0;
|
|
var value;
|
|
if ((importDefault(6526) /* metro dependency 6526: AutocompleteUtils */).hasSameRoleAsUsername(a0, a1)) {
|
|
r0 = '' + MENTION_SENTINEL + a1.tag;
|
|
} else {
|
|
value = importDefault(3995) /* metro dependency 3995: UserUtils */;
|
|
value = value.getUserTag(a1);
|
|
value = '' + MENTION_SENTINEL + value;
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function AutocompleteFormDivider() { // fn#84396, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11203:631, offset: 0x01f48563, size: 57 bytes, params: 1, frame: 15
|
|
const styles = useStyles();
|
|
return ((Component) => <Component style={styles.itemDivider} />)(importDefault(7331) /* metro dependency 7331: FormDivider */);
|
|
}
|
|
|
|
function getItemLayout(a0, a1) { // fn#84397, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11203:818, offset: 0x01f4859c, size: 123 bytes, params: 3, frame: 16
|
|
const type = a0 == null || a0[a1] == null ? undefined : a0[a1].type;
|
|
const EMOJI = AutoCompleteResultTypes.EMOJI;
|
|
const r3 = type === EMOJI ? AUTOCOMPLETE_EMOJI_ROW_HEIGHT : AUTOCOMPLETE_ROW_HEIGHT;
|
|
const value2 = a1 * r3;
|
|
const Math = global.Math;
|
|
return {length: r3, offset: value2 + Math.max(0, (a1 - 1) * hairlineWidth), index: a1};
|
|
}
|
|
|
|
function getAutocompleteResultText(a0, a1, a2) { // fn#84398, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11203:973, offset: 0x01f48617, size: 728 bytes, params: 4, frame: 21
|
|
var name;
|
|
var r5;
|
|
var type;
|
|
var channel;
|
|
var guildId;
|
|
var isGuildSelectableChannelTypeBinding;
|
|
var moduleValue;
|
|
var computeChannelName;
|
|
var moduleValue2;
|
|
var moduleValue3;
|
|
var escapeChannelName;
|
|
var moduleValue4;
|
|
if (a2 == null) {
|
|
type = a0.type;
|
|
if (AutoCompleteResultTypes.USER === type) {
|
|
return getMentionTextWithUser(a1, a0.user);
|
|
}
|
|
if (AutoCompleteResultTypes.GLOBAL === type) {
|
|
return a0.text;
|
|
}
|
|
if (AutoCompleteResultTypes.ROLE === type) {
|
|
return '' + MENTION_SENTINEL + a0.name;
|
|
}
|
|
if (AutoCompleteResultTypes.CHANNEL === type) {
|
|
channel = a0.channel;
|
|
if (channel.isThread()) {
|
|
moduleValue3 = require(4805) /* metro dependency 4805: useChannelName */;
|
|
escapeChannelName = moduleValue3.escapeChannelName;
|
|
moduleValue4 = require(4805) /* metro dependency 4805: useChannelName */;
|
|
return '#"' + Reflect.apply(escapeChannelName, moduleValue3,
|
|
[moduleValue4.computeChannelName(a0.channel,
|
|
UserStore,
|
|
RelationshipStore)]) + '"';
|
|
}
|
|
channel = a0.channel;
|
|
guildId = channel.getGuildId();
|
|
if (guildId == null) {
|
|
moduleValue = require(4805) /* metro dependency 4805: useChannelName */;
|
|
return '' + CHANNEL_SENTINEL + moduleValue.computeChannelName(a0.channel, UserStore, RelationshipStore);
|
|
}
|
|
isGuildSelectableChannelTypeBinding = isGuildSelectableChannelType;
|
|
channel = a0.channel;
|
|
if (isGuildSelectableChannelTypeBinding(channel.type)) {
|
|
name = GuildChannelStore.getTextChannelNameDisambiguations(guildId)[a0.channel.id]?.name;
|
|
if (name != null) {
|
|
r5 = name;
|
|
} else {
|
|
moduleValue2 = require(4805) /* metro dependency 4805: useChannelName */;
|
|
r5 = moduleValue2.computeChannelName(a0.channel, UserStore, RelationshipStore);
|
|
}
|
|
return '' + CHANNEL_SENTINEL + r5;
|
|
}
|
|
moduleValue = require(4805) /* metro dependency 4805: useChannelName */;
|
|
computeChannelName = moduleValue.computeChannelName;
|
|
channel = a0.channel;
|
|
return '' + CHANNEL_SENTINEL + Reflect.apply(computeChannelName, moduleValue, [channel, UserStore,
|
|
RelationshipStore]);
|
|
}
|
|
if (AutoCompleteResultTypes.EMOJI === type) {
|
|
return '' + EMOJI_SENTINEL + a0.name + ':';
|
|
}
|
|
if (AutoCompleteResultTypes.EMOJI_PREMIUM_UPSELL === type) {
|
|
return '';
|
|
}
|
|
if (AutoCompleteResultTypes.SLASH === type) {
|
|
return '';
|
|
}
|
|
if (AutoCompleteResultTypes.CHOICE === type) {
|
|
return '' + a0.choice.displayName;
|
|
}
|
|
if (AutoCompleteResultTypes.STICKER === type) {
|
|
return '';
|
|
}
|
|
if (AutoCompleteResultTypes.CHOICE_LOADING === type) {
|
|
return '';
|
|
}
|
|
if (AutoCompleteResultTypes.LABEL === type) {
|
|
return '';
|
|
}
|
|
return undefined;
|
|
}
|
|
const has = a2.has;
|
|
type = a0.type;
|
|
if (Reflect.apply(has, a2, [type])) {
|
|
type = a0.type;
|
|
if (AutoCompleteResultTypes.USER === type) {
|
|
return getMentionTextWithUser(a1, a0.user);
|
|
}
|
|
if (AutoCompleteResultTypes.GLOBAL === type) {
|
|
return a0.text;
|
|
}
|
|
if (AutoCompleteResultTypes.ROLE === type) {
|
|
return '' + MENTION_SENTINEL + a0.name;
|
|
}
|
|
if (AutoCompleteResultTypes.CHANNEL === type) {
|
|
channel = a0.channel;
|
|
if (channel.isThread()) {
|
|
moduleValue3 = require(4805) /* metro dependency 4805: useChannelName */;
|
|
escapeChannelName = moduleValue3.escapeChannelName;
|
|
moduleValue4 = require(4805) /* metro dependency 4805: useChannelName */;
|
|
return '#"' + Reflect.apply(escapeChannelName, moduleValue3,
|
|
[moduleValue4.computeChannelName(a0.channel,
|
|
UserStore,
|
|
RelationshipStore)]) + '"';
|
|
}
|
|
channel = a0.channel;
|
|
guildId = channel.getGuildId();
|
|
if (guildId == null) {
|
|
moduleValue = require(4805) /* metro dependency 4805: useChannelName */;
|
|
return '' + CHANNEL_SENTINEL + moduleValue.computeChannelName(a0.channel, UserStore, RelationshipStore);
|
|
}
|
|
isGuildSelectableChannelTypeBinding = isGuildSelectableChannelType;
|
|
channel = a0.channel;
|
|
if (isGuildSelectableChannelTypeBinding(channel.type)) {
|
|
name = GuildChannelStore.getTextChannelNameDisambiguations(guildId)[a0.channel.id]?.name;
|
|
if (name != null) {
|
|
r5 = name;
|
|
} else {
|
|
moduleValue2 = require(4805) /* metro dependency 4805: useChannelName */;
|
|
r5 = moduleValue2.computeChannelName(a0.channel, UserStore, RelationshipStore);
|
|
}
|
|
return '' + CHANNEL_SENTINEL + r5;
|
|
}
|
|
moduleValue = require(4805) /* metro dependency 4805: useChannelName */;
|
|
computeChannelName = moduleValue.computeChannelName;
|
|
channel = a0.channel;
|
|
return '' + CHANNEL_SENTINEL + Reflect.apply(computeChannelName, moduleValue, [channel, UserStore,
|
|
RelationshipStore]);
|
|
}
|
|
if (AutoCompleteResultTypes.EMOJI === type) {
|
|
return '' + EMOJI_SENTINEL + a0.name + ':';
|
|
}
|
|
if (AutoCompleteResultTypes.EMOJI_PREMIUM_UPSELL === type) {
|
|
return '';
|
|
}
|
|
if (AutoCompleteResultTypes.SLASH === type) {
|
|
return '';
|
|
}
|
|
if (AutoCompleteResultTypes.CHOICE === type) {
|
|
return '' + a0.choice.displayName;
|
|
}
|
|
if (AutoCompleteResultTypes.STICKER === type) {
|
|
return '';
|
|
}
|
|
if (AutoCompleteResultTypes.CHOICE_LOADING === type) {
|
|
return '';
|
|
}
|
|
if (AutoCompleteResultTypes.LABEL === type) {
|
|
return '';
|
|
}
|
|
return undefined;
|
|
}
|
|
return '';
|
|
}
|
|
|
|
function getItemSeparator() { // fn#84399, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11203:1839, offset: 0x01f488ef, size: 23 bytes, params: 1, frame: 13
|
|
return <AutocompleteFormDivider />;
|
|
}
|
|
|