import{RenderIf as t,template as i}from"@gem-sdk/core";import{getStyle as o}from"./common/styles.js";import{getClass as s}from"./common/classes.js";import{getAttr as r}from"./common/attrs.js";import d from"./ProductListGridItem.liquid.js";import{getStaticLocale as e}from"../../../helpers.js";let a=a=>{let{setting:n,builderProps:m,styles:c,productListId:p,productSrc:l}=a,{gridLayoutStyle:u}=o(a),{gridLayoutClass:f}=s(a),{productListAttr:g}=r(a),$=()=>i`
      {%- 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: "${m?.uid}" | append: product.id -%}
        ${d({...a})}
      {%- endif -%}
      {% endfor %}
      {%- if count == 0 and ${p?.length} == 0 -%}
        {% if '${l}' == 'RelatedProduct' -%}
          <div>${e("ProductList","no_related_products")}</div>
        {% else %}
          <div>${e("ProductList","no_products_found")}</div>
        {%- endif -%}
      {%- endif -%}
    `;return i`
    <div
      ${g}
      style="${u}"
      class="${f}"
    >
      ${t(n?.sameHeight,i`
      <gp-same-height
        class="gp-contents"
        style="visibility: hidden"
        gp-data='${JSON.stringify({targetUid:m?.builderData?.childrens?.[0],slidesToShow:n?.slidesToShow,rowGap:c?.horizontalGutter})}'>
        ${`${$()}`}
      </gp-same-height>
    `)}
      ${t(!n?.sameHeight,i`${$()}`)}
    </div>
  `};export{a as default};
