"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[19],{38:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HeroSlider=void 0;const s=n(0),a=(n(1),n(3)),o=i(n(48)),l=i(n(49)),r=i(n(143)),d=i(n(144));n(145);const u=n(4),c=n(39),p=n(3),h=n(2),{sliderContainer:m,sliderItem:v}=o.default;function f(e){(new Image).src=e.src}function g({src:e,className:t}){const n=(0,p.useRef)(null);return(0,a.useEffect)((()=>{var e;(null==n?void 0:n.current)&&(null===(e=null==n?void 0:n.current)||void 0===e||e.load())}),[e]),(0,s.jsx)("video",{playsInline:!0,ref:n,src:e,preload:"metadata",class:t,muted:!0,loop:!0,autoPlay:!0})}t.HeroSlider=function({product:e,selectedVariant:t,pdpVideo:n,showModelInformation:i,isDesktop:w,embedded:b}){const y=(0,a.useMemo)((()=>{var i,s,a;const o=(0,c.getImagesForVariant)(e.imageMap,t,h.getAssignment),l=null===(i=null==t?void 0:t.selectedOptions.find((e=>"Color"===e.name)))||void 0===i?void 0:i.value;return n&&l&&(null===(s=e.productVideos)||void 0===s?void 0:s[l])?[...o.slice(0,w?2:1),{src:null===(a=e.productVideos)||void 0===a?void 0:a[l]},...o.slice(w?2:1)]:o}),[t]),_=(0,p.useRef)(null),[j,x]=(0,a.useState)(!1);return(0,a.useEffect)((()=>{y.forEach(f),Object.values(e.imageMap).forEach((e=>{e.slice(0,2).forEach(f)}));const t=new r.default({gallery:"#hero-slider",children:"a",pswpModule:d.default,bgOpacity:.9,arrowKeys:!0});return n&&t.on("contentLoad",(e=>{var t;const{content:n}=e;if(null===(t=n.data.src)||void 0===t?void 0:t.endsWith(".mp4")){e.preventDefault(),n.element=document.createElement("div"),n.element.className="pswp__video-container";const t=document.createElement("video");t.setAttribute("playsinline",""),t.setAttribute("muted",""),t.setAttribute("loop",""),t.setAttribute("style","width: 100vw;"),t.setAttribute("autoplay",""),t.src=n.data.src,n.element.appendChild(t)}})),t.init(),j?!w&&_.current&&(_.current.scrollLeft=0):x(!0),()=>{null==t||t.destroy()}}),[y]),(0,s.jsxs)("div",Object.assign({class:["pswp-gallery",w?l.default.container:m,b?o.default.embeddedContainer:""].join(" "),ref:_,id:"hero-slider"},{children:[(0,s.jsx)("style",{dangerouslySetInnerHTML:{__html:".pswp--touch .pswp__button--arrow { visibility: visible; };\n "+(n?" .pswp__video-container {\n position: relative;\n width: 100%;\n height: 100%;\n pointer-events: none;\n }\n .pswp__video-container video {\n background: #444;\n object-fit: cover; \n width: 100%;\n height: 100%;\n max-width: 800px;\n max-height: 600px;\n pointer-events: auto;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n }":"")}}),y.map((({src:e,model:t,width:n,height:a},r)=>(0,s.jsxs)("a",Object.assign({class:[w?l.default.item:v,b?o.default.embeddedImage:""].join(" "),"data-pswp-type":(null==e?void 0:e.endsWith(".mp4"))?"video":"image",href:e,"data-pswp-width":n,"data-pswp-height":a,target:"_blank",rel:"noreferrer"},{children:[(null==e?void 0:e.endsWith(".mp4"))?(0,s.jsx)(g,{src:e,preload:"metadata",className:w?l.default.item:v}):(0,s.jsx)(u.LazyImage,{src:e,initialWidth:300,width:n,height:a}),i&&t&&(0,s.jsx)("div",Object.assign({class:o.default.modelOverlay},{children:t}))]}),r)))]}))}}}]);