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