decord/alpha/source/stores/UploadStore.tsx

286 lines
8.1 KiB
TypeScript
Raw Normal View History

// Module ID: 8083
// Function ID: 8084
// Name: UploadStore
// Dependencies: [4977, 504, 573, 2]
2026-07-23 10:11:24 +00:00
// Module 8083 (UploadStore)
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 573 */;
import MessageStore from "MessageStore" /* 4977 */;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
const re1 = /^(assets-library|ph|file):\/\//;
const re2 = /^content:\/\//;
let closure_3 = Object.freeze([]);
const dependencyMap = {};
const dependencyMap2 = {};
const dependencyMap3 = {};
const dependencyMap4 = {};
2026-07-29 08:29:29 +00:00
let closure_8 = {};
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class UploadStore extends Store {
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const prototype = UploadStore.prototype;
prototype["initialize"] = function initialize() {
this.waitFor(MessageStore);
2026-07-29 08:29:29 +00:00
};
prototype["getFiles"] = function getFiles(arg0) {
let tmp = dependencyMap[arg0];
if (tmp == null) {
tmp = closure_3;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp;
};
prototype["getMessageForFile"] = function getMessageForFile(id) {
return dependencyMap3[id];
};
prototype["getUploaderFileForMessageId"] = function getUploaderFileForMessageId(id) {
return dependencyMap4[id];
};
prototype["getUploadAttachments"] = function getUploadAttachments(nonce) {
if (null != nonce) {
return closure_8[nonce];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
};
UploadStore.displayName = "UploadStore";
const uploadStore = new UploadStore(DispatcherDefault, {
2026-07-20 16:05:17 +00:00
CONNECTION_OPEN: function handleConnectionOpen() {
2026-08-24 06:08:38 +00:00
closure_8 = {};
2026-07-20 16:05:17 +00:00
},
LOGOUT: function handleLogout() {
2026-08-24 06:08:38 +00:00
closure_8 = {};
2026-07-20 16:05:17 +00:00
},
UPLOAD_START: function handleUploadStart(arg0) {
({ channelId, file, uploader, message } = arg0);
if (!uploader._aborted) {
if (!uploader._errored) {
2026-07-23 10:11:24 +00:00
let tmp2 = dependencyMap[channelId];
2026-07-29 08:29:29 +00:00
if (tmp2 == null) {
tmp2 = closure_3;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
closure_5[file.id] = uploader;
const items1 = [];
items1[HermesBuiltin.arraySpread(tmp2, 0)] = file;
dependencyMap[channelId] = items1;
2026-07-20 16:05:17 +00:00
if (null != message) {
2026-07-29 08:29:29 +00:00
closure_6[file.id] = message;
const items = file.items;
2026-07-20 16:05:17 +00:00
if (null != items) {
const obj = {};
const merged = Object.assign(file);
2026-07-29 08:29:29 +00:00
obj.items = items;
closure_7[message.id] = obj;
2026-07-20 16:05:17 +00:00
}
let id = message.nonce;
2026-07-29 08:29:29 +00:00
if (id == null) {
2026-07-20 16:05:17 +00:00
id = message.id;
}
const items2 = file.items;
2026-07-29 08:29:29 +00:00
let mapped;
if (items2 != null) {
mapped = items2.map((item) => {
2026-07-29 08:29:29 +00:00
item = item.item;
let num = item.width;
if (num == null) {
num = 0;
}
const size = { width: num, height: null, localUri: null, uploaderId: null, uploaderItemId: null };
2026-07-29 08:29:29 +00:00
let num2 = item.height;
if (num2 == null) {
num2 = 0;
}
size.height = num2;
2026-07-29 08:29:29 +00:00
let str = item.originalUri;
if (str == null) {
str = "";
}
size.localUri = str;
size.uploaderId = file.id;
2026-07-29 08:29:29 +00:00
let str2 = item.id;
if (str2 == null) {
str2 = "";
}
size.uploaderItemId = str2;
return size;
2026-07-29 08:29:29 +00:00
});
}
if (mapped == null) {
mapped = [];
}
closure_8[id] = mapped;
2026-07-20 16:05:17 +00:00
}
}
}
},
2026-07-29 08:29:29 +00:00
UPLOAD_COMPRESSION_PROGRESS: function handleUploadCompressionProgress(arg0) {
({ channelId, file } = arg0);
if (null != dependencyMap[channelId]) {
tmp[channelId] = arr.map((id) => {
let tmp2 = id;
if (id.id === file.id) {
const obj = {};
const merged = Object.assign(id);
const merged1 = Object.assign(tmp);
tmp2 = obj;
}
return tmp2;
});
let tmp4 = null != tmp3;
if (tmp4) {
tmp4 = null != dependencyMap4[tmp3.id];
}
if (tmp4) {
const obj = {};
const merged = Object.assign(dependencyMap4[tmp3.id]);
const merged1 = Object.assign(file);
dependencyMap4[tmp3.id] = obj;
}
}
2026-07-20 16:05:17 +00:00
},
2026-07-29 08:29:29 +00:00
UPLOAD_PROGRESS: function handleUploadProgress(arg0) {
({ channelId, file } = arg0);
if (null != dependencyMap[channelId]) {
tmp[channelId] = arr.map((id) => {
let tmp2 = id;
if (id.id === file.id) {
const obj = {};
const merged = Object.assign(id);
const merged1 = Object.assign(tmp);
tmp2 = obj;
}
return tmp2;
});
let tmp4 = null != tmp3;
if (tmp4) {
tmp4 = null != dependencyMap4[tmp3.id];
}
if (tmp4) {
const obj = {};
const merged = Object.assign(dependencyMap4[tmp3.id]);
const merged1 = Object.assign(file);
dependencyMap4[tmp3.id] = obj;
}
}
2026-07-20 16:05:17 +00:00
},
UPLOAD_COMPLETE: function handleUploadComplete(channelId) {
2026-07-29 08:29:29 +00:00
channelId = channelId.channelId;
const id = channelId.file.id;
let tmp5 = null != arr;
if (tmp5) {
tmp4[channelId] = arr.filter((id) => id.id !== id);
delete tmp3[tmp2];
delete tmp[tmp2];
tmp5 = arr.length !== tmp4[channelId].length;
}
return tmp5;
2026-07-20 16:05:17 +00:00
},
UPLOAD_FAIL: function handleUploadFail(channelId) {
2026-07-29 08:29:29 +00:00
channelId = channelId.channelId;
const id = channelId.file.id;
let tmp5 = null != arr;
if (tmp5) {
tmp4[channelId] = arr.filter((id) => id.id !== id);
delete tmp3[tmp2];
delete tmp[tmp2];
tmp5 = arr.length !== tmp4[channelId].length;
}
return tmp5;
2026-07-20 16:05:17 +00:00
},
UPLOAD_CANCEL_REQUEST: function handleUploadCancel(arg0) {
let cancel = tmp;
2026-07-23 10:11:24 +00:00
if (null == dependencyMap2[arg0.file.id]) {
2026-07-20 16:05:17 +00:00
return false;
} else {
const _setImmediate = setImmediate;
setImmediate(() => {
2026-08-24 06:08:38 +00:00
cancel = cancel.cancel;
2026-07-20 16:05:17 +00:00
let cancelResult;
2026-07-29 08:29:29 +00:00
if (cancel != null) {
cancelResult = cancel();
2026-07-20 16:05:17 +00:00
}
return cancelResult;
});
}
},
UPLOAD_ITEM_CANCEL_REQUEST: function handleUploadItemCancel(itemId) {
itemId = itemId.itemId;
2026-08-24 06:08:38 +00:00
closure_1 = tmp;
2026-07-23 10:11:24 +00:00
if (null == dependencyMap2[itemId.file.id]) {
2026-07-20 16:05:17 +00:00
return false;
} else {
const _setImmediate = setImmediate;
2026-08-24 06:08:38 +00:00
setImmediate(() => closure_1.cancelItem(itemId));
2026-07-20 16:05:17 +00:00
}
},
2026-07-29 08:29:29 +00:00
UPLOAD_FILE_UPDATE: function handleUploadFileUpdate(arg0) {
({ channelId, file } = arg0);
2026-07-23 10:11:24 +00:00
if (null != dependencyMap3[file.id]) {
2026-07-29 08:29:29 +00:00
let id = tmp2.nonce;
if (id == null) {
id = tmp2.id;
}
const items = file.items;
let mapped;
if (items != null) {
mapped = items.map((item) => {
item = item.item;
let num = item.width;
if (num == null) {
num = 0;
}
const size = { width: num, height: null, localUri: null, uploaderId: null, uploaderItemId: null };
2026-07-29 08:29:29 +00:00
let num2 = item.height;
if (num2 == null) {
num2 = 0;
}
size.height = num2;
2026-07-29 08:29:29 +00:00
let str = item.originalUri;
if (str == null) {
str = "";
}
size.localUri = str;
size.uploaderId = file.id;
2026-07-29 08:29:29 +00:00
let str2 = item.id;
if (str2 == null) {
str2 = "";
}
size.uploaderItemId = str2;
return size;
2026-07-29 08:29:29 +00:00
});
}
if (mapped == null) {
mapped = [];
}
closure_8[id] = mapped;
}
if (null != dependencyMap[channelId]) {
tmp4[channelId] = arr3.map((id) => {
let tmp2 = id;
if (id.id === file.id) {
const obj = {};
const merged = Object.assign(id);
const merged1 = Object.assign(tmp);
tmp2 = obj;
}
return tmp2;
});
let tmp6 = null != tmp5;
if (tmp6) {
tmp6 = null != dependencyMap4[tmp5.id];
}
if (tmp6) {
let obj = {};
let merged = Object.assign(dependencyMap4[tmp5.id]);
let merged1 = Object.assign(file);
dependencyMap4[tmp5.id] = obj;
2026-07-20 16:05:17 +00:00
}
}
},
UPLOAD_RESTORE_FAILED_UPLOAD: function restoreFailedUpload(messageId) {
2026-07-29 08:29:29 +00:00
closure_7[messageId.messageId] = messageId.file;
2026-07-20 16:05:17 +00:00
}
});
let size = fn(2);
const result = size.fileFinishedImporting("stores/UploadStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default uploadStore;