text: "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")),TransitionGroup=_interopDefault(require("react-transition-group/TransitionGroup")),Transition=_interopDefault(require("react-transition-group/Transition")),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(){};function isValidDelay(t){return"number"==typeof t&&!isNaN(t)&&0<t}var canUseDom=!("undefined"==typeof window||!window.document||!window.document.createElement);function withRequired(o){return o.isRequired=function(t,e,n){if(void 0===t[e])return new Error("The prop "+e+" is marked as required in \n      "+n+", but its value is undefined.");o(t,e,n)},o}var falseOrDelay=withRequired(function(t,e,n){var o=t[e];return!1===o||isValidDelay(o)?null:new Error(n+" expect "+e+" \n      to be a valid Number > 0 or equal to false. "+o+" given.")});function ProgressBar(t){var e,n=t.delay,o=t.isRunning,s=t.closeToast,a=t.type,r=t.hide,i=t.className,l=t.style,u=t.controlledProgress,c=t.progress,p=t.rtl,d=_extends({},l,{animationDuration:n+"ms",animationPlayState:o?"running":"paused",opacity:r?0:1,transform:u?"scaleX("+c+")":null}),f=cx("Toastify__progress-bar",u?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated","Toastify__progress-bar--"+a,{"Toastify__progress-bar--rtl":p},i),g=((e={})[u&&1<=c?"onTransitionEnd":"onAnimationEnd"]=u&&c<1?null:s,e);return React__default.createElement("div",_extends({className:f,style:d},g))}function getX(t){return t.targetTouches&&1<=t.targetTouches.length?t.targetTouches[0].clientX:t.clientX}function getY(t){return t.targetTouches&&1<=t.targetTouches.length?t.targetTouches[0].clientY:t.clientY}ProgressBar.defaultProps={type:TYPE.DEFAULT,hide:!1};var iLoveInternetExplorer=canUseDom&&/(msie|trident)/i.test(navigator.userAgent),Toast=function(o){function t(){for(var a,t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return(a=o.call.apply(o,[this].concat(e))||this).state={isRunning:!0,preventExitTransition:!1},a.flag={canCloseOnClick:!0,canDrag:!1},a.drag={start:0,x:0,y:0,deltaX:0,removalDistance:0},a.boundingRect=null,a.ref=null,a.pauseToast=function(){a.props.autoClose&&a.setState({isRunning:!1})},a.playToast=function(){a.props.autoClose&&a.setState({isRunning:!0})},a.onDragStart=function(t){a.flag.canCloseOnClick=!0,a.flag.canDrag=!0,a.boundingRect=a.ref.getBoundingClientRect(),a.ref.style.transition="",a.drag.start=a.drag.x=getX(t.nativeEvent),a.drag.removalDistance=a.ref.offsetWidth*(a.props.draggablePercent/100)},a.onDragMove=function(t){a.flag.canDrag&&(a.state.isRunning&&a.pauseToast(),a.drag.x=getX(t),a.drag.deltaX=a.drag.x-a.drag.start,a.drag.y=getY(t),a.drag.start!==a.drag.x&&(a.flag.canCloseOnClick=!1),a.ref.style.transform="translateX("+a.drag.deltaX+"px)",a.ref.style.opacity=1-Math.abs(a.drag.deltaX/a.drag.removalDistance))},a.onDragEnd=function(t){if(a.flag.canDrag){if(a.flag.canDrag=!1,Math.abs(a.drag.deltaX)>a.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 e=this,t=this.props,n=t.closeButton,o=t.children,s=t.autoClose,a=t.pauseOnHover,r=t.onClick,i=t.closeOnClick,l=t.type,u=t.hideProgressBar,c=t.closeToast,p=t.transition,d=t.position,f=t.className,g=t.bodyClassName,h=t.progressClassName,T=t.progressStyle,m=t.updateId,y=t.role,v=t.progress,_=t.rtl,E={className:cx("Toastify__toast","Toastify__toast--"+l,{"Toastify__toast--rtl":_},f)};s&&a&&(E.onMouseEnter=this.pauseToast,E.onMouseLeave=this.playToast),i&&(E.onClick=function(t){r&&r(t),e.flag.canCloseOnClick&&c()});var C=parseFloat(v)===v;return React__default.createElement(p,{in:this.props.in,appear:!0,onExited:this.onExitTransitionEnd,position:d,preventExitTransition:this.state.preventExitTransition},React__default.createElement("div",_extends({onClick:r},E,{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:y},{className:cx("Toastify__toast-body",g)}),o),n&&n,(s||C)&&React__default.createElement(ProgressBar,_extends({},m&&!C?{key:"pb-"+m}:{},{rtl:_,delay:s,isRunning:this.state.isRunning,closeToast:c,hide:u,type:l,style:T,className:h,controlledProgress:C,progress:v}))))},t}(React.Component);function CloseButton(t){var e=t.closeToast,n=t.type,o=t.ariaLabel;return React__default.createElement("button",{className:"Toastify__close-button Toastify__close-button--"+n,type:"button",onClick:function(t){t.stopPropagation(),e(t)},"aria-label":o},"✖")}function cssTransition(t){var u=t.enter,c=t.exit,e=t.duration,p=void 0===e?750:e,n=t.appendPosition,d=void 0!==n&&n;return function(t){var e,n,o=t.children,s=t.position,a=t.preventExitTransition,r=_objectWithoutPropertiesLoose(t,["children","position","preventExitTransition"]),i=d?u+"--"+s:u,l=d?c+"--"+s:c;Array.isArray(p)&&2===p.length?(e=p[0],n=p[1]):e=n=p;return React__default.createElement(Transition,_extends({},r,{timeout:a?0:{enter:e,exit:n},onEnter:function(t){t.classList.add(i),t.style.animationFillMode="forwards",t.style.animationDuration=.001*e+"s"},onEntered:function(t){t.classList.remove(i),t.style.cssText=""},onExit:a?NOOP:function(t){t.classList.add(l),t.style.animationFillMode="forwards",t.style.animationDuration=.001*n+"s"}}),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:"Toastify__bounce-enter",exit:"Toastify__bounce-exit",appendPosition:!0}),Slide=cssTransition({enter:"Toastify__slide-enter",exit:"Toastify__slide-exit",duration:[450,750],appendPosition:!0}),Zoom=cssTransition({enter:"Toastify__zoom-enter",exit:"Toastify__zoom-exit"}),Flip=cssTransition({enter:"Toastify__flip-enter",exit:"Toastify__flip-exit"}),eventManager={list: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},emit:function(t){for(var e=arguments.length,n=new Array(1<e?e-1:0),o=1;o<e;o++)n[o-1]=arguments[o];this.list.has(t)&&this.list.get(t).forEach(function(t){return setTimeout(function(){t.apply(void 0,n)},0)})}},ToastContainer=function(s){function t(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return(e=s.call.apply(s,[this].concat(n))||this).state={toast:[]},e.toastKey=1,e.collection={},e.isToastActive=function(t){return-1!==e.state.toast.indexOf(t)},e}_inheritsLoose(t,s);var e=t.prototype;return e.componentDidMount=function(){var n=this;eventManager.on(ACTION.SHOW,function(t,e){return n.buildToast(t,e)}).on(ACTION.CLEAR,function(t){return null==t?n.clear():n.removeToast(t)}).emit(ACTION.DID_MOUNT,this)},e.componentWillUnmount=function(){eventManager.off(ACTION.SHOW).off(ACTION.CLEAR).emit(ACTION.WILL_UNMOUNT,this)},e.removeToast=function(e){this.setState({toast:this.state.toast.filter(function(t){return t!==e})},this.dispatchChange)},e.dispatchChange=function(){eventManager.emit(ACTION.ON_CHANGE,this.state.toast.length)},e.makeCloseButton=function(t,e,n){var o=this,s=this.props.closeButton;return React.isValidElement(t)||!1===t?s=t:!0===t&&(s=React__default.createElement(CloseButton,null)),!1!==s&&React.cloneElement(s,{closeToast:function(){return o.removeToast(e)},type:n})},e.getAutoCloseDelay=function(t){return!1===t||isValidDelay(t)?t:this.props.autoClose},e.canBeRendered=function(t){return React.isValidElement(t)||"string"==typeof t||"number"==typeof t||"function"==typeof t},e.parseClassName=function(t){return"string"==typeof t?t:null!==t&&"object"==typeof t&&"toString"in t?t.toString():null},e.belongToContainer=function(t){return t.containerId===this.props.containerId},e.buildToast=function(t,e){var n=this,o=e.delay,s=_objectWithoutPropertiesLoose(e,["delay"]);if(!this.canBeRendered(t))throw new Error("The element you provided cannot be rendered. You provided an element of type "+typeof t);var a=s.toastId,r=s.updateId;if(!(this.props.enableMultiContainer&&!this.belongToContainer(s)||this.isToastActive(a)&&null==r)){var i=function(){return n.removeToast(a)},l={id:a,key:s.key||this.toastKey++,type:s.type,closeToast:i,updateId:s.updateId,rtl:this.props.rtl,position:s.position||this.props.position,transition:s.transition||this.props.transition,className:this.parseClassName(s.className||this.props.toastClassName),bodyClassName:this.parseClassName(s.bodyClassName||this.props.bodyClassName),onClick:s.onClick||this.props.onClick,closeButton:this.makeCloseButton(s.closeButton,a,s.type),pauseOnHover:"boolean"==typeof s.pauseOnHover?s.pauseOnHover:this.props.pauseOnHover,pauseOnFocusLoss:"boolean"==typeof s.pauseOnFocusLoss?s.pauseOnFocusLoss:this.props.pauseOnFocusLoss,draggable:"boolean"==typeof s.draggable?s.draggable:this.props.draggable,draggablePercent:"number"!=typeof s.draggablePercent||isNaN(s.draggablePercent)?this.props.draggablePercent:s.draggablePercent,closeOnClick:"boolean"==typeof s.closeOnClick?s.closeOnClick:this.props.closeOnClick,progressClassName:this.parseClassName(s.progressClassName||this.props.progressClassName),progressStyle:this.props.progressStyle,autoClose:this.getAutoCloseDelay(s.autoClose),hideProgressBar:"boolean"==typeof s.hideProgressBar?s.hideProgressBar:this.props.hideProgressBar,progress:parseFloat(s.progress),role:"string"==typeof s.role?s.role:this.props.role};"function"==typeof s.onOpen&&(l.onOpen=s.onOpen),"function"==typeof s.onClose&&(l.onClose=s.onClose),React.isValidElement(t)&&"string"!=typeof t.type&&"number"!=typeof t.type?t=React.cloneElement(t,{closeToast:i}):"function"==typeof t&&(t=t({closeToast:i})),isValidDelay(o)?setTimeout(function(){n.appendToast(l,t,s.staleToastId)},o):this.appendToast(l,t,s.staleToastId)}},e.appendToast=function(t,e,n){var o,s=t.id,a=t.updateId;this.collection=_extends({},this.collection,((o={})[s]={options:t,content:e,position:t.position},o)),this.setState({toast:(a?[].concat(this.state.toast):[].concat(this.state.toast,[s])).filter(function(t){return t!==n})},this.dispatchChange)},e.clear=function(){this.setState({toast:[]})},e.renderToast=function(){var a=this,r={},t=this.props,o=t.className,s=t.style;return(t.newestOnTop?Object.keys(this.collection).reverse():Object.keys(this.collection)).forEach(function(t){var e=a.collection[t],n=e.position,o=e.options,s=e.content;r[n]||(r[n]=[]),-1!==a.state.toast.indexOf(o.id)?r[n].push(React__default.createElement(Toast,_extends({},o,{isDocumentHidden:a.state.isDocumentHidden,key:"toast-"+o.key}),s)):(r[n].push(null),delete a.collection[t])}),Object.keys(r).map(function(t){var e=1===r[t].length&&null===r[t][0],n={className:cx("Toastify__toast-container","Toastify__toast-container--"+t,{"Toastify__toast-container--rtl":a.props.rtl},a.parseClassName(o)),style:e?_extends({},s,{pointerEvents:"none"}):_extends({},s)};return React__default.createElement(TransitionGroup,_extends({},n,{key:"container-"+t}),r[t])})},e.render=function(){return React__default.createElement("div",{className:"Toastify"},this.renderToast())},t}(React.Component);ToastContainer.defaultProps={position:POSITION.TOP_RIGHT,transition:Bounce,rtl:!1,autoClose:5e3,hideProgressBar:!1,closeButton:React__default.createElement(CloseButton,null),pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,newestOnTop:!1,draggable:!0,draggablePercent:80,className:null,style:null,toastClassName:null,bodyClassName:null,progressClassName:null,progressStyle:null,role:"alert"};var containers=new Map,latestInstance=null,containerDomNode=null,containerConfig={},queue=[],lazy=!1;function isAnyContainerMounted(){return 0<containers.size}function getContainer(t){return isAnyContainerMounted()?t?containers.get(t):containers.get(latestInstance):null}function getToast(t,e){var n=getContainer(e.containerId);if(!n)return null;var o=n.collection[t];return void 0===o?null:o}function mergeOptions(t,e){return _extends({},t,{type:e,toastId:getToastId(t)})}function generateToastId(){return(Math.random().toString(36)+Date.now().toString(36)).substr(2,10)}function getToastId(t){return t&&("string"==typeof t.toastId||"number"==typeof t.toastId&&!isNaN(t.toastId))?t.toastId:generateToastId()}function dispatchToast(t,e){return isAnyContainerMounted()?eventManager.emit(ACTION.SHOW,t,e):(queue.push({action:ACTION.SHOW,content:t,options:e}),lazy&&canUseDom&&(lazy=!1,containerDomNode=document.createElement("div"),document.body.appendChild(containerDomNode),reactDom.render(React__default.createElement(ToastContainer,containerConfig),containerDomNode))),e.toastId}var toast=function(t,e){return dispatchToast(t,mergeOptions(e,e&&e.type||TYPE.DEFAULT))},_loop=function(n){TYPE[n]!==TYPE.DEFAULT&&(toast[TYPE[n].toLowerCase()]=function(t,e){return dispatchToast(t,mergeOptions(e,e&&e.type||TYPE[n]))})};for(var t in TYPE)_loop(t);toast.warn=toast.warning,toast.dismiss=function(t){return void 0===t&&(t=null),isAnyContainerMounted()&&eventManager.emit(ACTION.CLEAR,t)},toast.isActive=NOOP,toast.update=function(a,r){void 0===r&&(r={}),setTimeout(function(){var t=getToast(a,r);if(t){var e=t.options,n=t.content,o=_extends({},e,r,{toastId:r.toastId||a});r.toastId&&r.toastId!==a?o.staleToastId=a:o.updateId=generateToastId();var s=void 0!==o.render?o.render:n;delete o.render,dispatchToast(s,o)}},0)},toast.done=function(t){toast.update(t,{progress:1})},toast.onChange=function(t){"function"==typeof t&&eventManager.on(ACTION.ON_CHANGE,t)},toast.configure=function(t){lazy=!0,containerConfig=t},toast.POSITION=POSITION,toast.TYPE=TYPE,eventManager.on(ACTION.DID_MOUNT,function(e){latestInstance=e.props.containerId||e,containers.set(latestInstance,e),toast.isActive=function(t){return e.isToastActive(t)},queue.forEach(function(t){eventManager.emit(t.action,t.content,t.options)}),queue=[]}).on(ACTION.WILL_UNMOUNT,function(t){t?containers.delete(t.props.containerId||t):containers.clear(),toast.isActive=NOOP,canUseDom&&containerDomNode&&document.body.removeChild(containerDomNode)}),exports.Bounce=Bounce,exports.Flip=Flip,exports.Slide=Slide,exports.ToastContainer=ToastContainer,exports.ToastPosition=POSITION,exports.ToastType=TYPE,exports.Zoom=Zoom,exports.cssTransition=cssTransition,exports.toast=toast;
  