function norm(e){return(null==e?"":String(e)).trim().toLowerCase()}async function sha256Hex(e){e=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,"0")).join("")}window.dataLayer=window.dataLayer||[];const HS_FIELDS={first:"0-1/firstname",last:"0-1/lastname",email:"0-1/email",hear:"0-1/how_did_you_hear_about_us_"};function getVal(e,t){e=e.querySelector(`[name="${CSS.escape(t)}"]`);return e?e.value:""}function readFormFromScope(e){return{first_name:norm(getVal(e,HS_FIELDS.first)),last_name:norm(getVal(e,HS_FIELDS.last)),email:norm(getVal(e,HS_FIELDS.email)),hear:norm(getVal(e,HS_FIELDS.hear))}}function pushDataLayer(e){window.dataLayer.push({event:"hubspot_form_submission",form_type:e.form_type||"",first_name:e.first_name||"",last_name:e.last_name||"",email:e.email||"",email_hash:e.email_hash||"",hear:e.hear||"",page_url:window.location.href})}function bindWrappers(){document.querySelectorAll(".hsfc-FormWrapper").forEach(t=>{if(!t.__hsDlBound){t.__hsDlBound=!0,t.__hsPending=null,t.__hsPushed=!1,t.addEventListener("submit",async function(e){var e=e.target&&e.target.closest?e.target.closest("form"):null;e&&((e=readFormFromScope(e)).email_hash=e.email?await sha256Hex(e.email):"",e.form_type="New business",t.__hsPending=e)},!0);const a=new MutationObserver(function(){var e;t.__hsPushed||t.querySelector(".hsfc-PostSubmit")&&((e=t.__hsPending)&&(e.email||e.first_name||e.last_name)&&pushDataLayer(e),t.__hsPushed=!0,a.disconnect())});a.observe(t,{childList:!0,subtree:!0})}})}function hsDlInit(){watchForHubSpotMounts(),bindWrappers(),setTimeout(bindWrappers,250),setTimeout(bindWrappers,1500),setTimeout(bindWrappers,4e3)}function watchForHubSpotMounts(){window.__hsDlDomWatchStarted||(window.__hsDlDomWatchStarted=!0,new MutationObserver(()=>{bindWrappers()}).observe(document.documentElement,{childList:!0,subtree:!0}))}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",hsDlInit):hsDlInit(),window.addEventListener("pageshow",hsDlInit),["taxi:load","taxi:render","taxi:visit"].forEach(e=>{document.addEventListener(e,hsDlInit,!0)});