test-bentoweb-ui 1.0.73 → 1.0.75

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.
@@ -0,0 +1,29 @@
1
+ const g = /(?:https:\/\/)?(?:player\.)?vimeo(?:\.com)?\/(?:video\/)?(\d+)(?:(?:\?hash=|\?h=|\/)(.*))?/, c = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
2
+ function b(n) {
3
+ const o = n.match(g);
4
+ return { videoId: o == null ? void 0 : o[1], hash: o == null ? void 0 : o[2] };
5
+ }
6
+ async function w(n, o, r) {
7
+ if (c.has(n)) return c.get(n);
8
+ if (i.has(n)) return i.get(n);
9
+ let t = `https://vimeo.com/api/oembed.json?url=https://player.vimeo.com/video/${n}`;
10
+ r && (t = t.concat(`?h=${r}`));
11
+ const s = window.fetch(t, {
12
+ mode: "cors",
13
+ signal: o.signal
14
+ }).then((e) => e.json()).then((e) => {
15
+ var l, p;
16
+ const u = /vimeocdn.com\/video\/(.*)?_/, h = (p = (l = e == null ? void 0 : e.thumbnail_url) == null ? void 0 : l.match(u)) == null ? void 0 : p[1], f = h ? `https://i.vimeocdn.com/video/${h}_1920x1080.webp` : "", m = {
17
+ title: (e == null ? void 0 : e.title) ?? "",
18
+ duration: (e == null ? void 0 : e.duration) ?? 0,
19
+ poster: f,
20
+ pro: e.account_type !== "basic"
21
+ };
22
+ return c.set(n, m), m;
23
+ }).finally(() => i.delete(n));
24
+ return i.set(n, s), s;
25
+ }
26
+ export {
27
+ w as getVimeoVideoInfo,
28
+ b as resolveVimeoVideoId
29
+ };
@@ -0,0 +1,181 @@
1
+ var $ = Object.defineProperty;
2
+ var b = (i) => {
3
+ throw TypeError(i);
4
+ };
5
+ var N = (i, t, e) => t in i ? $(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
6
+ var m = (i, t, e) => N(i, typeof t != "symbol" ? t + "" : t, e), E = (i, t, e) => t.has(i) || b("Cannot " + e);
7
+ var s = (i, t, e) => (E(i, t, "read from private field"), e ? e.call(i) : t.get(i)), r = (i, t, e) => t.has(i) ? b("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), c = (i, t, e, n) => (E(i, t, "write to private field"), n ? n.call(i, e) : t.set(i, e), e), p = (i, t, e) => (E(i, t, "access private method"), e);
8
+ import { s as U, u as V, v as A, w as q, x as C, T as F, f as v, E as Y, l as _, D as j } from "./index-CJNQa9oe.js";
9
+ import { H as z, a as B } from "./vidstack-Bq6c3Bam-ajJxDr7M.js";
10
+ var P, f, k, D, H;
11
+ class G {
12
+ constructor(t, e) {
13
+ r(this, k);
14
+ r(this, P);
15
+ r(this, f);
16
+ c(this, P, t), c(this, f, e), t.textTracks.onaddtrack = p(this, k, D).bind(this), C(p(this, k, H).bind(this));
17
+ }
18
+ }
19
+ P = new WeakMap(), f = new WeakMap(), k = new WeakSet(), D = function(t) {
20
+ const e = t.track;
21
+ if (!e || J(s(this, P), e)) return;
22
+ const n = new F({
23
+ id: e.id,
24
+ kind: e.kind,
25
+ label: e.label ?? "",
26
+ language: e.language,
27
+ type: "vtt"
28
+ });
29
+ n[v.native] = { track: e }, n[v.readyState] = 2, n[v.nativeHLS] = !0;
30
+ let a = 0;
31
+ const I = (O) => {
32
+ if (e.cues)
33
+ for (let w = a; w < e.cues.length; w++)
34
+ n.addCue(e.cues[w], O), a++;
35
+ };
36
+ I(t), e.oncuechange = I, s(this, f).textTracks.add(n, t), n.setMode(e.mode, t);
37
+ }, H = function() {
38
+ var t;
39
+ s(this, P).textTracks.onaddtrack = null;
40
+ for (const e of s(this, f).textTracks) {
41
+ const n = (t = e[v.native]) == null ? void 0 : t.track;
42
+ n != null && n.oncuechange && (n.oncuechange = null);
43
+ }
44
+ };
45
+ function J(i, t) {
46
+ return Array.from(i.children).find((e) => e.track === t);
47
+ }
48
+ var d, y, x, S, L, T;
49
+ class K {
50
+ constructor(t, e) {
51
+ r(this, x);
52
+ r(this, d);
53
+ r(this, y);
54
+ r(this, T, (t, e) => {
55
+ s(this, y).notify("picture-in-picture-change", t, e);
56
+ });
57
+ c(this, d, t), c(this, y, e), new Y(t).add("enterpictureinpicture", p(this, x, S).bind(this)).add("leavepictureinpicture", p(this, x, L).bind(this));
58
+ }
59
+ get active() {
60
+ return document.pictureInPictureElement === s(this, d);
61
+ }
62
+ get supported() {
63
+ return A(s(this, d));
64
+ }
65
+ async enter() {
66
+ return s(this, d).requestPictureInPicture();
67
+ }
68
+ exit() {
69
+ return document.exitPictureInPicture();
70
+ }
71
+ }
72
+ d = new WeakMap(), y = new WeakMap(), x = new WeakSet(), S = function(t) {
73
+ s(this, T).call(this, !0, t);
74
+ }, L = function(t) {
75
+ s(this, T).call(this, !1, t);
76
+ }, T = new WeakMap();
77
+ var l, g, o, M, R;
78
+ class Q {
79
+ constructor(t, e) {
80
+ r(this, M);
81
+ r(this, l);
82
+ r(this, g);
83
+ r(this, o, "inline");
84
+ c(this, l, t), c(this, g, e), _(t, "webkitpresentationmodechanged", p(this, M, R).bind(this));
85
+ }
86
+ get mode() {
87
+ return s(this, o);
88
+ }
89
+ get supported() {
90
+ return V(s(this, l));
91
+ }
92
+ async setPresentationMode(t) {
93
+ s(this, o) !== t && s(this, l).webkitSetPresentationMode(t);
94
+ }
95
+ }
96
+ l = new WeakMap(), g = new WeakMap(), o = new WeakMap(), M = new WeakSet(), R = function(t) {
97
+ var n;
98
+ const e = s(this, o);
99
+ c(this, o, s(this, l).webkitPresentationMode), (n = s(this, g).player) == null || n.dispatch(
100
+ new j("video-presentation-change", {
101
+ detail: s(this, o),
102
+ trigger: t
103
+ })
104
+ ), ["fullscreen", "picture-in-picture"].forEach((a) => {
105
+ (s(this, o) === a || e === a) && s(this, g).notify(`${a}-change`, s(this, o) === a, t);
106
+ });
107
+ };
108
+ var u;
109
+ class W {
110
+ constructor(t) {
111
+ r(this, u);
112
+ c(this, u, t);
113
+ }
114
+ get active() {
115
+ return s(this, u).mode === "fullscreen";
116
+ }
117
+ get supported() {
118
+ return s(this, u).supported;
119
+ }
120
+ async enter() {
121
+ s(this, u).setPresentationMode("fullscreen");
122
+ }
123
+ async exit() {
124
+ s(this, u).setPresentationMode("inline");
125
+ }
126
+ }
127
+ u = new WeakMap();
128
+ var h;
129
+ class X {
130
+ constructor(t) {
131
+ r(this, h);
132
+ c(this, h, t);
133
+ }
134
+ get active() {
135
+ return s(this, h).mode === "picture-in-picture";
136
+ }
137
+ get supported() {
138
+ return s(this, h).supported;
139
+ }
140
+ async enter() {
141
+ s(this, h).setPresentationMode("picture-in-picture");
142
+ }
143
+ async exit() {
144
+ s(this, h).setPresentationMode("inline");
145
+ }
146
+ }
147
+ h = new WeakMap();
148
+ class it extends z {
149
+ constructor(e, n) {
150
+ super(e, n);
151
+ m(this, "$$PROVIDER_TYPE", "VIDEO");
152
+ m(this, "airPlay");
153
+ m(this, "fullscreen");
154
+ m(this, "pictureInPicture");
155
+ U(() => {
156
+ if (this.airPlay = new B(e, n), V(e)) {
157
+ const a = new Q(e, n);
158
+ this.fullscreen = new W(a), this.pictureInPicture = new X(a);
159
+ } else A(e) && (this.pictureInPicture = new K(e, n));
160
+ }, this.scope);
161
+ }
162
+ get type() {
163
+ return "video";
164
+ }
165
+ setup() {
166
+ super.setup(), q(this.video) && new G(this.video, this.ctx), this.ctx.textRenderers.attachVideo(this.video), C(() => {
167
+ this.ctx.textRenderers.attachVideo(null);
168
+ }), this.type === "video" && this.ctx.notify("provider-setup", this);
169
+ }
170
+ /**
171
+ * The native HTML `<video>` element.
172
+ *
173
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement}
174
+ */
175
+ get video() {
176
+ return this.media;
177
+ }
178
+ }
179
+ export {
180
+ it as VideoProvider
181
+ };
@@ -0,0 +1,434 @@
1
+ var ue = Object.defineProperty;
2
+ var N = (r) => {
3
+ throw TypeError(r);
4
+ };
5
+ var de = (r, c, e) => c in r ? ue(r, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[c] = e;
6
+ var b = (r, c, e) => de(r, typeof c != "symbol" ? c + "" : c, e), S = (r, c, e) => c.has(r) || N("Cannot " + e);
7
+ var t = (r, c, e) => (S(r, c, "read from private field"), e ? e.call(r) : c.get(r)), f = (r, c, e) => c.has(r) ? N("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(r) : c.set(r, e), u = (r, c, e, i) => (S(r, c, "write to private field"), i ? i.call(r, e) : c.set(r, e), e), o = (r, c, e) => (S(r, c, "access private method"), e);
8
+ import { y as fe, J as U, K as C, p as pe, e as q, d as Q, b as ye, M as _, L as R, l as be, N as ke, T as ve, Q as J } from "./index-CJNQa9oe.js";
9
+ import { R as me } from "./vidstack-DqAw8m9J-C-yN2xmu.js";
10
+ import { E as we } from "./vidstack-DDXt6fpN-BeN5Ad9F.js";
11
+ import { resolveVimeoVideoId as Pe, getVimeoVideoInfo as Te } from "./vidstack-krOAtKMi-B4IZWKdc.js";
12
+ const Ce = [
13
+ "bufferend",
14
+ "bufferstart",
15
+ // 'cuechange',
16
+ "durationchange",
17
+ "ended",
18
+ "enterpictureinpicture",
19
+ "error",
20
+ "fullscreenchange",
21
+ "leavepictureinpicture",
22
+ "loaded",
23
+ // 'loadeddata',
24
+ // 'loadedmetadata',
25
+ // 'loadstart',
26
+ "playProgress",
27
+ "loadProgress",
28
+ "pause",
29
+ "play",
30
+ "playbackratechange",
31
+ // 'progress',
32
+ "qualitychange",
33
+ "seeked",
34
+ "seeking",
35
+ // 'texttrackchange',
36
+ "timeupdate",
37
+ "volumechange",
38
+ "waiting"
39
+ // 'adstarted',
40
+ // 'adcompleted',
41
+ // 'aderror',
42
+ // 'adskipped',
43
+ // 'adallcompleted',
44
+ // 'adclicked',
45
+ // 'chapterchange',
46
+ // 'chromecastconnected',
47
+ // 'remoteplaybackavailabilitychange',
48
+ // 'remoteplaybackconnecting',
49
+ // 'remoteplaybackconnect',
50
+ // 'remoteplaybackdisconnect',
51
+ // 'liveeventended',
52
+ // 'liveeventstarted',
53
+ // 'livestreamoffline',
54
+ // 'livestreamonline',
55
+ ];
56
+ var a, y, k, w, g, V, v, $, M, P, m, E, s, K, W, Y, z, T, G, H, X, L, Z, ee, te, se, ie, x, ne, ae, oe, F, he, O, re, D, ce, le, l, j, B;
57
+ class Re extends we {
58
+ constructor(e, i) {
59
+ super(e);
60
+ f(this, s);
61
+ b(this, "$$PROVIDER_TYPE", "VIMEO");
62
+ b(this, "scope", fe());
63
+ b(this, "fullscreen");
64
+ f(this, a);
65
+ f(this, y, U(""));
66
+ f(this, k, U(!1));
67
+ f(this, w, null);
68
+ f(this, g, null);
69
+ f(this, V, !1);
70
+ f(this, v, new C(0, 0));
71
+ f(this, $, new me(o(this, s, z).bind(this)));
72
+ f(this, M, null);
73
+ f(this, P, null);
74
+ f(this, m, /* @__PURE__ */ new Map());
75
+ f(this, E, null);
76
+ /**
77
+ * Whether tracking session data should be enabled on the embed, including cookies and analytics.
78
+ * This is turned off by default to be GDPR-compliant.
79
+ *
80
+ * @defaultValue `false`
81
+ */
82
+ b(this, "cookies", !1);
83
+ b(this, "title", !0);
84
+ b(this, "byline", !0);
85
+ b(this, "portrait", !0);
86
+ b(this, "color", "00ADEF");
87
+ // Embed will sometimes dispatch 0 at end of playback.
88
+ f(this, T, !1);
89
+ u(this, a, i);
90
+ const n = this;
91
+ this.fullscreen = {
92
+ get active() {
93
+ return t(n, V);
94
+ },
95
+ supported: !0,
96
+ enter: () => o(this, s, l).call(this, "requestFullscreen"),
97
+ exit: () => o(this, s, l).call(this, "exitFullscreen")
98
+ };
99
+ }
100
+ get type() {
101
+ return "vimeo";
102
+ }
103
+ get currentSrc() {
104
+ return t(this, g);
105
+ }
106
+ get videoId() {
107
+ return t(this, y).call(this);
108
+ }
109
+ get hash() {
110
+ return t(this, w);
111
+ }
112
+ get isPro() {
113
+ return t(this, k).call(this);
114
+ }
115
+ preconnect() {
116
+ pe(this.getOrigin());
117
+ }
118
+ setup() {
119
+ super.setup(), q(o(this, s, K).bind(this)), q(o(this, s, W).bind(this)), q(o(this, s, Y).bind(this)), t(this, a).notify("provider-setup", this);
120
+ }
121
+ destroy() {
122
+ o(this, s, j).call(this), this.fullscreen = void 0;
123
+ const e = "provider destroyed";
124
+ for (const i of t(this, m).values())
125
+ for (const { reject: n } of i) n(e);
126
+ t(this, m).clear(), o(this, s, l).call(this, "destroy");
127
+ }
128
+ async play() {
129
+ return o(this, s, l).call(this, "play");
130
+ }
131
+ async pause() {
132
+ return o(this, s, l).call(this, "pause");
133
+ }
134
+ setMuted(e) {
135
+ o(this, s, l).call(this, "setMuted", e);
136
+ }
137
+ setCurrentTime(e) {
138
+ o(this, s, l).call(this, "seekTo", e), t(this, a).notify("seeking", e);
139
+ }
140
+ setVolume(e) {
141
+ o(this, s, l).call(this, "setVolume", e), o(this, s, l).call(this, "setMuted", Q(t(this, a).$state.muted));
142
+ }
143
+ setPlaybackRate(e) {
144
+ o(this, s, l).call(this, "setPlaybackRate", e);
145
+ }
146
+ async loadSource(e) {
147
+ if (!ye(e.src)) {
148
+ u(this, g, null), u(this, w, null), t(this, y).set("");
149
+ return;
150
+ }
151
+ const { videoId: i, hash: n } = Pe(e.src);
152
+ t(this, y).set(i ?? ""), u(this, w, n ?? null), u(this, g, e);
153
+ }
154
+ getOrigin() {
155
+ return "https://player.vimeo.com";
156
+ }
157
+ buildParams() {
158
+ const { keyDisabled: e } = t(this, a).$props, { playsInline: i, nativeControls: n } = t(this, a).$state, h = n();
159
+ return {
160
+ title: this.title,
161
+ byline: this.byline,
162
+ color: this.color,
163
+ portrait: this.portrait,
164
+ controls: h,
165
+ h: this.hash,
166
+ keyboard: h && !e(),
167
+ transparent: !0,
168
+ playsinline: i(),
169
+ dnt: !this.cookies
170
+ };
171
+ }
172
+ onMessage(e, i) {
173
+ e.event ? o(this, s, ce).call(this, e.event, e.data, i) : e.method && o(this, s, Z).call(this, e.method, e.value, i);
174
+ }
175
+ onLoad() {
176
+ }
177
+ }
178
+ a = new WeakMap(), y = new WeakMap(), k = new WeakMap(), w = new WeakMap(), g = new WeakMap(), V = new WeakMap(), v = new WeakMap(), $ = new WeakMap(), M = new WeakMap(), P = new WeakMap(), m = new WeakMap(), E = new WeakMap(), s = new WeakSet(), K = function() {
179
+ o(this, s, j).call(this);
180
+ const e = t(this, y).call(this);
181
+ if (!e) {
182
+ this.src.set("");
183
+ return;
184
+ }
185
+ this.src.set(`${this.getOrigin()}/video/${e}`), t(this, a).notify("load-start");
186
+ }, W = function() {
187
+ const e = t(this, y).call(this);
188
+ if (!e) return;
189
+ const i = _(), n = new AbortController();
190
+ return u(this, E, i), Te(e, n, t(this, w)).then((h) => {
191
+ i.resolve(h);
192
+ }).catch((h) => {
193
+ i.reject();
194
+ }), () => {
195
+ i.reject(), n.abort();
196
+ };
197
+ }, Y = function() {
198
+ const e = t(this, k).call(this), { $state: i, qualities: n } = t(this, a);
199
+ if (i.canSetPlaybackRate.set(e), n[R.setReadonly](!e), e)
200
+ return be(n, "change", () => {
201
+ var d;
202
+ if (n.auto) return;
203
+ const h = (d = n.selected) == null ? void 0 : d.id;
204
+ h && o(this, s, l).call(this, "setQuality", h);
205
+ });
206
+ }, z = function() {
207
+ o(this, s, l).call(this, "getCurrentTime");
208
+ }, T = new WeakMap(), G = function(e, i) {
209
+ if (t(this, T) && e === 0) return;
210
+ const { realCurrentTime: n, paused: h, bufferedEnd: d, seekableEnd: p, live: I } = t(this, a).$state;
211
+ if (n() === e) return;
212
+ const A = n();
213
+ t(this, a).notify("time-change", e, i), Math.abs(A - e) > 1.5 && (t(this, a).notify("seeking", e, i), !h() && d() < e && t(this, a).notify("waiting", void 0, i)), !I() && p() - e < 0.01 && (t(this, a).notify("end", void 0, i), u(this, T, !0), setTimeout(() => {
214
+ u(this, T, !1);
215
+ }, 500));
216
+ }, H = function(e, i) {
217
+ t(this, a).notify("seeked", e, i);
218
+ }, X = function(e) {
219
+ var n;
220
+ const i = t(this, y).call(this);
221
+ (n = t(this, E)) == null || n.promise.then((h) => {
222
+ if (!h) return;
223
+ const { title: d, poster: p, duration: I, pro: A } = h;
224
+ t(this, k).set(A), t(this, a).notify("title-change", d, e), t(this, a).notify("poster-change", p, e), t(this, a).notify("duration-change", I, e), o(this, s, L).call(this, I, e);
225
+ }).catch(() => {
226
+ i === t(this, y).call(this) && (o(this, s, l).call(this, "getVideoTitle"), o(this, s, l).call(this, "getDuration"));
227
+ });
228
+ }, L = function(e, i) {
229
+ const { nativeControls: n } = t(this, a).$state, h = n();
230
+ u(this, v, new C(0, e));
231
+ const d = {
232
+ buffered: new C(0, 0),
233
+ seekable: t(this, v),
234
+ duration: e
235
+ };
236
+ t(this, a).delegate.ready(d, i), h || o(this, s, l).call(this, "_hideOverlay"), o(this, s, l).call(this, "getQualities"), o(this, s, l).call(this, "getChapters");
237
+ }, Z = function(e, i, n) {
238
+ var h;
239
+ switch (e) {
240
+ case "getVideoTitle":
241
+ const d = i;
242
+ t(this, a).notify("title-change", d, n);
243
+ break;
244
+ case "getDuration":
245
+ const p = i;
246
+ t(this, a).$state.canPlay() ? t(this, a).notify("duration-change", p, n) : o(this, s, L).call(this, p, n);
247
+ break;
248
+ case "getCurrentTime":
249
+ o(this, s, G).call(this, i, n);
250
+ break;
251
+ case "getBuffered":
252
+ ke(i) && i.length && o(this, s, x).call(this, i[i.length - 1][1], n);
253
+ break;
254
+ case "setMuted":
255
+ o(this, s, F).call(this, Q(t(this, a).$state.volume), i, n);
256
+ break;
257
+ case "getChapters":
258
+ o(this, s, he).call(this, i);
259
+ break;
260
+ case "getQualities":
261
+ o(this, s, re).call(this, i, n);
262
+ break;
263
+ }
264
+ (h = o(this, s, B).call(this, e)) == null || h.resolve();
265
+ }, ee = function() {
266
+ for (const e of Ce)
267
+ o(this, s, l).call(this, "addEventListener", e);
268
+ }, te = function(e) {
269
+ t(this, $).stop(), t(this, a).notify("pause", void 0, e);
270
+ }, se = function(e) {
271
+ t(this, $).start(), t(this, a).notify("play", void 0, e);
272
+ }, ie = function(e) {
273
+ const { paused: i } = t(this, a).$state;
274
+ !i() && !t(this, T) && t(this, a).notify("playing", void 0, e);
275
+ }, x = function(e, i) {
276
+ const n = {
277
+ buffered: new C(0, e),
278
+ seekable: t(this, v)
279
+ };
280
+ t(this, a).notify("progress", n, i);
281
+ }, ne = function(e) {
282
+ t(this, a).notify("waiting", void 0, e);
283
+ }, ae = function(e) {
284
+ const { paused: i } = t(this, a).$state;
285
+ i() || t(this, a).notify("playing", void 0, e);
286
+ }, oe = function(e) {
287
+ const { paused: i } = t(this, a).$state;
288
+ i() && t(this, a).notify("play", void 0, e), t(this, a).notify("waiting", void 0, e);
289
+ }, F = function(e, i, n) {
290
+ const h = { volume: e, muted: i };
291
+ t(this, a).notify("volume-change", h, n);
292
+ }, // #onTextTrackChange(track: VimeoTextTrack, trigger: Event) {
293
+ // const textTrack = this.#ctx.textTracks.toArray().find((t) => t.language === track.language);
294
+ // if (textTrack) textTrack.mode = track.mode;
295
+ // }
296
+ // #onTextTracksChange(tracks: VimeoTextTrack[], trigger: Event) {
297
+ // for (const init of tracks) {
298
+ // const textTrack = new TextTrack({
299
+ // ...init,
300
+ // label: init.label.replace('auto-generated', 'auto'),
301
+ // });
302
+ // textTrack[TextTrackSymbol.readyState] = 2;
303
+ // this.#ctx.textTracks.add(textTrack, trigger);
304
+ // textTrack.setMode(init.mode, trigger);
305
+ // }
306
+ // }
307
+ // #onCueChange(cue: VimeoTextCue, trigger: Event) {
308
+ // const { textTracks, $state } = this.#ctx,
309
+ // { currentTime } = $state,
310
+ // track = textTracks.selected;
311
+ // if (this.#currentCue) track?.removeCue(this.#currentCue, trigger);
312
+ // this.#currentCue = new window.VTTCue(currentTime(), Number.MAX_SAFE_INTEGER, cue.text);
313
+ // track?.addCue(this.#currentCue, trigger);
314
+ // }
315
+ he = function(e) {
316
+ if (o(this, s, O).call(this), !e.length) return;
317
+ const i = new ve({
318
+ kind: "chapters",
319
+ default: !0
320
+ }), { seekableEnd: n } = t(this, a).$state;
321
+ for (let h = 0; h < e.length; h++) {
322
+ const d = e[h], p = e[h + 1];
323
+ i.addCue(
324
+ new window.VTTCue(
325
+ d.startTime,
326
+ (p == null ? void 0 : p.startTime) ?? n(),
327
+ d.title
328
+ )
329
+ );
330
+ }
331
+ u(this, P, i), t(this, a).textTracks.add(i);
332
+ }, O = function() {
333
+ t(this, P) && (t(this, a).textTracks.remove(t(this, P)), u(this, P, null));
334
+ }, re = function(e, i) {
335
+ t(this, a).qualities[J.enableAuto] = e.some((n) => n.id === "auto") ? () => o(this, s, l).call(this, "setQuality", "auto") : void 0;
336
+ for (const n of e) {
337
+ if (n.id === "auto") continue;
338
+ const h = +n.id.slice(0, -1);
339
+ isNaN(h) || t(this, a).qualities[R.add](
340
+ {
341
+ id: n.id,
342
+ width: h * (16 / 9),
343
+ height: h,
344
+ codec: "avc1,h.264",
345
+ bitrate: -1
346
+ },
347
+ i
348
+ );
349
+ }
350
+ o(this, s, D).call(this, e.find((n) => n.active), i);
351
+ }, D = function({ id: e } = {}, i) {
352
+ if (!e) return;
353
+ const n = e === "auto", h = t(this, a).qualities.getById(e);
354
+ n ? (t(this, a).qualities[J.setAuto](n, i), t(this, a).qualities[R.select](void 0, !0, i)) : t(this, a).qualities[R.select](h ?? void 0, !0, i);
355
+ }, ce = function(e, i, n) {
356
+ switch (e) {
357
+ case "ready":
358
+ o(this, s, ee).call(this);
359
+ break;
360
+ case "loaded":
361
+ o(this, s, X).call(this, n);
362
+ break;
363
+ case "play":
364
+ o(this, s, se).call(this, n);
365
+ break;
366
+ case "playProgress":
367
+ o(this, s, ie).call(this, n);
368
+ break;
369
+ case "pause":
370
+ o(this, s, te).call(this, n);
371
+ break;
372
+ case "loadProgress":
373
+ o(this, s, x).call(this, i.seconds, n);
374
+ break;
375
+ case "waiting":
376
+ o(this, s, oe).call(this, n);
377
+ break;
378
+ case "bufferstart":
379
+ o(this, s, ne).call(this, n);
380
+ break;
381
+ case "bufferend":
382
+ o(this, s, ae).call(this, n);
383
+ break;
384
+ case "volumechange":
385
+ o(this, s, F).call(this, i.volume, Q(t(this, a).$state.muted), n);
386
+ break;
387
+ case "durationchange":
388
+ u(this, v, new C(0, i.duration)), t(this, a).notify("duration-change", i.duration, n);
389
+ break;
390
+ case "playbackratechange":
391
+ t(this, a).notify("rate-change", i.playbackRate, n);
392
+ break;
393
+ case "qualitychange":
394
+ o(this, s, D).call(this, i, n);
395
+ break;
396
+ case "fullscreenchange":
397
+ u(this, V, i.fullscreen), t(this, a).notify("fullscreen-change", i.fullscreen, n);
398
+ break;
399
+ case "enterpictureinpicture":
400
+ t(this, a).notify("picture-in-picture-change", !0, n);
401
+ break;
402
+ case "leavepictureinpicture":
403
+ t(this, a).notify("picture-in-picture-change", !1, n);
404
+ break;
405
+ case "ended":
406
+ t(this, a).notify("end", void 0, n);
407
+ break;
408
+ case "error":
409
+ o(this, s, le).call(this, i, n);
410
+ break;
411
+ case "seek":
412
+ case "seeked":
413
+ o(this, s, H).call(this, i.seconds, n);
414
+ break;
415
+ }
416
+ }, le = function(e, i) {
417
+ var d;
418
+ const { message: n, method: h } = e;
419
+ h === "setPlaybackRate" && t(this, k).set(!1), h && ((d = o(this, s, B).call(this, h)) == null || d.reject(n));
420
+ }, l = async function(e, i) {
421
+ let n = _(), h = t(this, m).get(e);
422
+ return h || t(this, m).set(e, h = []), h.push(n), this.postMessage({
423
+ method: e,
424
+ value: i
425
+ }), n.promise;
426
+ }, j = function() {
427
+ t(this, $).stop(), u(this, v, new C(0, 0)), u(this, E, null), u(this, M, null), t(this, k).set(!1), o(this, s, O).call(this);
428
+ }, B = function(e) {
429
+ var i;
430
+ return (i = t(this, m).get(e)) == null ? void 0 : i.shift();
431
+ };
432
+ export {
433
+ Re as VimeoProvider
434
+ };