@instructure/studio-player 1.1.14 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/README.md +2 -2
  2. package/dist/{ar-DWuLBmz_.js → ar-Z9acuZzl.js} +59 -57
  3. package/dist/{ca-Qqae8qG8.js → ca-DlR1wIBB.js} +53 -51
  4. package/dist/chromecast-fcYiHsj5.js +4 -0
  5. package/dist/{cy-BpEFkqco.js → cy-Bfp7KxBK.js} +56 -54
  6. package/dist/{da-wed3aJ7h.js → da-qrZgDst-.js} +48 -46
  7. package/dist/{da-x-k12-COGvNdvr.js → da-x-k12-By8rNInq.js} +46 -44
  8. package/dist/{de-nKvELG0o.js → de-knn0V76L.js} +52 -50
  9. package/dist/dev-D3SS6qhA.js +1000 -0
  10. package/dist/{en_AU-MbaPa8_v.js → en-AU-x-unimelb-ByeXpRSQ.js} +54 -52
  11. package/dist/en-AyGO5HzS.js +133 -0
  12. package/dist/{en-GB-x-ukhe-B4JozeRC.js → en-GB-x-ukhe-xHRAKkin.js} +56 -54
  13. package/dist/{en-AU-x-unimelb-CkNBO1qD.js → en_AU-DyOGFAXY.js} +48 -46
  14. package/dist/{en_CY-Bic0boap.js → en_CY-BOdUgRsC.js} +52 -50
  15. package/dist/{en_GB-Bic0boap.js → en_GB-BgDkmLv4.js} +50 -48
  16. package/dist/errors-Bfk1GqFn.js +70 -0
  17. package/dist/{es-BcgDzQZG.js → es-CBqAZZdR.js} +54 -52
  18. package/dist/{es_ES-Dpu1hibc.js → es_ES-DLfG4pu4.js} +60 -58
  19. package/dist/{fi-BEWl8re7.js → fi-Dq0xAMjn.js} +55 -53
  20. package/dist/{fr-DiQce0QU.js → fr-CvtcW3Dj.js} +58 -56
  21. package/dist/fr_CA-ZpBdXMbh.js +133 -0
  22. package/dist/ga-83Dv-X5Z.js +133 -0
  23. package/dist/{hi-DFgKd5Rh.js → hi-xRyetvo6.js} +59 -57
  24. package/dist/ht-DA2-RKUH.js +133 -0
  25. package/dist/id-CEs1cZOo.js +133 -0
  26. package/dist/index-COMpNSdw.css +1 -0
  27. package/dist/{is-CTl9VBTw.js → is-BbinArrV.js} +56 -54
  28. package/dist/{it-DS73ictn.js → it-HslrRsSS.js} +58 -56
  29. package/dist/ja-D89KNqN9.js +133 -0
  30. package/dist/mi-aU_9ve5X.js +133 -0
  31. package/dist/{ms-C_fuUCcA.js → ms-bWAzRpaY.js} +52 -50
  32. package/dist/nb-M_VkURkp.js +133 -0
  33. package/dist/{nb-CrJr2akb.js → nb-x-k12-B-_bQnAo.js} +54 -52
  34. package/dist/{nl-CrynP9Ac.js → nl-DHdAiTnV.js} +56 -54
  35. package/dist/pl-1Qw2eZF3.js +133 -0
  36. package/dist/{pt-GnFuQolP.js → pt-Ck4sSJ6k.js} +52 -50
  37. package/dist/{pt_BR-Bw-U8Fma.js → pt_BR-Cx97cXwr.js} +56 -54
  38. package/dist/ru-C-htuaP4.js +133 -0
  39. package/dist/sl-CQCpGyzi.js +133 -0
  40. package/dist/srt-parser-HIGL5vQl.js +27 -0
  41. package/dist/ssa-parser-DsrjQpwb.js +209 -0
  42. package/dist/studio-player.es.js +4728 -4742
  43. package/dist/sv-e5AFl9Ar.js +133 -0
  44. package/dist/sv-x-k12-pMVzTct2.js +133 -0
  45. package/dist/{th-DY_qsUyE.js → th-D_TJAjfw.js} +63 -61
  46. package/dist/{vi-CZWY3NLh.js → vi-Cm6S7qCi.js} +53 -51
  47. package/dist/vidstack-CjqtyAQk.js +9772 -0
  48. package/dist/vidstack-audio-CkMeA4-b.js +32 -0
  49. package/dist/vidstack-dash-CMEjAqOU.js +95 -0
  50. package/dist/vidstack-google-cast-BMQWFfhs.js +313 -0
  51. package/dist/vidstack-hls-D1a98pZ4.js +95 -0
  52. package/dist/vidstack-html-CPvoK3qB.js +73 -0
  53. package/dist/vidstack-video-C_npz5Cj.js +39 -0
  54. package/dist/vidstack-vimeo-j7LNW6Re.js +426 -0
  55. package/dist/vidstack-youtube-C_ammZWO.js +264 -0
  56. package/dist/zh-DaDuLWt4.js +133 -0
  57. package/dist/zh-Hans-Bh10_Au7.js +133 -0
  58. package/dist/zh-Hant-DvNKec8H.js +133 -0
  59. package/dist/{zh-Hant-DuAgeN0L.js → zh_HK-CwSDZpFm.js} +59 -57
  60. package/package.json +4 -4
  61. package/dist/en-Da2QqQzB.js +0 -131
  62. package/dist/errors-DCJKAXTz.js +0 -70
  63. package/dist/fr_CA-zzDHXzBI.js +0 -131
  64. package/dist/ga-BnfTovup.js +0 -125
  65. package/dist/ht-DmkZypkC.js +0 -131
  66. package/dist/id-D12ot73_.js +0 -131
  67. package/dist/index-CXoy768z.css +0 -1
  68. package/dist/ja-B0B-sKEG.js +0 -131
  69. package/dist/mi-BX_XpUQT.js +0 -131
  70. package/dist/nb-x-k12-LqbRKYNM.js +0 -131
  71. package/dist/patches.d.ts +0 -1
  72. package/dist/pl-CBE8GSTo.js +0 -131
  73. package/dist/prod-DTLJXtPo.js +0 -994
  74. package/dist/ru-Din5Ed0v.js +0 -131
  75. package/dist/sl-DOsudmDY.js +0 -131
  76. package/dist/srt-parser-CWqahKwO.js +0 -27
  77. package/dist/ssa-parser-BqjjKy4M.js +0 -209
  78. package/dist/sv-CxnJbrMd.js +0 -131
  79. package/dist/sv-x-k12-C3MKrKJe.js +0 -131
  80. package/dist/vidstack-CpEp8jXV.js +0 -32955
  81. package/dist/zh-Cb-utrSO.js +0 -131
  82. package/dist/zh-Hans-C6EE8GVu.js +0 -131
  83. package/dist/zh_HK-BaabEC8v.js +0 -131
