fansunited-data-layer 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/sportal365-sports/basketball/games/index.d.ts +32 -0
- package/api/sportal365-sports/basketball/games/index.d.ts.map +1 -0
- package/api/sportal365-sports/basketball/games/transformers/game.d.ts +11 -0
- package/api/sportal365-sports/basketball/games/transformers/game.d.ts.map +1 -0
- package/api/sportal365-sports/basketball/games/types.d.ts +116 -0
- package/api/sportal365-sports/basketball/games/types.d.ts.map +1 -0
- package/api/sportal365-sports/basketball/http.d.ts +8 -0
- package/api/sportal365-sports/basketball/http.d.ts.map +1 -0
- package/api/sportal365-sports/basketball/index.d.ts +6 -0
- package/api/sportal365-sports/basketball/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/index.d.ts +2 -2
- package/api/sportal365-sports/football/index.d.ts.map +1 -1
- package/api/sportal365-sports/football/matches/index.d.ts +39 -2
- package/api/sportal365-sports/football/matches/index.d.ts.map +1 -1
- package/api/sportal365-sports/football/matches/types/index.d.ts +1 -1
- package/api/sportal365-sports/football/matches/types/index.d.ts.map +1 -1
- package/api/sportal365-sports/football/matches/types/option.types.d.ts +38 -0
- package/api/sportal365-sports/football/matches/types/option.types.d.ts.map +1 -1
- package/api/sportal365-sports/index.d.ts +6 -2
- package/api/sportal365-sports/index.d.ts.map +1 -1
- package/api/sportal365-sports/tennis/http.d.ts +8 -0
- package/api/sportal365-sports/tennis/http.d.ts.map +1 -0
- package/api/sportal365-sports/tennis/index.d.ts +6 -0
- package/api/sportal365-sports/tennis/index.d.ts.map +1 -0
- package/api/sportal365-sports/tennis/matches/index.d.ts +33 -0
- package/api/sportal365-sports/tennis/matches/index.d.ts.map +1 -0
- package/api/sportal365-sports/tennis/matches/transformers/match.d.ts +11 -0
- package/api/sportal365-sports/tennis/matches/transformers/match.d.ts.map +1 -0
- package/api/sportal365-sports/tennis/matches/types.d.ts +153 -0
- package/api/sportal365-sports/tennis/matches/types.d.ts.map +1 -0
- package/client.cjs +1 -1
- package/client.js +2 -2
- package/fansunited-data-layer.cjs +1 -1
- package/fansunited-data-layer.js +793 -461
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/matches-DRzEEGm5.cjs +1 -0
- package/{matches-CBFdPkPa.js → matches-KOom0gwu.js} +229 -198
- package/package.json +1 -1
- package/matches-DKjnuuq_.cjs +0 -1
package/fansunited-data-layer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import { useMemo as
|
|
4
|
-
function
|
|
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 de, h as le } from "./matches-KOom0gwu.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 Po, y as bo, z as ko, A as Ho, B as Bo, C as Uo, D as $o, E as xo } from "./matches-KOom0gwu.js";
|
|
3
|
+
import { useMemo as G } from "react";
|
|
4
|
+
function ue(e) {
|
|
5
5
|
return {
|
|
6
6
|
entityType: "tournament",
|
|
7
7
|
id: e.id.toString(),
|
|
@@ -15,15 +15,15 @@ function ae(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
|
-
function
|
|
26
|
+
function me(e) {
|
|
27
27
|
return {
|
|
28
28
|
entityType: "player",
|
|
29
29
|
id: e.id.toString(),
|
|
@@ -37,15 +37,15 @@ function ce(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
|
-
function
|
|
48
|
+
function fe(e) {
|
|
49
49
|
return {
|
|
50
50
|
entityType: "team",
|
|
51
51
|
id: e.id.toString(),
|
|
@@ -60,15 +60,15 @@ function le(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
|
-
function
|
|
71
|
+
function pe(e) {
|
|
72
72
|
return {
|
|
73
73
|
entityType: "president",
|
|
74
74
|
id: e.id.toString(),
|
|
@@ -80,15 +80,15 @@ function de(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
|
-
function
|
|
91
|
+
function ge(e) {
|
|
92
92
|
return {
|
|
93
93
|
entityType: "venue",
|
|
94
94
|
id: e.id.toString(),
|
|
@@ -102,16 +102,16 @@ function ue(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,10 +121,10 @@ function ue(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
|
-
function
|
|
127
|
+
function ye(e) {
|
|
128
128
|
return {
|
|
129
129
|
entityType: "coach",
|
|
130
130
|
id: e.id.toString(),
|
|
@@ -136,39 +136,39 @@ function me(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
|
-
function
|
|
147
|
+
function he(e) {
|
|
148
148
|
switch (e.entity_type) {
|
|
149
149
|
case "tournament":
|
|
150
|
-
return
|
|
150
|
+
return ue(e);
|
|
151
151
|
case "player":
|
|
152
|
-
return
|
|
152
|
+
return me(e);
|
|
153
153
|
case "team":
|
|
154
|
-
return
|
|
154
|
+
return fe(e);
|
|
155
155
|
case "president":
|
|
156
|
-
return
|
|
156
|
+
return pe(e);
|
|
157
157
|
case "venue":
|
|
158
|
-
return
|
|
158
|
+
return ge(e);
|
|
159
159
|
case "coach":
|
|
160
|
-
return
|
|
160
|
+
return ye(e);
|
|
161
161
|
default:
|
|
162
162
|
throw new Error(`Unknown entity type: ${e.entity_type}`);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
async function
|
|
165
|
+
async function Ot(e, t) {
|
|
166
166
|
if (!e.query || e.query.trim() === "")
|
|
167
167
|
return {
|
|
168
168
|
results: [],
|
|
169
169
|
query: e.query || ""
|
|
170
170
|
};
|
|
171
|
-
const o = t ||
|
|
171
|
+
const o = t || A(), { sportal365Sports: n } = o, s = e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["tournament", "player", "team", "president", "venue", "coach"], i = await se.get({
|
|
172
172
|
path: "/search",
|
|
173
173
|
params: {
|
|
174
174
|
query: e.query.trim(),
|
|
@@ -185,12 +185,341 @@ async function it(e, t) {
|
|
|
185
185
|
results: [],
|
|
186
186
|
query: e.query
|
|
187
187
|
} : {
|
|
188
|
-
results: i.map(
|
|
188
|
+
results: i.map(he),
|
|
189
189
|
query: e.query
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
|
-
const
|
|
193
|
-
function
|
|
192
|
+
const Te = V(ie);
|
|
193
|
+
function ve(e) {
|
|
194
|
+
return {
|
|
195
|
+
code: {
|
|
196
|
+
FINISHED: "finished",
|
|
197
|
+
NOT_STARTED: "not_started",
|
|
198
|
+
LIVE: "live",
|
|
199
|
+
INTERRUPTED: "interrupted",
|
|
200
|
+
CANCELLED: "cancelled",
|
|
201
|
+
POSTPONED: "postponed",
|
|
202
|
+
UNKNOWN: "not_started"
|
|
203
|
+
}[e.type] ?? "not_started",
|
|
204
|
+
name: e.name,
|
|
205
|
+
shortName: e.short_name,
|
|
206
|
+
type: e.type
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function Q(e) {
|
|
210
|
+
return {
|
|
211
|
+
id: e.id,
|
|
212
|
+
name: e.name,
|
|
213
|
+
threeLetterCode: e.three_letter_code,
|
|
214
|
+
slug: e.slug,
|
|
215
|
+
type: e.type === "national" ? "national" : "club",
|
|
216
|
+
gender: e.gender
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function _e(e) {
|
|
220
|
+
return {
|
|
221
|
+
kickoffTime: new Date(e.game_time),
|
|
222
|
+
currentMinute: e.minute
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
function Se(e) {
|
|
226
|
+
if (!e.season?.competition) return;
|
|
227
|
+
const t = e.season.competition;
|
|
228
|
+
return {
|
|
229
|
+
id: t.id,
|
|
230
|
+
name: t.name,
|
|
231
|
+
slug: t.slug,
|
|
232
|
+
type: "LEAGUE",
|
|
233
|
+
gender: t.gender,
|
|
234
|
+
region: t.region,
|
|
235
|
+
country: t.country ? {
|
|
236
|
+
id: t.country.id,
|
|
237
|
+
name: t.country.name
|
|
238
|
+
} : void 0,
|
|
239
|
+
season: {
|
|
240
|
+
id: e.season.id,
|
|
241
|
+
name: e.season.name,
|
|
242
|
+
status: e.season.status
|
|
243
|
+
},
|
|
244
|
+
stage: e.stage ? {
|
|
245
|
+
id: e.stage.id,
|
|
246
|
+
name: e.stage.name,
|
|
247
|
+
type: e.stage.type
|
|
248
|
+
} : void 0
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
function Ce(e) {
|
|
252
|
+
if (e)
|
|
253
|
+
return {
|
|
254
|
+
id: e.id,
|
|
255
|
+
name: e.name,
|
|
256
|
+
slug: e.slug
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function Ae(e) {
|
|
260
|
+
if (!e || e.length === 0) return;
|
|
261
|
+
let t = 0, o = 0;
|
|
262
|
+
const n = [];
|
|
263
|
+
for (const s of e)
|
|
264
|
+
t += s.home, o += s.away, n.push({
|
|
265
|
+
competitorOne: String(s.home),
|
|
266
|
+
competitorTwo: String(s.away)
|
|
267
|
+
});
|
|
268
|
+
return {
|
|
269
|
+
competitorOne: String(t),
|
|
270
|
+
competitorTwo: String(o),
|
|
271
|
+
breakdown: {
|
|
272
|
+
total: {
|
|
273
|
+
competitorOne: String(t),
|
|
274
|
+
competitorTwo: String(o)
|
|
275
|
+
},
|
|
276
|
+
periods: n
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
function Oe(e) {
|
|
281
|
+
if (e.winner)
|
|
282
|
+
return {
|
|
283
|
+
competitorId: e.winner.id
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
function Ne(e) {
|
|
287
|
+
return {
|
|
288
|
+
id: e.id,
|
|
289
|
+
slug: e.slug,
|
|
290
|
+
status: ve(e.status),
|
|
291
|
+
timing: _e(e),
|
|
292
|
+
competitorOne: Q(e.home_team),
|
|
293
|
+
competitorTwo: Q(e.away_team),
|
|
294
|
+
competition: Se(e),
|
|
295
|
+
round: e.round ? {
|
|
296
|
+
id: e.round.id,
|
|
297
|
+
key: e.round.uuid,
|
|
298
|
+
name: e.round.name,
|
|
299
|
+
type: "REGULAR",
|
|
300
|
+
providerRef: _(e.round.uuid)
|
|
301
|
+
} : void 0,
|
|
302
|
+
venue: Ce(e.arena),
|
|
303
|
+
score: Ae(e.score),
|
|
304
|
+
winner: Oe(e),
|
|
305
|
+
coverage: e.coverage === "NOT_LIVE" ? "UNKNOWN" : e.coverage,
|
|
306
|
+
providerRef: [
|
|
307
|
+
{
|
|
308
|
+
provider: "sportal365-basketball",
|
|
309
|
+
id: e.id
|
|
310
|
+
}
|
|
311
|
+
]
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
async function Nt(e, t) {
|
|
315
|
+
const o = t || A(), { sportal365Sports: n } = o;
|
|
316
|
+
return (await Te.get({
|
|
317
|
+
path: "/games",
|
|
318
|
+
params: {
|
|
319
|
+
offset: "0",
|
|
320
|
+
limit: "1000",
|
|
321
|
+
competition_list: e?.competitionList,
|
|
322
|
+
status_type: e?.statusTypes,
|
|
323
|
+
odd_client: e?.oddClient ?? n?.oddClient,
|
|
324
|
+
odd_type: e?.oddType,
|
|
325
|
+
market_types: e?.marketTypes
|
|
326
|
+
},
|
|
327
|
+
headers: {
|
|
328
|
+
"Accept-Language": e?.languageCode ?? n?.languageCode ?? "en"
|
|
329
|
+
},
|
|
330
|
+
next: e?.next,
|
|
331
|
+
config: o
|
|
332
|
+
})).games.map(Ne);
|
|
333
|
+
}
|
|
334
|
+
const Re = V(re);
|
|
335
|
+
function Ee(e) {
|
|
336
|
+
return {
|
|
337
|
+
code: {
|
|
338
|
+
FINISHED: "finished",
|
|
339
|
+
NOT_STARTED: "not_started",
|
|
340
|
+
LIVE: "live",
|
|
341
|
+
INTERRUPTED: "interrupted",
|
|
342
|
+
CANCELLED: "cancelled",
|
|
343
|
+
POSTPONED: "postponed"
|
|
344
|
+
}[e.type] ?? "not_started",
|
|
345
|
+
name: e.name,
|
|
346
|
+
shortName: e.short_name,
|
|
347
|
+
type: e.type
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
function X(e) {
|
|
351
|
+
if (e.type === "PLAYER")
|
|
352
|
+
return {
|
|
353
|
+
id: e.id,
|
|
354
|
+
name: e.name,
|
|
355
|
+
shortName: e.short_name,
|
|
356
|
+
threeLetterCode: e.three_letter_code,
|
|
357
|
+
type: "player",
|
|
358
|
+
country: e.details?.[0]?.country ? {
|
|
359
|
+
id: e.details[0].country.id,
|
|
360
|
+
name: e.details[0].country.name
|
|
361
|
+
} : void 0,
|
|
362
|
+
gender: e.details?.[0]?.gender
|
|
363
|
+
};
|
|
364
|
+
if (e.type === "TEAM_DOUBLE" && e.details && e.details.length === 2) {
|
|
365
|
+
const t = {
|
|
366
|
+
id: e.details[0].id,
|
|
367
|
+
name: e.details[0].name,
|
|
368
|
+
shortName: e.details[0].short_name,
|
|
369
|
+
threeLetterCode: e.details[0].three_letter_code,
|
|
370
|
+
type: "player",
|
|
371
|
+
country: e.details[0].country ? {
|
|
372
|
+
id: e.details[0].country.id,
|
|
373
|
+
name: e.details[0].country.name
|
|
374
|
+
} : void 0,
|
|
375
|
+
gender: e.details[0].gender
|
|
376
|
+
}, o = {
|
|
377
|
+
id: e.details[1].id,
|
|
378
|
+
name: e.details[1].name,
|
|
379
|
+
shortName: e.details[1].short_name,
|
|
380
|
+
threeLetterCode: e.details[1].three_letter_code,
|
|
381
|
+
type: "player",
|
|
382
|
+
country: e.details[1].country ? {
|
|
383
|
+
id: e.details[1].country.id,
|
|
384
|
+
name: e.details[1].country.name
|
|
385
|
+
} : void 0,
|
|
386
|
+
gender: e.details[1].gender
|
|
387
|
+
};
|
|
388
|
+
return {
|
|
389
|
+
id: e.id,
|
|
390
|
+
name: e.name,
|
|
391
|
+
shortName: e.short_name,
|
|
392
|
+
threeLetterCode: e.three_letter_code,
|
|
393
|
+
type: "pair",
|
|
394
|
+
players: [t, o]
|
|
395
|
+
};
|
|
396
|
+
} else
|
|
397
|
+
return {
|
|
398
|
+
id: e.id,
|
|
399
|
+
name: e.name,
|
|
400
|
+
shortName: e.short_name,
|
|
401
|
+
threeLetterCode: e.three_letter_code,
|
|
402
|
+
type: "national",
|
|
403
|
+
country: e.details?.[0]?.country ? {
|
|
404
|
+
id: e.details[0].country.id,
|
|
405
|
+
name: e.details[0].country.name
|
|
406
|
+
} : void 0,
|
|
407
|
+
gender: e.details?.[0]?.gender
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
function Fe(e) {
|
|
411
|
+
return {
|
|
412
|
+
kickoffTime: new Date(e.scheduled_start_time),
|
|
413
|
+
phaseStartedAt: e.started_at ? new Date(e.started_at) : void 0,
|
|
414
|
+
finishedAt: e.finished_at ? new Date(e.finished_at) : void 0
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
function Me(e) {
|
|
418
|
+
if (!e.tournament) return;
|
|
419
|
+
const t = e.tournament;
|
|
420
|
+
return {
|
|
421
|
+
id: t.competition?.id ?? t.id,
|
|
422
|
+
name: t.competition?.name ?? t.name,
|
|
423
|
+
slug: t.competition?.slug ?? t.slug,
|
|
424
|
+
type: "TOURNAMENT",
|
|
425
|
+
gender: t.gender,
|
|
426
|
+
region: "INTERNATIONAL",
|
|
427
|
+
country: t.country ? {
|
|
428
|
+
id: t.country.id,
|
|
429
|
+
name: t.country.name
|
|
430
|
+
} : void 0
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
function Le(e) {
|
|
434
|
+
if (!e.results || e.results.length === 0) return;
|
|
435
|
+
const t = [];
|
|
436
|
+
let o = 0, n = 0;
|
|
437
|
+
for (const s of e.results) {
|
|
438
|
+
const i = s.values.find((a) => a.position === "1"), r = s.values.find((a) => a.position === "2");
|
|
439
|
+
i && r && (t.push({
|
|
440
|
+
competitorOne: i.value,
|
|
441
|
+
competitorTwo: r.value
|
|
442
|
+
}), parseInt(i.value) > parseInt(r.value) && o++, parseInt(r.value) > parseInt(i.value) && n++);
|
|
443
|
+
}
|
|
444
|
+
return {
|
|
445
|
+
competitorOne: String(o),
|
|
446
|
+
competitorTwo: String(n),
|
|
447
|
+
breakdown: {
|
|
448
|
+
total: {
|
|
449
|
+
competitorOne: String(o),
|
|
450
|
+
competitorTwo: String(n)
|
|
451
|
+
},
|
|
452
|
+
periods: t
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
function Ie(e) {
|
|
457
|
+
const t = e.participants.find((o) => o.winner === "YES");
|
|
458
|
+
if (t)
|
|
459
|
+
return {
|
|
460
|
+
competitorId: t.id
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
function De(e) {
|
|
464
|
+
const t = e.participants.sort((o, n) => o.position - n.position);
|
|
465
|
+
return {
|
|
466
|
+
id: e.id,
|
|
467
|
+
slug: e.slug,
|
|
468
|
+
status: Ee(e.status),
|
|
469
|
+
timing: Fe(e),
|
|
470
|
+
competitorOne: X(t[0]),
|
|
471
|
+
competitorTwo: X(t[1]),
|
|
472
|
+
competition: Me(e),
|
|
473
|
+
round: e.round ? {
|
|
474
|
+
id: e.round.id,
|
|
475
|
+
key: e.round.uuid,
|
|
476
|
+
name: e.round.name,
|
|
477
|
+
type: "REGULAR",
|
|
478
|
+
providerRef: _(e.round.uuid)
|
|
479
|
+
} : void 0,
|
|
480
|
+
score: Le(e),
|
|
481
|
+
winner: Ie(e),
|
|
482
|
+
coverage: e.coverage?.type === "NOT_LIVE" ? "UNKNOWN" : e.coverage?.type,
|
|
483
|
+
metadata: {
|
|
484
|
+
matchType: e.type,
|
|
485
|
+
bestOfSets: e.best_of_sets,
|
|
486
|
+
surface: e.tournament?.surface,
|
|
487
|
+
indoorOutdoor: e.tournament?.indoor_outdoor
|
|
488
|
+
},
|
|
489
|
+
providerRef: [
|
|
490
|
+
{
|
|
491
|
+
provider: "sportal365-tennis",
|
|
492
|
+
id: e.id
|
|
493
|
+
}
|
|
494
|
+
]
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
async function Rt(e, t) {
|
|
498
|
+
const o = t || A(), { sportal365Sports: n } = o;
|
|
499
|
+
return (await Re.get({
|
|
500
|
+
path: "/matches/livescore",
|
|
501
|
+
params: {
|
|
502
|
+
date: e?.date,
|
|
503
|
+
utc_offset: e?.utcOffset?.toString(),
|
|
504
|
+
offset: "0",
|
|
505
|
+
limit: "1000",
|
|
506
|
+
type: e?.type,
|
|
507
|
+
gender: e?.gender,
|
|
508
|
+
status_type: e?.statusType,
|
|
509
|
+
competition_list: e?.competitionList,
|
|
510
|
+
odd_client: e?.oddClient ?? n?.oddClient,
|
|
511
|
+
odd_type: e?.oddType,
|
|
512
|
+
market_types: e?.marketTypes
|
|
513
|
+
},
|
|
514
|
+
headers: {
|
|
515
|
+
"Accept-Language": e?.languageCode ?? n?.languageCode ?? "en"
|
|
516
|
+
},
|
|
517
|
+
next: e?.next,
|
|
518
|
+
config: o
|
|
519
|
+
})).matches.map(De);
|
|
520
|
+
}
|
|
521
|
+
const Ge = V(ae);
|
|
522
|
+
function R(e) {
|
|
194
523
|
return {
|
|
195
524
|
language: e.language,
|
|
196
525
|
name: e.name,
|
|
@@ -198,13 +527,13 @@ function M(e) {
|
|
|
198
527
|
threeLetterCode: e.three_letter_code ?? void 0
|
|
199
528
|
};
|
|
200
529
|
}
|
|
201
|
-
function
|
|
530
|
+
function E(e) {
|
|
202
531
|
if (!(!e || !e.url))
|
|
203
532
|
return {
|
|
204
533
|
url: e.url
|
|
205
534
|
};
|
|
206
535
|
}
|
|
207
|
-
function
|
|
536
|
+
function D(e) {
|
|
208
537
|
if (e)
|
|
209
538
|
return {
|
|
210
539
|
id: e.id,
|
|
@@ -212,13 +541,13 @@ function N(e) {
|
|
|
212
541
|
name: e.name,
|
|
213
542
|
shortName: e.short_name ?? void 0,
|
|
214
543
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
215
|
-
translations: e.translations.map(
|
|
216
|
-
displayAsset:
|
|
544
|
+
translations: e.translations.map(R),
|
|
545
|
+
displayAsset: E(e.display_asset),
|
|
217
546
|
slug: e.slug,
|
|
218
547
|
providerRef: e.id
|
|
219
548
|
};
|
|
220
549
|
}
|
|
221
|
-
function
|
|
550
|
+
function K(e) {
|
|
222
551
|
return {
|
|
223
552
|
entityType: "team",
|
|
224
553
|
id: e.id,
|
|
@@ -226,12 +555,12 @@ function V(e) {
|
|
|
226
555
|
name: e.name,
|
|
227
556
|
shortName: e.short_name ?? void 0,
|
|
228
557
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
229
|
-
translations: e.translations.map(
|
|
230
|
-
displayAsset:
|
|
558
|
+
translations: e.translations.map(R),
|
|
559
|
+
displayAsset: E(e.display_asset),
|
|
231
560
|
slug: e.slug,
|
|
232
561
|
tagScore: e.tag_score ?? void 0,
|
|
233
562
|
sport: e.sport,
|
|
234
|
-
country:
|
|
563
|
+
country: D(e.country),
|
|
235
564
|
gender: e.gender,
|
|
236
565
|
competitionIds: e.competition_ids,
|
|
237
566
|
type: e.type,
|
|
@@ -240,7 +569,7 @@ function V(e) {
|
|
|
240
569
|
providerRef: e.id
|
|
241
570
|
};
|
|
242
571
|
}
|
|
243
|
-
function
|
|
572
|
+
function ee(e) {
|
|
244
573
|
return {
|
|
245
574
|
entityType: "city",
|
|
246
575
|
id: e.id,
|
|
@@ -248,16 +577,16 @@ function Z(e) {
|
|
|
248
577
|
name: e.name,
|
|
249
578
|
shortName: e.short_name ?? void 0,
|
|
250
579
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
251
|
-
translations: e.translations.map(
|
|
252
|
-
displayAsset:
|
|
580
|
+
translations: e.translations.map(R),
|
|
581
|
+
displayAsset: E(e.display_asset),
|
|
253
582
|
slug: e.slug,
|
|
254
583
|
tagScore: e.tag_score ?? void 0,
|
|
255
584
|
sport: e.sport,
|
|
256
|
-
country:
|
|
585
|
+
country: D(e.country),
|
|
257
586
|
providerRef: e.id
|
|
258
587
|
};
|
|
259
588
|
}
|
|
260
|
-
function
|
|
589
|
+
function Pe(e) {
|
|
261
590
|
return {
|
|
262
591
|
entityType: "horse",
|
|
263
592
|
id: e.id,
|
|
@@ -265,17 +594,17 @@ function pe(e) {
|
|
|
265
594
|
name: e.name,
|
|
266
595
|
shortName: e.short_name ?? void 0,
|
|
267
596
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
268
|
-
translations: e.translations.map(
|
|
269
|
-
displayAsset:
|
|
597
|
+
translations: e.translations.map(R),
|
|
598
|
+
displayAsset: E(e.display_asset),
|
|
270
599
|
slug: e.slug,
|
|
271
600
|
tagScore: e.tag_score ?? void 0,
|
|
272
601
|
sport: e.sport,
|
|
273
|
-
country:
|
|
602
|
+
country: D(e.country),
|
|
274
603
|
gender: e.gender,
|
|
275
604
|
providerRef: e.id
|
|
276
605
|
};
|
|
277
606
|
}
|
|
278
|
-
function
|
|
607
|
+
function be(e) {
|
|
279
608
|
return {
|
|
280
609
|
entityType: "player",
|
|
281
610
|
id: e.id,
|
|
@@ -283,19 +612,19 @@ function ye(e) {
|
|
|
283
612
|
name: e.name,
|
|
284
613
|
shortName: e.short_name ?? void 0,
|
|
285
614
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
286
|
-
translations: e.translations.map(
|
|
287
|
-
displayAsset:
|
|
615
|
+
translations: e.translations.map(R),
|
|
616
|
+
displayAsset: E(e.display_asset),
|
|
288
617
|
slug: e.slug,
|
|
289
618
|
tagScore: e.tag_score ?? void 0,
|
|
290
619
|
sport: e.sport,
|
|
291
|
-
country:
|
|
620
|
+
country: D(e.country),
|
|
292
621
|
gender: e.gender,
|
|
293
622
|
birthdate: e.birthdate ?? void 0,
|
|
294
623
|
position: e.position ?? void 0,
|
|
295
624
|
providerRef: e.id
|
|
296
625
|
};
|
|
297
626
|
}
|
|
298
|
-
function
|
|
627
|
+
function ke(e) {
|
|
299
628
|
return {
|
|
300
629
|
entityType: "coach",
|
|
301
630
|
id: e.id,
|
|
@@ -303,18 +632,18 @@ function he(e) {
|
|
|
303
632
|
name: e.name,
|
|
304
633
|
shortName: e.short_name ?? void 0,
|
|
305
634
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
306
|
-
translations: e.translations.map(
|
|
307
|
-
displayAsset:
|
|
635
|
+
translations: e.translations.map(R),
|
|
636
|
+
displayAsset: E(e.display_asset),
|
|
308
637
|
slug: e.slug,
|
|
309
638
|
tagScore: e.tag_score ?? void 0,
|
|
310
639
|
sport: e.sport,
|
|
311
|
-
country:
|
|
640
|
+
country: D(e.country),
|
|
312
641
|
gender: e.gender,
|
|
313
642
|
birthdate: e.birthdate ?? void 0,
|
|
314
643
|
providerRef: e.id
|
|
315
644
|
};
|
|
316
645
|
}
|
|
317
|
-
function
|
|
646
|
+
function He(e) {
|
|
318
647
|
return {
|
|
319
648
|
entityType: "referee",
|
|
320
649
|
id: e.id,
|
|
@@ -322,18 +651,18 @@ function Te(e) {
|
|
|
322
651
|
name: e.name,
|
|
323
652
|
shortName: e.short_name ?? void 0,
|
|
324
653
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
325
|
-
translations: e.translations.map(
|
|
326
|
-
displayAsset:
|
|
654
|
+
translations: e.translations.map(R),
|
|
655
|
+
displayAsset: E(e.display_asset),
|
|
327
656
|
slug: e.slug,
|
|
328
657
|
tagScore: e.tag_score ?? void 0,
|
|
329
658
|
sport: e.sport,
|
|
330
|
-
country:
|
|
659
|
+
country: D(e.country),
|
|
331
660
|
gender: e.gender,
|
|
332
661
|
birthdate: e.birthdate ?? void 0,
|
|
333
662
|
providerRef: e.id
|
|
334
663
|
};
|
|
335
664
|
}
|
|
336
|
-
function
|
|
665
|
+
function Be(e) {
|
|
337
666
|
return {
|
|
338
667
|
entityType: "venue",
|
|
339
668
|
id: e.id,
|
|
@@ -341,17 +670,17 @@ function ve(e) {
|
|
|
341
670
|
name: e.name,
|
|
342
671
|
shortName: e.short_name ?? void 0,
|
|
343
672
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
344
|
-
translations: e.translations.map(
|
|
345
|
-
displayAsset:
|
|
673
|
+
translations: e.translations.map(R),
|
|
674
|
+
displayAsset: E(e.display_asset),
|
|
346
675
|
slug: e.slug,
|
|
347
676
|
tagScore: e.tag_score ?? void 0,
|
|
348
677
|
sport: e.sport,
|
|
349
|
-
country:
|
|
350
|
-
city: e.city ?
|
|
678
|
+
country: D(e.country),
|
|
679
|
+
city: e.city ? ee(e.city) : void 0,
|
|
351
680
|
providerRef: e.id
|
|
352
681
|
};
|
|
353
682
|
}
|
|
354
|
-
function
|
|
683
|
+
function Ue(e) {
|
|
355
684
|
return {
|
|
356
685
|
entityType: e.entity_type,
|
|
357
686
|
id: e.id,
|
|
@@ -359,19 +688,19 @@ function Se(e) {
|
|
|
359
688
|
name: e.name,
|
|
360
689
|
shortName: e.short_name ?? void 0,
|
|
361
690
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
362
|
-
translations: e.translations.map(
|
|
363
|
-
displayAsset:
|
|
691
|
+
translations: e.translations.map(R),
|
|
692
|
+
displayAsset: E(e.display_asset),
|
|
364
693
|
slug: e.slug,
|
|
365
694
|
tagScore: e.tag_score ?? void 0,
|
|
366
695
|
sport: e.sport,
|
|
367
|
-
country:
|
|
696
|
+
country: D(e.country),
|
|
368
697
|
gender: e.gender,
|
|
369
698
|
type: e.type ?? void 0,
|
|
370
699
|
region: e.region ?? void 0,
|
|
371
700
|
providerRef: e.id
|
|
372
701
|
};
|
|
373
702
|
}
|
|
374
|
-
function
|
|
703
|
+
function $e(e) {
|
|
375
704
|
return {
|
|
376
705
|
entityType: "match",
|
|
377
706
|
id: e.id,
|
|
@@ -379,19 +708,19 @@ function _e(e) {
|
|
|
379
708
|
name: e.name,
|
|
380
709
|
shortName: e.short_name ?? void 0,
|
|
381
710
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
382
|
-
translations: e.translations.map(
|
|
383
|
-
displayAsset:
|
|
711
|
+
translations: e.translations.map(R),
|
|
712
|
+
displayAsset: E(e.display_asset),
|
|
384
713
|
slug: e.slug,
|
|
385
714
|
tagScore: e.tag_score ?? void 0,
|
|
386
715
|
sport: e.sport,
|
|
387
716
|
competitionId: e.competition_id ?? void 0,
|
|
388
717
|
startTime: e.start_time ?? void 0,
|
|
389
|
-
homeTeam: e.home_team ?
|
|
390
|
-
awayTeam: e.away_team ?
|
|
718
|
+
homeTeam: e.home_team ? K(e.home_team) : void 0,
|
|
719
|
+
awayTeam: e.away_team ? K(e.away_team) : void 0,
|
|
391
720
|
providerRef: e.id
|
|
392
721
|
};
|
|
393
722
|
}
|
|
394
|
-
function
|
|
723
|
+
function xe(e) {
|
|
395
724
|
return {
|
|
396
725
|
entityType: "country",
|
|
397
726
|
id: e.id,
|
|
@@ -399,47 +728,47 @@ function Ce(e) {
|
|
|
399
728
|
name: e.name,
|
|
400
729
|
shortName: e.short_name ?? void 0,
|
|
401
730
|
threeLetterCode: e.three_letter_code ?? void 0,
|
|
402
|
-
translations: e.translations.map(
|
|
403
|
-
displayAsset:
|
|
731
|
+
translations: e.translations.map(R),
|
|
732
|
+
displayAsset: E(e.display_asset),
|
|
404
733
|
slug: e.slug,
|
|
405
734
|
tagScore: e.tag_score ?? void 0,
|
|
406
735
|
sport: e.sport,
|
|
407
736
|
providerRef: e.id
|
|
408
737
|
};
|
|
409
738
|
}
|
|
410
|
-
function
|
|
739
|
+
function We(e) {
|
|
411
740
|
switch (e.entity_type) {
|
|
412
741
|
case "team":
|
|
413
|
-
return
|
|
742
|
+
return K(e);
|
|
414
743
|
case "city":
|
|
415
|
-
return
|
|
744
|
+
return ee(e);
|
|
416
745
|
case "horse":
|
|
417
|
-
return
|
|
746
|
+
return Pe(e);
|
|
418
747
|
case "player":
|
|
419
|
-
return
|
|
748
|
+
return be(e);
|
|
420
749
|
case "coach":
|
|
421
|
-
return
|
|
750
|
+
return ke(e);
|
|
422
751
|
case "referee":
|
|
423
|
-
return
|
|
752
|
+
return He(e);
|
|
424
753
|
case "venue":
|
|
425
|
-
return
|
|
754
|
+
return Be(e);
|
|
426
755
|
case "tournament":
|
|
427
756
|
case "competition":
|
|
428
|
-
return
|
|
757
|
+
return Ue(e);
|
|
429
758
|
case "match":
|
|
430
|
-
return
|
|
759
|
+
return $e(e);
|
|
431
760
|
case "country":
|
|
432
|
-
return
|
|
761
|
+
return xe(e);
|
|
433
762
|
default: {
|
|
434
763
|
const t = e;
|
|
435
764
|
throw new Error(`Unknown entity type: ${t.entity_type}`);
|
|
436
765
|
}
|
|
437
766
|
}
|
|
438
767
|
}
|
|
439
|
-
async function
|
|
440
|
-
const o = t ??
|
|
768
|
+
async function Et(e = {}, t) {
|
|
769
|
+
const o = t ?? A(), n = {};
|
|
441
770
|
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());
|
|
442
|
-
const s = await
|
|
771
|
+
const s = await Ge.get({
|
|
443
772
|
path: "/suggest",
|
|
444
773
|
params: n,
|
|
445
774
|
next: e.next,
|
|
@@ -449,12 +778,12 @@ async function rt(e = {}, t) {
|
|
|
449
778
|
results: [],
|
|
450
779
|
query: e.name
|
|
451
780
|
} : {
|
|
452
|
-
results: s.results.map(
|
|
781
|
+
results: s.results.map(We),
|
|
453
782
|
query: e.name
|
|
454
783
|
};
|
|
455
784
|
}
|
|
456
|
-
const
|
|
457
|
-
function
|
|
785
|
+
const qe = V(ce);
|
|
786
|
+
function Ve(e, t) {
|
|
458
787
|
return {
|
|
459
788
|
teamId: e.id,
|
|
460
789
|
teamName: e.name,
|
|
@@ -466,8 +795,8 @@ function Fe(e, t) {
|
|
|
466
795
|
}))
|
|
467
796
|
};
|
|
468
797
|
}
|
|
469
|
-
async function
|
|
470
|
-
const o = t ||
|
|
798
|
+
async function Ft(e, t) {
|
|
799
|
+
const o = t || A(), n = e.next ?? { revalidate: 600 }, s = await qe.get({
|
|
471
800
|
path: "/statistics/aggregate",
|
|
472
801
|
params: {
|
|
473
802
|
participant_ids: e.teamId,
|
|
@@ -479,16 +808,16 @@ async function at(e, t) {
|
|
|
479
808
|
});
|
|
480
809
|
if (!s.data || s.data.length === 0)
|
|
481
810
|
throw new Error(`No statistics found for team ${e.teamId} in season ${e.seasonId}`);
|
|
482
|
-
return
|
|
811
|
+
return Ve(s.data[0], e.seasonId);
|
|
483
812
|
}
|
|
484
|
-
function
|
|
813
|
+
function je(e) {
|
|
485
814
|
const t = e.replace(/\/$/, "");
|
|
486
815
|
function o(n) {
|
|
487
816
|
return `${t}${n}`;
|
|
488
817
|
}
|
|
489
818
|
return {
|
|
490
819
|
async get(n) {
|
|
491
|
-
const s = n.config ||
|
|
820
|
+
const s = n.config || A(), { fansUnited: i } = s;
|
|
492
821
|
if (!i)
|
|
493
822
|
throw new Error(
|
|
494
823
|
"Fans United configuration is missing. Add 'fansUnited' with 'apiKey' and 'clientId' to your config."
|
|
@@ -499,9 +828,9 @@ function Me(e) {
|
|
|
499
828
|
if (r.searchParams.set("key", i.apiKey), r.searchParams.set("client_id", i.clientId), n.params)
|
|
500
829
|
for (const [u, c] of Object.entries(n.params))
|
|
501
830
|
c !== void 0 && (Array.isArray(c) ? c.length > 0 && r.searchParams.set(u, c.join(",")) : r.searchParams.set(u, c));
|
|
502
|
-
const a = 3e4,
|
|
503
|
-
|
|
504
|
-
const
|
|
831
|
+
const a = 3e4, l = new URL(r.toString());
|
|
832
|
+
l.searchParams.delete("key"), l.searchParams.delete("client_id"), console.log("🔗 FansUnited API URL:", l.toString());
|
|
833
|
+
const d = await fetch(r.toString(), {
|
|
505
834
|
method: "GET",
|
|
506
835
|
headers: {
|
|
507
836
|
Accept: "application/json",
|
|
@@ -513,26 +842,26 @@ function Me(e) {
|
|
|
513
842
|
// Next.js cache options for ISR/on-demand revalidation
|
|
514
843
|
...n.next && { next: n.next }
|
|
515
844
|
});
|
|
516
|
-
if (!
|
|
517
|
-
let u = `Fans United API error: ${
|
|
845
|
+
if (!d.ok) {
|
|
846
|
+
let u = `Fans United API error: ${d.status} ${d.statusText}`;
|
|
518
847
|
try {
|
|
519
|
-
const c = await
|
|
848
|
+
const c = await d.text();
|
|
520
849
|
c && (u += ` - ${c}`);
|
|
521
850
|
} catch (c) {
|
|
522
851
|
console.error("[Fans United HTTP] Failed to read error response body:", {
|
|
523
852
|
error: c instanceof Error ? c.message : String(c),
|
|
524
|
-
status:
|
|
525
|
-
statusText:
|
|
853
|
+
status: d.status,
|
|
854
|
+
statusText: d.statusText
|
|
526
855
|
});
|
|
527
856
|
}
|
|
528
857
|
throw new Error(u);
|
|
529
858
|
}
|
|
530
|
-
return
|
|
859
|
+
return d.json();
|
|
531
860
|
}
|
|
532
861
|
};
|
|
533
862
|
}
|
|
534
|
-
const
|
|
535
|
-
function
|
|
863
|
+
const Ke = "https://football.fansunitedapi.com", I = je(Ke);
|
|
864
|
+
function Ye(e) {
|
|
536
865
|
return {
|
|
537
866
|
id: String(e.id),
|
|
538
867
|
name: e.name,
|
|
@@ -545,7 +874,7 @@ function Re(e) {
|
|
|
545
874
|
]
|
|
546
875
|
};
|
|
547
876
|
}
|
|
548
|
-
function
|
|
877
|
+
function ze(e) {
|
|
549
878
|
const t = {
|
|
550
879
|
id: String(e.id),
|
|
551
880
|
name: e.name,
|
|
@@ -574,16 +903,16 @@ function De(e) {
|
|
|
574
903
|
]
|
|
575
904
|
}), e.assets?.logo && (t.assets = {
|
|
576
905
|
logo: e.assets.logo
|
|
577
|
-
}), e.seasons && e.seasons.length > 0 && (t.seasons = e.seasons.map(
|
|
906
|
+
}), e.seasons && e.seasons.length > 0 && (t.seasons = e.seasons.map(Ye)), e.current_season && (t.season = {
|
|
578
907
|
id: String(e.current_season.id),
|
|
579
908
|
name: e.current_season.name,
|
|
580
909
|
status: e.current_season.active ? "ACTIVE" : "INACTIVE"
|
|
581
910
|
}), t;
|
|
582
911
|
}
|
|
583
|
-
function
|
|
584
|
-
return e.map(
|
|
912
|
+
function Je(e) {
|
|
913
|
+
return e.map(ze);
|
|
585
914
|
}
|
|
586
|
-
async function
|
|
915
|
+
async function Mt(e, t) {
|
|
587
916
|
const o = {};
|
|
588
917
|
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");
|
|
589
918
|
const n = await I.get({
|
|
@@ -591,12 +920,12 @@ async function ct(e, t) {
|
|
|
591
920
|
params: o,
|
|
592
921
|
config: t,
|
|
593
922
|
next: e?.next
|
|
594
|
-
}), s = n.data.map((
|
|
923
|
+
}), s = n.data.map((d) => d.id), i = new Set(s);
|
|
595
924
|
s.length !== i.size && console.warn("⚠️ API returned duplicate competitions!");
|
|
596
|
-
const r =
|
|
597
|
-
return r.length !==
|
|
925
|
+
const r = Je(n.data), a = /* @__PURE__ */ new Set(), l = r.filter((d) => a.has(d.id) ? !1 : (a.add(d.id), !0));
|
|
926
|
+
return r.length !== l.length && console.warn(`Removed ${r.length - l.length} duplicate competitions`), l;
|
|
598
927
|
}
|
|
599
|
-
function
|
|
928
|
+
function Qe(e) {
|
|
600
929
|
return {
|
|
601
930
|
id: e.id,
|
|
602
931
|
name: e.name,
|
|
@@ -612,13 +941,13 @@ function Ie(e) {
|
|
|
612
941
|
]
|
|
613
942
|
};
|
|
614
943
|
}
|
|
615
|
-
function
|
|
944
|
+
function Xe(e) {
|
|
616
945
|
return {
|
|
617
946
|
id: e.id,
|
|
618
947
|
name: e.name,
|
|
619
948
|
type: e.type?.toUpperCase() || "LEAGUE",
|
|
620
949
|
gender: e.gender?.toUpperCase(),
|
|
621
|
-
country: e.country ?
|
|
950
|
+
country: e.country ? Qe(e.country) : void 0,
|
|
622
951
|
assets: e.assets?.logo ? {
|
|
623
952
|
logo: e.assets.logo
|
|
624
953
|
} : void 0,
|
|
@@ -630,11 +959,11 @@ function Ne(e) {
|
|
|
630
959
|
]
|
|
631
960
|
};
|
|
632
961
|
}
|
|
633
|
-
function
|
|
634
|
-
return
|
|
962
|
+
function Ze(e) {
|
|
963
|
+
return Xe(e.data);
|
|
635
964
|
}
|
|
636
|
-
async function
|
|
637
|
-
const n = o ||
|
|
965
|
+
async function Lt(e, t, o) {
|
|
966
|
+
const n = o || A(), s = {};
|
|
638
967
|
t?.lang && (s.lang = t.lang);
|
|
639
968
|
const i = await I.get({
|
|
640
969
|
path: `/v1/competitions/${e}`,
|
|
@@ -642,9 +971,9 @@ async function lt(e, t, o) {
|
|
|
642
971
|
next: t?.next,
|
|
643
972
|
config: n
|
|
644
973
|
});
|
|
645
|
-
return
|
|
974
|
+
return Ze(i);
|
|
646
975
|
}
|
|
647
|
-
function
|
|
976
|
+
function we(e) {
|
|
648
977
|
return {
|
|
649
978
|
id: e.id,
|
|
650
979
|
name: e.name,
|
|
@@ -658,7 +987,7 @@ function Le(e) {
|
|
|
658
987
|
]
|
|
659
988
|
};
|
|
660
989
|
}
|
|
661
|
-
function
|
|
990
|
+
function te(e) {
|
|
662
991
|
return {
|
|
663
992
|
id: e.id,
|
|
664
993
|
name: e.name,
|
|
@@ -666,7 +995,7 @@ function w(e) {
|
|
|
666
995
|
threeLetterCode: e.code,
|
|
667
996
|
type: e.national ? "national" : "club",
|
|
668
997
|
gender: e.gender ? e.gender.toUpperCase() : void 0,
|
|
669
|
-
country: e.country ?
|
|
998
|
+
country: e.country ? we(e.country) : void 0,
|
|
670
999
|
assets: e.assets?.logo ? {
|
|
671
1000
|
logo: e.assets.logo
|
|
672
1001
|
} : void 0,
|
|
@@ -686,14 +1015,14 @@ function w(e) {
|
|
|
686
1015
|
]
|
|
687
1016
|
};
|
|
688
1017
|
}
|
|
689
|
-
function
|
|
690
|
-
return
|
|
1018
|
+
function et(e) {
|
|
1019
|
+
return te(e.data);
|
|
691
1020
|
}
|
|
692
|
-
function
|
|
693
|
-
return e.data.map(
|
|
1021
|
+
function tt(e) {
|
|
1022
|
+
return e.data.map(te);
|
|
694
1023
|
}
|
|
695
|
-
async function
|
|
696
|
-
const n = o ||
|
|
1024
|
+
async function It(e, t, o) {
|
|
1025
|
+
const n = o || A(), s = {};
|
|
697
1026
|
t?.lang && (s.lang = t.lang);
|
|
698
1027
|
const i = await I.get({
|
|
699
1028
|
path: `/v1/teams/${e}`,
|
|
@@ -701,10 +1030,10 @@ async function dt(e, t, o) {
|
|
|
701
1030
|
next: t?.next,
|
|
702
1031
|
config: n
|
|
703
1032
|
});
|
|
704
|
-
return
|
|
1033
|
+
return et(i);
|
|
705
1034
|
}
|
|
706
|
-
async function
|
|
707
|
-
const o = t ||
|
|
1035
|
+
async function Dt(e, t) {
|
|
1036
|
+
const o = t || A(), n = {};
|
|
708
1037
|
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);
|
|
709
1038
|
const s = await I.get({
|
|
710
1039
|
path: "/v1/teams",
|
|
@@ -712,7 +1041,7 @@ async function ut(e, t) {
|
|
|
712
1041
|
next: e?.next,
|
|
713
1042
|
config: o
|
|
714
1043
|
});
|
|
715
|
-
return
|
|
1044
|
+
return tt(s);
|
|
716
1045
|
}
|
|
717
1046
|
function Y(e) {
|
|
718
1047
|
return {
|
|
@@ -728,7 +1057,7 @@ function Y(e) {
|
|
|
728
1057
|
]
|
|
729
1058
|
};
|
|
730
1059
|
}
|
|
731
|
-
function
|
|
1060
|
+
function ot(e) {
|
|
732
1061
|
return {
|
|
733
1062
|
id: e.id,
|
|
734
1063
|
name: e.name,
|
|
@@ -749,7 +1078,7 @@ function ke(e) {
|
|
|
749
1078
|
]
|
|
750
1079
|
};
|
|
751
1080
|
}
|
|
752
|
-
function
|
|
1081
|
+
function nt(e) {
|
|
753
1082
|
return {
|
|
754
1083
|
id: e.id,
|
|
755
1084
|
name: e.name,
|
|
@@ -767,7 +1096,7 @@ function Be(e) {
|
|
|
767
1096
|
]
|
|
768
1097
|
};
|
|
769
1098
|
}
|
|
770
|
-
function
|
|
1099
|
+
function oe(e) {
|
|
771
1100
|
return {
|
|
772
1101
|
type: "player",
|
|
773
1102
|
id: e.id,
|
|
@@ -778,8 +1107,8 @@ function ee(e) {
|
|
|
778
1107
|
assets: e.assets?.headshot ? {
|
|
779
1108
|
photo: e.assets.headshot
|
|
780
1109
|
} : void 0,
|
|
781
|
-
teams: e.teams?.map(
|
|
782
|
-
competitions: e.competitions?.map(
|
|
1110
|
+
teams: e.teams?.map(ot),
|
|
1111
|
+
competitions: e.competitions?.map(nt),
|
|
783
1112
|
providerRef: [
|
|
784
1113
|
{
|
|
785
1114
|
provider: "fansunited",
|
|
@@ -788,14 +1117,14 @@ function ee(e) {
|
|
|
788
1117
|
]
|
|
789
1118
|
};
|
|
790
1119
|
}
|
|
791
|
-
function
|
|
792
|
-
return
|
|
1120
|
+
function st(e) {
|
|
1121
|
+
return oe(e.data);
|
|
793
1122
|
}
|
|
794
|
-
function
|
|
795
|
-
return e.data.map(
|
|
1123
|
+
function it(e) {
|
|
1124
|
+
return e.data.map(oe);
|
|
796
1125
|
}
|
|
797
|
-
async function
|
|
798
|
-
const n = o ||
|
|
1126
|
+
async function Gt(e, t, o) {
|
|
1127
|
+
const n = o || A(), s = {};
|
|
799
1128
|
t?.lang && (s.lang = t.lang);
|
|
800
1129
|
const i = await I.get({
|
|
801
1130
|
path: `/v1/players/${e}`,
|
|
@@ -803,10 +1132,10 @@ async function mt(e, t, o) {
|
|
|
803
1132
|
next: t?.next,
|
|
804
1133
|
config: n
|
|
805
1134
|
});
|
|
806
|
-
return
|
|
1135
|
+
return st(i);
|
|
807
1136
|
}
|
|
808
|
-
async function
|
|
809
|
-
const o = t ||
|
|
1137
|
+
async function Pt(e, t) {
|
|
1138
|
+
const o = t || A(), n = {};
|
|
810
1139
|
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);
|
|
811
1140
|
const s = await I.get({
|
|
812
1141
|
path: "/v1/players",
|
|
@@ -814,10 +1143,10 @@ async function ft(e, t) {
|
|
|
814
1143
|
next: e?.next,
|
|
815
1144
|
config: o
|
|
816
1145
|
});
|
|
817
|
-
return
|
|
1146
|
+
return it(s);
|
|
818
1147
|
}
|
|
819
|
-
async function
|
|
820
|
-
const n = o ||
|
|
1148
|
+
async function bt(e, t, o) {
|
|
1149
|
+
const n = o || A(), s = {};
|
|
821
1150
|
t?.lang && (s.lang = t.lang);
|
|
822
1151
|
const i = await I.get({
|
|
823
1152
|
path: `/v1/matches/${e}`,
|
|
@@ -825,10 +1154,10 @@ async function gt(e, t, o) {
|
|
|
825
1154
|
next: t?.next,
|
|
826
1155
|
config: n
|
|
827
1156
|
});
|
|
828
|
-
return
|
|
1157
|
+
return de(i);
|
|
829
1158
|
}
|
|
830
|
-
async function
|
|
831
|
-
const o = t ||
|
|
1159
|
+
async function kt(e, t) {
|
|
1160
|
+
const o = t || A(), n = {};
|
|
832
1161
|
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");
|
|
833
1162
|
const s = await I.get({
|
|
834
1163
|
path: "/v1/matches",
|
|
@@ -836,7 +1165,7 @@ async function pt(e, t) {
|
|
|
836
1165
|
next: e?.next,
|
|
837
1166
|
config: o
|
|
838
1167
|
});
|
|
839
|
-
return
|
|
1168
|
+
return le(s);
|
|
840
1169
|
}
|
|
841
1170
|
function z(e) {
|
|
842
1171
|
return {
|
|
@@ -852,7 +1181,7 @@ function z(e) {
|
|
|
852
1181
|
]
|
|
853
1182
|
};
|
|
854
1183
|
}
|
|
855
|
-
function
|
|
1184
|
+
function rt(e) {
|
|
856
1185
|
return {
|
|
857
1186
|
id: e.id,
|
|
858
1187
|
name: e.name,
|
|
@@ -872,7 +1201,7 @@ function xe(e) {
|
|
|
872
1201
|
]
|
|
873
1202
|
};
|
|
874
1203
|
}
|
|
875
|
-
function
|
|
1204
|
+
function at(e) {
|
|
876
1205
|
return {
|
|
877
1206
|
type: "player",
|
|
878
1207
|
id: e.id,
|
|
@@ -892,7 +1221,7 @@ function We(e) {
|
|
|
892
1221
|
]
|
|
893
1222
|
};
|
|
894
1223
|
}
|
|
895
|
-
function
|
|
1224
|
+
function ct(e) {
|
|
896
1225
|
return {
|
|
897
1226
|
type: e.national ? "national" : "club",
|
|
898
1227
|
id: e.id,
|
|
@@ -915,7 +1244,7 @@ function qe(e) {
|
|
|
915
1244
|
function j(e) {
|
|
916
1245
|
switch (e.entity_type) {
|
|
917
1246
|
case "competition": {
|
|
918
|
-
const t =
|
|
1247
|
+
const t = rt(e);
|
|
919
1248
|
return {
|
|
920
1249
|
source: "FOOTBALL",
|
|
921
1250
|
entityType: "competition",
|
|
@@ -924,7 +1253,7 @@ function j(e) {
|
|
|
924
1253
|
};
|
|
925
1254
|
}
|
|
926
1255
|
case "player": {
|
|
927
|
-
const t =
|
|
1256
|
+
const t = at(e);
|
|
928
1257
|
return {
|
|
929
1258
|
source: "FOOTBALL",
|
|
930
1259
|
entityType: "player",
|
|
@@ -933,7 +1262,7 @@ function j(e) {
|
|
|
933
1262
|
};
|
|
934
1263
|
}
|
|
935
1264
|
case "team": {
|
|
936
|
-
const t =
|
|
1265
|
+
const t = ct(e);
|
|
937
1266
|
return {
|
|
938
1267
|
source: "FOOTBALL",
|
|
939
1268
|
entityType: "team",
|
|
@@ -948,13 +1277,13 @@ function j(e) {
|
|
|
948
1277
|
throw new Error(`Unknown entity type: ${e.entity_type}`);
|
|
949
1278
|
}
|
|
950
1279
|
}
|
|
951
|
-
async function
|
|
1280
|
+
async function Ht(e, t) {
|
|
952
1281
|
if (!e.query || e.query.trim() === "")
|
|
953
1282
|
return [];
|
|
954
|
-
const o = t ||
|
|
1283
|
+
const o = t || A(), n = {
|
|
955
1284
|
q: e.query.trim()
|
|
956
|
-
}, i = (e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["competition", "team", "player"]).map((
|
|
957
|
-
switch (
|
|
1285
|
+
}, i = (e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["competition", "team", "player"]).map((l) => {
|
|
1286
|
+
switch (l) {
|
|
958
1287
|
case "team":
|
|
959
1288
|
return "teams";
|
|
960
1289
|
case "player":
|
|
@@ -962,7 +1291,7 @@ async function yt(e, t) {
|
|
|
962
1291
|
case "competition":
|
|
963
1292
|
return "competitions";
|
|
964
1293
|
default:
|
|
965
|
-
return
|
|
1294
|
+
return l;
|
|
966
1295
|
}
|
|
967
1296
|
});
|
|
968
1297
|
n.entities = i.join(","), e.lang && (n.lang = e.lang), e.limit && (n.limit = String(e.limit));
|
|
@@ -972,35 +1301,35 @@ async function yt(e, t) {
|
|
|
972
1301
|
next: e.next,
|
|
973
1302
|
config: o
|
|
974
1303
|
}), a = [];
|
|
975
|
-
return r.data && (r.data.competitions && r.data.competitions.forEach((
|
|
976
|
-
const
|
|
977
|
-
|
|
978
|
-
}), r.data.teams && r.data.teams.forEach((
|
|
979
|
-
const
|
|
980
|
-
|
|
981
|
-
}), r.data.players && r.data.players.forEach((
|
|
982
|
-
const
|
|
983
|
-
|
|
1304
|
+
return r.data && (r.data.competitions && r.data.competitions.forEach((l) => {
|
|
1305
|
+
const d = j({ ...l, entity_type: "competition" });
|
|
1306
|
+
d && a.push(d);
|
|
1307
|
+
}), r.data.teams && r.data.teams.forEach((l) => {
|
|
1308
|
+
const d = j({ ...l, entity_type: "team" });
|
|
1309
|
+
d && a.push(d);
|
|
1310
|
+
}), r.data.players && r.data.players.forEach((l) => {
|
|
1311
|
+
const d = j({ ...l, entity_type: "player" });
|
|
1312
|
+
d && a.push(d);
|
|
984
1313
|
})), a;
|
|
985
1314
|
}
|
|
986
|
-
function
|
|
1315
|
+
function Bt(e) {
|
|
987
1316
|
return !e.seasons || e.seasons.length === 0 ? void 0 : e.seasons.find((o) => o.active) ?? e.seasons[0];
|
|
988
1317
|
}
|
|
989
|
-
function
|
|
1318
|
+
function Ut(e, t) {
|
|
990
1319
|
const o = /* @__PURE__ */ new Date(), n = t.filter((s) => {
|
|
991
1320
|
const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "NOT_STARTED", a = new Date(s.timing.kickoffTime) >= o;
|
|
992
1321
|
return i && r && a;
|
|
993
1322
|
});
|
|
994
1323
|
return n.sort((s, i) => new Date(s.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()), n[0];
|
|
995
1324
|
}
|
|
996
|
-
function
|
|
1325
|
+
function $t(e, t) {
|
|
997
1326
|
const o = /* @__PURE__ */ new Date(), n = t.filter((s) => {
|
|
998
1327
|
const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "FINISHED", a = new Date(s.timing.kickoffTime) <= o;
|
|
999
1328
|
return i && r && a;
|
|
1000
1329
|
});
|
|
1001
1330
|
return n.sort((s, i) => new Date(i.timing.kickoffTime).getTime() - new Date(s.timing.kickoffTime).getTime()), n[0];
|
|
1002
1331
|
}
|
|
1003
|
-
function
|
|
1332
|
+
function xt(e, t) {
|
|
1004
1333
|
const o = /* @__PURE__ */ new Date();
|
|
1005
1334
|
return t.filter((s) => {
|
|
1006
1335
|
const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "NOT_STARTED" || s.status.type === "LIVE", a = new Date(s.timing.kickoffTime) >= o || s.status.type === "LIVE";
|
|
@@ -1009,7 +1338,7 @@ function St(e, t) {
|
|
|
1009
1338
|
(s, i) => new Date(s.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()
|
|
1010
1339
|
);
|
|
1011
1340
|
}
|
|
1012
|
-
function
|
|
1341
|
+
function Wt(e, t) {
|
|
1013
1342
|
const o = /* @__PURE__ */ new Date();
|
|
1014
1343
|
return t.filter((s) => {
|
|
1015
1344
|
const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "FINISHED", a = new Date(s.timing.kickoffTime) <= o;
|
|
@@ -1018,35 +1347,35 @@ function _t(e, t) {
|
|
|
1018
1347
|
(s, i) => new Date(i.timing.kickoffTime).getTime() - new Date(s.timing.kickoffTime).getTime()
|
|
1019
1348
|
);
|
|
1020
1349
|
}
|
|
1021
|
-
function
|
|
1350
|
+
function qt(e, t, o) {
|
|
1022
1351
|
const n = o.filter((r) => r.status.type === "FINISHED"), s = o.filter(
|
|
1023
1352
|
(r) => r.status.type === "NOT_STARTED" || r.status.type === "POSTPONED"
|
|
1024
1353
|
), i = t.entries.map((r) => {
|
|
1025
|
-
const a = r.competitor.id,
|
|
1354
|
+
const a = r.competitor.id, l = n.filter(
|
|
1026
1355
|
(m) => m.competitorOne.id === e && m.competitorTwo.id === a || m.competitorOne.id === a && m.competitorTwo.id === e
|
|
1027
|
-
),
|
|
1356
|
+
), d = s.filter(
|
|
1028
1357
|
(m) => m.competitorOne.id === e && m.competitorTwo.id === a || m.competitorOne.id === a && m.competitorTwo.id === e
|
|
1029
1358
|
);
|
|
1030
1359
|
let u, c;
|
|
1031
|
-
return
|
|
1032
|
-
const
|
|
1033
|
-
let
|
|
1034
|
-
|
|
1035
|
-
const
|
|
1036
|
-
result:
|
|
1037
|
-
score: `${
|
|
1360
|
+
return l.forEach((m) => {
|
|
1361
|
+
const p = m.competitorOne.id === e, g = parseInt(m.score?.competitorOne ?? "0"), h = parseInt(m.score?.competitorTwo ?? "0"), F = p ? g : h, S = p ? h : g;
|
|
1362
|
+
let O;
|
|
1363
|
+
F > S ? O = "W" : F === S ? O = "D" : O = "L";
|
|
1364
|
+
const M = {
|
|
1365
|
+
result: O,
|
|
1366
|
+
score: `${g} - ${h}`,
|
|
1038
1367
|
date: m.timing.kickoffTime,
|
|
1039
1368
|
matchId: m.id,
|
|
1040
1369
|
isUpcoming: !1
|
|
1041
1370
|
};
|
|
1042
|
-
|
|
1043
|
-
}),
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1371
|
+
p ? u = M : c = M;
|
|
1372
|
+
}), d.forEach((m) => {
|
|
1373
|
+
const p = m.competitorOne.id === e;
|
|
1374
|
+
p && !u ? u = {
|
|
1046
1375
|
date: m.timing.kickoffTime,
|
|
1047
1376
|
matchId: m.id,
|
|
1048
1377
|
isUpcoming: !0
|
|
1049
|
-
} : !
|
|
1378
|
+
} : !p && !c && (c = {
|
|
1050
1379
|
date: m.timing.kickoffTime,
|
|
1051
1380
|
matchId: m.id,
|
|
1052
1381
|
isUpcoming: !0
|
|
@@ -1068,7 +1397,7 @@ function Ct(e, t, o) {
|
|
|
1068
1397
|
rows: i
|
|
1069
1398
|
};
|
|
1070
1399
|
}
|
|
1071
|
-
function
|
|
1400
|
+
function Vt(e, t = 10) {
|
|
1072
1401
|
return e.players.filter((o) => (o.seasonStatistics?.goals ?? 0) > 0).sort((o, n) => {
|
|
1073
1402
|
const s = o.seasonStatistics?.goals ?? 0, i = n.seasonStatistics?.goals ?? 0;
|
|
1074
1403
|
if (i !== s)
|
|
@@ -1077,7 +1406,7 @@ function At(e, t = 10) {
|
|
|
1077
1406
|
return (n.seasonStatistics?.assists ?? 0) - r;
|
|
1078
1407
|
}).slice(0, t);
|
|
1079
1408
|
}
|
|
1080
|
-
function
|
|
1409
|
+
function jt(e, t = 10) {
|
|
1081
1410
|
return e.players.filter((o) => (o.seasonStatistics?.assists ?? 0) > 0).sort((o, n) => {
|
|
1082
1411
|
const s = o.seasonStatistics?.assists ?? 0, i = n.seasonStatistics?.assists ?? 0;
|
|
1083
1412
|
if (i !== s)
|
|
@@ -1086,7 +1415,7 @@ function Ot(e, t = 10) {
|
|
|
1086
1415
|
return (n.seasonStatistics?.goals ?? 0) - r;
|
|
1087
1416
|
}).slice(0, t);
|
|
1088
1417
|
}
|
|
1089
|
-
function
|
|
1418
|
+
function Kt(e, t = 10) {
|
|
1090
1419
|
return e.players.filter((o) => (o.seasonStatistics?.appearances ?? 0) > 0).sort((o, n) => {
|
|
1091
1420
|
const s = o.seasonStatistics?.appearances ?? 0, i = n.seasonStatistics?.appearances ?? 0;
|
|
1092
1421
|
if (i !== s)
|
|
@@ -1095,7 +1424,7 @@ function Ft(e, t = 10) {
|
|
|
1095
1424
|
return (n.seasonStatistics?.minutes ?? 0) - r;
|
|
1096
1425
|
}).slice(0, t);
|
|
1097
1426
|
}
|
|
1098
|
-
function
|
|
1427
|
+
function Yt(e, t = 10) {
|
|
1099
1428
|
return e.players.filter((o) => (o.seasonStatistics?.minutes ?? 0) > 0).sort((o, n) => {
|
|
1100
1429
|
const s = o.seasonStatistics?.minutes ?? 0, i = n.seasonStatistics?.minutes ?? 0;
|
|
1101
1430
|
if (i !== s)
|
|
@@ -1104,7 +1433,7 @@ function Mt(e, t = 10) {
|
|
|
1104
1433
|
return (n.seasonStatistics?.appearances ?? 0) - r;
|
|
1105
1434
|
}).slice(0, t);
|
|
1106
1435
|
}
|
|
1107
|
-
function
|
|
1436
|
+
function zt(e, t = 10) {
|
|
1108
1437
|
return e.players.filter((o) => (o.seasonStatistics?.cleansheets ?? 0) > 0).sort((o, n) => {
|
|
1109
1438
|
const s = o.seasonStatistics?.cleansheets ?? 0, i = n.seasonStatistics?.cleansheets ?? 0;
|
|
1110
1439
|
if (i !== s)
|
|
@@ -1113,13 +1442,13 @@ function Gt(e, t = 10) {
|
|
|
1113
1442
|
return (n.seasonStatistics?.appearances ?? 0) - r;
|
|
1114
1443
|
}).slice(0, t);
|
|
1115
1444
|
}
|
|
1116
|
-
function
|
|
1445
|
+
function Jt(e, t = 10) {
|
|
1117
1446
|
return e.players.filter((o) => {
|
|
1118
1447
|
const n = o.seasonStatistics?.yellowCards ?? 0, s = o.seasonStatistics?.redCards ?? 0;
|
|
1119
1448
|
return n + s > 0;
|
|
1120
1449
|
}).sort((o, n) => {
|
|
1121
|
-
const s = o.seasonStatistics?.yellowCards ?? 0, i = o.seasonStatistics?.redCards ?? 0, r = n.seasonStatistics?.yellowCards ?? 0, a = n.seasonStatistics?.redCards ?? 0,
|
|
1122
|
-
return
|
|
1450
|
+
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;
|
|
1451
|
+
return d !== l ? d - l : a !== i ? a - i : r - s;
|
|
1123
1452
|
}).slice(0, t);
|
|
1124
1453
|
}
|
|
1125
1454
|
function b(e) {
|
|
@@ -1166,61 +1495,61 @@ function b(e) {
|
|
|
1166
1495
|
i && i.appearances !== void 0 && (i.appearances = n.size);
|
|
1167
1496
|
}), t;
|
|
1168
1497
|
}
|
|
1169
|
-
function
|
|
1498
|
+
function H(e) {
|
|
1170
1499
|
return Array.from(e.values()).map((t) => ({
|
|
1171
1500
|
...t,
|
|
1172
1501
|
totalCards: (t.yellowCards ?? 0) + (t.redCards ?? 0)
|
|
1173
1502
|
}));
|
|
1174
1503
|
}
|
|
1175
|
-
function
|
|
1504
|
+
function dt(e, t = 10) {
|
|
1176
1505
|
const o = b(e);
|
|
1177
|
-
return
|
|
1506
|
+
return H(o).filter((s) => (s.goals ?? 0) > 0).sort((s, i) => {
|
|
1178
1507
|
const r = s.goals ?? 0, a = i.goals ?? 0;
|
|
1179
1508
|
if (a !== r)
|
|
1180
1509
|
return a - r;
|
|
1181
|
-
const
|
|
1182
|
-
return (i.assists ?? 0) -
|
|
1510
|
+
const l = s.assists ?? 0;
|
|
1511
|
+
return (i.assists ?? 0) - l;
|
|
1183
1512
|
}).slice(0, t);
|
|
1184
1513
|
}
|
|
1185
|
-
function
|
|
1514
|
+
function lt(e, t = 10) {
|
|
1186
1515
|
const o = b(e);
|
|
1187
|
-
return
|
|
1516
|
+
return H(o).filter((s) => (s.assists ?? 0) > 0).sort((s, i) => {
|
|
1188
1517
|
const r = s.assists ?? 0, a = i.assists ?? 0;
|
|
1189
1518
|
if (a !== r)
|
|
1190
1519
|
return a - r;
|
|
1191
|
-
const
|
|
1192
|
-
return (i.goals ?? 0) -
|
|
1520
|
+
const l = s.goals ?? 0;
|
|
1521
|
+
return (i.goals ?? 0) - l;
|
|
1193
1522
|
}).slice(0, t);
|
|
1194
1523
|
}
|
|
1195
|
-
function
|
|
1524
|
+
function ut(e, t = 10) {
|
|
1196
1525
|
const o = b(e);
|
|
1197
|
-
return
|
|
1526
|
+
return H(o).filter((s) => (s.totalCards ?? 0) > 0).sort((s, i) => {
|
|
1198
1527
|
const r = (s.yellowCards ?? 0) + (s.redCards ?? 0) * 3, a = (i.yellowCards ?? 0) + (i.redCards ?? 0) * 3;
|
|
1199
1528
|
if (a !== r)
|
|
1200
1529
|
return a - r;
|
|
1201
|
-
const
|
|
1202
|
-
if (
|
|
1203
|
-
return
|
|
1530
|
+
const l = s.redCards ?? 0, d = i.redCards ?? 0;
|
|
1531
|
+
if (d !== l)
|
|
1532
|
+
return d - l;
|
|
1204
1533
|
const u = s.yellowCards ?? 0;
|
|
1205
1534
|
return (i.yellowCards ?? 0) - u;
|
|
1206
1535
|
}).slice(0, t);
|
|
1207
1536
|
}
|
|
1208
|
-
function
|
|
1537
|
+
function mt(e, t = 10) {
|
|
1209
1538
|
const o = b(e);
|
|
1210
|
-
return
|
|
1539
|
+
return H(o).filter((s) => (s.goals ?? 0) + (s.assists ?? 0) > 0).sort((s, i) => {
|
|
1211
1540
|
const r = (s.goals ?? 0) + (s.assists ?? 0), a = (i.goals ?? 0) + (i.assists ?? 0);
|
|
1212
1541
|
if (a !== r)
|
|
1213
1542
|
return a - r;
|
|
1214
|
-
const
|
|
1215
|
-
if (
|
|
1216
|
-
return
|
|
1543
|
+
const l = s.goals ?? 0, d = i.goals ?? 0;
|
|
1544
|
+
if (d !== l)
|
|
1545
|
+
return d - l;
|
|
1217
1546
|
const u = s.assists ?? 0;
|
|
1218
1547
|
return (i.assists ?? 0) - u;
|
|
1219
1548
|
}).slice(0, t);
|
|
1220
1549
|
}
|
|
1221
|
-
function
|
|
1550
|
+
function ft(e) {
|
|
1222
1551
|
const t = b(e);
|
|
1223
|
-
return
|
|
1552
|
+
return H(t).sort((n, s) => {
|
|
1224
1553
|
const i = n.appearances ?? 0, r = s.appearances ?? 0;
|
|
1225
1554
|
if (r !== i)
|
|
1226
1555
|
return r - i;
|
|
@@ -1228,72 +1557,72 @@ function Ke(e) {
|
|
|
1228
1557
|
return (s.goals ?? 0) + (s.assists ?? 0) - a;
|
|
1229
1558
|
});
|
|
1230
1559
|
}
|
|
1231
|
-
function
|
|
1232
|
-
return
|
|
1560
|
+
function Qt(e, t = 10) {
|
|
1561
|
+
return G(() => dt(e, t), [e, t]);
|
|
1233
1562
|
}
|
|
1234
|
-
function
|
|
1235
|
-
return
|
|
1563
|
+
function Xt(e, t = 10) {
|
|
1564
|
+
return G(() => lt(e, t), [e, t]);
|
|
1236
1565
|
}
|
|
1237
|
-
function
|
|
1238
|
-
return
|
|
1566
|
+
function Zt(e, t = 10) {
|
|
1567
|
+
return G(() => ut(e, t), [e, t]);
|
|
1239
1568
|
}
|
|
1240
|
-
function
|
|
1241
|
-
return
|
|
1569
|
+
function wt(e, t = 10) {
|
|
1570
|
+
return G(() => mt(e, t), [e, t]);
|
|
1242
1571
|
}
|
|
1243
|
-
function
|
|
1244
|
-
return
|
|
1572
|
+
function eo(e) {
|
|
1573
|
+
return G(() => ft(e), [e]);
|
|
1245
1574
|
}
|
|
1246
|
-
function
|
|
1247
|
-
return
|
|
1575
|
+
function pt(e) {
|
|
1576
|
+
return G(() => b(e), [e]);
|
|
1248
1577
|
}
|
|
1249
|
-
function
|
|
1250
|
-
const o =
|
|
1251
|
-
return
|
|
1578
|
+
function to(e, t) {
|
|
1579
|
+
const o = pt(e);
|
|
1580
|
+
return G(() => o.get(t), [o, t]);
|
|
1252
1581
|
}
|
|
1253
|
-
const
|
|
1254
|
-
function
|
|
1582
|
+
const gt = ["GOAL", "PENALTY_GOAL", "OWN_GOAL"];
|
|
1583
|
+
function N(e, t) {
|
|
1255
1584
|
return t > 0 ? e / t * 100 : 0;
|
|
1256
1585
|
}
|
|
1257
1586
|
function W(e, t) {
|
|
1258
1587
|
return t > 0 ? e / t : 0;
|
|
1259
1588
|
}
|
|
1260
|
-
function
|
|
1589
|
+
function oo(e, t = !1, o = 2) {
|
|
1261
1590
|
return t ? `${Math.round(e)}%` : Number.isInteger(e) ? e.toString() : e.toFixed(o);
|
|
1262
1591
|
}
|
|
1263
|
-
function
|
|
1592
|
+
function no(e, t) {
|
|
1264
1593
|
const o = typeof e == "string" ? parseFloat(e) : e;
|
|
1265
1594
|
if (isNaN(o) || t === 0) return "0";
|
|
1266
1595
|
const n = (o / t).toFixed(1);
|
|
1267
1596
|
return `${o} (${n} avg)`;
|
|
1268
1597
|
}
|
|
1269
|
-
function
|
|
1598
|
+
function so(e, t) {
|
|
1270
1599
|
const o = typeof e == "string" ? parseFloat(e) : e;
|
|
1271
1600
|
return isNaN(o) || t === 0 ? "0.0" : (o / t).toFixed(1);
|
|
1272
1601
|
}
|
|
1273
|
-
function
|
|
1602
|
+
function io(e) {
|
|
1274
1603
|
const t = parseFloat(e);
|
|
1275
1604
|
return isNaN(t) ? "0%" : `${Math.round(t)}%`;
|
|
1276
1605
|
}
|
|
1277
|
-
function
|
|
1606
|
+
function yt(e, t, o) {
|
|
1278
1607
|
if (e.status?.type !== "FINISHED" || !e.score) return null;
|
|
1279
1608
|
const n = parseInt(e.score.competitorOne || "0"), s = parseInt(e.score.competitorTwo || "0"), i = o ? n : s, r = o ? s : n;
|
|
1280
|
-
let a = null,
|
|
1281
|
-
const
|
|
1282
|
-
if (
|
|
1283
|
-
const
|
|
1284
|
-
a = o ?
|
|
1609
|
+
let a = null, l = null;
|
|
1610
|
+
const d = e.score.breakdown?.halfTime;
|
|
1611
|
+
if (d) {
|
|
1612
|
+
const p = parseInt(d.competitorOne || "0"), g = parseInt(d.competitorTwo || "0");
|
|
1613
|
+
a = o ? p : g, l = o ? g : p;
|
|
1285
1614
|
}
|
|
1286
1615
|
const u = e.statistics;
|
|
1287
1616
|
let c = null, m = null;
|
|
1288
1617
|
if (u) {
|
|
1289
|
-
const
|
|
1290
|
-
|
|
1618
|
+
const p = u.find?.((g) => g.type === "CORNERS");
|
|
1619
|
+
p && (c = o ? p.competitorOne : p.competitorTwo, m = o ? p.competitorTwo : p.competitorOne);
|
|
1291
1620
|
}
|
|
1292
1621
|
return {
|
|
1293
1622
|
goalsFor: i,
|
|
1294
1623
|
goalsAgainst: r,
|
|
1295
1624
|
halfTimeGoalsFor: a,
|
|
1296
|
-
halfTimeGoalsAgainst:
|
|
1625
|
+
halfTimeGoalsAgainst: l,
|
|
1297
1626
|
cornersFor: c,
|
|
1298
1627
|
cornersAgainst: m,
|
|
1299
1628
|
isWin: i > r,
|
|
@@ -1301,61 +1630,61 @@ function Xe(e, t, o) {
|
|
|
1301
1630
|
isLoss: i < r
|
|
1302
1631
|
};
|
|
1303
1632
|
}
|
|
1304
|
-
function
|
|
1633
|
+
function J(e, t) {
|
|
1305
1634
|
return e.competitorOne.id === t;
|
|
1306
1635
|
}
|
|
1307
|
-
function
|
|
1636
|
+
function ht(e, t) {
|
|
1308
1637
|
return e.competitorTwo.id === t;
|
|
1309
1638
|
}
|
|
1310
|
-
function
|
|
1311
|
-
return
|
|
1639
|
+
function ro(e, t) {
|
|
1640
|
+
return J(e, t) || ht(e, t);
|
|
1312
1641
|
}
|
|
1313
|
-
function
|
|
1642
|
+
function ao(e) {
|
|
1314
1643
|
return e.status?.type === "FINISHED";
|
|
1315
1644
|
}
|
|
1316
|
-
function
|
|
1317
|
-
const o =
|
|
1645
|
+
function co(e, t) {
|
|
1646
|
+
const o = J(e, t);
|
|
1318
1647
|
return parseInt(o ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0");
|
|
1319
1648
|
}
|
|
1320
|
-
function
|
|
1321
|
-
const o =
|
|
1649
|
+
function lo(e, t) {
|
|
1650
|
+
const o = J(e, t);
|
|
1322
1651
|
return parseInt(o ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0");
|
|
1323
1652
|
}
|
|
1324
|
-
function
|
|
1653
|
+
function uo(e, t, o) {
|
|
1325
1654
|
const n = e.filter((u) => {
|
|
1326
1655
|
if (u.status?.type !== "FINISHED" || !u.score) return !1;
|
|
1327
1656
|
const c = u.competitorOne.id === t || u.competitorTwo.id === t, m = u.competitorOne.id === o || u.competitorTwo.id === o;
|
|
1328
1657
|
return c && m;
|
|
1329
1658
|
});
|
|
1330
|
-
let s = 0, i = 0, r = 0, a = 0,
|
|
1659
|
+
let s = 0, i = 0, r = 0, a = 0, l = 0;
|
|
1331
1660
|
n.forEach((u) => {
|
|
1332
|
-
const c = parseInt(u.score?.competitorOne || "0"), m = parseInt(u.score?.competitorTwo || "0"),
|
|
1333
|
-
a +=
|
|
1661
|
+
const c = parseInt(u.score?.competitorOne || "0"), m = parseInt(u.score?.competitorTwo || "0"), p = u.competitorOne.id === t, g = p ? c : m, h = p ? m : c;
|
|
1662
|
+
a += g, l += h, g > h ? s++ : h > g ? i++ : r++;
|
|
1334
1663
|
});
|
|
1335
|
-
const
|
|
1664
|
+
const d = n.length;
|
|
1336
1665
|
return {
|
|
1337
|
-
totalMatches:
|
|
1666
|
+
totalMatches: d,
|
|
1338
1667
|
homeTeamWins: s,
|
|
1339
1668
|
awayTeamWins: i,
|
|
1340
1669
|
draws: r,
|
|
1341
1670
|
homeTeamGoals: a,
|
|
1342
|
-
awayTeamGoals:
|
|
1343
|
-
homeTeamWinPercentage:
|
|
1344
|
-
awayTeamWinPercentage:
|
|
1345
|
-
drawPercentage:
|
|
1346
|
-
homeTeamAvgGoals:
|
|
1347
|
-
awayTeamAvgGoals:
|
|
1671
|
+
awayTeamGoals: l,
|
|
1672
|
+
homeTeamWinPercentage: d > 0 ? s / d * 100 : 0,
|
|
1673
|
+
awayTeamWinPercentage: d > 0 ? i / d * 100 : 0,
|
|
1674
|
+
drawPercentage: d > 0 ? r / d * 100 : 0,
|
|
1675
|
+
homeTeamAvgGoals: d > 0 ? a / d : 0,
|
|
1676
|
+
awayTeamAvgGoals: d > 0 ? l / d : 0
|
|
1348
1677
|
};
|
|
1349
1678
|
}
|
|
1350
|
-
function
|
|
1679
|
+
function mo(e, t, o, n = 5) {
|
|
1351
1680
|
return e.filter((i) => {
|
|
1352
1681
|
if (i.status?.type !== "FINISHED" || !i.score) return !1;
|
|
1353
1682
|
const r = i.competitorOne.id === t || i.competitorTwo.id === t, a = i.competitorOne.id === o || i.competitorTwo.id === o;
|
|
1354
1683
|
return r && a;
|
|
1355
1684
|
}).sort((i, r) => new Date(r.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()).slice(0, n).map((i) => {
|
|
1356
|
-
const r = parseInt(i.score?.competitorOne || "0"), a = parseInt(i.score?.competitorTwo || "0"),
|
|
1685
|
+
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;
|
|
1357
1686
|
let c;
|
|
1358
|
-
return
|
|
1687
|
+
return d > u ? c = "home" : u > d ? c = "away" : c = "draw", {
|
|
1359
1688
|
id: i.id,
|
|
1360
1689
|
date: new Date(i.timing.kickoffTime).toLocaleDateString("en-GB", {
|
|
1361
1690
|
day: "numeric",
|
|
@@ -1373,34 +1702,34 @@ function jt(e, t, o, n = 5) {
|
|
|
1373
1702
|
};
|
|
1374
1703
|
});
|
|
1375
1704
|
}
|
|
1376
|
-
function
|
|
1705
|
+
function Tt(e, t, o) {
|
|
1377
1706
|
return e.filter((n) => {
|
|
1378
1707
|
const s = n.competitorOne.id === t, i = n.competitorTwo.id === t;
|
|
1379
1708
|
return !s && !i ? !1 : o === "home" ? s : i;
|
|
1380
1709
|
}).map((n) => {
|
|
1381
1710
|
const s = n.competitorOne.id === t;
|
|
1382
|
-
return
|
|
1711
|
+
return yt(n, t, s);
|
|
1383
1712
|
}).filter((n) => n !== null);
|
|
1384
1713
|
}
|
|
1385
|
-
function
|
|
1714
|
+
function Z(e, t, o, n) {
|
|
1386
1715
|
let s = 0;
|
|
1387
1716
|
for (const i of e) {
|
|
1388
1717
|
const r = i.competitorOne.id === t, a = i.competitorTwo.id === t;
|
|
1389
1718
|
if (!r && !a || o === "home" && !r || o === "away" && !a || i.status?.type !== "FINISHED") continue;
|
|
1390
|
-
const
|
|
1391
|
-
if (!
|
|
1392
|
-
const
|
|
1393
|
-
const
|
|
1394
|
-
return
|
|
1719
|
+
const l = i.mainEvents;
|
|
1720
|
+
if (!l || !Array.isArray(l)) continue;
|
|
1721
|
+
const d = l.filter((g) => g.type && gt.includes(g.type)).sort((g, h) => {
|
|
1722
|
+
const F = g.minute ?? 0, S = h.minute ?? 0;
|
|
1723
|
+
return F !== S ? F - S : (g.injuryMinute ?? 0) - (h.injuryMinute ?? 0);
|
|
1395
1724
|
});
|
|
1396
|
-
if (
|
|
1397
|
-
const u =
|
|
1398
|
-
let
|
|
1399
|
-
m ?
|
|
1725
|
+
if (d.length === 0) continue;
|
|
1726
|
+
const u = d[0], c = r ? "ONE" : "TWO", m = u.type === "OWN_GOAL";
|
|
1727
|
+
let p;
|
|
1728
|
+
m ? p = u.competitorPosition !== c : p = u.competitorPosition === c, (n === "scored" && p || n === "conceded" && !p) && s++;
|
|
1400
1729
|
}
|
|
1401
1730
|
return s;
|
|
1402
1731
|
}
|
|
1403
|
-
function
|
|
1732
|
+
function vt(e, t, o) {
|
|
1404
1733
|
let n = 0;
|
|
1405
1734
|
for (const s of e) {
|
|
1406
1735
|
const i = s.competitorOne.id === t, r = s.competitorTwo.id === t;
|
|
@@ -1410,8 +1739,8 @@ function et(e, t, o) {
|
|
|
1410
1739
|
}
|
|
1411
1740
|
return n;
|
|
1412
1741
|
}
|
|
1413
|
-
function
|
|
1414
|
-
const n =
|
|
1742
|
+
function fo(e, t, o) {
|
|
1743
|
+
const n = Tt(e, t, o), s = n.length;
|
|
1415
1744
|
if (s === 0)
|
|
1416
1745
|
return {
|
|
1417
1746
|
played: 0,
|
|
@@ -1432,54 +1761,54 @@ function Vt(e, t, o) {
|
|
|
1432
1761
|
avgCornersFor: 0,
|
|
1433
1762
|
avgCornersAgainst: 0
|
|
1434
1763
|
};
|
|
1435
|
-
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,
|
|
1436
|
-
const v = f.halfTimeGoalsFor,
|
|
1437
|
-
return v > 0 &&
|
|
1438
|
-
}).length,
|
|
1439
|
-
const v = f.halfTimeGoalsAgainst,
|
|
1440
|
-
return v > 0 &&
|
|
1441
|
-
}).length, B =
|
|
1764
|
+
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, p = n.filter((f) => f.halfTimeGoalsFor !== null), g = p.length, h = p.filter((f) => {
|
|
1765
|
+
const v = f.halfTimeGoalsFor, k = f.goalsFor - v;
|
|
1766
|
+
return v > 0 && k > 0;
|
|
1767
|
+
}).length, F = Z(e, t, o, "scored"), S = vt(e, t, o), O = p.filter((f) => f.halfTimeGoalsFor > f.halfTimeGoalsAgainst).length, M = p.filter((f) => {
|
|
1768
|
+
const v = f.halfTimeGoalsAgainst, k = f.goalsAgainst - v;
|
|
1769
|
+
return v > 0 && k > 0;
|
|
1770
|
+
}).length, B = Z(e, t, o, "conceded"), U = p.filter((f) => f.halfTimeGoalsAgainst > f.halfTimeGoalsFor).length, P = n.filter((f) => f.cornersFor !== null), $ = P.reduce((f, v) => f + (v.cornersFor || 0), 0), x = P.reduce((f, v) => f + (v.cornersAgainst || 0), 0);
|
|
1442
1771
|
return {
|
|
1443
1772
|
played: s,
|
|
1444
1773
|
goalsForPerMatch: W(i, s),
|
|
1445
|
-
cleanSheets:
|
|
1446
|
-
wonToNil:
|
|
1447
|
-
scoringRate:
|
|
1448
|
-
scoredInBothHalves:
|
|
1449
|
-
scoredFirst:
|
|
1450
|
-
leadingAtHalfTime: O
|
|
1774
|
+
cleanSheets: N(a, s),
|
|
1775
|
+
wonToNil: N(l, s),
|
|
1776
|
+
scoringRate: N(d, s),
|
|
1777
|
+
scoredInBothHalves: N(h, g),
|
|
1778
|
+
scoredFirst: N(F, S),
|
|
1779
|
+
leadingAtHalfTime: N(O, g),
|
|
1451
1780
|
goalsAgainstPerMatch: W(r, s),
|
|
1452
|
-
failedToScore:
|
|
1453
|
-
lostToNil:
|
|
1454
|
-
concedingRate:
|
|
1455
|
-
concededInBothHalves:
|
|
1456
|
-
concededFirst:
|
|
1457
|
-
losingAtHalfTime:
|
|
1458
|
-
avgCornersFor: W($,
|
|
1459
|
-
avgCornersAgainst: W(x,
|
|
1781
|
+
failedToScore: N(u, s),
|
|
1782
|
+
lostToNil: N(c, s),
|
|
1783
|
+
concedingRate: N(m, s),
|
|
1784
|
+
concededInBothHalves: N(M, g),
|
|
1785
|
+
concededFirst: N(B, S),
|
|
1786
|
+
losingAtHalfTime: N(U, g),
|
|
1787
|
+
avgCornersFor: W($, P.length),
|
|
1788
|
+
avgCornersAgainst: W(x, P.length)
|
|
1460
1789
|
};
|
|
1461
1790
|
}
|
|
1462
|
-
function
|
|
1791
|
+
function _t(e, t) {
|
|
1463
1792
|
return e.filter((o) => o.status?.type !== "FINISHED" ? !1 : o.competitorOne.id === t || o.competitorTwo.id === t).map((o) => {
|
|
1464
1793
|
const n = o.competitorOne.id === t, s = parseInt(o.score?.competitorOne || "0"), i = parseInt(o.score?.competitorTwo || "0"), r = s + i, a = o.periods;
|
|
1465
|
-
let
|
|
1794
|
+
let l = null;
|
|
1466
1795
|
if (a && Array.isArray(a)) {
|
|
1467
|
-
const
|
|
1796
|
+
const d = a.find(
|
|
1468
1797
|
(u) => u.type === "FIRST_HALF" || u.type === "1ST_HALF"
|
|
1469
1798
|
);
|
|
1470
|
-
if (
|
|
1471
|
-
const u = parseInt(
|
|
1472
|
-
|
|
1799
|
+
if (d?.score) {
|
|
1800
|
+
const u = parseInt(d.score.competitorOne || "0"), c = parseInt(d.score.competitorTwo || "0");
|
|
1801
|
+
l = u + c;
|
|
1473
1802
|
}
|
|
1474
1803
|
}
|
|
1475
|
-
return { totalGoals: r, halfTimeGoals:
|
|
1804
|
+
return { totalGoals: r, halfTimeGoals: l, isHome: n };
|
|
1476
1805
|
});
|
|
1477
1806
|
}
|
|
1478
1807
|
function y(e, t) {
|
|
1479
1808
|
return e.length === 0 ? 0 : e.filter((n) => n > t).length / e.length * 100;
|
|
1480
1809
|
}
|
|
1481
|
-
function
|
|
1482
|
-
const o =
|
|
1810
|
+
function po(e, t) {
|
|
1811
|
+
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);
|
|
1483
1812
|
return {
|
|
1484
1813
|
over05: {
|
|
1485
1814
|
home: y(r, 0.5),
|
|
@@ -1512,23 +1841,23 @@ function Yt(e, t) {
|
|
|
1512
1841
|
away: y(a, 5.5)
|
|
1513
1842
|
},
|
|
1514
1843
|
over05HT: {
|
|
1515
|
-
home: y(
|
|
1516
|
-
total: y(
|
|
1844
|
+
home: y(d, 0.5),
|
|
1845
|
+
total: y(l, 0.5),
|
|
1517
1846
|
away: y(u, 0.5)
|
|
1518
1847
|
},
|
|
1519
1848
|
over15HT: {
|
|
1520
|
-
home: y(
|
|
1521
|
-
total: y(
|
|
1849
|
+
home: y(d, 1.5),
|
|
1850
|
+
total: y(l, 1.5),
|
|
1522
1851
|
away: y(u, 1.5)
|
|
1523
1852
|
},
|
|
1524
1853
|
over25HT: {
|
|
1525
|
-
home: y(
|
|
1526
|
-
total: y(
|
|
1854
|
+
home: y(d, 2.5),
|
|
1855
|
+
total: y(l, 2.5),
|
|
1527
1856
|
away: y(u, 2.5)
|
|
1528
1857
|
}
|
|
1529
1858
|
};
|
|
1530
1859
|
}
|
|
1531
|
-
function
|
|
1860
|
+
function St(e, t) {
|
|
1532
1861
|
const o = e.competitorOne.id === t, n = e.competitorTwo.id === t;
|
|
1533
1862
|
if (!o && !n || !e.score) return null;
|
|
1534
1863
|
const s = parseInt(o ? e.score.competitorOne || "0" : e.score.competitorTwo || "0"), i = parseInt(o ? e.score.competitorTwo || "0" : e.score.competitorOne || "0");
|
|
@@ -1538,35 +1867,35 @@ function ot(e, t) {
|
|
|
1538
1867
|
isHome: o
|
|
1539
1868
|
};
|
|
1540
1869
|
}
|
|
1541
|
-
function
|
|
1542
|
-
const r = t?.entries.find((
|
|
1870
|
+
function go(e, t, o, n, s, i) {
|
|
1871
|
+
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);
|
|
1543
1872
|
if (!r) return null;
|
|
1544
|
-
const c = a?.stats?.goalsFor ?? 0, m =
|
|
1873
|
+
const c = a?.stats?.goalsFor ?? 0, m = l?.stats?.goalsFor ?? 0, p = r?.stats?.goalsFor ?? 0, g = 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, B = M > 0 ? p / M : 0, U = M > 0 ? F / M : 0, P = B + U, $ = S > 0 ? c / S : 0, x = O > 0 ? m / O : 0, f = S > 0 ? g / S : 0, v = O > 0 ? h / O : 0, k = $ + f, ne = x + v;
|
|
1545
1874
|
return {
|
|
1546
1875
|
homeGoals: c,
|
|
1547
|
-
totalGoals:
|
|
1876
|
+
totalGoals: p,
|
|
1548
1877
|
awayGoals: m,
|
|
1549
1878
|
homeGamesPlayed: S,
|
|
1550
|
-
awayGamesPlayed:
|
|
1551
|
-
totalGamesPlayed:
|
|
1552
|
-
homeGoalsConceded:
|
|
1553
|
-
totalGoalsConceded:
|
|
1879
|
+
awayGamesPlayed: O,
|
|
1880
|
+
totalGamesPlayed: M,
|
|
1881
|
+
homeGoalsConceded: g,
|
|
1882
|
+
totalGoalsConceded: F,
|
|
1554
1883
|
awayGoalsConceded: h,
|
|
1555
1884
|
gfPerMatch: B,
|
|
1556
1885
|
gaPerMatch: U,
|
|
1557
|
-
gfGaPerMatch:
|
|
1886
|
+
gfGaPerMatch: P,
|
|
1558
1887
|
homeGfPerMatch: $,
|
|
1559
1888
|
awayGfPerMatch: x,
|
|
1560
1889
|
homeGaPerMatch: f,
|
|
1561
1890
|
awayGaPerMatch: v,
|
|
1562
|
-
homeGfGaPerMatch:
|
|
1563
|
-
awayGfGaPerMatch:
|
|
1891
|
+
homeGfGaPerMatch: k,
|
|
1892
|
+
awayGfGaPerMatch: ne
|
|
1564
1893
|
};
|
|
1565
1894
|
}
|
|
1566
|
-
function
|
|
1895
|
+
function C(e, t, o, n) {
|
|
1567
1896
|
const s = e.filter((r) => {
|
|
1568
|
-
const a = r.competitorOne.id === t,
|
|
1569
|
-
return !(!a && !
|
|
1897
|
+
const a = r.competitorOne.id === t, l = r.competitorTwo.id === t;
|
|
1898
|
+
return !(!a && !l || r.status?.type !== "FINISHED" || n === "home" && !a || n === "away" && !l);
|
|
1570
1899
|
}).sort((r, a) => new Date(a.timing.kickoffTime).getTime() - new Date(r.timing.kickoffTime).getTime());
|
|
1571
1900
|
if (s.length === 0) return null;
|
|
1572
1901
|
let i = 0;
|
|
@@ -1603,23 +1932,23 @@ const T = {
|
|
|
1603
1932
|
};
|
|
1604
1933
|
function q(e, t, o) {
|
|
1605
1934
|
return {
|
|
1606
|
-
win:
|
|
1607
|
-
draw:
|
|
1608
|
-
loss:
|
|
1609
|
-
noWin:
|
|
1610
|
-
noDraw:
|
|
1611
|
-
noDefeat:
|
|
1612
|
-
scored:
|
|
1613
|
-
conceded:
|
|
1614
|
-
noGoalScored:
|
|
1615
|
-
noGoalConceded:
|
|
1616
|
-
over25:
|
|
1617
|
-
under25:
|
|
1618
|
-
scoredTwice:
|
|
1619
|
-
concededTwice:
|
|
1935
|
+
win: C(e, t, T.win, o),
|
|
1936
|
+
draw: C(e, t, T.draw, o),
|
|
1937
|
+
loss: C(e, t, T.loss, o),
|
|
1938
|
+
noWin: C(e, t, T.noWin, o),
|
|
1939
|
+
noDraw: C(e, t, T.noDraw, o),
|
|
1940
|
+
noDefeat: C(e, t, T.noDefeat, o),
|
|
1941
|
+
scored: C(e, t, T.scored, o),
|
|
1942
|
+
conceded: C(e, t, T.conceded, o),
|
|
1943
|
+
noGoalScored: C(e, t, T.noGoalScored, o),
|
|
1944
|
+
noGoalConceded: C(e, t, T.noGoalConceded, o),
|
|
1945
|
+
over25: C(e, t, T.over25, o),
|
|
1946
|
+
under25: C(e, t, T.under25, o),
|
|
1947
|
+
scoredTwice: C(e, t, T.scoredTwice, o),
|
|
1948
|
+
concededTwice: C(e, t, T.concededTwice, o)
|
|
1620
1949
|
};
|
|
1621
1950
|
}
|
|
1622
|
-
function
|
|
1951
|
+
function yo(e, t, o) {
|
|
1623
1952
|
const n = q(e, t, "home"), s = q(e, t), i = q(e, o, "away"), r = q(e, o);
|
|
1624
1953
|
return [
|
|
1625
1954
|
{
|
|
@@ -1708,11 +2037,11 @@ function Kt(e, t, o) {
|
|
|
1708
2037
|
}
|
|
1709
2038
|
];
|
|
1710
2039
|
}
|
|
1711
|
-
function
|
|
2040
|
+
function w(e, t) {
|
|
1712
2041
|
const o = /* @__PURE__ */ new Map();
|
|
1713
2042
|
return e.forEach((n) => {
|
|
1714
2043
|
if (n.status?.type !== "FINISHED") return;
|
|
1715
|
-
const s =
|
|
2044
|
+
const s = St(n, t);
|
|
1716
2045
|
if (!s) return;
|
|
1717
2046
|
const i = s.isHome ? n.competitorTwo.id : n.competitorOne.id, r = s.isHome ? n.competitorTwo : n.competitorOne, a = o.get(i) || {
|
|
1718
2047
|
opponentId: i,
|
|
@@ -1722,117 +2051,120 @@ function Q(e, t) {
|
|
|
1722
2051
|
s.isHome ? a.homeResult = s.result : a.awayResult = s.result, o.set(i, a);
|
|
1723
2052
|
}), o;
|
|
1724
2053
|
}
|
|
1725
|
-
function
|
|
1726
|
-
const a =
|
|
2054
|
+
function ho(e, t, o, n, s, i, r) {
|
|
2055
|
+
const a = w(e, t), l = w(e, o), d = /* @__PURE__ */ new Set([
|
|
1727
2056
|
...a.keys(),
|
|
1728
|
-
...
|
|
2057
|
+
...l.keys(),
|
|
1729
2058
|
t,
|
|
1730
2059
|
// Include home team as row for away team results
|
|
1731
2060
|
o
|
|
1732
2061
|
// Include away team as row for home team results
|
|
1733
2062
|
]), u = [];
|
|
1734
|
-
return
|
|
1735
|
-
const m = a.get(c),
|
|
1736
|
-
if (!m && !
|
|
2063
|
+
return d.forEach((c) => {
|
|
2064
|
+
const m = a.get(c), p = l.get(c);
|
|
2065
|
+
if (!m && !p && c !== t && c !== o)
|
|
1737
2066
|
return;
|
|
1738
|
-
let
|
|
1739
|
-
c === t ? (
|
|
2067
|
+
let g, h;
|
|
2068
|
+
c === t ? (g = n, h = i) : c === o ? (g = s, h = r) : (g = m?.opponentName || p?.opponentName || "", h = m?.opponentLogo || p?.opponentLogo), u.push({
|
|
1740
2069
|
opponentId: c,
|
|
1741
|
-
opponentName:
|
|
2070
|
+
opponentName: g,
|
|
1742
2071
|
opponentLogo: h,
|
|
1743
2072
|
homeTeamHome: m?.homeResult,
|
|
1744
2073
|
homeTeamAway: m?.awayResult,
|
|
1745
|
-
awayTeamHome:
|
|
1746
|
-
awayTeamAway:
|
|
2074
|
+
awayTeamHome: p?.homeResult,
|
|
2075
|
+
awayTeamAway: p?.awayResult,
|
|
1747
2076
|
isHomeTeamRow: c === t,
|
|
1748
2077
|
isAwayTeamRow: c === o
|
|
1749
2078
|
});
|
|
1750
2079
|
}), u.sort((c, m) => c.isHomeTeamRow ? -1 : m.isHomeTeamRow ? 1 : c.isAwayTeamRow ? -1 : m.isAwayTeamRow ? 1 : c.opponentName.localeCompare(m.opponentName));
|
|
1751
2080
|
}
|
|
1752
2081
|
export {
|
|
1753
|
-
|
|
1754
|
-
|
|
2082
|
+
gt as GOAL_EVENT_TYPES,
|
|
2083
|
+
_o as addProviderRef,
|
|
1755
2084
|
b as aggregatePlayerStatisticsFromMatches,
|
|
1756
|
-
|
|
2085
|
+
yt as analyzeMatch,
|
|
1757
2086
|
W as calcAverage,
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
2087
|
+
N as calcPercentage,
|
|
2088
|
+
uo as calculateH2HStats,
|
|
2089
|
+
C as calculateStreak,
|
|
2090
|
+
so as formatAsAverage,
|
|
2091
|
+
io as formatPossessionPercentage,
|
|
2092
|
+
oo as formatStatValue,
|
|
2093
|
+
no as formatWithAverage,
|
|
2094
|
+
Bt as getActiveSeason,
|
|
2095
|
+
ft as getAllPlayerStatisticsFromMatches,
|
|
2096
|
+
Nt as getBasketballLivescore,
|
|
2097
|
+
So as getBatchMatchOdds,
|
|
2098
|
+
A as getConfig,
|
|
2099
|
+
Lt as getFansUnitedFootballCompetition,
|
|
2100
|
+
Mt as getFansUnitedFootballCompetitions,
|
|
2101
|
+
bt as getFansUnitedFootballMatch,
|
|
2102
|
+
kt as getFansUnitedFootballMatches,
|
|
2103
|
+
Gt as getFansUnitedFootballPlayer,
|
|
2104
|
+
Pt as getFansUnitedFootballPlayers,
|
|
2105
|
+
Ht as getFansUnitedFootballSearch,
|
|
2106
|
+
It as getFansUnitedFootballTeam,
|
|
2107
|
+
Dt as getFansUnitedFootballTeams,
|
|
2108
|
+
Co as getFootballCompetition,
|
|
2109
|
+
Ao as getFootballLivescore,
|
|
2110
|
+
Oo as getFootballMatch,
|
|
2111
|
+
No as getFootballMatchCommentary,
|
|
2112
|
+
Ro as getFootballMatchEvents,
|
|
2113
|
+
Eo as getFootballMatchLineups,
|
|
2114
|
+
Fo as getFootballMatchOdds,
|
|
2115
|
+
Mo as getFootballMatchStatistics,
|
|
2116
|
+
Lo as getFootballMatches,
|
|
2117
|
+
Io as getFootballPlayerSeasonStatistics,
|
|
2118
|
+
Do as getFootballSeasonDetails,
|
|
2119
|
+
Go as getFootballStandings,
|
|
2120
|
+
Po as getFootballTeam,
|
|
2121
|
+
bo as getFootballTeamSquad,
|
|
2122
|
+
ko as getLeaderboardMatches,
|
|
2123
|
+
Ho as getLeaderboardTeamMatches,
|
|
2124
|
+
Bo as getLeaderboardTemplate,
|
|
2125
|
+
St as getMatchResult,
|
|
2126
|
+
ut as getMostCardedPlayersFromMatches,
|
|
2127
|
+
lo as getOpponentScore,
|
|
2128
|
+
Uo as getProviderRefId,
|
|
2129
|
+
mo as getRecentH2HMeetings,
|
|
2130
|
+
Wt as getTeamFinishedMatches,
|
|
2131
|
+
go as getTeamGoalStats,
|
|
2132
|
+
fo as getTeamHomeAwayStats,
|
|
2133
|
+
Jt as getTeamMostDecorated,
|
|
2134
|
+
Ut as getTeamNextMatch,
|
|
2135
|
+
po as getTeamOverUnderStats,
|
|
2136
|
+
$t as getTeamPreviousMatch,
|
|
2137
|
+
qt as getTeamResultsTable,
|
|
2138
|
+
co as getTeamScore,
|
|
2139
|
+
Ft as getTeamSeasonStatistics,
|
|
1809
2140
|
q as getTeamStreaks,
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
$
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
2141
|
+
yo as getTeamStreaksComparison,
|
|
2142
|
+
Kt as getTeamTopAppearances,
|
|
2143
|
+
jt as getTeamTopAssisters,
|
|
2144
|
+
zt as getTeamTopCleanSheets,
|
|
2145
|
+
Yt as getTeamTopMinutesPlayed,
|
|
2146
|
+
Vt as getTeamTopScorers,
|
|
2147
|
+
xt as getTeamUpcomingMatches,
|
|
2148
|
+
ho as getTeamsCommonOpponents,
|
|
2149
|
+
Rt as getTennisLivescore,
|
|
2150
|
+
lt as getTopAssistersFromMatches,
|
|
2151
|
+
mt as getTopGoalContributorsFromMatches,
|
|
2152
|
+
dt as getTopScorersFromMatches,
|
|
2153
|
+
$o as isConfigured,
|
|
2154
|
+
ao as isMatchFinished,
|
|
2155
|
+
ht as isTeamAway,
|
|
2156
|
+
J as isTeamHome,
|
|
2157
|
+
ro as isTeamInMatch,
|
|
2158
|
+
Et as search,
|
|
2159
|
+
Ot as searchFootball,
|
|
2160
|
+
xo as setConfig,
|
|
1829
2161
|
T as streakFilters,
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
2162
|
+
_ as toProviderRefArray,
|
|
2163
|
+
eo as useAllPlayerStatisticsFromMatches,
|
|
2164
|
+
Zt as useMostCardedPlayersFromMatches,
|
|
2165
|
+
to as usePlayerStatistics,
|
|
2166
|
+
pt as usePlayerStatisticsMap,
|
|
2167
|
+
Xt as useTopAssistersFromMatches,
|
|
2168
|
+
wt as useTopGoalContributorsFromMatches,
|
|
2169
|
+
Qt as useTopScorersFromMatches
|
|
1838
2170
|
};
|