"use strict";var core=require("@gem-sdk/core");const addPxToValues=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,`${t}px`])),flipBorderWidth=e=>{if(!e)return e;let t=e.split(" ").map(e=>e.trim());return 4===t.length?`${t[0]} ${t[3]} ${t[2]} ${t[1]}`:e},flipCornerRadius=e=>{if(!e)return e;let t={...e},r=t.btlr,o=t.bblr,l=t.btrr,a=t.bbrr;return t.btrr=o,t.bbrr=r,t.btlr=a,t.bblr=l,t},flipBorderObject=e=>{if(!e)return e;let t={...e};return t.width&&(t.width=flipBorderWidth(t.width)),t},getDividerWidth=(e,t)=>{if(!e||!t)return{};let r=addPxToValues(e),o={...core.makeStyleState("brw",r),...core.makeStyleState("blw",r)};return o},getDividerColorStyle=e=>{if(!e)return{};let t={...e,normal:e?.normal??"transparent"},r={...core.getGlobalColorStateStyle("brc",t),...core.getGlobalColorStateStyle("blc",t)},o=Object.fromEntries(Object.entries(r).filter(([e,t])=>void 0!==t));return o},getInputStyle=e=>{let{styles:t,setting:r}=e,{inputBackgroundColor:o,textColor:l,dividerColor:a,dividerStroke:n}=t??{},{enableHoverInput:s,hasButton:i}=r??{},d=core.composeTypographyStyle(t?.typo,t?.typography),p={...getDividerWidth(n,a),...getDividerColorStyle(a)},c={...core.getGlobalColorStateStyle("bg",{...o,normal:o?.normal??"transparent"}),...core.getGlobalColorStateStyle("c",{...l,hover:l?.hover??l?.normal}),...i?p:{}},S=t?.inputBorder,b={...core.handleConvertBorderStyle(S),...core.handleConvertBorderWidth(S),...core.handleConvertBorderColor(S)},y={...i?{}:b,...i?{}:core.composeRadiusResponsive(t?.shapeRounded),...core.makeStyle({}),...d,...c,...core.getStyleShadow({value:t?.typo?.custom?.textShadow,styleAppliedFor:"text-shadow",isEnableShadow:t?.typo?.custom?.hasShadowText})};return s?y:core.filterHoverVariables(y)},getButtonStyle=({borderBtn:e,buttonWidth:t,buttonBackgroundColor:r,iconColor:o,corner:l,flipStyle:a,enableHoverButton:n})=>{let s=a?Object.fromEntries(Object.entries(e||{}).map(([e,t])=>[e,flipBorderObject(t)])):e,i=a?Object.fromEntries(Object.entries(l||{}).map(([e,t])=>[e,flipCornerRadius(t)])):l,d={...core.makeStyleResponsive("w",t),...core.handleConvertBorderStyle(s),...core.handleConvertBorderWidth(s),...core.handleConvertBorderColor(s),...core.getGlobalColorStateStyle("bg",r),...core.getGlobalColorStateStyle("c",o),...core.composeRadius(i)};return n?d:core.filterHoverVariables(d)},getContainerStyles=({inputHeight:e,align:t})=>({...core.makeStyleResponsive("h",e),...core.makeStyleResponsive("jc",t)}),getWrapperStyles=({backgroundColor:e,styles:t})=>{let r=t?.shapeShadow,o=core.getResponsiveStyleShadowWithoutState(r,"box-shadow",{desktop:r?.desktop??{},tablet:r?.tablet??r?.desktop??{},mobile:r?.mobile??r?.tablet??r?.desktop??{}});return{...core.getGlobalColorResponsiveStyle("bg",e),...core.makeStyleResponsive("maxw",t?.quantityWidth),...core.composeBorderResponsive(t?.shapeBorder),...core.composeRadiusResponsive(t?.shapeRounded),...o}};exports.getButtonStyle=getButtonStyle,exports.getContainerStyles=getContainerStyles,exports.getInputStyle=getInputStyle,exports.getWrapperStyles=getWrapperStyles;
