decord/source/modules/polls/PollsInteractionStore.tsx

133 lines
4.1 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 8476
// Function ID: 8477
2026-07-20 16:05:17 +00:00
// Name: useMessagePollInteractions
2026-07-29 08:29:29 +00:00
// Dependencies: [700, 705, 643, 11, 2]
2026-07-20 16:05:17 +00:00
// Exports: clearChannelPollState, clearPollState, getPollState, updatePollState, useChannelPollInteractions, useMessagePollInteractions
2026-08-25 06:04:03 +00:00
// Module 8476 (useMessagePollInteractions)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
import shallowEqualDefault from "shallowEqual" /* 643 */;
import identity from "identity" /* 700 */;
2026-07-23 10:11:24 +00:00
2026-07-20 16:05:17 +00:00
let closure_3 = {};
2026-07-29 08:29:29 +00:00
let closure_4 = identity.createWithEqualityFn((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-20 16:05:17 +00:00
return {
pollsByChannelId: {},
pollsByMessageId: {},
updatePollState(arg0, arg1, arg2) {
2026-07-23 10:11:24 +00:00
const callback = arg0;
2026-08-24 06:08:38 +00:00
closure_1 = arg1;
closure_2 = arg2;
callback(closure_1_2[1]).batchUpdates(() => {
2026-07-23 10:11:24 +00:00
callback((pollsByChannelId) => {
2026-07-29 08:29:29 +00:00
let tmp4;
if (pollsByChannelId.pollsByChannelId[closure_0] != null) {
tmp4 = tmp3[closure_1];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const tmpResult = closure_2(tmp4);
let obj = { pollsByChannelId: null, pollsByMessageId: null };
2026-07-20 16:05:17 +00:00
obj = {};
const merged = Object.assign(pollsByChannelId.pollsByChannelId);
obj = {};
2026-07-29 08:29:29 +00:00
const merged1 = Object.assign(pollsByChannelId.pollsByChannelId[tmp2]);
obj[closure_1] = tmpResult;
obj[closure_0] = obj;
obj[0] = obj;
2026-08-24 06:08:38 +00:00
obj1 = {};
2026-07-20 16:05:17 +00:00
const merged2 = Object.assign(pollsByChannelId.pollsByMessageId);
2026-07-29 08:29:29 +00:00
obj1[closure_1] = tmpResult;
obj[1] = obj1;
2026-07-20 16:05:17 +00:00
return obj;
});
});
}
};
});
2026-08-24 06:08:38 +00:00
const result = set.fileFinishedImporting("modules/polls/PollsInteractionStore.tsx");
2026-07-20 16:05:17 +00:00
export const useMessagePollInteractions = function useMessagePollInteractions(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-20 16:05:17 +00:00
return store((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const obj = {};
2026-07-23 10:11:24 +00:00
const item = closure_0.forEach((arg0) => {
if (null != pollsByMessageId.pollsByMessageId[arg0]) {
2026-07-20 16:05:17 +00:00
obj[arg0] = tmp;
}
});
return obj;
2026-08-24 06:08:38 +00:00
}, shallowEqualDefault);
2026-07-20 16:05:17 +00:00
};
export const useChannelPollInteractions = function useChannelPollInteractions(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-20 16:05:17 +00:00
return store((arg0) => {
let tmp = arg0.pollsByChannelId[closure_0];
2026-07-29 08:29:29 +00:00
if (tmp == null) {
2026-08-24 06:08:38 +00:00
tmp = closure_1_3;
2026-07-20 16:05:17 +00:00
}
return tmp;
2026-08-24 06:08:38 +00:00
}, shallowEqualDefault);
2026-07-20 16:05:17 +00:00
};
export const clearChannelPollState = function clearChannelPollState(arg0) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-07-29 08:29:29 +00:00
_require(705).batchUpdates(() => {
2026-08-24 06:08:38 +00:00
closure_1_4.setState((arg0) => {
2026-07-20 16:05:17 +00:00
({ pollsByChannelId, pollsByMessageId } = arg0);
pollsByMessageId = undefined;
2026-07-29 08:29:29 +00:00
let tmp3 = pollsByChannelId[pollsByMessageId];
if (tmp3 == null) {
2026-08-24 06:08:38 +00:00
tmp3 = closure_1_3;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
pollsByMessageId = closure_1_1(closure_1_2[3]);
2026-07-23 10:11:24 +00:00
const keys = pollsByMessageId.keys(tmp3);
2026-07-20 16:05:17 +00:00
pollsByMessageId = {};
const merged = Object.assign(pollsByMessageId);
const item = keys.forEach((arg0) => {
2026-07-23 10:11:24 +00:00
delete tmp2[tmp];
2026-07-20 16:05:17 +00:00
});
const merged1 = Object.assign(pollsByChannelId);
2026-07-23 10:11:24 +00:00
delete tmp2[tmp];
2026-07-20 16:05:17 +00:00
return { pollsByChannelId: {}, pollsByMessageId };
});
});
};
export const clearPollState = function clearPollState(arg0, arg1) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-08-24 06:08:38 +00:00
closure_1 = arg1;
2026-07-29 08:29:29 +00:00
_require(705).batchUpdates(() => {
2026-08-24 06:08:38 +00:00
closure_1_4.setState((arg0) => {
2026-07-20 16:05:17 +00:00
({ pollsByChannelId, pollsByMessageId } = arg0);
2026-07-29 08:29:29 +00:00
let obj = pollsByChannelId[closure_0];
if (obj == null) {
2026-07-20 16:05:17 +00:00
obj = {};
}
2026-07-29 08:29:29 +00:00
obj = {};
2026-07-20 16:05:17 +00:00
const merged = Object.assign(obj);
2026-07-23 10:11:24 +00:00
delete tmp3[tmp];
2026-07-20 16:05:17 +00:00
obj = {};
const merged1 = Object.assign(pollsByMessageId);
2026-07-23 10:11:24 +00:00
delete tmp2[tmp];
2026-08-24 06:08:38 +00:00
obj1 = { pollsByChannelId: null, pollsByMessageId: null };
2026-07-20 16:05:17 +00:00
const obj2 = {};
const merged2 = Object.assign(pollsByChannelId);
2026-07-29 08:29:29 +00:00
obj2[closure_0] = obj;
obj1[0] = obj2;
obj1[1] = obj;
2026-07-20 16:05:17 +00:00
return obj1;
});
});
};
export const updatePollState = function updatePollState(arg0, arg1, arg2) {
const state = store.getState();
state.updatePollState(arg0, arg1, arg2);
};
export const getPollState = function getPollState(channelId, id) {
const tmp = store.getState().pollsByChannelId[channelId];
let tmp2;
2026-07-29 08:29:29 +00:00
if (tmp != null) {
2026-07-20 16:05:17 +00:00
tmp2 = tmp[id];
}
return tmp2;
};