(()=>{"use strict";var t={54267:(t,e,r)=>{function o(t){if(t.startsWith("/")&&!t.startsWith("//"))return!0;try{var e=new URL(t);return"http:"===e.protocol||"https:"===e.protocol}catch(t){return!1}}function n(t){return/^[a-f0-9]{32}$/.test(t)}function a(){var t=new Uint8Array(16);return crypto.getRandomValues(t),Array.from(t,function(t){return t.toString(16).padStart(2,"0")}).join("")}function u(t){var e=document.createElement("a");return e.id=t,e.style.display="none",e.rel="noopener noreferrer",document.body.appendChild(e),e}function i(){var t="automator_tab_id",e=sessionStorage.getItem(t);return e&&n(e)||(e=a(),sessionStorage.setItem(t,e)),e}function c(){var t=function(){for(var t="automator_client_id=",e=decodeURIComponent(document.cookie).split(";"),r=0;r<e.length;r++){var o=e[r].trim();if(0===o.indexOf(t))return o.substring(20)}return""}();t&&n(t)||(t=a()),document.cookie="automator_client_id="+t+"; path=/; SameSite=Lax"}function d(t){if(!t)return!1;if("/"===t.charAt(0)&&"/"!==t.charAt(1))return!0;try{return new URL(t).origin===window.location.origin}catch(t){return!1}}function s(t){if(!t.url||!d(t.url))return!1;var e="string"==typeof t.data?t.data:"",r=t.url+e;return-1===r.indexOf("heartbeat")&&-1===r.indexOf("autosave")&&-1===r.indexOf("automator_check_closure_redirect")}r.d(e,{$Y:()=>s,AY:()=>o,J6:()=>d,PP:()=>c,d:()=>u,vU:()=>i})}},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var a=e[o]={exports:{}};return t[o](a,a.exports,r),a.exports}r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var o=r(54267);function n(){var t="automator_closure_redirect";(0,o.PP)();var e=(0,o.vU)(),r=(0,o.d)("automator-closure-redirect"),n=null,a=setInterval(function(){var e=sessionStorage.getItem(t);e&&(0,o.AY)(e)&&(clearInterval(a),sessionStorage.removeItem(t),r.href=e,r.click())},500);"undefined"!=typeof jQuery&&(jQuery(document).on("ajaxSend",function(t,r,n){(0,o.J6)(n.url)&&r.setRequestHeader("X-Automator-Tab-Id",e)}),jQuery(document).on("ajaxComplete",function(r,a,u){if((0,o.$Y)(u)){var i=a.getResponseHeader("X-Automator-Redirect");i&&(0,o.AY)(i)?sessionStorage.setItem(t,i):"undefined"!=typeof automatorClosure&&automatorClosure.nonce&&(clearTimeout(n),n=setTimeout(function(){var r=automatorClosure.ajaxUrl||window.ajaxurl||"/wp-admin/admin-ajax.php";fetch(r+"?action=automator_check_closure_redirect&nonce="+automatorClosure.nonce,{method:"GET",credentials:"same-origin",headers:{"X-Automator-Tab-Id":e}}).then(function(t){return t.json()}).then(function(e){e.success&&e.data.redirect_url&&(0,o.AY)(e.data.redirect_url)&&sessionStorage.setItem(t,e.data.redirect_url)}).catch(function(){})},500))}}))}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",n):n()})();
//# sourceMappingURL=closure.js.map