!function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.PhotoSwipe=t()}(this,function(){"use strict";return function(e,t,n,i){var o={features:null,bind:function(e,t,n,i){var o=(i?"remove":"add")+"EventListener";t=t.split(" ");for(var a=0;a0&&(a=parseInt(a[1],10))>=1&&8>a&&(n.isOldIOSPhone=!0)}var r=i.match(/Android\s([0-9\.]*)/),l=r?r[1]:0;(l=parseFloat(l))>=1&&(4.4>l&&(n.isOldAndroid=!0),n.androidVersion=l),n.isMobileOpera=/opera mini|opera mobi/i.test(i)}for(var s,u,c=["transform","perspective","animationName"],d=["","webkit","Moz","ms","O"],p=0;4>p;p++){t=d[p];for(var m=0;3>m;m++)s=c[m],u=t+(t?s.charAt(0).toUpperCase()+s.slice(1):s),!n[s]&&u in e&&(n[s]=u);t&&!n.raf&&(t=t.toLowerCase(),n.raf=window[t+"RequestAnimationFrame"],n.raf&&(n.caf=window[t+"CancelAnimationFrame"]||window[t+"CancelRequestAnimationFrame"]))}if(!n.raf){var f=0;n.raf=function(e){var t=(new Date).getTime(),n=Math.max(0,16-(t-f)),i=window.setTimeout(function(){e(t+n)},n);return f=t+n,i},n.caf=function(e){clearTimeout(e)}}return n.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,o.features=n,n}};o.detectFeatures(),o.features.oldIE&&(o.bind=function(e,t,n,i){t=t.split(" ");for(var o,a=(i?"detach":"attach")+"Event",r=0;rt-1?e-t:0>e?t+e:e},De={},Te=function(e,t){return De[e]||(De[e]=[]),De[e].push(t)},Me=function(e){var t=De&&De[e];if(t){var n=Array.prototype.slice.call(arguments);n.shift();for(var i=0;ia.currItem.fitRatio?be||(ln(a.currItem,!1,!0),be=!0):be&&(ln(a.currItem),be=!1)),Ee(ne,pe.x,pe.y,y))},ke=function(e){e.container&&Ee(e.container.style,e.initialPosition.x,e.initialPosition.y,e.initialZoomLevel,e)},Re=function(e,t){t[A]=v+e+"px, 0px"+g},Ze=function(e,t){if(!r.loop&&t){var n=c+(ye.x*fe-e)/ye.x,i=Math.round(e-ft.x);(0>n&&i>0||n>=qt()-1&&0>i)&&(e=ft.x+i*r.mainScrollEndFriction)}ft.x=e,Re(e,d)},Pe=function(e,t){var n=ht[e]-he[e];return de[e]+ce[e]+n-n*(t/x)},Le=function(e,t){e.x=t.x,e.y=t.y,t.id&&(e.id=t.id)},Fe=function(e){e.x=Math.round(e.x),e.y=Math.round(e.y)},ze=null,_e=function(){ze&&(o.unbind(document,"mousemove",_e),o.addClass(e,"pswp--has_mouse"),r.mouseUsed=!0,Me("mouseUsed")),ze=setTimeout(function(){ze=null},100)},Ne=function(){o.bind(document,"keydown",a),z.transform&&o.bind(a.scrollWrap,"click",a),r.mouseUsed||o.bind(document,"mousemove",_e),o.bind(window,"resize scroll orientationchange",a),Me("bindEvents")},Ue=function(){o.unbind(window,"resize scroll orientationchange",a),o.unbind(window,"scroll",h.scroll),o.unbind(document,"keydown",a),o.unbind(document,"mousemove",_e),z.transform&&o.unbind(a.scrollWrap,"click",a),G&&o.unbind(window,m,a),clearTimeout(_),Me("unbindEvents")},He=function(e,t){var n=nn(a.currItem,me,e);return t&&(te=n),n},Ye=function(e){return e||(e=a.currItem),e.initialZoomLevel},We=function(e){return e||(e=a.currItem),e.w>0?r.maxSpreadZoom:1},Be=function(e,t,n,i){return i===a.currItem.initialZoomLevel?(n[e]=a.currItem.initialPosition[e],!0):(n[e]=Pe(e,i),n[e]>t.min[e]?(n[e]=t.min[e],!0):n[e]1?1:e.fitRatio,n=e.container.style,i=t*e.w,o=t*e.h;n.width=i+"px",n.height=o+"px",n.left=e.initialPosition.x+"px",n.top=e.initialPosition.y+"px"},Oe=function(){if(ne){var e=ne,t=a.currItem,n=t.fitRatio>1?1:t.fitRatio,i=n*t.w,o=n*t.h;e.width=i+"px",e.height=o+"px",e.left=pe.x+"px",e.top=pe.y+"px"}}},Xe=function(e){var t="";r.escKey&&27===e.keyCode?t="close":r.arrowKeys&&(37===e.keyCode?t="prev":39===e.keyCode&&(t="next")),t&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey||(e.preventDefault?e.preventDefault():e.returnValue=!1,a[t]()))},Ve=function(e){e&&(K||V||ie||W)&&(e.preventDefault(),e.stopPropagation())},Ke=function(){a.setScrollOffset(0,o.getScrollY())},qe={},$e=0,je=function(e){qe[e]&&(qe[e].raf&&R(qe[e].raf),$e--,delete qe[e])},Je=function(e){qe[e]&&je(e),qe[e]||($e++,qe[e]={})},Qe=function(){for(var e in qe)qe.hasOwnProperty(e)&&je(e)},et=function(e,t,n,i,o,a,r){var l,s=Se();Je(e);var u=function(){if(qe[e]){if((l=Se()-s)>=i)return je(e),a(n),void(r&&r());a((n-t)*o(l/i)+t),qe[e].raf=k(u)}};u()},tt={shout:Me,listen:Te,viewportSize:me,options:r,isMainScrollAnimating:function(){return ie},getZoomLevel:function(){return y},getCurrentIndex:function(){return c},isDragging:function(){return G},isZooming:function(){return J},setScrollOffset:function(e,t){he.x=e,F=he.y=t,Me("updateScrollOffset",he)},applyZoomPan:function(e,t,n,i){pe.x=t,pe.y=n,y=e,Oe(i)},init:function(){if(!l&&!s){var n;a.framework=o,a.template=e,a.bg=o.getChildByClass(e,"pswp__bg"),Z=e.className,l=!0,z=o.detectFeatures(),k=z.raf,R=z.caf,A=z.transform,L=z.oldIE,a.scrollWrap=o.getChildByClass(e,"pswp__scroll-wrap"),a.container=o.getChildByClass(a.scrollWrap,"pswp__container"),d=a.container.style,a.itemHolders=C=[{el:a.container.children[0],wrap:0,index:-1},{el:a.container.children[1],wrap:0,index:-1},{el:a.container.children[2],wrap:0,index:-1}],C[0].el.style.display=C[2].el.style.display="none",Ge(),h={resize:a.updateSize,orientationchange:function(){clearTimeout(_),_=setTimeout(function(){me.x!==a.scrollWrap.clientWidth&&a.updateSize()},500)},scroll:Ke,keydown:Xe,click:Ve};var i=z.isOldIOSPhone||z.isOldAndroid||z.isMobileOpera;for(z.animationName&&z.transform&&!i||(r.showAnimationDuration=r.hideAnimationDuration=0),n=0;nc||c>=qt())&&(c=0),a.currItem=Kt(c),(z.isOldIOSPhone||z.isOldAndroid)&&(ve=!1),e.setAttribute("aria-hidden","false"),r.modal&&(ve?e.style.position="fixed":(e.style.position="absolute",e.style.top=o.getScrollY()+"px")),void 0===F&&(Me("initialLayout"),F=P=o.getScrollY());var u="pswp--open ";for(r.mainClass&&(u+=r.mainClass+" "),r.showHideOpacity&&(u+="pswp--animate_opacity "),u+=O?"pswp--touch":"pswp--notouch",u+=z.animationName?" pswp--css_animation":"",u+=z.svg?" pswp--svg":"",o.addClass(e,u),a.updateSize(),p=-1,xe=null,n=0;3>n;n++)Re((n+p)*ye.x,C[n].el.style);L||o.bind(a.scrollWrap,f,a),Te("initialZoomInEnd",function(){a.setContent(C[0],c-1),a.setContent(C[2],c+1),C[0].el.style.display=C[2].el.style.display="block",r.focus&&e.focus(),Ne()}),a.setContent(C[1],c),a.updateCurrItem(),Me("afterInit"),ve||(w=setInterval(function(){$e||G||J||y!==a.currItem.initialZoomLevel||a.updateSize()},1e3)),o.addClass(e,"pswp--visible")}},close:function(){l&&(l=!1,s=!0,Me("close"),Ue(),jt(a.currItem,null,!0,a.destroy))},destroy:function(){Me("destroy"),Bt&&clearTimeout(Bt),e.setAttribute("aria-hidden","true"),e.className=Z,w&&clearInterval(w),o.unbind(a.scrollWrap,f,a),o.unbind(window,"scroll",a),wt(),Qe(),De=null},panTo:function(e,t,n){n||(e>te.min.x?e=te.min.x:ete.min.y?t=te.min.y:te;e++)C[e].item&&(C[e].item.needsUpdate=!0)},updateCurrItem:function(e){if(0!==xe){var t,n=Math.abs(xe);if(!(e&&2>n)){a.currItem=Kt(c),be=!1,Me("beforeChange",xe),n>=3&&(p+=xe+(xe>0?-3:3),n=3);for(var i=0;n>i;i++)xe>0?(t=C.shift(),C[2]=t,Re((++p+2)*ye.x,t.el.style),a.setContent(t,c-n+i+1+1)):(t=C.pop(),C.unshift(t),Re(--p*ye.x,t.el.style),a.setContent(t,c+n-i-1-1));if(ne&&1===Math.abs(xe)){var o=Kt(I);o.initialZoomLevel!==y&&(nn(o,me),ln(o),ke(o))}xe=0,a.updateCurrZoomItem(),I=c,Me("afterChange")}}},updateSize:function(t){if(!ve&&r.modal){var n=o.getScrollY();if(F!==n&&(e.style.top=n+"px",F=n),!t&&we.x===window.innerWidth&&we.y===window.innerHeight)return;we.x=window.innerWidth,we.y=window.innerHeight,e.style.height=we.y+"px"}if(me.x=a.scrollWrap.clientWidth,me.y=a.scrollWrap.clientHeight,Ke(),ye.x=me.x+Math.round(me.x*r.spacing),ye.y=me.y,Ze(ye.x*fe),Me("beforeResize"),void 0!==p){for(var i,l,s,u=0;3>u;u++)i=C[u],Re((u+p)*ye.x,i.el.style),s=c+u-1,r.loop&&qt()>2&&(s=Ie(s)),(l=Kt(s))&&(b||l.needsUpdate||!l.bounds)?(a.cleanSlide(l),a.setContent(i,s),1===u&&(a.currItem=l,a.updateCurrZoomItem(!0)),l.needsUpdate=!1):-1===i.index&&s>=0&&a.setContent(i,s),l&&l.container&&(nn(l,me),ln(l),ke(l));b=!1}x=y=a.currItem.initialZoomLevel,(te=a.currItem.bounds)&&(pe.x=te.center.x,pe.y=te.center.y,Oe(!0)),Me("resize")},zoomTo:function(e,t,n,i,a){t&&(x=y,ht.x=Math.abs(t.x)-pe.x,ht.y=Math.abs(t.y)-pe.y,Le(de,pe));var r=He(e,!1),l={};Be("x",r,l,e),Be("y",r,l,e);var s=y,u={x:pe.x,y:pe.y};Fe(l);var c=function(t){1===t?(y=e,pe.x=l.x,pe.y=l.y):(y=(e-s)*t+s,pe.x=(l.x-u.x)*t+u.x,pe.y=(l.y-u.y)*t+u.y),a&&a(t),Oe(1===t)};n?et("customZoomTo",0,1,n,i||o.easing.sine.inOut,c):c(1)}},nt={},it={},ot={},at={},rt={},lt=[],st={},ut=[],ct={},dt=0,pt={x:0,y:0},mt=0,ft={x:0,y:0},ht={x:0,y:0},yt={x:0,y:0},xt=function(e,t){return e.x===t.x&&e.y===t.y},vt=function(e,t){return Math.abs(e.x-t.x)<25&&Math.abs(e.y-t.y)<25},gt=function(e,t){return ct.x=Math.abs(e.x-t.x),ct.y=Math.abs(e.y-t.y),Math.sqrt(ct.x*ct.x+ct.y*ct.y)},wt=function(){q&&(R(q),q=null)},bt=function(){G&&(q=k(bt),zt())},Ct=function(){return!("fit"===r.scaleMode&&y===a.currItem.initialZoomLevel)},It=function(e,t){return!(!e||e===document)&&!(e.getAttribute("class")&&e.getAttribute("class").indexOf("pswp__scroll-wrap")>-1)&&(t(e)?e:It(e.parentNode,t))},Dt={},Tt=function(e,t){return Dt.prevent=!It(e.target,r.isClickableElement),Me("preventDragEvent",e,t,Dt),Dt.prevent},Mt=function(e,t){return t.x=e.pageX,t.y=e.pageY,t.id=e.identifier,t},St=function(e,t,n){n.x=.5*(e.x+t.x),n.y=.5*(e.y+t.y)},At=function(e,t,n){if(e-U>50){var i=ut.length>2?ut.shift():{};i.x=t,i.y=n,ut.push(i),U=e}},Et=function(){var e=pe.y-a.currItem.initialPosition.y;return 1-Math.abs(e/(me.y/2))},Ot={},kt={},Rt=[],Zt=function(e){for(;Rt.length>0;)Rt.pop();return E?(ue=0,lt.forEach(function(e){0===ue?Rt[0]=e:1===ue&&(Rt[1]=e),ue++})):e.type.indexOf("touch")>-1?e.touches&&e.touches.length>0&&(Rt[0]=Mt(e.touches[0],Ot),e.touches.length>1&&(Rt[1]=Mt(e.touches[1],kt))):(Ot.x=e.pageX,Ot.y=e.pageY,Ot.id="",Rt[0]=Ot),Rt},Pt=function(e,t){var n,i,o,l,s=pe[e]+t[e],u=t[e]>0,c=ft.x+t.x,d=ft.x-st.x;return n=s>te.min[e]||ste.min[e]&&(n=r.panEndFriction,te.min[e]-s,i=te.min[e]-de[e]),(0>=i||0>d)&&qt()>1?(l=c,0>d&&c>st.x&&(l=st.x)):te.min.x!==te.max.x&&(o=s)):(s=i||d>0)&&qt()>1?(l=c,d>0&&ca.currItem.fitRatio&&(pe[e]+=t[e]*n)):(void 0!==l&&(Ze(l,!0),$=l!==st.x),te.min.x!==te.max.x&&(void 0!==o?pe.x=o:$||(pe.x+=t.x*n)),void 0!==l)},Lt=function(e){if(!("mousedown"===e.type&&e.button>0))if(Vt)e.preventDefault();else if(!B||"mousedown"!==e.type){if(Tt(e,!0)&&e.preventDefault(),Me("pointerDown"),E){var t=o.arraySearch(lt,e.pointerId,"id");0>t&&(t=lt.length),lt[t]={x:e.pageX,y:e.pageY,id:e.pointerId}}var n=Zt(e),i=n.length;j=null,Qe(),G&&1!==i||(G=ae=!0,o.bind(window,m,a),Y=se=re=W=$=K=X=V=!1,oe=null,Me("firstTouchStart",n),Le(de,pe),ce.x=ce.y=0,Le(at,n[0]),Le(rt,at),st.x=ye.x*fe,ut=[{x:at.x,y:at.y}],U=N=Se(),He(y,!0),wt(),bt()),!J&&i>1&&!ie&&!$&&(x=y,V=!1,J=X=!0,ce.y=ce.x=0,Le(de,pe),Le(nt,n[0]),Le(it,n[1]),St(nt,it,yt),ht.x=Math.abs(yt.x)-pe.x,ht.y=Math.abs(yt.y)-pe.y,Q=ee=gt(nt,it))}},Ft=function(e){if(e.preventDefault(),E){var t=o.arraySearch(lt,e.pointerId,"id");if(t>-1){var n=lt[t];n.x=e.pageX,n.y=e.pageY}}if(G){var i=Zt(e);if(oe||K||J)j=i;else if(ft.x!==ye.x*fe)oe="h";else{var a=Math.abs(i[0].x-at.x)-Math.abs(i[0].y-at.y);Math.abs(a)>=10&&(oe=a>0?"h":"v",j=i)}}},zt=function(){if(j){var e=j.length;if(0!==e)if(Le(nt,j[0]),ot.x=nt.x-at.x,ot.y=nt.y-at.y,J&&e>1){if(at.x=nt.x,at.y=nt.y,!ot.x&&!ot.y&&xt(j[1],it))return;Le(it,j[1]),V||(V=!0,Me("zoomGestureStarted"));var t=gt(nt,it),n=Yt(t);n>a.currItem.initialZoomLevel+a.currItem.initialZoomLevel/15&&(se=!0);var i=1,o=Ye(),l=We();if(o>n)if(r.pinchToClose&&!se&&x<=a.currItem.initialZoomLevel){var s=1-(o-n)/(o/1.2);Ae(s),Me("onPinchClose",s),re=!0}else(i=(o-n)/o)>1&&(i=1),n=o-i*(o/3);else n>l&&((i=(n-l)/(6*o))>1&&(i=1),n=l+i*o);0>i&&(i=0),Q=t,St(nt,it,pt),ce.x+=pt.x-yt.x,ce.y+=pt.y-yt.y,Le(yt,pt),pe.x=Pe("x",n),pe.y=Pe("y",n),Y=n>y,y=n,Oe()}else{if(!oe)return;if(ae&&(ae=!1,Math.abs(ot.x)>=10&&(ot.x-=j[0].x-rt.x),Math.abs(ot.y)>=10&&(ot.y-=j[0].y-rt.y)),at.x=nt.x,at.y=nt.y,0===ot.x&&0===ot.y)return;if("v"===oe&&r.closeOnVerticalDrag&&!Ct()){ce.y+=ot.y,pe.y+=ot.y;var u=Et();return W=!0,Me("onVerticalDrag",u),Ae(u),void Oe()}At(Se(),nt.x,nt.y),K=!0,te=a.currItem.bounds,Pt("x",ot)||(Pt("y",ot),Fe(pe),Oe())}}},_t=function(e){if(z.isOldAndroid){if(B&&"mouseup"===e.type)return;e.type.indexOf("touch")>-1&&(clearTimeout(B),B=setTimeout(function(){B=0},600))}Me("pointerUp"),Tt(e,!1)&&e.preventDefault();var t;if(E){var n=o.arraySearch(lt,e.pointerId,"id");if(n>-1)if(t=lt.splice(n,1)[0],navigator.pointerEnabled)t.type=e.pointerType||"mouse";else{var i={4:"mouse",2:"touch",3:"pen"};t.type=i[e.pointerType],t.type||(t.type=e.pointerType||"mouse")}}var l,s=Zt(e),u=s.length;if("mouseup"===e.type&&(u=0),2===u)return j=null,!0;1===u&&Le(rt,s[0]),0!==u||oe||ie||(t||("mouseup"===e.type?t={x:e.pageX,y:e.pageY,type:"mouse"}:e.changedTouches&&e.changedTouches[0]&&(t={x:e.changedTouches[0].pageX,y:e.changedTouches[0].pageY,type:"touch"})),Me("touchRelease",e,t));var c=-1;if(0===u&&(G=!1,o.unbind(window,m,a),wt(),J?c=0:-1!==mt&&(c=Se()-mt)),mt=1===u?Se():-1,l=-1!==c&&150>c?"zoom":"swipe",J&&2>u&&(J=!1,1===u&&(l="zoomPointerUp"),Me("zoomGestureEnded")),j=null,K||V||ie||W)if(Qe(),H||(H=Nt()),H.calculateSwipeSpeed("x"),W)if(Et()a.currItem.fitRatio&&Ut(H):Wt())}},Nt=function(){var e,t,n={lastFlickOffset:{},lastFlickDist:{},lastFlickSpeed:{},slowDownRatio:{},slowDownRatioReverse:{},speedDecelerationRatio:{},speedDecelerationRatioAbs:{},distanceOffset:{},backAnimDestination:{},backAnimStarted:{},calculateSwipeSpeed:function(i){ut.length>1?(e=Se()-U+50,t=ut[ut.length-2][i]):(e=Se()-N,t=rt[i]),n.lastFlickOffset[i]=at[i]-t,n.lastFlickDist[i]=Math.abs(n.lastFlickOffset[i]),n.lastFlickDist[i]>20?n.lastFlickSpeed[i]=n.lastFlickOffset[i]/e:n.lastFlickSpeed[i]=0,Math.abs(n.lastFlickSpeed[i])<.1&&(n.lastFlickSpeed[i]=0),n.slowDownRatio[i]=.95,n.slowDownRatioReverse[i]=1-n.slowDownRatio[i],n.speedDecelerationRatio[i]=1},calculateOverBoundsAnimOffset:function(e,t){n.backAnimStarted[e]||(pe[e]>te.min[e]?n.backAnimDestination[e]=te.min[e]:pe[e]30&&(s||t.lastFlickOffset.x>20)?i=-1:-30>l&&(s||t.lastFlickOffset.x<-20)&&(i=1)}var u;i&&((c+=i)<0?(c=r.loop?qt()-1:0,u=!0):c>=qt()&&(c=r.loop?0:qt()-1,u=!0),u&&!r.loop||(xe+=i,fe-=i,n=!0));var d,p=ye.x*fe,m=Math.abs(p-ft.x);return n||p>ft.x==t.lastFlickSpeed.x>0?(d=Math.abs(t.lastFlickSpeed.x)>0?m/Math.abs(t.lastFlickSpeed.x):333,d=Math.min(d,400),d=Math.max(d,250)):d=333,dt===c&&(n=!1),ie=!0,Me("mainScrollAnimStart"),et("mainScroll",ft.x,p,d,o.easing.cubic.out,Ze,function(){Qe(),ie=!1,dt=-1,(n||dt!==c)&&a.updateCurrItem(),Me("mainScrollAnimComplete")}),n&&a.updateCurrItem(!0),n},Yt=function(e){return 1/ee*e*x},Wt=function(){var e=y,t=Ye(),n=We();t>y?e=t:y>n&&(e=n);var i,r=le;return re&&!Y&&!se&&t>y?(a.close(),!0):(re&&(i=function(e){Ae((1-r)*e+r)}),a.zoomTo(e,0,200,o.easing.cubic.out,i),!0)};Ce("Gestures",{publicMethods:{initGestures:function(){var e=function(e,t,n,i,o){D=e+t,T=e+n,M=e+i,S=o?e+o:""};(E=z.pointerEvent)&&z.touch&&(z.touch=!1),E?navigator.pointerEnabled?e("pointer","down","move","up","cancel"):e("MSPointer","Down","Move","Up","Cancel"):z.touch?(e("touch","start","move","end","cancel"),O=!0):e("mouse","down","move","up"),m=T+" "+M+" "+S,f=D,E&&!O&&(O=navigator.maxTouchPoints>1||navigator.msMaxTouchPoints>1),a.likelyTouchDevice=O,h[D]=Lt,h[T]=Ft,h[M]=_t,S&&(h[S]=h[M]),z.touch&&(f+=" mousedown",m+=" mousemove mouseup",h.mousedown=h[D],h.mousemove=h[T],h.mouseup=h[M]),O||(r.allowPanToNext=!1)}}});var Bt,Gt,Xt,Vt,Kt,qt,$t,jt=function(t,n,i,l){Bt&&clearTimeout(Bt),Vt=!0,Xt=!0;var s;t.initialLayout?(s=t.initialLayout,t.initialLayout=null):s=r.getThumbBoundsFn&&r.getThumbBoundsFn(c);var d=i?r.hideAnimationDuration:r.showAnimationDuration,p=function(){je("initialZoom"),i?(a.template.removeAttribute("style"),a.bg.removeAttribute("style")):(Ae(1),n&&(n.style.display="block"),o.addClass(e,"pswp--animated-in"),Me("initialZoom"+(i?"OutEnd":"InEnd"))),l&&l(),Vt=!1};return d&&s&&void 0!==s.x?void!function(){var n=u,l=!a.currItem.src||a.currItem.loadError||r.showHideOpacity;t.miniImg&&(t.miniImg.style.webkitBackfaceVisibility="hidden"),i||(y=s.w/t.w,pe.x=s.x,pe.y=s.y-P,a[l?"template":"bg"].style.opacity=.001,Oe()),Je("initialZoom"),i&&!n&&o.removeClass(e,"pswp--animated-in"),l&&(i?o[(n?"remove":"add")+"Class"](e,"pswp--animate_opacity"):setTimeout(function(){o.addClass(e,"pswp--animate_opacity")},30)),Bt=setTimeout(function(){if(Me("initialZoom"+(i?"Out":"In")),i){var a=s.w/t.w,r={x:pe.x,y:pe.y},u=y,c=le,m=function(t){1===t?(y=a,pe.x=s.x,pe.y=s.y-F):(y=(a-u)*t+u,pe.x=(s.x-r.x)*t+r.x,pe.y=(s.y-F-r.y)*t+r.y),Oe(),l?e.style.opacity=1-t:Ae(c-t*c)};n?et("initialZoom",0,1,d,o.easing.cubic.out,m,p):(m(1),Bt=setTimeout(p,d+20))}else y=t.initialZoomLevel,Le(pe,t.initialPosition),Oe(),Ae(1),l?e.style.opacity=1:Ae(1),Bt=setTimeout(p,d+20)},i?25:90)}():(Me("initialZoom"+(i?"Out":"In")),y=t.initialZoomLevel,Le(pe,t.initialPosition),Oe(),e.style.opacity=i?0:1,Ae(1),void(d?setTimeout(function(){p()},d):p()))},Jt={},Qt=[],en={index:0,errorMsg:'
The image could not be loaded.
',forceProgressiveLoading:!1,preload:[1,1],getNumItemsFn:function(){return Gt.length}},tn=function(e,t,n){var i=e.bounds;i.center.x=Math.round((Jt.x-t)/2),i.center.y=Math.round((Jt.y-n)/2)+e.vGap.top,i.max.x=t>Jt.x?Math.round(Jt.x-t):i.center.x,i.max.y=n>Jt.y?Math.round(Jt.y-n)+e.vGap.top:i.center.y,i.min.x=t>Jt.x?0:i.center.x,i.min.y=n>Jt.y?e.vGap.top:i.center.y},nn=function(e,t,n){if(e.src&&!e.loadError){var i=!n;if(i&&(e.vGap||(e.vGap={top:0,bottom:0}),Me("parseVerticalMargin",e)),Jt.x=t.x,Jt.y=t.y-e.vGap.top-e.vGap.bottom,i){var o=Jt.x/e.w,a=Jt.y/e.h;e.fitRatio=a>o?o:a;var l=r.scaleMode;"orig"===l?n=1:"fit"===l&&(n=e.fitRatio),n>1&&(n=1),e.initialZoomLevel=n,e.bounds||(e.bounds={center:{x:0,y:0},max:{x:0,y:0},min:{x:0,y:0}})}if(!n)return;return tn(e,e.w*n,e.h*n),i&&n===e.initialZoomLevel&&(e.initialPosition=e.bounds.center),e.bounds}return e.w=e.h=0,e.initialZoomLevel=e.fitRatio=1,e.bounds={center:{x:0,y:0},max:{x:0,y:0},min:{x:0,y:0}},e.initialPosition=e.bounds.center,e.bounds},on=function(e,t,n,i,o,r){t.loadError||i&&(t.imageAppended=!0,ln(t,i,t===a.currItem&&be),n.appendChild(i),r&&setTimeout(function(){t&&t.loaded&&t.placeholder&&(t.placeholder.style.display="none",t.placeholder=null)},500))},an=function(e){e.loading=!0,e.loaded=!1,e.loading=!0,e.loaded=!1;var t=e.img=o.createEl("pswp__img","img"),n=function(){e.loading=!1,e.loaded=!0,e.loadComplete?e.loadComplete(e):e.img=null,t.onload=t.onerror=null,t=null};return t.onload=n,t.onerror=function(){e.loadError=!0,n()},e.filterClass&&t.classList.add(e.filterClass),t.src=e.src,t},rn=function(e,t){return e.src&&e.loadError&&e.container?(t&&(e.container.innerHTML=""),e.container.innerHTML=r.errorMsg.replace("%url%",e.src),!0):void 0},ln=function(e,t,n){if(e.src){t||(t=e.container.lastChild);var i=n?e.w:Math.round(e.w*e.fitRatio),o=n?e.h:Math.round(e.h*e.fitRatio);e.placeholder&&!e.loaded&&(e.placeholder.style.width=i+"px",e.placeholder.style.height=o+"px"),t.style.width=i+"px",t.style.height=o+"px"}},sn=function(){if(Qt.length){for(var e,t=0;t=0,o=Math.min(n[0],qt()),l=Math.min(n[1],qt());for(t=1;(i?l:o)>=t;t++)a.lazyLoadItem(c+t);for(t=1;(i?o:l)>=t;t++)a.lazyLoadItem(c-t)}),Te("initialLayout",function(){a.currItem.initialLayout=r.getThumbBoundsFn&&r.getThumbBoundsFn(c)}),Te("mainScrollAnimComplete",sn),Te("initialZoomInEnd",sn),Te("destroy",function(){for(var e,t=0;t=0&&void 0!==Gt[e]&&Gt[e]},allowProgressiveImg:function(){return r.forceProgressiveLoading||!O||r.mouseUsed||screen.width>1200},setContent:function(e,t){r.loop&&(t=Ie(t));var n=a.getItemAt(e.index);n&&(n.container=null);var i,s=a.getItemAt(t);if(s){Me("gettingData",t,s),e.index=t,e.item=s;var u=s.container=o.createEl("pswp__zoom-wrap");if(!s.src&&s.html&&(s.html.tagName?u.appendChild(s.html):u.innerHTML=s.html),rn(s),nn(s,me),!s.src||s.loadError||s.loaded)s.src&&!s.loadError&&((i=o.createEl("pswp__img","img")).style.opacity=1,s.filterClass&&i.classList.add(s.filterClass),i.src=s.src,ln(s,i),on(0,s,u,i));else{if(s.loadComplete=function(n){if(l){if(e&&e.index===t){if(rn(n,!0))return n.loadComplete=n.img=null,nn(n,me),ke(n),void(e.index===c&&a.updateCurrZoomItem());n.imageAppended?!Vt&&n.placeholder&&(n.placeholder.style.display="none",n.placeholder=null):z.transform&&(ie||Vt)?Qt.push({item:n,baseDiv:u,img:n.img,index:t,holder:e,clearPlaceholder:!0}):on(0,n,u,n.img,0,!0)}n.loadComplete=null,n.img=null,Me("imageLoadComplete",t,n)}},o.features.transform){var d="pswp__img pswp__img--placeholder";d+=s.msrc?"":" pswp__img--placeholder--blank";var p=o.createEl(d,s.msrc?"img":"");s.msrc&&(p.src=s.msrc),ln(s,p),u.appendChild(p),s.placeholder=p}s.loading||an(s),a.allowProgressiveImg()&&(!Xt&&z.transform?Qt.push({item:s,baseDiv:u,img:s.img,index:t,holder:e}):on(0,s,u,s.img,0,!0))}Xt||t!==c?ke(s):(ne=u.style,jt(s,i||s.img)),e.el.innerHTML="",e.el.appendChild(u)}else e.el.innerHTML=""},cleanSlide:function(e){e.img&&(e.img.onload=e.img.onerror=null),e.loaded=e.loading=e.img=e.imageAppended=!1}}});var un,cn={},dn=function(e,t,n){var i=document.createEvent("CustomEvent"),o={origEvent:e,target:e.target,releasePoint:t,pointerType:n||"touch"};i.initCustomEvent("pswpTap",!0,!0,o),e.target.dispatchEvent(i)};Ce("Tap",{publicMethods:{initTap:function(){Te("firstTouchStart",a.onTapStart),Te("touchRelease",a.onTapRelease),Te("destroy",function(){cn={},un=null})},onTapStart:function(e){e.length>1&&(clearTimeout(un),un=null)},onTapRelease:function(e,t){if(t&&!K&&!X&&!$e){var n=t;if(un&&(clearTimeout(un),un=null,vt(n,cn)))return void Me("doubleTap",n);if("mouse"===t.type)return void dn(e,t,"mouse");if("BUTTON"===e.target.tagName.toUpperCase()||o.hasClass(e.target,"pswp__single-tap"))return void dn(e,t);Le(cn,n),un=setTimeout(function(){dn(e,t),un=null},300)}}}});var pn;Ce("DesktopZoom",{publicMethods:{initDesktopZoom:function(){L||(O?Te("mouseUsed",function(){a.setupDesktopZoom()}):a.setupDesktopZoom(!0))},setupDesktopZoom:function(t){pn={};var n="wheel mousewheel DOMMouseScroll";Te("bindEvents",function(){o.bind(e,n,a.handleMouseWheel)}),Te("unbindEvents",function(){pn&&o.unbind(e,n,a.handleMouseWheel)}),a.mouseZoomedIn=!1;var i,r=function(){a.mouseZoomedIn&&(o.removeClass(e,"pswp--zoomed-in"),a.mouseZoomedIn=!1),1>y?o.addClass(e,"pswp--zoom-allowed"):o.removeClass(e,"pswp--zoom-allowed"),l()},l=function(){i&&(o.removeClass(e,"pswp--dragging"),i=!1)};Te("resize",r),Te("afterChange",r),Te("pointerDown",function(){a.mouseZoomedIn&&(i=!0,o.addClass(e,"pswp--dragging"))}),Te("pointerUp",l),t||r()},handleMouseWheel:function(e){if(y<=a.currItem.fitRatio)return r.modal&&(!r.closeOnScroll||$e||G?e.preventDefault():A&&Math.abs(e.deltaY)>2&&(u=!0,a.close())),!0;if(e.stopPropagation(),pn.x=0,"deltaX"in e)1===e.deltaMode?(pn.x=18*e.deltaX,pn.y=18*e.deltaY):(pn.x=e.deltaX,pn.y=e.deltaY);else if("wheelDelta"in e)e.wheelDeltaX&&(pn.x=-.16*e.wheelDeltaX),e.wheelDeltaY?pn.y=-.16*e.wheelDeltaY:pn.y=-.16*e.wheelDelta;else{if(!("detail"in e))return;pn.y=e.detail}He(y,!0);var t=pe.x-pn.x,n=pe.y-pn.y;(r.modal||t<=te.min.x&&t>=te.max.x&&n<=te.min.y&&n>=te.max.y)&&e.preventDefault(),a.panTo(t,n)},toggleDesktopZoom:function(t){t=t||{x:me.x/2+he.x,y:me.y/2+he.y};var n=r.getDoubleTapZoom(!0,a.currItem),i=y===n;a.mouseZoomedIn=!i,a.zoomTo(i?a.currItem.initialZoomLevel:n,t,333),o[(i?"remove":"add")+"Class"](e,"pswp--zoomed-in")}}});var mn,fn,hn,yn,xn,vn,gn,wn,bn,Cn,In,Dn,Tn={history:!0,galleryUID:1},Mn=function(){return In.hash.substring(1)},Sn=function(){mn&&clearTimeout(mn),hn&&clearTimeout(hn)},An=function(){var e=Mn(),t={};if(e.length<5)return t;var n,i=e.split("&");for(n=0;n-1&&"&"===(gn=gn.substring(0,t)).slice(-1)&&(gn=gn.slice(0,-1)),setTimeout(function(){l&&o.bind(window,"hashchange",a.onHashChange)},40)}},onHashChange:function(){return Mn()===gn?(bn=!0,void a.close()):void(yn||(xn=!0,a.goTo(An().pid),xn=!1))},updateURL:function(){Sn(),xn||(wn?mn=setTimeout(En,800):En())}}}),o.extend(a,tt)}});