fansunited-data-layer 0.13.0 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/fansunited/constants.js +5 -0
- package/api/fansunited/constants.js.map +1 -0
- package/api/fansunited/football/competition/index.js +21 -0
- package/api/fansunited/football/competition/index.js.map +1 -0
- package/api/fansunited/football/competition/transformer.js +41 -0
- package/api/fansunited/football/competition/transformer.js.map +1 -0
- package/api/fansunited/football/competitions/index.js +56 -0
- package/api/fansunited/football/competitions/index.js.map +1 -0
- package/api/fansunited/football/competitions/transformer.js +68 -0
- package/api/fansunited/football/competitions/transformer.js.map +1 -0
- package/api/fansunited/football/http.js +7 -0
- package/api/fansunited/football/http.js.map +1 -0
- package/api/fansunited/football/matches/index.js +132 -0
- package/api/fansunited/football/matches/index.js.map +1 -0
- package/api/fansunited/football/matches/transformer.js +148 -0
- package/api/fansunited/football/matches/transformer.js.map +1 -0
- package/api/fansunited/football/players/index.js +60 -0
- package/api/fansunited/football/players/index.js.map +1 -0
- package/api/fansunited/football/players/transformer.js +85 -0
- package/api/fansunited/football/players/transformer.js.map +1 -0
- package/api/fansunited/football/search/index.js +64 -0
- package/api/fansunited/football/search/index.js.map +1 -0
- package/api/fansunited/football/search/transformer.js +114 -0
- package/api/fansunited/football/search/transformer.js.map +1 -0
- package/api/fansunited/football/teams/index.js +66 -0
- package/api/fansunited/football/teams/index.js.map +1 -0
- package/api/fansunited/football/teams/transformer.js +53 -0
- package/api/fansunited/football/teams/transformer.js.map +1 -0
- package/api/fansunited/http.d.ts.map +1 -1
- package/api/fansunited/http.js +70 -0
- package/api/fansunited/http.js.map +1 -0
- package/api/fansunited/search/constants.js +5 -0
- package/api/fansunited/search/constants.js.map +1 -0
- package/api/fansunited/search/http.js +7 -0
- package/api/fansunited/search/http.js.map +1 -0
- package/api/fansunited/search/index.js +308 -0
- package/api/fansunited/search/index.js.map +1 -0
- package/api/fansunited/search/transformer.js +374 -0
- package/api/fansunited/search/transformer.js.map +1 -0
- package/api/fansunited-sdk/loyalty/matches.js +21 -0
- package/api/fansunited-sdk/loyalty/matches.js.map +1 -0
- package/api/fansunited-sdk/loyalty/template.js +52 -0
- package/api/fansunited-sdk/loyalty/template.js.map +1 -0
- package/api/fansunited-sdk/odds/matches.js +109 -0
- package/api/fansunited-sdk/odds/matches.js.map +1 -0
- package/api/sportal365-sports/basketball/games/index.js +32 -0
- package/api/sportal365-sports/basketball/games/index.js.map +1 -0
- package/api/sportal365-sports/basketball/games/transformers/game.js +137 -0
- package/api/sportal365-sports/basketball/games/transformers/game.js.map +1 -0
- package/api/sportal365-sports/basketball/http.js +7 -0
- package/api/sportal365-sports/basketball/http.js.map +1 -0
- package/api/sportal365-sports/constants.js +15 -0
- package/api/sportal365-sports/constants.js.map +1 -0
- package/api/sportal365-sports/football/competitions/index.js +52 -0
- package/api/sportal365-sports/football/competitions/index.js.map +1 -0
- package/api/sportal365-sports/football/competitions/utils.js +92 -0
- package/api/sportal365-sports/football/competitions/utils.js.map +1 -0
- package/api/sportal365-sports/football/http.js +7 -0
- package/api/sportal365-sports/football/http.js.map +1 -0
- package/api/sportal365-sports/football/matches/index.js +206 -0
- package/api/sportal365-sports/football/matches/index.js.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/commentary.js +27 -0
- package/api/sportal365-sports/football/matches/transformers/commentary.js.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/lineup.js +74 -0
- package/api/sportal365-sports/football/matches/transformers/lineup.js.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/match-event.js +60 -0
- package/api/sportal365-sports/football/matches/transformers/match-event.js.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/match.js +195 -0
- package/api/sportal365-sports/football/matches/transformers/match.js.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/odds.js +11 -0
- package/api/sportal365-sports/football/matches/transformers/odds.js.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/statistics.js +41 -0
- package/api/sportal365-sports/football/matches/transformers/statistics.js.map +1 -0
- package/api/sportal365-sports/football/search/index.js +42 -0
- package/api/sportal365-sports/football/search/index.js.map +1 -0
- package/api/sportal365-sports/football/search/search.transformer.js +166 -0
- package/api/sportal365-sports/football/search/search.transformer.js.map +1 -0
- package/api/sportal365-sports/football/standings/index.js +28 -0
- package/api/sportal365-sports/football/standings/index.js.map +1 -0
- package/api/sportal365-sports/football/standings/standing.transformer.js +107 -0
- package/api/sportal365-sports/football/standings/standing.transformer.js.map +1 -0
- package/api/sportal365-sports/football/statistics/index.js +154 -0
- package/api/sportal365-sports/football/statistics/index.js.map +1 -0
- package/api/sportal365-sports/football/statistics/player-career.transformer.js +77 -0
- package/api/sportal365-sports/football/statistics/player-career.transformer.js.map +1 -0
- package/api/sportal365-sports/football/statistics/player-recent.transformer.js +54 -0
- package/api/sportal365-sports/football/statistics/player-recent.transformer.js.map +1 -0
- package/api/sportal365-sports/football/statistics/player-season.transformer.js +147 -0
- package/api/sportal365-sports/football/statistics/player-season.transformer.js.map +1 -0
- package/api/sportal365-sports/football/teams/index.js +73 -0
- package/api/sportal365-sports/football/teams/index.js.map +1 -0
- package/api/sportal365-sports/football/teams/utils.js +196 -0
- package/api/sportal365-sports/football/teams/utils.js.map +1 -0
- package/api/sportal365-sports/http.js +58 -0
- package/api/sportal365-sports/http.js.map +1 -0
- package/api/sportal365-sports/search/http.js +7 -0
- package/api/sportal365-sports/search/http.js.map +1 -0
- package/api/sportal365-sports/search/index.js +61 -0
- package/api/sportal365-sports/search/index.js.map +1 -0
- package/api/sportal365-sports/search/search.transformer.js +254 -0
- package/api/sportal365-sports/search/search.transformer.js.map +1 -0
- package/api/sportal365-sports/shared/odds.transformer.js +65 -0
- package/api/sportal365-sports/shared/odds.transformer.js.map +1 -0
- package/api/sportal365-sports/shared/providerRef.helper.js +31 -0
- package/api/sportal365-sports/shared/providerRef.helper.js.map +1 -0
- package/api/sportal365-sports/standings/http.js +7 -0
- package/api/sportal365-sports/standings/http.js.map +1 -0
- package/api/sportal365-sports/standings/index.js +29 -0
- package/api/sportal365-sports/standings/index.js.map +1 -0
- package/api/sportal365-sports/standings/standing.transformer.js +185 -0
- package/api/sportal365-sports/standings/standing.transformer.js.map +1 -0
- package/api/sportal365-sports/statistics/http.js +7 -0
- package/api/sportal365-sports/statistics/http.js.map +1 -0
- package/api/sportal365-sports/statistics/index.js +25 -0
- package/api/sportal365-sports/statistics/index.js.map +1 -0
- package/api/sportal365-sports/statistics/team-stats.transformer.js +16 -0
- package/api/sportal365-sports/statistics/team-stats.transformer.js.map +1 -0
- package/api/sportal365-sports/tennis/http.js +7 -0
- package/api/sportal365-sports/tennis/http.js.map +1 -0
- package/api/sportal365-sports/tennis/matches/index.js +34 -0
- package/api/sportal365-sports/tennis/matches/index.js.map +1 -0
- package/api/sportal365-sports/tennis/matches/transformers/match.js +193 -0
- package/api/sportal365-sports/tennis/matches/transformers/match.js.map +1 -0
- package/cache/cache-manager.js +136 -0
- package/cache/cache-manager.js.map +1 -0
- package/cache/memory-store.js +29 -0
- package/cache/memory-store.js.map +1 -0
- package/client.js +38 -12337
- package/client.js.map +1 -0
- package/config/index.js +20 -0
- package/config/index.js.map +1 -0
- package/fansunited-data-layer.js +146 -3553
- package/fansunited-data-layer.js.map +1 -0
- package/helpers/competition.helpers.js +11 -0
- package/helpers/competition.helpers.js.map +1 -0
- package/helpers/player.helpers.js +165 -0
- package/helpers/player.helpers.js.map +1 -0
- package/helpers/player.hooks.js +34 -0
- package/helpers/player.hooks.js.map +1 -0
- package/helpers/team.helpers.js +216 -0
- package/helpers/team.helpers.js.map +1 -0
- package/package.json +6 -8
- package/providers/competition/hooks/useCompetitionStats.js +10 -0
- package/providers/competition/hooks/useCompetitionStats.js.map +1 -0
- package/providers/competition/hooks/useGoalDistribution.js +23 -0
- package/providers/competition/hooks/useGoalDistribution.js.map +1 -0
- package/providers/competition/hooks/useMatchHelpers.js +85 -0
- package/providers/competition/hooks/useMatchHelpers.js.map +1 -0
- package/providers/competition/hooks/useStandingsCalculations.js +89 -0
- package/providers/competition/hooks/useStandingsCalculations.js.map +1 -0
- package/providers/competition/hooks/useStandingsHelpers.js +61 -0
- package/providers/competition/hooks/useStandingsHelpers.js.map +1 -0
- package/providers/competition/hooks/useTeamPosition.js +15 -0
- package/providers/competition/hooks/useTeamPosition.js.map +1 -0
- package/providers/competition/hooks/useTeamResultsTable.js +86 -0
- package/providers/competition/hooks/useTeamResultsTable.js.map +1 -0
- package/providers/competition/utils/competitionStats.js +109 -0
- package/providers/competition/utils/competitionStats.js.map +1 -0
- package/providers/competition/utils/goalDistribution.js +64 -0
- package/providers/competition/utils/goalDistribution.js.map +1 -0
- package/providers/competition/utils/standingsCalculations.js +152 -0
- package/providers/competition/utils/standingsCalculations.js.map +1 -0
- package/providers/competition.context.js +14 -0
- package/providers/competition.context.js.map +1 -0
- package/providers/competition.provider.js +187 -0
- package/providers/competition.provider.js.map +1 -0
- package/providers/fansunited-config.context.js +6 -0
- package/providers/fansunited-config.context.js.map +1 -0
- package/providers/fansunited-config.hooks.js +20 -0
- package/providers/fansunited-config.hooks.js.map +1 -0
- package/providers/fansunited-config.provider.js +9 -0
- package/providers/fansunited-config.provider.js.map +1 -0
- package/providers/fansunited-sdk.hook.js +50 -0
- package/providers/fansunited-sdk.hook.js.map +1 -0
- package/providers/leaderboard/hooks/useMatchHelpers.js +30 -0
- package/providers/leaderboard/hooks/useMatchHelpers.js.map +1 -0
- package/providers/leaderboard/hooks/useTemplateHelpers.js +39 -0
- package/providers/leaderboard/hooks/useTemplateHelpers.js.map +1 -0
- package/providers/leaderboard.context.js +14 -0
- package/providers/leaderboard.context.js.map +1 -0
- package/providers/leaderboard.provider.js +98 -0
- package/providers/leaderboard.provider.js.map +1 -0
- package/providers/match/hooks/useBatchMatchOdds.js +72 -0
- package/providers/match/hooks/useBatchMatchOdds.js.map +1 -0
- package/providers/match/hooks/useEventHelpers.js +46 -0
- package/providers/match/hooks/useEventHelpers.js.map +1 -0
- package/providers/match/hooks/useHeadToHeadHelpers.js +52 -0
- package/providers/match/hooks/useHeadToHeadHelpers.js.map +1 -0
- package/providers/match/hooks/useLineupHelpers.js +53 -0
- package/providers/match/hooks/useLineupHelpers.js.map +1 -0
- package/providers/match/hooks/useMatchStandingsCalculations.js +332 -0
- package/providers/match/hooks/useMatchStandingsCalculations.js.map +1 -0
- package/providers/match/hooks/useMatchStatus.js +37 -0
- package/providers/match/hooks/useMatchStatus.js.map +1 -0
- package/providers/match/hooks/useOddsHelpers.js +54 -0
- package/providers/match/hooks/useOddsHelpers.js.map +1 -0
- package/providers/match/hooks/useScoreHelpers.js +34 -0
- package/providers/match/hooks/useScoreHelpers.js.map +1 -0
- package/providers/match/hooks/useStandingsHelpers.js +53 -0
- package/providers/match/hooks/useStandingsHelpers.js.map +1 -0
- package/providers/match/hooks/useStatisticsHelpers.js +40 -0
- package/providers/match/hooks/useStatisticsHelpers.js.map +1 -0
- package/providers/match/hooks/useTeamHelpers.js +38 -0
- package/providers/match/hooks/useTeamHelpers.js.map +1 -0
- package/providers/match/hooks/useTeamStatsHelpers.js +141 -0
- package/providers/match/hooks/useTeamStatsHelpers.js.map +1 -0
- package/providers/match.context.js +14 -0
- package/providers/match.context.js.map +1 -0
- package/providers/match.provider.js +176 -0
- package/providers/match.provider.js.map +1 -0
- package/providers/team/hooks/useFormStats.js +116 -0
- package/providers/team/hooks/useFormStats.js.map +1 -0
- package/providers/team/hooks/useMatchHelpers.js +46 -0
- package/providers/team/hooks/useMatchHelpers.js.map +1 -0
- package/providers/team/hooks/useSquadHelpers.js +67 -0
- package/providers/team/hooks/useSquadHelpers.js.map +1 -0
- package/providers/team.context.js +14 -0
- package/providers/team.context.js.map +1 -0
- package/providers/team.provider.js +98 -0
- package/providers/team.provider.js.map +1 -0
- package/utilities/stats/core/helpers.js +105 -0
- package/utilities/stats/core/helpers.js.map +1 -0
- package/utilities/stats/core/types.js +5 -0
- package/utilities/stats/core/types.js.map +1 -0
- package/utilities/stats/match/headToHead.js +83 -0
- package/utilities/stats/match/headToHead.js.map +1 -0
- package/utilities/stats/match/homeVsAway.js +140 -0
- package/utilities/stats/match/homeVsAway.js.map +1 -0
- package/utilities/stats/match/overUnder.js +91 -0
- package/utilities/stats/match/overUnder.js.map +1 -0
- package/utilities/stats/match/result.js +21 -0
- package/utilities/stats/match/result.js.map +1 -0
- package/utilities/stats/team/commonOpponents.js +77 -0
- package/utilities/stats/team/commonOpponents.js.map +1 -0
- package/utilities/stats/team/goalStats.js +50 -0
- package/utilities/stats/team/goalStats.js.map +1 -0
- package/utilities/stats/team/streaks.js +183 -0
- package/utilities/stats/team/streaks.js.map +1 -0
- package/client.cjs +0 -8
- package/fansunited-data-layer.cjs +0 -1
- package/matches-BvHU-bP0.js +0 -1795
- package/matches-Ci0Ci_Mw.cjs +0 -1
package/matches-BvHU-bP0.js
DELETED
|
@@ -1,1795 +0,0 @@
|
|
|
1
|
-
const E = "__FANSUNITED_DATA_LAYER_CONFIG__";
|
|
2
|
-
function xe(e) {
|
|
3
|
-
globalThis[E] = e;
|
|
4
|
-
}
|
|
5
|
-
function g() {
|
|
6
|
-
const e = globalThis[E];
|
|
7
|
-
if (!e)
|
|
8
|
-
throw new Error("Data layer config not initialized. Call setConfig() in your root layout.");
|
|
9
|
-
return e;
|
|
10
|
-
}
|
|
11
|
-
function Me() {
|
|
12
|
-
return globalThis[E] !== void 0;
|
|
13
|
-
}
|
|
14
|
-
function $(e) {
|
|
15
|
-
const t = e.replace(/\/$/, "");
|
|
16
|
-
function s(o) {
|
|
17
|
-
const { sportal365Sports: a } = o;
|
|
18
|
-
if (!a)
|
|
19
|
-
throw new Error("Sportal365 Sports API configuration is missing");
|
|
20
|
-
const c = `${a.username}:${a.password}`;
|
|
21
|
-
return `Basic ${btoa(c)}`;
|
|
22
|
-
}
|
|
23
|
-
function n(o) {
|
|
24
|
-
return `${t}${o}`;
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
async get(o) {
|
|
28
|
-
const a = o.config || g(), { sportal365Sports: c } = a;
|
|
29
|
-
if (!c)
|
|
30
|
-
throw new Error("Sportal365 Sports API configuration is missing");
|
|
31
|
-
const r = new URL(n(o.path));
|
|
32
|
-
if (o.params)
|
|
33
|
-
for (const [f, m] of Object.entries(o.params))
|
|
34
|
-
m !== void 0 && (Array.isArray(m) ? m.length > 0 && r.searchParams.set(f, m.join(",")) : r.searchParams.set(f, m));
|
|
35
|
-
const d = await fetch(r.toString(), {
|
|
36
|
-
method: "GET",
|
|
37
|
-
headers: {
|
|
38
|
-
Authorization: s(a),
|
|
39
|
-
"Content-Type": "application/json",
|
|
40
|
-
"X-Project": c.projectId,
|
|
41
|
-
// Merge custom headers (they can override defaults)
|
|
42
|
-
...o.headers
|
|
43
|
-
},
|
|
44
|
-
signal: c.timeout ? AbortSignal.timeout(c.timeout) : void 0,
|
|
45
|
-
// Next.js cache options for ISR/on-demand revalidation
|
|
46
|
-
...o.next && { next: o.next }
|
|
47
|
-
});
|
|
48
|
-
if (!d.ok)
|
|
49
|
-
throw new Error(`Sportal365 API error: ${d.status} ${d.statusText}`);
|
|
50
|
-
return d.json();
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
const G = "https://football.api.sportal365.com", Ue = "https://basketball.api.sportal365.com", $e = "https://tennis.api.sportal365.com", Ge = "https://sports-statistics.api.sportal365.com", He = "https://sports-search.api.sportal365.com", Be = "https://standing.api.sportal365.com", p = $(G);
|
|
55
|
-
function L(e) {
|
|
56
|
-
if (e)
|
|
57
|
-
return {
|
|
58
|
-
id: e.id,
|
|
59
|
-
name: e.name,
|
|
60
|
-
slug: e.slug,
|
|
61
|
-
position: e.position,
|
|
62
|
-
gender: e.gender,
|
|
63
|
-
assets: e.assets ? {
|
|
64
|
-
photo: e.assets.thumb?.url,
|
|
65
|
-
photoTransparent: e.assets.thumb_transparent_background?.url
|
|
66
|
-
} : void 0
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
const H = {
|
|
70
|
-
// Scoring events
|
|
71
|
-
GOAL: "GOAL",
|
|
72
|
-
PENALTY_GOAL: "PENALTY_GOAL",
|
|
73
|
-
OWN_GOAL: "OWN_GOAL",
|
|
74
|
-
DISALLOWED_GOAL: "DISALLOWED_GOAL",
|
|
75
|
-
PENALTY_SHOOTOUT_SCORED: "PENALTY_SHOOTOUT_SCORED",
|
|
76
|
-
PENALTY_SHOOTOUT_MISSED: "PENALTY_SHOOTOUT_MISSED",
|
|
77
|
-
// Card events
|
|
78
|
-
YELLOW_CARD: "YELLOW_CARD",
|
|
79
|
-
RED_CARD: "RED_CARD",
|
|
80
|
-
YELLOW_RED_CARD: "YELLOW_RED_CARD",
|
|
81
|
-
// Substitution
|
|
82
|
-
SUBSTITUTION: "SUBSTITUTION",
|
|
83
|
-
// Match flow events
|
|
84
|
-
KICKOFF: "KICKOFF",
|
|
85
|
-
HALFTIME: "HALFTIME",
|
|
86
|
-
START_SECOND_HALF: "START_SECOND_HALF",
|
|
87
|
-
FINISHED: "FINISHED",
|
|
88
|
-
INJURY_TIME: "INJURY_TIME",
|
|
89
|
-
// Penalty events
|
|
90
|
-
PENALTY_AWARDED: "PENALTY_AWARDED",
|
|
91
|
-
PENALTY_MISSED: "PENALTY_MISSED",
|
|
92
|
-
PENALTY_SAVED: "PENALTY_SAVED"
|
|
93
|
-
};
|
|
94
|
-
function I(e) {
|
|
95
|
-
const t = H[e.type_code];
|
|
96
|
-
return t ? {
|
|
97
|
-
id: e.id,
|
|
98
|
-
type: t,
|
|
99
|
-
competitorPosition: e.team_position === "HOME" ? "ONE" : "TWO",
|
|
100
|
-
minute: e.minute,
|
|
101
|
-
injuryMinute: e.injury_minute,
|
|
102
|
-
primaryPlayer: L(e.primary_player),
|
|
103
|
-
secondaryPlayer: L(e.secondary_player),
|
|
104
|
-
score: e.score ? { competitorOne: String(e.score.home), competitorTwo: String(e.score.away) } : void 0
|
|
105
|
-
} : (console.warn(`Unknown event type: ${e.type_code}`), null);
|
|
106
|
-
}
|
|
107
|
-
function u(e, t = "sportal365") {
|
|
108
|
-
if (e)
|
|
109
|
-
return [
|
|
110
|
-
{
|
|
111
|
-
provider: t,
|
|
112
|
-
id: e
|
|
113
|
-
}
|
|
114
|
-
];
|
|
115
|
-
}
|
|
116
|
-
function Ye(e, t) {
|
|
117
|
-
return e ? e.find((n) => n.provider === t)?.id : void 0;
|
|
118
|
-
}
|
|
119
|
-
function Ve(e, t, s) {
|
|
120
|
-
const n = e ?? [], o = n.findIndex((a) => a.provider === t);
|
|
121
|
-
if (o >= 0) {
|
|
122
|
-
const a = [...n];
|
|
123
|
-
return a[o] = { provider: t, id: s }, a;
|
|
124
|
-
} else
|
|
125
|
-
return [...n, { provider: t, id: s }];
|
|
126
|
-
}
|
|
127
|
-
function B(e) {
|
|
128
|
-
const t = e.urls?.find((s) => s.app_type === "desktop")?.url;
|
|
129
|
-
return {
|
|
130
|
-
id: e.id,
|
|
131
|
-
name: e.name,
|
|
132
|
-
code: e.code,
|
|
133
|
-
value: e.value ?? void 0,
|
|
134
|
-
odds: e.odds,
|
|
135
|
-
oddsOld: e.odds_old,
|
|
136
|
-
movement: e.movement === "STABLE" ? "NONE" : e.movement,
|
|
137
|
-
url: t,
|
|
138
|
-
providerSelectionId: e.provider_info?.selection_id
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
function Y(e) {
|
|
142
|
-
return {
|
|
143
|
-
type: {
|
|
144
|
-
id: e.type.id,
|
|
145
|
-
code: e.type.code,
|
|
146
|
-
name: e.type.name
|
|
147
|
-
},
|
|
148
|
-
period: {
|
|
149
|
-
id: e.scope.id,
|
|
150
|
-
type: e.scope.type,
|
|
151
|
-
name: e.scope.name
|
|
152
|
-
},
|
|
153
|
-
selections: e.selections.map(B)
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
function V(e) {
|
|
157
|
-
if (!e) return !0;
|
|
158
|
-
const t = e.replace("#", ""), s = parseInt(t.substring(0, 2), 16), n = parseInt(t.substring(2, 4), 16), o = parseInt(t.substring(4, 6), 16);
|
|
159
|
-
return (0.2126 * s + 0.7152 * n + 0.0722 * o) / 255 < 0.5;
|
|
160
|
-
}
|
|
161
|
-
function W(e) {
|
|
162
|
-
const t = e.bookmaker.assets?.[0], s = e.bookmaker.branding || t, n = e.bookmaker.branding?.background_color || t?.background_color, o = e.bookmaker.branding?.text_color || (V(n) ? "#FFFFFF" : "#000000");
|
|
163
|
-
return {
|
|
164
|
-
operator: {
|
|
165
|
-
id: e.bookmaker.id,
|
|
166
|
-
name: e.bookmaker.name,
|
|
167
|
-
url: e.bookmaker.url,
|
|
168
|
-
branding: s ? {
|
|
169
|
-
backgroundColor: n,
|
|
170
|
-
textColor: o,
|
|
171
|
-
logo: t?.logo
|
|
172
|
-
} : void 0
|
|
173
|
-
},
|
|
174
|
-
type: e.type,
|
|
175
|
-
markets: e.markets.map(Y)
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
function j(e) {
|
|
179
|
-
return e.map(W);
|
|
180
|
-
}
|
|
181
|
-
function K(e) {
|
|
182
|
-
const t = {
|
|
183
|
-
finished_ap: "finished_after_penalties",
|
|
184
|
-
// finished after penalties
|
|
185
|
-
finished_aet: "finished_after_extra_time",
|
|
186
|
-
// finished after extra time
|
|
187
|
-
finished: "finished",
|
|
188
|
-
not_started: "not_started",
|
|
189
|
-
live: "live",
|
|
190
|
-
interrupted: "interrupted",
|
|
191
|
-
cancelled: "cancelled",
|
|
192
|
-
postponed: "postponed",
|
|
193
|
-
abandoned: "abandoned"
|
|
194
|
-
};
|
|
195
|
-
let s;
|
|
196
|
-
return e.code && t[e.code] ? s = t[e.code] : s = {
|
|
197
|
-
FINISHED: "finished",
|
|
198
|
-
NOT_STARTED: "not_started",
|
|
199
|
-
LIVE: "live",
|
|
200
|
-
INTERRUPTED: "interrupted",
|
|
201
|
-
CANCELLED: "cancelled",
|
|
202
|
-
POSTPONED: "postponed",
|
|
203
|
-
UNKNOWN: "not_started",
|
|
204
|
-
ABANDONED: "abandoned"
|
|
205
|
-
}[e.type] ?? "not_started", {
|
|
206
|
-
code: s,
|
|
207
|
-
name: e.name,
|
|
208
|
-
shortName: e.short_name,
|
|
209
|
-
type: e.type
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
function k(e) {
|
|
213
|
-
return {
|
|
214
|
-
id: e.id,
|
|
215
|
-
name: e.name,
|
|
216
|
-
shortName: e.short_name ?? void 0,
|
|
217
|
-
threeLetterCode: e.three_letter_code,
|
|
218
|
-
slug: e.slug,
|
|
219
|
-
type: e.type === "national" ? "national" : "club",
|
|
220
|
-
gender: e.gender,
|
|
221
|
-
assets: e.assets ? {
|
|
222
|
-
logo: e.assets.logo?.url,
|
|
223
|
-
homeKit: e.assets.home_kit?.url,
|
|
224
|
-
awayKit: e.assets.away_kit?.url,
|
|
225
|
-
squadImage: e.assets.squad_image?.url
|
|
226
|
-
} : void 0,
|
|
227
|
-
metadata: e.shirt_color ? {
|
|
228
|
-
shirtColors: [
|
|
229
|
-
{
|
|
230
|
-
type: "home",
|
|
231
|
-
colorCode: e.shirt_color
|
|
232
|
-
}
|
|
233
|
-
]
|
|
234
|
-
} : void 0,
|
|
235
|
-
providerRef: u(e.uuid)
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
function q(e) {
|
|
239
|
-
return {
|
|
240
|
-
kickoffTime: new Date(e.kickoff_time),
|
|
241
|
-
currentMinute: e.minute?.regular_time,
|
|
242
|
-
phaseStartedAt: e.phase_started_at ? new Date(e.phase_started_at) : void 0,
|
|
243
|
-
finishedAt: e.finished_at ? new Date(e.finished_at) : void 0,
|
|
244
|
-
firstHalfStartedAt: e.first_half_started_at ? new Date(e.first_half_started_at) : void 0,
|
|
245
|
-
secondHalfStartedAt: e.second_half_started_at ? new Date(e.second_half_started_at) : void 0,
|
|
246
|
-
extraTimeFirstHalfStartedAt: e.extra_time_first_half_started_at ? new Date(e.extra_time_first_half_started_at) : void 0,
|
|
247
|
-
extraTimeSecondHalfStartedAt: e.extra_time_second_half_started_at ? new Date(e.extra_time_second_half_started_at) : void 0
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
function X(e) {
|
|
251
|
-
if (!e) return;
|
|
252
|
-
const t = (n) => n ? { competitorOne: String(n.home), competitorTwo: String(n.away) } : void 0, s = e.after_extra_time ?? e.regular_time;
|
|
253
|
-
return {
|
|
254
|
-
competitorOne: s?.home != null ? String(s.home) : null,
|
|
255
|
-
competitorTwo: s?.away != null ? String(s.away) : null,
|
|
256
|
-
breakdown: {
|
|
257
|
-
total: t(e.total),
|
|
258
|
-
halfTime: t(e.half_time),
|
|
259
|
-
regularTime: t(e.regular_time),
|
|
260
|
-
extraTime: t(e.extra_time),
|
|
261
|
-
penaltyShootout: t(e.penalty_shootout),
|
|
262
|
-
aggregate: t(e.aggregate)
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
function z(e) {
|
|
267
|
-
if (e)
|
|
268
|
-
return {
|
|
269
|
-
id: e.id,
|
|
270
|
-
name: e.name,
|
|
271
|
-
slug: e.slug,
|
|
272
|
-
assets: e.assets?.image?.url ? { image: e.assets.image.url } : void 0,
|
|
273
|
-
providerRef: u(e.uuid)
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
function J(e) {
|
|
277
|
-
if (e?.length)
|
|
278
|
-
return e.map((t) => ({
|
|
279
|
-
id: t.id,
|
|
280
|
-
name: t.name,
|
|
281
|
-
slug: t.slug,
|
|
282
|
-
role: t.role ?? "REFEREE",
|
|
283
|
-
gender: t.gender
|
|
284
|
-
}));
|
|
285
|
-
}
|
|
286
|
-
function Q(e) {
|
|
287
|
-
if (!e.season?.tournament) return;
|
|
288
|
-
const { tournament: t, ...s } = e.season;
|
|
289
|
-
return {
|
|
290
|
-
id: t.id,
|
|
291
|
-
name: t.name,
|
|
292
|
-
slug: t.slug,
|
|
293
|
-
type: t.type,
|
|
294
|
-
region: t.region,
|
|
295
|
-
country: t.country ? {
|
|
296
|
-
id: t.country.id,
|
|
297
|
-
name: t.country.name,
|
|
298
|
-
code: t.country.code ?? void 0,
|
|
299
|
-
flag: t.country.assets?.flag?.url,
|
|
300
|
-
providerRef: u(t.country.uuid)
|
|
301
|
-
} : void 0,
|
|
302
|
-
season: {
|
|
303
|
-
id: s.id,
|
|
304
|
-
name: s.name,
|
|
305
|
-
status: s.status
|
|
306
|
-
},
|
|
307
|
-
stage: e.stage ? {
|
|
308
|
-
id: e.stage.id,
|
|
309
|
-
name: e.stage.name,
|
|
310
|
-
type: e.stage.type
|
|
311
|
-
} : void 0,
|
|
312
|
-
assets: t.assets?.logo?.url ? { logo: t.assets.logo.url } : void 0,
|
|
313
|
-
providerRef: u(t.uuid)
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
function Z(e) {
|
|
317
|
-
if (!e.winner?.match?.id) return;
|
|
318
|
-
const t = {
|
|
319
|
-
"Regular Time": "REGULAR_TIME",
|
|
320
|
-
"Extra Time": "EXTRA_TIME",
|
|
321
|
-
Penalties: "PENALTIES"
|
|
322
|
-
};
|
|
323
|
-
return {
|
|
324
|
-
competitorId: e.winner.match.id,
|
|
325
|
-
reason: e.winner.match.reason?.name ? t[e.winner.match.reason.name] : void 0,
|
|
326
|
-
aggregate: !!e.winner.aggregate
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
function b(e) {
|
|
330
|
-
return {
|
|
331
|
-
id: e.id,
|
|
332
|
-
slug: e.slug,
|
|
333
|
-
sport: "football",
|
|
334
|
-
status: K(e.status),
|
|
335
|
-
timing: q(e),
|
|
336
|
-
competitorOne: k(e.home_team),
|
|
337
|
-
competitorTwo: k(e.away_team),
|
|
338
|
-
competition: Q(e),
|
|
339
|
-
round: e.round ? {
|
|
340
|
-
id: e.round.id ?? e.round.key,
|
|
341
|
-
key: e.round.key,
|
|
342
|
-
name: e.round.name,
|
|
343
|
-
type: e.round.type ?? "REGULAR",
|
|
344
|
-
providerRef: u(e.round.uuid)
|
|
345
|
-
} : void 0,
|
|
346
|
-
group: e.group ? {
|
|
347
|
-
id: e.group.id,
|
|
348
|
-
name: e.group.name,
|
|
349
|
-
providerRef: u(e.group.uuid)
|
|
350
|
-
} : void 0,
|
|
351
|
-
venue: z(e.venue),
|
|
352
|
-
officials: J(e.referees),
|
|
353
|
-
spectators: e.spectators ?? void 0,
|
|
354
|
-
score: X(e.score),
|
|
355
|
-
mainEvents: e.main_events?.map(I).filter((t) => t !== null),
|
|
356
|
-
penaltyShootoutEvents: e.penalty_shootout_events?.map(I).filter((t) => t !== null),
|
|
357
|
-
winner: Z(e),
|
|
358
|
-
coverage: e.coverage === "NOT_LIVE" ? "UNKNOWN" : e.coverage,
|
|
359
|
-
lineupStatus: e.lineup_status === "UNCONFIRMED" ? "EXPECTED" : e.lineup_status,
|
|
360
|
-
providerRef: u(e.uuid)
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
function w(e) {
|
|
364
|
-
const t = e.player;
|
|
365
|
-
return {
|
|
366
|
-
id: t.id,
|
|
367
|
-
name: t.name,
|
|
368
|
-
slug: t.slug,
|
|
369
|
-
position: t.position,
|
|
370
|
-
shirtNumber: e.shirt_number,
|
|
371
|
-
positionX: e.position_x ?? void 0,
|
|
372
|
-
positionY: e.position_y ?? void 0,
|
|
373
|
-
country: t.country ? {
|
|
374
|
-
id: t.country.id,
|
|
375
|
-
name: t.country.name,
|
|
376
|
-
code: t.country.code,
|
|
377
|
-
providerRef: u(t.country.uuid)
|
|
378
|
-
} : void 0,
|
|
379
|
-
birthdate: t.birthdate,
|
|
380
|
-
profile: t.profile ? {
|
|
381
|
-
height: t.profile.height,
|
|
382
|
-
weight: t.profile.weight
|
|
383
|
-
} : void 0,
|
|
384
|
-
assets: t.assets ? {
|
|
385
|
-
photo: t.assets.thumb?.url,
|
|
386
|
-
photoTransparent: t.assets.thumb_transparent_background?.url
|
|
387
|
-
} : void 0,
|
|
388
|
-
events: e.events?.map(I).filter((s) => s !== null),
|
|
389
|
-
providerRef: u(t.uuid)
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
function D(e) {
|
|
393
|
-
const t = [], s = [];
|
|
394
|
-
for (const n of e.players) {
|
|
395
|
-
const o = w(n);
|
|
396
|
-
n.type.category === "start" ? t.push(o) : n.type.category === "sub" && s.push(o);
|
|
397
|
-
}
|
|
398
|
-
return {
|
|
399
|
-
competitorId: e.team_id,
|
|
400
|
-
formation: e.formation,
|
|
401
|
-
coach: e.coach ? {
|
|
402
|
-
id: e.coach.id,
|
|
403
|
-
name: e.coach.name,
|
|
404
|
-
slug: e.coach.slug,
|
|
405
|
-
country: e.coach.country ? {
|
|
406
|
-
id: e.coach.country.id,
|
|
407
|
-
name: e.coach.country.name,
|
|
408
|
-
code: e.coach.country.code,
|
|
409
|
-
providerRef: u(e.coach.country.uuid)
|
|
410
|
-
} : void 0,
|
|
411
|
-
birthdate: e.coach.birthdate,
|
|
412
|
-
providerRef: u(e.coach.uuid)
|
|
413
|
-
} : void 0,
|
|
414
|
-
starters: t,
|
|
415
|
-
substitutes: s
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
function ee(e) {
|
|
419
|
-
return {
|
|
420
|
-
matchId: e.match_id,
|
|
421
|
-
confirmed: e.status === "CONFIRMED",
|
|
422
|
-
competitorOne: D(e.home_team),
|
|
423
|
-
competitorTwo: D(e.away_team)
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
function h(e, t, s, n) {
|
|
427
|
-
return t == null ? null : { key: e, value: String(t), label: s, unit: n };
|
|
428
|
-
}
|
|
429
|
-
function N(e, t) {
|
|
430
|
-
const s = (t.shots_on ?? 0) + (t.shots_off ?? 0) + (t.shots_blocked ?? 0), n = [
|
|
431
|
-
h("possession", t.possession, "Possession", "%"),
|
|
432
|
-
h("shots_total", s, "Shots"),
|
|
433
|
-
h("shots_on_target", t.shots_on, "Shots on Target"),
|
|
434
|
-
h("shots_off_target", t.shots_off, "Shots off Target"),
|
|
435
|
-
h("shots_blocked", t.shots_blocked, "Shots Blocked"),
|
|
436
|
-
h("corners", t.corners, "Corner Kicks"),
|
|
437
|
-
h("goal_kicks", t.goal_kicks, "Goal Kicks"),
|
|
438
|
-
h("throw_ins", t.throw_in, "Throw Ins"),
|
|
439
|
-
h("offsides", t.offside, "Offsides"),
|
|
440
|
-
h("fouls", t.fouls_committed, "Fouls"),
|
|
441
|
-
h("yellow_cards", t.yellow_cards, "Yellow Cards"),
|
|
442
|
-
h("passes", t.pass, "Passes"),
|
|
443
|
-
h("crosses", t.crosses, "Crosses")
|
|
444
|
-
];
|
|
445
|
-
return {
|
|
446
|
-
competitorId: e,
|
|
447
|
-
statistics: n.filter((o) => o !== null)
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
function te(e) {
|
|
451
|
-
const t = e.find((n) => n.home_team), s = e.find((n) => !n.home_team);
|
|
452
|
-
if (!t || !s)
|
|
453
|
-
throw new Error("Missing competitor statistics");
|
|
454
|
-
return {
|
|
455
|
-
competitorOne: N(String(t.team.id), t.statistics),
|
|
456
|
-
competitorTwo: N(String(s.team.id), s.statistics)
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
function ne(e, t) {
|
|
460
|
-
return {
|
|
461
|
-
matchId: e,
|
|
462
|
-
operators: j(t)
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
function F(e) {
|
|
466
|
-
if (e == null || e === "")
|
|
467
|
-
return;
|
|
468
|
-
const t = typeof e == "number" ? e : parseInt(e, 10);
|
|
469
|
-
return isNaN(t) ? void 0 : t;
|
|
470
|
-
}
|
|
471
|
-
function se(e) {
|
|
472
|
-
return {
|
|
473
|
-
externalId: e.external_id,
|
|
474
|
-
minute: F(e.elapsed),
|
|
475
|
-
addedTime: F(e.elapsed_plus),
|
|
476
|
-
text: e.auto_text,
|
|
477
|
-
details: e.details,
|
|
478
|
-
meta: {
|
|
479
|
-
type: e.type,
|
|
480
|
-
commentaryType: e.commentary_type,
|
|
481
|
-
subtype1: e.subtype_1,
|
|
482
|
-
subtype2: e.subtype_2,
|
|
483
|
-
timestamp: e.incident_timestamp
|
|
484
|
-
}
|
|
485
|
-
};
|
|
486
|
-
}
|
|
487
|
-
async function We(e, t, s) {
|
|
488
|
-
const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
|
|
489
|
-
path: `/v2/matches/${e}`,
|
|
490
|
-
params: {
|
|
491
|
-
language_code: t?.languageCode ?? o?.languageCode ?? "en",
|
|
492
|
-
odd_client: t?.oddClient,
|
|
493
|
-
odd_type: t?.oddType,
|
|
494
|
-
scope_type: t?.scopeType,
|
|
495
|
-
odd_format: t?.oddFormat,
|
|
496
|
-
market_types: t?.marketTypes,
|
|
497
|
-
bookmaker_ids: t?.bookmakerIds,
|
|
498
|
-
optional_data: t?.optionalData
|
|
499
|
-
},
|
|
500
|
-
headers: {
|
|
501
|
-
"Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
|
|
502
|
-
},
|
|
503
|
-
next: t?.next,
|
|
504
|
-
config: n
|
|
505
|
-
});
|
|
506
|
-
return b(a);
|
|
507
|
-
}
|
|
508
|
-
async function je(e, t, s) {
|
|
509
|
-
const n = s || g(), { sportal365Sports: o } = n;
|
|
510
|
-
return (await p.get({
|
|
511
|
-
path: `/v2/matches/${e}/events`,
|
|
512
|
-
params: {
|
|
513
|
-
language_code: t?.languageCode ?? o?.languageCode ?? "en"
|
|
514
|
-
},
|
|
515
|
-
headers: {
|
|
516
|
-
"Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
|
|
517
|
-
},
|
|
518
|
-
next: t?.next,
|
|
519
|
-
config: n
|
|
520
|
-
})).events.map(I).filter((c) => c !== null);
|
|
521
|
-
}
|
|
522
|
-
async function Ke(e, t, s) {
|
|
523
|
-
const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
|
|
524
|
-
path: `/v2/matches/${e}/lineups`,
|
|
525
|
-
params: {
|
|
526
|
-
language_code: t?.languageCode ?? o?.languageCode ?? "en"
|
|
527
|
-
},
|
|
528
|
-
headers: {
|
|
529
|
-
"Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
|
|
530
|
-
},
|
|
531
|
-
next: t?.next,
|
|
532
|
-
config: n
|
|
533
|
-
});
|
|
534
|
-
return ee(a);
|
|
535
|
-
}
|
|
536
|
-
async function qe(e, t, s) {
|
|
537
|
-
const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
|
|
538
|
-
path: `/v2/matches/${e}`,
|
|
539
|
-
params: {
|
|
540
|
-
language_code: t?.languageCode ?? o?.languageCode ?? "en",
|
|
541
|
-
odd_client: t?.oddClient ?? o?.oddClient,
|
|
542
|
-
odd_type: t?.oddType,
|
|
543
|
-
scope_type: t?.scopeType ?? "ALL",
|
|
544
|
-
odd_format: t?.oddFormat ?? "DECIMAL",
|
|
545
|
-
market_types: t?.marketTypes,
|
|
546
|
-
bookmaker_ids: t?.bookmakerIds
|
|
547
|
-
},
|
|
548
|
-
headers: {
|
|
549
|
-
"Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
|
|
550
|
-
},
|
|
551
|
-
next: t?.next,
|
|
552
|
-
config: n
|
|
553
|
-
});
|
|
554
|
-
return ne(e, a.odds ?? []);
|
|
555
|
-
}
|
|
556
|
-
async function Xe(e, t, s) {
|
|
557
|
-
const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
|
|
558
|
-
path: `/events/${e}/teamstats`,
|
|
559
|
-
params: {
|
|
560
|
-
language_code: t?.languageCode ?? o?.languageCode ?? "en"
|
|
561
|
-
},
|
|
562
|
-
headers: {
|
|
563
|
-
"Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
|
|
564
|
-
},
|
|
565
|
-
next: t?.next,
|
|
566
|
-
config: n
|
|
567
|
-
});
|
|
568
|
-
return te(a);
|
|
569
|
-
}
|
|
570
|
-
async function ze(e, t, s) {
|
|
571
|
-
const n = s || g(), { sportal365Sports: o } = n;
|
|
572
|
-
return (await p.get({
|
|
573
|
-
path: `/matches/${e}/commentary`,
|
|
574
|
-
params: {
|
|
575
|
-
language_code: t?.languageCode ?? o?.languageCode ?? "en"
|
|
576
|
-
},
|
|
577
|
-
headers: {
|
|
578
|
-
"Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
|
|
579
|
-
},
|
|
580
|
-
next: t?.next,
|
|
581
|
-
config: n
|
|
582
|
-
})).map(se);
|
|
583
|
-
}
|
|
584
|
-
async function Je(e, t) {
|
|
585
|
-
const s = t || g(), { sportal365Sports: n } = s;
|
|
586
|
-
return (await p.get({
|
|
587
|
-
path: "/v2/matches",
|
|
588
|
-
params: {
|
|
589
|
-
language_code: e.languageCode ?? n?.languageCode ?? "en",
|
|
590
|
-
limit: e.limit.toString(),
|
|
591
|
-
offset: e.offset.toString(),
|
|
592
|
-
// Competition filters
|
|
593
|
-
tournament_ids: e.tournamentIds,
|
|
594
|
-
season_ids: e.seasonIds,
|
|
595
|
-
stage_ids: e.stageIds,
|
|
596
|
-
group_ids: e.groupIds,
|
|
597
|
-
round_ids: e.roundIds,
|
|
598
|
-
round_filter: e.roundFilter,
|
|
599
|
-
// Time filters
|
|
600
|
-
from_kickoff_time: e.fromKickoffTime,
|
|
601
|
-
to_kickoff_time: e.toKickoffTime,
|
|
602
|
-
// Entity filters
|
|
603
|
-
team_ids: e.teamIds,
|
|
604
|
-
team_ids_operator: e.teamIdsOperator,
|
|
605
|
-
referee_id: e.refereeId,
|
|
606
|
-
venue_id: e.venueId,
|
|
607
|
-
player_id: e.playerId,
|
|
608
|
-
// Status filters
|
|
609
|
-
status_types: e.statusTypes,
|
|
610
|
-
status_codes: e.statusCodes,
|
|
611
|
-
// Odds
|
|
612
|
-
odd_client: e.oddClient ?? n?.oddClient,
|
|
613
|
-
odd_type: e.oddType,
|
|
614
|
-
scope_type: e.scopeType,
|
|
615
|
-
odd_format: e.oddFormat,
|
|
616
|
-
market_types: e.marketTypes,
|
|
617
|
-
bookmaker_ids: e.bookmakerIds,
|
|
618
|
-
// Sorting and optional data
|
|
619
|
-
sort_direction: e.sortDirection,
|
|
620
|
-
optional_data: e.optionalData
|
|
621
|
-
},
|
|
622
|
-
headers: {
|
|
623
|
-
"Accept-Language": e.languageCode ?? n?.languageCode ?? "en"
|
|
624
|
-
},
|
|
625
|
-
next: e.next,
|
|
626
|
-
config: s
|
|
627
|
-
})).matches.map(b);
|
|
628
|
-
}
|
|
629
|
-
async function Qe(e, t) {
|
|
630
|
-
const s = t || g(), { sportal365Sports: n } = s;
|
|
631
|
-
return (await p.get({
|
|
632
|
-
path: "/v2/matches/livescore",
|
|
633
|
-
params: {
|
|
634
|
-
// Match filters
|
|
635
|
-
match_ids: e?.matchIds,
|
|
636
|
-
date: e?.date,
|
|
637
|
-
utc_offset: e?.utcOffset?.toString(),
|
|
638
|
-
tournament_group: e?.tournamentGroup,
|
|
639
|
-
status_types: e?.statusTypes,
|
|
640
|
-
selection_filter: e?.selectionFilter,
|
|
641
|
-
language_code: e?.languageCode ?? n?.languageCode ?? "en",
|
|
642
|
-
// Odds parameters
|
|
643
|
-
odd_client: e?.oddClient ?? n?.oddClient,
|
|
644
|
-
odd_type: e?.oddType,
|
|
645
|
-
scope_type: e?.scopeType,
|
|
646
|
-
odd_format: e?.oddFormat,
|
|
647
|
-
market_types: e?.marketTypes,
|
|
648
|
-
// Optional data
|
|
649
|
-
optional_data: e?.optionalData
|
|
650
|
-
},
|
|
651
|
-
headers: {
|
|
652
|
-
"Accept-Language": e?.languageCode ?? n?.languageCode ?? "en"
|
|
653
|
-
},
|
|
654
|
-
next: e?.next,
|
|
655
|
-
config: s
|
|
656
|
-
})).matches.map(b);
|
|
657
|
-
}
|
|
658
|
-
function oe(e) {
|
|
659
|
-
return {
|
|
660
|
-
id: e.id,
|
|
661
|
-
name: e.name,
|
|
662
|
-
shortName: e.short_name ?? void 0,
|
|
663
|
-
threeLetterCode: e.three_letter_code,
|
|
664
|
-
slug: e.slug,
|
|
665
|
-
type: e.type === "placeholder" || e.type === "club" ? "club" : "national",
|
|
666
|
-
gender: e.gender,
|
|
667
|
-
country: e.country ? {
|
|
668
|
-
id: e.country.id,
|
|
669
|
-
name: e.country.name,
|
|
670
|
-
code: e.country.code ?? void 0,
|
|
671
|
-
flag: e.country.assets?.flag?.url,
|
|
672
|
-
providerRef: u(e.country.uuid)
|
|
673
|
-
} : void 0,
|
|
674
|
-
// Extended team profile data
|
|
675
|
-
venue: e.venue ? {
|
|
676
|
-
id: e.venue.id,
|
|
677
|
-
name: e.venue.name,
|
|
678
|
-
slug: e.venue.slug,
|
|
679
|
-
city: e.venue.city ? {
|
|
680
|
-
id: e.venue.city.id,
|
|
681
|
-
name: e.venue.city.name,
|
|
682
|
-
country: e.venue.city.country ? {
|
|
683
|
-
id: e.venue.city.country.id,
|
|
684
|
-
name: e.venue.city.country.name,
|
|
685
|
-
code: e.venue.city.country.code ?? void 0,
|
|
686
|
-
flag: e.venue.city.country.assets?.flag?.url,
|
|
687
|
-
providerRef: u(e.venue.city.country.uuid)
|
|
688
|
-
} : void 0,
|
|
689
|
-
providerRef: u(e.venue.city.uuid ?? void 0)
|
|
690
|
-
} : void 0,
|
|
691
|
-
country: e.venue.country ? {
|
|
692
|
-
id: e.venue.country.id,
|
|
693
|
-
name: e.venue.country.name,
|
|
694
|
-
code: e.venue.country.code ?? void 0,
|
|
695
|
-
flag: e.venue.country.assets?.flag?.url,
|
|
696
|
-
providerRef: u(e.venue.country.uuid)
|
|
697
|
-
} : void 0,
|
|
698
|
-
profile: e.venue.profile ? {
|
|
699
|
-
latitude: e.venue.profile.lat,
|
|
700
|
-
longitude: e.venue.profile.lng,
|
|
701
|
-
capacity: e.venue.profile.capacity
|
|
702
|
-
} : void 0,
|
|
703
|
-
assets: e.venue.assets?.image?.url ? {
|
|
704
|
-
image: e.venue.assets.image.url
|
|
705
|
-
} : void 0,
|
|
706
|
-
providerRef: u(e.venue.uuid)
|
|
707
|
-
} : void 0,
|
|
708
|
-
coach: e.coach ? {
|
|
709
|
-
id: e.coach.id,
|
|
710
|
-
name: e.coach.name,
|
|
711
|
-
slug: e.coach.slug,
|
|
712
|
-
country: {
|
|
713
|
-
id: e.coach.country.id,
|
|
714
|
-
name: e.coach.country.name,
|
|
715
|
-
code: e.coach.country.code ?? void 0,
|
|
716
|
-
flag: e.coach.country.assets?.flag?.url,
|
|
717
|
-
providerRef: u(e.coach.country.uuid)
|
|
718
|
-
},
|
|
719
|
-
birthdate: e.coach.birthdate,
|
|
720
|
-
providerRef: u(e.coach.uuid)
|
|
721
|
-
} : void 0,
|
|
722
|
-
founded: e.founded,
|
|
723
|
-
// Assets
|
|
724
|
-
assets: e.assets ? {
|
|
725
|
-
logo: e.assets.logo?.url,
|
|
726
|
-
homeKit: e.assets.home_kit?.url,
|
|
727
|
-
awayKit: e.assets.away_kit?.url,
|
|
728
|
-
squadImage: e.assets.squad_image?.url
|
|
729
|
-
} : void 0,
|
|
730
|
-
// Metadata
|
|
731
|
-
metadata: {
|
|
732
|
-
shirtColors: e.shirt_colors?.map((t) => ({
|
|
733
|
-
type: t.type,
|
|
734
|
-
colorCode: t.color_code
|
|
735
|
-
})),
|
|
736
|
-
socials: e.social ? {
|
|
737
|
-
website: e.social.web,
|
|
738
|
-
x: e.social.twitter_id,
|
|
739
|
-
facebook: e.social.facebook_id,
|
|
740
|
-
instagram: e.social.instagram_id,
|
|
741
|
-
wikipedia: e.social.wikipedia_id
|
|
742
|
-
} : void 0
|
|
743
|
-
},
|
|
744
|
-
// Seasons
|
|
745
|
-
activeSeasons: e.active_seasons?.map((t) => ({
|
|
746
|
-
id: t.id,
|
|
747
|
-
name: t.name,
|
|
748
|
-
slug: t.slug,
|
|
749
|
-
active: t.status === "ACTIVE",
|
|
750
|
-
providerRef: u(t.uuid)
|
|
751
|
-
})),
|
|
752
|
-
currentSeason: e.current_season ? {
|
|
753
|
-
id: e.current_season.id,
|
|
754
|
-
name: e.current_season.name,
|
|
755
|
-
slug: e.current_season.slug,
|
|
756
|
-
active: e.current_season.status === "ACTIVE",
|
|
757
|
-
providerRef: u(e.current_season.uuid)
|
|
758
|
-
} : void 0,
|
|
759
|
-
// Form - map to FUSportsCompetitorForm
|
|
760
|
-
form: e.form && e.form.length > 0 ? {
|
|
761
|
-
competitorId: e.id,
|
|
762
|
-
results: e.form.map((t) => {
|
|
763
|
-
const n = t.participants[0].id === e.uuid ? t.participants[1] : t.participants[0], o = t.result[0]?.results.find((r) => r.position === "1")?.value, a = t.result[0]?.results.find((r) => r.position === "2")?.value, c = t.outcome === "win" ? "W" : t.outcome === "draw" ? "D" : "L";
|
|
764
|
-
return {
|
|
765
|
-
matchId: t.id,
|
|
766
|
-
result: c,
|
|
767
|
-
score: o && a ? `${o}-${a}` : void 0,
|
|
768
|
-
opponent: {
|
|
769
|
-
id: n.id,
|
|
770
|
-
name: n.name,
|
|
771
|
-
logo: n.display_asset?.url
|
|
772
|
-
},
|
|
773
|
-
date: new Date(t.start_time),
|
|
774
|
-
competition: t.competition ? {
|
|
775
|
-
id: t.competition.id,
|
|
776
|
-
name: t.competition.name
|
|
777
|
-
} : void 0
|
|
778
|
-
};
|
|
779
|
-
}),
|
|
780
|
-
formString: e.form.map((t) => t.outcome === "win" ? "W" : t.outcome === "draw" ? "D" : "L").join("")
|
|
781
|
-
} : void 0,
|
|
782
|
-
providerRef: u(e.uuid)
|
|
783
|
-
};
|
|
784
|
-
}
|
|
785
|
-
function ae(e) {
|
|
786
|
-
const t = e.player;
|
|
787
|
-
return {
|
|
788
|
-
id: t.id,
|
|
789
|
-
name: t.name,
|
|
790
|
-
slug: t.slug,
|
|
791
|
-
position: t.position,
|
|
792
|
-
shirtNumber: e.shirt_number,
|
|
793
|
-
country: t.country ? {
|
|
794
|
-
id: t.country.id,
|
|
795
|
-
name: t.country.name,
|
|
796
|
-
code: t.country.code ?? void 0,
|
|
797
|
-
flag: t.country.assets?.flag?.url,
|
|
798
|
-
providerRef: u(t.country.uuid)
|
|
799
|
-
} : void 0,
|
|
800
|
-
gender: t.gender,
|
|
801
|
-
birthdate: t.birthdate,
|
|
802
|
-
profile: {
|
|
803
|
-
height: t.profile?.height ?? void 0,
|
|
804
|
-
weight: t.profile?.weight ?? void 0
|
|
805
|
-
},
|
|
806
|
-
assets: t.assets ? {
|
|
807
|
-
photo: t.assets.thumb?.url,
|
|
808
|
-
photoTransparent: t.assets.thumb_transparent_background?.url
|
|
809
|
-
} : void 0,
|
|
810
|
-
status: e.status,
|
|
811
|
-
contractType: e.contract_type,
|
|
812
|
-
contractUntil: e.contract_until ?? void 0,
|
|
813
|
-
joinedDate: e.start_date ?? void 0,
|
|
814
|
-
providerRef: u(t.id)
|
|
815
|
-
// Using player.id as provider reference
|
|
816
|
-
};
|
|
817
|
-
}
|
|
818
|
-
function ie(e) {
|
|
819
|
-
return {
|
|
820
|
-
id: e.id,
|
|
821
|
-
name: e.name,
|
|
822
|
-
slug: e.slug,
|
|
823
|
-
country: e.country ? {
|
|
824
|
-
id: e.country.id,
|
|
825
|
-
name: e.country.name,
|
|
826
|
-
code: e.country.code ?? void 0,
|
|
827
|
-
flag: e.country.assets?.flag?.url,
|
|
828
|
-
providerRef: u(e.country.uuid)
|
|
829
|
-
} : void 0,
|
|
830
|
-
birthdate: e.birthdate,
|
|
831
|
-
providerRef: u(e.uuid)
|
|
832
|
-
};
|
|
833
|
-
}
|
|
834
|
-
function re(e) {
|
|
835
|
-
return {
|
|
836
|
-
teamId: e.team.id,
|
|
837
|
-
teamName: e.team.name,
|
|
838
|
-
coach: e.coach ? ie(e.coach) : void 0,
|
|
839
|
-
players: e.players.map(ae)
|
|
840
|
-
};
|
|
841
|
-
}
|
|
842
|
-
function de(e) {
|
|
843
|
-
const t = parseInt(e, 10);
|
|
844
|
-
return isNaN(t) ? void 0 : t;
|
|
845
|
-
}
|
|
846
|
-
function i(e, t) {
|
|
847
|
-
const s = e.find((n) => n.name === t);
|
|
848
|
-
return s ? de(s.value) : void 0;
|
|
849
|
-
}
|
|
850
|
-
function ue(e, t) {
|
|
851
|
-
const s = e.statistics;
|
|
852
|
-
return {
|
|
853
|
-
playerId: e.player.id,
|
|
854
|
-
seasonId: e.season.id,
|
|
855
|
-
teamId: t,
|
|
856
|
-
// Core statistics
|
|
857
|
-
appearances: i(s, "played"),
|
|
858
|
-
started: i(s, "started"),
|
|
859
|
-
substituteIn: i(s, "substitute_in"),
|
|
860
|
-
substituteOut: i(s, "substitute_out"),
|
|
861
|
-
minutes: i(s, "minutes"),
|
|
862
|
-
minutesSubstitute: i(s, "minutes_substitute"),
|
|
863
|
-
// Scoring
|
|
864
|
-
goals: i(s, "goals"),
|
|
865
|
-
goalsSubstitute: i(s, "goals_substitute"),
|
|
866
|
-
penaltyGoals: i(s, "penalty_goals"),
|
|
867
|
-
ownGoals: i(s, "own_goals"),
|
|
868
|
-
assists: i(s, "assists"),
|
|
869
|
-
// Shooting
|
|
870
|
-
shots: i(s, "shots"),
|
|
871
|
-
shotsOnTarget: i(s, "shots_on_target"),
|
|
872
|
-
// Discipline
|
|
873
|
-
yellowCards: i(s, "yellow_cards"),
|
|
874
|
-
redCards: i(s, "red_cards"),
|
|
875
|
-
foulsCommitted: i(s, "fouls_committed"),
|
|
876
|
-
penaltiesCommitted: i(s, "penalties_committed"),
|
|
877
|
-
// Penalties
|
|
878
|
-
penaltiesMissed: i(s, "penalties_missed"),
|
|
879
|
-
// Defensive
|
|
880
|
-
cleansheets: i(s, "cleansheets"),
|
|
881
|
-
// Goalkeeper-specific
|
|
882
|
-
saves: i(s, "saves"),
|
|
883
|
-
conceded: i(s, "conceded"),
|
|
884
|
-
caughtBall: i(s, "caught_ball"),
|
|
885
|
-
penaltiesReceived: i(s, "penalties_received"),
|
|
886
|
-
// Other
|
|
887
|
-
offsides: i(s, "offsides"),
|
|
888
|
-
// Raw statistics array (for any additional stats not mapped above)
|
|
889
|
-
rawStatistics: s.map((n) => ({
|
|
890
|
-
name: n.name,
|
|
891
|
-
value: n.value
|
|
892
|
-
}))
|
|
893
|
-
};
|
|
894
|
-
}
|
|
895
|
-
function ce(e) {
|
|
896
|
-
const t = e.statistics;
|
|
897
|
-
return {
|
|
898
|
-
playerId: e.player.id,
|
|
899
|
-
seasonId: e.season.id,
|
|
900
|
-
// Core statistics
|
|
901
|
-
appearances: i(t, "played"),
|
|
902
|
-
started: i(t, "started"),
|
|
903
|
-
substituteIn: i(t, "substitute_in"),
|
|
904
|
-
substituteOut: i(t, "substitute_out"),
|
|
905
|
-
minutes: i(t, "minutes"),
|
|
906
|
-
minutesSubstitute: i(t, "minutes_substitute"),
|
|
907
|
-
// Scoring
|
|
908
|
-
goals: i(t, "goals"),
|
|
909
|
-
goalsSubstitute: i(t, "goals_substitute"),
|
|
910
|
-
penaltyGoals: i(t, "penalty_goals"),
|
|
911
|
-
ownGoals: i(t, "own_goals"),
|
|
912
|
-
assists: i(t, "assists"),
|
|
913
|
-
// Shooting
|
|
914
|
-
shots: i(t, "shots"),
|
|
915
|
-
shotsOnTarget: i(t, "shots_on_target"),
|
|
916
|
-
// Discipline
|
|
917
|
-
yellowCards: i(t, "yellow_cards"),
|
|
918
|
-
redCards: i(t, "red_cards"),
|
|
919
|
-
foulsCommitted: i(t, "fouls_committed"),
|
|
920
|
-
penaltiesCommitted: i(t, "penalties_committed"),
|
|
921
|
-
// Penalties
|
|
922
|
-
penaltiesMissed: i(t, "penalties_missed"),
|
|
923
|
-
// Defensive
|
|
924
|
-
cleansheets: i(t, "cleansheets"),
|
|
925
|
-
// Goalkeeper-specific
|
|
926
|
-
saves: i(t, "saves"),
|
|
927
|
-
conceded: i(t, "conceded"),
|
|
928
|
-
caughtBall: i(t, "caught_ball"),
|
|
929
|
-
penaltiesReceived: i(t, "penalties_received"),
|
|
930
|
-
// Other
|
|
931
|
-
offsides: i(t, "offsides"),
|
|
932
|
-
// Raw statistics array
|
|
933
|
-
rawStatistics: t.map((s) => ({
|
|
934
|
-
name: s.name,
|
|
935
|
-
value: s.value
|
|
936
|
-
}))
|
|
937
|
-
};
|
|
938
|
-
}
|
|
939
|
-
function l(e, t) {
|
|
940
|
-
if (!(e === void 0 && t === void 0))
|
|
941
|
-
return (e ?? 0) + (t ?? 0);
|
|
942
|
-
}
|
|
943
|
-
function le(e, t) {
|
|
944
|
-
return {
|
|
945
|
-
playerId: e.playerId,
|
|
946
|
-
seasonId: e.seasonId,
|
|
947
|
-
// Core statistics
|
|
948
|
-
appearances: l(e.appearances, t.appearances),
|
|
949
|
-
started: l(e.started, t.started),
|
|
950
|
-
substituteIn: l(e.substituteIn, t.substituteIn),
|
|
951
|
-
substituteOut: l(e.substituteOut, t.substituteOut),
|
|
952
|
-
minutes: l(e.minutes, t.minutes),
|
|
953
|
-
minutesSubstitute: l(e.minutesSubstitute, t.minutesSubstitute),
|
|
954
|
-
// Scoring
|
|
955
|
-
goals: l(e.goals, t.goals),
|
|
956
|
-
goalsSubstitute: l(e.goalsSubstitute, t.goalsSubstitute),
|
|
957
|
-
penaltyGoals: l(e.penaltyGoals, t.penaltyGoals),
|
|
958
|
-
ownGoals: l(e.ownGoals, t.ownGoals),
|
|
959
|
-
assists: l(e.assists, t.assists),
|
|
960
|
-
// Shooting
|
|
961
|
-
shots: l(e.shots, t.shots),
|
|
962
|
-
shotsOnTarget: l(e.shotsOnTarget, t.shotsOnTarget),
|
|
963
|
-
// Discipline
|
|
964
|
-
yellowCards: l(e.yellowCards, t.yellowCards),
|
|
965
|
-
redCards: l(e.redCards, t.redCards),
|
|
966
|
-
foulsCommitted: l(e.foulsCommitted, t.foulsCommitted),
|
|
967
|
-
penaltiesCommitted: l(e.penaltiesCommitted, t.penaltiesCommitted),
|
|
968
|
-
// Penalties
|
|
969
|
-
penaltiesMissed: l(e.penaltiesMissed, t.penaltiesMissed),
|
|
970
|
-
// Defensive
|
|
971
|
-
cleansheets: l(e.cleansheets, t.cleansheets),
|
|
972
|
-
// Goalkeeper-specific
|
|
973
|
-
saves: l(e.saves, t.saves),
|
|
974
|
-
conceded: l(e.conceded, t.conceded),
|
|
975
|
-
caughtBall: l(e.caughtBall, t.caughtBall),
|
|
976
|
-
penaltiesReceived: l(e.penaltiesReceived, t.penaltiesReceived),
|
|
977
|
-
// Other
|
|
978
|
-
offsides: l(e.offsides, t.offsides),
|
|
979
|
-
// Concatenate raw statistics from both entries
|
|
980
|
-
rawStatistics: [...e.rawStatistics ?? [], ...t.rawStatistics ?? []]
|
|
981
|
-
};
|
|
982
|
-
}
|
|
983
|
-
function me(e) {
|
|
984
|
-
return {
|
|
985
|
-
tournamentSeason: {
|
|
986
|
-
id: String(e.tournament_season.id),
|
|
987
|
-
name: e.tournament_season.name,
|
|
988
|
-
uuid: e.tournament_season.uuid,
|
|
989
|
-
active: e.tournament_season.active,
|
|
990
|
-
tournament: {
|
|
991
|
-
id: String(e.tournament_season.tournament.id),
|
|
992
|
-
name: e.tournament_season.tournament.name,
|
|
993
|
-
uuid: e.tournament_season.tournament.uuid,
|
|
994
|
-
type: e.tournament_season.tournament.type,
|
|
995
|
-
region: e.tournament_season.tournament.region,
|
|
996
|
-
logo: e.tournament_season.tournament.url_logo,
|
|
997
|
-
country: e.tournament_season.tournament.country ? {
|
|
998
|
-
id: String(e.tournament_season.tournament.country.id),
|
|
999
|
-
name: e.tournament_season.tournament.country.name,
|
|
1000
|
-
uuid: e.tournament_season.tournament.country.uuid
|
|
1001
|
-
} : void 0
|
|
1002
|
-
}
|
|
1003
|
-
},
|
|
1004
|
-
team: {
|
|
1005
|
-
id: String(e.team.id),
|
|
1006
|
-
name: e.team.name,
|
|
1007
|
-
uuid: e.team.uuid,
|
|
1008
|
-
threeLetterCode: e.team.three_letter_code,
|
|
1009
|
-
type: e.team.type,
|
|
1010
|
-
logo: e.team.url_logo
|
|
1011
|
-
},
|
|
1012
|
-
// Core statistics
|
|
1013
|
-
appearances: e.played,
|
|
1014
|
-
started: e.started,
|
|
1015
|
-
substituteIn: e.substitute_in,
|
|
1016
|
-
substituteOut: e.substitute_out,
|
|
1017
|
-
minutes: e.minutes,
|
|
1018
|
-
minutesSubstitute: e.minutes_substitute,
|
|
1019
|
-
// Scoring
|
|
1020
|
-
goals: e.goals,
|
|
1021
|
-
goalsSubstitute: e.goals_substitute,
|
|
1022
|
-
penaltyGoals: e.penalty_goals,
|
|
1023
|
-
ownGoals: e.own_goals,
|
|
1024
|
-
assists: e.assists,
|
|
1025
|
-
// Shooting
|
|
1026
|
-
shots: e.shots,
|
|
1027
|
-
shotsOnTarget: e.shots_on_target,
|
|
1028
|
-
// Discipline
|
|
1029
|
-
yellowCards: e.yellow_cards,
|
|
1030
|
-
redCards: e.red_cards,
|
|
1031
|
-
foulsCommitted: e.fouls_committed,
|
|
1032
|
-
penaltiesCommitted: e.penalties_committed,
|
|
1033
|
-
// Penalties
|
|
1034
|
-
penaltiesMissed: e.penalties_missed,
|
|
1035
|
-
penaltiesReceived: e.penalties_received,
|
|
1036
|
-
penaltiesSaved: e.penalties_saved,
|
|
1037
|
-
// Defensive
|
|
1038
|
-
cleansheets: e.cleansheets,
|
|
1039
|
-
// Other
|
|
1040
|
-
offsides: e.offsides,
|
|
1041
|
-
// Player context
|
|
1042
|
-
position: e.position,
|
|
1043
|
-
age: e.age,
|
|
1044
|
-
shirtNumber: e.shirt_number
|
|
1045
|
-
};
|
|
1046
|
-
}
|
|
1047
|
-
function ge(e) {
|
|
1048
|
-
const t = e[0];
|
|
1049
|
-
return {
|
|
1050
|
-
playerId: String(t.player.id),
|
|
1051
|
-
playerName: t.player.name,
|
|
1052
|
-
playerUuid: t.player.uuid,
|
|
1053
|
-
entries: e.map(me)
|
|
1054
|
-
};
|
|
1055
|
-
}
|
|
1056
|
-
function pe(e) {
|
|
1057
|
-
const t = parseInt(e, 10);
|
|
1058
|
-
return isNaN(t) ? void 0 : t;
|
|
1059
|
-
}
|
|
1060
|
-
function v(e, t) {
|
|
1061
|
-
const s = e.find((n) => n.name === t);
|
|
1062
|
-
return s ? pe(s.value) : void 0;
|
|
1063
|
-
}
|
|
1064
|
-
function fe(e) {
|
|
1065
|
-
return {
|
|
1066
|
-
id: e.id,
|
|
1067
|
-
name: e.name,
|
|
1068
|
-
uuid: e.uuid,
|
|
1069
|
-
threeLetterCode: e.three_letter_code,
|
|
1070
|
-
type: e.type,
|
|
1071
|
-
logo: e.assets?.logo?.url
|
|
1072
|
-
};
|
|
1073
|
-
}
|
|
1074
|
-
function _e(e) {
|
|
1075
|
-
const t = e.aggregated_statistics;
|
|
1076
|
-
return {
|
|
1077
|
-
playerId: e.player.id,
|
|
1078
|
-
playerName: e.player.name,
|
|
1079
|
-
playerUuid: e.player.uuid,
|
|
1080
|
-
position: e.player.position,
|
|
1081
|
-
teams: e.teams.map(fe),
|
|
1082
|
-
matches: e.matches.map(b),
|
|
1083
|
-
// Core statistics
|
|
1084
|
-
appearances: v(t, "played"),
|
|
1085
|
-
started: v(t, "started"),
|
|
1086
|
-
substituteIn: v(t, "substitute_in"),
|
|
1087
|
-
substituteOut: v(t, "substitute_out"),
|
|
1088
|
-
minutes: v(t, "minutes"),
|
|
1089
|
-
minutesSubstitute: v(t, "minutes_substitute"),
|
|
1090
|
-
// Scoring
|
|
1091
|
-
goals: v(t, "goals"),
|
|
1092
|
-
goalsSubstitute: v(t, "goals_substitute"),
|
|
1093
|
-
penaltyGoals: v(t, "penalty_goals"),
|
|
1094
|
-
assists: v(t, "assists"),
|
|
1095
|
-
// Discipline
|
|
1096
|
-
yellowCards: v(t, "yellow_cards"),
|
|
1097
|
-
redCards: v(t, "red_cards"),
|
|
1098
|
-
// Raw statistics array
|
|
1099
|
-
rawStatistics: t.map((s) => ({
|
|
1100
|
-
name: s.name,
|
|
1101
|
-
value: s.value
|
|
1102
|
-
}))
|
|
1103
|
-
};
|
|
1104
|
-
}
|
|
1105
|
-
async function ye(e, t) {
|
|
1106
|
-
const s = t || g(), { sportal365Sports: n } = s, { seasonIds: o, teamId: a, languageCode: c, next: r } = e, d = r ?? { revalidate: 0 }, f = {
|
|
1107
|
-
season_ids: o.join(","),
|
|
1108
|
-
team_id: a,
|
|
1109
|
-
language_code: c ?? n?.languageCode ?? "en"
|
|
1110
|
-
}, m = await p.get({
|
|
1111
|
-
path: "/v2/statistics/players/season",
|
|
1112
|
-
params: f,
|
|
1113
|
-
headers: {
|
|
1114
|
-
"Accept-Language": c ?? n?.languageCode ?? "en"
|
|
1115
|
-
},
|
|
1116
|
-
next: d,
|
|
1117
|
-
config: s
|
|
1118
|
-
});
|
|
1119
|
-
if (!m.statistics)
|
|
1120
|
-
return console.error("[getFootballPlayerSeasonStatistics] Invalid API response - missing statistics array:", {
|
|
1121
|
-
teamId: a,
|
|
1122
|
-
seasonIds: o,
|
|
1123
|
-
response: m
|
|
1124
|
-
}), {};
|
|
1125
|
-
if (m.statistics.length === 0)
|
|
1126
|
-
throw console.warn("[getFootballPlayerSeasonStatistics] API returned empty statistics array:", {
|
|
1127
|
-
teamId: a,
|
|
1128
|
-
seasonIds: o,
|
|
1129
|
-
hint: "This could be due to: wrong credentials, wrong project header, no data for this team/season, or API issue"
|
|
1130
|
-
}), new Error(
|
|
1131
|
-
`No player statistics found for team ${a} in seasons ${o.join(", ")}. This could be due to: wrong credentials, wrong X-Project header, or no data available for this team/season.`
|
|
1132
|
-
);
|
|
1133
|
-
const _ = {};
|
|
1134
|
-
for (const S of m.statistics) {
|
|
1135
|
-
const T = S.player.id;
|
|
1136
|
-
_[T] = ue(S, a);
|
|
1137
|
-
}
|
|
1138
|
-
return _;
|
|
1139
|
-
}
|
|
1140
|
-
async function Ze(e, t) {
|
|
1141
|
-
const s = t || g(), { sportal365Sports: n } = s, { playerIds: o, seasonIds: a, languageCode: c, next: r } = e, d = r ?? { revalidate: 0 }, f = {
|
|
1142
|
-
player_ids: o.join(","),
|
|
1143
|
-
season_ids: a.join(","),
|
|
1144
|
-
language_code: c ?? n?.languageCode ?? "en"
|
|
1145
|
-
}, m = await p.get({
|
|
1146
|
-
path: "/v2/statistics/players/season",
|
|
1147
|
-
params: f,
|
|
1148
|
-
headers: {
|
|
1149
|
-
"Accept-Language": c ?? n?.languageCode ?? "en"
|
|
1150
|
-
},
|
|
1151
|
-
next: d,
|
|
1152
|
-
config: s
|
|
1153
|
-
});
|
|
1154
|
-
if (!m.statistics)
|
|
1155
|
-
return console.error("[getFootballPlayerSeasonStatisticsByPlayerIds] Invalid API response - missing statistics array:", {
|
|
1156
|
-
playerIds: o,
|
|
1157
|
-
seasonIds: a,
|
|
1158
|
-
response: m
|
|
1159
|
-
}), {};
|
|
1160
|
-
if (m.statistics.length === 0)
|
|
1161
|
-
return {};
|
|
1162
|
-
const _ = {};
|
|
1163
|
-
for (const S of m.statistics) {
|
|
1164
|
-
const T = S.player.id, y = ce(S);
|
|
1165
|
-
_[T] ? _[T] = le(_[T], y) : _[T] = y;
|
|
1166
|
-
}
|
|
1167
|
-
return _;
|
|
1168
|
-
}
|
|
1169
|
-
async function we(e, t) {
|
|
1170
|
-
const s = t || g(), { sportal365Sports: n } = s, { playerId: o, languageCode: a, next: c } = e, r = c ?? { revalidate: 0 }, d = await p.get({
|
|
1171
|
-
path: `/players/${o}/statistics`,
|
|
1172
|
-
params: {
|
|
1173
|
-
language_code: a ?? n?.languageCode ?? "en"
|
|
1174
|
-
},
|
|
1175
|
-
headers: {
|
|
1176
|
-
"Accept-Language": a ?? n?.languageCode ?? "en"
|
|
1177
|
-
},
|
|
1178
|
-
next: r,
|
|
1179
|
-
config: s
|
|
1180
|
-
});
|
|
1181
|
-
if (!Array.isArray(d) || d.length === 0)
|
|
1182
|
-
throw new Error(
|
|
1183
|
-
`No career statistics found for player ${o}. This could be due to: invalid player ID/slug, wrong credentials, or no data available.`
|
|
1184
|
-
);
|
|
1185
|
-
return ge(d);
|
|
1186
|
-
}
|
|
1187
|
-
async function et(e, t) {
|
|
1188
|
-
const s = t || g(), { sportal365Sports: n } = s, { playerId: o, matches: a, tournamentIds: c, teamId: r, languageCode: d, next: f } = e, m = f ?? { revalidate: 0 }, _ = {
|
|
1189
|
-
language_code: d ?? n?.languageCode ?? "en"
|
|
1190
|
-
};
|
|
1191
|
-
a != null && (_.matches = String(a)), c?.length && (_.tournament_ids = c.join(",")), r && (_.team_id = r);
|
|
1192
|
-
const S = await p.get({
|
|
1193
|
-
path: `/v2/statistics/players/${o}/recent-statistics`,
|
|
1194
|
-
params: _,
|
|
1195
|
-
headers: {
|
|
1196
|
-
"Accept-Language": d ?? n?.languageCode ?? "en"
|
|
1197
|
-
},
|
|
1198
|
-
next: m,
|
|
1199
|
-
config: s
|
|
1200
|
-
});
|
|
1201
|
-
if (!S.player || !S.matches)
|
|
1202
|
-
throw new Error(
|
|
1203
|
-
`No recent statistics found for player ${o}. This could be due to: invalid player ID, wrong credentials, or no data available.`
|
|
1204
|
-
);
|
|
1205
|
-
return _e(S);
|
|
1206
|
-
}
|
|
1207
|
-
async function tt(e, t, s) {
|
|
1208
|
-
const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
|
|
1209
|
-
path: `/v2/teams/${e}`,
|
|
1210
|
-
params: {
|
|
1211
|
-
language_code: t?.languageCode ?? o?.languageCode ?? "en",
|
|
1212
|
-
optional_data: "form"
|
|
1213
|
-
},
|
|
1214
|
-
headers: {
|
|
1215
|
-
"Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
|
|
1216
|
-
},
|
|
1217
|
-
next: t?.next,
|
|
1218
|
-
config: n
|
|
1219
|
-
});
|
|
1220
|
-
return oe(a);
|
|
1221
|
-
}
|
|
1222
|
-
async function nt(e, t, s) {
|
|
1223
|
-
const n = s || g(), { sportal365Sports: o } = n, a = t?.seasonIds && t.seasonIds.length > 0 ? { revalidate: 0 } : t?.next, c = await p.get({
|
|
1224
|
-
path: `/v2/teams/${e}/squad`,
|
|
1225
|
-
params: {
|
|
1226
|
-
language_code: t?.languageCode ?? o?.languageCode ?? "en",
|
|
1227
|
-
memberStatus: t?.memberStatus ?? "ACTIVE"
|
|
1228
|
-
},
|
|
1229
|
-
headers: {
|
|
1230
|
-
"Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
|
|
1231
|
-
},
|
|
1232
|
-
next: a,
|
|
1233
|
-
config: n
|
|
1234
|
-
}), r = re(c);
|
|
1235
|
-
if (t?.seasonIds && t.seasonIds.length > 0)
|
|
1236
|
-
try {
|
|
1237
|
-
const d = await ye(
|
|
1238
|
-
{
|
|
1239
|
-
seasonIds: t.seasonIds,
|
|
1240
|
-
teamId: e,
|
|
1241
|
-
languageCode: t.languageCode,
|
|
1242
|
-
next: t.next
|
|
1243
|
-
},
|
|
1244
|
-
n
|
|
1245
|
-
);
|
|
1246
|
-
for (const f of r.players) {
|
|
1247
|
-
const m = d[f.id];
|
|
1248
|
-
m && (f.seasonStatistics = m);
|
|
1249
|
-
}
|
|
1250
|
-
} catch (d) {
|
|
1251
|
-
console.error("[getFootballTeamSquad] Failed to fetch player statistics:", {
|
|
1252
|
-
error: d instanceof Error ? d.message : String(d),
|
|
1253
|
-
stack: d instanceof Error ? d.stack : void 0,
|
|
1254
|
-
teamId: e,
|
|
1255
|
-
seasonIds: t.seasonIds
|
|
1256
|
-
});
|
|
1257
|
-
}
|
|
1258
|
-
else
|
|
1259
|
-
console.warn("[getFootballTeamSquad] No seasonIds provided, skipping stats fetch");
|
|
1260
|
-
return r;
|
|
1261
|
-
}
|
|
1262
|
-
function he(e) {
|
|
1263
|
-
return {
|
|
1264
|
-
id: String(e.id),
|
|
1265
|
-
name: e.name,
|
|
1266
|
-
slug: e.slug,
|
|
1267
|
-
type: e.type,
|
|
1268
|
-
region: e.region,
|
|
1269
|
-
gender: e.gender,
|
|
1270
|
-
country: {
|
|
1271
|
-
id: String(e.country.id),
|
|
1272
|
-
name: e.country.name,
|
|
1273
|
-
flag: e.country.url_flag,
|
|
1274
|
-
providerRef: u(e.country.uuid)
|
|
1275
|
-
},
|
|
1276
|
-
seasons: e.seasons.map((t) => ({
|
|
1277
|
-
id: String(t.id),
|
|
1278
|
-
name: t.name,
|
|
1279
|
-
slug: t.slug,
|
|
1280
|
-
active: t.active,
|
|
1281
|
-
providerRef: u(t.uuid)
|
|
1282
|
-
})),
|
|
1283
|
-
assets: e.url_logo ? {
|
|
1284
|
-
logo: e.url_logo
|
|
1285
|
-
} : void 0,
|
|
1286
|
-
providerRef: u(e.uuid)
|
|
1287
|
-
};
|
|
1288
|
-
}
|
|
1289
|
-
function ve(e) {
|
|
1290
|
-
const t = e.rounds.map((s) => ({
|
|
1291
|
-
id: s.id,
|
|
1292
|
-
name: s.name,
|
|
1293
|
-
key: s.key,
|
|
1294
|
-
type: s.type,
|
|
1295
|
-
status: s.status,
|
|
1296
|
-
startDate: s.start_date,
|
|
1297
|
-
endDate: s.end_date,
|
|
1298
|
-
providerRef: u(s.uuid)
|
|
1299
|
-
}));
|
|
1300
|
-
return {
|
|
1301
|
-
id: e.stage.id,
|
|
1302
|
-
name: e.stage.name,
|
|
1303
|
-
slug: e.stage.slug,
|
|
1304
|
-
shortName: e.stage.short_name ?? void 0,
|
|
1305
|
-
type: e.stage.type,
|
|
1306
|
-
status: e.stage.status,
|
|
1307
|
-
coverage: e.stage.coverage,
|
|
1308
|
-
order: e.stage.order_in_season,
|
|
1309
|
-
startDate: e.stage.start_date,
|
|
1310
|
-
endDate: e.stage.end_date,
|
|
1311
|
-
rounds: t,
|
|
1312
|
-
providerRef: u(e.stage.uuid)
|
|
1313
|
-
};
|
|
1314
|
-
}
|
|
1315
|
-
function Se(e) {
|
|
1316
|
-
const { season: t, stages: s } = e, { tournament: n } = t, o = {
|
|
1317
|
-
id: n.id,
|
|
1318
|
-
name: n.name,
|
|
1319
|
-
slug: n.slug,
|
|
1320
|
-
type: n.type,
|
|
1321
|
-
region: n.region,
|
|
1322
|
-
gender: n.gender,
|
|
1323
|
-
country: {
|
|
1324
|
-
id: n.country.id,
|
|
1325
|
-
name: n.country.name,
|
|
1326
|
-
code: n.country.code ?? void 0,
|
|
1327
|
-
flag: n.country.assets?.flag?.url,
|
|
1328
|
-
providerRef: u(n.country.uuid)
|
|
1329
|
-
},
|
|
1330
|
-
assets: n.assets?.logo?.url ? {
|
|
1331
|
-
logo: n.assets.logo.url
|
|
1332
|
-
} : void 0,
|
|
1333
|
-
providerRef: u(n.uuid)
|
|
1334
|
-
};
|
|
1335
|
-
return {
|
|
1336
|
-
id: t.id,
|
|
1337
|
-
name: t.name,
|
|
1338
|
-
slug: t.slug,
|
|
1339
|
-
active: t.status === "ACTIVE",
|
|
1340
|
-
status: t.status === "ACTIVE" ? "ACTIVE" : "INACTIVE",
|
|
1341
|
-
competition: o,
|
|
1342
|
-
stages: s.map(ve),
|
|
1343
|
-
providerRef: u(t.uuid)
|
|
1344
|
-
};
|
|
1345
|
-
}
|
|
1346
|
-
async function st(e, t, s) {
|
|
1347
|
-
const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
|
|
1348
|
-
path: `/tournaments/${e}`,
|
|
1349
|
-
params: {
|
|
1350
|
-
language_code: t?.languageCode ?? o?.languageCode ?? "en"
|
|
1351
|
-
},
|
|
1352
|
-
headers: {
|
|
1353
|
-
"Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
|
|
1354
|
-
},
|
|
1355
|
-
next: t?.next,
|
|
1356
|
-
config: n
|
|
1357
|
-
});
|
|
1358
|
-
return he(a);
|
|
1359
|
-
}
|
|
1360
|
-
async function ot(e, t) {
|
|
1361
|
-
const s = t || g(), { sportal365Sports: n } = s;
|
|
1362
|
-
if (!e?.seasonId && !e?.competitionId)
|
|
1363
|
-
throw new Error("Either seasonId or competitionId must be provided");
|
|
1364
|
-
const o = {
|
|
1365
|
-
language_code: e?.languageCode ?? n?.languageCode ?? "en"
|
|
1366
|
-
};
|
|
1367
|
-
e.seasonId ? o.season_id = e.seasonId : e.competitionId && (o.tournament_id = e.competitionId, e.status && (o.status = e.status));
|
|
1368
|
-
const a = await p.get({
|
|
1369
|
-
path: "/v2/seasons/details",
|
|
1370
|
-
params: o,
|
|
1371
|
-
headers: {
|
|
1372
|
-
"Accept-Language": e?.languageCode ?? n?.languageCode ?? "en"
|
|
1373
|
-
},
|
|
1374
|
-
next: e?.next,
|
|
1375
|
-
config: s
|
|
1376
|
-
});
|
|
1377
|
-
return Se(a);
|
|
1378
|
-
}
|
|
1379
|
-
function O(e) {
|
|
1380
|
-
return {
|
|
1381
|
-
championsleague: "championsLeague",
|
|
1382
|
-
europaleague: "europaLeague",
|
|
1383
|
-
conferenceleague: "conferenceLeague",
|
|
1384
|
-
relegation: "relegation",
|
|
1385
|
-
playoff: "playoff",
|
|
1386
|
-
promotion: "promotion"
|
|
1387
|
-
}[e.toLowerCase()] ?? e.toLowerCase().replace(/_/g, "");
|
|
1388
|
-
}
|
|
1389
|
-
function Ce(e) {
|
|
1390
|
-
const t = e.toLowerCase();
|
|
1391
|
-
return t === "relegation" ? "BOTTOM" : t === "playoff" ? "MIDDLE" : "TOP";
|
|
1392
|
-
}
|
|
1393
|
-
function Te(e, t) {
|
|
1394
|
-
if (!t || t.length === 0)
|
|
1395
|
-
return;
|
|
1396
|
-
const s = t.map((o) => {
|
|
1397
|
-
const a = o.event, c = a.home_team.id === e, r = c ? a.away_team : a.home_team, d = `${a.goal_home}-${a.goal_away}`;
|
|
1398
|
-
return {
|
|
1399
|
-
matchId: a.id.toString(),
|
|
1400
|
-
result: o.outcome,
|
|
1401
|
-
score: d,
|
|
1402
|
-
homeAway: c ? "HOME" : "AWAY",
|
|
1403
|
-
opponent: {
|
|
1404
|
-
id: r.id.toString(),
|
|
1405
|
-
name: r.name,
|
|
1406
|
-
logo: r.url_logo
|
|
1407
|
-
},
|
|
1408
|
-
date: new Date(a.start_time),
|
|
1409
|
-
competition: void 0
|
|
1410
|
-
// Football API doesn't include competition in form
|
|
1411
|
-
};
|
|
1412
|
-
}), n = s.map((o) => o.result).join("");
|
|
1413
|
-
return {
|
|
1414
|
-
competitorId: e.toString(),
|
|
1415
|
-
results: s,
|
|
1416
|
-
formString: n
|
|
1417
|
-
};
|
|
1418
|
-
}
|
|
1419
|
-
function Ie(e) {
|
|
1420
|
-
return {
|
|
1421
|
-
key: O(e.code),
|
|
1422
|
-
name: e.name,
|
|
1423
|
-
position: Ce(e.type)
|
|
1424
|
-
};
|
|
1425
|
-
}
|
|
1426
|
-
function be(e) {
|
|
1427
|
-
const t = {
|
|
1428
|
-
played: e.played,
|
|
1429
|
-
won: e.wins,
|
|
1430
|
-
drawn: e.draws,
|
|
1431
|
-
lost: e.defeits,
|
|
1432
|
-
goalsFor: e.goals_for,
|
|
1433
|
-
goalsAgainst: e.goals_against,
|
|
1434
|
-
goalDifference: e.goals_for - e.goals_against,
|
|
1435
|
-
points: e.points
|
|
1436
|
-
}, s = e.rules?.length > 0 ? e.rules.map((o) => O(o.code)) : void 0, n = Te(e.team.id, e.team.form ?? []);
|
|
1437
|
-
return {
|
|
1438
|
-
rank: e.rank,
|
|
1439
|
-
competitor: {
|
|
1440
|
-
id: e.team.id.toString(),
|
|
1441
|
-
name: e.team.name,
|
|
1442
|
-
shortName: e.team.short_name ?? void 0,
|
|
1443
|
-
logo: e.team.url_logo,
|
|
1444
|
-
uuid: e.team.uuid
|
|
1445
|
-
},
|
|
1446
|
-
stats: t,
|
|
1447
|
-
form: n,
|
|
1448
|
-
rules: s
|
|
1449
|
-
};
|
|
1450
|
-
}
|
|
1451
|
-
function Ae(e) {
|
|
1452
|
-
const t = e.map(be), s = /* @__PURE__ */ new Map();
|
|
1453
|
-
for (const n of e)
|
|
1454
|
-
if (n.rules)
|
|
1455
|
-
for (const o of n.rules) {
|
|
1456
|
-
const a = O(o.code);
|
|
1457
|
-
s.has(a) || s.set(a, Ie(o));
|
|
1458
|
-
}
|
|
1459
|
-
return {
|
|
1460
|
-
entries: t,
|
|
1461
|
-
metadata: {
|
|
1462
|
-
legend: Array.from(s.values())
|
|
1463
|
-
}
|
|
1464
|
-
};
|
|
1465
|
-
}
|
|
1466
|
-
async function at(e, t) {
|
|
1467
|
-
const s = t || g(), { sportal365Sports: n } = s, o = e.expand?.join(","), a = await p.get({
|
|
1468
|
-
path: `/tournaments/seasons/stages/${e.stageId}/standing`,
|
|
1469
|
-
params: {
|
|
1470
|
-
expand: o,
|
|
1471
|
-
language_code: e.languageCode ?? n?.languageCode ?? "en"
|
|
1472
|
-
},
|
|
1473
|
-
headers: {
|
|
1474
|
-
"Accept-Language": e.languageCode ?? n?.languageCode ?? "en"
|
|
1475
|
-
},
|
|
1476
|
-
next: e.next,
|
|
1477
|
-
config: s
|
|
1478
|
-
});
|
|
1479
|
-
return !a || a.length === 0 ? { entries: [], metadata: { legend: [] } } : Ae(a);
|
|
1480
|
-
}
|
|
1481
|
-
function x(e) {
|
|
1482
|
-
return {
|
|
1483
|
-
id: e.id,
|
|
1484
|
-
name: e.name,
|
|
1485
|
-
code: e.country_code,
|
|
1486
|
-
assets: e.assets?.flag ? {
|
|
1487
|
-
flag: e.assets.flag
|
|
1488
|
-
} : void 0,
|
|
1489
|
-
providerRef: [
|
|
1490
|
-
{
|
|
1491
|
-
provider: "fansunited",
|
|
1492
|
-
id: e.id
|
|
1493
|
-
}
|
|
1494
|
-
]
|
|
1495
|
-
};
|
|
1496
|
-
}
|
|
1497
|
-
function Ee(e) {
|
|
1498
|
-
return {
|
|
1499
|
-
id: e.id,
|
|
1500
|
-
name: e.name,
|
|
1501
|
-
type: e.type?.toUpperCase() || "LEAGUE",
|
|
1502
|
-
gender: e.gender?.toUpperCase(),
|
|
1503
|
-
country: e.country ? x(e.country) : void 0,
|
|
1504
|
-
assets: e.assets?.logo ? {
|
|
1505
|
-
logo: e.assets.logo
|
|
1506
|
-
} : void 0,
|
|
1507
|
-
providerRef: [
|
|
1508
|
-
{
|
|
1509
|
-
provider: "fansunited",
|
|
1510
|
-
id: e.id
|
|
1511
|
-
}
|
|
1512
|
-
]
|
|
1513
|
-
};
|
|
1514
|
-
}
|
|
1515
|
-
function Oe(e) {
|
|
1516
|
-
if (e.status) {
|
|
1517
|
-
const a = {
|
|
1518
|
-
notstarted: { code: "not_started", type: "NOT_STARTED", name: "Not Started" },
|
|
1519
|
-
live: { code: "live", type: "LIVE", name: "Live" },
|
|
1520
|
-
finished: { code: "finished", type: "FINISHED", name: "Finished" },
|
|
1521
|
-
postponed: { code: "postponed", type: "POSTPONED", name: "Postponed" },
|
|
1522
|
-
cancelled: { code: "cancelled", type: "CANCELLED", name: "Cancelled" },
|
|
1523
|
-
abandoned: { code: "abandoned", type: "ABANDONED", name: "Abandoned" }
|
|
1524
|
-
}[e.status.type];
|
|
1525
|
-
if (a)
|
|
1526
|
-
return a;
|
|
1527
|
-
}
|
|
1528
|
-
let t = "not_started", s = "NOT_STARTED", n = "Not Started";
|
|
1529
|
-
return e.finished_at ? (t = "finished", s = "FINISHED", n = "Finished") : e.started_at && (t = "live", s = "LIVE", n = "Live"), {
|
|
1530
|
-
code: t,
|
|
1531
|
-
name: n,
|
|
1532
|
-
type: s
|
|
1533
|
-
};
|
|
1534
|
-
}
|
|
1535
|
-
function Re(e) {
|
|
1536
|
-
return {
|
|
1537
|
-
kickoffTime: new Date(e.kickoff_at),
|
|
1538
|
-
currentMinute: e.minute ?? void 0,
|
|
1539
|
-
currentPeriod: void 0
|
|
1540
|
-
};
|
|
1541
|
-
}
|
|
1542
|
-
function P(e) {
|
|
1543
|
-
return {
|
|
1544
|
-
id: e.id,
|
|
1545
|
-
name: e.name,
|
|
1546
|
-
shortName: e.short_name ?? void 0,
|
|
1547
|
-
fullName: e.full_name ?? void 0,
|
|
1548
|
-
threeLetterCode: e.code,
|
|
1549
|
-
type: e.national ? "national" : "club",
|
|
1550
|
-
gender: e.gender?.toUpperCase(),
|
|
1551
|
-
country: e.country ? x(e.country) : void 0,
|
|
1552
|
-
assets: e.assets?.logo ? {
|
|
1553
|
-
logo: e.assets.logo
|
|
1554
|
-
} : void 0,
|
|
1555
|
-
providerRef: [
|
|
1556
|
-
{
|
|
1557
|
-
provider: "fansunited",
|
|
1558
|
-
id: e.id
|
|
1559
|
-
}
|
|
1560
|
-
]
|
|
1561
|
-
};
|
|
1562
|
-
}
|
|
1563
|
-
function Le(e) {
|
|
1564
|
-
if (!e) return;
|
|
1565
|
-
const t = (n) => n ? {
|
|
1566
|
-
competitorOne: n.home_goals !== null ? String(n.home_goals) : "0",
|
|
1567
|
-
competitorTwo: n.away_goals !== null ? String(n.away_goals) : "0"
|
|
1568
|
-
} : void 0, s = t(e.ft_score);
|
|
1569
|
-
if (s)
|
|
1570
|
-
return {
|
|
1571
|
-
competitorOne: s.competitorOne,
|
|
1572
|
-
competitorTwo: s.competitorTwo,
|
|
1573
|
-
breakdown: {
|
|
1574
|
-
total: s,
|
|
1575
|
-
halfTime: t(e.ht_score),
|
|
1576
|
-
regularTime: t(e.ft_score),
|
|
1577
|
-
extraTime: t(e.aet_score),
|
|
1578
|
-
penaltyShootout: t(e.pen_score)
|
|
1579
|
-
}
|
|
1580
|
-
};
|
|
1581
|
-
}
|
|
1582
|
-
function R(e) {
|
|
1583
|
-
return {
|
|
1584
|
-
id: e.id,
|
|
1585
|
-
sport: e.sport ?? "football",
|
|
1586
|
-
status: Oe(e),
|
|
1587
|
-
timing: Re(e),
|
|
1588
|
-
competitorOne: P(e.home_team),
|
|
1589
|
-
competitorTwo: P(e.away_team),
|
|
1590
|
-
score: Le(e.scores),
|
|
1591
|
-
competition: e.context?.competition ? Ee(e.context.competition) : void 0,
|
|
1592
|
-
lineupStatus: e.lineups_confirmed ? "CONFIRMED" : "NOT_AVAILABLE",
|
|
1593
|
-
updatedAt: e.updated_at ? new Date(e.updated_at) : void 0,
|
|
1594
|
-
isUndecided: e.undecided ?? void 0,
|
|
1595
|
-
providerRef: [
|
|
1596
|
-
{
|
|
1597
|
-
provider: "fansunited",
|
|
1598
|
-
id: e.id
|
|
1599
|
-
}
|
|
1600
|
-
]
|
|
1601
|
-
};
|
|
1602
|
-
}
|
|
1603
|
-
function it(e) {
|
|
1604
|
-
return R(e.data);
|
|
1605
|
-
}
|
|
1606
|
-
function rt(e) {
|
|
1607
|
-
return e.data.map(R);
|
|
1608
|
-
}
|
|
1609
|
-
function ke(e) {
|
|
1610
|
-
return e.map(R);
|
|
1611
|
-
}
|
|
1612
|
-
async function De(e, t, s) {
|
|
1613
|
-
const n = await e.loyalty.getTemplateMatches(
|
|
1614
|
-
t,
|
|
1615
|
-
s?.groupId,
|
|
1616
|
-
s?.disableCache
|
|
1617
|
-
);
|
|
1618
|
-
return ke(n);
|
|
1619
|
-
}
|
|
1620
|
-
async function dt(e, t, s, n) {
|
|
1621
|
-
return (await De(e, t, n)).filter((a) => a.competitorOne.id === s || a.competitorTwo.id === s);
|
|
1622
|
-
}
|
|
1623
|
-
async function ut(e, t, s) {
|
|
1624
|
-
const n = await e.loyalty.getTemplateById(t, s?.disableCache);
|
|
1625
|
-
return {
|
|
1626
|
-
id: n.id,
|
|
1627
|
-
name: n.name,
|
|
1628
|
-
description: n.description,
|
|
1629
|
-
type: n.type,
|
|
1630
|
-
fromDate: n.fromDate,
|
|
1631
|
-
toDate: n.toDate,
|
|
1632
|
-
markets: n.markets || [],
|
|
1633
|
-
teamIds: n.teamIds || [],
|
|
1634
|
-
matchIds: n.matchIds || [],
|
|
1635
|
-
groups: (n.groups || []).map((a) => ({
|
|
1636
|
-
groupId: a.groupId,
|
|
1637
|
-
label: a.label,
|
|
1638
|
-
flags: a.flags || [],
|
|
1639
|
-
filters: {
|
|
1640
|
-
fromDate: a.filters?.fromDate || "",
|
|
1641
|
-
toDate: a.filters?.toDate || "",
|
|
1642
|
-
matchIds: a.filters?.matchIds || []
|
|
1643
|
-
}
|
|
1644
|
-
})),
|
|
1645
|
-
gameIds: n.gameIds || [],
|
|
1646
|
-
gameTypes: n.gameTypes || [],
|
|
1647
|
-
competitionIds: n.competitionIds || [],
|
|
1648
|
-
excludedProfileIds: n.excludedProfileIds || [],
|
|
1649
|
-
rules: n.rules || "",
|
|
1650
|
-
labels: n.labels || {},
|
|
1651
|
-
customFields: n.customFields || {},
|
|
1652
|
-
// Convert BrandingModel to plain object
|
|
1653
|
-
branding: n.branding ? JSON.parse(JSON.stringify(n.branding)) : {},
|
|
1654
|
-
brandingId: null,
|
|
1655
|
-
// brandingId doesn't exist on TemplateByIdModel, using null
|
|
1656
|
-
flags: n.flags || [],
|
|
1657
|
-
images: {
|
|
1658
|
-
main: n.images?.main || null,
|
|
1659
|
-
cover: n.images?.cover || null,
|
|
1660
|
-
mobile: n.images?.mobile || null
|
|
1661
|
-
},
|
|
1662
|
-
status: n.status,
|
|
1663
|
-
automaticallyChangeStatus: n.automaticallyChangeStatus || !1,
|
|
1664
|
-
createdAt: n.createdAt,
|
|
1665
|
-
updatedAt: n.updatedAt,
|
|
1666
|
-
related: n.related || [],
|
|
1667
|
-
adContent: n.adContent || ""
|
|
1668
|
-
};
|
|
1669
|
-
}
|
|
1670
|
-
function Ne(e) {
|
|
1671
|
-
return {
|
|
1672
|
-
"1x2": "1X2",
|
|
1673
|
-
12: "12",
|
|
1674
|
-
OVER_UNDER: "OVER_UNDER",
|
|
1675
|
-
DOUBLE_CHANCE: "DOUBLE_CHANCE",
|
|
1676
|
-
BOTH_TO_SCORE: "BOTH_TO_SCORE",
|
|
1677
|
-
DRAW_NO_BET: "DRAW_NO_BET",
|
|
1678
|
-
FIRST_TEAM_TO_SCORE: "FIRST_TEAM_TO_SCORE",
|
|
1679
|
-
CORRECT_SCORE: "CORRECT_SCORE",
|
|
1680
|
-
FIRST_HALF_GOALS: "FIRST_HALF_GOALS",
|
|
1681
|
-
FIRST_PLAYER_TO_SCORE: "FIRST_PLAYER_TO_SCORE",
|
|
1682
|
-
PLAYER_TO_SCORE_DURING_GAME: "PLAYER_TO_SCORE_DURING_GAME",
|
|
1683
|
-
PLAYER_TO_RECEIVE_CARD: "PLAYER_TO_RECEIVE_CARD",
|
|
1684
|
-
FIRST_HALF_AND_FINAL_RESULT: "FIRST_HALF_AND_FINAL_RESULT"
|
|
1685
|
-
}[e] || e.toUpperCase();
|
|
1686
|
-
}
|
|
1687
|
-
function Fe(e, t) {
|
|
1688
|
-
const s = /* @__PURE__ */ new Map();
|
|
1689
|
-
return e.forEach((n, o) => {
|
|
1690
|
-
if (!n || n.length === 0)
|
|
1691
|
-
return;
|
|
1692
|
-
const c = (t ? n.filter((r) => r.bookmaker && t.includes(r.bookmaker.id)) : n).filter((r) => r.bookmaker && r.markets && r.markets.length > 0).map((r) => {
|
|
1693
|
-
const d = r.bookmaker, f = d.assets?.[0], m = d.branding?.backgroundColor || f?.backgroundColor, _ = d.branding?.textColor || (Pe(m) ? "#FFFFFF" : "#000000"), S = f?.transparentBackgroundUrl || f?.logo, T = d.eventUrls?.find((y) => y.appType === "desktop")?.url || d.links?.find((y) => y.appType === "desktop")?.homepageUrl || d.url || "";
|
|
1694
|
-
return {
|
|
1695
|
-
operator: {
|
|
1696
|
-
id: d.id,
|
|
1697
|
-
name: d.name,
|
|
1698
|
-
url: T,
|
|
1699
|
-
branding: {
|
|
1700
|
-
backgroundColor: m,
|
|
1701
|
-
textColor: _,
|
|
1702
|
-
logo: S
|
|
1703
|
-
}
|
|
1704
|
-
},
|
|
1705
|
-
type: r.type,
|
|
1706
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1707
|
-
markets: r.markets.map((y) => ({
|
|
1708
|
-
type: {
|
|
1709
|
-
id: y.type.id,
|
|
1710
|
-
code: y.type.code,
|
|
1711
|
-
name: y.type.name
|
|
1712
|
-
},
|
|
1713
|
-
period: {
|
|
1714
|
-
id: y.scope.id,
|
|
1715
|
-
type: y.scope.type,
|
|
1716
|
-
name: y.scope.name
|
|
1717
|
-
},
|
|
1718
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1719
|
-
selections: y.selections.map((C) => {
|
|
1720
|
-
const M = C.urls?.find((U) => U.appType === "desktop")?.url;
|
|
1721
|
-
let A = "NONE";
|
|
1722
|
-
return C.movement === "UP" ? A = "UP" : C.movement === "DOWN" && (A = "DOWN"), {
|
|
1723
|
-
id: C.id,
|
|
1724
|
-
name: C.name,
|
|
1725
|
-
code: C.code,
|
|
1726
|
-
value: C.value,
|
|
1727
|
-
odds: C.odds,
|
|
1728
|
-
oddsOld: C.oddsOld,
|
|
1729
|
-
movement: A,
|
|
1730
|
-
url: M,
|
|
1731
|
-
providerSelectionId: C.providerInfo?.selectionId
|
|
1732
|
-
};
|
|
1733
|
-
})
|
|
1734
|
-
}))
|
|
1735
|
-
};
|
|
1736
|
-
});
|
|
1737
|
-
s.set(o, c);
|
|
1738
|
-
}), s;
|
|
1739
|
-
}
|
|
1740
|
-
function Pe(e) {
|
|
1741
|
-
if (!e) return !0;
|
|
1742
|
-
const t = e.replace("#", ""), s = parseInt(t.substring(0, 2), 16), n = parseInt(t.substring(2, 4), 16), o = parseInt(t.substring(4, 6), 16);
|
|
1743
|
-
return (0.2126 * s + 0.7152 * n + 0.0722 * o) / 255 < 0.5;
|
|
1744
|
-
}
|
|
1745
|
-
async function ct(e, t, s) {
|
|
1746
|
-
if (!t || t.length === 0)
|
|
1747
|
-
return /* @__PURE__ */ new Map();
|
|
1748
|
-
const n = {
|
|
1749
|
-
oddType: s?.oddType || "ALL",
|
|
1750
|
-
scopeType: s?.scopeType || "ORDINARY_TIME",
|
|
1751
|
-
oddFormat: s?.oddFormat || "DECIMAL"
|
|
1752
|
-
};
|
|
1753
|
-
s?.marketTypes && s.marketTypes.length > 0 && (n.marketTypes = s.marketTypes.map((a) => Ne(a)));
|
|
1754
|
-
const o = await e.odds.getByMatchIds(t, n);
|
|
1755
|
-
return Fe(o, s?.bookmakerIds);
|
|
1756
|
-
}
|
|
1757
|
-
export {
|
|
1758
|
-
Ze as A,
|
|
1759
|
-
ot as B,
|
|
1760
|
-
at as C,
|
|
1761
|
-
tt as D,
|
|
1762
|
-
nt as E,
|
|
1763
|
-
De as F,
|
|
1764
|
-
dt as G,
|
|
1765
|
-
ut as H,
|
|
1766
|
-
Ye as I,
|
|
1767
|
-
xe as J,
|
|
1768
|
-
Ue as S,
|
|
1769
|
-
j as a,
|
|
1770
|
-
$e as b,
|
|
1771
|
-
$ as c,
|
|
1772
|
-
He as d,
|
|
1773
|
-
Be as e,
|
|
1774
|
-
p as f,
|
|
1775
|
-
g,
|
|
1776
|
-
Ge as h,
|
|
1777
|
-
it as i,
|
|
1778
|
-
rt as j,
|
|
1779
|
-
Me as k,
|
|
1780
|
-
Ve as l,
|
|
1781
|
-
ct as m,
|
|
1782
|
-
st as n,
|
|
1783
|
-
Qe as o,
|
|
1784
|
-
We as p,
|
|
1785
|
-
ze as q,
|
|
1786
|
-
je as r,
|
|
1787
|
-
Ke as s,
|
|
1788
|
-
u as t,
|
|
1789
|
-
qe as u,
|
|
1790
|
-
Xe as v,
|
|
1791
|
-
Je as w,
|
|
1792
|
-
we as x,
|
|
1793
|
-
et as y,
|
|
1794
|
-
ye as z
|
|
1795
|
-
};
|