fansunited-data-layer 0.8.6 → 0.9.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/basketball/games/index.d.ts.map +1 -1
- package/api/sportal365-sports/basketball/games/types.d.ts +4 -0
- package/api/sportal365-sports/basketball/games/types.d.ts.map +1 -1
- package/api/sportal365-sports/constants.d.ts +2 -0
- package/api/sportal365-sports/constants.d.ts.map +1 -1
- package/api/sportal365-sports/index.d.ts +2 -0
- package/api/sportal365-sports/index.d.ts.map +1 -1
- package/api/sportal365-sports/standings/http.d.ts +8 -0
- package/api/sportal365-sports/standings/http.d.ts.map +1 -0
- package/api/sportal365-sports/standings/index.d.ts +48 -0
- package/api/sportal365-sports/standings/index.d.ts.map +1 -0
- package/api/sportal365-sports/standings/standing.transformer.d.ts +18 -0
- package/api/sportal365-sports/standings/standing.transformer.d.ts.map +1 -0
- package/api/sportal365-sports/standings/standing.types.d.ts +105 -0
- package/api/sportal365-sports/standings/standing.types.d.ts.map +1 -0
- package/client.cjs +1 -1
- package/client.js +2 -2
- package/fansunited-data-layer.cjs +1 -1
- package/fansunited-data-layer.js +814 -632
- package/index.d.ts +3 -3
- package/index.d.ts.map +1 -1
- package/{matches-BefXoB5p.js → matches-CIte0UPI.js} +41 -40
- package/matches-D5jlWsqr.cjs +1 -0
- package/package.json +1 -1
- package/types/canonical/index.d.ts +1 -1
- package/types/canonical/index.d.ts.map +1 -1
- package/types/canonical/standing.types.d.ts +25 -0
- package/types/canonical/standing.types.d.ts.map +1 -1
- package/matches-CiVDiSIz.cjs +0 -1
package/fansunited-data-layer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
1
|
+
import { t as v, g as A, f as ae, c as b, S as re, a as ee, b as ce, d as le, e as de, h as ue, i as me, j as fe } from "./matches-CIte0UPI.js";
|
|
2
|
+
import { k as Ho, l as Uo, m as bo, n as ko, o as Bo, p as $o, q as xo, r as Wo, s as Yo, u as Qo, v as qo, w as Vo, x as jo, y as Ko, z as zo, A as Xo, B as Jo, C as Zo, D as wo, E as en, F as tn, G as on } from "./matches-CIte0UPI.js";
|
|
3
3
|
import { useMemo as G } from "react";
|
|
4
|
-
function
|
|
4
|
+
function pe(e) {
|
|
5
5
|
return {
|
|
6
6
|
entityType: "tournament",
|
|
7
7
|
id: e.id.toString(),
|
|
@@ -15,15 +15,15 @@ function me(e) {
|
|
|
15
15
|
name: e.country.name,
|
|
16
16
|
code: void 0,
|
|
17
17
|
flag: e.country.url_flag ?? void 0,
|
|
18
|
-
providerRef:
|
|
18
|
+
providerRef: v(e.country.uuid)
|
|
19
19
|
},
|
|
20
20
|
assets: e.url_logo ? {
|
|
21
21
|
logo: e.url_logo
|
|
22
22
|
} : void 0,
|
|
23
|
-
providerRef:
|
|
23
|
+
providerRef: v(e.uuid)
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function ge(e) {
|
|
27
27
|
return {
|
|
28
28
|
entityType: "player",
|
|
29
29
|
id: e.id.toString(),
|
|
@@ -37,15 +37,15 @@ function fe(e) {
|
|
|
37
37
|
name: e.country.name,
|
|
38
38
|
code: void 0,
|
|
39
39
|
flag: e.country.url_flag ?? void 0,
|
|
40
|
-
providerRef:
|
|
40
|
+
providerRef: v(e.country.uuid)
|
|
41
41
|
},
|
|
42
42
|
assets: e.url_thumb ? {
|
|
43
43
|
photo: e.url_thumb
|
|
44
44
|
} : void 0,
|
|
45
|
-
providerRef:
|
|
45
|
+
providerRef: v(e.uuid)
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function ye(e) {
|
|
49
49
|
return {
|
|
50
50
|
entityType: "team",
|
|
51
51
|
id: e.id.toString(),
|
|
@@ -60,15 +60,15 @@ function ge(e) {
|
|
|
60
60
|
name: e.country.name,
|
|
61
61
|
code: void 0,
|
|
62
62
|
flag: e.country.url_flag ?? void 0,
|
|
63
|
-
providerRef:
|
|
63
|
+
providerRef: v(e.country.uuid)
|
|
64
64
|
},
|
|
65
65
|
assets: e.url_logo ? {
|
|
66
66
|
logo: e.url_logo
|
|
67
67
|
} : void 0,
|
|
68
|
-
providerRef:
|
|
68
|
+
providerRef: v(e.uuid)
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function he(e) {
|
|
72
72
|
return {
|
|
73
73
|
entityType: "president",
|
|
74
74
|
id: e.id.toString(),
|
|
@@ -80,15 +80,15 @@ function pe(e) {
|
|
|
80
80
|
name: e.country.name,
|
|
81
81
|
code: void 0,
|
|
82
82
|
flag: e.country.url_flag ?? void 0,
|
|
83
|
-
providerRef:
|
|
83
|
+
providerRef: v(e.country.uuid)
|
|
84
84
|
},
|
|
85
85
|
assets: e.url_thumb ? {
|
|
86
86
|
photo: e.url_thumb
|
|
87
87
|
} : void 0,
|
|
88
|
-
providerRef:
|
|
88
|
+
providerRef: v(e.uuid)
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function Te(e) {
|
|
92
92
|
return {
|
|
93
93
|
entityType: "venue",
|
|
94
94
|
id: e.id.toString(),
|
|
@@ -102,16 +102,16 @@ function ye(e) {
|
|
|
102
102
|
name: e.city.country.name,
|
|
103
103
|
code: void 0,
|
|
104
104
|
flag: e.city.country.url_flag ?? void 0,
|
|
105
|
-
providerRef:
|
|
105
|
+
providerRef: v(e.city.country.uuid)
|
|
106
106
|
},
|
|
107
|
-
providerRef:
|
|
107
|
+
providerRef: v(e.city.uuid)
|
|
108
108
|
},
|
|
109
109
|
country: {
|
|
110
110
|
id: e.country.id.toString(),
|
|
111
111
|
name: e.country.name,
|
|
112
112
|
code: void 0,
|
|
113
113
|
flag: e.country.url_flag ?? void 0,
|
|
114
|
-
providerRef:
|
|
114
|
+
providerRef: v(e.country.uuid)
|
|
115
115
|
},
|
|
116
116
|
profile: {
|
|
117
117
|
latitude: e.profile.lat,
|
|
@@ -121,10 +121,10 @@ function ye(e) {
|
|
|
121
121
|
assets: e.url_thumb ? {
|
|
122
122
|
image: e.url_thumb
|
|
123
123
|
} : void 0,
|
|
124
|
-
providerRef:
|
|
124
|
+
providerRef: v(e.uuid)
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function _e(e) {
|
|
128
128
|
return {
|
|
129
129
|
entityType: "coach",
|
|
130
130
|
id: e.id.toString(),
|
|
@@ -136,39 +136,39 @@ function he(e) {
|
|
|
136
136
|
name: e.country.name,
|
|
137
137
|
code: void 0,
|
|
138
138
|
flag: e.country.url_flag ?? void 0,
|
|
139
|
-
providerRef:
|
|
139
|
+
providerRef: v(e.country.uuid)
|
|
140
140
|
},
|
|
141
141
|
assets: e.url_thumb ? {
|
|
142
142
|
photo: e.url_thumb
|
|
143
143
|
} : void 0,
|
|
144
|
-
providerRef:
|
|
144
|
+
providerRef: v(e.uuid)
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function ve(e) {
|
|
148
148
|
switch (e.entity_type) {
|
|
149
149
|
case "tournament":
|
|
150
|
-
return
|
|
150
|
+
return pe(e);
|
|
151
151
|
case "player":
|
|
152
|
-
return fe(e);
|
|
153
|
-
case "team":
|
|
154
152
|
return ge(e);
|
|
153
|
+
case "team":
|
|
154
|
+
return ye(e);
|
|
155
155
|
case "president":
|
|
156
|
-
return
|
|
156
|
+
return he(e);
|
|
157
157
|
case "venue":
|
|
158
|
-
return
|
|
158
|
+
return Te(e);
|
|
159
159
|
case "coach":
|
|
160
|
-
return
|
|
160
|
+
return _e(e);
|
|
161
161
|
default:
|
|
162
162
|
throw new Error(`Unknown entity type: ${e.entity_type}`);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
async function
|
|
165
|
+
async function kt(e, t) {
|
|
166
166
|
if (!e.query || e.query.trim() === "")
|
|
167
167
|
return {
|
|
168
168
|
results: [],
|
|
169
169
|
query: e.query || ""
|
|
170
170
|
};
|
|
171
|
-
const o = t || A(), { sportal365Sports: n } = o, s = e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["tournament", "player", "team", "president", "venue", "coach"], i = await
|
|
171
|
+
const o = t || A(), { sportal365Sports: n } = o, s = e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["tournament", "player", "team", "president", "venue", "coach"], i = await ae.get({
|
|
172
172
|
path: "/search",
|
|
173
173
|
params: {
|
|
174
174
|
query: e.query.trim(),
|
|
@@ -185,12 +185,12 @@ async function Nt(e, t) {
|
|
|
185
185
|
results: [],
|
|
186
186
|
query: e.query
|
|
187
187
|
} : {
|
|
188
|
-
results: i.map(
|
|
188
|
+
results: i.map(ve),
|
|
189
189
|
query: e.query
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
|
-
const
|
|
193
|
-
function
|
|
192
|
+
const Ae = b(re);
|
|
193
|
+
function Se(e) {
|
|
194
194
|
const t = {
|
|
195
195
|
FINISHED: "finished",
|
|
196
196
|
NOT_STARTED: "not_started",
|
|
@@ -207,7 +207,7 @@ function _e(e) {
|
|
|
207
207
|
type: o
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function X(e) {
|
|
211
211
|
return {
|
|
212
212
|
id: e.id,
|
|
213
213
|
name: e.name,
|
|
@@ -217,13 +217,13 @@ function Q(e) {
|
|
|
217
217
|
gender: e.gender
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function Ce(e) {
|
|
221
221
|
return {
|
|
222
222
|
kickoffTime: new Date(e.game_time),
|
|
223
223
|
currentMinute: e.minute
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function Oe(e) {
|
|
227
227
|
if (!e.season?.competition) return;
|
|
228
228
|
const t = e.season.competition;
|
|
229
229
|
return {
|
|
@@ -249,7 +249,7 @@ function Ce(e) {
|
|
|
249
249
|
} : void 0
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function Le(e) {
|
|
253
253
|
if (e)
|
|
254
254
|
return {
|
|
255
255
|
id: e.id,
|
|
@@ -257,7 +257,7 @@ function Ae(e) {
|
|
|
257
257
|
slug: e.slug
|
|
258
258
|
};
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function Ee(e) {
|
|
261
261
|
if (!e || e.length === 0) return;
|
|
262
262
|
const t = e.filter((i) => i.result_type.category === "single_period");
|
|
263
263
|
if (t.length === 0) return;
|
|
@@ -280,31 +280,31 @@ function Oe(e) {
|
|
|
280
280
|
}
|
|
281
281
|
};
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function Fe(e) {
|
|
284
284
|
if (e.winner)
|
|
285
285
|
return {
|
|
286
286
|
competitorId: e.winner.id
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function Ne(e) {
|
|
290
290
|
return {
|
|
291
291
|
id: e.id,
|
|
292
292
|
slug: e.slug,
|
|
293
|
-
status:
|
|
294
|
-
timing:
|
|
295
|
-
competitorOne:
|
|
296
|
-
competitorTwo:
|
|
297
|
-
competition:
|
|
293
|
+
status: Se(e.status),
|
|
294
|
+
timing: Ce(e),
|
|
295
|
+
competitorOne: X(e.home_team),
|
|
296
|
+
competitorTwo: X(e.away_team),
|
|
297
|
+
competition: Oe(e),
|
|
298
298
|
round: e.round ? {
|
|
299
299
|
id: e.round.id,
|
|
300
300
|
key: e.round.uuid,
|
|
301
301
|
name: e.round.name,
|
|
302
302
|
type: "REGULAR",
|
|
303
|
-
providerRef:
|
|
303
|
+
providerRef: v(e.round.uuid)
|
|
304
304
|
} : void 0,
|
|
305
|
-
venue:
|
|
306
|
-
score:
|
|
307
|
-
winner:
|
|
305
|
+
venue: Le(e.arena),
|
|
306
|
+
score: Ee(e.score),
|
|
307
|
+
winner: Fe(e),
|
|
308
308
|
odds: e.odds ? ee(e.odds) : void 0,
|
|
309
309
|
coverage: e.coverage === "NOT_LIVE" ? "UNKNOWN" : e.coverage,
|
|
310
310
|
providerRef: [
|
|
@@ -315,15 +315,17 @@ function Re(e) {
|
|
|
315
315
|
]
|
|
316
316
|
};
|
|
317
317
|
}
|
|
318
|
-
async function
|
|
318
|
+
async function Bt(e, t) {
|
|
319
319
|
const o = t || A(), { sportal365Sports: n } = o;
|
|
320
|
-
return (await
|
|
320
|
+
return (await Ae.get({
|
|
321
321
|
path: "/games",
|
|
322
322
|
params: {
|
|
323
323
|
offset: "0",
|
|
324
324
|
limit: "1000",
|
|
325
325
|
competition_list: e?.competitionList,
|
|
326
326
|
status_type: e?.statusTypes,
|
|
327
|
+
from_game_time: e?.fromGameTime,
|
|
328
|
+
to_game_time: e?.toGameTime,
|
|
327
329
|
odd_client: e?.oddClient ?? n?.oddClient,
|
|
328
330
|
odd_type: e?.oddType,
|
|
329
331
|
market_types: e?.marketTypes,
|
|
@@ -334,10 +336,10 @@ async function Rt(e, t) {
|
|
|
334
336
|
},
|
|
335
337
|
next: e?.next,
|
|
336
338
|
config: o
|
|
337
|
-
})).games.map(
|
|
339
|
+
})).games.map(Ne);
|
|
338
340
|
}
|
|
339
|
-
const
|
|
340
|
-
function
|
|
341
|
+
const Pe = b(ce);
|
|
342
|
+
function Ie(e) {
|
|
341
343
|
const t = {
|
|
342
344
|
FINISHED: "finished",
|
|
343
345
|
NOT_STARTED: "not_started",
|
|
@@ -353,7 +355,7 @@ function Ee(e) {
|
|
|
353
355
|
type: o
|
|
354
356
|
};
|
|
355
357
|
}
|
|
356
|
-
function
|
|
358
|
+
function J(e) {
|
|
357
359
|
if (e.type === "PLAYER")
|
|
358
360
|
return {
|
|
359
361
|
id: e.id,
|
|
@@ -413,14 +415,14 @@ function X(e) {
|
|
|
413
415
|
gender: e.details?.[0]?.gender
|
|
414
416
|
};
|
|
415
417
|
}
|
|
416
|
-
function
|
|
418
|
+
function Re(e) {
|
|
417
419
|
return {
|
|
418
420
|
kickoffTime: new Date(e.scheduled_start_time),
|
|
419
421
|
phaseStartedAt: e.started_at ? new Date(e.started_at) : void 0,
|
|
420
422
|
finishedAt: e.finished_at ? new Date(e.finished_at) : void 0
|
|
421
423
|
};
|
|
422
424
|
}
|
|
423
|
-
function
|
|
425
|
+
function Me(e) {
|
|
424
426
|
if (!e.tournament) return;
|
|
425
427
|
const t = e.tournament;
|
|
426
428
|
return {
|
|
@@ -436,28 +438,28 @@ function Le(e) {
|
|
|
436
438
|
} : void 0
|
|
437
439
|
};
|
|
438
440
|
}
|
|
439
|
-
function
|
|
441
|
+
function Ge(e) {
|
|
440
442
|
if (!e.results || e.results.length === 0) return;
|
|
441
|
-
const t = e.results.filter((
|
|
443
|
+
const t = e.results.filter((c) => /^set\d+$/i.test(c.type.code));
|
|
442
444
|
if (t.length === 0) return;
|
|
443
445
|
const o = [];
|
|
444
|
-
for (const
|
|
445
|
-
const
|
|
446
|
-
!
|
|
447
|
-
competitorOne:
|
|
446
|
+
for (const c of t) {
|
|
447
|
+
const d = c.values.find((l) => l.position === "1"), u = c.values.find((l) => l.position === "2");
|
|
448
|
+
!d || !u || d.value == null || u.value == null || o.push({
|
|
449
|
+
competitorOne: d.value,
|
|
448
450
|
competitorTwo: u.value
|
|
449
451
|
});
|
|
450
452
|
}
|
|
451
453
|
if (o.length === 0) return;
|
|
452
|
-
const n = e.results.find((
|
|
453
|
-
let
|
|
454
|
-
return s?.value != null && i?.value != null ? (
|
|
455
|
-
competitorOne: String(
|
|
456
|
-
competitorTwo: String(
|
|
454
|
+
const n = e.results.find((c) => c.type.code === "setswon"), s = n?.values.find((c) => c.position === "1"), i = n?.values.find((c) => c.position === "2");
|
|
455
|
+
let a, r;
|
|
456
|
+
return s?.value != null && i?.value != null ? (a = parseInt(s.value), r = parseInt(i.value)) : (a = o.filter((c) => parseInt(c.competitorOne) > parseInt(c.competitorTwo)).length, r = o.filter((c) => parseInt(c.competitorTwo) > parseInt(c.competitorOne)).length), {
|
|
457
|
+
competitorOne: String(a),
|
|
458
|
+
competitorTwo: String(r),
|
|
457
459
|
breakdown: {
|
|
458
460
|
total: {
|
|
459
|
-
competitorOne: String(
|
|
460
|
-
competitorTwo: String(
|
|
461
|
+
competitorOne: String(a),
|
|
462
|
+
competitorTwo: String(r)
|
|
461
463
|
},
|
|
462
464
|
periods: o
|
|
463
465
|
}
|
|
@@ -470,24 +472,24 @@ function De(e) {
|
|
|
470
472
|
competitorId: t.id
|
|
471
473
|
};
|
|
472
474
|
}
|
|
473
|
-
function
|
|
475
|
+
function He(e) {
|
|
474
476
|
const t = e.participants.sort((o, n) => o.position - n.position);
|
|
475
477
|
return {
|
|
476
478
|
id: e.id,
|
|
477
479
|
slug: e.slug,
|
|
478
|
-
status:
|
|
479
|
-
timing:
|
|
480
|
-
competitorOne:
|
|
481
|
-
competitorTwo:
|
|
482
|
-
competition:
|
|
480
|
+
status: Ie(e.status),
|
|
481
|
+
timing: Re(e),
|
|
482
|
+
competitorOne: J(t[0]),
|
|
483
|
+
competitorTwo: J(t[1]),
|
|
484
|
+
competition: Me(e),
|
|
483
485
|
round: e.round ? {
|
|
484
486
|
id: e.round.id,
|
|
485
487
|
key: e.round.uuid,
|
|
486
488
|
name: e.round.name,
|
|
487
489
|
type: "REGULAR",
|
|
488
|
-
providerRef:
|
|
490
|
+
providerRef: v(e.round.uuid)
|
|
489
491
|
} : void 0,
|
|
490
|
-
score:
|
|
492
|
+
score: Ge(e),
|
|
491
493
|
winner: De(e),
|
|
492
494
|
odds: e.odds ? ee(e.odds) : void 0,
|
|
493
495
|
coverage: e.coverage?.type === "NOT_LIVE" ? "UNKNOWN" : e.coverage?.type,
|
|
@@ -505,9 +507,9 @@ function Ge(e) {
|
|
|
505
507
|
]
|
|
506
508
|
};
|
|
507
509
|
}
|
|
508
|
-
async function
|
|
510
|
+
async function $t(e, t) {
|
|
509
511
|
const o = t || A(), { sportal365Sports: n } = o;
|
|
510
|
-
return (await
|
|
512
|
+
return (await Pe.get({
|
|
511
513
|
path: "/matches/livescore",
|
|
512
514
|
params: {
|
|
513
515
|
date: e?.date,
|
|
@@ -528,10 +530,10 @@ async function Ft(e, t) {
|
|
|
528
530
|
},
|
|
529
531
|
next: e?.next,
|
|
530
532
|
config: o
|
|
531
|
-
})).matches.map(
|
|
533
|
+
})).matches.map(He);
|
|
532
534
|
}
|
|
533
|
-
const
|
|
534
|
-
function
|
|
535
|
+
const Ue = b(le);
|
|
536
|
+
function E(e) {
|
|
535
537
|
return {
|
|
536
538
|
language: e.language,
|
|
537
539
|
name: e.name,
|
|
@@ -545,7 +547,7 @@ function F(e) {
|
|
|
545
547
|
url: e.url
|
|
546
548
|
};
|
|
547
549
|
}
|
|
548
|
-
function
|
|
550
|
+
function M(e) {
|
|
549
551
|
if (e)
|
|
550
552
|
return {
|
|
551
553
|
id: e.id,
|
|
@@ -553,13 +555,13 @@ function D(e) {
|
|
|
553
555
|
name: e.name,
|
|
554
556
|
shortName: e.short_name ?? void 0,
|
|
555
557
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
556
|
-
translations: e.translations.map(
|
|
558
|
+
translations: e.translations.map(E),
|
|
557
559
|
displayAsset: F(e.display_asset),
|
|
558
560
|
slug: e.slug,
|
|
559
561
|
providerRef: e.id
|
|
560
562
|
};
|
|
561
563
|
}
|
|
562
|
-
function
|
|
564
|
+
function V(e) {
|
|
563
565
|
return {
|
|
564
566
|
entityType: "team",
|
|
565
567
|
id: e.id,
|
|
@@ -567,12 +569,12 @@ function K(e) {
|
|
|
567
569
|
name: e.name,
|
|
568
570
|
shortName: e.short_name ?? void 0,
|
|
569
571
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
570
|
-
translations: e.translations.map(
|
|
572
|
+
translations: e.translations.map(E),
|
|
571
573
|
displayAsset: F(e.display_asset),
|
|
572
574
|
slug: e.slug,
|
|
573
575
|
tagScore: e.tag_score ?? void 0,
|
|
574
576
|
sport: e.sport,
|
|
575
|
-
country:
|
|
577
|
+
country: M(e.country),
|
|
576
578
|
gender: e.gender,
|
|
577
579
|
competitionIds: e.competition_ids,
|
|
578
580
|
type: e.type,
|
|
@@ -589,12 +591,12 @@ function te(e) {
|
|
|
589
591
|
name: e.name,
|
|
590
592
|
shortName: e.short_name ?? void 0,
|
|
591
593
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
592
|
-
translations: e.translations.map(
|
|
594
|
+
translations: e.translations.map(E),
|
|
593
595
|
displayAsset: F(e.display_asset),
|
|
594
596
|
slug: e.slug,
|
|
595
597
|
tagScore: e.tag_score ?? void 0,
|
|
596
598
|
sport: e.sport,
|
|
597
|
-
country:
|
|
599
|
+
country: M(e.country),
|
|
598
600
|
providerRef: e.id
|
|
599
601
|
};
|
|
600
602
|
}
|
|
@@ -606,12 +608,12 @@ function be(e) {
|
|
|
606
608
|
name: e.name,
|
|
607
609
|
shortName: e.short_name ?? void 0,
|
|
608
610
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
609
|
-
translations: e.translations.map(
|
|
611
|
+
translations: e.translations.map(E),
|
|
610
612
|
displayAsset: F(e.display_asset),
|
|
611
613
|
slug: e.slug,
|
|
612
614
|
tagScore: e.tag_score ?? void 0,
|
|
613
615
|
sport: e.sport,
|
|
614
|
-
country:
|
|
616
|
+
country: M(e.country),
|
|
615
617
|
gender: e.gender,
|
|
616
618
|
providerRef: e.id
|
|
617
619
|
};
|
|
@@ -624,19 +626,19 @@ function ke(e) {
|
|
|
624
626
|
name: e.name,
|
|
625
627
|
shortName: e.short_name ?? void 0,
|
|
626
628
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
627
|
-
translations: e.translations.map(
|
|
629
|
+
translations: e.translations.map(E),
|
|
628
630
|
displayAsset: F(e.display_asset),
|
|
629
631
|
slug: e.slug,
|
|
630
632
|
tagScore: e.tag_score ?? void 0,
|
|
631
633
|
sport: e.sport,
|
|
632
|
-
country:
|
|
634
|
+
country: M(e.country),
|
|
633
635
|
gender: e.gender,
|
|
634
636
|
birthdate: e.birthdate ?? void 0,
|
|
635
637
|
position: e.position ?? void 0,
|
|
636
638
|
providerRef: e.id
|
|
637
639
|
};
|
|
638
640
|
}
|
|
639
|
-
function
|
|
641
|
+
function Be(e) {
|
|
640
642
|
return {
|
|
641
643
|
entityType: "coach",
|
|
642
644
|
id: e.id,
|
|
@@ -644,18 +646,18 @@ function He(e) {
|
|
|
644
646
|
name: e.name,
|
|
645
647
|
shortName: e.short_name ?? void 0,
|
|
646
648
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
647
|
-
translations: e.translations.map(
|
|
649
|
+
translations: e.translations.map(E),
|
|
648
650
|
displayAsset: F(e.display_asset),
|
|
649
651
|
slug: e.slug,
|
|
650
652
|
tagScore: e.tag_score ?? void 0,
|
|
651
653
|
sport: e.sport,
|
|
652
|
-
country:
|
|
654
|
+
country: M(e.country),
|
|
653
655
|
gender: e.gender,
|
|
654
656
|
birthdate: e.birthdate ?? void 0,
|
|
655
657
|
providerRef: e.id
|
|
656
658
|
};
|
|
657
659
|
}
|
|
658
|
-
function
|
|
660
|
+
function $e(e) {
|
|
659
661
|
return {
|
|
660
662
|
entityType: "referee",
|
|
661
663
|
id: e.id,
|
|
@@ -663,18 +665,18 @@ function Ue(e) {
|
|
|
663
665
|
name: e.name,
|
|
664
666
|
shortName: e.short_name ?? void 0,
|
|
665
667
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
666
|
-
translations: e.translations.map(
|
|
668
|
+
translations: e.translations.map(E),
|
|
667
669
|
displayAsset: F(e.display_asset),
|
|
668
670
|
slug: e.slug,
|
|
669
671
|
tagScore: e.tag_score ?? void 0,
|
|
670
672
|
sport: e.sport,
|
|
671
|
-
country:
|
|
673
|
+
country: M(e.country),
|
|
672
674
|
gender: e.gender,
|
|
673
675
|
birthdate: e.birthdate ?? void 0,
|
|
674
676
|
providerRef: e.id
|
|
675
677
|
};
|
|
676
678
|
}
|
|
677
|
-
function
|
|
679
|
+
function xe(e) {
|
|
678
680
|
return {
|
|
679
681
|
entityType: "venue",
|
|
680
682
|
id: e.id,
|
|
@@ -682,17 +684,17 @@ function Be(e) {
|
|
|
682
684
|
name: e.name,
|
|
683
685
|
shortName: e.short_name ?? void 0,
|
|
684
686
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
685
|
-
translations: e.translations.map(
|
|
687
|
+
translations: e.translations.map(E),
|
|
686
688
|
displayAsset: F(e.display_asset),
|
|
687
689
|
slug: e.slug,
|
|
688
690
|
tagScore: e.tag_score ?? void 0,
|
|
689
691
|
sport: e.sport,
|
|
690
|
-
country:
|
|
692
|
+
country: M(e.country),
|
|
691
693
|
city: e.city ? te(e.city) : void 0,
|
|
692
694
|
providerRef: e.id
|
|
693
695
|
};
|
|
694
696
|
}
|
|
695
|
-
function
|
|
697
|
+
function We(e) {
|
|
696
698
|
return {
|
|
697
699
|
entityType: e.entity_type,
|
|
698
700
|
id: e.id,
|
|
@@ -700,19 +702,19 @@ function $e(e) {
|
|
|
700
702
|
name: e.name,
|
|
701
703
|
shortName: e.short_name ?? void 0,
|
|
702
704
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
703
|
-
translations: e.translations.map(
|
|
705
|
+
translations: e.translations.map(E),
|
|
704
706
|
displayAsset: F(e.display_asset),
|
|
705
707
|
slug: e.slug,
|
|
706
708
|
tagScore: e.tag_score ?? void 0,
|
|
707
709
|
sport: e.sport,
|
|
708
|
-
country:
|
|
710
|
+
country: M(e.country),
|
|
709
711
|
gender: e.gender,
|
|
710
712
|
type: e.type ?? void 0,
|
|
711
713
|
region: e.region ?? void 0,
|
|
712
714
|
providerRef: e.id
|
|
713
715
|
};
|
|
714
716
|
}
|
|
715
|
-
function
|
|
717
|
+
function Ye(e) {
|
|
716
718
|
return {
|
|
717
719
|
entityType: "match",
|
|
718
720
|
id: e.id,
|
|
@@ -720,19 +722,19 @@ function xe(e) {
|
|
|
720
722
|
name: e.name,
|
|
721
723
|
shortName: e.short_name ?? void 0,
|
|
722
724
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
723
|
-
translations: e.translations.map(
|
|
725
|
+
translations: e.translations.map(E),
|
|
724
726
|
displayAsset: F(e.display_asset),
|
|
725
727
|
slug: e.slug,
|
|
726
728
|
tagScore: e.tag_score ?? void 0,
|
|
727
729
|
sport: e.sport,
|
|
728
730
|
competitionId: e.competition_id ?? void 0,
|
|
729
731
|
startTime: e.start_time ?? void 0,
|
|
730
|
-
homeTeam: e.home_team ?
|
|
731
|
-
awayTeam: e.away_team ?
|
|
732
|
+
homeTeam: e.home_team ? V(e.home_team) : void 0,
|
|
733
|
+
awayTeam: e.away_team ? V(e.away_team) : void 0,
|
|
732
734
|
providerRef: e.id
|
|
733
735
|
};
|
|
734
736
|
}
|
|
735
|
-
function
|
|
737
|
+
function Qe(e) {
|
|
736
738
|
return {
|
|
737
739
|
entityType: "country",
|
|
738
740
|
id: e.id,
|
|
@@ -740,7 +742,7 @@ function We(e) {
|
|
|
740
742
|
name: e.name,
|
|
741
743
|
shortName: e.short_name ?? void 0,
|
|
742
744
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
743
|
-
translations: e.translations.map(
|
|
745
|
+
translations: e.translations.map(E),
|
|
744
746
|
displayAsset: F(e.display_asset),
|
|
745
747
|
slug: e.slug,
|
|
746
748
|
tagScore: e.tag_score ?? void 0,
|
|
@@ -751,7 +753,7 @@ function We(e) {
|
|
|
751
753
|
function qe(e) {
|
|
752
754
|
switch (e.entity_type) {
|
|
753
755
|
case "team":
|
|
754
|
-
return
|
|
756
|
+
return V(e);
|
|
755
757
|
case "city":
|
|
756
758
|
return te(e);
|
|
757
759
|
case "horse":
|
|
@@ -759,28 +761,28 @@ function qe(e) {
|
|
|
759
761
|
case "player":
|
|
760
762
|
return ke(e);
|
|
761
763
|
case "coach":
|
|
762
|
-
return
|
|
764
|
+
return Be(e);
|
|
763
765
|
case "referee":
|
|
764
|
-
return
|
|
766
|
+
return $e(e);
|
|
765
767
|
case "venue":
|
|
766
|
-
return
|
|
768
|
+
return xe(e);
|
|
767
769
|
case "tournament":
|
|
768
770
|
case "competition":
|
|
769
|
-
return
|
|
771
|
+
return We(e);
|
|
770
772
|
case "match":
|
|
771
|
-
return
|
|
773
|
+
return Ye(e);
|
|
772
774
|
case "country":
|
|
773
|
-
return
|
|
775
|
+
return Qe(e);
|
|
774
776
|
default: {
|
|
775
777
|
const t = e;
|
|
776
778
|
throw new Error(`Unknown entity type: ${t.entity_type}`);
|
|
777
779
|
}
|
|
778
780
|
}
|
|
779
781
|
}
|
|
780
|
-
async function
|
|
782
|
+
async function xt(e = {}, t) {
|
|
781
783
|
const o = t ?? A(), n = {};
|
|
782
784
|
e.name && (n.name = e.name), e.entityTypes && e.entityTypes.length > 0 && (n.entity_type = e.entityTypes.join(",")), e.sports && e.sports.length > 0 && (n.sport = e.sports.join(",")), e.eventStartTime && (n.event_start_time = e.eventStartTime), e.ids && e.ids.length > 0 && (n.ids = e.ids.join(",")), e.competitionIds && e.competitionIds.length > 0 && (n.competition_ids = e.competitionIds.join(",")), e.domain && (n.domain = e.domain), e.inputLanguage && (n.input_language = e.inputLanguage), e.translationLanguage && (n.translation_language = e.translationLanguage), e.limit !== void 0 && (n.limit = e.limit.toString()), e.offset !== void 0 && (n.offset = e.offset.toString());
|
|
783
|
-
const s = await
|
|
785
|
+
const s = await Ue.get({
|
|
784
786
|
path: "/suggest",
|
|
785
787
|
params: n,
|
|
786
788
|
next: e.next,
|
|
@@ -794,8 +796,187 @@ async function Et(e = {}, t) {
|
|
|
794
796
|
query: e.name
|
|
795
797
|
};
|
|
796
798
|
}
|
|
797
|
-
const Ve =
|
|
798
|
-
function je(e
|
|
799
|
+
const Ve = b(de);
|
|
800
|
+
function je(e) {
|
|
801
|
+
const t = {
|
|
802
|
+
RANK: null,
|
|
803
|
+
// rank is a top-level field, not a stat
|
|
804
|
+
PLAYED: "played",
|
|
805
|
+
WINS: "won",
|
|
806
|
+
DRAWS: "drawn",
|
|
807
|
+
LOSSES: "lost",
|
|
808
|
+
GOALS_FOR: "goalsFor",
|
|
809
|
+
GOALS_AGAINST: "goalsAgainst",
|
|
810
|
+
POINTS: "points"
|
|
811
|
+
};
|
|
812
|
+
return e in t ? t[e] : e.toLowerCase().replace(/_/g, "");
|
|
813
|
+
}
|
|
814
|
+
function oe(e) {
|
|
815
|
+
return {
|
|
816
|
+
CHAMPIONS_LEAGUE: "championsLeague",
|
|
817
|
+
CHAMPIONS_LEAGUE_QUAL: "championsLeagueQual",
|
|
818
|
+
CHAMPIONS_LEAGUE_8: "championsLeague8",
|
|
819
|
+
CHAMPIONS_LEAGUE_PLAYOFF_16: "championsLeaguePlayoff16",
|
|
820
|
+
PLAYOFF_TO_CHAMPIONS_LEAGUE: "playoffChampionsLeague",
|
|
821
|
+
PLAYOFF_TO_CHAMPIONS_LEAGUE_QUAL: "playoffChampionsLeagueQual",
|
|
822
|
+
UEFA_CUP: "europaLeague",
|
|
823
|
+
UEFA_QUAL: "europaLeagueQual",
|
|
824
|
+
UEFA_QUAL_PLAYOFF: "europaLeagueQualPlayoff",
|
|
825
|
+
PLAYOFF_TO_UEFA_QUAL: "playoffEuropaLeagueQual",
|
|
826
|
+
EUROPA_LEAGUE_8: "europaLeague8",
|
|
827
|
+
EUROPA_LEAGUE_PLAYOFF_16: "europaLeaguePlayoff16",
|
|
828
|
+
EUROPA_CONFERENCE_LEAGUE_PLAYOFF: "europaConferenceLeaguePlayoff",
|
|
829
|
+
EUROPA_CONFERENCE_LEAGUE_QUALIFICATION: "europaConferenceLeagueQual",
|
|
830
|
+
CONFERENCE_LEAGUE_8: "conferenceLeague8",
|
|
831
|
+
CONFERENCE_LEAGUE_PLAYOFF_16: "conferenceLeaguePlayoff16",
|
|
832
|
+
RELEGATION: "relegation",
|
|
833
|
+
RELEGATION_PLAYOFF: "relegationPlayoff",
|
|
834
|
+
PROMOTION: "promotion",
|
|
835
|
+
PROMOTION_PLAYOFF: "promotionPlayoff",
|
|
836
|
+
QUALIFICATION_TO_NEXT_STAGE: "qualificationNextStage",
|
|
837
|
+
POSSIBLE_QUALIFICATION_TO_NEXT_STAGE: "possibleQualificationNextStage",
|
|
838
|
+
CHAMPIONSHIP_PLAYOFF: "championshipPlayoff",
|
|
839
|
+
OVERALL_CHAMPIONSHIP_PLAYOFF: "overallChampionshipPlayoff",
|
|
840
|
+
CONFERENCE_CHAMPIONSHIP_PLAYOFF: "conferenceChampionshipPlayoff",
|
|
841
|
+
POSSIBLE_CONFERENCE_CHAMPIONSHIP_PLAYOFF: "possibleConferenceChampionshipPlayoff",
|
|
842
|
+
DIVISION_CHAMPIONSHIP_PLAYOFF: "divisionChampionshipPlayoff",
|
|
843
|
+
COPA_LIBERTADORES: "copaLibertadores",
|
|
844
|
+
PLAYOFF_TO_COPA_LIBERTADORES: "playoffCopaLibertadores",
|
|
845
|
+
PLAYOFF_TO_COPA_LIBERTADORES_QUAL: "playoffCopaLibertadoresQual",
|
|
846
|
+
PLAYOFF_TO_COPA_SUDAMERICANA: "playoffCopaSudamericana",
|
|
847
|
+
PLAYOFF_TO_CONCACAF_CHAMPIONS_LEAGUE: "playoffConcacafChampionsLeague",
|
|
848
|
+
CAF_CHAMPIONS_QUAL: "cafChampionsQual",
|
|
849
|
+
CAF_CONFEGERATION_CUP_QUAL: "cafConfederationCupQual",
|
|
850
|
+
CFU_CLUB_CHAMPIONSHIP: "cfuClubChampionship",
|
|
851
|
+
AFC_CHAMPIONS_LEAGUE: "afcChampionsLeague",
|
|
852
|
+
AFC_CHAMPIONS_LEAGUE_QUAL: "afcChampionsLeagueQual",
|
|
853
|
+
PLAYOFF_TO_AFC_CHAMPIONS_LEAGUE_QUAL: "playoffAfcChampionsLeagueQual",
|
|
854
|
+
WORLD_CUP: "worldCup"
|
|
855
|
+
}[e] ?? e.toLowerCase().replace(/_/g, "");
|
|
856
|
+
}
|
|
857
|
+
function Ke(e) {
|
|
858
|
+
return e === "RELEGATION" || e === "RELEGATION_PLAYOFF" ? "BOTTOM" : e.includes("PLAYOFF") ? "MIDDLE" : "TOP";
|
|
859
|
+
}
|
|
860
|
+
function ze(e, t) {
|
|
861
|
+
if (!t || t.length === 0) return;
|
|
862
|
+
const o = {
|
|
863
|
+
win: "W",
|
|
864
|
+
loss: "L",
|
|
865
|
+
draw: "D"
|
|
866
|
+
}, n = t.map((s) => {
|
|
867
|
+
const i = s.participants.find((m) => m.id === e), a = s.participants.find((m) => m.id !== e), r = i?.position === "1", c = s.result.find((m) => m.type === "display"), d = c?.results.find((m) => m.position === "1")?.value, u = c?.results.find((m) => m.position === "2")?.value, l = d && u ? `${d}-${u}` : void 0;
|
|
868
|
+
return {
|
|
869
|
+
matchId: s.id,
|
|
870
|
+
result: o[s.outcome] ?? "L",
|
|
871
|
+
score: l,
|
|
872
|
+
homeAway: r ? "HOME" : "AWAY",
|
|
873
|
+
opponent: {
|
|
874
|
+
id: a?.id ?? "",
|
|
875
|
+
name: a?.name ?? "",
|
|
876
|
+
logo: a?.display_asset?.url
|
|
877
|
+
},
|
|
878
|
+
date: new Date(s.start_time),
|
|
879
|
+
competition: s.competition ? {
|
|
880
|
+
id: s.competition.id,
|
|
881
|
+
name: s.competition.name
|
|
882
|
+
} : void 0
|
|
883
|
+
};
|
|
884
|
+
});
|
|
885
|
+
return {
|
|
886
|
+
competitorId: e,
|
|
887
|
+
results: n,
|
|
888
|
+
formString: n.map((s) => s.result).join("")
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
function Xe(e) {
|
|
892
|
+
const t = {};
|
|
893
|
+
for (const o of e) {
|
|
894
|
+
const n = je(o.type.code);
|
|
895
|
+
n && (t[n] = Number(o.value));
|
|
896
|
+
}
|
|
897
|
+
return t.goalsFor != null && t.goalsAgainst != null && t.goalDifference == null && (t.goalDifference = t.goalsFor - t.goalsAgainst), t;
|
|
898
|
+
}
|
|
899
|
+
function Je(e) {
|
|
900
|
+
const t = e.find((o) => o.type.code === "RANK");
|
|
901
|
+
return t ? Number(t.value) : 0;
|
|
902
|
+
}
|
|
903
|
+
function Ze(e) {
|
|
904
|
+
const t = e.rules?.length > 0 ? e.rules.map((o) => oe(o.standing_api_rule_type)) : void 0;
|
|
905
|
+
return {
|
|
906
|
+
rank: Je(e.columns),
|
|
907
|
+
competitor: {
|
|
908
|
+
id: e.team.id,
|
|
909
|
+
name: e.team.name,
|
|
910
|
+
shortName: e.team.short_name ?? void 0,
|
|
911
|
+
logo: void 0
|
|
912
|
+
// Standings API doesn't include logo in team object
|
|
913
|
+
},
|
|
914
|
+
stats: Xe(e.columns),
|
|
915
|
+
form: ze(e.team.id, e.form ?? []),
|
|
916
|
+
rules: t
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
function we(e) {
|
|
920
|
+
const t = /* @__PURE__ */ new Map();
|
|
921
|
+
for (const o of e)
|
|
922
|
+
if (o.rules)
|
|
923
|
+
for (const n of o.rules) {
|
|
924
|
+
const s = oe(n.standing_api_rule_type);
|
|
925
|
+
t.has(s) || t.set(s, {
|
|
926
|
+
key: s,
|
|
927
|
+
name: n.name,
|
|
928
|
+
position: Ke(n.type)
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
return Array.from(t.values());
|
|
932
|
+
}
|
|
933
|
+
function et(e) {
|
|
934
|
+
const t = e.standing.map(Ze), o = we(e.standing);
|
|
935
|
+
return {
|
|
936
|
+
entries: t,
|
|
937
|
+
metadata: { legend: o }
|
|
938
|
+
};
|
|
939
|
+
}
|
|
940
|
+
function tt(e) {
|
|
941
|
+
return e.standings.map((t) => ({
|
|
942
|
+
stage: {
|
|
943
|
+
id: e.stage.id,
|
|
944
|
+
name: e.stage.name
|
|
945
|
+
},
|
|
946
|
+
group: {
|
|
947
|
+
id: t.group.id,
|
|
948
|
+
name: t.group.name,
|
|
949
|
+
type: t.group.type
|
|
950
|
+
},
|
|
951
|
+
coverageType: t.type,
|
|
952
|
+
rankingType: t.ranking_type,
|
|
953
|
+
standings: et(t)
|
|
954
|
+
}));
|
|
955
|
+
}
|
|
956
|
+
function ot(e) {
|
|
957
|
+
return !e?.data || e.data.length === 0 ? [] : e.data.flatMap(tt);
|
|
958
|
+
}
|
|
959
|
+
async function Wt(e, t) {
|
|
960
|
+
const o = t || A(), { sportal365Sports: n } = o, s = {
|
|
961
|
+
season_id: e.seasonId,
|
|
962
|
+
stage_id: e.stageId,
|
|
963
|
+
group_id: e.groupId,
|
|
964
|
+
coverage_type: e.coverageType,
|
|
965
|
+
home_away: e.homeAway,
|
|
966
|
+
optional_data: e.includeForm ? "form" : void 0,
|
|
967
|
+
row_limit: e.rowLimit?.toString(),
|
|
968
|
+
row_offset: e.rowOffset?.toString(),
|
|
969
|
+
translation_language: e.languageCode ?? n?.languageCode ?? "en"
|
|
970
|
+
}, i = await Ve.get({
|
|
971
|
+
path: `/standings/${e.sport}`,
|
|
972
|
+
params: s,
|
|
973
|
+
next: e.next,
|
|
974
|
+
config: o
|
|
975
|
+
});
|
|
976
|
+
return ot(i);
|
|
977
|
+
}
|
|
978
|
+
const nt = b(ue);
|
|
979
|
+
function st(e, t) {
|
|
799
980
|
return {
|
|
800
981
|
teamId: e.id,
|
|
801
982
|
teamName: e.name,
|
|
@@ -807,8 +988,8 @@ function je(e, t) {
|
|
|
807
988
|
}))
|
|
808
989
|
};
|
|
809
990
|
}
|
|
810
|
-
async function
|
|
811
|
-
const o = t || A(), n = e.next ?? { revalidate: 600 }, s = await
|
|
991
|
+
async function Yt(e, t) {
|
|
992
|
+
const o = t || A(), n = e.next ?? { revalidate: 600 }, s = await nt.get({
|
|
812
993
|
path: "/statistics/aggregate",
|
|
813
994
|
params: {
|
|
814
995
|
participant_ids: e.teamId,
|
|
@@ -820,9 +1001,9 @@ async function Mt(e, t) {
|
|
|
820
1001
|
});
|
|
821
1002
|
if (!s.data || s.data.length === 0)
|
|
822
1003
|
throw new Error(`No statistics found for team ${e.teamId} in season ${e.seasonId}`);
|
|
823
|
-
return
|
|
1004
|
+
return st(s.data[0], e.seasonId);
|
|
824
1005
|
}
|
|
825
|
-
function
|
|
1006
|
+
function it(e) {
|
|
826
1007
|
const t = e.replace(/\/$/, "");
|
|
827
1008
|
function o(n) {
|
|
828
1009
|
return `${t}${n}`;
|
|
@@ -836,13 +1017,13 @@ function Ke(e) {
|
|
|
836
1017
|
);
|
|
837
1018
|
if (!i.apiKey || !i.clientId)
|
|
838
1019
|
throw new Error("Fans United configuration requires both 'apiKey' and 'clientId'");
|
|
839
|
-
const
|
|
840
|
-
if (
|
|
841
|
-
for (const [u,
|
|
842
|
-
|
|
843
|
-
const
|
|
844
|
-
|
|
845
|
-
const
|
|
1020
|
+
const a = new URL(o(n.path));
|
|
1021
|
+
if (a.searchParams.set("key", i.apiKey), a.searchParams.set("client_id", i.clientId), n.params)
|
|
1022
|
+
for (const [u, l] of Object.entries(n.params))
|
|
1023
|
+
l !== void 0 && (Array.isArray(l) ? l.length > 0 && a.searchParams.set(u, l.join(",")) : a.searchParams.set(u, l));
|
|
1024
|
+
const r = 3e4, c = new URL(a.toString());
|
|
1025
|
+
c.searchParams.delete("key"), c.searchParams.delete("client_id"), console.log("🔗 FansUnited API URL:", c.toString());
|
|
1026
|
+
const d = await fetch(a.toString(), {
|
|
846
1027
|
method: "GET",
|
|
847
1028
|
headers: {
|
|
848
1029
|
Accept: "application/json",
|
|
@@ -850,30 +1031,30 @@ function Ke(e) {
|
|
|
850
1031
|
// Merge custom headers (they can override defaults)
|
|
851
1032
|
...n.headers
|
|
852
1033
|
},
|
|
853
|
-
signal: AbortSignal.timeout(
|
|
1034
|
+
signal: AbortSignal.timeout(r),
|
|
854
1035
|
// Next.js cache options for ISR/on-demand revalidation
|
|
855
1036
|
...n.next && { next: n.next }
|
|
856
1037
|
});
|
|
857
|
-
if (!
|
|
858
|
-
let u = `Fans United API error: ${
|
|
1038
|
+
if (!d.ok) {
|
|
1039
|
+
let u = `Fans United API error: ${d.status} ${d.statusText}`;
|
|
859
1040
|
try {
|
|
860
|
-
const
|
|
861
|
-
|
|
862
|
-
} catch (
|
|
1041
|
+
const l = await d.text();
|
|
1042
|
+
l && (u += ` - ${l}`);
|
|
1043
|
+
} catch (l) {
|
|
863
1044
|
console.error("[Fans United HTTP] Failed to read error response body:", {
|
|
864
|
-
error:
|
|
865
|
-
status:
|
|
866
|
-
statusText:
|
|
1045
|
+
error: l instanceof Error ? l.message : String(l),
|
|
1046
|
+
status: d.status,
|
|
1047
|
+
statusText: d.statusText
|
|
867
1048
|
});
|
|
868
1049
|
}
|
|
869
1050
|
throw new Error(u);
|
|
870
1051
|
}
|
|
871
|
-
return
|
|
1052
|
+
return d.json();
|
|
872
1053
|
}
|
|
873
1054
|
};
|
|
874
1055
|
}
|
|
875
|
-
const
|
|
876
|
-
function
|
|
1056
|
+
const at = "https://football.fansunitedapi.com", R = it(at);
|
|
1057
|
+
function rt(e) {
|
|
877
1058
|
return {
|
|
878
1059
|
id: String(e.id),
|
|
879
1060
|
name: e.name,
|
|
@@ -886,7 +1067,7 @@ function ze(e) {
|
|
|
886
1067
|
]
|
|
887
1068
|
};
|
|
888
1069
|
}
|
|
889
|
-
function
|
|
1070
|
+
function ct(e) {
|
|
890
1071
|
const t = {
|
|
891
1072
|
id: String(e.id),
|
|
892
1073
|
name: e.name,
|
|
@@ -915,29 +1096,29 @@ function Je(e) {
|
|
|
915
1096
|
]
|
|
916
1097
|
}), e.assets?.logo && (t.assets = {
|
|
917
1098
|
logo: e.assets.logo
|
|
918
|
-
}), e.seasons && e.seasons.length > 0 && (t.seasons = e.seasons.map(
|
|
1099
|
+
}), e.seasons && e.seasons.length > 0 && (t.seasons = e.seasons.map(rt)), e.current_season && (t.season = {
|
|
919
1100
|
id: String(e.current_season.id),
|
|
920
1101
|
name: e.current_season.name,
|
|
921
1102
|
status: e.current_season.active ? "ACTIVE" : "INACTIVE"
|
|
922
1103
|
}), t;
|
|
923
1104
|
}
|
|
924
|
-
function
|
|
925
|
-
return e.map(
|
|
1105
|
+
function lt(e) {
|
|
1106
|
+
return e.map(ct);
|
|
926
1107
|
}
|
|
927
|
-
async function
|
|
1108
|
+
async function Qt(e, t) {
|
|
928
1109
|
const o = {};
|
|
929
1110
|
e?.lang ? o.lang = e.lang : o.lang = "EN", e?.sortField && (o.sort_field = e.sortField), e?.sortOrder && (o.sort_order = e.sortOrder), e?.page !== void 0 && (o.page = String(e.page)), e?.perPage !== void 0 && (o.per_page = String(e.perPage)), e?.countryId !== void 0 && (o.country_id = String(e.countryId)), e?.active !== void 0 && (o.active = e.active ? "1" : "0");
|
|
930
|
-
const n = await
|
|
1111
|
+
const n = await R.get({
|
|
931
1112
|
path: "/v1/competitions",
|
|
932
1113
|
params: o,
|
|
933
1114
|
config: t,
|
|
934
1115
|
next: e?.next
|
|
935
|
-
}), s = n.data.map((
|
|
1116
|
+
}), s = n.data.map((d) => d.id), i = new Set(s);
|
|
936
1117
|
s.length !== i.size && console.warn("⚠️ API returned duplicate competitions!");
|
|
937
|
-
const
|
|
938
|
-
return
|
|
1118
|
+
const a = lt(n.data), r = /* @__PURE__ */ new Set(), c = a.filter((d) => r.has(d.id) ? !1 : (r.add(d.id), !0));
|
|
1119
|
+
return a.length !== c.length && console.warn(`Removed ${a.length - c.length} duplicate competitions`), c;
|
|
939
1120
|
}
|
|
940
|
-
function
|
|
1121
|
+
function dt(e) {
|
|
941
1122
|
return {
|
|
942
1123
|
id: e.id,
|
|
943
1124
|
name: e.name,
|
|
@@ -953,13 +1134,13 @@ function Xe(e) {
|
|
|
953
1134
|
]
|
|
954
1135
|
};
|
|
955
1136
|
}
|
|
956
|
-
function
|
|
1137
|
+
function ut(e) {
|
|
957
1138
|
return {
|
|
958
1139
|
id: e.id,
|
|
959
1140
|
name: e.name,
|
|
960
1141
|
type: e.type?.toUpperCase() || "LEAGUE",
|
|
961
1142
|
gender: e.gender?.toUpperCase(),
|
|
962
|
-
country: e.country ?
|
|
1143
|
+
country: e.country ? dt(e.country) : void 0,
|
|
963
1144
|
assets: e.assets?.logo ? {
|
|
964
1145
|
logo: e.assets.logo
|
|
965
1146
|
} : void 0,
|
|
@@ -971,21 +1152,21 @@ function Ze(e) {
|
|
|
971
1152
|
]
|
|
972
1153
|
};
|
|
973
1154
|
}
|
|
974
|
-
function
|
|
975
|
-
return
|
|
1155
|
+
function mt(e) {
|
|
1156
|
+
return ut(e.data);
|
|
976
1157
|
}
|
|
977
|
-
async function
|
|
1158
|
+
async function qt(e, t, o) {
|
|
978
1159
|
const n = o || A(), s = {};
|
|
979
1160
|
t?.lang && (s.lang = t.lang);
|
|
980
|
-
const i = await
|
|
1161
|
+
const i = await R.get({
|
|
981
1162
|
path: `/v1/competitions/${e}`,
|
|
982
1163
|
params: s,
|
|
983
1164
|
next: t?.next,
|
|
984
1165
|
config: n
|
|
985
1166
|
});
|
|
986
|
-
return
|
|
1167
|
+
return mt(i);
|
|
987
1168
|
}
|
|
988
|
-
function
|
|
1169
|
+
function ft(e) {
|
|
989
1170
|
return {
|
|
990
1171
|
id: e.id,
|
|
991
1172
|
name: e.name,
|
|
@@ -999,7 +1180,7 @@ function et(e) {
|
|
|
999
1180
|
]
|
|
1000
1181
|
};
|
|
1001
1182
|
}
|
|
1002
|
-
function
|
|
1183
|
+
function ne(e) {
|
|
1003
1184
|
return {
|
|
1004
1185
|
id: e.id,
|
|
1005
1186
|
name: e.name,
|
|
@@ -1007,7 +1188,7 @@ function oe(e) {
|
|
|
1007
1188
|
threeLetterCode: e.code,
|
|
1008
1189
|
type: e.national ? "national" : "club",
|
|
1009
1190
|
gender: e.gender ? e.gender.toUpperCase() : void 0,
|
|
1010
|
-
country: e.country ?
|
|
1191
|
+
country: e.country ? ft(e.country) : void 0,
|
|
1011
1192
|
assets: e.assets?.logo ? {
|
|
1012
1193
|
logo: e.assets.logo
|
|
1013
1194
|
} : void 0,
|
|
@@ -1027,35 +1208,35 @@ function oe(e) {
|
|
|
1027
1208
|
]
|
|
1028
1209
|
};
|
|
1029
1210
|
}
|
|
1030
|
-
function
|
|
1031
|
-
return
|
|
1211
|
+
function pt(e) {
|
|
1212
|
+
return ne(e.data);
|
|
1032
1213
|
}
|
|
1033
|
-
function
|
|
1034
|
-
return e.data.map(
|
|
1214
|
+
function gt(e) {
|
|
1215
|
+
return e.data.map(ne);
|
|
1035
1216
|
}
|
|
1036
|
-
async function
|
|
1217
|
+
async function Vt(e, t, o) {
|
|
1037
1218
|
const n = o || A(), s = {};
|
|
1038
1219
|
t?.lang && (s.lang = t.lang);
|
|
1039
|
-
const i = await
|
|
1220
|
+
const i = await R.get({
|
|
1040
1221
|
path: `/v1/teams/${e}`,
|
|
1041
1222
|
params: s,
|
|
1042
1223
|
next: t?.next,
|
|
1043
1224
|
config: n
|
|
1044
1225
|
});
|
|
1045
|
-
return
|
|
1226
|
+
return pt(i);
|
|
1046
1227
|
}
|
|
1047
|
-
async function
|
|
1228
|
+
async function jt(e, t) {
|
|
1048
1229
|
const o = t || A(), n = {};
|
|
1049
1230
|
e?.lang && (n.lang = e.lang), e?.teamIds && (n.team_ids = e.teamIds), e?.countryId && (n.country_id = e.countryId), e?.name && (n.name = e.name), e?.scope && (n.scope = e.scope), e?.national !== void 0 && (n.national = String(e.national)), e?.gender && (n.gender = e.gender), e?.limit !== void 0 && (n.limit = String(e.limit)), e?.page !== void 0 && (n.page = String(e.page)), e?.sortField && (n.sort_field = e.sortField), e?.sortOrder && (n.sort_order = e.sortOrder);
|
|
1050
|
-
const s = await
|
|
1231
|
+
const s = await R.get({
|
|
1051
1232
|
path: "/v1/teams",
|
|
1052
1233
|
params: n,
|
|
1053
1234
|
next: e?.next,
|
|
1054
1235
|
config: o
|
|
1055
1236
|
});
|
|
1056
|
-
return
|
|
1237
|
+
return gt(s);
|
|
1057
1238
|
}
|
|
1058
|
-
function
|
|
1239
|
+
function j(e) {
|
|
1059
1240
|
return {
|
|
1060
1241
|
id: e.id,
|
|
1061
1242
|
name: e.name,
|
|
@@ -1069,7 +1250,7 @@ function Y(e) {
|
|
|
1069
1250
|
]
|
|
1070
1251
|
};
|
|
1071
1252
|
}
|
|
1072
|
-
function
|
|
1253
|
+
function yt(e) {
|
|
1073
1254
|
return {
|
|
1074
1255
|
id: e.id,
|
|
1075
1256
|
name: e.name,
|
|
@@ -1078,7 +1259,7 @@ function nt(e) {
|
|
|
1078
1259
|
threeLetterCode: e.code,
|
|
1079
1260
|
type: e.national ? "national" : "club",
|
|
1080
1261
|
gender: e.gender?.toUpperCase(),
|
|
1081
|
-
country: e.country ?
|
|
1262
|
+
country: e.country ? j(e.country) : void 0,
|
|
1082
1263
|
assets: e.assets?.logo ? {
|
|
1083
1264
|
logo: e.assets.logo
|
|
1084
1265
|
} : void 0,
|
|
@@ -1090,13 +1271,13 @@ function nt(e) {
|
|
|
1090
1271
|
]
|
|
1091
1272
|
};
|
|
1092
1273
|
}
|
|
1093
|
-
function
|
|
1274
|
+
function ht(e) {
|
|
1094
1275
|
return {
|
|
1095
1276
|
id: e.id,
|
|
1096
1277
|
name: e.name,
|
|
1097
1278
|
type: e.type?.toUpperCase() || "LEAGUE",
|
|
1098
1279
|
gender: e.gender?.toUpperCase(),
|
|
1099
|
-
country: e.country ?
|
|
1280
|
+
country: e.country ? j(e.country) : void 0,
|
|
1100
1281
|
assets: e.assets?.logo ? {
|
|
1101
1282
|
logo: e.assets.logo
|
|
1102
1283
|
} : void 0,
|
|
@@ -1108,19 +1289,19 @@ function st(e) {
|
|
|
1108
1289
|
]
|
|
1109
1290
|
};
|
|
1110
1291
|
}
|
|
1111
|
-
function
|
|
1292
|
+
function se(e) {
|
|
1112
1293
|
return {
|
|
1113
1294
|
type: "player",
|
|
1114
1295
|
id: e.id,
|
|
1115
1296
|
name: e.name,
|
|
1116
1297
|
position: e.position,
|
|
1117
1298
|
birthdate: e.birth_date,
|
|
1118
|
-
country: e.country ?
|
|
1299
|
+
country: e.country ? j(e.country) : void 0,
|
|
1119
1300
|
assets: e.assets?.headshot ? {
|
|
1120
1301
|
photo: e.assets.headshot
|
|
1121
1302
|
} : void 0,
|
|
1122
|
-
teams: e.teams?.map(
|
|
1123
|
-
competitions: e.competitions?.map(
|
|
1303
|
+
teams: e.teams?.map(yt),
|
|
1304
|
+
competitions: e.competitions?.map(ht),
|
|
1124
1305
|
providerRef: [
|
|
1125
1306
|
{
|
|
1126
1307
|
provider: "fansunited",
|
|
@@ -1129,57 +1310,57 @@ function ne(e) {
|
|
|
1129
1310
|
]
|
|
1130
1311
|
};
|
|
1131
1312
|
}
|
|
1132
|
-
function
|
|
1133
|
-
return
|
|
1313
|
+
function Tt(e) {
|
|
1314
|
+
return se(e.data);
|
|
1134
1315
|
}
|
|
1135
|
-
function
|
|
1136
|
-
return e.data.map(
|
|
1316
|
+
function _t(e) {
|
|
1317
|
+
return e.data.map(se);
|
|
1137
1318
|
}
|
|
1138
|
-
async function
|
|
1319
|
+
async function Kt(e, t, o) {
|
|
1139
1320
|
const n = o || A(), s = {};
|
|
1140
1321
|
t?.lang && (s.lang = t.lang);
|
|
1141
|
-
const i = await
|
|
1322
|
+
const i = await R.get({
|
|
1142
1323
|
path: `/v1/players/${e}`,
|
|
1143
1324
|
params: s,
|
|
1144
1325
|
next: t?.next,
|
|
1145
1326
|
config: n
|
|
1146
1327
|
});
|
|
1147
|
-
return
|
|
1328
|
+
return Tt(i);
|
|
1148
1329
|
}
|
|
1149
|
-
async function
|
|
1330
|
+
async function zt(e, t) {
|
|
1150
1331
|
const o = t || A(), n = {};
|
|
1151
1332
|
e?.lang && (n.lang = e.lang), e?.playerIds && (n.player_ids = e.playerIds), e?.countryId && (n.country_id = e.countryId), e?.name && (n.name = e.name), e?.scope && (n.scope = e.scope), e?.limit !== void 0 && (n.limit = String(e.limit)), e?.page !== void 0 && (n.page = String(e.page)), e?.sortField && (n.sort_field = e.sortField), e?.sortOrder && (n.sort_order = e.sortOrder);
|
|
1152
|
-
const s = await
|
|
1333
|
+
const s = await R.get({
|
|
1153
1334
|
path: "/v1/players",
|
|
1154
1335
|
params: n,
|
|
1155
1336
|
next: e?.next,
|
|
1156
1337
|
config: o
|
|
1157
1338
|
});
|
|
1158
|
-
return
|
|
1339
|
+
return _t(s);
|
|
1159
1340
|
}
|
|
1160
|
-
async function
|
|
1341
|
+
async function Xt(e, t, o) {
|
|
1161
1342
|
const n = o || A(), s = {};
|
|
1162
1343
|
t?.lang && (s.lang = t.lang);
|
|
1163
|
-
const i = await
|
|
1344
|
+
const i = await R.get({
|
|
1164
1345
|
path: `/v1/matches/${e}`,
|
|
1165
1346
|
params: s,
|
|
1166
1347
|
next: t?.next,
|
|
1167
1348
|
config: n
|
|
1168
1349
|
});
|
|
1169
|
-
return
|
|
1350
|
+
return me(i);
|
|
1170
1351
|
}
|
|
1171
|
-
async function
|
|
1352
|
+
async function Jt(e, t) {
|
|
1172
1353
|
const o = t || A(), n = {};
|
|
1173
1354
|
e?.lang && (n.lang = e.lang), e?.competitions && (n.competitions = e.competitions), e?.countries && (n.countries = e.countries), e?.fromDate && (n.from_date = e.fromDate), e?.toDate && (n.to_date = e.toDate), e?.matches && (n.matches = e.matches), e?.teams && (n.teams = e.teams), e?.status && (n.status = e.status), e?.limit !== void 0 && (n.limit = String(e.limit)), e?.page !== void 0 && (n.page = String(e.page)), e?.sortField && (n.sort_field = e.sortField), e?.sortOrder && (n.sort_order = e.sortOrder), e?.showDeleted !== void 0 && (n.show_deleted = e.showDeleted ? "true" : "false");
|
|
1174
|
-
const s = await
|
|
1355
|
+
const s = await R.get({
|
|
1175
1356
|
path: "/v1/matches",
|
|
1176
1357
|
params: n,
|
|
1177
1358
|
next: e?.next,
|
|
1178
1359
|
config: o
|
|
1179
1360
|
});
|
|
1180
|
-
return
|
|
1361
|
+
return fe(s);
|
|
1181
1362
|
}
|
|
1182
|
-
function
|
|
1363
|
+
function K(e) {
|
|
1183
1364
|
return {
|
|
1184
1365
|
id: e.id,
|
|
1185
1366
|
name: e.name,
|
|
@@ -1193,7 +1374,7 @@ function z(e) {
|
|
|
1193
1374
|
]
|
|
1194
1375
|
};
|
|
1195
1376
|
}
|
|
1196
|
-
function
|
|
1377
|
+
function vt(e) {
|
|
1197
1378
|
return {
|
|
1198
1379
|
id: e.id,
|
|
1199
1380
|
name: e.name,
|
|
@@ -1201,7 +1382,7 @@ function at(e) {
|
|
|
1201
1382
|
type: e.type || "LEAGUE",
|
|
1202
1383
|
region: e.region,
|
|
1203
1384
|
gender: e.gender?.toUpperCase(),
|
|
1204
|
-
country: e.country ?
|
|
1385
|
+
country: e.country ? K(e.country) : void 0,
|
|
1205
1386
|
assets: e.assets?.logo ? {
|
|
1206
1387
|
logo: e.assets.logo
|
|
1207
1388
|
} : void 0,
|
|
@@ -1213,7 +1394,7 @@ function at(e) {
|
|
|
1213
1394
|
]
|
|
1214
1395
|
};
|
|
1215
1396
|
}
|
|
1216
|
-
function
|
|
1397
|
+
function At(e) {
|
|
1217
1398
|
return {
|
|
1218
1399
|
type: "player",
|
|
1219
1400
|
id: e.id,
|
|
@@ -1221,7 +1402,7 @@ function ct(e) {
|
|
|
1221
1402
|
position: e.position || void 0,
|
|
1222
1403
|
gender: e.gender?.toUpperCase(),
|
|
1223
1404
|
birthdate: e.birth_date || void 0,
|
|
1224
|
-
country: e.country ?
|
|
1405
|
+
country: e.country ? K(e.country) : void 0,
|
|
1225
1406
|
assets: e.assets?.headshot ? {
|
|
1226
1407
|
photo: e.assets.headshot
|
|
1227
1408
|
} : void 0,
|
|
@@ -1233,7 +1414,7 @@ function ct(e) {
|
|
|
1233
1414
|
]
|
|
1234
1415
|
};
|
|
1235
1416
|
}
|
|
1236
|
-
function
|
|
1417
|
+
function St(e) {
|
|
1237
1418
|
return {
|
|
1238
1419
|
type: e.national ? "national" : "club",
|
|
1239
1420
|
id: e.id,
|
|
@@ -1241,7 +1422,7 @@ function dt(e) {
|
|
|
1241
1422
|
shortName: e.short_name || void 0,
|
|
1242
1423
|
threeLetterCode: e.code || void 0,
|
|
1243
1424
|
gender: e.gender?.toUpperCase(),
|
|
1244
|
-
country: e.country ?
|
|
1425
|
+
country: e.country ? K(e.country) : void 0,
|
|
1245
1426
|
assets: e.assets?.logo ? {
|
|
1246
1427
|
logo: e.assets.logo
|
|
1247
1428
|
} : void 0,
|
|
@@ -1253,10 +1434,10 @@ function dt(e) {
|
|
|
1253
1434
|
]
|
|
1254
1435
|
};
|
|
1255
1436
|
}
|
|
1256
|
-
function
|
|
1437
|
+
function q(e) {
|
|
1257
1438
|
switch (e.entity_type) {
|
|
1258
1439
|
case "competition": {
|
|
1259
|
-
const t =
|
|
1440
|
+
const t = vt(e);
|
|
1260
1441
|
return {
|
|
1261
1442
|
source: "FOOTBALL",
|
|
1262
1443
|
entityType: "competition",
|
|
@@ -1265,7 +1446,7 @@ function j(e) {
|
|
|
1265
1446
|
};
|
|
1266
1447
|
}
|
|
1267
1448
|
case "player": {
|
|
1268
|
-
const t =
|
|
1449
|
+
const t = At(e);
|
|
1269
1450
|
return {
|
|
1270
1451
|
source: "FOOTBALL",
|
|
1271
1452
|
entityType: "player",
|
|
@@ -1274,7 +1455,7 @@ function j(e) {
|
|
|
1274
1455
|
};
|
|
1275
1456
|
}
|
|
1276
1457
|
case "team": {
|
|
1277
|
-
const t =
|
|
1458
|
+
const t = St(e);
|
|
1278
1459
|
return {
|
|
1279
1460
|
source: "FOOTBALL",
|
|
1280
1461
|
entityType: "team",
|
|
@@ -1289,13 +1470,13 @@ function j(e) {
|
|
|
1289
1470
|
throw new Error(`Unknown entity type: ${e.entity_type}`);
|
|
1290
1471
|
}
|
|
1291
1472
|
}
|
|
1292
|
-
async function
|
|
1473
|
+
async function Zt(e, t) {
|
|
1293
1474
|
if (!e.query || e.query.trim() === "")
|
|
1294
1475
|
return [];
|
|
1295
1476
|
const o = t || A(), n = {
|
|
1296
1477
|
q: e.query.trim()
|
|
1297
|
-
}, i = (e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["competition", "team", "player"]).map((
|
|
1298
|
-
switch (
|
|
1478
|
+
}, i = (e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["competition", "team", "player"]).map((c) => {
|
|
1479
|
+
switch (c) {
|
|
1299
1480
|
case "team":
|
|
1300
1481
|
return "teams";
|
|
1301
1482
|
case "player":
|
|
@@ -1303,105 +1484,105 @@ async function Ut(e, t) {
|
|
|
1303
1484
|
case "competition":
|
|
1304
1485
|
return "competitions";
|
|
1305
1486
|
default:
|
|
1306
|
-
return
|
|
1487
|
+
return c;
|
|
1307
1488
|
}
|
|
1308
1489
|
});
|
|
1309
1490
|
n.entities = i.join(","), e.lang && (n.lang = e.lang), e.limit && (n.limit = String(e.limit));
|
|
1310
|
-
const
|
|
1491
|
+
const a = await R.get({
|
|
1311
1492
|
path: "/v1/search",
|
|
1312
1493
|
params: n,
|
|
1313
1494
|
next: e.next,
|
|
1314
1495
|
config: o
|
|
1315
|
-
}),
|
|
1316
|
-
return
|
|
1317
|
-
const
|
|
1318
|
-
|
|
1319
|
-
}),
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1322
|
-
}),
|
|
1323
|
-
const
|
|
1324
|
-
|
|
1325
|
-
})),
|
|
1326
|
-
}
|
|
1327
|
-
function
|
|
1496
|
+
}), r = [];
|
|
1497
|
+
return a.data && (a.data.competitions && a.data.competitions.forEach((c) => {
|
|
1498
|
+
const d = q({ ...c, entity_type: "competition" });
|
|
1499
|
+
d && r.push(d);
|
|
1500
|
+
}), a.data.teams && a.data.teams.forEach((c) => {
|
|
1501
|
+
const d = q({ ...c, entity_type: "team" });
|
|
1502
|
+
d && r.push(d);
|
|
1503
|
+
}), a.data.players && a.data.players.forEach((c) => {
|
|
1504
|
+
const d = q({ ...c, entity_type: "player" });
|
|
1505
|
+
d && r.push(d);
|
|
1506
|
+
})), r;
|
|
1507
|
+
}
|
|
1508
|
+
function wt(e) {
|
|
1328
1509
|
return !e.seasons || e.seasons.length === 0 ? void 0 : e.seasons.find((o) => o.active) ?? e.seasons[0];
|
|
1329
1510
|
}
|
|
1330
|
-
function
|
|
1511
|
+
function eo(e, t) {
|
|
1331
1512
|
const o = /* @__PURE__ */ new Date(), n = t.filter((s) => {
|
|
1332
|
-
const i = s.competitorOne.id === e || s.competitorTwo.id === e,
|
|
1333
|
-
return i &&
|
|
1513
|
+
const i = s.competitorOne.id === e || s.competitorTwo.id === e, a = s.status.type === "NOT_STARTED", r = new Date(s.timing.kickoffTime) >= o;
|
|
1514
|
+
return i && a && r;
|
|
1334
1515
|
});
|
|
1335
1516
|
return n.sort((s, i) => new Date(s.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()), n[0];
|
|
1336
1517
|
}
|
|
1337
|
-
function
|
|
1518
|
+
function to(e, t) {
|
|
1338
1519
|
const o = /* @__PURE__ */ new Date(), n = t.filter((s) => {
|
|
1339
|
-
const i = s.competitorOne.id === e || s.competitorTwo.id === e,
|
|
1340
|
-
return i &&
|
|
1520
|
+
const i = s.competitorOne.id === e || s.competitorTwo.id === e, a = s.status.type === "FINISHED", r = new Date(s.timing.kickoffTime) <= o;
|
|
1521
|
+
return i && a && r;
|
|
1341
1522
|
});
|
|
1342
1523
|
return n.sort((s, i) => new Date(i.timing.kickoffTime).getTime() - new Date(s.timing.kickoffTime).getTime()), n[0];
|
|
1343
1524
|
}
|
|
1344
|
-
function
|
|
1525
|
+
function oo(e, t) {
|
|
1345
1526
|
const o = /* @__PURE__ */ new Date();
|
|
1346
1527
|
return t.filter((s) => {
|
|
1347
|
-
const i = s.competitorOne.id === e || s.competitorTwo.id === e,
|
|
1348
|
-
return i &&
|
|
1528
|
+
const i = s.competitorOne.id === e || s.competitorTwo.id === e, a = s.status.type === "NOT_STARTED" || s.status.type === "LIVE", r = new Date(s.timing.kickoffTime) >= o || s.status.type === "LIVE";
|
|
1529
|
+
return i && a && r;
|
|
1349
1530
|
}).sort(
|
|
1350
1531
|
(s, i) => new Date(s.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()
|
|
1351
1532
|
);
|
|
1352
1533
|
}
|
|
1353
|
-
function
|
|
1534
|
+
function no(e, t) {
|
|
1354
1535
|
const o = /* @__PURE__ */ new Date();
|
|
1355
1536
|
return t.filter((s) => {
|
|
1356
|
-
const i = s.competitorOne.id === e || s.competitorTwo.id === e,
|
|
1357
|
-
return i &&
|
|
1537
|
+
const i = s.competitorOne.id === e || s.competitorTwo.id === e, a = s.status.type === "FINISHED", r = new Date(s.timing.kickoffTime) <= o;
|
|
1538
|
+
return i && a && r;
|
|
1358
1539
|
}).sort(
|
|
1359
1540
|
(s, i) => new Date(i.timing.kickoffTime).getTime() - new Date(s.timing.kickoffTime).getTime()
|
|
1360
1541
|
);
|
|
1361
1542
|
}
|
|
1362
|
-
function
|
|
1363
|
-
const n = o.filter((
|
|
1364
|
-
(
|
|
1365
|
-
), i = t.entries.map((
|
|
1366
|
-
const
|
|
1367
|
-
(m) => m.competitorOne.id === e && m.competitorTwo.id ===
|
|
1368
|
-
),
|
|
1369
|
-
(m) => m.competitorOne.id === e && m.competitorTwo.id ===
|
|
1543
|
+
function so(e, t, o) {
|
|
1544
|
+
const n = o.filter((a) => a.status.type === "FINISHED"), s = o.filter(
|
|
1545
|
+
(a) => a.status.type === "NOT_STARTED" || a.status.type === "POSTPONED"
|
|
1546
|
+
), i = t.entries.map((a) => {
|
|
1547
|
+
const r = a.competitor.id, c = n.filter(
|
|
1548
|
+
(m) => m.competitorOne.id === e && m.competitorTwo.id === r || m.competitorOne.id === r && m.competitorTwo.id === e
|
|
1549
|
+
), d = s.filter(
|
|
1550
|
+
(m) => m.competitorOne.id === e && m.competitorTwo.id === r || m.competitorOne.id === r && m.competitorTwo.id === e
|
|
1370
1551
|
);
|
|
1371
|
-
let u,
|
|
1372
|
-
return
|
|
1373
|
-
const
|
|
1552
|
+
let u, l;
|
|
1553
|
+
return c.forEach((m) => {
|
|
1554
|
+
const p = m.competitorOne.id === e, g = parseInt(m.score?.competitorOne ?? "0"), h = parseInt(m.score?.competitorTwo ?? "0"), N = p ? g : h, S = p ? h : g;
|
|
1374
1555
|
let O;
|
|
1375
|
-
|
|
1376
|
-
const
|
|
1556
|
+
N > S ? O = "W" : N === S ? O = "D" : O = "L";
|
|
1557
|
+
const P = {
|
|
1377
1558
|
result: O,
|
|
1378
|
-
score: `${
|
|
1559
|
+
score: `${g} - ${h}`,
|
|
1379
1560
|
date: m.timing.kickoffTime,
|
|
1380
1561
|
matchId: m.id,
|
|
1381
1562
|
isUpcoming: !1
|
|
1382
1563
|
};
|
|
1383
|
-
|
|
1384
|
-
}),
|
|
1385
|
-
const
|
|
1386
|
-
|
|
1564
|
+
p ? u = P : l = P;
|
|
1565
|
+
}), d.forEach((m) => {
|
|
1566
|
+
const p = m.competitorOne.id === e;
|
|
1567
|
+
p && !u ? u = {
|
|
1387
1568
|
date: m.timing.kickoffTime,
|
|
1388
1569
|
matchId: m.id,
|
|
1389
1570
|
isUpcoming: !0
|
|
1390
|
-
} : !
|
|
1571
|
+
} : !p && !l && (l = {
|
|
1391
1572
|
date: m.timing.kickoffTime,
|
|
1392
1573
|
matchId: m.id,
|
|
1393
1574
|
isUpcoming: !0
|
|
1394
1575
|
});
|
|
1395
1576
|
}), {
|
|
1396
|
-
rank:
|
|
1397
|
-
teamId:
|
|
1398
|
-
teamName:
|
|
1399
|
-
teamShortName:
|
|
1400
|
-
teamLogo:
|
|
1401
|
-
gamesPlayed:
|
|
1402
|
-
points:
|
|
1577
|
+
rank: a.rank,
|
|
1578
|
+
teamId: a.competitor.id,
|
|
1579
|
+
teamName: a.competitor.name,
|
|
1580
|
+
teamShortName: a.competitor.shortName,
|
|
1581
|
+
teamLogo: a.competitor.logo,
|
|
1582
|
+
gamesPlayed: a.stats.played ?? 0,
|
|
1583
|
+
points: a.stats.points ?? 0,
|
|
1403
1584
|
homeResult: u,
|
|
1404
|
-
awayResult:
|
|
1585
|
+
awayResult: l
|
|
1405
1586
|
};
|
|
1406
1587
|
});
|
|
1407
1588
|
return {
|
|
@@ -1409,61 +1590,61 @@ function Vt(e, t, o) {
|
|
|
1409
1590
|
rows: i
|
|
1410
1591
|
};
|
|
1411
1592
|
}
|
|
1412
|
-
function
|
|
1593
|
+
function io(e, t = 10) {
|
|
1413
1594
|
return e.players.filter((o) => (o.seasonStatistics?.goals ?? 0) > 0).sort((o, n) => {
|
|
1414
1595
|
const s = o.seasonStatistics?.goals ?? 0, i = n.seasonStatistics?.goals ?? 0;
|
|
1415
1596
|
if (i !== s)
|
|
1416
1597
|
return i - s;
|
|
1417
|
-
const
|
|
1418
|
-
return (n.seasonStatistics?.assists ?? 0) -
|
|
1598
|
+
const a = o.seasonStatistics?.assists ?? 0;
|
|
1599
|
+
return (n.seasonStatistics?.assists ?? 0) - a;
|
|
1419
1600
|
}).slice(0, t);
|
|
1420
1601
|
}
|
|
1421
|
-
function
|
|
1602
|
+
function ao(e, t = 10) {
|
|
1422
1603
|
return e.players.filter((o) => (o.seasonStatistics?.assists ?? 0) > 0).sort((o, n) => {
|
|
1423
1604
|
const s = o.seasonStatistics?.assists ?? 0, i = n.seasonStatistics?.assists ?? 0;
|
|
1424
1605
|
if (i !== s)
|
|
1425
1606
|
return i - s;
|
|
1426
|
-
const
|
|
1427
|
-
return (n.seasonStatistics?.goals ?? 0) -
|
|
1607
|
+
const a = o.seasonStatistics?.goals ?? 0;
|
|
1608
|
+
return (n.seasonStatistics?.goals ?? 0) - a;
|
|
1428
1609
|
}).slice(0, t);
|
|
1429
1610
|
}
|
|
1430
|
-
function
|
|
1611
|
+
function ro(e, t = 10) {
|
|
1431
1612
|
return e.players.filter((o) => (o.seasonStatistics?.appearances ?? 0) > 0).sort((o, n) => {
|
|
1432
1613
|
const s = o.seasonStatistics?.appearances ?? 0, i = n.seasonStatistics?.appearances ?? 0;
|
|
1433
1614
|
if (i !== s)
|
|
1434
1615
|
return i - s;
|
|
1435
|
-
const
|
|
1436
|
-
return (n.seasonStatistics?.minutes ?? 0) -
|
|
1616
|
+
const a = o.seasonStatistics?.minutes ?? 0;
|
|
1617
|
+
return (n.seasonStatistics?.minutes ?? 0) - a;
|
|
1437
1618
|
}).slice(0, t);
|
|
1438
1619
|
}
|
|
1439
|
-
function
|
|
1620
|
+
function co(e, t = 10) {
|
|
1440
1621
|
return e.players.filter((o) => (o.seasonStatistics?.minutes ?? 0) > 0).sort((o, n) => {
|
|
1441
1622
|
const s = o.seasonStatistics?.minutes ?? 0, i = n.seasonStatistics?.minutes ?? 0;
|
|
1442
1623
|
if (i !== s)
|
|
1443
1624
|
return i - s;
|
|
1444
|
-
const
|
|
1445
|
-
return (n.seasonStatistics?.appearances ?? 0) -
|
|
1625
|
+
const a = o.seasonStatistics?.appearances ?? 0;
|
|
1626
|
+
return (n.seasonStatistics?.appearances ?? 0) - a;
|
|
1446
1627
|
}).slice(0, t);
|
|
1447
1628
|
}
|
|
1448
|
-
function
|
|
1629
|
+
function lo(e, t = 10) {
|
|
1449
1630
|
return e.players.filter((o) => (o.seasonStatistics?.cleansheets ?? 0) > 0).sort((o, n) => {
|
|
1450
1631
|
const s = o.seasonStatistics?.cleansheets ?? 0, i = n.seasonStatistics?.cleansheets ?? 0;
|
|
1451
1632
|
if (i !== s)
|
|
1452
1633
|
return i - s;
|
|
1453
|
-
const
|
|
1454
|
-
return (n.seasonStatistics?.appearances ?? 0) -
|
|
1634
|
+
const a = o.seasonStatistics?.appearances ?? 0;
|
|
1635
|
+
return (n.seasonStatistics?.appearances ?? 0) - a;
|
|
1455
1636
|
}).slice(0, t);
|
|
1456
1637
|
}
|
|
1457
|
-
function
|
|
1638
|
+
function uo(e, t = 10) {
|
|
1458
1639
|
return e.players.filter((o) => {
|
|
1459
1640
|
const n = o.seasonStatistics?.yellowCards ?? 0, s = o.seasonStatistics?.redCards ?? 0;
|
|
1460
1641
|
return n + s > 0;
|
|
1461
1642
|
}).sort((o, n) => {
|
|
1462
|
-
const s = o.seasonStatistics?.yellowCards ?? 0, i = o.seasonStatistics?.redCards ?? 0,
|
|
1463
|
-
return
|
|
1643
|
+
const s = o.seasonStatistics?.yellowCards ?? 0, i = o.seasonStatistics?.redCards ?? 0, a = n.seasonStatistics?.yellowCards ?? 0, r = n.seasonStatistics?.redCards ?? 0, c = s + i * 3, d = a + r * 3;
|
|
1644
|
+
return d !== c ? d - c : r !== i ? r - i : a - s;
|
|
1464
1645
|
}).slice(0, t);
|
|
1465
1646
|
}
|
|
1466
|
-
function
|
|
1647
|
+
function H(e) {
|
|
1467
1648
|
const t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
1468
1649
|
return e.forEach((n) => {
|
|
1469
1650
|
!n.mainEvents || n.mainEvents.length === 0 || n.mainEvents.forEach((s) => {
|
|
@@ -1481,8 +1662,8 @@ function b(e) {
|
|
|
1481
1662
|
redCards: 0,
|
|
1482
1663
|
appearances: 0
|
|
1483
1664
|
});
|
|
1484
|
-
const
|
|
1485
|
-
o.has(i) || o.set(i, /* @__PURE__ */ new Set()), o.get(i).add(n.id), (s.type === "GOAL" || s.type === "PENALTY_GOAL") && (
|
|
1665
|
+
const a = t.get(i);
|
|
1666
|
+
o.has(i) || o.set(i, /* @__PURE__ */ new Set()), o.get(i).add(n.id), (s.type === "GOAL" || s.type === "PENALTY_GOAL") && (a.goals = (a.goals ?? 0) + 1), s.type === "YELLOW_CARD" && (a.yellowCards = (a.yellowCards ?? 0) + 1), (s.type === "RED_CARD" || s.type === "YELLOW_RED_CARD") && (a.redCards = (a.redCards ?? 0) + 1);
|
|
1486
1667
|
}
|
|
1487
1668
|
if (s.secondaryPlayer && (s.type === "GOAL" || s.type === "PENALTY_GOAL")) {
|
|
1488
1669
|
const i = s.secondaryPlayer.id;
|
|
@@ -1498,8 +1679,8 @@ function b(e) {
|
|
|
1498
1679
|
redCards: 0,
|
|
1499
1680
|
appearances: 0
|
|
1500
1681
|
});
|
|
1501
|
-
const
|
|
1502
|
-
|
|
1682
|
+
const a = t.get(i);
|
|
1683
|
+
a.assists = (a.assists ?? 0) + 1, o.has(i) || o.set(i, /* @__PURE__ */ new Set()), o.get(i).add(n.id);
|
|
1503
1684
|
}
|
|
1504
1685
|
});
|
|
1505
1686
|
}), o.forEach((n, s) => {
|
|
@@ -1507,196 +1688,196 @@ function b(e) {
|
|
|
1507
1688
|
i && i.appearances !== void 0 && (i.appearances = n.size);
|
|
1508
1689
|
}), t;
|
|
1509
1690
|
}
|
|
1510
|
-
function
|
|
1691
|
+
function k(e) {
|
|
1511
1692
|
return Array.from(e.values()).map((t) => ({
|
|
1512
1693
|
...t,
|
|
1513
1694
|
totalCards: (t.yellowCards ?? 0) + (t.redCards ?? 0)
|
|
1514
1695
|
}));
|
|
1515
1696
|
}
|
|
1516
|
-
function
|
|
1517
|
-
const o =
|
|
1518
|
-
return
|
|
1519
|
-
const
|
|
1520
|
-
if (
|
|
1521
|
-
return
|
|
1522
|
-
const
|
|
1523
|
-
return (i.assists ?? 0) -
|
|
1697
|
+
function Ct(e, t = 10) {
|
|
1698
|
+
const o = H(e);
|
|
1699
|
+
return k(o).filter((s) => (s.goals ?? 0) > 0).sort((s, i) => {
|
|
1700
|
+
const a = s.goals ?? 0, r = i.goals ?? 0;
|
|
1701
|
+
if (r !== a)
|
|
1702
|
+
return r - a;
|
|
1703
|
+
const c = s.assists ?? 0;
|
|
1704
|
+
return (i.assists ?? 0) - c;
|
|
1524
1705
|
}).slice(0, t);
|
|
1525
1706
|
}
|
|
1526
|
-
function
|
|
1527
|
-
const o =
|
|
1528
|
-
return
|
|
1529
|
-
const
|
|
1530
|
-
if (
|
|
1531
|
-
return
|
|
1532
|
-
const
|
|
1533
|
-
return (i.goals ?? 0) -
|
|
1707
|
+
function Ot(e, t = 10) {
|
|
1708
|
+
const o = H(e);
|
|
1709
|
+
return k(o).filter((s) => (s.assists ?? 0) > 0).sort((s, i) => {
|
|
1710
|
+
const a = s.assists ?? 0, r = i.assists ?? 0;
|
|
1711
|
+
if (r !== a)
|
|
1712
|
+
return r - a;
|
|
1713
|
+
const c = s.goals ?? 0;
|
|
1714
|
+
return (i.goals ?? 0) - c;
|
|
1534
1715
|
}).slice(0, t);
|
|
1535
1716
|
}
|
|
1536
|
-
function
|
|
1537
|
-
const o =
|
|
1538
|
-
return
|
|
1539
|
-
const
|
|
1540
|
-
if (
|
|
1541
|
-
return
|
|
1542
|
-
const
|
|
1543
|
-
if (
|
|
1544
|
-
return
|
|
1717
|
+
function Lt(e, t = 10) {
|
|
1718
|
+
const o = H(e);
|
|
1719
|
+
return k(o).filter((s) => (s.totalCards ?? 0) > 0).sort((s, i) => {
|
|
1720
|
+
const a = (s.yellowCards ?? 0) + (s.redCards ?? 0) * 3, r = (i.yellowCards ?? 0) + (i.redCards ?? 0) * 3;
|
|
1721
|
+
if (r !== a)
|
|
1722
|
+
return r - a;
|
|
1723
|
+
const c = s.redCards ?? 0, d = i.redCards ?? 0;
|
|
1724
|
+
if (d !== c)
|
|
1725
|
+
return d - c;
|
|
1545
1726
|
const u = s.yellowCards ?? 0;
|
|
1546
1727
|
return (i.yellowCards ?? 0) - u;
|
|
1547
1728
|
}).slice(0, t);
|
|
1548
1729
|
}
|
|
1549
|
-
function
|
|
1550
|
-
const o =
|
|
1551
|
-
return
|
|
1552
|
-
const
|
|
1553
|
-
if (
|
|
1554
|
-
return
|
|
1555
|
-
const
|
|
1556
|
-
if (
|
|
1557
|
-
return
|
|
1730
|
+
function Et(e, t = 10) {
|
|
1731
|
+
const o = H(e);
|
|
1732
|
+
return k(o).filter((s) => (s.goals ?? 0) + (s.assists ?? 0) > 0).sort((s, i) => {
|
|
1733
|
+
const a = (s.goals ?? 0) + (s.assists ?? 0), r = (i.goals ?? 0) + (i.assists ?? 0);
|
|
1734
|
+
if (r !== a)
|
|
1735
|
+
return r - a;
|
|
1736
|
+
const c = s.goals ?? 0, d = i.goals ?? 0;
|
|
1737
|
+
if (d !== c)
|
|
1738
|
+
return d - c;
|
|
1558
1739
|
const u = s.assists ?? 0;
|
|
1559
1740
|
return (i.assists ?? 0) - u;
|
|
1560
1741
|
}).slice(0, t);
|
|
1561
1742
|
}
|
|
1562
|
-
function
|
|
1563
|
-
const t =
|
|
1564
|
-
return
|
|
1565
|
-
const i = n.appearances ?? 0,
|
|
1566
|
-
if (
|
|
1567
|
-
return
|
|
1568
|
-
const
|
|
1569
|
-
return (s.goals ?? 0) + (s.assists ?? 0) -
|
|
1743
|
+
function Ft(e) {
|
|
1744
|
+
const t = H(e);
|
|
1745
|
+
return k(t).sort((n, s) => {
|
|
1746
|
+
const i = n.appearances ?? 0, a = s.appearances ?? 0;
|
|
1747
|
+
if (a !== i)
|
|
1748
|
+
return a - i;
|
|
1749
|
+
const r = (n.goals ?? 0) + (n.assists ?? 0);
|
|
1750
|
+
return (s.goals ?? 0) + (s.assists ?? 0) - r;
|
|
1570
1751
|
});
|
|
1571
1752
|
}
|
|
1572
|
-
function
|
|
1573
|
-
return G(() =>
|
|
1753
|
+
function mo(e, t = 10) {
|
|
1754
|
+
return G(() => Ct(e, t), [e, t]);
|
|
1574
1755
|
}
|
|
1575
|
-
function
|
|
1576
|
-
return G(() =>
|
|
1756
|
+
function fo(e, t = 10) {
|
|
1757
|
+
return G(() => Ot(e, t), [e, t]);
|
|
1577
1758
|
}
|
|
1578
|
-
function
|
|
1579
|
-
return G(() =>
|
|
1759
|
+
function po(e, t = 10) {
|
|
1760
|
+
return G(() => Lt(e, t), [e, t]);
|
|
1580
1761
|
}
|
|
1581
|
-
function
|
|
1582
|
-
return G(() =>
|
|
1762
|
+
function go(e, t = 10) {
|
|
1763
|
+
return G(() => Et(e, t), [e, t]);
|
|
1583
1764
|
}
|
|
1584
|
-
function
|
|
1585
|
-
return G(() =>
|
|
1765
|
+
function yo(e) {
|
|
1766
|
+
return G(() => Ft(e), [e]);
|
|
1586
1767
|
}
|
|
1587
|
-
function
|
|
1588
|
-
return G(() =>
|
|
1768
|
+
function Nt(e) {
|
|
1769
|
+
return G(() => H(e), [e]);
|
|
1589
1770
|
}
|
|
1590
|
-
function
|
|
1591
|
-
const o =
|
|
1771
|
+
function ho(e, t) {
|
|
1772
|
+
const o = Nt(e);
|
|
1592
1773
|
return G(() => o.get(t), [o, t]);
|
|
1593
1774
|
}
|
|
1594
|
-
const
|
|
1595
|
-
function
|
|
1775
|
+
const Pt = ["GOAL", "PENALTY_GOAL", "OWN_GOAL"];
|
|
1776
|
+
function L(e, t) {
|
|
1596
1777
|
return t > 0 ? e / t * 100 : 0;
|
|
1597
1778
|
}
|
|
1598
|
-
function
|
|
1779
|
+
function Y(e, t) {
|
|
1599
1780
|
return t > 0 ? e / t : 0;
|
|
1600
1781
|
}
|
|
1601
|
-
function
|
|
1782
|
+
function To(e, t = !1, o = 2) {
|
|
1602
1783
|
return t ? `${Math.round(e)}%` : Number.isInteger(e) ? e.toString() : e.toFixed(o);
|
|
1603
1784
|
}
|
|
1604
|
-
function
|
|
1785
|
+
function _o(e, t) {
|
|
1605
1786
|
const o = typeof e == "string" ? parseFloat(e) : e;
|
|
1606
1787
|
if (isNaN(o) || t === 0) return "0";
|
|
1607
1788
|
const n = (o / t).toFixed(1);
|
|
1608
1789
|
return `${o} (${n} avg)`;
|
|
1609
1790
|
}
|
|
1610
|
-
function
|
|
1791
|
+
function vo(e, t) {
|
|
1611
1792
|
const o = typeof e == "string" ? parseFloat(e) : e;
|
|
1612
1793
|
return isNaN(o) || t === 0 ? "0.0" : (o / t).toFixed(1);
|
|
1613
1794
|
}
|
|
1614
|
-
function
|
|
1795
|
+
function Ao(e) {
|
|
1615
1796
|
const t = parseFloat(e);
|
|
1616
1797
|
return isNaN(t) ? "0%" : `${Math.round(t)}%`;
|
|
1617
1798
|
}
|
|
1618
|
-
function
|
|
1799
|
+
function It(e, t, o) {
|
|
1619
1800
|
if (e.status?.type !== "FINISHED" || !e.score) return null;
|
|
1620
|
-
const n = parseInt(e.score.competitorOne || "0"), s = parseInt(e.score.competitorTwo || "0"), i = o ? n : s,
|
|
1621
|
-
let
|
|
1622
|
-
const
|
|
1623
|
-
if (
|
|
1624
|
-
const
|
|
1625
|
-
|
|
1801
|
+
const n = parseInt(e.score.competitorOne || "0"), s = parseInt(e.score.competitorTwo || "0"), i = o ? n : s, a = o ? s : n;
|
|
1802
|
+
let r = null, c = null;
|
|
1803
|
+
const d = e.score.breakdown?.halfTime;
|
|
1804
|
+
if (d) {
|
|
1805
|
+
const p = parseInt(d.competitorOne || "0"), g = parseInt(d.competitorTwo || "0");
|
|
1806
|
+
r = o ? p : g, c = o ? g : p;
|
|
1626
1807
|
}
|
|
1627
1808
|
const u = e.statistics;
|
|
1628
|
-
let
|
|
1809
|
+
let l = null, m = null;
|
|
1629
1810
|
if (u) {
|
|
1630
|
-
const
|
|
1631
|
-
|
|
1811
|
+
const p = u.find?.((g) => g.type === "CORNERS");
|
|
1812
|
+
p && (l = o ? p.competitorOne : p.competitorTwo, m = o ? p.competitorTwo : p.competitorOne);
|
|
1632
1813
|
}
|
|
1633
1814
|
return {
|
|
1634
1815
|
goalsFor: i,
|
|
1635
|
-
goalsAgainst:
|
|
1636
|
-
halfTimeGoalsFor:
|
|
1637
|
-
halfTimeGoalsAgainst:
|
|
1638
|
-
cornersFor:
|
|
1816
|
+
goalsAgainst: a,
|
|
1817
|
+
halfTimeGoalsFor: r,
|
|
1818
|
+
halfTimeGoalsAgainst: c,
|
|
1819
|
+
cornersFor: l,
|
|
1639
1820
|
cornersAgainst: m,
|
|
1640
|
-
isWin: i >
|
|
1641
|
-
isDraw: i ===
|
|
1642
|
-
isLoss: i <
|
|
1821
|
+
isWin: i > a,
|
|
1822
|
+
isDraw: i === a,
|
|
1823
|
+
isLoss: i < a
|
|
1643
1824
|
};
|
|
1644
1825
|
}
|
|
1645
|
-
function
|
|
1826
|
+
function z(e, t) {
|
|
1646
1827
|
return e.competitorOne.id === t;
|
|
1647
1828
|
}
|
|
1648
|
-
function
|
|
1829
|
+
function Rt(e, t) {
|
|
1649
1830
|
return e.competitorTwo.id === t;
|
|
1650
1831
|
}
|
|
1651
|
-
function
|
|
1652
|
-
return
|
|
1832
|
+
function So(e, t) {
|
|
1833
|
+
return z(e, t) || Rt(e, t);
|
|
1653
1834
|
}
|
|
1654
|
-
function
|
|
1835
|
+
function Co(e) {
|
|
1655
1836
|
return e.status?.type === "FINISHED";
|
|
1656
1837
|
}
|
|
1657
|
-
function
|
|
1658
|
-
const o =
|
|
1838
|
+
function Oo(e, t) {
|
|
1839
|
+
const o = z(e, t);
|
|
1659
1840
|
return parseInt(o ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0");
|
|
1660
1841
|
}
|
|
1661
|
-
function
|
|
1662
|
-
const o =
|
|
1842
|
+
function Lo(e, t) {
|
|
1843
|
+
const o = z(e, t);
|
|
1663
1844
|
return parseInt(o ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0");
|
|
1664
1845
|
}
|
|
1665
|
-
function
|
|
1846
|
+
function Eo(e, t, o) {
|
|
1666
1847
|
const n = e.filter((u) => {
|
|
1667
1848
|
if (u.status?.type !== "FINISHED" || !u.score) return !1;
|
|
1668
|
-
const
|
|
1669
|
-
return
|
|
1849
|
+
const l = u.competitorOne.id === t || u.competitorTwo.id === t, m = u.competitorOne.id === o || u.competitorTwo.id === o;
|
|
1850
|
+
return l && m;
|
|
1670
1851
|
});
|
|
1671
|
-
let s = 0, i = 0,
|
|
1852
|
+
let s = 0, i = 0, a = 0, r = 0, c = 0;
|
|
1672
1853
|
n.forEach((u) => {
|
|
1673
|
-
const
|
|
1674
|
-
|
|
1854
|
+
const l = parseInt(u.score?.competitorOne || "0"), m = parseInt(u.score?.competitorTwo || "0"), p = u.competitorOne.id === t, g = p ? l : m, h = p ? m : l;
|
|
1855
|
+
r += g, c += h, g > h ? s++ : h > g ? i++ : a++;
|
|
1675
1856
|
});
|
|
1676
|
-
const
|
|
1857
|
+
const d = n.length;
|
|
1677
1858
|
return {
|
|
1678
|
-
totalMatches:
|
|
1859
|
+
totalMatches: d,
|
|
1679
1860
|
homeTeamWins: s,
|
|
1680
1861
|
awayTeamWins: i,
|
|
1681
|
-
draws:
|
|
1682
|
-
homeTeamGoals:
|
|
1683
|
-
awayTeamGoals:
|
|
1684
|
-
homeTeamWinPercentage:
|
|
1685
|
-
awayTeamWinPercentage:
|
|
1686
|
-
drawPercentage:
|
|
1687
|
-
homeTeamAvgGoals:
|
|
1688
|
-
awayTeamAvgGoals:
|
|
1862
|
+
draws: a,
|
|
1863
|
+
homeTeamGoals: r,
|
|
1864
|
+
awayTeamGoals: c,
|
|
1865
|
+
homeTeamWinPercentage: d > 0 ? s / d * 100 : 0,
|
|
1866
|
+
awayTeamWinPercentage: d > 0 ? i / d * 100 : 0,
|
|
1867
|
+
drawPercentage: d > 0 ? a / d * 100 : 0,
|
|
1868
|
+
homeTeamAvgGoals: d > 0 ? r / d : 0,
|
|
1869
|
+
awayTeamAvgGoals: d > 0 ? c / d : 0
|
|
1689
1870
|
};
|
|
1690
1871
|
}
|
|
1691
|
-
function
|
|
1872
|
+
function Fo(e, t, o, n = 5) {
|
|
1692
1873
|
return e.filter((i) => {
|
|
1693
1874
|
if (i.status?.type !== "FINISHED" || !i.score) return !1;
|
|
1694
|
-
const
|
|
1695
|
-
return
|
|
1696
|
-
}).sort((i,
|
|
1697
|
-
const
|
|
1698
|
-
let
|
|
1699
|
-
return
|
|
1875
|
+
const a = i.competitorOne.id === t || i.competitorTwo.id === t, r = i.competitorOne.id === o || i.competitorTwo.id === o;
|
|
1876
|
+
return a && r;
|
|
1877
|
+
}).sort((i, a) => new Date(a.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()).slice(0, n).map((i) => {
|
|
1878
|
+
const a = parseInt(i.score?.competitorOne || "0"), r = parseInt(i.score?.competitorTwo || "0"), c = i.competitorOne.id === t, d = c ? a : r, u = c ? r : a;
|
|
1879
|
+
let l;
|
|
1880
|
+
return d > u ? l = "home" : u > d ? l = "away" : l = "draw", {
|
|
1700
1881
|
id: i.id,
|
|
1701
1882
|
date: new Date(i.timing.kickoffTime).toLocaleDateString("en-GB", {
|
|
1702
1883
|
day: "numeric",
|
|
@@ -1707,52 +1888,52 @@ function fo(e, t, o, n = 5) {
|
|
|
1707
1888
|
awayTeamName: i.competitorTwo.name,
|
|
1708
1889
|
homeTeamLogo: i.competitorOne.assets?.logo,
|
|
1709
1890
|
awayTeamLogo: i.competitorTwo.assets?.logo,
|
|
1710
|
-
homeScore:
|
|
1711
|
-
awayScore:
|
|
1891
|
+
homeScore: a,
|
|
1892
|
+
awayScore: r,
|
|
1712
1893
|
venue: i.venue?.name,
|
|
1713
|
-
winner:
|
|
1894
|
+
winner: l
|
|
1714
1895
|
};
|
|
1715
1896
|
});
|
|
1716
1897
|
}
|
|
1717
|
-
function
|
|
1898
|
+
function Mt(e, t, o) {
|
|
1718
1899
|
return e.filter((n) => {
|
|
1719
1900
|
const s = n.competitorOne.id === t, i = n.competitorTwo.id === t;
|
|
1720
1901
|
return !s && !i ? !1 : o === "home" ? s : i;
|
|
1721
1902
|
}).map((n) => {
|
|
1722
1903
|
const s = n.competitorOne.id === t;
|
|
1723
|
-
return
|
|
1904
|
+
return It(n, t, s);
|
|
1724
1905
|
}).filter((n) => n !== null);
|
|
1725
1906
|
}
|
|
1726
1907
|
function Z(e, t, o, n) {
|
|
1727
1908
|
let s = 0;
|
|
1728
1909
|
for (const i of e) {
|
|
1729
|
-
const
|
|
1730
|
-
if (!
|
|
1731
|
-
const
|
|
1732
|
-
if (!
|
|
1733
|
-
const
|
|
1734
|
-
const
|
|
1735
|
-
return
|
|
1910
|
+
const a = i.competitorOne.id === t, r = i.competitorTwo.id === t;
|
|
1911
|
+
if (!a && !r || o === "home" && !a || o === "away" && !r || i.status?.type !== "FINISHED") continue;
|
|
1912
|
+
const c = i.mainEvents;
|
|
1913
|
+
if (!c || !Array.isArray(c)) continue;
|
|
1914
|
+
const d = c.filter((g) => g.type && Pt.includes(g.type)).sort((g, h) => {
|
|
1915
|
+
const N = g.minute ?? 0, S = h.minute ?? 0;
|
|
1916
|
+
return N !== S ? N - S : (g.injuryMinute ?? 0) - (h.injuryMinute ?? 0);
|
|
1736
1917
|
});
|
|
1737
|
-
if (
|
|
1738
|
-
const u =
|
|
1739
|
-
let
|
|
1740
|
-
m ?
|
|
1918
|
+
if (d.length === 0) continue;
|
|
1919
|
+
const u = d[0], l = a ? "ONE" : "TWO", m = u.type === "OWN_GOAL";
|
|
1920
|
+
let p;
|
|
1921
|
+
m ? p = u.competitorPosition !== l : p = u.competitorPosition === l, (n === "scored" && p || n === "conceded" && !p) && s++;
|
|
1741
1922
|
}
|
|
1742
1923
|
return s;
|
|
1743
1924
|
}
|
|
1744
|
-
function
|
|
1925
|
+
function Gt(e, t, o) {
|
|
1745
1926
|
let n = 0;
|
|
1746
1927
|
for (const s of e) {
|
|
1747
|
-
const i = s.competitorOne.id === t,
|
|
1748
|
-
if (!i && !
|
|
1749
|
-
const
|
|
1750
|
-
|
|
1928
|
+
const i = s.competitorOne.id === t, a = s.competitorTwo.id === t;
|
|
1929
|
+
if (!i && !a || o === "home" && !i || o === "away" && !a || s.status?.type !== "FINISHED") continue;
|
|
1930
|
+
const r = s.mainEvents;
|
|
1931
|
+
r && Array.isArray(r) && n++;
|
|
1751
1932
|
}
|
|
1752
1933
|
return n;
|
|
1753
1934
|
}
|
|
1754
|
-
function
|
|
1755
|
-
const n =
|
|
1935
|
+
function No(e, t, o) {
|
|
1936
|
+
const n = Mt(e, t, o), s = n.length;
|
|
1756
1937
|
if (s === 0)
|
|
1757
1938
|
return {
|
|
1758
1939
|
played: 0,
|
|
@@ -1773,147 +1954,147 @@ function go(e, t, o) {
|
|
|
1773
1954
|
avgCornersFor: 0,
|
|
1774
1955
|
avgCornersAgainst: 0
|
|
1775
1956
|
};
|
|
1776
|
-
const i = n.reduce((f,
|
|
1777
|
-
const
|
|
1778
|
-
return
|
|
1779
|
-
}).length,
|
|
1780
|
-
const
|
|
1781
|
-
return
|
|
1782
|
-
}).length,
|
|
1957
|
+
const i = n.reduce((f, _) => f + _.goalsFor, 0), a = n.reduce((f, _) => f + _.goalsAgainst, 0), r = n.filter((f) => f.goalsAgainst === 0).length, c = n.filter((f) => f.isWin && f.goalsAgainst === 0).length, d = n.filter((f) => f.goalsFor > 0).length, u = n.filter((f) => f.goalsFor === 0).length, l = n.filter((f) => f.isLoss && f.goalsFor === 0).length, m = n.filter((f) => f.goalsAgainst > 0).length, p = n.filter((f) => f.halfTimeGoalsFor !== null), g = p.length, h = p.filter((f) => {
|
|
1958
|
+
const _ = f.halfTimeGoalsFor, U = f.goalsFor - _;
|
|
1959
|
+
return _ > 0 && U > 0;
|
|
1960
|
+
}).length, N = Z(e, t, o, "scored"), S = Gt(e, t, o), O = p.filter((f) => f.halfTimeGoalsFor > f.halfTimeGoalsAgainst).length, P = p.filter((f) => {
|
|
1961
|
+
const _ = f.halfTimeGoalsAgainst, U = f.goalsAgainst - _;
|
|
1962
|
+
return _ > 0 && U > 0;
|
|
1963
|
+
}).length, B = Z(e, t, o, "conceded"), $ = p.filter((f) => f.halfTimeGoalsAgainst > f.halfTimeGoalsFor).length, D = n.filter((f) => f.cornersFor !== null), x = D.reduce((f, _) => f + (_.cornersFor || 0), 0), W = D.reduce((f, _) => f + (_.cornersAgainst || 0), 0);
|
|
1783
1964
|
return {
|
|
1784
1965
|
played: s,
|
|
1785
|
-
goalsForPerMatch:
|
|
1786
|
-
cleanSheets:
|
|
1787
|
-
wonToNil:
|
|
1788
|
-
scoringRate:
|
|
1789
|
-
scoredInBothHalves:
|
|
1790
|
-
scoredFirst: N
|
|
1791
|
-
leadingAtHalfTime:
|
|
1792
|
-
goalsAgainstPerMatch:
|
|
1793
|
-
failedToScore:
|
|
1794
|
-
lostToNil:
|
|
1795
|
-
concedingRate:
|
|
1796
|
-
concededInBothHalves:
|
|
1797
|
-
concededFirst:
|
|
1798
|
-
losingAtHalfTime:
|
|
1799
|
-
avgCornersFor:
|
|
1800
|
-
avgCornersAgainst: W
|
|
1966
|
+
goalsForPerMatch: Y(i, s),
|
|
1967
|
+
cleanSheets: L(r, s),
|
|
1968
|
+
wonToNil: L(c, s),
|
|
1969
|
+
scoringRate: L(d, s),
|
|
1970
|
+
scoredInBothHalves: L(h, g),
|
|
1971
|
+
scoredFirst: L(N, S),
|
|
1972
|
+
leadingAtHalfTime: L(O, g),
|
|
1973
|
+
goalsAgainstPerMatch: Y(a, s),
|
|
1974
|
+
failedToScore: L(u, s),
|
|
1975
|
+
lostToNil: L(l, s),
|
|
1976
|
+
concedingRate: L(m, s),
|
|
1977
|
+
concededInBothHalves: L(P, g),
|
|
1978
|
+
concededFirst: L(B, S),
|
|
1979
|
+
losingAtHalfTime: L($, g),
|
|
1980
|
+
avgCornersFor: Y(x, D.length),
|
|
1981
|
+
avgCornersAgainst: Y(W, D.length)
|
|
1801
1982
|
};
|
|
1802
1983
|
}
|
|
1803
|
-
function
|
|
1984
|
+
function Dt(e, t) {
|
|
1804
1985
|
return e.filter((o) => o.status?.type !== "FINISHED" ? !1 : o.competitorOne.id === t || o.competitorTwo.id === t).map((o) => {
|
|
1805
|
-
const n = o.competitorOne.id === t, s = parseInt(o.score?.competitorOne || "0"), i = parseInt(o.score?.competitorTwo || "0"),
|
|
1806
|
-
let
|
|
1807
|
-
if (
|
|
1808
|
-
const
|
|
1986
|
+
const n = o.competitorOne.id === t, s = parseInt(o.score?.competitorOne || "0"), i = parseInt(o.score?.competitorTwo || "0"), a = s + i, r = o.periods;
|
|
1987
|
+
let c = null;
|
|
1988
|
+
if (r && Array.isArray(r)) {
|
|
1989
|
+
const d = r.find(
|
|
1809
1990
|
(u) => u.type === "FIRST_HALF" || u.type === "1ST_HALF"
|
|
1810
1991
|
);
|
|
1811
|
-
if (
|
|
1812
|
-
const u = parseInt(
|
|
1813
|
-
|
|
1992
|
+
if (d?.score) {
|
|
1993
|
+
const u = parseInt(d.score.competitorOne || "0"), l = parseInt(d.score.competitorTwo || "0");
|
|
1994
|
+
c = u + l;
|
|
1814
1995
|
}
|
|
1815
1996
|
}
|
|
1816
|
-
return { totalGoals:
|
|
1997
|
+
return { totalGoals: a, halfTimeGoals: c, isHome: n };
|
|
1817
1998
|
});
|
|
1818
1999
|
}
|
|
1819
2000
|
function y(e, t) {
|
|
1820
2001
|
return e.length === 0 ? 0 : e.filter((n) => n > t).length / e.length * 100;
|
|
1821
2002
|
}
|
|
1822
|
-
function
|
|
1823
|
-
const o =
|
|
2003
|
+
function Po(e, t) {
|
|
2004
|
+
const o = Dt(e, t), n = o.filter((l) => l.isHome), s = o.filter((l) => !l.isHome), i = o.map((l) => l.totalGoals), a = n.map((l) => l.totalGoals), r = s.map((l) => l.totalGoals), c = o.filter((l) => l.halfTimeGoals !== null).map((l) => l.halfTimeGoals), d = n.filter((l) => l.halfTimeGoals !== null).map((l) => l.halfTimeGoals), u = s.filter((l) => l.halfTimeGoals !== null).map((l) => l.halfTimeGoals);
|
|
1824
2005
|
return {
|
|
1825
2006
|
over05: {
|
|
1826
|
-
home: y(
|
|
2007
|
+
home: y(a, 0.5),
|
|
1827
2008
|
total: y(i, 0.5),
|
|
1828
|
-
away: y(
|
|
2009
|
+
away: y(r, 0.5)
|
|
1829
2010
|
},
|
|
1830
2011
|
over15: {
|
|
1831
|
-
home: y(
|
|
2012
|
+
home: y(a, 1.5),
|
|
1832
2013
|
total: y(i, 1.5),
|
|
1833
|
-
away: y(
|
|
2014
|
+
away: y(r, 1.5)
|
|
1834
2015
|
},
|
|
1835
2016
|
over25: {
|
|
1836
|
-
home: y(
|
|
2017
|
+
home: y(a, 2.5),
|
|
1837
2018
|
total: y(i, 2.5),
|
|
1838
|
-
away: y(
|
|
2019
|
+
away: y(r, 2.5)
|
|
1839
2020
|
},
|
|
1840
2021
|
over35: {
|
|
1841
|
-
home: y(
|
|
2022
|
+
home: y(a, 3.5),
|
|
1842
2023
|
total: y(i, 3.5),
|
|
1843
|
-
away: y(
|
|
2024
|
+
away: y(r, 3.5)
|
|
1844
2025
|
},
|
|
1845
2026
|
over45: {
|
|
1846
|
-
home: y(
|
|
2027
|
+
home: y(a, 4.5),
|
|
1847
2028
|
total: y(i, 4.5),
|
|
1848
|
-
away: y(
|
|
2029
|
+
away: y(r, 4.5)
|
|
1849
2030
|
},
|
|
1850
2031
|
over55: {
|
|
1851
|
-
home: y(
|
|
2032
|
+
home: y(a, 5.5),
|
|
1852
2033
|
total: y(i, 5.5),
|
|
1853
|
-
away: y(
|
|
2034
|
+
away: y(r, 5.5)
|
|
1854
2035
|
},
|
|
1855
2036
|
over05HT: {
|
|
1856
|
-
home: y(
|
|
1857
|
-
total: y(
|
|
2037
|
+
home: y(d, 0.5),
|
|
2038
|
+
total: y(c, 0.5),
|
|
1858
2039
|
away: y(u, 0.5)
|
|
1859
2040
|
},
|
|
1860
2041
|
over15HT: {
|
|
1861
|
-
home: y(
|
|
1862
|
-
total: y(
|
|
2042
|
+
home: y(d, 1.5),
|
|
2043
|
+
total: y(c, 1.5),
|
|
1863
2044
|
away: y(u, 1.5)
|
|
1864
2045
|
},
|
|
1865
2046
|
over25HT: {
|
|
1866
|
-
home: y(
|
|
1867
|
-
total: y(
|
|
2047
|
+
home: y(d, 2.5),
|
|
2048
|
+
total: y(c, 2.5),
|
|
1868
2049
|
away: y(u, 2.5)
|
|
1869
2050
|
}
|
|
1870
2051
|
};
|
|
1871
2052
|
}
|
|
1872
|
-
function
|
|
2053
|
+
function Ht(e, t) {
|
|
1873
2054
|
const o = e.competitorOne.id === t, n = e.competitorTwo.id === t;
|
|
1874
2055
|
if (!o && !n || !e.score) return null;
|
|
1875
2056
|
const s = parseInt(o ? e.score.competitorOne || "0" : e.score.competitorTwo || "0"), i = parseInt(o ? e.score.competitorTwo || "0" : e.score.competitorOne || "0");
|
|
1876
|
-
let
|
|
1877
|
-
return s > i ?
|
|
1878
|
-
result: { score: `${s}:${i}`, result:
|
|
2057
|
+
let a;
|
|
2058
|
+
return s > i ? a = "W" : s < i ? a = "L" : a = "D", {
|
|
2059
|
+
result: { score: `${s}:${i}`, result: a, isHome: o },
|
|
1879
2060
|
isHome: o
|
|
1880
2061
|
};
|
|
1881
2062
|
}
|
|
1882
|
-
function
|
|
1883
|
-
const
|
|
1884
|
-
if (!
|
|
1885
|
-
const
|
|
2063
|
+
function Io(e, t, o, n, s, i) {
|
|
2064
|
+
const a = t?.entries.find((I) => I.competitor.id === e), r = o?.entries.find((I) => I.competitor.id === e), c = n?.entries.find((I) => I.competitor.id === e), d = s?.entries.find((I) => I.competitor.id === e), u = i?.entries.find((I) => I.competitor.id === e);
|
|
2065
|
+
if (!a) return null;
|
|
2066
|
+
const l = r?.stats?.goalsFor ?? 0, m = c?.stats?.goalsFor ?? 0, p = a?.stats?.goalsFor ?? 0, g = d?.stats?.goalsAgainst ?? 0, h = u?.stats?.goalsAgainst ?? 0, N = a?.stats?.goalsAgainst ?? 0, S = r?.stats?.played ?? 0, O = c?.stats?.played ?? 0, P = a?.stats?.played ?? 0, B = P > 0 ? p / P : 0, $ = P > 0 ? N / P : 0, D = B + $, x = S > 0 ? l / S : 0, W = O > 0 ? m / O : 0, f = S > 0 ? g / S : 0, _ = O > 0 ? h / O : 0, U = x + f, ie = W + _;
|
|
1886
2067
|
return {
|
|
1887
|
-
homeGoals:
|
|
1888
|
-
totalGoals:
|
|
2068
|
+
homeGoals: l,
|
|
2069
|
+
totalGoals: p,
|
|
1889
2070
|
awayGoals: m,
|
|
1890
2071
|
homeGamesPlayed: S,
|
|
1891
2072
|
awayGamesPlayed: O,
|
|
1892
|
-
totalGamesPlayed:
|
|
1893
|
-
homeGoalsConceded:
|
|
1894
|
-
totalGoalsConceded:
|
|
2073
|
+
totalGamesPlayed: P,
|
|
2074
|
+
homeGoalsConceded: g,
|
|
2075
|
+
totalGoalsConceded: N,
|
|
1895
2076
|
awayGoalsConceded: h,
|
|
1896
|
-
gfPerMatch:
|
|
1897
|
-
gaPerMatch:
|
|
1898
|
-
gfGaPerMatch:
|
|
1899
|
-
homeGfPerMatch:
|
|
1900
|
-
awayGfPerMatch:
|
|
2077
|
+
gfPerMatch: B,
|
|
2078
|
+
gaPerMatch: $,
|
|
2079
|
+
gfGaPerMatch: D,
|
|
2080
|
+
homeGfPerMatch: x,
|
|
2081
|
+
awayGfPerMatch: W,
|
|
1901
2082
|
homeGaPerMatch: f,
|
|
1902
|
-
awayGaPerMatch:
|
|
1903
|
-
homeGfGaPerMatch:
|
|
1904
|
-
awayGfGaPerMatch:
|
|
2083
|
+
awayGaPerMatch: _,
|
|
2084
|
+
homeGfGaPerMatch: U,
|
|
2085
|
+
awayGfGaPerMatch: ie
|
|
1905
2086
|
};
|
|
1906
2087
|
}
|
|
1907
2088
|
function C(e, t, o, n) {
|
|
1908
|
-
const s = e.filter((
|
|
1909
|
-
const
|
|
1910
|
-
return !(!
|
|
1911
|
-
}).sort((
|
|
2089
|
+
const s = e.filter((a) => {
|
|
2090
|
+
const r = a.competitorOne.id === t, c = a.competitorTwo.id === t;
|
|
2091
|
+
return !(!r && !c || a.status?.type !== "FINISHED" || n === "home" && !r || n === "away" && !c);
|
|
2092
|
+
}).sort((a, r) => new Date(r.timing.kickoffTime).getTime() - new Date(a.timing.kickoffTime).getTime());
|
|
1912
2093
|
if (s.length === 0) return null;
|
|
1913
2094
|
let i = 0;
|
|
1914
|
-
for (const
|
|
1915
|
-
const
|
|
1916
|
-
if (o(
|
|
2095
|
+
for (const a of s) {
|
|
2096
|
+
const r = a.competitorOne.id === t;
|
|
2097
|
+
if (o(a, t, r))
|
|
1917
2098
|
i++;
|
|
1918
2099
|
else
|
|
1919
2100
|
break;
|
|
@@ -1942,7 +2123,7 @@ const T = {
|
|
|
1942
2123
|
scoredTwice: (e, t, o) => parseInt(o ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0") >= 2,
|
|
1943
2124
|
concededTwice: (e, t, o) => parseInt(o ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0") >= 2
|
|
1944
2125
|
};
|
|
1945
|
-
function
|
|
2126
|
+
function Q(e, t, o) {
|
|
1946
2127
|
return {
|
|
1947
2128
|
win: C(e, t, T.win, o),
|
|
1948
2129
|
draw: C(e, t, T.draw, o),
|
|
@@ -1960,91 +2141,91 @@ function q(e, t, o) {
|
|
|
1960
2141
|
concededTwice: C(e, t, T.concededTwice, o)
|
|
1961
2142
|
};
|
|
1962
2143
|
}
|
|
1963
|
-
function
|
|
1964
|
-
const n =
|
|
2144
|
+
function Ro(e, t, o) {
|
|
2145
|
+
const n = Q(e, t, "home"), s = Q(e, t), i = Q(e, o, "away"), a = Q(e, o);
|
|
1965
2146
|
return [
|
|
1966
2147
|
{
|
|
1967
2148
|
label: "Consecutive wins",
|
|
1968
2149
|
homeTeam: { home: n.win, total: s.win },
|
|
1969
|
-
awayTeam: { total:
|
|
2150
|
+
awayTeam: { total: a.win, home: i.win },
|
|
1970
2151
|
colorType: "neutral"
|
|
1971
2152
|
},
|
|
1972
2153
|
{
|
|
1973
2154
|
label: "Consecutive draws",
|
|
1974
2155
|
homeTeam: { home: n.draw, total: s.draw },
|
|
1975
|
-
awayTeam: { total:
|
|
2156
|
+
awayTeam: { total: a.draw, home: i.draw },
|
|
1976
2157
|
colorType: "neutral"
|
|
1977
2158
|
},
|
|
1978
2159
|
{
|
|
1979
2160
|
label: "Consecutive defeats",
|
|
1980
2161
|
homeTeam: { home: n.loss, total: s.loss },
|
|
1981
|
-
awayTeam: { total:
|
|
2162
|
+
awayTeam: { total: a.loss, home: i.loss },
|
|
1982
2163
|
colorType: "neutral"
|
|
1983
2164
|
},
|
|
1984
2165
|
{
|
|
1985
2166
|
label: "No win",
|
|
1986
2167
|
homeTeam: { home: n.noWin, total: s.noWin },
|
|
1987
|
-
awayTeam: { total:
|
|
2168
|
+
awayTeam: { total: a.noWin, home: i.noWin },
|
|
1988
2169
|
colorType: "negative"
|
|
1989
2170
|
},
|
|
1990
2171
|
{
|
|
1991
2172
|
label: "No draw",
|
|
1992
2173
|
homeTeam: { home: n.noDraw, total: s.noDraw },
|
|
1993
|
-
awayTeam: { total:
|
|
2174
|
+
awayTeam: { total: a.noDraw, home: i.noDraw },
|
|
1994
2175
|
colorType: "neutral"
|
|
1995
2176
|
},
|
|
1996
2177
|
{
|
|
1997
2178
|
label: "No defeat",
|
|
1998
2179
|
homeTeam: { home: n.noDefeat, total: s.noDefeat },
|
|
1999
|
-
awayTeam: { total:
|
|
2180
|
+
awayTeam: { total: a.noDefeat, home: i.noDefeat },
|
|
2000
2181
|
colorType: "positive"
|
|
2001
2182
|
},
|
|
2002
2183
|
{
|
|
2003
2184
|
label: "Scored at least once",
|
|
2004
2185
|
homeTeam: { home: n.scored, total: s.scored },
|
|
2005
|
-
awayTeam: { total:
|
|
2186
|
+
awayTeam: { total: a.scored, home: i.scored },
|
|
2006
2187
|
colorType: "positive"
|
|
2007
2188
|
},
|
|
2008
2189
|
{
|
|
2009
2190
|
label: "Conceded at least once",
|
|
2010
2191
|
homeTeam: { home: n.conceded, total: s.conceded },
|
|
2011
|
-
awayTeam: { total:
|
|
2192
|
+
awayTeam: { total: a.conceded, home: i.conceded },
|
|
2012
2193
|
colorType: "negative"
|
|
2013
2194
|
},
|
|
2014
2195
|
{
|
|
2015
2196
|
label: "No goal scored",
|
|
2016
2197
|
homeTeam: { home: n.noGoalScored, total: s.noGoalScored },
|
|
2017
|
-
awayTeam: { total:
|
|
2198
|
+
awayTeam: { total: a.noGoalScored, home: i.noGoalScored },
|
|
2018
2199
|
colorType: "neutral"
|
|
2019
2200
|
},
|
|
2020
2201
|
{
|
|
2021
2202
|
label: "No goal conceded",
|
|
2022
2203
|
homeTeam: { home: n.noGoalConceded, total: s.noGoalConceded },
|
|
2023
|
-
awayTeam: { total:
|
|
2204
|
+
awayTeam: { total: a.noGoalConceded, home: i.noGoalConceded },
|
|
2024
2205
|
colorType: "neutral"
|
|
2025
2206
|
},
|
|
2026
2207
|
{
|
|
2027
2208
|
label: "GS + GC over 2.5",
|
|
2028
2209
|
homeTeam: { home: n.over25, total: s.over25 },
|
|
2029
|
-
awayTeam: { total:
|
|
2210
|
+
awayTeam: { total: a.over25, home: i.over25 },
|
|
2030
2211
|
colorType: "neutral"
|
|
2031
2212
|
},
|
|
2032
2213
|
{
|
|
2033
2214
|
label: "GS + GC under 2.5",
|
|
2034
2215
|
homeTeam: { home: n.under25, total: s.under25 },
|
|
2035
|
-
awayTeam: { total:
|
|
2216
|
+
awayTeam: { total: a.under25, home: i.under25 },
|
|
2036
2217
|
colorType: "neutral"
|
|
2037
2218
|
},
|
|
2038
2219
|
{
|
|
2039
2220
|
label: "Scored at least twice",
|
|
2040
2221
|
homeTeam: { home: n.scoredTwice, total: s.scoredTwice },
|
|
2041
|
-
awayTeam: { total:
|
|
2222
|
+
awayTeam: { total: a.scoredTwice, home: i.scoredTwice },
|
|
2042
2223
|
colorType: "positive"
|
|
2043
2224
|
},
|
|
2044
2225
|
{
|
|
2045
2226
|
label: "Conceded at least twice",
|
|
2046
2227
|
homeTeam: { home: n.concededTwice, total: s.concededTwice },
|
|
2047
|
-
awayTeam: { total:
|
|
2228
|
+
awayTeam: { total: a.concededTwice, home: i.concededTwice },
|
|
2048
2229
|
colorType: "negative"
|
|
2049
2230
|
}
|
|
2050
2231
|
];
|
|
@@ -2053,130 +2234,131 @@ function w(e, t) {
|
|
|
2053
2234
|
const o = /* @__PURE__ */ new Map();
|
|
2054
2235
|
return e.forEach((n) => {
|
|
2055
2236
|
if (n.status?.type !== "FINISHED") return;
|
|
2056
|
-
const s =
|
|
2237
|
+
const s = Ht(n, t);
|
|
2057
2238
|
if (!s) return;
|
|
2058
|
-
const i = s.isHome ? n.competitorTwo.id : n.competitorOne.id,
|
|
2239
|
+
const i = s.isHome ? n.competitorTwo.id : n.competitorOne.id, a = s.isHome ? n.competitorTwo : n.competitorOne, r = o.get(i) || {
|
|
2059
2240
|
opponentId: i,
|
|
2060
|
-
opponentName:
|
|
2061
|
-
opponentLogo:
|
|
2241
|
+
opponentName: a.name,
|
|
2242
|
+
opponentLogo: a.assets?.logo
|
|
2062
2243
|
};
|
|
2063
|
-
s.isHome ?
|
|
2244
|
+
s.isHome ? r.homeResult = s.result : r.awayResult = s.result, o.set(i, r);
|
|
2064
2245
|
}), o;
|
|
2065
2246
|
}
|
|
2066
|
-
function
|
|
2067
|
-
const
|
|
2068
|
-
...
|
|
2069
|
-
...
|
|
2247
|
+
function Mo(e, t, o, n, s, i, a) {
|
|
2248
|
+
const r = w(e, t), c = w(e, o), d = /* @__PURE__ */ new Set([
|
|
2249
|
+
...r.keys(),
|
|
2250
|
+
...c.keys(),
|
|
2070
2251
|
t,
|
|
2071
2252
|
// Include home team as row for away team results
|
|
2072
2253
|
o
|
|
2073
2254
|
// Include away team as row for home team results
|
|
2074
2255
|
]), u = [];
|
|
2075
|
-
return
|
|
2076
|
-
const m =
|
|
2077
|
-
if (!m && !
|
|
2256
|
+
return d.forEach((l) => {
|
|
2257
|
+
const m = r.get(l), p = c.get(l);
|
|
2258
|
+
if (!m && !p && l !== t && l !== o)
|
|
2078
2259
|
return;
|
|
2079
|
-
let
|
|
2080
|
-
|
|
2081
|
-
opponentId:
|
|
2082
|
-
opponentName:
|
|
2260
|
+
let g, h;
|
|
2261
|
+
l === t ? (g = n, h = i) : l === o ? (g = s, h = a) : (g = m?.opponentName || p?.opponentName || "", h = m?.opponentLogo || p?.opponentLogo), u.push({
|
|
2262
|
+
opponentId: l,
|
|
2263
|
+
opponentName: g,
|
|
2083
2264
|
opponentLogo: h,
|
|
2084
2265
|
homeTeamHome: m?.homeResult,
|
|
2085
2266
|
homeTeamAway: m?.awayResult,
|
|
2086
|
-
awayTeamHome:
|
|
2087
|
-
awayTeamAway:
|
|
2088
|
-
isHomeTeamRow:
|
|
2089
|
-
isAwayTeamRow:
|
|
2267
|
+
awayTeamHome: p?.homeResult,
|
|
2268
|
+
awayTeamAway: p?.awayResult,
|
|
2269
|
+
isHomeTeamRow: l === t,
|
|
2270
|
+
isAwayTeamRow: l === o
|
|
2090
2271
|
});
|
|
2091
|
-
}), u.sort((
|
|
2272
|
+
}), u.sort((l, m) => l.isHomeTeamRow ? -1 : m.isHomeTeamRow ? 1 : l.isAwayTeamRow ? -1 : m.isAwayTeamRow ? 1 : l.opponentName.localeCompare(m.opponentName));
|
|
2092
2273
|
}
|
|
2093
2274
|
export {
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2275
|
+
Pt as GOAL_EVENT_TYPES,
|
|
2276
|
+
Ho as addProviderRef,
|
|
2277
|
+
H as aggregatePlayerStatisticsFromMatches,
|
|
2278
|
+
It as analyzeMatch,
|
|
2279
|
+
Y as calcAverage,
|
|
2280
|
+
L as calcPercentage,
|
|
2281
|
+
Eo as calculateH2HStats,
|
|
2101
2282
|
C as calculateStreak,
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2283
|
+
vo as formatAsAverage,
|
|
2284
|
+
Ao as formatPossessionPercentage,
|
|
2285
|
+
To as formatStatValue,
|
|
2286
|
+
_o as formatWithAverage,
|
|
2287
|
+
wt as getActiveSeason,
|
|
2288
|
+
Ft as getAllPlayerStatisticsFromMatches,
|
|
2289
|
+
Bt as getBasketballLivescore,
|
|
2290
|
+
Uo as getBatchMatchOdds,
|
|
2110
2291
|
A as getConfig,
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2292
|
+
qt as getFansUnitedFootballCompetition,
|
|
2293
|
+
Qt as getFansUnitedFootballCompetitions,
|
|
2294
|
+
Xt as getFansUnitedFootballMatch,
|
|
2295
|
+
Jt as getFansUnitedFootballMatches,
|
|
2296
|
+
Kt as getFansUnitedFootballPlayer,
|
|
2297
|
+
zt as getFansUnitedFootballPlayers,
|
|
2298
|
+
Zt as getFansUnitedFootballSearch,
|
|
2299
|
+
Vt as getFansUnitedFootballTeam,
|
|
2300
|
+
jt as getFansUnitedFootballTeams,
|
|
2301
|
+
bo as getFootballCompetition,
|
|
2302
|
+
ko as getFootballLivescore,
|
|
2303
|
+
Bo as getFootballMatch,
|
|
2304
|
+
$o as getFootballMatchCommentary,
|
|
2305
|
+
xo as getFootballMatchEvents,
|
|
2306
|
+
Wo as getFootballMatchLineups,
|
|
2307
|
+
Yo as getFootballMatchOdds,
|
|
2308
|
+
Qo as getFootballMatchStatistics,
|
|
2309
|
+
qo as getFootballMatches,
|
|
2310
|
+
Vo as getFootballPlayerSeasonStatistics,
|
|
2311
|
+
jo as getFootballSeasonDetails,
|
|
2312
|
+
Ko as getFootballStandings,
|
|
2313
|
+
zo as getFootballTeam,
|
|
2314
|
+
Xo as getFootballTeamSquad,
|
|
2315
|
+
Jo as getLeaderboardMatches,
|
|
2316
|
+
Zo as getLeaderboardTeamMatches,
|
|
2317
|
+
wo as getLeaderboardTemplate,
|
|
2318
|
+
Ht as getMatchResult,
|
|
2319
|
+
Lt as getMostCardedPlayersFromMatches,
|
|
2320
|
+
Lo as getOpponentScore,
|
|
2321
|
+
en as getProviderRefId,
|
|
2322
|
+
Fo as getRecentH2HMeetings,
|
|
2323
|
+
Wt as getSportal365Standings,
|
|
2324
|
+
no as getTeamFinishedMatches,
|
|
2325
|
+
Io as getTeamGoalStats,
|
|
2326
|
+
No as getTeamHomeAwayStats,
|
|
2327
|
+
uo as getTeamMostDecorated,
|
|
2328
|
+
eo as getTeamNextMatch,
|
|
2329
|
+
Po as getTeamOverUnderStats,
|
|
2330
|
+
to as getTeamPreviousMatch,
|
|
2331
|
+
so as getTeamResultsTable,
|
|
2332
|
+
Oo as getTeamScore,
|
|
2333
|
+
Yt as getTeamSeasonStatistics,
|
|
2334
|
+
Q as getTeamStreaks,
|
|
2335
|
+
Ro as getTeamStreaksComparison,
|
|
2336
|
+
ro as getTeamTopAppearances,
|
|
2337
|
+
ao as getTeamTopAssisters,
|
|
2338
|
+
lo as getTeamTopCleanSheets,
|
|
2339
|
+
co as getTeamTopMinutesPlayed,
|
|
2340
|
+
io as getTeamTopScorers,
|
|
2341
|
+
oo as getTeamUpcomingMatches,
|
|
2342
|
+
Mo as getTeamsCommonOpponents,
|
|
2343
|
+
$t as getTennisLivescore,
|
|
2344
|
+
Ot as getTopAssistersFromMatches,
|
|
2345
|
+
Et as getTopGoalContributorsFromMatches,
|
|
2346
|
+
Ct as getTopScorersFromMatches,
|
|
2347
|
+
tn as isConfigured,
|
|
2348
|
+
Co as isMatchFinished,
|
|
2349
|
+
Rt as isTeamAway,
|
|
2350
|
+
z as isTeamHome,
|
|
2351
|
+
So as isTeamInMatch,
|
|
2352
|
+
xt as search,
|
|
2353
|
+
kt as searchFootball,
|
|
2354
|
+
on as setConfig,
|
|
2173
2355
|
T as streakFilters,
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2356
|
+
v as toProviderRefArray,
|
|
2357
|
+
yo as useAllPlayerStatisticsFromMatches,
|
|
2358
|
+
po as useMostCardedPlayersFromMatches,
|
|
2359
|
+
ho as usePlayerStatistics,
|
|
2360
|
+
Nt as usePlayerStatisticsMap,
|
|
2361
|
+
fo as useTopAssistersFromMatches,
|
|
2362
|
+
go as useTopGoalContributorsFromMatches,
|
|
2363
|
+
mo as useTopScorersFromMatches
|
|
2182
2364
|
};
|