@@ -0,0 +1,426 @@
1
+ var me = Object.defineProperty;
2
+ var W = (r) => {
3
+ throw TypeError(r);
4
+ };
5
+ var ke = (r, c, e) => c in r ? me(r, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[c] = e;
6
+ var b = (r, c, e) => ke(r, typeof c != "symbol" ? c + "" : c, e), j = (r, c, e) => c.has(r) || W("Cannot " + e);
7
+ var s = (r, c, e) => (j(r, c, "read from private field"), e ? e.call(r) : c.get(r)), d = (r, c, e) => c.has(r) ? W("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(r) : c.set(r, e), f = (r, c, e, t) => (j(r, c, "write to private field"), t ? t.call(r, e) : c.set(r, e), e), h = (r, c, e) => (j(r, c, "access private method"), e);
8
+ import { E as ve, d as we, x as Y, T as g, R as Te, p as Pe, y as x, c as A, a as Ce, z as G, L as M, l as $e, B as ge, C as Ee, I as Re, Q as J } from "./vidstack-CjqtyAQk.js";
9
+ const Ve = /(?:https:\/\/)?(?:player\.)?vimeo(?:\.com)?\/(?:video\/)?(\d+)(?:(?:\?hash=|\?h=|\/)(.*))?/, O = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
10
+ function K(r) {
11
+ const c = r.match(Ve);
12
+ return { videoId: c == null ? void 0 : c[1], hash: c == null ? void 0 : c[2] };
13
+ }
14
+ async function X(r, c, e) {
15
+ if (O.has(r)) return O.get(r);
16
+ if (_.has(r)) return _.get(r);
17
+ let t = `https://vimeo.com/api/oembed.json?url=https://player.vimeo.com/video/${r}`;
18
+ e && (t = t.concat(`?h=${e}`));
19
+ const n = window.fetch(t, {
20
+ mode: "cors",
21
+ signal: c.signal
22
+ }).then((a) => a.json()).then((a) => {
23
+ var N, U;
24
+ const l = /vimeocdn.com\/video\/(.*)?_/, p = (U = (N = a == null ? void 0 : a.thumbnail_url) == null ? void 0 : N.match(l)) == null ? void 0 : U[1], C = p ? `https://i.vimeocdn.com/video/${p}_1920x1080.webp` : "", $ = {
25
+ title: (a == null ? void 0 : a.title) ?? "",
26
+ duration: (a == null ? void 0 : a.duration) ?? 0,
27
+ poster: C,
28
+ pro: a.account_type !== "basic"
29
+ };
30
+ return O.set(r, $), $;
31
+ }).finally(() => _.delete(r));
32
+ return _.set(r, n), n;
33
+ }
34
+ const Ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
35
+ __proto__: null,
36
+ getVimeoVideoInfo: X,
37
+ resolveVimeoVideoId: K
38
+ }, Symbol.toStringTag, { value: "Module" }));
39
+ var o, y, m, w, E, S, k, R, I, T, v, V, i, Z, H, ee, te, P, se, ie, ne, Q, oe, he, ae, re, ce, q, ue, le, fe, L, de, F, pe, B, ye, be, u, D, z;
40
+ class Se extends ve {
41
+ constructor(e, t) {
42
+ super(e);
43
+ d(this, i);
44
+ b(this, "$$PROVIDER_TYPE", "VIMEO");
45
+ b(this, "scope", we());
46
+ b(this, "fullscreen");
47
+ d(this, o);
48
+ d(this, y, Y(""));
49
+ d(this, m, Y(!1));
50
+ d(this, w, null);
51
+ d(this, E, null);
52
+ d(this, S, !1);
53
+ d(this, k, new g(0, 0));
54
+ d(this, R, new Te(h(this, i, te).bind(this)));
55
+ d(this, I, null);
56
+ d(this, T, null);
57
+ d(this, v, /* @__PURE__ */ new Map());
58
+ d(this, V, null);
59
+ /**
60
+ * Whether tracking session data should be enabled on the embed, including cookies and analytics.
61
+ * This is turned off by default to be GDPR-compliant.
62
+ *
63
+ * @defaultValue `false`
64
+ */
65
+ b(this, "cookies", !1);
66
+ b(this, "title", !0);
67
+ b(this, "byline", !0);
68
+ b(this, "portrait", !0);
69
+ b(this, "color", "00ADEF");
70
+ // Embed will sometimes dispatch 0 at end of playback.
71
+ d(this, P, !1);
72
+ f(this, o, t);
73
+ const n = this;
74
+ this.fullscreen = {
75
+ get active() {
76
+ return s(n, S);
77
+ },
78
+ supported: !0,
79
+ enter: () => h(this, i, u).call(this, "requestFullscreen"),
80
+ exit: () => h(this, i, u).call(this, "exitFullscreen")
81
+ };
82
+ }
83
+ get type() {
84
+ return "vimeo";
85
+ }
86
+ get currentSrc() {
87
+ return s(this, E);
88
+ }
89
+ get videoId() {
90
+ return s(this, y).call(this);
91
+ }
92
+ get hash() {
93
+ return s(this, w);
94
+ }
95
+ get isPro() {
96
+ return s(this, m).call(this);
97
+ }
98
+ preconnect() {
99
+ Pe(this.getOrigin());
100
+ }
101
+ setup() {
102
+ super.setup(), x(h(this, i, Z).bind(this)), x(h(this, i, H).bind(this)), x(h(this, i, ee).bind(this)), s(this, o).notify("provider-setup", this);
103
+ }
104
+ destroy() {
105
+ h(this, i, D).call(this), this.fullscreen = void 0;
106
+ const e = "provider destroyed";
107
+ for (const t of s(this, v).values())
108
+ for (const { reject: n } of t) n(e);
109
+ s(this, v).clear(), h(this, i, u).call(this, "destroy");
110
+ }
111
+ async play() {
112
+ return h(this, i, u).call(this, "play");
113
+ }
114
+ async pause() {
115
+ return h(this, i, u).call(this, "pause");
116
+ }
117
+ setMuted(e) {
118
+ h(this, i, u).call(this, "setMuted", e);
119
+ }
120
+ setCurrentTime(e) {
121
+ h(this, i, u).call(this, "seekTo", e), s(this, o).notify("seeking", e);
122
+ }
123
+ setVolume(e) {
124
+ h(this, i, u).call(this, "setVolume", e), h(this, i, u).call(this, "setMuted", A(s(this, o).$state.muted));
125
+ }
126
+ setPlaybackRate(e) {
127
+ h(this, i, u).call(this, "setPlaybackRate", e);
128
+ }
129
+ async loadSource(e) {
130
+ if (!Ce(e.src)) {
131
+ f(this, E, null), f(this, w, null), s(this, y).set("");
132
+ return;
133
+ }
134
+ const { videoId: t, hash: n } = K(e.src);
135
+ s(this, y).set(t ?? ""), f(this, w, n ?? null), f(this, E, e);
136
+ }
137
+ getOrigin() {
138
+ return "https://player.vimeo.com";
139
+ }
140
+ buildParams() {
141
+ const { keyDisabled: e } = s(this, o).$props, { playsInline: t, nativeControls: n } = s(this, o).$state, a = n();
142
+ return {
143
+ title: this.title,
144
+ byline: this.byline,
145
+ color: this.color,
146
+ portrait: this.portrait,
147
+ controls: a,
148
+ h: this.hash,
149
+ keyboard: a && !e(),
150
+ transparent: !0,
151
+ playsinline: t(),
152
+ dnt: !this.cookies
153
+ };
154
+ }
155
+ onMessage(e, t) {
156
+ e.event ? h(this, i, ye).call(this, e.event, e.data, t) : e.method && h(this, i, oe).call(this, e.method, e.value, t);
157
+ }
158
+ onLoad() {
159
+ }
160
+ }
161
+ o = new WeakMap(), y = new WeakMap(), m = new WeakMap(), w = new WeakMap(), E = new WeakMap(), S = new WeakMap(), k = new WeakMap(), R = new WeakMap(), I = new WeakMap(), T = new WeakMap(), v = new WeakMap(), V = new WeakMap(), i = new WeakSet(), Z = function() {
162
+ h(this, i, D).call(this);
163
+ const e = s(this, y).call(this);
164
+ if (!e) {
165
+ this.src.set("");
166
+ return;
167
+ }
168
+ this.src.set(`${this.getOrigin()}/video/${e}`), s(this, o).notify("load-start");
169
+ }, H = function() {
170
+ const e = s(this, y).call(this);
171
+ if (!e) return;
172
+ const t = G(), n = new AbortController();
173
+ return f(this, V, t), X(e, n, s(this, w)).then((a) => {
174
+ t.resolve(a);
175
+ }).catch((a) => {
176
+ t.reject();
177
+ }), () => {
178
+ t.reject(), n.abort();
179
+ };
180
+ }, ee = function() {
181
+ const e = s(this, m).call(this), { $state: t, qualities: n } = s(this, o);
182
+ if (t.canSetPlaybackRate.set(e), n[M.setReadonly](!e), e)
183
+ return $e(n, "change", () => {
184
+ var l;
185
+ if (n.auto) return;
186
+ const a = (l = n.selected) == null ? void 0 : l.id;
187
+ a && h(this, i, u).call(this, "setQuality", a);
188
+ });
189
+ }, te = function() {
190
+ h(this, i, u).call(this, "getCurrentTime");
191
+ }, P = new WeakMap(), se = function(e, t) {
192
+ if (s(this, P) && e === 0) return;
193
+ const { realCurrentTime: n, paused: a, bufferedEnd: l, seekableEnd: p, live: C } = s(this, o).$state;
194
+ if (n() === e) return;
195
+ const $ = n();
196
+ s(this, o).notify("time-change", e, t), Math.abs($ - e) > 1.5 && (s(this, o).notify("seeking", e, t), !a() && l() < e && s(this, o).notify("waiting", void 0, t)), !C() && p() - e < 0.01 && (s(this, o).notify("end", void 0, t), f(this, P, !0), setTimeout(() => {
197
+ f(this, P, !1);
198
+ }, 500));
199
+ }, ie = function(e, t) {
200
+ s(this, o).notify("seeked", e, t);
201
+ }, ne = function(e) {
202
+ var n;
203
+ const t = s(this, y).call(this);
204
+ (n = s(this, V)) == null || n.promise.then((a) => {
205
+ if (!a) return;
206
+ const { title: l, poster: p, duration: C, pro: $ } = a;
207
+ s(this, m).set($), s(this, o).notify("title-change", l, e), s(this, o).notify("poster-change", p, e), s(this, o).notify("duration-change", C, e), h(this, i, Q).call(this, C, e);
208
+ }).catch(() => {
209
+ t === s(this, y).call(this) && (h(this, i, u).call(this, "getVideoTitle"), h(this, i, u).call(this, "getDuration"));
210
+ });
211
+ }, Q = function(e, t) {
212
+ const { nativeControls: n } = s(this, o).$state, a = n();
213
+ f(this, k, new g(0, e));
214
+ const l = {
215
+ buffered: new g(0, 0),
216
+ seekable: s(this, k),
217
+ duration: e
218
+ };
219
+ s(this, o).delegate.ready(l, t), a || h(this, i, u).call(this, "_hideOverlay"), h(this, i, u).call(this, "getQualities"), h(this, i, u).call(this, "getChapters");
220
+ }, oe = function(e, t, n) {
221
+ var a;
222
+ switch (e) {
223
+ case "getVideoTitle":
224
+ const l = t;
225
+ s(this, o).notify("title-change", l, n);
226
+ break;
227
+ case "getDuration":
228
+ const p = t;
229
+ s(this, o).$state.canPlay() ? s(this, o).notify("duration-change", p, n) : h(this, i, Q).call(this, p, n);
230
+ break;
231
+ case "getCurrentTime":
232
+ h(this, i, se).call(this, t, n);
233
+ break;
234
+ case "getBuffered":
235
+ ge(t) && t.length && h(this, i, q).call(this, t[t.length - 1][1], n);
236
+ break;
237
+ case "setMuted":
238
+ h(this, i, L).call(this, A(s(this, o).$state.volume), t, n);
239
+ break;
240
+ // case 'getTextTracks':
241
+ // this.#onTextTracksChange(data as VimeoTextTrack[], trigger);
242
+ // break;
243
+ case "getChapters":
244
+ h(this, i, de).call(this, t);
245
+ break;
246
+ case "getQualities":
247
+ h(this, i, pe).call(this, t, n);
248
+ break;
249
+ }
250
+ (a = h(this, i, z).call(this, e)) == null || a.resolve();
251
+ }, he = function() {
252
+ for (const e of Ee)
253
+ h(this, i, u).call(this, "addEventListener", e);
254
+ }, ae = function(e) {
255
+ s(this, R).stop(), s(this, o).notify("pause", void 0, e);
256
+ }, re = function(e) {
257
+ s(this, R).start(), s(this, o).notify("play", void 0, e);
258
+ }, ce = function(e) {
259
+ const { paused: t } = s(this, o).$state;
260
+ !t() && !s(this, P) && s(this, o).notify("playing", void 0, e);
261
+ }, q = function(e, t) {
262
+ const n = {
263
+ buffered: new g(0, e),
264
+ seekable: s(this, k)
265
+ };
266
+ s(this, o).notify("progress", n, t);
267
+ }, ue = function(e) {
268
+ s(this, o).notify("waiting", void 0, e);
269
+ }, le = function(e) {
270
+ const { paused: t } = s(this, o).$state;
271
+ t() || s(this, o).notify("playing", void 0, e);
272
+ }, fe = function(e) {
273
+ const { paused: t } = s(this, o).$state;
274
+ t() && s(this, o).notify("play", void 0, e), s(this, o).notify("waiting", void 0, e);
275
+ }, L = function(e, t, n) {
276
+ const a = { volume: e, muted: t };
277
+ s(this, o).notify("volume-change", a, n);
278
+ }, // #onTextTrackChange(track: VimeoTextTrack, trigger: Event) {
279
+ // const textTrack = this.#ctx.textTracks.toArray().find((t) => t.language === track.language);
280
+ // if (textTrack) textTrack.mode = track.mode;
281
+ // }
282
+ // #onTextTracksChange(tracks: VimeoTextTrack[], trigger: Event) {
283
+ // for (const init of tracks) {
284
+ // const textTrack = new TextTrack({
285
+ // ...init,
286
+ // label: init.label.replace('auto-generated', 'auto'),
287
+ // });
288
+ // textTrack[TextTrackSymbol.readyState] = 2;
289
+ // this.#ctx.textTracks.add(textTrack, trigger);
290
+ // textTrack.setMode(init.mode, trigger);
291
+ // }
292
+ // }
293
+ // #onCueChange(cue: VimeoTextCue, trigger: Event) {
294
+ // const { textTracks, $state } = this.#ctx,
295
+ // { currentTime } = $state,
296
+ // track = textTracks.selected;
297
+ // if (this.#currentCue) track?.removeCue(this.#currentCue, trigger);
298
+ // this.#currentCue = new window.VTTCue(currentTime(), Number.MAX_SAFE_INTEGER, cue.text);
299
+ // track?.addCue(this.#currentCue, trigger);
300
+ // }
301
+ de = function(e) {
302
+ if (h(this, i, F).call(this), !e.length) return;
303
+ const t = new Re({
304
+ kind: "chapters",
305
+ default: !0
306
+ }), { seekableEnd: n } = s(this, o).$state;
307
+ for (let a = 0; a < e.length; a++) {
308
+ const l = e[a], p = e[a + 1];
309
+ t.addCue(
310
+ new window.VTTCue(
311
+ l.startTime,
312
+ (p == null ? void 0 : p.startTime) ?? n(),
313
+ l.title
314
+ )
315
+ );
316
+ }
317
+ f(this, T, t), s(this, o).textTracks.add(t);
318
+ }, F = function() {
319
+ s(this, T) && (s(this, o).textTracks.remove(s(this, T)), f(this, T, null));
320
+ }, pe = function(e, t) {
321
+ s(this, o).qualities[J.enableAuto] = e.some((n) => n.id === "auto") ? () => h(this, i, u).call(this, "setQuality", "auto") : void 0;
322
+ for (const n of e) {
323
+ if (n.id === "auto") continue;
324
+ const a = +n.id.slice(0, -1);
325
+ isNaN(a) || s(this, o).qualities[M.add](
326
+ {
327
+ id: n.id,
328
+ width: a * (16 / 9),
329
+ height: a,
330
+ codec: "avc1,h.264",
331
+ bitrate: -1
332
+ },
333
+ t
334
+ );
335
+ }
336
+ h(this, i, B).call(this, e.find((n) => n.active), t);
337
+ }, B = function({ id: e } = {}, t) {
338
+ if (!e) return;
339
+ const n = e === "auto", a = s(this, o).qualities.getById(e);
340
+ n ? (s(this, o).qualities[J.setAuto](n, t), s(this, o).qualities[M.select](void 0, !0, t)) : s(this, o).qualities[M.select](a ?? void 0, !0, t);
341
+ }, ye = function(e, t, n) {
342
+ switch (e) {
343
+ case "ready":
344
+ h(this, i, he).call(this);
345
+ break;
346
+ case "loaded":
347
+ h(this, i, ne).call(this, n);
348
+ break;
349
+ case "play":
350
+ h(this, i, re).call(this, n);
351
+ break;
352
+ case "playProgress":
353
+ h(this, i, ce).call(this, n);
354
+ break;
355
+ case "pause":
356
+ h(this, i, ae).call(this, n);
357
+ break;
358
+ case "loadProgress":
359
+ h(this, i, q).call(this, t.seconds, n);
360
+ break;
361
+ case "waiting":
362
+ h(this, i, fe).call(this, n);
363
+ break;
364
+ case "bufferstart":
365
+ h(this, i, ue).call(this, n);
366
+ break;
367
+ case "bufferend":
368
+ h(this, i, le).call(this, n);
369
+ break;
370
+ case "volumechange":
371
+ h(this, i, L).call(this, t.volume, A(s(this, o).$state.muted), n);
372
+ break;
373
+ case "durationchange":
374
+ f(this, k, new g(0, t.duration)), s(this, o).notify("duration-change", t.duration, n);
375
+ break;
376
+ case "playbackratechange":
377
+ s(this, o).notify("rate-change", t.playbackRate, n);
378
+ break;
379
+ case "qualitychange":
380
+ h(this, i, B).call(this, t, n);
381
+ break;
382
+ case "fullscreenchange":
383
+ f(this, S, t.fullscreen), s(this, o).notify("fullscreen-change", t.fullscreen, n);
384
+ break;
385
+ case "enterpictureinpicture":
386
+ s(this, o).notify("picture-in-picture-change", !0, n);
387
+ break;
388
+ case "leavepictureinpicture":
389
+ s(this, o).notify("picture-in-picture-change", !1, n);
390
+ break;
391
+ case "ended":
392
+ case "finish":
393
+ s(this, o).notify("end", void 0, n);
394
+ break;
395
+ case "error":
396
+ h(this, i, be).call(this, t, n);
397
+ break;
398
+ case "seek":
399
+ case "seeked":
400
+ h(this, i, ie).call(this, t.seconds, n);
401
+ break;
402
+ }
403
+ }, be = function(e, t) {
404
+ var l;
405
+ const { message: n, method: a } = e;
406
+ a === "setPlaybackRate" && s(this, m).set(!1), a && ((l = h(this, i, z).call(this, a)) == null || l.reject(n));
407
+ }, u = async function(e, t) {
408
+ let n = G(), a = s(this, v).get(e);
409
+ return a || s(this, v).set(e, a = []), a.push(n), this.postMessage({
410
+ method: e,
411
+ value: t
412
+ }), n.promise;
413
+ }, D = function() {
414
+ s(this, R).stop(), f(this, k, new g(0, 0)), f(this, V, null), f(this, I, null), s(this, m).set(!1), h(this, i, F).call(this);
415
+ }, z = function(e) {
416
+ var t;
417
+ return (t = s(this, v).get(e)) == null ? void 0 : t.shift();
418
+ };
419
+ const je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
420
+ __proto__: null,
421
+ VimeoProvider: Se
422
+ }, Symbol.toStringTag, { value: "Module" }));
423
+ export {
424
+ je as p,
425
+ Ie as u
426
+ };
@@ -0,0 +1,264 @@
1
+ var N = Object.defineProperty;
2
+ var x = (a) => {
3
+ throw TypeError(a);
4
+ };
5
+ var A = (a, n, e) => n in a ? N(a, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[n] = e;
6
+ var v = (a, n, e) => A(a, typeof n != "symbol" ? n + "" : n, e), E = (a, n, e) => n.has(a) || x("Cannot " + e);
7
+ var s = (a, n, e) => (E(a, n, "read from private field"), e ? e.call(a) : n.get(a)), p = (a, n, e) => n.has(a) ? x("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(a) : n.set(a, e), c = (a, n, e, t) => (E(a, n, "write to private field"), t ? t.call(a, e) : n.set(a, e), e), r = (a, n, e) => (E(a, n, "access private method"), e);
8
+ import { E as G, d as H, x as Q, p as W, y as X, a as Z, z as ee, Y as b, J as te, K as $, T as j, M as se } from "./vidstack-CjqtyAQk.js";
9
+ const ie = /(?:youtu\.be|youtube|youtube\.com|youtube-nocookie\.com)(?:\/shorts)?\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=|)((?:\w|-){11})/, O = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map();
10
+ function z(a) {
11
+ var n;
12
+ return (n = a.match(ie)) == null ? void 0 : n[1];
13
+ }
14
+ async function ae(a, n) {
15
+ if (O.has(a)) return O.get(a);
16
+ if (R.has(a)) return R.get(a);
17
+ const e = new Promise(async (t) => {
18
+ const u = ["maxresdefault", "sddefault", "hqdefault"];
19
+ for (const h of u)
20
+ for (const d of [!0, !1]) {
21
+ const l = oe(a, h, d);
22
+ if ((await fetch(l, {
23
+ mode: "no-cors",
24
+ signal: n.signal
25
+ })).status < 400) {
26
+ O.set(a, l), t(l);
27
+ return;
28
+ }
29
+ }
30
+ }).catch(() => "").finally(() => R.delete(a));
31
+ return R.set(a, e), e;
32
+ }
33
+ function oe(a, n, e) {
34
+ return `https://i.ytimg.com/${e ? "vi_webp" : "vi"}/${a}/${n}.${e ? "webp" : "jpg"}`;
35
+ }
36
+ const le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
37
+ __proto__: null,
38
+ findYouTubePoster: ae,
39
+ resolveYouTubeVideoId: z
40
+ }, Symbol.toStringTag, { value: "Module" }));
41
+ var o, w, k, S, P, g, y, i, re, ue, B, m, F, L, U, C, V, I, q, Y, _, J;
42
+ class ne extends G {
43
+ constructor(e, t) {
44
+ super(e);
45
+ p(this, i);
46
+ v(this, "$$PROVIDER_TYPE", "YOUTUBE");
47
+ v(this, "scope", H());
48
+ p(this, o);
49
+ p(this, w, Q(""));
50
+ p(this, k, -1);
51
+ p(this, S, null);
52
+ p(this, P, -1);
53
+ p(this, g, !1);
54
+ p(this, y, /* @__PURE__ */ new Map());
55
+ /**
56
+ * Sets the player's interface language. The parameter value is an ISO 639-1 two-letter
57
+ * language code or a fully specified locale. For example, fr and fr-ca are both valid values.
58
+ * Other language input codes, such as IETF language tags (BCP 47) might also be handled properly.
59
+ *
60
+ * The interface language is used for tooltips in the player and also affects the default caption
61
+ * track. Note that YouTube might select a different caption track language for a particular
62
+ * user based on the user's individual language preferences and the availability of caption tracks.
63
+ *
64
+ * @defaultValue 'en'
65
+ */
66
+ v(this, "language", "en");
67
+ v(this, "color", "red");
68
+ /**
69
+ * Whether cookies should be enabled on the embed. This is turned off by default to be
70
+ * GDPR-compliant.
71
+ *
72
+ * @defaultValue `false`
73
+ */
74
+ v(this, "cookies", !1);
75
+ c(this, o, t);
76
+ }
77
+ get currentSrc() {
78
+ return s(this, S);
79
+ }
80
+ get type() {
81
+ return "youtube";
82
+ }
83
+ get videoId() {
84
+ return s(this, w).call(this);
85
+ }
86
+ preconnect() {
87
+ W(this.getOrigin());
88
+ }
89
+ setup() {
90
+ super.setup(), X(r(this, i, B).bind(this)), s(this, o).notify("provider-setup", this);
91
+ }
92
+ destroy() {
93
+ r(this, i, Y).call(this);
94
+ const e = "provider destroyed";
95
+ for (const t of s(this, y).values())
96
+ for (const { reject: u } of t) u(e);
97
+ s(this, y).clear();
98
+ }
99
+ async play() {
100
+ return r(this, i, m).call(this, "playVideo");
101
+ }
102
+ async pause() {
103
+ return r(this, i, m).call(this, "pauseVideo");
104
+ }
105
+ setMuted(e) {
106
+ e ? r(this, i, m).call(this, "mute") : r(this, i, m).call(this, "unMute");
107
+ }
108
+ setCurrentTime(e) {
109
+ r(this, i, m).call(this, "seekTo", e), s(this, o).notify("seeking", e);
110
+ }
111
+ setVolume(e) {
112
+ r(this, i, m).call(this, "setVolume", e * 100);
113
+ }
114
+ setPlaybackRate(e) {
115
+ r(this, i, m).call(this, "setPlaybackRate", e);
116
+ }
117
+ async loadSource(e) {
118
+ if (!Z(e.src)) {
119
+ c(this, S, null), s(this, w).set("");
120
+ return;
121
+ }
122
+ const t = z(e.src);
123
+ s(this, w).set(t ?? ""), c(this, S, e);
124
+ }
125
+ getOrigin() {
126
+ return this.cookies ? "https://www.youtube.com" : "https://www.youtube-nocookie.com";
127
+ }
128
+ buildParams() {
129
+ const { keyDisabled: e } = s(this, o).$props, { muted: t, playsInline: u, nativeControls: h } = s(this, o).$state, d = h();
130
+ return {
131
+ rel: 0,
132
+ autoplay: 0,
133
+ cc_lang_pref: this.language,
134
+ cc_load_policy: d ? 1 : void 0,
135
+ color: this.color,
136
+ controls: d ? 1 : 0,
137
+ disablekb: !d || e() ? 1 : 0,
138
+ enablejsapi: 1,
139
+ fs: 1,
140
+ hl: this.language,
141
+ iv_load_policy: d ? 1 : 3,
142
+ mute: t() ? 1 : 0,
143
+ playsinline: u() ? 1 : 0
144
+ };
145
+ }
146
+ onLoad() {
147
+ window.setTimeout(() => this.postMessage({ event: "listening" }), 100);
148
+ }
149
+ onMessage({ info: e }, t) {
150
+ var l;
151
+ if (!e) return;
152
+ const { title: u, intrinsicDuration: h, playbackRate: d } = s(this, o).$state;
153
+ if (te(e.videoData) && e.videoData.title !== u() && s(this, o).notify("title-change", e.videoData.title, t), $(e.duration) && e.duration !== h()) {
154
+ if ($(e.videoLoadedFraction)) {
155
+ const f = ((l = e.progressState) == null ? void 0 : l.loaded) ?? e.videoLoadedFraction * e.duration, T = new j(0, e.duration);
156
+ r(this, i, C).call(this, f, T, t);
157
+ }
158
+ s(this, o).notify("duration-change", e.duration, t);
159
+ }
160
+ if ($(e.playbackRate) && e.playbackRate !== d() && s(this, o).notify("rate-change", e.playbackRate, t), e.progressState) {
161
+ const { current: f, seekableStart: T, seekableEnd: M, loaded: K, duration: D } = e.progressState;
162
+ r(this, i, U).call(this, f, t), r(this, i, C).call(this, K, new j(T, M), t), D !== h() && s(this, o).notify("duration-change", D, t);
163
+ }
164
+ if ($(e.volume) && se(e.muted) && !s(this, g)) {
165
+ const f = {
166
+ muted: e.muted,
167
+ volume: e.volume / 100
168
+ };
169
+ s(this, o).notify("volume-change", f, t);
170
+ }
171
+ $(e.playerState) && e.playerState !== s(this, k) && r(this, i, q).call(this, e.playerState, t);
172
+ }
173
+ }
174
+ o = new WeakMap(), w = new WeakMap(), k = new WeakMap(), S = new WeakMap(), P = new WeakMap(), g = new WeakMap(), y = new WeakMap(), i = new WeakSet(), re = function(e) {
175
+ var t;
176
+ (t = r(this, i, _).call(this, "playVideo")) == null || t.reject(e);
177
+ }, ue = function(e) {
178
+ var t;
179
+ (t = r(this, i, _).call(this, "pauseVideo")) == null || t.reject(e);
180
+ }, B = function() {
181
+ r(this, i, Y).call(this);
182
+ const e = s(this, w).call(this);
183
+ if (!e) {
184
+ this.src.set("");
185
+ return;
186
+ }
187
+ this.src.set(`${this.getOrigin()}/embed/${e}`), s(this, o).notify("load-start");
188
+ }, m = function(e, t) {
189
+ let u = ee(), h = s(this, y).get(e);
190
+ return h || s(this, y).set(e, h = []), h.push(u), this.postMessage({
191
+ event: "command",
192
+ func: e,
193
+ args: t ? [t] : void 0
194
+ }), u.promise;
195
+ }, F = function(e) {
196
+ s(this, o).notify("loaded-metadata"), s(this, o).notify("loaded-data"), s(this, o).delegate.ready(void 0, e);
197
+ }, L = function(e) {
198
+ var t;
199
+ (t = r(this, i, _).call(this, "pauseVideo")) == null || t.resolve(), s(this, o).notify("pause", void 0, e);
200
+ }, U = function(e, t) {
201
+ const { duration: u, realCurrentTime: h } = s(this, o).$state, d = s(this, k) === b.Ended, l = d ? u() : e;
202
+ s(this, o).notify("time-change", l, t), !d && Math.abs(l - h()) > 1 && s(this, o).notify("seeking", l, t);
203
+ }, C = function(e, t, u) {
204
+ const h = {
205
+ buffered: new j(0, e),
206
+ seekable: t
207
+ };
208
+ s(this, o).notify("progress", h, u);
209
+ const { seeking: d, realCurrentTime: l } = s(this, o).$state;
210
+ d() && e > l() && r(this, i, V).call(this, u);
211
+ }, V = function(e) {
212
+ const { paused: t, realCurrentTime: u } = s(this, o).$state;
213
+ window.clearTimeout(s(this, P)), c(this, P, window.setTimeout(
214
+ () => {
215
+ s(this, o).notify("seeked", u(), e), c(this, P, -1);
216
+ },
217
+ t() ? 100 : 0
218
+ ));
219
+ }, I = function(e) {
220
+ const { seeking: t } = s(this, o).$state;
221
+ t() && r(this, i, V).call(this, e), s(this, o).notify("pause", void 0, e), s(this, o).notify("end", void 0, e);
222
+ }, q = function(e, t) {
223
+ var M;
224
+ const { paused: u, seeking: h } = s(this, o).$state, d = e === b.Playing, l = e === b.Buffering, f = r(this, i, J).call(this, "playVideo"), T = u() && (l || d);
225
+ if (l && s(this, o).notify("waiting", void 0, t), h() && d && r(this, i, V).call(this, t), s(this, g) && d) {
226
+ this.pause(), c(this, g, !1), this.setMuted(s(this, o).$state.muted());
227
+ return;
228
+ }
229
+ if (!f && T) {
230
+ c(this, g, !0), this.setMuted(!0);
231
+ return;
232
+ }
233
+ switch (T && ((M = r(this, i, _).call(this, "playVideo")) == null || M.resolve(), s(this, o).notify("play", void 0, t)), e) {
234
+ case b.Cued:
235
+ r(this, i, F).call(this, t);
236
+ break;
237
+ case b.Playing:
238
+ s(this, o).notify("playing", void 0, t);
239
+ break;
240
+ case b.Paused:
241
+ r(this, i, L).call(this, t);
242
+ break;
243
+ case b.Ended:
244
+ r(this, i, I).call(this, t);
245
+ break;
246
+ }
247
+ c(this, k, e);
248
+ }, Y = function() {
249
+ c(this, k, -1), c(this, P, -1), c(this, g, !1);
250
+ }, _ = function(e) {
251
+ var t;
252
+ return (t = s(this, y).get(e)) == null ? void 0 : t.shift();
253
+ }, J = function(e) {
254
+ var t;
255
+ return !!((t = s(this, y).get(e)) != null && t.length);
256
+ };
257
+ const ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
258
+ __proto__: null,
259
+ YouTubeProvider: ne
260
+ }, Symbol.toStringTag, { value: "Module" }));
261
+ export {
262
+ ce as p,
263
+ le as u
264
+ };