decord/source/modules/emojis/hooks/useEmojiAndSource.tsx

196 lines
6.3 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 9444
// Function ID: 9445
2026-07-20 16:05:17 +00:00
// Name: useEmojiAndSource
2026-08-24 06:08:38 +00:00
// Dependencies: [5, 32, 19, 1910, 6764, 7227, 676, 4040, 647, 2]
2026-07-20 16:05:17 +00:00
// Exports: useEmojiAndSource
2026-08-24 06:08:38 +00:00
// Module 9444 (useEmojiAndSource)
import closure_2 from "asyncGeneratorStep" /* 5 */;
import closure_3 from "_slicedToArray" /* 32 */;
import closure_4 from "noop" /* 19 */;
import closure_5 from "createGuildRecordFromRust" /* 1910 */;
import closure_6 from "getEmojiToGroupId" /* 6764 */;
import getEmojiSourceData from "getEmojiSourceData" /* 7227 */;
import { GuildFeatures } from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-08-24 06:08:38 +00:00
({ ExpressionSourceGuildRecord: error, EmojiSourceDataTypes: closure_8, getEmojiSourceData: c9 } = getEmojiSourceData);
const result = require("set").fileFinishedImporting("modules/emojis/hooks/useEmojiAndSource.tsx");
2026-07-20 16:05:17 +00:00
export const useEmojiAndSource = function useEmojiAndSource(emojiId) {
emojiId = emojiId.emojiId;
const refreshPositionKey = emojiId.refreshPositionKey;
2026-08-24 06:08:38 +00:00
closure_2 = undefined;
2026-07-20 16:05:17 +00:00
let callback;
let React;
2026-07-23 10:11:24 +00:00
c5 = undefined;
c6 = undefined;
2026-08-24 06:08:38 +00:00
closure_7 = undefined;
2026-07-23 10:11:24 +00:00
const items = [c6, c5];
const emoji = emojiId(refreshPositionKey[8]).useStateFromStoresObject(items, () => {
let obj = c6;
2026-07-20 16:05:17 +00:00
let customEmojiById = null;
if (null != emojiId) {
customEmojiById = obj.getCustomEmojiById(tmp);
}
let type;
2026-07-29 08:29:29 +00:00
if (customEmojiById != null) {
2026-07-20 16:05:17 +00:00
type = customEmojiById.type;
}
if (type === emojiId(refreshPositionKey[7]).EmojiTypes.GUILD) {
2026-07-29 08:29:29 +00:00
obj = { emoji: null, joinedEmojiSourceGuildRecord: null };
obj[0] = customEmojiById;
2026-07-20 16:05:17 +00:00
let guildId;
2026-07-29 08:29:29 +00:00
if (customEmojiById != null) {
2026-07-20 16:05:17 +00:00
guildId = customEmojiById.guildId;
}
2026-07-29 08:29:29 +00:00
obj[1] = c5.getGuild(guildId);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
obj = { emoji: null, joinedEmojiSourceGuildRecord: null };
2026-07-20 16:05:17 +00:00
}
return obj;
});
const joinedEmojiSourceGuildRecord = emoji.joinedEmojiSourceGuildRecord;
const hasJoinedEmojiSourceGuild = null != joinedEmojiSourceGuildRecord;
let hasItem = null != joinedEmojiSourceGuildRecord;
if (hasItem) {
const features = joinedEmojiSourceGuildRecord.features;
hasItem = features.has(GuildFeatures.DISCOVERABLE);
}
let tmp5 = !hasJoinedEmojiSourceGuild;
if (hasJoinedEmojiSourceGuild) {
tmp5 = hasItem;
}
if (tmp5) {
tmp5 = null != emojiId;
}
2026-08-24 06:08:38 +00:00
closure_2 = tmp5;
2026-07-23 10:11:24 +00:00
let obj = emojiId(refreshPositionKey[8]);
2026-07-29 08:29:29 +00:00
[tmp8, c3] = callback(React.useState(tmp5), 2);
2026-07-20 16:05:17 +00:00
const sourceType = callback(React.useState(null), 2);
React = sourceType[1];
let fromGuildRecord = null;
if (null != joinedEmojiSourceGuildRecord) {
fromGuildRecord = closure_7.createFromGuildRecord(joinedEmojiSourceGuildRecord);
}
2026-07-29 08:29:29 +00:00
let tmp6Result = tmp6(obj2.useState(fromGuildRecord), 2);
[tmp13, c5] = tmp6Result;
tmp6Result = tmp6(obj2.useState(null), 2);
[tmp15, c6] = tmp6Result;
closure_7 = obj2.useRef(refreshPositionKey);
const effect = obj2.useEffect(() => {
2026-07-20 16:05:17 +00:00
closure_7.current = refreshPositionKey;
});
const items1 = [emojiId, tmp5];
2026-07-29 08:29:29 +00:00
const effect1 = obj2.useEffect(() => {
2026-07-20 16:05:17 +00:00
function _fetch() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback(function*() {
if (v0 === 2) {
v0 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
v0 = 2;
if (0 === c2) {
if (arg0 === 1) {
v0 = 3;
throw arg1;
} else if (arg0 === 2) {
v0 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
closure_1 = tmp5;
closure_0 = tmp2;
closure_0 = undefined;
2026-07-29 08:29:29 +00:00
let tmp6 = null;
2026-08-24 06:08:38 +00:00
if (null != closure_1_0) {
2026-07-29 08:29:29 +00:00
c2 = 1;
v0 = 1;
2026-08-24 06:08:38 +00:00
obj1 = { value: null, done: false };
obj1[0] = closure_2_9(tmp33);
2026-07-29 08:29:29 +00:00
return obj1;
}
}
} else if (arg0 === 1) {
v0 = 3;
throw arg1;
} else {
tmp6 = arg1;
if (arg0 === 2) {
v0 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
}
}
2026-08-24 06:08:38 +00:00
closure_0 = tmp6;
if (null != closure_0) {
closure_1_4(closure_0.type);
const type = closure_0.type;
if (closure_2_8.APPLICATION === type) {
closure_1_6(closure_0.application);
} else if (closure_2_8.GUILD === type) {
closure_1_5(closure_0.guild);
2026-07-29 08:29:29 +00:00
}
}
v0(false);
2026-08-24 06:08:38 +00:00
const current = closure_1_7.current;
2026-07-29 08:29:29 +00:00
if (current != null) {
current();
}
v0 = 3;
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
} catch (tmp27) {
v0 = tmp;
throw tmp27;
}
}
});
2026-08-24 06:08:38 +00:00
closure_0 = tmp;
2026-07-29 08:29:29 +00:00
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let current = ref.current;
if (current != null) {
current();
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
if (closure_2) {
2026-07-23 10:11:24 +00:00
(function fetch() {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _fetch.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-23 10:11:24 +00:00
})();
2026-07-29 08:29:29 +00:00
} else {
const current2 = ref.current;
if (current2 != null) {
current2();
}
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp4;
2026-07-20 16:05:17 +00:00
}, items1);
return { expressionSourceGuild, expressionSourceApplication, sourceType: sourceType[0], joinedEmojiSourceGuildRecord, hasJoinedEmojiSourceGuild, emoji: emoji.emoji, isFetching };
};