fansunited-data-layer 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/api/fansunited/constants.d.ts +5 -0
  2. package/api/fansunited/constants.d.ts.map +1 -0
  3. package/api/fansunited/football/competition/index.d.ts +30 -0
  4. package/api/fansunited/football/competition/index.d.ts.map +1 -0
  5. package/api/fansunited/football/competition/transformer.d.ts +11 -0
  6. package/api/fansunited/football/competition/transformer.d.ts.map +1 -0
  7. package/api/fansunited/football/competition/types.d.ts +70 -0
  8. package/api/fansunited/football/competition/types.d.ts.map +1 -0
  9. package/api/fansunited/football/competitions/index.d.ts +27 -0
  10. package/api/fansunited/football/competitions/index.d.ts.map +1 -0
  11. package/api/fansunited/football/competitions/transformer.d.ts +14 -0
  12. package/api/fansunited/football/competitions/transformer.d.ts.map +1 -0
  13. package/api/fansunited/football/competitions/types.d.ts +67 -0
  14. package/api/fansunited/football/competitions/types.d.ts.map +1 -0
  15. package/api/fansunited/football/http.d.ts +8 -0
  16. package/api/fansunited/football/http.d.ts.map +1 -0
  17. package/api/fansunited/football/index.d.ts +19 -0
  18. package/api/fansunited/football/index.d.ts.map +1 -0
  19. package/api/fansunited/football/matches/index.d.ts +61 -0
  20. package/api/fansunited/football/matches/index.d.ts.map +1 -0
  21. package/api/fansunited/football/matches/transformer.d.ts +28 -0
  22. package/api/fansunited/football/matches/transformer.d.ts.map +1 -0
  23. package/api/fansunited/football/matches/types.d.ts +328 -0
  24. package/api/fansunited/football/matches/types.d.ts.map +1 -0
  25. package/api/fansunited/football/players/index.d.ts +30 -0
  26. package/api/fansunited/football/players/index.d.ts.map +1 -0
  27. package/api/fansunited/football/players/transformer.d.ts +10 -0
  28. package/api/fansunited/football/players/transformer.d.ts.map +1 -0
  29. package/api/fansunited/football/players/types.d.ts +70 -0
  30. package/api/fansunited/football/players/types.d.ts.map +1 -0
  31. package/api/fansunited/football/search/index.d.ts +49 -0
  32. package/api/fansunited/football/search/index.d.ts.map +1 -0
  33. package/api/fansunited/football/search/transformer.d.ts +10 -0
  34. package/api/fansunited/football/search/transformer.d.ts.map +1 -0
  35. package/api/fansunited/football/search/types.d.ts +151 -0
  36. package/api/fansunited/football/search/types.d.ts.map +1 -0
  37. package/api/fansunited/football/teams/index.d.ts +30 -0
  38. package/api/fansunited/football/teams/index.d.ts.map +1 -0
  39. package/api/fansunited/football/teams/transformer.d.ts +10 -0
  40. package/api/fansunited/football/teams/transformer.d.ts.map +1 -0
  41. package/api/fansunited/football/teams/types.d.ts +87 -0
  42. package/api/fansunited/football/teams/types.d.ts.map +1 -0
  43. package/api/fansunited/http.d.ts +54 -0
  44. package/api/fansunited/http.d.ts.map +1 -0
  45. package/api/fansunited/index.d.ts +10 -0
  46. package/api/fansunited/index.d.ts.map +1 -0
  47. package/api/sportal365-sports/constants.d.ts +16 -0
  48. package/api/sportal365-sports/constants.d.ts.map +1 -0
  49. package/api/sportal365-sports/football/competitions/competition.types.d.ts +148 -0
  50. package/api/sportal365-sports/football/competitions/competition.types.d.ts.map +1 -0
  51. package/api/sportal365-sports/football/competitions/index.d.ts +54 -0
  52. package/api/sportal365-sports/football/competitions/index.d.ts.map +1 -0
  53. package/api/sportal365-sports/football/competitions/utils.d.ts +14 -0
  54. package/api/sportal365-sports/football/competitions/utils.d.ts.map +1 -0
  55. package/api/sportal365-sports/football/http.d.ts +8 -0
  56. package/api/sportal365-sports/football/http.d.ts.map +1 -0
  57. package/api/sportal365-sports/football/index.d.ts +19 -0
  58. package/api/sportal365-sports/football/index.d.ts.map +1 -0
  59. package/api/sportal365-sports/football/matches/index.d.ts +151 -0
  60. package/api/sportal365-sports/football/matches/index.d.ts.map +1 -0
  61. package/api/sportal365-sports/football/matches/transformers/commentary.d.ts +12 -0
  62. package/api/sportal365-sports/football/matches/transformers/commentary.d.ts.map +1 -0
  63. package/api/sportal365-sports/football/matches/transformers/index.d.ts +10 -0
  64. package/api/sportal365-sports/football/matches/transformers/index.d.ts.map +1 -0
  65. package/api/sportal365-sports/football/matches/transformers/lineup.d.ts +11 -0
  66. package/api/sportal365-sports/football/matches/transformers/lineup.d.ts.map +1 -0
  67. package/api/sportal365-sports/football/matches/transformers/match-event.d.ts +12 -0
  68. package/api/sportal365-sports/football/matches/transformers/match-event.d.ts.map +1 -0
  69. package/api/sportal365-sports/football/matches/transformers/match.d.ts +11 -0
  70. package/api/sportal365-sports/football/matches/transformers/match.d.ts.map +1 -0
  71. package/api/sportal365-sports/football/matches/transformers/odds.d.ts +11 -0
  72. package/api/sportal365-sports/football/matches/transformers/odds.d.ts.map +1 -0
  73. package/api/sportal365-sports/football/matches/transformers/statistics.d.ts +11 -0
  74. package/api/sportal365-sports/football/matches/transformers/statistics.d.ts.map +1 -0
  75. package/api/sportal365-sports/football/matches/types/commentary.types.d.ts +27 -0
  76. package/api/sportal365-sports/football/matches/types/commentary.types.d.ts.map +1 -0
  77. package/api/sportal365-sports/football/matches/types/event.types.d.ts +19 -0
  78. package/api/sportal365-sports/football/matches/types/event.types.d.ts.map +1 -0
  79. package/api/sportal365-sports/football/matches/types/index.d.ts +16 -0
  80. package/api/sportal365-sports/football/matches/types/index.d.ts.map +1 -0
  81. package/api/sportal365-sports/football/matches/types/lineup.types.d.ts +80 -0
  82. package/api/sportal365-sports/football/matches/types/lineup.types.d.ts.map +1 -0
  83. package/api/sportal365-sports/football/matches/types/match.types.d.ts +47 -0
  84. package/api/sportal365-sports/football/matches/types/match.types.d.ts.map +1 -0
  85. package/api/sportal365-sports/football/matches/types/minute.types.d.ts +8 -0
  86. package/api/sportal365-sports/football/matches/types/minute.types.d.ts.map +1 -0
  87. package/api/sportal365-sports/football/matches/types/odds.types.d.ts +80 -0
  88. package/api/sportal365-sports/football/matches/types/odds.types.d.ts.map +1 -0
  89. package/api/sportal365-sports/football/matches/types/option.types.d.ts +129 -0
  90. package/api/sportal365-sports/football/matches/types/option.types.d.ts.map +1 -0
  91. package/api/sportal365-sports/football/matches/types/referee.types.d.ts +13 -0
  92. package/api/sportal365-sports/football/matches/types/referee.types.d.ts.map +1 -0
  93. package/api/sportal365-sports/football/matches/types/statistics.types.d.ts +45 -0
  94. package/api/sportal365-sports/football/matches/types/statistics.types.d.ts.map +1 -0
  95. package/api/sportal365-sports/football/matches/types/status.types.d.ts +13 -0
  96. package/api/sportal365-sports/football/matches/types/status.types.d.ts.map +1 -0
  97. package/api/sportal365-sports/football/matches/types/team.types.d.ts +17 -0
  98. package/api/sportal365-sports/football/matches/types/team.types.d.ts.map +1 -0
  99. package/api/sportal365-sports/football/matches/types/winner.types.d.ts +15 -0
  100. package/api/sportal365-sports/football/matches/types/winner.types.d.ts.map +1 -0
  101. package/api/sportal365-sports/football/search/index.d.ts +45 -0
  102. package/api/sportal365-sports/football/search/index.d.ts.map +1 -0
  103. package/api/sportal365-sports/football/search/search.transformer.d.ts +10 -0
  104. package/api/sportal365-sports/football/search/search.transformer.d.ts.map +1 -0
  105. package/api/sportal365-sports/football/search/search.types.d.ts +147 -0
  106. package/api/sportal365-sports/football/search/search.types.d.ts.map +1 -0
  107. package/api/sportal365-sports/football/standings/index.d.ts +43 -0
  108. package/api/sportal365-sports/football/standings/index.d.ts.map +1 -0
  109. package/api/sportal365-sports/football/standings/standing.transformer.d.ts +15 -0
  110. package/api/sportal365-sports/football/standings/standing.transformer.d.ts.map +1 -0
  111. package/api/sportal365-sports/football/standings/standing.types.d.ts +73 -0
  112. package/api/sportal365-sports/football/standings/standing.types.d.ts.map +1 -0
  113. package/api/sportal365-sports/football/statistics/index.d.ts +42 -0
  114. package/api/sportal365-sports/football/statistics/index.d.ts.map +1 -0
  115. package/api/sportal365-sports/football/statistics/player-season.transformer.d.ts +11 -0
  116. package/api/sportal365-sports/football/statistics/player-season.transformer.d.ts.map +1 -0
  117. package/api/sportal365-sports/football/statistics/player-season.types.d.ts +84 -0
  118. package/api/sportal365-sports/football/statistics/player-season.types.d.ts.map +1 -0
  119. package/api/sportal365-sports/football/teams/index.d.ts +53 -0
  120. package/api/sportal365-sports/football/teams/index.d.ts.map +1 -0
  121. package/api/sportal365-sports/football/teams/squad.types.d.ts +63 -0
  122. package/api/sportal365-sports/football/teams/squad.types.d.ts.map +1 -0
  123. package/api/sportal365-sports/football/teams/team.types.d.ts +58 -0
  124. package/api/sportal365-sports/football/teams/team.types.d.ts.map +1 -0
  125. package/api/sportal365-sports/football/teams/utils.d.ts +24 -0
  126. package/api/sportal365-sports/football/teams/utils.d.ts.map +1 -0
  127. package/api/sportal365-sports/http.d.ts +59 -0
  128. package/api/sportal365-sports/http.d.ts.map +1 -0
  129. package/api/sportal365-sports/index.d.ts +14 -0
  130. package/api/sportal365-sports/index.d.ts.map +1 -0
  131. package/api/sportal365-sports/search/http.d.ts +8 -0
  132. package/api/sportal365-sports/search/http.d.ts.map +1 -0
  133. package/api/sportal365-sports/search/index.d.ts +43 -0
  134. package/api/sportal365-sports/search/index.d.ts.map +1 -0
  135. package/api/sportal365-sports/search/search.transformer.d.ts +10 -0
  136. package/api/sportal365-sports/search/search.transformer.d.ts.map +1 -0
  137. package/api/sportal365-sports/search/search.types.d.ts +209 -0
  138. package/api/sportal365-sports/search/search.types.d.ts.map +1 -0
  139. package/api/sportal365-sports/shared/index.d.ts +6 -0
  140. package/api/sportal365-sports/shared/index.d.ts.map +1 -0
  141. package/api/sportal365-sports/shared/providerRef.helper.d.ts +79 -0
  142. package/api/sportal365-sports/shared/providerRef.helper.d.ts.map +1 -0
  143. package/api/sportal365-sports/shared/types.d.ts +189 -0
  144. package/api/sportal365-sports/shared/types.d.ts.map +1 -0
  145. package/api/sportal365-sports/statistics/http.d.ts +8 -0
  146. package/api/sportal365-sports/statistics/http.d.ts.map +1 -0
  147. package/api/sportal365-sports/statistics/index.d.ts +55 -0
  148. package/api/sportal365-sports/statistics/index.d.ts.map +1 -0
  149. package/api/sportal365-sports/statistics/team-stats.transformer.d.ts +14 -0
  150. package/api/sportal365-sports/statistics/team-stats.transformer.d.ts.map +1 -0
  151. package/api/sportal365-sports/statistics/team-stats.types.d.ts +45 -0
  152. package/api/sportal365-sports/statistics/team-stats.types.d.ts.map +1 -0
  153. package/client.cjs +8 -0
  154. package/client.d.ts +20 -0
  155. package/client.d.ts.map +1 -0
  156. package/client.js +12065 -0
  157. package/config/index.d.ts +31 -0
  158. package/config/index.d.ts.map +1 -0
  159. package/config/types.d.ts +36 -0
  160. package/config/types.d.ts.map +1 -0
  161. package/fansunited-data-layer.cjs +1 -0
  162. package/fansunited-data-layer.js +1739 -0
  163. package/helpers/competition.helpers.d.ts +22 -0
  164. package/helpers/competition.helpers.d.ts.map +1 -0
  165. package/helpers/index.d.ts +7 -0
  166. package/helpers/index.d.ts.map +1 -0
  167. package/helpers/team.helpers.d.ts +289 -0
  168. package/helpers/team.helpers.d.ts.map +1 -0
  169. package/index-Cogo-Kkd.cjs +1 -0
  170. package/index-D7T2Yy11.js +1170 -0
  171. package/index.d.ts +39 -0
  172. package/index.d.ts.map +1 -0
  173. package/package.json +12 -15
  174. package/providers/competition/hooks/index.d.ts +6 -0
  175. package/providers/competition/hooks/index.d.ts.map +1 -0
  176. package/providers/competition/hooks/useCompetitionStats.d.ts +8 -0
  177. package/providers/competition/hooks/useCompetitionStats.d.ts.map +1 -0
  178. package/providers/competition/hooks/useGoalDistribution.d.ts +11 -0
  179. package/providers/competition/hooks/useGoalDistribution.d.ts.map +1 -0
  180. package/providers/competition/hooks/useMatchHelpers.d.ts +16 -0
  181. package/providers/competition/hooks/useMatchHelpers.d.ts.map +1 -0
  182. package/providers/competition/hooks/useStandingsCalculations.d.ts +18 -0
  183. package/providers/competition/hooks/useStandingsCalculations.d.ts.map +1 -0
  184. package/providers/competition/hooks/useStandingsHelpers.d.ts +23 -0
  185. package/providers/competition/hooks/useStandingsHelpers.d.ts.map +1 -0
  186. package/providers/competition/hooks/useTeamPosition.d.ts +8 -0
  187. package/providers/competition/hooks/useTeamPosition.d.ts.map +1 -0
  188. package/providers/competition/hooks/useTeamResultsTable.d.ts +9 -0
  189. package/providers/competition/hooks/useTeamResultsTable.d.ts.map +1 -0
  190. package/providers/competition/utils/competitionStats.d.ts +42 -0
  191. package/providers/competition/utils/competitionStats.d.ts.map +1 -0
  192. package/providers/competition/utils/goalDistribution.d.ts +41 -0
  193. package/providers/competition/utils/goalDistribution.d.ts.map +1 -0
  194. package/providers/competition/utils/index.d.ts +6 -0
  195. package/providers/competition/utils/index.d.ts.map +1 -0
  196. package/providers/competition/utils/standingsCalculations.d.ts +24 -0
  197. package/providers/competition/utils/standingsCalculations.d.ts.map +1 -0
  198. package/providers/competition.context.d.ts +8 -0
  199. package/providers/competition.context.d.ts.map +1 -0
  200. package/providers/competition.provider.d.ts +3 -0
  201. package/providers/competition.provider.d.ts.map +1 -0
  202. package/providers/competition.types.d.ts +118 -0
  203. package/providers/competition.types.d.ts.map +1 -0
  204. package/providers/fansunited-config.context.d.ts +6 -0
  205. package/providers/fansunited-config.context.d.ts.map +1 -0
  206. package/providers/fansunited-config.hooks.d.ts +19 -0
  207. package/providers/fansunited-config.hooks.d.ts.map +1 -0
  208. package/providers/fansunited-config.provider.d.ts +44 -0
  209. package/providers/fansunited-config.provider.d.ts.map +1 -0
  210. package/providers/fansunited-config.types.d.ts +48 -0
  211. package/providers/fansunited-config.types.d.ts.map +1 -0
  212. package/providers/fansunited-sdk.hook.d.ts +40 -0
  213. package/providers/fansunited-sdk.hook.d.ts.map +1 -0
  214. package/providers/index.d.ts +20 -0
  215. package/providers/index.d.ts.map +1 -0
  216. package/providers/match/hooks/useEventHelpers.d.ts +12 -0
  217. package/providers/match/hooks/useEventHelpers.d.ts.map +1 -0
  218. package/providers/match/hooks/useHeadToHeadHelpers.d.ts +13 -0
  219. package/providers/match/hooks/useHeadToHeadHelpers.d.ts.map +1 -0
  220. package/providers/match/hooks/useLineupHelpers.d.ts +13 -0
  221. package/providers/match/hooks/useLineupHelpers.d.ts.map +1 -0
  222. package/providers/match/hooks/useMatchStandingsCalculations.d.ts +20 -0
  223. package/providers/match/hooks/useMatchStandingsCalculations.d.ts.map +1 -0
  224. package/providers/match/hooks/useMatchStatus.d.ts +12 -0
  225. package/providers/match/hooks/useMatchStatus.d.ts.map +1 -0
  226. package/providers/match/hooks/useOddsHelpers.d.ts +10 -0
  227. package/providers/match/hooks/useOddsHelpers.d.ts.map +1 -0
  228. package/providers/match/hooks/useScoreHelpers.d.ts +16 -0
  229. package/providers/match/hooks/useScoreHelpers.d.ts.map +1 -0
  230. package/providers/match/hooks/useStandingsHelpers.d.ts +22 -0
  231. package/providers/match/hooks/useStandingsHelpers.d.ts.map +1 -0
  232. package/providers/match/hooks/useStatisticsHelpers.d.ts +13 -0
  233. package/providers/match/hooks/useStatisticsHelpers.d.ts.map +1 -0
  234. package/providers/match/hooks/useTeamHelpers.d.ts +11 -0
  235. package/providers/match/hooks/useTeamHelpers.d.ts.map +1 -0
  236. package/providers/match/hooks/useTeamStatsHelpers.d.ts +12 -0
  237. package/providers/match/hooks/useTeamStatsHelpers.d.ts.map +1 -0
  238. package/providers/match.context.d.ts +8 -0
  239. package/providers/match.context.d.ts.map +1 -0
  240. package/providers/match.provider.d.ts +3 -0
  241. package/providers/match.provider.d.ts.map +1 -0
  242. package/providers/match.types.d.ts +151 -0
  243. package/providers/match.types.d.ts.map +1 -0
  244. package/providers/team/hooks/useFormStats.d.ts +49 -0
  245. package/providers/team/hooks/useFormStats.d.ts.map +1 -0
  246. package/providers/team/hooks/useMatchHelpers.d.ts +12 -0
  247. package/providers/team/hooks/useMatchHelpers.d.ts.map +1 -0
  248. package/providers/team/hooks/useSquadHelpers.d.ts +17 -0
  249. package/providers/team/hooks/useSquadHelpers.d.ts.map +1 -0
  250. package/providers/team.context.d.ts +8 -0
  251. package/providers/team.context.d.ts.map +1 -0
  252. package/providers/team.provider.d.ts +3 -0
  253. package/providers/team.provider.d.ts.map +1 -0
  254. package/providers/team.types.d.ts +68 -0
  255. package/providers/team.types.d.ts.map +1 -0
  256. package/types/canonical/base.types.d.ts +366 -0
  257. package/types/canonical/base.types.d.ts.map +1 -0
  258. package/types/canonical/commentary.types.d.ts +42 -0
  259. package/types/canonical/commentary.types.d.ts.map +1 -0
  260. package/types/canonical/event.types.d.ts +31 -0
  261. package/types/canonical/event.types.d.ts.map +1 -0
  262. package/types/canonical/index.d.ts +17 -0
  263. package/types/canonical/index.d.ts.map +1 -0
  264. package/types/canonical/lineup.types.d.ts +33 -0
  265. package/types/canonical/lineup.types.d.ts.map +1 -0
  266. package/types/canonical/match.types.d.ts +153 -0
  267. package/types/canonical/match.types.d.ts.map +1 -0
  268. package/types/canonical/odds.types.d.ts +73 -0
  269. package/types/canonical/odds.types.d.ts.map +1 -0
  270. package/types/canonical/search.types.d.ts +101 -0
  271. package/types/canonical/search.types.d.ts.map +1 -0
  272. package/types/canonical/sports-search.types.d.ts +151 -0
  273. package/types/canonical/sports-search.types.d.ts.map +1 -0
  274. package/types/canonical/squad.types.d.ts +30 -0
  275. package/types/canonical/squad.types.d.ts.map +1 -0
  276. package/types/canonical/standing.types.d.ts +85 -0
  277. package/types/canonical/standing.types.d.ts.map +1 -0
  278. package/types/canonical/statistics.types.d.ts +81 -0
  279. package/types/canonical/statistics.types.d.ts.map +1 -0
  280. package/types/index.d.ts +10 -0
  281. package/types/index.d.ts.map +1 -0
  282. package/utilities/stats/core/helpers.d.ts +65 -0
  283. package/utilities/stats/core/helpers.d.ts.map +1 -0
  284. package/utilities/stats/core/index.d.ts +7 -0
  285. package/utilities/stats/core/index.d.ts.map +1 -0
  286. package/utilities/stats/core/types.d.ts +39 -0
  287. package/utilities/stats/core/types.d.ts.map +1 -0
  288. package/utilities/stats/index.d.ts +27 -0
  289. package/utilities/stats/index.d.ts.map +1 -0
  290. package/utilities/stats/match/headToHead.d.ts +73 -0
  291. package/utilities/stats/match/headToHead.d.ts.map +1 -0
  292. package/utilities/stats/match/homeVsAway.d.ts +30 -0
  293. package/utilities/stats/match/homeVsAway.d.ts.map +1 -0
  294. package/utilities/stats/match/index.d.ts +8 -0
  295. package/utilities/stats/match/index.d.ts.map +1 -0
  296. package/utilities/stats/match/overUnder.d.ts +59 -0
  297. package/utilities/stats/match/overUnder.d.ts.map +1 -0
  298. package/utilities/stats/match/result.d.ts +13 -0
  299. package/utilities/stats/match/result.d.ts.map +1 -0
  300. package/utilities/stats/team/commonOpponents.d.ts +28 -0
  301. package/utilities/stats/team/commonOpponents.d.ts.map +1 -0
  302. package/utilities/stats/team/goalStats.d.ts +42 -0
  303. package/utilities/stats/team/goalStats.d.ts.map +1 -0
  304. package/utilities/stats/team/index.d.ts +7 -0
  305. package/utilities/stats/team/index.d.ts.map +1 -0
  306. package/utilities/stats/team/streaks.d.ts +48 -0
  307. package/utilities/stats/team/streaks.d.ts.map +1 -0
  308. package/vite.svg +1 -0
