import { t as B } from "./vendor/react.js";
import { t as C } from "./dist.js";
import { n as S, t as i } from "./utils.js";
import { a as q, i as E, n as L, o as O, r as D, s as F, t as G } from "./TooltipProvider.js";
var t = B(), H = C("data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 motion-reduce:animate-none z-50 w-fit max-w-xs origin-(--transform-origin) px-3 py-1.5 text-xs shadow-[0_4px_12px_-4px_rgba(0,0,0,0.12)]", {
  variants: {
    variant: {
      primary: "bg-foreground text-background",
      secondary: "bg-secondary text-secondary-foreground border border-border shadow-sm",
      info: "bg-info text-info-foreground",
      success: "bg-success text-success-foreground",
      warning: "bg-warning text-warning-foreground",
      destructive: "bg-destructive text-destructive-foreground"
    },
    shape: {
      default: "rounded-md",
      rounded: "rounded-full"
    }
  },
  defaultVariants: {
    variant: "primary",
    shape: "default"
  }
}), J = C("size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] z-50 data-[side=bottom]:top-1 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5", {
  variants: { variant: {
    primary: "bg-foreground fill-foreground",
    secondary: "bg-secondary fill-secondary",
    info: "bg-info fill-info",
    success: "bg-success fill-success",
    warning: "bg-warning fill-warning",
    destructive: "bg-destructive fill-destructive"
  } },
  defaultVariants: { variant: "primary" }
});
function j({ delay: o = 0, ...e }) {
  return /* @__PURE__ */ (0, t.jsx)(G, {
    "data-slot": "tooltip-provider",
    delay: o,
    ...e
  });
}
function y(o) {
  return /* @__PURE__ */ (0, t.jsx)(F, {
    "data-slot": "tooltip",
    ...o
  });
}
function v(o) {
  return /* @__PURE__ */ (0, t.jsx)(O, {
    "data-slot": "tooltip-trigger",
    ...o
  });
}
function b({ className: o, side: e = "top", sideOffset: a = 4, align: r = "center", alignOffset: l = 0, variant: d = "primary", shape: m = "default", hideArrow: f = !1, children: n, ...s }) {
  return /* @__PURE__ */ (0, t.jsx)(q, { children: /* @__PURE__ */ (0, t.jsx)(E, {
    align: r,
    alignOffset: l,
    side: e,
    sideOffset: a,
    className: "isolate z-50",
    children: /* @__PURE__ */ (0, t.jsxs)(D, {
      "data-slot": "tooltip-popup",
      className: i(H({
        variant: d,
        shape: m
      }), o),
      ...s,
      children: [n, !f && /* @__PURE__ */ (0, t.jsx)(L, { className: J({ variant: d }) })]
    })
  }) });
}
function N({ children: o, className: e }) {
  return /* @__PURE__ */ (0, t.jsx)("span", {
    "data-slot": "tooltip-icon",
    className: i("shrink-0 [&>svg]:size-4", e),
    children: o
  });
}
N.displayName = "Tooltip.Icon";
function p({ src: o, alt: e, children: a, className: r }) {
  return a ? /* @__PURE__ */ (0, t.jsx)("span", {
    "data-slot": "tooltip-avatar",
    className: i("shrink-0", r),
    children: a
  }) : /* @__PURE__ */ (0, t.jsx)("img", {
    "data-slot": "tooltip-avatar",
    src: o,
    alt: e,
    className: i("size-4 shrink-0 rounded-full object-cover", r)
  });
}
p.displayName = "Tooltip.Avatar";
function c({ children: o, className: e }) {
  return /* @__PURE__ */ (0, t.jsx)("div", {
    "data-slot": "tooltip-content",
    className: i("flex flex-col gap-0.5", e),
    children: o
  });
}
c.displayName = "Tooltip.Content";
function u({ children: o, className: e }) {
  return /* @__PURE__ */ (0, t.jsx)("span", {
    "data-slot": "tooltip-title",
    className: i("text-xs font-semibold leading-4", e),
    children: o
  });
}
u.displayName = "Tooltip.Title";
function w({ children: o, className: e, variant: a = "primary" }) {
  return /* @__PURE__ */ (0, t.jsx)("span", {
    "data-slot": "tooltip-subtitle",
    className: i("text-xs font-medium leading-4", a === "secondary" ? "text-muted-foreground" : "text-inherit opacity-70", e),
    children: o
  });
}
w.displayName = "Tooltip.Subtitle";
function P({ children: o, className: e }) {
  return /* @__PURE__ */ (0, t.jsx)("span", {
    "data-slot": "tooltip-badge",
    className: i("shrink-0", e),
    children: o
  });
}
P.displayName = "Tooltip.Badge";
function _({ src: o, alt: e, layout: a = "vertical", className: r }) {
  return /* @__PURE__ */ (0, t.jsx)("img", {
    "data-slot": "tooltip-image",
    src: o,
    alt: e,
    className: i("rounded-md object-cover", a === "vertical" ? "w-full h-20" : "w-20 h-14 shrink-0", r)
  });
}
_.displayName = "Tooltip.Image";
var R = ({ trigger: o, content: e, variant: a = "primary", shape: r = "default", position: l = "top", align: d = "center", delayDuration: m, sideOffset: f = 6, icon: n, avatar: s, subtitle: g, badge: x, image: T, imageLayout: V, children: z }) => {
  const I = n || s || g || x || T, k = V ?? "vertical", h = S(e), A = g && /* @__PURE__ */ (0, t.jsx)(w, {
    variant: a,
    children: g
  }), $ = () => z || (T ? /* @__PURE__ */ (0, t.jsxs)("div", {
    className: i("flex gap-1.5 delight-tooltip-stagger", k === "vertical" ? "flex-col" : "flex-row items-center"),
    children: [/* @__PURE__ */ (0, t.jsx)(_, {
      src: T,
      alt: h,
      layout: k,
      className: "delight-tooltip-image"
    }), /* @__PURE__ */ (0, t.jsxs)(c, { children: [/* @__PURE__ */ (0, t.jsx)(u, { children: e }), A] })]
  }) : I ? /* @__PURE__ */ (0, t.jsxs)("div", {
    className: "flex items-center gap-1.5 delight-tooltip-stagger",
    children: [
      s && (typeof s == "string" ? /* @__PURE__ */ (0, t.jsx)(p, {
        src: s,
        alt: h
      }) : /* @__PURE__ */ (0, t.jsx)(p, {
        alt: h,
        children: s
      })),
      n && /* @__PURE__ */ (0, t.jsx)(N, { children: n }),
      /* @__PURE__ */ (0, t.jsxs)(c, { children: [/* @__PURE__ */ (0, t.jsx)(u, { children: e }), A] }),
      x && /* @__PURE__ */ (0, t.jsx)(P, { children: x })
    ]
  }) : e);
  return /* @__PURE__ */ (0, t.jsx)(j, {
    delay: m,
    children: /* @__PURE__ */ (0, t.jsxs)(y, { children: [/* @__PURE__ */ (0, t.jsx)(v, { render: o }), /* @__PURE__ */ (0, t.jsx)(b, {
      side: l === "none" ? "top" : l,
      align: d,
      sideOffset: f,
      variant: a,
      shape: r,
      hideArrow: l === "none",
      className: i(I && "p-2"),
      children: $()
    })] })
  });
};
R.displayName = "Tooltip";
j.displayName = "Tooltip.Provider";
y.displayName = "Tooltip.Root";
v.displayName = "Tooltip.Trigger";
b.displayName = "Tooltip.Popup";
var W = Object.assign(R, {
  Root: y,
  Provider: j,
  Trigger: v,
  Popup: b,
  Icon: N,
  Avatar: p,
  Content: c,
  Title: u,
  Subtitle: w,
  Badge: P,
  Image: _
});
export {
  W as t
};

//# sourceMappingURL=Tooltip.js.map