"use strict";var system=require("@gem-sdk/system"),core=require("@gem-sdk/core");const renderOptionValuesOld=s=>{let{renderVariantItem:e,variantPresetsLiquid:i}=s;return core.template`
    ${system.Liquid("{%- assign optionRendered = false -%}")}
    ${system.Liquid("{%- assign swatches = shop.metafields.GEMPAGES.swatches -%}")}
    ${system.Liquid("{%- assign swatchesItems = swatches | split: '($1)' -%}")}

    ${system.LiquidFor("swatchesItem in swatchesItems",`
      ${system.Liquid('{%- assign colorArraysString = "" -%}')}
      ${system.Liquid('{%- assign labelsString = "" -%}')}
      ${system.Liquid('{%- assign imageUrlsString = "" -%}')}
      ${system.Liquid("{%- assign attrItems = swatchesItem | split: '($3)' -%}")}

      ${system.LiquidFor("attrItem in attrItems",`
          ${system.Liquid("{%- assign attrs = attrItem | split: '($2)' -%}")}
          ${system.Liquid("{%- assign optionKey = attrs[0] -%}")}
          ${system.Liquid("{%- assign optionValue = attrs[1] -%}")}
          ${system.Liquid(`
            {% if optionKey == 'optionTitle' %}
              {% assign optionTitle = optionValue %}
            {% elsif optionKey == 'optionType' %}
              {% assign optionType = optionValue %}
            {% endif %}
          `)}

          ${system.LiquidIf('optionKey == "optionValues"',`
            ${system.Liquid("{%- assign opValueItems = optionValue | split: '($4)' -%}")}
            ${system.LiquidFor("opValueItem in opValueItems",`
                ${system.Liquid("{%- assign opValueItemAttrs = opValueItem | split: '($6)' -%}")}
                ${system.LiquidFor("opValueItemAttr in opValueItemAttrs",`
                    ${system.Liquid("{%- assign attrs = opValueItemAttr | split: '($5)' -%}")}
                    ${system.Liquid("{%- assign opValueItemKey = attrs[0] -%}")}
                    ${system.Liquid("{%- assign opValueItemValue = attrs[1] -%}")}

                    ${system.LiquidIf('opValueItemKey == "label"',`${system.Liquid("{%- assign labelsString = labelsString | append: opValueItemValue -%}")}
                       ${system.Liquid('{%- assign labelsString = labelsString | append: "($8)" -%}')}`)}

                    ${system.LiquidIf('opValueItemKey == "colors"',`${system.Liquid("{%- assign colorArraysString = colorArraysString | append: opValueItemValue -%}")}
                       ${system.Liquid('{%- assign colorArraysString = colorArraysString | append: "($8)" -%}')}`)}

                    ${system.LiquidIf('opValueItemKey == "imageUrl"',`${system.Liquid("{%- assign imageUrlsString = imageUrlsString | append: opValueItemValue -%}")}
                       ${system.Liquid('{%- assign imageUrlsString = imageUrlsString | append: "($8)" -%}')}`)}
                  `)}
              `)}
            `)}
        `)}

      ${system.Liquid("{%- assign labels = labelsString | split: '($8)' -%}")}
      ${system.Liquid("{%- assign colorStrings = colorArraysString | split: '($8)' -%}")}
      ${system.Liquid("{%- assign imageUrls = imageUrlsString | split: '($8)' -%}")}

      ${system.LiquidIf("optionTitle == option.name",`
        ${system.Liquid(`{%- assign variantPresetString = "${i}" -%}`)}
        ${system.Liquid('{%- assign optionName = option.name | replace: "\'", "&apos;" | replace: \'"\', "&quot;" -%}')}
        ${system.Liquid("{%- assign items = variantPresetString | split:'($2)' -%}")}
        ${system.Liquid("{%- assign type = 'dropdown' -%}")}
        ${system.LiquidFor("item in items",`
            ${system.Liquid("{%- assign itemPreset = item | split:'($1)' -%}")}
            ${system.LiquidIf("itemPreset[0] == optionName",system.Liquid("{%- assign type = itemPreset[1] -%}"))}
            ${system.LiquidIf('itemPreset[0] == "base"',system.Liquid("{%- assign type = itemPreset[1] -%}"))}
          `)}
        ${system.Liquid("{%- assign optionRendered = true -%}")}
        ${e({showDropdown:!0})}
      `)}
    `)}

    ${system.LiquidIf("optionRendered == false",e({showDropdown:!1,isRenderDefault:!0,typeOfOption:"optionType"}))}
  `};exports.renderOptionValuesOld=renderOptionValuesOld;
