!function(){function t(){return window.wp?.data?.select?.("wc/store/cart")?.getCartTotals?.()}function e(){const e=document.querySelectorAll(".mfn-free-delivery-info[data-threshold]");if(!e.length)return;const n=t(),r=n.total_items,o=r+n.total_items_tax;console.log({totals:n,ex_tax:r,incl_tax:o}),n&&e.forEach(t=>function(t,e){var n;const r=Number(t.dataset.threshold||0);if(!r||!e)return;const o=null!==(n=e.currency_minor_unit)&&void 0!==n?n:2,i=((t,e=2)=>Number(t||"0")/Math.pow(10,e))(e.total_items,o),a=Math.max(0,r-i),s=0===a;t.classList.toggle("mfn-free-delivery-achieved",s);const c=s?100:Math.max(0,Math.min(100,i/r*100)),l=t.querySelector(".mfn-free-delivery-info-progressbar span");l&&(l.style.width=`${c}%`);const d=t.querySelector(".mfn-free-delivery-info-desc strong .mfn-free-delivery-missing-amount");d&&(d.textContent=s?"":function(t,e){var n;const r=null!==(n=e?.currency_minor_unit)&&void 0!==n?n:2;return t.toFixed(r)}(a,e))}(t,n))}document.addEventListener("DOMContentLoaded",()=>{if(!window.wp?.data?.select?.("wc/store/cart"))return;e();let n="";window.wp.data.subscribe(()=>{const r=t(),o=r?JSON.stringify(r):"";o&&o!==n&&(n=o,e())})})}();