function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function _possibleConstructorReturn(n,t){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:n}function _inherits(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(n,t):n.__proto__=t)}var _createClass=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}(),FixedElementPosition=function(n){function t(n){_classCallCheck(this,t);var i=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,n));return i.fixedElementInfoAry=[],i.timeout=null,i}return _inherits(t,n),_createClass(t,[{key:"componentDidMount",value:function(){var n=this,t=$(window);t.on("load",function(){window.innerWidth>=n.props.minWindowWidth&&function(){var r=$("#"+n.props.footerElementId),i=n.props.topAdElementId?$("#"+n.props.topAdElementId):[];n.timeout=setTimeout(function(){var u=i.length>0?i.height():0;if(n.props.fixedElements.forEach(function(t){var i=$("#"+t.id);i.length>0&&(i.css({transitionDuration:t.durationTime}),n.fixedElementInfoAry.push({$element:i,offsetTop:i.offset().top}))}),n.fixedElementInfoAry.length>0)t.on("scroll",function(){window.innerWidth>=n.props.minWindowWidth?function(){var f=i.length>0?u-i.height():0,e=t.scrollTop(),o=e+t.height();n.fixedElementInfoAry.forEach(function(i){var u=i.offsetTop+i.$element.outerHeight(),s=n.props.footerElementId?r.offset().top:null;i.$element.outerHeight()>t.height()?o>u-f?n.props.footerElementId?o<s+n.props.bottomPositionIncrement?i.$element.stop().css(n._transformMaker(o-u+f)):i.$element.stop().css(n._transformMaker(s-u+f,"bottom")):i.$element.stop().css(n._transformMaker(o-u+f)):i.$element.stop().css(n._transformMaker()):e>i.offsetTop-f?n.props.footerElementId?e+i.$element.outerHeight()<s+n.props.bottomPositionIncrement?i.$element.stop().css(n._transformMaker(e-i.offsetTop+f,"top")):i.$element.stop().css(n._transformMaker(s-u+f,"bottom")):i.$element.stop().css(n._transformMaker(e-i.offsetTop+f,"top")):i.$element.stop().css(n._transformMaker())})}():n.fixedElementInfoAry.forEach(function(t){t.$element.stop().css(n._transformMaker())})})},500)}()})}},{key:"componentWillUnmount",value:function(){$window.off("scroll");clearTimeout(this.timeout)}},{key:"render",value:function(){return React.createElement("section",null)}},{key:"_transformMaker",value:function(n,t){var r=this,i=void 0;return n&&(i=n+function(){switch(t){case"top":return r.props.topPositionIncrement;case"bottom":return r.props.bottomPositionIncrement;default:return 0}}()),{position:i?"relative":null,top:i?i+"px":0}}}]),t}(React.Component);FixedElementPosition.defaultProps={topAdElementId:"",footerElementId:"",topPositionIncrement:0,bottomPositionIncrement:0};FixedElementPosition.propTypes={fixedElements:PropTypes.arrayOf(PropTypes.shape({id:PropTypes.string.isRequired,durationTime:PropTypes.string})).isRequired,minWindowWidth:PropTypes.number.isRequired,topAdElementId:PropTypes.string,footerElementId:PropTypes.string,topPositionIncrement:PropTypes.number,bottomPositionIncrement:PropTypes.number}