(() => { const i = { pardot: { utmcampaign: "utm_campaign", utmcontent: "utm_content", utmmedium: "utm_medium", utmsource: "utm_source", utmterm: "utm_term" }, leadsquared: { SourceCampaign: "utm_campaign", SourceContent: "utm_content", SourceMedium: "utm_medium", Source: "utm_source" } }; function u(c) { let n; c.destination === "leadsquared" && (n = i.leadsquared), c.destination === "pardot" && (n = i.pardot), function(s, r) { const e = document.getElementById(s.formId), t = (e == null ? void 0 : e.tagName) === "FORM" ? e : e == null ? void 0 : e.querySelector("form"); if (!t) return void console.warn("Form handler could not find form element"); for (const o in r) { const l = document.createElement("input"); l.type = "hidden", l.className = o, l.name = o, t.appendChild(l); } }(c, n), document.addEventListener("DOMContentLoaded", function() { const s = new URLSearchParams(window.location.search); for (const r in n) { const e = n[r], t = s.get(e); if (t) { const o = document.querySelector("." + r); o && (o.value = t); } } }); } function m(c) { const n = document.getElementById(c.formId); (function(s) { s.querySelectorAll("select[multiple]").forEach((e) => { e.previousElementSibling.style.display = "inline-block", e.style.display = "none"; const t = document.createElement("div"); e.insertAdjacentElement("afterend", t), e.querySelectorAll("option").forEach((o) => { o.setAttribute("form-value", o.value); const l = document.createElement("div"), a = document.createElement("input"); a.type = "checkbox", a.name = `checkbox-${e.name}`, a.id = `checkbox-${e.name}-${o.value}`, a.value = o.value, a.style.marginRight = "0.5rem", a.style.marginTop = "0.25rem", a.style.marginBottom = "0.0rem", a.style.marginLeft = "1.5rem", a.setAttribute("form-value", o.value); const d = document.createElement("label"); d.style.fontStyle = "italic", d.htmlFor = `checkbox-${e.name}-${o.value}`, d.textContent = o.textContent || "", l.appendChild(a), l.appendChild(d), t.appendChild(l); }); }); })(n), document.addEventListener("DOMContentLoaded", (s) => { n.addEventListener("change", (r) => { const e = r.target; e.type === "checkbox" && e.hasAttribute("form-value") && n.querySelectorAll("input[type='checkbox']").forEach((t) => { if (!t.getAttribute("form-value")) return; const o = n.querySelector(`option[value="${t.getAttribute("form-value")}"]`); o && (o.selected = t.checked); }); }); }); } function f() { (function() { const c = document.getElementById("newsletteroptin"), n = document.getElementById("newsletteroptin_hidden"); !c || !n || (c.addEventListener("change", (s) => { s.target.checked ? (n.name = "", c.name = "newsletteroptin") : (n.name = "newsletteroptin", c.name = ""); }), n.name = "newsletteroptin", c.name = ""); })(), function() { const c = document.getElementById("privacypolicy"), n = document.getElementById("privacypolicy_hidden"); !c || !n || (c.addEventListener("change", (s) => { s.target.checked ? (n.name = "", c.name = "privacypolicy") : (n.name = "privacypolicy", c.name = ""); }), n.name = "privacypolicy", c.name = ""); }(); } window.runFormHandler = function(c = {}) { const n = { formId: "form", successId: "success", successQuery: "success", successElementScrollOffsetInRems: 0, selectorsToHide: ["#form"], selectorsToShow: ["#success"], hideClass: "hide", convertMultiSelectToCheckboxes: !1, errorHandler: !1, refUrlId: null, ...c }, s = new URLSearchParams(window.location.search).has(n.successQuery); n.refUrlId && function(r) { try { const e = document.getElementById(r); if (!e) return; const t = window.location.href; if (!t) return; e.value = t; } catch (e) { console.error("Error handling reference URL:", e); } }(n.refUrlId), n.destination === "leadsquared" && (function(r) { const e = document.querySelector(r.formId), t = (e == null ? void 0 : e.tagName) === "FORM" ? e : e == null ? void 0 : e.querySelector("form"); if (!t) return; t.querySelectorAll("label").forEach(function(l) { var a; l.textContent = ((a = l.textContent) == null ? void 0 : a.replace(/\*/g, "")) || ""; }); let o = t.innerHTML; o = o.replace(/</g, "<").replace(/>/g, ">"), t.innerHTML = o; }(n), function(r) { document.addEventListener("DOMContentLoaded", function() { const e = document.querySelector(r.formId), t = (e == null ? void 0 : e.tagName) === "FORM" ? e : e == null ? void 0 : e.querySelector("form"); if (t) { const o = t.querySelector("#mx_User_consent_checkbox"); o && o.setAttribute("required", "required"); } }); }(n)), s ? function(r) { const e = document.getElementById(r.successId); e && document.addEventListener("DOMContentLoaded", () => { const t = 16 * r.successElementScrollOffsetInRems, o = e.getBoundingClientRect().top + window.scrollY - t; window.scrollTo({ top: o, behavior: "auto" }); }), r.selectorsToHide.forEach((t) => { document.querySelectorAll(t).forEach((o) => o.classList.add(r.hideClass)); }), r.selectorsToShow.forEach((t) => { document.querySelectorAll(t).forEach((o) => o.classList.remove(r.hideClass)); }); }(n) : function(r) { r.selectorsToHide.forEach((e) => { document.querySelectorAll(e).forEach((t) => t.classList.remove(r.hideClass)); }), r.selectorsToShow.forEach((e) => { document.querySelectorAll(e).forEach((t) => t.classList.add(r.hideClass)); }); }(n), n.destination && u(n), n.convertMultiSelectToCheckboxes && m(n), n.destination === "pardot" && f(), n.errorHandler && function(r) { if (!new URLSearchParams(window.location.search).has("errors")) return; const e = document.getElementById(r.formId); if (!e) return void console.warn("Form handler could not find form element"); e.querySelectorAll("input").forEach((o) => { const l = o.name, a = new URLSearchParams(window.location.search).get(l); a && (o.value = a); }); const t = document.querySelector("[form-error]"); t == null || t.classList.remove(r.hideClass), document.addEventListener("DOMContentLoaded", () => { const o = e.getBoundingClientRect().top + window.scrollY - 0; window.scrollTo({ top: o, behavior: "auto" }), setTimeout(() => { window.scrollTo({ top: o, behavior: "auto" }); }, 300); }); }(n); }; })()