/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
"use client";
"use client";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../../_virtual/_rolldown/runtime.cjs");
const require_styles_styler = require("../../../styles/styler.cjs");
const require_components_VStack = require("../../VStack.cjs");
const require_utils_getUnscaledAnchorRect = require("../../../utils/getUnscaledAnchorRect.cjs");
const require_components_client_Select_selectContext = require("./selectContext.cjs");
let react = require("react");
let react_jsx_runtime = require("react/jsx-runtime");
let _ariakit_react = require("@ariakit/react");
//#region src/components/client/Select/SelectContent.tsx
/**
* **▾ Select content panel**
*
* @componentType Client component
*
* @description
* The floating listbox container. Renders Ariakit `SelectPopover` with UDS
* styling.
*/
const SelectContent = (0, react.forwardRef)(function SelectContent({ children, className, size = "default", variant = "default", slotProps, gutter = 4, sameWidth = true, portal = true, unmountOnHide = false, keepOpenOnInteractOutside = false, maxHeight = 240, disableAutoBorderRadius, nestedBorderRadius = !disableAutoBorderRadius, nestedBorderRadiusSize, nestedBorderRadiusSpacing, nestedBorderRadiusWidth, ...props }, ref) {
	const { className: rootClassName, style: rootStyle, ...rootSlotProps } = slotProps?.root ?? {};
	const resolvedMaxHeight = typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight;
	const select = (0, _ariakit_react.useSelectContext)();
	const { triggerWrapperRef } = require_components_client_Select_selectContext.useSelectFieldContext();
	const mounted = (0, _ariakit_react.useStoreState)(select, "mounted");
	const hasResetActiveItemRef = (0, react.useRef)(false);
	const getAnchorRect = (0, react.useCallback)((anchor) => {
		const wrapper = triggerWrapperRef.current;
		if (wrapper) return require_utils_getUnscaledAnchorRect.getUnscaledAnchorRect(wrapper);
		return require_utils_getUnscaledAnchorRect.getUnscaledAnchorRect(anchor);
	}, [triggerWrapperRef]);
	(0, react.useLayoutEffect)(() => {
		if (!select) return;
		if (mounted && !hasResetActiveItemRef.current) {
			select.setActiveId(null);
			hasResetActiveItemRef.current = true;
		}
		if (!mounted) hasResetActiveItemRef.current = false;
	}, [mounted, select]);
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.SelectPopover, {
		ref,
		render: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_VStack.VStack, {
			elevation: "3",
			overflow: "auto",
			borderRadius: "md",
			nestedBorderRadius,
			nestedBorderRadiusSize,
			nestedBorderRadiusSpacing,
			nestedBorderRadiusWidth,
			...rootSlotProps,
			style: {
				maxHeight: resolvedMaxHeight,
				...rootStyle
			},
			className: require_styles_styler.cx(require_styles_styler.getStyles({
				selectcontentSizeRoot: size,
				selectcontentVariantRoot: variant
			}), "z-50", "focus:outline-none", className, rootClassName),
			children
		}),
		...props,
		gutter,
		sameWidth,
		getAnchorRect,
		portal,
		unmountOnHide,
		hideOnInteractOutside: !keepOpenOnInteractOutside
	});
});
SelectContent.displayName = "SelectContent";
//#endregion
exports.SelectContent = SelectContent;
