Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-pannable

Package Overview
Dependencies
Maintainers
1
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-pannable - npm Package Compare versions

Comparing version 0.6.3 to 0.7.0

2

dist/react-pannable.min.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e((t=t||self).ReactPannable={},t.React)}(this,function(t,g){"use strict";function p(t,e){if(null==t)return{};var n,i,o={},r=Object.keys(t);for(i=0;i<r.length;i++)e.indexOf(n=r[i])<0&&(o[n]=t[n]);return o}function m(){return(m=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function r(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}g=g&&g.hasOwnProperty("default")?g.default:g;var e,u={create:function(t){var e,n=t.transformTranslate;return m({},p(t,["transformTranslate"]),(e=n)?{transform:"translate3d("+e[0]+"px, "+e[1]+"px, 0)",WebkitTransform:"translate3d("+e[0]+"px, "+e[1]+"px, 0)",msTransform:"translate("+e[0]+"px, "+e[1]+"px)"}:null)}},h=function(i){function t(){for(var o,t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return(o=i.call.apply(i,[this].concat(e))||this).state={target:null,translation:null,interval:null,velocity:null,startPoint:null,movePoint:null,moveTime:null},o.elemRef=g.createRef(),o._onTouchStart=function(t){var e=o.props,n=e.onTouchStart;t.touches&&1===t.touches.length&&e.enabled&&o._track(t.touches[0]),n&&n(t)},o._onTouchMove=function(t){var e=o.props.onTouchMove;t.touches&&1===t.touches.length&&o._move(t.touches[0]),e&&e(t)},o._onTouchEnd=function(t){var e=o.props.onTouchEnd;t.changedTouches&&1===t.changedTouches.length&&o._end(),e&&e(t)},o._onTouchCancel=function(t){var e=o.props.onTouchCancel;t.changedTouches&&1===t.changedTouches.length&&o._end(),e&&e(t)},o._onMouseDown=function(t){var e=o.props,n=e.enabled,i=e.onMouseDown;(o._shouldPreventClick=n)&&(o._removeMousePanListener(),o._addMousePanListener(),o._track(t)),i&&i(t)},o._onMouseMove=function(t){t.preventDefault(),o._move(t)},o._onMouseUp=function(t){t.preventDefault(),o._removeMousePanListener(),o._end()},o._onClick=function(t){var e=o.props.onClick;o._shouldPreventClick&&t.preventDefault(),o._shouldPreventClick=!1,e&&e(t)},o}r(t,i);var e=t.prototype;return e.componentDidUpdate=function(t){var e=this.props.enabled;t.enabled===e||e||this._cancel()},e.componentWillUnmount=function(){this._removeMousePanListener()},e._track=function(t){this.setState({startPoint:{x:t.pageX,y:t.pageY},movePoint:{x:t.pageX,y:t.pageY},moveTime:(new Date).getTime()})},e._move=function(p){p={target:p.target,pageX:p.pageX,pageY:p.pageY},this.setState(function(t,e){var n=e.shouldStart,i=e.onStart,o=e.onMove,r=t.target,a=t.startPoint,s=t.movePoint,c=t.moveTime;if(!a)return null;var l=(new Date).getTime(),d={x:p.pageX,y:p.pageY},u=l-c,h={x:d.x-a.x,y:d.y-a.y},f={x:(d.x-s.x)/u,y:(d.y-s.y)/u},g={translation:h,velocity:f,interval:u,movePoint:d,moveTime:l};r?o({target:r,translation:h,velocity:f,interval:u}):0<Math.sqrt(h.x*h.x+h.y*h.y)&&n({target:p.target,translation:h,velocity:f,interval:u})&&(g.target=p.target,g.startPoint={x:p.pageX,y:p.pageY},g.translation=h={x:0,y:0},i({target:p.target,translation:h,velocity:f,interval:u}));return g})},e._end=function(){this.setState(function(t,e){var n=t.target;return n&&e.onEnd({target:n,translation:t.translation,velocity:t.velocity,interval:t.interval}),{target:null,translation:null,velocity:null,interval:null,startPoint:null,movePoint:null,moveTime:null}})},e._cancel=function(){this.setState(function(t,e){var n=t.target;return n&&e.onCancel({target:n,translation:t.translation,velocity:t.velocity,interval:t.interval}),{target:null,translation:null,velocity:null,interval:null,startPoint:null,movePoint:null,moveTime:null}})},e._addMousePanListener=function(){var t=document.documentElement;t.addEventListener("mousemove",this._onMouseMove,!1),t.addEventListener("mouseup",this._onMouseUp,!1)},e._removeMousePanListener=function(){var t=document.documentElement;t.removeEventListener("mousemove",this._onMouseMove,!1),t.removeEventListener("mouseup",this._onMouseUp,!1)},e.render=function(){var t=this.props,e=t.enabled,n=t.style,i=p(t,["enabled","shouldStart","onStart","onMove","onEnd","onCancel","style"]),o=u.create(m({touchAction:e?"none":"auto"},n));return g.createElement("div",m({},i,{ref:this.elemRef,style:o,onTouchStart:this._onTouchStart,onTouchEnd:this._onTouchEnd,onTouchMove:this._onTouchMove,onTouchCancel:this._onTouchCancel,onMouseDown:this._onMouseDown,onClick:this._onClick}))},t}(g.PureComponent);h.defaultProps={enabled:!0,shouldStart:function(){return!0},onStart:function(){},onMove:function(){},onEnd:function(){},onCancel:function(){}};var v=(e="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}).requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.msRequestAnimationFrame||e.setTimeout&&function(t){return e.setTimeout(t,20)}||function(){},y=e.cancelAnimationFrame||e.webkitCancelAnimationFrame||e.mozCancelAnimationFrame||e.clearTimeout||function(){};function b(t,e){var n=e.x,i=e.y,o=Math.sqrt(n*n+i*i);return 0===o?{x:0,y:0}:{x:t*(n/o),y:t*(i/o)}}function w(t,e,n,i,o){if(o){var r="y"===o?["y","height"]:["x","width"],a=r[0],s=r[1],c=Math.min(e[s]-n[s],0);return c=Math.max(c,Math.min(t[a],0)),i&&(c=e[s]?e[s]*Math.round(c/e[s]):0),c}return{x:w(t,e,n,i,"x"),y:w(t,e,n,i,"y")}}function l(t,e,n,i,o){if(o){var r="y"===o?["y","height"]:["x","width"],a=r[0],s=r[1],c=Math.min(n[s]-i[s],0);return c=Math.max(c,Math.min(e[a],0)),t[a]<(c=n[s]?n[s]*Math.floor(c/n[s]):0)+.5*n[s]?c:c+n[s]}return{x:l(t,e,n,i,"x"),y:l(t,e,n,i,"y")}}var x=.04,a=function(n){function t(t){var e;return(e=n.call(this,t)||this)._onDragStart=function(t){var r=t.velocity;e.setState(function(t,e){var n=t.contentOffset,i=e.directionalLockEnabled?Math.abs(r.y)<Math.abs(r.x)?{x:1,y:0}:{x:0,y:1}:{x:1,y:1},o={x:i.x*r.x,y:i.y*r.y};return{contentOffset:m({},n),contentVelocity:o,dragging:!0,dragStartOffset:n,dragDirection:i,decelerating:!1}})},e._onDragMove=function(t){var a=t.translation,s=t.interval;e.setState(function(t,e){var n=t.contentOffset,i=t.dragStartOffset,o=t.dragDirection,r=function t(e,n,i,o,r){if(r){var a="y"===r?["y","height","width"]:["x","width","height"],s=a[0],c=a[1],l=a[2],d=e[s],u=Math.min(i[c]-o[c],0),h=.5*Math.min(i[c],i[l]);return 0<d?n[s]?h*(1-h/(h+d)):0:d<u?n[s]?u-h*(1-h/(h-d+u)):u:d}return{x:t(e,n,i,o,"x"),y:t(e,n,i,o,"y")}}({x:i.x+o.x*a.x,y:i.y+o.y*a.y},{x:e.alwaysBounceX,y:e.alwaysBounceY},t.size,t.contentSize);return{contentOffset:r,contentVelocity:{x:(r.x-n.x)/s,y:(r.y-n.y)/s}}})},e._onDragEnd=function(){e.setState(function(t,e){var n=t.contentOffset,i=t.size,o=t.contentSize,r=e.pagingEnabled,a=r?x:.004,s=function t(e,n,i,o){if(o){var r=e[o];return i[o]&&(r+=.5*n[o]*(n[o]/i[o])),r}return"number"==typeof i&&(i=b(i,n)),{x:t(e,n,i,"x"),y:t(e,n,i,"y")}}(n,t.contentVelocity,a);return r&&(s=l(n,s,i,o)),{contentOffset:m({},n),dragging:!1,decelerating:!0,decelerationEndOffset:s,decelerationRate:a}})},e._onDragCancel=function(){e.setState(function(t,e){var n=t.contentOffset,i=t.dragStartOffset;return e.pagingEnabled&&(i=l(n,i,t.size,t.contentSize)),{contentOffset:m({},n),dragging:!1,decelerating:!0,decelerationEndOffset:i,decelerationRate:x}})},e.state={prevContentOffset:null,contentOffset:{x:0,y:0},contentVelocity:{x:0,y:0},size:{width:t.width,height:t.height},contentSize:{width:t.contentWidth,height:t.contentHeight},dragging:!1,dragStartOffset:null,dragDirection:null,decelerating:!1,decelerationEndOffset:null,decelerationRate:x},e.boundingRef=g.createRef(),e.contentRef=g.createRef(),e.setContentSize=e.setContentSize.bind(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(e)),e}r(t,n),t.getDerivedStateFromProps=function(t,e){var n=e.contentOffset,i=e.contentVelocity,o=e.size,r=e.contentSize,a=e.dragging,s=e.decelerating,c=e.decelerationEndOffset,l=e.decelerationRate,d={};if(e.prevContentOffset!==n){var u=s,h=c,f=l;if(u){var g=w(n,o,r,!1);g.x===n.x&&g.y===n.y||(f=x,(g.x!==n.x&&g.x!==h.x||g.y!==n.y&&g.y!==h.y)&&(h={x:g.x!==n.x?g.x:h.x,y:g.y!==n.y?g.y:h.y})),h.x===n.x&&h.y===n.y&&0===i.x&&0===i.y&&(u=!1)}d.prevContentOffset=n,u!==s&&(d.decelerating=u),f!==l&&(d.decelerationRate=f),h!==c&&(d.decelerationEndOffset=h),t.onScroll({contentOffset:n,contentVelocity:i,size:o,contentSize:r,dragging:a,decelerating:u})}return d};var e=t.prototype;return e.componentDidUpdate=function(t,e){var n=this,i=this.props,o=i.width,r=i.height,a=i.contentWidth,s=i.contentHeight,c=i.pagingEnabled,l=i.onResize,d=i.onContentResize;if(t.width!==o||t.height!==r){var u={width:o,height:r};this._setStateWithScroll({size:u}),l(u)}if(t.contentWidth!==a||t.contentHeight!==s){var h={width:a,height:s};this._setStateWithScroll({contentSize:h}),d(h)}if(t.pagingEnabled!==c&&c&&this._setStateWithScroll(null),e.contentOffset!==this.state.contentOffset&&this.state.decelerating){var f=(new Date).getTime();this._deceleratingTimer&&y(this._deceleratingTimer),this._deceleratingTimer=v(function(){n._deceleratingTimer=void 0,n._decelerate((new Date).getTime()-f)})}},e.componentWillUnmount=function(){this._deceleratingTimer&&(y(this._deceleratingTimer),this._deceleratingTimer=void 0)},e.getSize=function(){return this.state.size},e.getContentSize=function(){return this.state.contentSize},e.getContentOffset=function(){return this.state.contentOffset},e.isDragging=function(){return this.state.dragging},e.isDecelerating=function(){return this.state.decelerating},e.getVisibleRect=function(){var t=this.state,e=t.contentOffset,n=t.size;return{x:-e.x,y:-e.y,width:n.width,height:n.height}},e.setContentSize=function(t){this._setStateWithScroll({contentSize:t}),this.props.onContentResize(t)},e.scrollToRect=function(t){var e=t.rect,n=t.align,i=void 0===n?"auto":n;this._setContentOffset(function(t){return function t(e,n,i,o,r){if(r){var a="y"===r?["y","height"]:["x","width"],s=a[0],c=a[1],l=-e[s],d=o[c]-e[c];if("auto"===n[s]){var u=d<0?-1:1;l+=u*Math.max(0,Math.min(u*(i[s]-l),u*d))}else"start"===n[s]?n[s]=0:"center"===n[s]?n[s]=.5:"end"===n[s]&&(n[s]=1),("number"!=typeof n[s]||isNaN(n[s]))&&(n[s]=.5),l+=n[s]*d;return l}return"object"!=typeof n&&(n={x:n,y:n}),{x:t(e,n,i,o,"x"),y:t(e,n,i,o,"y")}}(e,i,t.contentOffset,t.size)},t.animated)},e.scrollTo=function(t){this._setContentOffset(t.offset,t.animated)},e._setContentOffset=function(i,o){this.setState(function(t,e){"function"==typeof i&&(i=i(t,e));var n=t.contentOffset;return t.dragging?null:(i=w(i,t.size,t.contentSize,e.pagingEnabled),o?{contentOffset:m({},n),decelerating:!0,decelerationEndOffset:i,decelerationRate:x}:{contentOffset:i,contentVelocity:{x:0,y:0},decelerating:!1})})},e._setStateWithScroll=function(o){this.setState(function(t,e){var n=t.contentOffset;if(t.dragging)return o;var i=w(n,t.size,t.contentSize,e.pagingEnabled);return i.x===n.x&&i.y===n.y?o:m({},o,{contentOffset:m({},n),decelerating:!0,decelerationEndOffset:i,decelerationRate:x})})},e._decelerate=function(n){this.setState(function(t){if(!t.decelerating)return null;var e=function t(e,n,i,o,r,a,s){if(s){var c,l="y"===s?["y","height"]:["x","width"],d=l[0],u=l[1],h=o[d],f=i[d];if(n[d]){var g=n[d]<0?-1:1,p=g*Math.sqrt(.5*f*f+n[d]*(r[d]-h)),v=(p-f)/n[d];v<0&&(p=f,v=0),(2*p-f)/n[d]<e?(f=0,h=r[d]):0<g*(r[d]-(h+=.5*(i[d]+p)*v-.5*(p+(f=p-n[d]*Math.abs(v-e)))*(v-e)))||(console.log("slow"),f=(f<0?-1:1)*Math.min(Math.abs(f),Math.sqrt(2*g*n[d]*.25*a[u])))}else h+=f*e;return(c={})[d+"Offset"]=h,c[d+"Velocity"]=f,c}return"number"==typeof n&&(n=b(n,{x:r.x-o.x,y:r.y-o.y})),m({},t(e,n,i,o,r,a,"x"),t(e,n,i,o,r,a,"y"))}(n,t.decelerationRate,t.contentVelocity,t.contentOffset,t.decelerationEndOffset,t.size);return{contentOffset:{x:e.xOffset,y:e.yOffset},contentVelocity:{x:e.xVelocity,y:e.yVelocity}}})},e.render=function(){var t=this.props,e=t.scrollEnabled,n=t.style,i=t.children,o=p(t,["width","height","contentWidth","contentHeight","scrollEnabled","pagingEnabled","directionalLockEnabled","alwaysBounceX","alwaysBounceY","onScroll","onResize","onContentResize","style","children"]),r=this.state,a=r.size,s=r.contentSize,c=r.contentOffset,l=u.create(m({overflow:"hidden",position:"relative",boxSizing:"border-box",width:a.width,height:a.height},n)),d=u.create({position:"relative",boxSizing:"border-box",width:s.width,height:s.height,transformTranslate:[c.x,c.y]});return g.createElement(h,m({},o,{ref:this.boundingRef,style:l,enabled:e,onStart:this._onDragStart,onMove:this._onDragMove,onEnd:this._onDragEnd,onCancel:this._onDragCancel}),g.createElement("div",{ref:this.contentRef,style:d},"function"==typeof i?i(this):i))},t}(g.PureComponent);function s(t){var e=window.getComputedStyle(t)||{},n=t.offsetWidth||0,i=t.offsetHeight||0;return e.paddingLeft&&(n-=parseInt(e.paddingLeft,10)),e.paddingRight&&(n-=parseInt(e.paddingRight,10)),e.borderLeftWidth&&(n-=parseInt(e.borderLeftWidth,10)),e.borderRightWidth&&(n-=parseInt(e.borderRightWidth,10)),e.paddingTop&&(i-=parseInt(e.paddingTop,10)),e.paddingBottom&&(i-=parseInt(e.paddingBottom,10)),e.borderTopWidth&&(i-=parseInt(e.borderTopWidth,10)),e.borderBottomWidth&&(i-=parseInt(e.borderBottomWidth,10)),{width:n,height:i}}function n(t,e){return t(e={exports:{}},e.exports),e.exports}a.defaultProps={children:null,width:0,height:0,contentWidth:0,contentHeight:0,scrollEnabled:!0,pagingEnabled:!1,directionalLockEnabled:!1,alwaysBounceX:!0,alwaysBounceY:!0,onScroll:function(){},onResize:function(){},onContentResize:function(){}};var i=n(function(t){(t.exports={}).forEach=function(t,e){for(var n=0;n<t.length;n++){var i=e(t[n]);if(i)return i}}}),z=n(function(t){var e=t.exports={};e.isIE=function(t){return(-1!=(e=navigator.userAgent.toLowerCase()).indexOf("msie")||-1!=e.indexOf("trident")||-1!=e.indexOf(" edge/"))&&(!t||t===function(){for(var t=3,e=document.createElement("div"),n=e.getElementsByTagName("i");e.innerHTML="\x3c!--[if gt IE "+ ++t+"]><i></i><![endif]--\x3e",n[0];);return 4<t?t:void 0}());var e},e.isLegacyOpera=function(){return!!window.opera}}),d=n(function(t){(t.exports={}).getOption=function(t,e,n){var i=t[e];return null!=i||void 0===n?i:n}}),S=function(t){var e=(t=t||{}).reporter,n=d.getOption(t,"async",!0),i=d.getOption(t,"auto",!0);i&&!n&&(e&&e.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true."),n=!0);var o,r=f(),a=!1;function s(){for(a=!0;r.size();){var t=r;r=f(),t.process()}a=!1}function c(){o=setTimeout(s,0)}return{add:function(t,e){!a&&i&&n&&0===r.size()&&c(),r.add(t,e)},force:function(t){a||(void 0===t&&(t=n),o&&(clearTimeout(o),o=null),t?c():s())}}};function f(){var i={},n=0,o=0,r=0;return{add:function(t,e){e||(e=t,t=0),o<t?o=t:t<r&&(r=t),i[t]||(i[t]=[]),i[t].push(e),n++},process:function(){for(var t=r;t<=o;t++)for(var e=i[t],n=0;n<e.length;n++)(0,e[n])()},size:function(){return n}}}var o="_erd";function c(t){return t[o]}var _={initState:function(t){return t[o]={},c(t)},getState:c,cleanState:function(t){delete t[o]}},I=i.forEach,E=function(t){var x=(t=t||{}).reporter,z=t.batchProcessor,S=t.stateHandler.getState,_=t.idHandler;if(!z)throw Error("Missing required dependency: batchProcessor");if(!x)throw Error("Missing required dependency: reporter.");var E=function(){var t=document.createElement("div");t.style.cssText="position: absolute; width: 1000px; height: 1000px; visibility: hidden; margin: 0; padding: 0;";var e=document.createElement("div");e.style.cssText="position: absolute; width: 500px; height: 500px; overflow: scroll; visibility: none; top: -1500px; left: -1500px; visibility: hidden; margin: 0; padding: 0;",e.appendChild(t),document.body.insertBefore(e,document.body.firstChild);var n=500-e.clientWidth,i=500-e.clientHeight;return document.body.removeChild(e),{width:n,height:i}}(),C="erd_scroll_detection_container";function R(t,e,n){if(t.addEventListener)t.addEventListener(e,n);else{if(!t.attachEvent)return x.error("[scroll] Don't know how to add event listeners.");t.attachEvent("on"+e,n)}}function n(t,e,n){if(t.removeEventListener)t.removeEventListener(e,n);else{if(!t.detachEvent)return x.error("[scroll] Don't know how to remove event listeners.");t.detachEvent("on"+e,n)}}function T(t){return S(t).container.childNodes[0].childNodes[0].childNodes[0]}function M(t){return S(t).container.childNodes[0].childNodes[0].childNodes[1]}return function(i,t){if(!document.getElementById(i)){var e=t+"_animation",n=t+"_animation_active",o="/* Created by the element-resize-detector library. */\n";o+="."+t+" > div::-webkit-scrollbar { display: none; }\n\n",o+="."+n+" { -webkit-animation-duration: 0.1s; animation-duration: 0.1s; -webkit-animation-name: "+e+"; animation-name: "+e+"; }\n",o+="@-webkit-keyframes "+e+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }\n",function(t,e){e=e||function(t){document.head.appendChild(t)};var n=document.createElement("style");n.innerHTML=t,n.id=i,e(n)}(o+="@keyframes "+e+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }")}}("erd_scroll_detection_scrollbar_style",C),{makeDetectable:function(a,v,t){function m(){if(a.debug){var t=Array.prototype.slice.call(arguments);if(t.unshift(_.get(v),"Scroll: "),x.log.apply)x.log.apply(null,t);else for(var e=0;e<t.length;e++)x.log(t[e])}}function s(t){var e=S(t).container.childNodes[0],n=window.getComputedStyle(e);return!n.width||-1==n.width.indexOf("px")}function e(){var t=window.getComputedStyle(v),e={};return e.position=t.position,e.width=v.offsetWidth,e.height=v.offsetHeight,e.top=t.top,e.right=t.right,e.bottom=t.bottom,e.left=t.left,e.widthCSS=t.width,e.heightCSS=t.height,e}function n(){if(m("storeStyle invoked."),S(v)){var t=e();S(v).style=t}else m("Aborting because element has been uninstalled")}function c(t,e,n){S(t).lastWidth=e,S(t).lastHeight=n}function l(){return 2*E.width+1}function d(){return 2*E.height+1}function u(t){return t+10+l()}function h(t){return t+10+d()}function f(t,e,n){var i=T(t),o=M(t),r=u(e),a=h(n),s=2*e+l(),c=2*n+d();i.scrollLeft=r,i.scrollTop=a,o.scrollLeft=s,o.scrollTop=c}function y(){var t=S(v).container;if(!t){(t=document.createElement("div")).className=C,t.style.cssText="visibility: hidden; display: inline; width: 0px; height: 0px; z-index: -1; overflow: hidden; margin: 0; padding: 0;",(S(v).container=t).className+=" "+C+"_animation_active",v.appendChild(t);var e=function(){S(v).onRendered&&S(v).onRendered()};R(t,"animationstart",e),S(v).onAnimationStart=e}return t}function i(){if(m("Injecting elements"),S(v)){!function(){var t=S(v).style;if("static"===t.position){v.style.position="relative";var e=function(t,e,n,i){var o=n[i];"auto"!==o&&"0"!==o.replace(/[^-\d\.]/g,"")&&(t.warn("An element that is positioned static has style."+i+"="+o+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+i+" will be set to 0. Element: ",e),e.style[i]=0)};e(x,v,t,"top"),e(x,v,t,"right"),e(x,v,t,"bottom"),e(x,v,t,"left")}}();var t=S(v).container;t||(t=y());var e,n,i,o,r=E.width,a=E.height,s="position: absolute; flex: none; overflow: hidden; z-index: -1; visibility: hidden; left: "+(e=(e=-(1+r))?e+"px":"0")+"; top: "+(n=(n=-(1+a))?n+"px":"0")+"; right: "+(o=(o=-r)?o+"px":"0")+"; bottom: "+(i=(i=-a)?i+"px":"0")+";",c=document.createElement("div"),l=document.createElement("div"),d=document.createElement("div"),u=document.createElement("div"),h=document.createElement("div"),f=document.createElement("div");c.dir="ltr",c.style.cssText="position: absolute; flex: none; overflow: hidden; z-index: -1; visibility: hidden; width: 100%; height: 100%; left: 0px; top: 0px;",l.className=c.className=C,l.style.cssText=s,d.style.cssText="position: absolute; flex: none; overflow: scroll; z-index: -1; visibility: hidden; width: 100%; height: 100%;",u.style.cssText="position: absolute; left: 0; top: 0;",h.style.cssText="position: absolute; flex: none; overflow: scroll; z-index: -1; visibility: hidden; width: 100%; height: 100%;",f.style.cssText="position: absolute; width: 200%; height: 200%;",d.appendChild(u),h.appendChild(f),l.appendChild(d),l.appendChild(h),c.appendChild(l),t.appendChild(c),R(d,"scroll",g),R(h,"scroll",p),S(v).onExpandScroll=g,S(v).onShrinkScroll=p}else m("Aborting because element has been uninstalled");function g(){S(v).onExpand&&S(v).onExpand()}function p(){S(v).onShrink&&S(v).onShrink()}}function o(){function i(t,e,n){var i=T(t).childNodes[0],o=u(e),r=h(n);i.style.width=o+"px",i.style.height=r+"px"}function n(t){var e=v.offsetWidth,n=v.offsetHeight;m("Storing current size",e,n),c(v,e,n),z.add(0,function(){S(v)?o()?(a.debug&&(v.offsetWidth===e&&v.offsetHeight===n||x.warn(_.get(v),"Scroll: Size changed before updating detector elements.")),i(v,e,n)):m("Aborting because element container has not been initialized"):m("Aborting because element has been uninstalled")}),z.add(1,function(){S(v)?o()?f(v,e,n):m("Aborting because element container has not been initialized"):m("Aborting because element has been uninstalled")}),t&&z.add(2,function(){S(v)?o()?t():m("Aborting because element container has not been initialized"):m("Aborting because element has been uninstalled")})}function o(){return!!S(v).container}function r(){m("notifyListenersIfNeeded invoked");var t=S(v);return void 0===S(v).lastNotifiedWidth&&t.lastWidth===t.startSize.width&&t.lastHeight===t.startSize.height?m("Not notifying: Size is the same as the start size, and there has been no notification yet."):t.lastWidth===t.lastNotifiedWidth&&t.lastHeight===t.lastNotifiedHeight?m("Not notifying: Size already notified"):(m("Current size not notified, notifying..."),t.lastNotifiedWidth=t.lastWidth,t.lastNotifiedHeight=t.lastHeight,void I(S(v).listeners,function(t){t(v)}))}function t(){if(m("Scroll detected."),s(v))m("Scroll event fired while unrendered. Ignoring...");else{var t=v.offsetWidth,e=v.offsetHeight;t!==S(v).lastWidth||e!==S(v).lastHeight?(m("Element size changed."),n(r)):m("Element size has not changed ("+t+"x"+e+").")}}if(m("registerListenersAndPositionElements invoked."),S(v)){S(v).onRendered=function(){if(m("startanimation triggered."),s(v))m("Ignoring since element is still unrendered...");else{m("Element rendered.");var t=T(v),e=M(v);0!==t.scrollLeft&&0!==t.scrollTop&&0!==e.scrollLeft&&0!==e.scrollTop||(m("Scrollbars out of sync. Updating detector elements..."),n(r))}},S(v).onExpand=t,S(v).onShrink=t;var e=S(v).style;i(v,e.width,e.height)}else m("Aborting because element has been uninstalled")}function r(){if(m("finalizeDomMutation invoked."),S(v)){var t=S(v).style;c(v,t.width,t.height),f(v,t.width,t.height)}else m("Aborting because element has been uninstalled")}function g(){t(v)}function p(){var t;m("Installing..."),S(v).listeners=[],t=e(),S(v).startSize={width:t.width,height:t.height},m("Element start size",S(v).startSize),z.add(0,n),z.add(1,i),z.add(2,o),z.add(3,r),z.add(4,g)}var b,w;t||(t=v,v=a,a=null),a=a||{},m("Making detectable..."),(w=b=v)!==w.ownerDocument.body&&!w.ownerDocument.body.contains(w)||null===window.getComputedStyle(b)?(m("Element is detached"),y(),m("Waiting until element is attached..."),S(v).onRendered=function(){m("Element is now attached"),p()}):p()},addListener:function(t,e){if(!S(t).listeners.push)throw Error("Cannot add listener to an element that is not detectable.");S(t).listeners.push(e)},uninstall:function(t){var e=S(t);e&&(e.onExpandScroll&&n(T(t),"scroll",e.onExpandScroll),e.onShrinkScroll&&n(M(t),"scroll",e.onShrinkScroll),e.onAnimationStart&&n(e.container,"animationstart",e.onAnimationStart),e.container&&t.removeChild(e.container))}}},C=i.forEach;function R(t){return Array.isArray(t)||void 0!==t.length}function T(t){if(Array.isArray(t))return t;var e=[];return C(t,function(t){e.push(t)}),e}function M(t){return t&&1===t.nodeType}function O(t,e,n){var i=t[e];return null==i&&void 0!==n?n:i}var D=function(e){var u,t,i,o,n;if((e=e||{}).idHandler)u={get:function(t){return e.idHandler.get(t,!0)},set:e.idHandler.set};else{var r=(n=1,{generate:function(){return n++}}),a=(i=(t={idGenerator:r,stateHandler:_}).idGenerator,o=t.stateHandler.getState,{get:function(t){var e=o(t);return e&&void 0!==e.id?e.id:null},set:function(t){var e=o(t);if(!e)throw Error("setId required the element to have a resize detection state.");var n=i.generate();return e.id=n}});u=a}var h=e.reporter;h||(h=function(t){function e(){}var n={log:e,warn:e,error:e};if(!t&&window.console){var i=function(t,n){t[n]=function(){var t=console[n];if(t.apply)t.apply(console,arguments);else for(var e=0;e<arguments.length;e++)t(arguments[e])}};i(n,"log"),i(n,"warn"),i(n,"error")}return n}(!1===h));var s=O(e,"batchProcessor",S({reporter:h})),f={};f.callOnAdd=!!O(e,"callOnAdd",!0),f.debug=!!O(e,"debug",!1);var c,g,p=function(i){var o={};function r(t){var e=i.get(t);return void 0===e?[]:o[e]||[]}return{get:r,add:function(t,e){var n=i.get(t);o[n]||(o[n]=[]),o[n].push(e)},removeListener:function(t,e){for(var n=r(t),i=0,o=n.length;i<o;++i)if(n[i]===e){n.splice(i,1);break}},removeAllListeners:function(t){var e=r(t);e&&(e.length=0)}}}(u),v=(c={stateHandler:_}.stateHandler.getState,{isDetectable:function(t){var e=c(t);return e&&!!e.isDetectable},markAsDetectable:function(t){c(t).isDetectable=!0},isBusy:function(t){return!!c(t).busy},markBusy:function(t,e){c(t).busy=!!e}}),l=O(e,"strategy","object"),d={reporter:h,batchProcessor:s,stateHandler:_,idHandler:u};if("scroll"===l&&(z.isLegacyOpera()?(h.warn("Scroll strategy is not supported on legacy Opera. Changing to object strategy."),l="object"):z.isIE(9)&&(h.warn("Scroll strategy is not supported on IE9. Changing to object strategy."),l="object")),"scroll"===l)g=E(d);else{if("object"!==l)throw Error("Invalid strategy name: "+l);g=function(t){var s=(t=t||{}).reporter,c=t.batchProcessor,l=t.stateHandler.getState;if(!s)throw Error("Missing required dependency: reporter.");function i(t){return l(t).object}return{makeDetectable:function(t,e,n){n||(n=e,e=t,t=null),t=t||{},z.isIE(8)?n(e):function(n,i){var o=!1,r=window.getComputedStyle(n),t=n.offsetWidth,e=n.offsetHeight;function a(){function t(){if("static"===r.position){n.style.position="relative";var t=function(t,e,n,i){var o=n[i];"auto"!==o&&"0"!==o.replace(/[^-\d\.]/g,"")&&(t.warn("An element that is positioned static has style."+i+"="+o+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+i+" will be set to 0. Element: ",e),e.style[i]=0)};t(s,n,r,"top"),t(s,n,r,"right"),t(s,n,r,"bottom"),t(s,n,r,"left")}}""!==r.position&&(t(),o=!0);var e=document.createElement("object");e.style.cssText="display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; padding: 0; margin: 0; opacity: 0; z-index: -1000; pointer-events: none;",e.tabIndex=-1,e.type="text/html",e.setAttribute("aria-hidden","true"),e.onload=function(){o||t(),function t(e,n){e.contentDocument?n(e.contentDocument):setTimeout(function(){t(e,n)},100)}(this,function(t){i(n)})},z.isIE()||(e.data="about:blank"),n.appendChild(e),l(n).object=e,z.isIE()&&(e.data="about:blank")}l(n).startSize={width:t,height:e},c?c.add(a):a()}(e,n)},addListener:function(t,e){if(!i(t))throw Error("Element is not detectable by this strategy.");function n(){e(t)}z.isIE(8)?(l(t).object={proxy:n},t.attachEvent("onresize",n)):i(t).contentDocument.defaultView.addEventListener("resize",n)},uninstall:function(t){z.isIE(8)?t.detachEvent("onresize",l(t).object.proxy):t.removeChild(i(t)),delete l(t).object}}}(d)}var m={};return{listenTo:function(t,i,o){function r(e){var t=p.get(e);C(t,function(t){t(e)})}function a(t,e,n){p.add(e,n),t&&n(e)}if(o||(o=i,i=t,t={}),!i)throw Error("At least one element required.");if(!o)throw Error("Listener required.");if(M(i))i=[i];else{if(!R(i))return h.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");i=T(i)}var s=0,c=O(t,"callOnAdd",f.callOnAdd),l=O(t,"onReady",function(){}),d=O(t,"debug",f.debug);C(i,function(t){_.getState(t)||(_.initState(t),u.set(t));var n=u.get(t);if(d&&h.log("Attaching listener to element",n,t),!v.isDetectable(t))return d&&h.log(n,"Not detectable."),v.isBusy(t)?(d&&h.log(n,"System busy making it detectable"),a(c,t,o),m[n]=m[n]||[],void m[n].push(function(){++s===i.length&&l()})):(d&&h.log(n,"Making detectable..."),v.markBusy(t,!0),g.makeDetectable({debug:d},t,function(t){if(d&&h.log(n,"onElementDetectable"),_.getState(t)){v.markAsDetectable(t),v.markBusy(t,!1),g.addListener(t,r),a(c,t,o);var e=_.getState(t);e&&e.startSize&&(e.startSize.width===t.offsetWidth&&e.startSize.height===t.offsetHeight||r(t)),m[n]&&C(m[n],function(t){t()})}else d&&h.log(n,"Element uninstalled before being detectable.");delete m[n],++s===i.length&&l()}));d&&h.log(n,"Already detecable, adding listener."),a(c,t,o),s++}),s===i.length&&l()},removeListener:p.removeListener,removeAllListeners:p.removeAllListeners,uninstall:function(t){if(!t)return h.error("At least one element is required.");if(M(t))t=[t];else{if(!R(t))return h.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");t=T(t)}C(t,function(t){p.removeAllListeners(t),g.uninstall(t),_.cleanState(t)})}}}({strategy:"scroll"}),A=function(o){function t(){for(var t,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return(t=o.call.apply(o,[this].concat(n))||this).resizeRef=g.createRef(),t}r(t,o);var e=t.prototype;return e.componentDidMount=function(){this._calculateSize()},e.componentDidUpdate=function(t){var e=this.props;t.width===e.width&&t.height===e.height||this._calculateSize()},e.componentWillUnmount=function(){this._resizeNode&&(D.uninstall(this._resizeNode),this._resizeNode=void 0)},e._calculateSize=function(){var t,e=this,n=this.props,i=n.width,o=n.height,r=n.onResize;if(i<0||o<0){if(!this._resizeNode){var a=this.resizeRef.current;if(!a)return;return void D.listenTo(this._resizeNode=a,function(){return e._calculateSize()})}t=s(this._resizeNode)}else this._resizeNode&&(D.uninstall(this._resizeNode),this._resizeNode=void 0),t={width:i,height:o};r(t)},e.render=function(){var t=this.props,e=t.width,n=t.height,i=t.style,o=t.children,r=p(t,["width","height","onResize","style","children"]),a=m({position:"absolute",width:e<0?"auto":e,height:n<0?"auto":n},i);return g.createElement("div",m({},r,{ref:this.resizeRef,style:a}),"function"==typeof o?o(this):o)},t}(g.PureComponent);function P(t,e,n){if(n){var i,o="y"===n?["y","height"]:["x","width"],r=o[0],a=o[1],s=Math.max(t[r],e[r]),c=Math.min(t[r]+t[a],e[r]+e[a]);return(i={})[r]=s-t[r],i[a]=Math.max(0,c-s),i}return m({},P(t,e,"x"),P(t,e,"y"))}function L(t,e,n){if(n){var i="y"===n?["y","height"]:["x","width"],o=i[0],r=i[1],a=t[o]-e[o];return-.25*e[r]<a+t[r]&&a<1.25*e[r]}return L(t,e,"x")&&L(t,e,"y")}A.defaultProps={width:-1,height:-1,onResize:function(){}};var k=function(o){function t(){for(var t,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return(t=o.call.apply(o,[this].concat(n))||this).state={size:{width:0,height:0},layoutAttrs:[],count:{row:0,column:0}},t}r(t,o);var e=t.prototype;return e.componentDidMount=function(){this._calculateLayout()},e.componentDidUpdate=function(t){var e=this.props;t.direction===e.direction&&t.width===e.width&&t.height===e.height&&t.rowSpacing===e.rowSpacing&&t.columnSpacing===e.columnSpacing&&t.itemCount===e.itemCount&&t.itemWidth===e.itemWidth&&t.itemHeight===e.itemHeight||this._calculateLayout()},e.getSize=function(){return this.state.size},e.getCount=function(){return this.state.count},e.getItemRect=function(t){var e,n,i,o=t.itemIndex,r=t.rowIndex,a=t.columnIndex,s=this.state;void 0!==r&&void 0!==a&&(o=(e={row:r,column:a})[i=(n="x"===this.props.direction?["column","row"]:["row","column"])[1]]+e[n[0]]*s.count[i]);var c=s.layoutAttrs[o];return c?c.rect:null},e._calculateLayout=function(){this.setState(function(t,e){var n=e.onResize,i=function(t,e,n,i,o){var r,a,s="x"===o?["y","x","height","width","column","row"]:["x","y","width","height","row","column"],c=s[0],l=s[1],d=s[2],u=s[3],h=s[4],f=s[5],g=i[d],p=0,v=0,m=0,y=[];g<0?(g=e*t[d],1<e&&(g+=(e-1)*n[f]),m=e):0===t[d]&&0===n[f]?m=e:(m=1,t[d]<g&&(m+=Math.floor((g-t[d])/(t[d]+n[f]))));0<m&&(v=Math.ceil(e/m));for(var b=0;b<v;b++){0<b&&(p+=n[h]);for(var w=0;w<m;w++){var x,z,S=w+b*m,_=0;if(1<m&&(_+=Math.round(w*((g-t[d])/(m-1)))),S<e)y.push(((z={rect:(x={},x[c]=_,x[l]=p,x[d]=t[d],x[u]=t[u],x)})[h+"Index"]=b,z[f+"Index"]=w,z.itemIndex=S,z))}p+=t[u]}return{count:(r={},r[h]=v,r[f]=m,r),size:(a={},a[d]=g,a[u]=p,a),layoutAttrs:y}}({width:e.itemWidth,height:e.itemHeight},e.itemCount,{row:e.rowSpacing,column:e.columnSpacing},{width:e.width,height:e.height},e.direction);return t.size.width===i.size.width&&t.size.height===i.size.height||n(i.size),i})},e._renderItem=function(t,e){var n=(0,this.props.renderItem)(m({},t,{visibleRect:e})),i=n.type,o=n.props,r=o.style,a=p(o,["style"]),s=n.key||t.itemIndex,c=m({position:"absolute",left:t.rect.x,top:t.rect.y,width:t.rect.width,height:t.rect.height},r);return g.createElement(i,m({},a,{key:s,style:c}))},e.render=function(){for(var t=this.props,e=t.itemCount,n=t.visibleRect,i=this.state.layoutAttrs,o=[],r=0;r<e;r++){var a=i[r];a&&L(a.rect,n)&&o.push(this._renderItem(a,P(a.rect,n)))}return o},t}(g.PureComponent);k.defaultProps={direction:"y",width:-1,height:-1,rowSpacing:0,columnSpacing:0,itemCount:0,itemWidth:0,itemHeight:0,renderItem:function(){return null},visibleRect:{x:0,y:0,width:0,height:0},onResize:function(){}};var W=function(o){function t(){for(var t,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return(t=o.call.apply(o,[this].concat(n))||this).resizeRef=g.createRef(),t}r(t,o);var e=t.prototype;return e.componentDidMount=function(){this._calculateSize()},e.componentDidUpdate=function(t){var e=this.props;t.width===e.width&&t.height===e.height&&t.hash===e.hash||this._calculateSize()},e._calculateSize=function(){var t=this.props,e=t.width,n=t.height,i=t.hash;(0,t.onResize)(e<0||n<0?(0,t.getSizeByHash)(i)||s(this.resizeRef.current):{width:e,height:n},i)},e.render=function(){var t=this.props,e=t.width,n=t.height,i=t.style,o=t.children,r=p(t,["width","height","hash","getSizeByHash","onResize","style","children"]),a=m({position:"absolute",width:e<0?"auto":e,height:n<0?"auto":n},i);return g.createElement("div",m({},r,{ref:this.resizeRef,style:a}),"function"==typeof o?o(this):o)},t}(g.PureComponent);W.defaultProps={width:-1,height:-1,hash:"Item",getSizeByHash:function(){return null},onResize:function(){}};var H=function(o){function t(){for(var t,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return(t=o.call.apply(o,[this].concat(n))||this).state={size:{width:0,height:0},layoutAttrs:[],itemHashList:[],itemSizeDict:{}},t}r(t,o);var e=t.prototype;return e.componentDidMount=function(){this._calculateLayout()},e.componentDidUpdate=function(t){var e=this.props;t.direction===e.direction&&t.width===e.width&&t.height===e.height&&t.spacing===e.spacing&&t.itemCount===e.itemCount&&t.estimatedItemWidth===e.estimatedItemWidth&&t.estimatedItemHeight===e.estimatedItemHeight||this._calculateLayout()},e.getSize=function(){return this.state.size},e.getItemRect=function(t){var e=this.state.layoutAttrs[t.itemIndex];return e?e.rect:null},e._calculateLayout=function(g,p,v){this.setState(function(t,e){var n=e.direction,i=e.spacing,o=e.itemCount,r=e.estimatedItemWidth,a=e.estimatedItemHeight,s=e.onResize,c=t.itemHashList,l=t.itemSizeDict,d=c,u=l;if(void 0!==g){var h;if(d[g]===p)return null;u=m({},u,((h={})[(d=[].concat(d))[g]=p]=v,h))}var f=function(t,e,n,i,o,r){for(var a,s="x"===r?["y","x","height","width"]:["x","y","width","height"],c=s[0],l=s[1],d=s[2],u=s[3],h=0,f=0,g=[],p=0;p<i;p++){var v;0<p&&(f+=o);var m=e[p],y=n[m]||t;g.push({rect:(v={},v[c]=0,v[l]=f,v[d]=y[d],v[u]=y[u],v),itemIndex:p}),f+=y[u],h<y[d]&&(h=y[d])}return{size:(a={},a[d]=h,a[u]=f,a),layoutAttrs:g}}({width:r,height:a},d,u,o,i,n);return d!==c&&(f.itemHashList=d),u!==l&&(f.itemSizeDict=u),t.size.width===f.size.width&&t.size.height===f.size.height||s(f.size),f})},e._renderItem=function(n,t){var i=this,e=this.props,o=e.direction,r=e.width,a=e.height,s=this.state.itemSizeDict,c=(0,e.renderItem)(m({},n,{visibleRect:t,Item:W})),l=c.key||n.itemIndex,d={position:"absolute",left:n.rect.x,top:n.rect.y,width:n.rect.width,height:n.rect.height};c.type!==W&&(c=g.createElement(W,{hash:l},c));var u=c.props,h=u.onResize,f=p(u,["onResize"]);return f.onResize=function(t,e){i._calculateLayout(n.itemIndex,e,t),h(t)},f.getSizeByHash=function(t){return s[t]},"x"===o?f.height=a:f.width=r,g.createElement("div",{key:l,style:d},g.createElement(W,f))},e.render=function(){for(var t=this.props,e=t.itemCount,n=t.visibleRect,i=this.state.layoutAttrs,o=[],r=0;r<e;r++){var a=i[r];a&&L(a.rect,n)&&o.push(this._renderItem(a,P(a.rect,n)))}return o},t}(g.PureComponent);H.defaultProps={direction:"y",width:-1,height:-1,spacing:0,itemCount:0,estimatedItemWidth:0,estimatedItemHeight:0,renderItem:function(){return null},visibleRect:{x:0,y:0,width:0,height:0},onResize:function(){}};var N=function(o){function t(){for(var t,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return(t=o.call.apply(o,[this].concat(n))||this).state={size:{width:0,height:0}},t.resizeRef=g.createRef(),t}r(t,o);var e=t.prototype;return e.componentDidMount=function(){this._calculateSize()},e.componentDidUpdate=function(t){t.width===this.props.width&&t.height===this.props.height||this._calculateSize()},e.componentWillUnmount=function(){this._resizeNode&&(D.uninstall(this._resizeNode),this._resizeNode=void 0)},e._calculateSize=function(){var t,e=this,n=this.props,i=n.width,o=n.height;if(i<0||o<0){if(!this._resizeNode){var r=this.resizeRef.current;if(!r)return;return void D.listenTo(this._resizeNode=r,function(){return e._calculateSize()})}t=s(this._resizeNode)}else this._resizeNode&&(D.uninstall(this._resizeNode),this._resizeNode=void 0),t={width:i,height:o};this.setState({size:t})},e.render=function(){var t=this.props,e=t.width,n=t.height;return g.createElement("div",{ref:this.resizeRef,style:{width:e<0?"100%":e,height:n<0?"100%":n}},(0,t.children)(this.state.size))},t}(g.Component);N.defaultProps={children:function(){return null},width:-1,height:-1};var B=function(e){function t(t){var s;return(s=e.call(this,t)||this)._onPadResize=function(t){var e=s.props,n=e.onResize,i=s.state.pageCount,o=j({direction:e.direction,size:t,contentSize:s.padRef.current.getContentSize()});o!==i&&s.setState({pageCount:o}),n&&n(t)},s._onPadContentResize=function(t){var e=s.props,n=e.onContentResize,i=s.state.pageCount,o=j({direction:e.direction,size:s.padRef.current.getSize(),contentSize:t});o!==i&&s.setState({pageCount:o}),n&&n(t)},s._onPadScroll=function(t){var e=t.dragging,n=t.decelerating,i=s.props,o=i.onScroll,r="x"===i.direction?["x","width"]:["y","height"],a={activeIndex:Math.abs(Math.floor(t.contentOffset[r[0]]/t.size[r[1]]))};s.state.dragging!==e&&(a.dragging=e),s.state.decelerating!==n&&(a.decelerating=n),s.setState(a),o&&o(t)},s._onMouseEnter=function(){s.setState({mouseEntered:!0})},s._onMouseLeave=function(){s.setState({mouseEntered:!1})},s.state={pageCount:0,activeIndex:0,dragging:!1,decelerating:!1,mouseEntered:!1},s.padRef=g.createRef(),s}r(t,e);var n=t.prototype;return n.componentDidMount=function(){var t=this.props,e=t.autoplayEnabled,n=this.padRef.current,i=j({direction:t.direction,size:n.getSize(),contentSize:n.getContentSize()});this.setState({pageCount:i}),e&&this.play()},n.componentDidUpdate=function(t,e){var n=this.props,i=n.direction,o=n.autoplayEnabled,r=this.state,a=r.pageCount,s=r.activeIndex,c=r.dragging,l=r.decelerating,d=r.mouseEntered;if(t.direction!==i||t.width!==n.width||t.contentWidth!==n.contentWidth||t.height!==n.height||t.contentHeight!==n.contentHeight){var u=this.padRef.current,h=(u.getSize(),u.getContentSize(),j(i));h!==a&&this.setState({pageCount:h})}t.autoplayEnabled===o&&e.dragging===c&&e.decelerating===l&&e.activeIndex===s&&e.mouseEntered===d||(!o||c||d||l||a<=s+1?this.pause():this.play())},n.componentWillUnmount=function(){this.pause()},n.getPageCount=function(){return this.state.pageCount},n.getActiveIndex=function(){return this.state.activeIndex},n.play=function(){var t=this,e=this.props.autoplayInterval;this._autoplayTimer&&(this.forward(),clearTimeout(this._autoplayTimer)),this._autoplayTimer=setTimeout(function(){t.play()},e)},n.pause=function(){this._autoplayTimer&&(clearTimeout(this._autoplayTimer),this._autoplayTimer=void 0)},n.setFrame=function(t,e){void 0===e&&(e=!0);var n=this.props.direction,i=this.padRef.current,o=i.getContentOffset(),r=i.getSize();i.scrollTo({offset:0===t?{x:0,y:0}:{x:"x"===n?-t*r.width:o.x,y:"x"===n?o.y:-t*r.height},animated:e})},n.rewind=function(){this.setFrame(this.state.activeIndex-1)},n.forward=function(){this.setFrame(this.state.activeIndex+1)},n.render=function(){var t=this.props,e=t.direction,n=t.children,i=p(t,["direction","autoplayEnabled","autoplayInterval","children"]),o={alwaysBounceX:!1,alwaysBounceY:!1};return"x"===e?o.alwaysBounceX=!0:o.alwaysBounceY=!0,g.createElement(a,m({ref:this.padRef},i,o,{pagingEnabled:!0,onScroll:this._onPadScroll,onResize:this._onPadResize,onContentResize:this._onPadContentResize,onMouseEnter:this._onMouseEnter,onMouseLeave:this._onMouseLeave}),"function"==typeof n?n(this):n)},t}(g.PureComponent);function j(t){var e=t.size,n="x"===t.direction?"width":"height";return e[n]?Math.round(t.contentSize[n]/e[n]):0}B.defaultProps={direction:"y",autoplayEnabled:!0,autoplayInterval:3e3};var U=function(n){function t(t){var e;return(e=n.call(this,t)||this)._onPlayerFrameChange=function(t){},e.state={playerExisted:!1},e.playerRef=g.createRef(),e}r(t,n);var e=t.prototype;return e.componentDidMount=function(){this.playerRef&&this.setState({playerExisted:!0})},e.componentDidUpdate=function(t,e){},e.componentWillUnmount=function(){},e.slideTo=function(t){},e.slidePrev=function(){},e.slideNext=function(){},e.render=function(){var t=this.props,r=t.loop,a=t.children,s=p(t,["loop","children"]);return g.createElement(B,m({ref:this.playerRef},s),function(t){if(r){var e=t.padRef.current,n=s.direction,i=e?e.getContentSize():{width:s.contentWidth,height:s.conte},o=e?e.getVisibleRect():{x:0,y:0,width:0,height:0};return g.createElement(H,{direction:n,height:i.height,estimatedItemWidth:i.width,estimatedItemHeight:i.height,itemCount:2,renderItem:function(){return g.createElement("div",{style:{position:"relative",width:i.width,height:i.height}},a)},visibleRect:o,onResize:function(t){return e.setContentSize(t)}})}return a})},t}(g.PureComponent);U.defaultProps={direction:"y",loop:!0},t.Pad=a,t.Pannable=h,t.GeneralContent=A,t.GridContent=k,t.ListContent=H,t.ItemContent=W,t.AutoResizing=N,t.Player=B,t.Carousel=U,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e((t=t||self).ReactPannable={},t.React)}(this,function(t,g){"use strict";function p(t,e){if(null==t)return{};var n,i,o={},r=Object.keys(t);for(i=0;i<r.length;i++)e.indexOf(n=r[i])<0&&(o[n]=t[n]);return o}function m(){return(m=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function r(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}g=g&&g.hasOwnProperty("default")?g.default:g;var e,u={create:function(t){var e,n=t.transformTranslate;return m({},p(t,["transformTranslate"]),(e=n)?{transform:"translate3d("+e[0]+"px, "+e[1]+"px, 0)",WebkitTransform:"translate3d("+e[0]+"px, "+e[1]+"px, 0)",msTransform:"translate("+e[0]+"px, "+e[1]+"px)"}:null)}},h=function(i){function t(){for(var o,t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return(o=i.call.apply(i,[this].concat(e))||this).state={target:null,translation:null,interval:null,velocity:null,startPoint:null,movePoint:null,moveTime:null},o.elemRef=g.createRef(),o._onTouchStart=function(t){var e=o.props,n=e.onTouchStart;t.touches&&1===t.touches.length&&e.enabled&&o._track(t.touches[0]),n&&n(t)},o._onTouchMove=function(t){var e=o.props.onTouchMove;t.touches&&1===t.touches.length&&o._move(t.touches[0]),e&&e(t)},o._onTouchEnd=function(t){var e=o.props.onTouchEnd;t.changedTouches&&1===t.changedTouches.length&&o._end(),e&&e(t)},o._onTouchCancel=function(t){var e=o.props.onTouchCancel;t.changedTouches&&1===t.changedTouches.length&&o._end(),e&&e(t)},o._onMouseDown=function(t){var e=o.props,n=e.enabled,i=e.onMouseDown;(o._shouldPreventClick=n)&&(o._removeMousePanListener(),o._addMousePanListener(),o._track(t)),i&&i(t)},o._onMouseMove=function(t){t.preventDefault(),o._move(t)},o._onMouseUp=function(t){t.preventDefault(),o._removeMousePanListener(),o._end()},o._onClick=function(t){var e=o.props.onClick;o._shouldPreventClick&&t.preventDefault(),o._shouldPreventClick=!1,e&&e(t)},o}r(t,i);var e=t.prototype;return e.componentDidUpdate=function(t){var e=this.props.enabled;t.enabled===e||e||this._cancel()},e.componentWillUnmount=function(){this._removeMousePanListener()},e._track=function(t){this.setState({startPoint:{x:t.pageX,y:t.pageY},movePoint:{x:t.pageX,y:t.pageY},moveTime:(new Date).getTime()})},e._move=function(p){p={target:p.target,pageX:p.pageX,pageY:p.pageY},this.setState(function(t,e){var n=e.shouldStart,i=e.onStart,o=e.onMove,r=t.target,a=t.startPoint,s=t.movePoint,c=t.moveTime;if(!a)return null;var l=(new Date).getTime(),d={x:p.pageX,y:p.pageY},u=l-c,h={x:d.x-a.x,y:d.y-a.y},f={x:(d.x-s.x)/u,y:(d.y-s.y)/u},g={translation:h,velocity:f,interval:u,movePoint:d,moveTime:l};r?o({target:r,translation:h,velocity:f,interval:u}):0<Math.sqrt(h.x*h.x+h.y*h.y)&&n({target:p.target,translation:h,velocity:f,interval:u})&&(g.target=p.target,g.startPoint={x:p.pageX,y:p.pageY},g.translation=h={x:0,y:0},i({target:p.target,translation:h,velocity:f,interval:u}));return g})},e._end=function(){this.setState(function(t,e){var n=t.target;return n&&e.onEnd({target:n,translation:t.translation,velocity:t.velocity,interval:t.interval}),{target:null,translation:null,velocity:null,interval:null,startPoint:null,movePoint:null,moveTime:null}})},e._cancel=function(){this.setState(function(t,e){var n=t.target;return n&&e.onCancel({target:n,translation:t.translation,velocity:t.velocity,interval:t.interval}),{target:null,translation:null,velocity:null,interval:null,startPoint:null,movePoint:null,moveTime:null}})},e._addMousePanListener=function(){var t=document.documentElement;t.addEventListener("mousemove",this._onMouseMove,!1),t.addEventListener("mouseup",this._onMouseUp,!1)},e._removeMousePanListener=function(){var t=document.documentElement;t.removeEventListener("mousemove",this._onMouseMove,!1),t.removeEventListener("mouseup",this._onMouseUp,!1)},e.render=function(){var t=this.props,e=t.enabled,n=t.style,i=p(t,["enabled","shouldStart","onStart","onMove","onEnd","onCancel","style"]),o=u.create(m({touchAction:e?"none":"auto"},n));return g.createElement("div",m({},i,{ref:this.elemRef,style:o,onTouchStart:this._onTouchStart,onTouchEnd:this._onTouchEnd,onTouchMove:this._onTouchMove,onTouchCancel:this._onTouchCancel,onMouseDown:this._onMouseDown,onClick:this._onClick}))},t}(g.PureComponent);h.defaultProps={enabled:!0,shouldStart:function(){return!0},onStart:function(){},onMove:function(){},onEnd:function(){},onCancel:function(){}};var v=(e="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}).requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.msRequestAnimationFrame||e.setTimeout&&function(t){return e.setTimeout(t,20)}||function(){},y=e.cancelAnimationFrame||e.webkitCancelAnimationFrame||e.mozCancelAnimationFrame||e.clearTimeout||function(){};function f(t,e){var n=e.x,i=e.y,o=Math.sqrt(n*n+i*i);return 0===o?{x:0,y:0}:{x:t*(n/o),y:t*(i/o)}}function w(t,e,n,i,o){if(o){var r="y"===o?["y","height"]:["x","width"],a=r[0],s=r[1],c=Math.min(e[s]-n[s],0),l=t[a];return 0<l?l=0:l<c?(l=c,i&&0<e[s]&&(l=e[s]*Math.ceil(l/e[s]))):i&&0<e[s]&&(l=e[s]*Math.round(l/e[s])),l}return{x:w(t,e,n,i,"x"),y:w(t,e,n,i,"y")}}function x(t,e,n,i,o,r){if(r){var a="y"===r?["y","height"]:["x","width"],s=a[0],c=a[1],l=t[s];return o[s]&&(l+=.5*e[s]*(e[s]/o[s])),i&&0<n[c]&&(l=n[c]*Math.round(l/n[c])),l}return"number"==typeof o&&(o=f(o,e)),{x:x(t,e,n,i,o,"x"),y:x(t,e,n,i,o,"y")}}var z=.04,a=function(n){function t(t){var e;return(e=n.call(this,t)||this)._onDragStart=function(t){var r=t.velocity;e.setState(function(t,e){var n=t.contentOffset,i=e.directionalLockEnabled?Math.abs(r.y)<Math.abs(r.x)?{x:1,y:0}:{x:0,y:1}:{x:1,y:1},o={x:i.x*r.x,y:i.y*r.y};return{contentOffset:m({},n),contentVelocity:o,dragging:!0,dragStartOffset:n,dragDirection:i,decelerating:!1}})},e._onDragMove=function(t){var a=t.translation,s=t.interval;e.setState(function(t,e){var n=t.contentOffset,i=t.dragStartOffset,o=t.dragDirection,r=function t(e,n,i,o,r){if(r){var a="y"===r?["y","height","width"]:["x","width","height"],s=a[0],c=a[1],l=a[2],d=e[s],u=Math.min(i[c]-o[c],0),h=.5*Math.min(i[c],i[l]);return 0<d?n[s]?h*(1-h/(h+d)):0:d<u?n[s]?u-h*(1-h/(h-d+u)):u:d}return{x:t(e,n,i,o,"x"),y:t(e,n,i,o,"y")}}({x:i.x+o.x*a.x,y:i.y+o.y*a.y},{x:e.alwaysBounceX,y:e.alwaysBounceY},t.size,t.contentSize);return{contentOffset:r,contentVelocity:{x:(r.x-n.x)/s,y:(r.y-n.y)/s}}})},e._onDragEnd=function(){e.setState(function(t,e){var n=t.contentOffset,i=t.size,o=t.contentSize,r=e.pagingEnabled,a=t.contentVelocity,s=z,c=function t(e,n,i,o){if(o){var r="y"===o?["y","height"]:["x","width"],a=r[0];if(!e[a])return 1;var s=e[a]<0?-1:1;return s*Math.min(s*e[a],Math.sqrt(.25*n[r[1]]*2*s*i[a]))/e[a]}"number"==typeof i&&(i=f(i,e));var c=Math.min(t(e,n,i,"x"),t(e,n,i,"y"));return{x:c*e.x,y:c*e.y}}(a,i,z);if(c.x===a.x&&c.y===a.y||(a=c),!r){var l=w(n,i,o,!1);l.x===n.x&&l.y===n.y&&(s=.004)}var d=x(n,a,i,r,s);return{contentOffset:m({},n),contentVelocity:a,dragging:!1,decelerating:!0,decelerationEndOffset:d,decelerationRate:s}})},e._onDragCancel=function(){e.setState(function(t,e){var n=t.contentOffset,i=t.dragStartOffset;return e.pagingEnabled&&(i=w(i,t.size,t.contentSize,!0)),{contentOffset:m({},n),dragging:!1,decelerating:!0,decelerationEndOffset:i,decelerationRate:z}})},e.state={prevContentOffset:null,contentOffset:{x:0,y:0},contentVelocity:{x:0,y:0},size:{width:t.width,height:t.height},contentSize:{width:t.contentWidth,height:t.contentHeight},dragging:!1,dragStartOffset:null,dragDirection:null,decelerating:!1,decelerationEndOffset:null,decelerationRate:z},e.boundingRef=g.createRef(),e.contentRef=g.createRef(),e.setContentSize=e.setContentSize.bind(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(e)),e}r(t,n),t.getDerivedStateFromProps=function(t,e){var n=t.pagingEnabled,i=e.prevContentOffset,o=e.contentOffset,r=e.contentVelocity,a=e.size,s=e.contentSize,c=e.dragging,l=e.decelerating,d=e.decelerationEndOffset,u=e.decelerationRate,h={};if(i!==o){var f=l,g=u,p=d;if(f){var v=w(i,a,s,!1),m=w(o,a,s,!1);if(g!==z&&(v.x===i.x&&m.x!==o.x||v.y===i.y&&m.y!==o.y)){var y=x(o,r,a,n,z);y.x===p.x&&y.y===p.y||(g=z,p=y)}if(p.x===o.x&&p.y===o.y&&0===r.x&&0===r.y){var b=w(o,a,s,n);b.x!==p.x||b.y!==p.y?(g=z,p=b):f=!1}}h.prevContentOffset=o,f!==l&&(h.decelerating=f),g!==u&&(h.decelerationRate=g),p!==d&&(h.decelerationEndOffset=p),t.onScroll({contentOffset:o,contentVelocity:r,size:a,contentSize:s,dragging:c,decelerating:f})}return h};var e=t.prototype;return e.componentDidUpdate=function(t,e){var n=this,i=this.props,o=i.width,r=i.height,a=i.contentWidth,s=i.contentHeight,c=i.pagingEnabled,l=i.onResize,d=i.onContentResize;if(t.width!==o||t.height!==r){var u={width:o,height:r};this._setStateWithScroll({size:u}),l(u)}if(t.contentWidth!==a||t.contentHeight!==s){var h={width:a,height:s};this._setStateWithScroll({contentSize:h}),d(h)}if(t.pagingEnabled!==c&&c&&this._setStateWithScroll(null),e.contentOffset!==this.state.contentOffset&&this.state.decelerating){var f=(new Date).getTime();this._deceleratingTimer&&y(this._deceleratingTimer),this._deceleratingTimer=v(function(){n._deceleratingTimer=void 0,n._decelerate((new Date).getTime()-f)})}},e.componentWillUnmount=function(){this._deceleratingTimer&&(y(this._deceleratingTimer),this._deceleratingTimer=void 0)},e.getSize=function(){return this.state.size},e.getContentSize=function(){return this.state.contentSize},e.getContentOffset=function(){return this.state.contentOffset},e.isDragging=function(){return this.state.dragging},e.isDecelerating=function(){return this.state.decelerating},e.getVisibleRect=function(){var t=this.state,e=t.contentOffset,n=t.size;return{x:-e.x,y:-e.y,width:n.width,height:n.height}},e.setContentSize=function(t){this._setStateWithScroll({contentSize:t}),this.props.onContentResize(t)},e.scrollToRect=function(t){var e=t.rect,n=t.align,i=void 0===n?"auto":n;this._setContentOffset(function(t){return function t(e,n,i,o,r){if(r){var a="y"===r?["y","height"]:["x","width"],s=a[0],c=a[1],l=-e[s],d=o[c]-e[c];if("auto"===n[s]){var u=d<0?-1:1;l+=u*Math.max(0,Math.min(u*(i[s]-l),u*d))}else"start"===n[s]?n[s]=0:"center"===n[s]?n[s]=.5:"end"===n[s]&&(n[s]=1),("number"!=typeof n[s]||isNaN(n[s]))&&(n[s]=.5),l+=n[s]*d;return l}return"object"!=typeof n&&(n={x:n,y:n}),{x:t(e,n,i,o,"x"),y:t(e,n,i,o,"y")}}(e,i,t.contentOffset,t.size)},t.animated)},e.scrollTo=function(t){this._setContentOffset(t.offset,t.animated)},e._setContentOffset=function(i,o){this.setState(function(t,e){"function"==typeof i&&(i=i(t,e));var n=t.contentOffset;return t.dragging?null:(i=w(i,t.size,t.contentSize,e.pagingEnabled),o?{contentOffset:m({},n),decelerating:!0,decelerationEndOffset:i,decelerationRate:z}:{contentOffset:i,contentVelocity:{x:0,y:0},decelerating:!1})})},e._setStateWithScroll=function(o){this.setState(function(t,e){var n=t.contentOffset;if(t.dragging)return o;var i=w(n,t.size,t.contentSize,e.pagingEnabled);return i.x===n.x&&i.y===n.y?o:m({},o,{contentOffset:m({},n),decelerating:!0,decelerationEndOffset:i,decelerationRate:z})})},e._decelerate=function(n){this.setState(function(t){if(!t.decelerating)return null;var e=function t(e,n,i,o,r,a){if(a){var s,c=("y"===a?["y"]:["x"])[0],l=o[c],d=i[c];if(n[c]){var u=(n[c]<0?-1:1)*Math.sqrt(.5*d*d+n[c]*(r[c]-l)),h=(u-d)/n[c];h<0&&(u=d,h=0),(2*u-d)/n[c]<e?(d=0,l=r[c]):l+=.5*(i[c]+u)*h-.5*(u+(d=u-n[c]*Math.abs(h-e)))*(h-e)}else l+=d*e;return(s={})[c+"Offset"]=l,s[c+"Velocity"]=d,s}return"number"==typeof n&&(n=f(n,{x:r.x-o.x,y:r.y-o.y})),m({},t(e,n,i,o,r,"x"),t(e,n,i,o,r,"y"))}(n,t.decelerationRate,t.contentVelocity,t.contentOffset,t.decelerationEndOffset);return{contentOffset:{x:e.xOffset,y:e.yOffset},contentVelocity:{x:e.xVelocity,y:e.yVelocity}}})},e.render=function(){var t=this.props,e=t.scrollEnabled,n=t.style,i=t.children,o=p(t,["width","height","contentWidth","contentHeight","scrollEnabled","pagingEnabled","directionalLockEnabled","alwaysBounceX","alwaysBounceY","onScroll","onResize","onContentResize","style","children"]),r=this.state,a=r.size,s=r.contentSize,c=r.contentOffset,l=u.create(m({overflow:"hidden",position:"relative",boxSizing:"border-box",width:a.width,height:a.height},n)),d=u.create({position:"relative",boxSizing:"border-box",width:s.width,height:s.height,transformTranslate:[c.x,c.y]});return g.createElement(h,m({},o,{ref:this.boundingRef,style:l,enabled:e,onStart:this._onDragStart,onMove:this._onDragMove,onEnd:this._onDragEnd,onCancel:this._onDragCancel}),g.createElement("div",{ref:this.contentRef,style:d},"function"==typeof i?i(this):i))},t}(g.PureComponent);function s(t){var e=window.getComputedStyle(t)||{},n=t.offsetWidth||0,i=t.offsetHeight||0;return e.paddingLeft&&(n-=parseInt(e.paddingLeft,10)),e.paddingRight&&(n-=parseInt(e.paddingRight,10)),e.borderLeftWidth&&(n-=parseInt(e.borderLeftWidth,10)),e.borderRightWidth&&(n-=parseInt(e.borderRightWidth,10)),e.paddingTop&&(i-=parseInt(e.paddingTop,10)),e.paddingBottom&&(i-=parseInt(e.paddingBottom,10)),e.borderTopWidth&&(i-=parseInt(e.borderTopWidth,10)),e.borderBottomWidth&&(i-=parseInt(e.borderBottomWidth,10)),{width:n,height:i}}function n(t,e){return t(e={exports:{}},e.exports),e.exports}a.defaultProps={children:null,width:0,height:0,contentWidth:0,contentHeight:0,scrollEnabled:!0,pagingEnabled:!1,directionalLockEnabled:!1,alwaysBounceX:!0,alwaysBounceY:!0,onScroll:function(){},onResize:function(){},onContentResize:function(){}};var i=n(function(t){(t.exports={}).forEach=function(t,e){for(var n=0;n<t.length;n++){var i=e(t[n]);if(i)return i}}}),b=n(function(t){var e=t.exports={};e.isIE=function(t){return(-1!=(e=navigator.userAgent.toLowerCase()).indexOf("msie")||-1!=e.indexOf("trident")||-1!=e.indexOf(" edge/"))&&(!t||t===function(){for(var t=3,e=document.createElement("div"),n=e.getElementsByTagName("i");e.innerHTML="\x3c!--[if gt IE "+ ++t+"]><i></i><![endif]--\x3e",n[0];);return 4<t?t:void 0}());var e},e.isLegacyOpera=function(){return!!window.opera}}),l=n(function(t){(t.exports={}).getOption=function(t,e,n){var i=t[e];return null!=i||void 0===n?i:n}}),S=function(t){var e=(t=t||{}).reporter,n=l.getOption(t,"async",!0),i=l.getOption(t,"auto",!0);i&&!n&&(e&&e.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true."),n=!0);var o,r=d(),a=!1;function s(){for(a=!0;r.size();){var t=r;r=d(),t.process()}a=!1}function c(){o=setTimeout(s,0)}return{add:function(t,e){!a&&i&&n&&0===r.size()&&c(),r.add(t,e)},force:function(t){a||(void 0===t&&(t=n),o&&(clearTimeout(o),o=null),t?c():s())}}};function d(){var i={},n=0,o=0,r=0;return{add:function(t,e){e||(e=t,t=0),o<t?o=t:t<r&&(r=t),i[t]||(i[t]=[]),i[t].push(e),n++},process:function(){for(var t=r;t<=o;t++)for(var e=i[t],n=0;n<e.length;n++)(0,e[n])()},size:function(){return n}}}var o="_erd";function c(t){return t[o]}var _={initState:function(t){return t[o]={},c(t)},getState:c,cleanState:function(t){delete t[o]}},I=i.forEach,E=function(t){var x=(t=t||{}).reporter,z=t.batchProcessor,S=t.stateHandler.getState,_=t.idHandler;if(!z)throw Error("Missing required dependency: batchProcessor");if(!x)throw Error("Missing required dependency: reporter.");var E=function(){var t=document.createElement("div");t.style.cssText="position: absolute; width: 1000px; height: 1000px; visibility: hidden; margin: 0; padding: 0;";var e=document.createElement("div");e.style.cssText="position: absolute; width: 500px; height: 500px; overflow: scroll; visibility: none; top: -1500px; left: -1500px; visibility: hidden; margin: 0; padding: 0;",e.appendChild(t),document.body.insertBefore(e,document.body.firstChild);var n=500-e.clientWidth,i=500-e.clientHeight;return document.body.removeChild(e),{width:n,height:i}}(),C="erd_scroll_detection_container";function R(t,e,n){if(t.addEventListener)t.addEventListener(e,n);else{if(!t.attachEvent)return x.error("[scroll] Don't know how to add event listeners.");t.attachEvent("on"+e,n)}}function n(t,e,n){if(t.removeEventListener)t.removeEventListener(e,n);else{if(!t.detachEvent)return x.error("[scroll] Don't know how to remove event listeners.");t.detachEvent("on"+e,n)}}function T(t){return S(t).container.childNodes[0].childNodes[0].childNodes[0]}function M(t){return S(t).container.childNodes[0].childNodes[0].childNodes[1]}return function(i,t){if(!document.getElementById(i)){var e=t+"_animation",n=t+"_animation_active",o="/* Created by the element-resize-detector library. */\n";o+="."+t+" > div::-webkit-scrollbar { display: none; }\n\n",o+="."+n+" { -webkit-animation-duration: 0.1s; animation-duration: 0.1s; -webkit-animation-name: "+e+"; animation-name: "+e+"; }\n",o+="@-webkit-keyframes "+e+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }\n",function(t,e){e=e||function(t){document.head.appendChild(t)};var n=document.createElement("style");n.innerHTML=t,n.id=i,e(n)}(o+="@keyframes "+e+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }")}}("erd_scroll_detection_scrollbar_style",C),{makeDetectable:function(a,v,t){function m(){if(a.debug){var t=Array.prototype.slice.call(arguments);if(t.unshift(_.get(v),"Scroll: "),x.log.apply)x.log.apply(null,t);else for(var e=0;e<t.length;e++)x.log(t[e])}}function s(t){var e=S(t).container.childNodes[0],n=window.getComputedStyle(e);return!n.width||-1==n.width.indexOf("px")}function e(){var t=window.getComputedStyle(v),e={};return e.position=t.position,e.width=v.offsetWidth,e.height=v.offsetHeight,e.top=t.top,e.right=t.right,e.bottom=t.bottom,e.left=t.left,e.widthCSS=t.width,e.heightCSS=t.height,e}function n(){if(m("storeStyle invoked."),S(v)){var t=e();S(v).style=t}else m("Aborting because element has been uninstalled")}function c(t,e,n){S(t).lastWidth=e,S(t).lastHeight=n}function l(){return 2*E.width+1}function d(){return 2*E.height+1}function u(t){return t+10+l()}function h(t){return t+10+d()}function f(t,e,n){var i=T(t),o=M(t),r=u(e),a=h(n),s=2*e+l(),c=2*n+d();i.scrollLeft=r,i.scrollTop=a,o.scrollLeft=s,o.scrollTop=c}function y(){var t=S(v).container;if(!t){(t=document.createElement("div")).className=C,t.style.cssText="visibility: hidden; display: inline; width: 0px; height: 0px; z-index: -1; overflow: hidden; margin: 0; padding: 0;",(S(v).container=t).className+=" "+C+"_animation_active",v.appendChild(t);var e=function(){S(v).onRendered&&S(v).onRendered()};R(t,"animationstart",e),S(v).onAnimationStart=e}return t}function i(){if(m("Injecting elements"),S(v)){!function(){var t=S(v).style;if("static"===t.position){v.style.position="relative";var e=function(t,e,n,i){var o=n[i];"auto"!==o&&"0"!==o.replace(/[^-\d\.]/g,"")&&(t.warn("An element that is positioned static has style."+i+"="+o+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+i+" will be set to 0. Element: ",e),e.style[i]=0)};e(x,v,t,"top"),e(x,v,t,"right"),e(x,v,t,"bottom"),e(x,v,t,"left")}}();var t=S(v).container;t||(t=y());var e,n,i,o,r=E.width,a=E.height,s="position: absolute; flex: none; overflow: hidden; z-index: -1; visibility: hidden; left: "+(e=(e=-(1+r))?e+"px":"0")+"; top: "+(n=(n=-(1+a))?n+"px":"0")+"; right: "+(o=(o=-r)?o+"px":"0")+"; bottom: "+(i=(i=-a)?i+"px":"0")+";",c=document.createElement("div"),l=document.createElement("div"),d=document.createElement("div"),u=document.createElement("div"),h=document.createElement("div"),f=document.createElement("div");c.dir="ltr",c.style.cssText="position: absolute; flex: none; overflow: hidden; z-index: -1; visibility: hidden; width: 100%; height: 100%; left: 0px; top: 0px;",l.className=c.className=C,l.style.cssText=s,d.style.cssText="position: absolute; flex: none; overflow: scroll; z-index: -1; visibility: hidden; width: 100%; height: 100%;",u.style.cssText="position: absolute; left: 0; top: 0;",h.style.cssText="position: absolute; flex: none; overflow: scroll; z-index: -1; visibility: hidden; width: 100%; height: 100%;",f.style.cssText="position: absolute; width: 200%; height: 200%;",d.appendChild(u),h.appendChild(f),l.appendChild(d),l.appendChild(h),c.appendChild(l),t.appendChild(c),R(d,"scroll",g),R(h,"scroll",p),S(v).onExpandScroll=g,S(v).onShrinkScroll=p}else m("Aborting because element has been uninstalled");function g(){S(v).onExpand&&S(v).onExpand()}function p(){S(v).onShrink&&S(v).onShrink()}}function o(){function i(t,e,n){var i=T(t).childNodes[0],o=u(e),r=h(n);i.style.width=o+"px",i.style.height=r+"px"}function n(t){var e=v.offsetWidth,n=v.offsetHeight;m("Storing current size",e,n),c(v,e,n),z.add(0,function(){S(v)?o()?(a.debug&&(v.offsetWidth===e&&v.offsetHeight===n||x.warn(_.get(v),"Scroll: Size changed before updating detector elements.")),i(v,e,n)):m("Aborting because element container has not been initialized"):m("Aborting because element has been uninstalled")}),z.add(1,function(){S(v)?o()?f(v,e,n):m("Aborting because element container has not been initialized"):m("Aborting because element has been uninstalled")}),t&&z.add(2,function(){S(v)?o()?t():m("Aborting because element container has not been initialized"):m("Aborting because element has been uninstalled")})}function o(){return!!S(v).container}function r(){m("notifyListenersIfNeeded invoked");var t=S(v);return void 0===S(v).lastNotifiedWidth&&t.lastWidth===t.startSize.width&&t.lastHeight===t.startSize.height?m("Not notifying: Size is the same as the start size, and there has been no notification yet."):t.lastWidth===t.lastNotifiedWidth&&t.lastHeight===t.lastNotifiedHeight?m("Not notifying: Size already notified"):(m("Current size not notified, notifying..."),t.lastNotifiedWidth=t.lastWidth,t.lastNotifiedHeight=t.lastHeight,void I(S(v).listeners,function(t){t(v)}))}function t(){if(m("Scroll detected."),s(v))m("Scroll event fired while unrendered. Ignoring...");else{var t=v.offsetWidth,e=v.offsetHeight;t!==S(v).lastWidth||e!==S(v).lastHeight?(m("Element size changed."),n(r)):m("Element size has not changed ("+t+"x"+e+").")}}if(m("registerListenersAndPositionElements invoked."),S(v)){S(v).onRendered=function(){if(m("startanimation triggered."),s(v))m("Ignoring since element is still unrendered...");else{m("Element rendered.");var t=T(v),e=M(v);0!==t.scrollLeft&&0!==t.scrollTop&&0!==e.scrollLeft&&0!==e.scrollTop||(m("Scrollbars out of sync. Updating detector elements..."),n(r))}},S(v).onExpand=t,S(v).onShrink=t;var e=S(v).style;i(v,e.width,e.height)}else m("Aborting because element has been uninstalled")}function r(){if(m("finalizeDomMutation invoked."),S(v)){var t=S(v).style;c(v,t.width,t.height),f(v,t.width,t.height)}else m("Aborting because element has been uninstalled")}function g(){t(v)}function p(){var t;m("Installing..."),S(v).listeners=[],t=e(),S(v).startSize={width:t.width,height:t.height},m("Element start size",S(v).startSize),z.add(0,n),z.add(1,i),z.add(2,o),z.add(3,r),z.add(4,g)}var b,w;t||(t=v,v=a,a=null),a=a||{},m("Making detectable..."),(w=b=v)!==w.ownerDocument.body&&!w.ownerDocument.body.contains(w)||null===window.getComputedStyle(b)?(m("Element is detached"),y(),m("Waiting until element is attached..."),S(v).onRendered=function(){m("Element is now attached"),p()}):p()},addListener:function(t,e){if(!S(t).listeners.push)throw Error("Cannot add listener to an element that is not detectable.");S(t).listeners.push(e)},uninstall:function(t){var e=S(t);e&&(e.onExpandScroll&&n(T(t),"scroll",e.onExpandScroll),e.onShrinkScroll&&n(M(t),"scroll",e.onShrinkScroll),e.onAnimationStart&&n(e.container,"animationstart",e.onAnimationStart),e.container&&t.removeChild(e.container))}}},C=i.forEach;function R(t){return Array.isArray(t)||void 0!==t.length}function T(t){if(Array.isArray(t))return t;var e=[];return C(t,function(t){e.push(t)}),e}function M(t){return t&&1===t.nodeType}function O(t,e,n){var i=t[e];return null==i&&void 0!==n?n:i}var D=function(e){var u,t,i,o,n;if((e=e||{}).idHandler)u={get:function(t){return e.idHandler.get(t,!0)},set:e.idHandler.set};else{var r=(n=1,{generate:function(){return n++}}),a=(i=(t={idGenerator:r,stateHandler:_}).idGenerator,o=t.stateHandler.getState,{get:function(t){var e=o(t);return e&&void 0!==e.id?e.id:null},set:function(t){var e=o(t);if(!e)throw Error("setId required the element to have a resize detection state.");var n=i.generate();return e.id=n}});u=a}var h=e.reporter;h||(h=function(t){function e(){}var n={log:e,warn:e,error:e};if(!t&&window.console){var i=function(t,n){t[n]=function(){var t=console[n];if(t.apply)t.apply(console,arguments);else for(var e=0;e<arguments.length;e++)t(arguments[e])}};i(n,"log"),i(n,"warn"),i(n,"error")}return n}(!1===h));var s=O(e,"batchProcessor",S({reporter:h})),f={};f.callOnAdd=!!O(e,"callOnAdd",!0),f.debug=!!O(e,"debug",!1);var c,g,p=function(i){var o={};function r(t){var e=i.get(t);return void 0===e?[]:o[e]||[]}return{get:r,add:function(t,e){var n=i.get(t);o[n]||(o[n]=[]),o[n].push(e)},removeListener:function(t,e){for(var n=r(t),i=0,o=n.length;i<o;++i)if(n[i]===e){n.splice(i,1);break}},removeAllListeners:function(t){var e=r(t);e&&(e.length=0)}}}(u),v=(c={stateHandler:_}.stateHandler.getState,{isDetectable:function(t){var e=c(t);return e&&!!e.isDetectable},markAsDetectable:function(t){c(t).isDetectable=!0},isBusy:function(t){return!!c(t).busy},markBusy:function(t,e){c(t).busy=!!e}}),l=O(e,"strategy","object"),d={reporter:h,batchProcessor:s,stateHandler:_,idHandler:u};if("scroll"===l&&(b.isLegacyOpera()?(h.warn("Scroll strategy is not supported on legacy Opera. Changing to object strategy."),l="object"):b.isIE(9)&&(h.warn("Scroll strategy is not supported on IE9. Changing to object strategy."),l="object")),"scroll"===l)g=E(d);else{if("object"!==l)throw Error("Invalid strategy name: "+l);g=function(t){var s=(t=t||{}).reporter,c=t.batchProcessor,l=t.stateHandler.getState;if(!s)throw Error("Missing required dependency: reporter.");function i(t){return l(t).object}return{makeDetectable:function(t,e,n){n||(n=e,e=t,t=null),t=t||{},b.isIE(8)?n(e):function(n,i){var o=!1,r=window.getComputedStyle(n),t=n.offsetWidth,e=n.offsetHeight;function a(){function t(){if("static"===r.position){n.style.position="relative";var t=function(t,e,n,i){var o=n[i];"auto"!==o&&"0"!==o.replace(/[^-\d\.]/g,"")&&(t.warn("An element that is positioned static has style."+i+"="+o+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+i+" will be set to 0. Element: ",e),e.style[i]=0)};t(s,n,r,"top"),t(s,n,r,"right"),t(s,n,r,"bottom"),t(s,n,r,"left")}}""!==r.position&&(t(),o=!0);var e=document.createElement("object");e.style.cssText="display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; padding: 0; margin: 0; opacity: 0; z-index: -1000; pointer-events: none;",e.tabIndex=-1,e.type="text/html",e.setAttribute("aria-hidden","true"),e.onload=function(){o||t(),function t(e,n){e.contentDocument?n(e.contentDocument):setTimeout(function(){t(e,n)},100)}(this,function(t){i(n)})},b.isIE()||(e.data="about:blank"),n.appendChild(e),l(n).object=e,b.isIE()&&(e.data="about:blank")}l(n).startSize={width:t,height:e},c?c.add(a):a()}(e,n)},addListener:function(t,e){if(!i(t))throw Error("Element is not detectable by this strategy.");function n(){e(t)}b.isIE(8)?(l(t).object={proxy:n},t.attachEvent("onresize",n)):i(t).contentDocument.defaultView.addEventListener("resize",n)},uninstall:function(t){b.isIE(8)?t.detachEvent("onresize",l(t).object.proxy):t.removeChild(i(t)),delete l(t).object}}}(d)}var m={};return{listenTo:function(t,i,o){function r(e){var t=p.get(e);C(t,function(t){t(e)})}function a(t,e,n){p.add(e,n),t&&n(e)}if(o||(o=i,i=t,t={}),!i)throw Error("At least one element required.");if(!o)throw Error("Listener required.");if(M(i))i=[i];else{if(!R(i))return h.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");i=T(i)}var s=0,c=O(t,"callOnAdd",f.callOnAdd),l=O(t,"onReady",function(){}),d=O(t,"debug",f.debug);C(i,function(t){_.getState(t)||(_.initState(t),u.set(t));var n=u.get(t);if(d&&h.log("Attaching listener to element",n,t),!v.isDetectable(t))return d&&h.log(n,"Not detectable."),v.isBusy(t)?(d&&h.log(n,"System busy making it detectable"),a(c,t,o),m[n]=m[n]||[],void m[n].push(function(){++s===i.length&&l()})):(d&&h.log(n,"Making detectable..."),v.markBusy(t,!0),g.makeDetectable({debug:d},t,function(t){if(d&&h.log(n,"onElementDetectable"),_.getState(t)){v.markAsDetectable(t),v.markBusy(t,!1),g.addListener(t,r),a(c,t,o);var e=_.getState(t);e&&e.startSize&&(e.startSize.width===t.offsetWidth&&e.startSize.height===t.offsetHeight||r(t)),m[n]&&C(m[n],function(t){t()})}else d&&h.log(n,"Element uninstalled before being detectable.");delete m[n],++s===i.length&&l()}));d&&h.log(n,"Already detecable, adding listener."),a(c,t,o),s++}),s===i.length&&l()},removeListener:p.removeListener,removeAllListeners:p.removeAllListeners,uninstall:function(t){if(!t)return h.error("At least one element is required.");if(M(t))t=[t];else{if(!R(t))return h.error("Invalid arguments. Must be a DOM element or a collection of DOM elements.");t=T(t)}C(t,function(t){p.removeAllListeners(t),g.uninstall(t),_.cleanState(t)})}}}({strategy:"scroll"}),A=function(o){function t(){for(var t,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return(t=o.call.apply(o,[this].concat(n))||this).resizeRef=g.createRef(),t}r(t,o);var e=t.prototype;return e.componentDidMount=function(){this._calculateSize()},e.componentDidUpdate=function(t){var e=this.props;t.width===e.width&&t.height===e.height||this._calculateSize()},e.componentWillUnmount=function(){this._resizeNode&&(D.uninstall(this._resizeNode),this._resizeNode=void 0)},e._calculateSize=function(){var t,e=this,n=this.props,i=n.width,o=n.height,r=n.onResize;if(i<0||o<0){if(!this._resizeNode){var a=this.resizeRef.current;if(!a)return;return void D.listenTo(this._resizeNode=a,function(){return e._calculateSize()})}t=s(this._resizeNode)}else this._resizeNode&&(D.uninstall(this._resizeNode),this._resizeNode=void 0),t={width:i,height:o};r(t)},e.render=function(){var t=this.props,e=t.width,n=t.height,i=t.style,o=t.children,r=p(t,["width","height","onResize","style","children"]),a=m({position:"absolute",width:e<0?"auto":e,height:n<0?"auto":n},i);return g.createElement("div",m({},r,{ref:this.resizeRef,style:a}),"function"==typeof o?o(this):o)},t}(g.PureComponent);function P(t,e,n){if(n){var i,o="y"===n?["y","height"]:["x","width"],r=o[0],a=o[1],s=Math.max(t[r],e[r]),c=Math.min(t[r]+t[a],e[r]+e[a]);return(i={})[r]=s-t[r],i[a]=Math.max(0,c-s),i}return m({},P(t,e,"x"),P(t,e,"y"))}function L(t,e,n){if(n){var i="y"===n?["y","height"]:["x","width"],o=i[0],r=i[1],a=t[o]-e[o];return-.25*e[r]<a+t[r]&&a<1.25*e[r]}return L(t,e,"x")&&L(t,e,"y")}A.defaultProps={width:-1,height:-1,onResize:function(){}};var W=function(o){function t(){for(var t,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return(t=o.call.apply(o,[this].concat(n))||this).state={size:{width:0,height:0},layoutAttrs:[],count:{row:0,column:0}},t}r(t,o);var e=t.prototype;return e.componentDidMount=function(){this._calculateLayout()},e.componentDidUpdate=function(t){var e=this.props;t.direction===e.direction&&t.width===e.width&&t.height===e.height&&t.rowSpacing===e.rowSpacing&&t.columnSpacing===e.columnSpacing&&t.itemCount===e.itemCount&&t.itemWidth===e.itemWidth&&t.itemHeight===e.itemHeight||this._calculateLayout()},e.getSize=function(){return this.state.size},e.getCount=function(){return this.state.count},e.getItemRect=function(t){var e,n,i,o=t.itemIndex,r=t.rowIndex,a=t.columnIndex,s=this.state;void 0!==r&&void 0!==a&&(o=(e={row:r,column:a})[i=(n="x"===this.props.direction?["column","row"]:["row","column"])[1]]+e[n[0]]*s.count[i]);var c=s.layoutAttrs[o];return c?c.rect:null},e._calculateLayout=function(){this.setState(function(t,e){var n=e.onResize,i=function(t,e,n,i,o){var r,a,s="x"===o?["y","x","height","width","column","row"]:["x","y","width","height","row","column"],c=s[0],l=s[1],d=s[2],u=s[3],h=s[4],f=s[5],g=i[d],p=0,v=0,m=0,y=[];g<0?(g=e*t[d],1<e&&(g+=(e-1)*n[f]),m=e):0===t[d]&&0===n[f]?m=e:(m=1,t[d]<g&&(m+=Math.floor((g-t[d])/(t[d]+n[f]))));0<m&&(v=Math.ceil(e/m));for(var b=0;b<v;b++){0<b&&(p+=n[h]);for(var w=0;w<m;w++){var x,z,S=w+b*m,_=0;if(1<m&&(_+=Math.round(w*((g-t[d])/(m-1)))),S<e)y.push(((z={rect:(x={},x[c]=_,x[l]=p,x[d]=t[d],x[u]=t[u],x)})[h+"Index"]=b,z[f+"Index"]=w,z.itemIndex=S,z))}p+=t[u]}return{count:(r={},r[h]=v,r[f]=m,r),size:(a={},a[d]=g,a[u]=p,a),layoutAttrs:y}}({width:e.itemWidth,height:e.itemHeight},e.itemCount,{row:e.rowSpacing,column:e.columnSpacing},{width:e.width,height:e.height},e.direction);return t.size.width===i.size.width&&t.size.height===i.size.height||n(i.size),i})},e._renderItem=function(t,e){var n=(0,this.props.renderItem)(m({},t,{visibleRect:e})),i=n.type,o=n.props,r=o.style,a=p(o,["style"]),s=n.key||t.itemIndex,c=m({position:"absolute",left:t.rect.x,top:t.rect.y,width:t.rect.width,height:t.rect.height},r);return g.createElement(i,m({},a,{key:s,style:c}))},e.render=function(){for(var t=this.props,e=t.itemCount,n=t.visibleRect,i=this.state.layoutAttrs,o=[],r=0;r<e;r++){var a=i[r];a&&L(a.rect,n)&&o.push(this._renderItem(a,P(a.rect,n)))}return o},t}(g.PureComponent);W.defaultProps={direction:"y",width:-1,height:-1,rowSpacing:0,columnSpacing:0,itemCount:0,itemWidth:0,itemHeight:0,renderItem:function(){return null},visibleRect:{x:0,y:0,width:0,height:0},onResize:function(){}};var k=function(o){function t(){for(var t,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return(t=o.call.apply(o,[this].concat(n))||this).resizeRef=g.createRef(),t}r(t,o);var e=t.prototype;return e.componentDidMount=function(){this._calculateSize()},e.componentDidUpdate=function(t){var e=this.props;t.width===e.width&&t.height===e.height&&t.hash===e.hash||this._calculateSize()},e._calculateSize=function(){var t=this.props,e=t.width,n=t.height,i=t.hash;(0,t.onResize)(e<0||n<0?(0,t.getSizeByHash)(i)||s(this.resizeRef.current):{width:e,height:n},i)},e.render=function(){var t=this.props,e=t.width,n=t.height,i=t.style,o=t.children,r=p(t,["width","height","hash","getSizeByHash","onResize","style","children"]),a=m({position:"absolute",width:e<0?"auto":e,height:n<0?"auto":n},i);return g.createElement("div",m({},r,{ref:this.resizeRef,style:a}),"function"==typeof o?o(this):o)},t}(g.PureComponent);k.defaultProps={width:-1,height:-1,hash:"Item",getSizeByHash:function(){return null},onResize:function(){}};var H=function(o){function t(){for(var t,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return(t=o.call.apply(o,[this].concat(n))||this).state={size:{width:0,height:0},layoutAttrs:[],itemHashList:[],itemSizeDict:{}},t}r(t,o);var e=t.prototype;return e.componentDidMount=function(){this._calculateLayout()},e.componentDidUpdate=function(t){var e=this.props;t.direction===e.direction&&t.width===e.width&&t.height===e.height&&t.spacing===e.spacing&&t.itemCount===e.itemCount&&t.estimatedItemWidth===e.estimatedItemWidth&&t.estimatedItemHeight===e.estimatedItemHeight||this._calculateLayout()},e.getSize=function(){return this.state.size},e.getItemRect=function(t){var e=this.state.layoutAttrs[t.itemIndex];return e?e.rect:null},e._calculateLayout=function(g,p,v){this.setState(function(t,e){var n=e.direction,i=e.spacing,o=e.itemCount,r=e.estimatedItemWidth,a=e.estimatedItemHeight,s=e.onResize,c=t.itemHashList,l=t.itemSizeDict,d=c,u=l;if(void 0!==g){var h;if(d[g]===p)return null;u=m({},u,((h={})[(d=[].concat(d))[g]=p]=v,h))}var f=function(t,e,n,i,o,r){for(var a,s="x"===r?["y","x","height","width"]:["x","y","width","height"],c=s[0],l=s[1],d=s[2],u=s[3],h=0,f=0,g=[],p=0;p<i;p++){var v;0<p&&(f+=o);var m=e[p],y=n[m]||t;g.push({rect:(v={},v[c]=0,v[l]=f,v[d]=y[d],v[u]=y[u],v),itemIndex:p}),f+=y[u],h<y[d]&&(h=y[d])}return{size:(a={},a[d]=h,a[u]=f,a),layoutAttrs:g}}({width:r,height:a},d,u,o,i,n);return d!==c&&(f.itemHashList=d),u!==l&&(f.itemSizeDict=u),t.size.width===f.size.width&&t.size.height===f.size.height||s(f.size),f})},e._renderItem=function(n,t){var i=this,e=this.props,o=e.direction,r=e.width,a=e.height,s=this.state.itemSizeDict,c=(0,e.renderItem)(m({},n,{visibleRect:t,Item:k})),l=c.key||n.itemIndex,d={position:"absolute",left:n.rect.x,top:n.rect.y,width:n.rect.width,height:n.rect.height};c.type!==k&&(c=g.createElement(k,{hash:l},c));var u=c.props,h=u.onResize,f=p(u,["onResize"]);return f.onResize=function(t,e){i._calculateLayout(n.itemIndex,e,t),h(t)},f.getSizeByHash=function(t){return s[t]},"x"===o?f.height=a:f.width=r,g.createElement("div",{key:l,style:d},g.createElement(k,f))},e.render=function(){for(var t=this.props,e=t.itemCount,n=t.visibleRect,i=this.state.layoutAttrs,o=[],r=0;r<e;r++){var a=i[r];a&&L(a.rect,n)&&o.push(this._renderItem(a,P(a.rect,n)))}return o},t}(g.PureComponent);H.defaultProps={direction:"y",width:-1,height:-1,spacing:0,itemCount:0,estimatedItemWidth:0,estimatedItemHeight:0,renderItem:function(){return null},visibleRect:{x:0,y:0,width:0,height:0},onResize:function(){}};var N=function(o){function t(){for(var t,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return(t=o.call.apply(o,[this].concat(n))||this).state={size:{width:0,height:0}},t.resizeRef=g.createRef(),t}r(t,o);var e=t.prototype;return e.componentDidMount=function(){this._calculateSize()},e.componentDidUpdate=function(t){t.width===this.props.width&&t.height===this.props.height||this._calculateSize()},e.componentWillUnmount=function(){this._resizeNode&&(D.uninstall(this._resizeNode),this._resizeNode=void 0)},e._calculateSize=function(){var t,e=this,n=this.props,i=n.width,o=n.height;if(i<0||o<0){if(!this._resizeNode){var r=this.resizeRef.current;if(!r)return;return void D.listenTo(this._resizeNode=r,function(){return e._calculateSize()})}t=s(this._resizeNode)}else this._resizeNode&&(D.uninstall(this._resizeNode),this._resizeNode=void 0),t={width:i,height:o};this.setState({size:t})},e.render=function(){var t=this.props,e=t.width,n=t.height;return g.createElement("div",{ref:this.resizeRef,style:{width:e<0?"100%":e,height:n<0?"100%":n}},(0,t.children)(this.state.size))},t}(g.Component);N.defaultProps={children:function(){return null},width:-1,height:-1};var B=function(e){function t(t){var s;return(s=e.call(this,t)||this)._onPadResize=function(t){var e=s.props,n=e.onResize,i=s.state.pageCount,o=j({direction:e.direction,size:t,contentSize:s.padRef.current.getContentSize()});o!==i&&s.setState({pageCount:o}),n&&n(t)},s._onPadContentResize=function(t){var e=s.props,n=e.onContentResize,i=s.state.pageCount,o=j({direction:e.direction,size:s.padRef.current.getSize(),contentSize:t});o!==i&&s.setState({pageCount:o}),n&&n(t)},s._onPadScroll=function(t){var e=t.dragging,n=t.decelerating,i=s.props,o=i.onScroll,r="x"===i.direction?["x","width"]:["y","height"],a={activeIndex:Math.abs(Math.floor(t.contentOffset[r[0]]/t.size[r[1]]))};s.state.dragging!==e&&(a.dragging=e),s.state.decelerating!==n&&(a.decelerating=n),s.setState(a),o&&o(t)},s._onMouseEnter=function(){s.setState({mouseEntered:!0})},s._onMouseLeave=function(){s.setState({mouseEntered:!1})},s.state={pageCount:0,activeIndex:0,dragging:!1,decelerating:!1,mouseEntered:!1},s.padRef=g.createRef(),s}r(t,e);var n=t.prototype;return n.componentDidMount=function(){var t=this.props,e=t.autoplayEnabled,n=this.padRef.current,i=j({direction:t.direction,size:n.getSize(),contentSize:n.getContentSize()});this.setState({pageCount:i}),e&&this.play()},n.componentDidUpdate=function(t,e){var n=this.props,i=n.direction,o=n.autoplayEnabled,r=this.state,a=r.pageCount,s=r.activeIndex,c=r.dragging,l=r.decelerating,d=r.mouseEntered;if(t.direction!==i||t.width!==n.width||t.contentWidth!==n.contentWidth||t.height!==n.height||t.contentHeight!==n.contentHeight){var u=this.padRef.current,h=(u.getSize(),u.getContentSize(),j(i));h!==a&&this.setState({pageCount:h})}t.autoplayEnabled===o&&e.dragging===c&&e.decelerating===l&&e.activeIndex===s&&e.mouseEntered===d||(!o||c||d||l||a<=s+1?this.pause():this.play())},n.componentWillUnmount=function(){this.pause()},n.getPageCount=function(){return this.state.pageCount},n.getActiveIndex=function(){return this.state.activeIndex},n.play=function(){var t=this,e=this.props.autoplayInterval;this._autoplayTimer&&(this.forward(),clearTimeout(this._autoplayTimer)),this._autoplayTimer=setTimeout(function(){t.play()},e)},n.pause=function(){this._autoplayTimer&&(clearTimeout(this._autoplayTimer),this._autoplayTimer=void 0)},n.setFrame=function(t,e){void 0===e&&(e=!0);var n=this.props.direction,i=this.padRef.current,o=i.getContentOffset(),r=i.getSize();i.scrollTo({offset:0===t?{x:0,y:0}:{x:"x"===n?-t*r.width:o.x,y:"x"===n?o.y:-t*r.height},animated:e})},n.rewind=function(){this.setFrame(this.state.activeIndex-1)},n.forward=function(){this.setFrame(this.state.activeIndex+1)},n.render=function(){var t=this.props,e=t.direction,n=t.children,i=p(t,["direction","autoplayEnabled","autoplayInterval","children"]),o={alwaysBounceX:!1,alwaysBounceY:!1};return"x"===e?o.alwaysBounceX=!0:o.alwaysBounceY=!0,g.createElement(a,m({ref:this.padRef},i,o,{pagingEnabled:!0,onScroll:this._onPadScroll,onResize:this._onPadResize,onContentResize:this._onPadContentResize,onMouseEnter:this._onMouseEnter,onMouseLeave:this._onMouseLeave}),"function"==typeof n?n(this):n)},t}(g.PureComponent);function j(t){var e=t.size,n="x"===t.direction?"width":"height";return e[n]?Math.round(t.contentSize[n]/e[n]):0}B.defaultProps={direction:"y",autoplayEnabled:!0,autoplayInterval:3e3};var U=function(n){function t(t){var e;return(e=n.call(this,t)||this)._onPlayerFrameChange=function(t){},e.state={playerExisted:!1},e.playerRef=g.createRef(),e}r(t,n);var e=t.prototype;return e.componentDidMount=function(){this.playerRef&&this.setState({playerExisted:!0})},e.componentDidUpdate=function(t,e){},e.componentWillUnmount=function(){},e.slideTo=function(t){},e.slidePrev=function(){},e.slideNext=function(){},e.render=function(){var t=this.props,r=t.loop,a=t.children,s=p(t,["loop","children"]);return g.createElement(B,m({ref:this.playerRef},s),function(t){if(r){var e=t.padRef.current,n=s.direction,i={width:"x"===n?2*s.contentWidth:s.contentWidth,height:"x"===n?s.contentHeight:2*s.contentHeight},o={x:0,y:0,width:0,height:0};return e&&(i=e.getContentSize(),o=e.getVisibleRect()),g.createElement(H,{direction:n,height:i.height,estimatedItemWidth:i.width/2,estimatedItemHeight:i.height/2,itemCount:2,renderItem:function(){return g.createElement("div",{style:{position:"relative",width:i.width,height:i.height}},a)},visibleRect:o,onResize:function(t){return e.setContentSize(t)}})}return a})},t}(g.PureComponent);U.defaultProps={direction:"y",loop:!0},t.Pad=a,t.Pannable=h,t.GeneralContent=A,t.GridContent=W,t.ListContent=H,t.ItemContent=k,t.AutoResizing=N,t.Player=B,t.Carousel=U,Object.defineProperty(t,"__esModule",{value:!0})});

@@ -18,6 +18,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";

_this._onPlayerFrameChange = function (activeIndex) {
var loop = _this.props.loop;
var player = _this.playerRef.current;
var pageCount = player.pageCount; // if(loop){
_this._onPlayerFrameChange = function (activeIndex) {// const { loop } = this.props;
// const player = this.playerRef.current;
// const pageCount = player.pageCount;
// if(loop){
// if(activeIndex+1 > pageCount/2){

@@ -68,7 +68,7 @@ // player.setFrame()

var direction = playerProps.direction;
var contentSize = pad ? pad.getContentSize() : {
width: playerProps.contentWidth,
height: playerProps.conte
var padContentSize = {
width: direction === 'x' ? playerProps.contentWidth * 2 : playerProps.contentWidth,
height: direction === 'x' ? playerProps.contentHeight : playerProps.contentHeight * 2
};
var visibleRect = pad ? pad.getVisibleRect() : {
var padVisibleRect = {
x: 0,

@@ -79,7 +79,13 @@ y: 0,

};
if (pad) {
padContentSize = pad.getContentSize();
padVisibleRect = pad.getVisibleRect();
}
return React.createElement(ListContent, {
direction: direction,
height: contentSize.height,
estimatedItemWidth: contentSize.width,
estimatedItemHeight: contentSize.height,
height: padContentSize.height,
estimatedItemWidth: padContentSize.width / 2,
estimatedItemHeight: padContentSize.height / 2,
itemCount: 2,

@@ -90,8 +96,8 @@ renderItem: function renderItem() {

position: 'relative',
width: contentSize.width,
height: contentSize.height
width: padContentSize.width,
height: padContentSize.height
}
}, children);
},
visibleRect: visibleRect,
visibleRect: padVisibleRect,
onResize: function onResize(size) {

@@ -98,0 +104,0 @@ return pad.setContentSize(size);

@@ -9,3 +9,3 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";

import { requestAnimationFrame, cancelAnimationFrame } from './utils/animationFrame';
import { getAdjustedContentOffset, getAdjustedBounceOffset, getAdjustedPagingOffset, getDecelerationEndOffset, calculateDeceleration, calculateRectOffset } from './utils/motion';
import { getAdjustedContentOffset, getAdjustedBounceOffset, getAdjustedContentVelocity, getDecelerationEndOffset, calculateDeceleration, calculateRectOffset } from './utils/motion';
var DECELERATION_RATE_STRONG = 0.04;

@@ -91,11 +91,22 @@ var DECELERATION_RATE_WEAK = 0.004;

var pagingEnabled = props.pagingEnabled;
var decelerationRate = pagingEnabled ? DECELERATION_RATE_STRONG : DECELERATION_RATE_WEAK;
var decelerationEndOffset = getDecelerationEndOffset(contentOffset, contentVelocity, decelerationRate);
var nextContentVelocity = contentVelocity;
var decelerationRate = DECELERATION_RATE_STRONG;
var adjustedContentVelocity = getAdjustedContentVelocity(nextContentVelocity, size, DECELERATION_RATE_STRONG);
if (pagingEnabled) {
decelerationEndOffset = getAdjustedPagingOffset(contentOffset, decelerationEndOffset, size, contentSize);
if (adjustedContentVelocity.x !== nextContentVelocity.x || adjustedContentVelocity.y !== nextContentVelocity.y) {
nextContentVelocity = adjustedContentVelocity;
}
if (!pagingEnabled) {
var adjustedContentOffset = getAdjustedContentOffset(contentOffset, size, contentSize, false);
if (adjustedContentOffset.x === contentOffset.x && adjustedContentOffset.y === contentOffset.y) {
decelerationRate = DECELERATION_RATE_WEAK;
}
}
var decelerationEndOffset = getDecelerationEndOffset(contentOffset, nextContentVelocity, size, pagingEnabled, decelerationRate);
return {
contentOffset: _extends({}, contentOffset),
contentVelocity: nextContentVelocity,
dragging: false,

@@ -118,3 +129,3 @@ decelerating: true,

if (props.pagingEnabled) {
decelerationEndOffset = getAdjustedPagingOffset(contentOffset, decelerationEndOffset, size, contentSize);
decelerationEndOffset = getAdjustedContentOffset(decelerationEndOffset, size, contentSize, true);
}

@@ -168,2 +179,3 @@

Pad.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
var pagingEnabled = props.pagingEnabled;
var prevContentOffset = state.prevContentOffset,

@@ -182,16 +194,15 @@ contentOffset = state.contentOffset,

var nextDecelerating = decelerating;
var nextDecelerationRate = decelerationRate;
var nextDecelerationEndOffset = decelerationEndOffset;
var nextDecelerationRate = decelerationRate;
if (nextDecelerating) {
var adjustedPrevContentOffset = getAdjustedContentOffset(prevContentOffset, size, contentSize, false);
var adjustedContentOffset = getAdjustedContentOffset(contentOffset, size, contentSize, false);
if (adjustedContentOffset.x !== contentOffset.x || adjustedContentOffset.y !== contentOffset.y) {
nextDecelerationRate = DECELERATION_RATE_STRONG;
if (nextDecelerationRate !== DECELERATION_RATE_STRONG && (adjustedPrevContentOffset.x === prevContentOffset.x && adjustedContentOffset.x !== contentOffset.x || adjustedPrevContentOffset.y === prevContentOffset.y && adjustedContentOffset.y !== contentOffset.y)) {
var adjustedDecelerationEndOffset = getDecelerationEndOffset(contentOffset, contentVelocity, size, pagingEnabled, DECELERATION_RATE_STRONG);
if (adjustedContentOffset.x !== contentOffset.x && adjustedContentOffset.x !== nextDecelerationEndOffset.x || adjustedContentOffset.y !== contentOffset.y && adjustedContentOffset.y !== nextDecelerationEndOffset.y) {
nextDecelerationEndOffset = {
x: adjustedContentOffset.x !== contentOffset.x ? adjustedContentOffset.x : nextDecelerationEndOffset.x,
y: adjustedContentOffset.y !== contentOffset.y ? adjustedContentOffset.y : nextDecelerationEndOffset.y
};
if (adjustedDecelerationEndOffset.x !== nextDecelerationEndOffset.x || adjustedDecelerationEndOffset.y !== nextDecelerationEndOffset.y) {
nextDecelerationRate = DECELERATION_RATE_STRONG;
nextDecelerationEndOffset = adjustedDecelerationEndOffset;
}

@@ -201,3 +212,10 @@ }

if (nextDecelerationEndOffset.x === contentOffset.x && nextDecelerationEndOffset.y === contentOffset.y && contentVelocity.x === 0 && contentVelocity.y === 0) {
nextDecelerating = false;
var _adjustedDecelerationEndOffset = getAdjustedContentOffset(contentOffset, size, contentSize, pagingEnabled);
if (_adjustedDecelerationEndOffset.x !== nextDecelerationEndOffset.x || _adjustedDecelerationEndOffset.y !== nextDecelerationEndOffset.y) {
nextDecelerationRate = DECELERATION_RATE_STRONG;
nextDecelerationEndOffset = _adjustedDecelerationEndOffset;
} else {
nextDecelerating = false;
}
}

@@ -430,3 +448,2 @@ }

contentVelocity = state.contentVelocity,
size = state.size,
decelerating = state.decelerating,

@@ -440,3 +457,3 @@ decelerationEndOffset = state.decelerationEndOffset,

var _calculateDeceleratio = calculateDeceleration(interval, decelerationRate, contentVelocity, contentOffset, decelerationEndOffset, size),
var _calculateDeceleratio = calculateDeceleration(interval, decelerationRate, contentVelocity, contentOffset, decelerationEndOffset),
xOffset = _calculateDeceleratio.xOffset,

@@ -443,0 +460,0 @@ yOffset = _calculateDeceleratio.yOffset,

@@ -27,9 +27,15 @@ import _extends from "@babel/runtime/helpers/esm/extends";

var offsetX = Math.min(size[width] - cSize[width], 0);
offsetX = Math.max(offsetX, Math.min(offset[x], 0));
var minOffsetX = Math.min(size[width] - cSize[width], 0);
var offsetX = offset[x];
if (paging) {
if (!size[width]) {
offsetX = 0;
} else {
if (0 < offsetX) {
offsetX = 0;
} else if (offsetX < minOffsetX) {
offsetX = minOffsetX;
if (paging && size[width] > 0) {
offsetX = size[width] * Math.ceil(offsetX / size[width]);
}
} else {
if (paging && size[width] > 0) {
offsetX = size[width] * Math.round(offsetX / size[width]);

@@ -47,36 +53,9 @@ }

}
export function getAdjustedPagingOffset(offsetEnd, offset, size, cSize, name) {
export function getAdjustedBounceOffset(offset, bounce, size, cSize, name) {
if (name) {
var _ref3 = name === 'y' ? ['y', 'height'] : ['x', 'width'],
var _ref3 = name === 'y' ? ['y', 'height', 'width'] : ['x', 'width', 'height'],
x = _ref3[0],
width = _ref3[1];
width = _ref3[1],
height = _ref3[2];
var offsetX = Math.min(size[width] - cSize[width], 0);
offsetX = Math.max(offsetX, Math.min(offset[x], 0));
if (!size[width]) {
offsetX = 0;
} else {
offsetX = size[width] * Math.floor(offsetX / size[width]);
}
if (offsetEnd[x] < offsetX + 0.5 * size[width]) {
return offsetX;
} else {
return offsetX + size[width];
}
}
return {
x: getAdjustedPagingOffset(offsetEnd, offset, size, cSize, 'x'),
y: getAdjustedPagingOffset(offsetEnd, offset, size, cSize, 'y')
};
}
export function getAdjustedBounceOffset(offset, bounce, size, cSize, name) {
if (name) {
var _ref4 = name === 'y' ? ['y', 'height', 'width'] : ['x', 'width', 'height'],
x = _ref4[0],
width = _ref4[1],
height = _ref4[2];
var offsetX = offset[x];

@@ -110,5 +89,8 @@ var minOffsetX = Math.min(size[width] - cSize[width], 0);

}
export function getDecelerationEndOffset(offset, velocity, acc, name) {
export function getDecelerationEndOffset(offset, velocity, size, paging, acc, name) {
if (name) {
var x = name;
var _ref4 = name === 'y' ? ['y', 'height'] : ['x', 'width'],
x = _ref4[0],
width = _ref4[1];
var offsetX = offset[x];

@@ -120,2 +102,6 @@

if (paging && size[width] > 0) {
offsetX = size[width] * Math.round(offsetX / size[width]);
}
return offsetX;

@@ -129,10 +115,8 @@ }

return {
x: getDecelerationEndOffset(offset, velocity, acc, 'x'),
y: getDecelerationEndOffset(offset, velocity, acc, 'y')
x: getDecelerationEndOffset(offset, velocity, size, paging, acc, 'x'),
y: getDecelerationEndOffset(offset, velocity, size, paging, acc, 'y')
};
}
export function calculateDeceleration(interval, acc, velocity, offset, offsetEnd, size, name) {
export function getAdjustedContentVelocity(velocity, size, acc, name) {
if (name) {
var _ref6;
var _ref5 = name === 'y' ? ['y', 'height'] : ['x', 'width'],

@@ -142,2 +126,29 @@ x = _ref5[0],

if (!velocity[x]) {
return 1;
}
var direction = velocity[x] < 0 ? -1 : 1;
var maxDist = 0.25 * size[width];
var maxVelocity = direction * Math.min(direction * velocity[x], Math.sqrt(2 * maxDist * direction * acc[x]));
return maxVelocity / velocity[x];
}
if (typeof acc === 'number') {
acc = getAcc(acc, velocity);
}
var n = Math.min(getAdjustedContentVelocity(velocity, size, acc, 'x'), getAdjustedContentVelocity(velocity, size, acc, 'y'));
return {
x: n * velocity.x,
y: n * velocity.y
};
}
export function calculateDeceleration(interval, acc, velocity, offset, offsetEnd, name) {
if (name) {
var _ref7;
var _ref6 = name === 'y' ? ['y'] : ['x'],
x = _ref6[0];
var offsetX = offset[x];

@@ -165,8 +176,2 @@ var velocityX = velocity[x];

offsetX += 0.5 * (velocity[x] + velocityH) * timeH - 0.5 * (velocityH + velocityX) * (timeH - interval);
if (direction * (offsetEnd[x] - offsetX) <= 0) {
console.log('slow');
var direction2 = velocityX < 0 ? -1 : 1;
velocityX = direction2 * Math.min(Math.abs(velocityX), Math.sqrt(2 * direction * acc[x] * 0.25 * size[width]));
}
}

@@ -177,3 +182,3 @@ } else {

return _ref6 = {}, _ref6[x + 'Offset'] = offsetX, _ref6[x + 'Velocity'] = velocityX, _ref6;
return _ref7 = {}, _ref7[x + 'Offset'] = offsetX, _ref7[x + 'Velocity'] = velocityX, _ref7;
}

@@ -188,9 +193,9 @@

return _extends({}, calculateDeceleration(interval, acc, velocity, offset, offsetEnd, size, 'x'), calculateDeceleration(interval, acc, velocity, offset, offsetEnd, size, 'y'));
return _extends({}, calculateDeceleration(interval, acc, velocity, offset, offsetEnd, 'x'), calculateDeceleration(interval, acc, velocity, offset, offsetEnd, 'y'));
}
export function calculateRectOffset(rect, align, offset, size, name) {
if (name) {
var _ref7 = name === 'y' ? ['y', 'height'] : ['x', 'width'],
x = _ref7[0],
width = _ref7[1];
var _ref8 = name === 'y' ? ['y', 'height'] : ['x', 'width'],
x = _ref8[0],
width = _ref8[1];

@@ -197,0 +202,0 @@ var offsetX = -rect[x];

@@ -30,6 +30,6 @@ "use strict";

_this._onPlayerFrameChange = function (activeIndex) {
var loop = _this.props.loop;
var player = _this.playerRef.current;
var pageCount = player.pageCount; // if(loop){
_this._onPlayerFrameChange = function (activeIndex) {// const { loop } = this.props;
// const player = this.playerRef.current;
// const pageCount = player.pageCount;
// if(loop){
// if(activeIndex+1 > pageCount/2){

@@ -79,7 +79,7 @@ // player.setFrame()

var direction = playerProps.direction;
var contentSize = pad ? pad.getContentSize() : {
width: playerProps.contentWidth,
height: playerProps.conte
var padContentSize = {
width: direction === 'x' ? playerProps.contentWidth * 2 : playerProps.contentWidth,
height: direction === 'x' ? playerProps.contentHeight : playerProps.contentHeight * 2
};
var visibleRect = pad ? pad.getVisibleRect() : {
var padVisibleRect = {
x: 0,

@@ -90,7 +90,13 @@ y: 0,

};
if (pad) {
padContentSize = pad.getContentSize();
padVisibleRect = pad.getVisibleRect();
}
return _react.default.createElement(_ListContent.default, {
direction: direction,
height: contentSize.height,
estimatedItemWidth: contentSize.width,
estimatedItemHeight: contentSize.height,
height: padContentSize.height,
estimatedItemWidth: padContentSize.width / 2,
estimatedItemHeight: padContentSize.height / 2,
itemCount: 2,

@@ -101,8 +107,8 @@ renderItem: function renderItem() {

position: 'relative',
width: contentSize.width,
height: contentSize.height
width: padContentSize.width,
height: padContentSize.height
}
}, children);
},
visibleRect: visibleRect,
visibleRect: padVisibleRect,
onResize: function onResize(size) {

@@ -109,0 +115,0 @@ return pad.setContentSize(size);

@@ -106,11 +106,22 @@ "use strict";

var pagingEnabled = props.pagingEnabled;
var decelerationRate = pagingEnabled ? DECELERATION_RATE_STRONG : DECELERATION_RATE_WEAK;
var decelerationEndOffset = (0, _motion.getDecelerationEndOffset)(contentOffset, contentVelocity, decelerationRate);
var nextContentVelocity = contentVelocity;
var decelerationRate = DECELERATION_RATE_STRONG;
var adjustedContentVelocity = (0, _motion.getAdjustedContentVelocity)(nextContentVelocity, size, DECELERATION_RATE_STRONG);
if (pagingEnabled) {
decelerationEndOffset = (0, _motion.getAdjustedPagingOffset)(contentOffset, decelerationEndOffset, size, contentSize);
if (adjustedContentVelocity.x !== nextContentVelocity.x || adjustedContentVelocity.y !== nextContentVelocity.y) {
nextContentVelocity = adjustedContentVelocity;
}
if (!pagingEnabled) {
var adjustedContentOffset = (0, _motion.getAdjustedContentOffset)(contentOffset, size, contentSize, false);
if (adjustedContentOffset.x === contentOffset.x && adjustedContentOffset.y === contentOffset.y) {
decelerationRate = DECELERATION_RATE_WEAK;
}
}
var decelerationEndOffset = (0, _motion.getDecelerationEndOffset)(contentOffset, nextContentVelocity, size, pagingEnabled, decelerationRate);
return {
contentOffset: (0, _extends2.default)({}, contentOffset),
contentVelocity: nextContentVelocity,
dragging: false,

@@ -133,3 +144,3 @@ decelerating: true,

if (props.pagingEnabled) {
decelerationEndOffset = (0, _motion.getAdjustedPagingOffset)(contentOffset, decelerationEndOffset, size, contentSize);
decelerationEndOffset = (0, _motion.getAdjustedContentOffset)(decelerationEndOffset, size, contentSize, true);
}

@@ -183,2 +194,3 @@

Pad.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
var pagingEnabled = props.pagingEnabled;
var prevContentOffset = state.prevContentOffset,

@@ -197,16 +209,15 @@ contentOffset = state.contentOffset,

var nextDecelerating = decelerating;
var nextDecelerationRate = decelerationRate;
var nextDecelerationEndOffset = decelerationEndOffset;
var nextDecelerationRate = decelerationRate;
if (nextDecelerating) {
var adjustedPrevContentOffset = (0, _motion.getAdjustedContentOffset)(prevContentOffset, size, contentSize, false);
var adjustedContentOffset = (0, _motion.getAdjustedContentOffset)(contentOffset, size, contentSize, false);
if (adjustedContentOffset.x !== contentOffset.x || adjustedContentOffset.y !== contentOffset.y) {
nextDecelerationRate = DECELERATION_RATE_STRONG;
if (nextDecelerationRate !== DECELERATION_RATE_STRONG && (adjustedPrevContentOffset.x === prevContentOffset.x && adjustedContentOffset.x !== contentOffset.x || adjustedPrevContentOffset.y === prevContentOffset.y && adjustedContentOffset.y !== contentOffset.y)) {
var adjustedDecelerationEndOffset = (0, _motion.getDecelerationEndOffset)(contentOffset, contentVelocity, size, pagingEnabled, DECELERATION_RATE_STRONG);
if (adjustedContentOffset.x !== contentOffset.x && adjustedContentOffset.x !== nextDecelerationEndOffset.x || adjustedContentOffset.y !== contentOffset.y && adjustedContentOffset.y !== nextDecelerationEndOffset.y) {
nextDecelerationEndOffset = {
x: adjustedContentOffset.x !== contentOffset.x ? adjustedContentOffset.x : nextDecelerationEndOffset.x,
y: adjustedContentOffset.y !== contentOffset.y ? adjustedContentOffset.y : nextDecelerationEndOffset.y
};
if (adjustedDecelerationEndOffset.x !== nextDecelerationEndOffset.x || adjustedDecelerationEndOffset.y !== nextDecelerationEndOffset.y) {
nextDecelerationRate = DECELERATION_RATE_STRONG;
nextDecelerationEndOffset = adjustedDecelerationEndOffset;
}

@@ -216,3 +227,10 @@ }

if (nextDecelerationEndOffset.x === contentOffset.x && nextDecelerationEndOffset.y === contentOffset.y && contentVelocity.x === 0 && contentVelocity.y === 0) {
nextDecelerating = false;
var _adjustedDecelerationEndOffset = (0, _motion.getAdjustedContentOffset)(contentOffset, size, contentSize, pagingEnabled);
if (_adjustedDecelerationEndOffset.x !== nextDecelerationEndOffset.x || _adjustedDecelerationEndOffset.y !== nextDecelerationEndOffset.y) {
nextDecelerationRate = DECELERATION_RATE_STRONG;
nextDecelerationEndOffset = _adjustedDecelerationEndOffset;
} else {
nextDecelerating = false;
}
}

@@ -445,3 +463,2 @@ }

contentVelocity = state.contentVelocity,
size = state.size,
decelerating = state.decelerating,

@@ -455,3 +472,3 @@ decelerationEndOffset = state.decelerationEndOffset,

var _calculateDeceleratio = (0, _motion.calculateDeceleration)(interval, decelerationRate, contentVelocity, contentOffset, decelerationEndOffset, size),
var _calculateDeceleratio = (0, _motion.calculateDeceleration)(interval, decelerationRate, contentVelocity, contentOffset, decelerationEndOffset),
xOffset = _calculateDeceleratio.xOffset,

@@ -458,0 +475,0 @@ yOffset = _calculateDeceleratio.yOffset,

@@ -7,5 +7,5 @@ "use strict";

exports.getAdjustedContentOffset = getAdjustedContentOffset;
exports.getAdjustedPagingOffset = getAdjustedPagingOffset;
exports.getAdjustedBounceOffset = getAdjustedBounceOffset;
exports.getDecelerationEndOffset = getDecelerationEndOffset;
exports.getAdjustedContentVelocity = getAdjustedContentVelocity;
exports.calculateDeceleration = calculateDeceleration;

@@ -40,9 +40,15 @@ exports.calculateRectOffset = calculateRectOffset;

var offsetX = Math.min(size[width] - cSize[width], 0);
offsetX = Math.max(offsetX, Math.min(offset[x], 0));
var minOffsetX = Math.min(size[width] - cSize[width], 0);
var offsetX = offset[x];
if (paging) {
if (!size[width]) {
offsetX = 0;
} else {
if (0 < offsetX) {
offsetX = 0;
} else if (offsetX < minOffsetX) {
offsetX = minOffsetX;
if (paging && size[width] > 0) {
offsetX = size[width] * Math.ceil(offsetX / size[width]);
}
} else {
if (paging && size[width] > 0) {
offsetX = size[width] * Math.round(offsetX / size[width]);

@@ -61,37 +67,9 @@ }

function getAdjustedPagingOffset(offsetEnd, offset, size, cSize, name) {
function getAdjustedBounceOffset(offset, bounce, size, cSize, name) {
if (name) {
var _ref3 = name === 'y' ? ['y', 'height'] : ['x', 'width'],
var _ref3 = name === 'y' ? ['y', 'height', 'width'] : ['x', 'width', 'height'],
x = _ref3[0],
width = _ref3[1];
width = _ref3[1],
height = _ref3[2];
var offsetX = Math.min(size[width] - cSize[width], 0);
offsetX = Math.max(offsetX, Math.min(offset[x], 0));
if (!size[width]) {
offsetX = 0;
} else {
offsetX = size[width] * Math.floor(offsetX / size[width]);
}
if (offsetEnd[x] < offsetX + 0.5 * size[width]) {
return offsetX;
} else {
return offsetX + size[width];
}
}
return {
x: getAdjustedPagingOffset(offsetEnd, offset, size, cSize, 'x'),
y: getAdjustedPagingOffset(offsetEnd, offset, size, cSize, 'y')
};
}
function getAdjustedBounceOffset(offset, bounce, size, cSize, name) {
if (name) {
var _ref4 = name === 'y' ? ['y', 'height', 'width'] : ['x', 'width', 'height'],
x = _ref4[0],
width = _ref4[1],
height = _ref4[2];
var offsetX = offset[x];

@@ -126,5 +104,8 @@ var minOffsetX = Math.min(size[width] - cSize[width], 0);

function getDecelerationEndOffset(offset, velocity, acc, name) {
function getDecelerationEndOffset(offset, velocity, size, paging, acc, name) {
if (name) {
var x = name;
var _ref4 = name === 'y' ? ['y', 'height'] : ['x', 'width'],
x = _ref4[0],
width = _ref4[1];
var offsetX = offset[x];

@@ -136,2 +117,6 @@

if (paging && size[width] > 0) {
offsetX = size[width] * Math.round(offsetX / size[width]);
}
return offsetX;

@@ -145,11 +130,9 @@ }

return {
x: getDecelerationEndOffset(offset, velocity, acc, 'x'),
y: getDecelerationEndOffset(offset, velocity, acc, 'y')
x: getDecelerationEndOffset(offset, velocity, size, paging, acc, 'x'),
y: getDecelerationEndOffset(offset, velocity, size, paging, acc, 'y')
};
}
function calculateDeceleration(interval, acc, velocity, offset, offsetEnd, size, name) {
function getAdjustedContentVelocity(velocity, size, acc, name) {
if (name) {
var _ref6;
var _ref5 = name === 'y' ? ['y', 'height'] : ['x', 'width'],

@@ -159,2 +142,30 @@ x = _ref5[0],

if (!velocity[x]) {
return 1;
}
var direction = velocity[x] < 0 ? -1 : 1;
var maxDist = 0.25 * size[width];
var maxVelocity = direction * Math.min(direction * velocity[x], Math.sqrt(2 * maxDist * direction * acc[x]));
return maxVelocity / velocity[x];
}
if (typeof acc === 'number') {
acc = getAcc(acc, velocity);
}
var n = Math.min(getAdjustedContentVelocity(velocity, size, acc, 'x'), getAdjustedContentVelocity(velocity, size, acc, 'y'));
return {
x: n * velocity.x,
y: n * velocity.y
};
}
function calculateDeceleration(interval, acc, velocity, offset, offsetEnd, name) {
if (name) {
var _ref7;
var _ref6 = name === 'y' ? ['y'] : ['x'],
x = _ref6[0];
var offsetX = offset[x];

@@ -182,8 +193,2 @@ var velocityX = velocity[x];

offsetX += 0.5 * (velocity[x] + velocityH) * timeH - 0.5 * (velocityH + velocityX) * (timeH - interval);
if (direction * (offsetEnd[x] - offsetX) <= 0) {
console.log('slow');
var direction2 = velocityX < 0 ? -1 : 1;
velocityX = direction2 * Math.min(Math.abs(velocityX), Math.sqrt(2 * direction * acc[x] * 0.25 * size[width]));
}
}

@@ -194,3 +199,3 @@ } else {

return _ref6 = {}, _ref6[x + 'Offset'] = offsetX, _ref6[x + 'Velocity'] = velocityX, _ref6;
return _ref7 = {}, _ref7[x + 'Offset'] = offsetX, _ref7[x + 'Velocity'] = velocityX, _ref7;
}

@@ -205,3 +210,3 @@

return (0, _extends2.default)({}, calculateDeceleration(interval, acc, velocity, offset, offsetEnd, size, 'x'), calculateDeceleration(interval, acc, velocity, offset, offsetEnd, size, 'y'));
return (0, _extends2.default)({}, calculateDeceleration(interval, acc, velocity, offset, offsetEnd, 'x'), calculateDeceleration(interval, acc, velocity, offset, offsetEnd, 'y'));
}

@@ -211,5 +216,5 @@

if (name) {
var _ref7 = name === 'y' ? ['y', 'height'] : ['x', 'width'],
x = _ref7[0],
width = _ref7[1];
var _ref8 = name === 'y' ? ['y', 'height'] : ['x', 'width'],
x = _ref8[0],
width = _ref8[1];

@@ -216,0 +221,0 @@ var offsetX = -rect[x];

{
"name": "react-pannable",
"version": "0.6.3",
"version": "0.7.0",
"description": "Simulate pan gesture and scroll view for touch devices with React",

@@ -5,0 +5,0 @@ "keywords": [

@@ -37,6 +37,5 @@ import React from 'react';

_onPlayerFrameChange = activeIndex => {
const { loop } = this.props;
const player = this.playerRef.current;
const pageCount = player.pageCount;
// const { loop } = this.props;
// const player = this.playerRef.current;
// const pageCount = player.pageCount;
// if(loop){

@@ -59,23 +58,25 @@ // if(activeIndex+1 > pageCount/2){

const contentSize = pad
? pad.getContentSize()
: {
width: playerProps.contentWidth,
height: playerProps.conte,
};
const visibleRect = pad
? pad.getVisibleRect()
: {
x: 0,
y: 0,
width: 0,
height: 0,
};
let padContentSize = {
width:
direction === 'x'
? playerProps.contentWidth * 2
: playerProps.contentWidth,
height:
direction === 'x'
? playerProps.contentHeight
: playerProps.contentHeight * 2,
};
let padVisibleRect = { x: 0, y: 0, width: 0, height: 0 };
if (pad) {
padContentSize = pad.getContentSize();
padVisibleRect = pad.getVisibleRect();
}
return (
<ListContent
direction={direction}
height={contentSize.height}
estimatedItemWidth={contentSize.width}
estimatedItemHeight={contentSize.height}
height={padContentSize.height}
estimatedItemWidth={padContentSize.width / 2}
estimatedItemHeight={padContentSize.height / 2}
itemCount={2}

@@ -87,4 +88,4 @@ renderItem={() => {

position: 'relative',
width: contentSize.width,
height: contentSize.height,
width: padContentSize.width,
height: padContentSize.height,
}}

@@ -96,3 +97,3 @@ >

}}
visibleRect={visibleRect}
visibleRect={padVisibleRect}
onResize={size => pad.setContentSize(size)}

@@ -99,0 +100,0 @@ />

@@ -11,3 +11,3 @@ import React from 'react';

getAdjustedBounceOffset,
getAdjustedPagingOffset,
getAdjustedContentVelocity,
getDecelerationEndOffset,

@@ -63,2 +63,3 @@ calculateDeceleration,

static getDerivedStateFromProps(props, state) {
const { pagingEnabled } = props;
const {

@@ -79,6 +80,12 @@ prevContentOffset,

let nextDecelerating = decelerating;
let nextDecelerationRate = decelerationRate;
let nextDecelerationEndOffset = decelerationEndOffset;
let nextDecelerationRate = decelerationRate;
if (nextDecelerating) {
const adjustedPrevContentOffset = getAdjustedContentOffset(
prevContentOffset,
size,
contentSize,
false
);
const adjustedContentOffset = getAdjustedContentOffset(

@@ -92,23 +99,22 @@ contentOffset,

if (
adjustedContentOffset.x !== contentOffset.x ||
adjustedContentOffset.y !== contentOffset.y
nextDecelerationRate !== DECELERATION_RATE_STRONG &&
((adjustedPrevContentOffset.x === prevContentOffset.x &&
adjustedContentOffset.x !== contentOffset.x) ||
(adjustedPrevContentOffset.y === prevContentOffset.y &&
adjustedContentOffset.y !== contentOffset.y))
) {
nextDecelerationRate = DECELERATION_RATE_STRONG;
const adjustedDecelerationEndOffset = getDecelerationEndOffset(
contentOffset,
contentVelocity,
size,
pagingEnabled,
DECELERATION_RATE_STRONG
);
if (
(adjustedContentOffset.x !== contentOffset.x &&
adjustedContentOffset.x !== nextDecelerationEndOffset.x) ||
(adjustedContentOffset.y !== contentOffset.y &&
adjustedContentOffset.y !== nextDecelerationEndOffset.y)
adjustedDecelerationEndOffset.x !== nextDecelerationEndOffset.x ||
adjustedDecelerationEndOffset.y !== nextDecelerationEndOffset.y
) {
nextDecelerationEndOffset = {
x:
adjustedContentOffset.x !== contentOffset.x
? adjustedContentOffset.x
: nextDecelerationEndOffset.x,
y:
adjustedContentOffset.y !== contentOffset.y
? adjustedContentOffset.y
: nextDecelerationEndOffset.y,
};
nextDecelerationRate = DECELERATION_RATE_STRONG;
nextDecelerationEndOffset = adjustedDecelerationEndOffset;
}

@@ -123,3 +129,18 @@ }

) {
nextDecelerating = false;
const adjustedDecelerationEndOffset = getAdjustedContentOffset(
contentOffset,
size,
contentSize,
pagingEnabled
);
if (
adjustedDecelerationEndOffset.x !== nextDecelerationEndOffset.x ||
adjustedDecelerationEndOffset.y !== nextDecelerationEndOffset.y
) {
nextDecelerationRate = DECELERATION_RATE_STRONG;
nextDecelerationEndOffset = adjustedDecelerationEndOffset;
} else {
nextDecelerating = false;
}
}

@@ -328,3 +349,2 @@ }

contentVelocity,
size,
decelerating,

@@ -344,4 +364,3 @@ decelerationEndOffset,

contentOffset,
decelerationEndOffset,
size
decelerationEndOffset
);

@@ -415,22 +434,45 @@

const decelerationRate = pagingEnabled
? DECELERATION_RATE_STRONG
: DECELERATION_RATE_WEAK;
let decelerationEndOffset = getDecelerationEndOffset(
contentOffset,
contentVelocity,
decelerationRate
let nextContentVelocity = contentVelocity;
let decelerationRate = DECELERATION_RATE_STRONG;
const adjustedContentVelocity = getAdjustedContentVelocity(
nextContentVelocity,
size,
DECELERATION_RATE_STRONG
);
if (pagingEnabled) {
decelerationEndOffset = getAdjustedPagingOffset(
if (
adjustedContentVelocity.x !== nextContentVelocity.x ||
adjustedContentVelocity.y !== nextContentVelocity.y
) {
nextContentVelocity = adjustedContentVelocity;
}
if (!pagingEnabled) {
const adjustedContentOffset = getAdjustedContentOffset(
contentOffset,
decelerationEndOffset,
size,
contentSize
contentSize,
false
);
if (
adjustedContentOffset.x === contentOffset.x &&
adjustedContentOffset.y === contentOffset.y
) {
decelerationRate = DECELERATION_RATE_WEAK;
}
}
let decelerationEndOffset = getDecelerationEndOffset(
contentOffset,
nextContentVelocity,
size,
pagingEnabled,
decelerationRate
);
return {
contentOffset: { ...contentOffset },
contentVelocity: nextContentVelocity,
dragging: false,

@@ -450,7 +492,7 @@ decelerating: true,

if (props.pagingEnabled) {
decelerationEndOffset = getAdjustedPagingOffset(
contentOffset,
decelerationEndOffset = getAdjustedContentOffset(
decelerationEndOffset,
size,
contentSize
contentSize,
true
);

@@ -457,0 +499,0 @@ }

@@ -14,9 +14,15 @@ function getAcc(rate, { x, y }) {

let offsetX = Math.min(size[width] - cSize[width], 0);
offsetX = Math.max(offsetX, Math.min(offset[x], 0));
const minOffsetX = Math.min(size[width] - cSize[width], 0);
let offsetX = offset[x];
if (paging) {
if (!size[width]) {
offsetX = 0;
} else {
if (0 < offsetX) {
offsetX = 0;
} else if (offsetX < minOffsetX) {
offsetX = minOffsetX;
if (paging && size[width] > 0) {
offsetX = size[width] * Math.ceil(offsetX / size[width]);
}
} else {
if (paging && size[width] > 0) {
offsetX = size[width] * Math.round(offsetX / size[width]);

@@ -35,28 +41,2 @@ }

export function getAdjustedPagingOffset(offsetEnd, offset, size, cSize, name) {
if (name) {
const [x, width] = name === 'y' ? ['y', 'height'] : ['x', 'width'];
let offsetX = Math.min(size[width] - cSize[width], 0);
offsetX = Math.max(offsetX, Math.min(offset[x], 0));
if (!size[width]) {
offsetX = 0;
} else {
offsetX = size[width] * Math.floor(offsetX / size[width]);
}
if (offsetEnd[x] < offsetX + 0.5 * size[width]) {
return offsetX;
} else {
return offsetX + size[width];
}
}
return {
x: getAdjustedPagingOffset(offsetEnd, offset, size, cSize, 'x'),
y: getAdjustedPagingOffset(offsetEnd, offset, size, cSize, 'y'),
};
}
export function getAdjustedBounceOffset(offset, bounce, size, cSize, name) {

@@ -96,5 +76,12 @@ if (name) {

export function getDecelerationEndOffset(offset, velocity, acc, name) {
export function getDecelerationEndOffset(
offset,
velocity,
size,
paging,
acc,
name
) {
if (name) {
const x = name;
const [x, width] = name === 'y' ? ['y', 'height'] : ['x', 'width'];

@@ -106,2 +93,5 @@ let offsetX = offset[x];

}
if (paging && size[width] > 0) {
offsetX = size[width] * Math.round(offsetX / size[width]);
}

@@ -116,7 +106,39 @@ return offsetX;

return {
x: getDecelerationEndOffset(offset, velocity, acc, 'x'),
y: getDecelerationEndOffset(offset, velocity, acc, 'y'),
x: getDecelerationEndOffset(offset, velocity, size, paging, acc, 'x'),
y: getDecelerationEndOffset(offset, velocity, size, paging, acc, 'y'),
};
}
export function getAdjustedContentVelocity(velocity, size, acc, name) {
if (name) {
const [x, width] = name === 'y' ? ['y', 'height'] : ['x', 'width'];
if (!velocity[x]) {
return 1;
}
const direction = velocity[x] < 0 ? -1 : 1;
const maxDist = 0.25 * size[width];
const maxVelocity =
direction *
Math.min(
direction * velocity[x],
Math.sqrt(2 * maxDist * direction * acc[x])
);
return maxVelocity / velocity[x];
}
if (typeof acc === 'number') {
acc = getAcc(acc, velocity);
}
const n = Math.min(
getAdjustedContentVelocity(velocity, size, acc, 'x'),
getAdjustedContentVelocity(velocity, size, acc, 'y')
);
return { x: n * velocity.x, y: n * velocity.y };
}
export function calculateDeceleration(

@@ -128,7 +150,6 @@ interval,

offsetEnd,
size,
name
) {
if (name) {
const [x, width] = name === 'y' ? ['y', 'height'] : ['x', 'width'];
const [x] = name === 'y' ? ['y'] : ['x'];

@@ -160,14 +181,2 @@ let offsetX = offset[x];

0.5 * (velocityH + velocityX) * (timeH - interval);
if (direction * (offsetEnd[x] - offsetX) <= 0) {
console.log('slow');
const direction2 = velocityX < 0 ? -1 : 1;
velocityX =
direction2 *
Math.min(
Math.abs(velocityX),
Math.sqrt(2 * direction * acc[x] * 0.25 * size[width])
);
}
}

@@ -186,20 +195,4 @@ } else {

return {
...calculateDeceleration(
interval,
acc,
velocity,
offset,
offsetEnd,
size,
'x'
),
...calculateDeceleration(
interval,
acc,
velocity,
offset,
offsetEnd,
size,
'y'
),
...calculateDeceleration(interval, acc, velocity, offset, offsetEnd, 'x'),
...calculateDeceleration(interval, acc, velocity, offset, offsetEnd, 'y'),
};

@@ -206,0 +199,0 @@ }

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc