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