decord/stable/source/lib/uploader/heicFilename.tsx
github-actions 528a3dd5ba chore: update source for stable 345.9
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4745.js (118.4 MB)
2026-09-18 20:18:48 +00:00

52 lines
1.4 KiB
TypeScript

// Module ID: 5171
// Function ID: 5172
// Name: heicFilename
// Dependencies: [2]
// Exports: heicMimeType, isHeicFile, renameToJpegExtension
// Module 5171 (heicFilename)
import size from "module_2" /* 2 */;
const set = new Set(["image/heic", "image/heif", "image/heic-sequence", "image/heif-sequence"]);
const set1 = new Set([".heic", ".heif", ".hif"]);
const re2 = /\.(heic|heif|hif)$/i;
const result = size.fileFinishedImporting("lib/uploader/heicFilename.tsx");
export const isHeicFile = function isHeicFile(type) {
if (set.has(type.type)) {
return true;
} else {
let str = "";
if (typeof type.name === "string") {
str = type.name;
}
const lastIndexOfResult = str.lastIndexOf(".");
let hasItem = lastIndexOfResult >= 0;
if (hasItem) {
hasItem = set1.has(str.slice(lastIndexOfResult).toLowerCase());
const str3 = str.slice(lastIndexOfResult);
}
return hasItem;
}
};
export const heicMimeType = function heicMimeType(type) {
if ("" !== type.type) {
let str3 = type.type;
} else {
const formatted = type.name.toLowerCase();
str3 = "image/heif";
if (formatted.endsWith(".heic")) {
str3 = "image/heic";
}
}
return str3;
};
export const renameToJpegExtension = function renameToJpegExtension(name) {
if (re2.test(name)) {
let replaced = name.replace(re2, ".jpg");
} else {
const _HermesInternal = HermesInternal;
replaced = "" + name + ".jpg";
}
return replaced;
};