1(()=>{"use strict";const t=window.wp.data;function e(t){if(!t)return null;if("string"==typeof t)try{return JSON.parse(t)}catch(t){return null}return t}function n(t){return Array.isArray(t)?t.map(t=>{const n=t&&t.extensions&&t.extensions.gtm4wp,r=n?e(n.item):null;return r?{key:t.key,quantity:t.quantity,item:r}:null}).filter(Boolean):[]}function r(t,e){const n=Array.isArray(t)?t:[],r=Array.isArray(e)?e:[],o=Object.create(null);n.forEach(t=>{o[t.key]=t});const i=Object.create(null);r.forEach(t=>{i[t.key]=t});const c=[],s=[];return r.forEach(t=>{const e=o[t.key],n=e?e.quantity:0,r=t.quantity-n;r>0&&c.push({item:t.item,quantity:r})}),n.forEach(t=>{const e=i[t.key],n=e?e.quantity:0,r=t.quantity-n;r>0&&s.push({item:t.item,quantity:r})}),{added:c,removed:s}}const o=["woocommerce_items_in_cart","woocommerce_cart_hash"],i="Cross-Sells",c="cross-sells";function s(e){try{return(0,t.select)(e)||null}catch(t){return null}}function u(t,e,n){"function"==typeof window.gtm4wp_push_ecommerce&&window.gtm4wp_push_ecommerce(t,e,n)}function a(t){const e=Object.assign({},t.item,{quantity:t.quantity});return delete e.internal_id,e}function l(t){return t.reduce((t,e)=>t+(parseFloat(e.item.price)||0)*e.quantity,0)}function m(t){return t&&t.totals&&t.totals.currency_code?t.totals.currency_code:"undefined"!=typeof gtm4wp_currency?gtm4wp_currency:void 0}function f(t){const e=Object.assign({},t.item,{item_list_name:i,item_list_id:c});return delete e.internal_id,e}function d(t,e){let i=null,c=!1,s=!1;const f=function(){e()||(c?s=!0:(c=!0,function(){const t="string"==typeof window.gtm4wp_store_api_cart_url?window.gtm4wp_store_api_cart_url:"";return""===t||"function"!=typeof window.fetch?Promise.resolve(null):window.fetch(t,{credentials:"same-origin",headers:{Accept:"application/json"}}).then(function(t){return t&&t.ok?t.json():null}).catch(function(){return null})}().then(function(e){if(c=!1,e){const o=n(e.items);if(null===i)i=o;else{const{added:n,removed:c}=r(i,o);i=o;const s=m(e);t&&n.length&&u("add_to_cart",n.map(a),{currency:s,value:l(n)}),c.length&&u("remove_from_cart",c.map(a),{currency:s,value:l(c)})}}s&&(s=!1,f())})))};window.setTimeout(function(){!e()&&o.some(function(t){return""!==function(t){const e=("; "+document.cookie).split("; "+t+"=");return 2===e.length?e.pop().split(";").shift():""}(t)})&&f()},2e3),window.addEventListener("wc-blocks_store_sync_required",f)}!function(){if(window.gtm4wp_woocommerce_blocks_inited)return;if(window.gtm4wp_woocommerce_blocks_inited=!0,"function"!=typeof t.subscribe)return;const o="string"==typeof window.gtm4wp_blocks_context?window.gtm4wp_blocks_context:"cartcheckout",p="checkout"===o||"cartcheckout"===o,_=p||"cart"===o;let y=null,w=!1,h=!1,g=[],k=!1;var b;_&&(b=()=>g,"undefined"!=typeof document&&document.addEventListener&&document.addEventListener("click",t=>{const e=t.target;if(!e||!e.closest)return;const n=e.closest(".wp-block-woocommerce-cart-cross-sells-block a[href], .wp-block-cart-cross-sells-product a[href]");if(!n)return;const r=n.getAttribute("href"),o=b().find(t=>t.permalink===r);o&&("undefined"!=typeof gtm4wp_list_attribution&>m4wp_list_attribution&&o.id&&"function"==typeof window.gtm4wp_store_item_list_attribution&&window.gtm4wp_store_item_list_attribution(o.id,i,c),u("select_item",[f(o)],{currency:m()}))}));let v=!1;d(_,()=>v),(0,t.subscribe)(()=>{const t=s("wc/store/cart");if(!t||"function"!=typeof t.getCartData)return;if("function"==typeof t.hasFinishedResolution&&!t.hasFinishedResolution("getCartData"))return;const o=t.getCartData();if(!o)return;v=!0;const i=n(o.items),c=m(o);if(null===y)y=i;else{const{added:t,removed:e}=r(y,i);y=i,_&&t.length&&u("add_to_cart",t.map(a),{currency:c,value:l(t)}),e.length&&u("remove_from_cart",e.map(a),{currency:c,value:l(e)})}var d;_&&(d=o.crossSells,g=Array.isArray(d)?d.map(t=>{const n=t&&t.extensions&&t.extensions.gtm4wp,r=n?e(n.item):null;return r?{id:t.id,permalink:t.permalink,item:r}:null}).filter(Boolean):[],!k&&g.length&&(k=!0,u("view_item_list",g.map(f),{currency:c})));const b=s("wc/store/payment");if(!p||!b||!i.length)return;const q=l(i);if(!w){const t=function(t){const e=t&&t.shippingRates||[];for(let t=0;t<e.length;t++){const n=e[t]&&e[t].shipping_rates||[];for(let t=0;t<n.length;t++)if(n[t]&&n[t].selected)return n[t].name||""}return""}(o);t&&(w=!0,u("add_shipping_info",i.map(a),{currency:c,shipping_tier:t,value:q}))}if(!h&&"function"==typeof b.getActivePaymentMethod){const t=b.getActivePaymentMethod();t&&(h=!0,u("add_payment_info",i.map(a),{currency:c,payment_type:t,value:q}))}})}()})();
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.