// Module ID: 11840 // Function ID: 11841 // Name: PollsActionCreators // Dependencies: [5, 4400, 7840, 502, 2045, 5107, 5632, 4978, 5106, 11559, 1078, 38, 5110, 1119, 5739, 11841, 11843, 4938, 12, 504, 577, 8010, 11852, 4610, 11846, 7703, 9421, 4659, 2] // Module 11840 (PollsActionCreators) import AppAnalyticsUtilsDefault from "AppAnalyticsUtils" /* 4938 */; import AlertActionCreatorsDefault from "AlertActionCreators" /* 5110 */; import GuildActionCreatorsDefault from "GuildActionCreators" /* 5739 */; import PollInteractionUtilsAll from "PollInteractionUtils" /* 11841 */; import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */; import LurkingStore from "LurkingStore" /* 4400 */; import ReferencedMessageStore from "ReferencedMessageStore" /* 7840 */; import AuthenticationStore from "AuthenticationStore" /* 502 */; import ChannelStore from "ChannelStore" /* 2045 */; import GuildVerificationStore from "GuildVerificationStore" /* 5632 */; import MessageStore from "MessageStore" /* 4978 */; import UploadAttachmentStore from "UploadAttachmentStore" /* 5106 */; const require = fn; function getPollVoteEventProperties(arg0, arg1) { closure_0 = arg0; const items = [...arg1]; importDefault = 0; importAll = 0; for (const item10012 of items) { let tmp = (function _loop(item10012) { closure_0 = item10012; let poll_media; if (closure_0 != null) { const found = closure_0.find((answer_id) => answer_id.answer_id === parseInt(closure_0)); if (found != null) { poll_media = found.poll_media; } } let text; if (poll_media != null) { text = poll_media.text; } if (null != text) { closure_1 = closure_1 + 1; } let emoji; if (poll_media != null) { emoji = poll_media.emoji; } if (null != emoji) { closure_2 = closure_2 + 1; } })(item10012); continue; } return { analyticsSelectedAnswerIds: items, selectedTextAnswersCount: importDefault, selectedEmojiAnswersCount: importAll }; } function showLurkingAlert(guildId) { guildId = guildId.guildId; ({ title, body } = guildId); const obj2 = { title, body, confirmText: null, cancelText: null, onConfirm: null }; const intl = guildId(1119).intl; obj2.confirmText = intl.string(guildId(1119).t["9VLmlZ"]); const intl2 = guildId(1119).intl; obj2.cancelText = intl2.string(guildId(1119).t["2m+Sqk"]); obj2.onConfirm = function onConfirm() { GuildActionCreatorsDefault.joinGuild(guild_id, { source: constants2.POLL_ALERT }); }; AlertActionCreatorsDefault.show(obj2); } function handleShowVotesForAnswer(messageId) { ({ channelId, answerId } = messageId); const channel = ChannelStore.getChannel(channelId); if (null != channel) { if (LurkingStore.isLurking(channel.guild_id)) { const intl = guild_id(1119).intl; const intl2 = guild_id(1119).intl; guild_id = channel.guild_id; const stringResult = intl.string(guild_id(1119).t["7LpysO"]); const stringResult1 = intl2.string(guild_id(1119).t["5sHHoy"]); const obj2 = { title: stringResult, body: stringResult1, confirmText: null, cancelText: null, onConfirm: null }; const intl3 = guild_id(1119).intl; obj2.confirmText = intl3.string(guild_id(1119).t["9VLmlZ"]); const intl4 = guild_id(1119).intl; obj2.cancelText = intl4.string(guild_id(1119).t["2m+Sqk"]); obj2.onConfirm = function onConfirm() { GuildActionCreatorsDefault.joinGuild(guild_id, { source: constants2.POLL_ALERT }); }; AlertActionCreatorsDefault.show(obj2); } else { const message = MessageStore.getMessage(channelId, messageId.messageId); if (null != message) { if (null != message.poll) { if (0 !== message.poll.answers.length) { if (answerId == null) { const _String = String; answerId = String(message.poll.answers[0].answer_id); } const obj4 = { message, initialAnswerId: answerId }; PollInteractionUtilsAll.showVotesForAnswer(obj4); } } } } } } function handleUpdateVoteEditingState(channelId) { channelId = channelId.channelId; const isEditing = channelId.isEditing; state(channelId, channelId.messageId, (showResults) => { const obj = { channelId, selectedAnswerIds: new Set(), submitting: false, editing: isEditing, showResults: null }; let flag; if (showResults != null) { flag = showResults.showResults; } if (flag == null) { flag = false; } obj.showResults = flag; return obj; }); } function getCurrentAnswerIds(channelId) { const message = MessageStore.getMessage(channelId.channelId, channelId.messageId); if (null == message) { let items = []; } else { const reactions = message.reactions; items = reactions.flatMap((me_vote) => { if (true === me_vote.me_vote) { let name = me_vote.emoji.name; } else { name = []; } return name; }); } return items; } function optimisticallySetAnswers() { const self = this; const apply = closure_23.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; } let closure_23 = async function _optimisticallySetAnswers(arg0, value) { if (1 === tmp5) { if (arg0 === 1) { c5 = 3; throw value; } else if (arg0 === 2) { c5 = 3; return { value, done: true }; } else { closure_130_3 = closure_131_21({ channelId: closure_130_0, messageId: closure_130_1 }); closure_130_4 = closure_131_1(closure_131_3[18]).difference(closure_130_3, closure_130_2); closure_131_1(closure_131_3[18]); closure_130_5 = closure_131_1(closure_131_3[18]).difference(closure_130_2, closure_130_3); let id = closure_131_7.getId(); let messageId = 0; const items = []; messageId = HermesBuiltin.arraySpread(closure_130_4.map((id) => ({ type: "MESSAGE_REACTION_REMOVE", id })), messageId); messageId = HermesBuiltin.arraySpread(closure_130_5.map((id) => ({ type: "MESSAGE_REACTION_ADD", id })), messageId); closure_130_7 = items; const Emitter = closure_131_1(closure_131_3[19]).Emitter; closure_130_8 = Emitter.batched(() => { let dispatchResult; for (const item10006 of closure_1_7) { let id = item10006.id; let obj = messageId(577); let obj2 = { type: item10006.type, channelId: null, messageId: null, emoji: null, userId: null, optimistic: true, reactionType: null }; obj2.channelId = channelId; obj2.messageId = messageId; let obj3 = { id, name: id }; obj2.emoji = obj3; obj2.userId = userId; obj2.reactionType = channelId(8010).ReactionTypes.VOTE; dispatchResult = obj.dispatch(obj2); continue; } return dispatchResult; }); if (null != closure_130_8) { c4 = 2; c5 = 1; return { value: closure_130_8, done: false }; } closure_131_1(closure_131_3[18]); } } else if (arg0 === 1) { c5 = 3; throw value; } else if (arg0 === 2) { c5 = 3; return { value, done: true }; } await "IconComponent"; closure_2 = tmp2; ({ channelId: closure_130_0, messageId: closure_130_1, answerIds: closure_130_2 } = channelId); return "Set"; }; function handlePollSubmitVote() { const self = this; const apply = closure_25.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; } let closure_25 = async function _handlePollSubmitVote(arg0, value) { if (c9 === 2) { c9 = 3; throw new TypeError("Generator functions may not be called on executing generators"); } else if (tmp6 === 3) { if (arg0 === 1) { throw value; } else if (arg0 === 2) { const obj2 = { value, done: true }; return obj2; } else { return { value: "IconComponent", done: null }; } } else { try { c9 = 2; if (0 === c8) { if (arg0 === 1) { c9 = 3; throw value; } else if (arg0 === 2) { c9 = 3; const obj4 = { value, done: true }; return obj4; } else { closure_5 = tmp3; closure_4 = tmp7; closure_132_0 = undefined; closure_132_1 = undefined; ({ channelId: closure_132_0, messageId: closure_132_1 } = closure_0); let channel; closure_132_3 = undefined; closure_132_4 = undefined; closure_132_5 = undefined; c8 = 1; c9 = 1; return { value: "Set", done: true }; } } else { if (1 === tmp7) { if (arg0 === 1) { c9 = 3; throw value; } else if (arg0 === 2) { c9 = 3; const obj5 = { value, done: true }; return obj5; } else { channel = closure_133_8.getChannel(closure_132_0); if (null != channel) { if (closure_133_5.isLurking(channel.guild_id)) { const obj6 = { guildId: channel.guild_id, title: null, body: null }; const intl7 = closure_133_0(closure_133_3[13]).intl; obj6.title = intl7.string(closure_133_0(closure_133_3[13]).t.Qic1FD); const intl8 = closure_133_0(closure_133_3[13]).intl; obj6.body = intl8.string(closure_133_0(closure_133_3[13]).t["5sHHoy"]); closure_133_18(obj6); } else if (closure_133_10.canChatInGuild(channel.guild_id)) { closure_132_3 = closure_133_13(closure_132_0, closure_132_1); closure_133_1(closure_133_3[11])(null != closure_132_3, "Must not be able to vote without existing state!"); const obj8 = { channelId: closure_132_0, messageId: closure_132_1 }; closure_132_4 = closure_133_21(obj8); c7 = 1; closure_3 = 0; const selectedAnswerIds = closure_132_3.selectedAnswerIds; const items = []; closure_3 = HermesBuiltin.arraySpread(selectedAnswerIds.values(), closure_3); closure_132_5 = items; closure_133_14(closure_132_0, closure_132_1, (arg0) => { body(closure_1_3[11])(null != arg0, "Must not be able to vote without existing state!"); const obj = {}; const merged = Object.assign(arg0); obj.submitting = true; obj.editing = false; return obj; }); const obj9 = { channelId: closure_132_0, messageId: closure_132_1, answerIds: closure_132_5 }; c8 = 3; c9 = 1; const obj10 = { value: closure_133_22(obj9), done: false }; return obj10; } else { const obj12 = { title: null, body: null }; const intl5 = closure_133_0(closure_133_3[13]).intl; obj12.title = intl5.string(closure_133_0(closure_133_3[13]).t.p245wu); const intl6 = closure_133_0(closure_133_3[13]).intl; obj12.body = intl6.string(closure_133_0(closure_133_3[13]).t["U/uodt"]); closure_133_1(closure_133_3[12]).show(obj12); const obj11 = closure_133_1(closure_133_3[12]); } } c9 = 3; } } else if (2 === tmp7) { c7 = 0; closure_132_6 = closure_6; const obj13 = { title: null, body: null }; const intl3 = closure_133_0(closure_133_3[13]).intl; obj13.title = intl3.string(closure_133_0(closure_133_3[13]).t.iufib1); const getAnyErrorMessage = closure_132_6.getAnyErrorMessage; let anyErrorMessage; if (getAnyErrorMessage != null) { anyErrorMessage = getAnyErrorMessage(); } let message = anyErrorMessage; if (anyErrorMessage == null) { message = closure_132_6.message; } let body = message; if (message == null) { const intl4 = closure_133_0(closure_133_3[13]).intl; body = intl4.string(closure_133_0(closure_133_3[13]).t.eAn6z2); } obj13.body = body; closure_133_1(closure_133_3[12]).show(obj13); const obj14 = { channelId: closure_132_0, messageId: closure_132_1, answerIds: closure_132_4 }; c8 = 5; c9 = 1; const obj15 = { value: closure_133_22(obj14), done: false }; return obj15; } else if (3 === tmp7) { if (arg0 === 1) { c9 = 3; throw value; } else if (arg0 === 2) { c7 = 0; c9 = 3; const obj16 = { value, done: true }; return obj16; } else { const obj17 = { channelId: closure_132_0, messageId: closure_132_1, answerIds: closure_132_5 }; c8 = 4; c9 = 1; const obj18 = { value: closure_133_2(closure_133_3[22]).submitPollVote(obj17), done: false }; return obj18; } } else if (4 === tmp7) { if (arg0 === 1) { c9 = 3; throw value; } else if (arg0 === 2) { c7 = 0; c9 = 3; const obj19 = { value, done: true }; return obj19; } else { closure_133_14(closure_132_0, closure_132_1, () => { }); const AccessibilityAnnouncer = closure_133_0(closure_133_3[23]).AccessibilityAnnouncer; if (0 === closure_132_5.length) { const intl2 = closure_133_0(closure_133_3[13]).intl; let stringResult = intl2.string(closure_133_0(closure_133_3[13]).t["xcvy+3"]); } else { const intl = closure_133_0(closure_133_3[13]).intl; stringResult = intl.string(closure_133_0(closure_133_3[13]).t.o20GSo); } AccessibilityAnnouncer.announce(stringResult); c7 = 0; } } else if (arg0 === 1) { c9 = 3; throw value; } else if (arg0 !== 2) { closure_133_14(closure_132_0, closure_132_1, (arg0) => { if (null != arg0) { const obj = {}; const merged = Object.assign(arg0); obj.submitting = false; obj.editing = false; return obj; } }); } c9 = 3; let obj = { value, done: true }; return obj; } } catch (tmp111) { closure_6 = tmp111; if (tmp4 === c7) { c9 = tmp2; throw tmp111; } else { c8 = tmp; } } } }; let closure_26 = async function _handleClearPollVote(arg0, value) { if (c4 === 2) { c4 = 3; throw new TypeError("Generator functions may not be called on executing generators"); } else if (tmp3 === 3) { if (arg0 === 1) { throw value; } else if (arg0 === 2) { const obj2 = { value, done: true }; return obj2; } else { return { value: "IconComponent", done: null }; } } else { try { c4 = 2; if (0 === c3) { if (arg0 === 1) { c4 = 3; throw value; } else if (arg0 === 2) { c4 = 3; const obj3 = { value, done: true }; return obj3; } else { closure_2 = tmp4; c1 = 0; closure_129_0 = undefined; closure_129_1 = undefined; ({ channelId: closure_129_0, messageId: closure_129_1 } = channelId); let channel; c3 = 1; c4 = 1; return { value: "Set", done: true }; } } else if (1 === tmp4) { if (arg0 === 1) { c4 = 3; throw value; } else if (arg0 === 2) { c4 = 3; const obj4 = { value, done: true }; return obj4; } else { channel = closure_130_8.getChannel(closure_129_0); if (null != channel) { if (closure_130_5.isLurking(channel.guild_id)) { const obj5 = { guildId: channel.guild_id, title: null, body: null }; const intl = closure_130_0(closure_130_3[13]).intl; obj5.title = intl.string(closure_130_0(closure_130_3[13]).t.B9QnBp); const intl2 = closure_130_0(closure_130_3[13]).intl; obj5.body = intl2.string(closure_130_0(closure_130_3[13]).t.BVZCTn); closure_130_18(obj5); } else { closure_130_14(closure_129_0, closure_129_1, (showResults) => { const obj = { channelId, selectedAnswerIds: new Set(), submitting: false, editing: false, showResults: null }; let flag; if (showResults != null) { flag = showResults.showResults; } if (flag == null) { flag = false; } obj.showResults = flag; return obj; }); const obj6 = { channelId: closure_129_0, messageId: closure_129_1 }; c3 = 2; c4 = 1; const obj7 = { value: closure_130_24(obj6), done: false }; return obj7; } } c4 = 3; return { value: "IconComponent", done: null }; } } else if (arg0 === 1) { c4 = 3; throw value; } else if (arg0 === 2) { c4 = 3; const obj8 = { value, done: true }; return obj8; } else { c4 = 3; let obj = { value, done: true }; return obj; } } catch (tmp18) { c4 = tmp; throw tmp18; } } }; let closure_27 = async function _handlePollActionTapped(arg0, value) { if (c4 === 2) { c4 = 3; throw new TypeError("Generator functions may not be called on executing generators"); } else if (tmp4 === 3) { if (arg0 === 1) { throw value; } else if (arg0 === 2) { let obj2 = { value, done: true }; return obj2; } else { return { value: "IconComponent", done: null }; } } else { try { c4 = 2; if (0 === c3) { if (arg0 === 1) { c4 = 3; throw value; } else if (arg0 === 2) { c4 = 3; const obj3 = { value, done: true }; return obj3; } else { closure_2 = tmp5; closure_1 = tmp2; closure_129_0 = undefined; closure_129_1 = undefined; closure_129_2 = undefined; ({ channelId: closure_129_0, messageId: closure_129_1, type: closure_129_2 } = closure_0); c3 = 1; c4 = 1; return { value: "Set", done: true }; } } else { if (1 === tmp5) { if (arg0 === 1) { c4 = 3; throw value; } else if (arg0 === 2) { c4 = 3; const obj4 = { value, done: true }; return obj4; } else if ("submit" === closure_129_2) { const obj5 = { channelId: closure_129_0, messageId: closure_129_1 }; c3 = 2; c4 = 1; const obj6 = { value: closure_130_24(obj5), done: false }; return obj6; } else if ("remove" === tmp39) { const obj7 = { channelId: closure_129_0, messageId: closure_129_1 }; c3 = 3; c4 = 1; const obj8 = { value: (function handleClearPollVote() { const self = this; const apply = closure_1_26.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; })(obj7), done: false }; return obj8; } else if ("cancel" === tmp39) { const obj9 = { channelId: closure_129_0, messageId: closure_129_1, isEditing: false }; closure_130_20(obj9); } else { if ("showVotes" === tmp39) { const obj10 = { channelId: closure_129_0, messageId: closure_129_1 }; (function handleShowVotes(channelId) { channelId = channelId.channelId; const messageId = channelId.messageId; closure_14(channelId, messageId, (showResults) => { message = message.getMessage(channelId, messageId); let num = 0; if (null != message) { const reactions = message.reactions; num = reactions.reduce((acc, count_details) => { count_details = count_details.count_details; let num; if (count_details != null) { num = count_details.vote; } if (num == null) { num = 0; } return acc + num; }, 0); } closure_2_1(dependencyMap[17]).trackWithMetadata(constants.POLL_SHOW_RESULTS_CLICKED, { channel_id: channelId, message_id: messageId, show_results: null == showResults || !showResults.showResults, votes_count: num }); const obj2 = { channelId, selectedAnswerIds: null, submitting: null, editing: null, showResults: null }; const obj = closure_2_1(dependencyMap[17]); obj2.selectedAnswerIds = new Set(); let flag; if (showResults != null) { flag = showResults.submitting; } if (flag == null) { flag = false; } obj2.submitting = flag; let flag2; if (showResults != null) { flag2 = showResults.submitting; } if (flag2 == null) { flag2 = false; } obj2.editing = flag2; obj2.showResults = null == showResults || !showResults.showResults; return obj2; }); })(obj10); } else if ("showVoterDetails" !== tmp39) { const _HermesInternal = HermesInternal; closure_130_1(closure_130_3[11])(false, "Unknown poll action type: " + closure_129_2); const tmp9 = closure_130_1(closure_130_3[11]); } const obj11 = { channelId: closure_129_0, messageId: closure_129_1 }; closure_130_19(obj11); } } else if (2 === tmp5) { if (arg0 === 1) { c4 = 3; throw value; } else if (arg0 === 2) { c4 = 3; const obj12 = { value, done: true }; return obj12; } } else if (arg0 === 1) { c4 = 3; throw value; } else if (arg0 === 2) { c4 = 3; let obj = { value, done: true }; return obj; } c4 = 3; } } catch (tmp33) { c4 = tmp; throw tmp33; } } }; let closure_28 = async function _createPoll(arg0, value) { if (c6 === 2) { c6 = 3; throw new TypeError("Generator functions may not be called on executing generators"); } else if (tmp6 === 3) { if (arg0 === 1) { throw value; } else if (arg0 === 2) { let obj2 = { value, done: true }; return obj2; } else { return { value: "IconComponent", done: null }; } } else { try { c6 = 2; if (0 === c5) { if (arg0 === 1) { c6 = 3; throw value; } else if (arg0 === 2) { c6 = 3; let obj3 = { value, done: true }; return obj3; } else { closure_2 = tmp3; closure_1 = tmp7; closure_129_0 = undefined; closure_129_1 = undefined; closure_129_2 = undefined; closure_129_3 = undefined; closure_129_4 = undefined; closure_129_5 = undefined; closure_129_6 = undefined; closure_129_7 = undefined; ({ channel: closure_129_0, question: closure_129_1, answers: closure_129_2, allowMultiSelect: closure_129_3, duration: closure_129_4, layout: closure_129_5, onClose: closure_129_6, scheduledTimestamp: closure_129_7 } = guildId); let uploads; closure_129_9 = undefined; closure_129_10 = undefined; c5 = 1; c6 = 1; return { value: "Set", done: true }; } } else if (1 === tmp7) { if (arg0 === 1) { c6 = 3; throw value; } else if (arg0 === 2) { c6 = 3; let obj4 = { value, done: true }; return obj4; } else { uploads = closure_130_12.getUploads(closure_129_0.id, closure_130_9.Poll); closure_129_9 = closure_129_2.map((text) => { guildId = text; let findIndexResult; if (closure_1_8 != null) { findIndexResult = closure_1_8.findIndex((id) => id.id === text.localCreationAnswerId); } let tmp2; if (-1 !== findIndexResult) { const _HermesInternal = HermesInternal; const items = ["" + findIndexResult]; tmp2 = items; } const obj2 = { attachment_ids: tmp2 }; if (closure_1_5 === guildId(11846).PollLayoutTypes.DEFAULT) { let trimmed; if (text.text != null) { trimmed = str2.trim(); } obj2.text = trimmed; } const image = text.image; let emoji; if (image != null) { emoji = image.emoji; } if (null != emoji) { if (null != emoji.id) { const obj3 = { id: emoji.id, name: "" }; obj2.emoji = obj3; } else if (null != emoji.optionallyDiverseSequence) { const obj4 = { name: emoji.optionallyDiverseSequence }; obj2.emoji = obj4; } } return { poll_media: obj2 }; }); const obj5 = { question: null, answers: null, allow_multiselect: null, duration: null, layout_type: null }; const obj6 = { text: closure_129_1.trim() }; obj5.question = obj6; obj5.answers = closure_129_9; obj5.allow_multiselect = closure_129_3; obj5.duration = closure_129_4; obj5.layout_type = closure_129_5; closure_129_10 = obj5; c4 = 1; const obj7 = { attachmentsToUpload: uploads, scheduledTimestamp: closure_129_7, onAttachmentUploadError(file, code, reason) { const obj = guildId(9421); const result = obj.handleUploadMessageAttachmentsErrors({ file, guildId: guildId.getGuildId(), analyticsLocations: [], code, reason }); } }; c5 = 3; c6 = 1; const obj8 = { value: closure_130_1(closure_130_3[25]).sendPollMessage(closure_129_0.id, closure_129_10, obj7), done: false }; return obj8; } } else { if (2 === tmp7) { c4 = 0; closure_129_11 = dependencyMap; if (closure_129_11 instanceof closure_130_0(closure_130_3[27]).APIError) { let aPIError = closure_129_11; } else { aPIError = new closure_130_0(closure_130_3[27]).APIError(closure_129_11); } if ("poll" === aPIError.getAnyErrorMessage()) { if (null != closure_129_11.text) { const obj9 = {}; const merged = Object.assign(closure_129_11); const _JSON = JSON; obj9.body = JSON.parse(closure_129_11.text); throw obj9; } } if (null == closure_129_7) { throw closure_129_11; } else { c6 = 3; } } else if (arg0 === 1) { c6 = 3; throw value; } else if (arg0 !== 2) { if (closure_129_6 != null) { tmp9(closure_129_7); } c4 = 0; } c4 = 0; c6 = 3; let obj = { value, done: true }; return obj; } } catch (tmp38) { dependencyMap = tmp38; if (tmp4 === c4) { c6 = tmp2; throw tmp38; } else { c5 = tmp; } } } }; let closure_29 = async function _endPollEarly(arg0, value) { const obj6 = { title: null, body: null }; const intl = closure_130_0(closure_130_3[13]).intl; obj6.title = intl.string(closure_130_0(closure_130_3[13]).t["+rfkTK"]); const intl2 = closure_130_0(closure_130_3[13]).intl; obj6.body = intl2.string(closure_130_0(closure_130_3[13]).t.H2I1gL); await closure_130_1(closure_130_3[12]).confirm(obj6); if (2 === tmp5) { if (arg0 === 1) { c4 = 3; throw value; } else if (arg0 === 2) { c4 = 3; return { value, done: true }; } else if (value) { c3 = 3; c4 = 1; return { value: closure_130_2(closure_130_3[22]).endPollEarly({ channelId: closure_129_0, messageId: closure_129_1 }), done: false }; } } else if (arg0 === 1) { c4 = 3; throw value; } else if (arg0 === 2) { c4 = 3; return { value, done: true }; } await "IconComponent"; closure_1 = tmp2; ({ channelId: closure_129_0, messageId: closure_129_1 } = closure_0); return "Set"; }; const DraftType = fn(5107).DraftType; const PollsInteractionStore = fn(11559); ({ getPollState: map1, updatePollState: closure_14 } = PollsInteractionStore); const Constants = fn(1078); ({ AnalyticEvents: closure_15, JoinGuildSources: closure_16 } = Constants); const size = fn(2); let result = size.fileFinishedImporting("modules/polls/PollsActionCreators.tsx"); export default { handlePollAnswerTapped(answerId) { answerId = answerId.answerId; let merged = Object.assign(answerId, Object.assign({ answerId: 0 })); let channelId2; let messageId2; let message; let allow_multiselect; ({ channelId, messageId } = merged); const message1 = MessageStore.getMessage(channelId, messageId); if (null != message1) { let obj2 = { message: message1, channelId, messageId }; let obj = obj2; } else { const message2 = ReferencedMessageStore.getMessage(channelId, messageId); if (null != message2.message) { obj = { channelId, messageId, message: message2.message }; } else { channelId2(message[11])(null != message1, "Tapped on a non-existent poll message"); const _Error = Error; const error = new Error(); throw error; } } channelId2 = obj.channelId; messageId2 = obj.messageId; message = obj.message; let basicPollChatData = answerId(message[16]).computeBasicPollChatData(message); if (basicPollChatData == null) { basicPollChatData = {}; } if (true !== basicPollChatData.tapShouldOpenVotersModal) { let poll = message.poll; allow_multiselect = undefined; if (poll != null) { allow_multiselect = poll.allow_multiselect; } closure_14(channelId2, messageId2, (arg0) => { if (null == arg0) { const _Set = Set; const items = [answerId]; const set = new Set(items); const poll2 = message.poll; let answers; if (poll2 != null) { answers = poll2.answers; } ({ analyticsSelectedAnswerIds: analyticsSelectedAnswerIds2, selectedTextAnswersCount: selectedTextAnswersCount2, selectedEmojiAnswersCount: selectedEmojiAnswersCount2 } = getPollVoteEventProperties(answers, set)); const tmp24Result = getPollVoteEventProperties(answers, set); const obj2 = { channel_id: channelId2, message_id: messageId2, selected_answer_ids: analyticsSelectedAnswerIds2, selected_text_answers_count: selectedTextAnswersCount2, selected_emoji_answers_count: selectedEmojiAnswersCount2 }; AppAnalyticsUtilsDefault.trackWithMetadata(constants.POLL_VOTE_SELECTED, obj2); const obj4 = { channelId: channelId2, selectedAnswerIds: set, submitting: false, editing: false, showResults: false }; return obj4; } else { const obj5 = {}; const merged = Object.assign(arg0); const _Set2 = Set; const set1 = new Set(obj5.selectedAnswerIds); obj5.selectedAnswerIds = set1; if (set1.has(answerId)) { set1.delete(tmp42); } else { if (!allow_multiselect) { for (const item10007 of tmp41) { let deleteResult1 = set1.delete(item10007); continue; } } set1.add(answerId); } const poll = message.poll; let answers1; if (poll != null) { answers1 = poll.answers; } ({ analyticsSelectedAnswerIds, selectedTextAnswersCount, selectedEmojiAnswersCount } = getPollVoteEventProperties(answers1, set1)); tmp42 = answerId; const tmp8Result = getPollVoteEventProperties(answers1, set1); const obj6 = { channel_id: channelId2, message_id: messageId2, selected_answer_ids: analyticsSelectedAnswerIds, selected_text_answers_count: selectedTextAnswersCount, selected_emoji_answers_count: selectedEmojiAnswersCount }; AppAnalyticsUtilsDefault.trackWithMetadata(constants.POLL_VOTE_SELECTED, obj6); return obj5; } }); } else { let obj4 = { channelId: channelId2, messageId: messageId2, answerId }; handleShowVotesForAnswer(obj4); } }, handlePollSubmitVote, handleUpdateVoteEditingState, handlePollActionTapped() { const self = this; const apply = closure_27.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; }, createPoll() { const self = this; const apply = closure_28.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; }, endPollEarly() { const self = this; const apply = closure_29.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; } }; export { handleShowVotesForAnswer };