mongodb-chatbot-ui
Version:
UI React components for the MongoDB Assistant
906 lines (892 loc) • 77.9 kB
JavaScript
import { jsx as Ea } from "react/jsx-runtime";
import { c as Qr, a as $a } from "./emotion-css.esm.js";
import { a as ea, b as Br, m as h, n as ae, w as x, F as s, l as ra, d as Te, E as Fa, e as Ee, L as ta, k as na, V as aa, _ as Ha, s as oa, C as ia, U as la, o as $r, P as ca, r as _r, j as Wr, z as Ca, $ as Pa, f as Oa } from "./index2.js";
import { r as La, D as Na, v as Ra, X as _a, t as Ma } from "./index4.js";
import * as J from "react";
import v, { useLayoutEffect as Ta, createContext as za, useContext as Ia, useMemo as ct, useState as lr, useRef as cr, useCallback as Mr, forwardRef as Pr, useEffect as Aa } from "react";
import { _ as ja } from "./polished.esm.js";
import { _ as Ba, k as Wa, Z as Ya, a as Ua } from "./index5.js";
import { t as Yr, a as Ge, i as Ur, e as ye, r as Vr, n as Ke } from "./glyphCommon-cTThlth0.js";
import { H as st } from "./index6.js";
import { p as Va } from "./Refresh.js";
import { e as Or, K as sa, s as Xa, I as Ga, R as Ka } from "./index8.js";
import { N as Za } from "./index9.js";
import { useChatbotContext as qa } from "./useChatbotContext.js";
var ua = {}, rt = { exports: {} }, L = {};
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var gt;
function Qa() {
if (gt)
return L;
gt = 1;
var t = typeof Symbol == "function" && Symbol.for, i = t ? Symbol.for("react.element") : 60103, o = t ? Symbol.for("react.portal") : 60106, l = t ? Symbol.for("react.fragment") : 60107, c = t ? Symbol.for("react.strict_mode") : 60108, d = t ? Symbol.for("react.profiler") : 60114, p = t ? Symbol.for("react.provider") : 60109, m = t ? Symbol.for("react.context") : 60110, g = t ? Symbol.for("react.async_mode") : 60111, y = t ? Symbol.for("react.concurrent_mode") : 60111, D = t ? Symbol.for("react.forward_ref") : 60112, S = t ? Symbol.for("react.suspense") : 60113, P = t ? Symbol.for("react.suspense_list") : 60120, C = t ? Symbol.for("react.memo") : 60115, O = t ? Symbol.for("react.lazy") : 60116, oe = t ? Symbol.for("react.block") : 60121, I = t ? Symbol.for("react.fundamental") : 60117, Fe = t ? Symbol.for("react.responder") : 60118, be = t ? Symbol.for("react.scope") : 60119;
function E(b) {
if (typeof b == "object" && b !== null) {
var X = b.$$typeof;
switch (X) {
case i:
switch (b = b.type, b) {
case g:
case y:
case l:
case d:
case c:
case S:
return b;
default:
switch (b = b && b.$$typeof, b) {
case m:
case D:
case O:
case C:
case p:
return b;
default:
return X;
}
}
case o:
return X;
}
}
}
function Y(b) {
return E(b) === y;
}
return L.AsyncMode = g, L.ConcurrentMode = y, L.ContextConsumer = m, L.ContextProvider = p, L.Element = i, L.ForwardRef = D, L.Fragment = l, L.Lazy = O, L.Memo = C, L.Portal = o, L.Profiler = d, L.StrictMode = c, L.Suspense = S, L.isAsyncMode = function(b) {
return Y(b) || E(b) === g;
}, L.isConcurrentMode = Y, L.isContextConsumer = function(b) {
return E(b) === m;
}, L.isContextProvider = function(b) {
return E(b) === p;
}, L.isElement = function(b) {
return typeof b == "object" && b !== null && b.$$typeof === i;
}, L.isForwardRef = function(b) {
return E(b) === D;
}, L.isFragment = function(b) {
return E(b) === l;
}, L.isLazy = function(b) {
return E(b) === O;
}, L.isMemo = function(b) {
return E(b) === C;
}, L.isPortal = function(b) {
return E(b) === o;
}, L.isProfiler = function(b) {
return E(b) === d;
}, L.isStrictMode = function(b) {
return E(b) === c;
}, L.isSuspense = function(b) {
return E(b) === S;
}, L.isValidElementType = function(b) {
return typeof b == "string" || typeof b == "function" || b === l || b === y || b === d || b === c || b === S || b === P || typeof b == "object" && b !== null && (b.$$typeof === O || b.$$typeof === C || b.$$typeof === p || b.$$typeof === m || b.$$typeof === D || b.$$typeof === I || b.$$typeof === Fe || b.$$typeof === be || b.$$typeof === oe);
}, L.typeOf = E, L;
}
var N = {}, ht;
function Ja() {
return ht || (ht = 1, ea.env.NODE_ENV !== "production" && function() {
var t = typeof Symbol == "function" && Symbol.for, i = t ? Symbol.for("react.element") : 60103, o = t ? Symbol.for("react.portal") : 60106, l = t ? Symbol.for("react.fragment") : 60107, c = t ? Symbol.for("react.strict_mode") : 60108, d = t ? Symbol.for("react.profiler") : 60114, p = t ? Symbol.for("react.provider") : 60109, m = t ? Symbol.for("react.context") : 60110, g = t ? Symbol.for("react.async_mode") : 60111, y = t ? Symbol.for("react.concurrent_mode") : 60111, D = t ? Symbol.for("react.forward_ref") : 60112, S = t ? Symbol.for("react.suspense") : 60113, P = t ? Symbol.for("react.suspense_list") : 60120, C = t ? Symbol.for("react.memo") : 60115, O = t ? Symbol.for("react.lazy") : 60116, oe = t ? Symbol.for("react.block") : 60121, I = t ? Symbol.for("react.fundamental") : 60117, Fe = t ? Symbol.for("react.responder") : 60118, be = t ? Symbol.for("react.scope") : 60119;
function E(k) {
return typeof k == "string" || typeof k == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
k === l || k === y || k === d || k === c || k === S || k === P || typeof k == "object" && k !== null && (k.$$typeof === O || k.$$typeof === C || k.$$typeof === p || k.$$typeof === m || k.$$typeof === D || k.$$typeof === I || k.$$typeof === Fe || k.$$typeof === be || k.$$typeof === oe);
}
function Y(k) {
if (typeof k == "object" && k !== null) {
var R = k.$$typeof;
switch (R) {
case i:
var _ = k.type;
switch (_) {
case g:
case y:
case l:
case d:
case c:
case S:
return _;
default:
var le = _ && _.$$typeof;
switch (le) {
case m:
case D:
case O:
case C:
case p:
return le;
default:
return R;
}
}
case o:
return R;
}
}
}
var b = g, X = y, ke = m, He = p, B = i, ze = D, xe = l, Ce = O, Ie = C, Pe = o, Oe = d, G = c, Ae = S, De = !1;
function qe(k) {
return De || (De = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), Qe(k) || Y(k) === g;
}
function Qe(k) {
return Y(k) === y;
}
function je(k) {
return Y(k) === m;
}
function ie(k) {
return Y(k) === p;
}
function we(k) {
return typeof k == "object" && k !== null && k.$$typeof === i;
}
function Se(k) {
return Y(k) === D;
}
function Be(k) {
return Y(k) === l;
}
function Le(k) {
return Y(k) === O;
}
function Ne(k) {
return Y(k) === C;
}
function re(k) {
return Y(k) === o;
}
function ve(k) {
return Y(k) === d;
}
function Je(k) {
return Y(k) === c;
}
function er(k) {
return Y(k) === S;
}
N.AsyncMode = b, N.ConcurrentMode = X, N.ContextConsumer = ke, N.ContextProvider = He, N.Element = B, N.ForwardRef = ze, N.Fragment = xe, N.Lazy = Ce, N.Memo = Ie, N.Portal = Pe, N.Profiler = Oe, N.StrictMode = G, N.Suspense = Ae, N.isAsyncMode = qe, N.isConcurrentMode = Qe, N.isContextConsumer = je, N.isContextProvider = ie, N.isElement = we, N.isForwardRef = Se, N.isFragment = Be, N.isLazy = Le, N.isMemo = Ne, N.isPortal = re, N.isProfiler = ve, N.isStrictMode = Je, N.isSuspense = er, N.isValidElementType = E, N.typeOf = Y;
}()), N;
}
ea.env.NODE_ENV === "production" ? rt.exports = Qa() : rt.exports = Ja();
var eo = rt.exports;
Object.defineProperty(ua, "__esModule", { value: !0 });
var Jr = v, ro = eo;
function da(t, i, o) {
return i === void 0 && (i = 0), o === void 0 && (o = []), Jr.Children.toArray(t).reduce(function(l, c, d) {
return ro.isFragment(c) ? l.push.apply(l, da(c.props.children, i + 1, o.concat(c.key || d))) : Jr.isValidElement(c) ? l.push(Jr.cloneElement(c, {
key: o.concat(String(c.key)).join(".")
})) : (typeof c == "string" || typeof c == "number") && l.push(c), l;
}, []);
}
var to = ua.default = da, no = Ta, ao = function(i) {
var o = v.useRef(i);
return no(function() {
o.current = i;
}), o;
}, bt = function(i, o) {
if (typeof i == "function") {
i(o);
return;
}
i.current = o;
}, oo = function(i, o) {
var l = v.useRef();
return v.useCallback(function(c) {
i.current = c, l.current && bt(l.current, null), l.current = o, o && bt(o, c);
}, [o]);
}, vt = {
"min-height": "0",
"max-height": "none",
height: "0",
visibility: "hidden",
overflow: "hidden",
position: "absolute",
"z-index": "-1000",
top: "0",
right: "0",
display: "block"
}, io = function(i) {
Object.keys(vt).forEach(function(o) {
i.style.setProperty(o, vt[o], "important");
});
}, pt = io, ue = null, mt = function(i, o) {
var l = i.scrollHeight;
return o.sizingStyle.boxSizing === "border-box" ? l + o.borderSize : l - o.paddingSize;
};
function lo(t, i, o, l) {
o === void 0 && (o = 1), l === void 0 && (l = 1 / 0), ue || (ue = document.createElement("textarea"), ue.setAttribute("tabindex", "-1"), ue.setAttribute("aria-hidden", "true"), pt(ue)), ue.parentNode === null && document.body.appendChild(ue);
var c = t.paddingSize, d = t.borderSize, p = t.sizingStyle, m = p.boxSizing;
Object.keys(p).forEach(function(P) {
var C = P;
ue.style[C] = p[C];
}), pt(ue), ue.value = i;
var g = mt(ue, t);
ue.value = i, g = mt(ue, t), ue.value = "x";
var y = ue.scrollHeight - c, D = y * o;
m === "border-box" && (D = D + c + d), g = Math.max(D, g);
var S = y * l;
return m === "border-box" && (S = S + c + d), g = Math.min(S, g), [g, y];
}
var yt = function() {
}, co = function(i, o) {
return i.reduce(function(l, c) {
return l[c] = o[c], l;
}, {});
}, so = [
"borderBottomWidth",
"borderLeftWidth",
"borderRightWidth",
"borderTopWidth",
"boxSizing",
"fontFamily",
"fontSize",
"fontStyle",
"fontWeight",
"letterSpacing",
"lineHeight",
"paddingBottom",
"paddingLeft",
"paddingRight",
"paddingTop",
// non-standard
"tabSize",
"textIndent",
// non-standard
"textRendering",
"textTransform",
"width",
"wordBreak",
"wordSpacing",
"scrollbarGutter"
], uo = !!document.documentElement.currentStyle, fo = function(i) {
var o = window.getComputedStyle(i);
if (o === null)
return null;
var l = co(so, o), c = l.boxSizing;
if (c === "")
return null;
uo && c === "border-box" && (l.width = parseFloat(l.width) + parseFloat(l.borderRightWidth) + parseFloat(l.borderLeftWidth) + parseFloat(l.paddingRight) + parseFloat(l.paddingLeft) + "px");
var d = parseFloat(l.paddingBottom) + parseFloat(l.paddingTop), p = parseFloat(l.borderBottomWidth) + parseFloat(l.borderTopWidth);
return {
sizingStyle: l,
paddingSize: d,
borderSize: p
};
}, go = fo;
function ut(t, i, o) {
var l = ao(o);
J.useLayoutEffect(function() {
var c = function(p) {
return l.current(p);
};
if (t)
return t.addEventListener(i, c), function() {
return t.removeEventListener(i, c);
};
}, []);
}
var ho = function(i, o) {
ut(document.body, "reset", function(l) {
i.current.form === l.target && o(l);
});
}, bo = function(i) {
ut(window, "resize", i);
}, vo = function(i) {
ut(document.fonts, "loadingdone", i);
}, po = ["cacheMeasurements", "maxRows", "minRows", "onChange", "onHeightChange"], mo = function(i, o) {
var l = i.cacheMeasurements, c = i.maxRows, d = i.minRows, p = i.onChange, m = p === void 0 ? yt : p, g = i.onHeightChange, y = g === void 0 ? yt : g, D = Ba(i, po), S = D.value !== void 0, P = J.useRef(null), C = oo(P, o), O = J.useRef(0), oe = J.useRef(), I = function() {
var E = P.current, Y = l && oe.current ? oe.current : go(E);
if (Y) {
oe.current = Y;
var b = lo(Y, E.value || E.placeholder || "x", d, c), X = b[0], ke = b[1];
O.current !== X && (O.current = X, E.style.setProperty("height", X + "px", "important"), y(X, {
rowHeight: ke
}));
}
}, Fe = function(E) {
S || I(), m(E);
};
return J.useLayoutEffect(I), ho(P, function() {
if (!S) {
var be = P.current.value;
requestAnimationFrame(function() {
var E = P.current;
E && be !== E.value && I();
});
}
}), bo(I), vo(I), /* @__PURE__ */ J.createElement("textarea", ja({}, D, {
onChange: Fe,
ref: C
}));
}, yo = /* @__PURE__ */ J.forwardRef(mo), kt, xt, ko = ["className", "size", "title", "aria-label", "aria-labelledby", "fill", "role"], tt = function(t) {
var i = t.className, o = t.size, l = o === void 0 ? 16 : o, c = t.title, d = t["aria-label"], p = t["aria-labelledby"], m = t.fill, g = t.role, y = g === void 0 ? "img" : g, D = Yr(t, ko), S = Br({ prefix: "icon-title" }), P = h(kt || (kt = Ge([`
color: `, `;
`])), m), C = h(xt || (xt = Ge([`
flex-shrink: 0;
`]))), O = Ur(y, "MagnifyingGlass", ye(ye({ title: c, titleId: S }, "aria-label", d), "aria-labelledby", p));
return J.createElement("svg", Vr({ className: ae(ye({}, P, m != null), C, i), height: typeof l == "number" ? l : Ke[l], width: typeof l == "number" ? l : Ke[l], role: y }, O, D, { viewBox: "0 0 16 16" }), c && J.createElement("title", { id: S }, c), J.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M2.3234 9.81874C4.07618 11.5715 6.75062 11.8398 8.78588 10.6244L12.93 14.7685C13.4377 15.2762 14.2608 15.2762 14.7685 14.7685C15.2762 14.2608 15.2762 13.4377 14.7685 12.93L10.6244 8.78588C11.8398 6.75062 11.5715 4.07619 9.81873 2.32341C7.74896 0.253628 4.39318 0.253628 2.3234 2.32341C0.253624 4.39319 0.253624 7.74896 2.3234 9.81874ZM7.98026 4.16188C9.03467 5.2163 9.03467 6.92585 7.98026 7.98026C6.92584 9.03468 5.2163 9.03468 4.16188 7.98026C3.10746 6.92585 3.10746 5.2163 4.16188 4.16188C5.2163 3.10747 6.92584 3.10747 7.98026 4.16188Z", fill: "currentColor" }));
};
tt.displayName = "MagnifyingGlass", tt.isGlyph = !0;
var Dt, St, xo = ["className", "size", "title", "aria-label", "aria-labelledby", "fill", "role"], nt = function(t) {
var i = t.className, o = t.size, l = o === void 0 ? 16 : o, c = t.title, d = t["aria-label"], p = t["aria-labelledby"], m = t.fill, g = t.role, y = g === void 0 ? "img" : g, D = Yr(t, xo), S = Br({ prefix: "icon-title" }), P = h(Dt || (Dt = Ge([`
color: `, `;
`])), m), C = h(St || (St = Ge([`
flex-shrink: 0;
`]))), O = Ur(y, "XWithCircle", ye(ye({ title: c, titleId: S }, "aria-label", d), "aria-labelledby", p));
return J.createElement("svg", Vr({ className: ae(ye({}, P, m != null), C, i), height: typeof l == "number" ? l : Ke[l], width: typeof l == "number" ? l : Ke[l], role: y }, O, D, { viewBox: "0 0 16 16" }), c && J.createElement("title", { id: S }, c), J.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15ZM9.41421 5.17157C9.80474 4.78105 10.4379 4.78105 10.8284 5.17157C11.219 5.5621 11.219 6.19526 10.8284 6.58579L9.41421 8L10.8284 9.41421C11.219 9.80474 11.219 10.4379 10.8284 10.8284C10.4379 11.219 9.80474 11.219 9.41421 10.8284L8 9.41421L6.58579 10.8284C6.19526 11.219 5.5621 11.219 5.17157 10.8284C4.78105 10.4379 4.78105 9.80474 5.17157 9.41421L6.58579 8L5.17157 6.58579C4.78105 6.19526 4.78105 5.5621 5.17157 5.17157C5.5621 4.78105 6.19526 4.78105 6.58579 5.17157L8 6.58579L9.41421 5.17157Z", fill: "currentColor" }));
};
nt.displayName = "XWithCircle", nt.isGlyph = !0;
var fa = { 0: 0, 50: 2, 100: 4, 150: 6, 200: 8, 300: 12, 400: 16, 500: 20, 600: 24 };
function e(t, i, o) {
return (i = function(l) {
var c = function(d, p) {
if (typeof d != "object" || !d)
return d;
var m = d[Symbol.toPrimitive];
if (m !== void 0) {
var g = m.call(d, p);
if (typeof g != "object")
return g;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(d);
}(l, "string");
return typeof c == "symbol" ? c : c + "";
}(i)) in t ? Object.defineProperty(t, i, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : t[i] = o, t;
}
var wt, Et, f = { 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" }, a = { Default: "default", Hover: "hover", Focus: "focus" }, Fr = s.black, A = s.blue, $ = s.gray, q = s.green, ce = s.red, Do = s.white, ur = s.yellow, So = { background: e(e(e(e(e(e(e(e({}, f.Primary, e(e(e({}, a.Default, Fr), a.Hover, $.dark2), a.Focus, A.dark3)), f.Secondary, e(e(e({}, a.Default, $.dark4), a.Hover, $.dark2), a.Focus, A.dark3)), f.InversePrimary, e(e(e({}, a.Default, $.light2), a.Hover, $.light3), a.Focus, A.light2)), f.Info, e(e(e({}, a.Default, A.dark3), a.Hover, A.dark3), a.Focus, A.dark3)), f.Warning, e(e(e({}, a.Default, ur.dark3), a.Hover, ur.dark3), a.Focus, ur.dark3)), f.Success, e(e(e({}, a.Default, q.dark3), a.Hover, q.dark3), a.Focus, q.dark3)), f.Error, e(e(e({}, a.Default, ce.dark3), a.Hover, ce.dark3), a.Focus, ce.dark3)), f.Disabled, e(e(e({}, a.Default, $.dark3), a.Hover, $.dark3), a.Focus, $.dark3)), border: e(e(e(e(e(e(e(e({}, f.Primary, e(e(e({}, a.Default, $.base), a.Hover, $.base), a.Focus, A.light1)), f.Secondary, e(e(e({}, a.Default, $.dark2), a.Hover, $.dark2), a.Focus, A.light1)), f.Tertiary, e(e(e({}, a.Default, $.dark1), a.Hover, $.dark1), a.Focus, A.light1)), f.Success, e(e(e({}, a.Default, q.dark1), a.Hover, q.dark1), a.Focus, A.light1)), f.Error, e(e(e({}, a.Default, ce.light1), a.Hover, ce.light1), a.Focus, A.light1)), f.OnSuccess, e(e(e({}, a.Default, q.dark2), a.Hover, q.dark2), a.Focus, A.light1)), f.OnError, e(e(e({}, a.Default, ce.dark2), a.Hover, ce.dark2), a.Focus, A.light1)), f.Disabled, e(e(e({}, a.Default, $.dark2), a.Hover, $.dark2), a.Focus, $.dark2)), icon: e(e(e(e(e(e(e(e({}, f.Primary, e(e(e({}, a.Default, $.light1), a.Hover, $.light3), a.Focus, A.light3)), f.Secondary, e(e(e({}, a.Default, $.base), a.Hover, $.light3), a.Focus, A.light3)), f.InversePrimary, e(e(e({}, a.Default, Do), a.Hover, Fr), a.Focus, A.dark2)), f.Info, e(e(e({}, a.Default, A.light1), a.Hover, A.light1), a.Focus, A.light1)), f.Warning, e(e(e({}, a.Default, ur.base), a.Hover, ur.base), a.Focus, ur.base)), f.Success, e(e(e({}, a.Default, q.base), a.Hover, q.base), a.Focus, q.base)), f.Error, e(e(e({}, a.Default, ce.light1), a.Hover, ce.light1), a.Focus, ce.light1)), f.Disabled, e(e(e({}, a.Default, $.dark1), a.Hover, $.dark1), a.Focus, $.dark1)), text: (e(e(e(e(e(e(e(e(e(e(wt = {}, f.Primary, e(e(e({}, a.Default, $.light2), a.Hover, $.light2), a.Focus, A.light3)), f.Placeholder, e(e(e({}, a.Default, $.dark1), a.Hover, $.dark1), a.Focus, $.dark1)), f.Secondary, e(e(e({}, a.Default, $.light1), a.Hover, $.light2), a.Focus, A.light3)), f.InversePrimary, e(e(e({}, a.Default, Fr), a.Hover, Fr), a.Focus, A.dark2)), f.InverseSecondary, e(e(e({}, a.Default, $.dark2), a.Hover, Fr), a.Focus, A.dark2)), f.Disabled, e(e(e({}, a.Default, $.dark1), a.Hover, $.dark1), a.Focus, $.dark1)), f.Success, e(e(e({}, a.Default, q.light2), a.Hover, q.light2), a.Focus, q.light2)), f.Error, e(e(e({}, a.Default, ce.light1), a.Hover, ce.light1), a.Focus, ce.light1)), f.OnSuccess, e(e(e({}, a.Default, q.light1), a.Hover, q.light1), a.Focus, q.light1)), f.OnSuccessLink, e(e(e({}, a.Default, q.light3), a.Hover, q.light3), a.Focus, q.light3)), e(e(wt, f.OnError, e(e(e({}, a.Default, ce.light2), a.Hover, ce.light2), a.Focus, ce.light2)), f.Link, e(e(e({}, a.Default, A.light1), a.Hover, A.light1), a.Focus, A.light1))) }, dr = s.black, U = s.blue, M = s.gray, K = s.green, te = s.red, fr = s.white, gr = s.yellow, wo = { background: e(e(e(e(e(e(e(e({}, f.Primary, e(e(e({}, a.Default, fr), a.Hover, M.light2), a.Focus, U.light3)), f.Secondary, e(e(e({}, a.Default, M.light3), a.Hover, M.light2), a.Focus, U.light3)), f.InversePrimary, e(e(e({}, a.Default, dr), a.Hover, M.dark3), a.Focus, U.dark2)), f.Info, e(e(e({}, a.Default, U.light3), a.Hover, U.light3), a.Focus, U.light3)), f.Warning, e(e(e({}, a.Default, gr.light3), a.Hover, gr.light3), a.Focus, gr.light3)), f.Success, e(e(e({}, a.Default, K.light3), a.Hover, K.light3), a.Focus, K.light3)), f.Error, e(e(e({}, a.Default, te.light3), a.Hover, te.light3), a.Focus, te.light3)), f.Disabled, e(e(e({}, a.Default, M.light2), a.Hover, M.light2), a.Focus, M.light2)), border: e(e(e(e(e(e(e(e({}, f.Primary, e(e(e({}, a.Default, M.base), a.Hover, M.base), a.Focus, U.light1)), f.Secondary, e(e(e({}, a.Default, M.light2), a.Hover, M.light2), a.Focus, U.light1)), f.Tertiary, e(e(e({}, a.Default, M.light1), a.Hover, M.light1), a.Focus, U.light1)), f.Success, e(e(e({}, a.Default, K.dark1), a.Hover, K.dark1), a.Focus, U.light1)), f.Error, e(e(e({}, a.Default, te.base), a.Hover, te.base), a.Focus, U.light1)), f.Disabled, e(e(e({}, a.Default, M.light1), a.Hover, M.light1), a.Focus, M.light1)), f.OnSuccess, e(e(e({}, a.Default, K.light2), a.Hover, K.light2), a.Focus, K.light2)), f.OnError, e(e(e({}, a.Default, te.light2), a.Hover, te.light2), a.Focus, te.light2)), icon: e(e(e(e(e(e(e(e({}, f.Primary, e(e(e({}, a.Default, M.dark1), a.Hover, dr), a.Focus, U.dark1)), f.Secondary, e(e(e({}, a.Default, M.base), a.Hover, dr), a.Focus, U.dark1)), f.InversePrimary, e(e(e({}, a.Default, fr), a.Hover, fr), a.Focus, U.light2)), f.Info, e(e(e({}, a.Default, U.base), a.Hover, U.base), a.Focus, U.base)), f.Warning, e(e(e({}, a.Default, gr.dark2), a.Hover, gr.dark2), a.Focus, gr.dark2)), f.Success, e(e(e({}, a.Default, K.dark1), a.Hover, K.dark1), a.Focus, K.dark1)), f.Error, e(e(e({}, a.Default, te.base), a.Hover, te.base), a.Focus, te.base)), f.Disabled, e(e(e({}, a.Default, M.base), a.Hover, M.base), a.Focus, M.base)), text: (e(e(e(e(e(e(e(e(e(e(Et = {}, f.Primary, e(e(e({}, a.Default, dr), a.Hover, dr), a.Focus, U.dark1)), f.Secondary, e(e(e({}, a.Default, M.dark1), a.Hover, dr), a.Focus, U.dark1)), f.InversePrimary, e(e(e({}, a.Default, fr), a.Hover, fr), a.Focus, U.light2)), f.InverseSecondary, e(e(e({}, a.Default, M.light1), a.Hover, fr), a.Focus, U.light2)), f.Disabled, e(e(e({}, a.Default, M.base), a.Hover, M.base), a.Focus, M.base)), f.Success, e(e(e({}, a.Default, K.dark2), a.Hover, K.dark2), a.Focus, K.dark2)), f.Error, e(e(e({}, a.Default, te.base), a.Hover, te.base), a.Focus, te.base)), f.Placeholder, e(e(e({}, a.Default, M.base), a.Hover, M.base), a.Focus, M.base)), f.OnSuccess, e(e(e({}, a.Default, K.dark2), a.Hover, K.dark2), a.Focus, K.dark2)), f.OnSuccessLink, e(e(e({}, a.Default, K.dark3), a.Hover, K.dark3), a.Focus, K.dark3)), e(e(Et, f.OnError, e(e(e({}, a.Default, te.dark2), a.Hover, te.dark2), a.Focus, te.dark2)), f.Link, e(e(e({}, a.Default, U.base), a.Hover, U.base), a.Focus, U.base))) }, $t = e(e({}, x.Dark, So), x.Light, wo), Tr = { Dark: "dark", Light: "light" }, zr = e(e({}, Tr.Light, { default: "0 0 0 2px ".concat(s.white, ", 0 0 0 4px ").concat(s.blue.light1), input: "0 0 0 3px ".concat(s.blue.light1) }), Tr.Dark, { default: "0 0 0 2px ".concat(s.black, ", 0 0 0 4px ").concat(s.blue.light1), input: "0 0 0 3px ".concat(s.blue.light1) }), Eo = { default: "'Euclid Circular A', 'Helvetica Neue', Helvetica, Arial, sans-serif", serif: "'MongoDB Value Serif', 'Times New Roman', serif", code: "'Source Code Pro', Menlo, monospace" }, at = { regular: 400, medium: 500, semiBold: 600, bold: 700 }, Ir = e(e({}, Tr.Light, { gray: "0 0 0 3px ".concat(s.gray.light2), green: "0 0 0 3px ".concat(s.green.light2), red: "0 0 0 3px ".concat(s.red.light2) }), Tr.Dark, { gray: "0 0 0 3px ".concat(s.gray.dark2), green: "0 0 0 3px ".concat(s.green.dark3), red: "0 0 0 3px ".concat(s.yellow.dark3) }), $o = s.black, hr = s.gray, Fo = s.white;
e(e({}, f.Primary, e({}, a.Default, hr.base)), f.Secondary, e({}, a.Default, hr.dark1)), e(e({}, f.Primary, e({}, a.Default, $o)), f.Secondary, e({}, a.Default, hr.dark4)), e(e({}, f.Primary, e({}, a.Default, hr.base)), f.Secondary, e({}, a.Default, hr.light1)), e(e({}, f.Primary, e({}, a.Default, Fo)), f.Secondary, e({}, a.Default, hr.light3));
var or = e(e({}, x.Light, { 1: "color-mix(in srgb, ".concat(s.black, " 15%, transparent)"), 2: "color-mix(in srgb, ".concat(s.black, " 20%, transparent)"), 3: "color-mix(in srgb, ".concat(s.black, " 60%, transparent)"), overflow: "color-mix(in srgb, ".concat(s.gray.dark1, " 30%, transparent)") }), x.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)" }), Ho = e(e({}, x.Light, { 1: "0px 2px 4px 1px ".concat(or[x.Light][1]), 2: "0px 18px 18px -15px ".concat(or[x.Light][2]), 3: "0px 8px 20px -8px ".concat(or[x.Light][3]), overflow: "0px 2px 4px 1px ".concat(or[x.Light].overflow) }), x.Dark, { 1: "unset", 2: "0 18px 18px -15px ".concat(or[x.Dark][2]), 3: "0 8px 20px -8px ".concat(or[x.Dark][3]), overflow: "0px 2px 4px 1px ".concat(or[x.Dark].overflow) });
e(e({}, x.Light, 2), x.Dark, 16);
var he = { XSmall: "xsmall", Small: "small", Default: "default", Large: "large" }, kr = { 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 }, Co = { faster: 100, default: 150, slower: 300, slowest: 500 }, Ft = { Body1: 13, Body2: 16 }, Ve = { body1: { fontSize: Ft.Body1, lineHeight: 20 }, body2: { fontSize: Ft.Body2, lineHeight: 28 }, code1: { fontSize: 13, lineHeight: 20 }, code2: { fontSize: 15, lineHeight: 24 }, disclaimer: { fontSize: 12, lineHeight: 20 }, large: { fontSize: 18, lineHeight: 24 } };
function Ht(t, i) {
i > t.length && (i = t.length);
for (var o = 0, l = Array(i); o < i; o++)
l[o] = t[o];
return l;
}
function H(t, i, o) {
return (i = function(l) {
var c = function(d, p) {
if (typeof d != "object" || !d)
return d;
var m = d[Symbol.toPrimitive];
if (m !== void 0) {
var g = m.call(d, p);
if (typeof g != "object")
return g;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(d);
}(l, "string");
return typeof c == "symbol" ? c : c + "";
}(i)) in t ? Object.defineProperty(t, i, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : t[i] = o, t;
}
function Cr() {
return Cr = Object.assign ? Object.assign.bind() : function(t) {
for (var i = 1; i < arguments.length; i++) {
var o = arguments[i];
for (var l in o)
({}).hasOwnProperty.call(o, l) && (t[l] = o[l]);
}
return t;
}, Cr.apply(null, arguments);
}
function Ct(t, i) {
var o = Object.keys(t);
if (Object.getOwnPropertySymbols) {
var l = Object.getOwnPropertySymbols(t);
i && (l = l.filter(function(c) {
return Object.getOwnPropertyDescriptor(t, c).enumerable;
})), o.push.apply(o, l);
}
return o;
}
function Lr(t) {
for (var i = 1; i < arguments.length; i++) {
var o = arguments[i] != null ? arguments[i] : {};
i % 2 ? Ct(Object(o), !0).forEach(function(l) {
H(t, l, o[l]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(o)) : Ct(Object(o)).forEach(function(l) {
Object.defineProperty(t, l, Object.getOwnPropertyDescriptor(o, l));
});
}
return t;
}
function Xr(t, i) {
if (t == null)
return {};
var o, l, c = function(p, m) {
if (p == null)
return {};
var g = {};
for (var y in p)
if ({}.hasOwnProperty.call(p, y)) {
if (m.indexOf(y) !== -1)
continue;
g[y] = p[y];
}
return g;
}(t, i);
if (Object.getOwnPropertySymbols) {
var d = Object.getOwnPropertySymbols(t);
for (l = 0; l < d.length; l++)
o = d[l], i.indexOf(o) === -1 && {}.propertyIsEnumerable.call(t, o) && (c[o] = t[o]);
}
return c;
}
function et(t, i) {
return function(o) {
if (Array.isArray(o))
return o;
}(t) || function(o, l) {
var c = o == null ? null : typeof Symbol < "u" && o[Symbol.iterator] || o["@@iterator"];
if (c != null) {
var d, p, m, g, y = [], D = !0, S = !1;
try {
if (m = (c = c.call(o)).next, l !== 0)
for (; !(D = (d = m.call(c)).done) && (y.push(d.value), y.length !== l); D = !0)
;
} catch (P) {
S = !0, p = P;
} finally {
try {
if (!D && c.return != null && (g = c.return(), Object(g) !== g))
return;
} finally {
if (S)
throw p;
}
}
return y;
}
}(t, i) || function(o, l) {
if (o) {
if (typeof o == "string")
return Ht(o, l);
var c = {}.toString.call(o).slice(8, -1);
return c === "Object" && o.constructor && (c = o.constructor.name), c === "Map" || c === "Set" ? Array.from(o) : c === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c) ? Ht(o, l) : void 0;
}
}(t, i) || 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 w(t, i) {
return i || (i = t.slice(0)), Object.freeze(Object.defineProperties(t, { raw: { value: Object.freeze(i) } }));
}
var Pt, Ot, Lt, Po = ["children"], ga = za({});
function Oo(t) {
var i = t.children, o = Xr(t, Po);
return v.createElement(ga.Provider, { value: o }, i);
}
var Nt, Rt, _t, Mt, Tt, zt, It, At, jt, Bt, Wt, Yt, Ut, Vt, Xt, Gt, Kt, Zt, qt, Qt, Jt, en, rn, tn, nn, an, on, ln, cn, sn, un, dn, fn, gn, hn, bn, Lo = h(Pt || (Pt = w([`
display: flex;
align-items: center;
gap: `, `px;
font-style: italic;
font-weight: 300;
padding-block: `, `px;
`])), kr[2], kr[1]), No = H(H({}, x.Light, h(Ot || (Ot = w([`
color: `, `;
`])), s.gray.dark1)), x.Dark, h(Lt || (Lt = w([`
color: `, `;
`])), s.gray.light1)), Ro = function() {
var t = Te().theme;
return v.createElement(Or, { "aria-label": "No results found", isInteractive: !1, className: ae(Lo, No[t]) }, v.createElement("span", null, "No results found"));
}, _o = h(Nt || (Nt = w([`
display: flex;
align-items: center;
gap: `, `px;
padding-block: `, `px;
`])), kr[2], kr[1]), Mo = ra(Rt || (Rt = w([`
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
`]))), To = h(_t || (_t = w([`
height: 16px;
width: 16px;
animation: `, ` 1.5s linear infinite;
`])), Mo), zo = function() {
var t = Te().darkMode;
return v.createElement(Or, { "data-testid": "lg-search-input-loading-option", "aria-label": "Loading results", isInteractive: !1, className: _o }, v.createElement(Va, { color: t ? s.blue.light1 : s.blue.base, className: To }), v.createElement("span", null, "Loading results"));
}, Io = h(Mt || (Mt = w([`
border-radius: `, `px;
`])), fa[300]), Ao = function(t) {
var i = t.theme, o = t.menuWidth;
return ae(Io, h(Tt || (Tt = w([`
width: `, `px;
min-width: `, `px;
background-color: `, `;
border: 1px solid `, `;
box-shadow: `, `;
`])), o, o, $t[i].background.primary.default, $t[i].border.secondary.default, Ho[i][1]));
}, jo = h(zt || (zt = w([`
padding: `, `px 0;
margin: 0;
border-radius: `, `px;
overflow-y: auto;
scroll-behavior: smooth;
`])), kr[300], fa[300]), Bo = function(t) {
var i = t.maxHeightValue;
return ae(jo, h(It || (It = w([`
max-height: `, `;
`])), i));
}, Wo = ["children", "open", "refEl", "footerSlot"], dt = v.forwardRef(function(t, i) {
var o = t.children, l = t.open, c = l !== void 0 && l, d = t.refEl, p = t.footerSlot, m = Xr(t, Wo), g = Te().theme, y = Ia(ga).state, D = ct(function() {
var C, O;
return (C = (O = d.current) === null || O === void 0 ? void 0 : O.clientWidth) !== null && C !== void 0 ? C : 0;
}, [d, c]), S = Fa(d), P = Ee(S) ? "unset" : "".concat(Math.min(S, 256), "px");
return v.createElement(Wa, { "data-testid": "lg-search-input-popover", spacing: kr[200], active: c, align: "bottom", justify: "start", className: Ao({ theme: g, menuWidth: D }), refEl: d, dismissMode: Ya.Manual, renderMode: Ua.TopLayer }, y === "loading" ? v.createElement(zo, null) : v.createElement(v.Fragment, null, v.createElement("ul", Cr({ role: "listbox", "aria-live": "polite", "aria-relevant": "additions removals", "aria-expanded": c, ref: i, className: Bo({ maxHeightValue: P }) }, m), v.Children.count(o) ? o : v.createElement(Ro, null)), p));
});
dt.displayName = "SearchResultsMenu";
var Xe = function(t) {
return "0 0 0 100px ".concat(t, " inset");
}, Yo = h(At || (At = w([`
outline: none;
`]))), Uo = h(jt || (jt = w([`
position: relative;
display: grid;
grid-auto-flow: column;
align-items: center;
justify-items: center;
border: 1px solid;
border-radius: 6px;
z-index: 0;
transition: `, `ms ease-in-out;
transition-property: border-color, box-shadow;
`])), Co.default), Vo = H(H(H(H({}, he.XSmall, h(Bt || (Bt = w([`
font-size: `, `px;
line-height: `, `px;
height: 22px;
grid-template-columns: 28px 1fr 36px;
`])), Ve.body1.fontSize, Ve.body1.lineHeight)), he.Small, h(Wt || (Wt = w([`
font-size: `, `px;
line-height: `, `px;
height: 28px;
grid-template-columns: 32px 1fr 36px;
`])), Ve.body1.fontSize, Ve.body1.lineHeight)), he.Default, h(Yt || (Yt = w([`
font-size: `, `px;
line-height: `, `px;
height: 36px;
grid-template-columns: 36px 1fr 36px;
`])), Ve.body1.fontSize, Ve.body1.lineHeight)), he.Large, h(Ut || (Ut = w([`
font-size: `, `px;
line-height: `, `px;
height: 48px;
grid-template-columns: 36px 1fr 44px;
`])), Ve.large.fontSize, Ve.large.lineHeight)), Xo = H(H({}, x.Light, h(Vt || (Vt = w([`
color: `, `;
background: `, `;
border-color: `, `;
`])), s.black, s.white, s.gray.base)), x.Dark, h(Xt || (Xt = w([`
color: `, `;
background-color: `, `;
border-color: `, `;
`])), s.gray.light2, s.gray.dark4, s.gray.base)), Go = H(H({}, x.Light, h(Gt || (Gt = w([`
&:hover,
&:active {
&:not(:disabled):not(:focus-within) {
box-shadow: `, `;
}
}
`])), Ir.light.gray)), x.Dark, h(Kt || (Kt = w([`
&:hover,
&:active {
&:not(:disabled):not(:focus-within) {
box-shadow: `, `;
}
}
`])), Ir.dark.gray)), Ko = H(H({}, x.Light, h(Zt || (Zt = w([`
&:not(:disabled):focus-within {
box-shadow: `, `;
border-color: `, `;
}
`])), zr.light.input, s.white)), x.Dark, h(qt || (qt = w([`
&:not(:disabled):focus-within {
box-shadow: `, `;
border-color: `, `;
}
`])), zr.dark.input, s.gray.dark4)), Zo = H(H({}, x.Light, h(Qt || (Qt = w([`
cursor: not-allowed;
color: `, `;
background-color: `, `;
border-color: `, `;
`])), s.gray.base, s.gray.light2, s.gray.light1)), x.Dark, h(Jt || (Jt = w([`
cursor: not-allowed;
color: `, `;
background-color: `, `;
border-color: `, `;
`])), s.gray.dark2, s.gray.dark3, s.gray.dark2)), qo = h(en || (en = w([`
font-size: inherit;
line-height: inherit;
color: inherit;
background-color: inherit;
font-family: `, `;
width: 100%;
height: 1.5em;
font-weight: `, `;
z-index: 1;
outline: none;
border: none;
padding: 0;
&[aria-disabled='true'] {
cursor: not-allowed;
&:hover,
&:active {
box-shadow: none;
}
}
&::placeholder {
font-size: inherit;
line-height: inherit;
}
&::-ms-clear,
&::-ms-reveal {
display: none;
width: 0;
height: 0;
}
&::-webkit-search-decoration,
&::-webkit-search-cancel-button,
&::-webkit-search-results-button,
&::-webkit-search-results-decoration {
display: none;
}
`])), Eo.default, at.regular), Qo = H(H({}, x.Light, h(rn || (rn = w([`
&:-webkit-autofill {
color: inherit;
background: transparent;
border: none;
-webkit-text-fill-color: inherit;
&[aria-disabled='false'] {
box-shadow: `, `;
&:focus {
box-shadow: `, `,
`, `;
}
&:hover:not(:focus) {
box-shadow: `, `,
`, `;
}
}
}
&::placeholder {
color: `, `;
font-weight: `, `;
}
&[aria-disabled='true'] {
&::placeholder {
color: `, `;
}
&:-webkit-autofill {
&,
&:hover,
&:focus {
appearance: none;
border: 1px solid `, `;
-webkit-text-fill-color: `, `;
box-shadow: `, `;
}
}
}
`])), Xe(s.white), Xe(s.white), zr.light.input, Xe(s.white), Ir.light.gray, s.gray.base, at.regular, s.gray.base, s.gray.base, s.gray.base, Xe(s.gray.light2))), x.Dark, h(tn || (tn = w([`
&:-webkit-autofill {
color: inherit;
background: transparent;
border: none;
-webkit-text-fill-color: `, `;
&[aria-disabled='false'] {
box-shadow: `, `;
&:focus {
box-shadow: `, `,
`, `;
border-color: `, `;
}
&:hover:not(:focus) {
box-shadow: `, `,
`, `;
}
}
}
&::placeholder {
color: `, `;
font-weight: `, `;
}
&[aria-disabled='true'] {
&::placeholder {
color: `, `;
}
&:-webkit-autofill {
&,
&:hover,
&:focus {
appearance: none;
border: 1px solid `, `;
-webkit-text-fill-color: `, `;
box-shadow: `, `;
}
}
}
`])), s.gray.light3, Xe(s.gray.dark4), Xe(s.gray.dark4), zr.dark.input, s.blue.light1, Xe(s.gray.dark4), Ir.dark.gray, s.gray.dark1, at.regular, s.gray.dark1, s.gray.dark1, s.gray.dark1, Xe(s.gray.dark2))), Jo = H(H({}, x.Light, h(nn || (nn = w([`
color: `, `;
`])), s.gray.dark1)), x.Dark, h(an || (an = w([`
color: `, `;
`])), s.gray.light1)), ei = H(H(H(H({}, he.XSmall, h(on || (on = w([`
margin-left: 2px;
`])))), he.Small, h(ln || (ln = w([`
margin-left: 0px;
`])))), he.Default, h(cn || (cn = w([`
margin-left: 8px;
`])))), he.Large, h(sn || (sn = w([`
margin-left: 8px;
`])))), ri = H(H({}, x.Light, h(un || (un = w([`
color: `, `;
`])), s.gray.base)), x.Dark, h(dn || (dn = w([`
color: `, `;
`])), s.gray.dark1)), ti = H(H(H(H({}, he.XSmall, h(fn || (fn = w([`
height: 22px;
width: 22px;
`])))), he.Small, h(gn || (gn = w([`
height: 28px;
width: 28px;
`])))), he.Default, h(hn || (hn = w([`
height: 28px;
width: 28px;
`])))), he.Large, h(bn || (bn = w([`
height: 28px;
width: 28px;
`])))), ni = { Unset: "unset", Loading: "loading" }, ai = ["placeholder", "className", "darkMode", "size", "disabled", "children", "state", "value", "onChange", "onSubmit", "aria-label", "aria-labelledby"], oi = v.forwardRef(function(t, i) {
var o = t.placeholder, l = o === void 0 ? "Search" : o, c = t.className, d = t.darkMode, p = t.size, m = p === void 0 ? he.Default : p, g = t.disabled, y = t.children, D = t.state, S = D === void 0 ? ni.Unset : D, P = t.value, C = t.onChange, O = t.onSubmit, oe = t["aria-label"], I = t["aria-labelledby"], Fe = Xr(t, ai), be = Te(d), E = be.theme, Y = be.darkMode, b = et(lr(!1), 2), X = b[0], ke = b[1], He = et(lr(0), 2), B = He[0], ze = He[1], xe = function() {
return ke(!1);
}, Ce = function() {
return ke(!0);
}, Ie = cr(null), Pe = cr(null), Oe = cr(null), G = ta(i, null), Ae = cr(null), De = na({ prefix: "result" }), qe = et(lr(), 2), Qe = qe[0], je = qe[1], ie = De("".concat(B)), we = !Ee(y), Se = aa(P, C), Be = Se.value, Le = Se.handleChange, Ne = Mr(function(R) {
G.current && (G.current.value = R, Le(Ha(new Event("change", { cancelable: !0, bubbles: !0 }), G.current)));
}, [Le, G]), re = Mr(function() {
var R = 0, _ = function(ee) {
if (_r(ee, "SearchResult")) {
var Re, fe = (R += 1) - 1, We = Wr(ee);
return v.cloneElement(ee, Lr(Lr({}, ee.props), {}, { id: "result-".concat(fe), key: "result-".concat(fe), ref: (Re = ee.props.ref) !== null && Re !== void 0 ? Re : De == null ? void 0 : De("".concat(fe)), highlighted: fe === B, onClick: function(sr) {
var rr, z;
if ((rr = (z = ee.props).onClick) === null || rr === void 0 || rr.call(z, sr), Ne(We), sr.detail >= 1 && Ie.current && G.current) {
var pe, _e = new Event("submit", { cancelable: !0, bubbles: !0 });
(pe = Ie.current) === null || pe === void 0 || pe.dispatchEvent(_e);
}
} }));
}
if (_r(ee, "SearchResultGroup")) {
var ge = v.Children.map(ee.props.children, _);
if (ge && ge.length > 0)
return v.cloneElement(ee, Lr(Lr({}, ee.props), {}, { children: ge }));
}
}, le = v.Children.map(y, _);
return { resultsCount: R, updatedChildren: le };
}, [y, B, G, De, Ne]), ve = ct(function() {
return re();
}, [re]), Je = ve.updatedChildren, er = ve.resultsCount, k = function(R) {
switch (R) {
case "first":
ze(0);
break;
case "last":
ze(er);
break;
case "next":
var _ = !Ee(B) && B + 1 < er ? B + 1 : 0;
ze(_);
break;
case "prev":
var le = !Ee(B) && B - 1 >= 0 ? B - 1 : er - 1;
ze(le);
}
};
return oa(ie, Oe, 12), ia(function() {
xe();
}, [Pe, Oe], { enabled: X && we }), v.createElement(la, { darkMode: Y }, v.createElement(Oo, { state: S, highlight: B, resultDynamicRefs: De }, v.createElement("form", Cr({ role: "search", ref: Ie, className: ae(Yo, c), onSubmit: function(R) {
R.preventDefault(), O == null || O(R), we && (xe(), Ne(""));
} }, Fe), v.createElement("div", { ref: Pe, role: "searchbox", tabIndex: -1, onMouseDown: function(R) {
g && R.preventDefault();
}, onClick: function(R) {
(function(_) {
g ? (_.preventDefault(), _.stopPropagation()) : Ce();
})(R);
}, onFocus: function(R) {
var _, le = R.target, ee = le === Ae.current ? Ae.current : (_ = G.current) !== null && _ !== void 0 ? _ : le;
ee.focus(), je(ee);
}, onKeyDown: function(R) {
var _, le, ee = (_ = Oe.current) === null || _ === void 0 ? void 0 : _.contains(document.activeElement);
if ((!((le = Pe.current) === null || le === void 0) && le.contains(document.activeElement) || ee) && !g)
switch (R.key) {
case $r.Enter:
var Re;
ie == null || (Re = ie.current) === null || Re === void 0 || Re.click();
break;
case $r.Escape:
var fe;
xe(), (fe = G.current) === null || fe === void 0 || fe.focus();
break;
case $r.ArrowDown:
var We;
we && ((We = G.current) === null || We === void 0 || We.focus(), Ce(), R.preventDefault(), k("next"));
break;
case $r.ArrowUp:
var ge;
we && ((ge = G.current) === null || ge === void 0 || ge.focus(), Ce(), R.preventDefault(), k("prev"));
break;
case $r.Tab:
X && xe();
break;
default:
we && Ce();
}
}, className: ae(Uo, Vo[m], Xo[E], H(H(H({}, Ko[E], Qe === G.current), Zo[E], g), Go[E], !g)), "aria-label": I ? void 0 : oe, "aria-labelledby": I }, v.createElement(tt, { className: ae(Jo[E], ei[m], H({}, ri[E], g)), role: "presentation" }), v.createElement("input", { type: "search", className: ae(qo, Qo[E]), value: Be, onChange: function(R) {
Le == null || Le(R);
}, placeholder: l, ref: G, readOnly: g, "aria-disabled": g }), Be && v.createElement(st, { ref: Ae, type: "button", "aria-label": "Clear search", onClick: function(R) {
var _;
R.stopPropagation(), Ne(""), G == null || (_ = G.current) === null || _ === void 0 || _.focus();
}, className: ti[m], tabIndex: g ? -1 : 0, disabled: g }, v.createElement(nt, null))), we && v.createElement(dt, { open: X, refEl: Pe, ref: Oe }, Je))));
});
oi.displayName = "SearchInput";
var vn, pn, mn, ii = ["as", "children", "description", "disabled", "className", "darkMode"], li = ca(function(t, i) {
var o, l = t.as, c = l === void 0 ? "li" : l, d = t.children, p = t.description, m = t.disabled, g = t.className;
t.darkMode;
var y = Xr(t, ii), D = Wr(d), S = (o = y["aria-label"]) !== null && o !== void 0 ? o : y["aria-labelledby"] ? "" : D;
return v.createElement(Or, Cr({}, y, { as: c, ref: i, className: g, disabled: m, "aria-labelledby": y["aria-labelledby"], "aria-label": S }), v.createElement(sa, { description: p, preserveIconSpace: !1 }, v.createElement("strong", null, d)));
}, "SearchResult");
li.displayName = "SearchResult";
h(vn || (vn = w([`
padding-top: 12px;
padding-bottom: 0;
`])));
H(H({}, x.Light, h(pn || (pn = w([`
color: `, `;
`])), s.gray.dark1)), x.Dark, h(mn || (mn = w([`
color: `, `;
`])), s.gray.base));
var ha = { 0: 0, 50: 2, 100: 4, 150: 6, 200: 8, 300: 12, 400: 16, 500: 20, 600: 24 };
function r(t, i, o) {
return (i = function(l) {
var c = function(d, p) {
if (typeof d != "object" || !d)
return d;
var m = d[Symbol.toPrimitive];
if (m !== void 0) {
var g = m.call(d, p);
if (typeof g != "object")
return g;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(d);
}(l, "string");
return typeof c == "symbol" ? c : c + "";
}(i)) in t ? Object.defineProperty(t, i, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : t[i] = o, t;
}
var yn, kn, u = { 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" }, n = { Default: "default", Hover: "hover", Focus: "focus" }, Hr = s.black, j = s.blue, F = s.gray, Q = s.green, se = s.red, ci = s.white, br = s.yellow, si = { background: r(r(r(r(r(r(r(r({}, u.Primary, r(r(r({}, n.Default, Hr), n.Hover, F.dark2), n.Focus, j.dark3)), u.Secondary, r(r(r({}, n.Default, F.dark4), n.Hover, F.dark2), n.Focus, j.dark3)), u.InversePrimary, r(r(r({}, n.Default, F.light2), n.Hover, F.light3), n.Focus, j.light2)), u.Info, r(r(r({}, n.Default, j.dark3), n.Hover, j.dark3), n.Focus, j.dark3)), u.Warning, r(r(r({}, n.Default, br.dark3), n.Hover, br.dark3), n.Focus, br.dark3)), u.Success, r(r(r({}, n.Default, Q.dark3), n.Hover, Q.dark3), n.Focus, Q.dark3)), u.Error, r(r(r({}, n.Default, se.dark3), n.Hover, se.dark3), n.Focus, se.dark3)), u.Disabled, r(r(r({}, n.Default, F.dark3), n.Hover, F.dark3), n.Focus, F.dark3)), border: r(r(r(r(r(r(r(r({}, u.Primary, r(r(r({}, n.Default, F.base), n.Hover, F.base), n.Focus, j.light1)), u.Secondary, r(r(r({}, n.Default, F.dark2), n.Hover, F.dark2), n.Focus, j.light1)), u.Tertiary, r(r(r({}, n.Default, F.dark1), n.Hover, F.dark1), n.Focus, j.light1)), u.Success, r(r(r({}, n.Default, Q.dark1), n.Hover, Q.dark1), n.Focus, j.light1)), u.Error, r(r(r({}, n.Default, se.light1), n.Hover, se.light1), n.Focus, j.light1)), u.OnSuccess, r(r(r({}, n.Default, Q.dark2), n.Hover, Q.dark2), n.Focus, j.light1)), u.OnError, r(r(r({}, n.Default, se.dark2), n.Hover, se.dark2), n.Focus, j.light1)), u.Disabled, r(r(r({}, n.Default, F.dark2), n.Hover, F.dark2), n.Focus, F.dark2)), icon: r(r(r(r(r(r(r(r({}, u.Primary, r(r(r({}, n.Default, F.light1), n.Hover, F.light3), n.Focus, j.light3)), u.Secondary, r(r(r({}, n.Default, F.base), n.Hover, F.light3), n.Focus, j.light3)), u.InversePrimary, r(r(r({}, n.Default, ci), n.Hover, Hr), n.Focus, j.dark2)), u.Info, r(r(r({}, n.Default, j.light1), n.Hover, j.light1), n.Focus, j.light1)), u.Warning, r(r(r({}, n.Default, br.base), n.Hover, br.base), n.Focus, br.base)), u.Success, r(r(r({}, n.Default, Q.base), n.Hover, Q.base), n.Focus, Q.base)), u.Error, r(r(r({}, n.Default, se.light1), n.Hover, se.light1), n.Focus, se.light1)), u.Disabled, r(r(r({}, n.Default, F.dark1), n.Hover, F.dark1), n.Focus, F.dark1)), text: (r(r(r(r(r(r(r(r(r(r(yn = {}, u.Primary, r(r(r({}, n.Default, F.light2), n.Hover, F.light2), n.Focus, j.light3)), u.Placeholder, r(r(r({}, n.Default, F.dark1), n.Hover, F.dark1), n.Focus, F.dark1)), u.Secondary, r(r(r({}, n.Default, F.light1), n.Hover, F.light2), n.Focus, j.light3)), u.InversePrimary, r(r(r({}, n.Default, Hr), n.Hover, Hr), n.Focus, j.dark2)), u.InverseSecondary, r(r(r({}, n.Default, F.dark2), n.Hover, Hr), n.Focus, j.dark2)), u.Disabled, r(r(r({}, n.Default, F.dark1), n.Hover, F.dark1), n.Focus, F.dark1)), u.Success, r(r(r({}, n.Default, Q.light2), n.Hover, Q.light2), n.Focus, Q.light2)), u.Error, r(r(r({}, n.Default, se.light1), n.Hover, se.light1), n.Focus, se.light1)), u.OnSuccess, r(r(r({}, n.Default, Q.light1), n.Hover, Q.light1), n.Focus, Q.light1)), u.OnSuccessLink, r(r(r({}, n.Default, Q.light3), n.Hover, Q.light3), n.Focus, Q.light3)), r(r(yn, u.O