"use strict";function _interopDefault(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=_interopDefault(require("@babel/runtime/helpers/extends")),_objectWithoutPropertiesLoose=_interopDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose")),_inheritsLoose=_interopDefault(require("@babel/runtime/helpers/inheritsLoose")),React=require("react"),React__default=_interopDefault(React),cx=_interopDefault(require("classnames")),reactTransitionGroup=require("react-transition-group"),reactDom=require("react-dom"),POSITION={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"},ACTION={SHOW:0,CLEAR:1,DID_MOUNT:2,WILL_UNMOUNT:3,ON_CHANGE:4},NOOP=function(){},RT_NAMESPACE="Toastify";function isValidDelay(t){return"number"==typeof t&&!isNaN(t)&&0 0 or equal to false. "+o+" given.")}),eventManager={list:new Map,emitQueue:new Map,on:function(t,e){return this.list.has(t)||this.list.set(t,[]),this.list.get(t).push(e),this},off:function(t){return this.list.delete(t),this},cancelEmit:function(t){var e=this.emitQueue.get(t);return e&&(e.forEach(function(t){return clearTimeout(t)}),this.emitQueue.delete(t)),this},emit:function(n){for(var o=this,t=arguments.length,s=new Array(1a.drag.removalDistance)return void a.setState({preventExitTransition:!0},a.props.closeToast);a.ref.style.transition="transform 0.2s, opacity 0.2s",a.ref.style.transform="translateX(0)",a.ref.style.opacity=1}},a.onDragTransitionEnd=function(){if(a.boundingRect){var t=a.boundingRect,e=t.top,n=t.bottom,o=t.left,s=t.right;a.props.pauseOnHover&&a.drag.x>=o&&a.drag.x<=s&&a.drag.y>=e&&a.drag.y<=n?a.pauseToast():a.playToast()}},a.onExitTransitionEnd=function(){if(iLoveInternetExplorer)a.props.onExited();else{var t=a.ref.scrollHeight,e=a.ref.style;requestAnimationFrame(function(){e.minHeight="initial",e.height=t+"px",e.transition="all 0.4s ",requestAnimationFrame(function(){e.height=0,e.padding=0,e.margin=0}),setTimeout(function(){return a.props.onExited()},400)})}},a}_inheritsLoose(t,o);var e=t.prototype;return e.componentDidMount=function(){this.props.onOpen(this.props.children.props),this.props.draggable&&this.bindDragEvents(),this.props.pauseOnFocusLoss&&this.bindFocusEvents()},e.componentDidUpdate=function(t){t.draggable!==this.props.draggable&&(this.props.draggable?this.bindDragEvents():this.unbindDragEvents()),t.pauseOnFocusLoss!==this.props.pauseOnFocusLoss&&(this.props.pauseOnFocusLoss?this.bindFocusEvents():this.unbindFocusEvents())},e.componentWillUnmount=function(){this.props.onClose(this.props.children.props),this.props.draggable&&this.unbindDragEvents(),this.props.pauseOnFocusLoss&&this.unbindFocusEvents()},e.bindFocusEvents=function(){window.addEventListener("focus",this.playToast),window.addEventListener("blur",this.pauseToast)},e.unbindFocusEvents=function(){window.removeEventListener("focus",this.playToast),window.removeEventListener("blur",this.pauseToast)},e.bindDragEvents=function(){document.addEventListener("mousemove",this.onDragMove),document.addEventListener("mouseup",this.onDragEnd),document.addEventListener("touchmove",this.onDragMove),document.addEventListener("touchend",this.onDragEnd)},e.unbindDragEvents=function(){document.removeEventListener("mousemove",this.onDragMove),document.removeEventListener("mouseup",this.onDragEnd),document.removeEventListener("touchmove",this.onDragMove),document.removeEventListener("touchend",this.onDragEnd)},e.render=function(){var t,e=this,n=this.props,o=n.closeButton,s=n.children,a=n.autoClose,r=n.pauseOnHover,i=n.onClick,l=n.closeOnClick,u=n.type,c=n.hideProgressBar,p=n.closeToast,d=n.transition,f=n.position,g=n.className,h=n.bodyClassName,T=n.progressClassName,m=n.progressStyle,E=n.updateId,v=n.role,_=n.progress,C=n.rtl,y={className:cx(RT_NAMESPACE+"__toast",RT_NAMESPACE+"__toast--"+u,((t={})[RT_NAMESPACE+"__toast--rtl"]=C,t),g)};a&&r&&(y.onMouseEnter=this.pauseToast,y.onMouseLeave=this.playToast),l&&(y.onClick=function(t){i&&i(t),e.flag.canCloseOnClick&&p()});var N=parseFloat(_)===_;return React__default.createElement(d,{in:this.props.in,appear:!0,onExited:this.onExitTransitionEnd,position:f,preventExitTransition:this.state.preventExitTransition},React__default.createElement("div",_extends({onClick:i},y,{ref:function(t){return e.ref=t},onMouseDown:this.onDragStart,onTouchStart:this.onDragStart,onMouseUp:this.onDragTransitionEnd,onTouchEnd:this.onDragTransitionEnd}),React__default.createElement("div",_extends({},this.props.in&&{role:v},{className:cx(RT_NAMESPACE+"__toast-body",h)}),s),o&&o,(a||N)&&React__default.createElement(ProgressBar,_extends({},E&&!N?{key:"pb-"+E}:{},{rtl:C,delay:a,isRunning:this.state.isRunning,closeToast:p,hide:c,type:u,style:m,className:T,controlledProgress:N,progress:_}))))},t}(React.Component);function CloseButton(t){var e=t.closeToast,n=t.type,o=t.ariaLabel;return React__default.createElement("button",{className:RT_NAMESPACE+"__close-button "+RT_NAMESPACE+"__close-button--"+n,type:"button",onClick:function(t){t.stopPropagation(),e(t)},"aria-label":o},"✖︎")}Toast.defaultProps={type:TYPE.DEFAULT,in:!0,onOpen:NOOP,onClose:NOOP,className:null,bodyClassName:null,progressClassName:null,updateId:null},CloseButton.defaultProps={ariaLabel:"close"};var Bounce=cssTransition({enter:RT_NAMESPACE+"__bounce-enter",exit:RT_NAMESPACE+"__bounce-exit",appendPosition:!0}),Slide=cssTransition({enter:RT_NAMESPACE+"__slide-enter",exit:RT_NAMESPACE+"__slide-exit",duration:[450,750],appendPosition:!0}),Zoom=cssTransition({enter:RT_NAMESPACE+"__zoom-enter",exit:RT_NAMESPACE+"__zoom-exit"}),Flip=cssTransition({enter:RT_NAMESPACE+"__flip-enter",exit:RT_NAMESPACE+"__flip-exit"}),ToastContainer=function(s){function t(){for(var e,t=arguments.length,n=new Array(t),o=0;o