decord/source/modules/guild_onboarding/useBatchUpdateSelectOption.tsx

205 lines
8 KiB
TypeScript
Raw Normal View History

2026-09-02 09:53:35 +00:00
// Module ID: 11374
// Function ID: 11375
2026-07-29 08:29:29 +00:00
// Name: useBatchUpdateSelectOption
2026-09-02 09:53:35 +00:00
// Dependencies: [19, 4701, 5475, 682, 706, 12, 1470, 11375, 586, 5480, 1398, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-09-02 09:53:35 +00:00
// Module 11374 (useBatchUpdateSelectOption)
2026-08-24 06:08:38 +00:00
import closure_3 from "noop" /* 19 */;
2026-09-01 10:26:29 +00:00
import closure_4 from "updateUserGuildSettingsInternal" /* 4701 */;
2026-09-02 09:53:35 +00:00
import closure_5 from "handleUpdate" /* 5475 */;
import { ChannelNotificationSettingsFlags as closure_6 } from "MAX_FAVORITES" /* 682 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
let closure_7 = {};
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/guild_onboarding/useBatchUpdateSelectOption.tsx");
2026-07-20 16:05:17 +00:00
export default function useBatchUpdateSelectOption(arg0) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-09-02 09:53:35 +00:00
let obj = _require(586);
2026-08-24 06:08:38 +00:00
let items = [closure_5];
2026-07-23 10:11:24 +00:00
let items1 = [arg0];
2026-07-20 16:05:17 +00:00
const stateFromStores = obj.useStateFromStores(items, () => {
2026-08-24 06:08:38 +00:00
let pendingResponseOptions = closure_1_5.getPendingResponseOptions(closure_0);
2026-07-29 08:29:29 +00:00
if (pendingResponseOptions == null) {
2026-08-24 06:08:38 +00:00
pendingResponseOptions = closure_1_7;
2026-07-20 16:05:17 +00:00
}
return pendingResponseOptions;
}, items1);
2026-07-29 08:29:29 +00:00
let items2 = [arg0];
2026-07-20 16:05:17 +00:00
const effect = React.useEffect(() => {
2026-08-24 06:08:38 +00:00
let obj = stateFromStores(closure_1_2[4]);
2026-07-29 08:29:29 +00:00
obj = { type: "CLEAR_PENDING_CHANNEL_AND_ROLE_UPDATES", guildId: closure_0 };
obj.dispatch(obj);
2026-07-20 16:05:17 +00:00
return () => {
2026-08-24 06:08:38 +00:00
let obj = closure_1_1(closure_1_2[4]);
2026-07-29 08:29:29 +00:00
obj = { type: "CLEAR_PENDING_CHANNEL_AND_ROLE_UPDATES", guildId: closure_0 };
obj.dispatch(obj);
2026-07-20 16:05:17 +00:00
};
}, items2);
const items3 = [arg0, stateFromStores];
const effect1 = React.useEffect(() => {
2026-07-29 08:29:29 +00:00
let tmp2 = null != stateFromStores;
if (tmp2) {
2026-07-20 16:05:17 +00:00
const _Object = Object;
2026-07-29 08:29:29 +00:00
tmp2 = 0 !== Object.keys(tmp).length;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp2) {
2026-08-24 06:08:38 +00:00
const result = stateFromStores(closure_1_2[9]).updateOnboardingResponses(closure_0);
const obj = stateFromStores(closure_1_2[9]);
2026-07-20 16:05:17 +00:00
}
}, items3);
obj = {
2026-07-29 08:29:29 +00:00
handleSelectOption: React.useCallback((singleSelect, roleIds) => {
2026-08-24 06:08:38 +00:00
let obj = closure_1_5;
const onboardingResponses = closure_1_5.getOnboardingResponses(callback);
2026-07-29 08:29:29 +00:00
callback = roleIds;
if (singleSelect.singleSelect) {
if (arg2) {
const options = singleSelect.options;
const found = options.find((id) => onboardingResponses.includes(id.id));
roleIds = roleIds.roleIds;
if (roleIds == null) {
roleIds = [];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let roleIds1;
if (found != null) {
roleIds1 = found.roleIds;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (roleIds1 == null) {
roleIds1 = [];
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const obj5 = stateFromStores(closure_1_2[5]);
2026-07-29 08:29:29 +00:00
const tmp10 = stateFromStores;
2026-08-24 06:08:38 +00:00
const tmp11 = closure_1_2;
const differenceResult = stateFromStores(closure_1_2[5]).difference(roleIds, roleIds1);
2026-07-29 08:29:29 +00:00
let roleIds2;
if (found != null) {
roleIds2 = found.roleIds;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (roleIds2 == null) {
roleIds2 = [];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let roleIds3 = roleIds.roleIds;
if (roleIds3 == null) {
roleIds3 = [];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let differenceResult1 = tmp10(tmp11[5]).difference(roleIds2, roleIds3);
let items2 = differenceResult;
const tmp10Result = tmp10(tmp11[5]);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
callback = roleIds;
if (singleSelect.singleSelect) {
if (arg2) {
const options1 = singleSelect.options;
const found1 = options1.find((id) => onboardingResponses.includes(id.id));
let channelIds = roleIds.channelIds;
if (channelIds == null) {
2026-07-20 16:05:17 +00:00
channelIds = [];
}
let channelIds1;
2026-07-29 08:29:29 +00:00
if (found1 != null) {
channelIds1 = found1.channelIds;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (channelIds1 == null) {
2026-07-20 16:05:17 +00:00
channelIds1 = [];
}
2026-08-24 06:08:38 +00:00
const obj10 = stateFromStores(closure_1_2[5]);
2026-07-29 08:29:29 +00:00
const tmp21 = stateFromStores;
2026-08-24 06:08:38 +00:00
const tmp22 = closure_1_2;
const differenceResult2 = stateFromStores(closure_1_2[5]).difference(channelIds, channelIds1);
2026-07-20 16:05:17 +00:00
let channelIds2;
2026-07-29 08:29:29 +00:00
if (found1 != null) {
channelIds2 = found1.channelIds;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (channelIds2 == null) {
2026-07-20 16:05:17 +00:00
channelIds2 = [];
}
2026-07-29 08:29:29 +00:00
let channelIds3 = roleIds.channelIds;
if (channelIds3 == null) {
2026-07-20 16:05:17 +00:00
channelIds3 = [];
}
2026-07-29 08:29:29 +00:00
let differenceResult3 = tmp21(tmp22[5]).difference(channelIds2, channelIds3);
let items1 = differenceResult2;
const tmp21Result = tmp21(tmp22[5]);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (obj12.hasNotSetUpChannelOptIn(tmp)) {
2026-07-20 16:05:17 +00:00
const push = items1.push;
const items = [];
2026-07-29 08:29:29 +00:00
HermesBuiltin.arraySpread(obj.getDefaultChannelIds(tmp), 0);
2026-07-20 16:05:17 +00:00
HermesBuiltin.apply(items, items1);
}
2026-07-29 08:29:29 +00:00
obj = {};
const merged = Object.assign(items1.reduce((arg0, id) => {
const obj = { flags: null };
2026-08-24 06:08:38 +00:00
const channelIdFlags = closure_1_4.getChannelIdFlags(lib, id);
obj[0] = lib(closure_1_2[10]).setFlag(channelIdFlags, closure_1_6.OPT_IN_ENABLED, true);
2026-07-29 08:29:29 +00:00
arg0[id] = obj;
return arg0;
}, {}));
const merged1 = Object.assign(differenceResult3.reduce((arg0, id) => {
const obj = { flags: null };
2026-08-24 06:08:38 +00:00
const channelIdFlags = closure_1_4.getChannelIdFlags(lib, id);
obj[0] = lib(closure_1_2[10]).setFlag(channelIdFlags, closure_1_6.OPT_IN_ENABLED, false);
2026-07-29 08:29:29 +00:00
arg0[id] = obj;
return arg0;
}, {}));
2026-08-24 06:08:38 +00:00
const obj14 = stateFromStores(closure_1_2[9]);
2026-07-29 08:29:29 +00:00
const option = obj14.selectOption(tmp, singleSelect.id, roleIds.id, arg2);
2026-08-24 06:08:38 +00:00
obj12 = callback(closure_1_2[7]);
2026-07-29 08:29:29 +00:00
obj = { type: "USER_GUILD_SETTINGS_CHANNEL_UPDATE_BULK", guildId: null, overrides: null };
obj[1] = tmp;
obj[2] = obj;
2026-08-24 06:08:38 +00:00
stateFromStores(closure_1_2[4]).dispatch(obj);
const obj15 = stateFromStores(closure_1_2[4]);
stateFromStores(closure_1_2[9]).updateRolesLocal(tmp, items2, differenceResult1);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (arg2) {
let channelIds4 = roleIds.channelIds;
if (channelIds4 == null) {
2026-07-20 16:05:17 +00:00
channelIds4 = [];
}
2026-07-29 08:29:29 +00:00
differenceResult3 = [];
2026-07-20 16:05:17 +00:00
items1 = channelIds4;
} else {
2026-07-29 08:29:29 +00:00
const options2 = singleSelect.options;
const found2 = options2.filter((id) => onboardingResponses.includes(id.id));
const found3 = found2.filter((id) => lib.id !== id.id);
const mapped = found2.map((channelIds) => channelIds.channelIds);
2026-08-24 06:08:38 +00:00
const found4 = mapped.flat().filter(callback(closure_1_2[6]).isNotNullish);
2026-07-29 08:29:29 +00:00
const mapped1 = found3.map((channelIds) => channelIds.channelIds);
2026-07-20 16:05:17 +00:00
const flatResult = mapped.flat();
items1 = [];
2026-08-24 06:08:38 +00:00
const found5 = mapped1.flat().filter(callback(closure_1_2[6]).isNotNullish);
2026-07-20 16:05:17 +00:00
const flatResult1 = mapped1.flat();
2026-08-24 06:08:38 +00:00
differenceResult3 = stateFromStores(closure_1_2[5]).difference(found4, found5);
const obj9 = stateFromStores(closure_1_2[5]);
2026-07-29 08:29:29 +00:00
}
}
if (arg2) {
let roleIds4 = roleIds.roleIds;
if (roleIds4 == null) {
roleIds4 = [];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
differenceResult1 = [];
items2 = roleIds4;
} else {
const options3 = singleSelect.options;
const found6 = options3.filter((id) => onboardingResponses.includes(id.id));
const found7 = found6.filter((id) => lib.id !== id.id);
const mapped2 = found6.map((roleIds) => roleIds.roleIds);
2026-08-24 06:08:38 +00:00
const found8 = mapped2.flat().filter(callback(closure_1_2[6]).isNotNullish);
2026-07-29 08:29:29 +00:00
const mapped3 = found7.map((roleIds) => roleIds.roleIds);
const flatResult2 = mapped2.flat();
items2 = [];
2026-08-24 06:08:38 +00:00
const found9 = mapped3.flat().filter(callback(closure_1_2[6]).isNotNullish);
2026-07-29 08:29:29 +00:00
const flatResult3 = mapped3.flat();
2026-08-24 06:08:38 +00:00
differenceResult1 = stateFromStores(closure_1_2[5]).difference(found8, found9);
const obj4 = stateFromStores(closure_1_2[5]);
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
}, items4)
};
2026-07-23 10:11:24 +00:00
items4 = [arg0];
2026-07-20 16:05:17 +00:00
return obj;
};