fansunited-data-layer 0.2.2 → 0.3.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.
@@ -1,6 +1,6 @@
1
- import { t as C, g as R, f as w, c as z, S as ee, a as te } from "./index-D7T2Yy11.js";
2
- import { b as Pt, d as $t, e as Ut, h as xt, i as Bt, j as Wt, k as qt, l as jt, m as Vt, n as Kt, o as Yt, p as zt, q as Jt, r as Qt, s as Xt, u as Zt, v as wt } from "./index-D7T2Yy11.js";
3
- function oe(e) {
1
+ import { t as C, g as D, f as ee, c as J, S as te, a as oe } from "./index-D7T2Yy11.js";
2
+ import { b as Ut, d as xt, e as Bt, h as Wt, i as qt, j as jt, k as Vt, l as Kt, m as Yt, n as zt, o as Jt, p as Qt, q as Xt, r as Zt, s as wt, u as eo, v as to } from "./index-D7T2Yy11.js";
3
+ function ne(e) {
4
4
  return {
5
5
  entityType: "tournament",
6
6
  id: e.id.toString(),
@@ -22,7 +22,7 @@ function oe(e) {
22
22
  providerRef: C(e.uuid)
23
23
  };
24
24
  }
25
- function ne(e) {
25
+ function se(e) {
26
26
  return {
27
27
  entityType: "player",
28
28
  id: e.id.toString(),
@@ -44,7 +44,7 @@ function ne(e) {
44
44
  providerRef: C(e.uuid)
45
45
  };
46
46
  }
47
- function se(e) {
47
+ function ie(e) {
48
48
  return {
49
49
  entityType: "team",
50
50
  id: e.id.toString(),
@@ -67,7 +67,7 @@ function se(e) {
67
67
  providerRef: C(e.uuid)
68
68
  };
69
69
  }
70
- function ie(e) {
70
+ function re(e) {
71
71
  return {
72
72
  entityType: "president",
73
73
  id: e.id.toString(),
@@ -87,7 +87,7 @@ function ie(e) {
87
87
  providerRef: C(e.uuid)
88
88
  };
89
89
  }
90
- function re(e) {
90
+ function ae(e) {
91
91
  return {
92
92
  entityType: "venue",
93
93
  id: e.id.toString(),
@@ -123,7 +123,7 @@ function re(e) {
123
123
  providerRef: C(e.uuid)
124
124
  };
125
125
  }
126
- function ae(e) {
126
+ function ce(e) {
127
127
  return {
128
128
  entityType: "coach",
129
129
  id: e.id.toString(),
@@ -143,31 +143,31 @@ function ae(e) {
143
143
  providerRef: C(e.uuid)
144
144
  };
145
145
  }
146
- function ce(e) {
146
+ function le(e) {
147
147
  switch (e.entity_type) {
148
148
  case "tournament":
149
- return oe(e);
150
- case "player":
151
149
  return ne(e);
152
- case "team":
150
+ case "player":
153
151
  return se(e);
154
- case "president":
152
+ case "team":
155
153
  return ie(e);
156
- case "venue":
154
+ case "president":
157
155
  return re(e);
158
- case "coach":
156
+ case "venue":
159
157
  return ae(e);
158
+ case "coach":
159
+ return ce(e);
160
160
  default:
161
161
  throw new Error(`Unknown entity type: ${e.entity_type}`);
162
162
  }
163
163
  }
164
- async function Ze(e, o) {
164
+ async function et(e, o) {
165
165
  if (!e.query || e.query.trim() === "")
166
166
  return {
167
167
  results: [],
168
168
  query: e.query || ""
169
169
  };
170
- const t = o || R(), { sportal365Sports: n } = t, s = e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["tournament", "player", "team", "president", "venue", "coach"], i = await w.get({
170
+ const t = o || D(), { sportal365Sports: n } = t, s = e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["tournament", "player", "team", "president", "venue", "coach"], i = await ee.get({
171
171
  path: "/search",
172
172
  params: {
173
173
  query: e.query.trim(),
@@ -184,12 +184,12 @@ async function Ze(e, o) {
184
184
  results: [],
185
185
  query: e.query
186
186
  } : {
187
- results: i.map(ce),
187
+ results: i.map(le),
188
188
  query: e.query
189
189
  };
190
190
  }
191
- const le = z(ee);
192
- function F(e) {
191
+ const de = J(te);
192
+ function N(e) {
193
193
  return {
194
194
  language: e.language,
195
195
  name: e.name,
@@ -197,7 +197,7 @@ function F(e) {
197
197
  threeLetterCode: e.three_letter_code ?? void 0
198
198
  };
199
199
  }
200
- function N(e) {
200
+ function F(e) {
201
201
  if (!(!e || !e.url))
202
202
  return {
203
203
  url: e.url
@@ -211,8 +211,8 @@ function M(e) {
211
211
  name: e.name,
212
212
  shortName: e.short_name ?? void 0,
213
213
  threeLetterCode: e.three_letter_code ?? void 0,
214
- translations: e.translations.map(F),
215
- displayAsset: N(e.display_asset),
214
+ translations: e.translations.map(N),
215
+ displayAsset: F(e.display_asset),
216
216
  slug: e.slug,
217
217
  providerRef: e.id
218
218
  };
@@ -225,8 +225,8 @@ function W(e) {
225
225
  name: e.name,
226
226
  shortName: e.short_name ?? void 0,
227
227
  threeLetterCode: e.three_letter_code ?? void 0,
228
- translations: e.translations.map(F),
229
- displayAsset: N(e.display_asset),
228
+ translations: e.translations.map(N),
229
+ displayAsset: F(e.display_asset),
230
230
  slug: e.slug,
231
231
  tagScore: e.tag_score ?? void 0,
232
232
  sport: e.sport,
@@ -239,7 +239,7 @@ function W(e) {
239
239
  providerRef: e.id
240
240
  };
241
241
  }
242
- function J(e) {
242
+ function Q(e) {
243
243
  return {
244
244
  entityType: "city",
245
245
  id: e.id,
@@ -247,8 +247,8 @@ function J(e) {
247
247
  name: e.name,
248
248
  shortName: e.short_name ?? void 0,
249
249
  threeLetterCode: e.three_letter_code ?? void 0,
250
- translations: e.translations.map(F),
251
- displayAsset: N(e.display_asset),
250
+ translations: e.translations.map(N),
251
+ displayAsset: F(e.display_asset),
252
252
  slug: e.slug,
253
253
  tagScore: e.tag_score ?? void 0,
254
254
  sport: e.sport,
@@ -256,7 +256,7 @@ function J(e) {
256
256
  providerRef: e.id
257
257
  };
258
258
  }
259
- function de(e) {
259
+ function ue(e) {
260
260
  return {
261
261
  entityType: "horse",
262
262
  id: e.id,
@@ -264,8 +264,8 @@ function de(e) {
264
264
  name: e.name,
265
265
  shortName: e.short_name ?? void 0,
266
266
  threeLetterCode: e.three_letter_code ?? void 0,
267
- translations: e.translations.map(F),
268
- displayAsset: N(e.display_asset),
267
+ translations: e.translations.map(N),
268
+ displayAsset: F(e.display_asset),
269
269
  slug: e.slug,
270
270
  tagScore: e.tag_score ?? void 0,
271
271
  sport: e.sport,
@@ -274,7 +274,7 @@ function de(e) {
274
274
  providerRef: e.id
275
275
  };
276
276
  }
277
- function ue(e) {
277
+ function me(e) {
278
278
  return {
279
279
  entityType: "player",
280
280
  id: e.id,
@@ -282,8 +282,8 @@ function ue(e) {
282
282
  name: e.name,
283
283
  shortName: e.short_name ?? void 0,
284
284
  threeLetterCode: e.three_letter_code ?? void 0,
285
- translations: e.translations.map(F),
286
- displayAsset: N(e.display_asset),
285
+ translations: e.translations.map(N),
286
+ displayAsset: F(e.display_asset),
287
287
  slug: e.slug,
288
288
  tagScore: e.tag_score ?? void 0,
289
289
  sport: e.sport,
@@ -294,7 +294,7 @@ function ue(e) {
294
294
  providerRef: e.id
295
295
  };
296
296
  }
297
- function me(e) {
297
+ function fe(e) {
298
298
  return {
299
299
  entityType: "coach",
300
300
  id: e.id,
@@ -302,8 +302,8 @@ function me(e) {
302
302
  name: e.name,
303
303
  shortName: e.short_name ?? void 0,
304
304
  threeLetterCode: e.three_letter_code ?? void 0,
305
- translations: e.translations.map(F),
306
- displayAsset: N(e.display_asset),
305
+ translations: e.translations.map(N),
306
+ displayAsset: F(e.display_asset),
307
307
  slug: e.slug,
308
308
  tagScore: e.tag_score ?? void 0,
309
309
  sport: e.sport,
@@ -313,7 +313,7 @@ function me(e) {
313
313
  providerRef: e.id
314
314
  };
315
315
  }
316
- function fe(e) {
316
+ function pe(e) {
317
317
  return {
318
318
  entityType: "referee",
319
319
  id: e.id,
@@ -321,8 +321,8 @@ function fe(e) {
321
321
  name: e.name,
322
322
  shortName: e.short_name ?? void 0,
323
323
  threeLetterCode: e.three_letter_code ?? void 0,
324
- translations: e.translations.map(F),
325
- displayAsset: N(e.display_asset),
324
+ translations: e.translations.map(N),
325
+ displayAsset: F(e.display_asset),
326
326
  slug: e.slug,
327
327
  tagScore: e.tag_score ?? void 0,
328
328
  sport: e.sport,
@@ -332,7 +332,7 @@ function fe(e) {
332
332
  providerRef: e.id
333
333
  };
334
334
  }
335
- function pe(e) {
335
+ function ge(e) {
336
336
  return {
337
337
  entityType: "venue",
338
338
  id: e.id,
@@ -340,17 +340,17 @@ function pe(e) {
340
340
  name: e.name,
341
341
  shortName: e.short_name ?? void 0,
342
342
  threeLetterCode: e.three_letter_code ?? void 0,
343
- translations: e.translations.map(F),
344
- displayAsset: N(e.display_asset),
343
+ translations: e.translations.map(N),
344
+ displayAsset: F(e.display_asset),
345
345
  slug: e.slug,
346
346
  tagScore: e.tag_score ?? void 0,
347
347
  sport: e.sport,
348
348
  country: M(e.country),
349
- city: e.city ? J(e.city) : void 0,
349
+ city: e.city ? Q(e.city) : void 0,
350
350
  providerRef: e.id
351
351
  };
352
352
  }
353
- function ge(e) {
353
+ function ye(e) {
354
354
  return {
355
355
  entityType: e.entity_type,
356
356
  id: e.id,
@@ -358,8 +358,8 @@ function ge(e) {
358
358
  name: e.name,
359
359
  shortName: e.short_name ?? void 0,
360
360
  threeLetterCode: e.three_letter_code ?? void 0,
361
- translations: e.translations.map(F),
362
- displayAsset: N(e.display_asset),
361
+ translations: e.translations.map(N),
362
+ displayAsset: F(e.display_asset),
363
363
  slug: e.slug,
364
364
  tagScore: e.tag_score ?? void 0,
365
365
  sport: e.sport,
@@ -370,7 +370,7 @@ function ge(e) {
370
370
  providerRef: e.id
371
371
  };
372
372
  }
373
- function ye(e) {
373
+ function he(e) {
374
374
  return {
375
375
  entityType: "match",
376
376
  id: e.id,
@@ -378,8 +378,8 @@ function ye(e) {
378
378
  name: e.name,
379
379
  shortName: e.short_name ?? void 0,
380
380
  threeLetterCode: e.three_letter_code ?? void 0,
381
- translations: e.translations.map(F),
382
- displayAsset: N(e.display_asset),
381
+ translations: e.translations.map(N),
382
+ displayAsset: F(e.display_asset),
383
383
  slug: e.slug,
384
384
  tagScore: e.tag_score ?? void 0,
385
385
  sport: e.sport,
@@ -390,7 +390,7 @@ function ye(e) {
390
390
  providerRef: e.id
391
391
  };
392
392
  }
393
- function he(e) {
393
+ function Te(e) {
394
394
  return {
395
395
  entityType: "country",
396
396
  id: e.id,
@@ -398,47 +398,47 @@ function he(e) {
398
398
  name: e.name,
399
399
  shortName: e.short_name ?? void 0,
400
400
  threeLetterCode: e.three_letter_code ?? void 0,
401
- translations: e.translations.map(F),
402
- displayAsset: N(e.display_asset),
401
+ translations: e.translations.map(N),
402
+ displayAsset: F(e.display_asset),
403
403
  slug: e.slug,
404
404
  tagScore: e.tag_score ?? void 0,
405
405
  sport: e.sport,
406
406
  providerRef: e.id
407
407
  };
408
408
  }
409
- function Te(e) {
409
+ function ve(e) {
410
410
  switch (e.entity_type) {
411
411
  case "team":
412
412
  return W(e);
413
413
  case "city":
414
- return J(e);
414
+ return Q(e);
415
415
  case "horse":
416
- return de(e);
417
- case "player":
418
416
  return ue(e);
419
- case "coach":
417
+ case "player":
420
418
  return me(e);
421
- case "referee":
419
+ case "coach":
422
420
  return fe(e);
423
- case "venue":
421
+ case "referee":
424
422
  return pe(e);
423
+ case "venue":
424
+ return ge(e);
425
425
  case "tournament":
426
426
  case "competition":
427
- return ge(e);
428
- case "match":
429
427
  return ye(e);
430
- case "country":
428
+ case "match":
431
429
  return he(e);
430
+ case "country":
431
+ return Te(e);
432
432
  default: {
433
433
  const o = e;
434
434
  throw new Error(`Unknown entity type: ${o.entity_type}`);
435
435
  }
436
436
  }
437
437
  }
438
- async function we(e = {}, o) {
439
- const t = o ?? R(), n = {};
438
+ async function tt(e = {}, o) {
439
+ const t = o ?? D(), n = {};
440
440
  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());
441
- const s = await le.get({
441
+ const s = await de.get({
442
442
  path: "/suggest",
443
443
  params: n,
444
444
  next: e.next,
@@ -448,12 +448,12 @@ async function we(e = {}, o) {
448
448
  results: [],
449
449
  query: e.name
450
450
  } : {
451
- results: s.results.map(Te),
451
+ results: s.results.map(ve),
452
452
  query: e.name
453
453
  };
454
454
  }
455
- const ve = z(te);
456
- function Se(e, o) {
455
+ const Se = J(oe);
456
+ function _e(e, o) {
457
457
  return {
458
458
  teamId: e.id,
459
459
  teamName: e.name,
@@ -465,8 +465,8 @@ function Se(e, o) {
465
465
  }))
466
466
  };
467
467
  }
468
- async function et(e, o) {
469
- const t = o || R(), n = e.next ?? { revalidate: 600 }, s = await ve.get({
468
+ async function ot(e, o) {
469
+ const t = o || D(), n = e.next ?? { revalidate: 600 }, s = await Se.get({
470
470
  path: "/statistics/aggregate",
471
471
  params: {
472
472
  participant_ids: e.teamId,
@@ -478,16 +478,16 @@ async function et(e, o) {
478
478
  });
479
479
  if (!s.data || s.data.length === 0)
480
480
  throw new Error(`No statistics found for team ${e.teamId} in season ${e.seasonId}`);
481
- return Se(s.data[0], e.seasonId);
481
+ return _e(s.data[0], e.seasonId);
482
482
  }
483
- function _e(e) {
483
+ function Ce(e) {
484
484
  const o = e.replace(/\/$/, "");
485
485
  function t(n) {
486
486
  return `${o}${n}`;
487
487
  }
488
488
  return {
489
489
  async get(n) {
490
- const s = n.config || R(), { fansUnited: i } = s;
490
+ const s = n.config || D(), { fansUnited: i } = s;
491
491
  if (!i)
492
492
  throw new Error(
493
493
  "Fans United configuration is missing. Add 'fansUnited' with 'apiKey' and 'clientId' to your config."
@@ -523,8 +523,8 @@ function _e(e) {
523
523
  }
524
524
  };
525
525
  }
526
- const Ce = "https://football.fansunitedapi.com", b = _e(Ce);
527
- function Ae(e) {
526
+ const Ae = "https://football.fansunitedapi.com", b = Ce(Ae);
527
+ function Oe(e) {
528
528
  return {
529
529
  id: String(e.id),
530
530
  name: e.name,
@@ -537,7 +537,7 @@ function Ae(e) {
537
537
  ]
538
538
  };
539
539
  }
540
- function Oe(e) {
540
+ function Ne(e) {
541
541
  const o = {
542
542
  id: String(e.id),
543
543
  name: e.name,
@@ -566,16 +566,16 @@ function Oe(e) {
566
566
  ]
567
567
  }), e.logo && (o.assets = {
568
568
  logo: e.logo
569
- }), e.seasons && e.seasons.length > 0 && (o.seasons = e.seasons.map(Ae)), e.current_season && (o.season = {
569
+ }), e.seasons && e.seasons.length > 0 && (o.seasons = e.seasons.map(Oe)), e.current_season && (o.season = {
570
570
  id: String(e.current_season.id),
571
571
  name: e.current_season.name,
572
572
  status: e.current_season.active ? "ACTIVE" : "INACTIVE"
573
573
  }), o;
574
574
  }
575
575
  function Fe(e) {
576
- return e.map(Oe);
576
+ return e.map(Ne);
577
577
  }
578
- async function tt(e, o) {
578
+ async function nt(e, o) {
579
579
  const t = {};
580
580
  e?.lang ? t.lang = e.lang : t.lang = "EN", e?.sortField && (t.sort_field = e.sortField), e?.sortOrder && (t.sort_order = e.sortOrder), e?.page !== void 0 && (t.page = String(e.page)), e?.perPage !== void 0 && (t.per_page = String(e.perPage)), e?.countryId !== void 0 && (t.country_id = String(e.countryId)), e?.active !== void 0 && (t.active = e.active ? "1" : "0");
581
581
  const n = await b.get({
@@ -586,7 +586,7 @@ async function tt(e, o) {
586
586
  });
587
587
  return Fe(n.data);
588
588
  }
589
- function Ne(e) {
589
+ function Re(e) {
590
590
  return {
591
591
  id: e.id,
592
592
  name: e.name,
@@ -602,13 +602,13 @@ function Ne(e) {
602
602
  ]
603
603
  };
604
604
  }
605
- function De(e) {
605
+ function Ge(e) {
606
606
  return {
607
607
  id: e.id,
608
608
  name: e.name,
609
609
  type: e.type?.toUpperCase() || "LEAGUE",
610
610
  gender: e.gender?.toUpperCase(),
611
- country: e.country ? Ne(e.country) : void 0,
611
+ country: e.country ? Re(e.country) : void 0,
612
612
  assets: e.assets?.logo ? {
613
613
  logo: e.assets.logo
614
614
  } : void 0,
@@ -620,11 +620,11 @@ function De(e) {
620
620
  ]
621
621
  };
622
622
  }
623
- function Ge(e) {
624
- return De(e.data);
623
+ function De(e) {
624
+ return Ge(e.data);
625
625
  }
626
- async function ot(e, o, t) {
627
- const n = t || R(), s = {};
626
+ async function st(e, o, t) {
627
+ const n = t || D(), s = {};
628
628
  o?.lang && (s.lang = o.lang);
629
629
  const i = await b.get({
630
630
  path: `/v1/competitions/${e}`,
@@ -632,9 +632,9 @@ async function ot(e, o, t) {
632
632
  next: o?.next,
633
633
  config: n
634
634
  });
635
- return Ge(i);
635
+ return De(i);
636
636
  }
637
- function Re(e) {
637
+ function Ee(e) {
638
638
  return {
639
639
  id: e.id,
640
640
  name: e.name,
@@ -648,7 +648,7 @@ function Re(e) {
648
648
  ]
649
649
  };
650
650
  }
651
- function Ee(e) {
651
+ function Me(e) {
652
652
  return {
653
653
  id: e.id,
654
654
  name: e.name,
@@ -656,7 +656,7 @@ function Ee(e) {
656
656
  threeLetterCode: e.code,
657
657
  type: e.national ? "national" : "club",
658
658
  gender: e.gender ? e.gender.toUpperCase() : void 0,
659
- country: e.country ? Re(e.country) : void 0,
659
+ country: e.country ? Ee(e.country) : void 0,
660
660
  assets: e.assets?.logo ? {
661
661
  logo: e.assets.logo
662
662
  } : void 0,
@@ -676,11 +676,11 @@ function Ee(e) {
676
676
  ]
677
677
  };
678
678
  }
679
- function Me(e) {
680
- return Ee(e.data);
679
+ function be(e) {
680
+ return Me(e.data);
681
681
  }
682
- async function nt(e, o, t) {
683
- const n = t || R(), s = {};
682
+ async function it(e, o, t) {
683
+ const n = t || D(), s = {};
684
684
  o?.lang && (s.lang = o.lang);
685
685
  const i = await b.get({
686
686
  path: `/v1/teams/${e}`,
@@ -688,9 +688,9 @@ async function nt(e, o, t) {
688
688
  next: o?.next,
689
689
  config: n
690
690
  });
691
- return Me(i);
691
+ return be(i);
692
692
  }
693
- function be(e) {
693
+ function q(e) {
694
694
  return {
695
695
  id: e.id,
696
696
  name: e.name,
@@ -705,16 +705,57 @@ function be(e) {
705
705
  };
706
706
  }
707
707
  function He(e) {
708
+ return {
709
+ id: e.id,
710
+ name: e.name,
711
+ shortName: e.short_name ?? void 0,
712
+ fullName: e.full_name ?? void 0,
713
+ threeLetterCode: e.code,
714
+ type: e.national ? "national" : "club",
715
+ gender: e.gender?.toUpperCase(),
716
+ country: e.country ? q(e.country) : void 0,
717
+ assets: e.assets?.logo ? {
718
+ logo: e.assets.logo
719
+ } : void 0,
720
+ providerRef: [
721
+ {
722
+ provider: "fansunited",
723
+ id: e.id
724
+ }
725
+ ]
726
+ };
727
+ }
728
+ function Ie(e) {
729
+ return {
730
+ id: e.id,
731
+ name: e.name,
732
+ type: e.type?.toUpperCase() || "LEAGUE",
733
+ gender: e.gender?.toUpperCase(),
734
+ country: e.country ? q(e.country) : void 0,
735
+ assets: e.assets?.logo ? {
736
+ logo: e.assets.logo
737
+ } : void 0,
738
+ providerRef: [
739
+ {
740
+ provider: "fansunited",
741
+ id: e.id
742
+ }
743
+ ]
744
+ };
745
+ }
746
+ function ke(e) {
708
747
  return {
709
748
  type: "player",
710
749
  id: e.id,
711
750
  name: e.name,
712
751
  position: e.position,
713
752
  birthdate: e.birth_date,
714
- country: e.country ? be(e.country) : void 0,
753
+ country: e.country ? q(e.country) : void 0,
715
754
  assets: e.assets?.headshot ? {
716
755
  photo: e.assets.headshot
717
756
  } : void 0,
757
+ teams: e.teams?.map(He),
758
+ competitions: e.competitions?.map(Ie),
718
759
  providerRef: [
719
760
  {
720
761
  provider: "fansunited",
@@ -723,11 +764,11 @@ function He(e) {
723
764
  ]
724
765
  };
725
766
  }
726
- function Ie(e) {
727
- return He(e.data);
767
+ function Le(e) {
768
+ return ke(e.data);
728
769
  }
729
- async function st(e, o, t) {
730
- const n = t || R(), s = {};
770
+ async function rt(e, o, t) {
771
+ const n = t || D(), s = {};
731
772
  o?.lang && (s.lang = o.lang);
732
773
  const i = await b.get({
733
774
  path: `/v1/players/${e}`,
@@ -735,9 +776,9 @@ async function st(e, o, t) {
735
776
  next: o?.next,
736
777
  config: n
737
778
  });
738
- return Ie(i);
779
+ return Le(i);
739
780
  }
740
- function Q(e) {
781
+ function X(e) {
741
782
  return {
742
783
  id: e.id,
743
784
  name: e.name,
@@ -753,13 +794,13 @@ function Q(e) {
753
794
  ]
754
795
  };
755
796
  }
756
- function ke(e) {
797
+ function Pe(e) {
757
798
  return {
758
799
  id: e.id,
759
800
  name: e.name,
760
801
  type: e.type?.toUpperCase() || "LEAGUE",
761
802
  gender: e.gender?.toUpperCase(),
762
- country: e.country ? Q(e.country) : void 0,
803
+ country: e.country ? X(e.country) : void 0,
763
804
  assets: e.assets?.logo ? {
764
805
  logo: e.assets.logo
765
806
  } : void 0,
@@ -771,7 +812,7 @@ function ke(e) {
771
812
  ]
772
813
  };
773
814
  }
774
- function Le(e) {
815
+ function $e(e) {
775
816
  if (e.status) {
776
817
  const i = {
777
818
  notstarted: { code: "not_started", type: "NOT_STARTED", name: "Not Started" },
@@ -791,14 +832,14 @@ function Le(e) {
791
832
  type: t
792
833
  };
793
834
  }
794
- function Pe(e) {
835
+ function Ue(e) {
795
836
  return {
796
837
  kickoffTime: new Date(e.kickoff_at),
797
838
  currentMinute: e.minute ?? void 0,
798
839
  currentPeriod: void 0
799
840
  };
800
841
  }
801
- function V(e) {
842
+ function K(e) {
802
843
  return {
803
844
  id: e.id,
804
845
  name: e.name,
@@ -807,7 +848,7 @@ function V(e) {
807
848
  threeLetterCode: e.code,
808
849
  type: e.national ? "national" : "club",
809
850
  gender: e.gender?.toUpperCase(),
810
- country: e.country ? Q(e.country) : void 0,
851
+ country: e.country ? X(e.country) : void 0,
811
852
  assets: e.assets?.logo ? {
812
853
  logo: e.assets.logo
813
854
  } : void 0,
@@ -819,7 +860,7 @@ function V(e) {
819
860
  ]
820
861
  };
821
862
  }
822
- function $e(e) {
863
+ function xe(e) {
823
864
  if (!e) return;
824
865
  const o = (n) => n ? {
825
866
  competitorOne: n.home_goals !== null ? String(n.home_goals) : "0",
@@ -838,15 +879,15 @@ function $e(e) {
838
879
  }
839
880
  };
840
881
  }
841
- function X(e) {
882
+ function Z(e) {
842
883
  return {
843
884
  id: e.id,
844
- status: Le(e),
845
- timing: Pe(e),
846
- competitorOne: V(e.home_team),
847
- competitorTwo: V(e.away_team),
848
- score: $e(e.scores),
849
- competition: e.context?.competition ? ke(e.context.competition) : void 0,
885
+ status: $e(e),
886
+ timing: Ue(e),
887
+ competitorOne: K(e.home_team),
888
+ competitorTwo: K(e.away_team),
889
+ score: xe(e.scores),
890
+ competition: e.context?.competition ? Pe(e.context.competition) : void 0,
850
891
  lineupStatus: e.lineups_confirmed ? "CONFIRMED" : "NOT_AVAILABLE",
851
892
  updatedAt: e.updated_at ? new Date(e.updated_at) : void 0,
852
893
  isUndecided: e.undecided ?? void 0,
@@ -858,14 +899,14 @@ function X(e) {
858
899
  ]
859
900
  };
860
901
  }
861
- function Ue(e) {
862
- return X(e.data);
902
+ function Be(e) {
903
+ return Z(e.data);
863
904
  }
864
- function xe(e) {
865
- return e.data.map(X);
905
+ function We(e) {
906
+ return e.data.map(Z);
866
907
  }
867
- async function it(e, o, t) {
868
- const n = t || R(), s = {};
908
+ async function at(e, o, t) {
909
+ const n = t || D(), s = {};
869
910
  o?.lang && (s.lang = o.lang);
870
911
  const i = await b.get({
871
912
  path: `/v1/matches/${e}`,
@@ -873,10 +914,10 @@ async function it(e, o, t) {
873
914
  next: o?.next,
874
915
  config: n
875
916
  });
876
- return Ue(i);
917
+ return Be(i);
877
918
  }
878
- async function rt(e, o) {
879
- const t = o || R(), n = {};
919
+ async function ct(e, o) {
920
+ const t = o || D(), n = {};
880
921
  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");
881
922
  const s = await b.get({
882
923
  path: "/v1/matches",
@@ -884,9 +925,9 @@ async function rt(e, o) {
884
925
  next: e?.next,
885
926
  config: t
886
927
  });
887
- return xe(s);
928
+ return We(s);
888
929
  }
889
- function q(e) {
930
+ function j(e) {
890
931
  return {
891
932
  id: e.id,
892
933
  name: e.name,
@@ -900,7 +941,7 @@ function q(e) {
900
941
  ]
901
942
  };
902
943
  }
903
- function Be(e) {
944
+ function qe(e) {
904
945
  return {
905
946
  id: e.id,
906
947
  name: e.name,
@@ -908,7 +949,7 @@ function Be(e) {
908
949
  type: e.type || "LEAGUE",
909
950
  region: e.region,
910
951
  gender: e.gender?.toUpperCase(),
911
- country: e.country ? q(e.country) : void 0,
952
+ country: e.country ? j(e.country) : void 0,
912
953
  assets: e.assets?.logo ? {
913
954
  logo: e.assets.logo
914
955
  } : void 0,
@@ -920,7 +961,7 @@ function Be(e) {
920
961
  ]
921
962
  };
922
963
  }
923
- function We(e) {
964
+ function je(e) {
924
965
  return {
925
966
  type: "player",
926
967
  id: e.id,
@@ -928,7 +969,7 @@ function We(e) {
928
969
  position: e.position || void 0,
929
970
  gender: e.gender?.toUpperCase(),
930
971
  birthdate: e.birthdate || void 0,
931
- country: e.country ? q(e.country) : void 0,
972
+ country: e.country ? j(e.country) : void 0,
932
973
  assets: e.assets?.photo ? {
933
974
  photo: e.assets.photo
934
975
  } : void 0,
@@ -940,7 +981,7 @@ function We(e) {
940
981
  ]
941
982
  };
942
983
  }
943
- function qe(e) {
984
+ function Ve(e) {
944
985
  return {
945
986
  type: e.national ? "national" : "club",
946
987
  id: e.id,
@@ -948,7 +989,7 @@ function qe(e) {
948
989
  shortName: e.short_name || void 0,
949
990
  threeLetterCode: e.code || void 0,
950
991
  gender: e.gender?.toUpperCase(),
951
- country: e.country ? q(e.country) : void 0,
992
+ country: e.country ? j(e.country) : void 0,
952
993
  assets: e.assets?.logo ? {
953
994
  logo: e.assets.logo
954
995
  } : void 0,
@@ -963,7 +1004,7 @@ function qe(e) {
963
1004
  function B(e) {
964
1005
  switch (e.entity_type) {
965
1006
  case "competition": {
966
- const o = Be(e);
1007
+ const o = qe(e);
967
1008
  return {
968
1009
  source: "FOOTBALL",
969
1010
  entityType: "competition",
@@ -972,7 +1013,7 @@ function B(e) {
972
1013
  };
973
1014
  }
974
1015
  case "player": {
975
- const o = We(e);
1016
+ const o = je(e);
976
1017
  return {
977
1018
  source: "FOOTBALL",
978
1019
  entityType: "player",
@@ -981,7 +1022,7 @@ function B(e) {
981
1022
  };
982
1023
  }
983
1024
  case "team": {
984
- const o = qe(e);
1025
+ const o = Ve(e);
985
1026
  return {
986
1027
  source: "FOOTBALL",
987
1028
  entityType: "team",
@@ -996,10 +1037,10 @@ function B(e) {
996
1037
  throw new Error(`Unknown entity type: ${e.entity_type}`);
997
1038
  }
998
1039
  }
999
- async function at(e, o) {
1040
+ async function lt(e, o) {
1000
1041
  if (!e.query || e.query.trim() === "")
1001
1042
  return [];
1002
- const t = o || R(), n = {
1043
+ const t = o || D(), n = {
1003
1044
  q: e.query.trim()
1004
1045
  }, i = (e.entityTypes && e.entityTypes.length > 0 ? e.entityTypes : ["competition", "team", "player"]).map((d) => {
1005
1046
  switch (d) {
@@ -1031,24 +1072,24 @@ async function at(e, o) {
1031
1072
  l && a.push(l);
1032
1073
  })), a;
1033
1074
  }
1034
- function ct(e) {
1075
+ function dt(e) {
1035
1076
  return !e.seasons || e.seasons.length === 0 ? void 0 : e.seasons.find((t) => t.active) ?? e.seasons[0];
1036
1077
  }
1037
- function lt(e, o) {
1078
+ function ut(e, o) {
1038
1079
  const t = /* @__PURE__ */ new Date(), n = o.filter((s) => {
1039
1080
  const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "NOT_STARTED", a = new Date(s.timing.kickoffTime) >= t;
1040
1081
  return i && r && a;
1041
1082
  });
1042
1083
  return n.sort((s, i) => new Date(s.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()), n[0];
1043
1084
  }
1044
- function dt(e, o) {
1085
+ function mt(e, o) {
1045
1086
  const t = /* @__PURE__ */ new Date(), n = o.filter((s) => {
1046
1087
  const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "FINISHED", a = new Date(s.timing.kickoffTime) <= t;
1047
1088
  return i && r && a;
1048
1089
  });
1049
1090
  return n.sort((s, i) => new Date(i.timing.kickoffTime).getTime() - new Date(s.timing.kickoffTime).getTime()), n[0];
1050
1091
  }
1051
- function ut(e, o) {
1092
+ function ft(e, o) {
1052
1093
  const t = /* @__PURE__ */ new Date();
1053
1094
  return o.filter((s) => {
1054
1095
  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) >= t || s.status.type === "LIVE";
@@ -1057,7 +1098,7 @@ function ut(e, o) {
1057
1098
  (s, i) => new Date(s.timing.kickoffTime).getTime() - new Date(i.timing.kickoffTime).getTime()
1058
1099
  );
1059
1100
  }
1060
- function mt(e, o) {
1101
+ function pt(e, o) {
1061
1102
  const t = /* @__PURE__ */ new Date();
1062
1103
  return o.filter((s) => {
1063
1104
  const i = s.competitorOne.id === e || s.competitorTwo.id === e, r = s.status.type === "FINISHED", a = new Date(s.timing.kickoffTime) <= t;
@@ -1066,7 +1107,7 @@ function mt(e, o) {
1066
1107
  (s, i) => new Date(i.timing.kickoffTime).getTime() - new Date(s.timing.kickoffTime).getTime()
1067
1108
  );
1068
1109
  }
1069
- function ft(e, o, t) {
1110
+ function gt(e, o, t) {
1070
1111
  const n = t.filter((r) => r.status.type === "FINISHED"), s = t.filter(
1071
1112
  (r) => r.status.type === "NOT_STARTED" || r.status.type === "POSTPONED"
1072
1113
  ), i = o.entries.map((r) => {
@@ -1077,9 +1118,9 @@ function ft(e, o, t) {
1077
1118
  );
1078
1119
  let u, c;
1079
1120
  return d.forEach((m) => {
1080
- const p = m.competitorOne.id === e, g = parseInt(m.score?.competitorOne ?? "0"), h = parseInt(m.score?.competitorTwo ?? "0"), D = p ? g : h, S = p ? h : g;
1121
+ const p = m.competitorOne.id === e, g = parseInt(m.score?.competitorOne ?? "0"), h = parseInt(m.score?.competitorTwo ?? "0"), R = p ? g : h, S = p ? h : g;
1081
1122
  let A;
1082
- D > S ? A = "W" : D === S ? A = "D" : A = "L";
1123
+ R > S ? A = "W" : R === S ? A = "D" : A = "L";
1083
1124
  const G = {
1084
1125
  result: A,
1085
1126
  score: `${g} - ${h}`,
@@ -1116,7 +1157,7 @@ function ft(e, o, t) {
1116
1157
  rows: i
1117
1158
  };
1118
1159
  }
1119
- function pt(e, o = 10) {
1160
+ function yt(e, o = 10) {
1120
1161
  return e.players.filter((t) => (t.seasonStatistics?.goals ?? 0) > 0).sort((t, n) => {
1121
1162
  const s = t.seasonStatistics?.goals ?? 0, i = n.seasonStatistics?.goals ?? 0;
1122
1163
  if (i !== s)
@@ -1125,7 +1166,7 @@ function pt(e, o = 10) {
1125
1166
  return (n.seasonStatistics?.assists ?? 0) - r;
1126
1167
  }).slice(0, o);
1127
1168
  }
1128
- function gt(e, o = 10) {
1169
+ function ht(e, o = 10) {
1129
1170
  return e.players.filter((t) => (t.seasonStatistics?.assists ?? 0) > 0).sort((t, n) => {
1130
1171
  const s = t.seasonStatistics?.assists ?? 0, i = n.seasonStatistics?.assists ?? 0;
1131
1172
  if (i !== s)
@@ -1134,7 +1175,7 @@ function gt(e, o = 10) {
1134
1175
  return (n.seasonStatistics?.goals ?? 0) - r;
1135
1176
  }).slice(0, o);
1136
1177
  }
1137
- function yt(e, o = 10) {
1178
+ function Tt(e, o = 10) {
1138
1179
  return e.players.filter((t) => (t.seasonStatistics?.appearances ?? 0) > 0).sort((t, n) => {
1139
1180
  const s = t.seasonStatistics?.appearances ?? 0, i = n.seasonStatistics?.appearances ?? 0;
1140
1181
  if (i !== s)
@@ -1143,7 +1184,7 @@ function yt(e, o = 10) {
1143
1184
  return (n.seasonStatistics?.minutes ?? 0) - r;
1144
1185
  }).slice(0, o);
1145
1186
  }
1146
- function ht(e, o = 10) {
1187
+ function vt(e, o = 10) {
1147
1188
  return e.players.filter((t) => (t.seasonStatistics?.minutes ?? 0) > 0).sort((t, n) => {
1148
1189
  const s = t.seasonStatistics?.minutes ?? 0, i = n.seasonStatistics?.minutes ?? 0;
1149
1190
  if (i !== s)
@@ -1152,7 +1193,7 @@ function ht(e, o = 10) {
1152
1193
  return (n.seasonStatistics?.appearances ?? 0) - r;
1153
1194
  }).slice(0, o);
1154
1195
  }
1155
- function Tt(e, o = 10) {
1196
+ function St(e, o = 10) {
1156
1197
  return e.players.filter((t) => (t.seasonStatistics?.cleansheets ?? 0) > 0).sort((t, n) => {
1157
1198
  const s = t.seasonStatistics?.cleansheets ?? 0, i = n.seasonStatistics?.cleansheets ?? 0;
1158
1199
  if (i !== s)
@@ -1161,7 +1202,7 @@ function Tt(e, o = 10) {
1161
1202
  return (n.seasonStatistics?.appearances ?? 0) - r;
1162
1203
  }).slice(0, o);
1163
1204
  }
1164
- function vt(e, o = 10) {
1205
+ function _t(e, o = 10) {
1165
1206
  return e.players.filter((t) => {
1166
1207
  const n = t.seasonStatistics?.yellowCards ?? 0, s = t.seasonStatistics?.redCards ?? 0;
1167
1208
  return n + s > 0;
@@ -1170,31 +1211,31 @@ function vt(e, o = 10) {
1170
1211
  return l !== d ? l - d : a !== i ? a - i : r - s;
1171
1212
  }).slice(0, o);
1172
1213
  }
1173
- const je = ["GOAL", "PENALTY_GOAL", "OWN_GOAL"];
1214
+ const Ke = ["GOAL", "PENALTY_GOAL", "OWN_GOAL"];
1174
1215
  function O(e, o) {
1175
1216
  return o > 0 ? e / o * 100 : 0;
1176
1217
  }
1177
1218
  function U(e, o) {
1178
1219
  return o > 0 ? e / o : 0;
1179
1220
  }
1180
- function St(e, o = !1, t = 2) {
1221
+ function Ct(e, o = !1, t = 2) {
1181
1222
  return o ? `${Math.round(e)}%` : Number.isInteger(e) ? e.toString() : e.toFixed(t);
1182
1223
  }
1183
- function _t(e, o) {
1224
+ function At(e, o) {
1184
1225
  const t = typeof e == "string" ? parseFloat(e) : e;
1185
1226
  if (isNaN(t) || o === 0) return "0";
1186
1227
  const n = (t / o).toFixed(1);
1187
1228
  return `${t} (${n} avg)`;
1188
1229
  }
1189
- function Ct(e, o) {
1230
+ function Ot(e, o) {
1190
1231
  const t = typeof e == "string" ? parseFloat(e) : e;
1191
1232
  return isNaN(t) || o === 0 ? "0.0" : (t / o).toFixed(1);
1192
1233
  }
1193
- function At(e) {
1234
+ function Nt(e) {
1194
1235
  const o = parseFloat(e);
1195
1236
  return isNaN(o) ? "0%" : `${Math.round(o)}%`;
1196
1237
  }
1197
- function Ve(e, o, t) {
1238
+ function Ye(e, o, t) {
1198
1239
  if (e.status?.type !== "FINISHED" || !e.score) return null;
1199
1240
  const n = parseInt(e.score.competitorOne || "0"), s = parseInt(e.score.competitorTwo || "0"), i = t ? n : s, r = t ? s : n;
1200
1241
  let a = null, d = null;
@@ -1221,27 +1262,27 @@ function Ve(e, o, t) {
1221
1262
  isLoss: i < r
1222
1263
  };
1223
1264
  }
1224
- function j(e, o) {
1265
+ function V(e, o) {
1225
1266
  return e.competitorOne.id === o;
1226
1267
  }
1227
- function Ke(e, o) {
1268
+ function ze(e, o) {
1228
1269
  return e.competitorTwo.id === o;
1229
1270
  }
1230
- function Ot(e, o) {
1231
- return j(e, o) || Ke(e, o);
1271
+ function Ft(e, o) {
1272
+ return V(e, o) || ze(e, o);
1232
1273
  }
1233
- function Ft(e) {
1274
+ function Rt(e) {
1234
1275
  return e.status?.type === "FINISHED";
1235
1276
  }
1236
- function Nt(e, o) {
1237
- const t = j(e, o);
1277
+ function Gt(e, o) {
1278
+ const t = V(e, o);
1238
1279
  return parseInt(t ? e.score?.competitorOne || "0" : e.score?.competitorTwo || "0");
1239
1280
  }
1240
1281
  function Dt(e, o) {
1241
- const t = j(e, o);
1282
+ const t = V(e, o);
1242
1283
  return parseInt(t ? e.score?.competitorTwo || "0" : e.score?.competitorOne || "0");
1243
1284
  }
1244
- function Gt(e, o, t) {
1285
+ function Et(e, o, t) {
1245
1286
  const n = e.filter((u) => {
1246
1287
  if (u.status?.type !== "FINISHED" || !u.score) return !1;
1247
1288
  const c = u.competitorOne.id === o || u.competitorTwo.id === o, m = u.competitorOne.id === t || u.competitorTwo.id === t;
@@ -1267,7 +1308,7 @@ function Gt(e, o, t) {
1267
1308
  awayTeamAvgGoals: l > 0 ? d / l : 0
1268
1309
  };
1269
1310
  }
1270
- function Rt(e, o, t, n = 5) {
1311
+ function Mt(e, o, t, n = 5) {
1271
1312
  return e.filter((i) => {
1272
1313
  if (i.status?.type !== "FINISHED" || !i.score) return !1;
1273
1314
  const r = i.competitorOne.id === o || i.competitorTwo.id === o, a = i.competitorOne.id === t || i.competitorTwo.id === t;
@@ -1293,25 +1334,25 @@ function Rt(e, o, t, n = 5) {
1293
1334
  };
1294
1335
  });
1295
1336
  }
1296
- function Ye(e, o, t) {
1337
+ function Je(e, o, t) {
1297
1338
  return e.filter((n) => {
1298
1339
  const s = n.competitorOne.id === o, i = n.competitorTwo.id === o;
1299
1340
  return !s && !i ? !1 : t === "home" ? s : i;
1300
1341
  }).map((n) => {
1301
1342
  const s = n.competitorOne.id === o;
1302
- return Ve(n, o, s);
1343
+ return Ye(n, o, s);
1303
1344
  }).filter((n) => n !== null);
1304
1345
  }
1305
- function K(e, o, t, n) {
1346
+ function Y(e, o, t, n) {
1306
1347
  let s = 0;
1307
1348
  for (const i of e) {
1308
1349
  const r = i.competitorOne.id === o, a = i.competitorTwo.id === o;
1309
1350
  if (!r && !a || t === "home" && !r || t === "away" && !a || i.status?.type !== "FINISHED") continue;
1310
1351
  const d = i.mainEvents;
1311
1352
  if (!d || !Array.isArray(d)) continue;
1312
- const l = d.filter((g) => g.type && je.includes(g.type)).sort((g, h) => {
1313
- const D = g.minute ?? 0, S = h.minute ?? 0;
1314
- return D !== S ? D - S : (g.injuryMinute ?? 0) - (h.injuryMinute ?? 0);
1353
+ const l = d.filter((g) => g.type && Ke.includes(g.type)).sort((g, h) => {
1354
+ const R = g.minute ?? 0, S = h.minute ?? 0;
1355
+ return R !== S ? R - S : (g.injuryMinute ?? 0) - (h.injuryMinute ?? 0);
1315
1356
  });
1316
1357
  if (l.length === 0) continue;
1317
1358
  const u = l[0], c = r ? "ONE" : "TWO", m = u.type === "OWN_GOAL";
@@ -1320,7 +1361,7 @@ function K(e, o, t, n) {
1320
1361
  }
1321
1362
  return s;
1322
1363
  }
1323
- function ze(e, o, t) {
1364
+ function Qe(e, o, t) {
1324
1365
  let n = 0;
1325
1366
  for (const s of e) {
1326
1367
  const i = s.competitorOne.id === o, r = s.competitorTwo.id === o;
@@ -1330,8 +1371,8 @@ function ze(e, o, t) {
1330
1371
  }
1331
1372
  return n;
1332
1373
  }
1333
- function Et(e, o, t) {
1334
- const n = Ye(e, o, t), s = n.length;
1374
+ function bt(e, o, t) {
1375
+ const n = Je(e, o, t), s = n.length;
1335
1376
  if (s === 0)
1336
1377
  return {
1337
1378
  played: 0,
@@ -1355,10 +1396,10 @@ function Et(e, o, t) {
1355
1396
  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, d = 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, c = n.filter((f) => f.isLoss && f.goalsFor === 0).length, m = n.filter((f) => f.goalsAgainst > 0).length, p = n.filter((f) => f.halfTimeGoalsFor !== null), g = p.length, h = p.filter((f) => {
1356
1397
  const v = f.halfTimeGoalsFor, I = f.goalsFor - v;
1357
1398
  return v > 0 && I > 0;
1358
- }).length, D = K(e, o, t, "scored"), S = ze(e, o, t), A = p.filter((f) => f.halfTimeGoalsFor > f.halfTimeGoalsAgainst).length, G = p.filter((f) => {
1399
+ }).length, R = Y(e, o, t, "scored"), S = Qe(e, o, t), A = p.filter((f) => f.halfTimeGoalsFor > f.halfTimeGoalsAgainst).length, G = p.filter((f) => {
1359
1400
  const v = f.halfTimeGoalsAgainst, I = f.goalsAgainst - v;
1360
1401
  return v > 0 && I > 0;
1361
- }).length, k = K(e, o, t, "conceded"), L = p.filter((f) => f.halfTimeGoalsAgainst > f.halfTimeGoalsFor).length, H = n.filter((f) => f.cornersFor !== null), P = H.reduce((f, v) => f + (v.cornersFor || 0), 0), $ = H.reduce((f, v) => f + (v.cornersAgainst || 0), 0);
1402
+ }).length, k = Y(e, o, t, "conceded"), L = p.filter((f) => f.halfTimeGoalsAgainst > f.halfTimeGoalsFor).length, H = n.filter((f) => f.cornersFor !== null), P = H.reduce((f, v) => f + (v.cornersFor || 0), 0), $ = H.reduce((f, v) => f + (v.cornersAgainst || 0), 0);
1362
1403
  return {
1363
1404
  played: s,
1364
1405
  goalsForPerMatch: U(i, s),
@@ -1366,7 +1407,7 @@ function Et(e, o, t) {
1366
1407
  wonToNil: O(d, s),
1367
1408
  scoringRate: O(l, s),
1368
1409
  scoredInBothHalves: O(h, g),
1369
- scoredFirst: O(D, S),
1410
+ scoredFirst: O(R, S),
1370
1411
  leadingAtHalfTime: O(A, g),
1371
1412
  goalsAgainstPerMatch: U(r, s),
1372
1413
  failedToScore: O(u, s),
@@ -1379,7 +1420,7 @@ function Et(e, o, t) {
1379
1420
  avgCornersAgainst: U($, H.length)
1380
1421
  };
1381
1422
  }
1382
- function Je(e, o) {
1423
+ function Xe(e, o) {
1383
1424
  return e.filter((t) => t.status?.type !== "FINISHED" ? !1 : t.competitorOne.id === o || t.competitorTwo.id === o).map((t) => {
1384
1425
  const n = t.competitorOne.id === o, s = parseInt(t.score?.competitorOne || "0"), i = parseInt(t.score?.competitorTwo || "0"), r = s + i, a = t.periods;
1385
1426
  let d = null;
@@ -1398,8 +1439,8 @@ function Je(e, o) {
1398
1439
  function y(e, o) {
1399
1440
  return e.length === 0 ? 0 : e.filter((n) => n > o).length / e.length * 100;
1400
1441
  }
1401
- function Mt(e, o) {
1402
- const t = Je(e, o), n = t.filter((c) => c.isHome), s = t.filter((c) => !c.isHome), i = t.map((c) => c.totalGoals), r = n.map((c) => c.totalGoals), a = s.map((c) => c.totalGoals), d = t.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals), l = n.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals), u = s.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals);
1442
+ function Ht(e, o) {
1443
+ const t = Xe(e, o), n = t.filter((c) => c.isHome), s = t.filter((c) => !c.isHome), i = t.map((c) => c.totalGoals), r = n.map((c) => c.totalGoals), a = s.map((c) => c.totalGoals), d = t.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals), l = n.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals), u = s.filter((c) => c.halfTimeGoals !== null).map((c) => c.halfTimeGoals);
1403
1444
  return {
1404
1445
  over05: {
1405
1446
  home: y(r, 0.5),
@@ -1448,7 +1489,7 @@ function Mt(e, o) {
1448
1489
  }
1449
1490
  };
1450
1491
  }
1451
- function Qe(e, o) {
1492
+ function Ze(e, o) {
1452
1493
  const t = e.competitorOne.id === o, n = e.competitorTwo.id === o;
1453
1494
  if (!t && !n || !e.score) return null;
1454
1495
  const s = parseInt(t ? e.score.competitorOne || "0" : e.score.competitorTwo || "0"), i = parseInt(t ? e.score.competitorTwo || "0" : e.score.competitorOne || "0");
@@ -1458,10 +1499,10 @@ function Qe(e, o) {
1458
1499
  isHome: t
1459
1500
  };
1460
1501
  }
1461
- function bt(e, o, t, n, s, i) {
1502
+ function It(e, o, t, n, s, i) {
1462
1503
  const r = o?.entries.find((E) => E.competitor.id === e), a = t?.entries.find((E) => E.competitor.id === e), d = n?.entries.find((E) => E.competitor.id === e), l = s?.entries.find((E) => E.competitor.id === e), u = i?.entries.find((E) => E.competitor.id === e);
1463
1504
  if (!r) return null;
1464
- const c = a?.stats?.goalsFor ?? 0, m = d?.stats?.goalsFor ?? 0, p = r?.stats?.goalsFor ?? 0, g = l?.stats?.goalsAgainst ?? 0, h = u?.stats?.goalsAgainst ?? 0, D = r?.stats?.goalsAgainst ?? 0, S = a?.stats?.played ?? 0, A = d?.stats?.played ?? 0, G = r?.stats?.played ?? 0, k = G > 0 ? p / G : 0, L = G > 0 ? D / G : 0, H = k + L, P = S > 0 ? c / S : 0, $ = A > 0 ? m / A : 0, f = S > 0 ? g / S : 0, v = A > 0 ? h / A : 0, I = P + f, Z = $ + v;
1505
+ const c = a?.stats?.goalsFor ?? 0, m = d?.stats?.goalsFor ?? 0, p = r?.stats?.goalsFor ?? 0, g = l?.stats?.goalsAgainst ?? 0, h = u?.stats?.goalsAgainst ?? 0, R = r?.stats?.goalsAgainst ?? 0, S = a?.stats?.played ?? 0, A = d?.stats?.played ?? 0, G = r?.stats?.played ?? 0, k = G > 0 ? p / G : 0, L = G > 0 ? R / G : 0, H = k + L, P = S > 0 ? c / S : 0, $ = A > 0 ? m / A : 0, f = S > 0 ? g / S : 0, v = A > 0 ? h / A : 0, I = P + f, w = $ + v;
1465
1506
  return {
1466
1507
  homeGoals: c,
1467
1508
  totalGoals: p,
@@ -1470,7 +1511,7 @@ function bt(e, o, t, n, s, i) {
1470
1511
  awayGamesPlayed: A,
1471
1512
  totalGamesPlayed: G,
1472
1513
  homeGoalsConceded: g,
1473
- totalGoalsConceded: D,
1514
+ totalGoalsConceded: R,
1474
1515
  awayGoalsConceded: h,
1475
1516
  gfPerMatch: k,
1476
1517
  gaPerMatch: L,
@@ -1480,7 +1521,7 @@ function bt(e, o, t, n, s, i) {
1480
1521
  homeGaPerMatch: f,
1481
1522
  awayGaPerMatch: v,
1482
1523
  homeGfGaPerMatch: I,
1483
- awayGfGaPerMatch: Z
1524
+ awayGfGaPerMatch: w
1484
1525
  };
1485
1526
  }
1486
1527
  function _(e, o, t, n) {
@@ -1539,7 +1580,7 @@ function x(e, o, t) {
1539
1580
  concededTwice: _(e, o, T.concededTwice, t)
1540
1581
  };
1541
1582
  }
1542
- function Ht(e, o, t) {
1583
+ function kt(e, o, t) {
1543
1584
  const n = x(e, o, "home"), s = x(e, o), i = x(e, t, "away"), r = x(e, t);
1544
1585
  return [
1545
1586
  {
@@ -1628,11 +1669,11 @@ function Ht(e, o, t) {
1628
1669
  }
1629
1670
  ];
1630
1671
  }
1631
- function Y(e, o) {
1672
+ function z(e, o) {
1632
1673
  const t = /* @__PURE__ */ new Map();
1633
1674
  return e.forEach((n) => {
1634
1675
  if (n.status?.type !== "FINISHED") return;
1635
- const s = Qe(n, o);
1676
+ const s = Ze(n, o);
1636
1677
  if (!s) return;
1637
1678
  const i = s.isHome ? n.competitorTwo.id : n.competitorOne.id, r = s.isHome ? n.competitorTwo : n.competitorOne, a = t.get(i) || {
1638
1679
  opponentId: i,
@@ -1642,8 +1683,8 @@ function Y(e, o) {
1642
1683
  s.isHome ? a.homeResult = s.result : a.awayResult = s.result, t.set(i, a);
1643
1684
  }), t;
1644
1685
  }
1645
- function It(e, o, t, n, s, i, r) {
1646
- const a = Y(e, o), d = Y(e, t), l = /* @__PURE__ */ new Set([
1686
+ function Lt(e, o, t, n, s, i, r) {
1687
+ const a = z(e, o), d = z(e, t), l = /* @__PURE__ */ new Set([
1647
1688
  ...a.keys(),
1648
1689
  ...d.keys(),
1649
1690
  o,
@@ -1670,70 +1711,70 @@ function It(e, o, t, n, s, i, r) {
1670
1711
  }), u.sort((c, m) => c.isHomeTeamRow ? -1 : m.isHomeTeamRow ? 1 : c.isAwayTeamRow ? -1 : m.isAwayTeamRow ? 1 : c.opponentName.localeCompare(m.opponentName));
1671
1712
  }
1672
1713
  export {
1673
- je as GOAL_EVENT_TYPES,
1674
- Pt as addProviderRef,
1675
- Ve as analyzeMatch,
1714
+ Ke as GOAL_EVENT_TYPES,
1715
+ Ut as addProviderRef,
1716
+ Ye as analyzeMatch,
1676
1717
  U as calcAverage,
1677
1718
  O as calcPercentage,
1678
- Gt as calculateH2HStats,
1719
+ Et as calculateH2HStats,
1679
1720
  _ as calculateStreak,
1680
- Ct as formatAsAverage,
1681
- At as formatPossessionPercentage,
1682
- St as formatStatValue,
1683
- _t as formatWithAverage,
1684
- ct as getActiveSeason,
1685
- R as getConfig,
1686
- ot as getFansUnitedFootballCompetition,
1687
- tt as getFansUnitedFootballCompetitions,
1688
- it as getFansUnitedFootballMatch,
1689
- rt as getFansUnitedFootballMatches,
1690
- st as getFansUnitedFootballPlayer,
1691
- at as getFansUnitedFootballSearch,
1692
- nt as getFansUnitedFootballTeam,
1693
- $t as getFootballCompetition,
1694
- Ut as getFootballMatch,
1695
- xt as getFootballMatchCommentary,
1696
- Bt as getFootballMatchEvents,
1697
- Wt as getFootballMatchLineups,
1698
- qt as getFootballMatchOdds,
1699
- jt as getFootballMatchStatistics,
1700
- Vt as getFootballMatches,
1701
- Kt as getFootballPlayerSeasonStatistics,
1702
- Yt as getFootballSeasonDetails,
1703
- zt as getFootballStandings,
1704
- Jt as getFootballTeam,
1705
- Qt as getFootballTeamSquad,
1706
- Qe as getMatchResult,
1721
+ Ot as formatAsAverage,
1722
+ Nt as formatPossessionPercentage,
1723
+ Ct as formatStatValue,
1724
+ At as formatWithAverage,
1725
+ dt as getActiveSeason,
1726
+ D as getConfig,
1727
+ st as getFansUnitedFootballCompetition,
1728
+ nt as getFansUnitedFootballCompetitions,
1729
+ at as getFansUnitedFootballMatch,
1730
+ ct as getFansUnitedFootballMatches,
1731
+ rt as getFansUnitedFootballPlayer,
1732
+ lt as getFansUnitedFootballSearch,
1733
+ it as getFansUnitedFootballTeam,
1734
+ xt as getFootballCompetition,
1735
+ Bt as getFootballMatch,
1736
+ Wt as getFootballMatchCommentary,
1737
+ qt as getFootballMatchEvents,
1738
+ jt as getFootballMatchLineups,
1739
+ Vt as getFootballMatchOdds,
1740
+ Kt as getFootballMatchStatistics,
1741
+ Yt as getFootballMatches,
1742
+ zt as getFootballPlayerSeasonStatistics,
1743
+ Jt as getFootballSeasonDetails,
1744
+ Qt as getFootballStandings,
1745
+ Xt as getFootballTeam,
1746
+ Zt as getFootballTeamSquad,
1747
+ Ze as getMatchResult,
1707
1748
  Dt as getOpponentScore,
1708
- Xt as getProviderRefId,
1709
- Rt as getRecentH2HMeetings,
1710
- mt as getTeamFinishedMatches,
1711
- bt as getTeamGoalStats,
1712
- Et as getTeamHomeAwayStats,
1713
- vt as getTeamMostDecorated,
1714
- lt as getTeamNextMatch,
1715
- Mt as getTeamOverUnderStats,
1716
- dt as getTeamPreviousMatch,
1717
- ft as getTeamResultsTable,
1718
- Nt as getTeamScore,
1719
- et as getTeamSeasonStatistics,
1749
+ wt as getProviderRefId,
1750
+ Mt as getRecentH2HMeetings,
1751
+ pt as getTeamFinishedMatches,
1752
+ It as getTeamGoalStats,
1753
+ bt as getTeamHomeAwayStats,
1754
+ _t as getTeamMostDecorated,
1755
+ ut as getTeamNextMatch,
1756
+ Ht as getTeamOverUnderStats,
1757
+ mt as getTeamPreviousMatch,
1758
+ gt as getTeamResultsTable,
1759
+ Gt as getTeamScore,
1760
+ ot as getTeamSeasonStatistics,
1720
1761
  x as getTeamStreaks,
1721
- Ht as getTeamStreaksComparison,
1722
- yt as getTeamTopAppearances,
1723
- gt as getTeamTopAssisters,
1724
- Tt as getTeamTopCleanSheets,
1725
- ht as getTeamTopMinutesPlayed,
1726
- pt as getTeamTopScorers,
1727
- ut as getTeamUpcomingMatches,
1728
- It as getTeamsCommonOpponents,
1729
- Zt as isConfigured,
1730
- Ft as isMatchFinished,
1731
- Ke as isTeamAway,
1732
- j as isTeamHome,
1733
- Ot as isTeamInMatch,
1734
- we as search,
1735
- Ze as searchFootball,
1736
- wt as setConfig,
1762
+ kt as getTeamStreaksComparison,
1763
+ Tt as getTeamTopAppearances,
1764
+ ht as getTeamTopAssisters,
1765
+ St as getTeamTopCleanSheets,
1766
+ vt as getTeamTopMinutesPlayed,
1767
+ yt as getTeamTopScorers,
1768
+ ft as getTeamUpcomingMatches,
1769
+ Lt as getTeamsCommonOpponents,
1770
+ eo as isConfigured,
1771
+ Rt as isMatchFinished,
1772
+ ze as isTeamAway,
1773
+ V as isTeamHome,
1774
+ Ft as isTeamInMatch,
1775
+ tt as search,
1776
+ et as searchFootball,
1777
+ to as setConfig,
1737
1778
  T as streakFilters,
1738
1779
  C as toProviderRefArray
1739
1780
  };