"use strict";var core=require("@gem-sdk/core");require("react/jsx-runtime"),require("react");var _const=require("../../common/const.js"),helpers=require("../../helpers.js"),translate=require("../settings/configs/translate.js");const getCSSPosition=e=>"top"==e?"sticky":"fixed",getDisplayStyle=(e,t,l)=>{let i={[`--top${e}`]:"auto",[`--${l+e}`]:"0",[`--pos${e}`]:getCSSPosition(l)};switch(t){case"after-first-cart-button":i[`--d${e}`]="none";break;case"always":i[`--d${e}`]="block"}return i},displayConditionStyle=(e,t)=>({...getDisplayStyle("",e?.desktop,t?.desktop),...getDisplayStyle("-tablet",e?.tablet??e?.desktop,t?.tablet??t?.desktop),...getDisplayStyle("-mobile",e?.mobile??e?.tablet??e?.desktop,t?.mobile??t?.tablet??t?.desktop)}),getCSSAlignByDevice=(e,t)=>({[`--left${t}`]:"top"==e?"0":"50%",[`--t${t}`]:"top"==e?"unset":"translateX(-50%)"}),getCSSAlign=e=>({...getCSSAlignByDevice(e?.desktop,""),...getCSSAlignByDevice(e?.tablet??e?.desktop,"-tablet"),...getCSSAlignByDevice(e?.mobile??e?.tablet??e?.desktop,"-mobile")}),getContainerStyles=e=>{let{position:t,display:l}=e;return{margin:"0 auto",...getCSSAlign(t),...displayConditionStyle(l,t),"z-index":_const.ELEMENT_Z_INDEX.STICKY}},getContentStyles=({setting:e,style:t,uid:l,pageContext:i,type:o="React"})=>{let{background:r}=e||{},a="Liquid"===o?helpers.getBackgroundTranslated({background:r,uid:l,enableTranslate:!!translate.Sticky?.background?.id,pageContext:i,isTranslateVideo:!1}):r;return{...core.makeStyle({m:"0 auto"}),...getStylePadding(t),...filterStyles(t),...core.getStyleBackgroundByDevice(a||r),...core.getGradientImageBgrStyleByDevice(a||r)}},getStylePadding=e=>{let t=["--pt","--pb","--pr","--pl","--pt-mobile","--pb-mobile","--pr-mobile","--pl-mobile","--pt-tablet","--pb-tablet","--pr-tablet","--pl-tablet"],l={};return t.forEach(t=>{e?.[t]&&(l[t]=e[t])}),l},filterStyles=e=>{let t={...e},l=["--pt","--pb","--pr","--pl","--pt-mobile","--pb-mobile","--pr-mobile","--pl-mobile","--pt-tablet","--pb-tablet","--pr-tablet","--pl-tablet"];return l.forEach(e=>{delete t?.[e]}),t};exports.displayConditionStyle=displayConditionStyle,exports.filterStyles=filterStyles,exports.getContainerStyles=getContainerStyles,exports.getContentStyles=getContentStyles,exports.getDisplayStyle=getDisplayStyle,exports.getStylePadding=getStylePadding;
