@validol4ik/uikit 0.14.7 → 0.14.8

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,66 +1,65 @@
1
- var $ = (t) => {
1
+ var ne = (t) => {
2
2
  throw TypeError(t);
3
3
  };
4
- var H = (t, r, e) => r.has(t) || $("Cannot " + e);
5
- var R = (t, r, e) => (H(t, r, "read from private field"), e ? e.call(t) : r.get(t)), A = (t, r, e) => r.has(t) ? $("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(t) : r.set(t, e), z = (t, r, e, s) => (H(t, r, "write to private field"), s ? s.call(t, e) : r.set(t, e), e), ee = (t, r, e) => (H(t, r, "access private method"), e);
6
- import { ref as k, onBeforeUnmount as oe, defineComponent as he, watch as te, onMounted as ye, createElementBlock as D, openBlock as O, unref as T, createCommentVNode as re, createElementVNode as F, normalizeClass as se, toDisplayString as ge, nextTick as Re } from "vue";
7
- import ae from "quasar/src/plugins/storage/LocalStorage.js";
8
- import { V as _, D as Se, S as _e, a as ne, b as we, E as Te, c as be, d as Le, B as ke, e as Pe, P as Ae, R as De, W as Oe, f as Ce } from "../types-BzvY-lmh.js";
9
- import { _ as Ie } from "../_plugin-vue_export-helper-CHgC5LLL.js";
10
- const ze = (t, r, e) => {
11
- var a;
12
- const s = (u) => !e.includes(u);
13
- return t.hlsSrc && r.hls && s(_.Hls) ? _.Hls : t.dashSrc && r.dash && s(_.Dash) ? _.Dash : (a = t.sources) != null && a.length && s(_.Progressive) ? _.Progressive : null;
14
- }, Ve = () => {
15
- var s, a;
4
+ var x = (t, r, e) => r.has(t) || ne("Cannot " + e);
5
+ var b = (t, r, e) => (x(t, r, "read from private field"), e ? e.call(t) : r.get(t)), I = (t, r, e) => r.has(t) ? ne("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(t) : r.set(t, e), M = (t, r, e, s) => (x(t, r, "write to private field"), s ? s.call(t, e) : r.set(t, e), e), oe = (t, r, e) => (x(t, r, "access private method"), e);
6
+ import { ref as P, onBeforeUnmount as de, defineComponent as ke, computed as Se, watch as F, onMounted as Re, createElementBlock as k, openBlock as S, unref as w, createCommentVNode as O, createElementVNode as G, normalizeClass as ie, toDisplayString as _e, nextTick as we } from "vue";
7
+ import { V as T, D as Te, S as Le, a as le, b as Pe, E as Ae, c as Oe, d as De, B as Ce, e as ce, P as Ie, f as Ve, r as ze, g as Me, t as Ke, W as Ne, h as Be } from "../playback-DxTLyUrL.js";
8
+ import { _ as Ue } from "../_plugin-vue_export-helper-CHgC5LLL.js";
9
+ const He = (t, r, e) => {
10
+ var n;
11
+ const s = (l) => !e.includes(l);
12
+ return t.hlsSrc && r.hls && s(T.Hls) ? T.Hls : t.dashSrc && r.dash && s(T.Dash) ? T.Dash : (n = t.sources) != null && n.length && s(T.Progressive) ? T.Progressive : null;
13
+ }, We = () => {
14
+ var s, n;
16
15
  const { ManagedMediaSource: t, MediaSource: r, WebKitMediaSource: e } = window;
17
- return !!((a = (s = t ?? r ?? e) == null ? void 0 : s.isTypeSupported) != null && a.call(s, Se));
18
- }, Me = (t) => _e.filter((r) => t.includes(r)), Ke = (t) => {
19
- const r = Me(t.map(({ size: s }) => s)), e = r.includes(ne) ? ne : r[0];
16
+ return !!((n = (s = t ?? r ?? e) == null ? void 0 : s.isTypeSupported) != null && n.call(s, Te));
17
+ }, Ye = (t) => Le.filter((r) => t.includes(r)), $e = (t) => {
18
+ const r = Ye(t.map(({ size: s }) => s)), e = r.includes(le) ? le : r[0];
20
19
  return t.find((s) => s.size === e) ?? t[0] ?? null;
21
- }, Ne = () => /iPhone|iPod/.test(navigator.userAgent), xe = () => Ne() || /iPad/.test(navigator.userAgent) || /Macintosh/.test(navigator.userAgent) && navigator.maxTouchPoints > 1;
22
- var M, C, K, P, L, V, ie;
23
- class Be extends EventTarget {
24
- constructor(e, s, a) {
20
+ }, je = () => /iPhone|iPod/.test(navigator.userAgent), xe = () => je() || /iPad/.test(navigator.userAgent) || /Macintosh/.test(navigator.userAgent) && navigator.maxTouchPoints > 1;
21
+ var N, V, B, C, A, K, pe;
22
+ class Fe extends EventTarget {
23
+ constructor(e, s, n) {
25
24
  super();
26
- A(this, L);
27
- A(this, M);
28
- A(this, C);
29
- A(this, K);
30
- A(this, P, -1);
31
- z(this, M, e), z(this, C, [...s].sort((u, i) => i.size - u.size)), z(this, K, a);
25
+ I(this, A);
26
+ I(this, N);
27
+ I(this, V);
28
+ I(this, B);
29
+ I(this, C, -1);
30
+ M(this, N, e), M(this, V, [...s].sort((l, i) => i.size - l.size)), M(this, B, n);
32
31
  }
33
32
  get selectedIndex() {
34
- return R(this, P);
33
+ return b(this, C);
35
34
  }
36
35
  set selectedIndex(e) {
37
- const s = R(this, L, V);
38
- z(this, P, e), R(this, L, V) !== s && ee(this, L, ie).call(this), this.dispatchEvent(new Event("change"));
36
+ const s = b(this, A, K);
37
+ M(this, C, e), b(this, A, K) !== s && oe(this, A, pe).call(this), this.dispatchEvent(new Event("change"));
39
38
  }
40
39
  *[Symbol.iterator]() {
41
- for (const [e, s] of R(this, C).entries())
40
+ for (const [e, s] of b(this, V).entries())
42
41
  yield {
43
42
  id: String(s.size),
44
43
  height: s.size,
45
- selected: e === R(this, P),
46
- active: s === R(this, L, V)
44
+ selected: e === b(this, C),
45
+ active: s === b(this, A, K)
47
46
  };
48
47
  }
49
48
  }
50
- M = new WeakMap(), C = new WeakMap(), K = new WeakMap(), P = new WeakMap(), L = new WeakSet(), V = function() {
51
- return R(this, C)[R(this, P)] ?? R(this, K);
49
+ N = new WeakMap(), V = new WeakMap(), B = new WeakMap(), C = new WeakMap(), A = new WeakSet(), K = function() {
50
+ return b(this, V)[b(this, C)] ?? b(this, B);
52
51
  }, // Loading a new src resets the position and speed
53
- ie = function() {
54
- const e = R(this, M), s = e.currentTime, a = e.playbackRate, u = !e.paused;
52
+ pe = function() {
53
+ const e = b(this, N), s = e.currentTime, n = e.playbackRate, l = !e.paused;
55
54
  e.addEventListener(
56
55
  "loadedmetadata",
57
56
  () => {
58
- s && (e.currentTime = s), e.playbackRate = a, u && e.play();
57
+ s && (e.currentTime = s), e.playbackRate = n, l && e.play();
59
58
  },
60
59
  { once: !0 }
61
- ), s && (e.preload = "metadata"), e.src = R(this, L, V).src;
60
+ ), s && (e.preload = "metadata"), e.src = b(this, A, K).src;
62
61
  };
63
- const He = (t, r) => {
62
+ const Ge = (t, r) => {
64
63
  t.preload = "metadata", t.addEventListener(
65
64
  "loadedmetadata",
66
65
  () => {
@@ -69,116 +68,116 @@ const He = (t, r) => {
69
68
  },
70
69
  { once: !0 }
71
70
  );
72
- }, le = () => {
71
+ }, fe = () => {
73
72
  let t = 0, r = 0;
74
73
  return (e) => {
75
74
  const s = Date.now();
76
- if (s - r > Le && (t = 0), r = s, t >= Te) return !1;
77
- const a = t++;
78
- return setTimeout(() => e(a), be * 2 ** a), !0;
75
+ if (s - r > De && (t = 0), r = s, t >= Ae) return !1;
76
+ const n = t++;
77
+ return setTimeout(() => e(n), Oe * 2 ** n), !0;
79
78
  };
80
- }, ue = (t, r) => {
81
- const { currentTime: e, playbackRate: s, paused: a } = t;
79
+ }, me = (t, r) => {
80
+ const { currentTime: e, playbackRate: s, paused: n } = t;
82
81
  return () => {
83
82
  t.addEventListener(
84
83
  "loadedmetadata",
85
84
  () => {
86
- t.currentTime = e, t.playbackRate = s, a || t.play().catch(() => {
85
+ t.currentTime = e, t.playbackRate = s, n || t.play().catch(() => {
87
86
  });
88
87
  },
89
88
  { once: !0 }
90
89
  ), r(e);
91
90
  };
92
- }, Fe = (t, r, e) => {
91
+ }, qe = (t, r, e) => {
93
92
  let s = null;
94
- const a = le();
93
+ const n = fe();
95
94
  t.addEventListener("loadstart", () => {
96
95
  if (!t.engine || t.engine === s) return;
97
96
  const i = t.engine;
98
97
  s = i;
99
- const c = () => t.engine === i;
100
- i.on(r.Events.ERROR, async (p, d) => {
101
- var n;
102
- if (!d.fatal) return;
103
- const m = (E) => {
104
- var h, y;
98
+ const f = () => t.engine === i;
99
+ i.on(r.Events.ERROR, async (d, p) => {
100
+ var R;
101
+ if (!p.fatal) return;
102
+ const h = (o) => {
103
+ var m, E;
105
104
  return e.report({
106
- type: d.type,
107
- details: d.details,
108
- status: (h = d.response) == null ? void 0 : h.code,
109
- url: ((y = d.frag) == null ? void 0 : y.url) ?? d.url,
110
- recovering: E
105
+ type: p.type,
106
+ details: p.details,
107
+ status: (m = p.response) == null ? void 0 : m.code,
108
+ url: ((E = p.frag) == null ? void 0 : E.url) ?? p.url,
109
+ recovering: o
111
110
  });
112
- }, S = () => {
113
- m(!0), e.dismissError();
111
+ }, u = () => {
112
+ h(!0), e.dismissError();
114
113
  };
115
- if (d.type === r.ErrorTypes.NETWORK_ERROR) {
116
- if (((n = d.response) == null ? void 0 : n.code) === 401 && await e.reauthorize()) {
117
- S(), i.startLoad(t.currentTime);
114
+ if (p.type === r.ErrorTypes.NETWORK_ERROR) {
115
+ if (((R = p.response) == null ? void 0 : R.code) === 401 && await e.reauthorize()) {
116
+ u(), i.startLoad(t.currentTime);
118
117
  return;
119
118
  }
120
- if (e.hasLoaded() && a(() => c() && i.startLoad(t.currentTime))) {
121
- S();
119
+ if (e.hasLoaded() && n(() => f() && i.startLoad(t.currentTime))) {
120
+ u();
122
121
  return;
123
122
  }
124
- } else if (d.type === r.ErrorTypes.MEDIA_ERROR && e.hasLoaded() && a((E) => {
125
- c() && (E > 0 && i.swapAudioCodec(), i.recoverMediaError());
123
+ } else if (p.type === r.ErrorTypes.MEDIA_ERROR && e.hasLoaded() && n((o) => {
124
+ f() && (o > 0 && i.swapAudioCodec(), i.recoverMediaError());
126
125
  })) {
127
- S();
126
+ u();
128
127
  return;
129
128
  }
130
- m(!1), e.fail();
129
+ h(!1), e.fail();
131
130
  }), i.on(r.Events.FRAG_LOADED, e.loaded);
132
131
  }), t.addEventListener("error", async () => {
133
132
  if (t.engine) return;
134
- const i = ue(t, () => t.load()), c = (d) => {
135
- var m;
133
+ const i = me(t, () => t.load()), f = (p) => {
134
+ var h;
136
135
  return e.report({
137
136
  type: "nativeError",
138
- details: String(((m = t.error) == null ? void 0 : m.code) ?? ""),
139
- recovering: d
137
+ details: String(((h = t.error) == null ? void 0 : h.code) ?? ""),
138
+ recovering: p
140
139
  });
141
140
  };
142
- if ((await e.reauthorize() || e.hasLoaded()) && a(() => t.isConnected && i())) {
143
- c(!0), e.dismissError();
141
+ if ((await e.reauthorize() || e.hasLoaded()) && n(() => t.isConnected && i())) {
142
+ f(!0), e.dismissError();
144
143
  return;
145
144
  }
146
- c(!1), e.fail();
145
+ f(!1), e.fail();
147
146
  }), t.addEventListener("loadeddata", e.loaded);
148
- const u = xe();
149
- e.withCredentials && !u && (t.crossOrigin = "use-credentials"), t.source = {
147
+ const l = xe();
148
+ e.withCredentials && !l && (t.crossOrigin = "use-credentials"), t.source = {
150
149
  src: e.src,
151
- preferPlayback: u ? "native" : "mse"
150
+ preferPlayback: l ? "native" : "mse"
152
151
  };
153
- }, We = (t, r) => {
152
+ }, Je = (t, r) => {
154
153
  const e = t.engine;
155
154
  e.setXHRWithCredentialsForType("default", r.withCredentials);
156
- const s = le(), a = () => ue(
155
+ const s = fe(), n = () => me(
157
156
  t,
158
- (u) => e.attachSource(r.src, u)
157
+ (l) => e.attachSource(r.src, l)
159
158
  );
160
- e.on("error", async (u) => {
161
- var d, m;
162
- const i = u.error, c = (m = (d = i.data) == null ? void 0 : d.response) == null ? void 0 : m.status, p = (S) => r.report({
159
+ e.on("error", async (l) => {
160
+ var p, h;
161
+ const i = l.error, f = (h = (p = i.data) == null ? void 0 : p.response) == null ? void 0 : h.status, d = (u) => r.report({
163
162
  type: "dashError",
164
163
  details: String(i.code ?? ""),
165
- status: c,
166
- recovering: S
164
+ status: f,
165
+ recovering: u
167
166
  });
168
- if (c === 401) {
167
+ if (f === 401) {
169
168
  if (await r.reauthorize()) {
170
- p(!0), a()();
169
+ d(!0), n()();
171
170
  return;
172
171
  }
173
- } else if (!we.includes(i.code ?? -1))
172
+ } else if (!Pe.includes(i.code ?? -1))
174
173
  return;
175
- p(!1), r.fail();
174
+ d(!1), r.fail();
176
175
  }), e.on("fragmentLoadingCompleted", r.loaded), t.addEventListener("error", () => {
177
- var c;
178
- const u = a(), i = r.hasLoaded() && s(() => t.isConnected && u());
176
+ var f;
177
+ const l = n(), i = r.hasLoaded() && s(() => t.isConnected && l());
179
178
  r.report({
180
179
  type: "mediaError",
181
- details: String(((c = t.error) == null ? void 0 : c.code) ?? ""),
180
+ details: String(((f = t.error) == null ? void 0 : f.code) ?? ""),
182
181
  recovering: i
183
182
  }), i ? r.dismissError() : r.fail();
184
183
  }), t.source = {
@@ -193,62 +192,83 @@ const He = (t, r) => {
193
192
  }
194
193
  }
195
194
  };
196
- }, Ye = (t, r) => {
197
- const e = Ke(r);
195
+ }, Qe = (t, r) => {
196
+ const e = $e(r);
198
197
  e && (Object.assign(t, {
199
- videoRenditions: new Be(t, r, e)
198
+ videoRenditions: new Fe(t, r, e)
200
199
  }), t.src = e.src);
201
- }, Ue = "media-controls-content, .media-popup, media-error-dialog", Ge = (t) => t instanceof Element && t.matches(Ue), qe = (t) => {
202
- const r = k(!1);
203
- let e, s = 1, a = null;
204
- const u = () => {
205
- var n;
206
- return (n = t.value) == null ? void 0 : n.store;
207
- }, i = () => {
208
- const n = u();
209
- !n || n.paused || (s = n.playbackRate, n.setPlaybackRate(Pe), r.value = !0);
210
- }, c = () => {
211
- var n;
212
- return clearTimeout(e), a == null || a(), a = null, r.value ? (r.value = !1, (n = u()) == null || n.setPlaybackRate(s), !0) : !1;
213
- }, p = (n, E, h) => {
214
- c(), E && (e = setTimeout(i, ke));
215
- const y = (f) => {
216
- if (f instanceof KeyboardEvent) {
217
- if (f.key !== " ") return;
218
- f.preventDefault(), f.stopPropagation();
200
+ }, Xe = "media-controls-content, .media-popup, media-error-dialog", Ze = (t) => t instanceof Element && t.matches(Xe), et = (t) => {
201
+ const r = P(!1);
202
+ let e, s = 1, n = !1, l = null;
203
+ const i = () => {
204
+ var o;
205
+ return (o = t.value) == null ? void 0 : o.store;
206
+ }, f = () => {
207
+ n = !0;
208
+ const o = i();
209
+ !o || o.paused || o.playbackRate >= ce || (s = o.playbackRate, o.setPlaybackRate(ce), r.value = !0);
210
+ }, d = () => {
211
+ var m;
212
+ clearTimeout(e), l == null || l(), l = null;
213
+ const o = n;
214
+ return n = !1, r.value && (r.value = !1, (m = i()) == null || m.setPlaybackRate(s)), o;
215
+ }, p = (o, m, E) => {
216
+ d(), m && (e = setTimeout(f, Ce));
217
+ const _ = (v) => {
218
+ if (v instanceof KeyboardEvent) {
219
+ if (v.key !== " ") return;
220
+ v.preventDefault(), v.stopPropagation();
219
221
  }
220
- const w = c();
221
- h == null || h(w);
222
+ const L = d();
223
+ E == null || E(L);
222
224
  };
223
- n.forEach((f) => window.addEventListener(f, y, !0)), window.addEventListener("blur", c), a = () => {
224
- n.forEach(
225
- (f) => window.removeEventListener(f, y, !0)
226
- ), window.removeEventListener("blur", c);
225
+ o.forEach((v) => window.addEventListener(v, _, !0)), window.addEventListener("blur", d), l = () => {
226
+ o.forEach(
227
+ (v) => window.removeEventListener(v, _, !0)
228
+ ), window.removeEventListener("blur", d);
227
229
  };
228
- }, d = (n) => {
229
- var f;
230
- if (n.key !== " " || n.altKey || n.ctrlKey || n.metaKey)
230
+ }, h = (o) => {
231
+ var v;
232
+ if (o.key !== " " || o.altKey || o.ctrlKey || o.metaKey)
231
233
  return;
232
- if (n.repeat) {
233
- a && (n.preventDefault(), n.stopPropagation());
234
+ if (o.repeat) {
235
+ l && (o.preventDefault(), o.stopPropagation());
234
236
  return;
235
237
  }
236
- const E = u(), h = document.activeElement;
237
- if (!E || !h || !((f = t.value) != null && f.contains(h))) return;
238
- n.preventDefault(), n.stopPropagation();
239
- const y = E.paused;
240
- y && E.play(), p(["keyup"], !y, (w) => {
241
- !y && !w && E.pause();
238
+ const m = i(), E = document.activeElement;
239
+ if (!m || !E || !((v = t.value) != null && v.contains(E))) return;
240
+ o.preventDefault(), o.stopPropagation();
241
+ const _ = m.paused;
242
+ _ && m.play(), p(["keyup"], !_, (L) => {
243
+ !_ && !L && m.pause();
242
244
  });
243
- }, m = (n) => {
244
- const E = u();
245
- !E || E.paused || n.button !== 0 || n.composedPath().some(Ge) || p(["pointerup", "pointercancel"], !0);
246
- }, S = (n) => {
247
- r.value && n.preventDefault();
245
+ }, u = (o) => {
246
+ const m = i();
247
+ !m || m.paused || o.button !== 0 || o.composedPath().some(Ze) || p(["pointerup", "pointercancel"], !0);
248
+ }, R = (o) => {
249
+ r.value && o.preventDefault();
248
250
  };
249
- return oe(c), { boosted: r, release: c, onKeyDown: d, onPointerDown: m, onContextMenu: S };
250
- }, W = "app-video-player", je = "linear-gradient(to top, rgb(0 0 0 / 0.15), rgb(0 0 0 / 0.05), rgb(0 0 0 / 0.02))", Je = async () => {
251
- if (customElements.get(W)) return;
251
+ return de(d), { boosted: r, release: d, onKeyDown: h, onPointerDown: u, onContextMenu: R };
252
+ }, tt = 359999.999, Y = (t, r = 2) => String(t).padStart(r, "0"), ue = (t) => {
253
+ const r = Math.round(t * 1e3), e = Math.floor(r / 36e5), s = Math.floor(r / 6e4) % 60, n = Math.floor(r / 1e3) % 60;
254
+ return `${Y(e)}:${Y(s)}:${Y(n)}.${Y(r % 1e3, 3)}`;
255
+ }, rt = (t) => t.replace(/\s+/g, " ").replace(/-->/g, "->").trim(), st = (t) => {
256
+ const r = [...t].sort((s, n) => s.start - n.start);
257
+ return `${["WEBVTT", ...r.map((s, n) => {
258
+ var i;
259
+ const l = ((i = r[n + 1]) == null ? void 0 : i.start) ?? tt;
260
+ return `${ue(s.start)} --> ${ue(l)}
261
+ ${rt(s.title)}`;
262
+ })].join(`
263
+
264
+ `)}
265
+ `;
266
+ }, q = "app-video-player", at = `linear-gradient(to top,
267
+ color-mix(in oklab, var(--media-backdrop) 40%, transparent),
268
+ color-mix(in oklab, var(--media-backdrop) 12%, transparent) 50%,
269
+ color-mix(in oklab, var(--media-backdrop) 2%, transparent) 75%,
270
+ transparent)`, nt = async () => {
271
+ if (customElements.get(q)) return;
252
272
  const [{ createPlayer: t, definePlayerFeature: r }, { videoFeatures: e }] = await Promise.all([
253
273
  import("@videojs/html"),
254
274
  import("@videojs/html/video")
@@ -256,32 +276,34 @@ const He = (t, r) => {
256
276
  name: "idleControls",
257
277
  // the fields belong to the playback and controls features, this one only reads and sets them
258
278
  state: () => ({}),
259
- attach({ target: u, signal: i, store: c, get: p, set: d }) {
260
- var n;
261
- (n = u.container) == null || n.style.setProperty(
279
+ attach({ target: l, signal: i, store: f, get: d, set: p }) {
280
+ var R;
281
+ (R = l.container) == null || R.style.setProperty(
262
282
  "--media-controls-gradient",
263
- je
283
+ at
264
284
  );
265
- const m = () => {
266
- const { paused: E, started: h, ended: y, userActive: f, controlsVisible: w } = p();
267
- return E && h && !y && !f && w;
268
- }, S = c.subscribe(() => {
269
- m() && queueMicrotask(() => {
270
- !i.aborted && m() && d({ controlsVisible: !1 });
285
+ const h = () => {
286
+ const { paused: o, started: m, ended: E, userActive: _, controlsVisible: v } = d();
287
+ return o && m && !E && !_ && v;
288
+ }, u = f.subscribe(() => {
289
+ h() && queueMicrotask(() => {
290
+ !i.aborted && h() && p({ controlsVisible: !1 });
271
291
  });
272
292
  });
273
- i.addEventListener("abort", S, { once: !0 });
293
+ i.addEventListener("abort", u, { once: !0 });
274
294
  }
275
- }), { PlayerElement: a } = t({
295
+ }), { PlayerElement: n } = t({
276
296
  features: [...e, s]
277
297
  });
278
- customElements.get(W) || customElements.define(W, a);
279
- }, Qe = ["lang"], Xe = ["poster"], Ze = { class: "app-video__skin" }, $e = /* @__PURE__ */ he({
298
+ customElements.get(q) || customElements.define(q, n);
299
+ }, ot = ["lang"], it = ["poster", "default-playback-rates"], lt = { class: "app-video__skin" }, ct = ["crossorigin"], ut = ["src"], dt = ["src"], pt = ["crossorigin"], ft = ["src"], mt = ["src"], ht = ["crossorigin"], vt = ["src"], yt = ["src"], Et = /* @__PURE__ */ ke({
280
300
  __name: "AppVideo",
281
301
  props: {
282
302
  hlsSrc: {},
283
303
  dashSrc: {},
284
304
  sources: {},
305
+ chapters: {},
306
+ thumbnailsSrc: {},
285
307
  poster: {},
286
308
  withCredentials: { type: Boolean, default: !0 },
287
309
  authorize: {},
@@ -289,174 +311,221 @@ const He = (t, r) => {
289
311
  watermark: {},
290
312
  color: {}
291
313
  },
292
- emits: ["error"],
314
+ emits: ["error", "progress", "ended"],
293
315
  setup(t, { emit: r }) {
294
- const e = t, s = r, a = k(null), u = k(null), i = k(null), c = k([]), p = k(null), d = k(!0), m = k(!1), { boosted: S, release: n, onKeyDown: E, onPointerDown: h, onContextMenu: y } = qe(a);
295
- let f = null, w = !1, N = !1, I, Y, U, x = 0, g = null;
296
- const ce = (o) => {
297
- var l;
298
- if (p.value !== o) return;
299
- const v = N ? u.value : null;
316
+ const e = t, s = r, n = P(null), l = P(null), i = P(null), f = P([]), d = P(null), p = P(!0), h = P(!1), u = P(null), R = Se(() => {
317
+ if (e.thumbnailsSrc)
318
+ return e.withCredentials ? "use-credentials" : "anonymous";
319
+ }), { boosted: o, release: m, onKeyDown: E, onPointerDown: _, onContextMenu: v } = et(n);
320
+ let L = null, U = !1, H = !1, z, J, Q, $ = 0, g = null;
321
+ const he = (a) => {
322
+ var c;
323
+ if (d.value !== a) return;
324
+ const y = H ? l.value : null;
300
325
  g = {
301
- time: v ? v.currentTime : (g == null ? void 0 : g.time) ?? 0,
302
- rate: v ? v.playbackRate : (g == null ? void 0 : g.rate) ?? 1,
303
- playing: !!(g != null && g.playing) || ((l = a.value) == null ? void 0 : l.store.paused) === !1
304
- }, c.value = [...c.value, o];
305
- }, G = async () => {
326
+ time: y ? y.currentTime : (g == null ? void 0 : g.time) ?? 0,
327
+ rate: y ? y.playbackRate : (g == null ? void 0 : g.rate) ?? 1,
328
+ playing: !!(g != null && g.playing) || ((c = n.value) == null ? void 0 : c.store.paused) === !1
329
+ }, f.value = [...f.value, a];
330
+ }, X = async () => {
306
331
  if (!e.authorize) return !0;
307
332
  try {
308
333
  return await e.authorize(), !0;
309
- } catch (o) {
310
- return console.error("Video authorization failed", o), !1;
334
+ } catch (a) {
335
+ return console.error("Video authorization failed", a), !1;
311
336
  }
312
- }, q = (o, v) => ({
313
- src: o ?? "",
337
+ }, Z = (a, y) => ({
338
+ src: a ?? "",
314
339
  withCredentials: e.withCredentials,
315
- reauthorize: async () => w ? !1 : (w = !0, G()),
340
+ reauthorize: async () => U ? !1 : (U = !0, X()),
316
341
  loaded: () => {
317
- w = !1, N = !0;
342
+ U = !1, H = !0;
318
343
  },
319
- hasLoaded: () => N,
320
- fail: () => ce(v),
321
- report: (l) => {
322
- var b;
344
+ hasLoaded: () => H,
345
+ fail: () => he(y),
346
+ report: (c) => {
347
+ var D;
323
348
  return s("error", {
324
- ...l,
325
- mode: v,
326
- time: ((b = u.value) == null ? void 0 : b.currentTime) ?? 0
349
+ ...c,
350
+ mode: y,
351
+ time: ((D = l.value) == null ? void 0 : D.currentTime) ?? 0
327
352
  });
328
353
  },
329
354
  dismissError: () => queueMicrotask(() => {
330
- var l;
331
- return (l = a.value) == null ? void 0 : l.store.dismissError();
355
+ var c;
356
+ return (c = n.value) == null ? void 0 : c.store.dismissError();
332
357
  })
333
- }), de = (o) => {
334
- if (!e.resumeKey) return;
335
- const v = e.resumeKey;
336
- let l = Number(ae.getItem(v)) || 0;
337
- if (l) {
338
- const b = l;
339
- o.addEventListener(
340
- "loadedmetadata",
341
- () => o.currentTime = b,
342
- { once: !0 }
343
- );
344
- }
345
- o.addEventListener("timeupdate", () => {
346
- Math.abs(o.currentTime - l) >= De && (l = o.currentTime, ae.setItem(v, l));
347
- });
348
- }, pe = () => {
349
- e.watermark && (Y = setInterval(() => {
350
- var o;
351
- (((o = a.value) == null ? void 0 : o.store.paused) ?? !0) || (m.value = !0, U = setTimeout(() => {
352
- m.value = !1;
353
- }, Oe));
354
- }, Ce));
355
- }, fe = async (o) => {
356
- var Q;
357
- const v = ++x;
358
- await Re();
359
- const l = u.value, b = (Q = a.value) == null ? void 0 : Q.store;
360
- if (!(!l || !b) && (w = !1, N = !1, o !== _.Progressive && await G(), v === x)) {
361
- if (de(l), g) {
362
- const { time: X, rate: me, playing: Ee } = g, Z = () => {
363
- g = null, X && (l.currentTime = X), l.playbackRate = me;
358
+ }), ve = () => {
359
+ e.watermark && (J = setInterval(() => {
360
+ var a;
361
+ (((a = n.value) == null ? void 0 : a.store.paused) ?? !0) || (h.value = !0, Q = setTimeout(() => {
362
+ h.value = !1;
363
+ }, Ne));
364
+ }, Be));
365
+ }, ee = () => {
366
+ var a;
367
+ u.value && URL.revokeObjectURL(u.value), u.value = (a = e.chapters) != null && a.length ? URL.createObjectURL(
368
+ new Blob([st(e.chapters)], { type: "text/vtt" })
369
+ ) : null;
370
+ }, ye = async (a) => {
371
+ var se;
372
+ const y = ++$;
373
+ await we();
374
+ const c = l.value, D = (se = n.value) == null ? void 0 : se.store;
375
+ if (!(!c || !D) && (U = !1, H = !1, a !== T.Progressive && await X(), y === $)) {
376
+ if (e.resumeKey && ze(c, e.resumeKey), Me(c, () => o.value), Ke(
377
+ c,
378
+ (W) => s("progress", W),
379
+ () => s("ended")
380
+ ), g) {
381
+ const { time: W, rate: ge, playing: be } = g, ae = () => {
382
+ g = null, W && (c.currentTime = W), c.playbackRate = ge;
364
383
  };
365
- Ee ? He(l, Z) : l.addEventListener("loadedmetadata", Z, { once: !0 });
384
+ be ? Ge(c, ae) : c.addEventListener("loadedmetadata", ae, { once: !0 });
366
385
  }
367
- o === _.Hls && f ? Fe(
368
- l,
369
- f,
370
- q(e.hlsSrc, o)
371
- ) : o === _.Dash ? We(
372
- l,
373
- q(e.dashSrc, o)
374
- ) : Ye(l, e.sources ?? []), d.value = b.controlsVisible, I = b.subscribe(() => {
375
- d.value = b.controlsVisible;
376
- }), pe();
386
+ a === T.Hls && L ? qe(
387
+ c,
388
+ L,
389
+ Z(e.hlsSrc, a)
390
+ ) : a === T.Dash ? Je(
391
+ c,
392
+ Z(e.dashSrc, a)
393
+ ) : Qe(c, e.sources ?? []), p.value = D.controlsVisible, z = D.subscribe(() => {
394
+ p.value = D.controlsVisible;
395
+ }), ve();
377
396
  }
378
- }, B = () => {
379
- x++, n(), I == null || I(), I = void 0, clearInterval(Y), clearTimeout(U), m.value = !1;
380
397
  }, j = () => {
398
+ $++, m(), z == null || z(), z = void 0, clearInterval(J), clearTimeout(Q), h.value = !1;
399
+ }, te = () => {
381
400
  if (!i.value) return;
382
- const o = ze(e, i.value, c.value);
383
- o !== p.value && (!o && p.value || (B(), p.value = o, o && fe(o)));
384
- }, ve = async () => {
385
- const [o] = await Promise.all([
401
+ const a = He(e, i.value, f.value);
402
+ a !== d.value && (!a && d.value || (j(), d.value = a, a && ye(a)));
403
+ }, Ee = async () => {
404
+ const [a] = await Promise.all([
386
405
  e.hlsSrc ? import("@videojs/hlsjs-video") : null,
387
406
  e.hlsSrc ? import("@videojs/html/media/hlsjs-video") : null,
388
407
  e.dashSrc ? import("@videojs/html/media/dash-video") : null,
389
408
  import("@videojs/html/i18n"),
390
409
  import("@videojs/html/i18n/locales/uk/register"),
391
- Je(),
410
+ nt(),
392
411
  import("@videojs/html/video/skin")
393
412
  ]);
394
- return f = (o == null ? void 0 : o.Hls) ?? null, {
395
- hls: !!f && (f.isSupported() || !!document.createElement("video").canPlayType("application/vnd.apple.mpegurl")),
396
- dash: !!e.dashSrc && Ve()
413
+ return L = (a == null ? void 0 : a.Hls) ?? null, {
414
+ hls: !!L && (L.isSupported() || !!document.createElement("video").canPlayType("application/vnd.apple.mpegurl")),
415
+ dash: !!e.dashSrc && We()
397
416
  };
398
- }, J = async () => {
399
- i.value = await ve(), j();
417
+ }, re = async () => {
418
+ i.value = await Ee(), te();
400
419
  };
401
- return te(c, j), te(
420
+ return F(f, te), F(() => JSON.stringify(e.chapters), ee), F(
402
421
  () => JSON.stringify([e.hlsSrc, e.dashSrc, e.sources]),
403
422
  () => {
404
- B(), g = null, p.value = null, i.value = null, c.value = [], J();
423
+ j(), g = null, d.value = null, i.value = null, f.value = [], re();
405
424
  }
406
- ), ye(J), oe(B), (o, v) => (O(), D("div", {
425
+ ), Re(() => {
426
+ ee(), re();
427
+ }), de(() => {
428
+ j(), u.value && URL.revokeObjectURL(u.value);
429
+ }), (a, y) => (S(), k("div", {
407
430
  class: "app-video",
408
- onKeydownCapture: v[0] || (v[0] = //@ts-ignore
409
- (...l) => T(E) && T(E)(...l)),
410
- onPointerdownCapture: v[1] || (v[1] = //@ts-ignore
411
- (...l) => T(h) && T(h)(...l)),
412
- onContextmenuCapture: v[2] || (v[2] = //@ts-ignore
413
- (...l) => T(y) && T(y)(...l))
431
+ onKeydownCapture: y[0] || (y[0] = //@ts-ignore
432
+ (...c) => w(E) && w(E)(...c)),
433
+ onPointerdownCapture: y[1] || (y[1] = //@ts-ignore
434
+ (...c) => w(_) && w(_)(...c)),
435
+ onContextmenuCapture: y[2] || (y[2] = //@ts-ignore
436
+ (...c) => w(v) && w(v)(...c))
414
437
  }, [
415
- p.value ? (O(), D("media-i18n", {
416
- key: p.value,
417
- lang: T(Ae)
438
+ d.value ? (S(), k("media-i18n", {
439
+ key: d.value,
440
+ lang: w(Ie)
418
441
  }, [
419
- F("app-video-player", {
442
+ G("app-video-player", {
420
443
  ref_key: "playerEl",
421
- ref: a,
422
- poster: o.poster
444
+ ref: n,
445
+ poster: a.poster,
446
+ "default-playback-rates": w(Ve).join(" ")
423
447
  }, [
424
- F("video-skin", Ze, [
425
- p.value === T(_).Hls ? (O(), D("hlsjs-video", {
448
+ G("video-skin", lt, [
449
+ d.value === w(T).Hls ? (S(), k("hlsjs-video", {
426
450
  key: 0,
427
451
  ref_key: "mediaEl",
428
- ref: u,
452
+ ref: l,
453
+ crossorigin: R.value,
429
454
  preload: "none",
430
455
  playsinline: ""
431
- }, null, 512)) : p.value === T(_).Dash ? (O(), D("dash-video", {
456
+ }, [
457
+ u.value ? (S(), k("track", {
458
+ key: u.value,
459
+ kind: "chapters",
460
+ default: "",
461
+ src: u.value
462
+ }, null, 8, ut)) : O("", !0),
463
+ a.thumbnailsSrc ? (S(), k("track", {
464
+ key: a.thumbnailsSrc,
465
+ kind: "metadata",
466
+ label: "thumbnails",
467
+ default: "",
468
+ src: a.thumbnailsSrc
469
+ }, null, 8, dt)) : O("", !0)
470
+ ], 8, ct)) : d.value === w(T).Dash ? (S(), k("dash-video", {
432
471
  key: 1,
433
472
  ref_key: "mediaEl",
434
- ref: u,
473
+ ref: l,
474
+ crossorigin: R.value,
435
475
  preload: "none",
436
476
  playsinline: ""
437
- }, null, 512)) : (O(), D("video", {
477
+ }, [
478
+ u.value ? (S(), k("track", {
479
+ key: u.value,
480
+ kind: "chapters",
481
+ default: "",
482
+ src: u.value
483
+ }, null, 8, ft)) : O("", !0),
484
+ a.thumbnailsSrc ? (S(), k("track", {
485
+ key: a.thumbnailsSrc,
486
+ kind: "metadata",
487
+ label: "thumbnails",
488
+ default: "",
489
+ src: a.thumbnailsSrc
490
+ }, null, 8, mt)) : O("", !0)
491
+ ], 8, pt)) : (S(), k("video", {
438
492
  key: 2,
439
493
  ref_key: "mediaEl",
440
- ref: u,
494
+ ref: l,
495
+ crossorigin: R.value,
441
496
  preload: "none",
442
497
  playsinline: ""
443
- }, null, 512)),
444
- o.watermark ? (O(), D("div", {
498
+ }, [
499
+ u.value ? (S(), k("track", {
500
+ key: u.value,
501
+ kind: "chapters",
502
+ default: "",
503
+ src: u.value
504
+ }, null, 8, vt)) : O("", !0),
505
+ a.thumbnailsSrc ? (S(), k("track", {
506
+ key: a.thumbnailsSrc,
507
+ kind: "metadata",
508
+ label: "thumbnails",
509
+ default: "",
510
+ src: a.thumbnailsSrc
511
+ }, null, 8, yt)) : O("", !0)
512
+ ], 8, ht)),
513
+ a.watermark ? (S(), k("div", {
445
514
  key: 3,
446
- class: se(["app-video__watermark", {
447
- "app-video__watermark_visible": m.value,
448
- "app-video__watermark_raised": d.value
515
+ class: ie(["app-video__watermark", {
516
+ "app-video__watermark_visible": h.value,
517
+ "app-video__watermark_raised": p.value
449
518
  }])
450
- }, ge(o.watermark), 3)) : re("", !0),
451
- F("div", {
452
- class: se(["app-video__boost", { "app-video__boost_visible": T(S) }])
519
+ }, _e(a.watermark), 3)) : O("", !0),
520
+ G("div", {
521
+ class: ie(["app-video__boost", { "app-video__boost_visible": w(o) }])
453
522
  }, " 2× ", 2)
454
523
  ])
455
- ], 8, Xe)
456
- ], 8, Qe)) : re("", !0)
524
+ ], 8, it)
525
+ ], 8, ot)) : O("", !0)
457
526
  ], 32));
458
527
  }
459
- }), nt = /* @__PURE__ */ Ie($e, [["__scopeId", "data-v-e7b77478"]]);
528
+ }), Rt = /* @__PURE__ */ Ue(Et, [["__scopeId", "data-v-bde5aa9e"]]);
460
529
  export {
461
- nt as AppVideo
530
+ Rt as AppVideo
462
531
  };