text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Modly=t()}(this,function(){"use strict";var c,d,m,p,e,t={animation:{enabled:!0,duration:300},className:"",closeButton:{enabled:!0},content:"",overlay:{enabled:!0},position:"center",sizes:{width:900},theme:"light"},o=(e=document.createElement("div")).style.WebkitTransition?"webkitTransitionEnd":e.style.OTransition?"oTransitionEnd":"transitionend",n=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};d?this.close.call(this,null,a.bind(this,e)):a.call(this,e)};function a(e){p=Object.assign({},t,e),function(){var e,t,n;e="string"==typeof p.content?p.content:p.content.outerHTML;n=document.createDocumentFragment(),(d=document.createElement("div")).className="modly-wrapper ".concat(p.className),d.style.transitionDuration="".concat(p.animation.duration/1e3,"s");var o=function(){var e,t;switch(p.position){case"center":t=e="center";break;case"top":e="center",t="flex-start";break;case"top-right":e="flex-end",t="flex-start";break;case"right":e="flex-end",t="center";break;case"bottom-right":t=e="flex-end";break;case"bottom":e="center",t="flex-end";break;case"bottom-left":e="flex-start",t="flex-end";break;case"left":e="flex-start",t="center";break;case"top-left":t=e="flex-start"}return{horizontal:e,vertical:t}}(),a=o.horizontal,i=o.vertical;d.style.justifyContent=a,d.style.alignItems=i,(m=document.createElement("div")).className="modly",m.style.width="".concat(p.sizes.width,"px"),m.style.maxWidth="100%",m.style.transitionDuration="".concat(p.animation.duration/1e3,"s"),d.appendChild(m),p.closeButton.enabled&&((c=document.createElement("button")).className="modly-close",c.innerHTML="×",m.appendChild(c));(t=document.createElement("div")).className="modly-content",t.innerHTML=e,m.appendChild(t),n.appendChild(d),document.body.appendChild(n),function(){var e,t,n,o,a=document.head,i=document.createElement("style");p.theme,e="rgba(62, 61, 64, 0.8)",t="#ffffff",o=n="#000000";var r=" .modly-wrapper * { box-sizing: border-box; } .modly-wrapper { background-color: ".concat(e,"; display: flex; position: fixed; top: 0; right: 0; bottom: 0; left: 0; opacity: 0; overflow-y: auto; transition-property: opacity; transition-timing-function: ease; } .modly-wrapper.modly-anchored { align-items: flex-start; } .modly { background-color: ").concat(t,"; color: ").concat(n,"; margin: 1.4em; padding: 1.5em; position: relative; border-radius: 5px; opacity: 0; transition-property: opacity; transition-timing-function: ease; } .modly * { max-width: 100%; } .modly-open { opacity: 1; } .modly-close { background: none; border: 0; border-radius: 0; box-shadow: none; color: ").concat(o,"; font-family: serif; font-size: 1.5em; height: 1em; line-height: 1; padding: 0; cursor: pointer; position: absolute; right: 0; top: 0; width: 1em; } ");i.type="text/css",i.styleSheet?i.styleSheet.cssText=r:i.appendChild(document.createTextNode(r));a.appendChild(i)}.call(this);var r=d.className+" modly-open",l=m.className+" modly-open",s=window.getComputedStyle?window.getComputedStyle(m):m.currentStyle;m.offsetHeight+(parseInt(s.marginTop)||0)+(parseInt(s.marginBottom)||0)>window.innerHeight&&(r+=" modly-anchored");d.className=r,m.className=l}.call(this),function(){!0===p.closeButton.enabled&&c.addEventListener("click",this.close.bind(this));p.overlay.enabled&&(m.addEventListener("click",function(e){e.stopPropagation()}),d.addEventListener("click",this.close.bind(this)))}.call(this)}return n.prototype.close=function(e,t){var n=this;m.addEventListener(o,function(){d.parentNode.removeChild(d),p=m=d=c=void 0,t&&t.call(n)}),d.className=d.className.replace(" modly-open",""),m.className=m.className.replace(" modly-open","")},n});