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