import { cn } from "./index3.js";
import { CirclePlay, Code2, FileText, Film, FolderClosed, Image, Music, Table } from "lucide-react";
import { jsx, jsxs } from "react/jsx-runtime";
//#region src/components/molecules/files/FileTypeIcon/FileTypeIcon.tsx
var es = (bg, accent) => ({
	bg,
	accent
});
var PRIMARY = es("bg-primary", "bg-primary/10");
var SUCCESS = es("bg-success", "bg-success/10");
var ORANGE_500 = es("bg-orange-500", "bg-orange-500/10");
var BLUE_500_MUTED = es("bg-blue-500", "bg-muted");
var INDIGO_600 = es("bg-indigo-600", "bg-indigo-600/10");
var GRAY_700 = es("bg-gray-700", "bg-gray-700/10");
var PINK_MUTED = es("bg-pink-600", "bg-muted");
var extensionStyleMap = {
	img: PRIMARY,
	jpg: PRIMARY,
	jpeg: PRIMARY,
	png: PRIMARY,
	webp: PRIMARY,
	tiff: PRIMARY,
	gif: PRIMARY,
	svg: PRIMARY,
	eps: PRIMARY,
	pdf: es("bg-destructive", "bg-destructive/10"),
	doc: es("bg-blue-300", "bg-blue-300/15"),
	docx: es("bg-blue-300", "bg-blue-300/15"),
	txt: es("bg-gray-500", "bg-gray-500/10"),
	csv: SUCCESS,
	xls: SUCCESS,
	xlsx: SUCCESS,
	ppt: ORANGE_500,
	pptx: ORANGE_500,
	fig: PRIMARY,
	ai: es("bg-orange-400", "bg-orange-400/10"),
	psd: es("bg-blue-500", "bg-blue-500/10"),
	indd: es("bg-fuchsia-600", "bg-fuchsia-600/10"),
	aep: es("bg-purple-600", "bg-purple-600/10"),
	mp3: PINK_MUTED,
	wav: PINK_MUTED,
	mp4: BLUE_500_MUTED,
	mpeg: BLUE_500_MUTED,
	avi: BLUE_500_MUTED,
	mkv: BLUE_500_MUTED,
	mov: BLUE_500_MUTED,
	html: INDIGO_600,
	css: INDIGO_600,
	rss: ORANGE_500,
	sql: INDIGO_600,
	js: INDIGO_600,
	json: GRAY_700,
	java: ORANGE_500,
	xml: PRIMARY,
	exe: GRAY_700,
	dmg: GRAY_700,
	zip: GRAY_700,
	rar: GRAY_700
};
/** Backward-compatible extension to badge color mapping */
var extensionColors = Object.fromEntries(Object.entries(extensionStyleMap).map(([ext, { bg }]) => [ext, bg]));
var fallbackStyle = es("bg-muted-foreground", "bg-muted");
var simpleFileTypeIcons = {
	empty: null,
	folder: FolderClosed,
	image: Image,
	video: Film,
	play: CirclePlay,
	audio: Music,
	pdf: FileText,
	document: FileText,
	spreadsheet: Table,
	code: Code2
};
var sizeMap = {
	sm: "size-8",
	md: "size-10",
	lg: "size-12"
};
var badgeFont = {
	sm: "text-[8px]",
	md: "text-[10px]",
	lg: "text-[12px]"
};
var labelFont = {
	sm: "text-[7px]",
	md: "text-[9px]",
	lg: "text-[11px]"
};
function FileTypeIcon({ extension, fileType, variant = "default", size = "md", className }) {
	const normalizedExt = extension?.toLowerCase().replace(".", "");
	const hasExtension = !!normalizedExt;
	const isSimple = !hasExtension && !!fileType;
	const activeStyle = hasExtension ? extensionStyleMap[normalizedExt] ?? fallbackStyle : PRIMARY;
	const label = hasExtension ? normalizedExt.toUpperCase().slice(0, 4) : void 0;
	const Icon = isSimple && fileType ? simpleFileTypeIcons[fileType] : null;
	const ariaLabel = normalizedExt ? `${normalizedExt} file type icon` : fileType ? `${fileType} file type icon` : "file type icon";
	const useFoldedPage = variant === "default" && hasExtension;
	return /* @__PURE__ */ jsxs("div", {
		className: cn("relative", sizeMap[size], className),
		"data-slot": "file-type-icon",
		role: "img",
		"aria-label": ariaLabel,
		children: [
			useFoldedPage ? /* @__PURE__ */ jsxs("svg", {
				viewBox: "0 0 40 40",
				fill: "none",
				className: "size-full",
				"aria-hidden": "true",
				children: [/* @__PURE__ */ jsx("path", {
					d: "M7 4C7 1.79086 8.79086 0 11 0H25L33 8V36C33 38.2091 31.2091 40 29 40H11C8.79086 40 7 38.2091 7 36V4Z",
					className: "fill-muted stroke-border",
					strokeWidth: "1"
				}), /* @__PURE__ */ jsx("path", {
					d: "M25 0L33 8H27C25.8954 8 25 7.10457 25 6V0Z",
					className: "fill-border"
				})]
			}) : /* @__PURE__ */ jsx("div", {
				className: cn("absolute inset-x-[10%] inset-y-0 rounded", variant === "default" ? "bg-background border border-border" : variant === "accent" ? activeStyle.accent : activeStyle.bg),
				"aria-hidden": "true"
			}),
			label && variant === "default" && /* @__PURE__ */ jsx("div", {
				className: cn("absolute bottom-[15%] start-[2.5%] rounded-[2px] px-[3px] py-[2px] inline-flex items-center", activeStyle.bg),
				children: /* @__PURE__ */ jsx("span", {
					className: cn("font-bold text-white uppercase leading-none", badgeFont[size]),
					children: label
				})
			}),
			label && variant !== "default" && /* @__PURE__ */ jsx("div", {
				className: cn("absolute top-[57.5%] bottom-[15%] left-[10%] right-[10%] flex items-center justify-center font-bold uppercase leading-none", labelFont[size], variant === "solid" ? "text-white" : "text-accent-foreground"),
				children: label
			}),
			Icon && /* @__PURE__ */ jsx("div", {
				className: cn("absolute flex items-center justify-center", variant === "default" ? "top-[37.5%] bottom-[17.5%] left-[27.5%] right-[27.5%]" : "top-[40%] bottom-[20%] left-[30%] right-[30%]"),
				children: /* @__PURE__ */ jsx(Icon, {
					className: cn("size-full", variant === "solid" ? "text-white" : "text-primary"),
					strokeWidth: 2,
					"aria-hidden": "true"
				})
			})
		]
	});
}
FileTypeIcon.displayName = "FileTypeIcon";
//#endregion
export { FileTypeIcon, extensionColors };

//# sourceMappingURL=index383.js.map