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