fansunited-data-layer 0.12.0 → 0.13.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.
Files changed (32) hide show
  1. package/api/fansunited-sdk/odds/matches.d.ts.map +1 -1
  2. package/api/sportal365-sports/football/index.d.ts +2 -2
  3. package/api/sportal365-sports/football/index.d.ts.map +1 -1
  4. package/api/sportal365-sports/football/statistics/index.d.ts +46 -1
  5. package/api/sportal365-sports/football/statistics/index.d.ts.map +1 -1
  6. package/api/sportal365-sports/football/statistics/player-career.transformer.d.ts +11 -0
  7. package/api/sportal365-sports/football/statistics/player-career.transformer.d.ts.map +1 -0
  8. package/api/sportal365-sports/football/statistics/player-career.types.d.ts +115 -0
  9. package/api/sportal365-sports/football/statistics/player-career.types.d.ts.map +1 -0
  10. package/api/sportal365-sports/football/statistics/player-recent.transformer.d.ts +11 -0
  11. package/api/sportal365-sports/football/statistics/player-recent.transformer.d.ts.map +1 -0
  12. package/api/sportal365-sports/football/statistics/player-recent.types.d.ts +31 -0
  13. package/api/sportal365-sports/football/statistics/player-recent.types.d.ts.map +1 -0
  14. package/api/sportal365-sports/index.d.ts +2 -2
  15. package/api/sportal365-sports/index.d.ts.map +1 -1
  16. package/api/sportal365-sports/shared/odds.transformer.d.ts.map +1 -1
  17. package/client.cjs +1 -1
  18. package/client.js +2 -2
  19. package/fansunited-data-layer.cjs +1 -1
  20. package/fansunited-data-layer.js +15 -13
  21. package/index.d.ts +3 -3
  22. package/index.d.ts.map +1 -1
  23. package/{matches-CmJlbloT.js → matches-BvHU-bP0.js} +723 -559
  24. package/matches-Ci0Ci_Mw.cjs +1 -0
  25. package/package.json +1 -1
  26. package/types/canonical/index.d.ts +1 -1
  27. package/types/canonical/index.d.ts.map +1 -1
  28. package/types/canonical/odds.types.d.ts +1 -0
  29. package/types/canonical/odds.types.d.ts.map +1 -1
  30. package/types/canonical/statistics.types.d.ts +102 -0
  31. package/types/canonical/statistics.types.d.ts.map +1 -1
  32. package/matches-B4GkQKDb.cjs +0 -1
