import { n as cn } from "./utils-DXzSsU1e.js";
import { a as CardDescription_default, n as CardTitle_default, o as CardContent_default, r as CardHeader_default, s as Card_default } from "./card-X74FuL7B.js";
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, renderList, toDisplayString, unref, withCtx } from "vue";
//#region src/components/compositions/elements/card/InfoCard.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = ["src", "alt"];
var _hoisted_2 = { class: "flex items-center gap-2" };
var _hoisted_3 = {
	key: 0,
	class: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 text-sm"
};
var _hoisted_4 = { class: "font-medium text-muted-foreground" };
var _hoisted_5 = {
	key: 1,
	class: "text-sm text-muted-foreground"
};
var _hoisted_6 = {
	key: 0,
	class: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 text-sm"
};
var _hoisted_7 = { class: "font-medium text-muted-foreground" };
//#endregion
//#region src/components/compositions/elements/card/InfoCard.vue
var InfoCard_default = /* @__PURE__ */ defineComponent({
	__name: "InfoCard",
	props: {
		label: {},
		title: {},
		subtitle: {},
		showCard: {
			type: Boolean,
			default: true
		},
		icon: {},
		iconColor: {},
		headerImage: {},
		headerRatio: {},
		lessPadding: {
			type: Boolean,
			default: false
		},
		fields: { default: () => [] },
		item: { default: () => ({}) },
		classList: {}
	},
	setup(__props) {
		/**
		* `card.info` element composition.
		*
		* Wraps the cards/InfoCard composition as an element-tier component.
		* Renders a read-only summary tile: optional icon/image header, title,
		* subtitle, and a list of label/value display rows.
		*/
		const props = __props;
		const heading = computed(() => props.title ?? props.label);
		/** Resolve a dot-path string against the item object. */
		function resolvePath(path, item) {
			return path.split(".").reduce((acc, key) => {
				if (acc && typeof acc === "object" && key in acc) return acc[key];
			}, item);
		}
		function formatValue(field) {
			const raw = resolvePath(field.value, props.item);
			const str = raw !== void 0 && raw !== null ? String(raw) : field.value;
			return `${field.prepend ?? ""}${str}${field.append ?? ""}`;
		}
		return (_ctx, _cache) => {
			return props.showCard !== false ? (openBlock(), createBlock(unref(Card_default), {
				key: 0,
				class: normalizeClass(unref(cn)(props.classList))
			}, {
				default: withCtx(() => [
					props.headerImage ? (openBlock(), createElementBlock("div", {
						key: 0,
						class: "overflow-hidden rounded-t-lg bg-muted",
						style: normalizeStyle(props.headerRatio ? { aspectRatio: props.headerRatio } : { height: "10rem" })
					}, [createElementVNode("img", {
						src: props.headerImage,
						alt: heading.value ?? "Info card header",
						class: "h-full w-full object-cover"
					}, null, 8, _hoisted_1)], 4)) : createCommentVNode("", true),
					heading.value || props.subtitle || props.icon ? (openBlock(), createBlock(unref(CardHeader_default), {
						key: 1,
						class: normalizeClass(props.lessPadding ? "py-2" : "")
					}, {
						default: withCtx(() => [createElementVNode("div", _hoisted_2, [props.icon ? (openBlock(), createElementBlock("span", {
							key: 0,
							class: normalizeClass(["lucide text-lg", props.iconColor ?? "text-muted-foreground"])
						}, toDisplayString(props.icon), 3)) : createCommentVNode("", true), createElementVNode("div", null, [heading.value ? (openBlock(), createBlock(unref(CardTitle_default), { key: 0 }, {
							default: withCtx(() => [createTextVNode(toDisplayString(heading.value), 1)]),
							_: 1
						})) : createCommentVNode("", true), props.subtitle ? (openBlock(), createBlock(unref(CardDescription_default), { key: 1 }, {
							default: withCtx(() => [createTextVNode(toDisplayString(props.subtitle), 1)]),
							_: 1
						})) : createCommentVNode("", true)])])]),
						_: 1
					}, 8, ["class"])) : createCommentVNode("", true),
					createVNode(unref(CardContent_default), { class: normalizeClass(props.lessPadding ? "py-2" : "") }, {
						default: withCtx(() => [props.fields.length ? (openBlock(), createElementBlock("dl", _hoisted_3, [(openBlock(true), createElementBlock(Fragment, null, renderList(props.fields, (field) => {
							return openBlock(), createElementBlock(Fragment, { key: field.label + field.value }, [createElementVNode("dt", _hoisted_4, toDisplayString(field.label), 1), createElementVNode("dd", null, toDisplayString(formatValue(field)), 1)], 64);
						}), 128))])) : (openBlock(), createElementBlock("p", _hoisted_5, "No fields configured."))]),
						_: 1
					}, 8, ["class"])
				]),
				_: 1
			}, 8, ["class"])) : (openBlock(), createElementBlock("div", {
				key: 1,
				class: normalizeClass(unref(cn)(props.classList))
			}, [props.fields.length ? (openBlock(), createElementBlock("dl", _hoisted_6, [(openBlock(true), createElementBlock(Fragment, null, renderList(props.fields, (field) => {
				return openBlock(), createElementBlock(Fragment, { key: field.label + field.value }, [createElementVNode("dt", _hoisted_7, toDisplayString(field.label), 1), createElementVNode("dd", null, toDisplayString(formatValue(field)), 1)], 64);
			}), 128))])) : createCommentVNode("", true)], 2));
		};
	}
});
//#endregion
export { InfoCard_default as default };

//# sourceMappingURL=InfoCard-BDjlMov_.js.map