vuepress-theme-plume/assets/photoswipe.esm-C2XFWD3l.js

1 line
58 KiB
JavaScript

function e(e,t,n){let r=document.createElement(t);return e&&(r.className=e),n&&n.appendChild(r),r}function t(e,t){return e.x=t.x,e.y=t.y,t.id!==void 0&&(e.id=t.id),e}function n(e){e.x=Math.round(e.x),e.y=Math.round(e.y)}function r(e,t){let n=Math.abs(e.x-t.x),r=Math.abs(e.y-t.y);return Math.sqrt(n*n+r*r)}function i(e,t){return e.x===t.x&&e.y===t.y}function a(e,t,n){return Math.min(Math.max(e,t),n)}function o(e,t,n){let r=`translate3d(${e}px,${t||0}px,0)`;return n!==void 0&&(r+=` scale3d(${n},${n},1)`),r}function s(e,t,n,r){e.style.transform=o(t,n,r)}var c=`cubic-bezier(.4,0,.22,1)`;function l(e,t,n,r){e.style.transition=t?`${t} ${n}ms ${r||c}`:`none`}function u(e,t,n){e.style.width=typeof t==`number`?`${t}px`:t,e.style.height=typeof n==`number`?`${n}px`:n}function d(e){l(e)}function f(e){return`decode`in e?e.decode().catch(()=>{}):e.complete?Promise.resolve(e):new Promise((t,n)=>{e.onload=()=>t(e),e.onerror=n})}var p={IDLE:`idle`,LOADING:`loading`,LOADED:`loaded`,ERROR:`error`};function m(e){return`button`in e&&e.button===1||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey}function h(e,t,n=document){let r=[];if(e instanceof Element)r=[e];else if(e instanceof NodeList||Array.isArray(e))r=Array.from(e);else{let i=typeof e==`string`?e:t;i&&(r=Array.from(n.querySelectorAll(i)))}return r}function g(){return!!(navigator.vendor&&navigator.vendor.match(/apple/i))}var _=!1;try{window.addEventListener(`test`,null,Object.defineProperty({},`passive`,{get:()=>{_=!0}}))}catch{}var ee=class{constructor(){this._pool=[]}add(e,t,n,r){this._toggleListener(e,t,n,r)}remove(e,t,n,r){this._toggleListener(e,t,n,r,!0)}removeAll(){this._pool.forEach(e=>{this._toggleListener(e.target,e.type,e.listener,e.passive,!0,!0)}),this._pool=[]}_toggleListener(e,t,n,r,i,a){if(!e)return;let o=i?`removeEventListener`:`addEventListener`;t.split(` `).forEach(t=>{if(t){a||(i?this._pool=this._pool.filter(r=>r.type!==t||r.listener!==n||r.target!==e):this._pool.push({target:e,type:t,listener:n,passive:r}));let s=_?{passive:r||!1}:!1;e[o](t,n,s)}})}};function v(e,t){if(e.getViewportSizeFn){let n=e.getViewportSizeFn(e,t);if(n)return n}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function y(e,t,n,r,i){let a=0;if(t.paddingFn)a=t.paddingFn(n,r,i)[e];else if(t.padding)a=t.padding[e];else{let n=`padding`+e[0].toUpperCase()+e.slice(1);t[n]&&(a=t[n])}return Number(a)||0}function b(e,t,n,r){return{x:t.x-y(`left`,e,t,n,r)-y(`right`,e,t,n,r),y:t.y-y(`top`,e,t,n,r)-y(`bottom`,e,t,n,r)}}var te=class{constructor(e){this.slide=e,this.currZoomLevel=1,this.center={x:0,y:0},this.max={x:0,y:0},this.min={x:0,y:0}}update(e){this.currZoomLevel=e,this.slide.width?(this._updateAxis(`x`),this._updateAxis(`y`),this.slide.pswp.dispatch(`calcBounds`,{slide:this.slide})):this.reset()}_updateAxis(e){let{pswp:t}=this.slide,n=this.slide[e===`x`?`width`:`height`]*this.currZoomLevel,r=y(e===`x`?`left`:`top`,t.options,t.viewportSize,this.slide.data,this.slide.index),i=this.slide.panAreaSize[e];this.center[e]=Math.round((i-n)/2)+r,this.max[e]=n>i?Math.round(i-n)+r:this.center[e],this.min[e]=n>i?r:this.center[e]}reset(){this.center.x=0,this.center.y=0,this.max.x=0,this.max.y=0,this.min.x=0,this.min.y=0}correctPan(e,t){return a(t,this.max[e],this.min[e])}},x=4e3,S=class{constructor(e,t,n,r){this.pswp=r,this.options=e,this.itemData=t,this.index=n,this.panAreaSize=null,this.elementSize=null,this.fit=1,this.fill=1,this.vFill=1,this.initial=1,this.secondary=1,this.max=1,this.min=1}update(e,t,n){let r={x:e,y:t};this.elementSize=r,this.panAreaSize=n;let i=n.x/r.x,a=n.y/r.y;this.fit=Math.min(1,i<a?i:a),this.fill=Math.min(1,i>a?i:a),this.vFill=Math.min(1,a),this.initial=this._getInitial(),this.secondary=this._getSecondary(),this.max=Math.max(this.initial,this.secondary,this._getMax()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch(`zoomLevelsUpdate`,{zoomLevels:this,slideData:this.itemData})}_parseZoomLevelOption(e){let t=e+`ZoomLevel`,n=this.options[t];if(n)return typeof n==`function`?n(this):n===`fill`?this.fill:n===`fit`?this.fit:Number(n)}_getSecondary(){let e=this._parseZoomLevelOption(`secondary`);return e||(e=Math.min(1,this.fit*3),this.elementSize&&e*this.elementSize.x>x&&(e=x/this.elementSize.x),e)}_getInitial(){return this._parseZoomLevelOption(`initial`)||this.fit}_getMax(){return this._parseZoomLevelOption(`max`)||Math.max(1,this.fit*4)}},C=class{constructor(t,n,r){this.data=t,this.index=n,this.pswp=r,this.isActive=n===r.currIndex,this.currentResolution=0,this.panAreaSize={x:0,y:0},this.pan={x:0,y:0},this.isFirstSlide=this.isActive&&!r.opener.isOpen,this.zoomLevels=new S(r.options,t,n,r),this.pswp.dispatch(`gettingData`,{slide:this,data:this.data,index:n}),this.content=this.pswp.contentLoader.getContentBySlide(this),this.container=e(`pswp__zoom-wrap`,`div`),this.holderElement=null,this.currZoomLevel=1,this.width=this.content.width,this.height=this.content.height,this.heavyAppended=!1,this.bounds=new te(this),this.prevDisplayedWidth=-1,this.prevDisplayedHeight=-1,this.pswp.dispatch(`slideInit`,{slide:this})}setIsActive(e){e&&!this.isActive?this.activate():!e&&this.isActive&&this.deactivate()}append(e){this.holderElement=e,this.container.style.transformOrigin=`0 0`,this.data&&(this.calculateSize(),this.load(),this.updateContentSize(),this.appendHeavy(),this.holderElement.appendChild(this.container),this.zoomAndPanToInitial(),this.pswp.dispatch(`firstZoomPan`,{slide:this}),this.applyCurrentZoomPan(),this.pswp.dispatch(`afterSetContent`,{slide:this}),this.isActive&&this.activate())}load(){this.content.load(!1),this.pswp.dispatch(`slideLoad`,{slide:this})}appendHeavy(){let{pswp:e}=this;this.heavyAppended||!e.opener.isOpen||e.mainScroll.isShifted()||!this.isActive&&!1||this.pswp.dispatch(`appendHeavy`,{slide:this}).defaultPrevented||(this.heavyAppended=!0,this.content.append(),this.pswp.dispatch(`appendHeavyContent`,{slide:this}))}activate(){this.isActive=!0,this.appendHeavy(),this.content.activate(),this.pswp.dispatch(`slideActivate`,{slide:this})}deactivate(){this.isActive=!1,this.content.deactivate(),this.currZoomLevel!==this.zoomLevels.initial&&this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize(),this.pswp.dispatch(`slideDeactivate`,{slide:this})}destroy(){this.content.hasSlide=!1,this.content.remove(),this.container.remove(),this.pswp.dispatch(`slideDestroy`,{slide:this})}resize(){this.currZoomLevel===this.zoomLevels.initial||!this.isActive?(this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize()):(this.calculateSize(),this.bounds.update(this.currZoomLevel),this.panTo(this.pan.x,this.pan.y))}updateContentSize(e){let t=this.currentResolution||this.zoomLevels.initial;if(!t)return;let n=Math.round(this.width*t)||this.pswp.viewportSize.x,r=Math.round(this.height*t)||this.pswp.viewportSize.y;!this.sizeChanged(n,r)&&!e||this.content.setDisplayedSize(n,r)}sizeChanged(e,t){return e!==this.prevDisplayedWidth||t!==this.prevDisplayedHeight?(this.prevDisplayedWidth=e,this.prevDisplayedHeight=t,!0):!1}getPlaceholderElement(){return this.content.placeholder?.element}zoomTo(e,t,r,i){let{pswp:o}=this;if(!this.isZoomable()||o.mainScroll.isShifted())return;o.dispatch(`beforeZoomTo`,{destZoomLevel:e,centerPoint:t,transitionDuration:r}),o.animations.stopAllPan();let s=this.currZoomLevel;i||(e=a(e,this.zoomLevels.min,this.zoomLevels.max)),this.setZoomLevel(e),this.pan.x=this.calculateZoomToPanOffset(`x`,t,s),this.pan.y=this.calculateZoomToPanOffset(`y`,t,s),n(this.pan);let c=()=>{this._setResolution(e),this.applyCurrentZoomPan()};r?o.animations.startTransition({isPan:!0,name:`zoomTo`,target:this.container,transform:this.getCurrentTransform(),onComplete:c,duration:r,easing:o.options.easing}):c()}toggleZoom(e){this.zoomTo(this.currZoomLevel===this.zoomLevels.initial?this.zoomLevels.secondary:this.zoomLevels.initial,e,this.pswp.options.zoomAnimationDuration)}setZoomLevel(e){this.currZoomLevel=e,this.bounds.update(this.currZoomLevel)}calculateZoomToPanOffset(e,t,n){if(this.bounds.max[e]-this.bounds.min[e]===0)return this.bounds.center[e];t||=this.pswp.getViewportCenterPoint(),n||=this.zoomLevels.initial;let r=this.currZoomLevel/n;return this.bounds.correctPan(e,(this.pan[e]-t[e])*r+t[e])}panTo(e,t){this.pan.x=this.bounds.correctPan(`x`,e),this.pan.y=this.bounds.correctPan(`y`,t),this.applyCurrentZoomPan()}isPannable(){return!!this.width&&this.currZoomLevel>this.zoomLevels.fit}isZoomable(){return!!this.width&&this.content.isZoomable()}applyCurrentZoomPan(){this._applyZoomTransform(this.pan.x,this.pan.y,this.currZoomLevel),this===this.pswp.currSlide&&this.pswp.dispatch(`zoomPanUpdate`,{slide:this})}zoomAndPanToInitial(){this.currZoomLevel=this.zoomLevels.initial,this.bounds.update(this.currZoomLevel),t(this.pan,this.bounds.center),this.pswp.dispatch(`initialZoomPan`,{slide:this})}_applyZoomTransform(e,t,n){n/=this.currentResolution||this.zoomLevels.initial,s(this.container,e,t,n)}calculateSize(){let{pswp:e}=this;t(this.panAreaSize,b(e.options,e.viewportSize,this.data,this.index)),this.zoomLevels.update(this.width,this.height,this.panAreaSize),e.dispatch(`calcSlideSize`,{slide:this})}getCurrentTransform(){let e=this.currZoomLevel/(this.currentResolution||this.zoomLevels.initial);return o(this.pan.x,this.pan.y,e)}_setResolution(e){e!==this.currentResolution&&(this.currentResolution=e,this.updateContentSize(),this.pswp.dispatch(`resolutionChanged`))}},ne=.35,re=.6,w=.4,T=.5;function ie(e,t){return e*t/(1-t)}var ae=class{constructor(e){this.gestures=e,this.pswp=e.pswp,this.startPan={x:0,y:0}}start(){this.pswp.currSlide&&t(this.startPan,this.pswp.currSlide.pan),this.pswp.animations.stopAll()}change(){let{p1:e,prevP1:t,dragAxis:r}=this.gestures,{currSlide:i}=this.pswp;if(r===`y`&&this.pswp.options.closeOnVerticalDrag&&i&&i.currZoomLevel<=i.zoomLevels.fit&&!this.gestures.isMultitouch){let n=i.pan.y+(e.y-t.y);if(!this.pswp.dispatch(`verticalDrag`,{panY:n}).defaultPrevented){this._setPanWithFriction(`y`,n,re);let e=1-Math.abs(this._getVerticalDragRatio(i.pan.y));this.pswp.applyBgOpacity(e),i.applyCurrentZoomPan()}}else this._panOrMoveMainScroll(`x`)||(this._panOrMoveMainScroll(`y`),i&&(n(i.pan),i.applyCurrentZoomPan()))}end(){let{velocity:e}=this.gestures,{mainScroll:t,currSlide:n}=this.pswp,r=0;if(this.pswp.animations.stopAll(),t.isShifted()){let n=(t.x-t.getCurrSlideX())/this.pswp.viewportSize.x;e.x<-T&&n<0||e.x<.1&&n<-.5?(r=1,e.x=Math.min(e.x,0)):(e.x>T&&n>0||e.x>-.1&&n>.5)&&(r=-1,e.x=Math.max(e.x,0)),t.moveIndexBy(r,!0,e.x)}n&&n.currZoomLevel>n.zoomLevels.max||this.gestures.isMultitouch?this.gestures.zoomLevels.correctZoomPan(!0):(this._finishPanGestureForAxis(`x`),this._finishPanGestureForAxis(`y`))}_finishPanGestureForAxis(e){let{velocity:t}=this.gestures,{currSlide:n}=this.pswp;if(!n)return;let{pan:r,bounds:i}=n,o=r[e],s=this.pswp.bgOpacity<1&&e===`y`,c=o+ie(t[e],.995);if(s){let e=this._getVerticalDragRatio(o),t=this._getVerticalDragRatio(c);if(e<0&&t<-w||e>0&&t>w){this.pswp.close();return}}let l=i.correctPan(e,c);if(o===l)return;let u=l===c?1:.82,d=this.pswp.bgOpacity,f=l-o;this.pswp.animations.startSpring({name:`panGesture`+e,isPan:!0,start:o,end:l,velocity:t[e],dampingRatio:u,onUpdate:t=>{if(s&&this.pswp.bgOpacity<1){let e=1-(l-t)/f;this.pswp.applyBgOpacity(a(d+(1-d)*e,0,1))}r[e]=Math.floor(t),n.applyCurrentZoomPan()}})}_panOrMoveMainScroll(e){let{p1:t,dragAxis:n,prevP1:r,isMultitouch:i}=this.gestures,{currSlide:a,mainScroll:o}=this.pswp,s=t[e]-r[e],c=o.x+s;if(!s||!a)return!1;if(e===`x`&&!a.isPannable()&&!i)return o.moveTo(c,!0),!0;let{bounds:l}=a,u=a.pan[e]+s;if(this.pswp.options.allowPanToNext&&n===`x`&&e===`x`&&!i){let t=o.getCurrSlideX(),n=o.x-t,r=s>0,i=!r;if(u>l.min[e]&&r){if(l.min[e]<=this.startPan[e])return o.moveTo(c,!0),!0;this._setPanWithFriction(e,u)}else if(u<l.max[e]&&i){if(this.startPan[e]<=l.max[e])return o.moveTo(c,!0),!0;this._setPanWithFriction(e,u)}else if(n!==0){if(n>0)return o.moveTo(Math.max(c,t),!0),!0;if(n<0)return o.moveTo(Math.min(c,t),!0),!0}else this._setPanWithFriction(e,u)}else e===`y`?!o.isShifted()&&l.min.y!==l.max.y&&this._setPanWithFriction(e,u):this._setPanWithFriction(e,u);return!1}_getVerticalDragRatio(e){return(e-(this.pswp.currSlide?.bounds.center.y??0))/(this.pswp.viewportSize.y/3)}_setPanWithFriction(e,t,n){let{currSlide:r}=this.pswp;if(!r)return;let{pan:i,bounds:a}=r;if(a.correctPan(e,t)!==t||n){let r=Math.round(t-i[e]);i[e]+=r*(n||ne)}else i[e]=t}},E=.05,D=.15;function O(e,t,n){return e.x=(t.x+n.x)/2,e.y=(t.y+n.y)/2,e}var k=class{constructor(e){this.gestures=e,this._startPan={x:0,y:0},this._startZoomPoint={x:0,y:0},this._zoomPoint={x:0,y:0},this._wasOverFitZoomLevel=!1,this._startZoomLevel=1}start(){let{currSlide:e}=this.gestures.pswp;e&&(this._startZoomLevel=e.currZoomLevel,t(this._startPan,e.pan)),this.gestures.pswp.animations.stopAllPan(),this._wasOverFitZoomLevel=!1}change(){let{p1:e,startP1:t,p2:n,startP2:i,pswp:a}=this.gestures,{currSlide:o}=a;if(!o)return;let s=o.zoomLevels.min,c=o.zoomLevels.max;if(!o.isZoomable()||a.mainScroll.isShifted())return;O(this._startZoomPoint,t,i),O(this._zoomPoint,e,n);let l=1/r(t,i)*r(e,n)*this._startZoomLevel;if(l>o.zoomLevels.initial+o.zoomLevels.initial/15&&(this._wasOverFitZoomLevel=!0),l<s)if(a.options.pinchToClose&&!this._wasOverFitZoomLevel&&this._startZoomLevel<=o.zoomLevels.initial){let e=1-(s-l)/(s/1.2);a.dispatch(`pinchClose`,{bgOpacity:e}).defaultPrevented||a.applyBgOpacity(e)}else l=s-(s-l)*D;else l>c&&(l=c+(l-c)*E);o.pan.x=this._calculatePanForZoomLevel(`x`,l),o.pan.y=this._calculatePanForZoomLevel(`y`,l),o.setZoomLevel(l),o.applyCurrentZoomPan()}end(){let{pswp:e}=this.gestures,{currSlide:t}=e;(!t||t.currZoomLevel<t.zoomLevels.initial)&&!this._wasOverFitZoomLevel&&e.options.pinchToClose?e.close():this.correctZoomPan()}_calculatePanForZoomLevel(e,t){let n=t/this._startZoomLevel;return this._zoomPoint[e]-(this._startZoomPoint[e]-this._startPan[e])*n}correctZoomPan(e){let{pswp:n}=this.gestures,{currSlide:r}=n;if(!(r!=null&&r.isZoomable()))return;this._zoomPoint.x===0&&(e=!0);let o=r.currZoomLevel,s,c=!0;o<r.zoomLevels.initial?s=r.zoomLevels.initial:o>r.zoomLevels.max?s=r.zoomLevels.max:(c=!1,s=o);let l=n.bgOpacity,u=n.bgOpacity<1,d=t({x:0,y:0},r.pan),f=t({x:0,y:0},d);e&&(this._zoomPoint.x=0,this._zoomPoint.y=0,this._startZoomPoint.x=0,this._startZoomPoint.y=0,this._startZoomLevel=o,t(this._startPan,d)),c&&(f={x:this._calculatePanForZoomLevel(`x`,s),y:this._calculatePanForZoomLevel(`y`,s)}),r.setZoomLevel(s),f={x:r.bounds.correctPan(`x`,f.x),y:r.bounds.correctPan(`y`,f.y)},r.setZoomLevel(o);let p=!i(f,d);if(!p&&!c&&!u){r._setResolution(s),r.applyCurrentZoomPan();return}n.animations.stopAllPan(),n.animations.startSpring({isPan:!0,start:0,end:1e3,velocity:0,dampingRatio:1,naturalFrequency:40,onUpdate:e=>{if(e/=1e3,p||c){if(p&&(r.pan.x=d.x+(f.x-d.x)*e,r.pan.y=d.y+(f.y-d.y)*e),c){let t=o+(s-o)*e;r.setZoomLevel(t)}r.applyCurrentZoomPan()}u&&n.bgOpacity<1&&n.applyBgOpacity(a(l+(1-l)*e,0,1))},onComplete:()=>{r._setResolution(s),r.applyCurrentZoomPan()}})}};function A(e){return!!e.target.closest(`.pswp__container`)}var j=class{constructor(e){this.gestures=e}click(e,t){let n=t.target.classList,r=n.contains(`pswp__img`),i=n.contains(`pswp__item`)||n.contains(`pswp__zoom-wrap`);r?this._doClickOrTapAction(`imageClick`,e,t):i&&this._doClickOrTapAction(`bgClick`,e,t)}tap(e,t){A(t)&&this._doClickOrTapAction(`tap`,e,t)}doubleTap(e,t){A(t)&&this._doClickOrTapAction(`doubleTap`,e,t)}_doClickOrTapAction(e,t,n){var r;let{pswp:i}=this.gestures,{currSlide:a}=i,o=e+`Action`,s=i.options[o];if(!i.dispatch(o,{point:t,originalEvent:n}).defaultPrevented){if(typeof s==`function`){s.call(i,t,n);return}switch(s){case`close`:case`next`:i[s]();break;case`zoom`:a?.toggleZoom(t);break;case`zoom-or-close`:a!=null&&a.isZoomable()&&a.zoomLevels.secondary!==a.zoomLevels.initial?a.toggleZoom(t):i.options.clickToCloseNonZoomable&&i.close();break;case`toggle-controls`:(r=this.gestures.pswp.element)==null||r.classList.toggle(`pswp--ui-visible`);break}}}},M=10,N=300,P=25,F=class{constructor(e){this.pswp=e,this.dragAxis=null,this.p1={x:0,y:0},this.p2={x:0,y:0},this.prevP1={x:0,y:0},this.prevP2={x:0,y:0},this.startP1={x:0,y:0},this.startP2={x:0,y:0},this.velocity={x:0,y:0},this._lastStartP1={x:0,y:0},this._intervalP1={x:0,y:0},this._numActivePoints=0,this._ongoingPointers=[],this._touchEventEnabled=`ontouchstart`in window,this._pointerEventEnabled=!!window.PointerEvent,this.supportsTouch=this._touchEventEnabled||this._pointerEventEnabled&&navigator.maxTouchPoints>1,this._numActivePoints=0,this._intervalTime=0,this._velocityCalculated=!1,this.isMultitouch=!1,this.isDragging=!1,this.isZooming=!1,this.raf=null,this._tapTimer=null,this.supportsTouch||(e.options.allowPanToNext=!1),this.drag=new ae(this),this.zoomLevels=new k(this),this.tapHandler=new j(this),e.on(`bindEvents`,()=>{e.events.add(e.scrollWrap,`click`,this._onClick.bind(this)),this._pointerEventEnabled?this._bindEvents(`pointer`,`down`,`up`,`cancel`):this._touchEventEnabled?(this._bindEvents(`touch`,`start`,`end`,`cancel`),e.scrollWrap&&(e.scrollWrap.ontouchmove=()=>{},e.scrollWrap.ontouchend=()=>{})):this._bindEvents(`mouse`,`down`,`up`)})}_bindEvents(e,t,n,r){let{pswp:i}=this,{events:a}=i,o=r?e+r:``;a.add(i.scrollWrap,e+t,this.onPointerDown.bind(this)),a.add(window,e+`move`,this.onPointerMove.bind(this)),a.add(window,e+n,this.onPointerUp.bind(this)),o&&a.add(i.scrollWrap,o,this.onPointerUp.bind(this))}onPointerDown(e){let n=e.type===`mousedown`||e.pointerType===`mouse`;if(n&&e.button>0)return;let{pswp:r}=this;if(!r.opener.isOpen){e.preventDefault();return}r.dispatch(`pointerDown`,{originalEvent:e}).defaultPrevented||(n&&(r.mouseDetected(),this._preventPointerEventBehaviour(e,`down`)),r.animations.stopAll(),this._updatePoints(e,`down`),this._numActivePoints===1&&(this.dragAxis=null,t(this.startP1,this.p1)),this._numActivePoints>1?(this._clearTapTimer(),this.isMultitouch=!0):this.isMultitouch=!1)}onPointerMove(e){this._preventPointerEventBehaviour(e,`move`),this._numActivePoints&&(this._updatePoints(e,`move`),!this.pswp.dispatch(`pointerMove`,{originalEvent:e}).defaultPrevented&&(this._numActivePoints===1&&!this.isDragging?(this.dragAxis||this._calculateDragDirection(),this.dragAxis&&!this.isDragging&&(this.isZooming&&(this.isZooming=!1,this.zoomLevels.end()),this.isDragging=!0,this._clearTapTimer(),this._updateStartPoints(),this._intervalTime=Date.now(),this._velocityCalculated=!1,t(this._intervalP1,this.p1),this.velocity.x=0,this.velocity.y=0,this.drag.start(),this._rafStopLoop(),this._rafRenderLoop())):this._numActivePoints>1&&!this.isZooming&&(this._finishDrag(),this.isZooming=!0,this._updateStartPoints(),this.zoomLevels.start(),this._rafStopLoop(),this._rafRenderLoop())))}_finishDrag(){this.isDragging&&(this.isDragging=!1,this._velocityCalculated||this._updateVelocity(!0),this.drag.end(),this.dragAxis=null)}onPointerUp(e){this._numActivePoints&&(this._updatePoints(e,`up`),!this.pswp.dispatch(`pointerUp`,{originalEvent:e}).defaultPrevented&&(this._numActivePoints===0&&(this._rafStopLoop(),this.isDragging?this._finishDrag():!this.isZooming&&!this.isMultitouch&&this._finishTap(e)),this._numActivePoints<2&&this.isZooming&&(this.isZooming=!1,this.zoomLevels.end(),this._numActivePoints===1&&(this.dragAxis=null,this._updateStartPoints()))))}_rafRenderLoop(){(this.isDragging||this.isZooming)&&(this._updateVelocity(),this.isDragging?i(this.p1,this.prevP1)||this.drag.change():(!i(this.p1,this.prevP1)||!i(this.p2,this.prevP2))&&this.zoomLevels.change(),this._updatePrevPoints(),this.raf=requestAnimationFrame(this._rafRenderLoop.bind(this)))}_updateVelocity(e){let n=Date.now(),r=n-this._intervalTime;r<50&&!e||(this.velocity.x=this._getVelocity(`x`,r),this.velocity.y=this._getVelocity(`y`,r),this._intervalTime=n,t(this._intervalP1,this.p1),this._velocityCalculated=!0)}_finishTap(e){let{mainScroll:n}=this.pswp;if(n.isShifted()){n.moveIndexBy(0,!0);return}if(e.type.indexOf(`cancel`)>0)return;if(e.type===`mouseup`||e.pointerType===`mouse`){this.tapHandler.click(this.startP1,e);return}let i=this.pswp.options.doubleTapAction?N:0;this._tapTimer?(this._clearTapTimer(),r(this._lastStartP1,this.startP1)<P&&this.tapHandler.doubleTap(this.startP1,e)):(t(this._lastStartP1,this.startP1),this._tapTimer=setTimeout(()=>{this.tapHandler.tap(this.startP1,e),this._clearTapTimer()},i))}_clearTapTimer(){this._tapTimer&&=(clearTimeout(this._tapTimer),null)}_getVelocity(e,t){let n=this.p1[e]-this._intervalP1[e];return Math.abs(n)>1&&t>5?n/t:0}_rafStopLoop(){this.raf&&=(cancelAnimationFrame(this.raf),null)}_preventPointerEventBehaviour(e,t){this.pswp.applyFilters(`preventPointerEvent`,!0,e,t)&&e.preventDefault()}_updatePoints(e,n){if(this._pointerEventEnabled){let r=e,i=this._ongoingPointers.findIndex(e=>e.id===r.pointerId);n===`up`&&i>-1?this._ongoingPointers.splice(i,1):n===`down`&&i===-1?this._ongoingPointers.push(this._convertEventPosToPoint(r,{x:0,y:0})):i>-1&&this._convertEventPosToPoint(r,this._ongoingPointers[i]),this._numActivePoints=this._ongoingPointers.length,this._numActivePoints>0&&t(this.p1,this._ongoingPointers[0]),this._numActivePoints>1&&t(this.p2,this._ongoingPointers[1])}else{let t=e;this._numActivePoints=0,t.type.indexOf(`touch`)>-1?t.touches&&t.touches.length>0&&(this._convertEventPosToPoint(t.touches[0],this.p1),this._numActivePoints++,t.touches.length>1&&(this._convertEventPosToPoint(t.touches[1],this.p2),this._numActivePoints++)):(this._convertEventPosToPoint(e,this.p1),n===`up`?this._numActivePoints=0:this._numActivePoints++)}}_updatePrevPoints(){t(this.prevP1,this.p1),t(this.prevP2,this.p2)}_updateStartPoints(){t(this.startP1,this.p1),t(this.startP2,this.p2),this._updatePrevPoints()}_calculateDragDirection(){if(this.pswp.mainScroll.isShifted())this.dragAxis=`x`;else{let e=Math.abs(this.p1.x-this.startP1.x)-Math.abs(this.p1.y-this.startP1.y);if(e!==0){let t=e>0?`x`:`y`;Math.abs(this.p1[t]-this.startP1[t])>=M&&(this.dragAxis=t)}}}_convertEventPosToPoint(e,t){return t.x=e.pageX-this.pswp.offset.x,t.y=e.pageY-this.pswp.offset.y,`pointerId`in e?t.id=e.pointerId:e.identifier!==void 0&&(t.id=e.identifier),t}_onClick(e){this.pswp.mainScroll.isShifted()&&(e.preventDefault(),e.stopPropagation())}},I=.35,L=class{constructor(e){this.pswp=e,this.x=0,this.slideWidth=0,this._currPositionIndex=0,this._prevPositionIndex=0,this._containerShiftIndex=-1,this.itemHolders=[]}resize(e){let{pswp:t}=this,n=Math.round(t.viewportSize.x+t.viewportSize.x*t.options.spacing),r=n!==this.slideWidth;r&&(this.slideWidth=n,this.moveTo(this.getCurrSlideX())),this.itemHolders.forEach((t,n)=>{r&&s(t.el,(n+this._containerShiftIndex)*this.slideWidth),e&&t.slide&&t.slide.resize()})}resetPosition(){this._currPositionIndex=0,this._prevPositionIndex=0,this.slideWidth=0,this._containerShiftIndex=-1}appendHolders(){this.itemHolders=[];for(let t=0;t<3;t++){let n=e(`pswp__item`,`div`,this.pswp.container);n.setAttribute(`role`,`group`),n.setAttribute(`aria-roledescription`,`slide`),n.setAttribute(`aria-hidden`,`true`),n.style.display=t===1?`block`:`none`,this.itemHolders.push({el:n})}}canBeSwiped(){return this.pswp.getNumItems()>1}moveIndexBy(e,t,n){let{pswp:r}=this,i=r.potentialIndex+e,a=r.getNumItems();if(r.canLoop()){i=r.getLoopedIndex(i);let t=(e+a)%a;e=t<=a/2?t:t-a}else i<0?i=0:i>=a&&(i=a-1),e=i-r.potentialIndex;r.potentialIndex=i,this._currPositionIndex-=e,r.animations.stopMainScroll();let o=this.getCurrSlideX();if(!t)this.moveTo(o),this.updateCurrItem();else{r.animations.startSpring({isMainScroll:!0,start:this.x,end:o,velocity:n||0,naturalFrequency:30,dampingRatio:1,onUpdate:e=>{this.moveTo(e)},onComplete:()=>{this.updateCurrItem(),r.appendHeavy()}});let e=r.potentialIndex-r.currIndex;if(r.canLoop()){let t=(e+a)%a;e=t<=a/2?t:t-a}Math.abs(e)>1&&this.updateCurrItem()}return!!e}getCurrSlideX(){return this.slideWidth*this._currPositionIndex}isShifted(){return this.x!==this.getCurrSlideX()}updateCurrItem(){let{pswp:e}=this,t=this._prevPositionIndex-this._currPositionIndex;if(!t)return;this._prevPositionIndex=this._currPositionIndex,e.currIndex=e.potentialIndex;let n=Math.abs(t),r;n>=3&&(this._containerShiftIndex+=t+(t>0?-3:3),n=3,this.itemHolders.forEach(e=>{var t;(t=e.slide)==null||t.destroy(),e.slide=void 0}));for(let i=0;i<n;i++)t>0?(r=this.itemHolders.shift(),r&&(this.itemHolders[2]=r,this._containerShiftIndex++,s(r.el,(this._containerShiftIndex+2)*this.slideWidth),e.setContent(r,e.currIndex-n+i+2))):(r=this.itemHolders.pop(),r&&(this.itemHolders.unshift(r),this._containerShiftIndex--,s(r.el,this._containerShiftIndex*this.slideWidth),e.setContent(r,e.currIndex+n-i-2)));Math.abs(this._containerShiftIndex)>50&&!this.isShifted()&&(this.resetPosition(),this.resize()),e.animations.stopAllPan(),this.itemHolders.forEach((e,t)=>{e.slide&&e.slide.setIsActive(t===1)}),e.currSlide=this.itemHolders[1]?.slide,e.contentLoader.updateLazy(t),e.currSlide&&e.currSlide.applyCurrentZoomPan(),e.dispatch(`change`)}moveTo(e,t){if(!this.pswp.canLoop()&&t){let t=(this.slideWidth*this._currPositionIndex-e)/this.slideWidth;t+=this.pswp.currIndex;let n=Math.round(e-this.x);(t<0&&n>0||t>=this.pswp.getNumItems()-1&&n<0)&&(e=this.x+n*I)}this.x=e,this.pswp.container&&s(this.pswp.container,e),this.pswp.dispatch(`moveMainScroll`,{x:e,dragging:t??!1})}},R={Escape:27,z:90,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Tab:9},z=(e,t)=>t?e:R[e],B=class{constructor(e){this.pswp=e,this._wasFocused=!1,e.on(`bindEvents`,()=>{e.options.trapFocus&&(e.options.initialPointerPos||this._focusRoot(),e.events.add(document,`focusin`,this._onFocusIn.bind(this))),e.events.add(document,`keydown`,this._onKeyDown.bind(this))});let t=document.activeElement;e.on(`destroy`,()=>{e.options.returnFocus&&t&&this._wasFocused&&t.focus()})}_focusRoot(){!this._wasFocused&&this.pswp.element&&(this.pswp.element.focus(),this._wasFocused=!0)}_onKeyDown(e){let{pswp:t}=this;if(t.dispatch(`keydown`,{originalEvent:e}).defaultPrevented||m(e))return;let n,r,i=!1,a=`key`in e;switch(a?e.key:e.keyCode){case z(`Escape`,a):t.options.escKey&&(n=`close`);break;case z(`z`,a):n=`toggleZoom`;break;case z(`ArrowLeft`,a):r=`x`;break;case z(`ArrowUp`,a):r=`y`;break;case z(`ArrowRight`,a):r=`x`,i=!0;break;case z(`ArrowDown`,a):i=!0,r=`y`;break;case z(`Tab`,a):this._focusRoot();break}if(r){e.preventDefault();let{currSlide:a}=t;t.options.arrowKeys&&r===`x`&&t.getNumItems()>1?n=i?`next`:`prev`:a&&a.currZoomLevel>a.zoomLevels.fit&&(a.pan[r]+=i?-80:80,a.panTo(a.pan.x,a.pan.y))}n&&(e.preventDefault(),t[n]())}_onFocusIn(e){let{template:t}=this.pswp;t&&document!==e.target&&t!==e.target&&!t.contains(e.target)&&t.focus()}},V=`cubic-bezier(.4,0,.22,1)`,H=class{constructor(e){this.props=e;let{target:t,onComplete:n,transform:r,onFinish:i=()=>{},duration:a=333,easing:o=V}=e;this.onFinish=i;let s=r?`transform`:`opacity`,c=e[s]??``;this._target=t,this._onComplete=n,this._finished=!1,this._onTransitionEnd=this._onTransitionEnd.bind(this),this._helperTimeout=setTimeout(()=>{l(t,s,a,o),this._helperTimeout=setTimeout(()=>{t.addEventListener(`transitionend`,this._onTransitionEnd,!1),t.addEventListener(`transitioncancel`,this._onTransitionEnd,!1),this._helperTimeout=setTimeout(()=>{this._finalizeAnimation()},a+500),t.style[s]=c},30)},0)}_onTransitionEnd(e){e.target===this._target&&this._finalizeAnimation()}_finalizeAnimation(){this._finished||(this._finished=!0,this.onFinish(),this._onComplete&&this._onComplete())}destroy(){this._helperTimeout&&clearTimeout(this._helperTimeout),d(this._target),this._target.removeEventListener(`transitionend`,this._onTransitionEnd,!1),this._target.removeEventListener(`transitioncancel`,this._onTransitionEnd,!1),this._finished||this._finalizeAnimation()}},U=12,W=.75,G=class{constructor(e,t,n){this.velocity=e*1e3,this._dampingRatio=t||W,this._naturalFrequency=n||U,this._dampedFrequency=this._naturalFrequency,this._dampingRatio<1&&(this._dampedFrequency*=Math.sqrt(1-this._dampingRatio*this._dampingRatio))}easeFrame(e,t){let n=0,r;t/=1e3;let i=Math.E**(-this._dampingRatio*this._naturalFrequency*t);if(this._dampingRatio===1)r=this.velocity+this._naturalFrequency*e,n=(e+r*t)*i,this.velocity=n*-this._naturalFrequency+r*i;else if(this._dampingRatio<1){r=1/this._dampedFrequency*(this._dampingRatio*this._naturalFrequency*e+this.velocity);let a=Math.cos(this._dampedFrequency*t),o=Math.sin(this._dampedFrequency*t);n=i*(e*a+r*o),this.velocity=n*-this._naturalFrequency*this._dampingRatio+i*(-this._dampedFrequency*e*o+this._dampedFrequency*r*a)}return n}},K=class{constructor(e){this.props=e,this._raf=0;let{start:t,end:n,velocity:r,onUpdate:i,onComplete:a,onFinish:o=()=>{},dampingRatio:s,naturalFrequency:c}=e;this.onFinish=o;let l=new G(r,s,c),u=Date.now(),d=t-n,f=()=>{this._raf&&(d=l.easeFrame(d,Date.now()-u),Math.abs(d)<1&&Math.abs(l.velocity)<50?(i(n),a&&a(),this.onFinish()):(u=Date.now(),i(d+n),this._raf=requestAnimationFrame(f)))};this._raf=requestAnimationFrame(f)}destroy(){this._raf>=0&&cancelAnimationFrame(this._raf),this._raf=0}},q=class{constructor(){this.activeAnimations=[]}startSpring(e){this._start(e,!0)}startTransition(e){this._start(e)}_start(e,t){let n=t?new K(e):new H(e);return this.activeAnimations.push(n),n.onFinish=()=>this.stop(n),n}stop(e){e.destroy();let t=this.activeAnimations.indexOf(e);t>-1&&this.activeAnimations.splice(t,1)}stopAll(){this.activeAnimations.forEach(e=>{e.destroy()}),this.activeAnimations=[]}stopAllPan(){this.activeAnimations=this.activeAnimations.filter(e=>e.props.isPan?(e.destroy(),!1):!0)}stopMainScroll(){this.activeAnimations=this.activeAnimations.filter(e=>e.props.isMainScroll?(e.destroy(),!1):!0)}isPanRunning(){return this.activeAnimations.some(e=>e.props.isPan)}},J=class{constructor(e){this.pswp=e,e.events.add(e.element,`wheel`,this._onWheel.bind(this))}_onWheel(e){e.preventDefault();let{currSlide:t}=this.pswp,{deltaX:n,deltaY:r}=e;if(t&&!this.pswp.dispatch(`wheel`,{originalEvent:e}).defaultPrevented)if(e.ctrlKey||this.pswp.options.wheelToZoom){if(t.isZoomable()){let n=-r;e.deltaMode===1?n*=.05:n*=e.deltaMode?1:.002,n=2**n;let i=t.currZoomLevel*n;t.zoomTo(i,{x:e.clientX,y:e.clientY})}}else t.isPannable()&&(e.deltaMode===1&&(n*=18,r*=18),t.panTo(t.pan.x-n,t.pan.y-r))}};function oe(e){if(typeof e==`string`)return e;if(!e||!e.isCustomSVG)return``;let t=e,n=`<svg aria-hidden="true" class="pswp__icn" viewBox="0 0 %d %d" width="%d" height="%d">`;return n=n.split(`%d`).join(t.size||32),t.outlineID&&(n+=`<use class="pswp__icn-shadow" xlink:href="#`+t.outlineID+`"/>`),n+=t.inner,n+=`</svg>`,n}var se=class{constructor(t,n){var r;let i=n.name||n.className,a=n.html;if(t.options[i]===!1)return;typeof t.options[i+`SVG`]==`string`&&(a=t.options[i+`SVG`]),t.dispatch(`uiElementCreate`,{data:n});let o=``;n.isButton?(o+=`pswp__button `,o+=n.className||`pswp__button--${n.name}`):o+=n.className||`pswp__${n.name}`;let s=n.isButton?n.tagName||`button`:n.tagName||`div`;s=s.toLowerCase();let c=e(o,s);if(n.isButton){s===`button`&&(c.type=`button`);let{title:e}=n,{ariaLabel:r}=n;typeof t.options[i+`Title`]==`string`&&(e=t.options[i+`Title`]),e&&(c.title=e);let a=r||e;a&&c.setAttribute(`aria-label`,a)}c.innerHTML=oe(a),n.onInit&&n.onInit(c,t),n.onClick&&(c.onclick=e=>{typeof n.onClick==`string`?t[n.onClick]():typeof n.onClick==`function`&&n.onClick(e,c,t)});let l=n.appendTo||`bar`,u=t.element;l===`bar`?(t.topBar||=e(`pswp__top-bar pswp__hide-on-close`,`div`,t.scrollWrap),u=t.topBar):(c.classList.add(`pswp__hide-on-close`),l===`wrapper`&&(u=t.scrollWrap)),(r=u)==null||r.appendChild(t.applyFilters(`uiElement`,c,n))}};function Y(e,t,n){e.classList.add(`pswp__button--arrow`),e.setAttribute(`aria-controls`,`pswp__items`),t.on(`change`,()=>{t.options.loop||(n?e.disabled=!(t.currIndex<t.getNumItems()-1):e.disabled=!(t.currIndex>0))})}var ce={name:`arrowPrev`,className:`pswp__button--arrow--prev`,title:`Previous`,order:10,isButton:!0,appendTo:`wrapper`,html:{isCustomSVG:!0,size:60,inner:`<path d="M29 43l-3 3-16-16 16-16 3 3-13 13 13 13z" id="pswp__icn-arrow"/>`,outlineID:`pswp__icn-arrow`},onClick:`prev`,onInit:Y},le={name:`arrowNext`,className:`pswp__button--arrow--next`,title:`Next`,order:11,isButton:!0,appendTo:`wrapper`,html:{isCustomSVG:!0,size:60,inner:`<use xlink:href="#pswp__icn-arrow"/>`,outlineID:`pswp__icn-arrow`},onClick:`next`,onInit:(e,t)=>{Y(e,t,!0)}},ue={name:`close`,title:`Close`,order:20,isButton:!0,html:{isCustomSVG:!0,inner:`<path d="M24 10l-2-2-6 6-6-6-2 2 6 6-6 6 2 2 6-6 6 6 2-2-6-6z" id="pswp__icn-close"/>`,outlineID:`pswp__icn-close`},onClick:`close`},de={name:`zoom`,title:`Zoom`,order:10,isButton:!0,html:{isCustomSVG:!0,inner:`<path d="M17.426 19.926a6 6 0 1 1 1.5-1.5L23 22.5 21.5 24l-4.074-4.074z" id="pswp__icn-zoom"/><path fill="currentColor" class="pswp__zoom-icn-bar-h" d="M11 16v-2h6v2z"/><path fill="currentColor" class="pswp__zoom-icn-bar-v" d="M13 12h2v6h-2z"/>`,outlineID:`pswp__icn-zoom`},onClick:`toggleZoom`},fe={name:`preloader`,appendTo:`bar`,order:7,html:{isCustomSVG:!0,inner:`<path fill-rule="evenodd" clip-rule="evenodd" d="M21.2 16a5.2 5.2 0 1 1-5.2-5.2V8a8 8 0 1 0 8 8h-2.8Z" id="pswp__icn-loading"/>`,outlineID:`pswp__icn-loading`},onInit:(e,t)=>{let n,r=null,i=(t,n)=>{e.classList.toggle(`pswp__preloader--`+t,n)},a=e=>{n!==e&&(n=e,i(`active`,e))},o=()=>{var e;if(!((e=t.currSlide)!=null&&e.content.isLoading())){a(!1),r&&=(clearTimeout(r),null);return}r||=setTimeout(()=>{a(!!t.currSlide?.content.isLoading()),r=null},t.options.preloaderDelay)};t.on(`change`,o),t.on(`loadComplete`,e=>{t.currSlide===e.slide&&o()}),t.ui&&(t.ui.updatePreloaderVisibility=o)}},pe={name:`counter`,order:5,onInit:(e,t)=>{t.on(`change`,()=>{e.innerText=t.currIndex+1+t.options.indexIndicatorSep+t.getNumItems()})}};function X(e,t){e.classList.toggle(`pswp--zoomed-in`,t)}var me=class{constructor(e){this.pswp=e,this.isRegistered=!1,this.uiElementsData=[],this.items=[],this.updatePreloaderVisibility=()=>{},this._lastUpdatedZoomLevel=void 0}init(){let{pswp:e}=this;this.isRegistered=!1,this.uiElementsData=[ue,ce,le,de,fe,pe],e.dispatch(`uiRegister`),this.uiElementsData.sort((e,t)=>(e.order||0)-(t.order||0)),this.items=[],this.isRegistered=!0,this.uiElementsData.forEach(e=>{this.registerElement(e)}),e.on(`change`,()=>{var t;(t=e.element)==null||t.classList.toggle(`pswp--one-slide`,e.getNumItems()===1)}),e.on(`zoomPanUpdate`,()=>this._onZoomPanUpdate())}registerElement(e){this.isRegistered?this.items.push(new se(this.pswp,e)):this.uiElementsData.push(e)}_onZoomPanUpdate(){let{template:e,currSlide:t,options:n}=this.pswp;if(this.pswp.opener.isClosing||!e||!t)return;let{currZoomLevel:r}=t;if(this.pswp.opener.isOpen||(r=t.zoomLevels.initial),r===this._lastUpdatedZoomLevel)return;this._lastUpdatedZoomLevel=r;let i=t.zoomLevels.initial-t.zoomLevels.secondary;if(Math.abs(i)<.01||!t.isZoomable()){X(e,!1),e.classList.remove(`pswp--zoom-allowed`);return}e.classList.add(`pswp--zoom-allowed`),X(e,(r===t.zoomLevels.initial?t.zoomLevels.secondary:t.zoomLevels.initial)<=r),(n.imageClickAction===`zoom`||n.imageClickAction===`zoom-or-close`)&&e.classList.add(`pswp--click-to-zoom`)}};function he(e){let t=e.getBoundingClientRect();return{x:t.left,y:t.top,w:t.width}}function ge(e,t,n){let r=e.getBoundingClientRect(),i=r.width/t,a=r.height/n,o=i>a?i:a,s=(r.width-t*o)/2,c=(r.height-n*o)/2,l={x:r.left+s,y:r.top+c,w:t*o};return l.innerRect={w:r.width,h:r.height,x:s,y:c},l}function _e(e,t,n){let r=n.dispatch(`thumbBounds`,{index:e,itemData:t,instance:n});if(r.thumbBounds)return r.thumbBounds;let{element:i}=t,a,o;if(i&&n.options.thumbSelector!==!1){let e=n.options.thumbSelector||`img`;o=i.matches(e)?i:i.querySelector(e)}return o=n.applyFilters(`thumbEl`,o,t,e),o&&(a=t.thumbCropped?ge(o,t.width||t.w||0,t.height||t.h||0):he(o)),n.applyFilters(`thumbBounds`,a,t,e)}var ve=class{constructor(e,t){this.type=e,this.defaultPrevented=!1,t&&Object.assign(this,t)}preventDefault(){this.defaultPrevented=!0}},ye=class{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(e,t,n=100){var r,i,a;this._filters[e]||(this._filters[e]=[]),(r=this._filters[e])==null||r.push({fn:t,priority:n}),(i=this._filters[e])==null||i.sort((e,t)=>e.priority-t.priority),(a=this.pswp)==null||a.addFilter(e,t,n)}removeFilter(e,t){this._filters[e]&&(this._filters[e]=this._filters[e].filter(e=>e.fn!==t)),this.pswp&&this.pswp.removeFilter(e,t)}applyFilters(e,...t){var n;return(n=this._filters[e])==null||n.forEach(e=>{t[0]=e.fn.apply(this,t)}),t[0]}on(e,t){var n,r;this._listeners[e]||(this._listeners[e]=[]),(n=this._listeners[e])==null||n.push(t),(r=this.pswp)==null||r.on(e,t)}off(e,t){var n;this._listeners[e]&&(this._listeners[e]=this._listeners[e].filter(e=>t!==e)),(n=this.pswp)==null||n.off(e,t)}dispatch(e,t){var n;if(this.pswp)return this.pswp.dispatch(e,t);let r=new ve(e,t);return(n=this._listeners[e])==null||n.forEach(e=>{e.call(this,r)}),r}},be=class{constructor(t,n){if(this.element=e(`pswp__img pswp__img--placeholder`,t?`img`:`div`,n),t){let e=this.element;e.decoding=`async`,e.alt=``,e.src=t,e.setAttribute(`role`,`presentation`)}this.element.setAttribute(`aria-hidden`,`true`)}setDisplayedSize(e,t){this.element&&(this.element.tagName===`IMG`?(u(this.element,250,`auto`),this.element.style.transformOrigin=`0 0`,this.element.style.transform=o(0,0,e/250)):u(this.element,e,t))}destroy(){var e;(e=this.element)!=null&&e.parentNode&&this.element.remove(),this.element=null}},xe=class{constructor(e,t,n){this.instance=t,this.data=e,this.index=n,this.element=void 0,this.placeholder=void 0,this.slide=void 0,this.displayedImageWidth=0,this.displayedImageHeight=0,this.width=Number(this.data.w)||Number(this.data.width)||0,this.height=Number(this.data.h)||Number(this.data.height)||0,this.isAttached=!1,this.hasSlide=!1,this.isDecoding=!1,this.state=p.IDLE,this.data.type?this.type=this.data.type:this.data.src?this.type=`image`:this.type=`html`,this.instance.dispatch(`contentInit`,{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout(()=>{this.placeholder&&=(this.placeholder.destroy(),void 0)},1e3)}load(t,n){if(this.slide&&this.usePlaceholder())if(!this.placeholder)this.placeholder=new be(this.instance.applyFilters(`placeholderSrc`,this.data.msrc&&this.slide.isFirstSlide?this.data.msrc:!1,this),this.slide.container);else{let e=this.placeholder.element;e&&!e.parentElement&&this.slide.container.prepend(e)}this.element&&!n||this.instance.dispatch(`contentLoad`,{content:this,isLazy:t}).defaultPrevented||(this.isImageContent()?(this.element=e(`pswp__img`,`img`),this.displayedImageWidth&&this.loadImage(t)):(this.element=e(`pswp__content`,`div`),this.element.innerHTML=this.data.html||``),n&&this.slide&&this.slide.updateContentSize(!0))}loadImage(e){if(!this.isImageContent()||!this.element||this.instance.dispatch(`contentLoadImage`,{content:this,isLazy:e}).defaultPrevented)return;let t=this.element;this.updateSrcsetSizes(),this.data.srcset&&(t.srcset=this.data.srcset),t.src=this.data.src??``,t.alt=this.data.alt??``,this.state=p.LOADING,t.complete?this.onLoaded():(t.onload=()=>{this.onLoaded()},t.onerror=()=>{this.onError()})}setSlide(e){this.slide=e,this.hasSlide=!0,this.instance=e.pswp}onLoaded(){this.state=p.LOADED,this.slide&&this.element&&(this.instance.dispatch(`loadComplete`,{slide:this.slide,content:this}),this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode&&(this.append(),this.slide.updateContentSize(!0)),(this.state===p.LOADED||this.state===p.ERROR)&&this.removePlaceholder())}onError(){this.state=p.ERROR,this.slide&&(this.displayError(),this.instance.dispatch(`loadComplete`,{slide:this.slide,isError:!0,content:this}),this.instance.dispatch(`loadError`,{slide:this.slide,content:this}))}isLoading(){return this.instance.applyFilters(`isContentLoading`,this.state===p.LOADING,this)}isError(){return this.state===p.ERROR}isImageContent(){return this.type===`image`}setDisplayedSize(e,t){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(e,t),!this.instance.dispatch(`contentResize`,{content:this,width:e,height:t}).defaultPrevented&&(u(this.element,e,t),this.isImageContent()&&!this.isError()))){let n=!this.displayedImageWidth&&e;this.displayedImageWidth=e,this.displayedImageHeight=t,n?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch(`imageSizeChange`,{slide:this.slide,width:e,height:t,content:this})}}isZoomable(){return this.instance.applyFilters(`isContentZoomable`,this.isImageContent()&&this.state!==p.ERROR,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;let e=this.element,t=this.instance.applyFilters(`srcsetSizesWidth`,this.displayedImageWidth,this);(!e.dataset.largestUsedSize||t>parseInt(e.dataset.largestUsedSize,10))&&(e.sizes=t+`px`,e.dataset.largestUsedSize=String(t))}usePlaceholder(){return this.instance.applyFilters(`useContentPlaceholder`,this.isImageContent(),this)}lazyLoad(){this.instance.dispatch(`contentLazyLoad`,{content:this}).defaultPrevented||this.load(!0)}keepPlaceholder(){return this.instance.applyFilters(`isKeepingPlaceholder`,this.isLoading(),this)}destroy(){this.hasSlide=!1,this.slide=void 0,!this.instance.dispatch(`contentDestroy`,{content:this}).defaultPrevented&&(this.remove(),this.placeholder&&=(this.placeholder.destroy(),void 0),this.isImageContent()&&this.element&&(this.element.onload=null,this.element.onerror=null,this.element=void 0))}displayError(){if(this.slide){let t=e(`pswp__error-msg`,`div`);t.innerText=this.instance.options?.errorMsg??``,t=this.instance.applyFilters(`contentErrorElement`,t,this),this.element=e(`pswp__content pswp__error-msg-container`,`div`),this.element.appendChild(t),this.slide.container.innerText=``,this.slide.container.appendChild(this.element),this.slide.updateContentSize(!0),this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;if(this.isAttached=!0,this.state===p.ERROR){this.displayError();return}if(this.instance.dispatch(`contentAppend`,{content:this}).defaultPrevented)return;let e=`decode`in this.element;this.isImageContent()?e&&this.slide&&(!this.slide.isActive||g())?(this.isDecoding=!0,this.element.decode().catch(()=>{}).finally(()=>{this.isDecoding=!1,this.appendImage()})):this.appendImage():this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){this.instance.dispatch(`contentActivate`,{content:this}).defaultPrevented||!this.slide||(this.isImageContent()&&this.isDecoding&&!g()?this.appendImage():this.isError()&&this.load(!1,!0),this.slide.holderElement&&this.slide.holderElement.setAttribute(`aria-hidden`,`false`))}deactivate(){this.instance.dispatch(`contentDeactivate`,{content:this}),this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute(`aria-hidden`,`true`)}remove(){this.isAttached=!1,!this.instance.dispatch(`contentRemove`,{content:this}).defaultPrevented&&(this.element&&this.element.parentNode&&this.element.remove(),this.placeholder&&this.placeholder.element&&this.placeholder.element.remove())}appendImage(){this.isAttached&&(this.instance.dispatch(`contentAppendImage`,{content:this}).defaultPrevented||(this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element),(this.state===p.LOADED||this.state===p.ERROR)&&this.removePlaceholder()))}},Se=5;function Z(e,t,n){let r=t.createContentFromData(e,n),i,{options:a}=t;if(a){i=new S(a,e,-1);let o;o=t.pswp?t.pswp.viewportSize:v(a,t);let s=b(a,o,e,n);i.update(r.width,r.height,s)}return r.lazyLoad(),i&&r.setDisplayedSize(Math.ceil(r.width*i.initial),Math.ceil(r.height*i.initial)),r}function Ce(e,t){let n=t.getItemData(e);if(!t.dispatch(`lazyLoadSlide`,{index:e,itemData:n}).defaultPrevented)return Z(n,t,e)}var we=class{constructor(e){this.pswp=e,this.limit=Math.max(e.options.preload[0]+e.options.preload[1]+1,Se),this._cachedItems=[]}updateLazy(e){let{pswp:t}=this;if(t.dispatch(`lazyLoad`).defaultPrevented)return;let{preload:n}=t.options,r=e===void 0?!0:e>=0,i;for(i=0;i<=n[1];i++)this.loadSlideByIndex(t.currIndex+(r?i:-i));for(i=1;i<=n[0];i++)this.loadSlideByIndex(t.currIndex+(r?-i:i))}loadSlideByIndex(e){let t=this.pswp.getLoopedIndex(e),n=this.getContentByIndex(t);n||(n=Ce(t,this.pswp),n&&this.addToCache(n))}getContentBySlide(e){let t=this.getContentByIndex(e.index);return t||(t=this.pswp.createContentFromData(e.data,e.index),this.addToCache(t)),t.setSlide(e),t}addToCache(e){if(this.removeByIndex(e.index),this._cachedItems.push(e),this._cachedItems.length>this.limit){let e=this._cachedItems.findIndex(e=>!e.isAttached&&!e.hasSlide);e!==-1&&this._cachedItems.splice(e,1)[0].destroy()}}removeByIndex(e){let t=this._cachedItems.findIndex(t=>t.index===e);t!==-1&&this._cachedItems.splice(t,1)}getContentByIndex(e){return this._cachedItems.find(t=>t.index===e)}destroy(){this._cachedItems.forEach(e=>e.destroy()),this._cachedItems=[]}},Q=class extends ye{getNumItems(){let e=0,t=this.options?.dataSource;t&&`length`in t?e=t.length:t&&`gallery`in t&&(t.items||=this._getGalleryDOMElements(t.gallery),t.items&&(e=t.items.length));let n=this.dispatch(`numItems`,{dataSource:t,numItems:e});return this.applyFilters(`numItems`,n.numItems,t)}createContentFromData(e,t){return new xe(e,this,t)}getItemData(e){let t=this.options?.dataSource,n={};Array.isArray(t)?n=t[e]:t&&`gallery`in t&&(t.items||=this._getGalleryDOMElements(t.gallery),n=t.items[e]);let r=n;r instanceof Element&&(r=this._domElementToItemData(r));let i=this.dispatch(`itemData`,{itemData:r||{},index:e});return this.applyFilters(`itemData`,i.itemData,e)}_getGalleryDOMElements(e){var t,n;return(t=this.options)!=null&&t.children||(n=this.options)!=null&&n.childSelector?h(this.options.children,this.options.childSelector,e)||[]:[e]}_domElementToItemData(e){let t={element:e},n=e.tagName===`A`?e:e.querySelector(`a`);if(n){t.src=n.dataset.pswpSrc||n.href,n.dataset.pswpSrcset&&(t.srcset=n.dataset.pswpSrcset),t.width=n.dataset.pswpWidth?parseInt(n.dataset.pswpWidth,10):0,t.height=n.dataset.pswpHeight?parseInt(n.dataset.pswpHeight,10):0,t.w=t.width,t.h=t.height,n.dataset.pswpType&&(t.type=n.dataset.pswpType);let r=e.querySelector(`img`);r&&(t.msrc=r.currentSrc||r.src,t.alt=r.getAttribute(`alt`)??``),(n.dataset.pswpCropped||n.dataset.cropped)&&(t.thumbCropped=!0)}return this.applyFilters(`domItemData`,t,e,n)}lazyLoadData(e,t){return Z(e,this,t)}},$=.003,Te=class{constructor(e){this.pswp=e,this.isClosed=!0,this.isOpen=!1,this.isClosing=!1,this.isOpening=!1,this._duration=void 0,this._useAnimation=!1,this._croppedZoom=!1,this._animateRootOpacity=!1,this._animateBgOpacity=!1,this._placeholder=void 0,this._opacityElement=void 0,this._cropContainer1=void 0,this._cropContainer2=void 0,this._thumbBounds=void 0,this._prepareOpen=this._prepareOpen.bind(this),e.on(`firstZoomPan`,this._prepareOpen)}open(){this._prepareOpen(),this._start()}close(){if(this.isClosed||this.isClosing||this.isOpening)return;let e=this.pswp.currSlide;this.isOpen=!1,this.isOpening=!1,this.isClosing=!0,this._duration=this.pswp.options.hideAnimationDuration,e&&e.currZoomLevel*e.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps(),setTimeout(()=>{this._start()},this._croppedZoom?30:0)}_prepareOpen(){if(this.pswp.off(`firstZoomPan`,this._prepareOpen),!this.isOpening){let e=this.pswp.currSlide;this.isOpening=!0,this.isClosing=!1,this._duration=this.pswp.options.showAnimationDuration,e&&e.zoomLevels.initial*e.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps()}}_applyStartProps(){let{pswp:e}=this,t=this.pswp.currSlide,{options:n}=e;if(n.showHideAnimationType===`fade`?(n.showHideOpacity=!0,this._thumbBounds=void 0):n.showHideAnimationType===`none`?(n.showHideOpacity=!1,this._duration=0,this._thumbBounds=void 0):this.isOpening&&e._initialThumbBounds?this._thumbBounds=e._initialThumbBounds:this._thumbBounds=this.pswp.getThumbBounds(),this._placeholder=t?.getPlaceholderElement(),e.animations.stopAll(),this._useAnimation=!!(this._duration&&this._duration>50),this._animateZoom=!!this._thumbBounds&&t?.content.usePlaceholder()&&(!this.isClosing||!e.mainScroll.isShifted()),this._animateZoom?this._animateRootOpacity=n.showHideOpacity??!1:(this._animateRootOpacity=!0,this.isOpening&&t&&(t.zoomAndPanToInitial(),t.applyCurrentZoomPan())),this._animateBgOpacity=!this._animateRootOpacity&&this.pswp.options.bgOpacity>$,this._opacityElement=this._animateRootOpacity?e.element:e.bg,!this._useAnimation){this._duration=0,this._animateZoom=!1,this._animateBgOpacity=!1,this._animateRootOpacity=!0,this.isOpening&&(e.element&&(e.element.style.opacity=String($)),e.applyBgOpacity(1));return}this._animateZoom&&this._thumbBounds&&this._thumbBounds.innerRect?(this._croppedZoom=!0,this._cropContainer1=this.pswp.container,this._cropContainer2=this.pswp.currSlide?.holderElement,e.container&&(e.container.style.overflow=`hidden`,e.container.style.width=e.viewportSize.x+`px`)):this._croppedZoom=!1,this.isOpening?(this._animateRootOpacity?(e.element&&(e.element.style.opacity=String($)),e.applyBgOpacity(1)):(this._animateBgOpacity&&e.bg&&(e.bg.style.opacity=String($)),e.element&&(e.element.style.opacity=`1`)),this._animateZoom&&(this._setClosedStateZoomPan(),this._placeholder&&(this._placeholder.style.willChange=`transform`,this._placeholder.style.opacity=String($)))):this.isClosing&&(e.mainScroll.itemHolders[0]&&(e.mainScroll.itemHolders[0].el.style.display=`none`),e.mainScroll.itemHolders[2]&&(e.mainScroll.itemHolders[2].el.style.display=`none`),this._croppedZoom&&e.mainScroll.x!==0&&(e.mainScroll.resetPosition(),e.mainScroll.resize()))}_start(){this.isOpening&&this._useAnimation&&this._placeholder&&this._placeholder.tagName===`IMG`?new Promise(e=>{let t=!1,n=!0;f(this._placeholder).finally(()=>{t=!0,n||e(!0)}),setTimeout(()=>{n=!1,t&&e(!0)},50),setTimeout(e,250)}).finally(()=>this._initiate()):this._initiate()}_initiate(){var e,t;(e=this.pswp.element)==null||e.style.setProperty(`--pswp-transition-duration`,this._duration+`ms`),this.pswp.dispatch(this.isOpening?`openingAnimationStart`:`closingAnimationStart`),this.pswp.dispatch(`initialZoom`+(this.isOpening?`In`:`Out`)),(t=this.pswp.element)==null||t.classList.toggle(`pswp--ui-visible`,this.isOpening),this.isOpening?(this._placeholder&&(this._placeholder.style.opacity=`1`),this._animateToOpenState()):this.isClosing&&this._animateToClosedState(),this._useAnimation||this._onAnimationComplete()}_onAnimationComplete(){let{pswp:e}=this;if(this.isOpen=this.isOpening,this.isClosed=this.isClosing,this.isOpening=!1,this.isClosing=!1,e.dispatch(this.isOpen?`openingAnimationEnd`:`closingAnimationEnd`),e.dispatch(`initialZoom`+(this.isOpen?`InEnd`:`OutEnd`)),this.isClosed)e.destroy();else if(this.isOpen){var t;this._animateZoom&&e.container&&(e.container.style.overflow=`visible`,e.container.style.width=`100%`),(t=e.currSlide)==null||t.applyCurrentZoomPan()}}_animateToOpenState(){let{pswp:e}=this;this._animateZoom&&(this._croppedZoom&&this._cropContainer1&&this._cropContainer2&&(this._animateTo(this._cropContainer1,`transform`,`translate3d(0,0,0)`),this._animateTo(this._cropContainer2,`transform`,`none`)),e.currSlide&&(e.currSlide.zoomAndPanToInitial(),this._animateTo(e.currSlide.container,`transform`,e.currSlide.getCurrentTransform()))),this._animateBgOpacity&&e.bg&&this._animateTo(e.bg,`opacity`,String(e.options.bgOpacity)),this._animateRootOpacity&&e.element&&this._animateTo(e.element,`opacity`,`1`)}_animateToClosedState(){let{pswp:e}=this;this._animateZoom&&this._setClosedStateZoomPan(!0),this._animateBgOpacity&&e.bgOpacity>.01&&e.bg&&this._animateTo(e.bg,`opacity`,`0`),this._animateRootOpacity&&e.element&&this._animateTo(e.element,`opacity`,`0`)}_setClosedStateZoomPan(e){if(!this._thumbBounds)return;let{pswp:n}=this,{innerRect:r}=this._thumbBounds,{currSlide:i,viewportSize:a}=n;if(this._croppedZoom&&r&&this._cropContainer1&&this._cropContainer2){let t=-a.x+(this._thumbBounds.x-r.x)+r.w,n=-a.y+(this._thumbBounds.y-r.y)+r.h,i=a.x-r.w,c=a.y-r.h;e?(this._animateTo(this._cropContainer1,`transform`,o(t,n)),this._animateTo(this._cropContainer2,`transform`,o(i,c))):(s(this._cropContainer1,t,n),s(this._cropContainer2,i,c))}i&&(t(i.pan,r||this._thumbBounds),i.currZoomLevel=this._thumbBounds.w/i.width,e?this._animateTo(i.container,`transform`,i.getCurrentTransform()):i.applyCurrentZoomPan())}_animateTo(e,t,n){if(!this._duration){e.style[t]=n;return}let{animations:r}=this.pswp,i={duration:this._duration,easing:this.pswp.options.easing,onComplete:()=>{r.activeAnimations.length||this._onAnimationComplete()},target:e};i[t]=n,r.startTransition(i)}},Ee={allowPanToNext:!0,spacing:.1,loop:!0,pinchToClose:!0,closeOnVerticalDrag:!0,hideAnimationDuration:333,showAnimationDuration:333,zoomAnimationDuration:333,escKey:!0,arrowKeys:!0,trapFocus:!0,returnFocus:!0,maxWidthToAnimate:4e3,clickToCloseNonZoomable:!0,imageClickAction:`zoom-or-close`,bgClickAction:`close`,tapAction:`toggle-controls`,doubleTapAction:`zoom`,indexIndicatorSep:` / `,preloaderDelay:2e3,bgOpacity:.8,index:0,errorMsg:`The image cannot be loaded`,preload:[1,2],easing:`cubic-bezier(.4,0,.22,1)`},De=class extends Q{constructor(e){super(),this.options=this._prepareOptions(e||{}),this.offset={x:0,y:0},this._prevViewportSize={x:0,y:0},this.viewportSize={x:0,y:0},this.bgOpacity=1,this.currIndex=0,this.potentialIndex=0,this.isOpen=!1,this.isDestroying=!1,this.hasMouse=!1,this._initialItemData={},this._initialThumbBounds=void 0,this.topBar=void 0,this.element=void 0,this.template=void 0,this.container=void 0,this.scrollWrap=void 0,this.currSlide=void 0,this.events=new ee,this.animations=new q,this.mainScroll=new L(this),this.gestures=new F(this),this.opener=new Te(this),this.keyboard=new B(this),this.contentLoader=new we(this)}init(){if(this.isOpen||this.isDestroying)return!1;this.isOpen=!0,this.dispatch(`init`),this.dispatch(`beforeOpen`),this._createMainStructure();let e=`pswp--open`;return this.gestures.supportsTouch&&(e+=` pswp--touch`),this.options.mainClass&&(e+=` `+this.options.mainClass),this.element&&(this.element.className+=` `+e),this.currIndex=this.options.index||0,this.potentialIndex=this.currIndex,this.dispatch(`firstUpdate`),this.scrollWheel=new J(this),(Number.isNaN(this.currIndex)||this.currIndex<0||this.currIndex>=this.getNumItems())&&(this.currIndex=0),this.gestures.supportsTouch||this.mouseDetected(),this.updateSize(),this.offset.y=window.pageYOffset,this._initialItemData=this.getItemData(this.currIndex),this.dispatch(`gettingData`,{index:this.currIndex,data:this._initialItemData,slide:void 0}),this._initialThumbBounds=this.getThumbBounds(),this.dispatch(`initialLayout`),this.on(`openingAnimationEnd`,()=>{let{itemHolders:e}=this.mainScroll;e[0]&&(e[0].el.style.display=`block`,this.setContent(e[0],this.currIndex-1)),e[2]&&(e[2].el.style.display=`block`,this.setContent(e[2],this.currIndex+1)),this.appendHeavy(),this.contentLoader.updateLazy(),this.events.add(window,`resize`,this._handlePageResize.bind(this)),this.events.add(window,`scroll`,this._updatePageScrollOffset.bind(this)),this.dispatch(`bindEvents`)}),this.mainScroll.itemHolders[1]&&this.setContent(this.mainScroll.itemHolders[1],this.currIndex),this.dispatch(`change`),this.opener.open(),this.dispatch(`afterInit`),!0}getLoopedIndex(e){let t=this.getNumItems();return this.options.loop&&(e>t-1&&(e-=t),e<0&&(e+=t)),a(e,0,t-1)}appendHeavy(){this.mainScroll.itemHolders.forEach(e=>{var t;(t=e.slide)==null||t.appendHeavy()})}goTo(e){this.mainScroll.moveIndexBy(this.getLoopedIndex(e)-this.potentialIndex)}next(){this.goTo(this.potentialIndex+1)}prev(){this.goTo(this.potentialIndex-1)}zoomTo(...e){var t;(t=this.currSlide)==null||t.zoomTo(...e)}toggleZoom(){var e;(e=this.currSlide)==null||e.toggleZoom()}close(){!this.opener.isOpen||this.isDestroying||(this.isDestroying=!0,this.dispatch(`close`),this.events.removeAll(),this.opener.close())}destroy(){var e;if(!this.isDestroying){this.options.showHideAnimationType=`none`,this.close();return}this.dispatch(`destroy`),this._listeners={},this.scrollWrap&&(this.scrollWrap.ontouchmove=null,this.scrollWrap.ontouchend=null),(e=this.element)==null||e.remove(),this.mainScroll.itemHolders.forEach(e=>{var t;(t=e.slide)==null||t.destroy()}),this.contentLoader.destroy(),this.events.removeAll()}refreshSlideContent(e){this.contentLoader.removeByIndex(e),this.mainScroll.itemHolders.forEach((t,n)=>{let r=(this.currSlide?.index??0)-1+n;if(this.canLoop()&&(r=this.getLoopedIndex(r)),r===e&&(this.setContent(t,e,!0),n===1)){var i;this.currSlide=t.slide,(i=t.slide)==null||i.setIsActive(!0)}}),this.dispatch(`change`)}setContent(e,t,n){if(this.canLoop()&&(t=this.getLoopedIndex(t)),e.slide){if(e.slide.index===t&&!n)return;e.slide.destroy(),e.slide=void 0}!this.canLoop()&&(t<0||t>=this.getNumItems())||(e.slide=new C(this.getItemData(t),t,this),t===this.currIndex&&(this.currSlide=e.slide),e.slide.append(e.el))}getViewportCenterPoint(){return{x:this.viewportSize.x/2,y:this.viewportSize.y/2}}updateSize(e){if(this.isDestroying)return;let n=v(this.options,this);!e&&i(n,this._prevViewportSize)||(t(this._prevViewportSize,n),this.dispatch(`beforeResize`),t(this.viewportSize,this._prevViewportSize),this._updatePageScrollOffset(),this.dispatch(`viewportSize`),this.mainScroll.resize(this.opener.isOpen),!this.hasMouse&&window.matchMedia(`(any-hover: hover)`).matches&&this.mouseDetected(),this.dispatch(`resize`))}applyBgOpacity(e){this.bgOpacity=Math.max(e,0),this.bg&&(this.bg.style.opacity=String(this.bgOpacity*this.options.bgOpacity))}mouseDetected(){if(!this.hasMouse){var e;this.hasMouse=!0,(e=this.element)==null||e.classList.add(`pswp--has_mouse`)}}_handlePageResize(){this.updateSize(),/iPhone|iPad|iPod/i.test(window.navigator.userAgent)&&setTimeout(()=>{this.updateSize()},500)}_updatePageScrollOffset(){this.setScrollOffset(0,window.pageYOffset)}setScrollOffset(e,t){this.offset.x=e,this.offset.y=t,this.dispatch(`updateScrollOffset`)}_createMainStructure(){this.element=e(`pswp`,`div`),this.element.setAttribute(`tabindex`,`-1`),this.element.setAttribute(`role`,`dialog`),this.template=this.element,this.bg=e(`pswp__bg`,`div`,this.element),this.scrollWrap=e(`pswp__scroll-wrap`,`section`,this.element),this.container=e(`pswp__container`,`div`,this.scrollWrap),this.scrollWrap.setAttribute(`aria-roledescription`,`carousel`),this.container.setAttribute(`aria-live`,`off`),this.container.setAttribute(`id`,`pswp__items`),this.mainScroll.appendHolders(),this.ui=new me(this),this.ui.init(),(this.options.appendToEl||document.body).appendChild(this.element)}getThumbBounds(){return _e(this.currIndex,this.currSlide?this.currSlide.data:this._initialItemData,this)}canLoop(){return this.options.loop&&this.getNumItems()>2}_prepareOptions(e){return window.matchMedia(`(prefers-reduced-motion), (update: slow)`).matches&&(e.showHideAnimationType=`none`,e.zoomAnimationDuration=0),{...Ee,...e}}};export{De as default};