"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),s=require("next/head"),t=require("../ChildrenDroppable.js"),l=require("../../../video/components/HTML5Embed.js"),i=require("../../../video/common/helpers.js"),o=require("../../../video/components/LiteYouTubeEmbed.js"),a=require("@gem-sdk/system"),d=require("../../hooks/useRowSetting.js"),m=require("./common/attrs.js"),n=require("./common/classes.js"),u=require("./common/styles.js"),c=require("./common/helpers.js"),p=require("@gem-sdk/core");exports.default=y=>{let{styles:j,setting:g,children:h}=y,{isSection:v,as:x="div"}=g??{},{background:f}=j??{},{builderAttrs:k,bgVideo:q,isRowEmpty:b,rowClassEditorOnly:C,isRenderPlaceholderViewBox:E,isPostPurchase:w,ref:N,postPurchaseVerticalAlign:H}=d.useRowSettings(y),{rowStyle:R,backgroundBoxStyle:T,embedVideoStyle:V,sectionStyle:P}=u.getRowStyle({rowProps:y,isPostPurchase:w,type:"React"}),{rowAttr:M}=m.getAttr(y),{rowClass:S,backgroundBoxClass:A,backgroundBoxInnerClass:B,sectionClass:F,wrapperYoutubeClasses:I,iframeYoutubeClasses:L}=n.getClass(y),Y=a.createClass({[S]:!0,[C]:!0}),$=r.useMemo(()=>{if(!c.checkHasBackgroundVideo(f))return;if(q?.videoType==="html5"&&!q.videoHtml5||q?.videoType==="youtube"&&!q.video)return null;if(q?.videoType==="html5"&&q.videoHtml5)return e.jsx(l.default,{muted:!0,loop:q.loop,controls:!1,autoplay:!0,src:q.videoHtml5,title:"Video",className:"gp-relative",style:V});let r=q?.video??"",s=i.getYoutubeVideoId(r);if(!i.youtubeVideoRegex.test(r)||!s)return;let t=`&loop=${q?.loop?1:0}&playlist=${s}&showinfo=0&rel=0&fs=0&enablejsapi=1`;return e.jsx(o.default,{id:s,autoplay:!0,title:"",controls:!1,params:t,adNetwork:!1,noCookie:!0,muted:!0,lazy:!1,style:V,wrapperClass:I,iframeClass:L})},[f,q,V,L,I]),_=r.Children.map(h,e=>!!p.isEmptyChildren(e)),z=e.jsxs("div",{ref:N,...k,...M,style:R(w),className:Y,children:[!!$&&e.jsx("div",{className:A,style:T,children:e.jsx("div",{className:B,children:$})}),E?e.jsx(e.Fragment,{}):b?e.jsx(t.default,{}):r.Children.map(h,e=>r.isValidElement(e)?r.createElement(e.type,{hiddenEmptyCol:y.hiddenEmptyCol&&!p.isEmptyChildren(e)&&!_,...e.props,key:e.key,order:g?.order,layout:g?.layout,justifyContent:w?H():g?.verticalAlign}):null)]});return e.jsxs(e.Fragment,{children:[!!j?.preloadBgImage&&e.jsxs(s,{children:[!!f?.desktop?.image?.src&&e.jsx("link",{rel:"preload",href:f.desktop.image.src,as:"image"}),!!f?.tablet?.image?.src&&e.jsx("link",{rel:"preload",href:f.tablet.image.src,as:"image"}),!!f?.mobile?.image?.src&&e.jsx("link",{rel:"preload",href:f.mobile.image.src,as:"image"})]}),v?e.jsx(x,{className:F,style:P,children:z}):z]})};
