define("@widget/GALLERY/bs-gallery4-Gallery-345bfda1.js",["exports","~/c/bs-wrapWithDeviceDetection","~/c/bs-dataAids","@wsb/guac-widget-shared@^1/lib/components/Masonry","~/c/bs-renderLightbox","~/c/bs-GalleryImage"],(function(e,t,a,o,r,i){"use strict";const l={[t.M]:182,[t.T]:370},{postRender:{Actions:n,monitor:s}}=(global.Core||guac["@wsb/guac-widget-core"]).utils;var c=t.w(class extends(global.React||guac.react).Component{constructor(e){super(...arguments),this.state={showLightbox:!1,selectedIndex:0,page:1,loading:e.imageCount>2&&!e.renderAsThumbnail},this.hideLightbox=this.hideLightbox.bind(this),this.handleClick=this.handleClick.bind(this),this.loadMore=this.loadMore.bind(this),this.hasNextPage=this.hasNextPage.bind(this),this.containerId=(global._||guac.lodash).uniqueId("gallery4-")}static get propTypes(){return{id:(global.PropTypes||guac["prop-types"]).string,category:(global.PropTypes||guac["prop-types"]).string,device:(global.PropTypes||guac["prop-types"]).string,galleryImages:(global.PropTypes||guac["prop-types"]).array.isRequired,renderAsThumbnail:(global.PropTypes||guac["prop-types"]).bool,renderMode:(global.PropTypes||guac["prop-types"]).string,section:(global.PropTypes||guac["prop-types"]).string,size:(global.PropTypes||guac["prop-types"]).string,staticContent:(global.PropTypes||guac["prop-types"]).object,imageCount:(global.PropTypes||guac["prop-types"]).number,enableImageDimension:(global.PropTypes||guac["prop-types"]).bool}}static get defaultProps(){return{category:"neutral",section:"default"}}componentDidMount(){const{id:e}=this.props;s(e,n.SCROLL_TO_URL_FRAGMENT)}hideLightbox(){this.setState({showLightbox:!1})}handleClick(e){this.setState({showLightbox:!0,selectedIndex:e})}loadMore(){this.setState({page:this.state.page+1})}renderSeeMoreText(){const{staticContent:e}=this.props;return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:{paddingTop:"xlarge",textAlign:"center"}},(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.MoreLink.Expand,{role:"button",tabIndex:"0",onClick:this.loadMore,"data-aid":a.d.GALLERY_MORE_BUTTON,children:e.showMore,"data-edit-interactive":!0}))}hasNextPage(){return!!this.props.galleryImages[this.state.page]}renderContent(e,o,r){const{device:n=t.T,enableImageDimension:s}=this.props,{loading:c}=this.state,g=l[n],d={padding:"xxsmall",width:"50%",display:"inline-block","@md":{width:"33.3333%"}},p={imageData:{...e,outputWidth:g,enableImageDimension:s},onClick:r?null:()=>{this.handleClick(e.index)},"data-aid":a.a(e.index),style:{cursor:"pointer",height:"auto",width:"100%",opacity:c?0:1,transition:"opacity 1s",display:"block"},...a.g(e.index,{isImage:!0}),isFullWidthMobile:!1};return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:d,"data-aid":a.c(e.index)},(global.React||guac.react).createElement(i.G,{imageProps:p,externalLink:r,background:!1}))}renderFakeContent(e){return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Container,{style:{padding:"xxsmall",width:"100%",display:"inline-block",margin:"0.25em"}},(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Image,{"data-aid":a.d.FAKE_THUMBNAIL_NAV_LIST,style:{cursor:"pointer",width:"100%",height:"auto"},imageData:e}))}renderFakeMasonry(e){return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Container,{style:{"-moz-column-width":"22em","-webkit-column-width":"22em","-moz-column-gap":"1em","-webkit-column-gap":"1em"}},e)}renderMasonry(e){const{device:t,renderMode:a,imageCount:r}=this.props,i=r>2?(global.React||guac.react).createElement(o.default,{device:t,renderMode:a,container:`#${this.containerId}`,onLoad:()=>{this.setState({loading:!1})}},e):e,l=r>2?{margin:0,width:"calc(100% - 0.5px) !important"}:{display:"flex",flexDirection:"row",justifyContent:"center"};return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{id:this.containerId,style:l},i)}render(){const{device:e,galleryImages:t,renderAsThumbnail:a,size:o}=this.props,i=("mobile"===e||"xs"===o)&&a,l=t.slice(0,this.state.page).map((e=>e.map((t=>{let{image:a,externalLink:o}=t;return i?this.renderFakeContent(a):this.renderContent(a,e.length,o)})))),n=i?this.renderFakeMasonry(l):this.renderMasonry(l);return(global.React||guac.react).createElement((global.Core||guac["@wsb/guac-widget-core"]).UX2.Element.Block,{style:{marginHorizontal:"-xxsmall"}},n,r.r.call(this),this.hasNextPage()?this.renderSeeMoreText():null)}});e.default=c,Object.defineProperty(e,"__esModule",{value:!0})})),"undefined"!=typeof window&&(window.global=window); //# sourceMappingURL=bs-gallery4-Gallery-345bfda1.js.map