"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("./common/common.js"),r=require("./components/feature-gallery/FeatureImageWithGallery.liquid.js"),i=require("./components/gallery-carousel/GalleryCarousel.liquid.js"),s=require("./components/gallery-grid/GalleryGrid.liquid.js"),a=require("../../../helpers.js"),o=require("./common/productGallery.js"),l=require("./composables/getProductImagesClassName.js"),d=require("./composables/getProductImagesStyles.js"),u=require("@gem-sdk/system"),p=require("./common/getBorderActiveCss.js"),n=require("../../helpers/function.js");exports.default=c=>{let g=t.setDefaultWhenUndefineSetting(c),{setting:m,styles:f,builderProps:y,style:$}=g,{rawChildren:S,pageContext:I}=c,h={...m,...f},q=`
    {
      "id":${JSON.stringify(y?.uid)},
      "pageContext": ${JSON.stringify(a.filterPageContext(I))},
      "setting":${JSON.stringify(m)},
      "styles":${JSON.stringify(f)},
      "productUrl":{{product.url | json | escape}},
      "product":{{product | json | escape}},
      "collectionUrl": {{ collection.url | json | escape }},
      "collection": {{ collection | json | escape}}
    }
  `,v=u.createAttr({"section-id":"{{section.id}}","data-id":`${y?.uid}`}),{isOnlyFeatureAllDevices:j,isRenderGalleryGrid:C}=t.getConditionRenderGalleryImages(h?.position,m?.type),F=C?{}:u.createAttr({"data-only-image":u.LiquidIf("product.media.size > 1","false","true")}),{wrapperClasses:L,productImagesGalleryClasses:P}=l.getProductImagesClassName(c),O=u.createClass({"gp-grid gp-w-full !gp-m-0 gp-relative":!0}),D=u.createClass({"gp-w-full !gp-m-0 gp-relative":!0}),{wrapContainerStyle:b,wrapContainerStyleOnlyOneImage:G,galleryImageStyle:z}=d.getProductImagesStyles(h),A=o.getShapeByLayout({shape:h.shape,shapeForBottom:h.shapeForBottom,shapeFor1Col:h.shapeFor1Col,shapeFor2Col:h.shapeFor2Col,shapeForFtOnly:h.shapeForFtOnly,shapeForInsideBottom:h.shapeForInsideBottom??o.sizeSettingDefaultForNewLayout,shapeForInside:h.shapeForInside??o.sizeSettingDefaultForNewLayout},h.position),N=t.getStyleInsideLayout(h.position,A,h?.spacing),_=()=>e.template`
      ${e.WrapRenderChildren({uid:y?.uid||"",customProps:S?.[0].customProps},S?.map(t=>{if(t)return e.template`${e.RenderChildren({...t,isInsideProductImage:!0,imageData:{imageShape:f?.ftShape,imageAlign:f?.align,imageLayout:f?.position},dotData:{dotSize:m?.ftDotSize,dotGapToCarousel:m?.ftDotGapToCarousel,dotStyle:m?.ftDotStyle}})}`}))}
    `;return e.template`
  ${u.If(m?.borderActive?.border!=="none",u.LiquidIf("product.media.size > 1",`<style>${p.getBorderActiveCss({settings:h,uid:y?.uid,type:"Liquid"})}</style>`),"")}
  ${u.Liquid(`
    {% assign featured_image = product.featured_image %}
    ${u.LiquidIf("variant != null and variant.featured_image != null","{% assign featured_image = variant.featured_image %}")}
  `)}
    <gp-product-images-v3
      gp-data='${q}'
      ${{...v}}
      style="${{...$}}"
      class="${L}"
    >
      <div
        class="${u.LiquidIf("product.media.size > 1",`${O}`,`${D}`)}"
        style="${u.LiquidIf("product.media.size > 1",n.getStyleOfObject(b),n.getStyleOfObject(G))}"
      >
        ${r.default({builderPropUID:`gp-carousel-${y?.uid}`,...h,children:_(),pageContext:I})}
        ${u.If(!j,e.template`
      <div
        class="${P}"
        style="${n.getStyleOfObject(z)}"
        ${{...F}}
      >
        ${u.LiquidIf("product.media.size > 1",i.default({builderPropUID:`gp-gallery-${y?.uid}`,...h,pageContext:I}))}
        ${u.If(C,s.default({builderPropUID:y?.uid,wrapperStyle:{...N},children:_(),...h,pageContext:I}))}
      </div>
    `)}
      </div>
    </gp-product-images-v3>
    ${u.If(e.isLocalEnv,`<script ${a.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-product-images-v3-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${a.getSettingPreloadData('class="gps-link" delay',"src")}="${e.baseAssetURL}/assets-v2/gp-product-images-v3-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
  `};
