mongodb-chatbot-ui
Version:
UI React components for the MongoDB Chatbot Framework
981 lines (980 loc) • 33.8 kB
JavaScript
import { e as Me, am as De, _ as $e } from "./index2.js";
import { p as k, g as ke } from "./jsx-runtime.js";
import J from "react";
import te from "react-dom";
var Y = Me({
key: "css"
});
Y.flush;
Y.hydrate;
var Ke = Y.cx;
Y.merge;
Y.getRegisteredStyles;
Y.injectGlobal;
Y.keyframes;
var Ze = Y.css;
Y.sheet;
Y.cache;
function Ne(s, g) {
if (s == null)
return {};
var f = {}, a = Object.keys(s), r, e;
for (e = 0; e < a.length; e++)
r = a[e], !(g.indexOf(r) >= 0) && (f[r] = s[r]);
return f;
}
var Ee = { exports: {} }, re = { exports: {} }, b = {};
/** @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 be;
function je() {
if (be)
return b;
be = 1;
var s = typeof Symbol == "function" && Symbol.for, g = s ? Symbol.for("react.element") : 60103, f = s ? Symbol.for("react.portal") : 60106, a = s ? Symbol.for("react.fragment") : 60107, r = s ? Symbol.for("react.strict_mode") : 60108, e = s ? Symbol.for("react.profiler") : 60114, u = s ? Symbol.for("react.provider") : 60109, c = s ? Symbol.for("react.context") : 60110, S = s ? Symbol.for("react.async_mode") : 60111, C = s ? Symbol.for("react.concurrent_mode") : 60111, _ = s ? Symbol.for("react.forward_ref") : 60112, O = s ? Symbol.for("react.suspense") : 60113, D = s ? Symbol.for("react.suspense_list") : 60120, w = s ? Symbol.for("react.memo") : 60115, N = s ? Symbol.for("react.lazy") : 60116, P = s ? Symbol.for("react.block") : 60121, M = s ? Symbol.for("react.fundamental") : 60117, j = s ? Symbol.for("react.responder") : 60118, H = s ? Symbol.for("react.scope") : 60119;
function I(i) {
if (typeof i == "object" && i !== null) {
var U = i.$$typeof;
switch (U) {
case g:
switch (i = i.type, i) {
case S:
case C:
case a:
case e:
case r:
case O:
return i;
default:
switch (i = i && i.$$typeof, i) {
case c:
case _:
case N:
case w:
case u:
return i;
default:
return U;
}
}
case f:
return U;
}
}
}
function A(i) {
return I(i) === C;
}
return b.AsyncMode = S, b.ConcurrentMode = C, b.ContextConsumer = c, b.ContextProvider = u, b.Element = g, b.ForwardRef = _, b.Fragment = a, b.Lazy = N, b.Memo = w, b.Portal = f, b.Profiler = e, b.StrictMode = r, b.Suspense = O, b.isAsyncMode = function(i) {
return A(i) || I(i) === S;
}, b.isConcurrentMode = A, b.isContextConsumer = function(i) {
return I(i) === c;
}, b.isContextProvider = function(i) {
return I(i) === u;
}, b.isElement = function(i) {
return typeof i == "object" && i !== null && i.$$typeof === g;
}, b.isForwardRef = function(i) {
return I(i) === _;
}, b.isFragment = function(i) {
return I(i) === a;
}, b.isLazy = function(i) {
return I(i) === N;
}, b.isMemo = function(i) {
return I(i) === w;
}, b.isPortal = function(i) {
return I(i) === f;
}, b.isProfiler = function(i) {
return I(i) === e;
}, b.isStrictMode = function(i) {
return I(i) === r;
}, b.isSuspense = function(i) {
return I(i) === O;
}, b.isValidElementType = function(i) {
return typeof i == "string" || typeof i == "function" || i === a || i === C || i === e || i === r || i === O || i === D || typeof i == "object" && i !== null && (i.$$typeof === N || i.$$typeof === w || i.$$typeof === u || i.$$typeof === c || i.$$typeof === _ || i.$$typeof === M || i.$$typeof === j || i.$$typeof === H || i.$$typeof === P);
}, b.typeOf = I, b;
}
var x = {}, xe;
function qe() {
return xe || (xe = 1, k.env.NODE_ENV !== "production" && function() {
var s = typeof Symbol == "function" && Symbol.for, g = s ? Symbol.for("react.element") : 60103, f = s ? Symbol.for("react.portal") : 60106, a = s ? Symbol.for("react.fragment") : 60107, r = s ? Symbol.for("react.strict_mode") : 60108, e = s ? Symbol.for("react.profiler") : 60114, u = s ? Symbol.for("react.provider") : 60109, c = s ? Symbol.for("react.context") : 60110, S = s ? Symbol.for("react.async_mode") : 60111, C = s ? Symbol.for("react.concurrent_mode") : 60111, _ = s ? Symbol.for("react.forward_ref") : 60112, O = s ? Symbol.for("react.suspense") : 60113, D = s ? Symbol.for("react.suspense_list") : 60120, w = s ? Symbol.for("react.memo") : 60115, N = s ? Symbol.for("react.lazy") : 60116, P = s ? Symbol.for("react.block") : 60121, M = s ? Symbol.for("react.fundamental") : 60117, j = s ? Symbol.for("react.responder") : 60118, H = s ? Symbol.for("react.scope") : 60119;
function I(n) {
return typeof n == "string" || typeof n == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
n === a || n === C || n === e || n === r || n === O || n === D || typeof n == "object" && n !== null && (n.$$typeof === N || n.$$typeof === w || n.$$typeof === u || n.$$typeof === c || n.$$typeof === _ || n.$$typeof === M || n.$$typeof === j || n.$$typeof === H || n.$$typeof === P);
}
function A(n) {
if (typeof n == "object" && n !== null) {
var L = n.$$typeof;
switch (L) {
case g:
var ee = n.type;
switch (ee) {
case S:
case C:
case a:
case e:
case r:
case O:
return ee;
default:
var Te = ee && ee.$$typeof;
switch (Te) {
case c:
case _:
case N:
case w:
case u:
return Te;
default:
return L;
}
}
case f:
return L;
}
}
}
var i = S, U = C, ne = c, ie = u, oe = g, ae = _, Z = a, se = N, ue = w, V = f, fe = e, q = r, F = O, Q = !1;
function ce(n) {
return Q || (Q = !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.")), t(n) || A(n) === S;
}
function t(n) {
return A(n) === C;
}
function o(n) {
return A(n) === c;
}
function E(n) {
return A(n) === u;
}
function v(n) {
return typeof n == "object" && n !== null && n.$$typeof === g;
}
function l(n) {
return A(n) === _;
}
function h(n) {
return A(n) === a;
}
function d(n) {
return A(n) === N;
}
function y(n) {
return A(n) === w;
}
function m(n) {
return A(n) === f;
}
function R(n) {
return A(n) === e;
}
function T(n) {
return A(n) === r;
}
function $(n) {
return A(n) === O;
}
x.AsyncMode = i, x.ConcurrentMode = U, x.ContextConsumer = ne, x.ContextProvider = ie, x.Element = oe, x.ForwardRef = ae, x.Fragment = Z, x.Lazy = se, x.Memo = ue, x.Portal = V, x.Profiler = fe, x.StrictMode = q, x.Suspense = F, x.isAsyncMode = ce, x.isConcurrentMode = t, x.isContextConsumer = o, x.isContextProvider = E, x.isElement = v, x.isForwardRef = l, x.isFragment = h, x.isLazy = d, x.isMemo = y, x.isPortal = m, x.isProfiler = R, x.isStrictMode = T, x.isSuspense = $, x.isValidElementType = I, x.typeOf = A;
}()), x;
}
var ge;
function we() {
return ge || (ge = 1, k.env.NODE_ENV === "production" ? re.exports = je() : re.exports = qe()), re.exports;
}
var le, Se;
function me() {
if (Se)
return le;
Se = 1;
var s = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
return le = s, le;
}
var pe, Re;
function Ae() {
return Re || (Re = 1, pe = Function.call.bind(Object.prototype.hasOwnProperty)), pe;
}
var de, _e;
function Le() {
if (_e)
return de;
_e = 1;
var s = function() {
};
if (k.env.NODE_ENV !== "production") {
var g = me(), f = {}, a = Ae();
s = function(e) {
var u = "Warning: " + e;
typeof console < "u" && console.error(u);
try {
throw new Error(u);
} catch {
}
};
}
function r(e, u, c, S, C) {
if (k.env.NODE_ENV !== "production") {
for (var _ in e)
if (a(e, _)) {
var O;
try {
if (typeof e[_] != "function") {
var D = Error(
(S || "React class") + ": " + c + " type `" + _ + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[_] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
);
throw D.name = "Invariant Violation", D;
}
O = e[_](u, _, S, c, null, g);
} catch (N) {
O = N;
}
if (O && !(O instanceof Error) && s(
(S || "React class") + ": type specification of " + c + " `" + _ + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof O + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
), O instanceof Error && !(O.message in f)) {
f[O.message] = !0;
var w = C ? C() : "";
s(
"Failed " + c + " type: " + O.message + (w ?? "")
);
}
}
}
}
return r.resetWarningCache = function() {
k.env.NODE_ENV !== "production" && (f = {});
}, de = r, de;
}
var ve, Oe;
function Ye() {
if (Oe)
return ve;
Oe = 1;
var s = we(), g = De, f = me(), a = Ae(), r = Le(), e = function() {
};
k.env.NODE_ENV !== "production" && (e = function(c) {
var S = "Warning: " + c;
typeof console < "u" && console.error(S);
try {
throw new Error(S);
} catch {
}
});
function u() {
return null;
}
return ve = function(c, S) {
var C = typeof Symbol == "function" && Symbol.iterator, _ = "@@iterator";
function O(t) {
var o = t && (C && t[C] || t[_]);
if (typeof o == "function")
return o;
}
var D = "<<anonymous>>", w = {
array: j("array"),
bigint: j("bigint"),
bool: j("boolean"),
func: j("function"),
number: j("number"),
object: j("object"),
string: j("string"),
symbol: j("symbol"),
any: H(),
arrayOf: I,
element: A(),
elementType: i(),
instanceOf: U,
node: ae(),
objectOf: ie,
oneOf: ne,
oneOfType: oe,
shape: se,
exact: ue
};
function N(t, o) {
return t === o ? t !== 0 || 1 / t === 1 / o : t !== t && o !== o;
}
function P(t, o) {
this.message = t, this.data = o && typeof o == "object" ? o : {}, this.stack = "";
}
P.prototype = Error.prototype;
function M(t) {
if (k.env.NODE_ENV !== "production")
var o = {}, E = 0;
function v(h, d, y, m, R, T, $) {
if (m = m || D, T = T || y, $ !== f) {
if (S) {
var n = new Error(
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
);
throw n.name = "Invariant Violation", n;
} else if (k.env.NODE_ENV !== "production" && typeof console < "u") {
var L = m + ":" + y;
!o[L] && // Avoid spamming the console because they are often not actionable except for lib authors
E < 3 && (e(
"You are manually calling a React.PropTypes validation function for the `" + T + "` prop on `" + m + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
), o[L] = !0, E++);
}
}
return d[y] == null ? h ? d[y] === null ? new P("The " + R + " `" + T + "` is marked as required " + ("in `" + m + "`, but its value is `null`.")) : new P("The " + R + " `" + T + "` is marked as required in " + ("`" + m + "`, but its value is `undefined`.")) : null : t(d, y, m, R, T);
}
var l = v.bind(null, !1);
return l.isRequired = v.bind(null, !0), l;
}
function j(t) {
function o(E, v, l, h, d, y) {
var m = E[v], R = q(m);
if (R !== t) {
var T = F(m);
return new P(
"Invalid " + h + " `" + d + "` of type " + ("`" + T + "` supplied to `" + l + "`, expected ") + ("`" + t + "`."),
{ expectedType: t }
);
}
return null;
}
return M(o);
}
function H() {
return M(u);
}
function I(t) {
function o(E, v, l, h, d) {
if (typeof t != "function")
return new P("Property `" + d + "` of component `" + l + "` has invalid PropType notation inside arrayOf.");
var y = E[v];
if (!Array.isArray(y)) {
var m = q(y);
return new P("Invalid " + h + " `" + d + "` of type " + ("`" + m + "` supplied to `" + l + "`, expected an array."));
}
for (var R = 0; R < y.length; R++) {
var T = t(y, R, l, h, d + "[" + R + "]", f);
if (T instanceof Error)
return T;
}
return null;
}
return M(o);
}
function A() {
function t(o, E, v, l, h) {
var d = o[E];
if (!c(d)) {
var y = q(d);
return new P("Invalid " + l + " `" + h + "` of type " + ("`" + y + "` supplied to `" + v + "`, expected a single ReactElement."));
}
return null;
}
return M(t);
}
function i() {
function t(o, E, v, l, h) {
var d = o[E];
if (!s.isValidElementType(d)) {
var y = q(d);
return new P("Invalid " + l + " `" + h + "` of type " + ("`" + y + "` supplied to `" + v + "`, expected a single ReactElement type."));
}
return null;
}
return M(t);
}
function U(t) {
function o(E, v, l, h, d) {
if (!(E[v] instanceof t)) {
var y = t.name || D, m = ce(E[v]);
return new P("Invalid " + h + " `" + d + "` of type " + ("`" + m + "` supplied to `" + l + "`, expected ") + ("instance of `" + y + "`."));
}
return null;
}
return M(o);
}
function ne(t) {
if (!Array.isArray(t))
return k.env.NODE_ENV !== "production" && (arguments.length > 1 ? e(
"Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
) : e("Invalid argument supplied to oneOf, expected an array.")), u;
function o(E, v, l, h, d) {
for (var y = E[v], m = 0; m < t.length; m++)
if (N(y, t[m]))
return null;
var R = JSON.stringify(t, function($, n) {
var L = F(n);
return L === "symbol" ? String(n) : n;
});
return new P("Invalid " + h + " `" + d + "` of value `" + String(y) + "` " + ("supplied to `" + l + "`, expected one of " + R + "."));
}
return M(o);
}
function ie(t) {
function o(E, v, l, h, d) {
if (typeof t != "function")
return new P("Property `" + d + "` of component `" + l + "` has invalid PropType notation inside objectOf.");
var y = E[v], m = q(y);
if (m !== "object")
return new P("Invalid " + h + " `" + d + "` of type " + ("`" + m + "` supplied to `" + l + "`, expected an object."));
for (var R in y)
if (a(y, R)) {
var T = t(y, R, l, h, d + "." + R, f);
if (T instanceof Error)
return T;
}
return null;
}
return M(o);
}
function oe(t) {
if (!Array.isArray(t))
return k.env.NODE_ENV !== "production" && e("Invalid argument supplied to oneOfType, expected an instance of array."), u;
for (var o = 0; o < t.length; o++) {
var E = t[o];
if (typeof E != "function")
return e(
"Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + Q(E) + " at index " + o + "."
), u;
}
function v(l, h, d, y, m) {
for (var R = [], T = 0; T < t.length; T++) {
var $ = t[T], n = $(l, h, d, y, m, f);
if (n == null)
return null;
n.data && a(n.data, "expectedType") && R.push(n.data.expectedType);
}
var L = R.length > 0 ? ", expected one of type [" + R.join(", ") + "]" : "";
return new P("Invalid " + y + " `" + m + "` supplied to " + ("`" + d + "`" + L + "."));
}
return M(v);
}
function ae() {
function t(o, E, v, l, h) {
return V(o[E]) ? null : new P("Invalid " + l + " `" + h + "` supplied to " + ("`" + v + "`, expected a ReactNode."));
}
return M(t);
}
function Z(t, o, E, v, l) {
return new P(
(t || "React class") + ": " + o + " type `" + E + "." + v + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + l + "`."
);
}
function se(t) {
function o(E, v, l, h, d) {
var y = E[v], m = q(y);
if (m !== "object")
return new P("Invalid " + h + " `" + d + "` of type `" + m + "` " + ("supplied to `" + l + "`, expected `object`."));
for (var R in t) {
var T = t[R];
if (typeof T != "function")
return Z(l, h, d, R, F(T));
var $ = T(y, R, l, h, d + "." + R, f);
if ($)
return $;
}
return null;
}
return M(o);
}
function ue(t) {
function o(E, v, l, h, d) {
var y = E[v], m = q(y);
if (m !== "object")
return new P("Invalid " + h + " `" + d + "` of type `" + m + "` " + ("supplied to `" + l + "`, expected `object`."));
var R = g({}, E[v], t);
for (var T in R) {
var $ = t[T];
if (a(t, T) && typeof $ != "function")
return Z(l, h, d, T, F($));
if (!$)
return new P(
"Invalid " + h + " `" + d + "` key `" + T + "` supplied to `" + l + "`.\nBad object: " + JSON.stringify(E[v], null, " ") + `
Valid keys: ` + JSON.stringify(Object.keys(t), null, " ")
);
var n = $(y, T, l, h, d + "." + T, f);
if (n)
return n;
}
return null;
}
return M(o);
}
function V(t) {
switch (typeof t) {
case "number":
case "string":
case "undefined":
return !0;
case "boolean":
return !t;
case "object":
if (Array.isArray(t))
return t.every(V);
if (t === null || c(t))
return !0;
var o = O(t);
if (o) {
var E = o.call(t), v;
if (o !== t.entries) {
for (; !(v = E.next()).done; )
if (!V(v.value))
return !1;
} else
for (; !(v = E.next()).done; ) {
var l = v.value;
if (l && !V(l[1]))
return !1;
}
} else
return !1;
return !0;
default:
return !1;
}
}
function fe(t, o) {
return t === "symbol" ? !0 : o ? o["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && o instanceof Symbol : !1;
}
function q(t) {
var o = typeof t;
return Array.isArray(t) ? "array" : t instanceof RegExp ? "object" : fe(o, t) ? "symbol" : o;
}
function F(t) {
if (typeof t > "u" || t === null)
return "" + t;
var o = q(t);
if (o === "object") {
if (t instanceof Date)
return "date";
if (t instanceof RegExp)
return "regexp";
}
return o;
}
function Q(t) {
var o = F(t);
switch (o) {
case "array":
case "object":
return "an " + o;
case "boolean":
case "date":
case "regexp":
return "a " + o;
default:
return o;
}
}
function ce(t) {
return !t.constructor || !t.constructor.name ? D : t.constructor.name;
}
return w.checkPropTypes = r, w.resetWarningCache = r.resetWarningCache, w.PropTypes = w, w;
}, ve;
}
var ye, Ce;
function We() {
if (Ce)
return ye;
Ce = 1;
var s = me();
function g() {
}
function f() {
}
return f.resetWarningCache = g, ye = function() {
function a(u, c, S, C, _, O) {
if (O !== s) {
var D = new Error(
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
);
throw D.name = "Invariant Violation", D;
}
}
a.isRequired = a;
function r() {
return a;
}
var e = {
array: a,
bigint: a,
bool: a,
func: a,
number: a,
object: a,
string: a,
symbol: a,
any: a,
arrayOf: r,
element: a,
elementType: a,
instanceOf: r,
node: a,
objectOf: r,
oneOf: r,
oneOfType: r,
shape: r,
exact: r,
checkPropTypes: f,
resetWarningCache: g
};
return e.PropTypes = e, e;
}, ye;
}
if (k.env.NODE_ENV !== "production") {
var Ue = we(), Fe = !0;
Ee.exports = Ye()(Ue.isElement, Fe);
} else
Ee.exports = We()();
var ze = Ee.exports;
const p = /* @__PURE__ */ ke(ze), Pe = {
disabled: !1
};
var Ge = k.env.NODE_ENV !== "production" ? p.oneOfType([p.number, p.shape({
enter: p.number,
exit: p.number,
appear: p.number
}).isRequired]) : null, Qe = k.env.NODE_ENV !== "production" ? p.oneOfType([p.string, p.shape({
enter: p.string,
exit: p.string,
active: p.string
}), p.shape({
enter: p.string,
enterDone: p.string,
enterActive: p.string,
exit: p.string,
exitDone: p.string,
exitActive: p.string
})]) : null;
const Ie = J.createContext(null);
var Ve = function(g) {
return g.scrollTop;
}, K = "unmounted", z = "exited", G = "entering", B = "entered", he = "exiting", W = /* @__PURE__ */ function(s) {
$e(g, s);
function g(a, r) {
var e;
e = s.call(this, a, r) || this;
var u = r, c = u && !u.isMounting ? a.enter : a.appear, S;
return e.appearStatus = null, a.in ? c ? (S = z, e.appearStatus = G) : S = B : a.unmountOnExit || a.mountOnEnter ? S = K : S = z, e.state = {
status: S
}, e.nextCallback = null, e;
}
g.getDerivedStateFromProps = function(r, e) {
var u = r.in;
return u && e.status === K ? {
status: z
} : null;
};
var f = g.prototype;
return f.componentDidMount = function() {
this.updateStatus(!0, this.appearStatus);
}, f.componentDidUpdate = function(r) {
var e = null;
if (r !== this.props) {
var u = this.state.status;
this.props.in ? u !== G && u !== B && (e = G) : (u === G || u === B) && (e = he);
}
this.updateStatus(!1, e);
}, f.componentWillUnmount = function() {
this.cancelNextCallback();
}, f.getTimeouts = function() {
var r = this.props.timeout, e, u, c;
return e = u = c = r, r != null && typeof r != "number" && (e = r.exit, u = r.enter, c = r.appear !== void 0 ? r.appear : u), {
exit: e,
enter: u,
appear: c
};
}, f.updateStatus = function(r, e) {
if (r === void 0 && (r = !1), e !== null)
if (this.cancelNextCallback(), e === G) {
if (this.props.unmountOnExit || this.props.mountOnEnter) {
var u = this.props.nodeRef ? this.props.nodeRef.current : te.findDOMNode(this);
u && Ve(u);
}
this.performEnter(r);
} else
this.performExit();
else
this.props.unmountOnExit && this.state.status === z && this.setState({
status: K
});
}, f.performEnter = function(r) {
var e = this, u = this.props.enter, c = this.context ? this.context.isMounting : r, S = this.props.nodeRef ? [c] : [te.findDOMNode(this), c], C = S[0], _ = S[1], O = this.getTimeouts(), D = c ? O.appear : O.enter;
if (!r && !u || Pe.disabled) {
this.safeSetState({
status: B
}, function() {
e.props.onEntered(C);
});
return;
}
this.props.onEnter(C, _), this.safeSetState({
status: G
}, function() {
e.props.onEntering(C, _), e.onTransitionEnd(D, function() {
e.safeSetState({
status: B
}, function() {
e.props.onEntered(C, _);
});
});
});
}, f.performExit = function() {
var r = this, e = this.props.exit, u = this.getTimeouts(), c = this.props.nodeRef ? void 0 : te.findDOMNode(this);
if (!e || Pe.disabled) {
this.safeSetState({
status: z
}, function() {
r.props.onExited(c);
});
return;
}
this.props.onExit(c), this.safeSetState({
status: he
}, function() {
r.props.onExiting(c), r.onTransitionEnd(u.exit, function() {
r.safeSetState({
status: z
}, function() {
r.props.onExited(c);
});
});
});
}, f.cancelNextCallback = function() {
this.nextCallback !== null && (this.nextCallback.cancel(), this.nextCallback = null);
}, f.safeSetState = function(r, e) {
e = this.setNextCallback(e), this.setState(r, e);
}, f.setNextCallback = function(r) {
var e = this, u = !0;
return this.nextCallback = function(c) {
u && (u = !1, e.nextCallback = null, r(c));
}, this.nextCallback.cancel = function() {
u = !1;
}, this.nextCallback;
}, f.onTransitionEnd = function(r, e) {
this.setNextCallback(e);
var u = this.props.nodeRef ? this.props.nodeRef.current : te.findDOMNode(this), c = r == null && !this.props.addEndListener;
if (!u || c) {
setTimeout(this.nextCallback, 0);
return;
}
if (this.props.addEndListener) {
var S = this.props.nodeRef ? [this.nextCallback] : [u, this.nextCallback], C = S[0], _ = S[1];
this.props.addEndListener(C, _);
}
r != null && setTimeout(this.nextCallback, r);
}, f.render = function() {
var r = this.state.status;
if (r === K)
return null;
var e = this.props, u = e.children;
e.in, e.mountOnEnter, e.unmountOnExit, e.appear, e.enter, e.exit, e.timeout, e.addEndListener, e.onEnter, e.onEntering, e.onEntered, e.onExit, e.onExiting, e.onExited, e.nodeRef;
var c = Ne(e, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);
return (
// allows for nested Transitions
/* @__PURE__ */ J.createElement(Ie.Provider, {
value: null
}, typeof u == "function" ? u(r, c) : J.cloneElement(J.Children.only(u), c))
);
}, g;
}(J.Component);
W.contextType = Ie;
W.propTypes = k.env.NODE_ENV !== "production" ? {
/**
* A React reference to DOM element that need to transition:
* https://stackoverflow.com/a/51127130/4671932
*
* - When `nodeRef` prop is used, `node` is not passed to callback functions
* (e.g. `onEnter`) because user already has direct access to the node.
* - When changing `key` prop of `Transition` in a `TransitionGroup` a new
* `nodeRef` need to be provided to `Transition` with changed `key` prop
* (see
* [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
*/
nodeRef: p.shape({
current: typeof Element > "u" ? p.any : function(s, g, f, a, r, e) {
var u = s[g];
return p.instanceOf(u && "ownerDocument" in u ? u.ownerDocument.defaultView.Element : Element)(s, g, f, a, r, e);
}
}),
/**
* A `function` child can be used instead of a React element. This function is
* called with the current transition status (`'entering'`, `'entered'`,
* `'exiting'`, `'exited'`), which can be used to apply context
* specific props to a component.
*
* ```jsx
* <Transition in={this.state.in} timeout={150}>
* {state => (
* <MyComponent className={`fade fade-${state}`} />
* )}
* </Transition>
* ```
*/
children: p.oneOfType([p.func.isRequired, p.element.isRequired]).isRequired,
/**
* Show the component; triggers the enter or exit states
*/
in: p.bool,
/**
* By default the child component is mounted immediately along with
* the parent `Transition` component. If you want to "lazy mount" the component on the
* first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
* mounted, even on "exited", unless you also specify `unmountOnExit`.
*/
mountOnEnter: p.bool,
/**
* By default the child component stays mounted after it reaches the `'exited'` state.
* Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
*/
unmountOnExit: p.bool,
/**
* By default the child component does not perform the enter transition when
* it first mounts, regardless of the value of `in`. If you want this
* behavior, set both `appear` and `in` to `true`.
*
* > **Note**: there are no special appear states like `appearing`/`appeared`, this prop
* > only adds an additional enter transition. However, in the
* > `<CSSTransition>` component that first enter transition does result in
* > additional `.appear-*` classes, that way you can choose to style it
* > differently.
*/
appear: p.bool,
/**
* Enable or disable enter transitions.
*/
enter: p.bool,
/**
* Enable or disable exit transitions.
*/
exit: p.bool,
/**
* The duration of the transition, in milliseconds.
* Required unless `addEndListener` is provided.
*
* You may specify a single timeout for all transitions:
*
* ```jsx
* timeout={500}
* ```
*
* or individually:
*
* ```jsx
* timeout={{
* appear: 500,
* enter: 300,
* exit: 500,
* }}
* ```
*
* - `appear` defaults to the value of `enter`
* - `enter` defaults to `0`
* - `exit` defaults to `0`
*
* @type {number | { enter?: number, exit?: number, appear?: number }}
*/
timeout: function(g) {
var f = Ge;
g.addEndListener || (f = f.isRequired);
for (var a = arguments.length, r = new Array(a > 1 ? a - 1 : 0), e = 1; e < a; e++)
r[e - 1] = arguments[e];
return f.apply(void 0, [g].concat(r));
},
/**
* Add a custom transition end trigger. Called with the transitioning
* DOM node and a `done` callback. Allows for more fine grained transition end
* logic. Timeouts are still used as a fallback if provided.
*
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
*
* ```jsx
* addEndListener={(node, done) => {
* // use the css transitionend event to mark the finish of a transition
* node.addEventListener('transitionend', done, false);
* }}
* ```
*/
addEndListener: p.func,
/**
* Callback fired before the "entering" status is applied. An extra parameter
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
*
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
*
* @type Function(node: HtmlElement, isAppearing: bool) -> void
*/
onEnter: p.func,
/**
* Callback fired after the "entering" status is applied. An extra parameter
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
*
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
*
* @type Function(node: HtmlElement, isAppearing: bool)
*/
onEntering: p.func,
/**
* Callback fired after the "entered" status is applied. An extra parameter
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
*
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
*
* @type Function(node: HtmlElement, isAppearing: bool) -> void
*/
onEntered: p.func,
/**
* Callback fired before the "exiting" status is applied.
*
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
*
* @type Function(node: HtmlElement) -> void
*/
onExit: p.func,
/**
* Callback fired after the "exiting" status is applied.
*
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
*
* @type Function(node: HtmlElement) -> void
*/
onExiting: p.func,
/**
* Callback fired after the "exited" status is applied.
*
* **Note**: when `nodeRef` prop is passed, `node` is not passed
*
* @type Function(node: HtmlElement) -> void
*/
onExited: p.func
} : {};
function X() {
}
W.defaultProps = {
in: !1,
mountOnEnter: !1,
unmountOnExit: !1,
appear: !1,
enter: !0,
exit: !0,
onEnter: X,
onEntering: X,
onEntered: X,
onExit: X,
onExiting: X,
onExited: X
};
W.UNMOUNTED = K;
W.EXITED = z;
W.ENTERING = G;
W.ENTERED = B;
W.EXITING = he;
const et = W;
export {
p as P,
Ne as _,
Ke as a,
Qe as b,
Ze as c,
Ve as f,
ze as p,
et as s
};