!function(){if(!window.YouformEmbed?.__initialized){var e=document.currentScript,t="https://app.youform.com";try{e&&e.src&&(t=new URL(e.src).origin)}catch(e){}window.YouformEmbed={__initialized:!0,init:function(){var e=document.querySelectorAll("[data-youform-embed]");if(e.length){var r=new Set,a=new URLSearchParams(window.location.search),n=null;window.addEventListener("message",(function(t){if(r.has(t.source)){var a=t.data;a&&"youformRedirect"===a.name&&a.url&&(window.location.href=a.url),a&&"youformCloseFullscreen"===a.name&&n&&n(),a&&"youformResize"===a.name&&a.height&&e.forEach((function(e){var r=e.querySelector("iframe");r&&r.contentWindow===t.source&&(r.style.height=a.height+"px")}))}})),e.forEach((function(e,r){var n=e.getAttribute("data-form"),d=e.getAttribute("data-width")||"100%",s=e.getAttribute("data-height")||"700",c=e.getAttribute("data-params"),l=e.getAttribute("data-parent-params"),u=e.hasAttribute("data-autoresize"),m=e.hasAttribute("data-fullscreen-mobile"),h=e.getAttribute("data-transparency");if(n){var f=e.getAttribute("data-base-url"),p=new URL((f||t)+"/forms/"+n);if(c)new URLSearchParams(c).forEach((function(e,t){p.searchParams.set(t,e)}));if(null!==l)if(""===l.trim())a.forEach((function(e,t){p.searchParams.set(t,e)}));else l.split(",").map((function(e){return e.trim()})).forEach((function(e){a.has(e)&&p.searchParams.set(e,a.get(e))}));if(u&&p.searchParams.set("embedded","1"),h&&parseInt(h)>0&&p.searchParams.set("transparency",h),m&&window.innerWidth<768)o(e,p.toString(),d,s);else{var b=document.createElement("iframe");for(b.src=p.toString(),b.width=d,b.height=s,b.loading="lazy",b.style.border="none",b.setAttribute("title","Youform Embed "+(r+1)),u&&(b.scrolling="no",b.style.overflow="hidden",b.style.transition="height 0.3s ease"),h&&parseInt(h)>0&&(b.allowTransparency=!0,b.style.background="transparent");e.firstChild;)e.removeChild(e.firstChild);e.appendChild(b),i(b)}}else console.error("Youform Embed Error: data-form attribute is required.")}))}function i(e){e&&e.contentWindow&&r.add(e.contentWindow)}function o(e,t,r,a){var o=document.createElement("div");o.style.cssText="position:relative;cursor:pointer;overflow:hidden;border-radius:8px;max-width:100%;";var d=document.createElement("iframe");d.src=t,d.width=r,d.height=a,d.loading="lazy",d.style.cssText="border:none;pointer-events:none;display:block;width:100%;",d.setAttribute("title","Youform form preview"),d.setAttribute("tabindex","-1");var s=document.createElement("div");for(s.style.cssText="position:absolute;inset:0;",o.appendChild(d),o.appendChild(s),o.addEventListener("click",(function(){!function(e){try{var t=new URL(e);t.searchParams.delete("embedded"),t.searchParams.delete("transparency"),t.searchParams.set("fullscreen","1"),e=t.toString()}catch(e){}var r=document.createElement("div");r.style.cssText="position:fixed;inset:0;z-index:99999;background:rgba(0,0,0,0.5);";var a=document.createElement("iframe");function o(){r.parentNode&&r.parentNode.removeChild(r),document.body.style.overflow="",n=null}a.src=e,a.frameBorder="0",a.style.cssText="width:100%;height:100%;border:none;",n=o,r.addEventListener("click",(function(e){e.target===r&&o()})),r.appendChild(a),document.body.appendChild(r),document.body.style.overflow="hidden",i(a)}(t)}));e.firstChild;)e.removeChild(e.firstChild);e.appendChild(o)}}},window.YouformEmbed.init()}}();