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