"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers$1=require("../../../helpers.js"),system=require("@gem-sdk/system"),attrs=require("./common/attrs.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js"),helpers=require("./common/helpers.js");const ProductQuantity=({setting:e={},styles:t={},advanced:s,builderProps:a})=>{let{plusIcon:r,minusIcon:l,updatePrice:n}=e,i=e.defaultQtyValue??1,{inputHeight:c,buttonBackgroundColor:o,iconColor:u,inputBackgroundColor:y,textColor:d,align:p,borderBtn:g,buttonWidth:m,iconSizeCustom:$,corner:f,backgroundColor:b,dividerColor:v,dividerStroke:S}=t,C=e?.hasButton,h=system.createAttr({...attrs.getContainerAttrs({uid:a?.uid||"",isDisableByLiquid:!0})}),q=system.createClass({...classes.getContainerClasses(s?.cssClass)}),B=system.createStyle({...styles.getContainerStyles({align:p,inputHeight:c})}),A=system.createClass({...classes.getWrapperClasses()}),I=system.createStyle({...styles.getWrapperStyles({backgroundColor:b,styles:t})}),_=system.createAttr({...attrs.getInputAttr({isLiquid:!0,hasButton:C,defaultQty:i})}),j=system.createClass({...classes.getInputClasses({styles:t,borderBtn:g,inputBackgroundColor:y,textColor:d})}),P=system.createStyle({...styles.getInputStyle({setting:e,styles:{...t,borderBtn:g,inputBackgroundColor:y,textColor:d,dividerColor:v,dividerStroke:S}})}),E=system.createClass({...classes.getButtonClass({borderBtn:g,buttonBackgroundColor:o,iconColor:u,buttonSide:"left"})}),R=system.createStyle({...styles.getButtonStyle({borderBtn:g,buttonWidth:m,buttonBackgroundColor:o,iconColor:u,corner:f,enableHoverButton:e?.enableHoverButton})}),k=system.createAttr({...attrs.getButtonAttrs({buttonSide:"left"})}),H=system.createClass({...classes.getButtonClass({borderBtn:g,buttonBackgroundColor:o,iconColor:u,buttonSide:"right"})}),L=system.createStyle({...styles.getButtonStyle({borderBtn:g,buttonWidth:m,buttonBackgroundColor:o,iconColor:u,corner:f,flipStyle:!0,enableHoverButton:e?.enableHoverButton})}),M=system.createAttr({...attrs.getButtonAttrs({buttonSide:"right"})}),W=system.createClass({...classes.getIconWrapperClasses()}),D=helpers.getIconWidth($);return core.template`
    {%- liquid
      assign current_variant = product.selected_or_first_available_variant
      assign available = current_variant.available | default: false
    -%}
      <gp-product-quantity
        ${{...h}}
        data-price="${n}"
        class="${q}"
        style="${B}"
      >
        <div class="${A}" style="${I}">
          ${core.RenderIf(C,core.template`
              <button
              {% if available == false %} disabled {% endif %}
               ${{...k}}
                class="${E}"
                style="${R}"
              >
                <span class="${W}" style="${D}"
                >
                  ${helpers.getMinusIcon(l)}
                </span>
              </button>
            `)}
          <input
            {% if available == false %} disabled {% endif %}
            ${{..._}}
            class="${j}"
            style="${P}"
            inputMode="numeric"
          />

          ${core.RenderIf(C,core.template`
            <button
              {% if available == false %} disabled {% endif %}
              ${{...M}}
              class="${H}"
              style="${L}"
            >
              <span class="${W}" style="${D}">
                ${helpers.getPlusIcon(r)}
              </span>
            </button>
          `)}
          </div>
        </gp-product-quantity>
      ${core.RenderIf(core.isLocalEnv,`<script ${helpers$1.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-product-quantity-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${helpers$1.getSettingPreloadData('class="gps-link" delay',"src")}="${core.baseAssetURL}/assets-v2/gp-product-quantity-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}`};exports.default=ProductQuantity;
