(()=>{if("undefined"==typeof gfZeroSpamConfig)return;const t=gfZeroSpamConfig.forms;if(t&&t.length){if("undefined"!=typeof gform&&gform.utils&&gform.utils.addAsyncFilter){const n={};return t.forEach(t=>{n[t.formId]=t}),void gform.utils.addAsyncFilter("gform/submission/pre_submission",t=>{const r=parseInt(t.form.dataset.formid,10),i=n[r];return i?e(i).then(e=>(o(t.form,e),t)):Promise.resolve(t)})}t.forEach(t=>{const n=document.getElementById("gform_"+t.formId);n&&!n.dataset.gfzsBound&&(n.dataset.gfzsBound="1",n.addEventListener("submit",function(n){n.preventDefault(),e(t).then(t=>{o(this,t),this.submit()})}))})}function e(t){return fetch(t.restUrl+"?form_id="+t.formId,{signal:AbortSignal.timeout(t.timeout)}).then(t=>{if(!t.ok)throw new Error("REST failed");return t.json()}).then(t=>t.token).catch(()=>fetch(t.ajaxUrl+"?action=gf_zero_spam_token&form_id="+t.formId,{signal:AbortSignal.timeout(t.timeout)}).then(t=>{if(!t.ok)throw new Error("AJAX failed");return t.json()}).then(t=>t.token).catch(()=>t.fallbackToken))}function o(t,e){const o=t.querySelector('input[name="gf_zero_spam_token"]');o&&o.remove();const n=document.createElement("input");n.type="hidden",n.name="gf_zero_spam_token",n.value=e,n.setAttribute("autocomplete","new-password"),t.appendChild(n)}})();