/home/silvwabw/public_html/wp-content/plugins/gutenverse/assets/js/frontend/popup-builder.js
(()=>{"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t){return e="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},e(t)}function n(t){var n=function(t){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,"string");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(n)?n:n+""}function o(t,e){for(var o=0;o<e.length;o++){var i=e[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function i(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}function r(t,e){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},r(t,e)}const s=gutenverseCoreFrontend;function u(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(u=function(){return!!t})()}var l=function(n){function o(){return t(this,o),n=this,r=arguments,i=a(i=o),function(t,n){if(n&&("object"==e(n)||"function"==typeof n))return n;if(void 0!==n)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)}(n,u()?Reflect.construct(i,r||[],a(n).constructor):i.apply(n,r));var n,i,r}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&&r(t,e)}(o,n),i(o,[{key:"init",value:function(){var t=this;this._elements.map(function(e){new p({element:e,playAnimation:t.playAnimation,getAnimationClass:t.getAnimationClass}),t.playAnimation((0,s.u)(e).find(".guten-popup-content"))})}}])}(s.Default),p=function(){return i(function e(n){var o=n.element,i=n.playAnimation,a=n.getAnimationClass;if(t(this,e),this.element=(0,s.u)(o),this.popup=this.element.find(".guten-popup"),this.overlay=this.element.find(".guten-popup-overlay"),this.closeButton=this.element.find(".guten-popup-close"),this.closeOverlay=this.element.data("close-overlay"),this.dontRepeatPopup=this.element.data("hide"),this.stickyWrapper=this.element.find(".sticky-wrapper"),this.wrapperId=this.stickyWrapper.data("id"),this.wrapper=this.element.find(".guten-popup-wrapper"),this.content=this.element.find(".guten-popup-content"),this.contentClass=this.content.attr("class"),this.playAnimation=i,this.getAnimationClass=a,this.hasExitAnimation=this.element.data("exit-animation"),this.exitAnimationDuration=this.element.data("exit-duration"),this.exitAnimationDelay=this.element.data("exit-delay"),this.shownOnce=localStorage.getItem(this.dontRepeatPopup),this.videoContainer=this.element.find(".guten-popup-video-container"),this._addCloseClick(),this._addLoadEvent(),null!==this.dontRepeatPopup&&void 0!==this.dontRepeatPopup||localStorage.removeItem(localStorage.getItem("data-hide")),this.videoContainer){var r=this.videoContainer;this.videoPlayOn=this.element.data("video-play-on"),this.videoPauseOnClose=this.element.data("video-pause-onclose"),this.videoResetOnClose=this.element.data("video-reset-onclose"),this.videoStart=this.element.data("video-start");var u=null;setTimeout(function(){var t,e=null==r||null===(t=r.find("iframe"))||void 0===t?void 0:t.first();if(e){var n=null==e?void 0:e.id,o=null==e?void 0:e.src.toLowerCase();window.YT&&(o.includes("youtube.com")||o.includes("youtube.be"))&&(u=window.YT.get(n))}else{var i;u=null==r||null===(i=r.find("video"))||void 0===i?void 0:i.first()}},500),this.player=function(){return{playVideo:function(){u&&(u.playVideo&&u.playVideo(),u.play&&u.play())},pauseVideo:function(){u&&(u.pauseVideo&&u.pauseVideo(),u.pause&&u.pause())},seekTo:function(t){u&&(u.seekTo&&u.seekTo(t),u.currentTime&&u.play&&(u.currentTime=t,u.play()))}}}}},[{key:"_showPopup",value:function(){if((null===this.dontRepeatPopup||(localStorage.setItem("data-hide",this.dontRepeatPopup),null===this.shownOnce))&&(this.playAnimation(this.element.find(".guten-popup-content")),this.popup.addClass("show"),this.playAnimation(this.content),this.videoContainer)){var t,e;if("true"===this.videoResetOnClose&&(null===(t=this.player())||void 0===t||t.seekTo(this.videoStart?this.videoStart:0)),"first"===this.videoPlayOn&&this.firstPlaying)return;"first"!==this.videoPlayOn&&"every"!==this.videoPlayOn||(null===(e=this.player())||void 0===e||e.playVideo(),"first"===this.videoPlayOn&&(this.firstPlaying=!0))}}},{key:"_closePopup",value:function(){var t=this;null!==this.dontRepeatPopup&&localStorage.setItem(this.dontRepeatPopup,!0),this.content.addClass("exit"),setTimeout(function(){var e;t.popup.removeClass("show"),t.content.removeClass("exit"),t.popup.addClass("load"),t.content.attr("class",t.contentClass),"true"===t.videoPauseOnClose&&(null===(e=t.player())||void 0===e||e.pauseVideo())},this.hasExitAnimation&&(this.exitAnimationDuration||this.exitAnimationDelay)?(parseInt(this.exitAnimationDuration)||0)+(parseInt(this.exitAnimationDelay)||0):0)}},{key:"_addCloseClick",value:function(){var t=this;this.closeButton.on("click",function(e){e.stopPropagation(),t._closePopup()}),"true"===this.closeOverlay&&(this.overlay.on("click",function(e){e.stopPropagation(),t._closePopup()}),this.wrapper.on("click",function(e){e.stopPropagation(),t.content.first().contains(e.target)||t._closePopup()}))}},{key:"_addLoadEvent",value:function(){var t,e,n,o,i=this,a=0,r=this.element.data("trigger"),u=function(){return i.popup.hasClass("load")};switch(r){case"load":e=(e=this.element.data("wait"))||0,u()||setTimeout(function(){i._showPopup()},e);break;case"scroll":n=(n=this.element.data("scroll"))||0,(0,s.u)(document).on("scroll",function(){(window.pageYOffset||document.documentElement.scrollTop)-(document.documentElement.clientTop||0)>n&&!u()&&i._showPopup()});break;case"click":t=(t=this.element.data("anchor"))||"",o=(o=this.element.data("max-click"))?parseInt(o):void 0,(0,s.u)(document).find('*[href="#'.concat(t,'"]')).on("click",function(t){(!o||a<o)&&(i._showPopup(),a+=1),t.preventDefault()}),(0,s.u)(document).find("#".concat(t)).on("click",function(t){(!o||a<o)&&(i._showPopup(),a+=1),t.preventDefault()}),(0,s.u)(document).find(".guten-wrap-helper[onclick^=\"window.open('#".concat(t,"'\"]")).on("click",function(t){(!o||a<o)&&(i._showPopup(),a+=1),t.preventDefault()});break;case"hover":t=(t=this.element.data("anchor"))||"",o=(o=this.element.data("max-click"))?parseInt(o):void 0,(0,s.u)(document).find('*[href="#'.concat(t,'"]')).on("mouseover",function(){(!o||a<o)&&(i._showPopup(),a+=1)}),(0,s.u)(document).find("#".concat(t)).on("mouseover",function(t){(!o||a<o)&&(i._showPopup(),a+=1),t.preventDefault()}),(0,s.u)(document).find(".guten-wrap-helper[onclick^=\"window.open('#".concat(t,"'\"]")).on("mouseover",function(t){(!o||a<o)&&(i._showPopup(),a+=1),t.preventDefault()});break;case"exit":(0,s.u)(document.body).on("mouseleave",function(t){0>t.clientY&&!u()&&i._showPopup()})}}}])}(),c=(0,s.u)(".guten-popup-builder");c&&new l(c)})();