!function(e,t){module.exports=t();}(commonjsGlobal,(function(){functione(e,t){for(varo=0;o<t.length;o++){varn=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"inn&&(n.writable=!0),Object.defineProperty(e,n.key,n);}}functiont(e){returnfunction(e){if(Array.isArray(e))returno(e)}(e)||function(e){if("undefined"!=typeofSymbol&&Symbol.iteratorinObject(e))returnArray.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeofe)returno(e,t);varn=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)returnArray.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))returno(e,t)}(e)||function(){thrownewTypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}functiono(e,t){(null==t||t>e.length)&&(t=e.length);for(varo=0,n=newArray(t);o<t;o++)n[o]=e[o];returnn}varn,i,a,r,s,l=(n=["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^="-"])'],i=function(){functiono(e){varn=e.targetModal,i=e.triggers,a=void0===i?[]:i,r=e.onShow,s=void0===r?function(){}:r,l=e.onClose,c=void0===l?function(){}:l,d=e.openTrigger,u=void0===d?"data-micromodal-trigger":d,f=e.closeTrigger,h=void0===f?"data-micromodal-close":f,v=e.openClass,g=void0===v?"is-open":v,m=e.disableScroll,b=void0!==m&&m,y=e.disableFocus,p=void0!==y&&y,w=e.awaitCloseAnimation,E=void0!==w&&w,k=e.awaitOpenAnimation,M=void0!==k&&k,A=e.debugMode,C=void0!==A&&A;!function(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}(this,o),this.modal=document.getElementById(n),this.config={debugMode:C,disableScroll:b,openTrigger:u,closeTrigger:h,openClass:g,onShow:s,onClose:c,awaitCloseAnimation:E,awaitOpenAnimation:M,disableFocus:p},a.length>0&&this.registerTriggers.apply(this,t(a)),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this);}vari,a;returni=o,(a=[{key:"registerTriggers",value:function(){for(vare=this,t=arguments.length,o=newArray(t),n=0;n<t;n++)o[n]=arguments[n];o.filter(Boolean).forEach((function(t){t.addEventListener("click",(function(t){returne.showModal(t)}));}));}},{key:"showModal",value:function(){vare=this,t=arguments.length>0&&void0!==arguments[0]?arguments[0]:null;if(this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),this.modal.classList.add(this.config.openClass),this.scrollBehaviour("disable"),this.addEventListeners(),this.config.awaitOpenAnimation){varo=functiont(){e.modal.removeEventListener("animationend",t,!1),e.setFocusToFirstNode();};this.modal.addEventListener("animationend",o,!1);}elsethis.setFocusToFirstNode();this.config.onShow(this.modal,this.activeElement,t);}},{key:"closeModal",value:function(){vare=arguments.length>0&&void0!==arguments[0]?arguments[0]:null,t=this.modal;if(this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.scrollBehaviour("enable"),this.activeElement&&this.activeElement.focus&&this.activeElement.focus(),this.config.onClose(this.modal,this.activeElement,e),this.config.awaitCloseAnimation){varo=this.config.openClass;this.modal.addEventListener("animationend",(functione(){t.classList.remove(o),t.removeEventListener("animationend",e,!1);}),!1);}elset.classList.remove(this.config.openClass);}},{key:"closeModalById",value:function(e){this.modal=document.getElementById(e),this.modal&&this.closeModal();}},{key:"scrollBehaviour",value:function(e){if(this.config.disableScroll){vart=document.querySelector("body");switch(e){case"enable":Object.assign(t.style,{overflow:""});break;case"disable":Object.assign(t.style,{overflow:"hidden"});}}}},{key:"addEventListeners",value:function(){this.modal.addEventListener("touchstart",this.onClick,{passive:!0}),this.modal.addE