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