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