"use strict";var React=require("react"),core=require("@gem-sdk/core"),system=require("@gem-sdk/system"),useInView=require("../../common/hooks/useInView.js");const useRowSettings=e=>{let{setting:t,styles:r,children:i,maxWidthWithEmptyChildren:s,builderAttrs:n}=e,{isSection:o,lazy:u,layout:c,blockAlignment:l}=t??{},{background:a}=r??{},d=core.useCurrentDevice(),g=core.useEditorMode(),m=core.usePageType(),h=core.getBgVideoByDevice(a,d),R=React.useRef(null),y=React.useMemo(()=>core.isEmptyChildren(i),[i]),w=e=>{R.current&&(clearTimeout(R.current),R.current=null);let t=e?.getBoundingClientRect().height;e.style.height=`${t||500}px`,e.style.overflow="hidden"},p=e=>{R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{e.style.height="",e.style.overflow="",R.current=null},1500)},[f,v]=useInView.useInView({initialInView:!u,triggerOnce:!0,skip:!o,onChange:(e,t)=>{t&&t instanceof HTMLElement&&"edit"===g&&(e?p(t):w(t))}}),C=React.useMemo(()=>!v&&"edit"==g&&"POST_PURCHASE"!==m,[v,g,m]),P=React.useMemo(()=>"edit"!==g&&u&&!v,[v,u,g]),S=()=>{let e=s&&y&&"edit"===g;if(!e)return{};let t=core.getResponsiveValue(c,"display"),r=t[d];return{width:"fit"===r?"fit-content":"400px"}},T=system.createClass({...S,"gp-content-visibility-hidden":P}),V=()=>({desktop:l,tablet:l,mobile:l});return{ref:f,isRowEmpty:y,bgVideo:h,rowClassEditorOnly:T,isRenderPlaceholderViewBox:C,builderAttrs:n,children:i,isPostPurchase:"POST_PURCHASE"===m,postPurchaseVerticalAlign:V}};exports.useRowSettings=useRowSettings;
