fansunited-data-layer 0.11.1 → 0.12.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/api/sportal365-sports/football/index.d.ts +2 -2
- package/api/sportal365-sports/football/index.d.ts.map +1 -1
- package/api/sportal365-sports/football/standings/standing.transformer.d.ts.map +1 -1
- package/api/sportal365-sports/football/statistics/index.d.ts +22 -2
- package/api/sportal365-sports/football/statistics/index.d.ts.map +1 -1
- package/api/sportal365-sports/football/statistics/player-season.transformer.d.ts +10 -0
- package/api/sportal365-sports/football/statistics/player-season.transformer.d.ts.map +1 -1
- package/api/sportal365-sports/football/statistics/player-season.types.d.ts +10 -0
- package/api/sportal365-sports/football/statistics/player-season.types.d.ts.map +1 -1
- package/api/sportal365-sports/index.d.ts +2 -2
- package/api/sportal365-sports/index.d.ts.map +1 -1
- package/client.cjs +1 -1
- package/client.js +2 -2
- package/fansunited-data-layer.cjs +1 -1
- package/fansunited-data-layer.js +12 -11
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/matches-B4GkQKDb.cjs +1 -0
- package/{matches-CIPlUJky.js → matches-CmJlbloT.js} +524 -405
- package/package.json +1 -1
- package/types/canonical/standing.types.d.ts +1 -0
- package/types/canonical/standing.types.d.ts.map +1 -1
- package/types/canonical/statistics.types.d.ts +1 -1
- package/types/canonical/statistics.types.d.ts.map +1 -1
- package/matches-CINPI4_G.cjs +0 -1
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
globalThis[
|
|
1
|
+
const A = "__FANSUNITED_DATA_LAYER_CONFIG__";
|
|
2
|
+
function Le(e) {
|
|
3
|
+
globalThis[A] = e;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
const e = globalThis[
|
|
5
|
+
function g() {
|
|
6
|
+
const e = globalThis[A];
|
|
7
7
|
if (!e)
|
|
8
8
|
throw new Error("Data layer config not initialized. Call setConfig() in your root layout.");
|
|
9
9
|
return e;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return globalThis[
|
|
11
|
+
function ke() {
|
|
12
|
+
return globalThis[A] !== void 0;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function U(e) {
|
|
15
15
|
const t = e.replace(/\/$/, "");
|
|
16
|
-
function n(
|
|
17
|
-
const { sportal365Sports:
|
|
18
|
-
if (!
|
|
16
|
+
function n(s) {
|
|
17
|
+
const { sportal365Sports: a } = s;
|
|
18
|
+
if (!a)
|
|
19
19
|
throw new Error("Sportal365 Sports API configuration is missing");
|
|
20
|
-
const
|
|
21
|
-
return `Basic ${btoa(
|
|
20
|
+
const l = `${a.username}:${a.password}`;
|
|
21
|
+
return `Basic ${btoa(l)}`;
|
|
22
22
|
}
|
|
23
|
-
function o(
|
|
24
|
-
return `${t}${
|
|
23
|
+
function o(s) {
|
|
24
|
+
return `${t}${s}`;
|
|
25
25
|
}
|
|
26
26
|
return {
|
|
27
|
-
async get(
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
27
|
+
async get(s) {
|
|
28
|
+
const a = s.config || g(), { sportal365Sports: l } = a;
|
|
29
|
+
if (!l)
|
|
30
30
|
throw new Error("Sportal365 Sports API configuration is missing");
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
for (const [
|
|
34
|
-
|
|
35
|
-
const
|
|
31
|
+
const d = new URL(o(s.path));
|
|
32
|
+
if (s.params)
|
|
33
|
+
for (const [_, m] of Object.entries(s.params))
|
|
34
|
+
m !== void 0 && (Array.isArray(m) ? m.length > 0 && d.searchParams.set(_, m.join(",")) : d.searchParams.set(_, m));
|
|
35
|
+
const u = await fetch(d.toString(), {
|
|
36
36
|
method: "GET",
|
|
37
37
|
headers: {
|
|
38
|
-
Authorization: n(
|
|
38
|
+
Authorization: n(a),
|
|
39
39
|
"Content-Type": "application/json",
|
|
40
|
-
"X-Project":
|
|
40
|
+
"X-Project": l.projectId,
|
|
41
41
|
// Merge custom headers (they can override defaults)
|
|
42
|
-
...
|
|
42
|
+
...s.headers
|
|
43
43
|
},
|
|
44
|
-
signal:
|
|
44
|
+
signal: l.timeout ? AbortSignal.timeout(l.timeout) : void 0,
|
|
45
45
|
// Next.js cache options for ISR/on-demand revalidation
|
|
46
|
-
...
|
|
46
|
+
...s.next && { next: s.next }
|
|
47
47
|
});
|
|
48
|
-
if (!
|
|
49
|
-
throw new Error(`Sportal365 API error: ${
|
|
50
|
-
return
|
|
48
|
+
if (!u.ok)
|
|
49
|
+
throw new Error(`Sportal365 API error: ${u.status} ${u.statusText}`);
|
|
50
|
+
return u.json();
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
function
|
|
54
|
+
const G = "https://football.api.sportal365.com", De = "https://basketball.api.sportal365.com", Ne = "https://tennis.api.sportal365.com", Fe = "https://sports-statistics.api.sportal365.com", Pe = "https://sports-search.api.sportal365.com", xe = "https://standing.api.sportal365.com", p = U(G);
|
|
55
|
+
function R(e) {
|
|
56
56
|
if (e)
|
|
57
57
|
return {
|
|
58
58
|
id: e.id,
|
|
@@ -91,7 +91,7 @@ const H = {
|
|
|
91
91
|
PENALTY_MISSED: "PENALTY_MISSED",
|
|
92
92
|
PENALTY_SAVED: "PENALTY_SAVED"
|
|
93
93
|
};
|
|
94
|
-
function
|
|
94
|
+
function S(e) {
|
|
95
95
|
const t = H[e.type_code];
|
|
96
96
|
return t ? {
|
|
97
97
|
id: e.id,
|
|
@@ -99,12 +99,12 @@ function T(e) {
|
|
|
99
99
|
competitorPosition: e.team_position === "HOME" ? "ONE" : "TWO",
|
|
100
100
|
minute: e.minute,
|
|
101
101
|
injuryMinute: e.injury_minute,
|
|
102
|
-
primaryPlayer:
|
|
103
|
-
secondaryPlayer:
|
|
102
|
+
primaryPlayer: R(e.primary_player),
|
|
103
|
+
secondaryPlayer: R(e.secondary_player),
|
|
104
104
|
score: e.score ? { competitorOne: String(e.score.home), competitorTwo: String(e.score.away) } : void 0
|
|
105
105
|
} : (console.warn(`Unknown event type: ${e.type_code}`), null);
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function r(e, t = "sportal365") {
|
|
108
108
|
if (e)
|
|
109
109
|
return [
|
|
110
110
|
{
|
|
@@ -113,18 +113,18 @@ function i(e, t = "sportal365") {
|
|
|
113
113
|
}
|
|
114
114
|
];
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function Me(e, t) {
|
|
117
117
|
return e ? e.find((o) => o.provider === t)?.id : void 0;
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
const o = e ?? [],
|
|
121
|
-
if (
|
|
122
|
-
const
|
|
123
|
-
return s
|
|
119
|
+
function Ue(e, t, n) {
|
|
120
|
+
const o = e ?? [], s = o.findIndex((a) => a.provider === t);
|
|
121
|
+
if (s >= 0) {
|
|
122
|
+
const a = [...o];
|
|
123
|
+
return a[s] = { provider: t, id: n }, a;
|
|
124
124
|
} else
|
|
125
125
|
return [...o, { provider: t, id: n }];
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function B(e) {
|
|
128
128
|
const t = e.urls?.find((n) => n.app_type === "desktop")?.url;
|
|
129
129
|
return {
|
|
130
130
|
id: e.id,
|
|
@@ -137,7 +137,7 @@ function $(e) {
|
|
|
137
137
|
url: t
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function $(e) {
|
|
141
141
|
return {
|
|
142
142
|
type: {
|
|
143
143
|
id: e.type.id,
|
|
@@ -149,16 +149,16 @@ function Y(e) {
|
|
|
149
149
|
type: e.scope.type,
|
|
150
150
|
name: e.scope.name
|
|
151
151
|
},
|
|
152
|
-
selections: e.selections.map(
|
|
152
|
+
selections: e.selections.map(B)
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function Y(e) {
|
|
156
156
|
if (!e) return !0;
|
|
157
|
-
const t = e.replace("#", ""), n = parseInt(t.substring(0, 2), 16), o = parseInt(t.substring(2, 4), 16),
|
|
158
|
-
return (0.2126 * n + 0.7152 * o + 0.0722 *
|
|
157
|
+
const t = e.replace("#", ""), n = parseInt(t.substring(0, 2), 16), o = parseInt(t.substring(2, 4), 16), s = parseInt(t.substring(4, 6), 16);
|
|
158
|
+
return (0.2126 * n + 0.7152 * o + 0.0722 * s) / 255 < 0.5;
|
|
159
159
|
}
|
|
160
|
-
function
|
|
161
|
-
const t = e.bookmaker.assets?.[0], n = e.bookmaker.branding || t, o = e.bookmaker.branding?.background_color || t?.background_color,
|
|
160
|
+
function V(e) {
|
|
161
|
+
const t = e.bookmaker.assets?.[0], n = e.bookmaker.branding || t, o = e.bookmaker.branding?.background_color || t?.background_color, s = e.bookmaker.branding?.text_color || (Y(o) ? "#FFFFFF" : "#000000");
|
|
162
162
|
return {
|
|
163
163
|
operator: {
|
|
164
164
|
id: e.bookmaker.id,
|
|
@@ -166,18 +166,18 @@ function G(e) {
|
|
|
166
166
|
url: e.bookmaker.url,
|
|
167
167
|
branding: n ? {
|
|
168
168
|
backgroundColor: o,
|
|
169
|
-
textColor:
|
|
169
|
+
textColor: s,
|
|
170
170
|
logo: t?.logo
|
|
171
171
|
} : void 0
|
|
172
172
|
},
|
|
173
173
|
type: e.type,
|
|
174
|
-
markets: e.markets.map(
|
|
174
|
+
markets: e.markets.map($)
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
|
-
function V(e) {
|
|
178
|
-
return e.map(G);
|
|
179
|
-
}
|
|
180
177
|
function W(e) {
|
|
178
|
+
return e.map(V);
|
|
179
|
+
}
|
|
180
|
+
function j(e) {
|
|
181
181
|
const t = {
|
|
182
182
|
finished_ap: "finished_after_penalties",
|
|
183
183
|
// finished after penalties
|
|
@@ -208,7 +208,7 @@ function W(e) {
|
|
|
208
208
|
type: e.type
|
|
209
209
|
};
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function L(e) {
|
|
212
212
|
return {
|
|
213
213
|
id: e.id,
|
|
214
214
|
name: e.name,
|
|
@@ -231,7 +231,7 @@ function R(e) {
|
|
|
231
231
|
}
|
|
232
232
|
]
|
|
233
233
|
} : void 0,
|
|
234
|
-
providerRef:
|
|
234
|
+
providerRef: r(e.uuid)
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
237
|
function K(e) {
|
|
@@ -246,7 +246,7 @@ function K(e) {
|
|
|
246
246
|
extraTimeSecondHalfStartedAt: e.extra_time_second_half_started_at ? new Date(e.extra_time_second_half_started_at) : void 0
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function q(e) {
|
|
250
250
|
if (!e) return;
|
|
251
251
|
const t = (o) => o ? { competitorOne: String(o.home), competitorTwo: String(o.away) } : void 0, n = e.after_extra_time ?? e.regular_time;
|
|
252
252
|
return {
|
|
@@ -262,17 +262,17 @@ function j(e) {
|
|
|
262
262
|
}
|
|
263
263
|
};
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function X(e) {
|
|
266
266
|
if (e)
|
|
267
267
|
return {
|
|
268
268
|
id: e.id,
|
|
269
269
|
name: e.name,
|
|
270
270
|
slug: e.slug,
|
|
271
271
|
assets: e.assets?.image?.url ? { image: e.assets.image.url } : void 0,
|
|
272
|
-
providerRef:
|
|
272
|
+
providerRef: r(e.uuid)
|
|
273
273
|
};
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function z(e) {
|
|
276
276
|
if (e?.length)
|
|
277
277
|
return e.map((t) => ({
|
|
278
278
|
id: t.id,
|
|
@@ -282,7 +282,7 @@ function X(e) {
|
|
|
282
282
|
gender: t.gender
|
|
283
283
|
}));
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function J(e) {
|
|
286
286
|
if (!e.season?.tournament) return;
|
|
287
287
|
const { tournament: t, ...n } = e.season;
|
|
288
288
|
return {
|
|
@@ -296,7 +296,7 @@ function z(e) {
|
|
|
296
296
|
name: t.country.name,
|
|
297
297
|
code: t.country.code ?? void 0,
|
|
298
298
|
flag: t.country.assets?.flag?.url,
|
|
299
|
-
providerRef:
|
|
299
|
+
providerRef: r(t.country.uuid)
|
|
300
300
|
} : void 0,
|
|
301
301
|
season: {
|
|
302
302
|
id: n.id,
|
|
@@ -309,10 +309,10 @@ function z(e) {
|
|
|
309
309
|
type: e.stage.type
|
|
310
310
|
} : void 0,
|
|
311
311
|
assets: t.assets?.logo?.url ? { logo: t.assets.logo.url } : void 0,
|
|
312
|
-
providerRef:
|
|
312
|
+
providerRef: r(t.uuid)
|
|
313
313
|
};
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function Q(e) {
|
|
316
316
|
if (!e.winner?.match?.id) return;
|
|
317
317
|
const t = {
|
|
318
318
|
"Regular Time": "REGULAR_TIME",
|
|
@@ -325,41 +325,41 @@ function J(e) {
|
|
|
325
325
|
aggregate: !!e.winner.aggregate
|
|
326
326
|
};
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function E(e) {
|
|
329
329
|
return {
|
|
330
330
|
id: e.id,
|
|
331
331
|
slug: e.slug,
|
|
332
332
|
sport: "football",
|
|
333
|
-
status:
|
|
333
|
+
status: j(e.status),
|
|
334
334
|
timing: K(e),
|
|
335
|
-
competitorOne:
|
|
336
|
-
competitorTwo:
|
|
337
|
-
competition:
|
|
335
|
+
competitorOne: L(e.home_team),
|
|
336
|
+
competitorTwo: L(e.away_team),
|
|
337
|
+
competition: J(e),
|
|
338
338
|
round: e.round ? {
|
|
339
339
|
id: e.round.id ?? e.round.key,
|
|
340
340
|
key: e.round.key,
|
|
341
341
|
name: e.round.name,
|
|
342
342
|
type: e.round.type ?? "REGULAR",
|
|
343
|
-
providerRef:
|
|
343
|
+
providerRef: r(e.round.uuid)
|
|
344
344
|
} : void 0,
|
|
345
345
|
group: e.group ? {
|
|
346
346
|
id: e.group.id,
|
|
347
347
|
name: e.group.name,
|
|
348
|
-
providerRef:
|
|
348
|
+
providerRef: r(e.group.uuid)
|
|
349
349
|
} : void 0,
|
|
350
|
-
venue:
|
|
351
|
-
officials:
|
|
350
|
+
venue: X(e.venue),
|
|
351
|
+
officials: z(e.referees),
|
|
352
352
|
spectators: e.spectators ?? void 0,
|
|
353
|
-
score:
|
|
354
|
-
mainEvents: e.main_events?.map(
|
|
355
|
-
penaltyShootoutEvents: e.penalty_shootout_events?.map(
|
|
356
|
-
winner:
|
|
353
|
+
score: q(e.score),
|
|
354
|
+
mainEvents: e.main_events?.map(S).filter((t) => t !== null),
|
|
355
|
+
penaltyShootoutEvents: e.penalty_shootout_events?.map(S).filter((t) => t !== null),
|
|
356
|
+
winner: Q(e),
|
|
357
357
|
coverage: e.coverage === "NOT_LIVE" ? "UNKNOWN" : e.coverage,
|
|
358
358
|
lineupStatus: e.lineup_status === "UNCONFIRMED" ? "EXPECTED" : e.lineup_status,
|
|
359
|
-
providerRef:
|
|
359
|
+
providerRef: r(e.uuid)
|
|
360
360
|
};
|
|
361
361
|
}
|
|
362
|
-
function
|
|
362
|
+
function Z(e) {
|
|
363
363
|
const t = e.player;
|
|
364
364
|
return {
|
|
365
365
|
id: t.id,
|
|
@@ -373,7 +373,7 @@ function Q(e) {
|
|
|
373
373
|
id: t.country.id,
|
|
374
374
|
name: t.country.name,
|
|
375
375
|
code: t.country.code,
|
|
376
|
-
providerRef:
|
|
376
|
+
providerRef: r(t.country.uuid)
|
|
377
377
|
} : void 0,
|
|
378
378
|
birthdate: t.birthdate,
|
|
379
379
|
profile: t.profile ? {
|
|
@@ -384,15 +384,15 @@ function Q(e) {
|
|
|
384
384
|
photo: t.assets.thumb?.url,
|
|
385
385
|
photoTransparent: t.assets.thumb_transparent_background?.url
|
|
386
386
|
} : void 0,
|
|
387
|
-
events: e.events?.map(
|
|
388
|
-
providerRef:
|
|
387
|
+
events: e.events?.map(S).filter((n) => n !== null),
|
|
388
|
+
providerRef: r(t.uuid)
|
|
389
389
|
};
|
|
390
390
|
}
|
|
391
|
-
function
|
|
391
|
+
function k(e) {
|
|
392
392
|
const t = [], n = [];
|
|
393
393
|
for (const o of e.players) {
|
|
394
|
-
const
|
|
395
|
-
o.type.category === "start" ? t.push(
|
|
394
|
+
const s = Z(o);
|
|
395
|
+
o.type.category === "start" ? t.push(s) : o.type.category === "sub" && n.push(s);
|
|
396
396
|
}
|
|
397
397
|
return {
|
|
398
398
|
competitorId: e.team_id,
|
|
@@ -405,73 +405,73 @@ function L(e) {
|
|
|
405
405
|
id: e.coach.country.id,
|
|
406
406
|
name: e.coach.country.name,
|
|
407
407
|
code: e.coach.country.code,
|
|
408
|
-
providerRef:
|
|
408
|
+
providerRef: r(e.coach.country.uuid)
|
|
409
409
|
} : void 0,
|
|
410
410
|
birthdate: e.coach.birthdate,
|
|
411
|
-
providerRef:
|
|
411
|
+
providerRef: r(e.coach.uuid)
|
|
412
412
|
} : void 0,
|
|
413
413
|
starters: t,
|
|
414
414
|
substitutes: n
|
|
415
415
|
};
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function w(e) {
|
|
418
418
|
return {
|
|
419
419
|
matchId: e.match_id,
|
|
420
420
|
confirmed: e.status === "CONFIRMED",
|
|
421
|
-
competitorOne:
|
|
422
|
-
competitorTwo:
|
|
421
|
+
competitorOne: k(e.home_team),
|
|
422
|
+
competitorTwo: k(e.away_team)
|
|
423
423
|
};
|
|
424
424
|
}
|
|
425
|
-
function
|
|
425
|
+
function y(e, t, n, o) {
|
|
426
426
|
return t == null ? null : { key: e, value: String(t), label: n, unit: o };
|
|
427
427
|
}
|
|
428
|
-
function
|
|
428
|
+
function D(e, t) {
|
|
429
429
|
const n = (t.shots_on ?? 0) + (t.shots_off ?? 0) + (t.shots_blocked ?? 0), o = [
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
430
|
+
y("possession", t.possession, "Possession", "%"),
|
|
431
|
+
y("shots_total", n, "Shots"),
|
|
432
|
+
y("shots_on_target", t.shots_on, "Shots on Target"),
|
|
433
|
+
y("shots_off_target", t.shots_off, "Shots off Target"),
|
|
434
|
+
y("shots_blocked", t.shots_blocked, "Shots Blocked"),
|
|
435
|
+
y("corners", t.corners, "Corner Kicks"),
|
|
436
|
+
y("goal_kicks", t.goal_kicks, "Goal Kicks"),
|
|
437
|
+
y("throw_ins", t.throw_in, "Throw Ins"),
|
|
438
|
+
y("offsides", t.offside, "Offsides"),
|
|
439
|
+
y("fouls", t.fouls_committed, "Fouls"),
|
|
440
|
+
y("yellow_cards", t.yellow_cards, "Yellow Cards"),
|
|
441
|
+
y("passes", t.pass, "Passes"),
|
|
442
|
+
y("crosses", t.crosses, "Crosses")
|
|
443
443
|
];
|
|
444
444
|
return {
|
|
445
445
|
competitorId: e,
|
|
446
|
-
statistics: o.filter((
|
|
446
|
+
statistics: o.filter((s) => s !== null)
|
|
447
447
|
};
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function ee(e) {
|
|
450
450
|
const t = e.find((o) => o.home_team), n = e.find((o) => !o.home_team);
|
|
451
451
|
if (!t || !n)
|
|
452
452
|
throw new Error("Missing competitor statistics");
|
|
453
453
|
return {
|
|
454
|
-
competitorOne:
|
|
455
|
-
competitorTwo:
|
|
454
|
+
competitorOne: D(String(t.team.id), t.statistics),
|
|
455
|
+
competitorTwo: D(String(n.team.id), n.statistics)
|
|
456
456
|
};
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function te(e, t) {
|
|
459
459
|
return {
|
|
460
460
|
matchId: e,
|
|
461
|
-
operators:
|
|
461
|
+
operators: W(t)
|
|
462
462
|
};
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function N(e) {
|
|
465
465
|
if (e == null || e === "")
|
|
466
466
|
return;
|
|
467
467
|
const t = typeof e == "number" ? e : parseInt(e, 10);
|
|
468
468
|
return isNaN(t) ? void 0 : t;
|
|
469
469
|
}
|
|
470
|
-
function
|
|
470
|
+
function oe(e) {
|
|
471
471
|
return {
|
|
472
472
|
externalId: e.external_id,
|
|
473
|
-
minute:
|
|
474
|
-
addedTime:
|
|
473
|
+
minute: N(e.elapsed),
|
|
474
|
+
addedTime: N(e.elapsed_plus),
|
|
475
475
|
text: e.auto_text,
|
|
476
476
|
details: e.details,
|
|
477
477
|
meta: {
|
|
@@ -483,11 +483,11 @@ function te(e) {
|
|
|
483
483
|
}
|
|
484
484
|
};
|
|
485
485
|
}
|
|
486
|
-
async function
|
|
487
|
-
const o = n ||
|
|
486
|
+
async function Ge(e, t, n) {
|
|
487
|
+
const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
|
|
488
488
|
path: `/v2/matches/${e}`,
|
|
489
489
|
params: {
|
|
490
|
-
language_code: t?.languageCode ??
|
|
490
|
+
language_code: t?.languageCode ?? s?.languageCode ?? "en",
|
|
491
491
|
odd_client: t?.oddClient,
|
|
492
492
|
odd_type: t?.oddType,
|
|
493
493
|
scope_type: t?.scopeType,
|
|
@@ -497,47 +497,47 @@ async function xe(e, t, n) {
|
|
|
497
497
|
optional_data: t?.optionalData
|
|
498
498
|
},
|
|
499
499
|
headers: {
|
|
500
|
-
"Accept-Language": t?.languageCode ??
|
|
500
|
+
"Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
|
|
501
501
|
},
|
|
502
502
|
next: t?.next,
|
|
503
503
|
config: o
|
|
504
504
|
});
|
|
505
|
-
return
|
|
505
|
+
return E(a);
|
|
506
506
|
}
|
|
507
|
-
async function
|
|
508
|
-
const o = n ||
|
|
509
|
-
return (await
|
|
507
|
+
async function He(e, t, n) {
|
|
508
|
+
const o = n || g(), { sportal365Sports: s } = o;
|
|
509
|
+
return (await p.get({
|
|
510
510
|
path: `/v2/matches/${e}/events`,
|
|
511
511
|
params: {
|
|
512
|
-
language_code: t?.languageCode ??
|
|
512
|
+
language_code: t?.languageCode ?? s?.languageCode ?? "en"
|
|
513
513
|
},
|
|
514
514
|
headers: {
|
|
515
|
-
"Accept-Language": t?.languageCode ??
|
|
515
|
+
"Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
|
|
516
516
|
},
|
|
517
517
|
next: t?.next,
|
|
518
518
|
config: o
|
|
519
|
-
})).events.map(
|
|
519
|
+
})).events.map(S).filter((l) => l !== null);
|
|
520
520
|
}
|
|
521
|
-
async function
|
|
522
|
-
const o = n ||
|
|
521
|
+
async function Be(e, t, n) {
|
|
522
|
+
const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
|
|
523
523
|
path: `/v2/matches/${e}/lineups`,
|
|
524
524
|
params: {
|
|
525
|
-
language_code: t?.languageCode ??
|
|
525
|
+
language_code: t?.languageCode ?? s?.languageCode ?? "en"
|
|
526
526
|
},
|
|
527
527
|
headers: {
|
|
528
|
-
"Accept-Language": t?.languageCode ??
|
|
528
|
+
"Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
|
|
529
529
|
},
|
|
530
530
|
next: t?.next,
|
|
531
531
|
config: o
|
|
532
532
|
});
|
|
533
|
-
return
|
|
533
|
+
return w(a);
|
|
534
534
|
}
|
|
535
|
-
async function
|
|
536
|
-
const o = n ||
|
|
535
|
+
async function $e(e, t, n) {
|
|
536
|
+
const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
|
|
537
537
|
path: `/v2/matches/${e}`,
|
|
538
538
|
params: {
|
|
539
|
-
language_code: t?.languageCode ??
|
|
540
|
-
odd_client: t?.oddClient ??
|
|
539
|
+
language_code: t?.languageCode ?? s?.languageCode ?? "en",
|
|
540
|
+
odd_client: t?.oddClient ?? s?.oddClient,
|
|
541
541
|
odd_type: t?.oddType,
|
|
542
542
|
scope_type: t?.scopeType ?? "ALL",
|
|
543
543
|
odd_format: t?.oddFormat ?? "DECIMAL",
|
|
@@ -545,44 +545,44 @@ async function He(e, t, n) {
|
|
|
545
545
|
bookmaker_ids: t?.bookmakerIds
|
|
546
546
|
},
|
|
547
547
|
headers: {
|
|
548
|
-
"Accept-Language": t?.languageCode ??
|
|
548
|
+
"Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
|
|
549
549
|
},
|
|
550
550
|
next: t?.next,
|
|
551
551
|
config: o
|
|
552
552
|
});
|
|
553
|
-
return
|
|
553
|
+
return te(e, a.odds ?? []);
|
|
554
554
|
}
|
|
555
|
-
async function
|
|
556
|
-
const o = n ||
|
|
555
|
+
async function Ye(e, t, n) {
|
|
556
|
+
const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
|
|
557
557
|
path: `/events/${e}/teamstats`,
|
|
558
558
|
params: {
|
|
559
|
-
language_code: t?.languageCode ??
|
|
559
|
+
language_code: t?.languageCode ?? s?.languageCode ?? "en"
|
|
560
560
|
},
|
|
561
561
|
headers: {
|
|
562
|
-
"Accept-Language": t?.languageCode ??
|
|
562
|
+
"Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
|
|
563
563
|
},
|
|
564
564
|
next: t?.next,
|
|
565
565
|
config: o
|
|
566
566
|
});
|
|
567
|
-
return
|
|
567
|
+
return ee(a);
|
|
568
568
|
}
|
|
569
|
-
async function
|
|
570
|
-
const o = n ||
|
|
571
|
-
return (await
|
|
569
|
+
async function Ve(e, t, n) {
|
|
570
|
+
const o = n || g(), { sportal365Sports: s } = o;
|
|
571
|
+
return (await p.get({
|
|
572
572
|
path: `/matches/${e}/commentary`,
|
|
573
573
|
params: {
|
|
574
|
-
language_code: t?.languageCode ??
|
|
574
|
+
language_code: t?.languageCode ?? s?.languageCode ?? "en"
|
|
575
575
|
},
|
|
576
576
|
headers: {
|
|
577
|
-
"Accept-Language": t?.languageCode ??
|
|
577
|
+
"Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
|
|
578
578
|
},
|
|
579
579
|
next: t?.next,
|
|
580
580
|
config: o
|
|
581
|
-
})).map(
|
|
581
|
+
})).map(oe);
|
|
582
582
|
}
|
|
583
|
-
async function
|
|
584
|
-
const n = t ||
|
|
585
|
-
return (await
|
|
583
|
+
async function We(e, t) {
|
|
584
|
+
const n = t || g(), { sportal365Sports: o } = n;
|
|
585
|
+
return (await p.get({
|
|
586
586
|
path: "/v2/matches",
|
|
587
587
|
params: {
|
|
588
588
|
language_code: e.languageCode ?? o?.languageCode ?? "en",
|
|
@@ -623,11 +623,11 @@ async function Be(e, t) {
|
|
|
623
623
|
},
|
|
624
624
|
next: e.next,
|
|
625
625
|
config: n
|
|
626
|
-
})).matches.map(
|
|
626
|
+
})).matches.map(E);
|
|
627
627
|
}
|
|
628
|
-
async function
|
|
629
|
-
const n = t ||
|
|
630
|
-
return (await
|
|
628
|
+
async function je(e, t) {
|
|
629
|
+
const n = t || g(), { sportal365Sports: o } = n;
|
|
630
|
+
return (await p.get({
|
|
631
631
|
path: "/v2/matches/livescore",
|
|
632
632
|
params: {
|
|
633
633
|
// Match filters
|
|
@@ -652,9 +652,9 @@ async function Ge(e, t) {
|
|
|
652
652
|
},
|
|
653
653
|
next: e?.next,
|
|
654
654
|
config: n
|
|
655
|
-
})).matches.map(
|
|
655
|
+
})).matches.map(E);
|
|
656
656
|
}
|
|
657
|
-
function
|
|
657
|
+
function ne(e) {
|
|
658
658
|
return {
|
|
659
659
|
id: e.id,
|
|
660
660
|
name: e.name,
|
|
@@ -668,7 +668,7 @@ function oe(e) {
|
|
|
668
668
|
name: e.country.name,
|
|
669
669
|
code: e.country.code ?? void 0,
|
|
670
670
|
flag: e.country.assets?.flag?.url,
|
|
671
|
-
providerRef:
|
|
671
|
+
providerRef: r(e.country.uuid)
|
|
672
672
|
} : void 0,
|
|
673
673
|
// Extended team profile data
|
|
674
674
|
venue: e.venue ? {
|
|
@@ -683,16 +683,16 @@ function oe(e) {
|
|
|
683
683
|
name: e.venue.city.country.name,
|
|
684
684
|
code: e.venue.city.country.code ?? void 0,
|
|
685
685
|
flag: e.venue.city.country.assets?.flag?.url,
|
|
686
|
-
providerRef:
|
|
686
|
+
providerRef: r(e.venue.city.country.uuid)
|
|
687
687
|
} : void 0,
|
|
688
|
-
providerRef:
|
|
688
|
+
providerRef: r(e.venue.city.uuid ?? void 0)
|
|
689
689
|
} : void 0,
|
|
690
690
|
country: e.venue.country ? {
|
|
691
691
|
id: e.venue.country.id,
|
|
692
692
|
name: e.venue.country.name,
|
|
693
693
|
code: e.venue.country.code ?? void 0,
|
|
694
694
|
flag: e.venue.country.assets?.flag?.url,
|
|
695
|
-
providerRef:
|
|
695
|
+
providerRef: r(e.venue.country.uuid)
|
|
696
696
|
} : void 0,
|
|
697
697
|
profile: e.venue.profile ? {
|
|
698
698
|
latitude: e.venue.profile.lat,
|
|
@@ -702,7 +702,7 @@ function oe(e) {
|
|
|
702
702
|
assets: e.venue.assets?.image?.url ? {
|
|
703
703
|
image: e.venue.assets.image.url
|
|
704
704
|
} : void 0,
|
|
705
|
-
providerRef:
|
|
705
|
+
providerRef: r(e.venue.uuid)
|
|
706
706
|
} : void 0,
|
|
707
707
|
coach: e.coach ? {
|
|
708
708
|
id: e.coach.id,
|
|
@@ -713,10 +713,10 @@ function oe(e) {
|
|
|
713
713
|
name: e.coach.country.name,
|
|
714
714
|
code: e.coach.country.code ?? void 0,
|
|
715
715
|
flag: e.coach.country.assets?.flag?.url,
|
|
716
|
-
providerRef:
|
|
716
|
+
providerRef: r(e.coach.country.uuid)
|
|
717
717
|
},
|
|
718
718
|
birthdate: e.coach.birthdate,
|
|
719
|
-
providerRef:
|
|
719
|
+
providerRef: r(e.coach.uuid)
|
|
720
720
|
} : void 0,
|
|
721
721
|
founded: e.founded,
|
|
722
722
|
// Assets
|
|
@@ -746,24 +746,24 @@ function oe(e) {
|
|
|
746
746
|
name: t.name,
|
|
747
747
|
slug: t.slug,
|
|
748
748
|
active: t.status === "ACTIVE",
|
|
749
|
-
providerRef:
|
|
749
|
+
providerRef: r(t.uuid)
|
|
750
750
|
})),
|
|
751
751
|
currentSeason: e.current_season ? {
|
|
752
752
|
id: e.current_season.id,
|
|
753
753
|
name: e.current_season.name,
|
|
754
754
|
slug: e.current_season.slug,
|
|
755
755
|
active: e.current_season.status === "ACTIVE",
|
|
756
|
-
providerRef:
|
|
756
|
+
providerRef: r(e.current_season.uuid)
|
|
757
757
|
} : void 0,
|
|
758
758
|
// Form - map to FUSportsCompetitorForm
|
|
759
759
|
form: e.form && e.form.length > 0 ? {
|
|
760
760
|
competitorId: e.id,
|
|
761
761
|
results: e.form.map((t) => {
|
|
762
|
-
const o = t.participants[0].id === e.uuid ? t.participants[1] : t.participants[0],
|
|
762
|
+
const o = t.participants[0].id === e.uuid ? t.participants[1] : t.participants[0], s = t.result[0]?.results.find((d) => d.position === "1")?.value, a = t.result[0]?.results.find((d) => d.position === "2")?.value, l = t.outcome === "win" ? "W" : t.outcome === "draw" ? "D" : "L";
|
|
763
763
|
return {
|
|
764
764
|
matchId: t.id,
|
|
765
|
-
result:
|
|
766
|
-
score:
|
|
765
|
+
result: l,
|
|
766
|
+
score: s && a ? `${s}-${a}` : void 0,
|
|
767
767
|
opponent: {
|
|
768
768
|
id: o.id,
|
|
769
769
|
name: o.name,
|
|
@@ -778,10 +778,10 @@ function oe(e) {
|
|
|
778
778
|
}),
|
|
779
779
|
formString: e.form.map((t) => t.outcome === "win" ? "W" : t.outcome === "draw" ? "D" : "L").join("")
|
|
780
780
|
} : void 0,
|
|
781
|
-
providerRef:
|
|
781
|
+
providerRef: r(e.uuid)
|
|
782
782
|
};
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function se(e) {
|
|
785
785
|
const t = e.player;
|
|
786
786
|
return {
|
|
787
787
|
id: t.id,
|
|
@@ -794,7 +794,7 @@ function ne(e) {
|
|
|
794
794
|
name: t.country.name,
|
|
795
795
|
code: t.country.code ?? void 0,
|
|
796
796
|
flag: t.country.assets?.flag?.url,
|
|
797
|
-
providerRef:
|
|
797
|
+
providerRef: r(t.country.uuid)
|
|
798
798
|
} : void 0,
|
|
799
799
|
gender: t.gender,
|
|
800
800
|
birthdate: t.birthdate,
|
|
@@ -810,7 +810,7 @@ function ne(e) {
|
|
|
810
810
|
contractType: e.contract_type,
|
|
811
811
|
contractUntil: e.contract_until ?? void 0,
|
|
812
812
|
joinedDate: e.start_date ?? void 0,
|
|
813
|
-
providerRef:
|
|
813
|
+
providerRef: r(t.id)
|
|
814
814
|
// Using player.id as provider reference
|
|
815
815
|
};
|
|
816
816
|
}
|
|
@@ -824,66 +824,66 @@ function ae(e) {
|
|
|
824
824
|
name: e.country.name,
|
|
825
825
|
code: e.country.code ?? void 0,
|
|
826
826
|
flag: e.country.assets?.flag?.url,
|
|
827
|
-
providerRef:
|
|
827
|
+
providerRef: r(e.country.uuid)
|
|
828
828
|
} : void 0,
|
|
829
829
|
birthdate: e.birthdate,
|
|
830
|
-
providerRef:
|
|
830
|
+
providerRef: r(e.uuid)
|
|
831
831
|
};
|
|
832
832
|
}
|
|
833
|
-
function
|
|
833
|
+
function ie(e) {
|
|
834
834
|
return {
|
|
835
835
|
teamId: e.team.id,
|
|
836
836
|
teamName: e.team.name,
|
|
837
837
|
coach: e.coach ? ae(e.coach) : void 0,
|
|
838
|
-
players: e.players.map(
|
|
838
|
+
players: e.players.map(se)
|
|
839
839
|
};
|
|
840
840
|
}
|
|
841
|
-
function
|
|
841
|
+
function re(e) {
|
|
842
842
|
const t = parseInt(e, 10);
|
|
843
843
|
return isNaN(t) ? void 0 : t;
|
|
844
844
|
}
|
|
845
|
-
function
|
|
845
|
+
function i(e, t) {
|
|
846
846
|
const n = e.find((o) => o.name === t);
|
|
847
|
-
return n ?
|
|
847
|
+
return n ? re(n.value) : void 0;
|
|
848
848
|
}
|
|
849
|
-
function
|
|
849
|
+
function de(e, t) {
|
|
850
850
|
const n = e.statistics;
|
|
851
851
|
return {
|
|
852
852
|
playerId: e.player.id,
|
|
853
853
|
seasonId: e.season.id,
|
|
854
854
|
teamId: t,
|
|
855
855
|
// Core statistics
|
|
856
|
-
appearances:
|
|
857
|
-
started:
|
|
858
|
-
substituteIn:
|
|
859
|
-
substituteOut:
|
|
860
|
-
minutes:
|
|
861
|
-
minutesSubstitute:
|
|
856
|
+
appearances: i(n, "played"),
|
|
857
|
+
started: i(n, "started"),
|
|
858
|
+
substituteIn: i(n, "substitute_in"),
|
|
859
|
+
substituteOut: i(n, "substitute_out"),
|
|
860
|
+
minutes: i(n, "minutes"),
|
|
861
|
+
minutesSubstitute: i(n, "minutes_substitute"),
|
|
862
862
|
// Scoring
|
|
863
|
-
goals:
|
|
864
|
-
goalsSubstitute:
|
|
865
|
-
penaltyGoals:
|
|
866
|
-
ownGoals:
|
|
867
|
-
assists:
|
|
863
|
+
goals: i(n, "goals"),
|
|
864
|
+
goalsSubstitute: i(n, "goals_substitute"),
|
|
865
|
+
penaltyGoals: i(n, "penalty_goals"),
|
|
866
|
+
ownGoals: i(n, "own_goals"),
|
|
867
|
+
assists: i(n, "assists"),
|
|
868
868
|
// Shooting
|
|
869
|
-
shots:
|
|
870
|
-
shotsOnTarget:
|
|
869
|
+
shots: i(n, "shots"),
|
|
870
|
+
shotsOnTarget: i(n, "shots_on_target"),
|
|
871
871
|
// Discipline
|
|
872
|
-
yellowCards:
|
|
873
|
-
redCards:
|
|
874
|
-
foulsCommitted:
|
|
875
|
-
penaltiesCommitted:
|
|
872
|
+
yellowCards: i(n, "yellow_cards"),
|
|
873
|
+
redCards: i(n, "red_cards"),
|
|
874
|
+
foulsCommitted: i(n, "fouls_committed"),
|
|
875
|
+
penaltiesCommitted: i(n, "penalties_committed"),
|
|
876
876
|
// Penalties
|
|
877
|
-
penaltiesMissed:
|
|
877
|
+
penaltiesMissed: i(n, "penalties_missed"),
|
|
878
878
|
// Defensive
|
|
879
|
-
cleansheets:
|
|
879
|
+
cleansheets: i(n, "cleansheets"),
|
|
880
880
|
// Goalkeeper-specific
|
|
881
|
-
saves:
|
|
882
|
-
conceded:
|
|
883
|
-
caughtBall:
|
|
884
|
-
penaltiesReceived:
|
|
881
|
+
saves: i(n, "saves"),
|
|
882
|
+
conceded: i(n, "conceded"),
|
|
883
|
+
caughtBall: i(n, "caught_ball"),
|
|
884
|
+
penaltiesReceived: i(n, "penalties_received"),
|
|
885
885
|
// Other
|
|
886
|
-
offsides:
|
|
886
|
+
offsides: i(n, "offsides"),
|
|
887
887
|
// Raw statistics array (for any additional stats not mapped above)
|
|
888
888
|
rawStatistics: n.map((o) => ({
|
|
889
889
|
name: o.name,
|
|
@@ -891,72 +891,189 @@ function re(e, t) {
|
|
|
891
891
|
}))
|
|
892
892
|
};
|
|
893
893
|
}
|
|
894
|
-
|
|
895
|
-
const
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
894
|
+
function ue(e) {
|
|
895
|
+
const t = e.statistics;
|
|
896
|
+
return {
|
|
897
|
+
playerId: e.player.id,
|
|
898
|
+
seasonId: e.season.id,
|
|
899
|
+
// Core statistics
|
|
900
|
+
appearances: i(t, "played"),
|
|
901
|
+
started: i(t, "started"),
|
|
902
|
+
substituteIn: i(t, "substitute_in"),
|
|
903
|
+
substituteOut: i(t, "substitute_out"),
|
|
904
|
+
minutes: i(t, "minutes"),
|
|
905
|
+
minutesSubstitute: i(t, "minutes_substitute"),
|
|
906
|
+
// Scoring
|
|
907
|
+
goals: i(t, "goals"),
|
|
908
|
+
goalsSubstitute: i(t, "goals_substitute"),
|
|
909
|
+
penaltyGoals: i(t, "penalty_goals"),
|
|
910
|
+
ownGoals: i(t, "own_goals"),
|
|
911
|
+
assists: i(t, "assists"),
|
|
912
|
+
// Shooting
|
|
913
|
+
shots: i(t, "shots"),
|
|
914
|
+
shotsOnTarget: i(t, "shots_on_target"),
|
|
915
|
+
// Discipline
|
|
916
|
+
yellowCards: i(t, "yellow_cards"),
|
|
917
|
+
redCards: i(t, "red_cards"),
|
|
918
|
+
foulsCommitted: i(t, "fouls_committed"),
|
|
919
|
+
penaltiesCommitted: i(t, "penalties_committed"),
|
|
920
|
+
// Penalties
|
|
921
|
+
penaltiesMissed: i(t, "penalties_missed"),
|
|
922
|
+
// Defensive
|
|
923
|
+
cleansheets: i(t, "cleansheets"),
|
|
924
|
+
// Goalkeeper-specific
|
|
925
|
+
saves: i(t, "saves"),
|
|
926
|
+
conceded: i(t, "conceded"),
|
|
927
|
+
caughtBall: i(t, "caught_ball"),
|
|
928
|
+
penaltiesReceived: i(t, "penalties_received"),
|
|
929
|
+
// Other
|
|
930
|
+
offsides: i(t, "offsides"),
|
|
931
|
+
// Raw statistics array
|
|
932
|
+
rawStatistics: t.map((n) => ({
|
|
933
|
+
name: n.name,
|
|
934
|
+
value: n.value
|
|
935
|
+
}))
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
function c(e, t) {
|
|
939
|
+
if (!(e === void 0 && t === void 0))
|
|
940
|
+
return (e ?? 0) + (t ?? 0);
|
|
941
|
+
}
|
|
942
|
+
function ce(e, t) {
|
|
943
|
+
return {
|
|
944
|
+
playerId: e.playerId,
|
|
945
|
+
seasonId: e.seasonId,
|
|
946
|
+
// Core statistics
|
|
947
|
+
appearances: c(e.appearances, t.appearances),
|
|
948
|
+
started: c(e.started, t.started),
|
|
949
|
+
substituteIn: c(e.substituteIn, t.substituteIn),
|
|
950
|
+
substituteOut: c(e.substituteOut, t.substituteOut),
|
|
951
|
+
minutes: c(e.minutes, t.minutes),
|
|
952
|
+
minutesSubstitute: c(e.minutesSubstitute, t.minutesSubstitute),
|
|
953
|
+
// Scoring
|
|
954
|
+
goals: c(e.goals, t.goals),
|
|
955
|
+
goalsSubstitute: c(e.goalsSubstitute, t.goalsSubstitute),
|
|
956
|
+
penaltyGoals: c(e.penaltyGoals, t.penaltyGoals),
|
|
957
|
+
ownGoals: c(e.ownGoals, t.ownGoals),
|
|
958
|
+
assists: c(e.assists, t.assists),
|
|
959
|
+
// Shooting
|
|
960
|
+
shots: c(e.shots, t.shots),
|
|
961
|
+
shotsOnTarget: c(e.shotsOnTarget, t.shotsOnTarget),
|
|
962
|
+
// Discipline
|
|
963
|
+
yellowCards: c(e.yellowCards, t.yellowCards),
|
|
964
|
+
redCards: c(e.redCards, t.redCards),
|
|
965
|
+
foulsCommitted: c(e.foulsCommitted, t.foulsCommitted),
|
|
966
|
+
penaltiesCommitted: c(e.penaltiesCommitted, t.penaltiesCommitted),
|
|
967
|
+
// Penalties
|
|
968
|
+
penaltiesMissed: c(e.penaltiesMissed, t.penaltiesMissed),
|
|
969
|
+
// Defensive
|
|
970
|
+
cleansheets: c(e.cleansheets, t.cleansheets),
|
|
971
|
+
// Goalkeeper-specific
|
|
972
|
+
saves: c(e.saves, t.saves),
|
|
973
|
+
conceded: c(e.conceded, t.conceded),
|
|
974
|
+
caughtBall: c(e.caughtBall, t.caughtBall),
|
|
975
|
+
penaltiesReceived: c(e.penaltiesReceived, t.penaltiesReceived),
|
|
976
|
+
// Other
|
|
977
|
+
offsides: c(e.offsides, t.offsides),
|
|
978
|
+
// Concatenate raw statistics from both entries
|
|
979
|
+
rawStatistics: [...e.rawStatistics ?? [], ...t.rawStatistics ?? []]
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
async function le(e, t) {
|
|
983
|
+
const n = t || g(), { sportal365Sports: o } = n, { seasonIds: s, teamId: a, languageCode: l, next: d } = e, u = d ?? { revalidate: 0 }, _ = {
|
|
984
|
+
season_ids: s.join(","),
|
|
985
|
+
team_id: a,
|
|
986
|
+
language_code: l ?? o?.languageCode ?? "en"
|
|
987
|
+
}, m = await p.get({
|
|
900
988
|
path: "/v2/statistics/players/season",
|
|
901
|
-
params:
|
|
989
|
+
params: _,
|
|
902
990
|
headers: {
|
|
903
|
-
"Accept-Language":
|
|
991
|
+
"Accept-Language": l ?? o?.languageCode ?? "en"
|
|
904
992
|
},
|
|
905
|
-
next:
|
|
993
|
+
next: u,
|
|
906
994
|
config: n
|
|
907
995
|
});
|
|
908
|
-
if (!
|
|
996
|
+
if (!m.statistics)
|
|
909
997
|
return console.error("[getFootballPlayerSeasonStatistics] Invalid API response - missing statistics array:", {
|
|
910
|
-
teamId:
|
|
911
|
-
seasonIds:
|
|
912
|
-
response:
|
|
998
|
+
teamId: a,
|
|
999
|
+
seasonIds: s,
|
|
1000
|
+
response: m
|
|
913
1001
|
}), {};
|
|
914
|
-
if (
|
|
1002
|
+
if (m.statistics.length === 0)
|
|
915
1003
|
throw console.warn("[getFootballPlayerSeasonStatistics] API returned empty statistics array:", {
|
|
916
|
-
teamId:
|
|
917
|
-
seasonIds:
|
|
1004
|
+
teamId: a,
|
|
1005
|
+
seasonIds: s,
|
|
918
1006
|
hint: "This could be due to: wrong credentials, wrong project header, no data for this team/season, or API issue"
|
|
919
1007
|
}), new Error(
|
|
920
|
-
`No player statistics found for team ${
|
|
1008
|
+
`No player statistics found for team ${a} in seasons ${s.join(", ")}. This could be due to: wrong credentials, wrong X-Project header, or no data available for this team/season.`
|
|
921
1009
|
);
|
|
922
1010
|
const h = {};
|
|
923
|
-
for (const
|
|
924
|
-
const
|
|
925
|
-
h[
|
|
1011
|
+
for (const C of m.statistics) {
|
|
1012
|
+
const T = C.player.id;
|
|
1013
|
+
h[T] = de(C, a);
|
|
926
1014
|
}
|
|
927
1015
|
return h;
|
|
928
1016
|
}
|
|
929
|
-
async function
|
|
930
|
-
const
|
|
1017
|
+
async function Ke(e, t) {
|
|
1018
|
+
const n = t || g(), { sportal365Sports: o } = n, { playerIds: s, seasonIds: a, languageCode: l, next: d } = e, u = d ?? { revalidate: 0 }, _ = {
|
|
1019
|
+
player_ids: s.join(","),
|
|
1020
|
+
season_ids: a.join(","),
|
|
1021
|
+
language_code: l ?? o?.languageCode ?? "en"
|
|
1022
|
+
}, m = await p.get({
|
|
1023
|
+
path: "/v2/statistics/players/season",
|
|
1024
|
+
params: _,
|
|
1025
|
+
headers: {
|
|
1026
|
+
"Accept-Language": l ?? o?.languageCode ?? "en"
|
|
1027
|
+
},
|
|
1028
|
+
next: u,
|
|
1029
|
+
config: n
|
|
1030
|
+
});
|
|
1031
|
+
if (!m.statistics)
|
|
1032
|
+
return console.error("[getFootballPlayerSeasonStatisticsByPlayerIds] Invalid API response - missing statistics array:", {
|
|
1033
|
+
playerIds: s,
|
|
1034
|
+
seasonIds: a,
|
|
1035
|
+
response: m
|
|
1036
|
+
}), {};
|
|
1037
|
+
if (m.statistics.length === 0)
|
|
1038
|
+
return {};
|
|
1039
|
+
const h = {};
|
|
1040
|
+
for (const C of m.statistics) {
|
|
1041
|
+
const T = C.player.id, f = ue(C);
|
|
1042
|
+
h[T] ? h[T] = ce(h[T], f) : h[T] = f;
|
|
1043
|
+
}
|
|
1044
|
+
return h;
|
|
1045
|
+
}
|
|
1046
|
+
async function qe(e, t, n) {
|
|
1047
|
+
const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
|
|
931
1048
|
path: `/v2/teams/${e}`,
|
|
932
1049
|
params: {
|
|
933
|
-
language_code: t?.languageCode ??
|
|
1050
|
+
language_code: t?.languageCode ?? s?.languageCode ?? "en",
|
|
934
1051
|
optional_data: "form"
|
|
935
1052
|
},
|
|
936
1053
|
headers: {
|
|
937
|
-
"Accept-Language": t?.languageCode ??
|
|
1054
|
+
"Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
|
|
938
1055
|
},
|
|
939
1056
|
next: t?.next,
|
|
940
1057
|
config: o
|
|
941
1058
|
});
|
|
942
|
-
return
|
|
1059
|
+
return ne(a);
|
|
943
1060
|
}
|
|
944
|
-
async function
|
|
945
|
-
const o = n ||
|
|
1061
|
+
async function Xe(e, t, n) {
|
|
1062
|
+
const o = n || g(), { sportal365Sports: s } = o, a = t?.seasonIds && t.seasonIds.length > 0 ? { revalidate: 0 } : t?.next, l = await p.get({
|
|
946
1063
|
path: `/v2/teams/${e}/squad`,
|
|
947
1064
|
params: {
|
|
948
|
-
language_code: t?.languageCode ??
|
|
1065
|
+
language_code: t?.languageCode ?? s?.languageCode ?? "en",
|
|
949
1066
|
memberStatus: t?.memberStatus ?? "ACTIVE"
|
|
950
1067
|
},
|
|
951
1068
|
headers: {
|
|
952
|
-
"Accept-Language": t?.languageCode ??
|
|
1069
|
+
"Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
|
|
953
1070
|
},
|
|
954
|
-
next:
|
|
1071
|
+
next: a,
|
|
955
1072
|
config: o
|
|
956
|
-
}),
|
|
1073
|
+
}), d = ie(l);
|
|
957
1074
|
if (t?.seasonIds && t.seasonIds.length > 0)
|
|
958
1075
|
try {
|
|
959
|
-
const
|
|
1076
|
+
const u = await le(
|
|
960
1077
|
{
|
|
961
1078
|
seasonIds: t.seasonIds,
|
|
962
1079
|
teamId: e,
|
|
@@ -965,23 +1082,23 @@ async function We(e, t, n) {
|
|
|
965
1082
|
},
|
|
966
1083
|
o
|
|
967
1084
|
);
|
|
968
|
-
for (const
|
|
969
|
-
const
|
|
970
|
-
|
|
1085
|
+
for (const _ of d.players) {
|
|
1086
|
+
const m = u[_.id];
|
|
1087
|
+
m && (_.seasonStatistics = m);
|
|
971
1088
|
}
|
|
972
|
-
} catch (
|
|
1089
|
+
} catch (u) {
|
|
973
1090
|
console.error("[getFootballTeamSquad] Failed to fetch player statistics:", {
|
|
974
|
-
error:
|
|
975
|
-
stack:
|
|
1091
|
+
error: u instanceof Error ? u.message : String(u),
|
|
1092
|
+
stack: u instanceof Error ? u.stack : void 0,
|
|
976
1093
|
teamId: e,
|
|
977
1094
|
seasonIds: t.seasonIds
|
|
978
1095
|
});
|
|
979
1096
|
}
|
|
980
1097
|
else
|
|
981
1098
|
console.warn("[getFootballTeamSquad] No seasonIds provided, skipping stats fetch");
|
|
982
|
-
return
|
|
1099
|
+
return d;
|
|
983
1100
|
}
|
|
984
|
-
function
|
|
1101
|
+
function me(e) {
|
|
985
1102
|
return {
|
|
986
1103
|
id: String(e.id),
|
|
987
1104
|
name: e.name,
|
|
@@ -993,22 +1110,22 @@ function ce(e) {
|
|
|
993
1110
|
id: String(e.country.id),
|
|
994
1111
|
name: e.country.name,
|
|
995
1112
|
flag: e.country.url_flag,
|
|
996
|
-
providerRef:
|
|
1113
|
+
providerRef: r(e.country.uuid)
|
|
997
1114
|
},
|
|
998
1115
|
seasons: e.seasons.map((t) => ({
|
|
999
1116
|
id: String(t.id),
|
|
1000
1117
|
name: t.name,
|
|
1001
1118
|
slug: t.slug,
|
|
1002
1119
|
active: t.active,
|
|
1003
|
-
providerRef:
|
|
1120
|
+
providerRef: r(t.uuid)
|
|
1004
1121
|
})),
|
|
1005
1122
|
assets: e.url_logo ? {
|
|
1006
1123
|
logo: e.url_logo
|
|
1007
1124
|
} : void 0,
|
|
1008
|
-
providerRef:
|
|
1125
|
+
providerRef: r(e.uuid)
|
|
1009
1126
|
};
|
|
1010
1127
|
}
|
|
1011
|
-
function
|
|
1128
|
+
function ge(e) {
|
|
1012
1129
|
const t = e.rounds.map((n) => ({
|
|
1013
1130
|
id: n.id,
|
|
1014
1131
|
name: n.name,
|
|
@@ -1017,7 +1134,7 @@ function ue(e) {
|
|
|
1017
1134
|
status: n.status,
|
|
1018
1135
|
startDate: n.start_date,
|
|
1019
1136
|
endDate: n.end_date,
|
|
1020
|
-
providerRef:
|
|
1137
|
+
providerRef: r(n.uuid)
|
|
1021
1138
|
}));
|
|
1022
1139
|
return {
|
|
1023
1140
|
id: e.stage.id,
|
|
@@ -1031,11 +1148,11 @@ function ue(e) {
|
|
|
1031
1148
|
startDate: e.stage.start_date,
|
|
1032
1149
|
endDate: e.stage.end_date,
|
|
1033
1150
|
rounds: t,
|
|
1034
|
-
providerRef:
|
|
1151
|
+
providerRef: r(e.stage.uuid)
|
|
1035
1152
|
};
|
|
1036
1153
|
}
|
|
1037
|
-
function
|
|
1038
|
-
const { season: t, stages: n } = e, { tournament: o } = t,
|
|
1154
|
+
function pe(e) {
|
|
1155
|
+
const { season: t, stages: n } = e, { tournament: o } = t, s = {
|
|
1039
1156
|
id: o.id,
|
|
1040
1157
|
name: o.name,
|
|
1041
1158
|
slug: o.slug,
|
|
@@ -1047,12 +1164,12 @@ function le(e) {
|
|
|
1047
1164
|
name: o.country.name,
|
|
1048
1165
|
code: o.country.code ?? void 0,
|
|
1049
1166
|
flag: o.country.assets?.flag?.url,
|
|
1050
|
-
providerRef:
|
|
1167
|
+
providerRef: r(o.country.uuid)
|
|
1051
1168
|
},
|
|
1052
1169
|
assets: o.assets?.logo?.url ? {
|
|
1053
1170
|
logo: o.assets.logo.url
|
|
1054
1171
|
} : void 0,
|
|
1055
|
-
providerRef:
|
|
1172
|
+
providerRef: r(o.uuid)
|
|
1056
1173
|
};
|
|
1057
1174
|
return {
|
|
1058
1175
|
id: t.id,
|
|
@@ -1060,45 +1177,45 @@ function le(e) {
|
|
|
1060
1177
|
slug: t.slug,
|
|
1061
1178
|
active: t.status === "ACTIVE",
|
|
1062
1179
|
status: t.status === "ACTIVE" ? "ACTIVE" : "INACTIVE",
|
|
1063
|
-
competition:
|
|
1064
|
-
stages: n.map(
|
|
1065
|
-
providerRef:
|
|
1180
|
+
competition: s,
|
|
1181
|
+
stages: n.map(ge),
|
|
1182
|
+
providerRef: r(t.uuid)
|
|
1066
1183
|
};
|
|
1067
1184
|
}
|
|
1068
|
-
async function
|
|
1069
|
-
const o = n ||
|
|
1185
|
+
async function ze(e, t, n) {
|
|
1186
|
+
const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
|
|
1070
1187
|
path: `/tournaments/${e}`,
|
|
1071
1188
|
params: {
|
|
1072
|
-
language_code: t?.languageCode ??
|
|
1189
|
+
language_code: t?.languageCode ?? s?.languageCode ?? "en"
|
|
1073
1190
|
},
|
|
1074
1191
|
headers: {
|
|
1075
|
-
"Accept-Language": t?.languageCode ??
|
|
1192
|
+
"Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
|
|
1076
1193
|
},
|
|
1077
1194
|
next: t?.next,
|
|
1078
1195
|
config: o
|
|
1079
1196
|
});
|
|
1080
|
-
return
|
|
1197
|
+
return me(a);
|
|
1081
1198
|
}
|
|
1082
|
-
async function
|
|
1083
|
-
const n = t ||
|
|
1199
|
+
async function Je(e, t) {
|
|
1200
|
+
const n = t || g(), { sportal365Sports: o } = n;
|
|
1084
1201
|
if (!e?.seasonId && !e?.competitionId)
|
|
1085
1202
|
throw new Error("Either seasonId or competitionId must be provided");
|
|
1086
|
-
const
|
|
1203
|
+
const s = {
|
|
1087
1204
|
language_code: e?.languageCode ?? o?.languageCode ?? "en"
|
|
1088
1205
|
};
|
|
1089
|
-
e.seasonId ?
|
|
1090
|
-
const
|
|
1206
|
+
e.seasonId ? s.season_id = e.seasonId : e.competitionId && (s.tournament_id = e.competitionId, e.status && (s.status = e.status));
|
|
1207
|
+
const a = await p.get({
|
|
1091
1208
|
path: "/v2/seasons/details",
|
|
1092
|
-
params:
|
|
1209
|
+
params: s,
|
|
1093
1210
|
headers: {
|
|
1094
1211
|
"Accept-Language": e?.languageCode ?? o?.languageCode ?? "en"
|
|
1095
1212
|
},
|
|
1096
1213
|
next: e?.next,
|
|
1097
1214
|
config: n
|
|
1098
1215
|
});
|
|
1099
|
-
return
|
|
1216
|
+
return pe(a);
|
|
1100
1217
|
}
|
|
1101
|
-
function
|
|
1218
|
+
function O(e) {
|
|
1102
1219
|
return {
|
|
1103
1220
|
championsleague: "championsLeague",
|
|
1104
1221
|
europaleague: "europaLeague",
|
|
@@ -1108,44 +1225,44 @@ function I(e) {
|
|
|
1108
1225
|
promotion: "promotion"
|
|
1109
1226
|
}[e.toLowerCase()] ?? e.toLowerCase().replace(/_/g, "");
|
|
1110
1227
|
}
|
|
1111
|
-
function
|
|
1228
|
+
function fe(e) {
|
|
1112
1229
|
const t = e.toLowerCase();
|
|
1113
1230
|
return t === "relegation" ? "BOTTOM" : t === "playoff" ? "MIDDLE" : "TOP";
|
|
1114
1231
|
}
|
|
1115
|
-
function
|
|
1232
|
+
function _e(e, t) {
|
|
1116
1233
|
if (!t || t.length === 0)
|
|
1117
1234
|
return;
|
|
1118
|
-
const n = t.map((
|
|
1119
|
-
const
|
|
1235
|
+
const n = t.map((s) => {
|
|
1236
|
+
const a = s.event, l = a.home_team.id === e, d = l ? a.away_team : a.home_team, u = `${a.goal_home}-${a.goal_away}`;
|
|
1120
1237
|
return {
|
|
1121
|
-
matchId:
|
|
1122
|
-
result:
|
|
1123
|
-
score:
|
|
1124
|
-
homeAway:
|
|
1238
|
+
matchId: a.id.toString(),
|
|
1239
|
+
result: s.outcome,
|
|
1240
|
+
score: u,
|
|
1241
|
+
homeAway: l ? "HOME" : "AWAY",
|
|
1125
1242
|
opponent: {
|
|
1126
|
-
id:
|
|
1127
|
-
name:
|
|
1128
|
-
logo:
|
|
1243
|
+
id: d.id.toString(),
|
|
1244
|
+
name: d.name,
|
|
1245
|
+
logo: d.url_logo
|
|
1129
1246
|
},
|
|
1130
|
-
date: new Date(
|
|
1247
|
+
date: new Date(a.start_time),
|
|
1131
1248
|
competition: void 0
|
|
1132
1249
|
// Football API doesn't include competition in form
|
|
1133
1250
|
};
|
|
1134
|
-
}), o = n.map((
|
|
1251
|
+
}), o = n.map((s) => s.result).join("");
|
|
1135
1252
|
return {
|
|
1136
1253
|
competitorId: e.toString(),
|
|
1137
1254
|
results: n,
|
|
1138
1255
|
formString: o
|
|
1139
1256
|
};
|
|
1140
1257
|
}
|
|
1141
|
-
function
|
|
1258
|
+
function ye(e) {
|
|
1142
1259
|
return {
|
|
1143
|
-
key:
|
|
1260
|
+
key: O(e.code),
|
|
1144
1261
|
name: e.name,
|
|
1145
|
-
position:
|
|
1262
|
+
position: fe(e.type)
|
|
1146
1263
|
};
|
|
1147
1264
|
}
|
|
1148
|
-
function
|
|
1265
|
+
function he(e) {
|
|
1149
1266
|
const t = {
|
|
1150
1267
|
played: e.played,
|
|
1151
1268
|
won: e.wins,
|
|
@@ -1155,27 +1272,28 @@ function fe(e) {
|
|
|
1155
1272
|
goalsAgainst: e.goals_against,
|
|
1156
1273
|
goalDifference: e.goals_for - e.goals_against,
|
|
1157
1274
|
points: e.points
|
|
1158
|
-
}, n = e.rules?.length > 0 ? e.rules.map((
|
|
1275
|
+
}, n = e.rules?.length > 0 ? e.rules.map((s) => O(s.code)) : void 0, o = _e(e.team.id, e.team.form ?? []);
|
|
1159
1276
|
return {
|
|
1160
1277
|
rank: e.rank,
|
|
1161
1278
|
competitor: {
|
|
1162
1279
|
id: e.team.id.toString(),
|
|
1163
1280
|
name: e.team.name,
|
|
1164
1281
|
shortName: e.team.short_name ?? void 0,
|
|
1165
|
-
logo: e.team.url_logo
|
|
1282
|
+
logo: e.team.url_logo,
|
|
1283
|
+
uuid: e.team.uuid
|
|
1166
1284
|
},
|
|
1167
1285
|
stats: t,
|
|
1168
1286
|
form: o,
|
|
1169
1287
|
rules: n
|
|
1170
1288
|
};
|
|
1171
1289
|
}
|
|
1172
|
-
function
|
|
1173
|
-
const t = e.map(
|
|
1290
|
+
function ve(e) {
|
|
1291
|
+
const t = e.map(he), n = /* @__PURE__ */ new Map();
|
|
1174
1292
|
for (const o of e)
|
|
1175
1293
|
if (o.rules)
|
|
1176
|
-
for (const
|
|
1177
|
-
const
|
|
1178
|
-
n.has(
|
|
1294
|
+
for (const s of o.rules) {
|
|
1295
|
+
const a = O(s.code);
|
|
1296
|
+
n.has(a) || n.set(a, ye(s));
|
|
1179
1297
|
}
|
|
1180
1298
|
return {
|
|
1181
1299
|
entries: t,
|
|
@@ -1184,11 +1302,11 @@ function _e(e) {
|
|
|
1184
1302
|
}
|
|
1185
1303
|
};
|
|
1186
1304
|
}
|
|
1187
|
-
async function
|
|
1188
|
-
const n = t ||
|
|
1305
|
+
async function Qe(e, t) {
|
|
1306
|
+
const n = t || g(), { sportal365Sports: o } = n, s = e.expand?.join(","), a = await p.get({
|
|
1189
1307
|
path: `/tournaments/seasons/stages/${e.stageId}/standing`,
|
|
1190
1308
|
params: {
|
|
1191
|
-
expand:
|
|
1309
|
+
expand: s,
|
|
1192
1310
|
language_code: e.languageCode ?? o?.languageCode ?? "en"
|
|
1193
1311
|
},
|
|
1194
1312
|
headers: {
|
|
@@ -1197,9 +1315,9 @@ async function qe(e, t) {
|
|
|
1197
1315
|
next: e.next,
|
|
1198
1316
|
config: n
|
|
1199
1317
|
});
|
|
1200
|
-
return !
|
|
1318
|
+
return !a || a.length === 0 ? { entries: [], metadata: { legend: [] } } : ve(a);
|
|
1201
1319
|
}
|
|
1202
|
-
function
|
|
1320
|
+
function P(e) {
|
|
1203
1321
|
return {
|
|
1204
1322
|
id: e.id,
|
|
1205
1323
|
name: e.name,
|
|
@@ -1215,13 +1333,13 @@ function F(e) {
|
|
|
1215
1333
|
]
|
|
1216
1334
|
};
|
|
1217
1335
|
}
|
|
1218
|
-
function
|
|
1336
|
+
function Te(e) {
|
|
1219
1337
|
return {
|
|
1220
1338
|
id: e.id,
|
|
1221
1339
|
name: e.name,
|
|
1222
1340
|
type: e.type?.toUpperCase() || "LEAGUE",
|
|
1223
1341
|
gender: e.gender?.toUpperCase(),
|
|
1224
|
-
country: e.country ?
|
|
1342
|
+
country: e.country ? P(e.country) : void 0,
|
|
1225
1343
|
assets: e.assets?.logo ? {
|
|
1226
1344
|
logo: e.assets.logo
|
|
1227
1345
|
} : void 0,
|
|
@@ -1233,9 +1351,9 @@ function ye(e) {
|
|
|
1233
1351
|
]
|
|
1234
1352
|
};
|
|
1235
1353
|
}
|
|
1236
|
-
function
|
|
1354
|
+
function Ce(e) {
|
|
1237
1355
|
if (e.status) {
|
|
1238
|
-
const
|
|
1356
|
+
const a = {
|
|
1239
1357
|
notstarted: { code: "not_started", type: "NOT_STARTED", name: "Not Started" },
|
|
1240
1358
|
live: { code: "live", type: "LIVE", name: "Live" },
|
|
1241
1359
|
finished: { code: "finished", type: "FINISHED", name: "Finished" },
|
|
@@ -1243,8 +1361,8 @@ function he(e) {
|
|
|
1243
1361
|
cancelled: { code: "cancelled", type: "CANCELLED", name: "Cancelled" },
|
|
1244
1362
|
abandoned: { code: "abandoned", type: "ABANDONED", name: "Abandoned" }
|
|
1245
1363
|
}[e.status.type];
|
|
1246
|
-
if (
|
|
1247
|
-
return
|
|
1364
|
+
if (a)
|
|
1365
|
+
return a;
|
|
1248
1366
|
}
|
|
1249
1367
|
let t = "not_started", n = "NOT_STARTED", o = "Not Started";
|
|
1250
1368
|
return e.finished_at ? (t = "finished", n = "FINISHED", o = "Finished") : e.started_at && (t = "live", n = "LIVE", o = "Live"), {
|
|
@@ -1253,14 +1371,14 @@ function he(e) {
|
|
|
1253
1371
|
type: n
|
|
1254
1372
|
};
|
|
1255
1373
|
}
|
|
1256
|
-
function
|
|
1374
|
+
function Se(e) {
|
|
1257
1375
|
return {
|
|
1258
1376
|
kickoffTime: new Date(e.kickoff_at),
|
|
1259
1377
|
currentMinute: e.minute ?? void 0,
|
|
1260
1378
|
currentPeriod: void 0
|
|
1261
1379
|
};
|
|
1262
1380
|
}
|
|
1263
|
-
function
|
|
1381
|
+
function F(e) {
|
|
1264
1382
|
return {
|
|
1265
1383
|
id: e.id,
|
|
1266
1384
|
name: e.name,
|
|
@@ -1269,7 +1387,7 @@ function N(e) {
|
|
|
1269
1387
|
threeLetterCode: e.code,
|
|
1270
1388
|
type: e.national ? "national" : "club",
|
|
1271
1389
|
gender: e.gender?.toUpperCase(),
|
|
1272
|
-
country: e.country ?
|
|
1390
|
+
country: e.country ? P(e.country) : void 0,
|
|
1273
1391
|
assets: e.assets?.logo ? {
|
|
1274
1392
|
logo: e.assets.logo
|
|
1275
1393
|
} : void 0,
|
|
@@ -1281,7 +1399,7 @@ function N(e) {
|
|
|
1281
1399
|
]
|
|
1282
1400
|
};
|
|
1283
1401
|
}
|
|
1284
|
-
function
|
|
1402
|
+
function Ie(e) {
|
|
1285
1403
|
if (!e) return;
|
|
1286
1404
|
const t = (o) => o ? {
|
|
1287
1405
|
competitorOne: o.home_goals !== null ? String(o.home_goals) : "0",
|
|
@@ -1304,12 +1422,12 @@ function b(e) {
|
|
|
1304
1422
|
return {
|
|
1305
1423
|
id: e.id,
|
|
1306
1424
|
sport: e.sport ?? "football",
|
|
1307
|
-
status:
|
|
1308
|
-
timing:
|
|
1309
|
-
competitorOne:
|
|
1310
|
-
competitorTwo:
|
|
1311
|
-
score:
|
|
1312
|
-
competition: e.context?.competition ?
|
|
1425
|
+
status: Ce(e),
|
|
1426
|
+
timing: Se(e),
|
|
1427
|
+
competitorOne: F(e.home_team),
|
|
1428
|
+
competitorTwo: F(e.away_team),
|
|
1429
|
+
score: Ie(e.scores),
|
|
1430
|
+
competition: e.context?.competition ? Te(e.context.competition) : void 0,
|
|
1313
1431
|
lineupStatus: e.lineups_confirmed ? "CONFIRMED" : "NOT_AVAILABLE",
|
|
1314
1432
|
updatedAt: e.updated_at ? new Date(e.updated_at) : void 0,
|
|
1315
1433
|
isUndecided: e.undecided ?? void 0,
|
|
@@ -1321,27 +1439,27 @@ function b(e) {
|
|
|
1321
1439
|
]
|
|
1322
1440
|
};
|
|
1323
1441
|
}
|
|
1324
|
-
function
|
|
1442
|
+
function Ze(e) {
|
|
1325
1443
|
return b(e.data);
|
|
1326
1444
|
}
|
|
1327
|
-
function
|
|
1445
|
+
function we(e) {
|
|
1328
1446
|
return e.data.map(b);
|
|
1329
1447
|
}
|
|
1330
|
-
function
|
|
1448
|
+
function Ae(e) {
|
|
1331
1449
|
return e.map(b);
|
|
1332
1450
|
}
|
|
1333
|
-
async function
|
|
1451
|
+
async function Ee(e, t, n) {
|
|
1334
1452
|
const o = await e.loyalty.getTemplateMatches(
|
|
1335
1453
|
t,
|
|
1336
1454
|
n?.groupId,
|
|
1337
1455
|
n?.disableCache
|
|
1338
1456
|
);
|
|
1339
|
-
return
|
|
1457
|
+
return Ae(o);
|
|
1340
1458
|
}
|
|
1341
|
-
async function
|
|
1342
|
-
return (await
|
|
1459
|
+
async function et(e, t, n, o) {
|
|
1460
|
+
return (await Ee(e, t, o)).filter((a) => a.competitorOne.id === n || a.competitorTwo.id === n);
|
|
1343
1461
|
}
|
|
1344
|
-
async function
|
|
1462
|
+
async function tt(e, t, n) {
|
|
1345
1463
|
const o = await e.loyalty.getTemplateById(t, n?.disableCache);
|
|
1346
1464
|
return {
|
|
1347
1465
|
id: o.id,
|
|
@@ -1353,14 +1471,14 @@ async function Qe(e, t, n) {
|
|
|
1353
1471
|
markets: o.markets || [],
|
|
1354
1472
|
teamIds: o.teamIds || [],
|
|
1355
1473
|
matchIds: o.matchIds || [],
|
|
1356
|
-
groups: (o.groups || []).map((
|
|
1357
|
-
groupId:
|
|
1358
|
-
label:
|
|
1359
|
-
flags:
|
|
1474
|
+
groups: (o.groups || []).map((a) => ({
|
|
1475
|
+
groupId: a.groupId,
|
|
1476
|
+
label: a.label,
|
|
1477
|
+
flags: a.flags || [],
|
|
1360
1478
|
filters: {
|
|
1361
|
-
fromDate:
|
|
1362
|
-
toDate:
|
|
1363
|
-
matchIds:
|
|
1479
|
+
fromDate: a.filters?.fromDate || "",
|
|
1480
|
+
toDate: a.filters?.toDate || "",
|
|
1481
|
+
matchIds: a.filters?.matchIds || []
|
|
1364
1482
|
}
|
|
1365
1483
|
})),
|
|
1366
1484
|
gameIds: o.gameIds || [],
|
|
@@ -1388,7 +1506,7 @@ async function Qe(e, t, n) {
|
|
|
1388
1506
|
adContent: o.adContent || ""
|
|
1389
1507
|
};
|
|
1390
1508
|
}
|
|
1391
|
-
function
|
|
1509
|
+
function Oe(e) {
|
|
1392
1510
|
return {
|
|
1393
1511
|
"1x2": "1X2",
|
|
1394
1512
|
12: "12",
|
|
@@ -1405,64 +1523,64 @@ function Ee(e) {
|
|
|
1405
1523
|
FIRST_HALF_AND_FINAL_RESULT: "FIRST_HALF_AND_FINAL_RESULT"
|
|
1406
1524
|
}[e] || e.toUpperCase();
|
|
1407
1525
|
}
|
|
1408
|
-
function
|
|
1526
|
+
function be(e, t) {
|
|
1409
1527
|
const n = /* @__PURE__ */ new Map();
|
|
1410
|
-
return e.forEach((o,
|
|
1528
|
+
return e.forEach((o, s) => {
|
|
1411
1529
|
if (!o || o.length === 0)
|
|
1412
1530
|
return;
|
|
1413
|
-
const
|
|
1414
|
-
const
|
|
1531
|
+
const l = (t ? o.filter((d) => d.bookmaker && t.includes(d.bookmaker.id)) : o).filter((d) => d.bookmaker && d.markets && d.markets.length > 0).map((d) => {
|
|
1532
|
+
const u = d.bookmaker, _ = u.assets?.[0], m = u.branding?.backgroundColor || _?.backgroundColor, h = u.branding?.textColor || (Re(m) ? "#FFFFFF" : "#000000"), C = _?.transparentBackgroundUrl || _?.logo, T = u.eventUrls?.find((f) => f.appType === "desktop")?.url || u.links?.find((f) => f.appType === "desktop")?.homepageUrl || u.url || "";
|
|
1415
1533
|
return {
|
|
1416
1534
|
operator: {
|
|
1417
|
-
id:
|
|
1418
|
-
name:
|
|
1419
|
-
url:
|
|
1535
|
+
id: u.id,
|
|
1536
|
+
name: u.name,
|
|
1537
|
+
url: T,
|
|
1420
1538
|
branding: {
|
|
1421
|
-
backgroundColor:
|
|
1539
|
+
backgroundColor: m,
|
|
1422
1540
|
textColor: h,
|
|
1423
|
-
logo:
|
|
1541
|
+
logo: C
|
|
1424
1542
|
}
|
|
1425
1543
|
},
|
|
1426
|
-
type:
|
|
1544
|
+
type: d.type,
|
|
1427
1545
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1428
|
-
markets:
|
|
1546
|
+
markets: d.markets.map((f) => ({
|
|
1429
1547
|
type: {
|
|
1430
|
-
id:
|
|
1431
|
-
code:
|
|
1432
|
-
name:
|
|
1548
|
+
id: f.type.id,
|
|
1549
|
+
code: f.type.code,
|
|
1550
|
+
name: f.type.name
|
|
1433
1551
|
},
|
|
1434
1552
|
period: {
|
|
1435
|
-
id:
|
|
1436
|
-
type:
|
|
1437
|
-
name:
|
|
1553
|
+
id: f.scope.id,
|
|
1554
|
+
type: f.scope.type,
|
|
1555
|
+
name: f.scope.name
|
|
1438
1556
|
},
|
|
1439
1557
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1440
|
-
selections:
|
|
1441
|
-
const
|
|
1442
|
-
let
|
|
1443
|
-
return
|
|
1444
|
-
id:
|
|
1445
|
-
name:
|
|
1446
|
-
code:
|
|
1447
|
-
value:
|
|
1448
|
-
odds:
|
|
1449
|
-
oddsOld:
|
|
1450
|
-
movement:
|
|
1451
|
-
url:
|
|
1558
|
+
selections: f.selections.map((v) => {
|
|
1559
|
+
const x = v.urls?.find((M) => M.appType === "desktop")?.url;
|
|
1560
|
+
let I = "NONE";
|
|
1561
|
+
return v.movement === "UP" ? I = "UP" : v.movement === "DOWN" && (I = "DOWN"), {
|
|
1562
|
+
id: v.id,
|
|
1563
|
+
name: v.name,
|
|
1564
|
+
code: v.code,
|
|
1565
|
+
value: v.value,
|
|
1566
|
+
odds: v.odds,
|
|
1567
|
+
oddsOld: v.oddsOld,
|
|
1568
|
+
movement: I,
|
|
1569
|
+
url: x
|
|
1452
1570
|
};
|
|
1453
1571
|
})
|
|
1454
1572
|
}))
|
|
1455
1573
|
};
|
|
1456
1574
|
});
|
|
1457
|
-
n.set(
|
|
1575
|
+
n.set(s, l);
|
|
1458
1576
|
}), n;
|
|
1459
1577
|
}
|
|
1460
|
-
function
|
|
1578
|
+
function Re(e) {
|
|
1461
1579
|
if (!e) return !0;
|
|
1462
|
-
const t = e.replace("#", ""), n = parseInt(t.substring(0, 2), 16), o = parseInt(t.substring(2, 4), 16),
|
|
1463
|
-
return (0.2126 * n + 0.7152 * o + 0.0722 *
|
|
1580
|
+
const t = e.replace("#", ""), n = parseInt(t.substring(0, 2), 16), o = parseInt(t.substring(2, 4), 16), s = parseInt(t.substring(4, 6), 16);
|
|
1581
|
+
return (0.2126 * n + 0.7152 * o + 0.0722 * s) / 255 < 0.5;
|
|
1464
1582
|
}
|
|
1465
|
-
async function
|
|
1583
|
+
async function ot(e, t, n) {
|
|
1466
1584
|
if (!t || t.length === 0)
|
|
1467
1585
|
return /* @__PURE__ */ new Map();
|
|
1468
1586
|
const o = {
|
|
@@ -1470,43 +1588,44 @@ async function Ze(e, t, n) {
|
|
|
1470
1588
|
scopeType: n?.scopeType || "ORDINARY_TIME",
|
|
1471
1589
|
oddFormat: n?.oddFormat || "DECIMAL"
|
|
1472
1590
|
};
|
|
1473
|
-
n?.marketTypes && n.marketTypes.length > 0 && (o.marketTypes = n.marketTypes.map((
|
|
1474
|
-
const
|
|
1475
|
-
return
|
|
1591
|
+
n?.marketTypes && n.marketTypes.length > 0 && (o.marketTypes = n.marketTypes.map((a) => Oe(a)));
|
|
1592
|
+
const s = await e.odds.getByMatchIds(t, o);
|
|
1593
|
+
return be(s, n?.bookmakerIds);
|
|
1476
1594
|
}
|
|
1477
1595
|
export {
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
$e as
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1596
|
+
Qe as A,
|
|
1597
|
+
qe as B,
|
|
1598
|
+
Xe as C,
|
|
1599
|
+
Ee as D,
|
|
1600
|
+
et as E,
|
|
1601
|
+
tt as F,
|
|
1602
|
+
Me as G,
|
|
1603
|
+
Le as H,
|
|
1604
|
+
De as S,
|
|
1605
|
+
W as a,
|
|
1606
|
+
Ne as b,
|
|
1607
|
+
U as c,
|
|
1608
|
+
Pe as d,
|
|
1609
|
+
xe as e,
|
|
1610
|
+
p as f,
|
|
1611
|
+
g,
|
|
1612
|
+
Fe as h,
|
|
1613
|
+
Ze as i,
|
|
1614
|
+
we as j,
|
|
1615
|
+
ke as k,
|
|
1616
|
+
Ue as l,
|
|
1617
|
+
ot as m,
|
|
1618
|
+
ze as n,
|
|
1619
|
+
je as o,
|
|
1620
|
+
Ge as p,
|
|
1621
|
+
Ve as q,
|
|
1622
|
+
He as r,
|
|
1623
|
+
Be as s,
|
|
1624
|
+
r as t,
|
|
1625
|
+
$e as u,
|
|
1626
|
+
Ye as v,
|
|
1627
|
+
We as w,
|
|
1628
|
+
le as x,
|
|
1629
|
+
Ke as y,
|
|
1630
|
+
Je as z
|
|
1512
1631
|
};
|