@lazycatcloud/vue-media-preview 0.1.2 → 0.1.4
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 +2 -1
- package/dist/components/MediaPreview.vue.d.ts +1 -1
- package/dist/components/PreviewStage.vue.d.ts +3 -2
- package/dist/core/gestures/dismissGesture.d.ts +3 -0
- package/dist/core/gestures/openingGesture.d.ts +18 -0
- package/dist/core/gestures/pointerVelocity.d.ts +7 -0
- package/dist/core/gestures/zoomBounds.d.ts +5 -0
- package/dist/core/resources/image/gif.d.ts +4 -0
- package/dist/core/resources/image/types.d.ts +16 -0
- package/dist/core/resources/imageOwnership.d.ts +1 -0
- package/dist/core/resources/imageResource.d.ts +3 -9
- package/dist/core/types.d.ts +6 -0
- package/dist/core/usePreviewViewport.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/renderers/ImageCanvasRenderer.vue.d.ts +11 -5
- package/dist/renderers/LivePhotoRenderer.vue.d.ts +5 -0
- package/dist/renderers/VideoDomRenderer.vue.d.ts +6 -1
- package/dist/renderers/image/AnimatedImageLayer.vue.d.ts +17 -0
- package/dist/vue-media-preview.cjs +2 -2
- package/dist/vue-media-preview.js +1616 -1437
- package/docs/testing.md +4 -0
- package/docs/vue-media-preview.md +21 -1
- package/package.json +1 -1
|
@@ -1,115 +1,183 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ref as
|
|
5
|
-
function
|
|
1
|
+
var Zt = Object.defineProperty;
|
|
2
|
+
var jt = (t, n, r) => n in t ? Zt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[n] = r;
|
|
3
|
+
var tt = (t, n, r) => jt(t, typeof n != "symbol" ? n + "" : n, r);
|
|
4
|
+
import { ref as $, onMounted as qe, watch as te, onBeforeUnmount as Te, shallowRef as ft, reactive as mt, computed as V, defineComponent as $e, openBlock as q, createElementBlock as _, createElementVNode as T, normalizeStyle as we, nextTick as Se, Fragment as Fe, createBlock as We, createCommentVNode as le, withModifiers as re, unref as f, normalizeClass as De, mergeProps as Ne, toHandlers as gt, createVNode as Ie, renderList as Ze, createTextVNode as Gt, toDisplayString as ce, withKeys as nt, Teleport as Ct, resolveDynamicComponent as Kt, useAttrs as Qt, getCurrentInstance as Jt, withDirectives as en, vShow as tn, renderSlot as ut } from "vue";
|
|
5
|
+
function He(t, n) {
|
|
6
|
+
return Math.hypot(t.x - n.x, t.y - n.y);
|
|
7
|
+
}
|
|
8
|
+
function yt(t, n) {
|
|
9
|
+
return { x: (t.x + n.x) / 2, y: (t.y + n.y) / 2 };
|
|
10
|
+
}
|
|
11
|
+
function Lt(t, n, r) {
|
|
12
|
+
return Math.hypot(t, n) < 9 ? "pending" : r > 1.01 ? "pan" : Math.abs(t) > Math.abs(n) * 1.1 ? "page" : n > 0 && Math.abs(n) > Math.abs(t) * 1.1 ? "dismiss" : "pending";
|
|
13
|
+
}
|
|
14
|
+
function $t(t, n, r) {
|
|
15
|
+
return t > Math.min(r.width, r.height) * 0.14 || t > 16 && n > 0.35;
|
|
16
|
+
}
|
|
17
|
+
function Ft() {
|
|
18
|
+
let t = { x: 0, y: 0, time: 0 }, n = { x: 0, y: 0 };
|
|
19
|
+
return {
|
|
20
|
+
reset(r, e) {
|
|
21
|
+
t = { ...r, time: e }, n = { x: 0, y: 0 };
|
|
22
|
+
},
|
|
23
|
+
move(r, e) {
|
|
24
|
+
const i = Math.max(8, e - t.time);
|
|
25
|
+
n = { x: (r.x - t.x) / i, y: (r.y - t.y) / i }, t = { ...r, time: e };
|
|
26
|
+
},
|
|
27
|
+
read(r) {
|
|
28
|
+
return r - t.time < 100 ? n : { x: 0, y: 0 };
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function nn() {
|
|
33
|
+
const t = /* @__PURE__ */ new Map();
|
|
34
|
+
let n = !1;
|
|
35
|
+
function r() {
|
|
36
|
+
t.clear(), n = !1;
|
|
37
|
+
}
|
|
38
|
+
function e() {
|
|
39
|
+
const a = !n && t.size === 1 ? { kind: "pointer", ...t.values().next().value } : { kind: "empty" };
|
|
40
|
+
return r(), a;
|
|
41
|
+
}
|
|
42
|
+
function i(a) {
|
|
43
|
+
if (!t.has(a.pointerId)) return;
|
|
44
|
+
const o = t.get(a.pointerId);
|
|
45
|
+
o.latest = a, o.velocity.move({ x: a.clientX, y: a.clientY }, a.timeStamp);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
clear: r,
|
|
49
|
+
take: e,
|
|
50
|
+
move: i,
|
|
51
|
+
start(a) {
|
|
52
|
+
if (a.pointerType === "mouse" && a.button !== 0) return;
|
|
53
|
+
const o = a.target;
|
|
54
|
+
if (o.closest("button, input, a, select")) return;
|
|
55
|
+
const l = Ft();
|
|
56
|
+
l.reset({ x: a.clientX, y: a.clientY }, a.timeStamp), t.set(a.pointerId, { down: a, latest: a, target: o, velocity: l }), n || (n = t.size > 1);
|
|
57
|
+
},
|
|
58
|
+
finish(a, o) {
|
|
59
|
+
if (!t.has(a.pointerId)) return !1;
|
|
60
|
+
if (n)
|
|
61
|
+
return t.delete(a.pointerId), t.size === 0 && r(), !1;
|
|
62
|
+
const l = e();
|
|
63
|
+
if (l.kind === "empty") return !1;
|
|
64
|
+
const u = a.clientX - l.down.clientX, p = a.clientY - l.down.clientY, c = l.velocity.read(a.timeStamp).y;
|
|
65
|
+
return Lt(u, p, 1) === "dismiss" && $t(p, c, o);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function Ve(t) {
|
|
6
70
|
return t instanceof Error ? t : new Error(String(t));
|
|
7
71
|
}
|
|
8
|
-
function
|
|
9
|
-
let n = 0,
|
|
72
|
+
function an(t) {
|
|
73
|
+
let n = 0, r = () => {
|
|
10
74
|
};
|
|
11
75
|
function e() {
|
|
12
76
|
n += 1;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
},
|
|
77
|
+
const a = r;
|
|
78
|
+
r = () => {
|
|
79
|
+
}, a();
|
|
16
80
|
}
|
|
17
|
-
function
|
|
81
|
+
function i() {
|
|
18
82
|
e(), t.reset();
|
|
19
83
|
}
|
|
20
84
|
return {
|
|
21
|
-
clear:
|
|
85
|
+
clear: i,
|
|
22
86
|
dispose: e,
|
|
23
|
-
start(
|
|
24
|
-
|
|
87
|
+
start(a, o, l) {
|
|
88
|
+
i();
|
|
25
89
|
const u = n;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
(
|
|
30
|
-
u === n && t.error(
|
|
90
|
+
r = l(
|
|
91
|
+
a,
|
|
92
|
+
o,
|
|
93
|
+
(p) => {
|
|
94
|
+
u === n && t.error(p);
|
|
31
95
|
},
|
|
32
|
-
(
|
|
33
|
-
u === n && t.duration(
|
|
96
|
+
(p) => {
|
|
97
|
+
u === n && t.duration(p);
|
|
34
98
|
}
|
|
35
99
|
);
|
|
36
100
|
}
|
|
37
101
|
};
|
|
38
102
|
}
|
|
39
|
-
const
|
|
103
|
+
const it = (t, n) => (t.src = n.videoSrc || n.src, () => {
|
|
40
104
|
t.removeAttribute("src"), t.load();
|
|
41
105
|
});
|
|
42
|
-
function Tt(t, n,
|
|
43
|
-
const
|
|
44
|
-
let
|
|
106
|
+
function Tt(t, n, r, e, i) {
|
|
107
|
+
const a = $(0), o = an(i);
|
|
108
|
+
let l = () => {
|
|
45
109
|
};
|
|
46
110
|
return qe(() => {
|
|
47
|
-
|
|
48
|
-
() => [n().id, n().src, n().videoSrc,
|
|
111
|
+
l = te(
|
|
112
|
+
() => [n().id, n().src, n().videoSrc, r(), e(), a.value],
|
|
49
113
|
() => {
|
|
50
|
-
|
|
114
|
+
r() ? o.start(t(), n(), e()) : o.clear();
|
|
51
115
|
},
|
|
52
116
|
{ immediate: !0, flush: "post" }
|
|
53
117
|
);
|
|
54
|
-
}),
|
|
55
|
-
|
|
56
|
-
}), () =>
|
|
118
|
+
}), Te(() => {
|
|
119
|
+
l(), o.dispose();
|
|
120
|
+
}), () => a.value++;
|
|
57
121
|
}
|
|
58
|
-
function
|
|
59
|
-
return Math.min(Math.max(t, n),
|
|
122
|
+
function J(t, n, r) {
|
|
123
|
+
return Math.min(Math.max(t, n), r);
|
|
60
124
|
}
|
|
61
|
-
function
|
|
125
|
+
function wt(t, n = 2) {
|
|
62
126
|
return Number(t.toFixed(n));
|
|
63
127
|
}
|
|
64
|
-
function
|
|
128
|
+
function rn(t, n) {
|
|
65
129
|
return t.width <= 0 || t.height <= 0 || n.width <= 0 || n.height <= 0 ? 1 : Math.min(n.width / t.width, n.height / t.height);
|
|
66
130
|
}
|
|
67
|
-
function
|
|
131
|
+
function bt(t) {
|
|
68
132
|
const n = (t % 360 + 360) % 360;
|
|
69
133
|
return n === 90 || n === 180 || n === 270 ? n : 0;
|
|
70
134
|
}
|
|
71
|
-
function
|
|
135
|
+
function on(t, n) {
|
|
72
136
|
return n === 90 || n === 270 ? { width: t.height, height: t.width } : t;
|
|
73
137
|
}
|
|
74
|
-
function
|
|
75
|
-
return `translate3d(${
|
|
138
|
+
function ln(t, n, r) {
|
|
139
|
+
return `translate3d(${wt(t)}px, ${wt(n)}px, 0) scale3d(${r}, ${r}, 1)`;
|
|
76
140
|
}
|
|
77
|
-
function
|
|
141
|
+
function sn(t) {
|
|
78
142
|
return 1 - (1 - t) ** 3;
|
|
79
143
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
144
|
+
const un = 16;
|
|
145
|
+
function cn(t, n) {
|
|
146
|
+
const r = t < 1 ? 1 : n;
|
|
147
|
+
if (t >= 1 && t <= n) return t;
|
|
148
|
+
const e = Math.abs(t - r), i = r * 0.25;
|
|
149
|
+
return r + Math.sign(t - r) * (i * e) / (i + e);
|
|
85
150
|
}
|
|
86
|
-
function
|
|
87
|
-
|
|
151
|
+
function dn(t, n) {
|
|
152
|
+
const r = t < 1 ? 1 : n;
|
|
153
|
+
if (t >= 1 && t <= n) return t;
|
|
154
|
+
const e = Math.abs(t - r), i = r * 0.25;
|
|
155
|
+
return r + Math.sign(t - r) * (i * e) / Math.max(Number.EPSILON, i - e);
|
|
88
156
|
}
|
|
89
|
-
function
|
|
157
|
+
function fn(t, n) {
|
|
90
158
|
return t.deltaMode === 1 ? 2 ** (-t.deltaY * 0.05) : t.deltaMode === 2 ? 2 ** -t.deltaY : n || Math.abs(t.deltaY) >= 40 ? 2 ** (-t.deltaY * 2e-3) : Math.exp(-t.deltaY * 8e-3);
|
|
91
159
|
}
|
|
92
|
-
function
|
|
160
|
+
function mn(t, n, r = 650) {
|
|
93
161
|
let e = { kind: "idle" };
|
|
94
|
-
function a() {
|
|
95
|
-
const l = e;
|
|
96
|
-
e = { kind: "idle" }, l.kind === "pending" && clearTimeout(l.timer), l.kind === "active" && n();
|
|
97
|
-
}
|
|
98
162
|
function i() {
|
|
99
|
-
|
|
163
|
+
const o = e;
|
|
164
|
+
e = { kind: "idle" }, o.kind === "pending" && clearTimeout(o.timer), o.kind === "active" && n();
|
|
165
|
+
}
|
|
166
|
+
function a() {
|
|
167
|
+
i(), e = {
|
|
100
168
|
kind: "pending",
|
|
101
169
|
timer: setTimeout(() => {
|
|
102
170
|
e = { kind: "active" }, t();
|
|
103
|
-
},
|
|
171
|
+
}, r)
|
|
104
172
|
};
|
|
105
173
|
}
|
|
106
|
-
return { arm:
|
|
174
|
+
return { arm: a, cancel: i };
|
|
107
175
|
}
|
|
108
|
-
function
|
|
109
|
-
const e =
|
|
110
|
-
return { offsetX: e, pageOffset:
|
|
176
|
+
function gn(t, n, r) {
|
|
177
|
+
const e = J(t, -n, n);
|
|
178
|
+
return { offsetX: e, pageOffset: r ? t - e : 0 };
|
|
111
179
|
}
|
|
112
|
-
function
|
|
180
|
+
function pn(t = {}) {
|
|
113
181
|
const n = {
|
|
114
182
|
motionActive: () => !1,
|
|
115
183
|
onTap: () => {
|
|
@@ -128,20 +196,20 @@ function ln(t = {}) {
|
|
|
128
196
|
},
|
|
129
197
|
onPageDrag: (d) => {
|
|
130
198
|
},
|
|
131
|
-
onPageRelease: (d,
|
|
199
|
+
onPageRelease: (d, z) => {
|
|
132
200
|
Math.abs(d) < 60 || (d < 0 ? n.onSwipeLeft() : n.onSwipeRight());
|
|
133
201
|
},
|
|
134
202
|
interactive: () => !0,
|
|
135
203
|
zoomable: () => !0,
|
|
136
204
|
doubleTapZoom: () => 2.5,
|
|
137
|
-
zoomLimit: () =>
|
|
205
|
+
zoomLimit: () => un,
|
|
138
206
|
holdable: () => !1,
|
|
139
207
|
onHoldStart: () => {
|
|
140
208
|
},
|
|
141
209
|
onHoldEnd: () => {
|
|
142
210
|
},
|
|
143
211
|
...t
|
|
144
|
-
},
|
|
212
|
+
}, r = $(), e = $(), i = ft(), a = $({ width: 1, height: 1 }), o = $({ width: 1, height: 1 }), l = mt({
|
|
145
213
|
level: 1,
|
|
146
214
|
offsetX: 0,
|
|
147
215
|
offsetY: 0,
|
|
@@ -151,287 +219,329 @@ function ln(t = {}) {
|
|
|
151
219
|
downOffsetX: 0,
|
|
152
220
|
downOffsetY: 0,
|
|
153
221
|
downScale: 1
|
|
154
|
-
}), u =
|
|
222
|
+
}), u = V(() => on(o.value, l.rotation)), p = V(() => rn(u.value, a.value)), c = V(() => p.value * l.level), x = V(() => ({
|
|
155
223
|
width: u.value.width * c.value,
|
|
156
224
|
height: u.value.height * c.value
|
|
157
|
-
})),
|
|
158
|
-
transform:
|
|
159
|
-
})), S = /* @__PURE__ */ new Set(),
|
|
160
|
-
() =>
|
|
225
|
+
})), L = V(() => ({
|
|
226
|
+
transform: ln(l.downOffsetX, l.downOffsetY, l.downScale)
|
|
227
|
+
})), S = /* @__PURE__ */ new Set(), E = $(!1), w = $(!1), g = $(!1), B = V(
|
|
228
|
+
() => E.value || w.value || g.value || n.motionActive()
|
|
161
229
|
);
|
|
162
|
-
let
|
|
163
|
-
}, 0),
|
|
164
|
-
const
|
|
165
|
-
let
|
|
166
|
-
const
|
|
230
|
+
let O, h = 0, k = 0, m = setTimeout(() => {
|
|
231
|
+
}, 0), y = -1e3, P = { x: 0, y: 0 }, v = !1, R = "idle", F = !0, C = !1, D = 0;
|
|
232
|
+
const A = /* @__PURE__ */ new Map();
|
|
233
|
+
let Z = { x: 0, y: 0 };
|
|
234
|
+
const K = Ft();
|
|
235
|
+
let be = 0, ne = { left: 0, top: 0 }, me = 1, oe = 1, Pe = { x: 0, y: 0 }, ee = pe();
|
|
236
|
+
const I = mn(
|
|
167
237
|
() => {
|
|
168
|
-
|
|
238
|
+
R = "hold", clearTimeout(m), y = -1e3, n.onHoldStart();
|
|
169
239
|
},
|
|
170
240
|
() => n.onHoldEnd()
|
|
171
|
-
),
|
|
172
|
-
for (const
|
|
173
|
-
}),
|
|
174
|
-
(d.key === "Control" || d.key === "Meta") &&
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
},
|
|
178
|
-
document.hidden &&
|
|
241
|
+
), U = new ResizeObserver((d) => {
|
|
242
|
+
for (const z of d) de(z.contentRect);
|
|
243
|
+
}), Y = /* @__PURE__ */ new Set(), Oe = (d) => {
|
|
244
|
+
(d.key === "Control" || d.key === "Meta") && Y.add(d.key);
|
|
245
|
+
}, Qe = (d) => Y.delete(d.key), ae = () => {
|
|
246
|
+
I.cancel(), Y.clear();
|
|
247
|
+
}, ge = () => {
|
|
248
|
+
document.hidden && I.cancel();
|
|
179
249
|
};
|
|
180
250
|
qe(() => {
|
|
181
|
-
|
|
182
|
-
}),
|
|
183
|
-
|
|
251
|
+
U.observe(r.value), de(r.value.getBoundingClientRect()), window.addEventListener("keydown", Oe), window.addEventListener("keyup", Qe), window.addEventListener("blur", ae), document.addEventListener("visibilitychange", ge);
|
|
252
|
+
}), Te(() => {
|
|
253
|
+
v = !0, I.cancel(), window.removeEventListener("keydown", Oe), window.removeEventListener("keyup", Qe), window.removeEventListener("blur", ae), document.removeEventListener("visibilitychange", ge), U.disconnect(), cancelAnimationFrame(h), cancelAnimationFrame(k), clearTimeout(m), clearTimeout(O);
|
|
184
254
|
});
|
|
185
|
-
function
|
|
186
|
-
|
|
255
|
+
function de(d) {
|
|
256
|
+
a.value = { width: d.width, height: d.height }, Object.assign(l, G(l.offsetX, l.offsetY, l.level)), ke();
|
|
187
257
|
}
|
|
188
|
-
function
|
|
189
|
-
|
|
190
|
-
|
|
258
|
+
function ke() {
|
|
259
|
+
v || h || (h = requestAnimationFrame(() => {
|
|
260
|
+
h = 0, S.forEach((d) => d());
|
|
191
261
|
}));
|
|
192
262
|
}
|
|
193
|
-
function
|
|
194
|
-
return { level:
|
|
263
|
+
function pe() {
|
|
264
|
+
return { level: l.level, offsetX: l.offsetX, offsetY: l.offsetY };
|
|
195
265
|
}
|
|
196
|
-
function
|
|
197
|
-
const
|
|
266
|
+
function G(d, z, X) {
|
|
267
|
+
const j = Math.max(
|
|
198
268
|
0,
|
|
199
|
-
(u.value.width *
|
|
200
|
-
),
|
|
269
|
+
(u.value.width * p.value * X - a.value.width) / 2
|
|
270
|
+
), N = Math.max(
|
|
201
271
|
0,
|
|
202
|
-
(u.value.height *
|
|
272
|
+
(u.value.height * p.value * X - a.value.height) / 2
|
|
203
273
|
);
|
|
204
|
-
return { offsetX:
|
|
205
|
-
}
|
|
206
|
-
function
|
|
207
|
-
Object.assign(
|
|
208
|
-
}
|
|
209
|
-
function
|
|
210
|
-
cancelAnimationFrame(
|
|
211
|
-
const X =
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
level: X.level + (d.level - X.level) *
|
|
215
|
-
offsetX: X.offsetX + (d.offsetX - X.offsetX) *
|
|
216
|
-
offsetY: X.offsetY + (d.offsetY - X.offsetY) *
|
|
217
|
-
}),
|
|
274
|
+
return { offsetX: J(d, -j, j), offsetY: J(z, -N, N) };
|
|
275
|
+
}
|
|
276
|
+
function xe(d) {
|
|
277
|
+
Object.assign(l, d), n.onScale(l.level), ke();
|
|
278
|
+
}
|
|
279
|
+
function se(d, z = 250) {
|
|
280
|
+
cancelAnimationFrame(k), E.value = !0;
|
|
281
|
+
const X = pe(), j = performance.now(), N = matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : z, Q = (ye) => {
|
|
282
|
+
const Me = N === 0 ? 1 : J((ye - j) / N, 0, 1), Le = sn(Me);
|
|
283
|
+
xe({
|
|
284
|
+
level: X.level + (d.level - X.level) * Le,
|
|
285
|
+
offsetX: X.offsetX + (d.offsetX - X.offsetX) * Le,
|
|
286
|
+
offsetY: X.offsetY + (d.offsetY - X.offsetY) * Le
|
|
287
|
+
}), Me < 1 ? k = requestAnimationFrame(Q) : E.value = !1;
|
|
218
288
|
};
|
|
219
|
-
|
|
289
|
+
k = requestAnimationFrame(Q);
|
|
220
290
|
}
|
|
221
|
-
function
|
|
222
|
-
return { x:
|
|
291
|
+
function fe() {
|
|
292
|
+
return { x: a.value.width / 2, y: a.value.height / 2 };
|
|
223
293
|
}
|
|
224
|
-
function
|
|
294
|
+
function he(d, z = fe(), X = !1) {
|
|
225
295
|
if (!n.zoomable()) return;
|
|
226
|
-
cancelAnimationFrame(
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
),
|
|
232
|
-
X ?
|
|
296
|
+
cancelAnimationFrame(k), E.value = !1;
|
|
297
|
+
const j = J(d, 1, n.zoomLimit()), N = j / l.level, Q = fe(), ye = G(
|
|
298
|
+
z.x - Q.x - (z.x - Q.x - l.offsetX) * N,
|
|
299
|
+
z.y - Q.y - (z.y - Q.y - l.offsetY) * N,
|
|
300
|
+
j
|
|
301
|
+
), Me = { level: j, ...ye };
|
|
302
|
+
X ? se(Me) : xe(Me);
|
|
233
303
|
}
|
|
234
|
-
function
|
|
235
|
-
|
|
304
|
+
function Re() {
|
|
305
|
+
l.draggingDown = !1, l.downOffsetX = 0, l.downOffsetY = 0, l.downScale = 1, n.onSwipeDownProgress(0);
|
|
236
306
|
}
|
|
237
|
-
function
|
|
238
|
-
d && (cancelAnimationFrame(
|
|
307
|
+
function ve(d = !1) {
|
|
308
|
+
d && (cancelAnimationFrame(k), E.value = !1), I.cancel(), A.clear(), w.value = !1, g.value = !1, clearTimeout(O), R = "idle", D = 0, l.zooming = !1, d || (Re(), n.onPageDrag(0)), clearTimeout(m), y = -1e3;
|
|
239
309
|
}
|
|
240
310
|
function Be(d = 0) {
|
|
241
|
-
cancelAnimationFrame(
|
|
242
|
-
const
|
|
243
|
-
d > 0 && (
|
|
311
|
+
cancelAnimationFrame(k), E.value = !1, ve();
|
|
312
|
+
const z = { level: 1, offsetX: 0, offsetY: 0 };
|
|
313
|
+
d > 0 && (l.level !== 1 || l.offsetX !== 0 || l.offsetY !== 0) ? se(z, d) : xe(z);
|
|
244
314
|
}
|
|
245
|
-
function
|
|
246
|
-
return { x: d.clientX -
|
|
315
|
+
function Ee(d, z = ne) {
|
|
316
|
+
return { x: d.clientX - z.left, y: d.clientY - z.top };
|
|
247
317
|
}
|
|
248
|
-
function
|
|
249
|
-
|
|
250
|
-
const [d,
|
|
251
|
-
|
|
318
|
+
function ze() {
|
|
319
|
+
I.cancel(), F = !1, C = !1, D = 0;
|
|
320
|
+
const [d, z] = [...A.values()];
|
|
321
|
+
me = dn(l.level, n.zoomLimit()), oe = Math.max(1, He(d, z)), Pe = yt(d, z), ee = pe(), R = "pinch", l.zooming = !0, Re(), n.onPageDrag(0), clearTimeout(m), y = -1e3;
|
|
252
322
|
}
|
|
253
|
-
function
|
|
254
|
-
if (!n.interactive() || d.pointerType === "mouse" && d.button !== 0)
|
|
255
|
-
return !1;
|
|
256
|
-
const X = d.target;
|
|
257
|
-
if (X.closest("button, input, a, select") || X instanceof HTMLVideoElement && X.controls && d.clientY > X.getBoundingClientRect().bottom - 48)
|
|
323
|
+
function Ae(d, z = r.value.getBoundingClientRect(), X = d.target) {
|
|
324
|
+
if (!n.interactive() || d.pointerType === "mouse" && d.button !== 0 || X.closest("button, input, a, select") || X instanceof HTMLVideoElement && X.controls && d.clientY > X.getBoundingClientRect().bottom - 48)
|
|
258
325
|
return !1;
|
|
259
|
-
if (cancelAnimationFrame(
|
|
260
|
-
return
|
|
261
|
-
|
|
262
|
-
const
|
|
263
|
-
return n.holdable() && Math.abs(
|
|
264
|
-
}
|
|
265
|
-
function
|
|
266
|
-
if (!
|
|
267
|
-
const
|
|
268
|
-
if (
|
|
326
|
+
if (cancelAnimationFrame(k), E.value = !1, w.value = !0, A.size === 0 && (ne = z), A.set(d.pointerId, Ee(d)), r.value.setPointerCapture(d.pointerId), A.size >= 2)
|
|
327
|
+
return ze(), !0;
|
|
328
|
+
Z = Ee(d), be = performance.now(), K.reset(Z, d.timeStamp), ee = pe(), R = "pending", F = !0, C = !1, D = 0;
|
|
329
|
+
const j = x.value.width / 2, N = x.value.height / 2, Q = fe();
|
|
330
|
+
return n.holdable() && Math.abs(Z.x - Q.x - l.offsetX) <= j && Math.abs(Z.y - Q.y - l.offsetY) <= N && (clearTimeout(m), I.arm()), !0;
|
|
331
|
+
}
|
|
332
|
+
function rt(d) {
|
|
333
|
+
if (!A.has(d.pointerId)) return;
|
|
334
|
+
const z = Ee(d);
|
|
335
|
+
if (A.set(d.pointerId, z), R === "pinch" && A.size >= 2) {
|
|
269
336
|
if (!n.zoomable()) return;
|
|
270
|
-
const [
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
Ye.y - be.y - (Oe.y - be.y - B.offsetY) * tt,
|
|
280
|
-
He
|
|
337
|
+
const [N, Q] = [...A.values()], ye = fe(), Me = yt(N, Q);
|
|
338
|
+
me *= Math.max(1, He(N, Q)) / oe;
|
|
339
|
+
const Le = cn(me, n.zoomLimit()), Je = Le / ee.level;
|
|
340
|
+
xe({
|
|
341
|
+
level: Le,
|
|
342
|
+
...G(
|
|
343
|
+
Me.x - ye.x - (Pe.x - ye.x - ee.offsetX) * Je,
|
|
344
|
+
Me.y - ye.y - (Pe.y - ye.y - ee.offsetY) * Je,
|
|
345
|
+
Le
|
|
281
346
|
)
|
|
282
|
-
}),
|
|
347
|
+
}), ee = pe(), oe = Math.max(1, He(N, Q)), Pe = Me, d.preventDefault();
|
|
283
348
|
return;
|
|
284
349
|
}
|
|
285
|
-
if (
|
|
286
|
-
const X =
|
|
287
|
-
if (
|
|
288
|
-
if (d.preventDefault(), Math.hypot(X,
|
|
289
|
-
|
|
290
|
-
}
|
|
291
|
-
Math.hypot(X,
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (q.cancel(), H.delete(d.pointerId), k.value = H.size > 0, h === "pinch") {
|
|
302
|
-
H.size > 0 ? (j = [...H.values()][0], B = G(), h = "pan") : (h = "idle", r.zooming = !1, ve(Math.max(1, r.level), ie(), !0));
|
|
350
|
+
if (R === "idle") return;
|
|
351
|
+
const X = z.x - Z.x, j = z.y - Z.y;
|
|
352
|
+
if (R === "hold") {
|
|
353
|
+
if (d.preventDefault(), Math.hypot(X, j) < 9) return;
|
|
354
|
+
I.cancel(), R = "pending";
|
|
355
|
+
}
|
|
356
|
+
if (Math.hypot(X, j) >= 9 && I.cancel(), K.move(z, d.timeStamp), R === "pending" && (R = Lt(X, j, l.level), C = R === "pan" && F && Math.abs(X) > Math.abs(j) * 1.1), R !== "pending")
|
|
357
|
+
if (clearTimeout(m), y = -1e3, d.preventDefault(), R === "pan") {
|
|
358
|
+
const N = Math.max(0, (x.value.width - a.value.width) / 2), Q = gn(ee.offsetX + X, N, C);
|
|
359
|
+
xe({ level: l.level, ...G(Q.offsetX, ee.offsetY + j, l.level) }), Q.pageOffset !== D && (D = Q.pageOffset, n.onPageDrag(D));
|
|
360
|
+
} else R === "page" ? n.onPageDrag(X) : R === "dismiss" && (l.draggingDown = !0, l.downOffsetX = X * 0.65, l.downOffsetY = Math.max(0, j), l.downScale = J(1 - Math.max(0, j) / a.value.height * 0.6, 0.65, 1), n.onSwipeDownProgress(J(j / (a.value.height * 0.55), 0, 0.85)));
|
|
361
|
+
}
|
|
362
|
+
function ot(d) {
|
|
363
|
+
if (!A.has(d.pointerId)) return;
|
|
364
|
+
if (I.cancel(), A.delete(d.pointerId), w.value = A.size > 0, R === "pinch") {
|
|
365
|
+
A.size > 0 ? (Z = [...A.values()][0], ee = pe(), R = "pan") : (R = "idle", l.zooming = !1, he(Math.max(1, l.level), fe(), !0));
|
|
303
366
|
return;
|
|
304
367
|
}
|
|
305
|
-
if (
|
|
306
|
-
const
|
|
307
|
-
|
|
368
|
+
if (A.size > 0) return;
|
|
369
|
+
const z = Ee(d), X = z.x - Z.x, j = z.y - Z.y, N = K.read(d.timeStamp);
|
|
370
|
+
R === "page" || R === "pan" && D !== 0 ? n.onPageRelease(R === "page" ? X : D, N.x) : R === "dismiss" ? $t(j, N.y, a.value) ? n.onSwipeDownClose() : Re() : R === "pending" && performance.now() - be < 300 && He(Z, z) < 9 ? st(z) : (l.level < 1 || l.level > n.zoomLimit()) && he(l.level, fe(), !0), l.zooming = !1, R = "idle";
|
|
308
371
|
}
|
|
309
|
-
function
|
|
310
|
-
if (!
|
|
311
|
-
const
|
|
312
|
-
|
|
372
|
+
function lt(d) {
|
|
373
|
+
if (!A.has(d.pointerId)) return;
|
|
374
|
+
const z = R === "page" || R === "pan" && D !== 0;
|
|
375
|
+
ve(), z && n.onPageRelease(0, 0), (l.level < 1 || l.level > n.zoomLimit()) && he(l.level, fe(), !0);
|
|
313
376
|
}
|
|
314
|
-
function
|
|
315
|
-
const
|
|
316
|
-
|
|
377
|
+
function st(d) {
|
|
378
|
+
const z = performance.now();
|
|
379
|
+
z - y < 280 && He(d, P) < 36 ? (clearTimeout(m), y = -1e3, n.onDoubleTap(), he(l.level > 1.01 ? 1 : n.doubleTapZoom(), d, !0)) : (y = z, P = d, m = setTimeout(n.onTap, 280));
|
|
317
380
|
}
|
|
318
|
-
function
|
|
381
|
+
function W(d) {
|
|
319
382
|
if (n.interactive()) {
|
|
320
|
-
if (
|
|
321
|
-
|
|
383
|
+
if (I.cancel(), g.value = !0, clearTimeout(O), O = setTimeout(() => {
|
|
384
|
+
g.value = !1;
|
|
322
385
|
}, 120), d.ctrlKey || d.metaKey)
|
|
323
|
-
d.preventDefault(),
|
|
324
|
-
|
|
325
|
-
|
|
386
|
+
d.preventDefault(), he(
|
|
387
|
+
l.level * fn(d, Y.size > 0),
|
|
388
|
+
Ee(d, r.value.getBoundingClientRect())
|
|
326
389
|
);
|
|
327
|
-
else if (
|
|
390
|
+
else if (l.level > 1) {
|
|
328
391
|
d.preventDefault();
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
level:
|
|
332
|
-
...
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
392
|
+
const z = d.deltaMode === 1 ? 16 : 1;
|
|
393
|
+
xe({
|
|
394
|
+
level: l.level,
|
|
395
|
+
...G(
|
|
396
|
+
l.offsetX - d.deltaX * z,
|
|
397
|
+
l.offsetY - d.deltaY * z,
|
|
398
|
+
l.level
|
|
336
399
|
)
|
|
337
400
|
});
|
|
338
401
|
}
|
|
339
402
|
}
|
|
340
403
|
}
|
|
341
404
|
const Ue = {
|
|
342
|
-
state:
|
|
343
|
-
motionActive:
|
|
344
|
-
containerRef:
|
|
405
|
+
state: l,
|
|
406
|
+
motionActive: B,
|
|
407
|
+
containerRef: r,
|
|
345
408
|
canvasRef: e,
|
|
346
|
-
mediaRef:
|
|
347
|
-
viewportSize:
|
|
348
|
-
mediaSize:
|
|
409
|
+
mediaRef: i,
|
|
410
|
+
viewportSize: a,
|
|
411
|
+
mediaSize: o,
|
|
349
412
|
visualMediaSize: u,
|
|
350
|
-
displaySize:
|
|
413
|
+
displaySize: x,
|
|
351
414
|
displayScale: c,
|
|
352
|
-
downDragStyle:
|
|
353
|
-
requestRender:
|
|
415
|
+
downDragStyle: L,
|
|
416
|
+
requestRender: ke,
|
|
354
417
|
renderNow: () => S.forEach((d) => d()),
|
|
355
|
-
zoomTo:
|
|
418
|
+
zoomTo: he,
|
|
356
419
|
resetTransform: Be,
|
|
357
|
-
cancelGesture:
|
|
420
|
+
cancelGesture: ve,
|
|
358
421
|
setMediaElement(d) {
|
|
359
|
-
|
|
422
|
+
i.value = d, d instanceof HTMLVideoElement && ke();
|
|
360
423
|
},
|
|
361
424
|
setMediaSize(d) {
|
|
362
|
-
|
|
425
|
+
o.value = d, ke();
|
|
363
426
|
},
|
|
364
427
|
clearMedia() {
|
|
365
|
-
|
|
428
|
+
i.value = void 0;
|
|
366
429
|
},
|
|
367
430
|
registerRenderHandler(d) {
|
|
368
431
|
return S.add(d), () => S.delete(d);
|
|
369
432
|
},
|
|
370
|
-
setRotation(d,
|
|
371
|
-
|
|
433
|
+
setRotation(d, z = !0) {
|
|
434
|
+
l.rotation = bt(d), z && Be(), ke();
|
|
372
435
|
},
|
|
373
436
|
rotateBy(d = 90) {
|
|
374
|
-
Ue.setRotation(
|
|
437
|
+
Ue.setRotation(bt(l.rotation + d));
|
|
375
438
|
}
|
|
376
439
|
};
|
|
377
|
-
return { core: Ue, onPointerDown:
|
|
440
|
+
return { core: Ue, onPointerDown: Ae, onPointerMove: rt, onPointerUp: ot, onPointerCancel: lt, onWheel: W };
|
|
378
441
|
}
|
|
379
|
-
function
|
|
380
|
-
const n = t.rotation * Math.PI / 180,
|
|
442
|
+
function hn(t) {
|
|
443
|
+
const n = t.rotation * Math.PI / 180, r = Math.round(Math.cos(n)), e = Math.round(Math.sin(n)), i = t.size.width / 2 - r * t.offsetX - e * t.offsetY, a = t.size.height / 2 + e * t.offsetX - r * t.offsetY, o = (Math.abs(r) * t.viewport.width + Math.abs(e) * t.viewport.height) / 2, l = (Math.abs(e) * t.viewport.width + Math.abs(r) * t.viewport.height) / 2, u = J(i - o, 0, t.size.width), p = J(a - l, 0, t.size.height);
|
|
381
444
|
return {
|
|
382
445
|
x: u,
|
|
383
|
-
y:
|
|
384
|
-
width:
|
|
385
|
-
height:
|
|
446
|
+
y: p,
|
|
447
|
+
width: J(i + o, 0, t.size.width) - u,
|
|
448
|
+
height: J(a + l, 0, t.size.height) - p
|
|
386
449
|
};
|
|
387
450
|
}
|
|
388
|
-
function
|
|
389
|
-
const
|
|
390
|
-
if (
|
|
451
|
+
function vn(t, n, r, e) {
|
|
452
|
+
const i = hn(r);
|
|
453
|
+
if (i.width <= 0 || i.height <= 0) return;
|
|
391
454
|
t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = e ? "low" : "high", t.translate(
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
), t.rotate(
|
|
395
|
-
const { width:
|
|
396
|
-
if (
|
|
397
|
-
t.drawImage(n, -
|
|
455
|
+
r.viewport.width / 2 + r.offsetX,
|
|
456
|
+
r.viewport.height / 2 + r.offsetY
|
|
457
|
+
), t.rotate(r.rotation * Math.PI / 180);
|
|
458
|
+
const { width: a, height: o } = r.size, l = "naturalWidth" in n ? n.naturalWidth : n.width, u = "naturalHeight" in n ? n.naturalHeight : n.height;
|
|
459
|
+
if (i.width === a && i.height === o) {
|
|
460
|
+
t.drawImage(n, -a / 2, -o / 2, a, o);
|
|
398
461
|
return;
|
|
399
462
|
}
|
|
400
463
|
t.drawImage(
|
|
401
464
|
n,
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
465
|
+
i.x / a * l,
|
|
466
|
+
i.y / o * u,
|
|
467
|
+
i.width / a * l,
|
|
468
|
+
i.height / o * u,
|
|
469
|
+
i.x - a / 2,
|
|
470
|
+
i.y - o / 2,
|
|
471
|
+
i.width,
|
|
472
|
+
i.height
|
|
410
473
|
);
|
|
411
474
|
}
|
|
412
|
-
|
|
475
|
+
const yn = { class: "mp-dom-renderer mp-gif-renderer" }, wn = ["src", "alt"], bn = /* @__PURE__ */ $e({
|
|
476
|
+
__name: "AnimatedImageLayer",
|
|
477
|
+
props: {
|
|
478
|
+
core: {},
|
|
479
|
+
src: {},
|
|
480
|
+
title: {}
|
|
481
|
+
},
|
|
482
|
+
setup(t) {
|
|
483
|
+
const n = t, r = V(() => ({
|
|
484
|
+
transform: `translate(-50%, -50%) translate3d(${n.core.state.offsetX}px, ${n.core.state.offsetY}px, 0)`
|
|
485
|
+
})), e = V(() => ({
|
|
486
|
+
width: `${n.core.mediaSize.value.width * n.core.displayScale.value}px`,
|
|
487
|
+
height: `${n.core.mediaSize.value.height * n.core.displayScale.value}px`,
|
|
488
|
+
transform: `rotate(${n.core.state.rotation}deg)`,
|
|
489
|
+
pointerEvents: "none"
|
|
490
|
+
}));
|
|
491
|
+
return (i, a) => (q(), _("div", yn, [
|
|
492
|
+
T("div", {
|
|
493
|
+
class: "mp-dom-renderer__frame",
|
|
494
|
+
style: we(r.value)
|
|
495
|
+
}, [
|
|
496
|
+
T("img", {
|
|
497
|
+
src: i.src,
|
|
498
|
+
alt: i.title,
|
|
499
|
+
draggable: !1,
|
|
500
|
+
class: "mp-dom-renderer__node",
|
|
501
|
+
style: we(e.value)
|
|
502
|
+
}, null, 12, wn)
|
|
503
|
+
], 4)
|
|
504
|
+
]));
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
function kn() {
|
|
413
508
|
const t = /* @__PURE__ */ new Set();
|
|
414
|
-
let n = []
|
|
415
|
-
|
|
509
|
+
let n = [];
|
|
510
|
+
const r = /* @__PURE__ */ new Map();
|
|
511
|
+
let e = { kind: "empty" };
|
|
512
|
+
function i() {
|
|
416
513
|
for (const a of t)
|
|
417
|
-
n.includes(a) ||
|
|
514
|
+
r.has(a) || n.includes(a) || e.kind === "owned" && e.lease === a || (a.release(), t.delete(a));
|
|
418
515
|
}
|
|
419
516
|
return {
|
|
420
517
|
replace(a) {
|
|
421
|
-
n = a, a.forEach((
|
|
518
|
+
n = a, a.forEach((o) => t.add(o)), i();
|
|
422
519
|
},
|
|
423
520
|
display(a) {
|
|
424
|
-
|
|
521
|
+
e = { kind: "owned", lease: a }, i();
|
|
522
|
+
},
|
|
523
|
+
retainDisplay() {
|
|
524
|
+
if (e.kind === "empty") return () => {
|
|
525
|
+
};
|
|
526
|
+
const a = e.lease;
|
|
527
|
+
r.set(a, r.has(a) ? r.get(a) + 1 : 1);
|
|
528
|
+
let o = !1;
|
|
529
|
+
return () => {
|
|
530
|
+
if (o) return;
|
|
531
|
+
o = !0;
|
|
532
|
+
const l = r.get(a) - 1;
|
|
533
|
+
l === 0 ? r.delete(a) : r.set(a, l), i();
|
|
534
|
+
};
|
|
425
535
|
},
|
|
426
536
|
clearDisplay() {
|
|
427
|
-
|
|
537
|
+
e = { kind: "empty" }, i();
|
|
428
538
|
},
|
|
429
539
|
dispose() {
|
|
430
|
-
|
|
540
|
+
n = [], e = { kind: "empty" }, i();
|
|
431
541
|
}
|
|
432
542
|
};
|
|
433
543
|
}
|
|
434
|
-
const
|
|
544
|
+
const ue = {
|
|
435
545
|
maxDecodedPixels: 64e6,
|
|
436
546
|
maxCanvasPixels: 6e6,
|
|
437
547
|
maxDevicePixelRatio: 2.5,
|
|
@@ -450,25 +560,25 @@ function Bt(t, n) {
|
|
|
450
560
|
if (t.naturalWidth * t.naturalHeight > n)
|
|
451
561
|
throw new je("图片像素超过解码保护限制,请提供较小的适屏资源");
|
|
452
562
|
}
|
|
453
|
-
const
|
|
454
|
-
function
|
|
455
|
-
return t instanceof je ? { status: "blocked", reason:
|
|
563
|
+
const ct = "原图超过资源限制";
|
|
564
|
+
function xn(t) {
|
|
565
|
+
return t instanceof je ? { status: "blocked", reason: ct } : {
|
|
456
566
|
status: "error",
|
|
457
567
|
reason: t instanceof Error ? t.message : "原图加载失败,可重试"
|
|
458
568
|
};
|
|
459
569
|
}
|
|
460
570
|
const zt = `(function(){"use strict";self.onmessage=async({data:a})=>{try{const t=await createImageBitmap(a.blob);let e=t;try{const s=Math.min(1,Math.sqrt(a.maxMotionPixels/(t.width*t.height)));s<1&&(e=await createImageBitmap(t,{resizeWidth:Math.max(1,Math.floor(t.width*s)),resizeHeight:Math.max(1,Math.floor(t.height*s)),resizeQuality:"high"}));const r=e===t?[t]:[t,e];self.postMessage({status:"ready",full:t,motion:e},{transfer:r})}catch(s){throw e!==t&&e.close(),t.close(),s}}catch(t){self.postMessage({status:"error",message:t instanceof Error?t.message:"图片位图准备失败"})}}})();
|
|
461
|
-
`,
|
|
462
|
-
function
|
|
571
|
+
`, kt = typeof self < "u" && self.Blob && new Blob([zt], { type: "text/javascript;charset=utf-8" });
|
|
572
|
+
function Mn(t) {
|
|
463
573
|
let n;
|
|
464
574
|
try {
|
|
465
|
-
if (n =
|
|
466
|
-
const
|
|
575
|
+
if (n = kt && (self.URL || self.webkitURL).createObjectURL(kt), !n) throw "";
|
|
576
|
+
const r = new Worker(n, {
|
|
467
577
|
name: t == null ? void 0 : t.name
|
|
468
578
|
});
|
|
469
|
-
return
|
|
579
|
+
return r.addEventListener("error", () => {
|
|
470
580
|
(self.URL || self.webkitURL).revokeObjectURL(n);
|
|
471
|
-
}),
|
|
581
|
+
}), r;
|
|
472
582
|
} catch {
|
|
473
583
|
return new Worker(
|
|
474
584
|
"data:text/javascript;charset=utf-8," + encodeURIComponent(zt),
|
|
@@ -480,37 +590,52 @@ function fn(t) {
|
|
|
480
590
|
n && (self.URL || self.webkitURL).revokeObjectURL(n);
|
|
481
591
|
}
|
|
482
592
|
}
|
|
483
|
-
function
|
|
593
|
+
function dt({ full: t, motion: n }) {
|
|
484
594
|
n !== t && n.close(), t.close();
|
|
485
595
|
}
|
|
486
|
-
function
|
|
487
|
-
return
|
|
488
|
-
const
|
|
489
|
-
|
|
490
|
-
},
|
|
491
|
-
|
|
596
|
+
function Sn(t, n, r) {
|
|
597
|
+
return r.throwIfAborted(), new Promise((e, i) => {
|
|
598
|
+
const a = new Mn(), o = () => {
|
|
599
|
+
r.removeEventListener("abort", l), a.terminate();
|
|
600
|
+
}, l = () => {
|
|
601
|
+
o(), i(r.reason);
|
|
492
602
|
};
|
|
493
|
-
|
|
494
|
-
if (
|
|
495
|
-
|
|
603
|
+
a.onmessage = ({ data: u }) => {
|
|
604
|
+
if (o(), u.status === "error") {
|
|
605
|
+
i(new Error(u.message));
|
|
496
606
|
return;
|
|
497
607
|
}
|
|
498
|
-
if (
|
|
499
|
-
|
|
608
|
+
if (r.aborted) {
|
|
609
|
+
dt(u), i(r.reason);
|
|
500
610
|
return;
|
|
501
611
|
}
|
|
502
612
|
e(u);
|
|
503
|
-
},
|
|
504
|
-
|
|
505
|
-
},
|
|
613
|
+
}, a.onerror = (u) => {
|
|
614
|
+
o(), i(new Error(u.message || "图片位图准备失败"));
|
|
615
|
+
}, r.addEventListener("abort", l, { once: !0 });
|
|
506
616
|
try {
|
|
507
|
-
|
|
617
|
+
a.postMessage({ blob: t, maxMotionPixels: n });
|
|
508
618
|
} catch (u) {
|
|
509
|
-
|
|
619
|
+
o(), i(u);
|
|
510
620
|
}
|
|
511
621
|
});
|
|
512
622
|
}
|
|
513
|
-
function
|
|
623
|
+
function Pn(t) {
|
|
624
|
+
return t[0] === 71 && t[1] === 73 && t[2] === 70 && t[3] === 56 && (t[4] === 55 || t[4] === 57) && t[5] === 97;
|
|
625
|
+
}
|
|
626
|
+
async function Rn(t, n, r) {
|
|
627
|
+
await t.decode(), r.throwIfAborted();
|
|
628
|
+
const e = URL.createObjectURL(n);
|
|
629
|
+
return {
|
|
630
|
+
image: t,
|
|
631
|
+
source: t,
|
|
632
|
+
motionSource: t,
|
|
633
|
+
animation: { kind: "gif", url: e },
|
|
634
|
+
bytes: t.naturalWidth * t.naturalHeight * 4 + n.size,
|
|
635
|
+
dispose: () => URL.revokeObjectURL(e)
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
function It(t) {
|
|
514
639
|
return {
|
|
515
640
|
image: t,
|
|
516
641
|
source: t,
|
|
@@ -520,97 +645,98 @@ function Dt(t) {
|
|
|
520
645
|
}
|
|
521
646
|
};
|
|
522
647
|
}
|
|
523
|
-
async function
|
|
524
|
-
const e = new Uint8Array(await n.slice(0,
|
|
525
|
-
if (
|
|
526
|
-
|
|
527
|
-
|
|
648
|
+
async function En(t, n, r) {
|
|
649
|
+
const e = new Uint8Array(await n.slice(0, 6).arrayBuffer());
|
|
650
|
+
if (r.throwIfAborted(), Pn(e)) return Rn(t, n, r);
|
|
651
|
+
if (!(e[0] === 255 && e[1] === 216 && e[2] === 255))
|
|
652
|
+
return await t.decode(), r.throwIfAborted(), It(t);
|
|
653
|
+
const i = await Sn(n, ue.maxCanvasPixels, r);
|
|
528
654
|
try {
|
|
529
|
-
|
|
530
|
-
const { full:
|
|
655
|
+
r.throwIfAborted();
|
|
656
|
+
const { full: a, motion: o } = i, l = o === a ? 0 : o.width * o.height * 4;
|
|
531
657
|
return {
|
|
532
658
|
image: t,
|
|
533
|
-
source:
|
|
534
|
-
motionSource:
|
|
659
|
+
source: a,
|
|
660
|
+
motionSource: o,
|
|
535
661
|
// Include the DOM image and both retained pixel sizes in the cache budget.
|
|
536
|
-
bytes: (t.naturalWidth * t.naturalHeight +
|
|
537
|
-
dispose: () =>
|
|
662
|
+
bytes: (t.naturalWidth * t.naturalHeight + a.width * a.height) * 4 + l,
|
|
663
|
+
dispose: () => dt(i)
|
|
538
664
|
};
|
|
539
|
-
} catch (
|
|
540
|
-
throw
|
|
665
|
+
} catch (a) {
|
|
666
|
+
throw dt(i), a;
|
|
541
667
|
}
|
|
542
668
|
}
|
|
543
|
-
const
|
|
544
|
-
const
|
|
545
|
-
if (!
|
|
546
|
-
if (Number(
|
|
547
|
-
throw await
|
|
548
|
-
const
|
|
549
|
-
let
|
|
669
|
+
const Cn = async (t, n) => {
|
|
670
|
+
const r = await fetch(t, { signal: n.signal, credentials: "same-origin" });
|
|
671
|
+
if (!r.ok) throw new Error(`图片加载失败:HTTP ${r.status}`);
|
|
672
|
+
if (Number(r.headers.get("content-length")) > n.maxBytes)
|
|
673
|
+
throw await r.body.cancel(), new je("资源超过下载保护限制,请使用适屏图或下载原文件");
|
|
674
|
+
const i = r.body.getReader(), a = [];
|
|
675
|
+
let o = 0;
|
|
550
676
|
try {
|
|
551
677
|
for (; ; ) {
|
|
552
|
-
const c = await
|
|
678
|
+
const c = await i.read();
|
|
553
679
|
if (c.done) break;
|
|
554
|
-
if (
|
|
680
|
+
if (o += c.value.byteLength, o > n.maxBytes)
|
|
555
681
|
throw new je("资源超过下载保护限制,请使用适屏图或下载原文件");
|
|
556
|
-
|
|
682
|
+
a.push(new Uint8Array(c.value));
|
|
557
683
|
}
|
|
558
684
|
} catch (c) {
|
|
559
|
-
throw await
|
|
685
|
+
throw await i.cancel(), c;
|
|
560
686
|
} finally {
|
|
561
|
-
|
|
687
|
+
i.releaseLock();
|
|
562
688
|
}
|
|
563
689
|
n.signal.throwIfAborted();
|
|
564
|
-
const
|
|
565
|
-
|
|
690
|
+
const l = new Blob(a, { type: r.headers.get("content-type") }), u = URL.createObjectURL(l), p = new Image();
|
|
691
|
+
p.decoding = "async";
|
|
566
692
|
try {
|
|
567
|
-
return await new Promise((c,
|
|
568
|
-
const
|
|
569
|
-
|
|
693
|
+
return await new Promise((c, x) => {
|
|
694
|
+
const L = () => {
|
|
695
|
+
p.removeAttribute("src"), x(new DOMException("请求已取消", "AbortError"));
|
|
570
696
|
};
|
|
571
|
-
|
|
572
|
-
n.signal.removeEventListener("abort",
|
|
573
|
-
},
|
|
574
|
-
n.signal.removeEventListener("abort",
|
|
575
|
-
}, n.signal.addEventListener("abort",
|
|
576
|
-
}), n.signal.throwIfAborted(), Bt(
|
|
697
|
+
p.onload = () => {
|
|
698
|
+
n.signal.removeEventListener("abort", L), c();
|
|
699
|
+
}, p.onerror = () => {
|
|
700
|
+
n.signal.removeEventListener("abort", L), x(new Error("图片解码失败或格式不受支持"));
|
|
701
|
+
}, n.signal.addEventListener("abort", L, { once: !0 }), p.src = u;
|
|
702
|
+
}), n.signal.throwIfAborted(), Bt(p, n.maxPixels), await En(p, l, n.signal);
|
|
577
703
|
} finally {
|
|
578
704
|
URL.revokeObjectURL(u);
|
|
579
705
|
}
|
|
580
706
|
};
|
|
581
|
-
class
|
|
582
|
-
constructor(n =
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
this.budget = n, this.concurrency =
|
|
707
|
+
class Ln {
|
|
708
|
+
constructor(n = ue.cacheBytes, r = ue.concurrency, e = Cn) {
|
|
709
|
+
tt(this, "entries", /* @__PURE__ */ new Map());
|
|
710
|
+
tt(this, "active", 0);
|
|
711
|
+
tt(this, "cancelled", 0);
|
|
712
|
+
this.budget = n, this.concurrency = r, this.loader = e;
|
|
587
713
|
}
|
|
588
714
|
get stats() {
|
|
589
715
|
return {
|
|
590
716
|
active: this.active,
|
|
591
717
|
queued: [...this.entries.values()].filter((n) => n.state === "queued").length,
|
|
592
718
|
entries: this.entries.size,
|
|
593
|
-
bytes: [...this.entries.values()].reduce((n,
|
|
719
|
+
bytes: [...this.entries.values()].reduce((n, r) => n + r.bytes, 0),
|
|
594
720
|
cancelled: this.cancelled
|
|
595
721
|
};
|
|
596
722
|
}
|
|
597
|
-
acquire(n,
|
|
723
|
+
acquire(n, r = {}) {
|
|
598
724
|
const e = {
|
|
599
725
|
priority: 0,
|
|
600
|
-
maxBytes:
|
|
601
|
-
maxPixels:
|
|
602
|
-
...
|
|
726
|
+
maxBytes: ue.maxOriginalBytes,
|
|
727
|
+
maxPixels: ue.maxDecodedPixels,
|
|
728
|
+
...r
|
|
603
729
|
};
|
|
604
730
|
if (this.entries.has(n) && ["error", "aborted"].includes(this.entries.get(n).state) && this.entries.delete(n), !this.entries.has(n)) {
|
|
605
|
-
let u,
|
|
606
|
-
const c = new Promise((
|
|
607
|
-
u =
|
|
731
|
+
let u, p;
|
|
732
|
+
const c = new Promise((x, L) => {
|
|
733
|
+
u = x, p = L;
|
|
608
734
|
});
|
|
609
735
|
c.catch(() => {
|
|
610
736
|
}), this.entries.set(n, {
|
|
611
737
|
promise: c,
|
|
612
738
|
resolve: u,
|
|
613
|
-
reject:
|
|
739
|
+
reject: p,
|
|
614
740
|
controller: new AbortController(),
|
|
615
741
|
users: 0,
|
|
616
742
|
bytes: 0,
|
|
@@ -622,26 +748,26 @@ class hn {
|
|
|
622
748
|
state: "queued"
|
|
623
749
|
});
|
|
624
750
|
}
|
|
625
|
-
const
|
|
626
|
-
|
|
627
|
-
let
|
|
628
|
-
const
|
|
629
|
-
return
|
|
630
|
-
}),
|
|
751
|
+
const i = this.entries.get(n);
|
|
752
|
+
i.users++, i.priority = Math.min(i.priority, e.priority), i.maxBytes = Math.max(i.maxBytes, e.maxBytes), i.maxPixels = Math.max(i.maxPixels, e.maxPixels), this.entries.delete(n), this.entries.set(n, i), this.pump();
|
|
753
|
+
let a = !1;
|
|
754
|
+
const o = i.promise.then((u) => (Bt(u.image, e.maxPixels), u)), l = o.then((u) => u.image);
|
|
755
|
+
return o.catch(() => {
|
|
756
|
+
}), l.catch(() => {
|
|
631
757
|
}), {
|
|
632
|
-
ready:
|
|
633
|
-
resource:
|
|
758
|
+
ready: l,
|
|
759
|
+
resource: o,
|
|
634
760
|
release: () => {
|
|
635
|
-
|
|
761
|
+
a || (a = !0, i.users--, i.users === 0 && (i.state === "queued" || i.state === "loading") && (i.state = "aborted", this.cancelled++, i.controller.abort(), i.reject(new DOMException("请求已取消", "AbortError")), this.entries.get(n) === i && this.entries.delete(n)), i.users === 0 && i.state === "error" && this.entries.get(n) === i && this.entries.delete(n), this.trim(), this.pump());
|
|
636
762
|
}
|
|
637
763
|
};
|
|
638
764
|
}
|
|
639
765
|
pump() {
|
|
640
766
|
for (; this.active < this.concurrency; ) {
|
|
641
|
-
const n = [...this.entries].filter(([,
|
|
767
|
+
const n = [...this.entries].filter(([, i]) => i.state === "queued" && i.users > 0).sort((i, a) => i[1].priority - a[1].priority);
|
|
642
768
|
if (n.length === 0) return;
|
|
643
|
-
const [
|
|
644
|
-
e.state = "loading", this.active++, this.loader(
|
|
769
|
+
const [r, e] = n[0];
|
|
770
|
+
e.state = "loading", this.active++, this.loader(r, {
|
|
645
771
|
signal: e.controller.signal,
|
|
646
772
|
get maxBytes() {
|
|
647
773
|
return e.maxBytes;
|
|
@@ -649,14 +775,14 @@ class hn {
|
|
|
649
775
|
get maxPixels() {
|
|
650
776
|
return e.maxPixels;
|
|
651
777
|
}
|
|
652
|
-
}).then((
|
|
778
|
+
}).then((i) => {
|
|
653
779
|
if (e.state === "aborted") {
|
|
654
|
-
|
|
780
|
+
i.dispose();
|
|
655
781
|
return;
|
|
656
782
|
}
|
|
657
|
-
e.bytes =
|
|
658
|
-
}).catch((
|
|
659
|
-
e.state !== "aborted" && (e.state = "error", e.reject(
|
|
783
|
+
e.bytes = i.bytes, e.dispose = i.dispose, e.state = "ready", e.resolve(i);
|
|
784
|
+
}).catch((i) => {
|
|
785
|
+
e.state !== "aborted" && (e.state = "error", e.reject(Ve(i)));
|
|
660
786
|
}).finally(() => {
|
|
661
787
|
this.active--, this.trim(), this.pump();
|
|
662
788
|
});
|
|
@@ -664,136 +790,143 @@ class hn {
|
|
|
664
790
|
}
|
|
665
791
|
trim() {
|
|
666
792
|
let n = this.stats.bytes;
|
|
667
|
-
for (const [
|
|
793
|
+
for (const [r, e] of this.entries)
|
|
668
794
|
if (!(e.users > 0 || e.state === "loading" || e.state === "queued")) {
|
|
669
|
-
if (n <= this.budget && this.entries.size <=
|
|
670
|
-
n -= e.bytes, e.dispose(), this.entries.delete(
|
|
795
|
+
if (n <= this.budget && this.entries.size <= ue.cacheEntries) break;
|
|
796
|
+
n -= e.bytes, e.dispose(), this.entries.delete(r);
|
|
671
797
|
}
|
|
672
798
|
}
|
|
673
799
|
}
|
|
674
|
-
const
|
|
675
|
-
function
|
|
676
|
-
return t.kind === "element" && t.element instanceof HTMLImageElement && t.element.complete && t.element.naturalWidth > 0 ? { kind: "image", image: t.element } :
|
|
800
|
+
const $n = new Ln(), Ce = { kind: "empty" };
|
|
801
|
+
function Fn(t) {
|
|
802
|
+
return t.kind === "element" && t.element instanceof HTMLImageElement && t.element.complete && t.element.naturalWidth > 0 ? { kind: "image", image: t.element } : Ce;
|
|
677
803
|
}
|
|
678
|
-
function
|
|
804
|
+
function xt() {
|
|
679
805
|
const t = document.createElement("canvas");
|
|
680
806
|
t.width = t.height = 1;
|
|
681
807
|
const n = t.getContext("2d");
|
|
682
808
|
return n.fillStyle = "#f3f4f5", n.fillRect(0, 0, 1, 1), t;
|
|
683
809
|
}
|
|
684
|
-
const
|
|
685
|
-
maxOriginalPixels:
|
|
686
|
-
maxOriginalBytes:
|
|
687
|
-
maxPreviewBytes:
|
|
688
|
-
},
|
|
689
|
-
function
|
|
810
|
+
const Dt = ["thumbnail", "screen", "full"], Ge = {
|
|
811
|
+
maxOriginalPixels: ue.maxDecodedPixels,
|
|
812
|
+
maxOriginalBytes: ue.maxOriginalBytes,
|
|
813
|
+
maxPreviewBytes: ue.maxPreviewBytes
|
|
814
|
+
}, Ke = (t, n) => n === "full" ? t.src : n === "screen" ? t.previewSrc : t.thumbnail;
|
|
815
|
+
function Tn(t, n) {
|
|
690
816
|
return t.width * t.height <= n.maxOriginalPixels;
|
|
691
817
|
}
|
|
692
|
-
function
|
|
693
|
-
const
|
|
818
|
+
function Bn(t, n) {
|
|
819
|
+
const r = Math.min(n.width / t.width, n.height / t.height);
|
|
694
820
|
return Math.min(
|
|
695
821
|
8,
|
|
696
822
|
Math.max(
|
|
697
823
|
2,
|
|
698
824
|
Math.min(
|
|
699
|
-
1 /
|
|
700
|
-
Math.max(n.width / (t.width *
|
|
825
|
+
1 / r,
|
|
826
|
+
Math.max(n.width / (t.width * r), n.height / (t.height * r))
|
|
701
827
|
)
|
|
702
828
|
)
|
|
703
829
|
);
|
|
704
830
|
}
|
|
705
|
-
function
|
|
706
|
-
const
|
|
831
|
+
function zn(t, n, r, e, i, a = !0) {
|
|
832
|
+
const o = Tn(t, r), l = {
|
|
707
833
|
sources: [],
|
|
708
|
-
originalStatus:
|
|
834
|
+
originalStatus: a && n === "full" ? o ? "loading" : "blocked" : "idle",
|
|
709
835
|
originalReason: ""
|
|
710
836
|
};
|
|
711
|
-
|
|
712
|
-
for (const [u,
|
|
713
|
-
if (
|
|
837
|
+
l.originalStatus === "blocked" && (l.originalReason = ct);
|
|
838
|
+
for (const [u, p] of Dt.entries()) {
|
|
839
|
+
if (p === "screen" && n === "thumbnail" || p === "full" && (!a || n !== "full" || !o))
|
|
714
840
|
continue;
|
|
715
|
-
const c = e(t,
|
|
716
|
-
if (
|
|
717
|
-
|
|
841
|
+
const c = e(t, p, i);
|
|
842
|
+
if (a && !o && c === t.src) {
|
|
843
|
+
l.originalStatus = "blocked", l.originalReason = ct;
|
|
718
844
|
continue;
|
|
719
845
|
}
|
|
720
|
-
|
|
846
|
+
l.sources.push({ url: c, quality: p, rank: u });
|
|
721
847
|
}
|
|
722
|
-
return
|
|
848
|
+
return l;
|
|
723
849
|
}
|
|
724
|
-
const
|
|
725
|
-
key:
|
|
850
|
+
const In = ["aria-label"], Dn = {
|
|
851
|
+
key: 1,
|
|
726
852
|
class: "mp-resource-state",
|
|
727
853
|
role: "status",
|
|
728
854
|
"aria-label": "加载中"
|
|
729
|
-
},
|
|
855
|
+
}, qn = /* @__PURE__ */ T("span", {
|
|
730
856
|
class: "mp-spinner",
|
|
731
857
|
"aria-hidden": "true"
|
|
732
|
-
}, null, -1),
|
|
733
|
-
|
|
734
|
-
],
|
|
735
|
-
key:
|
|
858
|
+
}, null, -1), On = [
|
|
859
|
+
qn
|
|
860
|
+
], An = {
|
|
861
|
+
key: 2,
|
|
736
862
|
class: "mp-resource-state",
|
|
737
863
|
role: "alert"
|
|
738
|
-
},
|
|
739
|
-
key:
|
|
864
|
+
}, _n = /* @__PURE__ */ T("span", null, "图片暂时无法加载", -1), Vn = {
|
|
865
|
+
key: 3,
|
|
740
866
|
class: "mp-quality-notice"
|
|
741
|
-
},
|
|
867
|
+
}, pt = /* @__PURE__ */ $e({
|
|
742
868
|
inheritAttrs: !1,
|
|
743
869
|
__name: "ImageCanvasRenderer",
|
|
744
870
|
props: {
|
|
745
871
|
media: {},
|
|
746
872
|
core: {},
|
|
873
|
+
active: { type: Boolean, default: !0 },
|
|
747
874
|
quality: { default: "screen" },
|
|
748
875
|
rendering: { type: Boolean, default: !0 },
|
|
749
876
|
requestVersion: { default: 0 },
|
|
750
877
|
loadEnabled: { type: Boolean, default: !0 },
|
|
751
878
|
originalEnabled: { type: Boolean, default: !0 },
|
|
752
879
|
priority: { default: 0 },
|
|
753
|
-
resourcePolicy: { default: () =>
|
|
754
|
-
resolveSource: { type: Function, default:
|
|
755
|
-
initialImage: { default: () =>
|
|
880
|
+
resourcePolicy: { default: () => Ge },
|
|
881
|
+
resolveSource: { type: Function, default: Ke },
|
|
882
|
+
initialImage: { default: () => Ce }
|
|
756
883
|
},
|
|
757
884
|
emits: ["ready", "error", "originalState"],
|
|
758
|
-
setup(t, { expose: n, emit:
|
|
759
|
-
const e = t,
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
885
|
+
setup(t, { expose: n, emit: r }) {
|
|
886
|
+
const e = t, i = r, a = $(), o = ft({ status: "empty" }), l = V(() => {
|
|
887
|
+
const F = { kind: "hidden" };
|
|
888
|
+
if (!e.active || !e.rendering || !e.loadEnabled || o.value.status !== "ready")
|
|
889
|
+
return F;
|
|
890
|
+
const C = o.value.value;
|
|
891
|
+
return "animation" in C ? C.animation : F;
|
|
892
|
+
}), u = $("loading"), p = $(!1), c = $("idle"), x = $("");
|
|
893
|
+
te(
|
|
894
|
+
[c, x],
|
|
895
|
+
() => i("originalState", c.value, x.value)
|
|
763
896
|
);
|
|
764
|
-
let
|
|
765
|
-
const
|
|
766
|
-
let
|
|
767
|
-
},
|
|
768
|
-
function
|
|
769
|
-
if (e.core.motionActive.value && e.loadEnabled &&
|
|
770
|
-
|
|
897
|
+
let L = !0, S = 0, E = e.media.id;
|
|
898
|
+
const w = kn();
|
|
899
|
+
let g = () => {
|
|
900
|
+
}, B, O = !1, h = { kind: "empty" };
|
|
901
|
+
function k() {
|
|
902
|
+
if (e.core.motionActive.value && e.loadEnabled && E === e.media.id) {
|
|
903
|
+
O = !0;
|
|
771
904
|
return;
|
|
772
905
|
}
|
|
773
|
-
|
|
906
|
+
O = !1, P();
|
|
774
907
|
}
|
|
775
|
-
function
|
|
776
|
-
|
|
908
|
+
function m(F, C, D, A) {
|
|
909
|
+
o.value = { status: "ready", value: F, rank: D }, w.display(C), e.core.setMediaElement(F.image), u.value = "ready", p.value = !1, A === "full" && (c.value = "ready"), e.core.requestRender(), i("ready", A);
|
|
777
910
|
}
|
|
778
|
-
|
|
911
|
+
te(
|
|
779
912
|
() => e.core.motionActive.value,
|
|
780
|
-
(
|
|
781
|
-
if (e.core.requestRender(), !
|
|
782
|
-
if (
|
|
783
|
-
const
|
|
784
|
-
|
|
913
|
+
(F) => {
|
|
914
|
+
if (e.core.requestRender(), !F) {
|
|
915
|
+
if (h.kind === "ready") {
|
|
916
|
+
const C = h;
|
|
917
|
+
h = { kind: "empty" }, C.token === S && m(C.value, C.lease, C.rank, C.quality);
|
|
785
918
|
}
|
|
786
|
-
|
|
919
|
+
O && k();
|
|
787
920
|
}
|
|
788
921
|
}
|
|
789
922
|
), qe(() => {
|
|
790
|
-
const
|
|
791
|
-
|
|
792
|
-
|
|
923
|
+
const F = a.value;
|
|
924
|
+
B = F.getContext("2d"), e.core.canvasRef.value = F, g = e.core.registerRenderHandler(v), y(), Se(() => {
|
|
925
|
+
L && k();
|
|
793
926
|
});
|
|
794
|
-
}),
|
|
795
|
-
|
|
796
|
-
}),
|
|
927
|
+
}), Te(() => {
|
|
928
|
+
L = !1, S += 1, g(), w.dispose();
|
|
929
|
+
}), te(
|
|
797
930
|
[
|
|
798
931
|
() => e.media.id,
|
|
799
932
|
() => e.media.src,
|
|
@@ -808,89 +941,89 @@ const kn = ["aria-label"], xn = {
|
|
|
808
941
|
() => e.requestVersion
|
|
809
942
|
],
|
|
810
943
|
() => {
|
|
811
|
-
|
|
944
|
+
k();
|
|
812
945
|
}
|
|
813
|
-
),
|
|
946
|
+
), te(() => e.initialImage, y), te(
|
|
814
947
|
() => e.rendering,
|
|
815
|
-
(
|
|
816
|
-
|
|
948
|
+
(F) => {
|
|
949
|
+
F && e.core.requestRender();
|
|
817
950
|
}
|
|
818
951
|
);
|
|
819
|
-
function
|
|
820
|
-
e.initialImage.kind !== "image" ||
|
|
952
|
+
function y() {
|
|
953
|
+
e.initialImage.kind !== "image" || o.value.status === "ready" || (o.value = {
|
|
821
954
|
status: "ready",
|
|
822
|
-
value:
|
|
955
|
+
value: It(e.initialImage.image),
|
|
823
956
|
rank: 0
|
|
824
|
-
}, e.core.setMediaElement(e.initialImage.image),
|
|
957
|
+
}, e.core.setMediaElement(e.initialImage.image), u.value = "ready", e.core.requestRender(), i("ready", "thumbnail"));
|
|
825
958
|
}
|
|
826
|
-
async function
|
|
827
|
-
const
|
|
828
|
-
if (
|
|
829
|
-
|
|
959
|
+
async function P() {
|
|
960
|
+
const F = ++S;
|
|
961
|
+
if (h = { kind: "empty" }, p.value = !1, E !== e.media.id && (E = e.media.id, o.value = { status: "empty" }, w.clearDisplay(), u.value = "loading", e.core.clearMedia(), y()), !e.loadEnabled) {
|
|
962
|
+
w.replace([]);
|
|
830
963
|
return;
|
|
831
964
|
}
|
|
832
|
-
const
|
|
833
|
-
e.core.viewportSize.value.width * Math.min(devicePixelRatio,
|
|
834
|
-
), D =
|
|
965
|
+
const C = Math.ceil(
|
|
966
|
+
e.core.viewportSize.value.width * Math.min(devicePixelRatio, ue.maxDevicePixelRatio) * e.core.state.level
|
|
967
|
+
), D = zn(
|
|
835
968
|
e.media,
|
|
836
969
|
e.quality,
|
|
837
970
|
e.resourcePolicy,
|
|
838
971
|
e.resolveSource,
|
|
839
|
-
|
|
972
|
+
C,
|
|
840
973
|
e.originalEnabled
|
|
841
974
|
);
|
|
842
|
-
|
|
843
|
-
const { sources:
|
|
844
|
-
(
|
|
975
|
+
x.value = D.originalReason, c.value = D.originalStatus;
|
|
976
|
+
const { sources: A } = D, Z = A.map(
|
|
977
|
+
(ne) => $n.acquire(ne.url, {
|
|
845
978
|
priority: e.priority,
|
|
846
979
|
maxPixels: e.resourcePolicy.maxOriginalPixels,
|
|
847
|
-
maxBytes:
|
|
980
|
+
maxBytes: ne.quality === "full" ? e.resourcePolicy.maxOriginalBytes : e.resourcePolicy.maxPreviewBytes
|
|
848
981
|
})
|
|
849
982
|
);
|
|
850
|
-
|
|
851
|
-
let
|
|
983
|
+
w.replace(Z), A.length === 0 && o.value.status === "empty" && (u.value = "error", i("error", new je(x.value))), o.value.status === "ready" && i("ready", Dt[o.value.rank]);
|
|
984
|
+
let K = o.value.status === "ready" ? o.value.rank : -1, be = 0;
|
|
852
985
|
await Promise.all(
|
|
853
|
-
|
|
854
|
-
const
|
|
986
|
+
A.map(async (ne, me) => {
|
|
987
|
+
const oe = ne.rank, Pe = Z[me];
|
|
855
988
|
try {
|
|
856
|
-
const ee = await
|
|
857
|
-
if (
|
|
858
|
-
|
|
989
|
+
const ee = await Pe.resource;
|
|
990
|
+
if (F !== S || oe < K) return;
|
|
991
|
+
K = oe, e.core.motionActive.value && o.value.status === "ready" ? h = {
|
|
859
992
|
kind: "ready",
|
|
860
|
-
token:
|
|
993
|
+
token: F,
|
|
861
994
|
value: ee,
|
|
862
|
-
lease:
|
|
863
|
-
rank:
|
|
864
|
-
quality:
|
|
865
|
-
} :
|
|
995
|
+
lease: Pe,
|
|
996
|
+
rank: oe,
|
|
997
|
+
quality: ne.quality
|
|
998
|
+
} : m(ee, Pe, oe, ne.quality);
|
|
866
999
|
} catch (ee) {
|
|
867
|
-
if (
|
|
868
|
-
if (
|
|
869
|
-
const
|
|
870
|
-
|
|
1000
|
+
if (F !== S || ee instanceof Error && ee.name === "AbortError") return;
|
|
1001
|
+
if (ne.quality === "full") {
|
|
1002
|
+
const I = xn(ee);
|
|
1003
|
+
c.value = I.status, x.value = I.reason;
|
|
871
1004
|
}
|
|
872
|
-
|
|
1005
|
+
be += 1, oe > K && o.value.status === "ready" && (p.value = !0), be === A.length && o.value.status === "empty" && (u.value = "error"), i("error", Ve(ee));
|
|
873
1006
|
}
|
|
874
1007
|
})
|
|
875
1008
|
);
|
|
876
1009
|
}
|
|
877
|
-
function
|
|
878
|
-
if (!e.rendering ||
|
|
879
|
-
const
|
|
880
|
-
if (
|
|
1010
|
+
function v() {
|
|
1011
|
+
if (!e.rendering || o.value.status !== "ready") return;
|
|
1012
|
+
const F = a.value, C = e.core.viewportSize.value;
|
|
1013
|
+
if (C.width <= 0 || C.height <= 0) return;
|
|
881
1014
|
const D = Math.min(
|
|
882
1015
|
devicePixelRatio,
|
|
883
|
-
|
|
884
|
-
Math.sqrt(
|
|
885
|
-
),
|
|
886
|
-
(
|
|
887
|
-
const { width:
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
e.core.motionActive.value ?
|
|
1016
|
+
ue.maxDevicePixelRatio,
|
|
1017
|
+
Math.sqrt(ue.maxCanvasPixels / (C.width * C.height))
|
|
1018
|
+
), A = Math.max(1, Math.round(C.width * D)), Z = Math.max(1, Math.round(C.height * D));
|
|
1019
|
+
(F.width !== A || F.height !== Z) && (F.width = A, F.height = Z), B.setTransform(D, 0, 0, D, 0, 0), B.clearRect(0, 0, C.width, C.height);
|
|
1020
|
+
const { width: K, height: be } = e.core.mediaSize.value, ne = e.core.displayScale.value;
|
|
1021
|
+
vn(
|
|
1022
|
+
B,
|
|
1023
|
+
e.core.motionActive.value ? o.value.value.motionSource : o.value.value.source,
|
|
891
1024
|
{
|
|
892
|
-
viewport:
|
|
893
|
-
size: { width:
|
|
1025
|
+
viewport: C,
|
|
1026
|
+
size: { width: K * ne, height: be * ne },
|
|
894
1027
|
offsetX: e.core.state.offsetX,
|
|
895
1028
|
offsetY: e.core.state.offsetY,
|
|
896
1029
|
rotation: e.core.state.rotation
|
|
@@ -898,159 +1031,171 @@ const kn = ["aria-label"], xn = {
|
|
|
898
1031
|
e.core.motionActive.value
|
|
899
1032
|
);
|
|
900
1033
|
}
|
|
1034
|
+
function R() {
|
|
1035
|
+
if (o.value.status !== "ready") throw new Error("图片画面尚未就绪");
|
|
1036
|
+
return { image: o.value.value.motionSource, scale: 1 };
|
|
1037
|
+
}
|
|
901
1038
|
return n({
|
|
902
|
-
captureFrame:
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
1039
|
+
captureFrame: R,
|
|
1040
|
+
retainFrame: () => ({
|
|
1041
|
+
...R(),
|
|
1042
|
+
release: w.retainDisplay()
|
|
1043
|
+
})
|
|
1044
|
+
}), (F, C) => (q(), _(Fe, null, [
|
|
907
1045
|
T("canvas", {
|
|
908
1046
|
ref_key: "canvasRef",
|
|
909
|
-
ref:
|
|
1047
|
+
ref: a,
|
|
910
1048
|
class: "mp-canvas-renderer",
|
|
911
|
-
"aria-label":
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
1049
|
+
"aria-label": F.media.title,
|
|
1050
|
+
style: we({ visibility: l.value.kind === "gif" ? "hidden" : "inherit" })
|
|
1051
|
+
}, null, 12, In),
|
|
1052
|
+
l.value.kind === "gif" ? (q(), We(bn, {
|
|
1053
|
+
key: 0,
|
|
1054
|
+
core: F.core,
|
|
1055
|
+
src: l.value.url,
|
|
1056
|
+
title: F.media.title
|
|
1057
|
+
}, null, 8, ["core", "src", "title"])) : le("", !0),
|
|
1058
|
+
u.value === "loading" ? (q(), _("div", Dn, On)) : le("", !0),
|
|
1059
|
+
u.value === "error" ? (q(), _("div", An, [
|
|
1060
|
+
_n,
|
|
916
1061
|
T("button", {
|
|
917
1062
|
type: "button",
|
|
918
|
-
onClick:
|
|
1063
|
+
onClick: re(P, ["stop"])
|
|
919
1064
|
}, "重新加载")
|
|
920
|
-
])) :
|
|
921
|
-
|
|
1065
|
+
])) : le("", !0),
|
|
1066
|
+
p.value && c.value !== "blocked" ? (q(), _("span", Vn, " 高清图加载失败,当前显示预览图 ")) : le("", !0)
|
|
922
1067
|
], 64));
|
|
923
1068
|
}
|
|
924
1069
|
});
|
|
925
|
-
function
|
|
1070
|
+
function Un(t, n, r) {
|
|
926
1071
|
const { buffered: e } = t;
|
|
927
1072
|
if (!Number.isFinite(n) || n <= 0) return [];
|
|
928
|
-
const
|
|
929
|
-
for (let
|
|
930
|
-
const
|
|
931
|
-
let u =
|
|
932
|
-
|
|
1073
|
+
const i = [], a = Math.min(0.25, n * 0.05);
|
|
1074
|
+
for (let o = 0; o < e.length; o++) {
|
|
1075
|
+
const l = J(e.start(o), 0, n);
|
|
1076
|
+
let u = J(e.end(o), l, n);
|
|
1077
|
+
o === e.length - 1 && (t.ended || r.kind === "retained" && e.end(o) >= r.end || t.readyState >= 4 && n - u <= a) && (u = n), u > l && i.push({ start: l, end: u });
|
|
933
1078
|
}
|
|
934
|
-
return
|
|
1079
|
+
return i;
|
|
935
1080
|
}
|
|
936
|
-
function
|
|
1081
|
+
function _e(t) {
|
|
937
1082
|
const n = Math.max(0, Math.floor(Number.isFinite(t) ? t : 0));
|
|
938
1083
|
return `${String(Math.floor(n / 60)).padStart(2, "0")}:${String(n % 60).padStart(2, "0")}`;
|
|
939
1084
|
}
|
|
940
|
-
function
|
|
1085
|
+
function Mt(t) {
|
|
941
1086
|
return Number.isFinite(t) && t > 0 ? t : 0;
|
|
942
1087
|
}
|
|
943
|
-
function
|
|
1088
|
+
function St() {
|
|
944
1089
|
return { duration: 0, time: 0, buffered: 0, bufferedRanges: [] };
|
|
945
1090
|
}
|
|
946
|
-
function
|
|
1091
|
+
function Yn() {
|
|
947
1092
|
let t = 0, n = { kind: "pending" };
|
|
948
1093
|
return {
|
|
949
|
-
setDuration(
|
|
950
|
-
t =
|
|
1094
|
+
setDuration(r) {
|
|
1095
|
+
t = Mt(r);
|
|
951
1096
|
},
|
|
952
|
-
complete(
|
|
953
|
-
const { buffered: e } =
|
|
1097
|
+
complete(r) {
|
|
1098
|
+
const { buffered: e } = r;
|
|
954
1099
|
n = e.length > 0 ? { kind: "retained", end: e.end(e.length - 1) } : { kind: "pending" };
|
|
955
1100
|
},
|
|
956
1101
|
reset() {
|
|
957
1102
|
t = 0, n = { kind: "pending" };
|
|
958
1103
|
},
|
|
959
|
-
read(
|
|
960
|
-
const
|
|
1104
|
+
read(r, e) {
|
|
1105
|
+
const i = t > 0 ? t : Mt(r.duration), a = Un(r, i, n);
|
|
961
1106
|
return {
|
|
962
|
-
duration:
|
|
963
|
-
time: e ?
|
|
964
|
-
buffered:
|
|
965
|
-
bufferedRanges:
|
|
1107
|
+
duration: i,
|
|
1108
|
+
time: e ? i : J(r.currentTime, 0, i),
|
|
1109
|
+
buffered: a.length > 0 ? a[a.length - 1].end : 0,
|
|
1110
|
+
bufferedRanges: a
|
|
966
1111
|
};
|
|
967
1112
|
}
|
|
968
1113
|
};
|
|
969
1114
|
}
|
|
970
1115
|
function qt(t, n) {
|
|
971
|
-
const
|
|
1116
|
+
const r = Yn(), e = mt({
|
|
972
1117
|
playing: !1,
|
|
973
1118
|
buffering: !1,
|
|
974
|
-
...
|
|
1119
|
+
...St(),
|
|
975
1120
|
muted: !1,
|
|
976
1121
|
ended: !1,
|
|
977
1122
|
scrubbing: !1,
|
|
978
1123
|
scrubTime: 0,
|
|
979
1124
|
status: "loading"
|
|
980
1125
|
});
|
|
981
|
-
let
|
|
982
|
-
const
|
|
983
|
-
() =>
|
|
984
|
-
),
|
|
985
|
-
() => e.bufferedRanges.map(({ start:
|
|
986
|
-
left:
|
|
987
|
-
width: (
|
|
1126
|
+
let i = !1, a = 0, o = !1;
|
|
1127
|
+
const l = V(() => e.duration > 0 && e.status !== "error"), u = V(() => e.scrubbing ? e.scrubTime : e.time), p = V(() => l.value ? u.value / e.duration * 100 : 0), c = V(
|
|
1128
|
+
() => l.value ? e.buffered / e.duration * 100 : 0
|
|
1129
|
+
), x = V(
|
|
1130
|
+
() => e.bufferedRanges.map(({ start: C, end: D }) => ({
|
|
1131
|
+
left: C / e.duration * 100,
|
|
1132
|
+
width: (D - C) / e.duration * 100
|
|
988
1133
|
}))
|
|
989
1134
|
);
|
|
990
|
-
function
|
|
991
|
-
Object.assign(e,
|
|
1135
|
+
function L() {
|
|
1136
|
+
Object.assign(e, r.read(t(), e.ended));
|
|
992
1137
|
}
|
|
993
|
-
function S(
|
|
994
|
-
|
|
1138
|
+
function S(C) {
|
|
1139
|
+
o || (r.setDuration(C), L(), e.scrubTime = J(e.scrubTime, 0, e.duration));
|
|
995
1140
|
}
|
|
996
|
-
function
|
|
997
|
-
|
|
1141
|
+
function E() {
|
|
1142
|
+
r.reset(), i = !1, a += 1, Object.assign(e, {
|
|
998
1143
|
playing: !1,
|
|
999
1144
|
buffering: !1,
|
|
1000
|
-
...
|
|
1145
|
+
...St(),
|
|
1001
1146
|
ended: !1,
|
|
1002
1147
|
scrubbing: !1,
|
|
1003
1148
|
scrubTime: 0,
|
|
1004
1149
|
status: "loading"
|
|
1005
1150
|
});
|
|
1006
1151
|
}
|
|
1007
|
-
async function
|
|
1008
|
-
if (
|
|
1009
|
-
const
|
|
1152
|
+
async function w() {
|
|
1153
|
+
if (o) return;
|
|
1154
|
+
const C = ++a;
|
|
1010
1155
|
e.ended && (t().currentTime = 0, e.time = 0), e.ended = !1, e.buffering = !0;
|
|
1011
1156
|
try {
|
|
1012
1157
|
await t().play();
|
|
1013
|
-
} catch (
|
|
1014
|
-
if (
|
|
1015
|
-
e.buffering = !1, e.playing = !1,
|
|
1158
|
+
} catch (D) {
|
|
1159
|
+
if (C !== a) return;
|
|
1160
|
+
e.buffering = !1, e.playing = !1, D instanceof Error && D.name !== "NotAllowedError" && D.name !== "AbortError" && n(D);
|
|
1016
1161
|
}
|
|
1017
1162
|
}
|
|
1018
|
-
function
|
|
1019
|
-
|
|
1163
|
+
function g() {
|
|
1164
|
+
a += 1, i = !1, e.scrubbing = !1, e.buffering = !1, t().pause();
|
|
1020
1165
|
}
|
|
1021
|
-
function
|
|
1022
|
-
e.playing ?
|
|
1166
|
+
function B() {
|
|
1167
|
+
e.playing ? g() : w();
|
|
1023
1168
|
}
|
|
1024
|
-
function
|
|
1025
|
-
!
|
|
1169
|
+
function O() {
|
|
1170
|
+
!l.value || e.scrubbing || (i = e.playing, e.scrubbing = !0, e.scrubTime = e.time, t().pause());
|
|
1026
1171
|
}
|
|
1027
|
-
function
|
|
1028
|
-
e.scrubTime =
|
|
1172
|
+
function h(C) {
|
|
1173
|
+
e.scrubTime = J(C, 0, e.duration);
|
|
1029
1174
|
}
|
|
1030
|
-
function
|
|
1175
|
+
function k(C = !0) {
|
|
1031
1176
|
if (!e.scrubbing) return;
|
|
1032
|
-
const
|
|
1033
|
-
|
|
1177
|
+
const D = i;
|
|
1178
|
+
i = !1, e.scrubbing = !1, C && (t().currentTime = e.scrubTime, e.time = e.scrubTime, e.ended = !1), D && w();
|
|
1034
1179
|
}
|
|
1035
1180
|
function m() {
|
|
1036
1181
|
t().muted = !t().muted, e.muted = t().muted;
|
|
1037
1182
|
}
|
|
1038
|
-
function
|
|
1039
|
-
e.status = "error", e.playing = !1, e.buffering = !1, n(
|
|
1183
|
+
function y(C) {
|
|
1184
|
+
e.status = "error", e.playing = !1, e.buffering = !1, n(C);
|
|
1040
1185
|
}
|
|
1041
|
-
const
|
|
1186
|
+
const v = Object.fromEntries(
|
|
1042
1187
|
Object.entries({
|
|
1043
|
-
loadedmetadata:
|
|
1044
|
-
durationchange:
|
|
1045
|
-
timeupdate:
|
|
1046
|
-
progress:
|
|
1188
|
+
loadedmetadata: L,
|
|
1189
|
+
durationchange: L,
|
|
1190
|
+
timeupdate: L,
|
|
1191
|
+
progress: L,
|
|
1047
1192
|
loadeddata: () => {
|
|
1048
|
-
|
|
1193
|
+
L(), e.status = "ready", e.buffering = !1;
|
|
1049
1194
|
},
|
|
1050
1195
|
canplay: () => {
|
|
1051
|
-
|
|
1196
|
+
L(), e.buffering = !1;
|
|
1052
1197
|
},
|
|
1053
|
-
canplaythrough:
|
|
1198
|
+
canplaythrough: L,
|
|
1054
1199
|
play: () => {
|
|
1055
1200
|
e.playing = !0, e.ended = !1;
|
|
1056
1201
|
},
|
|
@@ -1061,7 +1206,7 @@ function qt(t, n) {
|
|
|
1061
1206
|
e.playing = !1, e.buffering = !1;
|
|
1062
1207
|
},
|
|
1063
1208
|
ended: () => {
|
|
1064
|
-
e.playing = !1, e.ended = !0, e.buffering = !1,
|
|
1209
|
+
e.playing = !1, e.ended = !0, e.buffering = !1, r.complete(t()), L();
|
|
1065
1210
|
},
|
|
1066
1211
|
waiting: () => {
|
|
1067
1212
|
e.buffering = e.playing;
|
|
@@ -1070,50 +1215,50 @@ function qt(t, n) {
|
|
|
1070
1215
|
e.buffering = !0;
|
|
1071
1216
|
},
|
|
1072
1217
|
seeked: () => {
|
|
1073
|
-
e.buffering = !1,
|
|
1218
|
+
e.buffering = !1, L();
|
|
1074
1219
|
},
|
|
1075
1220
|
volumechange: () => {
|
|
1076
1221
|
e.muted = t().muted;
|
|
1077
1222
|
},
|
|
1078
1223
|
error: () => {
|
|
1079
|
-
|
|
1224
|
+
y(new Error("视频暂时无法播放,请重试或检查资源格式"));
|
|
1080
1225
|
}
|
|
1081
|
-
}).map(([
|
|
1082
|
-
|
|
1226
|
+
}).map(([C, D]) => [
|
|
1227
|
+
C,
|
|
1083
1228
|
() => {
|
|
1084
|
-
|
|
1229
|
+
o || D();
|
|
1085
1230
|
}
|
|
1086
1231
|
])
|
|
1087
1232
|
);
|
|
1088
|
-
function
|
|
1089
|
-
|
|
1233
|
+
function R() {
|
|
1234
|
+
o = !0, g();
|
|
1090
1235
|
}
|
|
1091
|
-
function
|
|
1092
|
-
|
|
1236
|
+
function F() {
|
|
1237
|
+
E(), e.buffering = !0, t().load();
|
|
1093
1238
|
}
|
|
1094
1239
|
return {
|
|
1095
1240
|
state: e,
|
|
1096
|
-
seekable:
|
|
1241
|
+
seekable: l,
|
|
1097
1242
|
displayTime: u,
|
|
1098
|
-
progress:
|
|
1243
|
+
progress: p,
|
|
1099
1244
|
bufferedProgress: c,
|
|
1100
|
-
bufferedRanges:
|
|
1101
|
-
events:
|
|
1102
|
-
play:
|
|
1103
|
-
pause:
|
|
1104
|
-
toggle:
|
|
1105
|
-
beginScrub:
|
|
1106
|
-
scrub:
|
|
1107
|
-
endScrub:
|
|
1245
|
+
bufferedRanges: x,
|
|
1246
|
+
events: v,
|
|
1247
|
+
play: w,
|
|
1248
|
+
pause: g,
|
|
1249
|
+
toggle: B,
|
|
1250
|
+
beginScrub: O,
|
|
1251
|
+
scrub: h,
|
|
1252
|
+
endScrub: k,
|
|
1108
1253
|
toggleMuted: m,
|
|
1109
|
-
retry:
|
|
1254
|
+
retry: F,
|
|
1110
1255
|
setSourceDuration: S,
|
|
1111
|
-
resetSource:
|
|
1112
|
-
sourceObserver: { error:
|
|
1113
|
-
dispose:
|
|
1256
|
+
resetSource: E,
|
|
1257
|
+
sourceObserver: { error: y, duration: S, reset: E },
|
|
1258
|
+
dispose: R
|
|
1114
1259
|
};
|
|
1115
1260
|
}
|
|
1116
|
-
const
|
|
1261
|
+
const Xn = ["data-live-state"], Hn = { class: "mp-dom-renderer mp-live-photo__motion" }, Wn = ["preload"], Nn = /* @__PURE__ */ $e({
|
|
1117
1262
|
__name: "LivePhotoRenderer",
|
|
1118
1263
|
props: {
|
|
1119
1264
|
media: {},
|
|
@@ -1124,139 +1269,141 @@ const Fn = ["data-live-state"], $n = { class: "mp-dom-renderer mp-live-photo__mo
|
|
|
1124
1269
|
requestVersion: { default: 0 },
|
|
1125
1270
|
loadEnabled: { type: Boolean, default: !0 },
|
|
1126
1271
|
priority: { default: 0 },
|
|
1127
|
-
resourcePolicy: { default: () =>
|
|
1128
|
-
resolveSource: { type: Function, default:
|
|
1272
|
+
resourcePolicy: { default: () => Ge },
|
|
1273
|
+
resolveSource: { type: Function, default: Ke },
|
|
1129
1274
|
rendering: { type: Boolean, default: !0 },
|
|
1130
|
-
initialImage: { default: () =>
|
|
1275
|
+
initialImage: { default: () => Ce },
|
|
1131
1276
|
quality: { default: "screen" }
|
|
1132
1277
|
},
|
|
1133
1278
|
emits: ["ready", "error", "originalState", "liveState", "liveEnded"],
|
|
1134
|
-
setup(t, { expose: n, emit:
|
|
1135
|
-
const e = t,
|
|
1136
|
-
() =>
|
|
1137
|
-
(m) =>
|
|
1138
|
-
), { state: c } =
|
|
1279
|
+
setup(t, { expose: n, emit: r }) {
|
|
1280
|
+
const e = t, i = r, a = $(), o = $(), l = $(), u = $(), p = qt(
|
|
1281
|
+
() => a.value,
|
|
1282
|
+
(m) => i("error", m)
|
|
1283
|
+
), { state: c } = p;
|
|
1139
1284
|
Tt(
|
|
1140
|
-
() =>
|
|
1285
|
+
() => a.value,
|
|
1141
1286
|
() => e.media,
|
|
1142
1287
|
() => e.active && e.loadEnabled,
|
|
1143
|
-
() =>
|
|
1144
|
-
|
|
1288
|
+
() => it,
|
|
1289
|
+
p.sourceObserver
|
|
1145
1290
|
);
|
|
1146
|
-
let
|
|
1291
|
+
let x = !1, L = () => {
|
|
1147
1292
|
};
|
|
1148
|
-
const S =
|
|
1293
|
+
const S = V(
|
|
1149
1294
|
() => e.active && e.enabled && c.playing && c.status === "ready" && !c.buffering
|
|
1150
|
-
),
|
|
1295
|
+
), E = V(() => ({
|
|
1151
1296
|
transform: `translate(-50%, -50%) translate3d(${e.core.state.offsetX}px, ${e.core.state.offsetY}px, 0)`
|
|
1152
|
-
})),
|
|
1297
|
+
})), w = V(() => ({
|
|
1153
1298
|
width: `${e.core.mediaSize.value.width * e.core.displayScale.value}px`,
|
|
1154
1299
|
height: `${e.core.mediaSize.value.height * e.core.displayScale.value}px`,
|
|
1155
1300
|
transform: `rotate(${e.core.state.rotation}deg)`
|
|
1156
1301
|
}));
|
|
1157
|
-
function
|
|
1158
|
-
|
|
1302
|
+
function g() {
|
|
1303
|
+
p.pause(), a.value.readyState >= HTMLMediaElement.HAVE_METADATA && (a.value.currentTime = 0);
|
|
1159
1304
|
}
|
|
1160
|
-
function
|
|
1161
|
-
!e.active || !e.enabled || !e.loadEnabled || !e.playing || c.status !== "ready" || c.buffering ?
|
|
1162
|
-
!
|
|
1305
|
+
function B() {
|
|
1306
|
+
!e.active || !e.enabled || !e.loadEnabled || !e.playing || c.status !== "ready" || c.buffering ? g() : p.play().then(() => {
|
|
1307
|
+
!x && !c.playing && e.playing && i("liveEnded");
|
|
1163
1308
|
});
|
|
1164
1309
|
}
|
|
1165
|
-
|
|
1310
|
+
te(
|
|
1166
1311
|
() => [c.status, c.playing, c.buffering],
|
|
1167
1312
|
() => {
|
|
1168
1313
|
const m = c.status === "error" ? "error" : c.buffering || c.status === "loading" ? "loading" : S.value ? "playing" : "idle";
|
|
1169
|
-
|
|
1314
|
+
i("liveState", m);
|
|
1170
1315
|
},
|
|
1171
1316
|
{ immediate: !0 }
|
|
1172
1317
|
);
|
|
1173
|
-
function
|
|
1174
|
-
|
|
1318
|
+
function O() {
|
|
1319
|
+
x || (g(), i("liveEnded"));
|
|
1175
1320
|
}
|
|
1176
|
-
function
|
|
1177
|
-
document.hidden && (
|
|
1321
|
+
function h() {
|
|
1322
|
+
document.hidden && (g(), i("liveEnded"));
|
|
1178
1323
|
}
|
|
1179
1324
|
qe(() => {
|
|
1180
|
-
|
|
1325
|
+
L = te(() => [e.active, e.enabled, e.loadEnabled, e.playing], B, {
|
|
1181
1326
|
flush: "post"
|
|
1182
|
-
}),
|
|
1183
|
-
}),
|
|
1184
|
-
|
|
1327
|
+
}), B(), document.addEventListener("visibilitychange", h);
|
|
1328
|
+
}), Te(() => {
|
|
1329
|
+
L(), x = !0, p.dispose(), document.removeEventListener("visibilitychange", h);
|
|
1185
1330
|
});
|
|
1186
|
-
function
|
|
1187
|
-
const m = document.createElement("canvas"),
|
|
1331
|
+
function k() {
|
|
1332
|
+
const m = document.createElement("canvas"), y = Math.min(
|
|
1188
1333
|
1,
|
|
1189
|
-
Math.sqrt(
|
|
1334
|
+
Math.sqrt(ue.maxCanvasPixels / (e.media.width * e.media.height))
|
|
1190
1335
|
);
|
|
1191
|
-
m.width = Math.round(e.media.width *
|
|
1192
|
-
const
|
|
1193
|
-
|
|
1194
|
-
const
|
|
1195
|
-
return
|
|
1196
|
-
}
|
|
1197
|
-
return n({ captureFrame:
|
|
1336
|
+
m.width = Math.round(e.media.width * y), m.height = Math.round(e.media.height * y);
|
|
1337
|
+
const P = m.getContext("2d"), v = Number(getComputedStyle(l.value).opacity);
|
|
1338
|
+
P.drawImage(u.value.captureFrame().image, 0, 0, m.width, m.height), v < 1 && a.value.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA && (P.globalAlpha = 1 - v, P.drawImage(a.value, 0, 0, m.width, m.height));
|
|
1339
|
+
const R = new DOMMatrixReadOnly(getComputedStyle(o.value).transform).a;
|
|
1340
|
+
return p.pause(), { image: m, scale: R };
|
|
1341
|
+
}
|
|
1342
|
+
return n({ captureFrame: k, retainFrame: () => ({ ...k(), release: () => {
|
|
1343
|
+
} }) }), (m, y) => (q(), _("div", {
|
|
1198
1344
|
class: "mp-live-photo-renderer",
|
|
1199
|
-
"data-live-state":
|
|
1345
|
+
"data-live-state": f(c).status === "error" ? "error" : S.value ? "playing" : "idle"
|
|
1200
1346
|
}, [
|
|
1201
1347
|
T("div", {
|
|
1202
1348
|
ref_key: "effectsRef",
|
|
1203
|
-
ref:
|
|
1204
|
-
class:
|
|
1349
|
+
ref: o,
|
|
1350
|
+
class: De(["mp-live-photo__effects", { "is-playing": S.value }])
|
|
1205
1351
|
}, [
|
|
1206
|
-
T("div",
|
|
1352
|
+
T("div", Hn, [
|
|
1207
1353
|
T("div", {
|
|
1208
1354
|
class: "mp-dom-renderer__frame",
|
|
1209
|
-
style:
|
|
1355
|
+
style: we(E.value)
|
|
1210
1356
|
}, [
|
|
1211
1357
|
T("video", Ne({
|
|
1212
1358
|
ref_key: "videoRef",
|
|
1213
|
-
ref:
|
|
1359
|
+
ref: a,
|
|
1214
1360
|
class: "mp-dom-renderer__node",
|
|
1215
|
-
style:
|
|
1361
|
+
style: w.value,
|
|
1216
1362
|
preload: m.active && m.enabled && m.loadEnabled ? "auto" : "none",
|
|
1217
1363
|
playsinline: "",
|
|
1218
1364
|
"webkit-playsinline": "true",
|
|
1219
1365
|
crossorigin: "anonymous"
|
|
1220
|
-
},
|
|
1221
|
-
onEnded:
|
|
1222
|
-
onError:
|
|
1223
|
-
}), null, 16,
|
|
1366
|
+
}, gt(f(p).events, !0), {
|
|
1367
|
+
onEnded: O,
|
|
1368
|
+
onError: y[0] || (y[0] = (P) => i("liveEnded"))
|
|
1369
|
+
}), null, 16, Wn)
|
|
1224
1370
|
], 4)
|
|
1225
1371
|
]),
|
|
1226
1372
|
T("div", {
|
|
1227
1373
|
ref_key: "stillRef",
|
|
1228
|
-
ref:
|
|
1229
|
-
class:
|
|
1374
|
+
ref: l,
|
|
1375
|
+
class: De(["mp-live-photo__still", { "is-playing": S.value }])
|
|
1230
1376
|
}, [
|
|
1231
|
-
|
|
1377
|
+
Ie(pt, {
|
|
1232
1378
|
ref_key: "imageRendererRef",
|
|
1233
1379
|
ref: u,
|
|
1380
|
+
active: m.active,
|
|
1234
1381
|
"request-version": m.requestVersion,
|
|
1235
1382
|
"load-enabled": m.loadEnabled,
|
|
1236
1383
|
priority: m.priority,
|
|
1237
1384
|
"resource-policy": m.resourcePolicy,
|
|
1238
1385
|
"resolve-source": m.resolveSource,
|
|
1239
|
-
onOriginalState:
|
|
1386
|
+
onOriginalState: y[1] || (y[1] = (P, v) => i("originalState", P, v)),
|
|
1240
1387
|
media: m.media,
|
|
1241
1388
|
"initial-image": m.initialImage,
|
|
1242
1389
|
rendering: m.rendering,
|
|
1243
1390
|
core: m.core,
|
|
1244
1391
|
quality: m.quality,
|
|
1245
|
-
onReady:
|
|
1246
|
-
onError:
|
|
1247
|
-
}, null, 8, ["request-version", "load-enabled", "priority", "resource-policy", "resolve-source", "media", "initial-image", "rendering", "core", "quality"])
|
|
1392
|
+
onReady: y[2] || (y[2] = (P) => i("ready", P)),
|
|
1393
|
+
onError: y[3] || (y[3] = (P) => i("error", P))
|
|
1394
|
+
}, null, 8, ["active", "request-version", "load-enabled", "priority", "resource-policy", "resolve-source", "media", "initial-image", "rendering", "core", "quality"])
|
|
1248
1395
|
], 2)
|
|
1249
1396
|
], 2)
|
|
1250
|
-
], 8,
|
|
1397
|
+
], 8, Xn));
|
|
1251
1398
|
}
|
|
1252
1399
|
});
|
|
1253
|
-
function
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1256
|
-
const
|
|
1257
|
-
return
|
|
1400
|
+
function Zn(t, n) {
|
|
1401
|
+
const r = document.createElement("canvas"), e = Math.min(1, Math.sqrt(ue.maxCanvasPixels / (n.width * n.height)));
|
|
1402
|
+
r.width = Math.max(1, Math.round(n.width * e)), r.height = Math.max(1, Math.round(n.height * e));
|
|
1403
|
+
const i = Math.min(r.width / t.videoWidth, r.height / t.videoHeight), a = t.videoWidth * i, o = t.videoHeight * i;
|
|
1404
|
+
return r.getContext("2d").drawImage(t, (r.width - a) / 2, (r.height - o) / 2, a, o), t.pause(), r;
|
|
1258
1405
|
}
|
|
1259
|
-
const
|
|
1406
|
+
const jn = {
|
|
1260
1407
|
class: "mp-video-icon--generic",
|
|
1261
1408
|
width: "22",
|
|
1262
1409
|
height: "22",
|
|
@@ -1267,13 +1414,13 @@ const Dn = {
|
|
|
1267
1414
|
"stroke-linecap": "round",
|
|
1268
1415
|
"stroke-linejoin": "round",
|
|
1269
1416
|
"aria-hidden": "true"
|
|
1270
|
-
},
|
|
1417
|
+
}, Gn = ["d", "fill"], Kn = ["src"], Qn = ["src"], at = /* @__PURE__ */ $e({
|
|
1271
1418
|
__name: "VideoIcon",
|
|
1272
1419
|
props: {
|
|
1273
1420
|
name: {}
|
|
1274
1421
|
},
|
|
1275
1422
|
setup(t) {
|
|
1276
|
-
const n = t,
|
|
1423
|
+
const n = t, r = {
|
|
1277
1424
|
play: ["mobile-play", "pc-play"],
|
|
1278
1425
|
replay: ["mobile-play", "pc-play"],
|
|
1279
1426
|
pause: ["mobile-pause", "pc-pause"],
|
|
@@ -1288,7 +1435,7 @@ const Dn = {
|
|
|
1288
1435
|
"pc-pause": new URL("data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e暂停%3c/title%3e%3cg%20id='页面-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='2.11查看视频'%20transform='translate(-737.000000,%20-1017.000000)'%20fill='%23FFFFFF'%3e%3cg%20id='编组-7'%20transform='translate(68.000000,%200.000000)'%3e%3cg%20id='编组'%20transform='translate(646.000000,%20970.000000)'%3e%3cg%20id='暂停-2'%20transform='translate(23.000000,%2047.000000)'%3e%3cg%20id='暂停'%20transform='translate(1.000000,%200.000000)'%3e%3crect%20id='矩形'%20x='0'%20y='0'%20width='4'%20height='16'%20rx='2'%3e%3c/rect%3e%3crect%20id='矩形备份-4'%20x='10'%20y='0'%20width='4'%20height='16'%20rx='2'%3e%3c/rect%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e", import.meta.url).href,
|
|
1289
1436
|
"pc-fullscreen": new URL("data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e形状%3c/title%3e%3cg%20id='页面-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='2.11查看视频'%20transform='translate(-1236.000000,%20-1017.000000)'%20fill='%23FFFFFF'%20fill-rule='nonzero'%3e%3cg%20id='编组-7'%20transform='translate(68.000000,%200.000000)'%3e%3cg%20id='编组'%20transform='translate(646.000000,%20970.000000)'%3e%3cg%20id='形状-2'%20transform='translate(522.000000,%2047.000000)'%3e%3cpath%20d='M2.64896326,8.31181102%20C3.0069116,8.31181102%203.29792652,8.60254391%203.29792652,8.96014537%20L3.297,11.774%20L6.30847581,8.766808%20C6.56165879,8.51387038%206.97344489,8.51387038%207.22662786,8.766808%20C7.47981084,9.01974561%207.47981084,9.43113265%207.22662786,9.68407026%20L4.204,12.701%20L7.04328847,12.7018776%20C7.40123681,12.7018776%207.69225716,12.9926105%207.69225716,13.350212%20C7.6937068,13.7092671%207.40269189,14%207.04328847,14%20L3.79410695,14%20C2.80465624,14%202,13.1961236%202,12.2076317%20L2,8.96014537%20C2,8.60254391%202.29101491,8.31181102%202.64896326,8.31181102%20Z%20M12.2058931,2%20C12.6893524,2%2013.1286932,2.19192028%2013.4516066,2.50352194%20C13.4593844,2.50982425%2013.4671226,2.51718474%2013.4747181,2.52477286%20L13.4959896,2.54786191%20C13.8078935,2.87046237%2014,3.30937746%2014,3.79236826%20L14,7.03985463%20C14,7.39745609%2013.7089851,7.68818898%2013.3510367,7.68818898%20C12.9930884,7.68818898%2012.7020735,7.39745609%2012.7020735,7.03985463%20L12.702,4.213%20L9.67842852,7.23464567%20C9.55183703,7.36111448%209.38450346,7.42507571%209.21862495,7.42507571%20C9.05274645,7.42507571%208.88686795,7.36111448%208.76027646,7.23464567%20C8.50709349,6.98170806%208.50709349,6.57032102%208.76027646,6.3173834%20L11.783,3.296%20L8.95525646,3.29666869%20C8.59730811,3.29666869%208.3062932,3.0059358%208.3062932,2.64833434%20C8.3062932,2.29073289%208.59730811,2%208.95525646,2%20L12.2058931,2%20Z'%20id='全屏'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e", import.meta.url).href,
|
|
1290
1437
|
"pc-exit": new URL("data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='16px'%20height='16px'%20viewBox='0%200%2016%2016'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e形状备份%3c/title%3e%3cg%20id='页面-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='2.11查看视频'%20transform='translate(-1275.000000,%20-1007.000000)'%20fill='%23FFFFFF'%20fill-rule='nonzero'%3e%3cg%20id='编组-7'%20transform='translate(68.000000,%200.000000)'%3e%3cg%20id='编组备份'%20transform='translate(601.000000,%20987.000000)'%3e%3cg%20id='形状-2'%20transform='translate(606.000000,%2020.000000)'%3e%3cpath%20d='M5.89959985,8.31181102%20C6.88905056,8.31181102%207.6937068,9.11568746%207.6937068,10.1041793%20L7.6937068,13.3516657%20C7.6937068,13.7092671%207.40269189,14%207.04474354,14%20C6.6867952,14%206.39578028,13.7092671%206.39578028,13.3516657%20L6.395,10.514%20L3.43761368,13.4679588%20C3.31102219,13.5958813%203.14514369,13.6583889%202.97926519,13.6583889%20C2.81338669,13.6583889%202.64750818,13.5944276%202.5209167,13.4679588%20C2.26773372,13.2150212%202.26773372,12.8036342%202.5209167,12.5506965%20L5.465,9.608%20L2.64896326,9.60847971%20C2.29101491,9.60847971%202,9.31774682%202,8.96014537%20C2,8.60254391%202.29101491,8.31181102%202.64896326,8.31181102%20L5.89959985,8.31181102%20Z%20M8.9567061,2%20C9.31465444,2%209.60566936,2.29073289%209.60566936,2.64833434%20L9.605,5.473%20L12.556566,2.52477286%20C12.809749,2.27183525%2013.2215351,2.27183525%2013.4747181,2.52477286%20C13.7279011,2.77771048%2013.7279011,3.18909752%2013.4747181,3.44203513%20L10.523,6.39%20L13.3510313,6.39006663%20C13.7089797,6.39006663%2014,6.68079952%2014,7.03840097%20C14.0014496,7.39745609%2013.7104347,7.68818898%2013.3510313,7.68818898%20L10.1018498,7.68818898%20C9.11239908,7.68818898%208.30774284,6.88431254%208.30774284,5.89582071%20L8.30774284,2.64833434%20C8.30774284,2.29073289%208.59875775,2%208.9567061,2%20Z'%20id='全屏'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e", import.meta.url).href
|
|
1291
|
-
},
|
|
1438
|
+
}, i = {
|
|
1292
1439
|
play: ["m9 5 11 7-11 7Z"],
|
|
1293
1440
|
pause: ["M8 5v14M16 5v14"],
|
|
1294
1441
|
replay: ["M4 10a8 8 0 1 1 1 7", "M4 4v6h6"],
|
|
@@ -1297,38 +1444,38 @@ const Dn = {
|
|
|
1297
1444
|
volume: ["m11 4-6 5H2v6h3l6 5Z", "M15 8a6 6 0 0 1 0 8M18 5a10 10 0 0 1 0 14"],
|
|
1298
1445
|
muted: ["m11 4-6 5H2v6h3l6 5Z", "m16 9 6 6m0-6-6 6"]
|
|
1299
1446
|
};
|
|
1300
|
-
return (
|
|
1301
|
-
class:
|
|
1447
|
+
return (a, o) => (q(), _("span", {
|
|
1448
|
+
class: De(["mp-video-icon", { "has-album-icon": n.name in r }])
|
|
1302
1449
|
}, [
|
|
1303
|
-
(
|
|
1304
|
-
(
|
|
1450
|
+
(q(), _("svg", jn, [
|
|
1451
|
+
(q(!0), _(Fe, null, Ze(i[a.name], (l, u) => (q(), _("path", {
|
|
1305
1452
|
key: u,
|
|
1306
|
-
d:
|
|
1307
|
-
fill:
|
|
1308
|
-
}, null, 8,
|
|
1453
|
+
d: l,
|
|
1454
|
+
fill: a.name === "play" ? "currentColor" : "none"
|
|
1455
|
+
}, null, 8, Gn))), 128))
|
|
1309
1456
|
])),
|
|
1310
|
-
|
|
1457
|
+
a.name in r ? (q(), _(Fe, { key: 0 }, [
|
|
1311
1458
|
T("img", {
|
|
1312
1459
|
class: "mp-video-icon--mobile",
|
|
1313
|
-
src: e[
|
|
1460
|
+
src: e[r[a.name][0]],
|
|
1314
1461
|
alt: "",
|
|
1315
1462
|
"aria-hidden": "true",
|
|
1316
1463
|
draggable: "false"
|
|
1317
|
-
}, null, 8,
|
|
1464
|
+
}, null, 8, Kn),
|
|
1318
1465
|
T("img", {
|
|
1319
1466
|
class: "mp-video-icon--desktop",
|
|
1320
|
-
src: e[
|
|
1467
|
+
src: e[r[a.name][1]],
|
|
1321
1468
|
alt: "",
|
|
1322
1469
|
"aria-hidden": "true",
|
|
1323
1470
|
draggable: "false"
|
|
1324
|
-
}, null, 8,
|
|
1325
|
-
], 64)) :
|
|
1471
|
+
}, null, 8, Qn)
|
|
1472
|
+
], 64)) : le("", !0)
|
|
1326
1473
|
], 2));
|
|
1327
1474
|
}
|
|
1328
|
-
}),
|
|
1475
|
+
}), Jn = {
|
|
1329
1476
|
key: 0,
|
|
1330
1477
|
class: "mp-video-seek-preview"
|
|
1331
|
-
},
|
|
1478
|
+
}, ea = ["aria-label", "disabled"], ta = { class: "mp-video-time" }, na = ["tabindex", "aria-disabled", "aria-valuemax", "aria-valuenow", "aria-valuetext"], aa = /* @__PURE__ */ T("span", { class: "mp-video-progress__rail" }, null, -1), ia = { class: "mp-video-time" }, ra = ["aria-label", "aria-pressed"], oa = ["aria-label", "disabled"], la = /* @__PURE__ */ $e({
|
|
1332
1479
|
__name: "VideoControls",
|
|
1333
1480
|
props: {
|
|
1334
1481
|
playback: {},
|
|
@@ -1337,145 +1484,145 @@ const Dn = {
|
|
|
1337
1484
|
},
|
|
1338
1485
|
emits: ["fullscreen"],
|
|
1339
1486
|
setup(t, { emit: n }) {
|
|
1340
|
-
const
|
|
1341
|
-
function c(
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1487
|
+
const r = t, e = n, i = $(), { state: a, seekable: o, displayTime: l, progress: u, bufferedRanges: p } = r.playback;
|
|
1488
|
+
function c(w) {
|
|
1489
|
+
const g = i.value.getBoundingClientRect();
|
|
1490
|
+
r.playback.scrub((w.clientX - g.left) / Math.max(1, g.width) * a.duration);
|
|
1344
1491
|
}
|
|
1345
|
-
function
|
|
1346
|
-
!
|
|
1492
|
+
function x(w) {
|
|
1493
|
+
!o.value || w.pointerType === "mouse" && w.button !== 0 || (i.value.setPointerCapture(w.pointerId), r.playback.beginScrub(), c(w));
|
|
1347
1494
|
}
|
|
1348
|
-
function
|
|
1349
|
-
|
|
1495
|
+
function L(w) {
|
|
1496
|
+
a.scrubbing && c(w);
|
|
1350
1497
|
}
|
|
1351
|
-
function S(
|
|
1352
|
-
|
|
1498
|
+
function S(w) {
|
|
1499
|
+
a.scrubbing && (c(w), r.playback.endScrub());
|
|
1353
1500
|
}
|
|
1354
|
-
function
|
|
1355
|
-
|
|
1501
|
+
function E(w) {
|
|
1502
|
+
r.playback.beginScrub(), r.playback.scrub(l.value + w), r.playback.endScrub();
|
|
1356
1503
|
}
|
|
1357
|
-
return (
|
|
1504
|
+
return (w, g) => (q(), _("div", {
|
|
1358
1505
|
class: "mp-video-controls",
|
|
1359
1506
|
"data-preview-control": "",
|
|
1360
|
-
onPointerdown:
|
|
1507
|
+
onPointerdown: g[9] || (g[9] = re(() => {
|
|
1361
1508
|
}, ["stop"])),
|
|
1362
|
-
onPointermove:
|
|
1509
|
+
onPointermove: g[10] || (g[10] = re(() => {
|
|
1363
1510
|
}, ["stop"])),
|
|
1364
|
-
onPointerup:
|
|
1511
|
+
onPointerup: g[11] || (g[11] = re(() => {
|
|
1365
1512
|
}, ["stop"])),
|
|
1366
|
-
onPointercancel:
|
|
1513
|
+
onPointercancel: g[12] || (g[12] = re(() => {
|
|
1367
1514
|
}, ["stop"])),
|
|
1368
|
-
onClick:
|
|
1515
|
+
onClick: g[13] || (g[13] = re(() => {
|
|
1369
1516
|
}, ["stop"])),
|
|
1370
|
-
onDblclick:
|
|
1517
|
+
onDblclick: g[14] || (g[14] = re(() => {
|
|
1371
1518
|
}, ["stop"])),
|
|
1372
|
-
onKeydown:
|
|
1519
|
+
onKeydown: g[15] || (g[15] = re(() => {
|
|
1373
1520
|
}, ["stop"]))
|
|
1374
1521
|
}, [
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
T("span", null, " / " +
|
|
1378
|
-
])) :
|
|
1522
|
+
f(a).scrubbing ? (q(), _("div", Jn, [
|
|
1523
|
+
Gt(ce(f(_e)(f(l))), 1),
|
|
1524
|
+
T("span", null, " / " + ce(f(_e)(f(a).duration)), 1)
|
|
1525
|
+
])) : le("", !0),
|
|
1379
1526
|
T("button", {
|
|
1380
1527
|
type: "button",
|
|
1381
|
-
"aria-label":
|
|
1382
|
-
disabled:
|
|
1383
|
-
onClick:
|
|
1384
|
-
(
|
|
1528
|
+
"aria-label": f(a).ended ? "重新播放视频" : f(a).playing ? "暂停视频" : "播放视频",
|
|
1529
|
+
disabled: f(a).status === "error",
|
|
1530
|
+
onClick: g[0] || (g[0] = //@ts-ignore
|
|
1531
|
+
(...B) => w.playback.toggle && w.playback.toggle(...B))
|
|
1385
1532
|
}, [
|
|
1386
|
-
|
|
1387
|
-
name:
|
|
1533
|
+
Ie(at, {
|
|
1534
|
+
name: f(a).ended ? "replay" : f(a).playing ? "pause" : "play"
|
|
1388
1535
|
}, null, 8, ["name"])
|
|
1389
|
-
], 8,
|
|
1390
|
-
T("time",
|
|
1536
|
+
], 8, ea),
|
|
1537
|
+
T("time", ta, ce(f(_e)(f(l))), 1),
|
|
1391
1538
|
T("div", {
|
|
1392
1539
|
ref_key: "track",
|
|
1393
|
-
ref:
|
|
1394
|
-
class:
|
|
1540
|
+
ref: i,
|
|
1541
|
+
class: De(["mp-video-progress", { "is-scrubbing": f(a).scrubbing }]),
|
|
1395
1542
|
role: "slider",
|
|
1396
1543
|
"aria-label": "视频进度",
|
|
1397
|
-
tabindex:
|
|
1398
|
-
"aria-disabled": !
|
|
1544
|
+
tabindex: f(o) ? 0 : -1,
|
|
1545
|
+
"aria-disabled": !f(o),
|
|
1399
1546
|
"aria-valuemin": "0",
|
|
1400
|
-
"aria-valuemax":
|
|
1401
|
-
"aria-valuenow":
|
|
1402
|
-
"aria-valuetext": `${
|
|
1403
|
-
onPointerdown:
|
|
1404
|
-
onPointermove:
|
|
1405
|
-
onPointerup:
|
|
1406
|
-
onPointercancel:
|
|
1407
|
-
onLostpointercapture:
|
|
1547
|
+
"aria-valuemax": f(a).duration,
|
|
1548
|
+
"aria-valuenow": f(l),
|
|
1549
|
+
"aria-valuetext": `${f(_e)(f(l))} / ${f(_e)(f(a).duration)}`,
|
|
1550
|
+
onPointerdown: re(x, ["prevent"]),
|
|
1551
|
+
onPointermove: re(L, ["prevent"]),
|
|
1552
|
+
onPointerup: re(S, ["prevent"]),
|
|
1553
|
+
onPointercancel: g[1] || (g[1] = (B) => w.playback.endScrub(!1)),
|
|
1554
|
+
onLostpointercapture: g[2] || (g[2] = (B) => w.playback.endScrub(!1)),
|
|
1408
1555
|
onKeydown: [
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1556
|
+
g[3] || (g[3] = nt(re((B) => E(-5), ["prevent"]), ["left"])),
|
|
1557
|
+
g[4] || (g[4] = nt(re((B) => E(5), ["prevent"]), ["right"])),
|
|
1558
|
+
g[5] || (g[5] = nt(re((B) => E(-f(a).duration), ["prevent"]), ["home"])),
|
|
1559
|
+
g[6] || (g[6] = nt(re((B) => E(f(a).duration), ["prevent"]), ["end"]))
|
|
1413
1560
|
]
|
|
1414
1561
|
}, [
|
|
1415
|
-
|
|
1416
|
-
(
|
|
1417
|
-
key:
|
|
1562
|
+
aa,
|
|
1563
|
+
(q(!0), _(Fe, null, Ze(f(p), (B, O) => (q(), _("span", {
|
|
1564
|
+
key: O,
|
|
1418
1565
|
class: "mp-video-progress__buffered",
|
|
1419
|
-
style:
|
|
1566
|
+
style: we({ left: `${B.left}%`, width: `${B.width}%` })
|
|
1420
1567
|
}, null, 4))), 128)),
|
|
1421
1568
|
T("span", {
|
|
1422
1569
|
class: "mp-video-progress__played",
|
|
1423
|
-
style:
|
|
1570
|
+
style: we({ width: `${f(u)}%` })
|
|
1424
1571
|
}, null, 4),
|
|
1425
1572
|
T("span", {
|
|
1426
1573
|
class: "mp-video-progress__thumb",
|
|
1427
|
-
style:
|
|
1574
|
+
style: we({ left: `${f(u)}%` })
|
|
1428
1575
|
}, null, 4)
|
|
1429
|
-
], 42,
|
|
1430
|
-
T("time",
|
|
1576
|
+
], 42, na),
|
|
1577
|
+
T("time", ia, ce(f(_e)(f(a).duration)), 1),
|
|
1431
1578
|
T("button", {
|
|
1432
1579
|
type: "button",
|
|
1433
1580
|
class: "mp-video-volume",
|
|
1434
|
-
"aria-label":
|
|
1435
|
-
"aria-pressed":
|
|
1436
|
-
onClick:
|
|
1437
|
-
(
|
|
1581
|
+
"aria-label": f(a).muted ? "开启声音" : "静音视频",
|
|
1582
|
+
"aria-pressed": f(a).muted,
|
|
1583
|
+
onClick: g[7] || (g[7] = //@ts-ignore
|
|
1584
|
+
(...B) => w.playback.toggleMuted && w.playback.toggleMuted(...B))
|
|
1438
1585
|
}, [
|
|
1439
|
-
|
|
1440
|
-
name:
|
|
1586
|
+
Ie(at, {
|
|
1587
|
+
name: f(a).muted ? "muted" : "volume"
|
|
1441
1588
|
}, null, 8, ["name"])
|
|
1442
|
-
], 8,
|
|
1589
|
+
], 8, ra),
|
|
1443
1590
|
T("button", {
|
|
1444
1591
|
type: "button",
|
|
1445
|
-
"aria-label":
|
|
1446
|
-
disabled: !
|
|
1447
|
-
onClick:
|
|
1592
|
+
"aria-label": w.fullscreen ? "退出视频全屏" : "视频全屏",
|
|
1593
|
+
disabled: !w.canFullscreen,
|
|
1594
|
+
onClick: g[8] || (g[8] = (B) => e("fullscreen"))
|
|
1448
1595
|
}, [
|
|
1449
|
-
|
|
1450
|
-
name:
|
|
1596
|
+
Ie(at, {
|
|
1597
|
+
name: w.fullscreen ? "exit" : "fullscreen"
|
|
1451
1598
|
}, null, 8, ["name"])
|
|
1452
|
-
], 8,
|
|
1599
|
+
], 8, oa)
|
|
1453
1600
|
], 32));
|
|
1454
1601
|
}
|
|
1455
|
-
}),
|
|
1602
|
+
}), sa = ["data-playback"], ua = ["muted", "loop", "preload"], ca = {
|
|
1456
1603
|
key: 1,
|
|
1457
1604
|
class: "mp-video-loading",
|
|
1458
1605
|
role: "status",
|
|
1459
1606
|
"aria-label": "视频缓冲中"
|
|
1460
|
-
},
|
|
1461
|
-
|
|
1462
|
-
],
|
|
1607
|
+
}, da = /* @__PURE__ */ T("span", { class: "mp-spinner" }, null, -1), fa = [
|
|
1608
|
+
da
|
|
1609
|
+
], ma = ["aria-label"], ga = {
|
|
1463
1610
|
key: 3,
|
|
1464
1611
|
class: "mp-video-error",
|
|
1465
1612
|
role: "alert"
|
|
1466
|
-
},
|
|
1613
|
+
}, pa = ["inert"], ha = /* @__PURE__ */ $e({
|
|
1467
1614
|
inheritAttrs: !1,
|
|
1468
1615
|
__name: "VideoDomRenderer",
|
|
1469
1616
|
props: {
|
|
1470
|
-
initialImage: { default: () =>
|
|
1617
|
+
initialImage: { default: () => Ce },
|
|
1471
1618
|
rendering: { type: Boolean, default: !0 },
|
|
1472
1619
|
quality: { default: "screen" },
|
|
1473
1620
|
requestVersion: { default: 0 },
|
|
1474
1621
|
priority: { default: 0 },
|
|
1475
|
-
resourcePolicy: { default: () =>
|
|
1476
|
-
resolveSource: { type: Function, default:
|
|
1622
|
+
resourcePolicy: { default: () => Ge },
|
|
1623
|
+
resolveSource: { type: Function, default: Ke },
|
|
1477
1624
|
media: {},
|
|
1478
|
-
videoLoader: { type: Function, default:
|
|
1625
|
+
videoLoader: { type: Function, default: it },
|
|
1479
1626
|
core: {},
|
|
1480
1627
|
active: { type: Boolean, default: !0 },
|
|
1481
1628
|
enabled: { type: Boolean, default: !0 },
|
|
@@ -1489,160 +1636,168 @@ const Dn = {
|
|
|
1489
1636
|
controlsTarget: { default: "body" }
|
|
1490
1637
|
},
|
|
1491
1638
|
emits: ["originalState", "ready", "error"],
|
|
1492
|
-
setup(t, { expose: n, emit:
|
|
1493
|
-
const e = t,
|
|
1639
|
+
setup(t, { expose: n, emit: r }) {
|
|
1640
|
+
const e = t, i = r, a = $(!1), o = V(() => ({
|
|
1494
1641
|
...e.media,
|
|
1495
1642
|
type: "image",
|
|
1496
1643
|
src: e.media.poster || e.media.previewSrc || e.media.thumbnail
|
|
1497
|
-
})),
|
|
1498
|
-
() =>
|
|
1499
|
-
(
|
|
1644
|
+
})), l = $(), u = $(), p = $(!1), c = $(!1), x = qt(
|
|
1645
|
+
() => l.value,
|
|
1646
|
+
(v) => i("error", v)
|
|
1500
1647
|
);
|
|
1501
1648
|
Tt(
|
|
1502
|
-
() =>
|
|
1649
|
+
() => l.value,
|
|
1503
1650
|
() => e.media,
|
|
1504
1651
|
() => e.active && e.loadEnabled,
|
|
1505
1652
|
() => e.videoLoader,
|
|
1506
|
-
|
|
1653
|
+
x.sourceObserver
|
|
1507
1654
|
);
|
|
1508
|
-
let
|
|
1655
|
+
let L = () => {
|
|
1509
1656
|
};
|
|
1510
|
-
const { state: S } =
|
|
1657
|
+
const { state: S } = x, E = V(
|
|
1511
1658
|
() => e.controls && e.active && e.enabled && e.controlsVisible
|
|
1512
1659
|
);
|
|
1513
|
-
function
|
|
1660
|
+
function w() {
|
|
1514
1661
|
return e.teleportControls ? u.value.closest(".mp-viewer") : e.core.containerRef.value;
|
|
1515
1662
|
}
|
|
1516
|
-
async function
|
|
1663
|
+
async function g() {
|
|
1517
1664
|
if (c.value)
|
|
1518
1665
|
try {
|
|
1519
|
-
document.fullscreenElement ===
|
|
1520
|
-
} catch (
|
|
1521
|
-
|
|
1666
|
+
document.fullscreenElement === w() ? await document.exitFullscreen() : document.fullscreenEnabled ? await w().requestFullscreen() : l.value.webkitEnterFullscreen();
|
|
1667
|
+
} catch (v) {
|
|
1668
|
+
i("error", Ve(v));
|
|
1522
1669
|
}
|
|
1523
1670
|
}
|
|
1524
|
-
function
|
|
1525
|
-
|
|
1671
|
+
function B() {
|
|
1672
|
+
p.value = document.fullscreenElement === w();
|
|
1526
1673
|
}
|
|
1527
|
-
function
|
|
1528
|
-
!e.active || !e.enabled ?
|
|
1674
|
+
function O() {
|
|
1675
|
+
!e.active || !e.enabled ? x.pause() : e.autoplay && x.play();
|
|
1529
1676
|
}
|
|
1530
|
-
function
|
|
1531
|
-
document.hidden &&
|
|
1677
|
+
function h() {
|
|
1678
|
+
document.hidden && x.pause();
|
|
1532
1679
|
}
|
|
1533
1680
|
qe(() => {
|
|
1534
|
-
S.muted =
|
|
1681
|
+
S.muted = l.value.muted, c.value = document.fullscreenEnabled || "webkitEnterFullscreen" in l.value, document.addEventListener("fullscreenchange", B), document.addEventListener("visibilitychange", h), L = te(() => [e.active, e.enabled, e.autoplay], O, {
|
|
1535
1682
|
flush: "post"
|
|
1536
|
-
}),
|
|
1537
|
-
}),
|
|
1538
|
-
|
|
1683
|
+
}), O();
|
|
1684
|
+
}), Te(() => {
|
|
1685
|
+
L(), x.dispose(), document.removeEventListener("fullscreenchange", B), document.removeEventListener("visibilitychange", h), document.fullscreenElement === w() && document.exitFullscreen().catch(() => {
|
|
1539
1686
|
});
|
|
1540
1687
|
});
|
|
1541
|
-
const
|
|
1688
|
+
const k = V(() => ({
|
|
1542
1689
|
transform: `translate(-50%, -50%) translate3d(${e.core.state.offsetX}px, ${e.core.state.offsetY}px, 0)`
|
|
1543
|
-
})), m =
|
|
1690
|
+
})), m = V(() => ({
|
|
1544
1691
|
width: `${e.core.mediaSize.value.width * e.core.displayScale.value}px`,
|
|
1545
1692
|
height: `${e.core.mediaSize.value.height * e.core.displayScale.value}px`,
|
|
1546
1693
|
transform: `rotate(${e.core.state.rotation}deg)`
|
|
1547
1694
|
}));
|
|
1548
|
-
function
|
|
1549
|
-
|
|
1695
|
+
function y() {
|
|
1696
|
+
a.value = !0, e.core.setMediaElement(l.value), i("ready", "screen");
|
|
1550
1697
|
}
|
|
1551
|
-
function
|
|
1552
|
-
return { image:
|
|
1698
|
+
function P() {
|
|
1699
|
+
return { image: a.value ? Zn(l.value, e.core.mediaSize.value) : e.core.mediaRef.value, scale: 1 };
|
|
1553
1700
|
}
|
|
1554
|
-
return n({
|
|
1701
|
+
return n({
|
|
1702
|
+
togglePlayback: x.toggle,
|
|
1703
|
+
toggleFullscreen: g,
|
|
1704
|
+
playback: x,
|
|
1705
|
+
captureFrame: P,
|
|
1706
|
+
retainFrame: () => ({ ...P(), release: () => {
|
|
1707
|
+
} })
|
|
1708
|
+
}), (v, R) => (q(), _("div", {
|
|
1555
1709
|
ref_key: "host",
|
|
1556
1710
|
ref: u,
|
|
1557
1711
|
class: "mp-dom-renderer mp-video-player",
|
|
1558
|
-
"data-playback":
|
|
1712
|
+
"data-playback": f(S).ended ? "ended" : f(S).playing ? "playing" : "paused"
|
|
1559
1713
|
}, [
|
|
1560
|
-
|
|
1714
|
+
a.value ? le("", !0) : (q(), We(pt, {
|
|
1561
1715
|
key: 0,
|
|
1562
|
-
|
|
1716
|
+
active: v.active,
|
|
1717
|
+
media: o.value,
|
|
1563
1718
|
"original-enabled": !1,
|
|
1564
|
-
core:
|
|
1565
|
-
"initial-image":
|
|
1566
|
-
rendering:
|
|
1567
|
-
quality:
|
|
1568
|
-
"request-version":
|
|
1569
|
-
"load-enabled":
|
|
1570
|
-
priority:
|
|
1571
|
-
"resource-policy":
|
|
1572
|
-
"resolve-source":
|
|
1573
|
-
onReady:
|
|
1574
|
-
onError:
|
|
1575
|
-
onOriginalState:
|
|
1576
|
-
}, null, 8, ["media", "core", "initial-image", "rendering", "quality", "request-version", "load-enabled", "priority", "resource-policy", "resolve-source"])),
|
|
1719
|
+
core: v.core,
|
|
1720
|
+
"initial-image": v.initialImage,
|
|
1721
|
+
rendering: v.rendering,
|
|
1722
|
+
quality: v.quality,
|
|
1723
|
+
"request-version": v.requestVersion,
|
|
1724
|
+
"load-enabled": v.loadEnabled,
|
|
1725
|
+
priority: v.priority,
|
|
1726
|
+
"resource-policy": v.resourcePolicy,
|
|
1727
|
+
"resolve-source": v.resolveSource,
|
|
1728
|
+
onReady: R[0] || (R[0] = (F) => i("ready", F)),
|
|
1729
|
+
onError: R[1] || (R[1] = (F) => i("error", F)),
|
|
1730
|
+
onOriginalState: R[2] || (R[2] = (F, C) => i("originalState", F, C))
|
|
1731
|
+
}, null, 8, ["active", "media", "core", "initial-image", "rendering", "quality", "request-version", "load-enabled", "priority", "resource-policy", "resolve-source"])),
|
|
1577
1732
|
T("div", {
|
|
1578
1733
|
class: "mp-dom-renderer__frame",
|
|
1579
|
-
style:
|
|
1734
|
+
style: we([k.value, { visibility: a.value ? "inherit" : "hidden" }])
|
|
1580
1735
|
}, [
|
|
1581
1736
|
T("video", Ne({
|
|
1582
1737
|
ref_key: "videoRef",
|
|
1583
|
-
ref:
|
|
1738
|
+
ref: l,
|
|
1584
1739
|
class: "mp-dom-renderer__node",
|
|
1585
|
-
muted:
|
|
1586
|
-
loop:
|
|
1740
|
+
muted: v.muted,
|
|
1741
|
+
loop: v.loop,
|
|
1587
1742
|
playsinline: "",
|
|
1588
1743
|
"webkit-playsinline": "true",
|
|
1589
1744
|
crossorigin: "anonymous",
|
|
1590
|
-
preload:
|
|
1745
|
+
preload: v.active && v.loadEnabled ? "auto" : "none",
|
|
1591
1746
|
style: m.value
|
|
1592
|
-
},
|
|
1747
|
+
}, gt(f(x).events, !0), { onPlaying: y }), null, 16, ua)
|
|
1593
1748
|
], 4),
|
|
1594
|
-
|
|
1595
|
-
|
|
1749
|
+
v.active && v.enabled && f(S).buffering && f(S).status !== "error" ? (q(), _("div", ca, fa)) : le("", !0),
|
|
1750
|
+
E.value && !f(S).playing && !f(S).buffering && f(S).status !== "error" ? (q(), _("button", {
|
|
1596
1751
|
key: 2,
|
|
1597
1752
|
type: "button",
|
|
1598
1753
|
class: "mp-video-center-play",
|
|
1599
1754
|
"data-preview-control": "",
|
|
1600
|
-
"aria-label":
|
|
1601
|
-
onPointerdown:
|
|
1755
|
+
"aria-label": f(S).ended ? "重新播放" : "开始播放视频",
|
|
1756
|
+
onPointerdown: R[3] || (R[3] = re(() => {
|
|
1602
1757
|
}, ["stop"])),
|
|
1603
|
-
onPointerup:
|
|
1758
|
+
onPointerup: R[4] || (R[4] = re(() => {
|
|
1604
1759
|
}, ["stop"])),
|
|
1605
|
-
onClick:
|
|
1760
|
+
onClick: R[5] || (R[5] = re(
|
|
1606
1761
|
//@ts-ignore
|
|
1607
|
-
(...
|
|
1762
|
+
(...F) => f(x).toggle && f(x).toggle(...F),
|
|
1608
1763
|
["stop"]
|
|
1609
1764
|
))
|
|
1610
1765
|
}, [
|
|
1611
|
-
|
|
1612
|
-
name:
|
|
1766
|
+
Ie(at, {
|
|
1767
|
+
name: f(S).ended ? "replay" : "play"
|
|
1613
1768
|
}, null, 8, ["name"])
|
|
1614
|
-
], 40,
|
|
1615
|
-
|
|
1616
|
-
|
|
1769
|
+
], 40, ma)) : le("", !0),
|
|
1770
|
+
f(S).status === "error" ? (q(), _("div", ga, "视频暂时无法播放")) : le("", !0),
|
|
1771
|
+
v.controls && v.active && v.enabled ? (q(), We(Ct, {
|
|
1617
1772
|
key: 4,
|
|
1618
|
-
to:
|
|
1619
|
-
disabled: !
|
|
1773
|
+
to: v.controlsTarget,
|
|
1774
|
+
disabled: !v.teleportControls
|
|
1620
1775
|
}, [
|
|
1621
1776
|
T("div", {
|
|
1622
|
-
class:
|
|
1623
|
-
inert: !
|
|
1777
|
+
class: De(["mp-video-control-layer", { "is-hidden": !E.value }]),
|
|
1778
|
+
inert: !E.value
|
|
1624
1779
|
}, [
|
|
1625
|
-
|
|
1626
|
-
playback:
|
|
1627
|
-
fullscreen:
|
|
1780
|
+
Ie(la, {
|
|
1781
|
+
playback: f(x),
|
|
1782
|
+
fullscreen: p.value,
|
|
1628
1783
|
"can-fullscreen": c.value,
|
|
1629
|
-
onFullscreen:
|
|
1784
|
+
onFullscreen: g
|
|
1630
1785
|
}, null, 8, ["playback", "fullscreen", "can-fullscreen"])
|
|
1631
|
-
], 10,
|
|
1632
|
-
], 8, ["to", "disabled"])) :
|
|
1633
|
-
], 8,
|
|
1786
|
+
], 10, pa)
|
|
1787
|
+
], 8, ["to", "disabled"])) : le("", !0)
|
|
1788
|
+
], 8, sa));
|
|
1634
1789
|
}
|
|
1635
|
-
}),
|
|
1790
|
+
}), va = ["data-scale", "data-rotation", "data-live-holding"], ya = /* @__PURE__ */ $e({
|
|
1636
1791
|
__name: "PreviewStage",
|
|
1637
1792
|
props: {
|
|
1638
1793
|
media: {},
|
|
1639
|
-
videoLoader: { type: Function, default:
|
|
1794
|
+
videoLoader: { type: Function, default: it },
|
|
1640
1795
|
livePlaying: { type: Boolean, default: !1 },
|
|
1641
1796
|
active: { type: Boolean, default: !0 },
|
|
1642
1797
|
requestVersion: { default: 0 },
|
|
1643
1798
|
loadEnabled: { type: Boolean, default: !0 },
|
|
1644
|
-
resourcePolicy: { default: () =>
|
|
1645
|
-
resolveSource: { type: Function, default:
|
|
1799
|
+
resourcePolicy: { default: () => Ge },
|
|
1800
|
+
resolveSource: { type: Function, default: Ke },
|
|
1646
1801
|
inactiveResetDuration: { default: 0 },
|
|
1647
1802
|
disabled: { type: Boolean, default: !1 },
|
|
1648
1803
|
externalGestures: { type: Boolean, default: !1 },
|
|
@@ -1651,45 +1806,44 @@ const Dn = {
|
|
|
1651
1806
|
controlsTarget: { default: "body" },
|
|
1652
1807
|
rendering: { type: Boolean, default: !0 },
|
|
1653
1808
|
paging: { type: Boolean, default: !1 },
|
|
1654
|
-
initialImage: { default: () =>
|
|
1809
|
+
initialImage: { default: () => Ce },
|
|
1655
1810
|
quality: { default: "screen" }
|
|
1656
1811
|
},
|
|
1657
1812
|
emits: ["tap", "doubleTap", "scale", "swipeDownProgress", "close", "previous", "next", "pageDrag", "pageRelease", "ready", "error", "originalState", "liveState", "liveEnded"],
|
|
1658
|
-
setup(t, { expose: n, emit:
|
|
1659
|
-
const e = t,
|
|
1813
|
+
setup(t, { expose: n, emit: r }) {
|
|
1814
|
+
const e = t, i = r, a = $(!1), o = $("loading"), l = pn({
|
|
1660
1815
|
motionActive: () => e.paging,
|
|
1661
1816
|
interactive: () => e.active && !e.disabled,
|
|
1662
1817
|
zoomable: () => !0,
|
|
1663
|
-
doubleTapZoom: () =>
|
|
1664
|
-
|
|
1665
|
-
holdable: () => e.media.type === "live-photo" && M.value === "ready" && l.value === "idle",
|
|
1818
|
+
doubleTapZoom: () => Bn(e.media, l.core.viewportSize.value),
|
|
1819
|
+
holdable: () => e.media.type === "live-photo" && x.value === "ready" && o.value === "idle",
|
|
1666
1820
|
onHoldStart: () => {
|
|
1667
|
-
|
|
1821
|
+
a.value = !0;
|
|
1668
1822
|
},
|
|
1669
1823
|
onHoldEnd: () => {
|
|
1670
|
-
|
|
1824
|
+
a.value = !1, i("liveEnded");
|
|
1671
1825
|
},
|
|
1672
|
-
onTap: () =>
|
|
1673
|
-
onDoubleTap: () =>
|
|
1674
|
-
onScale: (
|
|
1675
|
-
e.active &&
|
|
1826
|
+
onTap: () => i("tap"),
|
|
1827
|
+
onDoubleTap: () => i("doubleTap"),
|
|
1828
|
+
onScale: (h) => {
|
|
1829
|
+
e.active && i("scale", h);
|
|
1676
1830
|
},
|
|
1677
|
-
onSwipeDownProgress: (
|
|
1678
|
-
e.active &&
|
|
1831
|
+
onSwipeDownProgress: (h) => {
|
|
1832
|
+
e.active && i("swipeDownProgress", h);
|
|
1679
1833
|
},
|
|
1680
|
-
onSwipeDownClose: () =>
|
|
1681
|
-
onSwipeLeft: () =>
|
|
1682
|
-
onSwipeRight: () =>
|
|
1683
|
-
onPageDrag: (
|
|
1684
|
-
e.active &&
|
|
1834
|
+
onSwipeDownClose: () => i("close"),
|
|
1835
|
+
onSwipeLeft: () => i("next"),
|
|
1836
|
+
onSwipeRight: () => i("previous"),
|
|
1837
|
+
onPageDrag: (h) => {
|
|
1838
|
+
e.active && i("pageDrag", h);
|
|
1685
1839
|
},
|
|
1686
|
-
onPageRelease: (
|
|
1687
|
-
}), u =
|
|
1688
|
-
() => e.media.type === "video" ?
|
|
1689
|
-
),
|
|
1690
|
-
() =>
|
|
1840
|
+
onPageRelease: (h, k) => i("pageRelease", h, k)
|
|
1841
|
+
}), u = l.core.containerRef, p = l.core.downDragStyle, c = l.core.state, x = $("loading"), L = $("thumbnail"), S = $(), E = V(
|
|
1842
|
+
() => e.media.type === "video" ? ha : e.media.type === "live-photo" ? Nn : pt
|
|
1843
|
+
), w = V(
|
|
1844
|
+
() => L.value === "full" || e.quality === "full" ? "full" : e.quality
|
|
1691
1845
|
);
|
|
1692
|
-
|
|
1846
|
+
te(
|
|
1693
1847
|
[
|
|
1694
1848
|
() => e.media.id,
|
|
1695
1849
|
() => e.media.src,
|
|
@@ -1697,190 +1851,191 @@ const Dn = {
|
|
|
1697
1851
|
() => e.media.thumbnail
|
|
1698
1852
|
],
|
|
1699
1853
|
() => {
|
|
1700
|
-
|
|
1854
|
+
L.value = "thumbnail";
|
|
1701
1855
|
}
|
|
1702
|
-
),
|
|
1856
|
+
), te(
|
|
1703
1857
|
() => e.media.id,
|
|
1704
1858
|
() => {
|
|
1705
|
-
|
|
1859
|
+
x.value = "loading", l.core.setRotation(0);
|
|
1706
1860
|
}
|
|
1707
|
-
),
|
|
1861
|
+
), te(
|
|
1708
1862
|
[() => e.media.width, () => e.media.height],
|
|
1709
|
-
([
|
|
1710
|
-
|
|
1863
|
+
([h, k]) => {
|
|
1864
|
+
l.core.setMediaSize({ width: h, height: k });
|
|
1711
1865
|
},
|
|
1712
1866
|
{ immediate: !0 }
|
|
1713
|
-
),
|
|
1867
|
+
), te(
|
|
1714
1868
|
() => e.active,
|
|
1715
|
-
(
|
|
1716
|
-
|
|
1869
|
+
(h) => {
|
|
1870
|
+
h || l.core.resetTransform(e.inactiveResetDuration);
|
|
1717
1871
|
}
|
|
1718
|
-
),
|
|
1872
|
+
), te(
|
|
1719
1873
|
() => e.disabled,
|
|
1720
|
-
(
|
|
1721
|
-
|
|
1874
|
+
(h) => {
|
|
1875
|
+
h && l.core.cancelGesture(!0);
|
|
1722
1876
|
}
|
|
1723
1877
|
);
|
|
1724
|
-
function
|
|
1725
|
-
|
|
1878
|
+
function g(h) {
|
|
1879
|
+
h === "full" && (L.value = h), x.value = "ready", i("ready", h);
|
|
1726
1880
|
}
|
|
1727
|
-
function
|
|
1728
|
-
|
|
1881
|
+
function B(h) {
|
|
1882
|
+
o.value = h, i("liveState", h);
|
|
1729
1883
|
}
|
|
1730
|
-
const
|
|
1884
|
+
const O = V(
|
|
1731
1885
|
() => e.externalGestures ? {} : {
|
|
1732
|
-
wheel:
|
|
1733
|
-
pointerdown:
|
|
1734
|
-
pointermove:
|
|
1735
|
-
pointerup:
|
|
1736
|
-
pointercancel:
|
|
1737
|
-
lostpointercapture:
|
|
1886
|
+
wheel: l.onWheel,
|
|
1887
|
+
pointerdown: l.onPointerDown,
|
|
1888
|
+
pointermove: l.onPointerMove,
|
|
1889
|
+
pointerup: l.onPointerUp,
|
|
1890
|
+
pointercancel: l.onPointerCancel,
|
|
1891
|
+
lostpointercapture: l.onPointerCancel
|
|
1738
1892
|
}
|
|
1739
1893
|
);
|
|
1740
1894
|
return n({
|
|
1741
|
-
onPointerDown:
|
|
1742
|
-
onPointerMove:
|
|
1743
|
-
onPointerUp:
|
|
1744
|
-
onPointerCancel:
|
|
1745
|
-
onWheel:
|
|
1746
|
-
readiness:
|
|
1747
|
-
core:
|
|
1748
|
-
rotateBy:
|
|
1749
|
-
resetTransform:
|
|
1750
|
-
zoomIn: () =>
|
|
1751
|
-
zoomOut: () =>
|
|
1895
|
+
onPointerDown: l.onPointerDown,
|
|
1896
|
+
onPointerMove: l.onPointerMove,
|
|
1897
|
+
onPointerUp: l.onPointerUp,
|
|
1898
|
+
onPointerCancel: l.onPointerCancel,
|
|
1899
|
+
onWheel: l.onWheel,
|
|
1900
|
+
readiness: x,
|
|
1901
|
+
core: l.core,
|
|
1902
|
+
rotateBy: l.core.rotateBy,
|
|
1903
|
+
resetTransform: l.core.resetTransform,
|
|
1904
|
+
zoomIn: () => l.core.zoomTo(c.level * 1.5, void 0, !0),
|
|
1905
|
+
zoomOut: () => l.core.zoomTo(c.level / 1.5, void 0, !0),
|
|
1752
1906
|
togglePlayback: () => S.value.togglePlayback(),
|
|
1753
1907
|
toggleFullscreen: () => S.value.toggleFullscreen(),
|
|
1754
|
-
captureFrame: () => S.value.captureFrame()
|
|
1755
|
-
|
|
1908
|
+
captureFrame: () => S.value.captureFrame(),
|
|
1909
|
+
retainFrame: () => S.value.retainFrame()
|
|
1910
|
+
}), (h, k) => (q(), _("div", Ne({
|
|
1756
1911
|
ref_key: "containerRef",
|
|
1757
1912
|
ref: u,
|
|
1758
|
-
class: ["mp-stage", { "is-zoomed":
|
|
1759
|
-
style:
|
|
1760
|
-
"data-scale":
|
|
1761
|
-
"data-rotation":
|
|
1762
|
-
"data-live-holding":
|
|
1763
|
-
onContextmenu:
|
|
1764
|
-
|
|
1913
|
+
class: ["mp-stage", { "is-zoomed": f(c).level > 1, "is-dismissing": f(c).draggingDown }],
|
|
1914
|
+
style: f(p),
|
|
1915
|
+
"data-scale": f(c).level.toFixed(3),
|
|
1916
|
+
"data-rotation": f(c).rotation,
|
|
1917
|
+
"data-live-holding": a.value,
|
|
1918
|
+
onContextmenu: k[3] || (k[3] = (m) => {
|
|
1919
|
+
h.media.type === "live-photo" && m.preventDefault();
|
|
1765
1920
|
})
|
|
1766
|
-
},
|
|
1767
|
-
(
|
|
1921
|
+
}, gt(O.value, !0)), [
|
|
1922
|
+
(q(), We(Kt(E.value), Ne({
|
|
1768
1923
|
ref_key: "rendererRef",
|
|
1769
1924
|
ref: S,
|
|
1770
|
-
media:
|
|
1771
|
-
},
|
|
1772
|
-
"initial-image":
|
|
1773
|
-
rendering:
|
|
1774
|
-
core:
|
|
1775
|
-
quality:
|
|
1776
|
-
"request-version":
|
|
1777
|
-
"load-enabled":
|
|
1778
|
-
priority:
|
|
1779
|
-
"resource-policy":
|
|
1780
|
-
"resolve-source":
|
|
1781
|
-
playing: (
|
|
1782
|
-
enabled: !
|
|
1783
|
-
"controls-visible":
|
|
1784
|
-
"teleport-controls":
|
|
1785
|
-
"controls-target":
|
|
1786
|
-
active:
|
|
1787
|
-
onReady:
|
|
1788
|
-
onError:
|
|
1789
|
-
onOriginalState:
|
|
1790
|
-
onLiveState:
|
|
1791
|
-
onLiveEnded:
|
|
1925
|
+
media: h.media
|
|
1926
|
+
}, h.media.type === "video" ? { videoLoader: h.videoLoader } : {}, {
|
|
1927
|
+
"initial-image": h.initialImage,
|
|
1928
|
+
rendering: h.rendering,
|
|
1929
|
+
core: f(l).core,
|
|
1930
|
+
quality: w.value,
|
|
1931
|
+
"request-version": h.requestVersion,
|
|
1932
|
+
"load-enabled": h.loadEnabled,
|
|
1933
|
+
priority: h.active ? 0 : 2,
|
|
1934
|
+
"resource-policy": h.resourcePolicy,
|
|
1935
|
+
"resolve-source": h.resolveSource,
|
|
1936
|
+
playing: (h.livePlaying || a.value) && h.active,
|
|
1937
|
+
enabled: !h.disabled,
|
|
1938
|
+
"controls-visible": h.controlsVisible,
|
|
1939
|
+
"teleport-controls": h.teleportControls,
|
|
1940
|
+
"controls-target": h.controlsTarget,
|
|
1941
|
+
active: h.active,
|
|
1942
|
+
onReady: g,
|
|
1943
|
+
onError: k[0] || (k[0] = (m) => i("error", m)),
|
|
1944
|
+
onOriginalState: k[1] || (k[1] = (m, y) => i("originalState", m, y)),
|
|
1945
|
+
onLiveState: B,
|
|
1946
|
+
onLiveEnded: k[2] || (k[2] = (m) => i("liveEnded"))
|
|
1792
1947
|
}), null, 16, ["media", "initial-image", "rendering", "core", "quality", "request-version", "load-enabled", "priority", "resource-policy", "resolve-source", "playing", "enabled", "controls-visible", "teleport-controls", "controls-target", "active"]))
|
|
1793
|
-
], 16,
|
|
1948
|
+
], 16, va));
|
|
1794
1949
|
}
|
|
1795
1950
|
});
|
|
1796
|
-
function
|
|
1797
|
-
const
|
|
1798
|
-
function
|
|
1799
|
-
|
|
1951
|
+
function wa(t, n) {
|
|
1952
|
+
const r = $(/* @__PURE__ */ new Set()), e = $("idle"), i = $(""), a = $(0), o = $("");
|
|
1953
|
+
function l() {
|
|
1954
|
+
o.value = "", e.value = "idle", i.value = "", a.value = 0;
|
|
1800
1955
|
}
|
|
1801
1956
|
function u() {
|
|
1802
|
-
e.value !== "ready" && (e.value = "loading",
|
|
1957
|
+
e.value !== "ready" && (e.value = "loading", i.value = "", a.value++, r.value = /* @__PURE__ */ new Set([...r.value, t().id]));
|
|
1803
1958
|
}
|
|
1804
|
-
function
|
|
1805
|
-
e.value = c,
|
|
1959
|
+
function p(c, x) {
|
|
1960
|
+
e.value = c, i.value = x, n(t(), c, x);
|
|
1806
1961
|
}
|
|
1807
1962
|
return {
|
|
1808
|
-
originalIds:
|
|
1963
|
+
originalIds: r,
|
|
1809
1964
|
originalStatus: e,
|
|
1810
|
-
originalReason:
|
|
1811
|
-
originalRequest:
|
|
1812
|
-
readyId:
|
|
1813
|
-
reset:
|
|
1965
|
+
originalReason: i,
|
|
1966
|
+
originalRequest: a,
|
|
1967
|
+
readyId: o,
|
|
1968
|
+
reset: l,
|
|
1814
1969
|
requestOriginal: u,
|
|
1815
|
-
updateOriginal:
|
|
1970
|
+
updateOriginal: p
|
|
1816
1971
|
};
|
|
1817
1972
|
}
|
|
1818
|
-
function
|
|
1819
|
-
const
|
|
1973
|
+
function ba(t, n, r, e = {}) {
|
|
1974
|
+
const i = $(0), a = mt({
|
|
1820
1975
|
offset: 0,
|
|
1821
1976
|
dragging: !1,
|
|
1822
1977
|
settling: !1,
|
|
1823
1978
|
preparing: !1,
|
|
1824
1979
|
grabbed: !1,
|
|
1825
1980
|
duration: 360
|
|
1826
|
-
}),
|
|
1827
|
-
}, ...e },
|
|
1828
|
-
() => [
|
|
1981
|
+
}), o = { readOffset: () => a.offset, flushLayout: () => {
|
|
1982
|
+
}, ...e }, l = 16, u = () => n() + l, p = V(
|
|
1983
|
+
() => [i.value - 1, i.value, i.value + 1].filter((P) => P >= 0 && P < t())
|
|
1829
1984
|
);
|
|
1830
1985
|
let c = setTimeout(() => {
|
|
1831
|
-
}, 0),
|
|
1832
|
-
},
|
|
1833
|
-
function
|
|
1834
|
-
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
|
-
function
|
|
1838
|
-
if (!
|
|
1839
|
-
const
|
|
1840
|
-
|
|
1841
|
-
}
|
|
1842
|
-
function
|
|
1843
|
-
if (
|
|
1844
|
-
|
|
1986
|
+
}, 0), x = () => {
|
|
1987
|
+
}, L = 0, S = 0;
|
|
1988
|
+
function E() {
|
|
1989
|
+
L += 1, clearTimeout(c), x(), a.settling = !1, a.preparing = !1;
|
|
1990
|
+
}
|
|
1991
|
+
Te(E);
|
|
1992
|
+
function w() {
|
|
1993
|
+
if (!a.settling && !a.preparing) return;
|
|
1994
|
+
const P = a.preparing ? a.offset : o.readOffset();
|
|
1995
|
+
E(), a.offset = P, a.grabbed = !0;
|
|
1996
|
+
}
|
|
1997
|
+
function g(P) {
|
|
1998
|
+
if (P === 0) {
|
|
1999
|
+
E(), a.dragging = !1, a.grabbed = !1, a.offset = 0, S = 0;
|
|
1845
2000
|
return;
|
|
1846
2001
|
}
|
|
1847
|
-
|
|
1848
|
-
const
|
|
1849
|
-
|
|
1850
|
-
}
|
|
1851
|
-
async function
|
|
1852
|
-
|
|
1853
|
-
const
|
|
1854
|
-
|
|
1855
|
-
const
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
}),
|
|
2002
|
+
a.dragging || (w(), S = a.offset, E(), a.dragging = !0, a.grabbed = !0);
|
|
2003
|
+
const v = S + P, R = i.value === 0 && v > 0 || i.value === t() - 1 && v < 0;
|
|
2004
|
+
a.offset = R ? Math.sign(v) * Math.sqrt(Math.abs(v)) * 6 : v;
|
|
2005
|
+
}
|
|
2006
|
+
async function B(P, v = 0) {
|
|
2007
|
+
E();
|
|
2008
|
+
const R = L, F = i.value;
|
|
2009
|
+
a.offset += (P - F) * u();
|
|
2010
|
+
const C = Math.abs(a.offset), D = J(C / u(), 0, 1), A = J(220 + D * 140 - Math.min(Math.abs(v), 2) * 35, 240, 360);
|
|
2011
|
+
a.duration = matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : A, i.value = P, a.dragging = !1, a.grabbed = !1, a.preparing = !0, P !== F && r(P), await Se(), R === L && (o.flushLayout(), a.preparing = !1, a.settling = !0, a.offset = 0, await new Promise((Z) => {
|
|
2012
|
+
x = Z, c = setTimeout(Z, a.duration);
|
|
2013
|
+
}), R === L && (a.settling = !1, x = () => {
|
|
1859
2014
|
}));
|
|
1860
2015
|
}
|
|
1861
|
-
function
|
|
1862
|
-
const
|
|
1863
|
-
|
|
2016
|
+
function O(P, v) {
|
|
2017
|
+
const R = a.offset, F = Math.abs(v) > 0.35 && Math.abs(P) > 16, C = Math.sign(F ? v : R), D = F || Math.abs(R) > n() * 0.14;
|
|
2018
|
+
B(J(i.value - (D ? C : 0), 0, t() - 1), v);
|
|
1864
2019
|
}
|
|
1865
|
-
function
|
|
1866
|
-
|
|
2020
|
+
function h() {
|
|
2021
|
+
a.grabbed && !a.dragging && B(i.value);
|
|
1867
2022
|
}
|
|
1868
|
-
function
|
|
1869
|
-
if (
|
|
1870
|
-
|
|
1871
|
-
const
|
|
1872
|
-
|
|
2023
|
+
function k(P) {
|
|
2024
|
+
if (a.dragging) return;
|
|
2025
|
+
w();
|
|
2026
|
+
const v = J(i.value + P, 0, t() - 1);
|
|
2027
|
+
v !== i.value ? B(v) : h();
|
|
1873
2028
|
}
|
|
1874
|
-
function m(
|
|
1875
|
-
|
|
2029
|
+
function m(P) {
|
|
2030
|
+
E(), i.value = P, a.offset = 0, a.dragging = !1, a.grabbed = !1;
|
|
1876
2031
|
}
|
|
1877
|
-
function
|
|
1878
|
-
|
|
2032
|
+
function y(P) {
|
|
2033
|
+
i.value = P;
|
|
1879
2034
|
}
|
|
1880
|
-
return { index:
|
|
2035
|
+
return { index: i, state: a, slots: p, stride: u, drag: g, release: O, go: k, grab: w, resume: h, reset: m, rebase: y, cancel: E };
|
|
1881
2036
|
}
|
|
1882
|
-
function Ot(t, n,
|
|
1883
|
-
const e = Math[
|
|
2037
|
+
function Ot(t, n, r) {
|
|
2038
|
+
const e = Math[r === "cover" ? "max" : "min"](
|
|
1884
2039
|
n.width / t.width,
|
|
1885
2040
|
n.height / t.height
|
|
1886
2041
|
);
|
|
@@ -1894,8 +2049,8 @@ function Ot(t, n, o) {
|
|
|
1894
2049
|
radius: 0
|
|
1895
2050
|
};
|
|
1896
2051
|
}
|
|
1897
|
-
function
|
|
1898
|
-
const e = (
|
|
2052
|
+
function ka(t, n, r) {
|
|
2053
|
+
const e = (i, a) => i + (a - i) * r;
|
|
1899
2054
|
return {
|
|
1900
2055
|
x: e(t.x, n.x),
|
|
1901
2056
|
y: e(t.y, n.y),
|
|
@@ -1911,137 +2066,137 @@ function la(t, n, o) {
|
|
|
1911
2066
|
}
|
|
1912
2067
|
};
|
|
1913
2068
|
}
|
|
1914
|
-
function
|
|
1915
|
-
const n = t.rotation * Math.PI / 180,
|
|
2069
|
+
function Pt(t) {
|
|
2070
|
+
const n = t.rotation * Math.PI / 180, r = Math.abs(Math.cos(n)) * t.width + Math.abs(Math.sin(n)) * t.height, e = Math.abs(Math.sin(n)) * t.width + Math.abs(Math.cos(n)) * t.height, i = Math.max(t.x - r / 2, t.clip.left), a = Math.max(t.y - e / 2, t.clip.top);
|
|
1916
2071
|
return {
|
|
1917
|
-
left:
|
|
1918
|
-
top:
|
|
1919
|
-
width: Math.max(0, Math.min(t.x +
|
|
1920
|
-
height: Math.max(0, Math.min(t.y + e / 2, t.clip.top + t.clip.height) -
|
|
2072
|
+
left: i,
|
|
2073
|
+
top: a,
|
|
2074
|
+
width: Math.max(0, Math.min(t.x + r / 2, t.clip.left + t.clip.width) - i),
|
|
2075
|
+
height: Math.max(0, Math.min(t.y + e / 2, t.clip.top + t.clip.height) - a)
|
|
1921
2076
|
};
|
|
1922
2077
|
}
|
|
1923
|
-
function
|
|
1924
|
-
const
|
|
1925
|
-
width: Math.max(
|
|
1926
|
-
height: Math.max(
|
|
1927
|
-
},
|
|
1928
|
-
for (let
|
|
1929
|
-
const S =
|
|
1930
|
-
let
|
|
1931
|
-
if (
|
|
1932
|
-
|
|
1933
|
-
left:
|
|
1934
|
-
top:
|
|
1935
|
-
width:
|
|
1936
|
-
height:
|
|
2078
|
+
function xa(t, n, r, e, i) {
|
|
2079
|
+
const a = Pt(t), o = Pt(n), l = Math.min(a.width / o.width, a.height / o.height), u = {
|
|
2080
|
+
width: Math.max(a.width, o.width, 1),
|
|
2081
|
+
height: Math.max(a.height, o.height, 1)
|
|
2082
|
+
}, p = 128, c = [], x = [];
|
|
2083
|
+
for (let L = 0; L <= p; L += 1) {
|
|
2084
|
+
const S = L / p, E = ka(t, n, S);
|
|
2085
|
+
let w;
|
|
2086
|
+
if (i)
|
|
2087
|
+
w = {
|
|
2088
|
+
left: a.left + (o.left - a.left) * S,
|
|
2089
|
+
top: a.top + (o.top - a.top) * S,
|
|
2090
|
+
width: a.width + (o.width - a.width) * S,
|
|
2091
|
+
height: a.height + (o.height - a.height) * S
|
|
1937
2092
|
};
|
|
1938
2093
|
else {
|
|
1939
|
-
const
|
|
1940
|
-
|
|
1941
|
-
left:
|
|
1942
|
-
top:
|
|
2094
|
+
const O = Math.min(S / 0.78, 1), h = 1 - O * O * O * (O * (O * 6 - 15) + 10), k = l + (1 - l) * S, m = o.width * k + (a.width - o.width * l) * h, y = o.height * k + (a.height - o.height * l) * h;
|
|
2095
|
+
w = {
|
|
2096
|
+
left: a.left + a.width / 2 + (o.left + o.width / 2 - a.left - a.width / 2) * S - m / 2,
|
|
2097
|
+
top: a.top + a.height / 2 + (o.top + o.height / 2 - a.top - a.height / 2) * S - y / 2,
|
|
1943
2098
|
width: m,
|
|
1944
|
-
height:
|
|
2099
|
+
height: y
|
|
1945
2100
|
};
|
|
1946
2101
|
}
|
|
1947
|
-
const
|
|
2102
|
+
const g = Math.max(w.width, 1e-3) / u.width, B = Math.max(w.height, 1e-3) / u.height;
|
|
1948
2103
|
c.push({
|
|
1949
|
-
transform: `scale(${1 /
|
|
2104
|
+
transform: `scale(${1 / g},${1 / B}) translate3d(${E.x - w.left}px,${E.y - w.top}px,0) rotate(${E.rotation}deg) scale(${E.width / e.width}) translate3d(${-e.width / 2}px,${-e.height / 2}px,0)`,
|
|
1950
2105
|
offset: S
|
|
1951
|
-
}),
|
|
1952
|
-
transform: `translate3d(${
|
|
1953
|
-
...t.radius === 0 && n.radius === 0 ? {} : { borderRadius: `${
|
|
2106
|
+
}), x.push({
|
|
2107
|
+
transform: `translate3d(${w.left - r.left}px,${w.top - r.top}px,0) scale(${g},${B})`,
|
|
2108
|
+
...t.radius === 0 && n.radius === 0 ? {} : { borderRadius: `${E.radius / g}px / ${E.radius / B}px` },
|
|
1954
2109
|
offset: S
|
|
1955
2110
|
});
|
|
1956
2111
|
}
|
|
1957
|
-
return { pictures: c, masks:
|
|
2112
|
+
return { pictures: c, masks: x, maskSize: u };
|
|
1958
2113
|
}
|
|
1959
|
-
function
|
|
2114
|
+
function Ma() {
|
|
1960
2115
|
let t = { kind: "idle" };
|
|
1961
2116
|
function n() {
|
|
1962
|
-
t.kind === "playing" && t.animations.forEach((
|
|
2117
|
+
t.kind === "playing" && t.animations.forEach((i) => i.cancel()), t = { kind: "idle" };
|
|
1963
2118
|
}
|
|
1964
|
-
function
|
|
1965
|
-
return t.kind !== "playing" || !t.entering ? { kind: "inactive" } : (t.entering = !1, t.animations.forEach((
|
|
2119
|
+
function r() {
|
|
2120
|
+
return t.kind !== "playing" || !t.entering ? { kind: "inactive" } : (t.entering = !1, t.animations.forEach((i) => i.reverse()), t.finished = Promise.all(t.animations.map((i) => i.finished)).then(() => {
|
|
1966
2121
|
}).catch(() => {
|
|
1967
2122
|
}), { kind: "reversing", finished: t.finished });
|
|
1968
2123
|
}
|
|
1969
|
-
async function e(a,
|
|
2124
|
+
async function e(i, a, o, l, u, p, c, x, L = x ? 0 : 1, S = 340) {
|
|
1970
2125
|
n();
|
|
1971
|
-
const
|
|
2126
|
+
const E = Math.max(l.width, u.width), w = E * u.height / u.width, g = Math.min(
|
|
1972
2127
|
devicePixelRatio,
|
|
1973
2128
|
2,
|
|
1974
|
-
Math.sqrt(
|
|
2129
|
+
Math.sqrt(ue.maxCanvasPixels / (E * w))
|
|
1975
2130
|
);
|
|
1976
|
-
|
|
1977
|
-
const
|
|
1978
|
-
((
|
|
1979
|
-
|
|
1980
|
-
})(
|
|
1981
|
-
const
|
|
1982
|
-
|
|
2131
|
+
i.width = Math.max(1, Math.round(E * g)), i.height = Math.max(1, Math.round(w * g)), i.style.width = `${E}px`, i.style.height = `${w}px`;
|
|
2132
|
+
const B = i.getContext("2d");
|
|
2133
|
+
((v) => {
|
|
2134
|
+
B.clearRect(0, 0, i.width, i.height), B.imageSmoothingEnabled = !0, B.imageSmoothingQuality = "high", B.drawImage(v, 0, 0, i.width, i.height);
|
|
2135
|
+
})(o);
|
|
2136
|
+
const h = xa(l, u, p, { width: E, height: w }, x);
|
|
2137
|
+
a.style.width = `${h.maskSize.width}px`, a.style.height = `${h.maskSize.height}px`, a.style.borderRadius = "0";
|
|
1983
2138
|
const m = {
|
|
1984
2139
|
duration: matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : Math.max(0, S),
|
|
1985
2140
|
easing: "cubic-bezier(.2,.78,.2,1)",
|
|
1986
2141
|
fill: "both"
|
|
1987
|
-
},
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
c.animate([{ opacity:
|
|
1991
|
-
],
|
|
2142
|
+
}, y = [
|
|
2143
|
+
i.animate(h.pictures, m),
|
|
2144
|
+
a.animate(h.masks, m),
|
|
2145
|
+
c.animate([{ opacity: L }, { opacity: x ? 1 : 0 }], m)
|
|
2146
|
+
], P = Promise.all(y.map((v) => v.finished)).then(() => {
|
|
1992
2147
|
}).catch(() => {
|
|
1993
2148
|
});
|
|
1994
|
-
t = { kind: "playing", entering:
|
|
2149
|
+
t = { kind: "playing", entering: x, animations: y, finished: P }, await P;
|
|
1995
2150
|
}
|
|
1996
|
-
return { play: e, cancel: n, reverseOpening:
|
|
2151
|
+
return { play: e, cancel: n, reverseOpening: r };
|
|
1997
2152
|
}
|
|
1998
2153
|
function At(t, n) {
|
|
1999
|
-
const
|
|
2154
|
+
const r = Math.max(t.left, n.left), e = Math.max(t.top, n.top);
|
|
2000
2155
|
return {
|
|
2001
|
-
left:
|
|
2156
|
+
left: r,
|
|
2002
2157
|
top: e,
|
|
2003
|
-
width: Math.max(0, Math.min(t.left + t.width, n.left + n.width) -
|
|
2158
|
+
width: Math.max(0, Math.min(t.left + t.width, n.left + n.width) - r),
|
|
2004
2159
|
height: Math.max(0, Math.min(t.top + t.height, n.top + n.height) - e)
|
|
2005
2160
|
};
|
|
2006
2161
|
}
|
|
2007
|
-
function
|
|
2008
|
-
let
|
|
2162
|
+
function Sa(t, n) {
|
|
2163
|
+
let r = { ...n };
|
|
2009
2164
|
const e = /^(auto|scroll|overlay)$/;
|
|
2010
|
-
for (let
|
|
2011
|
-
const
|
|
2012
|
-
if (!
|
|
2013
|
-
const u =
|
|
2014
|
-
|
|
2015
|
-
left:
|
|
2016
|
-
top:
|
|
2017
|
-
width:
|
|
2018
|
-
height:
|
|
2165
|
+
for (let i = t.parentElement; i !== document.documentElement; i = i.parentElement) {
|
|
2166
|
+
const a = getComputedStyle(i), o = e.test(a.overflowX), l = e.test(a.overflowY);
|
|
2167
|
+
if (!o && !l) continue;
|
|
2168
|
+
const u = i.getBoundingClientRect(), p = Number(i.style.getPropertyValue("--mp-transition-inset-top"));
|
|
2169
|
+
r = At(r, {
|
|
2170
|
+
left: o ? u.left : r.left,
|
|
2171
|
+
top: l ? u.top + p : r.top,
|
|
2172
|
+
width: o ? u.width : r.width,
|
|
2173
|
+
height: l ? Math.max(0, u.height - p) : r.height
|
|
2019
2174
|
});
|
|
2020
2175
|
}
|
|
2021
|
-
return
|
|
2176
|
+
return r;
|
|
2022
2177
|
}
|
|
2023
|
-
function
|
|
2178
|
+
function Rt(t, n, r) {
|
|
2024
2179
|
if (t.kind === "unavailable") return t;
|
|
2025
2180
|
const e = Ot(n, t.element.getBoundingClientRect(), "cover");
|
|
2026
|
-
return e.clip = At(e.clip,
|
|
2181
|
+
return e.clip = At(e.clip, Sa(t.element, r)), e.clip.width <= 0 || e.clip.height <= 0 ? { kind: "unavailable" } : (e.radius = parseFloat(getComputedStyle(t.element).borderTopLeftRadius) || 0, { kind: "element", element: t.element, frame: e, viewport: r });
|
|
2027
2182
|
}
|
|
2028
|
-
const
|
|
2183
|
+
const Pa = ["aria-label", "data-phase", "data-chrome", "inert"], Ra = ["aria-hidden", "inert", "data-media-id"], Ea = {
|
|
2029
2184
|
key: 0,
|
|
2030
2185
|
class: "mp-resource-state mp-viewer__loading mp-viewer__pages",
|
|
2031
2186
|
role: "status",
|
|
2032
2187
|
"aria-label": "加载中"
|
|
2033
|
-
},
|
|
2188
|
+
}, Ca = /* @__PURE__ */ T("span", {
|
|
2034
2189
|
class: "mp-spinner",
|
|
2035
2190
|
"aria-hidden": "true"
|
|
2036
|
-
}, null, -1),
|
|
2037
|
-
|
|
2038
|
-
],
|
|
2191
|
+
}, null, -1), La = [
|
|
2192
|
+
Ca
|
|
2193
|
+
], $a = ["inert"], Fa = { class: "mp-viewer__toolbar" }, Ta = { class: "mp-viewer__title" }, Ba = ["disabled"], za = { class: "mp-viewer__footer" }, Ia = {
|
|
2039
2194
|
class: "mp-viewer__counter",
|
|
2040
2195
|
"aria-live": "polite"
|
|
2041
|
-
},
|
|
2196
|
+
}, Da = {
|
|
2042
2197
|
key: 1,
|
|
2043
2198
|
class: "mp-viewer__detail"
|
|
2044
|
-
},
|
|
2199
|
+
}, Ya = /* @__PURE__ */ $e({
|
|
2045
2200
|
inheritAttrs: !1,
|
|
2046
2201
|
__name: "MediaPreview",
|
|
2047
2202
|
props: {
|
|
@@ -2051,9 +2206,9 @@ const da = ["aria-label", "data-phase", "data-chrome", "inert"], fa = ["aria-hid
|
|
|
2051
2206
|
keyboardEnabled: { type: Boolean, default: !0 },
|
|
2052
2207
|
gesturesEnabled: { type: Boolean, default: !0 },
|
|
2053
2208
|
persistentChrome: { type: Boolean, default: !1 },
|
|
2054
|
-
videoLoader: { type: Function, default:
|
|
2055
|
-
resourcePolicy: { default: () =>
|
|
2056
|
-
resolveImageSource: { type: Function, default:
|
|
2209
|
+
videoLoader: { type: Function, default: it },
|
|
2210
|
+
resourcePolicy: { default: () => Ge },
|
|
2211
|
+
resolveImageSource: { type: Function, default: Ke },
|
|
2057
2212
|
hasMore: { type: Boolean, default: !1 },
|
|
2058
2213
|
appearance: { default: "dark" },
|
|
2059
2214
|
closeDuration: { default: 240 },
|
|
@@ -2061,520 +2216,544 @@ const da = ["aria-label", "data-phase", "data-chrome", "inert"], fa = ["aria-hid
|
|
|
2061
2216
|
resolveAnchor: { type: Function, default: () => ({ kind: "unavailable" }) }
|
|
2062
2217
|
},
|
|
2063
2218
|
emits: ["open", "opened", "ready", "closing", "close", "change", "error", "originalState", "loadMore", "phaseChange", "chromeChange"],
|
|
2064
|
-
setup(t, { expose: n, emit:
|
|
2065
|
-
const e =
|
|
2066
|
-
|
|
2067
|
-
const
|
|
2068
|
-
() =>
|
|
2069
|
-
(s, b,
|
|
2070
|
-
), { originalIds:
|
|
2071
|
-
let
|
|
2072
|
-
const
|
|
2073
|
-
|
|
2074
|
-
const
|
|
2075
|
-
let
|
|
2076
|
-
const
|
|
2077
|
-
function
|
|
2219
|
+
setup(t, { expose: n, emit: r }) {
|
|
2220
|
+
const e = Qt(), i = t, a = r, o = $("closed");
|
|
2221
|
+
te(o, (s) => a("phaseChange", s), { flush: "sync" });
|
|
2222
|
+
const l = `mp-video-controls-${Jt().uid}`, u = $(), p = $(), c = wa(
|
|
2223
|
+
() => Y.value,
|
|
2224
|
+
(s, b, M) => a("originalState", s, b, M)
|
|
2225
|
+
), { originalIds: x, originalStatus: L, originalReason: S, originalRequest: E, readyId: w } = c;
|
|
2226
|
+
let g = "", B = -1;
|
|
2227
|
+
const O = $(), h = $(), k = $(), m = $(!1), y = $(0), P = $(!0);
|
|
2228
|
+
te(P, (s) => a("chromeChange", s), { flush: "sync" });
|
|
2229
|
+
const v = $(!1), R = $("loading"), F = $(1), C = $(!1), D = $(1), A = $(!1), Z = $(!1), K = ft(Ce);
|
|
2230
|
+
let be = "", ne = { kind: "unavailable" };
|
|
2231
|
+
const me = /* @__PURE__ */ new Map(), oe = /* @__PURE__ */ new Map();
|
|
2232
|
+
function Pe(s) {
|
|
2078
2233
|
return (b) => {
|
|
2079
|
-
|
|
2234
|
+
oe.set(s, b);
|
|
2080
2235
|
};
|
|
2081
2236
|
}
|
|
2082
|
-
function
|
|
2237
|
+
function ee(s) {
|
|
2083
2238
|
return (b) => {
|
|
2084
|
-
|
|
2239
|
+
me.set(s, b);
|
|
2085
2240
|
};
|
|
2086
2241
|
}
|
|
2087
|
-
const
|
|
2088
|
-
() =>
|
|
2089
|
-
() =>
|
|
2242
|
+
const I = ba(
|
|
2243
|
+
() => i.items.length,
|
|
2244
|
+
() => D.value,
|
|
2090
2245
|
(s) => {
|
|
2091
|
-
|
|
2246
|
+
g = i.items[s].id, c.reset(), F.value = 1, v.value = !1, R.value = "loading", a("change", s), Ae(s);
|
|
2092
2247
|
},
|
|
2093
2248
|
{
|
|
2094
|
-
readOffset: () => new DOMMatrixReadOnly(getComputedStyle(
|
|
2249
|
+
readOffset: () => new DOMMatrixReadOnly(getComputedStyle(oe.get(g)).transform).m41,
|
|
2095
2250
|
flushLayout: () => {
|
|
2096
|
-
|
|
2251
|
+
oe.get(g).getBoundingClientRect();
|
|
2097
2252
|
}
|
|
2098
2253
|
}
|
|
2099
|
-
),
|
|
2100
|
-
() =>
|
|
2254
|
+
), U = I.index, Y = V(() => i.items[U.value]), Oe = I.slots, Qe = V(
|
|
2255
|
+
() => o.value === "opening" || m.value ? [U.value] : Oe.value
|
|
2101
2256
|
);
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
const s = new Set(
|
|
2105
|
-
for (const b of
|
|
2106
|
-
for (const b of
|
|
2257
|
+
te(Oe, () => {
|
|
2258
|
+
Se(() => {
|
|
2259
|
+
const s = new Set(Oe.value.map((b) => i.items[b].id));
|
|
2260
|
+
for (const b of me.keys()) s.has(b) || me.delete(b);
|
|
2261
|
+
for (const b of oe.keys()) s.has(b) || oe.delete(b);
|
|
2107
2262
|
});
|
|
2108
2263
|
});
|
|
2109
|
-
const
|
|
2110
|
-
close:
|
|
2264
|
+
const ae = {
|
|
2265
|
+
close: N,
|
|
2111
2266
|
setChromeVisible: (s) => {
|
|
2112
|
-
|
|
2267
|
+
P.value = s;
|
|
2113
2268
|
},
|
|
2114
|
-
goTo:
|
|
2115
|
-
previous: () =>
|
|
2116
|
-
next: () =>
|
|
2117
|
-
rotate: (s = 90) =>
|
|
2118
|
-
reset: () =>
|
|
2119
|
-
zoomIn: () =>
|
|
2120
|
-
zoomOut: () =>
|
|
2269
|
+
goTo: lt,
|
|
2270
|
+
previous: () => I.go(-1),
|
|
2271
|
+
next: () => I.go(1),
|
|
2272
|
+
rotate: (s = 90) => W().rotateBy(s),
|
|
2273
|
+
reset: () => W().resetTransform(),
|
|
2274
|
+
zoomIn: () => W().zoomIn(),
|
|
2275
|
+
zoomOut: () => W().zoomOut(),
|
|
2121
2276
|
original: c.requestOriginal,
|
|
2122
|
-
fullscreen:
|
|
2123
|
-
togglePlayback: () =>
|
|
2277
|
+
fullscreen: Me,
|
|
2278
|
+
togglePlayback: () => W().togglePlayback(),
|
|
2124
2279
|
toggleLive: () => {
|
|
2125
|
-
|
|
2280
|
+
o.value !== "open" || R.value === "loading" || R.value === "error" || (v.value = !v.value);
|
|
2126
2281
|
},
|
|
2127
2282
|
toggleDetail: () => {
|
|
2128
|
-
|
|
2283
|
+
C.value = !C.value;
|
|
2129
2284
|
}
|
|
2130
|
-
}, ge =
|
|
2131
|
-
let
|
|
2132
|
-
},
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2285
|
+
}, ge = Ma(), de = nn();
|
|
2286
|
+
let ke = Promise.resolve(), pe = () => {
|
|
2287
|
+
}, G = 0, xe = "", se = !1, fe = "", he = "", Re = () => {
|
|
2288
|
+
}, ve = { kind: "idle" }, Be = 0;
|
|
2289
|
+
const Ee = () => new Promise((s) => requestAnimationFrame(() => s())), ze = new ResizeObserver(() => {
|
|
2290
|
+
const s = `${p.value.clientWidth}:${p.value.clientHeight}`, b = `${u.value.clientWidth}:${u.value.clientHeight}`, M = fe !== "" && fe !== s, H = he !== "" && he !== b;
|
|
2291
|
+
fe = s, he = b, D.value = p.value.clientWidth, M && o.value === "open" && I.reset(U.value), H && ge.cancel();
|
|
2136
2292
|
});
|
|
2137
|
-
function
|
|
2138
|
-
|
|
2293
|
+
function Ae(s) {
|
|
2294
|
+
i.hasMore && s >= i.items.length - 3 && B !== i.items.length && (B = i.items.length, a("loadMore", s));
|
|
2139
2295
|
}
|
|
2140
|
-
function
|
|
2141
|
-
s ===
|
|
2296
|
+
function rt(s, b) {
|
|
2297
|
+
s === U.value && (Z.value && (w.value = Y.value.id), a("ready", s, b));
|
|
2142
2298
|
}
|
|
2143
|
-
function
|
|
2144
|
-
s ===
|
|
2299
|
+
function ot(s, b, M) {
|
|
2300
|
+
s === U.value && c.updateOriginal(b, M);
|
|
2145
2301
|
}
|
|
2146
|
-
|
|
2147
|
-
() =>
|
|
2302
|
+
te(
|
|
2303
|
+
() => i.items.map((s) => s.id),
|
|
2148
2304
|
(s) => {
|
|
2149
|
-
if (
|
|
2305
|
+
if (o.value === "closed") return;
|
|
2150
2306
|
if (s.length === 0) {
|
|
2151
|
-
|
|
2307
|
+
G++, ge.cancel(), pe(), de.clear(), I.cancel(), Be++, ve.kind === "active" && ve.animation.cancel(), ze.disconnect(), fe = "", he = "", Re(), a("closing"), o.value = "closed", K.value = Ce, me.clear(), oe.clear(), document.body.style.overflow = xe, a("close");
|
|
2152
2308
|
return;
|
|
2153
2309
|
}
|
|
2154
|
-
const b = s.indexOf(
|
|
2155
|
-
(
|
|
2310
|
+
const b = s.indexOf(g), M = b >= 0 ? b : Math.min(U.value, s.length - 1);
|
|
2311
|
+
(M !== U.value || b < 0) && (b >= 0 ? I.rebase(M) : (I.reset(M), g = s[M], c.reset(), F.value = 1, v.value = !1, a("change", M))), Ae(M);
|
|
2156
2312
|
},
|
|
2157
2313
|
{ flush: "sync" }
|
|
2158
2314
|
);
|
|
2159
|
-
function
|
|
2160
|
-
if (!Number.isInteger(s) || s < 0 || s >=
|
|
2315
|
+
function lt(s) {
|
|
2316
|
+
if (!Number.isInteger(s) || s < 0 || s >= i.items.length)
|
|
2161
2317
|
throw new RangeError("无效的预览下标");
|
|
2162
|
-
if (!(
|
|
2163
|
-
if (Math.abs(s -
|
|
2164
|
-
|
|
2318
|
+
if (!(o.value !== "open" || s === U.value)) {
|
|
2319
|
+
if (Math.abs(s - U.value) === 1) {
|
|
2320
|
+
I.go(s - U.value);
|
|
2165
2321
|
return;
|
|
2166
2322
|
}
|
|
2167
|
-
|
|
2323
|
+
I.reset(s), g = i.items[s].id, c.reset(), F.value = 1, v.value = !1, R.value = "loading", a("change", s), Ae(s);
|
|
2168
2324
|
}
|
|
2169
2325
|
}
|
|
2170
|
-
function
|
|
2171
|
-
|
|
2326
|
+
function st() {
|
|
2327
|
+
i.persistentChrome || (P.value = !P.value);
|
|
2172
2328
|
}
|
|
2173
|
-
function
|
|
2174
|
-
return
|
|
2329
|
+
function W() {
|
|
2330
|
+
return me.get(g);
|
|
2175
2331
|
}
|
|
2176
|
-
function
|
|
2177
|
-
|
|
2332
|
+
function Ue(s) {
|
|
2333
|
+
Re();
|
|
2178
2334
|
const b = s.element.classList.contains("mp-transition-source");
|
|
2179
|
-
s.element.classList.add("mp-transition-source"),
|
|
2335
|
+
s.element.classList.add("mp-transition-source"), Re = () => {
|
|
2180
2336
|
s.element.classList.toggle("mp-transition-source", b);
|
|
2181
2337
|
};
|
|
2182
2338
|
}
|
|
2183
|
-
function
|
|
2339
|
+
function d() {
|
|
2184
2340
|
const s = u.value.getBoundingClientRect();
|
|
2185
2341
|
return { left: s.left, top: s.top, width: s.width, height: s.height };
|
|
2186
2342
|
}
|
|
2187
|
-
function
|
|
2188
|
-
return
|
|
2343
|
+
function z() {
|
|
2344
|
+
return p.value.getBoundingClientRect();
|
|
2189
2345
|
}
|
|
2190
|
-
function
|
|
2191
|
-
const b =
|
|
2346
|
+
function X(s = 1) {
|
|
2347
|
+
const b = z(), M = W().core, H = M.state, ie = H.downScale;
|
|
2192
2348
|
return {
|
|
2193
|
-
x: b.left + b.width / 2 +
|
|
2194
|
-
y: b.top + b.height / 2 +
|
|
2195
|
-
width:
|
|
2196
|
-
height:
|
|
2197
|
-
rotation:
|
|
2349
|
+
x: b.left + b.width / 2 + I.state.offset + H.offsetX * ie * s + H.downOffsetX,
|
|
2350
|
+
y: b.top + b.height / 2 + H.offsetY * ie * s + H.downOffsetY,
|
|
2351
|
+
width: M.mediaSize.value.width * M.displayScale.value * ie * s,
|
|
2352
|
+
height: M.mediaSize.value.height * M.displayScale.value * ie * s,
|
|
2353
|
+
rotation: H.rotation,
|
|
2198
2354
|
clip: b,
|
|
2199
2355
|
radius: 0
|
|
2200
2356
|
};
|
|
2201
2357
|
}
|
|
2202
|
-
async function
|
|
2203
|
-
if (!Number.isInteger(s) || s < 0 || s >=
|
|
2358
|
+
async function j(s = 0) {
|
|
2359
|
+
if (!Number.isInteger(s) || s < 0 || s >= i.items.length)
|
|
2204
2360
|
throw new RangeError("无效的预览下标");
|
|
2205
|
-
if (
|
|
2206
|
-
const b = ++
|
|
2207
|
-
if (
|
|
2208
|
-
|
|
2361
|
+
if (o.value === "closing" && await ke, o.value !== "closed" || se) return;
|
|
2362
|
+
const b = ++G;
|
|
2363
|
+
if (de.clear(), xe = document.body.style.overflow, document.body.style.overflow = "hidden", I.reset(s), g = i.items[s].id, c.reset(), F.value = 1, P.value = !0, v.value = !1, R.value = "loading", C.value = !1, y.value = 0, Z.value = !1, o.value = "opening", K.value = Ce, A.value = !1, be = Y.value.id, ne = { kind: "unavailable" }, m.value = !1, a("open", s), await Se(), b !== G || se) return;
|
|
2364
|
+
D.value = p.value.clientWidth, ze.observe(u.value), ze.observe(p.value);
|
|
2365
|
+
try {
|
|
2366
|
+
const H = await i.resolveAnchor(Y.value);
|
|
2367
|
+
if (b !== G) return;
|
|
2368
|
+
const ie = Rt(H, Y.value, d());
|
|
2369
|
+
ne = ie, K.value = Fn(ie), A.value = K.value.kind === "image" || W().readiness === "ready";
|
|
2370
|
+
const Ye = z();
|
|
2371
|
+
if (ie.kind === "element") {
|
|
2372
|
+
const Xe = W().readiness === "ready" ? W().core.mediaRef.value : K.value.kind === "image" ? K.value.image : xt();
|
|
2373
|
+
if (m.value = !0, await Se(), b !== G || se) return;
|
|
2374
|
+
Ue(ie), await ge.play(
|
|
2375
|
+
O.value,
|
|
2376
|
+
h.value,
|
|
2377
|
+
Xe,
|
|
2378
|
+
ie.frame,
|
|
2379
|
+
Ot(Y.value, Ye, "contain"),
|
|
2380
|
+
ie.viewport,
|
|
2381
|
+
k.value,
|
|
2382
|
+
!0,
|
|
2383
|
+
0,
|
|
2384
|
+
i.transitionDuration
|
|
2385
|
+
);
|
|
2386
|
+
} else
|
|
2387
|
+
y.value = 1, m.value = !1, await ye(!0);
|
|
2388
|
+
} catch (H) {
|
|
2389
|
+
if (b !== G) return;
|
|
2390
|
+
a("error", Ve(H), Y.value);
|
|
2391
|
+
}
|
|
2392
|
+
if (b !== G || se || (y.value = 1, o.value = "open", await Se(), b !== G || se)) return;
|
|
2393
|
+
const M = de.take();
|
|
2394
|
+
M.kind === "pointer" && i.gesturesEnabled && (W().onPointerDown(M.down, z(), M.target), W().onPointerMove(M.latest)), W().core.renderNow(), await Ee(), !(b !== G || se) && (m.value = !1, ge.cancel(), Re(), a("opened", s), await Ee(), !(b !== G || se || o.value !== "open") && (Z.value = !0, Ae(s)));
|
|
2395
|
+
}
|
|
2396
|
+
function N() {
|
|
2397
|
+
return o.value === "closed" || o.value === "closing" || (ke = Q()), ke;
|
|
2398
|
+
}
|
|
2399
|
+
async function Q() {
|
|
2400
|
+
de.clear(), I.grab();
|
|
2401
|
+
const s = y.value, b = o.value === "opening", M = !b && W().readiness === "ready" ? W().retainFrame() : {
|
|
2402
|
+
image: K.value.kind === "image" && Y.value.id === be ? K.value.image : xt(),
|
|
2403
|
+
scale: 1,
|
|
2404
|
+
release: () => {
|
|
2405
|
+
}
|
|
2406
|
+
};
|
|
2407
|
+
pe = M.release;
|
|
2408
|
+
try {
|
|
2409
|
+
let H = b ? { kind: "opening" } : { kind: "captured", frame: X(M.scale) };
|
|
2410
|
+
b || W().core.cancelGesture(!0);
|
|
2411
|
+
const ie = ++G, Ye = b ? ge.reverseOpening() : { kind: "inactive" };
|
|
2412
|
+
Ye.kind === "inactive" && ge.cancel(), I.cancel(), v.value = !1, o.value = "closing", a("closing");
|
|
2209
2413
|
try {
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
!
|
|
2227
|
-
|
|
2228
|
-
|
|
2414
|
+
if (await Se(), ie !== G || se || (document.fullscreenElement === u.value && (await document.exitFullscreen(), await Ee(), await Ee(), H.kind === "captured" && (H.frame = X(M.scale))), ie !== G || se)) return;
|
|
2415
|
+
const Xe = b ? ne : await i.resolveAnchor(Y.value);
|
|
2416
|
+
if (ie !== G || se) return;
|
|
2417
|
+
const et = b ? ne : Rt(Xe, Y.value, d());
|
|
2418
|
+
if (Ye.kind === "reversing")
|
|
2419
|
+
await Ye.finished;
|
|
2420
|
+
else if (H.kind === "captured" && et.kind === "element") {
|
|
2421
|
+
const Nt = M.image;
|
|
2422
|
+
Ue(et), m.value = !0, await Se(), await ge.play(
|
|
2423
|
+
O.value,
|
|
2424
|
+
h.value,
|
|
2425
|
+
Nt,
|
|
2426
|
+
H.frame,
|
|
2427
|
+
et.frame,
|
|
2428
|
+
et.viewport,
|
|
2429
|
+
k.value,
|
|
2430
|
+
!1,
|
|
2431
|
+
s,
|
|
2432
|
+
i.closeDuration
|
|
2229
2433
|
);
|
|
2230
2434
|
} else
|
|
2231
|
-
|
|
2232
|
-
} catch (
|
|
2233
|
-
|
|
2234
|
-
i("error", _e(E), W.value);
|
|
2435
|
+
m.value = !1, await ye(!1);
|
|
2436
|
+
} catch (Xe) {
|
|
2437
|
+
a("error", Ve(Xe), Y.value), await ye(!1);
|
|
2235
2438
|
}
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
}
|
|
2242
|
-
async function X() {
|
|
2243
|
-
B.grab();
|
|
2244
|
-
const s = w.value, b = l.value === "opening", E = !b && Z().readiness === "ready" ? Z().captureFrame() : {
|
|
2245
|
-
image: U.value.kind === "image" && W.value.id === Pe ? U.value.image : St(),
|
|
2246
|
-
scale: 1
|
|
2247
|
-
};
|
|
2248
|
-
let _ = b ? { kind: "opening" } : { kind: "captured", frame: Ue(E.scale) };
|
|
2249
|
-
b || Z().core.cancelGesture(!0);
|
|
2250
|
-
const fe = ++Q, Xe = b ? ge.reverseOpening() : { kind: "inactive" };
|
|
2251
|
-
Xe.kind === "inactive" && ge.cancel(), B.cancel(), f.value = !1, l.value = "closing", i("closing");
|
|
2252
|
-
try {
|
|
2253
|
-
if (await we(), fe !== Q || G || (document.fullscreenElement === u.value && (await document.exitFullscreen(), await Ce(), await Ce(), _.kind === "captured" && (_.frame = Ue(E.scale))), fe !== Q || G)) return;
|
|
2254
|
-
const dt = b ? ue : await a.resolveAnchor(W.value);
|
|
2255
|
-
if (fe !== Q || G) return;
|
|
2256
|
-
const nt = b ? ue : Lt(dt, W.value, et());
|
|
2257
|
-
if (Xe.kind === "reversing")
|
|
2258
|
-
await Xe.finished;
|
|
2259
|
-
else if (_.kind === "captured" && nt.kind === "element") {
|
|
2260
|
-
const Ut = E.image;
|
|
2261
|
-
Je(nt), m.value = !0, await we(), await ge.play(
|
|
2262
|
-
I.value,
|
|
2263
|
-
y.value,
|
|
2264
|
-
Ut,
|
|
2265
|
-
_.frame,
|
|
2266
|
-
nt.frame,
|
|
2267
|
-
nt.viewport,
|
|
2268
|
-
x.value,
|
|
2269
|
-
!1,
|
|
2270
|
-
s,
|
|
2271
|
-
a.closeDuration
|
|
2272
|
-
);
|
|
2273
|
-
} else
|
|
2274
|
-
m.value = !1, await N(!1);
|
|
2275
|
-
} catch (dt) {
|
|
2276
|
-
i("error", _e(dt), W.value), await N(!1);
|
|
2439
|
+
if (ie !== G || se) return;
|
|
2440
|
+
ze.disconnect(), fe = "", he = "", y.value = 0, o.value = "closed", K.value = Ce, me.clear(), oe.clear(), Re(), document.body.style.overflow = xe, a("close"), await Se(), ge.cancel();
|
|
2441
|
+
} finally {
|
|
2442
|
+
M.release(), pe === M.release && (pe = () => {
|
|
2443
|
+
});
|
|
2277
2444
|
}
|
|
2278
|
-
fe !== Q || G || (Me.disconnect(), he = "", me = "", w.value = 0, l.value = "closed", U.value = ke, ce.clear(), ee.clear(), xe(), document.body.style.overflow = pe, i("close"), await we(), ge.cancel());
|
|
2279
2445
|
}
|
|
2280
|
-
async function
|
|
2281
|
-
const b = ++
|
|
2282
|
-
|
|
2283
|
-
const
|
|
2446
|
+
async function ye(s) {
|
|
2447
|
+
const b = ++Be, M = s ? 0 : Number(getComputedStyle(u.value).opacity);
|
|
2448
|
+
ve.kind === "active" && ve.animation.cancel(), u.value.style.opacity = String(M);
|
|
2449
|
+
const H = u.value.animate([{ opacity: M }, { opacity: s ? 1 : 0 }], {
|
|
2284
2450
|
duration: matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : 180,
|
|
2285
2451
|
fill: "forwards"
|
|
2286
2452
|
});
|
|
2287
|
-
|
|
2288
|
-
}), !(b !==
|
|
2453
|
+
ve = { kind: "active", animation: H }, await H.finished.catch(() => {
|
|
2454
|
+
}), !(b !== Be || se) && (u.value.style.opacity = s ? "1" : "0", H.cancel(), ve = { kind: "idle" });
|
|
2289
2455
|
}
|
|
2290
|
-
async function
|
|
2456
|
+
async function Me() {
|
|
2291
2457
|
if (document.fullscreenEnabled)
|
|
2292
2458
|
try {
|
|
2293
2459
|
document.fullscreenElement === u.value ? await document.exitFullscreen() : await u.value.requestFullscreen();
|
|
2294
2460
|
} catch (s) {
|
|
2295
|
-
|
|
2461
|
+
a("error", Ve(s), Y.value);
|
|
2296
2462
|
}
|
|
2297
2463
|
}
|
|
2298
|
-
function
|
|
2299
|
-
|
|
2464
|
+
function Le(s) {
|
|
2465
|
+
if (i.gesturesEnabled) {
|
|
2466
|
+
if (o.value === "opening") {
|
|
2467
|
+
de.start(s);
|
|
2468
|
+
return;
|
|
2469
|
+
}
|
|
2470
|
+
o.value === "open" && W().onPointerDown(s, z()) && I.grab();
|
|
2471
|
+
}
|
|
2300
2472
|
}
|
|
2301
|
-
function
|
|
2302
|
-
|
|
2473
|
+
function Je(s) {
|
|
2474
|
+
if (o.value === "opening") {
|
|
2475
|
+
i.gesturesEnabled && de.finish(s, z()) && N();
|
|
2476
|
+
return;
|
|
2477
|
+
}
|
|
2478
|
+
o.value === "open" && (W().onPointerUp(s), o.value === "open" && I.resume());
|
|
2303
2479
|
}
|
|
2304
|
-
function
|
|
2305
|
-
|
|
2480
|
+
function ht(s) {
|
|
2481
|
+
de.clear(), o.value === "open" && (W().onPointerCancel(s), o.value === "open" && I.resume());
|
|
2306
2482
|
}
|
|
2307
|
-
function
|
|
2308
|
-
|
|
2483
|
+
function _t(s) {
|
|
2484
|
+
o.value === "opening" && de.clear(), o.value === "open" && s.target === W().core.containerRef.value && ht(s);
|
|
2309
2485
|
}
|
|
2310
|
-
function
|
|
2311
|
-
|
|
2486
|
+
function Vt(s) {
|
|
2487
|
+
o.value === "opening" && de.move(s), o.value === "open" && W().onPointerMove(s);
|
|
2312
2488
|
}
|
|
2313
|
-
function
|
|
2314
|
-
|
|
2489
|
+
function Ut(s) {
|
|
2490
|
+
o.value === "open" && i.gesturesEnabled && W().onWheel(s);
|
|
2315
2491
|
}
|
|
2316
|
-
function
|
|
2317
|
-
|
|
2492
|
+
function Yt(s) {
|
|
2493
|
+
o.value === "open" && (y.value = 1 - s);
|
|
2318
2494
|
}
|
|
2319
|
-
function
|
|
2320
|
-
|
|
2495
|
+
function Xt(s) {
|
|
2496
|
+
o.value === "open" && I.drag(s);
|
|
2321
2497
|
}
|
|
2322
|
-
function
|
|
2323
|
-
|
|
2498
|
+
function Ht(s, b) {
|
|
2499
|
+
o.value === "open" && (v.value = !1, I.release(s, b));
|
|
2324
2500
|
}
|
|
2325
|
-
function
|
|
2326
|
-
|
|
2501
|
+
function Wt(s) {
|
|
2502
|
+
F.value = s, s > 1.02 && !i.persistentChrome && (P.value = !1);
|
|
2503
|
+
}
|
|
2504
|
+
function vt(s) {
|
|
2505
|
+
if (!(o.value === "closed" || !i.keyboardEnabled) && !(s.key === "Escape" && document.fullscreenElement === u.value)) {
|
|
2327
2506
|
if (s.key === "Escape") {
|
|
2328
|
-
s.preventDefault(),
|
|
2507
|
+
s.preventDefault(), N();
|
|
2329
2508
|
return;
|
|
2330
2509
|
}
|
|
2331
|
-
if (!(
|
|
2332
|
-
if (
|
|
2510
|
+
if (!(o.value !== "open" || s.target.matches("input, textarea, select, button, [role='slider']"))) {
|
|
2511
|
+
if (Y.value.type === "video") {
|
|
2333
2512
|
if (s.code === "Space") {
|
|
2334
|
-
s.preventDefault(),
|
|
2513
|
+
s.preventDefault(), W().togglePlayback();
|
|
2335
2514
|
return;
|
|
2336
2515
|
}
|
|
2337
2516
|
if (s.key === "Enter") {
|
|
2338
|
-
s.preventDefault(),
|
|
2517
|
+
s.preventDefault(), W().toggleFullscreen();
|
|
2339
2518
|
return;
|
|
2340
2519
|
}
|
|
2341
2520
|
}
|
|
2342
|
-
if (
|
|
2343
|
-
s.preventDefault(),
|
|
2521
|
+
if (Y.value.type === "live-photo" && s.code === "Space") {
|
|
2522
|
+
s.preventDefault(), ae.toggleLive();
|
|
2344
2523
|
return;
|
|
2345
2524
|
}
|
|
2346
|
-
s.key === "ArrowLeft" && (s.preventDefault(),
|
|
2525
|
+
s.key === "ArrowLeft" && (s.preventDefault(), I.go(-1)), s.key === "ArrowRight" && (s.preventDefault(), I.go(1)), (s.key === "+" || s.key === "=") && ae.zoomIn(), s.key === "-" && ae.zoomOut(), s.key === "0" && ae.reset();
|
|
2347
2526
|
}
|
|
2348
2527
|
}
|
|
2349
2528
|
}
|
|
2350
2529
|
return qe(() => {
|
|
2351
|
-
document.addEventListener("keydown",
|
|
2352
|
-
}),
|
|
2353
|
-
|
|
2530
|
+
document.addEventListener("keydown", vt);
|
|
2531
|
+
}), Te(() => {
|
|
2532
|
+
se = !0, G += 1, ge.cancel(), pe(), de.clear(), Be += 1, ve.kind === "active" && ve.animation.cancel(), Re(), ze.disconnect(), document.removeEventListener("keydown", vt), o.value !== "closed" && (document.body.style.overflow = xe);
|
|
2354
2533
|
}), n({
|
|
2355
|
-
open:
|
|
2356
|
-
...
|
|
2357
|
-
currentIndex:
|
|
2358
|
-
phase:
|
|
2534
|
+
open: j,
|
|
2535
|
+
...ae,
|
|
2536
|
+
currentIndex: U,
|
|
2537
|
+
phase: o,
|
|
2359
2538
|
element: u,
|
|
2360
|
-
mediaElement: () =>
|
|
2361
|
-
canvasElement: () =>
|
|
2362
|
-
}), (s, b) => (
|
|
2539
|
+
mediaElement: () => W().core.mediaRef.value,
|
|
2540
|
+
canvasElement: () => W().core.canvasRef.value
|
|
2541
|
+
}), (s, b) => (q(), We(Ct, {
|
|
2363
2542
|
to: "body",
|
|
2364
2543
|
disabled: s.teleportDisabled
|
|
2365
2544
|
}, [
|
|
2366
|
-
|
|
2545
|
+
o.value !== "closed" ? (q(), _("div", Ne({
|
|
2367
2546
|
key: 0,
|
|
2368
2547
|
ref_key: "root",
|
|
2369
2548
|
ref: u
|
|
2370
|
-
},
|
|
2549
|
+
}, f(e), {
|
|
2371
2550
|
class: ["mp-viewer", { "is-mobile": s.mobile, "is-album": s.appearance === "album" }],
|
|
2372
2551
|
role: "dialog",
|
|
2373
2552
|
"aria-modal": "true",
|
|
2374
|
-
"aria-label":
|
|
2375
|
-
"data-phase":
|
|
2376
|
-
"data-chrome":
|
|
2377
|
-
inert:
|
|
2378
|
-
onPointerdown:
|
|
2379
|
-
onPointermove:
|
|
2380
|
-
onPointerup:
|
|
2381
|
-
onPointercancel:
|
|
2382
|
-
onLostpointercapture:
|
|
2383
|
-
onWheel:
|
|
2553
|
+
"aria-label": Y.value.title,
|
|
2554
|
+
"data-phase": o.value,
|
|
2555
|
+
"data-chrome": P.value ? "visible" : "hidden",
|
|
2556
|
+
inert: o.value === "closing",
|
|
2557
|
+
onPointerdown: Le,
|
|
2558
|
+
onPointermove: Vt,
|
|
2559
|
+
onPointerup: Je,
|
|
2560
|
+
onPointercancel: ht,
|
|
2561
|
+
onLostpointercapture: _t,
|
|
2562
|
+
onWheel: Ut
|
|
2384
2563
|
}), [
|
|
2385
2564
|
T("div", {
|
|
2386
2565
|
ref_key: "backdrop",
|
|
2387
|
-
ref:
|
|
2566
|
+
ref: k,
|
|
2388
2567
|
class: "mp-viewer__backdrop",
|
|
2389
|
-
style:
|
|
2568
|
+
style: we({ opacity: y.value })
|
|
2390
2569
|
}, null, 4),
|
|
2391
2570
|
T("div", {
|
|
2392
|
-
id:
|
|
2571
|
+
id: l,
|
|
2393
2572
|
class: "mp-viewer__video-controls"
|
|
2394
2573
|
}),
|
|
2395
2574
|
T("div", {
|
|
2396
2575
|
ref_key: "mediaViewport",
|
|
2397
|
-
ref:
|
|
2398
|
-
class:
|
|
2576
|
+
ref: p,
|
|
2577
|
+
class: De(["mp-viewer__pages", { "is-transitioning": m.value }])
|
|
2399
2578
|
}, [
|
|
2400
|
-
(
|
|
2401
|
-
key: s.items[
|
|
2579
|
+
(q(!0), _(Fe, null, Ze(Qe.value, (M) => (q(), _("div", {
|
|
2580
|
+
key: s.items[M].id,
|
|
2402
2581
|
ref_for: !0,
|
|
2403
|
-
ref:
|
|
2582
|
+
ref: Pe(s.items[M].id),
|
|
2404
2583
|
class: "mp-viewer__page",
|
|
2405
|
-
style:
|
|
2406
|
-
transform: `translate3d(${(
|
|
2407
|
-
transition:
|
|
2584
|
+
style: we({
|
|
2585
|
+
transform: `translate3d(${(M - f(U)) * f(I).stride() + f(I).state.offset}px,0,0)`,
|
|
2586
|
+
transition: f(I).state.settling ? `transform ${f(I).state.duration}ms cubic-bezier(.22,.61,.36,1)` : "none"
|
|
2408
2587
|
}),
|
|
2409
|
-
"aria-hidden":
|
|
2410
|
-
inert:
|
|
2411
|
-
"data-media-id": s.items[
|
|
2588
|
+
"aria-hidden": M !== f(U),
|
|
2589
|
+
inert: M !== f(U),
|
|
2590
|
+
"data-media-id": s.items[M].id
|
|
2412
2591
|
}, [
|
|
2413
|
-
|
|
2592
|
+
Ie(ya, {
|
|
2414
2593
|
ref_for: !0,
|
|
2415
|
-
ref:
|
|
2416
|
-
media: s.items[
|
|
2594
|
+
ref: ee(s.items[M].id),
|
|
2595
|
+
media: s.items[M],
|
|
2417
2596
|
"video-loader": s.videoLoader,
|
|
2418
|
-
rendering:
|
|
2419
|
-
paging:
|
|
2597
|
+
rendering: o.value === "open",
|
|
2598
|
+
paging: f(I).state.dragging || f(I).state.preparing || f(I).state.settling || f(I).state.grabbed,
|
|
2420
2599
|
"external-gestures": "",
|
|
2421
|
-
active:
|
|
2422
|
-
disabled:
|
|
2423
|
-
"inactive-reset-duration":
|
|
2600
|
+
active: M === f(U),
|
|
2601
|
+
disabled: o.value !== "open" || !s.gesturesEnabled,
|
|
2602
|
+
"inactive-reset-duration": f(I).state.duration,
|
|
2424
2603
|
"resource-policy": s.resourcePolicy,
|
|
2425
2604
|
"resolve-source": s.resolveImageSource,
|
|
2426
|
-
"request-version":
|
|
2427
|
-
"load-enabled":
|
|
2605
|
+
"request-version": M === f(U) ? f(E) : 0,
|
|
2606
|
+
"load-enabled": M === f(U) ? Z.value && o.value === "open" : o.value === "open" && !m.value && f(w) === Y.value.id,
|
|
2428
2607
|
"teleport-controls": "",
|
|
2429
|
-
"controls-target": `#${
|
|
2430
|
-
"controls-visible":
|
|
2431
|
-
"initial-image": s.items[
|
|
2432
|
-
quality:
|
|
2433
|
-
"live-playing":
|
|
2434
|
-
onTap:
|
|
2435
|
-
onScale:
|
|
2436
|
-
onPageDrag:
|
|
2437
|
-
onPageRelease:
|
|
2438
|
-
onClose:
|
|
2439
|
-
onSwipeDownProgress:
|
|
2440
|
-
onLiveState: (
|
|
2441
|
-
|
|
2608
|
+
"controls-target": `#${l}`,
|
|
2609
|
+
"controls-visible": P.value && y.value === 1,
|
|
2610
|
+
"initial-image": s.items[M].id === f(be) ? K.value : f(Ce),
|
|
2611
|
+
quality: M === f(U) && f(x).has(s.items[M].id) ? "full" : M === f(U) ? "screen" : "thumbnail",
|
|
2612
|
+
"live-playing": v.value,
|
|
2613
|
+
onTap: st,
|
|
2614
|
+
onScale: Wt,
|
|
2615
|
+
onPageDrag: Xt,
|
|
2616
|
+
onPageRelease: Ht,
|
|
2617
|
+
onClose: N,
|
|
2618
|
+
onSwipeDownProgress: Yt,
|
|
2619
|
+
onLiveState: (H) => {
|
|
2620
|
+
M === f(U) && (R.value = H);
|
|
2442
2621
|
},
|
|
2443
2622
|
onLiveEnded: () => {
|
|
2444
|
-
|
|
2623
|
+
M === f(U) && (v.value = !1);
|
|
2445
2624
|
},
|
|
2446
|
-
onReady: (
|
|
2447
|
-
onOriginalState: (
|
|
2448
|
-
onError: (
|
|
2625
|
+
onReady: (H) => rt(M, H),
|
|
2626
|
+
onOriginalState: (H, ie) => ot(M, H, ie),
|
|
2627
|
+
onError: (H) => a("error", H, s.items[M])
|
|
2449
2628
|
}, null, 8, ["media", "video-loader", "rendering", "paging", "active", "disabled", "inactive-reset-duration", "resource-policy", "resolve-source", "request-version", "load-enabled", "controls-target", "controls-visible", "initial-image", "quality", "live-playing", "onLiveState", "onLiveEnded", "onReady", "onOriginalState", "onError"])
|
|
2450
|
-
], 12,
|
|
2629
|
+
], 12, Ra))), 128))
|
|
2451
2630
|
], 2),
|
|
2452
|
-
|
|
2631
|
+
en(T("div", {
|
|
2453
2632
|
ref_key: "transitionMask",
|
|
2454
|
-
ref:
|
|
2633
|
+
ref: h,
|
|
2455
2634
|
class: "mp-shared-clip",
|
|
2456
2635
|
"aria-hidden": "true"
|
|
2457
2636
|
}, [
|
|
2458
2637
|
T("canvas", {
|
|
2459
2638
|
ref_key: "transitionCanvas",
|
|
2460
|
-
ref:
|
|
2639
|
+
ref: O,
|
|
2461
2640
|
class: "mp-shared-transition"
|
|
2462
2641
|
}, null, 512)
|
|
2463
2642
|
], 512), [
|
|
2464
|
-
[
|
|
2643
|
+
[tn, m.value]
|
|
2465
2644
|
]),
|
|
2466
|
-
|
|
2645
|
+
o.value === "opening" && !A.value ? (q(), _("div", Ea, La)) : le("", !0),
|
|
2467
2646
|
T("div", {
|
|
2468
|
-
class:
|
|
2469
|
-
inert: !
|
|
2647
|
+
class: De(["mp-viewer__chrome", { "is-hidden": !P.value || o.value !== "open" || y.value < 1 }]),
|
|
2648
|
+
inert: !P.value || o.value !== "open" || y.value < 1
|
|
2470
2649
|
}, [
|
|
2471
|
-
|
|
2472
|
-
media:
|
|
2473
|
-
index:
|
|
2650
|
+
ut(s.$slots, "toolbar", {
|
|
2651
|
+
media: Y.value,
|
|
2652
|
+
index: f(U),
|
|
2474
2653
|
total: s.items.length,
|
|
2475
|
-
scale:
|
|
2476
|
-
controls:
|
|
2477
|
-
originalStatus:
|
|
2478
|
-
originalReason:
|
|
2479
|
-
livePlaying:
|
|
2480
|
-
liveStatus:
|
|
2654
|
+
scale: F.value,
|
|
2655
|
+
controls: ae,
|
|
2656
|
+
originalStatus: f(L),
|
|
2657
|
+
originalReason: f(S),
|
|
2658
|
+
livePlaying: v.value,
|
|
2659
|
+
liveStatus: R.value
|
|
2481
2660
|
}, () => [
|
|
2482
|
-
T("header",
|
|
2661
|
+
T("header", Fa, [
|
|
2483
2662
|
T("button", {
|
|
2484
2663
|
type: "button",
|
|
2485
2664
|
"aria-label": "关闭预览",
|
|
2486
|
-
onClick:
|
|
2665
|
+
onClick: N
|
|
2487
2666
|
}, "‹"),
|
|
2488
|
-
T("div",
|
|
2489
|
-
T("strong", null,
|
|
2490
|
-
T("span", null,
|
|
2667
|
+
T("div", Ta, [
|
|
2668
|
+
T("strong", null, ce(Y.value.title), 1),
|
|
2669
|
+
T("span", null, ce(f(U) + 1) + " / " + ce(s.items.length), 1)
|
|
2491
2670
|
]),
|
|
2492
2671
|
T("button", {
|
|
2493
2672
|
type: "button",
|
|
2494
2673
|
"aria-label": "旋转图片",
|
|
2495
|
-
disabled:
|
|
2496
|
-
onClick: b[0] || (b[0] = (
|
|
2497
|
-
}, " ↻ ", 8,
|
|
2674
|
+
disabled: Y.value.type === "video",
|
|
2675
|
+
onClick: b[0] || (b[0] = (M) => ae.rotate())
|
|
2676
|
+
}, " ↻ ", 8, Ba)
|
|
2498
2677
|
]),
|
|
2499
|
-
T("footer",
|
|
2500
|
-
|
|
2678
|
+
T("footer", za, [
|
|
2679
|
+
Y.value.type !== "video" ? (q(), _(Fe, { key: 0 }, [
|
|
2501
2680
|
T("button", {
|
|
2502
2681
|
type: "button",
|
|
2503
2682
|
"aria-label": "缩小",
|
|
2504
2683
|
onClick: b[1] || (b[1] = //@ts-ignore
|
|
2505
|
-
(...
|
|
2684
|
+
(...M) => ae.zoomOut && ae.zoomOut(...M))
|
|
2506
2685
|
}, "−"),
|
|
2507
2686
|
T("button", {
|
|
2508
2687
|
type: "button",
|
|
2509
2688
|
"aria-label": "放大",
|
|
2510
2689
|
onClick: b[2] || (b[2] = //@ts-ignore
|
|
2511
|
-
(...
|
|
2690
|
+
(...M) => ae.zoomIn && ae.zoomIn(...M))
|
|
2512
2691
|
}, "+"),
|
|
2513
2692
|
T("button", {
|
|
2514
2693
|
type: "button",
|
|
2515
2694
|
"aria-label": "复位",
|
|
2516
2695
|
onClick: b[3] || (b[3] = //@ts-ignore
|
|
2517
|
-
(...
|
|
2696
|
+
(...M) => ae.reset && ae.reset(...M))
|
|
2518
2697
|
}, "复位")
|
|
2519
|
-
], 64)) :
|
|
2698
|
+
], 64)) : le("", !0),
|
|
2520
2699
|
T("button", {
|
|
2521
2700
|
type: "button",
|
|
2522
2701
|
"aria-label": "图片详情",
|
|
2523
2702
|
onClick: b[4] || (b[4] = //@ts-ignore
|
|
2524
|
-
(...
|
|
2703
|
+
(...M) => ae.toggleDetail && ae.toggleDetail(...M))
|
|
2525
2704
|
}, "ⓘ")
|
|
2526
2705
|
])
|
|
2527
2706
|
]),
|
|
2528
|
-
!s.mobile &&
|
|
2707
|
+
!s.mobile && f(U) > 0 ? (q(), _("button", {
|
|
2529
2708
|
key: 0,
|
|
2530
2709
|
class: "mp-viewer__arrow is-left",
|
|
2531
2710
|
"aria-label": "上一张",
|
|
2532
|
-
onClick: b[5] || (b[5] = (
|
|
2533
|
-
}, " ‹ ")) :
|
|
2534
|
-
!s.mobile &&
|
|
2711
|
+
onClick: b[5] || (b[5] = (M) => f(I).go(-1))
|
|
2712
|
+
}, " ‹ ")) : le("", !0),
|
|
2713
|
+
!s.mobile && f(U) < s.items.length - 1 ? (q(), _("button", {
|
|
2535
2714
|
key: 1,
|
|
2536
2715
|
class: "mp-viewer__arrow is-right",
|
|
2537
2716
|
"aria-label": "下一张",
|
|
2538
|
-
onClick: b[6] || (b[6] = (
|
|
2539
|
-
}, " › ")) :
|
|
2540
|
-
T("div",
|
|
2541
|
-
], 10,
|
|
2542
|
-
|
|
2717
|
+
onClick: b[6] || (b[6] = (M) => f(I).go(1))
|
|
2718
|
+
}, " › ")) : le("", !0),
|
|
2719
|
+
T("div", Ia, ce(f(U) + 1) + " / " + ce(s.items.length), 1)
|
|
2720
|
+
], 10, $a),
|
|
2721
|
+
C.value ? (q(), _("aside", Da, [
|
|
2543
2722
|
T("button", {
|
|
2544
2723
|
type: "button",
|
|
2545
2724
|
"aria-label": "关闭详情",
|
|
2546
|
-
onClick: b[7] || (b[7] = (
|
|
2725
|
+
onClick: b[7] || (b[7] = (M) => C.value = !1)
|
|
2547
2726
|
}, "×"),
|
|
2548
|
-
T("strong", null,
|
|
2549
|
-
T("span", null,
|
|
2550
|
-
T("span", null,
|
|
2551
|
-
])) :
|
|
2552
|
-
], 16,
|
|
2727
|
+
T("strong", null, ce(Y.value.title), 1),
|
|
2728
|
+
T("span", null, ce(Y.value.width) + " × " + ce(Y.value.height), 1),
|
|
2729
|
+
T("span", null, ce(Y.value.type) + " · " + ce(F.value.toFixed(2)) + "×", 1)
|
|
2730
|
+
])) : le("", !0)
|
|
2731
|
+
], 16, Pa)) : le("", !0)
|
|
2553
2732
|
], 8, ["disabled"]));
|
|
2554
2733
|
}
|
|
2555
2734
|
});
|
|
2556
|
-
function
|
|
2557
|
-
const
|
|
2558
|
-
let
|
|
2559
|
-
return t.forEach((
|
|
2560
|
-
c > 0 && (
|
|
2561
|
-
for (let
|
|
2562
|
-
const
|
|
2563
|
-
|
|
2564
|
-
for (let
|
|
2565
|
-
u +=
|
|
2566
|
-
}
|
|
2567
|
-
}), { rows:
|
|
2735
|
+
function qa(t, n, r, e = 2) {
|
|
2736
|
+
const i = Math.max(1, (n - e * (r - 1)) / r), a = [], o = /* @__PURE__ */ new Map();
|
|
2737
|
+
let l = 0, u = 0;
|
|
2738
|
+
return t.forEach((p, c) => {
|
|
2739
|
+
c > 0 && (a.push({ kind: "header", group: c, first: 0, count: 0, start: l, end: l + 52 }), l += 52);
|
|
2740
|
+
for (let x = 0; x < p.items.length; x += r) {
|
|
2741
|
+
const L = Math.min(r, p.items.length - x), S = a.length;
|
|
2742
|
+
a.push({ kind: "items", group: c, first: x, count: L, start: l, end: l + i });
|
|
2743
|
+
for (let E = 0; E < L; E++) o.set(p.items[x + E].id, S);
|
|
2744
|
+
u += L, l += i + (x + L < p.items.length ? e : 0);
|
|
2745
|
+
}
|
|
2746
|
+
}), { rows: a, locations: o, height: l, size: i, total: u };
|
|
2568
2747
|
}
|
|
2569
|
-
function
|
|
2570
|
-
let
|
|
2571
|
-
for (;
|
|
2572
|
-
const
|
|
2573
|
-
t[
|
|
2748
|
+
function Et(t, n) {
|
|
2749
|
+
let r = 0, e = t.length;
|
|
2750
|
+
for (; r < e; ) {
|
|
2751
|
+
const i = r + e >>> 1;
|
|
2752
|
+
t[i].end < n ? r = i + 1 : e = i;
|
|
2574
2753
|
}
|
|
2575
|
-
return Math.min(
|
|
2754
|
+
return Math.min(r, Math.max(0, t.length - 1));
|
|
2576
2755
|
}
|
|
2577
|
-
const
|
|
2756
|
+
const Oa = ["data-total-items", "data-rendered-items"], Aa = /* @__PURE__ */ $e({
|
|
2578
2757
|
__name: "VirtualTimeline",
|
|
2579
2758
|
props: {
|
|
2580
2759
|
groups: {},
|
|
@@ -2583,97 +2762,97 @@ const Sa = ["data-total-items", "data-rendered-items"], Pa = /* @__PURE__ */ $e(
|
|
|
2583
2762
|
hasMore: { type: Boolean, default: !1 }
|
|
2584
2763
|
},
|
|
2585
2764
|
emits: ["loadMore", "date"],
|
|
2586
|
-
setup(t, { expose: n, emit:
|
|
2587
|
-
const e = t,
|
|
2588
|
-
() => e.mobile ?
|
|
2589
|
-
), c =
|
|
2590
|
-
const
|
|
2591
|
-
let
|
|
2592
|
-
for (;
|
|
2593
|
-
return
|
|
2594
|
-
}),
|
|
2595
|
-
let S = 0,
|
|
2765
|
+
setup(t, { expose: n, emit: r }) {
|
|
2766
|
+
const e = t, i = r, a = $(), o = $(390), l = $(844), u = $(0), p = V(
|
|
2767
|
+
() => e.mobile ? o.value >= 640 ? 5 : o.value >= 480 ? 4 : 3 : Math.max(1, Math.floor((o.value + 2) / 172))
|
|
2768
|
+
), c = V(() => qa(e.groups, o.value, p.value)), x = V(() => {
|
|
2769
|
+
const k = c.value.rows, m = Et(k, Math.max(0, u.value - c.value.size * 3)), y = u.value + l.value + c.value.size * 3;
|
|
2770
|
+
let P = m;
|
|
2771
|
+
for (; P < k.length && k[P].start <= y; ) P++;
|
|
2772
|
+
return k.slice(m, P);
|
|
2773
|
+
}), L = V(() => x.value.reduce((k, m) => k + m.count, 0));
|
|
2774
|
+
let S = 0, E = !1, w = () => {
|
|
2596
2775
|
};
|
|
2597
|
-
function
|
|
2598
|
-
const
|
|
2599
|
-
|
|
2600
|
-
const m = u.value +
|
|
2601
|
-
m && e.hasMore && !
|
|
2776
|
+
function g() {
|
|
2777
|
+
const k = e.scrollElement();
|
|
2778
|
+
o.value = k.clientWidth, l.value = k.clientHeight, u.value = k.scrollTop, c.value.rows.length > 0 && i("date", e.groups[c.value.rows[Et(c.value.rows, u.value)].group].key);
|
|
2779
|
+
const m = u.value + l.value >= c.value.height - c.value.size * 3;
|
|
2780
|
+
m && e.hasMore && !E && (E = !0, i("loadMore")), m || (E = !1);
|
|
2602
2781
|
}
|
|
2603
|
-
function
|
|
2782
|
+
function B() {
|
|
2604
2783
|
S === 0 && (S = requestAnimationFrame(() => {
|
|
2605
|
-
S = 0,
|
|
2784
|
+
S = 0, g();
|
|
2606
2785
|
}));
|
|
2607
2786
|
}
|
|
2608
|
-
const
|
|
2787
|
+
const O = new ResizeObserver(g);
|
|
2609
2788
|
qe(() => {
|
|
2610
|
-
const
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
},
|
|
2614
|
-
}),
|
|
2615
|
-
e.scrollElement().removeEventListener("scroll",
|
|
2616
|
-
}),
|
|
2789
|
+
const k = e.scrollElement(), m = k.style.overflowAnchor;
|
|
2790
|
+
k.style.overflowAnchor = "none", w = () => {
|
|
2791
|
+
k.style.overflowAnchor = m;
|
|
2792
|
+
}, k.addEventListener("scroll", B, { passive: !0 }), O.observe(k), g();
|
|
2793
|
+
}), Te(() => {
|
|
2794
|
+
e.scrollElement().removeEventListener("scroll", B), O.disconnect(), cancelAnimationFrame(S), w();
|
|
2795
|
+
}), te(
|
|
2617
2796
|
() => e.groups,
|
|
2618
2797
|
() => {
|
|
2619
|
-
|
|
2798
|
+
E = !1, Se(g);
|
|
2620
2799
|
}
|
|
2621
2800
|
);
|
|
2622
|
-
async function
|
|
2623
|
-
if (!c.value.locations.has(
|
|
2624
|
-
const m = c.value.rows[c.value.locations.get(
|
|
2625
|
-
return (m.start <
|
|
2626
|
-
(
|
|
2801
|
+
async function h(k) {
|
|
2802
|
+
if (!c.value.locations.has(k)) return { kind: "unavailable" };
|
|
2803
|
+
const m = c.value.rows[c.value.locations.get(k)], y = e.scrollElement();
|
|
2804
|
+
return (m.start < y.scrollTop || m.end > y.scrollTop + y.clientHeight) && (y.scrollTop = Math.max(0, m.start - (y.clientHeight - c.value.size) / 2)), g(), await Se(), await new Promise((v) => requestAnimationFrame(() => v())), { kind: "element", element: [...a.value.querySelectorAll("[data-id]")].find(
|
|
2805
|
+
(v) => v.dataset.id === k
|
|
2627
2806
|
).querySelector("img") };
|
|
2628
2807
|
}
|
|
2629
|
-
return n({ resolveAnchor:
|
|
2808
|
+
return n({ resolveAnchor: h, rendered: L, total: V(() => c.value.total) }), (k, m) => (q(), _("div", {
|
|
2630
2809
|
ref_key: "root",
|
|
2631
|
-
ref:
|
|
2810
|
+
ref: a,
|
|
2632
2811
|
class: "mp-virtual-timeline",
|
|
2633
|
-
style:
|
|
2812
|
+
style: we({ height: c.value.height + "px" }),
|
|
2634
2813
|
"data-total-items": c.value.total,
|
|
2635
|
-
"data-rendered-items":
|
|
2814
|
+
"data-rendered-items": L.value
|
|
2636
2815
|
}, [
|
|
2637
|
-
(
|
|
2638
|
-
key:
|
|
2816
|
+
(q(!0), _(Fe, null, Ze(x.value, (y) => (q(), _("div", {
|
|
2817
|
+
key: k.groups[y.group].key + ":" + y.kind + ":" + y.first,
|
|
2639
2818
|
class: "mp-timeline-row",
|
|
2640
|
-
style:
|
|
2641
|
-
top:
|
|
2642
|
-
height:
|
|
2643
|
-
display:
|
|
2644
|
-
gridTemplateColumns: `repeat(${
|
|
2819
|
+
style: we({
|
|
2820
|
+
top: y.start + "px",
|
|
2821
|
+
height: y.end - y.start + "px",
|
|
2822
|
+
display: y.kind === "items" ? "grid" : "block",
|
|
2823
|
+
gridTemplateColumns: `repeat(${p.value},minmax(0,1fr))`,
|
|
2645
2824
|
gap: "2px"
|
|
2646
2825
|
})
|
|
2647
2826
|
}, [
|
|
2648
|
-
|
|
2827
|
+
y.kind === "header" ? ut(k.$slots, "header", {
|
|
2649
2828
|
key: 0,
|
|
2650
|
-
group:
|
|
2651
|
-
index:
|
|
2652
|
-
}, void 0, !0) : (
|
|
2653
|
-
key:
|
|
2654
|
-
item:
|
|
2829
|
+
group: k.groups[y.group],
|
|
2830
|
+
index: y.group
|
|
2831
|
+
}, void 0, !0) : (q(!0), _(Fe, { key: 1 }, Ze(k.groups[y.group].items.slice(y.first, y.first + y.count), (P) => ut(k.$slots, "item", {
|
|
2832
|
+
key: P.id,
|
|
2833
|
+
item: P
|
|
2655
2834
|
}, void 0, !0)), 128))
|
|
2656
2835
|
], 4))), 128))
|
|
2657
|
-
], 12,
|
|
2658
|
-
}
|
|
2659
|
-
}),
|
|
2660
|
-
const
|
|
2661
|
-
for (const [e,
|
|
2662
|
-
|
|
2663
|
-
return
|
|
2664
|
-
},
|
|
2836
|
+
], 12, Oa));
|
|
2837
|
+
}
|
|
2838
|
+
}), _a = (t, n) => {
|
|
2839
|
+
const r = t.__vccOpts || t;
|
|
2840
|
+
for (const [e, i] of n)
|
|
2841
|
+
r[e] = i;
|
|
2842
|
+
return r;
|
|
2843
|
+
}, Xa = /* @__PURE__ */ _a(Aa, [["__scopeId", "data-v-05c756fb"]]);
|
|
2665
2844
|
export {
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2845
|
+
pt as ImageCanvasRenderer,
|
|
2846
|
+
Ln as ImageStore,
|
|
2847
|
+
Nn as LivePhotoRenderer,
|
|
2848
|
+
Ya as MediaPreview,
|
|
2849
|
+
ya as PreviewStage,
|
|
2850
|
+
ha as VideoDomRenderer,
|
|
2851
|
+
Xa as VirtualTimeline,
|
|
2852
|
+
Ge as defaultImagePolicy,
|
|
2853
|
+
Ke as defaultImageSource,
|
|
2854
|
+
_e as formatVideoTime,
|
|
2855
|
+
it as nativeVideoSource,
|
|
2856
|
+
$n as previewImageStore,
|
|
2857
|
+
pn as usePreviewViewport
|
|
2679
2858
|
};
|