vistaview 0.6.0 → 0.6.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.
@@ -51,6 +51,7 @@ export type VistaImgIdx = {
51
51
  export type VistaCustomCtrl = {
52
52
  name: string;
53
53
  icon: string;
54
+ description?: string;
54
55
  onClick: (vistaImageIndex: VistaImgIdx, vistaView: VistaView) => void | Promise<void>;
55
56
  };
56
57
  export type VistaData = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,QAAQ,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,CAAC,gBAAgB,GAAG,eAAe,CAAC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AAE,OAAO,CAAS;IAC5B,OAAO,CAAC,MAAM;IASd,OAAO,CAAC,OAAO;IAUf,OAAO,CAAC,kBAAkB;IAmC1B,OAAO,CAAC,mBAAmB;IAmD3B,OAAO,CAAC,SAAS,CAuBf;IAEF,OAAO,CAAC,QAAQ,CAYd;IAEF,OAAO,CAAC,eAAe,CAkBrB;IAGF,OAAO,CAAC,gBAAgB,CAAyD;IACjF,uBAAuB,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,gCAAgC,KAAK,IAAI,GAAG,IAAI;IAGtF,OAAO,CAAC,0BAA0B;IAIlC,OAAO,CAAC,0BAA0B,CAuDhC;IAGF,IAAI,CAAC,UAAU,GAAE,MAAU,GAAG,IAAI;IA+I5B,KAAK,CAAC,OAAO,GAAE,OAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IA0DnD,IAAI,IAAI,IAAI;IASZ,IAAI,IAAI,IAAI;IASZ,OAAO,IAAI,IAAI;IAcf,eAAe,IAAI,MAAM;IAOzB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;CAoBlE"}
package/dist/vistaview.js CHANGED
@@ -5,23 +5,23 @@ function $(s) {
5
5
  return s && !/^0(px|%|r?em|vw|vh|vmin|vmax|cm|mm|in|pt|pc|ex|ch)?$/i.test(s.trim()) && s;
6
6
  }
7
7
  function F(s) {
8
- const e = window.getComputedStyle(s).objectFit || "", { width: i, height: n } = s.getBoundingClientRect(), o = s.naturalWidth, r = s.naturalHeight;
8
+ const e = window.getComputedStyle(s).objectFit || "", { width: i, height: n } = s.getBoundingClientRect(), o = s.naturalWidth, a = s.naturalHeight;
9
9
  if (!e)
10
10
  return { width: i, height: n };
11
- if (!o || !r)
11
+ if (!o || !a)
12
12
  return { width: i, height: n };
13
- const a = o / r, h = i / n;
13
+ const r = o / a, h = i / n;
14
14
  switch (e) {
15
15
  case "fill":
16
16
  return { width: i, height: n };
17
17
  case "none":
18
- return { width: o, height: r };
18
+ return { width: o, height: a };
19
19
  case "contain":
20
- return a > h ? { width: i, height: i / a } : { width: n * a, height: n };
20
+ return r > h ? { width: i, height: i / r } : { width: n * r, height: n };
21
21
  case "cover":
22
- return a < h ? { width: i, height: i / a } : { width: n * a, height: n };
22
+ return r < h ? { width: i, height: i / r } : { width: n * r, height: n };
23
23
  case "scale-down": {
24
- const c = { width: o, height: r }, m = a > h ? { width: i, height: i / a } : { width: n * a, height: n };
24
+ const c = { width: o, height: a }, m = r > h ? { width: i, height: i / r } : { width: n * r, height: n };
25
25
  return m.width <= c.width && m.height <= c.height ? m : c;
26
26
  }
27
27
  }
@@ -61,18 +61,18 @@ function M(s, t, e, i = !1) {
61
61
  const {
62
62
  fit: n,
63
63
  w: o,
64
- h: r,
64
+ h: a,
65
65
  // this ones makes things hard. not used.
66
66
  // pos,
67
67
  // overflow,
68
- nw: a,
68
+ nw: r,
69
69
  nh: h,
70
70
  br: c,
71
71
  top: m,
72
72
  left: w
73
- } = A(s), L = Math.min(Math.max(w, -o), window.innerWidth + o) - window.innerWidth / 2 + o / 2, p = Math.min(Math.max(m, -r), window.innerHeight + r) - window.innerHeight / 2 + r / 2, d = e.style;
74
- d.width = `${o}px`, d.height = `${r}px`, d.objectFit = n, e.width = a, e.height = h, d.setProperty("--vvw-init-radius", `${c}`), d.setProperty("--vvw-pulse-radius", `calc(1.3 * ${c})`), d.setProperty("--vvw-init-x", `${L}px`), d.setProperty("--vvw-init-y", `${p}px`), i && (d.setProperty("--vvw-current-x", `${L}px`), d.setProperty("--vvw-current-y", `${p}px`));
75
- const v = F(s.imageElm), g = Math.min(o, v.width), f = Math.min(r, v.height), u = t.style;
73
+ } = A(s), b = Math.min(Math.max(w, -o), window.innerWidth + o) - window.innerWidth / 2 + o / 2, p = Math.min(Math.max(m, -a), window.innerHeight + a) - window.innerHeight / 2 + a / 2, d = e.style;
74
+ d.width = `${o}px`, d.height = `${a}px`, d.objectFit = n, e.width = r, e.height = h, d.setProperty("--vvw-init-radius", `${c}`), d.setProperty("--vvw-pulse-radius", `calc(1.3 * ${c})`), d.setProperty("--vvw-init-x", `${b}px`), d.setProperty("--vvw-init-y", `${p}px`), i && (d.setProperty("--vvw-current-x", `${b}px`), d.setProperty("--vvw-current-y", `${p}px`));
75
+ const v = F(s.imageElm), g = Math.min(o, v.width), f = Math.min(a, v.height), u = t.style;
76
76
  u.setProperty("--vvw-init-radius", `${c}`), u.setProperty("--vvw-init-w", `${g}px`), u.setProperty("--vvw-init-h", `${f}px`), i && (u.setProperty("--vvw-current-radius", `${c}`), u.setProperty("--vvw-current-w", `${g}px`), u.setProperty("--vvw-current-h", `${f}px`), t.dataset.vvwWidth = g.toString(), t.dataset.vvwHeight = f.toString());
77
77
  }
78
78
  function D(s) {
@@ -84,10 +84,10 @@ function D(s) {
84
84
  width: i,
85
85
  height: n
86
86
  };
87
- const o = i / n, r = t / e;
88
- let a, h;
89
- return o > r ? (a = t, h = t / o) : (h = e, a = e * o), {
90
- width: a,
87
+ const o = i / n, a = t / e;
88
+ let r, h;
89
+ return o > a ? (r = t, h = t / o) : (h = e, r = e * o), {
90
+ width: r,
91
91
  height: h
92
92
  };
93
93
  }
@@ -98,7 +98,7 @@ function C(s, t = 2) {
98
98
  const e = Math.pow(10, t);
99
99
  return Math.round(s * e) / e;
100
100
  }
101
- const q = '<svg viewBox="0 0 24 24"><path d="m15 18-6-6 6-6"/></svg>', k = '<svg viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"/></svg>', R = '<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/></svg>', O = '<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>', Y = '<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>', Z = '<svg viewBox="0 0 24 24"><path d="M12 15V3"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/></svg>';
101
+ const q = '<svg viewBox="0 0 24 24"><path d="m15 18-6-6 6-6"/></svg>', k = '<svg viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"/></svg>', R = '<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/></svg>', O = '<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>', Z = '<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>', Y = '<svg viewBox="0 0 24 24"><path d="M12 15V3"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/></svg>';
102
102
  let I = null;
103
103
  function X() {
104
104
  return I || (window.trustedTypes || (window.trustedTypes = {
@@ -123,7 +123,7 @@ function W(s) {
123
123
  function B() {
124
124
  return {
125
125
  name: "download",
126
- icon: Z,
126
+ icon: Y,
127
127
  onClick: async (s) => {
128
128
  var o;
129
129
  const t = await fetch(s.src), e = await t.blob(), i = t.url, n = document.createElement("a");
@@ -135,19 +135,19 @@ function N(s) {
135
135
  if (typeof s == "string")
136
136
  switch (s) {
137
137
  case "zoomIn":
138
- return `<button class="vvw-zoom-in vvw-ui">${R}</button>`;
138
+ return `<button aria-label="Zoom In" class="vvw-zoom-in vvw-ui">${R}</button>`;
139
139
  case "zoomOut":
140
- return `<button disabled class="vvw-zoom-out vvw-ui">${O}</button>`;
140
+ return `<button aria-label="Zoom Out" disabled class="vvw-zoom-out vvw-ui">${O}</button>`;
141
141
  case "close":
142
- return `<button class="vvw-close vvw-ui">${Y}</button>`;
142
+ return `<button aria-label="Close" class="vvw-close vvw-ui">${Z}</button>`;
143
143
  case "indexDisplay":
144
- return '<div class="vvw-index vvw-ui"></div>';
144
+ return '<div class="vvw-index vvw-ui" aria-hidden="true"></div>';
145
145
  case "description":
146
- return '<div class="vvw-desc vvw-ui"></div>';
146
+ return '<div class="vvw-desc vvw-ui" role="status" aria-live="polite" aria-atomic="true"></div>';
147
147
  default:
148
148
  return "";
149
149
  }
150
- return `<button data-vvw-control="${s.name}">${s.icon}</button>`;
150
+ return `<button aria-label="${s.description || s.name}" data-vvw-control="${s.name}">${s.icon}</button>`;
151
151
  }
152
152
  function j(s, t) {
153
153
  const e = document.createElement("div");
@@ -207,30 +207,30 @@ function G(s) {
207
207
  if (!n.hasInternalExecution && !(n.pointers.length > 1)) {
208
208
  if (n.event === "down" && (t = { x: n.pointer.x, y: n.pointer.y }, e = { x: n.pointer.x, y: n.pointer.y }), n.event === "move") {
209
209
  e = { x: n.pointer.x, y: n.pointer.y };
210
- const o = e.x - t.x, r = e.y - t.y;
211
- if (!i && Math.abs(r) > Math.abs(o) || i === "y") {
212
- const a = r / window.innerHeight * 100;
213
- s.imageContainer.style.transition = "none", s.imageContainer.style.transform = `translateY(${a}vh)`, i = "y";
214
- } else if (!i && Math.abs(o) > Math.abs(r) || i === "x") {
215
- const a = o / window.innerWidth * 100;
216
- s.imageContainer.style.transition = "none", s.imageContainer.style.transform = `translateX(${a}vw)`, i = "x";
210
+ const o = e.x - t.x, a = e.y - t.y;
211
+ if (!i && Math.abs(a) > Math.abs(o) || i === "y") {
212
+ const r = a / window.innerHeight * 100;
213
+ s.imageContainer.style.transition = "none", s.imageContainer.style.transform = `translateY(${r}vh)`, i = "y";
214
+ } else if (!i && Math.abs(o) > Math.abs(a) || i === "x") {
215
+ const r = o / window.innerWidth * 100;
216
+ s.imageContainer.style.transition = "none", s.imageContainer.style.transform = `translateX(${r}vw)`, i = "x";
217
217
  }
218
218
  }
219
219
  if (n.event === "up" || n.event === "cancel") {
220
- let o = function(r) {
221
- var a;
222
- (a = s.imageContainer) == null || a.addEventListener("transitionend", function h() {
220
+ let o = function(a) {
221
+ var r;
222
+ (r = s.imageContainer) == null || r.addEventListener("transitionend", function h() {
223
223
  var c;
224
224
  (c = s.imageContainer) == null || c.removeEventListener("transitionend", h), s.imageContainer.style.transition = "", s.imageContainer.style.transform = "";
225
- }), s.imageContainer.style.transition = "transform 222ms ease", s.imageContainer.style.transform = r;
225
+ }), s.imageContainer.style.transition = "transform 222ms ease", s.imageContainer.style.transform = a;
226
226
  };
227
227
  if (i === "y") {
228
- const r = e.y - t.y, a = n.pointer.movementY, h = 8;
229
- s.imageContainer.style.transition = "", r > 0 && Math.abs(a) > h || r < 0 && Math.abs(a) > h ? (s.imageContainer.style.transition = "transform 222ms ease", s.imageContainer.style.transform = "translateY(0vh)", s.close()) : o("translateY(0vh)");
228
+ const a = e.y - t.y, r = n.pointer.movementY, h = 8;
229
+ s.imageContainer.style.transition = "", a > 0 && Math.abs(r) > h || a < 0 && Math.abs(r) > h ? (s.imageContainer.style.transition = "transform 222ms ease", s.imageContainer.style.transform = "translateY(0vh)", s.close()) : o("translateY(0vh)");
230
230
  }
231
231
  if (i === "x") {
232
- const r = e.x - t.x, a = n.pointer.movementX, h = 8;
233
- s.imageContainer.style.transition = "", r > 0 && Math.abs(a) > h ? s.prev() : r < 0 && Math.abs(a) > h ? s.next() : o("translateX(0vw)");
232
+ const a = e.x - t.x, r = n.pointer.movementX, h = 8;
233
+ s.imageContainer.style.transition = "", a > 0 && Math.abs(r) > h ? s.prev() : a < 0 && Math.abs(r) > h ? s.next() : o("translateX(0vw)");
234
234
  }
235
235
  i = null;
236
236
  }
@@ -243,11 +243,11 @@ async function Q({
243
243
  vistaView: { isReducedMotion: s },
244
244
  htmlElements: { to: t },
245
245
  index: { from: e, to: i },
246
- vistaView: { elements: n, imageContainer: o, options: r }
247
- }, a) {
248
- if (!t || a.aborted || s || !(Math.abs(i - e) === 1 || e === 0 && i === n.length - 1 || e === n.length - 1 && i === 0))
246
+ vistaView: { elements: n, imageContainer: o, options: a }
247
+ }, r) {
248
+ if (!t || r.aborted || s || !(Math.abs(i - e) === 1 || e === 0 && i === n.length - 1 || e === n.length - 1 && i === 0))
249
249
  return;
250
- const c = Math.round(r.animationDurationBase * 1.5 * 100) / 100;
250
+ const c = Math.round(a.animationDurationBase * 1.5 * 100) / 100;
251
251
  return new Promise((m) => {
252
252
  o.addEventListener(
253
253
  "transitionend",
@@ -426,19 +426,19 @@ class tt {
426
426
  isMax: i >= this.maxDimension.width,
427
427
  isMin: i <= this.minDimension.initialWidth
428
428
  }), this.scale = C(i / this.rect.width);
429
- const n = this.rect.left + this.rect.width / 2, o = this.rect.top + this.rect.height / 2, r = this.initialCenter.x - n, a = this.initialCenter.y - o, h = r * (1 - this.scale), c = a * (1 - this.scale), m = e.x - this.initialCenter.x, w = e.y - this.initialCenter.y;
429
+ const n = this.rect.left + this.rect.width / 2, o = this.rect.top + this.rect.height / 2, a = this.initialCenter.x - n, r = this.initialCenter.y - o, h = a * (1 - this.scale), c = r * (1 - this.scale), m = e.x - this.initialCenter.x, w = e.y - this.initialCenter.y;
430
430
  this.translate.x = C(h + m), this.translate.y = C(c + w), this.image.style.transform = `translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`, i <= this.minDimension.closingWidth ? this.image.style.opacity = "0.5" : this.image.style.opacity = "";
431
431
  }
432
432
  moveAndNormalize(t) {
433
433
  let e = 0, i = !1;
434
- const n = ({ x: o, y: r }) => {
434
+ const n = ({ x: o, y: a }) => {
435
435
  if (i)
436
436
  return;
437
- if (Math.abs(o) < 1e-3 && Math.abs(r) < 1e-3)
437
+ if (Math.abs(o) < 1e-3 && Math.abs(a) < 1e-3)
438
438
  return this.normalize();
439
- o *= 0.9, r *= 0.9;
440
- const a = this.image.getBoundingClientRect();
441
- this.translate.x = C(this.translate.x + o), this.translate.y = C(this.translate.y + r), a.right < window.innerWidth / 2 && (this.translate.x += (window.innerWidth / 2 - a.right) * 0.1, o *= 0.7), a.left > window.innerWidth / 2 && (this.translate.x -= (a.left - window.innerWidth / 2) * 0.1, o *= 0.7), a.bottom < window.innerHeight / 2 && (this.translate.y += (window.innerHeight / 2 - a.bottom) * 0.1, r *= 0.7), a.top > window.innerHeight / 2 && (this.translate.y -= (a.top - window.innerHeight / 2) * 0.1, r *= 0.7), this.image.style.transform = `translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`, e = requestAnimationFrame(() => n({ x: o, y: r }));
439
+ o *= 0.9, a *= 0.9;
440
+ const r = this.image.getBoundingClientRect();
441
+ this.translate.x = C(this.translate.x + o), this.translate.y = C(this.translate.y + a), r.right < window.innerWidth / 2 && (this.translate.x += (window.innerWidth / 2 - r.right) * 0.1, o *= 0.7), r.left > window.innerWidth / 2 && (this.translate.x -= (r.left - window.innerWidth / 2) * 0.1, o *= 0.7), r.bottom < window.innerHeight / 2 && (this.translate.y += (window.innerHeight / 2 - r.bottom) * 0.1, a *= 0.7), r.top > window.innerHeight / 2 && (this.translate.y -= (r.top - window.innerHeight / 2) * 0.1, a *= 0.7), this.image.style.transform = `translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`, e = requestAnimationFrame(() => n({ x: o, y: a }));
442
442
  };
443
443
  return n({
444
444
  x: t.movementX,
@@ -497,14 +497,14 @@ class et {
497
497
  }
498
498
  // first in out
499
499
  fio(t, e, i = 50) {
500
- const o = Date.now() - (this.fiolast[e] ?? 0), r = () => {
500
+ const o = Date.now() - (this.fiolast[e] ?? 0), a = () => {
501
501
  this.fiolast[e] = Date.now(), t();
502
502
  };
503
503
  if (!this.fiolast[e]) {
504
- r();
504
+ a();
505
505
  return;
506
506
  }
507
- o >= i && r();
507
+ o >= i && a();
508
508
  }
509
509
  }
510
510
  const x = {
@@ -566,8 +566,8 @@ class it {
566
566
  this.currentChildren.htmls.forEach((t, e) => {
567
567
  const i = this.currentChildren.images[e], n = t.querySelector("img.vvw-img-hi"), o = t.querySelector("img.vvw-img-lo");
568
568
  if (M(i, n, o, !1), n.classList.contains("vvw--loaded")) {
569
- const { width: r, height: a } = D(n);
570
- n.style.setProperty("--vvw-current-w", `${r}px`), n.style.setProperty("--vvw-current-h", `${a}px`), n.dataset.vvwWidth = r.toString(), n.dataset.vvwHeight = a.toString();
569
+ const { width: a, height: r } = D(n);
570
+ n.style.setProperty("--vvw-current-w", `${a}px`), n.style.setProperty("--vvw-current-h", `${r}px`), n.dataset.vvwWidth = a.toString(), n.dataset.vvwHeight = r.toString();
571
571
  }
572
572
  });
573
573
  });
@@ -580,28 +580,28 @@ class it {
580
580
  return (o) => {
581
581
  if (o.event === "down") {
582
582
  if (n(), this.isZoomedIn && o.pointers.length === 1) {
583
- const r = this.pointers.getCentroid();
584
- t.setInitialCenter(r);
583
+ const a = this.pointers.getCentroid();
584
+ t.setInitialCenter(a);
585
585
  }
586
586
  if (o.pointers.length >= 2) {
587
587
  i = !0;
588
- const r = this.pointers.getCentroid();
589
- e = this.pointers.getPointerDistance(o.pointers[0], o.pointers[1]), t.setInitialCenter(r);
588
+ const a = this.pointers.getCentroid();
589
+ e = this.pointers.getPointerDistance(o.pointers[0], o.pointers[1]), t.setInitialCenter(a);
590
590
  }
591
591
  } else if (o.event === "move") {
592
592
  if (this.isZoomedIn && o.pointers.length === 1 && o.lastPointerLen === 0) {
593
- const r = this.pointers.getCentroid();
594
- t.move(r);
593
+ const a = this.pointers.getCentroid();
594
+ t.move(a);
595
595
  }
596
596
  if (o.pointers.length >= 2 && i) {
597
- const r = this.pointers.getCentroid(), a = this.pointers.getPointerDistance(o.pointers[0], o.pointers[1]);
598
- t.scaleMove(a / e, r);
597
+ const a = this.pointers.getCentroid(), r = this.pointers.getPointerDistance(o.pointers[0], o.pointers[1]);
598
+ t.scaleMove(r / e, a);
599
599
  }
600
600
  } else (o.event === "up" || o.event === "cancel") && (i || this.isZoomedIn) && (i ? (i = !1, t.normalize() && requestAnimationFrame(() => {
601
601
  this.close();
602
602
  })) : this.isZoomedIn && o.pointers.length === 0 && (n = t.moveAndNormalize(o.pointer)));
603
603
  this.pointerListeners.forEach(
604
- (r) => r({
604
+ (a) => a({
605
605
  ...o,
606
606
  hasInternalExecution: this.isZoomedIn || i
607
607
  })
@@ -618,11 +618,11 @@ class it {
618
618
  }, this.imageState = new tt(
619
619
  this.options.maxZoomLevel,
620
620
  (i) => {
621
- var n, o, r, a, h, c;
621
+ var n, o, a, r, h, c;
622
622
  i.isMin ? (this.isZoomedIn = !1, (n = this.qs(".vvw-zoom-out")) == null || n.setAttribute("disabled", "true"), (o = this.qs('.vvw-item[data-vvw-idx="' + this.currentIndex + '"]')) == null || o.style.setProperty(
623
623
  "pointer-events",
624
624
  "none"
625
- )) : (this.isZoomedIn = !0, (r = this.qs(".vvw-zoom-out")) == null || r.removeAttribute("disabled"), (a = this.qs('.vvw-item[data-vvw-idx="' + this.currentIndex + '"]')) == null || a.style.setProperty(
625
+ )) : (this.isZoomedIn = !0, (a = this.qs(".vvw-zoom-out")) == null || a.removeAttribute("disabled"), (r = this.qs('.vvw-item[data-vvw-idx="' + this.currentIndex + '"]')) == null || r.style.setProperty(
626
626
  "pointer-events",
627
627
  "auto"
628
628
  )), i.isMax ? (h = this.qs(".vvw-zoom-in")) == null || h.setAttribute("disabled", "true") : (c = this.qs(".vvw-zoom-in")) == null || c.removeAttribute("disabled");
@@ -635,39 +635,39 @@ class it {
635
635
  return this.root ? this.root.querySelector(t) : null;
636
636
  }
637
637
  async swap(t, e) {
638
- const i = this.options.preloads || 0, n = this.currentIndex, { htmls: o, images: r } = this.getChildElements(i, n), a = this.imageContainer, h = this.currentChildren, c = {
638
+ const i = this.options.preloads || 0, n = this.currentIndex, { htmls: o, images: a } = this.getChildElements(i, n), r = this.imageContainer, h = this.currentChildren, c = {
639
639
  htmlElements: { from: h.htmls, to: o },
640
- images: { from: h.images, to: r },
640
+ images: { from: h.images, to: a },
641
641
  index: { from: t, to: this.currentIndex },
642
642
  via: e || { next: !1, prev: !1 },
643
643
  vistaView: this
644
644
  };
645
- this.setupFunction(c), this.currentChildren = { htmls: o, images: r }, this.displayActiveIndex();
646
- const m = this.abortController.signal, w = performance.now(), L = w - this.lastSwapTime < this.options.rapidLimit;
645
+ this.setupFunction(c), this.currentChildren = { htmls: o, images: a }, this.displayActiveIndex();
646
+ const m = this.abortController.signal, w = performance.now(), b = w - this.lastSwapTime < this.options.rapidLimit;
647
647
  let p = null;
648
- L || (p = await this.transitionFunction(c, m)), this.lastSwapTime = w;
649
- const d = o[Math.floor(o.length / 2)].dataset.vvwIdx, v = a.querySelector(
648
+ b || (p = await this.transitionFunction(c, m)), this.lastSwapTime = w;
649
+ const d = o[Math.floor(o.length / 2)].dataset.vvwIdx, v = r.querySelector(
650
650
  `.vvw-item[data-vvw-idx="${d}"] img.vvw-img-hi`
651
- ), g = v.getAttribute("style") || "", f = v.classList.contains("vvw--loaded"), u = v.width, b = v.height;
652
- this.imageState.reset(), a.innerHTML = "", p instanceof Function && p(), o.forEach((E) => {
651
+ ), g = v.getAttribute("style") || "", f = v.classList.contains("vvw--loaded"), u = v.width, L = v.height;
652
+ this.imageState.reset(), r.innerHTML = "", p instanceof Function && p(), o.forEach((E) => {
653
653
  const y = E.querySelector("img.vvw-img-hi");
654
654
  E.dataset.vvwPos === "0" && !m.aborted && g && f && // ready &&
655
- u && b && (y.classList.add("vvw--loaded"), y.classList.add("vvw--ready"), y.setAttribute("style", g), y.width = u, y.height = b, y.dataset.vvwWidth = u.toString(), y.dataset.vvwHeight = b.toString()), a.appendChild(E), y.classList.contains("vvw--ready") && (this.imageState.setCurrentImage(y), this.imageState.setInitialCenter());
655
+ u && L && (y.classList.add("vvw--loaded"), y.classList.add("vvw--ready"), y.setAttribute("style", g), y.width = u, y.height = L, y.dataset.vvwWidth = u.toString(), y.dataset.vvwHeight = L.toString()), r.appendChild(E), y.classList.contains("vvw--ready") && (this.imageState.setCurrentImage(y), this.imageState.setInitialCenter());
656
656
  }), this.waitForImagesToLoad(), this.options.onImageView && this.options.onImageView(c);
657
657
  }
658
658
  getChildElements(t, e) {
659
659
  const i = [], n = [];
660
660
  for (let o = -t; o <= t; o++) {
661
- const r = (e + o + this.elements.length) % this.elements.length, a = this.elements[r], h = a instanceof HTMLImageElement ? a : a instanceof HTMLAnchorElement && a.querySelector("img") || void 0, c = a instanceof HTMLElement ? {
662
- index: r,
661
+ const a = (e + o + this.elements.length) % this.elements.length, r = this.elements[a], h = r instanceof HTMLImageElement ? r : r instanceof HTMLAnchorElement && r.querySelector("img") || void 0, c = r instanceof HTMLElement ? {
662
+ index: a,
663
663
  imageElm: h instanceof HTMLImageElement ? h : void 0,
664
- anchorElm: a instanceof HTMLAnchorElement ? a : void 0,
665
- src: a.dataset.vistaviewSrc || a.getAttribute("href") || a.getAttribute("src") || "",
666
- thumb: a.dataset.vistaviewThumb || (h instanceof HTMLImageElement ? h.getAttribute("src") : void 0) || a.getAttribute("href") || void 0,
664
+ anchorElm: r instanceof HTMLAnchorElement ? r : void 0,
665
+ src: r.dataset.vistaviewSrc || r.getAttribute("href") || r.getAttribute("src") || "",
666
+ thumb: r.dataset.vistaviewThumb || (h instanceof HTMLImageElement ? h.getAttribute("src") : void 0) || r.getAttribute("href") || void 0,
667
667
  alt: h instanceof HTMLImageElement && h.getAttribute("alt") || void 0
668
668
  } : {
669
- index: r,
670
- ...a
669
+ index: a,
670
+ ...r
671
671
  };
672
672
  n.push(c), i.push(j(c, o));
673
673
  }
@@ -695,29 +695,29 @@ class it {
695
695
  );
696
696
  }
697
697
  displayActiveIndex() {
698
- var n;
698
+ var a;
699
699
  const t = this.currentIndex;
700
- this.elements instanceof NodeList && this.elements.forEach((o, r) => {
701
- o.style.opacity = "", r === t && (o.style.opacity = "0");
700
+ this.elements instanceof NodeList && this.elements.forEach((r, h) => {
701
+ r.style.opacity = "", h === t && (r.style.opacity = "0");
702
702
  });
703
- const e = this.qs(".vvw-index");
704
- e && (e.textContent = `${t + 1} / ${this.elements.length}`);
705
- const i = this.qs(".vvw-desc");
706
- if (i) {
707
- const o = (n = this.currentChildren) == null ? void 0 : n.images.find((r) => r.index === t);
708
- o && o.alt ? i.textContent = o.alt : i.textContent = "";
703
+ const e = this.qs(".vvw-index"), i = `${t + 1}`, n = `${this.elements.length}`;
704
+ e && (e.textContent = `${i} / ${n}`);
705
+ const o = this.qs(".vvw-desc");
706
+ if (o) {
707
+ const r = (a = this.currentChildren) == null ? void 0 : a.images.find((c) => c.index === t), h = (r == null ? void 0 : r.alt) || "";
708
+ h ? (o.textContent = h, o.setAttribute("aria-label", `Image ${i} of ${n}: ${h}`)) : (o.textContent = "", o.setAttribute("aria-label", `Image ${i} of ${n}`));
709
709
  }
710
710
  }
711
711
  waitForImagesToLoad() {
712
712
  this.imageContainer.querySelectorAll("img.vvw-img-hi:not(.vvw--loaded)").forEach((i) => {
713
713
  const n = i, o = () => {
714
- var a;
714
+ var r;
715
715
  n.width = n.naturalWidth, n.height = n.naturalHeight;
716
- const r = (a = n.parentElement) == null ? void 0 : a.matches(`[data-vvw-idx="${this.currentIndex}"]`);
716
+ const a = (r = n.parentElement) == null ? void 0 : r.matches(`[data-vvw-idx="${this.currentIndex}"]`);
717
717
  n.addEventListener(
718
718
  "transitionend",
719
719
  () => {
720
- r && (this.imageState.setCurrentImage(n), this.imageState.setInitialCenter()), n.classList.add("vvw--ready");
720
+ a && (this.imageState.setCurrentImage(n), this.imageState.setInitialCenter()), n.classList.add("vvw--ready");
721
721
  },
722
722
  { once: !0 }
723
723
  ), n.classList.add("vvw--loaded"), requestAnimationFrame(() => {
@@ -744,7 +744,7 @@ class it {
744
744
  }
745
745
  /// OPEN
746
746
  open(t = 0) {
747
- var c, m, w, L, p;
747
+ var c, m, w, b, p;
748
748
  if (x.somethingOpened)
749
749
  return;
750
750
  x.somethingOpened = this, this.currentIndex = t, document.body.style.overflow = "hidden";
@@ -754,16 +754,16 @@ class it {
754
754
  if (document.body.prepend(e), this.root = document.body.querySelector("#vvw-root"), !this.root)
755
755
  throw new Error("Failed to setup VistaView root element.");
756
756
  this.imageContainer = this.qs(".vvw-image-container"), this.options.animationDurationBase && this.root.style.setProperty("--vvw-anim-dur", `${this.options.animationDurationBase}`), this.options.initialZIndex !== void 0 && this.root.style.setProperty("--vvw-init-z", `${this.options.initialZIndex}`);
757
- const i = this.options.preloads || 0, n = t, { images: o, htmls: r } = this.getChildElements(i, n), a = {
758
- htmlElements: { from: null, to: r },
757
+ const i = this.options.preloads || 0, n = t, { images: o, htmls: a } = this.getChildElements(i, n), r = {
758
+ htmlElements: { from: null, to: a },
759
759
  images: { from: null, to: o },
760
760
  index: { from: null, to: this.currentIndex },
761
761
  via: { next: !1, prev: !1 },
762
762
  vistaView: this
763
763
  };
764
- this.setupFunction(a), this.currentChildren = { htmls: r, images: o }, r.forEach((d) => {
764
+ this.setupFunction(r), this.currentChildren = { htmls: a, images: o }, a.forEach((d) => {
765
765
  this.imageContainer.appendChild(d);
766
- }), (c = this.qs(".vvw-close")) == null || c.addEventListener("click", () => this.close()), (m = this.qs(".vvw-zoom-in")) == null || m.addEventListener("click", () => this.zoomIn()), (w = this.qs(".vvw-zoom-out")) == null || w.addEventListener("click", () => this.zoomOut()), (L = this.qs(".vvw-prev>button")) == null || L.addEventListener("click", () => this.prev()), (p = this.qs(".vvw-next>button")) == null || p.addEventListener("click", () => this.next()), window.addEventListener("keydown", this.onKeyDown), window.addEventListener("wheel", this.onScroll, { passive: !1 }), window.addEventListener("resize", this.onResizeHandler), this.pointers = new V({
766
+ }), (c = this.qs(".vvw-close")) == null || c.addEventListener("click", () => this.close()), (m = this.qs(".vvw-zoom-in")) == null || m.addEventListener("click", () => this.zoomIn()), (w = this.qs(".vvw-zoom-out")) == null || w.addEventListener("click", () => this.zoomOut()), (b = this.qs(".vvw-prev>button")) == null || b.addEventListener("click", () => this.prev()), (p = this.qs(".vvw-next>button")) == null || p.addEventListener("click", () => this.next()), window.addEventListener("keydown", this.onKeyDown), window.addEventListener("wheel", this.onScroll, { passive: !1 }), window.addEventListener("resize", this.onResizeHandler), this.pointers = new V({
767
767
  elm: this.imageContainer,
768
768
  listeners: [this.getInternalPointerListener()]
769
769
  });
@@ -780,12 +780,12 @@ class it {
780
780
  }), this.root.querySelectorAll("button[data-vvw-control]").forEach((d) => {
781
781
  const v = d;
782
782
  v.addEventListener("click", (g) => {
783
- const f = g.currentTarget.dataset.vvwControl, u = h[f], b = this.currentChildren.images.find(
783
+ const f = g.currentTarget.dataset.vvwControl, u = h[f], L = this.currentChildren.images.find(
784
784
  (E) => E.index === this.currentIndex
785
785
  );
786
- u && b && (u.onClick.constructor.name === "AsyncFunction" ? (v.classList.add("vvw--loading"), u.onClick(b, this).finally(() => {
786
+ u && L && (u.onClick.constructor.name === "AsyncFunction" ? (v.classList.add("vvw--loading"), u.onClick(L, this).finally(() => {
787
787
  v.classList.remove("vvw--loading");
788
- })) : u.onClick(b, this));
788
+ })) : u.onClick(L, this));
789
789
  });
790
790
  }), this.initFunction(this), requestAnimationFrame(() => {
791
791
  var d;
@@ -798,7 +798,7 @@ class it {
798
798
  }), this.imageState.reset();
799
799
  },
800
800
  { once: !0 }
801
- ), this.root.classList.add("vvw--active"), this.displayActiveIndex(), this.options.onOpen && this.options.onOpen(this), this.options.onImageView && this.options.onImageView(a);
801
+ ), this.root.classList.add("vvw--active"), this.displayActiveIndex(), this.options.onOpen && this.options.onOpen(this), this.options.onImageView && this.options.onImageView(r);
802
802
  });
803
803
  }
804
804
  /// CLOSE
@@ -806,8 +806,8 @@ class it {
806
806
  x.somethingOpened === this && this.root && (t ? await new Promise((e) => {
807
807
  let n = 0;
808
808
  this.root.addEventListener("transitionend", (o) => {
809
- o.target === this.root && (n++, n === 2 && this.elements instanceof NodeList && this.elements.forEach((r) => {
810
- r.style.opacity = "";
809
+ o.target === this.root && (n++, n === 2 && this.elements instanceof NodeList && this.elements.forEach((a) => {
810
+ a.style.opacity = "";
811
811
  }), n === 3 && e(null));
812
812
  }), this.root.classList.add("vvw--closing");
813
813
  }) : this.elements instanceof NodeList && this.elements.forEach((e) => {
@@ -1,4 +1,4 @@
1
- (function(v,w){typeof exports=="object"&&typeof module<"u"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(v=typeof globalThis<"u"?globalThis:v||self,w(v.VistaView={}))})(this,(function(v){"use strict";var st=Object.defineProperty;var ot=(v,w,S)=>w in v?st(v,w,{enumerable:!0,configurable:!0,writable:!0,value:S}):v[w]=S;var l=(v,w,S)=>ot(v,typeof w!="symbol"?w+"":w,S);function w(s){return s&&!/^0(px|%|r?em|vw|vh|vmin|vmax|cm|mm|in|pt|pc|ex|ch)?$/i.test(s.trim())&&s}function S(s){const e=window.getComputedStyle(s).objectFit||"",{width:i,height:n}=s.getBoundingClientRect(),o=s.naturalWidth,r=s.naturalHeight;if(!e)return{width:i,height:n};if(!o||!r)return{width:i,height:n};const a=o/r,h=i/n;switch(e){case"fill":return{width:i,height:n};case"none":return{width:o,height:r};case"contain":return a>h?{width:i,height:i/a}:{width:n*a,height:n};case"cover":return a<h?{width:i,height:i/a}:{width:n*a,height:n};case"scale-down":{const c={width:o,height:r},m=a>h?{width:i,height:i/a}:{width:n*a,height:n};return m.width<=c.width&&m.height<=c.height?m:c}}return{width:i,height:n}}function M(s){const t=getComputedStyle(s),e=s.getBoundingClientRect();return{objectFit:t.objectFit,borderRadius:t.borderRadius,objectPosition:t.objectPosition,overflow:t.overflow,top:e.top,left:e.left,width:e.width,height:e.height,naturalWidth:s.naturalWidth,naturalHeight:s.naturalHeight}}function P(s){const t=s.imageElm?M(s.imageElm):null,e=s.anchorElm?M(s.anchorElm):null,i=w(t==null?void 0:t.borderRadius),n=e&&w(e==null?void 0:e.borderRadius),o=(n?e==null?void 0:e.borderRadius:i?t==null?void 0:t.borderRadius:"")||"";return{fit:(t==null?void 0:t.objectFit)||(e==null?void 0:e.objectFit)||"",pos:(t==null?void 0:t.objectPosition)||"",br:o,overflow:n?e.overflow:i?t.overflow:"",nw:(t==null?void 0:t.naturalWidth)||0,nh:(t==null?void 0:t.naturalHeight)||0,w:(e==null?void 0:e.width)||(t==null?void 0:t.width)||0,h:(e==null?void 0:e.height)||(t==null?void 0:t.height)||0,top:(e==null?void 0:e.top)||(t==null?void 0:t.top)||0,left:(e==null?void 0:e.left)||(t==null?void 0:t.left)||0}}function W(s,t,e,i=!1){const{fit:n,w:o,h:r,nw:a,nh:h,br:c,top:m,left:f}=P(s),E=Math.min(Math.max(f,-o),window.innerWidth+o)-window.innerWidth/2+o/2,y=Math.min(Math.max(m,-r),window.innerHeight+r)-window.innerHeight/2+r/2,d=e.style;d.width=`${o}px`,d.height=`${r}px`,d.objectFit=n,e.width=a,e.height=h,d.setProperty("--vvw-init-radius",`${c}`),d.setProperty("--vvw-pulse-radius",`calc(1.3 * ${c})`),d.setProperty("--vvw-init-x",`${E}px`),d.setProperty("--vvw-init-y",`${y}px`),i&&(d.setProperty("--vvw-current-x",`${E}px`),d.setProperty("--vvw-current-y",`${y}px`));const g=S(s.imageElm),p=Math.min(o,g.width),x=Math.min(r,g.height),u=t.style;u.setProperty("--vvw-init-radius",`${c}`),u.setProperty("--vvw-init-w",`${p}px`),u.setProperty("--vvw-init-h",`${x}px`),i&&(u.setProperty("--vvw-current-radius",`${c}`),u.setProperty("--vvw-current-w",`${p}px`),u.setProperty("--vvw-current-h",`${x}px`),t.dataset.vvwWidth=p.toString(),t.dataset.vvwHeight=x.toString())}function T(s){const t=window.innerWidth,e=window.innerHeight,i=s.naturalWidth,n=s.naturalHeight;if(!i||!n)throw new Error("Image natural dimensions are zero");if(i<t&&n<e)return{width:i,height:n};const o=i/n,r=t/e;let a,h;return o>r?(a=t,h=t/o):(h=e,a=e*o),{width:a,height:h}}function A(s,t,e){return Math.min(Math.max(s,t),e)}function C(s,t=2){const e=Math.pow(10,t);return Math.round(s*e)/e}const q='<svg viewBox="0 0 24 24"><path d="m15 18-6-6 6-6"/></svg>',k='<svg viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"/></svg>',R='<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/></svg>',O='<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>',Y='<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>',Z='<svg viewBox="0 0 24 24"><path d="M12 15V3"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/></svg>';let D=null;function X(){return D||(window.trustedTypes||(window.trustedTypes={createPolicy:(s,t)=>t}),D=window.trustedTypes.createPolicy("vistaView-policy",{createHTML:s=>s,createScript:()=>{throw new Error("Not implemented")},createScriptURL:()=>{throw new Error("Not implemented")}}),D)}function z(s){const e=X().createHTML(s),i=document.createElement("template");i.innerHTML=e;const n=i.content;return i.remove(),n}function F(){return{name:"download",icon:Z,onClick:async s=>{var o;const t=await fetch(s.src),e=await t.blob(),i=t.url,n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=((o=i.split("/").pop())==null?void 0:o.split("?")[0].split("#")[0])||"download",document.body.appendChild(n),n.click(),document.body.removeChild(n)}}}function B(s){if(typeof s=="string")switch(s){case"zoomIn":return`<button class="vvw-zoom-in vvw-ui">${R}</button>`;case"zoomOut":return`<button disabled class="vvw-zoom-out vvw-ui">${O}</button>`;case"close":return`<button class="vvw-close vvw-ui">${Y}</button>`;case"indexDisplay":return'<div class="vvw-index vvw-ui"></div>';case"description":return'<div class="vvw-desc vvw-ui"></div>';default:return""}return`<button data-vvw-control="${s.name}">${s.icon}</button>`}function N(s,t){const e=document.createElement("div");e.className="vvw-item",e.dataset.vvwPos=`${t!==void 0?t:""}`,e.dataset.vvwIdx=s.index.toString(),e.appendChild(z(`<p class="vvw-img-err">Error loading image</p>
1
+ (function(v,w){typeof exports=="object"&&typeof module<"u"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(v=typeof globalThis<"u"?globalThis:v||self,w(v.VistaView={}))})(this,(function(v){"use strict";var st=Object.defineProperty;var ot=(v,w,$)=>w in v?st(v,w,{enumerable:!0,configurable:!0,writable:!0,value:$}):v[w]=$;var l=(v,w,$)=>ot(v,typeof w!="symbol"?w+"":w,$);function w(s){return s&&!/^0(px|%|r?em|vw|vh|vmin|vmax|cm|mm|in|pt|pc|ex|ch)?$/i.test(s.trim())&&s}function $(s){const e=window.getComputedStyle(s).objectFit||"",{width:i,height:n}=s.getBoundingClientRect(),o=s.naturalWidth,a=s.naturalHeight;if(!e)return{width:i,height:n};if(!o||!a)return{width:i,height:n};const r=o/a,h=i/n;switch(e){case"fill":return{width:i,height:n};case"none":return{width:o,height:a};case"contain":return r>h?{width:i,height:i/r}:{width:n*r,height:n};case"cover":return r<h?{width:i,height:i/r}:{width:n*r,height:n};case"scale-down":{const c={width:o,height:a},m=r>h?{width:i,height:i/r}:{width:n*r,height:n};return m.width<=c.width&&m.height<=c.height?m:c}}return{width:i,height:n}}function M(s){const t=getComputedStyle(s),e=s.getBoundingClientRect();return{objectFit:t.objectFit,borderRadius:t.borderRadius,objectPosition:t.objectPosition,overflow:t.overflow,top:e.top,left:e.left,width:e.width,height:e.height,naturalWidth:s.naturalWidth,naturalHeight:s.naturalHeight}}function A(s){const t=s.imageElm?M(s.imageElm):null,e=s.anchorElm?M(s.anchorElm):null,i=w(t==null?void 0:t.borderRadius),n=e&&w(e==null?void 0:e.borderRadius),o=(n?e==null?void 0:e.borderRadius:i?t==null?void 0:t.borderRadius:"")||"";return{fit:(t==null?void 0:t.objectFit)||(e==null?void 0:e.objectFit)||"",pos:(t==null?void 0:t.objectPosition)||"",br:o,overflow:n?e.overflow:i?t.overflow:"",nw:(t==null?void 0:t.naturalWidth)||0,nh:(t==null?void 0:t.naturalHeight)||0,w:(e==null?void 0:e.width)||(t==null?void 0:t.width)||0,h:(e==null?void 0:e.height)||(t==null?void 0:t.height)||0,top:(e==null?void 0:e.top)||(t==null?void 0:t.top)||0,left:(e==null?void 0:e.left)||(t==null?void 0:t.left)||0}}function W(s,t,e,i=!1){const{fit:n,w:o,h:a,nw:r,nh:h,br:c,top:m,left:f}=A(s),E=Math.min(Math.max(f,-o),window.innerWidth+o)-window.innerWidth/2+o/2,y=Math.min(Math.max(m,-a),window.innerHeight+a)-window.innerHeight/2+a/2,d=e.style;d.width=`${o}px`,d.height=`${a}px`,d.objectFit=n,e.width=r,e.height=h,d.setProperty("--vvw-init-radius",`${c}`),d.setProperty("--vvw-pulse-radius",`calc(1.3 * ${c})`),d.setProperty("--vvw-init-x",`${E}px`),d.setProperty("--vvw-init-y",`${y}px`),i&&(d.setProperty("--vvw-current-x",`${E}px`),d.setProperty("--vvw-current-y",`${y}px`));const g=$(s.imageElm),p=Math.min(o,g.width),x=Math.min(a,g.height),u=t.style;u.setProperty("--vvw-init-radius",`${c}`),u.setProperty("--vvw-init-w",`${p}px`),u.setProperty("--vvw-init-h",`${x}px`),i&&(u.setProperty("--vvw-current-radius",`${c}`),u.setProperty("--vvw-current-w",`${p}px`),u.setProperty("--vvw-current-h",`${x}px`),t.dataset.vvwWidth=p.toString(),t.dataset.vvwHeight=x.toString())}function T(s){const t=window.innerWidth,e=window.innerHeight,i=s.naturalWidth,n=s.naturalHeight;if(!i||!n)throw new Error("Image natural dimensions are zero");if(i<t&&n<e)return{width:i,height:n};const o=i/n,a=t/e;let r,h;return o>a?(r=t,h=t/o):(h=e,r=e*o),{width:r,height:h}}function P(s,t,e){return Math.min(Math.max(s,t),e)}function C(s,t=2){const e=Math.pow(10,t);return Math.round(s*e)/e}const q='<svg viewBox="0 0 24 24"><path d="m15 18-6-6 6-6"/></svg>',k='<svg viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"/></svg>',R='<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/></svg>',O='<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>',Z='<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>',Y='<svg viewBox="0 0 24 24"><path d="M12 15V3"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/></svg>';let D=null;function X(){return D||(window.trustedTypes||(window.trustedTypes={createPolicy:(s,t)=>t}),D=window.trustedTypes.createPolicy("vistaView-policy",{createHTML:s=>s,createScript:()=>{throw new Error("Not implemented")},createScriptURL:()=>{throw new Error("Not implemented")}}),D)}function z(s){const e=X().createHTML(s),i=document.createElement("template");i.innerHTML=e;const n=i.content;return i.remove(),n}function F(){return{name:"download",icon:Y,onClick:async s=>{var o;const t=await fetch(s.src),e=await t.blob(),i=t.url,n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=((o=i.split("/").pop())==null?void 0:o.split("?")[0].split("#")[0])||"download",document.body.appendChild(n),n.click(),document.body.removeChild(n)}}}function B(s){if(typeof s=="string")switch(s){case"zoomIn":return`<button aria-label="Zoom In" class="vvw-zoom-in vvw-ui">${R}</button>`;case"zoomOut":return`<button aria-label="Zoom Out" disabled class="vvw-zoom-out vvw-ui">${O}</button>`;case"close":return`<button aria-label="Close" class="vvw-close vvw-ui">${Z}</button>`;case"indexDisplay":return'<div class="vvw-index vvw-ui" aria-hidden="true"></div>';case"description":return'<div class="vvw-desc vvw-ui" role="status" aria-live="polite" aria-atomic="true"></div>';default:return""}return`<button aria-label="${s.description||s.name}" data-vvw-control="${s.name}">${s.icon}</button>`}function N(s,t){const e=document.createElement("div");e.className="vvw-item",e.dataset.vvwPos=`${t!==void 0?t:""}`,e.dataset.vvwIdx=s.index.toString(),e.appendChild(z(`<p class="vvw-img-err">Error loading image</p>
2
2
  <img class="vvw-img-lo" src="${s.thumb||s.src}" alt="${s.alt||""}" />
3
3
  <img class="vvw-img-hi" src="${s.src}" alt="${s.alt||""}" />`));const i=e.querySelector("img.vvw-img-lo"),n=e.querySelector("img.vvw-img-hi");return W(s,n,i,t===0),e}function j({controls:s}){const t=i=>i?i.map(B).join(""):"";return z(`<div class="vvw-root" id="vvw-root">
4
4
  <div class="vvw-container">
@@ -9,4 +9,4 @@
9
9
  <div class="vvw-prev vvw-ui"><button>${q}</button></div>
10
10
  <div class="vvw-next vvw-ui"><button>${k}</button></div>
11
11
  </div>
12
- </div>`)}const H={animationDurationBase:333,zoomStep:500,maxZoomLevel:2,touchSpeedThreshold:.5,preloads:1,keyboardListeners:!0,arrowOnSmallScreens:!1,rapidLimit:222,controls:{topLeft:["indexDisplay"],topRight:["zoomIn","zoomOut",F(),"close"],bottomLeft:["description"]}};function U(s){}function V(s){const t=s.options.preloads;s.imageContainer.style.width=`${(t*2+1)*100}vw`,s.imageContainer.style.left=`-${t*100}vw`,s.imageContainer.style.display="flex",K(s)}function K(s){let t={x:0,y:0},e={x:0,y:0},i=null;s.registerPointerListener(n=>{if(!n.hasInternalExecution&&!(n.pointers.length>1)){if(n.event==="down"&&(t={x:n.pointer.x,y:n.pointer.y},e={x:n.pointer.x,y:n.pointer.y}),n.event==="move"){e={x:n.pointer.x,y:n.pointer.y};const o=e.x-t.x,r=e.y-t.y;if(!i&&Math.abs(r)>Math.abs(o)||i==="y"){const a=r/window.innerHeight*100;s.imageContainer.style.transition="none",s.imageContainer.style.transform=`translateY(${a}vh)`,i="y"}else if(!i&&Math.abs(o)>Math.abs(r)||i==="x"){const a=o/window.innerWidth*100;s.imageContainer.style.transition="none",s.imageContainer.style.transform=`translateX(${a}vw)`,i="x"}}if(n.event==="up"||n.event==="cancel"){let o=function(r){var a;(a=s.imageContainer)==null||a.addEventListener("transitionend",function h(){var c;(c=s.imageContainer)==null||c.removeEventListener("transitionend",h),s.imageContainer.style.transition="",s.imageContainer.style.transform=""}),s.imageContainer.style.transition="transform 222ms ease",s.imageContainer.style.transform=r};if(i==="y"){const r=e.y-t.y,a=n.pointer.movementY,h=8;s.imageContainer.style.transition="",r>0&&Math.abs(a)>h||r<0&&Math.abs(a)>h?(s.imageContainer.style.transition="transform 222ms ease",s.imageContainer.style.transform="translateY(0vh)",s.close()):o("translateY(0vh)")}if(i==="x"){const r=e.x-t.x,a=n.pointer.movementX,h=8;s.imageContainer.style.transition="",r>0&&Math.abs(a)>h?s.prev():r<0&&Math.abs(a)>h?s.next():o("translateX(0vw)")}i=null}}})}function _(s){}async function G({vistaView:{isReducedMotion:s},htmlElements:{to:t},index:{from:e,to:i},vistaView:{elements:n,imageContainer:o,options:r}},a){if(!t||a.aborted||s||!(Math.abs(i-e)===1||e===0&&i===n.length-1||e===n.length-1&&i===0))return;const c=Math.round(r.animationDurationBase*1.5*100)/100;return new Promise(m=>{o.addEventListener("transitionend",()=>{m(()=>{o.style.transition="",o.style.transform=""})},{once:!0});const f=i===e+1||e===n.length-1&&i===0?"translateX(-100vw)":"translateX(100vw)";o.style.transition=`transform ${c}ms ease`,o.style.transform=f})}class J{constructor({elm:t,listeners:e}){l(this,"pointers",[]);l(this,"elm");l(this,"listeners",[]);l(this,"lastPointerDownId",null);l(this,"removeLastPointer",()=>{if(this.pointers.length&&this.lastPointerDownId!==null){const t=this.pointers.findIndex(e=>e.id===this.lastPointerDownId);t!==-1&&this.pointers.splice(t,1)}});l(this,"onPointerDown",t=>{if(!this.listeners.length||t.button!==0)return;t.preventDefault(),this.lastPointerDownId=t.pointerId,window.addEventListener("contextmenu",this.removeLastPointer,{once:!0}),window.addEventListener("auxclick",this.removeLastPointer,{once:!0});let e={x:t.clientX,y:t.clientY,movementX:0,movementY:0,id:t.pointerId};this.pointers.push(e),this.listeners.forEach(i=>i({event:"down",pointer:e,pointers:this.pointers,lastPointerLen:this.pointers.length-1}))});l(this,"onPointerMove",t=>{if(!this.listeners.length)return;t.preventDefault();const e=this.pointers.find(i=>i.id===t.pointerId);e&&(e.movementX=t.movementX,e.movementY=t.movementY,e.x=t.clientX,e.y=t.clientY,this.listeners.forEach(i=>i({event:"move",pointer:e,pointers:this.pointers,lastPointerLen:this.pointers.length-1})))});l(this,"onPointerUp",t=>{if(!this.listeners.length||t.button!==0||(window.removeEventListener("contextmenu",this.removeLastPointer),window.removeEventListener("auxclick",this.removeLastPointer),t.target instanceof Node&&!this.elm.contains(t.target)&&t.target!==document.querySelector("html")&&t.target!==document))return;t.preventDefault();const e=this.pointers.findIndex(o=>o.id===t.pointerId);if(e===-1)return;const i=this.pointers[e];i.x=t.clientX,i.y=t.clientY;const n=this.pointers.length;this.pointers.splice(e,1),this.listeners.forEach(o=>o({event:"up",pointer:i,pointers:this.pointers,lastPointerLen:n}))});l(this,"onPointerCancel",t=>{if(!this.listeners.length||t.target instanceof Node&&!this.elm.contains(t.target)&&t.target!==document.querySelector("html")&&t.target!==document)return;t.preventDefault();const e=this.pointers.findIndex(o=>o.id===t.pointerId);if(e===-1)return;const i=this.pointers[e];i.x=t.clientX,i.y=t.clientY;const n=this.pointers.length;this.pointers.splice(e,1),this.listeners.forEach(o=>o({event:"cancel",pointer:i,pointers:this.pointers,lastPointerLen:n}))});this.elm=t??document,e&&(this.listeners=e),this.startListeners()}startListeners(){this.elm.addEventListener("pointerdown",this.onPointerDown),this.elm.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp),document.addEventListener("pointercancel",this.onPointerCancel)}removeListeners(){this.elm.removeEventListener("pointerdown",this.onPointerDown),this.elm.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),document.removeEventListener("pointercancel",this.onPointerCancel),this.pointers=[]}addEventListener(t){this.listeners.push(t)}removeEventListener(t){this.listeners=this.listeners.filter(e=>e!==t)}getPointerDistance(t,e){const i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)}getCentroid(){if(this.pointers.length===0)return null;const t=this.pointers.reduce((e,i)=>(e.x+=i.x,e.y+=i.y,e),{x:0,y:0});return{x:t.x/this.pointers.length,y:t.y/this.pointers.length}}}class Q{constructor(t,e){l(this,"maxZoomLevel");l(this,"image",null);l(this,"rect",null);l(this,"initialCenter",{x:0,y:0});l(this,"maxDimension",{width:0});l(this,"minDimension",{initialWidth:0,initialHeight:0,minWidth:0,closingWidth:0});l(this,"accumulatedTranslate",{x:0,y:0});l(this,"scale",1);l(this,"translate",{x:0,y:0});l(this,"onScale",null);l(this,"animationTimestamp",0);this.maxZoomLevel=t,this.onScale=e}clean(){this.image&&(this.image.style.transform="",this.image.style.width="",this.image.style.height="",this.image.style.top="",this.image.style.left="",this.image.style.opacity="")}reset(){this.clean(),this.image=null,this.rect=null,this.initialCenter={x:window.innerWidth/2,y:window.innerHeight/2},this.maxDimension={width:0},this.minDimension={initialWidth:0,initialHeight:0,minWidth:0,closingWidth:0},this.accumulatedTranslate={x:0,y:0},this.scale=1,this.translate={x:0,y:0}}setCurrentImage(t){if(this.rect=null,this.image=t,this.maxDimension={width:t.naturalWidth*this.maxZoomLevel},!t.dataset.vvwWidth||!t.dataset.vvwHeight)throw new Error("VistaImageState: Image dataset vvwWidth or vvwHeight not set.");const e=parseFloat(t.dataset.vvwWidth),i=parseFloat(t.dataset.vvwHeight);this.minDimension={initialWidth:e,initialHeight:i,minWidth:e*.1,closingWidth:e*.5},this.accumulatedTranslate={x:0,y:0}}setInitialCenter(t){this.initialCenter=t||{x:window.innerWidth/2,y:window.innerHeight/2}}move(t){this.image&&(this.rect||(this.rect=this.image.getBoundingClientRect()),this.translate.x=C(t.x-this.initialCenter.x),this.translate.y=C(t.y-this.initialCenter.y),this.image.style.transform=`translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`)}scaleMove(t,e){if(!this.image)return;this.rect||(this.rect=this.image.getBoundingClientRect()),e||(e=this.initialCenter);const i=A(this.rect.width*t,this.minDimension.minWidth,this.maxDimension.width);this.onScale&&this.onScale({scale:i/(this.maxDimension.width/this.maxZoomLevel),isMax:i>=this.maxDimension.width,isMin:i<=this.minDimension.initialWidth}),this.scale=C(i/this.rect.width);const n=this.rect.left+this.rect.width/2,o=this.rect.top+this.rect.height/2,r=this.initialCenter.x-n,a=this.initialCenter.y-o,h=r*(1-this.scale),c=a*(1-this.scale),m=e.x-this.initialCenter.x,f=e.y-this.initialCenter.y;this.translate.x=C(h+m),this.translate.y=C(c+f),this.image.style.transform=`translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`,i<=this.minDimension.closingWidth?this.image.style.opacity="0.5":this.image.style.opacity=""}moveAndNormalize(t){let e=0,i=!1;const n=({x:o,y:r})=>{if(i)return;if(Math.abs(o)<.001&&Math.abs(r)<.001)return this.normalize();o*=.9,r*=.9;const a=this.image.getBoundingClientRect();this.translate.x=C(this.translate.x+o),this.translate.y=C(this.translate.y+r),a.right<window.innerWidth/2&&(this.translate.x+=(window.innerWidth/2-a.right)*.1,o*=.7),a.left>window.innerWidth/2&&(this.translate.x-=(a.left-window.innerWidth/2)*.1,o*=.7),a.bottom<window.innerHeight/2&&(this.translate.y+=(window.innerHeight/2-a.bottom)*.1,r*=.7),a.top>window.innerHeight/2&&(this.translate.y-=(a.top-window.innerHeight/2)*.1,r*=.7),this.image.style.transform=`translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`,e=requestAnimationFrame(()=>n({x:o,y:r}))};return n({x:t.movementX,y:t.movementY}),()=>{i=!0,cancelAnimationFrame(e),this.normalize(!1)}}animateZoom(t){if(!this.image)return;this.rect||(this.rect=this.image.getBoundingClientRect());const e=Date.now(),i=this.image;this.rect.width*t<this.minDimension.closingWidth||i.width<Math.floor(this.minDimension.initialWidth)||(i.addEventListener("transitionend",()=>{this.animationTimestamp===e&&i&&(i.style.transition="",this.normalize())},{once:!0}),i.style.transition||(i.style.transition="all 222ms ease"),this.animationTimestamp=e,this.scaleMove(t))}normalize(t=!0){if(!this.image||!this.rect)return;let e=this.rect.width*this.scale,i=this.rect.height*this.scale;if(Math.round(e)===Math.round(this.minDimension.initialWidth)&&(e=this.minDimension.initialWidth,i=this.minDimension.initialHeight),this.image.style.width=`${e}px`,this.image.style.height=`${i}px`,this.scale=1,this.image.style.opacity="",this.accumulatedTranslate.x+=this.translate.x,this.accumulatedTranslate.y+=this.translate.y,this.image.style.left=`calc(50% + ${this.accumulatedTranslate.x}px)`,this.image.style.top=`calc(50% + ${this.accumulatedTranslate.y}px)`,this.translate={x:0,y:0},this.image.style.transform="",this.rect=this.image.getBoundingClientRect(),e<=this.minDimension.closingWidth)return this.clean(),!0;if(e<this.minDimension.initialWidth)this.accumulatedTranslate.x=0,this.accumulatedTranslate.y=0,requestAnimationFrame(()=>{const n=this.image;n&&(n.addEventListener("transitionend",()=>{n&&(this.clean(),this.rect=null)},{once:!0}),n.style.transition="all 222ms ease",n.style.width=`${this.minDimension.initialWidth}px`,n.style.height=`${this.minDimension.initialHeight}px`,n.style.left="50%",n.style.top="50%")});else if(t){let n=!1;if(this.rect.right<window.innerWidth/2&&(n=!0,this.accumulatedTranslate.x+=window.innerWidth/2-this.rect.right),this.rect.left>window.innerWidth/2&&(n=!0,this.accumulatedTranslate.x-=this.rect.left-window.innerWidth/2),this.rect.bottom<window.innerHeight/2&&(n=!0,this.accumulatedTranslate.y+=window.innerHeight/2-this.rect.bottom),this.rect.top>window.innerHeight/2&&(n=!0,this.accumulatedTranslate.y-=this.rect.top-window.innerHeight/2),n){const o=this.image;o.addEventListener("transitionend",()=>{o&&(o.style.transition="",this.rect=null)},{once:!0}),o.style.transition="all 222ms ease",o.style.left=`calc(50% + ${this.accumulatedTranslate.x}px)`,o.style.top=`calc(50% + ${this.accumulatedTranslate.y}px)`}else this.rect=null}}}class tt{constructor(){l(this,"fiolast",{})}fio(t,e,i=50){const o=Date.now()-(this.fiolast[e]??0),r=()=>{this.fiolast[e]=Date.now(),t()};if(!this.fiolast[e]){r();return}o>=i&&r()}}const b={somethingOpened:null};class et{constructor(t,e={}){l(this,"options");l(this,"elements");l(this,"isReducedMotion");l(this,"currentIndex",-1);l(this,"currentChildren",null);l(this,"setupFunction",U);l(this,"initFunction",V);l(this,"closeFunction",_);l(this,"transitionFunction",G);l(this,"pointers",null);l(this,"imageState");l(this,"root",null);l(this,"imageContainer",null);l(this,"onClickElements",t=>{t.preventDefault();const e=t.currentTarget;e.dataset.vistaIdx&&this.open(parseInt(e.dataset.vistaIdx))});l(this,"defaultOnClickHandler",t=>t.preventDefault());l(this,"abortController",null);l(this,"throttle",new tt);l(this,"lastSwapTime",0);l(this,"isZoomedIn",!1);l(this,"onKeyDown",t=>{switch(t.key){case"ArrowLeft":t.preventDefault(),this.prev();break;case"ArrowRight":t.preventDefault(),this.next();break;case"ArrowUp":t.preventDefault(),this.zoomIn();break;case"ArrowDown":t.preventDefault(),this.zoomOut();break;case"Escape":t.preventDefault(),this.close();break}});l(this,"onScroll",t=>{t.preventDefault();const e=t.deltaY;this.imageState.setInitialCenter({x:t.clientX,y:t.clientY}),e<0?this.zoomIn():e>0&&this.zoomOut()});l(this,"onResizeHandler",()=>{this.currentChildren.htmls.forEach((t,e)=>{const i=this.currentChildren.images[e],n=t.querySelector("img.vvw-img-hi"),o=t.querySelector("img.vvw-img-lo");if(W(i,n,o,!1),n.classList.contains("vvw--loaded")){const{width:r,height:a}=T(n);n.style.setProperty("--vvw-current-w",`${r}px`),n.style.setProperty("--vvw-current-h",`${a}px`),n.dataset.vvwWidth=r.toString(),n.dataset.vvwHeight=a.toString()}})});l(this,"pointerListeners",[]);l(this,"getInternalPointerListener",()=>{const t=this.imageState;let e=0,i=!1,n=()=>{};return o=>{if(o.event==="down"){if(n(),this.isZoomedIn&&o.pointers.length===1){const r=this.pointers.getCentroid();t.setInitialCenter(r)}if(o.pointers.length>=2){i=!0;const r=this.pointers.getCentroid();e=this.pointers.getPointerDistance(o.pointers[0],o.pointers[1]),t.setInitialCenter(r)}}else if(o.event==="move"){if(this.isZoomedIn&&o.pointers.length===1&&o.lastPointerLen===0){const r=this.pointers.getCentroid();t.move(r)}if(o.pointers.length>=2&&i){const r=this.pointers.getCentroid(),a=this.pointers.getPointerDistance(o.pointers[0],o.pointers[1]);t.scaleMove(a/e,r)}}else(o.event==="up"||o.event==="cancel")&&(i||this.isZoomedIn)&&(i?(i=!1,t.normalize()&&requestAnimationFrame(()=>{this.close()})):this.isZoomedIn&&o.pointers.length===0&&(n=t.moveAndNormalize(o.pointer)));this.pointerListeners.forEach(r=>r({...o,hasInternalExecution:this.isZoomedIn||i}))}});this.elements=t,this.options={...H,...e,controls:{...H.controls,...e.controls}},this.imageState=new Q(this.options.maxZoomLevel,i=>{var n,o,r,a,h,c;i.isMin?(this.isZoomedIn=!1,(n=this.qs(".vvw-zoom-out"))==null||n.setAttribute("disabled","true"),(o=this.qs('.vvw-item[data-vvw-idx="'+this.currentIndex+'"]'))==null||o.style.setProperty("pointer-events","none")):(this.isZoomedIn=!0,(r=this.qs(".vvw-zoom-out"))==null||r.removeAttribute("disabled"),(a=this.qs('.vvw-item[data-vvw-idx="'+this.currentIndex+'"]'))==null||a.style.setProperty("pointer-events","auto")),i.isMax?(h=this.qs(".vvw-zoom-in"))==null||h.setAttribute("disabled","true"):(c=this.qs(".vvw-zoom-in"))==null||c.removeAttribute("disabled")}),this.options.setupFunction&&(this.setupFunction=this.options.setupFunction),this.options.closeFunction&&(this.closeFunction=this.options.closeFunction),this.options.initFunction&&(this.initFunction=this.options.initFunction),this.options.transitionFunction&&(this.transitionFunction=this.options.transitionFunction),this.isReducedMotion=window.matchMedia("(prefers-reduced-motion: reduce)").matches,this.elements instanceof NodeList&&this.elements.forEach((i,n)=>{i.dataset.vistaIdx=n.toString(),i.addEventListener("click",this.defaultOnClickHandler),i.addEventListener("pointerup",this.onClickElements)})}qs(t){return this.root?this.root.querySelector(t):null}async swap(t,e){const i=this.options.preloads||0,n=this.currentIndex,{htmls:o,images:r}=this.getChildElements(i,n),a=this.imageContainer,h=this.currentChildren,c={htmlElements:{from:h.htmls,to:o},images:{from:h.images,to:r},index:{from:t,to:this.currentIndex},via:e||{next:!1,prev:!1},vistaView:this};this.setupFunction(c),this.currentChildren={htmls:o,images:r},this.displayActiveIndex();const m=this.abortController.signal,f=performance.now(),E=f-this.lastSwapTime<this.options.rapidLimit;let y=null;E||(y=await this.transitionFunction(c,m)),this.lastSwapTime=f;const d=o[Math.floor(o.length/2)].dataset.vvwIdx,g=a.querySelector(`.vvw-item[data-vvw-idx="${d}"] img.vvw-img-hi`),p=g.getAttribute("style")||"",x=g.classList.contains("vvw--loaded"),u=g.width,I=g.height;this.imageState.reset(),a.innerHTML="",y instanceof Function&&y(),o.forEach($=>{const L=$.querySelector("img.vvw-img-hi");$.dataset.vvwPos==="0"&&!m.aborted&&p&&x&&u&&I&&(L.classList.add("vvw--loaded"),L.classList.add("vvw--ready"),L.setAttribute("style",p),L.width=u,L.height=I,L.dataset.vvwWidth=u.toString(),L.dataset.vvwHeight=I.toString()),a.appendChild($),L.classList.contains("vvw--ready")&&(this.imageState.setCurrentImage(L),this.imageState.setInitialCenter())}),this.waitForImagesToLoad(),this.options.onImageView&&this.options.onImageView(c)}getChildElements(t,e){const i=[],n=[];for(let o=-t;o<=t;o++){const r=(e+o+this.elements.length)%this.elements.length,a=this.elements[r],h=a instanceof HTMLImageElement?a:a instanceof HTMLAnchorElement&&a.querySelector("img")||void 0,c=a instanceof HTMLElement?{index:r,imageElm:h instanceof HTMLImageElement?h:void 0,anchorElm:a instanceof HTMLAnchorElement?a:void 0,src:a.dataset.vistaviewSrc||a.getAttribute("href")||a.getAttribute("src")||"",thumb:a.dataset.vistaviewThumb||(h instanceof HTMLImageElement?h.getAttribute("src"):void 0)||a.getAttribute("href")||void 0,alt:h instanceof HTMLImageElement&&h.getAttribute("alt")||void 0}:{index:r,...a};n.push(c),i.push(N(c,o))}return{htmls:i,images:n}}zoomIn(){this.throttle.fio(()=>{this.imageState.animateZoom(1.68)},"zoom",222)}zoomOut(){this.throttle.fio(()=>{this.imageState.animateZoom(.68)},"zoom",222)}displayActiveIndex(){var n;const t=this.currentIndex;this.elements instanceof NodeList&&this.elements.forEach((o,r)=>{o.style.opacity="",r===t&&(o.style.opacity="0")});const e=this.qs(".vvw-index");e&&(e.textContent=`${t+1} / ${this.elements.length}`);const i=this.qs(".vvw-desc");if(i){const o=(n=this.currentChildren)==null?void 0:n.images.find(r=>r.index===t);o&&o.alt?i.textContent=o.alt:i.textContent=""}}waitForImagesToLoad(){this.imageContainer.querySelectorAll("img.vvw-img-hi:not(.vvw--loaded)").forEach(i=>{const n=i,o=()=>{var a;n.width=n.naturalWidth,n.height=n.naturalHeight;const r=(a=n.parentElement)==null?void 0:a.matches(`[data-vvw-idx="${this.currentIndex}"]`);n.addEventListener("transitionend",()=>{r&&(this.imageState.setCurrentImage(n),this.imageState.setInitialCenter()),n.classList.add("vvw--ready")},{once:!0}),n.classList.add("vvw--loaded"),requestAnimationFrame(()=>{const{width:h,height:c}=T(n);n.style.setProperty("--vvw-current-w",`${h}px`),n.style.setProperty("--vvw-current-h",`${c}px`),n.dataset.vvwWidth=h.toString(),n.dataset.vvwHeight=c.toString(),n.style.setProperty("--vvw-current-radius","0px")})};if(n.complete&&n.naturalWidth!==0){o();return}n.addEventListener("load",()=>{o()}),n.addEventListener("error",()=>{n.classList.add("vvw--loaderror")})})}registerPointerListener(t){this.pointerListeners.push(t)}unregisterPointerListeners(){this.pointerListeners=[]}open(t=0){var c,m,f,E,y;if(b.somethingOpened)return;b.somethingOpened=this,this.currentIndex=t,document.body.style.overflow="hidden";const e=j({controls:this.options.controls});if(document.body.prepend(e),this.root=document.body.querySelector("#vvw-root"),!this.root)throw new Error("Failed to setup VistaView root element.");this.imageContainer=this.qs(".vvw-image-container"),this.options.animationDurationBase&&this.root.style.setProperty("--vvw-anim-dur",`${this.options.animationDurationBase}`),this.options.initialZIndex!==void 0&&this.root.style.setProperty("--vvw-init-z",`${this.options.initialZIndex}`);const i=this.options.preloads||0,n=t,{images:o,htmls:r}=this.getChildElements(i,n),a={htmlElements:{from:null,to:r},images:{from:null,to:o},index:{from:null,to:this.currentIndex},via:{next:!1,prev:!1},vistaView:this};this.setupFunction(a),this.currentChildren={htmls:r,images:o},r.forEach(d=>{this.imageContainer.appendChild(d)}),(c=this.qs(".vvw-close"))==null||c.addEventListener("click",()=>this.close()),(m=this.qs(".vvw-zoom-in"))==null||m.addEventListener("click",()=>this.zoomIn()),(f=this.qs(".vvw-zoom-out"))==null||f.addEventListener("click",()=>this.zoomOut()),(E=this.qs(".vvw-prev>button"))==null||E.addEventListener("click",()=>this.prev()),(y=this.qs(".vvw-next>button"))==null||y.addEventListener("click",()=>this.next()),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("wheel",this.onScroll,{passive:!1}),window.addEventListener("resize",this.onResizeHandler),this.pointers=new J({elm:this.imageContainer,listeners:[this.getInternalPointerListener()]});const h={};[...this.options.controls.topLeft||[],...this.options.controls.topRight||[],...this.options.controls.topCenter||[],...this.options.controls.bottomCenter||[],...this.options.controls.bottomLeft||[],...this.options.controls.bottomRight||[]].forEach(d=>{typeof d!="string"&&(h[d.name]=d)}),this.root.querySelectorAll("button[data-vvw-control]").forEach(d=>{const g=d;g.addEventListener("click",p=>{const x=p.currentTarget.dataset.vvwControl,u=h[x],I=this.currentChildren.images.find($=>$.index===this.currentIndex);u&&I&&(u.onClick.constructor.name==="AsyncFunction"?(g.classList.add("vvw--loading"),u.onClick(I,this).finally(()=>{g.classList.remove("vvw--loading")})):u.onClick(I,this))})}),this.initFunction(this),requestAnimationFrame(()=>{var d;(d=this.root)==null||d.addEventListener("transitionend",()=>{var g,p;(g=this.root)==null||g.classList.add("vvw--settled"),this.waitForImagesToLoad(),(p=this.qs(".vvw-bg"))==null||p.addEventListener("click",x=>{x.preventDefault(),this.close()}),this.imageState.reset()},{once:!0}),this.root.classList.add("vvw--active"),this.displayActiveIndex(),this.options.onOpen&&this.options.onOpen(this),this.options.onImageView&&this.options.onImageView(a)})}async close(t=!0){b.somethingOpened===this&&this.root&&(t?await new Promise(e=>{let n=0;this.root.addEventListener("transitionend",o=>{o.target===this.root&&(n++,n===2&&this.elements instanceof NodeList&&this.elements.forEach(r=>{r.style.opacity=""}),n===3&&e(null))}),this.root.classList.add("vvw--closing")}):this.elements instanceof NodeList&&this.elements.forEach(e=>{e.style.opacity=""}),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("resize",this.onResizeHandler),window.removeEventListener("wheel",this.onScroll),this.unregisterPointerListeners(),this.pointers.removeListeners(),this.root.remove(),this.root=null,this.imageContainer=null,this.currentChildren=null,this.currentIndex=-1,document.body.style.overflow="",b.somethingOpened=null,this.closeFunction(this),this.options.onClose&&this.options.onClose(this))}next(){if(b.somethingOpened!==this)return;const t=(this.currentIndex+1)%this.elements.length;this.view(t,{next:!0,prev:!1})}prev(){if(b.somethingOpened!==this)return;const t=(this.currentIndex-1+this.elements.length)%this.elements.length;this.view(t,{next:!1,prev:!0})}destroy(){this.close(!1),this.elements instanceof NodeList&&this.elements.forEach(t=>{t.removeAttribute("data-vista-idx"),t.removeEventListener("click",this.defaultOnClickHandler),t.removeEventListener("pointerup",this.onClickElements)})}getCurrentIndex(){return b.somethingOpened!==this?-1:this.currentIndex}view(t,e){if(b.somethingOpened!==this||t<0||t>=this.elements.length)return;const i=this.currentIndex;this.currentIndex=t;const n=this.abortController;n==null||n.abort(),this.abortController=new AbortController,this.swap(i,e)}}function it(s){let t=null;if(typeof s=="string"?t=document.querySelectorAll(s):s instanceof NodeList&&(t=s),t)for(let e=0;e<t.length;e++){const i=t[e];if(!(i.dataset.vistaviewSrc||i.getAttribute("href")||i.getAttribute("src")||""))return`Element at index ${e} is missing 'src' / 'data-vistaview-src' / 'href' attribute.`}else{const e=s;for(let i=0;i<e.length;i++)if(!e[i].src)return`Element at index ${i} is missing 'src' attribute.`}return t||s}function nt({elements:s,...t}){if(!s)throw new Error("No elements");let e=it(s);if(typeof e=="string")return null;const i=new et(e,t);return{open:(n=0)=>i.open(n),close:()=>i.close(),next:()=>i.next(),prev:()=>i.prev(),destroy:()=>i.destroy(),getCurrentIndex:()=>i.getCurrentIndex(),view:n=>{i.view(n)}}}v.DefaultOptions=H,v.vistaView=nt,v.vistaViewDownload=F,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})}));
12
+ </div>`)}const H={animationDurationBase:333,zoomStep:500,maxZoomLevel:2,touchSpeedThreshold:.5,preloads:1,keyboardListeners:!0,arrowOnSmallScreens:!1,rapidLimit:222,controls:{topLeft:["indexDisplay"],topRight:["zoomIn","zoomOut",F(),"close"],bottomLeft:["description"]}};function U(s){}function V(s){const t=s.options.preloads;s.imageContainer.style.width=`${(t*2+1)*100}vw`,s.imageContainer.style.left=`-${t*100}vw`,s.imageContainer.style.display="flex",K(s)}function K(s){let t={x:0,y:0},e={x:0,y:0},i=null;s.registerPointerListener(n=>{if(!n.hasInternalExecution&&!(n.pointers.length>1)){if(n.event==="down"&&(t={x:n.pointer.x,y:n.pointer.y},e={x:n.pointer.x,y:n.pointer.y}),n.event==="move"){e={x:n.pointer.x,y:n.pointer.y};const o=e.x-t.x,a=e.y-t.y;if(!i&&Math.abs(a)>Math.abs(o)||i==="y"){const r=a/window.innerHeight*100;s.imageContainer.style.transition="none",s.imageContainer.style.transform=`translateY(${r}vh)`,i="y"}else if(!i&&Math.abs(o)>Math.abs(a)||i==="x"){const r=o/window.innerWidth*100;s.imageContainer.style.transition="none",s.imageContainer.style.transform=`translateX(${r}vw)`,i="x"}}if(n.event==="up"||n.event==="cancel"){let o=function(a){var r;(r=s.imageContainer)==null||r.addEventListener("transitionend",function h(){var c;(c=s.imageContainer)==null||c.removeEventListener("transitionend",h),s.imageContainer.style.transition="",s.imageContainer.style.transform=""}),s.imageContainer.style.transition="transform 222ms ease",s.imageContainer.style.transform=a};if(i==="y"){const a=e.y-t.y,r=n.pointer.movementY,h=8;s.imageContainer.style.transition="",a>0&&Math.abs(r)>h||a<0&&Math.abs(r)>h?(s.imageContainer.style.transition="transform 222ms ease",s.imageContainer.style.transform="translateY(0vh)",s.close()):o("translateY(0vh)")}if(i==="x"){const a=e.x-t.x,r=n.pointer.movementX,h=8;s.imageContainer.style.transition="",a>0&&Math.abs(r)>h?s.prev():a<0&&Math.abs(r)>h?s.next():o("translateX(0vw)")}i=null}}})}function _(s){}async function G({vistaView:{isReducedMotion:s},htmlElements:{to:t},index:{from:e,to:i},vistaView:{elements:n,imageContainer:o,options:a}},r){if(!t||r.aborted||s||!(Math.abs(i-e)===1||e===0&&i===n.length-1||e===n.length-1&&i===0))return;const c=Math.round(a.animationDurationBase*1.5*100)/100;return new Promise(m=>{o.addEventListener("transitionend",()=>{m(()=>{o.style.transition="",o.style.transform=""})},{once:!0});const f=i===e+1||e===n.length-1&&i===0?"translateX(-100vw)":"translateX(100vw)";o.style.transition=`transform ${c}ms ease`,o.style.transform=f})}class J{constructor({elm:t,listeners:e}){l(this,"pointers",[]);l(this,"elm");l(this,"listeners",[]);l(this,"lastPointerDownId",null);l(this,"removeLastPointer",()=>{if(this.pointers.length&&this.lastPointerDownId!==null){const t=this.pointers.findIndex(e=>e.id===this.lastPointerDownId);t!==-1&&this.pointers.splice(t,1)}});l(this,"onPointerDown",t=>{if(!this.listeners.length||t.button!==0)return;t.preventDefault(),this.lastPointerDownId=t.pointerId,window.addEventListener("contextmenu",this.removeLastPointer,{once:!0}),window.addEventListener("auxclick",this.removeLastPointer,{once:!0});let e={x:t.clientX,y:t.clientY,movementX:0,movementY:0,id:t.pointerId};this.pointers.push(e),this.listeners.forEach(i=>i({event:"down",pointer:e,pointers:this.pointers,lastPointerLen:this.pointers.length-1}))});l(this,"onPointerMove",t=>{if(!this.listeners.length)return;t.preventDefault();const e=this.pointers.find(i=>i.id===t.pointerId);e&&(e.movementX=t.movementX,e.movementY=t.movementY,e.x=t.clientX,e.y=t.clientY,this.listeners.forEach(i=>i({event:"move",pointer:e,pointers:this.pointers,lastPointerLen:this.pointers.length-1})))});l(this,"onPointerUp",t=>{if(!this.listeners.length||t.button!==0||(window.removeEventListener("contextmenu",this.removeLastPointer),window.removeEventListener("auxclick",this.removeLastPointer),t.target instanceof Node&&!this.elm.contains(t.target)&&t.target!==document.querySelector("html")&&t.target!==document))return;t.preventDefault();const e=this.pointers.findIndex(o=>o.id===t.pointerId);if(e===-1)return;const i=this.pointers[e];i.x=t.clientX,i.y=t.clientY;const n=this.pointers.length;this.pointers.splice(e,1),this.listeners.forEach(o=>o({event:"up",pointer:i,pointers:this.pointers,lastPointerLen:n}))});l(this,"onPointerCancel",t=>{if(!this.listeners.length||t.target instanceof Node&&!this.elm.contains(t.target)&&t.target!==document.querySelector("html")&&t.target!==document)return;t.preventDefault();const e=this.pointers.findIndex(o=>o.id===t.pointerId);if(e===-1)return;const i=this.pointers[e];i.x=t.clientX,i.y=t.clientY;const n=this.pointers.length;this.pointers.splice(e,1),this.listeners.forEach(o=>o({event:"cancel",pointer:i,pointers:this.pointers,lastPointerLen:n}))});this.elm=t??document,e&&(this.listeners=e),this.startListeners()}startListeners(){this.elm.addEventListener("pointerdown",this.onPointerDown),this.elm.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp),document.addEventListener("pointercancel",this.onPointerCancel)}removeListeners(){this.elm.removeEventListener("pointerdown",this.onPointerDown),this.elm.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),document.removeEventListener("pointercancel",this.onPointerCancel),this.pointers=[]}addEventListener(t){this.listeners.push(t)}removeEventListener(t){this.listeners=this.listeners.filter(e=>e!==t)}getPointerDistance(t,e){const i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)}getCentroid(){if(this.pointers.length===0)return null;const t=this.pointers.reduce((e,i)=>(e.x+=i.x,e.y+=i.y,e),{x:0,y:0});return{x:t.x/this.pointers.length,y:t.y/this.pointers.length}}}class Q{constructor(t,e){l(this,"maxZoomLevel");l(this,"image",null);l(this,"rect",null);l(this,"initialCenter",{x:0,y:0});l(this,"maxDimension",{width:0});l(this,"minDimension",{initialWidth:0,initialHeight:0,minWidth:0,closingWidth:0});l(this,"accumulatedTranslate",{x:0,y:0});l(this,"scale",1);l(this,"translate",{x:0,y:0});l(this,"onScale",null);l(this,"animationTimestamp",0);this.maxZoomLevel=t,this.onScale=e}clean(){this.image&&(this.image.style.transform="",this.image.style.width="",this.image.style.height="",this.image.style.top="",this.image.style.left="",this.image.style.opacity="")}reset(){this.clean(),this.image=null,this.rect=null,this.initialCenter={x:window.innerWidth/2,y:window.innerHeight/2},this.maxDimension={width:0},this.minDimension={initialWidth:0,initialHeight:0,minWidth:0,closingWidth:0},this.accumulatedTranslate={x:0,y:0},this.scale=1,this.translate={x:0,y:0}}setCurrentImage(t){if(this.rect=null,this.image=t,this.maxDimension={width:t.naturalWidth*this.maxZoomLevel},!t.dataset.vvwWidth||!t.dataset.vvwHeight)throw new Error("VistaImageState: Image dataset vvwWidth or vvwHeight not set.");const e=parseFloat(t.dataset.vvwWidth),i=parseFloat(t.dataset.vvwHeight);this.minDimension={initialWidth:e,initialHeight:i,minWidth:e*.1,closingWidth:e*.5},this.accumulatedTranslate={x:0,y:0}}setInitialCenter(t){this.initialCenter=t||{x:window.innerWidth/2,y:window.innerHeight/2}}move(t){this.image&&(this.rect||(this.rect=this.image.getBoundingClientRect()),this.translate.x=C(t.x-this.initialCenter.x),this.translate.y=C(t.y-this.initialCenter.y),this.image.style.transform=`translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`)}scaleMove(t,e){if(!this.image)return;this.rect||(this.rect=this.image.getBoundingClientRect()),e||(e=this.initialCenter);const i=P(this.rect.width*t,this.minDimension.minWidth,this.maxDimension.width);this.onScale&&this.onScale({scale:i/(this.maxDimension.width/this.maxZoomLevel),isMax:i>=this.maxDimension.width,isMin:i<=this.minDimension.initialWidth}),this.scale=C(i/this.rect.width);const n=this.rect.left+this.rect.width/2,o=this.rect.top+this.rect.height/2,a=this.initialCenter.x-n,r=this.initialCenter.y-o,h=a*(1-this.scale),c=r*(1-this.scale),m=e.x-this.initialCenter.x,f=e.y-this.initialCenter.y;this.translate.x=C(h+m),this.translate.y=C(c+f),this.image.style.transform=`translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`,i<=this.minDimension.closingWidth?this.image.style.opacity="0.5":this.image.style.opacity=""}moveAndNormalize(t){let e=0,i=!1;const n=({x:o,y:a})=>{if(i)return;if(Math.abs(o)<.001&&Math.abs(a)<.001)return this.normalize();o*=.9,a*=.9;const r=this.image.getBoundingClientRect();this.translate.x=C(this.translate.x+o),this.translate.y=C(this.translate.y+a),r.right<window.innerWidth/2&&(this.translate.x+=(window.innerWidth/2-r.right)*.1,o*=.7),r.left>window.innerWidth/2&&(this.translate.x-=(r.left-window.innerWidth/2)*.1,o*=.7),r.bottom<window.innerHeight/2&&(this.translate.y+=(window.innerHeight/2-r.bottom)*.1,a*=.7),r.top>window.innerHeight/2&&(this.translate.y-=(r.top-window.innerHeight/2)*.1,a*=.7),this.image.style.transform=`translate3d(${this.translate.x}px, ${this.translate.y}px, 0px) scale(${this.scale})`,e=requestAnimationFrame(()=>n({x:o,y:a}))};return n({x:t.movementX,y:t.movementY}),()=>{i=!0,cancelAnimationFrame(e),this.normalize(!1)}}animateZoom(t){if(!this.image)return;this.rect||(this.rect=this.image.getBoundingClientRect());const e=Date.now(),i=this.image;this.rect.width*t<this.minDimension.closingWidth||i.width<Math.floor(this.minDimension.initialWidth)||(i.addEventListener("transitionend",()=>{this.animationTimestamp===e&&i&&(i.style.transition="",this.normalize())},{once:!0}),i.style.transition||(i.style.transition="all 222ms ease"),this.animationTimestamp=e,this.scaleMove(t))}normalize(t=!0){if(!this.image||!this.rect)return;let e=this.rect.width*this.scale,i=this.rect.height*this.scale;if(Math.round(e)===Math.round(this.minDimension.initialWidth)&&(e=this.minDimension.initialWidth,i=this.minDimension.initialHeight),this.image.style.width=`${e}px`,this.image.style.height=`${i}px`,this.scale=1,this.image.style.opacity="",this.accumulatedTranslate.x+=this.translate.x,this.accumulatedTranslate.y+=this.translate.y,this.image.style.left=`calc(50% + ${this.accumulatedTranslate.x}px)`,this.image.style.top=`calc(50% + ${this.accumulatedTranslate.y}px)`,this.translate={x:0,y:0},this.image.style.transform="",this.rect=this.image.getBoundingClientRect(),e<=this.minDimension.closingWidth)return this.clean(),!0;if(e<this.minDimension.initialWidth)this.accumulatedTranslate.x=0,this.accumulatedTranslate.y=0,requestAnimationFrame(()=>{const n=this.image;n&&(n.addEventListener("transitionend",()=>{n&&(this.clean(),this.rect=null)},{once:!0}),n.style.transition="all 222ms ease",n.style.width=`${this.minDimension.initialWidth}px`,n.style.height=`${this.minDimension.initialHeight}px`,n.style.left="50%",n.style.top="50%")});else if(t){let n=!1;if(this.rect.right<window.innerWidth/2&&(n=!0,this.accumulatedTranslate.x+=window.innerWidth/2-this.rect.right),this.rect.left>window.innerWidth/2&&(n=!0,this.accumulatedTranslate.x-=this.rect.left-window.innerWidth/2),this.rect.bottom<window.innerHeight/2&&(n=!0,this.accumulatedTranslate.y+=window.innerHeight/2-this.rect.bottom),this.rect.top>window.innerHeight/2&&(n=!0,this.accumulatedTranslate.y-=this.rect.top-window.innerHeight/2),n){const o=this.image;o.addEventListener("transitionend",()=>{o&&(o.style.transition="",this.rect=null)},{once:!0}),o.style.transition="all 222ms ease",o.style.left=`calc(50% + ${this.accumulatedTranslate.x}px)`,o.style.top=`calc(50% + ${this.accumulatedTranslate.y}px)`}else this.rect=null}}}class tt{constructor(){l(this,"fiolast",{})}fio(t,e,i=50){const o=Date.now()-(this.fiolast[e]??0),a=()=>{this.fiolast[e]=Date.now(),t()};if(!this.fiolast[e]){a();return}o>=i&&a()}}const L={somethingOpened:null};class et{constructor(t,e={}){l(this,"options");l(this,"elements");l(this,"isReducedMotion");l(this,"currentIndex",-1);l(this,"currentChildren",null);l(this,"setupFunction",U);l(this,"initFunction",V);l(this,"closeFunction",_);l(this,"transitionFunction",G);l(this,"pointers",null);l(this,"imageState");l(this,"root",null);l(this,"imageContainer",null);l(this,"onClickElements",t=>{t.preventDefault();const e=t.currentTarget;e.dataset.vistaIdx&&this.open(parseInt(e.dataset.vistaIdx))});l(this,"defaultOnClickHandler",t=>t.preventDefault());l(this,"abortController",null);l(this,"throttle",new tt);l(this,"lastSwapTime",0);l(this,"isZoomedIn",!1);l(this,"onKeyDown",t=>{switch(t.key){case"ArrowLeft":t.preventDefault(),this.prev();break;case"ArrowRight":t.preventDefault(),this.next();break;case"ArrowUp":t.preventDefault(),this.zoomIn();break;case"ArrowDown":t.preventDefault(),this.zoomOut();break;case"Escape":t.preventDefault(),this.close();break}});l(this,"onScroll",t=>{t.preventDefault();const e=t.deltaY;this.imageState.setInitialCenter({x:t.clientX,y:t.clientY}),e<0?this.zoomIn():e>0&&this.zoomOut()});l(this,"onResizeHandler",()=>{this.currentChildren.htmls.forEach((t,e)=>{const i=this.currentChildren.images[e],n=t.querySelector("img.vvw-img-hi"),o=t.querySelector("img.vvw-img-lo");if(W(i,n,o,!1),n.classList.contains("vvw--loaded")){const{width:a,height:r}=T(n);n.style.setProperty("--vvw-current-w",`${a}px`),n.style.setProperty("--vvw-current-h",`${r}px`),n.dataset.vvwWidth=a.toString(),n.dataset.vvwHeight=r.toString()}})});l(this,"pointerListeners",[]);l(this,"getInternalPointerListener",()=>{const t=this.imageState;let e=0,i=!1,n=()=>{};return o=>{if(o.event==="down"){if(n(),this.isZoomedIn&&o.pointers.length===1){const a=this.pointers.getCentroid();t.setInitialCenter(a)}if(o.pointers.length>=2){i=!0;const a=this.pointers.getCentroid();e=this.pointers.getPointerDistance(o.pointers[0],o.pointers[1]),t.setInitialCenter(a)}}else if(o.event==="move"){if(this.isZoomedIn&&o.pointers.length===1&&o.lastPointerLen===0){const a=this.pointers.getCentroid();t.move(a)}if(o.pointers.length>=2&&i){const a=this.pointers.getCentroid(),r=this.pointers.getPointerDistance(o.pointers[0],o.pointers[1]);t.scaleMove(r/e,a)}}else(o.event==="up"||o.event==="cancel")&&(i||this.isZoomedIn)&&(i?(i=!1,t.normalize()&&requestAnimationFrame(()=>{this.close()})):this.isZoomedIn&&o.pointers.length===0&&(n=t.moveAndNormalize(o.pointer)));this.pointerListeners.forEach(a=>a({...o,hasInternalExecution:this.isZoomedIn||i}))}});this.elements=t,this.options={...H,...e,controls:{...H.controls,...e.controls}},this.imageState=new Q(this.options.maxZoomLevel,i=>{var n,o,a,r,h,c;i.isMin?(this.isZoomedIn=!1,(n=this.qs(".vvw-zoom-out"))==null||n.setAttribute("disabled","true"),(o=this.qs('.vvw-item[data-vvw-idx="'+this.currentIndex+'"]'))==null||o.style.setProperty("pointer-events","none")):(this.isZoomedIn=!0,(a=this.qs(".vvw-zoom-out"))==null||a.removeAttribute("disabled"),(r=this.qs('.vvw-item[data-vvw-idx="'+this.currentIndex+'"]'))==null||r.style.setProperty("pointer-events","auto")),i.isMax?(h=this.qs(".vvw-zoom-in"))==null||h.setAttribute("disabled","true"):(c=this.qs(".vvw-zoom-in"))==null||c.removeAttribute("disabled")}),this.options.setupFunction&&(this.setupFunction=this.options.setupFunction),this.options.closeFunction&&(this.closeFunction=this.options.closeFunction),this.options.initFunction&&(this.initFunction=this.options.initFunction),this.options.transitionFunction&&(this.transitionFunction=this.options.transitionFunction),this.isReducedMotion=window.matchMedia("(prefers-reduced-motion: reduce)").matches,this.elements instanceof NodeList&&this.elements.forEach((i,n)=>{i.dataset.vistaIdx=n.toString(),i.addEventListener("click",this.defaultOnClickHandler),i.addEventListener("pointerup",this.onClickElements)})}qs(t){return this.root?this.root.querySelector(t):null}async swap(t,e){const i=this.options.preloads||0,n=this.currentIndex,{htmls:o,images:a}=this.getChildElements(i,n),r=this.imageContainer,h=this.currentChildren,c={htmlElements:{from:h.htmls,to:o},images:{from:h.images,to:a},index:{from:t,to:this.currentIndex},via:e||{next:!1,prev:!1},vistaView:this};this.setupFunction(c),this.currentChildren={htmls:o,images:a},this.displayActiveIndex();const m=this.abortController.signal,f=performance.now(),E=f-this.lastSwapTime<this.options.rapidLimit;let y=null;E||(y=await this.transitionFunction(c,m)),this.lastSwapTime=f;const d=o[Math.floor(o.length/2)].dataset.vvwIdx,g=r.querySelector(`.vvw-item[data-vvw-idx="${d}"] img.vvw-img-hi`),p=g.getAttribute("style")||"",x=g.classList.contains("vvw--loaded"),u=g.width,I=g.height;this.imageState.reset(),r.innerHTML="",y instanceof Function&&y(),o.forEach(S=>{const b=S.querySelector("img.vvw-img-hi");S.dataset.vvwPos==="0"&&!m.aborted&&p&&x&&u&&I&&(b.classList.add("vvw--loaded"),b.classList.add("vvw--ready"),b.setAttribute("style",p),b.width=u,b.height=I,b.dataset.vvwWidth=u.toString(),b.dataset.vvwHeight=I.toString()),r.appendChild(S),b.classList.contains("vvw--ready")&&(this.imageState.setCurrentImage(b),this.imageState.setInitialCenter())}),this.waitForImagesToLoad(),this.options.onImageView&&this.options.onImageView(c)}getChildElements(t,e){const i=[],n=[];for(let o=-t;o<=t;o++){const a=(e+o+this.elements.length)%this.elements.length,r=this.elements[a],h=r instanceof HTMLImageElement?r:r instanceof HTMLAnchorElement&&r.querySelector("img")||void 0,c=r instanceof HTMLElement?{index:a,imageElm:h instanceof HTMLImageElement?h:void 0,anchorElm:r instanceof HTMLAnchorElement?r:void 0,src:r.dataset.vistaviewSrc||r.getAttribute("href")||r.getAttribute("src")||"",thumb:r.dataset.vistaviewThumb||(h instanceof HTMLImageElement?h.getAttribute("src"):void 0)||r.getAttribute("href")||void 0,alt:h instanceof HTMLImageElement&&h.getAttribute("alt")||void 0}:{index:a,...r};n.push(c),i.push(N(c,o))}return{htmls:i,images:n}}zoomIn(){this.throttle.fio(()=>{this.imageState.animateZoom(1.68)},"zoom",222)}zoomOut(){this.throttle.fio(()=>{this.imageState.animateZoom(.68)},"zoom",222)}displayActiveIndex(){var a;const t=this.currentIndex;this.elements instanceof NodeList&&this.elements.forEach((r,h)=>{r.style.opacity="",h===t&&(r.style.opacity="0")});const e=this.qs(".vvw-index"),i=`${t+1}`,n=`${this.elements.length}`;e&&(e.textContent=`${i} / ${n}`);const o=this.qs(".vvw-desc");if(o){const r=(a=this.currentChildren)==null?void 0:a.images.find(c=>c.index===t),h=(r==null?void 0:r.alt)||"";h?(o.textContent=h,o.setAttribute("aria-label",`Image ${i} of ${n}: ${h}`)):(o.textContent="",o.setAttribute("aria-label",`Image ${i} of ${n}`))}}waitForImagesToLoad(){this.imageContainer.querySelectorAll("img.vvw-img-hi:not(.vvw--loaded)").forEach(i=>{const n=i,o=()=>{var r;n.width=n.naturalWidth,n.height=n.naturalHeight;const a=(r=n.parentElement)==null?void 0:r.matches(`[data-vvw-idx="${this.currentIndex}"]`);n.addEventListener("transitionend",()=>{a&&(this.imageState.setCurrentImage(n),this.imageState.setInitialCenter()),n.classList.add("vvw--ready")},{once:!0}),n.classList.add("vvw--loaded"),requestAnimationFrame(()=>{const{width:h,height:c}=T(n);n.style.setProperty("--vvw-current-w",`${h}px`),n.style.setProperty("--vvw-current-h",`${c}px`),n.dataset.vvwWidth=h.toString(),n.dataset.vvwHeight=c.toString(),n.style.setProperty("--vvw-current-radius","0px")})};if(n.complete&&n.naturalWidth!==0){o();return}n.addEventListener("load",()=>{o()}),n.addEventListener("error",()=>{n.classList.add("vvw--loaderror")})})}registerPointerListener(t){this.pointerListeners.push(t)}unregisterPointerListeners(){this.pointerListeners=[]}open(t=0){var c,m,f,E,y;if(L.somethingOpened)return;L.somethingOpened=this,this.currentIndex=t,document.body.style.overflow="hidden";const e=j({controls:this.options.controls});if(document.body.prepend(e),this.root=document.body.querySelector("#vvw-root"),!this.root)throw new Error("Failed to setup VistaView root element.");this.imageContainer=this.qs(".vvw-image-container"),this.options.animationDurationBase&&this.root.style.setProperty("--vvw-anim-dur",`${this.options.animationDurationBase}`),this.options.initialZIndex!==void 0&&this.root.style.setProperty("--vvw-init-z",`${this.options.initialZIndex}`);const i=this.options.preloads||0,n=t,{images:o,htmls:a}=this.getChildElements(i,n),r={htmlElements:{from:null,to:a},images:{from:null,to:o},index:{from:null,to:this.currentIndex},via:{next:!1,prev:!1},vistaView:this};this.setupFunction(r),this.currentChildren={htmls:a,images:o},a.forEach(d=>{this.imageContainer.appendChild(d)}),(c=this.qs(".vvw-close"))==null||c.addEventListener("click",()=>this.close()),(m=this.qs(".vvw-zoom-in"))==null||m.addEventListener("click",()=>this.zoomIn()),(f=this.qs(".vvw-zoom-out"))==null||f.addEventListener("click",()=>this.zoomOut()),(E=this.qs(".vvw-prev>button"))==null||E.addEventListener("click",()=>this.prev()),(y=this.qs(".vvw-next>button"))==null||y.addEventListener("click",()=>this.next()),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("wheel",this.onScroll,{passive:!1}),window.addEventListener("resize",this.onResizeHandler),this.pointers=new J({elm:this.imageContainer,listeners:[this.getInternalPointerListener()]});const h={};[...this.options.controls.topLeft||[],...this.options.controls.topRight||[],...this.options.controls.topCenter||[],...this.options.controls.bottomCenter||[],...this.options.controls.bottomLeft||[],...this.options.controls.bottomRight||[]].forEach(d=>{typeof d!="string"&&(h[d.name]=d)}),this.root.querySelectorAll("button[data-vvw-control]").forEach(d=>{const g=d;g.addEventListener("click",p=>{const x=p.currentTarget.dataset.vvwControl,u=h[x],I=this.currentChildren.images.find(S=>S.index===this.currentIndex);u&&I&&(u.onClick.constructor.name==="AsyncFunction"?(g.classList.add("vvw--loading"),u.onClick(I,this).finally(()=>{g.classList.remove("vvw--loading")})):u.onClick(I,this))})}),this.initFunction(this),requestAnimationFrame(()=>{var d;(d=this.root)==null||d.addEventListener("transitionend",()=>{var g,p;(g=this.root)==null||g.classList.add("vvw--settled"),this.waitForImagesToLoad(),(p=this.qs(".vvw-bg"))==null||p.addEventListener("click",x=>{x.preventDefault(),this.close()}),this.imageState.reset()},{once:!0}),this.root.classList.add("vvw--active"),this.displayActiveIndex(),this.options.onOpen&&this.options.onOpen(this),this.options.onImageView&&this.options.onImageView(r)})}async close(t=!0){L.somethingOpened===this&&this.root&&(t?await new Promise(e=>{let n=0;this.root.addEventListener("transitionend",o=>{o.target===this.root&&(n++,n===2&&this.elements instanceof NodeList&&this.elements.forEach(a=>{a.style.opacity=""}),n===3&&e(null))}),this.root.classList.add("vvw--closing")}):this.elements instanceof NodeList&&this.elements.forEach(e=>{e.style.opacity=""}),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("resize",this.onResizeHandler),window.removeEventListener("wheel",this.onScroll),this.unregisterPointerListeners(),this.pointers.removeListeners(),this.root.remove(),this.root=null,this.imageContainer=null,this.currentChildren=null,this.currentIndex=-1,document.body.style.overflow="",L.somethingOpened=null,this.closeFunction(this),this.options.onClose&&this.options.onClose(this))}next(){if(L.somethingOpened!==this)return;const t=(this.currentIndex+1)%this.elements.length;this.view(t,{next:!0,prev:!1})}prev(){if(L.somethingOpened!==this)return;const t=(this.currentIndex-1+this.elements.length)%this.elements.length;this.view(t,{next:!1,prev:!0})}destroy(){this.close(!1),this.elements instanceof NodeList&&this.elements.forEach(t=>{t.removeAttribute("data-vista-idx"),t.removeEventListener("click",this.defaultOnClickHandler),t.removeEventListener("pointerup",this.onClickElements)})}getCurrentIndex(){return L.somethingOpened!==this?-1:this.currentIndex}view(t,e){if(L.somethingOpened!==this||t<0||t>=this.elements.length)return;const i=this.currentIndex;this.currentIndex=t;const n=this.abortController;n==null||n.abort(),this.abortController=new AbortController,this.swap(i,e)}}function it(s){let t=null;if(typeof s=="string"?t=document.querySelectorAll(s):s instanceof NodeList&&(t=s),t)for(let e=0;e<t.length;e++){const i=t[e];if(!(i.dataset.vistaviewSrc||i.getAttribute("href")||i.getAttribute("src")||""))return`Element at index ${e} is missing 'src' / 'data-vistaview-src' / 'href' attribute.`}else{const e=s;for(let i=0;i<e.length;i++)if(!e[i].src)return`Element at index ${i} is missing 'src' attribute.`}return t||s}function nt({elements:s,...t}){if(!s)throw new Error("No elements");let e=it(s);if(typeof e=="string")return null;const i=new et(e,t);return{open:(n=0)=>i.open(n),close:()=>i.close(),next:()=>i.next(),prev:()=>i.prev(),destroy:()=>i.destroy(),getCurrentIndex:()=>i.getCurrentIndex(),view:n=>{i.view(n)}}}v.DefaultOptions=H,v.vistaView=nt,v.vistaViewDownload=F,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vistaview",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "A lightweight, zero-dependency image lightbox library with smooth animations and touch support",
5
5
  "keywords": [
6
6
  "image",