"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),Row_liquid=require("../../grid/components/row/Row.liquid.js"),system=require("@gem-sdk/system"),AdaptiveImage_liquid=require("../../image/components/AdaptiveImage.liquid.js"),HTML5Embed_liquid=require("../../video/components/HTML5Embed.liquid.js"),styles=require("../common/styles.js"),classes=require("../common/classes.js"),helpers=require("../common/helpers.js"),helpers$1=require("../../image/common/helpers.js"),NextImage_liquid=require("../../image/components/NextImage.liquid.js"),LiteYouTubeEmbed_liquid=require("../../video/components/LiteYouTubeEmbed.liquid.js"),helpers$3=require("../../video/common/helpers.js"),helpers$2=require("../../grid/components/row/common/helpers.js"),constants=require("../../image/constants.js");const HeroBannerItem=e=>{let{enableLazyLoadImage:s=!0,setting:t,styles:l,children:a,builderProps:r,rawChildren:i}=e,{layout:o,verticalAlign:c,enableParallax:m,alt:d,title:u,preload:y,isYoutubeVideoMigrated:n}=t??{},{background:p,overlayColor:g,verticalGutter:C,sizeSetting:h,contentWidth:q,hoverEffect:v,contentPosition1Col:b,contentPosition2Col:S,videoObjectFit:I}=l??{},f=!y&&s,$=helpers.getAspectRatio(h,p),R=helpers.getYoutubeAspectRatio(p,I,$),j=helpers.getResponsiveSetting(p||{}),B=j.desktop,k=system.createStyle({...styles.getContainerStyle(l)}),A=system.createClass({...classes.getContainerClasses(t,l)}),_=system.createStyle({...styles.getOverlayStyle(l)}),w=system.createClass({...classes.getOverlayClasses(l)}),H=system.createStyle({...styles.getRowStyle(l)}),T=system.createClass({...classes.getRowClasses(l,t)}),V=system.createStyle({...styles.getAdaptiveStyle(l)}),E=system.createClass({...classes.getAdaptivePictureClasses()}),L=system.createClass({...classes.getAdaptiveClasses()}),Y=system.createClass({...classes.getBackgroundClasses(v,f)}),N=system.createStyle({...helpers.getBackgroundImageHeroBanner(p,f,!1),...styles.getBackgroundStyle(l,m,"")}),x=system.createClass({...classes.getContainBackgroundClasses()}),z=system.createStyle({...styles.getContainBackgroundStyle(l)}),O=system.createClass({...classes.getHtml5VideoClasses(!1)}),D=system.createStyle({...styles.getYoutubeIframeStyle(R,I)}),M=system.createClass({...classes.getWrapperYoutubeClasses(n)}),P=system.createStyle({...styles.getHtml5VideoStyle($,I,p)}),W=system.createClass({...classes.getIframeYoutubeClasses()}),G=e=>system.createClass({...classes.getLazyBackgroundClasses(e)}),F=()=>{if(!y)return core.DEVICES.map(e=>system.If(helpers.getEnableBgImageByDevice(e,p),NextImage_liquid.default({src:helpers$1.getImageSrc(core.getResponsiveValueByScreen(helpers.getBgImage(p),e),e),alt:d,title:u,className:G(e),isDisableAspectStyle:!0,enableLazyLoadImage:s}))).join("")},J=()=>{if(!helpers.showVideoType(p))return;if(helpers$2.isRenderHtmlVideo(p))return HTML5Embed_liquid.default({uid:r?.uid,muted:!0,loop:B?.loop,controls:!1,autoplay:!0,src:B?.videoHtml5||"",title:"Video",style:P,className:O});let e=B?.video??"",s=helpers$3.getYoutubeVideoId(e),t=`&loop=false&playlist=${s}&showinfo=0&rel=0&fs=0&enablejsapi=1`;if(B?.type==="video"&&B?.videoType==="youtube"&&s&&helpers$3.youtubeVideoRegex.test(e))return LiteYouTubeEmbed_liquid.default({uid:r?.uid,id:s,isHeroBanner:!0,autoplay:!0,title:"Video",controls:!1,params:t,adNetwork:!1,noCookie:!0,muted:!0,lazy:B?.lazyLoad??!0,preload:!0,style:D,wrapperClass:M,iframeClass:W})};return core.template`
  <div class="${A}" style="${k}">
      <div
        class="${x}"
        style="${z}"
      >
        <div class="${Y}" style="${N}">
          ${F()}
          ${J()}
        </div>
        ${system.If(!!g,core.template`<div aria-label="Overlay" class="${w}" style="${_}"> </div>`)}
      </div>
      ${Row_liquid.default({className:T,style:H,setting:{layout:o,horizontalAlign:helpers.horizontalAlign(o,b,S),verticalAlign:c},styles:{verticalGutter:C,width:helpers.getWidth(q),fullWidth:{desktop:!1,tablet:!1,mobile:!1}},children:a,rawChildren:i})}
        ${AdaptiveImage_liquid.default({pictureClass:E,srcSet:helpers.getBgImage(p),className:L,...y&&constants.PRIORITY_LOAD_ATTRS,aspectRatio:core.getAspectRatioGlobalSize(h),style:V,alt:d,title:u,enableLazyLoadImage:s,fallbackImg:helpers.fallbackImg})}
  </div>
`};exports.default=HeroBannerItem;
