document.addEventListener("DOMContentLoaded",function(){var e=document.getElementById("freeform-beta-feedback-widget"),t=e.querySelector("a"),n=e.querySelector("form"),a=e.querySelector('button[data-type="cancel"]'),r=e.querySelector('input[name="rating"]'),s=e.querySelectorAll("button");e.style.display=null;var c=function(){e.classList.toggle("expanded")};t.addEventListener("click",c),a.addEventListener("click",c);var o=e.querySelector(".stars").querySelectorAll(".star");o.forEach(function(e){var t=e.dataset.value;e.addEventListener("mouseenter",function(){o.forEach(function(e){e.dataset.value<=t?e.classList.add("hover"):e.classList.add("unhover")})}),e.addEventListener("mouseleave",function(){o.forEach(function(e){e.classList.remove("hover","unhover")})}),e.addEventListener("click",function(){r.value=t,o.forEach(function(e){e.dataset.value<=t?e.classList.add("selected"):e.classList.remove("selected")})})}),n.addEventListener("submit",function(t){var a=new FormData(n);return s.forEach(function(e){return e.disabled=!0}),fetch("".concat("https://api.solspace.com","/feedback"),{method:"post",cache:"no-cache",headers:{"X-Requested-With":"XMLHttpRequest"},body:a}).then(function(e){return e.json()}).then(function(t){t.success?(e.classList.remove("expanded"),e.classList.add("submitted")):(alert("There was an error submitting the feedback."),console.error(t.errors)),s.forEach(function(e){return e.disabled=!1})}),t.preventDefault(),t.stopPropagation(),!1})});