/* Metro module 15736; source: modules/interaction_components/InteractionModalUtils.tsx; dependencies: [5, 57, 31, 1226, 1379, 4645, 1945, 3969, 4644, 12952, 8358, 661, 8357, 1909, 1423, 8067, 6844, 566, 6518, 21, 694, 7879, 1244, 44, 4627, 7226, 8055, 4651, 507, 672, 2] */ function _fun120826(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120826, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:6, offset: 0x02536e50, size: 417 bytes, params: 8, frame: 20 let env0_0 = require; const closure = function() { return _submitModal.apply(this, arguments); }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importDefault(5) /* metro dependency 5 */; const env0_4 = importDefault(57) /* metro dependency 57 */; const env0_5 = importAll(31) /* metro dependency 31 */; const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */; const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */; const env0_8 = (require(4645) /* metro dependency 4645: DraftStore */).DraftType; const guildMemberStore = importDefault(1945) /* metro dependency 1945: GuildMemberStore */; const selectedGuildStore = importDefault(3969) /* metro dependency 3969: SelectedGuildStore */; const uploadAttachmentStore = importDefault(4644) /* metro dependency 4644: UploadAttachmentStore */; const interactionModalStore = importDefault(12952) /* metro dependency 12952: InteractionModalStore */; const env0_13 = (require(12952) /* metro dependency 12952: InteractionModalStore */).InteractionModalState; const localInteractionComponentStateStore = importDefault(8358) /* metro dependency 8358: LocalInteractionComponentStateStore */; const env0_15 = (require(661) /* metro dependency 661: Constants */).Endpoints; const getData = function(a0, a1, a2) { var env0_0 = a0; var env0_1 = a2; return a1.map(_fun120839); }; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/interaction_components/InteractionModalUtils.tsx'); exports.useIsFirstTextInputInModal = useIsFirstTextInputInModal; exports.useModalState = useModalState_120844; exports.useIframeModalState = useIframeModalState; exports.submitModal = closure; } function useApplicationInfo(a0) { // fn#120827, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:274, offset: 0x02536ff1, size: 77 bytes, params: 2, frame: 15 const env0_0 = a0; return env0_5.useMemo(_fun120828, [a0.id, a0.icon, a0.name, a0.bot]); } function getUploadsForModal(a0, a1) { // fn#120829, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:2534, offset: 0x02537168, size: 60 bytes, params: 3, frame: 14 const env0_0 = a1; const getUploads = UploadAttachmentStore.getUploads; const InteractionModal = DraftType.InteractionModal; return Reflect.apply(getUploads, UploadAttachmentStore, [a0, InteractionModal]).filter(_fun120830); } function _submitModal() { // fn#120832, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:2783, offset: 0x025371ec, size: 50 bytes, params: 1, frame: 14 return env0_3(_fun120834).apply(this, arguments); } function getData(a0, a1, a2) { // fn#120838, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:702, offset: 0x02537568, size: 38 bytes, params: 4, frame: 11 const env0_0 = a0; const env0_1 = a2; return a1.map(_fun120839); } function useIsFirstTextInputInModal(a0) { // fn#120843, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:3838, offset: 0x02537ad8, size: 152 bytes, params: 2, frame: 14 const value2 = undefined; const value3 = (require(8357) /* metro dependency 8357: ComponentStateContext */).useComponentStateContext(); const r1 = value3 == null || value3.modal == null ? value2 : value3.modal.components[0]; const type = r1 == null ? value2 : r1.type; const ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType; const ACTION_ROW = ComponentType.ACTION_ROW; return type === ACTION_ROW && r1.components[0].id === a0; } function useModalState_120844(a0, a1) { // fn#120844, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:4082, offset: 0x02537b70, size: 436 bytes, params: 3, frame: 30 const env0_0 = a0; const env0_1 = a1; const application = a0.application; const customId = a0.customId; const components = a0.components; let value2 = (importDefault(6844) /* metro dependency 6844: useUnmountAbortSignal */)(); const env0_3 = value2; let binding = env0_5; let useState = binding.useState; const value3 = Reflect.apply(useState, binding, [null]); binding = env0_4; const value4 = binding(value3, 2); const property = value4[0]; var env0_4 = value4[1]; const binding2 = env0_5; useState = binding2.useState; const value5 = binding(Reflect.apply(useState, binding2, [null]), 2); const property2 = value5[0]; var env0_5 = property2; const env0_6 = value5[1]; const binding3 = env0_5; useState = binding3.useState; const value6 = binding(Reflect.apply(useState, binding3, [{}]), 2); const property3 = value6[0]; const property4 = value6[1]; const value7 = (require(566) /* metro dependency 566: flux */).useStateFromStores([InteractionModalStore], _fun120845, [property2]); const value8 = (importDefault(6518) /* metro dependency 6518: useInitialValue */)(function() { var Set = global.Set; var value = Object.create(Set.prototype, {constructor: {value: Set}}); var value2 = new Set(); return value2 instanceof Object ? value2 : value; }); const value10 = env0_5.useCallback(env0_3(_fun120848), [value2, a0, value8]); env0_5.useEffect(_fun120851, [property2, value7, a1, customId, a0.channelId]); let value = useApplicationInfo(application); return {components: components, applicationIconURL: value.applicationIconURL, applicationName: value.applicationName, submissionState: value7, error: property, validators: value8, validationErrors: property3, setValidationErrors: property4, onSubmit: value10}; } function useIframeModalState(a0) { // fn#120853, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:5113, offset: 0x02537f1f, size: 295 bytes, params: 2, frame: 26 const application = a0.application; const customId = a0.customId; const {applicationIconURL, applicationName, applicationBaseUrl} = useApplicationInfo(application); const getChannel = ChannelStore.getChannel; let channelId = a0.channelId; const value3 = Reflect.apply(getChannel, ChannelStore, [channelId]); (importDefault(44) /* metro dependency 44 */)(value3 != null, 'channel should not be null'); const object3 = {}; channelId = a0.channelId; const id = application.id; const value = ''; object3.instance_id = value + channelId + ':' + id + ':' + customId; object3.custom_id = customId; object3.channel_id = a0.channelId; if (value3.guild_id != null && value !== value3.guild_id) { object3.guild_id = value3.guild_id; } const URL = global.URL; const uRL = new URL(applicationBaseUrl ?? value); uRL.pathname = a0.iframePath; const object4 = {applicationIconURL: applicationIconURL, applicationName: applicationName, applicationBaseUrl: applicationBaseUrl, queryParams: object3}; object4.iframeUrl = uRL.toString(); return object4; } function _fun120828() { // fn#120828, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:323, offset: 0x0253703e, size: 298 bytes, params: 1, frame: 20 const value = environment.__proto__; const guildId = SelectedGuildStore.getGuildId(); const value3 = undefined; const r5 = guildId != null && env0_0.bot != null ? GuildMemberStore.getMember(guildId, env0_0.bot.id) : value3; const object2 = {}; const defaultImport = importDefault(1423) /* metro dependency 1423: AvatarUtils */; const getApplicationIconURL = defaultImport.getApplicationIconURL; const binding = env0_0; object2.applicationIconURL = Reflect.apply(getApplicationIconURL, defaultImport, [{id: binding.id, icon: binding.icon, botIconFirst: true, bot: r5 != null ? env0_0.bot : value3, guildMember: r5}]); object2.applicationName = (r5 == null ? value3 : r5.nick) != null ? r5.nick : env0_0.bot != null ? env0_0.bot.username : env0_0.name; object2.applicationBaseUrl = (importDefault(8067) /* metro dependency 8067: getURLForApplication */)(env0_0.id); return object2; } function _fun120830({id}) { // fn#120830, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:2617, offset: 0x025371a4, size: 72 bytes, params: 2, frame: 12 let value = environment.__proto__; value = undefined; const value2 = (require(4627) /* metro dependency 4627: InteractionComponentUtils */).deserializeComponentUploadId(id); return (value2 == null ? value : value2.containerId) === require; } function* _fun120834(a0, a1, a2) { // fn#120834, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:2830, offset: 0x02537229, size: 349 bytes, params: 4, frame: 25 if (false) { return undefined; } const env0_0 = a0; const env0_1 = a1; const env0_2 = a2; value = undefined; const channelId = a0.channelId; let binding = env2_7; env2_1(env2_2[23])(binding.getChannel(channelId) != null, 'expected channel'); const value6 = env2_18(channelId, a0.customId); const r1 = value6.length > 0 ? env2_1(env2_2[25])(value6) : value; binding = env2_0; const binding2 = env2_2; const value8 = binding(binding2[26]); const addQueued = value8.addQueued; const InteractionTypes = binding(binding2[13]).InteractionTypes; const MODAL_SUBMIT = InteractionTypes.MODAL_SUBMIT; Reflect.apply(addQueued, value8, [a2, {data: {interactionType: MODAL_SUBMIT, applicationId: a0.application.id}, preflight: r1}]); yield r1; if (false) { return undefined; } const env0_4 = value6.map(_fun120835); const env0_5 = env2_16(a0.customId, a0.components, {uploads: value6}); send_120836(); return value; } function _fun120839(a0) { // fn#120839, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:718, offset: 0x0253758e, size: 1312 bytes, params: 2, frame: 20 var environment; var r3; var uploadIds; var r4; var object2; var value4; var value5; var value6; var value7; var value8; var value9; let type = a0.type; let value = environment.__proto__; const value2 = undefined; const ComponentType = (require(1909) /* metro dependency 1909: Server */).ComponentType; const ACTION_ROW = ComponentType.ACTION_ROW; if (ACTION_ROW === type) { object2 = {}; object2.type = a0.type; object2.components = getData(env0_0, a0.components, importDefault); return object2; } const TEXT_INPUT = ComponentType.TEXT_INPUT; if (TEXT_INPUT === type) { value = LocalInteractionComponentStateStore.getInteractionComponentState(env0_0, a0.id); object2 = {}; type = a0.type; object2.type = type; object2.custom_id = a0.customId; value9 = null; type = value9 == value ? value2 : value.type; object2.value = type !== a0.type ? value9 : value.value; return object2; } const FILE_UPLOAD = ComponentType.FILE_UPLOAD; if (FILE_UPLOAD === type) { value = LocalInteractionComponentStateStore.getInteractionComponentState(env0_0, a0.id); value8 = null; type = value8 == value ? value2 : value.type; uploadIds = type !== a0.type ? value8 : value.uploadIds; object2 = {}; type = a0.type; object2.type = type; object2.custom_id = a0.customId; r4 = value8 == uploadIds ? value2 : uploadIds.map(function(a0) { var env0_0 = a0; return importDefault.uploads.findIndex(_fun120841); }); object2.values = value8 != r4 ? r4 : value8; return object2; } const STRING_SELECT = ComponentType.STRING_SELECT; if (STRING_SELECT === type) { value = LocalInteractionComponentStateStore.getInteractionComponentState(env0_0, a0.id); object2 = {}; type = a0.type; object2.type = type; object2.custom_id = a0.customId; value7 = null; type = value7 == value ? value2 : value.type; object2.values = type !== a0.type ? value7 : value.values; return object2; } const USER_SELECT = ComponentType.USER_SELECT; if (USER_SELECT === type) { value = LocalInteractionComponentStateStore.getInteractionComponentState(env0_0, a0.id); object2 = {}; type = a0.type; object2.type = type; object2.custom_id = a0.customId; value6 = null; type = value6 == value ? value2 : value.type; if (type !== a0.type) { r3 = value6; } else { value = value.selectedOptions.map(function(a0) { return a0.value; }); r3 = value; } object2.values = r3; return object2; } const ROLE_SELECT = ComponentType.ROLE_SELECT; if (ROLE_SELECT === type) { value = LocalInteractionComponentStateStore.getInteractionComponentState(env0_0, a0.id); object2 = {}; type = a0.type; object2.type = type; object2.custom_id = a0.customId; value6 = null; type = value6 == value ? value2 : value.type; if (type !== a0.type) { r3 = value6; } else { value = value.selectedOptions.map(function(a0) { return a0.value; }); r3 = value; } object2.values = r3; return object2; } const MENTIONABLE_SELECT = ComponentType.MENTIONABLE_SELECT; if (MENTIONABLE_SELECT === type) { value = LocalInteractionComponentStateStore.getInteractionComponentState(env0_0, a0.id); object2 = {}; type = a0.type; object2.type = type; object2.custom_id = a0.customId; value6 = null; type = value6 == value ? value2 : value.type; if (type !== a0.type) { r3 = value6; } else { value = value.selectedOptions.map(function(a0) { return a0.value; }); r3 = value; } object2.values = r3; return object2; } const CHANNEL_SELECT = ComponentType.CHANNEL_SELECT; if (CHANNEL_SELECT === type) { value = LocalInteractionComponentStateStore.getInteractionComponentState(env0_0, a0.id); object2 = {}; type = a0.type; object2.type = type; object2.custom_id = a0.customId; value6 = null; type = value6 == value ? value2 : value.type; if (type !== a0.type) { r3 = value6; } else { value = value.selectedOptions.map(function(a0) { return a0.value; }); r3 = value; } object2.values = r3; return object2; } const TEXT_DISPLAY = ComponentType.TEXT_DISPLAY; if (TEXT_DISPLAY === type) { return {type: a0.type}; } const LABEL = ComponentType.LABEL; if (LABEL === type) { object2 = {}; object2.type = a0.type; object2.component = getData(env0_0, [a0.component], importDefault)[0]; return object2; } const RADIO_GROUP = ComponentType.RADIO_GROUP; if (RADIO_GROUP === type) { value = LocalInteractionComponentStateStore.getInteractionComponentState(env0_0, a0.id); object2 = {}; type = a0.type; object2.type = type; object2.custom_id = a0.customId; value5 = null; type = value5 == value ? value2 : value.type; object2.value = type !== a0.type ? value5 : value.value; return object2; } const CHECKBOX_GROUP = ComponentType.CHECKBOX_GROUP; if (CHECKBOX_GROUP === type) { value = LocalInteractionComponentStateStore.getInteractionComponentState(env0_0, a0.id); object2 = {}; type = a0.type; object2.type = type; object2.custom_id = a0.customId; value4 = null; type = value4 == value ? value2 : value.type; object2.values = type !== a0.type ? value4 : value.values; return object2; } const CHECKBOX = ComponentType.CHECKBOX; if (CHECKBOX === type) { value = LocalInteractionComponentStateStore.getInteractionComponentState(env0_0, a0.id); object2 = {}; type = a0.type; object2.type = type; object2.custom_id = a0.customId; type = value == null ? value2 : value.type; object2.value = type === a0.type && value.value; return object2; } (importDefault(44) /* metro dependency 44 */)(false, 'unreachable'); return value2; } function _fun120845() { // fn#120845, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:4331, offset: 0x02537d24, size: 29 bytes, params: 1, frame: 11 return InteractionModalStore.getModalState(env0_5); } function* _fun120848() { // fn#120848, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:4405, offset: 0x02537d4c, size: 154 bytes, params: 1, frame: 18 var environment; var value3; var binding; var value4; var fromTimestamp; var Date; var value5; if (true) { value = environment.__proto__; env1_4(null); AuthenticationStore(null); if (_fun120849(DraftType)) { value3 = environment.__proto__.__proto__; binding = env2_1; value4 = binding(env2_2[19]); fromTimestamp = value4.fromTimestamp; Date = global.Date; value5 = Reflect.apply(fromTimestamp, value4, [Date.now()]); AuthenticationStore(value5); binding = env2_19; yield binding(require, env1_3, value5); return undefined; } } } function _fun120851() { // fn#120851, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:4592, offset: 0x02537e1f, size: 256 bytes, params: 1, frame: 20 var defaultImport; var dispatch; var customIdBinding; var defaultImport2; var removeFiles; var intl; let binding = env0_7; const SUCCEEDED = InteractionModalState.SUCCEEDED; if (binding === SUCCEEDED) { defaultImport = importDefault(694) /* metro dependency 694: Dispatcher */; dispatch = defaultImport.dispatch; customIdBinding = customId; Reflect.apply(dispatch, defaultImport, [{type: 'CLEAR_INTERACTION_MODAL_STATE', customId: customIdBinding}]); defaultImport2 = importDefault(7879) /* metro dependency 7879: UploadAttachmentActionCreators */; removeFiles = defaultImport2.removeFiles; binding = env0_0; Reflect.apply(removeFiles, defaultImport2, [binding.channelId, getUploadsForModal(binding.channelId, customIdBinding).map(function(a0) { return a0.id; }), DraftType.InteractionModal]); require(); } binding = env0_7; const ERRORED = InteractionModalState.ERRORED; if (binding === ERRORED) { binding = env0_4; intl = (require(1244) /* metro dependency 1244: indexNative */).intl; binding(intl.string((require(1244) /* metro dependency 1244: indexNative */).t.uJgdEu)); } } function _fun120835(a0, a1) { // fn#120835, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:3143, offset: 0x02537386, size: 45 bytes, params: 3, frame: 13 const value = environment.__proto__.__proto__.__proto__; return env3_0(env3_2[27]).getAttachmentPayload(a0, a1); } function send_120836() { // fn#120836, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:3240, offset: 0x025373b3, size: 297 bytes, params: 1, frame: 18 var environment; var value3; var binding; var binding2; var value4; var HTTP; var post; var object3; var object4; var id; if (!(require != null && require.aborted)) { value3 = environment.__proto__.__proto__.__proto__; binding = env3_0; binding2 = env3_2; value4 = undefined; HTTP = binding(binding2[28]).HTTP; post = HTTP.post; object3 = {}; object3.url = env3_15.INTERACTIONS; object4 = {}; object4.type = binding(binding2[13]).InteractionTypes.MODAL_SUBMIT; binding = env0_0; id = binding.application.id; object4.application_id = id; id = env0_3.id; object4.channel_id = id; object4.guild_id = env0_3.guild_id; id = binding.id; object4.data = {id: id, custom_id: binding.customId, components: env0_5, attachments: env0_4.length > 0 ? env0_4 : value4}; binding = env3_6; object4.session_id = binding.getSessionId(); object4.nonce = importDefault; object3.body = object4; object3.signal = require; object3.rejectWithError = false; Reflect.apply(post, HTTP, [object3]).catch(_fun120837); } } function _fun120840(a0) { // fn#120840, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:1230, offset: 0x02537aae, size: 42 bytes, params: 2, frame: 11 const env0_0 = a0; return importDefault.uploads.findIndex(_fun120841); } function _fun120849(a0) { // fn#120849, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:4437, offset: 0x02537de6, size: 34 bytes, params: 2, frame: 12 const env0_0 = true; a0.forEach(_fun120850); return env0_0; } function _fun120837(a0) { // fn#120837, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:3579, offset: 0x025374dc, size: 140 bytes, params: 2, frame: 15 var value; var setFailed; var value2; var setTimeout; var send_120836Binding; var retry_after; if (a0.status === 429) { setTimeout = global.setTimeout; value = environment.__proto__; send_120836Binding = send_120836; retry_after = a0.body.retry_after; value = environment.__proto__.__proto__.__proto__.__proto__; setTimeout(send_120836Binding, retry_after * env4_1(env4_2[29]).Millis.SECOND); } else { value = environment.__proto__.__proto__.__proto__.__proto__; value = env4_0(env4_2[26]); setFailed = value.setFailed; value2 = environment.__proto__; Reflect.apply(setFailed, value, [importDefault]); } } function _fun120850(a0) { // fn#120850, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15944:4468, offset: 0x02537e08, size: 23 bytes, params: 2, frame: 10 if (a0()) { } }