"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("../helpers/product-image.js"),i=require("./product-images/common/helpers.js"),r=require("./product-images/ProductFeaturedImage.liquid.js"),l=require("./product-images/ProductGalleryCarousel.liquid.js"),s=require("./product-images/ProductGalleryGrid.liquid.js"),a=require("./product-images/common/productGallery.js"),o=require("../../helpers.js");exports.default=d=>{let{setting:g,styles:u,builderProps:p,style:n}=d,c={...d.styles,...d.setting},m={...d.styles,...d.setting},f=t=>e.getResponsiveValueByScreen(u?.position,t),y=`
    {
      "id":${JSON.stringify(p?.uid)},
      "setting":${JSON.stringify(g)},
      "styles":${JSON.stringify(u)},
      "product":{{ product | json | escape }}
    }
  `;return e.template`
  {% assign featured_image = product.featured_image %}
  {%- if variant != null and variant.featured_image != null -%}
  {% assign featured_image = variant.featured_image %}
  {%- endif -%}
  <gp-product-images
    gp-data='${y}'
    style="${{...n}}"
    class="${e.cls({"gp-overflow-hidden":i.checkAddOverFlowClass(n)})}"
  >
    <div
        class="${e.cls("gp-flex gp-w-full",{...t.getFlexDirection(d)})}"
        style="${{...i.getStyleAlignment(u?.align,u?.position)}}"
      >
        ${r.default({...c})}
        {%- if product.media.size > 1 -%}
          <div
            class="${e.cls("gallery-wrapper gp-product-images-gallery gp-inline-flex gp-h-fit gp-max-w-full",{"gp-justify-start":"bottom-left"==f("desktop"),"tablet:gp-justify-start":"bottom-left"==f("tablet"),"mobile:gp-justify-start":"bottom-left"==f("mobile"),"gp-justify-center":"bottom-center"==f("desktop"),"tablet:gp-justify-center":"bottom-center"==f("tablet"),"mobile:gp-justify-center":"bottom-center"==f("mobile"),"gp-mx-auto":"bottom-center"==f("desktop"),"tablet:gp-mx-auto":"bottom-center"==f("tablet"),"mobile:gp-mx-auto":"bottom-center"==f("mobile")})}"
            style="${{...e.makeStyle({fs:"1.23"}),...i.getDisplayStyle(t=>!!g?.galleryVisible&&!e.getResponsiveValueByScreen(g?.galleryVisible,t),"inline-flex"),...a.getStyleWidthForGallery({galleryVisible:g?.galleryVisible,featureImageVisible:g?.featureImageVisible,position:u?.position,width:u?.width,widthHorizontalLayout:u?.widthHorizontalLayout}),...a.getStyleGallerySpacing(u?.position,u?.gallerySpacing)}}"
          >
            ${l.default({builderPropUID:p?.uid,...m})}
            ${s.default({builderPropUID:p?.uid,...m})}
          </div>
        {%- endif -%}
      </div>
  </gp-product-images>
  ${e.RenderIf(e.isLocalEnv,`<script ${o.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-product-images.js' | asset_url }}" defer="defer"></script>`,`<script ${o.getSettingPreloadData('class="gps-link" delay',"src")}="${e.baseAssetURL}/assets-v2/gp-product-images.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
  `};
