"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),system=require("@gem-sdk/system"),helpers=require("../../../helpers.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js");const Button=({setting:s,advanced:e,styles:t,builderProps:a,className:i=""})=>{let l=system.createClass({...!!i&&{[i]:!0},...classes.getButtonClasses({styles:t,uid:a?.uid})}),r=styles.getButtonStyles({styles:t,uid:a?.uid}),o=system.createStateOrContext({setting:{label:s?.label},totalVariant:"{{total_combinations}}"});return core.template`
    ${system.Liquid("{%- assign total_combinations = 1 -%}")}
    ${system.LiquidFor("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
    ${system.Liquid(`
      {%- liquid
        assign inventory_quantity = variant.inventory_quantity | default: 0
        assign supported_payment_methods = shop.enabled_payment_types
      -%}
    `)}
    <gp-product-dynamic data-id="${a?.uid}" data-translate-label='${s?.label}' class="${e?.cssClass}" gp-data='${JSON.stringify(o).replaceAll("'","&#039;")}
    '>
    <div class="${l}">
        {{ form | payment_button }}
    </div>
    {% style %}
      ${r}
    {% endstyle %}
    </gp-product-dynamic>
    ${system.If(core.isLocalEnv,`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-product-dynamic-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="${core.baseAssetURL}/assets-v2/gp-product-dynamic-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
  `};exports.default=Button;
