"use strict";const QUANTITY_SOURCE={AUTO:"auto",MANUAL:"manual"},OUT_OF_STOCK={SHOW:"show",HIDE:"hide"},DEFAULT_QUANTITY_TEMPLATE="%number%",DEFAULT_HIGHLIGHT_TAG="mark",NO_PRODUCT_LEFT=0,DEFAULT_SCARCITY_THRESHOLD=12,DEFAULT_REMAINING_QUANTITY=12,DEFAULT_REMAINING_PERCENT=20,MIN_REMAINING_QUANTITY=0,MIN_REMAINING_PERCENT=10,MAX_REMAINING_PERCENT=100,DEFAULT_RANGE_STEP=10,DEFAULT_FONT_SIZE=20,DEFAULT_PROGRESS_BAR_HEIGHT=10,MIN_PROGRESS_BAR_HEIGHT=5,MAX_PROGRESS_BAR_HEIGHT=20,CONTINUE_SELLING_WHEN_OUT_OF_STOCK="CONTINUE",getLiquidTextContent=e=>{let{templateStringDisplay:t,outOfStockMessageDisplay:i,continueSellingDisplay:a,unlimitedQuantityMessageDisplay:n}=e??{};return`{% if inventory_management == null and inventory_quantity <= 0 %}
                    ${n}
                  {% elsif available == false %}
                    ${i}
                  {% elsif available and inventory_policy == '${CONTINUE_SELLING_WHEN_OUT_OF_STOCK.toLowerCase()}' and inventory_quantity <= 0 %}
                    ${a}
                  {% else %}
                    ${t}
                  {% endif %}`},getLiquidInitData=(e,t)=>{let{scarcityThreshold:i=0,hiddenCounterWhenOutOfStock:a,displayByDefault:n}=e??{},{displayProgressBar:r}=t??{},s=!!i&&i>0;return`{%- liquid
      assign current_variant = variant
      assign available = current_variant.available | default: false
      assign inventory_management = current_variant.inventory_management | default: null
      assign inventory_policy = current_variant.inventory_policy | default: 'deny'
      assign inventory_quantity = current_variant.inventory_quantity | default: 0
      assign scarcityThreshold = ${s}
      assign check_display = ${!!n}

      if inventory_management != null and available == false and inventory_quantity <= 0 and inventory_policy != '${CONTINUE_SELLING_WHEN_OUT_OF_STOCK.toLowerCase()}'
        assign is_out_of_stock = true
        else
        assign is_out_of_stock = false
      endif

      if check_display == true
        assign should_display = true
      elsif ${s} and inventory_quantity >= 0 and inventory_quantity < ${i}
        assign should_display = true
      else
        assign should_display = false
      endif

      if ${!0===a} and available == false
        assign should_display = false
      endif

      if ${!0===r} and available
        assign show_progress_bar = true
      else
        assign show_progress_bar = false
      endif
    -%}
    {% capture variant_policy_list %}
      {
        {% for variant in product.variants %}
        "{{ variant.id }}":"{{ variant.inventory_policy }}",
        "{{ variant.id }}_management":"{{ variant.inventory_management }}"{% if forloop.last == false %},{% endif %}
        {% endfor %}
      }
    {% endcapture %}`},getTextDisplayData=(e,t)=>{let{templateStringDisplay:i,outOfStockMessageDisplay:a,continueSellingDisplay:n,unlimitedQuantityMessageDisplay:r}=e??{},{textColor:s}=t??{},_=s||"brand";return`
    <div class="gp-hidden gp-text-white gp-py-1 gp-px-2 gp-mr-1 gp-inline-block gp-my-[1px] gp-text-g-${_} gp-bg-g-${_}" >
      <div id="template">${i}</div>
      <div id="out-of-stock-message">${a}</div>
      <div id="continue-selling">${n}</div>
      <div id="unlimited-quantity-message">${r}</div>
    </div>`},getInlineCss=(e,t)=>{let i=getBorderRadius(t);if(e)return`
      [data-id="${e}"]  {
          .gp-sc-progress-bar{
            ${i}
          }
          .gp-sc-progress-bar:before{
            ${i}
          }
      }`},getBorderRadius=e=>`
  border-top-left-radius: ${e?.bbrr??"0px"};
  border-top-right-radius: ${e?.bblr??"0px"};
  border-bottom-left-radius: ${e?.btrr??"0px"};
  border-bottom-right-radius: ${e?.btlr??"0px"};`,transformHighlighTag=(e,t)=>{if(!e.includes(`<${DEFAULT_HIGHLIGHT_TAG}>`))return e;let i="gp-text-white gp-py-1 gp-px-2 gp-mr-1 gp-inline-block gp-my-[1px]",a=`<${DEFAULT_HIGHLIGHT_TAG}>`;return a=t.includes("#")?`
      <${DEFAULT_HIGHLIGHT_TAG} class='${i}' style='background-color: ${t}'>
    `:`
      <${DEFAULT_HIGHLIGHT_TAG} class='${i} gp-bg-g-${t}'>
    `,e.replaceAll(`<${DEFAULT_HIGHLIGHT_TAG}>`,a)},transformNumberTag=(e,t,i)=>{if(!e.includes(DEFAULT_QUANTITY_TEMPLATE))return e;let a="";return a=t.includes("#")?`<span style='--c: ${t}'><$quantity$></span>`:`<span class='gp-text-g-${t}'><$quantity$></span>`,i&&(a=a.replace("<$quantity$>",i.toString())),e.replaceAll(DEFAULT_QUANTITY_TEMPLATE,a)},convertSizeToWidth=e=>{let t={};return e["--size"]&&(t["--w"]=e["--size"]),e["--size-tablet"]&&(t["--w-tablet"]=e["--size-tablet"]),e["--size-mobile"]&&(t["--w-mobile"]=e["--size-mobile"]),t};exports.CONTINUE_SELLING_WHEN_OUT_OF_STOCK=CONTINUE_SELLING_WHEN_OUT_OF_STOCK,exports.DEFAULT_FONT_SIZE=20,exports.DEFAULT_HIGHLIGHT_TAG=DEFAULT_HIGHLIGHT_TAG,exports.DEFAULT_PROGRESS_BAR_HEIGHT=10,exports.DEFAULT_QUANTITY_TEMPLATE=DEFAULT_QUANTITY_TEMPLATE,exports.DEFAULT_RANGE_STEP=10,exports.DEFAULT_REMAINING_PERCENT=20,exports.DEFAULT_REMAINING_QUANTITY=12,exports.DEFAULT_SCARCITY_THRESHOLD=12,exports.MAX_PROGRESS_BAR_HEIGHT=20,exports.MAX_REMAINING_PERCENT=100,exports.MIN_PROGRESS_BAR_HEIGHT=5,exports.MIN_REMAINING_PERCENT=10,exports.MIN_REMAINING_QUANTITY=0,exports.NO_PRODUCT_LEFT=0,exports.OUT_OF_STOCK=OUT_OF_STOCK,exports.QUANTITY_SOURCE=QUANTITY_SOURCE,exports.convertSizeToWidth=convertSizeToWidth,exports.getInlineCss=getInlineCss,exports.getLiquidInitData=getLiquidInitData,exports.getLiquidTextContent=getLiquidTextContent,exports.getTextDisplayData=getTextDisplayData,exports.transformHighlighTag=transformHighlighTag,exports.transformNumberTag=transformNumberTag;
