(()=>{var t={};t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),(e=>{if(!e)return;const{currency:o,products:n,purchase:i,add_to_cart:r,eventsToTrack:a}=t.g._googlesitekit?.wcdata||{},c=a?.includes("add_to_cart"),s=a?.includes("purchase");if(r&&c){const{price:e}=r,n=u(e,o,r);t.g._googlesitekit?.gtagEvent?.("add_to_cart",n)}if(i&&s){const{id:e,totals:o,items:n,user_data:r}=i,a=u(o.total_price,o.currency_code,n,e,o.shipping_total,o.tax_total);t.g._googlesitekit?.gtagUserData&&r&&(a.user_data=r),t.g._googlesitekit?.gtagEvent?.("purchase",a)}const d=e("body");function u(t,e,o){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;const a={value:l(t),currency:e,items:[]};if(n&&(a.transaction_id=n),"number"==typeof i&&(a.shipping=i),"number"==typeof r&&(a.tax=r),o&&o.length)for(const t of o)a.items.push(g(t));else o&&o.id&&(a.items=[g(o)]);return a}function g(t){const{id:e,name:o,price:n,variation:i,quantity:r,categories:a}=t,c={item_id:e,item_name:o,price:l(n)};if(r&&(c.quantity=r),i&&(c.item_variant=i),a&&a?.length){let t=1;for(const e of a)c[t>1?`item_category${t}`:"item_category"]=e.name,t++}return c}function l(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return parseInt(t,10)/10**e}c&&(d.on("added_to_cart",(e,i,r,a)=>{if(!a?.jquery)return;const c=parseInt(a.data("product_id"),10);if(!c)return;const s=n?.find(t=>t?.id===c)||{},{price:d}=s,g=u(d,o,s);t.g._googlesitekit?.gtagEvent?.("add_to_cart",g)}),e(".products-block-post-template .product, .wc-block-product-template .product").each(function(){const i=e(this),r=parseInt(i.find("[data-product_id]").attr("data-product_id"),10);r&&i.on("click",i=>{const a=e(i.target).closest(".wc-block-components-product-button [data-product_id]");if(!a.length||!a.hasClass("add_to_cart_button")||a.hasClass("product_type_variable"))return;const c=n?.find(t=>t?.id===r)||{},{price:s}=c,d=u(s,o,c);t.g._googlesitekit?.gtagEvent?.("add_to_cart",d)})}))})(t.g.jQuery)})();