import e from"../../@babel/runtime/helpers/esm/extends.js";import s from"../../@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js";import n from"../../@babel/runtime/helpers/esm/inheritsLoose.js";import r from"../../prop-types/index.js";import t from"../../dom-helpers/esm/addClass.js";import o from"../../dom-helpers/esm/removeClass.js";import a from"react";import i from"./Transition.js";import{classNamesShape as p}from"./utils/PropTypes.js";import{forceReflow as l}from"./utils/reflow.js";var m=function(e,s){return e&&s&&s.split(" ").forEach((function(s){return t(e,s)}))},d=function(e,s){return e&&s&&s.split(" ").forEach((function(s){return o(e,s)}))},u=function(r){function t(){for(var e,s=arguments.length,n=new Array(s),t=0;t<s;t++)n[t]=arguments[t];return(e=r.call.apply(r,[this].concat(n))||this).appliedClasses={appear:{},enter:{},exit:{}},e.onEnter=function(s,n){var r=e.resolveArguments(s,n),t=r[0],o=r[1];e.removeClasses(t,"exit"),e.addClass(t,o?"appear":"enter","base"),e.props.onEnter&&e.props.onEnter(s,n)},e.onEntering=function(s,n){var r=e.resolveArguments(s,n),t=r[0],o=r[1]?"appear":"enter";e.addClass(t,o,"active"),e.props.onEntering&&e.props.onEntering(s,n)},e.onEntered=function(s,n){var r=e.resolveArguments(s,n),t=r[0],o=r[1]?"appear":"enter";e.removeClasses(t,o),e.addClass(t,o,"done"),e.props.onEntered&&e.props.onEntered(s,n)},e.onExit=function(s){var n=e.resolveArguments(s)[0];e.removeClasses(n,"appear"),e.removeClasses(n,"enter"),e.addClass(n,"exit","base"),e.props.onExit&&e.props.onExit(s)},e.onExiting=function(s){var n=e.resolveArguments(s)[0];e.addClass(n,"exit","active"),e.props.onExiting&&e.props.onExiting(s)},e.onExited=function(s){var n=e.resolveArguments(s)[0];e.removeClasses(n,"exit"),e.addClass(n,"exit","done"),e.props.onExited&&e.props.onExited(s)},e.resolveArguments=function(s,n){return e.props.nodeRef?[e.props.nodeRef.current,s]:[s,n]},e.getClassNames=function(s){var n=e.props.classNames,r="string"==typeof n,t=r?""+(r&&n?n+"-":"")+s:n[s];return{baseClassName:t,activeClassName:r?t+"-active":n[s+"Active"],doneClassName:r?t+"-done":n[s+"Done"]}},e}n(t,r);var o=t.prototype;return o.addClass=function(e,s,n){var r=this.getClassNames(s)[n+"ClassName"],t=this.getClassNames("enter").doneClassName;"appear"===s&&"done"===n&&t&&(r+=" "+t),"active"===n&&e&&l(e),r&&(this.appliedClasses[s][n]=r,m(e,r))},o.removeClasses=function(e,s){var n=this.appliedClasses[s],r=n.base,t=n.active,o=n.done;this.appliedClasses[s]={},r&&d(e,r),t&&d(e,t),o&&d(e,o)},o.render=function(){var n=this.props;n.classNames;var r=s(n,["classNames"]);return a.createElement(i,e({},r,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(a.Component);u.defaultProps={classNames:""},u.propTypes="production"!==process.env.NODE_ENV?e({},i.propTypes,{classNames:p,onEnter:r.func,onEntering:r.func,onEntered:r.func,onExit:r.func,onExiting:r.func,onExited:r.func}):{};var c=u;export{c as default};
//# sourceMappingURL=CSSTransition.js.map
