"use strict";var system=require("@gem-sdk/system"),helpers=require("../../../../../../helpers.js");const renderCombineVariants=(e,i,t)=>{let o=t?"- {{variantItem.price | money}}":"",a='origin-price="{{variantItem.price}}" value="{{variantItem.id}}" key="{{variantItem.id}}"',n=`{{variantItem.title}} ${o}`;return`{%- for variantItem in variants -%}
    ${system.If(e,system.LiquidIf("variantItem.available == false",system.LiquidIf("variantItem.id == variant.id",`<option origin-price="{{variantItem.price}}" disabled ${i?"selected":""} value="{{variantItem.id}}" key="{{variantItem.id}}">            
            ${n}
          </option>`,`<option ${a} disabled>
            ${n}
          </option>`),system.LiquidIf("variantItem.id == variant.id",`<option origin-price="{{variantItem.price}}" ${i?"selected":""} value="{{variantItem.id}}" key="{{variantItem.id}}">
            ${n}
          </option>`,`<option ${a}>
            ${n}
          </option>`)),system.LiquidIf("variantItem.id == variant.id",`<option origin-price="{{variantItem.price}}" ${i?"selected":""} value="{{variantItem.id}}" key="{{variantItem.id}}">
          ${n}
        </option>`,`<option ${a}>
          ${n}
        </option>`))}     
    {%- endfor -%}
  `},composeSelectOptionAttrs=`
  option-data="{{option.name | escape}}"
  option-value="{{value | escape}}"
  data-gp-option-value-id="{{value.id}}"
  data-gp-option-available="{{value.available}}"
  value="{{value | escape}}"
  class="option-value-wrapper"
  key="{{value | escape}}"
`,renderDropdownOptions=(e,i)=>system.LiquidFor("value in values",`${system.Liquid(`{%- liquid
      assign option_disabled = true
      for variantItem in product.variants
        case option.position
          when 1
            if variantItem.available and variantItem.option1 == value
              assign option_disabled = false
            endif
          when 2
            if variantItem.available and variantItem.option2 == value
              assign option_disabled = false
            endif
          when 3
            if variantItem.available and variantItem.option3 == value
              assign option_disabled = false
            endif
        endcase
      endfor
    -%}`)}
    ${system.If(e,system.LiquidIf("option_disabled == true",system.LiquidIf("value == selectedValue",`<option disabled ${i?"selected":""} option-position="{{option.position}}"${composeSelectOptionAttrs}>{{value}}</option>`,`<option disabled ${composeSelectOptionAttrs}>{{value}}</option>`),system.LiquidIf("value == selectedValue",`<option ${i?"selected":""} option-position="{{option.position}}" ${composeSelectOptionAttrs}>{{value}}</option>`,`<option ${composeSelectOptionAttrs} option-position="{{option.position}}">{{value}}</option>`)),system.LiquidIf("value == selectedValue",`<option ${i?"selected":""} ${composeSelectOptionAttrs} option-position="{{option.position}}">{{value}}</option>`,`<option ${composeSelectOptionAttrs} option-position="{{option.position}}">{{value}}</option>`))}`),renderBlankOption=e=>`<option value="blank" selected>${e??helpers.getStaticLocale("ProductVariants","please_select")}</option>`;exports.renderBlankOption=renderBlankOption,exports.renderCombineVariants=renderCombineVariants,exports.renderDropdownOptions=renderDropdownOptions;
