define("@widget/LAYOUT/bs-BackgroundCarousel-Component-20ab7d3b.js",["exports","~/c/bs-_rollupPluginBabelHelpers","~/c/bs-dataAids","@wsb/guac-widget-shared@^1/lib/components/Carousel","~/c/bs-index","~/c/bs-overlayTypes","~/c/bs-utils","~/c/bs-PortalContainer"],(function(e,a,o,t,r,p,l,s){"use strict";const n="slides";(global.PropTypes||guac["prop-types"]).shape({image:(global.PropTypes||guac["prop-types"]).string,video:(global.PropTypes||guac["prop-types"]).string,oWidth:(global.PropTypes||guac["prop-types"]).number,oHeight:(global.PropTypes||guac["prop-types"]).number,alt:(global.PropTypes||guac["prop-types"]).string,coordinates:(global.PropTypes||guac["prop-types"]).shape({x:(global.PropTypes||guac["prop-types"]).number,y:(global.PropTypes||guac["prop-types"]).number}),editedAspectRatio:(global.PropTypes||guac["prop-types"]).string,height:(global.PropTypes||guac["prop-types"]).string,width:(global.PropTypes||guac["prop-types"]).string,left:(global.PropTypes||guac["prop-types"]).string,top:(global.PropTypes||guac["prop-types"]).string,rotation:(global.PropTypes||guac["prop-types"]).string,scale:(global.PropTypes||guac["prop-types"]).number,position:(global.PropTypes||guac["prop-types"]).string,overlayAlpha:(global.PropTypes||guac["prop-types"]).number});const g=(global.PropTypes||guac["prop-types"]).shape({image:(global.PropTypes||guac["prop-types"]).string,oWidth:(global.PropTypes||guac["prop-types"]).number,oHeight:(global.PropTypes||guac["prop-types"]).number,alt:(global.PropTypes||guac["prop-types"]).string,coordinates:(global.PropTypes||guac["prop-types"]).shape({x:(global.PropTypes||guac["prop-types"]).number,y:(global.PropTypes||guac["prop-types"]).number}),editedAspectRatio:(global.PropTypes||guac["prop-types"]).string,height:(global.PropTypes||guac["prop-types"]).string,width:(global.PropTypes||guac["prop-types"]).string,left:(global.PropTypes||guac["prop-types"]).string,top:(global.PropTypes||guac["prop-types"]).string,rotation:(global.PropTypes||guac["prop-types"]).string,scale:(global.PropTypes||guac["prop-types"]).number,position:(global.PropTypes||guac["prop-types"]).string,overlayAlpha:(global.PropTypes||guac["prop-types"]).number}),i=(global.PropTypes||guac["prop-types"]).shape({image:(global.PropTypes||guac["prop-types"]).string,video:(global.PropTypes||guac["prop-types"]).string,oWidth:(global.PropTypes||guac["prop-types"]).number,oHeight:(global.PropTypes||guac["prop-types"]).number,alt:(global.PropTypes||guac["prop-types"]).string,overlayAlpha:(global.PropTypes||guac["prop-types"]).number}),c=(global.PropTypes||guac["prop-types"]).shape({autoplay:(global.PropTypes||guac["prop-types"]).bool,autoplayDelay:(global.PropTypes||guac["prop-types"]).number,transition:(global.PropTypes||guac["prop-types"]).oneOf(["fade","slide"]),type:(global.PropTypes||guac["prop-types"]).oneOf(["imagesOnly",n]),dots:(global.PropTypes||guac["prop-types"]).bool,arrows:(global.PropTypes||guac["prop-types"]).bool,slides:(global.PropTypes||guac["prop-types"]).arrayOf((global.PropTypes||guac["prop-types"]).shape({image:g,heroContent:(global.PropTypes||guac["prop-types"]).shape({tagline:(global.PropTypes||guac["prop-types"]).string,tagline2:(global.PropTypes||guac["prop-types"]).string,cta:(global.PropTypes||guac["prop-types"]).object})})),alignmentOption:(global.PropTypes||guac["prop-types"]).string,themeConfig:(global.PropTypes||guac["prop-types"]).shape({height:(global.PropTypes||guac["prop-types"]).string,maxWidthPercent:(global.PropTypes||guac["prop-types"]).number})});(global.PropTypes||guac["prop-types"]).shape({mediaType:(global.PropTypes||guac["prop-types"]).oneOf([p.I,p.V,p.S]).isRequired,background:g,video:i,slideshow:c});const{DEFAULT:d,ALT:u,OVERLAY:b}=(global.Core||guac["@wsb/guac-widget-core"]).constants.sectionTypes,y=e=>{let{data:a,blur:o,children:t,dataRoute:r,dataAid:l,overlay:s,treatment:n,style:g={},backgroundSize:i,section:c,showOverlay:d,disableOverlayMobile:u}=e;const{image:y,position:h,alt:m,overlayAlpha:T}=a;if(!y)return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,null,t);const P=n===p.L,w=i||"cover",v={...(h||"").indexOf(" ")>-1?{backgroundPosition:h}:{},...g};return P?(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Component.Background,{backgroundSize:"contain",imageData2:{...a,additionalUrlParams:["fx-bl=s:30"]},backgroundSize2:"cover","data-aid":l,"data-field-id":r,"aria-label":m,section:b,style:v,overlay:s,treatment:n,"data-ht":n,overlayAlpha:d?T:0,disableOverlayMobile:u,imageData:a},t):(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Component.Background,{"data-aid":l,"data-field-id":r,"aria-label":m,section:c,style:v,overlay:s,treatment:n,"data-ht":n,backgroundSize:w,overlayAlpha:d?T:0,disableOverlayMobile:u,imageData:a,blur:o},t)};y.propTypes={blur:(global.PropTypes||guac["prop-types"]).bool,data:g.isRequired,dataAid:(global.PropTypes||guac["prop-types"]).string,children:(global.PropTypes||guac["prop-types"]).any,overlay:(global.PropTypes||guac["prop-types"]).oneOf([p.C,p.P,p.N,p.A,p.a]),section:(global.PropTypes||guac["prop-types"]).oneOf([d,u,b]),style:(global.PropTypes||guac["prop-types"]).object,treatment:(global.PropTypes||guac["prop-types"]).oneOf([p.F,p.b,p.c,p.B,p.L]),backgroundSize:(global.PropTypes||guac["prop-types"]).string,mobileSize:(global.PropTypes||guac["prop-types"]).string,dataRoute:(global.PropTypes||guac["prop-types"]).string,showOverlay:(global.PropTypes||guac["prop-types"]).bool,disableOverlayMobile:(global.PropTypes||guac["prop-types"]).bool},y.defaultProps={blur:!1,dataAid:o.D.BACKGROUND_IMAGE_RENDERED,overlay:p.a,section:b,showOverlay:!0};class h extends(global.React||guac.react).Component{constructor(){super(...arguments),a._(this,"goToSlide",((e,a)=>{a.stopPropagation(),this.props.goToSlide(e)}))}render(){const{numSlides:e,selectedIndex:o,editingIndex:t,visible:r,containerId:p}=this.props;if(e<=1)return null;const l={list:{listStyle:"none",padding:0,marginTop:0,marginBottom:p?0:"medium","@md":{marginBottom:p?0:"large"}},listItem:{display:"inline-block",cursor:"pointer"},wrapper:{display:r?"block":"none",position:"absolute",bottom:0,left:"50%",transform:"translateX(-50%)",width:"100%",zIndex:2}},n=[];for(let r=0;r=0?{"data-field-id":"slides","data-field-route":`/mediaData/slides/${r}`}:{"data-edit-interactive":!0};n.push((global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,a.a({tag:"li",key:`dot-${r}`,style:l.listItem,onClick:this.goToSlide.bind(null,r)},p),(global.React||guac.react).createElement(e,{"data-aid":`SLIDE_SELECTION_DOT_${r}`})))}const g=(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{tag:"ul",style:l.list},n);return p?(global.React||guac.react).createElement(s.P,{containerId:p},g):(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:l.wrapper},g)}}function m(e){const{numSlides:o,editingIndex:t,visible:r,containerId:l,mobileContainerId:n,nextSlide:g,prevSlide:i,viewDevice:c,renderMode:d,headerTreatment:u}=e,[b,y]=(global.React||guac.react).useState(!1),[h,m]=(global.React||guac.react).useState(!1),T=(global.React||guac.react).useCallback((e=>{e.stopPropagation(),i()}),[i]),P=(global.React||guac.react).useCallback((e=>{e.stopPropagation(),g()}),[g]),w=(global.React||guac.react).useCallback((e=>{const a=d===(global.Core||guac["@wsb/guac-widget-core"]).constants.renderModes.PUBLISH?"xs"===e.size:function(e){return/mobile/i.test(e)}(c);h&&a===b||(y(a),m(!0))}),[c,d,b,h,y,m]);if(o<=1)return null;const v={overlay:{display:r&&h?"flex":"none",justifyContent:"center",position:"absolute","@xs-only":{bottom:0,left:"small",right:"small",marginBottom:"small"},"@sm":{left:0,right:0,top:u===p.d?"unset":"calc(50% - 20px)",bottom:u===p.d?30:"unset"}}},C=t>=0?{"data-route":"/mediaData"}:{},f=(global.React||guac.react).createElement((global.React||guac.react).Fragment,null,(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX.MatchMedia,{onChange:w}),(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Group.SlideshowArrows,null,(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Button.Previous,a.a({onClick:T,"data-edit-interactive":!0},C)),(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Button.Next,a.a({onClick:P,"data-edit-interactive":!0},C))));return b&&n?(global.React||guac.react).createElement(s.P,{containerId:n},f):l?(global.React||guac.react).createElement(s.P,{containerId:l},f):(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:v.overlay},f)}h.propTypes={numSlides:(global.PropTypes||guac["prop-types"]).number,selectedIndex:(global.PropTypes||guac["prop-types"]).number,goToSlide:(global.PropTypes||guac["prop-types"]).func,editingIndex:(global.PropTypes||guac["prop-types"]).number,visible:(global.PropTypes||guac["prop-types"]).bool,containerId:(global.PropTypes||guac["prop-types"]).string},m.propTypes={numSlides:(global.PropTypes||guac["prop-types"]).number,prevSlide:(global.PropTypes||guac["prop-types"]).func,nextSlide:(global.PropTypes||guac["prop-types"]).func,editingIndex:(global.PropTypes||guac["prop-types"]).number,visible:(global.PropTypes||guac["prop-types"]).bool,containerId:(global.PropTypes||guac["prop-types"]).string,mobileContainerId:(global.PropTypes||guac["prop-types"]).string,renderMode:(global.PropTypes||guac["prop-types"]).string,viewDevice:(global.PropTypes||guac["prop-types"]).string,headerTreatment:(global.PropTypes||guac["prop-types"]).string};class T extends(global.React||guac.react).Component{componentDidUpdate(){const{goToSlide:e,editingIndex:a}=this.props;"number"==typeof a&&a>=0&&e(a)}render(){return null}}T.propTypes={renderKey:(global.PropTypes||guac["prop-types"]).number,editingIndex:(global.PropTypes||guac["prop-types"]).number,goToSlide:(global.PropTypes||guac["prop-types"]).func};const{renderModes:{LAYOUT:P,DISPLAY:w,PUBLISH:v,EDIT:C}}=(global.Core||guac["@wsb/guac-widget-core"]).constants,f=[/mediaData\/slides\/(\d+).*/,/mediaData\/(\d+).*\/image/];class E extends(global.React||guac.react).Component{constructor(){super(...arguments),this.state={currentSlide:0,showText:!1,navOpen:!1},this.afterChange=this.afterChange.bind(this),this.beforeChange=this.beforeChange.bind(this),this.handleNavDrawerOpened=this.handleNavDrawerOpened.bind(this),this.handleNavDrawerClosed=this.handleNavDrawerClosed.bind(this),this.getSlideEditingIndex=this.getSlideEditingIndex.bind(this),this._loadedImages=new Set}fireTransitionEvent(e){window.dispatchEvent(new CustomEvent("slideshowTransition",{detail:{slide:e,id:this.props.slideshow.themeConfig.slideshowId}}))}afterChange(e){const{renderMode:a,slideshow:o}=this.props,{type:t,themeConfig:{useHeroCarousel:r}}=o;a!==v||t!==n||r||l.p(o,e),this.setState({currentSlide:e,showText:!1},(()=>{setTimeout((()=>{this.setState({showText:!0})}),800)})),this.fireTransitionEvent(e)}beforeChange(e){this.fireTransitionEvent(e)}handleNavDrawerOpened(){this.setState({navOpen:!0})}handleNavDrawerClosed(){this.setState({navOpen:!1})}componentDidMount(){this.afterChange(0),window.addEventListener("NavigationDrawerOpened",this.handleNavDrawerOpened),window.addEventListener("NavigationDrawerClosed",this.handleNavDrawerClosed)}componentWillUnmount(){window.removeEventListener("NavigationDrawerOpened",this.handleNavDrawerOpened),window.removeEventListener("NavigationDrawerClosed",this.handleNavDrawerClosed)}getSlideEditingIndex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const{renderMode:a}=this.props;if(a===v)return-1;let o=-1;return f.forEach((a=>{const t=e.match(a);t&&t[1]&&(o=parseInt(t[1],10))})),o}render(){const{slideshow:e,renderMode:p,mutatorPath:s,dataRoute:g,viewDevice:i,heroContainerStyle:c,headerTreatment:d,...u}=this.props,{currentSlide:b,showText:v,navOpen:f}=this.state,{slides:E,type:I,autoplay:S,autoplayDelay:D,transition:R,dots:x,arrows:O,alignmentOption:k,heroIdPrefix:A,themeConfig:U}=e,{maxWidthPercent:M=100,useHeroCarousel:N,dotsContainerId:B,arrowsContainerId:L,mobileArrowsContainerId:X}=U,_=[P,w].includes(p),H={height:"100%",...c};let z=!1;const W=new Set(_?[0]:[b-1<0?E.length-1:b-1,b,b+1===E.length?0:b+1]),j=E.map(((e,t)=>{const s=e||{},g=s.image||{},i=`${o.D.HEADER_SLIDE}_${t}`,c=O?Math.min(M,80):M;let d;if(I===n&&!N){let e=!1;!z&&s.tagline&&(e=!0,z=!0),d=(global.React||guac.react).createElement(l.S,{slide:s,index:t,forceH1:e,alignmentOption:k,heroIdPrefix:A,themeConfig:U,renderMode:p,currentSlide:b,showText:v,slideWidthPercent:c,style:H})}return g.image&&(this._loadedImages.has(g.image)||W.has(t))?(this._loadedImages.add(g.image),(global.React||guac.react).createElement(y,a.a({key:t,data:{overlayAlpha:r.D,...g}},(global._||guac.lodash).pick(u,Object.keys(y.propTypes)),{style:H,dataAid:i,dataRoute:""}),d)):(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{key:t,style:H,dataAid:i},d)})),$=this.getSlideEditingIndex(s),F={mobile:!1,position:"bottom",editingIndex:$,viewDevice:i,renderMode:p},Y=[];x&&Y.push({component:h,props:{...F,visible:!f,containerId:B}}),O&&Y.push({component:m,props:{...F,visible:!f,containerId:L,mobileContainerId:X,headerTreatment:d}});let G=S;if(_||f)G=!1;else if(p===C){G=S&&-1===$;const e=b===$?0:Math.random();Y.push({component:T,props:{renderKey:e,editingIndex:$}})}const K=parseFloat(D),q={style:{container:{height:"100%"},containerInner:{height:"100%"},track:{height:"100%"},..."slide"===R?{slide:{opacity:1}}:{}},viewportWidth:"100%",viewportHeight:"100%",height:"100%",slideWidth:"100%",slideHeight:"100%",autoplay:G,autoplaySpeed:Number.isNaN(K)?7e3:Math.max(1e3*K,2e3),transition:R,transitionDuration:1e3,infinite:!0,lazyLoad:!1,dots:!1,arrows:!1,draggable:G||x||O,pauseOnHover:!1,afterChange:this.afterChange,beforeChange:this.beforeChange,controls:Y};return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:{height:"100%"}},p===C&&(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{"data-field-id":g,style:{position:"absolute",top:0,bottom:0,left:0,right:0}}),(global.React||guac.react).createElement(t.default,q,j))}}E.propTypes={slideshow:(global.PropTypes||guac["prop-types"]).object,heroTrackId:(global.PropTypes||guac["prop-types"]).string,dataRoute:(global.PropTypes||guac["prop-types"]).string,renderMode:(global.PropTypes||guac["prop-types"]).string,viewDevice:(global.PropTypes||guac["prop-types"]).string,mutatorPath:(global.PropTypes||guac["prop-types"]).string,heroContainerStyle:(global.PropTypes||guac["prop-types"]).object,headerTreatment:(global.PropTypes||guac["prop-types"]).string},e.default=E,Object.defineProperty(e,"__esModule",{value:!0})})),"undefined"!=typeof window&&(window.global=window); //# sourceMappingURL=bs-BackgroundCarousel-Component-20ab7d3b.js.map