import { jsx, jsxs } from "react/jsx-runtime";
import * as RadixTooltip from "@radix-ui/react-tooltip";
import { TooltipContent } from "./TooltipContent.js";
import { TooltipInfoTrigger } from "./TooltipInfoTrigger.js";
const Tooltip = ({
  content,
  children: trigger,
  open,
  defaultOpen,
  onOpenChange,
  delayDuration,
  noPortal
}) => {
  if (trigger.type !== TooltipTrigger) {
    trigger = /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: trigger });
  }
  if (typeof content === "string") {
    content = { text: content };
  }
  const finalContent = content && "text" in content ? /* @__PURE__ */ jsx(TooltipContent, { ...content }) : content;
  return /* @__PURE__ */ jsxs(RadixTooltip.Root, { defaultOpen, open, onOpenChange, delayDuration, children: [
    trigger,
    noPortal ? finalContent : /* @__PURE__ */ jsx(RadixTooltip.Portal, { children: finalContent })
  ] });
};
const TooltipTrigger = RadixTooltip.Trigger;
TooltipTrigger.displayName = "Tooltip.Trigger";
Tooltip.Content = TooltipContent;
Tooltip.Trigger = TooltipTrigger;
Tooltip.InfoTrigger = TooltipInfoTrigger;
export {
  Tooltip,
  TooltipTrigger
};