@@ -0,0 +1,1170 @@
1
+ const y = "__FANSUNITED_DATA_LAYER_CONFIG__";
2
+ function de(e) {
3
+ globalThis[y] = e;
4
+ }
5
+ function c() {
6
+ const e = globalThis[y];
7
+ if (!e)
8
+ throw new Error("Data layer config not initialized. Call setConfig() in your root layout.");
9
+ return e;
10
+ }
11
+ function ue() {
12
+ return globalThis[y] !== void 0;
13
+ }
14
+ function k(e) {
15
+ const t = e.replace(/\/$/, "");
16
+ function o(s) {
17
+ const { sportal365Sports: a } = s;
18
+ if (!a)
19
+ throw new Error("Sportal365 Sports API configuration is missing");
20
+ const d = `${a.username}:${a.password}`;
21
+ return `Basic ${btoa(d)}`;
22
+ }
23
+ function n(s) {
24
+ return `${t}${s}`;
25
+ }
26
+ return {
27
+ async get(s) {
28
+ const a = s.config || c(), { sportal365Sports: d } = a;
29
+ if (!d)
30
+ throw new Error("Sportal365 Sports API configuration is missing");
31
+ const u = new URL(n(s.path));
32
+ if (s.params)
33
+ for (const [p, f] of Object.entries(s.params))
34
+ f !== void 0 && (Array.isArray(f) ? f.length > 0 && u.searchParams.set(p, f.join(",")) : u.searchParams.set(p, f));
35
+ const m = await fetch(u.toString(), {
36
+ method: "GET",
37
+ headers: {
38
+ Authorization: o(a),
39
+ "Content-Type": "application/json",
40
+ "X-Project": d.projectId,
41
+ // Merge custom headers (they can override defaults)
42
+ ...s.headers
43
+ },
44
+ signal: d.timeout ? AbortSignal.timeout(d.timeout) : void 0,
45
+ // Next.js cache options for ISR/on-demand revalidation
46
+ ...s.next && { next: s.next }
47
+ });
48
+ if (!m.ok)
49
+ throw new Error(`Sportal365 API error: ${m.status} ${m.statusText}`);
50
+ return m.json();
51
+ }
52
+ };
53
+ }
54
+ const L = "https://football.api.sportal365.com", ce = "https://sports-statistics.api.sportal365.com", le = "https://sports-search.api.sportal365.com", g = k(L);
55
+ function S(e) {
56
+ if (e)
57
+ return {
58
+ id: e.id,
59
+ name: e.name,
60
+ slug: e.slug,
61
+ position: e.position,
62
+ gender: e.gender,
63
+ assets: e.assets ? {
64
+ photo: e.assets.thumb?.url,
65
+ photoTransparent: e.assets.thumb_transparent_background?.url
66
+ } : void 0
67
+ };
68
+ }
69
+ const R = {
70
+ // Scoring events
71
+ GOAL: "GOAL",
72
+ PENALTY_GOAL: "PENALTY_GOAL",
73
+ OWN_GOAL: "OWN_GOAL",
74
+ DISALLOWED_GOAL: "DISALLOWED_GOAL",
75
+ PENALTY_SHOOTOUT_SCORED: "PENALTY_SHOOTOUT_SCORED",
76
+ PENALTY_SHOOTOUT_MISSED: "PENALTY_SHOOTOUT_MISSED",
77
+ // Card events
78
+ YELLOW_CARD: "YELLOW_CARD",
79
+ RED_CARD: "RED_CARD",
80
+ YELLOW_RED_CARD: "YELLOW_RED_CARD",
81
+ // Substitution
82
+ SUBSTITUTION: "SUBSTITUTION",
83
+ // Match flow events
84
+ KICKOFF: "KICKOFF",
85
+ HALFTIME: "HALFTIME",
86
+ START_SECOND_HALF: "START_SECOND_HALF",
87
+ FINISHED: "FINISHED",
88
+ INJURY_TIME: "INJURY_TIME",
89
+ // Penalty events
90
+ PENALTY_AWARDED: "PENALTY_AWARDED",
91
+ PENALTY_MISSED: "PENALTY_MISSED",
92
+ PENALTY_SAVED: "PENALTY_SAVED"
93
+ };
94
+ function _(e) {
95
+ const t = R[e.type_code];
96
+ return t ? {
97
+ id: e.id,
98
+ type: t,
99
+ competitorPosition: e.team_position === "HOME" ? "ONE" : "TWO",
100
+ minute: e.minute,
101
+ injuryMinute: e.injury_minute,
102
+ primaryPlayer: S(e.primary_player),
103
+ secondaryPlayer: S(e.secondary_player),
104
+ score: e.score ? { competitorOne: String(e.score.home), competitorTwo: String(e.score.away) } : void 0
105
+ } : (console.warn(`Unknown event type: ${e.type_code}`), null);
106
+ }
107
+ function i(e, t = "sportal365") {
108
+ if (e)
109
+ return [
110
+ {
111
+ provider: t,
112
+ id: e
113
+ }
114
+ ];
115
+ }
116
+ function ge(e, t) {
117
+ return e ? e.find((n) => n.provider === t)?.id : void 0;
118
+ }
119
+ function me(e, t, o) {
120
+ const n = e ?? [], s = n.findIndex((a) => a.provider === t);
121
+ if (s >= 0) {
122
+ const a = [...n];
123
+ return a[s] = { provider: t, id: o }, a;
124
+ } else
125
+ return [...n, { provider: t, id: o }];
126
+ }
127
+ function D(e) {
128
+ const t = {
129
+ finished_ap: "finished_after_penalties",
130
+ // finished after penalties
131
+ finished_aet: "finished_after_extra_time",
132
+ // finished after extra time
133
+ finished: "finished",
134
+ not_started: "not_started",
135
+ live: "live",
136
+ interrupted: "interrupted",
137
+ cancelled: "cancelled",
138
+ postponed: "postponed",
139
+ abandoned: "abandoned"
140
+ };
141
+ let o;
142
+ return e.code && t[e.code] ? o = t[e.code] : o = {
143
+ FINISHED: "finished",
144
+ NOT_STARTED: "not_started",
145
+ LIVE: "live",
146
+ INTERRUPTED: "interrupted",
147
+ CANCELLED: "cancelled",
148
+ POSTPONED: "postponed",
149
+ UNKNOWN: "not_started",
150
+ ABANDONED: "abandoned"
151
+ }[e.type] ?? "not_started", {
152
+ code: o,
153
+ name: e.name,
154
+ shortName: e.short_name,
155
+ type: e.type
156
+ };
157
+ }
158
+ function T(e) {
159
+ return {
160
+ id: e.id,
161
+ name: e.name,
162
+ shortName: e.short_name ?? void 0,
163
+ threeLetterCode: e.three_letter_code,
164
+ slug: e.slug,
165
+ type: e.type === "national" ? "national" : "club",
166
+ gender: e.gender,
167
+ assets: e.assets ? {
168
+ logo: e.assets.logo?.url,
169
+ homeKit: e.assets.home_kit?.url,
170
+ awayKit: e.assets.away_kit?.url,
171
+ squadImage: e.assets.squad_image?.url
172
+ } : void 0,
173
+ metadata: e.shirt_color ? {
174
+ shirtColors: [
175
+ {
176
+ type: "home",
177
+ colorCode: e.shirt_color
178
+ }
179
+ ]
180
+ } : void 0,
181
+ providerRef: i(e.uuid)
182
+ };
183
+ }
184
+ function N(e) {
185
+ return {
186
+ kickoffTime: new Date(e.kickoff_time),
187
+ currentMinute: e.minute?.regular_time,
188
+ phaseStartedAt: e.phase_started_at ? new Date(e.phase_started_at) : void 0,
189
+ finishedAt: e.finished_at ? new Date(e.finished_at) : void 0,
190
+ firstHalfStartedAt: e.first_half_started_at ? new Date(e.first_half_started_at) : void 0,
191
+ secondHalfStartedAt: e.second_half_started_at ? new Date(e.second_half_started_at) : void 0,
192
+ extraTimeFirstHalfStartedAt: e.extra_time_first_half_started_at ? new Date(e.extra_time_first_half_started_at) : void 0,
193
+ extraTimeSecondHalfStartedAt: e.extra_time_second_half_started_at ? new Date(e.extra_time_second_half_started_at) : void 0
194
+ };
195
+ }
196
+ function x(e) {
197
+ if (!e) return;
198
+ const t = (n) => n ? { competitorOne: String(n.home), competitorTwo: String(n.away) } : void 0, o = e.after_extra_time ?? e.regular_time;
199
+ return {
200
+ competitorOne: o?.home != null ? String(o.home) : null,
201
+ competitorTwo: o?.away != null ? String(o.away) : null,
202
+ breakdown: {
203
+ total: t(e.total),
204
+ halfTime: t(e.half_time),
205
+ regularTime: t(e.regular_time),
206
+ extraTime: t(e.extra_time),
207
+ penaltyShootout: t(e.penalty_shootout),
208
+ aggregate: t(e.aggregate)
209
+ }
210
+ };
211
+ }
212
+ function P(e) {
213
+ if (e)
214
+ return {
215
+ id: e.id,
216
+ name: e.name,
217
+ slug: e.slug,
218
+ assets: e.assets?.image?.url ? { image: e.assets.image.url } : void 0,
219
+ providerRef: i(e.uuid)
220
+ };
221
+ }
222
+ function F(e) {
223
+ if (e?.length)
224
+ return e.map((t) => ({
225
+ id: t.id,
226
+ name: t.name,
227
+ slug: t.slug,
228
+ role: t.role ?? "REFEREE",
229
+ gender: t.gender
230
+ }));
231
+ }
232
+ function M(e) {
233
+ if (!e.season?.tournament) return;
234
+ const { tournament: t, ...o } = e.season;
235
+ return {
236
+ id: t.id,
237
+ name: t.name,
238
+ slug: t.slug,
239
+ type: t.type,
240
+ region: t.region,
241
+ country: t.country ? {
242
+ id: t.country.id,
243
+ name: t.country.name,
244
+ code: t.country.code ?? void 0,
245
+ flag: t.country.assets?.flag?.url,
246
+ providerRef: i(t.country.uuid)
247
+ } : void 0,
248
+ season: {
249
+ id: o.id,
250
+ name: o.name,
251
+ status: o.status
252
+ },
253
+ stage: e.stage ? {
254
+ id: e.stage.id,
255
+ name: e.stage.name,
256
+ type: e.stage.type
257
+ } : void 0,
258
+ assets: t.assets?.logo?.url ? { logo: t.assets.logo.url } : void 0,
259
+ providerRef: i(t.uuid)
260
+ };
261
+ }
262
+ function $(e) {
263
+ if (!e.winner?.match?.id) return;
264
+ const t = {
265
+ "Regular Time": "REGULAR_TIME",
266
+ "Extra Time": "EXTRA_TIME",
267
+ Penalties: "PENALTIES"
268
+ };
269
+ return {
270
+ competitorId: e.winner.match.id,
271
+ reason: e.winner.match.reason?.name ? t[e.winner.match.reason.name] : void 0,
272
+ aggregate: !!e.winner.aggregate
273
+ };
274
+ }
275
+ function E(e) {
276
+ return {
277
+ id: e.id,
278
+ slug: e.slug,
279
+ status: D(e.status),
280
+ timing: N(e),
281
+ competitorOne: T(e.home_team),
282
+ competitorTwo: T(e.away_team),
283
+ competition: M(e),
284
+ round: e.round ? {
285
+ id: e.round.id ?? e.round.key,
286
+ key: e.round.key,
287
+ name: e.round.name,
288
+ type: e.round.type ?? "REGULAR",
289
+ providerRef: i(e.round.uuid)
290
+ } : void 0,
291
+ group: e.group ? {
292
+ id: e.group.id,
293
+ name: e.group.name,
294
+ providerRef: i(e.group.uuid)
295
+ } : void 0,
296
+ venue: P(e.venue),
297
+ officials: F(e.referees),
298
+ spectators: e.spectators ?? void 0,
299
+ score: x(e.score),
300
+ mainEvents: e.main_events?.map(_).filter((t) => t !== null),
301
+ penaltyShootoutEvents: e.penalty_shootout_events?.map(_).filter((t) => t !== null),
302
+ winner: $(e),
303
+ coverage: e.coverage === "NOT_LIVE" ? "UNKNOWN" : e.coverage,
304
+ lineupStatus: e.lineup_status === "UNCONFIRMED" ? "EXPECTED" : e.lineup_status,
305
+ providerRef: i(e.uuid)
306
+ };
307
+ }
308
+ function H(e) {
309
+ const t = e.player;
310
+ return {
311
+ id: t.id,
312
+ name: t.name,
313
+ slug: t.slug,
314
+ position: t.position,
315
+ shirtNumber: e.shirt_number,
316
+ positionX: e.position_x ?? void 0,
317
+ positionY: e.position_y ?? void 0,
318
+ country: t.country ? {
319
+ id: t.country.id,
320
+ name: t.country.name,
321
+ code: t.country.code,
322
+ providerRef: i(t.country.uuid)
323
+ } : void 0,
324
+ birthdate: t.birthdate,
325
+ profile: t.profile ? {
326
+ height: t.profile.height,
327
+ weight: t.profile.weight
328
+ } : void 0,
329
+ assets: t.assets ? {
330
+ photo: t.assets.thumb?.url,
331
+ photoTransparent: t.assets.thumb_transparent_background?.url
332
+ } : void 0,
333
+ events: e.events?.map(_).filter((o) => o !== null),
334
+ providerRef: i(t.uuid)
335
+ };
336
+ }
337
+ function A(e) {
338
+ const t = [], o = [];
339
+ for (const n of e.players) {
340
+ const s = H(n);
341
+ n.type.category === "start" ? t.push(s) : n.type.category === "sub" && o.push(s);
342
+ }
343
+ return {
344
+ competitorId: e.team_id,
345
+ formation: e.formation,
346
+ coach: e.coach ? {
347
+ id: e.coach.id,
348
+ name: e.coach.name,
349
+ slug: e.coach.slug,
350
+ country: e.coach.country ? {
351
+ id: e.coach.country.id,
352
+ name: e.coach.country.name,
353
+ code: e.coach.country.code,
354
+ providerRef: i(e.coach.country.uuid)
355
+ } : void 0,
356
+ birthdate: e.coach.birthdate,
357
+ providerRef: i(e.coach.uuid)
358
+ } : void 0,
359
+ starters: t,
360
+ substitutes: o
361
+ };
362
+ }
363
+ function Y(e) {
364
+ return {
365
+ matchId: e.match_id,
366
+ confirmed: e.status === "CONFIRMED",
367
+ competitorOne: A(e.home_team),
368
+ competitorTwo: A(e.away_team)
369
+ };
370
+ }
371
+ function l(e, t, o, n) {
372
+ return t == null ? null : { key: e, value: String(t), label: o, unit: n };
373
+ }
374
+ function b(e, t) {
375
+ const o = (t.shots_on ?? 0) + (t.shots_off ?? 0) + (t.shots_blocked ?? 0), n = [
376
+ l("possession", t.possession, "Possession", "%"),
377
+ l("shots_total", o, "Shots"),
378
+ l("shots_on_target", t.shots_on, "Shots on Target"),
379
+ l("shots_off_target", t.shots_off, "Shots off Target"),
380
+ l("shots_blocked", t.shots_blocked, "Shots Blocked"),
381
+ l("corners", t.corners, "Corner Kicks"),
382
+ l("goal_kicks", t.goal_kicks, "Goal Kicks"),
383
+ l("throw_ins", t.throw_in, "Throw Ins"),
384
+ l("offsides", t.offside, "Offsides"),
385
+ l("fouls", t.fouls_committed, "Fouls"),
386
+ l("yellow_cards", t.yellow_cards, "Yellow Cards"),
387
+ l("passes", t.pass, "Passes"),
388
+ l("crosses", t.crosses, "Crosses")
389
+ ];
390
+ return {
391
+ competitorId: e,
392
+ statistics: n.filter((s) => s !== null)
393
+ };
394
+ }
395
+ function U(e) {
396
+ const t = e.find((n) => n.home_team), o = e.find((n) => !n.home_team);
397
+ if (!t || !o)
398
+ throw new Error("Missing competitor statistics");
399
+ return {
400
+ competitorOne: b(String(t.team.id), t.statistics),
401
+ competitorTwo: b(String(o.team.id), o.statistics)
402
+ };
403
+ }
404
+ function G(e) {
405
+ const t = e.urls?.find((o) => o.app_type === "desktop")?.url;
406
+ return {
407
+ id: e.id,
408
+ name: e.name,
409
+ code: e.code,
410
+ value: e.value ?? void 0,
411
+ odds: e.odds,
412
+ oddsOld: e.odds_old,
413
+ movement: e.movement === "STABLE" ? "NONE" : e.movement,
414
+ url: t
415
+ };
416
+ }
417
+ function W(e) {
418
+ return {
419
+ type: {
420
+ id: e.type.id,
421
+ code: e.type.code,
422
+ name: e.type.name
423
+ },
424
+ period: {
425
+ id: e.scope.id,
426
+ type: e.scope.type,
427
+ name: e.scope.name
428
+ },
429
+ selections: e.selections.map(G)
430
+ };
431
+ }
432
+ function K(e) {
433
+ if (!e) return !0;
434
+ const t = e.replace("#", ""), o = parseInt(t.substring(0, 2), 16), n = parseInt(t.substring(2, 4), 16), s = parseInt(t.substring(4, 6), 16);
435
+ return (0.2126 * o + 0.7152 * n + 0.0722 * s) / 255 < 0.5;
436
+ }
437
+ function V(e) {
438
+ const t = e.bookmaker.assets?.[0], o = e.bookmaker.branding || t, n = e.bookmaker.branding?.background_color || t?.background_color, s = e.bookmaker.branding?.text_color || (K(n) ? "#FFFFFF" : "#000000");
439
+ return {
440
+ operator: {
441
+ id: e.bookmaker.id,
442
+ name: e.bookmaker.name,
443
+ url: e.bookmaker.url,
444
+ branding: o ? {
445
+ backgroundColor: n,
446
+ textColor: s,
447
+ logo: t?.logo
448
+ } : void 0
449
+ },
450
+ type: e.type,
451
+ markets: e.markets.map(W)
452
+ };
453
+ }
454
+ function j(e, t) {
455
+ return {
456
+ matchId: e,
457
+ operators: t.map(V)
458
+ };
459
+ }
460
+ function I(e) {
461
+ if (e == null || e === "")
462
+ return;
463
+ const t = typeof e == "number" ? e : parseInt(e, 10);
464
+ return isNaN(t) ? void 0 : t;
465
+ }
466
+ function B(e) {
467
+ return {
468
+ externalId: e.external_id,
469
+ minute: I(e.elapsed),
470
+ addedTime: I(e.elapsed_plus),
471
+ text: e.auto_text,
472
+ details: e.details,
473
+ meta: {
474
+ type: e.type,
475
+ commentaryType: e.commentary_type,
476
+ subtype1: e.subtype_1,
477
+ subtype2: e.subtype_2,
478
+ timestamp: e.incident_timestamp
479
+ }
480
+ };
481
+ }
482
+ async function pe(e, t, o) {
483
+ const n = o || c(), { sportal365Sports: s } = n, a = await g.get({
484
+ path: `/v2/matches/${e}`,
485
+ params: {
486
+ language_code: t?.languageCode ?? s?.languageCode ?? "en",
487
+ odd_client: t?.oddClient,
488
+ odd_type: t?.oddType,
489
+ scope_type: t?.scopeType,
490
+ odd_format: t?.oddFormat,
491
+ market_types: t?.marketTypes,
492
+ bookmaker_ids: t?.bookmakerIds,
493
+ optional_data: t?.optionalData
494
+ },
495
+ headers: {
496
+ "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
497
+ },
498
+ next: t?.next,
499
+ config: n
500
+ });
501
+ return E(a);
502
+ }
503
+ async function fe(e, t, o) {
504
+ const n = o || c(), { sportal365Sports: s } = n;
505
+ return (await g.get({
506
+ path: `/v2/matches/${e}/events`,
507
+ params: {
508
+ language_code: t?.languageCode ?? s?.languageCode ?? "en"
509
+ },
510
+ headers: {
511
+ "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
512
+ },
513
+ next: t?.next,
514
+ config: n
515
+ })).events.map(_).filter((d) => d !== null);
516
+ }
517
+ async function _e(e, t, o) {
518
+ const n = o || c(), { sportal365Sports: s } = n, a = await g.get({
519
+ path: `/v2/matches/${e}/lineups`,
520
+ params: {
521
+ language_code: t?.languageCode ?? s?.languageCode ?? "en"
522
+ },
523
+ headers: {
524
+ "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
525
+ },
526
+ next: t?.next,
527
+ config: n
528
+ });
529
+ return Y(a);
530
+ }
531
+ async function ye(e, t, o) {
532
+ const n = o || c(), { sportal365Sports: s } = n, a = await g.get({
533
+ path: `/v2/matches/${e}`,
534
+ params: {
535
+ language_code: t?.languageCode ?? s?.languageCode ?? "en",
536
+ odd_client: t?.oddClient ?? s?.oddClient,
537
+ odd_type: t?.oddType,
538
+ scope_type: t?.scopeType ?? "ALL",
539
+ odd_format: t?.oddFormat ?? "DECIMAL",
540
+ market_types: t?.marketTypes,
541
+ bookmaker_ids: t?.bookmakerIds
542
+ },
543
+ headers: {
544
+ "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
545
+ },
546
+ next: t?.next,
547
+ config: n
548
+ });
549
+ return j(e, a.odds ?? []);
550
+ }
551
+ async function he(e, t, o) {
552
+ const n = o || c(), { sportal365Sports: s } = n, a = await g.get({
553
+ path: `/events/${e}/teamstats`,
554
+ params: {
555
+ language_code: t?.languageCode ?? s?.languageCode ?? "en"
556
+ },
557
+ headers: {
558
+ "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
559
+ },
560
+ next: t?.next,
561
+ config: n
562
+ });
563
+ return U(a);
564
+ }
565
+ async function ve(e, t, o) {
566
+ const n = o || c(), { sportal365Sports: s } = n;
567
+ return (await g.get({
568
+ path: `/matches/${e}/commentary`,
569
+ params: {
570
+ language_code: t?.languageCode ?? s?.languageCode ?? "en"
571
+ },
572
+ headers: {
573
+ "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
574
+ },
575
+ next: t?.next,
576
+ config: n
577
+ })).map(B);
578
+ }
579
+ async function Ce(e, t) {
580
+ const o = t || c(), { sportal365Sports: n } = o;
581
+ return (await g.get({
582
+ path: "/v2/matches",
583
+ params: {
584
+ language_code: e.languageCode ?? n?.languageCode ?? "en",
585
+ limit: e.limit.toString(),
586
+ offset: e.offset.toString(),
587
+ // Competition filters
588
+ tournament_ids: e.tournamentIds,
589
+ season_ids: e.seasonIds,
590
+ stage_ids: e.stageIds,
591
+ group_ids: e.groupIds,
592
+ round_ids: e.roundIds,
593
+ round_filter: e.roundFilter,
594
+ // Time filters
595
+ from_kickoff_time: e.fromKickoffTime,
596
+ to_kickoff_time: e.toKickoffTime,
597
+ // Entity filters
598
+ team_ids: e.teamIds,
599
+ team_ids_operator: e.teamIdsOperator,
600
+ referee_id: e.refereeId,
601
+ venue_id: e.venueId,
602
+ player_id: e.playerId,
603
+ // Status filters
604
+ status_types: e.statusTypes,
605
+ status_codes: e.statusCodes,
606
+ // Odds
607
+ odd_client: e.oddClient ?? n?.oddClient,
608
+ odd_type: e.oddType,
609
+ scope_type: e.scopeType,
610
+ odd_format: e.oddFormat,
611
+ market_types: e.marketTypes,
612
+ bookmaker_ids: e.bookmakerIds,
613
+ // Sorting and optional data
614
+ sort_direction: e.sortDirection,
615
+ optional_data: e.optionalData
616
+ },
617
+ headers: {
618
+ "Accept-Language": e.languageCode ?? n?.languageCode ?? "en"
619
+ },
620
+ next: e.next,
621
+ config: o
622
+ })).matches.map(E);
623
+ }
624
+ function q(e) {
625
+ return {
626
+ id: e.id,
627
+ name: e.name,
628
+ shortName: e.short_name ?? void 0,
629
+ threeLetterCode: e.three_letter_code,
630
+ slug: e.slug,
631
+ type: e.type === "placeholder" || e.type === "club" ? "club" : "national",
632
+ gender: e.gender,
633
+ country: e.country ? {
634
+ id: e.country.id,
635
+ name: e.country.name,
636
+ code: e.country.code ?? void 0,
637
+ flag: e.country.assets?.flag?.url,
638
+ providerRef: i(e.country.uuid)
639
+ } : void 0,
640
+ // Extended team profile data
641
+ venue: e.venue ? {
642
+ id: e.venue.id,
643
+ name: e.venue.name,
644
+ slug: e.venue.slug,
645
+ city: e.venue.city ? {
646
+ id: e.venue.city.id,
647
+ name: e.venue.city.name,
648
+ country: e.venue.city.country ? {
649
+ id: e.venue.city.country.id,
650
+ name: e.venue.city.country.name,
651
+ code: e.venue.city.country.code ?? void 0,
652
+ flag: e.venue.city.country.assets?.flag?.url,
653
+ providerRef: i(e.venue.city.country.uuid)
654
+ } : void 0,
655
+ providerRef: i(e.venue.city.uuid ?? void 0)
656
+ } : void 0,
657
+ country: e.venue.country ? {
658
+ id: e.venue.country.id,
659
+ name: e.venue.country.name,
660
+ code: e.venue.country.code ?? void 0,
661
+ flag: e.venue.country.assets?.flag?.url,
662
+ providerRef: i(e.venue.country.uuid)
663
+ } : void 0,
664
+ profile: e.venue.profile ? {
665
+ latitude: e.venue.profile.lat,
666
+ longitude: e.venue.profile.lng,
667
+ capacity: e.venue.profile.capacity
668
+ } : void 0,
669
+ assets: e.venue.assets?.image?.url ? {
670
+ image: e.venue.assets.image.url
671
+ } : void 0,
672
+ providerRef: i(e.venue.uuid)
673
+ } : void 0,
674
+ coach: e.coach ? {
675
+ id: e.coach.id,
676
+ name: e.coach.name,
677
+ slug: e.coach.slug,
678
+ country: {
679
+ id: e.coach.country.id,
680
+ name: e.coach.country.name,
681
+ code: e.coach.country.code ?? void 0,
682
+ flag: e.coach.country.assets?.flag?.url,
683
+ providerRef: i(e.coach.country.uuid)
684
+ },
685
+ birthdate: e.coach.birthdate,
686
+ providerRef: i(e.coach.uuid)
687
+ } : void 0,
688
+ founded: e.founded,
689
+ // Assets
690
+ assets: e.assets ? {
691
+ logo: e.assets.logo?.url,
692
+ homeKit: e.assets.home_kit?.url,
693
+ awayKit: e.assets.away_kit?.url,
694
+ squadImage: e.assets.squad_image?.url
695
+ } : void 0,
696
+ // Metadata
697
+ metadata: {
698
+ shirtColors: e.shirt_colors?.map((t) => ({
699
+ type: t.type,
700
+ colorCode: t.color_code
701
+ })),
702
+ socials: e.social ? {
703
+ website: e.social.web,
704
+ x: e.social.twitter_id,
705
+ facebook: e.social.facebook_id,
706
+ instagram: e.social.instagram_id,
707
+ wikipedia: e.social.wikipedia_id
708
+ } : void 0
709
+ },
710
+ // Seasons
711
+ activeSeasons: e.active_seasons?.map((t) => ({
712
+ id: t.id,
713
+ name: t.name,
714
+ slug: t.slug,
715
+ active: t.status === "ACTIVE",
716
+ providerRef: i(t.uuid)
717
+ })),
718
+ currentSeason: e.current_season ? {
719
+ id: e.current_season.id,
720
+ name: e.current_season.name,
721
+ slug: e.current_season.slug,
722
+ active: e.current_season.status === "ACTIVE",
723
+ providerRef: i(e.current_season.uuid)
724
+ } : void 0,
725
+ // Form - map to FUSportsCompetitorForm
726
+ form: e.form && e.form.length > 0 ? {
727
+ competitorId: e.id,
728
+ results: e.form.map((t) => {
729
+ const n = t.participants[0].id === e.uuid ? t.participants[1] : t.participants[0], s = t.result[0]?.results.find((u) => u.position === "1")?.value, a = t.result[0]?.results.find((u) => u.position === "2")?.value, d = t.outcome === "win" ? "W" : t.outcome === "draw" ? "D" : "L";
730
+ return {
731
+ matchId: t.id,
732
+ result: d,
733
+ score: s && a ? `${s}-${a}` : void 0,
734
+ opponent: {
735
+ id: n.id,
736
+ name: n.name,
737
+ logo: n.display_asset?.url
738
+ },
739
+ date: new Date(t.start_time),
740
+ competition: t.competition ? {
741
+ id: t.competition.id,
742
+ name: t.competition.name
743
+ } : void 0
744
+ };
745
+ }),
746
+ formString: e.form.map((t) => t.outcome === "win" ? "W" : t.outcome === "draw" ? "D" : "L").join("")
747
+ } : void 0,
748
+ providerRef: i(e.uuid)
749
+ };
750
+ }
751
+ function X(e) {
752
+ const t = e.player;
753
+ return {
754
+ id: t.id,
755
+ name: t.name,
756
+ slug: t.slug,
757
+ position: t.position,
758
+ shirtNumber: e.shirt_number,
759
+ country: t.country ? {
760
+ id: t.country.id,
761
+ name: t.country.name,
762
+ code: t.country.code ?? void 0,
763
+ flag: t.country.assets?.flag?.url,
764
+ providerRef: i(t.country.uuid)
765
+ } : void 0,
766
+ gender: t.gender,
767
+ birthdate: t.birthdate,
768
+ profile: {
769
+ height: t.profile?.height ?? void 0,
770
+ weight: t.profile?.weight ?? void 0
771
+ },
772
+ assets: t.assets ? {
773
+ photo: t.assets.thumb?.url,
774
+ photoTransparent: t.assets.thumb_transparent_background?.url
775
+ } : void 0,
776
+ status: e.status,
777
+ contractType: e.contract_type,
778
+ contractUntil: e.contract_until ?? void 0,
779
+ joinedDate: e.start_date ?? void 0,
780
+ providerRef: i(t.id)
781
+ // Using player.id as provider reference
782
+ };
783
+ }
784
+ function z(e) {
785
+ return {
786
+ id: e.id,
787
+ name: e.name,
788
+ slug: e.slug,
789
+ country: e.country ? {
790
+ id: e.country.id,
791
+ name: e.country.name,
792
+ code: e.country.code ?? void 0,
793
+ flag: e.country.assets?.flag?.url,
794
+ providerRef: i(e.country.uuid)
795
+ } : void 0,
796
+ birthdate: e.birthdate,
797
+ providerRef: i(e.uuid)
798
+ };
799
+ }
800
+ function J(e) {
801
+ return {
802
+ teamId: e.team.id,
803
+ teamName: e.team.name,
804
+ coach: e.coach ? z(e.coach) : void 0,
805
+ players: e.players.map(X)
806
+ };
807
+ }
808
+ function Q(e) {
809
+ const t = parseInt(e, 10);
810
+ return isNaN(t) ? void 0 : t;
811
+ }
812
+ function r(e, t) {
813
+ const o = e.find((n) => n.name === t);
814
+ return o ? Q(o.value) : void 0;
815
+ }
816
+ function Z(e, t) {
817
+ const o = e.statistics;
818
+ return {
819
+ playerId: e.player.id,
820
+ seasonId: e.season.id,
821
+ teamId: t,
822
+ // Core statistics
823
+ appearances: r(o, "played"),
824
+ started: r(o, "started"),
825
+ substituteIn: r(o, "substitute_in"),
826
+ substituteOut: r(o, "substitute_out"),
827
+ minutes: r(o, "minutes"),
828
+ minutesSubstitute: r(o, "minutes_substitute"),
829
+ // Scoring
830
+ goals: r(o, "goals"),
831
+ goalsSubstitute: r(o, "goals_substitute"),
832
+ penaltyGoals: r(o, "penalty_goals"),
833
+ ownGoals: r(o, "own_goals"),
834
+ assists: r(o, "assists"),
835
+ // Shooting
836
+ shots: r(o, "shots"),
837
+ shotsOnTarget: r(o, "shots_on_target"),
838
+ // Discipline
839
+ yellowCards: r(o, "yellow_cards"),
840
+ redCards: r(o, "red_cards"),
841
+ foulsCommitted: r(o, "fouls_committed"),
842
+ penaltiesCommitted: r(o, "penalties_committed"),
843
+ // Penalties
844
+ penaltiesMissed: r(o, "penalties_missed"),
845
+ // Defensive
846
+ cleansheets: r(o, "cleansheets"),
847
+ // Goalkeeper-specific
848
+ saves: r(o, "saves"),
849
+ conceded: r(o, "conceded"),
850
+ caughtBall: r(o, "caught_ball"),
851
+ penaltiesReceived: r(o, "penalties_received"),
852
+ // Other
853
+ offsides: r(o, "offsides"),
854
+ // Raw statistics array (for any additional stats not mapped above)
855
+ rawStatistics: o.map((n) => ({
856
+ name: n.name,
857
+ value: n.value
858
+ }))
859
+ };
860
+ }
861
+ async function w(e, t) {
862
+ const o = t || c(), { sportal365Sports: n } = o, { seasonIds: s, teamId: a, languageCode: d, next: u } = e, m = u ?? { revalidate: 120 }, p = {
863
+ season_ids: s.join(","),
864
+ team_id: a,
865
+ language_code: d ?? n?.languageCode ?? "en"
866
+ }, f = await g.get({
867
+ path: "/v2/statistics/players/season",
868
+ params: p,
869
+ headers: {
870
+ "Accept-Language": d ?? n?.languageCode ?? "en"
871
+ },
872
+ next: m,
873
+ config: o
874
+ }), v = {};
875
+ for (const C of f.statistics) {
876
+ const O = C.player.id;
877
+ v[O] = Z(C, a);
878
+ }
879
+ return v;
880
+ }
881
+ async function Se(e, t, o) {
882
+ const n = o || c(), { sportal365Sports: s } = n, a = await g.get({
883
+ path: `/v2/teams/${e}`,
884
+ params: {
885
+ language_code: t?.languageCode ?? s?.languageCode ?? "en",
886
+ optional_data: "form"
887
+ },
888
+ headers: {
889
+ "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
890
+ },
891
+ next: t?.next,
892
+ config: n
893
+ });
894
+ return q(a);
895
+ }
896
+ async function Te(e, t, o) {
897
+ const n = o || c(), { sportal365Sports: s } = n, a = await g.get({
898
+ path: `/v2/teams/${e}/squad`,
899
+ params: {
900
+ language_code: t?.languageCode ?? s?.languageCode ?? "en",
901
+ memberStatus: t?.memberStatus ?? "ACTIVE"
902
+ },
903
+ headers: {
904
+ "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
905
+ },
906
+ next: t?.next,
907
+ config: n
908
+ }), d = J(a);
909
+ if (t?.seasonIds && t.seasonIds.length > 0)
910
+ try {
911
+ const u = await w(
912
+ {
913
+ seasonIds: t.seasonIds,
914
+ teamId: e,
915
+ languageCode: t.languageCode,
916
+ next: t.next
917
+ },
918
+ n
919
+ );
920
+ for (const m of d.players) {
921
+ const p = u[m.id];
922
+ p && (m.seasonStatistics = p);
923
+ }
924
+ } catch {
925
+ }
926
+ return d;
927
+ }
928
+ function ee(e) {
929
+ return {
930
+ id: String(e.id),
931
+ name: e.name,
932
+ slug: e.slug,
933
+ type: e.type,
934
+ region: e.region,
935
+ gender: e.gender,
936
+ country: {
937
+ id: String(e.country.id),
938
+ name: e.country.name,
939
+ flag: e.country.url_flag,
940
+ providerRef: i(e.country.uuid)
941
+ },
942
+ seasons: e.seasons.map((t) => ({
943
+ id: String(t.id),
944
+ name: t.name,
945
+ slug: t.slug,
946
+ active: t.active,
947
+ providerRef: i(t.uuid)
948
+ })),
949
+ assets: e.url_logo ? {
950
+ logo: e.url_logo
951
+ } : void 0,
952
+ providerRef: i(e.uuid)
953
+ };
954
+ }
955
+ function te(e) {
956
+ const t = e.rounds.map((o) => ({
957
+ id: o.id,
958
+ name: o.name,
959
+ key: o.key,
960
+ type: o.type,
961
+ status: o.status,
962
+ startDate: o.start_date,
963
+ endDate: o.end_date,
964
+ providerRef: i(o.uuid)
965
+ }));
966
+ return {
967
+ id: e.stage.id,
968
+ name: e.stage.name,
969
+ slug: e.stage.slug,
970
+ shortName: e.stage.short_name ?? void 0,
971
+ type: e.stage.type,
972
+ status: e.stage.status,
973
+ coverage: e.stage.coverage,
974
+ order: e.stage.order_in_season,
975
+ startDate: e.stage.start_date,
976
+ endDate: e.stage.end_date,
977
+ rounds: t,
978
+ providerRef: i(e.stage.uuid)
979
+ };
980
+ }
981
+ function oe(e) {
982
+ const { season: t, stages: o } = e, { tournament: n } = t, s = {
983
+ id: n.id,
984
+ name: n.name,
985
+ slug: n.slug,
986
+ type: n.type,
987
+ region: n.region,
988
+ gender: n.gender,
989
+ country: {
990
+ id: n.country.id,
991
+ name: n.country.name,
992
+ code: n.country.code ?? void 0,
993
+ flag: n.country.assets?.flag?.url,
994
+ providerRef: i(n.country.uuid)
995
+ },
996
+ assets: n.assets?.logo?.url ? {
997
+ logo: n.assets.logo.url
998
+ } : void 0,
999
+ providerRef: i(n.uuid)
1000
+ };
1001
+ return {
1002
+ id: t.id,
1003
+ name: t.name,
1004
+ slug: t.slug,
1005
+ active: t.status === "ACTIVE",
1006
+ status: t.status === "ACTIVE" ? "ACTIVE" : "INACTIVE",
1007
+ competition: s,
1008
+ stages: o.map(te),
1009
+ providerRef: i(t.uuid)
1010
+ };
1011
+ }
1012
+ async function Ae(e, t, o) {
1013
+ const n = o || c(), { sportal365Sports: s } = n, a = await g.get({
1014
+ path: `/tournaments/${e}`,
1015
+ params: {
1016
+ language_code: t?.languageCode ?? s?.languageCode ?? "en"
1017
+ },
1018
+ headers: {
1019
+ "Accept-Language": t?.languageCode ?? s?.languageCode ?? "en"
1020
+ },
1021
+ next: t?.next,
1022
+ config: n
1023
+ });
1024
+ return ee(a);
1025
+ }
1026
+ async function be(e, t) {
1027
+ const o = t || c(), { sportal365Sports: n } = o;
1028
+ if (!e?.seasonId && !e?.competitionId)
1029
+ throw new Error("Either seasonId or competitionId must be provided");
1030
+ const s = {
1031
+ language_code: e?.languageCode ?? n?.languageCode ?? "en"
1032
+ };
1033
+ e.seasonId ? s.season_id = e.seasonId : e.competitionId && (s.tournament_id = e.competitionId, e.status && (s.status = e.status));
1034
+ const a = await g.get({
1035
+ path: "/v2/seasons/details",
1036
+ params: s,
1037
+ headers: {
1038
+ "Accept-Language": e?.languageCode ?? n?.languageCode ?? "en"
1039
+ },
1040
+ next: e?.next,
1041
+ config: o
1042
+ });
1043
+ return oe(a);
1044
+ }
1045
+ function h(e) {
1046
+ return {
1047
+ championsleague: "championsLeague",
1048
+ europaleague: "europaLeague",
1049
+ conferenceleague: "conferenceLeague",
1050
+ relegation: "relegation",
1051
+ playoff: "playoff",
1052
+ promotion: "promotion"
1053
+ }[e.toLowerCase()] ?? e.toLowerCase().replace(/_/g, "");
1054
+ }
1055
+ function ne(e) {
1056
+ const t = e.toLowerCase();
1057
+ return t === "relegation" ? "BOTTOM" : t === "playoff" ? "MIDDLE" : "TOP";
1058
+ }
1059
+ function se(e, t) {
1060
+ if (!t || t.length === 0)
1061
+ return;
1062
+ const o = t.map((s) => {
1063
+ const a = s.event, d = a.home_team.id === e, u = d ? a.away_team : a.home_team, m = `${a.goal_home}-${a.goal_away}`;
1064
+ return {
1065
+ matchId: a.id.toString(),
1066
+ result: s.outcome,
1067
+ score: m,
1068
+ homeAway: d ? "HOME" : "AWAY",
1069
+ opponent: {
1070
+ id: u.id.toString(),
1071
+ name: u.name,
1072
+ logo: u.url_logo
1073
+ },
1074
+ date: new Date(a.start_time),
1075
+ competition: void 0
1076
+ // Football API doesn't include competition in form
1077
+ };
1078
+ }), n = o.map((s) => s.result).join("");
1079
+ return {
1080
+ competitorId: e.toString(),
1081
+ results: o,
1082
+ formString: n
1083
+ };
1084
+ }
1085
+ function ae(e) {
1086
+ return {
1087
+ key: h(e.code),
1088
+ name: e.name,
1089
+ position: ne(e.type)
1090
+ };
1091
+ }
1092
+ function ie(e) {
1093
+ const t = {
1094
+ played: e.played,
1095
+ won: e.wins,
1096
+ drawn: e.draws,
1097
+ lost: e.defeits,
1098
+ goalsFor: e.goals_for,
1099
+ goalsAgainst: e.goals_against,
1100
+ goalDifference: e.goals_for - e.goals_against,
1101
+ points: e.points
1102
+ }, o = e.rules?.length > 0 ? e.rules.map((s) => h(s.code)) : void 0, n = se(e.team.id, e.team.form ?? []);
1103
+ return {
1104
+ rank: e.rank,
1105
+ competitor: {
1106
+ id: e.team.id.toString(),
1107
+ name: e.team.name,
1108
+ shortName: e.team.short_name ?? void 0,
1109
+ logo: e.team.url_logo
1110
+ },
1111
+ stats: t,
1112
+ form: n,
1113
+ rules: o
1114
+ };
1115
+ }
1116
+ function re(e) {
1117
+ const t = e.map(ie), o = /* @__PURE__ */ new Map();
1118
+ for (const n of e)
1119
+ if (n.rules)
1120
+ for (const s of n.rules) {
1121
+ const a = h(s.code);
1122
+ o.has(a) || o.set(a, ae(s));
1123
+ }
1124
+ return {
1125
+ entries: t,
1126
+ metadata: {
1127
+ legend: Array.from(o.values())
1128
+ }
1129
+ };
1130
+ }
1131
+ async function Ie(e, t) {
1132
+ const o = t || c(), { sportal365Sports: n } = o, s = e.expand?.join(","), a = await g.get({
1133
+ path: `/tournaments/seasons/stages/${e.stageId}/standing`,
1134
+ params: {
1135
+ expand: s,
1136
+ language_code: e.languageCode ?? n?.languageCode ?? "en"
1137
+ },
1138
+ headers: {
1139
+ "Accept-Language": e.languageCode ?? n?.languageCode ?? "en"
1140
+ },
1141
+ next: e.next,
1142
+ config: o
1143
+ });
1144
+ return !a || a.length === 0 ? { entries: [], metadata: { legend: [] } } : re(a);
1145
+ }
1146
+ export {
1147
+ le as S,
1148
+ ce as a,
1149
+ me as b,
1150
+ k as c,
1151
+ Ae as d,
1152
+ pe as e,
1153
+ g as f,
1154
+ c as g,
1155
+ ve as h,
1156
+ fe as i,
1157
+ _e as j,
1158
+ ye as k,
1159
+ he as l,
1160
+ Ce as m,
1161
+ w as n,
1162
+ be as o,
1163
+ Ie as p,
1164
+ Se as q,
1165
+ Te as r,
1166
+ ge as s,
1167
+ i as t,
1168
+ ue as u,
1169
+ de as v
1170
+ };