'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),Head=require("next/head"),ChildrenDroppable=require("../../grid/components/ChildrenDroppable.js");require("react");var _const=require("../../common/const.js"),useSticky=require("../hooks/useSticky.js"),system=require("@gem-sdk/system"),styles=require("../common/styles.js"),classes=require("../common/classes.js");const Sticky=({children:e,builderAttrs:s,setting:r,style:t,builderProps:i,advanced:a,pageContext:l})=>{let n=core.useEditorMode(),{background:c,preloadBgImage:d,isScrollToTop:m}=r??{},{positionStyle:u,displayStyle:o,makeDisplaySettingStyles:j,getCSSAlign:x,w:y}=useSticky.default(r),g=system.createStyle({margin:"0 auto",...o,...x,...u,zIndex:_const.ELEMENT_Z_INDEX.STICKY,..."edit"!==n&&j}),p=system.createStyle(styles.getContentStyles({setting:r,style:t,uid:i?.uid,pageContext:l??{}})),h=system.createClass(classes.getContainerClasses({uid:i?.uid,isScrollToTop:m,cssClass:a?.cssClass,isLiquid:!1}));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!!d&&jsxRuntime.jsxs(Head,{children:[!!c?.desktop?.image?.src&&jsxRuntime.jsx("link",{rel:"preload",href:c.desktop.image.src,as:"image"}),!!c?.tablet?.image?.src&&jsxRuntime.jsx("link",{rel:"preload",href:c.tablet.image.src,as:"image"}),!!c?.mobile?.image?.src&&jsxRuntime.jsx("link",{rel:"preload",href:c.mobile.image.src,as:"image"})]}),jsxRuntime.jsx("div",{className:h,id:i?.uid,style:{...y,...g},children:jsxRuntime.jsx("div",{...s,"data-id":i?.uid,style:p,children:core.isEmptyChildren(e)?jsxRuntime.jsx(ChildrenDroppable.default,{}):e})})]})};exports.default=Sticky;
