// Module ID: 16275 // Function ID: 16276 // Name: ThreadLongPressActionSheet // Dependencies: [19, 1958, 1980, 4655, 4659, 4280, 1074, 21, 10390, 1115, 10391, 10393, 7082, 7224, 10369, 4580, 7885, 10182, 8002, 4602, 4592, 10395, 5182, 10397, 8780, 4582, 11114, 9213, 4607, 10290, 1897, 9927, 11120, 11466, 504, 7383, 12, 8025, 4793, 1936, 11133, 5672, 1177, 7311, 11159, 7313, 10778, 7303, 4337, 2] // Exports: default // Module 16275 (ThreadLongPressActionSheet) import _modDef12 from "module_12" /* 12 */; import asyncRequireImpl from "asyncRequireImpl" /* 1897 */; import ToastUtils from "ToastUtils" /* 4337 */; import ActionSheetActionCreatorsDefault from "ActionSheetActionCreators" /* 4607 */; import ReadStateActionCreators from "ReadStateActionCreators" /* 7224 */; import ClipboardUtils from "ClipboardUtils" /* 7303 */; import ActionSheetRow from "ActionSheetRow" /* 7313 */; import ThreadActionCreatorsDefault from "ThreadActionCreators" /* 7885 */; import ChannelSettingsActionCreatorsDefault from "ChannelSettingsActionCreators" /* 8780 */; import markChannelUnreadDefault from "markChannelUnread" /* 10393 */; import ChannelActionSheetUtils from "ChannelActionSheetUtils" /* 11114 */; import threadActionSheets from "threadActionSheets" /* 11466 */; import noop from "module_19" /* 19 */; import ChannelStore from "ChannelStore" /* 1958 */; import GuildStore from "GuildStore" /* 1980 */; import ReadStateStore from "ReadStateStore" /* 4655 */; import VoiceStateStore from "VoiceStateStore" /* 4659 */; import JoinedThreadsStore from "JoinedThreadsStore" /* 4280 */; const require = globalThis.__r; require = fn; function ThreadLongPressActionSheetConnected(channel) { channel = channel.channel; const onClose = channel.onClose; let items5; dependencyMap = channel.getGuildId(); const tmp = channel; const items = [GuildStore]; const stateFromStores = channel(504).useStateFromStores(items, () => GuildStore.getGuild(closure_2)); let obj = channel(504); const items1 = [JoinedThreadsStore]; const stateFromStoresObject = channel(504).useStateFromStoresObject(items1, () => ({ isMuted: JoinedThreadsStore.isMuted(channel.id), hasJoined: JoinedThreadsStore.hasJoined(channel.id) })); ({ isMuted, hasJoined } = stateFromStoresObject); let obj2 = channel(504); const items2 = [ReadStateStore]; const stateFromStores1 = channel(504).useStateFromStores(items2, () => ReadStateStore.hasUnreadOrMentions(channel.id)); const obj3 = channel(504); const canMarkChannelUnread = channel(10393).useCanMarkChannelUnread(channel); const obj4 = channel(10393); const canManageThread = channel(7383).useCanManageThread(channel); const obj5 = channel(7383); const isThreadModerator = channel(7383).useIsThreadModerator(channel); const obj6 = channel(7383); const canUnarchiveThread = channel(7383).useCanUnarchiveThread(channel); const obj7 = channel(7383); const canJoinThreadVoice = channel(7383).useCanJoinThreadVoice(channel); const obj8 = channel(7383); const items3 = [VoiceStateStore]; const stateFromStores2 = channel(504).useStateFromStores(items3, () => VoiceStateStore.isInChannel(channel.id)); const obj9 = channel(504); const items4 = [VoiceStateStore]; const stateFromStores3 = channel(504).useStateFromStores(items4, () => !_modDef12.isEmpty(VoiceStateStore.getVoiceStatesForChannel(channel.id))); const obj10 = channel(504); const tmp14 = onClose(8025)(channel); const DeveloperMode = channel(1936).DeveloperMode; let setting = DeveloperMode.useSetting(); const tmp15 = onClose(4793)(channel); if (null != stateFromStores) { const obj11 = { guild: stateFromStores, size: tmp(5672).GuildIconSizes.LARGE }; let tmp19 = closure_13(tmp13(5672), obj11); let tmp18 = closure_13; const tmp13Result = tmp13(5672); } else { tmp18 = closure_13; const obj12 = { size: tmp(1177).AvatarSizes.LARGE, channel }; tmp19 = closure_13(tmp(1177).Avatar, obj12); } const isForumPostResult = channel.isForumPost(); let tmp23 = null; if (canJoinThreadVoice) { tmp23 = null; if (!stateFromStores2) { tmp23 = tmp14; } } closure_129_0 = channel; closure_129_1 = isMuted; const obj13 = { sectionKey: "mark-as-read", buttons: [] }; const MarkChannelUnreadExperiment = tmp(10390).MarkChannelUnreadExperiment; if (MarkChannelUnreadExperiment.getConfig({ location: "thread_action_sheet" }).enabled) { if (!stateFromStores1) { if (canMarkChannelUnread) { let buttons = obj13.buttons; const obj14 = { label: null, IconComponent: null, onPress: null }; const intl = tmp(1115).intl; obj14.label = intl.string(tmp(1115).t.RpE9k7); obj14.IconComponent = tmp(10391).ChatMarkUnreadIcon; obj14.onPress = function onPress() { markChannelUnreadDefault(channel.id); }; buttons.push(obj14); } items5 = []; items5.push(obj13); const tmp27 = tmp13(10369)(tmp17); if (null != tmp27) { const obj15 = { sectionKey: "favorites", buttons: null }; const items6 = [tmp27]; obj15.buttons = items6; items5.push(obj15); } const obj16 = { sectionKey: "channel-actions", buttons: [] }; const buttons1 = obj16.buttons; const push = buttons1.push; if (hasJoined) { const intl4 = tmp(1115).intl; const string2 = intl4.string; let t2 = tmp(1115).t; if (isForumPostResult) { let string2Result = string2(t2["2LsZdT"]); } else { string2Result = string2(t2["fa/84m"]); } const obj17 = { label: string2Result, IconComponent: tmp(4580).UserMinusIcon, isDestructive: true, onPress() { ThreadActionCreatorsDefault.leaveThread(channel, "Context Menu"); } }; t2 = push(obj17); } else { const intl3 = tmp(1115).intl; const string = intl3.string; const t = tmp(1115).t; if (isForumPostResult) { let stringResult = string(t.ihLPiO); } else { stringResult = string(t["10kukS"]); } const obj18 = { label: stringResult, IconComponent: tmp(10182).GroupPlusIcon, onPress() { ThreadActionCreatorsDefault.joinThread(channel, "Context Menu"); } }; push(obj18); if (null == tmp23) { const threadMetadata = channel.threadMetadata; let archived; if (threadMetadata != null) { archived = threadMetadata.archived; } if (archived) { if (canUnarchiveThread) { const buttons2 = obj16.buttons; const intl7 = tmp(1115).intl; const string5 = intl7.string; let t5 = tmp(1115).t; if (isForumPostResult) { let string5Result = string5(t5.cnRubV); } else { string5Result = string5(t5.S9E4G7); } const obj19 = { label: string5Result, IconComponent: tmp(4602).ClockIcon, onPress() { ThreadActionCreatorsDefault.unarchiveThread(channel, false); } }; t5 = buttons2.push(obj19); } } else if (canManageThread) { const buttons3 = obj16.buttons; const intl6 = tmp(1115).intl; const string4 = intl6.string; const t4 = tmp(1115).t; if (isForumPostResult) { let string4Result = string4(t4.BTs4Kb); } else { string4Result = string4(t4.wiIevd); } const obj20 = { label: string4Result, IconComponent: tmp(4592).XLargeIcon, onPress() { ThreadActionCreatorsDefault.archiveThread(channel, false); } }; buttons3.push(obj20); } if (isThreadModerator) { const buttons4 = obj16.buttons; const push2 = buttons4.push; let obj21 = { label: null, IconComponent: null, onPress: null }; const intl8 = tmp(1115).intl; const string6 = intl8.string; let t1 = tmp(1115).t; if (isLockedThreadResult) { if (isForumPostResult) { t1 = t1["/OKSxp"]; let string6Result = string6(t1); } else { string6Result = string6(t1["jeyb/W"]); } obj21.label = string6Result; obj21.IconComponent = tmp(10395).LockUnlockedIcon; obj21.onPress = function onPress() { ThreadActionCreatorsDefault.unlockThread(channel); }; obj21 = push2(obj21); } else { if (isForumPostResult) { let string6Result1 = string6(t1["Ur/0Na"]); } else { string6Result1 = string6(t1.HoCqm8); } obj21[0] = string6Result1; obj21[1] = tmp(5182).LockIcon; obj21[2] = function onPress() { ThreadActionCreatorsDefault.lockThread(channel); }; push2(obj21); } isLockedThreadResult = channel.isLockedThread(); } if (!isThreadModerator) { const buttons5 = obj16.buttons; const obj22 = { label: null, IconComponent: null, isDestructive: false, onPress: null }; const intl10 = tmp(1115).intl; obj22.label = intl10.string(tmp(1115).t.WqhZss); obj22.IconComponent = tmp(4582).LinkIcon; obj22.onPress = function onPress() { const result = ChannelActionSheetUtils.copyGuildChannelOrThreadLink(channel.guild_id, channel.id); }; buttons5.push(obj22); items5.push(obj16); const obj23 = { sectionKey: "notifications", buttons: [] }; const buttons6 = obj23.buttons; const push3 = buttons6.push; let obj24 = { label: null, IconComponent: null, onPress: null }; const intl11 = tmp(1115).intl; const string8 = intl11.string; let t7 = tmp(1115).t; if (isMuted) { if (isForumPostResult) { t7 = t7["0JQfsP"]; let string8Result = string8(t7); } else { string8Result = string8(t7["Cq/TzF"]); } obj24.label = string8Result; obj24.IconComponent = tmp(9927).BellIcon; obj24.onPress = function onPress() { const result = ThreadActionCreatorsDefault.setNotificationSettings(channel, { muted: !onClose }); }; obj24 = push3(obj24); } else { if (isForumPostResult) { let string8Result1 = string8(t7["nP+Ykd"]); } else { string8Result1 = string8(t7.bUUd8q); } obj24[0] = string8Result1; obj24[1] = tmp(9213).BellSlashIcon; obj24[2] = function onPress() { const obj = ActionSheetActionCreatorsDefault; const obj2 = { guildId: null, channelId: null }; const combined = "muteSettings" + channel.id; obj2.guildId = channel.getGuildId(); obj2.channelId = channel.id; obj.openLazy(asyncRequireImpl(10290, dependencyMap.paths), combined, obj2); }; push3(obj24); const buttons7 = obj23.buttons; const obj25 = { label: null, IconComponent: null, onPress: null, disableColor: true }; const intl12 = tmp(1115).intl; obj25.label = intl12.string(tmp(1115).t.h850Ss); obj25.IconComponent = tmp(11120).ChannelNotificationIcon; obj25.onPress = function onPress() { const result = threadActionSheets.showThreadNotificationsBottomSheet(channel); }; buttons7.push(obj25); items5.push(obj23); const items7 = [items5.length, setting, onClose]; const effect = setting.useEffect(() => { if (!tmp) { onClose(); } }, items7); const obj26 = { header: null, children: null }; const obj27 = { title: tmp15, icon: tmp19 }; obj26.header = tmp18(tmp(11159).ActionSheetIconHeader, obj27); const items8 = [ items5.map((buttons) => { let obj = { hasIcons: true, children: null }; buttons = buttons.buttons; obj.children = buttons.map((onPress, index) => { onPress = onPress.onPress; ({ label, IconComponent, trailing, isDestructive, disableColor } = onPress); const obj = { label, variant: null, icon: null, trailing: null, onPress: null }; let str = "default"; if (isDestructive) { str = "danger"; } obj.variant = str; obj.icon = closure_1_13(channel(dependencyMap[45]).ActionSheetRow.Icon, { IconComponent, disableColor }); obj.trailing = trailing; obj.onPress = function onPress() { onClose(); onPress(); }; return closure_1_13(channel(dependencyMap[45]).ActionSheetRow, obj, index); }); return map1(ActionSheetRow.ActionSheetRow.Group, obj, buttons.sectionKey); }), ]; if (setting) { const obj28 = { hasIcons: true, children: null }; const obj29 = { icon: null, label: null, onPress: null }; const obj30 = { IconComponent: tmp(10778).IdIcon }; obj29.icon = tmp18(tmp(7313).ActionSheetRow.Icon, obj30); const intl13 = tmp(1115).intl; obj29.label = intl13.string(tmp(1115).t.DQ797g); obj29.onPress = function onPress() { onClose(); ClipboardUtils.copy(channel.id); ToastUtils.presentIdCopied(); }; obj28.children = tmp18(tmp(7313).ActionSheetRow, obj29); setting = tmp18(tmp(7313).ActionSheetRow.Group, obj28, "developer-actions"); } items8[1] = setting; obj26.children = items8; return closure_14(tmp(7311).ActionSheet, obj26); } } else { const buttons8 = obj16.buttons; const intl9 = tmp(1115).intl; const string7 = intl9.string; let t6 = tmp(1115).t; if (isForumPostResult) { let string7Result = string7(t6.NP1yHG); } else { string7Result = string7(t6["2Mk1TP"]); } const obj31 = { label: string7Result, IconComponent: tmp(10397).PencilIcon, onPress() { ChannelSettingsActionCreatorsDefault.setSection(constants4.OVERVIEW); ChannelSettingsActionCreatorsDefault.open(channel.id); } }; t6 = buttons8.push(obj31); } } else { const buttons9 = obj16.buttons; const intl5 = tmp(1115).intl; const string3 = intl5.string; let t3 = tmp(1115).t; if (stateFromStores3) { let string3Result = string3(t3["0D/6Rz"]); } else { string3Result = string3(t3.My50nf); } const obj32 = { label: string3Result, IconComponent: tmp(8002).PhoneCallIcon, onPress: tmp23 }; t3 = buttons9.push(obj32); } } } } const buttons10 = obj13.buttons; const obj33 = { label: null, IconComponent: null, onPress: null }; const intl2 = tmp(1115).intl; obj33.label = intl2.string(tmp(1115).t.e6RscS); obj33.IconComponent = tmp(7082).EyeIcon; obj33.onPress = function onPress() { ReadStateActionCreators.ack(channel.id, { section: constants3.THREAD_ACTION_SHEET, object: constants2.MARK_THREAD_AS_READ_BUTTON, objectType: constants.ACK_MANUAL }, true, true); }; buttons10.push(obj33); } const Constants = fn(1074); ({ AnalyticsObjectTypes: closure_9, AnalyticsObjects: c10, AnalyticsSections: closure_11, ChannelSettingsSections: closure_12 } = Constants); const jsxProd = fn(21); ({ jsx: map1, jsxs: closure_14 } = jsxProd); const size = fn(2); let result = size.fileFinishedImporting("modules/threads/native/components/ThreadLongPressActionSheet.tsx"); export default function ThreadLongPressActionSheet(arg0) { ({ channelId: require, onClose } = arg0); let stateFromStores; const items = [ChannelStore]; stateFromStores = require("initialize").useStateFromStores(items, () => ChannelStore.getChannel(require)); const items1 = [stateFromStores, onClose]; const effect = noop.useEffect(() => { if (null == stateFromStores) { onClose(); } }, items1); let tmp3 = null; if (null != stateFromStores) { const obj2 = { channel: stateFromStores, onClose }; tmp3 = closure_13(ThreadLongPressActionSheetConnected, obj2); } return tmp3; };