Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

photoswipe

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

photoswipe - npm Package Compare versions

Comparing version 5.2.0-beta.1 to 5.2.0-beta.2

2

dist/photoswipe-lightbox.esm.js
/*!
* PhotoSwipe Lightbox 5.2.0-beta.0 - https://photoswipe.com
* PhotoSwipe Lightbox 5.2.0-beta.2 - https://photoswipe.com
* (c) 2022 Dmitry Semenov

@@ -4,0 +4,0 @@ */

/*!
* PhotoSwipe Lightbox 5.2.0-beta.0 - https://photoswipe.com
* PhotoSwipe Lightbox 5.2.0-beta.2 - https://photoswipe.com
* (c) 2022 Dmitry Semenov
*/
function t(t,s,i){const h=document.createElement(s||"div");return t&&(h.className=t),i&&i.appendChild(h),h}function s(t,s,i){t.style.width="number"==typeof s?s+"px":s,t.style.height="number"==typeof i?i+"px":i}const i="idle",h="loading",e="loaded",n="error";function r(t,s,i=document){let h=[];if(t instanceof Element)h=[t];else if(t instanceof NodeList||Array.isArray(t))h=Array.from(t);else{const e="string"==typeof t?t:s;e&&(h=Array.from(i.querySelectorAll(e)))}return h}class o{constructor(t,s){this.type=t,s&&Object.assign(this,s)}preventDefault(){this.defaultPrevented=!0}}class a{constructor(t,s){this.options=s.options,this.instance=s,this.data=t,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.state=i}setSlide(t){this.slide=t,this.pswp=t.pswp}load(){this.element||(this.element=t("pswp__content"),this.element.style.position="absolute",this.element.style.left=0,this.element.style.top=0,this.element.innerHTML=this.data.html||"")}isZoomable(){return!1}usePlaceholder(){return!1}activate(){}deactivate(){}setDisplayedSize(t,i){this.element&&s(this.element,t,i)}onLoaded(){this.state=e,this.slide&&this.pswp.dispatch("loadComplete",{slide:this.slide})}isLoading(){return this.state===h}keepPlaceholder(){return this.isLoading()}onError(){this.state=n,this.slide&&(this.pswp.dispatch("loadComplete",{slide:this.slide,isError:!0}),this.pswp.dispatch("loadError",{slide:this.slide}))}getErrorElement(){return!1}remove(){this.isAttached=!1,this.element&&this.element.parentNode&&this.element.remove()}appendTo(t){this.isAttached=!0,this.element&&!this.element.parentNode&&t.appendChild(this.element)}destroy(){}}class l extends a{load(){if(this.element)return;const s=this.data.src;s&&(this.element=t("pswp__img","img"),this.data.srcset&&(this.element.srcset=this.data.srcset),this.element.src=s,this.element.alt=this.data.alt||"",this.state=h,this.element.complete?this.onLoaded():(this.element.onload=()=>{this.onLoaded()},this.element.onerror=()=>{this.onError()}))}setDisplayedSize(t,i){const h=this.element;h&&(s(h,t,"auto"),h.srcset&&(!h.dataset.largestUsedSize||t>h.dataset.largestUsedSize)&&(h.sizes=t+"px",h.dataset.largestUsedSize=t),this.slide&&this.pswp.dispatch("imageSizeChange",{slide:this.slide,width:t,height:i}))}isZoomable(){return this.state!==n}usePlaceholder(){return!0}lazyLoad(){this.load()}destroy(){this.element&&(this.element.onload=null,this.element.onerror=null,this.element=null)}appendTo(t){this.isAttached=!0,this.slide&&!this.slide.isActive&&"decode"in this.element?(this.isDecoding=!0,requestAnimationFrame((()=>{this.element&&this.element.decode().then((()=>{this.isDecoding=!1,requestAnimationFrame((()=>{this.appendImageTo(t)}))})).catch((()=>{}))}))):this.appendImageTo(t)}activate(){this.slide&&this.slide.container&&this.isDecoding&&this.appendImageTo(this.slide.container)}getErrorElement(){const s=t("pswp__error-msg-container");s.innerHTML=this.options.errorMsg;const i=s.querySelector("a");return i&&(i.href=this.data.src),s}appendImageTo(t){this.element&&!this.element.parentNode&&this.isAttached&&t.appendChild(this.element)}}function u(t,s,i){let h;if(s.paddingFn)h=s.paddingFn(i)[t];else if(s.padding)h=s.padding[t];else{const i="padding"+t[0].toUpperCase()+t.slice(1);s[i]&&(h=s[i])}return h||0}class c{constructor(t,s,i,h){this.pswp=h,this.options=t,this.itemData=s,this.index=i}update(t,s,i){this.elementSize={x:t,y:s},this.panAreaSize=i;const h=this.panAreaSize.x/this.elementSize.x,e=this.panAreaSize.y/this.elementSize.y;this.fit=Math.min(1,h<e?h:e),this.fill=Math.min(1,h>e?h:e),this.vFill=Math.min(1,e),this.initial=this.t(),this.secondary=this.i(),this.max=Math.max(this.initial,this.secondary,this.o()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}l(t){const s=this.options[t+"ZoomLevel"];if(s)return"function"==typeof s?s(this):"fill"===s?this.fill:"fit"===s?this.fit:Number(s)}i(){let t=this.l("secondary");return t||(t=Math.min(1,3*this.fit),t*this.elementSize.x>4e3&&(t=4e3/this.elementSize.x),t)}t(){return this.l("initial")||this.fit}o(){const t=this.l("max");return t||Math.max(1,4*this.fit)}}function d(t,s,i){const h=s.createContentFromData(t);if(!h||!h.lazyLoad)return;h.key=function(t,s){return t&&t.src?t.src+"_"+s:s}(t,i);const{options:e}=s,n=s.viewportSize||function(t,s){if(t.getViewportSizeFn){const i=t.getViewportSizeFn(t,s);if(i)return i}return{x:document.documentElement.clientWidth,y:window.innerHeight}}(e),r=function(t,s){return{x:s.x-u("left",t,s)-u("right",t,s),y:s.y-u("top",t,s)-u("bottom",t,s)}}(e,n),o=new c(e,t,-1);return o.update(h.width,h.height,r),h.lazyLoad(),h.setDisplayedSize(Math.ceil(h.width*o.initial),Math.ceil(h.height*o.initial)),h}export default class extends class extends class{constructor(){this.u={},this.m={}}addFilter(t,s,i=100){this.m[t]||(this.m[t]=[]),this.m[t].push({fn:s,priority:i}),this.m[t].sort(((t,s)=>t.priority-s.priority)),this.pswp&&this.pswp.addFilter(t,s,i)}removeFilter(t,s){this.m[t]&&(this.m[t]=this.m[t].filter((t=>t.fn!==s))),this.pswp&&this.pswp.removeFilter(t,s)}applyFilters(t,...s){return this.m[t]&&this.m[t].forEach((t=>{s[0]=t.fn.apply(this,s)})),s[0]}on(t,s){this.u[t]||(this.u[t]=[]),this.u[t].push(s),this.pswp&&this.pswp.on(t,s)}off(t,s){this.u[t]&&(this.u[t]=this.u[t].filter((t=>s!==t))),this.pswp&&this.pswp.off(t,s)}dispatch(t,s){if(this.pswp)return this.pswp.dispatch(t,s);const i=new o(t,s);return this.u?(this.u[t]&&this.u[t].forEach((t=>{t.call(this,i)})),i):i}}{constructor(){super(),this.contentTypes={image:l,html:a}}getNumItems(){let t;const{dataSource:s}=this.options;s?s.length?t=s.length:s.gallery&&(s.items||(s.items=this.p(s.gallery)),s.items&&(t=s.items.length)):t=0;const i=this.dispatch("numItems",{dataSource:s,numItems:t});return this.applyFilters("numItems",i.numItems,s)}addContentType(t,s){this.contentTypes[t]=s}getContentClass(t){return t.type?this.contentTypes[t.type]:t.src?this.contentTypes.image:t.html?this.contentTypes.html:void 0}createContentFromData(t){const s=this.getContentClass(t);if(!s)return!1;return new s(t,this)}getItemData(t){const{dataSource:s}=this.options;let i;Array.isArray(s)?i=s[t]:s&&s.gallery&&(s.items||(s.items=this.p(s.gallery)),i=s.items[t]);let h=i;h instanceof Element&&(h=this.g(h));const e=this.dispatch("itemData",{itemData:h||{},index:t});return this.applyFilters("itemData",e.itemData,t)}p(t){return this.options.children||this.options.childSelector?r(this.options.children,this.options.childSelector,t)||[]:[t]}g(t){const s={element:t},i="A"===t.tagName?t:t.querySelector("a");if(i){s.src=i.dataset.pswpSrc||i.href,s.srcset=i.dataset.pswpSrcset,s.w=parseInt(i.dataset.pswpWidth,10),s.h=parseInt(i.dataset.pswpHeight,10),i.dataset.pswpType&&(s.type=i.dataset.pswpType);const h=t.querySelector("img");h&&(s.msrc=h.currentSrc||h.src,s.alt=h.getAttribute("alt")),(i.dataset.pswpCropped||i.dataset.cropped)&&(s.thumbCropped=!0)}return this.applyFilters("domItemData",s,t,i),s}}{constructor(t){super(),this.options=t||{},this.v=0}init(){this.onThumbnailsClick=this.onThumbnailsClick.bind(this),r(this.options.gallery,this.options.gallerySelector).forEach((t=>{t.addEventListener("click",this.onThumbnailsClick,!1)}))}onThumbnailsClick(t){if(function(t){if(2===t.which||t.ctrlKey||t.metaKey||t.altKey||t.shiftKey)return!0}(t)||window.pswp||!1===window.navigator.onLine)return;let s={x:t.clientX,y:t.clientY};s.x||s.y||(s=null);const i=this.getClickedIndex(t),h={gallery:t.currentTarget};i>=0&&(t.preventDefault(),this.loadAndOpen(i,h,s))}getClickedIndex(t){if(this.options.getClickedIndexFn)return this.options.getClickedIndexFn.call(this,t);const s=t.target,i=r(this.options.children,this.options.childSelector,t.currentTarget).findIndex((t=>t===s||t.contains(s)));return-1!==i?i:this.options.children||this.options.childSelector?-1:0}loadAndOpen(t,s,i){return!window.pswp&&(this.options.index=t,this.options.initialPointerPos=i,this.shouldOpen=!0,this.preload(t,s),!0)}preload(t,s){const{options:i}=this;s&&(i.dataSource=s);const h=[],e=typeof i.pswpModule;if("function"==typeof(n=i.pswpModule)&&/^\s*class\s+/.test(n.toString()))h.push(i.pswpModule);else{if("string"===e)throw new Error("pswpModule as string is no longer supported");if("function"!==e)throw new Error("pswpModule is not valid");h.push(i.pswpModule())}var n;"function"==typeof i.openPromise&&h.push(i.openPromise()),!1!==i.preloadFirstSlide&&t>=0&&(this._=function(t,s){const i=s.getItemData(t);if(!s.dispatch("lazyLoadSlide",{index:t,itemData:i}).defaultPrevented)return d(i,s,t)}(t,this));const r=++this.v;Promise.all(h).then((t=>{if(this.shouldOpen){const s=t[0];this.D(s,r)}}))}D(t,s){if(s!==this.v&&this.shouldOpen)return;if(this.shouldOpen=!1,window.pswp)return;const i="object"==typeof t?new t.default(null,this.options):new t(null,this.options);this.pswp=i,window.pswp=i,Object.keys(this.u).forEach((t=>{this.u[t].forEach((s=>{i.on(t,s)}))})),Object.keys(this.m).forEach((t=>{this.m[t].forEach((s=>{i.addFilter(t,s.fn,s.priority)}))})),i.contentTypes={...this.contentTypes},this._&&(i.contentLoader.addToCache(this._),this._=null),i.on("destroy",(()=>{this.pswp=null,window.pswp=null})),i.init()}destroy(){this.pswp&&this.pswp.close(),this.shouldOpen=!1,this.u=null,r(this.options.gallery,this.options.gallerySelector).forEach((t=>{t.removeEventListener("click",this.onThumbnailsClick,!1)}))}}export{a as Content,l as ImageContent};
/*!
* PhotoSwipe 5.2.0-beta.0 - https://photoswipe.com
* PhotoSwipe 5.2.0-beta.2 - https://photoswipe.com
* (c) 2022 Dmitry Semenov
*/
function t(t,i,s){const h=document.createElement(i||"div");return t&&(h.className=t),s&&s.appendChild(h),h}function i(t,i){return t.x=i.x,t.y=i.y,void 0!==i.id&&(t.id=i.id),t}function s(t){t.x=Math.round(t.x),t.y=Math.round(t.y)}function h(t,i){const s=Math.abs(t.x-i.x),h=Math.abs(t.y-i.y);return Math.sqrt(s*s+h*h)}function e(t,i){return t.x===i.x&&t.y===i.y}function n(t,i,s){return Math.min(Math.max(t,i),s)}function o(t,i,s){let h="translate3d("+t+"px,"+(i||0)+"px,0)";return void 0!==s&&(h+=" scale3d("+s+","+s+",1)"),h}function r(t,i,s,h){t.style.transform=o(i,s,h)}function a(t,i,s,h){t.style.transition=i?i+" "+s+"ms "+(h||"cubic-bezier(.4,0,.22,1)"):"none"}function c(t,i,s){t.style.width="number"==typeof i?i+"px":i,t.style.height="number"==typeof s?s+"px":s}const l="idle",u="loading",p="loaded",d="error";let m=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>{m=!0}}))}catch(t){}class f{constructor(){this.t=[]}add(t,i,s,h){this.i(t,i,s,h)}remove(t,i,s,h){this.i(t,i,s,h,!0)}removeAll(){this.t.forEach((t=>{this.i(t.target,t.type,t.listener,t.passive,!0,!0)})),this.t=[]}i(t,i,s,h,e,n){if(!t)return;const o=(e?"remove":"add")+"EventListener";(i=i.split(" ")).forEach((i=>{if(i){n||(e?this.t=this.t.filter((h=>h.type!==i||h.listener!==s||h.target!==t)):this.t.push({target:t,type:i,listener:s,passive:h}));const r=!!m&&{passive:h||!1};t[o](i,s,r)}}))}}function w(t,i){if(t.getViewportSizeFn){const s=t.getViewportSizeFn(t,i);if(s)return s}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function g(t,i,s){let h;if(i.paddingFn)h=i.paddingFn(s)[t];else if(i.padding)h=i.padding[t];else{const s="padding"+t[0].toUpperCase()+t.slice(1);i[s]&&(h=i[s])}return h||0}function _(t,i){return{x:i.x-g("left",t,i)-g("right",t,i),y:i.y-g("top",t,i)-g("bottom",t,i)}}class y{constructor(t){this.slide=t,this.currZoomLevel=1,this.center={},this.max={},this.min={},this.reset()}update(t){this.currZoomLevel=t,this.slide.width?(this.o("x"),this.o("y"),this.slide.pswp.dispatch("calcBounds",{slide:this.slide})):this.reset()}o(t){const{pswp:i}=this.slide,s=this.slide["x"===t?"width":"height"]*this.currZoomLevel,h=g("x"===t?"left":"top",i.options,i.viewportSize),e=this.slide.panAreaSize[t];this.center[t]=Math.round((e-s)/2)+h,this.max[t]=s>e?Math.round(e-s)+h:this.center[t],this.min[t]=s>e?h:this.center[t]}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(t,i){return n(i,this.max[t],this.min[t])}}class v{constructor(t,i,s,h){this.pswp=h,this.options=t,this.itemData=i,this.index=s}update(t,i,s){this.elementSize={x:t,y:i},this.panAreaSize=s;const h=this.panAreaSize.x/this.elementSize.x,e=this.panAreaSize.y/this.elementSize.y;this.fit=Math.min(1,h<e?h:e),this.fill=Math.min(1,h>e?h:e),this.vFill=Math.min(1,e),this.initial=this.l(),this.secondary=this.u(),this.max=Math.max(this.initial,this.secondary,this.p()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}m(t){const i=this.options[t+"ZoomLevel"];if(i)return"function"==typeof i?i(this):"fill"===i?this.fill:"fit"===i?this.fit:Number(i)}u(){let t=this.m("secondary");return t||(t=Math.min(1,3*this.fit),t*this.elementSize.x>4e3&&(t=4e3/this.elementSize.x),t)}l(){return this.m("initial")||this.fit}p(){const t=this.m("max");return t||Math.max(1,4*this.fit)}}class b{constructor(i,s){this.element=t("pswp__img pswp__img--placeholder",i?"img":"",s),i&&(this.element.decoding="async",this.element.alt="",this.element.src=i,this.element.setAttribute("role","presentation")),this.element.setAttribute("aria-hiden","true")}setDisplayedSize(t,i){this.element&&("IMG"===this.element.tagName?(c(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=o(0,0,t/250)):c(this.element,t,i))}destroy(){this.element.parentNode&&this.element.remove(),this.element=null}}class x{constructor(t,i,s){this.data=t,this.index=i,this.pswp=s,this.isActive=i===s.currIndex,this.currentResolution=0,this.panAreaSize={},this.isFirstSlide=this.isActive&&!s.opener.isOpen,this.zoomLevels=new v(s.options,t,i,s),this.pswp.dispatch("gettingData",{slide:this,data:this.data,index:i}),this.pan={x:0,y:0},this.content=this.pswp.contentLoader.getContentBySlide(this),this.currZoomLevel=1,this.width=this.content.width,this.height=this.content.height,this.bounds=new y(this),this.prevDisplayedWidth=-1,this.prevDisplayedHeight=-1,this.pswp.dispatch("slideInit",{slide:this})}setIsActive(t){t&&!this.isActive?this.activate():!t&&this.isActive&&this.deactivate()}append(i){this.holderElement=i,this.data?(this.calculateSize(),this.container=t("pswp__zoom-wrap"),this.container.transformOrigin="0 0",this.load(),this.appendHeavy(),this.updateContentSize(),this.holderElement.innerHTML="",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()):this.holderElement.innerHTML=""}removePlaceholder(){this.placeholder&&this.content&&!this.content.keepPlaceholder()&&setTimeout((()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=null)}),500)}load(){if(this.usePlaceholder()&&!this.placeholder){const t=this.pswp.applyFilters("placeholderSrc",!(!this.data.msrc||!this.isFirstSlide)&&this.data.msrc,this);this.placeholder=new b(t,this.container)}this.content.load(),this.pswp.dispatch("slideLoad",{slide:this})}isLoading(){return this.pswp.applyFilters("isSlideLoading",this.content.isLoading&&this.content.isLoading(),this)}appendHeavy(){const{pswp:t}=this;!this.heavyAppended&&t.opener.isOpen&&!t.mainScroll.isShifted()&&(this.isActive,1)&&(this.pswp.dispatch("appendHeavy",{slide:this}).defaultPrevented||(this.heavyAppended=!0,this.content.state===d?this.displayError():(this.content.appendTo(this.container),this.placeholder&&this.content.state===p&&this.removePlaceholder()),this.pswp.dispatch("appendHeavyContent",{slide:this})))}setSlideHTML(t){const{container:i}=this;t.tagName?i.appendChild(t):i.innerHTML=t}displayError(){const t=this.content.getErrorElement();t.style.position="absolute",t.style.left=0,t.style.top=0,this.activeErrorElement=t,this.setSlideHTML(t),this.updateContentSize(!0)}activate(){this.isActive=!0,this.appendHeavy(),this.content.activate(),this.pswp.dispatch("slideActivate",{slide:this})}deactivate(){this.isActive=!1,this.content.deactivate(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize(),this.pswp.dispatch("slideDeactivate",{slide:this})}destroy(){this.content.remove(),this.pswp.dispatch("slideDestroy",{slide:this})}resize(){this.currZoomLevel!==this.zoomLevels.initial&&this.isActive?(this.calculateSize(),this.bounds.update(this.currZoomLevel),this.panTo(this.pan.x,this.pan.y)):(this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize())}updateContentSize(t){const i=this.currentResolution||this.zoomLevels.initial;if(!i)return;const s=Math.round(this.width*i)||this.pswp.viewportSize.x,h=Math.round(this.height*i)||this.pswp.viewportSize.y;(this.sizeChanged(s,h)||t)&&(this.placeholder&&this.placeholder.setDisplayedSize(s,h),this.activeErrorElement&&c(this.activeErrorElement,s,h),this.content.setDisplayedSize(s,h))}sizeChanged(t,i){return(t!==this.prevDisplayedWidth||i!==this.prevDisplayedHeight)&&(this.prevDisplayedWidth=t,this.prevDisplayedHeight=i,!0)}getPlaceholderElement(){if(this.placeholder)return this.placeholder.element}zoomTo(t,i,h,e){const{pswp:o}=this;if(!this.isZoomable()||o.mainScroll.isShifted())return;o.dispatch("beforeZoomTo",{destZoomLevel:t,centerPoint:i,transitionDuration:h}),o.animations.stopAllPan();const r=this.currZoomLevel;e||(t=n(t,this.zoomLevels.min,this.zoomLevels.max)),this.setZoomLevel(t),this.pan.x=this.calculateZoomToPanOffset("x",i,r),this.pan.y=this.calculateZoomToPanOffset("y",i,r),s(this.pan);const a=()=>{this.g(t),this.applyCurrentZoomPan()};h?o.animations.startTransition({isPan:!0,name:"zoomTo",target:this.container,transform:this.getCurrentTransform(),onComplete:a,duration:h,easing:o.options.easing}):a()}toggleZoom(t){this.zoomTo(this.currZoomLevel===this.zoomLevels.initial?this.zoomLevels.secondary:this.zoomLevels.initial,t,this.pswp.options.zoomAnimationDuration)}setZoomLevel(t){this.currZoomLevel=t,this.bounds.update(this.currZoomLevel)}calculateZoomToPanOffset(t,i,s){if(0===this.bounds.max[t]-this.bounds.min[t])return this.bounds.center[t];i||(i=this.pswp.getViewportCenterPoint());const h=this.currZoomLevel/s;return this.bounds.correctPan(t,(this.pan[t]-i[t])*h+i[t])}panTo(t,i){this.pan.x=this.bounds.correctPan("x",t),this.pan.y=this.bounds.correctPan("y",i),this.applyCurrentZoomPan()}isPannable(){return this.width&&this.currZoomLevel>this.zoomLevels.fit}isZoomable(){return this.width&&this.content.isZoomable()}usePlaceholder(){return this.content.usePlaceholder()}applyCurrentZoomPan(){this._(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),i(this.pan,this.bounds.center),this.pswp.dispatch("initialZoomPan",{slide:this})}_(t,i,s){s/=this.currentResolution||this.zoomLevels.initial,r(this.container,t,i,s)}calculateSize(){const{pswp:t}=this;i(this.panAreaSize,_(t.options,t.viewportSize)),this.zoomLevels.update(this.width,this.height,this.panAreaSize),t.dispatch("calcSlideSize",{slide:this})}getCurrentTransform(){const t=this.currZoomLevel/(this.currentResolution||this.zoomLevels.initial);return o(this.pan.x,this.pan.y,t)}g(t){t!==this.currentResolution&&(this.currentResolution=t,this.updateContentSize(),this.pswp.dispatch("resolutionChanged"))}}class M{constructor(t){this.gestures=t,this.pswp=t.pswp,this.startPan={}}start(){i(this.startPan,this.pswp.currSlide.pan),this.pswp.animations.stopAll()}change(){const{p1:t,prevP1:i,dragAxis:h,pswp:e}=this.gestures,{currSlide:n}=e;if("y"===h&&e.options.closeOnVerticalDrag&&n.currZoomLevel<=n.zoomLevels.fit&&!this.gestures.isMultitouch){const s=n.pan.y+(t.y-i.y);if(!e.dispatch("verticalDrag",{panY:s}).defaultPrevented){this.v("y",s,.6);const t=1-Math.abs(this.M(n.pan.y));e.applyBgOpacity(t),n.applyCurrentZoomPan()}}else{this.S("x")||(this.S("y"),s(n.pan),n.applyCurrentZoomPan())}}end(){const{pswp:t,velocity:i}=this.gestures,{mainScroll:s}=t;let h=0;if(t.animations.stopAll(),s.isShifted()){const e=(s.x-s.getCurrSlideX())/t.viewportSize.x;i.x<-.5&&e<0||i.x<.1&&e<-.5?(h=1,i.x=Math.min(i.x,0)):(i.x>.5&&e>0||i.x>-.1&&e>.5)&&(h=-1,i.x=Math.max(i.x,0)),s.moveIndexBy(h,!0,i.x)}t.currSlide.currZoomLevel>t.currSlide.zoomLevels.max&&this.pswp.options.limitMaxZoom||this.gestures.isMultitouch?this.gestures.zoomLevels.correctZoomPan(!0):(this.P("x"),this.P("y"))}P(t){const{pswp:i}=this,{currSlide:s}=i,{velocity:h}=this.gestures,{pan:e,bounds:o}=s,r=e[t],a=i.bgOpacity<1&&"y"===t,c=r+function(t,i){return t*i/(1-i)}(h[t],.995);if(a){const t=this.M(r),s=this.M(c);if(t<0&&s<-.4||t>0&&s>.4)return void i.close()}const l=o.correctPan(t,c);if(r===l)return;const u=l===c?1:.82,p=i.bgOpacity,d=l-r;i.animations.startSpring({name:"panGesture"+t,isPan:!0,start:r,end:l,velocity:h[t],dampingRatio:u,onUpdate:h=>{if(a&&i.bgOpacity<1){const t=1-(l-h)/d;i.applyBgOpacity(n(p+(1-p)*t,0,1))}e[t]=Math.floor(h),s.applyCurrentZoomPan()}})}S(t){const{p1:i,pswp:s,dragAxis:h,prevP1:e,isMultitouch:n}=this.gestures,{currSlide:o,mainScroll:r}=s,a=i[t]-e[t],c=r.x+a;if(!a)return;if("x"===t&&!o.isPannable()&&!n)return r.moveTo(c,!0),!0;const{bounds:l}=o,u=o.pan[t]+a;if(s.options.allowPanToNext&&"x"===h&&"x"===t&&!n){const i=r.getCurrSlideX(),s=r.x-i,h=a>0,e=!h;if(u>l.min[t]&&h){if(l.min[t]<=this.startPan[t])return r.moveTo(c,!0),!0;this.v(t,u)}else if(u<l.max[t]&&e){if(this.startPan[t]<=l.max[t])return r.moveTo(c,!0),!0;this.v(t,u)}else if(0!==s){if(s>0)return r.moveTo(Math.max(c,i),!0),!0;if(s<0)return r.moveTo(Math.min(c,i),!0),!0}else this.v(t,u)}else"y"===t&&(r.isShifted()||l.min.y===l.max.y)||this.v(t,u)}M(t){return(t-this.pswp.currSlide.bounds.center.y)/(this.pswp.viewportSize.y/3)}v(t,i,s){const{pan:h,bounds:e}=this.pswp.currSlide;if(e.correctPan(t,i)!==i||s){const e=Math.round(i-h[t]);h[t]+=e*(s||.35)}else h[t]=i}}function S(t,i,s){return t.x=(i.x+s.x)/2,t.y=(i.y+s.y)/2,t}class z{constructor(t){this.gestures=t,this.pswp=this.gestures.pswp,this.C={},this.T={},this.D={}}start(){this.I=this.pswp.currSlide.currZoomLevel,i(this.C,this.pswp.currSlide.pan),this.pswp.animations.stopAllPan(),this.A=!1}change(){const{p1:t,startP1:i,p2:s,startP2:e,pswp:n}=this.gestures,{currSlide:o}=n,r=o.zoomLevels.min,a=o.zoomLevels.max;if(!o.isZoomable()||n.mainScroll.isShifted())return;S(this.T,i,e),S(this.D,t,s);let c=1/h(i,e)*h(t,s)*this.I;if(c>o.zoomLevels.initial+o.zoomLevels.initial/15&&(this.A=!0),c<r)if(n.options.pinchToClose&&!this.A&&this.I<=o.zoomLevels.initial){const t=1-(r-c)/(r/1.2);n.dispatch("pinchClose",{bgOpacity:t}).defaultPrevented||n.applyBgOpacity(t)}else c=r-.15*(r-c);else c>a&&(c=a+.05*(c-a));o.pan.x=this.k("x",c),o.pan.y=this.k("y",c),o.setZoomLevel(c),o.applyCurrentZoomPan()}end(){const{pswp:t}=this,{currSlide:i}=t;i.currZoomLevel<i.zoomLevels.initial&&!this.A&&t.options.pinchToClose?t.close():this.correctZoomPan()}k(t,i){const s=i/this.I;return this.D[t]-(this.T[t]-this.C[t])*s}correctZoomPan(t){const{pswp:s}=this,{currSlide:h}=s;if(!h.isZoomable())return;void 0===this.D.x&&(t=!0);const o=h.currZoomLevel;let r,a=!0;o<h.zoomLevels.initial?r=h.zoomLevels.initial:o>h.zoomLevels.max?r=h.zoomLevels.max:(a=!1,r=o);const c=s.bgOpacity,l=s.bgOpacity<1,u=i({},h.pan);let p=i({},u);t&&(this.D.x=0,this.D.y=0,this.T.x=0,this.T.y=0,this.I=o,i(this.C,u)),a&&(p={x:this.k("x",r),y:this.k("y",r)}),h.setZoomLevel(r),p={x:h.bounds.correctPan("x",p.x),y:h.bounds.correctPan("y",p.y)},h.setZoomLevel(o);let d=!0;if(e(p,u)&&(d=!1),!d&&!a&&!l)return h.g(r),void h.applyCurrentZoomPan();s.animations.stopAllPan(),s.animations.startSpring({isPan:!0,start:0,end:1e3,velocity:0,dampingRatio:1,naturalFrequency:40,onUpdate:t=>{if(t/=1e3,d||a){if(d&&(h.pan.x=u.x+(p.x-u.x)*t,h.pan.y=u.y+(p.y-u.y)*t),a){const i=o+(r-o)*t;h.setZoomLevel(i)}h.applyCurrentZoomPan()}l&&s.bgOpacity<1&&s.applyBgOpacity(n(c+(1-c)*t,0,1))},onComplete:()=>{h.g(r),h.applyCurrentZoomPan()}})}}function P(t){return!!t.target.closest(".pswp__container")}class C{constructor(t){this.gestures=t}click(t,i){const s=i.target.classList,h=s.contains("pswp__img"),e=s.contains("pswp__item")||s.contains("pswp__zoom-wrap");h?this.Z("imageClick",t,i):e&&this.Z("bgClick",t,i)}tap(t,i){P(i)&&this.Z("tap",t,i)}doubleTap(t,i){P(i)&&this.Z("doubleTap",t,i)}Z(t,i,s){const{pswp:h}=this.gestures,{currSlide:e}=h,n=h.options[t+"Action"];if(!h.dispatch(t+"Action",{point:i,originalEvent:s}).defaultPrevented)if("function"!=typeof n)switch(n){case"close":case"next":h[n]();break;case"zoom":e.toggleZoom(i);break;case"zoom-or-close":e.isZoomable()&&e.zoomLevels.secondary!==e.zoomLevels.initial?e.toggleZoom(i):h.options.clickToCloseNonZoomable&&h.close();break;case"toggle-controls":this.gestures.pswp.template.classList.toggle("pswp--ui-visible")}else n.call(h,i,s)}}class T{constructor(t){this.pswp=t,this.p1={},this.p2={},this.prevP1={},this.prevP2={},this.startP1={},this.startP2={},this.velocity={},this.L={},this.F={},this.B=0,this.O=[],this.G="ontouchstart"in window,this.R=!!window.PointerEvent,this.supportsTouch=this.G||this.R&&navigator.maxTouchPoints>1,this.supportsTouch||(t.options.allowPanToNext=!1),this.drag=new M(this),this.zoomLevels=new z(this),this.tapHandler=new C(this),t.on("bindEvents",(()=>{t.events.add(t.scrollWrap,"click",(t=>this.V(t))),this.R?this.N("pointer","down","up","cancel"):this.G?(this.N("touch","start","end","cancel"),t.scrollWrap.ontouchmove=()=>{},t.scrollWrap.ontouchend=()=>{}):this.N("mouse","down","up")}))}N(t,i,s,h){const{pswp:e}=this,{events:n}=e,o=h?t+h:"";n.add(e.scrollWrap,t+i,this.onPointerDown.bind(this)),n.add(window,t+"move",this.onPointerMove.bind(this)),n.add(window,t+s,this.onPointerUp.bind(this)),o&&n.add(e.scrollWrap,o,this.onPointerUp.bind(this))}onPointerDown(t){let s;if("mousedown"!==t.type&&"mouse"!==t.pointerType||(s=!0),s&&t.button>0)return;const{pswp:h}=this;h.opener.isOpen?h.dispatch("pointerDown",{originalEvent:t}).defaultPrevented||(s&&(h.mouseDetected(),this.U(t)),h.animations.stopAll(),this.q(t,"down"),this.pointerDown=!0,1===this.B&&(this.dragAxis=null,i(this.startP1,this.p1)),this.B>1?(this.H(),this.isMultitouch=!0):this.isMultitouch=!1):t.preventDefault()}onPointerMove(t){t.preventDefault(),this.B&&(this.q(t,"move"),this.pswp.dispatch("pointerMove",{originalEvent:t}).defaultPrevented||(1!==this.B||this.isDragging?this.B>1&&!this.isZooming&&(this.K(),this.isZooming=!0,this.j(),this.zoomLevels.start(),this.W(),this.X()):(this.dragAxis||this.Y(),this.dragAxis&&!this.isDragging&&(this.isZooming&&(this.isZooming=!1,this.zoomLevels.end()),this.isDragging=!0,this.H(),this.j(),this.J=Date.now(),this.$=!1,i(this.F,this.p1),this.velocity.x=0,this.velocity.y=0,this.drag.start(),this.W(),this.X()))))}K(){this.isDragging&&(this.isDragging=!1,this.$||this.tt(!0),this.drag.end(),this.dragAxis=null)}onPointerUp(t){this.B&&(this.q(t,"up"),this.pswp.dispatch("pointerUp",{originalEvent:t}).defaultPrevented||(0===this.B&&(this.pointerDown=!1,this.W(),this.isDragging?this.K():this.isZooming||this.isMultitouch||this.it(t)),this.B<2&&this.isZooming&&(this.isZooming=!1,this.zoomLevels.end(),1===this.B&&(this.dragAxis=null,this.j()))))}X(){(this.isDragging||this.isZooming)&&(this.tt(),this.isDragging?e(this.p1,this.prevP1)||this.drag.change():e(this.p1,this.prevP1)&&e(this.p2,this.prevP2)||this.zoomLevels.change(),this.st(),this.raf=requestAnimationFrame(this.X.bind(this)))}tt(t){const s=Date.now(),h=s-this.J;h<50&&!t||(this.velocity.x=this.ht("x",h),this.velocity.y=this.ht("y",h),this.J=s,i(this.F,this.p1),this.$=!0)}it(t){const{mainScroll:s}=this.pswp;if(s.isShifted())return void s.moveIndexBy(0,!0);if(t.type.indexOf("cancel")>0)return;if("mouseup"===t.type||"mouse"===t.pointerType)return void this.tapHandler.click(this.startP1,t);const e=this.pswp.options.doubleTapAction?300:0;this.et?(this.H(),h(this.L,this.startP1)<25&&this.tapHandler.doubleTap(this.startP1,t)):(i(this.L,this.startP1),this.et=setTimeout((()=>{this.tapHandler.tap(this.startP1,t),this.H()}),e))}H(){this.et&&(clearTimeout(this.et),this.et=null)}ht(t,i){const s=this.p1[t]-this.F[t];return Math.abs(s)>1&&i>5?s/i:0}W(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null)}U(t){return t.preventDefault(),!0}q(t,s){if(this.R){const h=this.O.findIndex((i=>i.id===t.pointerId));"up"===s&&h>-1?this.O.splice(h,1):"down"===s&&-1===h?this.O.push(this.nt(t,{})):h>-1&&this.nt(t,this.O[h]),this.B=this.O.length,this.B>0&&i(this.p1,this.O[0]),this.B>1&&i(this.p2,this.O[1])}else this.B=0,t.type.indexOf("touch")>-1?t.touches&&t.touches.length>0&&(this.nt(t.touches[0],this.p1),this.B++,t.touches.length>1&&(this.nt(t.touches[1],this.p2),this.B++)):(this.nt(t,this.p1),"up"===s?this.B=0:this.B++)}st(){i(this.prevP1,this.p1),i(this.prevP2,this.p2)}j(){i(this.startP1,this.p1),i(this.startP2,this.p2),this.st()}Y(){if(this.pswp.mainScroll.isShifted())this.dragAxis="x";else{const t=Math.abs(this.p1.x-this.startP1.x)-Math.abs(this.p1.y-this.startP1.y);if(0!==t){const i=t>0?"x":"y";Math.abs(this.p1[i]-this.startP1[i])>=10&&(this.dragAxis=i)}}}nt(t,i){return i.x=t.pageX-this.pswp.offset.x,i.y=t.pageY-this.pswp.offset.y,void 0!==t.pointerId?i.id=t.pointerId:void 0!==t.identifier&&(i.id=t.identifier),i}V(t){this.pswp.mainScroll.isShifted()&&(t.preventDefault(),t.stopPropagation())}}class D{constructor(t){this.pswp=t,this.x=0,this.resetPosition()}resize(t){const{pswp:i}=this,s=Math.round(i.viewportSize.x+i.viewportSize.x*i.options.spacing),h=s!==this.slideWidth;h&&(this.slideWidth=s,this.moveTo(this.getCurrSlideX())),this.itemHolders.forEach(((i,s)=>{h&&r(i.el,(s+this.ot)*this.slideWidth),t&&i.slide&&i.slide.resize()}))}resetPosition(){this.rt=0,this.at=0,this.slideWidth=0,this.ot=-1}appendHolders(){this.itemHolders=[];for(let i=0;i<3;i++){const s=t("pswp__item",!1,this.pswp.container);s.style.display=1===i?"block":"none",this.itemHolders.push({el:s})}}canBeSwiped(){return this.pswp.getNumItems()>1}moveIndexBy(t,i,s){const{pswp:h}=this;let e=h.potentialIndex+t;h.options.loop?e=h.getLoopedIndex(e):(e<0?e=0:e>=h.getNumItems()&&(e=h.getNumItems()-1),t=e-h.potentialIndex),h.potentialIndex=e,this.rt-=t,h.animations.stopMainScroll();const n=this.getCurrSlideX();if(i?(h.animations.startSpring({isMainScroll:!0,start:this.x,end:n,velocity:s||0,naturalFrequency:30,dampingRatio:1,onUpdate:t=>{this.moveTo(t)},onComplete:()=>{this.updateCurrItem(),h.appendHeavy()}}),Math.abs(h.potentialIndex-h.currIndex)>1&&this.updateCurrItem()):(this.moveTo(n),this.updateCurrItem()),t)return!0}getCurrSlideX(){return this.slideWidth*this.rt}isShifted(){return this.x!==this.getCurrSlideX()}updateCurrItem(){const{pswp:t}=this,i=this.at-this.rt;if(!i)return;this.at=this.rt,t.currIndex=t.potentialIndex;let s,h=Math.abs(i);h>=3&&(this.ot+=i+(i>0?-3:3),h=3);for(let e=0;e<h;e++)i>0?(s=this.itemHolders.shift(),this.itemHolders[2]=s,this.ot++,r(s.el,(this.ot+2)*this.slideWidth),t.setContent(s,t.currIndex-h+e+2)):(s=this.itemHolders.pop(),this.itemHolders.unshift(s),this.ot--,r(s.el,this.ot*this.slideWidth),t.setContent(s,t.currIndex+h-e-2));Math.abs(this.ot)>50&&!this.isShifted()&&(this.resetPosition(),this.resize()),t.animations.stopAllPan(),this.itemHolders.forEach(((t,i)=>{t.slide&&t.slide.setIsActive(1===i)})),t.currSlide=this.itemHolders[1].slide,t.contentLoader.updateLazy(i),t.currSlide.applyCurrentZoomPan(),t.dispatch("change")}moveTo(t,i){let s,h;!this.pswp.options.loop&&i&&(s=(this.slideWidth*this.rt-t)/this.slideWidth,s+=this.pswp.currIndex,h=Math.round(t-this.x),(s<0&&h>0||s>=this.pswp.getNumItems()-1&&h<0)&&(t=this.x+.35*h)),this.x=t,r(this.pswp.container,t),this.pswp.dispatch("moveMainScroll",{x:t,dragging:i})}}class I{constructor(t){this.pswp=t,t.on("bindEvents",(()=>{t.options.initialPointerPos||this.ct(),t.events.add(document,"focusin",this.lt.bind(this)),t.events.add(document,"keydown",this.ut.bind(this))}));const i=document.activeElement;t.on("destroy",(()=>{t.options.returnFocus&&i&&this.dt&&i.focus()}))}ct(){this.dt||(this.pswp.template.focus(),this.dt=!0)}ut(t){const{pswp:i}=this;if(i.dispatch("keydown",{originalEvent:t}).defaultPrevented)return;if(function(t){if(2===t.which||t.ctrlKey||t.metaKey||t.altKey||t.shiftKey)return!0}(t))return;let s,h,e;switch(t.keyCode){case 27:i.options.escKey&&(s="close");break;case 90:s="toggleZoom";break;case 37:h="x";break;case 38:h="y";break;case 39:h="x",e=!0;break;case 40:e=!0,h="y";break;case 9:this.ct()}if(h){t.preventDefault();const{currSlide:n}=i;i.options.arrowKeys&&"x"===h&&i.getNumItems()>1?s=e?"next":"prev":n&&n.currZoomLevel>n.zoomLevels.fit&&(n.pan[h]+=e?-80:80,n.panTo(n.pan.x,n.pan.y))}s&&(t.preventDefault(),i[s]())}lt(t){const{template:i}=this.pswp;document===t.target||i===t.target||i.contains(t.target)||i.focus()}}class A{constructor(t){this.props=t;const{target:i,onComplete:s,transform:h}=t;let{duration:e,easing:n}=t;const o=h?"transform":"opacity",r=t[o];this.ft=i,this.wt=s,e=e||333,n=n||"cubic-bezier(.4,0,.22,1)",this.gt=this.gt.bind(this),this._t=setTimeout((()=>{a(i,o,e,n),this._t=setTimeout((()=>{i.addEventListener("transitionend",this.gt,!1),i.addEventListener("transitioncancel",this.gt,!1),i.style[o]=r}),30)}),0)}gt(t){t.target===this.ft&&this.yt()}yt(){this.vt||(this.vt=!0,this.onFinish(),this.wt&&this.wt())}destroy(){this._t&&clearTimeout(this._t),a(this.ft),this.ft.removeEventListener("transitionend",this.gt,!1),this.ft.removeEventListener("transitioncancel",this.gt,!1),this.vt||this.yt()}}class E{constructor(t,i,s){this.velocity=1e3*t,this.bt=i||.75,this.xt=s||12,this.bt<1&&(this.Mt=this.xt*Math.sqrt(1-this.bt*this.bt))}easeFrame(t,i){let s,h=0;i/=1e3;const e=Math.E**(-this.bt*this.xt*i);if(1===this.bt)s=this.velocity+this.xt*t,h=(t+s*i)*e,this.velocity=h*-this.xt+s*e;else if(this.bt<1){s=1/this.Mt*(this.bt*this.xt*t+this.velocity);const n=Math.cos(this.Mt*i),o=Math.sin(this.Mt*i);h=e*(t*n+s*o),this.velocity=h*-this.xt*this.bt+e*(-this.Mt*t*o+this.Mt*s*n)}return h}}class k{constructor(t){this.props=t;const{start:i,end:s,velocity:h,onUpdate:e,onComplete:n,onFinish:o,dampingRatio:r,naturalFrequency:a}=t,c=new E(h,r,a);let l=Date.now(),u=i-s;this.St=o;const p=()=>{this.zt&&(u=c.easeFrame(u,Date.now()-l),Math.abs(u)<1&&Math.abs(c.velocity)<50?(e(s),n&&n(),this.onFinish()):(l=Date.now(),e(u+s),this.zt=requestAnimationFrame(p)))};this.zt=requestAnimationFrame(p)}destroy(){this.zt>=0&&cancelAnimationFrame(this.zt),this.zt=null}}class Z{constructor(){this.activeAnimations=[]}startSpring(t){this.Pt(t,!0)}startTransition(t){this.Pt(t)}Pt(t,i){let s;return s=i?new k(t):new A(t),this.activeAnimations.push(s),s.onFinish=()=>this.stop(s),s}stop(t){t.destroy();const i=this.activeAnimations.indexOf(t);i>-1&&this.activeAnimations.splice(i,1)}stopAll(){this.activeAnimations.forEach((t=>{t.destroy()})),this.activeAnimations=[]}stopAllPan(){this.activeAnimations=this.activeAnimations.filter((t=>!t.props.isPan||(t.destroy(),!1)))}stopMainScroll(){this.activeAnimations=this.activeAnimations.filter((t=>!t.props.isMainScroll||(t.destroy(),!1)))}isPanRunning(){return this.activeAnimations.some((t=>t.props.isPan))}}class L{constructor(t){this.pswp=t,t.events.add(t.template,"wheel",this.Ct.bind(this))}Ct(t){t.preventDefault();const{currSlide:i}=this.pswp;let{deltaX:s,deltaY:h}=t;if(i&&!this.pswp.dispatch("wheel",{originalEvent:t}).defaultPrevented)if(t.ctrlKey||this.pswp.options.wheelToZoom){if(i.isZoomable()){let s=-h;1===t.deltaMode?s*=.05:s*=t.deltaMode?1:.002,s=2**s,this.pswp.options.getWheelZoomFactorFn&&(s=this.pswp.options.getWheelZoomFactorFn(t,this.pswp));const e=i.currZoomLevel*s;i.zoomTo(e,{x:t.clientX,y:t.clientY})}}else i.isPannable()&&(1===t.deltaMode&&(s*=18,h*=18),i.panTo(i.pan.x-s,i.pan.y-h))}}class F{constructor(i,s){const h=s.name||s.class;let e=s.html;if(!1===i.options[h])return;"string"==typeof i.options[h+"SVG"]&&(e=i.options[h+"SVG"]),i.dispatch("uiElementCreate",{data:s});let n,o="pswp__";s.isButton&&(o+="button pswp__button--"),o+=s.class||s.name,s.isButton?(n=t(o,"button"),n.type="button","string"==typeof i.options[h+"Title"]?n.title=i.options[h+"Title"]:s.title&&(n.title=s.title)):n=t(o),n.innerHTML=function(t){if("string"==typeof t)return t;if(!t||!t.isCustomSVG)return"";const i=t;let s='<svg aria-hidden="true" class="pswp__icn" viewBox="0 0 %d %d" width="%d" height="%d">';return s=s.split("%d").join(i.size||32),i.outlineID&&(s+='<use class="pswp__icn-shadow" xlink:href="#'+i.outlineID+'"/>'),s+=i.inner,s+="</svg>",s}(e),s.onInit&&s.onInit(n,i),s.onClick&&(n.onclick=t=>{"string"==typeof s.onClick?i[s.onClick]():s.onClick(t,n,i)});const r=s.appendTo||"bar";let a;"bar"===r?(i.topBar||(i.topBar=t("pswp__top-bar pswp__hide-on-close",!1,i.scrollWrap)),a=i.topBar):(n.classList.add("pswp__hide-on-close"),a="wrapper"===r?i.scrollWrap:i.template),a.appendChild(n)}}function B(t,i,s){t.classList.add("pswp__button--arrow"),i.on("change",(()=>{i.options.loop||(t.disabled=s?!(i.currIndex<i.getNumItems()-1):!(i.currIndex>0))}))}const O={name:"arrowPrev",class:"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:B},G={name:"arrowNext",class:"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:(t,i)=>{B(t,i,!0)}},R={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"},V={name:"zoom",title:"Zoom (z)",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"},N={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:(t,i)=>{let s,h;const e=i=>{var h,e;s!==i&&(s=i,h="active",e=i,t.classList[e?"add":"remove"]("pswp__preloader--"+h))},n=()=>{if(!i.currSlide.isLoading())return e(!1),void(h&&(clearTimeout(h),h=null));h||(h=setTimeout((()=>{e(i.currSlide.isLoading()),h=null}),i.options.preloaderDelay))};i.on("change",n),i.on("loadComplete",(t=>{i.currSlide===t.slide&&n()})),i.ui.updatePreloaderVisibility=n}},U={name:"counter",order:5,onInit:(t,i)=>{i.on("change",(()=>{t.innerHTML=i.currIndex+1+i.options.indexIndicatorSep+i.getNumItems()}))}};function q(t,i){t.classList[i?"add":"remove"]("pswp--zoomed-in")}class H{constructor(t){this.pswp=t}init(){const{pswp:t}=this;this.isRegistered=!1,this.uiElementsData=[R,O,G,V,N,U],t.dispatch("uiRegister"),this.uiElementsData.sort(((t,i)=>(t.order||0)-(i.order||0))),this.items=[],this.isRegistered=!0,this.uiElementsData.forEach((t=>{this.registerElement(t)})),1===t.getNumItems()&&t.template.classList.add("pswp--one-slide"),t.on("zoomPanUpdate",(()=>this.Tt()))}registerElement(t){this.isRegistered?this.items.push(new F(this.pswp,t)):this.uiElementsData.push(t)}Tt(){const{template:t,currSlide:i,options:s}=this.pswp;let{currZoomLevel:h}=i;if(this.pswp.opener.isClosing)return;if(this.pswp.opener.isOpen||(h=i.zoomLevels.initial),h===this.Dt)return;this.Dt=h;const e=i.zoomLevels.initial-i.zoomLevels.secondary;if(Math.abs(e)<.01||!i.isZoomable())return q(t,!1),void t.classList.remove("pswp--zoom-allowed");t.classList.add("pswp--zoom-allowed");const n=e<0;h===i.zoomLevels.secondary?q(t,n):h>i.zoomLevels.secondary?q(t,!0):q(t,!1),"zoom"!==s.imageClickAction&&"zoom-or-close"!==s.imageClickAction||t.classList.add("pswp--click-to-zoom")}}class K{constructor(t,i){this.type=t,i&&Object.assign(this,i)}preventDefault(){this.defaultPrevented=!0}}class j{constructor(t,i){this.options=i.options,this.instance=i,this.data=t,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.state=l}setSlide(t){this.slide=t,this.pswp=t.pswp}load(){this.element||(this.element=t("pswp__content"),this.element.style.position="absolute",this.element.style.left=0,this.element.style.top=0,this.element.innerHTML=this.data.html||"")}isZoomable(){return!1}usePlaceholder(){return!1}activate(){}deactivate(){}setDisplayedSize(t,i){this.element&&c(this.element,t,i)}onLoaded(){this.state=p,this.slide&&this.pswp.dispatch("loadComplete",{slide:this.slide})}isLoading(){return this.state===u}keepPlaceholder(){return this.isLoading()}onError(){this.state=d,this.slide&&(this.pswp.dispatch("loadComplete",{slide:this.slide,isError:!0}),this.pswp.dispatch("loadError",{slide:this.slide}))}getErrorElement(){return!1}remove(){this.isAttached=!1,this.element&&this.element.parentNode&&this.element.remove()}appendTo(t){this.isAttached=!0,this.element&&!this.element.parentNode&&t.appendChild(this.element)}destroy(){}}class W extends j{load(){if(this.element)return;const i=this.data.src;i&&(this.element=t("pswp__img","img"),this.data.srcset&&(this.element.srcset=this.data.srcset),this.element.src=i,this.element.alt=this.data.alt||"",this.state=u,this.element.complete?this.onLoaded():(this.element.onload=()=>{this.onLoaded()},this.element.onerror=()=>{this.onError()}))}setDisplayedSize(t,i){const s=this.element;s&&(c(s,t,"auto"),s.srcset&&(!s.dataset.largestUsedSize||t>s.dataset.largestUsedSize)&&(s.sizes=t+"px",s.dataset.largestUsedSize=t),this.slide&&this.pswp.dispatch("imageSizeChange",{slide:this.slide,width:t,height:i}))}isZoomable(){return this.state!==d}usePlaceholder(){return!0}lazyLoad(){this.load()}destroy(){this.element&&(this.element.onload=null,this.element.onerror=null,this.element=null)}appendTo(t){this.isAttached=!0,this.slide&&!this.slide.isActive&&"decode"in this.element?(this.isDecoding=!0,requestAnimationFrame((()=>{this.element&&this.element.decode().then((()=>{this.isDecoding=!1,requestAnimationFrame((()=>{this.appendImageTo(t)}))})).catch((()=>{}))}))):this.appendImageTo(t)}activate(){this.slide&&this.slide.container&&this.isDecoding&&this.appendImageTo(this.slide.container)}getErrorElement(){const i=t("pswp__error-msg-container");i.innerHTML=this.options.errorMsg;const s=i.querySelector("a");return s&&(s.href=this.data.src),i}appendImageTo(t){this.element&&!this.element.parentNode&&this.isAttached&&t.appendChild(this.element)}}class X{constructor(t){this.pswp=t,this.isClosed=!0,this.It=this.It.bind(this),t.on("firstZoomPan",this.It)}open(){this.It(),this.Pt()}close(){if(this.isClosed||this.isClosing||this.isOpening)return!1;const t=this.pswp.currSlide;return this.isOpen=!1,this.isOpening=!1,this.isClosing=!0,this.At=this.pswp.options.hideAnimationDuration,t&&t.currZoomLevel*t.width>=4e3&&(this.At=0),this.Et(),setTimeout((()=>{this.Pt()}),this.kt?30:0),!0}It(){this.pswp.off("firstZoomPan",this.It),this.isOpening||(this.isOpening=!0,this.isClosing=!1,this.At=this.pswp.options.showAnimationDuration,this.Et())}Et(){const{pswp:t}=this,i=this.pswp.currSlide,{options:s}=t;if("fade"===s.showHideAnimationType?(s.showHideOpacity=!0,this.Zt=!1):"none"===s.showHideAnimationType?(s.showHideOpacity=!1,this.At=0,this.Zt=!1):this.isOpening&&t.Lt?this.Zt=t.Lt:this.Zt=this.pswp.getThumbBounds(),this.Ft=i.getPlaceholderElement(),t.animations.stopAll(),this.Bt=this.At>50,this.Ot=Boolean(this.Zt)&&(!this.isClosing||!t.mainScroll.isShifted()),this.Ot?this.Gt=s.showHideOpacity:(this.Gt=!0,this.isOpening&&(i.zoomAndPanToInitial(),i.applyCurrentZoomPan())),this.Rt=!this.Gt,this.Vt=this.Gt?t.template:t.bg,!this.Bt)return this.At=0,this.Ot=!1,this.Rt=!1,this.Gt=!0,void(this.isOpening&&(t.template.style.opacity=.003,t.applyBgOpacity(1)));this.Ot&&this.Zt.innerRect?(this.kt=!0,this.Nt=this.pswp.container,this.Ut=this.pswp.currSlide.holderElement,t.container.style.overflow="hidden",t.container.style.width=t.viewportSize.x+"px"):this.kt=!1,this.isOpening?(this.Rt&&(t.bg.style.opacity=.003,t.template.style.opacity=1),this.Gt&&(t.template.style.opacity=.003,t.applyBgOpacity(1)),this.Ot&&(this.qt(),this.Ft&&(this.Ft.willChange="transform",this.Ft.style.opacity=.003))):this.isClosing&&(t.mainScroll.itemHolders[0].el.style.display="none",t.mainScroll.itemHolders[2].el.style.display="none",this.kt&&0!==t.mainScroll.x&&(t.mainScroll.resetPosition(),t.mainScroll.resize()))}Pt(){this.isOpening&&this.Bt&&this.Ft&&"IMG"===this.Ft.tagName?new Promise((t=>{let i=!1,s=!0;var h;(h=this.Ft,"decode"in h?h.decode():h.complete?Promise.resolve(h):new Promise(((t,i)=>{h.onload=()=>t(h),h.onerror=i}))).finally((()=>{i=!0,s||t()})),setTimeout((()=>{s=!1,i&&t()}),50),setTimeout(t,250)})).finally((()=>this.Ht())):this.Ht()}Ht(){this.pswp.template.style.setProperty("--pswp-transition-duration",this.At+"ms"),this.pswp.dispatch("initialZoom"+(this.isOpening?"In":"Out")),this.pswp.template.classList[this.isOpening?"add":"remove"]("pswp--ui-visible"),this.isOpening?(this.Ft&&(this.Ft.style.opacity=1),this.Kt()):this.isClosing&&this.jt(),this.Bt||this.Wt()}Wt(){const{pswp:t}=this;this.isOpen=this.isOpening,this.isClosed=this.isClosing,this.isOpening=!1,this.isClosing=!1,t.dispatch("initialZoom"+(this.isOpen?"InEnd":"OutEnd")),this.isClosed?t.destroy():this.isOpen&&(this.Ot&&(t.container.style.overflow="visible",t.container.style.width="100%"),t.currSlide.applyCurrentZoomPan())}Kt(){const{pswp:t}=this;this.Ot&&(this.kt&&(this.Xt(this.Nt,"transform","translate3d(0,0,0)"),this.Xt(this.Ut,"transform","none")),t.currSlide.zoomAndPanToInitial(),this.Xt(t.currSlide.container,"transform",t.currSlide.getCurrentTransform())),this.Rt&&this.Xt(t.bg,"opacity",t.options.bgOpacity),this.Gt&&this.Xt(t.template,"opacity",1)}jt(){const{pswp:t}=this;this.Ot&&this.qt(!0),this.Rt&&t.bgOpacity>.01&&this.Xt(t.bg,"opacity",0),this.Gt&&this.Xt(t.template,"opacity",0)}qt(t){const{pswp:s}=this,{innerRect:h}=this.Zt,{currSlide:e,viewportSize:n}=s;if(this.kt){const i=-n.x+(this.Zt.x-h.x)+h.w,s=-n.y+(this.Zt.y-h.y)+h.h,e=n.x-h.w,a=n.y-h.h;t?(this.Xt(this.Nt,"transform",o(i,s)),this.Xt(this.Ut,"transform",o(e,a))):(r(this.Nt,i,s),r(this.Ut,e,a))}i(e.pan,h||this.Zt),e.currZoomLevel=this.Zt.w/e.width,t?this.Xt(e.container,"transform",e.getCurrentTransform()):e.applyCurrentZoomPan()}Xt(t,i,s){if(!this.At)return void(t.style[i]=s);const{animations:h}=this.pswp,e={duration:this.At,easing:this.pswp.options.easing,onComplete:()=>{h.activeAnimations.length||this.Wt()},target:t};e[i]=s,h.startTransition(e)}}function Y(t,i){return t&&t.src?t.src+"_"+i:i}function J(t,i){const s=i.getItemData(t);if(!i.dispatch("lazyLoadSlide",{index:t,itemData:s}).defaultPrevented)return function(t,i,s){const h=i.createContentFromData(t);if(!h||!h.lazyLoad)return;h.key=Y(t,s);const{options:e}=i,n=_(e,i.viewportSize||w(e)),o=new v(e,t,-1);return o.update(h.width,h.height,n),h.lazyLoad(),h.setDisplayedSize(Math.ceil(h.width*o.initial),Math.ceil(h.height*o.initial)),h}(s,i,t)}class Q{constructor(t){this.pswp=t,this.limit=Math.max(t.options.preload[0]+t.options.preload[1]+1,5),this.Yt=[]}updateLazy(t){const{pswp:i}=this;if(i.dispatch("lazyLoad").defaultPrevented)return;const{preload:s}=i.options,h=void 0===t||t>=0;let e;for(e=0;e<=s[1];e++)this.loadSlideByIndex(i.currIndex+(h?e:-e));for(e=1;e<=s[0];e++)this.loadSlideByIndex(i.currIndex+(h?-e:e))}loadSlideByIndex(t){t=this.pswp.getLoopedIndex(t);const i=Y(this.pswp.getItemData(t),t);let s=this.getContentByKey(i);s||(s=J(t,this.pswp),s.key=i,this.addToCache(s))}getContentBySlide(t){let i=this.getContentByKey(this.getKeyBySlide(t));return i||(i=this.pswp.createContentFromData(t.data),i&&(i.key=this.getKeyBySlide(t),this.addToCache(i))),i&&i.setSlide(t),i}addToCache(t){if(this.removeByKey(t.key),this.Yt.push(t),this.Yt.length>this.limit){const t=this.Yt.findIndex((t=>!t.isAttached));if(-1!==t){this.Yt.splice(t,1)[0].destroy()}}}removeByKey(t){const i=this.Yt.findIndex((i=>i.key===t));-1!==i&&this.Yt.splice(i,1)}getContentByKey(t){return this.Yt.find((i=>i.key===t))}getKeyBySlide(t){return Y(t.data,t.index)}destroy(){this.Yt.forEach((t=>t.destroy())),this.Yt=null}}const $={allowPanToNext:!0,spacing:.1,loop:!0,pinchToClose:!0,closeOnVerticalDrag:!0,hideAnimationDuration:333,showAnimationDuration:333,zoomAnimationDuration:333,escKey:!0,arrowKeys:!0,returnFocus:!0,limitMaxZoom:!0,clickToCloseNonZoomable:!0,imageClickAction:"zoom-or-close",bgClickAction:"close",tapAction:"toggle-controls",doubleTapAction:"zoom",indexIndicatorSep:" / ",preloaderDelay:2e3,bgOpacity:.8,index:0,errorMsg:'<div class="pswp__error-msg"><a href="" target="_blank">The image</a> could not be loaded.</div>',preload:[1,2],easing:"cubic-bezier(.4,0,.22,1)"};export default class extends class extends class{constructor(){this.Jt={},this.Qt={}}addFilter(t,i,s=100){this.Qt[t]||(this.Qt[t]=[]),this.Qt[t].push({fn:i,priority:s}),this.Qt[t].sort(((t,i)=>t.priority-i.priority)),this.pswp&&this.pswp.addFilter(t,i,s)}removeFilter(t,i){this.Qt[t]&&(this.Qt[t]=this.Qt[t].filter((t=>t.fn!==i))),this.pswp&&this.pswp.removeFilter(t,i)}applyFilters(t,...i){return this.Qt[t]&&this.Qt[t].forEach((t=>{i[0]=t.fn.apply(this,i)})),i[0]}on(t,i){this.Jt[t]||(this.Jt[t]=[]),this.Jt[t].push(i),this.pswp&&this.pswp.on(t,i)}off(t,i){this.Jt[t]&&(this.Jt[t]=this.Jt[t].filter((t=>i!==t))),this.pswp&&this.pswp.off(t,i)}dispatch(t,i){if(this.pswp)return this.pswp.dispatch(t,i);const s=new K(t,i);return this.Jt?(this.Jt[t]&&this.Jt[t].forEach((t=>{t.call(this,s)})),s):s}}{constructor(){super(),this.contentTypes={image:W,html:j}}getNumItems(){let t;const{dataSource:i}=this.options;i?i.length?t=i.length:i.gallery&&(i.items||(i.items=this.$t(i.gallery)),i.items&&(t=i.items.length)):t=0;const s=this.dispatch("numItems",{dataSource:i,numItems:t});return this.applyFilters("numItems",s.numItems,i)}addContentType(t,i){this.contentTypes[t]=i}getContentClass(t){return t.type?this.contentTypes[t.type]:t.src?this.contentTypes.image:t.html?this.contentTypes.html:void 0}createContentFromData(t){const i=this.getContentClass(t);if(!i)return!1;return new i(t,this)}getItemData(t){const{dataSource:i}=this.options;let s;Array.isArray(i)?s=i[t]:i&&i.gallery&&(i.items||(i.items=this.$t(i.gallery)),s=i.items[t]);let h=s;h instanceof Element&&(h=this.ti(h));const e=this.dispatch("itemData",{itemData:h||{},index:t});return this.applyFilters("itemData",e.itemData,t)}$t(t){return this.options.children||this.options.childSelector?function(t,i,s=document){let h=[];if(t instanceof Element)h=[t];else if(t instanceof NodeList||Array.isArray(t))h=Array.from(t);else{const e="string"==typeof t?t:i;e&&(h=Array.from(s.querySelectorAll(e)))}return h}(this.options.children,this.options.childSelector,t)||[]:[t]}ti(t){const i={element:t},s="A"===t.tagName?t:t.querySelector("a");if(s){i.src=s.dataset.pswpSrc||s.href,i.srcset=s.dataset.pswpSrcset,i.w=parseInt(s.dataset.pswpWidth,10),i.h=parseInt(s.dataset.pswpHeight,10),s.dataset.pswpType&&(i.type=s.dataset.pswpType);const h=t.querySelector("img");h&&(i.msrc=h.currentSrc||h.src,i.alt=h.getAttribute("alt")),(s.dataset.pswpCropped||s.dataset.cropped)&&(i.thumbCropped=!0)}return this.applyFilters("domItemData",i,t,s),i}}{constructor(t,i){super(),this.items=t,this.ii(i),this.offset={},this.si={},this.viewportSize={},this.bgOpacity=1,this.events=new f,this.animations=new Z,this.mainScroll=new D(this),this.gestures=new T(this),this.opener=new X(this),this.keyboard=new I(this),this.contentLoader=new Q(this)}init(){if(this.isOpen||this.isDestroying)return;this.isOpen=!0,this.getNumItems()<3&&(this.options.loop=!1),this.dispatch("init"),this.hi();let t="pswp--open";return this.gestures.supportsTouch&&(t+=" pswp--touch"),this.options.allowMouseDrag||(t+=" pswp--no-mouse-drag"),this.options.mainClass&&(t+=" "+this.options.mainClass),this.template.className+=" "+t,this.currIndex=this.options.index||0,this.potentialIndex=this.currIndex,this.dispatch("firstUpdate"),this.scrollWheel=new L(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.ei=this.getItemData(this.currIndex),this.dispatch("gettingData",this.currIndex,this.ei,!0),this.Lt=this.getThumbBounds(),this.dispatch("initialLayout"),this.on("initialZoomInEnd",(()=>{this.setContent(this.mainScroll.itemHolders[0],this.currIndex-1),this.setContent(this.mainScroll.itemHolders[2],this.currIndex+1),this.mainScroll.itemHolders[0].el.style.display="block",this.mainScroll.itemHolders[2].el.style.display="block",this.appendHeavy(),this.contentLoader.updateLazy(),this.events.add(window,"resize",this.ni.bind(this)),this.events.add(window,"scroll",this.oi.bind(this)),this.dispatch("bindEvents")})),this.on("loadComplete",(t=>{t.slide.heavyAppended&&t.slide.removePlaceholder()})),this.on("loadError",(t=>{t.slide.heavyAppended&&(t.slide.removePlaceholder(),t.slide.displayError())})),this.setContent(this.mainScroll.itemHolders[1],this.currIndex),this.dispatch("change"),this.opener.open(),this.dispatch("afterInit"),!0}getLoopedIndex(t){const i=this.getNumItems();return this.options.loop&&(t>i-1&&(t-=i),t<0&&(t+=i)),t=n(t,0,i-1)}getIndexDiff(t){if(this.options.loop){const i=this.getNumItems()-1;if(0===this.currIndex&&t===i)return-1;if(this.currIndex===i&&0===t)return 1}return t-this.currIndex}appendHeavy(){this.mainScroll.itemHolders.forEach((t=>{t.slide&&t.slide.appendHeavy()}))}goTo(t){t=this.getLoopedIndex(t);this.mainScroll.moveIndexBy(t-this.potentialIndex)&&this.dispatch("afterGoto")}next(){this.goTo(this.potentialIndex+1)}prev(){this.goTo(this.potentialIndex-1)}zoomTo(...t){this.currSlide.zoomTo(...t)}toggleZoom(){this.currSlide.toggleZoom()}close(){this.opener.isOpen&&!this.isDestroying&&(this.isDestroying=!0,this.dispatch("close"),this.events.removeAll(),this.opener.close())}destroy(){this.isDestroying?(this.dispatch("destroy"),this.listeners=null,this.scrollWrap.ontouchmove=null,this.scrollWrap.ontouchend=null,this.template.remove(),this.contentLoader.destroy(),this.events.removeAll()):this.close()}setContent(t,i){if(t.slide&&t.slide.destroy(),this.options.loop)i=this.getLoopedIndex(i);else if(i<0||i>=this.getNumItems())return void(t.el.innerHTML="");const s=this.getItemData(i);t.slide=new x(s,i,this),i===this.currIndex&&(this.currSlide=t.slide),t.slide.append(t.el)}getViewportCenterPoint(){return{x:this.viewportSize.x/2,y:this.viewportSize.y/2}}updateSize(t){if(this.isDestroying)return;const s=w(this.options,this);!t&&e(s,this.si)||(i(this.si,s),this.dispatch("beforeResize"),i(this.viewportSize,this.si),this.oi(),this.dispatch("viewportSize"),this.mainScroll.resize(this.opener.isOpen),!this.hasMouse&&window.matchMedia("(any-hover: hover)").matches&&this.mouseDetected(),this.dispatch("resize"))}applyBgOpacity(t){this.bgOpacity=Math.max(t,0),this.bg.style.opacity=this.bgOpacity*this.options.bgOpacity}mouseDetected(){this.hasMouse||(this.hasMouse=!0,this.template.classList.add("pswp--has_mouse"))}ni(){this.updateSize(),/iPhone|iPad|iPod/i.test(window.navigator.userAgent)&&setTimeout((()=>{this.updateSize()}),500)}oi(){this.setScrollOffset(0,window.pageYOffset)}setScrollOffset(t,i){this.offset.x=t,this.offset.y=i,this.dispatch("updateScrollOffset")}hi(){this.template=t("pswp"),this.template.setAttribute("tabindex",-1),this.template.setAttribute("role","dialog"),this.bg=t("pswp__bg",!1,this.template),this.scrollWrap=t("pswp__scroll-wrap",!1,this.template),this.container=t("pswp__container",!1,this.scrollWrap),this.mainScroll.appendHolders(),this.ui=new H(this),this.ui.init(),(this.options.appendToEl||document.body).appendChild(this.template)}getThumbBounds(){return function(t,i,s){const h=s.dispatch("thumbBounds",{index:t,itemData:i,instance:s});if(h.thumbBounds)return h.thumbBounds;const{element:e}=i;let n;if(e&&!1!==s.options.thumbSelector){const t=s.options.thumbSelector||"img",h=e.matches(t)?e:e.querySelector(t);h&&(n=i.thumbCropped?function(t,i,s){const h=t.getBoundingClientRect(),e=h.width/i,n=h.height/s,o=e>n?e:n,r=(h.width-i*o)/2,a=(h.height-s*o)/2,c={x:h.left+r,y:h.top+a,w:i*o};return c.innerRect={w:h.width,h:h.height,x:r,y:a},c}(h,i.w,i.h):function(t){const i=t.getBoundingClientRect();return{x:i.left,y:i.top,w:i.width}}(h))}return s.applyFilters("thumbBounds",n,i,t)}(this.currIndex,this.currSlide?this.currSlide.data:this.ei,this)}ii(t){window.matchMedia("(prefers-reduced-motion), (update: slow)").matches&&(t.showHideAnimationType="none",t.zoomAnimationDuration=0),this.options={...$,...t}}}export{j as Content,W as ImageContent};
function t(t,i,s){const h=document.createElement(i||"div");return t&&(h.className=t),s&&s.appendChild(h),h}function i(t,i){return t.x=i.x,t.y=i.y,void 0!==i.id&&(t.id=i.id),t}function s(t){t.x=Math.round(t.x),t.y=Math.round(t.y)}function h(t,i){const s=Math.abs(t.x-i.x),h=Math.abs(t.y-i.y);return Math.sqrt(s*s+h*h)}function e(t,i){return t.x===i.x&&t.y===i.y}function n(t,i,s){return Math.min(Math.max(t,i),s)}function o(t,i,s){let h="translate3d("+t+"px,"+(i||0)+"px,0)";return void 0!==s&&(h+=" scale3d("+s+","+s+",1)"),h}function r(t,i,s,h){t.style.transform=o(i,s,h)}function a(t,i,s,h){t.style.transition=i?i+" "+s+"ms "+(h||"cubic-bezier(.4,0,.22,1)"):"none"}function c(t,i,s){t.style.width="number"==typeof i?i+"px":i,t.style.height="number"==typeof s?s+"px":s}const l="idle",u="loading",p="loaded",d="error";let m=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>{m=!0}}))}catch(t){}class f{constructor(){this.t=[]}add(t,i,s,h){this.i(t,i,s,h)}remove(t,i,s,h){this.i(t,i,s,h,!0)}removeAll(){this.t.forEach((t=>{this.i(t.target,t.type,t.listener,t.passive,!0,!0)})),this.t=[]}i(t,i,s,h,e,n){if(!t)return;const o=(e?"remove":"add")+"EventListener";(i=i.split(" ")).forEach((i=>{if(i){n||(e?this.t=this.t.filter((h=>h.type!==i||h.listener!==s||h.target!==t)):this.t.push({target:t,type:i,listener:s,passive:h}));const r=!!m&&{passive:h||!1};t[o](i,s,r)}}))}}function w(t,i){if(t.getViewportSizeFn){const s=t.getViewportSizeFn(t,i);if(s)return s}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function g(t,i,s){let h;if(i.paddingFn)h=i.paddingFn(s)[t];else if(i.padding)h=i.padding[t];else{const s="padding"+t[0].toUpperCase()+t.slice(1);i[s]&&(h=i[s])}return h||0}function _(t,i){return{x:i.x-g("left",t,i)-g("right",t,i),y:i.y-g("top",t,i)-g("bottom",t,i)}}class y{constructor(t){this.slide=t,this.currZoomLevel=1,this.center={},this.max={},this.min={},this.reset()}update(t){this.currZoomLevel=t,this.slide.width?(this.o("x"),this.o("y"),this.slide.pswp.dispatch("calcBounds",{slide:this.slide})):this.reset()}o(t){const{pswp:i}=this.slide,s=this.slide["x"===t?"width":"height"]*this.currZoomLevel,h=g("x"===t?"left":"top",i.options,i.viewportSize),e=this.slide.panAreaSize[t];this.center[t]=Math.round((e-s)/2)+h,this.max[t]=s>e?Math.round(e-s)+h:this.center[t],this.min[t]=s>e?h:this.center[t]}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(t,i){return n(i,this.max[t],this.min[t])}}class v{constructor(t,i,s,h){this.pswp=h,this.options=t,this.itemData=i,this.index=s}update(t,i,s){this.elementSize={x:t,y:i},this.panAreaSize=s;const h=this.panAreaSize.x/this.elementSize.x,e=this.panAreaSize.y/this.elementSize.y;this.fit=Math.min(1,h<e?h:e),this.fill=Math.min(1,h>e?h:e),this.vFill=Math.min(1,e),this.initial=this.l(),this.secondary=this.u(),this.max=Math.max(this.initial,this.secondary,this.p()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}m(t){const i=this.options[t+"ZoomLevel"];if(i)return"function"==typeof i?i(this):"fill"===i?this.fill:"fit"===i?this.fit:Number(i)}u(){let t=this.m("secondary");return t||(t=Math.min(1,3*this.fit),t*this.elementSize.x>4e3&&(t=4e3/this.elementSize.x),t)}l(){return this.m("initial")||this.fit}p(){const t=this.m("max");return t||Math.max(1,4*this.fit)}}class b{constructor(i,s){this.element=t("pswp__img pswp__img--placeholder",i?"img":"",s),i&&(this.element.decoding="async",this.element.alt="",this.element.src=i,this.element.setAttribute("role","presentation")),this.element.setAttribute("aria-hiden","true")}setDisplayedSize(t,i){this.element&&("IMG"===this.element.tagName?(c(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=o(0,0,t/250)):c(this.element,t,i))}destroy(){this.element.parentNode&&this.element.remove(),this.element=null}}class x{constructor(t,i,s){this.data=t,this.index=i,this.pswp=s,this.isActive=i===s.currIndex,this.currentResolution=0,this.panAreaSize={},this.isFirstSlide=this.isActive&&!s.opener.isOpen,this.zoomLevels=new v(s.options,t,i,s),this.pswp.dispatch("gettingData",{slide:this,data:this.data,index:i}),this.pan={x:0,y:0},this.content=this.pswp.contentLoader.getContentBySlide(this),this.currZoomLevel=1,this.width=this.content.width,this.height=this.content.height,this.bounds=new y(this),this.prevDisplayedWidth=-1,this.prevDisplayedHeight=-1,this.pswp.dispatch("slideInit",{slide:this})}setIsActive(t){t&&!this.isActive?this.activate():!t&&this.isActive&&this.deactivate()}append(i){this.holderElement=i,this.data?(this.calculateSize(),this.container=t("pswp__zoom-wrap"),this.container.transformOrigin="0 0",this.load(),this.appendHeavy(),this.updateContentSize(),this.holderElement.innerHTML="",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()):this.holderElement.innerHTML=""}removePlaceholder(){this.placeholder&&this.content&&!this.content.keepPlaceholder()&&setTimeout((()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=null)}),500)}load(){if(this.usePlaceholder()&&!this.placeholder){const t=this.pswp.applyFilters("placeholderSrc",!(!this.data.msrc||!this.isFirstSlide)&&this.data.msrc,this);this.placeholder=new b(t,this.container)}this.content.load(),this.pswp.dispatch("slideLoad",{slide:this})}isLoading(){return this.pswp.applyFilters("isSlideLoading",this.content.isLoading&&this.content.isLoading(),this)}appendHeavy(){const{pswp:t}=this;!this.heavyAppended&&t.opener.isOpen&&!t.mainScroll.isShifted()&&(this.isActive,1)&&(this.pswp.dispatch("appendHeavy",{slide:this}).defaultPrevented||(this.heavyAppended=!0,this.content.state===d?this.displayError():(this.content.appendTo(this.container),this.placeholder&&this.content.state===p&&this.removePlaceholder()),this.pswp.dispatch("appendHeavyContent",{slide:this})))}setSlideHTML(t){const{container:i}=this;t.tagName?i.appendChild(t):i.innerHTML=t}displayError(){const t=this.content.getErrorElement();t.style.position="absolute",t.style.left=0,t.style.top=0,this.activeErrorElement=t,this.setSlideHTML(t),this.updateContentSize(!0)}activate(){this.isActive=!0,this.appendHeavy(),this.content.activate(),this.pswp.dispatch("slideActivate",{slide:this})}deactivate(){this.isActive=!1,this.content.deactivate(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize(),this.pswp.dispatch("slideDeactivate",{slide:this})}destroy(){this.content.remove(),this.pswp.dispatch("slideDestroy",{slide:this})}resize(){this.currZoomLevel!==this.zoomLevels.initial&&this.isActive?(this.calculateSize(),this.bounds.update(this.currZoomLevel),this.panTo(this.pan.x,this.pan.y)):(this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize())}updateContentSize(t){const i=this.currentResolution||this.zoomLevels.initial;if(!i)return;const s=Math.round(this.width*i)||this.pswp.viewportSize.x,h=Math.round(this.height*i)||this.pswp.viewportSize.y;(this.sizeChanged(s,h)||t)&&(this.placeholder&&this.placeholder.setDisplayedSize(s,h),this.activeErrorElement&&c(this.activeErrorElement,s,h),this.content.setDisplayedSize(s,h))}sizeChanged(t,i){return(t!==this.prevDisplayedWidth||i!==this.prevDisplayedHeight)&&(this.prevDisplayedWidth=t,this.prevDisplayedHeight=i,!0)}getPlaceholderElement(){if(this.placeholder)return this.placeholder.element}zoomTo(t,i,h,e){const{pswp:o}=this;if(!this.isZoomable()||o.mainScroll.isShifted())return;o.dispatch("beforeZoomTo",{destZoomLevel:t,centerPoint:i,transitionDuration:h}),o.animations.stopAllPan();const r=this.currZoomLevel;e||(t=n(t,this.zoomLevels.min,this.zoomLevels.max)),this.setZoomLevel(t),this.pan.x=this.calculateZoomToPanOffset("x",i,r),this.pan.y=this.calculateZoomToPanOffset("y",i,r),s(this.pan);const a=()=>{this.g(t),this.applyCurrentZoomPan()};h?o.animations.startTransition({isPan:!0,name:"zoomTo",target:this.container,transform:this.getCurrentTransform(),onComplete:a,duration:h,easing:o.options.easing}):a()}toggleZoom(t){this.zoomTo(this.currZoomLevel===this.zoomLevels.initial?this.zoomLevels.secondary:this.zoomLevels.initial,t,this.pswp.options.zoomAnimationDuration)}setZoomLevel(t){this.currZoomLevel=t,this.bounds.update(this.currZoomLevel)}calculateZoomToPanOffset(t,i,s){if(0===this.bounds.max[t]-this.bounds.min[t])return this.bounds.center[t];i||(i=this.pswp.getViewportCenterPoint());const h=this.currZoomLevel/s;return this.bounds.correctPan(t,(this.pan[t]-i[t])*h+i[t])}panTo(t,i){this.pan.x=this.bounds.correctPan("x",t),this.pan.y=this.bounds.correctPan("y",i),this.applyCurrentZoomPan()}isPannable(){return this.width&&this.currZoomLevel>this.zoomLevels.fit}isZoomable(){return this.width&&this.content.isZoomable()}usePlaceholder(){return this.content.usePlaceholder()}applyCurrentZoomPan(){this._(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),i(this.pan,this.bounds.center),this.pswp.dispatch("initialZoomPan",{slide:this})}_(t,i,s){s/=this.currentResolution||this.zoomLevels.initial,r(this.container,t,i,s)}calculateSize(){const{pswp:t}=this;i(this.panAreaSize,_(t.options,t.viewportSize)),this.zoomLevels.update(this.width,this.height,this.panAreaSize),t.dispatch("calcSlideSize",{slide:this})}getCurrentTransform(){const t=this.currZoomLevel/(this.currentResolution||this.zoomLevels.initial);return o(this.pan.x,this.pan.y,t)}g(t){t!==this.currentResolution&&(this.currentResolution=t,this.updateContentSize(),this.pswp.dispatch("resolutionChanged"))}}class M{constructor(t){this.gestures=t,this.pswp=t.pswp,this.startPan={}}start(){i(this.startPan,this.pswp.currSlide.pan),this.pswp.animations.stopAll()}change(){const{p1:t,prevP1:i,dragAxis:h,pswp:e}=this.gestures,{currSlide:n}=e;if("y"===h&&e.options.closeOnVerticalDrag&&n.currZoomLevel<=n.zoomLevels.fit&&!this.gestures.isMultitouch){const s=n.pan.y+(t.y-i.y);if(!e.dispatch("verticalDrag",{panY:s}).defaultPrevented){this.v("y",s,.6);const t=1-Math.abs(this.M(n.pan.y));e.applyBgOpacity(t),n.applyCurrentZoomPan()}}else{this.S("x")||(this.S("y"),s(n.pan),n.applyCurrentZoomPan())}}end(){const{pswp:t,velocity:i}=this.gestures,{mainScroll:s}=t;let h=0;if(t.animations.stopAll(),s.isShifted()){const e=(s.x-s.getCurrSlideX())/t.viewportSize.x;i.x<-.5&&e<0||i.x<.1&&e<-.5?(h=1,i.x=Math.min(i.x,0)):(i.x>.5&&e>0||i.x>-.1&&e>.5)&&(h=-1,i.x=Math.max(i.x,0)),s.moveIndexBy(h,!0,i.x)}t.currSlide.currZoomLevel>t.currSlide.zoomLevels.max&&this.pswp.options.limitMaxZoom||this.gestures.isMultitouch?this.gestures.zoomLevels.correctZoomPan(!0):(this.P("x"),this.P("y"))}P(t){const{pswp:i}=this,{currSlide:s}=i,{velocity:h}=this.gestures,{pan:e,bounds:o}=s,r=e[t],a=i.bgOpacity<1&&"y"===t,c=r+function(t,i){return t*i/(1-i)}(h[t],.995);if(a){const t=this.M(r),s=this.M(c);if(t<0&&s<-.4||t>0&&s>.4)return void i.close()}const l=o.correctPan(t,c);if(r===l)return;const u=l===c?1:.82,p=i.bgOpacity,d=l-r;i.animations.startSpring({name:"panGesture"+t,isPan:!0,start:r,end:l,velocity:h[t],dampingRatio:u,onUpdate:h=>{if(a&&i.bgOpacity<1){const t=1-(l-h)/d;i.applyBgOpacity(n(p+(1-p)*t,0,1))}e[t]=Math.floor(h),s.applyCurrentZoomPan()}})}S(t){const{p1:i,pswp:s,dragAxis:h,prevP1:e,isMultitouch:n}=this.gestures,{currSlide:o,mainScroll:r}=s,a=i[t]-e[t],c=r.x+a;if(!a)return;if("x"===t&&!o.isPannable()&&!n)return r.moveTo(c,!0),!0;const{bounds:l}=o,u=o.pan[t]+a;if(s.options.allowPanToNext&&"x"===h&&"x"===t&&!n){const i=r.getCurrSlideX(),s=r.x-i,h=a>0,e=!h;if(u>l.min[t]&&h){if(l.min[t]<=this.startPan[t])return r.moveTo(c,!0),!0;this.v(t,u)}else if(u<l.max[t]&&e){if(this.startPan[t]<=l.max[t])return r.moveTo(c,!0),!0;this.v(t,u)}else if(0!==s){if(s>0)return r.moveTo(Math.max(c,i),!0),!0;if(s<0)return r.moveTo(Math.min(c,i),!0),!0}else this.v(t,u)}else"y"===t&&(r.isShifted()||l.min.y===l.max.y)||this.v(t,u)}M(t){return(t-this.pswp.currSlide.bounds.center.y)/(this.pswp.viewportSize.y/3)}v(t,i,s){const{pan:h,bounds:e}=this.pswp.currSlide;if(e.correctPan(t,i)!==i||s){const e=Math.round(i-h[t]);h[t]+=e*(s||.35)}else h[t]=i}}function S(t,i,s){return t.x=(i.x+s.x)/2,t.y=(i.y+s.y)/2,t}class z{constructor(t){this.gestures=t,this.pswp=this.gestures.pswp,this.C={},this.T={},this.D={}}start(){this.I=this.pswp.currSlide.currZoomLevel,i(this.C,this.pswp.currSlide.pan),this.pswp.animations.stopAllPan(),this.A=!1}change(){const{p1:t,startP1:i,p2:s,startP2:e,pswp:n}=this.gestures,{currSlide:o}=n,r=o.zoomLevels.min,a=o.zoomLevels.max;if(!o.isZoomable()||n.mainScroll.isShifted())return;S(this.T,i,e),S(this.D,t,s);let c=1/h(i,e)*h(t,s)*this.I;if(c>o.zoomLevels.initial+o.zoomLevels.initial/15&&(this.A=!0),c<r)if(n.options.pinchToClose&&!this.A&&this.I<=o.zoomLevels.initial){const t=1-(r-c)/(r/1.2);n.dispatch("pinchClose",{bgOpacity:t}).defaultPrevented||n.applyBgOpacity(t)}else c=r-.15*(r-c);else c>a&&(c=a+.05*(c-a));o.pan.x=this.k("x",c),o.pan.y=this.k("y",c),o.setZoomLevel(c),o.applyCurrentZoomPan()}end(){const{pswp:t}=this,{currSlide:i}=t;i.currZoomLevel<i.zoomLevels.initial&&!this.A&&t.options.pinchToClose?t.close():this.correctZoomPan()}k(t,i){const s=i/this.I;return this.D[t]-(this.T[t]-this.C[t])*s}correctZoomPan(t){const{pswp:s}=this,{currSlide:h}=s;if(!h.isZoomable())return;void 0===this.D.x&&(t=!0);const o=h.currZoomLevel;let r,a=!0;o<h.zoomLevels.initial?r=h.zoomLevels.initial:o>h.zoomLevels.max?r=h.zoomLevels.max:(a=!1,r=o);const c=s.bgOpacity,l=s.bgOpacity<1,u=i({},h.pan);let p=i({},u);t&&(this.D.x=0,this.D.y=0,this.T.x=0,this.T.y=0,this.I=o,i(this.C,u)),a&&(p={x:this.k("x",r),y:this.k("y",r)}),h.setZoomLevel(r),p={x:h.bounds.correctPan("x",p.x),y:h.bounds.correctPan("y",p.y)},h.setZoomLevel(o);let d=!0;if(e(p,u)&&(d=!1),!d&&!a&&!l)return h.g(r),void h.applyCurrentZoomPan();s.animations.stopAllPan(),s.animations.startSpring({isPan:!0,start:0,end:1e3,velocity:0,dampingRatio:1,naturalFrequency:40,onUpdate:t=>{if(t/=1e3,d||a){if(d&&(h.pan.x=u.x+(p.x-u.x)*t,h.pan.y=u.y+(p.y-u.y)*t),a){const i=o+(r-o)*t;h.setZoomLevel(i)}h.applyCurrentZoomPan()}l&&s.bgOpacity<1&&s.applyBgOpacity(n(c+(1-c)*t,0,1))},onComplete:()=>{h.g(r),h.applyCurrentZoomPan()}})}}function P(t){return!!t.target.closest(".pswp__container")}class C{constructor(t){this.gestures=t}click(t,i){const s=i.target.classList,h=s.contains("pswp__img"),e=s.contains("pswp__item")||s.contains("pswp__zoom-wrap");h?this.Z("imageClick",t,i):e&&this.Z("bgClick",t,i)}tap(t,i){P(i)&&this.Z("tap",t,i)}doubleTap(t,i){P(i)&&this.Z("doubleTap",t,i)}Z(t,i,s){const{pswp:h}=this.gestures,{currSlide:e}=h,n=h.options[t+"Action"];if(!h.dispatch(t+"Action",{point:i,originalEvent:s}).defaultPrevented)if("function"!=typeof n)switch(n){case"close":case"next":h[n]();break;case"zoom":e.toggleZoom(i);break;case"zoom-or-close":e.isZoomable()&&e.zoomLevels.secondary!==e.zoomLevels.initial?e.toggleZoom(i):h.options.clickToCloseNonZoomable&&h.close();break;case"toggle-controls":this.gestures.pswp.template.classList.toggle("pswp--ui-visible")}else n.call(h,i,s)}}class T{constructor(t){this.pswp=t,this.p1={},this.p2={},this.prevP1={},this.prevP2={},this.startP1={},this.startP2={},this.velocity={},this.L={},this.F={},this.O=0,this.B=[],this.G="ontouchstart"in window,this.R=!!window.PointerEvent,this.supportsTouch=this.G||this.R&&navigator.maxTouchPoints>1,this.supportsTouch||(t.options.allowPanToNext=!1),this.drag=new M(this),this.zoomLevels=new z(this),this.tapHandler=new C(this),t.on("bindEvents",(()=>{t.events.add(t.scrollWrap,"click",(t=>this.V(t))),this.R?this.N("pointer","down","up","cancel"):this.G?(this.N("touch","start","end","cancel"),t.scrollWrap.ontouchmove=()=>{},t.scrollWrap.ontouchend=()=>{}):this.N("mouse","down","up")}))}N(t,i,s,h){const{pswp:e}=this,{events:n}=e,o=h?t+h:"";n.add(e.scrollWrap,t+i,this.onPointerDown.bind(this)),n.add(window,t+"move",this.onPointerMove.bind(this)),n.add(window,t+s,this.onPointerUp.bind(this)),o&&n.add(e.scrollWrap,o,this.onPointerUp.bind(this))}onPointerDown(t){let s;if("mousedown"!==t.type&&"mouse"!==t.pointerType||(s=!0),s&&t.button>0)return;const{pswp:h}=this;h.opener.isOpen?h.dispatch("pointerDown",{originalEvent:t}).defaultPrevented||(s&&(h.mouseDetected(),this.U(t)),h.animations.stopAll(),this.q(t,"down"),this.pointerDown=!0,1===this.O&&(this.dragAxis=null,i(this.startP1,this.p1)),this.O>1?(this.H(),this.isMultitouch=!0):this.isMultitouch=!1):t.preventDefault()}onPointerMove(t){t.preventDefault(),this.O&&(this.q(t,"move"),this.pswp.dispatch("pointerMove",{originalEvent:t}).defaultPrevented||(1!==this.O||this.isDragging?this.O>1&&!this.isZooming&&(this.K(),this.isZooming=!0,this.j(),this.zoomLevels.start(),this.W(),this.X()):(this.dragAxis||this.Y(),this.dragAxis&&!this.isDragging&&(this.isZooming&&(this.isZooming=!1,this.zoomLevels.end()),this.isDragging=!0,this.H(),this.j(),this.J=Date.now(),this.$=!1,i(this.F,this.p1),this.velocity.x=0,this.velocity.y=0,this.drag.start(),this.W(),this.X()))))}K(){this.isDragging&&(this.isDragging=!1,this.$||this.tt(!0),this.drag.end(),this.dragAxis=null)}onPointerUp(t){this.O&&(this.q(t,"up"),this.pswp.dispatch("pointerUp",{originalEvent:t}).defaultPrevented||(0===this.O&&(this.pointerDown=!1,this.W(),this.isDragging?this.K():this.isZooming||this.isMultitouch||this.it(t)),this.O<2&&this.isZooming&&(this.isZooming=!1,this.zoomLevels.end(),1===this.O&&(this.dragAxis=null,this.j()))))}X(){(this.isDragging||this.isZooming)&&(this.tt(),this.isDragging?e(this.p1,this.prevP1)||this.drag.change():e(this.p1,this.prevP1)&&e(this.p2,this.prevP2)||this.zoomLevels.change(),this.st(),this.raf=requestAnimationFrame(this.X.bind(this)))}tt(t){const s=Date.now(),h=s-this.J;h<50&&!t||(this.velocity.x=this.ht("x",h),this.velocity.y=this.ht("y",h),this.J=s,i(this.F,this.p1),this.$=!0)}it(t){const{mainScroll:s}=this.pswp;if(s.isShifted())return void s.moveIndexBy(0,!0);if(t.type.indexOf("cancel")>0)return;if("mouseup"===t.type||"mouse"===t.pointerType)return void this.tapHandler.click(this.startP1,t);const e=this.pswp.options.doubleTapAction?300:0;this.et?(this.H(),h(this.L,this.startP1)<25&&this.tapHandler.doubleTap(this.startP1,t)):(i(this.L,this.startP1),this.et=setTimeout((()=>{this.tapHandler.tap(this.startP1,t),this.H()}),e))}H(){this.et&&(clearTimeout(this.et),this.et=null)}ht(t,i){const s=this.p1[t]-this.F[t];return Math.abs(s)>1&&i>5?s/i:0}W(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null)}U(t){return t.preventDefault(),!0}q(t,s){if(this.R){const h=this.B.findIndex((i=>i.id===t.pointerId));"up"===s&&h>-1?this.B.splice(h,1):"down"===s&&-1===h?this.B.push(this.nt(t,{})):h>-1&&this.nt(t,this.B[h]),this.O=this.B.length,this.O>0&&i(this.p1,this.B[0]),this.O>1&&i(this.p2,this.B[1])}else this.O=0,t.type.indexOf("touch")>-1?t.touches&&t.touches.length>0&&(this.nt(t.touches[0],this.p1),this.O++,t.touches.length>1&&(this.nt(t.touches[1],this.p2),this.O++)):(this.nt(t,this.p1),"up"===s?this.O=0:this.O++)}st(){i(this.prevP1,this.p1),i(this.prevP2,this.p2)}j(){i(this.startP1,this.p1),i(this.startP2,this.p2),this.st()}Y(){if(this.pswp.mainScroll.isShifted())this.dragAxis="x";else{const t=Math.abs(this.p1.x-this.startP1.x)-Math.abs(this.p1.y-this.startP1.y);if(0!==t){const i=t>0?"x":"y";Math.abs(this.p1[i]-this.startP1[i])>=10&&(this.dragAxis=i)}}}nt(t,i){return i.x=t.pageX-this.pswp.offset.x,i.y=t.pageY-this.pswp.offset.y,void 0!==t.pointerId?i.id=t.pointerId:void 0!==t.identifier&&(i.id=t.identifier),i}V(t){this.pswp.mainScroll.isShifted()&&(t.preventDefault(),t.stopPropagation())}}class D{constructor(t){this.pswp=t,this.x=0,this.resetPosition()}resize(t){const{pswp:i}=this,s=Math.round(i.viewportSize.x+i.viewportSize.x*i.options.spacing),h=s!==this.slideWidth;h&&(this.slideWidth=s,this.moveTo(this.getCurrSlideX())),this.itemHolders.forEach(((i,s)=>{h&&r(i.el,(s+this.ot)*this.slideWidth),t&&i.slide&&i.slide.resize()}))}resetPosition(){this.rt=0,this.at=0,this.slideWidth=0,this.ot=-1}appendHolders(){this.itemHolders=[];for(let i=0;i<3;i++){const s=t("pswp__item",!1,this.pswp.container);s.style.display=1===i?"block":"none",this.itemHolders.push({el:s})}}canBeSwiped(){return this.pswp.getNumItems()>1}moveIndexBy(t,i,s){const{pswp:h}=this;let e=h.potentialIndex+t;h.options.loop?e=h.getLoopedIndex(e):(e<0?e=0:e>=h.getNumItems()&&(e=h.getNumItems()-1),t=e-h.potentialIndex),h.potentialIndex=e,this.rt-=t,h.animations.stopMainScroll();const n=this.getCurrSlideX();if(i?(h.animations.startSpring({isMainScroll:!0,start:this.x,end:n,velocity:s||0,naturalFrequency:30,dampingRatio:1,onUpdate:t=>{this.moveTo(t)},onComplete:()=>{this.updateCurrItem(),h.appendHeavy()}}),Math.abs(h.potentialIndex-h.currIndex)>1&&this.updateCurrItem()):(this.moveTo(n),this.updateCurrItem()),t)return!0}getCurrSlideX(){return this.slideWidth*this.rt}isShifted(){return this.x!==this.getCurrSlideX()}updateCurrItem(){const{pswp:t}=this,i=this.at-this.rt;if(!i)return;this.at=this.rt,t.currIndex=t.potentialIndex;let s,h=Math.abs(i);h>=3&&(this.ot+=i+(i>0?-3:3),h=3);for(let e=0;e<h;e++)i>0?(s=this.itemHolders.shift(),this.itemHolders[2]=s,this.ot++,r(s.el,(this.ot+2)*this.slideWidth),t.setContent(s,t.currIndex-h+e+2)):(s=this.itemHolders.pop(),this.itemHolders.unshift(s),this.ot--,r(s.el,this.ot*this.slideWidth),t.setContent(s,t.currIndex+h-e-2));Math.abs(this.ot)>50&&!this.isShifted()&&(this.resetPosition(),this.resize()),t.animations.stopAllPan(),this.itemHolders.forEach(((t,i)=>{t.slide&&t.slide.setIsActive(1===i)})),t.currSlide=this.itemHolders[1].slide,t.contentLoader.updateLazy(i),t.currSlide.applyCurrentZoomPan(),t.dispatch("change")}moveTo(t,i){let s,h;!this.pswp.options.loop&&i&&(s=(this.slideWidth*this.rt-t)/this.slideWidth,s+=this.pswp.currIndex,h=Math.round(t-this.x),(s<0&&h>0||s>=this.pswp.getNumItems()-1&&h<0)&&(t=this.x+.35*h)),this.x=t,r(this.pswp.container,t),this.pswp.dispatch("moveMainScroll",{x:t,dragging:i})}}class I{constructor(t){this.pswp=t,t.on("bindEvents",(()=>{t.options.initialPointerPos||this.ct(),t.events.add(document,"focusin",this.lt.bind(this)),t.events.add(document,"keydown",this.ut.bind(this))}));const i=document.activeElement;t.on("destroy",(()=>{t.options.returnFocus&&i&&this.dt&&i.focus()}))}ct(){this.dt||(this.pswp.template.focus(),this.dt=!0)}ut(t){const{pswp:i}=this;if(i.dispatch("keydown",{originalEvent:t}).defaultPrevented)return;if(function(t){if(2===t.which||t.ctrlKey||t.metaKey||t.altKey||t.shiftKey)return!0}(t))return;let s,h,e;switch(t.keyCode){case 27:i.options.escKey&&(s="close");break;case 90:s="toggleZoom";break;case 37:h="x";break;case 38:h="y";break;case 39:h="x",e=!0;break;case 40:e=!0,h="y";break;case 9:this.ct()}if(h){t.preventDefault();const{currSlide:n}=i;i.options.arrowKeys&&"x"===h&&i.getNumItems()>1?s=e?"next":"prev":n&&n.currZoomLevel>n.zoomLevels.fit&&(n.pan[h]+=e?-80:80,n.panTo(n.pan.x,n.pan.y))}s&&(t.preventDefault(),i[s]())}lt(t){const{template:i}=this.pswp;document===t.target||i===t.target||i.contains(t.target)||i.focus()}}class A{constructor(t){this.props=t;const{target:i,onComplete:s,transform:h}=t;let{duration:e,easing:n}=t;const o=h?"transform":"opacity",r=t[o];this.ft=i,this.wt=s,e=e||333,n=n||"cubic-bezier(.4,0,.22,1)",this.gt=this.gt.bind(this),this._t=setTimeout((()=>{a(i,o,e,n),this._t=setTimeout((()=>{i.addEventListener("transitionend",this.gt,!1),i.addEventListener("transitioncancel",this.gt,!1),i.style[o]=r}),30)}),0)}gt(t){t.target===this.ft&&this.yt()}yt(){this.vt||(this.vt=!0,this.onFinish(),this.wt&&this.wt())}destroy(){this._t&&clearTimeout(this._t),a(this.ft),this.ft.removeEventListener("transitionend",this.gt,!1),this.ft.removeEventListener("transitioncancel",this.gt,!1),this.vt||this.yt()}}class E{constructor(t,i,s){this.velocity=1e3*t,this.bt=i||.75,this.xt=s||12,this.bt<1&&(this.Mt=this.xt*Math.sqrt(1-this.bt*this.bt))}easeFrame(t,i){let s,h=0;i/=1e3;const e=Math.E**(-this.bt*this.xt*i);if(1===this.bt)s=this.velocity+this.xt*t,h=(t+s*i)*e,this.velocity=h*-this.xt+s*e;else if(this.bt<1){s=1/this.Mt*(this.bt*this.xt*t+this.velocity);const n=Math.cos(this.Mt*i),o=Math.sin(this.Mt*i);h=e*(t*n+s*o),this.velocity=h*-this.xt*this.bt+e*(-this.Mt*t*o+this.Mt*s*n)}return h}}class k{constructor(t){this.props=t;const{start:i,end:s,velocity:h,onUpdate:e,onComplete:n,onFinish:o,dampingRatio:r,naturalFrequency:a}=t,c=new E(h,r,a);let l=Date.now(),u=i-s;this.St=o;const p=()=>{this.zt&&(u=c.easeFrame(u,Date.now()-l),Math.abs(u)<1&&Math.abs(c.velocity)<50?(e(s),n&&n(),this.onFinish()):(l=Date.now(),e(u+s),this.zt=requestAnimationFrame(p)))};this.zt=requestAnimationFrame(p)}destroy(){this.zt>=0&&cancelAnimationFrame(this.zt),this.zt=null}}class Z{constructor(){this.activeAnimations=[]}startSpring(t){this.Pt(t,!0)}startTransition(t){this.Pt(t)}Pt(t,i){let s;return s=i?new k(t):new A(t),this.activeAnimations.push(s),s.onFinish=()=>this.stop(s),s}stop(t){t.destroy();const i=this.activeAnimations.indexOf(t);i>-1&&this.activeAnimations.splice(i,1)}stopAll(){this.activeAnimations.forEach((t=>{t.destroy()})),this.activeAnimations=[]}stopAllPan(){this.activeAnimations=this.activeAnimations.filter((t=>!t.props.isPan||(t.destroy(),!1)))}stopMainScroll(){this.activeAnimations=this.activeAnimations.filter((t=>!t.props.isMainScroll||(t.destroy(),!1)))}isPanRunning(){return this.activeAnimations.some((t=>t.props.isPan))}}class L{constructor(t){this.pswp=t,t.events.add(t.template,"wheel",this.Ct.bind(this))}Ct(t){t.preventDefault();const{currSlide:i}=this.pswp;let{deltaX:s,deltaY:h}=t;if(i&&!this.pswp.dispatch("wheel",{originalEvent:t}).defaultPrevented)if(t.ctrlKey||this.pswp.options.wheelToZoom){if(i.isZoomable()){let s=-h;1===t.deltaMode?s*=.05:s*=t.deltaMode?1:.002,s=2**s,this.pswp.options.getWheelZoomFactorFn&&(s=this.pswp.options.getWheelZoomFactorFn(t,this.pswp));const e=i.currZoomLevel*s;i.zoomTo(e,{x:t.clientX,y:t.clientY})}}else i.isPannable()&&(1===t.deltaMode&&(s*=18,h*=18),i.panTo(i.pan.x-s,i.pan.y-h))}}class F{constructor(i,s){const h=s.name||s.class;let e=s.html;if(!1===i.options[h])return;"string"==typeof i.options[h+"SVG"]&&(e=i.options[h+"SVG"]),i.dispatch("uiElementCreate",{data:s});let n,o="pswp__";s.isButton&&(o+="button pswp__button--"),o+=s.class||s.name,s.isButton?(n=t(o,"button"),n.type="button","string"==typeof i.options[h+"Title"]?n.title=i.options[h+"Title"]:s.title&&(n.title=s.title)):n=t(o),n.innerHTML=function(t){if("string"==typeof t)return t;if(!t||!t.isCustomSVG)return"";const i=t;let s='<svg aria-hidden="true" class="pswp__icn" viewBox="0 0 %d %d" width="%d" height="%d">';return s=s.split("%d").join(i.size||32),i.outlineID&&(s+='<use class="pswp__icn-shadow" xlink:href="#'+i.outlineID+'"/>'),s+=i.inner,s+="</svg>",s}(e),s.onInit&&s.onInit(n,i),s.onClick&&(n.onclick=t=>{"string"==typeof s.onClick?i[s.onClick]():s.onClick(t,n,i)});const r=s.appendTo||"bar";let a;"bar"===r?(i.topBar||(i.topBar=t("pswp__top-bar pswp__hide-on-close",!1,i.scrollWrap)),a=i.topBar):(n.classList.add("pswp__hide-on-close"),a="wrapper"===r?i.scrollWrap:i.template),a.appendChild(n)}}function O(t,i,s){t.classList.add("pswp__button--arrow"),i.on("change",(()=>{i.options.loop||(t.disabled=s?!(i.currIndex<i.getNumItems()-1):!(i.currIndex>0))}))}const B={name:"arrowPrev",class:"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:O},G={name:"arrowNext",class:"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:(t,i)=>{O(t,i,!0)}},R={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"},V={name:"zoom",title:"Zoom (z)",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"},N={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:(t,i)=>{let s,h;const e=i=>{var h,e;s!==i&&(s=i,h="active",e=i,t.classList[e?"add":"remove"]("pswp__preloader--"+h))},n=()=>{if(!i.currSlide.isLoading())return e(!1),void(h&&(clearTimeout(h),h=null));h||(h=setTimeout((()=>{e(i.currSlide.isLoading()),h=null}),i.options.preloaderDelay))};i.on("change",n),i.on("loadComplete",(t=>{i.currSlide===t.slide&&n()})),i.ui.updatePreloaderVisibility=n}},U={name:"counter",order:5,onInit:(t,i)=>{i.on("change",(()=>{t.innerHTML=i.currIndex+1+i.options.indexIndicatorSep+i.getNumItems()}))}};function q(t,i){t.classList[i?"add":"remove"]("pswp--zoomed-in")}class H{constructor(t){this.pswp=t}init(){const{pswp:t}=this;this.isRegistered=!1,this.uiElementsData=[R,B,G,V,N,U],t.dispatch("uiRegister"),this.uiElementsData.sort(((t,i)=>(t.order||0)-(i.order||0))),this.items=[],this.isRegistered=!0,this.uiElementsData.forEach((t=>{this.registerElement(t)})),1===t.getNumItems()&&t.template.classList.add("pswp--one-slide"),t.on("zoomPanUpdate",(()=>this.Tt()))}registerElement(t){this.isRegistered?this.items.push(new F(this.pswp,t)):this.uiElementsData.push(t)}Tt(){const{template:t,currSlide:i,options:s}=this.pswp;let{currZoomLevel:h}=i;if(this.pswp.opener.isClosing)return;if(this.pswp.opener.isOpen||(h=i.zoomLevels.initial),h===this.Dt)return;this.Dt=h;const e=i.zoomLevels.initial-i.zoomLevels.secondary;if(Math.abs(e)<.01||!i.isZoomable())return q(t,!1),void t.classList.remove("pswp--zoom-allowed");t.classList.add("pswp--zoom-allowed");const n=e<0;h===i.zoomLevels.secondary?q(t,n):h>i.zoomLevels.secondary?q(t,!0):q(t,!1),"zoom"!==s.imageClickAction&&"zoom-or-close"!==s.imageClickAction||t.classList.add("pswp--click-to-zoom")}}class K{constructor(t,i){this.type=t,i&&Object.assign(this,i)}preventDefault(){this.defaultPrevented=!0}}class j{constructor(t,i){this.options=i.options,this.instance=i,this.data=t,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.state=l}setSlide(t){this.slide=t,this.pswp=t.pswp}load(){this.element||(this.element=t("pswp__content"),this.element.style.position="absolute",this.element.style.left=0,this.element.style.top=0,this.element.innerHTML=this.data.html||"")}isZoomable(){return!1}usePlaceholder(){return!1}activate(){}deactivate(){}setDisplayedSize(t,i){this.element&&c(this.element,t,i)}onLoaded(){this.state=p,this.slide&&this.pswp.dispatch("loadComplete",{slide:this.slide})}isLoading(){return this.state===u}keepPlaceholder(){return this.isLoading()}onError(){this.state=d,this.slide&&(this.pswp.dispatch("loadComplete",{slide:this.slide,isError:!0}),this.pswp.dispatch("loadError",{slide:this.slide}))}getErrorElement(){return!1}remove(){this.isAttached=!1,this.element&&this.element.parentNode&&this.element.remove()}appendTo(t){this.isAttached=!0,this.element&&!this.element.parentNode&&t.appendChild(this.element)}destroy(){}}class W extends j{load(){if(this.element)return;const i=this.data.src;i&&(this.element=t("pswp__img","img"),this.data.srcset&&(this.element.srcset=this.data.srcset),this.element.src=i,this.element.alt=this.data.alt||"",this.state=u,this.element.complete?this.onLoaded():(this.element.onload=()=>{this.onLoaded()},this.element.onerror=()=>{this.onError()}))}setDisplayedSize(t,i){const s=this.element;s&&(c(s,t,"auto"),s.srcset&&(!s.dataset.largestUsedSize||t>s.dataset.largestUsedSize)&&(s.sizes=t+"px",s.dataset.largestUsedSize=t),this.slide&&this.pswp.dispatch("imageSizeChange",{slide:this.slide,width:t,height:i}))}isZoomable(){return this.state!==d}usePlaceholder(){return!0}lazyLoad(){this.load()}destroy(){this.element&&(this.element.onload=null,this.element.onerror=null,this.element=null)}appendTo(t){this.isAttached=!0,this.slide&&!this.slide.isActive&&"decode"in this.element?(this.isDecoding=!0,requestAnimationFrame((()=>{this.element&&this.element.decode().then((()=>{this.isDecoding=!1,requestAnimationFrame((()=>{this.appendImageTo(t)}))})).catch((()=>{}))}))):this.appendImageTo(t)}activate(){this.slide&&this.slide.container&&this.isDecoding&&this.appendImageTo(this.slide.container)}getErrorElement(){const i=t("pswp__error-msg-container");i.innerHTML=this.options.errorMsg;const s=i.querySelector("a");return s&&(s.href=this.data.src),i}appendImageTo(t){this.element&&!this.element.parentNode&&this.isAttached&&t.appendChild(this.element)}}class X{constructor(t){this.pswp=t,this.isClosed=!0,this.It=this.It.bind(this),t.on("firstZoomPan",this.It)}open(){this.It(),this.Pt()}close(){if(this.isClosed||this.isClosing||this.isOpening)return!1;const t=this.pswp.currSlide;return this.isOpen=!1,this.isOpening=!1,this.isClosing=!0,this.At=this.pswp.options.hideAnimationDuration,t&&t.currZoomLevel*t.width>=4e3&&(this.At=0),this.Et(),setTimeout((()=>{this.Pt()}),this.kt?30:0),!0}It(){this.pswp.off("firstZoomPan",this.It),this.isOpening||(this.isOpening=!0,this.isClosing=!1,this.At=this.pswp.options.showAnimationDuration,this.Et())}Et(){const{pswp:t}=this,i=this.pswp.currSlide,{options:s}=t;if("fade"===s.showHideAnimationType?(s.showHideOpacity=!0,this.Zt=!1):"none"===s.showHideAnimationType?(s.showHideOpacity=!1,this.At=0,this.Zt=!1):this.isOpening&&t.Lt?this.Zt=t.Lt:this.Zt=this.pswp.getThumbBounds(),this.Ft=i.getPlaceholderElement(),t.animations.stopAll(),this.Ot=this.At>50,this.Bt=Boolean(this.Zt)&&(!this.isClosing||!t.mainScroll.isShifted()),this.Bt?this.Gt=s.showHideOpacity:(this.Gt=!0,this.isOpening&&(i.zoomAndPanToInitial(),i.applyCurrentZoomPan())),this.Rt=!this.Gt,this.Vt=this.Gt?t.template:t.bg,!this.Ot)return this.At=0,this.Bt=!1,this.Rt=!1,this.Gt=!0,void(this.isOpening&&(t.template.style.opacity=.003,t.applyBgOpacity(1)));this.Bt&&this.Zt.innerRect?(this.kt=!0,this.Nt=this.pswp.container,this.Ut=this.pswp.currSlide.holderElement,t.container.style.overflow="hidden",t.container.style.width=t.viewportSize.x+"px"):this.kt=!1,this.isOpening?(this.Rt&&(t.bg.style.opacity=.003,t.template.style.opacity=1),this.Gt&&(t.template.style.opacity=.003,t.applyBgOpacity(1)),this.Bt&&(this.qt(),this.Ft&&(this.Ft.willChange="transform",this.Ft.style.opacity=.003))):this.isClosing&&(t.mainScroll.itemHolders[0].el.style.display="none",t.mainScroll.itemHolders[2].el.style.display="none",this.kt&&0!==t.mainScroll.x&&(t.mainScroll.resetPosition(),t.mainScroll.resize()))}Pt(){this.isOpening&&this.Ot&&this.Ft&&"IMG"===this.Ft.tagName?new Promise((t=>{let i=!1,s=!0;var h;(h=this.Ft,"decode"in h?h.decode():h.complete?Promise.resolve(h):new Promise(((t,i)=>{h.onload=()=>t(h),h.onerror=i}))).finally((()=>{i=!0,s||t()})),setTimeout((()=>{s=!1,i&&t()}),50),setTimeout(t,250)})).finally((()=>this.Ht())):this.Ht()}Ht(){this.pswp.template.style.setProperty("--pswp-transition-duration",this.At+"ms"),this.pswp.dispatch("initialZoom"+(this.isOpening?"In":"Out")),this.pswp.template.classList[this.isOpening?"add":"remove"]("pswp--ui-visible"),this.isOpening?(this.Ft&&(this.Ft.style.opacity=1),this.Kt()):this.isClosing&&this.jt(),this.Ot||this.Wt()}Wt(){const{pswp:t}=this;this.isOpen=this.isOpening,this.isClosed=this.isClosing,this.isOpening=!1,this.isClosing=!1,t.dispatch("initialZoom"+(this.isOpen?"InEnd":"OutEnd")),this.isClosed?t.destroy():this.isOpen&&(this.Bt&&(t.container.style.overflow="visible",t.container.style.width="100%"),t.currSlide.applyCurrentZoomPan())}Kt(){const{pswp:t}=this;this.Bt&&(this.kt&&(this.Xt(this.Nt,"transform","translate3d(0,0,0)"),this.Xt(this.Ut,"transform","none")),t.currSlide.zoomAndPanToInitial(),this.Xt(t.currSlide.container,"transform",t.currSlide.getCurrentTransform())),this.Rt&&this.Xt(t.bg,"opacity",t.options.bgOpacity),this.Gt&&this.Xt(t.template,"opacity",1)}jt(){const{pswp:t}=this;this.Bt&&this.qt(!0),this.Rt&&t.bgOpacity>.01&&this.Xt(t.bg,"opacity",0),this.Gt&&this.Xt(t.template,"opacity",0)}qt(t){const{pswp:s}=this,{innerRect:h}=this.Zt,{currSlide:e,viewportSize:n}=s;if(this.kt){const i=-n.x+(this.Zt.x-h.x)+h.w,s=-n.y+(this.Zt.y-h.y)+h.h,e=n.x-h.w,a=n.y-h.h;t?(this.Xt(this.Nt,"transform",o(i,s)),this.Xt(this.Ut,"transform",o(e,a))):(r(this.Nt,i,s),r(this.Ut,e,a))}i(e.pan,h||this.Zt),e.currZoomLevel=this.Zt.w/e.width,t?this.Xt(e.container,"transform",e.getCurrentTransform()):e.applyCurrentZoomPan()}Xt(t,i,s){if(!this.At)return void(t.style[i]=s);const{animations:h}=this.pswp,e={duration:this.At,easing:this.pswp.options.easing,onComplete:()=>{h.activeAnimations.length||this.Wt()},target:t};e[i]=s,h.startTransition(e)}}function Y(t,i){return t&&t.src?t.src+"_"+i:i}function J(t,i){const s=i.getItemData(t);if(!i.dispatch("lazyLoadSlide",{index:t,itemData:s}).defaultPrevented)return function(t,i,s){const h=i.createContentFromData(t);if(!h||!h.lazyLoad)return;h.key=Y(t,s);const{options:e}=i,n=_(e,i.viewportSize||w(e)),o=new v(e,t,-1);return o.update(h.width,h.height,n),h.lazyLoad(),h.setDisplayedSize(Math.ceil(h.width*o.initial),Math.ceil(h.height*o.initial)),h}(s,i,t)}class Q{constructor(t){this.pswp=t,this.limit=Math.max(t.options.preload[0]+t.options.preload[1]+1,5),this.Yt=[]}updateLazy(t){const{pswp:i}=this;if(i.dispatch("lazyLoad").defaultPrevented)return;const{preload:s}=i.options,h=void 0===t||t>=0;let e;for(e=0;e<=s[1];e++)this.loadSlideByIndex(i.currIndex+(h?e:-e));for(e=1;e<=s[0];e++)this.loadSlideByIndex(i.currIndex+(h?-e:e))}loadSlideByIndex(t){t=this.pswp.getLoopedIndex(t);const i=Y(this.pswp.getItemData(t),t);let s=this.getContentByKey(i);s||(s=J(t,this.pswp),s&&(s.key=i,this.addToCache(s)))}getContentBySlide(t){let i=this.getContentByKey(this.getKeyBySlide(t));return i||(i=this.pswp.createContentFromData(t.data),i&&(i.key=this.getKeyBySlide(t),this.addToCache(i))),i&&i.setSlide(t),i}addToCache(t){if(this.removeByKey(t.key),this.Yt.push(t),this.Yt.length>this.limit){const t=this.Yt.findIndex((t=>!t.isAttached));if(-1!==t){this.Yt.splice(t,1)[0].destroy()}}}removeByKey(t){const i=this.Yt.findIndex((i=>i.key===t));-1!==i&&this.Yt.splice(i,1)}getContentByKey(t){return this.Yt.find((i=>i.key===t))}getKeyBySlide(t){return Y(t.data,t.index)}destroy(){this.Yt.forEach((t=>t.destroy())),this.Yt=null}}const $={allowPanToNext:!0,spacing:.1,loop:!0,pinchToClose:!0,closeOnVerticalDrag:!0,hideAnimationDuration:333,showAnimationDuration:333,zoomAnimationDuration:333,escKey:!0,arrowKeys:!0,returnFocus:!0,limitMaxZoom:!0,clickToCloseNonZoomable:!0,imageClickAction:"zoom-or-close",bgClickAction:"close",tapAction:"toggle-controls",doubleTapAction:"zoom",indexIndicatorSep:" / ",preloaderDelay:2e3,bgOpacity:.8,index:0,errorMsg:'<div class="pswp__error-msg"><a href="" target="_blank">The image</a> could not be loaded.</div>',preload:[1,2],easing:"cubic-bezier(.4,0,.22,1)"};export default class extends class extends class{constructor(){this.Jt={},this.Qt={}}addFilter(t,i,s=100){this.Qt[t]||(this.Qt[t]=[]),this.Qt[t].push({fn:i,priority:s}),this.Qt[t].sort(((t,i)=>t.priority-i.priority)),this.pswp&&this.pswp.addFilter(t,i,s)}removeFilter(t,i){this.Qt[t]&&(this.Qt[t]=this.Qt[t].filter((t=>t.fn!==i))),this.pswp&&this.pswp.removeFilter(t,i)}applyFilters(t,...i){return this.Qt[t]&&this.Qt[t].forEach((t=>{i[0]=t.fn.apply(this,i)})),i[0]}on(t,i){this.Jt[t]||(this.Jt[t]=[]),this.Jt[t].push(i),this.pswp&&this.pswp.on(t,i)}off(t,i){this.Jt[t]&&(this.Jt[t]=this.Jt[t].filter((t=>i!==t))),this.pswp&&this.pswp.off(t,i)}dispatch(t,i){if(this.pswp)return this.pswp.dispatch(t,i);const s=new K(t,i);return this.Jt?(this.Jt[t]&&this.Jt[t].forEach((t=>{t.call(this,s)})),s):s}}{constructor(){super(),this.contentTypes={image:W,html:j}}getNumItems(){let t;const{dataSource:i}=this.options;i?i.length?t=i.length:i.gallery&&(i.items||(i.items=this.$t(i.gallery)),i.items&&(t=i.items.length)):t=0;const s=this.dispatch("numItems",{dataSource:i,numItems:t});return this.applyFilters("numItems",s.numItems,i)}addContentType(t,i){this.contentTypes[t]=i}getContentClass(t){return t.type?this.contentTypes[t.type]:t.src?this.contentTypes.image:t.html?this.contentTypes.html:void 0}createContentFromData(t){const i=this.getContentClass(t);if(!i)return!1;return new i(t,this)}getItemData(t){const{dataSource:i}=this.options;let s;Array.isArray(i)?s=i[t]:i&&i.gallery&&(i.items||(i.items=this.$t(i.gallery)),s=i.items[t]);let h=s;h instanceof Element&&(h=this.ti(h));const e=this.dispatch("itemData",{itemData:h||{},index:t});return this.applyFilters("itemData",e.itemData,t)}$t(t){return this.options.children||this.options.childSelector?function(t,i,s=document){let h=[];if(t instanceof Element)h=[t];else if(t instanceof NodeList||Array.isArray(t))h=Array.from(t);else{const e="string"==typeof t?t:i;e&&(h=Array.from(s.querySelectorAll(e)))}return h}(this.options.children,this.options.childSelector,t)||[]:[t]}ti(t){const i={element:t},s="A"===t.tagName?t:t.querySelector("a");if(s){i.src=s.dataset.pswpSrc||s.href,i.srcset=s.dataset.pswpSrcset,i.w=parseInt(s.dataset.pswpWidth,10),i.h=parseInt(s.dataset.pswpHeight,10),s.dataset.pswpType&&(i.type=s.dataset.pswpType);const h=t.querySelector("img");h&&(i.msrc=h.currentSrc||h.src,i.alt=h.getAttribute("alt")),(s.dataset.pswpCropped||s.dataset.cropped)&&(i.thumbCropped=!0)}return this.applyFilters("domItemData",i,t,s),i}}{constructor(t,i){super(),this.items=t,this.ii(i),this.offset={},this.si={},this.viewportSize={},this.bgOpacity=1,this.events=new f,this.animations=new Z,this.mainScroll=new D(this),this.gestures=new T(this),this.opener=new X(this),this.keyboard=new I(this),this.contentLoader=new Q(this)}init(){if(this.isOpen||this.isDestroying)return;this.isOpen=!0,this.getNumItems()<3&&(this.options.loop=!1),this.dispatch("init"),this.dispatch("beforeOpen"),this.hi();let t="pswp--open";return this.gestures.supportsTouch&&(t+=" pswp--touch"),this.options.allowMouseDrag||(t+=" pswp--no-mouse-drag"),this.options.mainClass&&(t+=" "+this.options.mainClass),this.template.className+=" "+t,this.currIndex=this.options.index||0,this.potentialIndex=this.currIndex,this.dispatch("firstUpdate"),this.scrollWheel=new L(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.ei=this.getItemData(this.currIndex),this.dispatch("gettingData",this.currIndex,this.ei,!0),this.Lt=this.getThumbBounds(),this.dispatch("initialLayout"),this.on("initialZoomInEnd",(()=>{this.setContent(this.mainScroll.itemHolders[0],this.currIndex-1),this.setContent(this.mainScroll.itemHolders[2],this.currIndex+1),this.mainScroll.itemHolders[0].el.style.display="block",this.mainScroll.itemHolders[2].el.style.display="block",this.appendHeavy(),this.contentLoader.updateLazy(),this.events.add(window,"resize",this.ni.bind(this)),this.events.add(window,"scroll",this.oi.bind(this)),this.dispatch("bindEvents")})),this.on("loadComplete",(t=>{t.slide.heavyAppended&&t.slide.removePlaceholder()})),this.on("loadError",(t=>{t.slide.heavyAppended&&(t.slide.removePlaceholder(),t.slide.displayError())})),this.setContent(this.mainScroll.itemHolders[1],this.currIndex),this.dispatch("change"),this.opener.open(),this.dispatch("afterInit"),!0}getLoopedIndex(t){const i=this.getNumItems();return this.options.loop&&(t>i-1&&(t-=i),t<0&&(t+=i)),t=n(t,0,i-1)}getIndexDiff(t){if(this.options.loop){const i=this.getNumItems()-1;if(0===this.currIndex&&t===i)return-1;if(this.currIndex===i&&0===t)return 1}return t-this.currIndex}appendHeavy(){this.mainScroll.itemHolders.forEach((t=>{t.slide&&t.slide.appendHeavy()}))}goTo(t){t=this.getLoopedIndex(t);this.mainScroll.moveIndexBy(t-this.potentialIndex)&&this.dispatch("afterGoto")}next(){this.goTo(this.potentialIndex+1)}prev(){this.goTo(this.potentialIndex-1)}zoomTo(...t){this.currSlide.zoomTo(...t)}toggleZoom(){this.currSlide.toggleZoom()}close(){this.opener.isOpen&&!this.isDestroying&&(this.isDestroying=!0,this.dispatch("close"),this.events.removeAll(),this.opener.close())}destroy(){this.isDestroying?(this.dispatch("destroy"),this.listeners=null,this.scrollWrap.ontouchmove=null,this.scrollWrap.ontouchend=null,this.template.remove(),this.contentLoader.destroy(),this.events.removeAll()):this.close()}setContent(t,i){if(t.slide&&t.slide.destroy(),this.options.loop)i=this.getLoopedIndex(i);else if(i<0||i>=this.getNumItems())return void(t.el.innerHTML="");const s=this.getItemData(i);t.slide=new x(s,i,this),i===this.currIndex&&(this.currSlide=t.slide),t.slide.append(t.el)}getViewportCenterPoint(){return{x:this.viewportSize.x/2,y:this.viewportSize.y/2}}updateSize(t){if(this.isDestroying)return;const s=w(this.options,this);!t&&e(s,this.si)||(i(this.si,s),this.dispatch("beforeResize"),i(this.viewportSize,this.si),this.oi(),this.dispatch("viewportSize"),this.mainScroll.resize(this.opener.isOpen),!this.hasMouse&&window.matchMedia("(any-hover: hover)").matches&&this.mouseDetected(),this.dispatch("resize"))}applyBgOpacity(t){this.bgOpacity=Math.max(t,0),this.bg.style.opacity=this.bgOpacity*this.options.bgOpacity}mouseDetected(){this.hasMouse||(this.hasMouse=!0,this.template.classList.add("pswp--has_mouse"))}ni(){this.updateSize(),/iPhone|iPad|iPod/i.test(window.navigator.userAgent)&&setTimeout((()=>{this.updateSize()}),500)}oi(){this.setScrollOffset(0,window.pageYOffset)}setScrollOffset(t,i){this.offset.x=t,this.offset.y=i,this.dispatch("updateScrollOffset")}hi(){this.template=t("pswp"),this.template.setAttribute("tabindex",-1),this.template.setAttribute("role","dialog"),this.bg=t("pswp__bg",!1,this.template),this.scrollWrap=t("pswp__scroll-wrap",!1,this.template),this.container=t("pswp__container",!1,this.scrollWrap),this.mainScroll.appendHolders(),this.ui=new H(this),this.ui.init(),(this.options.appendToEl||document.body).appendChild(this.template)}getThumbBounds(){return function(t,i,s){const h=s.dispatch("thumbBounds",{index:t,itemData:i,instance:s});if(h.thumbBounds)return h.thumbBounds;const{element:e}=i;let n;if(e&&!1!==s.options.thumbSelector){const t=s.options.thumbSelector||"img",h=e.matches(t)?e:e.querySelector(t);h&&(n=i.thumbCropped?function(t,i,s){const h=t.getBoundingClientRect(),e=h.width/i,n=h.height/s,o=e>n?e:n,r=(h.width-i*o)/2,a=(h.height-s*o)/2,c={x:h.left+r,y:h.top+a,w:i*o};return c.innerRect={w:h.width,h:h.height,x:r,y:a},c}(h,i.w,i.h):function(t){const i=t.getBoundingClientRect();return{x:i.left,y:i.top,w:i.width}}(h))}return s.applyFilters("thumbBounds",n,i,t)}(this.currIndex,this.currSlide?this.currSlide.data:this.ei,this)}ii(t){window.matchMedia("(prefers-reduced-motion), (update: slow)").matches&&(t.showHideAnimationType="none",t.zoomAnimationDuration=0),this.options={...$,...t}}}export{j as Content,W as ImageContent};
{
"name": "photoswipe",
"version": "5.2.0-beta.1",
"version": "5.2.0-beta.2",
"main": "dist/photoswipe.esm.js",

@@ -5,0 +5,0 @@ "style": "dist/photoswipe.css",

@@ -99,3 +99,4 @@ import {

this.dispatch('init');
this.dispatch('init'); // legacy
this.dispatch('beforeOpen');

@@ -102,0 +103,0 @@ this._createMainStructure();

@@ -124,7 +124,12 @@ import { getViewportSize, getPanAreaSize } from '../util/viewport-size.js';

const key = getKey(itemData, index);
// try to get cached content
let content = this.getContentByKey(key);
if (!content) {
// no cached content, so try to load from scratch:
content = lazyLoadSlide(index, this.pswp);
content.key = key;
this.addToCache(content);
// if content can be loaded, add it to cache:
if (content) {
content.key = key;
this.addToCache(content);
}
}

@@ -131,0 +136,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc