PageSourceSearch

https://anthemsnacks.com/cdn/shop/t/13/assets/recharge-cart-drawer-custom.js?v=6893007745937003371760996949

js anthemsnacks.com collected 2026-10-05 19:27:21 UTC 5,559 bytes, 2 lines download raw bytes

1(function(){var ONE_PACK_SUFFIX=/1-Pack\s*$/,MIN_REQUIRED=3,TOAST_MS=3500;function debounce(fn,wait){let t;return function(){clearTimeout(t),t=setTimeout(fn,wait)}}function showToast(msg){try{var id="onepack-toast",t=document.getElementById(id)||document.createElement("div");t.id=id,t.textContent=msg,t.setAttribute("role","status"),t.style.cssText="position:fixed;z-index:99999;left:50%;transform:translateX(-50%);bottom:24px;background:#111;color:#fff;padding:10px 14px;border-radius:8px;font-size:14px;max-width:90%;",document.body.appendChild(t),setTimeout(function(){t&&t.parentNode&&t.parentNode.removeChild(t)},TOAST_MS)}catch{}}function enforceOnePackMin(){fetch("/cart.js",{credentials:"same-origin"}).then(function(r){return r.json()}).then(function(cart){if(!(!cart||!cart.items)){var onePackItems=cart.items.filter(function(it){return ONE_PACK_SUFFIX.test(it.product_title||"")||ONE_PACK_SUFFIX.test(it.title||"")});if(onePackItems.length!==0){var onePackQty=onePackItems.reduce(function(sum,it){return sum+(it.quantity||0)},0);if(onePackQty>0&&onePackQty<MIN_REQUIRED){var updates={};return onePackItems.forEach(function(it){updates[it.key]=0}),fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({updates})}).then(function(){showToast("Single \u201C1-Pack\u201D items must be purchased in quantities of "+MIN_REQUIRED+"+ as part of a bundle. We removed the remaining 1-Pack item(s)."),document.dispatchEvent(new CustomEvent("onepack:cleaned"))})}}}}).catch(function(){})}var run=debounce(enforceOnePackMin,150);document.addEventListener("DOMContentLoaded",run);var _fetch=window.fetch;window.fetch=function(){var args=Array.prototype.slice.call(arguments),url=args[0]&&args[0].toString()||"",p=_fetch.apply(this,args);return/(\/cart\/add\.js|\/cart\/change\.js|\/cart\/update\.js|\/cart\.add|\/cart\.change|\/cart\.update)/.test(url)&&p.then(function(){run()}).catch(function(){}),p},["cart:updated","cart:update","cart:refresh","cart-drawer:updated","cart-drawer:afterUpdate"].forEach(function(evt){document.addEventListener(evt,run)});var obsTarget=document.getElementById("CartDrawer")||document.body;if(window.MutationObserver&&obsTarget){var mo=new MutationObserver(debounce(function(){run()},200));mo.observe(obsTarget,{childList:!0,subtree:!0})}})(),((document2,window2)=>{const govxConfig={drawerRoot:"#recharge-storefront-experiences__cart-drawer",widgetId:"govx-in-recharge",verificationUrl:"https://auth.govx.com/shopify/verify?shop=anthem-snacks.myshopify.com&utm_source=shopify&utm_medium=govxid&utm_campaign=custom_link",logoUrl:"https://i4.govx.net/images/cdn/govxid-new-logo-shopify-iapp-icon.jpg"};let drawerObserver,debounceTimer,attemptCount=0;const createDebounceFunction=(func,delayMs)=>(...args)=>(clearTimeout(debounceTimer),debounceTimer=setTimeout(()=>func(...args),delayMs)),govxWidgetHtml=`<div style="width:100%;padding:20px 0"><div style="display:flex;justify-content:center"><a href="#" onclick="open('${govxConfig.verificationUrl}','govx','width=400,height=600');return false" style="display:flex;width:100%;border:1px solid #eee;color:#333;background:#fff;padding:10px;text-decoration:none;border-radius:5px;align-items:center"><img src="${govxConfig.logoUrl}" style="width:50px;height:50px;flex-shrink:0"><div style="padding-left:15px"><p style="color:#333;line-height:16px;font-size:14px;margin:0;font-family:sans-serif">Exclusive discount for Military, First Responders, Medical Workers and Teachers</p></div></a></div></div>`,addGovxWidgetToDrawer=()=>{const shadowRoot=document2.querySelector(govxConfig.drawerRoot)?.shadowRoot;if(!shadowRoot)return!1;if(shadowRoot.querySelector(`#${govxConfig.widgetId},[data-govx-id],a[href*="auth.govx.com"]`))return!0;const checkoutButton=shadowRoot.querySelector('button[data-slot="button"][name="checkout"]');if(!checkoutButton)return!1;const govxWidget=document2.createElement("div");return govxWidget.id=govxConfig.widgetId,govxWidget.setAttribute("data-govx-id","s"),govxWidget.innerHTML=govxWidgetHtml,checkoutButton.insertAdjacentElement("afterend",govxWidget),!0},retryAddingWidget=()=>{addGovxWidgetToDrawer()||++attemptCount>
120||setTimeout(retryAddingWidget,500+attemptCount*50)},setupDrawerObserver=createDebounceFunction(()=>{const drawerElement=document2.querySelector(govxConfig.drawerRoot);if(!drawerElement?.shadowRoot)return setTimeout(setupDrawerObserver,1e3);drawerObserver?.disconnect(),drawerObserver=new MutationObserver(createDebounceFunction(retryAddingWidget,300)),drawerObserver.observe(drawerElement.shadowRoot,{childList:!0,subtree:!0})},100),setupEventListeners=()=>{["recharge:cart:opened","recharge:drawer:opened"].forEach(eventName=>document2.addEventListener(eventName,()=>setTimeout(retryAddingWidget,100),{passive:!0})),["recharge:cart:updated","recharge:drawer:updated","recharge:cart:changed","recharge:drawer:rendered","recharge:drawer:loaded"].forEach(eventName=>document2.addEventListener(eventName,()=>setTimeout(retryAddingWidget,200),{passive:!0}))},initializeGovxWidget=()=>{document2.readyState==="loading"?document2.addEventListener("DOMContentLoaded",retryAddingWidget):retryAddingWidget(),setupEventListeners(),setTimeout(setupDrawerObserver,2e3)},cleanupOnPageUnload=()=>{drawerObserver?.disconnect(),clearTimeout(debounceTimer)};window2.addEventListener("beforeunload",cleanupOnPageUnload),initializeGovxWidget()})(document,window);
2//# sourceMappingURL=/cdn/shop/t/13/assets/recharge-cart-drawer-custom.js.map?v=6893007745937003371760996949

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.