import { cn } from "./index3.js";
import { Button } from "./index6.js";
import { AnimatePresence } from "./index308.js";
import { motion } from "./index359.js";
import { cva } from "class-variance-authority";
import { AlertCircle, AlertTriangle, CheckCircle, Info, X } from "lucide-react";
import * as React from "react";
import { jsx, jsxs } from "react/jsx-runtime";
//#region src/components/organisms/ai/AISystemMessage/AISystemMessage.tsx
var systemMessageVariants = cva("flex items-start gap-3 px-4 py-3 rounded-xl border", {
	variants: {
		variant: {
			info: "bg-primary/10 border-primary text-primary",
			success: "bg-success/10 border-success/50 text-success",
			warning: "bg-warning/10 border-warning/50 text-warning",
			error: "bg-destructive/10 border-destructive/50 text-destructive",
			neutral: "bg-muted border-border text-secondary-foreground"
		},
		size: {
			sm: "px-3 py-2 text-xs",
			md: "px-4 py-3 text-sm",
			lg: "px-5 py-4 text-base"
		}
	},
	defaultVariants: {
		variant: "info",
		size: "md"
	}
});
var systemMessageIconVariants = cva("shrink-0 mt-0.5", {
	variants: {
		variant: {
			info: "text-primary",
			success: "text-success",
			warning: "text-warning",
			error: "text-destructive",
			neutral: "text-quaternary-foreground"
		},
		size: {
			sm: "size-4",
			md: "size-5",
			lg: "size-6"
		}
	},
	defaultVariants: {
		variant: "info",
		size: "md"
	}
});
var iconMap = {
	info: Info,
	success: CheckCircle,
	warning: AlertTriangle,
	error: AlertCircle,
	neutral: Info
};
function AISystemMessage({ children, title, variant = "info", size = "md", dismissible = false, onDismiss, icon, hideIcon = false, actions, className }) {
	const [isVisible, setIsVisible] = React.useState(true);
	const handleDismiss = () => {
		setIsVisible(false);
		onDismiss?.();
	};
	const IconComponent = iconMap[variant || "info"];
	return /* @__PURE__ */ jsx(AnimatePresence, { children: isVisible && /* @__PURE__ */ jsxs(motion.div, {
		"data-slot": "ai-system-message",
		role: "status",
		"aria-live": "polite",
		initial: {
			opacity: 0,
			y: -10
		},
		animate: {
			opacity: 1,
			y: 0
		},
		exit: {
			opacity: 0,
			y: -10,
			height: 0,
			marginBottom: 0
		},
		transition: {
			duration: .2,
			ease: [
				.4,
				0,
				.2,
				1
			]
		},
		className: cn(systemMessageVariants({
			variant,
			size
		}), "motion-reduce:transition-none", className),
		children: [
			!hideIcon && /* @__PURE__ */ jsx("div", {
				className: systemMessageIconVariants({
					variant,
					size
				}),
				"aria-hidden": "true",
				children: icon || /* @__PURE__ */ jsx(IconComponent, { className: "size-full" })
			}),
			/* @__PURE__ */ jsxs("div", {
				className: "flex-1 min-w-0",
				children: [
					title && /* @__PURE__ */ jsx("p", {
						className: "font-medium mb-0.5",
						children: title
					}),
					/* @__PURE__ */ jsx("div", {
						className: cn(!title && "leading-snug"),
						children
					}),
					actions && /* @__PURE__ */ jsx("div", {
						className: "flex items-center gap-2 mt-2",
						children: actions
					})
				]
			}),
			dismissible && /* @__PURE__ */ jsx(Button, {
				appearance: "ghost",
				variant: "secondary",
				size: "sm",
				onClick: handleDismiss,
				"aria-label": "Dismiss message",
				className: "size-6 p-0 shrink-0 -mt-0.5 -me-1 hover:bg-fg-primary/5",
				children: /* @__PURE__ */ jsx(X, { className: "size-4" })
			})
		]
	}) });
}
AISystemMessage.displayName = "AISystemMessage";
function AISystemMessageBanner({ children, variant = "info", dismissible = false, onDismiss, icon, action, className }) {
	const [isVisible, setIsVisible] = React.useState(true);
	const handleDismiss = () => {
		setIsVisible(false);
		onDismiss?.();
	};
	const IconComponent = iconMap[variant || "info"];
	return /* @__PURE__ */ jsx(AnimatePresence, { children: isVisible && /* @__PURE__ */ jsxs(motion.div, {
		"data-slot": "ai-system-message-banner",
		role: "status",
		"aria-live": "polite",
		initial: {
			opacity: 0,
			height: 0
		},
		animate: {
			opacity: 1,
			height: "auto"
		},
		exit: {
			opacity: 0,
			height: 0
		},
		transition: {
			duration: .2,
			ease: [
				.4,
				0,
				.2,
				1
			]
		},
		className: cn("w-full px-4 py-2 flex items-center justify-center gap-3 motion-reduce:transition-none", variant === "info" && "bg-primary/10 text-primary", variant === "success" && "bg-success/10 text-success", variant === "warning" && "bg-warning/10 text-warning", variant === "error" && "bg-destructive/10 text-destructive", variant === "neutral" && "bg-muted text-secondary-foreground", className),
		children: [/* @__PURE__ */ jsxs("div", {
			className: "flex items-center gap-2 flex-1 justify-center",
			children: [
				icon || /* @__PURE__ */ jsx(IconComponent, {
					"aria-hidden": "true",
					className: cn("size-4 shrink-0", variant === "info" && "text-primary", variant === "success" && "text-success", variant === "warning" && "text-warning", variant === "error" && "text-destructive", variant === "neutral" && "text-quaternary-foreground")
				}),
				/* @__PURE__ */ jsx("span", {
					className: "text-sm",
					children
				}),
				action
			]
		}), dismissible && /* @__PURE__ */ jsx("button", {
			type: "button",
			onClick: handleDismiss,
			"aria-label": "Dismiss banner",
			className: "p-1 rounded hover:bg-fg-primary/5 transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
			children: /* @__PURE__ */ jsx(X, { className: "size-4" })
		})]
	}) });
}
AISystemMessageBanner.displayName = "AISystemMessageBanner";
//#endregion
export { AISystemMessage, AISystemMessageBanner, systemMessageIconVariants, systemMessageVariants };

//# sourceMappingURL=index439.js.map