synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
88 lines (87 loc) • 2.05 kB
JavaScript
import { implementsCloudProviderFileHandleInterface as i } from "../../utils/types/IsType.js";
import { PreviewRendererType as e } from "./PreviewRendererType.js";
const s = [
"image/bmp",
"image/pjpeg",
"image/jpeg",
"image/jpg",
"image/jpe",
"image/gif",
"image/png",
"image/svg+xml"
], o = [".mp4", ".m4a", ".m4p", ".m4b", ".m4r", ".m4v"], p = [".ogv", ".ogg"], c = [...o, ...p, ".webm"], m = [
".cwl",
".wdl",
".json",
".awk",
".bat",
".btm",
".c",
".cmd",
".cpp",
".cxx",
".def",
".dlg",
".dpc",
".dpj",
".dtd",
".h",
".hdl",
".hpp",
".hrc",
".html",
".hxx",
".inc",
".ini",
".inl",
".ins",
".ipy",
".java",
".js",
".jsp",
".l",
".lgt",
".ll",
".par",
".pl",
".py",
".r",
".rc",
".rdb",
".res",
".s",
".sbl",
".scp",
".sh",
".sql",
".src",
".srs",
".xml",
".xrb",
".y",
".yaml",
".yxx"
], u = [".md", ".markdown", ".rmd"];
function f(t) {
const n = t.lastIndexOf(".");
return n === -1 ? null : t.substring(n);
}
function g(t) {
if (!i(t))
return e.NONE;
const n = f(t.fileName);
return n && c.includes(n) ? e.VIDEO : n === ".ipynb" ? e.IPYNB : s.includes(t.contentType) ? e.IMAGE : t.contentType === "text/html" ? e.HTML : t.contentType.toLowerCase().startsWith("application/pdf") ? e.PDF : n && m.includes(n) ? e.CODE : n && u.includes(n) ? e.MARKDOWN : t.contentType === "image/tiff" ? e.TIFF : e.NONE;
}
function a(t, n) {
const r = t.contentType;
return i(t) ? s.includes(t.contentType) ? e.IMAGE : r.toLowerCase().startsWith("text/") ? r.toLowerCase() === "text/csv" ? n.contentType === "application/zip" ? e.ZIP : e.CSV : r.toLowerCase() === "text/tab-separated-values" ? e.TAB : e.PLAINTEXT : r.toLowerCase().startsWith("application/pdf") ? e.PDF : e.NONE : e.NONE;
}
export {
m as CODE_EXTENSIONS,
s as IMAGE_CONTENT_TYPES,
u as MARKDOWN_EXTENSIONS,
c as VIDEO_EXTENSIONS,
g as getOriginalFileHandleRenderer,
a as getPreviewFileHandleRenderer
};
//# sourceMappingURL=PreviewUtils.js.map