mongodb-chatbot-ui
Version:
UI React components for the MongoDB Assistant
300 lines (299 loc) • 22.7 kB
JavaScript
import * as Ie from "react";
import P, { useState as xr, useRef as Ge, useEffect as Fr, isValidElement as Hr, useCallback as Sr, useMemo as Or } from "react";
import { w as D, F as i, O as wr, aw as Er, m as S, b as Pr, d as jr, R as Cr, C as Lr, U as Ir, ap as $e, n as qe } from "./index2.js";
import { K as $r } from "./index7.js";
import { F as ce, b as Mr, Z as Nr, k as Tr, a as Rr, V } from "./index5.js";
import { Q as Ar, r as zr } from "./index4.js";
import { flushSync as Zr } from "react-dom";
import { c as Br } from "./polished.esm.js";
var Me = { 0: 0, 50: 2, 100: 4, 150: 6, 200: 8, 300: 12, 400: 16, 500: 20, 600: 24 };
function e(t, n, o) {
return (n = function(c) {
var u = function(d, k) {
if (typeof d != "object" || !d)
return d;
var h = d[Symbol.toPrimitive];
if (h !== void 0) {
var s = h.call(d, k);
if (typeof s != "object")
return s;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(d);
}(c, "string");
return typeof u == "symbol" ? u : u + "";
}(n)) in t ? Object.defineProperty(t, n, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : t[n] = o, t;
}
var Ne, Te, a = { Disabled: "disabled", Placeholder: "placeholder", Primary: "primary", Secondary: "secondary", Tertiary: "tertiary", InversePrimary: "inversePrimary", InverseSecondary: "inverseSecondary", Info: "info", Warning: "warning", Error: "error", Success: "success", Link: "link", OnError: "onError", OnSuccess: "onSuccess", OnSuccessLink: "onSuccessLink" }, r = { Default: "default", Hover: "hover", Focus: "focus" }, re = i.black, g = i.blue, l = i.gray, m = i.green, y = i.red, Ur = i.white, _ = i.yellow, Wr = { background: e(e(e(e(e(e(e(e({}, a.Primary, e(e(e({}, r.Default, re), r.Hover, l.dark2), r.Focus, g.dark3)), a.Secondary, e(e(e({}, r.Default, l.dark4), r.Hover, l.dark2), r.Focus, g.dark3)), a.InversePrimary, e(e(e({}, r.Default, l.light2), r.Hover, l.light3), r.Focus, g.light2)), a.Info, e(e(e({}, r.Default, g.dark3), r.Hover, g.dark3), r.Focus, g.dark3)), a.Warning, e(e(e({}, r.Default, _.dark3), r.Hover, _.dark3), r.Focus, _.dark3)), a.Success, e(e(e({}, r.Default, m.dark3), r.Hover, m.dark3), r.Focus, m.dark3)), a.Error, e(e(e({}, r.Default, y.dark3), r.Hover, y.dark3), r.Focus, y.dark3)), a.Disabled, e(e(e({}, r.Default, l.dark3), r.Hover, l.dark3), r.Focus, l.dark3)), border: e(e(e(e(e(e(e(e({}, a.Primary, e(e(e({}, r.Default, l.base), r.Hover, l.base), r.Focus, g.light1)), a.Secondary, e(e(e({}, r.Default, l.dark2), r.Hover, l.dark2), r.Focus, g.light1)), a.Tertiary, e(e(e({}, r.Default, l.dark1), r.Hover, l.dark1), r.Focus, g.light1)), a.Success, e(e(e({}, r.Default, m.dark1), r.Hover, m.dark1), r.Focus, g.light1)), a.Error, e(e(e({}, r.Default, y.light1), r.Hover, y.light1), r.Focus, g.light1)), a.OnSuccess, e(e(e({}, r.Default, m.dark2), r.Hover, m.dark2), r.Focus, g.light1)), a.OnError, e(e(e({}, r.Default, y.dark2), r.Hover, y.dark2), r.Focus, g.light1)), a.Disabled, e(e(e({}, r.Default, l.dark2), r.Hover, l.dark2), r.Focus, l.dark2)), icon: e(e(e(e(e(e(e(e({}, a.Primary, e(e(e({}, r.Default, l.light1), r.Hover, l.light3), r.Focus, g.light3)), a.Secondary, e(e(e({}, r.Default, l.base), r.Hover, l.light3), r.Focus, g.light3)), a.InversePrimary, e(e(e({}, r.Default, Ur), r.Hover, re), r.Focus, g.dark2)), a.Info, e(e(e({}, r.Default, g.light1), r.Hover, g.light1), r.Focus, g.light1)), a.Warning, e(e(e({}, r.Default, _.base), r.Hover, _.base), r.Focus, _.base)), a.Success, e(e(e({}, r.Default, m.base), r.Hover, m.base), r.Focus, m.base)), a.Error, e(e(e({}, r.Default, y.light1), r.Hover, y.light1), r.Focus, y.light1)), a.Disabled, e(e(e({}, r.Default, l.dark1), r.Hover, l.dark1), r.Focus, l.dark1)), text: (e(e(e(e(e(e(e(e(e(e(Ne = {}, a.Primary, e(e(e({}, r.Default, l.light2), r.Hover, l.light2), r.Focus, g.light3)), a.Placeholder, e(e(e({}, r.Default, l.dark1), r.Hover, l.dark1), r.Focus, l.dark1)), a.Secondary, e(e(e({}, r.Default, l.light1), r.Hover, l.light2), r.Focus, g.light3)), a.InversePrimary, e(e(e({}, r.Default, re), r.Hover, re), r.Focus, g.dark2)), a.InverseSecondary, e(e(e({}, r.Default, l.dark2), r.Hover, re), r.Focus, g.dark2)), a.Disabled, e(e(e({}, r.Default, l.dark1), r.Hover, l.dark1), r.Focus, l.dark1)), a.Success, e(e(e({}, r.Default, m.light2), r.Hover, m.light2), r.Focus, m.light2)), a.Error, e(e(e({}, r.Default, y.light1), r.Hover, y.light1), r.Focus, y.light1)), a.OnSuccess, e(e(e({}, r.Default, m.light1), r.Hover, m.light1), r.Focus, m.light1)), a.OnSuccessLink, e(e(e({}, r.Default, m.light3), r.Hover, m.light3), r.Focus, m.light3)), e(e(Ne, a.OnError, e(e(e({}, r.Default, y.light2), r.Hover, y.light2), r.Focus, y.light2)), a.Link, e(e(e({}, r.Default, g.light1), r.Hover, g.light1), r.Focus, g.light1))) }, K = i.black, p = i.blue, f = i.gray, v = i.green, b = i.red, X = i.white, Y = i.yellow, Vr = { background: e(e(e(e(e(e(e(e({}, a.Primary, e(e(e({}, r.Default, X), r.Hover, f.light2), r.Focus, p.light3)), a.Secondary, e(e(e({}, r.Default, f.light3), r.Hover, f.light2), r.Focus, p.light3)), a.InversePrimary, e(e(e({}, r.Default, K), r.Hover, f.dark3), r.Focus, p.dark2)), a.Info, e(e(e({}, r.Default, p.light3), r.Hover, p.light3), r.Focus, p.light3)), a.Warning, e(e(e({}, r.Default, Y.light3), r.Hover, Y.light3), r.Focus, Y.light3)), a.Success, e(e(e({}, r.Default, v.light3), r.Hover, v.light3), r.Focus, v.light3)), a.Error, e(e(e({}, r.Default, b.light3), r.Hover, b.light3), r.Focus, b.light3)), a.Disabled, e(e(e({}, r.Default, f.light2), r.Hover, f.light2), r.Focus, f.light2)), border: e(e(e(e(e(e(e(e({}, a.Primary, e(e(e({}, r.Default, f.base), r.Hover, f.base), r.Focus, p.light1)), a.Secondary, e(e(e({}, r.Default, f.light2), r.Hover, f.light2), r.Focus, p.light1)), a.Tertiary, e(e(e({}, r.Default, f.light1), r.Hover, f.light1), r.Focus, p.light1)), a.Success, e(e(e({}, r.Default, v.dark1), r.Hover, v.dark1), r.Focus, p.light1)), a.Error, e(e(e({}, r.Default, b.base), r.Hover, b.base), r.Focus, p.light1)), a.Disabled, e(e(e({}, r.Default, f.light1), r.Hover, f.light1), r.Focus, f.light1)), a.OnSuccess, e(e(e({}, r.Default, v.light2), r.Hover, v.light2), r.Focus, v.light2)), a.OnError, e(e(e({}, r.Default, b.light2), r.Hover, b.light2), r.Focus, b.light2)), icon: e(e(e(e(e(e(e(e({}, a.Primary, e(e(e({}, r.Default, f.dark1), r.Hover, K), r.Focus, p.dark1)), a.Secondary, e(e(e({}, r.Default, f.base), r.Hover, K), r.Focus, p.dark1)), a.InversePrimary, e(e(e({}, r.Default, X), r.Hover, X), r.Focus, p.light2)), a.Info, e(e(e({}, r.Default, p.base), r.Hover, p.base), r.Focus, p.base)), a.Warning, e(e(e({}, r.Default, Y.dark2), r.Hover, Y.dark2), r.Focus, Y.dark2)), a.Success, e(e(e({}, r.Default, v.dark1), r.Hover, v.dark1), r.Focus, v.dark1)), a.Error, e(e(e({}, r.Default, b.base), r.Hover, b.base), r.Focus, b.base)), a.Disabled, e(e(e({}, r.Default, f.base), r.Hover, f.base), r.Focus, f.base)), text: (e(e(e(e(e(e(e(e(e(e(Te = {}, a.Primary, e(e(e({}, r.Default, K), r.Hover, K), r.Focus, p.dark1)), a.Secondary, e(e(e({}, r.Default, f.dark1), r.Hover, K), r.Focus, p.dark1)), a.InversePrimary, e(e(e({}, r.Default, X), r.Hover, X), r.Focus, p.light2)), a.InverseSecondary, e(e(e({}, r.Default, f.light1), r.Hover, X), r.Focus, p.light2)), a.Disabled, e(e(e({}, r.Default, f.base), r.Hover, f.base), r.Focus, f.base)), a.Success, e(e(e({}, r.Default, v.dark2), r.Hover, v.dark2), r.Focus, v.dark2)), a.Error, e(e(e({}, r.Default, b.base), r.Hover, b.base), r.Focus, b.base)), a.Placeholder, e(e(e({}, r.Default, f.base), r.Hover, f.base), r.Focus, f.base)), a.OnSuccess, e(e(e({}, r.Default, v.dark2), r.Hover, v.dark2), r.Focus, v.dark2)), a.OnSuccessLink, e(e(e({}, r.Default, v.dark3), r.Hover, v.dark3), r.Focus, v.dark3)), e(e(Te, a.OnError, e(e(e({}, r.Default, b.dark2), r.Hover, b.dark2), r.Focus, b.dark2)), a.Link, e(e(e({}, r.Default, p.base), r.Hover, p.base), r.Focus, p.base))) }, Qe = e(e({}, D.Dark, Wr), D.Light, Vr), ue = { Dark: "dark", Light: "light" };
e(e({}, ue.Light, { default: "0 0 0 2px ".concat(i.white, ", 0 0 0 4px ").concat(i.blue.light1), input: "0 0 0 3px ".concat(i.blue.light1) }), ue.Dark, { default: "0 0 0 2px ".concat(i.black, ", 0 0 0 4px ").concat(i.blue.light1), input: "0 0 0 3px ".concat(i.blue.light1) });
e(e({}, ue.Light, { gray: "0 0 0 3px ".concat(i.gray.light2), green: "0 0 0 3px ".concat(i.green.light2), red: "0 0 0 3px ".concat(i.red.light2) }), ue.Dark, { gray: "0 0 0 3px ".concat(i.gray.dark2), green: "0 0 0 3px ".concat(i.green.dark3), red: "0 0 0 3px ".concat(i.yellow.dark3) });
var _r = i.black, G = i.gray, Kr = i.white;
e(e({}, a.Primary, e({}, r.Default, G.base)), a.Secondary, e({}, r.Default, G.dark1)), e(e({}, a.Primary, e({}, r.Default, _r)), a.Secondary, e({}, r.Default, G.dark4)), e(e({}, a.Primary, e({}, r.Default, G.base)), a.Secondary, e({}, r.Default, G.light1)), e(e({}, a.Primary, e({}, r.Default, Kr)), a.Secondary, e({}, r.Default, G.light3));
var T = e(e({}, D.Light, { 1: "color-mix(in srgb, ".concat(i.black, " 15%, transparent)"), 2: "color-mix(in srgb, ".concat(i.black, " 20%, transparent)"), 3: "color-mix(in srgb, ".concat(i.black, " 60%, transparent)"), overflow: "color-mix(in srgb, ".concat(i.gray.dark1, " 30%, transparent)") }), D.Dark, { 1: "transparent", 2: "color-mix(in srgb, #000000 45%, transparent)", 3: "color-mix(in srgb, #000000 60%, transparent)", overflow: "color-mix(in srgb, #000000 30%, transparent)" });
e(e({}, D.Light, { 1: "0px 2px 4px 1px ".concat(T[D.Light][1]), 2: "0px 18px 18px -15px ".concat(T[D.Light][2]), 3: "0px 8px 20px -8px ".concat(T[D.Light][3]), overflow: "0px 2px 4px 1px ".concat(T[D.Light].overflow) }), D.Dark, { 1: "unset", 2: "0 18px 18px -15px ".concat(T[D.Dark][2]), 3: "0 8px 20px -8px ".concat(T[D.Dark][3]), overflow: "0px 2px 4px 1px ".concat(T[D.Dark].overflow) });
e(e({}, D.Light, 2), D.Dark, 16);
var fe = { 0: 0, 25: 1, 50: 2, 100: 4, 150: 6, 200: 8, 300: 12, 400: 16, 500: 20, 600: 24, 800: 32, 900: 36, 1e3: 40, 1200: 48, 1400: 56, 1600: 64, 1800: 72, 1: 4, 2: 8, 3: 16, 4: 24, 5: 32, 6: 64, 7: 88 }, Xr = { faster: 100, default: 150, slower: 300, slowest: 500 };
function Yr(t, n, o) {
return t === t && (o !== void 0 && (t = t <= o ? t : o), n !== void 0 && (t = t >= n ? t : n)), t;
}
var Gr = Yr, qr = Gr, me = Er;
function Qr(t, n, o) {
return o === void 0 && (o = n, n = void 0), o !== void 0 && (o = me(o), o = o === o ? o : 0), n !== void 0 && (n = me(n), n = n === n ? n : 0), qr(me(t), n, o);
}
var Jr = Qr;
const Re = /* @__PURE__ */ wr(Jr);
function Ae(t, n) {
n > t.length && (n = t.length);
for (var o = 0, c = Array(n); o < n; o++)
c[o] = t[o];
return c;
}
function q(t, n, o) {
return (n = function(c) {
var u = function(d, k) {
if (typeof d != "object" || !d)
return d;
var h = d[Symbol.toPrimitive];
if (h !== void 0) {
var s = h.call(d, k);
if (typeof s != "object")
return s;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(d);
}(c, "string");
return typeof u == "symbol" ? u : u + "";
}(n)) in t ? Object.defineProperty(t, n, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : t[n] = o, t;
}
function te() {
return te = Object.assign ? Object.assign.bind() : function(t) {
for (var n = 1; n < arguments.length; n++) {
var o = arguments[n];
for (var c in o)
({}).hasOwnProperty.call(o, c) && (t[c] = o[c]);
}
return t;
}, te.apply(null, arguments);
}
function ze(t, n) {
var o = Object.keys(t);
if (Object.getOwnPropertySymbols) {
var c = Object.getOwnPropertySymbols(t);
n && (c = c.filter(function(u) {
return Object.getOwnPropertyDescriptor(t, u).enumerable;
})), o.push.apply(o, c);
}
return o;
}
function se(t) {
for (var n = 1; n < arguments.length; n++) {
var o = arguments[n] != null ? arguments[n] : {};
n % 2 ? ze(Object(o), !0).forEach(function(c) {
q(t, c, o[c]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(o)) : ze(Object(o)).forEach(function(c) {
Object.defineProperty(t, c, Object.getOwnPropertyDescriptor(o, c));
});
}
return t;
}
function et(t, n) {
return function(o) {
if (Array.isArray(o))
return o;
}(t) || function(o, c) {
var u = o == null ? null : typeof Symbol < "u" && o[Symbol.iterator] || o["@@iterator"];
if (u != null) {
var d, k, h, s, C = [], R = !0, Q = !1;
try {
if (h = (u = u.call(o)).next, c !== 0)
for (; !(R = (d = h.call(u)).done) && (C.push(d.value), C.length !== c); R = !0)
;
} catch (ae) {
Q = !0, k = ae;
} finally {
try {
if (!R && u.return != null && (s = u.return(), Object(s) !== s))
return;
} finally {
if (Q)
throw k;
}
}
return C;
}
}(t, n) || function(o, c) {
if (o) {
if (typeof o == "string")
return Ae(o, c);
var u = {}.toString.call(o).slice(8, -1);
return u === "Object" && o.constructor && (u = o.constructor.name), u === "Map" || u === "Set" ? Array.from(o) : u === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u) ? Ae(o, c) : void 0;
}
}(t, n) || function() {
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}();
}
function j(t, n) {
return n || (n = t.slice(0)), Object.freeze(Object.defineProperties(t, { raw: { value: Object.freeze(n) } }));
}
function rt(t) {
return Ie.createElement("svg", te({ width: 26, height: 8, fill: "#001E2B", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 26 8" }, t), Ie.createElement("path", { d: "M27 0H-1v1h.699a10 10 0 017.26 3.123l1.685 1.78a6 6 0 008.712 0l1.686-1.78A10 10 0 0126.302 1H27V0z" }));
}
var Ze, Be, Ue, We, Ve, _e, Je = { Hover: "hover", Click: "click" }, L = { Default: "default", Compact: "compact" }, Ft = { Top: ce.Top, Bottom: ce.Bottom, Left: ce.Left, Right: ce.Right }, be = 26, de = q(q({}, L.Default, Me[400]), L.Compact, Me[150]), tt = Xr.slowest;
function at(t) {
var n = t.setState, o = t.triggerEvent, c = t.tooltipRef, u = t.isEnabled, d = u === void 0 || u, k = Ge(null);
return Or(function() {
return o === Je.Hover ? { onMouseEnter: $e(function(h) {
var s;
d && ((s = t.onMouseEnter) === null || s === void 0 || s.call(t, h), Zr(function() {
k.current = setTimeout(function() {
n(!0);
}, tt);
}));
}, 35), onMouseLeave: $e(function(h) {
var s;
d && ((s = t.onMouseLeave) === null || s === void 0 || s.call(t, h), n(!1), k.current && (clearTimeout(k.current), k.current = null));
}, 35), onFocus: function(h) {
var s;
d && ((s = t.onFocus) === null || s === void 0 || s.call(t, h), n(!0));
}, onBlur: function(h) {
var s;
d && ((s = t.onBlur) === null || s === void 0 || s.call(t, h), n(!1));
} } : { onClick: function(h) {
var s;
d && h.target !== (c == null ? void 0 : c.current) && ((s = t.onClick) === null || s === void 0 || s.call(t, h), n(function(C) {
return !C;
}));
} };
}, [t, d, n, c, o]);
}
var Ke, Xe, Ye, ot = S(Ze || (Ze = j([`
width: max-content;
`]))), nt = 26 + 2 * de[L.Default], it = S(Ue || (Ue = j([`
min-height: `, `px;
`])), nt), lt = S(We || (We = j([`
border-radius: `, `px;
padding: `, "px ", `px;
`])), de[L.Compact], fe[100], fe[150]), ct = function(t) {
var n = t.className, o = t.isCompact, c = t.isLeftOrRightAligned, u = t.tooltipAdjustmentStyles, d = t.theme;
return qe(function(k) {
return S(Be || (Be = j([`
display: flex;
align-items: center;
border-radius: `, `px;
padding: `, "px ", `px;
box-shadow: 0px 2px 4px -1px `, `;
cursor: default;
width: fit-content;
max-width: `, `px;
background-color: `, `;
color: `, `;
`])), de[L.Default], fe[300], fe[400], Br(0.85, i.black), 256, Qe[k].background[a.InversePrimary][r.Default], k === D.Dark ? i.black : i.gray.light1);
}(d), q(q(q({}, u, !o), it, !o && c), lt, o), n);
}, st = S(Ve || (Ve = j([`
width: 100%;
overflow-wrap: anywhere;
text-transform: none;
color: inherit;
`]))), ut = function(t) {
return Qe[t].background[a.InversePrimary][r.Default];
}, ft = S(_e || (_e = j([`
position: relative;
`]))), dt = function(t) {
return qe(ft, t);
}, gt = ["initialOpen", "open", "setOpen", "darkMode", "baseFontSize", "triggerEvent", "enabled", "align", "justify", "spacing", "renderMode", "onClose", "id", "shouldClose", "portalClassName", "portalContainer", "portalRef", "scrollContainer", "popoverZIndex", "refEl", "className", "children", "trigger", "variant"], pt = function(t) {
t.stopPropagation();
};
function ht(t) {
var n, o = t.initialOpen, c = o !== void 0 && o, u = t.open, d = t.setOpen, k = t.darkMode, h = t.baseFontSize, s = t.triggerEvent, C = s === void 0 ? Je.Hover : s, R = t.enabled, Q = R === void 0 || R, ae = t.align, ke = ae === void 0 ? "top" : ae, ye = t.justify, er = ye === void 0 ? "start" : ye, De = t.spacing, rr = De === void 0 ? 12 : De, xe = t.renderMode, tr = xe === void 0 ? Rr.TopLayer : xe, ge = t.onClose, Fe = t.id, pe = t.shouldClose, ar = t.portalClassName, or = t.portalContainer, nr = t.portalRef, ir = t.scrollContainer, lr = t.popoverZIndex, cr = t.refEl, sr = t.className, ur = t.children, I = t.trigger, He = t.variant, fr = He === void 0 ? L.Default : He, dr = function(w, z) {
if (w == null)
return {};
var $, Z, ie = function(E, J) {
if (E == null)
return {};
var B = {};
for (var U in E)
if ({}.hasOwnProperty.call(E, U)) {
if (J.indexOf(U) !== -1)
continue;
B[U] = E[U];
}
return B;
}(w, z);
if (Object.getOwnPropertySymbols) {
var M = Object.getOwnPropertySymbols(w);
for (Z = 0; Z < M.length; Z++)
$ = M[Z], z.indexOf($) === -1 && {}.propertyIsEnumerable.call(w, $) && (ie[$] = w[$]);
}
return ie;
}(t, gt), Se = typeof u == "boolean", Oe = et(xr(c), 2), gr = Oe[0], pr = Oe[1], hr = Ar(h), he = Se ? u : gr, ve = Se && d ? d : pr, oe = Ge(null), vr = Fe ?? ((n = oe.current) === null || n === void 0 ? void 0 : n.id), we = Pr({ prefix: "tooltip", id: vr }), Ee = jr(k), mr = Ee.darkMode, Pe = Ee.theme;
Fr(function() {
I && Hr(I) && $r(I) && console.warn("Using a LeafyGreenUI Icon or Glyph component as a trigger will not render a Tooltip, as these components do not render their children. To use, please wrap your trigger element in another HTML tag.");
}, [I]);
var A = typeof I == "function" ? I({}) : I, je = Sr(function() {
(typeof pe != "function" || pe()) && (ge == null || ge(), ve(!1));
}, [ve, pe, ge]);
Cr(je, { enabled: he }), Lr(je, [oe], { enabled: he && C === "click" });
var br = at(se({ setState: ve, triggerEvent: C, tooltipRef: oe, isEnabled: Q }, A == null ? void 0 : A.props)), kr = se({ popoverZIndex: lr, refEl: cr, spacing: rr }, Mr({ dismissMode: Nr.Manual, portalClassName: ar, portalContainer: or, portalRef: nr, renderMode: tr, scrollContainer: ir })), Ce = Q && he, yr = ["left", "right"].includes(ke), ne = fr === L.Compact, Dr = !ne, Le = P.createElement(Tr, te({ key: "tooltip", active: Ce, align: ke, justify: er, adjustOnMutation: !0, onClick: pt, className: ot }, kr), function(w) {
var z = function(M) {
var E = M.align, J = M.justify, B = M.triggerRect, U = M.isCompact;
if (!E || !J || !B || U)
return { notchContainer: "", notch: "", tooltip: "" };
var O, W, F = {}, x = {}, H = de[L.Default], le = 2 * H, N = 0, ee = "";
switch (E) {
case "top":
case "bottom":
switch (le = 3 * H, O = B.width / 2 - 13, N = Re(O, H, le), W = O <= H, F.left = "0px", F.right = "0px", E === "top" ? (x.top = "calc(100% - 1px)", F.top = "".concat(-9, "px")) : (x.bottom = "calc(100% - 1px)", F.bottom = "".concat(-9, "px"), F.transform = "rotate(180deg)"), J) {
case V.Start:
x.left = "".concat(N, "px"), W && (ee = "translateX(-".concat(H - O, "px)"));
break;
case V.Middle:
x.left = "0px", x.right = "0px";
break;
case V.End:
x.right = "".concat(N, "px"), W && (ee = "translateX(".concat(H - O, "px)"));
}
break;
case "left":
case "right":
switch (le = 2 * H, O = B.height / 2 - 13, N = Re(O, H, le), W = O <= H, F.top = "0px", F.bottom = "0px", E === "left" ? (x.left = "calc(100% - 1px)", F.left = "".concat(-9, "px"), F.transform = "rotate(-90deg)") : (x.right = "calc(100% - 1px)", F.right = "".concat(-9, "px"), F.transform = "rotate(90deg)"), J) {
case V.Start:
x.top = "".concat(N, "px"), W && (ee = "translateY(-".concat(H - O, "px)"));
break;
case V.Middle:
x.top = "0px", x.bottom = "0px";
break;
case V.End:
x.bottom = "".concat(N, "px"), W && (ee = "translateY(".concat(H - O, "px)"));
}
}
return { notchContainer: S(Ke || (Ke = j([`
position: absolute;
width: `, `px;
height: `, `px;
overflow: hidden;
margin: auto;
pointer-events: none;
`, `;
`])), be, be, S(x)), notch: S(Xe || (Xe = j([`
`, `;
position: absolute;
width: `, `px;
height: `, `px; // Keep it square. Rotating is simpler
margin: 0;
`])), S(F), 26, 26), tooltip: S(Ye || (Ye = j([`
min-width: `, `px;
transform: `, `;
`])), 2 * N + be, ee) };
}({ align: w.align, justify: w.justify, triggerRect: w.referenceElPos, isCompact: ne }), $ = z.notchContainer, Z = z.notch, ie = z.tooltip;
return P.createElement(Ir, { darkMode: !mr }, P.createElement("div", te({ role: "tooltip" }, dr, { id: we, className: ct({ className: sr, isCompact: ne, isLeftOrRightAligned: yr, tooltipAdjustmentStyles: ie, theme: Pe }), ref: oe }), P.createElement(zr, { as: "span", baseFontSize: ne ? void 0 : hr, className: st }, ur), Dr && P.createElement("div", { className: $ }, P.createElement(rt, { className: Z, fill: ut(Pe) }))));
});
return A ? P.cloneElement(A, se(se({}, br), {}, { "aria-describedby": Ce ? we : void 0, children: P.createElement(P.Fragment, null, A.props.children, Le), className: dt(A.props.className) })) : Le;
}
ht.displayName = "Tooltip";
export {
L as Q,
Ft as W,
ht as h,
tt as t
};