text: !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-motion")):"function"==typeof define&&define.amd?define(["react","react-motion"],t):"object"==typeof exports?exports.ReactCollapse=t(require("react"),require("react-motion")):e.ReactCollapse=t(e.React,e.ReactMotion)}(this,function(e,t){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,n){"use strict";function o(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Collapse=void 0;var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),c=n(1),l=function(e){return e&&e.__esModule?e:{default:e}}(c),p=n(4),f="IDLING",h=function(){return null},d={collapse:"ReactCollapse--collapse",content:"ReactCollapse--content"};(t.Collapse=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return m.call(n),n.state={currentState:f,from:0,to:0},n}return a(t,e),u(t,[{key:"componentDidMount",value:function(){var e=this.props,t=e.isOpened,n=e.forceInitialAnimation,o=e.onRest;if(t){var r=this.getTo();if(n){var i=this.wrapper.clientHeight;this.setState({currentState:"RESIZING",from:i,to:r})}else this.setState({currentState:f,from:r,to:r})}o()}},{key:"componentWillReceiveProps",value:function(e){e.hasNestedCollapse?e.isOpened!==this.props.isOpened&&this.setState({currentState:"WAITING"}):this.state.currentState===f&&(e.isOpened||this.props.isOpened)&&this.setState({currentState:"WAITING"})}},{key:"componentDidUpdate",value:function(e,t){var n=this.props,o=n.isOpened,r=n.onRest,i=n.onMeasure;if(this.state.currentState===f)return void r();t.to!==this.state.to&&i({height:this.state.to,width:this.content.clientWidth});var a=this.wrapper.clientHeight,s=o?this.getTo():0;if(a!==s)return void this.setState({currentState:"RESIZING",from:a,to:s});"RESTING"===this.state.currentState&&this.setState({currentState:f,from:a,to:s})}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.raf)}},{key:"render",value:function(){return l.default.createElement(p.Motion,s({},this.getMotionProps(),{onRest:this.onRest,children:this.renderContent}))}}]),t}(l.default.PureComponent)).defaultProps={forceInitialAnimation:!1,hasNestedCollapse:!1,fixedHeight:-1,style:{},theme:d,onRender:h,onRest:h,onMeasure:h};var m=function(){var e=this;this.onContentRef=function(t){e.content=t},this.onWrapperRef=function(t){e.wrapper=t},this.onRest=function(){e.raf=requestAnimationFrame(e.setResting)},this.setResting=function(){e.setState({currentState:"RESTING"})},this.getTo=function(){var t=e.props.fixedHeight;return t>-1?t:e.content.clientHeight},this.getWrapperStyle=function(t){if(e.state.currentState===f&&e.state.to){var n=e.props.fixedHeight;return n>-1?{overflow:"hidden",height:n}:{height:"auto"}}return"WAITING"!==e.state.currentState||e.state.to?{overflow:"hidden",height:Math.max(0,t)}:{overflow:"hidden",height:0}},this.getMotionProps=function(){var t=e.props.springConfig;return e.state.currentState===f?{defaultStyle:{height:e.state.to},style:{height:e.state.to}}:{defaultStyle:{height:e.state.from},style:{height:(0,p.spring)(e.state.to,s({precision:1},t))}}},this.renderContent=function(t){var n=t.height,r=e.props,i=(r.isOpened,r.springConfig,r.forceInitialAnimation,r.hasNestedCollapse,r.fixedHeight,r.theme),a=r.style,u=r.onRender,c=(r.onRest,r.onMeasure,r.children),p=o(r,["isOpened","springConfig","forceInitialAnimation","hasNestedCollapse","fixedHeight","theme","style","onRender","onRest","onMeasure","children"]),f=e.state;return u({current:n,from:f.from,to:f.to}),l.default.createElement("div",s({ref:e.onWrapperRef,className:i.collapse,style:s({},e.getWrapperStyle(Math.max(0,n)),a)},p),l.default.createElement("div",{ref:e.onContentRef,className:i.content},c))}}},function(t,n){t.exports=e},function(e,t,n){"use strict";function o(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.UnmountClosed=void 0;var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),c=n(1),l=function(e){return e&&e.__esModule?e:{default:e}}(c),p=n(0);t.UnmountClosed=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.componentWillReceiveProps=function(e){var t=e.isOpened;!n.props.isOpened&&t&&n.setState({forceInitialAnimation:!0,shouldUnmount:!1})},n.onRest=function(){var e=n.props,t=e.isOpened,o=e.onRest;t||n.setState({shouldUnmount:!0}),o&&o.apply(void 0,arguments)},n.state={shouldUnmount:!n.props.isOpened,forceInitialAnimation:!n.props.isOpened},n}return a(t,e),u(t,[{key:"render",value:function(){var e=this.props,t=e.isOpened,n=(e.onRest,o(e,["isOpened","onRest"])),r=this.state,i=r.forceInitialAnimation;return r.shouldUnmount?null:l.default.createElement(p.Collapse,s({forceInitialAnimation:i,isOpened:t,onRest:this.onRest},n))}}]),t}(l.default.PureComponent)},function(e,t,n){"use strict";var o=n(0),r=o.Collapse,i=n(2),a=i.UnmountClosed;a.Collapse=r,a.UnmountClosed=a,e.exports=a},function(e,n){e.exports=t}])});