262 lines
12 KiB
TypeScript
262 lines
12 KiB
TypeScript
/* Metro module 11355; source: modules/guild_onboarding/useBatchUpdateSelectOption.tsx; dependencies: [31, 4864, 6603, 670, 694, 22, 1360, 11356, 566, 6606, 1391, 2] */
|
|
function _fun86965(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#86965, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11541:6, offset: 0x01fa9e30, size: 192 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 userGuildSettingsStore = importDefault(4864) /* metro dependency 4864: UserGuildSettingsStore */;
|
|
const guildOnboardingPromptsStore = importDefault(6603) /* metro dependency 6603: GuildOnboardingPromptsStore */;
|
|
const env0_6 = (require(670) /* metro dependency 670: UserSettingsConstants */).ChannelNotificationSettingsFlags;
|
|
const env0_7 = {};
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guild_onboarding/useBatchUpdateSelectOption.tsx');
|
|
exports.default = useBatchUpdateSelectOption;
|
|
}
|
|
|
|
function useBatchUpdateSelectOption(a0) { // fn#86967, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11541:382, offset: 0x01fa9f26, size: 172 bytes, params: 2, frame: 18
|
|
var object2;
|
|
const env0_0 = a0;
|
|
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildOnboardingPromptsStore],
|
|
_fun86968, [a0]);
|
|
const binding = env0_3;
|
|
binding.useEffect(_fun86969, [a0]);
|
|
binding.useEffect(_fun86971, [a0, value2]);
|
|
object2 = {};
|
|
object2.handleSelectOption = binding.useCallback(_fun86972, [a0]);
|
|
return object2;
|
|
}
|
|
|
|
function _fun86968() { // fn#86968, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11541:459, offset: 0x01fa9fd2, size: 39 bytes, params: 1, frame: 12
|
|
return GuildOnboardingPromptsStore.getPendingResponseOptions(env0_0) ?? env1_7;
|
|
}
|
|
|
|
function _fun86969() { // fn#86969, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11541:549, offset: 0x01fa9ff9, size: 32 bytes, params: 1, frame: 11
|
|
resetStoreState(env0_0);
|
|
return _fun86970;
|
|
}
|
|
|
|
function _fun86971() { // fn#86971, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11541:616, offset: 0x01faa030, size: 96 bytes, params: 1, frame: 13
|
|
var value4;
|
|
if (env0_1 != null && global.Object.keys(env0_1).length !== 0) {
|
|
value4 = environment.__proto__;
|
|
(importDefault(6606) /* metro dependency 6606: GuildOnboardingActionCreators */).updateOnboardingResponses(env0_0);
|
|
}
|
|
}
|
|
|
|
function _fun86972(a0, a1, a2) { // fn#86972, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11541:738, offset: 0x01faa090, size: 297 bytes, params: 4, frame: 26
|
|
var object2;
|
|
var environment;
|
|
let value = environment.__proto__;
|
|
const getOnboardingResponses = GuildOnboardingPromptsStore.getOnboardingResponses;
|
|
const binding = env0_0;
|
|
const value3 = Reflect.apply(getOnboardingResponses, GuildOnboardingPromptsStore, [binding]);
|
|
const {addedRoleIds, removedRoleIds} = getRoles_86973(a0, a1, a2, value3);
|
|
const {addedChannelIds, removedChannelIds} = getChannels_86979({guildId: binding, prompt: a0, option: a1,
|
|
selected: a2, responses: value3});
|
|
object2 = {};
|
|
copyDataProperties(object2, addedChannelIds.reduce(_fun86985, {}), a2);
|
|
copyDataProperties(object2, removedChannelIds.reduce(_fun86986, {}), a2);
|
|
value = importDefault(6606) /* metro dependency 6606: GuildOnboardingActionCreators */;
|
|
value.selectOption(binding, a0.id, a1.id, a2);
|
|
value = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
value.dispatch({type: 'USER_GUILD_SETTINGS_CHANNEL_UPDATE_BULK', guildId: binding, overrides: object2});
|
|
(importDefault(6606) /* metro dependency 6606: GuildOnboardingActionCreators */).updateRolesLocal(binding,
|
|
addedRoleIds, removedRoleIds);
|
|
}
|
|
|
|
function _fun86970() { // fn#86970, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11541:573, offset: 0x01faa019, size: 23 bytes, params: 1, frame: 11
|
|
resetStoreState(env1_0);
|
|
}
|
|
|
|
function getRoles_86973(a0, a1, a2, a3) { // fn#86973, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11541:784, offset: 0x01faa1b9, size: 449 bytes, params: 5, frame: 22
|
|
var environment;
|
|
var r6;
|
|
var roleIds;
|
|
var r4;
|
|
var r1;
|
|
var r2;
|
|
var filter;
|
|
var value;
|
|
var value2;
|
|
var value3;
|
|
const isNotNullish = (require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish;
|
|
var difference;
|
|
var value7;
|
|
var value8;
|
|
var defaultImport2;
|
|
var value9;
|
|
var defaultImport3;
|
|
const env0_0 = a1;
|
|
const env0_1 = a3;
|
|
if (a0.singleSelect) {
|
|
if (a2) {
|
|
value = a0.options.find(function(a0) {
|
|
return importAll.includes(a0.id);
|
|
});
|
|
value7 = environment.__proto__.__proto__;
|
|
value8 = undefined;
|
|
defaultImport2 = importDefault(22) /* metro dependency 22 */;
|
|
difference = defaultImport2.difference;
|
|
roleIds = a1.roleIds;
|
|
r6 = roleIds ?? [];
|
|
roleIds = value == null ? value8 : value.roleIds;
|
|
value9 = Reflect.apply(difference, defaultImport2, [r6, roleIds ?? []]);
|
|
defaultImport3 = importDefault(22) /* metro dependency 22 */;
|
|
difference = defaultImport3.difference;
|
|
roleIds = value == null ? value8 : value.roleIds;
|
|
r4 = roleIds ?? [];
|
|
roleIds = a1.roleIds;
|
|
value = Reflect.apply(difference, defaultImport3, [r4, roleIds ?? []]);
|
|
r1 = value;
|
|
r2 = value9;
|
|
} else if (a2) {
|
|
r6 = a1.roleIds ?? [];
|
|
r1 = [];
|
|
r2 = r6;
|
|
} else {
|
|
value = a0.options.filter(_fun86975);
|
|
value2 = value.filter(_fun86976);
|
|
value = value.map(_fun86977);
|
|
value = value.flat();
|
|
filter = value.filter;
|
|
value3 = environment.__proto__.__proto__;
|
|
value = Reflect.apply(filter, value, [isNotNullish]);
|
|
value = (importDefault(22) /* metro dependency 22 */).difference(value,
|
|
value2.map(_fun86978).flat().filter(isNotNullish));
|
|
r1 = value;
|
|
r2 = [];
|
|
}
|
|
} else if (a2) {
|
|
r6 = a1.roleIds ?? [];
|
|
r1 = [];
|
|
r2 = r6;
|
|
} else {
|
|
value = a0.options.filter(_fun86975);
|
|
value2 = value.filter(_fun86976);
|
|
value = value.map(_fun86977);
|
|
value = value.flat();
|
|
filter = value.filter;
|
|
value3 = environment.__proto__.__proto__;
|
|
value = Reflect.apply(filter, value, [isNotNullish]);
|
|
value = (importDefault(22) /* metro dependency 22 */).difference(value,
|
|
value2.map(_fun86978).flat().filter(isNotNullish));
|
|
r1 = value;
|
|
r2 = [];
|
|
}
|
|
return {addedRoleIds: r2, removedRoleIds: r1};
|
|
}
|
|
|
|
function getChannels_86979({guildId, prompt, option, selected, responses}) { // fn#86979, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11541:1441, offset: 0x01faa394, size: 554 bytes, params: 2, frame: 24
|
|
var r13;
|
|
var environment;
|
|
var r7;
|
|
var channelIds;
|
|
var r4;
|
|
var r1;
|
|
var r2;
|
|
var filter;
|
|
var value;
|
|
var value2;
|
|
var value3;
|
|
const isNotNullish = (require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish;
|
|
var items;
|
|
var difference;
|
|
var value7;
|
|
var value8;
|
|
var defaultImport2;
|
|
var value9;
|
|
var value10;
|
|
var defaultImport3;
|
|
var push;
|
|
if (prompt.singleSelect) {
|
|
if (selected) {
|
|
value = prompt.options.find(function(a0) {
|
|
return responses.includes(a0.id);
|
|
});
|
|
value7 = environment.__proto__.__proto__;
|
|
value8 = undefined;
|
|
defaultImport2 = importDefault(22) /* metro dependency 22 */;
|
|
difference = defaultImport2.difference;
|
|
channelIds = option.channelIds;
|
|
r7 = channelIds ?? [];
|
|
value9 = value == null;
|
|
channelIds = value9 ? value8 : value.channelIds;
|
|
value10 = Reflect.apply(difference, defaultImport2, [r7, channelIds ?? []]);
|
|
defaultImport3 = importDefault(22) /* metro dependency 22 */;
|
|
difference = defaultImport3.difference;
|
|
channelIds = value == null ? value8 : value.channelIds;
|
|
r4 = channelIds ?? [];
|
|
channelIds = option.channelIds;
|
|
value = Reflect.apply(difference, defaultImport3, [r4, channelIds ?? []]);
|
|
r1 = value;
|
|
r2 = value10;
|
|
r13 = value9;
|
|
} else if (selected) {
|
|
r7 = option.channelIds ?? [];
|
|
r1 = [];
|
|
r2 = r7;
|
|
} else {
|
|
value = prompt.options.filter(_fun86981);
|
|
value2 = value.filter(_fun86982);
|
|
value = value.map(_fun86983);
|
|
value = value.flat();
|
|
filter = value.filter;
|
|
value3 = environment.__proto__.__proto__;
|
|
value = Reflect.apply(filter, value, [isNotNullish]);
|
|
value = (importDefault(22) /* metro dependency 22 */).difference(value,
|
|
value2.map(_fun86984).flat().filter(isNotNullish));
|
|
r1 = value;
|
|
r2 = [];
|
|
}
|
|
} else if (selected) {
|
|
r7 = option.channelIds ?? [];
|
|
r1 = [];
|
|
r2 = r7;
|
|
} else {
|
|
value = prompt.options.filter(_fun86981);
|
|
value2 = value.filter(_fun86982);
|
|
value = value.map(_fun86983);
|
|
value = value.flat();
|
|
filter = value.filter;
|
|
value3 = environment.__proto__.__proto__;
|
|
value = Reflect.apply(filter, value, [isNotNullish]);
|
|
value = (importDefault(22) /* metro dependency 22 */).difference(value,
|
|
value2.map(_fun86984).flat().filter(isNotNullish));
|
|
r1 = value;
|
|
r2 = [];
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
const optInOnboardingUtilsModule = require(11356) /* metro dependency 11356: OptInOnboardingUtils */;
|
|
if (optInOnboardingUtilsModule.hasNotSetUpChannelOptIn(guildId)) {
|
|
push = r2.push;
|
|
value = GuildOnboardingPromptsStore.getDefaultChannelIds(guildId);
|
|
items = [];
|
|
arraySpread(items, value, 0, r13);
|
|
apply(push, items, r2, r13);
|
|
}
|
|
return {addedChannelIds: r2, removedChannelIds: r1};
|
|
}
|
|
|
|
function _fun86985(a0, a1) { // fn#86985, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11541:2312, offset: 0x01faa5be, size: 91 bytes, params: 3, frame: 18
|
|
const channelIdFlags = UserGuildSettingsStore.getChannelIdFlags(env1_0, a1);
|
|
const flagUtilsModule = require(1391) /* metro dependency 1391: FlagUtils */;
|
|
const setFlag = flagUtilsModule.setFlag;
|
|
const OPT_IN_ENABLED = ChannelNotificationSettingsFlags.OPT_IN_ENABLED;
|
|
a0[a1] = {flags: Reflect.apply(setFlag, flagUtilsModule, [channelIdFlags, OPT_IN_ENABLED, true])};
|
|
return a0;
|
|
}
|
|
|
|
function _fun86986(a0, a1) { // fn#86986, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11541:2432, offset: 0x01faa619, size: 91 bytes, params: 3, frame: 18
|
|
const channelIdFlags = UserGuildSettingsStore.getChannelIdFlags(env1_0, a1);
|
|
const flagUtilsModule = require(1391) /* metro dependency 1391: FlagUtils */;
|
|
const setFlag = flagUtilsModule.setFlag;
|
|
const OPT_IN_ENABLED = ChannelNotificationSettingsFlags.OPT_IN_ENABLED;
|
|
a0[a1] = {flags: Reflect.apply(setFlag, flagUtilsModule, [channelIdFlags, OPT_IN_ENABLED, false])};
|
|
return a0;
|
|
}
|
|
|
|
function _fun86976({id}) { // fn#86976, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11541:1185, offset: 0x01faa37a, size: 26 bytes, params: 2, frame: 2
|
|
const id = require.id;
|
|
return id !== id;
|
|
}
|
|
|