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