import{getRadiusStyleActiveState as e,composeRadius as t,handleConvertBorderColor as o,handleConvertBorderWidth as r,handleConvertBorderStyle as i,composeTypographyStyle as l,makeStyle as p,getSingleColorVariable as a,getStyleShadow as n,getGlobalColorStateStyle as d,makeStyleResponsive as h}from"@gem-sdk/core";import{filterTruthyObject as c}from"../../../../../helpers.js";let s=e=>{let t=e?.height||"32px",o=e?.width||{desktop:t},r=Object.fromEntries(Object.entries(o).map(([e,o])=>{let r=o&&"undefined"!==o&&"auto"!==o&&"Auto"!==o?o:t;return[e,r]}));return h("minw",r)},b=t=>{let{preset:o,optionTypography:r,optionTypo:i,typeOfOption:d}=t,h=o?.optionBgColor,b=o?.optionTextColor,u=o?.optionBorder,m=o?.optionHasShadow,g=o?.optionShadow,w=o?.optionRounded,x="color"===d,v=l(i,r),f=g?.active??g?.normal,S=m?.active??m?.normal,y=b?.active??b?.normal;return c({...(e=>{let t=h?.active??h?.normal,o=u?.active??u?.normal;return p({bg:e&&a(t),bs:o?.border,bw:o?.width,bc:a(o?.color)})})(!x),...e(w),...n({value:f,state:"active",styleAppliedFor:"box-shadow",isEnableShadow:S},!0),...v,...!x&&!("image"===d||"image_shopify"===d)&&p({c:a(y)}),...x&&s(o),...p({h:o?.height})})},u=e=>{let{preset:a,optionTransform:h,optionTypography:b,optionTypo:u,typeOfOption:m}=e,g=a?.optionBgColor,w=a?.optionTextColor,x=a?.optionBorder,v=a?.optionHasShadow,f=a?.optionShadow,S=a?.optionRounded,y="color"===m,C="image"===m||"image_shopify"===m,k=["normal","hover"].reduce((e,t)=>({...e,...n({value:f?.[t],state:t,styleAppliedFor:"box-shadow",isEnableShadow:v?.[t]})}),{});return c({...t(S),...k,...!y&&d("bg",g),...!y&&i(x),...!y&&r(x),...!y&&o(x),...!y&&!C&&p({c:h}),...!y&&!C&&d("c",w),...function(e,t,o){let r=l(e,t);return o&&0!==o.length?Object.fromEntries(Object.entries(r).filter(([e])=>!o.includes(e))):r}(u,b,["--c"]),...y&&s(a),...p({h:a?.height})})},m=l=>{let{preset:p,typeOfOption:a,checked:n}=l,d=p?.optionBorder,h=p?.optionRounded,s="color"===a,b={...h,active:{...h?.active||{},radiusType:"custom"}},u=n?e(b):t(h),m=!n&&s?{...i(d),...r(d),...o(d)}:{};return c({...!s&&(()=>{let e="16px",t={"--pl":"0px","--pr":"0px","--pl-tablet":"0px","--pr-tablet":"0px","--pl-mobile":"0px","--pr-mobile":"0px","--pt":"0px","--pb":"0px"};return p?.width?.desktop?.toLowerCase()!=="auto"&&p?.width?.desktop||(t["--pl"]=e,t["--pr"]=e),p?.width?.tablet?.toLowerCase()!=="auto"&&p?.width?.tablet||(t["--pl-tablet"]=e,t["--pr-tablet"]=e),p?.width?.mobile?.toLowerCase()!=="auto"&&p?.width?.mobile||(t["--pl-mobile"]=e,t["--pr-mobile"]=e),(p?.height?.toLowerCase()==="auto"||p?.height)&&(t["--pt"]="8px",t["--pb"]="8px"),t})(),...s&&u,...m})},g=({optionBorder:e,optionRounded:l,isActive:p,color:a})=>({"--d":"flex","--jc":"center","	--ai":"center","--w":"100%","--h":"100%","--of":"hidden","--hvr-c":"unset",...p?{"--bs":"none"}:i(e),...r(e),...o(e),...t(l),...a?a?.startsWith("linear-gradient")?{backgroundImage:a}:{backgroundColor:a}:{}}),w=({optionTypo:e,optionTypography:t})=>{let o=l(e,t);return delete o["--c"],c({...o})};export{g as getColorStyle,w as getTextStyle,b as getWrapperStyleActive,u as getWrapperStyleNormalAndHover,m as getWrapperTextStyle};
