diff --git a/themes/intotheeast/css-compiled/main.css b/themes/intotheeast/css-compiled/main.css new file mode 100644 index 0000000..7c80c86 --- /dev/null +++ b/themes/intotheeast/css-compiled/main.css @@ -0,0 +1,6 @@ +@font-face{font-family:DM Sans Variable;font-style:normal;font-display:swap;font-weight:100 1000;src:url("../fonts/dm-sans-latin-ext-wght-normal.woff2") format("woff2-variations");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:DM Sans Variable;font-style:normal;font-display:swap;font-weight:100 1000;src:url("../fonts/dm-sans-latin-wght-normal.woff2") format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:"DM Serif Display";font-style:normal;font-display:swap;font-weight:400;src:url("../fonts/dm-serif-display-latin-ext-400-normal.woff2") format("woff2"),url("../fonts/dm-serif-display-latin-ext-400-normal.woff") format("woff");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:"DM Serif Display";font-style:normal;font-display:swap;font-weight:400;src:url("../fonts/dm-serif-display-latin-400-normal.woff2") format("woff2"),url("../fonts/dm-serif-display-latin-400-normal.woff") format("woff");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:"DM Serif Display";font-style:italic;font-display:swap;font-weight:400;src:url("../fonts/dm-serif-display-latin-ext-400-italic.woff2") format("woff2"),url("../fonts/dm-serif-display-latin-ext-400-italic.woff") format("woff");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:"DM Serif Display";font-style:italic;font-display:swap;font-weight:400;src:url("../fonts/dm-serif-display-latin-400-italic.woff2") format("woff2"),url("../fonts/dm-serif-display-latin-400-italic.woff") format("woff");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}.pswp{--pswp-bg: #000;--pswp-placeholder-bg: #222;--pswp-root-z-index: 100000;--pswp-preloader-color: rgba(79, 79, 79, .4);--pswp-preloader-color-secondary: rgba(255, 255, 255, .9);--pswp-icon-color: #fff;--pswp-icon-color-secondary: #4f4f4f;--pswp-icon-stroke-color: #4f4f4f;--pswp-icon-stroke-width: 2px;--pswp-error-text-color: var(--pswp-icon-color)}.pswp{position:fixed;top:0;left:0;width:100%;height:100%;z-index:var(--pswp-root-z-index);display:none;touch-action:none;outline:0;opacity:.003;contain:layout style size;-webkit-tap-highlight-color:rgba(0,0,0,0)}.pswp:focus{outline:0}.pswp *{box-sizing:border-box}.pswp img{max-width:none}.pswp--open{display:block}.pswp,.pswp__bg{transform:translateZ(0);will-change:opacity}.pswp__bg{opacity:.005;background:var(--pswp-bg)}.pswp,.pswp__scroll-wrap{overflow:hidden}.pswp__scroll-wrap,.pswp__bg,.pswp__container,.pswp__item,.pswp__content,.pswp__img,.pswp__zoom-wrap{position:absolute;top:0;left:0;width:100%;height:100%}.pswp__img,.pswp__zoom-wrap{width:auto;height:auto}.pswp--click-to-zoom.pswp--zoom-allowed .pswp__img{cursor:-webkit-zoom-in;cursor:-moz-zoom-in;cursor:zoom-in}.pswp--click-to-zoom.pswp--zoomed-in .pswp__img{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.pswp--click-to-zoom.pswp--zoomed-in .pswp__img:active{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.pswp--no-mouse-drag.pswp--zoomed-in .pswp__img,.pswp--no-mouse-drag.pswp--zoomed-in .pswp__img:active,.pswp__img{cursor:-webkit-zoom-out;cursor:-moz-zoom-out;cursor:zoom-out}.pswp__container,.pswp__img,.pswp__button,.pswp__counter{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.pswp__item{z-index:1;overflow:hidden}.pswp__hidden{display:none!important}.pswp__content{pointer-events:none}.pswp__content>*{pointer-events:auto}.pswp__error-msg-container{display:grid}.pswp__error-msg{margin:auto;font-size:1em;line-height:1;color:var(--pswp-error-text-color)}.pswp .pswp__hide-on-close{opacity:.005;will-change:opacity;transition:opacity var(--pswp-transition-duration) cubic-bezier(.4,0,.22,1);z-index:10;pointer-events:none}.pswp--ui-visible .pswp__hide-on-close{opacity:1;pointer-events:auto}.pswp__button{position:relative;display:block;width:50px;height:60px;padding:0;margin:0;overflow:hidden;cursor:pointer;background:none;border:0;box-shadow:none;opacity:.85;-webkit-appearance:none;-webkit-touch-callout:none}.pswp__button:hover,.pswp__button:active,.pswp__button:focus{transition:none;padding:0;background:none;border:0;box-shadow:none;opacity:1}.pswp__button:disabled{opacity:.3;cursor:auto}.pswp__icn{fill:var(--pswp-icon-color);color:var(--pswp-icon-color-secondary)}.pswp__icn{position:absolute;top:14px;left:9px;width:32px;height:32px;overflow:hidden;pointer-events:none}.pswp__icn-shadow{stroke:var(--pswp-icon-stroke-color);stroke-width:var(--pswp-icon-stroke-width);fill:none}.pswp__icn:focus{outline:0}div.pswp__img--placeholder,.pswp__img--with-bg{background:var(--pswp-placeholder-bg)}.pswp__top-bar{position:absolute;left:0;top:0;width:100%;height:60px;display:flex;flex-direction:row;justify-content:flex-end;z-index:10;pointer-events:none!important}.pswp__top-bar>*{pointer-events:auto;will-change:opacity}.pswp__button--close{margin-right:6px}.pswp__button--arrow{position:absolute;width:75px;height:100px;top:50%;margin-top:-50px}.pswp__button--arrow:disabled{display:none;cursor:default}.pswp__button--arrow .pswp__icn{top:50%;margin-top:-30px;width:60px;height:60px;background:none;border-radius:0}.pswp--one-slide .pswp__button--arrow{display:none}.pswp--touch .pswp__button--arrow{visibility:hidden}.pswp--has_mouse .pswp__button--arrow{visibility:visible}.pswp__button--arrow--prev{right:auto;left:0}.pswp__button--arrow--next{right:0}.pswp__button--arrow--next .pswp__icn{left:auto;right:14px;transform:scaleX(-1)}.pswp__button--zoom{display:none}.pswp--zoom-allowed .pswp__button--zoom{display:block}.pswp--zoomed-in .pswp__zoom-icn-bar-v{display:none}.pswp__preloader{position:relative;overflow:hidden;width:50px;height:60px;margin-right:auto}.pswp__preloader .pswp__icn{opacity:0;transition:opacity .2s linear;animation:pswp-clockwise .6s linear infinite}.pswp__preloader--active .pswp__icn{opacity:.85}@keyframes pswp-clockwise{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.pswp__counter{height:30px;margin-top:15px;margin-inline-start:20px;font-size:14px;line-height:30px;color:var(--pswp-icon-color);text-shadow:1px 1px 3px var(--pswp-icon-color-secondary);opacity:.85}.pswp--one-slide .pswp__counter{display:none} +/*! Bundled license information: + +photoswipe/dist/photoswipe.css: + (*! PhotoSwipe main CSS by Dmytro Semenov | photoswipe.com *) +*/ diff --git a/themes/intotheeast/fonts/dm-sans-latin-ext-wght-normal.woff2 b/themes/intotheeast/fonts/dm-sans-latin-ext-wght-normal.woff2 new file mode 100644 index 0000000..db39c62 Binary files /dev/null and b/themes/intotheeast/fonts/dm-sans-latin-ext-wght-normal.woff2 differ diff --git a/themes/intotheeast/fonts/dm-sans-latin-wght-normal.woff2 b/themes/intotheeast/fonts/dm-sans-latin-wght-normal.woff2 new file mode 100644 index 0000000..01383d7 Binary files /dev/null and b/themes/intotheeast/fonts/dm-sans-latin-wght-normal.woff2 differ diff --git a/themes/intotheeast/fonts/dm-serif-display-latin-400-italic.woff b/themes/intotheeast/fonts/dm-serif-display-latin-400-italic.woff new file mode 100644 index 0000000..d0da12d Binary files /dev/null and b/themes/intotheeast/fonts/dm-serif-display-latin-400-italic.woff differ diff --git a/themes/intotheeast/fonts/dm-serif-display-latin-400-italic.woff2 b/themes/intotheeast/fonts/dm-serif-display-latin-400-italic.woff2 new file mode 100644 index 0000000..f03a1bd Binary files /dev/null and b/themes/intotheeast/fonts/dm-serif-display-latin-400-italic.woff2 differ diff --git a/themes/intotheeast/fonts/dm-serif-display-latin-400-normal.woff b/themes/intotheeast/fonts/dm-serif-display-latin-400-normal.woff new file mode 100644 index 0000000..ce93e74 Binary files /dev/null and b/themes/intotheeast/fonts/dm-serif-display-latin-400-normal.woff differ diff --git a/themes/intotheeast/fonts/dm-serif-display-latin-400-normal.woff2 b/themes/intotheeast/fonts/dm-serif-display-latin-400-normal.woff2 new file mode 100644 index 0000000..75c0a69 Binary files /dev/null and b/themes/intotheeast/fonts/dm-serif-display-latin-400-normal.woff2 differ diff --git a/themes/intotheeast/fonts/dm-serif-display-latin-ext-400-italic.woff b/themes/intotheeast/fonts/dm-serif-display-latin-ext-400-italic.woff new file mode 100644 index 0000000..027b2e6 Binary files /dev/null and b/themes/intotheeast/fonts/dm-serif-display-latin-ext-400-italic.woff differ diff --git a/themes/intotheeast/fonts/dm-serif-display-latin-ext-400-italic.woff2 b/themes/intotheeast/fonts/dm-serif-display-latin-ext-400-italic.woff2 new file mode 100644 index 0000000..dcc61a6 Binary files /dev/null and b/themes/intotheeast/fonts/dm-serif-display-latin-ext-400-italic.woff2 differ diff --git a/themes/intotheeast/fonts/dm-serif-display-latin-ext-400-normal.woff b/themes/intotheeast/fonts/dm-serif-display-latin-ext-400-normal.woff new file mode 100644 index 0000000..f5338d9 Binary files /dev/null and b/themes/intotheeast/fonts/dm-serif-display-latin-ext-400-normal.woff differ diff --git a/themes/intotheeast/fonts/dm-serif-display-latin-ext-400-normal.woff2 b/themes/intotheeast/fonts/dm-serif-display-latin-ext-400-normal.woff2 new file mode 100644 index 0000000..2a8ab4c Binary files /dev/null and b/themes/intotheeast/fonts/dm-serif-display-latin-ext-400-normal.woff2 differ diff --git a/themes/intotheeast/js/main.js b/themes/intotheeast/js/main.js index 8a04fd2..4a03e3d 100644 --- a/themes/intotheeast/js/main.js +++ b/themes/intotheeast/js/main.js @@ -1 +1,15 @@ -(()=>{})(); +(()=>{var xe=Object.create;var Gt=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var Ce=Object.getPrototypeOf,Ie=Object.prototype.hasOwnProperty;var Ee=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports);var Le=(o,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ae(t))!Ie.call(o,s)&&s!==e&&Gt(o,s,{get:()=>t[s],enumerable:!(i=Pe(t,s))||i.enumerable});return o};var ze=(o,t,e)=>(e=o!=null?xe(Ce(o)):{},Le(t||!o||!o.__esModule?Gt(e,"default",{value:o,enumerable:!0}):e,o));var pe=Ee((Zt,Ut)=>{(function(o,t){typeof Zt=="object"&&typeof Ut<"u"?Ut.exports=t():typeof define=="function"&&define.amd?define(t):(o=o||self,o.scrollama=t())})(Zt,function(){"use strict";function o(p,f=document){return typeof p=="string"?Array.from(f.querySelectorAll(p)):p instanceof Element?[p]:p instanceof NodeList?Array.from(p):p instanceof Array?p:[]}function t(p){let f=document.createElement("div");f.className=`scrollama__debug-step ${p}`,f.style.position="fixed",f.style.left="0",f.style.width="100%",f.style.zIndex="9999",f.style.borderTop="2px solid black",f.style.borderBottom="2px solid black";let g=document.createElement("p");return g.style.position="absolute",g.style.left="0",g.style.height="1px",g.style.width="100%",g.style.borderTop="1px dashed black",f.appendChild(g),document.body.appendChild(f),f}function e({id:p,step:f,marginTop:g}){let{index:x,height:L}=f,z=`scrollama__debug-step--${p}-${x}`,D=document.querySelector(`.${z}`);D||(D=t(z)),D.style.top=`${g*-1}px`,D.style.height=`${L}px`,D.querySelector("p").style.top=`${L/2}px`}function i(){let p="abcdefghijklmnopqrstuvwxyz",f=Date.now(),g=[];for(let x=0;x<6;x+=1){let L=p[Math.floor(Math.random()*p.length)];g.push(L)}return`${g.join("")}${f}`}function s(p){console.error(`scrollama error: ${p}`)}function n(p){return+p.getAttribute("data-scrollama-index")}function r(p,f){let g=Math.ceil(p/f),x=[],L=1/g;for(let z=0;z0){let f=+p.replace("px","");return isNaN(f)?(err("offset value must be in 'px' format. Fallback to 0.5."),{format:"percent",value:.5}):{format:"pixels",value:f}}else if(typeof p=="number"||!isNaN(+p))return p>1&&err("offset value is greater than 1. Fallback to 1."),p<0&&err("offset value is lower than 0. Fallback to 0."),{format:"percent",value:Math.min(Math.max(0,p),1)};return null}function l(p){p.forEach(f=>f.node.setAttribute("data-scrollama-index",f.index))}function h(p){let{top:f}=p.getBoundingClientRect(),g=window.pageYOffset,x=document.body.clientTop||0;return f+g-x}let d,u,m;function S(p){let f=p?p.scrollTop:window.pageYOffset;d!==f&&(d=f,d>u?m="down":dS(p))}function T(){let p={},f=i(),g=[],x,L,z,D=0,Q=!1,tt=!1,Rt=!1,Bt=!1,et=[];function Nt(){p={stepEnter:()=>{},stepExit:()=>{},stepProgress:()=>{}},et=[]}function G(c){c&&!Q&&st(),!c&&Q&&Wt(),Q=c}function it(c,v){let _=n(c),y=g[_];v!==void 0&&(y.progress=v);let P={element:c,index:_,progress:v,direction:m};y.state==="enter"&&p.stepProgress(P)}function fe(c,v=!0){let _=n(c),y=g[_],P={element:c,index:_,direction:m};y.direction=m,y.state="enter",et[_]||p.stepEnter(P),Bt&&(et[_]=!0)}function me(c,v=!0){let _=n(c),y=g[_];if(!y.state)return!1;let P={element:c,index:_,direction:m};tt&&(m==="down"&&y.progress<1?it(c,1):m==="up"&&y.progress>0&&it(c,0)),y.direction=m,y.state="exit",p.stepExit(P)}function ge([c]){let v=n(c.target),_=g[v],y=c.target.offsetHeight;y!==_.height&&(_.height=y,$t(_),qt(_),Ht(_))}function _e([c]){S(L);let{isIntersecting:v,target:_}=c;v?fe(_):me(_)}function ve([c]){let v=n(c.target),_=g[v],{isIntersecting:y,intersectionRatio:P,target:O}=c;y&&_.state==="enter"&&it(O,P)}function $t({observers:c}){Object.keys(c).map(v=>{c[v].disconnect()})}function Wt(){g.forEach($t)}function Ht(c){let v=new ResizeObserver(ge);v.observe(c.node),c.observers.resize=v}function ye(){g.forEach(Ht)}function qt(c){let v=window.innerHeight,_=c.offset||x,y=_.format==="pixels"?1:v,P=_.value*y,O=c.height/2-P,U=c.height/2-(v-P),k={rootMargin:`${O}px 0px ${U}px 0px`,threshold:.5,root:z},Vt=new IntersectionObserver(_e,k);Vt.observe(c.node),c.observers.step=Vt,Rt&&e({id:f,step:c,marginTop:O,marginBottom:U})}function we(){g.forEach(qt)}function be(c){let v=window.innerHeight,_=c.offset||x,y=_.format==="pixels"?1:v,P=_.value*y,O=-P+c.height,U=P-v,R=`${O}px 0px ${U}px 0px`,j=r(c.height,D),F={rootMargin:R,threshold:j},k=new IntersectionObserver(ve,F);k.observe(c.node),c.observers.progress=k}function Se(){g.forEach(be)}function st(){Wt(),ye(),we(),tt&&Se()}let w={};return w.setup=({step:c,parent:v,offset:_=.5,threshold:y=4,progress:P=!1,once:O=!1,debug:U=!1,container:R=void 0,root:j=null})=>(E(R),g=o(c,v).map((F,k)=>({index:k,direction:void 0,height:F.offsetHeight,node:F,observers:{},offset:a(F.dataset.offset),top:h(F),progress:0,state:void 0})),g.length?(tt=P,Bt=O,Rt=U,D=Math.max(1,+y),x=a(_),L=R,z=j,Nt(),l(g),G(!0),w):(s("no step elements"),w)),w.enable=()=>(G(!0),w),w.disable=()=>(G(!1),w),w.destroy=()=>(G(!1),Nt(),w),w.resize=()=>(st(),w),w.offset=c=>c==null?x.value:(x=a(c),st(),w),w.onStepEnter=c=>(typeof c=="function"?p.stepEnter=c:s("onStepEnter requires a function"),w),w.onStepExit=c=>(typeof c=="function"?p.stepExit=c:s("onStepExit requires a function"),w),w.onStepProgress=c=>(typeof c=="function"?p.stepProgress=c:s("onStepProgress requires a function"),w),w}return T})});function B(o,t,e){let i=document.createElement(t);return o&&(i.className=o),e&&e.appendChild(i),i}function Te(o,t,e){let i=`translate3d(${o}px,${t||0}px,0)`;return e!==void 0&&(i+=` scale3d(${e},${e},1)`),i}function nt(o,t,e){o.style.width=typeof t=="number"?`${t}px`:t,o.style.height=typeof e=="number"?`${e}px`:e}var C={IDLE:"idle",LOADING:"loading",LOADED:"loaded",ERROR:"error"};function De(o){return"button"in o&&o.button===1||o.ctrlKey||o.metaKey||o.altKey||o.shiftKey}function N(o,t,e=document){let i=[];if(o instanceof Element)i=[o];else if(o instanceof NodeList||Array.isArray(o))i=Array.from(o);else{let s=typeof o=="string"?o:t;s&&(i=Array.from(e.querySelectorAll(s)))}return i}function Oe(o){return typeof o=="function"&&o.prototype&&o.prototype.goTo}function jt(){return!!(navigator.vendor&&navigator.vendor.match(/apple/i))}var ot=class{constructor(t,e){this.type=t,this.defaultPrevented=!1,e&&Object.assign(this,e)}preventDefault(){this.defaultPrevented=!0}},rt=class{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(t,e,i=100){var s,n,r;this._filters[t]||(this._filters[t]=[]),(s=this._filters[t])===null||s===void 0||s.push({fn:e,priority:i}),(n=this._filters[t])===null||n===void 0||n.sort((a,l)=>a.priority-l.priority),(r=this.pswp)===null||r===void 0||r.addFilter(t,e,i)}removeFilter(t,e){this._filters[t]&&(this._filters[t]=this._filters[t].filter(i=>i.fn!==e)),this.pswp&&this.pswp.removeFilter(t,e)}applyFilters(t,...e){var i;return(i=this._filters[t])===null||i===void 0||i.forEach(s=>{e[0]=s.fn.apply(this,e)}),e[0]}on(t,e){var i,s;this._listeners[t]||(this._listeners[t]=[]),(i=this._listeners[t])===null||i===void 0||i.push(e),(s=this.pswp)===null||s===void 0||s.on(t,e)}off(t,e){var i;this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter(s=>e!==s)),(i=this.pswp)===null||i===void 0||i.off(t,e)}dispatch(t,e){var i;if(this.pswp)return this.pswp.dispatch(t,e);let s=new ot(t,e);return(i=this._listeners[t])===null||i===void 0||i.forEach(n=>{n.call(this,s)}),s}},at=class{constructor(t,e){if(this.element=B("pswp__img pswp__img--placeholder",t?"img":"div",e),t){let i=this.element;i.decoding="async",i.alt="",i.src=t,i.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(t,e){this.element&&(this.element.tagName==="IMG"?(nt(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=Te(0,0,t/250)):nt(this.element,t,e))}destroy(){var t;(t=this.element)!==null&&t!==void 0&&t.parentNode&&this.element.remove(),this.element=null}},lt=class{constructor(t,e,i){this.instance=e,this.data=t,this.index=i,this.element=void 0,this.placeholder=void 0,this.slide=void 0,this.displayedImageWidth=0,this.displayedImageHeight=0,this.width=Number(this.data.w)||Number(this.data.width)||0,this.height=Number(this.data.h)||Number(this.data.height)||0,this.isAttached=!1,this.hasSlide=!1,this.isDecoding=!1,this.state=C.IDLE,this.data.type?this.type=this.data.type:this.data.src?this.type="image":this.type="html",this.instance.dispatch("contentInit",{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout(()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0)},1e3)}load(t,e){if(this.slide&&this.usePlaceholder())if(this.placeholder){let i=this.placeholder.element;i&&!i.parentElement&&this.slide.container.prepend(i)}else{let i=this.instance.applyFilters("placeholderSrc",this.data.msrc&&this.slide.isFirstSlide?this.data.msrc:!1,this);this.placeholder=new at(i,this.slide.container)}this.element&&!e||this.instance.dispatch("contentLoad",{content:this,isLazy:t}).defaultPrevented||(this.isImageContent()?(this.element=B("pswp__img","img"),this.displayedImageWidth&&this.loadImage(t)):(this.element=B("pswp__content","div"),this.element.innerHTML=this.data.html||""),e&&this.slide&&this.slide.updateContentSize(!0))}loadImage(t){var e,i;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:t}).defaultPrevented)return;let s=this.element;this.updateSrcsetSizes(),this.data.srcset&&(s.srcset=this.data.srcset),s.src=(e=this.data.src)!==null&&e!==void 0?e:"",s.alt=(i=this.data.alt)!==null&&i!==void 0?i:"",this.state=C.LOADING,s.complete?this.onLoaded():(s.onload=()=>{this.onLoaded()},s.onerror=()=>{this.onError()})}setSlide(t){this.slide=t,this.hasSlide=!0,this.instance=t.pswp}onLoaded(){this.state=C.LOADED,this.slide&&this.element&&(this.instance.dispatch("loadComplete",{slide:this.slide,content:this}),this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode&&(this.append(),this.slide.updateContentSize(!0)),(this.state===C.LOADED||this.state===C.ERROR)&&this.removePlaceholder())}onError(){this.state=C.ERROR,this.slide&&(this.displayError(),this.instance.dispatch("loadComplete",{slide:this.slide,isError:!0,content:this}),this.instance.dispatch("loadError",{slide:this.slide,content:this}))}isLoading(){return this.instance.applyFilters("isContentLoading",this.state===C.LOADING,this)}isError(){return this.state===C.ERROR}isImageContent(){return this.type==="image"}setDisplayedSize(t,e){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(t,e),!this.instance.dispatch("contentResize",{content:this,width:t,height:e}).defaultPrevented&&(nt(this.element,t,e),this.isImageContent()&&!this.isError()))){let i=!this.displayedImageWidth&&t;this.displayedImageWidth=t,this.displayedImageHeight=e,i?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:t,height:e,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==C.ERROR,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;let t=this.element,e=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!t.dataset.largestUsedSize||e>parseInt(t.dataset.largestUsedSize,10))&&(t.sizes=e+"px",t.dataset.largestUsedSize=String(e))}usePlaceholder(){return this.instance.applyFilters("useContentPlaceholder",this.isImageContent(),this)}lazyLoad(){this.instance.dispatch("contentLazyLoad",{content:this}).defaultPrevented||this.load(!0)}keepPlaceholder(){return this.instance.applyFilters("isKeepingPlaceholder",this.isLoading(),this)}destroy(){this.hasSlide=!1,this.slide=void 0,!this.instance.dispatch("contentDestroy",{content:this}).defaultPrevented&&(this.remove(),this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0),this.isImageContent()&&this.element&&(this.element.onload=null,this.element.onerror=null,this.element=void 0))}displayError(){if(this.slide){var t,e;let i=B("pswp__error-msg","div");i.innerText=(t=(e=this.instance.options)===null||e===void 0?void 0:e.errorMsg)!==null&&t!==void 0?t:"",i=this.instance.applyFilters("contentErrorElement",i,this),this.element=B("pswp__content pswp__error-msg-container","div"),this.element.appendChild(i),this.slide.container.innerText="",this.slide.container.appendChild(this.element),this.slide.updateContentSize(!0),this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;if(this.isAttached=!0,this.state===C.ERROR){this.displayError();return}if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;let t="decode"in this.element;this.isImageContent()?t&&this.slide&&(!this.slide.isActive||jt())?(this.isDecoding=!0,this.element.decode().catch(()=>{}).finally(()=>{this.isDecoding=!1,this.appendImage()})):this.appendImage():this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){this.instance.dispatch("contentActivate",{content:this}).defaultPrevented||!this.slide||(this.isImageContent()&&this.isDecoding&&!jt()?this.appendImage():this.isError()&&this.load(!1,!0),this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","false"))}deactivate(){this.instance.dispatch("contentDeactivate",{content:this}),this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","true")}remove(){this.isAttached=!1,!this.instance.dispatch("contentRemove",{content:this}).defaultPrevented&&(this.element&&this.element.parentNode&&this.element.remove(),this.placeholder&&this.placeholder.element&&this.placeholder.element.remove())}appendImage(){this.isAttached&&(this.instance.dispatch("contentAppendImage",{content:this}).defaultPrevented||(this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element),(this.state===C.LOADED||this.state===C.ERROR)&&this.removePlaceholder()))}};function Fe(o,t){if(o.getViewportSizeFn){let e=o.getViewportSizeFn(o,t);if(e)return e}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function K(o,t,e,i,s){let n=0;if(t.paddingFn)n=t.paddingFn(e,i,s)[o];else if(t.padding)n=t.padding[o];else{let r="padding"+o[0].toUpperCase()+o.slice(1);t[r]&&(n=t[r])}return Number(n)||0}function Me(o,t,e,i){return{x:t.x-K("left",o,t,e,i)-K("right",o,t,e,i),y:t.y-K("top",o,t,e,i)-K("bottom",o,t,e,i)}}var Kt=4e3,ht=class{constructor(t,e,i,s){this.pswp=s,this.options=t,this.itemData=e,this.index=i,this.panAreaSize=null,this.elementSize=null,this.fit=1,this.fill=1,this.vFill=1,this.initial=1,this.secondary=1,this.max=1,this.min=1}update(t,e,i){let s={x:t,y:e};this.elementSize=s,this.panAreaSize=i;let n=i.x/s.x,r=i.y/s.y;this.fit=Math.min(1,nr?n:r),this.vFill=Math.min(1,r),this.initial=this._getInitial(),this.secondary=this._getSecondary(),this.max=Math.max(this.initial,this.secondary,this._getMax()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}_parseZoomLevelOption(t){let e=t+"ZoomLevel",i=this.options[e];if(i)return typeof i=="function"?i(this):i==="fill"?this.fill:i==="fit"?this.fit:Number(i)}_getSecondary(){let t=this._parseZoomLevelOption("secondary");return t||(t=Math.min(1,this.fit*3),this.elementSize&&t*this.elementSize.x>Kt&&(t=Kt/this.elementSize.x),t)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,this.fit*4)}};function Xt(o,t,e){let i=t.createContentFromData(o,e),s,{options:n}=t;if(n){s=new ht(n,o,-1);let r;t.pswp?r=t.pswp.viewportSize:r=Fe(n,t);let a=Me(n,r,o,e);s.update(i.width,i.height,a)}return i.lazyLoad(),s&&i.setDisplayedSize(Math.ceil(i.width*s.initial),Math.ceil(i.height*s.initial)),i}function Ze(o,t){let e=t.getItemData(o);if(!t.dispatch("lazyLoadSlide",{index:o,itemData:e}).defaultPrevented)return Xt(e,t,o)}var ct=class extends rt{getNumItems(){var t;let e=0,i=(t=this.options)===null||t===void 0?void 0:t.dataSource;i&&"length"in i?e=i.length:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),i.items&&(e=i.items.length));let s=this.dispatch("numItems",{dataSource:i,numItems:e});return this.applyFilters("numItems",s.numItems,i)}createContentFromData(t,e){return new lt(t,this,e)}getItemData(t){var e;let i=(e=this.options)===null||e===void 0?void 0:e.dataSource,s={};Array.isArray(i)?s=i[t]:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),s=i.items[t]);let n=s;n instanceof Element&&(n=this._domElementToItemData(n));let r=this.dispatch("itemData",{itemData:n||{},index:t});return this.applyFilters("itemData",r.itemData,t)}_getGalleryDOMElements(t){var e,i;return(e=this.options)!==null&&e!==void 0&&e.children||(i=this.options)!==null&&i!==void 0&&i.childSelector?N(this.options.children,this.options.childSelector,t)||[]:[t]}_domElementToItemData(t){let e={element:t},i=t.tagName==="A"?t:t.querySelector("a");if(i){e.src=i.dataset.pswpSrc||i.href,i.dataset.pswpSrcset&&(e.srcset=i.dataset.pswpSrcset),e.width=i.dataset.pswpWidth?parseInt(i.dataset.pswpWidth,10):0,e.height=i.dataset.pswpHeight?parseInt(i.dataset.pswpHeight,10):0,e.w=e.width,e.h=e.height,i.dataset.pswpType&&(e.type=i.dataset.pswpType);let n=t.querySelector("img");if(n){var s;e.msrc=n.currentSrc||n.src,e.alt=(s=n.getAttribute("alt"))!==null&&s!==void 0?s:""}(i.dataset.pswpCropped||i.dataset.cropped)&&(e.thumbCropped=!0)}return this.applyFilters("domItemData",e,t,i)}lazyLoadData(t,e){return Xt(t,this,e)}},X=class extends ct{constructor(t){super(),this.options=t||{},this._uid=0,this.shouldOpen=!1,this._preloadedContent=void 0,this.onThumbnailsClick=this.onThumbnailsClick.bind(this)}init(){N(this.options.gallery,this.options.gallerySelector).forEach(t=>{t.addEventListener("click",this.onThumbnailsClick,!1)})}onThumbnailsClick(t){if(De(t)||window.pswp)return;let e={x:t.clientX,y:t.clientY};!e.x&&!e.y&&(e=null);let i=this.getClickedIndex(t);i=this.applyFilters("clickedIndex",i,t,this);let s={gallery:t.currentTarget};i>=0&&(t.preventDefault(),this.loadAndOpen(i,s,e))}getClickedIndex(t){if(this.options.getClickedIndexFn)return this.options.getClickedIndexFn.call(this,t);let e=t.target,s=N(this.options.children,this.options.childSelector,t.currentTarget).findIndex(n=>n===e||n.contains(e));return s!==-1?s:this.options.children||this.options.childSelector?-1:0}loadAndOpen(t,e,i){if(window.pswp||!this.options)return!1;if(!e&&this.options.gallery&&this.options.children){let s=N(this.options.gallery);s[0]&&(e={gallery:s[0]})}return this.options.index=t,this.options.initialPointerPos=i,this.shouldOpen=!0,this.preload(t,e),!0}preload(t,e){let{options:i}=this;e&&(i.dataSource=e);let s=[],n=typeof i.pswpModule;if(Oe(i.pswpModule))s.push(Promise.resolve(i.pswpModule));else{if(n==="string")throw new Error("pswpModule as string is no longer supported");if(n==="function")s.push(i.pswpModule());else throw new Error("pswpModule is not valid")}typeof i.openPromise=="function"&&s.push(i.openPromise()),i.preloadFirstSlide!==!1&&t>=0&&(this._preloadedContent=Ze(t,this));let r=++this._uid;Promise.all(s).then(a=>{if(this.shouldOpen){let l=a[0];this._openPhotoswipe(l,r)}})}_openPhotoswipe(t,e){if(e!==this._uid&&this.shouldOpen||(this.shouldOpen=!1,window.pswp))return;let i=typeof t=="object"?new t.default(this.options):new t(this.options);this.pswp=i,window.pswp=i,Object.keys(this._listeners).forEach(s=>{var n;(n=this._listeners[s])===null||n===void 0||n.forEach(r=>{i.on(s,r)})}),Object.keys(this._filters).forEach(s=>{var n;(n=this._filters[s])===null||n===void 0||n.forEach(r=>{i.addFilter(s,r.fn,r.priority)})}),this._preloadedContent&&(i.contentLoader.addToCache(this._preloadedContent),this._preloadedContent=void 0),i.on("destroy",()=>{this.pswp=void 0,delete window.pswp}),i.init()}destroy(){var t;(t=this.pswp)===null||t===void 0||t.destroy(),this.shouldOpen=!1,this._listeners={},N(this.options.gallery,this.options.gallerySelector).forEach(e=>{e.removeEventListener("click",this.onThumbnailsClick,!1)})}};function A(o,t,e){let i=document.createElement(t);return o&&(i.className=o),e&&e.appendChild(i),i}function b(o,t){return o.x=t.x,o.y=t.y,t.id!==void 0&&(o.id=t.id),o}function ne(o){o.x=Math.round(o.x),o.y=Math.round(o.y)}function pt(o,t){let e=Math.abs(o.x-t.x),i=Math.abs(o.y-t.y);return Math.sqrt(e*e+i*i)}function H(o,t){return o.x===t.x&&o.y===t.y}function V(o,t,e){return Math.min(Math.max(o,t),e)}function q(o,t,e){let i=`translate3d(${o}px,${t||0}px,0)`;return e!==void 0&&(i+=` scale3d(${e},${e},1)`),i}function Z(o,t,e,i){o.style.transform=q(t,e,i)}var Ue="cubic-bezier(.4,0,.22,1)";function oe(o,t,e,i){o.style.transition=t?`${t} ${e}ms ${i||Ue}`:"none"}function dt(o,t,e){o.style.width=typeof t=="number"?`${t}px`:t,o.style.height=typeof e=="number"?`${e}px`:e}function ke(o){oe(o)}function Re(o){return"decode"in o?o.decode().catch(()=>{}):o.complete?Promise.resolve(o):new Promise((t,e)=>{o.onload=()=>t(o),o.onerror=e})}var I={IDLE:"idle",LOADING:"loading",LOADED:"loaded",ERROR:"error"};function Be(o){return"button"in o&&o.button===1||o.ctrlKey||o.metaKey||o.altKey||o.shiftKey}function Ne(o,t,e=document){let i=[];if(o instanceof Element)i=[o];else if(o instanceof NodeList||Array.isArray(o))i=Array.from(o);else{let s=typeof o=="string"?o:t;s&&(i=Array.from(e.querySelectorAll(s)))}return i}function Yt(){return!!(navigator.vendor&&navigator.vendor.match(/apple/i))}var re=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>{re=!0}}))}catch{}var ut=class{constructor(){this._pool=[]}add(t,e,i,s){this._toggleListener(t,e,i,s)}remove(t,e,i,s){this._toggleListener(t,e,i,s,!0)}removeAll(){this._pool.forEach(t=>{this._toggleListener(t.target,t.type,t.listener,t.passive,!0,!0)}),this._pool=[]}_toggleListener(t,e,i,s,n,r){if(!t)return;let a=n?"removeEventListener":"addEventListener";e.split(" ").forEach(h=>{if(h){r||(n?this._pool=this._pool.filter(u=>u.type!==h||u.listener!==i||u.target!==t):this._pool.push({target:t,type:h,listener:i,passive:s}));let d=re?{passive:s||!1}:!1;t[a](h,i,d)}})}};function ae(o,t){if(o.getViewportSizeFn){let e=o.getViewportSizeFn(o,t);if(e)return e}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function W(o,t,e,i,s){let n=0;if(t.paddingFn)n=t.paddingFn(e,i,s)[o];else if(t.padding)n=t.padding[o];else{let r="padding"+o[0].toUpperCase()+o.slice(1);t[r]&&(n=t[r])}return Number(n)||0}function le(o,t,e,i){return{x:t.x-W("left",o,t,e,i)-W("right",o,t,e,i),y:t.y-W("top",o,t,e,i)-W("bottom",o,t,e,i)}}var ft=class{constructor(t){this.slide=t,this.currZoomLevel=1,this.center={x:0,y:0},this.max={x:0,y:0},this.min={x:0,y:0}}update(t){this.currZoomLevel=t,this.slide.width?(this._updateAxis("x"),this._updateAxis("y"),this.slide.pswp.dispatch("calcBounds",{slide:this.slide})):this.reset()}_updateAxis(t){let{pswp:e}=this.slide,i=this.slide[t==="x"?"width":"height"]*this.currZoomLevel,n=W(t==="x"?"left":"top",e.options,e.viewportSize,this.slide.data,this.slide.index),r=this.slide.panAreaSize[t];this.center[t]=Math.round((r-i)/2)+n,this.max[t]=i>r?Math.round(r-i)+n:this.center[t],this.min[t]=i>r?n: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,e){return V(e,this.max[t],this.min[t])}},Jt=4e3,Y=class{constructor(t,e,i,s){this.pswp=s,this.options=t,this.itemData=e,this.index=i,this.panAreaSize=null,this.elementSize=null,this.fit=1,this.fill=1,this.vFill=1,this.initial=1,this.secondary=1,this.max=1,this.min=1}update(t,e,i){let s={x:t,y:e};this.elementSize=s,this.panAreaSize=i;let n=i.x/s.x,r=i.y/s.y;this.fit=Math.min(1,nr?n:r),this.vFill=Math.min(1,r),this.initial=this._getInitial(),this.secondary=this._getSecondary(),this.max=Math.max(this.initial,this.secondary,this._getMax()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}_parseZoomLevelOption(t){let e=t+"ZoomLevel",i=this.options[e];if(i)return typeof i=="function"?i(this):i==="fill"?this.fill:i==="fit"?this.fit:Number(i)}_getSecondary(){let t=this._parseZoomLevelOption("secondary");return t||(t=Math.min(1,this.fit*3),this.elementSize&&t*this.elementSize.x>Jt&&(t=Jt/this.elementSize.x),t)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,this.fit*4)}},mt=class{constructor(t,e,i){this.data=t,this.index=e,this.pswp=i,this.isActive=e===i.currIndex,this.currentResolution=0,this.panAreaSize={x:0,y:0},this.pan={x:0,y:0},this.isFirstSlide=this.isActive&&!i.opener.isOpen,this.zoomLevels=new Y(i.options,t,e,i),this.pswp.dispatch("gettingData",{slide:this,data:this.data,index:e}),this.content=this.pswp.contentLoader.getContentBySlide(this),this.container=A("pswp__zoom-wrap","div"),this.holderElement=null,this.currZoomLevel=1,this.width=this.content.width,this.height=this.content.height,this.heavyAppended=!1,this.bounds=new ft(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(t){this.holderElement=t,this.container.style.transformOrigin="0 0",this.data&&(this.calculateSize(),this.load(),this.updateContentSize(),this.appendHeavy(),this.holderElement.appendChild(this.container),this.zoomAndPanToInitial(),this.pswp.dispatch("firstZoomPan",{slide:this}),this.applyCurrentZoomPan(),this.pswp.dispatch("afterSetContent",{slide:this}),this.isActive&&this.activate())}load(){this.content.load(!1),this.pswp.dispatch("slideLoad",{slide:this})}appendHeavy(){let{pswp:t}=this;this.heavyAppended||!t.opener.isOpen||t.mainScroll.isShifted()||!this.isActive&&!!0||this.pswp.dispatch("appendHeavy",{slide:this}).defaultPrevented||(this.heavyAppended=!0,this.content.append(),this.pswp.dispatch("appendHeavyContent",{slide:this}))}activate(){this.isActive=!0,this.appendHeavy(),this.content.activate(),this.pswp.dispatch("slideActivate",{slide:this})}deactivate(){this.isActive=!1,this.content.deactivate(),this.currZoomLevel!==this.zoomLevels.initial&&this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize(),this.pswp.dispatch("slideDeactivate",{slide:this})}destroy(){this.content.hasSlide=!1,this.content.remove(),this.container.remove(),this.pswp.dispatch("slideDestroy",{slide:this})}resize(){this.currZoomLevel===this.zoomLevels.initial||!this.isActive?(this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize()):(this.calculateSize(),this.bounds.update(this.currZoomLevel),this.panTo(this.pan.x,this.pan.y))}updateContentSize(t){let e=this.currentResolution||this.zoomLevels.initial;if(!e)return;let i=Math.round(this.width*e)||this.pswp.viewportSize.x,s=Math.round(this.height*e)||this.pswp.viewportSize.y;!this.sizeChanged(i,s)&&!t||this.content.setDisplayedSize(i,s)}sizeChanged(t,e){return t!==this.prevDisplayedWidth||e!==this.prevDisplayedHeight?(this.prevDisplayedWidth=t,this.prevDisplayedHeight=e,!0):!1}getPlaceholderElement(){var t;return(t=this.content.placeholder)===null||t===void 0?void 0:t.element}zoomTo(t,e,i,s){let{pswp:n}=this;if(!this.isZoomable()||n.mainScroll.isShifted())return;n.dispatch("beforeZoomTo",{destZoomLevel:t,centerPoint:e,transitionDuration:i}),n.animations.stopAllPan();let r=this.currZoomLevel;s||(t=V(t,this.zoomLevels.min,this.zoomLevels.max)),this.setZoomLevel(t),this.pan.x=this.calculateZoomToPanOffset("x",e,r),this.pan.y=this.calculateZoomToPanOffset("y",e,r),ne(this.pan);let a=()=>{this._setResolution(t),this.applyCurrentZoomPan()};i?n.animations.startTransition({isPan:!0,name:"zoomTo",target:this.container,transform:this.getCurrentTransform(),onComplete:a,duration:i,easing:n.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,e,i){if(this.bounds.max[t]-this.bounds.min[t]===0)return this.bounds.center[t];e||(e=this.pswp.getViewportCenterPoint()),i||(i=this.zoomLevels.initial);let n=this.currZoomLevel/i;return this.bounds.correctPan(t,(this.pan[t]-e[t])*n+e[t])}panTo(t,e){this.pan.x=this.bounds.correctPan("x",t),this.pan.y=this.bounds.correctPan("y",e),this.applyCurrentZoomPan()}isPannable(){return!!this.width&&this.currZoomLevel>this.zoomLevels.fit}isZoomable(){return!!this.width&&this.content.isZoomable()}applyCurrentZoomPan(){this._applyZoomTransform(this.pan.x,this.pan.y,this.currZoomLevel),this===this.pswp.currSlide&&this.pswp.dispatch("zoomPanUpdate",{slide:this})}zoomAndPanToInitial(){this.currZoomLevel=this.zoomLevels.initial,this.bounds.update(this.currZoomLevel),b(this.pan,this.bounds.center),this.pswp.dispatch("initialZoomPan",{slide:this})}_applyZoomTransform(t,e,i){i/=this.currentResolution||this.zoomLevels.initial,Z(this.container,t,e,i)}calculateSize(){let{pswp:t}=this;b(this.panAreaSize,le(t.options,t.viewportSize,this.data,this.index)),this.zoomLevels.update(this.width,this.height,this.panAreaSize),t.dispatch("calcSlideSize",{slide:this})}getCurrentTransform(){let t=this.currZoomLevel/(this.currentResolution||this.zoomLevels.initial);return q(this.pan.x,this.pan.y,t)}_setResolution(t){t!==this.currentResolution&&(this.currentResolution=t,this.updateContentSize(),this.pswp.dispatch("resolutionChanged"))}},$e=.35,We=.6,Qt=.4,te=.5;function He(o,t){return o*t/(1-t)}var gt=class{constructor(t){this.gestures=t,this.pswp=t.pswp,this.startPan={x:0,y:0}}start(){this.pswp.currSlide&&b(this.startPan,this.pswp.currSlide.pan),this.pswp.animations.stopAll()}change(){let{p1:t,prevP1:e,dragAxis:i}=this.gestures,{currSlide:s}=this.pswp;if(i==="y"&&this.pswp.options.closeOnVerticalDrag&&s&&s.currZoomLevel<=s.zoomLevels.fit&&!this.gestures.isMultitouch){let n=s.pan.y+(t.y-e.y);if(!this.pswp.dispatch("verticalDrag",{panY:n}).defaultPrevented){this._setPanWithFriction("y",n,We);let r=1-Math.abs(this._getVerticalDragRatio(s.pan.y));this.pswp.applyBgOpacity(r),s.applyCurrentZoomPan()}}else this._panOrMoveMainScroll("x")||(this._panOrMoveMainScroll("y"),s&&(ne(s.pan),s.applyCurrentZoomPan()))}end(){let{velocity:t}=this.gestures,{mainScroll:e,currSlide:i}=this.pswp,s=0;if(this.pswp.animations.stopAll(),e.isShifted()){let r=(e.x-e.getCurrSlideX())/this.pswp.viewportSize.x;t.x<-te&&r<0||t.x<.1&&r<-.5?(s=1,t.x=Math.min(t.x,0)):(t.x>te&&r>0||t.x>-.1&&r>.5)&&(s=-1,t.x=Math.max(t.x,0)),e.moveIndexBy(s,!0,t.x)}i&&i.currZoomLevel>i.zoomLevels.max||this.gestures.isMultitouch?this.gestures.zoomLevels.correctZoomPan(!0):(this._finishPanGestureForAxis("x"),this._finishPanGestureForAxis("y"))}_finishPanGestureForAxis(t){let{velocity:e}=this.gestures,{currSlide:i}=this.pswp;if(!i)return;let{pan:s,bounds:n}=i,r=s[t],a=this.pswp.bgOpacity<1&&t==="y",h=r+He(e[t],.995);if(a){let E=this._getVerticalDragRatio(r),T=this._getVerticalDragRatio(h);if(E<0&&T<-Qt||E>0&&T>Qt){this.pswp.close();return}}let d=n.correctPan(t,h);if(r===d)return;let u=d===h?1:.82,m=this.pswp.bgOpacity,S=d-r;this.pswp.animations.startSpring({name:"panGesture"+t,isPan:!0,start:r,end:d,velocity:e[t],dampingRatio:u,onUpdate:E=>{if(a&&this.pswp.bgOpacity<1){let T=1-(d-E)/S;this.pswp.applyBgOpacity(V(m+(1-m)*T,0,1))}s[t]=Math.floor(E),i.applyCurrentZoomPan()}})}_panOrMoveMainScroll(t){let{p1:e,dragAxis:i,prevP1:s,isMultitouch:n}=this.gestures,{currSlide:r,mainScroll:a}=this.pswp,l=e[t]-s[t],h=a.x+l;if(!l||!r)return!1;if(t==="x"&&!r.isPannable()&&!n)return a.moveTo(h,!0),!0;let{bounds:d}=r,u=r.pan[t]+l;if(this.pswp.options.allowPanToNext&&i==="x"&&t==="x"&&!n){let m=a.getCurrSlideX(),S=a.x-m,E=l>0,T=!E;if(u>d.min[t]&&E){if(d.min[t]<=this.startPan[t])return a.moveTo(h,!0),!0;this._setPanWithFriction(t,u)}else if(u0)return a.moveTo(Math.max(h,m),!0),!0;if(S<0)return a.moveTo(Math.min(h,m),!0),!0}else this._setPanWithFriction(t,u)}else t==="y"?!a.isShifted()&&d.min.y!==d.max.y&&this._setPanWithFriction(t,u):this._setPanWithFriction(t,u);return!1}_getVerticalDragRatio(t){var e,i;return(t-((e=(i=this.pswp.currSlide)===null||i===void 0?void 0:i.bounds.center.y)!==null&&e!==void 0?e:0))/(this.pswp.viewportSize.y/3)}_setPanWithFriction(t,e,i){let{currSlide:s}=this.pswp;if(!s)return;let{pan:n,bounds:r}=s;if(r.correctPan(t,e)!==e||i){let l=Math.round(e-n[t]);n[t]+=l*(i||$e)}else n[t]=e}},qe=.05,Ve=.15;function ee(o,t,e){return o.x=(t.x+e.x)/2,o.y=(t.y+e.y)/2,o}var _t=class{constructor(t){this.gestures=t,this._startPan={x:0,y:0},this._startZoomPoint={x:0,y:0},this._zoomPoint={x:0,y:0},this._wasOverFitZoomLevel=!1,this._startZoomLevel=1}start(){let{currSlide:t}=this.gestures.pswp;t&&(this._startZoomLevel=t.currZoomLevel,b(this._startPan,t.pan)),this.gestures.pswp.animations.stopAllPan(),this._wasOverFitZoomLevel=!1}change(){let{p1:t,startP1:e,p2:i,startP2:s,pswp:n}=this.gestures,{currSlide:r}=n;if(!r)return;let a=r.zoomLevels.min,l=r.zoomLevels.max;if(!r.isZoomable()||n.mainScroll.isShifted())return;ee(this._startZoomPoint,e,s),ee(this._zoomPoint,t,i);let h=1/pt(e,s)*pt(t,i)*this._startZoomLevel;if(h>r.zoomLevels.initial+r.zoomLevels.initial/15&&(this._wasOverFitZoomLevel=!0),hl&&(h=l+(h-l)*qe);r.pan.x=this._calculatePanForZoomLevel("x",h),r.pan.y=this._calculatePanForZoomLevel("y",h),r.setZoomLevel(h),r.applyCurrentZoomPan()}end(){let{pswp:t}=this.gestures,{currSlide:e}=t;(!e||e.currZoomLeveli.zoomLevels.max?n=i.zoomLevels.max:(r=!1,n=s);let a=e.bgOpacity,l=e.bgOpacity<1,h=b({x:0,y:0},i.pan),d=b({x:0,y:0},h);t&&(this._zoomPoint.x=0,this._zoomPoint.y=0,this._startZoomPoint.x=0,this._startZoomPoint.y=0,this._startZoomLevel=s,b(this._startPan,h)),r&&(d={x:this._calculatePanForZoomLevel("x",n),y:this._calculatePanForZoomLevel("y",n)}),i.setZoomLevel(n),d={x:i.bounds.correctPan("x",d.x),y:i.bounds.correctPan("y",d.y)},i.setZoomLevel(s);let u=!H(d,h);if(!u&&!r&&!l){i._setResolution(n),i.applyCurrentZoomPan();return}e.animations.stopAllPan(),e.animations.startSpring({isPan:!0,start:0,end:1e3,velocity:0,dampingRatio:1,naturalFrequency:40,onUpdate:m=>{if(m/=1e3,u||r){if(u&&(i.pan.x=h.x+(d.x-h.x)*m,i.pan.y=h.y+(d.y-h.y)*m),r){let S=s+(n-s)*m;i.setZoomLevel(S)}i.applyCurrentZoomPan()}l&&e.bgOpacity<1&&e.applyBgOpacity(V(a+(1-a)*m,0,1))},onComplete:()=>{i._setResolution(n),i.applyCurrentZoomPan()}})}};function ie(o){return!!o.target.closest(".pswp__container")}var vt=class{constructor(t){this.gestures=t}click(t,e){let i=e.target.classList,s=i.contains("pswp__img"),n=i.contains("pswp__item")||i.contains("pswp__zoom-wrap");s?this._doClickOrTapAction("imageClick",t,e):n&&this._doClickOrTapAction("bgClick",t,e)}tap(t,e){ie(e)&&this._doClickOrTapAction("tap",t,e)}doubleTap(t,e){ie(e)&&this._doClickOrTapAction("doubleTap",t,e)}_doClickOrTapAction(t,e,i){var s;let{pswp:n}=this.gestures,{currSlide:r}=n,a=t+"Action",l=n.options[a];if(!n.dispatch(a,{point:e,originalEvent:i}).defaultPrevented){if(typeof l=="function"){l.call(n,e,i);return}switch(l){case"close":case"next":n[l]();break;case"zoom":r?.toggleZoom(e);break;case"zoom-or-close":r!=null&&r.isZoomable()&&r.zoomLevels.secondary!==r.zoomLevels.initial?r.toggleZoom(e):n.options.clickToCloseNonZoomable&&n.close();break;case"toggle-controls":(s=this.gestures.pswp.element)===null||s===void 0||s.classList.toggle("pswp--ui-visible");break}}}},Ge=10,je=300,Ke=25,yt=class{constructor(t){this.pswp=t,this.dragAxis=null,this.p1={x:0,y:0},this.p2={x:0,y:0},this.prevP1={x:0,y:0},this.prevP2={x:0,y:0},this.startP1={x:0,y:0},this.startP2={x:0,y:0},this.velocity={x:0,y:0},this._lastStartP1={x:0,y:0},this._intervalP1={x:0,y:0},this._numActivePoints=0,this._ongoingPointers=[],this._touchEventEnabled="ontouchstart"in window,this._pointerEventEnabled=!!window.PointerEvent,this.supportsTouch=this._touchEventEnabled||this._pointerEventEnabled&&navigator.maxTouchPoints>1,this._numActivePoints=0,this._intervalTime=0,this._velocityCalculated=!1,this.isMultitouch=!1,this.isDragging=!1,this.isZooming=!1,this.raf=null,this._tapTimer=null,this.supportsTouch||(t.options.allowPanToNext=!1),this.drag=new gt(this),this.zoomLevels=new _t(this),this.tapHandler=new vt(this),t.on("bindEvents",()=>{t.events.add(t.scrollWrap,"click",this._onClick.bind(this)),this._pointerEventEnabled?this._bindEvents("pointer","down","up","cancel"):this._touchEventEnabled?(this._bindEvents("touch","start","end","cancel"),t.scrollWrap&&(t.scrollWrap.ontouchmove=()=>{},t.scrollWrap.ontouchend=()=>{})):this._bindEvents("mouse","down","up")})}_bindEvents(t,e,i,s){let{pswp:n}=this,{events:r}=n,a=s?t+s:"";r.add(n.scrollWrap,t+e,this.onPointerDown.bind(this)),r.add(window,t+"move",this.onPointerMove.bind(this)),r.add(window,t+i,this.onPointerUp.bind(this)),a&&r.add(n.scrollWrap,a,this.onPointerUp.bind(this))}onPointerDown(t){let e=t.type==="mousedown"||t.pointerType==="mouse";if(e&&t.button>0)return;let{pswp:i}=this;if(!i.opener.isOpen){t.preventDefault();return}i.dispatch("pointerDown",{originalEvent:t}).defaultPrevented||(e&&(i.mouseDetected(),this._preventPointerEventBehaviour(t,"down")),i.animations.stopAll(),this._updatePoints(t,"down"),this._numActivePoints===1&&(this.dragAxis=null,b(this.startP1,this.p1)),this._numActivePoints>1?(this._clearTapTimer(),this.isMultitouch=!0):this.isMultitouch=!1)}onPointerMove(t){this._preventPointerEventBehaviour(t,"move"),this._numActivePoints&&(this._updatePoints(t,"move"),!this.pswp.dispatch("pointerMove",{originalEvent:t}).defaultPrevented&&(this._numActivePoints===1&&!this.isDragging?(this.dragAxis||this._calculateDragDirection(),this.dragAxis&&!this.isDragging&&(this.isZooming&&(this.isZooming=!1,this.zoomLevels.end()),this.isDragging=!0,this._clearTapTimer(),this._updateStartPoints(),this._intervalTime=Date.now(),this._velocityCalculated=!1,b(this._intervalP1,this.p1),this.velocity.x=0,this.velocity.y=0,this.drag.start(),this._rafStopLoop(),this._rafRenderLoop())):this._numActivePoints>1&&!this.isZooming&&(this._finishDrag(),this.isZooming=!0,this._updateStartPoints(),this.zoomLevels.start(),this._rafStopLoop(),this._rafRenderLoop())))}_finishDrag(){this.isDragging&&(this.isDragging=!1,this._velocityCalculated||this._updateVelocity(!0),this.drag.end(),this.dragAxis=null)}onPointerUp(t){this._numActivePoints&&(this._updatePoints(t,"up"),!this.pswp.dispatch("pointerUp",{originalEvent:t}).defaultPrevented&&(this._numActivePoints===0&&(this._rafStopLoop(),this.isDragging?this._finishDrag():!this.isZooming&&!this.isMultitouch&&this._finishTap(t)),this._numActivePoints<2&&this.isZooming&&(this.isZooming=!1,this.zoomLevels.end(),this._numActivePoints===1&&(this.dragAxis=null,this._updateStartPoints()))))}_rafRenderLoop(){(this.isDragging||this.isZooming)&&(this._updateVelocity(),this.isDragging?H(this.p1,this.prevP1)||this.drag.change():(!H(this.p1,this.prevP1)||!H(this.p2,this.prevP2))&&this.zoomLevels.change(),this._updatePrevPoints(),this.raf=requestAnimationFrame(this._rafRenderLoop.bind(this)))}_updateVelocity(t){let e=Date.now(),i=e-this._intervalTime;i<50&&!t||(this.velocity.x=this._getVelocity("x",i),this.velocity.y=this._getVelocity("y",i),this._intervalTime=e,b(this._intervalP1,this.p1),this._velocityCalculated=!0)}_finishTap(t){let{mainScroll:e}=this.pswp;if(e.isShifted()){e.moveIndexBy(0,!0);return}if(t.type.indexOf("cancel")>0)return;if(t.type==="mouseup"||t.pointerType==="mouse"){this.tapHandler.click(this.startP1,t);return}let i=this.pswp.options.doubleTapAction?je:0;this._tapTimer?(this._clearTapTimer(),pt(this._lastStartP1,this.startP1){this.tapHandler.tap(this.startP1,t),this._clearTapTimer()},i))}_clearTapTimer(){this._tapTimer&&(clearTimeout(this._tapTimer),this._tapTimer=null)}_getVelocity(t,e){let i=this.p1[t]-this._intervalP1[t];return Math.abs(i)>1&&e>5?i/e:0}_rafStopLoop(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null)}_preventPointerEventBehaviour(t,e){this.pswp.applyFilters("preventPointerEvent",!0,t,e)&&t.preventDefault()}_updatePoints(t,e){if(this._pointerEventEnabled){let i=t,s=this._ongoingPointers.findIndex(n=>n.id===i.pointerId);e==="up"&&s>-1?this._ongoingPointers.splice(s,1):e==="down"&&s===-1?this._ongoingPointers.push(this._convertEventPosToPoint(i,{x:0,y:0})):s>-1&&this._convertEventPosToPoint(i,this._ongoingPointers[s]),this._numActivePoints=this._ongoingPointers.length,this._numActivePoints>0&&b(this.p1,this._ongoingPointers[0]),this._numActivePoints>1&&b(this.p2,this._ongoingPointers[1])}else{let i=t;this._numActivePoints=0,i.type.indexOf("touch")>-1?i.touches&&i.touches.length>0&&(this._convertEventPosToPoint(i.touches[0],this.p1),this._numActivePoints++,i.touches.length>1&&(this._convertEventPosToPoint(i.touches[1],this.p2),this._numActivePoints++)):(this._convertEventPosToPoint(t,this.p1),e==="up"?this._numActivePoints=0:this._numActivePoints++)}}_updatePrevPoints(){b(this.prevP1,this.p1),b(this.prevP2,this.p2)}_updateStartPoints(){b(this.startP1,this.p1),b(this.startP2,this.p2),this._updatePrevPoints()}_calculateDragDirection(){if(this.pswp.mainScroll.isShifted())this.dragAxis="x";else{let t=Math.abs(this.p1.x-this.startP1.x)-Math.abs(this.p1.y-this.startP1.y);if(t!==0){let e=t>0?"x":"y";Math.abs(this.p1[e]-this.startP1[e])>=Ge&&(this.dragAxis=e)}}}_convertEventPosToPoint(t,e){return e.x=t.pageX-this.pswp.offset.x,e.y=t.pageY-this.pswp.offset.y,"pointerId"in t?e.id=t.pointerId:t.identifier!==void 0&&(e.id=t.identifier),e}_onClick(t){this.pswp.mainScroll.isShifted()&&(t.preventDefault(),t.stopPropagation())}},Xe=.35,wt=class{constructor(t){this.pswp=t,this.x=0,this.slideWidth=0,this._currPositionIndex=0,this._prevPositionIndex=0,this._containerShiftIndex=-1,this.itemHolders=[]}resize(t){let{pswp:e}=this,i=Math.round(e.viewportSize.x+e.viewportSize.x*e.options.spacing),s=i!==this.slideWidth;s&&(this.slideWidth=i,this.moveTo(this.getCurrSlideX())),this.itemHolders.forEach((n,r)=>{s&&Z(n.el,(r+this._containerShiftIndex)*this.slideWidth),t&&n.slide&&n.slide.resize()})}resetPosition(){this._currPositionIndex=0,this._prevPositionIndex=0,this.slideWidth=0,this._containerShiftIndex=-1}appendHolders(){this.itemHolders=[];for(let t=0;t<3;t++){let e=A("pswp__item","div",this.pswp.container);e.setAttribute("role","group"),e.setAttribute("aria-roledescription","slide"),e.setAttribute("aria-hidden","true"),e.style.display=t===1?"block":"none",this.itemHolders.push({el:e})}}canBeSwiped(){return this.pswp.getNumItems()>1}moveIndexBy(t,e,i){let{pswp:s}=this,n=s.potentialIndex+t,r=s.getNumItems();if(s.canLoop()){n=s.getLoopedIndex(n);let l=(t+r)%r;l<=r/2?t=l:t=l-r}else n<0?n=0:n>=r&&(n=r-1),t=n-s.potentialIndex;s.potentialIndex=n,this._currPositionIndex-=t,s.animations.stopMainScroll();let a=this.getCurrSlideX();if(!e)this.moveTo(a),this.updateCurrItem();else{s.animations.startSpring({isMainScroll:!0,start:this.x,end:a,velocity:i||0,naturalFrequency:30,dampingRatio:1,onUpdate:h=>{this.moveTo(h)},onComplete:()=>{this.updateCurrItem(),s.appendHeavy()}});let l=s.potentialIndex-s.currIndex;if(s.canLoop()){let h=(l+r)%r;h<=r/2?l=h:l=h-r}Math.abs(l)>1&&this.updateCurrItem()}return!!t}getCurrSlideX(){return this.slideWidth*this._currPositionIndex}isShifted(){return this.x!==this.getCurrSlideX()}updateCurrItem(){var t;let{pswp:e}=this,i=this._prevPositionIndex-this._currPositionIndex;if(!i)return;this._prevPositionIndex=this._currPositionIndex,e.currIndex=e.potentialIndex;let s=Math.abs(i),n;s>=3&&(this._containerShiftIndex+=i+(i>0?-3:3),s=3,this.itemHolders.forEach(r=>{var a;(a=r.slide)===null||a===void 0||a.destroy(),r.slide=void 0}));for(let r=0;r0?(n=this.itemHolders.shift(),n&&(this.itemHolders[2]=n,this._containerShiftIndex++,Z(n.el,(this._containerShiftIndex+2)*this.slideWidth),e.setContent(n,e.currIndex-s+r+2))):(n=this.itemHolders.pop(),n&&(this.itemHolders.unshift(n),this._containerShiftIndex--,Z(n.el,this._containerShiftIndex*this.slideWidth),e.setContent(n,e.currIndex+s-r-2)));Math.abs(this._containerShiftIndex)>50&&!this.isShifted()&&(this.resetPosition(),this.resize()),e.animations.stopAllPan(),this.itemHolders.forEach((r,a)=>{r.slide&&r.slide.setIsActive(a===1)}),e.currSlide=(t=this.itemHolders[1])===null||t===void 0?void 0:t.slide,e.contentLoader.updateLazy(i),e.currSlide&&e.currSlide.applyCurrentZoomPan(),e.dispatch("change")}moveTo(t,e){if(!this.pswp.canLoop()&&e){let i=(this.slideWidth*this._currPositionIndex-t)/this.slideWidth;i+=this.pswp.currIndex;let s=Math.round(t-this.x);(i<0&&s>0||i>=this.pswp.getNumItems()-1&&s<0)&&(t=this.x+s*Xe)}this.x=t,this.pswp.container&&Z(this.pswp.container,t),this.pswp.dispatch("moveMainScroll",{x:t,dragging:e??!1})}},Ye={Escape:27,z:90,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Tab:9},M=(o,t)=>t?o:Ye[o],bt=class{constructor(t){this.pswp=t,this._wasFocused=!1,t.on("bindEvents",()=>{t.options.trapFocus&&(t.options.initialPointerPos||this._focusRoot(),t.events.add(document,"focusin",this._onFocusIn.bind(this))),t.events.add(document,"keydown",this._onKeyDown.bind(this))});let e=document.activeElement;t.on("destroy",()=>{t.options.returnFocus&&e&&this._wasFocused&&e.focus()})}_focusRoot(){!this._wasFocused&&this.pswp.element&&(this.pswp.element.focus(),this._wasFocused=!0)}_onKeyDown(t){let{pswp:e}=this;if(e.dispatch("keydown",{originalEvent:t}).defaultPrevented||Be(t))return;let i,s,n=!1,r="key"in t;switch(r?t.key:t.keyCode){case M("Escape",r):e.options.escKey&&(i="close");break;case M("z",r):i="toggleZoom";break;case M("ArrowLeft",r):s="x";break;case M("ArrowUp",r):s="y";break;case M("ArrowRight",r):s="x",n=!0;break;case M("ArrowDown",r):n=!0,s="y";break;case M("Tab",r):this._focusRoot();break}if(s){t.preventDefault();let{currSlide:a}=e;e.options.arrowKeys&&s==="x"&&e.getNumItems()>1?i=n?"next":"prev":a&&a.currZoomLevel>a.zoomLevels.fit&&(a.pan[s]+=n?-80:80,a.panTo(a.pan.x,a.pan.y))}i&&(t.preventDefault(),e[i]())}_onFocusIn(t){let{template:e}=this.pswp;e&&document!==t.target&&e!==t.target&&!e.contains(t.target)&&e.focus()}},Je="cubic-bezier(.4,0,.22,1)",St=class{constructor(t){var e;this.props=t;let{target:i,onComplete:s,transform:n,onFinish:r=()=>{},duration:a=333,easing:l=Je}=t;this.onFinish=r;let h=n?"transform":"opacity",d=(e=t[h])!==null&&e!==void 0?e:"";this._target=i,this._onComplete=s,this._finished=!1,this._onTransitionEnd=this._onTransitionEnd.bind(this),this._helperTimeout=setTimeout(()=>{oe(i,h,a,l),this._helperTimeout=setTimeout(()=>{i.addEventListener("transitionend",this._onTransitionEnd,!1),i.addEventListener("transitioncancel",this._onTransitionEnd,!1),this._helperTimeout=setTimeout(()=>{this._finalizeAnimation()},a+500),i.style[h]=d},30)},0)}_onTransitionEnd(t){t.target===this._target&&this._finalizeAnimation()}_finalizeAnimation(){this._finished||(this._finished=!0,this.onFinish(),this._onComplete&&this._onComplete())}destroy(){this._helperTimeout&&clearTimeout(this._helperTimeout),ke(this._target),this._target.removeEventListener("transitionend",this._onTransitionEnd,!1),this._target.removeEventListener("transitioncancel",this._onTransitionEnd,!1),this._finished||this._finalizeAnimation()}},Qe=12,ti=.75,xt=class{constructor(t,e,i){this.velocity=t*1e3,this._dampingRatio=e||ti,this._naturalFrequency=i||Qe,this._dampedFrequency=this._naturalFrequency,this._dampingRatio<1&&(this._dampedFrequency*=Math.sqrt(1-this._dampingRatio*this._dampingRatio))}easeFrame(t,e){let i=0,s;e/=1e3;let n=Math.E**(-this._dampingRatio*this._naturalFrequency*e);if(this._dampingRatio===1)s=this.velocity+this._naturalFrequency*t,i=(t+s*e)*n,this.velocity=i*-this._naturalFrequency+s*n;else if(this._dampingRatio<1){s=1/this._dampedFrequency*(this._dampingRatio*this._naturalFrequency*t+this.velocity);let r=Math.cos(this._dampedFrequency*e),a=Math.sin(this._dampedFrequency*e);i=n*(t*r+s*a),this.velocity=i*-this._naturalFrequency*this._dampingRatio+n*(-this._dampedFrequency*t*a+this._dampedFrequency*s*r)}return i}},Pt=class{constructor(t){this.props=t,this._raf=0;let{start:e,end:i,velocity:s,onUpdate:n,onComplete:r,onFinish:a=()=>{},dampingRatio:l,naturalFrequency:h}=t;this.onFinish=a;let d=new xt(s,l,h),u=Date.now(),m=e-i,S=()=>{this._raf&&(m=d.easeFrame(m,Date.now()-u),Math.abs(m)<1&&Math.abs(d.velocity)<50?(n(i),r&&r(),this.onFinish()):(u=Date.now(),n(m+i),this._raf=requestAnimationFrame(S)))};this._raf=requestAnimationFrame(S)}destroy(){this._raf>=0&&cancelAnimationFrame(this._raf),this._raf=0}},At=class{constructor(){this.activeAnimations=[]}startSpring(t){this._start(t,!0)}startTransition(t){this._start(t)}_start(t,e){let i=e?new Pt(t):new St(t);return this.activeAnimations.push(i),i.onFinish=()=>this.stop(i),i}stop(t){t.destroy();let e=this.activeAnimations.indexOf(t);e>-1&&this.activeAnimations.splice(e,1)}stopAll(){this.activeAnimations.forEach(t=>{t.destroy()}),this.activeAnimations=[]}stopAllPan(){this.activeAnimations=this.activeAnimations.filter(t=>t.props.isPan?(t.destroy(),!1):!0)}stopMainScroll(){this.activeAnimations=this.activeAnimations.filter(t=>t.props.isMainScroll?(t.destroy(),!1):!0)}isPanRunning(){return this.activeAnimations.some(t=>t.props.isPan)}},Ct=class{constructor(t){this.pswp=t,t.events.add(t.element,"wheel",this._onWheel.bind(this))}_onWheel(t){t.preventDefault();let{currSlide:e}=this.pswp,{deltaX:i,deltaY:s}=t;if(e&&!this.pswp.dispatch("wheel",{originalEvent:t}).defaultPrevented)if(t.ctrlKey||this.pswp.options.wheelToZoom){if(e.isZoomable()){let n=-s;t.deltaMode===1?n*=.05:n*=t.deltaMode?1:.002,n=2**n;let r=e.currZoomLevel*n;e.zoomTo(r,{x:t.clientX,y:t.clientY})}}else e.isPannable()&&(t.deltaMode===1&&(i*=18,s*=18),e.panTo(e.pan.x-i,e.pan.y-s))}};function ei(o){if(typeof o=="string")return o;if(!o||!o.isCustomSVG)return"";let t=o,e='",e}var It=class{constructor(t,e){var i;let s=e.name||e.className,n=e.html;if(t.options[s]===!1)return;typeof t.options[s+"SVG"]=="string"&&(n=t.options[s+"SVG"]),t.dispatch("uiElementCreate",{data:e});let r="";e.isButton?(r+="pswp__button ",r+=e.className||`pswp__button--${e.name}`):r+=e.className||`pswp__${e.name}`;let a=e.isButton?e.tagName||"button":e.tagName||"div";a=a.toLowerCase();let l=A(r,a);if(e.isButton){a==="button"&&(l.type="button");let{title:u}=e,{ariaLabel:m}=e;typeof t.options[s+"Title"]=="string"&&(u=t.options[s+"Title"]),u&&(l.title=u);let S=m||u;S&&l.setAttribute("aria-label",S)}l.innerHTML=ei(n),e.onInit&&e.onInit(l,t),e.onClick&&(l.onclick=u=>{typeof e.onClick=="string"?t[e.onClick]():typeof e.onClick=="function"&&e.onClick(u,l,t)});let h=e.appendTo||"bar",d=t.element;h==="bar"?(t.topBar||(t.topBar=A("pswp__top-bar pswp__hide-on-close","div",t.scrollWrap)),d=t.topBar):(l.classList.add("pswp__hide-on-close"),h==="wrapper"&&(d=t.scrollWrap)),(i=d)===null||i===void 0||i.appendChild(t.applyFilters("uiElement",l,e))}};function he(o,t,e){o.classList.add("pswp__button--arrow"),o.setAttribute("aria-controls","pswp__items"),t.on("change",()=>{t.options.loop||(e?o.disabled=!(t.currIndex0))})}var ii={name:"arrowPrev",className:"pswp__button--arrow--prev",title:"Previous",order:10,isButton:!0,appendTo:"wrapper",html:{isCustomSVG:!0,size:60,inner:'',outlineID:"pswp__icn-arrow"},onClick:"prev",onInit:he},si={name:"arrowNext",className:"pswp__button--arrow--next",title:"Next",order:11,isButton:!0,appendTo:"wrapper",html:{isCustomSVG:!0,size:60,inner:'',outlineID:"pswp__icn-arrow"},onClick:"next",onInit:(o,t)=>{he(o,t,!0)}},ni={name:"close",title:"Close",order:20,isButton:!0,html:{isCustomSVG:!0,inner:'',outlineID:"pswp__icn-close"},onClick:"close"},oi={name:"zoom",title:"Zoom",order:10,isButton:!0,html:{isCustomSVG:!0,inner:'',outlineID:"pswp__icn-zoom"},onClick:"toggleZoom"},ri={name:"preloader",appendTo:"bar",order:7,html:{isCustomSVG:!0,inner:'',outlineID:"pswp__icn-loading"},onInit:(o,t)=>{let e,i=null,s=(a,l)=>{o.classList.toggle("pswp__preloader--"+a,l)},n=a=>{e!==a&&(e=a,s("active",a))},r=()=>{var a;if(!((a=t.currSlide)!==null&&a!==void 0&&a.content.isLoading())){n(!1),i&&(clearTimeout(i),i=null);return}i||(i=setTimeout(()=>{var l;n(!!(!((l=t.currSlide)===null||l===void 0)&&l.content.isLoading())),i=null},t.options.preloaderDelay))};t.on("change",r),t.on("loadComplete",a=>{t.currSlide===a.slide&&r()}),t.ui&&(t.ui.updatePreloaderVisibility=r)}},ai={name:"counter",order:5,onInit:(o,t)=>{t.on("change",()=>{o.innerText=t.currIndex+1+t.options.indexIndicatorSep+t.getNumItems()})}};function se(o,t){o.classList.toggle("pswp--zoomed-in",t)}var Et=class{constructor(t){this.pswp=t,this.isRegistered=!1,this.uiElementsData=[],this.items=[],this.updatePreloaderVisibility=()=>{},this._lastUpdatedZoomLevel=void 0}init(){let{pswp:t}=this;this.isRegistered=!1,this.uiElementsData=[ni,ii,si,oi,ri,ai],t.dispatch("uiRegister"),this.uiElementsData.sort((e,i)=>(e.order||0)-(i.order||0)),this.items=[],this.isRegistered=!0,this.uiElementsData.forEach(e=>{this.registerElement(e)}),t.on("change",()=>{var e;(e=t.element)===null||e===void 0||e.classList.toggle("pswp--one-slide",t.getNumItems()===1)}),t.on("zoomPanUpdate",()=>this._onZoomPanUpdate())}registerElement(t){this.isRegistered?this.items.push(new It(this.pswp,t)):this.uiElementsData.push(t)}_onZoomPanUpdate(){let{template:t,currSlide:e,options:i}=this.pswp;if(this.pswp.opener.isClosing||!t||!e)return;let{currZoomLevel:s}=e;if(this.pswp.opener.isOpen||(s=e.zoomLevels.initial),s===this._lastUpdatedZoomLevel)return;this._lastUpdatedZoomLevel=s;let n=e.zoomLevels.initial-e.zoomLevels.secondary;if(Math.abs(n)<.01||!e.isZoomable()){se(t,!1),t.classList.remove("pswp--zoom-allowed");return}t.classList.add("pswp--zoom-allowed");let r=s===e.zoomLevels.initial?e.zoomLevels.secondary:e.zoomLevels.initial;se(t,r<=s),(i.imageClickAction==="zoom"||i.imageClickAction==="zoom-or-close")&&t.classList.add("pswp--click-to-zoom")}};function li(o){let t=o.getBoundingClientRect();return{x:t.left,y:t.top,w:t.width}}function hi(o,t,e){let i=o.getBoundingClientRect(),s=i.width/t,n=i.height/e,r=s>n?s:n,a=(i.width-t*r)/2,l=(i.height-e*r)/2,h={x:i.left+a,y:i.top+l,w:t*r};return h.innerRect={w:i.width,h:i.height,x:a,y:l},h}function ci(o,t,e){let i=e.dispatch("thumbBounds",{index:o,itemData:t,instance:e});if(i.thumbBounds)return i.thumbBounds;let{element:s}=t,n,r;if(s&&e.options.thumbSelector!==!1){let a=e.options.thumbSelector||"img";r=s.matches(a)?s:s.querySelector(a)}return r=e.applyFilters("thumbEl",r,t,o),r&&(t.thumbCropped?n=hi(r,t.width||t.w||0,t.height||t.h||0):n=li(r)),e.applyFilters("thumbBounds",n,t,o)}var Lt=class{constructor(t,e){this.type=t,this.defaultPrevented=!1,e&&Object.assign(this,e)}preventDefault(){this.defaultPrevented=!0}},zt=class{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(t,e,i=100){var s,n,r;this._filters[t]||(this._filters[t]=[]),(s=this._filters[t])===null||s===void 0||s.push({fn:e,priority:i}),(n=this._filters[t])===null||n===void 0||n.sort((a,l)=>a.priority-l.priority),(r=this.pswp)===null||r===void 0||r.addFilter(t,e,i)}removeFilter(t,e){this._filters[t]&&(this._filters[t]=this._filters[t].filter(i=>i.fn!==e)),this.pswp&&this.pswp.removeFilter(t,e)}applyFilters(t,...e){var i;return(i=this._filters[t])===null||i===void 0||i.forEach(s=>{e[0]=s.fn.apply(this,e)}),e[0]}on(t,e){var i,s;this._listeners[t]||(this._listeners[t]=[]),(i=this._listeners[t])===null||i===void 0||i.push(e),(s=this.pswp)===null||s===void 0||s.on(t,e)}off(t,e){var i;this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter(s=>e!==s)),(i=this.pswp)===null||i===void 0||i.off(t,e)}dispatch(t,e){var i;if(this.pswp)return this.pswp.dispatch(t,e);let s=new Lt(t,e);return(i=this._listeners[t])===null||i===void 0||i.forEach(n=>{n.call(this,s)}),s}},Tt=class{constructor(t,e){if(this.element=A("pswp__img pswp__img--placeholder",t?"img":"div",e),t){let i=this.element;i.decoding="async",i.alt="",i.src=t,i.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(t,e){this.element&&(this.element.tagName==="IMG"?(dt(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=q(0,0,t/250)):dt(this.element,t,e))}destroy(){var t;(t=this.element)!==null&&t!==void 0&&t.parentNode&&this.element.remove(),this.element=null}},Dt=class{constructor(t,e,i){this.instance=e,this.data=t,this.index=i,this.element=void 0,this.placeholder=void 0,this.slide=void 0,this.displayedImageWidth=0,this.displayedImageHeight=0,this.width=Number(this.data.w)||Number(this.data.width)||0,this.height=Number(this.data.h)||Number(this.data.height)||0,this.isAttached=!1,this.hasSlide=!1,this.isDecoding=!1,this.state=I.IDLE,this.data.type?this.type=this.data.type:this.data.src?this.type="image":this.type="html",this.instance.dispatch("contentInit",{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout(()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0)},1e3)}load(t,e){if(this.slide&&this.usePlaceholder())if(this.placeholder){let i=this.placeholder.element;i&&!i.parentElement&&this.slide.container.prepend(i)}else{let i=this.instance.applyFilters("placeholderSrc",this.data.msrc&&this.slide.isFirstSlide?this.data.msrc:!1,this);this.placeholder=new Tt(i,this.slide.container)}this.element&&!e||this.instance.dispatch("contentLoad",{content:this,isLazy:t}).defaultPrevented||(this.isImageContent()?(this.element=A("pswp__img","img"),this.displayedImageWidth&&this.loadImage(t)):(this.element=A("pswp__content","div"),this.element.innerHTML=this.data.html||""),e&&this.slide&&this.slide.updateContentSize(!0))}loadImage(t){var e,i;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:t}).defaultPrevented)return;let s=this.element;this.updateSrcsetSizes(),this.data.srcset&&(s.srcset=this.data.srcset),s.src=(e=this.data.src)!==null&&e!==void 0?e:"",s.alt=(i=this.data.alt)!==null&&i!==void 0?i:"",this.state=I.LOADING,s.complete?this.onLoaded():(s.onload=()=>{this.onLoaded()},s.onerror=()=>{this.onError()})}setSlide(t){this.slide=t,this.hasSlide=!0,this.instance=t.pswp}onLoaded(){this.state=I.LOADED,this.slide&&this.element&&(this.instance.dispatch("loadComplete",{slide:this.slide,content:this}),this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode&&(this.append(),this.slide.updateContentSize(!0)),(this.state===I.LOADED||this.state===I.ERROR)&&this.removePlaceholder())}onError(){this.state=I.ERROR,this.slide&&(this.displayError(),this.instance.dispatch("loadComplete",{slide:this.slide,isError:!0,content:this}),this.instance.dispatch("loadError",{slide:this.slide,content:this}))}isLoading(){return this.instance.applyFilters("isContentLoading",this.state===I.LOADING,this)}isError(){return this.state===I.ERROR}isImageContent(){return this.type==="image"}setDisplayedSize(t,e){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(t,e),!this.instance.dispatch("contentResize",{content:this,width:t,height:e}).defaultPrevented&&(dt(this.element,t,e),this.isImageContent()&&!this.isError()))){let i=!this.displayedImageWidth&&t;this.displayedImageWidth=t,this.displayedImageHeight=e,i?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:t,height:e,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==I.ERROR,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;let t=this.element,e=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!t.dataset.largestUsedSize||e>parseInt(t.dataset.largestUsedSize,10))&&(t.sizes=e+"px",t.dataset.largestUsedSize=String(e))}usePlaceholder(){return this.instance.applyFilters("useContentPlaceholder",this.isImageContent(),this)}lazyLoad(){this.instance.dispatch("contentLazyLoad",{content:this}).defaultPrevented||this.load(!0)}keepPlaceholder(){return this.instance.applyFilters("isKeepingPlaceholder",this.isLoading(),this)}destroy(){this.hasSlide=!1,this.slide=void 0,!this.instance.dispatch("contentDestroy",{content:this}).defaultPrevented&&(this.remove(),this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0),this.isImageContent()&&this.element&&(this.element.onload=null,this.element.onerror=null,this.element=void 0))}displayError(){if(this.slide){var t,e;let i=A("pswp__error-msg","div");i.innerText=(t=(e=this.instance.options)===null||e===void 0?void 0:e.errorMsg)!==null&&t!==void 0?t:"",i=this.instance.applyFilters("contentErrorElement",i,this),this.element=A("pswp__content pswp__error-msg-container","div"),this.element.appendChild(i),this.slide.container.innerText="",this.slide.container.appendChild(this.element),this.slide.updateContentSize(!0),this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;if(this.isAttached=!0,this.state===I.ERROR){this.displayError();return}if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;let t="decode"in this.element;this.isImageContent()?t&&this.slide&&(!this.slide.isActive||Yt())?(this.isDecoding=!0,this.element.decode().catch(()=>{}).finally(()=>{this.isDecoding=!1,this.appendImage()})):this.appendImage():this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){this.instance.dispatch("contentActivate",{content:this}).defaultPrevented||!this.slide||(this.isImageContent()&&this.isDecoding&&!Yt()?this.appendImage():this.isError()&&this.load(!1,!0),this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","false"))}deactivate(){this.instance.dispatch("contentDeactivate",{content:this}),this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","true")}remove(){this.isAttached=!1,!this.instance.dispatch("contentRemove",{content:this}).defaultPrevented&&(this.element&&this.element.parentNode&&this.element.remove(),this.placeholder&&this.placeholder.element&&this.placeholder.element.remove())}appendImage(){this.isAttached&&(this.instance.dispatch("contentAppendImage",{content:this}).defaultPrevented||(this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element),(this.state===I.LOADED||this.state===I.ERROR)&&this.removePlaceholder()))}},pi=5;function ce(o,t,e){let i=t.createContentFromData(o,e),s,{options:n}=t;if(n){s=new Y(n,o,-1);let r;t.pswp?r=t.pswp.viewportSize:r=ae(n,t);let a=le(n,r,o,e);s.update(i.width,i.height,a)}return i.lazyLoad(),s&&i.setDisplayedSize(Math.ceil(i.width*s.initial),Math.ceil(i.height*s.initial)),i}function di(o,t){let e=t.getItemData(o);if(!t.dispatch("lazyLoadSlide",{index:o,itemData:e}).defaultPrevented)return ce(e,t,o)}var Ot=class{constructor(t){this.pswp=t,this.limit=Math.max(t.options.preload[0]+t.options.preload[1]+1,pi),this._cachedItems=[]}updateLazy(t){let{pswp:e}=this;if(e.dispatch("lazyLoad").defaultPrevented)return;let{preload:i}=e.options,s=t===void 0?!0:t>=0,n;for(n=0;n<=i[1];n++)this.loadSlideByIndex(e.currIndex+(s?n:-n));for(n=1;n<=i[0];n++)this.loadSlideByIndex(e.currIndex+(s?-n:n))}loadSlideByIndex(t){let e=this.pswp.getLoopedIndex(t),i=this.getContentByIndex(e);i||(i=di(e,this.pswp),i&&this.addToCache(i))}getContentBySlide(t){let e=this.getContentByIndex(t.index);return e||(e=this.pswp.createContentFromData(t.data,t.index),this.addToCache(e)),e.setSlide(t),e}addToCache(t){if(this.removeByIndex(t.index),this._cachedItems.push(t),this._cachedItems.length>this.limit){let e=this._cachedItems.findIndex(i=>!i.isAttached&&!i.hasSlide);e!==-1&&this._cachedItems.splice(e,1)[0].destroy()}}removeByIndex(t){let e=this._cachedItems.findIndex(i=>i.index===t);e!==-1&&this._cachedItems.splice(e,1)}getContentByIndex(t){return this._cachedItems.find(e=>e.index===t)}destroy(){this._cachedItems.forEach(t=>t.destroy()),this._cachedItems=[]}},Ft=class extends zt{getNumItems(){var t;let e=0,i=(t=this.options)===null||t===void 0?void 0:t.dataSource;i&&"length"in i?e=i.length:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),i.items&&(e=i.items.length));let s=this.dispatch("numItems",{dataSource:i,numItems:e});return this.applyFilters("numItems",s.numItems,i)}createContentFromData(t,e){return new Dt(t,this,e)}getItemData(t){var e;let i=(e=this.options)===null||e===void 0?void 0:e.dataSource,s={};Array.isArray(i)?s=i[t]:i&&"gallery"in i&&(i.items||(i.items=this._getGalleryDOMElements(i.gallery)),s=i.items[t]);let n=s;n instanceof Element&&(n=this._domElementToItemData(n));let r=this.dispatch("itemData",{itemData:n||{},index:t});return this.applyFilters("itemData",r.itemData,t)}_getGalleryDOMElements(t){var e,i;return(e=this.options)!==null&&e!==void 0&&e.children||(i=this.options)!==null&&i!==void 0&&i.childSelector?Ne(this.options.children,this.options.childSelector,t)||[]:[t]}_domElementToItemData(t){let e={element:t},i=t.tagName==="A"?t:t.querySelector("a");if(i){e.src=i.dataset.pswpSrc||i.href,i.dataset.pswpSrcset&&(e.srcset=i.dataset.pswpSrcset),e.width=i.dataset.pswpWidth?parseInt(i.dataset.pswpWidth,10):0,e.height=i.dataset.pswpHeight?parseInt(i.dataset.pswpHeight,10):0,e.w=e.width,e.h=e.height,i.dataset.pswpType&&(e.type=i.dataset.pswpType);let n=t.querySelector("img");if(n){var s;e.msrc=n.currentSrc||n.src,e.alt=(s=n.getAttribute("alt"))!==null&&s!==void 0?s:""}(i.dataset.pswpCropped||i.dataset.cropped)&&(e.thumbCropped=!0)}return this.applyFilters("domItemData",e,t,i)}lazyLoadData(t,e){return ce(t,this,e)}},$=.003,Mt=class{constructor(t){this.pswp=t,this.isClosed=!0,this.isOpen=!1,this.isClosing=!1,this.isOpening=!1,this._duration=void 0,this._useAnimation=!1,this._croppedZoom=!1,this._animateRootOpacity=!1,this._animateBgOpacity=!1,this._placeholder=void 0,this._opacityElement=void 0,this._cropContainer1=void 0,this._cropContainer2=void 0,this._thumbBounds=void 0,this._prepareOpen=this._prepareOpen.bind(this),t.on("firstZoomPan",this._prepareOpen)}open(){this._prepareOpen(),this._start()}close(){if(this.isClosed||this.isClosing||this.isOpening)return;let t=this.pswp.currSlide;this.isOpen=!1,this.isOpening=!1,this.isClosing=!0,this._duration=this.pswp.options.hideAnimationDuration,t&&t.currZoomLevel*t.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps(),setTimeout(()=>{this._start()},this._croppedZoom?30:0)}_prepareOpen(){if(this.pswp.off("firstZoomPan",this._prepareOpen),!this.isOpening){let t=this.pswp.currSlide;this.isOpening=!0,this.isClosing=!1,this._duration=this.pswp.options.showAnimationDuration,t&&t.zoomLevels.initial*t.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps()}}_applyStartProps(){let{pswp:t}=this,e=this.pswp.currSlide,{options:i}=t;if(i.showHideAnimationType==="fade"?(i.showHideOpacity=!0,this._thumbBounds=void 0):i.showHideAnimationType==="none"?(i.showHideOpacity=!1,this._duration=0,this._thumbBounds=void 0):this.isOpening&&t._initialThumbBounds?this._thumbBounds=t._initialThumbBounds:this._thumbBounds=this.pswp.getThumbBounds(),this._placeholder=e?.getPlaceholderElement(),t.animations.stopAll(),this._useAnimation=!!(this._duration&&this._duration>50),this._animateZoom=!!this._thumbBounds&&e?.content.usePlaceholder()&&(!this.isClosing||!t.mainScroll.isShifted()),!this._animateZoom)this._animateRootOpacity=!0,this.isOpening&&e&&(e.zoomAndPanToInitial(),e.applyCurrentZoomPan());else{var s;this._animateRootOpacity=(s=i.showHideOpacity)!==null&&s!==void 0?s:!1}if(this._animateBgOpacity=!this._animateRootOpacity&&this.pswp.options.bgOpacity>$,this._opacityElement=this._animateRootOpacity?t.element:t.bg,!this._useAnimation){this._duration=0,this._animateZoom=!1,this._animateBgOpacity=!1,this._animateRootOpacity=!0,this.isOpening&&(t.element&&(t.element.style.opacity=String($)),t.applyBgOpacity(1));return}if(this._animateZoom&&this._thumbBounds&&this._thumbBounds.innerRect){var n;this._croppedZoom=!0,this._cropContainer1=this.pswp.container,this._cropContainer2=(n=this.pswp.currSlide)===null||n===void 0?void 0:n.holderElement,t.container&&(t.container.style.overflow="hidden",t.container.style.width=t.viewportSize.x+"px")}else this._croppedZoom=!1;this.isOpening?(this._animateRootOpacity?(t.element&&(t.element.style.opacity=String($)),t.applyBgOpacity(1)):(this._animateBgOpacity&&t.bg&&(t.bg.style.opacity=String($)),t.element&&(t.element.style.opacity="1")),this._animateZoom&&(this._setClosedStateZoomPan(),this._placeholder&&(this._placeholder.style.willChange="transform",this._placeholder.style.opacity=String($)))):this.isClosing&&(t.mainScroll.itemHolders[0]&&(t.mainScroll.itemHolders[0].el.style.display="none"),t.mainScroll.itemHolders[2]&&(t.mainScroll.itemHolders[2].el.style.display="none"),this._croppedZoom&&t.mainScroll.x!==0&&(t.mainScroll.resetPosition(),t.mainScroll.resize()))}_start(){this.isOpening&&this._useAnimation&&this._placeholder&&this._placeholder.tagName==="IMG"?new Promise(t=>{let e=!1,i=!0;Re(this._placeholder).finally(()=>{e=!0,i||t(!0)}),setTimeout(()=>{i=!1,e&&t(!0)},50),setTimeout(t,250)}).finally(()=>this._initiate()):this._initiate()}_initiate(){var t,e;(t=this.pswp.element)===null||t===void 0||t.style.setProperty("--pswp-transition-duration",this._duration+"ms"),this.pswp.dispatch(this.isOpening?"openingAnimationStart":"closingAnimationStart"),this.pswp.dispatch("initialZoom"+(this.isOpening?"In":"Out")),(e=this.pswp.element)===null||e===void 0||e.classList.toggle("pswp--ui-visible",this.isOpening),this.isOpening?(this._placeholder&&(this._placeholder.style.opacity="1"),this._animateToOpenState()):this.isClosing&&this._animateToClosedState(),this._useAnimation||this._onAnimationComplete()}_onAnimationComplete(){let{pswp:t}=this;if(this.isOpen=this.isOpening,this.isClosed=this.isClosing,this.isOpening=!1,this.isClosing=!1,t.dispatch(this.isOpen?"openingAnimationEnd":"closingAnimationEnd"),t.dispatch("initialZoom"+(this.isOpen?"InEnd":"OutEnd")),this.isClosed)t.destroy();else if(this.isOpen){var e;this._animateZoom&&t.container&&(t.container.style.overflow="visible",t.container.style.width="100%"),(e=t.currSlide)===null||e===void 0||e.applyCurrentZoomPan()}}_animateToOpenState(){let{pswp:t}=this;this._animateZoom&&(this._croppedZoom&&this._cropContainer1&&this._cropContainer2&&(this._animateTo(this._cropContainer1,"transform","translate3d(0,0,0)"),this._animateTo(this._cropContainer2,"transform","none")),t.currSlide&&(t.currSlide.zoomAndPanToInitial(),this._animateTo(t.currSlide.container,"transform",t.currSlide.getCurrentTransform()))),this._animateBgOpacity&&t.bg&&this._animateTo(t.bg,"opacity",String(t.options.bgOpacity)),this._animateRootOpacity&&t.element&&this._animateTo(t.element,"opacity","1")}_animateToClosedState(){let{pswp:t}=this;this._animateZoom&&this._setClosedStateZoomPan(!0),this._animateBgOpacity&&t.bgOpacity>.01&&t.bg&&this._animateTo(t.bg,"opacity","0"),this._animateRootOpacity&&t.element&&this._animateTo(t.element,"opacity","0")}_setClosedStateZoomPan(t){if(!this._thumbBounds)return;let{pswp:e}=this,{innerRect:i}=this._thumbBounds,{currSlide:s,viewportSize:n}=e;if(this._croppedZoom&&i&&this._cropContainer1&&this._cropContainer2){let r=-n.x+(this._thumbBounds.x-i.x)+i.w,a=-n.y+(this._thumbBounds.y-i.y)+i.h,l=n.x-i.w,h=n.y-i.h;t?(this._animateTo(this._cropContainer1,"transform",q(r,a)),this._animateTo(this._cropContainer2,"transform",q(l,h))):(Z(this._cropContainer1,r,a),Z(this._cropContainer2,l,h))}s&&(b(s.pan,i||this._thumbBounds),s.currZoomLevel=this._thumbBounds.w/s.width,t?this._animateTo(s.container,"transform",s.getCurrentTransform()):s.applyCurrentZoomPan())}_animateTo(t,e,i){if(!this._duration){t.style[e]=i;return}let{animations:s}=this.pswp,n={duration:this._duration,easing:this.pswp.options.easing,onComplete:()=>{s.activeAnimations.length||this._onAnimationComplete()},target:t};n[e]=i,s.startTransition(n)}},ui={allowPanToNext:!0,spacing:.1,loop:!0,pinchToClose:!0,closeOnVerticalDrag:!0,hideAnimationDuration:333,showAnimationDuration:333,zoomAnimationDuration:333,escKey:!0,arrowKeys:!0,trapFocus:!0,returnFocus:!0,maxWidthToAnimate:4e3,clickToCloseNonZoomable:!0,imageClickAction:"zoom-or-close",bgClickAction:"close",tapAction:"toggle-controls",doubleTapAction:"zoom",indexIndicatorSep:" / ",preloaderDelay:2e3,bgOpacity:.8,index:0,errorMsg:"The image cannot be loaded",preload:[1,2],easing:"cubic-bezier(.4,0,.22,1)"},J=class extends Ft{constructor(t){super(),this.options=this._prepareOptions(t||{}),this.offset={x:0,y:0},this._prevViewportSize={x:0,y:0},this.viewportSize={x:0,y:0},this.bgOpacity=1,this.currIndex=0,this.potentialIndex=0,this.isOpen=!1,this.isDestroying=!1,this.hasMouse=!1,this._initialItemData={},this._initialThumbBounds=void 0,this.topBar=void 0,this.element=void 0,this.template=void 0,this.container=void 0,this.scrollWrap=void 0,this.currSlide=void 0,this.events=new ut,this.animations=new At,this.mainScroll=new wt(this),this.gestures=new yt(this),this.opener=new Mt(this),this.keyboard=new bt(this),this.contentLoader=new Ot(this)}init(){if(this.isOpen||this.isDestroying)return!1;this.isOpen=!0,this.dispatch("init"),this.dispatch("beforeOpen"),this._createMainStructure();let t="pswp--open";return this.gestures.supportsTouch&&(t+=" pswp--touch"),this.options.mainClass&&(t+=" "+this.options.mainClass),this.element&&(this.element.className+=" "+t),this.currIndex=this.options.index||0,this.potentialIndex=this.currIndex,this.dispatch("firstUpdate"),this.scrollWheel=new Ct(this),(Number.isNaN(this.currIndex)||this.currIndex<0||this.currIndex>=this.getNumItems())&&(this.currIndex=0),this.gestures.supportsTouch||this.mouseDetected(),this.updateSize(),this.offset.y=window.pageYOffset,this._initialItemData=this.getItemData(this.currIndex),this.dispatch("gettingData",{index:this.currIndex,data:this._initialItemData,slide:void 0}),this._initialThumbBounds=this.getThumbBounds(),this.dispatch("initialLayout"),this.on("openingAnimationEnd",()=>{let{itemHolders:e}=this.mainScroll;e[0]&&(e[0].el.style.display="block",this.setContent(e[0],this.currIndex-1)),e[2]&&(e[2].el.style.display="block",this.setContent(e[2],this.currIndex+1)),this.appendHeavy(),this.contentLoader.updateLazy(),this.events.add(window,"resize",this._handlePageResize.bind(this)),this.events.add(window,"scroll",this._updatePageScrollOffset.bind(this)),this.dispatch("bindEvents")}),this.mainScroll.itemHolders[1]&&this.setContent(this.mainScroll.itemHolders[1],this.currIndex),this.dispatch("change"),this.opener.open(),this.dispatch("afterInit"),!0}getLoopedIndex(t){let e=this.getNumItems();return this.options.loop&&(t>e-1&&(t-=e),t<0&&(t+=e)),V(t,0,e-1)}appendHeavy(){this.mainScroll.itemHolders.forEach(t=>{var e;(e=t.slide)===null||e===void 0||e.appendHeavy()})}goTo(t){this.mainScroll.moveIndexBy(this.getLoopedIndex(t)-this.potentialIndex)}next(){this.goTo(this.potentialIndex+1)}prev(){this.goTo(this.potentialIndex-1)}zoomTo(...t){var e;(e=this.currSlide)===null||e===void 0||e.zoomTo(...t)}toggleZoom(){var t;(t=this.currSlide)===null||t===void 0||t.toggleZoom()}close(){!this.opener.isOpen||this.isDestroying||(this.isDestroying=!0,this.dispatch("close"),this.events.removeAll(),this.opener.close())}destroy(){var t;if(!this.isDestroying){this.options.showHideAnimationType="none",this.close();return}this.dispatch("destroy"),this._listeners={},this.scrollWrap&&(this.scrollWrap.ontouchmove=null,this.scrollWrap.ontouchend=null),(t=this.element)===null||t===void 0||t.remove(),this.mainScroll.itemHolders.forEach(e=>{var i;(i=e.slide)===null||i===void 0||i.destroy()}),this.contentLoader.destroy(),this.events.removeAll()}refreshSlideContent(t){this.contentLoader.removeByIndex(t),this.mainScroll.itemHolders.forEach((e,i)=>{var s,n;let r=((s=(n=this.currSlide)===null||n===void 0?void 0:n.index)!==null&&s!==void 0?s:0)-1+i;if(this.canLoop()&&(r=this.getLoopedIndex(r)),r===t&&(this.setContent(e,t,!0),i===1)){var a;this.currSlide=e.slide,(a=e.slide)===null||a===void 0||a.setIsActive(!0)}}),this.dispatch("change")}setContent(t,e,i){if(this.canLoop()&&(e=this.getLoopedIndex(e)),t.slide){if(t.slide.index===e&&!i)return;t.slide.destroy(),t.slide=void 0}if(!this.canLoop()&&(e<0||e>=this.getNumItems()))return;let s=this.getItemData(e);t.slide=new mt(s,e,this),e===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;let e=ae(this.options,this);!t&&H(e,this._prevViewportSize)||(b(this._prevViewportSize,e),this.dispatch("beforeResize"),b(this.viewportSize,this._prevViewportSize),this._updatePageScrollOffset(),this.dispatch("viewportSize"),this.mainScroll.resize(this.opener.isOpen),!this.hasMouse&&window.matchMedia("(any-hover: hover)").matches&&this.mouseDetected(),this.dispatch("resize"))}applyBgOpacity(t){this.bgOpacity=Math.max(t,0),this.bg&&(this.bg.style.opacity=String(this.bgOpacity*this.options.bgOpacity))}mouseDetected(){if(!this.hasMouse){var t;this.hasMouse=!0,(t=this.element)===null||t===void 0||t.classList.add("pswp--has_mouse")}}_handlePageResize(){this.updateSize(),/iPhone|iPad|iPod/i.test(window.navigator.userAgent)&&setTimeout(()=>{this.updateSize()},500)}_updatePageScrollOffset(){this.setScrollOffset(0,window.pageYOffset)}setScrollOffset(t,e){this.offset.x=t,this.offset.y=e,this.dispatch("updateScrollOffset")}_createMainStructure(){this.element=A("pswp","div"),this.element.setAttribute("tabindex","-1"),this.element.setAttribute("role","dialog"),this.template=this.element,this.bg=A("pswp__bg","div",this.element),this.scrollWrap=A("pswp__scroll-wrap","section",this.element),this.container=A("pswp__container","div",this.scrollWrap),this.scrollWrap.setAttribute("aria-roledescription","carousel"),this.container.setAttribute("aria-live","off"),this.container.setAttribute("id","pswp__items"),this.mainScroll.appendHolders(),this.ui=new Et(this),this.ui.init(),(this.options.appendToEl||document.body).appendChild(this.element)}getThumbBounds(){return ci(this.currIndex,this.currSlide?this.currSlide.data:this._initialItemData,this)}canLoop(){return this.options.loop&&this.getNumItems()>2}_prepareOptions(t){return window.matchMedia("(prefers-reduced-motion), (update: slow)").matches&&(t.showHideAnimationType="none",t.zoomAnimationDuration=0),{...ui,...t}}};var ue=ze(pe());window.scrollama=ue.default;function fi(){document.querySelectorAll(".journal-photo-strip").forEach(function(o){o.setAttribute("role","region"),o.setAttribute("aria-label","Photo strip"),o.setAttribute("tabindex","0");var t=parseInt(o.dataset.slides,10)||1,e=o.nextElementSibling;if(!(!e||!e.classList.contains("journal-photo-dots"))){var i=Array.from(e.querySelectorAll(".journal-photo-dot"));if(o.addEventListener("scroll",function(){var l=Math.round(o.scrollLeft/o.offsetWidth);i.forEach(function(h,d){h.classList.toggle("is-active",d===l)})},{passive:!0}),!(t<2)){var s=document.createElement("button");s.className="strip-prev",s.setAttribute("aria-label","Previous photo"),s.textContent="\u2039",s.addEventListener("click",function(){o.scrollBy({left:-o.offsetWidth,behavior:"smooth"})});var n=document.createElement("button");n.className="strip-next",n.setAttribute("aria-label","Next photo"),n.textContent="\u203A",n.addEventListener("click",function(){o.scrollBy({left:o.offsetWidth,behavior:"smooth"})});var r=document.createElement("div");r.className="strip-controls",r.appendChild(s),r.appendChild(n);var a=o.closest(".journal-photo-wrap");(a||e).insertAdjacentElement("afterend",r)}}})}function mi(){if(document.querySelector(".pswp-gallery")){var o=new X({gallery:".pswp-gallery",children:"a.journal-photo-slide",pswpModule:J});o.on("afterOpen",function(){var t=o.pswp,e=0,i=null;function s(n){n.key==="ArrowRight"?e=1:n.key==="ArrowLeft"?e=-1:e=0}document.addEventListener("keydown",s,!0),t.on("change",function(){if(e){var n=e;e=0;var r=t.currSlide&&t.currSlide.container;r&&(r.classList.remove("pswp-key-from-left","pswp-key-from-right"),r.offsetWidth,r.classList.add(n>0?"pswp-key-from-right":"pswp-key-from-left"),clearTimeout(i),i=setTimeout(function(){r.classList.remove("pswp-key-from-left","pswp-key-from-right")},400))}}),t.on("close",function(){document.removeEventListener("keydown",s,!0),clearTimeout(i)})}),o.init(),document.querySelectorAll(".journal-photo-wrap").forEach(function(t){var e=t.querySelector(".journal-photo-strip");if(e){var i=Array.from(e.querySelectorAll("a.journal-photo-slide")),s=t.querySelector(".journal-photo-expand"),n=t.closest("article"),r=n?Array.from(n.querySelectorAll(".journal-photo-dot")):[],a=0,l=new IntersectionObserver(function(h){h.forEach(function(d){d.isIntersecting&&(a=i.indexOf(d.target),r.forEach(function(u){u.classList.remove("is-active")}),r[a]&&r[a].classList.add("is-active"))})},{root:e,threshold:.5});i.forEach(function(h){l.observe(h)}),s&&i.length&&s.addEventListener("click",function(){i[a].dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0}))})}})}}function kt(o,t,e,i){var s=document.getElementById(o);if(s){var n=document.querySelector(t);if(n){var r=n.querySelector("#feed-filter-empty"),a=!0;s.addEventListener("click",function(){a=!a;var l=Array.from(n.querySelectorAll(e));l.reverse().forEach(function(h){r?n.insertBefore(h,r):n.appendChild(h)}),s.textContent=i?a?"\u2191 Oldest first":"\u2193 Newest first":a?"\u2191":"\u2193",s.setAttribute("aria-label",a?"Sort: oldest first":"Sort: newest first"),s.classList.toggle("is-active",!a)})}}}function gi(){var o=document.querySelectorAll(".trip-filter-btn");if(o.length){var t=document.querySelectorAll("[data-type]"),e=document.getElementById("feed-filter-empty");o.forEach(function(i){i.addEventListener("click",function(){o.forEach(function(r){r.classList.remove("is-active"),r.setAttribute("aria-pressed","false")}),i.classList.add("is-active"),i.setAttribute("aria-pressed","true");var s=i.getAttribute("data-filter"),n=0;t.forEach(function(r){var a=s==="all"||r.getAttribute("data-type")===s;r.style.display=a?"":"none",a&&n++}),e&&(n===0?(e.textContent=s==="story"?"No stories yet for this trip.":"No entries yet.",e.style.display=""):e.style.display="none")})})}}function de(o){var t=document.getElementById(o);if(t){var e=window.innerHeight*.8,i=!1;t.addEventListener("click",function(){history.pushState(null,"",window.location.pathname+window.location.search),window.scrollTo({top:0,behavior:"smooth"})}),window.addEventListener("scroll",function(){var s=window.scrollY>e;s!==i&&(i=s,t.classList.toggle("is-visible",i))},{passive:!0})}}function _i(){document.querySelectorAll(".trip-panel-toggle").forEach(function(o){var t=o.getAttribute("aria-controls"),e=t?document.getElementById(t):null;e&&o.addEventListener("click",function(){var i=e.classList.contains("is-open");e.classList.toggle("is-open",!i),o.classList.toggle("is-active",!i),o.setAttribute("aria-expanded",i?"false":"true")})}),document.querySelectorAll(".trip-panel-close").forEach(function(o){var t=document.getElementById(o.getAttribute("data-toggle"));t&&o.addEventListener("click",function(){t.click()})})}document.addEventListener("DOMContentLoaded",function(){fi(),mi(),gi(),kt("trip-sort-toggle",".feed","[data-type]",!1),kt("feed-sort-toggle",".feed","[data-type]",!0),kt("feed-sort-toggle",".stories-grid",".story-card",!0),de("story-totop"),de("trip-totop"),_i()});})(); +/*! Bundled license information: + +photoswipe/dist/photoswipe-lightbox.esm.js: + (*! + * PhotoSwipe Lightbox 5.4.4 - https://photoswipe.com + * (c) 2024 Dmytro Semenov + *) + +photoswipe/dist/photoswipe.esm.js: + (*! + * PhotoSwipe 5.4.4 - https://photoswipe.com + * (c) 2024 Dmytro Semenov + *) +*/ diff --git a/themes/intotheeast/js/src/main.js b/themes/intotheeast/js/src/main.js index 2a5c0e7..dc99941 100644 --- a/themes/intotheeast/js/src/main.js +++ b/themes/intotheeast/js/src/main.js @@ -1 +1,253 @@ -// placeholder — replaced in Task 2 +/* ── Fonts ───────────────────────────────────────────────── */ +import '@fontsource-variable/dm-sans'; +import '@fontsource/dm-serif-display/400.css'; +import '@fontsource/dm-serif-display/400-italic.css'; + +/* ── PhotoSwipe ──────────────────────────────────────────── */ +import PhotoSwipeLightbox from 'photoswipe/lightbox'; +import PhotoSwipe from 'photoswipe'; +import 'photoswipe/style.css'; + +/* ── Scrollama (used by story.html.twig inline script) ────── */ +import scrollama from 'scrollama'; +window.scrollama = scrollama; + +/* ── Photo strip: prev/next buttons + scroll-based dot sync ─ */ +function initPhotoStrip() { + document.querySelectorAll('.journal-photo-strip').forEach(function (strip) { + strip.setAttribute('role', 'region'); + strip.setAttribute('aria-label', 'Photo strip'); + strip.setAttribute('tabindex', '0'); + + var slideCount = parseInt(strip.dataset.slides, 10) || 1; + var dots = strip.nextElementSibling; + if (!dots || !dots.classList.contains('journal-photo-dots')) return; + var dotEls = Array.from(dots.querySelectorAll('.journal-photo-dot')); + + strip.addEventListener('scroll', function () { + var idx = Math.round(strip.scrollLeft / strip.offsetWidth); + dotEls.forEach(function (d, i) { d.classList.toggle('is-active', i === idx); }); + }, { passive: true }); + + if (slideCount < 2) return; + + var prev = document.createElement('button'); + prev.className = 'strip-prev'; + prev.setAttribute('aria-label', 'Previous photo'); + prev.textContent = '‹'; + prev.addEventListener('click', function () { + strip.scrollBy({ left: -strip.offsetWidth, behavior: 'smooth' }); + }); + + var next = document.createElement('button'); + next.className = 'strip-next'; + next.setAttribute('aria-label', 'Next photo'); + next.textContent = '›'; + next.addEventListener('click', function () { + strip.scrollBy({ left: strip.offsetWidth, behavior: 'smooth' }); + }); + + var controls = document.createElement('div'); + controls.className = 'strip-controls'; + controls.appendChild(prev); + controls.appendChild(next); + var wrap = strip.closest('.journal-photo-wrap'); + (wrap || dots).insertAdjacentElement('afterend', controls); + }); +} + +/* ── PhotoSwipe lightbox + IntersectionObserver dot sync ──── */ +function initPhotoSwipe() { + if (!document.querySelector('.pswp-gallery')) return; + + var lightbox = new PhotoSwipeLightbox({ + gallery: '.pswp-gallery', + children: 'a.journal-photo-slide', + pswpModule: PhotoSwipe + }); + + lightbox.on('afterOpen', function () { + var pswp = lightbox.pswp; + var keyDir = 0; + var clearTimer = null; + + function onKey(e) { + if (e.key === 'ArrowRight') keyDir = 1; + else if (e.key === 'ArrowLeft') keyDir = -1; + else keyDir = 0; + } + document.addEventListener('keydown', onKey, true); + + pswp.on('change', function () { + if (!keyDir) return; + var dir = keyDir; + keyDir = 0; + var el = pswp.currSlide && pswp.currSlide.container; + if (!el) return; + el.classList.remove('pswp-key-from-left', 'pswp-key-from-right'); + el.offsetWidth; /* force reflow */ + el.classList.add(dir > 0 ? 'pswp-key-from-right' : 'pswp-key-from-left'); + clearTimeout(clearTimer); + clearTimer = setTimeout(function () { + el.classList.remove('pswp-key-from-left', 'pswp-key-from-right'); + }, 400); + }); + + pswp.on('close', function () { + document.removeEventListener('keydown', onKey, true); + clearTimeout(clearTimer); + }); + }); + + lightbox.init(); + + /* Per-strip: IntersectionObserver dot sync + expand button */ + document.querySelectorAll('.journal-photo-wrap').forEach(function (wrap) { + var strip = wrap.querySelector('.journal-photo-strip'); + if (!strip) return; + var slides = Array.from(strip.querySelectorAll('a.journal-photo-slide')); + var expandBtn = wrap.querySelector('.journal-photo-expand'); + var article = wrap.closest('article'); + var dots = article ? Array.from(article.querySelectorAll('.journal-photo-dot')) : []; + var visibleIdx = 0; + + var io = new IntersectionObserver(function (entries) { + entries.forEach(function (e) { + if (!e.isIntersecting) return; + visibleIdx = slides.indexOf(e.target); + dots.forEach(function (d) { d.classList.remove('is-active'); }); + if (dots[visibleIdx]) dots[visibleIdx].classList.add('is-active'); + }); + }, { root: strip, threshold: 0.5 }); + slides.forEach(function (s) { io.observe(s); }); + + if (expandBtn && slides.length) { + expandBtn.addEventListener('click', function () { + slides[visibleIdx].dispatchEvent( + new MouseEvent('click', { bubbles: true, cancelable: true }) + ); + }); + } + }); +} + +/* ── Sort button ───────────────────────────────────────────── + btnId: element id of the sort toggle button + containerSel: CSS selector for the list container + itemSel: CSS selector for sortable items within container + withLabel: true = button shows "↑ Oldest first" / "↓ Newest first" + false = button shows "↑" / "↓" only + ──────────────────────────────────────────────────────────── */ +function initSortButton(btnId, containerSel, itemSel, withLabel) { + var btn = document.getElementById(btnId); + if (!btn) return; + var container = document.querySelector(containerSel); + if (!container) return; + var sentinel = container.querySelector('#feed-filter-empty'); + var ascending = true; + + btn.addEventListener('click', function () { + ascending = !ascending; + var items = Array.from(container.querySelectorAll(itemSel)); + items.reverse().forEach(function (el) { + if (sentinel) container.insertBefore(el, sentinel); + else container.appendChild(el); + }); + btn.textContent = withLabel + ? (ascending ? '↑ Oldest first' : '↓ Newest first') + : (ascending ? '↑' : '↓'); + btn.setAttribute('aria-label', ascending ? 'Sort: oldest first' : 'Sort: newest first'); + btn.classList.toggle('is-active', !ascending); + }); +} + +/* ── Filter bar (trip page: All / Journal / Stories) ─────── */ +function initFilterBar() { + var filterBtns = document.querySelectorAll('.trip-filter-btn'); + if (!filterBtns.length) return; + var cards = document.querySelectorAll('[data-type]'); + var filterEmpty = document.getElementById('feed-filter-empty'); + + filterBtns.forEach(function (btn) { + btn.addEventListener('click', function () { + filterBtns.forEach(function (b) { + b.classList.remove('is-active'); + b.setAttribute('aria-pressed', 'false'); + }); + btn.classList.add('is-active'); + btn.setAttribute('aria-pressed', 'true'); + + var filter = btn.getAttribute('data-filter'); + var visible = 0; + cards.forEach(function (card) { + var show = filter === 'all' || card.getAttribute('data-type') === filter; + card.style.display = show ? '' : 'none'; + if (show) visible++; + }); + + if (filterEmpty) { + if (visible === 0) { + filterEmpty.textContent = filter === 'story' + ? 'No stories yet for this trip.' + : 'No entries yet.'; + filterEmpty.style.display = ''; + } else { + filterEmpty.style.display = 'none'; + } + } + }); + }); +} + +/* ── Back to top ─────────────────────────────────────────── */ +function initBackToTop(btnId) { + var btn = document.getElementById(btnId); + if (!btn) return; + var threshold = window.innerHeight * 0.8; + var shown = false; + btn.addEventListener('click', function () { + history.pushState(null, '', window.location.pathname + window.location.search); + window.scrollTo({ top: 0, behavior: 'smooth' }); + }); + window.addEventListener('scroll', function () { + var shouldShow = window.scrollY > threshold; + if (shouldShow !== shown) { + shown = shouldShow; + btn.classList.toggle('is-visible', shown); + } + }, { passive: true }); +} + +/* ── Panel toggles (trip stats / cycling panels) ─────────── */ +function initPanelToggles() { + document.querySelectorAll('.trip-panel-toggle').forEach(function (toggle) { + var blockId = toggle.getAttribute('aria-controls'); + var block = blockId ? document.getElementById(blockId) : null; + if (!block) return; + toggle.addEventListener('click', function () { + var isOpen = block.classList.contains('is-open'); + block.classList.toggle('is-open', !isOpen); + toggle.classList.toggle('is-active', !isOpen); + toggle.setAttribute('aria-expanded', isOpen ? 'false' : 'true'); + }); + }); + + document.querySelectorAll('.trip-panel-close').forEach(function (btn) { + var toggleBtn = document.getElementById(btn.getAttribute('data-toggle')); + if (toggleBtn) btn.addEventListener('click', function () { toggleBtn.click(); }); + }); +} + +/* ── Boot ────────────────────────────────────────────────── */ +document.addEventListener('DOMContentLoaded', function () { + initPhotoStrip(); + initPhotoSwipe(); + initFilterBar(); + /* Sort buttons — each call is silent if its button/container isn't on this page */ + initSortButton('trip-sort-toggle', '.feed', '[data-type]', false); + initSortButton('feed-sort-toggle', '.feed', '[data-type]', true); + initSortButton('feed-sort-toggle', '.stories-grid', '.story-card', true); + initBackToTop('story-totop'); + initBackToTop('trip-totop'); + initPanelToggles(); +});