!function(a,b){if("function"==typeof define&&define.amd)define(["exports"],b);else if("undefined"!=typeof exports)b(exports);else{var c={};b(c),a.bodyScrollLock=c}}(this,function(b){"use strict";function g(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}Object.defineProperty(b,"__esModule",{value:!0});var h=!1;if("undefined"!=typeof window){var i={get passive(){h=!0}};window.addEventListener("testPassive",null,i),window.removeEventListener("testPassive",null,i)}var j,k,p="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&/iP(ad|hone|od)/.test(window.navigator.platform),d=[],n=!1,q=-1,w=function(a){return d.some(function(b){return b.options.allowTouchMove&&b.options.allowTouchMove(a)})},f=function(a){var b=a||window.event;return!!w(b.target)||1<b.touches.length||(b.preventDefault&&b.preventDefault(),!1)},e=function(){setTimeout(function(){void 0!==k&&(document.body.style.paddingRight=k,k=void 0),void 0!==j&&(document.body.style.overflow=j,j=void 0)})};b.disableBodyScroll=function(a,b){if(p){if(!a)return void console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");if(a&&!d.some(function(b){return b.targetElement===a})){d=[].concat(g(d),[{targetElement:a,options:b||{}}]),a.ontouchstart=function(a){1===a.targetTouches.length&&(q=a.targetTouches[0].clientY)},a.ontouchmove=function(b){var c,d,e,g;1===b.targetTouches.length&&(d=a,g=(c=b).targetTouches[0].clientY-q,!w(c.target)&&(d&&0===d.scrollTop&&0<g?f(c):(e=d)&&e.scrollHeight-e.scrollTop<=e.clientHeight&&0>g?f(c):c.stopPropagation()))},n||(document.addEventListener("touchmove",f,h?{passive:!1}:void 0),n=!0)}}else{c=b,setTimeout(function(){if(void 0===k){var a=!!c&&!0===c.reserveScrollBarGap,b=window.innerWidth-document.documentElement.clientWidth;a&&0<b&&(k=document.body.style.paddingRight,document.body.style.paddingRight=b+"px")}void 0===j&&(j=document.body.style.overflow,document.body.style.overflow="hidden")});d=[].concat(g(d),[{targetElement:a,options:b||{}}])}var c},b.clearAllBodyScrollLocks=function(){p?(d.forEach(function(a){a.targetElement.ontouchstart=null,a.targetElement.ontouchmove=null}),n&&(document.removeEventListener("touchmove",f,h?{passive:!1}:void 0),n=!1),d=[],q=-1):(e(),d=[])},b.enableBodyScroll=function(a){if(p){if(!a)return void console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");a.ontouchstart=null,a.ontouchmove=null,d=d.filter(function(b){return b.targetElement!==a}),n&&0===d.length&&(document.removeEventListener("touchmove",f,h?{passive:!1}:void 0),n=!1)}else 1===d.length&&d[0].targetElement===a?(e(),d=[]):d=d.filter(function(b){return b.targetElement!==a})}}),function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.MicroModal=b()}(this,function(){"use strict";var a=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},b=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),c=function(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)},d=function(a,b){Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(a){for(var b=(this.document||this.ownerDocument).querySelectorAll(a),c=b.length;0<=--c&&b.item(c)!==this;);return-1<c});for(var c=[];a&&a!==document;a=a.parentNode){if(b){a.matches(b)&&c.push(a);continue}c.push(a)}return c},e=function(){var e=["a[href]","area[href]","input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden])","select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","[contenteditable]","[tabindex]:not([tabindex^=\"-\"])"],f=function(){function f(b){var d=b.targetModal,e=b.triggers,g=void 0===e?[]:e,h=b.onShow,i=void 0===h?function(){}:h,j=b.onClose,k=void 0===j?function(){}:j,l=b.openTrigger,m=void 0===l?"data-micromodal-trigger":l,n=b.closeTrigger,o=void 0===n?"data-micromodal-close":n,p=b.disableScroll,q=void 0!==p&&p,r=b.disableFocus,s=void 0!==r&&r,t=b.awaitCloseAnimation,u=void 0!==t&&t,v=b.debugMode,w=void 0!==v&&v;a(this,f),this.modal=document.getElementById(d),this.config={debugMode:w,disableScroll:q,openTrigger:m,closeTrigger:o,onShow:i,onClose:k,awaitCloseAnimation:u,disableFocus:s},0<g.length&&this.registerTriggers.apply(this,c(g)),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this)}return b(f,[{key:"registerTriggers",value:function a(){for(var b=this,c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];d.forEach(function(a){a.addEventListener("click",function(){return b.showModal()})})}},{key:"showModal",value:function a(){this.activeElement=document.activeElement,this.zindexfix(this.modal),this.modal.setAttribute("aria-hidden","false"),this.scrollBehaviour("disable"),this.modal.classList.add("is-open"),this.setFocusToFirstNode(),this.addEventListeners(),this.config.onShow(this.modal)}},{key:"closeModal",value:function a(){var b=this.modal,c=this.config;this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.scrollBehaviour("enable"),this.activeElement.focus(),this.activeElement.blur(),this.zindexunfix(this.modal),this.config.awaitCloseAnimation?this.modal.addEventListener("animationend",function a(){b.classList.remove("is-open"),c.onClose(b),b.removeEventListener("animationend",a,!1)},!1):(b.classList.remove("is-open"),c.onClose(b))}},{key:"closeModalById",value:function b(a){this.modal=document.getElementById(a),this.modal&&this.closeModal()}},{key:"zindexfix",value:function b(a){for(var c=d(a,".wp-block-kadence-rowlayout"),e=d(a,".wp-block-kadence-column"),f=0;f<c.length;f++)Object.assign(c[f].style,{zIndex:1500,position:"relative"});for(var f=0;f<e.length;f++)Object.assign(e[f].style,{zIndex:1500,position:"relative"})}},{key:"zindexunfix",value:function b(a){for(var c=d(a,".wp-block-kadence-rowlayout"),e=0;e<c.length;e++)Object.assign(c[e].style,{zIndex:"",position:""});for(var f=d(a,".wp-block-kadence-column"),e=0;e<f.length;e++)Object.assign(f[e].style,{zIndex:"",position:""})}},{key:"scrollBehaviour",value:function b(a){if(this.config.disableScroll){var c=document.querySelector(".kt-modal-overlay");switch(a){case"enable":document.body.classList.remove("kadence-scrollbar-fixer"),document.body.classList.remove("kt-modal-open");break;case"disable":var d=window.innerWidth-document.documentElement.clientWidth;document.body.style.setProperty("--scrollbar-offset",d+"px"),document.body.classList.add("kadence-scrollbar-fixer"),document.body.classList.add("kt-modal-open");break;default:}}}},{key:"addEventListeners",value:function a(){this.modal.addEventListener("touchstart",this.onClick),this.modal.addEventListener("click",this.onClick),document.addEventListener("keydown",this.onKeydown)}},{key:"removeEventListeners",value:function a(){this.modal.removeEventListener("touchstart",this.onClick),this.modal.removeEventListener("click",this.onClick),document.removeEventListener("keydown",this.onKeydown)}},{key:"onClick",value:function b(a){a.target.hasAttribute(this.config.closeTrigger)&&(this.closeModal(),a.preventDefault())}},{key:"onKeydown",value:function b(a){27===a.keyCode&&this.closeModal(a),9===a.keyCode&&this.maintainFocus(a)}},{key:"getFocusableNodes",value:function a(){var b=this.modal.querySelectorAll(e);return Object.keys(b).map(function(a){return b[a]})}},{key:"setFocusToFirstNode",value:function a(){if(!this.config.disableFocus){var b=this.getFocusableNodes();b.length&&b[0].focus()}}},{key:"maintainFocus",value:function b(a){var c=this.getFocusableNodes();if(!this.modal.contains(document.activeElement))c[0].focus();else{var d=c.indexOf(document.activeElement);a.shiftKey&&0===d&&(c[c.length-1].focus(),a.preventDefault()),a.shiftKey||d!==c.length-1||(c[0].focus(),a.preventDefault())}}}]),f}(),g=null,h=function c(a,b){var d=[];return a.forEach(function(a){var c=a.attributes[b].value;void 0===d[c]&&(d[c]=[]),d[c].push(a)}),d},i=function b(a){if(!document.getElementById(a))return console.warn("MicroModal v0.3.2: \u2757Seems like you have missed %c'"+a+"'","background-color: #f8f9fa;color: #50596c;font-weight: bold;","ID somewhere in your code. Refer example below to resolve it."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;","<div class=\"modal\" id=\""+a+"\"></div>"),!1},j=function b(a){if(0>=a.length)return console.warn("MicroModal v0.3.2: \u2757Please specify at least one %c'micromodal-trigger'","background-color: #f8f9fa;color: #50596c;font-weight: bold;","data attribute."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;","<a href=\"#\" data-micromodal-trigger=\"my-modal\"></a>"),!1},k=function c(a,b){if(j(a),!b)return!0;for(var d in b)i(d);return!0},l=function c(a,b){var d=b||{};d.targetModal=a;!0===d.debugMode&&!1===i(a)||(g=new f(d),g.showModal())},m=function b(a){a?g.closeModalById(a):g.closeModal()};return{init:function b(a){var d=Object.assign({},{openTrigger:"data-micromodal-trigger"},a),e=[].concat(c(document.querySelectorAll("["+d.openTrigger+"]"))),g=h(e,d.openTrigger);if(!0!==d.debugMode||!1!==k(e,g))for(var i in g){var j=g[i];d.targetModal=i,d.triggers=[].concat(c(j)),new f(d)}},show:l,close:m}}();return e});function initializeMicroModal(){for(var a=document.getElementsByClassName("modal-trigger"),b=0;b<a.length;b++)if(a[b].hasAttribute("href")){var c=a[b].getAttribute("href").replace("#","");c&&(a[b].setAttribute("data-modal-open",c),a[b].setAttribute("tabindex",0),a[b].setAttribute("href","javascript:;"))}else if(a[b].hasChildNodes()){var d=a[b].getElementsByTagName("a")[0];if(d&&d.hasAttribute("href")){var c=a[b].getElementsByTagName("a")[0].getAttribute("href").replace("#","");c&&(d.setAttribute("data-modal-open",c),d.setAttribute("tabindex",0),d.setAttribute("href","javascript:;"))}}const e={onShow:a=>{var b=window.document.createEvent("UIEvents");b.initUIEvent("resize",!0,!1,window,0),window.dispatchEvent(b)},onClose:a=>{},openTrigger:"data-modal-open",closeTrigger:"data-modal-close",disableScroll:!0,disableFocus:!1,awaitCloseAnimation:!0,debugMode:!1};MicroModal.init(e);const f=window.location.hash.substring(1);if(f){var g=document.getElementById(f);g&&g.classList.contains("kadence-block-pro-modal")&&MicroModal.show(f,e)}}initializeMicroModal(),window.addEventListener("kb-query-loaded",function(a){initializeMicroModal()},!1);