import {
  __objRest,
  __spreadProps,
  __spreadValues
} from "./chunk-N552FDTV.js";

// src/atoms/tooltip.tsx
import { createContext, useContext, useEffect, useState } from "react";
import {
  TooltipProvider as OriginalTooltipProvider,
  Tooltip as OriginalTooltip,
  TooltipTrigger as OriginalTooltipTrigger,
  TooltipContent as OriginalTooltipContent
} from "@radix-ui/react-tooltip";
import {
  Popover,
  PopoverTrigger,
  PopoverContent
} from "@radix-ui/react-popover";
import { jsx } from "react/jsx-runtime";
var TouchContext = createContext(void 0);
var useTouch = () => useContext(TouchContext);
function TooltipProvider(_a) {
  var _b = _a, {
    children
  } = _b, props = __objRest(_b, [
    "children"
  ]);
  const [isTouch, setIsTouch] = useState(void 0);
  useEffect(() => {
    setIsTouch(window.matchMedia("(pointer: coarse)").matches);
  }, []);
  return /* @__PURE__ */ jsx(TouchContext.Provider, { value: isTouch, children: /* @__PURE__ */ jsx(OriginalTooltipProvider, __spreadProps(__spreadValues({}, props), { children })) });
}
function Tooltip(props) {
  const isTouch = useTouch();
  return isTouch ? /* @__PURE__ */ jsx(Popover, __spreadValues({}, props)) : /* @__PURE__ */ jsx(OriginalTooltip, __spreadValues({}, props));
}
function TooltipTrigger(props) {
  const isTouch = useTouch();
  return isTouch ? /* @__PURE__ */ jsx(PopoverTrigger, __spreadValues({}, props)) : /* @__PURE__ */ jsx(OriginalTooltipTrigger, __spreadValues({}, props));
}
function TooltipContent(props) {
  const isTouch = useTouch();
  return isTouch ? /* @__PURE__ */ jsx(PopoverContent, __spreadValues({}, props)) : /* @__PURE__ */ jsx(OriginalTooltipContent, __spreadValues({}, props));
}

export {
  TooltipProvider,
  Tooltip,
  TooltipTrigger,
  TooltipContent
};
//# sourceMappingURL=chunk-KT4BIOJJ.js.map