'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})=>{let l=core.useEditorMode(),{background:n,preloadBgImage:c,width:m,isScrollToTop:d}=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"!==l&&j}),p=system.createStyle(styles.getContentStyles({width:m,style:t,background:n})),h=system.createClass(classes.getContainerClasses({uid:i?.uid,isScrollToTop:d,cssClass:a?.cssClass,isLiquid:!1}));return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!!c&&jsxRuntime.jsxs(Head,{children:[!!n?.desktop?.image?.src&&jsxRuntime.jsx("link",{rel:"preload",href:n.desktop.image.src,as:"image"}),!!n?.tablet?.image?.src&&jsxRuntime.jsx("link",{rel:"preload",href:n.tablet.image.src,as:"image"}),!!n?.mobile?.image?.src&&jsxRuntime.jsx("link",{rel:"preload",href:n.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;
