@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.
@@ -1,81 +1,81 @@
1
- var Zt = Object.defineProperty;
2
- var jt = (t, n, o) => n in t ? Zt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[n] = o;
3
- var et = (t, n, o) => jt(t, typeof n != "symbol" ? n + "" : n, o);
4
- import { ref as L, onMounted as qe, watch as ee, onBeforeUnmount as $e, shallowRef as ft, reactive as gt, computed as X, defineComponent as Te, nextTick as Me, openBlock as O, createElementBlock as A, Fragment as Fe, createElementVNode as B, createCommentVNode as le, withModifiers as ae, unref as f, normalizeClass as Ie, normalizeStyle as Le, mergeProps as We, toHandlers as mt, createVNode as De, renderList as Ne, createTextVNode as Kt, toDisplayString as fe, withKeys as tt, createBlock as at, Teleport as Ct, resolveDynamicComponent as Gt, useAttrs as Qt, getCurrentInstance as Jt, withDirectives as en, vShow as tn, renderSlot as ut } from "vue";
5
- function He(t, n) {
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 Lt(t, n, o) {
12
- return Math.hypot(t, n) < 9 ? "pending" : o > 1.01 ? "pan" : Math.abs(t) > Math.abs(n) * 1.1 ? "page" : n > 0 && Math.abs(n) > Math.abs(t) * 1.1 ? "dismiss" : "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 Ft(t, n, o) {
15
- return t > Math.min(o.width, o.height) * 0.14 || t > 16 && n > 0.35;
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 $t() {
17
+ function Bt() {
18
18
  let t = { x: 0, y: 0, time: 0 }, n = { x: 0, y: 0 };
19
19
  return {
20
- reset(o, e) {
21
- t = { ...o, time: e }, n = { x: 0, y: 0 };
20
+ reset(r, e) {
21
+ t = { ...r, time: e }, n = { x: 0, y: 0 };
22
22
  },
23
- move(o, e) {
23
+ move(r, e) {
24
24
  const i = Math.max(8, e - t.time);
25
- n = { x: (o.x - t.x) / i, y: (o.y - t.y) / i }, t = { ...o, time: e };
25
+ n = { x: (r.x - t.x) / i, y: (r.y - t.y) / i }, t = { ...r, time: e };
26
26
  },
27
- read(o) {
28
- return o - t.time < 100 ? n : { x: 0, y: 0 };
27
+ read(r) {
28
+ return r - t.time < 100 ? n : { x: 0, y: 0 };
29
29
  }
30
30
  };
31
31
  }
32
- function nn() {
32
+ function an() {
33
33
  const t = /* @__PURE__ */ new Map();
34
34
  let n = !1;
35
- function o() {
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 o(), a;
40
+ return r(), a;
41
41
  }
42
42
  function i(a) {
43
43
  if (!t.has(a.pointerId)) return;
44
- const l = t.get(a.pointerId);
45
- l.latest = a, l.velocity.move({ x: a.clientX, y: a.clientY }, a.timeStamp);
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: o,
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 l = a.target;
54
- if (l.closest("button, input, a, select")) return;
55
- const r = $t();
56
- r.reset({ x: a.clientX, y: a.clientY }, a.timeStamp), t.set(a.pointerId, { down: a, latest: a, target: l, velocity: r }), n || (n = t.size > 1);
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, l) {
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 && o(), !1;
62
- const r = e();
63
- if (r.kind === "empty") return !1;
64
- const u = a.clientX - r.down.clientX, p = a.clientY - r.down.clientY, d = r.velocity.read(a.timeStamp).y;
65
- return Lt(u, p, 1) === "dismiss" && Ft(p, d, l);
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 _e(t) {
69
+ function Ve(t) {
70
70
  return t instanceof Error ? t : new Error(String(t));
71
71
  }
72
- function an(t) {
73
- let n = 0, o = () => {
72
+ function rn(t) {
73
+ let n = 0, r = () => {
74
74
  };
75
75
  function e() {
76
76
  n += 1;
77
- const a = o;
78
- o = () => {
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, l, r) {
87
+ start(a, o, l) {
88
88
  i();
89
89
  const u = n;
90
- o = r(
90
+ r = l(
91
91
  a,
92
- l,
93
- (p) => {
94
- u === n && t.error(p);
92
+ o,
93
+ (f) => {
94
+ u === n && t.error(f);
95
95
  },
96
- (p) => {
97
- u === n && t.duration(p);
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 it = (t, n) => (t.src = n.videoSrc || n.src, () => {
113
+ const rt = (t, n) => (t.src = n.videoSrc || n.src, () => {
104
114
  t.removeAttribute("src"), t.load();
105
115
  });
106
- function Tt(t, n, o, e, i) {
107
- const a = L(0), l = an(i);
108
- let r = () => {
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
- r = ee(
112
- () => [n().id, n().src, n().videoSrc, o(), e(), a.value],
121
+ l = te(
122
+ () => [n().id, n().src, n().videoSrc, r(), e(), a.value],
113
123
  () => {
114
- o() ? l.start(t(), n(), e()) : l.clear();
124
+ r() ? o.start(t(), n(), e()) : o.clear();
115
125
  },
116
126
  { immediate: !0, flush: "post" }
117
127
  );
118
- }), $e(() => {
119
- r(), l.dispose();
128
+ }), Te(() => {
129
+ l(), o.dispose();
120
130
  }), () => a.value++;
121
131
  }
122
- function Q(t, n, o) {
123
- return Math.min(Math.max(t, n), o);
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 rn(t, n) {
145
+ function ln(t, n) {
136
146
  return n === 90 || n === 270 ? { width: t.height, height: t.width } : t;
137
147
  }
138
- function ln(t, n, o) {
139
- return `translate3d(${wt(t)}px, ${wt(n)}px, 0) scale3d(${o}, ${o}, 1)`;
148
+ function sn(t, n, r) {
149
+ return `translate3d(${wt(t)}px, ${wt(n)}px, 0) scale3d(${r}, ${r}, 1)`;
140
150
  }
141
- function sn(t) {
151
+ function un(t) {
142
152
  return 1 - (1 - t) ** 3;
143
153
  }
144
- const un = 16;
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 o = t < 1 ? 1 : n;
156
+ const r = t < 1 ? 1 : n;
153
157
  if (t >= 1 && t <= n) return t;
154
- const e = Math.abs(t - o), i = o * 0.25;
155
- return o + Math.sign(t - o) * (i * e) / Math.max(Number.EPSILON, i - e);
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 gn(t, n, o = 650) {
170
+ function pn(t, n, r = 650) {
161
171
  let e = { kind: "idle" };
162
172
  function i() {
163
- const l = e;
164
- e = { kind: "idle" }, l.kind === "pending" && clearTimeout(l.timer), l.kind === "active" && n();
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
- }, o)
181
+ }, r)
172
182
  };
173
183
  }
174
184
  return { arm: a, cancel: i };
175
185
  }
176
- function mn(t, n, o) {
177
- const e = Q(t, -n, n);
178
- return { offsetX: e, pageOffset: o ? t - e : 0 };
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 pn(t = {}) {
190
+ function hn(t = {}) {
181
191
  const n = {
182
192
  motionActive: () => !1,
183
193
  onTap: () => {
184
194
  },
185
195
  onDoubleTap: () => {
186
196
  },
187
- onScale: (c) => {
197
+ onScale: (d) => {
188
198
  },
189
- onSwipeDownProgress: (c) => {
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: (c) => {
207
+ onPageDrag: (d) => {
198
208
  },
199
- onPageRelease: (c, T) => {
200
- Math.abs(c) < 60 || (c < 0 ? n.onSwipeLeft() : n.onSwipeRight());
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: () => un,
215
+ zoomLimit: () => cn,
206
216
  holdable: () => !1,
207
217
  onHoldStart: () => {
208
218
  },
209
219
  onHoldEnd: () => {
210
220
  },
211
221
  ...t
212
- }, o = L(), e = L(), i = ft(), a = L({ width: 1, height: 1 }), l = L({ width: 1, height: 1 }), r = gt({
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 = X(() => rn(l.value, r.rotation)), p = X(() => on(u.value, a.value)), d = X(() => p.value * r.level), S = X(() => ({
223
- width: u.value.width * d.value,
224
- height: u.value.height * d.value
225
- })), C = X(() => ({
226
- transform: ln(r.downOffsetX, r.downOffsetY, r.downScale)
227
- })), P = /* @__PURE__ */ new Set(), R = L(!1), x = L(!1), m = L(!1), F = X(
228
- () => R.value || x.value || m.value || n.motionActive()
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 q, v = 0, k = 0, g = setTimeout(() => {
231
- }, 0), w = -1e3, E = { x: 0, y: 0 }, y = !1, h = "idle", $ = !0, D = !1, I = 0;
232
- const H = /* @__PURE__ */ new Map();
233
- let Z = { x: 0, y: 0 };
234
- const J = $t();
235
- let ie = 0, Ee = { left: 0, top: 0 }, oe = 1, se = 1, ce = { x: 0, y: 0 }, de = he();
236
- const z = gn(
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
- h = "hold", clearTimeout(g), w = -1e3, n.onHoldStart();
248
+ $ = "hold", clearTimeout(m), k = -1e3, n.onHoldStart();
239
249
  },
240
250
  () => n.onHoldEnd()
241
- ), V = new ResizeObserver((c) => {
242
- for (const T of c) ge(T.contentRect);
243
- }), _ = /* @__PURE__ */ new Set(), Oe = (c) => {
244
- (c.key === "Control" || c.key === "Meta") && _.add(c.key);
245
- }, Ge = (c) => _.delete(c.key), te = () => {
246
- z.cancel(), _.clear();
247
- }, pe = () => {
248
- document.hidden && z.cancel();
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
- V.observe(o.value), ge(o.value.getBoundingClientRect()), window.addEventListener("keydown", Oe), window.addEventListener("keyup", Ge), window.addEventListener("blur", te), document.addEventListener("visibilitychange", pe);
252
- }), $e(() => {
253
- y = !0, z.cancel(), window.removeEventListener("keydown", Oe), window.removeEventListener("keyup", Ge), window.removeEventListener("blur", te), document.removeEventListener("visibilitychange", pe), V.disconnect(), cancelAnimationFrame(v), cancelAnimationFrame(k), clearTimeout(g), clearTimeout(q);
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 ge(c) {
256
- a.value = { width: c.width, height: c.height }, Object.assign(r, K(r.offsetX, r.offsetY, r.level)), be();
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 be() {
259
- y || v || (v = requestAnimationFrame(() => {
260
- v = 0, P.forEach((c) => c());
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: r.level, offsetX: r.offsetX, offsetY: r.offsetY };
274
+ return { level: l.level, offsetX: l.offsetX, offsetY: l.offsetY };
265
275
  }
266
- function K(c, T, Y) {
276
+ function K(d, I, X) {
267
277
  const j = Math.max(
268
278
  0,
269
- (u.value.width * p.value * Y - a.value.width) / 2
270
- ), N = Math.max(
279
+ (u.value.width * f.value * X - a.value.width) / 2
280
+ ), Z = Math.max(
271
281
  0,
272
- (u.value.height * p.value * Y - a.value.height) / 2
282
+ (u.value.height * f.value * X - a.value.height) / 2
273
283
  );
274
- return { offsetX: Q(c, -j, j), offsetY: Q(T, -N, N) };
275
- }
276
- function ke(c) {
277
- Object.assign(r, c), n.onScale(r.level), be();
278
- }
279
- function re(c, T = 250) {
280
- cancelAnimationFrame(k), R.value = !0;
281
- const Y = he(), j = performance.now(), N = matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : T, G = (we) => {
282
- const xe = N === 0 ? 1 : Q((we - j) / N, 0, 1), Ce = sn(xe);
283
- ke({
284
- level: Y.level + (c.level - Y.level) * Ce,
285
- offsetX: Y.offsetX + (c.offsetX - Y.offsetX) * Ce,
286
- offsetY: Y.offsetY + (c.offsetY - Y.offsetY) * Ce
287
- }), xe < 1 ? k = requestAnimationFrame(G) : R.value = !1;
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
- k = requestAnimationFrame(G);
299
+ b = requestAnimationFrame(Q);
290
300
  }
291
- function me() {
301
+ function fe() {
292
302
  return { x: a.value.width / 2, y: a.value.height / 2 };
293
303
  }
294
- function ve(c, T = me(), Y = !1) {
304
+ function ve(d, I = fe(), X = !1) {
295
305
  if (!n.zoomable()) return;
296
- cancelAnimationFrame(k), R.value = !1;
297
- const j = Q(c, 1, n.zoomLimit()), N = j / r.level, G = me(), we = K(
298
- T.x - G.x - (T.x - G.x - r.offsetX) * N,
299
- T.y - G.y - (T.y - G.y - r.offsetY) * N,
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
- ), xe = { level: j, ...we };
302
- Y ? re(xe) : ke(xe);
311
+ ), Me = { level: j, ...we };
312
+ X ? se(Me) : xe(Me);
303
313
  }
304
- function Se() {
305
- r.draggingDown = !1, r.downOffsetX = 0, r.downOffsetY = 0, r.downScale = 1, n.onSwipeDownProgress(0);
314
+ function Ee() {
315
+ l.draggingDown = !1, l.downOffsetX = 0, l.downOffsetY = 0, l.downScale = 1, n.onSwipeDownProgress(0);
306
316
  }
307
- function ye(c = !1) {
308
- c && (cancelAnimationFrame(k), R.value = !1), z.cancel(), H.clear(), x.value = !1, m.value = !1, clearTimeout(q), h = "idle", I = 0, r.zooming = !1, c || (Se(), n.onPageDrag(0)), clearTimeout(g), w = -1e3;
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(c = 0) {
311
- cancelAnimationFrame(k), R.value = !1, ye();
312
- const T = { level: 1, offsetX: 0, offsetY: 0 };
313
- c > 0 && (r.level !== 1 || r.offsetX !== 0 || r.offsetY !== 0) ? re(T, c) : ke(T);
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 Pe(c, T = Ee) {
316
- return { x: c.clientX - T.left, y: c.clientY - T.top };
325
+ function Re(d, I = ie) {
326
+ return { x: d.clientX - I.left, y: d.clientY - I.top };
317
327
  }
318
- function ze() {
319
- z.cancel(), $ = !1, D = !1, I = 0;
320
- const [c, T] = [...H.values()];
321
- oe = dn(r.level, n.zoomLimit()), se = Math.max(1, He(c, T)), ce = yt(c, T), de = he(), h = "pinch", r.zooming = !0, Se(), n.onPageDrag(0), clearTimeout(g), w = -1e3;
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 Ae(c, T = o.value.getBoundingClientRect(), Y = c.target) {
324
- if (!n.interactive() || c.pointerType === "mouse" && c.button !== 0 || Y.closest("button, input, a, select") || Y instanceof HTMLVideoElement && Y.controls && c.clientY > Y.getBoundingClientRect().bottom - 48)
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(k), R.value = !1, x.value = !0, H.size === 0 && (Ee = T), H.set(c.pointerId, Pe(c)), o.value.setPointerCapture(c.pointerId), H.size >= 2)
327
- return ze(), !0;
328
- Z = Pe(c), ie = performance.now(), J.reset(Z, c.timeStamp), de = he(), h = "pending", $ = !0, D = !1, I = 0;
329
- const j = S.value.width / 2, N = S.value.height / 2, G = me();
330
- return n.holdable() && Math.abs(Z.x - G.x - r.offsetX) <= j && Math.abs(Z.y - G.y - r.offsetY) <= N && (clearTimeout(g), z.arm()), !0;
331
- }
332
- function ot(c) {
333
- if (!H.has(c.pointerId)) return;
334
- const T = Pe(c);
335
- if (H.set(c.pointerId, T), h === "pinch" && H.size >= 2) {
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 [N, G] = [...H.values()], we = me(), xe = yt(N, G);
338
- oe *= Math.max(1, He(N, G)) / se;
339
- const Ce = cn(oe, n.zoomLimit()), Qe = Ce / de.level;
340
- ke({
341
- level: Ce,
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
- xe.x - we.x - (ce.x - we.x - de.offsetX) * Qe,
344
- xe.y - we.y - (ce.y - we.y - de.offsetY) * Qe,
345
- Ce
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
- }), de = he(), se = Math.max(1, He(N, G)), ce = xe, c.preventDefault();
357
+ }), ne = he(), le = Math.max(1, Ne(Z, Q)), Pe = Me, d.preventDefault();
348
358
  return;
349
359
  }
350
- if (h === "idle") return;
351
- const Y = T.x - Z.x, j = T.y - Z.y;
352
- if (h === "hold") {
353
- if (c.preventDefault(), Math.hypot(Y, j) < 9) return;
354
- z.cancel(), h = "pending";
355
- }
356
- if (Math.hypot(Y, j) >= 9 && z.cancel(), J.move(T, c.timeStamp), h === "pending" && (h = Lt(Y, j, r.level), D = h === "pan" && $ && Math.abs(Y) > Math.abs(j) * 1.1), h !== "pending")
357
- if (clearTimeout(g), w = -1e3, c.preventDefault(), h === "pan") {
358
- const N = Math.max(0, (S.value.width - a.value.width) / 2), G = mn(de.offsetX + Y, N, D);
359
- ke({ level: r.level, ...K(G.offsetX, de.offsetY + j, r.level) }), G.pageOffset !== I && (I = G.pageOffset, n.onPageDrag(I));
360
- } else h === "page" ? n.onPageDrag(Y) : h === "dismiss" && (r.draggingDown = !0, r.downOffsetX = Y * 0.65, r.downOffsetY = Math.max(0, j), r.downScale = Q(1 - Math.max(0, j) / a.value.height * 0.6, 0.65, 1), n.onSwipeDownProgress(Q(j / (a.value.height * 0.55), 0, 0.85)));
361
- }
362
- function rt(c) {
363
- if (!H.has(c.pointerId)) return;
364
- if (z.cancel(), H.delete(c.pointerId), x.value = H.size > 0, h === "pinch") {
365
- H.size > 0 ? (Z = [...H.values()][0], de = he(), h = "pan") : (h = "idle", r.zooming = !1, ve(Math.max(1, r.level), me(), !0));
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 (H.size > 0) return;
369
- const T = Pe(c), Y = T.x - Z.x, j = T.y - Z.y, N = J.read(c.timeStamp);
370
- h === "page" || h === "pan" && I !== 0 ? n.onPageRelease(h === "page" ? Y : I, N.x) : h === "dismiss" ? Ft(j, N.y, a.value) ? n.onSwipeDownClose() : Se() : h === "pending" && performance.now() - ie < 300 && He(Z, T) < 9 ? st(T) : (r.level < 1 || r.level > n.zoomLimit()) && ve(r.level, me(), !0), r.zooming = !1, h = "idle";
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 lt(c) {
373
- if (!H.has(c.pointerId)) return;
374
- const T = h === "page" || h === "pan" && I !== 0;
375
- ye(), T && n.onPageRelease(0, 0), (r.level < 1 || r.level > n.zoomLimit()) && ve(r.level, me(), !0);
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 st(c) {
378
- const T = performance.now();
379
- T - w < 280 && He(c, E) < 36 ? (clearTimeout(g), w = -1e3, n.onDoubleTap(), ve(r.level > 1.01 ? 1 : n.doubleTapZoom(), c, !0)) : (w = T, E = c, g = setTimeout(n.onTap, 280));
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 W(c) {
391
+ function N(d) {
382
392
  if (n.interactive()) {
383
- if (z.cancel(), m.value = !0, clearTimeout(q), q = setTimeout(() => {
384
- m.value = !1;
385
- }, 120), c.ctrlKey || c.metaKey)
386
- c.preventDefault(), ve(
387
- r.level * fn(c, _.size > 0),
388
- Pe(c, o.value.getBoundingClientRect())
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 (r.level > 1) {
391
- c.preventDefault();
392
- const T = c.deltaMode === 1 ? 16 : 1;
393
- ke({
394
- level: r.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
- r.offsetX - c.deltaX * T,
397
- r.offsetY - c.deltaY * T,
398
- r.level
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 Ye = {
405
- state: r,
406
- motionActive: F,
407
- containerRef: o,
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: l,
421
+ mediaSize: o,
412
422
  visualMediaSize: u,
413
- displaySize: S,
414
- displayScale: d,
415
- downDragStyle: C,
416
- requestRender: be,
417
- renderNow: () => P.forEach((c) => c()),
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(c) {
422
- i.value = c, c instanceof HTMLVideoElement && be();
431
+ setMediaElement(d) {
432
+ i.value = d, d instanceof HTMLVideoElement && ke();
423
433
  },
424
- setMediaSize(c) {
425
- l.value = c, be();
434
+ setMediaSize(d) {
435
+ o.value = d, ke();
426
436
  },
427
437
  clearMedia() {
428
438
  i.value = void 0;
429
439
  },
430
- registerRenderHandler(c) {
431
- return P.add(c), () => P.delete(c);
440
+ registerRenderHandler(d) {
441
+ return y.add(d), () => y.delete(d);
432
442
  },
433
- setRotation(c, T = !0) {
434
- r.rotation = bt(c), T && Be(), be();
443
+ setRotation(d, I = !0) {
444
+ l.rotation = bt(d), I && Be(), ke();
435
445
  },
436
- rotateBy(c = 90) {
437
- Ye.setRotation(bt(r.rotation + c));
446
+ rotateBy(d = 90) {
447
+ He.setRotation(bt(l.rotation + d));
438
448
  }
439
449
  };
440
- return { core: Ye, onPointerDown: Ae, onPointerMove: ot, onPointerUp: rt, onPointerCancel: lt, onWheel: W };
450
+ return { core: He, onPointerDown: Oe, onPointerMove: ot, onPointerUp: lt, onPointerCancel: st, onWheel: N };
441
451
  }
442
- function hn(t) {
443
- const n = t.rotation * Math.PI / 180, o = Math.round(Math.cos(n)), e = Math.round(Math.sin(n)), i = t.size.width / 2 - o * t.offsetX - e * t.offsetY, a = t.size.height / 2 + e * t.offsetX - o * t.offsetY, l = (Math.abs(o) * t.viewport.width + Math.abs(e) * t.viewport.height) / 2, r = (Math.abs(e) * t.viewport.width + Math.abs(o) * t.viewport.height) / 2, u = Q(i - l, 0, t.size.width), p = Q(a - r, 0, t.size.height);
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: p,
447
- width: Q(i + l, 0, t.size.width) - u,
448
- height: Q(a + r, 0, t.size.height) - p
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 vn(t, n, o, e) {
452
- const i = hn(o);
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
- o.viewport.width / 2 + o.offsetX,
456
- o.viewport.height / 2 + o.offsetY
457
- ), t.rotate(o.rotation * Math.PI / 180);
458
- const { width: a, height: l } = o.size, r = "naturalWidth" in n ? n.naturalWidth : n.width, u = "naturalHeight" in n ? n.naturalHeight : n.height;
459
- if (i.width === a && i.height === l) {
460
- t.drawImage(n, -a / 2, -l / 2, a, l);
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 * r,
466
- i.y / l * u,
467
- i.width / a * r,
468
- i.height / l * u,
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 - l / 2,
480
+ i.y - o / 2,
471
481
  i.width,
472
482
  i.height
473
483
  );
474
484
  }
475
- function yn() {
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 o = /* @__PURE__ */ new Map();
520
+ const r = /* @__PURE__ */ new Map();
479
521
  let e = { kind: "empty" };
480
522
  function i() {
481
523
  for (const a of t)
482
- o.has(a) || n.includes(a) || e.kind === "owned" && e.lease === a || (a.release(), t.delete(a));
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((l) => t.add(l)), i();
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
- o.set(a, o.has(a) ? o.get(a) + 1 : 1);
496
- let l = !1;
537
+ r.set(a, r.has(a) ? r.get(a) + 1 : 1);
538
+ let o = !1;
497
539
  return () => {
498
- if (l) return;
499
- l = !0;
500
- const r = o.get(a) - 1;
501
- r === 0 ? o.delete(a) : o.set(a, r), i();
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 ue = {
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 Ze extends Error {
564
+ class Ge extends Error {
523
565
  constructor(n) {
524
566
  super(n), this.name = "ImageLimitError";
525
567
  }
526
568
  }
527
- function Bt(t, n) {
569
+ function zt(t, n) {
528
570
  if (t.naturalWidth * t.naturalHeight > n)
529
- throw new Ze("图片像素超过解码保护限制,请提供较小的适屏资源");
571
+ throw new Ge("图片像素超过解码保护限制,请提供较小的适屏资源");
530
572
  }
531
- const ct = "原图超过资源限制";
532
- function wn(t) {
533
- return t instanceof Ze ? { status: "blocked", reason: ct } : {
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 zt = `(function(){"use strict";self.onmessage=async({data:a})=>{try{const t=await createImageBitmap(a.blob);let e=t;try{const s=Math.min(1,Math.sqrt(a.maxMotionPixels/(t.width*t.height)));s<1&&(e=await createImageBitmap(t,{resizeWidth:Math.max(1,Math.floor(t.width*s)),resizeHeight:Math.max(1,Math.floor(t.height*s)),resizeQuality:"high"}));const r=e===t?[t]:[t,e];self.postMessage({status:"ready",full:t,motion:e},{transfer:r})}catch(s){throw e!==t&&e.close(),t.close(),s}}catch(t){self.postMessage({status:"error",message:t instanceof Error?t.message:"图片位图准备失败"})}}})();
539
- `, kt = typeof self < "u" && self.Blob && new Blob([zt], { type: "text/javascript;charset=utf-8" });
540
- function bn(t) {
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 o = new Worker(n, {
586
+ const r = new Worker(n, {
545
587
  name: t == null ? void 0 : t.name
546
588
  });
547
- return o.addEventListener("error", () => {
589
+ return r.addEventListener("error", () => {
548
590
  (self.URL || self.webkitURL).revokeObjectURL(n);
549
- }), o;
591
+ }), r;
550
592
  } catch {
551
593
  return new Worker(
552
- "data:text/javascript;charset=utf-8," + encodeURIComponent(zt),
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 dt({ full: t, motion: n }) {
603
+ function ft({ full: t, motion: n }) {
562
604
  n !== t && n.close(), t.close();
563
605
  }
564
- function kn(t, n, o) {
565
- return o.throwIfAborted(), new Promise((e, i) => {
566
- const a = new bn(), l = () => {
567
- o.removeEventListener("abort", r), a.terminate();
568
- }, r = () => {
569
- l(), i(o.reason);
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 (l(), u.status === "error") {
614
+ if (o(), u.status === "error") {
573
615
  i(new Error(u.message));
574
616
  return;
575
617
  }
576
- if (o.aborted) {
577
- dt(u), i(o.reason);
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
- l(), i(new Error(u.message || "图片位图准备失败"));
583
- }, o.addEventListener("abort", r, { once: !0 });
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
- l(), i(u);
629
+ o(), i(u);
588
630
  }
589
631
  });
590
632
  }
591
- function Dt(t) {
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 xn(t, n, o) {
602
- const e = new Uint8Array(await n.slice(0, 3).arrayBuffer());
603
- if (o.throwIfAborted(), !(e[0] === 255 && e[1] === 216 && e[2] === 255))
604
- return await t.decode(), o.throwIfAborted(), Dt(t);
605
- const i = await kn(n, ue.maxCanvasPixels, o);
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
- o.throwIfAborted();
608
- const { full: a, motion: l } = i, r = l === a ? 0 : l.width * l.height * 4;
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: l,
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 + r,
615
- dispose: () => dt(i)
672
+ bytes: (t.naturalWidth * t.naturalHeight + a.width * a.height) * 4 + l,
673
+ dispose: () => ft(i)
616
674
  };
617
675
  } catch (a) {
618
- throw dt(i), a;
676
+ throw ft(i), a;
619
677
  }
620
678
  }
621
- const Mn = async (t, n) => {
622
- const o = await fetch(t, { signal: n.signal, credentials: "same-origin" });
623
- if (!o.ok) throw new Error(`图片加载失败:HTTP ${o.status}`);
624
- if (Number(o.headers.get("content-length")) > n.maxBytes)
625
- throw await o.body.cancel(), new Ze("资源超过下载保护限制,请使用适屏图或下载原文件");
626
- const i = o.body.getReader(), a = [];
627
- let l = 0;
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 d = await i.read();
631
- if (d.done) break;
632
- if (l += d.value.byteLength, l > n.maxBytes)
633
- throw new Ze("资源超过下载保护限制,请使用适屏图或下载原文件");
634
- a.push(new Uint8Array(d.value));
635
- }
636
- } catch (d) {
637
- throw await i.cancel(), d;
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 r = new Blob(a, { type: o.headers.get("content-type") }), u = URL.createObjectURL(r), p = new Image();
643
- p.decoding = "async";
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((d, S) => {
646
- const C = () => {
647
- p.removeAttribute("src"), S(new DOMException("请求已取消", "AbortError"));
703
+ return await new Promise((c, P) => {
704
+ const x = () => {
705
+ f.removeAttribute("src"), P(new DOMException("请求已取消", "AbortError"));
648
706
  };
649
- p.onload = () => {
650
- n.signal.removeEventListener("abort", C), d();
651
- }, p.onerror = () => {
652
- n.signal.removeEventListener("abort", C), S(new Error("图片解码失败或格式不受支持"));
653
- }, n.signal.addEventListener("abort", C, { once: !0 }), p.src = u;
654
- }), n.signal.throwIfAborted(), Bt(p, n.maxPixels), await xn(p, r, n.signal);
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 Sn {
660
- constructor(n = ue.cacheBytes, o = ue.concurrency, e = Mn) {
661
- et(this, "entries", /* @__PURE__ */ new Map());
662
- et(this, "active", 0);
663
- et(this, "cancelled", 0);
664
- this.budget = n, this.concurrency = o, this.loader = e;
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, o) => n + o.bytes, 0),
729
+ bytes: [...this.entries.values()].reduce((n, r) => n + r.bytes, 0),
672
730
  cancelled: this.cancelled
673
731
  };
674
732
  }
675
- acquire(n, o = {}) {
733
+ acquire(n, r = {}) {
676
734
  const e = {
677
735
  priority: 0,
678
- maxBytes: ue.maxOriginalBytes,
679
- maxPixels: ue.maxDecodedPixels,
680
- ...o
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, p;
684
- const d = new Promise((S, C) => {
685
- u = S, p = C;
741
+ let u, f;
742
+ const c = new Promise((P, x) => {
743
+ u = P, f = x;
686
744
  });
687
- d.catch(() => {
745
+ c.catch(() => {
688
746
  }), this.entries.set(n, {
689
- promise: d,
747
+ promise: c,
690
748
  resolve: u,
691
- reject: p,
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 l = i.promise.then((u) => (Bt(u.image, e.maxPixels), u)), r = l.then((u) => u.image);
707
- return l.catch(() => {
708
- }), r.catch(() => {
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: r,
711
- resource: l,
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 [o, e] = n[0];
722
- e.state = "loading", this.active++, this.loader(o, {
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(_e(i)));
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 [o, e] of this.entries)
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 <= ue.cacheEntries) break;
748
- n -= e.bytes, e.dispose(), this.entries.delete(o);
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 Pn = new Sn(), Re = { kind: "empty" };
753
- function Rn(t) {
754
- return t.kind === "element" && t.element instanceof HTMLImageElement && t.element.complete && t.element.naturalWidth > 0 ? { kind: "image", image: t.element } : Re;
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 It = ["thumbnail", "screen", "full"], je = {
763
- maxOriginalPixels: ue.maxDecodedPixels,
764
- maxOriginalBytes: ue.maxOriginalBytes,
765
- maxPreviewBytes: ue.maxPreviewBytes
766
- }, Ke = (t, n) => n === "full" ? t.src : n === "screen" ? t.previewSrc : t.thumbnail;
767
- function En(t, n) {
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 Cn(t, n) {
771
- const o = Math.min(n.width / t.width, n.height / t.height);
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 / o,
778
- Math.max(n.width / (t.width * o), n.height / (t.height * o))
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 Ln(t, n, o, e, i, a = !0) {
784
- const l = En(t, o), r = {
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" ? l ? "loading" : "blocked" : "idle",
844
+ originalStatus: a && n === "full" ? o ? "loading" : "blocked" : "idle",
787
845
  originalReason: ""
788
846
  };
789
- r.originalStatus === "blocked" && (r.originalReason = ct);
790
- for (const [u, p] of It.entries()) {
791
- if (p === "screen" && n === "thumbnail" || p === "full" && (!a || n !== "full" || !l))
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 d = e(t, p, i);
794
- if (a && !l && d === t.src) {
795
- r.originalStatus = "blocked", r.originalReason = ct;
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
- r.sources.push({ url: d, quality: p, rank: u });
856
+ l.sources.push({ url: c, quality: f, rank: u });
799
857
  }
800
- return r;
858
+ return l;
801
859
  }
802
- const Fn = ["aria-label"], $n = {
803
- key: 0,
860
+ const zn = ["aria-label"], Dn = {
861
+ key: 1,
804
862
  class: "mp-resource-state",
805
863
  role: "status",
806
864
  "aria-label": "加载中"
807
- }, Tn = /* @__PURE__ */ B("span", {
865
+ }, An = /* @__PURE__ */ T("span", {
808
866
  class: "mp-spinner",
809
867
  "aria-hidden": "true"
810
- }, null, -1), Bn = [
811
- Tn
812
- ], zn = {
813
- key: 1,
868
+ }, null, -1), On = [
869
+ An
870
+ ], _n = {
871
+ key: 2,
814
872
  class: "mp-resource-state",
815
873
  role: "alert"
816
- }, Dn = /* @__PURE__ */ B("span", null, "图片暂时无法加载", -1), In = {
817
- key: 2,
874
+ }, Vn = /* @__PURE__ */ T("span", null, "图片暂时无法加载", -1), Un = {
875
+ key: 3,
818
876
  class: "mp-quality-notice"
819
- }, pt = /* @__PURE__ */ Te({
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: () => je },
832
- resolveSource: { type: Function, default: Ke },
833
- initialImage: { default: () => Re }
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: o }) {
837
- const e = t, i = o, a = L(), l = ft({ status: "empty" }), r = L("loading"), u = L(!1), p = L("idle"), d = L("");
838
- ee(
839
- [p, d],
840
- () => i("originalState", p.value, d.value)
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 S = !0, C = 0, P = e.media.id;
843
- const R = yn();
844
- let x = () => {
845
- }, m, F = !1, q = { kind: "empty" };
846
- function v() {
847
- if (e.core.motionActive.value && e.loadEnabled && P === e.media.id) {
848
- F = !0;
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
- F = !1, w();
916
+ D = !1, C();
852
917
  }
853
- function k(h, $, D, I) {
854
- l.value = { status: "ready", value: h, rank: D }, R.display($), e.core.setMediaElement(h.image), r.value = "ready", u.value = !1, I === "full" && (p.value = "ready"), e.core.requestRender(), i("ready", I);
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
- ee(
921
+ te(
857
922
  () => e.core.motionActive.value,
858
- (h) => {
859
- if (e.core.requestRender(), !h) {
860
- if (q.kind === "ready") {
861
- const $ = q;
862
- q = { kind: "empty" }, $.token === C && k($.value, $.lease, $.rank, $.quality);
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
- F && v();
929
+ D && b();
865
930
  }
866
931
  }
867
932
  ), qe(() => {
868
- const h = a.value;
869
- m = h.getContext("2d"), e.core.canvasRef.value = h, x = e.core.registerRenderHandler(E), g(), Me(() => {
870
- S && v();
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
- }), $e(() => {
873
- S = !1, C += 1, x(), R.dispose();
874
- }), ee(
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
- v();
954
+ b();
890
955
  }
891
- ), ee(() => e.initialImage, g), ee(
956
+ ), te(() => e.initialImage, k), te(
892
957
  () => e.rendering,
893
- (h) => {
894
- h && e.core.requestRender();
958
+ (z) => {
959
+ z && e.core.requestRender();
895
960
  }
896
961
  );
897
- function g() {
898
- e.initialImage.kind !== "image" || l.value.status === "ready" || (l.value = {
962
+ function k() {
963
+ e.initialImage.kind !== "image" || o.value.status === "ready" || (o.value = {
899
964
  status: "ready",
900
- value: Dt(e.initialImage.image),
965
+ value: At(e.initialImage.image),
901
966
  rank: 0
902
- }, e.core.setMediaElement(e.initialImage.image), r.value = "ready", e.core.requestRender(), i("ready", "thumbnail"));
967
+ }, e.core.setMediaElement(e.initialImage.image), u.value = "ready", e.core.requestRender(), i("ready", "thumbnail"));
903
968
  }
904
- async function w() {
905
- const h = ++C;
906
- if (q = { kind: "empty" }, u.value = !1, P !== e.media.id && (P = e.media.id, l.value = { status: "empty" }, R.clearDisplay(), r.value = "loading", e.core.clearMedia(), g()), !e.loadEnabled) {
907
- R.replace([]);
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 $ = Math.ceil(
911
- e.core.viewportSize.value.width * Math.min(devicePixelRatio, ue.maxDevicePixelRatio) * e.core.state.level
912
- ), D = Ln(
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
- d.value = D.originalReason, p.value = D.originalStatus;
921
- const { sources: I } = D, H = I.map(
922
- (ie) => Pn.acquire(ie.url, {
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
- R.replace(H), I.length === 0 && l.value.status === "empty" && (r.value = "error", i("error", new Ze(d.value))), l.value.status === "ready" && i("ready", It[l.value.rank]);
929
- let Z = l.value.status === "ready" ? l.value.rank : -1, J = 0;
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
- I.map(async (ie, Ee) => {
932
- const oe = ie.rank, se = H[Ee];
996
+ q.map(async (ie, pe) => {
997
+ const le = ie.rank, Pe = U[pe];
933
998
  try {
934
- const ce = await se.resource;
935
- if (h !== C || oe < Z) return;
936
- Z = oe, e.core.motionActive.value && l.value.status === "ready" ? q = {
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: h,
939
- value: ce,
940
- lease: se,
941
- rank: oe,
1003
+ token: z,
1004
+ value: ne,
1005
+ lease: Pe,
1006
+ rank: le,
942
1007
  quality: ie.quality
943
- } : k(ce, se, oe, ie.quality);
944
- } catch (ce) {
945
- if (h !== C || ce instanceof Error && ce.name === "AbortError") return;
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 de = wn(ce);
948
- p.value = de.status, d.value = de.reason;
1012
+ const A = Mn(ne);
1013
+ c.value = A.status, P.value = A.reason;
949
1014
  }
950
- J += 1, oe > Z && l.value.status === "ready" && (u.value = !0), J === I.length && l.value.status === "empty" && (r.value = "error"), i("error", _e(ce));
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 E() {
956
- if (!e.rendering || l.value.status !== "ready") return;
957
- const h = a.value, $ = e.core.viewportSize.value;
958
- if ($.width <= 0 || $.height <= 0) return;
959
- const D = Math.min(
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
- ue.maxDevicePixelRatio,
962
- Math.sqrt(ue.maxCanvasPixels / ($.width * $.height))
963
- ), I = Math.max(1, Math.round($.width * D)), H = Math.max(1, Math.round($.height * D));
964
- (h.width !== I || h.height !== H) && (h.width = I, h.height = H), m.setTransform(D, 0, 0, D, 0, 0), m.clearRect(0, 0, $.width, $.height);
965
- const { width: Z, height: J } = e.core.mediaSize.value, ie = e.core.displayScale.value;
966
- vn(
967
- m,
968
- e.core.motionActive.value ? l.value.value.motionSource : l.value.value.source,
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: Z * ie, height: J * ie },
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 y() {
980
- if (l.value.status !== "ready") throw new Error("图片画面尚未就绪");
981
- return { image: l.value.value.motionSource, scale: 1 };
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: y,
1049
+ captureFrame: $,
985
1050
  retainFrame: () => ({
986
- ...y(),
987
- release: R.retainDisplay()
1051
+ ...$(),
1052
+ release: w.retainDisplay()
988
1053
  })
989
- }), (h, $) => (O(), A(Fe, null, [
990
- B("canvas", {
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": h.media.title
995
- }, null, 8, Fn),
996
- r.value === "loading" ? (O(), A("div", $n, Bn)) : le("", !0),
997
- r.value === "error" ? (O(), A("div", zn, [
998
- Dn,
999
- B("button", {
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(w, ["stop"])
1073
+ onClick: ae(C, ["stop"])
1002
1074
  }, "重新加载")
1003
- ])) : le("", !0),
1004
- u.value && p.value !== "blocked" ? (O(), A("span", In, " 高清图加载失败,当前显示预览图 ")) : le("", !0)
1075
+ ])) : J("", !0),
1076
+ f.value && c.value !== "blocked" ? (O(), _("span", Un, " 高清图加载失败,当前显示预览图 ")) : J("", !0)
1005
1077
  ], 64));
1006
1078
  }
1007
1079
  });
1008
- function qn(t, n, o) {
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 l = 0; l < e.length; l++) {
1013
- const r = Q(e.start(l), 0, n);
1014
- let u = Q(e.end(l), r, n);
1015
- l === e.length - 1 && (t.ended || o.kind === "retained" && e.end(l) >= o.end || t.readyState >= 4 && n - u <= a) && (u = n), u > r && i.push({ start: r, end: u });
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 Ve(t) {
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 On() {
1101
+ function Hn() {
1030
1102
  let t = 0, n = { kind: "pending" };
1031
1103
  return {
1032
- setDuration(o) {
1033
- t = Mt(o);
1104
+ setDuration(r) {
1105
+ t = Mt(r);
1034
1106
  },
1035
- complete(o) {
1036
- const { buffered: e } = o;
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(o, e) {
1043
- const i = t > 0 ? t : Mt(o.duration), a = qn(o, i, n);
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 : Q(o.currentTime, 0, 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 qt(t, n) {
1054
- const o = On(), e = gt({
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, l = !1;
1065
- const r = X(() => e.duration > 0 && e.status !== "error"), u = X(() => e.scrubbing ? e.scrubTime : e.time), p = X(() => r.value ? u.value / e.duration * 100 : 0), d = X(
1066
- () => r.value ? e.buffered / e.duration * 100 : 0
1067
- ), S = X(
1068
- () => e.bufferedRanges.map(({ start: D, end: I }) => ({
1069
- left: D / e.duration * 100,
1070
- width: (I - D) / e.duration * 100
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 C() {
1074
- Object.assign(e, o.read(t(), e.ended));
1145
+ function x() {
1146
+ Object.assign(e, r.read(t(), e.ended));
1075
1147
  }
1076
- function P(D) {
1077
- l || (o.setDuration(D), C(), e.scrubTime = Q(e.scrubTime, 0, e.duration));
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
- o.reset(), i = !1, a += 1, Object.assign(e, {
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 x() {
1091
- if (l) return;
1092
- const D = ++a;
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 (I) {
1097
- if (D !== a) return;
1098
- e.buffering = !1, e.playing = !1, I instanceof Error && I.name !== "NotAllowedError" && I.name !== "AbortError" && n(I);
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 m() {
1173
+ function g() {
1102
1174
  a += 1, i = !1, e.scrubbing = !1, e.buffering = !1, t().pause();
1103
1175
  }
1104
- function F() {
1105
- e.playing ? m() : x();
1176
+ function M() {
1177
+ e.playing ? g() : w();
1106
1178
  }
1107
- function q() {
1108
- !r.value || e.scrubbing || (i = e.playing, e.scrubbing = !0, e.scrubTime = e.time, t().pause());
1179
+ function D() {
1180
+ !l.value || e.scrubbing || (i = e.playing, e.scrubbing = !0, e.scrubTime = e.time, t().pause());
1109
1181
  }
1110
- function v(D) {
1111
- e.scrubTime = Q(D, 0, e.duration);
1182
+ function h(F) {
1183
+ e.scrubTime = ee(F, 0, e.duration);
1112
1184
  }
1113
- function k(D = !0) {
1185
+ function b(F = !0) {
1114
1186
  if (!e.scrubbing) return;
1115
- const I = i;
1116
- i = !1, e.scrubbing = !1, D && (t().currentTime = e.scrubTime, e.time = e.scrubTime, e.ended = !1), I && x();
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 g() {
1190
+ function m() {
1119
1191
  t().muted = !t().muted, e.muted = t().muted;
1120
1192
  }
1121
- function w(D) {
1122
- e.status = "error", e.playing = !1, e.buffering = !1, n(D);
1193
+ function k(F) {
1194
+ e.status = "error", e.playing = !1, e.buffering = !1, n(F);
1123
1195
  }
1124
- const y = Object.fromEntries(
1196
+ const B = Object.fromEntries(
1125
1197
  Object.entries({
1126
- loadedmetadata: C,
1127
- durationchange: C,
1128
- timeupdate: C,
1129
- progress: C,
1198
+ loadedmetadata: x,
1199
+ durationchange: x,
1200
+ timeupdate: x,
1201
+ progress: x,
1130
1202
  loadeddata: () => {
1131
- C(), e.status = "ready", e.buffering = !1;
1203
+ x(), e.status = "ready", e.buffering = !1;
1132
1204
  },
1133
1205
  canplay: () => {
1134
- C(), e.buffering = !1;
1206
+ x(), e.buffering = !1;
1135
1207
  },
1136
- canplaythrough: C,
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, o.complete(t()), C();
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, C();
1228
+ e.buffering = !1, x();
1157
1229
  },
1158
1230
  volumechange: () => {
1159
1231
  e.muted = t().muted;
1160
1232
  },
1161
1233
  error: () => {
1162
- w(new Error("视频暂时无法播放,请重试或检查资源格式"));
1234
+ k(new Error("视频暂时无法播放,请重试或检查资源格式"));
1163
1235
  }
1164
- }).map(([D, I]) => [
1165
- D,
1236
+ }).map(([F, v]) => [
1237
+ F,
1166
1238
  () => {
1167
- l || I();
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: r,
1251
+ seekable: l,
1180
1252
  displayTime: u,
1181
- progress: p,
1182
- bufferedProgress: d,
1183
- bufferedRanges: S,
1184
- events: y,
1185
- play: x,
1186
- pause: m,
1187
- toggle: F,
1188
- beginScrub: q,
1189
- scrub: v,
1190
- endScrub: k,
1191
- toggleMuted: g,
1192
- retry: $,
1193
- setSourceDuration: P,
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: w, duration: P, reset: R },
1196
- dispose: h
1267
+ sourceObserver: { error: k, duration: y, reset: R },
1268
+ dispose: $
1197
1269
  };
1198
1270
  }
1199
- const An = ["data-live-state"], Vn = { class: "mp-dom-renderer mp-live-photo__motion" }, _n = ["preload"], Yn = /* @__PURE__ */ Te({
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: () => je },
1211
- resolveSource: { type: Function, default: Ke },
1282
+ resourcePolicy: { default: () => Ke },
1283
+ resolveSource: { type: Function, default: Qe },
1212
1284
  rendering: { type: Boolean, default: !0 },
1213
- initialImage: { default: () => Re },
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: o }) {
1218
- const e = t, i = o, a = L(), l = L(), r = L(), u = L(), p = qt(
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
- (g) => i("error", g)
1221
- ), { state: d } = p;
1222
- Tt(
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
- () => it,
1227
- p.sourceObserver
1298
+ () => rt,
1299
+ { ...f.sourceObserver, quality: () => {
1300
+ } }
1228
1301
  );
1229
- let S = !1, C = () => {
1302
+ let P = !1, x = () => {
1230
1303
  };
1231
- const P = X(
1232
- () => e.active && e.enabled && d.playing && d.status === "ready" && !d.buffering
1233
- ), R = X(() => ({
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
- })), x = X(() => ({
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 m() {
1241
- p.pause(), a.value.readyState >= HTMLMediaElement.HAVE_METADATA && (a.value.currentTime = 0);
1313
+ function g() {
1314
+ f.pause(), a.value.readyState >= HTMLMediaElement.HAVE_METADATA && (a.value.currentTime = 0);
1242
1315
  }
1243
- function F() {
1244
- !e.active || !e.enabled || !e.loadEnabled || !e.playing || d.status !== "ready" || d.buffering ? m() : p.play().then(() => {
1245
- !S && !d.playing && e.playing && i("liveEnded");
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
- ee(
1249
- () => [d.status, d.playing, d.buffering],
1321
+ te(
1322
+ () => [c.status, c.playing, c.buffering],
1250
1323
  () => {
1251
- const g = d.status === "error" ? "error" : d.buffering || d.status === "loading" ? "loading" : P.value ? "playing" : "idle";
1252
- i("liveState", g);
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 q() {
1257
- S || (m(), i("liveEnded"));
1329
+ function D() {
1330
+ P || (g(), i("liveEnded"));
1258
1331
  }
1259
- function v() {
1260
- document.hidden && (m(), i("liveEnded"));
1332
+ function h() {
1333
+ document.hidden && (g(), i("liveEnded"));
1261
1334
  }
1262
1335
  qe(() => {
1263
- C = ee(() => [e.active, e.enabled, e.loadEnabled, e.playing], F, {
1336
+ x = te(() => [e.active, e.enabled, e.loadEnabled, e.playing], M, {
1264
1337
  flush: "post"
1265
- }), F(), document.addEventListener("visibilitychange", v);
1266
- }), $e(() => {
1267
- C(), S = !0, p.dispose(), document.removeEventListener("visibilitychange", v);
1338
+ }), M(), document.addEventListener("visibilitychange", h);
1339
+ }), Te(() => {
1340
+ x(), P = !0, f.dispose(), document.removeEventListener("visibilitychange", h);
1268
1341
  });
1269
- function k() {
1270
- const g = document.createElement("canvas"), w = Math.min(
1342
+ function b() {
1343
+ const m = document.createElement("canvas"), k = Math.min(
1271
1344
  1,
1272
- Math.sqrt(ue.maxCanvasPixels / (e.media.width * e.media.height))
1345
+ Math.sqrt(ce.maxCanvasPixels / (e.media.width * e.media.height))
1273
1346
  );
1274
- g.width = Math.round(e.media.width * w), g.height = Math.round(e.media.height * w);
1275
- const E = g.getContext("2d"), y = Number(getComputedStyle(r.value).opacity);
1276
- E.drawImage(u.value.captureFrame().image, 0, 0, g.width, g.height), y < 1 && a.value.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA && (E.globalAlpha = 1 - y, E.drawImage(a.value, 0, 0, g.width, g.height));
1277
- const h = new DOMMatrixReadOnly(getComputedStyle(l.value).transform).a;
1278
- return p.pause(), { image: g, scale: h };
1279
- }
1280
- return n({ captureFrame: k, retainFrame: () => ({ ...k(), release: () => {
1281
- } }) }), (g, w) => (O(), A("div", {
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": f(d).status === "error" ? "error" : P.value ? "playing" : "idle"
1356
+ "data-live-state": p(c).status === "error" ? "error" : y.value ? "playing" : "idle"
1284
1357
  }, [
1285
- B("div", {
1358
+ T("div", {
1286
1359
  ref_key: "effectsRef",
1287
- ref: l,
1288
- class: Ie(["mp-live-photo__effects", { "is-playing": P.value }])
1360
+ ref: o,
1361
+ class: De(["mp-live-photo__effects", { "is-playing": y.value }])
1289
1362
  }, [
1290
- B("div", Vn, [
1291
- B("div", {
1363
+ T("div", Wn, [
1364
+ T("div", {
1292
1365
  class: "mp-dom-renderer__frame",
1293
- style: Le(R.value)
1366
+ style: me(R.value)
1294
1367
  }, [
1295
- B("video", We({
1368
+ T("video", je({
1296
1369
  ref_key: "videoRef",
1297
1370
  ref: a,
1298
1371
  class: "mp-dom-renderer__node",
1299
- style: x.value,
1300
- preload: g.active && g.enabled && g.loadEnabled ? "auto" : "none",
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
- }, mt(f(p).events, !0), {
1305
- onEnded: q,
1306
- onError: w[0] || (w[0] = (E) => i("liveEnded"))
1307
- }), null, 16, _n)
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
- B("div", {
1383
+ T("div", {
1311
1384
  ref_key: "stillRef",
1312
- ref: r,
1313
- class: Ie(["mp-live-photo__still", { "is-playing": P.value }])
1385
+ ref: l,
1386
+ class: De(["mp-live-photo__still", { "is-playing": y.value }])
1314
1387
  }, [
1315
- De(pt, {
1388
+ ze(gt, {
1316
1389
  ref_key: "imageRendererRef",
1317
1390
  ref: u,
1318
- "request-version": g.requestVersion,
1319
- "load-enabled": g.loadEnabled,
1320
- priority: g.priority,
1321
- "resource-policy": g.resourcePolicy,
1322
- "resolve-source": g.resolveSource,
1323
- onOriginalState: w[1] || (w[1] = (E, y) => i("originalState", E, y)),
1324
- media: g.media,
1325
- "initial-image": g.initialImage,
1326
- rendering: g.rendering,
1327
- core: g.core,
1328
- quality: g.quality,
1329
- onReady: w[2] || (w[2] = (E) => i("ready", E)),
1330
- onError: w[3] || (w[3] = (E) => i("error", E))
1331
- }, null, 8, ["request-version", "load-enabled", "priority", "resource-policy", "resolve-source", "media", "initial-image", "rendering", "core", "quality"])
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, An));
1408
+ ], 8, Xn));
1335
1409
  }
1336
1410
  });
1337
- function Un(t, n) {
1338
- const o = document.createElement("canvas"), e = Math.min(1, Math.sqrt(ue.maxCanvasPixels / (n.width * n.height)));
1339
- o.width = Math.max(1, Math.round(n.width * e)), o.height = Math.max(1, Math.round(n.height * e));
1340
- const i = Math.min(o.width / t.videoWidth, o.height / t.videoHeight), a = t.videoWidth * i, l = t.videoHeight * i;
1341
- return o.getContext("2d").drawImage(t, (o.width - a) / 2, (o.height - l) / 2, a, l), t.pause(), o;
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 Xn = {
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
- }, Hn = ["d", "fill"], Wn = ["src"], Nn = ["src"], nt = /* @__PURE__ */ Te({
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, o = {
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, l) => (O(), A("span", {
1385
- class: Ie(["mp-video-icon", { "has-album-icon": n.name in o }])
1518
+ return (a, o) => (O(), _("span", {
1519
+ class: De(["mp-video-icon", { "has-album-icon": n.name in r }])
1386
1520
  }, [
1387
- (O(), A("svg", Xn, [
1388
- (O(!0), A(Fe, null, Ne(i[a.name], (r, u) => (O(), A("path", {
1521
+ (O(), _("svg", Kn, [
1522
+ (O(!0), _($e, null, Ye(i[a.name], (l, u) => (O(), _("path", {
1389
1523
  key: u,
1390
- d: r,
1524
+ d: l,
1391
1525
  fill: a.name === "play" ? "currentColor" : "none"
1392
- }, null, 8, Hn))), 128))
1526
+ }, null, 8, Qn))), 128))
1393
1527
  ])),
1394
- a.name in o ? (O(), A(Fe, { key: 0 }, [
1395
- B("img", {
1528
+ a.name in r ? (O(), _($e, { key: 0 }, [
1529
+ T("img", {
1396
1530
  class: "mp-video-icon--mobile",
1397
- src: e[o[a.name][0]],
1531
+ src: e[r[a.name][0]],
1398
1532
  alt: "",
1399
1533
  "aria-hidden": "true",
1400
1534
  draggable: "false"
1401
- }, null, 8, Wn),
1402
- B("img", {
1535
+ }, null, 8, Jn),
1536
+ T("img", {
1403
1537
  class: "mp-video-icon--desktop",
1404
- src: e[o[a.name][1]],
1538
+ src: e[r[a.name][1]],
1405
1539
  alt: "",
1406
1540
  "aria-hidden": "true",
1407
1541
  draggable: "false"
1408
- }, null, 8, Nn)
1409
- ], 64)) : le("", !0)
1542
+ }, null, 8, ea)
1543
+ ], 64)) : J("", !0)
1410
1544
  ], 2));
1411
1545
  }
1412
- }), Zn = {
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
- }, jn = ["aria-label", "disabled"], Kn = { class: "mp-video-time" }, Gn = ["tabindex", "aria-disabled", "aria-valuemax", "aria-valuenow", "aria-valuetext"], Qn = /* @__PURE__ */ B("span", { class: "mp-video-progress__rail" }, null, -1), Jn = { class: "mp-video-time" }, ea = ["aria-label", "aria-pressed"], ta = ["aria-label", "disabled"], na = /* @__PURE__ */ Te({
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 o = t, e = n, i = L(), { state: a, seekable: l, displayTime: r, progress: u, bufferedRanges: p } = o.playback;
1425
- function d(x) {
1426
- const m = i.value.getBoundingClientRect();
1427
- o.playback.scrub((x.clientX - m.left) / Math.max(1, m.width) * a.duration);
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 S(x) {
1430
- !l.value || x.pointerType === "mouse" && x.button !== 0 || (i.value.setPointerCapture(x.pointerId), o.playback.beginScrub(), d(x));
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 C(x) {
1433
- a.scrubbing && d(x);
1626
+ function x(w) {
1627
+ a.scrubbing && c(w);
1434
1628
  }
1435
- function P(x) {
1436
- a.scrubbing && (d(x), o.playback.endScrub());
1629
+ function y(w) {
1630
+ a.scrubbing && (c(w), r.playback.endScrub());
1437
1631
  }
1438
- function R(x) {
1439
- o.playback.beginScrub(), o.playback.scrub(r.value + x), o.playback.endScrub();
1632
+ function R(w) {
1633
+ r.playback.beginScrub(), r.playback.scrub(l.value + w), r.playback.endScrub();
1440
1634
  }
1441
- return (x, m) => (O(), A("div", {
1635
+ return (w, g) => (O(), _("div", {
1442
1636
  class: "mp-video-controls",
1443
1637
  "data-preview-control": "",
1444
- onPointerdown: m[9] || (m[9] = ae(() => {
1638
+ onPointerdown: g[9] || (g[9] = ae(() => {
1445
1639
  }, ["stop"])),
1446
- onPointermove: m[10] || (m[10] = ae(() => {
1640
+ onPointermove: g[10] || (g[10] = ae(() => {
1447
1641
  }, ["stop"])),
1448
- onPointerup: m[11] || (m[11] = ae(() => {
1642
+ onPointerup: g[11] || (g[11] = ae(() => {
1449
1643
  }, ["stop"])),
1450
- onPointercancel: m[12] || (m[12] = ae(() => {
1644
+ onPointercancel: g[12] || (g[12] = ae(() => {
1451
1645
  }, ["stop"])),
1452
- onClick: m[13] || (m[13] = ae(() => {
1646
+ onClick: g[13] || (g[13] = ae(() => {
1453
1647
  }, ["stop"])),
1454
- onDblclick: m[14] || (m[14] = ae(() => {
1648
+ onDblclick: g[14] || (g[14] = ae(() => {
1455
1649
  }, ["stop"])),
1456
- onKeydown: m[15] || (m[15] = ae(() => {
1650
+ onKeydown: g[15] || (g[15] = ae(() => {
1457
1651
  }, ["stop"]))
1458
1652
  }, [
1459
- f(a).scrubbing ? (O(), A("div", Zn, [
1460
- Kt(fe(f(Ve)(f(r))), 1),
1461
- B("span", null, " / " + fe(f(Ve)(f(a).duration)), 1)
1462
- ])) : le("", !0),
1463
- B("button", {
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": f(a).ended ? "重新播放视频" : f(a).playing ? "暂停视频" : "播放视频",
1466
- disabled: f(a).status === "error",
1467
- onClick: m[0] || (m[0] = //@ts-ignore
1468
- (...F) => x.playback.toggle && x.playback.toggle(...F))
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
- De(nt, {
1471
- name: f(a).ended ? "replay" : f(a).playing ? "pause" : "play"
1664
+ ze(at, {
1665
+ name: p(a).ended ? "replay" : p(a).playing ? "pause" : "play"
1472
1666
  }, null, 8, ["name"])
1473
- ], 8, jn),
1474
- B("time", Kn, fe(f(Ve)(f(r))), 1),
1475
- B("div", {
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: Ie(["mp-video-progress", { "is-scrubbing": f(a).scrubbing }]),
1672
+ class: De(["mp-video-progress", { "is-scrubbing": p(a).scrubbing }]),
1479
1673
  role: "slider",
1480
1674
  "aria-label": "视频进度",
1481
- tabindex: f(l) ? 0 : -1,
1482
- "aria-disabled": !f(l),
1675
+ tabindex: p(o) ? 0 : -1,
1676
+ "aria-disabled": !p(o),
1483
1677
  "aria-valuemin": "0",
1484
- "aria-valuemax": f(a).duration,
1485
- "aria-valuenow": f(r),
1486
- "aria-valuetext": `${f(Ve)(f(r))} / ${f(Ve)(f(a).duration)}`,
1487
- onPointerdown: ae(S, ["prevent"]),
1488
- onPointermove: ae(C, ["prevent"]),
1489
- onPointerup: ae(P, ["prevent"]),
1490
- onPointercancel: m[1] || (m[1] = (F) => x.playback.endScrub(!1)),
1491
- onLostpointercapture: m[2] || (m[2] = (F) => x.playback.endScrub(!1)),
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
- m[3] || (m[3] = tt(ae((F) => R(-5), ["prevent"]), ["left"])),
1494
- m[4] || (m[4] = tt(ae((F) => R(5), ["prevent"]), ["right"])),
1495
- m[5] || (m[5] = tt(ae((F) => R(-f(a).duration), ["prevent"]), ["home"])),
1496
- m[6] || (m[6] = tt(ae((F) => R(f(a).duration), ["prevent"]), ["end"]))
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
- Qn,
1500
- (O(!0), A(Fe, null, Ne(f(p), (F, q) => (O(), A("span", {
1501
- key: q,
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: Le({ left: `${F.left}%`, width: `${F.width}%` })
1697
+ style: me({ left: `${M.left}%`, width: `${M.width}%` })
1504
1698
  }, null, 4))), 128)),
1505
- B("span", {
1699
+ T("span", {
1506
1700
  class: "mp-video-progress__played",
1507
- style: Le({ width: `${f(u)}%` })
1701
+ style: me({ width: `${p(u)}%` })
1508
1702
  }, null, 4),
1509
- B("span", {
1703
+ T("span", {
1510
1704
  class: "mp-video-progress__thumb",
1511
- style: Le({ left: `${f(u)}%` })
1705
+ style: me({ left: `${p(u)}%` })
1512
1706
  }, null, 4)
1513
- ], 42, Gn),
1514
- B("time", Jn, fe(f(Ve)(f(a).duration)), 1),
1515
- B("button", {
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": f(a).muted ? "开启声音" : "静音视频",
1519
- "aria-pressed": f(a).muted,
1520
- onClick: m[7] || (m[7] = //@ts-ignore
1521
- (...F) => x.playback.toggleMuted && x.playback.toggleMuted(...F))
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
- De(nt, {
1524
- name: f(a).muted ? "muted" : "volume"
1721
+ ze(at, {
1722
+ name: p(a).muted ? "muted" : "volume"
1525
1723
  }, null, 8, ["name"])
1526
- ], 8, ea),
1527
- B("button", {
1724
+ ], 8, fa),
1725
+ T("button", {
1528
1726
  type: "button",
1529
- "aria-label": x.fullscreen ? "退出视频全屏" : "视频全屏",
1530
- disabled: !x.canFullscreen,
1531
- onClick: m[8] || (m[8] = (F) => e("fullscreen"))
1727
+ "aria-label": w.fullscreen ? "退出视频全屏" : "视频全屏",
1728
+ disabled: !w.canFullscreen,
1729
+ onClick: g[8] || (g[8] = (M) => e("fullscreen"))
1532
1730
  }, [
1533
- De(nt, {
1534
- name: x.fullscreen ? "exit" : "fullscreen"
1731
+ ze(at, {
1732
+ name: w.fullscreen ? "exit" : "fullscreen"
1535
1733
  }, null, 8, ["name"])
1536
- ], 8, ta)
1734
+ ], 8, ma)
1537
1735
  ], 32));
1538
1736
  }
1539
- }), aa = ["data-playback"], ia = ["muted", "loop", "preload"], oa = {
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
- }, ra = /* @__PURE__ */ B("span", { class: "mp-spinner" }, null, -1), la = [
1545
- ra
1546
- ], sa = ["aria-label"], ua = {
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
- }, ca = ["inert"], da = /* @__PURE__ */ Te({
1748
+ }, xa = ["inert"], Ma = /* @__PURE__ */ Le({
1551
1749
  inheritAttrs: !1,
1552
1750
  __name: "VideoDomRenderer",
1553
1751
  props: {
1554
- initialImage: { default: () => Re },
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: () => je },
1560
- resolveSource: { type: Function, default: Ke },
1757
+ resourcePolicy: { default: () => Ke },
1758
+ resolveSource: { type: Function, default: Qe },
1561
1759
  media: {},
1562
- videoLoader: { type: Function, default: it },
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: o }) {
1577
- const e = t, i = o, a = L(!1), l = X(() => ({
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
- })), r = L(), u = L(), p = L(!1), d = L(!1), S = qt(
1582
- () => r.value,
1583
- (y) => i("error", y)
1584
- );
1585
- Tt(
1586
- () => r.value,
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
- S.sourceObserver
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 C = () => {
1815
+ let g = () => {
1593
1816
  };
1594
- const { state: P } = S, R = X(
1817
+ const { state: M } = y, D = V(
1595
1818
  () => e.controls && e.active && e.enabled && e.controlsVisible
1596
1819
  );
1597
- function x() {
1598
- return e.teleportControls ? u.value.closest(".mp-viewer") : e.core.containerRef.value;
1820
+ function h() {
1821
+ return e.teleportControls ? c.value.closest(".mp-viewer") : e.core.containerRef.value;
1599
1822
  }
1600
- async function m() {
1601
- if (d.value)
1823
+ async function b() {
1824
+ if (x.value)
1602
1825
  try {
1603
- document.fullscreenElement === x() ? await document.exitFullscreen() : document.fullscreenEnabled ? await x().requestFullscreen() : r.value.webkitEnterFullscreen();
1604
- } catch (y) {
1605
- i("error", _e(y));
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 F() {
1609
- p.value = document.fullscreenElement === x();
1831
+ function m() {
1832
+ P.value = document.fullscreenElement === h();
1610
1833
  }
1611
- function q() {
1612
- !e.active || !e.enabled ? S.pause() : e.autoplay && S.play();
1834
+ function k() {
1835
+ !e.active || !e.enabled ? y.pause() : e.autoplay && y.play();
1613
1836
  }
1614
- function v() {
1615
- document.hidden && S.pause();
1837
+ function C() {
1838
+ document.hidden && y.pause();
1616
1839
  }
1617
1840
  qe(() => {
1618
- P.muted = r.value.muted, d.value = document.fullscreenEnabled || "webkitEnterFullscreen" in r.value, document.addEventListener("fullscreenchange", F), document.addEventListener("visibilitychange", v), C = ee(() => [e.active, e.enabled, e.autoplay], q, {
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
- }), q();
1621
- }), $e(() => {
1622
- C(), S.dispose(), document.removeEventListener("fullscreenchange", F), document.removeEventListener("visibilitychange", v), document.fullscreenElement === x() && document.exitFullscreen().catch(() => {
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 k = X(() => ({
1848
+ const B = V(() => ({
1626
1849
  transform: `translate(-50%, -50%) translate3d(${e.core.state.offsetX}px, ${e.core.state.offsetY}px, 0)`
1627
- })), g = X(() => ({
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 w() {
1633
- a.value = !0, e.core.setMediaElement(r.value), i("ready", "screen");
1855
+ function z() {
1856
+ a.value = !0, e.core.setMediaElement(l.value), i("ready", "screen");
1634
1857
  }
1635
- function E() {
1636
- return { image: a.value ? Un(r.value, e.core.mediaSize.value) : e.core.mediaRef.value, scale: 1 };
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: S.toggle,
1640
- toggleFullscreen: m,
1641
- playback: S,
1642
- captureFrame: E,
1643
- retainFrame: () => ({ ...E(), release: () => {
1862
+ togglePlayback: y.toggle,
1863
+ toggleFullscreen: b,
1864
+ playback: y,
1865
+ captureFrame: F,
1866
+ retainFrame: () => ({ ...F(), release: () => {
1644
1867
  } })
1645
- }), (y, h) => (O(), A("div", {
1868
+ }), (v, q) => (O(), _("div", {
1646
1869
  ref_key: "host",
1647
- ref: u,
1870
+ ref: c,
1648
1871
  class: "mp-dom-renderer mp-video-player",
1649
- "data-playback": f(P).ended ? "ended" : f(P).playing ? "playing" : "paused"
1872
+ "data-playback": p(M).ended ? "ended" : p(M).playing ? "playing" : "paused"
1650
1873
  }, [
1651
- a.value ? le("", !0) : (O(), at(pt, {
1874
+ a.value ? J("", !0) : (O(), Ue(gt, {
1652
1875
  key: 0,
1653
- media: l.value,
1876
+ active: v.active,
1877
+ media: o.value,
1654
1878
  "original-enabled": !1,
1655
- core: y.core,
1656
- "initial-image": y.initialImage,
1657
- rendering: y.rendering,
1658
- quality: y.quality,
1659
- "request-version": y.requestVersion,
1660
- "load-enabled": y.loadEnabled,
1661
- priority: y.priority,
1662
- "resource-policy": y.resourcePolicy,
1663
- "resolve-source": y.resolveSource,
1664
- onReady: h[0] || (h[0] = ($) => i("ready", $)),
1665
- onError: h[1] || (h[1] = ($) => i("error", $)),
1666
- onOriginalState: h[2] || (h[2] = ($, D) => i("originalState", $, D))
1667
- }, null, 8, ["media", "core", "initial-image", "rendering", "quality", "request-version", "load-enabled", "priority", "resource-policy", "resolve-source"])),
1668
- B("div", {
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: Le([k.value, { visibility: a.value ? "inherit" : "hidden" }])
1894
+ style: me([B.value, { visibility: a.value ? "inherit" : "hidden" }])
1671
1895
  }, [
1672
- B("video", We({
1896
+ T("video", je({
1673
1897
  ref_key: "videoRef",
1674
- ref: r,
1898
+ ref: l,
1675
1899
  class: "mp-dom-renderer__node",
1676
- muted: y.muted,
1677
- loop: y.loop,
1900
+ muted: v.muted,
1901
+ loop: v.loop,
1678
1902
  playsinline: "",
1679
1903
  "webkit-playsinline": "true",
1680
1904
  crossorigin: "anonymous",
1681
- preload: y.active && y.loadEnabled ? "auto" : "none",
1682
- style: g.value
1683
- }, mt(f(S).events, !0), { onPlaying: w }), null, 16, ia)
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
- y.active && y.enabled && f(P).buffering && f(P).status !== "error" ? (O(), A("div", oa, la)) : le("", !0),
1686
- R.value && !f(P).playing && !f(P).buffering && f(P).status !== "error" ? (O(), A("button", {
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": f(P).ended ? "重新播放" : "开始播放视频",
1692
- onPointerdown: h[3] || (h[3] = ae(() => {
1924
+ "aria-label": p(M).ended ? "重新播放" : "开始播放视频",
1925
+ onPointerdown: q[3] || (q[3] = ae(() => {
1693
1926
  }, ["stop"])),
1694
- onPointerup: h[4] || (h[4] = ae(() => {
1927
+ onPointerup: q[4] || (q[4] = ae(() => {
1695
1928
  }, ["stop"])),
1696
- onClick: h[5] || (h[5] = ae(
1929
+ onClick: q[5] || (q[5] = ae(
1697
1930
  //@ts-ignore
1698
- (...$) => f(S).toggle && f(S).toggle(...$),
1931
+ (...U) => p(y).toggle && p(y).toggle(...U),
1699
1932
  ["stop"]
1700
1933
  ))
1701
1934
  }, [
1702
- De(nt, {
1703
- name: f(P).ended ? "replay" : "play"
1935
+ ze(at, {
1936
+ name: p(M).ended ? "replay" : "play"
1704
1937
  }, null, 8, ["name"])
1705
- ], 40, sa)) : le("", !0),
1706
- f(P).status === "error" ? (O(), A("div", ua, "视频暂时无法播放")) : le("", !0),
1707
- y.controls && y.active && y.enabled ? (O(), at(Ct, {
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: y.controlsTarget,
1710
- disabled: !y.teleportControls
1942
+ to: v.controlsTarget,
1943
+ disabled: !v.teleportControls
1711
1944
  }, [
1712
- B("div", {
1713
- class: Ie(["mp-video-control-layer", { "is-hidden": !R.value }]),
1714
- inert: !R.value
1945
+ T("div", {
1946
+ class: De(["mp-video-control-layer", { "is-hidden": !D.value }]),
1947
+ inert: !D.value
1715
1948
  }, [
1716
- De(na, {
1717
- playback: f(S),
1718
- fullscreen: p.value,
1719
- "can-fullscreen": d.value,
1720
- onFullscreen: m
1721
- }, null, 8, ["playback", "fullscreen", "can-fullscreen"])
1722
- ], 10, ca)
1723
- ], 8, ["to", "disabled"])) : le("", !0)
1724
- ], 8, aa));
1725
- }
1726
- }), fa = ["data-scale", "data-rotation", "data-live-holding"], ga = /* @__PURE__ */ Te({
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: it },
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: () => je },
1736
- resolveSource: { type: Function, default: Ke },
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: () => Re },
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: o }) {
1750
- const e = t, i = o, a = L(!1), l = L("loading"), r = pn({
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: () => Cn(e.media, r.core.viewportSize.value),
1755
- holdable: () => e.media.type === "live-photo" && S.value === "ready" && l.value === "idle",
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: (v) => {
1765
- e.active && i("scale", v);
1999
+ onScale: (h) => {
2000
+ e.active && i("scale", h);
1766
2001
  },
1767
- onSwipeDownProgress: (v) => {
1768
- e.active && i("swipeDownProgress", v);
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: (v) => {
1774
- e.active && i("pageDrag", v);
2008
+ onPageDrag: (h) => {
2009
+ e.active && i("pageDrag", h);
1775
2010
  },
1776
- onPageRelease: (v, k) => i("pageRelease", v, k)
1777
- }), u = r.core.containerRef, p = r.core.downDragStyle, d = r.core.state, S = L("loading"), C = L("thumbnail"), P = L(), R = X(
1778
- () => e.media.type === "video" ? da : e.media.type === "live-photo" ? Yn : pt
1779
- ), x = X(
1780
- () => C.value === "full" || e.quality === "full" ? "full" : e.quality
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
- ee(
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
- C.value = "thumbnail";
2025
+ x.value = "thumbnail";
1791
2026
  }
1792
- ), ee(
2027
+ ), te(
1793
2028
  () => e.media.id,
1794
2029
  () => {
1795
- S.value = "loading", r.core.setRotation(0);
2030
+ P.value = "loading", l.core.setRotation(0);
1796
2031
  }
1797
- ), ee(
2032
+ ), te(
1798
2033
  [() => e.media.width, () => e.media.height],
1799
- ([v, k]) => {
1800
- r.core.setMediaSize({ width: v, height: k });
2034
+ ([h, b]) => {
2035
+ l.core.setMediaSize({ width: h, height: b });
1801
2036
  },
1802
2037
  { immediate: !0 }
1803
- ), ee(
2038
+ ), te(
1804
2039
  () => e.active,
1805
- (v) => {
1806
- v || r.core.resetTransform(e.inactiveResetDuration);
2040
+ (h) => {
2041
+ h || l.core.resetTransform(e.inactiveResetDuration);
1807
2042
  }
1808
- ), ee(
2043
+ ), te(
1809
2044
  () => e.disabled,
1810
- (v) => {
1811
- v && r.core.cancelGesture(!0);
2045
+ (h) => {
2046
+ h && l.core.cancelGesture(!0);
1812
2047
  }
1813
2048
  );
1814
- function m(v) {
1815
- v === "full" && (C.value = v), S.value = "ready", i("ready", v);
2049
+ function g(h) {
2050
+ h === "full" && (x.value = h), P.value = "ready", i("ready", h);
1816
2051
  }
1817
- function F(v) {
1818
- l.value = v, i("liveState", v);
2052
+ function M(h) {
2053
+ o.value = h, i("liveState", h);
1819
2054
  }
1820
- const q = X(
2055
+ const D = V(
1821
2056
  () => e.externalGestures ? {} : {
1822
- wheel: r.onWheel,
1823
- pointerdown: r.onPointerDown,
1824
- pointermove: r.onPointerMove,
1825
- pointerup: r.onPointerUp,
1826
- pointercancel: r.onPointerCancel,
1827
- lostpointercapture: r.onPointerCancel
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: r.onPointerDown,
1832
- onPointerMove: r.onPointerMove,
1833
- onPointerUp: r.onPointerUp,
1834
- onPointerCancel: r.onPointerCancel,
1835
- onWheel: r.onWheel,
1836
- readiness: S,
1837
- core: r.core,
1838
- rotateBy: r.core.rotateBy,
1839
- resetTransform: r.core.resetTransform,
1840
- zoomIn: () => r.core.zoomTo(d.level * 1.5, void 0, !0),
1841
- zoomOut: () => r.core.zoomTo(d.level / 1.5, void 0, !0),
1842
- togglePlayback: () => P.value.togglePlayback(),
1843
- toggleFullscreen: () => P.value.toggleFullscreen(),
1844
- captureFrame: () => P.value.captureFrame(),
1845
- retainFrame: () => P.value.retainFrame()
1846
- }), (v, k) => (O(), A("div", We({
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": f(d).level > 1, "is-dismissing": f(d).draggingDown }],
1850
- style: f(p),
1851
- "data-scale": f(d).level.toFixed(3),
1852
- "data-rotation": f(d).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: k[3] || (k[3] = (g) => {
1855
- v.media.type === "live-photo" && g.preventDefault();
2089
+ onContextmenu: b[3] || (b[3] = (m) => {
2090
+ h.media.type === "live-photo" && m.preventDefault();
1856
2091
  })
1857
- }, mt(q.value, !0)), [
1858
- (O(), at(Gt(R.value), We({
2092
+ }, pt(D.value, !0)), [
2093
+ (O(), Ue(en(R.value), je({
1859
2094
  ref_key: "rendererRef",
1860
- ref: P,
1861
- media: v.media
1862
- }, v.media.type === "video" ? { videoLoader: v.videoLoader } : {}, {
1863
- "initial-image": v.initialImage,
1864
- rendering: v.rendering,
1865
- core: f(r).core,
1866
- quality: x.value,
1867
- "request-version": v.requestVersion,
1868
- "load-enabled": v.loadEnabled,
1869
- priority: v.active ? 0 : 2,
1870
- "resource-policy": v.resourcePolicy,
1871
- "resolve-source": v.resolveSource,
1872
- playing: (v.livePlaying || a.value) && v.active,
1873
- enabled: !v.disabled,
1874
- "controls-visible": v.controlsVisible,
1875
- "teleport-controls": v.teleportControls,
1876
- "controls-target": v.controlsTarget,
1877
- active: v.active,
1878
- onReady: m,
1879
- onError: k[0] || (k[0] = (g) => i("error", g)),
1880
- onOriginalState: k[1] || (k[1] = (g, w) => i("originalState", g, w)),
1881
- onLiveState: F,
1882
- onLiveEnded: k[2] || (k[2] = (g) => i("liveEnded"))
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, fa));
2119
+ ], 16, Sa));
1885
2120
  }
1886
2121
  });
1887
- function ma(t, n) {
1888
- const o = L(/* @__PURE__ */ new Set()), e = L("idle"), i = L(""), a = L(0), l = L("");
1889
- function r() {
1890
- l.value = "", e.value = "idle", i.value = "", a.value = 0;
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++, o.value = /* @__PURE__ */ new Set([...o.value, t().id]));
2128
+ e.value !== "ready" && (e.value = "loading", i.value = "", a.value++, r.value = /* @__PURE__ */ new Set([...r.value, t().id]));
1894
2129
  }
1895
- function p(d, S) {
1896
- e.value = d, i.value = S, n(t(), d, S);
2130
+ function f(c, P) {
2131
+ e.value = c, i.value = P, n(t(), c, P);
1897
2132
  }
1898
2133
  return {
1899
- originalIds: o,
2134
+ originalIds: r,
1900
2135
  originalStatus: e,
1901
2136
  originalReason: i,
1902
2137
  originalRequest: a,
1903
- readyId: l,
1904
- reset: r,
2138
+ readyId: o,
2139
+ reset: l,
1905
2140
  requestOriginal: u,
1906
- updateOriginal: p
2141
+ updateOriginal: f
1907
2142
  };
1908
2143
  }
1909
- function pa(t, n, o, e = {}) {
1910
- const i = L(0), a = gt({
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
- }), l = { readOffset: () => a.offset, flushLayout: () => {
1918
- }, ...e }, r = 16, u = () => n() + r, p = X(
1919
- () => [i.value - 1, i.value, i.value + 1].filter((E) => E >= 0 && E < t())
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 d = setTimeout(() => {
1922
- }, 0), S = () => {
1923
- }, C = 0, P = 0;
2156
+ let c = setTimeout(() => {
2157
+ }, 0), P = () => {
2158
+ }, x = 0, y = 0;
1924
2159
  function R() {
1925
- C += 1, clearTimeout(d), S(), a.settling = !1, a.preparing = !1;
2160
+ x += 1, clearTimeout(c), P(), a.settling = !1, a.preparing = !1;
1926
2161
  }
1927
- $e(R);
1928
- function x() {
2162
+ Te(R);
2163
+ function w() {
1929
2164
  if (!a.settling && !a.preparing) return;
1930
- const E = a.preparing ? a.offset : l.readOffset();
1931
- R(), a.offset = E, a.grabbed = !0;
2165
+ const C = a.preparing ? a.offset : o.readOffset();
2166
+ R(), a.offset = C, a.grabbed = !0;
1932
2167
  }
1933
- function m(E) {
1934
- if (E === 0) {
1935
- R(), a.dragging = !1, a.grabbed = !1, a.offset = 0, P = 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 || (x(), P = a.offset, R(), a.dragging = !0, a.grabbed = !0);
1939
- const y = P + E, h = i.value === 0 && y > 0 || i.value === t() - 1 && y < 0;
1940
- a.offset = h ? Math.sign(y) * Math.sqrt(Math.abs(y)) * 6 : y;
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 F(E, y = 0) {
2177
+ async function M(C, B = 0) {
1943
2178
  R();
1944
- const h = C, $ = i.value;
1945
- a.offset += (E - $) * u();
1946
- const D = Math.abs(a.offset), I = Q(D / u(), 0, 1), H = Q(220 + I * 140 - Math.min(Math.abs(y), 2) * 35, 240, 360);
1947
- a.duration = matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : H, i.value = E, a.dragging = !1, a.grabbed = !1, a.preparing = !0, E !== $ && o(E), await Me(), h === C && (l.flushLayout(), a.preparing = !1, a.settling = !0, a.offset = 0, await new Promise((Z) => {
1948
- S = Z, d = setTimeout(Z, a.duration);
1949
- }), h === C && (a.settling = !1, S = () => {
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 q(E, y) {
1953
- const h = a.offset, $ = Math.abs(y) > 0.35 && Math.abs(E) > 16, D = Math.sign($ ? y : h), I = $ || Math.abs(h) > n() * 0.14;
1954
- F(Q(i.value - (I ? D : 0), 0, t() - 1), y);
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 v() {
1957
- a.grabbed && !a.dragging && F(i.value);
2191
+ function h() {
2192
+ a.grabbed && !a.dragging && M(i.value);
1958
2193
  }
1959
- function k(E) {
2194
+ function b(C) {
1960
2195
  if (a.dragging) return;
1961
- x();
1962
- const y = Q(i.value + E, 0, t() - 1);
1963
- y !== i.value ? F(y) : v();
2196
+ w();
2197
+ const B = ee(i.value + C, 0, t() - 1);
2198
+ B !== i.value ? M(B) : h();
1964
2199
  }
1965
- function g(E) {
1966
- R(), i.value = E, a.offset = 0, a.dragging = !1, a.grabbed = !1;
2200
+ function m(C) {
2201
+ R(), i.value = C, a.offset = 0, a.dragging = !1, a.grabbed = !1;
1967
2202
  }
1968
- function w(E) {
1969
- i.value = E;
2203
+ function k(C) {
2204
+ i.value = C;
1970
2205
  }
1971
- return { index: i, state: a, slots: p, stride: u, drag: m, release: q, go: k, grab: x, resume: v, reset: g, rebase: w, cancel: R };
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 Ot(t, n, o) {
1974
- const e = Math[o === "cover" ? "max" : "min"](
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 ha(t, n, o) {
1989
- const e = (i, a) => i + (a - i) * o;
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, o = 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 - o / 2, t.clip.left), a = Math.max(t.y - e / 2, t.clip.top);
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 + o / 2, t.clip.left + t.clip.width) - i),
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 va(t, n, o, e, i) {
2015
- const a = Pt(t), l = Pt(n), r = Math.min(a.width / l.width, a.height / l.height), u = {
2016
- width: Math.max(a.width, l.width, 1),
2017
- height: Math.max(a.height, l.height, 1)
2018
- }, p = 128, d = [], S = [];
2019
- for (let C = 0; C <= p; C += 1) {
2020
- const P = C / p, R = ha(t, n, P);
2021
- let x;
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
- x = {
2024
- left: a.left + (l.left - a.left) * P,
2025
- top: a.top + (l.top - a.top) * P,
2026
- width: a.width + (l.width - a.width) * P,
2027
- height: a.height + (l.height - a.height) * P
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 q = Math.min(P / 0.78, 1), v = 1 - q * q * q * (q * (q * 6 - 15) + 10), k = r + (1 - r) * P, g = l.width * k + (a.width - l.width * r) * v, w = l.height * k + (a.height - l.height * r) * v;
2031
- x = {
2032
- left: a.left + a.width / 2 + (l.left + l.width / 2 - a.left - a.width / 2) * P - g / 2,
2033
- top: a.top + a.height / 2 + (l.top + l.height / 2 - a.top - a.height / 2) * P - w / 2,
2034
- width: g,
2035
- height: w
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 m = Math.max(x.width, 1e-3) / u.width, F = Math.max(x.height, 1e-3) / u.height;
2039
- d.push({
2040
- transform: `scale(${1 / m},${1 / F}) translate3d(${R.x - x.left}px,${R.y - x.top}px,0) rotate(${R.rotation}deg) scale(${R.width / e.width}) translate3d(${-e.width / 2}px,${-e.height / 2}px,0)`,
2041
- offset: P
2042
- }), S.push({
2043
- transform: `translate3d(${x.left - o.left}px,${x.top - o.top}px,0) scale(${m},${F})`,
2044
- ...t.radius === 0 && n.radius === 0 ? {} : { borderRadius: `${R.radius / m}px / ${R.radius / F}px` },
2045
- offset: P
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: d, masks: S, maskSize: u };
2283
+ return { pictures: c, masks: P, maskSize: u };
2049
2284
  }
2050
- function ya() {
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 o() {
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, l, r, u, p, d, S, C = S ? 0 : 1, P = 340) {
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(r.width, u.width), x = R * u.height / u.width, m = Math.min(
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(ue.maxCanvasPixels / (R * x))
2300
+ Math.sqrt(ce.maxCanvasPixels / (R * w))
2066
2301
  );
2067
- i.width = Math.max(1, Math.round(R * m)), i.height = Math.max(1, Math.round(x * m)), i.style.width = `${R}px`, i.style.height = `${x}px`;
2068
- const F = i.getContext("2d");
2069
- ((y) => {
2070
- F.clearRect(0, 0, i.width, i.height), F.imageSmoothingEnabled = !0, F.imageSmoothingQuality = "high", F.drawImage(y, 0, 0, i.width, i.height);
2071
- })(l);
2072
- const v = va(r, u, p, { width: R, height: x }, S);
2073
- a.style.width = `${v.maskSize.width}px`, a.style.height = `${v.maskSize.height}px`, a.style.borderRadius = "0";
2074
- const g = {
2075
- duration: matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : Math.max(0, P),
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
- }, w = [
2079
- i.animate(v.pictures, g),
2080
- a.animate(v.masks, g),
2081
- d.animate([{ opacity: C }, { opacity: S ? 1 : 0 }], g)
2082
- ], E = Promise.all(w.map((y) => y.finished)).then(() => {
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: S, animations: w, finished: E }, await E;
2320
+ t = { kind: "playing", entering: P, animations: k, finished: C }, await C;
2086
2321
  }
2087
- return { play: e, cancel: n, reverseOpening: o };
2322
+ return { play: e, cancel: n, reverseOpening: r };
2088
2323
  }
2089
- function At(t, n) {
2090
- const o = Math.max(t.left, n.left), e = Math.max(t.top, n.top);
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: o,
2327
+ left: r,
2093
2328
  top: e,
2094
- width: Math.max(0, Math.min(t.left + t.width, n.left + n.width) - o),
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 wa(t, n) {
2099
- let o = { ...n };
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), l = e.test(a.overflowX), r = e.test(a.overflowY);
2103
- if (!l && !r) continue;
2104
- const u = i.getBoundingClientRect(), p = Number(i.style.getPropertyValue("--mp-transition-inset-top"));
2105
- o = At(o, {
2106
- left: l ? u.left : o.left,
2107
- top: r ? u.top + p : o.top,
2108
- width: l ? u.width : o.width,
2109
- height: r ? Math.max(0, u.height - p) : o.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 o;
2347
+ return r;
2113
2348
  }
2114
- function Rt(t, n, o) {
2349
+ function Et(t, n, r) {
2115
2350
  if (t.kind === "unavailable") return t;
2116
- const e = Ot(n, t.element.getBoundingClientRect(), "cover");
2117
- return e.clip = At(e.clip, wa(t.element, o)), 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: o });
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 ba = ["aria-label", "data-phase", "data-chrome", "inert"], ka = ["aria-hidden", "inert", "data-media-id"], xa = {
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
- }, Ma = /* @__PURE__ */ B("span", {
2359
+ }, Ia = /* @__PURE__ */ T("span", {
2125
2360
  class: "mp-spinner",
2126
2361
  "aria-hidden": "true"
2127
- }, null, -1), Sa = [
2128
- Ma
2129
- ], Pa = ["inert"], Ra = { class: "mp-viewer__toolbar" }, Ea = { class: "mp-viewer__title" }, Ca = ["disabled"], La = { class: "mp-viewer__footer" }, Fa = {
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
- }, $a = {
2367
+ }, Ya = {
2133
2368
  key: 1,
2134
2369
  class: "mp-viewer__detail"
2135
- }, Oa = /* @__PURE__ */ Te({
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: it },
2146
- resourcePolicy: { default: () => je },
2147
- resolveImageSource: { type: Function, default: Ke },
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: o }) {
2156
- const e = Qt(), i = t, a = o, l = L("closed");
2157
- ee(l, (s) => a("phaseChange", s), { flush: "sync" });
2158
- const r = `mp-video-controls-${Jt().uid}`, u = L(), p = L(), d = ma(
2159
- () => _.value,
2160
- (s, b, M) => a("originalState", s, b, M)
2161
- ), { originalIds: S, originalStatus: C, originalReason: P, originalRequest: R, readyId: x } = d;
2162
- let m = "", F = -1;
2163
- const q = L(), v = L(), k = L(), g = L(!1), w = L(0), E = L(!0);
2164
- ee(E, (s) => a("chromeChange", s), { flush: "sync" });
2165
- const y = L(!1), h = L("loading"), $ = L(1), D = L(!1), I = L(1), H = L(!1), Z = L(!1), J = ft(Re);
2166
- let ie = "", Ee = { kind: "unavailable" };
2167
- const oe = /* @__PURE__ */ new Map(), se = /* @__PURE__ */ new Map();
2168
- function ce(s) {
2169
- return (b) => {
2170
- se.set(s, b);
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 de(s) {
2174
- return (b) => {
2175
- oe.set(s, b);
2408
+ function ne(s) {
2409
+ return (S) => {
2410
+ pe.set(s, S);
2176
2411
  };
2177
2412
  }
2178
- const z = pa(
2413
+ const A = Ra(
2179
2414
  () => i.items.length,
2180
- () => I.value,
2415
+ () => v.value,
2181
2416
  (s) => {
2182
- m = i.items[s].id, d.reset(), $.value = 1, y.value = !1, h.value = "loading", a("change", s), Ae(s);
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(se.get(m)).transform).m41,
2420
+ readOffset: () => new DOMMatrixReadOnly(getComputedStyle(le.get(g)).transform).m41,
2186
2421
  flushLayout: () => {
2187
- se.get(m).getBoundingClientRect();
2422
+ le.get(g).getBoundingClientRect();
2188
2423
  }
2189
2424
  }
2190
- ), V = z.index, _ = X(() => i.items[V.value]), Oe = z.slots, Ge = X(
2191
- () => l.value === "opening" || g.value ? [V.value] : Oe.value
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
- ee(Oe, () => {
2194
- Me(() => {
2195
- const s = new Set(Oe.value.map((b) => i.items[b].id));
2196
- for (const b of oe.keys()) s.has(b) || oe.delete(b);
2197
- for (const b of se.keys()) s.has(b) || se.delete(b);
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 te = {
2201
- close: N,
2435
+ const re = {
2436
+ close: Z,
2202
2437
  setChromeVisible: (s) => {
2203
- E.value = s;
2438
+ C.value = s;
2204
2439
  },
2205
- goTo: lt,
2206
- previous: () => z.go(-1),
2207
- next: () => z.go(1),
2208
- rotate: (s = 90) => W().rotateBy(s),
2209
- reset: () => W().resetTransform(),
2210
- zoomIn: () => W().zoomIn(),
2211
- zoomOut: () => W().zoomOut(),
2212
- original: d.requestOriginal,
2213
- fullscreen: xe,
2214
- togglePlayback: () => W().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
- l.value !== "open" || h.value === "loading" || h.value === "error" || (y.value = !y.value);
2451
+ o.value !== "open" || $.value === "loading" || $.value === "error" || (B.value = !B.value);
2217
2452
  },
2218
2453
  toggleDetail: () => {
2219
- D.value = !D.value;
2454
+ F.value = !F.value;
2220
2455
  }
2221
- }, pe = ya(), ge = nn();
2222
- let be = Promise.resolve(), he = () => {
2223
- }, K = 0, ke = "", re = !1, me = "", ve = "", Se = () => {
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 Pe = () => new Promise((s) => requestAnimationFrame(() => s())), ze = new ResizeObserver(() => {
2226
- const s = `${p.value.clientWidth}:${p.value.clientHeight}`, b = `${u.value.clientWidth}:${u.value.clientHeight}`, M = me !== "" && me !== s, U = ve !== "" && ve !== b;
2227
- me = s, ve = b, I.value = p.value.clientWidth, M && l.value === "open" && z.reset(V.value), U && pe.cancel();
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 Ae(s) {
2230
- i.hasMore && s >= i.items.length - 3 && F !== i.items.length && (F = i.items.length, a("loadMore", s));
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, b) {
2233
- s === V.value && (Z.value && (x.value = _.value.id), a("ready", s, b));
2467
+ function ot(s, S) {
2468
+ s === Y.value && (U.value && (w.value = H.value.id), a("ready", s, S));
2234
2469
  }
2235
- function rt(s, b, M) {
2236
- s === V.value && d.updateOriginal(b, M);
2470
+ function lt(s, S, E) {
2471
+ s === Y.value && c.updateOriginal(S, E);
2237
2472
  }
2238
- ee(
2473
+ te(
2239
2474
  () => i.items.map((s) => s.id),
2240
2475
  (s) => {
2241
- if (l.value === "closed") return;
2476
+ if (o.value === "closed") return;
2242
2477
  if (s.length === 0) {
2243
- K++, pe.cancel(), he(), ge.clear(), z.cancel(), Be++, ye.kind === "active" && ye.animation.cancel(), ze.disconnect(), me = "", ve = "", Se(), a("closing"), l.value = "closed", J.value = Re, oe.clear(), se.clear(), document.body.style.overflow = ke, a("close");
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 b = s.indexOf(m), M = b >= 0 ? b : Math.min(V.value, s.length - 1);
2247
- (M !== V.value || b < 0) && (b >= 0 ? z.rebase(M) : (z.reset(M), m = s[M], d.reset(), $.value = 1, y.value = !1, a("change", M))), Ae(M);
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 lt(s) {
2486
+ function st(s) {
2252
2487
  if (!Number.isInteger(s) || s < 0 || s >= i.items.length)
2253
2488
  throw new RangeError("无效的预览下标");
2254
- if (!(l.value !== "open" || s === V.value)) {
2255
- if (Math.abs(s - V.value) === 1) {
2256
- z.go(s - V.value);
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
- z.reset(s), m = i.items[s].id, d.reset(), $.value = 1, y.value = !1, h.value = "loading", a("change", s), Ae(s);
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 st() {
2263
- i.persistentChrome || (E.value = !E.value);
2497
+ function ut() {
2498
+ i.persistentChrome || (C.value = !C.value);
2264
2499
  }
2265
- function W() {
2266
- return oe.get(m);
2500
+ function N() {
2501
+ return pe.get(g);
2267
2502
  }
2268
- function Ye(s) {
2269
- Se();
2270
- const b = s.element.classList.contains("mp-transition-source");
2271
- s.element.classList.add("mp-transition-source"), Se = () => {
2272
- s.element.classList.toggle("mp-transition-source", b);
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 c() {
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 T() {
2280
- return p.value.getBoundingClientRect();
2514
+ function I() {
2515
+ return f.value.getBoundingClientRect();
2281
2516
  }
2282
- function Y(s = 1) {
2283
- const b = T(), M = W().core, U = M.state, ne = U.downScale;
2517
+ function X(s = 1) {
2518
+ const S = I(), E = N().core, W = E.state, oe = W.downScale;
2284
2519
  return {
2285
- x: b.left + b.width / 2 + z.state.offset + U.offsetX * ne * s + U.downOffsetX,
2286
- y: b.top + b.height / 2 + U.offsetY * ne * s + U.downOffsetY,
2287
- width: M.mediaSize.value.width * M.displayScale.value * ne * s,
2288
- height: M.mediaSize.value.height * M.displayScale.value * ne * s,
2289
- rotation: U.rotation,
2290
- clip: b,
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 (l.value === "closing" && await be, l.value !== "closed" || re) return;
2298
- const b = ++K;
2299
- if (ge.clear(), ke = document.body.style.overflow, document.body.style.overflow = "hidden", z.reset(s), m = i.items[s].id, d.reset(), $.value = 1, E.value = !0, y.value = !1, h.value = "loading", D.value = !1, w.value = 0, Z.value = !1, l.value = "opening", J.value = Re, H.value = !1, ie = _.value.id, Ee = { kind: "unavailable" }, g.value = !1, a("open", s), await Me(), b !== K || re) return;
2300
- I.value = p.value.clientWidth, ze.observe(u.value), ze.observe(p.value);
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 U = await i.resolveAnchor(_.value);
2303
- if (b !== K) return;
2304
- const ne = Rt(U, _.value, c());
2305
- Ee = ne, J.value = Rn(ne), H.value = J.value.kind === "image" || W().readiness === "ready";
2306
- const Ue = T();
2307
- if (ne.kind === "element") {
2308
- const Xe = W().readiness === "ready" ? W().core.mediaRef.value : J.value.kind === "image" ? J.value.image : xt();
2309
- if (g.value = !0, await Me(), b !== K || re) return;
2310
- Ye(ne), await pe.play(
2311
- q.value,
2312
- v.value,
2313
- Xe,
2314
- ne.frame,
2315
- Ot(_.value, Ue, "contain"),
2316
- ne.viewport,
2317
- k.value,
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
- w.value = 1, g.value = !1, await we(!0);
2324
- } catch (U) {
2325
- if (b !== K) return;
2326
- a("error", _e(U), _.value);
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 (b !== K || re || (w.value = 1, l.value = "open", await Me(), b !== K || re)) return;
2329
- const M = ge.take();
2330
- M.kind === "pointer" && i.gesturesEnabled && (W().onPointerDown(M.down, T(), M.target), W().onPointerMove(M.latest)), W().core.renderNow(), await Pe(), !(b !== K || re) && (g.value = !1, pe.cancel(), Se(), a("opened", s), await Pe(), !(b !== K || re || l.value !== "open") && (Z.value = !0, Ae(s)));
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 N() {
2333
- return l.value === "closed" || l.value === "closing" || (be = G()), be;
2567
+ function Z() {
2568
+ return o.value === "closed" || o.value === "closing" || (ke = Q()), ke;
2334
2569
  }
2335
- async function G() {
2336
- ge.clear(), z.grab();
2337
- const s = w.value, b = l.value === "opening", M = !b && W().readiness === "ready" ? W().retainFrame() : {
2338
- image: J.value.kind === "image" && _.value.id === ie ? J.value.image : xt(),
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 = M.release;
2578
+ he = E.release;
2344
2579
  try {
2345
- let U = b ? { kind: "opening" } : { kind: "captured", frame: Y(M.scale) };
2346
- b || W().core.cancelGesture(!0);
2347
- const ne = ++K, Ue = b ? pe.reverseOpening() : { kind: "inactive" };
2348
- Ue.kind === "inactive" && pe.cancel(), z.cancel(), y.value = !1, l.value = "closing", a("closing");
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 Me(), ne !== K || re || (document.fullscreenElement === u.value && (await document.exitFullscreen(), await Pe(), await Pe(), U.kind === "captured" && (U.frame = Y(M.scale))), ne !== K || re)) return;
2351
- const Xe = b ? Ee : await i.resolveAnchor(_.value);
2352
- if (ne !== K || re) return;
2353
- const Je = b ? Ee : Rt(Xe, _.value, c());
2354
- if (Ue.kind === "reversing")
2355
- await Ue.finished;
2356
- else if (U.kind === "captured" && Je.kind === "element") {
2357
- const Nt = M.image;
2358
- Ye(Je), g.value = !0, await Me(), await pe.play(
2359
- q.value,
2360
- v.value,
2361
- Nt,
2362
- U.frame,
2363
- Je.frame,
2364
- Je.viewport,
2365
- k.value,
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
- g.value = !1, await we(!1);
2372
- } catch (Xe) {
2373
- a("error", _e(Xe), _.value), await we(!1);
2606
+ m.value = !1, await we(!1);
2607
+ } catch (We) {
2608
+ a("error", Ve(We), H.value), await we(!1);
2374
2609
  }
2375
- if (ne !== K || re) return;
2376
- ze.disconnect(), me = "", ve = "", w.value = 0, l.value = "closed", J.value = Re, oe.clear(), se.clear(), Se(), document.body.style.overflow = ke, a("close"), await Me(), pe.cancel();
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
- M.release(), he === M.release && (he = () => {
2613
+ E.release(), he === E.release && (he = () => {
2379
2614
  });
2380
2615
  }
2381
2616
  }
2382
2617
  async function we(s) {
2383
- const b = ++Be, M = s ? 0 : Number(getComputedStyle(u.value).opacity);
2384
- ye.kind === "active" && ye.animation.cancel(), u.value.style.opacity = String(M);
2385
- const U = u.value.animate([{ opacity: M }, { opacity: s ? 1 : 0 }], {
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: U }, await U.finished.catch(() => {
2390
- }), !(b !== Be || re) && (u.value.style.opacity = s ? "1" : "0", U.cancel(), ye = { kind: "idle" });
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 xe() {
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", _e(s), _.value);
2632
+ a("error", Ve(s), H.value);
2398
2633
  }
2399
2634
  }
2400
- function Ce(s) {
2635
+ function Fe(s) {
2401
2636
  if (i.gesturesEnabled) {
2402
- if (l.value === "opening") {
2403
- ge.start(s);
2637
+ if (o.value === "opening") {
2638
+ de.start(s);
2404
2639
  return;
2405
2640
  }
2406
- l.value === "open" && W().onPointerDown(s, T()) && z.grab();
2641
+ o.value === "open" && N().onPointerDown(s, I()) && A.grab();
2407
2642
  }
2408
2643
  }
2409
- function Qe(s) {
2410
- if (l.value === "opening") {
2411
- i.gesturesEnabled && ge.finish(s, T()) && N();
2644
+ function et(s) {
2645
+ if (o.value === "opening") {
2646
+ i.gesturesEnabled && de.finish(s, I()) && Z();
2412
2647
  return;
2413
2648
  }
2414
- l.value === "open" && (W().onPointerUp(s), l.value === "open" && z.resume());
2649
+ o.value === "open" && (N().onPointerUp(s), o.value === "open" && A.resume());
2415
2650
  }
2416
2651
  function ht(s) {
2417
- ge.clear(), l.value === "open" && (W().onPointerCancel(s), l.value === "open" && z.resume());
2652
+ de.clear(), o.value === "open" && (N().onPointerCancel(s), o.value === "open" && A.resume());
2418
2653
  }
2419
- function Vt(s) {
2420
- l.value === "opening" && ge.clear(), l.value === "open" && s.target === W().core.containerRef.value && ht(s);
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 _t(s) {
2423
- l.value === "opening" && ge.move(s), l.value === "open" && W().onPointerMove(s);
2657
+ function Xt(s) {
2658
+ o.value === "opening" && de.move(s), o.value === "open" && N().onPointerMove(s);
2424
2659
  }
2425
- function Yt(s) {
2426
- l.value === "open" && i.gesturesEnabled && W().onWheel(s);
2660
+ function Wt(s) {
2661
+ o.value === "open" && i.gesturesEnabled && N().onWheel(s);
2427
2662
  }
2428
- function Ut(s) {
2429
- l.value === "open" && (w.value = 1 - s);
2663
+ function Nt(s) {
2664
+ o.value === "open" && (k.value = 1 - s);
2430
2665
  }
2431
- function Xt(s) {
2432
- l.value === "open" && z.drag(s);
2666
+ function Zt(s) {
2667
+ o.value === "open" && A.drag(s);
2433
2668
  }
2434
- function Ht(s, b) {
2435
- l.value === "open" && (y.value = !1, z.release(s, b));
2669
+ function jt(s, S) {
2670
+ o.value === "open" && (B.value = !1, A.release(s, S));
2436
2671
  }
2437
- function Wt(s) {
2438
- $.value = s, s > 1.02 && !i.persistentChrome && (E.value = !1);
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 (!(l.value === "closed" || !i.keyboardEnabled) && !(s.key === "Escape" && document.fullscreenElement === u.value)) {
2676
+ if (!(o.value === "closed" || !i.keyboardEnabled) && !(s.key === "Escape" && document.fullscreenElement === u.value)) {
2442
2677
  if (s.key === "Escape") {
2443
- s.preventDefault(), N();
2678
+ s.preventDefault(), Z();
2444
2679
  return;
2445
2680
  }
2446
- if (!(l.value !== "open" || s.target.matches("input, textarea, select, button, [role='slider']"))) {
2447
- if (_.value.type === "video") {
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(), W().togglePlayback();
2684
+ s.preventDefault(), N().togglePlayback();
2450
2685
  return;
2451
2686
  }
2452
2687
  if (s.key === "Enter") {
2453
- s.preventDefault(), W().toggleFullscreen();
2688
+ s.preventDefault(), N().toggleFullscreen();
2454
2689
  return;
2455
2690
  }
2456
2691
  }
2457
- if (_.value.type === "live-photo" && s.code === "Space") {
2458
- s.preventDefault(), te.toggleLive();
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(), z.go(-1)), s.key === "ArrowRight" && (s.preventDefault(), z.go(1)), (s.key === "+" || s.key === "=") && te.zoomIn(), s.key === "-" && te.zoomOut(), s.key === "0" && te.reset();
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
- }), $e(() => {
2468
- re = !0, K += 1, pe.cancel(), he(), ge.clear(), Be += 1, ye.kind === "active" && ye.animation.cancel(), Se(), ze.disconnect(), document.removeEventListener("keydown", vt), l.value !== "closed" && (document.body.style.overflow = ke);
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
- ...te,
2472
- currentIndex: V,
2473
- phase: l,
2706
+ ...re,
2707
+ currentIndex: Y,
2708
+ phase: o,
2474
2709
  element: u,
2475
- mediaElement: () => W().core.mediaRef.value,
2476
- canvasElement: () => W().core.canvasRef.value
2477
- }), (s, b) => (O(), at(Ct, {
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
- l.value !== "closed" ? (O(), A("div", We({
2716
+ o.value !== "closed" ? (O(), _("div", je({
2482
2717
  key: 0,
2483
2718
  ref_key: "root",
2484
2719
  ref: u
2485
- }, f(e), {
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": _.value.title,
2490
- "data-phase": l.value,
2491
- "data-chrome": E.value ? "visible" : "hidden",
2492
- inert: l.value === "closing",
2493
- onPointerdown: Ce,
2494
- onPointermove: _t,
2495
- onPointerup: Qe,
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: Vt,
2498
- onWheel: Yt
2732
+ onLostpointercapture: Ht,
2733
+ onWheel: Wt
2499
2734
  }), [
2500
- B("div", {
2735
+ T("div", {
2501
2736
  ref_key: "backdrop",
2502
- ref: k,
2737
+ ref: b,
2503
2738
  class: "mp-viewer__backdrop",
2504
- style: Le({ opacity: w.value })
2739
+ style: me({ opacity: k.value })
2505
2740
  }, null, 4),
2506
- B("div", {
2507
- id: r,
2741
+ T("div", {
2742
+ id: l,
2508
2743
  class: "mp-viewer__video-controls"
2509
2744
  }),
2510
- B("div", {
2745
+ T("div", {
2511
2746
  ref_key: "mediaViewport",
2512
- ref: p,
2513
- class: Ie(["mp-viewer__pages", { "is-transitioning": g.value }])
2747
+ ref: f,
2748
+ class: De(["mp-viewer__pages", { "is-transitioning": m.value }])
2514
2749
  }, [
2515
- (O(!0), A(Fe, null, Ne(Ge.value, (M) => (O(), A("div", {
2516
- key: s.items[M].id,
2750
+ (O(!0), _($e, null, Ye(Je.value, (E) => (O(), _("div", {
2751
+ key: s.items[E].id,
2517
2752
  ref_for: !0,
2518
- ref: ce(s.items[M].id),
2753
+ ref: Pe(s.items[E].id),
2519
2754
  class: "mp-viewer__page",
2520
- style: Le({
2521
- transform: `translate3d(${(M - f(V)) * f(z).stride() + f(z).state.offset}px,0,0)`,
2522
- transition: f(z).state.settling ? `transform ${f(z).state.duration}ms cubic-bezier(.22,.61,.36,1)` : "none"
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": M !== f(V),
2525
- inert: M !== f(V),
2526
- "data-media-id": s.items[M].id
2759
+ "aria-hidden": E !== p(Y),
2760
+ inert: E !== p(Y),
2761
+ "data-media-id": s.items[E].id
2527
2762
  }, [
2528
- De(ga, {
2763
+ ze(Pa, {
2529
2764
  ref_for: !0,
2530
- ref: de(s.items[M].id),
2531
- media: s.items[M],
2765
+ ref: ne(s.items[E].id),
2766
+ media: s.items[E],
2532
2767
  "video-loader": s.videoLoader,
2533
- rendering: l.value === "open",
2534
- paging: f(z).state.dragging || f(z).state.preparing || f(z).state.settling || f(z).state.grabbed,
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: M === f(V),
2537
- disabled: l.value !== "open" || !s.gesturesEnabled,
2538
- "inactive-reset-duration": f(z).state.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": M === f(V) ? f(R) : 0,
2542
- "load-enabled": M === f(V) ? Z.value && l.value === "open" : l.value === "open" && !g.value && f(x) === _.value.id,
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": `#${r}`,
2545
- "controls-visible": E.value && w.value === 1,
2546
- "initial-image": s.items[M].id === f(ie) ? J.value : f(Re),
2547
- quality: M === f(V) && f(S).has(s.items[M].id) ? "full" : M === f(V) ? "screen" : "thumbnail",
2548
- "live-playing": y.value,
2549
- onTap: st,
2550
- onScale: Wt,
2551
- onPageDrag: Xt,
2552
- onPageRelease: Ht,
2553
- onClose: N,
2554
- onSwipeDownProgress: Ut,
2555
- onLiveState: (U) => {
2556
- M === f(V) && (h.value = U);
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
- M === f(V) && (y.value = !1);
2794
+ E === p(Y) && (B.value = !1);
2560
2795
  },
2561
- onReady: (U) => ot(M, U),
2562
- onOriginalState: (U, ne) => rt(M, U, ne),
2563
- onError: (U) => a("error", U, s.items[M])
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, ka))), 128))
2800
+ ], 12, qa))), 128))
2566
2801
  ], 2),
2567
- en(B("div", {
2802
+ Lt(T("div", {
2568
2803
  ref_key: "transitionMask",
2569
- ref: v,
2804
+ ref: h,
2570
2805
  class: "mp-shared-clip",
2571
2806
  "aria-hidden": "true"
2572
2807
  }, [
2573
- B("canvas", {
2808
+ T("canvas", {
2574
2809
  ref_key: "transitionCanvas",
2575
- ref: q,
2810
+ ref: D,
2576
2811
  class: "mp-shared-transition"
2577
2812
  }, null, 512)
2578
2813
  ], 512), [
2579
- [tn, g.value]
2814
+ [Ft, m.value]
2580
2815
  ]),
2581
- l.value === "opening" && !H.value ? (O(), A("div", xa, Sa)) : le("", !0),
2582
- B("div", {
2583
- class: Ie(["mp-viewer__chrome", { "is-hidden": !E.value || l.value !== "open" || w.value < 1 }]),
2584
- inert: !E.value || l.value !== "open" || w.value < 1
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
- ut(s.$slots, "toolbar", {
2587
- media: _.value,
2588
- index: f(V),
2821
+ ct(s.$slots, "toolbar", {
2822
+ media: H.value,
2823
+ index: p(Y),
2589
2824
  total: s.items.length,
2590
- scale: $.value,
2591
- controls: te,
2592
- originalStatus: f(C),
2593
- originalReason: f(P),
2594
- livePlaying: y.value,
2595
- liveStatus: h.value
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
- B("header", Ra, [
2598
- B("button", {
2832
+ T("header", Aa, [
2833
+ T("button", {
2599
2834
  type: "button",
2600
2835
  "aria-label": "关闭预览",
2601
- onClick: N
2836
+ onClick: Z
2602
2837
  }, "‹"),
2603
- B("div", Ea, [
2604
- B("strong", null, fe(_.value.title), 1),
2605
- B("span", null, fe(f(V) + 1) + " / " + fe(s.items.length), 1)
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
- B("button", {
2842
+ T("button", {
2608
2843
  type: "button",
2609
2844
  "aria-label": "旋转图片",
2610
- disabled: _.value.type === "video",
2611
- onClick: b[0] || (b[0] = (M) => te.rotate())
2612
- }, " ↻ ", 8, Ca)
2845
+ disabled: H.value.type === "video",
2846
+ onClick: S[0] || (S[0] = (E) => re.rotate())
2847
+ }, " ↻ ", 8, _a)
2613
2848
  ]),
2614
- B("footer", La, [
2615
- _.value.type !== "video" ? (O(), A(Fe, { key: 0 }, [
2616
- B("button", {
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: b[1] || (b[1] = //@ts-ignore
2620
- (...M) => te.zoomOut && te.zoomOut(...M))
2854
+ onClick: S[1] || (S[1] = //@ts-ignore
2855
+ (...E) => re.zoomOut && re.zoomOut(...E))
2621
2856
  }, "−"),
2622
- B("button", {
2857
+ T("button", {
2623
2858
  type: "button",
2624
2859
  "aria-label": "放大",
2625
- onClick: b[2] || (b[2] = //@ts-ignore
2626
- (...M) => te.zoomIn && te.zoomIn(...M))
2860
+ onClick: S[2] || (S[2] = //@ts-ignore
2861
+ (...E) => re.zoomIn && re.zoomIn(...E))
2627
2862
  }, "+"),
2628
- B("button", {
2863
+ T("button", {
2629
2864
  type: "button",
2630
2865
  "aria-label": "复位",
2631
- onClick: b[3] || (b[3] = //@ts-ignore
2632
- (...M) => te.reset && te.reset(...M))
2866
+ onClick: S[3] || (S[3] = //@ts-ignore
2867
+ (...E) => re.reset && re.reset(...E))
2633
2868
  }, "复位")
2634
- ], 64)) : le("", !0),
2635
- B("button", {
2869
+ ], 64)) : J("", !0),
2870
+ T("button", {
2636
2871
  type: "button",
2637
2872
  "aria-label": "图片详情",
2638
- onClick: b[4] || (b[4] = //@ts-ignore
2639
- (...M) => te.toggleDetail && te.toggleDetail(...M))
2873
+ onClick: S[4] || (S[4] = //@ts-ignore
2874
+ (...E) => re.toggleDetail && re.toggleDetail(...E))
2640
2875
  }, "ⓘ")
2641
2876
  ])
2642
2877
  ]),
2643
- !s.mobile && f(V) > 0 ? (O(), A("button", {
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: b[5] || (b[5] = (M) => f(z).go(-1))
2648
- }, " ‹ ")) : le("", !0),
2649
- !s.mobile && f(V) < s.items.length - 1 ? (O(), A("button", {
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: b[6] || (b[6] = (M) => f(z).go(1))
2654
- }, " › ")) : le("", !0),
2655
- B("div", Fa, fe(f(V) + 1) + " / " + fe(s.items.length), 1)
2656
- ], 10, Pa),
2657
- D.value ? (O(), A("aside", $a, [
2658
- B("button", {
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: b[7] || (b[7] = (M) => D.value = !1)
2896
+ onClick: S[7] || (S[7] = (E) => F.value = !1)
2662
2897
  }, "×"),
2663
- B("strong", null, fe(_.value.title), 1),
2664
- B("span", null, fe(_.value.width) + " × " + fe(_.value.height), 1),
2665
- B("span", null, fe(_.value.type) + " · " + fe($.value.toFixed(2)) + "×", 1)
2666
- ])) : le("", !0)
2667
- ], 16, ba)) : le("", !0)
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 Ta(t, n, o, e = 2) {
2672
- const i = Math.max(1, (n - e * (o - 1)) / o), a = [], l = /* @__PURE__ */ new Map();
2673
- let r = 0, u = 0;
2674
- return t.forEach((p, d) => {
2675
- d > 0 && (a.push({ kind: "header", group: d, first: 0, count: 0, start: r, end: r + 52 }), r += 52);
2676
- for (let S = 0; S < p.items.length; S += o) {
2677
- const C = Math.min(o, p.items.length - S), P = a.length;
2678
- a.push({ kind: "items", group: d, first: S, count: C, start: r, end: r + i });
2679
- for (let R = 0; R < C; R++) l.set(p.items[S + R].id, P);
2680
- u += C, r += i + (S + C < p.items.length ? e : 0);
2681
- }
2682
- }), { rows: a, locations: l, height: r, size: i, total: u };
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 Et(t, n) {
2685
- let o = 0, e = t.length;
2686
- for (; o < e; ) {
2687
- const i = o + e >>> 1;
2688
- t[i].end < n ? o = i + 1 : e = i;
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(o, Math.max(0, t.length - 1));
2925
+ return Math.min(r, Math.max(0, t.length - 1));
2691
2926
  }
2692
- const Ba = ["data-total-items", "data-rendered-items"], za = /* @__PURE__ */ Te({
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: o }) {
2702
- const e = t, i = o, a = L(), l = L(390), r = L(844), u = L(0), p = X(
2703
- () => e.mobile ? l.value >= 640 ? 5 : l.value >= 480 ? 4 : 3 : Math.max(1, Math.floor((l.value + 2) / 172))
2704
- ), d = X(() => Ta(e.groups, l.value, p.value)), S = X(() => {
2705
- const k = d.value.rows, g = Et(k, Math.max(0, u.value - d.value.size * 3)), w = u.value + r.value + d.value.size * 3;
2706
- let E = g;
2707
- for (; E < k.length && k[E].start <= w; ) E++;
2708
- return k.slice(g, E);
2709
- }), C = X(() => S.value.reduce((k, g) => k + g.count, 0));
2710
- let P = 0, R = !1, x = () => {
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 m() {
2713
- const k = e.scrollElement();
2714
- l.value = k.clientWidth, r.value = k.clientHeight, u.value = k.scrollTop, d.value.rows.length > 0 && i("date", e.groups[d.value.rows[Et(d.value.rows, u.value)].group].key);
2715
- const g = u.value + r.value >= d.value.height - d.value.size * 3;
2716
- g && e.hasMore && !R && (R = !0, i("loadMore")), g || (R = !1);
2717
- }
2718
- function F() {
2719
- P === 0 && (P = requestAnimationFrame(() => {
2720
- P = 0, m();
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 q = new ResizeObserver(m);
2958
+ const D = new ResizeObserver(g);
2724
2959
  qe(() => {
2725
- const k = e.scrollElement(), g = k.style.overflowAnchor;
2726
- k.style.overflowAnchor = "none", x = () => {
2727
- k.style.overflowAnchor = g;
2728
- }, k.addEventListener("scroll", F, { passive: !0 }), q.observe(k), m();
2729
- }), $e(() => {
2730
- e.scrollElement().removeEventListener("scroll", F), q.disconnect(), cancelAnimationFrame(P), x();
2731
- }), ee(
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, Me(m);
2969
+ R = !1, Se(g);
2735
2970
  }
2736
2971
  );
2737
- async function v(k) {
2738
- if (!d.value.locations.has(k)) return { kind: "unavailable" };
2739
- const g = d.value.rows[d.value.locations.get(k)], w = e.scrollElement();
2740
- return (g.start < w.scrollTop || g.end > w.scrollTop + w.clientHeight) && (w.scrollTop = Math.max(0, g.start - (w.clientHeight - d.value.size) / 2)), m(), await Me(), await new Promise((y) => requestAnimationFrame(() => y())), { kind: "element", element: [...a.value.querySelectorAll("[data-id]")].find(
2741
- (y) => y.dataset.id === k
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: v, rendered: C, total: X(() => d.value.total) }), (k, g) => (O(), A("div", {
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: Le({ height: d.value.height + "px" }),
2749
- "data-total-items": d.value.total,
2750
- "data-rendered-items": C.value
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), A(Fe, null, Ne(S.value, (w) => (O(), A("div", {
2753
- key: k.groups[w.group].key + ":" + w.kind + ":" + w.first,
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: Le({
2756
- top: w.start + "px",
2757
- height: w.end - w.start + "px",
2758
- display: w.kind === "items" ? "grid" : "block",
2759
- gridTemplateColumns: `repeat(${p.value},minmax(0,1fr))`,
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
- w.kind === "header" ? ut(k.$slots, "header", {
2998
+ k.kind === "header" ? ct(b.$slots, "header", {
2764
2999
  key: 0,
2765
- group: k.groups[w.group],
2766
- index: w.group
2767
- }, void 0, !0) : (O(!0), A(Fe, { key: 1 }, Ne(k.groups[w.group].items.slice(w.first, w.first + w.count), (E) => ut(k.$slots, "item", {
2768
- key: E.id,
2769
- item: E
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, Ba));
3007
+ ], 12, Xa));
2773
3008
  }
2774
- }), Da = (t, n) => {
2775
- const o = t.__vccOpts || t;
3009
+ }), Na = (t, n) => {
3010
+ const r = t.__vccOpts || t;
2776
3011
  for (const [e, i] of n)
2777
- o[e] = i;
2778
- return o;
2779
- }, Aa = /* @__PURE__ */ Da(za, [["__scopeId", "data-v-05c756fb"]]);
3012
+ r[e] = i;
3013
+ return r;
3014
+ }, Ka = /* @__PURE__ */ Na(Wa, [["__scopeId", "data-v-05c756fb"]]);
2780
3015
  export {
2781
- pt as ImageCanvasRenderer,
2782
- Sn as ImageStore,
2783
- Yn as LivePhotoRenderer,
2784
- Oa as MediaPreview,
2785
- ga as PreviewStage,
2786
- da as VideoDomRenderer,
2787
- Aa as VirtualTimeline,
2788
- je as defaultImagePolicy,
2789
- Ke as defaultImageSource,
2790
- Ve as formatVideoTime,
2791
- it as nativeVideoSource,
2792
- Pn as previewImageStore,
2793
- pn as usePreviewViewport
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
  };