\n * )}\n * \n * );\n * ```\n *\n * There are 4 main states a Transition can be in:\n * - `'entering'`\n * - `'entered'`\n * - `'exiting'`\n * - `'exited'`\n *\n * Transition state is toggled via the `in` prop. When `true` the component\n * begins the \"Enter\" stage. During this stage, the component will shift from\n * its current transition state, to `'entering'` for the duration of the\n * transition and then to the `'entered'` stage once it's complete. Let's take\n * the following example (we'll use the\n * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):\n *\n * ```jsx\n * function App() {\n * const [inProp, setInProp] = useState(false);\n * return (\n *
\n * );\n * }\n * ```\n *\n * When the button is clicked the component will shift to the `'entering'` state\n * and stay there for 500ms (the value of `timeout`) before it finally switches\n * to `'entered'`.\n *\n * When `in` is `false` the same thing happens except the state moves from\n * `'exiting'` to `'exited'`.\n */\n\nvar Transition = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(Transition, _React$Component);\n function Transition(props, context) {\n var _this;\n _this = _React$Component.call(this, props, context) || this;\n var parentGroup = context; // In the context of a TransitionGroup all enters are really appears\n\n var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;\n var initialStatus;\n _this.appearStatus = null;\n if (props.in) {\n if (appear) {\n initialStatus = EXITED;\n _this.appearStatus = ENTERING;\n } else {\n initialStatus = ENTERED;\n }\n } else {\n if (props.unmountOnExit || props.mountOnEnter) {\n initialStatus = UNMOUNTED;\n } else {\n initialStatus = EXITED;\n }\n }\n _this.state = {\n status: initialStatus\n };\n _this.nextCallback = null;\n return _this;\n }\n Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {\n var nextIn = _ref.in;\n if (nextIn && prevState.status === UNMOUNTED) {\n return {\n status: EXITED\n };\n }\n return null;\n } // getSnapshotBeforeUpdate(prevProps) {\n // let nextStatus = null\n // if (prevProps !== this.props) {\n // const { status } = this.state\n // if (this.props.in) {\n // if (status !== ENTERING && status !== ENTERED) {\n // nextStatus = ENTERING\n // }\n // } else {\n // if (status === ENTERING || status === ENTERED) {\n // nextStatus = EXITING\n // }\n // }\n // }\n // return { nextStatus }\n // }\n ;\n\n var _proto = Transition.prototype;\n _proto.componentDidMount = function componentDidMount() {\n this.updateStatus(true, this.appearStatus);\n };\n _proto.componentDidUpdate = function componentDidUpdate(prevProps) {\n var nextStatus = null;\n if (prevProps !== this.props) {\n var status = this.state.status;\n if (this.props.in) {\n if (status !== ENTERING && status !== ENTERED) {\n nextStatus = ENTERING;\n }\n } else {\n if (status === ENTERING || status === ENTERED) {\n nextStatus = EXITING;\n }\n }\n }\n this.updateStatus(false, nextStatus);\n };\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.cancelNextCallback();\n };\n _proto.getTimeouts = function getTimeouts() {\n var timeout = this.props.timeout;\n var exit, enter, appear;\n exit = enter = appear = timeout;\n if (timeout != null && typeof timeout !== 'number') {\n exit = timeout.exit;\n enter = timeout.enter; // TODO: remove fallback for next major\n\n appear = timeout.appear !== undefined ? timeout.appear : enter;\n }\n return {\n exit: exit,\n enter: enter,\n appear: appear\n };\n };\n _proto.updateStatus = function updateStatus(mounting, nextStatus) {\n if (mounting === void 0) {\n mounting = false;\n }\n if (nextStatus !== null) {\n // nextStatus will always be ENTERING or EXITING.\n this.cancelNextCallback();\n if (nextStatus === ENTERING) {\n this.performEnter(mounting);\n } else {\n this.performExit();\n }\n } else if (this.props.unmountOnExit && this.state.status === EXITED) {\n this.setState({\n status: UNMOUNTED\n });\n }\n };\n _proto.performEnter = function performEnter(mounting) {\n var _this2 = this;\n var enter = this.props.enter;\n var appearing = this.context ? this.context.isMounting : mounting;\n var _ref2 = this.props.nodeRef ? [appearing] : [ReactDOM.findDOMNode(this), appearing],\n maybeNode = _ref2[0],\n maybeAppearing = _ref2[1];\n var timeouts = this.getTimeouts();\n var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED\n // if we are mounting and running this it means appear _must_ be set\n\n if (!mounting && !enter || config.disabled) {\n this.safeSetState({\n status: ENTERED\n }, function () {\n _this2.props.onEntered(maybeNode);\n });\n return;\n }\n this.props.onEnter(maybeNode, maybeAppearing);\n this.safeSetState({\n status: ENTERING\n }, function () {\n _this2.props.onEntering(maybeNode, maybeAppearing);\n _this2.onTransitionEnd(enterTimeout, function () {\n _this2.safeSetState({\n status: ENTERED\n }, function () {\n _this2.props.onEntered(maybeNode, maybeAppearing);\n });\n });\n });\n };\n _proto.performExit = function performExit() {\n var _this3 = this;\n var exit = this.props.exit;\n var timeouts = this.getTimeouts();\n var maybeNode = this.props.nodeRef ? undefined : ReactDOM.findDOMNode(this); // no exit animation skip right to EXITED\n\n if (!exit || config.disabled) {\n this.safeSetState({\n status: EXITED\n }, function () {\n _this3.props.onExited(maybeNode);\n });\n return;\n }\n this.props.onExit(maybeNode);\n this.safeSetState({\n status: EXITING\n }, function () {\n _this3.props.onExiting(maybeNode);\n _this3.onTransitionEnd(timeouts.exit, function () {\n _this3.safeSetState({\n status: EXITED\n }, function () {\n _this3.props.onExited(maybeNode);\n });\n });\n });\n };\n _proto.cancelNextCallback = function cancelNextCallback() {\n if (this.nextCallback !== null) {\n this.nextCallback.cancel();\n this.nextCallback = null;\n }\n };\n _proto.safeSetState = function safeSetState(nextState, callback) {\n // This shouldn't be necessary, but there are weird race conditions with\n // setState callbacks and unmounting in testing, so always make sure that\n // we can cancel any pending setState callbacks after we unmount.\n callback = this.setNextCallback(callback);\n this.setState(nextState, callback);\n };\n _proto.setNextCallback = function setNextCallback(callback) {\n var _this4 = this;\n var active = true;\n this.nextCallback = function (event) {\n if (active) {\n active = false;\n _this4.nextCallback = null;\n callback(event);\n }\n };\n this.nextCallback.cancel = function () {\n active = false;\n };\n return this.nextCallback;\n };\n _proto.onTransitionEnd = function onTransitionEnd(timeout, handler) {\n this.setNextCallback(handler);\n var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this);\n var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;\n if (!node || doesNotHaveTimeoutOrListener) {\n setTimeout(this.nextCallback, 0);\n return;\n }\n if (this.props.addEndListener) {\n var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback],\n maybeNode = _ref3[0],\n maybeNextCallback = _ref3[1];\n this.props.addEndListener(maybeNode, maybeNextCallback);\n }\n if (timeout != null) {\n setTimeout(this.nextCallback, timeout);\n }\n };\n _proto.render = function render() {\n var status = this.state.status;\n if (status === UNMOUNTED) {\n return null;\n }\n var _this$props = this.props,\n children = _this$props.children,\n _in = _this$props.in,\n _mountOnEnter = _this$props.mountOnEnter,\n _unmountOnExit = _this$props.unmountOnExit,\n _appear = _this$props.appear,\n _enter = _this$props.enter,\n _exit = _this$props.exit,\n _timeout = _this$props.timeout,\n _addEndListener = _this$props.addEndListener,\n _onEnter = _this$props.onEnter,\n _onEntering = _this$props.onEntering,\n _onEntered = _this$props.onEntered,\n _onExit = _this$props.onExit,\n _onExiting = _this$props.onExiting,\n _onExited = _this$props.onExited,\n _nodeRef = _this$props.nodeRef,\n childProps = _objectWithoutPropertiesLoose(_this$props, [\"children\", \"in\", \"mountOnEnter\", \"unmountOnExit\", \"appear\", \"enter\", \"exit\", \"timeout\", \"addEndListener\", \"onEnter\", \"onEntering\", \"onEntered\", \"onExit\", \"onExiting\", \"onExited\", \"nodeRef\"]);\n return /*#__PURE__*/(\n // allows for nested Transitions\n React.createElement(TransitionGroupContext.Provider, {\n value: null\n }, typeof children === 'function' ? children(status, childProps) : React.cloneElement(React.Children.only(children), childProps))\n );\n };\n return Transition;\n}(React.Component);\nTransition.contextType = TransitionGroupContext;\nTransition.propTypes = process.env.NODE_ENV !== \"production\" ? {\n /**\n * A React reference to DOM element that need to transition:\n * https://stackoverflow.com/a/51127130/4671932\n *\n * - When `nodeRef` prop is used, `node` is not passed to callback functions\n * (e.g. `onEnter`) because user already has direct access to the node.\n * - When changing `key` prop of `Transition` in a `TransitionGroup` a new\n * `nodeRef` need to be provided to `Transition` with changed `key` prop\n * (see\n * [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).\n */\n nodeRef: PropTypes.shape({\n current: typeof Element === 'undefined' ? PropTypes.any : function (propValue, key, componentName, location, propFullName, secret) {\n var value = propValue[key];\n return PropTypes.instanceOf(value && 'ownerDocument' in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret);\n }\n }),\n /**\n * A `function` child can be used instead of a React element. This function is\n * called with the current transition status (`'entering'`, `'entered'`,\n * `'exiting'`, `'exited'`), which can be used to apply context\n * specific props to a component.\n *\n * ```jsx\n * \n * {state => (\n * \n * )}\n * \n * ```\n */\n children: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.element.isRequired]).isRequired,\n /**\n * Show the component; triggers the enter or exit states\n */\n in: PropTypes.bool,\n /**\n * By default the child component is mounted immediately along with\n * the parent `Transition` component. If you want to \"lazy mount\" the component on the\n * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay\n * mounted, even on \"exited\", unless you also specify `unmountOnExit`.\n */\n mountOnEnter: PropTypes.bool,\n /**\n * By default the child component stays mounted after it reaches the `'exited'` state.\n * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.\n */\n unmountOnExit: PropTypes.bool,\n /**\n * By default the child component does not perform the enter transition when\n * it first mounts, regardless of the value of `in`. If you want this\n * behavior, set both `appear` and `in` to `true`.\n *\n * > **Note**: there are no special appear states like `appearing`/`appeared`, this prop\n * > only adds an additional enter transition. However, in the\n * > `` component that first enter transition does result in\n * > additional `.appear-*` classes, that way you can choose to style it\n * > differently.\n */\n appear: PropTypes.bool,\n /**\n * Enable or disable enter transitions.\n */\n enter: PropTypes.bool,\n /**\n * Enable or disable exit transitions.\n */\n exit: PropTypes.bool,\n /**\n * The duration of the transition, in milliseconds.\n * Required unless `addEndListener` is provided.\n *\n * You may specify a single timeout for all transitions:\n *\n * ```jsx\n * timeout={500}\n * ```\n *\n * or individually:\n *\n * ```jsx\n * timeout={{\n * appear: 500,\n * enter: 300,\n * exit: 500,\n * }}\n * ```\n *\n * - `appear` defaults to the value of `enter`\n * - `enter` defaults to `0`\n * - `exit` defaults to `0`\n *\n * @type {number | { enter?: number, exit?: number, appear?: number }}\n */\n timeout: function timeout(props) {\n var pt = timeoutsShape;\n if (!props.addEndListener) pt = pt.isRequired;\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n return pt.apply(void 0, [props].concat(args));\n },\n /**\n * Add a custom transition end trigger. Called with the transitioning\n * DOM node and a `done` callback. Allows for more fine grained transition end\n * logic. Timeouts are still used as a fallback if provided.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * ```jsx\n * addEndListener={(node, done) => {\n * // use the css transitionend event to mark the finish of a transition\n * node.addEventListener('transitionend', done, false);\n * }}\n * ```\n */\n addEndListener: PropTypes.func,\n /**\n * Callback fired before the \"entering\" status is applied. An extra parameter\n * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement, isAppearing: bool) -> void\n */\n onEnter: PropTypes.func,\n /**\n * Callback fired after the \"entering\" status is applied. An extra parameter\n * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement, isAppearing: bool)\n */\n onEntering: PropTypes.func,\n /**\n * Callback fired after the \"entered\" status is applied. An extra parameter\n * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement, isAppearing: bool) -> void\n */\n onEntered: PropTypes.func,\n /**\n * Callback fired before the \"exiting\" status is applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement) -> void\n */\n onExit: PropTypes.func,\n /**\n * Callback fired after the \"exiting\" status is applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed.\n *\n * @type Function(node: HtmlElement) -> void\n */\n onExiting: PropTypes.func,\n /**\n * Callback fired after the \"exited\" status is applied.\n *\n * **Note**: when `nodeRef` prop is passed, `node` is not passed\n *\n * @type Function(node: HtmlElement) -> void\n */\n onExited: PropTypes.func\n} : {}; // Name the function so it is clearer in the documentation\n\nfunction noop() {}\nTransition.defaultProps = {\n in: false,\n mountOnEnter: false,\n unmountOnExit: false,\n appear: false,\n enter: true,\n exit: true,\n onEnter: noop,\n onEntering: noop,\n onEntered: noop,\n onExit: noop,\n onExiting: noop,\n onExited: noop\n};\nTransition.UNMOUNTED = UNMOUNTED;\nTransition.EXITED = EXITED;\nTransition.ENTERING = ENTERING;\nTransition.ENTERED = ENTERED;\nTransition.EXITING = EXITING;\nexport default Transition;","import { Children, cloneElement, isValidElement } from 'react';\n/**\n * Given `this.props.children`, return an object mapping key to child.\n *\n * @param {*} children `this.props.children`\n * @return {object} Mapping of key to child\n */\n\nexport function getChildMapping(children, mapFn) {\n var mapper = function mapper(child) {\n return mapFn && isValidElement(child) ? mapFn(child) : child;\n };\n var result = Object.create(null);\n if (children) Children.map(children, function (c) {\n return c;\n }).forEach(function (child) {\n // run the map function here instead so that the key is the computed one\n result[child.key] = mapper(child);\n });\n return result;\n}\n/**\n * When you're adding or removing children some may be added or removed in the\n * same render pass. We want to show *both* since we want to simultaneously\n * animate elements in and out. This function takes a previous set of keys\n * and a new set of keys and merges them with its best guess of the correct\n * ordering. In the future we may expose some of the utilities in\n * ReactMultiChild to make this easy, but for now React itself does not\n * directly have this concept of the union of prevChildren and nextChildren\n * so we implement it here.\n *\n * @param {object} prev prev children as returned from\n * `ReactTransitionChildMapping.getChildMapping()`.\n * @param {object} next next children as returned from\n * `ReactTransitionChildMapping.getChildMapping()`.\n * @return {object} a key set that contains all keys in `prev` and all keys\n * in `next` in a reasonable order.\n */\n\nexport function mergeChildMappings(prev, next) {\n prev = prev || {};\n next = next || {};\n function getValueForKey(key) {\n return key in next ? next[key] : prev[key];\n } // For each key of `next`, the list of keys to insert before that key in\n // the combined list\n\n var nextKeysPending = Object.create(null);\n var pendingKeys = [];\n for (var prevKey in prev) {\n if (prevKey in next) {\n if (pendingKeys.length) {\n nextKeysPending[prevKey] = pendingKeys;\n pendingKeys = [];\n }\n } else {\n pendingKeys.push(prevKey);\n }\n }\n var i;\n var childMapping = {};\n for (var nextKey in next) {\n if (nextKeysPending[nextKey]) {\n for (i = 0; i < nextKeysPending[nextKey].length; i++) {\n var pendingNextKey = nextKeysPending[nextKey][i];\n childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);\n }\n }\n childMapping[nextKey] = getValueForKey(nextKey);\n } // Finally, add the keys which didn't appear before any key in `next`\n\n for (i = 0; i < pendingKeys.length; i++) {\n childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);\n }\n return childMapping;\n}\nfunction getProp(child, prop, props) {\n return props[prop] != null ? props[prop] : child.props[prop];\n}\nexport function getInitialChildMapping(props, onExited) {\n return getChildMapping(props.children, function (child) {\n return cloneElement(child, {\n onExited: onExited.bind(null, child),\n in: true,\n appear: getProp(child, 'appear', props),\n enter: getProp(child, 'enter', props),\n exit: getProp(child, 'exit', props)\n });\n });\n}\nexport function getNextChildMapping(nextProps, prevChildMapping, onExited) {\n var nextChildMapping = getChildMapping(nextProps.children);\n var children = mergeChildMappings(prevChildMapping, nextChildMapping);\n Object.keys(children).forEach(function (key) {\n var child = children[key];\n if (!isValidElement(child)) return;\n var hasPrev = (key in prevChildMapping);\n var hasNext = (key in nextChildMapping);\n var prevChild = prevChildMapping[key];\n var isLeaving = isValidElement(prevChild) && !prevChild.props.in; // item is new (entering)\n\n if (hasNext && (!hasPrev || isLeaving)) {\n // console.log('entering', key)\n children[key] = cloneElement(child, {\n onExited: onExited.bind(null, child),\n in: true,\n exit: getProp(child, 'exit', nextProps),\n enter: getProp(child, 'enter', nextProps)\n });\n } else if (!hasNext && hasPrev && !isLeaving) {\n // item is old (exiting)\n // console.log('leaving', key)\n children[key] = cloneElement(child, {\n in: false\n });\n } else if (hasNext && hasPrev && isValidElement(prevChild)) {\n // item hasn't changed transition states\n // copy over the last transition props;\n // console.log('unchanged', key)\n children[key] = cloneElement(child, {\n onExited: onExited.bind(null, child),\n in: prevChild.props.in,\n exit: getProp(child, 'exit', nextProps),\n enter: getProp(child, 'enter', nextProps)\n });\n }\n });\n return children;\n}","import _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport TransitionGroupContext from './TransitionGroupContext';\nimport { getChildMapping, getInitialChildMapping, getNextChildMapping } from './utils/ChildMapping';\nvar values = Object.values || function (obj) {\n return Object.keys(obj).map(function (k) {\n return obj[k];\n });\n};\nvar defaultProps = {\n component: 'div',\n childFactory: function childFactory(child) {\n return child;\n }\n};\n/**\n * The `` component manages a set of transition components\n * (`` and ``) in a list. Like with the transition\n * components, `` is a state machine for managing the mounting\n * and unmounting of components over time.\n *\n * Consider the example below. As items are removed or added to the TodoList the\n * `in` prop is toggled automatically by the ``.\n *\n * Note that `` does not define any animation behavior!\n * Exactly _how_ a list item animates is up to the individual transition\n * component. This means you can mix and match animations across different list\n * items.\n */\n\nvar TransitionGroup = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(TransitionGroup, _React$Component);\n function TransitionGroup(props, context) {\n var _this;\n _this = _React$Component.call(this, props, context) || this;\n var handleExited = _this.handleExited.bind(_assertThisInitialized(_this)); // Initial children should all be entering, dependent on appear\n\n _this.state = {\n contextValue: {\n isMounting: true\n },\n handleExited: handleExited,\n firstRender: true\n };\n return _this;\n }\n var _proto = TransitionGroup.prototype;\n _proto.componentDidMount = function componentDidMount() {\n this.mounted = true;\n this.setState({\n contextValue: {\n isMounting: false\n }\n });\n };\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.mounted = false;\n };\n TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {\n var prevChildMapping = _ref.children,\n handleExited = _ref.handleExited,\n firstRender = _ref.firstRender;\n return {\n children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),\n firstRender: false\n };\n } // node is `undefined` when user provided `nodeRef` prop\n ;\n\n _proto.handleExited = function handleExited(child, node) {\n var currentChildMapping = getChildMapping(this.props.children);\n if (child.key in currentChildMapping) return;\n if (child.props.onExited) {\n child.props.onExited(node);\n }\n if (this.mounted) {\n this.setState(function (state) {\n var children = _extends({}, state.children);\n delete children[child.key];\n return {\n children: children\n };\n });\n }\n };\n _proto.render = function render() {\n var _this$props = this.props,\n Component = _this$props.component,\n childFactory = _this$props.childFactory,\n props = _objectWithoutPropertiesLoose(_this$props, [\"component\", \"childFactory\"]);\n var contextValue = this.state.contextValue;\n var children = values(this.state.children).map(childFactory);\n delete props.appear;\n delete props.enter;\n delete props.exit;\n if (Component === null) {\n return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, {\n value: contextValue\n }, children);\n }\n return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, {\n value: contextValue\n }, /*#__PURE__*/React.createElement(Component, props, children));\n };\n return TransitionGroup;\n}(React.Component);\nTransitionGroup.propTypes = process.env.NODE_ENV !== \"production\" ? {\n /**\n * `` renders a `
` by default. You can change this\n * behavior by providing a `component` prop.\n * If you use React v16+ and would like to avoid a wrapping `
` element\n * you can pass in `component={null}`. This is useful if the wrapping div\n * borks your css styles.\n */\n component: PropTypes.any,\n /**\n * A set of `` components, that are toggled `in` and out as they\n * leave. the `` will inject specific transition props, so\n * remember to spread them through if you are wrapping the `` as\n * with our `` example.\n *\n * While this component is meant for multiple `Transition` or `CSSTransition`\n * children, sometimes you may want to have a single transition child with\n * content that you want to be transitioned out and in when you change it\n * (e.g. routes, images etc.) In that case you can change the `key` prop of\n * the transition child as you change its content, this will cause\n * `TransitionGroup` to transition the child out and back in.\n */\n children: PropTypes.node,\n /**\n * A convenience prop that enables or disables appear animations\n * for all children. Note that specifying this will override any defaults set\n * on individual children Transitions.\n */\n appear: PropTypes.bool,\n /**\n * A convenience prop that enables or disables enter animations\n * for all children. Note that specifying this will override any defaults set\n * on individual children Transitions.\n */\n enter: PropTypes.bool,\n /**\n * A convenience prop that enables or disables exit animations\n * for all children. Note that specifying this will override any defaults set\n * on individual children Transitions.\n */\n exit: PropTypes.bool,\n /**\n * You may need to apply reactive updates to a child as it is exiting.\n * This is generally done by using `cloneElement` however in the case of an exiting\n * child the element has already been removed and not accessible to the consumer.\n *\n * If you do need to update a child as it leaves you can provide a `childFactory`\n * to wrap every child, even the ones that are leaving.\n *\n * @type Function(child: ReactElement) -> ReactElement\n */\n childFactory: PropTypes.func\n} : {};\nTransitionGroup.defaultProps = defaultProps;\nexport default TransitionGroup;","import _extends from '@babel/runtime/helpers/esm/extends';\nimport _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose';\nimport _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';\nimport React, { Component, isValidElement, cloneElement } from 'react';\nimport PropTypes from 'prop-types';\nimport cx from 'classnames';\nimport { Transition, TransitionGroup } from 'react-transition-group';\nimport { render } from 'react-dom';\nvar POSITION = {\n TOP_LEFT: 'top-left',\n TOP_RIGHT: 'top-right',\n TOP_CENTER: 'top-center',\n BOTTOM_LEFT: 'bottom-left',\n BOTTOM_RIGHT: 'bottom-right',\n BOTTOM_CENTER: 'bottom-center'\n};\nvar TYPE = {\n INFO: 'info',\n SUCCESS: 'success',\n WARNING: 'warning',\n ERROR: 'error',\n DEFAULT: 'default'\n};\nvar ACTION = {\n SHOW: 0,\n CLEAR: 1,\n DID_MOUNT: 2,\n WILL_UNMOUNT: 3,\n ON_CHANGE: 4\n};\nvar NOOP = function NOOP() {};\nvar RT_NAMESPACE = 'Toastify';\nfunction isValidDelay(val) {\n return typeof val === 'number' && !isNaN(val) && val > 0;\n}\nfunction objectValues(obj) {\n return Object.keys(obj).map(function (key) {\n return obj[key];\n });\n}\nvar canUseDom = !!(typeof window !== 'undefined' && window.document && window.document.createElement);\nfunction withRequired(fn) {\n fn.isRequired = function (props, propName, componentName) {\n var prop = props[propName];\n if (typeof prop === 'undefined') {\n return new Error(\"The prop \" + propName + \" is marked as required in \\n \" + componentName + \", but its value is undefined.\");\n }\n fn(props, propName, componentName);\n };\n return fn;\n}\nvar falseOrDelay = withRequired(function (props, propName, componentName) {\n var prop = props[propName];\n if (prop !== false && !isValidDelay(prop)) {\n return new Error(componentName + \" expect \" + propName + \" \\n to be a valid Number > 0 or equal to false. \" + prop + \" given.\");\n }\n return null;\n});\nvar eventManager = {\n list: new Map(),\n emitQueue: new Map(),\n on: function on(event, callback) {\n this.list.has(event) || this.list.set(event, []);\n this.list.get(event).push(callback);\n return this;\n },\n off: function off(event) {\n this.list.delete(event);\n return this;\n },\n cancelEmit: function cancelEmit(event) {\n var timers = this.emitQueue.get(event);\n if (timers) {\n timers.forEach(function (timer) {\n return clearTimeout(timer);\n });\n this.emitQueue.delete(event);\n }\n return this;\n },\n /**\n * Enqueue the event at the end of the call stack\n * Doing so let the user call toast as follow:\n * toast('1')\n * toast('2')\n * toast('3')\n * Without setTimemout the code above will not work\n */\n emit: function emit(event) {\n var _this = this;\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n this.list.has(event) && this.list.get(event).forEach(function (callback) {\n var timer = setTimeout(function () {\n callback.apply(void 0, args);\n }, 0);\n _this.emitQueue.has(event) || _this.emitQueue.set(event, []);\n _this.emitQueue.get(event).push(timer);\n });\n }\n};\nfunction cssTransition(_ref) {\n var enter = _ref.enter,\n exit = _ref.exit,\n _ref$duration = _ref.duration,\n duration = _ref$duration === void 0 ? 750 : _ref$duration,\n _ref$appendPosition = _ref.appendPosition,\n appendPosition = _ref$appendPosition === void 0 ? false : _ref$appendPosition;\n return function Animation(_ref2) {\n var children = _ref2.children,\n position = _ref2.position,\n preventExitTransition = _ref2.preventExitTransition,\n props = _objectWithoutPropertiesLoose(_ref2, [\"children\", \"position\", \"preventExitTransition\"]);\n var enterClassName = appendPosition ? enter + \"--\" + position : enter;\n var exitClassName = appendPosition ? exit + \"--\" + position : exit;\n var enterDuration, exitDuration;\n if (Array.isArray(duration) && duration.length === 2) {\n enterDuration = duration[0];\n exitDuration = duration[1];\n } else {\n enterDuration = exitDuration = duration;\n }\n var onEnter = function onEnter(node) {\n node.classList.add(enterClassName);\n node.style.animationFillMode = 'forwards';\n node.style.animationDuration = enterDuration * 0.001 + \"s\";\n };\n var onEntered = function onEntered(node) {\n node.classList.remove(enterClassName);\n node.style.cssText = '';\n };\n var onExit = function onExit(node) {\n node.classList.add(exitClassName);\n node.style.animationFillMode = 'forwards';\n node.style.animationDuration = exitDuration * 0.001 + \"s\";\n };\n return React.createElement(Transition, _extends({}, props, {\n timeout: preventExitTransition ? 0 : {\n enter: enterDuration,\n exit: exitDuration\n },\n onEnter: onEnter,\n onEntered: onEntered,\n onExit: preventExitTransition ? NOOP : onExit\n }), children);\n };\n}\nfunction ProgressBar(_ref) {\n var _cx, _animationEvent;\n var delay = _ref.delay,\n isRunning = _ref.isRunning,\n closeToast = _ref.closeToast,\n type = _ref.type,\n hide = _ref.hide,\n className = _ref.className,\n userStyle = _ref.style,\n controlledProgress = _ref.controlledProgress,\n progress = _ref.progress,\n rtl = _ref.rtl;\n var style = _extends({}, userStyle, {\n animationDuration: delay + \"ms\",\n animationPlayState: isRunning ? 'running' : 'paused',\n opacity: hide ? 0 : 1,\n transform: controlledProgress ? \"scaleX(\" + progress + \")\" : null\n });\n var classNames = cx(RT_NAMESPACE + \"__progress-bar\", controlledProgress ? RT_NAMESPACE + \"__progress-bar--controlled\" : RT_NAMESPACE + \"__progress-bar--animated\", RT_NAMESPACE + \"__progress-bar--\" + type, (_cx = {}, _cx[RT_NAMESPACE + \"__progress-bar--rtl\"] = rtl, _cx), className);\n var animationEvent = (_animationEvent = {}, _animationEvent[controlledProgress && progress >= 1 ? 'onTransitionEnd' : 'onAnimationEnd'] = controlledProgress && progress < 1 ? null : closeToast, _animationEvent);\n return React.createElement(\"div\", _extends({\n className: classNames,\n style: style\n }, animationEvent));\n}\nProgressBar.propTypes = {\n /**\n * The animation delay which determine when to close the toast\n */\n delay: falseOrDelay.isRequired,\n /**\n * Whether or not the animation is running or paused\n */\n isRunning: PropTypes.bool.isRequired,\n /**\n * Func to close the current toast\n */\n closeToast: PropTypes.func.isRequired,\n /**\n * Support rtl content\n */\n rtl: PropTypes.bool.isRequired,\n /**\n * Optional type : info, success ...\n */\n type: PropTypes.string,\n /**\n * Hide or not the progress bar\n */\n hide: PropTypes.bool,\n /**\n * Optionnal className\n */\n className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n /**\n * Controlled progress value\n */\n progress: PropTypes.number,\n /**\n * Tell wether or not controlled progress bar is used\n */\n controlledProgress: PropTypes.bool\n};\nProgressBar.defaultProps = {\n type: TYPE.DEFAULT,\n hide: false\n};\nfunction getX(e) {\n return e.targetTouches && e.targetTouches.length >= 1 ? e.targetTouches[0].clientX : e.clientX;\n}\nfunction getY(e) {\n return e.targetTouches && e.targetTouches.length >= 1 ? e.targetTouches[0].clientY : e.clientY;\n}\nvar iLoveInternetExplorer = canUseDom && /(msie|trident)/i.test(navigator.userAgent);\nvar Toast = /*#__PURE__*/\nfunction (_Component) {\n _inheritsLoose(Toast, _Component);\n function Toast() {\n var _this;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _Component.call.apply(_Component, [this].concat(args)) || this;\n _this.state = {\n isRunning: true,\n preventExitTransition: false\n };\n _this.flag = {\n canCloseOnClick: true,\n canDrag: false\n };\n _this.drag = {\n start: 0,\n x: 0,\n y: 0,\n deltaX: 0,\n removalDistance: 0\n };\n _this.boundingRect = null;\n _this.ref = null;\n _this.pauseToast = function () {\n if (_this.props.autoClose) {\n _this.setState({\n isRunning: false\n });\n }\n };\n _this.playToast = function () {\n if (_this.props.autoClose) {\n _this.setState({\n isRunning: true\n });\n }\n };\n _this.onDragStart = function (e) {\n _this.flag.canCloseOnClick = true;\n _this.flag.canDrag = true;\n _this.boundingRect = _this.ref.getBoundingClientRect();\n _this.ref.style.transition = '';\n _this.drag.start = _this.drag.x = getX(e.nativeEvent);\n _this.drag.removalDistance = _this.ref.offsetWidth * (_this.props.draggablePercent / 100);\n };\n _this.onDragMove = function (e) {\n if (_this.flag.canDrag) {\n if (_this.state.isRunning) {\n _this.pauseToast();\n }\n _this.drag.x = getX(e);\n _this.drag.deltaX = _this.drag.x - _this.drag.start;\n _this.drag.y = getY(e); // prevent false positif during a toast click\n\n _this.drag.start !== _this.drag.x && (_this.flag.canCloseOnClick = false);\n _this.ref.style.transform = \"translateX(\" + _this.drag.deltaX + \"px)\";\n _this.ref.style.opacity = 1 - Math.abs(_this.drag.deltaX / _this.drag.removalDistance);\n }\n };\n _this.onDragEnd = function (e) {\n if (_this.flag.canDrag) {\n _this.flag.canDrag = false;\n if (Math.abs(_this.drag.deltaX) > _this.drag.removalDistance) {\n _this.setState({\n preventExitTransition: true\n }, _this.props.closeToast);\n return;\n }\n _this.ref.style.transition = 'transform 0.2s, opacity 0.2s';\n _this.ref.style.transform = 'translateX(0)';\n _this.ref.style.opacity = 1;\n }\n };\n _this.onDragTransitionEnd = function () {\n if (_this.boundingRect) {\n var _this$boundingRect = _this.boundingRect,\n top = _this$boundingRect.top,\n bottom = _this$boundingRect.bottom,\n left = _this$boundingRect.left,\n right = _this$boundingRect.right;\n if (_this.props.pauseOnHover && _this.drag.x >= left && _this.drag.x <= right && _this.drag.y >= top && _this.drag.y <= bottom) {\n _this.pauseToast();\n } else {\n _this.playToast();\n }\n }\n };\n _this.onExitTransitionEnd = function () {\n if (iLoveInternetExplorer) {\n _this.props.onExited();\n return;\n }\n var height = _this.ref.scrollHeight;\n var style = _this.ref.style;\n requestAnimationFrame(function () {\n style.minHeight = 'initial';\n style.height = height + 'px';\n style.transition = 'all 0.4s ';\n requestAnimationFrame(function () {\n style.height = 0;\n style.padding = 0;\n style.margin = 0;\n });\n setTimeout(function () {\n return _this.props.onExited();\n }, 400);\n });\n };\n return _this;\n }\n var _proto = Toast.prototype;\n _proto.componentDidMount = function componentDidMount() {\n this.props.onOpen(this.props.children.props);\n if (this.props.draggable) {\n this.bindDragEvents();\n } // Maybe I could bind the event in the ToastContainer and rely on delegation\n\n if (this.props.pauseOnFocusLoss) {\n this.bindFocusEvents();\n }\n };\n _proto.componentDidUpdate = function componentDidUpdate(prevProps) {\n if (prevProps.draggable !== this.props.draggable) {\n if (this.props.draggable) {\n this.bindDragEvents();\n } else {\n this.unbindDragEvents();\n }\n }\n if (prevProps.pauseOnFocusLoss !== this.props.pauseOnFocusLoss) {\n if (this.props.pauseOnFocusLoss) {\n this.bindFocusEvents();\n } else {\n this.unbindFocusEvents();\n }\n }\n };\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.props.onClose(this.props.children.props);\n if (this.props.draggable) {\n this.unbindDragEvents();\n }\n if (this.props.pauseOnFocusLoss) {\n this.unbindFocusEvents();\n }\n };\n _proto.bindFocusEvents = function bindFocusEvents() {\n window.addEventListener('focus', this.playToast);\n window.addEventListener('blur', this.pauseToast);\n };\n _proto.unbindFocusEvents = function unbindFocusEvents() {\n window.removeEventListener('focus', this.playToast);\n window.removeEventListener('blur', this.pauseToast);\n };\n _proto.bindDragEvents = function bindDragEvents() {\n document.addEventListener('mousemove', this.onDragMove);\n document.addEventListener('mouseup', this.onDragEnd);\n document.addEventListener('touchmove', this.onDragMove);\n document.addEventListener('touchend', this.onDragEnd);\n };\n _proto.unbindDragEvents = function unbindDragEvents() {\n document.removeEventListener('mousemove', this.onDragMove);\n document.removeEventListener('mouseup', this.onDragEnd);\n document.removeEventListener('touchmove', this.onDragMove);\n document.removeEventListener('touchend', this.onDragEnd);\n };\n _proto.render = function render() {\n var _cx,\n _this2 = this;\n var _this$props = this.props,\n closeButton = _this$props.closeButton,\n children = _this$props.children,\n autoClose = _this$props.autoClose,\n pauseOnHover = _this$props.pauseOnHover,\n onClick = _this$props.onClick,\n closeOnClick = _this$props.closeOnClick,\n type = _this$props.type,\n hideProgressBar = _this$props.hideProgressBar,\n closeToast = _this$props.closeToast,\n Transition = _this$props.transition,\n position = _this$props.position,\n className = _this$props.className,\n bodyClassName = _this$props.bodyClassName,\n progressClassName = _this$props.progressClassName,\n progressStyle = _this$props.progressStyle,\n updateId = _this$props.updateId,\n role = _this$props.role,\n progress = _this$props.progress,\n rtl = _this$props.rtl;\n var toastProps = {\n className: cx(RT_NAMESPACE + \"__toast\", RT_NAMESPACE + \"__toast--\" + type, (_cx = {}, _cx[RT_NAMESPACE + \"__toast--rtl\"] = rtl, _cx), className)\n };\n if (autoClose && pauseOnHover) {\n toastProps.onMouseEnter = this.pauseToast;\n toastProps.onMouseLeave = this.playToast;\n } // prevent toast from closing when user drags the toast\n\n if (closeOnClick) {\n toastProps.onClick = function (e) {\n onClick && onClick(e);\n _this2.flag.canCloseOnClick && closeToast();\n };\n }\n var controlledProgress = parseFloat(progress) === progress;\n return React.createElement(Transition, {\n in: this.props.in,\n appear: true,\n onExited: this.onExitTransitionEnd,\n position: position,\n preventExitTransition: this.state.preventExitTransition\n }, React.createElement(\"div\", _extends({\n onClick: onClick\n }, toastProps, {\n ref: function ref(_ref) {\n return _this2.ref = _ref;\n },\n onMouseDown: this.onDragStart,\n onTouchStart: this.onDragStart,\n onMouseUp: this.onDragTransitionEnd,\n onTouchEnd: this.onDragTransitionEnd\n }), React.createElement(\"div\", _extends({}, this.props.in && {\n role: role\n }, {\n className: cx(RT_NAMESPACE + \"__toast-body\", bodyClassName)\n }), children), closeButton && closeButton, (autoClose || controlledProgress) && React.createElement(ProgressBar, _extends({}, updateId && !controlledProgress ? {\n key: \"pb-\" + updateId\n } : {}, {\n rtl: rtl,\n delay: autoClose,\n isRunning: this.state.isRunning,\n closeToast: closeToast,\n hide: hideProgressBar,\n type: type,\n style: progressStyle,\n className: progressClassName,\n controlledProgress: controlledProgress,\n progress: progress\n }))));\n };\n return Toast;\n}(Component);\nToast.propTypes = {\n closeButton: PropTypes.oneOfType([PropTypes.node, PropTypes.bool]).isRequired,\n autoClose: falseOrDelay.isRequired,\n children: PropTypes.node.isRequired,\n closeToast: PropTypes.func.isRequired,\n position: PropTypes.oneOf(objectValues(POSITION)).isRequired,\n pauseOnHover: PropTypes.bool.isRequired,\n pauseOnFocusLoss: PropTypes.bool.isRequired,\n closeOnClick: PropTypes.bool.isRequired,\n transition: PropTypes.func.isRequired,\n rtl: PropTypes.bool.isRequired,\n hideProgressBar: PropTypes.bool.isRequired,\n draggable: PropTypes.bool.isRequired,\n draggablePercent: PropTypes.number.isRequired,\n in: PropTypes.bool,\n onExited: PropTypes.func,\n onOpen: PropTypes.func,\n onClose: PropTypes.func,\n type: PropTypes.oneOf(objectValues(TYPE)),\n className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n bodyClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n progressClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n progressStyle: PropTypes.object,\n progress: PropTypes.number,\n updateId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n ariaLabel: PropTypes.string,\n containerId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n role: PropTypes.string\n};\nToast.defaultProps = {\n type: TYPE.DEFAULT,\n in: true,\n onOpen: NOOP,\n onClose: NOOP,\n className: null,\n bodyClassName: null,\n progressClassName: null,\n updateId: null\n};\nfunction CloseButton(_ref) {\n var closeToast = _ref.closeToast,\n type = _ref.type,\n ariaLabel = _ref.ariaLabel;\n return React.createElement(\"button\", {\n className: RT_NAMESPACE + \"__close-button \" + RT_NAMESPACE + \"__close-button--\" + type,\n type: \"button\",\n onClick: function onClick(e) {\n e.stopPropagation();\n closeToast(e);\n },\n \"aria-label\": ariaLabel\n }, \"\\u2716\\uFE0E\");\n}\nCloseButton.propTypes = {\n closeToast: PropTypes.func,\n arialLabel: PropTypes.string\n};\nCloseButton.defaultProps = {\n ariaLabel: 'close'\n};\nvar Bounce = cssTransition({\n enter: RT_NAMESPACE + \"__bounce-enter\",\n exit: RT_NAMESPACE + \"__bounce-exit\",\n appendPosition: true\n});\nvar Slide = cssTransition({\n enter: RT_NAMESPACE + \"__slide-enter\",\n exit: RT_NAMESPACE + \"__slide-exit\",\n duration: [450, 750],\n appendPosition: true\n});\nvar Zoom = cssTransition({\n enter: RT_NAMESPACE + \"__zoom-enter\",\n exit: RT_NAMESPACE + \"__zoom-exit\"\n});\nvar Flip = cssTransition({\n enter: RT_NAMESPACE + \"__flip-enter\",\n exit: RT_NAMESPACE + \"__flip-exit\"\n});\nvar ToastContainer = /*#__PURE__*/\nfunction (_Component) {\n _inheritsLoose(ToastContainer, _Component);\n function ToastContainer() {\n var _this;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _Component.call.apply(_Component, [this].concat(args)) || this;\n _this.state = {\n toast: []\n };\n _this.toastKey = 1;\n _this.collection = {};\n _this.isToastActive = function (id) {\n return _this.state.toast.indexOf(id) !== -1;\n };\n return _this;\n }\n var _proto = ToastContainer.prototype;\n _proto.componentDidMount = function componentDidMount() {\n var _this2 = this;\n eventManager.cancelEmit(ACTION.WILL_UNMOUNT).on(ACTION.SHOW, function (content, options) {\n return _this2.ref ? _this2.buildToast(content, options) : null;\n }).on(ACTION.CLEAR, function (id) {\n return !_this2.ref ? null : id == null ? _this2.clear() : _this2.removeToast(id);\n }).emit(ACTION.DID_MOUNT, this);\n };\n _proto.componentWillUnmount = function componentWillUnmount() {\n eventManager.emit(ACTION.WILL_UNMOUNT, this);\n };\n _proto.removeToast = function removeToast(id) {\n this.setState({\n toast: this.state.toast.filter(function (v) {\n return v !== id;\n })\n }, this.dispatchChange);\n };\n _proto.dispatchChange = function dispatchChange() {\n eventManager.emit(ACTION.ON_CHANGE, this.state.toast.length, this.props.containerId);\n };\n _proto.makeCloseButton = function makeCloseButton(toastClose, toastId, type) {\n var _this3 = this;\n var closeButton = this.props.closeButton;\n if (isValidElement(toastClose) || toastClose === false) {\n closeButton = toastClose;\n } else if (toastClose === true) {\n closeButton = this.props.closeButton && typeof this.props.closeButton !== 'boolean' ? this.props.closeButton : React.createElement(CloseButton, null);\n }\n return closeButton === false ? false : cloneElement(closeButton, {\n closeToast: function closeToast() {\n return _this3.removeToast(toastId);\n },\n type: type\n });\n };\n _proto.getAutoCloseDelay = function getAutoCloseDelay(toastAutoClose) {\n return toastAutoClose === false || isValidDelay(toastAutoClose) ? toastAutoClose : this.props.autoClose;\n };\n _proto.canBeRendered = function canBeRendered(content) {\n return isValidElement(content) || typeof content === 'string' || typeof content === 'number' || typeof content === 'function';\n };\n _proto.parseClassName = function parseClassName(prop) {\n if (typeof prop === 'string') {\n return prop;\n } else if (prop !== null && typeof prop === 'object' && 'toString' in prop) {\n return prop.toString();\n }\n return null;\n };\n _proto.belongToContainer = function belongToContainer(_ref) {\n var containerId = _ref.containerId;\n return containerId === this.props.containerId;\n };\n _proto.buildToast = function buildToast(content, _ref2) {\n var _this4 = this;\n var delay = _ref2.delay,\n options = _objectWithoutPropertiesLoose(_ref2, [\"delay\"]);\n if (!this.canBeRendered(content)) {\n throw new Error(\"The element you provided cannot be rendered. You provided an element of type \" + typeof content);\n }\n var toastId = options.toastId,\n updateId = options.updateId; // Check for multi-container and also for duplicate toastId\n // Maybe it would be better to extract it\n\n if (this.props.enableMultiContainer && !this.belongToContainer(options) || this.isToastActive(toastId) && updateId == null) {\n return;\n }\n var closeToast = function closeToast() {\n return _this4.removeToast(toastId);\n };\n var toastOptions = {\n id: toastId,\n // ⚠️ if no options.key, this.toastKey - 1 is assigned\n key: options.key || this.toastKey++,\n type: options.type,\n closeToast: closeToast,\n updateId: options.updateId,\n rtl: this.props.rtl,\n position: options.position || this.props.position,\n transition: options.transition || this.props.transition,\n className: this.parseClassName(options.className || this.props.toastClassName),\n bodyClassName: this.parseClassName(options.bodyClassName || this.props.bodyClassName),\n onClick: options.onClick || this.props.onClick,\n closeButton: this.makeCloseButton(options.closeButton, toastId, options.type),\n pauseOnHover: typeof options.pauseOnHover === 'boolean' ? options.pauseOnHover : this.props.pauseOnHover,\n pauseOnFocusLoss: typeof options.pauseOnFocusLoss === 'boolean' ? options.pauseOnFocusLoss : this.props.pauseOnFocusLoss,\n draggable: typeof options.draggable === 'boolean' ? options.draggable : this.props.draggable,\n draggablePercent: typeof options.draggablePercent === 'number' && !isNaN(options.draggablePercent) ? options.draggablePercent : this.props.draggablePercent,\n closeOnClick: typeof options.closeOnClick === 'boolean' ? options.closeOnClick : this.props.closeOnClick,\n progressClassName: this.parseClassName(options.progressClassName || this.props.progressClassName),\n progressStyle: this.props.progressStyle,\n autoClose: this.getAutoCloseDelay(options.autoClose),\n hideProgressBar: typeof options.hideProgressBar === 'boolean' ? options.hideProgressBar : this.props.hideProgressBar,\n progress: parseFloat(options.progress),\n role: typeof options.role === 'string' ? options.role : this.props.role\n };\n typeof options.onOpen === 'function' && (toastOptions.onOpen = options.onOpen);\n typeof options.onClose === 'function' && (toastOptions.onClose = options.onClose); // add closeToast function to react component only\n\n if (isValidElement(content) && typeof content.type !== 'string' && typeof content.type !== 'number') {\n content = cloneElement(content, {\n closeToast: closeToast\n });\n } else if (typeof content === 'function') {\n content = content({\n closeToast: closeToast\n });\n }\n if (isValidDelay(delay)) {\n setTimeout(function () {\n _this4.appendToast(toastOptions, content, options.staleToastId);\n }, delay);\n } else {\n this.appendToast(toastOptions, content, options.staleToastId);\n }\n };\n _proto.appendToast = function appendToast(options, content, staleToastId) {\n var _extends2;\n var id = options.id,\n updateId = options.updateId;\n this.collection = _extends({}, this.collection, (_extends2 = {}, _extends2[id] = {\n options: options,\n content: content,\n position: options.position\n }, _extends2));\n this.setState({\n toast: (updateId ? [].concat(this.state.toast) : [].concat(this.state.toast, [id])).filter(function (id) {\n return id !== staleToastId;\n })\n }, this.dispatchChange);\n };\n _proto.clear = function clear() {\n this.setState({\n toast: []\n });\n };\n _proto.renderToast = function renderToast() {\n var _this5 = this;\n var toastToRender = {};\n var _this$props = this.props,\n className = _this$props.className,\n style = _this$props.style,\n newestOnTop = _this$props.newestOnTop;\n var collection = newestOnTop ? Object.keys(this.collection).reverse() : Object.keys(this.collection); // group toast by position\n\n collection.forEach(function (toastId) {\n var _this5$collection$toa = _this5.collection[toastId],\n position = _this5$collection$toa.position,\n options = _this5$collection$toa.options,\n content = _this5$collection$toa.content;\n toastToRender[position] || (toastToRender[position] = []);\n if (_this5.state.toast.indexOf(options.id) !== -1) {\n toastToRender[position].push(React.createElement(Toast, _extends({}, options, {\n isDocumentHidden: _this5.state.isDocumentHidden,\n key: \"toast-\" + options.key\n }), content));\n } else {\n toastToRender[position].push(null);\n delete _this5.collection[toastId];\n }\n });\n return Object.keys(toastToRender).map(function (position) {\n var _cx;\n var disablePointer = toastToRender[position].length === 1 && toastToRender[position][0] === null;\n var props = {\n className: cx(RT_NAMESPACE + \"__toast-container\", RT_NAMESPACE + \"__toast-container--\" + position, (_cx = {}, _cx[RT_NAMESPACE + \"__toast-container--rtl\"] = _this5.props.rtl, _cx), _this5.parseClassName(className)),\n style: disablePointer ? _extends({}, style, {\n pointerEvents: 'none'\n }) : _extends({}, style)\n };\n return React.createElement(TransitionGroup, _extends({}, props, {\n key: \"container-\" + position\n }), toastToRender[position]);\n });\n };\n _proto.render = function render() {\n var _this6 = this;\n return React.createElement(\"div\", {\n ref: function ref(node) {\n return _this6.ref = node;\n },\n className: \"\" + RT_NAMESPACE\n }, this.renderToast());\n };\n return ToastContainer;\n}(Component);\nToastContainer.propTypes = {\n /**\n * Set toast position\n */\n position: PropTypes.oneOf(objectValues(POSITION)),\n /**\n * Disable or set autoClose delay\n */\n autoClose: falseOrDelay,\n /**\n * Disable or set a custom react element for the close button\n */\n closeButton: PropTypes.oneOfType([PropTypes.node, PropTypes.bool]),\n /**\n * Hide or not progress bar when autoClose is enabled\n */\n hideProgressBar: PropTypes.bool,\n /**\n * Pause toast duration on hover\n */\n pauseOnHover: PropTypes.bool,\n /**\n * Dismiss toast on click\n */\n closeOnClick: PropTypes.bool,\n /**\n * Newest on top\n */\n newestOnTop: PropTypes.bool,\n /**\n * An optional className\n */\n className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n /**\n * An optional style\n */\n style: PropTypes.object,\n /**\n * An optional className for the toast\n */\n toastClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n /**\n * An optional className for the toast body\n */\n bodyClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n /**\n * An optional className for the toast progress bar\n */\n progressClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n /**\n * An optional style for the toast progress bar\n */\n progressStyle: PropTypes.object,\n /**\n * Define enter and exit transition using react-transition-group\n */\n transition: PropTypes.func,\n /**\n * Support rtl display\n */\n rtl: PropTypes.bool,\n /**\n * Allow toast to be draggable\n */\n draggable: PropTypes.bool,\n /**\n * The percentage of the toast's width it takes for a drag to dismiss a toast\n */\n draggablePercent: PropTypes.number,\n /**\n * Pause the toast on focus loss\n */\n pauseOnFocusLoss: PropTypes.bool,\n /**\n * Show the toast only if it includes containerId and it's the same as containerId\n */\n enableMultiContainer: PropTypes.bool,\n /**\n * Set id to handle multiple container\n */\n containerId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n /**\n * Set role attribute for the toast body\n */\n role: PropTypes.string,\n /**\n * Fired when clicking inside toaster\n */\n onClick: PropTypes.func\n};\nToastContainer.defaultProps = {\n position: POSITION.TOP_RIGHT,\n transition: Bounce,\n rtl: false,\n autoClose: 5000,\n hideProgressBar: false,\n closeButton: React.createElement(CloseButton, null),\n pauseOnHover: true,\n pauseOnFocusLoss: true,\n closeOnClick: true,\n newestOnTop: false,\n draggable: true,\n draggablePercent: 80,\n className: null,\n style: null,\n toastClassName: null,\n bodyClassName: null,\n progressClassName: null,\n progressStyle: null,\n role: 'alert'\n};\nvar containers = new Map();\nvar latestInstance = null;\nvar containerDomNode = null;\nvar containerConfig = {};\nvar queue = [];\nvar lazy = false;\n/**\n * Check whether any container is currently mounted in the DOM\n */\n\nfunction isAnyContainerMounted() {\n return containers.size > 0;\n}\n/**\n * Get the container by id. Returns the last container declared when no id is given.\n */\n\nfunction getContainer(containerId) {\n if (!isAnyContainerMounted()) return null;\n if (!containerId) return containers.get(latestInstance);\n return containers.get(containerId);\n}\n/**\n * Get the toast by id, given it's in the DOM, otherwise returns null\n */\n\nfunction getToast(toastId, _ref) {\n var containerId = _ref.containerId;\n var container = getContainer(containerId);\n if (!container) return null;\n var toast = container.collection[toastId];\n if (typeof toast === 'undefined') return null;\n return toast;\n}\n/**\n * Merge provided options with the defaults settings and generate the toastId\n */\n\nfunction mergeOptions(options, type) {\n return _extends({}, options, {\n type: type,\n toastId: getToastId(options)\n });\n}\n/**\n * Generate a random toastId\n */\n\nfunction generateToastId() {\n return (Math.random().toString(36) + Date.now().toString(36)).substr(2, 10);\n}\n/**\n * Generate a toastId or use the one provided\n */\n\nfunction getToastId(options) {\n if (options && (typeof options.toastId === 'string' || typeof options.toastId === 'number' && !isNaN(options.toastId))) {\n return options.toastId;\n }\n return generateToastId();\n}\n/**\n * If the container is not mounted, the toast is enqueued and\n * the container lazy mounted\n */\n\nfunction dispatchToast(content, options) {\n if (isAnyContainerMounted()) {\n eventManager.emit(ACTION.SHOW, content, options);\n } else {\n queue.push({\n action: ACTION.SHOW,\n content: content,\n options: options\n });\n if (lazy && canUseDom) {\n lazy = false;\n containerDomNode = document.createElement('div');\n document.body.appendChild(containerDomNode);\n render(React.createElement(ToastContainer, containerConfig), containerDomNode);\n }\n }\n return options.toastId;\n}\nvar toast = function toast(content, options) {\n return dispatchToast(content, mergeOptions(options, options && options.type || TYPE.DEFAULT));\n};\n/**\n * For each available type create a shortcut\n */\n\nvar _loop = function _loop(t) {\n if (TYPE[t] !== TYPE.DEFAULT) {\n toast[TYPE[t].toLowerCase()] = function (content, options) {\n return dispatchToast(content, mergeOptions(options, options && options.type || TYPE[t]));\n };\n }\n};\nfor (var t in TYPE) {\n _loop(t);\n}\n/**\n * Maybe I should remove warning in favor of warn, I don't know\n */\n\ntoast.warn = toast.warning;\n/**\n * Remove toast programmaticaly\n */\n\ntoast.dismiss = function (id) {\n if (id === void 0) {\n id = null;\n }\n return isAnyContainerMounted() && eventManager.emit(ACTION.CLEAR, id);\n};\n/**\n * return true if one container is displaying the toast\n */\n\ntoast.isActive = function (id) {\n var isToastActive = false;\n if (containers.size > 0) {\n containers.forEach(function (container) {\n if (container.isToastActive(id)) {\n isToastActive = true;\n }\n });\n }\n return isToastActive;\n};\ntoast.update = function (toastId, options) {\n if (options === void 0) {\n options = {};\n }\n\n // if you call toast and toast.update directly nothing will be displayed\n // this is why I defered the update\n setTimeout(function () {\n var toast = getToast(toastId, options);\n if (toast) {\n var oldOptions = toast.options,\n oldContent = toast.content;\n var nextOptions = _extends({}, oldOptions, {}, options, {\n toastId: options.toastId || toastId\n });\n if (!options.toastId || options.toastId === toastId) {\n nextOptions.updateId = generateToastId();\n } else {\n nextOptions.staleToastId = toastId;\n }\n var content = typeof nextOptions.render !== 'undefined' ? nextOptions.render : oldContent;\n delete nextOptions.render;\n dispatchToast(content, nextOptions);\n }\n }, 0);\n};\n/**\n * Used for controlled progress bar.\n */\n\ntoast.done = function (id) {\n toast.update(id, {\n progress: 1\n });\n};\n/**\n * Track changes. The callback get the number of toast displayed\n */\n\ntoast.onChange = function (callback) {\n if (typeof callback === 'function') {\n eventManager.on(ACTION.ON_CHANGE, callback);\n }\n};\n/**\n * Configure the ToastContainer when lazy mounted\n */\n\ntoast.configure = function (config) {\n lazy = true;\n containerConfig = config;\n};\ntoast.POSITION = POSITION;\ntoast.TYPE = TYPE;\n/**\n * Wait until the ToastContainer is mounted to dispatch the toast\n * and attach isActive method\n */\n\neventManager.on(ACTION.DID_MOUNT, function (containerInstance) {\n latestInstance = containerInstance.props.containerId || containerInstance;\n containers.set(latestInstance, containerInstance);\n queue.forEach(function (item) {\n eventManager.emit(item.action, item.content, item.options);\n });\n queue = [];\n}).on(ACTION.WILL_UNMOUNT, function (containerInstance) {\n if (containerInstance) containers.delete(containerInstance.props.containerId || containerInstance);else containers.clear();\n if (containers.size === 0) {\n eventManager.off(ACTION.SHOW).off(ACTION.CLEAR);\n }\n if (canUseDom && containerDomNode) {\n document.body.removeChild(containerDomNode);\n }\n});\nexport { Bounce, Flip, Slide, ToastContainer, POSITION as ToastPosition, TYPE as ToastType, Zoom, cssTransition, toast };","/*!\n * jQuery JavaScript Library v3.6.0\n * https://jquery.com/\n *\n * Includes Sizzle.js\n * https://sizzlejs.com/\n *\n * Copyright OpenJS Foundation and other contributors\n * Released under the MIT license\n * https://jquery.org/license\n *\n * Date: 2021-03-02T17:08Z\n */\n(function (global, factory) {\n \"use strict\";\n\n if (typeof module === \"object\" && typeof module.exports === \"object\") {\n // For CommonJS and CommonJS-like environments where a proper `window`\n // is present, execute the factory and get jQuery.\n // For environments that do not have a `window` with a `document`\n // (such as Node.js), expose a factory as module.exports.\n // This accentuates the need for the creation of a real `window`.\n // e.g. var jQuery = require(\"jquery\")(window);\n // See ticket #14549 for more info.\n module.exports = global.document ? factory(global, true) : function (w) {\n if (!w.document) {\n throw new Error(\"jQuery requires a window with a document\");\n }\n return factory(w);\n };\n } else {\n factory(global);\n }\n\n // Pass this if window is not defined yet\n})(typeof window !== \"undefined\" ? window : this, function (window, noGlobal) {\n // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1\n // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode\n // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common\n // enough that all such attempts are guarded in a try block.\n \"use strict\";\n\n var arr = [];\n var getProto = Object.getPrototypeOf;\n var _slice = arr.slice;\n var flat = arr.flat ? function (array) {\n return arr.flat.call(array);\n } : function (array) {\n return arr.concat.apply([], array);\n };\n var push = arr.push;\n var indexOf = arr.indexOf;\n var class2type = {};\n var toString = class2type.toString;\n var hasOwn = class2type.hasOwnProperty;\n var fnToString = hasOwn.toString;\n var ObjectFunctionString = fnToString.call(Object);\n var support = {};\n var isFunction = function isFunction(obj) {\n // Support: Chrome <=57, Firefox <=52\n // In some browsers, typeof returns \"function\" for HTML