import{makeStyleResponsive as e,template as s,RenderIf as t,isLocalEnv as i,baseAssetURL as a}from"@gem-sdk/core";import{getSettingPreloadData as r}from"../../helpers.js";import{createStyle as d,createClass as l,createStateOrContext as o}from"@gem-sdk/system";import{getContainerStyles as m,getContentStyles as p}from"../common/styles.js";import{getContainerClasses as c}from"../common/classes.js";let Sticky=({children:g,builderAttrs:n,setting:$,style:k,builderProps:y,advanced:f,pageContext:u})=>{let{width:b,position:S,display:v,preloadBgImage:h,background:j,isScrollToTop:E}=$??{},w=f?.d,C=d({...e("w",b),...m({position:S,style:k,display:v})}),q=d(p({setting:$,style:k,uid:y?.uid,pageContext:u??{},type:"Liquid"})),x=l(c({uid:y?.uid,isScrollToTop:E,cssClass:f?.cssClass,isLiquid:!0})),A=o({uid:y?.uid,setting:{display:{desktop:v?.desktop,tablet:v?.tablet??v?.desktop,mobile:v?.mobile??v?.tablet??v?.desktop}},advanced:{d:w}}),G=`.drawer-page-content {
       transform: none !important;
      -webkit-transform: none !important;
  }`;return s`
    ${t(!!h,`${t(!!j?.desktop?.image?.src,`<link rel="preload" href="${j?.desktop?.image?.src}" as="image" />`)}${t(!!j?.tablet?.image?.src,`<link rel="preload" href="${j?.tablet?.image?.src}" as="image" />`)}${t(!!j?.mobile?.image?.src,`<link rel="preload" href="${j?.mobile?.image?.src}" as="image" />`)}`)}
    <gp-sticky
    data-id="${y?.uid}"
      gp-data='${JSON.stringify(A)}'
      id="${y?.uid}"
      data-id="${y?.uid}"
      class="${x} ${r("gps-lazy")}"
      style="${C}"
    >
      <style>${G}</style>
      <div ${{...n}} style="${{...q}}">
        ${g}
      </div>
    </gp-sticky>
    ${t(i,`<script ${r('class="gps-link" delay',"src")}="{{ 'gp-sticky-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${r('class="gps-link" delay',"src")}="${a}/assets-v2/gp-sticky-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
  `};export{Sticky as default};
