"use client";
import * as React from "react";
import { usePreviewCardRootContext } from "../root/PreviewCardContext.js";
import { PreviewCardPortalContext } from "./PreviewCardPortalContext.js";
import { FloatingPortalLite } from "../../utils/FloatingPortalLite.js";
import { jsx } from "react/jsx-runtime";
const PreviewCardPortal = /* @__PURE__ */ React.forwardRef(function PreviewCardPortal2(props, forwardedRef) {
  const {
    keepMounted = false,
    ...portalProps
  } = props;
  const {
    mounted
  } = usePreviewCardRootContext();
  const shouldRender = mounted || keepMounted;
  if (!shouldRender) {
    return null;
  }
  return /* @__PURE__ */ jsx(PreviewCardPortalContext.Provider, {
    value: keepMounted,
    children: /* @__PURE__ */ jsx(FloatingPortalLite, {
      ref: forwardedRef,
      ...portalProps
    })
  });
});
if (process.env.NODE_ENV !== "production") PreviewCardPortal.displayName = "PreviewCardPortal";
export {
  PreviewCardPortal
};
//# sourceMappingURL=PreviewCardPortal.js.map
