// Metro module 6148 (f6149). import UploadStore from "../../stores/UploadStore"; import CloudUploader from "../../lib/uploader/native/CloudUploader"; import { createMessageRecord } from "../messages/MessageRecordUtils"; import Dispatcher from "../../Dispatcher"; function $mk114870($env) { return (a0) => { const r4 = $env; c3890_5.add(r4[2]); Dispatcher.dispatch({ type: "UPLOAD_START", channelId: r4[0], file: a0, uploader: r4[5], message: r4[7] }); }; } function $mk114871($env) { return (a0) => { Dispatcher.dispatch({ type: "UPLOAD_COMPRESSION_PROGRESS", channelId: $env[0], file: a0 }); }; } function $mk114872($env) { return (a0) => { Dispatcher.dispatch({ type: "UPLOAD_PROGRESS", channelId: $env[0], file: a0 }); }; } function $mk114873($env) { return (a0) => { const r4 = $env; c3890_5.delete(r4[2]); r4[5].cancel(); Dispatcher.dispatch({ type: "UPLOAD_FAIL", channelId: r4[0], file: a0, messageId: r4[7].id, shouldSendNotification: r4[4] }); }; } function $mk114874($env) { return (a0) => { const r4 = $env; let env31392 = { $parent: $env }; env31392[0] = a0; c3890_5.delete(r4[2]); const messageForFile = UploadStore.getMessageForFile(a0.id); if (messageForFile != null && messageForFile.content === "" && r4[5]._aborted) { let nonce = messageForFile.nonce; if (nonce == null) { nonce = messageForFile.id; } Dispatcher.dispatch({ type: "MESSAGE_DELETE", id: nonce, channelId: messageForFile.channel_id }); } if (r4[5]._aborted) { setTimeout(() => { const r1 = env31392.$parent.$parent; (0, r1[1])(r1[2][4]).dispatch({ type: "UPLOAD_COMPLETE", channelId: env31392.$parent[0], file: env31392[0], aborted: true }); }, 0); } }; } function $mk114875($env) { return (a0) => { Dispatcher.dispatch({ type: "UPLOAD_FILE_UPDATE", file: a0, channelId: $env[0] }); }; } let env3890 = {}; const c3890_5 = new Set(); export async function uploadMessageAttachments(c25718_0) { let value, c25718_2, c25718_3; L14: { let env29671; const r29 = env3890; c25718_3 = r29; const r10 = env29671 = { $parent: r29 }; c25718_2 = r10; env29671[0] = void 0; env29671[1] = void 0; env29671[2] = void 0; env29671[3] = void 0; env29671[4] = void 0; env29671[0] = c25718_0.channelId; env29671[1] = c25718_0.message; env29671[2] = c25718_0.nonce; env29671[3] = c25718_0.items; env29671[4] = c25718_0.shouldUploadFailureSendNotification; env29671[5] = void 0; env29671[6] = void 0; env29671[7] = void 0; await void 0; if (c3890_5.has(env29671[2])) { break L14; } const r55 = c25718_2; env29671[5] = new CloudUploader(); env29671[6] = `pending-upload-${env29671[5]._file.id}`; env29671[7] = createMessageRecord({ ...env29671[1], key: env29671[6] }); env29671[5].on("start", $mk114870(r55)); env29671[5].on("compression-progress", $mk114871(r55)); env29671[5].on("progress", $mk114872(r55)); env29671[5].on("error", $mk114873(r55)); env29671[5].on("complete", $mk114874(r55)); env29671[5].on("cancel-upload-item", $mk114875(r55)); value = {}; const attachments = await env29671[5].uploadFiles(env29671[3]); value.attachments = attachments; value.uploader = env29671[5]; return value; } }