{
  "version": 3,
  "sources": ["/cdn/shop/t/27/assets/prolean-benefits-card-v2.js?cb=1784901215986"],
  "sourcesContent": ["/** Prolean dynamic product benefits card. */\n(() => {\n  'use strict';\n  if (window.__proleanBenefitsCard) return;\n  window.__proleanBenefitsCard = true;\n\n  const HOST = '.prolean-purchase-reassurance';\n  const OPTIONS = '.shopify_subscriptions_app_block_purchase_options';\n  const LABEL = '.shopify_subscriptions_app_block_label';\n  const cards = new WeakMap();\n  const clean = (v) => String(v || '').replace(/\\s+/g, ' ').trim();\n  const number = (v) => {\n    const s = clean(v).replace(/[^0-9.,-]/g, '');\n    if (!s) return 0;\n    const n = s.lastIndexOf(',') > s.lastIndexOf('.')\n      ? parseFloat(s.replace(/\\./g, '').replace(',', '.'))\n      : parseFloat(s.replace(/,/g, ''));\n    return Number.isFinite(n) ? n : 0;\n  };\n  const sectionFor = (n) => n.closest('product-info') || n.closest('.shopify-section');\n  const setText = (el, text) => { if (el && el.textContent !== text) el.textContent = text; };\n\n  function optionData(section) {\n    const options = section.querySelector(OPTIONS);\n    // Selection is authoritative via the .prolean-selected class (the app can\n    // leave One-time's radio :checked even when a subscription is chosen).\n    const label = options?.querySelector(LABEL + '.prolean-selected')\n      || options?.querySelector('input[type=\"radio\"]:checked')?.closest(LABEL)\n      || options?.querySelector(LABEL);\n    const oneTime = !label || !!label.querySelector('input[data-radio-type=\"one_time_purchase\"]');\n    let script = label?.querySelector('script');\n    if (!script && label?.nextElementSibling?.tagName === 'SCRIPT') script = label.nextElementSibling;\n    let price = 0;\n    let compare = 0;\n    try {\n      const data = JSON.parse(script?.textContent || '{}');\n      price = number(data.price);\n      compare = number(data.comparedAtPrice);\n    } catch (_) {}\n    if (!price) {\n      const root = section.querySelector('[id^=\"price-\"] .price, .product__info-container .price');\n      const sale = root?.classList.contains('price--on-sale');\n      const el = sale\n        ? root.querySelector('.price__sale .price-item--sale, .price__sale .price-item--last')\n        : root?.querySelector('.price__regular .price-item--regular');\n      price = number(el?.textContent || root?.textContent);\n    }\n    if (!compare) compare = price;\n    const discount = !oneTime && compare > price ? Math.round((compare - price) / compare * 100) : 0;\n    return { oneTime, price, discount };\n  }\n\n  function quantity(section) {\n    const input = section.querySelector('quantity-input input[name=\"quantity\"], input[name=\"quantity\"]');\n    const n = parseInt(input?.value || '1', 10);\n    return n > 0 ? n : 1;\n  }\n\n  function currency(value) {\n    try {\n      return new Intl.NumberFormat(document.documentElement.lang || 'en-US', {\n        style: 'currency', currency: window.Shopify?.currency?.active || 'USD'\n      }).format(value);\n    } catch (_) { return `$${value.toFixed(2)}`; }\n  }\n\n  const row = (icon, html, cls = '') =>\n    `<span class=\"prolean-benefits__row ${cls}\"><span class=\"prolean-benefits__icon\" aria-hidden=\"true\">${icon}</span><span>${html}</span></span>`;\n\n  function cardHtml() {\n    return `<span class=\"prolean-benefits__head\"><strong data-pb-title>Your Prolean Benefits</strong><span aria-hidden=\"true\">\u203A</span></span>\n      <span data-pb-sub hidden>\n        ${row('\u2726', '<strong>Extra 15% off</strong> your first qualifying subscription order', 'is-bonus')}\n        ${row('\u21BB', '<strong data-pb-saving>Subscription savings</strong> on recurring shipments')}\n      </span>\n      <span class=\"prolean-benefits__rows\">\n        ${row('\u2605', '<strong data-pb-points>Earn Prolean Rewards</strong><span data-pb-value></span><small class=\"prolean-benefits__fine\" data-pb-fine style=\"display:none;margin-top:.3rem;font-size:1.05rem;line-height:1.35;font-weight:400;color:rgba(var(--color-foreground),.6)\"></small>')}\n        ${row('\u2192', '<strong>Free Economy shipping</strong> on qualifying U.S. orders $50+')}\n        ${row('\u2713', '<strong>Secure checkout</strong> powered by Shopify')}\n      </span>\n      <span class=\"prolean-benefits__more\">View rewards, subscription savings, and benefits \u2192</span>`;\n  }\n\n  function modalHtml(id) {\n    return `<dialog class=\"prolean-benefits-modal\" id=\"${id}\" aria-labelledby=\"${id}-title\">\n      <div class=\"prolean-benefits-modal__panel\">\n        <header><div><small>PROLEAN WELLNESS</small><h2 id=\"${id}-title\">Purchase Benefits</h2></div><button type=\"button\" data-pb-close aria-label=\"Close\">\u00D7</button></header>\n        <div class=\"prolean-benefits-modal__body\">\n          <section><b aria-hidden=\"true\">\u2605</b><div><h3>Rewards on every eligible purchase</h3><p>Earn 10 Prolean Rewards points for every $1 spent\u2014approximately 10% back in rewards.</p><p class=\"is-estimate\" data-pb-estimate></p><p class=\"is-fine\">Final points are based on the eligible amount paid after discounts and adjustments. Taxes, shipping, refunds, and canceled items do not earn rewards.</p></div></section>\n          <section><b aria-hidden=\"true\">\u2726</b><div><h3>Subscribe &amp; Save</h3><p>New subscribers receive an extra 15% off their first qualifying subscription order, in addition to the selected recurring subscription savings.</p><p data-pb-subtext></p><p>Subscribers continue earning rewards on the eligible amount actually paid.</p></div></section>\n          <section><b aria-hidden=\"true\">\u21BB</b><div><h3>Flexible delivery</h3><p>Eligible subscriptions may be skipped, paused, changed, or canceled according to the subscription terms.</p></div></section>\n          <section><b aria-hidden=\"true\">\u2192</b><div><h3>Shipping</h3><p>Free Economy shipping is available on qualifying U.S. orders of $50 or more after applicable discounts. Eligibility is confirmed at checkout.</p></div></section>\n          <section><b aria-hidden=\"true\">\u2713</b><div><h3>Secure checkout</h3><p>Payments and checkout are securely processed through Shopify.</p></div></section>\n        </div>\n        <footer><button type=\"button\" class=\"button button--primary\" data-pb-close>Continue shopping</button></footer>\n      </div>\n    </dialog>`;\n  }\n\n  function update(c) {\n    if (!c.wrap.isConnected) return;\n    const state = optionData(c.section);\n    const qty = quantity(c.section);\n    const points = Math.max(0, Math.round(state.price * qty * 10));\n    const value = currency(points / 100);\n    const sub = c.card.querySelector('[data-pb-sub]');\n    setText(c.card.querySelector('[data-pb-title]'), state.oneTime ? 'Your Prolean Benefits' : 'Your Subscriber Benefits');\n    if (sub.hidden === !state.oneTime) sub.hidden = state.oneTime;\n    c.card.classList.toggle('is-subscription', !state.oneTime);\n    setText(c.card.querySelector('[data-pb-saving]'), state.discount ? `Save ${state.discount}%` : 'Subscription savings');\n\n    // Rewards estimate. One-time: exact. Subscription: the storefront cannot know\n    // whether the buyer qualifies as a first-time subscriber (extra 15% off the\n    // first order) before checkout, so show a non-numeric, always-true message.\n    const pointsEl = c.card.querySelector('[data-pb-points]');\n    const valueEl = c.card.querySelector('[data-pb-value]');\n    const fineEl = c.card.querySelector('[data-pb-fine]');\n    if (state.oneTime) {\n      setText(pointsEl, `Earn approximately ${points.toLocaleString()} Prolean Rewards points`);\n      setText(valueEl, ` \u2014 a ${value} value${qty > 1 ? ` for ${qty} items` : ''}`);\n      if (fineEl) fineEl.style.display = 'none';\n    } else {\n      setText(pointsEl, 'Earn Prolean Rewards on this order');\n      setText(valueEl, '');\n      if (fineEl) {\n        setText(fineEl, 'Final points are calculated from the amount paid after subscription and promotional discounts.');\n        fineEl.style.display = 'block';\n      }\n    }\n\n    setText(c.modal.querySelector('[data-pb-estimate]'), state.oneTime\n      ? `This selection is estimated to earn approximately ${points.toLocaleString()} points, a ${value} rewards value.`\n      : `Recurring shipments are estimated to earn approximately ${points.toLocaleString()} points (${value} value) based on the subscription price. Your first order applies the extra first-order discount, so final points are calculated from the amount actually paid.`);\n    setText(c.modal.querySelector('[data-pb-subtext]'), state.discount\n      ? `Your selected subscription saves ${state.discount}% on recurring shipments. The extra 15% applies to the first qualifying subscription order.`\n      : 'Choose a subscription option to see its recurring savings. The extra 15% applies to the first qualifying subscription order.');\n  }\n\n  function schedule(c) {\n    if (c.pending) return;\n    c.pending = true;\n    requestAnimationFrame(() => { c.pending = false; update(c); });\n  }\n\n  function enhance(host) {\n    const section = sectionFor(host);\n    if (!section) return;\n    const id = `ProleanBenefits-${clean(section.dataset.section || section.id || Math.random().toString(36).slice(2)).replace(/[^\\w-]/g, '')}`;\n    const wrap = document.createElement('div');\n    wrap.className = 'prolean-benefits-wrap';\n    wrap.innerHTML = `<button type=\"button\" class=\"prolean-benefits-card\" aria-haspopup=\"dialog\" aria-controls=\"${id}\">${cardHtml()}</button>${modalHtml(id)}`;\n    host.replaceWith(wrap);\n    const card = wrap.querySelector('.prolean-benefits-card');\n    const modal = wrap.querySelector('.prolean-benefits-modal');\n    const c = { section, wrap, card, modal, pending: false };\n    cards.set(wrap, c);\n    let opener;\n    const close = () => modal.open && modal.close ? modal.close() : modal.removeAttribute('open');\n    card.addEventListener('click', () => {\n      opener = document.activeElement;\n      modal.showModal ? modal.showModal() : modal.setAttribute('open', '');\n    });\n    modal.querySelectorAll('[data-pb-close]').forEach((b) => b.addEventListener('click', close));\n    modal.addEventListener('click', (e) => { if (e.target === modal) close(); });\n    modal.addEventListener('close', () => opener?.focus?.({ preventScroll: true }));\n    section.addEventListener('change', () => schedule(c), true);\n    section.addEventListener('input', () => schedule(c), true);\n    section.addEventListener('click', () => setTimeout(() => schedule(c), 50), true);\n    new MutationObserver(() => schedule(c)).observe(section, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: ['class'] });\n    update(c);\n    [80, 300, 900].forEach((ms) => setTimeout(() => schedule(c), ms));\n  }\n\n  function init(root = document) {\n    root.querySelectorAll?.(HOST).forEach(enhance);\n    document.querySelectorAll('.prolean-benefits-wrap').forEach((w) => { const c = cards.get(w); if (c) schedule(c); });\n  }\n\n  let pending = false;\n  const page = new MutationObserver((records) => {\n    if (pending || !records.some((r) => r.addedNodes.length)) return;\n    pending = true;\n    requestAnimationFrame(() => { pending = false; init(); });\n  });\n  const start = () => { init(); page.observe(document.body, { childList: true, subtree: true }); };\n  document.addEventListener('shopify:section:load', (e) => init(e.target));\n  document.readyState === 'loading' ? document.addEventListener('DOMContentLoaded', start, { once: true }) : start();\n})();\n"],
  "mappings": "CACC,IAAM,CACL,aACA,GAAI,OAAO,sBAAuB,OAClC,OAAO,sBAAwB,GAE/B,MAAM,KAAO,gCACP,QAAU,oDACV,MAAQ,yCACR,MAAQ,IAAI,QACZ,MAAS,GAAM,OAAO,GAAK,EAAE,EAAE,QAAQ,OAAQ,GAAG,EAAE,KAAK,EACzD,OAAU,GAAM,CACpB,MAAM,EAAI,MAAM,CAAC,EAAE,Q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