import{template as o,RenderIf as r,isLocalEnv as e,baseAssetURL as s,WrapRenderChildren as t,RenderChildren as i}from"@gem-sdk/core";import a from"../arrow/Arrow.liquid.js";import l from"../dot/Dots.liquid.js";import{mappingNavigationCarousel as d}from"../arrow/common/helpers.js";import{getData as n}from"./common/helpers.js";import{getClass as p}from"./common/classes.js";import{getStyle as m}from"./common/styles.js";import{getAttr as c}from"./common/attrs.js";import{getSettingPreloadData as u,getStaticLocale as $}from"../../../helpers.js";let Carousel=v=>{let{children:f,builderAttrs:g,builderProps:w,styles:S,isHiddenArrowWhenDisabled:h=!0,hiddenDotWhenOnlyOne:C,rootId:y,rawChildren:j,conditionAppendJs:k,productBadgeLiquid:z}=v,E=d(v.setting),I={...v,setting:E},{arrowButtonSize:A,arrowBackgroundColor:G,arrowGapToEachSide:P="16",roundedArrow:T,arrowIconSize:b,arrowCustomColor:q,arrowBorder:x,arrowShadow:B,showWhenHover:D}=E??{},{uniqueComponentId:O,loopConfig:W,arrowShowConfig:_,stateData:H}=n(I),{rootClassRender:M,wrapperClassRender:N,wrapperInnerClass:R,sliderClass:U}=p(I),{sliderWrapperStyle:V,rootStyleRender:F,wrapperStyleRender:J,wrapperInnerStyle:K}=m(I),{rootAttrRender:L,sliderAttr:Q}=c(I),X=()=>r(e,`<script ${u('class="gps-link" delay',"src")}="{{ 'gp-carousel-v3-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${u('class="gps-link" delay',"src")}="${s}/assets-v2/gp-carousel-v3-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`),Y=o=>{let r="next"===o;return a({uid:w?.uid,componentId:O,custom:E?.arrowCustom??"",showArrow:_,arrowButtonSize:A||{},arrowIconSize:b||{},arrowBackgroundColor:G??"",arrowCustomColor:q,gapToEachSize:P,showWhenHover:D,arrowBorder:x||{},arrowCorner:T||{},arrowShadow:B||{},left:!r,onClick:o=>{o.stopPropagation()},vertical:E?.vertical,isHiddenWhenDisabled:h,rootId:y})},Z=()=>o`
    ${j?.length?t({uid:w?.uid??"",customProps:j[0]?.customProps},j.map((r,e)=>{if(r)return o`${i({...r,index:e,parentSettings:E,parentStyle:S,background:E?.background,parentUid:w?.uid})}`})):f??`<div>${$("Carousel","no_slider")}</div>`}`;return o`
    <gp-carousel-v3 gp-data='${H}' ${L} style="${F}" class="${M}">
      <div
        ${g}
        class="${N}"
        style="${J}"
      >
        <div class="${R}" style="${K}">
          ${z??""}
          ${Y("prev")}
          <div ${Q} style="${V}">
            <div class="${U}">
              ${Z()}
            </div>
          </div>
          ${Y("next")}
        </div>
        ${l({loop:W,showDots:E?.dot,dotStyle:E?.dotStyle,dotGapToCarousel:E?.dotGapToCarousel,dotSize:E?.dotSize,vertical:E?.vertical,uniqueComponentId:O,hiddenWhenOnlyOne:C})}
      </div>
    </gp-carousel-v3>
    ${k?`{% if ${k} %} ${X()} {% endif %}`:X()}

  `};export{Carousel as default};
