"use strict";var core=require("@gem-sdk/core");const getStyleBackground=(e,r)=>{if(!e)return{};let t=createResponsiveStateMap(e=>getBackgroundByDevice(r,e));return{...core.makeStyleResponsive("bg",t)}},getBackgroundByDevice=(e,r)=>{let t=e?.[r];return core.getSingleColorVariable(t??e?.desktop)},getStyleBorder=e=>{if(!e)return{};let r=createResponsiveMap(r=>getBorderColorByDevice(e,r)),t=createResponsiveMap(r=>getBorderWidthByDevice(e,r)),o=createResponsiveMap(r=>getBorderStyleByDevice(e,r)),a=core.removeNullUndefined({...core.makeStyleResponsive("bc",r),...core.makeStyleResponsive("bw",t),...core.makeStyleResponsive("bs",o)});return a},getBorderColorByDevice=(e,r)=>e?.[r]?.color,getBorderWidthByDevice=(e,r)=>e?.[r]?.width,getBorderStyleByDevice=(e,r)=>e?.[r]?.border,getStyleCornerRadius=(e,r)=>{if(!e)return{};let t=["btlr","btrr","bblr","bbrr"],o=t.reduce((t,o)=>({...t,...core.removeNullUndefined(core.makeStyleResponsive(o,getCornerValueStyles(o,e,r)))}),{});return o},getCornerValueStyles=(e,r,t)=>createResponsiveMap(o=>getCornerByDevice({corner:e,cornerProps:r,device:o,shapeRadius:t})),getCornerByDevice=e=>{let{cornerProps:r,device:t,corner:o,shapeRadius:a}=e,l=r?.[t]?.[o],n=r?.desktop?.[o],i=a?.[o];return l??n??i},calculateShadow=e=>{let r={};for(let t of core.DEVICES){let o=e[t]||e.desktop;if(!o)continue;let{angle:a,distance:l,blur:n,color:i,enable:s}=o;if(!a||!l||!n||!i||!1===s)continue;let{unit:c}=core.parseValueWithUnit(`${l}`),d=`${Math.cos(parseFloat(`${a}`)*Math.PI/180)*parseFloat(`${l}`)}${c}`,p=`${Math.sin(parseFloat(`${a}`)*Math.PI/180)*parseFloat(`${l}`)}${c}`;r[t]=`drop-shadow(${d} ${p} ${n} ${core.getSingleColorVariable(i)})`}return r},createResponsiveMap=e=>core.DEVICES.reduce((r,t)=>({...r,[t]:e(t)}),{}),createResponsiveStateMap=e=>core.DEVICES.reduce((r,t)=>({...r,[t]:e(t)}),{}),generateShadowCSS=(e,r)=>{if(!r)return"";let t=calculateShadow(r);return`
     ${e} {
      filter: ${t.desktop};
      transition: filter 0.3s ease;
    }

    @media only screen and (max-width: 1024px) and (min-width: 768px) {
      ${e} {
        filter: ${t.tablet||t.desktop};
      }
    }

    @media only screen and (max-width: 767px) {
      ${e} {
        filter: ${t.mobile||t.tablet||t.desktop};
      }
    }
  `};exports.generateShadowCSS=generateShadowCSS,exports.getStyleBackground=getStyleBackground,exports.getStyleBorder=getStyleBorder,exports.getStyleCornerRadius=getStyleCornerRadius;
