@redot-src/glare 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/glare.css +1 -1
- package/dist/glare.esm.js +122 -122
- package/dist/glare.esm.js.map +1 -1
- package/dist/glare.js +2 -2
- package/dist/glare.js.map +1 -1
- package/package.json +1 -1
package/dist/glare.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(S,
|
|
1
|
+
(function(S,M){typeof exports=="object"&&typeof module<"u"?module.exports=M():typeof define=="function"&&define.amd?define(M):(S=typeof globalThis<"u"?globalThis:S||self,S.Glare=M())})(this,(function(){"use strict";const S={CLOSE:"Close",NEXT:"Next",PREV:"Previous",ERROR:"The requested content cannot be loaded.<br/>Please try again later.",LOADING:"Loading",LIGHTBOX:"Media lightbox",GO_TO_SLIDE:"Go to slide {{index}}",VIDEO_UNSUPPORTED:"Your browser does not support HTML5 video.",PLAY_START:"Start slideshow",PLAY_STOP:"Pause slideshow",FULL_SCREEN:"Full screen",FULL_SCREEN_EXIT:"Exit full screen",THUMBS:"Thumbnails",DOWNLOAD:"Download",MORE:"More options",ZOOM:"Zoom",ZOOM_OUT:"Zoom out"};function M(e){const t=e.lang??"en";return{...S,...e.i18n?.en,...e.i18n?.[t]}}function g(e,t){return e.replace(/\{\{(\w+)\}\}/g,(s,i)=>t[i]??"")}function wt(e){return Object.entries(e).map(([t,s])=>`${encodeURIComponent(t)}=${encodeURIComponent(String(s))}`).join("&")}function Et(e,t){return e.replace(/\$(\d+)/g,(s,i)=>t[Number(i)]??"")}const Tt={youtube:{matcher:/(?:youtube\.com|youtu\.be|youtube-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/\w\/|embed\/|shorts\/)?([\w-]{11})/i,type:"embed",url:"https://www.youtube-nocookie.com/embed/$1",thumb:"https://img.youtube.com/vi/$1/hqdefault.jpg",params:{autoplay:1,rel:0,modestbranding:1,playsinline:1}},vimeo:{matcher:/vimeo\.com\/(?:video\/)?(\d+)/i,type:"embed",url:"https://player.vimeo.com/video/$1",params:{autoplay:1,title:0,byline:0,portrait:0}},gmap:{matcher:/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/(?:place\/[^/]+\/)?@([^/]+)|maps\?q=([^&]+)|maps\/search\/([^/?]+))/i,type:"iframe",url:e=>{const[,t,s,i,n]=e;if(s){const[r,a,l]=s.split(","),u=l?Math.floor(parseFloat(l)):14;return`https://maps.google.${t}/maps?ll=${r},${a}&z=${u}&output=embed`}const o=encodeURIComponent(decodeURIComponent(i||n||""));return`https://maps.google.${t}/maps?q=${o}&output=embed`}}};function W(e,t,s){if(typeof e=="function")return e(t,s);if(typeof e=="string")return Et(e,t)}function St(e,t){for(const s of Object.values(t??{})){const i=e.match(s.matcher);if(!i)continue;let n=W(s.url,i,e)??e;return s.params&&(n+=(n.includes("?")?"&":"?")+wt(s.params)),{src:n,type:s.type??"iframe",thumb:W(s.thumb,i,e)}}return null}const d=e=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${e}</svg>`,c={close:d('<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'),next:d('<path d="m9 18 6-6-6-6"/>'),prev:d('<path d="m15 18-6-6 6-6"/>'),zoomIn:d('<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/><path d="M11 8v6"/><path d="M8 11h6"/>'),zoomOut:d('<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/><path d="M8 11h6"/>'),download:d('<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/>'),thumbs:d('<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M9 21V9"/>'),play:d('<polygon points="6 3 20 12 6 21 6 3"/>'),pause:d('<rect width="4" height="16" x="6" y="4"/><rect width="4" height="16" x="14" y="4"/>'),fullscreen:d('<path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/>'),fullscreenExit:d('<path d="M8 3v3a2 2 0 0 1-2 2H3"/><path d="M21 8h-3a2 2 0 0 1-2-2V3"/><path d="M3 16h3a2 2 0 0 1 2 2v3"/><path d="M16 21v-3a2 2 0 0 1 2-2h3"/>'),more:d('<circle cx="5" cy="12" r="1" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1" fill="currentColor" stroke="none"/><circle cx="19" cy="12" r="1" fill="currentColor" stroke="none"/>'),thumbImage:d('<rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="8.5" cy="9" r="1.5"/><path d="m4 17 5-5 4 4 2-2 5 5"/>'),thumbVideo:d('<rect x="3" y="5" width="18" height="14" rx="2"/><path d="m10 9 5 3-5 3Z"/>'),thumbEmbed:d('<circle cx="12" cy="12" r="9"/><path d="m10 8 6 4-6 4Z"/>'),thumbIframe:d('<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 8h18"/><circle cx="6" cy="6" r=".5" fill="currentColor" stroke="none"/><circle cx="9" cy="6" r=".5" fill="currentColor" stroke="none"/>'),thumbInline:d('<rect x="4" y="4" width="16" height="16" rx="2"/><path d="M8 8h8M8 12h8M8 16h5"/>'),thumbAjax:d('<path d="M20 15a4 4 0 0 0-3-3.87A6 6 0 1 0 6 14"/><path d="m9 16 3 3 3-3M12 12v7"/>'),thumbHtml:d('<path d="m8 9-3 3 3 3M16 9l3 3-3 3M14 5l-4 14"/>'),thumbSlide:d('<path d="M6 3h9l4 4v14H6Z"/><path d="M14 3v5h5M9 13h7M9 17h5"/>')},v=(e,t,s,i="")=>`<button type="button" class="glare-button glare-button--${e}" data-glare-${e} title="{{${t}}}" aria-label="{{${t}}}"${i}>${s}</button>`,Lt=`
|
|
2
2
|
<div class="glare-container" role="dialog" aria-modal="true" tabindex="-1">
|
|
3
3
|
<div class="glare-bg"></div>
|
|
4
4
|
<div class="glare-progress" hidden></div>
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
<div class="glare-stage"></div>
|
|
14
14
|
<div class="glare-caption"></div>
|
|
15
15
|
</div>
|
|
16
|
-
</div>`,Mt={zoom:v("zoom","ZOOM",c.zoomIn),slideshow:v("slideshow","PLAY_START",c.play),thumbs:v("thumbs","THUMBS",c.thumbs,' aria-expanded="false"'),fullscreen:v("fullscreen","FULL_SCREEN",c.fullscreen),more:v("more","MORE",c.more,' aria-expanded="false" aria-haspopup="true"'),close:v("close","CLOSE",c.close),download:`<a class="glare-button glare-button--download" data-glare-download download target="_blank" rel="noopener" title="{{DOWNLOAD}}" aria-label="{{DOWNLOAD}}">${c.download}</a>`,smallBtn:`<button type="button" class="glare-button glare-close-small" data-glare-close title="{{CLOSE}}" aria-label="{{CLOSE}}">${c.close}</button>`},Lt='<div class="glare-spinner" role="status" aria-label="{{LOADING}}"></div>',Ct='<div class="glare-error"><p>{{ERROR}}</p></div>',$t='<video class="glare-video" controls playsinline controlsList="nodownload" poster="{{poster}}"><source src="{{src}}" type="{{format}}"/>{{VIDEO_UNSUPPORTED}}</video>',It='<iframe class="glare-iframe"></iframe>',U={autoStart:!1,axis:"x",fit:"cover"},D={autoStart:!1,speed:3e3},V={autoStart:!1},k={closeExisting:!1,loop:!1,keyboard:!0,protect:!1,modal:!1,idleTime:3,hideScrollbar:!0,autoFocus:!0,backFocus:!0,trapFocus:!0,defaultType:"image",parentEl:"body",baseClass:"",slideClass:"",arrows:!0,infobar:!0,toolbar:"auto",smallBtn:"auto",buttons:["zoom","slideshow","thumbs","download","fullscreen","close"],animationEffect:"zoom",animationDuration:366,anchor:"trigger",zoomOpacity:!0,transitionEffect:"fade",transitionDuration:366,clickContent:e=>e.type==="image"?"zoom":!1,clickSlide:"close",dblclickContent:!1,dblclickSlide:!1,wheel:"auto",touch:{vertical:!0,momentum:!0},mobile:{idleTime:!1,clickContent:e=>e.type==="image"?"toggleControls":!1,clickSlide:e=>e.type==="image"?"toggleControls":"close",dblclickContent:e=>e.type==="image"?"zoom":!1,dblclickSlide:e=>e.type==="image"?"zoom":!1},image:{preload:!1},video:{tpl:$t,format:"",autoStart:!0},iframe:{preload:!0,css:{},attr:{allowfullscreen:"true",allow:"autoplay; fullscreen; picture-in-picture"},tpl:It},ajax:{settings:{headers:{"X-Requested-With":"XMLHttpRequest"}}},media:Et,hash:!0,slideshow:D,thumbs:U,fullscreen:V,lang:"en",i18n:{en:S},baseTpl:St,btnTpl:Mt,spinnerTpl:Lt,errorTpl:Ct},Ot=/\.(avif|bmp|gif|jpe?g|png|svg|webp|ico)(\?.*)?$/i,At=/\.(mp4|webm|ogg|ogv|mov|m4v)(\?.*)?$/i,Dt=/\.pdf(\?.*)?$/i,kt=/^(#[\w-]+|\.[\w-]+)$/;function Rt(e,t="image"){return e?kt.test(e)?"inline":Ot.test(e)?"image":At.test(e)?"video":Dt.test(e)?"iframe":t:"html"}function Ft(e){const t=e.match(/\.(\w+)(?:\?|$)/)?.[1]?.toLowerCase();return t?`video/${t==="ogv"?"ogg":t}`:"video/mp4"}function G(e,t,s){const i=typeof e=="string"?{src:e}:{...e};let n=i.src??"",o=i.type,r=i.thumb;const a=n?Tt(n,s.media):null;return a&&(n=a.src??n,o??=a.type,r??=a.thumb),o||(o=i.html||i.content?"html":Rt(n,s.defaultType)),{...i,index:t,src:n,type:o,thumb:r,caption:i.caption??i.title??"",isLoaded:!1,hasError:!1}}const p=(e,t)=>e.getAttribute(t)||void 0;function Ht(e,t){return e.map((s,i)=>{const n=s.querySelector("img"),o=p(s,"data-caption")??p(s,"title")??"";return G({src:p(s,"data-src")??p(s,"href")??"",type:p(s,"data-type"),caption:o,alt:n?.getAttribute("alt")||o,thumb:p(s,"data-thumb")??n?.getAttribute("src")??void 0,width:p(s,"data-width"),height:p(s,"data-height"),ratio:p(s,"data-ratio"),poster:p(s,"data-poster"),downloadSrc:p(s,"data-download-src"),html:p(s,"data-html"),$trigger:s},i,t)})}function Pt(e,t){return e.length&&e[0].nodeType===1?Ht(e,t):e.map((s,i)=>G(s,i,t))}function h(e,t=document){return t.querySelector(e)}function $(e,t=document){return Array.from(t.querySelectorAll(e))}function m(e,t="",s=""){const i=document.createElement(e);return t&&(i.className=t),s&&(i.innerHTML=s),i}function zt(e){return m("div","",e.trim()).firstElementChild}function R(e){return/[<&]/.test(e)?new DOMParser().parseFromString(e,"text/html").body.textContent?.trim()??"":e.trim()}function X(e,t=document){return e?typeof e!="string"?e:h(e,t)??h(e):null}function Y(e){return typeof e=="number"?`${e}px`:e}function f(e,t,s,i){return e.addEventListener(t,s,i),()=>e.removeEventListener(t,s,i)}function K(e){requestAnimationFrame(()=>requestAnimationFrame(e))}function _t(e,t,s){let i=!1;const n=()=>{i||(i=!0,clearTimeout(r),e.removeEventListener("transitionend",o),s())},o=a=>{a.target===e&&n()};e.addEventListener("transitionend",o);const r=setTimeout(n,t+50)}function Nt(){return navigator.maxTouchPoints>0&&window.matchMedia("(pointer: coarse)").matches}function Q(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}function J(){const e=document;return!!(e.fullscreenEnabled??e.webkitFullscreenEnabled)}const tt="glare-lock";function et(e){const t=document.documentElement;if(e){const s=window.innerWidth-t.clientWidth;t.classList.add(tt),s>0&&(t.style.marginRight=`${s}px`)}else t.classList.remove(tt),t.style.marginRight=""}const T="glare-hidden";function Zt(e,t,s,i){const n=zt(g(e.baseTpl,t));n.dataset.glareId=String(s),e.baseClass&&n.classList.add(e.baseClass),e.modal&&n.classList.add("glare-is-modal");const o=h(".glare-stage",n);if(!o)throw new Error("baseTpl must contain a .glare-stage element");const r={container:n,bg:h(".glare-bg",n),inner:h(".glare-inner",n),stage:o,caption:h(".glare-caption",n),toolbar:h(".glare-toolbar",n),infobar:h(".glare-infobar",n),navigation:h(".glare-navigation",n)},a=i<2;return r.navigation?.classList.toggle(T,!e.arrows||a),r.infobar?.classList.toggle(T,!e.infobar||a),r.toolbar&&jt(r.toolbar,e,t,a),r}function jt(e,t,s,i){if(t.toolbar===!1){e.classList.add(T);return}const n=m("div","glare-toolbar-menu");n.id=`glare-toolbar-menu-${e.closest(".glare-container")?.dataset.glareId??""}`;for(const o of t.buttons){if(typeof o!="string"){n.appendChild(qt(o));continue}if(i&&(o==="thumbs"||o==="slideshow")||o==="fullscreen"&&!J()||o==="more"||o==="close")continue;const r=t.btnTpl[o];r&&n.insertAdjacentHTML("beforeend",g(r,s))}if(n.childElementCount){e.appendChild(n);const o=t.btnTpl.more;o&&(e.insertAdjacentHTML("beforeend",g(o,s)),e.querySelector("[data-glare-more]")?.setAttribute("aria-controls",n.id))}if(t.buttons.includes("close")){const o=t.btnTpl.close;o&&e.insertAdjacentHTML("beforeend",g(o,s))}}function qt({name:e,label:t,icon:s}){const i=m("button",`glare-button glare-button--${e}`,s);return i.type="button",i.title=t,i.dataset.glareCustom=e,i.setAttribute("aria-label",t),i}function Bt(e,t){let s=0;for(let i=e;i instanceof HTMLElement&&i!==t;i=i.offsetParent)s+=i.offsetTop;return s}function Wt({container:e,caption:t}){let s=null;const i=()=>{if(!t)return;e.style.setProperty("--glare-caption-inset",`${t.offsetHeight}px`);const o=s&&h(".glare-content",s);o&&Object.assign(t.style,{top:`${Bt(o,t.offsetParent)+o.offsetHeight}px`,bottom:"auto"})},n=new ResizeObserver(i);return t&&n.observe(t),i(),{follow(o){if(s)for(const r of[s,h(".glare-content",s)])r&&n.unobserve(r);s=o;for(const r of[o,h(".glare-content",o)])r&&n.observe(r);i()},destroy:()=>n.disconnect()}}function Ut(e,t,s){const i=m("div",`glare-slide glare-slide--${t.type}`);s.slideClass&&i.classList.add(s.slideClass);const n=m("div","glare-content");return i.appendChild(n),e.appendChild(i),t.$slide=i,t.$content=n,i}function Vt(e,t,s){e.style.setProperty("--glare-direction",String(s)),e.classList.add(t?"glare-slide--opening":"glare-slide--in"),t&&(e.style.transition="none"),e.offsetWidth,e.classList.add("glare-slide--current"),t&&(e.offsetWidth,e.style.transition="")}function Gt(e,t,s,i){for(const n of $(".glare-slide",e))n!==t&&(n.classList.contains("glare-slide--out")||n.style.setProperty("--glare-direction",String(i)),n.classList.remove("glare-slide--current","glare-slide--in","glare-slide--opening"),n.classList.add("glare-slide--out"),setTimeout(()=>n.remove(),s))}function Xt(e,t,s){e.insertAdjacentHTML("beforeend",g(t.btnTpl.smallBtn??"",s))}function Yt(e,t,s){e.querySelector(":scope > .glare-spinner")||e.insertAdjacentHTML("beforeend",g(t.spinnerTpl,s))}function Kt(e){e.querySelector(":scope > .glare-spinner")?.remove()}function Qt(e,t,s,i){e.hasError=!0,e.error=t,e.$content&&(e.$content.className="glare-content glare-content--error",e.$content.innerHTML=g(s.errorTpl,i))}function st(e,t){return typeof e.toolbar=="boolean"?e.toolbar:t.type==="image"}function Jt(e,t){return typeof e.smallBtn=="boolean"?e.smallBtn:!st(e,t)}function te(e,t,s,i,n,o){const{container:r,toolbar:a,infobar:l}=e;ae(r,i.type),a&&ee(a,t,i),se(r,i),l&&ie(l,i.index,n),e.caption&&ne(e.caption,o),oe(r,t,i.index,n),re(r,s,i,n)}function ee(e,t,s){if(t.toolbar===!1)return;e.classList.remove("glare-toolbar--expanded"),e.querySelector("[data-glare-more]")?.setAttribute("aria-expanded","false");const i=st(t,s);if(e.classList.toggle(T,!i),!i)return;const n=s.type==="image";h("[data-glare-zoom]",e)?.classList.toggle(T,!n)}function se(e,t){const s=e.querySelector("[data-glare-download]");if(!s)return;const i=t.downloadSrc||(t.type==="image"?t.src:"");s.classList.toggle(T,!i),i&&(s.href=i)}function ie(e,t,s){const i=h(".glare-infobar-index",e);i&&(i.textContent=`${t+1} / ${s}`)}function ne(e,t){e.innerHTML=t,e.classList.toggle(T,!t)}function oe(e,t,s,i){const n=!t.loop&&s===0,o=!t.loop&&s===i-1;it(h("[data-glare-prev]",e),n),it(h("[data-glare-next]",e),o)}function it(e,t){e&&(e.classList.toggle("glare-is-disabled",t),e.setAttribute("aria-disabled",String(t)))}function re(e,t,s,i){const n=R(s.caption)||s.alt||t.LIGHTBOX,o=i>1?`${n} (${s.index+1} of ${i})`:n;e.setAttribute("aria-label",o);const r=h(".glare-live",e);r&&(r.textContent=o)}function ae(e,t){const s=e.dataset.type;s&&e.classList.remove(`glare-type-${s}`),e.dataset.type=t,e.classList.add(`glare-type-${t}`)}function le(e,t,s,i){e.classList.toggle("glare-can-zoom-out",s),e.classList.toggle("glare-can-zoom-in",!s&&i);const n=h("[data-glare-zoom]",e),o=s?"out":"in";!n||n.dataset.state===o||(n.dataset.state=o,F(n,s,s?t.ZOOM_OUT:t.ZOOM,s?c.zoomOut:c.zoomIn))}function F(e,t,s,i){e.setAttribute("title",s),e.setAttribute("aria-label",s),e.innerHTML=i,e.classList.toggle("glare-is-active",t)}class ce{constructor(t,s,i){this.glare=t,this.container=s,this.offs=[f(document,"fullscreenchange",()=>this.sync()),f(document,"webkitfullscreenchange",()=>this.sync())],i.autoStart&&this.request()}isFullscreen(){const t=document;return!!(t.fullscreenElement??t.webkitFullscreenElement)}request(){const t=this.container;(t.requestFullscreen??t.webkitRequestFullscreen)?.call(t)}exit(){if(!this.isFullscreen())return;const t=document;(t.exitFullscreen??t.webkitExitFullscreen)?.call(document)}toggle(){this.isFullscreen()?this.exit():this.request()}destroy(){this.exit(),this.offs.forEach(t=>t())}sync(){const t=this.isFullscreen();this.container.classList.toggle("glare-is-fullscreen",t);const s=h("[data-glare-fullscreen]",this.container);if(!s)return;const{dict:i}=this.glare;F(s,t,t?i.FULL_SCREEN_EXIT:i.FULL_SCREEN,t?c.fullscreenExit:c.fullscreen)}}function nt(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function H(...e){const t={};for(const s of e)if(s)for(const[i,n]of Object.entries(s)){if(n===void 0)continue;const o=t[i];t[i]=nt(n)?H(nt(o)?o:{},n):n}return t}function w(e,t,s){return Math.min(s,Math.max(t,e))}const M=1,P=5,he=1.01;class ue{constructor(t){this.target=t,this.scale=M,this.x=0,this.y=0}get isZoomed(){return this.scale>he}get state(){return{scale:this.scale,x:this.x,y:this.y}}center(){const t=this.target.image();if(!t)return null;const s=t.getBoundingClientRect();return{x:s.left+s.width/2-this.x,y:s.top+s.height/2-this.y}}apply(t,s,i,n=0){const o=this.target.image();if(!o)return;this.scale=w(t,M,P);const r=this.isZoomed?this.bounded(s,i):{x:0,y:0};this.x=r.x,this.y=r.y,o.style.transitionDuration=`${n}ms`,o.style.transform=`translate3d(${this.x}px, ${this.y}px, 0) scale(${this.scale})`,this.target.onChange(this.isZoomed)}toFit(t=300){this.apply(M,0,0,t)}toActual(t,s=300){const i=this.target.image(),n=this.center();if(!i||!n)return;const o=i.naturalWidth/Math.max(i.offsetWidth,1),r=w(Math.max(o,1.5),M,P),a=t?.x??n.x,l=t?.y??n.y;this.apply(r,(n.x-a)*(r-1),(n.y-l)*(r-1),s)}reset(){const t=this.target.image();t&&(t.style.transform="",t.style.transitionDuration=""),this.scale=M,this.x=0,this.y=0,this.target.onChange(!1)}bounded(t,s){const i=this.target.image(),n=this.target.stage();if(!i||!n)return{x:t,y:s};const o=Math.max(0,(i.offsetWidth*this.scale-n.clientWidth)/2),r=Math.max(0,(i.offsetHeight*this.scale-n.clientHeight)/2);return{x:w(t,-o,o),y:w(s,-r,r)}}}const de=6,ot=120,fe=100,pe=.5,me=80,ge=.4,be="a, button, input, textarea, select, video, .glare-thumbs",rt=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y),at=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2}),z=e=>({x:e.clientX,y:e.clientY});class ye{constructor(t,s){this.stage=t,this.host=s,this.pointers=new Map,this.mode="idle",this.moved=!1,this.start=[],this.startTime=0,this.startZoom={scale:1,x:0,y:0},this.startMid={x:0,y:0},this.startDistance=0,this.offs=[f(t,"pointerdown",i=>this.onDown(i)),f(window,"pointermove",i=>this.onMove(i),{passive:!1}),f(window,"pointerup",i=>this.onUp(i)),f(window,"pointercancel",i=>this.onUp(i))]}destroy(){this.offs.forEach(t=>t()),this.pointers.clear()}consumeMoved(){const t=this.moved;return this.moved=!1,t}onDown(t){t.pointerType==="mouse"&&t.button!==0||t.target.closest(be)||(this.pointers.set(t.pointerId,z(t)),this.pointers.size<=2&&this.begin())}onMove(t){this.pointers.has(t.pointerId)&&(this.pointers.set(t.pointerId,z(t)),this.move(t))}onUp(t){this.pointers.has(t.pointerId)&&(this.pointers.delete(t.pointerId),this.pointers.size===0?this.end(z(t)):this.begin())}begin(){this.mode==="swipe"&&this.releaseStage();const t=[...this.pointers.values()];this.start=t,this.startTime=performance.now(),this.startZoom=this.host.zoom.state,this.mode=t.length>=2?"pinch":"idle",t.length>=2&&(this.startDistance=rt(t[0],t[1]),this.startMid=at(t[0],t[1]))}move(t){const s=[...this.pointers.values()];if(!this.start.length||!s.length)return;if(this.mode==="pinch"&&s.length>=2){t.preventDefault(),this.moved=!0,this.pinch(s[0],s[1]);return}const i=s[0].x-this.start[0].x,n=s[0].y-this.start[0].y;if(!(!this.moved&&Math.hypot(i,n)<de)){if(this.moved=!0,this.mode==="idle"&&(this.mode=this.host.zoom.isZoomed&&this.host.canPan()?"pan":"swipe"),this.mode==="pan")t.preventDefault(),this.host.zoom.apply(this.startZoom.scale,this.startZoom.x+i,this.startZoom.y+n);else if(this.mode==="swipe"){const o=this.host.touch.vertical!==!1;if(!o&&Math.abs(n)>Math.abs(i))return;t.preventDefault(),this.dragStage(i,o?n:0)}}}pinch(t,s){const{zoom:i}=this.host,n=at(t,s),o=i.center()??n,r=w(this.startZoom.scale*rt(t,s)/(this.startDistance||1),M,P),a=(this.startMid.x-o.x-this.startZoom.x)/this.startZoom.scale,l=(this.startMid.y-o.y-this.startZoom.y)/this.startZoom.scale;i.apply(r,n.x-o.x-r*a,n.y-o.y-r*l)}end(t){if(!this.start.length)return;const s=Math.max(performance.now()-this.startTime,1),i=t.x-this.start[0].x,n=t.y-this.start[0].y,o={x:i/s,y:n/s};if(this.mode==="swipe")this.releaseStage(),this.finishSwipe(i,n,o);else if(this.mode==="pan"&&this.host.touch.momentum!==!1){const{zoom:r}=this.host;r.apply(r.scale,r.x+o.x*ot,r.y+o.y*ot,250)}this.mode="idle",this.start=[],this.moved&&setTimeout(()=>this.moved=!1,0)}dragStage(t,s){this.stage.style.transitionDuration="0ms",this.stage.style.transform=`translate3d(${t}px, ${s}px, 0)`;const{bg:i}=this.host;i&&(i.style.transitionDuration="0ms",i.style.opacity=String(w(1-Math.abs(s)/400,.35,1)))}releaseStage(){this.stage.style.transitionDuration="",this.stage.style.transform="";const{bg:t}=this.host;t&&(t.style.transitionDuration="",t.style.opacity="")}finishSwipe(t,s,i){if(Math.abs(s)>Math.abs(t)){(Math.abs(s)>fe||Math.abs(i.y)>pe)&&this.host.close();return}(Math.abs(t)>me||Math.abs(i.x)>ge)&&(t<0?this.host.next():this.host.prev())}}const xe=/^(.+)-(\d+)$/;function _(e=window.location.hash){const t=e.replace(/^#/,"").match(xe);return t?{gallery:t[1],index:Math.max(0,parseInt(t[2],10)-1)}:null}function lt(e,t){return`${e}-${t+1}`}class ve{constructor(t,s){this.glare=t,this.gallery=s,this.pushed=!1,this.off=f(window,"hashchange",()=>this.onHashChange());const i=lt(s,t.currIndex);ct()!==i&&(window.history.pushState(null,"",`#${i}`),this.pushed=!0)}update(t=this.glare.currIndex){const s=lt(this.gallery,t);ct()!==s&&this.replace(`#${s}`)}destroy(){this.off(),_()?.gallery===this.gallery&&(this.pushed?window.history.back():this.replace(""))}onHashChange(){const t=_();!t||t.gallery!==this.gallery?(this.pushed=!1,this.glare.close()):t.index!==this.glare.currIndex&&this.glare.jumpTo(t.index)}replace(t){const{pathname:s,search:i}=window.location;window.history.replaceState(null,"",`${s}${i}${t}`)}}const ct=()=>window.location.hash.replace(/^#/,"");class we{constructor(t,s,i){this.glare=t,this.container=s,this.opts=i,this.timer=null,this.active=!1,this.bar=h(".glare-progress",s),this.button=h("[data-glare-slideshow]",s),i.autoStart&&this.start()}isActive(){return this.active}start(){this.glare.group.length<2||(this.active=!0,this.container.classList.add("glare-is-slideshow"),this.syncButton(),this.schedule())}stop(){this.active=!1,this.clearTimer(),this.setProgress(0,!0),this.container.classList.remove("glare-is-slideshow"),this.syncButton()}toggle(){this.active?this.stop():this.start()}onIndexChange(){this.active&&this.schedule()}destroy(){this.stop()}get speed(){return this.opts.speed??D.speed}get atEnd(){return!this.glare.opts.loop&&this.glare.currIndex===this.glare.group.length-1}schedule(){this.clearTimer(),this.setProgress(0),Q()||(this.bar?.offsetWidth,this.setProgress(1)),this.timer=setTimeout(()=>this.atEnd?this.stop():this.glare.next(),this.speed)}clearTimer(){this.timer&&clearTimeout(this.timer),this.timer=null}setProgress(t,s=!1){this.bar&&(this.bar.hidden=s,this.bar.style.transitionDuration=t?`${this.speed}ms`:"0ms",this.bar.style.transform=`scaleX(${t})`)}syncButton(){if(!this.button)return;const{dict:t}=this.glare;F(this.button,this.active,this.active?t.PLAY_STOP:t.PLAY_START,this.active?c.pause:c.play)}}const Ee={image:c.thumbImage,video:c.thumbVideo,embed:c.thumbEmbed,iframe:c.thumbIframe,inline:c.thumbInline,ajax:c.thumbAjax,html:c.thumbHtml};function Te(e){return e.thumb||(e.type==="video"?e.poster:"")||(e.type==="image"?e.src:"")}function ht(e,t){e.classList.add("glare-thumbs-item--placeholder"),e.innerHTML=Ee[t]??c.thumbSlide}class Se{constructor(t,s,i){this.glare=t,this.container=s,this.opts=i,this.isActive=!1,this.offs=[],this.axis=i.axis==="y"?"y":"x",this.list=m("div","glare-thumbs-list"),this.strip=m("div",`glare-thumbs glare-thumbs--${this.axis}`),this.strip.style.setProperty("--glare-thumbs-fit",i.fit??"cover"),this.strip.appendChild(this.list),this.build()}show(){this.setActive(!0)}hide(){this.setActive(!1)}toggle(){this.setActive(!this.isActive)}focus(t=this.glare.currIndex){for(const s of $(".glare-thumbs-item",this.list))s.classList.toggle("glare-is-active",Number(s.dataset.index)===t);this.list.querySelector(".glare-is-active")?.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}destroy(){this.offs.forEach(t=>t()),this.offs=[],this.container.classList.remove(`glare-thumbs-axis-${this.axis}`),this.strip.remove()}setActive(t){this.isActive=t,this.strip.classList.toggle("glare-thumbs--active",t),this.container.classList.toggle("glare-show-thumbs",t);const s=h("[data-glare-thumbs]",this.container);s?.classList.toggle("glare-is-active",t),s?.setAttribute("aria-expanded",String(t))}build(){const{group:t,dict:s}=this.glare;if(t.length<2)return;this.container.classList.add(`glare-thumbs-axis-${this.axis}`);for(const n of t){const o=m("button","glare-thumbs-item");o.type="button",o.dataset.index=String(n.index),o.setAttribute("aria-label",g(s.GO_TO_SLIDE,{index:String(n.index+1)}));const r=Te(n);if(r){const a=m("img");a.src=r,a.alt=n.alt||R(n.caption),a.loading="lazy",a.onerror=()=>ht(o,n.type),o.appendChild(a)}else ht(o,n.type);this.list.appendChild(o),this.offs.push(f(o,"click",()=>this.glare.jumpTo(n.index)))}(X(this.opts.parentEl,this.container)??this.container).appendChild(this.strip),this.opts.autoStart&&this.show(),this.focus()}}const Me=40,Le=150,Ce=16;class $e{constructor(t,s){this.distance=0,this.fired=!1,this.settle=null,this.off=f(t,"wheel",i=>{const n=s.current();!n||i.deltaY===0||s.mode==="auto"&&n.type!=="image"||n.type==="image"&&s.isZoomed()||(i.preventDefault(),this.restartSettle(),!this.fired&&(this.distance+=Ie(i,t),!(Math.abs(this.distance)<Me)&&(this.fired=!0,this.distance>0?s.next():s.prev())))},{passive:!1})}destroy(){this.settle&&clearTimeout(this.settle),this.off()}restartSettle(){this.settle&&clearTimeout(this.settle),this.settle=setTimeout(()=>{this.distance=0,this.fired=!1},Le)}}function Ie(e,t){return e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*Ce:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*t.clientHeight:e.deltaY}function I(e){const t=Q(),s=t||!e.animationEffect?0:Math.max(0,e.animationDuration),i=t||!e.transitionEffect?0:Math.max(0,e.transitionDuration);return{animationEffect:s?e.animationEffect:!1,animationDuration:s,transitionEffect:i?e.transitionEffect:!1,transitionDuration:i}}function Oe(e,t){const s=I(t);e.dataset.animation=s.animationEffect||"none",e.style.setProperty("--glare-duration",`${s.animationDuration}ms`),e.style.setProperty("--glare-transition-duration",`${s.transitionDuration}ms`)}function Ae(e,t){e.dataset.transition=I(t).transitionEffect||"none"}const De=/^(top|center|bottom)-(left|center|right)$/,ut={top:0,left:0,center:.5,bottom:1,right:1};function ke(e,t,s){const i=typeof s=="string"?De.exec(s):null;if(i){const u=e.getBoundingClientRect(),x=u.left+u.width*ut[i[2]],C=u.top+u.height*ut[i[1]];return new DOMRect(x,C,0,0)}const n=u=>u?.getClientRects().length?u:null,o=s!=="trigger"&&n(X(s))||n(t.$trigger);if(!o)return null;const r=o.getBoundingClientRect(),l=(o.ownerDocument===e.ownerDocument?null:o.ownerDocument.defaultView?.frameElement)?.getBoundingClientRect();return l?new DOMRect(r.x+l.x,r.y+l.y,r.width,r.height):r}function Re(e,t,s){const i=t.$image;if(e.dataset.animation!=="zoom"||!i)return;const n=ke(e,t,s.anchor);if(!n)return;const o=i.getBoundingClientRect(),r=Math.max(n.width/Math.max(o.width,1),n.height/Math.max(o.height,1)),a=n.left+n.width/2-(o.left+o.width/2),l=n.top+n.height/2-(o.top+o.height/2);Object.assign(i.style,{transform:`translate3d(${a}px, ${l}px, 0) scale(${r})`,opacity:s.zoomOpacity?"0.2":"1",transitionDuration:"0ms"}),K(()=>{Object.assign(i.style,{transform:"",opacity:"",transitionDuration:""})})}function dt(e){const t=H(k,e);return Nt()&&t.mobile?H(t,t.mobile):t}function N(e,t){return e?e===!0?{...t}:{...t,...e}:null}const O=[],Z=e=>e.getAttribute("data-glare")??"";function Fe(e){return typeof e=="string"?$(e):e instanceof HTMLElement?[e]:Array.from(e)}function He(e,t,s){const i=Fe(e),n=a=>{const l=Z(a),u=l?i.filter(x=>Z(x)===l):[a];s(u,u.indexOf(a),l)},o=i.map(a=>f(a,"click",l=>{l.preventDefault(),n(a)})),r={elements:i,destroy(){o.forEach(l=>l());const a=O.indexOf(r);a>=0&&O.splice(a,1)}};return O.push(r),dt(t).hash&&ze(i,n),r}function Pe(){for(const e of[...O])e.destroy()}function ze(e,t){const s=_();if(!s)return;const n=e.filter(o=>Z(o)===s.gallery)[s.index];n&&t(n)}class _e{constructor(t,s){this.seconds=t,this.onIdle=s,this.timer=null}reset(){this.stop(),this.seconds&&(this.timer=setTimeout(this.onIdle,this.seconds*1e3))}stop(){this.timer&&clearTimeout(this.timer),this.timer=null}}const E=[],b={add(e){E.push(e)},remove(e){const t=E.indexOf(e);t>=0&&E.splice(t,1)},top(){return E[E.length-1]??null},get(e){return E.find(t=>t.id===e)??null},all(){return[...E]},get size(){return E.length}},Ne=[["[data-glare-close]",e=>e.close()],["[data-glare-next]",e=>e.next()],["[data-glare-prev]",e=>e.prev()],["[data-glare-zoom]",e=>e.toggleZoom()],["[data-glare-slideshow]",e=>e.slideshow?.toggle()],["[data-glare-thumbs]",e=>e.thumbs?.toggle()],["[data-glare-fullscreen]",e=>e.fullscreen?.toggle()]],Ze=".glare-content",je=".glare-slide, .glare-stage",qe='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',Be=new Set(["INPUT","TEXTAREA","SELECT"]),We=300;function Ue(e,t,s){let i=null;const n=()=>{i&&clearTimeout(i),i=null},o=[f(t,"click",r=>{if(e.consumeGesture())return;const a=r.target,l=a.closest("[data-glare-more]");if(l){const A=l.closest(".glare-toolbar"),xt=!A?.classList.contains("glare-toolbar--expanded");A?.classList.toggle("glare-toolbar--expanded",xt),l.setAttribute("aria-expanded",String(xt));return}pt(t);const u=a.closest("[data-glare-custom]");if(u)return Ve(e,u.dataset.glareCustom,r);const x=Ne.find(([A])=>a.closest(A));if(x)return x[1](e);if(a.closest(".glare-button"))return;const C=j(e,a,"click");if(C){if(!ft(e,j(e,a,"dblclick"),r))return q(e,C,r);n(),i=setTimeout(()=>q(e,C,r),We)}}),f(t,"dblclick",r=>{n();const a=r.target;a.closest(".glare-button")||q(e,j(e,a,"dblclick"),r)}),f(document,"keydown",r=>Ge(e,r)),f(document,"keydown",s),f(document,"click",s,{capture:!0}),f(document,"mousemove",s),f(document,"touchstart",s,{passive:!0})];return e.opts.trapFocus&&o.push(f(t,"keydown",r=>Xe(t,r))),e.opts.protect&&o.push(f(t,"contextmenu",r=>r.preventDefault()),f(t,"dragstart",r=>{r.target.tagName==="IMG"&&r.preventDefault()})),()=>{n(),o.forEach(r=>r())}}function Ve(e,t,s){const i=e.opts.buttons.find(n=>typeof n!="string"&&n.name===t);i&&e.current&&i.click(e,e.current,s)}function j(e,t,s){const{opts:i}=e;if(t.closest(Ze))return s==="click"?i.clickContent:i.dblclickContent;if(!(i.modal||!t.closest(je)))return s==="click"?i.clickSlide:i.dblclickSlide}function ft(e,t,s){return!t||!e.current?!1:typeof t=="function"?t(e.current,s):t}function q(e,t,s){switch(ft(e,t,s)){case"close":return e.close();case"next":return e.next();case"nextOrClose":return e.currIndex===e.group.length-1&&!e.opts.loop?e.close():e.next();case"toggleControls":return e.toggleControls();case"zoom":{const i=s instanceof MouseEvent?{x:s.clientX,y:s.clientY}:void 0;return e.toggleZoom(i)}}}function Ge(e,t){if(b.top()!==e)return;if(t.key==="Escape"&&pt(e.$refs?.container??null)){t.preventDefault();return}if(!e.opts.keyboard||e.opts.modal)return;const s=t.target;if(!Be.has(s.tagName)&&!(t.key===" "&&s.closest("button")))switch(t.key){case"Escape":return t.preventDefault(),e.close();case"ArrowRight":case"ArrowDown":return t.preventDefault(),e.next();case"ArrowLeft":case"ArrowUp":return t.preventDefault(),e.prev();case" ":return t.preventDefault(),e.slideshow?.toggle();case"f":case"F":return e.fullscreen?.toggle()}}function pt(e){const t=e?.querySelector(".glare-toolbar--expanded");return t?(t.classList.remove("glare-toolbar--expanded"),t.querySelector("[data-glare-more]")?.setAttribute("aria-expanded","false"),!0):!1}function Xe(e,t){if(t.key!=="Tab")return;const s=$(qe,e).filter(o=>!o.hasAttribute("disabled")&&o.offsetParent!==null&&getComputedStyle(o).visibility!=="hidden");if(!s.length)return;const i=s[0],n=s[s.length-1];t.shiftKey&&document.activeElement===i?(t.preventDefault(),n.focus()):!t.shiftKey&&document.activeElement===n&&(t.preventDefault(),i.focus())}const Ye=1200,mt=16/9;function Ke(e,t,s){if(t&&s)return t/s;const i=String(e.ratio||mt).replace(":","/"),[n,o="1"]=i.split("/").map(l=>l.trim()),r=parseFloat(n),a=parseFloat(o);return r>0&&a>0?r/a:mt}function gt(e,t,s){if(!e)return 0;if(typeof e=="number")return e;const i=e.trim(),n=parseFloat(i);return n>0?i.endsWith("%")?t*n/100:i.endsWith("vw")||i.endsWith("vh")?s*n/100:n:0}function bt(e,t){const s=t.parentElement;if(!s)return;const i=getComputedStyle(s),n=s.clientWidth-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight),o=s.clientHeight-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom);if(!(n>0&&o>0))return;const r=e.width!==void 0&&e.height!==void 0;let a=r?gt(e.width,n,innerWidth):n,l=r?gt(e.height,o,innerHeight):o;const u=Ke(e,r?a:void 0,r?l:void 0),x=Math.min(1,n/a,o/l);a*=x,l*=x,l>a/u?l=a/u:a>l*u&&(a=l*u),t.style.width=`${a}px`,t.style.height=`${l}px`,t.style.aspectRatio=String(u)}function Qe(e,t){if(bt(e,t),typeof ResizeObserver>"u"||!t.parentElement)return;const s=new ResizeObserver(()=>{if(!t.isConnected)return s.disconnect();bt(e,t)});s.observe(t.parentElement)}const Je=(e,t,s)=>new Promise((i,n)=>{const o=m("img","glare-image");o.alt=e.alt||R(e.caption),o.decoding="async",o.draggable=!1,s.protect&&(o.style.pointerEvents="none"),o.onload=()=>{e.$image=o,e.contentWidth=o.naturalWidth,e.contentHeight=o.naturalHeight,t.appendChild(o),i()},o.onerror=()=>n(new Error(`Failed to load image: ${e.src}`)),o.src=e.src}),ts=(e,t,s,i)=>{const n=e.format||s.video.format||Ft(e.src);t.innerHTML=g(s.video.tpl,{...i,src:e.src,format:n,poster:e.poster??""});const o=t.querySelector("video");o&&(e.autoStart??s.video.autoStart)&&o.play().catch(()=>{})},yt=(e,t,s)=>new Promise(i=>{const n=s.iframe,o=m("div","glare-iframe-wrap",n.tpl),r=o.querySelector("iframe");if(!r)throw new Error("Iframe template must contain an <iframe>");for(const[a,l]of Object.entries(n.attr))r.setAttribute(a,l);if(Object.assign(r.style,n.css),t.appendChild(o),e.type==="embed"?Qe(e,t):(e.width&&(o.style.width=Y(e.width)),e.height&&(o.style.height=Y(e.height))),!n.preload){r.src=e.src,i();return}r.onload=()=>i(),r.src=e.src,setTimeout(i,Ye)}),es={image:Je,video:ts,embed:yt,iframe:yt,inline:(e,t)=>{const s=e.src?h(e.src):null;if(!s)throw new Error(`Inline target not found: ${e.src}`);const i=s.cloneNode(!0);i.removeAttribute("id"),i.hidden=!1,i.style.display="",t.appendChild(i)},ajax:async(e,t,s)=>{const i=await fetch(e.src,s.ajax.settings);if(!i.ok)throw new Error(`Request failed: ${i.status} ${e.src}`);t.innerHTML=await i.text()},html:(e,t)=>{e.content&&typeof e.content=="object"?t.appendChild(e.content):t.innerHTML=e.html??e.content??e.src}};async function ss(e,t,s,i){t.innerHTML="",t.className=`glare-content glare-content--${e.type}`,await es[e.type](e,t,s,i),e.isLoaded=!0}function is(e,t){for(const s of[e[t-1],e[t+1]])s?.type==="image"&&s.src&&(new Image().src=s.src)}let ns=0;function os(e){try{return e?.Glare}catch{return}}const y=class y{constructor(t,s={},i=0,n=""){this.id=++ns,this.current=null,this.currIndex=0,this.prevIndex=0,this.isActive=!1,this.isClosing=!1,this.isIdle=!1,this.$refs=null,this.hash=null,this.gestures=null,this.wheel=null,this.cleanups=[],this.captionTracker=null,this.previouslyFocused=null,this.direction=1,this.opts=dt(s),this.dict=L(this.opts),this.group=Pt(t,this.opts),this.galleryName=n,this.currIndex=this.clampIndex(i),this.zoom=new ue({image:()=>this.current?.$image??null,stage:()=>this.$refs?.stage??null,onChange:o=>this.syncZoomState(o)}),this.idle=new _e(this.opts.modal?!1:this.opts.idleTime,()=>this.toggleControls(!0))}open(t=this.currIndex){if(this.isActive)return this.jumpTo(t);if(!this.group.length)return;this.opts.closeExisting&&y.close(!0),this.currIndex=this.clampIndex(t),this.current=this.group[this.currIndex],this.previouslyFocused=document.activeElement instanceof HTMLElement?document.activeElement:null,this.emit("onInit");const s=Zt(this.opts,this.dict,this.id,this.group.length),{container:i}=s;this.$refs=s,Oe(i,this.opts),this.syncChrome(),this.resolveParent().appendChild(i),this.captionTracker=Wt(s),this.cleanups.push(()=>this.captionTracker?.destroy()),this.isActive=!0,b.add(this),this.opts.hideScrollbar&&et(!0),this.emit("onActivate"),this.emitSlide("beforeShow",this.current),K(()=>{this.isActive&&(i.classList.add("glare-is-open"),this.showSlide(this.currIndex,!0),this.cleanups.push(Ue(this,i,()=>this.onActivity())),this.startModules(s),this.opts.autoFocus&&this.focus(),this.idle.reset())})}close(){if(!this.isActive||this.isClosing||!this.current||!this.$refs||this.emitSlide("beforeClose",this.current)===!1)return;this.isClosing=!0,this.slideshow?.stop(),this.idle.stop();const{container:t,bg:s}=this.$refs,i=I(this.opts).animationDuration;if(i===0)return this.teardown();t.classList.remove("glare-is-open"),t.classList.add("glare-is-closing"),_t(s??t,i,()=>this.teardown())}next(){this.jumpTo(this.currIndex+1)}prev(){this.jumpTo(this.currIndex-1)}jumpTo(t){if(!this.isActive||this.isClosing)return;const s=this.group.length,i=this.opts.loop?(t%s+s)%s:w(t,0,s-1);i!==this.currIndex&&(this.direction=t>this.currIndex?1:-1,this.prevIndex=this.currIndex,this.currIndex=i,this.zoom.reset(),this.current=this.group[i],this.syncChrome(),this.showSlide(i,!1),this.thumbs?.focus(i),this.hash?.update(i),this.slideshow?.onIndexChange(),this.emitSlide("onUpdate",this.current))}toggleZoom(t){this.current?.type==="image"&&(this.zoom.isZoomed?this.zoom.toFit():this.zoom.toActual(t))}update(){this.syncChrome()}focus(){this.$refs?.container.focus({preventScroll:!0})}toggleControls(t){this.$refs&&(this.isIdle=t??!this.isIdle,this.$refs.container.classList.toggle("glare-is-idle",this.isIdle))}consumeGesture(){return this.gestures?.consumeMoved()??!1}async showSlide(t,s){const i=this.group[t];if(!this.$refs||!i)return;const{container:n,stage:o}=this.$refs,r=Ut(o,i,this.opts);Jt(this.opts,i)&&Xt(r,this.opts,this.dict),Yt(o,this.opts,this.dict),this.emitSlide("beforeLoad",i),this.opts.image.preload&&is(this.group,t);let a=!1;try{await ss(i,i.$content,this.opts,this.dict)}catch(l){a=!0,Qt(i,l,this.opts,this.dict),this.emitSlide("onError",i),this.opts.onError||console.warn("[glare]",l)}if(!this.isActive||this.currIndex!==t)return r.remove();a||this.emitSlide("afterLoad",i),Kt(o),s||Ae(n,this.opts),Vt(r,s,this.direction),this.captionTracker?.follow(r),Gt(o,r,I(this.opts).transitionDuration,this.direction),this.syncZoomState(this.zoom.isZoomed),!a&&(s&&Re(n,i,this.opts),this.emitSlide("afterShow",i))}syncChrome(){!this.$refs||!this.current||(te(this.$refs,this.opts,this.dict,this.current,this.group.length,this.captionFor(this.current)),this.syncZoomState(this.zoom.isZoomed))}captionFor(t){const{caption:s}=this.opts;return typeof s=="function"?s(this,t):s??t.caption}syncZoomState(t){this.$refs&&le(this.$refs.container,this.dict,t,!!this.current?.$image)}resolveParent(){const{parentEl:t}=this.opts;return(typeof t=="string"?document.querySelector(t):t)??document.body}startModules({container:t,stage:s,bg:i}){const n=this.opts,o=N(n.thumbs,U);o&&(this.thumbs=new Se(this,t,o));const r=N(n.slideshow,D);r&&(this.slideshow=new we(this,t,r));const a=N(n.fullscreen,V);a&&J()&&(this.fullscreen=new ce(this,t,a)),n.hash&&this.galleryName&&(this.hash=new ve(this,this.galleryName)),n.wheel&&(this.wheel=new $e(s,{mode:n.wheel,current:()=>this.current,isZoomed:()=>this.zoom.isZoomed,next:()=>this.next(),prev:()=>this.prev()})),n.touch&&(this.gestures=new ye(s,{zoom:this.zoom,touch:n.touch,bg:i,canPan:()=>this.current?.type==="image",close:()=>this.close(),next:()=>this.next(),prev:()=>this.prev()}))}onActivity(){this.isIdle&&this.toggleControls(!1),this.idle.reset()}teardown(){for(const t of[this.gestures,this.wheel,this.hash,this.thumbs,this.slideshow,this.fullscreen])t?.destroy();this.gestures=this.wheel=this.hash=null,this.thumbs=this.slideshow=this.fullscreen=void 0,this.cleanups.forEach(t=>t()),this.cleanups=[],this.$refs?.container.remove(),this.$refs=null,b.remove(this),this.opts.hideScrollbar&&b.size===0&&et(!1),this.opts.backFocus&&(this.current?.$trigger??this.previouslyFocused)?.focus({preventScroll:!0}),this.isActive=!1,this.isClosing=!1,this.current&&this.emitSlide("afterClose",this.current)}emit(t){return this.opts[t]?.(this)}emitSlide(t,s){return this.opts[t]?.(this,s)}clampIndex(t){return w(t,0,Math.max(0,this.group.length-1))}static open(t,s={},i=0){const n=y.create(t,s,i);return n.open(),n}static bind(t,s={}){return He(t,s,(i,n,o)=>{y.create(i,s,n,o).open()})}static create(t,{delegate:s=k.delegate,...i},n,o=""){return new(os(s)??y)(t,i,n,o)}static close(t=!1){t?b.all().reverse().forEach(s=>s.close()):b.top()?.close()}static getInstance(t){return t==null?b.top():b.get(t)}static getInstances(){return b.all()}static destroy(){y.close(!0),Pe()}static autoBind(t={}){const s=()=>y.bind("[data-glare]",t);document.readyState==="loading"?document.addEventListener("DOMContentLoaded",s,{once:!0}):s()}};y.defaults=k;let B=y;return B}));
|
|
16
|
+
</div>`,Mt={zoom:v("zoom","ZOOM",c.zoomIn),slideshow:v("slideshow","PLAY_START",c.play),thumbs:v("thumbs","THUMBS",c.thumbs,' aria-expanded="false"'),fullscreen:v("fullscreen","FULL_SCREEN",c.fullscreen),more:v("more","MORE",c.more,' aria-expanded="false" aria-haspopup="true"'),close:v("close","CLOSE",c.close),download:`<a class="glare-button glare-button--download" data-glare-download download target="_blank" rel="noopener" title="{{DOWNLOAD}}" aria-label="{{DOWNLOAD}}">${c.download}</a>`,smallBtn:`<button type="button" class="glare-button glare-close-small" data-glare-close title="{{CLOSE}}" aria-label="{{CLOSE}}">${c.close}</button>`},Ct='<div class="glare-spinner" role="status" aria-label="{{LOADING}}"></div>',$t='<div class="glare-error"><p>{{ERROR}}</p></div>',It='<video class="glare-video" controls playsinline controlsList="nodownload" poster="{{poster}}"><source src="{{src}}" type="{{format}}"/>{{VIDEO_UNSUPPORTED}}</video>',Ot='<iframe class="glare-iframe"></iframe>',U={autoStart:!1,axis:"x",fit:"cover"},D={autoStart:!1,speed:3e3},V={autoStart:!1},k={closeExisting:!1,loop:!1,keyboard:!0,protect:!1,modal:!1,idleTime:3,hideScrollbar:!0,autoFocus:!0,backFocus:!0,trapFocus:!0,defaultType:"image",parentEl:"body",baseClass:"",slideClass:"",arrows:!0,infobar:!0,toolbar:"auto",smallBtn:"auto",buttons:["zoom","slideshow","thumbs","download","fullscreen","close"],animationEffect:"zoom",animationDuration:366,anchor:"trigger",zoomOpacity:!0,transitionEffect:"fade",transitionDuration:366,clickContent:e=>e.type==="image"?"zoom":!1,clickSlide:"close",dblclickContent:!1,dblclickSlide:!1,wheel:"auto",touch:{vertical:!0,momentum:!0},mobile:{idleTime:!1,clickContent:e=>e.type==="image"?"toggleControls":!1,clickSlide:e=>e.type==="image"?"toggleControls":"close",dblclickContent:e=>e.type==="image"?"zoom":!1,dblclickSlide:e=>e.type==="image"?"zoom":!1},image:{preload:!1},video:{tpl:It,format:"",autoStart:!0},iframe:{preload:!0,css:{},attr:{allowfullscreen:"true",allow:"autoplay; fullscreen; picture-in-picture"},tpl:Ot},ajax:{settings:{headers:{"X-Requested-With":"XMLHttpRequest"}}},media:Tt,hash:!0,slideshow:D,thumbs:U,fullscreen:V,lang:"en",i18n:{en:S},baseTpl:Lt,btnTpl:Mt,spinnerTpl:Ct,errorTpl:$t},At=/\.(avif|bmp|gif|jpe?g|png|svg|webp|ico)(\?.*)?$/i,Dt=/\.(mp4|webm|ogg|ogv|mov|m4v)(\?.*)?$/i,kt=/\.pdf(\?.*)?$/i,Rt=/^(#[\w-]+|\.[\w-]+)$/;function Ft(e,t="image"){return e?Rt.test(e)?"inline":At.test(e)?"image":Dt.test(e)?"video":kt.test(e)?"iframe":t:"html"}function Ht(e){const t=e.match(/\.(\w+)(?:\?|$)/)?.[1]?.toLowerCase();return t?`video/${t==="ogv"?"ogg":t}`:"video/mp4"}function G(e,t,s){const i=typeof e=="string"?{src:e}:{...e};let n=i.src??"",o=i.type,r=i.thumb;const a=n?St(n,s.media):null;return a&&(n=a.src??n,o??=a.type,r??=a.thumb),o||(o=i.html||i.content?"html":Ft(n,s.defaultType)),{...i,index:t,src:n,type:o,thumb:r,caption:i.caption??i.title??"",isLoaded:!1,hasError:!1}}const p=(e,t)=>e.getAttribute(t)||void 0;function Pt(e,t){return e.map((s,i)=>{const n=s.querySelector("img"),o=p(s,"data-caption")??p(s,"title")??"";return G({src:p(s,"data-src")??p(s,"href")??"",type:p(s,"data-type"),caption:o,alt:n?.getAttribute("alt")||o,thumb:p(s,"data-thumb")??n?.getAttribute("src")??void 0,width:p(s,"data-width"),height:p(s,"data-height"),ratio:p(s,"data-ratio"),poster:p(s,"data-poster"),downloadSrc:p(s,"data-download-src"),html:p(s,"data-html"),$trigger:s},i,t)})}function zt(e,t){return e.length&&e[0].nodeType===1?Pt(e,t):e.map((s,i)=>G(s,i,t))}function h(e,t=document){return t.querySelector(e)}function $(e,t=document){return Array.from(t.querySelectorAll(e))}function m(e,t="",s=""){const i=document.createElement(e);return t&&(i.className=t),s&&(i.innerHTML=s),i}function _t(e){return m("div","",e.trim()).firstElementChild}function R(e){return/[<&]/.test(e)?new DOMParser().parseFromString(e,"text/html").body.textContent?.trim()??"":e.trim()}function X(e,t=document){return e?typeof e!="string"?e:h(e,t)??h(e):null}function Y(e){return typeof e=="number"?`${e}px`:e}function f(e,t,s,i){return e.addEventListener(t,s,i),()=>e.removeEventListener(t,s,i)}function K(e){requestAnimationFrame(()=>requestAnimationFrame(e))}function Nt(e,t,s){let i=!1;const n=()=>{i||(i=!0,clearTimeout(r),e.removeEventListener("transitionend",o),s())},o=a=>{a.target===e&&n()};e.addEventListener("transitionend",o);const r=setTimeout(n,t+50)}function Zt(){return navigator.maxTouchPoints>0&&window.matchMedia("(pointer: coarse)").matches}function Q(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}function J(){const e=document;return!!(e.fullscreenEnabled??e.webkitFullscreenEnabled)}const tt="glare-lock";function et(e){const t=document.documentElement;if(e){const s=window.innerWidth-t.clientWidth;t.classList.add(tt),s>0&&(t.style.marginRight=`${s}px`)}else t.classList.remove(tt),t.style.marginRight=""}const T="glare-hidden";function jt(e,t,s,i){const n=_t(g(e.baseTpl,t));n.dataset.glareId=String(s),e.baseClass&&n.classList.add(e.baseClass),e.modal&&n.classList.add("glare-is-modal");const o=h(".glare-stage",n);if(!o)throw new Error("baseTpl must contain a .glare-stage element");const r={container:n,bg:h(".glare-bg",n),inner:h(".glare-inner",n),stage:o,caption:h(".glare-caption",n),toolbar:h(".glare-toolbar",n),infobar:h(".glare-infobar",n),navigation:h(".glare-navigation",n)},a=i<2;return r.navigation?.classList.toggle(T,!e.arrows||a),r.infobar?.classList.toggle(T,!e.infobar||a),r.toolbar&&qt(r.toolbar,e,t,a),r}function qt(e,t,s,i){if(t.toolbar===!1){e.classList.add(T);return}const n=m("div","glare-toolbar-menu");n.id=`glare-toolbar-menu-${e.closest(".glare-container")?.dataset.glareId??""}`;for(const o of t.buttons){if(typeof o!="string"){n.appendChild(Bt(o));continue}if(i&&(o==="thumbs"||o==="slideshow")||o==="fullscreen"&&!J()||o==="more"||o==="close")continue;const r=t.btnTpl[o];r&&n.insertAdjacentHTML("beforeend",g(r,s))}if(n.childElementCount){e.appendChild(n);const o=t.btnTpl.more;o&&(e.insertAdjacentHTML("beforeend",g(o,s)),e.querySelector("[data-glare-more]")?.setAttribute("aria-controls",n.id))}if(t.buttons.includes("close")){const o=t.btnTpl.close;o&&e.insertAdjacentHTML("beforeend",g(o,s))}}function Bt({name:e,label:t,icon:s}){const i=m("button",`glare-button glare-button--${e}`,s);return i.type="button",i.title=t,i.dataset.glareCustom=e,i.setAttribute("aria-label",t),i}function Wt(e,t){let s=0;for(let i=e;i instanceof HTMLElement&&i!==t;i=i.offsetParent)s+=i.offsetTop;return s}function Ut({container:e,caption:t}){let s=null;const i=()=>{if(!t)return;e.style.setProperty("--glare-caption-inset",`${t.offsetHeight}px`);const o=s&&h(".glare-content",s);o&&Object.assign(t.style,{top:`${Wt(o,t.offsetParent)+o.offsetHeight}px`,bottom:"auto"})},n=new ResizeObserver(i);return t&&n.observe(t),i(),{follow(o){if(s)for(const r of[s,h(".glare-content",s)])r&&n.unobserve(r);s=o;for(const r of[o,h(".glare-content",o)])r&&n.observe(r);i()},destroy:()=>n.disconnect()}}function Vt(e,t,s){const i=m("div",`glare-slide glare-slide--${t.type}`);s.slideClass&&i.classList.add(s.slideClass);const n=m("div","glare-content");return i.appendChild(n),e.appendChild(i),t.$slide=i,t.$content=n,i}function Gt(e,t,s){e.style.setProperty("--glare-direction",String(s)),e.classList.add(t?"glare-slide--opening":"glare-slide--in"),t&&(e.style.transition="none"),e.offsetWidth,e.classList.add("glare-slide--current"),t&&(e.offsetWidth,e.style.transition="")}function st(e,t,s,i){for(const n of $(".glare-slide",e))n!==t&&(n.classList.contains("glare-slide--out")||n.style.setProperty("--glare-direction",String(i)),n.classList.remove("glare-slide--current","glare-slide--in","glare-slide--opening"),n.classList.add("glare-slide--out"),setTimeout(()=>n.remove(),s))}function Xt(e,t,s){e.insertAdjacentHTML("beforeend",g(t.btnTpl.smallBtn??"",s))}function Yt(e,t,s){e.querySelector(":scope > .glare-spinner")||e.insertAdjacentHTML("beforeend",g(t.spinnerTpl,s))}function Kt(e){e.querySelector(":scope > .glare-spinner")?.remove()}function Qt(e,t,s,i){e.hasError=!0,e.error=t,e.$content&&(e.$content.className="glare-content glare-content--error",e.$content.innerHTML=g(s.errorTpl,i))}function it(e,t){return typeof e.toolbar=="boolean"?e.toolbar:t.type==="image"}function Jt(e,t){return typeof e.smallBtn=="boolean"?e.smallBtn:!it(e,t)}function te(e,t,s,i,n,o){const{container:r,toolbar:a,infobar:l}=e;ae(r,i.type),a&&ee(a,t,i),se(r,i),l&&ie(l,i.index,n),e.caption&&ne(e.caption,o),oe(r,t,i.index,n),re(r,s,i,n)}function ee(e,t,s){if(t.toolbar===!1)return;e.classList.remove("glare-toolbar--expanded"),e.querySelector("[data-glare-more]")?.setAttribute("aria-expanded","false");const i=it(t,s);if(e.classList.toggle(T,!i),!i)return;const n=s.type==="image";h("[data-glare-zoom]",e)?.classList.toggle(T,!n)}function se(e,t){const s=e.querySelector("[data-glare-download]");if(!s)return;const i=t.downloadSrc||(t.type==="image"?t.src:"");s.classList.toggle(T,!i),i&&(s.href=i)}function ie(e,t,s){const i=h(".glare-infobar-index",e);i&&(i.textContent=`${t+1} / ${s}`)}function ne(e,t){e.innerHTML=t,e.classList.toggle(T,!t)}function oe(e,t,s,i){const n=!t.loop&&s===0,o=!t.loop&&s===i-1;nt(h("[data-glare-prev]",e),n),nt(h("[data-glare-next]",e),o)}function nt(e,t){e&&(e.classList.toggle("glare-is-disabled",t),e.setAttribute("aria-disabled",String(t)))}function re(e,t,s,i){const n=R(s.caption)||s.alt||t.LIGHTBOX,o=i>1?`${n} (${s.index+1} of ${i})`:n;e.setAttribute("aria-label",o);const r=h(".glare-live",e);r&&(r.textContent=o)}function ae(e,t){const s=e.dataset.type;s&&e.classList.remove(`glare-type-${s}`),e.dataset.type=t,e.classList.add(`glare-type-${t}`)}function le(e,t,s,i){e.classList.toggle("glare-can-zoom-out",s),e.classList.toggle("glare-can-zoom-in",!s&&i);const n=h("[data-glare-zoom]",e),o=s?"out":"in";!n||n.dataset.state===o||(n.dataset.state=o,F(n,s,s?t.ZOOM_OUT:t.ZOOM,s?c.zoomOut:c.zoomIn))}function F(e,t,s,i){e.setAttribute("title",s),e.setAttribute("aria-label",s),e.innerHTML=i,e.classList.toggle("glare-is-active",t)}class ce{constructor(t,s,i){this.glare=t,this.container=s,this.offs=[f(document,"fullscreenchange",()=>this.sync()),f(document,"webkitfullscreenchange",()=>this.sync())],i.autoStart&&this.request()}isFullscreen(){const t=document;return!!(t.fullscreenElement??t.webkitFullscreenElement)}request(){const t=this.container;(t.requestFullscreen??t.webkitRequestFullscreen)?.call(t)}exit(){if(!this.isFullscreen())return;const t=document;(t.exitFullscreen??t.webkitExitFullscreen)?.call(document)}toggle(){this.isFullscreen()?this.exit():this.request()}destroy(){this.exit(),this.offs.forEach(t=>t())}sync(){const t=this.isFullscreen();this.container.classList.toggle("glare-is-fullscreen",t);const s=h("[data-glare-fullscreen]",this.container);if(!s)return;const{dict:i}=this.glare;F(s,t,t?i.FULL_SCREEN_EXIT:i.FULL_SCREEN,t?c.fullscreenExit:c.fullscreen)}}function ot(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function H(...e){const t={};for(const s of e)if(s)for(const[i,n]of Object.entries(s)){if(n===void 0)continue;const o=t[i];t[i]=ot(n)?H(ot(o)?o:{},n):n}return t}function w(e,t,s){return Math.min(s,Math.max(t,e))}const L=1,P=5,he=1.01;class ue{constructor(t){this.target=t,this.scale=L,this.x=0,this.y=0}get isZoomed(){return this.scale>he}get state(){return{scale:this.scale,x:this.x,y:this.y}}center(){const t=this.target.image();if(!t)return null;const s=t.getBoundingClientRect();return{x:s.left+s.width/2-this.x,y:s.top+s.height/2-this.y}}apply(t,s,i,n=0){const o=this.target.image();if(!o)return;this.scale=w(t,L,P);const r=this.isZoomed?this.bounded(s,i):{x:0,y:0};this.x=r.x,this.y=r.y,o.style.transitionDuration=`${n}ms`,o.style.transform=`translate3d(${this.x}px, ${this.y}px, 0) scale(${this.scale})`,this.target.onChange(this.isZoomed)}toFit(t=300){this.apply(L,0,0,t)}toActual(t,s=300){const i=this.target.image(),n=this.center();if(!i||!n)return;const o=i.naturalWidth/Math.max(i.offsetWidth,1),r=w(Math.max(o,1.5),L,P),a=t?.x??n.x,l=t?.y??n.y;this.apply(r,(n.x-a)*(r-1),(n.y-l)*(r-1),s)}reset(){const t=this.target.image();t&&(t.style.transform="",t.style.transitionDuration=""),this.scale=L,this.x=0,this.y=0,this.target.onChange(!1)}bounded(t,s){const i=this.target.image(),n=this.target.stage();if(!i||!n)return{x:t,y:s};const o=Math.max(0,(i.offsetWidth*this.scale-n.clientWidth)/2),r=Math.max(0,(i.offsetHeight*this.scale-n.clientHeight)/2);return{x:w(t,-o,o),y:w(s,-r,r)}}}const de=6,rt=120,fe=100,pe=.5,me=80,ge=.4,be="a, button, input, textarea, select, video, .glare-thumbs",at=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y),lt=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2}),z=e=>({x:e.clientX,y:e.clientY});class ye{constructor(t,s){this.stage=t,this.host=s,this.pointers=new Map,this.mode="idle",this.moved=!1,this.start=[],this.startTime=0,this.startZoom={scale:1,x:0,y:0},this.startMid={x:0,y:0},this.startDistance=0,this.offs=[f(t,"pointerdown",i=>this.onDown(i)),f(window,"pointermove",i=>this.onMove(i),{passive:!1}),f(window,"pointerup",i=>this.onUp(i)),f(window,"pointercancel",i=>this.onUp(i))]}destroy(){this.offs.forEach(t=>t()),this.pointers.clear()}consumeMoved(){const t=this.moved;return this.moved=!1,t}onDown(t){t.pointerType==="mouse"&&t.button!==0||t.target.closest(be)||(this.pointers.set(t.pointerId,z(t)),this.pointers.size<=2&&this.begin())}onMove(t){this.pointers.has(t.pointerId)&&(this.pointers.set(t.pointerId,z(t)),this.move(t))}onUp(t){this.pointers.has(t.pointerId)&&(this.pointers.delete(t.pointerId),this.pointers.size===0?this.end(z(t)):this.begin())}begin(){this.mode==="swipe"&&this.releaseStage();const t=[...this.pointers.values()];this.start=t,this.startTime=performance.now(),this.startZoom=this.host.zoom.state,this.mode=t.length>=2?"pinch":"idle",t.length>=2&&(this.startDistance=at(t[0],t[1]),this.startMid=lt(t[0],t[1]))}move(t){const s=[...this.pointers.values()];if(!this.start.length||!s.length)return;if(this.mode==="pinch"&&s.length>=2){t.preventDefault(),this.moved=!0,this.pinch(s[0],s[1]);return}const i=s[0].x-this.start[0].x,n=s[0].y-this.start[0].y;if(!(!this.moved&&Math.hypot(i,n)<de)){if(this.moved=!0,this.mode==="idle"&&(this.mode=this.host.zoom.isZoomed&&this.host.canPan()?"pan":"swipe"),this.mode==="pan")t.preventDefault(),this.host.zoom.apply(this.startZoom.scale,this.startZoom.x+i,this.startZoom.y+n);else if(this.mode==="swipe"){const o=this.host.touch.vertical!==!1;if(!o&&Math.abs(n)>Math.abs(i))return;t.preventDefault(),this.dragStage(i,o?n:0)}}}pinch(t,s){const{zoom:i}=this.host,n=lt(t,s),o=i.center()??n,r=w(this.startZoom.scale*at(t,s)/(this.startDistance||1),L,P),a=(this.startMid.x-o.x-this.startZoom.x)/this.startZoom.scale,l=(this.startMid.y-o.y-this.startZoom.y)/this.startZoom.scale;i.apply(r,n.x-o.x-r*a,n.y-o.y-r*l)}end(t){if(!this.start.length)return;const s=Math.max(performance.now()-this.startTime,1),i=t.x-this.start[0].x,n=t.y-this.start[0].y,o={x:i/s,y:n/s};if(this.mode==="swipe")this.releaseStage(),this.finishSwipe(i,n,o);else if(this.mode==="pan"&&this.host.touch.momentum!==!1){const{zoom:r}=this.host;r.apply(r.scale,r.x+o.x*rt,r.y+o.y*rt,250)}this.mode="idle",this.start=[],this.moved&&setTimeout(()=>this.moved=!1,0)}dragStage(t,s){this.stage.style.transitionDuration="0ms",this.stage.style.transform=`translate3d(${t}px, ${s}px, 0)`;const{bg:i}=this.host;i&&(i.style.transitionDuration="0ms",i.style.opacity=String(w(1-Math.abs(s)/400,.35,1)))}releaseStage(){this.stage.style.transitionDuration="",this.stage.style.transform="";const{bg:t}=this.host;t&&(t.style.transitionDuration="",t.style.opacity="")}finishSwipe(t,s,i){if(Math.abs(s)>Math.abs(t)){(Math.abs(s)>fe||Math.abs(i.y)>pe)&&this.host.close();return}(Math.abs(t)>me||Math.abs(i.x)>ge)&&(t<0?this.host.next():this.host.prev())}}const xe=/^(.+)-(\d+)$/;function _(e=window.location.hash){const t=e.replace(/^#/,"").match(xe);return t?{gallery:t[1],index:Math.max(0,parseInt(t[2],10)-1)}:null}function ct(e,t){return`${e}-${t+1}`}class ve{constructor(t,s){this.glare=t,this.gallery=s,this.pushed=!1,this.off=f(window,"hashchange",()=>this.onHashChange());const i=ct(s,t.currIndex);ht()!==i&&(window.history.pushState(null,"",`#${i}`),this.pushed=!0)}update(t=this.glare.currIndex){const s=ct(this.gallery,t);ht()!==s&&this.replace(`#${s}`)}destroy(){this.off(),_()?.gallery===this.gallery&&(this.pushed?window.history.back():this.replace(""))}onHashChange(){const t=_();!t||t.gallery!==this.gallery?(this.pushed=!1,this.glare.close()):t.index!==this.glare.currIndex&&this.glare.jumpTo(t.index)}replace(t){const{pathname:s,search:i}=window.location;window.history.replaceState(null,"",`${s}${i}${t}`)}}const ht=()=>window.location.hash.replace(/^#/,"");class we{constructor(t,s,i){this.glare=t,this.container=s,this.opts=i,this.timer=null,this.active=!1,this.bar=h(".glare-progress",s),this.button=h("[data-glare-slideshow]",s),i.autoStart&&this.start()}isActive(){return this.active}start(){this.glare.group.length<2||(this.active=!0,this.container.classList.add("glare-is-slideshow"),this.syncButton(),this.schedule())}stop(){this.active=!1,this.clearTimer(),this.setProgress(0,!0),this.container.classList.remove("glare-is-slideshow"),this.syncButton()}toggle(){this.active?this.stop():this.start()}onIndexChange(){this.active&&this.schedule()}destroy(){this.stop()}get speed(){return this.opts.speed??D.speed}get atEnd(){return!this.glare.opts.loop&&this.glare.currIndex===this.glare.group.length-1}schedule(){this.clearTimer(),this.setProgress(0),Q()||(this.bar?.offsetWidth,this.setProgress(1)),this.timer=setTimeout(()=>this.atEnd?this.stop():this.glare.next(),this.speed)}clearTimer(){this.timer&&clearTimeout(this.timer),this.timer=null}setProgress(t,s=!1){this.bar&&(this.bar.hidden=s,this.bar.style.transitionDuration=t?`${this.speed}ms`:"0ms",this.bar.style.transform=`scaleX(${t})`)}syncButton(){if(!this.button)return;const{dict:t}=this.glare;F(this.button,this.active,this.active?t.PLAY_STOP:t.PLAY_START,this.active?c.pause:c.play)}}const Ee={image:c.thumbImage,video:c.thumbVideo,embed:c.thumbEmbed,iframe:c.thumbIframe,inline:c.thumbInline,ajax:c.thumbAjax,html:c.thumbHtml};function Te(e){return e.thumb||(e.type==="video"?e.poster:"")||(e.type==="image"?e.src:"")}function ut(e,t){e.classList.add("glare-thumbs-item--placeholder"),e.innerHTML=Ee[t]??c.thumbSlide}class Se{constructor(t,s,i){this.glare=t,this.container=s,this.opts=i,this.isActive=!1,this.offs=[],this.axis=i.axis==="y"?"y":"x",this.list=m("div","glare-thumbs-list"),this.strip=m("div",`glare-thumbs glare-thumbs--${this.axis}`),this.strip.style.setProperty("--glare-thumbs-fit",i.fit??"cover"),this.strip.appendChild(this.list),this.build()}show(){this.setActive(!0)}hide(){this.setActive(!1)}toggle(){this.setActive(!this.isActive)}focus(t=this.glare.currIndex){for(const s of $(".glare-thumbs-item",this.list))s.classList.toggle("glare-is-active",Number(s.dataset.index)===t);this.list.querySelector(".glare-is-active")?.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}destroy(){this.offs.forEach(t=>t()),this.offs=[],this.container.classList.remove(`glare-thumbs-axis-${this.axis}`),this.strip.remove()}setActive(t){this.isActive=t,this.strip.classList.toggle("glare-thumbs--active",t),this.container.classList.toggle("glare-show-thumbs",t);const s=h("[data-glare-thumbs]",this.container);s?.classList.toggle("glare-is-active",t),s?.setAttribute("aria-expanded",String(t))}build(){const{group:t,dict:s}=this.glare;if(t.length<2)return;this.container.classList.add(`glare-thumbs-axis-${this.axis}`);for(const n of t){const o=m("button","glare-thumbs-item");o.type="button",o.dataset.index=String(n.index),o.setAttribute("aria-label",g(s.GO_TO_SLIDE,{index:String(n.index+1)}));const r=Te(n);if(r){const a=m("img");a.src=r,a.alt=n.alt||R(n.caption),a.loading="lazy",a.onerror=()=>ut(o,n.type),o.appendChild(a)}else ut(o,n.type);this.list.appendChild(o),this.offs.push(f(o,"click",()=>this.glare.jumpTo(n.index)))}(X(this.opts.parentEl,this.container)??this.container).appendChild(this.strip),this.opts.autoStart&&this.show(),this.focus()}}const Le=40,Me=150,Ce=16;class $e{constructor(t,s){this.distance=0,this.fired=!1,this.settle=null,this.off=f(t,"wheel",i=>{const n=s.current();!n||i.deltaY===0||s.mode==="auto"&&n.type!=="image"||n.type==="image"&&s.isZoomed()||(i.preventDefault(),this.restartSettle(),!this.fired&&(this.distance+=Ie(i,t),!(Math.abs(this.distance)<Le)&&(this.fired=!0,this.distance>0?s.next():s.prev())))},{passive:!1})}destroy(){this.settle&&clearTimeout(this.settle),this.off()}restartSettle(){this.settle&&clearTimeout(this.settle),this.settle=setTimeout(()=>{this.distance=0,this.fired=!1},Me)}}function Ie(e,t){return e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*Ce:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*t.clientHeight:e.deltaY}function I(e){const t=Q(),s=t||!e.animationEffect?0:Math.max(0,e.animationDuration),i=t||!e.transitionEffect?0:Math.max(0,e.transitionDuration);return{animationEffect:s?e.animationEffect:!1,animationDuration:s,transitionEffect:i?e.transitionEffect:!1,transitionDuration:i}}function Oe(e,t){const s=I(t);e.dataset.animation=s.animationEffect||"none",e.style.setProperty("--glare-duration",`${s.animationDuration}ms`),e.style.setProperty("--glare-transition-duration",`${s.transitionDuration}ms`)}function Ae(e,t){e.dataset.transition=I(t).transitionEffect||"none"}const De=/^(top|center|bottom)-(left|center|right)$/,dt={top:0,left:0,center:.5,bottom:1,right:1};function ke(e,t,s){const i=typeof s=="string"?De.exec(s):null;if(i){const u=e.getBoundingClientRect(),x=u.left+u.width*dt[i[2]],C=u.top+u.height*dt[i[1]];return new DOMRect(x,C,0,0)}const n=u=>u?.getClientRects().length?u:null,o=s!=="trigger"&&n(X(s))||n(t.$trigger);if(!o)return null;const r=o.getBoundingClientRect(),l=(o.ownerDocument===e.ownerDocument?null:o.ownerDocument.defaultView?.frameElement)?.getBoundingClientRect();return l?new DOMRect(r.x+l.x,r.y+l.y,r.width,r.height):r}function Re(e,t,s){const i=t.$image;if(e.dataset.animation!=="zoom"||!i)return;const n=ke(e,t,s.anchor);if(!n)return;const o=i.getBoundingClientRect(),r=Math.max(n.width/Math.max(o.width,1),n.height/Math.max(o.height,1)),a=n.left+n.width/2-(o.left+o.width/2),l=n.top+n.height/2-(o.top+o.height/2);Object.assign(i.style,{transform:`translate3d(${a}px, ${l}px, 0) scale(${r})`,opacity:s.zoomOpacity?"0.2":"1",transitionDuration:"0ms"}),K(()=>{Object.assign(i.style,{transform:"",opacity:"",transitionDuration:""})})}function ft(e){const t=H(k,e);return Zt()&&t.mobile?H(t,t.mobile):t}function N(e,t){return e?e===!0?{...t}:{...t,...e}:null}const O=[],Z=e=>e.getAttribute("data-glare")??"";function Fe(e){return typeof e=="string"?$(e):e instanceof HTMLElement?[e]:Array.from(e)}function He(e,t,s){const i=Fe(e),n=a=>{const l=Z(a),u=l?i.filter(x=>Z(x)===l):[a];s(u,u.indexOf(a),l)},o=i.map(a=>f(a,"click",l=>{l.preventDefault(),n(a)})),r={elements:i,destroy(){o.forEach(l=>l());const a=O.indexOf(r);a>=0&&O.splice(a,1)}};return O.push(r),ft(t).hash&&ze(i,n),r}function Pe(){for(const e of[...O])e.destroy()}function ze(e,t){const s=_();if(!s)return;const n=e.filter(o=>Z(o)===s.gallery)[s.index];n&&t(n)}class _e{constructor(t,s){this.seconds=t,this.onIdle=s,this.timer=null}reset(){this.stop(),this.seconds&&(this.timer=setTimeout(this.onIdle,this.seconds*1e3))}stop(){this.timer&&clearTimeout(this.timer),this.timer=null}}const E=[],b={add(e){E.push(e)},remove(e){const t=E.indexOf(e);t>=0&&E.splice(t,1)},top(){return E[E.length-1]??null},get(e){return E.find(t=>t.id===e)??null},all(){return[...E]},get size(){return E.length}},Ne=[["[data-glare-close]",e=>e.close()],["[data-glare-next]",e=>e.next()],["[data-glare-prev]",e=>e.prev()],["[data-glare-zoom]",e=>e.toggleZoom()],["[data-glare-slideshow]",e=>e.slideshow?.toggle()],["[data-glare-thumbs]",e=>e.thumbs?.toggle()],["[data-glare-fullscreen]",e=>e.fullscreen?.toggle()]],Ze=".glare-content",je=".glare-slide, .glare-stage",qe='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',Be=new Set(["INPUT","TEXTAREA","SELECT"]),We=300;function Ue(e,t,s){let i=null;const n=()=>{i&&clearTimeout(i),i=null},o=[f(t,"click",r=>{if(e.consumeGesture())return;const a=r.target,l=a.closest("[data-glare-more]");if(l){const A=l.closest(".glare-toolbar"),vt=!A?.classList.contains("glare-toolbar--expanded");A?.classList.toggle("glare-toolbar--expanded",vt),l.setAttribute("aria-expanded",String(vt));return}mt(t);const u=a.closest("[data-glare-custom]");if(u)return Ve(e,u.dataset.glareCustom,r);const x=Ne.find(([A])=>a.closest(A));if(x)return x[1](e);if(a.closest(".glare-button"))return;const C=j(e,a,"click");if(C){if(!pt(e,j(e,a,"dblclick"),r))return q(e,C,r);n(),i=setTimeout(()=>q(e,C,r),We)}}),f(t,"dblclick",r=>{n();const a=r.target;a.closest(".glare-button")||q(e,j(e,a,"dblclick"),r)}),f(document,"keydown",r=>Ge(e,r)),f(document,"keydown",s),f(document,"click",s,{capture:!0}),f(document,"mousemove",s),f(document,"touchstart",s,{passive:!0})];return e.opts.trapFocus&&o.push(f(t,"keydown",r=>Xe(t,r))),e.opts.protect&&o.push(f(t,"contextmenu",r=>r.preventDefault()),f(t,"dragstart",r=>{r.target.tagName==="IMG"&&r.preventDefault()})),()=>{n(),o.forEach(r=>r())}}function Ve(e,t,s){const i=e.opts.buttons.find(n=>typeof n!="string"&&n.name===t);i&&e.current&&i.click(e,e.current,s)}function j(e,t,s){const{opts:i}=e;if(t.closest(Ze))return s==="click"?i.clickContent:i.dblclickContent;if(!(i.modal||!t.closest(je)))return s==="click"?i.clickSlide:i.dblclickSlide}function pt(e,t,s){return!t||!e.current?!1:typeof t=="function"?t(e.current,s):t}function q(e,t,s){switch(pt(e,t,s)){case"close":return e.close();case"next":return e.next();case"nextOrClose":return e.currIndex===e.group.length-1&&!e.opts.loop?e.close():e.next();case"toggleControls":return e.toggleControls();case"zoom":{const i=s instanceof MouseEvent?{x:s.clientX,y:s.clientY}:void 0;return e.toggleZoom(i)}}}function Ge(e,t){if(b.top()!==e)return;if(t.key==="Escape"&&mt(e.$refs?.container??null)){t.preventDefault();return}if(!e.opts.keyboard||e.opts.modal)return;const s=t.target;if(!Be.has(s.tagName)&&!(t.key===" "&&s.closest("button")))switch(t.key){case"Escape":return t.preventDefault(),e.close();case"ArrowRight":case"ArrowDown":return t.preventDefault(),e.next();case"ArrowLeft":case"ArrowUp":return t.preventDefault(),e.prev();case" ":return t.preventDefault(),e.slideshow?.toggle();case"f":case"F":return e.fullscreen?.toggle()}}function mt(e){const t=e?.querySelector(".glare-toolbar--expanded");return t?(t.classList.remove("glare-toolbar--expanded"),t.querySelector("[data-glare-more]")?.setAttribute("aria-expanded","false"),!0):!1}function Xe(e,t){if(t.key!=="Tab")return;const s=$(qe,e).filter(o=>!o.hasAttribute("disabled")&&o.offsetParent!==null&&getComputedStyle(o).visibility!=="hidden");if(!s.length)return;const i=s[0],n=s[s.length-1];t.shiftKey&&document.activeElement===i?(t.preventDefault(),n.focus()):!t.shiftKey&&document.activeElement===n&&(t.preventDefault(),i.focus())}const Ye=1200,gt=16/9;function Ke(e,t,s){if(t&&s)return t/s;const i=String(e.ratio||gt).replace(":","/"),[n,o="1"]=i.split("/").map(l=>l.trim()),r=parseFloat(n),a=parseFloat(o);return r>0&&a>0?r/a:gt}function bt(e,t,s){if(!e)return 0;if(typeof e=="number")return e;const i=e.trim(),n=parseFloat(i);return n>0?i.endsWith("%")?t*n/100:i.endsWith("vw")||i.endsWith("vh")?s*n/100:n:0}function yt(e,t){const s=t.parentElement;if(!s)return;const i=getComputedStyle(s),n=s.clientWidth-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight),o=s.clientHeight-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom);if(!(n>0&&o>0))return;const r=e.width!==void 0&&e.height!==void 0;let a=r?bt(e.width,n,innerWidth):n,l=r?bt(e.height,o,innerHeight):o;const u=Ke(e,r?a:void 0,r?l:void 0),x=Math.min(1,n/a,o/l);a*=x,l*=x,l>a/u?l=a/u:a>l*u&&(a=l*u),t.style.width=`${a}px`,t.style.height=`${l}px`,t.style.aspectRatio=String(u)}function Qe(e,t){if(yt(e,t),typeof ResizeObserver>"u"||!t.parentElement)return;const s=new ResizeObserver(()=>{if(!t.isConnected)return s.disconnect();yt(e,t)});s.observe(t.parentElement)}const Je=(e,t,s)=>new Promise((i,n)=>{const o=m("img","glare-image");o.alt=e.alt||R(e.caption),o.decoding="async",o.draggable=!1,s.protect&&(o.style.pointerEvents="none"),o.onload=()=>{e.$image=o,e.contentWidth=o.naturalWidth,e.contentHeight=o.naturalHeight,t.appendChild(o),i()},o.onerror=()=>n(new Error(`Failed to load image: ${e.src}`)),o.src=e.src}),ts=(e,t,s,i)=>{const n=e.format||s.video.format||Ht(e.src);t.innerHTML=g(s.video.tpl,{...i,src:e.src,format:n,poster:e.poster??""});const o=t.querySelector("video");o&&(e.autoStart??s.video.autoStart)&&o.play().catch(()=>{})},xt=(e,t,s)=>new Promise(i=>{const n=s.iframe,o=m("div","glare-iframe-wrap",n.tpl),r=o.querySelector("iframe");if(!r)throw new Error("Iframe template must contain an <iframe>");for(const[a,l]of Object.entries(n.attr))r.setAttribute(a,l);if(Object.assign(r.style,n.css),t.appendChild(o),e.type==="embed"?Qe(e,t):(e.width&&(o.style.width=Y(e.width)),e.height&&(o.style.height=Y(e.height))),!n.preload){r.src=e.src,i();return}r.onload=()=>i(),r.src=e.src,setTimeout(i,Ye)}),es={image:Je,video:ts,embed:xt,iframe:xt,inline:(e,t)=>{const s=e.src?h(e.src):null;if(!s)throw new Error(`Inline target not found: ${e.src}`);const i=s.cloneNode(!0);i.removeAttribute("id"),i.hidden=!1,i.style.display="",t.appendChild(i)},ajax:async(e,t,s)=>{const i=await fetch(e.src,s.ajax.settings);if(!i.ok)throw new Error(`Request failed: ${i.status} ${e.src}`);t.innerHTML=await i.text()},html:(e,t)=>{e.content&&typeof e.content=="object"?t.appendChild(e.content):t.innerHTML=e.html??e.content??e.src}};async function ss(e,t,s,i){t.innerHTML="",t.className=`glare-content glare-content--${e.type}`,await es[e.type](e,t,s,i),e.isLoaded=!0}function is(e,t){for(const s of[e[t-1],e[t+1]])s?.type==="image"&&s.src&&(new Image().src=s.src)}let ns=0;function os(e){try{return e?.Glare}catch{return}}const y=class y{constructor(t,s={},i=0,n=""){this.id=++ns,this.current=null,this.currIndex=0,this.prevIndex=0,this.isActive=!1,this.isClosing=!1,this.isIdle=!1,this.$refs=null,this.hash=null,this.gestures=null,this.wheel=null,this.cleanups=[],this.captionTracker=null,this.previouslyFocused=null,this.direction=1,this.opts=ft(s),this.dict=M(this.opts),this.group=zt(t,this.opts),this.galleryName=n,this.currIndex=this.clampIndex(i),this.zoom=new ue({image:()=>this.current?.$image??null,stage:()=>this.$refs?.stage??null,onChange:o=>this.syncZoomState(o)}),this.idle=new _e(this.opts.modal?!1:this.opts.idleTime,()=>this.toggleControls(!0))}open(t=this.currIndex){if(this.isActive)return this.jumpTo(t);if(!this.group.length)return;this.opts.closeExisting&&y.close(!0),this.currIndex=this.clampIndex(t),this.current=this.group[this.currIndex],this.previouslyFocused=document.activeElement instanceof HTMLElement?document.activeElement:null,this.emit("onInit");const s=jt(this.opts,this.dict,this.id,this.group.length),{container:i}=s;i.classList.add("glare-is-loading"),this.$refs=s,Oe(i,this.opts),this.syncChrome(),this.resolveParent().appendChild(i),this.captionTracker=Ut(s),this.cleanups.push(()=>this.captionTracker?.destroy()),this.isActive=!0,b.add(this),this.opts.hideScrollbar&&et(!0),this.emit("onActivate"),this.emitSlide("beforeShow",this.current),K(()=>{this.isActive&&(i.classList.add("glare-is-open"),this.showSlide(this.currIndex,!0),this.cleanups.push(Ue(this,i,()=>this.onActivity())),this.startModules(s),this.opts.autoFocus&&this.focus(),this.idle.reset())})}close(){if(!this.isActive||this.isClosing||!this.current||!this.$refs||this.emitSlide("beforeClose",this.current)===!1)return;this.isClosing=!0,this.slideshow?.stop(),this.idle.stop();const{container:t,bg:s}=this.$refs,i=I(this.opts).animationDuration;if(i===0)return this.teardown();t.classList.remove("glare-is-open"),t.classList.add("glare-is-closing"),Nt(s??t,i,()=>this.teardown())}next(){this.jumpTo(this.currIndex+1)}prev(){this.jumpTo(this.currIndex-1)}jumpTo(t){if(!this.isActive||this.isClosing)return;const s=this.group.length,i=this.opts.loop?(t%s+s)%s:w(t,0,s-1);i!==this.currIndex&&(this.direction=t>this.currIndex?1:-1,this.prevIndex=this.currIndex,this.currIndex=i,this.zoom.reset(),this.current=this.group[i],this.$refs?.container.classList.add("glare-is-loading"),this.syncChrome(),this.showSlide(i,!1),this.thumbs?.focus(i),this.hash?.update(i),this.slideshow?.onIndexChange(),this.emitSlide("onUpdate",this.current))}toggleZoom(t){this.current?.type==="image"&&(this.zoom.isZoomed?this.zoom.toFit():this.zoom.toActual(t))}update(){this.syncChrome()}focus(){this.$refs?.container.focus({preventScroll:!0})}toggleControls(t){this.$refs&&(this.isIdle=t??!this.isIdle,this.$refs.container.classList.toggle("glare-is-idle",this.isIdle))}consumeGesture(){return this.gestures?.consumeMoved()??!1}async showSlide(t,s){const i=this.group[t];if(!this.$refs||!i)return;const{container:n,stage:o}=this.$refs,r=Vt(o,i,this.opts);Jt(this.opts,i)&&Xt(r,this.opts,this.dict),s||st(o,r,0,this.direction),Yt(o,this.opts,this.dict),this.emitSlide("beforeLoad",i),this.opts.image.preload&&is(this.group,t);let a=!1;try{await ss(i,i.$content,this.opts,this.dict)}catch(l){a=!0,Qt(i,l,this.opts,this.dict),this.emitSlide("onError",i),this.opts.onError||console.warn("[glare]",l)}if(!this.isActive||this.currIndex!==t)return r.remove();a||this.emitSlide("afterLoad",i),Kt(o),s||Ae(n,this.opts),Gt(r,s,this.direction),this.captionTracker?.follow(r),n.classList.remove("glare-is-loading"),st(o,r,I(this.opts).transitionDuration,this.direction),this.syncZoomState(this.zoom.isZoomed),!a&&(s&&Re(n,i,this.opts),this.emitSlide("afterShow",i))}syncChrome(){!this.$refs||!this.current||(te(this.$refs,this.opts,this.dict,this.current,this.group.length,this.captionFor(this.current)),this.syncZoomState(this.zoom.isZoomed))}captionFor(t){const{caption:s}=this.opts;return typeof s=="function"?s(this,t):s??t.caption}syncZoomState(t){this.$refs&&le(this.$refs.container,this.dict,t,!!this.current?.$image)}resolveParent(){const{parentEl:t}=this.opts;return(typeof t=="string"?document.querySelector(t):t)??document.body}startModules({container:t,stage:s,bg:i}){const n=this.opts,o=N(n.thumbs,U);o&&(this.thumbs=new Se(this,t,o));const r=N(n.slideshow,D);r&&(this.slideshow=new we(this,t,r));const a=N(n.fullscreen,V);a&&J()&&(this.fullscreen=new ce(this,t,a)),n.hash&&this.galleryName&&(this.hash=new ve(this,this.galleryName)),n.wheel&&(this.wheel=new $e(s,{mode:n.wheel,current:()=>this.current,isZoomed:()=>this.zoom.isZoomed,next:()=>this.next(),prev:()=>this.prev()})),n.touch&&(this.gestures=new ye(s,{zoom:this.zoom,touch:n.touch,bg:i,canPan:()=>this.current?.type==="image",close:()=>this.close(),next:()=>this.next(),prev:()=>this.prev()}))}onActivity(){this.isIdle&&this.toggleControls(!1),this.idle.reset()}teardown(){for(const t of[this.gestures,this.wheel,this.hash,this.thumbs,this.slideshow,this.fullscreen])t?.destroy();this.gestures=this.wheel=this.hash=null,this.thumbs=this.slideshow=this.fullscreen=void 0,this.cleanups.forEach(t=>t()),this.cleanups=[],this.$refs?.container.remove(),this.$refs=null,b.remove(this),this.opts.hideScrollbar&&b.size===0&&et(!1),this.opts.backFocus&&(this.current?.$trigger??this.previouslyFocused)?.focus({preventScroll:!0}),this.isActive=!1,this.isClosing=!1,this.current&&this.emitSlide("afterClose",this.current)}emit(t){return this.opts[t]?.(this)}emitSlide(t,s){return this.opts[t]?.(this,s)}clampIndex(t){return w(t,0,Math.max(0,this.group.length-1))}static open(t,s={},i=0){const n=y.create(t,s,i);return n.open(),n}static bind(t,s={}){return He(t,s,(i,n,o)=>{y.create(i,s,n,o).open()})}static create(t,{delegate:s=k.delegate,...i},n,o=""){return new(os(s)??y)(t,i,n,o)}static close(t=!1){t?b.all().reverse().forEach(s=>s.close()):b.top()?.close()}static getInstance(t){return t==null?b.top():b.get(t)}static getInstances(){return b.all()}static destroy(){y.close(!0),Pe()}static autoBind(t={}){const s=()=>y.bind("[data-glare]",t);document.readyState==="loading"?document.addEventListener("DOMContentLoaded",s,{once:!0}):s()}};y.defaults=k;let B=y;return B}));
|
|
17
17
|
//# sourceMappingURL=glare.js.map
|