define("@wsb/guac-widget-shared/lib/components/Carousel-7574d33c.js",["exports","~/c/_rollupPluginBabelHelpers","~/c/_commonjsHelpers","~/c/interopRequireDefault","~/c/_react_commonjs-external"],(function(e,t,n,i,r){"use strict";var o=n.c((function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})),s=n.c((function(e){var t=o.default;function n(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(n=function(e){return e?i:t})(e)}e.exports=function(e,i){if(!i&&e&&e.__esModule)return e;if(null===e||"object"!==t(e)&&"function"!=typeof e)return{default:e};var r=n(i);if(r&&r.has(e))return r.get(e);var o={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var l=s?Object.getOwnPropertyDescriptor(e,a):null;l&&(l.get||l.set)?Object.defineProperty(o,a,l):o[a]=e[a]}return o.default=e,r&&r.set(e,o),o},e.exports.__esModule=!0,e.exports.default=e.exports})),a=n.c((function(e){function t(){return e.exports=t=Object.assign?Object.assign.bind():function(e){for(var t=1;t0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*p;case"weeks":case"week":case"w":return n*f;case"days":case"day":case"d":return n*h;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*d;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===n&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=h)return g(e,t,h,"day");if(t>=c)return g(e,t,c,"hour");if(t>=u)return g(e,t,u,"minute");if(t>=d)return g(e,t,d,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=h)return Math.round(e/h)+"d";if(t>=c)return Math.round(e/c)+"h";if(t>=u)return Math.round(e/u)+"m";if(t>=d)return Math.round(e/d)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function g(e,t,n,i){var r=t>=1.5*n;return Math.round(e/n)+" "+i+(r?"s":"")}var v=n.c((function(e){ /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ !function(){var t={}.hasOwnProperty;function n(){for(var e=[],i=0;i0:i=0&&t{const{currentSlide:e}=this.state,t=this._track.childNodes,{slideWidth:n,slideHeight:i}=this.props;if(!n||!i)for(let n=0;n{const{beforeChange:i,transitionDuration:r,transition:o,onSlideTransitioned:s,children:a}=this.props,{currentSlide:l}=this.state,u=d.Children.count(a)-1,c=e<0?u+e+1:e<=u?e:e-u-1;t=t||(e>l?"right":"left"),s&&s({autoPlay:n,index:c,direction:t}),l!==c&&(this._animating||(this._animating=!0,i&&i(c,l,t),this.setState({transitionDuration:r},(()=>{this.setState({currentSlide:c,direction:t,transitioningFrom:l},(()=>{r&&"fade"!==o&&"none"!==o||this.slideTransitionEnd()}))}))))})),(0,o.default)(this,"nextSlide",(e=>{const{currentSlide:t}=this.state;this.goToSlide(t+1,"right","object"!=typeof e)})),(0,o.default)(this,"prevSlide",(()=>{const{currentSlide:e}=this.state;this.goToSlide(e-1,"left")})),(0,o.default)(this,"slideTransitionEnd",(e=>{const{currentSlide:t}=this.state,{afterChange:n}=this.props;e&&"transform"!==e.propertyName||(this._animating=!1,this.setState({direction:null,transitioningFrom:null,transitionDuration:0},(()=>{this._allImagesLoaded||this.fetchImages()})),this.props.autoplay&&this.startAutoplay(),n&&n(t))})),(0,o.default)(this,"calcLeftOffset",((e=0)=>{const{direction:t,loading:n}=this.state,{isVertical:i}=this.props,r=this._viewport&&(i?this._viewport.offsetHeight:this._viewport.offsetWidth);if(clearTimeout(this._retryTimer),!this._track||!r)return void(this._retryTimer=setTimeout(this.calcLeftOffset,10));const{infinite:o,children:s,cellPadding:a,slideAlignment:l}=this.props;let{currentSlide:u}=this.state;const c=this._track.childNodes,h=d.Children.count(s);o&&(0===u&&"right"===t?u=h:u===h-1&&"left"===t&&(u=-1));let f,p,m=0,g=!1,v=!1;for(let e=0;e{const{clickToNavigate:t}=this.props,{currentSlide:n}=this.state,i=parseInt(e.currentTarget.getAttribute("data-index"),10);!t||i===n||Math.abs(this._startPos.x-e.clientX)>.01||this.goToSlide(i)})),(0,o.default)(this,"onMouseDown",(e=>{const{draggable:t,transition:n}=this.props;"IMG"===e.target.nodeName&&e.preventDefault(),t&&"slide"===n&&!this._animating&&(this._autoplayTimer&&clearTimeout(this._autoplayTimer),this._startPos={x:e.clientX,y:e.clientY,startTime:Date.now()},this.setState({transitionDuration:0}),document.addEventListener("mousemove",this.onMouseMove,{passive:!1}),document.addEventListener("mouseup",this.stopDragging,!1))})),(0,o.default)(this,"onMouseMove",(e=>{e.preventDefault(),this.setState({dragOffset:e.clientX-this._startPos.x})})),(0,o.default)(this,"onMouseEnter",(()=>{document.addEventListener("mousemove",this.handleMovement,!1)})),(0,o.default)(this,"handleMovement",(()=>{this.setHoverState(!0)})),(0,o.default)(this,"onMouseOver",(()=>{this.setHoverState(!0)})),(0,o.default)(this,"onMouseLeave",(()=>{document.removeEventListener("mousemove",this.handleMovement,!1),this.setHoverState(!1),!this._animating&&this._startPos&&this.stopDragging()})),(0,o.default)(this,"onTouchStart",(e=>{const{draggable:t,transition:n}=this.props;t&&"slide"===n&&!this._animating&&(this._autoplayTimer&&clearTimeout(this._autoplayTimer),1===e.touches.length&&(this._startPos={x:e.touches[0].screenX,y:e.touches[0].screenY,startTime:Date.now()},document.addEventListener("touchmove",this.onTouchMove,{passive:!1}),document.addEventListener("touchend",this.stopDragging,!1)))})),(0,o.default)(this,"onTouchMove",(e=>{const{x:t,y:n}=this._prevPos||this._startPos,{screenX:i,screenY:r}=e.touches[0],o=180*Math.abs(Math.atan2(r-n,i-t))/Math.PI;this._prevPos={x:i,y:r},(o<20||o>160)&&(e.preventDefault(),this.setState({dragOffset:i-this._startPos.x}))})),(0,o.default)(this,"stopDragging",(()=>{const{dragThreshold:e,transitionDuration:t}=this.props,{dragOffset:n}=this.state,i=this._viewport&&this._viewport.offsetWidth||1,r=Math.abs(n/i),o=Date.now()-this._startPos.startTime||1,s=o/(r*i),a=r>.05&&o<250;let l;l=a||r>e?Math.min(s*(1-r)*i,(0,c.default)(""+t)*(1-r)):(0,c.default)(""+t)*r,this.removeDragListeners(),this.setState({transitionDuration:l},(()=>{const{children:t,infinite:i}=this.props,{currentSlide:o}=this.state,s=d.Children.count(t);let l=o,u="";(r>e||a)&&(n>0?(l--,l<0&&(l=i?s-1:o)):(l++,l===s&&(l=i?0:o)),u=n>0?"left":"right"),this.setState({dragOffset:0,currentSlide:l,direction:u})})),this.props.autoplay&&this.startAutoplay()})),this.state={currentSlide:e.initialSlide,loading:e.lazyLoad,loadedImages:{},slideDimensions:{},dragOffset:0,transitionDuration:0,transitioningFrom:null}}static getDerivedStateFromProps(e,t){const{currentSlide:n}=t,i=d.Children.count(e.children);return n>=i?{currentSlide:i?i-1:0}:null}componentDidUpdate(e,t){const{children:n,autoplay:i,slideWidth:r,slideAlignment:o}=this.props,{currentSlide:s,loadedImages:a,direction:l,loading:u,slideDimensions:c}=this.state,h=e.children;l===t.direction&&s===t.currentSlide&&a===t.loadedImages&&r===e.slideWidth&&c.width===t.slideDimensions.width&&c.height===t.slideDimensions.height&&o===e.slideAlignment||this.calcLeftOffset(),(0,f.default)(d.Children.toArray(n),d.Children.toArray(h))||(this._animating=!1,this.fetchImages()),i&&(!u&&t.loading||!e.autoplay)&&this.startAutoplay()}componentDidMount(){const{lazyLoad:e,autoplay:t}=this.props;this._isMounted=!0,e?this.fetchImages():(t&&this.startAutoplay(),this.calcLeftOffset()),window.addEventListener("resize",this.calcLeftOffset,!1),window.IntersectionObserver&&(this._observer=new window.IntersectionObserver((e=>{this.props.autoplay&&(e&&e[0]&&e[0].isIntersecting?this.startAutoplay():clearTimeout(this._autoplayTimer))})),this._observer.observe(this._containerRef))}componentWillUnmount(){this.removeDragListeners(),window.removeEventListener("resize",this.calcLeftOffset,!1),document.removeEventListener("mousemove",this.handleMovement,!1),clearTimeout(this._autoplayTimer),clearTimeout(this._retryTimer),clearTimeout(this._initialLoadTimer),this._observer&&this._observer.unobserve(this._containerRef),this._isMounted=!1}startAutoplay(){clearTimeout(this._autoplayTimer),this._autoplayTimer=setTimeout((()=>{const{autoplay:e}=this.props;e&&this.nextSlide()}),(0,c.default)(""+this.props.autoplaySpeed))}fetchImages(){const{children:e}=this.props,{loadedImages:t,currentSlide:n}=this.state,i=d.Children.toArray(e),r=Math.min(this.props.imagesToPrefetch,i.length),o=n-Math.floor(r/2),s=o+r,a=[],l=i[n].props.src;for(let e=o;e{const t=new Image;t.onload=t.onerror=()=>{this._isMounted&&this.setState({loadedImages:{...this.state.loadedImages,[e]:{width:t.width||"auto",height:t.height||"auto"}}},(()=>{e===l&&this.handleInitialLoad()}))},t.src=e})):this.calcLeftOffset()}getControls(){const{arrows:e,dots:t,controls:n,isVertical:i}=this.props;let r=n.slice(0);return t&&r.push({component:x.Dots}),e&&(r=r.concat([{...i?{component:x.Arrow,props:{direction:"top"}}:{component:x.Arrow,props:{direction:"left"}}},{...i?{component:x.Arrow,props:{direction:"bottom"}}:{component:x.Arrow,props:{direction:"right"}}}])),r}render(){const{className:e,viewportWidth:t,viewportHeight:i,width:r,height:o,dots:s,infinite:a,children:l,slideHeight:u,transition:f,style:p,draggable:m,easing:g,arrows:v,dir:y,isVertical:b}=this.props,{loading:w,transitionDuration:x,dragOffset:S,currentSlide:_,leftOffset:T}=this.state,M=d.Children.count(l),O=(0,h.default)("carousel",e,{loaded:!w}),E={...p.container||{},width:r,height:o},k={...p.containerInner||{},width:r,height:o,marginBottom:s?"20px":0,...b&&{display:"flex"}},D={...p.viewport||{},width:t,height:i||u||"auto"},L="rtl"===y;let P={...p.track};if("slide"===f){const e=T+S;P={...P,...b&&{transform:`translateY(${L?-e:e}px)`},...!b&&{transform:`translateX(${L?-e:e}px)`},transition:x?`transform ${(0,c.default)(""+x)}ms ${g}`:"none"}}m||(P.touchAction="auto");const I=this.getControls();return d.default.createElement("div",{className:O,style:E,ref:e=>{this._containerRef=e}},d.default.createElement("div",{className:"carousel-container-inner",style:k},I.filter((e=>"top"===e.position)).map(((e,t)=>d.default.createElement(e.component,(0,n.default)({},e.props,{key:`control-${t}`,selectedIndex:_,numSlides:M,nextSlide:this.nextSlide,prevSlide:this.prevSlide,goToSlide:this.goToSlide,infinite:a})))),d.default.createElement("div",{className:"carousel-viewport",ref:e=>{this._viewport=e},style:D},d.default.createElement("ul",{className:"carousel-track",style:{...P,...b&&{display:"flex",flexDirection:"column"}},ref:e=>{this._track=e},onTransitionEnd:this.slideTransitionEnd,onMouseDown:this.onMouseDown,onMouseLeave:this.onMouseLeave,onMouseOver:this.onMouseOver,onMouseEnter:this.onMouseEnter,onTouchStart:this.onTouchStart},this.renderSlides())),I.filter((e=>"top"!==e.position)).map(((e,t)=>d.default.createElement(e.component,(0,n.default)({},e.props,{key:`control-${t}`,selectedIndex:_,numSlides:M,nextSlide:this.nextSlide,prevSlide:this.prevSlide,goToSlide:this.goToSlide,arrows:v,infinite:a}))))))}renderSlides(){const{children:e,infinite:t,cellPadding:n,slideWidth:i,slideHeight:r,transition:o,transitionDuration:s,style:a,easing:l,lazyLoad:u,isVertical:f}=this.props,{slideDimensions:p,currentSlide:m,loadedImages:v}=this.state;this._allImagesLoaded=!0;let y=d.Children.map(e,((e,t)=>{const y=`slide-${t}`,w=e.props.src,x=(0,h.default)("carousel-slide",{[g]:t===m,"carousel-slide-fade":"fade"===o||"none"===o});let S={...!f&&{marginLeft:`${n}px`},...f&&{marginTop:`${n}px`},height:r,width:i};"fade"===o?S.transition=`opacity ${(0,c.default)(""+s)}ms ${l}`:"none"===o&&(S.transition="none"),r&&(S.overflowY="hidden",S.minHeight=r),i&&(S.overflowX="hidden",S.minWidth=i),S={...S,...a.slide||{},...t===m&&a.selectedSlide||{}};const _={...S||{},marginLeft:S.marginLeft,width:i||p.width,height:r||p.height},T=this.getIndicesToRender();if(!u||(w?v[w]:T.indexOf(t)>-1)){if(w&&v[w]){const{width:e,height:t}=v[w];S.height=S.height||t,S.width=S.width||e}return d.default.createElement("li",{key:y,style:S,"data-index":t,className:x,onClick:this.handleSlideClick},e)}return w&&(this._allImagesLoaded=!1),d.default.createElement("li",{key:y,style:_,"data-index":t,className:(0,h.default)(x,b),onClick:this.handleSlideClick})}));return t&&"slide"===o&&(y=this.addClones(y)),y}getIndicesToRender(){const{currentSlide:e,transitioningFrom:t}=this.state,{children:n,infinite:i,maxRenderedSlides:r}=this.props,o=d.Children.count(n);function s(e,t){const n=[];for(let r=e;r<=t;r++)i&&r<0?n.push(o+r):i&&r>=o?n.push(r-o):n.push(r);return n}const a=Math.max(1,r),l=Math.floor((a-1)/2),u=Math.floor(a/2);let c=s(e-l,e+u);return null!==t&&(c=c.concat(s(t-l,t+u))),c}addClones(e){const t=e.length,n=[(0,p.default)(e,t-2),(0,p.default)(e,t-1),(0,p.default)(e,0),(0,p.default)(e,Math.min(1,t-1))],i=[(0,d.cloneElement)(n[0],{key:"clone-1","data-index":-2,className:n[0].props.className.replace(g,"")}),(0,d.cloneElement)(n[1],{key:"clone-0","data-index":-1,className:n[1].props.className.replace(g,"")})],r=[(0,d.cloneElement)(n[2],{key:"clone-2","data-index":t,className:n[2].props.className.replace(g,"")}),(0,d.cloneElement)(n[3],{key:"clone-3","data-index":t+1,className:n[3].props.className.replace(g,"")})];return i.concat(e).concat(r)}setHoverState(e){const{pauseOnHover:t,autoplay:n}=this.props;t&&n&&(clearTimeout(this._hoverTimer),e?(clearTimeout(this._autoplayTimer),this._hoverTimer=setTimeout((()=>{this.setHoverState(!1)}),2e3)):this.startAutoplay())}removeDragListeners(){document.removeEventListener("mousemove",this.onMouseMove,{passive:!1}),document.removeEventListener("mouseup",this.stopDragging,!1),document.removeEventListener("touchmove",this.onTouchMove,{passive:!1}),document.removeEventListener("touchend",this.stopDragging,!1)}}t.default=w})),M=n.g(T),O='.carousel {\n text-align: center;\n position: relative;\n opacity: 0;\n margin: 0 auto;\n transition: opacity 0.5s;\n}\n.carousel .carousel-container-inner {\n margin: 0 auto;\n position: relative;\n}\n.carousel .carousel-viewport {\n overflow: hidden;\n white-space: nowrap;\n text-align: left;\n}\n.carousel .carousel-arrow-default {\n border: 3px solid !important;\n border-radius: 50%;\n color: rgba(255, 255, 255, 0.9);\n height: 32px;\n width: 32px;\n font-weight: 900;\n background: rgba(0, 0, 0, 0.15);\n}\n.carousel .carousel-arrow {\n position: absolute;\n z-index: 1;\n bottom: 23px;\n padding: 0;\n cursor: pointer;\n border: none;\n}\n.carousel .carousel-arrow:focus {\n outline: none;\n}\n.carousel .carousel-arrow:before {\n font-size: 19px;\n display: block;\n margin-top: -2px;\n}\n.carousel .carousel-arrow:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n.carousel .carousel-left-arrow {\n left: 23px;\n}\n.carousel .carousel-right-arrow {\n right: 23px;\n}\n.carousel .carousel-left-arrow.carousel-arrow-default:before {\n content: \'<\';\n padding-right: 2px;\n}\n.carousel .carousel-right-arrow.carousel-arrow-default:before {\n content: \'>\';\n padding-left: 2px;\n}\n.carousel .carousel-top-arrow {\n top: 75px;\n}\n.carousel .carousel-bottom-arrow {\n bottom: 75px;\n}\n.carousel .carousel-top-arrow.carousel-arrow-default:before {\n content: \'\\1431\';\n padding-bottom: 2px;\n}\n.carousel .carousel-bottom-arrow.carousel-arrow-default:before {\n content: \'\\142F\';\n padding-top: 2px;\n}\n.carousel .carousel-track {\n list-style: none;\n padding: 0;\n margin: 0;\n touch-action: pan-y pinch-zoom;\n}\n.carousel .carousel-track .carousel-slide {\n display: inline-block;\n opacity: 0.7;\n transition: opacity 0.5s ease-in-out;\n}\n.carousel .carousel-track .carousel-slide > * {\n display: block;\n white-space: normal;\n}\n.carousel .carousel-track .carousel-slide.carousel-slide-loading {\n background: rgba(204, 204, 204, 0.7);\n}\n.carousel .carousel-track .carousel-slide.carousel-slide-fade {\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n opacity: 0;\n}\n.carousel .carousel-track .carousel-slide.carousel-slide-selected {\n opacity: 1;\n z-index: 1;\n}\n.carousel.loaded {\n opacity: 1;\n}\n.carousel .carousel-dots {\n list-style: none;\n padding: 0;\n margin: 0;\n position: absolute;\n left: 0;\n right: 0;\n bottom: -30px;\n text-align: center;\n}\n.carousel .carousel-dots li {\n display: inline-block;\n}\n.carousel .carousel-dots button {\n border: 0;\n background: transparent;\n font-size: 1.1em;\n cursor: pointer;\n color: #CCC;\n padding-left: 6px;\n padding-right: 6px;\n}\n.carousel .carousel-dots button.selected {\n color: black;\n}\n.carousel .carousel-dots button:focus {\n outline: none;\n}\n[dir="rtl"] .carousel .carousel-viewport {\n text-align: right;\n}\n[dir="rtl"] .carousel .carousel-left-arrow {\n left: unset;\n right: 23px;\n}\n[dir="rtl"] .carousel .carousel-right-arrow {\n right: unset;\n left: 23px;\n}\n[dir="rtl"] .carousel .carousel-left-arrow.carousel-arrow-default:before {\n padding-left: 2px;\n padding-right: unset;\n}\n[dir="rtl"] .carousel .carousel-right-arrow.carousel-arrow-default:before {\n padding-right: 2px;\n padding-left: unset;\n}\n';const E="carousel-stylesheet";var k=(global.React||guac.react).forwardRef(((e,n)=>{const i="undefined"==typeof window;return(global.React||guac.react).useEffect((()=>{if(window.dispatchEvent(new Event("resize")),document.getElementById(E))return;const e=document.createElement("style");e.setAttribute("id",E),e.textContent=O,e.onload=()=>{window.dispatchEvent(new Event("resize"))},document.head.appendChild(e)}),[]),(global.React||guac.react).createElement((global.React||guac.react).Fragment,null,(global.React||guac.react).createElement(M,t._({},e,{ref:n})),i&&(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX.Style,{attributes:{id:E}}," ",O," "))}));e.default=k,Object.defineProperty(e,"__esModule",{value:!0})})),"undefined"!=typeof window&&(window.global=window); //# sourceMappingURL=Carousel-7574d33c.js.map