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

265 lines
16 KiB
TypeScript

/* Metro module 11855; source: modules/autocompleter/native/Autocomplete.tsx; dependencies: [31, 27, 1867, 3793, 1878, 661, 11018, 33, 4501, 697, 7972, 566, 3995, 1305, 9210, 6238, 6246, 1244, 8366, 6647, 4805, 4573, 5475, 11856, 11049, 5278, 10970, 22, 2] */
import Module00022 from '../../../by-id/module-00022.js'; /* Metro dependency 22 */
import GuildStore from '../../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import RelationshipStore from '../../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
import DiscordTag from '../../user_profile/native/DiscordTag.tsx'; /* Metro dependency 9210 */
import Sticker from '../../stickers/native/Sticker.tsx'; /* Metro dependency 10970 */
import ChannelAutocompleteEmojiUpsell from '../../channel_text_area/native/ChannelAutocompleteEmojiUpsell.tsx'; /* Metro dependency 11856 */
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 ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as NativeModule from '../../../design/void/native.tsx'; /* Metro dependency 1305 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as UseChannelNameModule from '../../channel/useChannelName.tsx'; /* Metro dependency 4805 */
import * as PressablesModule from '../../../design/void/Pressables/native/Pressables.tsx'; /* Metro dependency 5278 */
import * as TableRowNativeModule from '../../../design/components/TableRow/native/TableRow.native.tsx'; /* Metro dependency 6238 */
import * as TableRowTrailingTextNativeModule from '../../../design/components/TableRow/native/TableRowTrailingText.native.tsx'; /* Metro dependency 6246 */
import * as NativeModule2 from '../../../design/void/Form/native/index.tsx'; /* Metro dependency 7972 */
import * as ApplicationCommandsConstantsModule from '../../application_commands/native/ApplicationCommandsConstants.tsx'; /* Metro dependency 11018 */
import * as StickersHooksModule from '../../stickers/StickersHooks.tsx'; /* Metro dependency 11049 */
function _fun90879(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#90879, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12041:6, offset: 0x0204a4b2, size: 843 bytes, params: 8, frame: 25
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ConstantsModule;
const env0_8 = value.ChannelTypes;
const Fonts = value.Fonts;
const AUTOCOMPLETE_ROW_HEIGHT = (ApplicationCommandsConstantsModule).AUTOCOMPLETE_ROW_HEIGHT;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
const object2 = {height: AUTOCOMPLETE_ROW_HEIGHT, paddingVertical: 0};
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
object2.backgroundColor = BACKGROUND_SURFACE_HIGH;
object.row = object2;
const INTERACTIVE_TEXT_ACTIVE = (importDefault(697) /* metro dependency 697: native */).colors.INTERACTIVE_TEXT_ACTIVE;
const PRIMARY_SEMIBOLD = Fonts.PRIMARY_SEMIBOLD;
object.leading = {fontSize: 16, color: INTERACTIVE_TEXT_ACTIVE, fontFamily: PRIMARY_SEMIBOLD};
const TEXT_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_MUTED;
object.trailing = {fontSize: 14, color: TEXT_MUTED};
const PRIMARY_400 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.PRIMARY_400;
object.username = {color: PRIMARY_400};
object.emoji = {'width': 32, 'height': 32};
object.emojiImage = {resizeMode: 'contain'};
const TEXT_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_DEFAULT;
object.emojiText = {'lineHeight': 32, 'fontSize': 27, 'textAlign': 'center', color: TEXT_DEFAULT};
const object7 = {'width': 56, 'height': 56, 'marginHorizontal': 4, 'justifyContent': 'center',
'alignItems': 'center'};
const BACKGROUND_MOD_NORMAL = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_NORMAL;
object7.backgroundColor = BACKGROUND_MOD_NORMAL;
object7.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object.stickerContainer = object7;
object.commandChoiceLoadingContainer = {'flex': 1, 'justifyContent': 'center'};
const object8 = {};
const BACKGROUND_MOD_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_MUTED;
object8.backgroundColor = BACKGROUND_MOD_MUTED;
object8.height = 16;
object8.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
object8.alignSelf = 'flex-start';
object.commandChoiceLoadingItem = object8;
object.autocompleteIcon = {opacity: 0.6};
const env0_10 = Reflect.apply(createStyles, value, [object]);
object = {User: User_90881, Global: Global, Role: Role_90884, Channel: Channel_90885, Emoji: Emoji_90886,
EmojiPremiumUpsell: EmojiPremiumUpsell, Choice: Choice, ChoiceLoading: ChoiceLoading, Sticker: Sticker,
Label: Label_90892};
(FileImportTrackerModule).fileFinishedImporting('modules/autocompleter/native/Autocomplete.tsx');
exports.default = object;
exports.AUTOCOMPLETE_STICKER_NODE_SIZE = 56;
exports.AUTOCOMPLETE_STICKER_NODE_MARGIN = 4;
function AutocompleteLabel(a0) { // fn#90880, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12041:1127, offset: 0x0204a7fd, size: 81 bytes, params: 2, frame: 15
const styles = useStyles();
const FormRow = (NativeModule2).FormRow;
const Label = FormRow.Label;
return <Label style={styles.leading} text={a0.text} />;
}
function User_90881({user, nick, status, guildId, onPress}) { // fn#90881, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12041:1242, offset: 0x0204a84e, size: 391 bytes, params: 2, frame: 25
const styles = useStyles();
const value2 = (FluxModule).useStateFromStores([RelationshipStore], _fun90882);
const FormRow = (NativeModule2).FormRow;
object = {DEPRECATED_style: styles.row, onPress: onPress, accessibilityRole: 'menuitem'};
let r10 = nick ?? value2;
r10 = r10 ?? (importDefault(3995) /* metro dependency 3995: UserUtils */).getName(user);
object.label = <AutocompleteLabel text={r10} />;
const Avatar = (NativeModule).Avatar;
const AvatarSizes = (NativeModule).AvatarSizes;
const SMALL = AvatarSizes.SMALL;
object.leading = (
<Avatar
status={status}
user={user}
size={SMALL}
guildId={guildId}
autoStatusCutout
/>
);
const username = styles.username;
object.trailing = ((Component) => <Component user={user} usernameStyle={[styles.trailing,
username]} discriminatorStyle={styles.trailing} />)(DiscordTag);
return <FormRow {...object} />;
function _fun90882() { // fn#90882, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12041:1338, offset: 0x0204a9d5, size: 45 bytes, params: 1, frame: 12
const guildIdBinding = guildId;
const value2 = null;
return value2 == guildIdBinding ? RelationshipStore.getNickname(user.id) : value2;
}
}
function Global({text, description, onPress}) { // fn#90883, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12041:1759, offset: 0x0204aa02, size: 140 bytes, params: 2, frame: 21
const TableRow = (TableRowNativeModule).TableRow;
const tableRowProps = {onPress: onPress, accessibilityRole: 'menuitem', label: <AutocompleteLabel text={text} />};
const TableRowTrailingText = (TableRowTrailingTextNativeModule).TableRowTrailingText;
tableRowProps.trailing = <TableRowTrailingText text={description} />;
return <TableRow {...tableRowProps} />;
}
function Role_90884({onPress, showDescription, name, colorString}) { // fn#90884, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12041:1949, offset: 0x0204aa8e, size: 311 bytes, params: 2, frame: 23
var r7;
var intl;
const styles = useStyles();
const TableRow = (TableRowNativeModule).TableRow;
const object = {onPress: onPress, accessibilityRole: 'menuitem'};
const FormRow = (NativeModule2).FormRow;
const Label = FormRow.Label;
object.label = (
<Label style={[styles.leading, colorString != null ? {color: colorString} : undefined]} text={'@' + name} />
);
const TableRowTrailingText = (TableRowTrailingTextNativeModule).TableRowTrailingText;
if (showDescription) {
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
r7 = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.HrUmDH);
} else {
r7 = '';
}
object.trailing = <TableRowTrailingText text={r7} />;
return <TableRow {...object} />;
}
function Channel_90885({channel, category, onPress}) { // fn#90885, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12041:2276, offset: 0x0204abc5, size: 364 bytes, params: 2, frame: 23
const styles = useStyles();
const guildStoreBinding = GuildStore;
const getGuild = guildStoreBinding.getGuild;
const getGuildId = channel.getGuildId;
const value2 = Reflect.apply(getGuild, guildStoreBinding, [Reflect.apply(getGuildId, channel, [])]);
const type = channel.type;
const GUILD_CATEGORY = ChannelTypes.GUILD_CATEGORY;
const r6 = type === GUILD_CATEGORY ? importDefault(8366) /* metro dependency 8366 */ : (require(6647) /* metro dependency 6647: ChannelUtils */).getChannelIconWithGuild(channel,
value2);
const Icon = (NativeModule).Icon;
const icon = <Icon source={r6} style={styles.autocompleteIcon} />;
const channelName = UseChannelNameModule.computeChannelName(channel, UserStore, RelationshipStore);
const FormRow = (NativeModule2).FormRow;
const formRowProps = {onPress: onPress, accessibilityRole: 'menuitem', leading: icon,
label: <AutocompleteLabel text={channelName} />};
const Text = (TextModule).Text;
formRowProps.trailing = (
<Text
style={styles.trailing}
variant="text-sm/medium"
color="text-muted"
>
{category != null && category.name}
</Text>
);
return <FormRow {...formRowProps} />;
}
function Emoji_90886({name, url, surrogates, onPress}) { // fn#90886, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12041:2754, offset: 0x0204ad31, size: 299 bytes, params: 2, frame: 21
var r5;
const styles = useStyles();
if (url !== '') {
r5 = ((Component) => <Component style={[styles.emoji,
styles.emojiImage]} source={{uri: url}} />)(importDefault(5475) /* metro dependency 5475: FastImage */);
} else {
const LegacyText = (require(1305) /* metro dependency 1305: native */).LegacyText;
r5 = (
<LegacyText style={[styles.emoji, styles.emojiText]} allowFontScaling={false}>
{surrogates}
</LegacyText>
);
}
const FormRow = (NativeModule2).FormRow;
return (
<FormRow
onPress={onPress}
accessibilityRole="menuitem"
leading={r5}
label={<AutocompleteLabel text={':' + name + ':'} />}
/>
);
}
function EmojiPremiumUpsell({results, onPress}) { // fn#90887, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12041:3100, offset: 0x0204ae5c, size: 110 bytes, params: 2, frame: 18
const FormRow = (NativeModule2).FormRow;
return (
<FormRow
onPress={onPress}
accessibilityRole="menuitem"
label={((Component) => <Component results={results} />)(ChannelAutocompleteEmojiUpsell)}
/>
);
}
function Choice({choice, onPress}) { // fn#90888, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12041:3223, offset: 0x0204aeca, size: 102 bytes, params: 2, frame: 17
const FormRow = (NativeModule2).FormRow;
return (
<FormRow
onPress={onPress}
accessibilityRole="menuitem"
label={<AutocompleteLabel text={choice.displayName} />}
/>
);
}
function ChoiceLoading() { // fn#90889, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12041:3370, offset: 0x0204af30, size: 167 bytes, params: 1, frame: 21
const styles = useStyles();
const value2 = ReactModule.useMemo(_fun90890, []);
const FormRow = (NativeModule2).FormRow;
return (
<FormRow
DEPRECATED_style={styles.row}
leading={<View style={styles.commandChoiceLoadingContainer}>
<View style={[styles.commandChoiceLoadingItem, {width: value2}]} />
</View>}
/>
);
function _fun90890() { // fn#90890, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12041:3418, offset: 0x0204afd7, size: 48 bytes, params: 1, frame: 13
const value = environment.__proto__;
return (Module00022).random(100, 300);
}
}
function Sticker({sticker, onPress, onLongPress, isInteracting}) { // fn#90891, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12041:3627, offset: 0x0204b007, size: 191 bytes, params: 2, frame: 21
const styles = useStyles();
const value2 = (StickersHooksModule).useShouldAnimateSticker(isInteracting);
const PressableOpacity = (PressablesModule).PressableOpacity;
return (
<PressableOpacity
accessibilityRole="menuitem"
style={styles.stickerContainer}
onPress={onPress}
onLongPress={onLongPress}
pointerEvents="box-only"
>
{((Component) => <Component sticker={sticker} size={40} animated={value2} />)(Sticker)}
</PressableOpacity>
);
}
function Label_90892({label}) { // fn#90892, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12041:3931, offset: 0x0204b0c6, size: 77 bytes, params: 2, frame: 17
const FormRow = (NativeModule2).FormRow;
return <FormRow label={<AutocompleteLabel text={label} />} />;
}
}
global.__d(_fun90879, 11855, [31, 27, 1867, 3793, 1878, 661, 11018, 33, 4501, 697, 7972, 566, 3995, 1305, 9210,
6238, 6246, 1244, 8366, 6647, 4805, 4573, 5475, 11856, 11049, 5278, 10970, 22,
2]) /* metro module 11855, dependencies: [31, 27, 1867, 3793, 1878, 661, 11018, 33, 4501, 697, 7972, 566, 3995, 1305, 9210, 6238, 6246, 1244, 8366, 6647, 4805, 4573, 5475, 11856, 11049, 5278, 10970, 22, 2] */;