"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Admonition = Admonition;
const jsx_runtime_1 = require("react/jsx-runtime");
const lucide_react_native_1 = require("lucide-react-native");
const react_native_1 = require("react-native");
const ui_1 = require("../../ui");
const text_1 = require("./text");
function Admonition({ variant = "default", size = "md", title, children, iconLeft, style, }) {
    const { theme, icons } = (0, ui_1.useTheme)();
    const defaultIconLeft = (() => {
        if (iconLeft)
            return iconLeft;
        switch (variant) {
            case "success":
                return lucide_react_native_1.CheckCircle;
            case "error":
                return lucide_react_native_1.XCircle;
            case "info":
                return lucide_react_native_1.Info;
            case "warning":
                return lucide_react_native_1.AlertCircle;
            default:
                return lucide_react_native_1.Info;
        }
    })();
    const FinalIconLeft = defaultIconLeft;
    const variantStyles = {
        default: {
            backgroundColor: theme.colors.secondary,
            borderColor: theme.colors.border,
        },
        success: {
            backgroundColor: (0, ui_1.hexToRgba)(theme.colors.success, 0.08),
            borderColor: theme.colors.success,
        },
        error: {
            backgroundColor: (0, ui_1.hexToRgba)(theme.colors.destructive, 0.08),
            borderColor: theme.colors.destructive,
        },
        info: {
            backgroundColor: (0, ui_1.hexToRgba)(theme.colors.info, 0.08),
            borderColor: theme.colors.info,
        },
        warning: {
            backgroundColor: (0, ui_1.hexToRgba)(theme.colors.warning, 0.08),
            borderColor: theme.colors.warning,
        },
    };
    const iconColor = (() => {
        switch (variant) {
            case "success":
                return theme.colors.success;
            case "error":
                return theme.colors.destructive;
            case "info":
                return theme.colors.info;
            case "warning":
                return theme.colors.warning;
            default:
                return theme.colors.foreground;
        }
    })();
    const sizeConfig = (() => {
        switch (size) {
            case "sm":
                return {
                    borderRadius: 8,
                    padding: 12,
                    gap: 6,
                    iconSize: icons.size.md,
                    titleSize: "base",
                    contentSize: "sm",
                    innerGap: 8,
                };
            case "lg":
                return {
                    borderRadius: 16,
                    padding: 20,
                    gap: 12,
                    iconSize: icons.size.xl,
                    titleSize: "xl",
                    contentSize: "lg",
                    innerGap: 16,
                };
            case "md":
            default:
                return {
                    borderRadius: 12,
                    padding: 16,
                    gap: 8,
                    iconSize: icons.size.lg,
                    titleSize: "lg",
                    contentSize: "base",
                    innerGap: 12,
                };
        }
    })();
    let childrenIn = ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
            paddingLeft: title ? sizeConfig.iconSize + sizeConfig.innerGap : 0,
        }, children: typeof children === "string" ? ((0, jsx_runtime_1.jsx)(text_1.Text, { size: sizeConfig.contentSize, style: { color: theme.colors.cardForeground, flexWrap: "wrap" }, children: children })) : (children) }));
    return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
            {
                borderRadius: sizeConfig.borderRadius,
                borderWidth: 1,
                padding: sizeConfig.padding,
                gap: sizeConfig.gap,
            },
            variantStyles[variant],
            style,
        ], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: {
                    flexDirection: "row",
                    alignItems: "flex-start",
                    gap: sizeConfig.innerGap,
                }, children: [FinalIconLeft && ((0, jsx_runtime_1.jsx)(FinalIconLeft, { size: sizeConfig.iconSize, color: iconColor })), title ? ((0, jsx_runtime_1.jsx)(text_1.Text, { size: sizeConfig.titleSize, weight: "semibold", style: { flex: 1 }, children: title })) : (children && (0, jsx_runtime_1.jsx)(react_native_1.View, { style: { flex: 1 }, children: childrenIn }))] }), children && title && childrenIn] }));
}
//# sourceMappingURL=admonition.js.map