import{template as e,makeStyleResponsive as t}from"@gem-sdk/core";import{getLiquidForAppBlock as s}from"../common/helpers.js";let LooxReviews=({setting:a,advanced:o})=>{let{widgetType:i,showAllReviews:r,showRatingWidgetAllReviews:d,version:l,appBlockId:g,align:c}=a??{},n=e=>{switch(i){case"reviews_widget":return{id:"looxReviews","data-product-id":e,...r?{"data-loox-aggregate":"true"}:{}};case"rating_widget":return{class:"loox-rating","data-id":e,"data-fetch":"","data-rating":"{{ product.metafields.loox.avg_rating }}","data-raters":"{{ product.metafields.loox.num_reviews }}"};case"carousel_widget":return{id:"looxCarousel","data-show-more":"true"}}};return"v2"===l?s(g,c,o?.cssClass):e`
    <script defer strategy="lazyOnload" src="${"//loox.io/widget/loox.js?shop={{ request.host }}"}"></script>
    <div
      class="${o?.cssClass}"
      style="${{...t("ta",a?.align)}}"
    >
      {% if '${i}' == "rating_widget"  %}
        {% if '${d}' == 'true' %}
          {% if shop.metafields.loox["global_stats"]  %}
            {% assign looxstats = shop.metafields.loox["global_stats"] | split: ',' %}
            <a href="#looxReviews">
              <div class="loox-rating" data-rating="{{ looxstats[0] }}" data-raters="{{ looxstats[1] }}"></div>
            </a>
          {% endif %}
        {% else %}
          <a href="#looxReviews">
            <div ${{...n("{{ product.id }}")}}></div>
          </a>
        {% endif %}
      {% else %}
        <div ${{...n("{{ product.id }}")}}></div>
      {% endif %}
    </div>
  `};export{LooxReviews as default};
