"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers=require("../../../helpers.js"),HTML5Embed_liquid=require("../../../video/components/HTML5Embed.liquid.js"),system=require("@gem-sdk/system"),helpers$2=require("../../../video/common/helpers.js"),LiteYouTubeEmbed_liquid=require("../../../video/components/LiteYouTubeEmbed.liquid.js"),attrs=require("./common/attrs.js"),translate=require("../../settings/configs/row/translate.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js"),helpers$1=require("./common/helpers.js"),helpers$3=require("../../../hero-banner/common/helpers.js");const Row=e=>{let{styles:r,setting:s,rawChildren:t,builderProps:o}=e,{isSection:l}=s??{},{background:a}=r??{},i=l?"section":"div",d=helpers.getBackgroundTranslated({background:a,uid:o?.uid,enableTranslate:!!translate.Row?.background?.id,pageContext:e.pageContext??{}}),{stateData:p}=helpers$1.getData(e,d),{rowStyle:n,backgroundBoxStyle:c,embedVideoStyle:u,sectionStyle:m}=styles.getRowStyle({rowProps:e,type:"Liquid",translatedBackground:d}),{rowAttr:g}=attrs.getAttr(e),{rowClass:$,backgroundBoxClass:f,backgroundBoxInnerClass:h,sectionClass:y,wrapperYoutubeClasses:b,iframeYoutubeClasses:k}=classes.getClass(e),q=system.createClass({[$]:!0}),v=()=>{if(!helpers$1.checkHasBackgroundVideo(a))return;let e=helpers$3.getResponsiveSetting(a||{});if(helpers$1.isRenderHtmlVideo(a))return HTML5Embed_liquid.default({uid:o?.uid,muted:!0,loop:e.desktop?.loop,controls:!1,autoplay:!0,src:"",title:"Video",className:"gp-relative",style:u});if(helpers$1.isRenderYoutubeVideo(a)){let r=e?.desktop?.video??"",s=helpers$2.getYoutubeVideoId(r)||"",t=core.hasTranslatedLiquid(r),l=`&loop=false&playlist=${s}&showinfo=0&rel=0&fs=0&enablejsapi=1`;return LiteYouTubeEmbed_liquid.default({uid:o?.uid,id:s,autoplay:!0,title:"Video",translatedVideoUrl:t?r:"",controls:!1,params:l,adNetwork:!1,noCookie:!0,muted:!0,lazy:e?.desktop?.lazyLoad??!0,preload:!0,style:u,wrapperClass:b,iframeClass:k})}},R=()=>{if(helpers$1.checkHasBackgroundVideo(a))return core.template`
      ${core.RenderIf(core.isLocalEnv,`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-row-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="${core.baseAssetURL}/assets-v2/gp-row-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
    `},j=core.template`
    <gp-row gp-data='${p}' ${{...g}} class="${q}" style="${n()}">
      ${system.If(!!v(),core.template`
          <div class="${f}" style="${c}">
            <div class="${h}">${v()}</div>
          </div>
        `)}

      ${core.WrapRenderChildren({uid:o?.uid||"",customProps:t?.[0].customProps},t?.map(e=>{if(e)return core.RenderChildren({...e,order:s?.order,layout:s?.layout,justifyContent:s?.verticalAlign})}))}

      ${R()}
    </gp-row>
  `;return core.template`
    ${core.RenderIf(!!r?.preloadBgImage,`${core.RenderIf(!!a?.desktop?.image?.src,`<link rel="preload" href="${a?.desktop?.image?.src}" as="image" />`)}${core.RenderIf(!!a?.tablet?.image?.src,`<link rel="preload" href="${a?.tablet?.image?.src}" as="image" />`)}${core.RenderIf(!!a?.mobile?.image?.src,`<link rel="preload" href="${a?.mobile?.image?.src}" as="image" />`)}`)}

    ${core.RenderIf(!!l,"{% assign locationOrigin = request.origin | append: routes.root_url | split: '/' | join: '/' %}")}

    ${system.If(l,core.template`
        <${i}
          class="${y} ${l?helpers.getSettingPreloadData("gps-lazy"):""}"
          style="${m}"
        >
          ${j}
        </${i}>
      `,core.template`${j}`)}
  `};exports.default=Row;
