(()=>{"use strict";const a=window.wc.wcBlocksData,e=window.wp.data,t=(0,e.select)(a.CART_STORE_KEY);var l=!1,_=!0;const s=((a,e)=>{let t=null;return(...e)=>{window.clearTimeout(t),t=window.setTimeout((()=>{a.apply(null,e)}),1e3)}})((a=>{l=!0}));window.addEventListener("change",s),window.addEventListener("keypress",s),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 s=localStorage.getItem("wcal_user_email"),c=localStorage.getItem("wcal_user_firstname"),o=localStorage.getItem("wcal_user_lastname"),r=localStorage.getItem("wcal_billing_postcode"),n=localStorage.getItem("wcal_shipping_postcode"),i=a.email,g=a.first_name,m=a.last_name,p=a.postcode,w=e.postcode,u=!1;if(s!==i&&(u=!0,localStorage.setItem("wcal_user_email",i)),c!=g&&(u=!0,localStorage.setItem("wcal_user_firstname",g)),o!=m&&(u=!0,localStorage.setItem("wcal_user_lastname",m)),r!=p&&localStorage.setItem("wcal_billing_postcode",p),n!=w&&localStorage.setItem("wcal_shipping_postcode",w),u){var d={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"),wcal_guest_capture_nonce:wcal_guest_capture_blocks_params.wcal_save_nonce,action:"save_data"};localStorage.wcal_abandoned_id&&(d.wcal_abandoned_id=localStorage.wcal_abandoned_id),jQuery.post(wcal_guest_capture_blocks_params.ajax_url,d,(function(a){}))}l=!1}}),a.CART_STORE_KEY)})();