fansunited-data-layer 0.8.4 → 0.8.5
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/transformers/game.d.ts.map +1 -1
- package/api/sportal365-sports/basketball/games/types.d.ts +2 -2
- package/api/sportal365-sports/basketball/games/types.d.ts.map +1 -1
- package/api/sportal365-sports/tennis/matches/transformers/match.d.ts.map +1 -1
- package/api/sportal365-sports/tennis/matches/types.d.ts +1 -1
- package/api/sportal365-sports/tennis/matches/types.d.ts.map +1 -1
- package/fansunited-data-layer.cjs +1 -1
- package/fansunited-data-layer.js +210 -228
- package/package.json +1 -1
package/fansunited-data-layer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { i as
|
|
1
|
+
import { t as _, g as A, f as se, c as V, S as ie, a as re, b as ae, d as ce, e as le, h as de } from "./matches-B8E7KjZU.js";
|
|
2
|
+
import { i as _o, j as So, k as Co, l as Ao, m as Oo, n as No, o as Ro, p as Eo, q as Fo, r as Mo, s as Lo, u as Io, v as Do, w as Go, x as bo, y as Po, z as ko, A as Ho, B as Uo, C as Bo, D as $o, E as xo } from "./matches-B8E7KjZU.js";
|
|
3
3
|
import { useMemo as G } from "react";
|
|
4
4
|
function ue(e) {
|
|
5
5
|
return {
|
|
@@ -15,12 +15,12 @@ function ue(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: _(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: _(e.uuid)
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
function me(e) {
|
|
@@ -37,12 +37,12 @@ function me(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: _(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: _(e.uuid)
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
function fe(e) {
|
|
@@ -60,12 +60,12 @@ function fe(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: _(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: _(e.uuid)
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
function ge(e) {
|
|
@@ -80,12 +80,12 @@ function ge(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: _(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: _(e.uuid)
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
function pe(e) {
|
|
@@ -102,16 +102,16 @@ function pe(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: _(e.city.country.uuid)
|
|
106
106
|
},
|
|
107
|
-
providerRef:
|
|
107
|
+
providerRef: _(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: _(e.country.uuid)
|
|
115
115
|
},
|
|
116
116
|
profile: {
|
|
117
117
|
latitude: e.profile.lat,
|
|
@@ -121,7 +121,7 @@ function pe(e) {
|
|
|
121
121
|
assets: e.url_thumb ? {
|
|
122
122
|
image: e.url_thumb
|
|
123
123
|
} : void 0,
|
|
124
|
-
providerRef:
|
|
124
|
+
providerRef: _(e.uuid)
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
function ye(e) {
|
|
@@ -136,12 +136,12 @@ function ye(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: _(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: _(e.uuid)
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
function he(e) {
|
|
@@ -217,13 +217,13 @@ function Q(e) {
|
|
|
217
217
|
gender: e.gender
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function _e(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 Se(e) {
|
|
227
227
|
if (!e.season?.competition) return;
|
|
228
228
|
const t = e.season.competition;
|
|
229
229
|
return {
|
|
@@ -260,21 +260,8 @@ function Ce(e) {
|
|
|
260
260
|
function Ae(e) {
|
|
261
261
|
if (!e || e.length === 0) return;
|
|
262
262
|
console.log("[livescore:basketball] raw score entries:", JSON.stringify(e, null, 2));
|
|
263
|
-
const t = e.filter((i) => i.result_type.category === "
|
|
264
|
-
if (t.length === 0)
|
|
265
|
-
const i = e[0];
|
|
266
|
-
return console.warn("[livescore:basketball] no PERIOD entries found in score, falling back to first entry:", JSON.stringify(i, null, 2)), {
|
|
267
|
-
competitorOne: String(i.home),
|
|
268
|
-
competitorTwo: String(i.away),
|
|
269
|
-
breakdown: {
|
|
270
|
-
total: {
|
|
271
|
-
competitorOne: String(i.home),
|
|
272
|
-
competitorTwo: String(i.away)
|
|
273
|
-
},
|
|
274
|
-
periods: []
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
}
|
|
263
|
+
const t = e.filter((i) => i.result_type.category === "single_period");
|
|
264
|
+
if (t.length === 0) return;
|
|
278
265
|
let o = 0, n = 0;
|
|
279
266
|
const s = [];
|
|
280
267
|
for (const i of t)
|
|
@@ -305,16 +292,16 @@ function Ne(e) {
|
|
|
305
292
|
id: e.id,
|
|
306
293
|
slug: e.slug,
|
|
307
294
|
status: ve(e.status),
|
|
308
|
-
timing:
|
|
295
|
+
timing: _e(e),
|
|
309
296
|
competitorOne: Q(e.home_team),
|
|
310
297
|
competitorTwo: Q(e.away_team),
|
|
311
|
-
competition:
|
|
298
|
+
competition: Se(e),
|
|
312
299
|
round: e.round ? {
|
|
313
300
|
id: e.round.id,
|
|
314
301
|
key: e.round.uuid,
|
|
315
302
|
name: e.round.name,
|
|
316
303
|
type: "REGULAR",
|
|
317
|
-
providerRef:
|
|
304
|
+
providerRef: _(e.round.uuid)
|
|
318
305
|
} : void 0,
|
|
319
306
|
venue: Ce(e.arena),
|
|
320
307
|
score: Ae(e.score),
|
|
@@ -349,8 +336,8 @@ async function Nt(e, t) {
|
|
|
349
336
|
config: o
|
|
350
337
|
})).games.map(Ne);
|
|
351
338
|
}
|
|
352
|
-
const
|
|
353
|
-
function
|
|
339
|
+
const Re = V(re);
|
|
340
|
+
function Ee(e) {
|
|
354
341
|
const t = {
|
|
355
342
|
FINISHED: "finished",
|
|
356
343
|
NOT_STARTED: "not_started",
|
|
@@ -452,49 +439,44 @@ function Me(e) {
|
|
|
452
439
|
function Le(e) {
|
|
453
440
|
if (!e.results || e.results.length === 0) return;
|
|
454
441
|
console.log("[livescore:tennis] raw results entries:", JSON.stringify(e.results, null, 2));
|
|
455
|
-
const t = e.results.filter((
|
|
456
|
-
if (t.length === 0)
|
|
457
|
-
console.warn("[livescore:tennis] no SET_n entries found in results, result_type codes:", e.results.map((i) => i.type.code));
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
442
|
+
const t = e.results.filter((l) => /^set\d+$/i.test(l.type.code));
|
|
443
|
+
if (t.length === 0) return;
|
|
460
444
|
const o = [];
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
competitorOne: r.value,
|
|
467
|
-
competitorTwo: a.value
|
|
445
|
+
for (const l of t) {
|
|
446
|
+
const d = l.values.find((c) => c.position === "1"), u = l.values.find((c) => c.position === "2");
|
|
447
|
+
!d || !u || d.value == null || u.value == null || o.push({
|
|
448
|
+
competitorOne: d.value,
|
|
449
|
+
competitorTwo: u.value
|
|
468
450
|
});
|
|
469
|
-
const d = parseInt(r.value), l = parseInt(a.value);
|
|
470
|
-
!isNaN(d) && !isNaN(l) && (d > l && n++, l > d && s++);
|
|
471
451
|
}
|
|
472
|
-
if (o.length
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
}
|
|
483
|
-
|
|
452
|
+
if (o.length === 0) return;
|
|
453
|
+
const n = e.results.find((l) => l.type.code === "setswon"), s = n?.values.find((l) => l.position === "1"), i = n?.values.find((l) => l.position === "2");
|
|
454
|
+
let r, a;
|
|
455
|
+
return s?.value != null && i?.value != null ? (r = parseInt(s.value), a = parseInt(i.value)) : (r = o.filter((l) => parseInt(l.competitorOne) > parseInt(l.competitorTwo)).length, a = o.filter((l) => parseInt(l.competitorTwo) > parseInt(l.competitorOne)).length), {
|
|
456
|
+
competitorOne: String(r),
|
|
457
|
+
competitorTwo: String(a),
|
|
458
|
+
breakdown: {
|
|
459
|
+
total: {
|
|
460
|
+
competitorOne: String(r),
|
|
461
|
+
competitorTwo: String(a)
|
|
462
|
+
},
|
|
463
|
+
periods: o
|
|
464
|
+
}
|
|
465
|
+
};
|
|
484
466
|
}
|
|
485
|
-
function
|
|
467
|
+
function Ie(e) {
|
|
486
468
|
const t = e.participants.find((o) => o.winner === "YES");
|
|
487
469
|
if (t)
|
|
488
470
|
return {
|
|
489
471
|
competitorId: t.id
|
|
490
472
|
};
|
|
491
473
|
}
|
|
492
|
-
function
|
|
474
|
+
function De(e) {
|
|
493
475
|
const t = e.participants.sort((o, n) => o.position - n.position);
|
|
494
476
|
return {
|
|
495
477
|
id: e.id,
|
|
496
478
|
slug: e.slug,
|
|
497
|
-
status:
|
|
479
|
+
status: Ee(e.status),
|
|
498
480
|
timing: Fe(e),
|
|
499
481
|
competitorOne: X(t[0]),
|
|
500
482
|
competitorTwo: X(t[1]),
|
|
@@ -504,10 +486,10 @@ function Ie(e) {
|
|
|
504
486
|
key: e.round.uuid,
|
|
505
487
|
name: e.round.name,
|
|
506
488
|
type: "REGULAR",
|
|
507
|
-
providerRef:
|
|
489
|
+
providerRef: _(e.round.uuid)
|
|
508
490
|
} : void 0,
|
|
509
491
|
score: Le(e),
|
|
510
|
-
winner:
|
|
492
|
+
winner: Ie(e),
|
|
511
493
|
coverage: e.coverage?.type === "NOT_LIVE" ? "UNKNOWN" : e.coverage?.type,
|
|
512
494
|
metadata: {
|
|
513
495
|
matchType: e.type,
|
|
@@ -523,9 +505,9 @@ function Ie(e) {
|
|
|
523
505
|
]
|
|
524
506
|
};
|
|
525
507
|
}
|
|
526
|
-
async function
|
|
508
|
+
async function Rt(e, t) {
|
|
527
509
|
const o = t || A(), { sportal365Sports: n } = o;
|
|
528
|
-
return (await
|
|
510
|
+
return (await Re.get({
|
|
529
511
|
path: "/matches/livescore",
|
|
530
512
|
params: {
|
|
531
513
|
date: e?.date,
|
|
@@ -546,10 +528,10 @@ async function Et(e, t) {
|
|
|
546
528
|
},
|
|
547
529
|
next: e?.next,
|
|
548
530
|
config: o
|
|
549
|
-
})).matches.map(
|
|
531
|
+
})).matches.map(De);
|
|
550
532
|
}
|
|
551
533
|
const Ge = V(ae);
|
|
552
|
-
function
|
|
534
|
+
function R(e) {
|
|
553
535
|
return {
|
|
554
536
|
language: e.language,
|
|
555
537
|
name: e.name,
|
|
@@ -557,13 +539,13 @@ function E(e) {
|
|
|
557
539
|
threeLetterCode: e.three_letter_code ?? void 0
|
|
558
540
|
};
|
|
559
541
|
}
|
|
560
|
-
function
|
|
542
|
+
function E(e) {
|
|
561
543
|
if (!(!e || !e.url))
|
|
562
544
|
return {
|
|
563
545
|
url: e.url
|
|
564
546
|
};
|
|
565
547
|
}
|
|
566
|
-
function
|
|
548
|
+
function D(e) {
|
|
567
549
|
if (e)
|
|
568
550
|
return {
|
|
569
551
|
id: e.id,
|
|
@@ -571,8 +553,8 @@ function I(e) {
|
|
|
571
553
|
name: e.name,
|
|
572
554
|
shortName: e.short_name ?? void 0,
|
|
573
555
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
574
|
-
translations: e.translations.map(
|
|
575
|
-
displayAsset:
|
|
556
|
+
translations: e.translations.map(R),
|
|
557
|
+
displayAsset: E(e.display_asset),
|
|
576
558
|
slug: e.slug,
|
|
577
559
|
providerRef: e.id
|
|
578
560
|
};
|
|
@@ -585,12 +567,12 @@ function K(e) {
|
|
|
585
567
|
name: e.name,
|
|
586
568
|
shortName: e.short_name ?? void 0,
|
|
587
569
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
588
|
-
translations: e.translations.map(
|
|
589
|
-
displayAsset:
|
|
570
|
+
translations: e.translations.map(R),
|
|
571
|
+
displayAsset: E(e.display_asset),
|
|
590
572
|
slug: e.slug,
|
|
591
573
|
tagScore: e.tag_score ?? void 0,
|
|
592
574
|
sport: e.sport,
|
|
593
|
-
country:
|
|
575
|
+
country: D(e.country),
|
|
594
576
|
gender: e.gender,
|
|
595
577
|
competitionIds: e.competition_ids,
|
|
596
578
|
type: e.type,
|
|
@@ -607,12 +589,12 @@ function ee(e) {
|
|
|
607
589
|
name: e.name,
|
|
608
590
|
shortName: e.short_name ?? void 0,
|
|
609
591
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
610
|
-
translations: e.translations.map(
|
|
611
|
-
displayAsset:
|
|
592
|
+
translations: e.translations.map(R),
|
|
593
|
+
displayAsset: E(e.display_asset),
|
|
612
594
|
slug: e.slug,
|
|
613
595
|
tagScore: e.tag_score ?? void 0,
|
|
614
596
|
sport: e.sport,
|
|
615
|
-
country:
|
|
597
|
+
country: D(e.country),
|
|
616
598
|
providerRef: e.id
|
|
617
599
|
};
|
|
618
600
|
}
|
|
@@ -624,12 +606,12 @@ function be(e) {
|
|
|
624
606
|
name: e.name,
|
|
625
607
|
shortName: e.short_name ?? void 0,
|
|
626
608
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
627
|
-
translations: e.translations.map(
|
|
628
|
-
displayAsset:
|
|
609
|
+
translations: e.translations.map(R),
|
|
610
|
+
displayAsset: E(e.display_asset),
|
|
629
611
|
slug: e.slug,
|
|
630
612
|
tagScore: e.tag_score ?? void 0,
|
|
631
613
|
sport: e.sport,
|
|
632
|
-
country:
|
|
614
|
+
country: D(e.country),
|
|
633
615
|
gender: e.gender,
|
|
634
616
|
providerRef: e.id
|
|
635
617
|
};
|
|
@@ -642,12 +624,12 @@ function Pe(e) {
|
|
|
642
624
|
name: e.name,
|
|
643
625
|
shortName: e.short_name ?? void 0,
|
|
644
626
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
645
|
-
translations: e.translations.map(
|
|
646
|
-
displayAsset:
|
|
627
|
+
translations: e.translations.map(R),
|
|
628
|
+
displayAsset: E(e.display_asset),
|
|
647
629
|
slug: e.slug,
|
|
648
630
|
tagScore: e.tag_score ?? void 0,
|
|
649
631
|
sport: e.sport,
|
|
650
|
-
country:
|
|
632
|
+
country: D(e.country),
|
|
651
633
|
gender: e.gender,
|
|
652
634
|
birthdate: e.birthdate ?? void 0,
|
|
653
635
|
position: e.position ?? void 0,
|
|
@@ -662,12 +644,12 @@ function ke(e) {
|
|
|
662
644
|
name: e.name,
|
|
663
645
|
shortName: e.short_name ?? void 0,
|
|
664
646
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
665
|
-
translations: e.translations.map(
|
|
666
|
-
displayAsset:
|
|
647
|
+
translations: e.translations.map(R),
|
|
648
|
+
displayAsset: E(e.display_asset),
|
|
667
649
|
slug: e.slug,
|
|
668
650
|
tagScore: e.tag_score ?? void 0,
|
|
669
651
|
sport: e.sport,
|
|
670
|
-
country:
|
|
652
|
+
country: D(e.country),
|
|
671
653
|
gender: e.gender,
|
|
672
654
|
birthdate: e.birthdate ?? void 0,
|
|
673
655
|
providerRef: e.id
|
|
@@ -681,12 +663,12 @@ function He(e) {
|
|
|
681
663
|
name: e.name,
|
|
682
664
|
shortName: e.short_name ?? void 0,
|
|
683
665
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
684
|
-
translations: e.translations.map(
|
|
685
|
-
displayAsset:
|
|
666
|
+
translations: e.translations.map(R),
|
|
667
|
+
displayAsset: E(e.display_asset),
|
|
686
668
|
slug: e.slug,
|
|
687
669
|
tagScore: e.tag_score ?? void 0,
|
|
688
670
|
sport: e.sport,
|
|
689
|
-
country:
|
|
671
|
+
country: D(e.country),
|
|
690
672
|
gender: e.gender,
|
|
691
673
|
birthdate: e.birthdate ?? void 0,
|
|
692
674
|
providerRef: e.id
|
|
@@ -700,12 +682,12 @@ function Ue(e) {
|
|
|
700
682
|
name: e.name,
|
|
701
683
|
shortName: e.short_name ?? void 0,
|
|
702
684
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
703
|
-
translations: e.translations.map(
|
|
704
|
-
displayAsset:
|
|
685
|
+
translations: e.translations.map(R),
|
|
686
|
+
displayAsset: E(e.display_asset),
|
|
705
687
|
slug: e.slug,
|
|
706
688
|
tagScore: e.tag_score ?? void 0,
|
|
707
689
|
sport: e.sport,
|
|
708
|
-
country:
|
|
690
|
+
country: D(e.country),
|
|
709
691
|
city: e.city ? ee(e.city) : void 0,
|
|
710
692
|
providerRef: e.id
|
|
711
693
|
};
|
|
@@ -718,12 +700,12 @@ function Be(e) {
|
|
|
718
700
|
name: e.name,
|
|
719
701
|
shortName: e.short_name ?? void 0,
|
|
720
702
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
721
|
-
translations: e.translations.map(
|
|
722
|
-
displayAsset:
|
|
703
|
+
translations: e.translations.map(R),
|
|
704
|
+
displayAsset: E(e.display_asset),
|
|
723
705
|
slug: e.slug,
|
|
724
706
|
tagScore: e.tag_score ?? void 0,
|
|
725
707
|
sport: e.sport,
|
|
726
|
-
country:
|
|
708
|
+
country: D(e.country),
|
|
727
709
|
gender: e.gender,
|
|
728
710
|
type: e.type ?? void 0,
|
|
729
711
|
region: e.region ?? void 0,
|
|
@@ -738,8 +720,8 @@ function $e(e) {
|
|
|
738
720
|
name: e.name,
|
|
739
721
|
shortName: e.short_name ?? void 0,
|
|
740
722
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
741
|
-
translations: e.translations.map(
|
|
742
|
-
displayAsset:
|
|
723
|
+
translations: e.translations.map(R),
|
|
724
|
+
displayAsset: E(e.display_asset),
|
|
743
725
|
slug: e.slug,
|
|
744
726
|
tagScore: e.tag_score ?? void 0,
|
|
745
727
|
sport: e.sport,
|
|
@@ -758,8 +740,8 @@ function xe(e) {
|
|
|
758
740
|
name: e.name,
|
|
759
741
|
shortName: e.short_name ?? void 0,
|
|
760
742
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
761
|
-
translations: e.translations.map(
|
|
762
|
-
displayAsset:
|
|
743
|
+
translations: e.translations.map(R),
|
|
744
|
+
displayAsset: E(e.display_asset),
|
|
763
745
|
slug: e.slug,
|
|
764
746
|
tagScore: e.tag_score ?? void 0,
|
|
765
747
|
sport: e.sport,
|
|
@@ -795,7 +777,7 @@ function We(e) {
|
|
|
795
777
|
}
|
|
796
778
|
}
|
|
797
779
|
}
|
|
798
|
-
async function
|
|
780
|
+
async function Et(e = {}, t) {
|
|
799
781
|
const o = t ?? A(), n = {};
|
|
800
782
|
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());
|
|
801
783
|
const s = await Ge.get({
|
|
@@ -858,9 +840,9 @@ function je(e) {
|
|
|
858
840
|
if (r.searchParams.set("key", i.apiKey), r.searchParams.set("client_id", i.clientId), n.params)
|
|
859
841
|
for (const [u, c] of Object.entries(n.params))
|
|
860
842
|
c !== void 0 && (Array.isArray(c) ? c.length > 0 && r.searchParams.set(u, c.join(",")) : r.searchParams.set(u, c));
|
|
861
|
-
const a = 3e4,
|
|
862
|
-
|
|
863
|
-
const
|
|
843
|
+
const a = 3e4, l = new URL(r.toString());
|
|
844
|
+
l.searchParams.delete("key"), l.searchParams.delete("client_id"), console.log("🔗 FansUnited API URL:", l.toString());
|
|
845
|
+
const d = await fetch(r.toString(), {
|
|
864
846
|
method: "GET",
|
|
865
847
|
headers: {
|
|
866
848
|
Accept: "application/json",
|
|
@@ -872,25 +854,25 @@ function je(e) {
|
|
|
872
854
|
// Next.js cache options for ISR/on-demand revalidation
|
|
873
855
|
...n.next && { next: n.next }
|
|
874
856
|
});
|
|
875
|
-
if (!
|
|
876
|
-
let u = `Fans United API error: ${
|
|
857
|
+
if (!d.ok) {
|
|
858
|
+
let u = `Fans United API error: ${d.status} ${d.statusText}`;
|
|
877
859
|
try {
|
|
878
|
-
const c = await
|
|
860
|
+
const c = await d.text();
|
|
879
861
|
c && (u += ` - ${c}`);
|
|
880
862
|
} catch (c) {
|
|
881
863
|
console.error("[Fans United HTTP] Failed to read error response body:", {
|
|
882
864
|
error: c instanceof Error ? c.message : String(c),
|
|
883
|
-
status:
|
|
884
|
-
statusText:
|
|
865
|
+
status: d.status,
|
|
866
|
+
statusText: d.statusText
|
|
885
867
|
});
|
|
886
868
|
}
|
|
887
869
|
throw new Error(u);
|
|
888
870
|
}
|
|
889
|
-
return
|
|
871
|
+
return d.json();
|
|
890
872
|
}
|
|
891
873
|
};
|
|
892
874
|
}
|
|
893
|
-
const Ke = "https://football.fansunitedapi.com",
|
|
875
|
+
const Ke = "https://football.fansunitedapi.com", I = je(Ke);
|
|
894
876
|
function Ye(e) {
|
|
895
877
|
return {
|
|
896
878
|
id: String(e.id),
|
|
@@ -945,15 +927,15 @@ function Je(e) {
|
|
|
945
927
|
async function Mt(e, t) {
|
|
946
928
|
const o = {};
|
|
947
929
|
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");
|
|
948
|
-
const n = await
|
|
930
|
+
const n = await I.get({
|
|
949
931
|
path: "/v1/competitions",
|
|
950
932
|
params: o,
|
|
951
933
|
config: t,
|
|
952
934
|
next: e?.next
|
|
953
|
-
}), s = n.data.map((
|
|
935
|
+
}), s = n.data.map((d) => d.id), i = new Set(s);
|
|
954
936
|
s.length !== i.size && console.warn("⚠️ API returned duplicate competitions!");
|
|
955
|
-
const r = Je(n.data), a = /* @__PURE__ */ new Set(),
|
|
956
|
-
return r.length !==
|
|
937
|
+
const r = Je(n.data), a = /* @__PURE__ */ new Set(), l = r.filter((d) => a.has(d.id) ? !1 : (a.add(d.id), !0));
|
|
938
|
+
return r.length !== l.length && console.warn(`Removed ${r.length - l.length} duplicate competitions`), l;
|
|
957
939
|
}
|
|
958
940
|
function Qe(e) {
|
|
959
941
|
return {
|
|
@@ -995,7 +977,7 @@ function Ze(e) {
|
|
|
995
977
|
async function Lt(e, t, o) {
|
|
996
978
|
const n = o || A(), s = {};
|
|
997
979
|
t?.lang && (s.lang = t.lang);
|
|
998
|
-
const i = await
|
|
980
|
+
const i = await I.get({
|
|
999
981
|
path: `/v1/competitions/${e}`,
|
|
1000
982
|
params: s,
|
|
1001
983
|
next: t?.next,
|
|
@@ -1051,10 +1033,10 @@ function et(e) {
|
|
|
1051
1033
|
function tt(e) {
|
|
1052
1034
|
return e.data.map(te);
|
|
1053
1035
|
}
|
|
1054
|
-
async function
|
|
1036
|
+
async function It(e, t, o) {
|
|
1055
1037
|
const n = o || A(), s = {};
|
|
1056
1038
|
t?.lang && (s.lang = t.lang);
|
|
1057
|
-
const i = await
|
|
1039
|
+
const i = await I.get({
|
|
1058
1040
|
path: `/v1/teams/${e}`,
|
|
1059
1041
|
params: s,
|
|
1060
1042
|
next: t?.next,
|
|
@@ -1062,10 +1044,10 @@ async function Dt(e, t, o) {
|
|
|
1062
1044
|
});
|
|
1063
1045
|
return et(i);
|
|
1064
1046
|
}
|
|
1065
|
-
async function
|
|
1047
|
+
async function Dt(e, t) {
|
|
1066
1048
|
const o = t || A(), n = {};
|
|
1067
1049
|
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);
|
|
1068
|
-
const s = await
|
|
1050
|
+
const s = await I.get({
|
|
1069
1051
|
path: "/v1/teams",
|
|
1070
1052
|
params: n,
|
|
1071
1053
|
next: e?.next,
|
|
@@ -1156,7 +1138,7 @@ function it(e) {
|
|
|
1156
1138
|
async function Gt(e, t, o) {
|
|
1157
1139
|
const n = o || A(), s = {};
|
|
1158
1140
|
t?.lang && (s.lang = t.lang);
|
|
1159
|
-
const i = await
|
|
1141
|
+
const i = await I.get({
|
|
1160
1142
|
path: `/v1/players/${e}`,
|
|
1161
1143
|
params: s,
|
|
1162
1144
|
next: t?.next,
|
|
@@ -1167,7 +1149,7 @@ async function Gt(e, t, o) {
|
|
|
1167
1149
|
async function bt(e, t) {
|
|
1168
1150
|
const o = t || A(), n = {};
|
|
1169
1151
|
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);
|
|
1170
|
-
const s = await
|
|
1152
|
+
const s = await I.get({
|
|
1171
1153
|
path: "/v1/players",
|
|
1172
1154
|
params: n,
|
|
1173
1155
|
next: e?.next,
|
|
@@ -1178,7 +1160,7 @@ async function bt(e, t) {
|
|
|
1178
1160
|
async function Pt(e, t, o) {
|
|
1179
1161
|
const n = o || A(), s = {};
|
|
1180
1162
|
t?.lang && (s.lang = t.lang);
|
|
1181
|
-
const i = await
|
|
1163
|
+
const i = await I.get({
|
|
1182
1164
|
path: `/v1/matches/${e}`,
|
|
1183
1165
|
params: s,
|
|
1184
1166
|
next: t?.next,
|
|
@@ -1189,7 +1171,7 @@ async function Pt(e, t, o) {
|
|
|
1189
1171
|
async function kt(e, t) {
|
|
1190
1172
|
const o = t || A(), n = {};
|
|
1191
1173
|
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");
|
|
1192
|
-
const s = await
|
|
1174
|
+
const s = await I.get({
|
|
1193
1175
|
path: "/v1/matches",
|
|
1194
1176
|
params: n,
|
|
1195
1177
|
next: e?.next,
|
|
@@ -1312,8 +1294,8 @@ async function Ht(e, t) {
|
|
|
1312
1294
|
return [];
|
|
1313
1295
|
const o = t || A(), n = {
|
|
1314
1296
|
q: e.query.trim()
|
|
1315
|
-
}, i = (e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["competition", "team", "player"]).map((
|
|
1316
|
-
switch (
|
|
1297
|
+
}, i = (e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["competition", "team", "player"]).map((l) => {
|
|
1298
|
+
switch (l) {
|
|
1317
1299
|
case "team":
|
|
1318
1300
|
return "teams";
|
|
1319
1301
|
case "player":
|
|
@@ -1321,25 +1303,25 @@ async function Ht(e, t) {
|
|
|
1321
1303
|
case "competition":
|
|
1322
1304
|
return "competitions";
|
|
1323
1305
|
default:
|
|
1324
|
-
return
|
|
1306
|
+
return l;
|
|
1325
1307
|
}
|
|
1326
1308
|
});
|
|
1327
1309
|
n.entities = i.join(","), e.lang && (n.lang = e.lang), e.limit && (n.limit = String(e.limit));
|
|
1328
|
-
const r = await
|
|
1310
|
+
const r = await I.get({
|
|
1329
1311
|
path: "/v1/search",
|
|
1330
1312
|
params: n,
|
|
1331
1313
|
next: e.next,
|
|
1332
1314
|
config: o
|
|
1333
1315
|
}), a = [];
|
|
1334
|
-
return r.data && (r.data.competitions && r.data.competitions.forEach((
|
|
1335
|
-
const
|
|
1336
|
-
|
|
1337
|
-
}), r.data.teams && r.data.teams.forEach((
|
|
1338
|
-
const
|
|
1339
|
-
|
|
1340
|
-
}), r.data.players && r.data.players.forEach((
|
|
1341
|
-
const
|
|
1342
|
-
|
|
1316
|
+
return r.data && (r.data.competitions && r.data.competitions.forEach((l) => {
|
|
1317
|
+
const d = j({ ...l, entity_type: "competition" });
|
|
1318
|
+
d && a.push(d);
|
|
1319
|
+
}), r.data.teams && r.data.teams.forEach((l) => {
|
|
1320
|
+
const d = j({ ...l, entity_type: "team" });
|
|
1321
|
+
d && a.push(d);
|
|
1322
|
+
}), r.data.players && r.data.players.forEach((l) => {
|
|
1323
|
+
const d = j({ ...l, entity_type: "player" });
|
|
1324
|
+
d && a.push(d);
|
|
1343
1325
|
})), a;
|
|
1344
1326
|
}
|
|
1345
1327
|
function Ut(e) {
|
|
@@ -1381,16 +1363,16 @@ function qt(e, t, o) {
|
|
|
1381
1363
|
const n = o.filter((r) => r.status.type === "FINISHED"), s = o.filter(
|
|
1382
1364
|
(r) => r.status.type === "NOT_STARTED" || r.status.type === "POSTPONED"
|
|
1383
1365
|
), i = t.entries.map((r) => {
|
|
1384
|
-
const a = r.competitor.id,
|
|
1366
|
+
const a = r.competitor.id, l = n.filter(
|
|
1385
1367
|
(m) => m.competitorOne.id === e && m.competitorTwo.id === a || m.competitorOne.id === a && m.competitorTwo.id === e
|
|
1386
|
-
),
|
|
1368
|
+
), d = s.filter(
|
|
1387
1369
|
(m) => m.competitorOne.id === e && m.competitorTwo.id === a || m.competitorOne.id === a && m.competitorTwo.id === e
|
|
1388
1370
|
);
|
|
1389
1371
|
let u, c;
|
|
1390
|
-
return
|
|
1391
|
-
const g = m.competitorOne.id === e, p = parseInt(m.score?.competitorOne ?? "0"), h = parseInt(m.score?.competitorTwo ?? "0"), F = g ? p : h,
|
|
1372
|
+
return l.forEach((m) => {
|
|
1373
|
+
const g = m.competitorOne.id === e, p = parseInt(m.score?.competitorOne ?? "0"), h = parseInt(m.score?.competitorTwo ?? "0"), F = g ? p : h, S = g ? h : p;
|
|
1392
1374
|
let O;
|
|
1393
|
-
F >
|
|
1375
|
+
F > S ? O = "W" : F === S ? O = "D" : O = "L";
|
|
1394
1376
|
const M = {
|
|
1395
1377
|
result: O,
|
|
1396
1378
|
score: `${p} - ${h}`,
|
|
@@ -1399,7 +1381,7 @@ function qt(e, t, o) {
|
|
|
1399
1381
|
isUpcoming: !1
|
|
1400
1382
|
};
|
|
1401
1383
|
g ? u = M : c = M;
|
|
1402
|
-
}),
|
|
1384
|
+
}), d.forEach((m) => {
|
|
1403
1385
|
const g = m.competitorOne.id === e;
|
|
1404
1386
|
g && !u ? u = {
|
|
1405
1387
|
date: m.timing.kickoffTime,
|
|
@@ -1477,8 +1459,8 @@ function Jt(e, t = 10) {
|
|
|
1477
1459
|
const n = o.seasonStatistics?.yellowCards ?? 0, s = o.seasonStatistics?.redCards ?? 0;
|
|
1478
1460
|
return n + s > 0;
|
|
1479
1461
|
}).sort((o, n) => {
|
|
1480
|
-
const s = o.seasonStatistics?.yellowCards ?? 0, i = o.seasonStatistics?.redCards ?? 0, r = n.seasonStatistics?.yellowCards ?? 0, a = n.seasonStatistics?.redCards ?? 0,
|
|
1481
|
-
return
|
|
1462
|
+
const s = o.seasonStatistics?.yellowCards ?? 0, i = o.seasonStatistics?.redCards ?? 0, r = n.seasonStatistics?.yellowCards ?? 0, a = n.seasonStatistics?.redCards ?? 0, l = s + i * 3, d = r + a * 3;
|
|
1463
|
+
return d !== l ? d - l : a !== i ? a - i : r - s;
|
|
1482
1464
|
}).slice(0, t);
|
|
1483
1465
|
}
|
|
1484
1466
|
function P(e) {
|
|
@@ -1537,8 +1519,8 @@ function lt(e, t = 10) {
|
|
|
1537
1519
|
const r = s.goals ?? 0, a = i.goals ?? 0;
|
|
1538
1520
|
if (a !== r)
|
|
1539
1521
|
return a - r;
|
|
1540
|
-
const
|
|
1541
|
-
return (i.assists ?? 0) -
|
|
1522
|
+
const l = s.assists ?? 0;
|
|
1523
|
+
return (i.assists ?? 0) - l;
|
|
1542
1524
|
}).slice(0, t);
|
|
1543
1525
|
}
|
|
1544
1526
|
function dt(e, t = 10) {
|
|
@@ -1547,8 +1529,8 @@ function dt(e, t = 10) {
|
|
|
1547
1529
|
const r = s.assists ?? 0, a = i.assists ?? 0;
|
|
1548
1530
|
if (a !== r)
|
|
1549
1531
|
return a - r;
|
|
1550
|
-
const
|
|
1551
|
-
return (i.goals ?? 0) -
|
|
1532
|
+
const l = s.goals ?? 0;
|
|
1533
|
+
return (i.goals ?? 0) - l;
|
|
1552
1534
|
}).slice(0, t);
|
|
1553
1535
|
}
|
|
1554
1536
|
function ut(e, t = 10) {
|
|
@@ -1557,9 +1539,9 @@ function ut(e, t = 10) {
|
|
|
1557
1539
|
const r = (s.yellowCards ?? 0) + (s.redCards ?? 0) * 3, a = (i.yellowCards ?? 0) + (i.redCards ?? 0) * 3;
|
|
1558
1540
|
if (a !== r)
|
|
1559
1541
|
return a - r;
|
|
1560
|
-
const
|
|
1561
|
-
if (
|
|
1562
|
-
return
|
|
1542
|
+
const l = s.redCards ?? 0, d = i.redCards ?? 0;
|
|
1543
|
+
if (d !== l)
|
|
1544
|
+
return d - l;
|
|
1563
1545
|
const u = s.yellowCards ?? 0;
|
|
1564
1546
|
return (i.yellowCards ?? 0) - u;
|
|
1565
1547
|
}).slice(0, t);
|
|
@@ -1570,9 +1552,9 @@ function mt(e, t = 10) {
|
|
|
1570
1552
|
const r = (s.goals ?? 0) + (s.assists ?? 0), a = (i.goals ?? 0) + (i.assists ?? 0);
|
|
1571
1553
|
if (a !== r)
|
|
1572
1554
|
return a - r;
|
|
1573
|
-
const
|
|
1574
|
-
if (
|
|
1575
|
-
return
|
|
1555
|
+
const l = s.goals ?? 0, d = i.goals ?? 0;
|
|
1556
|
+
if (d !== l)
|
|
1557
|
+
return d - l;
|
|
1576
1558
|
const u = s.assists ?? 0;
|
|
1577
1559
|
return (i.assists ?? 0) - u;
|
|
1578
1560
|
}).slice(0, t);
|
|
@@ -1636,11 +1618,11 @@ function io(e) {
|
|
|
1636
1618
|
function yt(e, t, o) {
|
|
1637
1619
|
if (e.status?.type !== "FINISHED" || !e.score) return null;
|
|
1638
1620
|
const n = parseInt(e.score.competitorOne || "0"), s = parseInt(e.score.competitorTwo || "0"), i = o ? n : s, r = o ? s : n;
|
|
1639
|
-
let a = null,
|
|
1640
|
-
const
|
|
1641
|
-
if (
|
|
1642
|
-
const g = parseInt(
|
|
1643
|
-
a = o ? g : p,
|
|
1621
|
+
let a = null, l = null;
|
|
1622
|
+
const d = e.score.breakdown?.halfTime;
|
|
1623
|
+
if (d) {
|
|
1624
|
+
const g = parseInt(d.competitorOne || "0"), p = parseInt(d.competitorTwo || "0");
|
|
1625
|
+
a = o ? g : p, l = o ? p : g;
|
|
1644
1626
|
}
|
|
1645
1627
|
const u = e.statistics;
|
|
1646
1628
|
let c = null, m = null;
|
|
@@ -1652,7 +1634,7 @@ function yt(e, t, o) {
|
|
|
1652
1634
|
goalsFor: i,
|
|
1653
1635
|
goalsAgainst: r,
|
|
1654
1636
|
halfTimeGoalsFor: a,
|
|
1655
|
-
halfTimeGoalsAgainst:
|
|
1637
|
+
halfTimeGoalsAgainst: l,
|
|
1656
1638
|
cornersFor: c,
|
|
1657
1639
|
cornersAgainst: m,
|
|
1658
1640
|
isWin: i > r,
|
|
@@ -1686,24 +1668,24 @@ function uo(e, t, o) {
|
|
|
1686
1668
|
const c = u.competitorOne.id === t || u.competitorTwo.id === t, m = u.competitorOne.id === o || u.competitorTwo.id === o;
|
|
1687
1669
|
return c && m;
|
|
1688
1670
|
});
|
|
1689
|
-
let s = 0, i = 0, r = 0, a = 0,
|
|
1671
|
+
let s = 0, i = 0, r = 0, a = 0, l = 0;
|
|
1690
1672
|
n.forEach((u) => {
|
|
1691
1673
|
const c = parseInt(u.score?.competitorOne || "0"), m = parseInt(u.score?.competitorTwo || "0"), g = u.competitorOne.id === t, p = g ? c : m, h = g ? m : c;
|
|
1692
|
-
a += p,
|
|
1674
|
+
a += p, l += h, p > h ? s++ : h > p ? i++ : r++;
|
|
1693
1675
|
});
|
|
1694
|
-
const
|
|
1676
|
+
const d = n.length;
|
|
1695
1677
|
return {
|
|
1696
|
-
totalMatches:
|
|
1678
|
+
totalMatches: d,
|
|
1697
1679
|
homeTeamWins: s,
|
|
1698
1680
|
awayTeamWins: i,
|
|
1699
1681
|
draws: r,
|
|
1700
1682
|
homeTeamGoals: a,
|
|
1701
|
-
awayTeamGoals:
|
|
1702
|
-
homeTeamWinPercentage:
|
|
1703
|
-
awayTeamWinPercentage:
|
|
1704
|
-
drawPercentage:
|
|
1705
|
-
homeTeamAvgGoals:
|
|
1706
|
-
awayTeamAvgGoals:
|
|
1683
|
+
awayTeamGoals: l,
|
|
1684
|
+
homeTeamWinPercentage: d > 0 ? s / d * 100 : 0,
|
|
1685
|
+
awayTeamWinPercentage: d > 0 ? i / d * 100 : 0,
|
|
1686
|
+
drawPercentage: d > 0 ? r / d * 100 : 0,
|
|
1687
|
+
homeTeamAvgGoals: d > 0 ? a / d : 0,
|
|
1688
|
+
awayTeamAvgGoals: d > 0 ? l / d : 0
|
|
1707
1689
|
};
|
|
1708
1690
|
}
|
|
1709
1691
|
function mo(e, t, o, n = 5) {
|
|
@@ -1712,9 +1694,9 @@ function mo(e, t, o, n = 5) {
|
|
|
1712
1694
|
const r = i.competitorOne.id === t || i.competitorTwo.id === t, a = i.competitorOne.id === o || i.competitorTwo.id === o;
|
|
1713
1695
|
return r && a;
|
|
1714
1696
|
}).sort((i, r) => new Date(r.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()).slice(0, n).map((i) => {
|
|
1715
|
-
const r = parseInt(i.score?.competitorOne || "0"), a = parseInt(i.score?.competitorTwo || "0"),
|
|
1697
|
+
const r = parseInt(i.score?.competitorOne || "0"), a = parseInt(i.score?.competitorTwo || "0"), l = i.competitorOne.id === t, d = l ? r : a, u = l ? a : r;
|
|
1716
1698
|
let c;
|
|
1717
|
-
return
|
|
1699
|
+
return d > u ? c = "home" : u > d ? c = "away" : c = "draw", {
|
|
1718
1700
|
id: i.id,
|
|
1719
1701
|
date: new Date(i.timing.kickoffTime).toLocaleDateString("en-GB", {
|
|
1720
1702
|
day: "numeric",
|
|
@@ -1746,14 +1728,14 @@ function Z(e, t, o, n) {
|
|
|
1746
1728
|
for (const i of e) {
|
|
1747
1729
|
const r = i.competitorOne.id === t, a = i.competitorTwo.id === t;
|
|
1748
1730
|
if (!r && !a || o === "home" && !r || o === "away" && !a || i.status?.type !== "FINISHED") continue;
|
|
1749
|
-
const
|
|
1750
|
-
if (!
|
|
1751
|
-
const
|
|
1752
|
-
const F = p.minute ?? 0,
|
|
1753
|
-
return F !==
|
|
1731
|
+
const l = i.mainEvents;
|
|
1732
|
+
if (!l || !Array.isArray(l)) continue;
|
|
1733
|
+
const d = l.filter((p) => p.type && pt.includes(p.type)).sort((p, h) => {
|
|
1734
|
+
const F = p.minute ?? 0, S = h.minute ?? 0;
|
|
1735
|
+
return F !== S ? F - S : (p.injuryMinute ?? 0) - (h.injuryMinute ?? 0);
|
|
1754
1736
|
});
|
|
1755
|
-
if (
|
|
1756
|
-
const u =
|
|
1737
|
+
if (d.length === 0) continue;
|
|
1738
|
+
const u = d[0], c = r ? "ONE" : "TWO", m = u.type === "OWN_GOAL";
|
|
1757
1739
|
let g;
|
|
1758
1740
|
m ? g = u.competitorPosition !== c : g = u.competitorPosition === c, (n === "scored" && g || n === "conceded" && !g) && s++;
|
|
1759
1741
|
}
|
|
@@ -1791,10 +1773,10 @@ function fo(e, t, o) {
|
|
|
1791
1773
|
avgCornersFor: 0,
|
|
1792
1774
|
avgCornersAgainst: 0
|
|
1793
1775
|
};
|
|
1794
|
-
const i = n.reduce((f, v) => f + v.goalsFor, 0), r = n.reduce((f, v) => f + v.goalsAgainst, 0), a = n.filter((f) => f.goalsAgainst === 0).length,
|
|
1776
|
+
const i = n.reduce((f, v) => f + v.goalsFor, 0), r = n.reduce((f, v) => f + v.goalsAgainst, 0), a = n.filter((f) => f.goalsAgainst === 0).length, l = 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, c = n.filter((f) => f.isLoss && f.goalsFor === 0).length, m = n.filter((f) => f.goalsAgainst > 0).length, g = n.filter((f) => f.halfTimeGoalsFor !== null), p = g.length, h = g.filter((f) => {
|
|
1795
1777
|
const v = f.halfTimeGoalsFor, k = f.goalsFor - v;
|
|
1796
1778
|
return v > 0 && k > 0;
|
|
1797
|
-
}).length, F = Z(e, t, o, "scored"),
|
|
1779
|
+
}).length, F = Z(e, t, o, "scored"), S = vt(e, t, o), O = g.filter((f) => f.halfTimeGoalsFor > f.halfTimeGoalsAgainst).length, M = g.filter((f) => {
|
|
1798
1780
|
const v = f.halfTimeGoalsAgainst, k = f.goalsAgainst - v;
|
|
1799
1781
|
return v > 0 && k > 0;
|
|
1800
1782
|
}).length, U = Z(e, t, o, "conceded"), B = g.filter((f) => f.halfTimeGoalsAgainst > f.halfTimeGoalsFor).length, b = n.filter((f) => f.cornersFor !== null), $ = b.reduce((f, v) => f + (v.cornersFor || 0), 0), x = b.reduce((f, v) => f + (v.cornersAgainst || 0), 0);
|
|
@@ -1802,43 +1784,43 @@ function fo(e, t, o) {
|
|
|
1802
1784
|
played: s,
|
|
1803
1785
|
goalsForPerMatch: W(i, s),
|
|
1804
1786
|
cleanSheets: N(a, s),
|
|
1805
|
-
wonToNil: N(
|
|
1806
|
-
scoringRate: N(
|
|
1787
|
+
wonToNil: N(l, s),
|
|
1788
|
+
scoringRate: N(d, s),
|
|
1807
1789
|
scoredInBothHalves: N(h, p),
|
|
1808
|
-
scoredFirst: N(F,
|
|
1790
|
+
scoredFirst: N(F, S),
|
|
1809
1791
|
leadingAtHalfTime: N(O, p),
|
|
1810
1792
|
goalsAgainstPerMatch: W(r, s),
|
|
1811
1793
|
failedToScore: N(u, s),
|
|
1812
1794
|
lostToNil: N(c, s),
|
|
1813
1795
|
concedingRate: N(m, s),
|
|
1814
1796
|
concededInBothHalves: N(M, p),
|
|
1815
|
-
concededFirst: N(U,
|
|
1797
|
+
concededFirst: N(U, S),
|
|
1816
1798
|
losingAtHalfTime: N(B, p),
|
|
1817
1799
|
avgCornersFor: W($, b.length),
|
|
1818
1800
|
avgCornersAgainst: W(x, b.length)
|
|
1819
1801
|
};
|
|
1820
1802
|
}
|
|
1821
|
-
function
|
|
1803
|
+
function _t(e, t) {
|
|
1822
1804
|
return e.filter((o) => o.status?.type !== "FINISHED" ? !1 : o.competitorOne.id === t || o.competitorTwo.id === t).map((o) => {
|
|
1823
1805
|
const n = o.competitorOne.id === t, s = parseInt(o.score?.competitorOne || "0"), i = parseInt(o.score?.competitorTwo || "0"), r = s + i, a = o.periods;
|
|
1824
|
-
let
|
|
1806
|
+
let l = null;
|
|
1825
1807
|
if (a && Array.isArray(a)) {
|
|
1826
|
-
const
|
|
1808
|
+
const d = a.find(
|
|
1827
1809
|
(u) => u.type === "FIRST_HALF" || u.type === "1ST_HALF"
|
|
1828
1810
|
);
|
|
1829
|
-
if (
|
|
1830
|
-
const u = parseInt(
|
|
1831
|
-
|
|
1811
|
+
if (d?.score) {
|
|
1812
|
+
const u = parseInt(d.score.competitorOne || "0"), c = parseInt(d.score.competitorTwo || "0");
|
|
1813
|
+
l = u + c;
|
|
1832
1814
|
}
|
|
1833
1815
|
}
|
|
1834
|
-
return { totalGoals: r, halfTimeGoals:
|
|
1816
|
+
return { totalGoals: r, halfTimeGoals: l, isHome: n };
|
|
1835
1817
|
});
|
|
1836
1818
|
}
|
|
1837
1819
|
function y(e, t) {
|
|
1838
1820
|
return e.length === 0 ? 0 : e.filter((n) => n > t).length / e.length * 100;
|
|
1839
1821
|
}
|
|
1840
1822
|
function go(e, t) {
|
|
1841
|
-
const o =
|
|
1823
|
+
const o = _t(e, t), n = o.filter((c) => c.isHome), s = o.filter((c) => !c.isHome), i = o.map((c) => c.totalGoals), r = n.map((c) => c.totalGoals), a = s.map((c) => c.totalGoals), l = o.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals), d = n.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals), u = s.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals);
|
|
1842
1824
|
return {
|
|
1843
1825
|
over05: {
|
|
1844
1826
|
home: y(r, 0.5),
|
|
@@ -1871,23 +1853,23 @@ function go(e, t) {
|
|
|
1871
1853
|
away: y(a, 5.5)
|
|
1872
1854
|
},
|
|
1873
1855
|
over05HT: {
|
|
1874
|
-
home: y(
|
|
1875
|
-
total: y(
|
|
1856
|
+
home: y(d, 0.5),
|
|
1857
|
+
total: y(l, 0.5),
|
|
1876
1858
|
away: y(u, 0.5)
|
|
1877
1859
|
},
|
|
1878
1860
|
over15HT: {
|
|
1879
|
-
home: y(
|
|
1880
|
-
total: y(
|
|
1861
|
+
home: y(d, 1.5),
|
|
1862
|
+
total: y(l, 1.5),
|
|
1881
1863
|
away: y(u, 1.5)
|
|
1882
1864
|
},
|
|
1883
1865
|
over25HT: {
|
|
1884
|
-
home: y(
|
|
1885
|
-
total: y(
|
|
1866
|
+
home: y(d, 2.5),
|
|
1867
|
+
total: y(l, 2.5),
|
|
1886
1868
|
away: y(u, 2.5)
|
|
1887
1869
|
}
|
|
1888
1870
|
};
|
|
1889
1871
|
}
|
|
1890
|
-
function
|
|
1872
|
+
function St(e, t) {
|
|
1891
1873
|
const o = e.competitorOne.id === t, n = e.competitorTwo.id === t;
|
|
1892
1874
|
if (!o && !n || !e.score) return null;
|
|
1893
1875
|
const s = parseInt(o ? e.score.competitorOne || "0" : e.score.competitorTwo || "0"), i = parseInt(o ? e.score.competitorTwo || "0" : e.score.competitorOne || "0");
|
|
@@ -1898,14 +1880,14 @@ function _t(e, t) {
|
|
|
1898
1880
|
};
|
|
1899
1881
|
}
|
|
1900
1882
|
function po(e, t, o, n, s, i) {
|
|
1901
|
-
const r = t?.entries.find((L) => L.competitor.id === e), a = o?.entries.find((L) => L.competitor.id === e),
|
|
1883
|
+
const r = t?.entries.find((L) => L.competitor.id === e), a = o?.entries.find((L) => L.competitor.id === e), l = n?.entries.find((L) => L.competitor.id === e), d = s?.entries.find((L) => L.competitor.id === e), u = i?.entries.find((L) => L.competitor.id === e);
|
|
1902
1884
|
if (!r) return null;
|
|
1903
|
-
const c = a?.stats?.goalsFor ?? 0, m =
|
|
1885
|
+
const c = a?.stats?.goalsFor ?? 0, m = l?.stats?.goalsFor ?? 0, g = r?.stats?.goalsFor ?? 0, p = d?.stats?.goalsAgainst ?? 0, h = u?.stats?.goalsAgainst ?? 0, F = r?.stats?.goalsAgainst ?? 0, S = a?.stats?.played ?? 0, O = l?.stats?.played ?? 0, M = r?.stats?.played ?? 0, U = M > 0 ? g / M : 0, B = M > 0 ? F / M : 0, b = U + B, $ = S > 0 ? c / S : 0, x = O > 0 ? m / O : 0, f = S > 0 ? p / S : 0, v = O > 0 ? h / O : 0, k = $ + f, ne = x + v;
|
|
1904
1886
|
return {
|
|
1905
1887
|
homeGoals: c,
|
|
1906
1888
|
totalGoals: g,
|
|
1907
1889
|
awayGoals: m,
|
|
1908
|
-
homeGamesPlayed:
|
|
1890
|
+
homeGamesPlayed: S,
|
|
1909
1891
|
awayGamesPlayed: O,
|
|
1910
1892
|
totalGamesPlayed: M,
|
|
1911
1893
|
homeGoalsConceded: p,
|
|
@@ -1924,8 +1906,8 @@ function po(e, t, o, n, s, i) {
|
|
|
1924
1906
|
}
|
|
1925
1907
|
function C(e, t, o, n) {
|
|
1926
1908
|
const s = e.filter((r) => {
|
|
1927
|
-
const a = r.competitorOne.id === t,
|
|
1928
|
-
return !(!a && !
|
|
1909
|
+
const a = r.competitorOne.id === t, l = r.competitorTwo.id === t;
|
|
1910
|
+
return !(!a && !l || r.status?.type !== "FINISHED" || n === "home" && !a || n === "away" && !l);
|
|
1929
1911
|
}).sort((r, a) => new Date(a.timing.kickoffTime).getTime() - new Date(r.timing.kickoffTime).getTime());
|
|
1930
1912
|
if (s.length === 0) return null;
|
|
1931
1913
|
let i = 0;
|
|
@@ -2071,7 +2053,7 @@ function w(e, t) {
|
|
|
2071
2053
|
const o = /* @__PURE__ */ new Map();
|
|
2072
2054
|
return e.forEach((n) => {
|
|
2073
2055
|
if (n.status?.type !== "FINISHED") return;
|
|
2074
|
-
const s =
|
|
2056
|
+
const s = St(n, t);
|
|
2075
2057
|
if (!s) return;
|
|
2076
2058
|
const i = s.isHome ? n.competitorTwo.id : n.competitorOne.id, r = s.isHome ? n.competitorTwo : n.competitorOne, a = o.get(i) || {
|
|
2077
2059
|
opponentId: i,
|
|
@@ -2082,16 +2064,16 @@ function w(e, t) {
|
|
|
2082
2064
|
}), o;
|
|
2083
2065
|
}
|
|
2084
2066
|
function ho(e, t, o, n, s, i, r) {
|
|
2085
|
-
const a = w(e, t),
|
|
2067
|
+
const a = w(e, t), l = w(e, o), d = /* @__PURE__ */ new Set([
|
|
2086
2068
|
...a.keys(),
|
|
2087
|
-
...
|
|
2069
|
+
...l.keys(),
|
|
2088
2070
|
t,
|
|
2089
2071
|
// Include home team as row for away team results
|
|
2090
2072
|
o
|
|
2091
2073
|
// Include away team as row for home team results
|
|
2092
2074
|
]), u = [];
|
|
2093
|
-
return
|
|
2094
|
-
const m = a.get(c), g =
|
|
2075
|
+
return d.forEach((c) => {
|
|
2076
|
+
const m = a.get(c), g = l.get(c);
|
|
2095
2077
|
if (!m && !g && c !== t && c !== o)
|
|
2096
2078
|
return;
|
|
2097
2079
|
let p, h;
|
|
@@ -2110,7 +2092,7 @@ function ho(e, t, o, n, s, i, r) {
|
|
|
2110
2092
|
}
|
|
2111
2093
|
export {
|
|
2112
2094
|
pt as GOAL_EVENT_TYPES,
|
|
2113
|
-
|
|
2095
|
+
_o as addProviderRef,
|
|
2114
2096
|
P as aggregatePlayerStatisticsFromMatches,
|
|
2115
2097
|
yt as analyzeMatch,
|
|
2116
2098
|
W as calcAverage,
|
|
@@ -2124,7 +2106,7 @@ export {
|
|
|
2124
2106
|
Ut as getActiveSeason,
|
|
2125
2107
|
ft as getAllPlayerStatisticsFromMatches,
|
|
2126
2108
|
Nt as getBasketballLivescore,
|
|
2127
|
-
|
|
2109
|
+
So as getBatchMatchOdds,
|
|
2128
2110
|
A as getConfig,
|
|
2129
2111
|
Lt as getFansUnitedFootballCompetition,
|
|
2130
2112
|
Mt as getFansUnitedFootballCompetitions,
|
|
@@ -2133,26 +2115,26 @@ export {
|
|
|
2133
2115
|
Gt as getFansUnitedFootballPlayer,
|
|
2134
2116
|
bt as getFansUnitedFootballPlayers,
|
|
2135
2117
|
Ht as getFansUnitedFootballSearch,
|
|
2136
|
-
|
|
2137
|
-
|
|
2118
|
+
It as getFansUnitedFootballTeam,
|
|
2119
|
+
Dt as getFansUnitedFootballTeams,
|
|
2138
2120
|
Co as getFootballCompetition,
|
|
2139
2121
|
Ao as getFootballLivescore,
|
|
2140
2122
|
Oo as getFootballMatch,
|
|
2141
2123
|
No as getFootballMatchCommentary,
|
|
2142
|
-
|
|
2143
|
-
|
|
2124
|
+
Ro as getFootballMatchEvents,
|
|
2125
|
+
Eo as getFootballMatchLineups,
|
|
2144
2126
|
Fo as getFootballMatchOdds,
|
|
2145
2127
|
Mo as getFootballMatchStatistics,
|
|
2146
2128
|
Lo as getFootballMatches,
|
|
2147
|
-
|
|
2148
|
-
|
|
2129
|
+
Io as getFootballPlayerSeasonStatistics,
|
|
2130
|
+
Do as getFootballSeasonDetails,
|
|
2149
2131
|
Go as getFootballStandings,
|
|
2150
2132
|
bo as getFootballTeam,
|
|
2151
2133
|
Po as getFootballTeamSquad,
|
|
2152
2134
|
ko as getLeaderboardMatches,
|
|
2153
2135
|
Ho as getLeaderboardTeamMatches,
|
|
2154
2136
|
Uo as getLeaderboardTemplate,
|
|
2155
|
-
|
|
2137
|
+
St as getMatchResult,
|
|
2156
2138
|
ut as getMostCardedPlayersFromMatches,
|
|
2157
2139
|
lo as getOpponentScore,
|
|
2158
2140
|
Bo as getProviderRefId,
|
|
@@ -2176,7 +2158,7 @@ export {
|
|
|
2176
2158
|
Vt as getTeamTopScorers,
|
|
2177
2159
|
xt as getTeamUpcomingMatches,
|
|
2178
2160
|
ho as getTeamsCommonOpponents,
|
|
2179
|
-
|
|
2161
|
+
Rt as getTennisLivescore,
|
|
2180
2162
|
dt as getTopAssistersFromMatches,
|
|
2181
2163
|
mt as getTopGoalContributorsFromMatches,
|
|
2182
2164
|
lt as getTopScorersFromMatches,
|
|
@@ -2185,11 +2167,11 @@ export {
|
|
|
2185
2167
|
ht as isTeamAway,
|
|
2186
2168
|
J as isTeamHome,
|
|
2187
2169
|
ro as isTeamInMatch,
|
|
2188
|
-
|
|
2170
|
+
Et as search,
|
|
2189
2171
|
Ot as searchFootball,
|
|
2190
2172
|
xo as setConfig,
|
|
2191
2173
|
T as streakFilters,
|
|
2192
|
-
|
|
2174
|
+
_ as toProviderRefArray,
|
|
2193
2175
|
eo as useAllPlayerStatisticsFromMatches,
|
|
2194
2176
|
Zt as useMostCardedPlayersFromMatches,
|
|
2195
2177
|
to as usePlayerStatistics,
|