97 lines
3.1 KiB
JavaScript
97 lines
3.1 KiB
JavaScript
// Metro module 4777 (f4778).
|
|
import * as _Module4778 from "./Module4778";
|
|
import * as _Module4779 from "./Module4779";
|
|
import * as _Module4780 from "./Module4780";
|
|
import * as _Module4781 from "./Module4781";
|
|
import * as _Module4782 from "./Module4782";
|
|
import { FileTypes, FILE_TYPES_REQUIRED_ADDITIONAL_CHECK } from "./Module4775";
|
|
import { getFileChunk } from "./fetchFromObject";
|
|
let c2928_2 = (this ? this.__createBinding : this) || (Object.create ? function(a0, a1, a2, a3) {
|
|
const r6 = a3 === void 0 ? a2 : a3;
|
|
let r9 = Object.getOwnPropertyDescriptor(a1, a2);
|
|
if (!(r9 ? !("get" in r9 ? !a1.__esModule : r9.writable || r9.configurable) : r9)) {
|
|
r9 = {
|
|
enumerable: true,
|
|
get: function get() {
|
|
return a1[a2];
|
|
}
|
|
};
|
|
}
|
|
Object.defineProperty(a0, r6, r9);
|
|
} : function(a0, a1, a2, a3) {
|
|
a0[a3 === void 0 ? a2 : a3] = a1[a2];
|
|
});
|
|
const r13 = (this ? this.__exportStar : this) || function(a0, a1) {
|
|
for (const key in a0) {
|
|
if (!(key === "default" || Object.prototype.hasOwnProperty.call(a1, key))) {
|
|
c2928_2(a1, a0, key);
|
|
}
|
|
}
|
|
};
|
|
r13(_Module4778, exports);
|
|
r13(_Module4779, exports);
|
|
r13(_Module4780, exports);
|
|
r13(_Module4781, exports);
|
|
r13(_Module4782, exports);
|
|
export function validateFileType(a0, a1, a2) {
|
|
let r84;
|
|
const r11 = [];
|
|
for (const item of [...new Set(a1.map((item) => {
|
|
const r3 = item.split(".").join("").toUpperCase();
|
|
let r10 = r3;
|
|
if (r10 === "7Z") {
|
|
r10 = `_${r3}`;
|
|
}
|
|
return r10;
|
|
}))]) {
|
|
if (!Object.prototype.hasOwnProperty.call(FileTypes, item)) {
|
|
throw new TypeError(`Type \`${item.toLowerCase()}\` is not supported. Please make sure that \`types\` list conatins only supported files`);
|
|
}
|
|
r11.push(item);
|
|
}
|
|
if (a2 && Object.prototype.hasOwnProperty.call(a2, "chunkSize")) {
|
|
const chunkSize = a2?.chunkSize;
|
|
if ((chunkSize !== null ? chunkSize !== void 0 ? chunkSize : 0 : 0) <= 0) {
|
|
throw new RangeError("chunkSize must be bigger than zero");
|
|
}
|
|
}
|
|
L26: {
|
|
if (a2) {
|
|
const excludeSimilarTypes = a2?.excludeSimilarTypes;
|
|
r84 = r11;
|
|
if (excludeSimilarTypes) {
|
|
break L26;
|
|
}
|
|
}
|
|
const r86 = (function addSimilarTypes(a0) {
|
|
return a0.some((item) => item === "MP4") ? ["M4V"] : a0.some((item) => item === "AAC") ? ["M4A"] : [];
|
|
})(r11);
|
|
r84 = r86.length > 0 ? r11.concat(r86) : r11;
|
|
}
|
|
let r89 = [];
|
|
const r90 = [];
|
|
for (const item2 of r84) {
|
|
r89 = r89.concat(FileTypes.getSignaturesByName(item2));
|
|
if (FILE_TYPES_REQUIRED_ADDITIONAL_CHECK.includes(item2.toLowerCase())) {
|
|
r90.push(FileTypes.getInfoByName(item2));
|
|
}
|
|
}
|
|
const r134 = a2?.chunkSize || 64;
|
|
let c14432_1;
|
|
const fileChunk = getFileChunk(a0, r134);
|
|
const r144 = FileTypes.detectSignature(fileChunk, r89);
|
|
let c14432_0 = r144;
|
|
if (r144) {
|
|
if (r90.length > 0) {
|
|
const r149 = r90.filter((item) => item.signatures.includes(c14432_0));
|
|
if (r149.length > 0) {
|
|
const r156 = FileTypes.detectTypeByAdditionalCheck(fileChunk, r149);
|
|
c14432_1 = r156;
|
|
return !!r156 && r84.some((item) => item.toLowerCase() === c14432_1);
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|