{
  "version": 3,
  "sources": ["/cdn/shop/t/95/assets/lazy-reviews.js?cb=20261119"],
  "sourcesContent": ["/**\n * Mounts the Judge.me review widget when the shopper nears it.\n *\n * Markup contract (snippets/reviews-lazy.liquid):\n *   <div id=\"judgeme_product_reviews\" data-lazy-reviews\n *        data-lazy-class=\"jdgm-widget jdgm-review-widget\"\n *        data-lazy-entry-point=\"review_widget.js\" ...>\n *\n * Judge.me's loader.js runs once at load and only looks for\n * `.jdgm-widget[data-entry-point]`. With the class and the entry point held in\n * data attributes it finds nothing and loads nothing. To mount, this script\n * restores both and runs the loader again (its guard `jdgm._loaderExecuted`\n * is reset first); Judge.me then loads and renders the widget as it always did.\n *\n * Triggers: the widget comes within NEAR_VIEWPORT_MARGIN of the viewport, a\n * click on a link to #judgeme_product_reviews, or the page opening on that hash.\n *\n * Relies on Judge.me's loader behavior above; if Judge.me changes it and the\n * widget stops mounting, remove the data-lazy-* attributes in the snippet.\n */\n(() => {\n  const WIDGET_SELECTOR = '[data-lazy-reviews]';\n  const ANCHOR_HASH = '#judgeme_product_reviews';\n  // Mounting takes a second or two on a phone: start well before the widget is on screen.\n  const NEAR_VIEWPORT_MARGIN = '800px';\n\n  const isMounted = (widget) => widget.dataset.lazyReviewsMounted === 'true';\n\n  const findJudgemeLoader = () => [...document.scripts].find((script) => /judgeme/.test(script.src) && /\\/loader\\.js/.test(script.src));\n\n  const restoreWidgetAttributes = (widget) => {\n    widget.className = widget.dataset.lazyClass;\n    widget.setAttribute('data-entry-point', widget.dataset.lazyEntryPoint);\n    ['data-lazy-class', 'data-lazy-entry-point'].forEach((name) => widget.removeAttribute(name));\n  };\n\n  const loaderAlreadyRan = () => Boolean(window.jdgm && window.jdgm._loaderExecuted);\n\n  const runJudgemeLoaderAgain = (loader) => {\n    window.jdgm._loaderExecuted = false;\n    const again = document.createElement('script');\n    again.src = loader.src;\n    document.head.appendChild(again);\n  };\n\n  const mount = (widget) => {\n    if (isMounted(widget)) return;\n    widget.dataset.lazyReviewsMounted = 'true';\n    restoreWidgetAttributes(widget);\n\n    // Loader not run yet (the page opened on the anchor): it will find the widget on its own.\n    if (!loaderAlreadyRan()) return;\n\n    const loader = findJudgemeLoader();\n    if (loader) runJudgemeLoaderAgain(loader);\n    else console.warn('[lazy-reviews] Judge.me loader not found; the widget cannot mount.');\n  };\n\n  const mountAll = () => document.querySelectorAll(WIDGET_SELECTOR).forEach(mount);\n\n  const mountWhenNear = (widgets) => {\n    const observer = new IntersectionObserver((entries) => {\n      entries.forEach(({ target, isIntersecting }) => {\n        if (!isIntersecting) return;\n        observer.unobserve(target);\n        mount(target);\n      });\n    }, { rootMargin: NEAR_VIEWPORT_MARGIN });\n    widgets.forEach((widget) => observer.observe(widget));\n  };\n\n  const mountOnAnchorClick = () => {\n    document.addEventListener('click', (event) => {\n      if (event.target.closest(`a[href$=\"${ANCHOR_HASH}\"]`)) mountAll();\n    });\n  };\n\n  const init = () => {\n    const widgets = [...document.querySelectorAll(WIDGET_SELECTOR)].filter((widget) => !isMounted(widget));\n    if (!widgets.length) return;\n\n    mountOnAnchorClick();\n    if (window.location.hash === ANCHOR_HASH || !('IntersectionObserver' in window)) mountAll();\n    else mountWhenNear(widgets);\n  };\n\n  init();\n})();\n"],
  "mappings": "CAoBC,IAAM,CACL,MAAM,gBAAkB,sBAClB,YAAc,2BAEd,qBAAuB,QAEvB,UAAa,QAAW,OAAO,QAAQ,qBAAuB,OAE9D,kBAAoB,IAAM,CAAC,GAAG,SAAS,OAAO,EAAE,KAAM,QAAW,UAAU,KAAK,OAAO,GAAG,GAAK,eAAe,KAAK,OAAO,GAAG,CAAC,EAE9H,wBAA2B,QAAW,CAC1C,OAAO,UAAY,OAAO,QAAQ,UAClC,OAAO,aAAa,mBAAoB,OAAO,QAAQ,cAAc,EACrE,CAAC,kBAAmB,uBAAuB,EAAE,QAAS,MAAS,OAAO,gBAAgB,IAAI,CAAC,CAC7F,EAEM,iBAAmB,IAAM,GAAQ,OAAO,MAAQ,OAAO,KAAK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