@redot-src/glare 1.3.0 → 1.4.0

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.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- const ot = {
1
+ const at = {
2
2
  CLOSE: "Close",
3
3
  NEXT: "Next",
4
4
  PREV: "Previous",
@@ -17,20 +17,20 @@ const ot = {
17
17
  ZOOM: "Zoom",
18
18
  ZOOM_OUT: "Zoom out"
19
19
  };
20
- function yt(e) {
20
+ function xt(e) {
21
21
  const t = e.lang ?? "en";
22
- return { ...ot, ...e.i18n?.en, ...e.i18n?.[t] };
22
+ return { ...at, ...e.i18n?.en, ...e.i18n?.[t] };
23
23
  }
24
- function b(e, t) {
24
+ function x(e, t) {
25
25
  return e.replace(/\{\{(\w+)\}\}/g, (s, i) => t[i] ?? "");
26
26
  }
27
27
  function vt(e) {
28
28
  return Object.entries(e).map(([t, s]) => `${encodeURIComponent(t)}=${encodeURIComponent(String(s))}`).join("&");
29
29
  }
30
- function xt(e, t) {
30
+ function wt(e, t) {
31
31
  return e.replace(/\$(\d+)/g, (s, i) => t[Number(i)] ?? "");
32
32
  }
33
- const wt = {
33
+ const Et = {
34
34
  youtube: {
35
35
  matcher: /(?:youtube\.com|youtu\.be|youtube-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/\w\/|embed\/|shorts\/)?([\w-]{11})/i,
36
36
  type: "embed",
@@ -50,8 +50,8 @@ const wt = {
50
50
  url: (e) => {
51
51
  const [, t, s, i, n] = e;
52
52
  if (s) {
53
- const [r, a, l] = s.split(","), d = l ? Math.floor(parseFloat(l)) : 14;
54
- return `https://maps.google.${t}/maps?ll=${r},${a}&z=${d}&output=embed`;
53
+ const [r, a, l] = s.split(","), u = l ? Math.floor(parseFloat(l)) : 14;
54
+ return `https://maps.google.${t}/maps?ll=${r},${a}&z=${u}&output=embed`;
55
55
  }
56
56
  const o = encodeURIComponent(decodeURIComponent(i || n || ""));
57
57
  return `https://maps.google.${t}/maps?q=${o}&output=embed`;
@@ -60,9 +60,9 @@ const wt = {
60
60
  };
61
61
  function q(e, t, s) {
62
62
  if (typeof e == "function") return e(t, s);
63
- if (typeof e == "string") return xt(e, t);
63
+ if (typeof e == "string") return wt(e, t);
64
64
  }
65
- function Et(e, t) {
65
+ function Tt(e, t) {
66
66
  for (const s of Object.values(t ?? {})) {
67
67
  const i = e.match(s.matcher);
68
68
  if (!i) continue;
@@ -75,20 +75,28 @@ function Et(e, t) {
75
75
  }
76
76
  return null;
77
77
  }
78
- const f = (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>`, u = {
79
- close: f('<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'),
80
- next: f('<path d="m9 18 6-6-6-6"/>'),
81
- prev: f('<path d="m15 18-6-6 6-6"/>'),
82
- zoomIn: f('<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/><path d="M11 8v6"/><path d="M8 11h6"/>'),
83
- zoomOut: f('<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/><path d="M8 11h6"/>'),
84
- download: f('<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"/>'),
85
- thumbs: f('<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M9 21V9"/>'),
86
- play: f('<polygon points="6 3 20 12 6 21 6 3"/>'),
87
- pause: f('<rect width="4" height="16" x="6" y="4"/><rect width="4" height="16" x="14" y="4"/>'),
88
- fullscreen: f('<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"/>'),
89
- fullscreenExit: f('<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"/>'),
90
- more: f('<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"/>')
91
- }, 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>`, Tt = `
78
+ 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 = {
79
+ close: d('<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'),
80
+ next: d('<path d="m9 18 6-6-6-6"/>'),
81
+ prev: d('<path d="m15 18-6-6 6-6"/>'),
82
+ 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"/>'),
83
+ zoomOut: d('<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/><path d="M8 11h6"/>'),
84
+ 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"/>'),
85
+ thumbs: d('<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M9 21V9"/>'),
86
+ play: d('<polygon points="6 3 20 12 6 21 6 3"/>'),
87
+ pause: d('<rect width="4" height="16" x="6" y="4"/><rect width="4" height="16" x="14" y="4"/>'),
88
+ 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"/>'),
89
+ 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"/>'),
90
+ 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"/>'),
91
+ 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"/>'),
92
+ thumbVideo: d('<rect x="3" y="5" width="18" height="14" rx="2"/><path d="m10 9 5 3-5 3Z"/>'),
93
+ thumbEmbed: d('<circle cx="12" cy="12" r="9"/><path d="m10 8 6 4-6 4Z"/>'),
94
+ 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"/>'),
95
+ thumbInline: d('<rect x="4" y="4" width="16" height="16" rx="2"/><path d="M8 8h8M8 12h8M8 16h5"/>'),
96
+ 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"/>'),
97
+ thumbHtml: d('<path d="m8 9-3 3 3 3M16 9l3 3-3 3M14 5l-4 14"/>'),
98
+ thumbSlide: d('<path d="M6 3h9l4 4v14H6Z"/><path d="M14 3v5h5M9 13h7M9 17h5"/>')
99
+ }, w = (e, t, s, i = "") => `<button type="button" class="glare-button glare-button--${e}" data-glare-${e} title="{{${t}}}" aria-label="{{${t}}}"${i}>${s}</button>`, St = `
92
100
  <div class="glare-container" role="dialog" aria-modal="true" tabindex="-1">
93
101
  <div class="glare-bg"></div>
94
102
  <div class="glare-progress" hidden></div>
@@ -97,31 +105,31 @@ const f = (e) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fi
97
105
  <div class="glare-infobar"><span class="glare-infobar-index"></span></div>
98
106
  <div class="glare-toolbar"></div>
99
107
  <div class="glare-navigation">
100
- ${v("prev", "PREV", u.prev)}
101
- ${v("next", "NEXT", u.next)}
108
+ ${w("prev", "PREV", c.prev)}
109
+ ${w("next", "NEXT", c.next)}
102
110
  </div>
103
111
  <div class="glare-stage"></div>
104
112
  <div class="glare-caption"></div>
105
113
  </div>
106
- </div>`, St = {
107
- zoom: v("zoom", "ZOOM", u.zoomIn),
108
- slideshow: v("slideshow", "PLAY_START", u.play),
109
- thumbs: v("thumbs", "THUMBS", u.thumbs, ' aria-expanded="false"'),
110
- fullscreen: v("fullscreen", "FULL_SCREEN", u.fullscreen),
111
- more: v("more", "MORE", u.more, ' aria-expanded="false" aria-haspopup="true"'),
112
- close: v("close", "CLOSE", u.close),
113
- download: `<a class="glare-button glare-button--download" data-glare-download download target="_blank" rel="noopener" title="{{DOWNLOAD}}" aria-label="{{DOWNLOAD}}">${u.download}</a>`,
114
- smallBtn: `<button type="button" class="glare-button glare-close-small" data-glare-close title="{{CLOSE}}" aria-label="{{CLOSE}}">${u.close}</button>`
115
- }, Lt = '<div class="glare-spinner" role="status" aria-label="{{LOADING}}"></div>', Mt = '<div class="glare-error"><p>{{ERROR}}</p></div>', Ct = '<video class="glare-video" controls playsinline controlsList="nodownload" poster="{{poster}}"><source src="{{src}}" type="{{format}}"/>{{VIDEO_UNSUPPORTED}}</video>', $t = '<iframe class="glare-iframe"></iframe>', rt = {
114
+ </div>`, Mt = {
115
+ zoom: w("zoom", "ZOOM", c.zoomIn),
116
+ slideshow: w("slideshow", "PLAY_START", c.play),
117
+ thumbs: w("thumbs", "THUMBS", c.thumbs, ' aria-expanded="false"'),
118
+ fullscreen: w("fullscreen", "FULL_SCREEN", c.fullscreen),
119
+ more: w("more", "MORE", c.more, ' aria-expanded="false" aria-haspopup="true"'),
120
+ close: w("close", "CLOSE", c.close),
121
+ download: `<a class="glare-button glare-button--download" data-glare-download download target="_blank" rel="noopener" title="{{DOWNLOAD}}" aria-label="{{DOWNLOAD}}">${c.download}</a>`,
122
+ smallBtn: `<button type="button" class="glare-button glare-close-small" data-glare-close title="{{CLOSE}}" aria-label="{{CLOSE}}">${c.close}</button>`
123
+ }, 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>', lt = {
116
124
  autoStart: !1,
117
125
  axis: "x",
118
126
  fit: "cover"
119
- }, _ = {
127
+ }, N = {
120
128
  autoStart: !1,
121
129
  speed: 3e3
122
- }, at = {
130
+ }, ct = {
123
131
  autoStart: !1
124
- }, lt = {
132
+ }, R = {
125
133
  closeExisting: !1,
126
134
  loop: !1,
127
135
  keyboard: !0,
@@ -161,38 +169,38 @@ const f = (e) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fi
161
169
  dblclickSlide: (e) => e.type === "image" ? "zoom" : !1
162
170
  },
163
171
  image: { preload: !1 },
164
- video: { tpl: Ct, format: "", autoStart: !0 },
172
+ video: { tpl: $t, format: "", autoStart: !0 },
165
173
  iframe: {
166
174
  preload: !0,
167
175
  css: {},
168
176
  attr: { allowfullscreen: "true", allow: "autoplay; fullscreen; picture-in-picture" },
169
- tpl: $t
177
+ tpl: It
170
178
  },
171
179
  ajax: { settings: { headers: { "X-Requested-With": "XMLHttpRequest" } } },
172
- media: wt,
180
+ media: Et,
173
181
  hash: !0,
174
- slideshow: _,
175
- thumbs: rt,
176
- fullscreen: at,
182
+ slideshow: N,
183
+ thumbs: lt,
184
+ fullscreen: ct,
177
185
  lang: "en",
178
- i18n: { en: ot },
179
- baseTpl: Tt,
180
- btnTpl: St,
186
+ i18n: { en: at },
187
+ baseTpl: St,
188
+ btnTpl: Mt,
181
189
  spinnerTpl: Lt,
182
- errorTpl: Mt
183
- }, Ot = /\.(avif|bmp|gif|jpe?g|png|svg|webp|ico)(\?.*)?$/i, It = /\.(mp4|webm|ogg|ogv|mov|m4v)(\?.*)?$/i, At = /\.pdf(\?.*)?$/i, Dt = /^(#[\w-]+|\.[\w-]+)$/;
184
- function kt(e, t = "image") {
185
- return e ? Dt.test(e) ? "inline" : Ot.test(e) ? "image" : It.test(e) ? "video" : At.test(e) ? "iframe" : t : "html";
190
+ errorTpl: Ct
191
+ }, 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-]+)$/;
192
+ function Rt(e, t = "image") {
193
+ return e ? kt.test(e) ? "inline" : Ot.test(e) ? "image" : At.test(e) ? "video" : Dt.test(e) ? "iframe" : t : "html";
186
194
  }
187
- function Rt(e) {
195
+ function Ft(e) {
188
196
  const t = e.match(/\.(\w+)(?:\?|$)/)?.[1]?.toLowerCase();
189
197
  return t ? `video/${t === "ogv" ? "ogg" : t}` : "video/mp4";
190
198
  }
191
- function ct(e, t, s) {
199
+ function ht(e, t, s) {
192
200
  const i = typeof e == "string" ? { src: e } : { ...e };
193
201
  let n = i.src ?? "", o = i.type, r = i.thumb;
194
- const a = n ? Et(n, s.media) : null;
195
- return a && (n = a.src ?? n, o ??= a.type, r ??= a.thumb), o || (o = i.html || i.content ? "html" : kt(n, s.defaultType)), {
202
+ const a = n ? Tt(n, s.media) : null;
203
+ return a && (n = a.src ?? n, o ??= a.type, r ??= a.thumb), o || (o = i.html || i.content ? "html" : Rt(n, s.defaultType)), {
196
204
  ...i,
197
205
  index: t,
198
206
  src: n,
@@ -204,10 +212,10 @@ function ct(e, t, s) {
204
212
  };
205
213
  }
206
214
  const p = (e, t) => e.getAttribute(t) || void 0;
207
- function Ft(e, t) {
215
+ function Ht(e, t) {
208
216
  return e.map((s, i) => {
209
217
  const n = s.querySelector("img"), o = p(s, "data-caption") ?? p(s, "title") ?? "";
210
- return ct(
218
+ return ht(
211
219
  {
212
220
  src: p(s, "data-src") ?? p(s, "href") ?? "",
213
221
  type: p(s, "data-type"),
@@ -227,38 +235,38 @@ function Ft(e, t) {
227
235
  );
228
236
  });
229
237
  }
230
- function Ht(e, t) {
231
- return e.length && e[0] instanceof HTMLElement ? Ft(e, t) : e.map((s, i) => ct(s, i, t));
238
+ function Pt(e, t) {
239
+ return e.length && e[0].nodeType === 1 ? Ht(e, t) : e.map((s, i) => ht(s, i, t));
232
240
  }
233
- function c(e, t = document) {
241
+ function h(e, t = document) {
234
242
  return t.querySelector(e);
235
243
  }
236
- function $(e, t = document) {
244
+ function I(e, t = document) {
237
245
  return Array.from(t.querySelectorAll(e));
238
246
  }
239
247
  function m(e, t = "", s = "") {
240
248
  const i = document.createElement(e);
241
249
  return t && (i.className = t), s && (i.innerHTML = s), i;
242
250
  }
243
- function Pt(e) {
251
+ function zt(e) {
244
252
  return m("div", "", e.trim()).firstElementChild;
245
253
  }
246
- function N(e) {
254
+ function Z(e) {
247
255
  return /[<&]/.test(e) ? new DOMParser().parseFromString(e, "text/html").body.textContent?.trim() ?? "" : e.trim();
248
256
  }
249
- function ht(e, t = document) {
250
- return e ? typeof e != "string" ? e : c(e, t) ?? c(e) : null;
257
+ function ut(e, t = document) {
258
+ return e ? typeof e != "string" ? e : h(e, t) ?? h(e) : null;
251
259
  }
252
- function j(e) {
260
+ function W(e) {
253
261
  return typeof e == "number" ? `${e}px` : e;
254
262
  }
255
- function h(e, t, s, i) {
263
+ function f(e, t, s, i) {
256
264
  return e.addEventListener(t, s, i), () => e.removeEventListener(t, s, i);
257
265
  }
258
- function ut(e) {
266
+ function dt(e) {
259
267
  requestAnimationFrame(() => requestAnimationFrame(e));
260
268
  }
261
- function zt(e, t, s) {
269
+ function _t(e, t, s) {
262
270
  let i = !1;
263
271
  const n = () => {
264
272
  i || (i = !0, clearTimeout(r), e.removeEventListener("transitionend", o), s());
@@ -268,44 +276,44 @@ function zt(e, t, s) {
268
276
  e.addEventListener("transitionend", o);
269
277
  const r = setTimeout(n, t + 50);
270
278
  }
271
- function _t() {
279
+ function Nt() {
272
280
  return navigator.maxTouchPoints > 0 && window.matchMedia("(pointer: coarse)").matches;
273
281
  }
274
- function dt() {
282
+ function ft() {
275
283
  return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
276
284
  }
277
- function ft() {
285
+ function pt() {
278
286
  const e = document;
279
287
  return !!(e.fullscreenEnabled ?? e.webkitFullscreenEnabled);
280
288
  }
281
- const W = "glare-lock";
282
- function U(e) {
289
+ const U = "glare-lock";
290
+ function V(e) {
283
291
  const t = document.documentElement;
284
292
  if (e) {
285
293
  const s = window.innerWidth - t.clientWidth;
286
- t.classList.add(W), s > 0 && (t.style.marginRight = `${s}px`);
294
+ t.classList.add(U), s > 0 && (t.style.marginRight = `${s}px`);
287
295
  } else
288
- t.classList.remove(W), t.style.marginRight = "";
296
+ t.classList.remove(U), t.style.marginRight = "";
289
297
  }
290
298
  const T = "glare-hidden";
291
- function Nt(e, t, s, i) {
292
- const n = Pt(b(e.baseTpl, t));
299
+ function Zt(e, t, s, i) {
300
+ const n = zt(x(e.baseTpl, t));
293
301
  n.dataset.glareId = String(s), e.baseClass && n.classList.add(e.baseClass), e.modal && n.classList.add("glare-is-modal");
294
- const o = c(".glare-stage", n);
302
+ const o = h(".glare-stage", n);
295
303
  if (!o) throw new Error("baseTpl must contain a .glare-stage element");
296
304
  const r = {
297
305
  container: n,
298
- bg: c(".glare-bg", n),
299
- inner: c(".glare-inner", n),
306
+ bg: h(".glare-bg", n),
307
+ inner: h(".glare-inner", n),
300
308
  stage: o,
301
- caption: c(".glare-caption", n),
302
- toolbar: c(".glare-toolbar", n),
303
- infobar: c(".glare-infobar", n),
304
- navigation: c(".glare-navigation", n)
309
+ caption: h(".glare-caption", n),
310
+ toolbar: h(".glare-toolbar", n),
311
+ infobar: h(".glare-infobar", n),
312
+ navigation: h(".glare-navigation", n)
305
313
  }, a = i < 2;
306
- return r.navigation?.classList.toggle(T, !e.arrows || a), r.infobar?.classList.toggle(T, !e.infobar || a), r.toolbar && Zt(r.toolbar, e, t, a), r;
314
+ 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;
307
315
  }
308
- function Zt(e, t, s, i) {
316
+ function jt(e, t, s, i) {
309
317
  if (t.toolbar === !1) {
310
318
  e.classList.add(T);
311
319
  return;
@@ -317,18 +325,18 @@ function Zt(e, t, s, i) {
317
325
  n.appendChild(Bt(o));
318
326
  continue;
319
327
  }
320
- if (i && (o === "thumbs" || o === "slideshow") || o === "fullscreen" && !ft() || o === "more" || o === "close") continue;
328
+ if (i && (o === "thumbs" || o === "slideshow") || o === "fullscreen" && !pt() || o === "more" || o === "close") continue;
321
329
  const r = t.btnTpl[o];
322
- r && n.insertAdjacentHTML("beforeend", b(r, s));
330
+ r && n.insertAdjacentHTML("beforeend", x(r, s));
323
331
  }
324
332
  if (n.childElementCount) {
325
333
  e.appendChild(n);
326
334
  const o = t.btnTpl.more;
327
- o && (e.insertAdjacentHTML("beforeend", b(o, s)), e.querySelector("[data-glare-more]")?.setAttribute("aria-controls", n.id));
335
+ o && (e.insertAdjacentHTML("beforeend", x(o, s)), e.querySelector("[data-glare-more]")?.setAttribute("aria-controls", n.id));
328
336
  }
329
337
  if (t.buttons.includes("close")) {
330
338
  const o = t.btnTpl.close;
331
- o && e.insertAdjacentHTML("beforeend", b(o, s));
339
+ o && e.insertAdjacentHTML("beforeend", x(o, s));
332
340
  }
333
341
  }
334
342
  function Bt({ name: e, label: t, icon: s }) {
@@ -341,111 +349,111 @@ function qt(e, t) {
341
349
  s += i.offsetTop;
342
350
  return s;
343
351
  }
344
- function jt({ container: e, caption: t }) {
352
+ function Wt({ container: e, caption: t }) {
345
353
  let s = null;
346
354
  const i = () => {
347
355
  if (!t) return;
348
356
  e.style.setProperty("--glare-caption-inset", `${t.offsetHeight}px`);
349
- const o = s && c(".glare-content", s);
357
+ const o = s && h(".glare-content", s);
350
358
  o && Object.assign(t.style, { top: `${qt(o, t.offsetParent) + o.offsetHeight}px`, bottom: "auto" });
351
359
  }, n = new ResizeObserver(i);
352
360
  return t && n.observe(t), i(), {
353
361
  follow(o) {
354
362
  if (s)
355
- for (const r of [s, c(".glare-content", s)]) r && n.unobserve(r);
363
+ for (const r of [s, h(".glare-content", s)]) r && n.unobserve(r);
356
364
  s = o;
357
- for (const r of [o, c(".glare-content", o)]) r && n.observe(r);
365
+ for (const r of [o, h(".glare-content", o)]) r && n.observe(r);
358
366
  i();
359
367
  },
360
368
  destroy: () => n.disconnect()
361
369
  };
362
370
  }
363
- function Wt(e, t, s) {
371
+ function Ut(e, t, s) {
364
372
  const i = m("div", `glare-slide glare-slide--${t.type}`);
365
373
  s.slideClass && i.classList.add(s.slideClass);
366
374
  const n = m("div", "glare-content");
367
375
  return i.appendChild(n), e.appendChild(i), t.$slide = i, t.$content = n, i;
368
376
  }
369
- function Ut(e, t, s) {
377
+ function Vt(e, t, s) {
370
378
  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 = "");
371
379
  }
372
380
  function Xt(e, t, s, i) {
373
- for (const n of $(".glare-slide", e))
381
+ for (const n of I(".glare-slide", e))
374
382
  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));
375
383
  }
376
384
  function Gt(e, t, s) {
377
- e.insertAdjacentHTML("beforeend", b(t.btnTpl.smallBtn ?? "", s));
385
+ e.insertAdjacentHTML("beforeend", x(t.btnTpl.smallBtn ?? "", s));
378
386
  }
379
- function Vt(e, t, s) {
380
- e.querySelector(":scope > .glare-spinner") || e.insertAdjacentHTML("beforeend", b(t.spinnerTpl, s));
387
+ function Yt(e, t, s) {
388
+ e.querySelector(":scope > .glare-spinner") || e.insertAdjacentHTML("beforeend", x(t.spinnerTpl, s));
381
389
  }
382
- function Yt(e) {
390
+ function Kt(e) {
383
391
  e.querySelector(":scope > .glare-spinner")?.remove();
384
392
  }
385
- function Kt(e, t, s, i) {
386
- e.hasError = !0, e.error = t, e.$content && (e.$content.className = "glare-content glare-content--error", e.$content.innerHTML = b(s.errorTpl, i));
393
+ function Qt(e, t, s, i) {
394
+ e.hasError = !0, e.error = t, e.$content && (e.$content.className = "glare-content glare-content--error", e.$content.innerHTML = x(s.errorTpl, i));
387
395
  }
388
- function pt(e, t) {
396
+ function mt(e, t) {
389
397
  return typeof e.toolbar == "boolean" ? e.toolbar : t.type === "image";
390
398
  }
391
- function Qt(e, t) {
392
- return typeof e.smallBtn == "boolean" ? e.smallBtn : !pt(e, t);
399
+ function Jt(e, t) {
400
+ return typeof e.smallBtn == "boolean" ? e.smallBtn : !mt(e, t);
393
401
  }
394
- function Jt(e, t, s, i, n, o) {
402
+ function te(e, t, s, i, n, o) {
395
403
  const { container: r, toolbar: a, infobar: l } = e;
396
- re(r, i.type), a && te(a, t, i), ee(r, i), l && se(l, i.index, n), e.caption && ie(e.caption, o), ne(r, t, i.index, n), oe(r, s, i, n);
404
+ 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);
397
405
  }
398
- function te(e, t, s) {
406
+ function ee(e, t, s) {
399
407
  if (t.toolbar === !1) return;
400
408
  e.classList.remove("glare-toolbar--expanded"), e.querySelector("[data-glare-more]")?.setAttribute("aria-expanded", "false");
401
- const i = pt(t, s);
409
+ const i = mt(t, s);
402
410
  if (e.classList.toggle(T, !i), !i) return;
403
411
  const n = s.type === "image";
404
- c("[data-glare-zoom]", e)?.classList.toggle(T, !n);
412
+ h("[data-glare-zoom]", e)?.classList.toggle(T, !n);
405
413
  }
406
- function ee(e, t) {
414
+ function se(e, t) {
407
415
  const s = e.querySelector("[data-glare-download]");
408
416
  if (!s) return;
409
417
  const i = t.downloadSrc || (t.type === "image" ? t.src : "");
410
418
  s.classList.toggle(T, !i), i && (s.href = i);
411
419
  }
412
- function se(e, t, s) {
413
- const i = c(".glare-infobar-index", e);
420
+ function ie(e, t, s) {
421
+ const i = h(".glare-infobar-index", e);
414
422
  i && (i.textContent = `${t + 1} / ${s}`);
415
423
  }
416
- function ie(e, t) {
424
+ function ne(e, t) {
417
425
  e.innerHTML = t, e.classList.toggle(T, !t);
418
426
  }
419
- function ne(e, t, s, i) {
427
+ function oe(e, t, s, i) {
420
428
  const n = !t.loop && s === 0, o = !t.loop && s === i - 1;
421
- X(c("[data-glare-prev]", e), n), X(c("[data-glare-next]", e), o);
429
+ X(h("[data-glare-prev]", e), n), X(h("[data-glare-next]", e), o);
422
430
  }
423
431
  function X(e, t) {
424
432
  e && (e.classList.toggle("glare-is-disabled", t), e.setAttribute("aria-disabled", String(t)));
425
433
  }
426
- function oe(e, t, s, i) {
427
- const n = N(s.caption) || s.alt || t.LIGHTBOX, o = i > 1 ? `${n} (${s.index + 1} of ${i})` : n;
434
+ function re(e, t, s, i) {
435
+ const n = Z(s.caption) || s.alt || t.LIGHTBOX, o = i > 1 ? `${n} (${s.index + 1} of ${i})` : n;
428
436
  e.setAttribute("aria-label", o);
429
- const r = c(".glare-live", e);
437
+ const r = h(".glare-live", e);
430
438
  r && (r.textContent = o);
431
439
  }
432
- function re(e, t) {
440
+ function ae(e, t) {
433
441
  const s = e.dataset.type;
434
442
  s && e.classList.remove(`glare-type-${s}`), e.dataset.type = t, e.classList.add(`glare-type-${t}`);
435
443
  }
436
- function ae(e, t, s, i) {
444
+ function le(e, t, s, i) {
437
445
  e.classList.toggle("glare-can-zoom-out", s), e.classList.toggle("glare-can-zoom-in", !s && i);
438
- const n = c("[data-glare-zoom]", e), o = s ? "out" : "in";
439
- !n || n.dataset.state === o || (n.dataset.state = o, Z(n, s, s ? t.ZOOM_OUT : t.ZOOM, s ? u.zoomOut : u.zoomIn));
446
+ const n = h("[data-glare-zoom]", e), o = s ? "out" : "in";
447
+ !n || n.dataset.state === o || (n.dataset.state = o, j(n, s, s ? t.ZOOM_OUT : t.ZOOM, s ? c.zoomOut : c.zoomIn));
440
448
  }
441
- function Z(e, t, s, i) {
449
+ function j(e, t, s, i) {
442
450
  e.setAttribute("title", s), e.setAttribute("aria-label", s), e.innerHTML = i, e.classList.toggle("glare-is-active", t);
443
451
  }
444
- class le {
452
+ class ce {
445
453
  constructor(t, s, i) {
446
454
  this.glare = t, this.container = s, this.offs = [
447
- h(document, "fullscreenchange", () => this.sync()),
448
- h(document, "webkitfullscreenchange", () => this.sync())
455
+ f(document, "fullscreenchange", () => this.sync()),
456
+ f(document, "webkitfullscreenchange", () => this.sync())
449
457
  ], i.autoStart && this.request();
450
458
  }
451
459
  isFullscreen() {
@@ -470,43 +478,43 @@ class le {
470
478
  sync() {
471
479
  const t = this.isFullscreen();
472
480
  this.container.classList.toggle("glare-is-fullscreen", t);
473
- const s = c("[data-glare-fullscreen]", this.container);
481
+ const s = h("[data-glare-fullscreen]", this.container);
474
482
  if (!s) return;
475
483
  const { dict: i } = this.glare;
476
- Z(
484
+ j(
477
485
  s,
478
486
  t,
479
487
  t ? i.FULL_SCREEN_EXIT : i.FULL_SCREEN,
480
- t ? u.fullscreenExit : u.fullscreen
488
+ t ? c.fullscreenExit : c.fullscreen
481
489
  );
482
490
  }
483
491
  }
484
492
  function G(e) {
485
493
  if (typeof e != "object" || e === null) return !1;
486
494
  const t = Object.getPrototypeOf(e);
487
- return t === Object.prototype || t === null;
495
+ return t === null || Object.getPrototypeOf(t) === null;
488
496
  }
489
- function R(...e) {
497
+ function F(...e) {
490
498
  const t = {};
491
499
  for (const s of e)
492
500
  if (s)
493
501
  for (const [i, n] of Object.entries(s)) {
494
502
  if (n === void 0) continue;
495
503
  const o = t[i];
496
- t[i] = G(n) ? R(G(o) ? o : {}, n) : n;
504
+ t[i] = G(n) ? F(G(o) ? o : {}, n) : n;
497
505
  }
498
506
  return t;
499
507
  }
500
- function w(e, t, s) {
508
+ function E(e, t, s) {
501
509
  return Math.min(s, Math.max(t, e));
502
510
  }
503
- const S = 1, F = 5, ce = 1.01;
504
- class he {
511
+ const S = 1, H = 5, he = 1.01;
512
+ class ue {
505
513
  constructor(t) {
506
514
  this.target = t, this.scale = S, this.x = 0, this.y = 0;
507
515
  }
508
516
  get isZoomed() {
509
- return this.scale > ce;
517
+ return this.scale > he;
510
518
  }
511
519
  get state() {
512
520
  return { scale: this.scale, x: this.x, y: this.y };
@@ -521,7 +529,7 @@ class he {
521
529
  apply(t, s, i, n = 0) {
522
530
  const o = this.target.image();
523
531
  if (!o) return;
524
- this.scale = w(t, S, F);
532
+ this.scale = E(t, S, H);
525
533
  const r = this.isZoomed ? this.bounded(s, i) : { x: 0, y: 0 };
526
534
  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);
527
535
  }
@@ -532,7 +540,7 @@ class he {
532
540
  toActual(t, s = 300) {
533
541
  const i = this.target.image(), n = this.center();
534
542
  if (!i || !n) return;
535
- const o = i.naturalWidth / Math.max(i.offsetWidth, 1), r = w(Math.max(o, 1.5), S, F), a = t?.x ?? n.x, l = t?.y ?? n.y;
543
+ const o = i.naturalWidth / Math.max(i.offsetWidth, 1), r = E(Math.max(o, 1.5), S, H), a = t?.x ?? n.x, l = t?.y ?? n.y;
536
544
  this.apply(r, (n.x - a) * (r - 1), (n.y - l) * (r - 1), s);
537
545
  }
538
546
  reset() {
@@ -544,17 +552,17 @@ class he {
544
552
  const i = this.target.image(), n = this.target.stage();
545
553
  if (!i || !n) return { x: t, y: s };
546
554
  const o = Math.max(0, (i.offsetWidth * this.scale - n.clientWidth) / 2), r = Math.max(0, (i.offsetHeight * this.scale - n.clientHeight) / 2);
547
- return { x: w(t, -o, o), y: w(s, -r, r) };
555
+ return { x: E(t, -o, o), y: E(s, -r, r) };
548
556
  }
549
557
  }
550
- const ue = 6, V = 120, de = 100, fe = 0.5, pe = 80, me = 0.4, ge = "a, button, input, textarea, select, video, .glare-thumbs", Y = (e, t) => Math.hypot(e.x - t.x, e.y - t.y), K = (e, t) => ({ x: (e.x + t.x) / 2, y: (e.y + t.y) / 2 }), I = (e) => ({ x: e.clientX, y: e.clientY });
551
- class be {
558
+ const de = 6, Y = 120, fe = 100, pe = 0.5, me = 80, ge = 0.4, be = "a, button, input, textarea, select, video, .glare-thumbs", K = (e, t) => Math.hypot(e.x - t.x, e.y - t.y), Q = (e, t) => ({ x: (e.x + t.x) / 2, y: (e.y + t.y) / 2 }), O = (e) => ({ x: e.clientX, y: e.clientY });
559
+ class ye {
552
560
  constructor(t, s) {
553
561
  this.stage = t, this.host = s, this.pointers = /* @__PURE__ */ 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 = [
554
- h(t, "pointerdown", (i) => this.onDown(i)),
555
- h(window, "pointermove", (i) => this.onMove(i), { passive: !1 }),
556
- h(window, "pointerup", (i) => this.onUp(i)),
557
- h(window, "pointercancel", (i) => this.onUp(i))
562
+ f(t, "pointerdown", (i) => this.onDown(i)),
563
+ f(window, "pointermove", (i) => this.onMove(i), { passive: !1 }),
564
+ f(window, "pointerup", (i) => this.onUp(i)),
565
+ f(window, "pointercancel", (i) => this.onUp(i))
558
566
  ];
559
567
  }
560
568
  destroy() {
@@ -566,19 +574,19 @@ class be {
566
574
  return this.moved = !1, t;
567
575
  }
568
576
  onDown(t) {
569
- t.pointerType === "mouse" && t.button !== 0 || t.target.closest(ge) || (this.pointers.set(t.pointerId, I(t)), this.pointers.size <= 2 && this.begin());
577
+ t.pointerType === "mouse" && t.button !== 0 || t.target.closest(be) || (this.pointers.set(t.pointerId, O(t)), this.pointers.size <= 2 && this.begin());
570
578
  }
571
579
  onMove(t) {
572
- this.pointers.has(t.pointerId) && (this.pointers.set(t.pointerId, I(t)), this.move(t));
580
+ this.pointers.has(t.pointerId) && (this.pointers.set(t.pointerId, O(t)), this.move(t));
573
581
  }
574
582
  onUp(t) {
575
- this.pointers.has(t.pointerId) && (this.pointers.delete(t.pointerId), this.pointers.size === 0 ? this.end(I(t)) : this.begin());
583
+ this.pointers.has(t.pointerId) && (this.pointers.delete(t.pointerId), this.pointers.size === 0 ? this.end(O(t)) : this.begin());
576
584
  }
577
585
  /** Anchors a new gesture on the currently pressed pointers. */
578
586
  begin() {
579
587
  this.mode === "swipe" && this.releaseStage();
580
588
  const t = [...this.pointers.values()];
581
- 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 = Y(t[0], t[1]), this.startMid = K(t[0], t[1]));
589
+ 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 = K(t[0], t[1]), this.startMid = Q(t[0], t[1]));
582
590
  }
583
591
  move(t) {
584
592
  const s = [...this.pointers.values()];
@@ -588,7 +596,7 @@ class be {
588
596
  return;
589
597
  }
590
598
  const i = s[0].x - this.start[0].x, n = s[0].y - this.start[0].y;
591
- if (!(!this.moved && Math.hypot(i, n) < ue)) {
599
+ if (!(!this.moved && Math.hypot(i, n) < de)) {
592
600
  if (this.moved = !0, this.mode === "idle" && (this.mode = this.host.zoom.isZoomed && this.host.canPan() ? "pan" : "swipe"), this.mode === "pan")
593
601
  t.preventDefault(), this.host.zoom.apply(this.startZoom.scale, this.startZoom.x + i, this.startZoom.y + n);
594
602
  else if (this.mode === "swipe") {
@@ -600,10 +608,10 @@ class be {
600
608
  }
601
609
  /** Scales around the pinch midpoint so the content under the fingers stays put. */
602
610
  pinch(t, s) {
603
- const { zoom: i } = this.host, n = K(t, s), o = i.center() ?? n, r = w(
604
- this.startZoom.scale * Y(t, s) / (this.startDistance || 1),
611
+ const { zoom: i } = this.host, n = Q(t, s), o = i.center() ?? n, r = E(
612
+ this.startZoom.scale * K(t, s) / (this.startDistance || 1),
605
613
  S,
606
- F
614
+ H
607
615
  ), a = (this.startMid.x - o.x - this.startZoom.x) / this.startZoom.scale, l = (this.startMid.y - o.y - this.startZoom.y) / this.startZoom.scale;
608
616
  i.apply(r, n.x - o.x - r * a, n.y - o.y - r * l);
609
617
  }
@@ -614,7 +622,7 @@ class be {
614
622
  this.releaseStage(), this.finishSwipe(i, n, o);
615
623
  else if (this.mode === "pan" && this.host.touch.momentum !== !1) {
616
624
  const { zoom: r } = this.host;
617
- r.apply(r.scale, r.x + o.x * V, r.y + o.y * V, 250);
625
+ r.apply(r.scale, r.x + o.x * Y, r.y + o.y * Y, 250);
618
626
  }
619
627
  this.mode = "idle", this.start = [], this.moved && setTimeout(() => this.moved = !1, 0);
620
628
  }
@@ -622,7 +630,7 @@ class be {
622
630
  dragStage(t, s) {
623
631
  this.stage.style.transitionDuration = "0ms", this.stage.style.transform = `translate3d(${t}px, ${s}px, 0)`;
624
632
  const { bg: i } = this.host;
625
- i && (i.style.transitionDuration = "0ms", i.style.opacity = String(w(1 - Math.abs(s) / 400, 0.35, 1)));
633
+ i && (i.style.transitionDuration = "0ms", i.style.opacity = String(E(1 - Math.abs(s) / 400, 0.35, 1)));
626
634
  }
627
635
  releaseStage() {
628
636
  this.stage.style.transitionDuration = "", this.stage.style.transform = "";
@@ -632,35 +640,35 @@ class be {
632
640
  /** A long or fast vertical swipe closes; a horizontal one navigates. */
633
641
  finishSwipe(t, s, i) {
634
642
  if (Math.abs(s) > Math.abs(t)) {
635
- (Math.abs(s) > de || Math.abs(i.y) > fe) && this.host.close();
643
+ (Math.abs(s) > fe || Math.abs(i.y) > pe) && this.host.close();
636
644
  return;
637
645
  }
638
- (Math.abs(t) > pe || Math.abs(i.x) > me) && (t < 0 ? this.host.next() : this.host.prev());
646
+ (Math.abs(t) > me || Math.abs(i.x) > ge) && (t < 0 ? this.host.next() : this.host.prev());
639
647
  }
640
648
  }
641
- const ye = /^(.+)-(\d+)$/;
642
- function H(e = window.location.hash) {
643
- const t = e.replace(/^#/, "").match(ye);
649
+ const xe = /^(.+)-(\d+)$/;
650
+ function P(e = window.location.hash) {
651
+ const t = e.replace(/^#/, "").match(xe);
644
652
  return t ? { gallery: t[1], index: Math.max(0, parseInt(t[2], 10) - 1) } : null;
645
653
  }
646
- function Q(e, t) {
654
+ function J(e, t) {
647
655
  return `${e}-${t + 1}`;
648
656
  }
649
657
  class ve {
650
658
  constructor(t, s) {
651
- this.glare = t, this.gallery = s, this.pushed = !1, this.off = h(window, "hashchange", () => this.onHashChange());
652
- const i = Q(s, t.currIndex);
653
- J() !== i && (window.history.pushState(null, "", `#${i}`), this.pushed = !0);
659
+ this.glare = t, this.gallery = s, this.pushed = !1, this.off = f(window, "hashchange", () => this.onHashChange());
660
+ const i = J(s, t.currIndex);
661
+ tt() !== i && (window.history.pushState(null, "", `#${i}`), this.pushed = !0);
654
662
  }
655
663
  update(t = this.glare.currIndex) {
656
- const s = Q(this.gallery, t);
657
- J() !== s && this.replace(`#${s}`);
664
+ const s = J(this.gallery, t);
665
+ tt() !== s && this.replace(`#${s}`);
658
666
  }
659
667
  destroy() {
660
- this.off(), H()?.gallery === this.gallery && (this.pushed ? window.history.back() : this.replace(""));
668
+ this.off(), P()?.gallery === this.gallery && (this.pushed ? window.history.back() : this.replace(""));
661
669
  }
662
670
  onHashChange() {
663
- const t = H();
671
+ const t = P();
664
672
  !t || t.gallery !== this.gallery ? (this.pushed = !1, this.glare.close()) : t.index !== this.glare.currIndex && this.glare.jumpTo(t.index);
665
673
  }
666
674
  replace(t) {
@@ -668,10 +676,10 @@ class ve {
668
676
  window.history.replaceState(null, "", `${s}${i}${t}`);
669
677
  }
670
678
  }
671
- const J = () => window.location.hash.replace(/^#/, "");
672
- class xe {
679
+ const tt = () => window.location.hash.replace(/^#/, "");
680
+ class we {
673
681
  constructor(t, s, i) {
674
- this.glare = t, this.container = s, this.opts = i, this.timer = null, this.active = !1, this.bar = c(".glare-progress", s), this.button = c("[data-glare-slideshow]", s), i.autoStart && this.start();
682
+ 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();
675
683
  }
676
684
  isActive() {
677
685
  return this.active;
@@ -692,13 +700,13 @@ class xe {
692
700
  this.stop();
693
701
  }
694
702
  get speed() {
695
- return this.opts.speed ?? _.speed;
703
+ return this.opts.speed ?? N.speed;
696
704
  }
697
705
  get atEnd() {
698
706
  return !this.glare.opts.loop && this.glare.currIndex === this.glare.group.length - 1;
699
707
  }
700
708
  schedule() {
701
- this.clearTimer(), this.setProgress(0), dt() || (this.bar?.offsetWidth, this.setProgress(1)), this.timer = setTimeout(() => this.atEnd ? this.stop() : this.glare.next(), this.speed);
709
+ this.clearTimer(), this.setProgress(0), ft() || (this.bar?.offsetWidth, this.setProgress(1)), this.timer = setTimeout(() => this.atEnd ? this.stop() : this.glare.next(), this.speed);
702
710
  }
703
711
  clearTimer() {
704
712
  this.timer && clearTimeout(this.timer), this.timer = null;
@@ -709,15 +717,30 @@ class xe {
709
717
  syncButton() {
710
718
  if (!this.button) return;
711
719
  const { dict: t } = this.glare;
712
- Z(
720
+ j(
713
721
  this.button,
714
722
  this.active,
715
723
  this.active ? t.PLAY_STOP : t.PLAY_START,
716
- this.active ? u.pause : u.play
724
+ this.active ? c.pause : c.play
717
725
  );
718
726
  }
719
727
  }
720
- class we {
728
+ const Ee = {
729
+ image: c.thumbImage,
730
+ video: c.thumbVideo,
731
+ embed: c.thumbEmbed,
732
+ iframe: c.thumbIframe,
733
+ inline: c.thumbInline,
734
+ ajax: c.thumbAjax,
735
+ html: c.thumbHtml
736
+ };
737
+ function Te(e) {
738
+ return e.thumb || (e.type === "video" ? e.poster : "") || (e.type === "image" ? e.src : "");
739
+ }
740
+ function et(e, t) {
741
+ e.classList.add("glare-thumbs-item--placeholder"), e.innerHTML = Ee[t] ?? c.thumbSlide;
742
+ }
743
+ class Se {
721
744
  constructor(t, s, i) {
722
745
  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();
723
746
  }
@@ -732,7 +755,7 @@ class we {
732
755
  }
733
756
  /** Highlights the thumbnail for `index` and scrolls it into view. */
734
757
  focus(t = this.glare.currIndex) {
735
- for (const s of $(".glare-thumbs-item", this.list))
758
+ for (const s of I(".glare-thumbs-item", this.list))
736
759
  s.classList.toggle("glare-is-active", Number(s.dataset.index) === t);
737
760
  this.list.querySelector(".glare-is-active")?.scrollIntoView({ block: "nearest", inline: "nearest", behavior: "smooth" });
738
761
  }
@@ -741,7 +764,7 @@ class we {
741
764
  }
742
765
  setActive(t) {
743
766
  this.isActive = t, this.strip.classList.toggle("glare-thumbs--active", t), this.container.classList.toggle("glare-show-thumbs", t);
744
- const s = c("[data-glare-thumbs]", this.container);
767
+ const s = h("[data-glare-thumbs]", this.container);
745
768
  s?.classList.toggle("glare-is-active", t), s?.setAttribute("aria-expanded", String(t));
746
769
  }
747
770
  build() {
@@ -750,27 +773,27 @@ class we {
750
773
  this.container.classList.add(`glare-thumbs-axis-${this.axis}`);
751
774
  for (const n of t) {
752
775
  const o = m("button", "glare-thumbs-item");
753
- o.type = "button", o.dataset.index = String(n.index), o.setAttribute("aria-label", b(s.GO_TO_SLIDE, { index: String(n.index + 1) }));
754
- const r = n.thumb || (n.type === "image" ? n.src : "");
776
+ o.type = "button", o.dataset.index = String(n.index), o.setAttribute("aria-label", x(s.GO_TO_SLIDE, { index: String(n.index + 1) }));
777
+ const r = Te(n);
755
778
  if (r) {
756
779
  const a = m("img");
757
- a.src = r, a.alt = n.alt || N(n.caption), a.loading = "lazy", o.appendChild(a);
780
+ a.src = r, a.alt = n.alt || Z(n.caption), a.loading = "lazy", a.onerror = () => et(o, n.type), o.appendChild(a);
758
781
  } else
759
- o.textContent = String(n.index + 1);
760
- this.list.appendChild(o), this.offs.push(h(o, "click", () => this.glare.jumpTo(n.index)));
782
+ et(o, n.type);
783
+ this.list.appendChild(o), this.offs.push(f(o, "click", () => this.glare.jumpTo(n.index)));
761
784
  }
762
- (ht(this.opts.parentEl, this.container) ?? this.container).appendChild(this.strip), this.opts.autoStart && this.show(), this.focus();
785
+ (ut(this.opts.parentEl, this.container) ?? this.container).appendChild(this.strip), this.opts.autoStart && this.show(), this.focus();
763
786
  }
764
787
  }
765
- const Ee = 40, Te = 150, Se = 16;
766
- class Le {
788
+ const Me = 40, Le = 150, Ce = 16;
789
+ class $e {
767
790
  constructor(t, s) {
768
- this.distance = 0, this.fired = !1, this.settle = null, this.off = h(
791
+ this.distance = 0, this.fired = !1, this.settle = null, this.off = f(
769
792
  t,
770
793
  "wheel",
771
794
  (i) => {
772
795
  const n = s.current();
773
- !n || i.deltaY === 0 || s.mode === "auto" && n.type !== "image" || n.type === "image" && s.isZoomed() || (i.preventDefault(), this.restartSettle(), !this.fired && (this.distance += Me(i, t), !(Math.abs(this.distance) < Ee) && (this.fired = !0, this.distance > 0 ? s.next() : s.prev())));
796
+ !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())));
774
797
  },
775
798
  { passive: !1 }
776
799
  );
@@ -781,14 +804,14 @@ class Le {
781
804
  restartSettle() {
782
805
  this.settle && clearTimeout(this.settle), this.settle = setTimeout(() => {
783
806
  this.distance = 0, this.fired = !1;
784
- }, Te);
807
+ }, Le);
785
808
  }
786
809
  }
787
- function Me(e, t) {
788
- return e.deltaMode === WheelEvent.DOM_DELTA_LINE ? e.deltaY * Se : e.deltaMode === WheelEvent.DOM_DELTA_PAGE ? e.deltaY * t.clientHeight : e.deltaY;
810
+ function Ie(e, t) {
811
+ return e.deltaMode === WheelEvent.DOM_DELTA_LINE ? e.deltaY * Ce : e.deltaMode === WheelEvent.DOM_DELTA_PAGE ? e.deltaY * t.clientHeight : e.deltaY;
789
812
  }
790
- function C(e) {
791
- const t = dt(), s = t || !e.animationEffect ? 0 : Math.max(0, e.animationDuration), i = t || !e.transitionEffect ? 0 : Math.max(0, e.transitionDuration);
813
+ function $(e) {
814
+ const t = ft(), s = t || !e.animationEffect ? 0 : Math.max(0, e.animationDuration), i = t || !e.transitionEffect ? 0 : Math.max(0, e.transitionDuration);
792
815
  return {
793
816
  animationEffect: s ? e.animationEffect : !1,
794
817
  animationDuration: s,
@@ -796,76 +819,78 @@ function C(e) {
796
819
  transitionDuration: i
797
820
  };
798
821
  }
799
- function Ce(e, t) {
800
- const s = C(t);
822
+ function Oe(e, t) {
823
+ const s = $(t);
801
824
  e.dataset.animation = s.animationEffect || "none", e.style.setProperty("--glare-duration", `${s.animationDuration}ms`), e.style.setProperty("--glare-transition-duration", `${s.transitionDuration}ms`);
802
825
  }
803
- function $e(e, t) {
804
- e.dataset.transition = C(t).transitionEffect || "none";
826
+ function Ae(e, t) {
827
+ e.dataset.transition = $(t).transitionEffect || "none";
805
828
  }
806
- const Oe = /^(top|center|bottom)-(left|center|right)$/, tt = { top: 0, left: 0, center: 0.5, bottom: 1, right: 1 };
807
- function Ie(e, t, s) {
808
- const i = typeof s == "string" ? Oe.exec(s) : null;
829
+ const De = /^(top|center|bottom)-(left|center|right)$/, st = { top: 0, left: 0, center: 0.5, bottom: 1, right: 1 };
830
+ function ke(e, t, s) {
831
+ const i = typeof s == "string" ? De.exec(s) : null;
809
832
  if (i) {
810
- const r = e.getBoundingClientRect(), a = r.left + r.width * tt[i[2]], l = r.top + r.height * tt[i[1]];
811
- return new DOMRect(a, l, 0, 0);
833
+ const u = e.getBoundingClientRect(), g = u.left + u.width * st[i[2]], M = u.top + u.height * st[i[1]];
834
+ return new DOMRect(g, M, 0, 0);
812
835
  }
813
- const n = (r) => r?.getClientRects().length ? r : null, o = s !== "trigger" && n(ht(s)) || n(t.$trigger);
814
- return o ? o.getBoundingClientRect() : null;
836
+ const n = (u) => u?.getClientRects().length ? u : null, o = s !== "trigger" && n(ut(s)) || n(t.$trigger);
837
+ if (!o) return null;
838
+ const r = o.getBoundingClientRect(), l = (o.ownerDocument === e.ownerDocument ? null : o.ownerDocument.defaultView?.frameElement)?.getBoundingClientRect();
839
+ return l ? new DOMRect(r.x + l.x, r.y + l.y, r.width, r.height) : r;
815
840
  }
816
- function Ae(e, t, s) {
841
+ function Re(e, t, s) {
817
842
  const i = t.$image;
818
843
  if (e.dataset.animation !== "zoom" || !i) return;
819
- const n = Ie(e, t, s.anchor);
844
+ const n = ke(e, t, s.anchor);
820
845
  if (!n) return;
821
846
  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);
822
847
  Object.assign(i.style, {
823
848
  transform: `translate3d(${a}px, ${l}px, 0) scale(${r})`,
824
849
  opacity: s.zoomOpacity ? "0.2" : "1",
825
850
  transitionDuration: "0ms"
826
- }), ut(() => {
851
+ }), dt(() => {
827
852
  Object.assign(i.style, { transform: "", opacity: "", transitionDuration: "" });
828
853
  });
829
854
  }
830
- function mt(e) {
831
- const t = R(lt, e);
832
- return _t() && t.mobile ? R(t, t.mobile) : t;
855
+ function gt(e) {
856
+ const t = F(R, e);
857
+ return Nt() && t.mobile ? F(t, t.mobile) : t;
833
858
  }
834
859
  function A(e, t) {
835
860
  return e ? e === !0 ? { ...t } : { ...t, ...e } : null;
836
861
  }
837
- const M = [], P = (e) => e.getAttribute("data-glare") ?? "";
838
- function De(e) {
839
- return typeof e == "string" ? $(e) : e instanceof HTMLElement ? [e] : Array.from(e);
862
+ const C = [], z = (e) => e.getAttribute("data-glare") ?? "";
863
+ function Fe(e) {
864
+ return typeof e == "string" ? I(e) : e instanceof HTMLElement ? [e] : Array.from(e);
840
865
  }
841
- function ke(e, t, s) {
842
- const i = De(e), n = (a) => {
843
- const l = P(a), d = l ? i.filter((E) => P(E) === l) : [a];
844
- s(d, d.indexOf(a), l);
866
+ function He(e, t, s) {
867
+ const i = Fe(e), n = (a) => {
868
+ const l = z(a), u = l ? i.filter((g) => z(g) === l) : [a];
869
+ s(u, u.indexOf(a), l);
845
870
  }, o = i.map(
846
- (a) => h(a, "click", (l) => {
871
+ (a) => f(a, "click", (l) => {
847
872
  l.preventDefault(), n(a);
848
873
  })
849
874
  ), r = {
850
875
  elements: i,
851
876
  destroy() {
852
877
  o.forEach((l) => l());
853
- const a = M.indexOf(r);
854
- a >= 0 && M.splice(a, 1);
878
+ const a = C.indexOf(r);
879
+ a >= 0 && C.splice(a, 1);
855
880
  }
856
881
  };
857
- return M.push(r), mt(t).hash && Fe(i, n), r;
882
+ return C.push(r), gt(t).hash && ze(i, n), r;
858
883
  }
859
- function Re() {
860
- for (const e of [...M]) e.destroy();
884
+ function Pe() {
885
+ for (const e of [...C]) e.destroy();
861
886
  }
862
- function Fe(e, t) {
863
- const s = H();
887
+ function ze(e, t) {
888
+ const s = P();
864
889
  if (!s) return;
865
- const n = e.filter((o) => P(o) === s.gallery)[s.index];
890
+ const n = e.filter((o) => z(o) === s.gallery)[s.index];
866
891
  n && t(n);
867
892
  }
868
- class He {
893
+ class _e {
869
894
  constructor(t, s) {
870
895
  this.seconds = t, this.onIdle = s, this.timer = null;
871
896
  }
@@ -876,27 +901,27 @@ class He {
876
901
  this.timer && clearTimeout(this.timer), this.timer = null;
877
902
  }
878
903
  }
879
- const y = [], g = {
904
+ const v = [], b = {
880
905
  add(e) {
881
- y.push(e);
906
+ v.push(e);
882
907
  },
883
908
  remove(e) {
884
- const t = y.indexOf(e);
885
- t >= 0 && y.splice(t, 1);
909
+ const t = v.indexOf(e);
910
+ t >= 0 && v.splice(t, 1);
886
911
  },
887
912
  top() {
888
- return y[y.length - 1] ?? null;
913
+ return v[v.length - 1] ?? null;
889
914
  },
890
915
  get(e) {
891
- return y.find((t) => t.id === e) ?? null;
916
+ return v.find((t) => t.id === e) ?? null;
892
917
  },
893
918
  all() {
894
- return [...y];
919
+ return [...v];
895
920
  },
896
921
  get size() {
897
- return y.length;
922
+ return v.length;
898
923
  }
899
- }, Pe = [
924
+ }, Ne = [
900
925
  ["[data-glare-close]", (e) => e.close()],
901
926
  ["[data-glare-next]", (e) => e.next()],
902
927
  ["[data-glare-prev]", (e) => e.prev()],
@@ -904,13 +929,13 @@ const y = [], g = {
904
929
  ["[data-glare-slideshow]", (e) => e.slideshow?.toggle()],
905
930
  ["[data-glare-thumbs]", (e) => e.thumbs?.toggle()],
906
931
  ["[data-glare-fullscreen]", (e) => e.fullscreen?.toggle()]
907
- ], ze = ".glare-content", _e = ".glare-slide, .glare-stage", Ne = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])', Ze = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), Be = 300;
908
- function qe(e, t, s) {
932
+ ], Ze = ".glare-content", je = ".glare-slide, .glare-stage", Be = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])', qe = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), We = 300;
933
+ function Ue(e, t, s) {
909
934
  let i = null;
910
935
  const n = () => {
911
936
  i && clearTimeout(i), i = null;
912
937
  }, o = [
913
- h(t, "click", (r) => {
938
+ f(t, "click", (r) => {
914
939
  if (e.consumeGesture()) return;
915
940
  const a = r.target, l = a.closest("[data-glare-more]");
916
941
  if (l) {
@@ -918,54 +943,54 @@ function qe(e, t, s) {
918
943
  L?.classList.toggle("glare-toolbar--expanded", B), l.setAttribute("aria-expanded", String(B));
919
944
  return;
920
945
  }
921
- bt(t);
922
- const d = a.closest("[data-glare-custom]");
923
- if (d) return je(e, d.dataset.glareCustom, r);
924
- const E = Pe.find(([L]) => a.closest(L));
925
- if (E) return E[1](e);
946
+ yt(t);
947
+ const u = a.closest("[data-glare-custom]");
948
+ if (u) return Ve(e, u.dataset.glareCustom, r);
949
+ const g = Ne.find(([L]) => a.closest(L));
950
+ if (g) return g[1](e);
926
951
  if (a.closest(".glare-button")) return;
927
- const O = D(e, a, "click");
928
- if (O) {
929
- if (!gt(e, D(e, a, "dblclick"), r))
930
- return k(e, O, r);
931
- n(), i = setTimeout(() => k(e, O, r), Be);
952
+ const M = D(e, a, "click");
953
+ if (M) {
954
+ if (!bt(e, D(e, a, "dblclick"), r))
955
+ return k(e, M, r);
956
+ n(), i = setTimeout(() => k(e, M, r), We);
932
957
  }
933
958
  }),
934
- h(t, "dblclick", (r) => {
959
+ f(t, "dblclick", (r) => {
935
960
  n();
936
961
  const a = r.target;
937
962
  a.closest(".glare-button") || k(e, D(e, a, "dblclick"), r);
938
963
  }),
939
- h(document, "keydown", (r) => We(e, r)),
940
- h(document, "keydown", s),
941
- h(document, "click", s, { capture: !0 }),
942
- h(document, "mousemove", s),
943
- h(document, "touchstart", s, { passive: !0 })
964
+ f(document, "keydown", (r) => Xe(e, r)),
965
+ f(document, "keydown", s),
966
+ f(document, "click", s, { capture: !0 }),
967
+ f(document, "mousemove", s),
968
+ f(document, "touchstart", s, { passive: !0 })
944
969
  ];
945
- return e.opts.trapFocus && o.push(h(t, "keydown", (r) => Ue(t, r))), e.opts.protect && o.push(
946
- h(t, "contextmenu", (r) => r.preventDefault()),
947
- h(t, "dragstart", (r) => {
970
+ return e.opts.trapFocus && o.push(f(t, "keydown", (r) => Ge(t, r))), e.opts.protect && o.push(
971
+ f(t, "contextmenu", (r) => r.preventDefault()),
972
+ f(t, "dragstart", (r) => {
948
973
  r.target.tagName === "IMG" && r.preventDefault();
949
974
  })
950
975
  ), () => {
951
976
  n(), o.forEach((r) => r());
952
977
  };
953
978
  }
954
- function je(e, t, s) {
979
+ function Ve(e, t, s) {
955
980
  const i = e.opts.buttons.find((n) => typeof n != "string" && n.name === t);
956
981
  i && e.current && i.click(e, e.current, s);
957
982
  }
958
983
  function D(e, t, s) {
959
984
  const { opts: i } = e;
960
- if (t.closest(ze)) return s === "click" ? i.clickContent : i.dblclickContent;
961
- if (!(i.modal || !t.closest(_e)))
985
+ if (t.closest(Ze)) return s === "click" ? i.clickContent : i.dblclickContent;
986
+ if (!(i.modal || !t.closest(je)))
962
987
  return s === "click" ? i.clickSlide : i.dblclickSlide;
963
988
  }
964
- function gt(e, t, s) {
989
+ function bt(e, t, s) {
965
990
  return !t || !e.current ? !1 : typeof t == "function" ? t(e.current, s) : t;
966
991
  }
967
992
  function k(e, t, s) {
968
- switch (gt(e, t, s)) {
993
+ switch (bt(e, t, s)) {
969
994
  case "close":
970
995
  return e.close();
971
996
  case "next":
@@ -980,15 +1005,15 @@ function k(e, t, s) {
980
1005
  }
981
1006
  }
982
1007
  }
983
- function We(e, t) {
984
- if (g.top() !== e) return;
985
- if (t.key === "Escape" && bt(e.$refs?.container ?? null)) {
1008
+ function Xe(e, t) {
1009
+ if (b.top() !== e) return;
1010
+ if (t.key === "Escape" && yt(e.$refs?.container ?? null)) {
986
1011
  t.preventDefault();
987
1012
  return;
988
1013
  }
989
1014
  if (!e.opts.keyboard || e.opts.modal) return;
990
1015
  const s = t.target;
991
- if (!Ze.has(s.tagName) && !(t.key === " " && s.closest("button")))
1016
+ if (!qe.has(s.tagName) && !(t.key === " " && s.closest("button")))
992
1017
  switch (t.key) {
993
1018
  case "Escape":
994
1019
  return t.preventDefault(), e.close();
@@ -1005,57 +1030,57 @@ function We(e, t) {
1005
1030
  return e.fullscreen?.toggle();
1006
1031
  }
1007
1032
  }
1008
- function bt(e) {
1033
+ function yt(e) {
1009
1034
  const t = e?.querySelector(".glare-toolbar--expanded");
1010
1035
  return t ? (t.classList.remove("glare-toolbar--expanded"), t.querySelector("[data-glare-more]")?.setAttribute("aria-expanded", "false"), !0) : !1;
1011
1036
  }
1012
- function Ue(e, t) {
1037
+ function Ge(e, t) {
1013
1038
  if (t.key !== "Tab") return;
1014
- const s = $(Ne, e).filter(
1039
+ const s = I(Be, e).filter(
1015
1040
  (o) => !o.hasAttribute("disabled") && o.offsetParent !== null && getComputedStyle(o).visibility !== "hidden"
1016
1041
  );
1017
1042
  if (!s.length) return;
1018
1043
  const i = s[0], n = s[s.length - 1];
1019
1044
  t.shiftKey && document.activeElement === i ? (t.preventDefault(), n.focus()) : !t.shiftKey && document.activeElement === n && (t.preventDefault(), i.focus());
1020
1045
  }
1021
- const Xe = 1200, et = 16 / 9;
1022
- function Ge(e, t, s) {
1046
+ const Ye = 1200, it = 16 / 9;
1047
+ function Ke(e, t, s) {
1023
1048
  if (t && s) return t / s;
1024
- const i = String(e.ratio || et).replace(":", "/"), [n, o = "1"] = i.split("/").map((l) => l.trim()), r = parseFloat(n), a = parseFloat(o);
1025
- return r > 0 && a > 0 ? r / a : et;
1049
+ const i = String(e.ratio || it).replace(":", "/"), [n, o = "1"] = i.split("/").map((l) => l.trim()), r = parseFloat(n), a = parseFloat(o);
1050
+ return r > 0 && a > 0 ? r / a : it;
1026
1051
  }
1027
- function st(e, t, s) {
1052
+ function nt(e, t, s) {
1028
1053
  if (!e) return 0;
1029
1054
  if (typeof e == "number") return e;
1030
1055
  const i = e.trim(), n = parseFloat(i);
1031
1056
  return n > 0 ? i.endsWith("%") ? t * n / 100 : i.endsWith("vw") || i.endsWith("vh") ? s * n / 100 : n : 0;
1032
1057
  }
1033
- function it(e, t) {
1058
+ function ot(e, t) {
1034
1059
  const s = t.parentElement;
1035
1060
  if (!s) return;
1036
1061
  const i = getComputedStyle(s), n = s.clientWidth - parseFloat(i.paddingLeft) - parseFloat(i.paddingRight), o = s.clientHeight - parseFloat(i.paddingTop) - parseFloat(i.paddingBottom);
1037
1062
  if (!(n > 0 && o > 0)) return;
1038
1063
  const r = e.width !== void 0 && e.height !== void 0;
1039
- let a = r ? st(e.width, n, innerWidth) : n, l = r ? st(e.height, o, innerHeight) : o;
1040
- const d = Ge(e, r ? a : void 0, r ? l : void 0), E = Math.min(1, n / a, o / l);
1041
- a *= E, l *= E, l > a / d ? l = a / d : a > l * d && (a = l * d), t.style.width = `${a}px`, t.style.height = `${l}px`, t.style.aspectRatio = String(d);
1064
+ let a = r ? nt(e.width, n, innerWidth) : n, l = r ? nt(e.height, o, innerHeight) : o;
1065
+ const u = Ke(e, r ? a : void 0, r ? l : void 0), g = Math.min(1, n / a, o / l);
1066
+ a *= g, l *= g, 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);
1042
1067
  }
1043
- function Ve(e, t) {
1044
- if (it(e, t), typeof ResizeObserver > "u" || !t.parentElement) return;
1068
+ function Qe(e, t) {
1069
+ if (ot(e, t), typeof ResizeObserver > "u" || !t.parentElement) return;
1045
1070
  const s = new ResizeObserver(() => {
1046
1071
  if (!t.isConnected) return s.disconnect();
1047
- it(e, t);
1072
+ ot(e, t);
1048
1073
  });
1049
1074
  s.observe(t.parentElement);
1050
1075
  }
1051
- const Ye = (e, t, s) => new Promise((i, n) => {
1076
+ const Je = (e, t, s) => new Promise((i, n) => {
1052
1077
  const o = m("img", "glare-image");
1053
- o.alt = e.alt || N(e.caption), o.decoding = "async", o.draggable = !1, s.protect && (o.style.pointerEvents = "none"), o.onload = () => {
1078
+ o.alt = e.alt || Z(e.caption), o.decoding = "async", o.draggable = !1, s.protect && (o.style.pointerEvents = "none"), o.onload = () => {
1054
1079
  e.$image = o, e.contentWidth = o.naturalWidth, e.contentHeight = o.naturalHeight, t.appendChild(o), i();
1055
1080
  }, o.onerror = () => n(new Error(`Failed to load image: ${e.src}`)), o.src = e.src;
1056
- }), Ke = (e, t, s, i) => {
1057
- const n = e.format || s.video.format || Rt(e.src);
1058
- t.innerHTML = b(s.video.tpl, {
1081
+ }), ts = (e, t, s, i) => {
1082
+ const n = e.format || s.video.format || Ft(e.src);
1083
+ t.innerHTML = x(s.video.tpl, {
1059
1084
  ...i,
1060
1085
  src: e.src,
1061
1086
  format: n,
@@ -1064,58 +1089,65 @@ const Ye = (e, t, s) => new Promise((i, n) => {
1064
1089
  const o = t.querySelector("video");
1065
1090
  o && (e.autoStart ?? s.video.autoStart) && o.play().catch(() => {
1066
1091
  });
1067
- }, nt = (e, t, s) => new Promise((i) => {
1092
+ }, rt = (e, t, s) => new Promise((i) => {
1068
1093
  const n = s.iframe, o = m("div", "glare-iframe-wrap", n.tpl), r = o.querySelector("iframe");
1069
1094
  if (!r) throw new Error("Iframe template must contain an <iframe>");
1070
1095
  for (const [a, l] of Object.entries(n.attr)) r.setAttribute(a, l);
1071
- if (Object.assign(r.style, n.css), t.appendChild(o), e.type === "embed" ? Ve(e, t) : (e.width && (o.style.width = j(e.width)), e.height && (o.style.height = j(e.height))), !n.preload) {
1096
+ if (Object.assign(r.style, n.css), t.appendChild(o), e.type === "embed" ? Qe(e, t) : (e.width && (o.style.width = W(e.width)), e.height && (o.style.height = W(e.height))), !n.preload) {
1072
1097
  r.src = e.src, i();
1073
1098
  return;
1074
1099
  }
1075
- r.onload = () => i(), r.src = e.src, setTimeout(i, Xe);
1076
- }), Qe = (e, t) => {
1077
- const s = e.src ? c(e.src) : null;
1100
+ r.onload = () => i(), r.src = e.src, setTimeout(i, Ye);
1101
+ }), es = (e, t) => {
1102
+ const s = e.src ? h(e.src) : null;
1078
1103
  if (!s) throw new Error(`Inline target not found: ${e.src}`);
1079
1104
  const i = s.cloneNode(!0);
1080
1105
  i.removeAttribute("id"), i.hidden = !1, i.style.display = "", t.appendChild(i);
1081
- }, Je = async (e, t, s) => {
1106
+ }, ss = async (e, t, s) => {
1082
1107
  const i = await fetch(e.src, s.ajax.settings);
1083
1108
  if (!i.ok) throw new Error(`Request failed: ${i.status} ${e.src}`);
1084
1109
  t.innerHTML = await i.text();
1085
- }, ts = (e, t) => {
1086
- e.content instanceof HTMLElement ? t.appendChild(e.content) : t.innerHTML = e.html ?? e.content ?? e.src;
1087
- }, es = { image: Ye, video: Ke, embed: nt, iframe: nt, inline: Qe, ajax: Je, html: ts };
1088
- async function ss(e, t, s, i) {
1089
- t.innerHTML = "", t.className = `glare-content glare-content--${e.type}`, await es[e.type](e, t, s, i), e.isLoaded = !0;
1110
+ }, is = (e, t) => {
1111
+ e.content && typeof e.content == "object" ? t.appendChild(e.content) : t.innerHTML = e.html ?? e.content ?? e.src;
1112
+ }, ns = { image: Je, video: ts, embed: rt, iframe: rt, inline: es, ajax: ss, html: is };
1113
+ async function os(e, t, s, i) {
1114
+ t.innerHTML = "", t.className = `glare-content glare-content--${e.type}`, await ns[e.type](e, t, s, i), e.isLoaded = !0;
1090
1115
  }
1091
- function is(e, t) {
1116
+ function rs(e, t) {
1092
1117
  for (const s of [e[t - 1], e[t + 1]])
1093
1118
  s?.type === "image" && s.src && (new Image().src = s.src);
1094
1119
  }
1095
- let ns = 0;
1096
- const x = class x {
1120
+ let as = 0;
1121
+ function ls(e) {
1122
+ try {
1123
+ return e?.Glare;
1124
+ } catch {
1125
+ return;
1126
+ }
1127
+ }
1128
+ const y = class y {
1097
1129
  constructor(t, s = {}, i = 0, n = "") {
1098
- 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 = mt(s), this.dict = yt(this.opts), this.group = Ht(t, this.opts), this.galleryName = n, this.currIndex = this.clampIndex(i), this.zoom = new he({
1130
+ this.id = ++as, 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 = gt(s), this.dict = xt(this.opts), this.group = Pt(t, this.opts), this.galleryName = n, this.currIndex = this.clampIndex(i), this.zoom = new ue({
1099
1131
  image: () => this.current?.$image ?? null,
1100
1132
  stage: () => this.$refs?.stage ?? null,
1101
1133
  onChange: (o) => this.syncZoomState(o)
1102
- }), this.idle = new He(this.opts.modal ? !1 : this.opts.idleTime, () => this.toggleControls(!0));
1134
+ }), this.idle = new _e(this.opts.modal ? !1 : this.opts.idleTime, () => this.toggleControls(!0));
1103
1135
  }
1104
1136
  open(t = this.currIndex) {
1105
1137
  if (this.isActive) return this.jumpTo(t);
1106
1138
  if (!this.group.length) return;
1107
- this.opts.closeExisting && x.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");
1108
- const s = Nt(this.opts, this.dict, this.id, this.group.length), { container: i } = s;
1109
- this.$refs = s, Ce(i, this.opts), this.syncChrome(), this.resolveParent().appendChild(i), this.captionTracker = jt(s), this.cleanups.push(() => this.captionTracker?.destroy()), this.isActive = !0, g.add(this), this.opts.hideScrollbar && U(!0), this.emit("onActivate"), this.emitSlide("beforeShow", this.current), ut(() => {
1110
- this.isActive && (i.classList.add("glare-is-open"), this.showSlide(this.currIndex, !0), this.cleanups.push(qe(this, i, () => this.onActivity())), this.startModules(s), this.opts.autoFocus && this.focus(), this.idle.reset());
1139
+ 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");
1140
+ const s = Zt(this.opts, this.dict, this.id, this.group.length), { container: i } = s;
1141
+ 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 && V(!0), this.emit("onActivate"), this.emitSlide("beforeShow", this.current), dt(() => {
1142
+ 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());
1111
1143
  });
1112
1144
  }
1113
1145
  close() {
1114
1146
  if (!this.isActive || this.isClosing || !this.current || !this.$refs || this.emitSlide("beforeClose", this.current) === !1) return;
1115
1147
  this.isClosing = !0, this.slideshow?.stop(), this.idle.stop();
1116
- const { container: t, bg: s } = this.$refs, i = C(this.opts).animationDuration;
1148
+ const { container: t, bg: s } = this.$refs, i = $(this.opts).animationDuration;
1117
1149
  if (i === 0) return this.teardown();
1118
- t.classList.remove("glare-is-open"), t.classList.add("glare-is-closing"), zt(s ?? t, i, () => this.teardown());
1150
+ t.classList.remove("glare-is-open"), t.classList.add("glare-is-closing"), _t(s ?? t, i, () => this.teardown());
1119
1151
  }
1120
1152
  next() {
1121
1153
  this.jumpTo(this.currIndex + 1);
@@ -1125,7 +1157,7 @@ const x = class x {
1125
1157
  }
1126
1158
  jumpTo(t) {
1127
1159
  if (!this.isActive || this.isClosing) return;
1128
- const s = this.group.length, i = this.opts.loop ? (t % s + s) % s : w(t, 0, s - 1);
1160
+ const s = this.group.length, i = this.opts.loop ? (t % s + s) % s : E(t, 0, s - 1);
1129
1161
  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));
1130
1162
  }
1131
1163
  toggleZoom(t) {
@@ -1147,44 +1179,44 @@ const x = class x {
1147
1179
  async showSlide(t, s) {
1148
1180
  const i = this.group[t];
1149
1181
  if (!this.$refs || !i) return;
1150
- const { container: n, stage: o } = this.$refs, r = Wt(o, i, this.opts);
1151
- Qt(this.opts, i) && Gt(r, this.opts, this.dict), Vt(o, this.opts, this.dict), this.emitSlide("beforeLoad", i), this.opts.image.preload && is(this.group, t);
1182
+ const { container: n, stage: o } = this.$refs, r = Ut(o, i, this.opts);
1183
+ Jt(this.opts, i) && Gt(r, this.opts, this.dict), Yt(o, this.opts, this.dict), this.emitSlide("beforeLoad", i), this.opts.image.preload && rs(this.group, t);
1152
1184
  let a = !1;
1153
1185
  try {
1154
- await ss(i, i.$content, this.opts, this.dict);
1186
+ await os(i, i.$content, this.opts, this.dict);
1155
1187
  } catch (l) {
1156
- a = !0, Kt(i, l, this.opts, this.dict), this.emitSlide("onError", i), this.opts.onError || console.warn("[glare]", l);
1188
+ a = !0, Qt(i, l, this.opts, this.dict), this.emitSlide("onError", i), this.opts.onError || console.warn("[glare]", l);
1157
1189
  }
1158
1190
  if (!this.isActive || this.currIndex !== t) return r.remove();
1159
- a || this.emitSlide("afterLoad", i), Yt(o), s || $e(n, this.opts), Ut(r, s, this.direction), this.captionTracker?.follow(r), Xt(o, r, C(this.opts).transitionDuration, this.direction), this.syncZoomState(this.zoom.isZoomed), !a && (s && Ae(n, i, this.opts), this.emitSlide("afterShow", i));
1191
+ a || this.emitSlide("afterLoad", i), Kt(o), s || Ae(n, this.opts), Vt(r, s, this.direction), this.captionTracker?.follow(r), Xt(o, r, $(this.opts).transitionDuration, this.direction), this.syncZoomState(this.zoom.isZoomed), !a && (s && Re(n, i, this.opts), this.emitSlide("afterShow", i));
1160
1192
  }
1161
1193
  syncChrome() {
1162
- !this.$refs || !this.current || (Jt(this.$refs, this.opts, this.dict, this.current, this.group.length, this.captionFor(this.current)), this.syncZoomState(this.zoom.isZoomed));
1194
+ !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));
1163
1195
  }
1164
1196
  captionFor(t) {
1165
1197
  const { caption: s } = this.opts;
1166
1198
  return typeof s == "function" ? s(this, t) : s ?? t.caption;
1167
1199
  }
1168
1200
  syncZoomState(t) {
1169
- this.$refs && ae(this.$refs.container, this.dict, t, !!this.current?.$image);
1201
+ this.$refs && le(this.$refs.container, this.dict, t, !!this.current?.$image);
1170
1202
  }
1171
1203
  resolveParent() {
1172
1204
  const { parentEl: t } = this.opts;
1173
1205
  return (typeof t == "string" ? document.querySelector(t) : t) ?? document.body;
1174
1206
  }
1175
1207
  startModules({ container: t, stage: s, bg: i }) {
1176
- const n = this.opts, o = A(n.thumbs, rt);
1177
- o && (this.thumbs = new we(this, t, o));
1178
- const r = A(n.slideshow, _);
1179
- r && (this.slideshow = new xe(this, t, r));
1180
- const a = A(n.fullscreen, at);
1181
- a && ft() && (this.fullscreen = new le(this, t, a)), n.hash && this.galleryName && (this.hash = new ve(this, this.galleryName)), n.wheel && (this.wheel = new Le(s, {
1208
+ const n = this.opts, o = A(n.thumbs, lt);
1209
+ o && (this.thumbs = new Se(this, t, o));
1210
+ const r = A(n.slideshow, N);
1211
+ r && (this.slideshow = new we(this, t, r));
1212
+ const a = A(n.fullscreen, ct);
1213
+ a && pt() && (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, {
1182
1214
  mode: n.wheel,
1183
1215
  current: () => this.current,
1184
1216
  isZoomed: () => this.zoom.isZoomed,
1185
1217
  next: () => this.next(),
1186
1218
  prev: () => this.prev()
1187
- })), n.touch && (this.gestures = new be(s, {
1219
+ })), n.touch && (this.gestures = new ye(s, {
1188
1220
  zoom: this.zoom,
1189
1221
  touch: n.touch,
1190
1222
  bg: i,
@@ -1207,7 +1239,7 @@ const x = class x {
1207
1239
  this.fullscreen
1208
1240
  ])
1209
1241
  t?.destroy();
1210
- 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, g.remove(this), this.opts.hideScrollbar && g.size === 0 && U(!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);
1242
+ 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 && V(!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);
1211
1243
  }
1212
1244
  emit(t) {
1213
1245
  return this.opts[t]?.(this);
@@ -1216,42 +1248,46 @@ const x = class x {
1216
1248
  return this.opts[t]?.(this, s);
1217
1249
  }
1218
1250
  clampIndex(t) {
1219
- return w(t, 0, Math.max(0, this.group.length - 1));
1251
+ return E(t, 0, Math.max(0, this.group.length - 1));
1220
1252
  }
1221
1253
  static open(t, s = {}, i = 0) {
1222
- const n = new x(t, s, i);
1254
+ const n = y.create(t, s, i);
1223
1255
  return n.open(), n;
1224
1256
  }
1225
1257
  static bind(t, s = {}) {
1226
- return ke(t, s, (i, n, o) => {
1227
- new x(i, s, n, o).open();
1258
+ return He(t, s, (i, n, o) => {
1259
+ y.create(i, s, n, o).open();
1228
1260
  });
1229
1261
  }
1262
+ /** Builds the instance here, or in the `delegate` window when that window has Glare loaded. */
1263
+ static create(t, { delegate: s = R.delegate, ...i }, n, o = "") {
1264
+ return new (ls(s) ?? y)(t, i, n, o);
1265
+ }
1230
1266
  static close(t = !1) {
1231
- t ? g.all().reverse().forEach((s) => s.close()) : g.top()?.close();
1267
+ t ? b.all().reverse().forEach((s) => s.close()) : b.top()?.close();
1232
1268
  }
1233
1269
  static getInstance(t) {
1234
- return t == null ? g.top() : g.get(t);
1270
+ return t == null ? b.top() : b.get(t);
1235
1271
  }
1236
1272
  static getInstances() {
1237
- return g.all();
1273
+ return b.all();
1238
1274
  }
1239
1275
  /** Closes every instance and removes all `bind()` handlers. */
1240
1276
  static destroy() {
1241
- x.close(!0), Re();
1277
+ y.close(!0), Pe();
1242
1278
  }
1243
1279
  /** Binds every `[data-glare]` element once the DOM is ready. */
1244
1280
  static autoBind(t = {}) {
1245
- const s = () => x.bind("[data-glare]", t);
1281
+ const s = () => y.bind("[data-glare]", t);
1246
1282
  document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", s, { once: !0 }) : s();
1247
1283
  }
1248
1284
  };
1249
- x.defaults = lt;
1250
- let z = x;
1251
- const os = z.autoBind;
1285
+ y.defaults = R;
1286
+ let _ = y;
1287
+ const cs = _.autoBind;
1252
1288
  export {
1253
- z as Glare,
1254
- os as autoBind,
1255
- z as default
1289
+ _ as Glare,
1290
+ cs as autoBind,
1291
+ _ as default
1256
1292
  };
1257
1293
  //# sourceMappingURL=glare.esm.js.map