import { jsx, jsxs } from 'react/jsx-runtime';
import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from './primitives/Tooltip.js';
import { r as renderIcon } from './renderIcon-C6twJSqH.js';
import { c as cn } from './utils-BJnb9o5c.js';
import { c as createLucideIcon } from './createLucideIcon-C8ycilSN.js';
import { P as Popover } from './Popover-C1FNlRtU.js';
import { b as Button } from './Button-DV9xCqlc.js';

/**
 * @license lucide-react v0.577.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */


const __iconNode = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
  ["path", { d: "M12 17h.01", key: "p32p05" }]
];
const CircleQuestionMark = createLucideIcon("circle-question-mark", __iconNode);

const SIDE_MAP = {
  top: "top",
  bottom: "bottom",
  left: "left",
  right: "right",
  auto: "top"
};
const HelpIcon = (helpIconProps) => {
  const icon = helpIconProps.icon ?? CircleQuestionMark;
  const iconElement = /* @__PURE__ */ jsx(
    "span",
    {
      className: cn(
        "inline-flex cursor-help text-muted-foreground transition-colors hover:text-foreground",
        helpIconProps.onClick && "cursor-pointer",
        helpIconProps.className
      ),
      onClick: helpIconProps.onClick,
      children: renderIcon(icon, "size-3.5")
    }
  );
  if (helpIconProps.popoverProps) {
    const { title, description, helpLinkProps } = helpIconProps.popoverProps;
    return /* @__PURE__ */ jsxs(Popover, { trigger: iconElement, children: [
      title && /* @__PURE__ */ jsx(Popover.Title, { children: title }),
      description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description }),
      helpLinkProps && /* @__PURE__ */ jsx(
        Button,
        {
          variant: "link",
          size: "sm",
          className: "mt-1 h-auto self-start p-0",
          ...helpLinkProps,
          href: helpLinkProps.href
        }
      )
    ] });
  }
  if (helpIconProps.tooltipProps?.content) {
    const side = SIDE_MAP[helpIconProps.tooltipProps.position ?? "auto"] ?? "top";
    return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
      /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: iconElement }),
      /* @__PURE__ */ jsx(TooltipContent, { side, children: helpIconProps.tooltipProps.content })
    ] }) });
  }
  return iconElement;
};

export { HelpIcon as H };
//# sourceMappingURL=HelpIcon-Cm3ZgoCx.js.map
