2026-09-28 16:18:32 +00:00
|
|
|
// Module ID: 12838
|
|
|
|
|
// Function ID: 12839
|
2026-09-18 19:45:33 +00:00
|
|
|
// Name: useAppDMChatInputState
|
2026-09-28 16:18:32 +00:00
|
|
|
// Dependencies: [19, 8591, 5063, 7035, 2003, 1372, 1074, 1979, 504, 7632, 573, 6589, 2]
|
2026-09-26 17:57:22 +00:00
|
|
|
// Exports: default
|
2026-09-18 19:45:33 +00:00
|
|
|
|
2026-09-28 16:18:32 +00:00
|
|
|
// Module 12838 (useAppDMChatInputState)
|
2026-09-26 17:57:22 +00:00
|
|
|
import DispatcherDefault from "Dispatcher" /* 573 */;
|
2026-10-01 14:13:23 +00:00
|
|
|
import Constants from "Constants" /* 1074 */;
|
|
|
|
|
import Server from "Server" /* 1979 */;
|
2026-09-28 16:18:32 +00:00
|
|
|
import maybeFetchUserProfileDefault from "maybeFetchUserProfile" /* 7632 */;
|
2026-10-01 14:13:23 +00:00
|
|
|
import ApplicationCommandIndexStore from "ApplicationCommandIndexStore" /* 8591 */;
|
|
|
|
|
import react from "react" /* 19 */;
|
2026-09-28 16:18:32 +00:00
|
|
|
import ApplicationStore from "ApplicationStore" /* 5063 */;
|
|
|
|
|
import UserProfileStore from "UserProfileStore" /* 7035 */;
|
|
|
|
|
import ApplicationRecord from "ApplicationRecord" /* 2003 */;
|
2026-09-26 17:57:22 +00:00
|
|
|
import UserStore from "UserStore" /* 1372 */;
|
2026-10-01 14:13:23 +00:00
|
|
|
import size from "module_2" /* 2 */;
|
2026-09-18 19:45:33 +00:00
|
|
|
|
2026-10-01 14:13:23 +00:00
|
|
|
const useQueryState = ApplicationCommandIndexStore.useQueryState;
|
|
|
|
|
const EMPTY_STRING_SNOWFLAKE_ID = Constants.EMPTY_STRING_SNOWFLAKE_ID;
|
|
|
|
|
let items = [Server.ApplicationCommandType.PRIMARY_ENTRY_POINT, Server.ApplicationCommandType.CHAT, Server.ApplicationCommandType.MESSAGE, Server.ApplicationCommandType.USER];
|
2026-09-18 19:45:33 +00:00
|
|
|
const result = size.fileFinishedImporting("modules/app_dms/useAppDMChatInputState.tsx");
|
|
|
|
|
|
2026-09-26 17:57:22 +00:00
|
|
|
export default function useAppDMChatInputState(context) {
|
2026-10-01 14:13:23 +00:00
|
|
|
let flag;
|
|
|
|
|
let id2;
|
|
|
|
|
let tmp16;
|
2026-09-18 19:45:33 +00:00
|
|
|
let stateFromStores;
|
|
|
|
|
let application;
|
|
|
|
|
const channel = context.context.channel;
|
2026-10-01 14:13:23 +00:00
|
|
|
let obj = application;
|
2026-09-18 19:45:33 +00:00
|
|
|
items = [channel];
|
|
|
|
|
const memo = application.useMemo(() => {
|
|
|
|
|
if (null != channel) {
|
2026-10-01 14:13:23 +00:00
|
|
|
if (true === channel.isDM()) {
|
2026-09-18 19:45:33 +00:00
|
|
|
const user = UserStore.getUser(obj.getRecipientId());
|
|
|
|
|
let tmp3 = null;
|
|
|
|
|
if (undefined !== user) {
|
|
|
|
|
tmp3 = null;
|
|
|
|
|
if (true === user.bot) {
|
|
|
|
|
tmp3 = user;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return tmp3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}, items);
|
2026-10-01 14:13:23 +00:00
|
|
|
let tmp2 = channel;
|
|
|
|
|
let tmp3 = stateFromStores;
|
|
|
|
|
let obj2 = channel(stateFromStores[8]);
|
2026-09-18 19:45:33 +00:00
|
|
|
const items1 = [ApplicationStore];
|
2026-10-01 14:13:23 +00:00
|
|
|
stateFromStores = obj2.useStateFromStores(items1, () => {
|
2026-09-18 19:45:33 +00:00
|
|
|
let id;
|
2026-10-01 14:13:23 +00:00
|
|
|
const getAppIdForBotUserId = ApplicationStore.getAppIdForBotUserId;
|
2026-09-18 19:45:33 +00:00
|
|
|
if (memo != null) {
|
|
|
|
|
id = memo.id;
|
|
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
return getAppIdForBotUserId(id);
|
2026-09-18 19:45:33 +00:00
|
|
|
});
|
|
|
|
|
const items2 = [UserProfileStore];
|
2026-10-01 14:13:23 +00:00
|
|
|
const obj3 = channel(stateFromStores[8]);
|
|
|
|
|
const stateFromStores1 = obj3.useStateFromStores(items2, () => {
|
2026-09-18 19:45:33 +00:00
|
|
|
let tmp2;
|
|
|
|
|
if (null !== memo) {
|
|
|
|
|
let id;
|
2026-10-01 14:13:23 +00:00
|
|
|
const getUserProfile = UserProfileStore.getUserProfile;
|
|
|
|
|
if (memo != null) {
|
2026-09-18 19:45:33 +00:00
|
|
|
id = tmp.id;
|
|
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
const userProfile = getUserProfile(id);
|
2026-09-18 19:45:33 +00:00
|
|
|
application = undefined;
|
|
|
|
|
if (userProfile != null) {
|
|
|
|
|
application = userProfile.application;
|
|
|
|
|
}
|
|
|
|
|
tmp2 = application;
|
|
|
|
|
}
|
|
|
|
|
return tmp2;
|
|
|
|
|
});
|
|
|
|
|
if (stateFromStores == null) {
|
|
|
|
|
let id;
|
|
|
|
|
if (stateFromStores1 != null) {
|
|
|
|
|
id = stateFromStores1.id;
|
|
|
|
|
}
|
|
|
|
|
stateFromStores = id;
|
|
|
|
|
}
|
|
|
|
|
const items3 = [memo, stateFromStores];
|
|
|
|
|
const effect = obj.useEffect(() => {
|
|
|
|
|
if (null == stateFromStores) {
|
|
|
|
|
let id;
|
2026-10-01 14:13:23 +00:00
|
|
|
const tmp3 = maybeFetchUserProfileDefault;
|
2026-09-18 19:45:33 +00:00
|
|
|
if (memo != null) {
|
|
|
|
|
id = memo.id;
|
|
|
|
|
}
|
|
|
|
|
if (id == null) {
|
|
|
|
|
id = EMPTY_STRING_SNOWFLAKE_ID;
|
|
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
tmp3(id, undefined, { withMutualGuilds: true });
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
}, items3);
|
|
|
|
|
let id1;
|
2026-10-01 14:13:23 +00:00
|
|
|
const useEffect = obj.useEffect;
|
2026-09-18 19:45:33 +00:00
|
|
|
if (memo != null) {
|
|
|
|
|
id1 = memo.id;
|
|
|
|
|
}
|
|
|
|
|
const items4 = [id1];
|
2026-10-01 14:13:23 +00:00
|
|
|
const effect1 = useEffect(() => {
|
2026-09-18 19:45:33 +00:00
|
|
|
let id;
|
|
|
|
|
if (memo != null) {
|
|
|
|
|
id = tmp.id;
|
|
|
|
|
}
|
|
|
|
|
if (null != id) {
|
2026-10-01 14:13:23 +00:00
|
|
|
const obj2 = { type: "APP_DM_OPEN", botUserId: memo.id };
|
|
|
|
|
const obj = DispatcherDefault;
|
|
|
|
|
obj.dispatch(obj2);
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
}, items4);
|
2026-10-01 14:13:23 +00:00
|
|
|
const obj5 = { applicationId: stateFromStores, allowFetch: null != id2, allowApplicationState: true };
|
|
|
|
|
id2 = undefined;
|
|
|
|
|
const obj4 = { commandTypes: items };
|
|
|
|
|
const tmp10 = useQueryState;
|
2026-09-18 19:45:33 +00:00
|
|
|
if (memo != null) {
|
|
|
|
|
id2 = memo.id;
|
|
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
const descriptors = tmp10({ channel, type: "channel" }, obj4, obj5).descriptors;
|
2026-09-18 19:45:33 +00:00
|
|
|
const found = descriptors.find((application) => {
|
|
|
|
|
application = application.application;
|
|
|
|
|
let id;
|
|
|
|
|
if (application != null) {
|
|
|
|
|
id = application.id;
|
|
|
|
|
}
|
|
|
|
|
return id === stateFromStores;
|
|
|
|
|
});
|
|
|
|
|
application = undefined;
|
|
|
|
|
if (found != null) {
|
|
|
|
|
application = found.application;
|
|
|
|
|
}
|
|
|
|
|
const items5 = [application];
|
|
|
|
|
let memo1 = obj.useMemo(() => {
|
|
|
|
|
let fromServer;
|
|
|
|
|
if (null != application) {
|
|
|
|
|
fromServer = ApplicationRecord.createFromServer(tmp);
|
|
|
|
|
}
|
|
|
|
|
return fromServer;
|
|
|
|
|
}, items5);
|
2026-10-01 14:13:23 +00:00
|
|
|
const useGetOrFetchApplication = tmp2(tmp3[11]).useGetOrFetchApplication;
|
|
|
|
|
tmp2(tmp3[11]);
|
2026-09-18 19:45:33 +00:00
|
|
|
if (null == memo1) {
|
2026-10-01 14:13:23 +00:00
|
|
|
tmp16 = stateFromStores;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
|
|
|
|
if (memo1 == null) {
|
2026-10-01 14:13:23 +00:00
|
|
|
memo1 = useGetOrFetchApplication(tmp16);
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
const obj6 = { application: memo1, isAppDM: flag };
|
|
|
|
|
flag = undefined;
|
2026-09-18 19:45:33 +00:00
|
|
|
if (memo != null) {
|
|
|
|
|
flag = memo.bot;
|
|
|
|
|
}
|
|
|
|
|
if (flag == null) {
|
|
|
|
|
flag = false;
|
|
|
|
|
}
|
|
|
|
|
return obj6;
|
2026-09-26 17:57:22 +00:00
|
|
|
};
|