!function(e){"use strict";const t=e.params,n=(document.querySelector.bind(document),(e,t)=>t.split(".").reduce((e,t)=>e&&e[t],e)),s=()=>null,i=e=>null===e||e===undefined?"":e,o="wc/store/checkout";function a(){const i=t.allowTracking?n:s,o=Object.entries(e.fields).map(([e,t])=>[e,i(sbjs.get,t)]);return Object.fromEntries(o)}function c(e){window.wp&&window.wp.data&&window.wp.data.dispatch&&window.wc&&window.wc.wcBlocksData&&window.wp.data.dispatch(window.wc.wcBlocksData.CHECKOUT_STORE_KEY).__internalSetExtensionData("woocommerce/order-attribution",e,!0)}function r(){if(window.wp&&window.wp.data&&"function"==typeof window.wp.data.subscribe){const e=window.wp.data.subscribe(function(){e(),c(a())},o)}}e.setOrderTracking=function(e){if(t.allowTracking=e,e){if("undefined"==typeof sbjs)return;sbjs.init({lifetime:Number(t.lifetime),session_length:Number(t.session),timezone_offset:"0"})}else!function(){const e=window.location.hostname;["sbjs_current","sbjs_current_add","sbjs_first","sbjs_first_add","sbjs_session","sbjs_udata","sbjs_migrations","sbjs_promo"].forEach(t=>{document.cookie=`${t}=; path=/; max-age=-999; domain=.${e};`})}();const n=a();!function(e){for(const t of document.querySelectorAll("wc-order-attribution-inputs"))t.values=e}(n),c(n)},e.setOrderTracking(t.allowTracking),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",r):r(),window.customElements.define("wc-order-attribution-inputs",class extends HTMLElement{constructor(){if(super(),this._fieldNames=Object.keys(e.fields),this.hasOwnProperty("_values")){let e=this.values;delete this.values,this.values=e||{}}}connectedCallback(){let e="";for(const n of this._fieldNames){const s=i(this.values[n]);e+=``}this.innerHTML=e}set values(e){if(this._values=e,this.isConnected)for(const e of this._fieldNames){const n=this.querySelector(`input[name="${t.prefix}${e}"]`);n?n.value=i(this.values[e]):console.warn(`Field "${e}" not found. Most likely, the '' element was manipulated.`)}}get values(){return this._values}})}(window.wc_order_attribution);