decord/source/modules/chat_input/native/ChatInputAppCommandManager.tsx

113 lines
5.9 KiB
TypeScript
Raw Normal View History

2026-07-23 10:11:24 +00:00
// Module ID: 11460
// Function ID: 89212
2026-07-20 16:05:17 +00:00
// Name: ChatInputAppCommandManager
2026-07-23 10:11:24 +00:00
// Dependencies: [57, 31, 7021, 7022, 4130, 689, 11225, 566, 11433, 8189, 1881, 11461, 11434, 2]
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
// Module 11460 (ChatInputAppCommandManager)
import _slicedToArray from "_slicedToArray";
import importAllResult from "result";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_7 from "_isNativeReflectConstruct";
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose";
const require = arg1;
2026-07-20 16:05:17 +00:00
let obj = {};
2026-07-23 10:11:24 +00:00
obj = { backgroundColor: require("_createForOfIteratorHelperLoose").colors.KEYWORD_HIGHLIGHT_BACKGROUND, color: require("_createForOfIteratorHelperLoose").colors.TEXT_DEFAULT, borderRadius: require("_createForOfIteratorHelperLoose").radii.xs, fontSize: 14 };
2026-07-20 16:05:17 +00:00
obj.commandOption = obj;
2026-07-23 10:11:24 +00:00
_createForOfIteratorHelperLoose = { backgroundColor: require("_createForOfIteratorHelperLoose").colors.KEYWORD_HIGHLIGHT_BACKGROUND, color: require("_createForOfIteratorHelperLoose").colors.TEXT_FEEDBACK_CRITICAL, borderRadius: require("_createForOfIteratorHelperLoose").radii.xs, fontSize: 14 };
obj.commandErrorOption = _createForOfIteratorHelperLoose;
obj.autocomplete = { color: require("_createForOfIteratorHelperLoose").colors.TEXT_BRAND, fontWeight: "bold" };
let closure_8 = _createForOfIteratorHelperLoose.createStyles(obj);
2026-07-20 16:05:17 +00:00
const forwardRefResult = importAllResult.forwardRef((chatInputRef) => {
chatInputRef = chatInputRef.chatInputRef;
const chatInputStateRef = chatInputRef.chatInputStateRef;
const channel = chatInputRef.channel;
const commandsDisabled = chatInputRef.commandsDisabled;
2026-07-23 10:11:24 +00:00
const tmp = ref();
2026-07-20 16:05:17 +00:00
let callback = tmp;
2026-07-23 10:11:24 +00:00
const applicationCommandOptionValueParser = chatInputRef(commandsDisabled[6]).useApplicationCommandOptionValueParser({ channel });
let obj = chatInputRef(commandsDisabled[6]);
const items = [stateFromStores1];
const stateFromStores = chatInputRef(commandsDisabled[7]).useStateFromStores(items, () => stateFromStores1.getActiveCommand(channel.id));
const obj2 = chatInputRef(commandsDisabled[7]);
const items1 = [stateFromStores];
stateFromStores1 = chatInputRef(commandsDisabled[7]).useStateFromStores(items1, () => stateFromStores.getLastResponseNonce(channel.id));
let obj3 = chatInputRef(commandsDisabled[7]);
let text = chatInputRef(commandsDisabled[8]).getTextBeforeFirstOption(chatInputStateRef.current.text).text;
let substr = text.slice(1);
ref = applicationCommandOptionValueParser.useRef(substr.trimEnd());
let tmp6 = callback(applicationCommandOptionValueParser.useState(ref.current), 2);
2026-07-20 16:05:17 +00:00
let closure_9 = tmp6[1];
2026-07-23 10:11:24 +00:00
const obj4 = chatInputRef(commandsDisabled[8]);
const commands = channel(commandsDisabled[9]).useCachedResults({ type: "channel", channel }, chatInputRef(commandsDisabled[10]).ApplicationCommandType.CHAT, tmp6[0]).commands;
let closure_11 = applicationCommandOptionValueParser.useRef(undefined);
2026-07-20 16:05:17 +00:00
const items2 = [stateFromStores, channel, chatInputRef, chatInputStateRef, commandsDisabled, stateFromStores1, applicationCommandOptionValueParser, commands, tmp];
2026-07-23 10:11:24 +00:00
callback = applicationCommandOptionValueParser.useCallback(() => {
2026-07-20 16:05:17 +00:00
const current = chatInputStateRef.current;
let text = current.text;
let obj = { activeCommand: stateFromStores, channel, commandsDisabled, editId: current.editId, focused: current.focused, lastCommandAutocompleteResponseNonce: stateFromStores1, queryCommands: commands, selectionStart: current.selectionStart, selectionEnd: current.selectionEnd, text };
if (null == ref.current) {
let tmp6 = chatInputStateRef(commandsDisabled[11]);
obj = {};
obj.props = obj;
obj.ref = chatInputRef;
obj.optionValueParser = applicationCommandOptionValueParser;
obj = {
commandOption() {
2026-07-23 10:11:24 +00:00
return chatInputRef(commandsDisabled[12]).convertToNativeStyle(outer1_4.commandOption);
2026-07-20 16:05:17 +00:00
},
commandErrorOption() {
2026-07-23 10:11:24 +00:00
return chatInputRef(commandsDisabled[12]).convertToNativeStyle(outer1_4.commandErrorOption);
2026-07-20 16:05:17 +00:00
},
autocomplete(arg0) {
if (null == arg0) {
2026-07-23 10:11:24 +00:00
let convertToNativeStyleResult = chatInputRef(commandsDisabled[12]).convertToNativeStyle(outer1_4.autocomplete);
const obj3 = chatInputRef(commandsDisabled[12]);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
let obj = chatInputRef(commandsDisabled[12]);
2026-07-20 16:05:17 +00:00
obj = {};
2026-07-23 10:11:24 +00:00
const merged = Object.assign(outer1_4.autocomplete);
2026-07-20 16:05:17 +00:00
obj["color"] = arg0;
convertToNativeStyleResult = obj.convertToNativeStyle(obj);
}
return convertToNativeStyleResult;
}
};
obj.styles = obj;
const prototype = tmp6.prototype;
tmp6 = new tmp6(obj);
ref.current = tmp6;
} else {
const current2 = ref.current;
const obj1 = { newState: obj };
const result = current2.updateApplicationCommandManagerState(obj1);
}
text = chatInputRef(commandsDisabled[8]).getTextBeforeFirstOption(text).text;
const substr = text.slice(1);
const trimEndResult = substr.trimEnd();
if (ref.current !== trimEndResult) {
callback(trimEndResult);
ref.current = trimEndResult;
}
}, items2);
const items3 = [callback];
2026-07-23 10:11:24 +00:00
const effect = applicationCommandOptionValueParser.useEffect(() => {
2026-07-20 16:05:17 +00:00
callback();
}, items3);
2026-07-23 10:11:24 +00:00
const imperativeHandle = applicationCommandOptionValueParser.useImperativeHandle(arg1, () => ({
2026-07-20 16:05:17 +00:00
getApplicationCommandManager() {
2026-07-23 10:11:24 +00:00
return outer1_11.current;
2026-07-20 16:05:17 +00:00
},
updateState() {
2026-07-23 10:11:24 +00:00
return outer1_12();
2026-07-20 16:05:17 +00:00
}
}));
return null;
});
forwardRefResult.displayName = "ChatInputAppCommandManager";
2026-07-23 10:11:24 +00:00
let obj2 = { color: require("_createForOfIteratorHelperLoose").colors.TEXT_BRAND, fontWeight: "bold" };
2026-07-20 16:05:17 +00:00
const memoResult = importAllResult.memo(forwardRefResult);
2026-07-23 10:11:24 +00:00
let result = require("_isNativeReflectConstruct").fileFinishedImporting("modules/chat_input/native/ChatInputAppCommandManager.tsx");
2026-07-20 16:05:17 +00:00
export default memoResult;