"use client";
'use strict';

var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var Image = require('next/image');
var server = require('@windrun-huaiin/base-ui/components/server');
var ui = require('@windrun-huaiin/base-ui/ui');

function AdsAlertDialog({ open, onOpenChange, title, description, imgSrc, imgHref, cancelText, onCancel, confirmText, onConfirm, }) {
    const [imgError, setImgError] = React.useState(false);
    return (jsxRuntime.jsx(ui.AlertDialog, { open: open, onOpenChange: onOpenChange, children: jsxRuntime.jsxs(ui.AlertDialogContent, { className: "fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-white dark:bg-neutral-900 rounded-2xl shadow-2xl border border-neutral-200 dark:border-neutral-700 max-w-md w-full min-w-[320px] p-4 flex flex-col items-stretch", children: [jsxRuntime.jsxs("div", { className: "flex flex-row items-center justify-between mb-2", children: [jsxRuntime.jsx(ui.AlertDialogTitle, { asChild: true, children: jsxRuntime.jsxs("div", { className: "flex flex-row items-center gap-1 min-w-0 text-xl font-semibold", children: [jsxRuntime.jsx(server.globalLucideIcons.Info, { className: "w-5 h-5" }), jsxRuntime.jsx("span", { className: "truncate", children: title })] }) }), jsxRuntime.jsx("button", { className: "text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200 text-xl ml-4", onClick: () => onOpenChange(false), "aria-label": "Close", tabIndex: 0, children: jsxRuntime.jsx(server.globalLucideIcons.X, { className: "w-5 h-5" }) })] }), jsxRuntime.jsx(ui.AlertDialogDescription, { className: "text-base font-medium text-neutral-800 dark:text-neutral-100 mb-2", children: description }), imgSrc && (jsxRuntime.jsx("div", { className: "w-full max-w-[400px] h-[220px] relative flex items-center justify-center mb-2", children: imgError ? (jsxRuntime.jsxs("div", { className: "absolute inset-0 flex flex-col items-center justify-center bg-gray-100 dark:bg-neutral-800 border border-dashed border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-400 text-sm", children: [jsxRuntime.jsx(server.globalLucideIcons.ImageOff, { className: "w-12 h-12 mb-2" }), jsxRuntime.jsx("span", { children: "Image loading failed" })] })) : imgHref ? (jsxRuntime.jsx("a", { href: imgHref, target: "_blank", rel: "noopener noreferrer", className: "block w-full h-full", children: jsxRuntime.jsx(Image, { src: imgSrc, alt: "image", fill: true, className: "object-contain rounded-lg", priority: false, placeholder: "empty", unoptimized: true, onError: () => setImgError(true), sizes: "(max-width: 400px) 100vw, 400px" }) })) : (jsxRuntime.jsx(Image, { src: imgSrc, alt: "image", fill: true, className: "object-contain rounded-lg", priority: false, placeholder: "empty", unoptimized: true, onError: () => setImgError(true), sizes: "(max-width: 400px) 100vw, 400px" })) })), (cancelText || confirmText) && (jsxRuntime.jsxs("div", { className: "flex justify-end gap-2 mt-2", children: [cancelText && (jsxRuntime.jsx("button", { onClick: () => {
                                onOpenChange(false);
                                onCancel === null || onCancel === void 0 ? void 0 : onCancel();
                            }, className: "px-6 py-2 rounded-lg border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-200 font-semibold hover:bg-neutral-100 dark:hover:bg-neutral-700 transition", children: cancelText })), confirmText && (jsxRuntime.jsx(ui.AlertDialogAction, { onClick: () => {
                                onOpenChange(false);
                                onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
                            }, className: "px-6 py-2 rounded-lg bg-purple-500 text-white font-semibold hover:bg-purple-600 transition", children: confirmText }))] }))] }) }));
}

exports.AdsAlertDialog = AdsAlertDialog;
