(()=>{"use strict";const t=new TextEncoder;function e(t){return[...new Uint8Array(t)].map(t=>t.toString(16).padStart(2,"0")).join("")}async function n(e,n){return crypto.subtle.digest(e.toUpperCase(),"string"==typeof n?t.encode(n):new Uint8Array(n))}async function r(t,r){return e(await n(t,r))}function o(t,e,n="SHA-256",o=1e6,i=0){const a=new AbortController,u=Date.now();return{promise:(async()=>{for(let c=i;c<=o;c+=1){if(a.signal.aborted)return null;if(await r(n,e+c)===t)return{number:c,took:Date.now()-u}}return null})(),controller:a}}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,u(r.key),r)}}function u(t){var e=function(t,e){if("object"!=i(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==i(e)?e:e+""}var c=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},n=[{key:"ParseIt",value:function(t){var e={};try{e=JSON.parse(t)}catch(i){var n="##APTO_OPEN##",r=0,o=0;t.indexOf(n)>=0?(r=t.indexOf(n)+13,o=t.lastIndexOf("##APTO_CLOSE##")):(r=t.indexOf("{"),o=t.lastIndexOf("}"));try{e=JSON.parse(t.substring(r,o))}catch(t){e={}}}return e}}],(e=null)&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,s(r.key),r)}}function s(t){var e=function(t,e){if("object"!=l(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==l(e)?e:e+""}function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}function p(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,b(r.key),r)}}function b(t){var e=function(t,e){if("object"!=y(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=y(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==y(e)?e:e+""}function h(t,e,n){return e=d(e),function(t,e){if(e&&("object"==y(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,v()?Reflect.construct(e,n||[],d(t).constructor):e.apply(t,n))}function v(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(v=function(){return!!t})()}function d(t){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},d(t)}function m(t,e){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},m(t,e)}var w=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),h(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&m(t,e)}(e,t),n=e,(r=[{key:"init",value:function(){this.exec()}}])&&p(n.prototype,r),o&&p(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o}(function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._init_data=e,this._base_data=this.retrieveBaseData(),this.init()},(e=[{key:"retrieveBaseData",value:function(){return this._init_data}},{key:"init",value:function(){}},{key:"run",value:function(){}},{key:"exec",value:function(){this.canRun()&&this.run()}},{key:"canRun",value:function(){return!0}}])&&f(t.prototype,e),n&&f(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}());function _(t){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_(t)}function g(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,O(r.key),r)}}function O(t){var e=function(t,e){if("object"!=_(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=_(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==_(e)?e:e+""}var j=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},n=[{key:"Get",value:function(t){var e=("; "+document.cookie).split("; "+t+"=");return 2===e.length?e.pop().split(";").shift():""}}],(e=null)&&g(t.prototype,e),n&&g(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function S(t){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},S(t)}function P(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,k(r.key),r)}}function k(t){var e=function(t,e){if("object"!=S(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==S(e)?e:e+""}var E=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},n=[{key:"ObjClone",value:function(t){return JSON.parse(JSON.stringify(t))}},{key:"Merge",value:function(){for(var t={},e=function(e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},n=0;n<arguments.length;n++)e(arguments[n]);return t}},{key:"IsEmpty",value:function(t){return"object"===S(t)&&0===Object.keys(t).length}}],(e=null)&&P(t.prototype,e),n&&P(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function q(t){return q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},q(t)}function T(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,x(r.key),r)}}function x(t){var e=function(t,e){if("object"!=q(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=q(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==q(e)?e:e+""}var R=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},n=[{key:"Retrieve",value:function(t){return new URLSearchParams(window.location.search).get(t)}}],(e=null)&&T(t.prototype,e),n&&T(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function C(t){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},C(t)}function N(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return D(l,"_invoke",function(n,r,o){var i,u,c,l=0,f=o||[],s=!1,y={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return i=e,u=0,c=t,y.n=n,a}};function p(n,r){for(u=n,c=r,e=0;!s&&l&&!o&&e<f.length;e++){var o,i=f[e],p=y.p,b=i[2];n>3?(o=b===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,y.v=r,y.n=i[1]):p<b&&(o=n<3||i[0]>r||r>b)&&(i[4]=n,i[5]=r,y.n=b,u=0))}if(o||n>1)return a;throw s=!0,r}return function(o,f,b){if(l>1)throw TypeError("Generator is already running");for(s&&1===f&&p(f,b),u=f,c=b;(e=u<2?t:c)||!s;){i||(u?u<3?(u>1&&(y.n=-1),p(u,c)):y.n=c:y.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(s=y.n<0)?c:n.call(r,y))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:s}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var f=[][r]?e(e([][r]())):(D(e={},r,function(){return this}),e),s=l.prototype=u.prototype=Object.create(f);function y(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,D(t,o,"GeneratorFunction")),t.prototype=Object.create(s),t}return c.prototype=l,D(s,"constructor",l),D(l,"constructor",c),c.displayName="GeneratorFunction",D(l,o,"GeneratorFunction"),D(s),D(s,o,"Generator"),D(s,r,function(){return this}),D(s,"toString",function(){return"[object Generator]"}),(N=function(){return{w:i,m:y}})()}function D(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}D=function(t,e,n,r){function i(e,n){D(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},D(t,e,n,r)}function F(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function A(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){F(i,r,o,a,u,"next",t)}function u(t){F(i,r,o,a,u,"throw",t)}a(void 0)})}}function B(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,G(r.key),r)}}function G(t){var e=function(t,e){if("object"!=C(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=C(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==C(e)?e:e+""}function I(t,e,n){return e=U(e),function(t,e){if(e&&("object"==C(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,H()?Reflect.construct(e,n||[],U(t).constructor):e.apply(t,n))}function H(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(H=function(){return!!t})()}function L(){return L="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=U(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},L.apply(null,arguments)}function U(t){return U=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},U(t)}function M(t,e){return M=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},M(t,e)}var J=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),I(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&M(t,e)}(e,t),n=e,r=[{key:"init",value:function(){var t,n,r,o,i;this.window_focus_at=Date.now(),this.window_blur_at=0,this.notbot_altcha_challenge_request_data=null,this.request_count=0,this.failed_request_count=0,this.shield_ajaxurl=this._base_data.ajax.not_bot.ajaxurl,(t=e,n="init",r=this,i=L(U(1&(o=3)?t.prototype:t),n,r),2&o&&"function"==typeof i?function(t){return i.apply(r,t)}:i)([])}},{key:"run",value:function(){var t=this;window.addEventListener("focus",function(){t.window_focus_at=Date.now()}),window.addEventListener("blur",function(){t.window_blur_at=Date.now()}),this.fire()}},{key:"fire",value:function(){this.request_count<10&&this.failed_request_count<5&&this.performPathAltcha()}},{key:"performPathAltcha",value:function(){var t=this;this.isAltchaChallengeRequired()?this.hasAltchaChallengeData()?(this.request_count++,o(this.notbot_altcha_challenge_request_data.challenge,this.notbot_altcha_challenge_request_data.salt,this.notbot_altcha_challenge_request_data.algorithm,this.notbot_altcha_challenge_request_data.maxnumber).promise.then(function(e){t.request_count++;var n=E.Merge(t.notbot_altcha_challenge_request_data,e);delete n.ajaxurl,delete n._wpnonce,delete n._rest_url,fetch(t.shield_ajaxurl,t.constructFetchRequestData(n)).then(function(t){return t.text()}).then(function(t){if(E.IsEmpty(c.ParseIt(t)))throw new Error("Data in the altcha request could not be parsed.");return t}).then(function(){return t.reFire()}).catch(function(t){console.log("hasAltchaChallengeData() error: "+t)}).finally(function(){t.notbot_altcha_challenge_request_data=null})})):this.performPathNotbot().finally():this.isNotBotRequired()?this.performPathNotbot().finally():this.reFire()}},{key:"reFire",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12e4;this.start_refire_at=Date.now(),window.setTimeout(function(){0===e||t.windowHasHadFocus()?t.fire():t.reFire(2500)},e)}},{key:"performPathNotbot",value:(u=A(N().m(function t(){return N().w(function(t){for(;;)if(0===t.n)return t.a(2,this.fetch_NotBot())},t,this)})),function(){return u.apply(this,arguments)})},{key:"hasAltchaChallengeData",value:function(){return this.verifyAltchaChallengeData(this.notbot_altcha_challenge_request_data)}},{key:"verifyAltchaChallengeData",value:function(t){var e=null!==t;return e&&(["challenge","salt","algorithm","maxnumber","expires"].forEach(function(n){Object.keys(t).includes(n)||(e=!1)}),e=e&&Math.round(Date.now()/1e3)<t.expires),e}},{key:"isNotBotRequired",value:function(){return"1"===R.Retrieve("force_notbot")||!this.getNonRequiredFlagsFromCookie().includes("notbot")}},{key:"isAltchaChallengeRequired",value:function(){return"1"===R.Retrieve("force_notbot")||!this.getNonRequiredFlagsFromCookie().includes("altcha")}},{key:"getNonRequiredFlagsFromCookie",value:function(){var t=[],e=j.Get("icwp-wpsf-notbot"),n=("undefined"===C(e)||void 0===e||""===e?"":e).split("Z"),r=n.pop();if(r){var o=/^exp-([0-9]+)$/.exec(r);o&&Math.round(Date.now()/1e3)<Number(o[1])&&(t=n)}return t}},{key:"fetch_NotBot",value:(a=A(N().m(function t(){var e,n=this;return N().w(function(t){for(;;)if(0===t.n)return this.request_count++,delete(e=E.ObjClone(this._base_data.ajax.not_bot)).ajaxurl,delete e._rest_url,delete e._wpnonce,t.a(2,fetch(this.shield_ajaxurl,this.constructFetchRequestData(e)).then(function(t){return t.text()}).then(function(t){var e=c.ParseIt(t);if(E.IsEmpty(e)||!("data"in e))throw new Error("Data in the notbot request could not be parsed.");if("altcha_data"in e.data&&n.verifyAltchaChallengeData(e.data.altcha_data))n.notbot_altcha_challenge_request_data=e.data.altcha_data;else if(n.isAltchaChallengeRequired())throw new Error("Could not verify the altcha challenge data in response.");return e}).then(function(){return n.reFire(0)}).catch(function(t){n.failed_request_count++,console.log("fetch_NotBot() error: "+t)}))},t,this)})),function(){return a.apply(this,arguments)})},{key:"constructFetchRequestData",value:function(t){return{method:"POST",body:new URLSearchParams(t).toString(),headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8","X-Requested-With":"XMLHttpRequest"}}}},{key:"windowHasHadFocus",value:function(){return this.window_focus_at>this.window_blur_at||this.window_focus_at>this.start_refire_at}}],r&&B(n.prototype,r),i&&B(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i,a,u}(w);"shield_vars_notbot"in window&&new J(window.shield_vars_notbot.comps.notbot)})();