import{RenderIf as t,template as s,isLocalEnv as e,baseAssetURL as a}from"@gem-sdk/core";import{getSettingPreloadData as i}from"../../../helpers.js";import{createAttr as l,createClass as r,createStyle as o}from"@gem-sdk/system";import{getContainerAttrs as n,getInputAttr as d,getButtonAttrs as u}from"./common/attrs.js";import{getContainerClasses as p,getWrapperClasses as c,getInputClasses as f,getButtonClass as m,getIconWrapperClasses as $}from"./common/classes.js";import{getContainerStyles as b,getWrapperStyles as y,getInputStyle as v,getButtonStyle as g}from"./common/styles.js";import{getIconWidth as S,getMinusIcon as _,getPlusIcon as h}from"./common/helpers.js";let j=({setting:j={},styles:q={},advanced:B,builderProps:k})=>{let{plusIcon:E,minusIcon:H,updatePrice:A}=j,G=j.defaultQtyValue??1,{inputHeight:L,buttonBackgroundColor:M,iconColor:P,inputBackgroundColor:Q,textColor:V,align:x,borderBtn:C,buttonWidth:D,iconSizeCustom:I,corner:N,backgroundColor:O,dividerColor:R,dividerStroke:T}=q,w=j?.hasButton,z=l({...n({uid:k?.uid||"",isDisableByLiquid:!0})}),F=r({...p(B?.cssClass)}),J=o({...b({align:x,inputHeight:L})}),K=r({...c()}),U=o({...y({backgroundColor:O,styles:q})}),W=l({...d({isLiquid:!0,hasButton:w,defaultQty:G})}),X=r({...f({styles:q,borderBtn:C,inputBackgroundColor:Q,textColor:V})}),Y=o({...v({setting:j,styles:{...q,borderBtn:C,inputBackgroundColor:Q,textColor:V,dividerColor:R,dividerStroke:T}})}),Z=r({...m({borderBtn:C,buttonBackgroundColor:M,iconColor:P,buttonSide:"left"})}),tt=o({...g({borderBtn:C,buttonWidth:D,buttonBackgroundColor:M,iconColor:P,corner:N,enableHoverButton:j?.enableHoverButton})}),ts=l({...u({buttonSide:"left"})}),te=r({...m({borderBtn:C,buttonBackgroundColor:M,iconColor:P,buttonSide:"right"})}),ta=o({...g({borderBtn:C,buttonWidth:D,buttonBackgroundColor:M,iconColor:P,corner:N,flipStyle:!0,enableHoverButton:j?.enableHoverButton})}),ti=l({...u({buttonSide:"right"})}),tl=r({...$()}),tr=S(I);return s`
    {%- liquid
      assign current_variant = product.selected_or_first_available_variant
      assign available = current_variant.available | default: false
    -%}
      <gp-product-quantity
        ${{...z}}
        data-price="${A}"
        class="${F}"
        style="${J}"
      >
        <div class="${K}" style="${U}">
          ${t(w,s`
              <button
              {% if available == false %} disabled {% endif %}
               ${{...ts}}
                class="${Z}"
                style="${tt}"
              >
                <span class="${tl}" style="${tr}"
                >
                  ${_(H)}
                </span>
              </button>
            `)}
          <input
            {% if available == false %} disabled {% endif %}
            ${{...W}}
            class="${X}"
            style="${Y}"
            inputMode="numeric"
          />

          ${t(w,s`
            <button
              {% if available == false %} disabled {% endif %}
              ${{...ti}}
              class="${te}"
              style="${ta}"
            >
              <span class="${tl}" style="${tr}">
                ${h(E)}
              </span>
            </button>
          `)}
          </div>
        </gp-product-quantity>
      ${t(e,`<script ${i('class="gps-link" delay',"src")}="{{ 'gp-product-quantity-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${i('class="gps-link" delay',"src")}="${a}/assets-v2/gp-product-quantity-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}`};export{j as default};
