{
  "version": 3,
  "sources": ["/cdn/shop/t/1/assets/ryze-gift-sets.js?cb=20260615-gifts-topgap-refresh-2"],
  "sourcesContent": ["(() => {\n  const READY = () => {\n    initGiftReveal();\n    initFeatureLanes();\n    initFavoritesGrid();\n    initGiftAddToCart();\n  };\n\n  if (document.readyState === 'loading') {\n    document.addEventListener('DOMContentLoaded', READY, { once: true });\n  } else {\n    READY();\n  }\n\n  function initGiftReveal() {\n    const targets = Array.from(document.querySelectorAll('[data-ryze-gift-reveal]'));\n    if (!targets.length) return;\n\n    if (!('IntersectionObserver' in window)) {\n      targets.forEach((target) => target.classList.add('is-visible'));\n      return;\n    }\n\n    const observer = new IntersectionObserver(\n      (entries) => {\n        entries.forEach((entry) => {\n          if (!entry.isIntersecting) return;\n          entry.target.classList.add('is-visible');\n          observer.unobserve(entry.target);\n        });\n      },\n      {\n        rootMargin: '0px 0px -10% 0px',\n        threshold: 0.15,\n      }\n    );\n\n    targets.forEach((target) => observer.observe(target));\n  }\n\n  function initFeatureLanes() {\n    document.querySelectorAll('[data-ryze-feature-lane]').forEach((lane) => {\n      const candidates = Array.from(lane.querySelectorAll('[data-ryze-feature-candidate]'));\n      if (!candidates.length) return;\n\n      const activeIndex = Math.floor(Math.random() * candidates.length);\n      candidates.forEach((candidate, index) => {\n        const isActive = index === activeIndex;\n        candidate.hidden = !isActive;\n        candidate.classList.toggle('is-active', isActive);\n        initGallery(candidate);\n      });\n\n      initFeaturePurchaseOptions(lane);\n    });\n  }\n\n  function initGallery(candidate) {\n    if (candidate.dataset.ryzeGalleryReady === 'true') return;\n    candidate.dataset.ryzeGalleryReady = 'true';\n\n    const mainImage = candidate.querySelector('[data-ryze-gallery-main]');\n    const thumbs = Array.from(candidate.querySelectorAll('[data-ryze-gallery-thumb]'));\n    if (!mainImage || !thumbs.length) return;\n\n    const sync = (selectedThumb) => {\n      const nextSrc = selectedThumb.getAttribute('data-image-src');\n      const nextAlt = selectedThumb.getAttribute('data-image-alt');\n      if (nextSrc) {\n        mainImage.setAttribute('src', nextSrc);\n      }\n      if (nextAlt) {\n        mainImage.setAttribute('alt', nextAlt);\n      }\n\n      thumbs.forEach((thumb) => {\n        const isActive = thumb === selectedThumb;\n        thumb.classList.toggle('is-active', isActive);\n        thumb.setAttribute('aria-current', isActive ? 'true' : 'false');\n      });\n    };\n\n    thumbs.forEach((thumb) => {\n      thumb.addEventListener('click', () => sync(thumb));\n    });\n  }\n\n  function initFavoritesGrid() {\n    document.querySelectorAll('[data-ryze-random-grid]').forEach((grid) => {\n      const cards = Array.from(grid.querySelectorAll('[data-random-item]'));\n      if (!cards.length) return;\n\n      const visibleCount = Number.parseInt(grid.getAttribute('data-visible-count') || '', 10) || 6;\n      const shuffledCards = shuffle(cards);\n\n      shuffledCards.forEach((card, index) => {\n        grid.appendChild(card);\n        card.hidden = index >= visibleCount;\n      });\n    });\n  }\n\n  function initFeaturePurchaseOptions(lane) {\n    if (lane.dataset.ryzePurchaseOptionsReady === 'true') return;\n    lane.dataset.ryzePurchaseOptionsReady = 'true';\n\n    const candidates = Array.from(lane.querySelectorAll('[data-ryze-feature-candidate]'));\n    if (!candidates.length) return;\n\n    const activateCandidate = (nextHandle) => {\n      const targetCandidate = candidates.find((candidate) => candidate.getAttribute('data-product-handle') === nextHandle);\n      if (!targetCandidate) return;\n\n      for (const candidate of candidates) {\n        const isActive = candidate === targetCandidate;\n        candidate.hidden = !isActive;\n        candidate.classList.toggle('is-active', isActive);\n      }\n\n      const optionInputs = Array.from(targetCandidate.querySelectorAll('[data-ryze-feature-purchase-option]'));\n      for (const input of optionInputs) {\n        const wrapper = input.closest('.gift-feature__purchase-option');\n        const isActive = input.getAttribute('data-target-handle') === nextHandle;\n        input.checked = isActive;\n        if (wrapper) {\n          wrapper.classList.toggle('is-active', isActive);\n        }\n      }\n    };\n\n    for (const candidate of candidates) {\n      const optionInputs = Array.from(candidate.querySelectorAll('[data-ryze-feature-purchase-option]'));\n      for (const option of optionInputs) {\n        option.addEventListener('change', () => {\n          const targetHandle = option.getAttribute('data-target-handle');\n          if (targetHandle) activateCandidate(targetHandle);\n        });\n      }\n    }\n\n    const activeCandidate = candidates.find((candidate) => candidate.classList.contains('is-active')) || candidates[0];\n    const activeHandle = activeCandidate.getAttribute('data-product-handle');\n    if (activeHandle) activateCandidate(activeHandle);\n  }\n\n  function initGiftAddToCart() {\n    document.querySelectorAll('[data-ryze-add-to-cart]').forEach((form) => {\n      form.addEventListener('submit', async (event) => {\n        const button = form.querySelector('button[type=\"submit\"]');\n        const idField = form.querySelector('input[name=\"id\"]');\n        if (!button || !idField) return;\n\n        event.preventDefault();\n\n        const originalText = button.textContent;\n        button.disabled = true;\n        button.textContent = 'ADDING...';\n\n        try {\n          const response = await fetch('/cart/add.js', {\n            method: 'POST',\n            credentials: 'same-origin',\n            headers: {\n              'Content-Type': 'application/json',\n              Accept: 'application/json',\n            },\n            body: JSON.stringify({\n              id: Number(idField.value),\n              quantity: 1,\n            }),\n          });\n\n          if (!response.ok) {\n            throw new Error(`Add to cart failed: ${response.status}`);\n          }\n\n          button.textContent = 'ADDED TO CART';\n          window.setTimeout(() => {\n            button.disabled = false;\n            button.textContent = originalText;\n          }, 1800);\n        } catch (error) {\n          button.disabled = false;\n          button.textContent = originalText;\n          form.submit();\n        }\n      });\n    });\n  }\n\n  function shuffle(items) {\n    const next = items.slice();\n    for (let index = next.length - 1; index > 0; index -= 1) {\n      const randomIndex = Math.floor(Math.random() * (index + 1));\n      const currentValue = next[index];\n      next[index] = next[randomIndex];\n      next[randomIndex] = currentValue;\n    }\n    return next;\n  }\n})();\n"],
  "mappings": "CAAC,IAAM,CACL,MAAM,MAAQ,IAAM,CAClB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,CACpB,EAEI,SAAS,aAAe,UAC1B,SAAS,iBAAiB,mBAAoB,MAAO,CAAE,KAAM,EAAK,CAAC,EAEnE,MAAM,EAGR,SAAS,gBAAiB,CACxB,MAAM,QAAU,MAAM,KAAK,SAAS,iB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