@tidal-music/player-web-components 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/basePlayer-C5QIyqfj-Dxhlf4BZ.js +528 -0
- package/dist/{browserPlayer-oNOpDVm6-UW0N6pFH.js → browserPlayer-HE2uqs17-DJrIq6Jp.js} +44 -55
- package/dist/{index-tM9JvbA8.js → index-vp_MoGvy.js} +1204 -1054
- package/dist/index.d.ts +3 -0
- package/dist/index.js +9 -8
- package/dist/{nativePlayer-U375Dfm5-hUK7oXzY.js → nativePlayer-B3eHKegV-DdXsvi0F.js} +65 -104
- package/dist/output-devices-Jno8Kp5B-CAnEAv_Z.js +224 -0
- package/dist/shakaPlayer-CCJQsypf-DHT2kwDp.js +24411 -0
- package/package.json +16 -18
- package/dist/basePlayer-a-avZASH-Ux-6s9Ex.js +0 -579
- package/dist/output-devices-NXuo75MQ-_vYYuqUm.js +0 -236
- package/dist/shakaPlayer-izGFLVQr--XUsjgT2.js +0 -24740
- package/dist/worker-qh_9Fyf6-Li0uY2-a.js +0 -89
- /package/dist/{_commonjsHelpers-f3sTPFkQ-YKQV-mq1.js → _commonjsHelpers-DaMA6jEr-DtILRGNx.js} +0 -0
|
@@ -1,167 +1,180 @@
|
|
|
1
|
-
let
|
|
1
|
+
let A = Object.freeze({
|
|
2
2
|
apiUrl: "https://api.tidal.com/v1",
|
|
3
|
-
appVersion: "TIDAL Player",
|
|
4
|
-
clientPlatform: "web",
|
|
5
3
|
desiredVolumeLevel: 1,
|
|
6
|
-
eventUrl: "https://et.tidal.com/api/events",
|
|
7
4
|
gatherEvents: !0,
|
|
8
5
|
loudnessNormalizationMode: "ALBUM",
|
|
9
6
|
outputDevicesEnabled: !1,
|
|
10
7
|
streamingWifiAudioQuality: "LOW"
|
|
11
8
|
});
|
|
12
|
-
function
|
|
13
|
-
return
|
|
14
|
-
}
|
|
15
|
-
function
|
|
16
|
-
return
|
|
17
|
-
...
|
|
18
|
-
...
|
|
19
|
-
}), Object.keys(
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
}),
|
|
23
|
-
}
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
31
|
-
e instanceof WeakSet ? e.add(t) : e.set(t, r);
|
|
32
|
-
}, B = (t, e, r, s) => (ee(t, e, "write to private field"), s ? s.call(t, r) : e.set(t, r), r), A, C, x, D;
|
|
33
|
-
class te {
|
|
9
|
+
function _(r) {
|
|
10
|
+
return A[r];
|
|
11
|
+
}
|
|
12
|
+
function B(r) {
|
|
13
|
+
return A = Object.freeze({
|
|
14
|
+
...A,
|
|
15
|
+
...r
|
|
16
|
+
}), Object.keys(r).forEach((e) => {
|
|
17
|
+
const t = e;
|
|
18
|
+
oe.dispatchEvent(new CustomEvent(t, { detail: r[t] }));
|
|
19
|
+
}), A;
|
|
20
|
+
}
|
|
21
|
+
const oe = new EventTarget();
|
|
22
|
+
class ce {
|
|
23
|
+
#e;
|
|
24
|
+
#r = !1;
|
|
25
|
+
#s;
|
|
26
|
+
#t;
|
|
34
27
|
constructor(e) {
|
|
35
|
-
|
|
28
|
+
this.#t = new URL(e), this.synchronize();
|
|
36
29
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
);
|
|
30
|
+
/**
|
|
31
|
+
* Returns the current time adjusted to server-time.
|
|
32
|
+
*
|
|
33
|
+
* @param clientCurrentTime The current time on the client side. Defaults to Date.now().
|
|
34
|
+
* @returns The current adjusted time (or the client time if not synced yet).
|
|
35
|
+
*/
|
|
36
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
37
|
+
now(e = Date.now()) {
|
|
38
|
+
return !this.#s || !this.#e ? (console.warn("TrueTime is not yet synchronized"), e) : this.#s + (e - this.#e);
|
|
46
39
|
}
|
|
47
40
|
/**
|
|
48
|
-
*
|
|
41
|
+
* Synchronizes the client's time with the server's time.
|
|
42
|
+
* If the client's time is already synchronized within an hour, this method does nothing.
|
|
49
43
|
*
|
|
50
|
-
* @
|
|
44
|
+
* @returns {Promise<void>} A promise that resolves when the synchronization is complete.
|
|
51
45
|
*/
|
|
52
46
|
async synchronize() {
|
|
53
|
-
if (!
|
|
47
|
+
if (!(this.#e && // eslint-disable-next-line no-restricted-syntax
|
|
48
|
+
Math.abs(Date.now() - this.#e) < 36e5 || this.#r)) {
|
|
49
|
+
this.#r = !0;
|
|
54
50
|
try {
|
|
55
|
-
const e = await fetch(
|
|
56
|
-
e.ok && e.headers.has("date") && (
|
|
51
|
+
const e = await fetch(this.#t);
|
|
52
|
+
e.ok && e.headers.has("date") && (this.#s = new Date(e.headers.get("date")).getTime(), this.#e = Date.now());
|
|
57
53
|
} catch (e) {
|
|
58
54
|
console.error(e);
|
|
59
55
|
}
|
|
56
|
+
this.#r = !1;
|
|
57
|
+
}
|
|
60
58
|
}
|
|
61
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Returns the timestamp of a performance mark with the specified name and detail.
|
|
61
|
+
* PS: `performance.mark` must be called with `startTime: trueTime.now()`.
|
|
62
|
+
*
|
|
63
|
+
* @param markName - The name of the performance mark.
|
|
64
|
+
* @param detail - Optional. The detail of the performance mark.
|
|
65
|
+
* @returns The timestamp of the performance mark, or undefined if not found.
|
|
66
|
+
* @throws ReferenceError if the performance mark is not found.
|
|
67
|
+
*/
|
|
68
|
+
timestamp(e, t) {
|
|
62
69
|
let s;
|
|
63
|
-
if (
|
|
64
|
-
if (s = performance.getEntriesByName(e).find((n) => "detail" in n && n.detail ===
|
|
70
|
+
if (t) {
|
|
71
|
+
if (s = performance.getEntriesByName(e).find((n) => "detail" in n && n.detail === t), !s)
|
|
65
72
|
throw new ReferenceError(
|
|
66
|
-
`There is no performance entry named "${e}" with detail "${
|
|
73
|
+
`There is no performance entry named "${e}" with detail "${t}"`
|
|
67
74
|
);
|
|
68
75
|
} else
|
|
69
76
|
s = performance.getEntriesByName(e).pop();
|
|
70
|
-
return s ?
|
|
77
|
+
return s ? s.startTime : void 0;
|
|
71
78
|
}
|
|
72
79
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const b = new te("https://api.tidal.com/v1/ping"), K = (t, e, r) => {
|
|
76
|
-
for (const s of t) {
|
|
80
|
+
const y = new ce("https://api.tidal.com/v1/ping"), de = (r, e, t) => {
|
|
81
|
+
for (const s of r) {
|
|
77
82
|
const n = s.addedNodes[0];
|
|
78
|
-
s.type === "childList" && n.id === e &&
|
|
83
|
+
s.type === "childList" && n.id === e && t();
|
|
79
84
|
}
|
|
80
85
|
};
|
|
81
|
-
function
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
86
|
+
function le() {
|
|
87
|
+
const r = document.getElementById("tidal-player-root");
|
|
88
|
+
if (!r)
|
|
84
89
|
return Promise.reject("No player root");
|
|
85
|
-
if ("video-one" in
|
|
90
|
+
if ("video-one" in r.children)
|
|
86
91
|
return Promise.resolve();
|
|
87
92
|
const e = [];
|
|
88
|
-
return "video-one" in
|
|
89
|
-
new Promise((
|
|
93
|
+
return "video-one" in r.children || e.push(
|
|
94
|
+
new Promise((t) => {
|
|
90
95
|
new MutationObserver(
|
|
91
|
-
(s) =>
|
|
92
|
-
).observe(
|
|
93
|
-
})
|
|
94
|
-
), "video-two" in t.children || e.push(
|
|
95
|
-
new Promise((r) => {
|
|
96
|
-
new MutationObserver(
|
|
97
|
-
(s) => K(s, "video-two", r)
|
|
98
|
-
).observe(t, { childList: !0 });
|
|
96
|
+
(s) => de(s, "video-one", t)
|
|
97
|
+
).observe(r, { childList: !0 });
|
|
99
98
|
})
|
|
100
99
|
), Promise.all(e);
|
|
101
100
|
}
|
|
102
|
-
const E = document.createElement("video"),
|
|
103
|
-
|
|
101
|
+
const E = document.createElement("video"), ue = (r) => {
|
|
102
|
+
r.setAttribute("crossorigin", "anonymous"), r.setAttribute("playsinline", "playsinline");
|
|
104
103
|
};
|
|
105
|
-
|
|
104
|
+
ue(E);
|
|
106
105
|
E.id = "video-one";
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
let t = document.getElementById(U);
|
|
112
|
-
if (!t) {
|
|
106
|
+
const O = "tidal-player-root";
|
|
107
|
+
function he() {
|
|
108
|
+
let r = document.getElementById(O);
|
|
109
|
+
if (!r) {
|
|
113
110
|
const e = document.createElement("template");
|
|
114
|
-
e.id =
|
|
111
|
+
e.id = O, document.body.appendChild(e), r = document.getElementById(O);
|
|
115
112
|
}
|
|
116
|
-
return
|
|
113
|
+
return me();
|
|
117
114
|
}
|
|
118
|
-
function
|
|
119
|
-
const
|
|
120
|
-
|
|
115
|
+
function me() {
|
|
116
|
+
const r = document.getElementById(
|
|
117
|
+
O
|
|
121
118
|
);
|
|
122
|
-
return
|
|
119
|
+
return r && (E.id in r.children || r.appendChild(E)), le();
|
|
123
120
|
}
|
|
124
|
-
function
|
|
121
|
+
function pe() {
|
|
125
122
|
return new Promise(
|
|
126
|
-
(
|
|
123
|
+
(r) => document.addEventListener(
|
|
127
124
|
"click",
|
|
128
125
|
() => {
|
|
129
|
-
E.readyState === HTMLMediaElement.HAVE_NOTHING && !E.src && E.load(),
|
|
126
|
+
E.readyState === HTMLMediaElement.HAVE_NOTHING && !E.src && E.load(), r();
|
|
130
127
|
},
|
|
131
128
|
{ once: !0 }
|
|
132
129
|
)
|
|
133
130
|
);
|
|
134
131
|
}
|
|
135
|
-
function
|
|
136
|
-
return new Promise((e) => setTimeout(() => e(),
|
|
132
|
+
function fe(r) {
|
|
133
|
+
return new Promise((e) => setTimeout(() => e(), r));
|
|
137
134
|
}
|
|
138
|
-
function
|
|
139
|
-
return new Promise((
|
|
140
|
-
|
|
135
|
+
function ge(r, e) {
|
|
136
|
+
return new Promise((t) => {
|
|
137
|
+
r.addEventListener(e, (s) => t(s), !1);
|
|
141
138
|
});
|
|
142
139
|
}
|
|
143
|
-
class
|
|
140
|
+
class ye extends EventTarget {
|
|
141
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
142
|
+
// @ts-ignore - Setter
|
|
143
|
+
#e;
|
|
144
|
+
hasEventSender() {
|
|
145
|
+
return !!this.#e;
|
|
146
|
+
}
|
|
147
|
+
set eventSender(e) {
|
|
148
|
+
this.#e = e;
|
|
149
|
+
}
|
|
150
|
+
get eventSender() {
|
|
151
|
+
return this.#e;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
class we extends EventTarget {
|
|
144
155
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
145
156
|
// @ts-ignore - Setter
|
|
146
157
|
#e;
|
|
147
158
|
async dispatchAuthorized() {
|
|
148
159
|
const e = await this.#e.getCredentials();
|
|
149
|
-
e?.token
|
|
160
|
+
e?.token ? this.dispatchEvent(
|
|
150
161
|
new CustomEvent("authorized", {
|
|
151
162
|
detail: {
|
|
152
163
|
credentials: e
|
|
153
164
|
}
|
|
154
165
|
})
|
|
166
|
+
) : this.dispatchEvent(
|
|
167
|
+
new CustomEvent("unauthenticated", { detail: { credentials: e } })
|
|
155
168
|
);
|
|
156
169
|
}
|
|
157
170
|
set credentialsProvider(e) {
|
|
158
|
-
this.#e = e, this.dispatchAuthorized().catch(console.error), this.#e.bus((
|
|
159
|
-
switch (
|
|
160
|
-
case "
|
|
171
|
+
this.#e = e, this.dispatchAuthorized().catch(console.error), this.#e.bus((t) => {
|
|
172
|
+
switch (t.detail.type) {
|
|
173
|
+
case "CredentialsUpdatedMessage":
|
|
161
174
|
this.dispatchAuthorized().catch(console.error);
|
|
162
175
|
break;
|
|
163
176
|
default:
|
|
164
|
-
console.warn("Unhandled event from credentials provider: ",
|
|
177
|
+
console.warn("Unhandled event from credentials provider: ", t);
|
|
165
178
|
break;
|
|
166
179
|
}
|
|
167
180
|
});
|
|
@@ -170,12 +183,12 @@ class Ae extends EventTarget {
|
|
|
170
183
|
return this.#e;
|
|
171
184
|
}
|
|
172
185
|
}
|
|
173
|
-
class
|
|
186
|
+
class C extends Error {
|
|
174
187
|
errorCode = null;
|
|
175
188
|
errorId = null;
|
|
176
189
|
referenceId;
|
|
177
|
-
constructor(e,
|
|
178
|
-
super(`${e}: ${
|
|
190
|
+
constructor(e, t, s) {
|
|
191
|
+
super(`${e}: ${t} (${s})`), this.errorId = e, this.errorCode = t, this.referenceId = s;
|
|
179
192
|
}
|
|
180
193
|
toJSON() {
|
|
181
194
|
return {
|
|
@@ -188,40 +201,48 @@ class W extends Error {
|
|
|
188
201
|
return JSON.stringify(this.toJSON());
|
|
189
202
|
}
|
|
190
203
|
}
|
|
191
|
-
async function
|
|
204
|
+
async function P() {
|
|
192
205
|
if (v.credentialsProvider) {
|
|
193
|
-
const
|
|
194
|
-
return !!(
|
|
206
|
+
const r = await v.credentialsProvider.getCredentials();
|
|
207
|
+
return !!(r.token && r.userId);
|
|
195
208
|
}
|
|
196
|
-
return await
|
|
209
|
+
return await ge(v, "authorized"), P();
|
|
197
210
|
}
|
|
198
|
-
const v = new
|
|
199
|
-
async function
|
|
200
|
-
const
|
|
201
|
-
const { Pushkin:
|
|
202
|
-
return
|
|
203
|
-
}
|
|
204
|
-
if (
|
|
205
|
-
|
|
211
|
+
const v = new we(), D = new ye();
|
|
212
|
+
async function be() {
|
|
213
|
+
const r = await P(), e = async () => {
|
|
214
|
+
const { Pushkin: t } = await Promise.resolve().then(() => gt);
|
|
215
|
+
return t.refresh();
|
|
216
|
+
};
|
|
217
|
+
if (r) {
|
|
218
|
+
B({
|
|
206
219
|
gatherEvents: !0
|
|
207
220
|
});
|
|
208
221
|
try {
|
|
209
|
-
await Promise.all([e()
|
|
210
|
-
} catch (
|
|
211
|
-
console.error(
|
|
222
|
+
await Promise.all([e()]);
|
|
223
|
+
} catch (t) {
|
|
224
|
+
console.error(t);
|
|
212
225
|
}
|
|
213
226
|
} else
|
|
214
|
-
|
|
227
|
+
B({
|
|
215
228
|
gatherEvents: !1
|
|
216
229
|
});
|
|
217
230
|
}
|
|
231
|
+
function ve() {
|
|
232
|
+
B({
|
|
233
|
+
gatherEvents: !0
|
|
234
|
+
});
|
|
235
|
+
}
|
|
218
236
|
v.addEventListener("authorized", () => {
|
|
219
|
-
|
|
237
|
+
be().then().catch(console.error);
|
|
238
|
+
});
|
|
239
|
+
v.addEventListener("unauthenticated", () => {
|
|
240
|
+
ve();
|
|
220
241
|
});
|
|
221
|
-
async function
|
|
242
|
+
async function V() {
|
|
222
243
|
return v.credentialsProvider ? (await v.credentialsProvider.getCredentials()).token ?? null : null;
|
|
223
244
|
}
|
|
224
|
-
class
|
|
245
|
+
class Se extends EventTarget {
|
|
225
246
|
dispatchError(e) {
|
|
226
247
|
this.dispatchEvent(
|
|
227
248
|
new CustomEvent("error", {
|
|
@@ -230,35 +251,36 @@ class _e extends EventTarget {
|
|
|
230
251
|
);
|
|
231
252
|
}
|
|
232
253
|
}
|
|
233
|
-
const
|
|
234
|
-
class
|
|
254
|
+
const m = new Se();
|
|
255
|
+
class Me {
|
|
235
256
|
#e = /* @__PURE__ */ new Map();
|
|
236
257
|
#r = /* @__PURE__ */ new Map();
|
|
237
258
|
#s = /* @__PURE__ */ new Map();
|
|
259
|
+
#t = /* @__PURE__ */ new Map();
|
|
238
260
|
/**
|
|
239
261
|
* Clones a session to re-use the media product and playback content for a new session.
|
|
240
262
|
*
|
|
241
263
|
* @param from - streamingSessionId to clone
|
|
242
264
|
* @param to - target streamingSessionId
|
|
243
265
|
*/
|
|
244
|
-
clone(e,
|
|
266
|
+
clone(e, t) {
|
|
245
267
|
const s = this.getMediaProductTransition(e), n = this.getStreamInfo(e), o = this.getPlaybackInfo(e);
|
|
246
268
|
if (!s || !n || !o)
|
|
247
269
|
throw new Error(
|
|
248
270
|
`Cannot clone ${e}. Missing mediaProductTransition or streamInfo.`
|
|
249
271
|
);
|
|
250
|
-
this.saveMediaProductTransition(
|
|
272
|
+
this.saveMediaProductTransition(t, {
|
|
251
273
|
...s,
|
|
252
274
|
playbackContext: {
|
|
253
275
|
...s.playbackContext,
|
|
254
|
-
playbackSessionId:
|
|
276
|
+
playbackSessionId: t
|
|
255
277
|
}
|
|
256
|
-
}), this.saveStreamInfo(
|
|
278
|
+
}), this.saveStreamInfo(t, {
|
|
257
279
|
...n,
|
|
258
|
-
streamingSessionId:
|
|
259
|
-
}), this.savePlaybackInfo(
|
|
280
|
+
streamingSessionId: t
|
|
281
|
+
}), this.savePlaybackInfo(t, {
|
|
260
282
|
...o,
|
|
261
|
-
streamingSessionId:
|
|
283
|
+
streamingSessionId: t
|
|
262
284
|
});
|
|
263
285
|
}
|
|
264
286
|
deleteMediaProductTransition(e) {
|
|
@@ -271,11 +293,14 @@ class Ne {
|
|
|
271
293
|
* @see {@link StreamingSessionStore.clone}
|
|
272
294
|
*/
|
|
273
295
|
deleteSession(e) {
|
|
274
|
-
this.deleteMediaProductTransition(e), this.#r.delete(e), this.deleteStreamInfo(e);
|
|
296
|
+
this.deleteMediaProductTransition(e), this.#r.delete(e), this.#s.delete(e), this.deleteStreamInfo(e);
|
|
275
297
|
}
|
|
276
|
-
|
|
298
|
+
deleteStartedStreamInfo(e) {
|
|
277
299
|
this.#s.delete(e);
|
|
278
300
|
}
|
|
301
|
+
deleteStreamInfo(e) {
|
|
302
|
+
this.#t.delete(e);
|
|
303
|
+
}
|
|
279
304
|
getMediaProductTransition(e) {
|
|
280
305
|
return e ? this.#e.get(e) : void 0;
|
|
281
306
|
}
|
|
@@ -283,7 +308,7 @@ class Ne {
|
|
|
283
308
|
return e ? this.#r.get(e) : void 0;
|
|
284
309
|
}
|
|
285
310
|
getStreamInfo(e) {
|
|
286
|
-
return e ? this.#
|
|
311
|
+
return e ? this.#t.get(e) : void 0;
|
|
287
312
|
}
|
|
288
313
|
hasMediaProductTransition(e) {
|
|
289
314
|
return this.#e.has(e);
|
|
@@ -291,32 +316,41 @@ class Ne {
|
|
|
291
316
|
hasPlaybackInfo(e) {
|
|
292
317
|
return this.#r.has(e);
|
|
293
318
|
}
|
|
294
|
-
|
|
319
|
+
hasStartedStreamInfo(e) {
|
|
295
320
|
return this.#s.has(e);
|
|
296
321
|
}
|
|
297
|
-
|
|
322
|
+
hasStreamInfo(e) {
|
|
323
|
+
return this.#t.has(e);
|
|
324
|
+
}
|
|
325
|
+
overwriteDuration(e, t) {
|
|
298
326
|
const s = this.#e.get(e);
|
|
299
|
-
s && (s.playbackContext
|
|
327
|
+
s && (s.playbackContext = {
|
|
328
|
+
...s.playbackContext,
|
|
329
|
+
actualDuration: t
|
|
330
|
+
}, this.saveMediaProductTransition(e, s));
|
|
300
331
|
}
|
|
301
|
-
saveMediaProductTransition(e,
|
|
332
|
+
saveMediaProductTransition(e, t) {
|
|
302
333
|
this.#e.set(
|
|
303
334
|
e,
|
|
304
|
-
|
|
335
|
+
t
|
|
305
336
|
);
|
|
306
337
|
}
|
|
307
|
-
savePlaybackInfo(e,
|
|
308
|
-
this.#r.set(e,
|
|
338
|
+
savePlaybackInfo(e, t) {
|
|
339
|
+
this.#r.set(e, t);
|
|
340
|
+
}
|
|
341
|
+
saveStreamInfo(e, t) {
|
|
342
|
+
this.#t.set(e, t);
|
|
309
343
|
}
|
|
310
|
-
|
|
311
|
-
this.#s.set(e,
|
|
344
|
+
setStartedStreamInfo(e) {
|
|
345
|
+
return this.#s.set(e, !0);
|
|
312
346
|
}
|
|
313
347
|
}
|
|
314
|
-
const
|
|
315
|
-
class
|
|
348
|
+
const H = new Me();
|
|
349
|
+
class Ee {
|
|
316
350
|
activePlayer;
|
|
317
351
|
preloadPlayer;
|
|
318
352
|
get preloadedMediaProduct() {
|
|
319
|
-
return
|
|
353
|
+
return H.getMediaProductTransition(
|
|
320
354
|
this.preloadedStreamingSessionId
|
|
321
355
|
)?.mediaProduct ?? void 0;
|
|
322
356
|
}
|
|
@@ -324,193 +358,221 @@ class Fe {
|
|
|
324
358
|
return this.preloadPlayer?.preloadedStreamingSessionId ?? void 0;
|
|
325
359
|
}
|
|
326
360
|
}
|
|
327
|
-
const p = new
|
|
328
|
-
let
|
|
329
|
-
const
|
|
361
|
+
const p = new Ee();
|
|
362
|
+
let ke;
|
|
363
|
+
const Pe = [
|
|
330
364
|
{
|
|
331
|
-
itemTypes: ["track", "video"],
|
|
365
|
+
itemTypes: ["track", "video", "demo"],
|
|
332
366
|
player: "shaka",
|
|
333
367
|
qualities: ["HIGH", "LOSSLESS", "LOW", "HI_RES_LOSSLESS"]
|
|
334
368
|
}
|
|
335
369
|
];
|
|
336
|
-
let
|
|
370
|
+
let x = Pe;
|
|
337
371
|
const w = {
|
|
338
372
|
browser: void 0,
|
|
339
373
|
native: void 0,
|
|
340
374
|
shaka: void 0
|
|
341
375
|
};
|
|
342
|
-
async function
|
|
376
|
+
async function Te() {
|
|
343
377
|
await Promise.all(
|
|
344
|
-
|
|
345
|
-
const e = w[
|
|
378
|
+
x.map((r) => {
|
|
379
|
+
const e = w[r.player];
|
|
346
380
|
return e ? e.reset() : Promise.resolve();
|
|
347
381
|
})
|
|
348
382
|
), p.activePlayer = void 0, p.preloadPlayer = void 0;
|
|
349
383
|
}
|
|
350
|
-
function
|
|
351
|
-
|
|
384
|
+
function Ie(r) {
|
|
385
|
+
r.name !== "nativePlayer" && w.native && w.native.abandon(), p.activePlayer = r;
|
|
352
386
|
}
|
|
353
|
-
function
|
|
354
|
-
|
|
387
|
+
function Le() {
|
|
388
|
+
m.removeEventListener("ended", ke);
|
|
355
389
|
}
|
|
356
|
-
async function
|
|
357
|
-
const { default:
|
|
358
|
-
return w.native || (w.native = new
|
|
390
|
+
async function Ae() {
|
|
391
|
+
const { default: r } = await import("./nativePlayer-B3eHKegV-DdXsvi0F.js");
|
|
392
|
+
return w.native || (w.native = new r()), w.native;
|
|
359
393
|
}
|
|
360
|
-
async function
|
|
361
|
-
const { default:
|
|
362
|
-
return w.browser || (w.browser = new
|
|
394
|
+
async function Oe() {
|
|
395
|
+
const { default: r } = await import("./browserPlayer-HE2uqs17-DJrIq6Jp.js");
|
|
396
|
+
return w.browser || (w.browser = new r()), w.browser;
|
|
363
397
|
}
|
|
364
|
-
async function
|
|
365
|
-
const { default:
|
|
366
|
-
return w.shaka || (w.shaka = new
|
|
398
|
+
async function Ce() {
|
|
399
|
+
const { default: r } = await import("./shakaPlayer-CCJQsypf-DHT2kwDp.js");
|
|
400
|
+
return w.shaka || (w.shaka = new r()), w.shaka;
|
|
367
401
|
}
|
|
368
|
-
async function
|
|
369
|
-
const
|
|
370
|
-
(n) =>
|
|
402
|
+
async function _e(r, e) {
|
|
403
|
+
const t = x.filter((n) => n.itemTypes.includes(r)).filter(
|
|
404
|
+
(n) => r === "track" && n.qualities && e ? n.qualities.includes(e) : !0
|
|
371
405
|
);
|
|
372
|
-
|
|
406
|
+
t.length === 0 && console.error(
|
|
373
407
|
`No player found to handle audio quality "${String(
|
|
374
408
|
e
|
|
375
|
-
)}" for product type "${
|
|
376
|
-
|
|
409
|
+
)}" for product type "${r}" in player config: `,
|
|
410
|
+
x
|
|
377
411
|
);
|
|
378
|
-
const { player: s } =
|
|
412
|
+
const { player: s } = t[0];
|
|
379
413
|
switch (s) {
|
|
380
|
-
case "shaka":
|
|
381
|
-
return Ve();
|
|
382
414
|
case "browser":
|
|
383
|
-
return
|
|
415
|
+
return Oe();
|
|
384
416
|
case "native":
|
|
385
|
-
return
|
|
417
|
+
return Ae();
|
|
418
|
+
case "shaka":
|
|
419
|
+
return Ce();
|
|
386
420
|
default:
|
|
387
421
|
throw new Error("No player found.");
|
|
388
422
|
}
|
|
389
423
|
}
|
|
390
|
-
function
|
|
424
|
+
function Fe() {
|
|
391
425
|
return p.activePlayer?.getPosition() ?? 0;
|
|
392
426
|
}
|
|
393
|
-
function
|
|
427
|
+
function Ne() {
|
|
394
428
|
return p.activePlayer?.currentMediaProduct ?? null;
|
|
395
429
|
}
|
|
396
|
-
function
|
|
397
|
-
const
|
|
398
|
-
if (
|
|
399
|
-
const e =
|
|
400
|
-
|
|
430
|
+
function Be() {
|
|
431
|
+
const r = p.activePlayer;
|
|
432
|
+
if (r) {
|
|
433
|
+
const e = H.getMediaProductTransition(
|
|
434
|
+
r.currentStreamingSessionId
|
|
401
435
|
);
|
|
402
436
|
if (e)
|
|
403
437
|
return e.playbackContext;
|
|
404
438
|
}
|
|
405
439
|
}
|
|
406
|
-
function
|
|
440
|
+
function Q() {
|
|
407
441
|
return p.activePlayer?.playbackState ?? "IDLE";
|
|
408
442
|
}
|
|
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);
|
|
443
|
+
class xe {
|
|
444
|
+
#e;
|
|
445
|
+
constructor() {
|
|
446
|
+
this.#e = /* @__PURE__ */ new Map();
|
|
438
447
|
}
|
|
439
|
-
|
|
440
|
-
const
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
448
|
+
async #r(e, t) {
|
|
449
|
+
const s = new TextEncoder().encode(
|
|
450
|
+
`${e}-${t}`
|
|
451
|
+
), n = await crypto.subtle.digest("SHA-1", s);
|
|
452
|
+
return Array.from(new Uint8Array(n)).map((o) => o.toString(16).padStart(2, "0")).join("");
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Delete a logged event by name and streamingSessionId.
|
|
456
|
+
*/
|
|
457
|
+
async delete({
|
|
458
|
+
name: e,
|
|
459
|
+
streamingSessionId: t
|
|
460
|
+
}) {
|
|
461
|
+
const s = await this.#r(
|
|
462
|
+
t,
|
|
463
|
+
e
|
|
464
|
+
);
|
|
465
|
+
this.#e.delete(s);
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Get a logged event by name and streamingSessionId.
|
|
469
|
+
*/
|
|
470
|
+
async get({
|
|
471
|
+
name: e,
|
|
472
|
+
streamingSessionId: t
|
|
473
|
+
}) {
|
|
474
|
+
const s = await this.#r(
|
|
475
|
+
t,
|
|
476
|
+
e
|
|
477
|
+
);
|
|
478
|
+
return this.#e.get(s);
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Adds or updates an event.
|
|
482
|
+
*/
|
|
483
|
+
async put(e) {
|
|
484
|
+
const t = await this.#r(
|
|
485
|
+
e.streamingSessionId,
|
|
486
|
+
e.name
|
|
487
|
+
);
|
|
488
|
+
this.#e.set(t, e);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
const R = new xe();
|
|
492
|
+
async function T(r, e) {
|
|
493
|
+
return _("gatherEvents") ? async (t) => {
|
|
452
494
|
try {
|
|
453
|
-
await
|
|
454
|
-
|
|
455
|
-
|
|
495
|
+
const s = await R.get({
|
|
496
|
+
name: r,
|
|
497
|
+
streamingSessionId: t.streamingSessionId
|
|
498
|
+
}), n = Object.assign(
|
|
499
|
+
{},
|
|
500
|
+
e,
|
|
501
|
+
s ? s.payload : {},
|
|
502
|
+
t
|
|
503
|
+
);
|
|
504
|
+
for (const o of Object.keys(t)) {
|
|
505
|
+
const a = o;
|
|
506
|
+
Array.isArray(t[a]) && (n[a] = [
|
|
507
|
+
...e[a] || [],
|
|
508
|
+
...s && s.payload[a] || [],
|
|
509
|
+
...t[a] || []
|
|
510
|
+
]);
|
|
511
|
+
}
|
|
512
|
+
return await R.put({
|
|
513
|
+
name: r,
|
|
514
|
+
payload: n,
|
|
515
|
+
streamingSessionId: t.streamingSessionId
|
|
516
|
+
}), {
|
|
517
|
+
name: r,
|
|
518
|
+
payload: n,
|
|
519
|
+
streamingSessionId: t.streamingSessionId
|
|
520
|
+
};
|
|
521
|
+
} catch (s) {
|
|
522
|
+
console.error(s);
|
|
456
523
|
}
|
|
457
|
-
|
|
458
|
-
name: t,
|
|
459
|
-
payload: a
|
|
460
|
-
};
|
|
461
|
-
};
|
|
524
|
+
} : (t) => Promise.resolve(void 0);
|
|
462
525
|
}
|
|
463
|
-
const
|
|
526
|
+
const Re = {
|
|
464
527
|
endReason: "COMPLETE",
|
|
465
528
|
endTimestamp: 0,
|
|
466
529
|
errorCode: null,
|
|
467
530
|
errorMessage: null,
|
|
468
531
|
startTimestamp: 0,
|
|
469
532
|
streamingSessionId: ""
|
|
470
|
-
},
|
|
533
|
+
}, De = await T(
|
|
471
534
|
"drm_license_fetch",
|
|
472
|
-
|
|
535
|
+
Re
|
|
473
536
|
);
|
|
474
|
-
function
|
|
475
|
-
return
|
|
537
|
+
function Dt(r) {
|
|
538
|
+
return De(r);
|
|
476
539
|
}
|
|
477
|
-
const
|
|
540
|
+
const He = {
|
|
478
541
|
endReason: "COMPLETE",
|
|
479
542
|
endTimestamp: 0,
|
|
480
543
|
errorCode: null,
|
|
481
544
|
errorMessage: null,
|
|
482
545
|
startTimestamp: 0,
|
|
483
546
|
streamingSessionId: ""
|
|
484
|
-
},
|
|
547
|
+
}, Ue = await T(
|
|
485
548
|
"playback_info_fetch",
|
|
486
|
-
|
|
549
|
+
He
|
|
487
550
|
);
|
|
488
|
-
function
|
|
489
|
-
return
|
|
551
|
+
function N(r) {
|
|
552
|
+
return Ue(r);
|
|
490
553
|
}
|
|
491
|
-
function
|
|
492
|
-
switch (
|
|
554
|
+
function Ht(r) {
|
|
555
|
+
switch (r) {
|
|
493
556
|
case "bluetooth":
|
|
494
557
|
return "BLUETOOTH";
|
|
495
|
-
case "displayPort":
|
|
496
|
-
return "DISPLAY_PORT";
|
|
497
|
-
case "mqa":
|
|
498
|
-
return "MQA";
|
|
499
558
|
case "builtIn":
|
|
500
559
|
return "BUILT_IN";
|
|
560
|
+
case "displayPort":
|
|
561
|
+
return "DISPLAY_PORT";
|
|
501
562
|
case "hdmi":
|
|
502
563
|
return "HDMI";
|
|
503
|
-
case "usb":
|
|
504
|
-
return "USB";
|
|
505
564
|
case "systemDefault":
|
|
506
565
|
return "SYSTEM_DEFAULT";
|
|
507
|
-
case "
|
|
566
|
+
case "usb":
|
|
567
|
+
return "USB";
|
|
568
|
+
// Never happens (cannot be chose by user)
|
|
508
569
|
case "airplay":
|
|
570
|
+
case "windowsCommunication":
|
|
509
571
|
default:
|
|
510
572
|
return;
|
|
511
573
|
}
|
|
512
574
|
}
|
|
513
|
-
const
|
|
575
|
+
const Ve = {
|
|
514
576
|
actualAssetPresentation: "FULL",
|
|
515
577
|
actualAudioMode: "STEREO",
|
|
516
578
|
actualProductId: null,
|
|
@@ -530,24 +592,24 @@ const Xe = {
|
|
|
530
592
|
productType: "TRACK",
|
|
531
593
|
stalls: [],
|
|
532
594
|
streamingSessionId: ""
|
|
533
|
-
},
|
|
595
|
+
}, ze = await T(
|
|
534
596
|
"playback_statistics",
|
|
535
|
-
|
|
597
|
+
Ve
|
|
536
598
|
);
|
|
537
|
-
function
|
|
538
|
-
return
|
|
599
|
+
function z(r) {
|
|
600
|
+
return ze(r);
|
|
539
601
|
}
|
|
540
|
-
const
|
|
602
|
+
const We = {
|
|
541
603
|
streamingSessionId: "",
|
|
542
604
|
timestamp: 0
|
|
543
|
-
},
|
|
605
|
+
}, $e = await T(
|
|
544
606
|
"streaming_session_end",
|
|
545
|
-
|
|
607
|
+
We
|
|
546
608
|
);
|
|
547
|
-
function
|
|
548
|
-
return
|
|
609
|
+
function Qe(r) {
|
|
610
|
+
return $e(r);
|
|
549
611
|
}
|
|
550
|
-
const
|
|
612
|
+
const Ge = {
|
|
551
613
|
"Amazon Silk": "amazon_silk",
|
|
552
614
|
"Android Browser": "android",
|
|
553
615
|
Bada: "bada",
|
|
@@ -569,6 +631,7 @@ const st = {
|
|
|
569
631
|
"NAVER Whale Browser": "naver",
|
|
570
632
|
Opera: "opera",
|
|
571
633
|
"Opera Coast": "opera_coast",
|
|
634
|
+
"Pale Moon": "pale_moon",
|
|
572
635
|
PhantomJS: "phantomjs",
|
|
573
636
|
Puffin: "puffin",
|
|
574
637
|
QupZilla: "qupzilla",
|
|
@@ -587,7 +650,7 @@ const st = {
|
|
|
587
650
|
WeChat: "wechat",
|
|
588
651
|
"Yandex Browser": "yandex",
|
|
589
652
|
Roku: "roku"
|
|
590
|
-
},
|
|
653
|
+
}, G = {
|
|
591
654
|
amazon_silk: "Amazon Silk",
|
|
592
655
|
android: "Android Browser",
|
|
593
656
|
bada: "Bada",
|
|
@@ -609,6 +672,7 @@ const st = {
|
|
|
609
672
|
naver: "NAVER Whale Browser",
|
|
610
673
|
opera: "Opera",
|
|
611
674
|
opera_coast: "Opera Coast",
|
|
675
|
+
pale_moon: "Pale Moon",
|
|
612
676
|
phantomjs: "PhantomJS",
|
|
613
677
|
puffin: "Puffin",
|
|
614
678
|
qupzilla: "QupZilla",
|
|
@@ -626,11 +690,12 @@ const st = {
|
|
|
626
690
|
webos: "WebOS Browser",
|
|
627
691
|
wechat: "WeChat",
|
|
628
692
|
yandex: "Yandex Browser"
|
|
629
|
-
},
|
|
693
|
+
}, h = {
|
|
630
694
|
tablet: "tablet",
|
|
631
695
|
mobile: "mobile",
|
|
632
696
|
desktop: "desktop",
|
|
633
|
-
tv: "tv"
|
|
697
|
+
tv: "tv",
|
|
698
|
+
bot: "bot"
|
|
634
699
|
}, g = {
|
|
635
700
|
WindowsPhone: "Windows Phone",
|
|
636
701
|
Windows: "Windows",
|
|
@@ -660,8 +725,8 @@ class i {
|
|
|
660
725
|
* @param {String} ua
|
|
661
726
|
* @return {Array|{index: number, input: string}|*|boolean|string}
|
|
662
727
|
*/
|
|
663
|
-
static getFirstMatch(e,
|
|
664
|
-
const s =
|
|
728
|
+
static getFirstMatch(e, t) {
|
|
729
|
+
const s = t.match(e);
|
|
665
730
|
return s && s.length > 0 && s[1] || "";
|
|
666
731
|
}
|
|
667
732
|
/**
|
|
@@ -670,8 +735,8 @@ class i {
|
|
|
670
735
|
* @param {String} ua
|
|
671
736
|
* @return {Array|{index: number, input: string}|*|boolean|string}
|
|
672
737
|
*/
|
|
673
|
-
static getSecondMatch(e,
|
|
674
|
-
const s =
|
|
738
|
+
static getSecondMatch(e, t) {
|
|
739
|
+
const s = t.match(e);
|
|
675
740
|
return s && s.length > 1 && s[2] || "";
|
|
676
741
|
}
|
|
677
742
|
/**
|
|
@@ -681,8 +746,8 @@ class i {
|
|
|
681
746
|
* @param {*} _const Any const that will be returned if regexp matches the string
|
|
682
747
|
* @return {*}
|
|
683
748
|
*/
|
|
684
|
-
static matchAndReturnConst(e,
|
|
685
|
-
if (e.test(
|
|
749
|
+
static matchAndReturnConst(e, t, s) {
|
|
750
|
+
if (e.test(t))
|
|
686
751
|
return s;
|
|
687
752
|
}
|
|
688
753
|
static getWindowsVersionName(e) {
|
|
@@ -732,9 +797,9 @@ class i {
|
|
|
732
797
|
* @return {string} versionName
|
|
733
798
|
*/
|
|
734
799
|
static getMacOSVersionName(e) {
|
|
735
|
-
const
|
|
736
|
-
if (
|
|
737
|
-
switch (
|
|
800
|
+
const t = e.split(".").splice(0, 2).map((s) => parseInt(s, 10) || 0);
|
|
801
|
+
if (t.push(0), t[0] === 10)
|
|
802
|
+
switch (t[1]) {
|
|
738
803
|
case 5:
|
|
739
804
|
return "Leopard";
|
|
740
805
|
case 6:
|
|
@@ -786,36 +851,22 @@ class i {
|
|
|
786
851
|
* @return {string} versionName
|
|
787
852
|
*/
|
|
788
853
|
static getAndroidVersionName(e) {
|
|
789
|
-
const
|
|
790
|
-
if (
|
|
791
|
-
if (
|
|
792
|
-
|
|
793
|
-
if (
|
|
794
|
-
|
|
795
|
-
if (
|
|
796
|
-
|
|
797
|
-
if (
|
|
798
|
-
|
|
799
|
-
if (
|
|
800
|
-
|
|
801
|
-
if (
|
|
802
|
-
|
|
803
|
-
if (
|
|
804
|
-
|
|
805
|
-
if (r[0] === 4 && r[1] < 4)
|
|
806
|
-
return "Jelly Bean";
|
|
807
|
-
if (r[0] === 4 && r[1] >= 4)
|
|
808
|
-
return "KitKat";
|
|
809
|
-
if (r[0] === 5)
|
|
810
|
-
return "Lollipop";
|
|
811
|
-
if (r[0] === 6)
|
|
812
|
-
return "Marshmallow";
|
|
813
|
-
if (r[0] === 7)
|
|
814
|
-
return "Nougat";
|
|
815
|
-
if (r[0] === 8)
|
|
816
|
-
return "Oreo";
|
|
817
|
-
if (r[0] === 9)
|
|
818
|
-
return "Pie";
|
|
854
|
+
const t = e.split(".").splice(0, 2).map((s) => parseInt(s, 10) || 0);
|
|
855
|
+
if (t.push(0), !(t[0] === 1 && t[1] < 5)) {
|
|
856
|
+
if (t[0] === 1 && t[1] < 6) return "Cupcake";
|
|
857
|
+
if (t[0] === 1 && t[1] >= 6) return "Donut";
|
|
858
|
+
if (t[0] === 2 && t[1] < 2) return "Eclair";
|
|
859
|
+
if (t[0] === 2 && t[1] === 2) return "Froyo";
|
|
860
|
+
if (t[0] === 2 && t[1] > 2) return "Gingerbread";
|
|
861
|
+
if (t[0] === 3) return "Honeycomb";
|
|
862
|
+
if (t[0] === 4 && t[1] < 1) return "Ice Cream Sandwich";
|
|
863
|
+
if (t[0] === 4 && t[1] < 4) return "Jelly Bean";
|
|
864
|
+
if (t[0] === 4 && t[1] >= 4) return "KitKat";
|
|
865
|
+
if (t[0] === 5) return "Lollipop";
|
|
866
|
+
if (t[0] === 6) return "Marshmallow";
|
|
867
|
+
if (t[0] === 7) return "Nougat";
|
|
868
|
+
if (t[0] === 8) return "Oreo";
|
|
869
|
+
if (t[0] === 9) return "Pie";
|
|
819
870
|
}
|
|
820
871
|
}
|
|
821
872
|
/**
|
|
@@ -847,21 +898,21 @@ class i {
|
|
|
847
898
|
* 1 when versionA is bigger, 0 when both equal
|
|
848
899
|
*/
|
|
849
900
|
/* eslint consistent-return: 1 */
|
|
850
|
-
static compareVersions(e,
|
|
851
|
-
const n = i.getVersionPrecision(e), o = i.getVersionPrecision(
|
|
901
|
+
static compareVersions(e, t, s = !1) {
|
|
902
|
+
const n = i.getVersionPrecision(e), o = i.getVersionPrecision(t);
|
|
852
903
|
let a = Math.max(n, o), c = 0;
|
|
853
|
-
const
|
|
854
|
-
const
|
|
904
|
+
const u = i.map([e, t], (d) => {
|
|
905
|
+
const b = a - i.getVersionPrecision(d), M = d + new Array(b + 1).join(".0");
|
|
855
906
|
return i.map(M.split("."), (f) => new Array(20 - f.length).join("0") + f).reverse();
|
|
856
907
|
});
|
|
857
908
|
for (s && (c = a - Math.min(n, o)), a -= 1; a >= c; ) {
|
|
858
|
-
if (
|
|
909
|
+
if (u[0][a] > u[1][a])
|
|
859
910
|
return 1;
|
|
860
|
-
if (
|
|
911
|
+
if (u[0][a] === u[1][a]) {
|
|
861
912
|
if (a === c)
|
|
862
913
|
return 0;
|
|
863
914
|
a -= 1;
|
|
864
|
-
} else if (
|
|
915
|
+
} else if (u[0][a] < u[1][a])
|
|
865
916
|
return -1;
|
|
866
917
|
}
|
|
867
918
|
}
|
|
@@ -872,13 +923,13 @@ class i {
|
|
|
872
923
|
* @param {Function} iterator
|
|
873
924
|
* @return {Array}
|
|
874
925
|
*/
|
|
875
|
-
static map(e,
|
|
926
|
+
static map(e, t) {
|
|
876
927
|
const s = [];
|
|
877
928
|
let n;
|
|
878
929
|
if (Array.prototype.map)
|
|
879
|
-
return Array.prototype.map.call(e,
|
|
930
|
+
return Array.prototype.map.call(e, t);
|
|
880
931
|
for (n = 0; n < e.length; n += 1)
|
|
881
|
-
s.push(
|
|
932
|
+
s.push(t(e[n]));
|
|
882
933
|
return s;
|
|
883
934
|
}
|
|
884
935
|
/**
|
|
@@ -888,13 +939,13 @@ class i {
|
|
|
888
939
|
* @param {Function} predicate
|
|
889
940
|
* @return {Array}
|
|
890
941
|
*/
|
|
891
|
-
static find(e,
|
|
942
|
+
static find(e, t) {
|
|
892
943
|
let s, n;
|
|
893
944
|
if (Array.prototype.find)
|
|
894
|
-
return Array.prototype.find.call(e,
|
|
945
|
+
return Array.prototype.find.call(e, t);
|
|
895
946
|
for (s = 0, n = e.length; s < n; s += 1) {
|
|
896
947
|
const o = e[s];
|
|
897
|
-
if (
|
|
948
|
+
if (t(o, s))
|
|
898
949
|
return o;
|
|
899
950
|
}
|
|
900
951
|
}
|
|
@@ -905,13 +956,13 @@ class i {
|
|
|
905
956
|
* @param {Object} ...objs
|
|
906
957
|
* @return {Object}
|
|
907
958
|
*/
|
|
908
|
-
static assign(e, ...
|
|
959
|
+
static assign(e, ...t) {
|
|
909
960
|
const s = e;
|
|
910
961
|
let n, o;
|
|
911
962
|
if (Object.assign)
|
|
912
|
-
return Object.assign(e, ...
|
|
913
|
-
for (n = 0, o =
|
|
914
|
-
const a =
|
|
963
|
+
return Object.assign(e, ...t);
|
|
964
|
+
for (n = 0, o = t.length; n < o; n += 1) {
|
|
965
|
+
const a = t[n];
|
|
915
966
|
typeof a == "object" && a !== null && Object.keys(a).forEach((c) => {
|
|
916
967
|
s[c] = a[c];
|
|
917
968
|
});
|
|
@@ -928,426 +979,435 @@ class i {
|
|
|
928
979
|
* @return {string}
|
|
929
980
|
*/
|
|
930
981
|
static getBrowserAlias(e) {
|
|
931
|
-
return
|
|
982
|
+
return Ge[e];
|
|
932
983
|
}
|
|
933
984
|
/**
|
|
934
|
-
* Get
|
|
985
|
+
* Get browser name for a short version/alias
|
|
935
986
|
*
|
|
936
987
|
* @example
|
|
937
|
-
*
|
|
988
|
+
* getBrowserTypeByAlias('edge') // Microsoft Edge
|
|
938
989
|
*
|
|
939
990
|
* @param {string} browserAlias
|
|
940
991
|
* @return {string}
|
|
941
992
|
*/
|
|
942
993
|
static getBrowserTypeByAlias(e) {
|
|
943
|
-
return
|
|
994
|
+
return G[e] || "";
|
|
944
995
|
}
|
|
945
996
|
}
|
|
946
|
-
const
|
|
997
|
+
const l = /version\/(\d+(\.?_?\d+)+)/i, qe = [
|
|
947
998
|
/* Googlebot */
|
|
948
999
|
{
|
|
949
1000
|
test: [/googlebot/i],
|
|
950
|
-
describe(
|
|
1001
|
+
describe(r) {
|
|
951
1002
|
const e = {
|
|
952
1003
|
name: "Googlebot"
|
|
953
|
-
},
|
|
954
|
-
return
|
|
1004
|
+
}, t = i.getFirstMatch(/googlebot\/(\d+(\.\d+))/i, r) || i.getFirstMatch(l, r);
|
|
1005
|
+
return t && (e.version = t), e;
|
|
955
1006
|
}
|
|
956
1007
|
},
|
|
957
1008
|
/* Opera < 13.0 */
|
|
958
1009
|
{
|
|
959
1010
|
test: [/opera/i],
|
|
960
|
-
describe(
|
|
1011
|
+
describe(r) {
|
|
961
1012
|
const e = {
|
|
962
1013
|
name: "Opera"
|
|
963
|
-
},
|
|
964
|
-
return
|
|
1014
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1015
|
+
return t && (e.version = t), e;
|
|
965
1016
|
}
|
|
966
1017
|
},
|
|
967
1018
|
/* Opera > 13.0 */
|
|
968
1019
|
{
|
|
969
1020
|
test: [/opr\/|opios/i],
|
|
970
|
-
describe(
|
|
1021
|
+
describe(r) {
|
|
971
1022
|
const e = {
|
|
972
1023
|
name: "Opera"
|
|
973
|
-
},
|
|
974
|
-
return
|
|
1024
|
+
}, t = i.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, r) || i.getFirstMatch(l, r);
|
|
1025
|
+
return t && (e.version = t), e;
|
|
975
1026
|
}
|
|
976
1027
|
},
|
|
977
1028
|
{
|
|
978
1029
|
test: [/SamsungBrowser/i],
|
|
979
|
-
describe(
|
|
1030
|
+
describe(r) {
|
|
980
1031
|
const e = {
|
|
981
1032
|
name: "Samsung Internet for Android"
|
|
982
|
-
},
|
|
983
|
-
return
|
|
1033
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1034
|
+
return t && (e.version = t), e;
|
|
984
1035
|
}
|
|
985
1036
|
},
|
|
986
1037
|
{
|
|
987
1038
|
test: [/Whale/i],
|
|
988
|
-
describe(
|
|
1039
|
+
describe(r) {
|
|
989
1040
|
const e = {
|
|
990
1041
|
name: "NAVER Whale Browser"
|
|
991
|
-
},
|
|
992
|
-
return
|
|
1042
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, r);
|
|
1043
|
+
return t && (e.version = t), e;
|
|
1044
|
+
}
|
|
1045
|
+
},
|
|
1046
|
+
{
|
|
1047
|
+
test: [/PaleMoon/i],
|
|
1048
|
+
describe(r) {
|
|
1049
|
+
const e = {
|
|
1050
|
+
name: "Pale Moon"
|
|
1051
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i, r);
|
|
1052
|
+
return t && (e.version = t), e;
|
|
993
1053
|
}
|
|
994
1054
|
},
|
|
995
1055
|
{
|
|
996
1056
|
test: [/MZBrowser/i],
|
|
997
|
-
describe(
|
|
1057
|
+
describe(r) {
|
|
998
1058
|
const e = {
|
|
999
1059
|
name: "MZ Browser"
|
|
1000
|
-
},
|
|
1001
|
-
return
|
|
1060
|
+
}, t = i.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1061
|
+
return t && (e.version = t), e;
|
|
1002
1062
|
}
|
|
1003
1063
|
},
|
|
1004
1064
|
{
|
|
1005
1065
|
test: [/focus/i],
|
|
1006
|
-
describe(
|
|
1066
|
+
describe(r) {
|
|
1007
1067
|
const e = {
|
|
1008
1068
|
name: "Focus"
|
|
1009
|
-
},
|
|
1010
|
-
return
|
|
1069
|
+
}, t = i.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1070
|
+
return t && (e.version = t), e;
|
|
1011
1071
|
}
|
|
1012
1072
|
},
|
|
1013
1073
|
{
|
|
1014
1074
|
test: [/swing/i],
|
|
1015
|
-
describe(
|
|
1075
|
+
describe(r) {
|
|
1016
1076
|
const e = {
|
|
1017
1077
|
name: "Swing"
|
|
1018
|
-
},
|
|
1019
|
-
return
|
|
1078
|
+
}, t = i.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1079
|
+
return t && (e.version = t), e;
|
|
1020
1080
|
}
|
|
1021
1081
|
},
|
|
1022
1082
|
{
|
|
1023
1083
|
test: [/coast/i],
|
|
1024
|
-
describe(
|
|
1084
|
+
describe(r) {
|
|
1025
1085
|
const e = {
|
|
1026
1086
|
name: "Opera Coast"
|
|
1027
|
-
},
|
|
1028
|
-
return
|
|
1087
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1088
|
+
return t && (e.version = t), e;
|
|
1029
1089
|
}
|
|
1030
1090
|
},
|
|
1031
1091
|
{
|
|
1032
1092
|
test: [/opt\/\d+(?:.?_?\d+)+/i],
|
|
1033
|
-
describe(
|
|
1093
|
+
describe(r) {
|
|
1034
1094
|
const e = {
|
|
1035
1095
|
name: "Opera Touch"
|
|
1036
|
-
},
|
|
1037
|
-
return
|
|
1096
|
+
}, t = i.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1097
|
+
return t && (e.version = t), e;
|
|
1038
1098
|
}
|
|
1039
1099
|
},
|
|
1040
1100
|
{
|
|
1041
1101
|
test: [/yabrowser/i],
|
|
1042
|
-
describe(
|
|
1102
|
+
describe(r) {
|
|
1043
1103
|
const e = {
|
|
1044
1104
|
name: "Yandex Browser"
|
|
1045
|
-
},
|
|
1046
|
-
return
|
|
1105
|
+
}, t = i.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1106
|
+
return t && (e.version = t), e;
|
|
1047
1107
|
}
|
|
1048
1108
|
},
|
|
1049
1109
|
{
|
|
1050
1110
|
test: [/ucbrowser/i],
|
|
1051
|
-
describe(
|
|
1111
|
+
describe(r) {
|
|
1052
1112
|
const e = {
|
|
1053
1113
|
name: "UC Browser"
|
|
1054
|
-
},
|
|
1055
|
-
return
|
|
1114
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1115
|
+
return t && (e.version = t), e;
|
|
1056
1116
|
}
|
|
1057
1117
|
},
|
|
1058
1118
|
{
|
|
1059
1119
|
test: [/Maxthon|mxios/i],
|
|
1060
|
-
describe(
|
|
1120
|
+
describe(r) {
|
|
1061
1121
|
const e = {
|
|
1062
1122
|
name: "Maxthon"
|
|
1063
|
-
},
|
|
1064
|
-
return
|
|
1123
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1124
|
+
return t && (e.version = t), e;
|
|
1065
1125
|
}
|
|
1066
1126
|
},
|
|
1067
1127
|
{
|
|
1068
1128
|
test: [/epiphany/i],
|
|
1069
|
-
describe(
|
|
1129
|
+
describe(r) {
|
|
1070
1130
|
const e = {
|
|
1071
1131
|
name: "Epiphany"
|
|
1072
|
-
},
|
|
1073
|
-
return
|
|
1132
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1133
|
+
return t && (e.version = t), e;
|
|
1074
1134
|
}
|
|
1075
1135
|
},
|
|
1076
1136
|
{
|
|
1077
1137
|
test: [/puffin/i],
|
|
1078
|
-
describe(
|
|
1138
|
+
describe(r) {
|
|
1079
1139
|
const e = {
|
|
1080
1140
|
name: "Puffin"
|
|
1081
|
-
},
|
|
1082
|
-
return
|
|
1141
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1142
|
+
return t && (e.version = t), e;
|
|
1083
1143
|
}
|
|
1084
1144
|
},
|
|
1085
1145
|
{
|
|
1086
1146
|
test: [/sleipnir/i],
|
|
1087
|
-
describe(
|
|
1147
|
+
describe(r) {
|
|
1088
1148
|
const e = {
|
|
1089
1149
|
name: "Sleipnir"
|
|
1090
|
-
},
|
|
1091
|
-
return
|
|
1150
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1151
|
+
return t && (e.version = t), e;
|
|
1092
1152
|
}
|
|
1093
1153
|
},
|
|
1094
1154
|
{
|
|
1095
1155
|
test: [/k-meleon/i],
|
|
1096
|
-
describe(
|
|
1156
|
+
describe(r) {
|
|
1097
1157
|
const e = {
|
|
1098
1158
|
name: "K-Meleon"
|
|
1099
|
-
},
|
|
1100
|
-
return
|
|
1159
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1160
|
+
return t && (e.version = t), e;
|
|
1101
1161
|
}
|
|
1102
1162
|
},
|
|
1103
1163
|
{
|
|
1104
1164
|
test: [/micromessenger/i],
|
|
1105
|
-
describe(
|
|
1165
|
+
describe(r) {
|
|
1106
1166
|
const e = {
|
|
1107
1167
|
name: "WeChat"
|
|
1108
|
-
},
|
|
1109
|
-
return
|
|
1168
|
+
}, t = i.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1169
|
+
return t && (e.version = t), e;
|
|
1110
1170
|
}
|
|
1111
1171
|
},
|
|
1112
1172
|
{
|
|
1113
1173
|
test: [/qqbrowser/i],
|
|
1114
|
-
describe(
|
|
1174
|
+
describe(r) {
|
|
1115
1175
|
const e = {
|
|
1116
|
-
name: /qqbrowserlite/i.test(
|
|
1117
|
-
},
|
|
1118
|
-
return
|
|
1176
|
+
name: /qqbrowserlite/i.test(r) ? "QQ Browser Lite" : "QQ Browser"
|
|
1177
|
+
}, t = i.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1178
|
+
return t && (e.version = t), e;
|
|
1119
1179
|
}
|
|
1120
1180
|
},
|
|
1121
1181
|
{
|
|
1122
1182
|
test: [/msie|trident/i],
|
|
1123
|
-
describe(
|
|
1183
|
+
describe(r) {
|
|
1124
1184
|
const e = {
|
|
1125
1185
|
name: "Internet Explorer"
|
|
1126
|
-
},
|
|
1127
|
-
return
|
|
1186
|
+
}, t = i.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, r);
|
|
1187
|
+
return t && (e.version = t), e;
|
|
1128
1188
|
}
|
|
1129
1189
|
},
|
|
1130
1190
|
{
|
|
1131
1191
|
test: [/\sedg\//i],
|
|
1132
|
-
describe(
|
|
1192
|
+
describe(r) {
|
|
1133
1193
|
const e = {
|
|
1134
1194
|
name: "Microsoft Edge"
|
|
1135
|
-
},
|
|
1136
|
-
return
|
|
1195
|
+
}, t = i.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i, r);
|
|
1196
|
+
return t && (e.version = t), e;
|
|
1137
1197
|
}
|
|
1138
1198
|
},
|
|
1139
1199
|
{
|
|
1140
1200
|
test: [/edg([ea]|ios)/i],
|
|
1141
|
-
describe(
|
|
1201
|
+
describe(r) {
|
|
1142
1202
|
const e = {
|
|
1143
1203
|
name: "Microsoft Edge"
|
|
1144
|
-
},
|
|
1145
|
-
return
|
|
1204
|
+
}, t = i.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, r);
|
|
1205
|
+
return t && (e.version = t), e;
|
|
1146
1206
|
}
|
|
1147
1207
|
},
|
|
1148
1208
|
{
|
|
1149
1209
|
test: [/vivaldi/i],
|
|
1150
|
-
describe(
|
|
1210
|
+
describe(r) {
|
|
1151
1211
|
const e = {
|
|
1152
1212
|
name: "Vivaldi"
|
|
1153
|
-
},
|
|
1154
|
-
return
|
|
1213
|
+
}, t = i.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, r);
|
|
1214
|
+
return t && (e.version = t), e;
|
|
1155
1215
|
}
|
|
1156
1216
|
},
|
|
1157
1217
|
{
|
|
1158
1218
|
test: [/seamonkey/i],
|
|
1159
|
-
describe(
|
|
1219
|
+
describe(r) {
|
|
1160
1220
|
const e = {
|
|
1161
1221
|
name: "SeaMonkey"
|
|
1162
|
-
},
|
|
1163
|
-
return
|
|
1222
|
+
}, t = i.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, r);
|
|
1223
|
+
return t && (e.version = t), e;
|
|
1164
1224
|
}
|
|
1165
1225
|
},
|
|
1166
1226
|
{
|
|
1167
1227
|
test: [/sailfish/i],
|
|
1168
|
-
describe(
|
|
1228
|
+
describe(r) {
|
|
1169
1229
|
const e = {
|
|
1170
1230
|
name: "Sailfish"
|
|
1171
|
-
},
|
|
1172
|
-
return
|
|
1231
|
+
}, t = i.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, r);
|
|
1232
|
+
return t && (e.version = t), e;
|
|
1173
1233
|
}
|
|
1174
1234
|
},
|
|
1175
1235
|
{
|
|
1176
1236
|
test: [/silk/i],
|
|
1177
|
-
describe(
|
|
1237
|
+
describe(r) {
|
|
1178
1238
|
const e = {
|
|
1179
1239
|
name: "Amazon Silk"
|
|
1180
|
-
},
|
|
1181
|
-
return
|
|
1240
|
+
}, t = i.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, r);
|
|
1241
|
+
return t && (e.version = t), e;
|
|
1182
1242
|
}
|
|
1183
1243
|
},
|
|
1184
1244
|
{
|
|
1185
1245
|
test: [/phantom/i],
|
|
1186
|
-
describe(
|
|
1246
|
+
describe(r) {
|
|
1187
1247
|
const e = {
|
|
1188
1248
|
name: "PhantomJS"
|
|
1189
|
-
},
|
|
1190
|
-
return
|
|
1249
|
+
}, t = i.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, r);
|
|
1250
|
+
return t && (e.version = t), e;
|
|
1191
1251
|
}
|
|
1192
1252
|
},
|
|
1193
1253
|
{
|
|
1194
1254
|
test: [/slimerjs/i],
|
|
1195
|
-
describe(
|
|
1255
|
+
describe(r) {
|
|
1196
1256
|
const e = {
|
|
1197
1257
|
name: "SlimerJS"
|
|
1198
|
-
},
|
|
1199
|
-
return
|
|
1258
|
+
}, t = i.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i, r);
|
|
1259
|
+
return t && (e.version = t), e;
|
|
1200
1260
|
}
|
|
1201
1261
|
},
|
|
1202
1262
|
{
|
|
1203
1263
|
test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
|
|
1204
|
-
describe(
|
|
1264
|
+
describe(r) {
|
|
1205
1265
|
const e = {
|
|
1206
1266
|
name: "BlackBerry"
|
|
1207
|
-
},
|
|
1208
|
-
return
|
|
1267
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i, r);
|
|
1268
|
+
return t && (e.version = t), e;
|
|
1209
1269
|
}
|
|
1210
1270
|
},
|
|
1211
1271
|
{
|
|
1212
1272
|
test: [/(web|hpw)[o0]s/i],
|
|
1213
|
-
describe(
|
|
1273
|
+
describe(r) {
|
|
1214
1274
|
const e = {
|
|
1215
1275
|
name: "WebOS Browser"
|
|
1216
|
-
},
|
|
1217
|
-
return
|
|
1276
|
+
}, t = i.getFirstMatch(l, r) || i.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i, r);
|
|
1277
|
+
return t && (e.version = t), e;
|
|
1218
1278
|
}
|
|
1219
1279
|
},
|
|
1220
1280
|
{
|
|
1221
1281
|
test: [/bada/i],
|
|
1222
|
-
describe(
|
|
1282
|
+
describe(r) {
|
|
1223
1283
|
const e = {
|
|
1224
1284
|
name: "Bada"
|
|
1225
|
-
},
|
|
1226
|
-
return
|
|
1285
|
+
}, t = i.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, r);
|
|
1286
|
+
return t && (e.version = t), e;
|
|
1227
1287
|
}
|
|
1228
1288
|
},
|
|
1229
1289
|
{
|
|
1230
1290
|
test: [/tizen/i],
|
|
1231
|
-
describe(
|
|
1291
|
+
describe(r) {
|
|
1232
1292
|
const e = {
|
|
1233
1293
|
name: "Tizen"
|
|
1234
|
-
},
|
|
1235
|
-
return
|
|
1294
|
+
}, t = i.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1295
|
+
return t && (e.version = t), e;
|
|
1236
1296
|
}
|
|
1237
1297
|
},
|
|
1238
1298
|
{
|
|
1239
1299
|
test: [/qupzilla/i],
|
|
1240
|
-
describe(
|
|
1300
|
+
describe(r) {
|
|
1241
1301
|
const e = {
|
|
1242
1302
|
name: "QupZilla"
|
|
1243
|
-
},
|
|
1244
|
-
return
|
|
1303
|
+
}, t = i.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1304
|
+
return t && (e.version = t), e;
|
|
1245
1305
|
}
|
|
1246
1306
|
},
|
|
1247
1307
|
{
|
|
1248
1308
|
test: [/firefox|iceweasel|fxios/i],
|
|
1249
|
-
describe(
|
|
1309
|
+
describe(r) {
|
|
1250
1310
|
const e = {
|
|
1251
1311
|
name: "Firefox"
|
|
1252
|
-
},
|
|
1253
|
-
return
|
|
1312
|
+
}, t = i.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1313
|
+
return t && (e.version = t), e;
|
|
1254
1314
|
}
|
|
1255
1315
|
},
|
|
1256
1316
|
{
|
|
1257
1317
|
test: [/electron/i],
|
|
1258
|
-
describe(
|
|
1318
|
+
describe(r) {
|
|
1259
1319
|
const e = {
|
|
1260
1320
|
name: "Electron"
|
|
1261
|
-
},
|
|
1262
|
-
return
|
|
1321
|
+
}, t = i.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i, r);
|
|
1322
|
+
return t && (e.version = t), e;
|
|
1263
1323
|
}
|
|
1264
1324
|
},
|
|
1265
1325
|
{
|
|
1266
1326
|
test: [/MiuiBrowser/i],
|
|
1267
|
-
describe(
|
|
1327
|
+
describe(r) {
|
|
1268
1328
|
const e = {
|
|
1269
1329
|
name: "Miui"
|
|
1270
|
-
},
|
|
1271
|
-
return
|
|
1330
|
+
}, t = i.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i, r);
|
|
1331
|
+
return t && (e.version = t), e;
|
|
1272
1332
|
}
|
|
1273
1333
|
},
|
|
1274
1334
|
{
|
|
1275
1335
|
test: [/chromium/i],
|
|
1276
|
-
describe(
|
|
1336
|
+
describe(r) {
|
|
1277
1337
|
const e = {
|
|
1278
1338
|
name: "Chromium"
|
|
1279
|
-
},
|
|
1280
|
-
return
|
|
1339
|
+
}, t = i.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i, r) || i.getFirstMatch(l, r);
|
|
1340
|
+
return t && (e.version = t), e;
|
|
1281
1341
|
}
|
|
1282
1342
|
},
|
|
1283
1343
|
{
|
|
1284
1344
|
test: [/chrome|crios|crmo/i],
|
|
1285
|
-
describe(
|
|
1345
|
+
describe(r) {
|
|
1286
1346
|
const e = {
|
|
1287
1347
|
name: "Chrome"
|
|
1288
|
-
},
|
|
1289
|
-
return
|
|
1348
|
+
}, t = i.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i, r);
|
|
1349
|
+
return t && (e.version = t), e;
|
|
1290
1350
|
}
|
|
1291
1351
|
},
|
|
1292
1352
|
{
|
|
1293
1353
|
test: [/GSA/i],
|
|
1294
|
-
describe(
|
|
1354
|
+
describe(r) {
|
|
1295
1355
|
const e = {
|
|
1296
1356
|
name: "Google Search"
|
|
1297
|
-
},
|
|
1298
|
-
return
|
|
1357
|
+
}, t = i.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i, r);
|
|
1358
|
+
return t && (e.version = t), e;
|
|
1299
1359
|
}
|
|
1300
1360
|
},
|
|
1301
1361
|
/* Android Browser */
|
|
1302
1362
|
{
|
|
1303
|
-
test(
|
|
1304
|
-
const e = !
|
|
1305
|
-
return e &&
|
|
1363
|
+
test(r) {
|
|
1364
|
+
const e = !r.test(/like android/i), t = r.test(/android/i);
|
|
1365
|
+
return e && t;
|
|
1306
1366
|
},
|
|
1307
|
-
describe(
|
|
1367
|
+
describe(r) {
|
|
1308
1368
|
const e = {
|
|
1309
1369
|
name: "Android Browser"
|
|
1310
|
-
},
|
|
1311
|
-
return
|
|
1370
|
+
}, t = i.getFirstMatch(l, r);
|
|
1371
|
+
return t && (e.version = t), e;
|
|
1312
1372
|
}
|
|
1313
1373
|
},
|
|
1314
1374
|
/* PlayStation 4 */
|
|
1315
1375
|
{
|
|
1316
1376
|
test: [/playstation 4/i],
|
|
1317
|
-
describe(
|
|
1377
|
+
describe(r) {
|
|
1318
1378
|
const e = {
|
|
1319
1379
|
name: "PlayStation 4"
|
|
1320
|
-
},
|
|
1321
|
-
return
|
|
1380
|
+
}, t = i.getFirstMatch(l, r);
|
|
1381
|
+
return t && (e.version = t), e;
|
|
1322
1382
|
}
|
|
1323
1383
|
},
|
|
1324
1384
|
/* Safari */
|
|
1325
1385
|
{
|
|
1326
1386
|
test: [/safari|applewebkit/i],
|
|
1327
|
-
describe(
|
|
1387
|
+
describe(r) {
|
|
1328
1388
|
const e = {
|
|
1329
1389
|
name: "Safari"
|
|
1330
|
-
},
|
|
1331
|
-
return
|
|
1390
|
+
}, t = i.getFirstMatch(l, r);
|
|
1391
|
+
return t && (e.version = t), e;
|
|
1332
1392
|
}
|
|
1333
1393
|
},
|
|
1334
1394
|
/* Something else */
|
|
1335
1395
|
{
|
|
1336
1396
|
test: [/.*/i],
|
|
1337
|
-
describe(
|
|
1338
|
-
const e = /^(.*)\/(.*) /,
|
|
1397
|
+
describe(r) {
|
|
1398
|
+
const e = /^(.*)\/(.*) /, t = /^(.*)\/(.*)[ \t]\((.*)/, s = r.search("\\(") !== -1 ? t : e;
|
|
1339
1399
|
return {
|
|
1340
|
-
name: i.getFirstMatch(s,
|
|
1341
|
-
version: i.getSecondMatch(s,
|
|
1400
|
+
name: i.getFirstMatch(s, r),
|
|
1401
|
+
version: i.getSecondMatch(s, r)
|
|
1342
1402
|
};
|
|
1343
1403
|
}
|
|
1344
1404
|
}
|
|
1345
|
-
],
|
|
1405
|
+
], je = [
|
|
1346
1406
|
/* Roku */
|
|
1347
1407
|
{
|
|
1348
1408
|
test: [/Roku\/DVP/],
|
|
1349
|
-
describe(
|
|
1350
|
-
const e = i.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,
|
|
1409
|
+
describe(r) {
|
|
1410
|
+
const e = i.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i, r);
|
|
1351
1411
|
return {
|
|
1352
1412
|
name: g.Roku,
|
|
1353
1413
|
version: e
|
|
@@ -1357,8 +1417,8 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1357
1417
|
/* Windows Phone */
|
|
1358
1418
|
{
|
|
1359
1419
|
test: [/windows phone/i],
|
|
1360
|
-
describe(
|
|
1361
|
-
const e = i.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,
|
|
1420
|
+
describe(r) {
|
|
1421
|
+
const e = i.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i, r);
|
|
1362
1422
|
return {
|
|
1363
1423
|
name: g.WindowsPhone,
|
|
1364
1424
|
version: e
|
|
@@ -1368,41 +1428,41 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1368
1428
|
/* Windows */
|
|
1369
1429
|
{
|
|
1370
1430
|
test: [/windows /i],
|
|
1371
|
-
describe(
|
|
1372
|
-
const e = i.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,
|
|
1431
|
+
describe(r) {
|
|
1432
|
+
const e = i.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i, r), t = i.getWindowsVersionName(e);
|
|
1373
1433
|
return {
|
|
1374
1434
|
name: g.Windows,
|
|
1375
1435
|
version: e,
|
|
1376
|
-
versionName:
|
|
1436
|
+
versionName: t
|
|
1377
1437
|
};
|
|
1378
1438
|
}
|
|
1379
1439
|
},
|
|
1380
1440
|
/* Firefox on iPad */
|
|
1381
1441
|
{
|
|
1382
1442
|
test: [/Macintosh(.*?) FxiOS(.*?)\//],
|
|
1383
|
-
describe(
|
|
1443
|
+
describe(r) {
|
|
1384
1444
|
const e = {
|
|
1385
1445
|
name: g.iOS
|
|
1386
|
-
},
|
|
1387
|
-
return
|
|
1446
|
+
}, t = i.getSecondMatch(/(Version\/)(\d[\d.]+)/, r);
|
|
1447
|
+
return t && (e.version = t), e;
|
|
1388
1448
|
}
|
|
1389
1449
|
},
|
|
1390
1450
|
/* macOS */
|
|
1391
1451
|
{
|
|
1392
1452
|
test: [/macintosh/i],
|
|
1393
|
-
describe(
|
|
1394
|
-
const e = i.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,
|
|
1453
|
+
describe(r) {
|
|
1454
|
+
const e = i.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i, r).replace(/[_\s]/g, "."), t = i.getMacOSVersionName(e), s = {
|
|
1395
1455
|
name: g.MacOS,
|
|
1396
1456
|
version: e
|
|
1397
1457
|
};
|
|
1398
|
-
return
|
|
1458
|
+
return t && (s.versionName = t), s;
|
|
1399
1459
|
}
|
|
1400
1460
|
},
|
|
1401
1461
|
/* iOS */
|
|
1402
1462
|
{
|
|
1403
1463
|
test: [/(ipod|iphone|ipad)/i],
|
|
1404
|
-
describe(
|
|
1405
|
-
const e = i.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,
|
|
1464
|
+
describe(r) {
|
|
1465
|
+
const e = i.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i, r).replace(/[_\s]/g, ".");
|
|
1406
1466
|
return {
|
|
1407
1467
|
name: g.iOS,
|
|
1408
1468
|
version: e
|
|
@@ -1411,33 +1471,33 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1411
1471
|
},
|
|
1412
1472
|
/* Android */
|
|
1413
1473
|
{
|
|
1414
|
-
test(
|
|
1415
|
-
const e = !
|
|
1416
|
-
return e &&
|
|
1474
|
+
test(r) {
|
|
1475
|
+
const e = !r.test(/like android/i), t = r.test(/android/i);
|
|
1476
|
+
return e && t;
|
|
1417
1477
|
},
|
|
1418
|
-
describe(
|
|
1419
|
-
const e = i.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,
|
|
1478
|
+
describe(r) {
|
|
1479
|
+
const e = i.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i, r), t = i.getAndroidVersionName(e), s = {
|
|
1420
1480
|
name: g.Android,
|
|
1421
1481
|
version: e
|
|
1422
1482
|
};
|
|
1423
|
-
return
|
|
1483
|
+
return t && (s.versionName = t), s;
|
|
1424
1484
|
}
|
|
1425
1485
|
},
|
|
1426
1486
|
/* WebOS */
|
|
1427
1487
|
{
|
|
1428
1488
|
test: [/(web|hpw)[o0]s/i],
|
|
1429
|
-
describe(
|
|
1430
|
-
const e = i.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,
|
|
1489
|
+
describe(r) {
|
|
1490
|
+
const e = i.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i, r), t = {
|
|
1431
1491
|
name: g.WebOS
|
|
1432
1492
|
};
|
|
1433
|
-
return e && e.length && (
|
|
1493
|
+
return e && e.length && (t.version = e), t;
|
|
1434
1494
|
}
|
|
1435
1495
|
},
|
|
1436
1496
|
/* BlackBerry */
|
|
1437
1497
|
{
|
|
1438
1498
|
test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
|
|
1439
|
-
describe(
|
|
1440
|
-
const e = i.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,
|
|
1499
|
+
describe(r) {
|
|
1500
|
+
const e = i.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i, r) || i.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i, r) || i.getFirstMatch(/\bbb(\d+)/i, r);
|
|
1441
1501
|
return {
|
|
1442
1502
|
name: g.BlackBerry,
|
|
1443
1503
|
version: e
|
|
@@ -1447,8 +1507,8 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1447
1507
|
/* Bada */
|
|
1448
1508
|
{
|
|
1449
1509
|
test: [/bada/i],
|
|
1450
|
-
describe(
|
|
1451
|
-
const e = i.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,
|
|
1510
|
+
describe(r) {
|
|
1511
|
+
const e = i.getFirstMatch(/bada\/(\d+(\.\d+)*)/i, r);
|
|
1452
1512
|
return {
|
|
1453
1513
|
name: g.Bada,
|
|
1454
1514
|
version: e
|
|
@@ -1458,8 +1518,8 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1458
1518
|
/* Tizen */
|
|
1459
1519
|
{
|
|
1460
1520
|
test: [/tizen/i],
|
|
1461
|
-
describe(
|
|
1462
|
-
const e = i.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,
|
|
1521
|
+
describe(r) {
|
|
1522
|
+
const e = i.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i, r);
|
|
1463
1523
|
return {
|
|
1464
1524
|
name: g.Tizen,
|
|
1465
1525
|
version: e
|
|
@@ -1487,21 +1547,21 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1487
1547
|
/* Playstation 4 */
|
|
1488
1548
|
{
|
|
1489
1549
|
test: [/PlayStation 4/],
|
|
1490
|
-
describe(
|
|
1491
|
-
const e = i.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,
|
|
1550
|
+
describe(r) {
|
|
1551
|
+
const e = i.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i, r);
|
|
1492
1552
|
return {
|
|
1493
1553
|
name: g.PlayStation4,
|
|
1494
1554
|
version: e
|
|
1495
1555
|
};
|
|
1496
1556
|
}
|
|
1497
1557
|
}
|
|
1498
|
-
],
|
|
1558
|
+
], Ke = [
|
|
1499
1559
|
/* Googlebot */
|
|
1500
1560
|
{
|
|
1501
1561
|
test: [/googlebot/i],
|
|
1502
1562
|
describe() {
|
|
1503
1563
|
return {
|
|
1504
|
-
type:
|
|
1564
|
+
type: h.bot,
|
|
1505
1565
|
vendor: "Google"
|
|
1506
1566
|
};
|
|
1507
1567
|
}
|
|
@@ -1509,12 +1569,12 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1509
1569
|
/* Huawei */
|
|
1510
1570
|
{
|
|
1511
1571
|
test: [/huawei/i],
|
|
1512
|
-
describe(
|
|
1513
|
-
const e = i.getFirstMatch(/(can-l01)/i,
|
|
1514
|
-
type:
|
|
1572
|
+
describe(r) {
|
|
1573
|
+
const e = i.getFirstMatch(/(can-l01)/i, r) && "Nova", t = {
|
|
1574
|
+
type: h.mobile,
|
|
1515
1575
|
vendor: "Huawei"
|
|
1516
1576
|
};
|
|
1517
|
-
return e && (
|
|
1577
|
+
return e && (t.model = e), t;
|
|
1518
1578
|
}
|
|
1519
1579
|
},
|
|
1520
1580
|
/* Nexus Tablet */
|
|
@@ -1522,7 +1582,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1522
1582
|
test: [/nexus\s*(?:7|8|9|10).*/i],
|
|
1523
1583
|
describe() {
|
|
1524
1584
|
return {
|
|
1525
|
-
type:
|
|
1585
|
+
type: h.tablet,
|
|
1526
1586
|
vendor: "Nexus"
|
|
1527
1587
|
};
|
|
1528
1588
|
}
|
|
@@ -1532,7 +1592,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1532
1592
|
test: [/ipad/i],
|
|
1533
1593
|
describe() {
|
|
1534
1594
|
return {
|
|
1535
|
-
type:
|
|
1595
|
+
type: h.tablet,
|
|
1536
1596
|
vendor: "Apple",
|
|
1537
1597
|
model: "iPad"
|
|
1538
1598
|
};
|
|
@@ -1543,7 +1603,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1543
1603
|
test: [/Macintosh(.*?) FxiOS(.*?)\//],
|
|
1544
1604
|
describe() {
|
|
1545
1605
|
return {
|
|
1546
|
-
type:
|
|
1606
|
+
type: h.tablet,
|
|
1547
1607
|
vendor: "Apple",
|
|
1548
1608
|
model: "iPad"
|
|
1549
1609
|
};
|
|
@@ -1554,7 +1614,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1554
1614
|
test: [/kftt build/i],
|
|
1555
1615
|
describe() {
|
|
1556
1616
|
return {
|
|
1557
|
-
type:
|
|
1617
|
+
type: h.tablet,
|
|
1558
1618
|
vendor: "Amazon",
|
|
1559
1619
|
model: "Kindle Fire HD 7"
|
|
1560
1620
|
};
|
|
@@ -1565,7 +1625,7 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1565
1625
|
test: [/silk/i],
|
|
1566
1626
|
describe() {
|
|
1567
1627
|
return {
|
|
1568
|
-
type:
|
|
1628
|
+
type: h.tablet,
|
|
1569
1629
|
vendor: "Amazon"
|
|
1570
1630
|
};
|
|
1571
1631
|
}
|
|
@@ -1575,20 +1635,20 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1575
1635
|
test: [/tablet(?! pc)/i],
|
|
1576
1636
|
describe() {
|
|
1577
1637
|
return {
|
|
1578
|
-
type:
|
|
1638
|
+
type: h.tablet
|
|
1579
1639
|
};
|
|
1580
1640
|
}
|
|
1581
1641
|
},
|
|
1582
1642
|
/* iPod/iPhone */
|
|
1583
1643
|
{
|
|
1584
|
-
test(
|
|
1585
|
-
const e =
|
|
1586
|
-
return e && !
|
|
1644
|
+
test(r) {
|
|
1645
|
+
const e = r.test(/ipod|iphone/i), t = r.test(/like (ipod|iphone)/i);
|
|
1646
|
+
return e && !t;
|
|
1587
1647
|
},
|
|
1588
|
-
describe(
|
|
1589
|
-
const e = i.getFirstMatch(/(ipod|iphone)/i,
|
|
1648
|
+
describe(r) {
|
|
1649
|
+
const e = i.getFirstMatch(/(ipod|iphone)/i, r);
|
|
1590
1650
|
return {
|
|
1591
|
-
type:
|
|
1651
|
+
type: h.mobile,
|
|
1592
1652
|
vendor: "Apple",
|
|
1593
1653
|
model: e
|
|
1594
1654
|
};
|
|
@@ -1599,146 +1659,157 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1599
1659
|
test: [/nexus\s*[0-6].*/i, /galaxy nexus/i],
|
|
1600
1660
|
describe() {
|
|
1601
1661
|
return {
|
|
1602
|
-
type:
|
|
1662
|
+
type: h.mobile,
|
|
1603
1663
|
vendor: "Nexus"
|
|
1604
1664
|
};
|
|
1605
1665
|
}
|
|
1606
1666
|
},
|
|
1667
|
+
/* Nokia */
|
|
1668
|
+
{
|
|
1669
|
+
test: [/Nokia/i],
|
|
1670
|
+
describe(r) {
|
|
1671
|
+
const e = i.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i, r), t = {
|
|
1672
|
+
type: h.mobile,
|
|
1673
|
+
vendor: "Nokia"
|
|
1674
|
+
};
|
|
1675
|
+
return e && (t.model = e), t;
|
|
1676
|
+
}
|
|
1677
|
+
},
|
|
1607
1678
|
/* Mobile */
|
|
1608
1679
|
{
|
|
1609
1680
|
test: [/[^-]mobi/i],
|
|
1610
1681
|
describe() {
|
|
1611
1682
|
return {
|
|
1612
|
-
type:
|
|
1683
|
+
type: h.mobile
|
|
1613
1684
|
};
|
|
1614
1685
|
}
|
|
1615
1686
|
},
|
|
1616
1687
|
/* BlackBerry */
|
|
1617
1688
|
{
|
|
1618
|
-
test(
|
|
1619
|
-
return
|
|
1689
|
+
test(r) {
|
|
1690
|
+
return r.getBrowserName(!0) === "blackberry";
|
|
1620
1691
|
},
|
|
1621
1692
|
describe() {
|
|
1622
1693
|
return {
|
|
1623
|
-
type:
|
|
1694
|
+
type: h.mobile,
|
|
1624
1695
|
vendor: "BlackBerry"
|
|
1625
1696
|
};
|
|
1626
1697
|
}
|
|
1627
1698
|
},
|
|
1628
1699
|
/* Bada */
|
|
1629
1700
|
{
|
|
1630
|
-
test(
|
|
1631
|
-
return
|
|
1701
|
+
test(r) {
|
|
1702
|
+
return r.getBrowserName(!0) === "bada";
|
|
1632
1703
|
},
|
|
1633
1704
|
describe() {
|
|
1634
1705
|
return {
|
|
1635
|
-
type:
|
|
1706
|
+
type: h.mobile
|
|
1636
1707
|
};
|
|
1637
1708
|
}
|
|
1638
1709
|
},
|
|
1639
1710
|
/* Windows Phone */
|
|
1640
1711
|
{
|
|
1641
|
-
test(
|
|
1642
|
-
return
|
|
1712
|
+
test(r) {
|
|
1713
|
+
return r.getBrowserName() === "windows phone";
|
|
1643
1714
|
},
|
|
1644
1715
|
describe() {
|
|
1645
1716
|
return {
|
|
1646
|
-
type:
|
|
1717
|
+
type: h.mobile,
|
|
1647
1718
|
vendor: "Microsoft"
|
|
1648
1719
|
};
|
|
1649
1720
|
}
|
|
1650
1721
|
},
|
|
1651
1722
|
/* Android Tablet */
|
|
1652
1723
|
{
|
|
1653
|
-
test(
|
|
1654
|
-
const e = Number(String(
|
|
1655
|
-
return
|
|
1724
|
+
test(r) {
|
|
1725
|
+
const e = Number(String(r.getOSVersion()).split(".")[0]);
|
|
1726
|
+
return r.getOSName(!0) === "android" && e >= 3;
|
|
1656
1727
|
},
|
|
1657
1728
|
describe() {
|
|
1658
1729
|
return {
|
|
1659
|
-
type:
|
|
1730
|
+
type: h.tablet
|
|
1660
1731
|
};
|
|
1661
1732
|
}
|
|
1662
1733
|
},
|
|
1663
1734
|
/* Android Mobile */
|
|
1664
1735
|
{
|
|
1665
|
-
test(
|
|
1666
|
-
return
|
|
1736
|
+
test(r) {
|
|
1737
|
+
return r.getOSName(!0) === "android";
|
|
1667
1738
|
},
|
|
1668
1739
|
describe() {
|
|
1669
1740
|
return {
|
|
1670
|
-
type:
|
|
1741
|
+
type: h.mobile
|
|
1671
1742
|
};
|
|
1672
1743
|
}
|
|
1673
1744
|
},
|
|
1674
1745
|
/* desktop */
|
|
1675
1746
|
{
|
|
1676
|
-
test(
|
|
1677
|
-
return
|
|
1747
|
+
test(r) {
|
|
1748
|
+
return r.getOSName(!0) === "macos";
|
|
1678
1749
|
},
|
|
1679
1750
|
describe() {
|
|
1680
1751
|
return {
|
|
1681
|
-
type:
|
|
1752
|
+
type: h.desktop,
|
|
1682
1753
|
vendor: "Apple"
|
|
1683
1754
|
};
|
|
1684
1755
|
}
|
|
1685
1756
|
},
|
|
1686
1757
|
/* Windows */
|
|
1687
1758
|
{
|
|
1688
|
-
test(
|
|
1689
|
-
return
|
|
1759
|
+
test(r) {
|
|
1760
|
+
return r.getOSName(!0) === "windows";
|
|
1690
1761
|
},
|
|
1691
1762
|
describe() {
|
|
1692
1763
|
return {
|
|
1693
|
-
type:
|
|
1764
|
+
type: h.desktop
|
|
1694
1765
|
};
|
|
1695
1766
|
}
|
|
1696
1767
|
},
|
|
1697
1768
|
/* Linux */
|
|
1698
1769
|
{
|
|
1699
|
-
test(
|
|
1700
|
-
return
|
|
1770
|
+
test(r) {
|
|
1771
|
+
return r.getOSName(!0) === "linux";
|
|
1701
1772
|
},
|
|
1702
1773
|
describe() {
|
|
1703
1774
|
return {
|
|
1704
|
-
type:
|
|
1775
|
+
type: h.desktop
|
|
1705
1776
|
};
|
|
1706
1777
|
}
|
|
1707
1778
|
},
|
|
1708
1779
|
/* PlayStation 4 */
|
|
1709
1780
|
{
|
|
1710
|
-
test(
|
|
1711
|
-
return
|
|
1781
|
+
test(r) {
|
|
1782
|
+
return r.getOSName(!0) === "playstation 4";
|
|
1712
1783
|
},
|
|
1713
1784
|
describe() {
|
|
1714
1785
|
return {
|
|
1715
|
-
type:
|
|
1786
|
+
type: h.tv
|
|
1716
1787
|
};
|
|
1717
1788
|
}
|
|
1718
1789
|
},
|
|
1719
1790
|
/* Roku */
|
|
1720
1791
|
{
|
|
1721
|
-
test(
|
|
1722
|
-
return
|
|
1792
|
+
test(r) {
|
|
1793
|
+
return r.getOSName(!0) === "roku";
|
|
1723
1794
|
},
|
|
1724
1795
|
describe() {
|
|
1725
1796
|
return {
|
|
1726
|
-
type:
|
|
1797
|
+
type: h.tv
|
|
1727
1798
|
};
|
|
1728
1799
|
}
|
|
1729
1800
|
}
|
|
1730
|
-
],
|
|
1801
|
+
], Ye = [
|
|
1731
1802
|
/* EdgeHTML */
|
|
1732
1803
|
{
|
|
1733
|
-
test(
|
|
1734
|
-
return
|
|
1804
|
+
test(r) {
|
|
1805
|
+
return r.getBrowserName(!0) === "microsoft edge";
|
|
1735
1806
|
},
|
|
1736
|
-
describe(
|
|
1737
|
-
if (/\sedg\//i.test(
|
|
1807
|
+
describe(r) {
|
|
1808
|
+
if (/\sedg\//i.test(r))
|
|
1738
1809
|
return {
|
|
1739
1810
|
name: S.Blink
|
|
1740
1811
|
};
|
|
1741
|
-
const e = i.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,
|
|
1812
|
+
const e = i.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, r);
|
|
1742
1813
|
return {
|
|
1743
1814
|
name: S.EdgeHTML,
|
|
1744
1815
|
version: e
|
|
@@ -1748,36 +1819,36 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1748
1819
|
/* Trident */
|
|
1749
1820
|
{
|
|
1750
1821
|
test: [/trident/i],
|
|
1751
|
-
describe(
|
|
1822
|
+
describe(r) {
|
|
1752
1823
|
const e = {
|
|
1753
1824
|
name: S.Trident
|
|
1754
|
-
},
|
|
1755
|
-
return
|
|
1825
|
+
}, t = i.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, r);
|
|
1826
|
+
return t && (e.version = t), e;
|
|
1756
1827
|
}
|
|
1757
1828
|
},
|
|
1758
1829
|
/* Presto */
|
|
1759
1830
|
{
|
|
1760
|
-
test(
|
|
1761
|
-
return
|
|
1831
|
+
test(r) {
|
|
1832
|
+
return r.test(/presto/i);
|
|
1762
1833
|
},
|
|
1763
|
-
describe(
|
|
1834
|
+
describe(r) {
|
|
1764
1835
|
const e = {
|
|
1765
1836
|
name: S.Presto
|
|
1766
|
-
},
|
|
1767
|
-
return
|
|
1837
|
+
}, t = i.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, r);
|
|
1838
|
+
return t && (e.version = t), e;
|
|
1768
1839
|
}
|
|
1769
1840
|
},
|
|
1770
1841
|
/* Gecko */
|
|
1771
1842
|
{
|
|
1772
|
-
test(
|
|
1773
|
-
const e =
|
|
1774
|
-
return e && !
|
|
1843
|
+
test(r) {
|
|
1844
|
+
const e = r.test(/gecko/i), t = r.test(/like gecko/i);
|
|
1845
|
+
return e && !t;
|
|
1775
1846
|
},
|
|
1776
|
-
describe(
|
|
1847
|
+
describe(r) {
|
|
1777
1848
|
const e = {
|
|
1778
1849
|
name: S.Gecko
|
|
1779
|
-
},
|
|
1780
|
-
return
|
|
1850
|
+
}, t = i.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, r);
|
|
1851
|
+
return t && (e.version = t), e;
|
|
1781
1852
|
}
|
|
1782
1853
|
},
|
|
1783
1854
|
/* Blink */
|
|
@@ -1792,15 +1863,15 @@ const u = /version\/(\d+(\.?_?\d+)+)/i, it = [
|
|
|
1792
1863
|
/* WebKit */
|
|
1793
1864
|
{
|
|
1794
1865
|
test: [/(apple)?webkit/i],
|
|
1795
|
-
describe(
|
|
1866
|
+
describe(r) {
|
|
1796
1867
|
const e = {
|
|
1797
1868
|
name: S.WebKit
|
|
1798
|
-
},
|
|
1799
|
-
return
|
|
1869
|
+
}, t = i.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, r);
|
|
1870
|
+
return t && (e.version = t), e;
|
|
1800
1871
|
}
|
|
1801
1872
|
}
|
|
1802
1873
|
];
|
|
1803
|
-
class
|
|
1874
|
+
class W {
|
|
1804
1875
|
/**
|
|
1805
1876
|
* Create instance of Parser
|
|
1806
1877
|
*
|
|
@@ -1813,10 +1884,10 @@ class X {
|
|
|
1813
1884
|
*
|
|
1814
1885
|
* @constructor
|
|
1815
1886
|
*/
|
|
1816
|
-
constructor(e,
|
|
1887
|
+
constructor(e, t = !1) {
|
|
1817
1888
|
if (e == null || e === "")
|
|
1818
1889
|
throw new Error("UserAgent parameter can't be empty");
|
|
1819
|
-
this._ua = e, this.parsedResult = {},
|
|
1890
|
+
this._ua = e, this.parsedResult = {}, t !== !0 && this.parse();
|
|
1820
1891
|
}
|
|
1821
1892
|
/**
|
|
1822
1893
|
* Get UserAgent string of current Parser instance
|
|
@@ -1841,11 +1912,11 @@ class X {
|
|
|
1841
1912
|
*/
|
|
1842
1913
|
parseBrowser() {
|
|
1843
1914
|
this.parsedResult.browser = {};
|
|
1844
|
-
const e = i.find(
|
|
1845
|
-
if (typeof
|
|
1846
|
-
return
|
|
1847
|
-
if (
|
|
1848
|
-
return
|
|
1915
|
+
const e = i.find(qe, (t) => {
|
|
1916
|
+
if (typeof t.test == "function")
|
|
1917
|
+
return t.test(this);
|
|
1918
|
+
if (Array.isArray(t.test))
|
|
1919
|
+
return t.test.some((s) => this.test(s));
|
|
1849
1920
|
throw new Error("Browser's test function is not valid");
|
|
1850
1921
|
});
|
|
1851
1922
|
return e && (this.parsedResult.browser = e.describe(this.getUA())), this.parsedResult.browser;
|
|
@@ -1897,11 +1968,11 @@ class X {
|
|
|
1897
1968
|
*/
|
|
1898
1969
|
parseOS() {
|
|
1899
1970
|
this.parsedResult.os = {};
|
|
1900
|
-
const e = i.find(
|
|
1901
|
-
if (typeof
|
|
1902
|
-
return
|
|
1903
|
-
if (
|
|
1904
|
-
return
|
|
1971
|
+
const e = i.find(je, (t) => {
|
|
1972
|
+
if (typeof t.test == "function")
|
|
1973
|
+
return t.test(this);
|
|
1974
|
+
if (Array.isArray(t.test))
|
|
1975
|
+
return t.test.some((s) => this.test(s));
|
|
1905
1976
|
throw new Error("Browser's test function is not valid");
|
|
1906
1977
|
});
|
|
1907
1978
|
return e && (this.parsedResult.os = e.describe(this.getUA())), this.parsedResult.os;
|
|
@@ -1912,8 +1983,8 @@ class X {
|
|
|
1912
1983
|
* @return {String} name of the OS — macOS, Windows, Linux, etc.
|
|
1913
1984
|
*/
|
|
1914
1985
|
getOSName(e) {
|
|
1915
|
-
const { name:
|
|
1916
|
-
return e ? String(
|
|
1986
|
+
const { name: t } = this.getOS();
|
|
1987
|
+
return e ? String(t).toLowerCase() || "" : t || "";
|
|
1917
1988
|
}
|
|
1918
1989
|
/**
|
|
1919
1990
|
* Get OS version
|
|
@@ -1935,8 +2006,8 @@ class X {
|
|
|
1935
2006
|
* @return {*}
|
|
1936
2007
|
*/
|
|
1937
2008
|
getPlatformType(e = !1) {
|
|
1938
|
-
const { type:
|
|
1939
|
-
return e ? String(
|
|
2009
|
+
const { type: t } = this.getPlatform();
|
|
2010
|
+
return e ? String(t).toLowerCase() || "" : t || "";
|
|
1940
2011
|
}
|
|
1941
2012
|
/**
|
|
1942
2013
|
* Get parsed platform
|
|
@@ -1944,11 +2015,11 @@ class X {
|
|
|
1944
2015
|
*/
|
|
1945
2016
|
parsePlatform() {
|
|
1946
2017
|
this.parsedResult.platform = {};
|
|
1947
|
-
const e = i.find(
|
|
1948
|
-
if (typeof
|
|
1949
|
-
return
|
|
1950
|
-
if (
|
|
1951
|
-
return
|
|
2018
|
+
const e = i.find(Ke, (t) => {
|
|
2019
|
+
if (typeof t.test == "function")
|
|
2020
|
+
return t.test(this);
|
|
2021
|
+
if (Array.isArray(t.test))
|
|
2022
|
+
return t.test.some((s) => this.test(s));
|
|
1952
2023
|
throw new Error("Browser's test function is not valid");
|
|
1953
2024
|
});
|
|
1954
2025
|
return e && (this.parsedResult.platform = e.describe(this.getUA())), this.parsedResult.platform;
|
|
@@ -1975,11 +2046,11 @@ class X {
|
|
|
1975
2046
|
*/
|
|
1976
2047
|
parseEngine() {
|
|
1977
2048
|
this.parsedResult.engine = {};
|
|
1978
|
-
const e = i.find(
|
|
1979
|
-
if (typeof
|
|
1980
|
-
return
|
|
1981
|
-
if (
|
|
1982
|
-
return
|
|
2049
|
+
const e = i.find(Ye, (t) => {
|
|
2050
|
+
if (typeof t.test == "function")
|
|
2051
|
+
return t.test(this);
|
|
2052
|
+
if (Array.isArray(t.test))
|
|
2053
|
+
return t.test.some((s) => this.test(s));
|
|
1983
2054
|
throw new Error("Browser's test function is not valid");
|
|
1984
2055
|
});
|
|
1985
2056
|
return e && (this.parsedResult.engine = e.describe(this.getUA())), this.parsedResult.engine;
|
|
@@ -2017,62 +2088,77 @@ class X {
|
|
|
2017
2088
|
* if (browser.satisfies({desktop: { chrome: '>118.01.1322' } }))
|
|
2018
2089
|
*/
|
|
2019
2090
|
satisfies(e) {
|
|
2020
|
-
const
|
|
2091
|
+
const t = {};
|
|
2021
2092
|
let s = 0;
|
|
2022
2093
|
const n = {};
|
|
2023
2094
|
let o = 0;
|
|
2024
2095
|
if (Object.keys(e).forEach((a) => {
|
|
2025
2096
|
const c = e[a];
|
|
2026
|
-
typeof c == "string" ? (n[a] = c, o += 1) : typeof c == "object" && (
|
|
2097
|
+
typeof c == "string" ? (n[a] = c, o += 1) : typeof c == "object" && (t[a] = c, s += 1);
|
|
2027
2098
|
}), s > 0) {
|
|
2028
|
-
const a = Object.keys(
|
|
2099
|
+
const a = Object.keys(t), c = i.find(a, (d) => this.isOS(d));
|
|
2029
2100
|
if (c) {
|
|
2030
|
-
const
|
|
2031
|
-
if (
|
|
2032
|
-
return
|
|
2101
|
+
const d = this.satisfies(t[c]);
|
|
2102
|
+
if (d !== void 0)
|
|
2103
|
+
return d;
|
|
2033
2104
|
}
|
|
2034
|
-
const
|
|
2105
|
+
const u = i.find(
|
|
2035
2106
|
a,
|
|
2036
|
-
(
|
|
2107
|
+
(d) => this.isPlatform(d)
|
|
2037
2108
|
);
|
|
2038
|
-
if (
|
|
2039
|
-
const
|
|
2040
|
-
if (
|
|
2041
|
-
return
|
|
2109
|
+
if (u) {
|
|
2110
|
+
const d = this.satisfies(t[u]);
|
|
2111
|
+
if (d !== void 0)
|
|
2112
|
+
return d;
|
|
2042
2113
|
}
|
|
2043
2114
|
}
|
|
2044
2115
|
if (o > 0) {
|
|
2045
|
-
const a = Object.keys(n), c = i.find(a, (
|
|
2116
|
+
const a = Object.keys(n), c = i.find(a, (u) => this.isBrowser(u, !0));
|
|
2046
2117
|
if (c !== void 0)
|
|
2047
2118
|
return this.compareVersion(n[c]);
|
|
2048
2119
|
}
|
|
2049
2120
|
}
|
|
2050
2121
|
/**
|
|
2051
2122
|
* Check if the browser name equals the passed string
|
|
2052
|
-
* @param browserName The string to compare with the browser name
|
|
2123
|
+
* @param {string} browserName The string to compare with the browser name
|
|
2053
2124
|
* @param [includingAlias=false] The flag showing whether alias will be included into comparison
|
|
2054
2125
|
* @returns {boolean}
|
|
2055
2126
|
*/
|
|
2056
|
-
isBrowser(e,
|
|
2127
|
+
isBrowser(e, t = !1) {
|
|
2057
2128
|
const s = this.getBrowserName().toLowerCase();
|
|
2058
2129
|
let n = e.toLowerCase();
|
|
2059
2130
|
const o = i.getBrowserTypeByAlias(n);
|
|
2060
|
-
return
|
|
2131
|
+
return t && o && (n = o.toLowerCase()), n === s;
|
|
2061
2132
|
}
|
|
2062
2133
|
compareVersion(e) {
|
|
2063
|
-
let
|
|
2134
|
+
let t = [0], s = e, n = !1;
|
|
2064
2135
|
const o = this.getBrowserVersion();
|
|
2065
2136
|
if (typeof o == "string")
|
|
2066
|
-
return e[0] === ">" || e[0] === "<" ? (s = e.substr(1), e[1] === "=" ? (n = !0, s = e.substr(2)) :
|
|
2137
|
+
return e[0] === ">" || e[0] === "<" ? (s = e.substr(1), e[1] === "=" ? (n = !0, s = e.substr(2)) : t = [], e[0] === ">" ? t.push(1) : t.push(-1)) : e[0] === "=" ? s = e.substr(1) : e[0] === "~" && (n = !0, s = e.substr(1)), t.indexOf(
|
|
2067
2138
|
i.compareVersions(o, s, n)
|
|
2068
2139
|
) > -1;
|
|
2069
2140
|
}
|
|
2141
|
+
/**
|
|
2142
|
+
* Check if the OS name equals the passed string
|
|
2143
|
+
* @param {string} osName The string to compare with the OS name
|
|
2144
|
+
* @returns {boolean}
|
|
2145
|
+
*/
|
|
2070
2146
|
isOS(e) {
|
|
2071
2147
|
return this.getOSName(!0) === String(e).toLowerCase();
|
|
2072
2148
|
}
|
|
2149
|
+
/**
|
|
2150
|
+
* Check if the platform type equals the passed string
|
|
2151
|
+
* @param {string} platformType The string to compare with the platform type
|
|
2152
|
+
* @returns {boolean}
|
|
2153
|
+
*/
|
|
2073
2154
|
isPlatform(e) {
|
|
2074
2155
|
return this.getPlatformType(!0) === String(e).toLowerCase();
|
|
2075
2156
|
}
|
|
2157
|
+
/**
|
|
2158
|
+
* Check if the engine name equals the passed string
|
|
2159
|
+
* @param {string} engineName The string to compare with the engine name
|
|
2160
|
+
* @returns {boolean}
|
|
2161
|
+
*/
|
|
2076
2162
|
isEngine(e) {
|
|
2077
2163
|
return this.getEngineName(!0) === String(e).toLowerCase();
|
|
2078
2164
|
}
|
|
@@ -2083,8 +2169,8 @@ class X {
|
|
|
2083
2169
|
* @param [includingAlias=false] The flag showing whether alias will be included into comparison
|
|
2084
2170
|
* @returns {Boolean}
|
|
2085
2171
|
*/
|
|
2086
|
-
is(e,
|
|
2087
|
-
return this.isBrowser(e,
|
|
2172
|
+
is(e, t = !1) {
|
|
2173
|
+
return this.isBrowser(e, t) || this.isOS(e) || this.isPlatform(e);
|
|
2088
2174
|
}
|
|
2089
2175
|
/**
|
|
2090
2176
|
* Check if any of the given values satisfies this.is(anything)
|
|
@@ -2092,7 +2178,7 @@ class X {
|
|
|
2092
2178
|
* @returns {Boolean}
|
|
2093
2179
|
*/
|
|
2094
2180
|
some(e = []) {
|
|
2095
|
-
return e.some((
|
|
2181
|
+
return e.some((t) => this.is(t));
|
|
2096
2182
|
}
|
|
2097
2183
|
}
|
|
2098
2184
|
/*!
|
|
@@ -2101,7 +2187,7 @@ class X {
|
|
|
2101
2187
|
* MIT License | (c) Dustin Diaz 2012-2015
|
|
2102
2188
|
* MIT License | (c) Denis Demchenko 2015-2019
|
|
2103
2189
|
*/
|
|
2104
|
-
class
|
|
2190
|
+
class Je {
|
|
2105
2191
|
/**
|
|
2106
2192
|
* Creates a {@link Parser} instance
|
|
2107
2193
|
*
|
|
@@ -2115,10 +2201,10 @@ class ct {
|
|
|
2115
2201
|
* const parser = Bowser.getParser(window.navigator.userAgent);
|
|
2116
2202
|
* const result = parser.getResult();
|
|
2117
2203
|
*/
|
|
2118
|
-
static getParser(e,
|
|
2204
|
+
static getParser(e, t = !1) {
|
|
2119
2205
|
if (typeof e != "string")
|
|
2120
2206
|
throw new Error("UserAgent should be a string");
|
|
2121
|
-
return new
|
|
2207
|
+
return new W(e, t);
|
|
2122
2208
|
}
|
|
2123
2209
|
/**
|
|
2124
2210
|
* Creates a {@link Parser} instance and runs {@link Parser.getResult} immediately
|
|
@@ -2130,10 +2216,10 @@ class ct {
|
|
|
2130
2216
|
* const result = Bowser.parse(window.navigator.userAgent);
|
|
2131
2217
|
*/
|
|
2132
2218
|
static parse(e) {
|
|
2133
|
-
return new
|
|
2219
|
+
return new W(e).getResult();
|
|
2134
2220
|
}
|
|
2135
2221
|
static get BROWSER_MAP() {
|
|
2136
|
-
return
|
|
2222
|
+
return G;
|
|
2137
2223
|
}
|
|
2138
2224
|
static get ENGINE_MAP() {
|
|
2139
2225
|
return S;
|
|
@@ -2142,20 +2228,20 @@ class ct {
|
|
|
2142
2228
|
return g;
|
|
2143
2229
|
}
|
|
2144
2230
|
static get PLATFORMS_MAP() {
|
|
2145
|
-
return
|
|
2231
|
+
return h;
|
|
2146
2232
|
}
|
|
2147
2233
|
}
|
|
2148
|
-
const
|
|
2234
|
+
const I = Je.parse(navigator.userAgent), Xe = {
|
|
2149
2235
|
abTestGroup: null,
|
|
2150
2236
|
abTestName: null,
|
|
2151
|
-
browser:
|
|
2152
|
-
browserVersion:
|
|
2153
|
-
hardwarePlatform:
|
|
2237
|
+
browser: I.browser.name ?? null,
|
|
2238
|
+
browserVersion: I.browser.version ?? null,
|
|
2239
|
+
hardwarePlatform: I.browser.name === "Electron" ? "DESKTOP" : "WEB",
|
|
2154
2240
|
isOfflineModeStart: !1,
|
|
2155
2241
|
mobileNetworkType: null,
|
|
2156
2242
|
networkType: "WIFI",
|
|
2157
|
-
operatingSystem:
|
|
2158
|
-
operatingSystemVersion:
|
|
2243
|
+
operatingSystem: I.os.name ?? null,
|
|
2244
|
+
operatingSystemVersion: I.os.version ?? null,
|
|
2159
2245
|
screenHeight: window.screen.height,
|
|
2160
2246
|
screenWidth: window.screen.width,
|
|
2161
2247
|
sessionProductId: "",
|
|
@@ -2165,251 +2251,240 @@ const O = ct.parse(navigator.userAgent), dt = {
|
|
|
2165
2251
|
startReason: "IMPLICIT",
|
|
2166
2252
|
streamingSessionId: "",
|
|
2167
2253
|
timestamp: 0
|
|
2168
|
-
},
|
|
2254
|
+
}, Ze = await T(
|
|
2169
2255
|
"streaming_session_start",
|
|
2170
|
-
|
|
2256
|
+
Xe
|
|
2171
2257
|
);
|
|
2172
|
-
function
|
|
2173
|
-
return
|
|
2174
|
-
}
|
|
2175
|
-
function
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
}
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
}
|
|
2192
|
-
function pt(t) {
|
|
2193
|
-
return t != null;
|
|
2194
|
-
}
|
|
2195
|
-
async function de(t, e) {
|
|
2196
|
-
if (t) {
|
|
2197
|
-
const r = (await Promise.all(e.events)).filter(pt);
|
|
2198
|
-
e.events = r;
|
|
2199
|
-
const { clientId: s, token: n } = await v.credentialsProvider.getCredentials();
|
|
2200
|
-
if (!n)
|
|
2201
|
-
throw new Error("No accessToken");
|
|
2202
|
-
const o = {
|
|
2203
|
-
...e,
|
|
2204
|
-
accessToken: n,
|
|
2205
|
-
apiUrl: k("apiUrl"),
|
|
2206
|
-
appVersion: k("appVersion"),
|
|
2207
|
-
clientId: s,
|
|
2208
|
-
clientPlatform: k("clientPlatform"),
|
|
2209
|
-
eventUrl: k("eventUrl"),
|
|
2210
|
-
ts: b.now()
|
|
2211
|
-
};
|
|
2212
|
-
return t.postMessage(JSON.stringify(o)), o;
|
|
2213
|
-
} else
|
|
2214
|
-
console.warn("Event beacon is not running.");
|
|
2258
|
+
function et(r) {
|
|
2259
|
+
return Ze(r);
|
|
2260
|
+
}
|
|
2261
|
+
async function tt(r) {
|
|
2262
|
+
if (await P())
|
|
2263
|
+
return r();
|
|
2264
|
+
}
|
|
2265
|
+
async function q(r) {
|
|
2266
|
+
const e = {
|
|
2267
|
+
consentCategory: "NECESSARY",
|
|
2268
|
+
..."extras" in r && { extras: r.extras },
|
|
2269
|
+
group: r.group,
|
|
2270
|
+
name: r.name,
|
|
2271
|
+
payload: r.payload,
|
|
2272
|
+
version: r.version
|
|
2273
|
+
}, t = e.payload.streamingSessionId;
|
|
2274
|
+
e.name === "progress" && "streamingSessionId" in e.payload && delete e.payload.streamingSessionId, D.eventSender.sendEvent(e), t && await R.delete({
|
|
2275
|
+
name: e.name,
|
|
2276
|
+
streamingSessionId: t
|
|
2277
|
+
});
|
|
2215
2278
|
}
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
}
|
|
2229
|
-
function le(t) {
|
|
2230
|
-
return gt(
|
|
2231
|
-
() => de(_, {
|
|
2232
|
-
type: "streaming_metrics",
|
|
2233
|
-
...t
|
|
2234
|
-
})
|
|
2235
|
-
);
|
|
2279
|
+
async function j(r) {
|
|
2280
|
+
return tt(async () => {
|
|
2281
|
+
for (const e of r)
|
|
2282
|
+
if (e) {
|
|
2283
|
+
const t = await e;
|
|
2284
|
+
t && await q({
|
|
2285
|
+
group: "streaming_metrics",
|
|
2286
|
+
name: t.name,
|
|
2287
|
+
payload: t.payload,
|
|
2288
|
+
version: 2
|
|
2289
|
+
});
|
|
2290
|
+
}
|
|
2291
|
+
});
|
|
2236
2292
|
}
|
|
2237
|
-
function
|
|
2238
|
-
const e =
|
|
2239
|
-
return (
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
);
|
|
2293
|
+
function rt(r = !0) {
|
|
2294
|
+
const e = r && "crypto" in window && "getRandomValues" in crypto;
|
|
2295
|
+
return ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, (t) => {
|
|
2296
|
+
const s = e ? crypto.getRandomValues(new Uint8Array(1))[0] : Math.floor(256 * Math.random());
|
|
2297
|
+
return (t ^ (s ?? 0) & 15 >> t / 4).toString(16);
|
|
2298
|
+
});
|
|
2243
2299
|
}
|
|
2244
|
-
|
|
2245
|
-
|
|
2300
|
+
const L = {
|
|
2301
|
+
BTS: "application/vnd.tidal.bts",
|
|
2302
|
+
DASH: "application/dash+xml",
|
|
2303
|
+
EMU: "application/vnd.tidal.emu",
|
|
2304
|
+
HLS: "application/vnd.apple.mpegurl"
|
|
2305
|
+
};
|
|
2306
|
+
function st(r) {
|
|
2307
|
+
return JSON.parse(atob(r));
|
|
2246
2308
|
}
|
|
2247
|
-
function
|
|
2248
|
-
if ("codecs" in
|
|
2249
|
-
switch (
|
|
2309
|
+
function it(r, e) {
|
|
2310
|
+
if ("codecs" in r)
|
|
2311
|
+
switch (r.codecs) {
|
|
2250
2312
|
case "aac":
|
|
2251
2313
|
return "aac";
|
|
2252
|
-
case "mp4a.40.2":
|
|
2253
|
-
return "mp4a.40.2";
|
|
2254
2314
|
case "aac+":
|
|
2255
2315
|
return "aac+";
|
|
2256
|
-
case "mp4a.40.5":
|
|
2257
|
-
return "mp4a.40.5";
|
|
2258
2316
|
case "flac":
|
|
2259
2317
|
return "flac";
|
|
2260
|
-
case "mqa":
|
|
2261
|
-
return "mqa";
|
|
2262
2318
|
case "mp3":
|
|
2263
2319
|
return "mp3";
|
|
2320
|
+
case "mp4a.40.2":
|
|
2321
|
+
return "mp4a.40.2";
|
|
2322
|
+
case "mp4a.40.5":
|
|
2323
|
+
return "mp4a.40.5";
|
|
2264
2324
|
}
|
|
2265
2325
|
else if (e)
|
|
2266
2326
|
switch (e) {
|
|
2267
|
-
case "LOW":
|
|
2268
|
-
return "mp4a.40.5";
|
|
2269
|
-
case "HIGH":
|
|
2270
|
-
return "mp4a.40.2";
|
|
2271
|
-
case "LOSSLESS":
|
|
2272
2327
|
case "HI_RES":
|
|
2273
2328
|
case "HI_RES_LOSSLESS":
|
|
2329
|
+
case "LOSSLESS":
|
|
2274
2330
|
return "flac";
|
|
2331
|
+
case "HIGH":
|
|
2332
|
+
return "mp4a.40.2";
|
|
2333
|
+
case "LOW":
|
|
2334
|
+
return "mp4a.40.5";
|
|
2275
2335
|
}
|
|
2276
2336
|
return "none";
|
|
2277
2337
|
}
|
|
2278
|
-
function
|
|
2279
|
-
switch (
|
|
2280
|
-
case "mp3":
|
|
2281
|
-
return "mp3";
|
|
2338
|
+
function nt(r) {
|
|
2339
|
+
switch (r) {
|
|
2282
2340
|
case "aac":
|
|
2283
2341
|
case "aac+":
|
|
2284
2342
|
case "mp4a.40.2":
|
|
2285
2343
|
case "mp4a.40.5":
|
|
2286
2344
|
return "aac";
|
|
2287
2345
|
case "flac":
|
|
2288
|
-
|
|
2289
|
-
|
|
2346
|
+
return r;
|
|
2347
|
+
case "mp3":
|
|
2348
|
+
return "mp3";
|
|
2290
2349
|
default:
|
|
2291
2350
|
return;
|
|
2292
2351
|
}
|
|
2293
2352
|
}
|
|
2294
|
-
function
|
|
2295
|
-
const e = /codecs=(["'])?((?:.(?!\1|>))*.?)\1?/.exec(
|
|
2353
|
+
function at(r) {
|
|
2354
|
+
const e = /codecs=(["'])?((?:.(?!\1|>))*.?)\1?/.exec(r);
|
|
2296
2355
|
if (e === null)
|
|
2297
2356
|
return;
|
|
2298
|
-
const
|
|
2299
|
-
if (
|
|
2357
|
+
const t = e[2] ?? "";
|
|
2358
|
+
if (t.includes("mp4a") || t.includes("aac"))
|
|
2300
2359
|
return "aac";
|
|
2301
|
-
if (
|
|
2302
|
-
return
|
|
2303
|
-
}
|
|
2304
|
-
function
|
|
2305
|
-
const
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2360
|
+
if (t === "flac")
|
|
2361
|
+
return t;
|
|
2362
|
+
}
|
|
2363
|
+
function ot(r) {
|
|
2364
|
+
const e = /PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?/.exec(r);
|
|
2365
|
+
if (!e)
|
|
2366
|
+
throw new Error("Invalid duration format");
|
|
2367
|
+
const t = parseFloat(e[1] || "0"), s = parseFloat(e[2] || "0"), n = parseFloat(e[3] || "0");
|
|
2368
|
+
return t * 3600 + s * 60 + n;
|
|
2369
|
+
}
|
|
2370
|
+
function ct(r) {
|
|
2371
|
+
const e = /mediaPresentationDuration="([^"]+)"/.exec(r);
|
|
2372
|
+
if (e) {
|
|
2373
|
+
const t = e[1];
|
|
2374
|
+
if (t)
|
|
2375
|
+
return ot(t);
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
function dt(r) {
|
|
2379
|
+
const { prefetched: e, streamingSessionId: t } = r, s = "albumReplayGain" in r ? {
|
|
2380
|
+
albumPeakAmplitude: r.albumPeakAmplitude,
|
|
2381
|
+
albumReplayGain: r.albumReplayGain,
|
|
2382
|
+
trackPeakAmplitude: r.trackPeakAmplitude,
|
|
2383
|
+
trackReplayGain: r.trackReplayGain
|
|
2384
|
+
} : {}, n = "audioQuality" in r ? r.audioQuality : r.videoQuality, o = {
|
|
2311
2385
|
id: String(
|
|
2312
|
-
"videoId" in
|
|
2386
|
+
"videoId" in r ? r.videoId : r.trackId
|
|
2313
2387
|
),
|
|
2314
|
-
type: "trackId" in
|
|
2388
|
+
type: "trackId" in r ? "track" : "video"
|
|
2315
2389
|
};
|
|
2316
|
-
if (
|
|
2317
|
-
const a =
|
|
2390
|
+
if (r.manifestMimeType === L.BTS || r.manifestMimeType === L.EMU) {
|
|
2391
|
+
const a = st(r.manifest), c = a.urls[0], u = it(
|
|
2318
2392
|
a,
|
|
2319
|
-
"audioQuality" in
|
|
2393
|
+
"audioQuality" in r ? r.audioQuality : null
|
|
2320
2394
|
);
|
|
2321
|
-
let
|
|
2322
|
-
return "keyId" in a && (
|
|
2395
|
+
let d;
|
|
2396
|
+
return "keyId" in a && (d = a.keyId), "licenseSecurityToken" in r && (d = r.licenseSecurityToken), {
|
|
2323
2397
|
...s,
|
|
2324
|
-
bitDepth: "bitDepth" in
|
|
2325
|
-
codec:
|
|
2398
|
+
bitDepth: "bitDepth" in r ? r.bitDepth ?? void 0 : void 0,
|
|
2399
|
+
codec: nt(u),
|
|
2326
2400
|
prefetched: e,
|
|
2327
2401
|
quality: n,
|
|
2328
|
-
sampleRate: "sampleRate" in
|
|
2329
|
-
securityToken:
|
|
2330
|
-
streamFormat:
|
|
2402
|
+
sampleRate: "sampleRate" in r ? r.sampleRate ?? void 0 : void 0,
|
|
2403
|
+
securityToken: d,
|
|
2404
|
+
streamFormat: u,
|
|
2331
2405
|
streamUrl: c,
|
|
2332
|
-
streamingSessionId:
|
|
2406
|
+
streamingSessionId: t,
|
|
2333
2407
|
...o,
|
|
2334
|
-
expires:
|
|
2408
|
+
expires: r.expires
|
|
2335
2409
|
};
|
|
2336
2410
|
}
|
|
2337
|
-
if (
|
|
2338
|
-
const a = `data:${
|
|
2411
|
+
if (r.manifestMimeType === L.DASH) {
|
|
2412
|
+
const a = `data:${r.manifestMimeType};base64,${r.manifest}`, c = atob(r.manifest);
|
|
2339
2413
|
return {
|
|
2340
2414
|
...s,
|
|
2341
|
-
bitDepth: "bitDepth" in
|
|
2342
|
-
codec:
|
|
2415
|
+
bitDepth: "bitDepth" in r ? r.bitDepth ?? void 0 : void 0,
|
|
2416
|
+
codec: at(c),
|
|
2417
|
+
duration: ct(c),
|
|
2343
2418
|
prefetched: e,
|
|
2344
2419
|
quality: n,
|
|
2345
|
-
sampleRate: "sampleRate" in
|
|
2346
|
-
securityToken:
|
|
2420
|
+
sampleRate: "sampleRate" in r ? r.sampleRate ?? void 0 : void 0,
|
|
2421
|
+
securityToken: r.licenseSecurityToken,
|
|
2347
2422
|
streamUrl: a,
|
|
2348
|
-
streamingSessionId:
|
|
2423
|
+
streamingSessionId: t,
|
|
2349
2424
|
...o,
|
|
2350
|
-
expires:
|
|
2425
|
+
expires: r.expires
|
|
2351
2426
|
};
|
|
2352
2427
|
}
|
|
2353
2428
|
throw new TypeError(
|
|
2354
|
-
`${
|
|
2429
|
+
`${r.manifestMimeType} not supported as playback info manifest mime type.`
|
|
2355
2430
|
);
|
|
2356
2431
|
}
|
|
2357
|
-
const
|
|
2432
|
+
const K = async (r, e = {}, t = 3) => {
|
|
2358
2433
|
let s, n;
|
|
2359
2434
|
try {
|
|
2360
|
-
s = await fetch(
|
|
2435
|
+
s = await fetch(r, e);
|
|
2361
2436
|
} catch (c) {
|
|
2362
|
-
if (
|
|
2437
|
+
if (t === 0)
|
|
2363
2438
|
throw c;
|
|
2364
2439
|
n = null;
|
|
2365
2440
|
}
|
|
2366
2441
|
if (s?.ok)
|
|
2367
2442
|
return s;
|
|
2368
2443
|
const o = s && s.status >= 500 && s.status <= 599, a = n === null || o || s?.status === 429;
|
|
2369
|
-
if (
|
|
2370
|
-
const c = 500 * Math.abs(4 -
|
|
2444
|
+
if (t > 0 && a) {
|
|
2445
|
+
const c = 500 * Math.abs(4 - t);
|
|
2371
2446
|
return console.debug(
|
|
2372
2447
|
`Retrying request for ${Math.abs(
|
|
2373
|
-
4 -
|
|
2448
|
+
4 - t
|
|
2374
2449
|
)}th time in ${c}ms`
|
|
2375
|
-
), await
|
|
2450
|
+
), await fe(c), K(r, e, t - 1);
|
|
2376
2451
|
}
|
|
2377
2452
|
if (!s)
|
|
2378
2453
|
throw new Error("Retries exchaused. Cannot fetch playbackinfo.");
|
|
2379
2454
|
return s;
|
|
2380
2455
|
};
|
|
2381
|
-
function
|
|
2456
|
+
function lt(r, e) {
|
|
2382
2457
|
switch (e) {
|
|
2458
|
+
case 4010:
|
|
2459
|
+
return "PEMonthlyStreamQuotaExceeded";
|
|
2383
2460
|
case 4032:
|
|
2384
2461
|
case 4035:
|
|
2385
2462
|
return "PEContentNotAvailableInLocation";
|
|
2386
2463
|
case 4033:
|
|
2387
2464
|
return "PEContentNotAvailableForSubscription";
|
|
2388
|
-
case 4010:
|
|
2389
|
-
return "PEMonthlyStreamQuotaExceeded";
|
|
2390
2465
|
}
|
|
2391
|
-
return
|
|
2466
|
+
return r >= 500 && r < 600 || r === 429 ? "PERetryable" : r >= 400 && r < 500 ? "PENotAllowed" : "EUnexpected";
|
|
2392
2467
|
}
|
|
2393
|
-
async function
|
|
2468
|
+
async function ut(r) {
|
|
2394
2469
|
const {
|
|
2395
2470
|
accessToken: e,
|
|
2396
|
-
audioQuality:
|
|
2471
|
+
audioQuality: t,
|
|
2397
2472
|
clientId: s,
|
|
2398
2473
|
mediaProduct: n,
|
|
2399
2474
|
prefetch: o,
|
|
2400
2475
|
streamingSessionId: a
|
|
2401
|
-
} =
|
|
2476
|
+
} = r, c = _("apiUrl"), u = new URL(
|
|
2402
2477
|
`${c}/${n.productType}s/${n.productId}/playbackinfo`
|
|
2403
|
-
),
|
|
2404
|
-
n.productType === "video" ?
|
|
2405
|
-
const
|
|
2406
|
-
o &&
|
|
2478
|
+
), d = u.searchParams;
|
|
2479
|
+
n.productType === "video" ? d.set("videoquality", "HIGH") : d.set("audioquality", t), d.set("playbackmode", "STREAM"), d.set("assetpresentation", "FULL");
|
|
2480
|
+
const b = new Headers();
|
|
2481
|
+
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);
|
|
2407
2482
|
let M;
|
|
2408
2483
|
try {
|
|
2409
|
-
M = await
|
|
2410
|
-
|
|
2484
|
+
M = await K(
|
|
2485
|
+
u.toString(),
|
|
2411
2486
|
{
|
|
2412
|
-
headers:
|
|
2487
|
+
headers: b,
|
|
2413
2488
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2414
2489
|
// @ts-ignore - It is a thing.
|
|
2415
2490
|
importance: "high"
|
|
@@ -2417,36 +2492,62 @@ async function Et(t) {
|
|
|
2417
2492
|
3
|
|
2418
2493
|
);
|
|
2419
2494
|
} catch {
|
|
2420
|
-
throw new
|
|
2495
|
+
throw new C("PENetwork", "NPBI0");
|
|
2421
2496
|
}
|
|
2422
2497
|
const f = await M.json();
|
|
2423
2498
|
if ("status" in f) {
|
|
2424
|
-
const
|
|
2425
|
-
throw new
|
|
2499
|
+
const ae = `A${f.subStatus}`;
|
|
2500
|
+
throw new C(lt(f.status, f.subStatus), ae);
|
|
2426
2501
|
}
|
|
2427
|
-
const
|
|
2428
|
-
if (!
|
|
2429
|
-
throw new
|
|
2502
|
+
const ie = "trackId" in f, ne = "videoId" in f;
|
|
2503
|
+
if (!ie && !ne)
|
|
2504
|
+
throw new C("EUnexpected", "B9999");
|
|
2430
2505
|
return {
|
|
2431
2506
|
...f,
|
|
2507
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
2508
|
+
expires: Date.now() + 36e5,
|
|
2432
2509
|
prefetched: o
|
|
2433
2510
|
};
|
|
2434
2511
|
}
|
|
2435
|
-
|
|
2436
|
-
const {
|
|
2512
|
+
function ht(r) {
|
|
2513
|
+
const { mediaProduct: e, streamingSessionId: t } = r;
|
|
2514
|
+
return {
|
|
2515
|
+
assetPresentation: "FULL",
|
|
2516
|
+
audioMode: "STEREO",
|
|
2517
|
+
audioQuality: "LOW",
|
|
2518
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
2519
|
+
expires: Date.now() + 36e5,
|
|
2520
|
+
manifest: btoa(
|
|
2521
|
+
JSON.stringify({
|
|
2522
|
+
mimeType: L.HLS,
|
|
2523
|
+
urls: [
|
|
2524
|
+
`https://fsu.fa.tidal.com/storage/${e.productId}.m3u8`
|
|
2525
|
+
]
|
|
2526
|
+
})
|
|
2527
|
+
),
|
|
2528
|
+
manifestMimeType: L.EMU,
|
|
2529
|
+
prefetched: !1,
|
|
2530
|
+
streamType: "ON_DEMAND",
|
|
2531
|
+
streamingSessionId: t,
|
|
2532
|
+
trackId: e.productId
|
|
2533
|
+
};
|
|
2534
|
+
}
|
|
2535
|
+
async function mt(r) {
|
|
2536
|
+
const { streamingSessionId: e } = r, t = [];
|
|
2437
2537
|
performance.mark("streaming_metrics:playback_info_fetch:startTimestamp", {
|
|
2438
|
-
detail: e
|
|
2538
|
+
detail: e,
|
|
2539
|
+
startTime: y.now()
|
|
2439
2540
|
});
|
|
2440
2541
|
try {
|
|
2441
|
-
|
|
2442
|
-
if (s === void 0)
|
|
2542
|
+
let s;
|
|
2543
|
+
if (r.mediaProduct.productType === "demo" ? s = ht(r) : s = await ut(r), s === void 0)
|
|
2443
2544
|
throw new Error("Playback info was fetched, but undefined.");
|
|
2444
|
-
|
|
2545
|
+
N({
|
|
2445
2546
|
endReason: "COMPLETE",
|
|
2446
2547
|
streamingSessionId: e
|
|
2447
|
-
}).catch(console.error)
|
|
2548
|
+
}).catch(console.error);
|
|
2448
2549
|
const n = "adInfo" in s;
|
|
2449
|
-
return "trackId" in s ?
|
|
2550
|
+
return "trackId" in s ? z({
|
|
2450
2551
|
actualAssetPresentation: s.assetPresentation,
|
|
2451
2552
|
actualAudioMode: s.audioMode,
|
|
2452
2553
|
actualProductId: String(s.trackId),
|
|
@@ -2455,7 +2556,7 @@ async function Pt(t) {
|
|
|
2455
2556
|
hasAds: n,
|
|
2456
2557
|
productType: "TRACK",
|
|
2457
2558
|
streamingSessionId: e
|
|
2458
|
-
}).catch(console.error) :
|
|
2559
|
+
}).catch(console.error) : z({
|
|
2459
2560
|
actualAssetPresentation: s.assetPresentation,
|
|
2460
2561
|
actualAudioMode: void 0,
|
|
2461
2562
|
actualProductId: String(s.videoId),
|
|
@@ -2465,45 +2566,45 @@ async function Pt(t) {
|
|
|
2465
2566
|
productType: "VIDEO",
|
|
2466
2567
|
streamingSessionId: e
|
|
2467
2568
|
}).catch(console.error), performance.mark("streaming_metrics:playback_info_fetch:endTimestamp", {
|
|
2468
|
-
detail: e
|
|
2569
|
+
detail: e,
|
|
2570
|
+
startTime: y.now()
|
|
2469
2571
|
}), s;
|
|
2470
2572
|
} catch (s) {
|
|
2471
2573
|
throw performance.mark("streaming_metrics:playback_info_fetch:endTimestamp", {
|
|
2472
|
-
detail: e
|
|
2473
|
-
|
|
2574
|
+
detail: e,
|
|
2575
|
+
startTime: y.now()
|
|
2576
|
+
}), N({
|
|
2474
2577
|
endReason: "ERROR",
|
|
2475
2578
|
errorCode: s.message,
|
|
2476
2579
|
errorMessage: s.stack,
|
|
2477
2580
|
streamingSessionId: e
|
|
2478
|
-
}).catch(console.error),
|
|
2479
|
-
|
|
2581
|
+
}).catch(console.error), t.push(
|
|
2582
|
+
Qe({
|
|
2480
2583
|
streamingSessionId: e,
|
|
2481
|
-
timestamp:
|
|
2584
|
+
timestamp: y.timestamp(
|
|
2482
2585
|
"streaming_metrics:playback_info_fetch:endTimestamp"
|
|
2483
2586
|
)
|
|
2484
2587
|
})
|
|
2485
2588
|
), s;
|
|
2486
2589
|
} finally {
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
endTimestamp:
|
|
2590
|
+
t.push(
|
|
2591
|
+
N({
|
|
2592
|
+
endTimestamp: y.timestamp(
|
|
2490
2593
|
"streaming_metrics:playback_info_fetch:endTimestamp"
|
|
2491
2594
|
),
|
|
2492
|
-
startTimestamp:
|
|
2595
|
+
startTimestamp: y.timestamp(
|
|
2493
2596
|
"streaming_metrics:playback_info_fetch:startTimestamp"
|
|
2494
2597
|
),
|
|
2495
2598
|
streamingSessionId: e
|
|
2496
2599
|
})
|
|
2497
|
-
),
|
|
2498
|
-
events: r
|
|
2499
|
-
}).catch(console.error), performance.clearMarks(
|
|
2600
|
+
), j(t).catch(console.error), performance.clearMarks(
|
|
2500
2601
|
"streaming_metrics:playback_info_fetch:endTimestamp"
|
|
2501
2602
|
), performance.clearMarks(
|
|
2502
2603
|
"streaming_metrics:playback_info_fetch:startTimestamp"
|
|
2503
2604
|
);
|
|
2504
2605
|
}
|
|
2505
2606
|
}
|
|
2506
|
-
class
|
|
2607
|
+
class Y {
|
|
2507
2608
|
/**
|
|
2508
2609
|
* The current time position to restore playback from when connection is back online.
|
|
2509
2610
|
*/
|
|
@@ -2516,29 +2617,23 @@ class he {
|
|
|
2516
2617
|
static #t;
|
|
2517
2618
|
static #i;
|
|
2518
2619
|
static #n;
|
|
2519
|
-
static disable() {
|
|
2520
|
-
this.#r && (this.#t && window.removeEventListener("offline", this.#t, !1), this.#i && window.removeEventListener("online", this.#i, !1), this.#i = void 0, this.#t = void 0, this.#r = !1);
|
|
2521
|
-
}
|
|
2522
|
-
static enable() {
|
|
2523
|
-
this.#r || (this.#i = () => this.#o(), this.#t = () => this.#a(), window.addEventListener("offline", this.#t, !1), window.addEventListener("online", this.#i, !1), this.#r = !0);
|
|
2524
|
-
}
|
|
2525
2620
|
static #a() {
|
|
2526
2621
|
const { activePlayer: e } = p;
|
|
2527
|
-
|
|
2622
|
+
e?.hasStarted() && (this.#s = e.currentMediaProduct, this.#n = this.#d.bind(this), m.addEventListener(
|
|
2528
2623
|
"playback-state-change",
|
|
2529
2624
|
this.#n
|
|
2530
2625
|
));
|
|
2531
2626
|
}
|
|
2532
2627
|
static #o() {
|
|
2533
2628
|
const { activePlayer: e } = p;
|
|
2534
|
-
|
|
2629
|
+
e?.hasStarted() && (e.playbackState !== "PLAYING" && this.#s && (m.dispatchEvent(
|
|
2535
2630
|
new CustomEvent("load", {
|
|
2536
2631
|
detail: {
|
|
2537
2632
|
currentTime: this.#e,
|
|
2538
2633
|
mediaProduct: this.#s
|
|
2539
2634
|
}
|
|
2540
2635
|
})
|
|
2541
|
-
), this.#c()),
|
|
2636
|
+
), this.#c()), m.removeEventListener(
|
|
2542
2637
|
"playback-state-change",
|
|
2543
2638
|
this.#n
|
|
2544
2639
|
));
|
|
@@ -2550,36 +2645,42 @@ class he {
|
|
|
2550
2645
|
const { activePlayer: e } = p;
|
|
2551
2646
|
e && (this.#e = e.currentTime);
|
|
2552
2647
|
}
|
|
2648
|
+
static disable() {
|
|
2649
|
+
this.#r && (this.#t && window.removeEventListener("offline", this.#t, !1), this.#i && window.removeEventListener("online", this.#i, !1), this.#i = void 0, this.#t = void 0, this.#r = !1);
|
|
2650
|
+
}
|
|
2651
|
+
static enable() {
|
|
2652
|
+
this.#r || (this.#i = () => this.#o(), this.#t = () => this.#a(), window.addEventListener("offline", this.#t, !1), window.addEventListener("online", this.#i, !1), this.#r = !0);
|
|
2653
|
+
}
|
|
2553
2654
|
}
|
|
2554
|
-
const
|
|
2555
|
-
function
|
|
2556
|
-
return new CustomEvent(
|
|
2557
|
-
detail:
|
|
2655
|
+
const pt = "streaming-privileges-revoked";
|
|
2656
|
+
function ft(r) {
|
|
2657
|
+
return new CustomEvent(pt, {
|
|
2658
|
+
detail: r
|
|
2558
2659
|
});
|
|
2559
2660
|
}
|
|
2560
|
-
let
|
|
2561
|
-
async function
|
|
2562
|
-
const e =
|
|
2661
|
+
let k;
|
|
2662
|
+
async function J(r) {
|
|
2663
|
+
const e = _("apiUrl"), t = await fetch(e + "/rt/connect", {
|
|
2563
2664
|
headers: new Headers({
|
|
2564
|
-
Authorization: "Bearer " +
|
|
2665
|
+
Authorization: "Bearer " + r,
|
|
2565
2666
|
"Content-Type": "application/json"
|
|
2566
2667
|
}),
|
|
2567
2668
|
method: "POST"
|
|
2568
|
-
}), { url: s } = await
|
|
2669
|
+
}), { url: s } = await t.json();
|
|
2569
2670
|
return s;
|
|
2570
2671
|
}
|
|
2571
|
-
function
|
|
2672
|
+
function X(r) {
|
|
2572
2673
|
return new Promise((e) => {
|
|
2573
|
-
|
|
2674
|
+
r.addEventListener("open", () => e(), { once: !0 });
|
|
2574
2675
|
});
|
|
2575
2676
|
}
|
|
2576
|
-
class
|
|
2677
|
+
class F {
|
|
2577
2678
|
#e;
|
|
2578
2679
|
#r;
|
|
2579
2680
|
#s;
|
|
2580
2681
|
#t;
|
|
2581
2682
|
constructor() {
|
|
2582
|
-
this.#t = void 0, this.#r = this.#i(),
|
|
2683
|
+
this.#t = void 0, this.#r = this.#i(), m.addEventListener("user-action", () => {
|
|
2583
2684
|
this.connected && this.userAction().then().catch(console.error);
|
|
2584
2685
|
});
|
|
2585
2686
|
}
|
|
@@ -2587,23 +2688,23 @@ class z {
|
|
|
2587
2688
|
* Call this method to ensure pushkin is running.
|
|
2588
2689
|
*/
|
|
2589
2690
|
static async ensure() {
|
|
2590
|
-
await
|
|
2691
|
+
await P() && (k ? k.connected || await k.reconnect() : k = new F());
|
|
2591
2692
|
}
|
|
2592
2693
|
/**
|
|
2593
2694
|
* Call this method when credentials changes to re-setup pushkin with the new credentials
|
|
2594
2695
|
*/
|
|
2595
2696
|
static async refresh() {
|
|
2596
|
-
if (!await
|
|
2697
|
+
if (!await P())
|
|
2597
2698
|
return;
|
|
2598
|
-
const e = await
|
|
2599
|
-
|
|
2699
|
+
const e = await V();
|
|
2700
|
+
k && e && k.reconnect().catch(console.error);
|
|
2600
2701
|
}
|
|
2601
2702
|
async #i() {
|
|
2602
|
-
const e = await
|
|
2703
|
+
const e = await V();
|
|
2603
2704
|
if (!e)
|
|
2604
2705
|
throw new Error("No access token to connect to Pushkin.");
|
|
2605
|
-
const
|
|
2606
|
-
|
|
2706
|
+
const t = await J(e);
|
|
2707
|
+
t && (this.#t = new WebSocket(t), await X(this.#t), this.#s = (s) => this.#o(s.data), this.#e = () => this.#a(), this.#t.addEventListener("message", this.#s, !1), this.#t.addEventListener("closed", this.#e, !1), window.addEventListener("online", () => this.#a(), {
|
|
2607
2708
|
once: !0
|
|
2608
2709
|
}));
|
|
2609
2710
|
}
|
|
@@ -2618,12 +2719,12 @@ class z {
|
|
|
2618
2719
|
this.#r = this.#i();
|
|
2619
2720
|
}
|
|
2620
2721
|
#o(e) {
|
|
2621
|
-
const
|
|
2622
|
-
switch (
|
|
2722
|
+
const t = JSON.parse(e);
|
|
2723
|
+
switch (t.type) {
|
|
2623
2724
|
case "PRIVILEGED_SESSION_NOTIFICATION": {
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
String(
|
|
2725
|
+
m.dispatchEvent(
|
|
2726
|
+
ft(
|
|
2727
|
+
String(t.payload.clientDisplayName)
|
|
2627
2728
|
)
|
|
2628
2729
|
), p.activePlayer?.pause();
|
|
2629
2730
|
break;
|
|
@@ -2632,7 +2733,7 @@ class z {
|
|
|
2632
2733
|
this.reconnect().catch(console.error);
|
|
2633
2734
|
break;
|
|
2634
2735
|
default:
|
|
2635
|
-
console.warn("Unhandled event from Pushkin: ",
|
|
2736
|
+
console.warn("Unhandled event from Pushkin: ", t);
|
|
2636
2737
|
break;
|
|
2637
2738
|
}
|
|
2638
2739
|
}
|
|
@@ -2648,7 +2749,7 @@ class z {
|
|
|
2648
2749
|
try {
|
|
2649
2750
|
await this.#n({
|
|
2650
2751
|
payload: {
|
|
2651
|
-
startedAt:
|
|
2752
|
+
startedAt: y.now()
|
|
2652
2753
|
},
|
|
2653
2754
|
type: "USER_ACTION"
|
|
2654
2755
|
});
|
|
@@ -2660,16 +2761,19 @@ class z {
|
|
|
2660
2761
|
return this.#t && this.#t.readyState === WebSocket.OPEN;
|
|
2661
2762
|
}
|
|
2662
2763
|
}
|
|
2663
|
-
const
|
|
2764
|
+
const gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2664
2765
|
__proto__: null,
|
|
2665
|
-
Pushkin:
|
|
2666
|
-
fetchWebSocketURL:
|
|
2667
|
-
socketOpen:
|
|
2766
|
+
Pushkin: F,
|
|
2767
|
+
fetchWebSocketURL: J,
|
|
2768
|
+
socketOpen: X
|
|
2668
2769
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2669
|
-
async function
|
|
2670
|
-
|
|
2770
|
+
async function yt() {
|
|
2771
|
+
Le(), Y.disable(), await Te();
|
|
2772
|
+
}
|
|
2773
|
+
function Ut(r, e) {
|
|
2774
|
+
return r === "FULL" && e.sourceType !== "PRIVATE_LINK_SHARING";
|
|
2671
2775
|
}
|
|
2672
|
-
const
|
|
2776
|
+
const wt = {
|
|
2673
2777
|
actions: [],
|
|
2674
2778
|
actualAssetPresentation: "PREVIEW",
|
|
2675
2779
|
actualAudioMode: "STEREO",
|
|
@@ -2685,171 +2789,219 @@ const At = {
|
|
|
2685
2789
|
sourceType: "",
|
|
2686
2790
|
startAssetPosition: -1,
|
|
2687
2791
|
startTimestamp: -1
|
|
2688
|
-
},
|
|
2792
|
+
}, Z = await T(
|
|
2689
2793
|
"playback_session",
|
|
2690
|
-
|
|
2794
|
+
wt
|
|
2691
2795
|
);
|
|
2692
|
-
function
|
|
2693
|
-
|
|
2796
|
+
async function Vt(r) {
|
|
2797
|
+
const e = await Z(r);
|
|
2798
|
+
if (!e) {
|
|
2799
|
+
console.error("reducedData is undefined");
|
|
2800
|
+
return;
|
|
2801
|
+
}
|
|
2802
|
+
const { name: t, streamingSessionId: s } = e, { extras: n, ...o } = e.payload;
|
|
2803
|
+
return {
|
|
2804
|
+
extras: n,
|
|
2805
|
+
name: t,
|
|
2806
|
+
payload: o,
|
|
2807
|
+
streamingSessionId: s
|
|
2808
|
+
};
|
|
2694
2809
|
}
|
|
2695
|
-
function
|
|
2696
|
-
return
|
|
2810
|
+
function zt(r, e) {
|
|
2811
|
+
return Z({
|
|
2697
2812
|
actions: [e],
|
|
2698
|
-
streamingSessionId:
|
|
2813
|
+
streamingSessionId: r
|
|
2699
2814
|
});
|
|
2700
2815
|
}
|
|
2701
|
-
|
|
2702
|
-
|
|
2816
|
+
function Wt(r) {
|
|
2817
|
+
switch (r) {
|
|
2818
|
+
case "demo":
|
|
2819
|
+
return "UC";
|
|
2820
|
+
case "video":
|
|
2821
|
+
return "VIDEO";
|
|
2822
|
+
case "track":
|
|
2823
|
+
default:
|
|
2824
|
+
return "TRACK";
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
async function $t(r) {
|
|
2828
|
+
const e = await P();
|
|
2829
|
+
for (const t of r)
|
|
2830
|
+
if (t) {
|
|
2831
|
+
const s = await t;
|
|
2832
|
+
s && await q({
|
|
2833
|
+
..."extras" in s && { extras: s.extras },
|
|
2834
|
+
group: e ? "play_log" : "play_log_open",
|
|
2835
|
+
name: s.name,
|
|
2836
|
+
payload: s.payload,
|
|
2837
|
+
version: 2
|
|
2838
|
+
});
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
async function ee(r, e = 0, t = !1) {
|
|
2842
|
+
if (!D.hasEventSender())
|
|
2843
|
+
throw new Error("Playback not allowed without an event sender.");
|
|
2844
|
+
if (await y.synchronize(), F.ensure().catch(console.error), p.activePlayer?.nextItem && p.activePlayer.nextItem.mediaProduct.productId === r.productId) {
|
|
2703
2845
|
const f = p.activePlayer;
|
|
2704
2846
|
return performance.mark(
|
|
2705
2847
|
"streaming_metrics:playback_statistics:idealStartTimestamp",
|
|
2706
|
-
{
|
|
2707
|
-
|
|
2848
|
+
{
|
|
2849
|
+
detail: p.preloadedStreamingSessionId,
|
|
2850
|
+
startTime: y.now()
|
|
2851
|
+
}
|
|
2852
|
+
), await f.reset({ keepPreload: !0 }), r.referenceId && p.preloadedStreamingSessionId && f.overwriteMediaProduct(
|
|
2708
2853
|
p.preloadedStreamingSessionId,
|
|
2709
|
-
|
|
2854
|
+
r
|
|
2710
2855
|
), f.skipToPreloadedMediaProduct();
|
|
2711
2856
|
}
|
|
2712
|
-
const s =
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
]
|
|
2724
|
-
}).catch(console.error), performance.mark(
|
|
2857
|
+
const s = yt(), n = rt();
|
|
2858
|
+
j([
|
|
2859
|
+
et({
|
|
2860
|
+
sessionProductId: r.productId,
|
|
2861
|
+
sessionProductType: r.productType === "track" ? "TRACK" : "VIDEO",
|
|
2862
|
+
sessionType: "PLAYBACK",
|
|
2863
|
+
startReason: "EXPLICIT",
|
|
2864
|
+
streamingSessionId: n,
|
|
2865
|
+
timestamp: y.now()
|
|
2866
|
+
})
|
|
2867
|
+
]).catch(console.error), performance.mark(
|
|
2725
2868
|
"streaming_metrics:playback_statistics:idealStartTimestamp",
|
|
2726
|
-
{
|
|
2869
|
+
{
|
|
2870
|
+
detail: n,
|
|
2871
|
+
startTime: y.now()
|
|
2872
|
+
}
|
|
2727
2873
|
);
|
|
2728
|
-
const { clientId: o, token: a } = await v.credentialsProvider.getCredentials(), c =
|
|
2729
|
-
let
|
|
2874
|
+
const { clientId: o, token: a } = await v.credentialsProvider.getCredentials(), c = _("streamingWifiAudioQuality");
|
|
2875
|
+
let u = null;
|
|
2730
2876
|
try {
|
|
2731
|
-
|
|
2877
|
+
u = await mt({
|
|
2732
2878
|
accessToken: a,
|
|
2733
2879
|
audioQuality: c,
|
|
2734
2880
|
clientId: o,
|
|
2735
|
-
mediaProduct:
|
|
2736
|
-
prefetch:
|
|
2881
|
+
mediaProduct: r,
|
|
2882
|
+
prefetch: t,
|
|
2737
2883
|
streamingSessionId: n
|
|
2738
2884
|
});
|
|
2739
2885
|
} catch (f) {
|
|
2740
|
-
f instanceof
|
|
2886
|
+
f instanceof C && m.dispatchError(f), document.location.href.includes("localhost") && console.error(f);
|
|
2741
2887
|
}
|
|
2742
|
-
if (!
|
|
2888
|
+
if (!u)
|
|
2743
2889
|
return;
|
|
2744
|
-
const
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
), await s,
|
|
2749
|
-
const
|
|
2750
|
-
|
|
2751
|
-
|
|
2890
|
+
const d = dt(u);
|
|
2891
|
+
H.saveStreamInfo(
|
|
2892
|
+
d.streamingSessionId,
|
|
2893
|
+
d
|
|
2894
|
+
), await s, Y.enable();
|
|
2895
|
+
const b = "trackId" in u ? u.audioQuality : void 0, M = await _e(
|
|
2896
|
+
r.productType,
|
|
2897
|
+
b
|
|
2752
2898
|
);
|
|
2753
|
-
return
|
|
2899
|
+
return Ie(M), M.load(
|
|
2754
2900
|
{
|
|
2755
2901
|
assetPosition: e,
|
|
2756
|
-
mediaProduct:
|
|
2757
|
-
playbackInfo:
|
|
2758
|
-
streamInfo:
|
|
2902
|
+
mediaProduct: r,
|
|
2903
|
+
playbackInfo: u,
|
|
2904
|
+
streamInfo: d
|
|
2759
2905
|
},
|
|
2760
2906
|
"explicit"
|
|
2761
2907
|
);
|
|
2762
2908
|
}
|
|
2763
|
-
|
|
2764
|
-
if (
|
|
2765
|
-
const { currentTime: e, mediaProduct:
|
|
2766
|
-
|
|
2909
|
+
m.addEventListener("load", (r) => {
|
|
2910
|
+
if (r instanceof CustomEvent) {
|
|
2911
|
+
const { currentTime: e, mediaProduct: t } = r.detail;
|
|
2912
|
+
ee(t, e).then().catch(console.error);
|
|
2767
2913
|
}
|
|
2768
2914
|
});
|
|
2769
|
-
function
|
|
2915
|
+
function bt() {
|
|
2770
2916
|
return p.activePlayer?.pause();
|
|
2771
2917
|
}
|
|
2772
|
-
async function
|
|
2773
|
-
await
|
|
2774
|
-
const { activePlayer:
|
|
2775
|
-
return
|
|
2918
|
+
async function vt() {
|
|
2919
|
+
await y.synchronize();
|
|
2920
|
+
const { activePlayer: r } = p;
|
|
2921
|
+
return r ? (m.dispatchEvent(new CustomEvent("user-action")), r.play()) : Promise.reject(new Error("No active player"));
|
|
2776
2922
|
}
|
|
2777
|
-
async function
|
|
2923
|
+
async function St(r) {
|
|
2778
2924
|
const { activePlayer: e } = p;
|
|
2779
|
-
return e?.seek(
|
|
2925
|
+
return e?.seek(r);
|
|
2780
2926
|
}
|
|
2781
|
-
function
|
|
2782
|
-
v.credentialsProvider =
|
|
2927
|
+
function Qt(r) {
|
|
2928
|
+
v.credentialsProvider = r;
|
|
2783
2929
|
}
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
return new CustomEvent(Ft, {
|
|
2787
|
-
detail: t
|
|
2788
|
-
});
|
|
2930
|
+
function Gt(r) {
|
|
2931
|
+
D.eventSender = r;
|
|
2789
2932
|
}
|
|
2790
|
-
const
|
|
2791
|
-
function
|
|
2792
|
-
return new CustomEvent(
|
|
2793
|
-
detail:
|
|
2933
|
+
const Mt = "active-device-changed";
|
|
2934
|
+
function qt(r) {
|
|
2935
|
+
return new CustomEvent(Mt, {
|
|
2936
|
+
detail: r
|
|
2794
2937
|
});
|
|
2795
2938
|
}
|
|
2796
|
-
const
|
|
2797
|
-
function
|
|
2798
|
-
return new CustomEvent(
|
|
2799
|
-
detail:
|
|
2939
|
+
const Et = "active-device-mode-changed";
|
|
2940
|
+
function jt(r) {
|
|
2941
|
+
return new CustomEvent(Et, {
|
|
2942
|
+
detail: r
|
|
2800
2943
|
});
|
|
2801
2944
|
}
|
|
2802
|
-
|
|
2803
|
-
function
|
|
2804
|
-
const { activePlayer:
|
|
2805
|
-
if (!
|
|
2945
|
+
y.synchronize().then().catch(console.error);
|
|
2946
|
+
function te() {
|
|
2947
|
+
const { activePlayer: r } = p;
|
|
2948
|
+
if (!r)
|
|
2806
2949
|
return null;
|
|
2807
|
-
switch (
|
|
2808
|
-
case "shakaPlayer":
|
|
2809
|
-
return t.mediaElement;
|
|
2950
|
+
switch (r.name) {
|
|
2810
2951
|
case "browserPlayer":
|
|
2811
|
-
return
|
|
2952
|
+
return r.mediaElement;
|
|
2953
|
+
case "shakaPlayer":
|
|
2954
|
+
return r.mediaElement;
|
|
2812
2955
|
default:
|
|
2813
2956
|
return null;
|
|
2814
2957
|
}
|
|
2815
2958
|
}
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2959
|
+
function kt() {
|
|
2960
|
+
const r = localStorage.getItem("ssuid");
|
|
2961
|
+
try {
|
|
2962
|
+
r && indexedDB.deleteDatabase("streaming-sessions-" + r);
|
|
2963
|
+
} catch (e) {
|
|
2964
|
+
console.warn(`DB streaming-sessions-${r} could not be deleted`), console.error(e);
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
2967
|
+
he().then().catch(console.error);
|
|
2968
|
+
pe().then().catch(console.error);
|
|
2969
|
+
kt();
|
|
2970
|
+
const U = String.raw, Pt = String.raw;
|
|
2971
|
+
function re(r) {
|
|
2972
|
+
if (r === void 0)
|
|
2821
2973
|
return "0:00";
|
|
2822
|
-
const e = parseInt(String(
|
|
2974
|
+
const e = parseInt(String(r), 10), t = Math.floor(e / 3600), s = Math.floor((e - t * 3600) / 60), n = e - t * 3600 - s * 60;
|
|
2823
2975
|
let o = "";
|
|
2824
|
-
if (
|
|
2976
|
+
if (t !== 0) {
|
|
2825
2977
|
const a = s < 10 ? `0${s}` : String(s);
|
|
2826
|
-
o = `${
|
|
2978
|
+
o = `${t}:${a}:`;
|
|
2827
2979
|
} else
|
|
2828
2980
|
o = `${s}:`;
|
|
2829
2981
|
return o += n < 10 ? `0${n}` : String(n), o;
|
|
2830
2982
|
}
|
|
2831
|
-
function
|
|
2832
|
-
const e = typeof
|
|
2833
|
-
if (c === 0 &&
|
|
2983
|
+
function se(r = 0) {
|
|
2984
|
+
const e = typeof r == "number" ? r : parseInt(r, 10), t = Math.floor(e / 3600) % 24, s = Math.floor(e / 60) % 60, n = e % 60, o = (c, u) => {
|
|
2985
|
+
if (c === 0 && u !== 1)
|
|
2834
2986
|
return "";
|
|
2835
|
-
let
|
|
2836
|
-
switch (
|
|
2987
|
+
let d;
|
|
2988
|
+
switch (u) {
|
|
2837
2989
|
case 0:
|
|
2838
|
-
|
|
2990
|
+
d = "H";
|
|
2839
2991
|
break;
|
|
2840
2992
|
case 1:
|
|
2841
|
-
|
|
2993
|
+
d = "M";
|
|
2842
2994
|
break;
|
|
2843
2995
|
default:
|
|
2844
|
-
|
|
2996
|
+
d = "S";
|
|
2845
2997
|
break;
|
|
2846
2998
|
}
|
|
2847
|
-
return `${
|
|
2999
|
+
return `${d}${c}`;
|
|
2848
3000
|
};
|
|
2849
|
-
return `P${[
|
|
3001
|
+
return `P${[t, s, n].map(o).join("")}`;
|
|
2850
3002
|
}
|
|
2851
|
-
const
|
|
2852
|
-
class
|
|
3003
|
+
const Tt = "tidal-current-time";
|
|
3004
|
+
class It extends HTMLElement {
|
|
2853
3005
|
#e = void 0;
|
|
2854
3006
|
#r = /* @__PURE__ */ new Set();
|
|
2855
3007
|
#s;
|
|
@@ -2859,18 +3011,18 @@ class Ut extends HTMLElement {
|
|
|
2859
3011
|
super(), this.#i = (e) => this.renderTime(e.target.currentTime), this.#t = () => this.renderTime(0), this.#s = this.#n.bind(this);
|
|
2860
3012
|
}
|
|
2861
3013
|
#n() {
|
|
2862
|
-
const e =
|
|
3014
|
+
const e = te();
|
|
2863
3015
|
e && this.#e && !this.#r.has(e) && (e.addEventListener("timeupdate", this.#i, !1), this.#r.add(e));
|
|
2864
3016
|
}
|
|
2865
3017
|
connectedCallback() {
|
|
2866
3018
|
const e = this.attachShadow({ mode: "open" });
|
|
2867
3019
|
e.innerHTML = "<time></time>";
|
|
2868
|
-
const
|
|
2869
|
-
this.#e === void 0 &&
|
|
3020
|
+
const t = e.querySelector("time");
|
|
3021
|
+
this.#e === void 0 && t !== null && (this.#e = t), this.renderTime(Fe()), m.addEventListener(
|
|
2870
3022
|
"media-product-transition",
|
|
2871
3023
|
this.#s,
|
|
2872
3024
|
!1
|
|
2873
|
-
),
|
|
3025
|
+
), m.addEventListener("ended", this.#t, !1);
|
|
2874
3026
|
}
|
|
2875
3027
|
disconnectedCallback() {
|
|
2876
3028
|
for (let e of this.#r)
|
|
@@ -2879,31 +3031,31 @@ class Ut extends HTMLElement {
|
|
|
2879
3031
|
this.#i,
|
|
2880
3032
|
!1
|
|
2881
3033
|
);
|
|
2882
|
-
|
|
3034
|
+
m.removeEventListener(
|
|
2883
3035
|
"media-product-transition",
|
|
2884
3036
|
this.#s,
|
|
2885
3037
|
!1
|
|
2886
|
-
),
|
|
3038
|
+
), m.removeEventListener("ended", this.#t, !1);
|
|
2887
3039
|
}
|
|
2888
3040
|
renderTime(e) {
|
|
2889
|
-
const
|
|
2890
|
-
this.#e && (this.#e.textContent =
|
|
3041
|
+
const t = Math.floor(e);
|
|
3042
|
+
this.#e && (this.#e.textContent = re(t), this.#e.setAttribute("datetime", se(t)));
|
|
2891
3043
|
}
|
|
2892
3044
|
}
|
|
2893
|
-
customElements.define(
|
|
2894
|
-
const
|
|
2895
|
-
class
|
|
3045
|
+
customElements.define(Tt, It);
|
|
3046
|
+
const Lt = "tidal-duration-time";
|
|
3047
|
+
class At extends HTMLElement {
|
|
2896
3048
|
#e;
|
|
2897
3049
|
#r = !1;
|
|
2898
3050
|
#s;
|
|
2899
3051
|
constructor() {
|
|
2900
3052
|
super(), this.#s = (e) => {
|
|
2901
|
-
const
|
|
2902
|
-
this.renderTime(
|
|
3053
|
+
const t = e;
|
|
3054
|
+
this.renderTime(t.detail.playbackContext.actualDuration);
|
|
2903
3055
|
}, this.#t();
|
|
2904
3056
|
}
|
|
2905
3057
|
#t() {
|
|
2906
|
-
this.#r || (
|
|
3058
|
+
this.#r || (m.addEventListener(
|
|
2907
3059
|
"media-product-transition",
|
|
2908
3060
|
this.#s,
|
|
2909
3061
|
!1
|
|
@@ -2915,54 +3067,51 @@ class zt extends HTMLElement {
|
|
|
2915
3067
|
}
|
|
2916
3068
|
connectedCallback() {
|
|
2917
3069
|
this.#t(), this.#i();
|
|
2918
|
-
const e = parseInt(String(this.textContent), 10),
|
|
2919
|
-
this.renderTime(
|
|
3070
|
+
const e = parseInt(String(this.textContent), 10), t = Number.isNaN(e) ? 0 : e;
|
|
3071
|
+
this.renderTime(Be()?.actualDuration ?? t);
|
|
2920
3072
|
}
|
|
2921
3073
|
disconnectedCallback() {
|
|
2922
|
-
|
|
3074
|
+
m.removeEventListener(
|
|
2923
3075
|
"media-product-transition",
|
|
2924
3076
|
this.#s,
|
|
2925
3077
|
!1
|
|
2926
3078
|
), this.#r = !1;
|
|
2927
3079
|
}
|
|
2928
3080
|
renderTime(e) {
|
|
2929
|
-
const
|
|
2930
|
-
this.#e && (this.#e.textContent =
|
|
3081
|
+
const t = parseInt(e.toFixed(0), 10);
|
|
3082
|
+
this.#e && (this.#e.textContent = re(t), this.#e.setAttribute("datetime", se(t)));
|
|
2931
3083
|
}
|
|
2932
3084
|
}
|
|
2933
|
-
customElements.define(
|
|
2934
|
-
const
|
|
2935
|
-
class
|
|
3085
|
+
customElements.define(Lt, At);
|
|
3086
|
+
const Ot = "tidal-play-trigger";
|
|
3087
|
+
class Ct extends HTMLElement {
|
|
2936
3088
|
#e;
|
|
2937
3089
|
#r = !1;
|
|
2938
3090
|
constructor() {
|
|
2939
|
-
super(), this.#e = (
|
|
2940
|
-
|
|
3091
|
+
super(), this.#e = () => {
|
|
3092
|
+
this.#s().catch(console.error);
|
|
2941
3093
|
}, this.#i();
|
|
2942
3094
|
}
|
|
2943
|
-
static get observedAttributes() {
|
|
2944
|
-
return ["product-id", "product-type"];
|
|
2945
|
-
}
|
|
2946
3095
|
async #s() {
|
|
2947
|
-
await this.#t(),
|
|
3096
|
+
await this.#t(), Q() === "PLAYING" ? bt() : await vt();
|
|
2948
3097
|
}
|
|
2949
3098
|
#t() {
|
|
2950
|
-
const e =
|
|
3099
|
+
const e = Ne()?.productId ?? void 0;
|
|
2951
3100
|
if (this.mediaProduct && this.mediaProduct.productId !== e)
|
|
2952
|
-
return
|
|
3101
|
+
return ee(this.mediaProduct, 0);
|
|
2953
3102
|
}
|
|
2954
3103
|
#i() {
|
|
2955
3104
|
this.#r || this.addEventListener("click", this.#e, { passive: !0 });
|
|
2956
3105
|
}
|
|
2957
3106
|
#n() {
|
|
2958
|
-
const e = this.attachShadow({ mode: "closed" }),
|
|
2959
|
-
|
|
3107
|
+
const e = this.attachShadow({ mode: "closed" }), t = document.createElement("style");
|
|
3108
|
+
t.textContent = U`
|
|
2960
3109
|
:host {
|
|
2961
3110
|
display: contents;
|
|
2962
3111
|
}
|
|
2963
3112
|
`;
|
|
2964
3113
|
const s = document.createElement("slot");
|
|
2965
|
-
e.appendChild(
|
|
3114
|
+
e.appendChild(t), e.appendChild(s);
|
|
2966
3115
|
}
|
|
2967
3116
|
connectedCallback() {
|
|
2968
3117
|
this.#i(), this.#n();
|
|
@@ -2976,17 +3125,20 @@ class Ht extends HTMLElement {
|
|
|
2976
3125
|
const e = this.getAttribute("product-id");
|
|
2977
3126
|
if (!e)
|
|
2978
3127
|
return;
|
|
2979
|
-
const
|
|
3128
|
+
const t = this.getAttribute("product-type") === "video" ? "video" : "track";
|
|
2980
3129
|
return {
|
|
2981
3130
|
productId: e,
|
|
2982
|
-
productType:
|
|
3131
|
+
productType: t,
|
|
2983
3132
|
sourceId: "",
|
|
2984
3133
|
sourceType: ""
|
|
2985
3134
|
};
|
|
2986
3135
|
}
|
|
3136
|
+
static get observedAttributes() {
|
|
3137
|
+
return ["product-id", "product-type"];
|
|
3138
|
+
}
|
|
2987
3139
|
}
|
|
2988
|
-
customElements.define(
|
|
2989
|
-
const
|
|
3140
|
+
customElements.define(Ot, Ct);
|
|
3141
|
+
const _t = U`
|
|
2990
3142
|
:host {
|
|
2991
3143
|
display: inline-block;
|
|
2992
3144
|
}
|
|
@@ -3007,10 +3159,10 @@ const qt = j`
|
|
|
3007
3159
|
background-color: currentColor;
|
|
3008
3160
|
pointer-events: none;
|
|
3009
3161
|
}
|
|
3010
|
-
`,
|
|
3162
|
+
`, $ = {
|
|
3011
3163
|
NO_DURATION: "You need to set duration before you can start/stop the progress bar."
|
|
3012
3164
|
};
|
|
3013
|
-
class
|
|
3165
|
+
class Ft extends HTMLElement {
|
|
3014
3166
|
#e;
|
|
3015
3167
|
#r = 1;
|
|
3016
3168
|
#s = null;
|
|
@@ -3021,17 +3173,17 @@ class Qt extends HTMLElement {
|
|
|
3021
3173
|
#o;
|
|
3022
3174
|
constructor() {
|
|
3023
3175
|
super(), this.#t = (e) => {
|
|
3024
|
-
const
|
|
3025
|
-
if (this.duration =
|
|
3176
|
+
const t = e;
|
|
3177
|
+
if (this.duration = t.detail.playbackContext.actualDuration, Q() === "PLAYING")
|
|
3026
3178
|
try {
|
|
3027
3179
|
this.start();
|
|
3028
3180
|
} catch (s) {
|
|
3029
3181
|
console.warn(s);
|
|
3030
3182
|
}
|
|
3031
3183
|
}, this.#i = (e) => {
|
|
3032
|
-
const
|
|
3184
|
+
const t = e;
|
|
3033
3185
|
try {
|
|
3034
|
-
|
|
3186
|
+
t.detail.state === "PLAYING" ? this.start() : this.stop();
|
|
3035
3187
|
} catch (s) {
|
|
3036
3188
|
console.warn(s);
|
|
3037
3189
|
}
|
|
@@ -3040,20 +3192,20 @@ class Qt extends HTMLElement {
|
|
|
3040
3192
|
}, this.#c();
|
|
3041
3193
|
}
|
|
3042
3194
|
#c() {
|
|
3043
|
-
this.#n.has("media-product-transition") || (
|
|
3195
|
+
this.#n.has("media-product-transition") || (m.addEventListener(
|
|
3044
3196
|
"media-product-transition",
|
|
3045
3197
|
this.#t,
|
|
3046
3198
|
!1
|
|
3047
|
-
), this.#n.add("media-product-transition")), this.#n.has("playback-state-change") || (
|
|
3199
|
+
), this.#n.add("media-product-transition")), this.#n.has("playback-state-change") || (m.addEventListener(
|
|
3048
3200
|
"playback-state-change",
|
|
3049
3201
|
this.#i
|
|
3050
3202
|
), this.#n.add("playback-state-change")), this.#a && !this.#n.has("wrapper-click") && (this.#a.addEventListener("click", this.#o, !1), this.#n.add("wrapper-click"));
|
|
3051
3203
|
}
|
|
3052
3204
|
#d() {
|
|
3053
3205
|
const e = this.attachShadow({ mode: "closed" });
|
|
3054
|
-
e.innerHTML =
|
|
3206
|
+
e.innerHTML = Pt`
|
|
3055
3207
|
<style>
|
|
3056
|
-
${
|
|
3208
|
+
${_t}
|
|
3057
3209
|
</style>
|
|
3058
3210
|
<div id="wrapper">
|
|
3059
3211
|
<div id="indicator"></div>
|
|
@@ -3069,11 +3221,11 @@ class Qt extends HTMLElement {
|
|
|
3069
3221
|
this.#d(), this.#c();
|
|
3070
3222
|
}
|
|
3071
3223
|
disconnectedCallback() {
|
|
3072
|
-
|
|
3224
|
+
m.removeEventListener(
|
|
3073
3225
|
"media-product-transition",
|
|
3074
3226
|
this.#t,
|
|
3075
3227
|
!1
|
|
3076
|
-
),
|
|
3228
|
+
), m.removeEventListener(
|
|
3077
3229
|
"playback-state-change",
|
|
3078
3230
|
this.#i
|
|
3079
3231
|
), this.#a?.addEventListener("click", this.#o, !1), this.#n.clear();
|
|
@@ -3086,9 +3238,9 @@ class Qt extends HTMLElement {
|
|
|
3086
3238
|
*/
|
|
3087
3239
|
getMousePositionAsPercent(e) {
|
|
3088
3240
|
if (this.#a) {
|
|
3089
|
-
const
|
|
3090
|
-
left: Math.abs(
|
|
3091
|
-
width: Math.round(
|
|
3241
|
+
const t = this.#a.getBoundingClientRect(), s = {
|
|
3242
|
+
left: Math.abs(t.left + window.pageXOffset - e.pageX),
|
|
3243
|
+
width: Math.round(t.width)
|
|
3092
3244
|
};
|
|
3093
3245
|
return s.left / s.width;
|
|
3094
3246
|
}
|
|
@@ -3102,8 +3254,8 @@ class Qt extends HTMLElement {
|
|
|
3102
3254
|
* @param {MouseEvent | PointerEvent} event
|
|
3103
3255
|
*/
|
|
3104
3256
|
handleClick(e) {
|
|
3105
|
-
const
|
|
3106
|
-
this.currentTime = s,
|
|
3257
|
+
const t = this.getMousePositionAsPercent(e), s = this.#r * t;
|
|
3258
|
+
this.currentTime = s, St(s / 1e3);
|
|
3107
3259
|
}
|
|
3108
3260
|
/**
|
|
3109
3261
|
* Starts the animation if duration is defined.
|
|
@@ -3112,7 +3264,7 @@ class Qt extends HTMLElement {
|
|
|
3112
3264
|
*/
|
|
3113
3265
|
start() {
|
|
3114
3266
|
if (!this.#e)
|
|
3115
|
-
throw new Error(
|
|
3267
|
+
throw new Error($.NO_DURATION);
|
|
3116
3268
|
this.#e.play();
|
|
3117
3269
|
}
|
|
3118
3270
|
/**
|
|
@@ -3122,7 +3274,7 @@ class Qt extends HTMLElement {
|
|
|
3122
3274
|
*/
|
|
3123
3275
|
stop() {
|
|
3124
3276
|
if (!this.#e)
|
|
3125
|
-
throw new Error(
|
|
3277
|
+
throw new Error($.NO_DURATION);
|
|
3126
3278
|
this.#e.pause();
|
|
3127
3279
|
}
|
|
3128
3280
|
/**
|
|
@@ -3138,7 +3290,7 @@ class Qt extends HTMLElement {
|
|
|
3138
3290
|
*/
|
|
3139
3291
|
set duration(e) {
|
|
3140
3292
|
this.#r = e * 1e3;
|
|
3141
|
-
const
|
|
3293
|
+
const t = [
|
|
3142
3294
|
{
|
|
3143
3295
|
transform: "translateX(-100%)"
|
|
3144
3296
|
},
|
|
@@ -3146,7 +3298,7 @@ class Qt extends HTMLElement {
|
|
|
3146
3298
|
transform: "translateX(0%)"
|
|
3147
3299
|
}
|
|
3148
3300
|
];
|
|
3149
|
-
this.#e = this.#s?.animate(
|
|
3301
|
+
this.#e = this.#s?.animate(t, {
|
|
3150
3302
|
duration: this.#r,
|
|
3151
3303
|
iterations: 1
|
|
3152
3304
|
}), this.#e?.pause();
|
|
@@ -3158,9 +3310,9 @@ class Qt extends HTMLElement {
|
|
|
3158
3310
|
this.stop(), this.#e && (this.#e.playbackRate = e), this.start();
|
|
3159
3311
|
}
|
|
3160
3312
|
}
|
|
3161
|
-
const
|
|
3162
|
-
customElements.define(
|
|
3163
|
-
const
|
|
3313
|
+
const Nt = "tidal-progress-bar";
|
|
3314
|
+
customElements.define(Nt, Ft);
|
|
3315
|
+
const Bt = U`
|
|
3164
3316
|
:host {
|
|
3165
3317
|
position: relative;
|
|
3166
3318
|
display: block;
|
|
@@ -3177,8 +3329,8 @@ const jt = j`
|
|
|
3177
3329
|
position: relative;
|
|
3178
3330
|
background-color: black;
|
|
3179
3331
|
}
|
|
3180
|
-
`,
|
|
3181
|
-
class
|
|
3332
|
+
`, xt = "tidal-video-view";
|
|
3333
|
+
class Rt extends HTMLElement {
|
|
3182
3334
|
#e = !1;
|
|
3183
3335
|
#r;
|
|
3184
3336
|
#s;
|
|
@@ -3186,19 +3338,19 @@ class Kt extends HTMLElement {
|
|
|
3186
3338
|
super(), this.#r = (e) => {
|
|
3187
3339
|
e.detail.mediaProduct.productType === "video" && this.mountPlayer();
|
|
3188
3340
|
}, this.#s = (e) => {
|
|
3189
|
-
const
|
|
3341
|
+
const t = e;
|
|
3190
3342
|
this.setAttribute(
|
|
3191
3343
|
"playback-state",
|
|
3192
|
-
|
|
3344
|
+
t.detail.state.toLocaleLowerCase()
|
|
3193
3345
|
);
|
|
3194
3346
|
}, this.#t();
|
|
3195
3347
|
}
|
|
3196
3348
|
#t() {
|
|
3197
|
-
this.#e || (
|
|
3349
|
+
this.#e || (m.addEventListener(
|
|
3198
3350
|
"media-product-transition",
|
|
3199
3351
|
this.#r,
|
|
3200
3352
|
!1
|
|
3201
|
-
),
|
|
3353
|
+
), m.addEventListener(
|
|
3202
3354
|
"playback-state-change",
|
|
3203
3355
|
this.#s,
|
|
3204
3356
|
!1
|
|
@@ -3206,62 +3358,60 @@ class Kt extends HTMLElement {
|
|
|
3206
3358
|
}
|
|
3207
3359
|
connectedCallback() {
|
|
3208
3360
|
this.#t();
|
|
3209
|
-
const e = this.attachShadow({ mode: "closed" }),
|
|
3210
|
-
|
|
3361
|
+
const e = this.attachShadow({ mode: "closed" }), t = document.createElement("style");
|
|
3362
|
+
t.textContent = Bt;
|
|
3211
3363
|
const s = document.createElement("slot");
|
|
3212
|
-
e.appendChild(
|
|
3364
|
+
e.appendChild(t), e.appendChild(s);
|
|
3213
3365
|
}
|
|
3214
3366
|
disconnectedCallback() {
|
|
3215
|
-
|
|
3367
|
+
m.removeEventListener(
|
|
3216
3368
|
"media-product-transition",
|
|
3217
3369
|
this.#r,
|
|
3218
3370
|
!1
|
|
3219
|
-
),
|
|
3371
|
+
), m.removeEventListener(
|
|
3220
3372
|
"playback-state-change",
|
|
3221
3373
|
this.#s,
|
|
3222
3374
|
!1
|
|
3223
3375
|
), this.#e = !0;
|
|
3224
3376
|
}
|
|
3225
3377
|
mountPlayer() {
|
|
3226
|
-
const e =
|
|
3378
|
+
const e = te();
|
|
3227
3379
|
e && (this.innerHTML = "", this.appendChild(e));
|
|
3228
3380
|
}
|
|
3229
3381
|
}
|
|
3230
|
-
customElements.define(
|
|
3382
|
+
customElements.define(xt, Rt);
|
|
3231
3383
|
export {
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
Jt as Q,
|
|
3241
|
-
Le as R,
|
|
3384
|
+
Ht as C,
|
|
3385
|
+
qt as G,
|
|
3386
|
+
Qt as H,
|
|
3387
|
+
E as I,
|
|
3388
|
+
Dt as L,
|
|
3389
|
+
H as P,
|
|
3390
|
+
Gt as Q,
|
|
3391
|
+
zt as R,
|
|
3242
3392
|
v as S,
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
le as j,
|
|
3256
|
-
Q as k,
|
|
3393
|
+
j as W,
|
|
3394
|
+
me as a,
|
|
3395
|
+
m as b,
|
|
3396
|
+
fe as c,
|
|
3397
|
+
$t as d,
|
|
3398
|
+
Qe as e,
|
|
3399
|
+
oe as f,
|
|
3400
|
+
Wt as g,
|
|
3401
|
+
Ut as h,
|
|
3402
|
+
ee as i,
|
|
3403
|
+
jt as j,
|
|
3404
|
+
_ as k,
|
|
3257
3405
|
p as l,
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3406
|
+
Je as m,
|
|
3407
|
+
rt as n,
|
|
3408
|
+
Tt as o,
|
|
3409
|
+
Lt as p,
|
|
3410
|
+
z as q,
|
|
3411
|
+
Ot as r,
|
|
3412
|
+
Nt as s,
|
|
3413
|
+
xt as t,
|
|
3414
|
+
Vt as w,
|
|
3415
|
+
C as x,
|
|
3416
|
+
y
|
|
3267
3417
|
};
|