fansunited-data-layer 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import { t as C, g as F, f as te, c as X, S as oe, a as ne, b as se, d as ie } from "./matches-CBFdPkPa.js";
2
- import { e as Qt, h as Xt, i as Zt, j as wt, k as eo, l as to, m as oo, n as no, o as so, p as io, q as ro, r as ao, s as co, u as lo, v as uo, w as mo, x as fo, y as go, z as po, A as yo, B as ho } from "./matches-CBFdPkPa.js";
3
- import { useMemo as L } from "react";
1
+ import { t as C, g as F, f as te, c as X, S as oe, a as se, b as ne, d as ie } from "./matches-CBFdPkPa.js";
2
+ import { e as Qt, h as Xt, i as Zt, j as wt, k as eo, l as to, m as oo, n as so, o as no, p as io, q as ro, r as ao, s as co, u as lo, v as uo, w as mo, x as fo, y as go, z as po, A as yo, B as ho } from "./matches-CBFdPkPa.js";
3
+ import { useMemo as P } from "react";
4
4
  function re(e) {
5
5
  return {
6
6
  entityType: "tournament",
@@ -162,21 +162,21 @@ function me(e) {
162
162
  throw new Error(`Unknown entity type: ${e.entity_type}`);
163
163
  }
164
164
  }
165
- async function st(e, t) {
165
+ async function nt(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 || F(), { sportal365Sports: s } = o, n = e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["tournament", "player", "team", "president", "venue", "coach"], i = await te.get({
171
+ const o = t || F(), { sportal365Sports: n } = o, s = e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["tournament", "player", "team", "president", "venue", "coach"], i = await te.get({
172
172
  path: "/search",
173
173
  params: {
174
174
  query: e.query.trim(),
175
- entity_type: n.join(","),
176
- language_code: e.languageCode ?? s?.languageCode ?? "en"
175
+ entity_type: s.join(","),
176
+ language_code: e.languageCode ?? n?.languageCode ?? "en"
177
177
  },
178
178
  headers: {
179
- "Accept-Language": e.languageCode ?? s?.languageCode ?? "en"
179
+ "Accept-Language": e.languageCode ?? n?.languageCode ?? "en"
180
180
  },
181
181
  next: e.next,
182
182
  config: o
@@ -204,7 +204,7 @@ function G(e) {
204
204
  url: e.url
205
205
  };
206
206
  }
207
- function N(e) {
207
+ function E(e) {
208
208
  if (e)
209
209
  return {
210
210
  id: e.id,
@@ -231,7 +231,7 @@ function V(e) {
231
231
  slug: e.slug,
232
232
  tagScore: e.tag_score ?? void 0,
233
233
  sport: e.sport,
234
- country: N(e.country),
234
+ country: E(e.country),
235
235
  gender: e.gender,
236
236
  competitionIds: e.competition_ids,
237
237
  type: e.type,
@@ -253,7 +253,7 @@ function Z(e) {
253
253
  slug: e.slug,
254
254
  tagScore: e.tag_score ?? void 0,
255
255
  sport: e.sport,
256
- country: N(e.country),
256
+ country: E(e.country),
257
257
  providerRef: e.id
258
258
  };
259
259
  }
@@ -270,7 +270,7 @@ function ge(e) {
270
270
  slug: e.slug,
271
271
  tagScore: e.tag_score ?? void 0,
272
272
  sport: e.sport,
273
- country: N(e.country),
273
+ country: E(e.country),
274
274
  gender: e.gender,
275
275
  providerRef: e.id
276
276
  };
@@ -288,7 +288,7 @@ function pe(e) {
288
288
  slug: e.slug,
289
289
  tagScore: e.tag_score ?? void 0,
290
290
  sport: e.sport,
291
- country: N(e.country),
291
+ country: E(e.country),
292
292
  gender: e.gender,
293
293
  birthdate: e.birthdate ?? void 0,
294
294
  position: e.position ?? void 0,
@@ -308,7 +308,7 @@ function ye(e) {
308
308
  slug: e.slug,
309
309
  tagScore: e.tag_score ?? void 0,
310
310
  sport: e.sport,
311
- country: N(e.country),
311
+ country: E(e.country),
312
312
  gender: e.gender,
313
313
  birthdate: e.birthdate ?? void 0,
314
314
  providerRef: e.id
@@ -327,7 +327,7 @@ function he(e) {
327
327
  slug: e.slug,
328
328
  tagScore: e.tag_score ?? void 0,
329
329
  sport: e.sport,
330
- country: N(e.country),
330
+ country: E(e.country),
331
331
  gender: e.gender,
332
332
  birthdate: e.birthdate ?? void 0,
333
333
  providerRef: e.id
@@ -346,7 +346,7 @@ function Te(e) {
346
346
  slug: e.slug,
347
347
  tagScore: e.tag_score ?? void 0,
348
348
  sport: e.sport,
349
- country: N(e.country),
349
+ country: E(e.country),
350
350
  city: e.city ? Z(e.city) : void 0,
351
351
  providerRef: e.id
352
352
  };
@@ -364,7 +364,7 @@ function ve(e) {
364
364
  slug: e.slug,
365
365
  tagScore: e.tag_score ?? void 0,
366
366
  sport: e.sport,
367
- country: N(e.country),
367
+ country: E(e.country),
368
368
  gender: e.gender,
369
369
  type: e.type ?? void 0,
370
370
  region: e.region ?? void 0,
@@ -437,23 +437,23 @@ function Ce(e) {
437
437
  }
438
438
  }
439
439
  async function it(e = {}, t) {
440
- const o = t ?? F(), s = {};
441
- e.name && (s.name = e.name), e.entityTypes && e.entityTypes.length > 0 && (s.entity_type = e.entityTypes.join(",")), e.sports && e.sports.length > 0 && (s.sport = e.sports.join(",")), e.eventStartTime && (s.event_start_time = e.eventStartTime), e.ids && e.ids.length > 0 && (s.ids = e.ids.join(",")), e.competitionIds && e.competitionIds.length > 0 && (s.competition_ids = e.competitionIds.join(",")), e.domain && (s.domain = e.domain), e.inputLanguage && (s.input_language = e.inputLanguage), e.translationLanguage && (s.translation_language = e.translationLanguage), e.limit !== void 0 && (s.limit = e.limit.toString()), e.offset !== void 0 && (s.offset = e.offset.toString());
442
- const n = await fe.get({
440
+ const o = t ?? F(), n = {};
441
+ 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 fe.get({
443
443
  path: "/suggest",
444
- params: s,
444
+ params: n,
445
445
  next: e.next,
446
446
  config: o
447
447
  });
448
- return !n.results || n.results.length === 0 ? {
448
+ return !s.results || s.results.length === 0 ? {
449
449
  results: [],
450
450
  query: e.name
451
451
  } : {
452
- results: n.results.map(Ce),
452
+ results: s.results.map(Ce),
453
453
  query: e.name
454
454
  };
455
455
  }
456
- const Ae = X(ne);
456
+ const Ae = X(se);
457
457
  function Oe(e, t) {
458
458
  return {
459
459
  teamId: e.id,
@@ -467,65 +467,65 @@ function Oe(e, t) {
467
467
  };
468
468
  }
469
469
  async function rt(e, t) {
470
- const o = t || F(), s = e.next ?? { revalidate: 600 }, n = await Ae.get({
470
+ const o = t || F(), n = e.next ?? { revalidate: 600 }, s = await Ae.get({
471
471
  path: "/statistics/aggregate",
472
472
  params: {
473
473
  participant_ids: e.teamId,
474
474
  season_ids: e.seasonId,
475
475
  participant_type: "TEAM"
476
476
  },
477
- next: s,
477
+ next: n,
478
478
  config: o
479
479
  });
480
- if (!n.data || n.data.length === 0)
480
+ if (!s.data || s.data.length === 0)
481
481
  throw new Error(`No statistics found for team ${e.teamId} in season ${e.seasonId}`);
482
- return Oe(n.data[0], e.seasonId);
482
+ return Oe(s.data[0], e.seasonId);
483
483
  }
484
484
  function Fe(e) {
485
485
  const t = e.replace(/\/$/, "");
486
- function o(s) {
487
- return `${t}${s}`;
486
+ function o(n) {
487
+ return `${t}${n}`;
488
488
  }
489
489
  return {
490
- async get(s) {
491
- const n = s.config || F(), { fansUnited: i } = n;
490
+ async get(n) {
491
+ const s = n.config || F(), { fansUnited: i } = s;
492
492
  if (!i)
493
493
  throw new Error(
494
494
  "Fans United configuration is missing. Add 'fansUnited' with 'apiKey' and 'clientId' to your config."
495
495
  );
496
496
  if (!i.apiKey || !i.clientId)
497
497
  throw new Error("Fans United configuration requires both 'apiKey' and 'clientId'");
498
- const r = new URL(o(s.path));
499
- if (r.searchParams.set("key", i.apiKey), r.searchParams.set("client_id", i.clientId), s.params)
500
- for (const [d, u] of Object.entries(s.params))
501
- u !== void 0 && (Array.isArray(u) ? u.length > 0 && r.searchParams.set(d, u.join(",")) : r.searchParams.set(d, u));
502
- const l = await fetch(r.toString(), {
498
+ const r = new URL(o(n.path));
499
+ if (r.searchParams.set("key", i.apiKey), r.searchParams.set("client_id", i.clientId), n.params)
500
+ for (const [l, u] of Object.entries(n.params))
501
+ u !== void 0 && (Array.isArray(u) ? u.length > 0 && r.searchParams.set(l, u.join(",")) : r.searchParams.set(l, u));
502
+ const c = await fetch(r.toString(), {
503
503
  method: "GET",
504
504
  headers: {
505
505
  Accept: "application/json",
506
506
  "Content-Type": "application/json",
507
507
  // Merge custom headers (they can override defaults)
508
- ...s.headers
508
+ ...n.headers
509
509
  },
510
510
  signal: AbortSignal.timeout(3e4),
511
511
  // Next.js cache options for ISR/on-demand revalidation
512
- ...s.next && { next: s.next }
512
+ ...n.next && { next: n.next }
513
513
  });
514
- if (!l.ok) {
515
- let d = `Fans United API error: ${l.status} ${l.statusText}`;
514
+ if (!c.ok) {
515
+ let l = `Fans United API error: ${c.status} ${c.statusText}`;
516
516
  try {
517
- const u = await l.text();
518
- u && (d += ` - ${u}`);
517
+ const u = await c.text();
518
+ u && (l += ` - ${u}`);
519
519
  } catch (u) {
520
520
  console.error("[Fans United HTTP] Failed to read error response body:", {
521
521
  error: u instanceof Error ? u.message : String(u),
522
- status: l.status,
523
- statusText: l.statusText
522
+ status: c.status,
523
+ statusText: c.statusText
524
524
  });
525
525
  }
526
- throw new Error(d);
526
+ throw new Error(l);
527
527
  }
528
- return l.json();
528
+ return c.json();
529
529
  }
530
530
  };
531
531
  }
@@ -563,15 +563,15 @@ function Re(e) {
563
563
  id: String(e.country.id),
564
564
  name: e.country.name,
565
565
  code: e.country.code,
566
- flag: e.country.flag,
566
+ flag: e.country.assets?.flag,
567
567
  providerRef: [
568
568
  {
569
569
  provider: "fansunited",
570
570
  id: String(e.country.id)
571
571
  }
572
572
  ]
573
- }), e.logo && (t.assets = {
574
- logo: e.logo
573
+ }), e.assets?.logo && (t.assets = {
574
+ logo: e.assets.logo
575
575
  }), e.seasons && e.seasons.length > 0 && (t.seasons = e.seasons.map(Ge)), e.current_season && (t.season = {
576
576
  id: String(e.current_season.id),
577
577
  name: e.current_season.name,
@@ -584,15 +584,19 @@ function De(e) {
584
584
  async function at(e, t) {
585
585
  const o = {};
586
586
  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");
587
- const s = await I.get({
587
+ const n = await I.get({
588
588
  path: "/v1/competitions",
589
589
  params: o,
590
590
  config: t,
591
591
  next: e?.next
592
592
  });
593
- return De(s.data);
593
+ console.log("Raw API response (first item):", JSON.stringify(n.data[0], null, 2)), console.log("Total raw competitions:", n.data.length);
594
+ const s = n.data.map((l) => l.id), i = new Set(s);
595
+ console.log("Unique raw competition IDs:", i.size), s.length !== i.size && console.warn("⚠️ API returned duplicate competitions!");
596
+ const r = De(n.data), a = /* @__PURE__ */ new Set(), c = r.filter((l) => a.has(l.id) ? !1 : (a.add(l.id), !0));
597
+ return r.length !== c.length && console.warn(`Removed ${r.length - c.length} duplicate competitions`), c;
594
598
  }
595
- function Ee(e) {
599
+ function Ne(e) {
596
600
  return {
597
601
  id: e.id,
598
602
  name: e.name,
@@ -608,13 +612,13 @@ function Ee(e) {
608
612
  ]
609
613
  };
610
614
  }
611
- function Ne(e) {
615
+ function Ee(e) {
612
616
  return {
613
617
  id: e.id,
614
618
  name: e.name,
615
619
  type: e.type?.toUpperCase() || "LEAGUE",
616
620
  gender: e.gender?.toUpperCase(),
617
- country: e.country ? Ee(e.country) : void 0,
621
+ country: e.country ? Ne(e.country) : void 0,
618
622
  assets: e.assets?.logo ? {
619
623
  logo: e.assets.logo
620
624
  } : void 0,
@@ -627,20 +631,20 @@ function Ne(e) {
627
631
  };
628
632
  }
629
633
  function Ie(e) {
630
- return Ne(e.data);
634
+ return Ee(e.data);
631
635
  }
632
636
  async function ct(e, t, o) {
633
- const s = o || F(), n = {};
634
- t?.lang && (n.lang = t.lang);
637
+ const n = o || F(), s = {};
638
+ t?.lang && (s.lang = t.lang);
635
639
  const i = await I.get({
636
640
  path: `/v1/competitions/${e}`,
637
- params: n,
641
+ params: s,
638
642
  next: t?.next,
639
- config: s
643
+ config: n
640
644
  });
641
645
  return Ie(i);
642
646
  }
643
- function Le(e) {
647
+ function Pe(e) {
644
648
  return {
645
649
  id: e.id,
646
650
  name: e.name,
@@ -654,7 +658,7 @@ function Le(e) {
654
658
  ]
655
659
  };
656
660
  }
657
- function Pe(e) {
661
+ function Le(e) {
658
662
  return {
659
663
  id: e.id,
660
664
  name: e.name,
@@ -662,7 +666,7 @@ function Pe(e) {
662
666
  threeLetterCode: e.code,
663
667
  type: e.national ? "national" : "club",
664
668
  gender: e.gender ? e.gender.toUpperCase() : void 0,
665
- country: e.country ? Le(e.country) : void 0,
669
+ country: e.country ? Pe(e.country) : void 0,
666
670
  assets: e.assets?.logo ? {
667
671
  logo: e.assets.logo
668
672
  } : void 0,
@@ -683,16 +687,16 @@ function Pe(e) {
683
687
  };
684
688
  }
685
689
  function be(e) {
686
- return Pe(e.data);
690
+ return Le(e.data);
687
691
  }
688
692
  async function lt(e, t, o) {
689
- const s = o || F(), n = {};
690
- t?.lang && (n.lang = t.lang);
693
+ const n = o || F(), s = {};
694
+ t?.lang && (s.lang = t.lang);
691
695
  const i = await I.get({
692
696
  path: `/v1/teams/${e}`,
693
- params: n,
697
+ params: s,
694
698
  next: t?.next,
695
- config: s
699
+ config: n
696
700
  });
697
701
  return be(i);
698
702
  }
@@ -777,50 +781,50 @@ function $e(e) {
777
781
  return e.data.map(w);
778
782
  }
779
783
  async function dt(e, t, o) {
780
- const s = o || F(), n = {};
781
- t?.lang && (n.lang = t.lang);
784
+ const n = o || F(), s = {};
785
+ t?.lang && (s.lang = t.lang);
782
786
  const i = await I.get({
783
787
  path: `/v1/players/${e}`,
784
- params: n,
788
+ params: s,
785
789
  next: t?.next,
786
- config: s
790
+ config: n
787
791
  });
788
792
  return Be(i);
789
793
  }
790
794
  async function ut(e, t) {
791
- const o = t || F(), s = {};
792
- e?.lang && (s.lang = e.lang), e?.playerIds && (s.player_ids = e.playerIds), e?.countryId && (s.country_id = e.countryId), e?.name && (s.name = e.name), e?.scope && (s.scope = e.scope), e?.limit !== void 0 && (s.limit = String(e.limit)), e?.page !== void 0 && (s.page = String(e.page)), e?.sortField && (s.sort_field = e.sortField), e?.sortOrder && (s.sort_order = e.sortOrder);
793
- const n = await I.get({
795
+ const o = t || F(), n = {};
796
+ 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);
797
+ const s = await I.get({
794
798
  path: "/v1/players",
795
- params: s,
799
+ params: n,
796
800
  next: e?.next,
797
801
  config: o
798
802
  });
799
- return $e(n);
803
+ return $e(s);
800
804
  }
801
805
  async function mt(e, t, o) {
802
- const s = o || F(), n = {};
803
- t?.lang && (n.lang = t.lang);
806
+ const n = o || F(), s = {};
807
+ t?.lang && (s.lang = t.lang);
804
808
  const i = await I.get({
805
809
  path: `/v1/matches/${e}`,
806
- params: n,
810
+ params: s,
807
811
  next: t?.next,
808
- config: s
812
+ config: n
809
813
  });
810
- return se(i);
814
+ return ne(i);
811
815
  }
812
816
  async function ft(e, t) {
813
- const o = t || F(), s = {};
814
- e?.lang && (s.lang = e.lang), e?.competitions && (s.competitions = e.competitions), e?.countries && (s.countries = e.countries), e?.fromDate && (s.from_date = e.fromDate), e?.toDate && (s.to_date = e.toDate), e?.matches && (s.matches = e.matches), e?.teams && (s.teams = e.teams), e?.status && (s.status = e.status), e?.limit !== void 0 && (s.limit = String(e.limit)), e?.page !== void 0 && (s.page = String(e.page)), e?.sortField && (s.sort_field = e.sortField), e?.sortOrder && (s.sort_order = e.sortOrder), e?.showDeleted !== void 0 && (s.show_deleted = e.showDeleted ? "true" : "false");
815
- const n = await I.get({
817
+ const o = t || F(), n = {};
818
+ 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");
819
+ const s = await I.get({
816
820
  path: "/v1/matches",
817
- params: s,
821
+ params: n,
818
822
  next: e?.next,
819
823
  config: o
820
824
  });
821
- return ie(n);
825
+ return ie(s);
822
826
  }
823
- function K(e) {
827
+ function z(e) {
824
828
  return {
825
829
  id: e.id,
826
830
  name: e.name,
@@ -842,7 +846,7 @@ function Ue(e) {
842
846
  type: e.type || "LEAGUE",
843
847
  region: e.region,
844
848
  gender: e.gender?.toUpperCase(),
845
- country: e.country ? K(e.country) : void 0,
849
+ country: e.country ? z(e.country) : void 0,
846
850
  assets: e.assets?.logo ? {
847
851
  logo: e.assets.logo
848
852
  } : void 0,
@@ -862,7 +866,7 @@ function xe(e) {
862
866
  position: e.position || void 0,
863
867
  gender: e.gender?.toUpperCase(),
864
868
  birthdate: e.birth_date || void 0,
865
- country: e.country ? K(e.country) : void 0,
869
+ country: e.country ? z(e.country) : void 0,
866
870
  assets: e.assets?.headshot ? {
867
871
  photo: e.assets.headshot
868
872
  } : void 0,
@@ -882,7 +886,7 @@ function We(e) {
882
886
  shortName: e.short_name || void 0,
883
887
  threeLetterCode: e.code || void 0,
884
888
  gender: e.gender?.toUpperCase(),
885
- country: e.country ? K(e.country) : void 0,
889
+ country: e.country ? z(e.country) : void 0,
886
890
  assets: e.assets?.logo ? {
887
891
  logo: e.assets.logo
888
892
  } : void 0,
@@ -933,10 +937,10 @@ function j(e) {
933
937
  async function gt(e, t) {
934
938
  if (!e.query || e.query.trim() === "")
935
939
  return [];
936
- const o = t || F(), s = {
940
+ const o = t || F(), n = {
937
941
  q: e.query.trim()
938
- }, i = (e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["competition", "team", "player"]).map((l) => {
939
- switch (l) {
942
+ }, i = (e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["competition", "team", "player"]).map((c) => {
943
+ switch (c) {
940
944
  case "team":
941
945
  return "teams";
942
946
  case "player":
@@ -944,73 +948,73 @@ async function gt(e, t) {
944
948
  case "competition":
945
949
  return "competitions";
946
950
  default:
947
- return l;
951
+ return c;
948
952
  }
949
953
  });
950
- s.entities = i.join(","), e.lang && (s.lang = e.lang), e.limit && (s.limit = String(e.limit));
954
+ n.entities = i.join(","), e.lang && (n.lang = e.lang), e.limit && (n.limit = String(e.limit));
951
955
  const r = await I.get({
952
956
  path: "/v1/search",
953
- params: s,
957
+ params: n,
954
958
  next: e.next,
955
959
  config: o
956
960
  }), a = [];
957
- return r.data && (r.data.competitions && r.data.competitions.forEach((l) => {
958
- const d = j({ ...l, entity_type: "competition" });
959
- d && a.push(d);
960
- }), r.data.teams && r.data.teams.forEach((l) => {
961
- const d = j({ ...l, entity_type: "team" });
962
- d && a.push(d);
963
- }), r.data.players && r.data.players.forEach((l) => {
964
- const d = j({ ...l, entity_type: "player" });
965
- d && a.push(d);
961
+ return r.data && (r.data.competitions && r.data.competitions.forEach((c) => {
962
+ const l = j({ ...c, entity_type: "competition" });
963
+ l && a.push(l);
964
+ }), r.data.teams && r.data.teams.forEach((c) => {
965
+ const l = j({ ...c, entity_type: "team" });
966
+ l && a.push(l);
967
+ }), r.data.players && r.data.players.forEach((c) => {
968
+ const l = j({ ...c, entity_type: "player" });
969
+ l && a.push(l);
966
970
  })), a;
967
971
  }
968
972
  function pt(e) {
969
973
  return !e.seasons || e.seasons.length === 0 ? void 0 : e.seasons.find((o) => o.active) ?? e.seasons[0];
970
974
  }
971
975
  function yt(e, t) {
972
- const o = /* @__PURE__ */ new Date(), s = t.filter((n) => {
973
- const i = n.competitorOne.id === e || n.competitorTwo.id === e, r = n.status.type === "NOT_STARTED", a = new Date(n.timing.kickoffTime) >= o;
976
+ const o = /* @__PURE__ */ new Date(), n = t.filter((s) => {
977
+ const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "NOT_STARTED", a = new Date(s.timing.kickoffTime) >= o;
974
978
  return i && r && a;
975
979
  });
976
- return s.sort((n, i) => new Date(n.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()), s[0];
980
+ return n.sort((s, i) => new Date(s.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()), n[0];
977
981
  }
978
982
  function ht(e, t) {
979
- const o = /* @__PURE__ */ new Date(), s = t.filter((n) => {
980
- const i = n.competitorOne.id === e || n.competitorTwo.id === e, r = n.status.type === "FINISHED", a = new Date(n.timing.kickoffTime) <= o;
983
+ const o = /* @__PURE__ */ new Date(), n = t.filter((s) => {
984
+ const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "FINISHED", a = new Date(s.timing.kickoffTime) <= o;
981
985
  return i && r && a;
982
986
  });
983
- return s.sort((n, i) => new Date(i.timing.kickoffTime).getTime() - new Date(n.timing.kickoffTime).getTime()), s[0];
987
+ return n.sort((s, i) => new Date(i.timing.kickoffTime).getTime() - new Date(s.timing.kickoffTime).getTime()), n[0];
984
988
  }
985
989
  function Tt(e, t) {
986
990
  const o = /* @__PURE__ */ new Date();
987
- return t.filter((n) => {
988
- const i = n.competitorOne.id === e || n.competitorTwo.id === e, r = n.status.type === "NOT_STARTED" || n.status.type === "LIVE", a = new Date(n.timing.kickoffTime) >= o || n.status.type === "LIVE";
991
+ return t.filter((s) => {
992
+ 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";
989
993
  return i && r && a;
990
994
  }).sort(
991
- (n, i) => new Date(n.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()
995
+ (s, i) => new Date(s.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()
992
996
  );
993
997
  }
994
998
  function vt(e, t) {
995
999
  const o = /* @__PURE__ */ new Date();
996
- return t.filter((n) => {
997
- const i = n.competitorOne.id === e || n.competitorTwo.id === e, r = n.status.type === "FINISHED", a = new Date(n.timing.kickoffTime) <= o;
1000
+ return t.filter((s) => {
1001
+ const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "FINISHED", a = new Date(s.timing.kickoffTime) <= o;
998
1002
  return i && r && a;
999
1003
  }).sort(
1000
- (n, i) => new Date(i.timing.kickoffTime).getTime() - new Date(n.timing.kickoffTime).getTime()
1004
+ (s, i) => new Date(i.timing.kickoffTime).getTime() - new Date(s.timing.kickoffTime).getTime()
1001
1005
  );
1002
1006
  }
1003
1007
  function St(e, t, o) {
1004
- const s = o.filter((r) => r.status.type === "FINISHED"), n = o.filter(
1008
+ const n = o.filter((r) => r.status.type === "FINISHED"), s = o.filter(
1005
1009
  (r) => r.status.type === "NOT_STARTED" || r.status.type === "POSTPONED"
1006
1010
  ), i = t.entries.map((r) => {
1007
- const a = r.competitor.id, l = s.filter(
1011
+ const a = r.competitor.id, c = n.filter(
1008
1012
  (m) => m.competitorOne.id === e && m.competitorTwo.id === a || m.competitorOne.id === a && m.competitorTwo.id === e
1009
- ), d = n.filter(
1013
+ ), l = s.filter(
1010
1014
  (m) => m.competitorOne.id === e && m.competitorTwo.id === a || m.competitorOne.id === a && m.competitorTwo.id === e
1011
1015
  );
1012
- let u, c;
1013
- return l.forEach((m) => {
1016
+ let u, d;
1017
+ return c.forEach((m) => {
1014
1018
  const g = m.competitorOne.id === e, p = parseInt(m.score?.competitorOne ?? "0"), h = parseInt(m.score?.competitorTwo ?? "0"), R = g ? p : h, S = g ? h : p;
1015
1019
  let A;
1016
1020
  R > S ? A = "W" : R === S ? A = "D" : A = "L";
@@ -1021,14 +1025,14 @@ function St(e, t, o) {
1021
1025
  matchId: m.id,
1022
1026
  isUpcoming: !1
1023
1027
  };
1024
- g ? u = D : c = D;
1025
- }), d.forEach((m) => {
1028
+ g ? u = D : d = D;
1029
+ }), l.forEach((m) => {
1026
1030
  const g = m.competitorOne.id === e;
1027
1031
  g && !u ? u = {
1028
1032
  date: m.timing.kickoffTime,
1029
1033
  matchId: m.id,
1030
1034
  isUpcoming: !0
1031
- } : !g && !c && (c = {
1035
+ } : !g && !d && (d = {
1032
1036
  date: m.timing.kickoffTime,
1033
1037
  matchId: m.id,
1034
1038
  isUpcoming: !0
@@ -1042,7 +1046,7 @@ function St(e, t, o) {
1042
1046
  gamesPlayed: r.stats.played ?? 0,
1043
1047
  points: r.stats.points ?? 0,
1044
1048
  homeResult: u,
1045
- awayResult: c
1049
+ awayResult: d
1046
1050
  };
1047
1051
  });
1048
1052
  return {
@@ -1051,67 +1055,67 @@ function St(e, t, o) {
1051
1055
  };
1052
1056
  }
1053
1057
  function _t(e, t = 10) {
1054
- return e.players.filter((o) => (o.seasonStatistics?.goals ?? 0) > 0).sort((o, s) => {
1055
- const n = o.seasonStatistics?.goals ?? 0, i = s.seasonStatistics?.goals ?? 0;
1056
- if (i !== n)
1057
- return i - n;
1058
+ return e.players.filter((o) => (o.seasonStatistics?.goals ?? 0) > 0).sort((o, n) => {
1059
+ const s = o.seasonStatistics?.goals ?? 0, i = n.seasonStatistics?.goals ?? 0;
1060
+ if (i !== s)
1061
+ return i - s;
1058
1062
  const r = o.seasonStatistics?.assists ?? 0;
1059
- return (s.seasonStatistics?.assists ?? 0) - r;
1063
+ return (n.seasonStatistics?.assists ?? 0) - r;
1060
1064
  }).slice(0, t);
1061
1065
  }
1062
1066
  function Ct(e, t = 10) {
1063
- return e.players.filter((o) => (o.seasonStatistics?.assists ?? 0) > 0).sort((o, s) => {
1064
- const n = o.seasonStatistics?.assists ?? 0, i = s.seasonStatistics?.assists ?? 0;
1065
- if (i !== n)
1066
- return i - n;
1067
+ return e.players.filter((o) => (o.seasonStatistics?.assists ?? 0) > 0).sort((o, n) => {
1068
+ const s = o.seasonStatistics?.assists ?? 0, i = n.seasonStatistics?.assists ?? 0;
1069
+ if (i !== s)
1070
+ return i - s;
1067
1071
  const r = o.seasonStatistics?.goals ?? 0;
1068
- return (s.seasonStatistics?.goals ?? 0) - r;
1072
+ return (n.seasonStatistics?.goals ?? 0) - r;
1069
1073
  }).slice(0, t);
1070
1074
  }
1071
1075
  function At(e, t = 10) {
1072
- return e.players.filter((o) => (o.seasonStatistics?.appearances ?? 0) > 0).sort((o, s) => {
1073
- const n = o.seasonStatistics?.appearances ?? 0, i = s.seasonStatistics?.appearances ?? 0;
1074
- if (i !== n)
1075
- return i - n;
1076
+ return e.players.filter((o) => (o.seasonStatistics?.appearances ?? 0) > 0).sort((o, n) => {
1077
+ const s = o.seasonStatistics?.appearances ?? 0, i = n.seasonStatistics?.appearances ?? 0;
1078
+ if (i !== s)
1079
+ return i - s;
1076
1080
  const r = o.seasonStatistics?.minutes ?? 0;
1077
- return (s.seasonStatistics?.minutes ?? 0) - r;
1081
+ return (n.seasonStatistics?.minutes ?? 0) - r;
1078
1082
  }).slice(0, t);
1079
1083
  }
1080
1084
  function Ot(e, t = 10) {
1081
- return e.players.filter((o) => (o.seasonStatistics?.minutes ?? 0) > 0).sort((o, s) => {
1082
- const n = o.seasonStatistics?.minutes ?? 0, i = s.seasonStatistics?.minutes ?? 0;
1083
- if (i !== n)
1084
- return i - n;
1085
+ return e.players.filter((o) => (o.seasonStatistics?.minutes ?? 0) > 0).sort((o, n) => {
1086
+ const s = o.seasonStatistics?.minutes ?? 0, i = n.seasonStatistics?.minutes ?? 0;
1087
+ if (i !== s)
1088
+ return i - s;
1085
1089
  const r = o.seasonStatistics?.appearances ?? 0;
1086
- return (s.seasonStatistics?.appearances ?? 0) - r;
1090
+ return (n.seasonStatistics?.appearances ?? 0) - r;
1087
1091
  }).slice(0, t);
1088
1092
  }
1089
1093
  function Ft(e, t = 10) {
1090
- return e.players.filter((o) => (o.seasonStatistics?.cleansheets ?? 0) > 0).sort((o, s) => {
1091
- const n = o.seasonStatistics?.cleansheets ?? 0, i = s.seasonStatistics?.cleansheets ?? 0;
1092
- if (i !== n)
1093
- return i - n;
1094
+ return e.players.filter((o) => (o.seasonStatistics?.cleansheets ?? 0) > 0).sort((o, n) => {
1095
+ const s = o.seasonStatistics?.cleansheets ?? 0, i = n.seasonStatistics?.cleansheets ?? 0;
1096
+ if (i !== s)
1097
+ return i - s;
1094
1098
  const r = o.seasonStatistics?.appearances ?? 0;
1095
- return (s.seasonStatistics?.appearances ?? 0) - r;
1099
+ return (n.seasonStatistics?.appearances ?? 0) - r;
1096
1100
  }).slice(0, t);
1097
1101
  }
1098
1102
  function Mt(e, t = 10) {
1099
1103
  return e.players.filter((o) => {
1100
- const s = o.seasonStatistics?.yellowCards ?? 0, n = o.seasonStatistics?.redCards ?? 0;
1101
- return s + n > 0;
1102
- }).sort((o, s) => {
1103
- const n = o.seasonStatistics?.yellowCards ?? 0, i = o.seasonStatistics?.redCards ?? 0, r = s.seasonStatistics?.yellowCards ?? 0, a = s.seasonStatistics?.redCards ?? 0, l = n + i * 3, d = r + a * 3;
1104
- return d !== l ? d - l : a !== i ? a - i : r - n;
1104
+ const n = o.seasonStatistics?.yellowCards ?? 0, s = o.seasonStatistics?.redCards ?? 0;
1105
+ return n + s > 0;
1106
+ }).sort((o, n) => {
1107
+ const s = o.seasonStatistics?.yellowCards ?? 0, i = o.seasonStatistics?.redCards ?? 0, r = n.seasonStatistics?.yellowCards ?? 0, a = n.seasonStatistics?.redCards ?? 0, c = s + i * 3, l = r + a * 3;
1108
+ return l !== c ? l - c : a !== i ? a - i : r - s;
1105
1109
  }).slice(0, t);
1106
1110
  }
1107
1111
  function b(e) {
1108
1112
  const t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
1109
- return e.forEach((s) => {
1110
- !s.mainEvents || s.mainEvents.length === 0 || s.mainEvents.forEach((n) => {
1111
- if (n.primaryPlayer) {
1112
- const i = n.primaryPlayer.id;
1113
+ return e.forEach((n) => {
1114
+ !n.mainEvents || n.mainEvents.length === 0 || n.mainEvents.forEach((s) => {
1115
+ if (s.primaryPlayer) {
1116
+ const i = s.primaryPlayer.id;
1113
1117
  t.has(i) || t.set(i, {
1114
- playerId: n.primaryPlayer.id,
1118
+ playerId: s.primaryPlayer.id,
1115
1119
  seasonId: "",
1116
1120
  // Not applicable for match aggregation
1117
1121
  teamId: "",
@@ -1123,12 +1127,12 @@ function b(e) {
1123
1127
  appearances: 0
1124
1128
  });
1125
1129
  const r = t.get(i);
1126
- o.has(i) || o.set(i, /* @__PURE__ */ new Set()), o.get(i).add(s.id), (n.type === "GOAL" || n.type === "PENALTY_GOAL") && (r.goals = (r.goals ?? 0) + 1), n.type === "YELLOW_CARD" && (r.yellowCards = (r.yellowCards ?? 0) + 1), (n.type === "RED_CARD" || n.type === "YELLOW_RED_CARD") && (r.redCards = (r.redCards ?? 0) + 1);
1130
+ o.has(i) || o.set(i, /* @__PURE__ */ new Set()), o.get(i).add(n.id), (s.type === "GOAL" || s.type === "PENALTY_GOAL") && (r.goals = (r.goals ?? 0) + 1), s.type === "YELLOW_CARD" && (r.yellowCards = (r.yellowCards ?? 0) + 1), (s.type === "RED_CARD" || s.type === "YELLOW_RED_CARD") && (r.redCards = (r.redCards ?? 0) + 1);
1127
1131
  }
1128
- if (n.secondaryPlayer && (n.type === "GOAL" || n.type === "PENALTY_GOAL")) {
1129
- const i = n.secondaryPlayer.id;
1132
+ if (s.secondaryPlayer && (s.type === "GOAL" || s.type === "PENALTY_GOAL")) {
1133
+ const i = s.secondaryPlayer.id;
1130
1134
  t.has(i) || t.set(i, {
1131
- playerId: n.secondaryPlayer.id,
1135
+ playerId: s.secondaryPlayer.id,
1132
1136
  seasonId: "",
1133
1137
  // Not applicable for match aggregation
1134
1138
  teamId: "",
@@ -1140,12 +1144,12 @@ function b(e) {
1140
1144
  appearances: 0
1141
1145
  });
1142
1146
  const r = t.get(i);
1143
- r.assists = (r.assists ?? 0) + 1, o.has(i) || o.set(i, /* @__PURE__ */ new Set()), o.get(i).add(s.id);
1147
+ r.assists = (r.assists ?? 0) + 1, o.has(i) || o.set(i, /* @__PURE__ */ new Set()), o.get(i).add(n.id);
1144
1148
  }
1145
1149
  });
1146
- }), o.forEach((s, n) => {
1147
- const i = t.get(n);
1148
- i && i.appearances !== void 0 && (i.appearances = s.size);
1150
+ }), o.forEach((n, s) => {
1151
+ const i = t.get(s);
1152
+ i && i.appearances !== void 0 && (i.appearances = n.size);
1149
1153
  }), t;
1150
1154
  }
1151
1155
  function k(e) {
@@ -1156,81 +1160,81 @@ function k(e) {
1156
1160
  }
1157
1161
  function qe(e, t = 10) {
1158
1162
  const o = b(e);
1159
- return k(o).filter((n) => (n.goals ?? 0) > 0).sort((n, i) => {
1160
- const r = n.goals ?? 0, a = i.goals ?? 0;
1163
+ return k(o).filter((s) => (s.goals ?? 0) > 0).sort((s, i) => {
1164
+ const r = s.goals ?? 0, a = i.goals ?? 0;
1161
1165
  if (a !== r)
1162
1166
  return a - r;
1163
- const l = n.assists ?? 0;
1164
- return (i.assists ?? 0) - l;
1167
+ const c = s.assists ?? 0;
1168
+ return (i.assists ?? 0) - c;
1165
1169
  }).slice(0, t);
1166
1170
  }
1167
1171
  function je(e, t = 10) {
1168
1172
  const o = b(e);
1169
- return k(o).filter((n) => (n.assists ?? 0) > 0).sort((n, i) => {
1170
- const r = n.assists ?? 0, a = i.assists ?? 0;
1173
+ return k(o).filter((s) => (s.assists ?? 0) > 0).sort((s, i) => {
1174
+ const r = s.assists ?? 0, a = i.assists ?? 0;
1171
1175
  if (a !== r)
1172
1176
  return a - r;
1173
- const l = n.goals ?? 0;
1174
- return (i.goals ?? 0) - l;
1177
+ const c = s.goals ?? 0;
1178
+ return (i.goals ?? 0) - c;
1175
1179
  }).slice(0, t);
1176
1180
  }
1177
1181
  function Ve(e, t = 10) {
1178
1182
  const o = b(e);
1179
- return k(o).filter((n) => (n.totalCards ?? 0) > 0).sort((n, i) => {
1180
- const r = (n.yellowCards ?? 0) + (n.redCards ?? 0) * 3, a = (i.yellowCards ?? 0) + (i.redCards ?? 0) * 3;
1183
+ return k(o).filter((s) => (s.totalCards ?? 0) > 0).sort((s, i) => {
1184
+ const r = (s.yellowCards ?? 0) + (s.redCards ?? 0) * 3, a = (i.yellowCards ?? 0) + (i.redCards ?? 0) * 3;
1181
1185
  if (a !== r)
1182
1186
  return a - r;
1183
- const l = n.redCards ?? 0, d = i.redCards ?? 0;
1184
- if (d !== l)
1185
- return d - l;
1186
- const u = n.yellowCards ?? 0;
1187
+ const c = s.redCards ?? 0, l = i.redCards ?? 0;
1188
+ if (l !== c)
1189
+ return l - c;
1190
+ const u = s.yellowCards ?? 0;
1187
1191
  return (i.yellowCards ?? 0) - u;
1188
1192
  }).slice(0, t);
1189
1193
  }
1190
1194
  function Ye(e, t = 10) {
1191
1195
  const o = b(e);
1192
- return k(o).filter((n) => (n.goals ?? 0) + (n.assists ?? 0) > 0).sort((n, i) => {
1193
- const r = (n.goals ?? 0) + (n.assists ?? 0), a = (i.goals ?? 0) + (i.assists ?? 0);
1196
+ return k(o).filter((s) => (s.goals ?? 0) + (s.assists ?? 0) > 0).sort((s, i) => {
1197
+ const r = (s.goals ?? 0) + (s.assists ?? 0), a = (i.goals ?? 0) + (i.assists ?? 0);
1194
1198
  if (a !== r)
1195
1199
  return a - r;
1196
- const l = n.goals ?? 0, d = i.goals ?? 0;
1197
- if (d !== l)
1198
- return d - l;
1199
- const u = n.assists ?? 0;
1200
+ const c = s.goals ?? 0, l = i.goals ?? 0;
1201
+ if (l !== c)
1202
+ return l - c;
1203
+ const u = s.assists ?? 0;
1200
1204
  return (i.assists ?? 0) - u;
1201
1205
  }).slice(0, t);
1202
1206
  }
1203
- function Ke(e) {
1207
+ function ze(e) {
1204
1208
  const t = b(e);
1205
- return k(t).sort((s, n) => {
1206
- const i = s.appearances ?? 0, r = n.appearances ?? 0;
1209
+ return k(t).sort((n, s) => {
1210
+ const i = n.appearances ?? 0, r = s.appearances ?? 0;
1207
1211
  if (r !== i)
1208
1212
  return r - i;
1209
- const a = (s.goals ?? 0) + (s.assists ?? 0);
1210
- return (n.goals ?? 0) + (n.assists ?? 0) - a;
1213
+ const a = (n.goals ?? 0) + (n.assists ?? 0);
1214
+ return (s.goals ?? 0) + (s.assists ?? 0) - a;
1211
1215
  });
1212
1216
  }
1213
1217
  function Gt(e, t = 10) {
1214
- return L(() => qe(e, t), [e, t]);
1218
+ return P(() => qe(e, t), [e, t]);
1215
1219
  }
1216
1220
  function Rt(e, t = 10) {
1217
- return L(() => je(e, t), [e, t]);
1221
+ return P(() => je(e, t), [e, t]);
1218
1222
  }
1219
1223
  function Dt(e, t = 10) {
1220
- return L(() => Ve(e, t), [e, t]);
1224
+ return P(() => Ve(e, t), [e, t]);
1221
1225
  }
1222
- function Et(e, t = 10) {
1223
- return L(() => Ye(e, t), [e, t]);
1226
+ function Nt(e, t = 10) {
1227
+ return P(() => Ye(e, t), [e, t]);
1224
1228
  }
1225
- function Nt(e) {
1226
- return L(() => Ke(e), [e]);
1229
+ function Et(e) {
1230
+ return P(() => ze(e), [e]);
1227
1231
  }
1228
- function ze(e) {
1229
- return L(() => b(e), [e]);
1232
+ function Ke(e) {
1233
+ return P(() => b(e), [e]);
1230
1234
  }
1231
1235
  function It(e, t) {
1232
- const o = ze(e);
1233
- return L(() => o.get(t), [o, t]);
1236
+ const o = Ke(e);
1237
+ return P(() => o.get(t), [o, t]);
1234
1238
  }
1235
1239
  const Je = ["GOAL", "PENALTY_GOAL", "OWN_GOAL"];
1236
1240
  function O(e, t) {
@@ -1239,14 +1243,14 @@ function O(e, t) {
1239
1243
  function W(e, t) {
1240
1244
  return t > 0 ? e / t : 0;
1241
1245
  }
1242
- function Lt(e, t = !1, o = 2) {
1246
+ function Pt(e, t = !1, o = 2) {
1243
1247
  return t ? `${Math.round(e)}%` : Number.isInteger(e) ? e.toString() : e.toFixed(o);
1244
1248
  }
1245
- function Pt(e, t) {
1249
+ function Lt(e, t) {
1246
1250
  const o = typeof e == "string" ? parseFloat(e) : e;
1247
1251
  if (isNaN(o) || t === 0) return "0";
1248
- const s = (o / t).toFixed(1);
1249
- return `${o} (${s} avg)`;
1252
+ const n = (o / t).toFixed(1);
1253
+ return `${o} (${n} avg)`;
1250
1254
  }
1251
1255
  function bt(e, t) {
1252
1256
  const o = typeof e == "string" ? parseFloat(e) : e;
@@ -1258,86 +1262,86 @@ function Ht(e) {
1258
1262
  }
1259
1263
  function Qe(e, t, o) {
1260
1264
  if (e.status?.type !== "FINISHED" || !e.score) return null;
1261
- const s = parseInt(e.score.competitorOne || "0"), n = parseInt(e.score.competitorTwo || "0"), i = o ? s : n, r = o ? n : s;
1262
- let a = null, l = null;
1263
- const d = e.score.breakdown?.halfTime;
1264
- if (d) {
1265
- const g = parseInt(d.competitorOne || "0"), p = parseInt(d.competitorTwo || "0");
1266
- a = o ? g : p, l = o ? p : g;
1265
+ const n = parseInt(e.score.competitorOne || "0"), s = parseInt(e.score.competitorTwo || "0"), i = o ? n : s, r = o ? s : n;
1266
+ let a = null, c = null;
1267
+ const l = e.score.breakdown?.halfTime;
1268
+ if (l) {
1269
+ const g = parseInt(l.competitorOne || "0"), p = parseInt(l.competitorTwo || "0");
1270
+ a = o ? g : p, c = o ? p : g;
1267
1271
  }
1268
1272
  const u = e.statistics;
1269
- let c = null, m = null;
1273
+ let d = null, m = null;
1270
1274
  if (u) {
1271
1275
  const g = u.find?.((p) => p.type === "CORNERS");
1272
- g && (c = o ? g.competitorOne : g.competitorTwo, m = o ? g.competitorTwo : g.competitorOne);
1276
+ g && (d = o ? g.competitorOne : g.competitorTwo, m = o ? g.competitorTwo : g.competitorOne);
1273
1277
  }
1274
1278
  return {
1275
1279
  goalsFor: i,
1276
1280
  goalsAgainst: r,
1277
1281
  halfTimeGoalsFor: a,
1278
- halfTimeGoalsAgainst: l,
1279
- cornersFor: c,
1282
+ halfTimeGoalsAgainst: c,
1283
+ cornersFor: d,
1280
1284
  cornersAgainst: m,
1281
1285
  isWin: i > r,
1282
1286
  isDraw: i === r,
1283
1287
  isLoss: i < r
1284
1288
  };
1285
1289
  }
1286
- function z(e, t) {
1290
+ function K(e, t) {
1287
1291
  return e.competitorOne.id === t;
1288
1292
  }
1289
1293
  function Xe(e, t) {
1290
1294
  return e.competitorTwo.id === t;
1291
1295
  }
1292
1296
  function kt(e, t) {
1293
- return z(e, t) || Xe(e, t);
1297
+ return K(e, t) || Xe(e, t);
1294
1298
  }
1295
1299
  function Bt(e) {
1296
1300
  return e.status?.type === "FINISHED";
1297
1301
  }
1298
1302
  function $t(e, t) {
1299
- const o = z(e, t);
1303
+ const o = K(e, t);
1300
1304
  return parseInt(o ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0");
1301
1305
  }
1302
1306
  function Ut(e, t) {
1303
- const o = z(e, t);
1307
+ const o = K(e, t);
1304
1308
  return parseInt(o ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0");
1305
1309
  }
1306
1310
  function xt(e, t, o) {
1307
- const s = e.filter((u) => {
1311
+ const n = e.filter((u) => {
1308
1312
  if (u.status?.type !== "FINISHED" || !u.score) return !1;
1309
- const c = u.competitorOne.id === t || u.competitorTwo.id === t, m = u.competitorOne.id === o || u.competitorTwo.id === o;
1310
- return c && m;
1313
+ const d = u.competitorOne.id === t || u.competitorTwo.id === t, m = u.competitorOne.id === o || u.competitorTwo.id === o;
1314
+ return d && m;
1311
1315
  });
1312
- let n = 0, i = 0, r = 0, a = 0, l = 0;
1313
- s.forEach((u) => {
1314
- const c = parseInt(u.score?.competitorOne || "0"), m = parseInt(u.score?.competitorTwo || "0"), g = u.competitorOne.id === t, p = g ? c : m, h = g ? m : c;
1315
- a += p, l += h, p > h ? n++ : h > p ? i++ : r++;
1316
+ let s = 0, i = 0, r = 0, a = 0, c = 0;
1317
+ n.forEach((u) => {
1318
+ const d = parseInt(u.score?.competitorOne || "0"), m = parseInt(u.score?.competitorTwo || "0"), g = u.competitorOne.id === t, p = g ? d : m, h = g ? m : d;
1319
+ a += p, c += h, p > h ? s++ : h > p ? i++ : r++;
1316
1320
  });
1317
- const d = s.length;
1321
+ const l = n.length;
1318
1322
  return {
1319
- totalMatches: d,
1320
- homeTeamWins: n,
1323
+ totalMatches: l,
1324
+ homeTeamWins: s,
1321
1325
  awayTeamWins: i,
1322
1326
  draws: r,
1323
1327
  homeTeamGoals: a,
1324
- awayTeamGoals: l,
1325
- homeTeamWinPercentage: d > 0 ? n / d * 100 : 0,
1326
- awayTeamWinPercentage: d > 0 ? i / d * 100 : 0,
1327
- drawPercentage: d > 0 ? r / d * 100 : 0,
1328
- homeTeamAvgGoals: d > 0 ? a / d : 0,
1329
- awayTeamAvgGoals: d > 0 ? l / d : 0
1328
+ awayTeamGoals: c,
1329
+ homeTeamWinPercentage: l > 0 ? s / l * 100 : 0,
1330
+ awayTeamWinPercentage: l > 0 ? i / l * 100 : 0,
1331
+ drawPercentage: l > 0 ? r / l * 100 : 0,
1332
+ homeTeamAvgGoals: l > 0 ? a / l : 0,
1333
+ awayTeamAvgGoals: l > 0 ? c / l : 0
1330
1334
  };
1331
1335
  }
1332
- function Wt(e, t, o, s = 5) {
1336
+ function Wt(e, t, o, n = 5) {
1333
1337
  return e.filter((i) => {
1334
1338
  if (i.status?.type !== "FINISHED" || !i.score) return !1;
1335
1339
  const r = i.competitorOne.id === t || i.competitorTwo.id === t, a = i.competitorOne.id === o || i.competitorTwo.id === o;
1336
1340
  return r && a;
1337
- }).sort((i, r) => new Date(r.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()).slice(0, s).map((i) => {
1338
- 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;
1339
- let c;
1340
- return d > u ? c = "home" : u > d ? c = "away" : c = "draw", {
1341
+ }).sort((i, r) => new Date(r.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()).slice(0, n).map((i) => {
1342
+ const r = parseInt(i.score?.competitorOne || "0"), a = parseInt(i.score?.competitorTwo || "0"), c = i.competitorOne.id === t, l = c ? r : a, u = c ? a : r;
1343
+ let d;
1344
+ return l > u ? d = "home" : u > l ? d = "away" : d = "draw", {
1341
1345
  id: i.id,
1342
1346
  date: new Date(i.timing.kickoffTime).toLocaleDateString("en-GB", {
1343
1347
  day: "numeric",
@@ -1351,50 +1355,50 @@ function Wt(e, t, o, s = 5) {
1351
1355
  homeScore: r,
1352
1356
  awayScore: a,
1353
1357
  venue: i.venue?.name,
1354
- winner: c
1358
+ winner: d
1355
1359
  };
1356
1360
  });
1357
1361
  }
1358
1362
  function Ze(e, t, o) {
1359
- return e.filter((s) => {
1360
- const n = s.competitorOne.id === t, i = s.competitorTwo.id === t;
1361
- return !n && !i ? !1 : o === "home" ? n : i;
1362
- }).map((s) => {
1363
- const n = s.competitorOne.id === t;
1364
- return Qe(s, t, n);
1365
- }).filter((s) => s !== null);
1366
- }
1367
- function J(e, t, o, s) {
1368
- let n = 0;
1363
+ return e.filter((n) => {
1364
+ const s = n.competitorOne.id === t, i = n.competitorTwo.id === t;
1365
+ return !s && !i ? !1 : o === "home" ? s : i;
1366
+ }).map((n) => {
1367
+ const s = n.competitorOne.id === t;
1368
+ return Qe(n, t, s);
1369
+ }).filter((n) => n !== null);
1370
+ }
1371
+ function J(e, t, o, n) {
1372
+ let s = 0;
1369
1373
  for (const i of e) {
1370
1374
  const r = i.competitorOne.id === t, a = i.competitorTwo.id === t;
1371
1375
  if (!r && !a || o === "home" && !r || o === "away" && !a || i.status?.type !== "FINISHED") continue;
1372
- const l = i.mainEvents;
1373
- if (!l || !Array.isArray(l)) continue;
1374
- const d = l.filter((p) => p.type && Je.includes(p.type)).sort((p, h) => {
1376
+ const c = i.mainEvents;
1377
+ if (!c || !Array.isArray(c)) continue;
1378
+ const l = c.filter((p) => p.type && Je.includes(p.type)).sort((p, h) => {
1375
1379
  const R = p.minute ?? 0, S = h.minute ?? 0;
1376
1380
  return R !== S ? R - S : (p.injuryMinute ?? 0) - (h.injuryMinute ?? 0);
1377
1381
  });
1378
- if (d.length === 0) continue;
1379
- const u = d[0], c = r ? "ONE" : "TWO", m = u.type === "OWN_GOAL";
1382
+ if (l.length === 0) continue;
1383
+ const u = l[0], d = r ? "ONE" : "TWO", m = u.type === "OWN_GOAL";
1380
1384
  let g;
1381
- m ? g = u.competitorPosition !== c : g = u.competitorPosition === c, (s === "scored" && g || s === "conceded" && !g) && n++;
1385
+ m ? g = u.competitorPosition !== d : g = u.competitorPosition === d, (n === "scored" && g || n === "conceded" && !g) && s++;
1382
1386
  }
1383
- return n;
1387
+ return s;
1384
1388
  }
1385
1389
  function we(e, t, o) {
1386
- let s = 0;
1387
- for (const n of e) {
1388
- const i = n.competitorOne.id === t, r = n.competitorTwo.id === t;
1389
- if (!i && !r || o === "home" && !i || o === "away" && !r || n.status?.type !== "FINISHED") continue;
1390
- const a = n.mainEvents;
1391
- a && Array.isArray(a) && s++;
1390
+ let n = 0;
1391
+ for (const s of e) {
1392
+ const i = s.competitorOne.id === t, r = s.competitorTwo.id === t;
1393
+ if (!i && !r || o === "home" && !i || o === "away" && !r || s.status?.type !== "FINISHED") continue;
1394
+ const a = s.mainEvents;
1395
+ a && Array.isArray(a) && n++;
1392
1396
  }
1393
- return s;
1397
+ return n;
1394
1398
  }
1395
1399
  function qt(e, t, o) {
1396
- const s = Ze(e, t, o), n = s.length;
1397
- if (n === 0)
1400
+ const n = Ze(e, t, o), s = n.length;
1401
+ if (s === 0)
1398
1402
  return {
1399
1403
  played: 0,
1400
1404
  goalsForPerMatch: 0,
@@ -1414,54 +1418,54 @@ function qt(e, t, o) {
1414
1418
  avgCornersFor: 0,
1415
1419
  avgCornersAgainst: 0
1416
1420
  };
1417
- const i = s.reduce((f, v) => f + v.goalsFor, 0), r = s.reduce((f, v) => f + v.goalsAgainst, 0), a = s.filter((f) => f.goalsAgainst === 0).length, l = s.filter((f) => f.isWin && f.goalsAgainst === 0).length, d = s.filter((f) => f.goalsFor > 0).length, u = s.filter((f) => f.goalsFor === 0).length, c = s.filter((f) => f.isLoss && f.goalsFor === 0).length, m = s.filter((f) => f.goalsAgainst > 0).length, g = s.filter((f) => f.halfTimeGoalsFor !== null), p = g.length, h = g.filter((f) => {
1421
+ 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, c = n.filter((f) => f.isWin && f.goalsAgainst === 0).length, l = n.filter((f) => f.goalsFor > 0).length, u = n.filter((f) => f.goalsFor === 0).length, d = n.filter((f) => f.isLoss && f.goalsFor === 0).length, m = n.filter((f) => f.goalsAgainst > 0).length, g = n.filter((f) => f.halfTimeGoalsFor !== null), p = g.length, h = g.filter((f) => {
1418
1422
  const v = f.halfTimeGoalsFor, H = f.goalsFor - v;
1419
1423
  return v > 0 && H > 0;
1420
1424
  }).length, R = J(e, t, o, "scored"), S = we(e, t, o), A = g.filter((f) => f.halfTimeGoalsFor > f.halfTimeGoalsAgainst).length, D = g.filter((f) => {
1421
1425
  const v = f.halfTimeGoalsAgainst, H = f.goalsAgainst - v;
1422
1426
  return v > 0 && H > 0;
1423
- }).length, B = J(e, t, o, "conceded"), $ = g.filter((f) => f.halfTimeGoalsAgainst > f.halfTimeGoalsFor).length, P = s.filter((f) => f.cornersFor !== null), U = P.reduce((f, v) => f + (v.cornersFor || 0), 0), x = P.reduce((f, v) => f + (v.cornersAgainst || 0), 0);
1427
+ }).length, B = J(e, t, o, "conceded"), $ = g.filter((f) => f.halfTimeGoalsAgainst > f.halfTimeGoalsFor).length, L = n.filter((f) => f.cornersFor !== null), U = L.reduce((f, v) => f + (v.cornersFor || 0), 0), x = L.reduce((f, v) => f + (v.cornersAgainst || 0), 0);
1424
1428
  return {
1425
- played: n,
1426
- goalsForPerMatch: W(i, n),
1427
- cleanSheets: O(a, n),
1428
- wonToNil: O(l, n),
1429
- scoringRate: O(d, n),
1429
+ played: s,
1430
+ goalsForPerMatch: W(i, s),
1431
+ cleanSheets: O(a, s),
1432
+ wonToNil: O(c, s),
1433
+ scoringRate: O(l, s),
1430
1434
  scoredInBothHalves: O(h, p),
1431
1435
  scoredFirst: O(R, S),
1432
1436
  leadingAtHalfTime: O(A, p),
1433
- goalsAgainstPerMatch: W(r, n),
1434
- failedToScore: O(u, n),
1435
- lostToNil: O(c, n),
1436
- concedingRate: O(m, n),
1437
+ goalsAgainstPerMatch: W(r, s),
1438
+ failedToScore: O(u, s),
1439
+ lostToNil: O(d, s),
1440
+ concedingRate: O(m, s),
1437
1441
  concededInBothHalves: O(D, p),
1438
1442
  concededFirst: O(B, S),
1439
1443
  losingAtHalfTime: O($, p),
1440
- avgCornersFor: W(U, P.length),
1441
- avgCornersAgainst: W(x, P.length)
1444
+ avgCornersFor: W(U, L.length),
1445
+ avgCornersAgainst: W(x, L.length)
1442
1446
  };
1443
1447
  }
1444
1448
  function et(e, t) {
1445
1449
  return e.filter((o) => o.status?.type !== "FINISHED" ? !1 : o.competitorOne.id === t || o.competitorTwo.id === t).map((o) => {
1446
- const s = o.competitorOne.id === t, n = parseInt(o.score?.competitorOne || "0"), i = parseInt(o.score?.competitorTwo || "0"), r = n + i, a = o.periods;
1447
- let l = null;
1450
+ const n = o.competitorOne.id === t, s = parseInt(o.score?.competitorOne || "0"), i = parseInt(o.score?.competitorTwo || "0"), r = s + i, a = o.periods;
1451
+ let c = null;
1448
1452
  if (a && Array.isArray(a)) {
1449
- const d = a.find(
1453
+ const l = a.find(
1450
1454
  (u) => u.type === "FIRST_HALF" || u.type === "1ST_HALF"
1451
1455
  );
1452
- if (d?.score) {
1453
- const u = parseInt(d.score.competitorOne || "0"), c = parseInt(d.score.competitorTwo || "0");
1454
- l = u + c;
1456
+ if (l?.score) {
1457
+ const u = parseInt(l.score.competitorOne || "0"), d = parseInt(l.score.competitorTwo || "0");
1458
+ c = u + d;
1455
1459
  }
1456
1460
  }
1457
- return { totalGoals: r, halfTimeGoals: l, isHome: s };
1461
+ return { totalGoals: r, halfTimeGoals: c, isHome: n };
1458
1462
  });
1459
1463
  }
1460
1464
  function y(e, t) {
1461
- return e.length === 0 ? 0 : e.filter((s) => s > t).length / e.length * 100;
1465
+ return e.length === 0 ? 0 : e.filter((n) => n > t).length / e.length * 100;
1462
1466
  }
1463
1467
  function jt(e, t) {
1464
- const o = et(e, t), s = o.filter((c) => c.isHome), n = o.filter((c) => !c.isHome), i = o.map((c) => c.totalGoals), r = s.map((c) => c.totalGoals), a = n.map((c) => c.totalGoals), l = o.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals), d = s.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals), u = n.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals);
1468
+ const o = et(e, t), n = o.filter((d) => d.isHome), s = o.filter((d) => !d.isHome), i = o.map((d) => d.totalGoals), r = n.map((d) => d.totalGoals), a = s.map((d) => d.totalGoals), c = o.filter((d) => d.halfTimeGoals !== null).map((d) => d.halfTimeGoals), l = n.filter((d) => d.halfTimeGoals !== null).map((d) => d.halfTimeGoals), u = s.filter((d) => d.halfTimeGoals !== null).map((d) => d.halfTimeGoals);
1465
1469
  return {
1466
1470
  over05: {
1467
1471
  home: y(r, 0.5),
@@ -1494,38 +1498,38 @@ function jt(e, t) {
1494
1498
  away: y(a, 5.5)
1495
1499
  },
1496
1500
  over05HT: {
1497
- home: y(d, 0.5),
1498
- total: y(l, 0.5),
1501
+ home: y(l, 0.5),
1502
+ total: y(c, 0.5),
1499
1503
  away: y(u, 0.5)
1500
1504
  },
1501
1505
  over15HT: {
1502
- home: y(d, 1.5),
1503
- total: y(l, 1.5),
1506
+ home: y(l, 1.5),
1507
+ total: y(c, 1.5),
1504
1508
  away: y(u, 1.5)
1505
1509
  },
1506
1510
  over25HT: {
1507
- home: y(d, 2.5),
1508
- total: y(l, 2.5),
1511
+ home: y(l, 2.5),
1512
+ total: y(c, 2.5),
1509
1513
  away: y(u, 2.5)
1510
1514
  }
1511
1515
  };
1512
1516
  }
1513
1517
  function tt(e, t) {
1514
- const o = e.competitorOne.id === t, s = e.competitorTwo.id === t;
1515
- if (!o && !s || !e.score) return null;
1516
- const n = parseInt(o ? e.score.competitorOne || "0" : e.score.competitorTwo || "0"), i = parseInt(o ? e.score.competitorTwo || "0" : e.score.competitorOne || "0");
1518
+ const o = e.competitorOne.id === t, n = e.competitorTwo.id === t;
1519
+ if (!o && !n || !e.score) return null;
1520
+ const s = parseInt(o ? e.score.competitorOne || "0" : e.score.competitorTwo || "0"), i = parseInt(o ? e.score.competitorTwo || "0" : e.score.competitorOne || "0");
1517
1521
  let r;
1518
- return n > i ? r = "W" : n < i ? r = "L" : r = "D", {
1519
- result: { score: `${n}:${i}`, result: r, isHome: o },
1522
+ return s > i ? r = "W" : s < i ? r = "L" : r = "D", {
1523
+ result: { score: `${s}:${i}`, result: r, isHome: o },
1520
1524
  isHome: o
1521
1525
  };
1522
1526
  }
1523
- function Vt(e, t, o, s, n, i) {
1524
- const r = t?.entries.find((E) => E.competitor.id === e), a = o?.entries.find((E) => E.competitor.id === e), l = s?.entries.find((E) => E.competitor.id === e), d = n?.entries.find((E) => E.competitor.id === e), u = i?.entries.find((E) => E.competitor.id === e);
1527
+ function Vt(e, t, o, n, s, i) {
1528
+ const r = t?.entries.find((N) => N.competitor.id === e), a = o?.entries.find((N) => N.competitor.id === e), c = n?.entries.find((N) => N.competitor.id === e), l = s?.entries.find((N) => N.competitor.id === e), u = i?.entries.find((N) => N.competitor.id === e);
1525
1529
  if (!r) return null;
1526
- const c = a?.stats?.goalsFor ?? 0, m = l?.stats?.goalsFor ?? 0, g = r?.stats?.goalsFor ?? 0, p = d?.stats?.goalsAgainst ?? 0, h = u?.stats?.goalsAgainst ?? 0, R = r?.stats?.goalsAgainst ?? 0, S = a?.stats?.played ?? 0, A = l?.stats?.played ?? 0, D = r?.stats?.played ?? 0, B = D > 0 ? g / D : 0, $ = D > 0 ? R / D : 0, P = B + $, U = S > 0 ? c / S : 0, x = A > 0 ? m / A : 0, f = S > 0 ? p / S : 0, v = A > 0 ? h / A : 0, H = U + f, ee = x + v;
1530
+ const d = a?.stats?.goalsFor ?? 0, m = c?.stats?.goalsFor ?? 0, g = r?.stats?.goalsFor ?? 0, p = l?.stats?.goalsAgainst ?? 0, h = u?.stats?.goalsAgainst ?? 0, R = r?.stats?.goalsAgainst ?? 0, S = a?.stats?.played ?? 0, A = c?.stats?.played ?? 0, D = r?.stats?.played ?? 0, B = D > 0 ? g / D : 0, $ = D > 0 ? R / D : 0, L = B + $, U = S > 0 ? d / S : 0, x = A > 0 ? m / A : 0, f = S > 0 ? p / S : 0, v = A > 0 ? h / A : 0, H = U + f, ee = x + v;
1527
1531
  return {
1528
- homeGoals: c,
1532
+ homeGoals: d,
1529
1533
  totalGoals: g,
1530
1534
  awayGoals: m,
1531
1535
  homeGamesPlayed: S,
@@ -1536,7 +1540,7 @@ function Vt(e, t, o, s, n, i) {
1536
1540
  awayGoalsConceded: h,
1537
1541
  gfPerMatch: B,
1538
1542
  gaPerMatch: $,
1539
- gfGaPerMatch: P,
1543
+ gfGaPerMatch: L,
1540
1544
  homeGfPerMatch: U,
1541
1545
  awayGfPerMatch: x,
1542
1546
  homeGaPerMatch: f,
@@ -1545,14 +1549,14 @@ function Vt(e, t, o, s, n, i) {
1545
1549
  awayGfGaPerMatch: ee
1546
1550
  };
1547
1551
  }
1548
- function _(e, t, o, s) {
1549
- const n = e.filter((r) => {
1550
- const a = r.competitorOne.id === t, l = r.competitorTwo.id === t;
1551
- return !(!a && !l || r.status?.type !== "FINISHED" || s === "home" && !a || s === "away" && !l);
1552
+ function _(e, t, o, n) {
1553
+ const s = e.filter((r) => {
1554
+ const a = r.competitorOne.id === t, c = r.competitorTwo.id === t;
1555
+ return !(!a && !c || r.status?.type !== "FINISHED" || n === "home" && !a || n === "away" && !c);
1552
1556
  }).sort((r, a) => new Date(a.timing.kickoffTime).getTime() - new Date(r.timing.kickoffTime).getTime());
1553
- if (n.length === 0) return null;
1557
+ if (s.length === 0) return null;
1554
1558
  let i = 0;
1555
- for (const r of n) {
1559
+ for (const r of s) {
1556
1560
  const a = r.competitorOne.id === t;
1557
1561
  if (o(r, t, a))
1558
1562
  i++;
@@ -1563,13 +1567,13 @@ function _(e, t, o, s) {
1563
1567
  }
1564
1568
  const T = {
1565
1569
  win: (e, t, o) => {
1566
- const s = parseInt(o ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0"), n = parseInt(o ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0");
1567
- return s > n;
1570
+ const n = parseInt(o ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0"), s = parseInt(o ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0");
1571
+ return n > s;
1568
1572
  },
1569
1573
  draw: (e) => e.score?.competitorOne === e.score?.competitorTwo,
1570
1574
  loss: (e, t, o) => {
1571
- const s = parseInt(o ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0"), n = parseInt(o ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0");
1572
- return s < n;
1575
+ const n = parseInt(o ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0"), s = parseInt(o ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0");
1576
+ return n < s;
1573
1577
  },
1574
1578
  noWin: (e, t, o) => !T.win(e, t, o),
1575
1579
  noDraw: (e) => !T.draw(e),
@@ -1602,89 +1606,89 @@ function q(e, t, o) {
1602
1606
  };
1603
1607
  }
1604
1608
  function Yt(e, t, o) {
1605
- const s = q(e, t, "home"), n = q(e, t), i = q(e, o, "away"), r = q(e, o);
1609
+ const n = q(e, t, "home"), s = q(e, t), i = q(e, o, "away"), r = q(e, o);
1606
1610
  return [
1607
1611
  {
1608
1612
  label: "Consecutive wins",
1609
- homeTeam: { home: s.win, total: n.win },
1613
+ homeTeam: { home: n.win, total: s.win },
1610
1614
  awayTeam: { total: r.win, home: i.win },
1611
1615
  colorType: "neutral"
1612
1616
  },
1613
1617
  {
1614
1618
  label: "Consecutive draws",
1615
- homeTeam: { home: s.draw, total: n.draw },
1619
+ homeTeam: { home: n.draw, total: s.draw },
1616
1620
  awayTeam: { total: r.draw, home: i.draw },
1617
1621
  colorType: "neutral"
1618
1622
  },
1619
1623
  {
1620
1624
  label: "Consecutive defeats",
1621
- homeTeam: { home: s.loss, total: n.loss },
1625
+ homeTeam: { home: n.loss, total: s.loss },
1622
1626
  awayTeam: { total: r.loss, home: i.loss },
1623
1627
  colorType: "neutral"
1624
1628
  },
1625
1629
  {
1626
1630
  label: "No win",
1627
- homeTeam: { home: s.noWin, total: n.noWin },
1631
+ homeTeam: { home: n.noWin, total: s.noWin },
1628
1632
  awayTeam: { total: r.noWin, home: i.noWin },
1629
1633
  colorType: "negative"
1630
1634
  },
1631
1635
  {
1632
1636
  label: "No draw",
1633
- homeTeam: { home: s.noDraw, total: n.noDraw },
1637
+ homeTeam: { home: n.noDraw, total: s.noDraw },
1634
1638
  awayTeam: { total: r.noDraw, home: i.noDraw },
1635
1639
  colorType: "neutral"
1636
1640
  },
1637
1641
  {
1638
1642
  label: "No defeat",
1639
- homeTeam: { home: s.noDefeat, total: n.noDefeat },
1643
+ homeTeam: { home: n.noDefeat, total: s.noDefeat },
1640
1644
  awayTeam: { total: r.noDefeat, home: i.noDefeat },
1641
1645
  colorType: "positive"
1642
1646
  },
1643
1647
  {
1644
1648
  label: "Scored at least once",
1645
- homeTeam: { home: s.scored, total: n.scored },
1649
+ homeTeam: { home: n.scored, total: s.scored },
1646
1650
  awayTeam: { total: r.scored, home: i.scored },
1647
1651
  colorType: "positive"
1648
1652
  },
1649
1653
  {
1650
1654
  label: "Conceded at least once",
1651
- homeTeam: { home: s.conceded, total: n.conceded },
1655
+ homeTeam: { home: n.conceded, total: s.conceded },
1652
1656
  awayTeam: { total: r.conceded, home: i.conceded },
1653
1657
  colorType: "negative"
1654
1658
  },
1655
1659
  {
1656
1660
  label: "No goal scored",
1657
- homeTeam: { home: s.noGoalScored, total: n.noGoalScored },
1661
+ homeTeam: { home: n.noGoalScored, total: s.noGoalScored },
1658
1662
  awayTeam: { total: r.noGoalScored, home: i.noGoalScored },
1659
1663
  colorType: "neutral"
1660
1664
  },
1661
1665
  {
1662
1666
  label: "No goal conceded",
1663
- homeTeam: { home: s.noGoalConceded, total: n.noGoalConceded },
1667
+ homeTeam: { home: n.noGoalConceded, total: s.noGoalConceded },
1664
1668
  awayTeam: { total: r.noGoalConceded, home: i.noGoalConceded },
1665
1669
  colorType: "neutral"
1666
1670
  },
1667
1671
  {
1668
1672
  label: "GS + GC over 2.5",
1669
- homeTeam: { home: s.over25, total: n.over25 },
1673
+ homeTeam: { home: n.over25, total: s.over25 },
1670
1674
  awayTeam: { total: r.over25, home: i.over25 },
1671
1675
  colorType: "neutral"
1672
1676
  },
1673
1677
  {
1674
1678
  label: "GS + GC under 2.5",
1675
- homeTeam: { home: s.under25, total: n.under25 },
1679
+ homeTeam: { home: n.under25, total: s.under25 },
1676
1680
  awayTeam: { total: r.under25, home: i.under25 },
1677
1681
  colorType: "neutral"
1678
1682
  },
1679
1683
  {
1680
1684
  label: "Scored at least twice",
1681
- homeTeam: { home: s.scoredTwice, total: n.scoredTwice },
1685
+ homeTeam: { home: n.scoredTwice, total: s.scoredTwice },
1682
1686
  awayTeam: { total: r.scoredTwice, home: i.scoredTwice },
1683
1687
  colorType: "positive"
1684
1688
  },
1685
1689
  {
1686
1690
  label: "Conceded at least twice",
1687
- homeTeam: { home: s.concededTwice, total: n.concededTwice },
1691
+ homeTeam: { home: n.concededTwice, total: s.concededTwice },
1688
1692
  awayTeam: { total: r.concededTwice, home: i.concededTwice },
1689
1693
  colorType: "negative"
1690
1694
  }
@@ -1692,44 +1696,44 @@ function Yt(e, t, o) {
1692
1696
  }
1693
1697
  function Q(e, t) {
1694
1698
  const o = /* @__PURE__ */ new Map();
1695
- return e.forEach((s) => {
1696
- if (s.status?.type !== "FINISHED") return;
1697
- const n = tt(s, t);
1698
- if (!n) return;
1699
- const i = n.isHome ? s.competitorTwo.id : s.competitorOne.id, r = n.isHome ? s.competitorTwo : s.competitorOne, a = o.get(i) || {
1699
+ return e.forEach((n) => {
1700
+ if (n.status?.type !== "FINISHED") return;
1701
+ const s = tt(n, t);
1702
+ if (!s) return;
1703
+ const i = s.isHome ? n.competitorTwo.id : n.competitorOne.id, r = s.isHome ? n.competitorTwo : n.competitorOne, a = o.get(i) || {
1700
1704
  opponentId: i,
1701
1705
  opponentName: r.name,
1702
1706
  opponentLogo: r.assets?.logo
1703
1707
  };
1704
- n.isHome ? a.homeResult = n.result : a.awayResult = n.result, o.set(i, a);
1708
+ s.isHome ? a.homeResult = s.result : a.awayResult = s.result, o.set(i, a);
1705
1709
  }), o;
1706
1710
  }
1707
- function Kt(e, t, o, s, n, i, r) {
1708
- const a = Q(e, t), l = Q(e, o), d = /* @__PURE__ */ new Set([
1711
+ function zt(e, t, o, n, s, i, r) {
1712
+ const a = Q(e, t), c = Q(e, o), l = /* @__PURE__ */ new Set([
1709
1713
  ...a.keys(),
1710
- ...l.keys(),
1714
+ ...c.keys(),
1711
1715
  t,
1712
1716
  // Include home team as row for away team results
1713
1717
  o
1714
1718
  // Include away team as row for home team results
1715
1719
  ]), u = [];
1716
- return d.forEach((c) => {
1717
- const m = a.get(c), g = l.get(c);
1718
- if (!m && !g && c !== t && c !== o)
1720
+ return l.forEach((d) => {
1721
+ const m = a.get(d), g = c.get(d);
1722
+ if (!m && !g && d !== t && d !== o)
1719
1723
  return;
1720
1724
  let p, h;
1721
- c === t ? (p = s, h = i) : c === o ? (p = n, h = r) : (p = m?.opponentName || g?.opponentName || "", h = m?.opponentLogo || g?.opponentLogo), u.push({
1722
- opponentId: c,
1725
+ d === t ? (p = n, h = i) : d === o ? (p = s, h = r) : (p = m?.opponentName || g?.opponentName || "", h = m?.opponentLogo || g?.opponentLogo), u.push({
1726
+ opponentId: d,
1723
1727
  opponentName: p,
1724
1728
  opponentLogo: h,
1725
1729
  homeTeamHome: m?.homeResult,
1726
1730
  homeTeamAway: m?.awayResult,
1727
1731
  awayTeamHome: g?.homeResult,
1728
1732
  awayTeamAway: g?.awayResult,
1729
- isHomeTeamRow: c === t,
1730
- isAwayTeamRow: c === o
1733
+ isHomeTeamRow: d === t,
1734
+ isAwayTeamRow: d === o
1731
1735
  });
1732
- }), u.sort((c, m) => c.isHomeTeamRow ? -1 : m.isHomeTeamRow ? 1 : c.isAwayTeamRow ? -1 : m.isAwayTeamRow ? 1 : c.opponentName.localeCompare(m.opponentName));
1736
+ }), u.sort((d, m) => d.isHomeTeamRow ? -1 : m.isHomeTeamRow ? 1 : d.isAwayTeamRow ? -1 : m.isAwayTeamRow ? 1 : d.opponentName.localeCompare(m.opponentName));
1733
1737
  }
1734
1738
  export {
1735
1739
  Je as GOAL_EVENT_TYPES,
@@ -1742,10 +1746,10 @@ export {
1742
1746
  _ as calculateStreak,
1743
1747
  bt as formatAsAverage,
1744
1748
  Ht as formatPossessionPercentage,
1745
- Lt as formatStatValue,
1746
- Pt as formatWithAverage,
1749
+ Pt as formatStatValue,
1750
+ Lt as formatWithAverage,
1747
1751
  pt as getActiveSeason,
1748
- Ke as getAllPlayerStatisticsFromMatches,
1752
+ ze as getAllPlayerStatisticsFromMatches,
1749
1753
  Xt as getBatchMatchOdds,
1750
1754
  F as getConfig,
1751
1755
  ct as getFansUnitedFootballCompetition,
@@ -1761,8 +1765,8 @@ export {
1761
1765
  eo as getFootballMatchCommentary,
1762
1766
  to as getFootballMatchEvents,
1763
1767
  oo as getFootballMatchLineups,
1764
- no as getFootballMatchOdds,
1765
- so as getFootballMatchStatistics,
1768
+ so as getFootballMatchOdds,
1769
+ no as getFootballMatchStatistics,
1766
1770
  io as getFootballMatches,
1767
1771
  ro as getFootballPlayerSeasonStatistics,
1768
1772
  ao as getFootballSeasonDetails,
@@ -1795,25 +1799,25 @@ export {
1795
1799
  Ot as getTeamTopMinutesPlayed,
1796
1800
  _t as getTeamTopScorers,
1797
1801
  Tt as getTeamUpcomingMatches,
1798
- Kt as getTeamsCommonOpponents,
1802
+ zt as getTeamsCommonOpponents,
1799
1803
  je as getTopAssistersFromMatches,
1800
1804
  Ye as getTopGoalContributorsFromMatches,
1801
1805
  qe as getTopScorersFromMatches,
1802
1806
  yo as isConfigured,
1803
1807
  Bt as isMatchFinished,
1804
1808
  Xe as isTeamAway,
1805
- z as isTeamHome,
1809
+ K as isTeamHome,
1806
1810
  kt as isTeamInMatch,
1807
1811
  it as search,
1808
- st as searchFootball,
1812
+ nt as searchFootball,
1809
1813
  ho as setConfig,
1810
1814
  T as streakFilters,
1811
1815
  C as toProviderRefArray,
1812
- Nt as useAllPlayerStatisticsFromMatches,
1816
+ Et as useAllPlayerStatisticsFromMatches,
1813
1817
  Dt as useMostCardedPlayersFromMatches,
1814
1818
  It as usePlayerStatistics,
1815
- ze as usePlayerStatisticsMap,
1819
+ Ke as usePlayerStatisticsMap,
1816
1820
  Rt as useTopAssistersFromMatches,
1817
- Et as useTopGoalContributorsFromMatches,
1821
+ Nt as useTopGoalContributorsFromMatches,
1818
1822
  Gt as useTopScorersFromMatches
1819
1823
  };