{
  "version": 3,
  "sources": ["/cdn/shop/t/95/assets/lazy-video.js?cb=20261119"],
  "sourcesContent": ["/**\n * Lazy autoplay for muted, looping preview videos.\n *\n * Markup contract:\n *   <video muted loop playsinline preload=\"none\" data-lazy-autoplay data-poster=\"...\">\n *     <source data-src=\"...\" type=\"...\">\n *   </video>\n *\n * Nothing is downloaded (no file, no HLS manifest, no poster) until a video is\n * near the viewport: only then are the poster and the sources attached. A video\n * plays while it is on screen and pauses when it leaves. With\n * prefers-reduced-motion the video is never loaded: only its poster is set.\n *\n * Used by sections/video-carousel.liquid. The carousel previously started every\n * video at page load (preload=\"auto\" plus a forced play()), tens of MB that\n * competed with the cart requests on a phone.\n */\n(() => {\n  const VIDEO_SELECTOR = 'video[data-lazy-autoplay]';\n  // Small margin so a tile is ready by the time it scrolls into view.\n  const NEAR_VIEWPORT_MARGIN = '200px';\n\n  const prefersReducedMotion = () => window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n\n  const hasSources = (video) => video.dataset.lazyAutoplayLoaded === 'true';\n\n  const showPoster = (video) => {\n    if (video.dataset.poster && !video.poster) video.poster = video.dataset.poster;\n  };\n\n  const attachSources = (video) => {\n    if (hasSources(video)) return;\n    video.querySelectorAll('source[data-src]').forEach((source) => {\n      source.src = source.dataset.src;\n    });\n    video.load();\n    video.dataset.lazyAutoplayLoaded = 'true';\n  };\n\n  const play = (video) => {\n    video.muted = true;\n    const attempt = video.play();\n    // Autoplay can be refused (low-power mode, data saver): the poster stays.\n    if (attempt) attempt.catch(() => {});\n  };\n\n  const loadAndPlay = (video) => {\n    showPoster(video);\n    attachSources(video);\n    play(video);\n  };\n\n  const pauseIfLoaded = (video) => {\n    if (hasSources(video)) video.pause();\n  };\n\n  const handleVisibilityChange = (entries) => {\n    entries.forEach(({ target, isIntersecting }) => {\n      if (isIntersecting) loadAndPlay(target);\n      else pauseIfLoaded(target);\n    });\n  };\n\n  const observeVideos = (videos) => {\n    const observer = new IntersectionObserver(handleVisibilityChange, { rootMargin: NEAR_VIEWPORT_MARGIN });\n    videos.forEach((video) => {\n      video.dataset.lazyAutoplayObserved = 'true';\n      observer.observe(video);\n    });\n  };\n\n  const init = () => {\n    // A video already taken by an earlier run of this script (a section rendered twice) is skipped.\n    const videos = [...document.querySelectorAll(VIDEO_SELECTOR)].filter((video) => video.dataset.lazyAutoplayObserved !== 'true');\n    if (!videos.length) return;\n\n    if (prefersReducedMotion()) videos.forEach(showPoster);\n    else if ('IntersectionObserver' in window) observeVideos(videos);\n    else videos.forEach(loadAndPlay);\n  };\n\n  init();\n})();\n"],
  "mappings": "CAiBC,IAAM,CACL,MAAM,eAAiB,4BAEjB,qBAAuB,QAEvB,qBAAuB,IAAM,OAAO,WAAW,kCAAkC,EAAE,QAEnF,WAAc,OAAU,MAAM,QAAQ,qBAAuB,OAE7D,WAAc,OAAU,CACxB,MAAM,QAAQ,QAAU,CAAC,MAAM,SAAQ,MAAM,OAAS,MAAM,QAAQ,OAC1E,EAEM,cAAiB,OAAU,CAC3B,WAAW,KAAK,IACpB,MAAM,iBAAiB,kBAAkB,EAAE,QAAS,QAAW,CAC7D,OAAO,IAAM,OAAO,QAAQ,GAC9B,CAAC,EACD,MAAM,KAAK,EACX,MAAM,QAAQ,mBAAqB,OACrC,EAEM,KAAQ,OAAU,CACtB,MAAM,MAAQ,GACd,MAAM,QAAU,MAAM,KAAK,EAEvB,SAAS,QAAQ,MAAM,IAAM,CAAC,CAAC,CACrC,EAEM,YAAe,OAAU,CAC7B,WAAW,KAAK,EAChB,cAAc,KAAK,EACnB,KAAK,KAAK,CACZ,EAEM,cAAiB,OAAU,CAC3B,WAAW,KAAK,GAAG,MAAM,MAAM,CACrC,EAEM,uBAA0B,SAAY,CAC1C,QAAQ,QAAQ,CAAC,CAAE,OAAQ,cAAe,IAAM,CAC1C,eAAgB,YAAY,MAAM,EACjC,cAAc,MAAM,CAC3B,CAAC,CACH,EAEM,cAAiB,QAAW,CAChC,MAAM,SAAW,IAAI,qBAAqB,uBAAwB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