"use strict";const ADVANCED_WIDGETS="advanced_widget",getTemplateByWidget=e=>{let t={reviews_widget:productReviewWidget,star_ratings:starRatings,homepage_reviews:homePageReviews,happy_customer_reviews:happyCustomerReviews,star_ratings_in_list:starRatingsInList},a={cardCarousel:cardCarousel,testimonialCarousel:testimonialCarousel,mediaGallery:mediaGallery,cardGrid:cardGrid},s=e?.widgetType??"reviews_widget",i=e?.advancedWidgetType??"mediaGallery";return"advanced_widget"===s?a[i]:t[s]},productReviewWidget=`
  {% assign random_number = "now" | date: "%N" | modulo: 1000 | plus: 0 %}
  <script>
    var sectionConfig = (typeof sectionConfig == "undefined" || sectionConfig == null) ? {} : sectionConfig;
    var scmCustomData = (typeof scmCustomData == "undefined" || scmCustomData == null) ? {} : scmCustomData;
    var scmCustomDataWigetAll = (typeof scmCustomDataWigetAll == "undefined" || scmCustomDataWigetAll == null) ? [] : scmCustomDataWigetAll;
    scmCustomDataWigetAll['{{ random_number }}'] = {
      "id_iframe" : "{{ random_number }}",
      "productId" : "{{ product.id }}",
      "typePage" : 'productPage',
      "sectionConfig" : JSON.stringify(sectionConfig),
      "scmCustomData" : JSON.stringify(scmCustomData),
      'dataProduct' : []
    };
    sectionConfig= null;
    scmCustomData= null;
    scmCustomDataWigetAll['{{ random_number }}'].dataProduct['product']= {{ product | json }};
    {% for metafieldValue in product.metafields.scm_review_importer %}
      scmCustomDataWigetAll['{{ random_number }}'].dataProduct['{{ metafieldValue[0] }}'] = \`{{ metafieldValue[1] | json }}\`;
    {% endfor %}
  </script>
  <div class="scm-container" style="display: none;">
      <div class="scm-reviews-importer" data-product-id="{{ product.id }}">
          <iframe class="scm-reviews-importer-iframe" width="100%" title="Sma reviews section Product page" data-idIframe="{{ random_number }}"></iframe>
      </div>
  </div>
`,starRatings=`
  <div class="scm-reviews-rate" data-rate-version2="{{ product.metafields.scm_review_importer.reviewsData.reviewCountInfo | json | escape}}" data-product-id="{{ product.id }}"></div>
`,cardCarousel=`
  <script>var sectionConfig={ "type_layout" : "cardCarousel", "source" : "default_layout"};</script>{% assign random_number = "now" | date: "%N" | modulo: 1000 | plus: 0 %}<script>var sectionConfig=  (typeof sectionConfig == "undefined" || sectionConfig == null) ? {} : sectionConfig;var scmCustomData= (typeof scmCustomData == "undefined" || scmCustomData == null) ? {} : scmCustomData;var scmCustomDataWigetAll= (typeof scmCustomDataWigetAll == "undefined" || scmCustomDataWigetAll == null) ? [] : scmCustomDataWigetAll; scmCustomDataWigetAll['{{ random_number }}'] ={ "id_iframe" : "{{ random_number }}","productId" : "","typePage" : 'homePage',"sectionConfig" : JSON.stringify(sectionConfig),"scmCustomData" : JSON.stringify(scmCustomData),'dataProduct' : []};sectionConfig= null;scmCustomData= null;</script><div class="scm-container" style="display: none;"><div class="scm-reviews-importer"><iframe class="scm-reviews-importer-iframe" width="100%" title="Sma reviews section Home Page" data-idIframe="{{ random_number }}"></iframe></div></div>
`,testimonialCarousel=`
  <script>var sectionConfig={ "type_layout" : "testimonial", "source" : "default_layout"};</script>{% assign random_number = "now" | date: "%N" | modulo: 1000 | plus: 0 %}<script>var sectionConfig=  (typeof sectionConfig == "undefined" || sectionConfig == null) ? {} : sectionConfig;var scmCustomData= (typeof scmCustomData == "undefined" || scmCustomData == null) ? {} : scmCustomData;var scmCustomDataWigetAll= (typeof scmCustomDataWigetAll == "undefined" || scmCustomDataWigetAll == null) ? [] : scmCustomDataWigetAll; scmCustomDataWigetAll['{{ random_number }}'] ={ "id_iframe" : "{{ random_number }}","productId" : "","typePage" : 'homePage',"sectionConfig" : JSON.stringify(sectionConfig),"scmCustomData" : JSON.stringify(scmCustomData),'dataProduct' : []};sectionConfig= null;scmCustomData= null;</script><div class="scm-container" style="display: none;"><div class="scm-reviews-importer"><iframe class="scm-reviews-importer-iframe" width="100%" title="Sma reviews section Home Page" data-idIframe="{{ random_number }}"></iframe></div></div>
`,mediaGallery=`
  <script>var sectionConfig={ "type_layout" : "gallery", "source" : "default_layout"};</script>{% assign random_number = "now" | date: "%N" | modulo: 1000 | plus: 0 %}<script>var sectionConfig=  (typeof sectionConfig == "undefined" || sectionConfig == null) ? {} : sectionConfig;var scmCustomData= (typeof scmCustomData == "undefined" || scmCustomData == null) ? {} : scmCustomData;var scmCustomDataWigetAll= (typeof scmCustomDataWigetAll == "undefined" || scmCustomDataWigetAll == null) ? [] : scmCustomDataWigetAll; scmCustomDataWigetAll['{{ random_number }}'] ={ "id_iframe" : "{{ random_number }}","productId" : "","typePage" : 'homePage',"sectionConfig" : JSON.stringify(sectionConfig),"scmCustomData" : JSON.stringify(scmCustomData),'dataProduct' : []};sectionConfig= null;scmCustomData= null;</script><div class="scm-container" style="display: none;"><div class="scm-reviews-importer"><iframe class="scm-reviews-importer-iframe" width="100%" title="Sma reviews section Home Page" data-idIframe="{{ random_number }}"></iframe></div></div>
`,cardGrid=`
  <script>var sectionConfig={ "type_layout" : "grid", "source" : "default_layout"};</script>{% assign random_number = "now" | date: "%N" | modulo: 1000 | plus: 0 %}<script>var sectionConfig=  (typeof sectionConfig == "undefined" || sectionConfig == null) ? {} : sectionConfig;var scmCustomData= (typeof scmCustomData == "undefined" || scmCustomData == null) ? {} : scmCustomData;var scmCustomDataWigetAll= (typeof scmCustomDataWigetAll == "undefined" || scmCustomDataWigetAll == null) ? [] : scmCustomDataWigetAll; scmCustomDataWigetAll['{{ random_number }}'] ={ "id_iframe" : "{{ random_number }}","productId" : "","typePage" : 'homePage',"sectionConfig" : JSON.stringify(sectionConfig),"scmCustomData" : JSON.stringify(scmCustomData),'dataProduct' : []};sectionConfig= null;scmCustomData= null;</script><div class="scm-container" style="display: none;"><div class="scm-reviews-importer"><iframe class="scm-reviews-importer-iframe" width="100%" title="Sma reviews section Home Page" data-idIframe="{{ random_number }}"></iframe></div></div>
`,homePageReviews=`
  {% capture laisnippet %}
    {% render "lai-home-page" %}
  {% endcapture %}
  {% unless laisnippet contains "Liquid error" %}
      {{ laisnippet }}
  {% endunless %}
`,happyCustomerReviews=`
  {% capture laisnippet %}
    {% render "reviews-happy-page" %}
  {% endcapture %}
  {% unless laisnippet contains "Liquid error" %}
      {{ laisnippet }}
  {% endunless %}
`,starRatingsInList=`
  <div class="scm-reviews-rate"
    data-rate-version2="{{ product.metafields.scm_review_importer.reviewsData.reviewCountInfo | json | escape }}"
    data-product-id="{{ product.id }}"></div>
`;exports.getTemplateByWidget=getTemplateByWidget;
