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

206 lines
11 KiB
TypeScript

/* Metro module 16133; source: modules/guild_invite/native/AdvancedInstantInvite.tsx; dependencies: [31, 27, 3793, 1878, 33, 4501, 6647, 4805, 16134, 9155, 16135, 4080, 16136, 1962, 1244, 7972, 1305, 6808, 1391, 8898, 2] */
import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
import RelationshipStore from '../../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
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 NativeModule from '../../../design/void/native.tsx'; /* Metro dependency 1305 */
import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as TableSwitchRowNativeModule from '../../../design/components/TableRow/native/TableSwitchRow.native.tsx'; /* Metro dependency 6808 */
import * as UseInviteApplicationBypassInfoModule from '../../instant_invite/useInviteApplicationBypassInfo.tsx'; /* Metro dependency 16134 */
function _fun124574(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#124574, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16341:6, offset: 0x025bd96b, size: 272 bytes, params: 8, frame: 20
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_10 = (CreateStylesModule).createStyles({container: {flexGrow: 1},
channelIcon: {'height': 16, 'width': 16, 'marginTop': 2}});
(FileImportTrackerModule).fileFinishedImporting('modules/guild_invite/native/AdvancedInstantInvite.tsx');
exports.default = AdvancedInstantInvite;
function AdvancedInstantInvite({channel, guild, style, maxAge, onChangeMaxAge, maxUsesOptions, maxUses, onChangeMaxUses, temporary, onChangeTemporary, flags, onChangeFlags, roleIds, onChangeRoleIds}) { // fn#124575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16341:373, offset: 0x025bda7b, size: 1798 bytes, params: 2, frame: 48
var r17;
var r8;
var moduleValue2;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
var jsxRuntimeEnv0_9Binding;
const TableSwitchRow = (TableSwitchRowNativeModule).TableSwitchRow;
var items4;
const FormHint = (require(7972) /* metro dependency 7972: native */).FormHint;
var object;
var moduleValue5;
var items5;
const roleIds2 = roleIds;
const styles = useStyles();
const r36 = channel != null ? (require(6647) /* metro dependency 6647: ChannelUtils */).getChannelIcon(channel) : null;
if (channel != null) {
moduleValue2 = require(4805) /* metro dependency 4805: useChannelName */;
r17 = moduleValue2.computeChannelName(channel, UserStore, RelationshipStore);
} else {
r17 = ' ';
}
const {canCreateApplicationBypassInvites,
isManualApprovalGuild} = (UseInviteApplicationBypassInfoModule).useInviteApplicationBypassInfo(guild);
const value7 = (require(9155) /* metro dependency 9155: DefaultInviteExpirationExperiments */).useMaxAgeOptions({guildId: guild?.id,
location: 'AdvancedInstantInvite'});
const value8 = (importDefault(16135) /* metro dependency 16135: useInviteAssignableRoles */)(guild ?? null);
const value9 = value8.length > 0;
const binding = roleIds2;
const value10 = binding.useCallback(_fun124576, [guild, value8, roleIds, onChangeRoleIds]);
const value11 = binding.useMemo(_fun124577, [value8, roleIds]);
const r22 = value11 === 0 ? undefined : intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t['eXU3/V'],
{count: value11});
const items6 = [styles.container, style];
const Form = (require(7972) /* metro dependency 7972: native */).Form;
const FormSection = (require(7972) /* metro dependency 7972: native */).FormSection;
let string = intl.string;
const LUo0Q8 = (require(1244) /* metro dependency 1244: indexNative */).t.LUo0Q8;
const FormRow = (require(7972) /* metro dependency 7972: native */).FormRow;
const Icon = (NativeModule).Icon;
const Icon2 = (NativeModule).Icon;
const Sizes = Icon2.Sizes;
const CUSTOM = Sizes.CUSTOM;
const items2 = [
<FormSection title={Reflect.apply(string, intl, [LUo0Q8])}>
<FormRow leading={<Icon size={CUSTOM} source={r36} style={styles.channelIcon} />} label={r17} />
</FormSection>,
];
const formSectionProps = {title: intl.string((require(1244) /* metro dependency 1244: indexNative */).t['4QuV7G'])};
const FormSelect = (require(7972) /* metro dependency 7972: native */).FormSelect;
const items3 = [
<FormSelect
label={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.gKmKP0)}
options={value7}
value={maxAge}
onChange={onChangeMaxAge}
/>,
];
const FormDivider = (require(7972) /* metro dependency 7972: native */).FormDivider;
items3[1] = <FormDivider />;
items3[2] = (
<FormSelect
label={intl.string((require(1244) /* metro dependency 1244: indexNative */).t['+3vH1h'])}
options={maxUsesOptions}
value={maxUses}
onChange={onChangeMaxUses}
/>
);
items2[1] = (
<FormSection {...formSectionProps}>
{items3}
</FormSection>
);
items2[2] = (
value9
? (
<FormSection>
<FormRow
label={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.rPYJxL)}
trailing={((Arrow) => <Arrow />)((require(7972) /* metro dependency 7972: native */).FormRow.Arrow)}
subLabel={r22}
onPress={value10}
/>
</FormSection>
)
: null
);
let r10 = !isManualApprovalGuild && onChangeTemporary != null;
if (r10) {
jsxRuntimeEnv0_9Binding = jsxRuntimeEnv0_9;
string = intl.string;
items4 = [
<FormSection>
<TableSwitchRow
label={Reflect.apply(string, intl, [t.dy1ico])}
value={temporary}
onValueChange={onChangeTemporary}
/>
</FormSection>,
];
string = intl.string;
items4[1] = (
<FormHint>
{Reflect.apply(string, intl, [t.A53l87])}
</FormHint>
);
r10 = (
<>
{items4}
</>
);
}
items2[3] = r10;
if (canCreateApplicationBypassInvites) {
jsxRuntimeEnv0_9Binding = jsxRuntimeEnv0_9;
var tableSwitchRowProps = {label: intl.string(t['1i1bUl'])};
moduleValue5 = require(1391) /* metro dependency 1391: FlagUtils */;
tableSwitchRowProps.value = moduleValue5.hasFlag(flags,
(require(8898) /* metro dependency 8898: GuildInviteFlags */).GuildInviteFlags.IS_APPLICATION_BYPASS);
tableSwitchRowProps.onValueChange = function(a0) {
var onChangeFlagsBinding = onChangeFlags;
var moduleValue = require(dependencyMap[18]);
var flagsBinding = flags;
var IS_APPLICATION_BYPASS = require(dependencyMap[19]).GuildInviteFlags.IS_APPLICATION_BYPASS;
return onChangeFlagsBinding(moduleValue.setFlag(flagsBinding, IS_APPLICATION_BYPASS, a0));
};
items5 = [
<FormSection>
<TableSwitchRow {...tableSwitchRowProps} />
</FormSection>,
];
items5[1] = (
<FormHint>
{intl.string(t['jvd/LF'])}
</FormHint>
);
r8 = (
<>
{items5}
</>
);
} else {
r8 = null;
}
items2[4] = r8;
return (
<View style={items6}>
<Form>
{items2}
</Form>
</View>
);
function _fun124576() { // fn#124576, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16341:943, offset: 0x025be181, size: 145 bytes, params: 1, frame: 18
var value4;
var defaultImport;
if (guild != null && onChangeRoleIds != null) {
value4 = environment.__proto__;
defaultImport = importDefault(dependencyMap[11]);
defaultImport.openLazy(require(dependencyMap[13])(dependencyMap[12], dependencyMap.paths),
'SelectInviteRolesActionSheet', {assignableRoles: env0_5, selectedRoleIds: roleIds,
onSave: onChangeRoleIds},
'stack');
}
}
function _fun124577() { // fn#124577, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16341:1121, offset: 0x025be212, size: 86 bytes, params: 1, frame: 14
const Set = global.Set;
const set = new Set(env0_5.map(function(a0) {
return a0.id;
}));
const roleIdsBinding = roleIds;
return roleIdsBinding.filter(_fun124579).length;
function _fun124579(a0) { // fn#124579, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16341:1175, offset: 0x00e4010b, size: 22 bytes, params: 2, frame: 11
return env0_0.has(a0);
}
}
}
}
global.__d(_fun124574, 16133, [31, 27, 3793, 1878, 33, 4501, 6647, 4805, 16134, 9155, 16135, 4080, 16136, 1962,
1244, 7972, 1305, 6808, 1391, 8898,
2]) /* metro module 16133, dependencies: [31, 27, 3793, 1878, 33, 4501, 6647, 4805, 16134, 9155, 16135, 4080, 16136, 1962, 1244, 7972, 1305, 6808, 1391, 8898, 2] */;