/* Metro module 11358; source: modules/opt_in_channels/useBatchUpdateChannelSettings.tsx; dependencies: [31, 5090, 4864, 661, 694, 566, 6609, 11359, 11356, 2] */ function _fun87016(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#87016, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11544:6, offset: 0x01fabe02, size: 186 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importAll(31) /* metro dependency 31 */; const categoryCollapseStore = importDefault(5090) /* metro dependency 5090: CategoryCollapseStore */; const userGuildSettingsStore = importDefault(4864) /* metro dependency 4864: UserGuildSettingsStore */; const env0_6 = (require(661) /* metro dependency 661: Constants */).AnalyticsSections; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/opt_in_channels/useBatchUpdateChannelSettings.tsx'); exports.default = useBatchUpdateChannelSettings; } function useBatchUpdateChannelSettings(a0) { // fn#87018, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11544:359, offset: 0x01fabebc, size: 159 bytes, params: 2, frame: 16 var object2; const env0_0 = a0; const pendingChannelUpdates = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserGuildSettingsStore], _fun87019); const binding = env0_3; binding.useEffect(_fun87020, [a0]); binding.useEffect(_fun87022, [a0, pendingChannelUpdates]); object2 = {}; object2.onChannelClick = binding.useCallback(_fun87023, []); return object2; } function _fun87019() { // fn#87019, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11544:439, offset: 0x01fabf5b, size: 29 bytes, params: 1, frame: 11 return UserGuildSettingsStore.getPendingChannelUpdates(env0_0); } function _fun87020() { // fn#87020, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11544:495, offset: 0x01fabf78, size: 32 bytes, params: 1, frame: 11 resetStoreState_87017(env0_0); return _fun87021; } function _fun87022() { // fn#87022, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11544:562, offset: 0x01fabfaf, size: 62 bytes, params: 1, frame: 13 var value2; var moduleValue; if (pendingChannelUpdates != null) { value2 = environment.__proto__; moduleValue = require(6609) /* metro dependency 6609: OptInChannelsActionCreators */; moduleValue.updateOptInChannelsBatched(env0_0, pendingChannelUpdates); } } function _fun87023(a0, a1, a2) { // fn#87023, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11544:656, offset: 0x01fabfed, size: 355 bytes, params: 4, frame: 22 var optIntoAllChannelsForExistingMember; var Set; var value4; var set; var value6; let value = environment.__proto__; const isChannelOptedIn2 = UserGuildSettingsStore.isChannelOptedIn(a0, a1); const value2 = !isChannelOptedIn2; if ((isChannelOptedIn2 ? value2 : CategoryCollapseStore.isCollapsed(a2)) && a2 != null) { (require(11359) /* metro dependency 11359: CategoryCollapseActionCreators */).categoryExpand(a2); } const optInOnboardingUtilsModule = require(11356) /* metro dependency 11356: OptInOnboardingUtils */; if (optInOnboardingUtilsModule.hasNotSetUpChannelOptIn(a0)) { if (a1 === a2) { value = optInOnboardingUtilsModule; optIntoAllChannelsForExistingMember = value.optIntoAllChannelsForExistingMember; Set = global.Set; value6 = Object.create(Set.prototype, {constructor: {value: Set}}); set = new Set([a1]); Reflect.apply(optIntoAllChannelsForExistingMember, value, [a0, {include: set instanceof Object ? set : value6}]); } else { value = require(11356) /* metro dependency 11356: OptInOnboardingUtils */; optIntoAllChannelsForExistingMember = value.optIntoAllChannelsForExistingMember; Set = global.Set; value4 = Object.create(Set.prototype, {constructor: {value: Set}}); set = new Set([a1]); Reflect.apply(optIntoAllChannelsForExistingMember, value, [a0, {exclude: set instanceof Object ? set : value4}]); } } else { (require(6609) /* metro dependency 6609: OptInChannelsActionCreators */).updateOptInChannelsImmediate(a0, a1, value2, {section: AnalyticsSections.CHANNEL_BROWSER}); } } function _fun87021() { // fn#87021, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11544:519, offset: 0x01fabf98, size: 23 bytes, params: 1, frame: 11 resetStoreState_87017(env1_0); }