(function(f,m){typeof exports=="object"&&typeof module<"u"?module.exports=m():typeof define=="function"&&define.amd?define(m):(f=typeof globalThis<"u"?globalThis:f||self,f.RevealZoom=m())})(this,(function(){"use strict";const f={id:"zoom",init:function(n){n.getRevealElement().addEventListener("mousedown",function(i){var l=/Linux/.test(window.navigator.platform)?"ctrl":"alt",r=(n.getConfig().zoomKey?n.getConfig().zoomKey:l)+"Key",s=n.getConfig().zoomLevel?n.getConfig().zoomLevel:2;i[r]&&!n.isOverview()&&(i.preventDefault(),u.to({x:i.clientX,y:i.clientY,scale:s,pan:!1}))})},destroy:()=>{u.reset()}},m=()=>f;var u=(function(){var n=1,i=0,l=0,r=-1,s=-1,y="transform"in document.body.style;y&&(document.body.style.transition="transform 0.8s ease"),document.addEventListener("keyup",function(e){n!==1&&e.keyCode===27&&u.out()}),document.addEventListener("mousemove",function(e){n!==1&&(i=e.clientX,l=e.clientY)});function c(e,t){var o=w();if(e.width=e.width||1,e.height=e.height||1,e.x-=(window.innerWidth-e.width*t)/2,e.y-=(window.innerHeight-e.height*t)/2,y)if(t===1)document.body.style.transform="";else{var d=o.x+"px "+o.y+"px",h="translate("+-e.x+"px,"+-e.y+"px) scale("+t+")";document.body.style.transformOrigin=d,document.body.style.transform=h}else t===1?(document.body.style.position="",document.body.style.left="",document.body.style.top="",document.body.style.width="",document.body.style.height="",document.body.style.zoom=""):(document.body.style.position="relative",document.body.style.left=-(o.x+e.x)/t+"px",document.body.style.top=-(o.y+e.y)/t+"px",document.body.style.width=t*100+"%",document.body.style.height=t*100+"%",document.body.style.zoom=t);n=t,document.documentElement.classList&&(n!==1?document.documentElement.classList.add("zoomed"):document.documentElement.classList.remove("zoomed"))}function a(){var e=.12,t=window.innerWidth*e,o=window.innerHeight*e,d=w();l<o?window.scroll(d.x,d.y-(1-l/o)*(14/n)):l>window.innerHeight-o&&window.scroll(d.x,d.y+(1-(window.innerHeight-l)/o)*(14/n)),i<t?window.scroll(d.x-(1-i/t)*(14/n),d.y):i>window.innerWidth-t&&window.scroll(d.x+(1-(window.innerWidth-i)/t)*(14/n),d.y)}function w(){return{x:window.scrollX!==void 0?window.scrollX:window.pageXOffset,y:window.scrollY!==void 0?window.scrollY:window.pageYOffset}}return{to:function(e){if(n!==1)u.out();else{if(e.x=e.x||0,e.y=e.y||0,e.element){var t=20,o=e.element.getBoundingClientRect();e.x=o.left-t,e.y=o.top-t,e.width=o.width+t*2,e.height=o.height+t*2}e.width!==void 0&&e.height!==void 0&&(e.scale=Math.max(Math.min(window.innerWidth/e.width,window.innerHeight/e.height),1)),e.scale>1&&(e.x*=e.scale,e.y*=e.scale,c(e,e.scale),e.pan!==!1&&(r=setTimeout(function(){s=setInterval(a,1e3/60)},800)))}},out:function(){clearTimeout(r),clearInterval(s),c({x:0,y:0},1),n=1},magnify:function(e){this.to(e)},reset:function(){this.out()},zoomLevel:function(){return n}}})();return m}));
