/home/silvwabw/public_html/wp-content/plugins/gutenverse/assets/js/frontend/countdown.js
(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t){var r=function(t){if("object"!=e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(r)?r:r+""}function r(e,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,t(o.key),o)}}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}function o(e,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o(e,t)}const i=gutenverseCoreFrontend;function a(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(a=function(){return!!e})()}var u=function(t){function u(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),t=this,o=arguments,r=n(r=u),function(t,r){if(r&&("object"==e(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}(t,a()?Reflect.construct(r,o||[],n(t).constructor):r.apply(t,o));var t,r,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&o(e,t)}(u,t),c=u,l=[{key:"init",value:function(){var e=this;this._elements.map(function(t){e._countDown(t)})}},{key:"_countDown",value:function(e){var t=this,r=(0,i.u)(e),n=JSON.parse(r.data("duedate")),o=setInterval(function(){try{t.__handleTimer(r,n,o)}catch(e){console.error("Error during countdown:",e),clearInterval(o)}},1e3)}},{key:"__handleTimer",value:function(e,t,r){var n=new Date(t)-new Date,o=JSON.parse(e.data("expired"));if(n<=0){if("redirect"===o.action){var i=o.url;try{var a=new URL(i);["http:","https:"].includes(a.protocol)?window.location.assign(i):(console.error("Invalid URL scheme detected. Redirection aborted."),clearInterval(r))}catch(e){console.error("Invalid URL format. Redirection aborted:",e),clearInterval(r)}}else if("section"===o.action){var u=e.find(".countdown-expired-wrapper");u&&u.attr("style","display: block;")}}else{var c,l,f,p=e.find(".days-wrapper"),s=e.find(".hours-wrapper"),d=e.find(".minutes-wrapper"),y=e.find(".seconds-wrapper"),v=null;p?(c=Math.floor(n/864e5),l=Math.floor(n%864e5/36e5),f=Math.floor(n%36e5/6e4),v=Math.floor(n%6e4/1e3)):s?(l=Math.floor(n/36e5),f=Math.floor(n%36e5/6e4),v=Math.floor(n%6e4/1e3)):d?(f=Math.floor(n/6e4),v=Math.floor(n%6e4/1e3)):v=Math.floor(n/1e3),null!=c&&p.find(".countdown-value").html(c),null!=l&&s.find(".countdown-value").html(l),null!=f&&d.find(".countdown-value").html(f),null!=v&&y.find(".countdown-value").html(v)}}}],l&&r(c.prototype,l),Object.defineProperty(c,"prototype",{writable:!1}),c;var c,l}(i.Default),c=(0,i.u)(".guten-countdown");c&&new u(c)})();