(()=>{"use strict";var e={};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();const t="email",n="phone",r="name",a={[t]:["email","e-mail","mail","email address"],[n]:["phone","tel","mobile","cell","telephone","phone number"],[r]:["name","full-name","full name","full_name","fullname","first-name","first name","first_name","firstname","last-name","last name","last_name","lastname","given-name","given name","given_name","givenname","family-name","family name","family_name","familyname","fname","lname","first","last","your-name","your name"]};function i(e){return e&&"string"==typeof e?e.trim().toLowerCase():""}function l(e){const t=i(e),n=t.lastIndexOf("@");if(-1===n)return t;const r=t.slice(n+1);return["gmail.com","googlemail.com"].includes(r)?`${t.slice(0,n).replace(/\./g,"")}@${r}`:t}function s(e){const t=i(e),n=t.replace(/\D/g,"");return t.startsWith("+")?`+${n}`:n}function u(e){const t=e.filter(e=>{let{type:t}=e;return t===r}).map(e=>{let{value:t}=e;return i(t)}).filter(Boolean);if(!t.length)return;const[n,...a]=1===t.length?t[0].split(" "):t;return{first_name:n,...a?.length>0?{last_name:a.join(" ")}:{}}}function o(e){return e.find(e=>{let{type:n}=e;return n===t})?.value}function c(e){return e.find(e=>{let{type:t}=e;return t===n})?.value}((f,g,p)=>{if(!f||!g||!p)return;const d=g.Object.extend({initialize(){this.listenTo(p.Radio.channel("forms"),"submit:response",this.actionSubmit)},actionSubmit(f){const g=e.g._googlesitekit?.gtagUserData,p=g?(d=f.data.fields,function(e){const t=[["address",u(e)],["email",o(e)],["phone_number",c(e)]].filter(e=>{let[,t]=e;return t});if(0!==t.length)return Object.fromEntries(t)}(Object.values(d).map(e=>{const{label:u,type:o,value:c,key:f}=e;return function(e){let{type:u,name:o,value:c,label:m}=e||{};switch(u=i(u),o=i(o),c=i(c),m=function(e){return e&&"string"==typeof e?e.trim().toLowerCase().replace(/\s*\*+\s*$/,"").replace(/\s*\(required\)\s*$/i,"").replace(/\s*:\s*$/,"").trim():""}(m),u){case"email":return{type:t,value:l(c)};case"tel":return{type:n,value:s(c)}}return function(e){if(!e)return!1;const t=l(e);return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}(c)||a[t].includes(o)||a[t].includes(m)?{type:t,value:l(c)}:a[n].includes(o)||a[n].includes(m)?{type:n,value:s(c)}:a[r].includes(o)||a[r].includes(m)?{type:r,value:i(c)}:function(e){if(!e)return!1;if(!function(e){const t=e.replace(/\D/g,"");return!(t.length<7||t.length<e.length/2)&&/^[\s\-()+.\d]*$/.test(e)}(e))return!1;const t=s(e);if(!/^\+?\d{7,}$/.test(t))return!1;const n=/[\s\-()+.]/.test(e),r=e.trim().startsWith("+");return!(!n&&!r)}(c)?{type:n,value:s(c)}:null}({label:u,type:m[o]??o,value:c,name:f})}).filter(Boolean))):void 0;var d;e.g._googlesitekit?.gtagEvent?.("submit_lead_form",p?{user_data:p}:void 0)}});f(document).ready(()=>{new d})})(e.g.jQuery,e.g.Marionette,e.g.Backbone);const m={phone:"tel",textbox:"text"}})();