// Metro module 9916 (f9917). import { useRef, useState, useCallback } from "react"; import { EmojiIntention } from "../../emojis/EmojiConstants"; import { openEmojiPickerActionSheet } from "../../emoji_picker/native/openEmojiPickerActionSheet"; export function useShareChatInputActions(a0, a1, a2) { let callback, callback2; let c17552_0 = a0; const channel = a1; const appEntryKey = a2; const ref = useRef(null); const ref2 = useRef({ start: 0, end: 0 }); const [isInputFocused, setState] = useState(false); const callback3 = useCallback((a0) => { ref2.current = { ...a0.nativeEvent.selection }; }, []); const callback4 = useCallback(() => { setState(true); }, []); const callback5 = useCallback(() => { setState(false); }, []); callback = useCallback((a0) => { let surrogates = ""; if (a0.id == null && a0.surrogates != null) { surrogates = a0.surrogates; } else { surrogates = `:${a0.uniqueName != null && a0.uniqueName !== "" ? a0.uniqueName : a0.name}: `; } c17552_0((a0) => a0.slice(0, ref2.current.start) + surrogates + a0.slice(ref2.current.end)); const current = ref.current; if (current != null) { current.focus(); } }, [a0]); callback2 = useCallback(() => { const current = ref.current; if (current != null) { current.focus(); } }, []); return { textInputRef: ref, isInputFocused, handleSelectionChange: callback3, handleMessageFocus: callback4, handleMessageBlur: callback5, handlePressEmoji: useCallback(() => { const current = ref.current; if (current != null) { current.blur(); } let guildId = channel == null ? void 0 : channel.getGuildId(); if (guildId == null) { guildId = void 0; } openEmojiPickerActionSheet({ onPressEmoji: callback, onClose: callback2, pickerIntention: EmojiIntention.CHAT, autoFocus: false, startExpanded: false, channel, appEntryKey, guildId }); }, [callback2, callback, a1, a2]) }; }