"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),styles=require("./common/styles.js"),classes=require("./common/classes.js"),attrs=require("./common/attrs.js"),ProductListGridItem_liquid=require("./ProductListGridItem.liquid.js"),helpers=require("../../../helpers.js");const ProductListGridLayout=e=>{let{setting:t,builderProps:s,styles:r,productListId:i,productSrc:d}=e,{gridLayoutStyle:o}=styles.getStyle(e),{gridLayoutClass:a}=classes.getClass(e),{productListAttr:c}=attrs.getAttr(e),l=e=>core.template`
      <gp-same-height
        class="gp-contents"
        style="visibility: hidden"
        gp-data='${JSON.stringify({targetUid:s?.builderData?.childrens?.[0],slidesToShow:t?.slidesToShow,rowGap:r?.horizontalGutter})}'>
        ${e}
      </gp-same-height>
    `,u=()=>core.template`
      {%- assign count = 0 -%}
      {%- for product in products limit: limit -%}
      {%- if product.id != empty -%}
      {%- assign count = count | plus: 1 -%}
      {%- assign variant = product.selected_or_first_available_variant -%}
      {%- assign product_form_id = 'product-form-' | append: "${s?.uid}" | append: product.id -%}
        ${ProductListGridItem_liquid.default({...e})}
      {%- endif -%}
      {% endfor %}
      {%- if count == 0 and ${i?.length} == 0 -%}
        {% if '${d}' == 'RelatedProduct' -%}
          <div>${helpers.getStaticLocale("ProductList","no_related_products")}</div>
        {% else %}
          <div>${helpers.getStaticLocale("ProductList","no_products_found")}</div>
        {%- endif -%}
      {%- endif -%}
    `;return core.template`
    <div
      ${c}
      style="${o}"
      class="${a}"
    >
      ${core.RenderIf(t?.sameHeight,l(`${u()}`))}
      ${core.RenderIf(!t?.sameHeight,core.template`${u()}`)}
    </div>
  `};exports.default=ProductListGridLayout;
