((t,o)=>{if(!t)return;const l=(null===(o=globalThis._googlesitekit)||void 0===o?void 0:o.wcdata)||{},i=l.currency,e=l.products,n=l.purchase,a=l.add_to_cart,c=l.eventsToTrack,r=null==c?void 0:c.includes("add_to_cart"),d=null==c?void 0:c.includes("purchase");if(a&&r){var u,s;const t=h(a.price,i,a);null===(u=globalThis._googlesitekit)||void 0===u||null===(s=u.gtagEvent)||void 0===s||s.call(u,"add_to_cart",t)}if(n&&d){var g,_,p;const t=n.id,o=n.totals,l=n.items,i=n.user_data,e=h(o.total_price,o.currency_code,l,t,o.shipping_total,o.tax_total);null!==(g=globalThis._googlesitekit)&&void 0!==g&&g.gtagUserData&&i&&(e.user_data=i),null===(_=globalThis._googlesitekit)||void 0===_||null===(p=_.gtagEvent)||void 0===p||p.call(_,"purchase",e)}const v=t("body");function h(t,o,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,e=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;const a={value:m(t),currency:o,items:[]};if(i&&(a.transaction_id=i),"number"==typeof e&&(a.shipping=e),"number"==typeof n&&(a.tax=n),l&&l.length)for(const t of l)a.items.push(f(t));else l&&l.id&&(a.items=[f(l)]);return a}function f(t){const o=t.id,l=t.name,i=t.price,e=t.variation,n=t.quantity,a=t.categories,c={item_id:o,item_name:l,price:m(i)};if(n&&(c.quantity=n),e&&(c.item_variant=e),a&&null!=a&&a.length){let t=1;for(const o of a)c[t>1?"item_category".concat(t):"item_category"]=o.name,t++}return c}function m(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return parseInt(t,10)/10**o}r&&(v.on("added_to_cart",(t,o,l,n)=>{var a,c;if(null==n||!n.jquery)return;const r=parseInt(n.data("product_id"),10);if(!r)return;const d=(null==e?void 0:e.find(t=>(null==t?void 0:t.id)===r))||{},u=h(d.price,i,d);null===(a=globalThis._googlesitekit)||void 0===a||null===(c=a.gtagEvent)||void 0===c||c.call(a,"add_to_cart",u)}),t(".products-block-post-template .product, .wc-block-product-template .product").each(function(){const o=t(this),l=parseInt(o.find("[data-product_id]").attr("data-product_id"),10);l&&o.on("click",o=>{var n,a;const c=t(o.target).closest(".wc-block-components-product-button [data-product_id]");if(!c.length||!c.hasClass("add_to_cart_button")||c.hasClass("product_type_variable"))return;const r=(null==e?void 0:e.find(t=>(null==t?void 0:t.id)===l))||{},d=h(r.price,i,r);null===(n=globalThis._googlesitekit)||void 0===n||null===(a=n.gtagEvent)||void 0===a||a.call(n,"add_to_cart",d)})}))})(globalThis.jQuery);
jQuery(document).ready(function ($){
var variable_id=jQuery('[name="product_id"]').val();
var available_ids=[];
var variable_bulk_table="";
function get_table(product_id, updateBulkTable=false){
if(typeof jQuery('.wdp_bulk_table_content').attr('data-available-ids')!=='undefined'){
available_ids=JSON.parse(jQuery('.wdp_bulk_table_content').attr('data-available-ids'));
}
if(available_ids.indexOf(parseInt(product_id))===-1){
return;
}
if(product_id===variable_id&&variable_bulk_table&&!updateBulkTable){
jQuery('.wdp_bulk_table_content').html(variable_bulk_table)
return true;
}
let attributes={};
jQuery('form.variations_form[data-product_id=' + variable_id + '] select').each(function (index, item){
if(jQuery(item).attr("data-attribute_name")){
attributes[jQuery(item).attr("data-attribute_name")]=jQuery(this).val();
}});
var data={
action: 'get_table_with_product_bulk_table',
product_id: parseInt(product_id),
attributes: attributes,
...jQuery('form.cart').triggerHandler('wdp_get_custom_data')
};
return jQuery.ajax({
url: script_data.ajaxurl,
data: data,
dataType: 'json',
type: 'POST',
success: function (response){
if(response.success){
jQuery('.wdp_bulk_table_content').each(function (_, item){
let jQItem=jQuery(item);
let availableIds=JSON.parse(jQItem.attr('data-available-ids'));
if(availableIds.indexOf(parseInt(product_id))===-1){
return;
}
jQItem.html(jQuery(response.data).children()).trigger('update');
});
init_custom_event();
if(product_id===variable_id){
variable_bulk_table=response.data;
}}else{
get_table(variable_id);
}},
error: function (response){
get_table(variable_id);
}});
}
function init_custom_event(){
jQuery('.wdp_bulk_table_content').on('get_table', function (e, $obj_id){
if(typeof $obj_id==='undefined'||!$obj_id){
get_table(variable_id);
}else{
get_table($obj_id);
}});
}
function init_events(){
if(jQuery('.wdp_bulk_table_content').length > 0){
jQuery('.variations_form').on('found_variation', { variationForm: this },
function (event, variation){
if(typeof variation==='undefined'){
get_table(variable_id);
return true;
}
get_table(variation.variation_id);
return true;
})
.on('click', '.reset_variations',
{ variationForm: this },
function (event, variation){
get_table(variable_id);
return true;
})
.on('reset_data',
function (event){
get_table(variable_id);
return true;
});
jQuery('form.cart').on('adp_found_variation', function (e, { product_id, variation_id}){
get_table(variation_id||product_id, true);
return true;
});
init_custom_event();
}}
if(script_data.js_init_trigger){
$(document).on(script_data.js_init_trigger, function (){
init_events();
});
}
jQuery('form.cart').on('adp_variations_form', function(){
init_events();
});
setTimeout(function (){
jQuery('.variations_form').on("wc_variation_form", function (){
init_events();
})
}, 0);
function watchForQuickView(){
let observer=new MutationObserver(function (mutations){
mutations.forEach(function (mutation){
mutation.addedNodes.forEach(function (node){
if($(node).hasClass('product-lightbox-inner')||$(node).find('.product-lightbox-inner').length){
init_events();
}});
});
});
observer.observe(document.body, { childList: true, subtree: true });
}
watchForQuickView();
});
(()=>{var t={507:(t,e,r)=>{"use strict";r.d(e,{A:()=>A});var n=function(t){return"string"!=typeof t||""===t?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(t)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)};var i=function(t){return"string"!=typeof t||""===t?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(t)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(t)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)};var o=function(t,e){return function(r,o,s,c=10){const l=t[e];if(!i(r))return;if(!n(o))return;if("function"!=typeof s)return void console.error("The hook callback must be a function.");if("number"!=typeof c)return void console.error("If specified, the hook priority must be a number.");const a={callback:s,priority:c,namespace:o};if(l[r]){const t=l[r].handlers;let e;for(e=t.length;e>0&&!(c>=t[e-1].priority);e--);e===t.length?t[e]=a:t.splice(e,0,a),l.__current.forEach((t=>{t.name===r&&t.currentIndex>=e&&t.currentIndex++}))}else l[r]={handlers:[a],runs:0};"hookAdded"!==r&&t.doAction("hookAdded",r,o,s,c)}};var s=function(t,e,r=!1){return function(o,s){const c=t[e];if(!i(o))return;if(!r&&!n(s))return;if(!c[o])return 0;let l=0;if(r)l=c[o].handlers.length,c[o]={runs:c[o].runs,handlers:[]};else{const t=c[o].handlers;for(let e=t.length-1;e>=0;e--)t[e].namespace===s&&(t.splice(e,1),l++,c.__current.forEach((t=>{t.name===o&&t.currentIndex>=e&&t.currentIndex--})))}return"hookRemoved"!==o&&t.doAction("hookRemoved",o,s),l}};var c=function(t,e){return function(r,n){const i=t[e];return void 0!==n?r in i&&i[r].handlers.some((t=>t.namespace===n)):r in i}};var l=function(t,e,r,n){return function(i,...o){const s=t[e];s[i]||(s[i]={handlers:[],runs:0}),s[i].runs++;const c=s[i].handlers;if(!c||!c.length)return r?o[0]:void 0;const l={name:i,currentIndex:0};return(n?async function(){try{s.__current.add(l);let t=r?o[0]:void 0;for(;l.currentIndex<c.length;){const e=c[l.currentIndex];t=await e.callback.apply(null,o),r&&(o[0]=t),l.currentIndex++}return r?t:void 0}finally{s.__current.delete(l)}}:function(){try{s.__current.add(l);let t=r?o[0]:void 0;for(;l.currentIndex<c.length;){t=c[l.currentIndex].callback.apply(null,o),r&&(o[0]=t),l.currentIndex++}return r?t:void 0}finally{s.__current.delete(l)}})()}};var a=function(t,e){return function(){const r=t[e],n=Array.from(r.__current);return n.at(-1)?.name??null}};var d=function(t,e){return function(r){const n=t[e];return void 0===r?n.__current.size>0:Array.from(n.__current).some((t=>t.name===r))}};var u=function(t,e){return function(r){const n=t[e];if(i(r))return n[r]&&n[r].runs?n[r].runs:0}};class h{actions;filters;addAction;addFilter;removeAction;removeFilter;hasAction;hasFilter;removeAllActions;removeAllFilters;doAction;doActionAsync;applyFilters;applyFiltersAsync;currentAction;currentFilter;doingAction;doingFilter;didAction;didFilter;constructor(){this.actions=Object.create(null),this.actions.__current=new Set,this.filters=Object.create(null),this.filters.__current=new Set,this.addAction=o(this,"actions"),this.addFilter=o(this,"filters"),this.removeAction=s(this,"actions"),this.removeFilter=s(this,"filters"),this.hasAction=c(this,"actions"),this.hasFilter=c(this,"filters"),this.removeAllActions=s(this,"actions",!0),this.removeAllFilters=s(this,"filters",!0),this.doAction=l(this,"actions",!1,!1),this.doActionAsync=l(this,"actions",!1,!0),this.applyFilters=l(this,"filters",!0,!1),this.applyFiltersAsync=l(this,"filters",!0,!0),this.currentAction=a(this,"actions"),this.currentFilter=a(this,"filters"),this.doingAction=d(this,"actions"),this.doingFilter=d(this,"filters"),this.didAction=u(this,"actions"),this.didFilter=u(this,"filters")}}var A=function(){return new h}},8770:()=>{}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{actions:()=>x,addAction:()=>s,addFilter:()=>c,applyFilters:()=>m,applyFiltersAsync:()=>v,createHooks:()=>t.A,currentAction:()=>y,currentFilter:()=>F,defaultHooks:()=>o,didAction:()=>b,didFilter:()=>k,doAction:()=>f,doActionAsync:()=>p,doingAction:()=>_,doingFilter:()=>g,filters:()=>w,hasAction:()=>d,hasFilter:()=>u,removeAction:()=>l,removeAllActions:()=>h,removeAllFilters:()=>A,removeFilter:()=>a});var t=r(507),e=r(8770),i={};for(const t in e)["default","actions","addAction","addFilter","applyFilters","applyFiltersAsync","createHooks","currentAction","currentFilter","defaultHooks","didAction","didFilter","doAction","doActionAsync","doingAction","doingFilter","filters","hasAction","hasFilter","removeAction","removeAllActions","removeAllFilters","removeFilter"].indexOf(t)<0&&(i[t]=()=>e[t]);r.d(n,i);const o=(0,t.A)(),{addAction:s,addFilter:c,removeAction:l,removeFilter:a,hasAction:d,hasFilter:u,removeAllActions:h,removeAllFilters:A,doAction:f,doActionAsync:p,applyFilters:m,applyFiltersAsync:v,currentAction:y,currentFilter:F,doingAction:_,doingFilter:g,didAction:b,didFilter:k,actions:x,filters:w}=o})(),(window.wp=window.wp||{}).hooks=n})();
(()=>{"use strict";const t=window.wp.hooks,e=(t,e)=>{const a={id:"gla_"+t.id,quantity:e,google_business_vertical:"retail"};return t.name&&(a.name=t.name),t?.categories?.length&&(a.category=t.categories[0].name),t?.prices?.price&&(a.price=parseInt(t.prices.price,10)/10**t.prices.currency_minor_unit),a},a=(t,a=1)=>{((t,e)=>{if("function"!=typeof gtag)throw new Error("Function gtag not implemented.");window.gtag("event","add_to_cart",{send_to:"GLA",...e})})(0,{ecomm_pagetype:"cart",event_category:"ecommerce",items:[e(t,a)]})},n=t=>{var e;return glaGtagData.products[t.id]&&(t.name=glaGtagData.products[t.id].name,t.prices=(e=glaGtagData.products[t.id].price,{price:Math.round(e*10**glaGtagData.currency_minor_unit),currency_minor_unit:glaGtagData.currency_minor_unit})),t};(0,t.addAction)("experimental__woocommerce_blocks-cart-add-item","google-listings-and-ads",({product:t,quantity:e=1})=>{a(t,e)});const r=function(t){const e=t.currentTarget.dataset,r=n({id:e.product_id});a(r,e.quantity||1)},o=function(t){const e=t.target.closest("form.cart");if(!e)return;const r=e.querySelector("[name=add-to-cart]");if(!r)return;const o=e.querySelector("[name=variation_id]"),c=e.querySelector("[name=quantity]"),i=n({id:parseInt(o?o.value:r.value,10)});a(i,c?parseInt(c.value,10):1)};document.defaultView.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".add_to_cart_button:not(.product_type_variable):not(.product_type_grouped):not(.wc-block-components-product-button__button)").forEach(t=>{t.addEventListener("click",r)}),document.querySelectorAll('[data-block-name="woocommerce/product-button"] > .add_to_cart_button:not(.product_type_variable):not(.product_type_grouped)').forEach(t=>{t.addEventListener("click",r)}),document.querySelectorAll(".single_add_to_cart_button").forEach(t=>{t.addEventListener("click",o)})}),"function"==typeof jQuery&&jQuery(document).on("found_variation","form.cart",function(t,e){(t=>{t?.variation_id&&(glaGtagData.products[t.variation_id]={name:t.display_name,price:t.display_price})})(e)})})();
(()=>{const e={statistics:["analytics_storage"],marketing:["ad_storage","ad_user_data","ad_personalization"]},t=()=>{if("function"==typeof wp_has_consent){void 0===window.wp_consent_type&&(window.wp_consent_type="optin");const t={};for(const[n,o]of Object.entries(e))if(""!==consent_api_get_cookie(window.consent_api.cookie_prefix+"_"+n)){const e=wp_has_consent(n)?"granted":"denied";o.forEach(n=>{t[n]=e})}Object.keys(t).length>0&&window.gtag("consent","update",t)}};document.addEventListener("wp_listen_for_consent_change",t=>{const n={},o=e[Object.keys(t.detail)[0]],a="allow"===Object.values(t.detail)[0]?"granted":"denied";void 0!==o&&(o.forEach(e=>{n[e]=a}),Object.keys(n).length>0&&window.gtag("consent","update",n))}),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()})();