@@ -1,58 +1,58 @@
1
- const A = "__FANSUNITED_DATA_LAYER_CONFIG__";
2
- function Le(e) {
3
- globalThis[A] = e;
1
+ const E = "__FANSUNITED_DATA_LAYER_CONFIG__";
2
+ function xe(e) {
3
+ globalThis[E] = e;
4
4
  }
5
5
  function g() {
6
- const e = globalThis[A];
6
+ const e = globalThis[E];
7
7
  if (!e)
8
8
  throw new Error("Data layer config not initialized. Call setConfig() in your root layout.");
9
9
  return e;
10
10
  }
11
- function ke() {
12
- return globalThis[A] !== void 0;
11
+ function Me() {
12
+ return globalThis[E] !== void 0;
13
13
  }
14
- function U(e) {
14
+ function $(e) {
15
15
  const t = e.replace(/\/$/, "");
16
- function n(s) {
17
- const { sportal365Sports: a } = s;
16
+ function s(o) {
17
+ const { sportal365Sports: a } = o;
18
18
  if (!a)
19
19
  throw new Error("Sportal365 Sports API configuration is missing");
20
- const l = `${a.username}:${a.password}`;
21
- return `Basic ${btoa(l)}`;
20
+ const c = `${a.username}:${a.password}`;
21
+ return `Basic ${btoa(c)}`;
22
22
  }
23
- function o(s) {
24
- return `${t}${s}`;
23
+ function n(o) {
24
+ return `${t}${o}`;
25
25
  }
26
26
  return {
27
- async get(s) {
28
- const a = s.config || g(), { sportal365Sports: l } = a;
29
- if (!l)
27
+ async get(o) {
28
+ const a = o.config || g(), { sportal365Sports: c } = a;
29
+ if (!c)
30
30
  throw new Error("Sportal365 Sports API configuration is missing");
31
- const d = new URL(o(s.path));
32
- if (s.params)
33
- for (const [_, m] of Object.entries(s.params))
34
- m !== void 0 && (Array.isArray(m) ? m.length > 0 && d.searchParams.set(_, m.join(",")) : d.searchParams.set(_, m));
35
- const u = await fetch(d.toString(), {
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
36
  method: "GET",
37
37
  headers: {
38
- Authorization: n(a),
38
+ Authorization: s(a),
39
39
  "Content-Type": "application/json",
40
- "X-Project": l.projectId,
40
+ "X-Project": c.projectId,
41
41
  // Merge custom headers (they can override defaults)
42
- ...s.headers
42
+ ...o.headers
43
43
  },
44
- signal: l.timeout ? AbortSignal.timeout(l.timeout) : void 0,
44
+ signal: c.timeout ? AbortSignal.timeout(c.timeout) : void 0,
45
45
  // Next.js cache options for ISR/on-demand revalidation
46
- ...s.next && { next: s.next }
46
+ ...o.next && { next: o.next }
47
47
  });
48
- if (!u.ok)
49
- throw new Error(`Sportal365 API error: ${u.status} ${u.statusText}`);
50
- return u.json();
48
+ if (!d.ok)
49
+ throw new Error(`Sportal365 API error: ${d.status} ${d.statusText}`);
50
+ return d.json();
51
51
  }
52
52
  };
53
53
  }
54
- const G = "https://football.api.sportal365.com", De = "https://basketball.api.sportal365.com", Ne = "https://tennis.api.sportal365.com", Fe = "https://sports-statistics.api.sportal365.com", Pe = "https://sports-search.api.sportal365.com", xe = "https://standing.api.sportal365.com", p = U(G);
55
- function R(e) {
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
56
  if (e)
57
57
  return {
58
58
  id: e.id,
@@ -91,7 +91,7 @@ const H = {
91
91
  PENALTY_MISSED: "PENALTY_MISSED",
92
92
  PENALTY_SAVED: "PENALTY_SAVED"
93
93
  };
94
- function S(e) {
94
+ function I(e) {
95
95
  const t = H[e.type_code];
96
96
  return t ? {
97
97
  id: e.id,
@@ -99,12 +99,12 @@ function S(e) {
99
99
  competitorPosition: e.team_position === "HOME" ? "ONE" : "TWO",
100
100
  minute: e.minute,
101
101
  injuryMinute: e.injury_minute,
102
- primaryPlayer: R(e.primary_player),
103
- secondaryPlayer: R(e.secondary_player),
102
+ primaryPlayer: L(e.primary_player),
103
+ secondaryPlayer: L(e.secondary_player),
104
104
  score: e.score ? { competitorOne: String(e.score.home), competitorTwo: String(e.score.away) } : void 0
105
105
  } : (console.warn(`Unknown event type: ${e.type_code}`), null);
106
106
  }
107
- function r(e, t = "sportal365") {
107
+ function u(e, t = "sportal365") {
108
108
  if (e)
109
109
  return [
110
110
  {
@@ -113,19 +113,19 @@ function r(e, t = "sportal365") {
113
113
  }
114
114
  ];
115
115
  }
116
- function Me(e, t) {
117
- return e ? e.find((o) => o.provider === t)?.id : void 0;
116
+ function Ye(e, t) {
117
+ return e ? e.find((n) => n.provider === t)?.id : void 0;
118
118
  }
119
- function Ue(e, t, n) {
120
- const o = e ?? [], s = o.findIndex((a) => a.provider === t);
121
- if (s >= 0) {
122
- const a = [...o];
123
- return a[s] = { provider: t, id: n }, a;
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
124
  } else
125
- return [...o, { provider: t, id: n }];
125
+ return [...n, { provider: t, id: s }];
126
126
  }
127
127
  function B(e) {
128
- const t = e.urls?.find((n) => n.app_type === "desktop")?.url;
128
+ const t = e.urls?.find((s) => s.app_type === "desktop")?.url;
129
129
  return {
130
130
  id: e.id,
131
131
  name: e.name,
@@ -134,10 +134,11 @@ function B(e) {
134
134
  odds: e.odds,
135
135
  oddsOld: e.odds_old,
136
136
  movement: e.movement === "STABLE" ? "NONE" : e.movement,
137
- url: t
137
+ url: t,
138
+ providerSelectionId: e.provider_info?.selection_id
138
139
  };
139
140
  }
140
- function $(e) {
141
+ function Y(e) {
141
142
  return {
142
143
  type: {
143
144
  id: e.type.id,
@@ -152,32 +153,32 @@ function $(e) {
152
153
  selections: e.selections.map(B)
153
154
  };
154
155
  }
155
- function Y(e) {
156
+ function V(e) {
156
157
  if (!e) return !0;
157
- const t = e.replace("#", ""), n = parseInt(t.substring(0, 2), 16), o = parseInt(t.substring(2, 4), 16), s = parseInt(t.substring(4, 6), 16);
158
- return (0.2126 * n + 0.7152 * o + 0.0722 * s) / 255 < 0.5;
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;
159
160
  }
160
- function V(e) {
161
- const t = e.bookmaker.assets?.[0], n = e.bookmaker.branding || t, o = e.bookmaker.branding?.background_color || t?.background_color, s = e.bookmaker.branding?.text_color || (Y(o) ? "#FFFFFF" : "#000000");
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");
162
163
  return {
163
164
  operator: {
164
165
  id: e.bookmaker.id,
165
166
  name: e.bookmaker.name,
166
167
  url: e.bookmaker.url,
167
- branding: n ? {
168
- backgroundColor: o,
169
- textColor: s,
168
+ branding: s ? {
169
+ backgroundColor: n,
170
+ textColor: o,
170
171
  logo: t?.logo
171
172
  } : void 0
172
173
  },
173
174
  type: e.type,
174
- markets: e.markets.map($)
175
+ markets: e.markets.map(Y)
175
176
  };
176
177
  }
177
- function W(e) {
178
- return e.map(V);
179
- }
180
178
  function j(e) {
179
+ return e.map(W);
180
+ }
181
+ function K(e) {
181
182
  const t = {
182
183
  finished_ap: "finished_after_penalties",
183
184
  // finished after penalties
@@ -191,8 +192,8 @@ function j(e) {
191
192
  postponed: "postponed",
192
193
  abandoned: "abandoned"
193
194
  };
194
- let n;
195
- return e.code && t[e.code] ? n = t[e.code] : n = {
195
+ let s;
196
+ return e.code && t[e.code] ? s = t[e.code] : s = {
196
197
  FINISHED: "finished",
197
198
  NOT_STARTED: "not_started",
198
199
  LIVE: "live",
@@ -202,13 +203,13 @@ function j(e) {
202
203
  UNKNOWN: "not_started",
203
204
  ABANDONED: "abandoned"
204
205
  }[e.type] ?? "not_started", {
205
- code: n,
206
+ code: s,
206
207
  name: e.name,
207
208
  shortName: e.short_name,
208
209
  type: e.type
209
210
  };
210
211
  }
211
- function L(e) {
212
+ function k(e) {
212
213
  return {
213
214
  id: e.id,
214
215
  name: e.name,
@@ -231,10 +232,10 @@ function L(e) {
231
232
  }
232
233
  ]
233
234
  } : void 0,
234
- providerRef: r(e.uuid)
235
+ providerRef: u(e.uuid)
235
236
  };
236
237
  }
237
- function K(e) {
238
+ function q(e) {
238
239
  return {
239
240
  kickoffTime: new Date(e.kickoff_time),
240
241
  currentMinute: e.minute?.regular_time,
@@ -246,12 +247,12 @@ function K(e) {
246
247
  extraTimeSecondHalfStartedAt: e.extra_time_second_half_started_at ? new Date(e.extra_time_second_half_started_at) : void 0
247
248
  };
248
249
  }
249
- function q(e) {
250
+ function X(e) {
250
251
  if (!e) return;
251
- const t = (o) => o ? { competitorOne: String(o.home), competitorTwo: String(o.away) } : void 0, n = e.after_extra_time ?? e.regular_time;
252
+ const t = (n) => n ? { competitorOne: String(n.home), competitorTwo: String(n.away) } : void 0, s = e.after_extra_time ?? e.regular_time;
252
253
  return {
253
- competitorOne: n?.home != null ? String(n.home) : null,
254
- competitorTwo: n?.away != null ? String(n.away) : null,
254
+ competitorOne: s?.home != null ? String(s.home) : null,
255
+ competitorTwo: s?.away != null ? String(s.away) : null,
255
256
  breakdown: {
256
257
  total: t(e.total),
257
258
  halfTime: t(e.half_time),
@@ -262,17 +263,17 @@ function q(e) {
262
263
  }
263
264
  };
264
265
  }
265
- function X(e) {
266
+ function z(e) {
266
267
  if (e)
267
268
  return {
268
269
  id: e.id,
269
270
  name: e.name,
270
271
  slug: e.slug,
271
272
  assets: e.assets?.image?.url ? { image: e.assets.image.url } : void 0,
272
- providerRef: r(e.uuid)
273
+ providerRef: u(e.uuid)
273
274
  };
274
275
  }
275
- function z(e) {
276
+ function J(e) {
276
277
  if (e?.length)
277
278
  return e.map((t) => ({
278
279
  id: t.id,
@@ -282,9 +283,9 @@ function z(e) {
282
283
  gender: t.gender
283
284
  }));
284
285
  }
285
- function J(e) {
286
+ function Q(e) {
286
287
  if (!e.season?.tournament) return;
287
- const { tournament: t, ...n } = e.season;
288
+ const { tournament: t, ...s } = e.season;
288
289
  return {
289
290
  id: t.id,
290
291
  name: t.name,
@@ -296,12 +297,12 @@ function J(e) {
296
297
  name: t.country.name,
297
298
  code: t.country.code ?? void 0,
298
299
  flag: t.country.assets?.flag?.url,
299
- providerRef: r(t.country.uuid)
300
+ providerRef: u(t.country.uuid)
300
301
  } : void 0,
301
302
  season: {
302
- id: n.id,
303
- name: n.name,
304
- status: n.status
303
+ id: s.id,
304
+ name: s.name,
305
+ status: s.status
305
306
  },
306
307
  stage: e.stage ? {
307
308
  id: e.stage.id,
@@ -309,10 +310,10 @@ function J(e) {
309
310
  type: e.stage.type
310
311
  } : void 0,
311
312
  assets: t.assets?.logo?.url ? { logo: t.assets.logo.url } : void 0,
312
- providerRef: r(t.uuid)
313
+ providerRef: u(t.uuid)
313
314
  };
314
315
  }
315
- function Q(e) {
316
+ function Z(e) {
316
317
  if (!e.winner?.match?.id) return;
317
318
  const t = {
318
319
  "Regular Time": "REGULAR_TIME",
@@ -325,41 +326,41 @@ function Q(e) {
325
326
  aggregate: !!e.winner.aggregate
326
327
  };
327
328
  }
328
- function E(e) {
329
+ function b(e) {
329
330
  return {
330
331
  id: e.id,
331
332
  slug: e.slug,
332
333
  sport: "football",
333
- status: j(e.status),
334
- timing: K(e),
335
- competitorOne: L(e.home_team),
336
- competitorTwo: L(e.away_team),
337
- competition: J(e),
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),
338
339
  round: e.round ? {
339
340
  id: e.round.id ?? e.round.key,
340
341
  key: e.round.key,
341
342
  name: e.round.name,
342
343
  type: e.round.type ?? "REGULAR",
343
- providerRef: r(e.round.uuid)
344
+ providerRef: u(e.round.uuid)
344
345
  } : void 0,
345
346
  group: e.group ? {
346
347
  id: e.group.id,
347
348
  name: e.group.name,
348
- providerRef: r(e.group.uuid)
349
+ providerRef: u(e.group.uuid)
349
350
  } : void 0,
350
- venue: X(e.venue),
351
- officials: z(e.referees),
351
+ venue: z(e.venue),
352
+ officials: J(e.referees),
352
353
  spectators: e.spectators ?? void 0,
353
- score: q(e.score),
354
- mainEvents: e.main_events?.map(S).filter((t) => t !== null),
355
- penaltyShootoutEvents: e.penalty_shootout_events?.map(S).filter((t) => t !== null),
356
- winner: Q(e),
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),
357
358
  coverage: e.coverage === "NOT_LIVE" ? "UNKNOWN" : e.coverage,
358
359
  lineupStatus: e.lineup_status === "UNCONFIRMED" ? "EXPECTED" : e.lineup_status,
359
- providerRef: r(e.uuid)
360
+ providerRef: u(e.uuid)
360
361
  };
361
362
  }
362
- function Z(e) {
363
+ function w(e) {
363
364
  const t = e.player;
364
365
  return {
365
366
  id: t.id,
@@ -373,7 +374,7 @@ function Z(e) {
373
374
  id: t.country.id,
374
375
  name: t.country.name,
375
376
  code: t.country.code,
376
- providerRef: r(t.country.uuid)
377
+ providerRef: u(t.country.uuid)
377
378
  } : void 0,
378
379
  birthdate: t.birthdate,
379
380
  profile: t.profile ? {
@@ -384,15 +385,15 @@ function Z(e) {
384
385
  photo: t.assets.thumb?.url,
385
386
  photoTransparent: t.assets.thumb_transparent_background?.url
386
387
  } : void 0,
387
- events: e.events?.map(S).filter((n) => n !== null),
388
- providerRef: r(t.uuid)
388
+ events: e.events?.map(I).filter((s) => s !== null),
389
+ providerRef: u(t.uuid)
389
390
  };
390
391
  }
391
- function k(e) {
392
- const t = [], n = [];
393
- for (const o of e.players) {
394
- const s = Z(o);
395
- o.type.category === "start" ? t.push(s) : o.type.category === "sub" && n.push(s);
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);
396
397
  }
397
398
  return {
398
399
  competitorId: e.team_id,
@@ -405,73 +406,73 @@ function k(e) {
405
406
  id: e.coach.country.id,
406
407
  name: e.coach.country.name,
407
408
  code: e.coach.country.code,
408
- providerRef: r(e.coach.country.uuid)
409
+ providerRef: u(e.coach.country.uuid)
409
410
  } : void 0,
410
411
  birthdate: e.coach.birthdate,
411
- providerRef: r(e.coach.uuid)
412
+ providerRef: u(e.coach.uuid)
412
413
  } : void 0,
413
414
  starters: t,
414
- substitutes: n
415
+ substitutes: s
415
416
  };
416
417
  }
417
- function w(e) {
418
+ function ee(e) {
418
419
  return {
419
420
  matchId: e.match_id,
420
421
  confirmed: e.status === "CONFIRMED",
421
- competitorOne: k(e.home_team),
422
- competitorTwo: k(e.away_team)
422
+ competitorOne: D(e.home_team),
423
+ competitorTwo: D(e.away_team)
423
424
  };
424
425
  }
425
- function y(e, t, n, o) {
426
- return t == null ? null : { key: e, value: String(t), label: n, unit: o };
427
- }
428
- function D(e, t) {
429
- const n = (t.shots_on ?? 0) + (t.shots_off ?? 0) + (t.shots_blocked ?? 0), o = [
430
- y("possession", t.possession, "Possession", "%"),
431
- y("shots_total", n, "Shots"),
432
- y("shots_on_target", t.shots_on, "Shots on Target"),
433
- y("shots_off_target", t.shots_off, "Shots off Target"),
434
- y("shots_blocked", t.shots_blocked, "Shots Blocked"),
435
- y("corners", t.corners, "Corner Kicks"),
436
- y("goal_kicks", t.goal_kicks, "Goal Kicks"),
437
- y("throw_ins", t.throw_in, "Throw Ins"),
438
- y("offsides", t.offside, "Offsides"),
439
- y("fouls", t.fouls_committed, "Fouls"),
440
- y("yellow_cards", t.yellow_cards, "Yellow Cards"),
441
- y("passes", t.pass, "Passes"),
442
- y("crosses", t.crosses, "Crosses")
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")
443
444
  ];
444
445
  return {
445
446
  competitorId: e,
446
- statistics: o.filter((s) => s !== null)
447
+ statistics: n.filter((o) => o !== null)
447
448
  };
448
449
  }
449
- function ee(e) {
450
- const t = e.find((o) => o.home_team), n = e.find((o) => !o.home_team);
451
- if (!t || !n)
450
+ function te(e) {
451
+ const t = e.find((n) => n.home_team), s = e.find((n) => !n.home_team);
452
+ if (!t || !s)
452
453
  throw new Error("Missing competitor statistics");
453
454
  return {
454
- competitorOne: D(String(t.team.id), t.statistics),
455
- competitorTwo: D(String(n.team.id), n.statistics)
455
+ competitorOne: N(String(t.team.id), t.statistics),
456
+ competitorTwo: N(String(s.team.id), s.statistics)
456
457
  };
457
458
  }
458
- function te(e, t) {
459
+ function ne(e, t) {
459
460
  return {
460
461
  matchId: e,
461
- operators: W(t)
462
+ operators: j(t)
462
463
  };
463
464
  }
464
- function N(e) {
465
+ function F(e) {
465
466
  if (e == null || e === "")
466
467
  return;
467
468
  const t = typeof e == "number" ? e : parseInt(e, 10);
468
469
  return isNaN(t) ? void 0 : t;
469
470
  }
470
- function oe(e) {
471
+ function se(e) {
471
472
  return {
472
473
  externalId: e.external_id,
473
- minute: N(e.elapsed),
474
- addedTime: N(e.elapsed_plus),
474
+ minute: F(e.elapsed),
475
+ addedTime: F(e.elapsed_plus),
475
476
  text: e.auto_text,
476
477
  details: e.details,
477
478
  meta: {
@@ -483,11 +484,11 @@ function oe(e) {
483
484
  }
484
485
  };
485
486
  }
486
- async function Ge(e, t, n) {
487
- const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
487
+ async function We(e, t, s) {
488
+ const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
488
489
  path: `/v2/matches/${e}`,
489
490
  params: {
490
- language_code: t?.languageCode ?? s?.languageCode ?? "en",
491
+ language_code: t?.languageCode ?? o?.languageCode ?? "en",
491
492
  odd_client: t?.oddClient,
492
493
  odd_type: t?.oddType,
493
494
  scope_type: t?.scopeType,
@@ -497,47 +498,47 @@ async function Ge(e, t, n) {
497
498
  optional_data: t?.optionalData
498
499
  },
499
500
  headers: {
500
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
501
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
501
502
  },
502
503
  next: t?.next,
503
- config: o
504
+ config: n
504
505
  });
505
- return E(a);
506
+ return b(a);
506
507
  }
507
- async function He(e, t, n) {
508
- const o = n || g(), { sportal365Sports: s } = o;
508
+ async function je(e, t, s) {
509
+ const n = s || g(), { sportal365Sports: o } = n;
509
510
  return (await p.get({
510
511
  path: `/v2/matches/${e}/events`,
511
512
  params: {
512
- language_code: t?.languageCode ?? s?.languageCode ?? "en"
513
+ language_code: t?.languageCode ?? o?.languageCode ?? "en"
513
514
  },
514
515
  headers: {
515
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
516
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
516
517
  },
517
518
  next: t?.next,
518
- config: o
519
- })).events.map(S).filter((l) => l !== null);
519
+ config: n
520
+ })).events.map(I).filter((c) => c !== null);
520
521
  }
521
- async function Be(e, t, n) {
522
- const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
522
+ async function Ke(e, t, s) {
523
+ const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
523
524
  path: `/v2/matches/${e}/lineups`,
524
525
  params: {
525
- language_code: t?.languageCode ?? s?.languageCode ?? "en"
526
+ language_code: t?.languageCode ?? o?.languageCode ?? "en"
526
527
  },
527
528
  headers: {
528
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
529
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
529
530
  },
530
531
  next: t?.next,
531
- config: o
532
+ config: n
532
533
  });
533
- return w(a);
534
+ return ee(a);
534
535
  }
535
- async function $e(e, t, n) {
536
- const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
536
+ async function qe(e, t, s) {
537
+ const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
537
538
  path: `/v2/matches/${e}`,
538
539
  params: {
539
- language_code: t?.languageCode ?? s?.languageCode ?? "en",
540
- odd_client: t?.oddClient ?? s?.oddClient,
540
+ language_code: t?.languageCode ?? o?.languageCode ?? "en",
541
+ odd_client: t?.oddClient ?? o?.oddClient,
541
542
  odd_type: t?.oddType,
542
543
  scope_type: t?.scopeType ?? "ALL",
543
544
  odd_format: t?.oddFormat ?? "DECIMAL",
@@ -545,47 +546,47 @@ async function $e(e, t, n) {
545
546
  bookmaker_ids: t?.bookmakerIds
546
547
  },
547
548
  headers: {
548
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
549
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
549
550
  },
550
551
  next: t?.next,
551
- config: o
552
+ config: n
552
553
  });
553
- return te(e, a.odds ?? []);
554
+ return ne(e, a.odds ?? []);
554
555
  }
555
- async function Ye(e, t, n) {
556
- const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
556
+ async function Xe(e, t, s) {
557
+ const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
557
558
  path: `/events/${e}/teamstats`,
558
559
  params: {
559
- language_code: t?.languageCode ?? s?.languageCode ?? "en"
560
+ language_code: t?.languageCode ?? o?.languageCode ?? "en"
560
561
  },
561
562
  headers: {
562
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
563
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
563
564
  },
564
565
  next: t?.next,
565
- config: o
566
+ config: n
566
567
  });
567
- return ee(a);
568
+ return te(a);
568
569
  }
569
- async function Ve(e, t, n) {
570
- const o = n || g(), { sportal365Sports: s } = o;
570
+ async function ze(e, t, s) {
571
+ const n = s || g(), { sportal365Sports: o } = n;
571
572
  return (await p.get({
572
573
  path: `/matches/${e}/commentary`,
573
574
  params: {
574
- language_code: t?.languageCode ?? s?.languageCode ?? "en"
575
+ language_code: t?.languageCode ?? o?.languageCode ?? "en"
575
576
  },
576
577
  headers: {
577
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
578
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
578
579
  },
579
580
  next: t?.next,
580
- config: o
581
- })).map(oe);
581
+ config: n
582
+ })).map(se);
582
583
  }
583
- async function We(e, t) {
584
- const n = t || g(), { sportal365Sports: o } = n;
584
+ async function Je(e, t) {
585
+ const s = t || g(), { sportal365Sports: n } = s;
585
586
  return (await p.get({
586
587
  path: "/v2/matches",
587
588
  params: {
588
- language_code: e.languageCode ?? o?.languageCode ?? "en",
589
+ language_code: e.languageCode ?? n?.languageCode ?? "en",
589
590
  limit: e.limit.toString(),
590
591
  offset: e.offset.toString(),
591
592
  // Competition filters
@@ -608,7 +609,7 @@ async function We(e, t) {
608
609
  status_types: e.statusTypes,
609
610
  status_codes: e.statusCodes,
610
611
  // Odds
611
- odd_client: e.oddClient ?? o?.oddClient,
612
+ odd_client: e.oddClient ?? n?.oddClient,
612
613
  odd_type: e.oddType,
613
614
  scope_type: e.scopeType,
614
615
  odd_format: e.oddFormat,
@@ -619,14 +620,14 @@ async function We(e, t) {
619
620
  optional_data: e.optionalData
620
621
  },
621
622
  headers: {
622
- "Accept-Language": e.languageCode ?? o?.languageCode ?? "en"
623
+ "Accept-Language": e.languageCode ?? n?.languageCode ?? "en"
623
624
  },
624
625
  next: e.next,
625
- config: n
626
- })).matches.map(E);
626
+ config: s
627
+ })).matches.map(b);
627
628
  }
628
- async function je(e, t) {
629
- const n = t || g(), { sportal365Sports: o } = n;
629
+ async function Qe(e, t) {
630
+ const s = t || g(), { sportal365Sports: n } = s;
630
631
  return (await p.get({
631
632
  path: "/v2/matches/livescore",
632
633
  params: {
@@ -637,9 +638,9 @@ async function je(e, t) {
637
638
  tournament_group: e?.tournamentGroup,
638
639
  status_types: e?.statusTypes,
639
640
  selection_filter: e?.selectionFilter,
640
- language_code: e?.languageCode ?? o?.languageCode ?? "en",
641
+ language_code: e?.languageCode ?? n?.languageCode ?? "en",
641
642
  // Odds parameters
642
- odd_client: e?.oddClient ?? o?.oddClient,
643
+ odd_client: e?.oddClient ?? n?.oddClient,
643
644
  odd_type: e?.oddType,
644
645
  scope_type: e?.scopeType,
645
646
  odd_format: e?.oddFormat,
@@ -648,13 +649,13 @@ async function je(e, t) {
648
649
  optional_data: e?.optionalData
649
650
  },
650
651
  headers: {
651
- "Accept-Language": e?.languageCode ?? o?.languageCode ?? "en"
652
+ "Accept-Language": e?.languageCode ?? n?.languageCode ?? "en"
652
653
  },
653
654
  next: e?.next,
654
- config: n
655
- })).matches.map(E);
655
+ config: s
656
+ })).matches.map(b);
656
657
  }
657
- function ne(e) {
658
+ function oe(e) {
658
659
  return {
659
660
  id: e.id,
660
661
  name: e.name,
@@ -668,7 +669,7 @@ function ne(e) {
668
669
  name: e.country.name,
669
670
  code: e.country.code ?? void 0,
670
671
  flag: e.country.assets?.flag?.url,
671
- providerRef: r(e.country.uuid)
672
+ providerRef: u(e.country.uuid)
672
673
  } : void 0,
673
674
  // Extended team profile data
674
675
  venue: e.venue ? {
@@ -683,16 +684,16 @@ function ne(e) {
683
684
  name: e.venue.city.country.name,
684
685
  code: e.venue.city.country.code ?? void 0,
685
686
  flag: e.venue.city.country.assets?.flag?.url,
686
- providerRef: r(e.venue.city.country.uuid)
687
+ providerRef: u(e.venue.city.country.uuid)
687
688
  } : void 0,
688
- providerRef: r(e.venue.city.uuid ?? void 0)
689
+ providerRef: u(e.venue.city.uuid ?? void 0)
689
690
  } : void 0,
690
691
  country: e.venue.country ? {
691
692
  id: e.venue.country.id,
692
693
  name: e.venue.country.name,
693
694
  code: e.venue.country.code ?? void 0,
694
695
  flag: e.venue.country.assets?.flag?.url,
695
- providerRef: r(e.venue.country.uuid)
696
+ providerRef: u(e.venue.country.uuid)
696
697
  } : void 0,
697
698
  profile: e.venue.profile ? {
698
699
  latitude: e.venue.profile.lat,
@@ -702,7 +703,7 @@ function ne(e) {
702
703
  assets: e.venue.assets?.image?.url ? {
703
704
  image: e.venue.assets.image.url
704
705
  } : void 0,
705
- providerRef: r(e.venue.uuid)
706
+ providerRef: u(e.venue.uuid)
706
707
  } : void 0,
707
708
  coach: e.coach ? {
708
709
  id: e.coach.id,
@@ -713,10 +714,10 @@ function ne(e) {
713
714
  name: e.coach.country.name,
714
715
  code: e.coach.country.code ?? void 0,
715
716
  flag: e.coach.country.assets?.flag?.url,
716
- providerRef: r(e.coach.country.uuid)
717
+ providerRef: u(e.coach.country.uuid)
717
718
  },
718
719
  birthdate: e.coach.birthdate,
719
- providerRef: r(e.coach.uuid)
720
+ providerRef: u(e.coach.uuid)
720
721
  } : void 0,
721
722
  founded: e.founded,
722
723
  // Assets
@@ -746,28 +747,28 @@ function ne(e) {
746
747
  name: t.name,
747
748
  slug: t.slug,
748
749
  active: t.status === "ACTIVE",
749
- providerRef: r(t.uuid)
750
+ providerRef: u(t.uuid)
750
751
  })),
751
752
  currentSeason: e.current_season ? {
752
753
  id: e.current_season.id,
753
754
  name: e.current_season.name,
754
755
  slug: e.current_season.slug,
755
756
  active: e.current_season.status === "ACTIVE",
756
- providerRef: r(e.current_season.uuid)
757
+ providerRef: u(e.current_season.uuid)
757
758
  } : void 0,
758
759
  // Form - map to FUSportsCompetitorForm
759
760
  form: e.form && e.form.length > 0 ? {
760
761
  competitorId: e.id,
761
762
  results: e.form.map((t) => {
762
- const o = t.participants[0].id === e.uuid ? t.participants[1] : t.participants[0], s = t.result[0]?.results.find((d) => d.position === "1")?.value, a = t.result[0]?.results.find((d) => d.position === "2")?.value, l = t.outcome === "win" ? "W" : t.outcome === "draw" ? "D" : "L";
763
+ 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";
763
764
  return {
764
765
  matchId: t.id,
765
- result: l,
766
- score: s && a ? `${s}-${a}` : void 0,
766
+ result: c,
767
+ score: o && a ? `${o}-${a}` : void 0,
767
768
  opponent: {
768
- id: o.id,
769
- name: o.name,
770
- logo: o.display_asset?.url
769
+ id: n.id,
770
+ name: n.name,
771
+ logo: n.display_asset?.url
771
772
  },
772
773
  date: new Date(t.start_time),
773
774
  competition: t.competition ? {
@@ -778,10 +779,10 @@ function ne(e) {
778
779
  }),
779
780
  formString: e.form.map((t) => t.outcome === "win" ? "W" : t.outcome === "draw" ? "D" : "L").join("")
780
781
  } : void 0,
781
- providerRef: r(e.uuid)
782
+ providerRef: u(e.uuid)
782
783
  };
783
784
  }
784
- function se(e) {
785
+ function ae(e) {
785
786
  const t = e.player;
786
787
  return {
787
788
  id: t.id,
@@ -794,7 +795,7 @@ function se(e) {
794
795
  name: t.country.name,
795
796
  code: t.country.code ?? void 0,
796
797
  flag: t.country.assets?.flag?.url,
797
- providerRef: r(t.country.uuid)
798
+ providerRef: u(t.country.uuid)
798
799
  } : void 0,
799
800
  gender: t.gender,
800
801
  birthdate: t.birthdate,
@@ -810,11 +811,11 @@ function se(e) {
810
811
  contractType: e.contract_type,
811
812
  contractUntil: e.contract_until ?? void 0,
812
813
  joinedDate: e.start_date ?? void 0,
813
- providerRef: r(t.id)
814
+ providerRef: u(t.id)
814
815
  // Using player.id as provider reference
815
816
  };
816
817
  }
817
- function ae(e) {
818
+ function ie(e) {
818
819
  return {
819
820
  id: e.id,
820
821
  name: e.name,
@@ -824,74 +825,74 @@ function ae(e) {
824
825
  name: e.country.name,
825
826
  code: e.country.code ?? void 0,
826
827
  flag: e.country.assets?.flag?.url,
827
- providerRef: r(e.country.uuid)
828
+ providerRef: u(e.country.uuid)
828
829
  } : void 0,
829
830
  birthdate: e.birthdate,
830
- providerRef: r(e.uuid)
831
+ providerRef: u(e.uuid)
831
832
  };
832
833
  }
833
- function ie(e) {
834
+ function re(e) {
834
835
  return {
835
836
  teamId: e.team.id,
836
837
  teamName: e.team.name,
837
- coach: e.coach ? ae(e.coach) : void 0,
838
- players: e.players.map(se)
838
+ coach: e.coach ? ie(e.coach) : void 0,
839
+ players: e.players.map(ae)
839
840
  };
840
841
  }
841
- function re(e) {
842
+ function de(e) {
842
843
  const t = parseInt(e, 10);
843
844
  return isNaN(t) ? void 0 : t;
844
845
  }
845
846
  function i(e, t) {
846
- const n = e.find((o) => o.name === t);
847
- return n ? re(n.value) : void 0;
847
+ const s = e.find((n) => n.name === t);
848
+ return s ? de(s.value) : void 0;
848
849
  }
849
- function de(e, t) {
850
- const n = e.statistics;
850
+ function ue(e, t) {
851
+ const s = e.statistics;
851
852
  return {
852
853
  playerId: e.player.id,
853
854
  seasonId: e.season.id,
854
855
  teamId: t,
855
856
  // Core statistics
856
- appearances: i(n, "played"),
857
- started: i(n, "started"),
858
- substituteIn: i(n, "substitute_in"),
859
- substituteOut: i(n, "substitute_out"),
860
- minutes: i(n, "minutes"),
861
- minutesSubstitute: i(n, "minutes_substitute"),
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"),
862
863
  // Scoring
863
- goals: i(n, "goals"),
864
- goalsSubstitute: i(n, "goals_substitute"),
865
- penaltyGoals: i(n, "penalty_goals"),
866
- ownGoals: i(n, "own_goals"),
867
- assists: i(n, "assists"),
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"),
868
869
  // Shooting
869
- shots: i(n, "shots"),
870
- shotsOnTarget: i(n, "shots_on_target"),
870
+ shots: i(s, "shots"),
871
+ shotsOnTarget: i(s, "shots_on_target"),
871
872
  // Discipline
872
- yellowCards: i(n, "yellow_cards"),
873
- redCards: i(n, "red_cards"),
874
- foulsCommitted: i(n, "fouls_committed"),
875
- penaltiesCommitted: i(n, "penalties_committed"),
873
+ yellowCards: i(s, "yellow_cards"),
874
+ redCards: i(s, "red_cards"),
875
+ foulsCommitted: i(s, "fouls_committed"),
876
+ penaltiesCommitted: i(s, "penalties_committed"),
876
877
  // Penalties
877
- penaltiesMissed: i(n, "penalties_missed"),
878
+ penaltiesMissed: i(s, "penalties_missed"),
878
879
  // Defensive
879
- cleansheets: i(n, "cleansheets"),
880
+ cleansheets: i(s, "cleansheets"),
880
881
  // Goalkeeper-specific
881
- saves: i(n, "saves"),
882
- conceded: i(n, "conceded"),
883
- caughtBall: i(n, "caught_ball"),
884
- penaltiesReceived: i(n, "penalties_received"),
882
+ saves: i(s, "saves"),
883
+ conceded: i(s, "conceded"),
884
+ caughtBall: i(s, "caught_ball"),
885
+ penaltiesReceived: i(s, "penalties_received"),
885
886
  // Other
886
- offsides: i(n, "offsides"),
887
+ offsides: i(s, "offsides"),
887
888
  // Raw statistics array (for any additional stats not mapped above)
888
- rawStatistics: n.map((o) => ({
889
- name: o.name,
890
- value: o.value
889
+ rawStatistics: s.map((n) => ({
890
+ name: n.name,
891
+ value: n.value
891
892
  }))
892
893
  };
893
894
  }
894
- function ue(e) {
895
+ function ce(e) {
895
896
  const t = e.statistics;
896
897
  return {
897
898
  playerId: e.player.id,
@@ -929,176 +930,336 @@ function ue(e) {
929
930
  // Other
930
931
  offsides: i(t, "offsides"),
931
932
  // Raw statistics array
932
- rawStatistics: t.map((n) => ({
933
- name: n.name,
934
- value: n.value
933
+ rawStatistics: t.map((s) => ({
934
+ name: s.name,
935
+ value: s.value
935
936
  }))
936
937
  };
937
938
  }
938
- function c(e, t) {
939
+ function l(e, t) {
939
940
  if (!(e === void 0 && t === void 0))
940
941
  return (e ?? 0) + (t ?? 0);
941
942
  }
942
- function ce(e, t) {
943
+ function le(e, t) {
943
944
  return {
944
945
  playerId: e.playerId,
945
946
  seasonId: e.seasonId,
946
947
  // Core statistics
947
- appearances: c(e.appearances, t.appearances),
948
- started: c(e.started, t.started),
949
- substituteIn: c(e.substituteIn, t.substituteIn),
950
- substituteOut: c(e.substituteOut, t.substituteOut),
951
- minutes: c(e.minutes, t.minutes),
952
- minutesSubstitute: c(e.minutesSubstitute, t.minutesSubstitute),
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),
953
954
  // Scoring
954
- goals: c(e.goals, t.goals),
955
- goalsSubstitute: c(e.goalsSubstitute, t.goalsSubstitute),
956
- penaltyGoals: c(e.penaltyGoals, t.penaltyGoals),
957
- ownGoals: c(e.ownGoals, t.ownGoals),
958
- assists: c(e.assists, t.assists),
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),
959
960
  // Shooting
960
- shots: c(e.shots, t.shots),
961
- shotsOnTarget: c(e.shotsOnTarget, t.shotsOnTarget),
961
+ shots: l(e.shots, t.shots),
962
+ shotsOnTarget: l(e.shotsOnTarget, t.shotsOnTarget),
962
963
  // Discipline
963
- yellowCards: c(e.yellowCards, t.yellowCards),
964
- redCards: c(e.redCards, t.redCards),
965
- foulsCommitted: c(e.foulsCommitted, t.foulsCommitted),
966
- penaltiesCommitted: c(e.penaltiesCommitted, t.penaltiesCommitted),
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),
967
968
  // Penalties
968
- penaltiesMissed: c(e.penaltiesMissed, t.penaltiesMissed),
969
+ penaltiesMissed: l(e.penaltiesMissed, t.penaltiesMissed),
969
970
  // Defensive
970
- cleansheets: c(e.cleansheets, t.cleansheets),
971
+ cleansheets: l(e.cleansheets, t.cleansheets),
971
972
  // Goalkeeper-specific
972
- saves: c(e.saves, t.saves),
973
- conceded: c(e.conceded, t.conceded),
974
- caughtBall: c(e.caughtBall, t.caughtBall),
975
- penaltiesReceived: c(e.penaltiesReceived, t.penaltiesReceived),
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),
976
977
  // Other
977
- offsides: c(e.offsides, t.offsides),
978
+ offsides: l(e.offsides, t.offsides),
978
979
  // Concatenate raw statistics from both entries
979
980
  rawStatistics: [...e.rawStatistics ?? [], ...t.rawStatistics ?? []]
980
981
  };
981
982
  }
982
- async function le(e, t) {
983
- const n = t || g(), { sportal365Sports: o } = n, { seasonIds: s, teamId: a, languageCode: l, next: d } = e, u = d ?? { revalidate: 0 }, _ = {
984
- season_ids: s.join(","),
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(","),
985
1108
  team_id: a,
986
- language_code: l ?? o?.languageCode ?? "en"
1109
+ language_code: c ?? n?.languageCode ?? "en"
987
1110
  }, m = await p.get({
988
1111
  path: "/v2/statistics/players/season",
989
- params: _,
1112
+ params: f,
990
1113
  headers: {
991
- "Accept-Language": l ?? o?.languageCode ?? "en"
1114
+ "Accept-Language": c ?? n?.languageCode ?? "en"
992
1115
  },
993
- next: u,
994
- config: n
1116
+ next: d,
1117
+ config: s
995
1118
  });
996
1119
  if (!m.statistics)
997
1120
  return console.error("[getFootballPlayerSeasonStatistics] Invalid API response - missing statistics array:", {
998
1121
  teamId: a,
999
- seasonIds: s,
1122
+ seasonIds: o,
1000
1123
  response: m
1001
1124
  }), {};
1002
1125
  if (m.statistics.length === 0)
1003
1126
  throw console.warn("[getFootballPlayerSeasonStatistics] API returned empty statistics array:", {
1004
1127
  teamId: a,
1005
- seasonIds: s,
1128
+ seasonIds: o,
1006
1129
  hint: "This could be due to: wrong credentials, wrong project header, no data for this team/season, or API issue"
1007
1130
  }), new Error(
1008
- `No player statistics found for team ${a} in seasons ${s.join(", ")}. This could be due to: wrong credentials, wrong X-Project header, or no data available for this team/season.`
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.`
1009
1132
  );
1010
- const h = {};
1011
- for (const C of m.statistics) {
1012
- const T = C.player.id;
1013
- h[T] = de(C, a);
1133
+ const _ = {};
1134
+ for (const S of m.statistics) {
1135
+ const T = S.player.id;
1136
+ _[T] = ue(S, a);
1014
1137
  }
1015
- return h;
1138
+ return _;
1016
1139
  }
1017
- async function Ke(e, t) {
1018
- const n = t || g(), { sportal365Sports: o } = n, { playerIds: s, seasonIds: a, languageCode: l, next: d } = e, u = d ?? { revalidate: 0 }, _ = {
1019
- player_ids: s.join(","),
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(","),
1020
1143
  season_ids: a.join(","),
1021
- language_code: l ?? o?.languageCode ?? "en"
1144
+ language_code: c ?? n?.languageCode ?? "en"
1022
1145
  }, m = await p.get({
1023
1146
  path: "/v2/statistics/players/season",
1024
- params: _,
1147
+ params: f,
1025
1148
  headers: {
1026
- "Accept-Language": l ?? o?.languageCode ?? "en"
1149
+ "Accept-Language": c ?? n?.languageCode ?? "en"
1027
1150
  },
1028
- next: u,
1029
- config: n
1151
+ next: d,
1152
+ config: s
1030
1153
  });
1031
1154
  if (!m.statistics)
1032
1155
  return console.error("[getFootballPlayerSeasonStatisticsByPlayerIds] Invalid API response - missing statistics array:", {
1033
- playerIds: s,
1156
+ playerIds: o,
1034
1157
  seasonIds: a,
1035
1158
  response: m
1036
1159
  }), {};
1037
1160
  if (m.statistics.length === 0)
1038
1161
  return {};
1039
- const h = {};
1040
- for (const C of m.statistics) {
1041
- const T = C.player.id, f = ue(C);
1042
- h[T] ? h[T] = ce(h[T], f) : h[T] = f;
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;
1043
1166
  }
1044
- return h;
1167
+ return _;
1045
1168
  }
1046
- async function qe(e, t, n) {
1047
- const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
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({
1048
1209
  path: `/v2/teams/${e}`,
1049
1210
  params: {
1050
- language_code: t?.languageCode ?? s?.languageCode ?? "en",
1211
+ language_code: t?.languageCode ?? o?.languageCode ?? "en",
1051
1212
  optional_data: "form"
1052
1213
  },
1053
1214
  headers: {
1054
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
1215
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
1055
1216
  },
1056
1217
  next: t?.next,
1057
- config: o
1218
+ config: n
1058
1219
  });
1059
- return ne(a);
1220
+ return oe(a);
1060
1221
  }
1061
- async function Xe(e, t, n) {
1062
- const o = n || g(), { sportal365Sports: s } = o, a = t?.seasonIds && t.seasonIds.length > 0 ? { revalidate: 0 } : t?.next, l = await p.get({
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({
1063
1224
  path: `/v2/teams/${e}/squad`,
1064
1225
  params: {
1065
- language_code: t?.languageCode ?? s?.languageCode ?? "en",
1226
+ language_code: t?.languageCode ?? o?.languageCode ?? "en",
1066
1227
  memberStatus: t?.memberStatus ?? "ACTIVE"
1067
1228
  },
1068
1229
  headers: {
1069
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
1230
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
1070
1231
  },
1071
1232
  next: a,
1072
- config: o
1073
- }), d = ie(l);
1233
+ config: n
1234
+ }), r = re(c);
1074
1235
  if (t?.seasonIds && t.seasonIds.length > 0)
1075
1236
  try {
1076
- const u = await le(
1237
+ const d = await ye(
1077
1238
  {
1078
1239
  seasonIds: t.seasonIds,
1079
1240
  teamId: e,
1080
1241
  languageCode: t.languageCode,
1081
1242
  next: t.next
1082
1243
  },
1083
- o
1244
+ n
1084
1245
  );
1085
- for (const _ of d.players) {
1086
- const m = u[_.id];
1087
- m && (_.seasonStatistics = m);
1246
+ for (const f of r.players) {
1247
+ const m = d[f.id];
1248
+ m && (f.seasonStatistics = m);
1088
1249
  }
1089
- } catch (u) {
1250
+ } catch (d) {
1090
1251
  console.error("[getFootballTeamSquad] Failed to fetch player statistics:", {
1091
- error: u instanceof Error ? u.message : String(u),
1092
- stack: u instanceof Error ? u.stack : void 0,
1252
+ error: d instanceof Error ? d.message : String(d),
1253
+ stack: d instanceof Error ? d.stack : void 0,
1093
1254
  teamId: e,
1094
1255
  seasonIds: t.seasonIds
1095
1256
  });
1096
1257
  }
1097
1258
  else
1098
1259
  console.warn("[getFootballTeamSquad] No seasonIds provided, skipping stats fetch");
1099
- return d;
1260
+ return r;
1100
1261
  }
1101
- function me(e) {
1262
+ function he(e) {
1102
1263
  return {
1103
1264
  id: String(e.id),
1104
1265
  name: e.name,
@@ -1110,31 +1271,31 @@ function me(e) {
1110
1271
  id: String(e.country.id),
1111
1272
  name: e.country.name,
1112
1273
  flag: e.country.url_flag,
1113
- providerRef: r(e.country.uuid)
1274
+ providerRef: u(e.country.uuid)
1114
1275
  },
1115
1276
  seasons: e.seasons.map((t) => ({
1116
1277
  id: String(t.id),
1117
1278
  name: t.name,
1118
1279
  slug: t.slug,
1119
1280
  active: t.active,
1120
- providerRef: r(t.uuid)
1281
+ providerRef: u(t.uuid)
1121
1282
  })),
1122
1283
  assets: e.url_logo ? {
1123
1284
  logo: e.url_logo
1124
1285
  } : void 0,
1125
- providerRef: r(e.uuid)
1286
+ providerRef: u(e.uuid)
1126
1287
  };
1127
1288
  }
1128
- function ge(e) {
1129
- const t = e.rounds.map((n) => ({
1130
- id: n.id,
1131
- name: n.name,
1132
- key: n.key,
1133
- type: n.type,
1134
- status: n.status,
1135
- startDate: n.start_date,
1136
- endDate: n.end_date,
1137
- providerRef: r(n.uuid)
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)
1138
1299
  }));
1139
1300
  return {
1140
1301
  id: e.stage.id,
@@ -1148,28 +1309,28 @@ function ge(e) {
1148
1309
  startDate: e.stage.start_date,
1149
1310
  endDate: e.stage.end_date,
1150
1311
  rounds: t,
1151
- providerRef: r(e.stage.uuid)
1312
+ providerRef: u(e.stage.uuid)
1152
1313
  };
1153
1314
  }
1154
- function pe(e) {
1155
- const { season: t, stages: n } = e, { tournament: o } = t, s = {
1156
- id: o.id,
1157
- name: o.name,
1158
- slug: o.slug,
1159
- type: o.type,
1160
- region: o.region,
1161
- gender: o.gender,
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,
1162
1323
  country: {
1163
- id: o.country.id,
1164
- name: o.country.name,
1165
- code: o.country.code ?? void 0,
1166
- flag: o.country.assets?.flag?.url,
1167
- providerRef: r(o.country.uuid)
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)
1168
1329
  },
1169
- assets: o.assets?.logo?.url ? {
1170
- logo: o.assets.logo.url
1330
+ assets: n.assets?.logo?.url ? {
1331
+ logo: n.assets.logo.url
1171
1332
  } : void 0,
1172
- providerRef: r(o.uuid)
1333
+ providerRef: u(n.uuid)
1173
1334
  };
1174
1335
  return {
1175
1336
  id: t.id,
@@ -1177,43 +1338,43 @@ function pe(e) {
1177
1338
  slug: t.slug,
1178
1339
  active: t.status === "ACTIVE",
1179
1340
  status: t.status === "ACTIVE" ? "ACTIVE" : "INACTIVE",
1180
- competition: s,
1181
- stages: n.map(ge),
1182
- providerRef: r(t.uuid)
1341
+ competition: o,
1342
+ stages: s.map(ve),
1343
+ providerRef: u(t.uuid)
1183
1344
  };
1184
1345
  }
1185
- async function ze(e, t, n) {
1186
- const o = n || g(), { sportal365Sports: s } = o, a = await p.get({
1346
+ async function st(e, t, s) {
1347
+ const n = s || g(), { sportal365Sports: o } = n, a = await p.get({
1187
1348
  path: `/tournaments/${e}`,
1188
1349
  params: {
1189
- language_code: t?.languageCode ?? s?.languageCode ?? "en"
1350
+ language_code: t?.languageCode ?? o?.languageCode ?? "en"
1190
1351
  },
1191
1352
  headers: {
1192
- "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
1353
+ "Accept-Language": t?.languageCode ?? o?.languageCode ?? "en"
1193
1354
  },
1194
1355
  next: t?.next,
1195
- config: o
1356
+ config: n
1196
1357
  });
1197
- return me(a);
1358
+ return he(a);
1198
1359
  }
1199
- async function Je(e, t) {
1200
- const n = t || g(), { sportal365Sports: o } = n;
1360
+ async function ot(e, t) {
1361
+ const s = t || g(), { sportal365Sports: n } = s;
1201
1362
  if (!e?.seasonId && !e?.competitionId)
1202
1363
  throw new Error("Either seasonId or competitionId must be provided");
1203
- const s = {
1204
- language_code: e?.languageCode ?? o?.languageCode ?? "en"
1364
+ const o = {
1365
+ language_code: e?.languageCode ?? n?.languageCode ?? "en"
1205
1366
  };
1206
- e.seasonId ? s.season_id = e.seasonId : e.competitionId && (s.tournament_id = e.competitionId, e.status && (s.status = e.status));
1367
+ e.seasonId ? o.season_id = e.seasonId : e.competitionId && (o.tournament_id = e.competitionId, e.status && (o.status = e.status));
1207
1368
  const a = await p.get({
1208
1369
  path: "/v2/seasons/details",
1209
- params: s,
1370
+ params: o,
1210
1371
  headers: {
1211
- "Accept-Language": e?.languageCode ?? o?.languageCode ?? "en"
1372
+ "Accept-Language": e?.languageCode ?? n?.languageCode ?? "en"
1212
1373
  },
1213
1374
  next: e?.next,
1214
- config: n
1375
+ config: s
1215
1376
  });
1216
- return pe(a);
1377
+ return Se(a);
1217
1378
  }
1218
1379
  function O(e) {
1219
1380
  return {
@@ -1225,44 +1386,44 @@ function O(e) {
1225
1386
  promotion: "promotion"
1226
1387
  }[e.toLowerCase()] ?? e.toLowerCase().replace(/_/g, "");
1227
1388
  }
1228
- function fe(e) {
1389
+ function Ce(e) {
1229
1390
  const t = e.toLowerCase();
1230
1391
  return t === "relegation" ? "BOTTOM" : t === "playoff" ? "MIDDLE" : "TOP";
1231
1392
  }
1232
- function _e(e, t) {
1393
+ function Te(e, t) {
1233
1394
  if (!t || t.length === 0)
1234
1395
  return;
1235
- const n = t.map((s) => {
1236
- const a = s.event, l = a.home_team.id === e, d = l ? a.away_team : a.home_team, u = `${a.goal_home}-${a.goal_away}`;
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}`;
1237
1398
  return {
1238
1399
  matchId: a.id.toString(),
1239
- result: s.outcome,
1240
- score: u,
1241
- homeAway: l ? "HOME" : "AWAY",
1400
+ result: o.outcome,
1401
+ score: d,
1402
+ homeAway: c ? "HOME" : "AWAY",
1242
1403
  opponent: {
1243
- id: d.id.toString(),
1244
- name: d.name,
1245
- logo: d.url_logo
1404
+ id: r.id.toString(),
1405
+ name: r.name,
1406
+ logo: r.url_logo
1246
1407
  },
1247
1408
  date: new Date(a.start_time),
1248
1409
  competition: void 0
1249
1410
  // Football API doesn't include competition in form
1250
1411
  };
1251
- }), o = n.map((s) => s.result).join("");
1412
+ }), n = s.map((o) => o.result).join("");
1252
1413
  return {
1253
1414
  competitorId: e.toString(),
1254
- results: n,
1255
- formString: o
1415
+ results: s,
1416
+ formString: n
1256
1417
  };
1257
1418
  }
1258
- function ye(e) {
1419
+ function Ie(e) {
1259
1420
  return {
1260
1421
  key: O(e.code),
1261
1422
  name: e.name,
1262
- position: fe(e.type)
1423
+ position: Ce(e.type)
1263
1424
  };
1264
1425
  }
1265
- function he(e) {
1426
+ function be(e) {
1266
1427
  const t = {
1267
1428
  played: e.played,
1268
1429
  won: e.wins,
@@ -1272,7 +1433,7 @@ function he(e) {
1272
1433
  goalsAgainst: e.goals_against,
1273
1434
  goalDifference: e.goals_for - e.goals_against,
1274
1435
  points: e.points
1275
- }, n = e.rules?.length > 0 ? e.rules.map((s) => O(s.code)) : void 0, o = _e(e.team.id, e.team.form ?? []);
1436
+ }, s = e.rules?.length > 0 ? e.rules.map((o) => O(o.code)) : void 0, n = Te(e.team.id, e.team.form ?? []);
1276
1437
  return {
1277
1438
  rank: e.rank,
1278
1439
  competitor: {
@@ -1283,41 +1444,41 @@ function he(e) {
1283
1444
  uuid: e.team.uuid
1284
1445
  },
1285
1446
  stats: t,
1286
- form: o,
1287
- rules: n
1447
+ form: n,
1448
+ rules: s
1288
1449
  };
1289
1450
  }
1290
- function ve(e) {
1291
- const t = e.map(he), n = /* @__PURE__ */ new Map();
1292
- for (const o of e)
1293
- if (o.rules)
1294
- for (const s of o.rules) {
1295
- const a = O(s.code);
1296
- n.has(a) || n.set(a, ye(s));
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));
1297
1458
  }
1298
1459
  return {
1299
1460
  entries: t,
1300
1461
  metadata: {
1301
- legend: Array.from(n.values())
1462
+ legend: Array.from(s.values())
1302
1463
  }
1303
1464
  };
1304
1465
  }
1305
- async function Qe(e, t) {
1306
- const n = t || g(), { sportal365Sports: o } = n, s = e.expand?.join(","), a = await p.get({
1466
+ async function at(e, t) {
1467
+ const s = t || g(), { sportal365Sports: n } = s, o = e.expand?.join(","), a = await p.get({
1307
1468
  path: `/tournaments/seasons/stages/${e.stageId}/standing`,
1308
1469
  params: {
1309
- expand: s,
1310
- language_code: e.languageCode ?? o?.languageCode ?? "en"
1470
+ expand: o,
1471
+ language_code: e.languageCode ?? n?.languageCode ?? "en"
1311
1472
  },
1312
1473
  headers: {
1313
- "Accept-Language": e.languageCode ?? o?.languageCode ?? "en"
1474
+ "Accept-Language": e.languageCode ?? n?.languageCode ?? "en"
1314
1475
  },
1315
1476
  next: e.next,
1316
- config: n
1477
+ config: s
1317
1478
  });
1318
- return !a || a.length === 0 ? { entries: [], metadata: { legend: [] } } : ve(a);
1479
+ return !a || a.length === 0 ? { entries: [], metadata: { legend: [] } } : Ae(a);
1319
1480
  }
1320
- function P(e) {
1481
+ function x(e) {
1321
1482
  return {
1322
1483
  id: e.id,
1323
1484
  name: e.name,
@@ -1333,13 +1494,13 @@ function P(e) {
1333
1494
  ]
1334
1495
  };
1335
1496
  }
1336
- function Te(e) {
1497
+ function Ee(e) {
1337
1498
  return {
1338
1499
  id: e.id,
1339
1500
  name: e.name,
1340
1501
  type: e.type?.toUpperCase() || "LEAGUE",
1341
1502
  gender: e.gender?.toUpperCase(),
1342
- country: e.country ? P(e.country) : void 0,
1503
+ country: e.country ? x(e.country) : void 0,
1343
1504
  assets: e.assets?.logo ? {
1344
1505
  logo: e.assets.logo
1345
1506
  } : void 0,
@@ -1351,7 +1512,7 @@ function Te(e) {
1351
1512
  ]
1352
1513
  };
1353
1514
  }
1354
- function Ce(e) {
1515
+ function Oe(e) {
1355
1516
  if (e.status) {
1356
1517
  const a = {
1357
1518
  notstarted: { code: "not_started", type: "NOT_STARTED", name: "Not Started" },
@@ -1364,21 +1525,21 @@ function Ce(e) {
1364
1525
  if (a)
1365
1526
  return a;
1366
1527
  }
1367
- let t = "not_started", n = "NOT_STARTED", o = "Not Started";
1368
- return e.finished_at ? (t = "finished", n = "FINISHED", o = "Finished") : e.started_at && (t = "live", n = "LIVE", o = "Live"), {
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"), {
1369
1530
  code: t,
1370
- name: o,
1371
- type: n
1531
+ name: n,
1532
+ type: s
1372
1533
  };
1373
1534
  }
1374
- function Se(e) {
1535
+ function Re(e) {
1375
1536
  return {
1376
1537
  kickoffTime: new Date(e.kickoff_at),
1377
1538
  currentMinute: e.minute ?? void 0,
1378
1539
  currentPeriod: void 0
1379
1540
  };
1380
1541
  }
1381
- function F(e) {
1542
+ function P(e) {
1382
1543
  return {
1383
1544
  id: e.id,
1384
1545
  name: e.name,
@@ -1387,7 +1548,7 @@ function F(e) {
1387
1548
  threeLetterCode: e.code,
1388
1549
  type: e.national ? "national" : "club",
1389
1550
  gender: e.gender?.toUpperCase(),
1390
- country: e.country ? P(e.country) : void 0,
1551
+ country: e.country ? x(e.country) : void 0,
1391
1552
  assets: e.assets?.logo ? {
1392
1553
  logo: e.assets.logo
1393
1554
  } : void 0,
@@ -1399,18 +1560,18 @@ function F(e) {
1399
1560
  ]
1400
1561
  };
1401
1562
  }
1402
- function Ie(e) {
1563
+ function Le(e) {
1403
1564
  if (!e) return;
1404
- const t = (o) => o ? {
1405
- competitorOne: o.home_goals !== null ? String(o.home_goals) : "0",
1406
- competitorTwo: o.away_goals !== null ? String(o.away_goals) : "0"
1407
- } : void 0, n = t(e.ft_score);
1408
- if (n)
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)
1409
1570
  return {
1410
- competitorOne: n.competitorOne,
1411
- competitorTwo: n.competitorTwo,
1571
+ competitorOne: s.competitorOne,
1572
+ competitorTwo: s.competitorTwo,
1412
1573
  breakdown: {
1413
- total: n,
1574
+ total: s,
1414
1575
  halfTime: t(e.ht_score),
1415
1576
  regularTime: t(e.ft_score),
1416
1577
  extraTime: t(e.aet_score),
@@ -1418,16 +1579,16 @@ function Ie(e) {
1418
1579
  }
1419
1580
  };
1420
1581
  }
1421
- function b(e) {
1582
+ function R(e) {
1422
1583
  return {
1423
1584
  id: e.id,
1424
1585
  sport: e.sport ?? "football",
1425
- status: Ce(e),
1426
- timing: Se(e),
1427
- competitorOne: F(e.home_team),
1428
- competitorTwo: F(e.away_team),
1429
- score: Ie(e.scores),
1430
- competition: e.context?.competition ? Te(e.context.competition) : void 0,
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,
1431
1592
  lineupStatus: e.lineups_confirmed ? "CONFIRMED" : "NOT_AVAILABLE",
1432
1593
  updatedAt: e.updated_at ? new Date(e.updated_at) : void 0,
1433
1594
  isUndecided: e.undecided ?? void 0,
@@ -1439,39 +1600,39 @@ function b(e) {
1439
1600
  ]
1440
1601
  };
1441
1602
  }
1442
- function Ze(e) {
1443
- return b(e.data);
1603
+ function it(e) {
1604
+ return R(e.data);
1444
1605
  }
1445
- function we(e) {
1446
- return e.data.map(b);
1606
+ function rt(e) {
1607
+ return e.data.map(R);
1447
1608
  }
1448
- function Ae(e) {
1449
- return e.map(b);
1609
+ function ke(e) {
1610
+ return e.map(R);
1450
1611
  }
1451
- async function Ee(e, t, n) {
1452
- const o = await e.loyalty.getTemplateMatches(
1612
+ async function De(e, t, s) {
1613
+ const n = await e.loyalty.getTemplateMatches(
1453
1614
  t,
1454
- n?.groupId,
1455
- n?.disableCache
1615
+ s?.groupId,
1616
+ s?.disableCache
1456
1617
  );
1457
- return Ae(o);
1618
+ return ke(n);
1458
1619
  }
1459
- async function et(e, t, n, o) {
1460
- return (await Ee(e, t, o)).filter((a) => a.competitorOne.id === n || a.competitorTwo.id === n);
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);
1461
1622
  }
1462
- async function tt(e, t, n) {
1463
- const o = await e.loyalty.getTemplateById(t, n?.disableCache);
1623
+ async function ut(e, t, s) {
1624
+ const n = await e.loyalty.getTemplateById(t, s?.disableCache);
1464
1625
  return {
1465
- id: o.id,
1466
- name: o.name,
1467
- description: o.description,
1468
- type: o.type,
1469
- fromDate: o.fromDate,
1470
- toDate: o.toDate,
1471
- markets: o.markets || [],
1472
- teamIds: o.teamIds || [],
1473
- matchIds: o.matchIds || [],
1474
- groups: (o.groups || []).map((a) => ({
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) => ({
1475
1636
  groupId: a.groupId,
1476
1637
  label: a.label,
1477
1638
  flags: a.flags || [],
@@ -1481,32 +1642,32 @@ async function tt(e, t, n) {
1481
1642
  matchIds: a.filters?.matchIds || []
1482
1643
  }
1483
1644
  })),
1484
- gameIds: o.gameIds || [],
1485
- gameTypes: o.gameTypes || [],
1486
- competitionIds: o.competitionIds || [],
1487
- excludedProfileIds: o.excludedProfileIds || [],
1488
- rules: o.rules || "",
1489
- labels: o.labels || {},
1490
- customFields: o.customFields || {},
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 || {},
1491
1652
  // Convert BrandingModel to plain object
1492
- branding: o.branding ? JSON.parse(JSON.stringify(o.branding)) : {},
1653
+ branding: n.branding ? JSON.parse(JSON.stringify(n.branding)) : {},
1493
1654
  brandingId: null,
1494
1655
  // brandingId doesn't exist on TemplateByIdModel, using null
1495
- flags: o.flags || [],
1656
+ flags: n.flags || [],
1496
1657
  images: {
1497
- main: o.images?.main || null,
1498
- cover: o.images?.cover || null,
1499
- mobile: o.images?.mobile || null
1658
+ main: n.images?.main || null,
1659
+ cover: n.images?.cover || null,
1660
+ mobile: n.images?.mobile || null
1500
1661
  },
1501
- status: o.status,
1502
- automaticallyChangeStatus: o.automaticallyChangeStatus || !1,
1503
- createdAt: o.createdAt,
1504
- updatedAt: o.updatedAt,
1505
- related: o.related || [],
1506
- adContent: o.adContent || ""
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 || ""
1507
1668
  };
1508
1669
  }
1509
- function Oe(e) {
1670
+ function Ne(e) {
1510
1671
  return {
1511
1672
  "1x2": "1X2",
1512
1673
  12: "12",
@@ -1523,109 +1684,112 @@ function Oe(e) {
1523
1684
  FIRST_HALF_AND_FINAL_RESULT: "FIRST_HALF_AND_FINAL_RESULT"
1524
1685
  }[e] || e.toUpperCase();
1525
1686
  }
1526
- function be(e, t) {
1527
- const n = /* @__PURE__ */ new Map();
1528
- return e.forEach((o, s) => {
1529
- if (!o || o.length === 0)
1687
+ function Fe(e, t) {
1688
+ const s = /* @__PURE__ */ new Map();
1689
+ return e.forEach((n, o) => {
1690
+ if (!n || n.length === 0)
1530
1691
  return;
1531
- const l = (t ? o.filter((d) => d.bookmaker && t.includes(d.bookmaker.id)) : o).filter((d) => d.bookmaker && d.markets && d.markets.length > 0).map((d) => {
1532
- const u = d.bookmaker, _ = u.assets?.[0], m = u.branding?.backgroundColor || _?.backgroundColor, h = u.branding?.textColor || (Re(m) ? "#FFFFFF" : "#000000"), C = _?.transparentBackgroundUrl || _?.logo, T = u.eventUrls?.find((f) => f.appType === "desktop")?.url || u.links?.find((f) => f.appType === "desktop")?.homepageUrl || u.url || "";
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 || "";
1533
1694
  return {
1534
1695
  operator: {
1535
- id: u.id,
1536
- name: u.name,
1696
+ id: d.id,
1697
+ name: d.name,
1537
1698
  url: T,
1538
1699
  branding: {
1539
1700
  backgroundColor: m,
1540
- textColor: h,
1541
- logo: C
1701
+ textColor: _,
1702
+ logo: S
1542
1703
  }
1543
1704
  },
1544
- type: d.type,
1705
+ type: r.type,
1545
1706
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1546
- markets: d.markets.map((f) => ({
1707
+ markets: r.markets.map((y) => ({
1547
1708
  type: {
1548
- id: f.type.id,
1549
- code: f.type.code,
1550
- name: f.type.name
1709
+ id: y.type.id,
1710
+ code: y.type.code,
1711
+ name: y.type.name
1551
1712
  },
1552
1713
  period: {
1553
- id: f.scope.id,
1554
- type: f.scope.type,
1555
- name: f.scope.name
1714
+ id: y.scope.id,
1715
+ type: y.scope.type,
1716
+ name: y.scope.name
1556
1717
  },
1557
1718
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1558
- selections: f.selections.map((v) => {
1559
- const x = v.urls?.find((M) => M.appType === "desktop")?.url;
1560
- let I = "NONE";
1561
- return v.movement === "UP" ? I = "UP" : v.movement === "DOWN" && (I = "DOWN"), {
1562
- id: v.id,
1563
- name: v.name,
1564
- code: v.code,
1565
- value: v.value,
1566
- odds: v.odds,
1567
- oddsOld: v.oddsOld,
1568
- movement: I,
1569
- url: x
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
1570
1732
  };
1571
1733
  })
1572
1734
  }))
1573
1735
  };
1574
1736
  });
1575
- n.set(s, l);
1576
- }), n;
1737
+ s.set(o, c);
1738
+ }), s;
1577
1739
  }
1578
- function Re(e) {
1740
+ function Pe(e) {
1579
1741
  if (!e) return !0;
1580
- const t = e.replace("#", ""), n = parseInt(t.substring(0, 2), 16), o = parseInt(t.substring(2, 4), 16), s = parseInt(t.substring(4, 6), 16);
1581
- return (0.2126 * n + 0.7152 * o + 0.0722 * s) / 255 < 0.5;
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;
1582
1744
  }
1583
- async function ot(e, t, n) {
1745
+ async function ct(e, t, s) {
1584
1746
  if (!t || t.length === 0)
1585
1747
  return /* @__PURE__ */ new Map();
1586
- const o = {
1587
- oddType: n?.oddType || "ALL",
1588
- scopeType: n?.scopeType || "ORDINARY_TIME",
1589
- oddFormat: n?.oddFormat || "DECIMAL"
1748
+ const n = {
1749
+ oddType: s?.oddType || "ALL",
1750
+ scopeType: s?.scopeType || "ORDINARY_TIME",
1751
+ oddFormat: s?.oddFormat || "DECIMAL"
1590
1752
  };
1591
- n?.marketTypes && n.marketTypes.length > 0 && (o.marketTypes = n.marketTypes.map((a) => Oe(a)));
1592
- const s = await e.odds.getByMatchIds(t, o);
1593
- return be(s, n?.bookmakerIds);
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);
1594
1756
  }
1595
1757
  export {
1596
- Qe as A,
1597
- qe as B,
1598
- Xe as C,
1599
- Ee as D,
1600
- et as E,
1601
- tt as F,
1602
- Me as G,
1603
- Le as H,
1604
- De as S,
1605
- W as a,
1606
- Ne as b,
1607
- U as c,
1608
- Pe as d,
1609
- xe as e,
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,
1610
1774
  p as f,
1611
1775
  g,
1612
- Fe as h,
1613
- Ze as i,
1614
- we as j,
1615
- ke as k,
1616
- Ue as l,
1617
- ot as m,
1618
- ze as n,
1619
- je as o,
1620
- Ge as p,
1621
- Ve as q,
1622
- He as r,
1623
- Be as s,
1624
- r as t,
1625
- $e as u,
1626
- Ye as v,
1627
- We as w,
1628
- le as x,
1629
- Ke as y,
1630
- Je as z
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
1631
1795
  };