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