import{getPaddingGlobalSize as t,getWidthHeightGlobalSize as o,composeShadowCss as n,composeCornerCss as e,composeTypographyV2Css as a,composeTextHoverColorCss as r,composeBorderCss as d,composeBackgroundImageCss as i,getSingleColorVariable as p}from"@gem-sdk/core";let b=(t,o,n=!0)=>`
    ${t?`width: ${t}${n?"!important;":""};`:""}
    ${o?`height: ${o}${n?"!important;":""};`:""}
  `,u=(t,o)=>{let n=t&&"desktop"!==t?`-${t}`:"",e={top:o[`--pt${n}`],bottom:o[`--pb${n}`],left:o[`--pl${n}`],right:o[`--pr${n}`]};return`
    padding-top: ${e.top?`${e.top} !important;`:""};
    padding-bottom: ${e.bottom?`${e.bottom} !important;`:""};
    padding-left: ${e.left?`${e.left} !important;`:""};
    padding-right: ${e.right?`${e.right} !important;`:""};
  `},h=t=>t?`font-size: ${t} !important;`:"",m=t=>t?`line-height: ${t} !important;`:"",_=t=>t?`letter-spacing: ${t} !important;`:"",s=t=>`${t?`text-align: ${t} !important;`:""}`,$=(t,o)=>!t||o?.forceIgnore?"":"string"==typeof t&&t.includes("linear-gradient")?`background-image: ${t};`:`background-color: ${p(t)};`,y=({uid:t,device:o,styles:p,composeGlobalSize:y})=>{let{backgroundColorV2:l,backgroundImage:g}=p||{},w={...g,hover:g?.hover?.image?g?.hover:g?.normal},f={hover:l?.hover||l?.normal};return`
    .wrap__button--unbranded__${t} {
      ${s(p?.align?.[o])}
    }

    .wrap__button--unbranded__${t} .shopify-payment-button {
      width: 100%;
    }

    .wrap__button--unbranded__${t} .shopify-payment-button .shopify-payment-button__button--unbranded {
      width: 100%;
      text-transform: unset;
      ${"desktop"!==o?`
        ${m(p?.typo?.custom?.lineHeight?.[o])}
        ${h(p?.typo?.custom?.fontSize?.[o])}
        ${_(p?.typo?.custom?.letterSpacing?.[o])}
      `:""}
      ${u(o,y.padding)}
      ${b(y.width[o]||"auto",y.height[o]||"auto",!1)}
      ${n({boxShadowValue:p?.boxShadowBtn?.normal,hasBoxShadow:p?.hasBoxShadowBtn?.normal})||""}
      ${e(p?.roundedBtnV2?.normal,!0)}
      ${"desktop"===o?a(p?.typo,!0):""}
    }

    .wrap__button--unbranded__${t} .shopify-payment-button .shopify-payment-button__button--unbranded:hover {
      ${n({boxShadowValue:p?.boxShadowBtn?.hover,hasBoxShadow:p?.boxShadowBtn?.hover?.type!=="none",important:!0})||""}
      ${r(p?.textColor,!0)};
      ${e(p?.roundedBtnV2?.hover,!0)}
    }

    .wrap__button--unbranded__${t} .shopify-payment-button .shopify-payment-button__button--unbranded::before {
      ${d(p?.borderBtnV2?.normal)}
      ${e(p?.roundedBtnV2?.normal)}
      ${$(p?.backgroundColorV2?.normal,{forceIgnore:!!p?.backgroundImage?.normal?.image})}
      ${i(p?.backgroundImage,{device:o,state:"normal"})}
      ${n({boxShadowValue:p?.boxShadowBtn?.normal,hasBoxShadow:p?.hasBoxShadowBtn?.normal})||""}


    }

    .wrap__button--unbranded__${t} .shopify-payment-button .shopify-payment-button__button--unbranded:hover::before {
      ${p?.backgroundImage?.hover||p?.backgroundColorV2?.hover?"background-image : unset;":""}
      ${p?.borderBtnV2?.hover?.borderType!=="none"?d(p?.borderBtnV2?.hover):""}
      ${p?.roundedBtnV2?.hover?.radiusType!=="none"?e(p?.roundedBtnV2?.hover):""}
      ${f?.hover?$(f?.hover,{forceIgnore:!!w?.hover?.image?.src}):""}
      ${w?.hover?.image?.src?i(w,{device:o,state:"hover"}):""}
      ${n({boxShadowValue:p?.boxShadowBtn?.hover,hasBoxShadow:p?.boxShadowBtn?.hover?.type!=="none",important:!0})||""}
    }
  `},l=({styles:n,uid:e})=>{let a={width:o("width",n?.globalSize),height:o("height",n?.globalSize),padding:t(n?.globalSize)},r=`
    .wrap__button--unbranded__${e} .shopify-payment-button {
      display: inline-block;
      min-height: unset !important;
    }

    .wrap__button--unbranded__${e} .shopify-payment-button div {
      width: 100%;
      margin-top: 0px !important;
    }

    .wrap__button--unbranded__${e} .shopify-payment-button .shopify-payment-button__more-options {
      display: none;
    }

    .wrap__button--unbranded__${e} .shopify-payment-button .shopify-payment-button__button--unbranded {
      max-width: 100%;
      min-width: unset;
      min-height: unset !important;
      background-color: unset !important;
      position: relative;
      border: none !important;
      margin: 0;
      z-index: 0;
      border-radius: unset;
      width: 100%;
      display: inline-flex;
      justify-content: center;
      align-items: center;
    }

    .wrap__button--unbranded__${e} .shopify-payment-button .shopify-payment-button__button--unbranded::before {
      content: "";
      height: 100%;
      width: 100%;
      position: absolute;
      top: 0;
      left: 0;
      pointer-events: none;
      z-index: -1;
      transition-duration: 0.2s;
    }

    .wrap__button--unbranded__${e} .shopify-payment-button .shopify-payment-button__button--unbranded::after {
      border-radius: 0;
      box-shadow: none;
    }

    .wrap__button--unbranded__${e} .shopify-payment-button .shopify-payment-button__button--unbranded::after:hover {
      border-radius: 0;
      box-shadow: none;
    }

    .wrap__button--unbranded__${e} .shopify-payment-button > div {
      max-width: 100%;
    }

    .wrap__button--unbranded__${e} .shopify-payment-button > div > div {
      max-width: 100%;
    }

    ${y({device:"desktop",uid:e,styles:n,composeGlobalSize:a})}

    @media only screen and (max-width: 1024px) and (min-width: 768px) {
      ${y({device:"tablet",uid:e,styles:n,composeGlobalSize:a})}
    }

    @media only screen and (max-width: 767px) {
      ${y({device:"mobile",uid:e,styles:n,composeGlobalSize:a})}
    }
  `;return r};export{l as getButtonStyles};
