import{i as x,a7 as D,a8 as m,a9 as l,aa as g,ab as y}from"./index-BbBXKozi.js";var p,f;const i=await x("react");function R(e,t){return!(e===t||i.isValidElement(e)&&i.isValidElement(t)&&e.key!=null&&e.key===t.key)}var s={out:"out-in",in:"in-out"},E=function(t,r,n){return function(){var a;t.props[r]&&(a=t.props)[r].apply(a,arguments),n()}},k=(p={},p[s.out]=function(e){var t=e.current,r=e.changeState;return i.cloneElement(t,{in:!1,onExited:E(t,"onExited",function(){r(l,null)})})},p[s.in]=function(e){var t=e.current,r=e.changeState,n=e.children;return[t,i.cloneElement(n,{in:!0,onEntered:E(n,"onEntered",function(){r(l)})})]},p),N=(f={},f[s.out]=function(e){var t=e.children,r=e.changeState;return i.cloneElement(t,{in:!0,onEntered:E(t,"onEntered",function(){r(m,i.cloneElement(t,{in:!0}))})})},f[s.in]=function(e){var t=e.current,r=e.children,n=e.changeState;return[i.cloneElement(t,{in:!1,onExited:E(t,"onExited",function(){n(m,i.cloneElement(r,{in:!0}))})}),i.cloneElement(r,{in:!0})]},f),T=function(e){D(t,e);function t(){for(var n,a=arguments.length,o=new Array(a),u=0;u<a;u++)o[u]=arguments[u];return n=e.call.apply(e,[this].concat(o))||this,n.state={status:m,current:null},n.appeared=!1,n.changeState=function(d,c){c===void 0&&(c=n.state.current),n.setState({status:d,current:c})},n}var r=t.prototype;return r.componentDidMount=function(){this.appeared=!0},t.getDerivedStateFromProps=function(a,o){return a.children==null?{current:null}:o.status===l&&a.mode===s.in?{status:l}:o.current&&R(o.current,a.children)?{status:g}:{current:i.cloneElement(a.children,{in:!0})}},r.render=function(){var a=this.props,o=a.children,u=a.mode,d=this.state,c=d.status,v=d.current,S={children:o,current:v,changeState:this.changeState,status:c},h;switch(c){case l:h=N[u](S);break;case g:h=k[u](S);break;case m:h=v}return i.createElement(y.Provider,{value:{isMounting:!this.appeared}},h)},t}(i.Component);T.propTypes={};T.defaultProps={mode:s.out};export{T as S}; //# sourceMappingURL=SwitchTransition-CHC1m-Pk.js.map