@deot/docs-client 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +325 -0
- package/dist/chunks/_commonjsHelpers-BFTU3MAI-D_7z5o6A.js +8 -0
- package/dist/chunks/echarts-I1Rk_oCV.js +45301 -0
- package/dist/chunks/jsx-H2PmTOgp-C0GVSSMR.js +128281 -0
- package/dist/chunks/photoswipe.esm-CT37djgx.js +1628 -0
- package/dist/chunks/rolldown-runtime-Ce3zPWPd.js +24 -0
- package/dist/chunks/vc-components-C7ruefOT.js +6 -0
- package/dist/chunks/vc-components-m3l_xrd8.js +6 -0
- package/dist/index.cjs +8508 -0
- package/dist/index.d.ts +422 -0
- package/dist/index.js +119018 -0
- package/dist/index.style.css +22 -0
- package/package.json +43 -0
|
@@ -0,0 +1,1628 @@
|
|
|
1
|
+
globalThis.process;
|
|
2
|
+
//#region node_modules/.pnpm/photoswipe@5.4.4/node_modules/photoswipe/dist/photoswipe.esm.js
|
|
3
|
+
function e(e, t, n) {
|
|
4
|
+
let r = document.createElement(t);
|
|
5
|
+
return e && (r.className = e), n && n.appendChild(r), r;
|
|
6
|
+
}
|
|
7
|
+
function t(e, t) {
|
|
8
|
+
return e.x = t.x, e.y = t.y, t.id !== void 0 && (e.id = t.id), e;
|
|
9
|
+
}
|
|
10
|
+
function n(e) {
|
|
11
|
+
e.x = Math.round(e.x), e.y = Math.round(e.y);
|
|
12
|
+
}
|
|
13
|
+
function r(e, t) {
|
|
14
|
+
let n = Math.abs(e.x - t.x), r = Math.abs(e.y - t.y);
|
|
15
|
+
return Math.sqrt(n * n + r * r);
|
|
16
|
+
}
|
|
17
|
+
function i(e, t) {
|
|
18
|
+
return e.x === t.x && e.y === t.y;
|
|
19
|
+
}
|
|
20
|
+
function a(e, t, n) {
|
|
21
|
+
return Math.min(Math.max(e, t), n);
|
|
22
|
+
}
|
|
23
|
+
function o(e, t, n) {
|
|
24
|
+
let r = `translate3d(${e}px,${t || 0}px,0)`;
|
|
25
|
+
return n !== void 0 && (r += ` scale3d(${n},${n},1)`), r;
|
|
26
|
+
}
|
|
27
|
+
function s(e, t, n, r) {
|
|
28
|
+
e.style.transform = o(t, n, r);
|
|
29
|
+
}
|
|
30
|
+
var c = "cubic-bezier(.4,0,.22,1)";
|
|
31
|
+
function l(e, t, n, r) {
|
|
32
|
+
e.style.transition = t ? `${t} ${n}ms ${r || c}` : "none";
|
|
33
|
+
}
|
|
34
|
+
function u(e, t, n) {
|
|
35
|
+
e.style.width = typeof t == "number" ? `${t}px` : t, e.style.height = typeof n == "number" ? `${n}px` : n;
|
|
36
|
+
}
|
|
37
|
+
function d(e) {
|
|
38
|
+
l(e);
|
|
39
|
+
}
|
|
40
|
+
function f(e) {
|
|
41
|
+
return "decode" in e ? e.decode().catch(() => {}) : e.complete ? Promise.resolve(e) : new Promise((t, n) => {
|
|
42
|
+
e.onload = () => t(e), e.onerror = n;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
var p = {
|
|
46
|
+
IDLE: "idle",
|
|
47
|
+
LOADING: "loading",
|
|
48
|
+
LOADED: "loaded",
|
|
49
|
+
ERROR: "error"
|
|
50
|
+
};
|
|
51
|
+
function m(e) {
|
|
52
|
+
return "button" in e && e.button === 1 || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey;
|
|
53
|
+
}
|
|
54
|
+
function ee(e, t, n = document) {
|
|
55
|
+
let r = [];
|
|
56
|
+
if (e instanceof Element) r = [e];
|
|
57
|
+
else if (e instanceof NodeList || Array.isArray(e)) r = Array.from(e);
|
|
58
|
+
else {
|
|
59
|
+
let i = typeof e == "string" ? e : t;
|
|
60
|
+
i && (r = Array.from(n.querySelectorAll(i)));
|
|
61
|
+
}
|
|
62
|
+
return r;
|
|
63
|
+
}
|
|
64
|
+
function h() {
|
|
65
|
+
return !!(navigator.vendor && navigator.vendor.match(/apple/i));
|
|
66
|
+
}
|
|
67
|
+
var g = !1;
|
|
68
|
+
try {
|
|
69
|
+
window.addEventListener("test", null, Object.defineProperty({}, "passive", { get: () => {
|
|
70
|
+
g = !0;
|
|
71
|
+
} }));
|
|
72
|
+
} catch {}
|
|
73
|
+
var _ = class {
|
|
74
|
+
constructor() {
|
|
75
|
+
this._pool = [];
|
|
76
|
+
}
|
|
77
|
+
add(e, t, n, r) {
|
|
78
|
+
this._toggleListener(e, t, n, r);
|
|
79
|
+
}
|
|
80
|
+
remove(e, t, n, r) {
|
|
81
|
+
this._toggleListener(e, t, n, r, !0);
|
|
82
|
+
}
|
|
83
|
+
removeAll() {
|
|
84
|
+
this._pool.forEach((e) => {
|
|
85
|
+
this._toggleListener(e.target, e.type, e.listener, e.passive, !0, !0);
|
|
86
|
+
}), this._pool = [];
|
|
87
|
+
}
|
|
88
|
+
_toggleListener(e, t, n, r, i, a) {
|
|
89
|
+
if (!e) return;
|
|
90
|
+
let o = i ? "removeEventListener" : "addEventListener";
|
|
91
|
+
t.split(" ").forEach((t) => {
|
|
92
|
+
if (t) {
|
|
93
|
+
a || (i ? this._pool = this._pool.filter((r) => r.type !== t || r.listener !== n || r.target !== e) : this._pool.push({
|
|
94
|
+
target: e,
|
|
95
|
+
type: t,
|
|
96
|
+
listener: n,
|
|
97
|
+
passive: r
|
|
98
|
+
}));
|
|
99
|
+
let s = g ? { passive: r || !1 } : !1;
|
|
100
|
+
e[o](t, n, s);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
function v(e, t) {
|
|
106
|
+
if (e.getViewportSizeFn) {
|
|
107
|
+
let n = e.getViewportSizeFn(e, t);
|
|
108
|
+
if (n) return n;
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
x: document.documentElement.clientWidth,
|
|
112
|
+
y: window.innerHeight
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function y(e, t, n, r, i) {
|
|
116
|
+
let a = 0;
|
|
117
|
+
if (t.paddingFn) a = t.paddingFn(n, r, i)[e];
|
|
118
|
+
else if (t.padding) a = t.padding[e];
|
|
119
|
+
else {
|
|
120
|
+
let n = "padding" + e[0].toUpperCase() + e.slice(1);
|
|
121
|
+
t[n] && (a = t[n]);
|
|
122
|
+
}
|
|
123
|
+
return Number(a) || 0;
|
|
124
|
+
}
|
|
125
|
+
function b(e, t, n, r) {
|
|
126
|
+
return {
|
|
127
|
+
x: t.x - y("left", e, t, n, r) - y("right", e, t, n, r),
|
|
128
|
+
y: t.y - y("top", e, t, n, r) - y("bottom", e, t, n, r)
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
var x = class {
|
|
132
|
+
constructor(e) {
|
|
133
|
+
this.slide = e, this.currZoomLevel = 1, this.center = {
|
|
134
|
+
x: 0,
|
|
135
|
+
y: 0
|
|
136
|
+
}, this.max = {
|
|
137
|
+
x: 0,
|
|
138
|
+
y: 0
|
|
139
|
+
}, this.min = {
|
|
140
|
+
x: 0,
|
|
141
|
+
y: 0
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
update(e) {
|
|
145
|
+
this.currZoomLevel = e, this.slide.width ? (this._updateAxis("x"), this._updateAxis("y"), this.slide.pswp.dispatch("calcBounds", { slide: this.slide })) : this.reset();
|
|
146
|
+
}
|
|
147
|
+
_updateAxis(e) {
|
|
148
|
+
let { pswp: t } = this.slide, n = this.slide[e === "x" ? "width" : "height"] * this.currZoomLevel, r = y(e === "x" ? "left" : "top", t.options, t.viewportSize, this.slide.data, this.slide.index), i = this.slide.panAreaSize[e];
|
|
149
|
+
this.center[e] = Math.round((i - n) / 2) + r, this.max[e] = n > i ? Math.round(i - n) + r : this.center[e], this.min[e] = n > i ? r : this.center[e];
|
|
150
|
+
}
|
|
151
|
+
reset() {
|
|
152
|
+
this.center.x = 0, this.center.y = 0, this.max.x = 0, this.max.y = 0, this.min.x = 0, this.min.y = 0;
|
|
153
|
+
}
|
|
154
|
+
correctPan(e, t) {
|
|
155
|
+
return a(t, this.max[e], this.min[e]);
|
|
156
|
+
}
|
|
157
|
+
}, S = 4e3, C = class {
|
|
158
|
+
constructor(e, t, n, r) {
|
|
159
|
+
this.pswp = r, this.options = e, this.itemData = t, this.index = n, this.panAreaSize = null, this.elementSize = null, this.fit = 1, this.fill = 1, this.vFill = 1, this.initial = 1, this.secondary = 1, this.max = 1, this.min = 1;
|
|
160
|
+
}
|
|
161
|
+
update(e, t, n) {
|
|
162
|
+
let r = {
|
|
163
|
+
x: e,
|
|
164
|
+
y: t
|
|
165
|
+
};
|
|
166
|
+
this.elementSize = r, this.panAreaSize = n;
|
|
167
|
+
let i = n.x / r.x, a = n.y / r.y;
|
|
168
|
+
this.fit = Math.min(1, i < a ? i : a), this.fill = Math.min(1, i > a ? i : a), this.vFill = Math.min(1, a), this.initial = this._getInitial(), this.secondary = this._getSecondary(), this.max = Math.max(this.initial, this.secondary, this._getMax()), this.min = Math.min(this.fit, this.initial, this.secondary), this.pswp && this.pswp.dispatch("zoomLevelsUpdate", {
|
|
169
|
+
zoomLevels: this,
|
|
170
|
+
slideData: this.itemData
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
_parseZoomLevelOption(e) {
|
|
174
|
+
let t = e + "ZoomLevel", n = this.options[t];
|
|
175
|
+
if (n) return typeof n == "function" ? n(this) : n === "fill" ? this.fill : n === "fit" ? this.fit : Number(n);
|
|
176
|
+
}
|
|
177
|
+
_getSecondary() {
|
|
178
|
+
let e = this._parseZoomLevelOption("secondary");
|
|
179
|
+
return e || (e = Math.min(1, this.fit * 3), this.elementSize && e * this.elementSize.x > S && (e = S / this.elementSize.x), e);
|
|
180
|
+
}
|
|
181
|
+
_getInitial() {
|
|
182
|
+
return this._parseZoomLevelOption("initial") || this.fit;
|
|
183
|
+
}
|
|
184
|
+
_getMax() {
|
|
185
|
+
return this._parseZoomLevelOption("max") || Math.max(1, this.fit * 4);
|
|
186
|
+
}
|
|
187
|
+
}, te = class {
|
|
188
|
+
constructor(t, n, r) {
|
|
189
|
+
this.data = t, this.index = n, this.pswp = r, this.isActive = n === r.currIndex, this.currentResolution = 0, this.panAreaSize = {
|
|
190
|
+
x: 0,
|
|
191
|
+
y: 0
|
|
192
|
+
}, this.pan = {
|
|
193
|
+
x: 0,
|
|
194
|
+
y: 0
|
|
195
|
+
}, this.isFirstSlide = this.isActive && !r.opener.isOpen, this.zoomLevels = new C(r.options, t, n, r), this.pswp.dispatch("gettingData", {
|
|
196
|
+
slide: this,
|
|
197
|
+
data: this.data,
|
|
198
|
+
index: n
|
|
199
|
+
}), this.content = this.pswp.contentLoader.getContentBySlide(this), this.container = e("pswp__zoom-wrap", "div"), this.holderElement = null, this.currZoomLevel = 1, this.width = this.content.width, this.height = this.content.height, this.heavyAppended = !1, this.bounds = new x(this), this.prevDisplayedWidth = -1, this.prevDisplayedHeight = -1, this.pswp.dispatch("slideInit", { slide: this });
|
|
200
|
+
}
|
|
201
|
+
setIsActive(e) {
|
|
202
|
+
e && !this.isActive ? this.activate() : !e && this.isActive && this.deactivate();
|
|
203
|
+
}
|
|
204
|
+
append(e) {
|
|
205
|
+
this.holderElement = e, this.container.style.transformOrigin = "0 0", this.data && (this.calculateSize(), this.load(), this.updateContentSize(), this.appendHeavy(), this.holderElement.appendChild(this.container), this.zoomAndPanToInitial(), this.pswp.dispatch("firstZoomPan", { slide: this }), this.applyCurrentZoomPan(), this.pswp.dispatch("afterSetContent", { slide: this }), this.isActive && this.activate());
|
|
206
|
+
}
|
|
207
|
+
load() {
|
|
208
|
+
this.content.load(!1), this.pswp.dispatch("slideLoad", { slide: this });
|
|
209
|
+
}
|
|
210
|
+
appendHeavy() {
|
|
211
|
+
let { pswp: e } = this;
|
|
212
|
+
this.heavyAppended || !e.opener.isOpen || e.mainScroll.isShifted() || !this.isActive && !1 || this.pswp.dispatch("appendHeavy", { slide: this }).defaultPrevented || (this.heavyAppended = !0, this.content.append(), this.pswp.dispatch("appendHeavyContent", { slide: this }));
|
|
213
|
+
}
|
|
214
|
+
activate() {
|
|
215
|
+
this.isActive = !0, this.appendHeavy(), this.content.activate(), this.pswp.dispatch("slideActivate", { slide: this });
|
|
216
|
+
}
|
|
217
|
+
deactivate() {
|
|
218
|
+
this.isActive = !1, this.content.deactivate(), this.currZoomLevel !== this.zoomLevels.initial && this.calculateSize(), this.currentResolution = 0, this.zoomAndPanToInitial(), this.applyCurrentZoomPan(), this.updateContentSize(), this.pswp.dispatch("slideDeactivate", { slide: this });
|
|
219
|
+
}
|
|
220
|
+
destroy() {
|
|
221
|
+
this.content.hasSlide = !1, this.content.remove(), this.container.remove(), this.pswp.dispatch("slideDestroy", { slide: this });
|
|
222
|
+
}
|
|
223
|
+
resize() {
|
|
224
|
+
this.currZoomLevel === this.zoomLevels.initial || !this.isActive ? (this.calculateSize(), this.currentResolution = 0, this.zoomAndPanToInitial(), this.applyCurrentZoomPan(), this.updateContentSize()) : (this.calculateSize(), this.bounds.update(this.currZoomLevel), this.panTo(this.pan.x, this.pan.y));
|
|
225
|
+
}
|
|
226
|
+
updateContentSize(e) {
|
|
227
|
+
let t = this.currentResolution || this.zoomLevels.initial;
|
|
228
|
+
if (!t) return;
|
|
229
|
+
let n = Math.round(this.width * t) || this.pswp.viewportSize.x, r = Math.round(this.height * t) || this.pswp.viewportSize.y;
|
|
230
|
+
!this.sizeChanged(n, r) && !e || this.content.setDisplayedSize(n, r);
|
|
231
|
+
}
|
|
232
|
+
sizeChanged(e, t) {
|
|
233
|
+
return e !== this.prevDisplayedWidth || t !== this.prevDisplayedHeight ? (this.prevDisplayedWidth = e, this.prevDisplayedHeight = t, !0) : !1;
|
|
234
|
+
}
|
|
235
|
+
getPlaceholderElement() {
|
|
236
|
+
return this.content.placeholder?.element;
|
|
237
|
+
}
|
|
238
|
+
zoomTo(e, t, r, i) {
|
|
239
|
+
let { pswp: o } = this;
|
|
240
|
+
if (!this.isZoomable() || o.mainScroll.isShifted()) return;
|
|
241
|
+
o.dispatch("beforeZoomTo", {
|
|
242
|
+
destZoomLevel: e,
|
|
243
|
+
centerPoint: t,
|
|
244
|
+
transitionDuration: r
|
|
245
|
+
}), o.animations.stopAllPan();
|
|
246
|
+
let s = this.currZoomLevel;
|
|
247
|
+
i || (e = a(e, this.zoomLevels.min, this.zoomLevels.max)), this.setZoomLevel(e), this.pan.x = this.calculateZoomToPanOffset("x", t, s), this.pan.y = this.calculateZoomToPanOffset("y", t, s), n(this.pan);
|
|
248
|
+
let c = () => {
|
|
249
|
+
this._setResolution(e), this.applyCurrentZoomPan();
|
|
250
|
+
};
|
|
251
|
+
r ? o.animations.startTransition({
|
|
252
|
+
isPan: !0,
|
|
253
|
+
name: "zoomTo",
|
|
254
|
+
target: this.container,
|
|
255
|
+
transform: this.getCurrentTransform(),
|
|
256
|
+
onComplete: c,
|
|
257
|
+
duration: r,
|
|
258
|
+
easing: o.options.easing
|
|
259
|
+
}) : c();
|
|
260
|
+
}
|
|
261
|
+
toggleZoom(e) {
|
|
262
|
+
this.zoomTo(this.currZoomLevel === this.zoomLevels.initial ? this.zoomLevels.secondary : this.zoomLevels.initial, e, this.pswp.options.zoomAnimationDuration);
|
|
263
|
+
}
|
|
264
|
+
setZoomLevel(e) {
|
|
265
|
+
this.currZoomLevel = e, this.bounds.update(this.currZoomLevel);
|
|
266
|
+
}
|
|
267
|
+
calculateZoomToPanOffset(e, t, n) {
|
|
268
|
+
if (this.bounds.max[e] - this.bounds.min[e] === 0) return this.bounds.center[e];
|
|
269
|
+
t ||= this.pswp.getViewportCenterPoint(), n ||= this.zoomLevels.initial;
|
|
270
|
+
let r = this.currZoomLevel / n;
|
|
271
|
+
return this.bounds.correctPan(e, (this.pan[e] - t[e]) * r + t[e]);
|
|
272
|
+
}
|
|
273
|
+
panTo(e, t) {
|
|
274
|
+
this.pan.x = this.bounds.correctPan("x", e), this.pan.y = this.bounds.correctPan("y", t), this.applyCurrentZoomPan();
|
|
275
|
+
}
|
|
276
|
+
isPannable() {
|
|
277
|
+
return !!this.width && this.currZoomLevel > this.zoomLevels.fit;
|
|
278
|
+
}
|
|
279
|
+
isZoomable() {
|
|
280
|
+
return !!this.width && this.content.isZoomable();
|
|
281
|
+
}
|
|
282
|
+
applyCurrentZoomPan() {
|
|
283
|
+
this._applyZoomTransform(this.pan.x, this.pan.y, this.currZoomLevel), this === this.pswp.currSlide && this.pswp.dispatch("zoomPanUpdate", { slide: this });
|
|
284
|
+
}
|
|
285
|
+
zoomAndPanToInitial() {
|
|
286
|
+
this.currZoomLevel = this.zoomLevels.initial, this.bounds.update(this.currZoomLevel), t(this.pan, this.bounds.center), this.pswp.dispatch("initialZoomPan", { slide: this });
|
|
287
|
+
}
|
|
288
|
+
_applyZoomTransform(e, t, n) {
|
|
289
|
+
n /= this.currentResolution || this.zoomLevels.initial, s(this.container, e, t, n);
|
|
290
|
+
}
|
|
291
|
+
calculateSize() {
|
|
292
|
+
let { pswp: e } = this;
|
|
293
|
+
t(this.panAreaSize, b(e.options, e.viewportSize, this.data, this.index)), this.zoomLevels.update(this.width, this.height, this.panAreaSize), e.dispatch("calcSlideSize", { slide: this });
|
|
294
|
+
}
|
|
295
|
+
getCurrentTransform() {
|
|
296
|
+
let e = this.currZoomLevel / (this.currentResolution || this.zoomLevels.initial);
|
|
297
|
+
return o(this.pan.x, this.pan.y, e);
|
|
298
|
+
}
|
|
299
|
+
_setResolution(e) {
|
|
300
|
+
e !== this.currentResolution && (this.currentResolution = e, this.updateContentSize(), this.pswp.dispatch("resolutionChanged"));
|
|
301
|
+
}
|
|
302
|
+
}, ne = .35, re = .6, ie = .4, w = .5;
|
|
303
|
+
function T(e, t) {
|
|
304
|
+
return e * t / (1 - t);
|
|
305
|
+
}
|
|
306
|
+
var E = class {
|
|
307
|
+
constructor(e) {
|
|
308
|
+
this.gestures = e, this.pswp = e.pswp, this.startPan = {
|
|
309
|
+
x: 0,
|
|
310
|
+
y: 0
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
start() {
|
|
314
|
+
this.pswp.currSlide && t(this.startPan, this.pswp.currSlide.pan), this.pswp.animations.stopAll();
|
|
315
|
+
}
|
|
316
|
+
change() {
|
|
317
|
+
let { p1: e, prevP1: t, dragAxis: r } = this.gestures, { currSlide: i } = this.pswp;
|
|
318
|
+
if (r === "y" && this.pswp.options.closeOnVerticalDrag && i && i.currZoomLevel <= i.zoomLevels.fit && !this.gestures.isMultitouch) {
|
|
319
|
+
let n = i.pan.y + (e.y - t.y);
|
|
320
|
+
if (!this.pswp.dispatch("verticalDrag", { panY: n }).defaultPrevented) {
|
|
321
|
+
this._setPanWithFriction("y", n, re);
|
|
322
|
+
let e = 1 - Math.abs(this._getVerticalDragRatio(i.pan.y));
|
|
323
|
+
this.pswp.applyBgOpacity(e), i.applyCurrentZoomPan();
|
|
324
|
+
}
|
|
325
|
+
} else this._panOrMoveMainScroll("x") || (this._panOrMoveMainScroll("y"), i && (n(i.pan), i.applyCurrentZoomPan()));
|
|
326
|
+
}
|
|
327
|
+
end() {
|
|
328
|
+
let { velocity: e } = this.gestures, { mainScroll: t, currSlide: n } = this.pswp, r = 0;
|
|
329
|
+
if (this.pswp.animations.stopAll(), t.isShifted()) {
|
|
330
|
+
let n = (t.x - t.getCurrSlideX()) / this.pswp.viewportSize.x;
|
|
331
|
+
e.x < -.5 && n < 0 || e.x < .1 && n < -.5 ? (r = 1, e.x = Math.min(e.x, 0)) : (e.x > w && n > 0 || e.x > -.1 && n > .5) && (r = -1, e.x = Math.max(e.x, 0)), t.moveIndexBy(r, !0, e.x);
|
|
332
|
+
}
|
|
333
|
+
n && n.currZoomLevel > n.zoomLevels.max || this.gestures.isMultitouch ? this.gestures.zoomLevels.correctZoomPan(!0) : (this._finishPanGestureForAxis("x"), this._finishPanGestureForAxis("y"));
|
|
334
|
+
}
|
|
335
|
+
_finishPanGestureForAxis(e) {
|
|
336
|
+
let { velocity: t } = this.gestures, { currSlide: n } = this.pswp;
|
|
337
|
+
if (!n) return;
|
|
338
|
+
let { pan: r, bounds: i } = n, o = r[e], s = this.pswp.bgOpacity < 1 && e === "y", c = o + T(t[e], .995);
|
|
339
|
+
if (s) {
|
|
340
|
+
let e = this._getVerticalDragRatio(o), t = this._getVerticalDragRatio(c);
|
|
341
|
+
if (e < 0 && t < -.4 || e > 0 && t > ie) {
|
|
342
|
+
this.pswp.close();
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
let l = i.correctPan(e, c);
|
|
347
|
+
if (o === l) return;
|
|
348
|
+
let u = l === c ? 1 : .82, d = this.pswp.bgOpacity, f = l - o;
|
|
349
|
+
this.pswp.animations.startSpring({
|
|
350
|
+
name: "panGesture" + e,
|
|
351
|
+
isPan: !0,
|
|
352
|
+
start: o,
|
|
353
|
+
end: l,
|
|
354
|
+
velocity: t[e],
|
|
355
|
+
dampingRatio: u,
|
|
356
|
+
onUpdate: (t) => {
|
|
357
|
+
if (s && this.pswp.bgOpacity < 1) {
|
|
358
|
+
let e = 1 - (l - t) / f;
|
|
359
|
+
this.pswp.applyBgOpacity(a(d + (1 - d) * e, 0, 1));
|
|
360
|
+
}
|
|
361
|
+
r[e] = Math.floor(t), n.applyCurrentZoomPan();
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
_panOrMoveMainScroll(e) {
|
|
366
|
+
let { p1: t, dragAxis: n, prevP1: r, isMultitouch: i } = this.gestures, { currSlide: a, mainScroll: o } = this.pswp, s = t[e] - r[e], c = o.x + s;
|
|
367
|
+
if (!s || !a) return !1;
|
|
368
|
+
if (e === "x" && !a.isPannable() && !i) return o.moveTo(c, !0), !0;
|
|
369
|
+
let { bounds: l } = a, u = a.pan[e] + s;
|
|
370
|
+
if (this.pswp.options.allowPanToNext && n === "x" && e === "x" && !i) {
|
|
371
|
+
let t = o.getCurrSlideX(), n = o.x - t, r = s > 0, i = !r;
|
|
372
|
+
if (u > l.min[e] && r) {
|
|
373
|
+
if (l.min[e] <= this.startPan[e]) return o.moveTo(c, !0), !0;
|
|
374
|
+
this._setPanWithFriction(e, u);
|
|
375
|
+
} else if (u < l.max[e] && i) {
|
|
376
|
+
if (this.startPan[e] <= l.max[e]) return o.moveTo(c, !0), !0;
|
|
377
|
+
this._setPanWithFriction(e, u);
|
|
378
|
+
} else if (n !== 0) {
|
|
379
|
+
if (n > 0) return o.moveTo(Math.max(c, t), !0), !0;
|
|
380
|
+
if (n < 0) return o.moveTo(Math.min(c, t), !0), !0;
|
|
381
|
+
} else this._setPanWithFriction(e, u);
|
|
382
|
+
} else e === "y" ? !o.isShifted() && l.min.y !== l.max.y && this._setPanWithFriction(e, u) : this._setPanWithFriction(e, u);
|
|
383
|
+
return !1;
|
|
384
|
+
}
|
|
385
|
+
_getVerticalDragRatio(e) {
|
|
386
|
+
return (e - (this.pswp.currSlide?.bounds.center.y ?? 0)) / (this.pswp.viewportSize.y / 3);
|
|
387
|
+
}
|
|
388
|
+
_setPanWithFriction(e, t, n) {
|
|
389
|
+
let { currSlide: r } = this.pswp;
|
|
390
|
+
if (!r) return;
|
|
391
|
+
let { pan: i, bounds: a } = r;
|
|
392
|
+
if (a.correctPan(e, t) !== t || n) {
|
|
393
|
+
let r = Math.round(t - i[e]);
|
|
394
|
+
i[e] += r * (n || ne);
|
|
395
|
+
} else i[e] = t;
|
|
396
|
+
}
|
|
397
|
+
}, D = .05, O = .15;
|
|
398
|
+
function k(e, t, n) {
|
|
399
|
+
return e.x = (t.x + n.x) / 2, e.y = (t.y + n.y) / 2, e;
|
|
400
|
+
}
|
|
401
|
+
var A = class {
|
|
402
|
+
constructor(e) {
|
|
403
|
+
this.gestures = e, this._startPan = {
|
|
404
|
+
x: 0,
|
|
405
|
+
y: 0
|
|
406
|
+
}, this._startZoomPoint = {
|
|
407
|
+
x: 0,
|
|
408
|
+
y: 0
|
|
409
|
+
}, this._zoomPoint = {
|
|
410
|
+
x: 0,
|
|
411
|
+
y: 0
|
|
412
|
+
}, this._wasOverFitZoomLevel = !1, this._startZoomLevel = 1;
|
|
413
|
+
}
|
|
414
|
+
start() {
|
|
415
|
+
let { currSlide: e } = this.gestures.pswp;
|
|
416
|
+
e && (this._startZoomLevel = e.currZoomLevel, t(this._startPan, e.pan)), this.gestures.pswp.animations.stopAllPan(), this._wasOverFitZoomLevel = !1;
|
|
417
|
+
}
|
|
418
|
+
change() {
|
|
419
|
+
let { p1: e, startP1: t, p2: n, startP2: i, pswp: a } = this.gestures, { currSlide: o } = a;
|
|
420
|
+
if (!o) return;
|
|
421
|
+
let s = o.zoomLevels.min, c = o.zoomLevels.max;
|
|
422
|
+
if (!o.isZoomable() || a.mainScroll.isShifted()) return;
|
|
423
|
+
k(this._startZoomPoint, t, i), k(this._zoomPoint, e, n);
|
|
424
|
+
let l = 1 / r(t, i) * r(e, n) * this._startZoomLevel;
|
|
425
|
+
if (l > o.zoomLevels.initial + o.zoomLevels.initial / 15 && (this._wasOverFitZoomLevel = !0), l < s) if (a.options.pinchToClose && !this._wasOverFitZoomLevel && this._startZoomLevel <= o.zoomLevels.initial) {
|
|
426
|
+
let e = 1 - (s - l) / (s / 1.2);
|
|
427
|
+
a.dispatch("pinchClose", { bgOpacity: e }).defaultPrevented || a.applyBgOpacity(e);
|
|
428
|
+
} else l = s - (s - l) * O;
|
|
429
|
+
else l > c && (l = c + (l - c) * D);
|
|
430
|
+
o.pan.x = this._calculatePanForZoomLevel("x", l), o.pan.y = this._calculatePanForZoomLevel("y", l), o.setZoomLevel(l), o.applyCurrentZoomPan();
|
|
431
|
+
}
|
|
432
|
+
end() {
|
|
433
|
+
let { pswp: e } = this.gestures, { currSlide: t } = e;
|
|
434
|
+
(!t || t.currZoomLevel < t.zoomLevels.initial) && !this._wasOverFitZoomLevel && e.options.pinchToClose ? e.close() : this.correctZoomPan();
|
|
435
|
+
}
|
|
436
|
+
_calculatePanForZoomLevel(e, t) {
|
|
437
|
+
let n = t / this._startZoomLevel;
|
|
438
|
+
return this._zoomPoint[e] - (this._startZoomPoint[e] - this._startPan[e]) * n;
|
|
439
|
+
}
|
|
440
|
+
correctZoomPan(e) {
|
|
441
|
+
let { pswp: n } = this.gestures, { currSlide: r } = n;
|
|
442
|
+
if (!(r != null && r.isZoomable())) return;
|
|
443
|
+
this._zoomPoint.x === 0 && (e = !0);
|
|
444
|
+
let o = r.currZoomLevel, s, c = !0;
|
|
445
|
+
o < r.zoomLevels.initial ? s = r.zoomLevels.initial : o > r.zoomLevels.max ? s = r.zoomLevels.max : (c = !1, s = o);
|
|
446
|
+
let l = n.bgOpacity, u = n.bgOpacity < 1, d = t({
|
|
447
|
+
x: 0,
|
|
448
|
+
y: 0
|
|
449
|
+
}, r.pan), f = t({
|
|
450
|
+
x: 0,
|
|
451
|
+
y: 0
|
|
452
|
+
}, d);
|
|
453
|
+
e && (this._zoomPoint.x = 0, this._zoomPoint.y = 0, this._startZoomPoint.x = 0, this._startZoomPoint.y = 0, this._startZoomLevel = o, t(this._startPan, d)), c && (f = {
|
|
454
|
+
x: this._calculatePanForZoomLevel("x", s),
|
|
455
|
+
y: this._calculatePanForZoomLevel("y", s)
|
|
456
|
+
}), r.setZoomLevel(s), f = {
|
|
457
|
+
x: r.bounds.correctPan("x", f.x),
|
|
458
|
+
y: r.bounds.correctPan("y", f.y)
|
|
459
|
+
}, r.setZoomLevel(o);
|
|
460
|
+
let p = !i(f, d);
|
|
461
|
+
if (!p && !c && !u) {
|
|
462
|
+
r._setResolution(s), r.applyCurrentZoomPan();
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
n.animations.stopAllPan(), n.animations.startSpring({
|
|
466
|
+
isPan: !0,
|
|
467
|
+
start: 0,
|
|
468
|
+
end: 1e3,
|
|
469
|
+
velocity: 0,
|
|
470
|
+
dampingRatio: 1,
|
|
471
|
+
naturalFrequency: 40,
|
|
472
|
+
onUpdate: (e) => {
|
|
473
|
+
if (e /= 1e3, p || c) {
|
|
474
|
+
if (p && (r.pan.x = d.x + (f.x - d.x) * e, r.pan.y = d.y + (f.y - d.y) * e), c) {
|
|
475
|
+
let t = o + (s - o) * e;
|
|
476
|
+
r.setZoomLevel(t);
|
|
477
|
+
}
|
|
478
|
+
r.applyCurrentZoomPan();
|
|
479
|
+
}
|
|
480
|
+
u && n.bgOpacity < 1 && n.applyBgOpacity(a(l + (1 - l) * e, 0, 1));
|
|
481
|
+
},
|
|
482
|
+
onComplete: () => {
|
|
483
|
+
r._setResolution(s), r.applyCurrentZoomPan();
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
function j(e) {
|
|
489
|
+
return !!e.target.closest(".pswp__container");
|
|
490
|
+
}
|
|
491
|
+
var M = class {
|
|
492
|
+
constructor(e) {
|
|
493
|
+
this.gestures = e;
|
|
494
|
+
}
|
|
495
|
+
click(e, t) {
|
|
496
|
+
let n = t.target.classList, r = n.contains("pswp__img"), i = n.contains("pswp__item") || n.contains("pswp__zoom-wrap");
|
|
497
|
+
r ? this._doClickOrTapAction("imageClick", e, t) : i && this._doClickOrTapAction("bgClick", e, t);
|
|
498
|
+
}
|
|
499
|
+
tap(e, t) {
|
|
500
|
+
j(t) && this._doClickOrTapAction("tap", e, t);
|
|
501
|
+
}
|
|
502
|
+
doubleTap(e, t) {
|
|
503
|
+
j(t) && this._doClickOrTapAction("doubleTap", e, t);
|
|
504
|
+
}
|
|
505
|
+
_doClickOrTapAction(e, t, n) {
|
|
506
|
+
var r;
|
|
507
|
+
let { pswp: i } = this.gestures, { currSlide: a } = i, o = e + "Action", s = i.options[o];
|
|
508
|
+
if (!i.dispatch(o, {
|
|
509
|
+
point: t,
|
|
510
|
+
originalEvent: n
|
|
511
|
+
}).defaultPrevented) {
|
|
512
|
+
if (typeof s == "function") {
|
|
513
|
+
s.call(i, t, n);
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
switch (s) {
|
|
517
|
+
case "close":
|
|
518
|
+
case "next":
|
|
519
|
+
i[s]();
|
|
520
|
+
break;
|
|
521
|
+
case "zoom":
|
|
522
|
+
a?.toggleZoom(t);
|
|
523
|
+
break;
|
|
524
|
+
case "zoom-or-close":
|
|
525
|
+
a != null && a.isZoomable() && a.zoomLevels.secondary !== a.zoomLevels.initial ? a.toggleZoom(t) : i.options.clickToCloseNonZoomable && i.close();
|
|
526
|
+
break;
|
|
527
|
+
case "toggle-controls": (r = this.gestures.pswp.element) == null || r.classList.toggle("pswp--ui-visible");
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}, N = 10, P = 300, F = 25, I = class {
|
|
532
|
+
constructor(e) {
|
|
533
|
+
this.pswp = e, this.dragAxis = null, this.p1 = {
|
|
534
|
+
x: 0,
|
|
535
|
+
y: 0
|
|
536
|
+
}, this.p2 = {
|
|
537
|
+
x: 0,
|
|
538
|
+
y: 0
|
|
539
|
+
}, this.prevP1 = {
|
|
540
|
+
x: 0,
|
|
541
|
+
y: 0
|
|
542
|
+
}, this.prevP2 = {
|
|
543
|
+
x: 0,
|
|
544
|
+
y: 0
|
|
545
|
+
}, this.startP1 = {
|
|
546
|
+
x: 0,
|
|
547
|
+
y: 0
|
|
548
|
+
}, this.startP2 = {
|
|
549
|
+
x: 0,
|
|
550
|
+
y: 0
|
|
551
|
+
}, this.velocity = {
|
|
552
|
+
x: 0,
|
|
553
|
+
y: 0
|
|
554
|
+
}, this._lastStartP1 = {
|
|
555
|
+
x: 0,
|
|
556
|
+
y: 0
|
|
557
|
+
}, this._intervalP1 = {
|
|
558
|
+
x: 0,
|
|
559
|
+
y: 0
|
|
560
|
+
}, this._numActivePoints = 0, this._ongoingPointers = [], this._touchEventEnabled = "ontouchstart" in window, this._pointerEventEnabled = !!window.PointerEvent, this.supportsTouch = this._touchEventEnabled || this._pointerEventEnabled && navigator.maxTouchPoints > 1, this._numActivePoints = 0, this._intervalTime = 0, this._velocityCalculated = !1, this.isMultitouch = !1, this.isDragging = !1, this.isZooming = !1, this.raf = null, this._tapTimer = null, this.supportsTouch || (e.options.allowPanToNext = !1), this.drag = new E(this), this.zoomLevels = new A(this), this.tapHandler = new M(this), e.on("bindEvents", () => {
|
|
561
|
+
e.events.add(e.scrollWrap, "click", this._onClick.bind(this)), this._pointerEventEnabled ? this._bindEvents("pointer", "down", "up", "cancel") : this._touchEventEnabled ? (this._bindEvents("touch", "start", "end", "cancel"), e.scrollWrap && (e.scrollWrap.ontouchmove = () => {}, e.scrollWrap.ontouchend = () => {})) : this._bindEvents("mouse", "down", "up");
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
_bindEvents(e, t, n, r) {
|
|
565
|
+
let { pswp: i } = this, { events: a } = i, o = r ? e + r : "";
|
|
566
|
+
a.add(i.scrollWrap, e + t, this.onPointerDown.bind(this)), a.add(window, e + "move", this.onPointerMove.bind(this)), a.add(window, e + n, this.onPointerUp.bind(this)), o && a.add(i.scrollWrap, o, this.onPointerUp.bind(this));
|
|
567
|
+
}
|
|
568
|
+
onPointerDown(e) {
|
|
569
|
+
let n = e.type === "mousedown" || e.pointerType === "mouse";
|
|
570
|
+
if (n && e.button > 0) return;
|
|
571
|
+
let { pswp: r } = this;
|
|
572
|
+
if (!r.opener.isOpen) {
|
|
573
|
+
e.preventDefault();
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
r.dispatch("pointerDown", { originalEvent: e }).defaultPrevented || (n && (r.mouseDetected(), this._preventPointerEventBehaviour(e, "down")), r.animations.stopAll(), this._updatePoints(e, "down"), this._numActivePoints === 1 && (this.dragAxis = null, t(this.startP1, this.p1)), this._numActivePoints > 1 ? (this._clearTapTimer(), this.isMultitouch = !0) : this.isMultitouch = !1);
|
|
577
|
+
}
|
|
578
|
+
onPointerMove(e) {
|
|
579
|
+
this._preventPointerEventBehaviour(e, "move"), this._numActivePoints && (this._updatePoints(e, "move"), !this.pswp.dispatch("pointerMove", { originalEvent: e }).defaultPrevented && (this._numActivePoints === 1 && !this.isDragging ? (this.dragAxis || this._calculateDragDirection(), this.dragAxis && !this.isDragging && (this.isZooming && (this.isZooming = !1, this.zoomLevels.end()), this.isDragging = !0, this._clearTapTimer(), this._updateStartPoints(), this._intervalTime = Date.now(), this._velocityCalculated = !1, t(this._intervalP1, this.p1), this.velocity.x = 0, this.velocity.y = 0, this.drag.start(), this._rafStopLoop(), this._rafRenderLoop())) : this._numActivePoints > 1 && !this.isZooming && (this._finishDrag(), this.isZooming = !0, this._updateStartPoints(), this.zoomLevels.start(), this._rafStopLoop(), this._rafRenderLoop())));
|
|
580
|
+
}
|
|
581
|
+
_finishDrag() {
|
|
582
|
+
this.isDragging && (this.isDragging = !1, this._velocityCalculated || this._updateVelocity(!0), this.drag.end(), this.dragAxis = null);
|
|
583
|
+
}
|
|
584
|
+
onPointerUp(e) {
|
|
585
|
+
this._numActivePoints && (this._updatePoints(e, "up"), !this.pswp.dispatch("pointerUp", { originalEvent: e }).defaultPrevented && (this._numActivePoints === 0 && (this._rafStopLoop(), this.isDragging ? this._finishDrag() : !this.isZooming && !this.isMultitouch && this._finishTap(e)), this._numActivePoints < 2 && this.isZooming && (this.isZooming = !1, this.zoomLevels.end(), this._numActivePoints === 1 && (this.dragAxis = null, this._updateStartPoints()))));
|
|
586
|
+
}
|
|
587
|
+
_rafRenderLoop() {
|
|
588
|
+
(this.isDragging || this.isZooming) && (this._updateVelocity(), this.isDragging ? i(this.p1, this.prevP1) || this.drag.change() : (!i(this.p1, this.prevP1) || !i(this.p2, this.prevP2)) && this.zoomLevels.change(), this._updatePrevPoints(), this.raf = requestAnimationFrame(this._rafRenderLoop.bind(this)));
|
|
589
|
+
}
|
|
590
|
+
_updateVelocity(e) {
|
|
591
|
+
let n = Date.now(), r = n - this._intervalTime;
|
|
592
|
+
r < 50 && !e || (this.velocity.x = this._getVelocity("x", r), this.velocity.y = this._getVelocity("y", r), this._intervalTime = n, t(this._intervalP1, this.p1), this._velocityCalculated = !0);
|
|
593
|
+
}
|
|
594
|
+
_finishTap(e) {
|
|
595
|
+
let { mainScroll: n } = this.pswp;
|
|
596
|
+
if (n.isShifted()) {
|
|
597
|
+
n.moveIndexBy(0, !0);
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
if (e.type.indexOf("cancel") > 0) return;
|
|
601
|
+
if (e.type === "mouseup" || e.pointerType === "mouse") {
|
|
602
|
+
this.tapHandler.click(this.startP1, e);
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
let i = this.pswp.options.doubleTapAction ? P : 0;
|
|
606
|
+
this._tapTimer ? (this._clearTapTimer(), r(this._lastStartP1, this.startP1) < F && this.tapHandler.doubleTap(this.startP1, e)) : (t(this._lastStartP1, this.startP1), this._tapTimer = setTimeout(() => {
|
|
607
|
+
this.tapHandler.tap(this.startP1, e), this._clearTapTimer();
|
|
608
|
+
}, i));
|
|
609
|
+
}
|
|
610
|
+
_clearTapTimer() {
|
|
611
|
+
this._tapTimer &&= (clearTimeout(this._tapTimer), null);
|
|
612
|
+
}
|
|
613
|
+
_getVelocity(e, t) {
|
|
614
|
+
let n = this.p1[e] - this._intervalP1[e];
|
|
615
|
+
return Math.abs(n) > 1 && t > 5 ? n / t : 0;
|
|
616
|
+
}
|
|
617
|
+
_rafStopLoop() {
|
|
618
|
+
this.raf &&= (cancelAnimationFrame(this.raf), null);
|
|
619
|
+
}
|
|
620
|
+
_preventPointerEventBehaviour(e, t) {
|
|
621
|
+
this.pswp.applyFilters("preventPointerEvent", !0, e, t) && e.preventDefault();
|
|
622
|
+
}
|
|
623
|
+
_updatePoints(e, n) {
|
|
624
|
+
if (this._pointerEventEnabled) {
|
|
625
|
+
let r = e, i = this._ongoingPointers.findIndex((e) => e.id === r.pointerId);
|
|
626
|
+
n === "up" && i > -1 ? this._ongoingPointers.splice(i, 1) : n === "down" && i === -1 ? this._ongoingPointers.push(this._convertEventPosToPoint(r, {
|
|
627
|
+
x: 0,
|
|
628
|
+
y: 0
|
|
629
|
+
})) : i > -1 && this._convertEventPosToPoint(r, this._ongoingPointers[i]), this._numActivePoints = this._ongoingPointers.length, this._numActivePoints > 0 && t(this.p1, this._ongoingPointers[0]), this._numActivePoints > 1 && t(this.p2, this._ongoingPointers[1]);
|
|
630
|
+
} else {
|
|
631
|
+
let t = e;
|
|
632
|
+
this._numActivePoints = 0, t.type.indexOf("touch") > -1 ? t.touches && t.touches.length > 0 && (this._convertEventPosToPoint(t.touches[0], this.p1), this._numActivePoints++, t.touches.length > 1 && (this._convertEventPosToPoint(t.touches[1], this.p2), this._numActivePoints++)) : (this._convertEventPosToPoint(e, this.p1), n === "up" ? this._numActivePoints = 0 : this._numActivePoints++);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
_updatePrevPoints() {
|
|
636
|
+
t(this.prevP1, this.p1), t(this.prevP2, this.p2);
|
|
637
|
+
}
|
|
638
|
+
_updateStartPoints() {
|
|
639
|
+
t(this.startP1, this.p1), t(this.startP2, this.p2), this._updatePrevPoints();
|
|
640
|
+
}
|
|
641
|
+
_calculateDragDirection() {
|
|
642
|
+
if (this.pswp.mainScroll.isShifted()) this.dragAxis = "x";
|
|
643
|
+
else {
|
|
644
|
+
let e = Math.abs(this.p1.x - this.startP1.x) - Math.abs(this.p1.y - this.startP1.y);
|
|
645
|
+
if (e !== 0) {
|
|
646
|
+
let t = e > 0 ? "x" : "y";
|
|
647
|
+
Math.abs(this.p1[t] - this.startP1[t]) >= N && (this.dragAxis = t);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
_convertEventPosToPoint(e, t) {
|
|
652
|
+
return t.x = e.pageX - this.pswp.offset.x, t.y = e.pageY - this.pswp.offset.y, "pointerId" in e ? t.id = e.pointerId : e.identifier !== void 0 && (t.id = e.identifier), t;
|
|
653
|
+
}
|
|
654
|
+
_onClick(e) {
|
|
655
|
+
this.pswp.mainScroll.isShifted() && (e.preventDefault(), e.stopPropagation());
|
|
656
|
+
}
|
|
657
|
+
}, L = .35, R = class {
|
|
658
|
+
constructor(e) {
|
|
659
|
+
this.pswp = e, this.x = 0, this.slideWidth = 0, this._currPositionIndex = 0, this._prevPositionIndex = 0, this._containerShiftIndex = -1, this.itemHolders = [];
|
|
660
|
+
}
|
|
661
|
+
resize(e) {
|
|
662
|
+
let { pswp: t } = this, n = Math.round(t.viewportSize.x + t.viewportSize.x * t.options.spacing), r = n !== this.slideWidth;
|
|
663
|
+
r && (this.slideWidth = n, this.moveTo(this.getCurrSlideX())), this.itemHolders.forEach((t, n) => {
|
|
664
|
+
r && s(t.el, (n + this._containerShiftIndex) * this.slideWidth), e && t.slide && t.slide.resize();
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
resetPosition() {
|
|
668
|
+
this._currPositionIndex = 0, this._prevPositionIndex = 0, this.slideWidth = 0, this._containerShiftIndex = -1;
|
|
669
|
+
}
|
|
670
|
+
appendHolders() {
|
|
671
|
+
this.itemHolders = [];
|
|
672
|
+
for (let t = 0; t < 3; t++) {
|
|
673
|
+
let n = e("pswp__item", "div", this.pswp.container);
|
|
674
|
+
n.setAttribute("role", "group"), n.setAttribute("aria-roledescription", "slide"), n.setAttribute("aria-hidden", "true"), n.style.display = t === 1 ? "block" : "none", this.itemHolders.push({ el: n });
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
canBeSwiped() {
|
|
678
|
+
return this.pswp.getNumItems() > 1;
|
|
679
|
+
}
|
|
680
|
+
moveIndexBy(e, t, n) {
|
|
681
|
+
let { pswp: r } = this, i = r.potentialIndex + e, a = r.getNumItems();
|
|
682
|
+
if (r.canLoop()) {
|
|
683
|
+
i = r.getLoopedIndex(i);
|
|
684
|
+
let t = (e + a) % a;
|
|
685
|
+
e = t <= a / 2 ? t : t - a;
|
|
686
|
+
} else i < 0 ? i = 0 : i >= a && (i = a - 1), e = i - r.potentialIndex;
|
|
687
|
+
r.potentialIndex = i, this._currPositionIndex -= e, r.animations.stopMainScroll();
|
|
688
|
+
let o = this.getCurrSlideX();
|
|
689
|
+
if (!t) this.moveTo(o), this.updateCurrItem();
|
|
690
|
+
else {
|
|
691
|
+
r.animations.startSpring({
|
|
692
|
+
isMainScroll: !0,
|
|
693
|
+
start: this.x,
|
|
694
|
+
end: o,
|
|
695
|
+
velocity: n || 0,
|
|
696
|
+
naturalFrequency: 30,
|
|
697
|
+
dampingRatio: 1,
|
|
698
|
+
onUpdate: (e) => {
|
|
699
|
+
this.moveTo(e);
|
|
700
|
+
},
|
|
701
|
+
onComplete: () => {
|
|
702
|
+
this.updateCurrItem(), r.appendHeavy();
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
let e = r.potentialIndex - r.currIndex;
|
|
706
|
+
if (r.canLoop()) {
|
|
707
|
+
let t = (e + a) % a;
|
|
708
|
+
e = t <= a / 2 ? t : t - a;
|
|
709
|
+
}
|
|
710
|
+
Math.abs(e) > 1 && this.updateCurrItem();
|
|
711
|
+
}
|
|
712
|
+
return !!e;
|
|
713
|
+
}
|
|
714
|
+
getCurrSlideX() {
|
|
715
|
+
return this.slideWidth * this._currPositionIndex;
|
|
716
|
+
}
|
|
717
|
+
isShifted() {
|
|
718
|
+
return this.x !== this.getCurrSlideX();
|
|
719
|
+
}
|
|
720
|
+
updateCurrItem() {
|
|
721
|
+
let { pswp: e } = this, t = this._prevPositionIndex - this._currPositionIndex;
|
|
722
|
+
if (!t) return;
|
|
723
|
+
this._prevPositionIndex = this._currPositionIndex, e.currIndex = e.potentialIndex;
|
|
724
|
+
let n = Math.abs(t), r;
|
|
725
|
+
n >= 3 && (this._containerShiftIndex += t + (t > 0 ? -3 : 3), n = 3, this.itemHolders.forEach((e) => {
|
|
726
|
+
var t;
|
|
727
|
+
(t = e.slide) == null || t.destroy(), e.slide = void 0;
|
|
728
|
+
}));
|
|
729
|
+
for (let i = 0; i < n; i++) t > 0 ? (r = this.itemHolders.shift(), r && (this.itemHolders[2] = r, this._containerShiftIndex++, s(r.el, (this._containerShiftIndex + 2) * this.slideWidth), e.setContent(r, e.currIndex - n + i + 2))) : (r = this.itemHolders.pop(), r && (this.itemHolders.unshift(r), this._containerShiftIndex--, s(r.el, this._containerShiftIndex * this.slideWidth), e.setContent(r, e.currIndex + n - i - 2)));
|
|
730
|
+
Math.abs(this._containerShiftIndex) > 50 && !this.isShifted() && (this.resetPosition(), this.resize()), e.animations.stopAllPan(), this.itemHolders.forEach((e, t) => {
|
|
731
|
+
e.slide && e.slide.setIsActive(t === 1);
|
|
732
|
+
}), e.currSlide = this.itemHolders[1]?.slide, e.contentLoader.updateLazy(t), e.currSlide && e.currSlide.applyCurrentZoomPan(), e.dispatch("change");
|
|
733
|
+
}
|
|
734
|
+
moveTo(e, t) {
|
|
735
|
+
if (!this.pswp.canLoop() && t) {
|
|
736
|
+
let t = (this.slideWidth * this._currPositionIndex - e) / this.slideWidth;
|
|
737
|
+
t += this.pswp.currIndex;
|
|
738
|
+
let n = Math.round(e - this.x);
|
|
739
|
+
(t < 0 && n > 0 || t >= this.pswp.getNumItems() - 1 && n < 0) && (e = this.x + n * L);
|
|
740
|
+
}
|
|
741
|
+
this.x = e, this.pswp.container && s(this.pswp.container, e), this.pswp.dispatch("moveMainScroll", {
|
|
742
|
+
x: e,
|
|
743
|
+
dragging: t ?? !1
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
}, z = {
|
|
747
|
+
Escape: 27,
|
|
748
|
+
z: 90,
|
|
749
|
+
ArrowLeft: 37,
|
|
750
|
+
ArrowUp: 38,
|
|
751
|
+
ArrowRight: 39,
|
|
752
|
+
ArrowDown: 40,
|
|
753
|
+
Tab: 9
|
|
754
|
+
}, B = (e, t) => t ? e : z[e], V = class {
|
|
755
|
+
constructor(e) {
|
|
756
|
+
this.pswp = e, this._wasFocused = !1, e.on("bindEvents", () => {
|
|
757
|
+
e.options.trapFocus && (e.options.initialPointerPos || this._focusRoot(), e.events.add(document, "focusin", this._onFocusIn.bind(this))), e.events.add(document, "keydown", this._onKeyDown.bind(this));
|
|
758
|
+
});
|
|
759
|
+
let t = document.activeElement;
|
|
760
|
+
e.on("destroy", () => {
|
|
761
|
+
e.options.returnFocus && t && this._wasFocused && t.focus();
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
_focusRoot() {
|
|
765
|
+
!this._wasFocused && this.pswp.element && (this.pswp.element.focus(), this._wasFocused = !0);
|
|
766
|
+
}
|
|
767
|
+
_onKeyDown(e) {
|
|
768
|
+
let { pswp: t } = this;
|
|
769
|
+
if (t.dispatch("keydown", { originalEvent: e }).defaultPrevented || m(e)) return;
|
|
770
|
+
let n, r, i = !1, a = "key" in e;
|
|
771
|
+
switch (a ? e.key : e.keyCode) {
|
|
772
|
+
case B("Escape", a):
|
|
773
|
+
t.options.escKey && (n = "close");
|
|
774
|
+
break;
|
|
775
|
+
case B("z", a):
|
|
776
|
+
n = "toggleZoom";
|
|
777
|
+
break;
|
|
778
|
+
case B("ArrowLeft", a):
|
|
779
|
+
r = "x";
|
|
780
|
+
break;
|
|
781
|
+
case B("ArrowUp", a):
|
|
782
|
+
r = "y";
|
|
783
|
+
break;
|
|
784
|
+
case B("ArrowRight", a):
|
|
785
|
+
r = "x", i = !0;
|
|
786
|
+
break;
|
|
787
|
+
case B("ArrowDown", a):
|
|
788
|
+
i = !0, r = "y";
|
|
789
|
+
break;
|
|
790
|
+
case B("Tab", a): this._focusRoot();
|
|
791
|
+
}
|
|
792
|
+
if (r) {
|
|
793
|
+
e.preventDefault();
|
|
794
|
+
let { currSlide: a } = t;
|
|
795
|
+
t.options.arrowKeys && r === "x" && t.getNumItems() > 1 ? n = i ? "next" : "prev" : a && a.currZoomLevel > a.zoomLevels.fit && (a.pan[r] += i ? -80 : 80, a.panTo(a.pan.x, a.pan.y));
|
|
796
|
+
}
|
|
797
|
+
n && (e.preventDefault(), t[n]());
|
|
798
|
+
}
|
|
799
|
+
_onFocusIn(e) {
|
|
800
|
+
let { template: t } = this.pswp;
|
|
801
|
+
t && document !== e.target && t !== e.target && !t.contains(e.target) && t.focus();
|
|
802
|
+
}
|
|
803
|
+
}, H = "cubic-bezier(.4,0,.22,1)", U = class {
|
|
804
|
+
constructor(e) {
|
|
805
|
+
this.props = e;
|
|
806
|
+
let { target: t, onComplete: n, transform: r, onFinish: i = () => {}, duration: a = 333, easing: o = H } = e;
|
|
807
|
+
this.onFinish = i;
|
|
808
|
+
let s = r ? "transform" : "opacity", c = e[s] ?? "";
|
|
809
|
+
this._target = t, this._onComplete = n, this._finished = !1, this._onTransitionEnd = this._onTransitionEnd.bind(this), this._helperTimeout = setTimeout(() => {
|
|
810
|
+
l(t, s, a, o), this._helperTimeout = setTimeout(() => {
|
|
811
|
+
t.addEventListener("transitionend", this._onTransitionEnd, !1), t.addEventListener("transitioncancel", this._onTransitionEnd, !1), this._helperTimeout = setTimeout(() => {
|
|
812
|
+
this._finalizeAnimation();
|
|
813
|
+
}, a + 500), t.style[s] = c;
|
|
814
|
+
}, 30);
|
|
815
|
+
}, 0);
|
|
816
|
+
}
|
|
817
|
+
_onTransitionEnd(e) {
|
|
818
|
+
e.target === this._target && this._finalizeAnimation();
|
|
819
|
+
}
|
|
820
|
+
_finalizeAnimation() {
|
|
821
|
+
this._finished || (this._finished = !0, this.onFinish(), this._onComplete && this._onComplete());
|
|
822
|
+
}
|
|
823
|
+
destroy() {
|
|
824
|
+
this._helperTimeout && clearTimeout(this._helperTimeout), d(this._target), this._target.removeEventListener("transitionend", this._onTransitionEnd, !1), this._target.removeEventListener("transitioncancel", this._onTransitionEnd, !1), this._finished || this._finalizeAnimation();
|
|
825
|
+
}
|
|
826
|
+
}, W = 12, G = .75, K = class {
|
|
827
|
+
constructor(e, t, n) {
|
|
828
|
+
this.velocity = e * 1e3, this._dampingRatio = t || G, this._naturalFrequency = n || W, this._dampedFrequency = this._naturalFrequency, this._dampingRatio < 1 && (this._dampedFrequency *= Math.sqrt(1 - this._dampingRatio * this._dampingRatio));
|
|
829
|
+
}
|
|
830
|
+
easeFrame(e, t) {
|
|
831
|
+
let n = 0, r;
|
|
832
|
+
t /= 1e3;
|
|
833
|
+
let i = Math.E ** (-this._dampingRatio * this._naturalFrequency * t);
|
|
834
|
+
if (this._dampingRatio === 1) r = this.velocity + this._naturalFrequency * e, n = (e + r * t) * i, this.velocity = n * -this._naturalFrequency + r * i;
|
|
835
|
+
else if (this._dampingRatio < 1) {
|
|
836
|
+
r = 1 / this._dampedFrequency * (this._dampingRatio * this._naturalFrequency * e + this.velocity);
|
|
837
|
+
let a = Math.cos(this._dampedFrequency * t), o = Math.sin(this._dampedFrequency * t);
|
|
838
|
+
n = i * (e * a + r * o), this.velocity = n * -this._naturalFrequency * this._dampingRatio + i * (-this._dampedFrequency * e * o + this._dampedFrequency * r * a);
|
|
839
|
+
}
|
|
840
|
+
return n;
|
|
841
|
+
}
|
|
842
|
+
}, q = class {
|
|
843
|
+
constructor(e) {
|
|
844
|
+
this.props = e, this._raf = 0;
|
|
845
|
+
let { start: t, end: n, velocity: r, onUpdate: i, onComplete: a, onFinish: o = () => {}, dampingRatio: s, naturalFrequency: c } = e;
|
|
846
|
+
this.onFinish = o;
|
|
847
|
+
let l = new K(r, s, c), u = Date.now(), d = t - n, f = () => {
|
|
848
|
+
this._raf && (d = l.easeFrame(d, Date.now() - u), Math.abs(d) < 1 && Math.abs(l.velocity) < 50 ? (i(n), a && a(), this.onFinish()) : (u = Date.now(), i(d + n), this._raf = requestAnimationFrame(f)));
|
|
849
|
+
};
|
|
850
|
+
this._raf = requestAnimationFrame(f);
|
|
851
|
+
}
|
|
852
|
+
destroy() {
|
|
853
|
+
this._raf >= 0 && cancelAnimationFrame(this._raf), this._raf = 0;
|
|
854
|
+
}
|
|
855
|
+
}, ae = class {
|
|
856
|
+
constructor() {
|
|
857
|
+
this.activeAnimations = [];
|
|
858
|
+
}
|
|
859
|
+
startSpring(e) {
|
|
860
|
+
this._start(e, !0);
|
|
861
|
+
}
|
|
862
|
+
startTransition(e) {
|
|
863
|
+
this._start(e);
|
|
864
|
+
}
|
|
865
|
+
_start(e, t) {
|
|
866
|
+
let n = t ? new q(e) : new U(e);
|
|
867
|
+
return this.activeAnimations.push(n), n.onFinish = () => this.stop(n), n;
|
|
868
|
+
}
|
|
869
|
+
stop(e) {
|
|
870
|
+
e.destroy();
|
|
871
|
+
let t = this.activeAnimations.indexOf(e);
|
|
872
|
+
t > -1 && this.activeAnimations.splice(t, 1);
|
|
873
|
+
}
|
|
874
|
+
stopAll() {
|
|
875
|
+
this.activeAnimations.forEach((e) => {
|
|
876
|
+
e.destroy();
|
|
877
|
+
}), this.activeAnimations = [];
|
|
878
|
+
}
|
|
879
|
+
stopAllPan() {
|
|
880
|
+
this.activeAnimations = this.activeAnimations.filter((e) => !e.props.isPan || (e.destroy(), !1));
|
|
881
|
+
}
|
|
882
|
+
stopMainScroll() {
|
|
883
|
+
this.activeAnimations = this.activeAnimations.filter((e) => !e.props.isMainScroll || (e.destroy(), !1));
|
|
884
|
+
}
|
|
885
|
+
isPanRunning() {
|
|
886
|
+
return this.activeAnimations.some((e) => e.props.isPan);
|
|
887
|
+
}
|
|
888
|
+
}, J = class {
|
|
889
|
+
constructor(e) {
|
|
890
|
+
this.pswp = e, e.events.add(e.element, "wheel", this._onWheel.bind(this));
|
|
891
|
+
}
|
|
892
|
+
_onWheel(e) {
|
|
893
|
+
e.preventDefault();
|
|
894
|
+
let { currSlide: t } = this.pswp, { deltaX: n, deltaY: r } = e;
|
|
895
|
+
if (t && !this.pswp.dispatch("wheel", { originalEvent: e }).defaultPrevented) if (e.ctrlKey || this.pswp.options.wheelToZoom) {
|
|
896
|
+
if (t.isZoomable()) {
|
|
897
|
+
let n = -r;
|
|
898
|
+
e.deltaMode === 1 ? n *= .05 : n *= e.deltaMode ? 1 : .002, n = 2 ** n;
|
|
899
|
+
let i = t.currZoomLevel * n;
|
|
900
|
+
t.zoomTo(i, {
|
|
901
|
+
x: e.clientX,
|
|
902
|
+
y: e.clientY
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
} else t.isPannable() && (e.deltaMode === 1 && (n *= 18, r *= 18), t.panTo(t.pan.x - n, t.pan.y - r));
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
|
+
function oe(e) {
|
|
909
|
+
if (typeof e == "string") return e;
|
|
910
|
+
if (!e || !e.isCustomSVG) return "";
|
|
911
|
+
let t = e, n = "<svg aria-hidden=\"true\" class=\"pswp__icn\" viewBox=\"0 0 %d %d\" width=\"%d\" height=\"%d\">";
|
|
912
|
+
return n = n.split("%d").join(t.size || 32), t.outlineID && (n += "<use class=\"pswp__icn-shadow\" xlink:href=\"#" + t.outlineID + "\"/>"), n += t.inner, n += "</svg>", n;
|
|
913
|
+
}
|
|
914
|
+
var se = class {
|
|
915
|
+
constructor(t, n) {
|
|
916
|
+
var r;
|
|
917
|
+
let i = n.name || n.className, a = n.html;
|
|
918
|
+
if (t.options[i] === !1) return;
|
|
919
|
+
typeof t.options[i + "SVG"] == "string" && (a = t.options[i + "SVG"]), t.dispatch("uiElementCreate", { data: n });
|
|
920
|
+
let o = "";
|
|
921
|
+
n.isButton ? (o += "pswp__button ", o += n.className || `pswp__button--${n.name}`) : o += n.className || `pswp__${n.name}`;
|
|
922
|
+
let s = n.isButton ? n.tagName || "button" : n.tagName || "div";
|
|
923
|
+
s = s.toLowerCase();
|
|
924
|
+
let c = e(o, s);
|
|
925
|
+
if (n.isButton) {
|
|
926
|
+
s === "button" && (c.type = "button");
|
|
927
|
+
let { title: e } = n, { ariaLabel: r } = n;
|
|
928
|
+
typeof t.options[i + "Title"] == "string" && (e = t.options[i + "Title"]), e && (c.title = e);
|
|
929
|
+
let a = r || e;
|
|
930
|
+
a && c.setAttribute("aria-label", a);
|
|
931
|
+
}
|
|
932
|
+
c.innerHTML = oe(a), n.onInit && n.onInit(c, t), n.onClick && (c.onclick = (e) => {
|
|
933
|
+
typeof n.onClick == "string" ? t[n.onClick]() : typeof n.onClick == "function" && n.onClick(e, c, t);
|
|
934
|
+
});
|
|
935
|
+
let l = n.appendTo || "bar", u = t.element;
|
|
936
|
+
l === "bar" ? (t.topBar ||= e("pswp__top-bar pswp__hide-on-close", "div", t.scrollWrap), u = t.topBar) : (c.classList.add("pswp__hide-on-close"), l === "wrapper" && (u = t.scrollWrap)), (r = u) == null || r.appendChild(t.applyFilters("uiElement", c, n));
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
function Y(e, t, n) {
|
|
940
|
+
e.classList.add("pswp__button--arrow"), e.setAttribute("aria-controls", "pswp__items"), t.on("change", () => {
|
|
941
|
+
t.options.loop || (e.disabled = n ? !(t.currIndex < t.getNumItems() - 1) : !(t.currIndex > 0));
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
var ce = {
|
|
945
|
+
name: "arrowPrev",
|
|
946
|
+
className: "pswp__button--arrow--prev",
|
|
947
|
+
title: "Previous",
|
|
948
|
+
order: 10,
|
|
949
|
+
isButton: !0,
|
|
950
|
+
appendTo: "wrapper",
|
|
951
|
+
html: {
|
|
952
|
+
isCustomSVG: !0,
|
|
953
|
+
size: 60,
|
|
954
|
+
inner: "<path d=\"M29 43l-3 3-16-16 16-16 3 3-13 13 13 13z\" id=\"pswp__icn-arrow\"/>",
|
|
955
|
+
outlineID: "pswp__icn-arrow"
|
|
956
|
+
},
|
|
957
|
+
onClick: "prev",
|
|
958
|
+
onInit: Y
|
|
959
|
+
}, le = {
|
|
960
|
+
name: "arrowNext",
|
|
961
|
+
className: "pswp__button--arrow--next",
|
|
962
|
+
title: "Next",
|
|
963
|
+
order: 11,
|
|
964
|
+
isButton: !0,
|
|
965
|
+
appendTo: "wrapper",
|
|
966
|
+
html: {
|
|
967
|
+
isCustomSVG: !0,
|
|
968
|
+
size: 60,
|
|
969
|
+
inner: "<use xlink:href=\"#pswp__icn-arrow\"/>",
|
|
970
|
+
outlineID: "pswp__icn-arrow"
|
|
971
|
+
},
|
|
972
|
+
onClick: "next",
|
|
973
|
+
onInit: (e, t) => {
|
|
974
|
+
Y(e, t, !0);
|
|
975
|
+
}
|
|
976
|
+
}, ue = {
|
|
977
|
+
name: "close",
|
|
978
|
+
title: "Close",
|
|
979
|
+
order: 20,
|
|
980
|
+
isButton: !0,
|
|
981
|
+
html: {
|
|
982
|
+
isCustomSVG: !0,
|
|
983
|
+
inner: "<path d=\"M24 10l-2-2-6 6-6-6-2 2 6 6-6 6 2 2 6-6 6 6 2-2-6-6z\" id=\"pswp__icn-close\"/>",
|
|
984
|
+
outlineID: "pswp__icn-close"
|
|
985
|
+
},
|
|
986
|
+
onClick: "close"
|
|
987
|
+
}, de = {
|
|
988
|
+
name: "zoom",
|
|
989
|
+
title: "Zoom",
|
|
990
|
+
order: 10,
|
|
991
|
+
isButton: !0,
|
|
992
|
+
html: {
|
|
993
|
+
isCustomSVG: !0,
|
|
994
|
+
inner: "<path d=\"M17.426 19.926a6 6 0 1 1 1.5-1.5L23 22.5 21.5 24l-4.074-4.074z\" id=\"pswp__icn-zoom\"/><path fill=\"currentColor\" class=\"pswp__zoom-icn-bar-h\" d=\"M11 16v-2h6v2z\"/><path fill=\"currentColor\" class=\"pswp__zoom-icn-bar-v\" d=\"M13 12h2v6h-2z\"/>",
|
|
995
|
+
outlineID: "pswp__icn-zoom"
|
|
996
|
+
},
|
|
997
|
+
onClick: "toggleZoom"
|
|
998
|
+
}, fe = {
|
|
999
|
+
name: "preloader",
|
|
1000
|
+
appendTo: "bar",
|
|
1001
|
+
order: 7,
|
|
1002
|
+
html: {
|
|
1003
|
+
isCustomSVG: !0,
|
|
1004
|
+
inner: "<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M21.2 16a5.2 5.2 0 1 1-5.2-5.2V8a8 8 0 1 0 8 8h-2.8Z\" id=\"pswp__icn-loading\"/>",
|
|
1005
|
+
outlineID: "pswp__icn-loading"
|
|
1006
|
+
},
|
|
1007
|
+
onInit: (e, t) => {
|
|
1008
|
+
let n, r = null, i = (t, n) => {
|
|
1009
|
+
e.classList.toggle("pswp__preloader--" + t, n);
|
|
1010
|
+
}, a = (e) => {
|
|
1011
|
+
n !== e && (n = e, i("active", e));
|
|
1012
|
+
}, o = () => {
|
|
1013
|
+
var e;
|
|
1014
|
+
if (!((e = t.currSlide) != null && e.content.isLoading())) {
|
|
1015
|
+
a(!1), r &&= (clearTimeout(r), null);
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
1018
|
+
r ||= setTimeout(() => {
|
|
1019
|
+
a(!!t.currSlide?.content.isLoading()), r = null;
|
|
1020
|
+
}, t.options.preloaderDelay);
|
|
1021
|
+
};
|
|
1022
|
+
t.on("change", o), t.on("loadComplete", (e) => {
|
|
1023
|
+
t.currSlide === e.slide && o();
|
|
1024
|
+
}), t.ui && (t.ui.updatePreloaderVisibility = o);
|
|
1025
|
+
}
|
|
1026
|
+
}, pe = {
|
|
1027
|
+
name: "counter",
|
|
1028
|
+
order: 5,
|
|
1029
|
+
onInit: (e, t) => {
|
|
1030
|
+
t.on("change", () => {
|
|
1031
|
+
e.innerText = t.currIndex + 1 + t.options.indexIndicatorSep + t.getNumItems();
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
};
|
|
1035
|
+
function X(e, t) {
|
|
1036
|
+
e.classList.toggle("pswp--zoomed-in", t);
|
|
1037
|
+
}
|
|
1038
|
+
var me = class {
|
|
1039
|
+
constructor(e) {
|
|
1040
|
+
this.pswp = e, this.isRegistered = !1, this.uiElementsData = [], this.items = [], this.updatePreloaderVisibility = () => {}, this._lastUpdatedZoomLevel = void 0;
|
|
1041
|
+
}
|
|
1042
|
+
init() {
|
|
1043
|
+
let { pswp: e } = this;
|
|
1044
|
+
this.isRegistered = !1, this.uiElementsData = [
|
|
1045
|
+
ue,
|
|
1046
|
+
ce,
|
|
1047
|
+
le,
|
|
1048
|
+
de,
|
|
1049
|
+
fe,
|
|
1050
|
+
pe
|
|
1051
|
+
], e.dispatch("uiRegister"), this.uiElementsData.sort((e, t) => (e.order || 0) - (t.order || 0)), this.items = [], this.isRegistered = !0, this.uiElementsData.forEach((e) => {
|
|
1052
|
+
this.registerElement(e);
|
|
1053
|
+
}), e.on("change", () => {
|
|
1054
|
+
var t;
|
|
1055
|
+
(t = e.element) == null || t.classList.toggle("pswp--one-slide", e.getNumItems() === 1);
|
|
1056
|
+
}), e.on("zoomPanUpdate", () => this._onZoomPanUpdate());
|
|
1057
|
+
}
|
|
1058
|
+
registerElement(e) {
|
|
1059
|
+
this.isRegistered ? this.items.push(new se(this.pswp, e)) : this.uiElementsData.push(e);
|
|
1060
|
+
}
|
|
1061
|
+
_onZoomPanUpdate() {
|
|
1062
|
+
let { template: e, currSlide: t, options: n } = this.pswp;
|
|
1063
|
+
if (this.pswp.opener.isClosing || !e || !t) return;
|
|
1064
|
+
let { currZoomLevel: r } = t;
|
|
1065
|
+
if (this.pswp.opener.isOpen || (r = t.zoomLevels.initial), r === this._lastUpdatedZoomLevel) return;
|
|
1066
|
+
this._lastUpdatedZoomLevel = r;
|
|
1067
|
+
let i = t.zoomLevels.initial - t.zoomLevels.secondary;
|
|
1068
|
+
if (Math.abs(i) < .01 || !t.isZoomable()) {
|
|
1069
|
+
X(e, !1), e.classList.remove("pswp--zoom-allowed");
|
|
1070
|
+
return;
|
|
1071
|
+
}
|
|
1072
|
+
e.classList.add("pswp--zoom-allowed"), X(e, (r === t.zoomLevels.initial ? t.zoomLevels.secondary : t.zoomLevels.initial) <= r), (n.imageClickAction === "zoom" || n.imageClickAction === "zoom-or-close") && e.classList.add("pswp--click-to-zoom");
|
|
1073
|
+
}
|
|
1074
|
+
};
|
|
1075
|
+
function he(e) {
|
|
1076
|
+
let t = e.getBoundingClientRect();
|
|
1077
|
+
return {
|
|
1078
|
+
x: t.left,
|
|
1079
|
+
y: t.top,
|
|
1080
|
+
w: t.width
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
function ge(e, t, n) {
|
|
1084
|
+
let r = e.getBoundingClientRect(), i = r.width / t, a = r.height / n, o = i > a ? i : a, s = (r.width - t * o) / 2, c = (r.height - n * o) / 2, l = {
|
|
1085
|
+
x: r.left + s,
|
|
1086
|
+
y: r.top + c,
|
|
1087
|
+
w: t * o
|
|
1088
|
+
};
|
|
1089
|
+
return l.innerRect = {
|
|
1090
|
+
w: r.width,
|
|
1091
|
+
h: r.height,
|
|
1092
|
+
x: s,
|
|
1093
|
+
y: c
|
|
1094
|
+
}, l;
|
|
1095
|
+
}
|
|
1096
|
+
function _e(e, t, n) {
|
|
1097
|
+
let r = n.dispatch("thumbBounds", {
|
|
1098
|
+
index: e,
|
|
1099
|
+
itemData: t,
|
|
1100
|
+
instance: n
|
|
1101
|
+
});
|
|
1102
|
+
if (r.thumbBounds) return r.thumbBounds;
|
|
1103
|
+
let { element: i } = t, a, o;
|
|
1104
|
+
if (i && n.options.thumbSelector !== !1) {
|
|
1105
|
+
let e = n.options.thumbSelector || "img";
|
|
1106
|
+
o = i.matches(e) ? i : i.querySelector(e);
|
|
1107
|
+
}
|
|
1108
|
+
return o = n.applyFilters("thumbEl", o, t, e), o && (a = t.thumbCropped ? ge(o, t.width || t.w || 0, t.height || t.h || 0) : he(o)), n.applyFilters("thumbBounds", a, t, e);
|
|
1109
|
+
}
|
|
1110
|
+
var ve = class {
|
|
1111
|
+
constructor(e, t) {
|
|
1112
|
+
this.type = e, this.defaultPrevented = !1, t && Object.assign(this, t);
|
|
1113
|
+
}
|
|
1114
|
+
preventDefault() {
|
|
1115
|
+
this.defaultPrevented = !0;
|
|
1116
|
+
}
|
|
1117
|
+
}, ye = class {
|
|
1118
|
+
constructor() {
|
|
1119
|
+
this._listeners = {}, this._filters = {}, this.pswp = void 0, this.options = void 0;
|
|
1120
|
+
}
|
|
1121
|
+
addFilter(e, t, n = 100) {
|
|
1122
|
+
var r, i, a;
|
|
1123
|
+
this._filters[e] || (this._filters[e] = []), (r = this._filters[e]) == null || r.push({
|
|
1124
|
+
fn: t,
|
|
1125
|
+
priority: n
|
|
1126
|
+
}), (i = this._filters[e]) == null || i.sort((e, t) => e.priority - t.priority), (a = this.pswp) == null || a.addFilter(e, t, n);
|
|
1127
|
+
}
|
|
1128
|
+
removeFilter(e, t) {
|
|
1129
|
+
this._filters[e] && (this._filters[e] = this._filters[e].filter((e) => e.fn !== t)), this.pswp && this.pswp.removeFilter(e, t);
|
|
1130
|
+
}
|
|
1131
|
+
applyFilters(e, ...t) {
|
|
1132
|
+
var n;
|
|
1133
|
+
return (n = this._filters[e]) == null || n.forEach((e) => {
|
|
1134
|
+
t[0] = e.fn.apply(this, t);
|
|
1135
|
+
}), t[0];
|
|
1136
|
+
}
|
|
1137
|
+
on(e, t) {
|
|
1138
|
+
var n, r;
|
|
1139
|
+
this._listeners[e] || (this._listeners[e] = []), (n = this._listeners[e]) == null || n.push(t), (r = this.pswp) == null || r.on(e, t);
|
|
1140
|
+
}
|
|
1141
|
+
off(e, t) {
|
|
1142
|
+
var n;
|
|
1143
|
+
this._listeners[e] && (this._listeners[e] = this._listeners[e].filter((e) => t !== e)), (n = this.pswp) == null || n.off(e, t);
|
|
1144
|
+
}
|
|
1145
|
+
dispatch(e, t) {
|
|
1146
|
+
var n;
|
|
1147
|
+
if (this.pswp) return this.pswp.dispatch(e, t);
|
|
1148
|
+
let r = new ve(e, t);
|
|
1149
|
+
return (n = this._listeners[e]) == null || n.forEach((e) => {
|
|
1150
|
+
e.call(this, r);
|
|
1151
|
+
}), r;
|
|
1152
|
+
}
|
|
1153
|
+
}, be = class {
|
|
1154
|
+
constructor(t, n) {
|
|
1155
|
+
if (this.element = e("pswp__img pswp__img--placeholder", t ? "img" : "div", n), t) {
|
|
1156
|
+
let e = this.element;
|
|
1157
|
+
e.decoding = "async", e.alt = "", e.src = t, e.setAttribute("role", "presentation");
|
|
1158
|
+
}
|
|
1159
|
+
this.element.setAttribute("aria-hidden", "true");
|
|
1160
|
+
}
|
|
1161
|
+
setDisplayedSize(e, t) {
|
|
1162
|
+
this.element && (this.element.tagName === "IMG" ? (u(this.element, 250, "auto"), this.element.style.transformOrigin = "0 0", this.element.style.transform = o(0, 0, e / 250)) : u(this.element, e, t));
|
|
1163
|
+
}
|
|
1164
|
+
destroy() {
|
|
1165
|
+
var e;
|
|
1166
|
+
(e = this.element) != null && e.parentNode && this.element.remove(), this.element = null;
|
|
1167
|
+
}
|
|
1168
|
+
}, xe = class {
|
|
1169
|
+
constructor(e, t, n) {
|
|
1170
|
+
this.instance = t, this.data = e, this.index = n, this.element = void 0, this.placeholder = void 0, this.slide = void 0, this.displayedImageWidth = 0, this.displayedImageHeight = 0, this.width = Number(this.data.w) || Number(this.data.width) || 0, this.height = Number(this.data.h) || Number(this.data.height) || 0, this.isAttached = !1, this.hasSlide = !1, this.isDecoding = !1, this.state = p.IDLE, this.type = this.data.type ? this.data.type : this.data.src ? "image" : "html", this.instance.dispatch("contentInit", { content: this });
|
|
1171
|
+
}
|
|
1172
|
+
removePlaceholder() {
|
|
1173
|
+
this.placeholder && !this.keepPlaceholder() && setTimeout(() => {
|
|
1174
|
+
this.placeholder &&= (this.placeholder.destroy(), void 0);
|
|
1175
|
+
}, 1e3);
|
|
1176
|
+
}
|
|
1177
|
+
load(t, n) {
|
|
1178
|
+
if (this.slide && this.usePlaceholder()) if (this.placeholder) {
|
|
1179
|
+
let e = this.placeholder.element;
|
|
1180
|
+
e && !e.parentElement && this.slide.container.prepend(e);
|
|
1181
|
+
} else {
|
|
1182
|
+
let e = this.instance.applyFilters("placeholderSrc", this.data.msrc && this.slide.isFirstSlide ? this.data.msrc : !1, this);
|
|
1183
|
+
this.placeholder = new be(e, this.slide.container);
|
|
1184
|
+
}
|
|
1185
|
+
this.element && !n || this.instance.dispatch("contentLoad", {
|
|
1186
|
+
content: this,
|
|
1187
|
+
isLazy: t
|
|
1188
|
+
}).defaultPrevented || (this.isImageContent() ? (this.element = e("pswp__img", "img"), this.displayedImageWidth && this.loadImage(t)) : (this.element = e("pswp__content", "div"), this.element.innerHTML = this.data.html || ""), n && this.slide && this.slide.updateContentSize(!0));
|
|
1189
|
+
}
|
|
1190
|
+
loadImage(e) {
|
|
1191
|
+
if (!this.isImageContent() || !this.element || this.instance.dispatch("contentLoadImage", {
|
|
1192
|
+
content: this,
|
|
1193
|
+
isLazy: e
|
|
1194
|
+
}).defaultPrevented) return;
|
|
1195
|
+
let t = this.element;
|
|
1196
|
+
this.updateSrcsetSizes(), this.data.srcset && (t.srcset = this.data.srcset), t.src = this.data.src ?? "", t.alt = this.data.alt ?? "", this.state = p.LOADING, t.complete ? this.onLoaded() : (t.onload = () => {
|
|
1197
|
+
this.onLoaded();
|
|
1198
|
+
}, t.onerror = () => {
|
|
1199
|
+
this.onError();
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
setSlide(e) {
|
|
1203
|
+
this.slide = e, this.hasSlide = !0, this.instance = e.pswp;
|
|
1204
|
+
}
|
|
1205
|
+
onLoaded() {
|
|
1206
|
+
this.state = p.LOADED, this.slide && this.element && (this.instance.dispatch("loadComplete", {
|
|
1207
|
+
slide: this.slide,
|
|
1208
|
+
content: this
|
|
1209
|
+
}), this.slide.isActive && this.slide.heavyAppended && !this.element.parentNode && (this.append(), this.slide.updateContentSize(!0)), (this.state === p.LOADED || this.state === p.ERROR) && this.removePlaceholder());
|
|
1210
|
+
}
|
|
1211
|
+
onError() {
|
|
1212
|
+
this.state = p.ERROR, this.slide && (this.displayError(), this.instance.dispatch("loadComplete", {
|
|
1213
|
+
slide: this.slide,
|
|
1214
|
+
isError: !0,
|
|
1215
|
+
content: this
|
|
1216
|
+
}), this.instance.dispatch("loadError", {
|
|
1217
|
+
slide: this.slide,
|
|
1218
|
+
content: this
|
|
1219
|
+
}));
|
|
1220
|
+
}
|
|
1221
|
+
isLoading() {
|
|
1222
|
+
return this.instance.applyFilters("isContentLoading", this.state === p.LOADING, this);
|
|
1223
|
+
}
|
|
1224
|
+
isError() {
|
|
1225
|
+
return this.state === p.ERROR;
|
|
1226
|
+
}
|
|
1227
|
+
isImageContent() {
|
|
1228
|
+
return this.type === "image";
|
|
1229
|
+
}
|
|
1230
|
+
setDisplayedSize(e, t) {
|
|
1231
|
+
if (this.element && (this.placeholder && this.placeholder.setDisplayedSize(e, t), !this.instance.dispatch("contentResize", {
|
|
1232
|
+
content: this,
|
|
1233
|
+
width: e,
|
|
1234
|
+
height: t
|
|
1235
|
+
}).defaultPrevented && (u(this.element, e, t), this.isImageContent() && !this.isError()))) {
|
|
1236
|
+
let n = !this.displayedImageWidth && e;
|
|
1237
|
+
this.displayedImageWidth = e, this.displayedImageHeight = t, n ? this.loadImage(!1) : this.updateSrcsetSizes(), this.slide && this.instance.dispatch("imageSizeChange", {
|
|
1238
|
+
slide: this.slide,
|
|
1239
|
+
width: e,
|
|
1240
|
+
height: t,
|
|
1241
|
+
content: this
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
isZoomable() {
|
|
1246
|
+
return this.instance.applyFilters("isContentZoomable", this.isImageContent() && this.state !== p.ERROR, this);
|
|
1247
|
+
}
|
|
1248
|
+
updateSrcsetSizes() {
|
|
1249
|
+
if (!this.isImageContent() || !this.element || !this.data.srcset) return;
|
|
1250
|
+
let e = this.element, t = this.instance.applyFilters("srcsetSizesWidth", this.displayedImageWidth, this);
|
|
1251
|
+
(!e.dataset.largestUsedSize || t > parseInt(e.dataset.largestUsedSize, 10)) && (e.sizes = t + "px", e.dataset.largestUsedSize = String(t));
|
|
1252
|
+
}
|
|
1253
|
+
usePlaceholder() {
|
|
1254
|
+
return this.instance.applyFilters("useContentPlaceholder", this.isImageContent(), this);
|
|
1255
|
+
}
|
|
1256
|
+
lazyLoad() {
|
|
1257
|
+
this.instance.dispatch("contentLazyLoad", { content: this }).defaultPrevented || this.load(!0);
|
|
1258
|
+
}
|
|
1259
|
+
keepPlaceholder() {
|
|
1260
|
+
return this.instance.applyFilters("isKeepingPlaceholder", this.isLoading(), this);
|
|
1261
|
+
}
|
|
1262
|
+
destroy() {
|
|
1263
|
+
this.hasSlide = !1, this.slide = void 0, !this.instance.dispatch("contentDestroy", { content: this }).defaultPrevented && (this.remove(), this.placeholder &&= (this.placeholder.destroy(), void 0), this.isImageContent() && this.element && (this.element.onload = null, this.element.onerror = null, this.element = void 0));
|
|
1264
|
+
}
|
|
1265
|
+
displayError() {
|
|
1266
|
+
if (this.slide) {
|
|
1267
|
+
let t = e("pswp__error-msg", "div");
|
|
1268
|
+
t.innerText = this.instance.options?.errorMsg ?? "", t = this.instance.applyFilters("contentErrorElement", t, this), this.element = e("pswp__content pswp__error-msg-container", "div"), this.element.appendChild(t), this.slide.container.innerText = "", this.slide.container.appendChild(this.element), this.slide.updateContentSize(!0), this.removePlaceholder();
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
append() {
|
|
1272
|
+
if (this.isAttached || !this.element) return;
|
|
1273
|
+
if (this.isAttached = !0, this.state === p.ERROR) {
|
|
1274
|
+
this.displayError();
|
|
1275
|
+
return;
|
|
1276
|
+
}
|
|
1277
|
+
if (this.instance.dispatch("contentAppend", { content: this }).defaultPrevented) return;
|
|
1278
|
+
let e = "decode" in this.element;
|
|
1279
|
+
this.isImageContent() ? e && this.slide && (!this.slide.isActive || h()) ? (this.isDecoding = !0, this.element.decode().catch(() => {}).finally(() => {
|
|
1280
|
+
this.isDecoding = !1, this.appendImage();
|
|
1281
|
+
})) : this.appendImage() : this.slide && !this.element.parentNode && this.slide.container.appendChild(this.element);
|
|
1282
|
+
}
|
|
1283
|
+
activate() {
|
|
1284
|
+
this.instance.dispatch("contentActivate", { content: this }).defaultPrevented || !this.slide || (this.isImageContent() && this.isDecoding && !h() ? this.appendImage() : this.isError() && this.load(!1, !0), this.slide.holderElement && this.slide.holderElement.setAttribute("aria-hidden", "false"));
|
|
1285
|
+
}
|
|
1286
|
+
deactivate() {
|
|
1287
|
+
this.instance.dispatch("contentDeactivate", { content: this }), this.slide && this.slide.holderElement && this.slide.holderElement.setAttribute("aria-hidden", "true");
|
|
1288
|
+
}
|
|
1289
|
+
remove() {
|
|
1290
|
+
this.isAttached = !1, !this.instance.dispatch("contentRemove", { content: this }).defaultPrevented && (this.element && this.element.parentNode && this.element.remove(), this.placeholder && this.placeholder.element && this.placeholder.element.remove());
|
|
1291
|
+
}
|
|
1292
|
+
appendImage() {
|
|
1293
|
+
this.isAttached && (this.instance.dispatch("contentAppendImage", { content: this }).defaultPrevented || (this.slide && this.element && !this.element.parentNode && this.slide.container.appendChild(this.element), (this.state === p.LOADED || this.state === p.ERROR) && this.removePlaceholder()));
|
|
1294
|
+
}
|
|
1295
|
+
}, Se = 5;
|
|
1296
|
+
function Z(e, t, n) {
|
|
1297
|
+
let r = t.createContentFromData(e, n), i, { options: a } = t;
|
|
1298
|
+
if (a) {
|
|
1299
|
+
i = new C(a, e, -1);
|
|
1300
|
+
let o;
|
|
1301
|
+
o = t.pswp ? t.pswp.viewportSize : v(a, t);
|
|
1302
|
+
let s = b(a, o, e, n);
|
|
1303
|
+
i.update(r.width, r.height, s);
|
|
1304
|
+
}
|
|
1305
|
+
return r.lazyLoad(), i && r.setDisplayedSize(Math.ceil(r.width * i.initial), Math.ceil(r.height * i.initial)), r;
|
|
1306
|
+
}
|
|
1307
|
+
function Ce(e, t) {
|
|
1308
|
+
let n = t.getItemData(e);
|
|
1309
|
+
if (!t.dispatch("lazyLoadSlide", {
|
|
1310
|
+
index: e,
|
|
1311
|
+
itemData: n
|
|
1312
|
+
}).defaultPrevented) return Z(n, t, e);
|
|
1313
|
+
}
|
|
1314
|
+
var we = class {
|
|
1315
|
+
constructor(e) {
|
|
1316
|
+
this.pswp = e, this.limit = Math.max(e.options.preload[0] + e.options.preload[1] + 1, Se), this._cachedItems = [];
|
|
1317
|
+
}
|
|
1318
|
+
updateLazy(e) {
|
|
1319
|
+
let { pswp: t } = this;
|
|
1320
|
+
if (t.dispatch("lazyLoad").defaultPrevented) return;
|
|
1321
|
+
let { preload: n } = t.options, r = e === void 0 || e >= 0, i;
|
|
1322
|
+
for (i = 0; i <= n[1]; i++) this.loadSlideByIndex(t.currIndex + (r ? i : -i));
|
|
1323
|
+
for (i = 1; i <= n[0]; i++) this.loadSlideByIndex(t.currIndex + (r ? -i : i));
|
|
1324
|
+
}
|
|
1325
|
+
loadSlideByIndex(e) {
|
|
1326
|
+
let t = this.pswp.getLoopedIndex(e), n = this.getContentByIndex(t);
|
|
1327
|
+
n || (n = Ce(t, this.pswp), n && this.addToCache(n));
|
|
1328
|
+
}
|
|
1329
|
+
getContentBySlide(e) {
|
|
1330
|
+
let t = this.getContentByIndex(e.index);
|
|
1331
|
+
return t || (t = this.pswp.createContentFromData(e.data, e.index), this.addToCache(t)), t.setSlide(e), t;
|
|
1332
|
+
}
|
|
1333
|
+
addToCache(e) {
|
|
1334
|
+
if (this.removeByIndex(e.index), this._cachedItems.push(e), this._cachedItems.length > this.limit) {
|
|
1335
|
+
let e = this._cachedItems.findIndex((e) => !e.isAttached && !e.hasSlide);
|
|
1336
|
+
e !== -1 && this._cachedItems.splice(e, 1)[0].destroy();
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
removeByIndex(e) {
|
|
1340
|
+
let t = this._cachedItems.findIndex((t) => t.index === e);
|
|
1341
|
+
t !== -1 && this._cachedItems.splice(t, 1);
|
|
1342
|
+
}
|
|
1343
|
+
getContentByIndex(e) {
|
|
1344
|
+
return this._cachedItems.find((t) => t.index === e);
|
|
1345
|
+
}
|
|
1346
|
+
destroy() {
|
|
1347
|
+
this._cachedItems.forEach((e) => e.destroy()), this._cachedItems = [];
|
|
1348
|
+
}
|
|
1349
|
+
}, Q = class extends ye {
|
|
1350
|
+
getNumItems() {
|
|
1351
|
+
let e = 0, t = this.options?.dataSource;
|
|
1352
|
+
t && "length" in t ? e = t.length : t && "gallery" in t && (t.items ||= this._getGalleryDOMElements(t.gallery), t.items && (e = t.items.length));
|
|
1353
|
+
let n = this.dispatch("numItems", {
|
|
1354
|
+
dataSource: t,
|
|
1355
|
+
numItems: e
|
|
1356
|
+
});
|
|
1357
|
+
return this.applyFilters("numItems", n.numItems, t);
|
|
1358
|
+
}
|
|
1359
|
+
createContentFromData(e, t) {
|
|
1360
|
+
return new xe(e, this, t);
|
|
1361
|
+
}
|
|
1362
|
+
getItemData(e) {
|
|
1363
|
+
let t = this.options?.dataSource, n = {};
|
|
1364
|
+
Array.isArray(t) ? n = t[e] : t && "gallery" in t && (t.items ||= this._getGalleryDOMElements(t.gallery), n = t.items[e]);
|
|
1365
|
+
let r = n;
|
|
1366
|
+
r instanceof Element && (r = this._domElementToItemData(r));
|
|
1367
|
+
let i = this.dispatch("itemData", {
|
|
1368
|
+
itemData: r || {},
|
|
1369
|
+
index: e
|
|
1370
|
+
});
|
|
1371
|
+
return this.applyFilters("itemData", i.itemData, e);
|
|
1372
|
+
}
|
|
1373
|
+
_getGalleryDOMElements(e) {
|
|
1374
|
+
var t, n;
|
|
1375
|
+
return (t = this.options) != null && t.children || (n = this.options) != null && n.childSelector ? ee(this.options.children, this.options.childSelector, e) || [] : [e];
|
|
1376
|
+
}
|
|
1377
|
+
_domElementToItemData(e) {
|
|
1378
|
+
let t = { element: e }, n = e.tagName === "A" ? e : e.querySelector("a");
|
|
1379
|
+
if (n) {
|
|
1380
|
+
t.src = n.dataset.pswpSrc || n.href, n.dataset.pswpSrcset && (t.srcset = n.dataset.pswpSrcset), t.width = n.dataset.pswpWidth ? parseInt(n.dataset.pswpWidth, 10) : 0, t.height = n.dataset.pswpHeight ? parseInt(n.dataset.pswpHeight, 10) : 0, t.w = t.width, t.h = t.height, n.dataset.pswpType && (t.type = n.dataset.pswpType);
|
|
1381
|
+
let r = e.querySelector("img");
|
|
1382
|
+
r && (t.msrc = r.currentSrc || r.src, t.alt = r.getAttribute("alt") ?? ""), (n.dataset.pswpCropped || n.dataset.cropped) && (t.thumbCropped = !0);
|
|
1383
|
+
}
|
|
1384
|
+
return this.applyFilters("domItemData", t, e, n);
|
|
1385
|
+
}
|
|
1386
|
+
lazyLoadData(e, t) {
|
|
1387
|
+
return Z(e, this, t);
|
|
1388
|
+
}
|
|
1389
|
+
}, $ = .003, Te = class {
|
|
1390
|
+
constructor(e) {
|
|
1391
|
+
this.pswp = e, this.isClosed = !0, this.isOpen = !1, this.isClosing = !1, this.isOpening = !1, this._duration = void 0, this._useAnimation = !1, this._croppedZoom = !1, this._animateRootOpacity = !1, this._animateBgOpacity = !1, this._placeholder = void 0, this._opacityElement = void 0, this._cropContainer1 = void 0, this._cropContainer2 = void 0, this._thumbBounds = void 0, this._prepareOpen = this._prepareOpen.bind(this), e.on("firstZoomPan", this._prepareOpen);
|
|
1392
|
+
}
|
|
1393
|
+
open() {
|
|
1394
|
+
this._prepareOpen(), this._start();
|
|
1395
|
+
}
|
|
1396
|
+
close() {
|
|
1397
|
+
if (this.isClosed || this.isClosing || this.isOpening) return;
|
|
1398
|
+
let e = this.pswp.currSlide;
|
|
1399
|
+
this.isOpen = !1, this.isOpening = !1, this.isClosing = !0, this._duration = this.pswp.options.hideAnimationDuration, e && e.currZoomLevel * e.width >= this.pswp.options.maxWidthToAnimate && (this._duration = 0), this._applyStartProps(), setTimeout(() => {
|
|
1400
|
+
this._start();
|
|
1401
|
+
}, this._croppedZoom ? 30 : 0);
|
|
1402
|
+
}
|
|
1403
|
+
_prepareOpen() {
|
|
1404
|
+
if (this.pswp.off("firstZoomPan", this._prepareOpen), !this.isOpening) {
|
|
1405
|
+
let e = this.pswp.currSlide;
|
|
1406
|
+
this.isOpening = !0, this.isClosing = !1, this._duration = this.pswp.options.showAnimationDuration, e && e.zoomLevels.initial * e.width >= this.pswp.options.maxWidthToAnimate && (this._duration = 0), this._applyStartProps();
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
_applyStartProps() {
|
|
1410
|
+
let { pswp: e } = this, t = this.pswp.currSlide, { options: n } = e;
|
|
1411
|
+
if (n.showHideAnimationType === "fade" ? (n.showHideOpacity = !0, this._thumbBounds = void 0) : n.showHideAnimationType === "none" ? (n.showHideOpacity = !1, this._duration = 0, this._thumbBounds = void 0) : this._thumbBounds = this.isOpening && e._initialThumbBounds ? e._initialThumbBounds : this.pswp.getThumbBounds(), this._placeholder = t?.getPlaceholderElement(), e.animations.stopAll(), this._useAnimation = !!(this._duration && this._duration > 50), this._animateZoom = !!this._thumbBounds && t?.content.usePlaceholder() && (!this.isClosing || !e.mainScroll.isShifted()), this._animateZoom ? this._animateRootOpacity = n.showHideOpacity ?? !1 : (this._animateRootOpacity = !0, this.isOpening && t && (t.zoomAndPanToInitial(), t.applyCurrentZoomPan())), this._animateBgOpacity = !this._animateRootOpacity && this.pswp.options.bgOpacity > $, this._opacityElement = this._animateRootOpacity ? e.element : e.bg, !this._useAnimation) {
|
|
1412
|
+
this._duration = 0, this._animateZoom = !1, this._animateBgOpacity = !1, this._animateRootOpacity = !0, this.isOpening && (e.element && (e.element.style.opacity = String($)), e.applyBgOpacity(1));
|
|
1413
|
+
return;
|
|
1414
|
+
}
|
|
1415
|
+
this._animateZoom && this._thumbBounds && this._thumbBounds.innerRect ? (this._croppedZoom = !0, this._cropContainer1 = this.pswp.container, this._cropContainer2 = this.pswp.currSlide?.holderElement, e.container && (e.container.style.overflow = "hidden", e.container.style.width = e.viewportSize.x + "px")) : this._croppedZoom = !1, this.isOpening ? (this._animateRootOpacity ? (e.element && (e.element.style.opacity = String($)), e.applyBgOpacity(1)) : (this._animateBgOpacity && e.bg && (e.bg.style.opacity = String($)), e.element && (e.element.style.opacity = "1")), this._animateZoom && (this._setClosedStateZoomPan(), this._placeholder && (this._placeholder.style.willChange = "transform", this._placeholder.style.opacity = String($)))) : this.isClosing && (e.mainScroll.itemHolders[0] && (e.mainScroll.itemHolders[0].el.style.display = "none"), e.mainScroll.itemHolders[2] && (e.mainScroll.itemHolders[2].el.style.display = "none"), this._croppedZoom && e.mainScroll.x !== 0 && (e.mainScroll.resetPosition(), e.mainScroll.resize()));
|
|
1416
|
+
}
|
|
1417
|
+
_start() {
|
|
1418
|
+
this.isOpening && this._useAnimation && this._placeholder && this._placeholder.tagName === "IMG" ? new Promise((e) => {
|
|
1419
|
+
let t = !1, n = !0;
|
|
1420
|
+
f(this._placeholder).finally(() => {
|
|
1421
|
+
t = !0, n || e(!0);
|
|
1422
|
+
}), setTimeout(() => {
|
|
1423
|
+
n = !1, t && e(!0);
|
|
1424
|
+
}, 50), setTimeout(e, 250);
|
|
1425
|
+
}).finally(() => this._initiate()) : this._initiate();
|
|
1426
|
+
}
|
|
1427
|
+
_initiate() {
|
|
1428
|
+
var e, t;
|
|
1429
|
+
(e = this.pswp.element) == null || e.style.setProperty("--pswp-transition-duration", this._duration + "ms"), this.pswp.dispatch(this.isOpening ? "openingAnimationStart" : "closingAnimationStart"), this.pswp.dispatch("initialZoom" + (this.isOpening ? "In" : "Out")), (t = this.pswp.element) == null || t.classList.toggle("pswp--ui-visible", this.isOpening), this.isOpening ? (this._placeholder && (this._placeholder.style.opacity = "1"), this._animateToOpenState()) : this.isClosing && this._animateToClosedState(), this._useAnimation || this._onAnimationComplete();
|
|
1430
|
+
}
|
|
1431
|
+
_onAnimationComplete() {
|
|
1432
|
+
let { pswp: e } = this;
|
|
1433
|
+
if (this.isOpen = this.isOpening, this.isClosed = this.isClosing, this.isOpening = !1, this.isClosing = !1, e.dispatch(this.isOpen ? "openingAnimationEnd" : "closingAnimationEnd"), e.dispatch("initialZoom" + (this.isOpen ? "InEnd" : "OutEnd")), this.isClosed) e.destroy();
|
|
1434
|
+
else if (this.isOpen) {
|
|
1435
|
+
var t;
|
|
1436
|
+
this._animateZoom && e.container && (e.container.style.overflow = "visible", e.container.style.width = "100%"), (t = e.currSlide) == null || t.applyCurrentZoomPan();
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
_animateToOpenState() {
|
|
1440
|
+
let { pswp: e } = this;
|
|
1441
|
+
this._animateZoom && (this._croppedZoom && this._cropContainer1 && this._cropContainer2 && (this._animateTo(this._cropContainer1, "transform", "translate3d(0,0,0)"), this._animateTo(this._cropContainer2, "transform", "none")), e.currSlide && (e.currSlide.zoomAndPanToInitial(), this._animateTo(e.currSlide.container, "transform", e.currSlide.getCurrentTransform()))), this._animateBgOpacity && e.bg && this._animateTo(e.bg, "opacity", String(e.options.bgOpacity)), this._animateRootOpacity && e.element && this._animateTo(e.element, "opacity", "1");
|
|
1442
|
+
}
|
|
1443
|
+
_animateToClosedState() {
|
|
1444
|
+
let { pswp: e } = this;
|
|
1445
|
+
this._animateZoom && this._setClosedStateZoomPan(!0), this._animateBgOpacity && e.bgOpacity > .01 && e.bg && this._animateTo(e.bg, "opacity", "0"), this._animateRootOpacity && e.element && this._animateTo(e.element, "opacity", "0");
|
|
1446
|
+
}
|
|
1447
|
+
_setClosedStateZoomPan(e) {
|
|
1448
|
+
if (!this._thumbBounds) return;
|
|
1449
|
+
let { pswp: n } = this, { innerRect: r } = this._thumbBounds, { currSlide: i, viewportSize: a } = n;
|
|
1450
|
+
if (this._croppedZoom && r && this._cropContainer1 && this._cropContainer2) {
|
|
1451
|
+
let t = -a.x + (this._thumbBounds.x - r.x) + r.w, n = -a.y + (this._thumbBounds.y - r.y) + r.h, i = a.x - r.w, c = a.y - r.h;
|
|
1452
|
+
e ? (this._animateTo(this._cropContainer1, "transform", o(t, n)), this._animateTo(this._cropContainer2, "transform", o(i, c))) : (s(this._cropContainer1, t, n), s(this._cropContainer2, i, c));
|
|
1453
|
+
}
|
|
1454
|
+
i && (t(i.pan, r || this._thumbBounds), i.currZoomLevel = this._thumbBounds.w / i.width, e ? this._animateTo(i.container, "transform", i.getCurrentTransform()) : i.applyCurrentZoomPan());
|
|
1455
|
+
}
|
|
1456
|
+
_animateTo(e, t, n) {
|
|
1457
|
+
if (!this._duration) {
|
|
1458
|
+
e.style[t] = n;
|
|
1459
|
+
return;
|
|
1460
|
+
}
|
|
1461
|
+
let { animations: r } = this.pswp, i = {
|
|
1462
|
+
duration: this._duration,
|
|
1463
|
+
easing: this.pswp.options.easing,
|
|
1464
|
+
onComplete: () => {
|
|
1465
|
+
r.activeAnimations.length || this._onAnimationComplete();
|
|
1466
|
+
},
|
|
1467
|
+
target: e
|
|
1468
|
+
};
|
|
1469
|
+
i[t] = n, r.startTransition(i);
|
|
1470
|
+
}
|
|
1471
|
+
}, Ee = {
|
|
1472
|
+
allowPanToNext: !0,
|
|
1473
|
+
spacing: .1,
|
|
1474
|
+
loop: !0,
|
|
1475
|
+
pinchToClose: !0,
|
|
1476
|
+
closeOnVerticalDrag: !0,
|
|
1477
|
+
hideAnimationDuration: 333,
|
|
1478
|
+
showAnimationDuration: 333,
|
|
1479
|
+
zoomAnimationDuration: 333,
|
|
1480
|
+
escKey: !0,
|
|
1481
|
+
arrowKeys: !0,
|
|
1482
|
+
trapFocus: !0,
|
|
1483
|
+
returnFocus: !0,
|
|
1484
|
+
maxWidthToAnimate: 4e3,
|
|
1485
|
+
clickToCloseNonZoomable: !0,
|
|
1486
|
+
imageClickAction: "zoom-or-close",
|
|
1487
|
+
bgClickAction: "close",
|
|
1488
|
+
tapAction: "toggle-controls",
|
|
1489
|
+
doubleTapAction: "zoom",
|
|
1490
|
+
indexIndicatorSep: " / ",
|
|
1491
|
+
preloaderDelay: 2e3,
|
|
1492
|
+
bgOpacity: .8,
|
|
1493
|
+
index: 0,
|
|
1494
|
+
errorMsg: "The image cannot be loaded",
|
|
1495
|
+
preload: [1, 2],
|
|
1496
|
+
easing: "cubic-bezier(.4,0,.22,1)"
|
|
1497
|
+
}, De = class extends Q {
|
|
1498
|
+
constructor(e) {
|
|
1499
|
+
super(), this.options = this._prepareOptions(e || {}), this.offset = {
|
|
1500
|
+
x: 0,
|
|
1501
|
+
y: 0
|
|
1502
|
+
}, this._prevViewportSize = {
|
|
1503
|
+
x: 0,
|
|
1504
|
+
y: 0
|
|
1505
|
+
}, this.viewportSize = {
|
|
1506
|
+
x: 0,
|
|
1507
|
+
y: 0
|
|
1508
|
+
}, this.bgOpacity = 1, this.currIndex = 0, this.potentialIndex = 0, this.isOpen = !1, this.isDestroying = !1, this.hasMouse = !1, this._initialItemData = {}, this._initialThumbBounds = void 0, this.topBar = void 0, this.element = void 0, this.template = void 0, this.container = void 0, this.scrollWrap = void 0, this.currSlide = void 0, this.events = new _(), this.animations = new ae(), this.mainScroll = new R(this), this.gestures = new I(this), this.opener = new Te(this), this.keyboard = new V(this), this.contentLoader = new we(this);
|
|
1509
|
+
}
|
|
1510
|
+
init() {
|
|
1511
|
+
if (this.isOpen || this.isDestroying) return !1;
|
|
1512
|
+
this.isOpen = !0, this.dispatch("init"), this.dispatch("beforeOpen"), this._createMainStructure();
|
|
1513
|
+
let e = "pswp--open";
|
|
1514
|
+
return this.gestures.supportsTouch && (e += " pswp--touch"), this.options.mainClass && (e += " " + this.options.mainClass), this.element && (this.element.className += " " + e), this.currIndex = this.options.index || 0, this.potentialIndex = this.currIndex, this.dispatch("firstUpdate"), this.scrollWheel = new J(this), (Number.isNaN(this.currIndex) || this.currIndex < 0 || this.currIndex >= this.getNumItems()) && (this.currIndex = 0), this.gestures.supportsTouch || this.mouseDetected(), this.updateSize(), this.offset.y = window.pageYOffset, this._initialItemData = this.getItemData(this.currIndex), this.dispatch("gettingData", {
|
|
1515
|
+
index: this.currIndex,
|
|
1516
|
+
data: this._initialItemData,
|
|
1517
|
+
slide: void 0
|
|
1518
|
+
}), this._initialThumbBounds = this.getThumbBounds(), this.dispatch("initialLayout"), this.on("openingAnimationEnd", () => {
|
|
1519
|
+
let { itemHolders: e } = this.mainScroll;
|
|
1520
|
+
e[0] && (e[0].el.style.display = "block", this.setContent(e[0], this.currIndex - 1)), e[2] && (e[2].el.style.display = "block", this.setContent(e[2], this.currIndex + 1)), this.appendHeavy(), this.contentLoader.updateLazy(), this.events.add(window, "resize", this._handlePageResize.bind(this)), this.events.add(window, "scroll", this._updatePageScrollOffset.bind(this)), this.dispatch("bindEvents");
|
|
1521
|
+
}), this.mainScroll.itemHolders[1] && this.setContent(this.mainScroll.itemHolders[1], this.currIndex), this.dispatch("change"), this.opener.open(), this.dispatch("afterInit"), !0;
|
|
1522
|
+
}
|
|
1523
|
+
getLoopedIndex(e) {
|
|
1524
|
+
let t = this.getNumItems();
|
|
1525
|
+
return this.options.loop && (e > t - 1 && (e -= t), e < 0 && (e += t)), a(e, 0, t - 1);
|
|
1526
|
+
}
|
|
1527
|
+
appendHeavy() {
|
|
1528
|
+
this.mainScroll.itemHolders.forEach((e) => {
|
|
1529
|
+
var t;
|
|
1530
|
+
(t = e.slide) == null || t.appendHeavy();
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
goTo(e) {
|
|
1534
|
+
this.mainScroll.moveIndexBy(this.getLoopedIndex(e) - this.potentialIndex);
|
|
1535
|
+
}
|
|
1536
|
+
next() {
|
|
1537
|
+
this.goTo(this.potentialIndex + 1);
|
|
1538
|
+
}
|
|
1539
|
+
prev() {
|
|
1540
|
+
this.goTo(this.potentialIndex - 1);
|
|
1541
|
+
}
|
|
1542
|
+
zoomTo(...e) {
|
|
1543
|
+
var t;
|
|
1544
|
+
(t = this.currSlide) == null || t.zoomTo(...e);
|
|
1545
|
+
}
|
|
1546
|
+
toggleZoom() {
|
|
1547
|
+
var e;
|
|
1548
|
+
(e = this.currSlide) == null || e.toggleZoom();
|
|
1549
|
+
}
|
|
1550
|
+
close() {
|
|
1551
|
+
!this.opener.isOpen || this.isDestroying || (this.isDestroying = !0, this.dispatch("close"), this.events.removeAll(), this.opener.close());
|
|
1552
|
+
}
|
|
1553
|
+
destroy() {
|
|
1554
|
+
var e;
|
|
1555
|
+
if (!this.isDestroying) {
|
|
1556
|
+
this.options.showHideAnimationType = "none", this.close();
|
|
1557
|
+
return;
|
|
1558
|
+
}
|
|
1559
|
+
this.dispatch("destroy"), this._listeners = {}, this.scrollWrap && (this.scrollWrap.ontouchmove = null, this.scrollWrap.ontouchend = null), (e = this.element) == null || e.remove(), this.mainScroll.itemHolders.forEach((e) => {
|
|
1560
|
+
var t;
|
|
1561
|
+
(t = e.slide) == null || t.destroy();
|
|
1562
|
+
}), this.contentLoader.destroy(), this.events.removeAll();
|
|
1563
|
+
}
|
|
1564
|
+
refreshSlideContent(e) {
|
|
1565
|
+
this.contentLoader.removeByIndex(e), this.mainScroll.itemHolders.forEach((t, n) => {
|
|
1566
|
+
let r = (this.currSlide?.index ?? 0) - 1 + n;
|
|
1567
|
+
if (this.canLoop() && (r = this.getLoopedIndex(r)), r === e && (this.setContent(t, e, !0), n === 1)) {
|
|
1568
|
+
var i;
|
|
1569
|
+
this.currSlide = t.slide, (i = t.slide) == null || i.setIsActive(!0);
|
|
1570
|
+
}
|
|
1571
|
+
}), this.dispatch("change");
|
|
1572
|
+
}
|
|
1573
|
+
setContent(e, t, n) {
|
|
1574
|
+
if (this.canLoop() && (t = this.getLoopedIndex(t)), e.slide) {
|
|
1575
|
+
if (e.slide.index === t && !n) return;
|
|
1576
|
+
e.slide.destroy(), e.slide = void 0;
|
|
1577
|
+
}
|
|
1578
|
+
!this.canLoop() && (t < 0 || t >= this.getNumItems()) || (e.slide = new te(this.getItemData(t), t, this), t === this.currIndex && (this.currSlide = e.slide), e.slide.append(e.el));
|
|
1579
|
+
}
|
|
1580
|
+
getViewportCenterPoint() {
|
|
1581
|
+
return {
|
|
1582
|
+
x: this.viewportSize.x / 2,
|
|
1583
|
+
y: this.viewportSize.y / 2
|
|
1584
|
+
};
|
|
1585
|
+
}
|
|
1586
|
+
updateSize(e) {
|
|
1587
|
+
if (this.isDestroying) return;
|
|
1588
|
+
let n = v(this.options, this);
|
|
1589
|
+
!e && i(n, this._prevViewportSize) || (t(this._prevViewportSize, n), this.dispatch("beforeResize"), t(this.viewportSize, this._prevViewportSize), this._updatePageScrollOffset(), this.dispatch("viewportSize"), this.mainScroll.resize(this.opener.isOpen), !this.hasMouse && window.matchMedia("(any-hover: hover)").matches && this.mouseDetected(), this.dispatch("resize"));
|
|
1590
|
+
}
|
|
1591
|
+
applyBgOpacity(e) {
|
|
1592
|
+
this.bgOpacity = Math.max(e, 0), this.bg && (this.bg.style.opacity = String(this.bgOpacity * this.options.bgOpacity));
|
|
1593
|
+
}
|
|
1594
|
+
mouseDetected() {
|
|
1595
|
+
if (!this.hasMouse) {
|
|
1596
|
+
var e;
|
|
1597
|
+
this.hasMouse = !0, (e = this.element) == null || e.classList.add("pswp--has_mouse");
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
_handlePageResize() {
|
|
1601
|
+
this.updateSize(), /iPhone|iPad|iPod/i.test(window.navigator.userAgent) && setTimeout(() => {
|
|
1602
|
+
this.updateSize();
|
|
1603
|
+
}, 500);
|
|
1604
|
+
}
|
|
1605
|
+
_updatePageScrollOffset() {
|
|
1606
|
+
this.setScrollOffset(0, window.pageYOffset);
|
|
1607
|
+
}
|
|
1608
|
+
setScrollOffset(e, t) {
|
|
1609
|
+
this.offset.x = e, this.offset.y = t, this.dispatch("updateScrollOffset");
|
|
1610
|
+
}
|
|
1611
|
+
_createMainStructure() {
|
|
1612
|
+
this.element = e("pswp", "div"), this.element.setAttribute("tabindex", "-1"), this.element.setAttribute("role", "dialog"), this.template = this.element, this.bg = e("pswp__bg", "div", this.element), this.scrollWrap = e("pswp__scroll-wrap", "section", this.element), this.container = e("pswp__container", "div", this.scrollWrap), this.scrollWrap.setAttribute("aria-roledescription", "carousel"), this.container.setAttribute("aria-live", "off"), this.container.setAttribute("id", "pswp__items"), this.mainScroll.appendHolders(), this.ui = new me(this), this.ui.init(), (this.options.appendToEl || document.body).appendChild(this.element);
|
|
1613
|
+
}
|
|
1614
|
+
getThumbBounds() {
|
|
1615
|
+
return _e(this.currIndex, this.currSlide ? this.currSlide.data : this._initialItemData, this);
|
|
1616
|
+
}
|
|
1617
|
+
canLoop() {
|
|
1618
|
+
return this.options.loop && this.getNumItems() > 2;
|
|
1619
|
+
}
|
|
1620
|
+
_prepareOptions(e) {
|
|
1621
|
+
return window.matchMedia("(prefers-reduced-motion), (update: slow)").matches && (e.showHideAnimationType = "none", e.zoomAnimationDuration = 0), {
|
|
1622
|
+
...Ee,
|
|
1623
|
+
...e
|
|
1624
|
+
};
|
|
1625
|
+
}
|
|
1626
|
+
};
|
|
1627
|
+
//#endregion
|
|
1628
|
+
export { De as default };
|