"use strict";var core=require("@gem-sdk/core");const composeSize=(o,t,e=!0)=>`
    ${o?`width: ${o}${e?"!important;":""};`:""}
    ${t?`height: ${t}${e?"!important;":""};`:""}
  `,composeSpacing=(o,t)=>{let e=o&&"desktop"!==o?`-${o}`:"",n={top:t[`--pt${e}`],bottom:t[`--pb${e}`],left:t[`--pl${e}`],right:t[`--pr${e}`]};return`
    padding-top: ${n.top?`${n.top} !important;`:""};
    padding-bottom: ${n.bottom?`${n.bottom} !important;`:""};
    padding-left: ${n.left?`${n.left} !important;`:""};
    padding-right: ${n.right?`${n.right} !important;`:""};
  `},composeFontSize=o=>o?`font-size: ${o} !important;`:"",composeLineHeight=o=>o?`line-height: ${o} !important;`:"",composeLetterSpacing=o=>o?`letter-spacing: ${o} !important;`:"",composeTextAlign=o=>`${o?`text-align: ${o} !important;`:""}`,composeBackgroundStyle=(o,t)=>!o||t?.forceIgnore?"":"string"==typeof o&&o.includes("linear-gradient")?`background-image: ${o};`:`background-color: ${core.getSingleColorVariable(o)};`,getDeviceStyles=({uid:o,device:t,styles:e,composeGlobalSize:n})=>{let{backgroundColorV2:r,backgroundImage:a}=e||{},i={...a,hover:a?.hover?.image?a?.hover:a?.normal},d={...r,hover:r?.hover||r?.normal};return`
    .wrap__button--unbranded__${o} {
      ${composeTextAlign(e?.align?.[t])}
    }

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

    .wrap__button--unbranded__${o} .shopify-payment-button .shopify-payment-button__button--unbranded {
      width: 100%;
      text-transform: unset;
      ${"desktop"!==t?`
        ${composeLineHeight(e?.typo?.custom?.lineHeight?.[t])}
        ${composeFontSize(e?.typo?.custom?.fontSize?.[t])}
        ${composeLetterSpacing(e?.typo?.custom?.letterSpacing?.[t])}
      `:""}
      ${composeSpacing(t,n.padding)}
      ${composeSize(n.width[t]||"auto",n.height[t]||"auto",!1)}
      ${core.composeShadowCss({boxShadowValue:e?.boxShadowBtn?.normal,hasBoxShadow:e?.hasBoxShadowBtn?.normal})||""}
      ${core.composeCornerCss(e?.roundedBtnV2?.normal,!0)}
      ${"desktop"===t?core.composeTypographyV2Css(e?.typo,!0):""}
    }

    .wrap__button--unbranded__${o} .shopify-payment-button .shopify-payment-button__button--unbranded:hover {
      ${core.composeShadowCss({boxShadowValue:e?.boxShadowBtn?.hover,hasBoxShadow:e?.boxShadowBtn?.hover?.type!=="none",important:!0})||""}
      ${core.composeTextHoverColorCss(e?.textColor,!0)};
      ${core.composeCornerCss(e?.roundedBtnV2?.hover,!0)}
    }

    .wrap__button--unbranded__${o} .shopify-payment-button .shopify-payment-button__button--unbranded::before {
      ${core.composeBorderCss(e?.borderBtnV2?.normal)}
      ${core.composeCornerCss(e?.roundedBtnV2?.normal)}
      ${composeBackgroundStyle(e?.backgroundColorV2?.normal,{forceIgnore:!!e?.backgroundImage?.normal?.image})}
      ${core.composeBackgroundImageCss(e?.backgroundImage,{device:t,state:"normal"})}
      ${core.composeShadowCss({boxShadowValue:e?.boxShadowBtn?.normal,hasBoxShadow:e?.hasBoxShadowBtn?.normal})||""}


    }

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

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

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

    .wrap__button--unbranded__${t} .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__${t} .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__${t} .shopify-payment-button .shopify-payment-button__button--unbranded::after {
      border-radius: 0;
      box-shadow: none;
    }

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

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

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

    ${getDeviceStyles({device:"desktop",uid:t,styles:o,composeGlobalSize:e})}

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

    @media only screen and (max-width: 767px) {
      ${getDeviceStyles({device:"mobile",uid:t,styles:o,composeGlobalSize:e})}
    }
  `;return n};exports.getButtonStyles=getButtonStyles;
