Files
discord-decomp/sources/modules/interaction_components/useFileUploadComponentState.tsx
T
2026-07-27 16:20:00 +03:00

62 lines
3.8 KiB
TypeScript

/* Metro module 15742; source: modules/interaction_components/useFileUploadComponentState.tsx; dependencies: [31, 4645, 4644, 8357, 44, 1909, 2] */
function _fun120893(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120893, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15950:6, offset: 0x02539b60, size: 159 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importAll(31) /* metro dependency 31 */;
const env0_4 = (require(4645) /* metro dependency 4645: DraftStore */).DraftType;
const uploadAttachmentStore = importDefault(4644) /* metro dependency 4644: UploadAttachmentStore */;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/interaction_components/useFileUploadComponentState.tsx');
exports.useFileUploadComponentState = useFileUploadComponentState;
}
function useFileUploadComponentState(a0) { // fn#120894, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15950:262, offset: 0x02539bff, size: 324 bytes, params: 2, frame: 20
const value2 = (require(8357) /* metro dependency 8357: ComponentStateContext */).useComponentStateContext();
(importDefault(44) /* metro dependency 44 */)(value2 != null,
'useFileUploadComponentState must be used within a ComponentStateContextProvider');
const channelId = value2.channelId;
(importDefault(44) /* metro dependency 44 */)(channelId != null,
'useFileUploadComponentState must be used inside a channel');
const {state, executeStateUpdate, error} = value2.useComponentState(a0);
const binding = env0_3;
const value4 = binding.useMemo(function() {
return state?.type === require(dependencyMap[5]).ComponentType.FILE_UPLOAD ? state.uploadIds : [];
}, [state]);
const getUploads = UploadAttachmentStore.getUploads;
const InteractionModal = DraftType.InteractionModal;
let value = Reflect.apply(getUploads, UploadAttachmentStore, [channelId, InteractionModal]);
value = binding.useMemo(_fun120896, [value4, value]);
const value5 = binding.useCallback(function(a0) {
var executeStateUpdateBinding = executeStateUpdate;
var object = {};
object.type = require(dependencyMap[5]).ComponentType.FILE_UPLOAD;
object.uploadIds = a0;
return executeStateUpdateBinding(object);
}, [executeStateUpdate]);
binding.useEffect(_fun120901, [value4, value, value5]);
return {uploadIds: value4, setUploadIds: value5, currentUploads: value, error: error};
}
function _fun120896() { // fn#120896, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15950:757, offset: 0x02539d99, size: 45 bytes, params: 1, frame: 12
return env0_2.map(_fun120897).filter(function(a0) {
return a0 != null;
});
}
function _fun120901() { // fn#120901, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15950:926, offset: 0x02539e2b, size: 63 bytes, params: 1, frame: 12
if (env0_2.length > env0_4.length) {
env0_5(env0_2.filter(_fun120902));
}
}
function _fun120897(a0) { // fn#120897, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15950:768, offset: 0x02539dc6, size: 36 bytes, params: 2, frame: 11
const env0_0 = a0;
return env1_3.find(_fun120898);
}
function _fun120902(a0) { // fn#120902, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15950:969, offset: 0x02539e6a, size: 36 bytes, params: 2, frame: 11
const env0_0 = a0;
return env1_4.some(_fun120903);
}