@flyfish-group/file-viewer 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -0
- package/dist/components/ImageViewer.js +1679 -0
- package/dist/components/MarkdownViewer.js +1459 -0
- package/dist/components/PdfView.js +22460 -0
- package/dist/components/PptxRender.js +21744 -0
- package/dist/components/XlsxTable.js +49412 -0
- package/dist/components/_commonjs-dynamic-modules.js +6 -0
- package/dist/components/_commonjsHelpers.js +30 -0
- package/dist/components/docx-preview.min.js +5354 -0
- package/dist/components/index.js +1787 -0
- package/dist/components/utils.d.ts +3 -0
- package/dist/components/worker-ref.js +21 -0
- package/dist/index.mjs +6 -0
- package/dist/index.umd.js +325 -0
- package/dist/main.d.ts +0 -0
- package/dist/package/common/type.d.ts +30 -0
- package/dist/package/common/util.d.ts +5 -0
- package/dist/package/common/worker-ref.d.ts +12 -0
- package/dist/package/components/FileViewer/FileViewer.vue.d.ts +18 -0
- package/dist/package/components/FileViewer/index.d.ts +2 -0
- package/dist/package/components/FileViewer/util.d.ts +2 -0
- package/dist/package/index.d.ts +11 -0
- package/dist/package/use/index.d.ts +1 -0
- package/dist/package/use/worker.d.ts +24 -0
- package/dist/package/vendors/docx/index.d.ts +4 -0
- package/dist/package/vendors/image/ImageViewer.vue.d.ts +15 -0
- package/dist/package/vendors/image/index.d.ts +5 -0
- package/dist/package/vendors/md/MarkdownViewer.vue.d.ts +15 -0
- package/dist/package/vendors/md/index.d.ts +5 -0
- package/dist/package/vendors/mp4/index.d.ts +4 -0
- package/dist/package/vendors/pdf/PdfView.vue.d.ts +15 -0
- package/dist/package/vendors/pdf/index.d.ts +2 -0
- package/dist/package/vendors/pdf/worker/index.d.ts +4 -0
- package/dist/package/vendors/pptx/PptxRender.vue.d.ts +87 -0
- package/dist/package/vendors/pptx/index.d.ts +7 -0
- package/dist/package/vendors/pptx/options.d.ts +39 -0
- package/dist/package/vendors/pptx/support/chart.d.ts +4 -0
- package/dist/package/vendors/pptx/worker/index.d.ts +4 -0
- package/dist/package/vendors/renders.d.ts +3 -0
- package/dist/package/vendors/text/CodeViewer.vue.d.ts +15 -0
- package/dist/package/vendors/text/index.d.ts +7 -0
- package/dist/package/vendors/xlsx/XlsxTable.vue.d.ts +17 -0
- package/dist/package/vendors/xlsx/index.d.ts +5 -0
- package/dist/package/vendors/xlsx/render.d.ts +6 -0
- package/dist/package/vendors/xlsx/util.d.ts +8 -0
- package/dist/package/vendors/xlsx/worker/index.d.ts +6 -0
- package/dist/package/vendors/xlsx/worker/xls/SheetJsModel.d.ts +36 -0
- package/dist/package/vendors/xlsx/worker/xls/index.d.ts +4 -0
- package/dist/package/vendors/xlsx/worker/xls/sheet.worker.d.ts +1 -0
- package/dist/package/vendors/xlsx/worker/xlsx/ExcelJsModel.d.ts +39 -0
- package/dist/package/vendors/xlsx/worker/xlsx/color.d.ts +2 -0
- package/dist/package/vendors/xlsx/worker/xlsx/context.d.ts +7 -0
- package/dist/package/vendors/xlsx/worker/xlsx/index.d.ts +4 -0
- package/dist/package/vendors/xlsx/worker/xlsx/util.d.ts +10 -0
- package/dist/package/vendors/xlsx/worker/xlsx/xlsx.worker.d.ts +2 -0
- package/dist/style.css +57 -0
- package/dist/vite.svg +1 -0
- package/dist/worker/pdf.worker.js +58 -0
- package/dist/worker/pptx.worker.js +21 -0
- package/dist/worker/sheet.worker.js +38 -0
- package/dist/worker/xlsx.worker.js +62 -0
- package/package.json +76 -0
|
@@ -0,0 +1,1679 @@
|
|
|
1
|
+
import { defineComponent as le, computed as he } from "vue";
|
|
2
|
+
import { n as ue } from "./index.js";
|
|
3
|
+
/*!
|
|
4
|
+
* Viewer.js v1.11.6
|
|
5
|
+
* https://fengyuanchen.github.io/viewerjs
|
|
6
|
+
*
|
|
7
|
+
* Copyright 2015-present Chen Fengyuan
|
|
8
|
+
* Released under the MIT license
|
|
9
|
+
*
|
|
10
|
+
* Date: 2023-09-17T03:16:38.052Z
|
|
11
|
+
*/
|
|
12
|
+
function St(n, t) {
|
|
13
|
+
var i = Object.keys(n);
|
|
14
|
+
if (Object.getOwnPropertySymbols) {
|
|
15
|
+
var e = Object.getOwnPropertySymbols(n);
|
|
16
|
+
t && (e = e.filter(function(r) {
|
|
17
|
+
return Object.getOwnPropertyDescriptor(n, r).enumerable;
|
|
18
|
+
})), i.push.apply(i, e);
|
|
19
|
+
}
|
|
20
|
+
return i;
|
|
21
|
+
}
|
|
22
|
+
function yt(n) {
|
|
23
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
24
|
+
var i = arguments[t] != null ? arguments[t] : {};
|
|
25
|
+
t % 2 ? St(Object(i), !0).forEach(function(e) {
|
|
26
|
+
de(n, e, i[e]);
|
|
27
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(n, Object.getOwnPropertyDescriptors(i)) : St(Object(i)).forEach(function(e) {
|
|
28
|
+
Object.defineProperty(n, e, Object.getOwnPropertyDescriptor(i, e));
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return n;
|
|
32
|
+
}
|
|
33
|
+
function gt(n) {
|
|
34
|
+
"@babel/helpers - typeof";
|
|
35
|
+
return gt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
36
|
+
return typeof t;
|
|
37
|
+
} : function(t) {
|
|
38
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
39
|
+
}, gt(n);
|
|
40
|
+
}
|
|
41
|
+
function ce(n, t) {
|
|
42
|
+
if (!(n instanceof t))
|
|
43
|
+
throw new TypeError("Cannot call a class as a function");
|
|
44
|
+
}
|
|
45
|
+
function Dt(n, t) {
|
|
46
|
+
for (var i = 0; i < t.length; i++) {
|
|
47
|
+
var e = t[i];
|
|
48
|
+
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(n, ie(e.key), e);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function fe(n, t, i) {
|
|
52
|
+
return t && Dt(n.prototype, t), i && Dt(n, i), Object.defineProperty(n, "prototype", {
|
|
53
|
+
writable: !1
|
|
54
|
+
}), n;
|
|
55
|
+
}
|
|
56
|
+
function de(n, t, i) {
|
|
57
|
+
return t = ie(t), t in n ? Object.defineProperty(n, t, {
|
|
58
|
+
value: i,
|
|
59
|
+
enumerable: !0,
|
|
60
|
+
configurable: !0,
|
|
61
|
+
writable: !0
|
|
62
|
+
}) : n[t] = i, n;
|
|
63
|
+
}
|
|
64
|
+
function me(n, t) {
|
|
65
|
+
if (typeof n != "object" || n === null)
|
|
66
|
+
return n;
|
|
67
|
+
var i = n[Symbol.toPrimitive];
|
|
68
|
+
if (i !== void 0) {
|
|
69
|
+
var e = i.call(n, t || "default");
|
|
70
|
+
if (typeof e != "object")
|
|
71
|
+
return e;
|
|
72
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
73
|
+
}
|
|
74
|
+
return (t === "string" ? String : Number)(n);
|
|
75
|
+
}
|
|
76
|
+
function ie(n) {
|
|
77
|
+
var t = me(n, "string");
|
|
78
|
+
return typeof t == "symbol" ? t : String(t);
|
|
79
|
+
}
|
|
80
|
+
var It = {
|
|
81
|
+
/**
|
|
82
|
+
* Enable a modal backdrop, specify `static` for a backdrop
|
|
83
|
+
* which doesn't close the modal on click.
|
|
84
|
+
* @type {boolean}
|
|
85
|
+
*/
|
|
86
|
+
backdrop: !0,
|
|
87
|
+
/**
|
|
88
|
+
* Show the button on the top-right of the viewer.
|
|
89
|
+
* @type {boolean}
|
|
90
|
+
*/
|
|
91
|
+
button: !0,
|
|
92
|
+
/**
|
|
93
|
+
* Show the navbar.
|
|
94
|
+
* @type {boolean | number}
|
|
95
|
+
*/
|
|
96
|
+
navbar: !0,
|
|
97
|
+
/**
|
|
98
|
+
* Specify the visibility and the content of the title.
|
|
99
|
+
* @type {boolean | number | Function | Array}
|
|
100
|
+
*/
|
|
101
|
+
title: !0,
|
|
102
|
+
/**
|
|
103
|
+
* Show the toolbar.
|
|
104
|
+
* @type {boolean | number | Object}
|
|
105
|
+
*/
|
|
106
|
+
toolbar: !0,
|
|
107
|
+
/**
|
|
108
|
+
* Custom class name(s) to add to the viewer's root element.
|
|
109
|
+
* @type {string}
|
|
110
|
+
*/
|
|
111
|
+
className: "",
|
|
112
|
+
/**
|
|
113
|
+
* Define where to put the viewer in modal mode.
|
|
114
|
+
* @type {string | Element}
|
|
115
|
+
*/
|
|
116
|
+
container: "body",
|
|
117
|
+
/**
|
|
118
|
+
* Filter the images for viewing. Return true if the image is viewable.
|
|
119
|
+
* @type {Function}
|
|
120
|
+
*/
|
|
121
|
+
filter: null,
|
|
122
|
+
/**
|
|
123
|
+
* Enable to request fullscreen when play.
|
|
124
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/FullscreenOptions}
|
|
125
|
+
* @type {boolean|FullscreenOptions}
|
|
126
|
+
*/
|
|
127
|
+
fullscreen: !0,
|
|
128
|
+
/**
|
|
129
|
+
* Define the extra attributes to inherit from the original image.
|
|
130
|
+
* @type {Array}
|
|
131
|
+
*/
|
|
132
|
+
inheritedAttributes: ["crossOrigin", "decoding", "isMap", "loading", "referrerPolicy", "sizes", "srcset", "useMap"],
|
|
133
|
+
/**
|
|
134
|
+
* Define the initial coverage of the viewing image.
|
|
135
|
+
* @type {number}
|
|
136
|
+
*/
|
|
137
|
+
initialCoverage: 0.9,
|
|
138
|
+
/**
|
|
139
|
+
* Define the initial index of the image for viewing.
|
|
140
|
+
* @type {number}
|
|
141
|
+
*/
|
|
142
|
+
initialViewIndex: 0,
|
|
143
|
+
/**
|
|
144
|
+
* Enable inline mode.
|
|
145
|
+
* @type {boolean}
|
|
146
|
+
*/
|
|
147
|
+
inline: !1,
|
|
148
|
+
/**
|
|
149
|
+
* The amount of time to delay between automatically cycling an image when playing.
|
|
150
|
+
* @type {number}
|
|
151
|
+
*/
|
|
152
|
+
interval: 5e3,
|
|
153
|
+
/**
|
|
154
|
+
* Enable keyboard support.
|
|
155
|
+
* @type {boolean}
|
|
156
|
+
*/
|
|
157
|
+
keyboard: !0,
|
|
158
|
+
/**
|
|
159
|
+
* Focus the viewer when initialized.
|
|
160
|
+
* @type {boolean}
|
|
161
|
+
*/
|
|
162
|
+
focus: !0,
|
|
163
|
+
/**
|
|
164
|
+
* Indicate if show a loading spinner when load image or not.
|
|
165
|
+
* @type {boolean}
|
|
166
|
+
*/
|
|
167
|
+
loading: !0,
|
|
168
|
+
/**
|
|
169
|
+
* Indicate if enable loop viewing or not.
|
|
170
|
+
* @type {boolean}
|
|
171
|
+
*/
|
|
172
|
+
loop: !0,
|
|
173
|
+
/**
|
|
174
|
+
* Min width of the viewer in inline mode.
|
|
175
|
+
* @type {number}
|
|
176
|
+
*/
|
|
177
|
+
minWidth: 200,
|
|
178
|
+
/**
|
|
179
|
+
* Min height of the viewer in inline mode.
|
|
180
|
+
* @type {number}
|
|
181
|
+
*/
|
|
182
|
+
minHeight: 100,
|
|
183
|
+
/**
|
|
184
|
+
* Enable to move the image.
|
|
185
|
+
* @type {boolean}
|
|
186
|
+
*/
|
|
187
|
+
movable: !0,
|
|
188
|
+
/**
|
|
189
|
+
* Enable to rotate the image.
|
|
190
|
+
* @type {boolean}
|
|
191
|
+
*/
|
|
192
|
+
rotatable: !0,
|
|
193
|
+
/**
|
|
194
|
+
* Enable to scale the image.
|
|
195
|
+
* @type {boolean}
|
|
196
|
+
*/
|
|
197
|
+
scalable: !0,
|
|
198
|
+
/**
|
|
199
|
+
* Enable to zoom the image.
|
|
200
|
+
* @type {boolean}
|
|
201
|
+
*/
|
|
202
|
+
zoomable: !0,
|
|
203
|
+
/**
|
|
204
|
+
* Enable to zoom the current image by dragging on the touch screen.
|
|
205
|
+
* @type {boolean}
|
|
206
|
+
*/
|
|
207
|
+
zoomOnTouch: !0,
|
|
208
|
+
/**
|
|
209
|
+
* Enable to zoom the image by wheeling mouse.
|
|
210
|
+
* @type {boolean}
|
|
211
|
+
*/
|
|
212
|
+
zoomOnWheel: !0,
|
|
213
|
+
/**
|
|
214
|
+
* Enable to slide to the next or previous image by swiping on the touch screen.
|
|
215
|
+
* @type {boolean}
|
|
216
|
+
*/
|
|
217
|
+
slideOnTouch: !0,
|
|
218
|
+
/**
|
|
219
|
+
* Indicate if toggle the image size between its natural size
|
|
220
|
+
* and initial size when double click on the image or not.
|
|
221
|
+
* @type {boolean}
|
|
222
|
+
*/
|
|
223
|
+
toggleOnDblclick: !0,
|
|
224
|
+
/**
|
|
225
|
+
* Show the tooltip with image ratio (percentage) when zoom in or zoom out.
|
|
226
|
+
* @type {boolean}
|
|
227
|
+
*/
|
|
228
|
+
tooltip: !0,
|
|
229
|
+
/**
|
|
230
|
+
* Enable CSS3 Transition for some special elements.
|
|
231
|
+
* @type {boolean}
|
|
232
|
+
*/
|
|
233
|
+
transition: !0,
|
|
234
|
+
/**
|
|
235
|
+
* Define the CSS `z-index` value of viewer in modal mode.
|
|
236
|
+
* @type {number}
|
|
237
|
+
*/
|
|
238
|
+
zIndex: 2015,
|
|
239
|
+
/**
|
|
240
|
+
* Define the CSS `z-index` value of viewer in inline mode.
|
|
241
|
+
* @type {number}
|
|
242
|
+
*/
|
|
243
|
+
zIndexInline: 0,
|
|
244
|
+
/**
|
|
245
|
+
* Define the ratio when zoom the image by wheeling mouse.
|
|
246
|
+
* @type {number}
|
|
247
|
+
*/
|
|
248
|
+
zoomRatio: 0.1,
|
|
249
|
+
/**
|
|
250
|
+
* Define the min ratio of the image when zoom out.
|
|
251
|
+
* @type {number}
|
|
252
|
+
*/
|
|
253
|
+
minZoomRatio: 0.01,
|
|
254
|
+
/**
|
|
255
|
+
* Define the max ratio of the image when zoom in.
|
|
256
|
+
* @type {number}
|
|
257
|
+
*/
|
|
258
|
+
maxZoomRatio: 100,
|
|
259
|
+
/**
|
|
260
|
+
* Define where to get the original image URL for viewing.
|
|
261
|
+
* @type {string | Function}
|
|
262
|
+
*/
|
|
263
|
+
url: "src",
|
|
264
|
+
/**
|
|
265
|
+
* Event shortcuts.
|
|
266
|
+
* @type {Function}
|
|
267
|
+
*/
|
|
268
|
+
ready: null,
|
|
269
|
+
show: null,
|
|
270
|
+
shown: null,
|
|
271
|
+
hide: null,
|
|
272
|
+
hidden: null,
|
|
273
|
+
view: null,
|
|
274
|
+
viewed: null,
|
|
275
|
+
move: null,
|
|
276
|
+
moved: null,
|
|
277
|
+
rotate: null,
|
|
278
|
+
rotated: null,
|
|
279
|
+
scale: null,
|
|
280
|
+
scaled: null,
|
|
281
|
+
zoom: null,
|
|
282
|
+
zoomed: null,
|
|
283
|
+
play: null,
|
|
284
|
+
stop: null
|
|
285
|
+
}, ve = '<div class="viewer-container" tabindex="-1" touch-action="none"><div class="viewer-canvas"></div><div class="viewer-footer"><div class="viewer-title"></div><div class="viewer-toolbar"></div><div class="viewer-navbar"><ul class="viewer-list" role="navigation"></ul></div></div><div class="viewer-tooltip" role="alert" aria-hidden="true"></div><div class="viewer-button" data-viewer-action="mix" role="button"></div><div class="viewer-player"></div></div>', mt = typeof window < "u" && typeof window.document < "u", M = mt ? window : {}, K = mt && M.document.documentElement ? "ontouchstart" in M.document.documentElement : !1, Et = mt ? "PointerEvent" in M : !1, v = "viewer", ut = "move", ne = "switch", tt = "zoom", at = "".concat(v, "-active"), ge = "".concat(v, "-close"), ct = "".concat(v, "-fade"), pt = "".concat(v, "-fixed"), pe = "".concat(v, "-fullscreen"), Ot = "".concat(v, "-fullscreen-exit"), W = "".concat(v, "-hide"), be = "".concat(v, "-hide-md-down"), we = "".concat(v, "-hide-sm-down"), ye = "".concat(v, "-hide-xs-down"), A = "".concat(v, "-in"), et = "".concat(v, "-invisible"), Z = "".concat(v, "-loading"), Ee = "".concat(v, "-move"), xt = "".concat(v, "-open"), q = "".concat(v, "-show"), D = "".concat(v, "-transition"), G = "click", bt = "dblclick", Ct = "dragstart", Nt = "focusin", At = "keydown", z = "load", X = "error", _e = K ? "touchend touchcancel" : "mouseup", Te = K ? "touchmove" : "mousemove", Se = K ? "touchstart" : "mousedown", zt = Et ? "pointerdown" : Se, kt = Et ? "pointermove" : Te, Lt = Et ? "pointerup pointercancel" : _e, Vt = "resize", k = "transitionend", Rt = "wheel", Ft = "ready", Mt = "show", Pt = "shown", Yt = "hide", Wt = "hidden", Xt = "view", it = "viewed", Ht = "move", qt = "moved", jt = "rotate", $t = "rotated", Ut = "scale", Bt = "scaled", Kt = "zoom", Zt = "zoomed", Gt = "play", Jt = "stop", dt = "".concat(v, "Action"), _t = /\s\s*/, st = ["zoom-in", "zoom-out", "one-to-one", "reset", "prev", "play", "next", "rotate-left", "rotate-right", "flip-horizontal", "flip-vertical"];
|
|
286
|
+
function nt(n) {
|
|
287
|
+
return typeof n == "string";
|
|
288
|
+
}
|
|
289
|
+
var De = Number.isNaN || M.isNaN;
|
|
290
|
+
function S(n) {
|
|
291
|
+
return typeof n == "number" && !De(n);
|
|
292
|
+
}
|
|
293
|
+
function $(n) {
|
|
294
|
+
return typeof n > "u";
|
|
295
|
+
}
|
|
296
|
+
function J(n) {
|
|
297
|
+
return gt(n) === "object" && n !== null;
|
|
298
|
+
}
|
|
299
|
+
var Ie = Object.prototype.hasOwnProperty;
|
|
300
|
+
function U(n) {
|
|
301
|
+
if (!J(n))
|
|
302
|
+
return !1;
|
|
303
|
+
try {
|
|
304
|
+
var t = n.constructor, i = t.prototype;
|
|
305
|
+
return t && i && Ie.call(i, "isPrototypeOf");
|
|
306
|
+
} catch {
|
|
307
|
+
return !1;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function p(n) {
|
|
311
|
+
return typeof n == "function";
|
|
312
|
+
}
|
|
313
|
+
function w(n, t) {
|
|
314
|
+
if (n && p(t))
|
|
315
|
+
if (Array.isArray(n) || S(n.length)) {
|
|
316
|
+
var i = n.length, e;
|
|
317
|
+
for (e = 0; e < i && t.call(n, n[e], e, n) !== !1; e += 1)
|
|
318
|
+
;
|
|
319
|
+
} else
|
|
320
|
+
J(n) && Object.keys(n).forEach(function(r) {
|
|
321
|
+
t.call(n, n[r], r, n);
|
|
322
|
+
});
|
|
323
|
+
return n;
|
|
324
|
+
}
|
|
325
|
+
var N = Object.assign || function(t) {
|
|
326
|
+
for (var i = arguments.length, e = new Array(i > 1 ? i - 1 : 0), r = 1; r < i; r++)
|
|
327
|
+
e[r - 1] = arguments[r];
|
|
328
|
+
return J(t) && e.length > 0 && e.forEach(function(a) {
|
|
329
|
+
J(a) && Object.keys(a).forEach(function(s) {
|
|
330
|
+
t[s] = a[s];
|
|
331
|
+
});
|
|
332
|
+
}), t;
|
|
333
|
+
}, Oe = /^(?:width|height|left|top|marginLeft|marginTop)$/;
|
|
334
|
+
function L(n, t) {
|
|
335
|
+
var i = n.style;
|
|
336
|
+
w(t, function(e, r) {
|
|
337
|
+
Oe.test(r) && S(e) && (e += "px"), i[r] = e;
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
function xe(n) {
|
|
341
|
+
return nt(n) ? n.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">") : n;
|
|
342
|
+
}
|
|
343
|
+
function j(n, t) {
|
|
344
|
+
return !n || !t ? !1 : n.classList ? n.classList.contains(t) : n.className.indexOf(t) > -1;
|
|
345
|
+
}
|
|
346
|
+
function f(n, t) {
|
|
347
|
+
if (!(!n || !t)) {
|
|
348
|
+
if (S(n.length)) {
|
|
349
|
+
w(n, function(e) {
|
|
350
|
+
f(e, t);
|
|
351
|
+
});
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
if (n.classList) {
|
|
355
|
+
n.classList.add(t);
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
var i = n.className.trim();
|
|
359
|
+
i ? i.indexOf(t) < 0 && (n.className = "".concat(i, " ").concat(t)) : n.className = t;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
function g(n, t) {
|
|
363
|
+
if (!(!n || !t)) {
|
|
364
|
+
if (S(n.length)) {
|
|
365
|
+
w(n, function(i) {
|
|
366
|
+
g(i, t);
|
|
367
|
+
});
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
if (n.classList) {
|
|
371
|
+
n.classList.remove(t);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
n.className.indexOf(t) >= 0 && (n.className = n.className.replace(t, ""));
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
function rt(n, t, i) {
|
|
378
|
+
if (t) {
|
|
379
|
+
if (S(n.length)) {
|
|
380
|
+
w(n, function(e) {
|
|
381
|
+
rt(e, t, i);
|
|
382
|
+
});
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
i ? f(n, t) : g(n, t);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
var Ce = /([a-z\d])([A-Z])/g;
|
|
389
|
+
function Tt(n) {
|
|
390
|
+
return n.replace(Ce, "$1-$2").toLowerCase();
|
|
391
|
+
}
|
|
392
|
+
function B(n, t) {
|
|
393
|
+
return J(n[t]) ? n[t] : n.dataset ? n.dataset[t] : n.getAttribute("data-".concat(Tt(t)));
|
|
394
|
+
}
|
|
395
|
+
function wt(n, t, i) {
|
|
396
|
+
J(i) ? n[t] = i : n.dataset ? n.dataset[t] = i : n.setAttribute("data-".concat(Tt(t)), i);
|
|
397
|
+
}
|
|
398
|
+
var re = function() {
|
|
399
|
+
var n = !1;
|
|
400
|
+
if (mt) {
|
|
401
|
+
var t = !1, i = function() {
|
|
402
|
+
}, e = Object.defineProperty({}, "once", {
|
|
403
|
+
get: function() {
|
|
404
|
+
return n = !0, t;
|
|
405
|
+
},
|
|
406
|
+
/**
|
|
407
|
+
* This setter can fix a `TypeError` in strict mode
|
|
408
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only}
|
|
409
|
+
* @param {boolean} value - The value to set
|
|
410
|
+
*/
|
|
411
|
+
set: function(a) {
|
|
412
|
+
t = a;
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
M.addEventListener("test", i, e), M.removeEventListener("test", i, e);
|
|
416
|
+
}
|
|
417
|
+
return n;
|
|
418
|
+
}();
|
|
419
|
+
function b(n, t, i) {
|
|
420
|
+
var e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, r = i;
|
|
421
|
+
t.trim().split(_t).forEach(function(a) {
|
|
422
|
+
if (!re) {
|
|
423
|
+
var s = n.listeners;
|
|
424
|
+
s && s[a] && s[a][i] && (r = s[a][i], delete s[a][i], Object.keys(s[a]).length === 0 && delete s[a], Object.keys(s).length === 0 && delete n.listeners);
|
|
425
|
+
}
|
|
426
|
+
n.removeEventListener(a, r, e);
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
function m(n, t, i) {
|
|
430
|
+
var e = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, r = i;
|
|
431
|
+
t.trim().split(_t).forEach(function(a) {
|
|
432
|
+
if (e.once && !re) {
|
|
433
|
+
var s = n.listeners, u = s === void 0 ? {} : s;
|
|
434
|
+
r = function() {
|
|
435
|
+
delete u[a][i], n.removeEventListener(a, r, e);
|
|
436
|
+
for (var o = arguments.length, h = new Array(o), c = 0; c < o; c++)
|
|
437
|
+
h[c] = arguments[c];
|
|
438
|
+
i.apply(n, h);
|
|
439
|
+
}, u[a] || (u[a] = {}), u[a][i] && n.removeEventListener(a, u[a][i], e), u[a][i] = r, n.listeners = u;
|
|
440
|
+
}
|
|
441
|
+
n.addEventListener(a, r, e);
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
function I(n, t, i, e) {
|
|
445
|
+
var r;
|
|
446
|
+
return p(Event) && p(CustomEvent) ? r = new CustomEvent(t, yt({
|
|
447
|
+
bubbles: !0,
|
|
448
|
+
cancelable: !0,
|
|
449
|
+
detail: i
|
|
450
|
+
}, e)) : (r = document.createEvent("CustomEvent"), r.initCustomEvent(t, !0, !0, i)), n.dispatchEvent(r);
|
|
451
|
+
}
|
|
452
|
+
function Ne(n) {
|
|
453
|
+
var t = n.getBoundingClientRect();
|
|
454
|
+
return {
|
|
455
|
+
left: t.left + (window.pageXOffset - document.documentElement.clientLeft),
|
|
456
|
+
top: t.top + (window.pageYOffset - document.documentElement.clientTop)
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
function ft(n) {
|
|
460
|
+
var t = n.rotate, i = n.scaleX, e = n.scaleY, r = n.translateX, a = n.translateY, s = [];
|
|
461
|
+
S(r) && r !== 0 && s.push("translateX(".concat(r, "px)")), S(a) && a !== 0 && s.push("translateY(".concat(a, "px)")), S(t) && t !== 0 && s.push("rotate(".concat(t, "deg)")), S(i) && i !== 1 && s.push("scaleX(".concat(i, ")")), S(e) && e !== 1 && s.push("scaleY(".concat(e, ")"));
|
|
462
|
+
var u = s.length ? s.join(" ") : "none";
|
|
463
|
+
return {
|
|
464
|
+
WebkitTransform: u,
|
|
465
|
+
msTransform: u,
|
|
466
|
+
transform: u
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
function Ae(n) {
|
|
470
|
+
return nt(n) ? decodeURIComponent(n.replace(/^.*\//, "").replace(/[?&#].*$/, "")) : "";
|
|
471
|
+
}
|
|
472
|
+
var vt = M.navigator && /Version\/\d+(\.\d+)+?\s+Safari/i.test(M.navigator.userAgent);
|
|
473
|
+
function ae(n, t, i) {
|
|
474
|
+
var e = document.createElement("img");
|
|
475
|
+
if (n.naturalWidth && !vt)
|
|
476
|
+
return i(n.naturalWidth, n.naturalHeight), e;
|
|
477
|
+
var r = document.body || document.documentElement;
|
|
478
|
+
return e.onload = function() {
|
|
479
|
+
i(e.width, e.height), vt || r.removeChild(e);
|
|
480
|
+
}, w(t.inheritedAttributes, function(a) {
|
|
481
|
+
var s = n.getAttribute(a);
|
|
482
|
+
s !== null && e.setAttribute(a, s);
|
|
483
|
+
}), e.src = n.src, vt || (e.style.cssText = "left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;", r.appendChild(e)), e;
|
|
484
|
+
}
|
|
485
|
+
function ot(n) {
|
|
486
|
+
switch (n) {
|
|
487
|
+
case 2:
|
|
488
|
+
return ye;
|
|
489
|
+
case 3:
|
|
490
|
+
return we;
|
|
491
|
+
case 4:
|
|
492
|
+
return be;
|
|
493
|
+
default:
|
|
494
|
+
return "";
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
function ze(n) {
|
|
498
|
+
var t = yt({}, n), i = [];
|
|
499
|
+
return w(n, function(e, r) {
|
|
500
|
+
delete t[r], w(t, function(a) {
|
|
501
|
+
var s = Math.abs(e.startX - a.startX), u = Math.abs(e.startY - a.startY), l = Math.abs(e.endX - a.endX), o = Math.abs(e.endY - a.endY), h = Math.sqrt(s * s + u * u), c = Math.sqrt(l * l + o * o), d = (c - h) / h;
|
|
502
|
+
i.push(d);
|
|
503
|
+
});
|
|
504
|
+
}), i.sort(function(e, r) {
|
|
505
|
+
return Math.abs(e) < Math.abs(r);
|
|
506
|
+
}), i[0];
|
|
507
|
+
}
|
|
508
|
+
function lt(n, t) {
|
|
509
|
+
var i = n.pageX, e = n.pageY, r = {
|
|
510
|
+
endX: i,
|
|
511
|
+
endY: e
|
|
512
|
+
};
|
|
513
|
+
return t ? r : yt({
|
|
514
|
+
timeStamp: Date.now(),
|
|
515
|
+
startX: i,
|
|
516
|
+
startY: e
|
|
517
|
+
}, r);
|
|
518
|
+
}
|
|
519
|
+
function ke(n) {
|
|
520
|
+
var t = 0, i = 0, e = 0;
|
|
521
|
+
return w(n, function(r) {
|
|
522
|
+
var a = r.startX, s = r.startY;
|
|
523
|
+
t += a, i += s, e += 1;
|
|
524
|
+
}), t /= e, i /= e, {
|
|
525
|
+
pageX: t,
|
|
526
|
+
pageY: i
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
var Le = {
|
|
530
|
+
render: function() {
|
|
531
|
+
this.initContainer(), this.initViewer(), this.initList(), this.renderViewer();
|
|
532
|
+
},
|
|
533
|
+
initBody: function() {
|
|
534
|
+
var t = this.element.ownerDocument, i = t.body || t.documentElement;
|
|
535
|
+
this.body = i, this.scrollbarWidth = window.innerWidth - t.documentElement.clientWidth, this.initialBodyPaddingRight = i.style.paddingRight, this.initialBodyComputedPaddingRight = window.getComputedStyle(i).paddingRight;
|
|
536
|
+
},
|
|
537
|
+
initContainer: function() {
|
|
538
|
+
this.containerData = {
|
|
539
|
+
width: window.innerWidth,
|
|
540
|
+
height: window.innerHeight
|
|
541
|
+
};
|
|
542
|
+
},
|
|
543
|
+
initViewer: function() {
|
|
544
|
+
var t = this.options, i = this.parent, e;
|
|
545
|
+
t.inline && (e = {
|
|
546
|
+
width: Math.max(i.offsetWidth, t.minWidth),
|
|
547
|
+
height: Math.max(i.offsetHeight, t.minHeight)
|
|
548
|
+
}, this.parentData = e), (this.fulled || !e) && (e = this.containerData), this.viewerData = N({}, e);
|
|
549
|
+
},
|
|
550
|
+
renderViewer: function() {
|
|
551
|
+
this.options.inline && !this.fulled && L(this.viewer, this.viewerData);
|
|
552
|
+
},
|
|
553
|
+
initList: function() {
|
|
554
|
+
var t = this, i = this.element, e = this.options, r = this.list, a = [];
|
|
555
|
+
r.innerHTML = "", w(this.images, function(s, u) {
|
|
556
|
+
var l = s.src, o = s.alt || Ae(l), h = t.getImageURL(s);
|
|
557
|
+
if (l || h) {
|
|
558
|
+
var c = document.createElement("li"), d = document.createElement("img");
|
|
559
|
+
w(e.inheritedAttributes, function(_) {
|
|
560
|
+
var y = s.getAttribute(_);
|
|
561
|
+
y !== null && d.setAttribute(_, y);
|
|
562
|
+
}), e.navbar && (d.src = l || h), d.alt = o, d.setAttribute("data-original-url", h || l), c.setAttribute("data-index", u), c.setAttribute("data-viewer-action", "view"), c.setAttribute("role", "button"), e.keyboard && c.setAttribute("tabindex", 0), c.appendChild(d), r.appendChild(c), a.push(c);
|
|
563
|
+
}
|
|
564
|
+
}), this.items = a, w(a, function(s) {
|
|
565
|
+
var u = s.firstElementChild, l, o;
|
|
566
|
+
wt(u, "filled", !0), e.loading && f(s, Z), m(u, z, l = function(c) {
|
|
567
|
+
b(u, X, o), e.loading && g(s, Z), t.loadImage(c);
|
|
568
|
+
}, {
|
|
569
|
+
once: !0
|
|
570
|
+
}), m(u, X, o = function() {
|
|
571
|
+
b(u, z, l), e.loading && g(s, Z);
|
|
572
|
+
}, {
|
|
573
|
+
once: !0
|
|
574
|
+
});
|
|
575
|
+
}), e.transition && m(i, it, function() {
|
|
576
|
+
f(r, D);
|
|
577
|
+
}, {
|
|
578
|
+
once: !0
|
|
579
|
+
});
|
|
580
|
+
},
|
|
581
|
+
renderList: function() {
|
|
582
|
+
var t = this.index, i = this.items[t];
|
|
583
|
+
if (i) {
|
|
584
|
+
var e = i.nextElementSibling, r = parseInt(window.getComputedStyle(e || i).marginLeft, 10), a = i.offsetWidth, s = a + r;
|
|
585
|
+
L(this.list, N({
|
|
586
|
+
width: s * this.length - r
|
|
587
|
+
}, ft({
|
|
588
|
+
translateX: (this.viewerData.width - a) / 2 - s * t
|
|
589
|
+
})));
|
|
590
|
+
}
|
|
591
|
+
},
|
|
592
|
+
resetList: function() {
|
|
593
|
+
var t = this.list;
|
|
594
|
+
t.innerHTML = "", g(t, D), L(t, ft({
|
|
595
|
+
translateX: 0
|
|
596
|
+
}));
|
|
597
|
+
},
|
|
598
|
+
initImage: function(t) {
|
|
599
|
+
var i = this, e = this.options, r = this.image, a = this.viewerData, s = this.footer.offsetHeight, u = a.width, l = Math.max(a.height - s, s), o = this.imageData || {}, h;
|
|
600
|
+
this.imageInitializing = {
|
|
601
|
+
abort: function() {
|
|
602
|
+
h.onload = null;
|
|
603
|
+
}
|
|
604
|
+
}, h = ae(r, e, function(c, d) {
|
|
605
|
+
var _ = c / d, y = Math.max(0, Math.min(1, e.initialCoverage)), T = u, O = l;
|
|
606
|
+
i.imageInitializing = !1, l * _ > u ? O = u / _ : T = l * _, y = S(y) ? y : 0.9, T = Math.min(T * y, c), O = Math.min(O * y, d);
|
|
607
|
+
var x = (u - T) / 2, C = (l - O) / 2, E = {
|
|
608
|
+
left: x,
|
|
609
|
+
top: C,
|
|
610
|
+
x,
|
|
611
|
+
y: C,
|
|
612
|
+
width: T,
|
|
613
|
+
height: O,
|
|
614
|
+
oldRatio: 1,
|
|
615
|
+
ratio: T / c,
|
|
616
|
+
aspectRatio: _,
|
|
617
|
+
naturalWidth: c,
|
|
618
|
+
naturalHeight: d
|
|
619
|
+
}, R = N({}, E);
|
|
620
|
+
e.rotatable && (E.rotate = o.rotate || 0, R.rotate = 0), e.scalable && (E.scaleX = o.scaleX || 1, E.scaleY = o.scaleY || 1, R.scaleX = 1, R.scaleY = 1), i.imageData = E, i.initialImageData = R, t && t();
|
|
621
|
+
});
|
|
622
|
+
},
|
|
623
|
+
renderImage: function(t) {
|
|
624
|
+
var i = this, e = this.image, r = this.imageData;
|
|
625
|
+
if (L(e, N({
|
|
626
|
+
width: r.width,
|
|
627
|
+
height: r.height,
|
|
628
|
+
// XXX: Not to use translateX/Y to avoid image shaking when zooming
|
|
629
|
+
marginLeft: r.x,
|
|
630
|
+
marginTop: r.y
|
|
631
|
+
}, ft(r))), t)
|
|
632
|
+
if ((this.viewing || this.moving || this.rotating || this.scaling || this.zooming) && this.options.transition && j(e, D)) {
|
|
633
|
+
var a = function() {
|
|
634
|
+
i.imageRendering = !1, t();
|
|
635
|
+
};
|
|
636
|
+
this.imageRendering = {
|
|
637
|
+
abort: function() {
|
|
638
|
+
b(e, k, a);
|
|
639
|
+
}
|
|
640
|
+
}, m(e, k, a, {
|
|
641
|
+
once: !0
|
|
642
|
+
});
|
|
643
|
+
} else
|
|
644
|
+
t();
|
|
645
|
+
},
|
|
646
|
+
resetImage: function() {
|
|
647
|
+
var t = this.image;
|
|
648
|
+
t && (this.viewing && this.viewing.abort(), t.parentNode.removeChild(t), this.image = null, this.title.innerHTML = "");
|
|
649
|
+
}
|
|
650
|
+
}, Ve = {
|
|
651
|
+
bind: function() {
|
|
652
|
+
var t = this.options, i = this.viewer, e = this.canvas, r = this.element.ownerDocument;
|
|
653
|
+
m(i, G, this.onClick = this.click.bind(this)), m(i, Ct, this.onDragStart = this.dragstart.bind(this)), m(e, zt, this.onPointerDown = this.pointerdown.bind(this)), m(r, kt, this.onPointerMove = this.pointermove.bind(this)), m(r, Lt, this.onPointerUp = this.pointerup.bind(this)), m(r, At, this.onKeyDown = this.keydown.bind(this)), m(window, Vt, this.onResize = this.resize.bind(this)), t.zoomable && t.zoomOnWheel && m(i, Rt, this.onWheel = this.wheel.bind(this), {
|
|
654
|
+
passive: !1,
|
|
655
|
+
capture: !0
|
|
656
|
+
}), t.toggleOnDblclick && m(e, bt, this.onDblclick = this.dblclick.bind(this));
|
|
657
|
+
},
|
|
658
|
+
unbind: function() {
|
|
659
|
+
var t = this.options, i = this.viewer, e = this.canvas, r = this.element.ownerDocument;
|
|
660
|
+
b(i, G, this.onClick), b(i, Ct, this.onDragStart), b(e, zt, this.onPointerDown), b(r, kt, this.onPointerMove), b(r, Lt, this.onPointerUp), b(r, At, this.onKeyDown), b(window, Vt, this.onResize), t.zoomable && t.zoomOnWheel && b(i, Rt, this.onWheel, {
|
|
661
|
+
passive: !1,
|
|
662
|
+
capture: !0
|
|
663
|
+
}), t.toggleOnDblclick && b(e, bt, this.onDblclick);
|
|
664
|
+
}
|
|
665
|
+
}, Re = {
|
|
666
|
+
click: function(t) {
|
|
667
|
+
var i = this.options, e = this.imageData, r = t.target, a = B(r, dt);
|
|
668
|
+
switch (!a && r.localName === "img" && r.parentElement.localName === "li" && (r = r.parentElement, a = B(r, dt)), K && t.isTrusted && r === this.canvas && clearTimeout(this.clickCanvasTimeout), a) {
|
|
669
|
+
case "mix":
|
|
670
|
+
this.played ? this.stop() : i.inline ? this.fulled ? this.exit() : this.full() : this.hide();
|
|
671
|
+
break;
|
|
672
|
+
case "hide":
|
|
673
|
+
this.pointerMoved || this.hide();
|
|
674
|
+
break;
|
|
675
|
+
case "view":
|
|
676
|
+
this.view(B(r, "index"));
|
|
677
|
+
break;
|
|
678
|
+
case "zoom-in":
|
|
679
|
+
this.zoom(0.1, !0);
|
|
680
|
+
break;
|
|
681
|
+
case "zoom-out":
|
|
682
|
+
this.zoom(-0.1, !0);
|
|
683
|
+
break;
|
|
684
|
+
case "one-to-one":
|
|
685
|
+
this.toggle();
|
|
686
|
+
break;
|
|
687
|
+
case "reset":
|
|
688
|
+
this.reset();
|
|
689
|
+
break;
|
|
690
|
+
case "prev":
|
|
691
|
+
this.prev(i.loop);
|
|
692
|
+
break;
|
|
693
|
+
case "play":
|
|
694
|
+
this.play(i.fullscreen);
|
|
695
|
+
break;
|
|
696
|
+
case "next":
|
|
697
|
+
this.next(i.loop);
|
|
698
|
+
break;
|
|
699
|
+
case "rotate-left":
|
|
700
|
+
this.rotate(-90);
|
|
701
|
+
break;
|
|
702
|
+
case "rotate-right":
|
|
703
|
+
this.rotate(90);
|
|
704
|
+
break;
|
|
705
|
+
case "flip-horizontal":
|
|
706
|
+
this.scaleX(-e.scaleX || -1);
|
|
707
|
+
break;
|
|
708
|
+
case "flip-vertical":
|
|
709
|
+
this.scaleY(-e.scaleY || -1);
|
|
710
|
+
break;
|
|
711
|
+
default:
|
|
712
|
+
this.played && this.stop();
|
|
713
|
+
}
|
|
714
|
+
},
|
|
715
|
+
dblclick: function(t) {
|
|
716
|
+
t.preventDefault(), this.viewed && t.target === this.image && (K && t.isTrusted && clearTimeout(this.doubleClickImageTimeout), this.toggle(t.isTrusted ? t : t.detail && t.detail.originalEvent));
|
|
717
|
+
},
|
|
718
|
+
load: function() {
|
|
719
|
+
var t = this;
|
|
720
|
+
this.timeout && (clearTimeout(this.timeout), this.timeout = !1);
|
|
721
|
+
var i = this.element, e = this.options, r = this.image, a = this.index, s = this.viewerData;
|
|
722
|
+
g(r, et), e.loading && g(this.canvas, Z), r.style.cssText = "height:0;" + "margin-left:".concat(s.width / 2, "px;") + "margin-top:".concat(s.height / 2, "px;") + "max-width:none!important;position:relative;width:0;", this.initImage(function() {
|
|
723
|
+
rt(r, Ee, e.movable), rt(r, D, e.transition), t.renderImage(function() {
|
|
724
|
+
t.viewed = !0, t.viewing = !1, p(e.viewed) && m(i, it, e.viewed, {
|
|
725
|
+
once: !0
|
|
726
|
+
}), I(i, it, {
|
|
727
|
+
originalImage: t.images[a],
|
|
728
|
+
index: a,
|
|
729
|
+
image: r
|
|
730
|
+
}, {
|
|
731
|
+
cancelable: !1
|
|
732
|
+
});
|
|
733
|
+
});
|
|
734
|
+
});
|
|
735
|
+
},
|
|
736
|
+
loadImage: function(t) {
|
|
737
|
+
var i = t.target, e = i.parentNode, r = e.offsetWidth || 30, a = e.offsetHeight || 50, s = !!B(i, "filled");
|
|
738
|
+
ae(i, this.options, function(u, l) {
|
|
739
|
+
var o = u / l, h = r, c = a;
|
|
740
|
+
a * o > r ? s ? h = a * o : c = r / o : s ? c = r / o : h = a * o, L(i, N({
|
|
741
|
+
width: h,
|
|
742
|
+
height: c
|
|
743
|
+
}, ft({
|
|
744
|
+
translateX: (r - h) / 2,
|
|
745
|
+
translateY: (a - c) / 2
|
|
746
|
+
})));
|
|
747
|
+
});
|
|
748
|
+
},
|
|
749
|
+
keydown: function(t) {
|
|
750
|
+
var i = this.options;
|
|
751
|
+
if (i.keyboard) {
|
|
752
|
+
var e = t.keyCode || t.which || t.charCode;
|
|
753
|
+
switch (e) {
|
|
754
|
+
case 13:
|
|
755
|
+
this.viewer.contains(t.target) && this.click(t);
|
|
756
|
+
break;
|
|
757
|
+
}
|
|
758
|
+
if (this.fulled)
|
|
759
|
+
switch (e) {
|
|
760
|
+
case 27:
|
|
761
|
+
this.played ? this.stop() : i.inline ? this.fulled && this.exit() : this.hide();
|
|
762
|
+
break;
|
|
763
|
+
case 32:
|
|
764
|
+
this.played && this.stop();
|
|
765
|
+
break;
|
|
766
|
+
case 37:
|
|
767
|
+
this.played && this.playing ? this.playing.prev() : this.prev(i.loop);
|
|
768
|
+
break;
|
|
769
|
+
case 38:
|
|
770
|
+
t.preventDefault(), this.zoom(i.zoomRatio, !0);
|
|
771
|
+
break;
|
|
772
|
+
case 39:
|
|
773
|
+
this.played && this.playing ? this.playing.next() : this.next(i.loop);
|
|
774
|
+
break;
|
|
775
|
+
case 40:
|
|
776
|
+
t.preventDefault(), this.zoom(-i.zoomRatio, !0);
|
|
777
|
+
break;
|
|
778
|
+
case 48:
|
|
779
|
+
case 49:
|
|
780
|
+
t.ctrlKey && (t.preventDefault(), this.toggle());
|
|
781
|
+
break;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
},
|
|
785
|
+
dragstart: function(t) {
|
|
786
|
+
t.target.localName === "img" && t.preventDefault();
|
|
787
|
+
},
|
|
788
|
+
pointerdown: function(t) {
|
|
789
|
+
var i = this.options, e = this.pointers, r = t.buttons, a = t.button;
|
|
790
|
+
if (this.pointerMoved = !1, !(!this.viewed || this.showing || this.viewing || this.hiding || (t.type === "mousedown" || t.type === "pointerdown" && t.pointerType === "mouse") && // No primary button (Usually the left button)
|
|
791
|
+
(S(r) && r !== 1 || S(a) && a !== 0 || t.ctrlKey))) {
|
|
792
|
+
t.preventDefault(), t.changedTouches ? w(t.changedTouches, function(u) {
|
|
793
|
+
e[u.identifier] = lt(u);
|
|
794
|
+
}) : e[t.pointerId || 0] = lt(t);
|
|
795
|
+
var s = i.movable ? ut : !1;
|
|
796
|
+
i.zoomOnTouch && i.zoomable && Object.keys(e).length > 1 ? s = tt : i.slideOnTouch && (t.pointerType === "touch" || t.type === "touchstart") && this.isSwitchable() && (s = ne), i.transition && (s === ut || s === tt) && g(this.image, D), this.action = s;
|
|
797
|
+
}
|
|
798
|
+
},
|
|
799
|
+
pointermove: function(t) {
|
|
800
|
+
var i = this.pointers, e = this.action;
|
|
801
|
+
!this.viewed || !e || (t.preventDefault(), t.changedTouches ? w(t.changedTouches, function(r) {
|
|
802
|
+
N(i[r.identifier] || {}, lt(r, !0));
|
|
803
|
+
}) : N(i[t.pointerId || 0] || {}, lt(t, !0)), this.change(t));
|
|
804
|
+
},
|
|
805
|
+
pointerup: function(t) {
|
|
806
|
+
var i = this, e = this.options, r = this.action, a = this.pointers, s;
|
|
807
|
+
t.changedTouches ? w(t.changedTouches, function(u) {
|
|
808
|
+
s = a[u.identifier], delete a[u.identifier];
|
|
809
|
+
}) : (s = a[t.pointerId || 0], delete a[t.pointerId || 0]), r && (t.preventDefault(), e.transition && (r === ut || r === tt) && f(this.image, D), this.action = !1, K && r !== tt && s && Date.now() - s.timeStamp < 500 && (clearTimeout(this.clickCanvasTimeout), clearTimeout(this.doubleClickImageTimeout), e.toggleOnDblclick && this.viewed && t.target === this.image ? this.imageClicked ? (this.imageClicked = !1, this.doubleClickImageTimeout = setTimeout(function() {
|
|
810
|
+
I(i.image, bt, {
|
|
811
|
+
originalEvent: t
|
|
812
|
+
});
|
|
813
|
+
}, 50)) : (this.imageClicked = !0, this.doubleClickImageTimeout = setTimeout(function() {
|
|
814
|
+
i.imageClicked = !1;
|
|
815
|
+
}, 500)) : (this.imageClicked = !1, e.backdrop && e.backdrop !== "static" && t.target === this.canvas && (this.clickCanvasTimeout = setTimeout(function() {
|
|
816
|
+
I(i.canvas, G, {
|
|
817
|
+
originalEvent: t
|
|
818
|
+
});
|
|
819
|
+
}, 50)))));
|
|
820
|
+
},
|
|
821
|
+
resize: function() {
|
|
822
|
+
var t = this;
|
|
823
|
+
if (!(!this.isShown || this.hiding) && (this.fulled && (this.close(), this.initBody(), this.open()), this.initContainer(), this.initViewer(), this.renderViewer(), this.renderList(), this.viewed && this.initImage(function() {
|
|
824
|
+
t.renderImage();
|
|
825
|
+
}), this.played)) {
|
|
826
|
+
if (this.options.fullscreen && this.fulled && !(document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement)) {
|
|
827
|
+
this.stop();
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
w(this.player.getElementsByTagName("img"), function(i) {
|
|
831
|
+
m(i, z, t.loadImage.bind(t), {
|
|
832
|
+
once: !0
|
|
833
|
+
}), I(i, z);
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
},
|
|
837
|
+
wheel: function(t) {
|
|
838
|
+
var i = this;
|
|
839
|
+
if (this.viewed && (t.preventDefault(), !this.wheeling)) {
|
|
840
|
+
this.wheeling = !0, setTimeout(function() {
|
|
841
|
+
i.wheeling = !1;
|
|
842
|
+
}, 50);
|
|
843
|
+
var e = Number(this.options.zoomRatio) || 0.1, r = 1;
|
|
844
|
+
t.deltaY ? r = t.deltaY > 0 ? 1 : -1 : t.wheelDelta ? r = -t.wheelDelta / 120 : t.detail && (r = t.detail > 0 ? 1 : -1), this.zoom(-r * e, !0, null, t);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}, Fe = {
|
|
848
|
+
/** Show the viewer (only available in modal mode)
|
|
849
|
+
* @param {boolean} [immediate=false] - Indicates if show the viewer immediately or not.
|
|
850
|
+
* @returns {Viewer} this
|
|
851
|
+
*/
|
|
852
|
+
show: function() {
|
|
853
|
+
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, i = this.element, e = this.options;
|
|
854
|
+
if (e.inline || this.showing || this.isShown || this.showing)
|
|
855
|
+
return this;
|
|
856
|
+
if (!this.ready)
|
|
857
|
+
return this.build(), this.ready && this.show(t), this;
|
|
858
|
+
if (p(e.show) && m(i, Mt, e.show, {
|
|
859
|
+
once: !0
|
|
860
|
+
}), I(i, Mt) === !1 || !this.ready)
|
|
861
|
+
return this;
|
|
862
|
+
this.hiding && this.transitioning.abort(), this.showing = !0, this.open();
|
|
863
|
+
var r = this.viewer;
|
|
864
|
+
if (g(r, W), r.setAttribute("role", "dialog"), r.setAttribute("aria-labelledby", this.title.id), r.setAttribute("aria-modal", !0), r.removeAttribute("aria-hidden"), e.transition && !t) {
|
|
865
|
+
var a = this.shown.bind(this);
|
|
866
|
+
this.transitioning = {
|
|
867
|
+
abort: function() {
|
|
868
|
+
b(r, k, a), g(r, A);
|
|
869
|
+
}
|
|
870
|
+
}, f(r, D), r.initialOffsetWidth = r.offsetWidth, m(r, k, a, {
|
|
871
|
+
once: !0
|
|
872
|
+
}), f(r, A);
|
|
873
|
+
} else
|
|
874
|
+
f(r, A), this.shown();
|
|
875
|
+
return this;
|
|
876
|
+
},
|
|
877
|
+
/**
|
|
878
|
+
* Hide the viewer (only available in modal mode)
|
|
879
|
+
* @param {boolean} [immediate=false] - Indicates if hide the viewer immediately or not.
|
|
880
|
+
* @returns {Viewer} this
|
|
881
|
+
*/
|
|
882
|
+
hide: function() {
|
|
883
|
+
var t = this, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, e = this.element, r = this.options;
|
|
884
|
+
if (r.inline || this.hiding || !(this.isShown || this.showing))
|
|
885
|
+
return this;
|
|
886
|
+
if (p(r.hide) && m(e, Yt, r.hide, {
|
|
887
|
+
once: !0
|
|
888
|
+
}), I(e, Yt) === !1)
|
|
889
|
+
return this;
|
|
890
|
+
this.showing && this.transitioning.abort(), this.hiding = !0, this.played ? this.stop() : this.viewing && this.viewing.abort();
|
|
891
|
+
var a = this.viewer, s = this.image, u = function() {
|
|
892
|
+
g(a, A), t.hidden();
|
|
893
|
+
};
|
|
894
|
+
if (r.transition && !i) {
|
|
895
|
+
var l = function h(c) {
|
|
896
|
+
c && c.target === a && (b(a, k, h), t.hidden());
|
|
897
|
+
}, o = function() {
|
|
898
|
+
j(a, D) ? (m(a, k, l), g(a, A)) : u();
|
|
899
|
+
};
|
|
900
|
+
this.transitioning = {
|
|
901
|
+
abort: function() {
|
|
902
|
+
t.viewed && j(s, D) ? b(s, k, o) : j(a, D) && b(a, k, l);
|
|
903
|
+
}
|
|
904
|
+
}, this.viewed && j(s, D) ? (m(s, k, o, {
|
|
905
|
+
once: !0
|
|
906
|
+
}), this.zoomTo(0, !1, null, null, !0)) : o();
|
|
907
|
+
} else
|
|
908
|
+
u();
|
|
909
|
+
return this;
|
|
910
|
+
},
|
|
911
|
+
/**
|
|
912
|
+
* View one of the images with image's index
|
|
913
|
+
* @param {number} index - The index of the image to view.
|
|
914
|
+
* @returns {Viewer} this
|
|
915
|
+
*/
|
|
916
|
+
view: function() {
|
|
917
|
+
var t = this, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.options.initialViewIndex;
|
|
918
|
+
if (i = Number(i) || 0, this.hiding || this.played || i < 0 || i >= this.length || this.viewed && i === this.index)
|
|
919
|
+
return this;
|
|
920
|
+
if (!this.isShown)
|
|
921
|
+
return this.index = i, this.show();
|
|
922
|
+
this.viewing && this.viewing.abort();
|
|
923
|
+
var e = this.element, r = this.options, a = this.title, s = this.canvas, u = this.items[i], l = u.querySelector("img"), o = B(l, "originalUrl"), h = l.getAttribute("alt"), c = document.createElement("img");
|
|
924
|
+
if (w(r.inheritedAttributes, function(O) {
|
|
925
|
+
var x = l.getAttribute(O);
|
|
926
|
+
x !== null && c.setAttribute(O, x);
|
|
927
|
+
}), c.src = o, c.alt = h, p(r.view) && m(e, Xt, r.view, {
|
|
928
|
+
once: !0
|
|
929
|
+
}), I(e, Xt, {
|
|
930
|
+
originalImage: this.images[i],
|
|
931
|
+
index: i,
|
|
932
|
+
image: c
|
|
933
|
+
}) === !1 || !this.isShown || this.hiding || this.played)
|
|
934
|
+
return this;
|
|
935
|
+
var d = this.items[this.index];
|
|
936
|
+
d && (g(d, at), d.removeAttribute("aria-selected")), f(u, at), u.setAttribute("aria-selected", !0), r.focus && u.focus(), this.image = c, this.viewed = !1, this.index = i, this.imageData = {}, f(c, et), r.loading && f(s, Z), s.innerHTML = "", s.appendChild(c), this.renderList(), a.innerHTML = "";
|
|
937
|
+
var _ = function() {
|
|
938
|
+
var x = t.imageData, C = Array.isArray(r.title) ? r.title[1] : r.title;
|
|
939
|
+
a.innerHTML = xe(p(C) ? C.call(t, c, x) : "".concat(h, " (").concat(x.naturalWidth, " × ").concat(x.naturalHeight, ")"));
|
|
940
|
+
}, y, T;
|
|
941
|
+
return m(e, it, _, {
|
|
942
|
+
once: !0
|
|
943
|
+
}), this.viewing = {
|
|
944
|
+
abort: function() {
|
|
945
|
+
b(e, it, _), c.complete ? t.imageRendering ? t.imageRendering.abort() : t.imageInitializing && t.imageInitializing.abort() : (c.src = "", b(c, z, y), t.timeout && clearTimeout(t.timeout));
|
|
946
|
+
}
|
|
947
|
+
}, c.complete ? this.load() : (m(c, z, y = function() {
|
|
948
|
+
b(c, X, T), t.load();
|
|
949
|
+
}, {
|
|
950
|
+
once: !0
|
|
951
|
+
}), m(c, X, T = function() {
|
|
952
|
+
b(c, z, y), t.timeout && (clearTimeout(t.timeout), t.timeout = !1), g(c, et), r.loading && g(t.canvas, Z);
|
|
953
|
+
}, {
|
|
954
|
+
once: !0
|
|
955
|
+
}), this.timeout && clearTimeout(this.timeout), this.timeout = setTimeout(function() {
|
|
956
|
+
g(c, et), t.timeout = !1;
|
|
957
|
+
}, 1e3)), this;
|
|
958
|
+
},
|
|
959
|
+
/**
|
|
960
|
+
* View the previous image
|
|
961
|
+
* @param {boolean} [loop=false] - Indicate if view the last one
|
|
962
|
+
* when it is the first one at present.
|
|
963
|
+
* @returns {Viewer} this
|
|
964
|
+
*/
|
|
965
|
+
prev: function() {
|
|
966
|
+
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, i = this.index - 1;
|
|
967
|
+
return i < 0 && (i = t ? this.length - 1 : 0), this.view(i), this;
|
|
968
|
+
},
|
|
969
|
+
/**
|
|
970
|
+
* View the next image
|
|
971
|
+
* @param {boolean} [loop=false] - Indicate if view the first one
|
|
972
|
+
* when it is the last one at present.
|
|
973
|
+
* @returns {Viewer} this
|
|
974
|
+
*/
|
|
975
|
+
next: function() {
|
|
976
|
+
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, i = this.length - 1, e = this.index + 1;
|
|
977
|
+
return e > i && (e = t ? 0 : i), this.view(e), this;
|
|
978
|
+
},
|
|
979
|
+
/**
|
|
980
|
+
* Move the image with relative offsets.
|
|
981
|
+
* @param {number} x - The moving distance in the horizontal direction.
|
|
982
|
+
* @param {number} [y=x] The moving distance in the vertical direction.
|
|
983
|
+
* @returns {Viewer} this
|
|
984
|
+
*/
|
|
985
|
+
move: function(t) {
|
|
986
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, e = this.imageData;
|
|
987
|
+
return this.moveTo($(t) ? t : e.x + Number(t), $(i) ? i : e.y + Number(i)), this;
|
|
988
|
+
},
|
|
989
|
+
/**
|
|
990
|
+
* Move the image to an absolute point.
|
|
991
|
+
* @param {number} x - The new position in the horizontal direction.
|
|
992
|
+
* @param {number} [y=x] - The new position in the vertical direction.
|
|
993
|
+
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
994
|
+
* @returns {Viewer} this
|
|
995
|
+
*/
|
|
996
|
+
moveTo: function(t) {
|
|
997
|
+
var i = this, e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, a = this.element, s = this.options, u = this.imageData;
|
|
998
|
+
if (t = Number(t), e = Number(e), this.viewed && !this.played && s.movable) {
|
|
999
|
+
var l = u.x, o = u.y, h = !1;
|
|
1000
|
+
if (S(t) ? h = !0 : t = l, S(e) ? h = !0 : e = o, h) {
|
|
1001
|
+
if (p(s.move) && m(a, Ht, s.move, {
|
|
1002
|
+
once: !0
|
|
1003
|
+
}), I(a, Ht, {
|
|
1004
|
+
x: t,
|
|
1005
|
+
y: e,
|
|
1006
|
+
oldX: l,
|
|
1007
|
+
oldY: o,
|
|
1008
|
+
originalEvent: r
|
|
1009
|
+
}) === !1)
|
|
1010
|
+
return this;
|
|
1011
|
+
u.x = t, u.y = e, u.left = t, u.top = e, this.moving = !0, this.renderImage(function() {
|
|
1012
|
+
i.moving = !1, p(s.moved) && m(a, qt, s.moved, {
|
|
1013
|
+
once: !0
|
|
1014
|
+
}), I(a, qt, {
|
|
1015
|
+
x: t,
|
|
1016
|
+
y: e,
|
|
1017
|
+
oldX: l,
|
|
1018
|
+
oldY: o,
|
|
1019
|
+
originalEvent: r
|
|
1020
|
+
}, {
|
|
1021
|
+
cancelable: !1
|
|
1022
|
+
});
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
return this;
|
|
1027
|
+
},
|
|
1028
|
+
/**
|
|
1029
|
+
* Rotate the image with a relative degree.
|
|
1030
|
+
* @param {number} degree - The rotate degree.
|
|
1031
|
+
* @returns {Viewer} this
|
|
1032
|
+
*/
|
|
1033
|
+
rotate: function(t) {
|
|
1034
|
+
return this.rotateTo((this.imageData.rotate || 0) + Number(t)), this;
|
|
1035
|
+
},
|
|
1036
|
+
/**
|
|
1037
|
+
* Rotate the image to an absolute degree.
|
|
1038
|
+
* @param {number} degree - The rotate degree.
|
|
1039
|
+
* @returns {Viewer} this
|
|
1040
|
+
*/
|
|
1041
|
+
rotateTo: function(t) {
|
|
1042
|
+
var i = this, e = this.element, r = this.options, a = this.imageData;
|
|
1043
|
+
if (t = Number(t), S(t) && this.viewed && !this.played && r.rotatable) {
|
|
1044
|
+
var s = a.rotate;
|
|
1045
|
+
if (p(r.rotate) && m(e, jt, r.rotate, {
|
|
1046
|
+
once: !0
|
|
1047
|
+
}), I(e, jt, {
|
|
1048
|
+
degree: t,
|
|
1049
|
+
oldDegree: s
|
|
1050
|
+
}) === !1)
|
|
1051
|
+
return this;
|
|
1052
|
+
a.rotate = t, this.rotating = !0, this.renderImage(function() {
|
|
1053
|
+
i.rotating = !1, p(r.rotated) && m(e, $t, r.rotated, {
|
|
1054
|
+
once: !0
|
|
1055
|
+
}), I(e, $t, {
|
|
1056
|
+
degree: t,
|
|
1057
|
+
oldDegree: s
|
|
1058
|
+
}, {
|
|
1059
|
+
cancelable: !1
|
|
1060
|
+
});
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
return this;
|
|
1064
|
+
},
|
|
1065
|
+
/**
|
|
1066
|
+
* Scale the image on the x-axis.
|
|
1067
|
+
* @param {number} scaleX - The scale ratio on the x-axis.
|
|
1068
|
+
* @returns {Viewer} this
|
|
1069
|
+
*/
|
|
1070
|
+
scaleX: function(t) {
|
|
1071
|
+
return this.scale(t, this.imageData.scaleY), this;
|
|
1072
|
+
},
|
|
1073
|
+
/**
|
|
1074
|
+
* Scale the image on the y-axis.
|
|
1075
|
+
* @param {number} scaleY - The scale ratio on the y-axis.
|
|
1076
|
+
* @returns {Viewer} this
|
|
1077
|
+
*/
|
|
1078
|
+
scaleY: function(t) {
|
|
1079
|
+
return this.scale(this.imageData.scaleX, t), this;
|
|
1080
|
+
},
|
|
1081
|
+
/**
|
|
1082
|
+
* Scale the image.
|
|
1083
|
+
* @param {number} scaleX - The scale ratio on the x-axis.
|
|
1084
|
+
* @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.
|
|
1085
|
+
* @returns {Viewer} this
|
|
1086
|
+
*/
|
|
1087
|
+
scale: function(t) {
|
|
1088
|
+
var i = this, e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : t, r = this.element, a = this.options, s = this.imageData;
|
|
1089
|
+
if (t = Number(t), e = Number(e), this.viewed && !this.played && a.scalable) {
|
|
1090
|
+
var u = s.scaleX, l = s.scaleY, o = !1;
|
|
1091
|
+
if (S(t) ? o = !0 : t = u, S(e) ? o = !0 : e = l, o) {
|
|
1092
|
+
if (p(a.scale) && m(r, Ut, a.scale, {
|
|
1093
|
+
once: !0
|
|
1094
|
+
}), I(r, Ut, {
|
|
1095
|
+
scaleX: t,
|
|
1096
|
+
scaleY: e,
|
|
1097
|
+
oldScaleX: u,
|
|
1098
|
+
oldScaleY: l
|
|
1099
|
+
}) === !1)
|
|
1100
|
+
return this;
|
|
1101
|
+
s.scaleX = t, s.scaleY = e, this.scaling = !0, this.renderImage(function() {
|
|
1102
|
+
i.scaling = !1, p(a.scaled) && m(r, Bt, a.scaled, {
|
|
1103
|
+
once: !0
|
|
1104
|
+
}), I(r, Bt, {
|
|
1105
|
+
scaleX: t,
|
|
1106
|
+
scaleY: e,
|
|
1107
|
+
oldScaleX: u,
|
|
1108
|
+
oldScaleY: l
|
|
1109
|
+
}, {
|
|
1110
|
+
cancelable: !1
|
|
1111
|
+
});
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
return this;
|
|
1116
|
+
},
|
|
1117
|
+
/**
|
|
1118
|
+
* Zoom the image with a relative ratio.
|
|
1119
|
+
* @param {number} ratio - The target ratio.
|
|
1120
|
+
* @param {boolean} [showTooltip=false] - Indicates whether to show the tooltip.
|
|
1121
|
+
* @param {Object} [pivot] - The pivot point coordinate for zooming.
|
|
1122
|
+
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
1123
|
+
* @returns {Viewer} this
|
|
1124
|
+
*/
|
|
1125
|
+
zoom: function(t) {
|
|
1126
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null, a = this.imageData;
|
|
1127
|
+
return t = Number(t), t < 0 ? t = 1 / (1 - t) : t = 1 + t, this.zoomTo(a.width * t / a.naturalWidth, i, e, r), this;
|
|
1128
|
+
},
|
|
1129
|
+
/**
|
|
1130
|
+
* Zoom the image to an absolute ratio.
|
|
1131
|
+
* @param {number} ratio - The target ratio.
|
|
1132
|
+
* @param {boolean} [showTooltip] - Indicates whether to show the tooltip.
|
|
1133
|
+
* @param {Object} [pivot] - The pivot point coordinate for zooming.
|
|
1134
|
+
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
1135
|
+
* @param {Event} [_zoomable=false] - Indicates if the current zoom is available or not.
|
|
1136
|
+
* @returns {Viewer} this
|
|
1137
|
+
*/
|
|
1138
|
+
zoomTo: function(t) {
|
|
1139
|
+
var i = this, e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null, s = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !1, u = this.element, l = this.options, o = this.pointers, h = this.imageData, c = h.x, d = h.y, _ = h.width, y = h.height, T = h.naturalWidth, O = h.naturalHeight;
|
|
1140
|
+
if (t = Math.max(0, t), S(t) && this.viewed && !this.played && (s || l.zoomable)) {
|
|
1141
|
+
if (!s) {
|
|
1142
|
+
var x = Math.max(0.01, l.minZoomRatio), C = Math.min(100, l.maxZoomRatio);
|
|
1143
|
+
t = Math.min(Math.max(t, x), C);
|
|
1144
|
+
}
|
|
1145
|
+
if (a)
|
|
1146
|
+
switch (a.type) {
|
|
1147
|
+
case "wheel":
|
|
1148
|
+
l.zoomRatio >= 0.055 && t > 0.95 && t < 1.05 && (t = 1);
|
|
1149
|
+
break;
|
|
1150
|
+
case "pointermove":
|
|
1151
|
+
case "touchmove":
|
|
1152
|
+
case "mousemove":
|
|
1153
|
+
t > 0.99 && t < 1.01 && (t = 1);
|
|
1154
|
+
break;
|
|
1155
|
+
}
|
|
1156
|
+
var E = T * t, R = O * t, P = E - _, V = R - y, Y = h.ratio;
|
|
1157
|
+
if (p(l.zoom) && m(u, Kt, l.zoom, {
|
|
1158
|
+
once: !0
|
|
1159
|
+
}), I(u, Kt, {
|
|
1160
|
+
ratio: t,
|
|
1161
|
+
oldRatio: Y,
|
|
1162
|
+
originalEvent: a
|
|
1163
|
+
}) === !1)
|
|
1164
|
+
return this;
|
|
1165
|
+
if (this.zooming = !0, a) {
|
|
1166
|
+
var Q = Ne(this.viewer), H = o && Object.keys(o).length > 0 ? ke(o) : {
|
|
1167
|
+
pageX: a.pageX,
|
|
1168
|
+
pageY: a.pageY
|
|
1169
|
+
};
|
|
1170
|
+
h.x -= P * ((H.pageX - Q.left - c) / _), h.y -= V * ((H.pageY - Q.top - d) / y);
|
|
1171
|
+
} else
|
|
1172
|
+
U(r) && S(r.x) && S(r.y) ? (h.x -= P * ((r.x - c) / _), h.y -= V * ((r.y - d) / y)) : (h.x -= P / 2, h.y -= V / 2);
|
|
1173
|
+
h.left = h.x, h.top = h.y, h.width = E, h.height = R, h.oldRatio = Y, h.ratio = t, this.renderImage(function() {
|
|
1174
|
+
i.zooming = !1, p(l.zoomed) && m(u, Zt, l.zoomed, {
|
|
1175
|
+
once: !0
|
|
1176
|
+
}), I(u, Zt, {
|
|
1177
|
+
ratio: t,
|
|
1178
|
+
oldRatio: Y,
|
|
1179
|
+
originalEvent: a
|
|
1180
|
+
}, {
|
|
1181
|
+
cancelable: !1
|
|
1182
|
+
});
|
|
1183
|
+
}), e && this.tooltip();
|
|
1184
|
+
}
|
|
1185
|
+
return this;
|
|
1186
|
+
},
|
|
1187
|
+
/**
|
|
1188
|
+
* Play the images
|
|
1189
|
+
* @param {boolean|FullscreenOptions} [fullscreen=false] - Indicate if request fullscreen or not.
|
|
1190
|
+
* @returns {Viewer} this
|
|
1191
|
+
*/
|
|
1192
|
+
play: function() {
|
|
1193
|
+
var t = this, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
|
|
1194
|
+
if (!this.isShown || this.played)
|
|
1195
|
+
return this;
|
|
1196
|
+
var e = this.element, r = this.options;
|
|
1197
|
+
if (p(r.play) && m(e, Gt, r.play, {
|
|
1198
|
+
once: !0
|
|
1199
|
+
}), I(e, Gt) === !1)
|
|
1200
|
+
return this;
|
|
1201
|
+
var a = this.player, s = this.loadImage.bind(this), u = [], l = 0, o = 0;
|
|
1202
|
+
if (this.played = !0, this.onLoadWhenPlay = s, i && this.requestFullscreen(i), f(a, q), w(this.items, function(d, _) {
|
|
1203
|
+
var y = d.querySelector("img"), T = document.createElement("img");
|
|
1204
|
+
T.src = B(y, "originalUrl"), T.alt = y.getAttribute("alt"), T.referrerPolicy = y.referrerPolicy, l += 1, f(T, ct), rt(T, D, r.transition), j(d, at) && (f(T, A), o = _), u.push(T), m(T, z, s, {
|
|
1205
|
+
once: !0
|
|
1206
|
+
}), a.appendChild(T);
|
|
1207
|
+
}), S(r.interval) && r.interval > 0) {
|
|
1208
|
+
var h = function d() {
|
|
1209
|
+
clearTimeout(t.playing.timeout), g(u[o], A), o -= 1, o = o >= 0 ? o : l - 1, f(u[o], A), t.playing.timeout = setTimeout(d, r.interval);
|
|
1210
|
+
}, c = function d() {
|
|
1211
|
+
clearTimeout(t.playing.timeout), g(u[o], A), o += 1, o = o < l ? o : 0, f(u[o], A), t.playing.timeout = setTimeout(d, r.interval);
|
|
1212
|
+
};
|
|
1213
|
+
l > 1 && (this.playing = {
|
|
1214
|
+
prev: h,
|
|
1215
|
+
next: c,
|
|
1216
|
+
timeout: setTimeout(c, r.interval)
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1219
|
+
return this;
|
|
1220
|
+
},
|
|
1221
|
+
// Stop play
|
|
1222
|
+
stop: function() {
|
|
1223
|
+
var t = this;
|
|
1224
|
+
if (!this.played)
|
|
1225
|
+
return this;
|
|
1226
|
+
var i = this.element, e = this.options;
|
|
1227
|
+
if (p(e.stop) && m(i, Jt, e.stop, {
|
|
1228
|
+
once: !0
|
|
1229
|
+
}), I(i, Jt) === !1)
|
|
1230
|
+
return this;
|
|
1231
|
+
var r = this.player;
|
|
1232
|
+
return clearTimeout(this.playing.timeout), this.playing = !1, this.played = !1, w(r.getElementsByTagName("img"), function(a) {
|
|
1233
|
+
b(a, z, t.onLoadWhenPlay);
|
|
1234
|
+
}), g(r, q), r.innerHTML = "", this.exitFullscreen(), this;
|
|
1235
|
+
},
|
|
1236
|
+
// Enter modal mode (only available in inline mode)
|
|
1237
|
+
full: function() {
|
|
1238
|
+
var t = this, i = this.options, e = this.viewer, r = this.image, a = this.list;
|
|
1239
|
+
return !this.isShown || this.played || this.fulled || !i.inline ? this : (this.fulled = !0, this.open(), f(this.button, Ot), i.transition && (g(a, D), this.viewed && g(r, D)), f(e, pt), e.setAttribute("role", "dialog"), e.setAttribute("aria-labelledby", this.title.id), e.setAttribute("aria-modal", !0), e.removeAttribute("style"), L(e, {
|
|
1240
|
+
zIndex: i.zIndex
|
|
1241
|
+
}), i.focus && this.enforceFocus(), this.initContainer(), this.viewerData = N({}, this.containerData), this.renderList(), this.viewed && this.initImage(function() {
|
|
1242
|
+
t.renderImage(function() {
|
|
1243
|
+
i.transition && setTimeout(function() {
|
|
1244
|
+
f(r, D), f(a, D);
|
|
1245
|
+
}, 0);
|
|
1246
|
+
});
|
|
1247
|
+
}), this);
|
|
1248
|
+
},
|
|
1249
|
+
// Exit modal mode (only available in inline mode)
|
|
1250
|
+
exit: function() {
|
|
1251
|
+
var t = this, i = this.options, e = this.viewer, r = this.image, a = this.list;
|
|
1252
|
+
return !this.isShown || this.played || !this.fulled || !i.inline ? this : (this.fulled = !1, this.close(), g(this.button, Ot), i.transition && (g(a, D), this.viewed && g(r, D)), i.focus && this.clearEnforceFocus(), e.removeAttribute("role"), e.removeAttribute("aria-labelledby"), e.removeAttribute("aria-modal"), g(e, pt), L(e, {
|
|
1253
|
+
zIndex: i.zIndexInline
|
|
1254
|
+
}), this.viewerData = N({}, this.parentData), this.renderViewer(), this.renderList(), this.viewed && this.initImage(function() {
|
|
1255
|
+
t.renderImage(function() {
|
|
1256
|
+
i.transition && setTimeout(function() {
|
|
1257
|
+
f(r, D), f(a, D);
|
|
1258
|
+
}, 0);
|
|
1259
|
+
});
|
|
1260
|
+
}), this);
|
|
1261
|
+
},
|
|
1262
|
+
// Show the current ratio of the image with percentage
|
|
1263
|
+
tooltip: function() {
|
|
1264
|
+
var t = this, i = this.options, e = this.tooltipBox, r = this.imageData;
|
|
1265
|
+
return !this.viewed || this.played || !i.tooltip ? this : (e.textContent = "".concat(Math.round(r.ratio * 100), "%"), this.tooltipping ? clearTimeout(this.tooltipping) : i.transition ? (this.fading && I(e, k), f(e, q), f(e, ct), f(e, D), e.removeAttribute("aria-hidden"), e.initialOffsetWidth = e.offsetWidth, f(e, A)) : (f(e, q), e.removeAttribute("aria-hidden")), this.tooltipping = setTimeout(function() {
|
|
1266
|
+
i.transition ? (m(e, k, function() {
|
|
1267
|
+
g(e, q), g(e, ct), g(e, D), e.setAttribute("aria-hidden", !0), t.fading = !1;
|
|
1268
|
+
}, {
|
|
1269
|
+
once: !0
|
|
1270
|
+
}), g(e, A), t.fading = !0) : (g(e, q), e.setAttribute("aria-hidden", !0)), t.tooltipping = !1;
|
|
1271
|
+
}, 1e3), this);
|
|
1272
|
+
},
|
|
1273
|
+
/**
|
|
1274
|
+
* Toggle the image size between its current size and natural size
|
|
1275
|
+
* @param {Event} [_originalEvent=null] - The original event if any.
|
|
1276
|
+
* @returns {Viewer} this
|
|
1277
|
+
*/
|
|
1278
|
+
toggle: function() {
|
|
1279
|
+
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
1280
|
+
return this.imageData.ratio === 1 ? this.zoomTo(this.imageData.oldRatio, !0, null, t) : this.zoomTo(1, !0, null, t), this;
|
|
1281
|
+
},
|
|
1282
|
+
// Reset the image to its initial state
|
|
1283
|
+
reset: function() {
|
|
1284
|
+
return this.viewed && !this.played && (this.imageData = N({}, this.initialImageData), this.renderImage()), this;
|
|
1285
|
+
},
|
|
1286
|
+
// Update viewer when images changed
|
|
1287
|
+
update: function() {
|
|
1288
|
+
var t = this, i = this.element, e = this.options, r = this.isImg;
|
|
1289
|
+
if (r && !i.parentNode)
|
|
1290
|
+
return this.destroy();
|
|
1291
|
+
var a = [];
|
|
1292
|
+
if (w(r ? [i] : i.querySelectorAll("img"), function(o) {
|
|
1293
|
+
p(e.filter) ? e.filter.call(t, o) && a.push(o) : t.getImageURL(o) && a.push(o);
|
|
1294
|
+
}), !a.length)
|
|
1295
|
+
return this;
|
|
1296
|
+
if (this.images = a, this.length = a.length, this.ready) {
|
|
1297
|
+
var s = [];
|
|
1298
|
+
if (w(this.items, function(o, h) {
|
|
1299
|
+
var c = o.querySelector("img"), d = a[h];
|
|
1300
|
+
d && c ? (d.src !== c.src || d.alt !== c.alt) && s.push(h) : s.push(h);
|
|
1301
|
+
}), L(this.list, {
|
|
1302
|
+
width: "auto"
|
|
1303
|
+
}), this.initList(), this.isShown)
|
|
1304
|
+
if (this.length) {
|
|
1305
|
+
if (this.viewed) {
|
|
1306
|
+
var u = s.indexOf(this.index);
|
|
1307
|
+
if (u >= 0)
|
|
1308
|
+
this.viewed = !1, this.view(Math.max(Math.min(this.index - u, this.length - 1), 0));
|
|
1309
|
+
else {
|
|
1310
|
+
var l = this.items[this.index];
|
|
1311
|
+
f(l, at), l.setAttribute("aria-selected", !0);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
} else
|
|
1315
|
+
this.image = null, this.viewed = !1, this.index = 0, this.imageData = {}, this.canvas.innerHTML = "", this.title.innerHTML = "";
|
|
1316
|
+
} else
|
|
1317
|
+
this.build();
|
|
1318
|
+
return this;
|
|
1319
|
+
},
|
|
1320
|
+
// Destroy the viewer
|
|
1321
|
+
destroy: function() {
|
|
1322
|
+
var t = this.element, i = this.options;
|
|
1323
|
+
return t[v] ? (this.destroyed = !0, this.ready ? (this.played && this.stop(), i.inline ? (this.fulled && this.exit(), this.unbind()) : this.isShown ? (this.viewing && (this.imageRendering ? this.imageRendering.abort() : this.imageInitializing && this.imageInitializing.abort()), this.hiding && this.transitioning.abort(), this.hidden()) : this.showing && (this.transitioning.abort(), this.hidden()), this.ready = !1, this.viewer.parentNode.removeChild(this.viewer)) : i.inline && (this.delaying ? this.delaying.abort() : this.initializing && this.initializing.abort()), i.inline || b(t, G, this.onStart), t[v] = void 0, this) : this;
|
|
1324
|
+
}
|
|
1325
|
+
}, Me = {
|
|
1326
|
+
getImageURL: function(t) {
|
|
1327
|
+
var i = this.options.url;
|
|
1328
|
+
return nt(i) ? i = t.getAttribute(i) : p(i) ? i = i.call(this, t) : i = "", i;
|
|
1329
|
+
},
|
|
1330
|
+
enforceFocus: function() {
|
|
1331
|
+
var t = this;
|
|
1332
|
+
this.clearEnforceFocus(), m(document, Nt, this.onFocusin = function(i) {
|
|
1333
|
+
var e = t.viewer, r = i.target;
|
|
1334
|
+
if (!(r === document || r === e || e.contains(r))) {
|
|
1335
|
+
for (; r; ) {
|
|
1336
|
+
if (r.getAttribute("tabindex") !== null || r.getAttribute("aria-modal") === "true")
|
|
1337
|
+
return;
|
|
1338
|
+
r = r.parentElement;
|
|
1339
|
+
}
|
|
1340
|
+
e.focus();
|
|
1341
|
+
}
|
|
1342
|
+
});
|
|
1343
|
+
},
|
|
1344
|
+
clearEnforceFocus: function() {
|
|
1345
|
+
this.onFocusin && (b(document, Nt, this.onFocusin), this.onFocusin = null);
|
|
1346
|
+
},
|
|
1347
|
+
open: function() {
|
|
1348
|
+
var t = this.body;
|
|
1349
|
+
f(t, xt), this.scrollbarWidth > 0 && (t.style.paddingRight = "".concat(this.scrollbarWidth + (parseFloat(this.initialBodyComputedPaddingRight) || 0), "px"));
|
|
1350
|
+
},
|
|
1351
|
+
close: function() {
|
|
1352
|
+
var t = this.body;
|
|
1353
|
+
g(t, xt), this.scrollbarWidth > 0 && (t.style.paddingRight = this.initialBodyPaddingRight);
|
|
1354
|
+
},
|
|
1355
|
+
shown: function() {
|
|
1356
|
+
var t = this.element, i = this.options, e = this.viewer;
|
|
1357
|
+
this.fulled = !0, this.isShown = !0, this.render(), this.bind(), this.showing = !1, i.focus && (e.focus(), this.enforceFocus()), p(i.shown) && m(t, Pt, i.shown, {
|
|
1358
|
+
once: !0
|
|
1359
|
+
}), I(t, Pt) !== !1 && this.ready && this.isShown && !this.hiding && this.view(this.index);
|
|
1360
|
+
},
|
|
1361
|
+
hidden: function() {
|
|
1362
|
+
var t = this.element, i = this.options, e = this.viewer;
|
|
1363
|
+
i.fucus && this.clearEnforceFocus(), this.close(), this.unbind(), f(e, W), e.removeAttribute("role"), e.removeAttribute("aria-labelledby"), e.removeAttribute("aria-modal"), e.setAttribute("aria-hidden", !0), this.resetList(), this.resetImage(), this.fulled = !1, this.viewed = !1, this.isShown = !1, this.hiding = !1, this.destroyed || (p(i.hidden) && m(t, Wt, i.hidden, {
|
|
1364
|
+
once: !0
|
|
1365
|
+
}), I(t, Wt, null, {
|
|
1366
|
+
cancelable: !1
|
|
1367
|
+
}));
|
|
1368
|
+
},
|
|
1369
|
+
requestFullscreen: function(t) {
|
|
1370
|
+
var i = this.element.ownerDocument;
|
|
1371
|
+
if (this.fulled && !(i.fullscreenElement || i.webkitFullscreenElement || i.mozFullScreenElement || i.msFullscreenElement)) {
|
|
1372
|
+
var e = i.documentElement;
|
|
1373
|
+
e.requestFullscreen ? U(t) ? e.requestFullscreen(t) : e.requestFullscreen() : e.webkitRequestFullscreen ? e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT) : e.mozRequestFullScreen ? e.mozRequestFullScreen() : e.msRequestFullscreen && e.msRequestFullscreen();
|
|
1374
|
+
}
|
|
1375
|
+
},
|
|
1376
|
+
exitFullscreen: function() {
|
|
1377
|
+
var t = this.element.ownerDocument;
|
|
1378
|
+
this.fulled && (t.fullscreenElement || t.webkitFullscreenElement || t.mozFullScreenElement || t.msFullscreenElement) && (t.exitFullscreen ? t.exitFullscreen() : t.webkitExitFullscreen ? t.webkitExitFullscreen() : t.mozCancelFullScreen ? t.mozCancelFullScreen() : t.msExitFullscreen && t.msExitFullscreen());
|
|
1379
|
+
},
|
|
1380
|
+
change: function(t) {
|
|
1381
|
+
var i = this.options, e = this.pointers, r = e[Object.keys(e)[0]];
|
|
1382
|
+
if (r) {
|
|
1383
|
+
var a = r.endX - r.startX, s = r.endY - r.startY;
|
|
1384
|
+
switch (this.action) {
|
|
1385
|
+
case ut:
|
|
1386
|
+
(a !== 0 || s !== 0) && (this.pointerMoved = !0, this.move(a, s, t));
|
|
1387
|
+
break;
|
|
1388
|
+
case tt:
|
|
1389
|
+
this.zoom(ze(e), !1, null, t);
|
|
1390
|
+
break;
|
|
1391
|
+
case ne: {
|
|
1392
|
+
this.action = "switched";
|
|
1393
|
+
var u = Math.abs(a);
|
|
1394
|
+
u > 1 && u > Math.abs(s) && (this.pointers = {}, a > 1 ? this.prev(i.loop) : a < -1 && this.next(i.loop));
|
|
1395
|
+
break;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
w(e, function(l) {
|
|
1399
|
+
l.startX = l.endX, l.startY = l.endY;
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
},
|
|
1403
|
+
isSwitchable: function() {
|
|
1404
|
+
var t = this.imageData, i = this.viewerData;
|
|
1405
|
+
return this.length > 1 && t.x >= 0 && t.y >= 0 && t.width <= i.width && t.height <= i.height;
|
|
1406
|
+
}
|
|
1407
|
+
}, Pe = M.Viewer, Ye = function(n) {
|
|
1408
|
+
return function() {
|
|
1409
|
+
return n += 1, n;
|
|
1410
|
+
};
|
|
1411
|
+
}(-1), se = /* @__PURE__ */ function() {
|
|
1412
|
+
function n(t) {
|
|
1413
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1414
|
+
if (ce(this, n), !t || t.nodeType !== 1)
|
|
1415
|
+
throw new Error("The first argument is required and must be an element.");
|
|
1416
|
+
this.element = t, this.options = N({}, It, U(i) && i), this.action = !1, this.fading = !1, this.fulled = !1, this.hiding = !1, this.imageClicked = !1, this.imageData = {}, this.index = this.options.initialViewIndex, this.isImg = !1, this.isShown = !1, this.length = 0, this.moving = !1, this.played = !1, this.playing = !1, this.pointers = {}, this.ready = !1, this.rotating = !1, this.scaling = !1, this.showing = !1, this.timeout = !1, this.tooltipping = !1, this.viewed = !1, this.viewing = !1, this.wheeling = !1, this.zooming = !1, this.pointerMoved = !1, this.id = Ye(), this.init();
|
|
1417
|
+
}
|
|
1418
|
+
return fe(n, [{
|
|
1419
|
+
key: "init",
|
|
1420
|
+
value: function() {
|
|
1421
|
+
var i = this, e = this.element, r = this.options;
|
|
1422
|
+
if (!e[v]) {
|
|
1423
|
+
e[v] = this, r.focus && !r.keyboard && (r.focus = !1);
|
|
1424
|
+
var a = e.localName === "img", s = [];
|
|
1425
|
+
if (w(a ? [e] : e.querySelectorAll("img"), function(o) {
|
|
1426
|
+
p(r.filter) ? r.filter.call(i, o) && s.push(o) : i.getImageURL(o) && s.push(o);
|
|
1427
|
+
}), this.isImg = a, this.length = s.length, this.images = s, this.initBody(), $(document.createElement(v).style.transition) && (r.transition = !1), r.inline) {
|
|
1428
|
+
var u = 0, l = function() {
|
|
1429
|
+
if (u += 1, u === i.length) {
|
|
1430
|
+
var h;
|
|
1431
|
+
i.initializing = !1, i.delaying = {
|
|
1432
|
+
abort: function() {
|
|
1433
|
+
clearTimeout(h);
|
|
1434
|
+
}
|
|
1435
|
+
}, h = setTimeout(function() {
|
|
1436
|
+
i.delaying = !1, i.build();
|
|
1437
|
+
}, 0);
|
|
1438
|
+
}
|
|
1439
|
+
};
|
|
1440
|
+
this.initializing = {
|
|
1441
|
+
abort: function() {
|
|
1442
|
+
w(s, function(h) {
|
|
1443
|
+
h.complete || (b(h, z, l), b(h, X, l));
|
|
1444
|
+
});
|
|
1445
|
+
}
|
|
1446
|
+
}, w(s, function(o) {
|
|
1447
|
+
if (o.complete)
|
|
1448
|
+
l();
|
|
1449
|
+
else {
|
|
1450
|
+
var h, c;
|
|
1451
|
+
m(o, z, h = function() {
|
|
1452
|
+
b(o, X, c), l();
|
|
1453
|
+
}, {
|
|
1454
|
+
once: !0
|
|
1455
|
+
}), m(o, X, c = function() {
|
|
1456
|
+
b(o, z, h), l();
|
|
1457
|
+
}, {
|
|
1458
|
+
once: !0
|
|
1459
|
+
});
|
|
1460
|
+
}
|
|
1461
|
+
});
|
|
1462
|
+
} else
|
|
1463
|
+
m(e, G, this.onStart = function(o) {
|
|
1464
|
+
var h = o.target;
|
|
1465
|
+
h.localName === "img" && (!p(r.filter) || r.filter.call(i, h)) && i.view(i.images.indexOf(h));
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
}, {
|
|
1470
|
+
key: "build",
|
|
1471
|
+
value: function() {
|
|
1472
|
+
if (!this.ready) {
|
|
1473
|
+
var i = this.element, e = this.options, r = i.parentNode, a = document.createElement("div");
|
|
1474
|
+
a.innerHTML = ve;
|
|
1475
|
+
var s = a.querySelector(".".concat(v, "-container")), u = s.querySelector(".".concat(v, "-title")), l = s.querySelector(".".concat(v, "-toolbar")), o = s.querySelector(".".concat(v, "-navbar")), h = s.querySelector(".".concat(v, "-button")), c = s.querySelector(".".concat(v, "-canvas"));
|
|
1476
|
+
if (this.parent = r, this.viewer = s, this.title = u, this.toolbar = l, this.navbar = o, this.button = h, this.canvas = c, this.footer = s.querySelector(".".concat(v, "-footer")), this.tooltipBox = s.querySelector(".".concat(v, "-tooltip")), this.player = s.querySelector(".".concat(v, "-player")), this.list = s.querySelector(".".concat(v, "-list")), s.id = "".concat(v).concat(this.id), u.id = "".concat(v, "Title").concat(this.id), f(u, e.title ? ot(Array.isArray(e.title) ? e.title[0] : e.title) : W), f(o, e.navbar ? ot(e.navbar) : W), rt(h, W, !e.button), e.keyboard && h.setAttribute("tabindex", 0), e.backdrop && (f(s, "".concat(v, "-backdrop")), !e.inline && e.backdrop !== "static" && wt(c, dt, "hide")), nt(e.className) && e.className && e.className.split(_t).forEach(function(E) {
|
|
1477
|
+
f(s, E);
|
|
1478
|
+
}), e.toolbar) {
|
|
1479
|
+
var d = document.createElement("ul"), _ = U(e.toolbar), y = st.slice(0, 3), T = st.slice(7, 9), O = st.slice(9);
|
|
1480
|
+
_ || f(l, ot(e.toolbar)), w(_ ? e.toolbar : st, function(E, R) {
|
|
1481
|
+
var P = _ && U(E), V = _ ? Tt(R) : E, Y = P && !$(E.show) ? E.show : E;
|
|
1482
|
+
if (!(!Y || !e.zoomable && y.indexOf(V) !== -1 || !e.rotatable && T.indexOf(V) !== -1 || !e.scalable && O.indexOf(V) !== -1)) {
|
|
1483
|
+
var Q = P && !$(E.size) ? E.size : E, H = P && !$(E.click) ? E.click : E, F = document.createElement("li");
|
|
1484
|
+
e.keyboard && F.setAttribute("tabindex", 0), F.setAttribute("role", "button"), f(F, "".concat(v, "-").concat(V)), p(H) || wt(F, dt, V), S(Y) && f(F, ot(Y)), ["small", "large"].indexOf(Q) !== -1 ? f(F, "".concat(v, "-").concat(Q)) : V === "play" && f(F, "".concat(v, "-large")), p(H) && m(F, G, H), d.appendChild(F);
|
|
1485
|
+
}
|
|
1486
|
+
}), l.appendChild(d);
|
|
1487
|
+
} else
|
|
1488
|
+
f(l, W);
|
|
1489
|
+
if (!e.rotatable) {
|
|
1490
|
+
var x = l.querySelectorAll('li[class*="rotate"]');
|
|
1491
|
+
f(x, et), w(x, function(E) {
|
|
1492
|
+
l.appendChild(E);
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
if (e.inline)
|
|
1496
|
+
f(h, pe), L(s, {
|
|
1497
|
+
zIndex: e.zIndexInline
|
|
1498
|
+
}), window.getComputedStyle(r).position === "static" && L(r, {
|
|
1499
|
+
position: "relative"
|
|
1500
|
+
}), r.insertBefore(s, i.nextSibling);
|
|
1501
|
+
else {
|
|
1502
|
+
f(h, ge), f(s, pt), f(s, ct), f(s, W), L(s, {
|
|
1503
|
+
zIndex: e.zIndex
|
|
1504
|
+
});
|
|
1505
|
+
var C = e.container;
|
|
1506
|
+
nt(C) && (C = i.ownerDocument.querySelector(C)), C || (C = this.body), C.appendChild(s);
|
|
1507
|
+
}
|
|
1508
|
+
if (e.inline && (this.render(), this.bind(), this.isShown = !0), this.ready = !0, p(e.ready) && m(i, Ft, e.ready, {
|
|
1509
|
+
once: !0
|
|
1510
|
+
}), I(i, Ft) === !1) {
|
|
1511
|
+
this.ready = !1;
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1514
|
+
this.ready && e.inline && this.view(this.index);
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* Get the no conflict viewer class.
|
|
1519
|
+
* @returns {Viewer} The viewer class.
|
|
1520
|
+
*/
|
|
1521
|
+
}], [{
|
|
1522
|
+
key: "noConflict",
|
|
1523
|
+
value: function() {
|
|
1524
|
+
return window.Viewer = Pe, n;
|
|
1525
|
+
}
|
|
1526
|
+
/**
|
|
1527
|
+
* Change the default options.
|
|
1528
|
+
* @param {Object} options - The new default options.
|
|
1529
|
+
*/
|
|
1530
|
+
}, {
|
|
1531
|
+
key: "setDefaults",
|
|
1532
|
+
value: function(i) {
|
|
1533
|
+
N(It, U(i) && i);
|
|
1534
|
+
}
|
|
1535
|
+
}]), n;
|
|
1536
|
+
}();
|
|
1537
|
+
N(se.prototype, Le, Ve, Re, Fe, Me);
|
|
1538
|
+
const We = typeof window < "u" && window !== null;
|
|
1539
|
+
Xe();
|
|
1540
|
+
function Xe() {
|
|
1541
|
+
return We && "IntersectionObserver" in window && "IntersectionObserverEntry" in window && "intersectionRatio" in window.IntersectionObserverEntry.prototype ? ("isIntersecting" in window.IntersectionObserverEntry.prototype || Object.defineProperty(window.IntersectionObserverEntry.prototype, "isIntersecting", {
|
|
1542
|
+
get() {
|
|
1543
|
+
return this.intersectionRatio > 0;
|
|
1544
|
+
}
|
|
1545
|
+
}), !0) : !1;
|
|
1546
|
+
}
|
|
1547
|
+
var He = function() {
|
|
1548
|
+
var n = this, t = n.$createElement, i = n._self._c || t;
|
|
1549
|
+
return i("div", [n._t("default", null, { images: n.images, options: n.options })], 2);
|
|
1550
|
+
}, qe = [];
|
|
1551
|
+
function je(n, t, i, e, r, a, s, u) {
|
|
1552
|
+
var l = typeof n == "function" ? n.options : n;
|
|
1553
|
+
t && (l.render = t, l.staticRenderFns = i, l._compiled = !0), e && (l.functional = !0), a && (l._scopeId = "data-v-" + a);
|
|
1554
|
+
var o;
|
|
1555
|
+
if (s ? (o = function(d) {
|
|
1556
|
+
d = d || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !d && typeof __VUE_SSR_CONTEXT__ < "u" && (d = __VUE_SSR_CONTEXT__), r && r.call(this, d), d && d._registeredComponents && d._registeredComponents.add(s);
|
|
1557
|
+
}, l._ssrRegister = o) : r && (o = u ? function() {
|
|
1558
|
+
r.call(this, (l.functional ? this.parent : this).$root.$options.shadowRoot);
|
|
1559
|
+
} : r), o)
|
|
1560
|
+
if (l.functional) {
|
|
1561
|
+
l._injectStyles = o;
|
|
1562
|
+
var h = l.render;
|
|
1563
|
+
l.render = function(_, y) {
|
|
1564
|
+
return o.call(y), h(_, y);
|
|
1565
|
+
};
|
|
1566
|
+
} else {
|
|
1567
|
+
var c = l.beforeCreate;
|
|
1568
|
+
l.beforeCreate = c ? [].concat(c, o) : [o];
|
|
1569
|
+
}
|
|
1570
|
+
return {
|
|
1571
|
+
exports: n,
|
|
1572
|
+
options: l
|
|
1573
|
+
};
|
|
1574
|
+
}
|
|
1575
|
+
const $e = {
|
|
1576
|
+
props: {
|
|
1577
|
+
images: {
|
|
1578
|
+
type: Array
|
|
1579
|
+
},
|
|
1580
|
+
rebuild: {
|
|
1581
|
+
type: Boolean,
|
|
1582
|
+
default: !1
|
|
1583
|
+
},
|
|
1584
|
+
trigger: {},
|
|
1585
|
+
options: {
|
|
1586
|
+
type: Object
|
|
1587
|
+
}
|
|
1588
|
+
},
|
|
1589
|
+
data() {
|
|
1590
|
+
return {};
|
|
1591
|
+
},
|
|
1592
|
+
computed: {},
|
|
1593
|
+
watch: {
|
|
1594
|
+
images() {
|
|
1595
|
+
this.$nextTick(() => {
|
|
1596
|
+
this.onChange();
|
|
1597
|
+
});
|
|
1598
|
+
},
|
|
1599
|
+
trigger: {
|
|
1600
|
+
handler() {
|
|
1601
|
+
this.$nextTick(() => {
|
|
1602
|
+
this.onChange();
|
|
1603
|
+
});
|
|
1604
|
+
},
|
|
1605
|
+
deep: !0
|
|
1606
|
+
},
|
|
1607
|
+
options: {
|
|
1608
|
+
handler() {
|
|
1609
|
+
this.$nextTick(() => {
|
|
1610
|
+
this.rebuildViewer();
|
|
1611
|
+
});
|
|
1612
|
+
},
|
|
1613
|
+
deep: !0
|
|
1614
|
+
}
|
|
1615
|
+
},
|
|
1616
|
+
mounted() {
|
|
1617
|
+
this.createViewer();
|
|
1618
|
+
},
|
|
1619
|
+
unmounted() {
|
|
1620
|
+
this.destroyViewer();
|
|
1621
|
+
},
|
|
1622
|
+
methods: {
|
|
1623
|
+
onChange() {
|
|
1624
|
+
this.rebuild ? this.rebuildViewer() : this.updateViewer();
|
|
1625
|
+
},
|
|
1626
|
+
rebuildViewer() {
|
|
1627
|
+
this.destroyViewer(), this.createViewer();
|
|
1628
|
+
},
|
|
1629
|
+
updateViewer() {
|
|
1630
|
+
this.$viewer ? (this.$viewer.update(), this.$emit("inited", this.$viewer)) : this.createViewer();
|
|
1631
|
+
},
|
|
1632
|
+
destroyViewer() {
|
|
1633
|
+
this.$viewer && this.$viewer.destroy();
|
|
1634
|
+
},
|
|
1635
|
+
createViewer() {
|
|
1636
|
+
this.$viewer = new se(this.$el, this.options), this.$emit("inited", this.$viewer);
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
}, Qt = {};
|
|
1640
|
+
var Ue = /* @__PURE__ */ je($e, He, qe, !1, Be, null, null, null);
|
|
1641
|
+
function Be(n) {
|
|
1642
|
+
for (let t in Qt)
|
|
1643
|
+
this[t] = Qt[t];
|
|
1644
|
+
}
|
|
1645
|
+
var Ke = /* @__PURE__ */ function() {
|
|
1646
|
+
return Ue.exports;
|
|
1647
|
+
}(), ht = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Ze = typeof ht == "object" && ht && ht.Object === Object && ht, Ge = Ze, Je = Ge, Qe = typeof self == "object" && self && self.Object === Object && self, ti = Je || Qe || Function("return this")(), ei = ti, ii = ei, ni = ii.Symbol, oe = ni, te = oe;
|
|
1648
|
+
te && te.toStringTag;
|
|
1649
|
+
var ee = oe;
|
|
1650
|
+
ee && ee.toStringTag;
|
|
1651
|
+
const ri = /* @__PURE__ */ le({
|
|
1652
|
+
__name: "ImageViewer",
|
|
1653
|
+
props: {
|
|
1654
|
+
image: null
|
|
1655
|
+
},
|
|
1656
|
+
setup(n) {
|
|
1657
|
+
const t = n, i = he(() => t.image ? [{ src: t.image, index: 0 }] : []);
|
|
1658
|
+
return { __sfc: !0, props: t, images: i, VueViewer: Ke };
|
|
1659
|
+
}
|
|
1660
|
+
});
|
|
1661
|
+
var ai = function() {
|
|
1662
|
+
var t = this, i = t._self._c, e = t._self._setupProxy;
|
|
1663
|
+
return i(e.VueViewer, { staticStyle: { height: "100%" }, attrs: { images: e.images } }, t._l(e.images, function(r) {
|
|
1664
|
+
return i("img", { key: r.index, staticClass: "image", attrs: { alt: "图片", src: r.src } });
|
|
1665
|
+
}), 0);
|
|
1666
|
+
}, si = [], oi = /* @__PURE__ */ ue(
|
|
1667
|
+
ri,
|
|
1668
|
+
ai,
|
|
1669
|
+
si,
|
|
1670
|
+
!1,
|
|
1671
|
+
null,
|
|
1672
|
+
"b0f61c51",
|
|
1673
|
+
null,
|
|
1674
|
+
null
|
|
1675
|
+
);
|
|
1676
|
+
const ui = oi.exports;
|
|
1677
|
+
export {
|
|
1678
|
+
ui as default
|
|
1679
|
+
};
|