@tidal-music/player-web-components 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{basePlayer-a-avZASH-Ux-6s9Ex.js → basePlayer-BcooVl9P-WesO1_17.js} +188 -178
- package/dist/{browserPlayer-oNOpDVm6-UW0N6pFH.js → browserPlayer-B1V50MdI-D65N_aRN.js} +67 -74
- package/dist/{index-tM9JvbA8.js → index-DbGwqQeZ.js} +563 -498
- package/dist/index.js +4 -4
- package/dist/{nativePlayer-U375Dfm5-hUK7oXzY.js → nativePlayer-DdpXKE9r-B14o92dS.js} +7 -7
- package/dist/{output-devices-NXuo75MQ-_vYYuqUm.js → output-devices-BhcWYG6e-l4DCXneM.js} +16 -16
- package/dist/shakaPlayer-Brgd4rob-DJ5uJTjr.js +26243 -0
- package/dist/{worker-qh_9Fyf6-Li0uY2-a.js → worker-DrRlSx4a-BTanKBsS.js} +13 -13
- package/package.json +19 -21
- package/dist/shakaPlayer-izGFLVQr--XUsjgT2.js +0 -24740
- /package/dist/{_commonjsHelpers-f3sTPFkQ-YKQV-mq1.js → _commonjsHelpers-DaMA6jEr-DtILRGNx.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
let
|
|
1
|
+
let x = Object.freeze({
|
|
2
2
|
apiUrl: "https://api.tidal.com/v1",
|
|
3
3
|
appVersion: "TIDAL Player",
|
|
4
4
|
clientPlatform: "web",
|
|
@@ -9,55 +9,69 @@ let R = Object.freeze({
|
|
|
9
9
|
outputDevicesEnabled: !1,
|
|
10
10
|
streamingWifiAudioQuality: "LOW"
|
|
11
11
|
});
|
|
12
|
-
function
|
|
13
|
-
return
|
|
12
|
+
function M(t) {
|
|
13
|
+
return x[t];
|
|
14
14
|
}
|
|
15
15
|
function G(t) {
|
|
16
|
-
return
|
|
17
|
-
...
|
|
16
|
+
return x = Object.freeze({
|
|
17
|
+
...x,
|
|
18
18
|
...t
|
|
19
19
|
}), Object.keys(t).forEach((e) => {
|
|
20
20
|
const r = e;
|
|
21
|
-
|
|
22
|
-
}),
|
|
21
|
+
we.dispatchEvent(new CustomEvent(r, { detail: t[r] }));
|
|
22
|
+
}), x;
|
|
23
23
|
}
|
|
24
|
-
const
|
|
25
|
-
var
|
|
24
|
+
const we = new EventTarget();
|
|
25
|
+
var Z = (t, e, r) => {
|
|
26
26
|
if (!e.has(t))
|
|
27
27
|
throw TypeError("Cannot " + r);
|
|
28
|
-
},
|
|
28
|
+
}, S = (t, e, r) => (Z(t, e, "read from private field"), r ? r.call(t) : e.get(t)), R = (t, e, r) => {
|
|
29
29
|
if (e.has(t))
|
|
30
30
|
throw TypeError("Cannot add the same private member more than once");
|
|
31
31
|
e instanceof WeakSet ? e.add(t) : e.set(t, r);
|
|
32
|
-
},
|
|
33
|
-
class
|
|
32
|
+
}, A = (t, e, r, s) => (Z(t, e, "write to private field"), e.set(t, r), r), P, _, N, D;
|
|
33
|
+
class be {
|
|
34
34
|
constructor(e) {
|
|
35
|
-
|
|
35
|
+
R(this, P, void 0), R(this, _, !1), R(this, N, void 0), R(this, D, void 0), A(this, D, new URL(e)), this.synchronize();
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
);
|
|
37
|
+
/**
|
|
38
|
+
* Returns the current time adjusted to server-time.
|
|
39
|
+
*
|
|
40
|
+
* @param clientCurrentTime The current time on the client side. Defaults to Date.now().
|
|
41
|
+
* @returns The current adjusted time (or the client time if not synced yet).
|
|
42
|
+
*/
|
|
43
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
44
|
+
now(e = Date.now()) {
|
|
45
|
+
return !S(this, N) || !S(this, P) ? (console.warn("TrueTime is not yet synchronized"), e) : S(this, N) + (e - S(this, P));
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Synchronizes the client's time with the server's time.
|
|
49
|
+
* If the client's time is already synchronized within an hour, this method does nothing.
|
|
49
50
|
*
|
|
50
|
-
* @
|
|
51
|
+
* @returns {Promise<void>} A promise that resolves when the synchronization is complete.
|
|
51
52
|
*/
|
|
52
53
|
async synchronize() {
|
|
53
|
-
if (!
|
|
54
|
+
if (!(S(this, P) && // eslint-disable-next-line no-restricted-syntax
|
|
55
|
+
Math.abs(Date.now() - S(this, P)) < 36e5 || S(this, _))) {
|
|
56
|
+
A(this, _, !0);
|
|
54
57
|
try {
|
|
55
|
-
const e = await fetch(
|
|
56
|
-
e.ok && e.headers.has("date") && (
|
|
58
|
+
const e = await fetch(S(this, D));
|
|
59
|
+
e.ok && e.headers.has("date") && (A(this, N, new Date(e.headers.get("date")).getTime()), A(this, P, Date.now()));
|
|
57
60
|
} catch (e) {
|
|
58
61
|
console.error(e);
|
|
59
62
|
}
|
|
63
|
+
A(this, _, !1);
|
|
64
|
+
}
|
|
60
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Returns the timestamp of a performance mark with the specified name and detail.
|
|
68
|
+
* PS: `performance.mark` must be called with `startTime: trueTime.now()`.
|
|
69
|
+
*
|
|
70
|
+
* @param markName - The name of the performance mark.
|
|
71
|
+
* @param detail - Optional. The detail of the performance mark.
|
|
72
|
+
* @returns The timestamp of the performance mark, or undefined if not found.
|
|
73
|
+
* @throws ReferenceError if the performance mark is not found.
|
|
74
|
+
*/
|
|
61
75
|
timestamp(e, r) {
|
|
62
76
|
let s;
|
|
63
77
|
if (r) {
|
|
@@ -67,18 +81,17 @@ class te {
|
|
|
67
81
|
);
|
|
68
82
|
} else
|
|
69
83
|
s = performance.getEntriesByName(e).pop();
|
|
70
|
-
return s ?
|
|
84
|
+
return s ? s.startTime : void 0;
|
|
71
85
|
}
|
|
72
86
|
}
|
|
73
|
-
|
|
74
|
-
new
|
|
75
|
-
const b = new te("https://api.tidal.com/v1/ping"), K = (t, e, r) => {
|
|
87
|
+
P = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap();
|
|
88
|
+
const y = new be("https://api.tidal.com/v1/ping"), Q = (t, e, r) => {
|
|
76
89
|
for (const s of t) {
|
|
77
90
|
const n = s.addedNodes[0];
|
|
78
91
|
s.type === "childList" && n.id === e && r();
|
|
79
92
|
}
|
|
80
93
|
};
|
|
81
|
-
function
|
|
94
|
+
function ve() {
|
|
82
95
|
const t = document.getElementById("tidal-player-root");
|
|
83
96
|
if (!t)
|
|
84
97
|
return Promise.reject("No player root");
|
|
@@ -88,59 +101,59 @@ function Ee() {
|
|
|
88
101
|
return "video-one" in t.children || e.push(
|
|
89
102
|
new Promise((r) => {
|
|
90
103
|
new MutationObserver(
|
|
91
|
-
(s) =>
|
|
104
|
+
(s) => Q(s, "video-one", r)
|
|
92
105
|
).observe(t, { childList: !0 });
|
|
93
106
|
})
|
|
94
107
|
), "video-two" in t.children || e.push(
|
|
95
108
|
new Promise((r) => {
|
|
96
109
|
new MutationObserver(
|
|
97
|
-
(s) =>
|
|
110
|
+
(s) => Q(s, "video-two", r)
|
|
98
111
|
).observe(t, { childList: !0 });
|
|
99
112
|
})
|
|
100
113
|
), Promise.all(e);
|
|
101
114
|
}
|
|
102
|
-
const
|
|
115
|
+
const T = document.createElement("video"), I = document.createElement("video"), ee = (t) => {
|
|
103
116
|
t.setAttribute("crossorigin", "anonymous"), t.setAttribute("playsinline", "playsinline");
|
|
104
117
|
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
function
|
|
111
|
-
let t = document.getElementById(
|
|
118
|
+
ee(T);
|
|
119
|
+
T.id = "video-one";
|
|
120
|
+
ee(I);
|
|
121
|
+
I.id = "video-two";
|
|
122
|
+
const W = "tidal-player-root";
|
|
123
|
+
function Se() {
|
|
124
|
+
let t = document.getElementById(W);
|
|
112
125
|
if (!t) {
|
|
113
126
|
const e = document.createElement("template");
|
|
114
|
-
e.id =
|
|
127
|
+
e.id = W, document.body.appendChild(e), t = document.getElementById(W);
|
|
115
128
|
}
|
|
116
|
-
return
|
|
129
|
+
return ke();
|
|
117
130
|
}
|
|
118
|
-
function
|
|
131
|
+
function ke() {
|
|
119
132
|
const t = document.getElementById(
|
|
120
|
-
|
|
133
|
+
W
|
|
121
134
|
);
|
|
122
|
-
return t && (
|
|
135
|
+
return t && (T.id in t.children || t.appendChild(T), I.id in t.children || t.appendChild(I)), ve();
|
|
123
136
|
}
|
|
124
|
-
function
|
|
137
|
+
function Me() {
|
|
125
138
|
return new Promise(
|
|
126
139
|
(t) => document.addEventListener(
|
|
127
140
|
"click",
|
|
128
141
|
() => {
|
|
129
|
-
|
|
142
|
+
T.readyState === HTMLMediaElement.HAVE_NOTHING && !T.src && T.load(), I.readyState === HTMLMediaElement.HAVE_NOTHING && !I.src && I.load(), t();
|
|
130
143
|
},
|
|
131
144
|
{ once: !0 }
|
|
132
145
|
)
|
|
133
146
|
);
|
|
134
147
|
}
|
|
135
|
-
function
|
|
148
|
+
function Ee(t) {
|
|
136
149
|
return new Promise((e) => setTimeout(() => e(), t));
|
|
137
150
|
}
|
|
138
|
-
function
|
|
151
|
+
function Pe(t, e) {
|
|
139
152
|
return new Promise((r) => {
|
|
140
153
|
t.addEventListener(e, (s) => r(s), !1);
|
|
141
154
|
});
|
|
142
155
|
}
|
|
143
|
-
class
|
|
156
|
+
class Te extends EventTarget {
|
|
144
157
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
145
158
|
// @ts-ignore - Setter
|
|
146
159
|
#e;
|
|
@@ -170,7 +183,7 @@ class Ae extends EventTarget {
|
|
|
170
183
|
return this.#e;
|
|
171
184
|
}
|
|
172
185
|
}
|
|
173
|
-
class
|
|
186
|
+
class V extends Error {
|
|
174
187
|
errorCode = null;
|
|
175
188
|
errorId = null;
|
|
176
189
|
referenceId;
|
|
@@ -188,19 +201,19 @@ class W extends Error {
|
|
|
188
201
|
return JSON.stringify(this.toJSON());
|
|
189
202
|
}
|
|
190
203
|
}
|
|
191
|
-
async function
|
|
204
|
+
async function B() {
|
|
192
205
|
if (v.credentialsProvider) {
|
|
193
206
|
const t = await v.credentialsProvider.getCredentials();
|
|
194
207
|
return !!(t.token && t.userId);
|
|
195
208
|
}
|
|
196
|
-
return await
|
|
209
|
+
return await Pe(v, "authorized"), B();
|
|
197
210
|
}
|
|
198
|
-
const v = new
|
|
199
|
-
async function
|
|
200
|
-
const t = await
|
|
201
|
-
const { Pushkin: s } = await Promise.resolve().then(() =>
|
|
211
|
+
const v = new Te();
|
|
212
|
+
async function Ie() {
|
|
213
|
+
const t = await B(), e = async () => {
|
|
214
|
+
const { Pushkin: s } = await Promise.resolve().then(() => Et);
|
|
202
215
|
return s.refresh();
|
|
203
|
-
}, r = async () => (await Promise.resolve().then(() =>
|
|
216
|
+
}, r = async () => (await Promise.resolve().then(() => ut)).start();
|
|
204
217
|
if (t) {
|
|
205
218
|
G({
|
|
206
219
|
gatherEvents: !0
|
|
@@ -216,12 +229,12 @@ async function Ce() {
|
|
|
216
229
|
});
|
|
217
230
|
}
|
|
218
231
|
v.addEventListener("authorized", () => {
|
|
219
|
-
|
|
232
|
+
Ie().then().catch(console.error);
|
|
220
233
|
});
|
|
221
|
-
async function
|
|
234
|
+
async function K() {
|
|
222
235
|
return v.credentialsProvider ? (await v.credentialsProvider.getCredentials()).token ?? null : null;
|
|
223
236
|
}
|
|
224
|
-
class
|
|
237
|
+
class Le extends EventTarget {
|
|
225
238
|
dispatchError(e) {
|
|
226
239
|
this.dispatchEvent(
|
|
227
240
|
new CustomEvent("error", {
|
|
@@ -230,10 +243,10 @@ class _e extends EventTarget {
|
|
|
230
243
|
);
|
|
231
244
|
}
|
|
232
245
|
}
|
|
233
|
-
const h = new
|
|
234
|
-
class
|
|
246
|
+
const h = new Le();
|
|
247
|
+
class Oe {
|
|
235
248
|
#e = /* @__PURE__ */ new Map();
|
|
236
|
-
#
|
|
249
|
+
#t = /* @__PURE__ */ new Map();
|
|
237
250
|
#s = /* @__PURE__ */ new Map();
|
|
238
251
|
/**
|
|
239
252
|
* Clones a session to re-use the media product and playback content for a new session.
|
|
@@ -271,7 +284,7 @@ class Ne {
|
|
|
271
284
|
* @see {@link StreamingSessionStore.clone}
|
|
272
285
|
*/
|
|
273
286
|
deleteSession(e) {
|
|
274
|
-
this.deleteMediaProductTransition(e), this.#
|
|
287
|
+
this.deleteMediaProductTransition(e), this.#t.delete(e), this.deleteStreamInfo(e);
|
|
275
288
|
}
|
|
276
289
|
deleteStreamInfo(e) {
|
|
277
290
|
this.#s.delete(e);
|
|
@@ -280,7 +293,7 @@ class Ne {
|
|
|
280
293
|
return e ? this.#e.get(e) : void 0;
|
|
281
294
|
}
|
|
282
295
|
getPlaybackInfo(e) {
|
|
283
|
-
return e ? this.#
|
|
296
|
+
return e ? this.#t.get(e) : void 0;
|
|
284
297
|
}
|
|
285
298
|
getStreamInfo(e) {
|
|
286
299
|
return e ? this.#s.get(e) : void 0;
|
|
@@ -289,14 +302,17 @@ class Ne {
|
|
|
289
302
|
return this.#e.has(e);
|
|
290
303
|
}
|
|
291
304
|
hasPlaybackInfo(e) {
|
|
292
|
-
return this.#
|
|
305
|
+
return this.#t.has(e);
|
|
293
306
|
}
|
|
294
307
|
hasStreamInfo(e) {
|
|
295
308
|
return this.#s.has(e);
|
|
296
309
|
}
|
|
297
310
|
overwriteDuration(e, r) {
|
|
298
311
|
const s = this.#e.get(e);
|
|
299
|
-
s && (s.playbackContext
|
|
312
|
+
s && (s.playbackContext = {
|
|
313
|
+
...s.playbackContext,
|
|
314
|
+
actualDuration: r
|
|
315
|
+
}, this.saveMediaProductTransition(e, s));
|
|
300
316
|
}
|
|
301
317
|
saveMediaProductTransition(e, r) {
|
|
302
318
|
this.#e.set(
|
|
@@ -305,18 +321,18 @@ class Ne {
|
|
|
305
321
|
);
|
|
306
322
|
}
|
|
307
323
|
savePlaybackInfo(e, r) {
|
|
308
|
-
this.#
|
|
324
|
+
this.#t.set(e, r);
|
|
309
325
|
}
|
|
310
326
|
saveStreamInfo(e, r) {
|
|
311
327
|
this.#s.set(e, r);
|
|
312
328
|
}
|
|
313
329
|
}
|
|
314
|
-
const
|
|
315
|
-
class
|
|
330
|
+
const q = new Oe();
|
|
331
|
+
class Ae {
|
|
316
332
|
activePlayer;
|
|
317
333
|
preloadPlayer;
|
|
318
334
|
get preloadedMediaProduct() {
|
|
319
|
-
return
|
|
335
|
+
return q.getMediaProductTransition(
|
|
320
336
|
this.preloadedStreamingSessionId
|
|
321
337
|
)?.mediaProduct ?? void 0;
|
|
322
338
|
}
|
|
@@ -324,171 +340,200 @@ class Fe {
|
|
|
324
340
|
return this.preloadPlayer?.preloadedStreamingSessionId ?? void 0;
|
|
325
341
|
}
|
|
326
342
|
}
|
|
327
|
-
const p = new
|
|
328
|
-
let
|
|
329
|
-
const
|
|
343
|
+
const p = new Ae();
|
|
344
|
+
let Ce;
|
|
345
|
+
const _e = [
|
|
330
346
|
{
|
|
331
347
|
itemTypes: ["track", "video"],
|
|
332
348
|
player: "shaka",
|
|
333
349
|
qualities: ["HIGH", "LOSSLESS", "LOW", "HI_RES_LOSSLESS"]
|
|
334
350
|
}
|
|
335
351
|
];
|
|
336
|
-
let
|
|
352
|
+
let H = _e;
|
|
337
353
|
const w = {
|
|
338
354
|
browser: void 0,
|
|
339
355
|
native: void 0,
|
|
340
356
|
shaka: void 0
|
|
341
357
|
};
|
|
342
|
-
async function
|
|
358
|
+
async function Ne() {
|
|
343
359
|
await Promise.all(
|
|
344
|
-
|
|
360
|
+
H.map((t) => {
|
|
345
361
|
const e = w[t.player];
|
|
346
362
|
return e ? e.reset() : Promise.resolve();
|
|
347
363
|
})
|
|
348
364
|
), p.activePlayer = void 0, p.preloadPlayer = void 0;
|
|
349
365
|
}
|
|
350
|
-
function
|
|
366
|
+
function Fe(t) {
|
|
351
367
|
t.name !== "nativePlayer" && w.native && w.native.abandon(), p.activePlayer = t;
|
|
352
368
|
}
|
|
353
|
-
function
|
|
354
|
-
h.removeEventListener("ended",
|
|
369
|
+
function Be() {
|
|
370
|
+
h.removeEventListener("ended", Ce);
|
|
355
371
|
}
|
|
356
|
-
async function
|
|
357
|
-
const { default: t } = await import("./nativePlayer-
|
|
372
|
+
async function Re() {
|
|
373
|
+
const { default: t } = await import("./nativePlayer-DdpXKE9r-B14o92dS.js");
|
|
358
374
|
return w.native || (w.native = new t()), w.native;
|
|
359
375
|
}
|
|
360
|
-
async function
|
|
361
|
-
const { default: t } = await import("./browserPlayer-
|
|
376
|
+
async function xe() {
|
|
377
|
+
const { default: t } = await import("./browserPlayer-B1V50MdI-D65N_aRN.js");
|
|
362
378
|
return w.browser || (w.browser = new t()), w.browser;
|
|
363
379
|
}
|
|
364
|
-
async function
|
|
365
|
-
const { default: t } = await import("./shakaPlayer-
|
|
380
|
+
async function De() {
|
|
381
|
+
const { default: t } = await import("./shakaPlayer-Brgd4rob-DJ5uJTjr.js");
|
|
366
382
|
return w.shaka || (w.shaka = new t()), w.shaka;
|
|
367
383
|
}
|
|
368
|
-
async function
|
|
369
|
-
const r =
|
|
384
|
+
async function We(t, e) {
|
|
385
|
+
const r = H.filter((n) => n.itemTypes.includes(t)).filter(
|
|
370
386
|
(n) => t === "track" && n.qualities && e ? n.qualities.includes(e) : !0
|
|
371
387
|
);
|
|
372
388
|
r.length === 0 && console.error(
|
|
373
389
|
`No player found to handle audio quality "${String(
|
|
374
390
|
e
|
|
375
391
|
)}" for product type "${t}" in player config: `,
|
|
376
|
-
|
|
392
|
+
H
|
|
377
393
|
);
|
|
378
394
|
const { player: s } = r[0];
|
|
379
395
|
switch (s) {
|
|
380
396
|
case "shaka":
|
|
381
|
-
return
|
|
397
|
+
return De();
|
|
382
398
|
case "browser":
|
|
383
|
-
return
|
|
399
|
+
return xe();
|
|
384
400
|
case "native":
|
|
385
|
-
return
|
|
401
|
+
return Re();
|
|
386
402
|
default:
|
|
387
403
|
throw new Error("No player found.");
|
|
388
404
|
}
|
|
389
405
|
}
|
|
390
|
-
function
|
|
406
|
+
function Ve() {
|
|
391
407
|
return p.activePlayer?.getPosition() ?? 0;
|
|
392
408
|
}
|
|
393
|
-
function
|
|
409
|
+
function ze() {
|
|
394
410
|
return p.activePlayer?.currentMediaProduct ?? null;
|
|
395
411
|
}
|
|
396
|
-
function
|
|
412
|
+
function Ue() {
|
|
397
413
|
const t = p.activePlayer;
|
|
398
414
|
if (t) {
|
|
399
|
-
const e =
|
|
415
|
+
const e = q.getMediaProductTransition(
|
|
400
416
|
t.currentStreamingSessionId
|
|
401
417
|
);
|
|
402
418
|
if (e)
|
|
403
419
|
return e.playbackContext;
|
|
404
420
|
}
|
|
405
421
|
}
|
|
406
|
-
function
|
|
422
|
+
function te() {
|
|
407
423
|
return p.activePlayer?.playbackState ?? "IDLE";
|
|
408
424
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
}
|
|
414
|
-
function je(t, e) {
|
|
415
|
-
const r = indexedDB.open(t);
|
|
416
|
-
r.onupgradeneeded = () => r.result.createObjectStore(e);
|
|
417
|
-
const s = $(r);
|
|
418
|
-
return (n, o) => s.then((a) => o(a.transaction(e, n).objectStore(e)));
|
|
419
|
-
}
|
|
420
|
-
let V;
|
|
421
|
-
function ie() {
|
|
422
|
-
return V || (V = je("keyval-store", "keyval")), V;
|
|
423
|
-
}
|
|
424
|
-
function ne(t, e = ie()) {
|
|
425
|
-
return e("readonly", (r) => $(r.get(t)));
|
|
426
|
-
}
|
|
427
|
-
function ae(t, e, r = ie()) {
|
|
428
|
-
return r("readwrite", (s) => (s.put(e, t), $(s.transaction)));
|
|
429
|
-
}
|
|
430
|
-
async function L(t, e) {
|
|
431
|
-
let r = /* @__PURE__ */ new Map(), s;
|
|
432
|
-
if (!k("gatherEvents"))
|
|
433
|
-
return (n) => Promise.resolve(void 0);
|
|
434
|
-
try {
|
|
435
|
-
s = await ne(t), s && (r = new Map(s));
|
|
436
|
-
} catch (n) {
|
|
437
|
-
console.error(n);
|
|
425
|
+
class He {
|
|
426
|
+
#e;
|
|
427
|
+
constructor() {
|
|
428
|
+
this.#e = /* @__PURE__ */ new Map();
|
|
438
429
|
}
|
|
439
|
-
|
|
440
|
-
const
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
430
|
+
async #t(e, r) {
|
|
431
|
+
const s = new TextEncoder().encode(
|
|
432
|
+
`${e}-${r}`
|
|
433
|
+
), n = await crypto.subtle.digest("SHA-1", s);
|
|
434
|
+
return Array.from(new Uint8Array(n)).map((o) => o.toString(16).padStart(2, "0")).join("");
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Delete a logged event by name and streamingSessionId.
|
|
438
|
+
*/
|
|
439
|
+
async delete({
|
|
440
|
+
name: e,
|
|
441
|
+
streamingSessionId: r
|
|
442
|
+
}) {
|
|
443
|
+
const s = await this.#t(
|
|
444
|
+
r,
|
|
445
|
+
e
|
|
446
|
+
);
|
|
447
|
+
this.#e.delete(s);
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Get a logged event by name and streamingSessionId.
|
|
451
|
+
*/
|
|
452
|
+
async get({
|
|
453
|
+
name: e,
|
|
454
|
+
streamingSessionId: r
|
|
455
|
+
}) {
|
|
456
|
+
const s = await this.#t(
|
|
457
|
+
r,
|
|
458
|
+
e
|
|
459
|
+
);
|
|
460
|
+
return this.#e.get(s);
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Adds or updates an event.
|
|
464
|
+
*/
|
|
465
|
+
async put(e) {
|
|
466
|
+
const r = await this.#t(
|
|
467
|
+
e.streamingSessionId,
|
|
468
|
+
e.name
|
|
469
|
+
);
|
|
470
|
+
this.#e.set(r, e);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
const $ = new He();
|
|
474
|
+
async function O(t, e) {
|
|
475
|
+
return M("gatherEvents") ? async (r) => {
|
|
452
476
|
try {
|
|
453
|
-
await
|
|
454
|
-
|
|
455
|
-
|
|
477
|
+
const s = await $.get({
|
|
478
|
+
name: t,
|
|
479
|
+
streamingSessionId: r.streamingSessionId
|
|
480
|
+
}), n = Object.assign(
|
|
481
|
+
{},
|
|
482
|
+
e,
|
|
483
|
+
s ? s.payload : {},
|
|
484
|
+
r
|
|
485
|
+
);
|
|
486
|
+
for (const o of Object.keys(r)) {
|
|
487
|
+
const a = o;
|
|
488
|
+
Array.isArray(r[a]) && (n[a] = [
|
|
489
|
+
...e[a] || [],
|
|
490
|
+
...s && s.payload[a] || [],
|
|
491
|
+
...r[a] || []
|
|
492
|
+
]);
|
|
493
|
+
}
|
|
494
|
+
return await $.put({
|
|
495
|
+
name: t,
|
|
496
|
+
payload: n,
|
|
497
|
+
streamingSessionId: r.streamingSessionId
|
|
498
|
+
}), {
|
|
499
|
+
name: t,
|
|
500
|
+
payload: n,
|
|
501
|
+
streamingSessionId: r.streamingSessionId
|
|
502
|
+
};
|
|
503
|
+
} catch (s) {
|
|
504
|
+
console.error(s);
|
|
456
505
|
}
|
|
457
|
-
|
|
458
|
-
name: t,
|
|
459
|
-
payload: a
|
|
460
|
-
};
|
|
461
|
-
};
|
|
506
|
+
} : (r) => Promise.resolve(void 0);
|
|
462
507
|
}
|
|
463
|
-
const
|
|
508
|
+
const $e = {
|
|
464
509
|
endReason: "COMPLETE",
|
|
465
510
|
endTimestamp: 0,
|
|
466
511
|
errorCode: null,
|
|
467
512
|
errorMessage: null,
|
|
468
513
|
startTimestamp: 0,
|
|
469
514
|
streamingSessionId: ""
|
|
470
|
-
},
|
|
515
|
+
}, qe = await O(
|
|
471
516
|
"drm_license_fetch",
|
|
472
|
-
|
|
517
|
+
$e
|
|
473
518
|
);
|
|
474
|
-
function
|
|
475
|
-
return
|
|
519
|
+
function Gt(t) {
|
|
520
|
+
return qe(t);
|
|
476
521
|
}
|
|
477
|
-
const
|
|
522
|
+
const je = {
|
|
478
523
|
endReason: "COMPLETE",
|
|
479
524
|
endTimestamp: 0,
|
|
480
525
|
errorCode: null,
|
|
481
526
|
errorMessage: null,
|
|
482
527
|
startTimestamp: 0,
|
|
483
528
|
streamingSessionId: ""
|
|
484
|
-
},
|
|
529
|
+
}, Ge = await O(
|
|
485
530
|
"playback_info_fetch",
|
|
486
|
-
|
|
531
|
+
je
|
|
487
532
|
);
|
|
488
|
-
function
|
|
489
|
-
return
|
|
533
|
+
function U(t) {
|
|
534
|
+
return Ge(t);
|
|
490
535
|
}
|
|
491
|
-
function
|
|
536
|
+
function Qt(t) {
|
|
492
537
|
switch (t) {
|
|
493
538
|
case "bluetooth":
|
|
494
539
|
return "BLUETOOTH";
|
|
@@ -510,7 +555,7 @@ function Jt(t) {
|
|
|
510
555
|
return;
|
|
511
556
|
}
|
|
512
557
|
}
|
|
513
|
-
const
|
|
558
|
+
const Qe = {
|
|
514
559
|
actualAssetPresentation: "FULL",
|
|
515
560
|
actualAudioMode: "STEREO",
|
|
516
561
|
actualProductId: null,
|
|
@@ -530,24 +575,24 @@ const Xe = {
|
|
|
530
575
|
productType: "TRACK",
|
|
531
576
|
stalls: [],
|
|
532
577
|
streamingSessionId: ""
|
|
533
|
-
},
|
|
578
|
+
}, Ke = await O(
|
|
534
579
|
"playback_statistics",
|
|
535
|
-
|
|
580
|
+
Qe
|
|
536
581
|
);
|
|
537
582
|
function J(t) {
|
|
538
|
-
return
|
|
583
|
+
return Ke(t);
|
|
539
584
|
}
|
|
540
|
-
const
|
|
585
|
+
const Je = {
|
|
541
586
|
streamingSessionId: "",
|
|
542
587
|
timestamp: 0
|
|
543
|
-
},
|
|
588
|
+
}, Ye = await O(
|
|
544
589
|
"streaming_session_end",
|
|
545
|
-
|
|
590
|
+
Je
|
|
546
591
|
);
|
|
547
|
-
function
|
|
548
|
-
return
|
|
592
|
+
function Xe(t) {
|
|
593
|
+
return Ye(t);
|
|
549
594
|
}
|
|
550
|
-
const
|
|
595
|
+
const Ze = {
|
|
551
596
|
"Amazon Silk": "amazon_silk",
|
|
552
597
|
"Android Browser": "android",
|
|
553
598
|
Bada: "bada",
|
|
@@ -587,7 +632,7 @@ const st = {
|
|
|
587
632
|
WeChat: "wechat",
|
|
588
633
|
"Yandex Browser": "yandex",
|
|
589
634
|
Roku: "roku"
|
|
590
|
-
},
|
|
635
|
+
}, re = {
|
|
591
636
|
amazon_silk: "Amazon Silk",
|
|
592
637
|
android: "Android Browser",
|
|
593
638
|
bada: "Bada",
|
|
@@ -645,7 +690,7 @@ const st = {
|
|
|
645
690
|
ChromeOS: "Chrome OS",
|
|
646
691
|
PlayStation4: "PlayStation 4",
|
|
647
692
|
Roku: "Roku"
|
|
648
|
-
},
|
|
693
|
+
}, k = {
|
|
649
694
|
EdgeHTML: "EdgeHTML",
|
|
650
695
|
Blink: "Blink",
|
|
651
696
|
Trident: "Trident",
|
|
@@ -850,18 +895,18 @@ class i {
|
|
|
850
895
|
static compareVersions(e, r, s = !1) {
|
|
851
896
|
const n = i.getVersionPrecision(e), o = i.getVersionPrecision(r);
|
|
852
897
|
let a = Math.max(n, o), c = 0;
|
|
853
|
-
const
|
|
854
|
-
const
|
|
855
|
-
return i.map(
|
|
898
|
+
const l = i.map([e, r], (d) => {
|
|
899
|
+
const b = a - i.getVersionPrecision(d), E = d + new Array(b + 1).join(".0");
|
|
900
|
+
return i.map(E.split("."), (f) => new Array(20 - f.length).join("0") + f).reverse();
|
|
856
901
|
});
|
|
857
902
|
for (s && (c = a - Math.min(n, o)), a -= 1; a >= c; ) {
|
|
858
|
-
if (
|
|
903
|
+
if (l[0][a] > l[1][a])
|
|
859
904
|
return 1;
|
|
860
|
-
if (
|
|
905
|
+
if (l[0][a] === l[1][a]) {
|
|
861
906
|
if (a === c)
|
|
862
907
|
return 0;
|
|
863
908
|
a -= 1;
|
|
864
|
-
} else if (
|
|
909
|
+
} else if (l[0][a] < l[1][a])
|
|
865
910
|
return -1;
|
|
866
911
|
}
|
|
867
912
|
}
|
|
@@ -928,7 +973,7 @@ class i {
|
|
|
928
973
|
* @return {string}
|
|
929
974
|
*/
|
|
930
975
|
static getBrowserAlias(e) {
|
|
931
|
-
return
|
|
976
|
+
return Ze[e];
|
|
932
977
|
}
|
|
933
978
|
/**
|
|
934
979
|
* Get short version/alias for a browser name
|
|
@@ -940,10 +985,10 @@ class i {
|
|
|
940
985
|
* @return {string}
|
|
941
986
|
*/
|
|
942
987
|
static getBrowserTypeByAlias(e) {
|
|
943
|
-
return
|
|
988
|
+
return re[e] || "";
|
|
944
989
|
}
|
|
945
990
|
}
|
|
946
|
-
const u = /version\/(\d+(\.?_?\d+)+)/i,
|
|
991
|
+
const u = /version\/(\d+(\.?_?\d+)+)/i, et = [
|
|
947
992
|
/* Googlebot */
|
|
948
993
|
{
|
|
949
994
|
test: [/googlebot/i],
|
|
@@ -1342,7 +1387,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1342
1387
|
};
|
|
1343
1388
|
}
|
|
1344
1389
|
}
|
|
1345
|
-
],
|
|
1390
|
+
], tt = [
|
|
1346
1391
|
/* Roku */
|
|
1347
1392
|
{
|
|
1348
1393
|
test: [/Roku\/DVP/],
|
|
@@ -1495,7 +1540,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1495
1540
|
};
|
|
1496
1541
|
}
|
|
1497
1542
|
}
|
|
1498
|
-
],
|
|
1543
|
+
], rt = [
|
|
1499
1544
|
/* Googlebot */
|
|
1500
1545
|
{
|
|
1501
1546
|
test: [/googlebot/i],
|
|
@@ -1727,7 +1772,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1727
1772
|
};
|
|
1728
1773
|
}
|
|
1729
1774
|
}
|
|
1730
|
-
],
|
|
1775
|
+
], st = [
|
|
1731
1776
|
/* EdgeHTML */
|
|
1732
1777
|
{
|
|
1733
1778
|
test(t) {
|
|
@@ -1736,11 +1781,11 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1736
1781
|
describe(t) {
|
|
1737
1782
|
if (/\sedg\//i.test(t))
|
|
1738
1783
|
return {
|
|
1739
|
-
name:
|
|
1784
|
+
name: k.Blink
|
|
1740
1785
|
};
|
|
1741
1786
|
const e = i.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, t);
|
|
1742
1787
|
return {
|
|
1743
|
-
name:
|
|
1788
|
+
name: k.EdgeHTML,
|
|
1744
1789
|
version: e
|
|
1745
1790
|
};
|
|
1746
1791
|
}
|
|
@@ -1750,7 +1795,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1750
1795
|
test: [/trident/i],
|
|
1751
1796
|
describe(t) {
|
|
1752
1797
|
const e = {
|
|
1753
|
-
name:
|
|
1798
|
+
name: k.Trident
|
|
1754
1799
|
}, r = i.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, t);
|
|
1755
1800
|
return r && (e.version = r), e;
|
|
1756
1801
|
}
|
|
@@ -1762,7 +1807,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1762
1807
|
},
|
|
1763
1808
|
describe(t) {
|
|
1764
1809
|
const e = {
|
|
1765
|
-
name:
|
|
1810
|
+
name: k.Presto
|
|
1766
1811
|
}, r = i.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, t);
|
|
1767
1812
|
return r && (e.version = r), e;
|
|
1768
1813
|
}
|
|
@@ -1775,7 +1820,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1775
1820
|
},
|
|
1776
1821
|
describe(t) {
|
|
1777
1822
|
const e = {
|
|
1778
|
-
name:
|
|
1823
|
+
name: k.Gecko
|
|
1779
1824
|
}, r = i.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, t);
|
|
1780
1825
|
return r && (e.version = r), e;
|
|
1781
1826
|
}
|
|
@@ -1785,7 +1830,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1785
1830
|
test: [/(apple)?webkit\/537\.36/i],
|
|
1786
1831
|
describe() {
|
|
1787
1832
|
return {
|
|
1788
|
-
name:
|
|
1833
|
+
name: k.Blink
|
|
1789
1834
|
};
|
|
1790
1835
|
}
|
|
1791
1836
|
},
|
|
@@ -1794,13 +1839,13 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1794
1839
|
test: [/(apple)?webkit/i],
|
|
1795
1840
|
describe(t) {
|
|
1796
1841
|
const e = {
|
|
1797
|
-
name:
|
|
1842
|
+
name: k.WebKit
|
|
1798
1843
|
}, r = i.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, t);
|
|
1799
1844
|
return r && (e.version = r), e;
|
|
1800
1845
|
}
|
|
1801
1846
|
}
|
|
1802
1847
|
];
|
|
1803
|
-
class
|
|
1848
|
+
class Y {
|
|
1804
1849
|
/**
|
|
1805
1850
|
* Create instance of Parser
|
|
1806
1851
|
*
|
|
@@ -1841,7 +1886,7 @@ class X {
|
|
|
1841
1886
|
*/
|
|
1842
1887
|
parseBrowser() {
|
|
1843
1888
|
this.parsedResult.browser = {};
|
|
1844
|
-
const e = i.find(
|
|
1889
|
+
const e = i.find(et, (r) => {
|
|
1845
1890
|
if (typeof r.test == "function")
|
|
1846
1891
|
return r.test(this);
|
|
1847
1892
|
if (r.test instanceof Array)
|
|
@@ -1897,7 +1942,7 @@ class X {
|
|
|
1897
1942
|
*/
|
|
1898
1943
|
parseOS() {
|
|
1899
1944
|
this.parsedResult.os = {};
|
|
1900
|
-
const e = i.find(
|
|
1945
|
+
const e = i.find(tt, (r) => {
|
|
1901
1946
|
if (typeof r.test == "function")
|
|
1902
1947
|
return r.test(this);
|
|
1903
1948
|
if (r.test instanceof Array)
|
|
@@ -1944,7 +1989,7 @@ class X {
|
|
|
1944
1989
|
*/
|
|
1945
1990
|
parsePlatform() {
|
|
1946
1991
|
this.parsedResult.platform = {};
|
|
1947
|
-
const e = i.find(
|
|
1992
|
+
const e = i.find(rt, (r) => {
|
|
1948
1993
|
if (typeof r.test == "function")
|
|
1949
1994
|
return r.test(this);
|
|
1950
1995
|
if (r.test instanceof Array)
|
|
@@ -1975,7 +2020,7 @@ class X {
|
|
|
1975
2020
|
*/
|
|
1976
2021
|
parseEngine() {
|
|
1977
2022
|
this.parsedResult.engine = {};
|
|
1978
|
-
const e = i.find(
|
|
2023
|
+
const e = i.find(st, (r) => {
|
|
1979
2024
|
if (typeof r.test == "function")
|
|
1980
2025
|
return r.test(this);
|
|
1981
2026
|
if (r.test instanceof Array)
|
|
@@ -2025,24 +2070,24 @@ class X {
|
|
|
2025
2070
|
const c = e[a];
|
|
2026
2071
|
typeof c == "string" ? (n[a] = c, o += 1) : typeof c == "object" && (r[a] = c, s += 1);
|
|
2027
2072
|
}), s > 0) {
|
|
2028
|
-
const a = Object.keys(r), c = i.find(a, (
|
|
2073
|
+
const a = Object.keys(r), c = i.find(a, (d) => this.isOS(d));
|
|
2029
2074
|
if (c) {
|
|
2030
|
-
const
|
|
2031
|
-
if (
|
|
2032
|
-
return
|
|
2075
|
+
const d = this.satisfies(r[c]);
|
|
2076
|
+
if (d !== void 0)
|
|
2077
|
+
return d;
|
|
2033
2078
|
}
|
|
2034
|
-
const
|
|
2079
|
+
const l = i.find(
|
|
2035
2080
|
a,
|
|
2036
|
-
(
|
|
2081
|
+
(d) => this.isPlatform(d)
|
|
2037
2082
|
);
|
|
2038
|
-
if (
|
|
2039
|
-
const
|
|
2040
|
-
if (
|
|
2041
|
-
return
|
|
2083
|
+
if (l) {
|
|
2084
|
+
const d = this.satisfies(r[l]);
|
|
2085
|
+
if (d !== void 0)
|
|
2086
|
+
return d;
|
|
2042
2087
|
}
|
|
2043
2088
|
}
|
|
2044
2089
|
if (o > 0) {
|
|
2045
|
-
const a = Object.keys(n), c = i.find(a, (
|
|
2090
|
+
const a = Object.keys(n), c = i.find(a, (l) => this.isBrowser(l, !0));
|
|
2046
2091
|
if (c !== void 0)
|
|
2047
2092
|
return this.compareVersion(n[c]);
|
|
2048
2093
|
}
|
|
@@ -2101,7 +2146,7 @@ class X {
|
|
|
2101
2146
|
* MIT License | (c) Dustin Diaz 2012-2015
|
|
2102
2147
|
* MIT License | (c) Denis Demchenko 2015-2019
|
|
2103
2148
|
*/
|
|
2104
|
-
class
|
|
2149
|
+
class it {
|
|
2105
2150
|
/**
|
|
2106
2151
|
* Creates a {@link Parser} instance
|
|
2107
2152
|
*
|
|
@@ -2118,7 +2163,7 @@ class ct {
|
|
|
2118
2163
|
static getParser(e, r = !1) {
|
|
2119
2164
|
if (typeof e != "string")
|
|
2120
2165
|
throw new Error("UserAgent should be a string");
|
|
2121
|
-
return new
|
|
2166
|
+
return new Y(e, r);
|
|
2122
2167
|
}
|
|
2123
2168
|
/**
|
|
2124
2169
|
* Creates a {@link Parser} instance and runs {@link Parser.getResult} immediately
|
|
@@ -2130,13 +2175,13 @@ class ct {
|
|
|
2130
2175
|
* const result = Bowser.parse(window.navigator.userAgent);
|
|
2131
2176
|
*/
|
|
2132
2177
|
static parse(e) {
|
|
2133
|
-
return new
|
|
2178
|
+
return new Y(e).getResult();
|
|
2134
2179
|
}
|
|
2135
2180
|
static get BROWSER_MAP() {
|
|
2136
|
-
return
|
|
2181
|
+
return re;
|
|
2137
2182
|
}
|
|
2138
2183
|
static get ENGINE_MAP() {
|
|
2139
|
-
return
|
|
2184
|
+
return k;
|
|
2140
2185
|
}
|
|
2141
2186
|
static get OS_MAP() {
|
|
2142
2187
|
return g;
|
|
@@ -2145,17 +2190,17 @@ class ct {
|
|
|
2145
2190
|
return m;
|
|
2146
2191
|
}
|
|
2147
2192
|
}
|
|
2148
|
-
const
|
|
2193
|
+
const C = it.parse(navigator.userAgent), nt = {
|
|
2149
2194
|
abTestGroup: null,
|
|
2150
2195
|
abTestName: null,
|
|
2151
|
-
browser:
|
|
2152
|
-
browserVersion:
|
|
2153
|
-
hardwarePlatform:
|
|
2196
|
+
browser: C.browser.name ?? null,
|
|
2197
|
+
browserVersion: C.browser.version ?? null,
|
|
2198
|
+
hardwarePlatform: C.browser.name === "Electron" ? "DESKTOP" : "WEB",
|
|
2154
2199
|
isOfflineModeStart: !1,
|
|
2155
2200
|
mobileNetworkType: null,
|
|
2156
2201
|
networkType: "WIFI",
|
|
2157
|
-
operatingSystem:
|
|
2158
|
-
operatingSystemVersion:
|
|
2202
|
+
operatingSystem: C.os.name ?? null,
|
|
2203
|
+
operatingSystemVersion: C.os.version ?? null,
|
|
2159
2204
|
screenHeight: window.screen.height,
|
|
2160
2205
|
screenWidth: window.screen.width,
|
|
2161
2206
|
sessionProductId: "",
|
|
@@ -2165,36 +2210,38 @@ const O = ct.parse(navigator.userAgent), dt = {
|
|
|
2165
2210
|
startReason: "IMPLICIT",
|
|
2166
2211
|
streamingSessionId: "",
|
|
2167
2212
|
timestamp: 0
|
|
2168
|
-
},
|
|
2213
|
+
}, at = await O(
|
|
2169
2214
|
"streaming_session_start",
|
|
2170
|
-
|
|
2215
|
+
nt
|
|
2171
2216
|
);
|
|
2172
|
-
function
|
|
2173
|
-
return
|
|
2217
|
+
function ot(t) {
|
|
2218
|
+
return at(t);
|
|
2174
2219
|
}
|
|
2175
|
-
function
|
|
2220
|
+
function se(t) {
|
|
2176
2221
|
const e = `(${t.toString()})();`, r = new Blob([e], { type: "text/javascript" });
|
|
2177
2222
|
return URL.createObjectURL(r);
|
|
2178
2223
|
}
|
|
2179
|
-
let
|
|
2180
|
-
async function
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2224
|
+
let F;
|
|
2225
|
+
async function ct(t) {
|
|
2226
|
+
$.delete({
|
|
2227
|
+
name: t.data.eventName,
|
|
2228
|
+
streamingSessionId: t.data.streamingSessionId
|
|
2229
|
+
});
|
|
2230
|
+
}
|
|
2231
|
+
async function dt() {
|
|
2232
|
+
if (!F) {
|
|
2233
|
+
const { beacon: t } = await import("./worker-DrRlSx4a-BTanKBsS.js");
|
|
2234
|
+
F = new Worker(se(t)), F.addEventListener("message", (e) => {
|
|
2235
|
+
ct(e);
|
|
2189
2236
|
});
|
|
2190
2237
|
}
|
|
2191
2238
|
}
|
|
2192
|
-
function
|
|
2239
|
+
function lt(t) {
|
|
2193
2240
|
return t != null;
|
|
2194
2241
|
}
|
|
2195
|
-
async function
|
|
2242
|
+
async function ie(t, e) {
|
|
2196
2243
|
if (t) {
|
|
2197
|
-
const r = (await Promise.all(e.events)).filter(
|
|
2244
|
+
const r = (await Promise.all(e.events)).filter(lt);
|
|
2198
2245
|
e.events = r;
|
|
2199
2246
|
const { clientId: s, token: n } = await v.credentialsProvider.getCredentials();
|
|
2200
2247
|
if (!n)
|
|
@@ -2202,49 +2249,49 @@ async function de(t, e) {
|
|
|
2202
2249
|
const o = {
|
|
2203
2250
|
...e,
|
|
2204
2251
|
accessToken: n,
|
|
2205
|
-
apiUrl:
|
|
2206
|
-
appVersion:
|
|
2252
|
+
apiUrl: M("apiUrl"),
|
|
2253
|
+
appVersion: M("appVersion"),
|
|
2207
2254
|
clientId: s,
|
|
2208
|
-
clientPlatform:
|
|
2209
|
-
eventUrl:
|
|
2210
|
-
ts:
|
|
2255
|
+
clientPlatform: M("clientPlatform"),
|
|
2256
|
+
eventUrl: M("eventUrl"),
|
|
2257
|
+
ts: y.now()
|
|
2211
2258
|
};
|
|
2212
2259
|
return t.postMessage(JSON.stringify(o)), o;
|
|
2213
2260
|
} else
|
|
2214
2261
|
console.warn("Event beacon is not running.");
|
|
2215
2262
|
}
|
|
2216
|
-
const
|
|
2263
|
+
const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2217
2264
|
__proto__: null,
|
|
2218
|
-
commit:
|
|
2219
|
-
start:
|
|
2265
|
+
commit: ie,
|
|
2266
|
+
start: dt,
|
|
2220
2267
|
get worker() {
|
|
2221
|
-
return
|
|
2268
|
+
return F;
|
|
2222
2269
|
},
|
|
2223
|
-
workerize:
|
|
2270
|
+
workerize: se
|
|
2224
2271
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2225
|
-
async function
|
|
2226
|
-
if (await
|
|
2272
|
+
async function ht(t) {
|
|
2273
|
+
if (await B())
|
|
2227
2274
|
return t();
|
|
2228
2275
|
}
|
|
2229
|
-
function
|
|
2230
|
-
return
|
|
2231
|
-
() =>
|
|
2276
|
+
function ne(t) {
|
|
2277
|
+
return ht(
|
|
2278
|
+
() => ie(F, {
|
|
2232
2279
|
type: "streaming_metrics",
|
|
2233
2280
|
...t
|
|
2234
2281
|
})
|
|
2235
2282
|
);
|
|
2236
2283
|
}
|
|
2237
|
-
function
|
|
2284
|
+
function mt(t = !0) {
|
|
2238
2285
|
const e = t && "crypto" in window && "getRandomValues" in crypto;
|
|
2239
|
-
return (
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
);
|
|
2286
|
+
return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, (r) => {
|
|
2287
|
+
const s = e ? crypto.getRandomValues(new Uint8Array(1))[0] : Math.floor(256 * Math.random());
|
|
2288
|
+
return (r ^ (s ?? 0) & 15 >> r / 4).toString(16);
|
|
2289
|
+
});
|
|
2243
2290
|
}
|
|
2244
|
-
function
|
|
2291
|
+
function pt(t) {
|
|
2245
2292
|
return JSON.parse(atob(t));
|
|
2246
2293
|
}
|
|
2247
|
-
function
|
|
2294
|
+
function ft(t, e) {
|
|
2248
2295
|
if ("codecs" in t)
|
|
2249
2296
|
switch (t.codecs) {
|
|
2250
2297
|
case "aac":
|
|
@@ -2275,7 +2322,7 @@ function bt(t, e) {
|
|
|
2275
2322
|
}
|
|
2276
2323
|
return "none";
|
|
2277
2324
|
}
|
|
2278
|
-
function
|
|
2325
|
+
function gt(t) {
|
|
2279
2326
|
switch (t) {
|
|
2280
2327
|
case "mp3":
|
|
2281
2328
|
return "mp3";
|
|
@@ -2291,17 +2338,17 @@ function vt(t) {
|
|
|
2291
2338
|
return;
|
|
2292
2339
|
}
|
|
2293
2340
|
}
|
|
2294
|
-
function
|
|
2341
|
+
function yt(t) {
|
|
2295
2342
|
const e = /codecs=(["'])?((?:.(?!\1|>))*.?)\1?/.exec(t);
|
|
2296
2343
|
if (e === null)
|
|
2297
2344
|
return;
|
|
2298
|
-
const r = e[2];
|
|
2345
|
+
const r = e[2] ?? "";
|
|
2299
2346
|
if (r.includes("mp4a") || r.includes("aac"))
|
|
2300
2347
|
return "aac";
|
|
2301
2348
|
if (r === "mqa" || r === "flac")
|
|
2302
2349
|
return r;
|
|
2303
2350
|
}
|
|
2304
|
-
function
|
|
2351
|
+
function wt(t) {
|
|
2305
2352
|
const { prefetched: e, streamingSessionId: r } = t, s = "albumReplayGain" in t ? {
|
|
2306
2353
|
albumPeakAmplitude: t.albumPeakAmplitude,
|
|
2307
2354
|
albumReplayGain: t.albumReplayGain,
|
|
@@ -2314,20 +2361,20 @@ function kt(t) {
|
|
|
2314
2361
|
type: "trackId" in t ? "track" : "video"
|
|
2315
2362
|
};
|
|
2316
2363
|
if (t.manifestMimeType === "application/vnd.tidal.bts" || t.manifestMimeType === "application/vnd.tidal.emu") {
|
|
2317
|
-
const a =
|
|
2364
|
+
const a = pt(t.manifest), c = a.urls[0], l = ft(
|
|
2318
2365
|
a,
|
|
2319
2366
|
"audioQuality" in t ? t.audioQuality : null
|
|
2320
2367
|
);
|
|
2321
|
-
let
|
|
2322
|
-
return "keyId" in a && (
|
|
2368
|
+
let d;
|
|
2369
|
+
return "keyId" in a && (d = a.keyId), "licenseSecurityToken" in t && (d = t.licenseSecurityToken), {
|
|
2323
2370
|
...s,
|
|
2324
2371
|
bitDepth: "bitDepth" in t ? t.bitDepth ?? void 0 : void 0,
|
|
2325
|
-
codec:
|
|
2372
|
+
codec: gt(l),
|
|
2326
2373
|
prefetched: e,
|
|
2327
2374
|
quality: n,
|
|
2328
2375
|
sampleRate: "sampleRate" in t ? t.sampleRate ?? void 0 : void 0,
|
|
2329
|
-
securityToken:
|
|
2330
|
-
streamFormat:
|
|
2376
|
+
securityToken: d,
|
|
2377
|
+
streamFormat: l,
|
|
2331
2378
|
streamUrl: c,
|
|
2332
2379
|
streamingSessionId: r,
|
|
2333
2380
|
...o,
|
|
@@ -2339,7 +2386,7 @@ function kt(t) {
|
|
|
2339
2386
|
return {
|
|
2340
2387
|
...s,
|
|
2341
2388
|
bitDepth: "bitDepth" in t ? t.bitDepth ?? void 0 : void 0,
|
|
2342
|
-
codec:
|
|
2389
|
+
codec: yt(c),
|
|
2343
2390
|
prefetched: e,
|
|
2344
2391
|
quality: n,
|
|
2345
2392
|
sampleRate: "sampleRate" in t ? t.sampleRate ?? void 0 : void 0,
|
|
@@ -2354,7 +2401,7 @@ function kt(t) {
|
|
|
2354
2401
|
`${t.manifestMimeType} not supported as playback info manifest mime type.`
|
|
2355
2402
|
);
|
|
2356
2403
|
}
|
|
2357
|
-
const
|
|
2404
|
+
const ae = async (t, e = {}, r = 3) => {
|
|
2358
2405
|
let s, n;
|
|
2359
2406
|
try {
|
|
2360
2407
|
s = await fetch(t, e);
|
|
@@ -2372,13 +2419,13 @@ const ue = async (t, e = {}, r = 3) => {
|
|
|
2372
2419
|
`Retrying request for ${Math.abs(
|
|
2373
2420
|
4 - r
|
|
2374
2421
|
)}th time in ${c}ms`
|
|
2375
|
-
), await
|
|
2422
|
+
), await Ee(c), ae(t, e, r - 1);
|
|
2376
2423
|
}
|
|
2377
2424
|
if (!s)
|
|
2378
2425
|
throw new Error("Retries exchaused. Cannot fetch playbackinfo.");
|
|
2379
2426
|
return s;
|
|
2380
2427
|
};
|
|
2381
|
-
function
|
|
2428
|
+
function bt(t, e) {
|
|
2382
2429
|
switch (e) {
|
|
2383
2430
|
case 4032:
|
|
2384
2431
|
case 4035:
|
|
@@ -2390,7 +2437,7 @@ function Mt(t, e) {
|
|
|
2390
2437
|
}
|
|
2391
2438
|
return t >= 500 && t < 600 || t === 429 ? "PERetryable" : t >= 400 && t < 500 ? "PENotAllowed" : "EUnexpected";
|
|
2392
2439
|
}
|
|
2393
|
-
async function
|
|
2440
|
+
async function vt(t) {
|
|
2394
2441
|
const {
|
|
2395
2442
|
accessToken: e,
|
|
2396
2443
|
audioQuality: r,
|
|
@@ -2398,18 +2445,18 @@ async function Et(t) {
|
|
|
2398
2445
|
mediaProduct: n,
|
|
2399
2446
|
prefetch: o,
|
|
2400
2447
|
streamingSessionId: a
|
|
2401
|
-
} = t, c =
|
|
2448
|
+
} = t, c = M("apiUrl"), l = new URL(
|
|
2402
2449
|
`${c}/${n.productType}s/${n.productId}/playbackinfo`
|
|
2403
|
-
),
|
|
2404
|
-
n.productType === "video" ?
|
|
2405
|
-
const
|
|
2406
|
-
o &&
|
|
2407
|
-
let
|
|
2450
|
+
), d = l.searchParams;
|
|
2451
|
+
n.productType === "video" ? d.set("videoquality", "HIGH") : d.set("audioquality", r), d.set("playbackmode", "STREAM"), d.set("assetpresentation", "FULL");
|
|
2452
|
+
const b = new Headers();
|
|
2453
|
+
o && b.set("x-tidal-prefetch", "true"), s && b.set("x-tidal-token", s), e && b.set("authorization", "Bearer " + e), a && b.set("x-tidal-streamingsessionid", a);
|
|
2454
|
+
let E;
|
|
2408
2455
|
try {
|
|
2409
|
-
|
|
2410
|
-
|
|
2456
|
+
E = await ae(
|
|
2457
|
+
l.toString(),
|
|
2411
2458
|
{
|
|
2412
|
-
headers:
|
|
2459
|
+
headers: b,
|
|
2413
2460
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2414
2461
|
// @ts-ignore - It is a thing.
|
|
2415
2462
|
importance: "high"
|
|
@@ -2417,31 +2464,32 @@ async function Et(t) {
|
|
|
2417
2464
|
3
|
|
2418
2465
|
);
|
|
2419
2466
|
} catch {
|
|
2420
|
-
throw new
|
|
2467
|
+
throw new V("PENetwork", "NPBI0");
|
|
2421
2468
|
}
|
|
2422
|
-
const f = await
|
|
2469
|
+
const f = await E.json();
|
|
2423
2470
|
if ("status" in f) {
|
|
2424
|
-
const
|
|
2425
|
-
throw new
|
|
2471
|
+
const ye = `A${f.subStatus}`;
|
|
2472
|
+
throw new V(bt(f.status, f.subStatus), ye);
|
|
2426
2473
|
}
|
|
2427
|
-
const
|
|
2428
|
-
if (!
|
|
2429
|
-
throw new
|
|
2474
|
+
const fe = "trackId" in f, ge = "videoId" in f;
|
|
2475
|
+
if (!fe && !ge)
|
|
2476
|
+
throw new V("EUnexpected", "B9999");
|
|
2430
2477
|
return {
|
|
2431
2478
|
...f,
|
|
2432
2479
|
prefetched: o
|
|
2433
2480
|
};
|
|
2434
2481
|
}
|
|
2435
|
-
async function
|
|
2482
|
+
async function St(t) {
|
|
2436
2483
|
const { streamingSessionId: e } = t, r = [];
|
|
2437
2484
|
performance.mark("streaming_metrics:playback_info_fetch:startTimestamp", {
|
|
2438
|
-
detail: e
|
|
2485
|
+
detail: e,
|
|
2486
|
+
startTime: y.now()
|
|
2439
2487
|
});
|
|
2440
2488
|
try {
|
|
2441
|
-
const s = await
|
|
2489
|
+
const s = await vt(t);
|
|
2442
2490
|
if (s === void 0)
|
|
2443
2491
|
throw new Error("Playback info was fetched, but undefined.");
|
|
2444
|
-
|
|
2492
|
+
U({
|
|
2445
2493
|
endReason: "COMPLETE",
|
|
2446
2494
|
streamingSessionId: e
|
|
2447
2495
|
}).catch(console.error), s.expires = Date.now() + 36e5;
|
|
@@ -2465,36 +2513,38 @@ async function Pt(t) {
|
|
|
2465
2513
|
productType: "VIDEO",
|
|
2466
2514
|
streamingSessionId: e
|
|
2467
2515
|
}).catch(console.error), performance.mark("streaming_metrics:playback_info_fetch:endTimestamp", {
|
|
2468
|
-
detail: e
|
|
2516
|
+
detail: e,
|
|
2517
|
+
startTime: y.now()
|
|
2469
2518
|
}), s;
|
|
2470
2519
|
} catch (s) {
|
|
2471
2520
|
throw performance.mark("streaming_metrics:playback_info_fetch:endTimestamp", {
|
|
2472
|
-
detail: e
|
|
2473
|
-
|
|
2521
|
+
detail: e,
|
|
2522
|
+
startTime: y.now()
|
|
2523
|
+
}), U({
|
|
2474
2524
|
endReason: "ERROR",
|
|
2475
2525
|
errorCode: s.message,
|
|
2476
2526
|
errorMessage: s.stack,
|
|
2477
2527
|
streamingSessionId: e
|
|
2478
2528
|
}).catch(console.error), r.push(
|
|
2479
|
-
|
|
2529
|
+
Xe({
|
|
2480
2530
|
streamingSessionId: e,
|
|
2481
|
-
timestamp:
|
|
2531
|
+
timestamp: y.timestamp(
|
|
2482
2532
|
"streaming_metrics:playback_info_fetch:endTimestamp"
|
|
2483
2533
|
)
|
|
2484
2534
|
})
|
|
2485
2535
|
), s;
|
|
2486
2536
|
} finally {
|
|
2487
2537
|
r.push(
|
|
2488
|
-
|
|
2489
|
-
endTimestamp:
|
|
2538
|
+
U({
|
|
2539
|
+
endTimestamp: y.timestamp(
|
|
2490
2540
|
"streaming_metrics:playback_info_fetch:endTimestamp"
|
|
2491
2541
|
),
|
|
2492
|
-
startTimestamp:
|
|
2542
|
+
startTimestamp: y.timestamp(
|
|
2493
2543
|
"streaming_metrics:playback_info_fetch:startTimestamp"
|
|
2494
2544
|
),
|
|
2495
2545
|
streamingSessionId: e
|
|
2496
2546
|
})
|
|
2497
|
-
),
|
|
2547
|
+
), ne({
|
|
2498
2548
|
events: r
|
|
2499
2549
|
}).catch(console.error), performance.clearMarks(
|
|
2500
2550
|
"streaming_metrics:playback_info_fetch:endTimestamp"
|
|
@@ -2503,24 +2553,24 @@ async function Pt(t) {
|
|
|
2503
2553
|
);
|
|
2504
2554
|
}
|
|
2505
2555
|
}
|
|
2506
|
-
class
|
|
2556
|
+
class oe {
|
|
2507
2557
|
/**
|
|
2508
2558
|
* The current time position to restore playback from when connection is back online.
|
|
2509
2559
|
*/
|
|
2510
2560
|
static #e = 0;
|
|
2511
|
-
static #
|
|
2561
|
+
static #t = !1;
|
|
2512
2562
|
/**
|
|
2513
2563
|
* The media product to restore when connection is back online.
|
|
2514
2564
|
*/
|
|
2515
2565
|
static #s = null;
|
|
2516
|
-
static #
|
|
2566
|
+
static #r;
|
|
2517
2567
|
static #i;
|
|
2518
2568
|
static #n;
|
|
2519
2569
|
static disable() {
|
|
2520
|
-
this.#
|
|
2570
|
+
this.#t && (this.#r && window.removeEventListener("offline", this.#r, !1), this.#i && window.removeEventListener("online", this.#i, !1), this.#i = void 0, this.#r = void 0, this.#t = !1);
|
|
2521
2571
|
}
|
|
2522
2572
|
static enable() {
|
|
2523
|
-
this.#
|
|
2573
|
+
this.#t || (this.#i = () => this.#o(), this.#r = () => this.#a(), window.addEventListener("offline", this.#r, !1), window.addEventListener("online", this.#i, !1), this.#t = !0);
|
|
2524
2574
|
}
|
|
2525
2575
|
static #a() {
|
|
2526
2576
|
const { activePlayer: e } = p;
|
|
@@ -2551,15 +2601,15 @@ class he {
|
|
|
2551
2601
|
e && (this.#e = e.currentTime);
|
|
2552
2602
|
}
|
|
2553
2603
|
}
|
|
2554
|
-
const
|
|
2555
|
-
function
|
|
2556
|
-
return new CustomEvent(
|
|
2604
|
+
const kt = "streaming-privileges-revoked";
|
|
2605
|
+
function Mt(t) {
|
|
2606
|
+
return new CustomEvent(kt, {
|
|
2557
2607
|
detail: t
|
|
2558
2608
|
});
|
|
2559
2609
|
}
|
|
2560
|
-
let
|
|
2561
|
-
async function
|
|
2562
|
-
const e =
|
|
2610
|
+
let L;
|
|
2611
|
+
async function ce(t) {
|
|
2612
|
+
const e = M("apiUrl"), r = await fetch(e + "/rt/connect", {
|
|
2563
2613
|
headers: new Headers({
|
|
2564
2614
|
Authorization: "Bearer " + t,
|
|
2565
2615
|
"Content-Type": "application/json"
|
|
@@ -2568,18 +2618,18 @@ async function me(t) {
|
|
|
2568
2618
|
}), { url: s } = await r.json();
|
|
2569
2619
|
return s;
|
|
2570
2620
|
}
|
|
2571
|
-
function
|
|
2621
|
+
function de(t) {
|
|
2572
2622
|
return new Promise((e) => {
|
|
2573
2623
|
t.addEventListener("open", () => e(), { once: !0 });
|
|
2574
2624
|
});
|
|
2575
2625
|
}
|
|
2576
2626
|
class z {
|
|
2577
2627
|
#e;
|
|
2578
|
-
#r;
|
|
2579
|
-
#s;
|
|
2580
2628
|
#t;
|
|
2629
|
+
#s;
|
|
2630
|
+
#r;
|
|
2581
2631
|
constructor() {
|
|
2582
|
-
this.#
|
|
2632
|
+
this.#r = void 0, this.#t = this.#i(), h.addEventListener("user-action", () => {
|
|
2583
2633
|
this.connected && this.userAction().then().catch(console.error);
|
|
2584
2634
|
});
|
|
2585
2635
|
}
|
|
@@ -2587,42 +2637,42 @@ class z {
|
|
|
2587
2637
|
* Call this method to ensure pushkin is running.
|
|
2588
2638
|
*/
|
|
2589
2639
|
static async ensure() {
|
|
2590
|
-
await
|
|
2640
|
+
await B() && (L ? L.connected || await L.reconnect() : L = new z());
|
|
2591
2641
|
}
|
|
2592
2642
|
/**
|
|
2593
2643
|
* Call this method when credentials changes to re-setup pushkin with the new credentials
|
|
2594
2644
|
*/
|
|
2595
2645
|
static async refresh() {
|
|
2596
|
-
if (!await
|
|
2646
|
+
if (!await B())
|
|
2597
2647
|
return;
|
|
2598
|
-
const e = await
|
|
2599
|
-
|
|
2648
|
+
const e = await K();
|
|
2649
|
+
L && e && L.reconnect().catch(console.error);
|
|
2600
2650
|
}
|
|
2601
2651
|
async #i() {
|
|
2602
|
-
const e = await
|
|
2652
|
+
const e = await K();
|
|
2603
2653
|
if (!e)
|
|
2604
2654
|
throw new Error("No access token to connect to Pushkin.");
|
|
2605
|
-
const r = await
|
|
2606
|
-
r && (this.#
|
|
2655
|
+
const r = await ce(e);
|
|
2656
|
+
r && (this.#r = new WebSocket(r), await de(this.#r), this.#s = (s) => this.#o(s.data), this.#e = () => this.#a(), this.#r.addEventListener("message", this.#s, !1), this.#r.addEventListener("closed", this.#e, !1), window.addEventListener("online", () => this.#a(), {
|
|
2607
2657
|
once: !0
|
|
2608
2658
|
}));
|
|
2609
2659
|
}
|
|
2610
2660
|
async #n(e) {
|
|
2611
|
-
if (!this.#
|
|
2661
|
+
if (!this.#r)
|
|
2612
2662
|
throw new Error(
|
|
2613
2663
|
"No socket connected. Did you forget to call connect method in Pushkin service first?"
|
|
2614
2664
|
);
|
|
2615
|
-
this.#
|
|
2665
|
+
this.#r.readyState !== WebSocket.OPEN && await this.#t, this.#r.send(JSON.stringify(e));
|
|
2616
2666
|
}
|
|
2617
2667
|
#a() {
|
|
2618
|
-
this.#
|
|
2668
|
+
this.#t = this.#i();
|
|
2619
2669
|
}
|
|
2620
2670
|
#o(e) {
|
|
2621
2671
|
const r = JSON.parse(e);
|
|
2622
2672
|
switch (r.type) {
|
|
2623
2673
|
case "PRIVILEGED_SESSION_NOTIFICATION": {
|
|
2624
2674
|
h.dispatchEvent(
|
|
2625
|
-
|
|
2675
|
+
Mt(
|
|
2626
2676
|
String(r.payload.clientDisplayName)
|
|
2627
2677
|
)
|
|
2628
2678
|
), p.activePlayer?.pause();
|
|
@@ -2637,7 +2687,7 @@ class z {
|
|
|
2637
2687
|
}
|
|
2638
2688
|
}
|
|
2639
2689
|
reconnect() {
|
|
2640
|
-
return this.#
|
|
2690
|
+
return this.#r ? (this.#s && this.#r.removeEventListener("message", this.#s), this.#e && this.#r.removeEventListener("closed", this.#e), this.#r.close(), this.#t = this.#i(), this.#t) : Promise.resolve();
|
|
2641
2691
|
}
|
|
2642
2692
|
/**
|
|
2643
2693
|
* Call this method to tell Pushkin a user action happened, so it can
|
|
@@ -2648,7 +2698,7 @@ class z {
|
|
|
2648
2698
|
try {
|
|
2649
2699
|
await this.#n({
|
|
2650
2700
|
payload: {
|
|
2651
|
-
startedAt:
|
|
2701
|
+
startedAt: y.now()
|
|
2652
2702
|
},
|
|
2653
2703
|
type: "USER_ACTION"
|
|
2654
2704
|
});
|
|
@@ -2657,19 +2707,19 @@ class z {
|
|
|
2657
2707
|
}
|
|
2658
2708
|
}
|
|
2659
2709
|
get connected() {
|
|
2660
|
-
return this.#
|
|
2710
|
+
return this.#r && this.#r.readyState === WebSocket.OPEN;
|
|
2661
2711
|
}
|
|
2662
2712
|
}
|
|
2663
|
-
const
|
|
2713
|
+
const Et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2664
2714
|
__proto__: null,
|
|
2665
2715
|
Pushkin: z,
|
|
2666
|
-
fetchWebSocketURL:
|
|
2667
|
-
socketOpen:
|
|
2716
|
+
fetchWebSocketURL: ce,
|
|
2717
|
+
socketOpen: de
|
|
2668
2718
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2669
|
-
async function
|
|
2670
|
-
|
|
2719
|
+
async function Pt() {
|
|
2720
|
+
Be(), oe.disable(), await Ne();
|
|
2671
2721
|
}
|
|
2672
|
-
const
|
|
2722
|
+
const Tt = {
|
|
2673
2723
|
actions: [],
|
|
2674
2724
|
actualAssetPresentation: "PREVIEW",
|
|
2675
2725
|
actualAudioMode: "STEREO",
|
|
@@ -2685,50 +2735,56 @@ const At = {
|
|
|
2685
2735
|
sourceType: "",
|
|
2686
2736
|
startAssetPosition: -1,
|
|
2687
2737
|
startTimestamp: -1
|
|
2688
|
-
},
|
|
2738
|
+
}, le = await O(
|
|
2689
2739
|
"playback_session",
|
|
2690
|
-
|
|
2740
|
+
Tt
|
|
2691
2741
|
);
|
|
2692
|
-
function
|
|
2693
|
-
return
|
|
2742
|
+
function Kt(t) {
|
|
2743
|
+
return le(t);
|
|
2694
2744
|
}
|
|
2695
|
-
function
|
|
2696
|
-
return
|
|
2745
|
+
function Jt(t, e) {
|
|
2746
|
+
return le({
|
|
2697
2747
|
actions: [e],
|
|
2698
2748
|
streamingSessionId: t
|
|
2699
2749
|
});
|
|
2700
2750
|
}
|
|
2701
|
-
async function
|
|
2702
|
-
if (await
|
|
2751
|
+
async function ue(t, e = 0, r = !1) {
|
|
2752
|
+
if (await y.synchronize(), z.ensure().catch(console.error), p.activePlayer?.nextItem && p.activePlayer.nextItem.mediaProduct.productId === t.productId) {
|
|
2703
2753
|
const f = p.activePlayer;
|
|
2704
2754
|
return performance.mark(
|
|
2705
2755
|
"streaming_metrics:playback_statistics:idealStartTimestamp",
|
|
2706
|
-
{
|
|
2756
|
+
{
|
|
2757
|
+
detail: p.preloadedStreamingSessionId,
|
|
2758
|
+
startTime: y.now()
|
|
2759
|
+
}
|
|
2707
2760
|
), await f.reset({ keepPreload: !0 }), t.referenceId && p.preloadedStreamingSessionId && f.overwriteMediaProduct(
|
|
2708
2761
|
p.preloadedStreamingSessionId,
|
|
2709
2762
|
t
|
|
2710
2763
|
), f.skipToPreloadedMediaProduct();
|
|
2711
2764
|
}
|
|
2712
|
-
const s =
|
|
2713
|
-
|
|
2765
|
+
const s = Pt(), n = mt();
|
|
2766
|
+
ne({
|
|
2714
2767
|
events: [
|
|
2715
|
-
|
|
2768
|
+
ot({
|
|
2716
2769
|
sessionProductId: t.productId,
|
|
2717
2770
|
sessionProductType: t.productType === "track" ? "TRACK" : "VIDEO",
|
|
2718
2771
|
sessionType: "PLAYBACK",
|
|
2719
2772
|
startReason: "EXPLICIT",
|
|
2720
2773
|
streamingSessionId: n,
|
|
2721
|
-
timestamp:
|
|
2774
|
+
timestamp: y.now()
|
|
2722
2775
|
})
|
|
2723
2776
|
]
|
|
2724
2777
|
}).catch(console.error), performance.mark(
|
|
2725
2778
|
"streaming_metrics:playback_statistics:idealStartTimestamp",
|
|
2726
|
-
{
|
|
2779
|
+
{
|
|
2780
|
+
detail: n,
|
|
2781
|
+
startTime: y.now()
|
|
2782
|
+
}
|
|
2727
2783
|
);
|
|
2728
|
-
const { clientId: o, token: a } = await v.credentialsProvider.getCredentials(), c =
|
|
2729
|
-
let
|
|
2784
|
+
const { clientId: o, token: a } = await v.credentialsProvider.getCredentials(), c = M("streamingWifiAudioQuality");
|
|
2785
|
+
let l = null;
|
|
2730
2786
|
try {
|
|
2731
|
-
|
|
2787
|
+
l = await St({
|
|
2732
2788
|
accessToken: a,
|
|
2733
2789
|
audioQuality: c,
|
|
2734
2790
|
clientId: o,
|
|
@@ -2737,25 +2793,25 @@ async function ge(t, e = 0, r = !1) {
|
|
|
2737
2793
|
streamingSessionId: n
|
|
2738
2794
|
});
|
|
2739
2795
|
} catch (f) {
|
|
2740
|
-
f instanceof
|
|
2796
|
+
f instanceof V && h.dispatchError(f), document.location.href.includes("localhost") && console.error(f);
|
|
2741
2797
|
}
|
|
2742
|
-
if (!
|
|
2798
|
+
if (!l)
|
|
2743
2799
|
return;
|
|
2744
|
-
const
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
), await s,
|
|
2749
|
-
const
|
|
2800
|
+
const d = wt(l);
|
|
2801
|
+
q.saveStreamInfo(
|
|
2802
|
+
d.streamingSessionId,
|
|
2803
|
+
d
|
|
2804
|
+
), await s, oe.enable();
|
|
2805
|
+
const b = "trackId" in l ? l.audioQuality : void 0, E = await We(
|
|
2750
2806
|
t.productType,
|
|
2751
|
-
|
|
2807
|
+
b
|
|
2752
2808
|
);
|
|
2753
|
-
return
|
|
2809
|
+
return Fe(E), E.load(
|
|
2754
2810
|
{
|
|
2755
2811
|
assetPosition: e,
|
|
2756
2812
|
mediaProduct: t,
|
|
2757
|
-
playbackInfo:
|
|
2758
|
-
streamInfo:
|
|
2813
|
+
playbackInfo: l,
|
|
2814
|
+
streamInfo: d
|
|
2759
2815
|
},
|
|
2760
2816
|
"explicit"
|
|
2761
2817
|
);
|
|
@@ -2763,44 +2819,44 @@ async function ge(t, e = 0, r = !1) {
|
|
|
2763
2819
|
h.addEventListener("load", (t) => {
|
|
2764
2820
|
if (t instanceof CustomEvent) {
|
|
2765
2821
|
const { currentTime: e, mediaProduct: r } = t.detail;
|
|
2766
|
-
|
|
2822
|
+
ue(r, e).then().catch(console.error);
|
|
2767
2823
|
}
|
|
2768
2824
|
});
|
|
2769
|
-
function
|
|
2825
|
+
function It() {
|
|
2770
2826
|
return p.activePlayer?.pause();
|
|
2771
2827
|
}
|
|
2772
|
-
async function
|
|
2773
|
-
await
|
|
2828
|
+
async function Lt() {
|
|
2829
|
+
await y.synchronize();
|
|
2774
2830
|
const { activePlayer: t } = p;
|
|
2775
2831
|
return t ? (h.dispatchEvent(new CustomEvent("user-action")), t.play()) : Promise.reject(new Error("No active player"));
|
|
2776
2832
|
}
|
|
2777
|
-
async function
|
|
2833
|
+
async function Ot(t) {
|
|
2778
2834
|
const { activePlayer: e } = p;
|
|
2779
2835
|
return e?.seek(t);
|
|
2780
2836
|
}
|
|
2781
|
-
function
|
|
2837
|
+
function Yt(t) {
|
|
2782
2838
|
v.credentialsProvider = t;
|
|
2783
2839
|
}
|
|
2784
|
-
const
|
|
2785
|
-
function
|
|
2786
|
-
return new CustomEvent(
|
|
2840
|
+
const At = "active-device-changed";
|
|
2841
|
+
function Xt(t) {
|
|
2842
|
+
return new CustomEvent(At, {
|
|
2787
2843
|
detail: t
|
|
2788
2844
|
});
|
|
2789
2845
|
}
|
|
2790
|
-
const
|
|
2791
|
-
function
|
|
2792
|
-
return new CustomEvent(
|
|
2846
|
+
const Ct = "active-device-mode-changed";
|
|
2847
|
+
function Zt(t) {
|
|
2848
|
+
return new CustomEvent(Ct, {
|
|
2793
2849
|
detail: t
|
|
2794
2850
|
});
|
|
2795
2851
|
}
|
|
2796
|
-
const
|
|
2797
|
-
function
|
|
2798
|
-
return new CustomEvent(
|
|
2852
|
+
const _t = "active-device-pass-through-changed";
|
|
2853
|
+
function er(t) {
|
|
2854
|
+
return new CustomEvent(_t, {
|
|
2799
2855
|
detail: t
|
|
2800
2856
|
});
|
|
2801
2857
|
}
|
|
2802
|
-
|
|
2803
|
-
function
|
|
2858
|
+
y.synchronize().then().catch(console.error);
|
|
2859
|
+
function he() {
|
|
2804
2860
|
const { activePlayer: t } = p;
|
|
2805
2861
|
if (!t)
|
|
2806
2862
|
return null;
|
|
@@ -2813,10 +2869,19 @@ function we() {
|
|
|
2813
2869
|
return null;
|
|
2814
2870
|
}
|
|
2815
2871
|
}
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2872
|
+
function Nt() {
|
|
2873
|
+
const t = localStorage.getItem("ssuid");
|
|
2874
|
+
try {
|
|
2875
|
+
t && indexedDB.deleteDatabase("streaming-sessions-" + t);
|
|
2876
|
+
} catch (e) {
|
|
2877
|
+
console.warn(`DB streaming-sessions-${t} could not be deleted`), console.error(e);
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
Se().then().catch(console.error);
|
|
2881
|
+
Me().then().catch(console.error);
|
|
2882
|
+
Nt();
|
|
2883
|
+
const j = String.raw, Ft = String.raw;
|
|
2884
|
+
function me(t) {
|
|
2820
2885
|
if (t === void 0)
|
|
2821
2886
|
return "0:00";
|
|
2822
2887
|
const e = parseInt(String(t), 10), r = Math.floor(e / 3600), s = Math.floor((e - r * 3600) / 60), n = e - r * 3600 - s * 60;
|
|
@@ -2828,52 +2893,52 @@ function ye(t) {
|
|
|
2828
2893
|
o = `${s}:`;
|
|
2829
2894
|
return o += n < 10 ? `0${n}` : String(n), o;
|
|
2830
2895
|
}
|
|
2831
|
-
function
|
|
2832
|
-
const e = typeof t == "number" ? t : parseInt(t, 10), r = Math.floor(e / 3600) % 24, s = Math.floor(e / 60) % 60, n = e % 60, o = (c,
|
|
2833
|
-
if (c === 0 &&
|
|
2896
|
+
function pe(t = 0) {
|
|
2897
|
+
const e = typeof t == "number" ? t : parseInt(t, 10), r = Math.floor(e / 3600) % 24, s = Math.floor(e / 60) % 60, n = e % 60, o = (c, l) => {
|
|
2898
|
+
if (c === 0 && l !== 1)
|
|
2834
2899
|
return "";
|
|
2835
|
-
let
|
|
2836
|
-
switch (
|
|
2900
|
+
let d;
|
|
2901
|
+
switch (l) {
|
|
2837
2902
|
case 0:
|
|
2838
|
-
|
|
2903
|
+
d = "H";
|
|
2839
2904
|
break;
|
|
2840
2905
|
case 1:
|
|
2841
|
-
|
|
2906
|
+
d = "M";
|
|
2842
2907
|
break;
|
|
2843
2908
|
default:
|
|
2844
|
-
|
|
2909
|
+
d = "S";
|
|
2845
2910
|
break;
|
|
2846
2911
|
}
|
|
2847
|
-
return `${
|
|
2912
|
+
return `${d}${c}`;
|
|
2848
2913
|
};
|
|
2849
2914
|
return `P${[r, s, n].map(o).join("")}`;
|
|
2850
2915
|
}
|
|
2851
|
-
const
|
|
2852
|
-
class
|
|
2916
|
+
const Bt = "tidal-current-time";
|
|
2917
|
+
class Rt extends HTMLElement {
|
|
2853
2918
|
#e = void 0;
|
|
2854
|
-
#
|
|
2919
|
+
#t = /* @__PURE__ */ new Set();
|
|
2855
2920
|
#s;
|
|
2856
|
-
#
|
|
2921
|
+
#r;
|
|
2857
2922
|
#i;
|
|
2858
2923
|
constructor() {
|
|
2859
|
-
super(), this.#i = (e) => this.renderTime(e.target.currentTime), this.#
|
|
2924
|
+
super(), this.#i = (e) => this.renderTime(e.target.currentTime), this.#r = () => this.renderTime(0), this.#s = this.#n.bind(this);
|
|
2860
2925
|
}
|
|
2861
2926
|
#n() {
|
|
2862
|
-
const e =
|
|
2863
|
-
e && this.#e && !this.#
|
|
2927
|
+
const e = he();
|
|
2928
|
+
e && this.#e && !this.#t.has(e) && (e.addEventListener("timeupdate", this.#i, !1), this.#t.add(e));
|
|
2864
2929
|
}
|
|
2865
2930
|
connectedCallback() {
|
|
2866
2931
|
const e = this.attachShadow({ mode: "open" });
|
|
2867
2932
|
e.innerHTML = "<time></time>";
|
|
2868
2933
|
const r = e.querySelector("time");
|
|
2869
|
-
this.#e === void 0 && r !== null && (this.#e = r), this.renderTime(
|
|
2934
|
+
this.#e === void 0 && r !== null && (this.#e = r), this.renderTime(Ve()), h.addEventListener(
|
|
2870
2935
|
"media-product-transition",
|
|
2871
2936
|
this.#s,
|
|
2872
2937
|
!1
|
|
2873
|
-
), h.addEventListener("ended", this.#
|
|
2938
|
+
), h.addEventListener("ended", this.#r, !1);
|
|
2874
2939
|
}
|
|
2875
2940
|
disconnectedCallback() {
|
|
2876
|
-
for (let e of this.#
|
|
2941
|
+
for (let e of this.#t)
|
|
2877
2942
|
e.removeEventListener(
|
|
2878
2943
|
"timeupdate",
|
|
2879
2944
|
this.#i,
|
|
@@ -2883,58 +2948,58 @@ class Ut extends HTMLElement {
|
|
|
2883
2948
|
"media-product-transition",
|
|
2884
2949
|
this.#s,
|
|
2885
2950
|
!1
|
|
2886
|
-
), h.removeEventListener("ended", this.#
|
|
2951
|
+
), h.removeEventListener("ended", this.#r, !1);
|
|
2887
2952
|
}
|
|
2888
2953
|
renderTime(e) {
|
|
2889
2954
|
const r = Math.floor(e);
|
|
2890
|
-
this.#e && (this.#e.textContent =
|
|
2955
|
+
this.#e && (this.#e.textContent = me(r), this.#e.setAttribute("datetime", pe(r)));
|
|
2891
2956
|
}
|
|
2892
2957
|
}
|
|
2893
|
-
customElements.define(
|
|
2894
|
-
const
|
|
2895
|
-
class
|
|
2958
|
+
customElements.define(Bt, Rt);
|
|
2959
|
+
const xt = "tidal-duration-time";
|
|
2960
|
+
class Dt extends HTMLElement {
|
|
2896
2961
|
#e;
|
|
2897
|
-
#
|
|
2962
|
+
#t = !1;
|
|
2898
2963
|
#s;
|
|
2899
2964
|
constructor() {
|
|
2900
2965
|
super(), this.#s = (e) => {
|
|
2901
2966
|
const r = e;
|
|
2902
2967
|
this.renderTime(r.detail.playbackContext.actualDuration);
|
|
2903
|
-
}, this.#
|
|
2968
|
+
}, this.#r();
|
|
2904
2969
|
}
|
|
2905
|
-
#
|
|
2906
|
-
this.#
|
|
2970
|
+
#r() {
|
|
2971
|
+
this.#t || (h.addEventListener(
|
|
2907
2972
|
"media-product-transition",
|
|
2908
2973
|
this.#s,
|
|
2909
2974
|
!1
|
|
2910
|
-
), this.#
|
|
2975
|
+
), this.#t = !0);
|
|
2911
2976
|
}
|
|
2912
2977
|
#i() {
|
|
2913
2978
|
const e = this.attachShadow({ mode: "open" });
|
|
2914
2979
|
this.#e = document.createElement("time"), e.appendChild(this.#e);
|
|
2915
2980
|
}
|
|
2916
2981
|
connectedCallback() {
|
|
2917
|
-
this.#
|
|
2982
|
+
this.#r(), this.#i();
|
|
2918
2983
|
const e = parseInt(String(this.textContent), 10), r = Number.isNaN(e) ? 0 : e;
|
|
2919
|
-
this.renderTime(
|
|
2984
|
+
this.renderTime(Ue()?.actualDuration ?? r);
|
|
2920
2985
|
}
|
|
2921
2986
|
disconnectedCallback() {
|
|
2922
2987
|
h.removeEventListener(
|
|
2923
2988
|
"media-product-transition",
|
|
2924
2989
|
this.#s,
|
|
2925
2990
|
!1
|
|
2926
|
-
), this.#
|
|
2991
|
+
), this.#t = !1;
|
|
2927
2992
|
}
|
|
2928
2993
|
renderTime(e) {
|
|
2929
2994
|
const r = parseInt(e.toFixed(0), 10);
|
|
2930
|
-
this.#e && (this.#e.textContent =
|
|
2995
|
+
this.#e && (this.#e.textContent = me(r), this.#e.setAttribute("datetime", pe(r)));
|
|
2931
2996
|
}
|
|
2932
2997
|
}
|
|
2933
|
-
customElements.define(
|
|
2934
|
-
const
|
|
2935
|
-
class
|
|
2998
|
+
customElements.define(xt, Dt);
|
|
2999
|
+
const Wt = "tidal-play-trigger";
|
|
3000
|
+
class Vt extends HTMLElement {
|
|
2936
3001
|
#e;
|
|
2937
|
-
#
|
|
3002
|
+
#t = !1;
|
|
2938
3003
|
constructor() {
|
|
2939
3004
|
super(), this.#e = (e) => {
|
|
2940
3005
|
e.preventDefault(), this.#s().catch(console.error);
|
|
@@ -2944,15 +3009,15 @@ class Ht extends HTMLElement {
|
|
|
2944
3009
|
return ["product-id", "product-type"];
|
|
2945
3010
|
}
|
|
2946
3011
|
async #s() {
|
|
2947
|
-
await this.#
|
|
3012
|
+
await this.#r(), te() === "PLAYING" ? It() : await Lt();
|
|
2948
3013
|
}
|
|
2949
|
-
#
|
|
2950
|
-
const e =
|
|
3014
|
+
#r() {
|
|
3015
|
+
const e = ze()?.productId ?? void 0;
|
|
2951
3016
|
if (this.mediaProduct && this.mediaProduct.productId !== e)
|
|
2952
|
-
return
|
|
3017
|
+
return ue(this.mediaProduct, 0);
|
|
2953
3018
|
}
|
|
2954
3019
|
#i() {
|
|
2955
|
-
this.#
|
|
3020
|
+
this.#t || this.addEventListener("click", this.#e, { passive: !0 });
|
|
2956
3021
|
}
|
|
2957
3022
|
#n() {
|
|
2958
3023
|
const e = this.attachShadow({ mode: "closed" }), r = document.createElement("style");
|
|
@@ -2970,7 +3035,7 @@ class Ht extends HTMLElement {
|
|
|
2970
3035
|
disconnectedCallback() {
|
|
2971
3036
|
this.removeEventListener("click", this.#e, {
|
|
2972
3037
|
passive: !0
|
|
2973
|
-
}), this.#
|
|
3038
|
+
}), this.#t = !1;
|
|
2974
3039
|
}
|
|
2975
3040
|
get mediaProduct() {
|
|
2976
3041
|
const e = this.getAttribute("product-id");
|
|
@@ -2985,8 +3050,8 @@ class Ht extends HTMLElement {
|
|
|
2985
3050
|
};
|
|
2986
3051
|
}
|
|
2987
3052
|
}
|
|
2988
|
-
customElements.define(
|
|
2989
|
-
const
|
|
3053
|
+
customElements.define(Wt, Vt);
|
|
3054
|
+
const zt = j`
|
|
2990
3055
|
:host {
|
|
2991
3056
|
display: inline-block;
|
|
2992
3057
|
}
|
|
@@ -3007,22 +3072,22 @@ const qt = j`
|
|
|
3007
3072
|
background-color: currentColor;
|
|
3008
3073
|
pointer-events: none;
|
|
3009
3074
|
}
|
|
3010
|
-
`,
|
|
3075
|
+
`, X = {
|
|
3011
3076
|
NO_DURATION: "You need to set duration before you can start/stop the progress bar."
|
|
3012
3077
|
};
|
|
3013
|
-
class
|
|
3078
|
+
class Ut extends HTMLElement {
|
|
3014
3079
|
#e;
|
|
3015
|
-
#
|
|
3080
|
+
#t = 1;
|
|
3016
3081
|
#s = null;
|
|
3017
|
-
#
|
|
3082
|
+
#r;
|
|
3018
3083
|
#i;
|
|
3019
3084
|
#n = /* @__PURE__ */ new Set();
|
|
3020
3085
|
#a = null;
|
|
3021
3086
|
#o;
|
|
3022
3087
|
constructor() {
|
|
3023
|
-
super(), this.#
|
|
3088
|
+
super(), this.#r = (e) => {
|
|
3024
3089
|
const r = e;
|
|
3025
|
-
if (this.duration = r.detail.playbackContext.actualDuration,
|
|
3090
|
+
if (this.duration = r.detail.playbackContext.actualDuration, te() === "PLAYING")
|
|
3026
3091
|
try {
|
|
3027
3092
|
this.start();
|
|
3028
3093
|
} catch (s) {
|
|
@@ -3042,7 +3107,7 @@ class Qt extends HTMLElement {
|
|
|
3042
3107
|
#c() {
|
|
3043
3108
|
this.#n.has("media-product-transition") || (h.addEventListener(
|
|
3044
3109
|
"media-product-transition",
|
|
3045
|
-
this.#
|
|
3110
|
+
this.#r,
|
|
3046
3111
|
!1
|
|
3047
3112
|
), this.#n.add("media-product-transition")), this.#n.has("playback-state-change") || (h.addEventListener(
|
|
3048
3113
|
"playback-state-change",
|
|
@@ -3051,9 +3116,9 @@ class Qt extends HTMLElement {
|
|
|
3051
3116
|
}
|
|
3052
3117
|
#d() {
|
|
3053
3118
|
const e = this.attachShadow({ mode: "closed" });
|
|
3054
|
-
e.innerHTML =
|
|
3119
|
+
e.innerHTML = Ft`
|
|
3055
3120
|
<style>
|
|
3056
|
-
${
|
|
3121
|
+
${zt}
|
|
3057
3122
|
</style>
|
|
3058
3123
|
<div id="wrapper">
|
|
3059
3124
|
<div id="indicator"></div>
|
|
@@ -3071,7 +3136,7 @@ class Qt extends HTMLElement {
|
|
|
3071
3136
|
disconnectedCallback() {
|
|
3072
3137
|
h.removeEventListener(
|
|
3073
3138
|
"media-product-transition",
|
|
3074
|
-
this.#
|
|
3139
|
+
this.#r,
|
|
3075
3140
|
!1
|
|
3076
3141
|
), h.removeEventListener(
|
|
3077
3142
|
"playback-state-change",
|
|
@@ -3102,8 +3167,8 @@ class Qt extends HTMLElement {
|
|
|
3102
3167
|
* @param {MouseEvent | PointerEvent} event
|
|
3103
3168
|
*/
|
|
3104
3169
|
handleClick(e) {
|
|
3105
|
-
const r = this.getMousePositionAsPercent(e), s = this.#
|
|
3106
|
-
this.currentTime = s,
|
|
3170
|
+
const r = this.getMousePositionAsPercent(e), s = this.#t * r;
|
|
3171
|
+
this.currentTime = s, Ot(s / 1e3);
|
|
3107
3172
|
}
|
|
3108
3173
|
/**
|
|
3109
3174
|
* Starts the animation if duration is defined.
|
|
@@ -3112,7 +3177,7 @@ class Qt extends HTMLElement {
|
|
|
3112
3177
|
*/
|
|
3113
3178
|
start() {
|
|
3114
3179
|
if (!this.#e)
|
|
3115
|
-
throw new Error(
|
|
3180
|
+
throw new Error(X.NO_DURATION);
|
|
3116
3181
|
this.#e.play();
|
|
3117
3182
|
}
|
|
3118
3183
|
/**
|
|
@@ -3122,7 +3187,7 @@ class Qt extends HTMLElement {
|
|
|
3122
3187
|
*/
|
|
3123
3188
|
stop() {
|
|
3124
3189
|
if (!this.#e)
|
|
3125
|
-
throw new Error(
|
|
3190
|
+
throw new Error(X.NO_DURATION);
|
|
3126
3191
|
this.#e.pause();
|
|
3127
3192
|
}
|
|
3128
3193
|
/**
|
|
@@ -3137,7 +3202,7 @@ class Qt extends HTMLElement {
|
|
|
3137
3202
|
* Setting this recrates the animation with the new duraton and pauses the animation.
|
|
3138
3203
|
*/
|
|
3139
3204
|
set duration(e) {
|
|
3140
|
-
this.#
|
|
3205
|
+
this.#t = e * 1e3;
|
|
3141
3206
|
const r = [
|
|
3142
3207
|
{
|
|
3143
3208
|
transform: "translateX(-100%)"
|
|
@@ -3147,7 +3212,7 @@ class Qt extends HTMLElement {
|
|
|
3147
3212
|
}
|
|
3148
3213
|
];
|
|
3149
3214
|
this.#e = this.#s?.animate(r, {
|
|
3150
|
-
duration: this.#
|
|
3215
|
+
duration: this.#t,
|
|
3151
3216
|
iterations: 1
|
|
3152
3217
|
}), this.#e?.pause();
|
|
3153
3218
|
}
|
|
@@ -3158,9 +3223,9 @@ class Qt extends HTMLElement {
|
|
|
3158
3223
|
this.stop(), this.#e && (this.#e.playbackRate = e), this.start();
|
|
3159
3224
|
}
|
|
3160
3225
|
}
|
|
3161
|
-
const
|
|
3162
|
-
customElements.define(
|
|
3163
|
-
const
|
|
3226
|
+
const Ht = "tidal-progress-bar";
|
|
3227
|
+
customElements.define(Ht, Ut);
|
|
3228
|
+
const $t = j`
|
|
3164
3229
|
:host {
|
|
3165
3230
|
position: relative;
|
|
3166
3231
|
display: block;
|
|
@@ -3177,13 +3242,13 @@ const jt = j`
|
|
|
3177
3242
|
position: relative;
|
|
3178
3243
|
background-color: black;
|
|
3179
3244
|
}
|
|
3180
|
-
`,
|
|
3181
|
-
class
|
|
3245
|
+
`, qt = "tidal-video-view";
|
|
3246
|
+
class jt extends HTMLElement {
|
|
3182
3247
|
#e = !1;
|
|
3183
|
-
#
|
|
3248
|
+
#t;
|
|
3184
3249
|
#s;
|
|
3185
3250
|
constructor() {
|
|
3186
|
-
super(), this.#
|
|
3251
|
+
super(), this.#t = (e) => {
|
|
3187
3252
|
e.detail.mediaProduct.productType === "video" && this.mountPlayer();
|
|
3188
3253
|
}, this.#s = (e) => {
|
|
3189
3254
|
const r = e;
|
|
@@ -3191,12 +3256,12 @@ class Kt extends HTMLElement {
|
|
|
3191
3256
|
"playback-state",
|
|
3192
3257
|
r.detail.state.toLocaleLowerCase()
|
|
3193
3258
|
);
|
|
3194
|
-
}, this.#
|
|
3259
|
+
}, this.#r();
|
|
3195
3260
|
}
|
|
3196
|
-
#
|
|
3261
|
+
#r() {
|
|
3197
3262
|
this.#e || (h.addEventListener(
|
|
3198
3263
|
"media-product-transition",
|
|
3199
|
-
this.#
|
|
3264
|
+
this.#t,
|
|
3200
3265
|
!1
|
|
3201
3266
|
), h.addEventListener(
|
|
3202
3267
|
"playback-state-change",
|
|
@@ -3205,16 +3270,16 @@ class Kt extends HTMLElement {
|
|
|
3205
3270
|
));
|
|
3206
3271
|
}
|
|
3207
3272
|
connectedCallback() {
|
|
3208
|
-
this.#
|
|
3273
|
+
this.#r();
|
|
3209
3274
|
const e = this.attachShadow({ mode: "closed" }), r = document.createElement("style");
|
|
3210
|
-
r.textContent =
|
|
3275
|
+
r.textContent = $t;
|
|
3211
3276
|
const s = document.createElement("slot");
|
|
3212
3277
|
e.appendChild(r), e.appendChild(s);
|
|
3213
3278
|
}
|
|
3214
3279
|
disconnectedCallback() {
|
|
3215
3280
|
h.removeEventListener(
|
|
3216
3281
|
"media-product-transition",
|
|
3217
|
-
this.#
|
|
3282
|
+
this.#t,
|
|
3218
3283
|
!1
|
|
3219
3284
|
), h.removeEventListener(
|
|
3220
3285
|
"playback-state-change",
|
|
@@ -3223,45 +3288,45 @@ class Kt extends HTMLElement {
|
|
|
3223
3288
|
), this.#e = !0;
|
|
3224
3289
|
}
|
|
3225
3290
|
mountPlayer() {
|
|
3226
|
-
const e =
|
|
3291
|
+
const e = he();
|
|
3227
3292
|
e && (this.innerHTML = "", this.appendChild(e));
|
|
3228
3293
|
}
|
|
3229
3294
|
}
|
|
3230
|
-
customElements.define(
|
|
3295
|
+
customElements.define(qt, jt);
|
|
3231
3296
|
export {
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3297
|
+
V as $,
|
|
3298
|
+
Kt as A,
|
|
3299
|
+
ke as C,
|
|
3300
|
+
F as D,
|
|
3301
|
+
ne as G,
|
|
3302
|
+
Yt as K,
|
|
3303
|
+
O as N,
|
|
3304
|
+
T as O,
|
|
3305
|
+
v as P,
|
|
3306
|
+
M as S,
|
|
3307
|
+
q as T,
|
|
3308
|
+
Qt as V,
|
|
3309
|
+
Gt as W,
|
|
3310
|
+
Xt as X,
|
|
3311
|
+
Ee as _,
|
|
3312
|
+
I as a,
|
|
3313
|
+
h as b,
|
|
3314
|
+
we as c,
|
|
3315
|
+
Xe as d,
|
|
3316
|
+
Zt as e,
|
|
3317
|
+
ue as f,
|
|
3318
|
+
y as g,
|
|
3319
|
+
ie as h,
|
|
3320
|
+
it as i,
|
|
3321
|
+
Bt as j,
|
|
3322
|
+
xt as k,
|
|
3257
3323
|
p as l,
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
h as y
|
|
3324
|
+
mt as m,
|
|
3325
|
+
Wt as n,
|
|
3326
|
+
Ht as o,
|
|
3327
|
+
ht as p,
|
|
3328
|
+
qt as q,
|
|
3329
|
+
er as r,
|
|
3330
|
+
J as s,
|
|
3331
|
+
Jt as z
|
|
3267
3332
|
};
|