welcome-ui
Version:
Customizable design system with react, typescript, tailwindcss and ariakit.
134 lines (133 loc) • 3.74 kB
JavaScript
"use client";
import "react/jsx-runtime";
import "./Icon-BisRi8B3.js";
import { A as o, C as m, M as s, V as c, a as r, D as d, X as l, P as g, b as u, c as x, d as f, Z as v } from "./index-DL4-ut3P.js";
const b = {
"7z": "application/x-7z-compressed",
aac: "audio/aac",
aif: "audio/x-aiff",
aifc: "audio/x-aiff",
aiff: "audio/x-aiff",
au: "audio/basic",
avi: "video/x-msvideo",
bmp: "image/x-ms-bmp",
bz: "application/x-bzip",
bz2: "application/x-bzip2",
csv: "text/csv",
doc: "application/msword",
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
gif: "image/gif",
gz: "application/gzip",
ico: "image/x-icon",
jpe: "image/jpeg",
jpeg: "image/jpeg",
jpg: "image/jpeg",
m1v: "video/mpeg",
mid: "audio/midi",
midi: "audio/x-midi",
mov: "video/quicktime",
movie: "video/x-sgi-movie",
mp2: "audio/mpeg",
mp3: "audio/mpeg",
mp4: "video/mp4",
mpa: "video/mpeg",
mpe: "video/mpeg",
mpeg: "video/mpeg",
mpg: "video/mpeg",
pbm: "image/x-portable-bitmap",
pdf: "application/pdf",
pgm: "image/x-portable-graymap",
png: "image/png",
pnm: "image/x-portable-anymap",
pot: "application/vnd.ms-powerpoint",
ppa: "application/vnd.ms-powerpoint",
ppm: "image/x-portable-pixmap",
pps: "application/vnd.ms-powerpoint",
ppt: "application/vnd.ms-powerpoint",
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
ps: "application/postscript",
pwz: "application/vnd.ms-powerpoint",
qt: "video/quicktime",
ra: "audio/x-pn-realaudio",
rar: "application/vnd.rar",
ras: "image/x-cmu-raster",
rgb: "image/x-rgb",
snd: "audio/basic",
svg: "image/svg+xml",
tif: "image/tiff",
tiff: "image/tiff",
wav: "audio/x-wav",
weba: "audio/webm",
webm: "video/webm",
webp: "image/webp",
wiz: "application/msword",
xbm: "image/x-xbitmap",
xls: "application/vnd.ms-excel",
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
xpm: "image/x-xpixmap",
xwd: "image/x-xwindowdump",
zip: "application/zip"
}, w = (i, e = 2) => {
if (i === 0)
return "0 Bytes";
const a = 1024, t = e < 0 ? 0 : e, n = ["Bytes", "KB", "MB", "GB"], p = Math.floor(Math.log(i) / Math.log(a));
return parseFloat((i / Math.pow(a, p)).toFixed(t)) + " " + n[p];
};
function B(i, e) {
const a = h(i);
if (!e && !a)
return o;
if (e === "image" || a && a.startsWith("image/"))
return m;
if (e === "audio" || a && a.startsWith("audio/"))
return s;
if (e === "video" || a && a.startsWith("video/"))
return c;
switch (a) {
case "application/gzip":
case "application/vnd.rar":
case "application/x-7z-compressed":
case "application/x-bzip":
case "application/x-bzip2":
case "application/zip":
return v;
case "application/msword":
return f;
case "application/pdf":
return x;
case "application/vnd.ms-excel":
return u;
case "application/vnd.ms-powerpoint":
case "application/vnd.openxmlformats-officedocument.presentationml.presentation":
return g;
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
return l;
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
return d;
case "text/csv":
return r;
default:
return o;
}
}
function z(i) {
return typeof i == "string" ? I(i).split("/").pop() : i.name;
}
function k(i) {
return i instanceof File && i.size ? w(i.size, 0) : null;
}
function h(i) {
if (typeof i == "string") {
const e = z(i).split(".").pop();
return b[e] || null;
} else
return i.type;
}
function I(i) {
return i.split("?")[0];
}
export {
k as a,
z as b,
B as g
};