/* Metro module 9142; source: modules/guild_scheduled_events/StartEventUtils.tsx; dependencies: [5, 1383, 1379, 1867, 1385, 661, 9086, 44, 8123, 9037, 2] */ import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */ import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */ import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */ import * as ChannelRecordModule from '../../records/ChannelRecord.tsx'; /* Metro dependency 1383 */ import * as GuildScheduledEventsConstantsModule from './GuildScheduledEventsConstants.tsx'; /* Metro dependency 1385 */ function _fun71613(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#71613, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9327:6, offset: 0x01d26a0d, size: 310 bytes, params: 8, frame: 21 const env0_0 = require; const closure = function() { return _createStageChannelForEvent.apply(this, arguments); }; const findOrCreateEventChannel2 = findOrCreateEventChannel; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('modules/guild_scheduled_events/StartEventUtils.tsx'); exports.createStageChannelForEvent = closure; exports.findOrCreateEventChannel = findOrCreateEventChannel2; exports.preStartEventActions = function() { return _preStartEventActions.apply(this, arguments); }; exports.setEventAsActive = function() { return _setEventAsActive.apply(this, arguments); }; function _createStageChannelForEvent() { // fn#71615, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9327:365, offset: 0x01d26b43, size: 50 bytes, params: 1, frame: 14 return Module00005(_fun71617).apply(this, arguments); async function _fun71617({id}, a1) { // fn#71617, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9327:442, offset: 0x01d26b89, size: 255 bytes, params: 3, frame: 22 let value = a2; if (false) { return undefined; } const r4 = value !== undefined ? value : []; await undefined; if (false) { return undefined; } const items3 = []; const push = items3.push; const items2 = []; arraySpread(items2, r4, 0, a1); apply(push, items2, items3, a1); value = environment.__proto__.__proto__; const value5 = env2_1(env2_2[6]); const createChannel = value5.createChannel; const object = {}; object.guildId = id; const GUILD_STAGE_VOICE = env2_9.GUILD_STAGE_VOICE; object.type = GUILD_STAGE_VOICE; object.name = a1.substring(0, 100); object.permissionOverwrites = items3; await Reflect.apply(createChannel, value5, [object]); if (false) { return undefined; } if (null == undefined) { throw new global.Error("Can't create channel for event"); } if (undefined.status !== 201) { throw new global.Error("Can't create channel for event"); } return env2_4(undefined.body); } } function findOrCreateEventChannel(a0, a1) { // fn#71618, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9327:726, offset: 0x01d26c88, size: 118 bytes, params: 3, frame: 17 const guild_id = a0.guild_id; const channel_id = a0.channel_id; const guild = GuildStore.getGuild(guild_id); if (guild == null) { return global.Promise.resolve(null); } const channel = ChannelStore.getChannel(channel_id); return channel == null ? createStageChannelForEvent(guild, a0.name, a1) : global.Promise.resolve(channel); } function _preStartEventActions() { // fn#71619, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9327:948, offset: 0x01d26cfe, size: 50 bytes, params: 1, frame: 14 return Module00005(_fun71621).apply(this, arguments); function* _fun71621(a0, a1) { // fn#71621, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9327:1013, offset: 0x01d26d3b, size: 107 bytes, params: 3, frame: 15 if (true) { var entity_type = a0.entity_type; value = environment.__proto__.__proto__; var STAGE_INSTANCE = env2_7.STAGE_INSTANCE; if (entity_type === STAGE_INSTANCE) { yield env2_12(a0, a1); var value3 = undefined; if (false) { return value3; } env2_1(env2_2[7])(value3 != null, 'could not find or create channel'); } } } } function _setEventAsActive() { // fn#71622, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9327:1186, offset: 0x01d26da6, size: 50 bytes, params: 1, frame: 14 return Module00005(_fun71624).apply(this, arguments); async function _fun71624({channel_id, entity_type, name, id, guild_id}) { // fn#71624, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9327:1243, offset: 0x01d26dec, size: 348 bytes, params: 2, frame: 26 var binding; var binding2; var binding3; var value8; let value = a1; if (true) { var r9 = value !== undefined ? value : false; await undefined; if (false) { return undefined; } value = environment.__proto__.__proto__; var STAGE_INSTANCE = env2_7.STAGE_INSTANCE; if (STAGE_INSTANCE === entity_type) { binding = env2_1; binding3 = env2_2; binding(binding3[7])(channel_id != null, 'channel_id is required'); binding = env2_0; value8 = binding(binding3[8]); await value8.startStageInstance(channel_id, name, env2_8.GUILD_ONLY, r9, id); } else { var VOICE = env2_7.VOICE; if (VOICE === entity_type) { binding = env2_1; binding2 = env2_2; value = binding(binding2[7]); value(channel_id != null, 'channel_id is required'); value = binding(binding2[9]); await value.startEvent(id, guild_id); value = undefined; return undefined; } var EXTERNAL = env2_7.EXTERNAL; if (EXTERNAL !== entity_type) { return undefined; } value = env2_1(env2_2[9]); await value.startEvent(id, guild_id); } } } } } global.__d(_fun71613, 9142, [5, 1383, 1379, 1867, 1385, 661, 9086, 44, 8123, 9037, 2]) /* metro module 9142, dependencies: [5, 1383, 1379, 1867, 1385, 661, 9086, 44, 8123, 9037, 2] */;