import { defineComponent as g, ref as n, computed as r, openBlock as u, createElementBlock as S, createElementVNode as i, renderSlot as s, createBlock as T, Teleport as E, normalizeStyle as f, unref as $, createTextVNode as k, toDisplayString as B } from "vue";
import { u as D, a as O, f as z, s as A, o as F, b as I } from "./floating-ui.vue-B4We5rJr.js";
import { u as P } from "./index-CLv1CFWG.js";
const M = { class: "stash-tooltip__wrapper relative inline-flex size-fit" }, N = 6, C = 12, U = /* @__PURE__ */ g({
  __name: "Tooltip",
  props: {
    disableTeleport: { type: Boolean, default: !1 },
    side: { default: "top" },
    isDisabled: { type: Boolean, default: !1 },
    isOpen: { type: Boolean, default: !1 },
    teleportTo: { default: "#stash-menus-mount-node" },
    text: { default: "" }
  },
  setup(m) {
    const h = {
      top: "bottom",
      right: "left",
      bottom: "top",
      left: "right"
    }, e = m, l = n(null), p = n(null), c = n(null), { isOutside: _ } = P(l), w = r(() => !e.isDisabled && (!_.value || e.isOpen)), y = r(() => e.side), { floatingStyles: x, middlewareData: o, placement: b } = D(l, c, {
      whileElementsMounted: O,
      placement: y,
      middleware: [
        z(),
        A({ padding: 8 }),
        F(C),
        I({ element: p, padding: 8 })
      ]
    }), v = r(() => {
      var a, d;
      const t = h[b.value];
      return {
        left: ((a = o.value.arrow) == null ? void 0 : a.x) != null ? `${o.value.arrow.x}px` : "",
        top: ((d = o.value.arrow) == null ? void 0 : d.y) != null ? `${o.value.arrow.y}px` : "",
        [t]: `-${N}px`
      };
    });
    return (t, a) => (u(), S("div", M, [
      i("span", {
        ref_key: "anchor",
        ref: l,
        "data-test": "stash-tooltip|anchor",
        class: "stash-tooltip__anchor"
      }, [
        s(t.$slots, "default")
      ], 512),
      (u(), T(E, {
        to: e.teleportTo,
        disabled: e.disableTeleport
      }, [
        i("div", {
          ref_key: "tooltip",
          ref: c,
          "data-test": "stash-tooltip",
          class: "stash-tooltip pointer-events-none z-screen flex w-[148px] flex-col items-center whitespace-normal rounded bg-ice-900 p-3 text-center text-xs text-white opacity-0 shadow transition-opacity",
          role: "tooltip",
          style: f({
            ...$(x),
            opacity: w.value ? 0.95 : 0
          })
        }, [
          s(t.$slots, "icon"),
          s(t.$slots, "content", {}, () => [
            k(B(e.text), 1)
          ]),
          s(t.$slots, "secondaryIcon"),
          i("div", {
            ref_key: "floatingArrow",
            ref: p,
            class: "stash-tooltip__arrow absolute z-behind size-[12px] rotate-45 bg-ice-900",
            style: f(v.value)
          }, null, 4)
        ], 4)
      ], 8, ["to", "disabled"]))
    ]));
  }
});
export {
  U as _
};
//# sourceMappingURL=Tooltip.vue_vue_type_script_setup_true_lang-EZU7uCEV.js.map
