/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
"use client";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../../_virtual/_rolldown/runtime.cjs");
const require_components_client_Modal_modalStore = require("./modalStore.cjs");
const require_components_client_Modal_UDSModalConfigProvider = require("./UDSModalConfigProvider.cjs");
const require_components_client_Modal_ModalActions = require("./ModalActions.cjs");
const require_components_client_Modal_ModalContent = require("./ModalContent.cjs");
const require_components_client_Modal_ModalDescription = require("./ModalDescription.cjs");
const require_components_client_Modal_ModalTitle = require("./ModalTitle.cjs");
const require_components_client_Modal_Modal = require("./Modal.cjs");
let react = require("react");
let react_jsx_runtime = require("react/jsx-runtime");
let motion_react = require("motion/react");
//#region src/components/client/Modal/ManagedModal.tsx
const ManagedModal = ({ slot }) => {
	const { animationDuration } = require_components_client_Modal_UDSModalConfigProvider.useModalConfig();
	const durationOut = typeof animationDuration === "number" ? animationDuration : animationDuration.out;
	const exitDuration = (0, motion_react.useReducedMotion)() || slot.props.reduceMotion ? 0 : durationOut;
	(0, react.useEffect)(() => {
		if (!slot.closing) return;
		const ownerId = slot.ownerId;
		const timer = window.setTimeout(() => require_components_client_Modal_modalStore.removeModalEntry(ownerId), exitDuration);
		return () => window.clearTimeout(timer);
	}, [
		slot.closing,
		slot.ownerId,
		exitDuration
	]);
	const { onClose, title, description, content, actions, ...modalProps } = slot.props;
	const { actionStartContent } = slot.options;
	return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_client_Modal_Modal.Modal, {
		...modalProps,
		open: slot.open,
		onClose: (event) => {
			onClose?.(event);
			require_components_client_Modal_modalStore.closeModalEntry(slot.ownerId);
		},
		children: [
			title != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Modal_ModalTitle.ModalTitle, { children: title }) : null,
			description != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Modal_ModalDescription.ModalDescription, { children: description }) : null,
			content != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Modal_ModalContent.ModalContent, { children: content }) : null,
			actions != null || actionStartContent != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Modal_ModalActions.ModalActions, {
				startContent: actionStartContent,
				children: actions
			}) : null
		]
	});
};
ManagedModal.displayName = "ManagedModal";
//#endregion
exports.ManagedModal = ManagedModal;
