{
  "version": 3,
  "sources": ["/cdn/shop/t/36/assets/mn-quickadd.js?cb=1790757931071"],
  "sourcesContent": ["// MN Quick Add (global) \u2014 AJAX add-to-cart\n(function () {\n  function closestForm(target) {\n    return target.closest('.mn-mncard__form, .mn-mncard__variantForm');\n  }\n\n  async function addToCart(form) {\n    const fd = new FormData(form);\n    const res = await fetch('/cart/add.js', {\n      method: 'POST',\n      body: fd,\n      headers: { 'X-Requested-With': 'XMLHttpRequest' },\n      credentials: 'same-origin'\n    });\n    if (!res.ok) throw new Error('Add to cart failed');\n    return res.json();\n  }\n\n  async function refreshCartCount() {\n    try {\n      const r = await fetch('/cart.js', { credentials: 'same-origin' });\n      const cart = await r.json();\n      document.querySelectorAll('.cart-count-bubble, [data-cart-count]').forEach(el => {\n        el.textContent = cart.item_count;\n      });\n    } catch (e) {}\n  }\n\n  document.addEventListener('submit', async (e) => {\n    const form = closestForm(e.target);\n    if (!form) return;\n\n    // \u2705 STOP normal submit + STOP other JS listeners (prevents double add)\n    e.preventDefault();\n    e.stopPropagation();\n    if (e.stopImmediatePropagation) e.stopImmediatePropagation();\n\n    // \u2705 LOCK so it can\u2019t fire twice (double click or duplicate listeners)\n    if (form.dataset.mnAdding === '1') return;\n    form.dataset.mnAdding = '1';\n\n    const btn = form.querySelector('button[type=\"submit\"]');\n    const prevText = btn ? btn.textContent : null;\n\n    try {\n      if (btn) {\n        btn.disabled = true;\n        btn.textContent = 'ADDING...';\n      }\n\n      await addToCart(form);\n      refreshCartCount();\n\n      if (btn) btn.textContent = 'ADDED \u2713';\n      setTimeout(() => {\n        if (btn) {\n          btn.disabled = false;\n          btn.textContent = prevText || 'QUICK ADD +';\n        }\n      }, 900);\n\n    } catch (err) {\n      console.error(err);\n      if (btn) {\n        btn.disabled = false;\n        btn.textContent = prevText || 'QUICK ADD +';\n      }\n    } finally {\n      // \u2705 UNLOCK\n      form.dataset.mnAdding = '0';\n    }\n  }, true);\n})();\n\n/* ---------------------------------------------------------------------------\n   SUBSCRIPTION BADGE FIX \u2014 added 30 Sep 2026\n\n   Symptom: on a supplement PDP, for a variant that has a subscription, the\n   SUBSCRIPTION badge sits under the price while \"One-time purchase\" is still\n   ticked \u2014 and it disappears when \"Subscribe\" IS ticked. It only misbehaves\n   when the variant is discounted, which is what made it look intermittent.\n\n   Cause: the Shopify Subscriptions app renders its badge as\n\n     class=\"badge price__badge-sale uppercase color-scheme-5 price__badge--subscription\"\n     style=\"display: inline-block !important\"\n\n   That price__badge-sale class is the same one the \"Save 20%\" badge uses, and\n   the badge logic in sections/mn-pdp-redesign-styles.liquid keys off it:\n\n     \u2022 mnBadgeLooksLikeSubscription() early-returns false for anything carrying\n       price__badge-sale, so it never recognises its own subscription badge;\n     \u2022 the pass that should hide the badge skips it for that same reason;\n     \u2022 the final `.price__badge-sale` pass then sets\n         display: oneTimeOnSale ? 'inline-block' : 'none'\n       which forces the badge visible on any discounted variant, whichever\n       purchase option is selected \u2014 and hides it when Subscribe is chosen.\n\n   Off sale, oneTimeOnSale is false, so that last pass happens to hide it and\n   everything looks correct. Hence \"only during sales\".\n\n   Fix: strip the misleading price__badge-sale class from the subscription\n   badge. It contributes no styling of its own here (the pill comes from\n   .badge + the colour scheme \u2014 verified: zero computed-style difference), so\n   removing it is visually inert. With the class gone, the section's existing\n   logic classifies the badge correctly and shows/hides it in step with the\n   radio, using its own rules. Nothing else is overridden.\n\n   The inline display is also cleared so the stylesheet's \"hidden unless\n   data-mn-purchase-mode=subscribe\" rule governs in the gap before the\n   section's next pass \u2014 hidden is the safe direction.\n\n   Deliberately guarded: it only acts while the class is still present, so it\n   cannot ping-pong with the section's own MutationObserver (which watches\n   class and style on the same nodes).\n\n   NOTE: this is a targeted patch in an already-loaded asset. The tidier home\n   is the three class checks inside mn-pdp-redesign-styles.liquid itself \u2014\n   worth folding in next time that section is edited properly via CLI/git.\n   --------------------------------------------------------------------------- */\n(function () {\n  var SUB_CLASS = 'price__badge--subscription';\n  var SALE_CLASS = 'price__badge-sale';\n  var queued = false;\n\n  function declash() {\n    queued = false;\n    var badges = document.querySelectorAll('.' + SUB_CLASS);\n    for (var i = 0; i < badges.length; i++) {\n      var badge = badges[i];\n      // already cleaned \u2014 do nothing, so we never mutate in response to our\n      // own (or the section's) changes\n      if (!badge.classList.contains(SALE_CLASS)) continue;\n      badge.classList.remove(SALE_CLASS);\n      badge.style.removeProperty('display');\n    }\n  }\n\n  function queue() {\n    if (queued) return;\n    queued = true;\n    requestAnimationFrame(declash);\n  }\n\n  function start() {\n    declash();\n\n    var scope =\n      document.querySelector('.product__info-wrapper') ||\n      document.querySelector('.product__info-container') ||\n      document.body;\n    if (!scope) return;\n\n    new MutationObserver(queue).observe(scope, {\n      childList: true,\n      subtree: true,\n      attributes: true,\n      attributeFilter: ['class', 'style']\n    });\n\n    // the app re-injects the badge on variant change and after its own\n    // async passes; these catch anything the observer misses on first paint\n    [100, 400, 1000, 2500, 6000].forEach(function (ms) {\n      setTimeout(declash, ms);\n    });\n  }\n\n  if (document.readyState === 'loading') {\n    document.addEventListener('DOMContentLoaded', start);\n  } else {\n    start();\n  }\n})();\n"],
  "mappings": "CACC,UAAY,CACX,SAAS,YAAY,OAAQ,CAC3B,OAAO,OAAO,QAAQ,2CAA2C,CACnE,CAEA,eAAe,UAAU,KAAM,CAC7B,MAAM,GAAK,IAAI,SAAS,IAAI,EACtB,IAAM,MAAM,MAAM,eAAgB,CACtC,OAAQ,OACR,KAAM,GACN,QAAS,CAAE,mBAAoB,gBAAiB,EAChD,YAAa,aACf,CAAC,EACD,GAAI,CAAC,IAAI,GAAI,MAAM,IAAI,MAAM,oBAAoB,EACjD,OAAO,IAAI,KAAK,CAClB,CAEA,eAAe,kBAAmB,CAChC,GAAI,CAEF,MAAM,KAAO,MADH,MAAM,MAAM,WAAY,CAAE,YAAa,aAAc,CAAC,GAC3C,KAAK,EAC1B,SAAS,iBAAiB,uCAAuC,EAAE,QAAQ,IAAM,CAC/E,GAAG,YAAc,KAAK,UACxB,CAAC,CACH,MAAY,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