/*! ratio-ui · design system for knowledge sharing · https://github.com/losol/ratio-ui · (c) 2026 Losol AS · MPL-2.0 */
import "react";
import { jsx, jsxs } from "react/jsx-runtime";
//#region src/core/Image/Image.tsx
/**
* Generic Image with optional figure/caption semantics and pluggable renderer.
* - Default: renders <img|renderer>.
* - as="figure": wraps in <figure>.
* - caption: always wraps in <figure> with <figcaption>.
* @see ImageProps
* @see ImageRendererProps
*/
function Image(props) {
	const Img = props.renderer ?? ((p) => /* @__PURE__ */ jsx("img", {
		loading: props.loading ?? "lazy",
		decoding: "async",
		...p
	}));
	const imgProps = {
		src: props.src,
		alt: props.alt ?? "",
		width: props.width,
		height: props.height,
		className: props.imgClassName ?? "h-auto max-w-full rounded",
		loading: props.loading,
		...props.rendererProps
	};
	if (Boolean(props.caption) || props.as === "figure") {
		const wrapper = props.wrapperClassName ?? "max-w-lg py-8";
		const cap = props.figCaptionClassName ?? "mt-2 text-sm text-center text-(--text-subtle)";
		return /* @__PURE__ */ jsxs("figure", {
			className: wrapper,
			children: [/* @__PURE__ */ jsx(Img, { ...imgProps }), props.caption ? /* @__PURE__ */ jsx("figcaption", {
				className: cap,
				children: /* @__PURE__ */ jsx("p", { children: props.caption })
			}) : null]
		});
	}
	return /* @__PURE__ */ jsx(Img, { ...imgProps });
}
//#endregion
export { Image };

//# sourceMappingURL=Image.js.map