const require_chunk = require("./chunk-9hOWP6kD.cjs");
const require_registries = require("./registries-yZkFfBWj.cjs");
const require_MediaRenderer = require("./MediaRenderer-D-hwg614.cjs");
let react_jsx_runtime = require("react/jsx-runtime");
//#region ../widgets/src/widgets/ImageWidget.tsx
var ImageWidget_exports = /* @__PURE__ */ require_chunk.__exportAll({
	ImageWidget: () => ImageWidget,
	imageWidgetPropertySchema: () => imageWidgetPropertySchema
});
function ImageWidget({ src = "", alt = "", borderRadius = "md", borderWidth = "none", borderColor = "muted", verticalSizing = "auto", fixedHeight = "200px", displayFit = "cover", focusPoint, linkUrl, resource, useCustomUrl, editMode = false }) {
	const effectiveSrc = useCustomUrl ? src : resource?.imageUrl ?? src;
	const effectiveAlt = resource?.title ?? alt;
	const isFixed = verticalSizing === "fixed";
	const content = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
		className: `w-full rounded-${borderRadius} ${require_registries.borderWidthClasses[borderWidth]} ${borderWidth !== "none" ? require_registries.borderColorClasses[borderColor] : ""} overflow-hidden`,
		style: isFixed ? { height: fixedHeight } : void 0,
		children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MediaRenderer.MediaRenderer, {
			mediaType: "image",
			src: effectiveSrc,
			alt: effectiveAlt,
			objectFit: isFixed ? displayFit : "contain",
			focusPoint: isFixed ? focusPoint : void 0
		})
	});
	if (linkUrl && !editMode) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
		href: linkUrl,
		target: "_blank",
		rel: "noopener noreferrer",
		children: content
	});
	return content;
}
const imageWidgetPropertySchema = {
	widgetType: "ImageWidget",
	displayName: "Image",
	fields: [
		{
			key: "resource",
			label: "Select Image",
			type: "resource",
			description: "Browse and select an image",
			allowedTypes: ["Medium"],
			group: "Content"
		},
		{
			key: "useCustomUrl",
			label: "Use Custom URL",
			type: "boolean",
			description: "Enter a custom image URL instead of selecting media",
			defaultValue: false,
			group: "Content"
		},
		{
			key: "src",
			label: "Image URL",
			type: "text",
			description: "The source URL of the image",
			defaultValue: "https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=800&auto=format&fit=crop",
			group: "Content",
			requiresKeyToBeTrue: "useCustomUrl"
		},
		{
			key: "alt",
			label: "Alt Text",
			type: "text",
			description: "Alternative text for the image (for accessibility)",
			defaultValue: "Placeholder image",
			group: "Content"
		},
		require_registries.getBorderRadiusField({
			key: "borderRadius",
			label: "Border Radius",
			description: "Border radius for the container",
			defaultValue: "md",
			group: "Design"
		}),
		require_registries.getBorderWidthField({
			key: "borderWidth",
			label: "Border Width",
			description: "Border width for the widget",
			defaultValue: "none",
			group: "Design"
		}),
		require_registries.getBorderColorField({
			key: "borderColor",
			label: "Border Color",
			description: "Border color for the widget",
			defaultValue: "muted",
			group: "Design"
		}),
		{
			key: "verticalSizing",
			label: "Vertical Sizing",
			type: "buttonGroup",
			description: "How the image height is determined",
			options: [{
				label: "Auto",
				value: "auto"
			}, {
				label: "Fixed",
				value: "fixed"
			}],
			defaultValue: "auto",
			group: "Design"
		},
		require_registries.getHeightField({
			key: "fixedHeight",
			label: "Height",
			description: "Fixed height of the image container",
			defaultValue: "200px",
			group: "Design",
			requiresKeyValue: {
				key: "verticalSizing",
				value: "fixed"
			}
		}),
		{
			key: "displayFit",
			label: "Display Fit",
			type: "buttonGroup",
			description: "How the image fills its container",
			options: [{
				label: "Cover",
				value: "cover"
			}, {
				label: "Contain",
				value: "contain"
			}],
			defaultValue: "cover",
			group: "Design",
			requiresKeyValue: {
				key: "verticalSizing",
				value: "fixed"
			}
		},
		{
			key: "focusPoint",
			label: "Focus Point",
			type: "contentPosition",
			description: "The focal point of the image within its container",
			defaultValue: "center",
			group: "Design",
			requiresKeyValue: {
				key: "verticalSizing",
				value: "fixed"
			}
		},
		{
			key: "linkUrl",
			label: "Link URL",
			type: "text",
			description: "Optional URL to wrap the image in a link",
			defaultValue: "",
			group: "Link"
		}
	]
};
//#endregion
Object.defineProperty(exports, "ImageWidget", {
	enumerable: true,
	get: function() {
		return ImageWidget;
	}
});
Object.defineProperty(exports, "ImageWidget_exports", {
	enumerable: true,
	get: function() {
		return ImageWidget_exports;
	}
});
Object.defineProperty(exports, "imageWidgetPropertySchema", {
	enumerable: true,
	get: function() {
		return imageWidgetPropertySchema;
	}
});

//# sourceMappingURL=ImageWidget-M1QQtfhV.cjs.map