decord/source/utils/AttachmentFile.native.tsx

251 lines
7.4 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 4842
// Function ID: 4843
2026-07-20 16:05:17 +00:00
// Name: _getAttachmentFile
2026-08-24 06:08:38 +00:00
// Dependencies: [5, 3, 38, 4834, 4843, 4835, 2]
2026-07-20 16:05:17 +00:00
// Exports: cancelGetAttachmentFile, fileIsInAppDir, getAttachmentFile
2026-08-24 06:08:38 +00:00
// Module 4842 (_getAttachmentFile)
import timestampDefault from "timestamp" /* 3 */;
import openImagePickerUnhandled from "openImagePickerUnhandled" /* 4843 */;
import closure_3 from "asyncGeneratorStep" /* 5 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
function _getAttachmentFile() {
const self = this;
const tmp = callback((arg0, arg1) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
c7 = 0;
c8 = 0;
c6 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0, arg1) {
if (c8 === 2) {
c8 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp6 === 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 {
c8 = 2;
if (0 === c7) {
if (arg0 === 1) {
c8 = 3;
throw arg1;
} else if (arg0 === 2) {
c8 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
let logger = tmp3;
2026-08-24 06:08:38 +00:00
closure_3 = tmp7;
dependencyMap = undefined;
closure_3 = undefined;
2026-07-29 08:29:29 +00:00
logger = undefined;
2026-08-24 06:08:38 +00:00
callback(closure_1_2[2])(lib.item.platform === lib(closure_1_2[3]).UploadPlatform.REACT_NATIVE, "Upload must be in the React Native format");
c6 = 1;
const tmp49 = callback(closure_1_2[2]);
2026-07-29 08:29:29 +00:00
c7 = 2;
c8 = 1;
2026-08-24 06:08:38 +00:00
obj1 = { value: null, done: false };
obj1[0] = lib(closure_1_2[4]).getFileInfo(lib, callback);
2026-07-29 08:29:29 +00:00
return obj1;
}
} else if (1 === tmp7) {
c6 = 0;
logger.error("Failed to get attachment file", closure_5);
c8 = 3;
const obj2 = { value: null, done: true };
obj2[0] = undefined;
return obj2;
} else if (2 === tmp7) {
if (arg0 === 1) {
c8 = 3;
throw arg1;
} else if (arg0 === 2) {
c6 = 0;
c8 = 3;
const obj3 = { value: null, done: true };
obj3[0] = arg1;
return obj3;
} else {
2026-08-24 06:08:38 +00:00
closure_3 = arg1;
logger = lib(4835).getAttachmentPayload(lib, callback, closure_3.name);
2026-07-29 08:29:29 +00:00
c6 = 2;
2026-08-24 06:08:38 +00:00
const obj10 = lib(4835);
2026-07-29 08:29:29 +00:00
c7 = 4;
c8 = 1;
const obj4 = { value: null, done: false };
2026-08-24 06:08:38 +00:00
obj4[0] = lib(4843).getFileSize(closure_3.uri);
2026-07-29 08:29:29 +00:00
return obj4;
}
} else {
if (3 === tmp7) {
c6 = 1;
} else if (arg0 === 1) {
c8 = 3;
throw arg1;
} else if (arg0 === 2) {
c6 = 0;
c8 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
dependencyMap = arg1;
c6 = 1;
}
const obj5 = { file: null, uri: null, name: null, fileSize: null };
2026-08-24 06:08:38 +00:00
obj5[0] = closure_3;
obj5[1] = closure_3.uri;
2026-07-29 08:29:29 +00:00
const filename = logger.filename;
dependencyMap = filename;
if (filename == null) {
dependencyMap = "";
}
obj5[2] = dependencyMap;
obj5[3] = dependencyMap;
c6 = 0;
c8 = 3;
const obj6 = { value: null, done: true };
obj6[0] = obj5;
return obj6;
}
} catch (tmp24) {
closure_5 = tmp24;
if (tmp4 === c6) {
c8 = tmp2;
throw tmp24;
} else if (tmp === tmp26) {
c7 = tmp;
} else {
c7 = tmp2;
}
}
}
})();
});
2026-08-24 06:08:38 +00:00
closure_5 = 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);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
function _cancelGetAttachmentFile() {
const self = this;
const tmp = callback((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
c2 = 0;
c1 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0) {
if (c1 === 2) {
c1 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp3 === 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 {
c1 = 2;
if (0 === table) {
if (arg0 === 1) {
c1 = 3;
throw arg1;
} else if (arg0 === 2) {
c1 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
obj1 = callback(table[4]);
2026-07-29 08:29:29 +00:00
table = 1;
c1 = 1;
obj1 = { value: null, done: false };
obj1[0] = obj1.cancelGetFileInfo(callback);
return obj1;
}
} else if (arg0 === 1) {
c1 = 3;
throw arg1;
} else if (arg0 === 2) {
c1 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
c1 = 3;
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} catch (tmp8) {
c1 = tmp;
throw tmp8;
}
}
})();
});
2026-08-24 06:08:38 +00:00
closure_6 = 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-08-24 06:08:38 +00:00
let closure_4 = new timestampDefault("AttachmentFile");
const tmp2 = new timestampDefault("AttachmentFile");
const result = require("set").fileFinishedImporting("utils/AttachmentFile.native.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const getAttachmentFile = function getAttachmentFile(arg0, c0) {
const self = this;
const apply = _getAttachmentFile.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
};
export const cancelGetAttachmentFile = function cancelGetAttachmentFile(found) {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _cancelGetAttachmentFile.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
};
export const fileIsInAppDir = function fileIsInAppDir(uri) {
const replaced = uri.replace(/^file:\/\//, "");
2026-07-29 08:29:29 +00:00
try {
2026-08-24 06:08:38 +00:00
let startsWithResult = "" !== openImagePickerUnhandled.getAppDir();
2026-07-29 08:29:29 +00:00
if (startsWithResult) {
2026-08-24 06:08:38 +00:00
startsWithResult = replaced.startsWith(openImagePickerUnhandled.getAppDir());
const tmpResult = openImagePickerUnhandled;
2026-07-29 08:29:29 +00:00
}
return startsWithResult;
} catch (tmp4) {
2026-08-24 06:08:38 +00:00
logger.error("Failed to get app dir", tmp4);
2026-07-29 08:29:29 +00:00
return false;
2026-07-20 16:05:17 +00:00
}
};