(()=>{"use strict";const a=window.wc.wcBlocksData,e=window.wp.data,t=(0,e.select)(a.CART_STORE_KEY);var l=!1,_=!0;const c=(a=>{let e=null;return(...t)=>{window.clearTimeout(e),e=window.setTimeout(()=>{a.apply(null,t)},1e3)}})(a=>{l=!0});window.addEventListener("change",c),window.addEventListener("keypress",c),window.addEventListener("storage",a=>{if("wcal_gdpr_no_thanks"===a.key){if("wcal_gdpr_no_thanks"===a.key){a.newValue&&(_=!1);var e={action:"wcal_gdpr_refused",ajax_nonce:wcal_guest_capture_blocks_params.wcal_gdpr_nonce}}jQuery.post(wcal_guest_capture_blocks_params.ajax_url,e,function(a){})}}),(0,e.subscribe)(()=>{const{billingAddress:a,shippingAddress:e}=t.getCustomerData();if(wcal_guest_capture_blocks_params.user_id>=63e6&&!localStorage.getItem("wcal_data_populated")&&(a.email=wcal_guest_capture_blocks_params.email,localStorage.setItem("wcal_user_email",wcal_guest_capture_blocks_params.email),a.first_name=wcal_guest_capture_blocks_params.first_name,e.first_name=wcal_guest_capture_blocks_params.first_name,localStorage.setItem("wcal_user_firstname",wcal_guest_capture_blocks_params.first_name),a.last_name=wcal_guest_capture_blocks_params.last_name,e.last_name=wcal_guest_capture_blocks_params.last_name,localStorage.setItem("wcal_user_lastname",wcal_guest_capture_blocks_params.last_name),localStorage.setItem("wcal_data_populated",!0)),l&&_){var c=localStorage.getItem("wcal_user_email"),s=localStorage.getItem("wcal_user_firstname"),o=localStorage.getItem("wcal_user_lastname"),r=localStorage.getItem("wcal_billing_postcode"),n=localStorage.getItem("wcal_shipping_postcode"),i=localStorage.getItem("wcal_billing_country"),g=localStorage.getItem("wcal_shipping_country"),m=a.email,p=a.first_name,u=a.last_name,w=a.postcode,d=e.postcode,b=a.country,S=e.country,I=!1;if(c!==m&&(I=!0,localStorage.setItem("wcal_user_email",m)),s!==p&&(I=!0,localStorage.setItem("wcal_user_firstname",p)),o!==u&&(I=!0,localStorage.setItem("wcal_user_lastname",u)),r!==w&&localStorage.setItem("wcal_billing_postcode",w),n!==d&&localStorage.setItem("wcal_shipping_postcode",d),i!==b&&(I=!0,localStorage.setItem("wcal_billing_country",b)),g!==S&&(I=!0,localStorage.setItem("wcal_shipping_country",S)),I){var k={billing_first_name:localStorage.getItem("wcal_user_firstname"),billing_last_name:localStorage.getItem("wcal_user_lastname"),billing_email:localStorage.getItem("wcal_user_email"),billing_postcode:localStorage.getItem("wcal_billing_postcode"),shipping_postcode:localStorage.getItem("wcal_shipping_postcode"),billing_country:localStorage.getItem("wcal_billing_country"),shipping_country:localStorage.getItem("wcal_shipping_country"),wcal_guest_capture_nonce:wcal_guest_capture_blocks_params.wcal_save_nonce,action:"save_data"};localStorage.wcal_abandoned_id&&(k.wcal_abandoned_id=localStorage.wcal_abandoned_id),jQuery.post(wcal_guest_capture_blocks_params.ajax_url,k,function(a){})}l=!1}},a.CART_STORE_KEY)})();