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.
- package/api/fansunited/constants.d.ts +5 -0
- package/api/fansunited/constants.d.ts.map +1 -0
- package/api/fansunited/football/competition/index.d.ts +30 -0
- package/api/fansunited/football/competition/index.d.ts.map +1 -0
- package/api/fansunited/football/competition/transformer.d.ts +11 -0
- package/api/fansunited/football/competition/transformer.d.ts.map +1 -0
- package/api/fansunited/football/competition/types.d.ts +70 -0
- package/api/fansunited/football/competition/types.d.ts.map +1 -0
- package/api/fansunited/football/competitions/index.d.ts +27 -0
- package/api/fansunited/football/competitions/index.d.ts.map +1 -0
- package/api/fansunited/football/competitions/transformer.d.ts +14 -0
- package/api/fansunited/football/competitions/transformer.d.ts.map +1 -0
- package/api/fansunited/football/competitions/types.d.ts +67 -0
- package/api/fansunited/football/competitions/types.d.ts.map +1 -0
- package/api/fansunited/football/http.d.ts +8 -0
- package/api/fansunited/football/http.d.ts.map +1 -0
- package/api/fansunited/football/index.d.ts +19 -0
- package/api/fansunited/football/index.d.ts.map +1 -0
- package/api/fansunited/football/matches/index.d.ts +61 -0
- package/api/fansunited/football/matches/index.d.ts.map +1 -0
- package/api/fansunited/football/matches/transformer.d.ts +28 -0
- package/api/fansunited/football/matches/transformer.d.ts.map +1 -0
- package/api/fansunited/football/matches/types.d.ts +328 -0
- package/api/fansunited/football/matches/types.d.ts.map +1 -0
- package/api/fansunited/football/players/index.d.ts +30 -0
- package/api/fansunited/football/players/index.d.ts.map +1 -0
- package/api/fansunited/football/players/transformer.d.ts +10 -0
- package/api/fansunited/football/players/transformer.d.ts.map +1 -0
- package/api/fansunited/football/players/types.d.ts +70 -0
- package/api/fansunited/football/players/types.d.ts.map +1 -0
- package/api/fansunited/football/search/index.d.ts +49 -0
- package/api/fansunited/football/search/index.d.ts.map +1 -0
- package/api/fansunited/football/search/transformer.d.ts +10 -0
- package/api/fansunited/football/search/transformer.d.ts.map +1 -0
- package/api/fansunited/football/search/types.d.ts +151 -0
- package/api/fansunited/football/search/types.d.ts.map +1 -0
- package/api/fansunited/football/teams/index.d.ts +30 -0
- package/api/fansunited/football/teams/index.d.ts.map +1 -0
- package/api/fansunited/football/teams/transformer.d.ts +10 -0
- package/api/fansunited/football/teams/transformer.d.ts.map +1 -0
- package/api/fansunited/football/teams/types.d.ts +87 -0
- package/api/fansunited/football/teams/types.d.ts.map +1 -0
- package/api/fansunited/http.d.ts +54 -0
- package/api/fansunited/http.d.ts.map +1 -0
- package/api/fansunited/index.d.ts +10 -0
- package/api/fansunited/index.d.ts.map +1 -0
- package/api/sportal365-sports/constants.d.ts +16 -0
- package/api/sportal365-sports/constants.d.ts.map +1 -0
- package/api/sportal365-sports/football/competitions/competition.types.d.ts +148 -0
- package/api/sportal365-sports/football/competitions/competition.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/competitions/index.d.ts +54 -0
- package/api/sportal365-sports/football/competitions/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/competitions/utils.d.ts +14 -0
- package/api/sportal365-sports/football/competitions/utils.d.ts.map +1 -0
- package/api/sportal365-sports/football/http.d.ts +8 -0
- package/api/sportal365-sports/football/http.d.ts.map +1 -0
- package/api/sportal365-sports/football/index.d.ts +19 -0
- package/api/sportal365-sports/football/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/index.d.ts +151 -0
- package/api/sportal365-sports/football/matches/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/commentary.d.ts +12 -0
- package/api/sportal365-sports/football/matches/transformers/commentary.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/index.d.ts +10 -0
- package/api/sportal365-sports/football/matches/transformers/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/lineup.d.ts +11 -0
- package/api/sportal365-sports/football/matches/transformers/lineup.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/match-event.d.ts +12 -0
- package/api/sportal365-sports/football/matches/transformers/match-event.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/match.d.ts +11 -0
- package/api/sportal365-sports/football/matches/transformers/match.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/odds.d.ts +11 -0
- package/api/sportal365-sports/football/matches/transformers/odds.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/statistics.d.ts +11 -0
- package/api/sportal365-sports/football/matches/transformers/statistics.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/commentary.types.d.ts +27 -0
- package/api/sportal365-sports/football/matches/types/commentary.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/event.types.d.ts +19 -0
- package/api/sportal365-sports/football/matches/types/event.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/index.d.ts +16 -0
- package/api/sportal365-sports/football/matches/types/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/lineup.types.d.ts +80 -0
- package/api/sportal365-sports/football/matches/types/lineup.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/match.types.d.ts +47 -0
- package/api/sportal365-sports/football/matches/types/match.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/minute.types.d.ts +8 -0
- package/api/sportal365-sports/football/matches/types/minute.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/odds.types.d.ts +80 -0
- package/api/sportal365-sports/football/matches/types/odds.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/option.types.d.ts +129 -0
- package/api/sportal365-sports/football/matches/types/option.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/referee.types.d.ts +13 -0
- package/api/sportal365-sports/football/matches/types/referee.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/statistics.types.d.ts +45 -0
- package/api/sportal365-sports/football/matches/types/statistics.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/status.types.d.ts +13 -0
- package/api/sportal365-sports/football/matches/types/status.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/team.types.d.ts +17 -0
- package/api/sportal365-sports/football/matches/types/team.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/matches/types/winner.types.d.ts +15 -0
- package/api/sportal365-sports/football/matches/types/winner.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/search/index.d.ts +45 -0
- package/api/sportal365-sports/football/search/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/search/search.transformer.d.ts +10 -0
- package/api/sportal365-sports/football/search/search.transformer.d.ts.map +1 -0
- package/api/sportal365-sports/football/search/search.types.d.ts +147 -0
- package/api/sportal365-sports/football/search/search.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/standings/index.d.ts +43 -0
- package/api/sportal365-sports/football/standings/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/standings/standing.transformer.d.ts +15 -0
- package/api/sportal365-sports/football/standings/standing.transformer.d.ts.map +1 -0
- package/api/sportal365-sports/football/standings/standing.types.d.ts +73 -0
- package/api/sportal365-sports/football/standings/standing.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/statistics/index.d.ts +42 -0
- package/api/sportal365-sports/football/statistics/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/statistics/player-season.transformer.d.ts +11 -0
- package/api/sportal365-sports/football/statistics/player-season.transformer.d.ts.map +1 -0
- package/api/sportal365-sports/football/statistics/player-season.types.d.ts +84 -0
- package/api/sportal365-sports/football/statistics/player-season.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/teams/index.d.ts +53 -0
- package/api/sportal365-sports/football/teams/index.d.ts.map +1 -0
- package/api/sportal365-sports/football/teams/squad.types.d.ts +63 -0
- package/api/sportal365-sports/football/teams/squad.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/teams/team.types.d.ts +58 -0
- package/api/sportal365-sports/football/teams/team.types.d.ts.map +1 -0
- package/api/sportal365-sports/football/teams/utils.d.ts +24 -0
- package/api/sportal365-sports/football/teams/utils.d.ts.map +1 -0
- package/api/sportal365-sports/http.d.ts +59 -0
- package/api/sportal365-sports/http.d.ts.map +1 -0
- package/api/sportal365-sports/index.d.ts +14 -0
- package/api/sportal365-sports/index.d.ts.map +1 -0
- package/api/sportal365-sports/search/http.d.ts +8 -0
- package/api/sportal365-sports/search/http.d.ts.map +1 -0
- package/api/sportal365-sports/search/index.d.ts +43 -0
- package/api/sportal365-sports/search/index.d.ts.map +1 -0
- package/api/sportal365-sports/search/search.transformer.d.ts +10 -0
- package/api/sportal365-sports/search/search.transformer.d.ts.map +1 -0
- package/api/sportal365-sports/search/search.types.d.ts +209 -0
- package/api/sportal365-sports/search/search.types.d.ts.map +1 -0
- package/api/sportal365-sports/shared/index.d.ts +6 -0
- package/api/sportal365-sports/shared/index.d.ts.map +1 -0
- package/api/sportal365-sports/shared/providerRef.helper.d.ts +79 -0
- package/api/sportal365-sports/shared/providerRef.helper.d.ts.map +1 -0
- package/api/sportal365-sports/shared/types.d.ts +189 -0
- package/api/sportal365-sports/shared/types.d.ts.map +1 -0
- package/api/sportal365-sports/statistics/http.d.ts +8 -0
- package/api/sportal365-sports/statistics/http.d.ts.map +1 -0
- package/api/sportal365-sports/statistics/index.d.ts +55 -0
- package/api/sportal365-sports/statistics/index.d.ts.map +1 -0
- package/api/sportal365-sports/statistics/team-stats.transformer.d.ts +14 -0
- package/api/sportal365-sports/statistics/team-stats.transformer.d.ts.map +1 -0
- package/api/sportal365-sports/statistics/team-stats.types.d.ts +45 -0
- package/api/sportal365-sports/statistics/team-stats.types.d.ts.map +1 -0
- package/client.cjs +8 -0
- package/client.d.ts +20 -0
- package/client.d.ts.map +1 -0
- package/client.js +12065 -0
- package/config/index.d.ts +31 -0
- package/config/index.d.ts.map +1 -0
- package/config/types.d.ts +36 -0
- package/config/types.d.ts.map +1 -0
- package/fansunited-data-layer.cjs +1 -0
- package/fansunited-data-layer.js +1739 -0
- package/helpers/competition.helpers.d.ts +22 -0
- package/helpers/competition.helpers.d.ts.map +1 -0
- package/helpers/index.d.ts +7 -0
- package/helpers/index.d.ts.map +1 -0
- package/helpers/team.helpers.d.ts +289 -0
- package/helpers/team.helpers.d.ts.map +1 -0
- package/index-Cogo-Kkd.cjs +1 -0
- package/index-D7T2Yy11.js +1170 -0
- package/index.d.ts +39 -0
- package/index.d.ts.map +1 -0
- package/package.json +12 -15
- package/providers/competition/hooks/index.d.ts +6 -0
- package/providers/competition/hooks/index.d.ts.map +1 -0
- package/providers/competition/hooks/useCompetitionStats.d.ts +8 -0
- package/providers/competition/hooks/useCompetitionStats.d.ts.map +1 -0
- package/providers/competition/hooks/useGoalDistribution.d.ts +11 -0
- package/providers/competition/hooks/useGoalDistribution.d.ts.map +1 -0
- package/providers/competition/hooks/useMatchHelpers.d.ts +16 -0
- package/providers/competition/hooks/useMatchHelpers.d.ts.map +1 -0
- package/providers/competition/hooks/useStandingsCalculations.d.ts +18 -0
- package/providers/competition/hooks/useStandingsCalculations.d.ts.map +1 -0
- package/providers/competition/hooks/useStandingsHelpers.d.ts +23 -0
- package/providers/competition/hooks/useStandingsHelpers.d.ts.map +1 -0
- package/providers/competition/hooks/useTeamPosition.d.ts +8 -0
- package/providers/competition/hooks/useTeamPosition.d.ts.map +1 -0
- package/providers/competition/hooks/useTeamResultsTable.d.ts +9 -0
- package/providers/competition/hooks/useTeamResultsTable.d.ts.map +1 -0
- package/providers/competition/utils/competitionStats.d.ts +42 -0
- package/providers/competition/utils/competitionStats.d.ts.map +1 -0
- package/providers/competition/utils/goalDistribution.d.ts +41 -0
- package/providers/competition/utils/goalDistribution.d.ts.map +1 -0
- package/providers/competition/utils/index.d.ts +6 -0
- package/providers/competition/utils/index.d.ts.map +1 -0
- package/providers/competition/utils/standingsCalculations.d.ts +24 -0
- package/providers/competition/utils/standingsCalculations.d.ts.map +1 -0
- package/providers/competition.context.d.ts +8 -0
- package/providers/competition.context.d.ts.map +1 -0
- package/providers/competition.provider.d.ts +3 -0
- package/providers/competition.provider.d.ts.map +1 -0
- package/providers/competition.types.d.ts +118 -0
- package/providers/competition.types.d.ts.map +1 -0
- package/providers/fansunited-config.context.d.ts +6 -0
- package/providers/fansunited-config.context.d.ts.map +1 -0
- package/providers/fansunited-config.hooks.d.ts +19 -0
- package/providers/fansunited-config.hooks.d.ts.map +1 -0
- package/providers/fansunited-config.provider.d.ts +44 -0
- package/providers/fansunited-config.provider.d.ts.map +1 -0
- package/providers/fansunited-config.types.d.ts +48 -0
- package/providers/fansunited-config.types.d.ts.map +1 -0
- package/providers/fansunited-sdk.hook.d.ts +40 -0
- package/providers/fansunited-sdk.hook.d.ts.map +1 -0
- package/providers/index.d.ts +20 -0
- package/providers/index.d.ts.map +1 -0
- package/providers/match/hooks/useEventHelpers.d.ts +12 -0
- package/providers/match/hooks/useEventHelpers.d.ts.map +1 -0
- package/providers/match/hooks/useHeadToHeadHelpers.d.ts +13 -0
- package/providers/match/hooks/useHeadToHeadHelpers.d.ts.map +1 -0
- package/providers/match/hooks/useLineupHelpers.d.ts +13 -0
- package/providers/match/hooks/useLineupHelpers.d.ts.map +1 -0
- package/providers/match/hooks/useMatchStandingsCalculations.d.ts +20 -0
- package/providers/match/hooks/useMatchStandingsCalculations.d.ts.map +1 -0
- package/providers/match/hooks/useMatchStatus.d.ts +12 -0
- package/providers/match/hooks/useMatchStatus.d.ts.map +1 -0
- package/providers/match/hooks/useOddsHelpers.d.ts +10 -0
- package/providers/match/hooks/useOddsHelpers.d.ts.map +1 -0
- package/providers/match/hooks/useScoreHelpers.d.ts +16 -0
- package/providers/match/hooks/useScoreHelpers.d.ts.map +1 -0
- package/providers/match/hooks/useStandingsHelpers.d.ts +22 -0
- package/providers/match/hooks/useStandingsHelpers.d.ts.map +1 -0
- package/providers/match/hooks/useStatisticsHelpers.d.ts +13 -0
- package/providers/match/hooks/useStatisticsHelpers.d.ts.map +1 -0
- package/providers/match/hooks/useTeamHelpers.d.ts +11 -0
- package/providers/match/hooks/useTeamHelpers.d.ts.map +1 -0
- package/providers/match/hooks/useTeamStatsHelpers.d.ts +12 -0
- package/providers/match/hooks/useTeamStatsHelpers.d.ts.map +1 -0
- package/providers/match.context.d.ts +8 -0
- package/providers/match.context.d.ts.map +1 -0
- package/providers/match.provider.d.ts +3 -0
- package/providers/match.provider.d.ts.map +1 -0
- package/providers/match.types.d.ts +151 -0
- package/providers/match.types.d.ts.map +1 -0
- package/providers/team/hooks/useFormStats.d.ts +49 -0
- package/providers/team/hooks/useFormStats.d.ts.map +1 -0
- package/providers/team/hooks/useMatchHelpers.d.ts +12 -0
- package/providers/team/hooks/useMatchHelpers.d.ts.map +1 -0
- package/providers/team/hooks/useSquadHelpers.d.ts +17 -0
- package/providers/team/hooks/useSquadHelpers.d.ts.map +1 -0
- package/providers/team.context.d.ts +8 -0
- package/providers/team.context.d.ts.map +1 -0
- package/providers/team.provider.d.ts +3 -0
- package/providers/team.provider.d.ts.map +1 -0
- package/providers/team.types.d.ts +68 -0
- package/providers/team.types.d.ts.map +1 -0
- package/types/canonical/base.types.d.ts +366 -0
- package/types/canonical/base.types.d.ts.map +1 -0
- package/types/canonical/commentary.types.d.ts +42 -0
- package/types/canonical/commentary.types.d.ts.map +1 -0
- package/types/canonical/event.types.d.ts +31 -0
- package/types/canonical/event.types.d.ts.map +1 -0
- package/types/canonical/index.d.ts +17 -0
- package/types/canonical/index.d.ts.map +1 -0
- package/types/canonical/lineup.types.d.ts +33 -0
- package/types/canonical/lineup.types.d.ts.map +1 -0
- package/types/canonical/match.types.d.ts +153 -0
- package/types/canonical/match.types.d.ts.map +1 -0
- package/types/canonical/odds.types.d.ts +73 -0
- package/types/canonical/odds.types.d.ts.map +1 -0
- package/types/canonical/search.types.d.ts +101 -0
- package/types/canonical/search.types.d.ts.map +1 -0
- package/types/canonical/sports-search.types.d.ts +151 -0
- package/types/canonical/sports-search.types.d.ts.map +1 -0
- package/types/canonical/squad.types.d.ts +30 -0
- package/types/canonical/squad.types.d.ts.map +1 -0
- package/types/canonical/standing.types.d.ts +85 -0
- package/types/canonical/standing.types.d.ts.map +1 -0
- package/types/canonical/statistics.types.d.ts +81 -0
- package/types/canonical/statistics.types.d.ts.map +1 -0
- package/types/index.d.ts +10 -0
- package/types/index.d.ts.map +1 -0
- package/utilities/stats/core/helpers.d.ts +65 -0
- package/utilities/stats/core/helpers.d.ts.map +1 -0
- package/utilities/stats/core/index.d.ts +7 -0
- package/utilities/stats/core/index.d.ts.map +1 -0
- package/utilities/stats/core/types.d.ts +39 -0
- package/utilities/stats/core/types.d.ts.map +1 -0
- package/utilities/stats/index.d.ts +27 -0
- package/utilities/stats/index.d.ts.map +1 -0
- package/utilities/stats/match/headToHead.d.ts +73 -0
- package/utilities/stats/match/headToHead.d.ts.map +1 -0
- package/utilities/stats/match/homeVsAway.d.ts +30 -0
- package/utilities/stats/match/homeVsAway.d.ts.map +1 -0
- package/utilities/stats/match/index.d.ts +8 -0
- package/utilities/stats/match/index.d.ts.map +1 -0
- package/utilities/stats/match/overUnder.d.ts +59 -0
- package/utilities/stats/match/overUnder.d.ts.map +1 -0
- package/utilities/stats/match/result.d.ts +13 -0
- package/utilities/stats/match/result.d.ts.map +1 -0
- package/utilities/stats/team/commonOpponents.d.ts +28 -0
- package/utilities/stats/team/commonOpponents.d.ts.map +1 -0
- package/utilities/stats/team/goalStats.d.ts +42 -0
- package/utilities/stats/team/goalStats.d.ts.map +1 -0
- package/utilities/stats/team/index.d.ts +7 -0
- package/utilities/stats/team/index.d.ts.map +1 -0
- package/utilities/stats/team/streaks.d.ts +48 -0
- package/utilities/stats/team/streaks.d.ts.map +1 -0
- package/vite.svg +1 -0
package/client.cjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),Z=require("./index-Cogo-Kkd.cjs");var et={exports:{}},Ge={};var ma;function bs(){if(ma)return Ge;ma=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(i,s,r){var n=null;if(r!==void 0&&(n=""+r),s.key!==void 0&&(n=""+s.key),"key"in s){r={};for(var o in s)o!=="key"&&(r[o]=s[o])}else r=s;return s=r.ref,{$$typeof:e,type:i,key:n,ref:s!==void 0?s:null,props:r}}return Ge.Fragment=t,Ge.jsx=a,Ge.jsxs=a,Ge}var $e={};var ga;function Ps(){return ga||(ga=1,process.env.NODE_ENV!=="production"&&(function(){function e(w){if(w==null)return null;if(typeof w=="function")return w.$$typeof===P?null:w.displayName||w.name||null;if(typeof w=="string")return w;switch(w){case b:return"Fragment";case A:return"Profiler";case I:return"StrictMode";case g:return"Suspense";case f:return"SuspenseList";case C:return"Activity"}if(typeof w=="object")switch(typeof w.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),w.$$typeof){case v:return"Portal";case $:return w.displayName||"Context";case F:return(w._context.displayName||"Context")+".Consumer";case D:var R=w.render;return w=w.displayName,w||(w=R.displayName||R.name||"",w=w!==""?"ForwardRef("+w+")":"ForwardRef"),w;case y:return R=w.displayName||null,R!==null?R:e(w.type)||"Memo";case T:R=w._payload,w=w._init;try{return e(w(R))}catch{}}return null}function t(w){return""+w}function a(w){try{t(w);var R=!1}catch{R=!0}if(R){R=console;var M=R.error,N=typeof Symbol=="function"&&Symbol.toStringTag&&w[Symbol.toStringTag]||w.constructor.name||"Object";return M.call(R,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",N),t(w)}}function i(w){if(w===b)return"<>";if(typeof w=="object"&&w!==null&&w.$$typeof===T)return"<...>";try{var R=e(w);return R?"<"+R+">":"<...>"}catch{return"<...>"}}function s(){var w=k.A;return w===null?null:w.getOwner()}function r(){return Error("react-stack-top-frame")}function n(w){if(U.call(w,"key")){var R=Object.getOwnPropertyDescriptor(w,"key").get;if(R&&R.isReactWarning)return!1}return w.key!==void 0}function o(w,R){function M(){re||(re=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",R))}M.isReactWarning=!0,Object.defineProperty(w,"key",{get:M,configurable:!0})}function l(){var w=e(this.type);return ae[w]||(ae[w]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),w=this.props.ref,w!==void 0?w:null}function c(w,R,M,N,ne,ve){var G=M.ref;return w={$$typeof:_,type:w,key:R,props:M,_owner:N},(G!==void 0?G:null)!==null?Object.defineProperty(w,"ref",{enumerable:!1,get:l}):Object.defineProperty(w,"ref",{enumerable:!1,value:null}),w._store={},Object.defineProperty(w._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(w,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(w,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ne}),Object.defineProperty(w,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ve}),Object.freeze&&(Object.freeze(w.props),Object.freeze(w)),w}function d(w,R,M,N,ne,ve){var G=R.children;if(G!==void 0)if(N)if(q(G)){for(N=0;N<G.length;N++)p(G[N]);Object.freeze&&Object.freeze(G)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else p(G);if(U.call(R,"key")){G=e(w);var K=Object.keys(R).filter(function(Ne){return Ne!=="key"});N=0<K.length?"{key: someKey, "+K.join(": ..., ")+": ...}":"{key: someKey}",J[G+N]||(K=0<K.length?"{"+K.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
|
+
let props = %s;
|
|
3
|
+
<%s {...props} />
|
|
4
|
+
React keys must be passed directly to JSX without using spread:
|
|
5
|
+
let props = %s;
|
|
6
|
+
<%s key={someKey} {...props} />`,N,G,K,G),J[G+N]=!0)}if(G=null,M!==void 0&&(a(M),G=""+M),n(R)&&(a(R.key),G=""+R.key),"key"in R){M={};for(var Se in R)Se!=="key"&&(M[Se]=R[Se])}else M=R;return G&&o(M,typeof w=="function"?w.displayName||w.name||"Unknown":w),c(w,G,M,s(),ne,ve)}function p(w){m(w)?w._store&&(w._store.validated=1):typeof w=="object"&&w!==null&&w.$$typeof===T&&(w._payload.status==="fulfilled"?m(w._payload.value)&&w._payload.value._store&&(w._payload.value._store.validated=1):w._store&&(w._store.validated=1))}function m(w){return typeof w=="object"&&w!==null&&w.$$typeof===_}var u=h,_=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),F=Symbol.for("react.consumer"),$=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),C=Symbol.for("react.activity"),P=Symbol.for("react.client.reference"),k=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=Object.prototype.hasOwnProperty,q=Array.isArray,z=console.createTask?console.createTask:function(){return null};u={react_stack_bottom_frame:function(w){return w()}};var re,ae={},Y=u.react_stack_bottom_frame.bind(u,r)(),X=z(i(r)),J={};$e.Fragment=b,$e.jsx=function(w,R,M){var N=1e4>k.recentlyCreatedOwnerStacks++;return d(w,R,M,!1,N?Error("react-stack-top-frame"):Y,N?z(i(w)):X)},$e.jsxs=function(w,R,M){var N=1e4>k.recentlyCreatedOwnerStacks++;return d(w,R,M,!0,N?Error("react-stack-top-frame"):Y,N?z(i(w)):X)}})()),$e}var fa;function Es(){return fa||(fa=1,process.env.NODE_ENV==="production"?et.exports=bs():et.exports=Ps()),et.exports}var ft=Es();const Ba=h.createContext(null);function Rs({config:e,children:t}){return ft.jsx(Ba.Provider,{value:e,children:t})}function zt(){const e=h.useContext(Ba);if(!e)throw new Error("useFansUnitedConfig must be used within FansUnitedConfigProvider. Wrap your app with <FansUnitedConfigProvider config={...}>");return e}function yt(){return zt().dataLayer}var Ss=Object.create,wt=Object.defineProperty,Cs=Object.getOwnPropertyDescriptor,Ms=Object.getOwnPropertyNames,Os=Object.getPrototypeOf,Fs=Object.prototype.hasOwnProperty,As=(e,t,a)=>t in e?wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,ks=(e,t)=>()=>(e&&(t=e(e=0)),t),je=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ds=(e,t)=>{for(var a in t)wt(e,a,{get:t[a],enumerable:!0})},Ls=(e,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ms(t))!Fs.call(e,s)&&s!==a&&wt(e,s,{get:()=>t[s],enumerable:!(i=Cs(t,s))||i.enumerable});return e},xs=(e,t,a)=>(a=e!=null?Ss(Os(e)):{},Ls(!e||!e.__esModule?wt(a,"default",{value:e,enumerable:!0}):a,e)),de=(e,t,a)=>(As(e,typeof t!="symbol"?t+"":t,a),a),Ha={};Ds(Ha,{default:()=>Va});var ya,Va,Ns=ks(()=>{ya={getItem:async()=>null,setItem:async()=>null,removeItem:async()=>null,clear:async()=>null,getAllKeys:async()=>[],multiGet:async()=>[],multiSet:async()=>null,multiRemove:async()=>null,mergeItem:async()=>null,multiMerge:async()=>null},Va=ya}),Gs=je((e,t)=>{var a=(function(){function i(u,_){return _!=null&&u instanceof _}var s;try{s=Map}catch{s=function(){}}var r;try{r=Set}catch{r=function(){}}var n;try{n=Promise}catch{n=function(){}}function o(u,_,v,b,I){typeof _=="object"&&(v=_.depth,b=_.prototype,I=_.includeNonEnumerable,_=_.circular);var A=[],F=[],$=typeof Buffer<"u";typeof _>"u"&&(_=!0),typeof v>"u"&&(v=1/0);function D(g,f){if(g===null)return null;if(f===0)return g;var y,T;if(typeof g!="object")return g;if(i(g,s))y=new s;else if(i(g,r))y=new r;else if(i(g,n))y=new n(function(Y,X){g.then(function(J){Y(D(J,f-1))},function(J){X(D(J,f-1))})});else if(o.__isArray(g))y=[];else if(o.__isRegExp(g))y=new RegExp(g.source,m(g)),g.lastIndex&&(y.lastIndex=g.lastIndex);else if(o.__isDate(g))y=new Date(g.getTime());else{if($&&Buffer.isBuffer(g))return Buffer.allocUnsafe?y=Buffer.allocUnsafe(g.length):y=new Buffer(g.length),g.copy(y),y;i(g,Error)?y=Object.create(g):typeof b>"u"?(T=Object.getPrototypeOf(g),y=Object.create(T)):(y=Object.create(b),T=b)}if(_){var C=A.indexOf(g);if(C!=-1)return F[C];A.push(g),F.push(y)}i(g,s)&&g.forEach(function(Y,X){var J=D(X,f-1),w=D(Y,f-1);y.set(J,w)}),i(g,r)&&g.forEach(function(Y){var X=D(Y,f-1);y.add(X)});for(var P in g){var k;T&&(k=Object.getOwnPropertyDescriptor(T,P)),!(k&&k.set==null)&&(y[P]=D(g[P],f-1))}if(Object.getOwnPropertySymbols)for(var U=Object.getOwnPropertySymbols(g),P=0;P<U.length;P++){var q=U[P],z=Object.getOwnPropertyDescriptor(g,q);z&&!z.enumerable&&!I||(y[q]=D(g[q],f-1),z.enumerable||Object.defineProperty(y,q,{enumerable:!1}))}if(I)for(var re=Object.getOwnPropertyNames(g),P=0;P<re.length;P++){var ae=re[P],z=Object.getOwnPropertyDescriptor(g,ae);z&&z.enumerable||(y[ae]=D(g[ae],f-1),Object.defineProperty(y,ae,{enumerable:!1}))}return y}return D(u,v)}o.clonePrototype=function(u){if(u===null)return null;var _=function(){};return _.prototype=u,new _};function l(u){return Object.prototype.toString.call(u)}o.__objToStr=l;function c(u){return typeof u=="object"&&l(u)==="[object Date]"}o.__isDate=c;function d(u){return typeof u=="object"&&l(u)==="[object Array]"}o.__isArray=d;function p(u){return typeof u=="object"&&l(u)==="[object RegExp]"}o.__isRegExp=p;function m(u){var _="";return u.global&&(_+="g"),u.ignoreCase&&(_+="i"),u.multiline&&(_+="m"),_}return o.__getRegExpFlags=m,o})();typeof t=="object"&&t.exports&&(t.exports=a)}),$s=je((e,t)=>{var a=typeof Reflect=="object"?Reflect:null,i=a&&typeof a.apply=="function"?a.apply:function(g,f,y){return Function.prototype.apply.call(g,f,y)},s;a&&typeof a.ownKeys=="function"?s=a.ownKeys:Object.getOwnPropertySymbols?s=function(g){return Object.getOwnPropertyNames(g).concat(Object.getOwnPropertySymbols(g))}:s=function(g){return Object.getOwnPropertyNames(g)};function r(g){console&&console.warn&&console.warn(g)}var n=Number.isNaN||function(g){return g!==g};function o(){o.init.call(this)}t.exports=o,t.exports.once=F,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var l=10;function c(g){if(typeof g!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof g)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(g){if(typeof g!="number"||g<0||n(g))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+g+".");l=g}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(g){if(typeof g!="number"||g<0||n(g))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+g+".");return this._maxListeners=g,this};function d(g){return g._maxListeners===void 0?o.defaultMaxListeners:g._maxListeners}o.prototype.getMaxListeners=function(){return d(this)},o.prototype.emit=function(g){for(var f=[],y=1;y<arguments.length;y++)f.push(arguments[y]);var T=g==="error",C=this._events;if(C!==void 0)T=T&&C.error===void 0;else if(!T)return!1;if(T){var P;if(f.length>0&&(P=f[0]),P instanceof Error)throw P;var k=new Error("Unhandled error."+(P?" ("+P.message+")":""));throw k.context=P,k}var U=C[g];if(U===void 0)return!1;if(typeof U=="function")i(U,this,f);else for(var q=U.length,z=b(U,q),y=0;y<q;++y)i(z[y],this,f);return!0};function p(g,f,y,T){var C,P,k;if(c(y),P=g._events,P===void 0?(P=g._events=Object.create(null),g._eventsCount=0):(P.newListener!==void 0&&(g.emit("newListener",f,y.listener?y.listener:y),P=g._events),k=P[f]),k===void 0)k=P[f]=y,++g._eventsCount;else if(typeof k=="function"?k=P[f]=T?[y,k]:[k,y]:T?k.unshift(y):k.push(y),C=d(g),C>0&&k.length>C&&!k.warned){k.warned=!0;var U=new Error("Possible EventEmitter memory leak detected. "+k.length+" "+String(f)+" listeners added. Use emitter.setMaxListeners() to increase limit");U.name="MaxListenersExceededWarning",U.emitter=g,U.type=f,U.count=k.length,r(U)}return g}o.prototype.addListener=function(g,f){return p(this,g,f,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(g,f){return p(this,g,f,!0)};function m(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(g,f,y){var T={fired:!1,wrapFn:void 0,target:g,type:f,listener:y},C=m.bind(T);return C.listener=y,T.wrapFn=C,C}o.prototype.once=function(g,f){return c(f),this.on(g,u(this,g,f)),this},o.prototype.prependOnceListener=function(g,f){return c(f),this.prependListener(g,u(this,g,f)),this},o.prototype.removeListener=function(g,f){var y,T,C,P,k;if(c(f),T=this._events,T===void 0)return this;if(y=T[g],y===void 0)return this;if(y===f||y.listener===f)--this._eventsCount===0?this._events=Object.create(null):(delete T[g],T.removeListener&&this.emit("removeListener",g,y.listener||f));else if(typeof y!="function"){for(C=-1,P=y.length-1;P>=0;P--)if(y[P]===f||y[P].listener===f){k=y[P].listener,C=P;break}if(C<0)return this;C===0?y.shift():I(y,C),y.length===1&&(T[g]=y[0]),T.removeListener!==void 0&&this.emit("removeListener",g,k||f)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(g){var f,y,T;if(y=this._events,y===void 0)return this;if(y.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):y[g]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete y[g]),this;if(arguments.length===0){var C=Object.keys(y),P;for(T=0;T<C.length;++T)P=C[T],P!=="removeListener"&&this.removeAllListeners(P);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(f=y[g],typeof f=="function")this.removeListener(g,f);else if(f!==void 0)for(T=f.length-1;T>=0;T--)this.removeListener(g,f[T]);return this};function _(g,f,y){var T=g._events;if(T===void 0)return[];var C=T[f];return C===void 0?[]:typeof C=="function"?y?[C.listener||C]:[C]:y?A(C):b(C,C.length)}o.prototype.listeners=function(g){return _(this,g,!0)},o.prototype.rawListeners=function(g){return _(this,g,!1)},o.listenerCount=function(g,f){return typeof g.listenerCount=="function"?g.listenerCount(f):v.call(g,f)},o.prototype.listenerCount=v;function v(g){var f=this._events;if(f!==void 0){var y=f[g];if(typeof y=="function")return 1;if(y!==void 0)return y.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?s(this._events):[]};function b(g,f){for(var y=new Array(f),T=0;T<f;++T)y[T]=g[T];return y}function I(g,f){for(;f+1<g.length;f++)g[f]=g[f+1];g.pop()}function A(g){for(var f=new Array(g.length),y=0;y<f.length;++y)f[y]=g[y].listener||g[y];return f}function F(g,f){return new Promise(function(y,T){function C(k){g.removeListener(f,P),T(k)}function P(){typeof g.removeListener=="function"&&g.removeListener("error",C),y([].slice.call(arguments))}D(g,f,P,{once:!0}),f!=="error"&&$(g,C,{once:!0})})}function $(g,f,y){typeof g.on=="function"&&D(g,"error",f,y)}function D(g,f,y,T){if(typeof g.on=="function")T.once?g.once(f,y):g.on(f,y);else if(typeof g.addEventListener=="function")g.addEventListener(f,function C(P){T.once&&g.removeEventListener(f,C),y(P)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof g)}}),Us=je((e,t)=>{(function(){var a,i,s=[].splice,r=function(o,l){if(!(o instanceof l))throw new Error("Bound instance method accessed before binding")},n=[].indexOf;i=Gs(),a=$s().EventEmitter,t.exports=(function(){class o extends a{constructor(c={}){super(),this.get=this.get.bind(this),this.mget=this.mget.bind(this),this.set=this.set.bind(this),this.mset=this.mset.bind(this),this.del=this.del.bind(this),this.take=this.take.bind(this),this.ttl=this.ttl.bind(this),this.getTtl=this.getTtl.bind(this),this.keys=this.keys.bind(this),this.has=this.has.bind(this),this.getStats=this.getStats.bind(this),this.flushAll=this.flushAll.bind(this),this.flushStats=this.flushStats.bind(this),this.close=this.close.bind(this),this._checkData=this._checkData.bind(this),this._check=this._check.bind(this),this._isInvalidKey=this._isInvalidKey.bind(this),this._wrap=this._wrap.bind(this),this._getValLength=this._getValLength.bind(this),this._error=this._error.bind(this),this._initErrors=this._initErrors.bind(this),this.options=c,this._initErrors(),this.data={},this.options=Object.assign({forceString:!1,objectValueSize:80,promiseValueSize:80,arrayValueSize:40,stdTTL:0,checkperiod:600,useClones:!0,deleteOnExpire:!0,enableLegacyCallbacks:!1,maxKeys:-1},this.options),this.options.enableLegacyCallbacks&&(console.warn("WARNING! node-cache legacy callback support will drop in v6.x"),["get","mget","set","del","ttl","getTtl","keys","has"].forEach(d=>{var p;p=this[d],this[d]=function(...m){var u,_,v,b;if(v=m,[...m]=v,[u]=s.call(m,-1),typeof u=="function")try{b=p(...m),u(null,b)}catch(I){_=I,u(_)}else return p(...m,u)}})),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.validKeyTypes=["string","number"],this._checkData()}get(c){var d,p;if(r(this,o),(p=this._isInvalidKey(c))!=null)throw p;if(this.data[c]!=null&&this._check(c,this.data[c]))return this.stats.hits++,d=this._unwrap(this.data[c]),d;this.stats.misses++}mget(c){var d,p,m,u,_,v;if(r(this,o),!Array.isArray(c))throw d=this._error("EKEYSTYPE"),d;for(v={},m=0,_=c.length;m<_;m++){if(u=c[m],(p=this._isInvalidKey(u))!=null)throw p;this.data[u]!=null&&this._check(u,this.data[u])?(this.stats.hits++,v[u]=this._unwrap(this.data[u])):this.stats.misses++}return v}set(c,d,p){var m,u,_;if(r(this,o),this.options.maxKeys>-1&&this.stats.keys>=this.options.maxKeys)throw m=this._error("ECACHEFULL"),m;if(this.options.forceString,p==null&&(p=this.options.stdTTL),(u=this._isInvalidKey(c))!=null)throw u;return _=!1,this.data[c]&&(_=!0,this.stats.vsize-=this._getValLength(this._unwrap(this.data[c],!1))),this.data[c]=this._wrap(d,p),this.stats.vsize+=this._getValLength(d),_||(this.stats.ksize+=this._getKeyLength(c),this.stats.keys++),this.emit("set",c,d),!0}mset(c){var d,p,m,u,_,v,b,I,A,F;if(r(this,o),this.options.maxKeys>-1&&this.stats.keys+c.length>=this.options.maxKeys)throw d=this._error("ECACHEFULL"),d;for(m=0,b=c.length;m<b;m++){if(v=c[m],{key:_,val:F,ttl:A}=v,A&&typeof A!="number")throw d=this._error("ETTLTYPE"),d;if((p=this._isInvalidKey(_))!=null)throw p}for(u=0,I=c.length;u<I;u++)v=c[u],{key:_,val:F,ttl:A}=v,this.set(_,F,A);return!0}del(c){var d,p,m,u,_,v;for(r(this,o),Array.isArray(c)||(c=[c]),d=0,m=0,_=c.length;m<_;m++){if(u=c[m],(p=this._isInvalidKey(u))!=null)throw p;this.data[u]!=null&&(this.stats.vsize-=this._getValLength(this._unwrap(this.data[u],!1)),this.stats.ksize-=this._getKeyLength(u),this.stats.keys--,d++,v=this.data[u],delete this.data[u],this.emit("del",u,v.v))}return d}take(c){var d;return r(this,o),d=this.get(c),d!=null&&this.del(c),d}ttl(c,d){var p;if(r(this,o),d||(d=this.options.stdTTL),!c)return!1;if((p=this._isInvalidKey(c))!=null)throw p;return this.data[c]!=null&&this._check(c,this.data[c])?(d>=0?this.data[c]=this._wrap(this.data[c].v,d,!1):this.del(c),!0):!1}getTtl(c){var d,p;if(r(this,o),!!c){if((p=this._isInvalidKey(c))!=null)throw p;if(this.data[c]!=null&&this._check(c,this.data[c]))return d=this.data[c].t,d}}keys(){var c;return r(this,o),c=Object.keys(this.data),c}has(c){var d;return r(this,o),d=this.data[c]!=null&&this._check(c,this.data[c]),d}getStats(){return r(this,o),this.stats}flushAll(c=!0){r(this,o),this.data={},this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this._killCheckPeriod(),this._checkData(c),this.emit("flush")}flushStats(){r(this,o),this.stats={hits:0,misses:0,keys:0,ksize:0,vsize:0},this.emit("flush_stats")}close(){r(this,o),this._killCheckPeriod()}_checkData(c=!0){var d,p,m;r(this,o),p=this.data;for(d in p)m=p[d],this._check(d,m);c&&this.options.checkperiod>0&&(this.checkTimeout=setTimeout(this._checkData,this.options.checkperiod*1e3,c),this.checkTimeout!=null&&this.checkTimeout.unref!=null&&this.checkTimeout.unref())}_killCheckPeriod(){if(this.checkTimeout!=null)return clearTimeout(this.checkTimeout)}_check(c,d){var p;return r(this,o),p=!0,d.t!==0&&d.t<Date.now()&&(this.options.deleteOnExpire&&(p=!1,this.del(c)),this.emit("expired",c,this._unwrap(d))),p}_isInvalidKey(c){var d;if(r(this,o),d=typeof c,n.call(this.validKeyTypes,d)<0)return this._error("EKEYTYPE",{type:typeof c})}_wrap(c,d,p=!0){var m,u,_;return r(this,o),this.options.useClones||(p=!1),u=Date.now(),m=0,_=1e3,d===0?m=0:d?m=u+d*_:this.options.stdTTL===0?m=this.options.stdTTL:m=u+this.options.stdTTL*_,{t:m,v:p?i(c):c}}_unwrap(c,d=!0){return this.options.useClones||(d=!1),c.v!=null?d?i(c.v):c.v:null}_getKeyLength(c){return c.toString().length}_getValLength(c){return r(this,o),typeof c=="string"?c.length:this.options.forceString?JSON.stringify(c).length:Array.isArray(c)?this.options.arrayValueSize*c.length:typeof c=="number"?8:typeof c?.then=="function"?this.options.promiseValueSize:typeof Buffer<"u"&&Buffer!==null&&Buffer.isBuffer(c)?c.length:c!=null&&typeof c=="object"?this.options.objectValueSize*Object.keys(c).length:typeof c=="boolean"?8:0}_error(c,d={}){var p;return r(this,o),p=new Error,p.name=c,p.errorcode=c,p.message=this.ERRORS[c]!=null?this.ERRORS[c](d):"-",p.data=d,p}_initErrors(){var c,d,p;r(this,o),this.ERRORS={},p=this._ERRORS;for(d in p)c=p[d],this.ERRORS[d]=this.createErrorMessage(c)}createErrorMessage(c){return function(d){return c.replace("__key",d.type)}}}return o.prototype._ERRORS={ENOTFOUND:"Key `__key` not found",ECACHEFULL:"Cache max keys amount exceeded",EKEYTYPE:"The key argument has to be of type `string` or `number`. Found: `__key`",EKEYSTYPE:"The keys argument has to be an array.",ETTLTYPE:"The ttl argument has to be a number."},o}).call(this)}).call(e)}),Bs=je((e,t)=>{(function(){var a;a=t.exports=Us(),a.version="5.1.2"}).call(e)}),Hs=je((e,t)=>{t.exports={name:"fansunited-sdk-esm",version:"1.122.0",description:"Javascript SDK implemented as a standard module system",author:"fansunited",license:"ISC",homepage:"https://fansunitedmedia.com/",type:"module",exports:{".":{import:"./index.js",types:"./types/index.d.ts"},"./Core/*":{import:"./Core/*.js",types:"./types/Core/*.d.ts"}},typesVersions:{"*":{"*":["./types/*"],"Core/*":["./types/Core/*"]}},files:["*.js","*.d.ts","types/**/*.d.ts","types/Core/**/*.js","types/Core/**/*.d.ts"],sideEffects:!1}}),Wa=(e=>(e.EN="en",e.BG="bg",e.RO="ro",e.EL="el",e.SK="sk",e.PT="pt",e.SR="sr",e.HU="hu",e.SV="sv",e.ES="es",e.FR="fr",e.NL="nl",e.DE="de",e.IT="it",e.AR="ar",e))(Wa||{}),Vs=class{validate=e=>{let t=this.validateField(e.lang),a=this.generateMessage(t);return{validation:t,message:a}};validateField=e=>{let t=Object.values(Wa),a=null;return e!=null&&e.length>0?t.includes(e)?a="valid":a="invalid":a="missing",a};generateMessage=e=>{let t=null,a="warning";return e==="missing"&&(t="If no lang is passed the default one will be set which is: en"),e==="invalid"&&(t="This lang value is not supported, the default one will be set which is: en"),e==="valid"&&(t=null,a=null),{text:t,type:a}}},za=(e=>(e.DEV="dev",e.PROD="prod",e.STAGING="staging",e))(za||{}),Ws=class{validate(e){let t=this.validateField(e.environment),a=this.generateMessage(t);return{validation:t,message:a}}validateField=e=>{let t=Object.values(za),a=null;return e!=null&&e.length>0?t.includes(e)?a="valid":a="invalid":a="missing",a};generateMessage=e=>{let t=null,a="warning";return e==="missing"&&(t="If no environment is passed the default one will be set which is: prod"),e==="invalid"&&(t="This environment value is not supported, the default one will be set which is: prod"),e==="valid"&&(t=null,a=null),{text:t,type:a}}},zs=class{validate(e){let t=this.validateField(e.apiKey),a=this.generateMessage(t);return{validation:t,message:a}}validateField=e=>{let t=null;return e!=null&&e.length>0?t="valid":t="missing",t};generateMessage=e=>{let t=null,a="error";return e==="missing"&&(t="The field apiKey with valid value must be provided to use Fans United JS SDK"),e==="valid"&&(a=null),{text:t,type:a}}},qa=(e=>(e.NATIVE="native",e.ENETPULSE="enetpulse",e.SPORTRADAR="sportradar",e.SPORTAL_365="sportal365",e.API_FOOTBALL="api_football",e))(qa||{}),qs=class{validate(e){let t=this.validateField(e.idSchema),a=this.generateMessage(t);return{validation:t,message:a}}validateField=e=>{let t=Object.values(qa),a=null;return e!=null&&e.length>0?t.includes(e)?a="valid":a="invalid":a="missing",a};generateMessage=e=>{let t=null,a="warning";return e==="missing"&&(t="If no idSchema is passed the default one will be set which is: native"),e==="invalid"&&(t="This idSchema value is not supported, the default one will be set which is: native"),e==="valid"&&(t=null,a=null),{text:t,type:a}}},Gt=class{getIdToken=null;logout=null},Te=class{text=null;type=null},wa=class{validation=null;message=new Te;getIdToken={validation:null,message:new Te};logout={validation:null,message:new Te}},js=class{validate(e){if(e.cookieToken)return new wa;let t=this.validateAuthProvider(e.authProvider);return t.validation!=="missing"&&(t=this.validateAuthProviderConfigFields(e.authProvider,t),t=this.generateAuthProviderConfigMessages(t),t=this.checkAuthProviderConfigMessagesForErrors(t)),t}validateAuthProvider=e=>{let t=Object.keys(new Gt),a=new wa;if(e){let i=Object.keys(e).filter(s=>!t.includes(s));i.length>0?(a.validation="invalid",a.message.type="warning",a.message.text=`You have passed a property which is not supported for the authentication provider: ${i.join(",")}`):a.validation="valid"}else a.validation="missing",a.message.type="error",a.message.text="The field authProvider must be provided to use this SDK";return a};validateAuthProviderConfigFields=(e,t)=>(Object.keys(new Gt).forEach(a=>{e[a]?t[a].validation="valid":t[a].validation="missing"}),t);generateAuthProviderConfigMessages=e=>(Object.keys(e).filter(t=>t!=="validation"&&t!=="message").forEach(t=>{let a=e[t];a.validation==="missing"&&(a.message.text=`The following property is missing from the authProvider object: ${t}`,a.message.type="error")}),e);checkAuthProviderConfigMessagesForErrors=e=>(Object.keys(e).filter(t=>t!=="validation"&&t!=="message").forEach(t=>{e[t].validation==="missing"&&e.validation==="valid"&&(e.validation="invalid",e.message.type="error",e.message.text="The field authProvider has missing properties")}),e)},Oe=class{validation;message},Qs=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;errorHandlingMode=null;cookieToken={name:new Oe,requestHeaders:new Oe};oddClient=null;authProvider={getIdToken:new Oe,logout:new Oe};isValid=!1},Ys=class{validate(e){let t=this.validateField(e.clientId),a=this.generateMessage(t);return{validation:t,message:a}}validateField=e=>{let t=null;return e!=null&&e.length>0?t="valid":t="missing",t};generateMessage=e=>{let t=null,a="error";return e==="missing"&&(t="The field clientId must be provided to use Fans United JS SDK"),e==="valid"&&(t=null,a=null),{text:t,type:a}}},Xs=(e=>(e.DEFAULT="default",e.STANDARD="standard",e))(Xs||{}),Js=class{validate=e=>{let t=this.validateField(e.errorHandlingMode),a=this.generateMessage(t);return{validation:t,message:a}};validateField=e=>{let t=["default","standard"],a=null;return e?t.includes(e)?a="valid":a="invalid":a="missing",a};generateMessage=e=>{let t=null,a="warning";return e==="missing"&&(t="If no errorHandlingMode is passed the default one will be set which is: default"),e==="invalid"&&(t="This errorHandlingMode value is not supported, the default one will be set which is: default"),e==="valid"&&(t=null,a=null),{text:t,type:a}}},_a=class extends Oe{name={validation:null,message:new Te};requestHeaders={validation:null,message:new Te}},Ks=class{keys=["name","requestHeaders"];isServerSide=typeof document>"u";validate(e){if(!e.cookieToken){let a=new _a;return a.message={type:null,text:null},a.validation="valid",a}let t=this.validateCookieToken(e.cookieToken);return t=this.validateCookieTokenConfigFields(e.cookieToken,t),t=this.generateCookieTokenConfigMessages(t),t=this.checkCookieTokenConfigMessagesForErrors(t),t}validateCookieToken=e=>{let t=new _a;t.message={type:null,text:null};let a=Object.keys(e).filter(i=>!this.keys.includes(i));return a.length>0?(t.validation="invalid",t.message.type="warning",t.message.text=`You have passed properties which are not supported for the cookie token configuration property: ${a.join(",")}`):t.validation="valid",t};validateCookieTokenConfigFields=(e,t)=>(this.keys.forEach(a=>{e[a]||a==="requestHeaders"&&!this.isServerSide?t[a].validation="valid":t[a].validation="missing"}),t);generateCookieTokenConfigMessages=e=>(Object.keys(e).filter(t=>t!=="validation"&&t!=="message").forEach(t=>{let a=e[t];a.validation==="missing"&&(a.message.text=`The following property is missing from the cookieToken object: ${t}`,a.message.type="error")}),e);checkCookieTokenConfigMessagesForErrors=e=>(Object.keys(e).filter(t=>t!=="validation"&&t!=="message").forEach(t=>{e[t].validation==="missing"&&(e.validation="invalid",e.message.type="error",e.message.text="The field cookieToken has missing properties")}),e)},va=class extends Oe{name={validation:null,message:new Te};credentials={validation:null,message:new Te}},Zs=class{keys=["name","credentials"];validate=e=>{if(!e.oddClient){let a=new va;return a.validation="missing",a.message={type:"warning",text:"If no oddClient is passed the Odds namespace will not work. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/"},a}let t=this.validateOddClient(e.oddClient);return t.message.type==="error"||(t=this.validateOddClientConfigFields(e.oddClient,t),t=this.checkOddClientMissingProperties(t),t.message.type==="error")||(t=this.validateOddClientCredentials(e.oddClient.credentials,t)),t};validateOddClient=e=>{let t=new va;if(t.message={type:null,text:null},!(e instanceof Object))return t.validation="invalid",t.message.type="error",t.message.text="The oddClient object is not valid. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/",t;let a=Object.keys(e).filter(i=>!this.keys.includes(i));return a.length>0?(t.validation="invalid",t.message.type="warning",t.message.text=`You have passed properties which are not supported for the odd client configuration property: ${a.join(",")}`):t.validation="valid",t};validateOddClientConfigFields=(e,t)=>(this.keys.forEach(a=>{e[a]?t[a].validation="valid":t[a].validation="missing"}),t);validateOddClientCredentials=(e,t)=>{if(!(e instanceof Object))return t.credentials.validation="invalid",t.credentials.message.type="error",t.credentials.message.text="The odd client credentials object is not valid. The odd client will not work without credentials. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/",t;let a=Object.keys(e),i=["username","password"],s=i.filter(n=>!a.includes(n));s.length>0&&(t.credentials.validation="invalid",t.credentials.message.type="error",t.credentials.message.text=`The following property is missing from the odd client credentials object: ${s.join(", ")}`),a.length>0&&s.length===0&&(!e.username||!e.password)&&(t.credentials.validation="invalid",t.credentials.message.type="error",t.credentials.message.text="The odd client credentials object is not valid. The odd client will not work without credentials. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/");let r=a.filter(n=>!i.includes(n));return r.length>0&&(t.credentials.validation="invalid",t.credentials.message.type="warning",t.credentials.message.text=`You have passed properties which are not supported for the odd client credentials configuration property: ${r.join(", ")}`),t};checkOddClientMissingProperties=e=>(Object.keys(e).filter(t=>t!=="validation"&&t!=="message").forEach(t=>{e[t].validation==="missing"&&(e.validation="invalid",e.message.type="error",e.message.text="The field oddClient has missing properties. For more information check our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk#/")}),e)},er=class{validate=e=>{let t=this.checkFieldsForValues(e);return t.isValid=this.containsErrorMessage(t),t};checkFieldsForValues=e=>{let t=new Qs,a={apiKey:new zs,environment:new Ws,idSchema:new qs,clientId:new Ys,lang:new Vs,errorHandlingMode:new Js,authProvider:new js,cookieToken:new Ks,oddClient:new Zs};for(let[i,s]of Object.entries(t))i!=="isValid"&&(s=a[i].validate(e));return Object.keys(a).forEach(i=>{t[i]=a[i].validate(e)}),t};containsErrorMessage=e=>{let t=!0;for(let[a,i]of Object.entries(e))if(a!=="authProvider"&&a!=="cookieToken"&&a!=="oddClient"){if(a!=="isValid"&&i.message.type==="error")return t=!1,t;if(a!=="isValid"&&i.message.type==="warning")return t=!0,t}else if(i.message.type==="error"||a==="oddClient"&&i.credentials.message.type==="error")return t=!1,t;return t}},Ia=e=>{let t=200,a=[],i=0;return a[i]=[],e.forEach(s=>{a[i].length<=t-1?a[i].push(s):(i++,a[i]=[s])}),a},Fe=(e,t)=>{let a=[];for(;e.length>t;){let i=e.splice(0,t);a.push(i)}return a.push(e),a},ee=(e,t)=>{let a="";return e==="prod"?a={profile:"https://profile.fansunitedapi.com/v1",football:"https://football.fansunitedapi.com/v1",idMapping:"https://id-mapping.fansunitedapi.com/v1",predictor:"https://prediction.fansunitedapi.com/v1",client:"https://client.fansunitedapi.com/v1",loyalty:"https://loyalty.fansunitedapi.com/v1",miniGames:"https://mini-games.fansunitedapi.com/v1",discussions:"https://discussions.fansunitedapi.com/v1",privateLeagues:"https://private-leagues.fansunitedapi.com/v1",voting:"https://voting.fansunitedapi.com/v1"}[t]:e==="dev"?a={profile:"http://localhost:8010/v1",football:"http://localhost:8080/v1",idMapping:"http://localhost:8030/v1",predictor:"http://localhost:8040/v1",client:"http://localhost:8070/v1",loyalty:"http://localhost:8060/v1",miniGames:"http://localhost:9040/v1",discussions:"http://localhost:9020/v1",privateLeagues:"http://localhost:9010/v1",voting:"http://localhost:9030/v1"}[t]:a={profile:"https://profile.fansunitedstagingapi.com/v1",football:"https://football.fansunitedstagingapi.com/v1",idMapping:"https://id-mapping.fansunitedstagingapi.com/v1",predictor:"https://prediction.fansunitedstagingapi.com/v1",client:"https://client.fansunitedstagingapi.com/v1",loyalty:"https://loyalty.fansunitedstagingapi.com/v1",miniGames:"https://mini-games.fansunitedstagingapi.com/v1",discussions:"https://discussions.fansunitedstagingapi.com/v1",privateLeagues:"https://private-leagues.fansunitedstagingapi.com/v1",voting:"https://voting.fansunitedstagingapi.com/v1"}[t],a},_t=e=>Array.from(new Set(e)),S=e=>e||!1,E=()=>`&disable_cache=${Date.now()}`,ja=e=>JSON.parse(JSON.stringify(e.sort((t,a)=>t.localeCompare(a)))),$t=e=>{if(!e)return"";let t=[];typeof document>"u"?t=(e.requestHeaders?.get("cookie")||"").split(";"):t=document.cookie.split(";");let a=t.find(r=>r.trim().startsWith(`${e.name}=`));if(!a)return"";let i=a.split("=")[1].trim(),s=decodeURIComponent(i);try{let r=JSON.parse(s);return r.token||r||""}catch{return s}},vt=(e=>(e.FT_1X2="FT_1X2",e.HT_1X2="HT_1X2",e.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",e.DOUBLE_CHANCE="DOUBLE_CHANCE",e.HT_FT="HT_FT",e.PLAYER_SCORE="PLAYER_SCORE",e.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",e.PLAYER_RED_CARD="PLAYER_RED_CARD",e.RED_CARD_MATCH="RED_CARD_MATCH",e.PENALTY_MATCH="PENALTY_MATCH",e.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",e.CORNERS_MATCH="CORNERS_MATCH",e.CORRECT_SCORE="CORRECT_SCORE",e.CORRECT_SCORE_ADVANCED="CORRECT_SCORE_ADVANCED",e.CORRECT_SCORE_HT="CORRECT_SCORE_HT",e.PLAYER_SCORE_HATTRICK="PLAYER_SCORE_HATTRICK",e.PLAYER_SCORE_TWICE="PLAYER_SCORE_TWICE",e.OVER_GOALS_0_5="OVER_GOALS_0_5",e.OVER_GOALS_1_5="OVER_GOALS_1_5",e.OVER_GOALS_2_5="OVER_GOALS_2_5",e.OVER_GOALS_3_5="OVER_GOALS_3_5",e.OVER_GOALS_4_5="OVER_GOALS_4_5",e.OVER_GOALS_5_5="OVER_GOALS_5_5",e.OVER_GOALS_6_5="OVER_GOALS_6_5",e.OVER_CORNERS_6_5="OVER_CORNERS_6_5",e.OVER_CORNERS_7_5="OVER_CORNERS_7_5",e.OVER_CORNERS_8_5="OVER_CORNERS_8_5",e.OVER_CORNERS_9_5="OVER_CORNERS_9_5",e.OVER_CORNERS_10_5="OVER_CORNERS_10_5",e.OVER_CORNERS_11_5="OVER_CORNERS_11_5",e.OVER_CORNERS_12_5="OVER_CORNERS_12_5",e.OVER_CORNERS_13_5="OVER_CORNERS_13_5",e))(vt||{}),tr=["OVER_GOALS_0_5","OVER_GOALS_1_5","OVER_GOALS_2_5","OVER_GOALS_3_5","OVER_GOALS_4_5","OVER_GOALS_5_5","OVER_GOALS_6_5"],ar=["OVER_CORNERS_6_5","OVER_CORNERS_7_5","OVER_CORNERS_8_5","OVER_CORNERS_9_5","OVER_CORNERS_10_5","OVER_CORNERS_11_5","OVER_CORNERS_12_5","OVER_CORNERS_13_5"],ge=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],ir=["FT_1X2","HT_1X2","HT_FT","DOUBLE_CHANCE","CORNERS_MATCH","CORRECT_SCORE","CORRECT_SCORE_HT","CORRECT_SCORE_ADVANCED"],ht="PLAYER_SCORE_FIRST_GOAL",sr=class{id="";achievedAt=""},Qa=class{participationCount=null;points=null},Ya=class{totalPoints=null;postPoints=null;postsMade=null;reactionPoints=null;reactionCount=null},Xa=class{participationCount=null},Ta=class{participations=0;points=0},Ut=class{footballCompetitions=[];footballTeams=[]},Ja=class{predictionsMade=0;correct=0;points=0;breakdown=new Ut},Ka=class{single=new Ja;topX=new Ta;matchQuiz=new Ta},rr=class{overallPercent;byFootballCompetition;byFootballTeam;byFootballMarket},nr=class{profileId;tier;points;predictionsMade;successRates=new rr;predictions=new Ka;tiers=[];badges=[];discussions=new Ya;classicQuizzes=new Qa;eitherOr=new Xa},or=class{entityId="";entityType="";entitySource="";model=null;predictionsMade=0;correct=0;points=0},lr=class{successRatePercent;model=null},qt=class{content=null;tags=[];campaign=null},Za=class{id=null;profileId=null;property=null;value=null;action=null;context=new qt;points=0},ke=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null},fe=class{pagination=new ke},cr=class{meta=new fe;data=[new Za]},dr=class{remapSingleResponse=e=>{let t=new Za;return t.id=e.id,t.profileId=e.profile_id,t.property=e.property,t.value=e.value,t.action=e.action,t.context.content=e.context.content,t.context.tags=e.context.tags,t.context.campaign=e.context.campaign,t.points=e.points,t};remapActivitiesResponse=e=>{let t=new cr;return t.meta.pagination.currentPage=e.meta.pagination.current_page,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.meta.pagination.numberOfPages=e.meta.pagination.number_of_pages,t.meta.pagination.totalItems=e.meta.pagination.total_items,t.data=e.data.map(a=>this.remapSingleResponse(a)),t};remapStatsResponse=e=>{let t=new nr;return t.profileId=e.profile_id,t.tier=e.tier,t.points=e.points,t.predictionsMade=e.predictions_made,t.successRates.overallPercent=e.success_rates.overall_percent,t.successRates.byFootballCompetition=this.constructNewRecord(e.success_rates.by_competition),t.successRates.byFootballTeam=this.constructNewRecord(e.success_rates.by_team),t.successRates.byFootballMarket=this.constructNewRecord(e.success_rates.by_market),t.predictions=e.predictions?this.remapPredictionsStats(e.predictions):null,t.tiers=e.tiers?this.remapAchievementsStats(e.tiers):null,t.badges=e.badges?this.remapAchievementsStats(e.badges):null,t.discussions=e.discussions?this.remapDiscussionStats(e.discussions):null,t.classicQuizzes=e.classic_quizzes?this.remapClassicQuizStats(e.classic_quizzes):null,t.eitherOr=e.either_or?this.remapEitherOrStats(e.either_or):null,t};constructNewRecord=e=>{let t;if(Object.entries(e).length)Object.entries(e).forEach(([a,i])=>{t={...t,[a]:this.remapSuccessRatePercent(i)},vt[a]&&delete t[a].model});else return e;return t};remapSuccessRatePercent=e=>{let t=new lr;return t.successRatePercent=e.success_rate_percent,t};remapPredictionsStats=e=>{let t=new Ka;return t.single=this.remapSinglePredictionsStats(e.single),t.topX=e.top_x,t.matchQuiz=e.match_quiz,t};remapSinglePredictionsStats=e=>{let t=new Ja;return t.predictionsMade=e.predictions_made,t.correct=e.correct,t.points=e.points,t.breakdown=this.remapBreakdownSinglePredictionsStats(e.breakdown),t};remapBreakdownSinglePredictionsStats=e=>{if(e&&Object.keys(e).length){let t=new Ut,a=[],i=[];return Object.keys(e).forEach(s=>{let r=new or;r.entityId=s,r.entityType=e[s].entity_type,r.entitySource=e[s].entity_source,r.predictionsMade=e[s].predictions_made,r.correct=e[s].correct,r.points=e[s].points,r.entityType==="competition"?a.push(r):r.entityType==="team"&&i.push(r)}),t.footballCompetitions=a,t.footballTeams=i,t}return new Ut};remapAchievementsStats=e=>e.map(t=>{let a=new sr;return a.id=t.id,a.achievedAt=t.achieved_at,a});remapDiscussionStats=e=>{let t=new Ya;return t.totalPoints=e.total_points,t.postPoints=e.post_points,t.postsMade=e.posts_made,t.reactionPoints=e.reaction_points,t.reactionCount=e.reaction_count,t};remapClassicQuizStats=e=>{let t=new Qa;return t.participationCount=e.participation_count,t.points=e.points,t};remapEitherOrStats=e=>{let t=new Xa;return t.participationCount=e.participation_count,t}};function Bt(e){this.message=e}Bt.prototype=new Error,Bt.prototype.name="InvalidCharacterError";var ba=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Bt("'atob' failed: The string to be decoded is not correctly encoded.");for(var a,i,s=0,r=0,n="";i=t.charAt(r++);~i&&(a=s%4?64*a+i:i,s++%4)?n+=String.fromCharCode(255&a>>(-2*s&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return n};function pr(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return(function(a){return decodeURIComponent(ba(a).replace(/(.)/g,function(i,s){var r=s.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))})(t)}catch{return ba(t)}}function mt(e){this.message=e}function ur(e,t){if(typeof e!="string")throw new mt("Invalid token specified");var a=(t=t||{}).header===!0?0:1;try{return JSON.parse(pr(e.split(".")[a]))}catch(i){throw new mt("Invalid token specified: "+i.message)}}mt.prototype=new Error,mt.prototype.name="InvalidTokenError";var Pa=ur,hr=(e=>(e[e.BAD_METHOD_CALL=400]="BAD_METHOD_CALL",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e))(hr||{}),mr=(e=>(e.INVALID_TEMPLATE="INVALID_TEMPLATE",e.INVALID_PREDICTION="INVALID_PREDICTION",e.INVALID_MARKET="INVALID_MARKET",e.INVALID_FIELD="INVALID_FIELD",e.INVALID_TYPE="INVALID_TYPE",e.EXCEEDED_LENGTH="EXCEEDED_LENGTH",e.INVALID_TOKEN="invalid_token",e.UNAUTHORIZED="unauthorized",e.INVALID_FILTERS="invalid_filters",e.INVALID_AVATAR="invalid_avatar",e.INVALID_METHOD_CALL="invalid_method_call",e.INVALID_LIMIT="invalid_limit",e.INVALID_TEMPLATE_GROUP_ID="invalid_template_group_id",e.INVALID_TEMPLATE_GROUP_FILTERS="invalid_template_group_filters",e.INVALID_PAGE_NUMBER="invalid_page_number",e.INVALID_DISCUSSION_IDS="invalid_discussion_ids",e.ID_MAPPING_NOT_FOUND="id_mapping_not_found",e.INVALID_COMPETITION_ID="invalid_competition_id",e.INVALID_TEAM_ID="invalid_team_id",e.INVALID_IDS="invalid_ids",e.INVALID_INPUT_PROVIDER="invalid_input_provider",e.INVALID_OUTPUT_PROVIDER="invalid_output_provider",e.INVALID_MATCH_SUMMARY="invalid_match_summary",e.INVALID_MATCH_SUMMARY_PREDICTIONS="invalid_match_summary_predictions",e.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="invalid_match_summary_predictions_keys",e.ENTITY_IDS_NOT_FOUND="entity_ids_not_found",e.MATCH_IDS_NOT_FOUND="match_ids_not_found",e.INVALID_MATCH_IDS="invalid_match_ids",e.ODD_CLIENT_CONFIGURATION_NOT_FOUND="odd_client_configuration_not_found",e))(mr||{}),H={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id",api_football:"api_football_id"},Ea={PREDICTOR_USER_RELATED_OPERATION:"https://docs.fansunitedmedia.com/docs/predictor-operations#user-related-operations"},Ra=["matchId","matchType","market","prediction"],gr=new Map().set("FT_1X2","fullTimeOneXTwo").set("HT_1X2","halfTimeOneXTwo").set("BOTH_TEAMS_SCORE","bothTeamsScore").set("DOUBLE_CHANCE","doubleChance").set("HT_FT","halfTimeFullTime").set("PLAYER_SCORE","playerScore").set("PLAYER_YELLOW_CARD","playerYellowCard").set("PLAYER_RED_CARD","playerRedCard").set("RED_CARD_MATCH","redCardMatch").set("PENALTY_MATCH","penaltyMatch").set("PLAYER_SCORE_FIRST_GOAL","playerScoreFirstGoal").set("CORNERS_MATCH","cornersMatch").set("CORRECT_SCORE","correctScore").set("CORRECT_SCORE_ADVANCED","correctScoreAdvanced").set("CORRECT_SCORE_HT","correctScoreHalfTime").set("PLAYER_SCORE_HATTRICK","playerScoreHattrick").set("PLAYER_SCORE_TWICE","playerScoreTwice").set("OVER_GOALS_0_5","overZeroPointFiveGoals").set("OVER_GOALS_1_5","overOnePointFiveGoals").set("OVER_GOALS_2_5","overTwoPointFiveGoals").set("OVER_GOALS_3_5","overThreePointFiveGoals").set("OVER_GOALS_4_5","overFourPointFiveGoals").set("OVER_GOALS_5_5","overFivePointFiveGoals").set("OVER_GOALS_6_5","overSixPointFiveGoals").set("OVER_CORNERS_6_5","overSixPointFiveCorners").set("OVER_CORNERS_7_5","overSevenPointFiveCorners").set("OVER_CORNERS_8_5","overEightPointFiveCorners").set("OVER_CORNERS_9_5","overNinePointFiveCorners").set("OVER_CORNERS_10_5","overTenPointFiveCorners").set("OVER_CORNERS_11_5","overElevenPointFiveCorners").set("OVER_CORNERS_12_5","overTwelvePointFiveCorners").set("OVER_CORNERS_13_5","overThirteenPointFiveCorners"),fr=(e=>(e.INVALID_MATCH_ID="Match id is invalid!",e.INVALID_PLAYER_ID="Player id is invalid!",e.QUERY_PARAM_MATCH_IDS_EXCEEDED="Maximum matchIds in PredictionFilters should be 10 or less.",e.QUERY_PARAM_FILTERS_LIMIT_EXCEEDED="Maximum limit for filtering games is 50 or less.",e.INVALID_FIXTURES_FIELD="Fixtures field is invalid. For more information please visit our documentation",e.INVALID_TOKEN="Invalid JWT token is provided",e.EXPIRED_TOKEN="The provided JWT token is expired",e.ENTITIES_NEEDED="At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.",e.ENTITIES_FOLLOWS_FILTERS_EXCEEDED="Maximum length per entity should be 24 or less.",e.INVALID_TYPE="You have provided invalid type. The valid type is ",e.INVALID_VALUE="You have provided invalid value. The valid value is ",e.INVALID_AVATAR="Invalid URL syntax for avatar image.",e.INVALID_GET_PROFILES_METHOD_CALL="The method 'getByIds' from Profile namespace is not called correctly. You need to provide 'profileIds' OR 'search' parameters to the method, but you can't use both of them or neither of them.",e.INVALID_LIMIT="Invalid limit. The maximum limit is: ",e.INVALID_LIMIT_TYPE="Invalid limit type. The proper type is number.",e.FILTER_COMBINATION_ERROR="You need to use both 'entityIds' and 'entityType' filters together",e.INVALID_ENTITY_TYPE="Invalid 'entityType' filter. Please use one of the following valid options: competition, team, or player",e.INVALID_TEMPLATE_GROUP_ID="There is no group in this template with the provided groupId",e.INVALID_TEMPLATE_GROUP_FILTERS="The provided template group has no filters",e.INVALID_PAGE_NUMBER="Invalid page number provided. Use number between 1 and max number of pages.",e.INVALID_DISCUSSION_IDS="Invalid discussion ids argument. Please provide at least one discussion id in an array",e.EXCEEDED_DISCUSSION_IDS="Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids.",e.EXCEEDED_EXTENDED_DISCUSSION_IDS="Maximum number of discussion ids exceeded. The maximum number of discussion ids is: ",e.ID_MAPPING_NOT_FOUND="No ID mappings are available for the provided ID. ID argument: ",e.INVALID_PARAM="Invalid parameter provided. Please check the following parameter: ",e.INVALID_COMPETITION_ID="Invalid competition ID provided. Please provide a valid competition ID.",e.INVALID_TEAM_ID="Invalid team ID provided. Please provide a valid team ID.",e.INVALID_OR_EMPTY_IDS="Invalid or empty IDs provided. Please provide at least one ID.",e.INVALID_PROVIDER="Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'.",e.INVALID_OUTPUT_PROVIDER="Invalid output provider. The output can not be the same as the input provider.",e.MATCH_SUMMARY_REQUIRED="Match summary is required.",e.MATCH_SUMMARY_PREDICTIONS_REQUIRED="Predictions in match summary are required.",e.INVALID_MATCH_SUMMARY_PREDICTIONS_KEYS="Keys in predictions in match summary are invalid. The valid ones are: ",e.INVALID_COLLECT_LEAD_METHOD_CALL="The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method.",e.REQUIRED_FIXTURES_FIELD="Fixtures field is required and should contain at least one fixtures object. For more information please visit our documentation",e.INVALID_TIEBREAKER_FIELD="Tiebreaker field is invalid. It should contain statTotal key with integer value. For more information please visit our documentation",e.ENTITY_IDS_NOT_FOUND="Some of the sport entity IDs were not found for the provided id schema",e.MATCH_IDS_NOT_FOUND="Some of the match IDs were not found for the provided id schema",e.INVALID_STANDING_PREDICTION_ARGUMENT="The prediction argument is invalid. For more information please visit our documentation",e.INVALID_MAP_PLAYERS_ROLES_KEYS="The keys in the players roles map are not part of the valid keys. The valid keys are: ",e.INVALID_MAP_PLAYERS_ROLES_VALUES="The values in the map are not valid. The valid ones are: ",e.INVALID_MATCH_IDS="Match IDs are invalid!",e.MISSING_ODD_CLIENT_CONFIGURATION="Odds namespace requires oddClient configuration to be set",e.INVALID_COLLECT_CONSENTS_METHOD_CALL="The method 'collectConsents' from Profile namespace is not called correctly. You need to provide 'consents' parameter to the method.",e))(fr||{}),Sa={UNEXPECTED_STATUS_PROP:`Unexpected provided property 'status'. You can NOT use this property for this method. For more information visit our documentation:
|
|
7
|
+
${Ea.PREDICTOR_USER_RELATED_OPERATION}`,UNEXPECTED_TYPE_PROP:`Unexpected provided property 'type'. You can NOT use this property for this method. For more information visit our documentation:
|
|
8
|
+
${Ea.PREDICTOR_USER_RELATED_OPERATION}`},yr=(e,t)=>`The prediction '${e}' is invalid for market '${t}'. Please check again have you passed appropriate prediction model. For more information please visit our documentation: https://docs.fansunitedmedia.com/sdks/js/match.quiz#gamerelatedoperations`,ei=e=>`The market '${e}' is not supported from Fans United. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/predictor-operations#make-football-prediction`,wr=e=>`The market '${e}' is not valid for Top X game. The only available market is CORRECT_SCORE.`,_r=e=>`The field/s '${e.length>1?e.join(", "):e[0]}' is/are invalid. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/javascript-sdk`,vr=(e,t)=>`The following field/s is/are missing from ${e}: '${t.length>1?t.join(", "):t[0]}'. For more information please visit our documentation: https://docs.fansunitedmedia.com/docs/predictor-operations#make-football-prediction`,Ir=(e,t)=>`The field ${e} has incorrect type. The correct type is ${t}`,tt=class{data={error:{code:0,status:"",message:""}};status=0;statusText="";headers=null;constructor(e,t){this.data.error.code=t.code,this.data.error.status=t.status,this.data.error.message=t.message,this.status=e.status,this.statusText=e.statusText,this.headers=e.headers}errorMessage=()=>this.data.error.message},O=class{error={code:0,status:"",message:""};constructor(e,t,a){this.error.code=e,this.error.status=t,this.error.message=a}},se=class{baseUrl=null;apiSignInUrl=null;jwtToken=null;idSchema=null;retryRequest=!1;headers=null;authHeaders=null;errorHandlingMode=null;configuration=null;constructor(e,t){this.baseUrl=t,this.configuration=e,this.apiSignInUrl=`?key=${e.apiKey}&client_id=${e.clientId}`,this.errorHandlingMode=e.errorHandlingMode,this.idSchema=e.idSchema,this.headers={"Content-Type":"application/json"}}getJwtToken=()=>this.configuration.cookieToken?$t(this.configuration.cookieToken):this.configuration.authProvider?.getIdToken()||"";getAuthHeaders=()=>({"Content-Type":"application/json",Authorization:`Bearer ${this.getJwtToken()}`});fetchWithoutAuth=async(e,t,a,i)=>{let s=null;i?s=await fetch(this.baseUrl+e,{headers:this.headers,method:a||"GET",body:JSON.stringify(i)}):s=await fetch(this.baseUrl+e,{headers:this.headers,method:a||"GET"});let r=await s.json();if(!s.ok){let n=this.transformFetchException(s,r);throw console.warn(t,n),n}return r};fetchWithoutAuthAdditionalHeaders=async(e,t,a)=>{let i=await fetch(this.baseUrl+e,{headers:{...this.headers,...a}}),s=await i.json();if(!i.ok){let r=this.transformFetchException(i,s);throw console.warn(t,r),r}return s};fetchWithAuth=async(e,t,a,i)=>{this.validateJWTToken();let s=null,r=null;if(a&&i?s=await fetch(this.baseUrl+e,{method:a,headers:this.getAuthHeaders(),body:JSON.stringify(i)}):a&&!i?s=await fetch(this.baseUrl+e,{method:a,headers:this.getAuthHeaders()}):s=await fetch(this.baseUrl+e,{headers:this.getAuthHeaders()}),a!=="DELETE"&&(r=await s.json()),!s.ok){(s.status===401||s.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuth(e,t,a,i)),this.retryRequest=!1;let n=this.transformFetchException(s,r||await s.json());throw console.warn(t,n),n}return this.retryRequest=!1,r};fetchWithAuthNewBaseURL=async(e,t,a,i,s)=>{this.validateJWTToken();let r=null,n=null;if(i&&s?r=await fetch(e+t,{method:i,headers:this.getAuthHeaders(),body:JSON.stringify(s)}):i&&!s?r=await fetch(e+t,{method:i,headers:this.getAuthHeaders()}):r=await fetch(e+t,{headers:this.getAuthHeaders()}),i!=="DELETE"&&(n=await r.json()),!r.ok){(r.status===401||r.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuthNewBaseURL(e,t,a,i,s)),this.retryRequest=!1;let o=this.transformFetchException(r,n||await r.json());throw console.warn(a,o),o}return this.retryRequest=!1,n};transformFetchException=(e,t)=>{if(!t&&e.status===401){if(this.errorHandlingMode==="standard")return new O(401,"unauthorized","Invalid JWT token is provided");let r={code:401,status:"unauthorized",message:"Invalid JWT token is provided"};return new tt(e,r)}let{code:a,status:i,message:s}=t.error;return this.errorHandlingMode==="standard"?new O(a,i,s):new tt(e,t.error)};validateJWTToken=()=>{let e=null;try{e=Pa(this.getJwtToken())}catch(t){if(this.errorHandlingMode==="default"){let a={status:401,statusText:t.message,headers:{}},i={code:401,status:"invalid_token",message:"Invalid JWT token is provided"};throw new tt(a,i)}else if(this.errorHandlingMode==="standard")throw new O(401,"invalid_token","Invalid JWT token is provided")}if(Date.now()>e.exp*1e3){if(this.errorHandlingMode==="default"){let t={status:401,statusText:"",headers:{}},a={code:401,status:"invalid_token",message:"The provided JWT token is expired"};throw new tt(t,a)}else if(this.errorHandlingMode==="standard")throw new O(401,"invalid_token","The provided JWT token is expired")}};extractUserIdFromToken=()=>{try{return Pa(this.getJwtToken())?.sub||""}catch(e){return console.error(e),""}}},ti=class extends se{activityRemapper=null;constructor(e){super(e,ee(e.environment,"loyalty")),this.activityRemapper=new dr}createActivity=async e=>{let t=`/activities${this.apiSignInUrl}`,a="There was a problem with creating activity",i="POST",s=await this.fetchWithAuth(t,a,i,e);return this.activityRemapper.remapSingleResponse(s)};deleteActivity=async e=>{let t=`/activities/${e}${this.apiSignInUrl}`,a=`There was a problem deleting the following activity: ${e}`;return await this.fetchWithAuth(t,a,"DELETE"),!0};getOwnActivities=async(e,t)=>{let a=`/activities${this.apiSignInUrl}`,i=Date.now(),s="There was a problem with fetching own activities";e&&(a+=`${e.constructFilterUrl()}`),t&&(a+=`disable_cache=${i}`);let r=await this.fetchWithAuth(a,s);return this.activityRemapper.remapActivitiesResponse(r)};getActivitiesForUser=async(e,t,a)=>{let i=`/users/${e}/activities${this.apiSignInUrl}`,s=Date.now(),r=`There was a problem with fetching activities for user: ${e}`;t&&(i+=`${t.constructFilterUrl()}`),a&&(i+=`disable_cache=${s}`);let n=await this.fetchWithoutAuth(i,r);return this.activityRemapper.remapActivitiesResponse(n)};getStats=async(e,t)=>{let a="",i="",s=null;return e?(a+=S(t)?`/users/${e}/statistics${this.apiSignInUrl}${E()}`:`/users/${e}/statistics${this.apiSignInUrl}`,i=`There was a problem fetching statistics for profile: ${e}`,s=await this.fetchWithoutAuth(a,i)):(a+=`/statistics${this.apiSignInUrl}`,i="There was a problem fetching profile`s statistics",s=await this.fetchWithAuth(a,i)),this.activityRemapper.remapStatsResponse(s.data)}},Tr=(e=>(e.LIKE="like",e.DISLIKE="dislike",e.PAGE_VIEW="page_view",e.CONTENT_CONSUMED="content_consumed",e.SHARE="share",e.COMMENT="comment",e.CLICK_AD="click_ad",e.PREDICTION_MADE="prediction_made",e.CONVERT="convert",e.MANAGE_INTERESTS="manage_interests",e.GAME_PARTICIPATION="game_participation",e.ARTICLE_CONSUMED="article_consumed",e.VIDEO_CONSUMED="video_consumed",e.SHORT_VIDEO_CONSUMED="short_video_consumed",e.LONG_VIDEO_CONSUMED="long_video_consumed",e.AUDIO_CONSUMED="audio_consumed",e.GALLERY_CONSUMED="gallery_consumed",e.IMAGE_CONSUMED="image_consumed",e.POLL_PARTICIPATION="poll_participation",e))(Tr||{}),Ca=class{action=null;context=new qt;constructor(e,t,a,i){this.action=e,this.context.tags=t,a&&(this.context.content=a),i&&(this.context.campaign=i)}},Ue={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},br=class extends se{constructor(e){super(e,ee(e.environment,"idMapping"))}getEntityById=async(e,t)=>{let a=`/football${this.apiSignInUrl}&input_provider=${this.idSchema}&${Ue[e]}=${t}`,i=`There was a problem with id mapping request for the following id: ${t}`;return await this.fetchWithoutAuth(a,i)};getEntityByIdAndSchema=async(e,t,a)=>{let i=`/football${this.apiSignInUrl}&input_provider=${a}&${Ue[e]}=${t}`,s=`There was a problem with id mapping request for the following id: ${t}`;return await this.fetchWithoutAuth(i,s)};getEntityIdsByIdsAndSchema=async(e,t,a)=>{let i=`/football${this.apiSignInUrl}&input_provider=${a}&${Ue[e]}=${t.join(",")}`,s=`There was a problem with id mapping request for the following ids: ${t.join(",")}`;return await this.fetchWithoutAuth(i,s)};getEntitiesByIds=async(e,t,a)=>{t.sort((r,n)=>r.localeCompare(n));let i=Ia(t),s=[];for(let r of i){let n=`/football${this.apiSignInUrl}&input_provider=${a}&${Ue[e]}=${r.join(",")}`,o=`There was a problem with id mapping request for the following ids :${r.join(",")}`,l=await this.fetchWithoutAuth(n,o);s=[...s,...l.data]}return s};getEntitiesByIdObjs=async(e,t)=>{let a=[],i={},s=[];Object.keys(e).forEach(o=>{a.push.apply(a,e[o])});let r=_t(a),n=Ia(r);for(let o of n){let l="";if(Object.keys(e).forEach(c=>{i[c]=[];let d=o.filter(p=>e[c].includes(p));d&&d.length>0&&(i[c]=d)}),Object.keys(i).forEach(c=>{i[c].length>0&&(i[c].sort((d,p)=>d.localeCompare(p)),l+="&",l+=`${Ue[c]}=${i[c].join(",")}`)}),l&&l.length>0){let c=`/football${this.apiSignInUrl}&input_provider=${t||"native"}${l}`,d="There was a problem with id mapping request",p=await this.fetchWithoutAuth(c,d);s.push(p.data)}else s.push([])}return Array.prototype.concat.apply([],s)};getTopEntities=async()=>{let e=`/football/top${this.apiSignInUrl}`;return(await this.fetchWithoutAuth(e,"There was a problem with top id mappings request")).data}},Ct="FansUnited",at={football:{ids:[],countries:[],competitions:[],expirations:{ids:0}},profile:{info:{},statistics:{},badges:null,countries:[],expirations:{profile:0,statistics:0,badges:0}},client:{features:{},expirations:{features:0}}},Ve=class{idSchema="";storageInstance=null;expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(e){this.idSchema=e,this.getStorageInstance()}static getInstance(e){return Ve.instance||(Ve.instance=new Ve(e)),Ve.instance}async getStorageInstance(){try{let e=await Promise.resolve().then(()=>(Ns(),Ha));this.storageInstance=e.default}catch(e){console.error(e)}}async getData(){try{let e=await this.storageInstance.getItem(Ct);return e?JSON.parse(e):(await this.storageInstance.setItem(Ct,JSON.stringify(at)),at)}catch(e){throw console.error("AsyncStorage error:",e),e}}async setData(e){await this.storageInstance.setItem(Ct,JSON.stringify(e))}clearData=async()=>{await this.setData(at)};getCompetitions=async e=>{let t=await this.getData();return e?e.competitionSearchFilter(t.football.competitions):t.football.competitions};setCompetitions=async e=>{let t=await this.getData(),a=[...t.football.competitions];a.push(...e),t.football.competitions=this.makeCompetitionsUnique(a),await this.setData(t)};getCompetitionsLength=async()=>(await this.getData()).football.competitions.length;getEntityById=async(e="",t="")=>(await this.getData()).football.ids.find(a=>{let i=H[this.idSchema];return a&&`${a[i]}`===t&&a.resource===e});getEntity=async(e,t,a)=>{let i=await this.getData();return Array.isArray(e)?i.football.ids.filter(s=>{let r=H[a];return s&&e.includes(`${s[r]}`)&&s.resource===t}):i.football.ids.find(s=>{let r=H[a];return s&&`${s[r]}`===e&&s.resource===t})};checkForExistingIdObjs=async(e,t)=>{let a=H[t],i={};for(let s of Object.keys(e)){let r=e[s],n=(await this.getEntity(r,s,t)).map(l=>l[a]),o=e[s].filter(l=>!n.includes(l));i[s]=r.map(l=>o.includes(l)?{id:l,exists:!1}:{id:l,exists:!0})}return i};getIdsByType=async(e,t,a)=>{let i=await this.getData(),s=H[a],r=H[t],n={};return Object.keys(e).forEach(o=>{let l=e[o],c=[];i.football.ids.forEach(d=>{l.forEach((p,m)=>{p===d[r]&&o===d.resource&&(c[m]=d[s])})}),n[o]=c}),n};addIdMapping=async e=>{let t=await this.getData();t.football.ids.push(e),await this.setData(t)};addIdMappings=async e=>{let t=await this.getData(),a=t.football.ids;a=[...a,...e],t.football.ids=a,await this.setData(t)};addTopIdMappings=async e=>{let t=await this.getData();if(t.football.ids.length){let a=JSON.parse(JSON.stringify(t.football.ids));a=a.filter(i=>i.resource!=="match"),e=e.filter(i=>i.resource==="match"),a=[...a,...e],t.football.ids=a}else t.football.ids=e;t.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,await this.setData(t)};setOwnProfile=async e=>{let t=await this.getData();t.profile.info=e,t.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,await this.setData(t)};getOwnProfile=async()=>(await this.getData()).profile.info;getProfileCountries=async()=>(await this.getData()).profile.countries;setProfileCountries=async e=>{let t=await this.getData();t.profile.countries=e,await this.setData(t)};getProfileStats=async()=>(await this.getData()).profile.statistics;setProfileStats=async e=>{let t=await this.getData();t.profile.statistics=e,t.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,await this.setData(t)};getProfileBadges=async()=>(await this.getData()).profile.badges;setProfileBadges=async e=>{let t=await this.getData();t.profile.badges=e,t.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,await this.setData(t)};getFootballCountries=async()=>(await this.getData()).football.countries;setFootballCountries=async e=>{let t=await this.getData();t.football.countries=e,await this.setData(t)};getClientFeatures=async()=>(await this.getData()).client.features;setClientFeatures=async e=>{let t=await this.getData(),a=JSON.parse(JSON.stringify(e));t.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,t.client.features=a,await this.setData(t)};deleteClientFeatures=async()=>{let e=await this.getData(),t=JSON.parse(JSON.stringify(e));t.client={features:{},expirations:{features:0}},await this.setData(t)};getExpiration=async(e,t)=>{await this.initialNewSchema(e,"expirations");let a=await this.getData();switch(t){case"profile":return a.profile.expirations.profile;case"statistics":return a.profile.expirations.statistics;case"badges":return a.profile.expirations.badges;case"features":return a.client.expirations.features;case"ids":return a.football.expirations.ids}};makeCompetitionsUnique=e=>{let t=new Set;return e.filter(a=>{let i=!t.has(a.id);return t.add(a.id),i})};initialNewSchema=async(e,t)=>{let a=await this.getData();(!a||!a[e]||!a[e][t])&&await this.setData(at)}},ai=Ve;de(ai,"instance");var Mt="FansUnited",Ot={football:{ids:[],countries:[],competitions:[],expirations:{ids:0}},profile:{info:{},statistics:{},badges:null,countries:[],expirations:{profile:0,statistics:0,badges:0}},client:{features:{},expirations:{features:0}}},We=class{idSchema="";expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(e){this.idSchema=e}static getInstance(e){return We.instance||(We.instance=new We(e)),We.instance}clearData=async()=>{this.setData(Ot)};getEntityById=async(e="",t="")=>this.getData().football.ids.find(a=>{let i=H[this.idSchema];return a&&`${a[i]}`===t&&a.resource===e});getEntity=(e,t,a)=>Array.isArray(e)?this.getData().football.ids.filter(i=>{let s=H[a];return i&&e.includes(`${i[s]}`)&&i.resource===t}):this.getData().football.ids.find(i=>{let s=H[a];return i&&`${i[s]}`===e&&i.resource===t});getEntityByNativeId=(e="",t="")=>this.getData().football.ids.find(a=>a&&`${a.id}`===t&&a.resource===e);checkForExistingIdObjs=async(e,t)=>{let a=H[t],i={};return Object.keys(e).forEach(s=>{let r=e[s],n=this.getEntity(r,s,t).map(l=>l[a]),o=e[s].filter(l=>!n.includes(l));i[s]=r.map(l=>o.includes(l)?{id:l,exists:!1}:{id:l,exists:!0})}),i};getIdsByType=async(e,t,a)=>{let i=H[a],s=H[t],r={};return Object.keys(e).forEach(n=>{let o=e[n],l=[];this.getData().football.ids.forEach(c=>{o.forEach((d,p)=>{d===c[s]&&n===c.resource&&(l[p]=c[i])})}),r[n]=l}),r};addIdMapping=e=>{let t=this.getData();t.football.ids.push(e),this.setData(t)};addIdMappings=async e=>{let t=this.getData(),a=t.football.ids;a=[...a,...e],t.football.ids=a,this.setData(t)};addTopIdMappings=async e=>{let t=this.getData();if(t.football.ids.length){let a=JSON.parse(JSON.stringify(t.football.ids));a=a.filter(i=>i.resource!=="match"),e=e.filter(i=>i.resource==="match"),a=[...a,...e],t.football.ids=a}else t.football.ids=e;t.football.expirations.ids=Math.floor(Date.now()/1e3)+this.expirationFootballIdsTimeout,this.setData(t)};setOwnProfile=async e=>{let t=this.getData();t.profile.info=e,t.profile.expirations.profile=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(t)};getOwnProfile=()=>this.getData().profile.info;getProfileCountries=()=>this.getData().profile.countries;setProfileCountries=async e=>{let t=this.getData();t.profile.countries=e,this.setData(t)};getProfileStats=()=>this.getData().profile.statistics;setProfileStats=async e=>{let t=this.getData();t.profile.statistics=e,t.profile.expirations.statistics=Math.floor(Date.now()/1e3)+this.expirationProfileTimeout,this.setData(t)};getProfileBadges=()=>this.getData().profile.badges;setProfileBadges=async e=>{let t=this.getData();t.profile.badges=e,t.profile.expirations.badges=Math.floor(Date.now()/1e3)+this.expirationBadgesTimeout,this.setData(t)};getFootballCountries=()=>this.getData().football.countries;setFootballCountries=async e=>{let t=this.getData();t.football.countries=e,this.setData(t)};getCompetitions=e=>{let t=this.getData();return e?e.competitionSearchFilter(t.football.competitions):t.football.competitions};setCompetitions=async e=>{let t=this.getData(),a=[...t.football.competitions];a.push(...e),t.football.competitions=this.makeCompetitionsUnique(a),this.setData(t)};getCompetitionsLength=async()=>{let{football:e}=this.getData();return e.competitions.length};getClientFeatures=()=>this.getData().client.features;setClientFeatures=async e=>{let t=this.getData(),a=JSON.parse(JSON.stringify(e));t.client.expirations.features=Math.floor(Date.now()/1e3)+this.expirationClientFeaturesTimeout,t.client.features=a,this.setData(t)};deleteClientFeatures=async()=>{let e=this.getData(),t=JSON.parse(JSON.stringify(e));t.client={features:{},expirations:{features:0}},this.setData(t)};getExpiration=async(e,t)=>{this.initialNewSchema(e,"expirations");let a=this.getData();switch(t){case"profile":return a.profile.expirations.profile;case"statistics":return a.profile.expirations.statistics;case"badges":return a.profile.expirations.badges;case"features":return a.client.expirations.features;case"ids":return a.football.expirations.ids}};makeCompetitionsUnique=e=>{let t=new Set;return e.filter(a=>{let i=!t.has(a.id);return t.add(a.id),i})};getData=()=>(localStorage.getItem(Mt)||this.setData(Ot),JSON.parse(localStorage.getItem(Mt)));setData=e=>{localStorage.setItem(Mt,JSON.stringify(e))};initialNewSchema=(e,t)=>{let a=this.getData();(!a||!a[e]||!a[e][t])&&this.setData(Ot)}},ii=We;de(ii,"instance");var Pr=xs(Bs()),L=class{profileTTL=600;clientTTL=14400;profileBadgesTTL=3600;idMappingsExpiration=0;idSchema="";constructor(e){}static getInstance(e){return L.instance||(L.instance=new L(e),L.nodeCache.options.useClones=!1),L.instance}clearData=async()=>L.nodeCache.flushAll();getEntityById=async(e,t)=>{let a=L.nodeCache.get("ids");return a?a.find(i=>{let s=H[this.idSchema];return i&&`${i[s]}`===t&&i.resource===e}):null};getEntity=async(e,t,a)=>{let i=L.nodeCache.get("ids");return i?Array.isArray(e)?[]:null:Array.isArray(e)?i.filter(s=>{let r=H[a];return s&&e.includes(`${s[r]}`)&&s.resource===t}):i.find(s=>{let r=H[a];return s&&`${s[r]}`===e&&s.resource===t})};checkForExistingIdObjs=async(e,t)=>{let a=H[t],i={};for(let s of Object.keys(e)){let r=e[s],n=(await this.getEntity(r,s,t)).map(l=>l[a]),o=e[s].filter(l=>!n.includes(l));i[s]=r.map(l=>o.includes(l)?{id:l,exists:!1}:{id:l,exists:!0})}return i};getIdsByType=async(e,t,a)=>{let i=H[a],s=H[t],r=L.nodeCache.get("ids"),n={};return r?(Object.keys(e).forEach(o=>{let l=e[o],c=[];r.forEach(d=>{l.forEach((p,m)=>{p===d[s]&&o===d.resource&&(c[m]=d[i])})}),n[o]=c}),n):null};addIdMapping=async e=>{let t=L.nodeCache.get("ids");t.push(e),L.nodeCache.set("ids",t)};addIdMappings=async e=>{let t=L.nodeCache.get("ids");t=[...t,...e],L.nodeCache.set("ids",t)};addTopIdMappings=async e=>{let t=L.nodeCache.get("ids"),a=604800;if(t){let i=JSON.parse(JSON.stringify(t));i=i.filter(s=>s.resource!=="match"),e=e.filter(s=>s.resource==="match"),i=[...i,...e],L.nodeCache.set("ids",i)}else L.nodeCache.set("ids",e);this.idMappingsExpiration=Math.floor(Date.now()/1e3)+a};setOwnProfile=async e=>{L.nodeCache.set("profile",e,this.profileTTL)};getOwnProfile=async()=>L.nodeCache.get("profile");getProfileCountries=async()=>L.nodeCache.get("profile_countries");setProfileCountries=async e=>{L.nodeCache.set("profile_countries",e)};getProfileStats=async()=>L.nodeCache.get("profile_stats");setProfileStats=async e=>{L.nodeCache.set("profile_stats",e,this.profileTTL)};getProfileBadges=async()=>L.nodeCache.get("profile_badges");setProfileBadges=async e=>{L.nodeCache.set("profile_badges",e,this.profileBadgesTTL)};getFootballCountries=async()=>L.nodeCache.get("football_countries");setFootballCountries=async e=>{L.nodeCache.set("football_countries",e)};getCompetitions=async e=>{let t=L.nodeCache.get("football_competitions");return t?e?e.competitionSearchFilter(t):t:null};setCompetitions=async e=>{L.nodeCache.set("football_competitions",e)};getCompetitionsLength=async()=>{let e=L.nodeCache.get("football_competitions");return e?e.length:0};getClientFeatures=async()=>L.nodeCache.get("client");setClientFeatures=async e=>{L.nodeCache.set("client",e,this.clientTTL)};deleteClientFeatures=async()=>{L.nodeCache.del("client")};getExpiration=async(e,t)=>{let a=this.getKeyFromExpirationType(t);return a==="ids"?this.idMappingsExpiration:L.nodeCache.getTtl(a)};getKeyFromExpirationType=e=>{switch(e){case"profile":return"profile";case"statistics":return"profile_stats";case"badges":return"profile_badges";case"features":return"client";case"ids":return"ids"}}},Ht=L;de(Ht,"instance"),de(Ht,"nodeCache",new Pr.default);var Qe=class{createLocalCacheInstance=e=>typeof window>"u"?Ht.getInstance(e):typeof __DEV__<"u"?ai.getInstance(e):ii.getInstance(e)},si=class{localCache=null;https=null;constructor(e){this.localCache=new Qe().createLocalCacheInstance(e.idSchema),this.https=new br(e)}getEntitiesByIds=async(e,t,a)=>{await this.setTopIdMappings();try{let i=await this.localCache.checkForExistingIdObjs(e,t),s=this.splitForRequestAndExisting(i),r=await this.https.getEntitiesByIdObjs(s.request,t);return await this.localCache.addIdMappings(r),await this.localCache.getIdsByType(e,t,a)}catch(i){return console.warn("There was a problem retrieving the entity ids ",i),Promise.resolve([])}};getEntitiesByIdsMap=async(e,t,a)=>{await this.setTopIdMappings();try{let i=JSON.parse(JSON.stringify(e)),s=await this.localCache.checkForExistingIdObjs(e,t),r=this.splitForRequestAndExisting(s),n=await this.https.getEntitiesByIdObjs(r.request,t);await this.localCache.addIdMappings(n);let o=await this.localCache.getIdsByType(e,t,a),l=new Map;return Object.keys(i).forEach(c=>{i[c].forEach((d,p)=>{let m=o[c].length&&o[c][p]?o[c][p]:"";l.set(d,m)})}),l}catch(i){return console.warn("There was a problem retrieving the entity ids ",i),Promise.resolve(new Map)}};getEntityById=async(e,t,a)=>{let i=await this.localCache.getEntity(e,t,a);if(i)return i;let s=await this.requestEntity(e,t,a);return await this.localCache.addIdMappings(s),s&&s.length>0?s[0]:null};splitForRequestAndExisting=e=>{let t={},a={};return Object.keys(e).forEach(i=>{t[i]=e[i].filter(s=>!s.exists).map(s=>s.id),a[i]=e[i].filter(s=>s.exists).map(s=>s.id)}),{existing:a,request:t}};requestEntity=async(e,t,a)=>{try{return e=Array.isArray(e)?e:[e],await this.https.getEntitiesByIds(t,e,a)}catch(i){return console.warn(`There was a problem retrieving the requested entity: ${i}`),null}};setTopIdMappings=async()=>{let e=Math.floor(Date.now()/1e3);if(await this.localCache.getExpiration("football","ids")>e)return Promise.resolve();let t=await this.https.getTopEntities();await this.localCache.addTopIdMappings(t)}},ri=e=>{switch(e){case"competitions":return"competition";case"players":case"relatedPlayer":case"squad":return"player";case"teams":case"participants":case"homeTeam":case"awayTeam":case"timeline":case"teamId":return"team";default:return e}},Er=class{extractedObjIds={};traverse=(e,t)=>(t=ri(t),Array.isArray(e)?this.traverseArrExtract(e,t):e&&typeof e=="object"&&this.traverseObjExtract(e,t),this.extractedObjIds);traverseArrExtract=(e,t)=>{e&&e.length>0&&e.forEach(a=>{this.traverseObjExtract(a,t)})};traverseObjExtract=(e,t)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(a=>{let i=e[a];a==="id"||a==="teamId"?(this.extractedObjIds.hasOwnProperty(t)||(this.extractedObjIds[t]=[]),i&&this.extractedObjIds[t].push(i)):e[a]&&this.traverse(e[a],a)})}},Rr=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(e,t,a)=>(t=ri(t),this.replaceObjIdsIndex===null&&(this.initReplaceObjIdsIndex(a),this.remappedIdsObj=a),Array.isArray(e)?this.traverseArrReplace(e,t):e&&typeof e=="object"&&this.traverseObjReplace(e,t),e);initReplaceObjIdsIndex=e=>{this.replaceObjIdsIndex={},Object.keys(e).forEach(t=>{this.replaceObjIdsIndex[t]=0})};traverseArrReplace=(e,t)=>{e&&e.length>0&&e.forEach(a=>{this.traverseObjReplace(a,t)})};traverseObjReplace=(e,t)=>{e&&Object.keys(e).length>0&&Object.keys(e).forEach(a=>{a==="id"||a==="teamId"?e[a]&&(e[a]=this.remappedIdsObj[t][this.replaceObjIdsIndex[t]],this.replaceObjIdsIndex[t]=this.replaceObjIdsIndex[t]+1):e[a]&&this.traverse(e[a],a,this.remappedIdsObj)})}},te=class{idSchema="";idMappingFacade=null;constructor(e){this.idSchema=e.idSchema,this.idMappingFacade=new si(e)}getEntityIdBySchemaId=(e,t)=>this.idMappingFacade.getEntityById(t,e,this.idSchema);remapEntities=async(e,t)=>{let a=JSON.parse(JSON.stringify(e));try{if(this.idSchema!=="native"){let i=new Er().traverse(a,t);return this.idMappingFacade.getEntitiesByIds(i,"native",this.idSchema).then(s=>new Rr().traverse(a,t,s))}else return e}catch(i){return console.warn(`There was a problem remapping entity: ${t} with inner entity `,i),[]}};getEntityIdsBySchemaId=async(e,t,a)=>{let i={};return i[t]=e,this.idSchema!=="native"?await this.idMappingFacade.getEntitiesByIds(i,this.idSchema,a):i}},It=class{idSchema;idMapping;constructor(e){this.idSchema=e.idSchema,this.idMapping=new te(e)}remapTagsIds=async(e,t,a)=>{if(!e||!e.length)return e;let i={},s={},r=[];e.forEach(o=>{i.hasOwnProperty(o.type)||(i[o.type]=[],s[o.type]=[]),i[o.type].push(o.id),s[o.type].push(o)});let n=await this.idMapping.idMappingFacade.getEntitiesByIds(i,t,a);for(let[o,l]of Object.entries(s))l.forEach((c,d)=>{c.id=n[o][d],r.push(c)});return r}},ni=class{page=null;limit=null;constructor(e){this.page=e.page?e.page:null,this.limit=e.limit?e.limit:null}},Sr=class extends ni{action=null;constructor(e){super(e),this.action=e.action?e.action:null}constructFilterUrl(){let e="";return this.action&&(e+="&",e+=`action=${this.action}`),this.page&&(e+="&",e+=`page=${this.page}`),this.limit&&(e+="&",e+=`limit=${this.limit}`),e}},Cr=class extends ni{action=null;constructor(e){super(e),this.action=e.action?e.action:null}constructFilterUrl(){let e="";return this.action&&(e+="&",e+=`action=${this.action}`),this.page&&(e+="&",e+=`page=${this.page}`),this.limit&&(e+="&",e+=`limit=${this.limit}`),e}},Mr=class{idSchema;activityHttps;activityService;constructor(e){this.idSchema=e.idSchema,this.activityHttps=new ti(e),this.activityService=new It(e)}add=async(e,t,a,i)=>{if(this.idSchema!="native"){let r=JSON.parse(JSON.stringify(t)),n=await this.activityService.remapTagsIds(t,this.idSchema,"native"),o=new Ca(e,n,a,i),l=await this.activityHttps.createActivity(o);return l.context.tags=r,l}let s=new Ca(e,t,a,i);return this.activityHttps.createActivity(s)};delete=async e=>await this.activityHttps.deleteActivity(e);like=async(e,t,a)=>await this.add("like",e,t,a);dislike=async(e,t,a)=>await this.add("dislike",e,t,a);addPageview=async(e,t,a)=>await this.add("page_view",e,t,a);addContentConsumed=async(e,t,a)=>await this.add("content_consumed",e,t,a);addShare=async(e,t,a)=>await this.add("share",e,t,a);addComment=async(e,t,a)=>await this.add("comment",e,t,a);addClickAd=async(e,t,a)=>await this.add("click_ad",e,t,a);addConvert=async(e,t,a)=>await this.add("convert",e,t,a);getOwn=async(e,t)=>{if(t=t||!1,e&&(e=new Sr(e)),this.idSchema!="native"){let a=await this.activityHttps.getOwnActivities(e,t);for(let i of a.data)await this.activityService.remapTagsIds(i.context.tags,"native",this.idSchema);return a}return await this.activityHttps.getOwnActivities(e,t)};getForUser=async(e,t,a)=>{if(a=a||!1,t&&(t=new Cr(t)),this.idSchema!="native"){let i=await this.activityHttps.getActivitiesForUser(e,t,a),s=JSON.parse(JSON.stringify(i));for(let r of s.data)await this.activityService.remapTagsIds([...r.context.tags],"native",this.idSchema);return s}return await this.activityHttps.getActivitiesForUser(e,t,a)}},Or=class{activityFacade;constructor(e){this.activityFacade=new Mr(e)}add=async(e,t,a,i)=>await this.activityFacade.add(e,t,a,i);delete=async e=>await this.activityFacade.delete(e);like=async(e,t,a)=>await this.activityFacade.like(e,t,a);dislike=async(e,t,a)=>await this.activityFacade.dislike(e,t,a);addPageview=async(e,t,a)=>await this.activityFacade.addPageview(e,t,a);addContentConsumed=async(e,t,a)=>await this.activityFacade.addContentConsumed(e,t,a);addShare=async(e,t,a)=>await this.activityFacade.addShare(e,t,a);addComment=async(e,t,a)=>await this.activityFacade.addComment(e,t,a);addClickAd=async(e,t,a)=>await this.activityFacade.addClickAd(e,t,a);addConvert=async(e,t,a)=>await this.activityFacade.addConvert(e,t,a);getOwn=async(e,t)=>await this.activityFacade.getOwn(e,t);getForUser=async(e,t,a)=>await this.activityFacade.getForUser(e,t,a)},oi=class{colors=null;urls=null;images=null},li=class{primaryColor=null;secondaryColor=null;contentColor=null;backgroundColor=null;borderColor=null;additionalColor=null},ci=class{primaryUrl=null;secondaryUrl=null;privacyPolicyUrl=null;termsAndConditionsUrl=null;additionalUrl=null},di=class{mainLogo=null;mobileLogo=null;backgroundImage=null;mobileBackgroundImage=null;additionalImage=null},Fr=class extends se{clientId=null;clientApiSignInUrl=null;constructor(e){super(e,ee(e.environment,"client")),this.clientId=e.clientId,this.clientApiSignInUrl=`?key=${e.apiKey}`}getBrandingByIds=async(e,t)=>{if(!e||e.length===0)return new Map;let a=Array.from(new Set(e)),i=`/clients/${this.clientId}/templates/brandings${this.clientApiSignInUrl}&branding_ids=${a.join(",")}`;t&&(i+=`&disable_cache=${Date.now()}`);let s=`There was a problem fetching brandings for IDs: ${a.join(", ")}`;try{let r=await this.fetchWithoutAuth(i,s),n=new Map;return r.data&&Array.isArray(r.data)&&r.data.forEach(o=>{let l=this.remapBranding(o);n.set(o.id,l)}),n}catch(r){return console.warn("Failed to fetch brandings, returning empty map",r),new Map}};getBrandingById=async(e,t)=>{if(!e)return null;let a=`/clients/${this.clientId}/templates/brandings/${e}${this.clientApiSignInUrl}`;t&&(a+=`&disable_cache=${Date.now()}`);let i=`There was a problem fetching branding: ${e}`;try{let s=await this.fetchWithoutAuth(a,i);return this.remapBranding(s.data)}catch(s){return console.warn(`Failed to fetch branding ${e}, returning null`,s),null}};remapBranding=e=>{let t=new oi;return e.colors&&(t.colors=new li,t.colors.primaryColor=e.colors.primary_color,t.colors.secondaryColor=e.colors.secondary_color,t.colors.contentColor=e.colors.content_color,t.colors.backgroundColor=e.colors.background_color,t.colors.borderColor=e.colors.border_color,t.colors.additionalColor=e.colors.additional_color),e.urls&&(t.urls=new ci,t.urls.primaryUrl=e.urls.primary_url,t.urls.secondaryUrl=e.urls.secondary_url,t.urls.privacyPolicyUrl=e.urls.privacy_policy_url,t.urls.termsAndConditionsUrl=e.urls.terms_and_conditions_url,t.urls.additionalUrl=e.urls.additional_url),e.images&&(t.images=new di,t.images.mainLogo=e.images.main_logo,t.images.mobileLogo=e.images.mobile_logo,t.images.backgroundImage=e.images.background_image,t.images.mobileBackgroundImage=e.images.mobile_background_image,t.images.additionalImage=e.images.additional_image),t}},ye=class{brandingHttps;constructor(e){this.brandingHttps=new Fr(e)}async resolveBranding(e,t){if(e.brandingId){let a=await this.brandingHttps.getBrandingById(e.brandingId,t);a||(e.brandingId=null),e.branding=a}return e}async resolveBrandingBatch(e,t){if(!e||e.length===0)return e;let a=e.filter(s=>s.brandingId).map(s=>s.brandingId);if(a.length===0)return e;let i=await this.brandingHttps.getBrandingByIds(a,t);return e.forEach(s=>{if(s.brandingId){let r=i.get(s.brandingId);r||(s.brandingId=null),s.branding=r||null}}),e}},we=class{entityId=null;entityType=null;entityRelationship=null},pe=class{remapBranding=e=>{let t=new oi;return e.colors&&(t.colors=new li,t.colors.primaryColor=e.colors.primary_color,t.colors.secondaryColor=e.colors.secondary_color,t.colors.contentColor=e.colors.content_color,t.colors.backgroundColor=e.colors.background_color,t.colors.borderColor=e.colors.border_color,t.colors.additionalColor=e.colors.additional_color),e.urls&&(t.urls=new ci,t.urls.primaryUrl=e.urls.primary_url,t.urls.secondaryUrl=e.urls.secondary_url,t.urls.privacyPolicyUrl=e.urls.privacy_policy_url,t.urls.termsAndConditionsUrl=e.urls.terms_and_conditions_url,t.urls.additionalUrl=e.urls.additional_url),e.images&&(t.images=new di,t.images.mainLogo=e.images.main_logo,t.images.mobileLogo=e.images.mobile_logo,t.images.backgroundImage=e.images.background_image,t.images.mobileBackgroundImage=e.images.mobile_background_image,t.images.additionalImage=e.images.additional_image),t};remapBrandingWithId=e=>{let t=null,a=null;return e.branding_id!==void 0&&(a=e.branding_id),e.branding&&(t=this.remapBranding(e.branding)),{branding:t,brandingId:a}}},pi=class{participantOne=null;participantTwo=null},Ar=class{matchId="";participantOne="";participantTwo="";winner="";homeParticipant="";startDate="";score=new pi},ui=class{participants=[]},kr=class{id=null;name=null;group=null;image=null;undecided=!1},Dr=class{id=null;title=null;description=null;rules=null;customFields=null;images=null;type="BRACKET";status=null;points=null;related=[];tiebreaker=null;predictionsCutoff=null;meta=new ui;fixtures=[];branding=null;brandingId=null;createdAt=null;updatedAt=null},Ye=class{nextPageStartsAfter=null;itemsPerPage=null},V=class{pagination=new Ye},Lr=class{meta=new V;data=[]},xr=class{meta=new V;data=[]},Nr=class{statTiebreakerEnabled;statTotal},Gr=class{matchId="";participantOne="";participantTwo="";winner;correct=null},hi=class{statTotal=0},$r=(e=>(e.ACTIVE="ACTIVE",e.WON="WON",e.LOST="LOST",e.PARTIALLY_WON="PARTIALLY_WON",e.CANCELED="CANCELED",e))($r||{}),Ur=class{id="";profileId="";profileModel=null;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new hi;createdAt="";updatedAt=""},Br=class{meta=new V;data=[]},Hr=class extends pe{remapBracketGames=e=>{let t=new xr;return t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.data=e.data.map(a=>this.remapBracketGameById(a)),t};remapBracketGameById=e=>{let t=new Dr;t.id=e.id,t.title=e.title,t.description=e.description,t.rules=e.rules,t.customFields=e.custom_fields,t.images=e.images,t.type=e.type,t.status=e.status,t.points=e.points,t.related=e.related?this.remapRelated(e.related):e.related,t.tiebreaker=e.tiebreaker?this.remapBracketGameTiebreaker(e.tiebreaker):e.tiebreaker,t.predictionsCutoff=e.predictions_cutoff;let a=this.remapBrandingWithId(e);return t.branding=a.branding,t.brandingId=a.brandingId,t.meta=e.meta&&e.meta.participants?this.remapBracketGameMeta(e.meta):e.meta,t.fixtures=e.fixtures?this.remapBracketGameFixtures(e.fixtures):e.fixtures,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapPredictionToRequestBody=e=>e.map(t=>({match_id:t.matchId,participant_one:t.participantOne,participant_two:t.participantTwo,winner:t.winner}));remapPrediction=e=>{let t=new Ur;return t.id=e.id,t.profileId=e.profile_id,t.gameId=e.game_id,t.totalPoints=e.total_points,t.gamePoints=e.game_points,t.bonusPoints=e.bonus_points,t.position=e.position,t.status=e.status,t.fixtures=this.remapPredictionFixtures(e.fixtures),t.tiebreaker=e.tiebreaker?this.remapPredictionTiebreaker(e.tiebreaker):e.tiebreaker,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapPredictionsForUser=e=>{let t=new Lr;return t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.data=e.data.map(a=>this.remapPrediction(a)),t};remapRankings=e=>{let t=new Br;return t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.data=e.data.map(a=>this.remapPrediction(a)),t};remapRelated=e=>e.map(t=>{let a=new we;return a.entityId=t.entity_id,a.entityType=t.entity_type,a.entityRelationship=t.entity_relationship,a});remapPredictionFixtures=e=>e.map(t=>{let a=new Gr;return a.matchId=t.match_id,a.participantOne=t.participant_one,a.participantTwo=t.participant_two,a.winner=t.winner,a.correct=t.correct,a});remapPredictionTiebreaker=e=>{let t=new hi;return t.statTotal=e.stat_total,t};remapBracketGameMeta=e=>{let t=new ui;return t.participants=e.participants.map(a=>{let i=new kr;return i.id=a.id,i.name=a.name,i.group=a.group,i.image=a.image,i.undecided=a.undecided,i}),t};remapBracketGameFixtures=e=>e.map(t=>{let a=new Ar;return a.matchId=t.match_id,a.participantOne=t.participant_one,a.participantTwo=t.participant_two,a.winner=t.winner,a.homeParticipant=t.home_participant,a.startDate=t.start_date,a.score=t.score?this.remapBracketGameFixturesScore(t.score):t.score,a});remapBracketGameFixturesScore=e=>{let t=new pi;return t.participantOne=e.participant_one,t.participantTwo=e.participant_two,t};remapBracketGameTiebreaker=e=>{let t=new Nr;return t.statTiebreakerEnabled=e.stat_tiebreaker_enabled,t.statTotal=e.stat_total,t}},mi=class{participants=[]},Vr=class{id=null;title=null;description=null;rules=null;customFields=null;images=null;type="STANDING";status=null;points=null;related=[];predictionsCutoff="";meta=new mi;outcomeCount=null;outcome=[];branding=null;brandingId=null;createdAt=null;updatedAt=null},Wr=class{meta=new V;data=[]},zr=class{id=null;name=null;group=null;image=null;undecided=!1},qr=class{id="";profileId="";profileModel=null;total=0;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";standing=[];createdAt="";updatedAt=""},jr=class{meta=new V;data=[]},Qr=class{meta=new V;data=[]},Yr=class extends pe{remapBracketGames=e=>{let t=new Wr;return t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.data=e.data.map(a=>this.remapStandingGameById(a)),t};remapStandingGameById=e=>{let t=new Vr;t.id=e.id,t.title=e.title,t.description=e.description,t.rules=e.rules,t.customFields=e.custom_fields,t.images=e.images,t.type=e.type,t.status=e.status,t.points=e.points,t.related=e.related?this.remapRelated(e.related):e.related,t.predictionsCutoff=e.predictions_cutoff,t.meta=e.meta&&e.meta.participants?this.remapStandingGameMeta(e.meta):e.meta,t.outcomeCount=e.outcome_count,t.outcome=e.outcome;let a=this.remapBrandingWithId(e);return t.branding=a.branding,t.brandingId=a.brandingId,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapPrediction=e=>{let t=new qr;return t.id=e.id,t.profileId=e.profile_id,t.gameId=e.game_id,t.totalPoints=e.total_points,t.gamePoints=e.game_points,t.bonusPoints=e.bonus_points,t.position=e.position,t.status=e.status,t.standing=e.standing,t.total=e.total,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapPredictionsForUser=e=>{let t=new jr;return t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.data=e.data.map(a=>this.remapPrediction(a)),t};remapRankings=e=>{let t=new Qr;return t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.data=e.data.map(a=>this.remapPrediction(a)),t};remapRelated=e=>e.map(t=>{let a=new we;return a.entityId=t.entity_id,a.entityType=t.entity_type,a.entityRelationship=t.entity_relationship,a});remapStandingGameMeta=e=>{let t=new mi;return t.participants=e.participants.map(a=>{let i=new zr;return i.id=a.id,i.name=a.name,i.group=a.group,i.image=a.image,i.undecided=a.undecided,i}),t}},Xr=class{meta=new V;data=[]},Jr=class{statTiebreakerEnabled;statTotal},gi=class{statTotal=0},Kr=(e=>(e.ACTIVE="ACTIVE",e.WON="WON",e.LOST="LOST",e.PARTIALLY_WON="PARTIALLY_WON",e.CANCELED="CANCELED",e))(Kr||{}),Zr=class{id="";profileId="";profileModel=null;gameId="";gamePoints=null;bonusPoints=null;totalPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new gi;createdAt="";updatedAt=""},en=class{meta=new V;data=[]},tn=class{id=null;title=null;description=null;images=null;rules=null;customFields=null;type="EVENT";status=null;related=[];tiebreaker=null;predictionsCutoff=null;fixtures=[];branding=null;brandingId=null;createdAt=null;updatedAt=null},an=(e=>(e.BOOLEAN="BOOLEAN",e.NUMBER="NUMBER",e.ENUM="ENUM",e.FREE_INPUT="FREE_INPUT",e))(an||{}),Be=class{id="";question="";status="ACTIVE";voidReason=null;points=0;outcomeType=null;validOutcomes=null;outcome=null},He=class{id="";predictionType;prediction;correct=null;points=0},sn=class{meta=new V;data=[]},rn=class extends pe{remapEventGames=e=>{let t=new Xr;return t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.data=e.data.map(a=>this.remapEventGameById(a)),t};remapEventGameById=e=>{let t=new tn;t.id=e.id,t.title=e.title,t.description=e.description,t.rules=e.rules,t.customFields=e.custom_fields,t.images=e.images,t.type=e.type,t.status=e.status,t.related=e.related?this.remapRelated(e.related):e.related,t.tiebreaker=e.tiebreaker?this.remapEventGameTiebreaker(e.tiebreaker):e.tiebreaker,t.predictionsCutoff=e.predictions_cutoff;let a=this.remapBrandingWithId(e);return t.branding=a.branding,t.brandingId=a.brandingId,t.fixtures=e.fixtures?this.remapEventGameFixtures(e.fixtures):e.fixtures,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapPredictionToRequestBody=e=>e.map(t=>({id:t.id,prediction_type:t.predictionType,prediction:t.prediction}));remapPrediction=e=>{let t=new Zr;return t.id=e.id,t.profileId=e.profile_id,t.gameId=e.game_id,t.totalPoints=e.total_points,t.gamePoints=e.game_points,t.bonusPoints=e.bonus_points,t.position=e.position,t.status=e.status,t.fixtures=this.remapPredictionFixtures(e.fixtures),t.tiebreaker=e.tiebreaker?this.remapPredictionTiebreaker(e.tiebreaker):e.tiebreaker,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapPredictionsForUser=e=>{let t=new sn;return t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.data=e.data.map(a=>this.remapPrediction(a)),t};remapRankings=e=>{let t=new en;return t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.data=e.data.map(a=>this.remapPrediction(a)),t};remapRelated=e=>e.map(t=>{let a=new we;return a.entityId=t.entity_id,a.entityType=t.entity_type,a.entityRelationship=t.entity_relationship,a});remapPredictionFixtures=e=>e.map(t=>{let a=new He;switch(t.prediction_type){case"BOOLEAN":a=new He;break;case"NUMBER":a=new He;break;case"ENUM":a=new He;break;case"FREE_INPUT":a=new He;break}return a.id=t.id,a.predictionType=t.prediction_type,a.prediction=t.prediction,a.points=t.points,a.correct=t.correct,a});remapPredictionTiebreaker=e=>{let t=new gi;return t.statTotal=e.stat_total,t};remapEventGameFixtures=e=>e.map(t=>{let a=new Be;switch(t.outcome_type){case"BOOLEAN":a=new Be;break;case"NUMBER":a=new Be;break;case"ENUM":a=new Be;break;case"FREE_INPUT":a=new Be;break}return a.id=t.id,a.question=t.question,a.status=t.status,a.voidReason=t.void_reason,a.points=t.points,a.outcomeType=t.outcome_type,a.validOutcomes=t.valid_outcomes,a.outcome=t.outcome,a});remapEventGameTiebreaker=e=>{let t=new Jr;return t.statTiebreakerEnabled=e.stat_tiebreaker_enabled,t.statTotal=e.stat_total,t}},nn={id:"",profile_id:"",total_points:null,game_points:null,bonus_points:null,position:null,status:"ACTIVE",game_id:"",fixtures:[],tiebreaker:{stat_total:0},updated_at:"",created_at:""},jt=class extends se{bracketGameRemapper=null;standingGameRemapper=null;eventGameRemapper=null;constructor(e){super(e,ee(e.environment,"predictor")),this.bracketGameRemapper=new Hr,this.standingGameRemapper=new Yr,this.eventGameRemapper=new rn}getBracketGames=async(e,t)=>{let a=e?`/custom/bracket${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/bracket${this.apiSignInUrl}`;S(t)&&(a+=E());let i="There was a problem with fetching bracket games list",s=await this.fetchWithoutAuth(a,i);return this.bracketGameRemapper.remapBracketGames(s)};getBracketGameById=async(e,t)=>{let a=S(t)?`/custom/bracket/${e}${this.apiSignInUrl}${E()}`:`/custom/bracket/${e}${this.apiSignInUrl}`,i="There was a problem with fetching bracket game with the following ID: "+e,s=await this.fetchWithoutAuth(a,i);return this.bracketGameRemapper.remapBracketGameById(s)};makeBracketGamePrediction=async(e,t)=>{let a=`/custom/bracket/${e}/predictions${this.apiSignInUrl}`,i="There was a problem with making prediction for bracket game with the following ID: "+e,s="POST",r=JSON.parse(JSON.stringify(t));r.fixtures=this.bracketGameRemapper.remapPredictionToRequestBody(t.fixtures),t.tiebreaker&&(r.tiebreaker={stat_total:t.tiebreaker.statTotal});let n=await this.fetchWithAuth(a,i,s,r);return this.bracketGameRemapper.remapPrediction(n)};updateBracketGamePrediction=async(e,t,a)=>{let i=`/custom/bracket/${e}/predictions/${t}${this.apiSignInUrl}`,s="There was a problem with updating prediction for bracket game with the following ID: "+e,r="PUT",n=JSON.parse(JSON.stringify(a));n.fixtures=this.bracketGameRemapper.remapPredictionToRequestBody(a.fixtures),a.tiebreaker&&(n.tiebreaker={stat_total:a.tiebreaker.statTotal});let o=await this.fetchWithAuth(i,s,r,n);return this.bracketGameRemapper.remapPrediction(o)};getBracketGamePredictionsForUser=async(e,t,a,i)=>{let s=a?`/custom/bracket/${e}/predictions${this.apiSignInUrl}&profile_id=${t}${a.constructMainFiltersUrl()}`:`/custom/bracket/${e}/predictions${this.apiSignInUrl}&profile_id=${t}`;S(i)&&(s+=E());let r=`There was a problem with getting all predictions for user with ID ${t} for bracket game with ID ${e}`,n=await this.fetchWithoutAuth(s,r);return this.bracketGameRemapper.remapPredictionsForUser(n)};getBracketGamePredictionById=async(e,t,a)=>{S(a)?`${e}${t}${this.apiSignInUrl}${E()}`:`${e}${t}${this.apiSignInUrl}`;let i=JSON.parse(JSON.stringify(nn));return i.id=t,i.game_id=e,i.tiebreaker=null,Promise.resolve(this.bracketGameRemapper.remapPrediction(i))};getBracketGameRankings=async(e,t,a)=>{let i=t?`/custom/bracket/${e}/ranking${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/bracket/${e}/ranking${this.apiSignInUrl}`;S(a)&&(i+=E());let s=`There was a problem with getting rankings for bracket game with ID ${e}`,r=await this.fetchWithoutAuth(i,s);return this.bracketGameRemapper.remapRankings(r)};getStandingsGames=async(e,t)=>{let a=e?`/custom/standing${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/standing${this.apiSignInUrl}`;S(t)&&(a+=E());let i="There was a problem with fetching standings games list",s=await this.fetchWithoutAuth(a,i);return this.standingGameRemapper.remapBracketGames(s)};getStandingGameById=async(e,t)=>{let a=S(t)?`/custom/standing/${e}${this.apiSignInUrl}${E()}`:`/custom/standing/${e}${this.apiSignInUrl}`,i="There was a problem with fetching standing game with the following ID: "+e,s=await this.fetchWithoutAuth(a,i);return this.standingGameRemapper.remapStandingGameById(s)};makeStandingGamePrediction=async(e,t)=>{let a=`/custom/standing/${e}/predictions${this.apiSignInUrl}`,i="There was a problem with making prediction for standing game with the following ID: "+e,s="POST",r={standing:t},n=await this.fetchWithAuth(a,i,s,r);return this.standingGameRemapper.remapPrediction(n)};updateStandingGamePrediction=async(e,t,a)=>{let i=`/custom/standing/${e}/predictions/${t}${this.apiSignInUrl}`,s="There was a problem with updating prediction for standing game with the following ID: "+e,r="PUT",n={standing:a},o=await this.fetchWithAuth(i,s,r,n);return this.standingGameRemapper.remapPrediction(o)};getStandingGamePredictionsForUser=async(e,t,a)=>{let i=`/custom/standing/${e}/predictions${this.apiSignInUrl}&profile_id=${t}`;S(a)&&(i+=E());let s=`There was a problem with getting prediction for user with ID ${t} for standing game with ID ${e}`,r=await this.fetchWithoutAuth(i,s);return this.standingGameRemapper.remapPredictionsForUser(r)};getStandingGameRankings=async(e,t,a)=>{let i=t?`/custom/standing/${e}/ranking${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/standing/${e}/ranking${this.apiSignInUrl}`;S(a)&&(i+=E());let s=`There was a problem with getting rankings for standing game with ID ${e}`,r=await this.fetchWithoutAuth(i,s);return this.standingGameRemapper.remapRankings(r)};getEventGames=async(e,t)=>{let a=e?`/custom/event${this.apiSignInUrl}${e.constructMainFiltersUrl()}`:`/custom/event${this.apiSignInUrl}`;S(t)&&(a+=E());let i="There was a problem with fetching event games list",s=await this.fetchWithoutAuth(a,i);return this.eventGameRemapper.remapEventGames(s)};getEventGameById=async(e,t)=>{let a=S(t)?`/custom/event/${e}${this.apiSignInUrl}${E()}`:`/custom/event/${e}${this.apiSignInUrl}`,i="There was a problem with fetching event game with the following ID: "+e,s=await this.fetchWithoutAuth(a,i);return this.eventGameRemapper.remapEventGameById(s)};makeEventGamePrediction=async(e,t)=>{let a=`/custom/event/${e}/predictions${this.apiSignInUrl}`,i="There was a problem with making prediction for event game with the following ID: "+e,s="POST",r=JSON.parse(JSON.stringify(t));r.fixtures=this.eventGameRemapper.remapPredictionToRequestBody(t.fixtures),t.tiebreaker&&(r.tiebreaker={stat_total:t.tiebreaker.statTotal});let n=await this.fetchWithAuth(a,i,s,r);return this.eventGameRemapper.remapPrediction(n)};updateEventGamePrediction=async(e,t,a)=>{let i=`/custom/event/${e}/predictions/${t}${this.apiSignInUrl}`,s="There was a problem with updating prediction for event game with the following ID: "+e,r="PUT",n=JSON.parse(JSON.stringify(a));n.fixtures=this.eventGameRemapper.remapPredictionToRequestBody(a.fixtures),a.tiebreaker&&(n.tiebreaker={stat_total:a.tiebreaker.statTotal});let o=await this.fetchWithAuth(i,s,r,n);return this.eventGameRemapper.remapPrediction(o)};getEventGamePredictionsForUser=async(e,t,a,i)=>{let s=a?`/custom/event/${e}/predictions${this.apiSignInUrl}&profile_id=${t}${a.constructMainFiltersUrl()}`:`/custom/event/${e}/predictions${this.apiSignInUrl}&profile_id=${t}`;S(i)&&(s+=E());let r=`There was a problem with getting all predictions for user with ID ${t} for event game with ID ${e}`,n=await this.fetchWithoutAuth(s,r);return this.eventGameRemapper.remapPredictionsForUser(n)};getEventGameRankings=async(e,t,a)=>{let i=t?`/custom/event/${e}/ranking${this.apiSignInUrl}${t.constructMainFiltersUrl()}`:`/custom/event/${e}/ranking${this.apiSignInUrl}`;S(a)&&(i+=E());let s=`There was a problem with getting rankings for event game with ID ${e}`,r=await this.fetchWithoutAuth(i,s);return this.eventGameRemapper.remapRankings(r)}},fi=class{id=null;name=null;nickname=null;avatar=null;gender=null;country=null;birthDate=null;verified=!1;staffMember=!1;anonymous=!1;disabled=!1;interests=[];followingCount=0;followersCount=0},on=class extends fi{email=null;phoneNumber=null;phoneCountryCode=null;preferences=null;consentIds=null},ln=class{profilesFromResponse=e=>e?e.map(t=>this.publicProfileFromResponse(t)):null;fullProfileFromResponse=e=>{let t=new on;return t.id=e.id,t.name=e.name,t.email=e.email,t.nickname=e.nickname,t.avatar=e.avatar,t.gender=e.gender,t.country=e.country,t.birthDate=e.birth_date,t.phoneCountryCode=e.phone_country_code,t.phoneNumber=e.phone_number,t.verified=e.verified,t.staffMember=e.staff_member,t.anonymous=e.anonymous,t.disabled=e.disabled,t.interests=e.interests?e.interests:[],t.preferences=e.preferences?this.remapPreferences(e.preferences):[],t.consentIds=e.consent_ids?e.consent_ids:[],t.followingCount=e.following_count,t.followersCount=e.followers_count,t};publicProfileFromResponse=e=>{let t=new fi;return t.id=e.id,t.name=e.name,t.nickname=e.nickname,t.avatar=e.avatar,t.gender=e.gender,t.country=e.country,t.birthDate=e.birth_date,t.verified=e.verified,t.staffMember=e.staff_member,t.anonymous=e.anonymous,t.disabled=e.disabled,t.interests=e.interests?e.interests:[],t.followingCount=e.following_count,t.followersCount=e.followers_count,t};remapPreferences=e=>e.map(t=>({preferenceId:t.preference_id,categories:t.categories,source:t.source}))},ie=class{meta=new V;data=[]},cn=class{avatar=null;followingId=null;name=null;nickname=null;profileId=null},dn=class{followResponse=e=>e.map(t=>this.remapResponse(t));followingFromResponse=e=>{let t=new ie;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(a=>this.remapResponse(a)),t};remapResponse=e=>{let t=new cn;return t.avatar=e.avatar,t.followingId=e.following_id,t.name=e.name,t.profileId=e.profile_id,t.nickname=e.nickname,t}},pn=class{avatar=null;followerId=null;name=null;nickname=null;profileId=null},un=class{followsMe=[];iFollow=[];followsMeBack=[]},hn=class{followersFromResponse=e=>{let t=new ie;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(a=>this.remapResponse(a)),t};followStatusFromResponse=e=>{let t=new un;return t.iFollow=e.i_follow,t.followsMe=e.follows_me,t.followsMeBack=e.follows_me_back,t};remapResponse=e=>{let t=new pn;return t.avatar=e.avatar,t.followerId=e.follower_id,t.name=e.name,t.profileId=e.profile_id,t}},Ma=class{profile_ids=[]},mn=class{leadId=null;profileId=null;firstName=null;lastName=null;fullName=null;email=null;gender=null;country=null;phoneCountryCode=null;phoneNumber=null;campaignId=null;campaignName=null;contentType=null;contentId=null;contentName=null;customFields=null},gn=class{toRequest(e){return{first_name:e.firstName||null,last_name:e.lastName||null,full_name:e.fullName||null,email:e.email||null,gender:e.gender||null,country:e.country||null,phone_country_code:e.phoneCountryCode||null,phone_number:e.phoneNumber||null,campaign_id:e.campaignId||null,campaign_name:e.campaignName||null,content_type:e.contentType||null,content_id:e.contentId||null,content_name:e.contentName||null,custom_fields:e.customFields||null}}fromResponse(e){let t=new mn;return t.leadId=e.lead_id,t.profileId=e.profile_id,t.firstName=e.first_name,t.lastName=e.last_name,t.fullName=e.full_name,t.email=e.email,t.gender=e.gender,t.country=e.country,t.phoneCountryCode=e.phone_country_code,t.phoneNumber=e.phone_number,t.campaignId=e.campaign_id,t.campaignName=e.campaign_name,t.contentId=e.content_id,t.contentType=e.content_type,t.contentName=e.content_name,t.customFields=e.custom_fields,t}},fn=class{consentId="";entityId=null;entityType=null;content=null;consentedAt=""},yn=class{toRequest(e){return{consent_data:e.map(t=>({consent_id:t.consentId,entity_id:t.entityId||null,entity_type:t.entityType||null,content:t.content||null}))}}fromResponse(e){return e.map(t=>{let a=new fn;return a.consentId=t.consent_id,a.entityId=t.entity_id,a.entityType=t.entity_type,a.content=t.content,a.consentedAt=t.consented_at,a})}},wn=class{id="";datetime="";status="available"},_n=class{fromResponse(e){return e.map(t=>{let a=new wn;return a.id=t.id,a.datetime=t.datetime,a.status=t.status,a})}},vn="/countries",j="/profile",it="/profiles",yi=class extends se{profileRemapper=null;followingRemapper=null;followersRemapper=null;leadRemapper=null;consentRemapper=null;externalActivityRemapper=null;lang=null;limitIds=100;constructor(e){super(e,ee(e.environment,"profile")),this.lang=e.lang,this.profileRemapper=new ln,this.followingRemapper=new dn,this.followersRemapper=new hn,this.leadRemapper=new gn,this.consentRemapper=new yn,this.externalActivityRemapper=new _n}getCountries=async e=>{let t=`&lang=${this.lang}`,a=`${vn}${this.apiSignInUrl}${t}`,i=Date.now();return e&&(a+=`&disable_cache=${i}`),(await this.fetchWithoutAuth(a,"There was a problem fetching profile countries")).data};getProfile=async e=>{let t=`${j}${this.apiSignInUrl}`,a="";if(e){t=`${it}/${e}${this.apiSignInUrl}`,a=`There was a problem fetching the following profile: ${e}`;let i=await this.fetchWithoutAuth(t,a);return this.profileRemapper.publicProfileFromResponse(i.data)}else{a="There was a problem fetching your profile from API";let i=await this.fetchWithAuth(t,a);return this.profileRemapper.fullProfileFromResponse(i.data)}};getProfiles=async(e,t,a)=>{let i=Date.now(),s=`There was a problem fetching the following profiles: ${e.join(",")}`;if(e&&e.length){if(e.length>this.limitIds){let c=[],d=Fe(e,this.limitIds);for(let p of d){let m=`${it}${this.apiSignInUrl}&profile_ids=${p.join(",")}`;s=`There was a problem fetching the following profiles: ${p.join(",")}`,a&&(m+=`&disable_cache=${i}`);let u=await this.fetchWithoutAuth(m,s);c.push(...this.profileRemapper.profilesFromResponse(u.data))}return c}let o=`${it}${this.apiSignInUrl}&profile_ids=${e.join(",")}`;a&&(o+=`&disable_cache=${i}`);let l=await this.fetchWithoutAuth(o,s);return this.profileRemapper.profilesFromResponse(l.data)}let r=`${it}${this.apiSignInUrl}&search=${t}`;a&&(r+=`&disable_cache=${i}`);let n=await this.fetchWithoutAuth(r,s);return this.profileRemapper.profilesFromResponse(n.data)};getFollowers=async(e,t)=>{let a=`${j}/followers${this.apiSignInUrl}`,i="There was a problem fetching the followers for own profile";if(e&&!t){a=`${j}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`;let r=await this.fetchWithAuth(a,i);return this.followersRemapper.followersFromResponse(r)}else if(!e&&!t){let r=await this.fetchWithAuth(a,i);return this.followersRemapper.followersFromResponse(r)}e&&t?a=`${j}/${t}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`:!e&&t&&(a=`${j}/${t}/followers${this.apiSignInUrl}`),i=`There was a problem fetching the followers for profile: ${t}`;let s=await this.fetchWithoutAuth(a,i);return this.followersRemapper.followersFromResponse(s)};getFollowing=async(e,t)=>{let a=`${j}/following${this.apiSignInUrl}`,i="There was a problem fetching the followers of own profile";if(e&&!t){a=`${j}/following${this.apiSignInUrl}${e.constructFilterUrl()}`;let r=await this.fetchWithAuth(a,i);return this.followingRemapper.followingFromResponse(r)}else if(!e&&!t){let r=await this.fetchWithAuth(a,i);return this.followingRemapper.followingFromResponse(r)}e&&t?a=`${j}/${t}/following${this.apiSignInUrl}${e.constructFilterUrl()}`:!e&&t&&(a=`${j}/${t}/following${this.apiSignInUrl}`),i=`There was a problem fetching the followers of the following profile: ${t}`;let s=await this.fetchWithoutAuth(a,i);return this.followingRemapper.followingFromResponse(s)};follow=async e=>{let t=new Ma;t.profile_ids=e;let a=j+`/follow${this.apiSignInUrl}`,i=`There was a problem with following profiles: ${e.join(",")}`,s="POST",r=await this.fetchWithAuth(a,i,s,t);return this.followingRemapper.followResponse(r.data)};unfollow=async e=>{let t=new Ma;t.profile_ids=e;let a=j+`/follow${this.apiSignInUrl}`,i=`There was a problem with unfollowing profiles: ${e.join(",")}`;return await this.fetchWithAuth(a,i,"DELETE",t),!0};getBadges=async e=>{let t=`${j}/badges${this.apiSignInUrl}`,a="There was a problem with fetching own badges";return e?(t=`${j}/${e}/badges${this.apiSignInUrl}`,a="There was a problem with fetching the badges",(await this.fetchWithoutAuth(t,a)).data):(await this.fetchWithAuth(t,a)).data};updateProfile=async e=>{let t=j+this.apiSignInUrl,a="There was a problem updating the own profile",i="PATCH",s=await this.fetchWithAuth(t,a,i,e);return this.profileRemapper.fullProfileFromResponse(s.data)};collectLead=async e=>{let t=`/leads${this.apiSignInUrl}`,a="There was a problem collecting lead",i="POST",s=await this.fetchWithAuth(t,a,i,this.leadRemapper.toRequest(e));return this.leadRemapper.fromResponse(s.data)};collectConsents=async e=>{let t=j+`/consents${this.apiSignInUrl}`,a="There was a problem collecting consents",i="POST",s=await this.fetchWithAuth(t,a,i,this.consentRemapper.toRequest(e));return this.consentRemapper.fromResponse(Array.isArray(s)?s:s.data)};checkFollowStatus=async e=>{let t=`/profile/followers/check-follow-status${this.apiSignInUrl}&profile_ids=${e.join(",")}`,a="There was a problem checking follow status for profiles",i=await this.fetchWithAuth(t,a);return this.followersRemapper.followStatusFromResponse(i.data)};deleteOwnProfile=async()=>{let e=`/profile${this.apiSignInUrl}`;await this.fetchWithAuth(e,"There was a problem deleting own profile","DELETE")};deleteUserData=async()=>{let e=`/user-data${this.apiSignInUrl}`;await this.fetchWithAuth(e,"There was a problem deleting profile data","DELETE")};getOwnExternalActivities=async()=>{let e=`/external-activities${this.apiSignInUrl}`,t="There was a problem getting own profile's external activities",a=await this.fetchWithAuth(e,t);return this.externalActivityRemapper.fromResponse(a.data?a.data.external_activities:a.external_activities)};getConsents=async()=>{let e=j+`/consents${this.apiSignInUrl}`,t="There was a problem getting own profile's consents",a=await this.fetchWithAuth(e,t);return this.consentRemapper.fromResponse(a.data)};deleteConsent=async e=>{let t=j+`/consents/${e}${this.apiSignInUrl}`,a="There was a problem deleting profile's consent: "+e;return await this.fetchWithAuth(t,a,"DELETE"),!0}},ce=class{completed=!1;percentage;constructor(e){this.percentage=e}},In=class{teamFollowed=new ce(10);teamFavourite=new ce(15);playerFollowed=new ce(10);playerFavourite=new ce(10);competitionFollowed=new ce(10);competitionFavourite=new ce(5);addedBirthdate=new ce(10);addedGender=new ce(10);addedCountry=new ce(10);addedAvatar=new ce(10)},Tn=class{totalPercentage;breakdown=new In},Oa=class{limit=0;startAfter=null;constructor(e){this.limit=e.limit?e.limit:20,this.startAfter=e.startAfter?e.startAfter:null}constructFilterUrl=()=>{let e="";return this.limit&&(e=e+"&",e=e+`limit=${this.limit}`),this.startAfter&&(e=e+"&",e=e+`start_after=${this.startAfter}`),e}},x=class extends Error{code=0;status=null;message=null;constructor(e,t,a){super(),this.code=e,this.status=t,this.message=a}errorMessage=()=>this.message},Tt=class{localCache;profileHttps=null;activityHttps=null;errorHandlingMode=null;constructor(e,t,a,i){this.localCache=e,this.profileHttps=t,this.activityHttps=a,this.errorHandlingMode=i}getOwn=async()=>{let e=await this.getLocalStorageData("profile");if(e&&Object.keys(e).length)return JSON.parse(JSON.stringify(e));try{let t=await this.profileHttps.getProfile();return await this.localCache.setOwnProfile(t),t}catch(t){throw console.warn("There was a problem retrieving your profile: ",t),t}};getOwnProfileFromCache=async()=>await this.localCache.getOwnProfile();updateOwnProfile=async()=>{try{let e=await this.profileHttps.getProfile();return await this.localCache.setOwnProfile(e),e}catch(e){throw console.warn("There was a problem retrieving your profile: ",e),e}};getByIds=async(e,t,a)=>{if(e&&e.length>0&&t||!e&&e.length===0&&!t)throw new O(400,"invalid_method_call","The method 'getByIds' from Profile namespace is not called correctly. You need to provide 'profileIds' OR 'search' parameters to the method, but you can't use both of them or neither of them.");try{return await this.profileHttps.getProfiles(e,t,a)}catch(i){throw console.warn(`There was a problem retrieving the selected profiles: ${e.join(",")} `,i),i}};getById=async e=>{try{return await this.profileHttps.getProfile(e)}catch(t){throw console.warn(`There was a problem retrieving the selected profile: ${e} `,t),t}};getCountries=async e=>{e=e||!1;let t=await this.localCache.getProfileCountries();if(t&&t.length>0)return t;try{let a=await this.profileHttps.getCountries(e);return await this.localCache.setProfileCountries(a),a}catch(a){throw console.warn("There was a problem retrieving profile countries: ",a),a}};getFollowers=async(e,t)=>{try{e&&(e=new Oa(e));let a=await this.profileHttps.getFollowers(e,t),i=a.data.map(s=>s.followerId);if(i.length){let s=await this.getByIds(i),r=a.data.map(n=>(s.forEach(o=>{n.followerId===o.id&&(n.name=o.name,n.nickname=o.nickname,n.avatar=o.avatar)}),n));return a.data=r,a}return a}catch(a){throw console.warn("There was a problem retrieving your followers: ",a),a}};getFollowing=async(e,t)=>{try{e&&(e=new Oa(e));let a=await this.profileHttps.getFollowing(e,t),i=a.data.map(s=>s.followingId);if(i.length){let s=await this.getByIds(i),r=a.data.map(n=>(s.forEach(o=>{n.followingId===o.id&&(n.name=o.name,n.nickname=o.nickname,n.avatar=o.avatar)}),n));return a.data=r,a}return a}catch(a){throw console.warn("There was a problem retrieving your following profiles: ",a),a}};follow=async e=>{try{return await this.profileHttps.follow(e)}catch(t){throw console.warn(`There was a problem following profiles: ${e.join(",")} `,t),t}};unfollow=async e=>{try{return await this.profileHttps.unfollow(e)}catch(t){throw console.warn(`There was a problem unfollowing profiles: ${e.join(",")} `,t),t}};showFullnessProfile=e=>{let t=new Tn,a=0;return e.avatar&&(t.breakdown.addedAvatar.completed=!0,a+=t.breakdown.addedAvatar.percentage),e.birthDate&&(t.breakdown.addedBirthdate.completed=!0,a+=t.breakdown.addedBirthdate.percentage),e.country&&(t.breakdown.addedCountry.completed=!0,a+=t.breakdown.addedCountry.percentage),e.gender&&(t.breakdown.addedGender.completed=!0,a+=t.breakdown.addedGender.percentage),e.interests&&e.interests.length>0&&(e.interests.find(i=>i.type==="team"&&i.favourite)&&(t.breakdown.teamFavourite.completed=!0,a+=t.breakdown.teamFavourite.percentage),e.interests.find(i=>i.type==="team")&&(t.breakdown.teamFollowed.completed=!0,a+=t.breakdown.teamFollowed.percentage),e.interests.find(i=>i.type==="player"&&i.favourite)&&(t.breakdown.playerFavourite.completed=!0,a+=t.breakdown.playerFavourite.percentage),e.interests.find(i=>i.type==="player")&&(t.breakdown.playerFollowed.completed=!0,a+=t.breakdown.playerFollowed.percentage),e.interests.find(i=>i.type==="competition"&&i.favourite)&&(t.breakdown.competitionFavourite.completed=!0,a+=t.breakdown.competitionFavourite.percentage),e.interests.find(i=>i.type==="competition")&&(t.breakdown.competitionFollowed.completed=!0,a+=t.breakdown.competitionFollowed.percentage)),t.totalPercentage=a,t};getStats=async()=>{let e=await this.getLocalStorageData("statistics");if(e&&Object.keys(e).length)return JSON.parse(JSON.stringify(e));try{let t=await this.activityHttps.getStats();return await this.localCache.setProfileStats(t),t}catch(t){throw console.warn("There was a problem retrieving own profile statistics: ",t),t}};getBadges=async e=>{if(e)try{return await this.profileHttps.getBadges()}catch(a){throw console.warn("There was a problem retrieving own profile badges: ",a),a}let t=await this.getLocalStorageData("badges");if(t)return t;try{let a=await this.profileHttps.getBadges();return await this.localCache.setProfileBadges(a),a}catch(a){throw console.warn("There was a problem retrieving own profile badges: ",a),a}};clearLocalStorageData=async()=>{await this.localCache.setOwnProfile({}),await this.localCache.setProfileStats({}),await this.localCache.setProfileBadges(null)};collectLead=async e=>{if(this.errorHandlingMode&&!e)throw this.errorHandlingMode==="standard"?new O(400,"invalid_method_call","The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method."):new x(400,"invalid_method_call","The method 'collectLead' from Profile namespace is not called correctly. You need to provide 'requestBody' parameter to the method.");return await this.profileHttps.collectLead(e)};collectConsents=async e=>{if(this.errorHandlingMode&&!e)throw this.errorHandlingMode==="standard"?new O(400,"invalid_method_call","The method 'collectConsents' from Profile namespace is not called correctly. You need to provide 'consents' parameter to the method."):new x(400,"invalid_method_call","The method 'collectConsents' from Profile namespace is not called correctly. You need to provide 'consents' parameter to the method.");return await this.profileHttps.collectConsents(e)};checkFollowStatus=async e=>{if(!e||!Array.isArray(e)||e.length===0)throw this.errorHandlingMode==="standard"?new O(400,"invalid_method_call","Invalid or empty IDs provided. Please provide at least one ID."):new x(400,"invalid_method_call","Invalid or empty IDs provided. Please provide at least one ID.");return await this.profileHttps.checkFollowStatus(e)};getLocalStorageData=async e=>{let t=Math.floor(Date.now()/1e3),a=await this.localCache.getExpiration("profile",e);switch(e){case"profile":if(a>t)return await this.localCache.getOwnProfile();case"statistics":if(a>t)return await this.localCache.getProfileStats();case"badges":if(a>t)return await this.localCache.getProfileBadges();default:return null}}},bn=class{id=null;name=null;assets=null},Pn=class{extractUpdatedProps=(e,t)=>{let a=["name","nickname","gender","avatar","email"],i={};return Object.keys(e).forEach(s=>{if(a.includes(s)&&e[s]!==t[s])i[s]=t[s];else if(s==="phoneCountryCode")e[s]&&t[s]===null?i.phone_country_code=null:(e[s]===null&&t[s]||e[s]!==t[s])&&(i.phone_country_code=t[s]);else if(s==="phoneNumber")(e[s]&&t[s]===null||e[s]===null&&t[s]||e[s]!==t[s])&&(i.phone_number=t[s]);else if(s==="birthDate")(t[s]===null||e[s]===null&&t[s]||e[s]!==t[s])&&(i.birth_date=t[s]);else if(s==="country")t[s]===null?i.country_id=t[s]:(e[s]===null&&t[s]||e[s].id!==t[s].id)&&(i.country_id=t[s].id);else if(s==="interests"){let r=e[s],n=t[s];n.length&&this.isNewInterest(r,n)?i[s]=this.updateInterests(r,n):(!n.length&&r.length||r.length!==n.length&&!this.isNewInterest(r,n))&&(i[s]=n)}}),i};updateInterests=(e,t)=>{if(e.length===t.length){let[a,i]=this.extractSameAndNewInterests(e,t);return[...i,...a]}else return t};isNewInterest=(e,t)=>{let a=!1,[i]=this.extractSameAndNewInterests(e,t);return i.length&&(a=!0),a};extractSameAndNewInterests=(e,t)=>{let a=t.filter(i=>e.some(s=>i.id===s.id&&i.type===s.type&&i.source===s.source&&i.favourite===s.favourite));return[t.filter(i=>!e.some(s=>i.id===s.id&&i.type===s.type&&i.source===s.source&&i.favourite===s.favourite)),a]};isAvatarValidURL=e=>{try{return new URL(e),!0}catch{return!1}}},En=class{idsRemapper=null;profileHttps=null;profileService=null;localCache=null;profileFacade=null;ownProfile=null;modified=!1;expireAt=0;promises=[];isFetching=!1;configuration=null;newProfileCheckResult=null;fetchProfilePromise=null;constructor(e,t,a,i,s){this.configuration=e,this.idsRemapper=t,this.localCache=a,this.profileHttps=i,this.profileService=new Pn,this.profileFacade=new Tt(a,i,s)}getOwnProfile=async()=>{for(;this.isFetching;)console.log("Another thread is fetching profile..."),await this.delay(100);if(this.modified&&this.ownProfile)return console.log("Timestamp is less than 10 minutes OR profile is modifying "),this.ownProfile;let e=Math.floor(Date.now()/1e3);if(this.newProfileCheckResult===null&&(this.newProfileCheckResult=await this.isNewProfileRequested()),!this.ownProfile||this.expireAt<e||this.newProfileCheckResult){if(this.fetchProfilePromise)return await this.fetchProfilePromise;this.fetchProfilePromise=this.doFetchProfile();try{return await this.fetchProfilePromise}finally{this.fetchProfilePromise=null}}return this.ownProfile};doFetchProfile=async()=>{this.isFetching=!0,this.expireAt=Math.floor(Date.now()/1e3)+600;try{await this.clearAllProfileData();let e=await this.profileFacade.getOwn();return this.setOwnProfile(e),this.modified=!1,this.isFetching=!1,this.ownProfile}catch(e){throw this.isFetching=!1,e}};delay=e=>new Promise(t=>{setTimeout(t,e)});setOwnProfile=e=>{this.ownProfile=e};resetProfileCheckResult=()=>{this.newProfileCheckResult=null};getInfo=async()=>{this.resetProfileCheckResult();let e=await this.getOwnProfile(),t=JSON.parse(JSON.stringify(e));return delete t.interests,t};showInterests=async()=>{this.resetProfileCheckResult();let e=await this.getOwnProfile(),t=JSON.parse(JSON.stringify(e));return await this.idsRemapper.remapInterests(t.interests)};showFullInterests=async()=>{this.resetProfileCheckResult();let e=await this.getOwnProfile(),t=JSON.parse(JSON.stringify(e));return await this.idsRemapper.showFullInterests(t.interests)};getFollowers=async e=>await this.profileFacade.getFollowers(e);getFollowing=async e=>await this.profileFacade.getFollowing(e);follow=async e=>{let t=await this.profileFacade.follow(e),a=await this.profileFacade.updateOwnProfile();return this.setOwnProfile(a),t};unfollow=async e=>{let t=await this.profileFacade.unfollow(e),a=await this.profileFacade.updateOwnProfile();return this.setOwnProfile(a),t};getStats=async()=>{await this.clearAllProfileData();let e=await this.profileFacade.getStats();return await this.idsRemapper.remapProfileStats(e)};getBadges=async e=>(await this.clearAllProfileData(),await this.profileFacade.getBadges(e));addInterestPromise=async e=>{this.modified=!0;let t={...e};await this.getOwnProfile();let a=null;e.source!=="custom"?a=await this.idsRemapper.remapInterestToNative(t):a=t;let i=this.ownProfile.interests.filter(s=>s.id!==a.id||s.type!==a.type||s.source!==a.source);return this.ownProfile.interests=[...i],this.ownProfile.interests.push(a),this};addInterest=e=>(this.promises.push(this.addInterestPromise(e)),this);removeInterestPromise=async e=>{this.modified=!0;let t={...e};await this.getOwnProfile();let a=null;return e.source!=="custom"?a=await this.idsRemapper.remapInterestToNative(t):a=t,this.ownProfile.interests=this.ownProfile.interests.filter(i=>i.id!==a.id||i.type!==a.type||i.source!==a.source),this};removeInterest=e=>(this.promises.push(this.removeInterestPromise(e)),this);setBirthdatePromise=async e=>(this.modified=!0,await this.getOwnProfile(),e?this.ownProfile.birthDate=e:this.ownProfile.birthDate=null,this);setBirthdate=e=>(this.promises.push(this.setBirthdatePromise(e)),this);setGenderPromise=async e=>(this.modified=!0,await this.getOwnProfile(),e==="male"||e==="female"?this.ownProfile.gender=e:this.ownProfile.gender="unspecified",this);setGender=e=>(this.promises.push(this.setGenderPromise(e)),this);setNicknamePromise=async e=>(this.modified=!0,await this.getOwnProfile(),this.ownProfile.nickname=e,this);setNickname=e=>(this.promises.push(this.setNicknamePromise(e)),this);setNamePromise=async e=>(this.modified=!0,await this.getOwnProfile(),this.ownProfile.name=e,this);setName=e=>(this.promises.push(this.setNamePromise(e)),this);setCountryPromise=async e=>(this.modified=!0,await this.getOwnProfile(),e&&!this.ownProfile.country?(this.ownProfile.country=new bn,this.ownProfile.country.id=e):e&&this.ownProfile.country?this.ownProfile.country.id=e:this.ownProfile.country=null,this);setCountry=e=>(this.promises.push(this.setCountryPromise(e)),this);showFullnessProfile=async()=>{this.resetProfileCheckResult();let e=await this.getOwnProfile(),t=JSON.parse(JSON.stringify(e));return this.profileFacade.showFullnessProfile(t)};setAvatarPromise=async e=>{if(this.modified=!0,await this.getOwnProfile(),this.profileService.isAvatarValidURL(e))this.ownProfile.avatar=e;else{if(this.configuration.errorHandlingMode==="default")throw new x(400,"invalid_avatar","Invalid URL syntax for avatar image.");if(this.configuration.errorHandlingMode==="standard")throw new O(400,"invalid_avatar","Invalid URL syntax for avatar image.")}return this};setAvatar=e=>(this.promises.push(this.setAvatarPromise(e)),this);delete=async()=>(await this.profileHttps.deleteOwnProfile(),await this.profileFacade.clearLocalStorageData(),!0);deleteData=async()=>(await this.profileHttps.deleteUserData(),await this.profileFacade.clearLocalStorageData(),!0);setEmailPromise=async e=>(this.modified=!0,await this.getOwnProfile(),typeof e=="string"&&e?this.ownProfile.email=e:console.warn(`Wrong email argument: ${e}. Will be ignored when updating profile`),this);setEmail=e=>(this.promises.push(this.setEmailPromise(e)),this);setPhoneCountryCodePromise=async e=>(this.modified=!0,await this.getOwnProfile(),e===null||typeof e=="string"&&e?this.ownProfile.phoneCountryCode=e:console.warn(`Wrong phoneCountryCode argument: ${e}. Will be ignored when updating profile`),this);setPhoneCountryCode=e=>(this.promises.push(this.setPhoneCountryCodePromise(e)),this);setPhoneNumberPromise=async e=>(this.modified=!0,await this.getOwnProfile(),e===null||typeof e=="string"&&e?this.ownProfile.phoneNumber=e:console.warn(`Wrong phoneNumber argument: ${e}. Will be ignored when updating profile`),this);setPhoneNumber=e=>(this.promises.push(this.setPhoneNumberPromise(e)),this);getExternalActivities=async()=>await this.profileHttps.getOwnExternalActivities();update=async()=>{if(this.promises.length===0)return this.ownProfile;await Promise.all(this.promises),this.promises=[],this.resetProfileCheckResult();let e=await this.profileFacade.getOwn(),t=await this.getOwnProfile(),a=this.profileService.extractUpdatedProps(e,t);if(this.modified=!1,this.expireAt=0,Object.keys(a).length){let s=await this.profileHttps.updateProfile(a),r=JSON.parse(JSON.stringify(s));return this.setOwnProfile(r),await this.localCache.setOwnProfile(r),delete s.interests,s}let i=JSON.parse(JSON.stringify(this.ownProfile));return delete i.interests,i};getConsents=async()=>await this.profileHttps.getConsents();deleteConsent=async e=>await this.profileHttps.deleteConsent(e);clearAllProfileData=async()=>{this.newProfileCheckResult===!0&&await this.profileFacade.clearLocalStorageData()};isNewProfileRequested=async()=>{let e=this.profileHttps.extractUserIdFromToken();if(!e)return!1;if(!this.ownProfile){let t=await this.profileFacade.getOwnProfileFromCache();return!!(t&&Object.keys(t).length&&t.id!==e)}return this.ownProfile.id!==e}},wi=class{idsRemapper=null;profileHttps=null;activityHttps=null;profileFacade=null;profileId="";localCache=null;constructor(e,t,a,i){this.idsRemapper=e,this.profileHttps=a,this.activityHttps=i,this.localCache=t,this.profileFacade=new Tt(t,a,i)}getById=e=>new wi(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps).setId(e);setId=e=>(this.profileId=e,this);getProfile=async()=>await this.profileFacade.getById(this.profileId);getInfo=async()=>{let e=await this.getProfile();return delete e.interests,e};showInterests=async()=>{let e=await this.getProfile(),t=JSON.parse(JSON.stringify(e));return await this.idsRemapper.remapInterests(t.interests)};showFullInterests=async()=>{let e=await this.getProfile(),t=JSON.parse(JSON.stringify(e));return await this.idsRemapper.showFullInterests(t.interests)};getFollowers=async e=>await this.profileFacade.getFollowers(e,this.profileId);getFollowing=async e=>await this.profileFacade.getFollowing(e,this.profileId);showFullnessProfile=async()=>{let e=await this.getProfile();return this.profileFacade.showFullnessProfile(e)};getStats=async e=>{let t=await this.activityHttps.getStats(this.profileId,e);return await this.idsRemapper.remapProfileStats(t)};getBadges=async()=>await this.profileHttps.getBadges(this.profileId)},Rn=class{localCache=null;https=null;idMapping=null;constructor(e,t,a){this.localCache=e,this.idMapping=a,this.https=t}getCountriesWithIdMapping=async e=>{try{let t=await this.getCountries(e);return this.idMapping.remapEntities(t,"country")}catch(t){throw console.warn("There was a problem browsing countries as football entities",t),t}};getCountries=async e=>{e=e||!1;let t=await this.localCache.getFootballCountries();if(t&&t.length>0)return t;try{let a=await this.https.getCountries(e);return await this.localCache.setFootballCountries(a),a}catch(a){throw console.warn("There was a problem retrieving countries as football entities",a),a}}},Fa=class{countryId=null;name=null;gender=null;type=null;sortField=null;sortOrder=null;competitionIds=null;constructor(e){this.countryId=e.countryId?`${e.countryId}`:null,this.name=e.name?e.name:null,this.gender=e.gender?e.gender:null,this.type=e.type?e.type:null,this.sortField=e.sortField?`${e.sortField}`:null,this.sortOrder=e.sortOrder?`${e.sortOrder}`:null,this.competitionIds=e.competitionIds?e.competitionIds:null}constructFilterUrl=()=>{let e="";return this.countryId&&(e=e+"&",e=e+`country_id=${this.countryId}`),this.gender&&(e=e+"&",e=e+`gender=${this.gender}`),this.type&&(e=e+"&",e=e+`type=${this.type}`),this.sortField&&(e=e+"&",e=e+`sort_field=${this.sortField}`),this.sortOrder&&(e=e+"&",e=e+`sort_order=${this.sortOrder}`),this.name&&(e=e+"&",e=e+`name=${this.name}`),this.competitionIds&&this.competitionIds.length>0&&(e=e+"&",e=e+`competition_ids=${this.competitionIds.join(",")}`),e};competitionSearchFilter=e=>{try{let t=this.filter(e);return this.sortField||this.sortOrder?this.sort(t):t}catch(t){return console.warn("There was a problem filtering the local competitions",t),[]}};filter=e=>{let t=this.entitiesToSearchWith();return e.filter(a=>{let i=!0;return t.forEach(s=>{s!=="sortOrder"&&s!=="sortField"&&(s==="countryId"?i&&=a.country.id===this[s]:s==="name"?i&&=a.name.toLocaleLowerCase().includes(this[s].toLocaleLowerCase()):s==="competitionIds"?i&&=this[s].some(r=>a.id===r):i&&=a[s].toLocaleLowerCase()===this[s].toLocaleLowerCase())}),i})};entitiesToSearchWith=()=>{let e=[];return this.countryId&&e.push("countryId"),this.name&&e.push("name"),this.gender&&e.push("gender"),this.type&&e.push("type"),this.sortField&&e.push("sortField"),this.sortOrder&&e.push("sortOrder"),this.competitionIds&&e.push("competitionIds"),e};sort=e=>{let t=[];return this.sortField==="name"?t=e.sort((a,i)=>this.sortOrder&&this.sortOrder==="desc"?i.name.localeCompare(a.name):a.name.localeCompare(i.name)):this.sortField==="country"?t=e.sort((a,i)=>this.sortOrder&&this.sortOrder==="desc"?i.country.name.localeCompare(a.country.name):a.country.name.localeCompare(i.country.name)):this.sortField==="scope"?e.forEach(a=>t[this.competitionIds.indexOf(a.id)]=a):!this.sortField&&this.sortOrder==="desc"&&(t=e.sort((a,i)=>i.id.localeCompare(a.id))),t}},Sn=class{localStorage=null;https=null;idMapping=null;constructor(e,t,a){this.localStorage=e,this.idMapping=a,this.https=t}getCompetitionsIdMapping=async(e,t)=>{try{let a=!1;if(e){if(e=new Fa(e),e.countryId){let s=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");s.country.length===0&&(a=!0),e.countryId=s.country[0]}if(e.competitionIds){let s=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");s.competition.length===0&&(a=!0),e.competitionIds=s.competition}if(a)return[]}let i=await this.getCompetitions(e,t);return await this.idMapping.remapEntities(i,"competition")}catch(a){throw console.warn("There was a problem browsing all of the competitions",a),a}};getCompetitionsMapWithNativeIds=async e=>{let t=new Map,a=e.length,i=new Fa({competitionIds:e,limit:a}),s=await this.getCompetitions(i);s.sort((o,l)=>o.id.localeCompare(l.id));let r=ja(e),n=await this.idMapping.remapEntities(s,"competition");return r.forEach((o,l)=>t.set(o,n[l])),t};getCompetitions=async(e,t)=>{let a=null;if(!await this.localStorage.getCompetitionsLength()){try{a=await this.https.getCompetitions()}catch(i){throw console.warn("There was a problem retrieving all competitions",i),i}await this.localStorage.setCompetitions(a)}return await this.localStorage.getCompetitions(e)};getCompetitionByIdIdMapping=async(e,t)=>{try{let a=(await this.idMapping.getEntityIdsBySchemaId([e],"competition","native")).competition[0],i=await this.getCompetitionById(a,t);return await this.idMapping.remapEntities(i,"competition")}catch(a){throw console.warn(`There was a problem browsing the following competition:${e}`,a),a}};getCompetitionById=async(e,t)=>{try{return t=t||!1,await this.https.getCompetitionById(e,t)}catch(a){throw console.warn(`There was a problem retrieving the competition with the following id: ${e}`,a),a}};getTopCompetitionsIdMapping=async e=>{try{let t=await this.getTopCompetitions(e);return await this.idMapping.remapEntities(t,"competition")}catch(t){throw console.warn("There was a problem browsing the top competitions",t),t}};getTopCompetitions=async e=>{try{return e=e||!1,await this.https.getTopCompetitions(e)}catch(t){throw console.warn("There was a problem retrieving the top competitions",t),t}}},Aa=class{name=null;countryId=null;national=!1;gender=null;limit=null;page=null;scope=null;sortField=null;sortOrder=null;teamIds=null;constructor(e){this.name=e.name?e.name:null,this.countryId=e.countryId?`${e.countryId}`:null,this.national=e.national?e.national:!1,this.gender=e.gender?e.gender:null,this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null,this.scope=e.scope?e.scope:null,this.sortField=e.sortField?`${e.sortField}`:null,this.sortOrder=e.sortOrder?`${e.sortOrder}`:null,this.teamIds=e.teamIds?e.teamIds:null}constructFilterUrl=()=>{let e="";return this.name&&(e=e+"&",e=e+`name=${this.name}`),this.countryId&&(e=e+"&",e=e+`country_id=${this.countryId}`),this.national&&(e=e+"&",e=e+`national=${this.national}`),this.gender&&(e=e+"&",e=e+`gender=${this.gender}`),this.limit&&(e=e+"&",e=e+`limit=${this.limit}`),this.scope&&this.scope.length>0&&(e=e+"&",e=e+`scope=${this.scope.join(",")}`),this.page&&(e=e+"&",e=e+`page=${this.page}`),this.sortField&&(e=e+"&",e=e+`sort_field=${this.sortField}`),this.sortOrder&&(e=e+"&",e=e+`sort_order=${this.sortOrder}`),this.teamIds&&this.teamIds.length>0&&(e=e+"&",e=e+`team_ids=${this.teamIds.join(",")}`),e}},Cn=class{reason="";words=[]},_i=class{enabled=!1;moderateLinks=!1;linksWhitelist=[];moderatorProfileId="";dictionary=new Cn},Mn=class{enabled=!1;clientId=null;automaticModeration=new _i},Qt=class{points=null;gameParticipationCount=null;entityId=null;entityType=null;predictionsMade=null;correctPredictions=null},On=class{id;weight;multiplier;conditions},vi=class{value=[new On]},Ii=class{points=null;tiers=null;badges=null},Fn=class{enabled=!1;clientId=null;conditions={list:null};actions=new vi;rewards=new Ii},An=class{general=null;predictor=null;activity=null;topX=null;matchQuiz=null;discussionPost=null},Ti=class{enabled=!1;clientId=null;defaultMarkets=null;competitionsWhitelist=null;authRequirement=null},bi=class{enabled=!1;clientId=null;minFixtures=null;maxFixtures=null;competitionsWhitelist=null;authRequirement=null},kn=class{competitions=[];teams=[];markets=[]},Pi=class{enabled=!1;clientId=null;fullCoverageCompetitions=null;markets=null;successRateScopes=new kn;userDataConfig=null},Dn=class{storeIp=!1;storeDeviceId=!1;storeAgent=!1},Ln=class{potm=[];poll=[]},xn=class{predictor=[];topX=[];matchQuiz=[];games=[];football=[];classicQuizzes=[];eitherOr=[];discussions=[];voting=new Ln},be=class{id;label;description;flags;assets={mainImageUrl:""};enabled},Nn=class{predictionsNumber;correctPredictions;points;fromDate;toDate},Gn=class extends be{requirements=new Nn},$n=class{participationCount;points;fromDate;toDate},Un=class extends be{requirements=new $n},Bn=class{participationCount;points;specificGames;fromDate;toDate},Hn=class extends be{requirements=new Bn},Vn=class{predictionsNumber;correctPredictions;points;entityId;entityType;entityModel=null},Wn=class extends be{requirements=new Vn},zn=class{participationCount;fromDate;toDate},qn=class extends be{requirements=new zn},jn=class{totalDiscussionPoints;postsCount;postPoints;reactionsCount},Qn=class extends be{requirements=new jn},Yn=class{points;voteCount;entityId;entityType;entityModel},Xn=class extends be{requirements=new Yn},Ei=class{points=null;tiers=null;badges=null},Jn=class{enabled=!1;clientId=null;conditions={list:null};actions=new vi;rewards=new Ei},Kn=class{general=[];predictor=[];topX=[];matchQuiz=[]},Zn=class{id;label;assets={mainImageUrl:""};enabled;requirements=new Qt},Ri=class extends Qt{postPoints=null;postsCount=null;reactionsCount=null;totalDiscussionPoints=null},eo=class{id;label;assets={mainImageUrl:""};enabled;requirements=new Ri},Si=class{assists=null;shots=null;offsides=null;tackles=null;saves=null;minutesEqualOrOver60=null;minutesUnder60=null;yellowCards=null;redCards=null;goalsGoalkeeper=null;goalsDefender=null;goalsMidfielder=null;goalsForwards=null;penaltyGoals=null;ownGoals=null;cleanSheetsGoalkeeper=null;cleanSheetsDefender=null;cleanSheetsMidfielder=null;cleanSheetsForwards=null;shotsOn=null;foulsCommitted=null;penaltyCommitted=null;penaltyWon=null;penaltyMissed=null;concededGoals=null;caughtBall=null},Ci=class{total=null;minGoalkeepers=null;maxGoalkeepers=null;minDefenders=null;maxDefenders=null;minMidfielders=null;maxMidfielders=null;minStrikers=null;maxStrikers=null},to=class{enabled=!1;clientId=null;addPointsToProfileTotal=!1;coefficients=new Si;players=new Ci;multipliers=null;competitionsWhitelist=[]},ao=class{captain=null;viceCaptain=null},io=class{remapPredictorConfig=e=>{let t=new Pi;return t.enabled=e.enabled,t.clientId=e.client_id,t.fullCoverageCompetitions=e.full_coverage_competitions,t.markets=e.markets,t.successRateScopes=e.success_rate_scopes,t.userDataConfig=e.user_data_config?this.remapUserDataConfig(e.user_data_config):null,t};remapTopXConfig=e=>{let t=new bi;return t.enabled=e.enabled,t.clientId=e.client_id,t.minFixtures=e.min_fixtures,t.maxFixtures=e.max_fixtures,t.competitionsWhitelist=e.competitions_whitelist,t.authRequirement=e.auth_requirement,t};remapMatchQuizConfig=e=>{let t=new Ti;return t.enabled=e.enabled,t.clientId=e.client_id,t.defaultMarkets=e.default_markets,t.competitionsWhitelist=e.competitions_whitelist,t.authRequirement=e.auth_requirement,t};remapLoyaltyConfig=e=>{let t=new Fn;return t.enabled=e.enabled,t.clientId=e.client_id,t.conditions.list=e.conditions.list,t.actions.value=e.actions.value,t.rewards=this.remapRewards(e.rewards),t};remapLoyaltyNewConfig=e=>{let t=new Jn;return t.enabled=e.enabled,t.clientId=e.client_id,t.conditions.list=e.conditions.list,t.actions.value=e.actions.value,t.rewards=this.remapNewRewards(e.rewards),t};remapDiscussionsConfig=e=>{let t=new Mn;return t.enabled=e.enabled,t.clientId=e.client_id,t.automaticModeration=e.automatic_moderation?this.remapAutomaticModeration(e.automatic_moderation):null,t};remapFantasyConfig=e=>{let t=new to;return t.enabled=e.enabled,t.clientId=e.client_id,t.addPointsToProfileTotal=e.add_points_to_profile_total,t.competitionsWhitelist=e.competitions_whitelist,t.multipliers=e.multipliers?this.remapMultipliers(e.multipliers):null,t.players=this.remapFantasyPlayers(e.players),t.coefficients=this.remapFantasyCoefficients(e.coefficients),t};remapFantasyPlayers=e=>{let t=new Ci;return t.total=e.total,t.minGoalkeepers=e.min_goalkeepers,t.maxGoalkeepers=e.max_goalkeepers,t.minDefenders=e.min_defenders,t.maxDefenders=e.max_defenders,t.minMidfielders=e.min_midfielders,t.maxMidfielders=e.max_midfielders,t.minStrikers=e.min_strikers,t.maxStrikers=e.max_strikers,t};remapFantasyCoefficients=e=>{let t=new Si;return t.assists=e.assists,t.shots=e.shots,t.offsides=e.offsides,t.tackles=e.tackles,t.saves=e.saves,t.minutesEqualOrOver60=e.minutes_equal_or_over_60,t.minutesUnder60=e.minutes_under_60,t.yellowCards=e.yellow_cards,t.redCards=e.red_cards,t.goalsGoalkeeper=e.goals_goalkeeper,t.goalsDefender=e.goals_defender,t.goalsMidfielder=e.goals_midfielder,t.goalsForwards=e.goals_forwards,t.penaltyGoals=e.penalty_goals,t.ownGoals=e.own_goals,t.cleanSheetsGoalkeeper=e.clean_sheets_goalkeeper,t.cleanSheetsDefender=e.clean_sheets_defender,t.cleanSheetsMidfielder=e.clean_sheets_midfielder,t.cleanSheetsForwards=e.clean_sheets_forwards,t.shotsOn=e.shots_on,t.foulsCommitted=e.fouls_committed,t.penaltyCommitted=e.penalty_committed,t.penaltyWon=e.penalty_won,t.penaltyMissed=e.penalty_missed,t.concededGoals=e.conceded_goals,t.caughtBall=e.caught_ball,t};remapAutomaticModeration=e=>{let t=new _i;return t.enabled=e.enabled,t.moderateLinks=e.moderate_links,t.linksWhitelist=e.links_whitelist,t.moderatorProfileId=e.moderator_profile_id,t.dictionary=e.dictionary,t};remapNewRewards=e=>{let t=new Ei;return t.points=this.remapPoints(e.points),t.tiers=e.tiers,t.badges=this.remapNewBadges(e.badges),t};remapRewards=e=>{let t=new Ii;return t.points=this.remapPoints(e.points),t.tiers=e.tiers,t.badges=this.remapBadges(e.badges),t};remapPoints=e=>{let t=new An;return t.general=e.general,t.discussionPost=e.discussion_post,t.predictor=e.predictor,t.activity=e.activity,t.topX=e.top_x,t.matchQuiz=e.match_quiz,t};remapBadges=e=>{let t=new Kn;return t.general=e.general?this.remapGeneralBadgeValues(e.general):[],t.predictor=this.remapBadgeValues(e.predictor),t.topX=this.remapBadgeValues(e.top_x),t.matchQuiz=this.remapBadgeValues(e.match_quiz),t};remapNewBadges=e=>{let t=new xn;return t.predictor=this.remapBadgeValuesPredictor(e.predictor),t.topX=this.remapBadgeValuesGame(e.top_x),t.matchQuiz=this.remapBadgeValuesGame(e.match_quiz),e.games&&(t.games=this.remapBadgeValuesGames(e.games)),e.football&&(t.football=this.remapBadgeValuesFootball(e.football)),e.classic_quizzes&&(t.classicQuizzes=this.remapBadgeValuesMiniGames(e.classic_quizzes)),e.either_or&&(t.eitherOr=this.remapBadgeValuesMiniGames(e.either_or)),e.discussions&&(t.discussions=this.remapBadgeValuesDiscussions(e.discussions)),e.voting&&e.voting.potm&&(t.voting.potm=this.remapBadgeValuesVoting(e.voting.potm)),e.voting&&e.voting.poll&&(t.voting.poll=this.remapBadgeValuesVoting(e.voting.poll)),t};remapBadgeValuesPredictor=e=>e.map(t=>{let a=new Gn;return a.id=t.id,a.enabled=t.enabled,a.label=t.label,a.description=t.description,a.flags=t.flags,t.assets?a.assets.mainImageUrl=t.assets.main_image_url:a.assets=t.assets,t.requirements&&(a.requirements.predictionsNumber=t.requirements.predictions_number,a.requirements.correctPredictions=t.requirements.correct_predictions,a.requirements.points=t.requirements.points,a.requirements.fromDate=t.requirements.from_date,a.requirements.toDate=t.requirements.to_date),a});remapBadgeValuesGame=e=>e.map(t=>{let a=new Un;return a.id=t.id,a.enabled=t.enabled,a.label=t.label,a.description=t.description,a.flags=t.flags,t.assets?a.assets.mainImageUrl=t.assets.main_image_url:a.assets=t.assets,t.requirements&&(a.requirements.participationCount=t.requirements.participation_count,a.requirements.points=t.requirements.points,a.requirements.fromDate=t.requirements.from_date,a.requirements.toDate=t.requirements.to_date),a});remapBadgeValuesGames=e=>e.map(t=>{let a=new Hn;return a.id=t.id,a.enabled=t.enabled,a.label=t.label,a.description=t.description,a.flags=t.flags,t.assets?a.assets.mainImageUrl=t.assets.main_image_url:a.assets=t.assets,t.requirements&&(a.requirements.participationCount=t.requirements.participation_count,a.requirements.points=t.requirements.points,a.requirements.fromDate=t.requirements.from_date,a.requirements.toDate=t.requirements.to_date,a.requirements.specificGames=t.requirements.specific_games?this.remapSpecificGamesRequirement(t.requirements.specific_games):null),a});remapSpecificGamesRequirement=e=>e.map(t=>({gameId:t.game_id,gameType:t.game_type,gameModel:null}));remapBadgeValuesFootball=e=>e.map(t=>{let a=new Wn;return a.id=t.id,a.enabled=t.enabled,a.label=t.label,a.description=t.description,a.flags=t.flags,t.assets?a.assets.mainImageUrl=t.assets.main_image_url:a.assets=t.assets,t.requirements&&(a.requirements.predictionsNumber=t.requirements.predictions_number,a.requirements.correctPredictions=t.requirements.correct_predictions,a.requirements.points=t.requirements.points,a.requirements.entityId=t.requirements.entity_id,a.requirements.entityType=t.requirements.entity_type),a});remapBadgeValuesMiniGames=e=>e.map(t=>{let a=new qn;return a.id=t.id,a.enabled=t.enabled,a.label=t.label,a.description=t.description,a.flags=t.flags,t.assets?a.assets.mainImageUrl=t.assets.main_image_url:a.assets=t.assets,t.requirements&&(a.requirements.participationCount=t.requirements.participation_count,a.requirements.fromDate=t.requirements.from_date,a.requirements.toDate=t.requirements.to_date),a});remapBadgeValuesDiscussions=e=>e.map(t=>{let a=new Qn;return a.id=t.id,a.enabled=t.enabled,a.label=t.label,a.description=t.description,a.flags=t.flags,t.assets?a.assets.mainImageUrl=t.assets.main_image_url:a.assets=t.assets,t.requirements&&(a.requirements.totalDiscussionPoints=t.requirements.total_discussion_points,a.requirements.postsCount=t.requirements.posts_count,a.requirements.postPoints=t.requirements.post_points,a.requirements.reactionsCount=t.requirements.reactions_count),a});remapBadgeValuesVoting=e=>e.map(t=>{let a=new Xn;return a.id=t.id,a.enabled=t.enabled,a.label=t.label,a.description=t.description,a.flags=t.flags,t.assets?a.assets.mainImageUrl=t.assets.main_image_url:a.assets=t.assets,t.requirements&&(a.requirements.points=t.requirements.points,a.requirements.voteCount=t.requirements.vote_count,a.requirements.entityId=t.requirements.entity_id,a.requirements.entityType=t.requirements.entity_type),a});remapBadgeValues=e=>e.map(t=>{let a=new Zn;return a.id=t.id,a.label=t.label,a.enabled=t.enabled,t.assets?a.assets.mainImageUrl=t.assets.main_image_url:a.assets=t.assets,a.requirements=this.remapRequirements(t.requirements),a});remapRequirements=e=>{let t=new Qt;return t.points=e.points,t.gameParticipationCount=e.game_participation_count,t.entityId=e.entity_id,t.entityType=e.entity_type,t.predictionsMade=e.predictions_made,t.correctPredictions=e.correct_predictions,t};remapUserDataConfig=e=>{let t=new Dn;return t.storeIp=e.store_ip,t.storeDeviceId=e.store_device_id,t.storeAgent=e.store_agent,t};remapGeneralBadgeValues=e=>e.map(t=>{let a=new eo;return a.id=t.id,a.label=t.label,a.enabled=t.enabled,t.assets?a.assets.mainImageUrl=t.assets.main_image_url:a.assets=t.assets,a.requirements=this.remapGeneralRequirements(t.requirements),a});remapGeneralRequirements=e=>{let t=new Ri;return t.points=e.points,t.gameParticipationCount=e.game_participation_count,t.entityId=e.entity_id,t.entityType=e.entity_type,t.predictionsMade=e.predictions_made,t.correctPredictions=e.correct_predictions,t.postPoints=e.post_points,t.postsCount=e.posts_count,t.reactionsCount=e.reactions_count,t.totalDiscussionPoints=e.total_discussion_points,t};remapMultipliers=e=>{let t=new ao;return t.captain=e.captain,t.viceCaptain=e.vice_captain,t}},so=class{entityId;entityType;entityModel=null},ro=class{id=null;source=null;type=null},B=class{limit;startAfter;constructor(e){this.limit=e&&e.limit?e.limit:null,this.startAfter=e&&e.startAfter?e.startAfter:null}constructMainFiltersUrl(){let e="";return this.limit&&(e+="&",e+=`limit=${this.limit}`),this.startAfter&&(e+="&",e+=`start_after=${this.startAfter}`),e}},no=class extends B{},oo=(e=>(e.PARTICIPANT_ONE="PARTICIPANT_ONE",e.PARTICIPANT_TWO="PARTICIPANT_TWO",e.DRAW="DRAW",e))(oo||{}),lo=class{matchId="";participantOne="";participantTwo="";winner="PARTICIPANT_ONE"},Xe=(e=>(e.OPEN="OPEN",e.LIVE="LIVE",e.PENDING="PENDING",e.CANCELED="CANCELED",e.CLOSED="CLOSED",e.SETTLED="SETTLED",e))(Xe||{}),co=class extends B{status=null;sortOrder=null;gameIds=null;constructor(e){super(e),this.status=e?.status||null,this.sortOrder=e?.sortOrder||null,this.gameIds=e?.gameIds||null}constructMainFiltersUrl(){let e=super.constructMainFiltersUrl();return this.status&&Object.values(Xe).includes(this.status)?(e+="&",e+=`status=${this.status}`):this.status!==null&&console.warn(`The filter 'status' has the following INVALID value: ${this.status}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.sortOrder&&(this.sortOrder==="asc"||this.sortOrder==="desc"||this.sortOrder==="ASC"||this.sortOrder==="DESC")?(e+="&",e+=`sort_order=${this.sortOrder}`):this.sortOrder!==null&&console.warn(`The filter 'sortOrder' has the following INVALID value: ${this.sortOrder}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.gameIds&&Array.isArray(this.gameIds)&&this.gameIds.length>0?(e+="&",e+=`game_ids=${this.gameIds}`):this.gameIds!==null&&console.warn(`The filter 'gameIds' has the following INVALID value: ${this.gameIds}. It will be not passed as a query param in the URL. For more information visit our documentation.`),e}},po=class{profileId="";profileModel=null;challengeId="";challengeModel=null;message=""},Mi=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];scoring_starts_at=""},uo=class extends Mi{type="ONE_VS_ONE"},Oi=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];pinned_posts=[];scoring_starts_at=""},ho=class extends Oi{type="ONE_VS_ONE"},mo=class{limit=null;page=null;challengeId=null;templateId=null;sortOrder=null;constructor(e){this.limit=e&&e.limit?e.limit:null,this.page=e&&e.page?e.page:null,this.challengeId=e&&e.challengeId?e.challengeId:null,this.templateId=e&&e.templateId?e.templateId:null,this.sortOrder=e&&e.sortOrder?e.sortOrder:null}constructFiltersUrl=()=>{let e="";return this.limit&&(e+=`&limit=${this.limit}`),this.page&&(e+=`&page=${this.page}`),this.challengeId&&(e+=`&league_id=${this.challengeId}`),this.templateId&&(e+=`&template_id=${this.templateId}`),this.sortOrder&&(e+=`&sort_order=${this.sortOrder}`),e}},go=class{type="ONE_VS_ONE";userRole=null;constructor(e){this.userRole=e?.userRole||null}constructFiltersUrl=()=>{let e=`&type=${this.type}`;return this.userRole&&(e+=`&user_role=${this.userRole}`),e}},fo=class{templateId="";templateModel=null;challengeId="";challengeModel=null;position="";points=0;type="challenge"},yo=class{id="";label="";discussionType="LEAGUE";discussionUrl=null;moderationType="USER";postsCount=0;pinnedPosts=[];lastPostId="";status="";deleted=!1;deletedAt="";deletedBy="";customFields=null;context=null;createdAt="";updatedAt=""},Fi=class{id="";userId="";discussionId="";content="";repliesCount=0;replyId="";anonymousNickname="";reactions=[];reactionsCount=0;reports=[];reportsCount=0;versions=null;privatePost=!1;deleted=!1;deletedAt="";deletedBy="";moderated=!1;moderatedAt="";moderatedBy="";moderatedReason="";createdAt="";updatedAt=""},wo=class extends Fi{userModel=null},_o=class{content="";reply_id="";discussion_label="";discussion_url="";anonymous_nickname="";context=null},vo=class{id="";postsCount=0},Yt=class{pagination={totalItems:0,nextPageStartsAfter:"",lastCommentCreateTimestamp:""}},Io=class{meta=new Yt;data=[]},To=class{meta=new Yt;data=[]},bo=class{meta=new V;data=[]},Po=class{type="";userIds=[];reactionCount=0},Eo=class{userId=null;reason="AD";reasonDetails=null},Ro=class{updatedAt="";content=""},So=["CREATED_AT_ASC","CREATED_AT_DESC","POSTS_COUNT_ASC","POSTS_COUNT_DESC"],Co=["ACTIVE","INACTIVE"],Mo=class extends B{discussionIds;label;discussionUrl;fromDate;toDate;fromCount;toCount;sort;status;skipDeleted;constructor(e){super(e),this.discussionIds=e&&e.discussionIds?e.discussionIds:null,this.label=e&&e.label?e.label:null,this.discussionUrl=e&&e.discussionUrl?e.discussionUrl:null,this.fromDate=e&&e.fromDate?e.fromDate:null,this.toDate=e&&e.toDate?e.toDate:null,this.fromCount=e&&e.fromCount?e.fromCount:null,this.toCount=e&&e.toCount?e.toCount:null,this.sort=e&&e.sort?e.sort:null,this.status=e?.status||null,this.skipDeleted=e&&e.skipDeleted!==void 0?e.skipDeleted:null}constructMainFiltersUrl(){let e=super.constructMainFiltersUrl();return this.discussionIds!==null&&(e+=`&discussion_ids=${this.discussionIds.join(",")}`),this.label!==null&&(e+=`&label=${this.label}`),this.discussionUrl!==null&&(e+=`&discussion_url=${this.discussionUrl}`),this.fromDate!==null&&(e+=`&from_date=${this.fromDate}`),this.toDate!==null&&(e+=`&to_date=${this.toDate}`),this.fromCount!==null&&(e+=`&from_count=${this.fromCount}`),this.toCount!==null&&(e+=`&to_count=${this.toCount}`),this.sort&&So.includes(this.sort.toUpperCase())&&(e+=`&sort=${this.sort.toUpperCase()}`),this.status&&Co.includes(this.status.toUpperCase())&&(e+=`&status=${this.status.toUpperCase()}`),this.skipDeleted!==null&&(e+=`&skip_deleted=${this.skipDeleted}`),e}},st=class extends B{skipDeleted;skipModerated;sort;constructor(e){super(e),this.skipDeleted=e&&e.skipDeleted!==void 0?e.skipDeleted:null,this.skipModerated=e&&e.skipModerated!==void 0?e.skipModerated:null,this.sort=e&&e.sort?e.sort.toLocaleLowerCase():null}constructMainFiltersUrl(){let e=super.constructMainFiltersUrl();return this.skipDeleted!==null&&(e+=`&skip_deleted=${this.skipDeleted}`),this.skipModerated!==null&&(e+=`&skip_moderated=${this.skipModerated}`),this.sort&&(e+=`&sort=${this.sort}`),e}},Oo=class extends B{fromDate;toDate;entityIds;entityType;contentType;constructor(e){super(e),this.fromDate=e?.fromDate||null,this.toDate=e?.toDate||null,this.entityIds=e?.entityIds||null,this.entityType=e?.entityType||null,this.contentType=e?.contentType||null}constructMainFiltersUrl(){let e=super.constructMainFiltersUrl();return this.fromDate!==null&&(e+=`&from_date=${this.fromDate}`),this.toDate!==null&&(e+=`&to_date=${this.toDate}`),this.entityIds!==null&&this.entityIds.length>0&&(e+=`&entity_ids=${this.entityIds}`),this.contentType!==null&&(e+=`&content_type=${this.contentType}`),e}},Fo=class extends B{status=null;sortOrder=null;gameIds=null;constructor(e){super(e),this.status=e?.status||null,this.sortOrder=e?.sortOrder||null,this.gameIds=e?.gameIds||null}constructMainFiltersUrl(){let e=super.constructMainFiltersUrl();return this.status&&Object.values(Xe).includes(this.status)?(e+="&",e+=`status=${this.status}`):(this.status!==null||this.status!==void 0)&&console.warn(`The filter 'status' has the following INVALID value: ${this.status}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.sortOrder&&(this.sortOrder==="asc"||this.sortOrder==="desc"||this.sortOrder==="ASC"||this.sortOrder==="DESC")?(e+="&",e+=`sort_order=${this.sortOrder}`):(this.sortOrder!==null||this.sortOrder!==void 0)&&console.warn(`The filter 'sortOrder' has the following INVALID value: ${this.sortOrder}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.gameIds&&Array.isArray(this.gameIds)&&this.gameIds.length>0?(e+="&",e+=`game_ids=${this.gameIds}`):(this.gameIds!==null||this.gameIds!==void 0)&&console.warn(`The filter 'gameIds' has the following INVALID value: ${this.gameIds}. It will be not passed as a query param in the URL. For more information visit our documentation.`),e}},Ao=class extends B{},ko=class extends B{},Do=class{templateId=null;playerId=null},Lo=class{filters=new Do},xo=class{meta=new Lo;data=[]},No=class{key=null;label=null;value=null},Go=class{templateId=null},$o=class{filters=new Go},Uo=class{meta=new $o;data=[]},Ai=class{template_id=null;group_id=null;fixtures=[]},ki=class{total=null;minutesPlayed=null;yellowCards=null;redCards=null;goals=null;penaltyGoals=null;ownGoals=null;assists=null;cleanSheets=null;shots=null;shotsOn=null;offsides=null;foulsCommitted=null;penaltyCommitted=null;penaltyWon=null;penaltyMissed=null;tackles=null;concededGoals=null;caughtBall=null;saves=null},Xt=class{minutesPlayed=null;yellowCards=null;redCards=null;goals=null;penaltyGoals=null;penaltyCommitted=null;penaltyWon=null;penaltyMissed=null;penaltySaved=null;penaltyReceived=null;ownGoals=null;assists=null;cleanSheets=null;shots=null;shotsOn=null;shotsBlocked=null;offsides=null;foulsCommitted=null;foulsWon=null;tackles=null;tacklesBlocks=null;tacklesInterceptions=null;concededGoals=null;caughtBall=null;saves=null;passes=null;crosses=null;interceptions=null;keyPasses=null;passesAccuracy=null;duels=null;duelsWon=null;dribblesAttempts=null;dribblesSuccess=null;dribblesPast=null},Bo=class{matchId=null;matchModel=null;points=new ki;stats=new Xt},Ho=class{playerId=null;playerModel=null;points=null;rank=null},Vo=class{id="";country=null;gender="";assets=null;type="";name=""},Wo=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]},zo=class{id="";alias="";countryCode="";assets=null;name=""},De=class{type=null;subType=null},qo=class{id="";kickoffAt="";finishedAt="";updatedAt="";availableMarkets=null;homeTeam=null;awayTeam=null;isDeleted=!1;undecided=!1;lineupsConfirmed=!1;startedAt="";minute="";scores=null;context={competition:null};status=new De},jo=class{id="";kickoffAt="";finishedAt="";updatedAt="";availableMarkets=null;isDeleted=!1;undecided=!1;homeTeam=null;awayTeam=null;lineupsConfirmed=!1;startedAt="";minute="";scores=null;stats=null;playerStats=[];context={competition:null};timeline=[];status=new De;lineups=null},qe=class{countryIds=null;competitionIds=null;matchIds=null;status=null;teamIds=null;fromDate=null;toDate=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(e){this.countryIds=e.countryIds?e.countryIds:null,this.competitionIds=e.competitionIds?e.competitionIds:null,this.matchIds=e.matchIds?e.matchIds:null,this.status=e.status?e.status:null,this.teamIds=e.teamIds?e.teamIds:null,this.fromDate=e.fromDate?e.fromDate:null,this.toDate=e.toDate?e.toDate:null,this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null,this.sortField=e.sortField?e.sortField:null,this.sortOrder=e.sortOrder?e.sortOrder:null}constructFilterUrl=e=>{let t="";return this.countryIds&&(t=t+"&",t=t+`countries=${this.countryIds.join(",")}`),this.competitionIds&&this.competitionIds.length>0&&(t=t+"&",t=t+`competitions=${this.competitionIds.join(",")}`),this.matchIds&&this.matchIds.length>0&&(t=t+"&",t=t+`matches=${this.matchIds.join(",")}`),this.status&&(t=t+"&",t=t+`status=${this.status}`),this.teamIds&&this.teamIds.length>0&&(t=t+"&",t=t+`teams=${this.teamIds.join(",")}`),this.fromDate&&(t=t+"&",t=t+`from_date=${this.fromDate}`),this.toDate&&(t=t+"&",t=t+`to_date=${this.toDate}`),this.limit&&!e&&(t=t+"&",t=t+`limit=${this.limit}`),this.page&&!e&&(t=t+"&",t=t+`page=${this.page}`),this.sortField&&(t=t+"&",t=t+`sort_field=${this.sortField}`),this.sortOrder&&(t=t+"&",t=t+`sort_order=${this.sortOrder}`),t}},Qo=class{corners=null;cornersFirstHalf=null;cornersSecondHalf=null;cornersExtraTime=null;crosses=null;crossesFirstHalf=null;crossesSecondHalf=null;crossesExtraTime=null;offside=null;offsideFirstHalf=null;offsideSecondHalf=null;offsideExtraTime=null;shotsOn=null;shotsOnFirstHalf=null;shotsOnSecondHalf=null;shotsOnExtraTime=null;throwIn=null;throwInFirstHalf=null;throwInSecondHalf=null;throwInExtraTime=null;redCards=null;redCardsFirstHalf=null;redCardsSecondHalf=null;redCardsExtraTime=null;shotsOff=null;shotsOffFirstHalf=null;shotsOffSecondHalf=null;shotsOffExtraTime=null;goalKicks=null;goalKicksFirstHalf=null;goalKicksSecondHalf=null;goalKicksExtraTime=null;possession=null;possessionFirstHalf=null;possessionSecondHalf=null;possessionExtraTime=null;treatments=null;treatmentsFirstHalf=null;treatmentsSecondHalf=null;treatmentsExtraTime=null;yellowCards=null;yellowCardsFirstHalf=null;yellowCardsSecondHalf=null;yellowCardsExtraTime=null;shotsBlocked=null;shotsBlockedFirstHalf=null;shotsBlockedSecondHalf=null;shotsBlockedExtraTime=null;substitutions=null;substitutionsFirstHalf=null;substitutionsSecondHalf=null;substitutionsExtraTime=null;counterAttacks=null;counterAttacksFirstHalf=null;counterAttacksSecondHalf=null;counterAttacksExtraTime=null;foulsCommitted=null;foulsCommittedFirstHalf=null;foulsCommittedSecondHalf=null;foulsCommittedExtraTime=null},Yo=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null},Di=class{homeTeam={players:[]};awayTeam={players:[]}},Xo=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""},Jo=class{playerId=null;position=null;minutesPlayed=null;yellowCards=null;redCards=null;goals=null;penaltyGoals=null;penaltyCommitted=null;penaltyWon=null;penaltyMissed=null;penaltySaved=null;penaltyReceived=null;ownGoals=null;assists=null;cleanSheets=null;shots=null;shotsOn=null;shotsBlocked=null;offsides=null;foulsCommitted=null;foulsWon=null;tackles=null;tacklesBlocks=null;tacklesInterceptions=null;concededGoals=null;caughtBall=null;saves=null;passes=null;crosses=null;interceptions=null;keyPasses=null;passesAccuracy=null;duels=null;duelsWon=null;dribblesAttempts=null;dribblesSuccess=null;dribblesPast=null;updatedAt=null},Ko=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;teams=[]},Zo=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;competitions=[];teams=[]},el=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""},tl=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null},ka=class{countryId=null;scope=null;name=null;playerIds=null;limit=null;page=null;sortField=null;sortOrder=null;constructor(e){this.countryId=e.countryId?e.countryId:null,this.scope=e.scope?e.scope:null,this.name=e.name?e.name:null,this.playerIds=e.playerIds?e.playerIds:null,this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null,this.sortField=e.sortField?e.sortField:null,this.sortOrder=e.sortOrder?e.sortOrder:null}constructFilterUrl=()=>{let e="";return this.countryId&&(e=e+"&",e=e+`country_id=${this.countryId}`),this.scope&&this.scope.length>0&&(e=e+"&",e=e+`scope=${this.scope.join(",")}`),this.name&&(e=e+"&",e=e+`name=${this.name}`),this.playerIds&&this.playerIds.length>0&&(e=e+"&",e=e+`player_ids=${this.playerIds.join(",")}`),this.limit&&(e=e+"&",e=e+`limit=${this.limit}`),this.page&&(e=e+"&",e=e+`page=${this.page}`),this.sortField&&(e=e+"&",e=e+`sort_field=${this.sortField}`),this.sortOrder&&(e=e+"&",e=e+`sort_order=${this.sortOrder}`),e}},al=class{id="";name="";position="";shirtNumber;assets=null;type=""},il=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;undecided=!1;fullName="";shortName="";isDeleted=!1},sl=class{primary=null;secondary=null;tertiary=null},rl=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";isDeleted=!1;undecided=!1;colors=new sl;squad=[]},nl=class{teams=null;players=null;competitions=null},ol=class{entities=null;query=null;scope=null;constructor(e){this.entities=e.entities?e.entities:null,this.query=e.query?e.query:null,this.scope=e.scope?e.scope:null}constructFilterUrl=()=>{let e="";return this.entities&&(e=e+"&",e=e+`entities=${this.entities.join(",")}`),this.query&&(e=e+"&",e=e+`q=${this.query}`),this.scope&&(e=e+"&",e=e+`scope=${this.scope.join(",")}`),e}},rt=class{meta=new fe;data=[]},Pe=class{main=null;cover=null;mobile=null},ll=class{input=null;output=null},cl=class{meta=new ll;data=[]},dl=class{limit=null;page=null;constructor(e){this.limit=e&&e.limit?e.limit:null,this.page=e&&e.page?e.page:null}constructFiltersUrl=()=>{let e="";return this.limit&&(e+=`&limit=${this.limit}`),this.page&&(e+=`&page=${this.page}`),e}},pl=class{general;predictor;topX;matchQuiz},ul=class{predictor;topX;matchQuiz;games;football;classicQuizzes;eitherOr;discussions;potm;poll},hl=class{market;fromDate;toDate;usersCount;minimumPredictions;constructor(e){this.market=e.market?e.market:null,this.fromDate=e.fromDate?e.fromDate:null,this.toDate=e.toDate?e.toDate:null,this.usersCount=e.usersCount?e.usersCount:null,this.minimumPredictions=e.minimumPredictions?e.minimumPredictions:null}constructFiltersUrl(){let e="";return this.market&&(e+="&",e+=`market=${this.market}`),this.fromDate&&(e+="&",e+=`from_date=${this.fromDate}`),this.toDate&&(e+="&",e+=`to_date=${this.toDate}`),this.usersCount&&(e+="&",e+=`users_count=${this.usersCount}`),this.minimumPredictions&&(e+="&",e+=`minimum_predictions=${this.minimumPredictions}`),e}},ml=class{templateId=null;limit=null;page=null;groupId=null;constructor(e){this.templateId=e?.templateId||null,this.limit=e?.limit||null,this.page=e?.page||null,e?.groupId!==void 0&&console.warn("Warning: groupId property is deprecated and no longer supported by the API. This property will be removed in a future version. Please update your code accordingly.")}constructFiltersUrl(){let e="";return this.templateId&&(e+=`&template_id=${this.templateId}`),this.limit&&(e+=`&limit=${this.limit}`),this.page&&(e+=`&page=${this.page}`),e}},gl=class{groupId=null;limit=null;page=null;constructor(e){this.groupId=e.groupId?e.groupId:null,this.limit=e.limit?e.limit:null,this.page=e.page?e.page:null}constructFiltersUrl(){let e="";return this.groupId&&(e+="&",e+=`group_id=${this.groupId}`),this.limit&&(e+="&",e+=`limit=${this.limit}`),this.page&&(e+="&",e+=`page=${this.page}`),e}},fl=class{sortOrder=null;rankType=null;leaderboardIds=null;gameType=null;limit=null;page=null;groupId=null;constructor(e){this.sortOrder=e.sortOrder,this.rankType=e.rankType,this.leaderboardIds=e.leaderboardIds,this.limit=e.limit,this.page=e.page,e.gameType&&(e.rankType==="GAME"?this.gameType=e.gameType:console.warn(`RankingsFilters: gameType "${e.gameType}" ignored because rankType is "${e.rankType}". gameType can only be used when rankType is "GAME".`)),e.groupId&&(e.rankType==="TEMPLATE"?this.groupId=e.groupId:console.warn(`RankingsFilters: groupId "${e.groupId}" ignored because rankType is "${e.rankType}". groupId can only be used when rankType is "TEMPLATE".`))}constructFiltersUrl=()=>{let e="";return this.sortOrder&&(e+="&",e+=`sort_order=${this.sortOrder}`),this.rankType&&(e+="&",e+=`rank_type=${this.rankType}`),this.leaderboardIds&&(e+="&",e+=`type_ids=${this.leaderboardIds.join(",")}`),this.gameType&&this.rankType==="GAME"&&(e+="&",e+=`game_type=${this.gameType}`),this.limit&&(e+="&",e+=`limit=${this.limit}`),this.page&&(e+="&",e+=`page=${this.page}`),this.groupId&&this.rankType==="TEMPLATE"&&(e+="&",e+=`group_id=${this.groupId}`),e}},yl=class{flags=null;status=null;type=null;activeFrom=null;activeTo=null;createdFrom=null;createdTo=null;updatedFrom=null;updatedTo=null;constructor(e){this.flags=e.flags?e.flags:null,this.status=e.status?e.status:null,this.type=e.type?e.type:null,this.activeFrom=e.activeFrom?e.activeFrom:null,this.activeTo=e.activeTo?e.activeTo:null,this.createdFrom=e.createdFrom?e.createdFrom:null,this.createdTo=e.createdTo?e.createdTo:null,this.updatedFrom=e.updatedFrom?e.updatedFrom:null,this.updatedTo=e.updatedTo?e.updatedTo:null}constructFiltersUrl(){let e="";return this.flags&&this.flags.length>0&&(e+="&",e+=`flags=${this.flags.join(",")}`),this.status&&(e+="&",e+=`status=${this.status}`),this.type&&(e+="&",e+=`type=${this.type}`),this.activeFrom&&(e+="&",e+=`active_from=${this.activeFrom}`),this.activeTo&&(e+="&",e+=`active_to=${this.activeTo}`),this.createdFrom&&(e+="&",e+=`created_from=${this.createdFrom}`),this.createdTo&&(e+="&",e+=`created_to=${this.createdTo}`),this.updatedFrom&&(e+="&",e+=`updated_from=${this.updatedFrom}`),this.updatedTo&&(e+="&",e+=`updated_to=${this.updatedTo}`),e}},wl=class{position=null;points=null;predictionsMade=null;profileId=null;profileModel=null;successRatePercent=null},_l=class{templateId=null;privateLeagueId=null;fromDate=null;toDate=null;pagination=new ke},vl=class{rankType=null;fromDate=null;toDate=null;pagination=new ke},Li=class{position=null;profileId=null;profileModel=null;points=null;predictionsMade=null},Il=class{flags="";status="";type="";activeFrom="";activeTo="";createdFrom="";createdTo="";updatedFrom="";updatedTo=""},Tl=class{pagination=new ke;filters=new Il},bl=class extends Li{id=null;rankType=null;model=null;gameType=null},Pl=class{groupId;averagePoints;highestPoints},xi=class{id=null;name=null;description=null;type=null;fromDate=null;toDate=null;markets=[];teamIds=[];matchIds=[];groups=[];gameIds=[];gameTypes=[];competitionIds=[];excludedProfileIds=[];rules=null;labels=null;customFields=null;branding=null;brandingId=null;flags=null;images=new Pe;status=null;automaticallyChangeStatus=!0;createdAt=null;updatedAt=null;related=null},El=class extends xi{adContent=null},Rl=class{groupId=null;label=null;flags=[];filters=null},Sl=class{fromDate=null;toDate=null;matchIds=[]},Cl=class{value=null;target=null;playerId=null;playerModel=null;result=null},Ml=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new De;prediction=new Cl},Ol=class{gameId=null;results=null;tieBreakers=null},bt=class{timeTiebreaker=!1},ze=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new bt;predictionId=null;participantsCount=0;related=[];excludedProfileIds=null;rules=null;flags=null;points=null;createdAt=null;updatedAt=null;predictionsMadeAt=null;predictionsUpdatedAt=null;images=null;scheduleOpenAt=null;branding=null;brandingId=null},Ni=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new Pe;participationCount=null;questionsCount=null;status=null;language=null;authRequirement=null;flags=null;customFields=null;labels=null;branding=null;brandingId=null;related=[];time=null;points=null;scored=!1;maxAttempts=null;averageScore=null;perfectScore=null;adContent=null;context=null;createdAt=null;updatedAt=null},Jt=class extends B{flags=null;status=null;entityIds=null;entityType=null;sort=null;groupByStatus=null;language=null;title=null;constructor(e){super(e),this.flags=e&&e.flags?e.flags:null,this.status=e&&e.status?e.status:null,this.entityIds=e&&e.entityIds?e.entityIds:null,this.entityType=e&&e.entityType?e.entityType:null,this.sort=e&&e.sort?e.sort:null,this.groupByStatus=e&&e.groupByStatus!==void 0?e.groupByStatus:null,this.language=e&&e.language?e.language:null,this.title=e&&e.title?e.title:null}constructMainFiltersUrl(){let e=super.constructMainFiltersUrl();return this.flags&&this.flags.length>0&&(e+=`&flags=${this.flags.join(",")}`),this.status&&(e+=`&status=${this.status}`),this.entityIds&&this.entityIds.length>0&&(e+=`&entity_ids=${this.entityIds}`),this.sort&&(e+=`&sort=${this.sort}`),this.groupByStatus!==null&&(e+=`&group_by_status=${this.groupByStatus}`),this.language!==null&&(e+=`&language=${this.language}`),this.title!==null&&(e+=`&title=${this.title}`),e}},Fl=class extends Jt{classicQuizIds=null;constructor(e){super(e),this.classicQuizIds=e&&e.classicQuizIds?e.classicQuizIds:null}constructMainFiltersUrl(){let e=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(e+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),e}},Al=class extends Ni{rules=null;questions=[]},kl=class{questionId=null;question=null;images=null;embedCode=null;explanation=null;options=[]},Dl=class{optionId=null;option=null;images=null;correct=null},Ll=class{classicQuizId=null;userId=null;questions=[];correctOptions=null;personalBest=null;points=null;attempts=null},xl=class{questionId=null;optionId=null;correct=null;correctOptionId=null},Da=class extends B{classicQuizIds=null;constructor(e){super(e),this.classicQuizIds=e?.classicQuizIds||null}constructMainFiltersUrl(){let e=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(e+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),e}},La=class{classicQuizId=null;classicQuizModel=null;correct=null;classicQuizQuestions=null;personalBest=null;points=null;answers=[];attempts=0},Nl=class{meta=new V;data=[]},Gl=class{questionId=null;questionModel=null;wrong=null;correct=null;skipped=null;total=null},Gi=class{classicQuizIds=null},$i=class{limit=null;page=null;constructor(e){this.limit=e?.limit||null,this.page=e?.page||null}constructMainFiltersUrl(){let e="";return this.limit&&(e+=`&limit=${this.limit}`),this.page&&(e+=`&page=${this.page}`),e}},$l=class extends $i{classicQuizIds=null;constructor(e){super(e),this.classicQuizIds=e?.classicQuizIds||null}constructMainFiltersUrl(){let e=super.constructMainFiltersUrl();return this.classicQuizIds&&this.classicQuizIds.length>0&&(e+=`&classic_quiz_ids=${this.classicQuizIds.join(",")}`),e}},Ul=class{pagination=new ke;filters=new Gi},Bl=class{position=null;profileId=null;profileModel=null;points=null},Hl=class{position=null;classicQuizId=null;classicQuizModel=null;points=null},Ui=class{id="";title="";alternativeTitle="";description="";images=new Pe;flags=[];status="";language="";authRequirement=null;winningCondition="";lives=0;time=0;points=[];customFields=null;branding=null;brandingId=null;labels=null;adContent="";context=null;type="";related=[];totalParticipationsCount=0;totalUsersCount=0;finishedParticipationsCount=0;averageStartedParticipationsCount=0;averageFinishedParticipationsCount=0;createdAt="";updatedAt=""},Vl=class extends Jt{eitherOrIds=null;constructor(e){super(e),this.eitherOrIds=e&&e.eitherOrIds?e.eitherOrIds:null}constructMainFiltersUrl(){let e=super.constructMainFiltersUrl();return this.eitherOrIds&&this.eitherOrIds.length>0&&(e+=`&either_or_ids=${this.eitherOrIds.join(",")}`),e}},Wl=class extends Ui{rules=""},zl=class{correctSteps=0;score=0},ql=class{eitherOrId="";personalBest=0;betterThan=0},jl=class{instanceId="";eitherOrId="";gameStartedAt="";currentStep=0;currentStreak=0;remainingSteps=0;currentLives=0;currentPoints=0;personalBest=0;participationCount=0;finishedParticipationsCount=0;steps=[]},Ql=class{pair="";answer=""},Yl=class extends Ql{expired=!1;time=0},Xl=class{main;mobile},xa=class{id="";label="";images=new Xl;value=null},Jl=class{pairId="";userSelection="";correct=null;played=null;timestamp="";optionOne=new xa;optionTwo=new xa},Kl=class{rangeStartInclusive=0;rangeEndInclusive=0;totalUsers=0},Zl=class{standings=[];breakdown=[]},ec=class{userId="";userModel=null;personalBest=""},Kt=class{content=null;tags=[];campaign=null},Zt=class{id=null;model=null;source=null;type=null},tc=class{questions=null;correctAnswers=null},Bi=class{id=null;title=null;alternativeTitle=null;description=null;images=new Pe;participationCount=null;status=null;language=null;authRequirement=null;flags=null;customFields=null;labels=null;branding=null;brandingId=null;related=[];time=null;preferencesEnabled=!1;maxAttempts=null;adContent=null;context=null;createdAt=null;updatedAt=null},ac=class{personaId=null;title=null;description=null;images=null},ic=class{questionId=null;question=null;images=null;explanation=null;options=[]},sc=class{personaId=null;points=null},rc=class{optionId=null;option=null;images=null;personaPoints=[];preferencesMapping=[]},nc=class extends Bi{rules=null;questions=[];personaResults=[]},oc=class extends Jt{personalityQuizIds=null;constructor(e){super(e),this.personalityQuizIds=e&&e.personalityQuizIds?e.personalityQuizIds:null}constructMainFiltersUrl(){let e=super.constructMainFiltersUrl();return this.personalityQuizIds&&this.personalityQuizIds.length>0&&(e+=`&personality_quiz_ids=${this.personalityQuizIds.join(",")}`),e}},lc=class{personalityQuizId=null;userId=null;questions=[];personas=[];attempts=null},cc=class{questionId=null;optionId=null},dc=class{personaId=null;percent=null},pc=class extends B{personalityQuizIds=null;constructor(e){super(e),this.personalityQuizIds=e?.personalityQuizIds||null}constructMainFiltersUrl(){let e=super.constructMainFiltersUrl();return this.personalityQuizIds&&this.personalityQuizIds.length>0&&(e+=`&personality_quiz_ids=${this.personalityQuizIds.join(",")}`),e}},uc=class{meta=new V;data=[]},hc=class{id=null;name=null;url=null;assets=[];links=[];branding=null;eventUrls=[];stakesDisclaimer=null;domainName=null},mc=class{backgroundColor=null;textColor=null},gc=class{logo=null;type=null;transparentBackgroundUrl=null;backgroundColor=null},fc=class{url=null;appType=null},Hi=(e=>(e.PRE_EVENT="PRE_EVENT",e.LIVE="LIVE",e.ALL="ALL",e))(Hi||{}),Vi=(e=>(e.ORDINARY_TIME="ORDINARY_TIME",e.FULL_TIME="FULL_TIME",e))(Vi||{}),Wi=(e=>(e.DECIMAL="DECIMAL",e.MONEYLINE="MONEYLINE",e.FRACTIONAL="FRACTIONAL",e))(Wi||{}),zi=(e=>(e.FT_1X2="FT_1X2",e.DOUBLE_CHANCE="DOUBLE_CHANCE",e.HT_FT="HT_FT",e.BOTH_TEAMS_SCORE="BOTH_TEAMS_SCORE",e.CORRECT_SCORE="CORRECT_SCORE",e.PLAYER_SCORE_FIRST_GOAL="PLAYER_SCORE_FIRST_GOAL",e.PLAYER_SCORE="PLAYER_SCORE",e.PLAYER_RED_CARD="PLAYER_RED_CARD",e.PLAYER_YELLOW_CARD="PLAYER_YELLOW_CARD",e.OVER_GOALS_0_5="OVER_GOALS_0_5",e.OVER_GOALS_1_5="OVER_GOALS_1_5",e.OVER_GOALS_2_5="OVER_GOALS_2_5",e.OVER_GOALS_3_5="OVER_GOALS_3_5",e.OVER_GOALS_4_5="OVER_GOALS_4_5",e.OVER_GOALS_5_5="OVER_GOALS_5_5",e))(zi||{}),yc={FT_1X2:"1x2",DOUBLE_CHANCE:"DOUBLE_CHANCE",HT_FT:"FIRST_HALF_AND_FINAL_RESULT",BOTH_TEAMS_SCORE:"BOTH_TO_SCORE",CORRECT_SCORE:"CORRECT_SCORE",PLAYER_SCORE_FIRST_GOAL:"FIRST_PLAYER_TO_SCORE",PLAYER_SCORE:"PLAYER_TO_SCORE_DURING_GAME",PLAYER_RED_CARD:"PLAYER_TO_RECEIVE_CARD",PLAYER_YELLOW_CARD:"PLAYER_TO_RECEIVE_CARD"},wc=class{oddType="PRE_EVENT";scopeType="ORDINARY_TIME";oddFormat="DECIMAL";marketTypes=["FT_1X2"];constructor(e){this.validateFilters(e)}constructFiltersUrl(){let e=this.marketTypes.map(t=>this.mapToSportal365Market(t));return`&odd_type=${this.oddType}&scope_type=${this.scopeType}&odd_format=${this.oddFormat}&market_types=${e.join(",")}`}validateFilters(e){let t=Object.values(Hi),a=Object.values(Vi),i=Object.values(Wi),s=Object.values(zi);e?.oddType&&(t.includes(e.oddType)?this.oddType=e.oddType:console.warn(`The filter "oddType" is NOT valid and therefore it will be set to PRE_EVENT. The VALID values are : ${t.join(", ")}`)),e?.scopeType&&(a.includes(e.scopeType)?this.scopeType=e.scopeType:console.warn(`The filter "scopeType" is NOT valid and therefore it will be set to ORDINARY_TIME. The VALID values are : ${a.join(", ")}`)),e?.oddFormat&&(i.includes(e.oddFormat)?this.oddFormat=e.oddFormat:console.warn(`The filter "oddFormat" is NOT valid and therefore it will be set to DECIMAL. The VALID values are : ${i.join(", ")}`)),e?.marketTypes&&Array.isArray(e?.marketTypes)&&e?.marketTypes.length>0&&(e.marketTypes.every(r=>s.includes(r))?this.marketTypes=e.marketTypes:console.warn(`The filter "marketTypes" is NOT valid and therefore it will be set to FT_1X2. The VALID values are : ${s.join(", ")}`))}mapToSportal365Market(e){return e.startsWith("OVER_GOALS_")?"OVER_UNDER":yc[e]}},_c=class{type=null;scope=null;selections=[]},vc=class{id=null;type=null;name=null;entityType=null},Ic=class{id=null;name=null;code=null;value=null;odds=null;urls=[];movement=null;oddsOld=null;entityType=null;additionalInfo=null;providerInfo=null},Tc=class{id=null;name=null;code=null;entityType=null},bc=class{selectionId=null;eventId=null;marketId=null;competitionId=null},Pc=class{bookmaker=null;type=null;markets=[]},Ec=class{value=null;playerId=null;playerModel=null;playerRole},qi=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new Ec;result=null},ji=class{settledAt=null;resettledAt=null;status=null;outcome=null;points=0},Je=class{value=!1},Rc=class{matchId=null;market="BOTH_TEAMS_SCORE";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new Je,this.prediction.value=t}},Sc=class{value},Cc=class{matchId=null;market="CORNERS_MATCH";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new Sc,this.prediction.value=t}},Mc=class{value=null},ea=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,a){this.matchId=e,this.market=t,this.prediction=new Mc,this.prediction.value=a}},Oc=class{value=null},Fc=class{matchId=null;market="DOUBLE_CHANCE";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new Oc,this.prediction.value=t}},Ac=class{value=null},kc=class{matchId=null;market="HT_FT";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new Ac,this.prediction.value=t}},Dc=class{value=null},Lc=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,a){this.matchId=e,this.market=t,this.prediction=new Dc,this.prediction.value=a}},Qi=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,a){this.matchId=e,this.market=t,this.prediction=new Je,this.prediction.value=a}},Yi=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,a){this.matchId=e,this.market=t,this.prediction=new Je,this.prediction.value=a}},xc=class{matchId=null;market="PENALTY_MATCH";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new Je,this.prediction.value=t}},Nc=class{value=!1;playerId=null},Ae=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,a,i){this.matchId=e,this.market=t,this.prediction=new Nc,this.prediction.value=a,this.prediction.playerId=i}},Gc=class{matchId=null;market="RED_CARD_MATCH";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new Je,this.prediction.value=t}},Ft=class{homeGoals=null;awayGoals=null},$c=class{playerId=null;playerModel=null},Uc=class{FT_1X2=null;HT_1X2=null;BOTH_TEAMS_SCORE=null;DOUBLE_CHANCE=null;HT_FT=null;RED_CARD_MATCH=null;PENALTY_MATCH=null;CORNERS_MATCH=null;PLAYER_YELLOW_CARD=[];PLAYER_RED_CARD=[];PLAYER_SCORE_FIRST_GOAL=new $c;PLAYER_SCORE=[];PLAYER_SCORE_TWICE=[];PLAYER_SCORE_HATTRICK=[];CORRECT_SCORE=new Ft;CORRECT_SCORE_ADVANCED=new Ft;CORRECT_SCORE_HT=new Ft;OVER_GOALS_0_5=null;OVER_GOALS_1_5=null;OVER_GOALS_2_5=null;OVER_GOALS_3_5=null;OVER_GOALS_4_5=null;OVER_GOALS_5_5=null;OVER_GOALS_6_5=null;OVER_CORNERS_6_5=null;OVER_CORNERS_7_5=null;OVER_CORNERS_8_5=null;OVER_CORNERS_9_5=null;OVER_CORNERS_10_5=null;OVER_CORNERS_11_5=null;OVER_CORNERS_12_5=null;OVER_CORNERS_13_5=null},W=class{no=0;yes=0},Xi=class{gameInstanceId=null;fixtures=null},Pt=class{goldenGoal=null},Na=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new Pt;points=null;templateId=null;groupId=null;profileLastUpdatedAt=null;createdAt=null;updatedAt=null},Ji=(e=>(e.ACTIVE="ACTIVE",e.WON="WON",e.LOST="LOST",e.PARTIALLY_WON="PARTIALLY_WON",e.CANCELED="CANCELED",e))(Ji||{}),Ga=["WON","LOST","PARTIALLY_WON","CANCELED"],Q=class{limit=null;startAfter=null;status=null;type=null;matchIds=null;gameIds=null;constructor(e){this.limit=e?.limit||null,this.startAfter=e?.startAfter||null,this.status=e?.status||null,this.type=e?.type||null,this.matchIds=e?.matchIds||null,this.gameIds=e?.gameIds||null}constructFiltersUrl=()=>{let e="",t=!1;return this.status&&(t=Object.values(Ji).some(a=>this.status.includes(a))),this.limit&&(e+="&",e+=`limit=${this.limit}`),this.startAfter&&(e+="&",e+=`start_after=${this.startAfter}`),this.status&&t&&(e+="&",e+=`status=${this.status.join(",")}`),this.type&&(e+="&",e+=`game_types=${this.type}`),this.matchIds&&this.matchIds.length>0&&(e+="&",e+=`match_ids=${this.matchIds.join(",")}`),this.gameIds&&this.gameIds.length>0&&(e+="&",e+=`game_ids=${this.gameIds.join(",")}`),e}},Bc=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new W;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new W;penaltyMatch=new W;playerScoreFirstGoal={};cornersMatch={};correctScore={};correctScoreHalfTime={};correctScoreAdvanced={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new W;overOnePointFiveGoals=new W;overTwoPointFiveGoals=new W;overThreePointFiveGoals=new W;overFourPointFiveGoals=new W;overFivePointFiveGoals=new W;overSixPointFiveGoals=new W;overSixPointFiveCorners=new W;overSevenPointFiveCorners=new W;overEightPointFiveCorners=new W;overNinePointFiveCorners=new W;overTenPointFiveCorners=new W;overElevenPointFiveCorners=new W;overTwelvePointFiveCorners=new W;overThirteenPointFiveCorners=new W},Hc=class{matchId=null;matchType=null;predictions=null},Vc=class{profileId="";profileModel=null;leagueId="";leagueModel=null;message=""},Ki=class{id="";name="";description="";type="";banned=[];invites=[];administrators=[];membersCount=0;invitationCode="";templateId="";templateModel=null;pastTemplates=[];usersCanInviteUsers=!1;scoringStartsAt="";pinnedPosts=[]},Wc=class extends Ki{members=[]},zc=class{predictionId=null;predictionModel=null;profileId=null;profileModel=null},Zi=class extends B{type=null;constructor(e){super(e),this.type=e&&e.type?e.type:null}constructMainFiltersUrl=()=>{let e=super.constructMainFiltersUrl();return this.type&&(e+=`&type=${this.type}`),e}},qc=class{type="PRIVATE";userRole=null;constructor(e){this.userRole=e?.userRole||null}constructFiltersUrl=()=>{let e=`&type=${this.type}`;return this.userRole&&(e+=`&user_role=${this.userRole}`),e}},jc=class{limit=null;page=null;leagueId=null;templateId=null;sortOrder=null;constructor(e){this.limit=e&&e.limit?e.limit:null,this.page=e&&e.page?e.page:null,this.leagueId=e&&e.leagueId?e.leagueId:null,this.templateId=e&&e.templateId?e.templateId:null,this.sortOrder=e&&e.sortOrder?e.sortOrder:null}constructFiltersUrl=()=>{let e="";return this.limit&&(e+=`&limit=${this.limit}`),this.page&&(e+=`&page=${this.page}`),this.leagueId&&(e+=`&private_league_id=${this.leagueId}`),this.templateId&&(e+=`&template_id=${this.templateId}`),this.sortOrder&&(e+=`&sort_order=${this.sortOrder}`),e}},es=class extends B{reportsCount=null;constructor(e){super(e),this.reportsCount=e.reportsCount?e.reportsCount:null}constructMainFiltersUrl=()=>{let e=super.constructMainFiltersUrl();return this.reportsCount&&(e+=`&reports_count=${this.reportsCount}`),e}},ts=class{limit=null;page=null;profileIds=null;constructor(e){this.limit=e&&e.limit?e.limit:null,this.page=e&&e.page?e.page:null,this.profileIds=e&&e.profileIds?e.leagueId:null}constructFiltersUrl=()=>{let e="";return this.limit&&(e+=`&limit=${this.limit}`),this.page&&(e+=`&page=${this.page}`),this.profileIds&&(e+=`&profile_ids=${this.profileIds.join(",")}`),e}},Qc=class{templateId="";templateModel=null;privateLeagueId="";privateLeagueModel=null;position="";points=0;type="private_league"},Yc=class extends Mi{type="PRIVATE"},Xc=class extends Oi{type="PRIVATE"},Jc=class{id="";source="";type="";favourite=!1},Kc=class extends Jc{model=null},Zc=class extends B{status=null;sortOrder=null;gameIds=null;constructor(e){super(e),this.status=e?.status||null,this.sortOrder=e?.sortOrder||null,this.gameIds=e?.gameIds||null}constructMainFiltersUrl(){let e=super.constructMainFiltersUrl();return this.status&&Object.values(Xe).includes(this.status)?(e+="&",e+=`status=${this.status}`):this.status!==null&&console.warn(`The filter 'status' has the following INVALID value: ${this.status}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.sortOrder&&(this.sortOrder==="asc"||this.sortOrder==="desc"||this.sortOrder==="ASC"||this.sortOrder==="DESC")?(e+="&",e+=`sort_order=${this.sortOrder}`):this.sortOrder!==null&&console.warn(`The filter 'sortOrder' has the following INVALID value: ${this.sortOrder}. It will be not passed as a query param in the URL. For more information visit our documentation.`),this.gameIds&&Array.isArray(this.gameIds)&&this.gameIds.length>0?(e+="&",e+=`game_ids=${this.gameIds.join(",")}`):this.gameIds!==null&&console.warn(`The filter 'gameIds' has the following INVALID value: ${this.gameIds}. It will be not passed as a query param in the URL. For more information visit our documentation.`),e}},ed=class extends B{},td=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new De},ad=class{value=null;result=null},id=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new De;prediction=new ad},gt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;scheduleOpenAt=null;predictionsCutoff=null;fixtures=[];tiebreaker=new bt;participantsCount=0;related=[];excludedProfileIds=null;rules=null;labels=null;customFields=null;branding=null;brandingId=null;flags=null;images=new Pe;createdAt=null;updatedAt=null},as=class extends gt{adContent=null},Vt=class{userId=null;points=null;results=[];tiebreaker=null},sd=class{matchId=null;matchModel=null;outcome=null},oe=class extends B{status=null;type=null;gameIds=null;sortOrder=null;constructor(e){super(e),this.status=e?.status||null,this.type=e?.type||null,this.gameIds=e?.gameIds||null,this.sortOrder=e?.sortOrder||null}constructFiltersUrl=()=>{let e=super.constructMainFiltersUrl();return this.status&&Object.values(Xe).includes(this.status)&&(e+="&",e+=`status=${this.status}`),this.type&&(e+="&",e+=`type=${this.type}`),this.gameIds&&this.gameIds.length>0&&(e+="&",e+=`game_ids=${this.gameIds.join(",")}`),this.sortOrder&&(e+="&",e+=`sort_order=${this.sortOrder}`),e}},dt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new bt;predictionId=null;participantsCount=0;related=[];excludedProfileIds=null;rules=null;flags=null;points=null;createdAt=null;updatedAt=null;predictionsMadeAt=null;predictionsUpdatedAt=null;scheduleOpenAt=null;images=null;predictionTiebreaker=new Pt;branding=null;brandingId=null},rd=class{contestId="";contestType="GAME";contestModel=null;description="";userList=[]},nd=class{position="";profileId="";profileModel=null;note="";tags=[]},is=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(e){this.gameInstanceId=e.gameInstanceId,e.fixtures.forEach(t=>this.fixtures.push(new ea(t.matchId,t.market,t.prediction.value))),this.tiebreaker=e.tiebreaker?e.tiebreaker:null}},At=class extends B{flags=null;status=null;entityIds=null;entityType=null;pollIds=null;sortOrder=null;minVotes=null;language=null;constructor(e){super(e),this.flags=e?.flags||null,this.status=e?.status||null,this.entityIds=e?.entityIds||null,this.entityType=e?.entityType||null,this.pollIds=e?.pollIds||null,this.sortOrder=e?.sortOrder||null,this.minVotes=e&&e.minVotes!==void 0?e.minVotes:null,this.language=e?.language||null}constructMainFiltersUrl(){let e=super.constructMainFiltersUrl();return this.flags&&this.flags.length>0&&(e+=`&flags=${this.flags.join(",")}`),this.status&&(e+=`&status=${this.status}`),this.entityIds&&this.entityIds.length>0&&(e+=`&entity_ids=${this.entityIds.join(",")}`),this.pollIds&&this.pollIds.length>0&&(e+=`&poll_ids=${this.pollIds.join(",")}`),this.sortOrder&&(e+=`&sort_order=${this.sortOrder}`),this.minVotes&&(e+=`&min_votes=${this.minVotes}`),this.language&&(e+=`&language=${this.language}`),e}},ss=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new Pe;status=null;language=null;authRequirement=null;totalVotes=null;flags=[];customFields=null;branding=null;brandingId=null;embedCode=null;labels=null;adContent=null;context=null;options=[];related=[];preferencesEnabled=!1;multipleChoice=!1;maxMultipleChoiceOptions=null;participationCount=0;maxAttempts=0;externalActivity=null;createdAt=null;updatedAt=null},od=class extends ss{rules=null},ld=class{id=null;title=null;description=null;images=new Pe;votes=null;embedCode=null;preferencesMapping=[]},rs=class{preferenceId=""},ta=class{id=null;pollId=null;optionId=null;optionIds=[];userId=null;createdAt=null},cd=class extends ta{pollModel=null;optionModel=null;optionsModels=[];previousVotes=[];attempts=null},dd=class extends ta{previousVotes=[];attempts=null},pd=class{meta=new V;data=[]},ud=class{meta=new V;data=[]},hd=class extends B{matchIds=null;constructor(e){super(e),this.matchIds=e&&e.matchIds?e.matchIds:null}constructFiltersUrl(){let e=super.constructMainFiltersUrl();return this.matchIds&&this.matchIds.length>0&&(e+="&",e+=`match_ids=${this.matchIds.join(",")}`),e}},md=class{meta=new V;data=[]},gd=class{matchId=null;matchModel=null;playerId=null;playerModel=null;createdAt=null},fd=class{total},yd=class{meta=new fd;data=[]},wd=class{teamId=null;teamModel=null;playerId=null;playerModel=null;votes=null;winner=null},_d=class{meta=new fe;data=[]},vd=class{remapListContent=e=>{let t=new _d;return t.meta=this.remapMeta(e.meta),t.data=e.data.map(a=>{let i=new so;return i.entityId=a.entity_id,i.entityType=a.entity_type,i}),t};remapMeta=e=>{let t=new fe;return t.pagination.currentPage=e.pagination.current_page,t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.totalItems=e.pagination.total_items,t.pagination.numberOfPages=e.pagination.number_of_pages,t}},Id=class extends pe{remapBranding=e=>this.remapBranding(e)},_e=class extends se{featureConfigRemapper=null;listContentRemapper=null;brandingRemapper=null;localStorage=null;clientId=null;clientApiSignInUrl=null;constructor(e){super(e,ee(e.environment,"client")),this.clientId=e.clientId,this.localStorage=new Qe().createLocalCacheInstance(e.idSchema),this.featureConfigRemapper=new io,this.listContentRemapper=new vd,this.brandingRemapper=new Id,this.clientApiSignInUrl=`?key=${e.apiKey}`}getConfig=async e=>{let t=await this.getCachedFeatures();if(!t){let a=`/clients/${this.clientId}/features${this.clientApiSignInUrl}`;t=(await this.fetchWithoutAuth(a,"There was a problem fetching client features from Client API")).data,await this.localStorage.setClientFeatures(t)}switch(e){case"predictor":return this.featureConfigRemapper.remapPredictorConfig(t.predictor);case"topX":return this.featureConfigRemapper.remapTopXConfig(t.top_x);case"matchQuiz":return this.featureConfigRemapper.remapMatchQuizConfig(t.match_quiz);case"loyalty":return this.featureConfigRemapper.remapLoyaltyConfig(t.loyalty);case"discussions":return this.featureConfigRemapper.remapDiscussionsConfig(t.discussions);case"fantasy":return this.featureConfigRemapper.remapFantasyConfig(t.football_fantasy)}};getNewLoyaltyConfig=async e=>{let t=`/clients/${this.clientId}/features${this.clientApiSignInUrl}`,a="There was a problem fetching client features from Client API";if(e){let s=t+E(),r=await this.fetchWithoutAuthAdditionalHeaders(s,a,{"x-api-version":"2"});await this.localStorage.setClientFeatures(r.data)}let i=await this.getCachedFeatures();return i||(i=(await this.fetchWithoutAuthAdditionalHeaders(t,a,{"x-api-version":"2"})).data,await this.localStorage.setClientFeatures(i)),this.featureConfigRemapper.remapLoyaltyNewConfig(i.loyalty)};getListContent=async(e,t,a)=>{let i=`/clients/${this.clientId}/lists/${e}/content${this.clientApiSignInUrl}`;t&&(i+=t.constructFiltersUrl()),S(a)&&(i+=E());let s="There was a problem fetching client list content",r=await this.fetchWithoutAuth(i,s);return this.listContentRemapper.remapListContent(r)};getBrandingByIds=async(e,t)=>{if(!e||e.length===0)return new Map;let a=Array.from(new Set(e)),i=`/clients/${this.clientId}/templates/brandings${this.clientApiSignInUrl}`;t&&(i+=`&disable_cache=${Date.now()}`);let s=`There was a problem fetching brandings for IDs: ${a.join(", ")}`;try{let r=await this.fetchWithoutAuth(i,s),n=new Map;return r.data&&Array.isArray(r.data)&&r.data.forEach(o=>{let l=this.brandingRemapper.remapBranding(o);n.set(o.id,l)}),n}catch(r){return console.warn("Failed to fetch brandings, returning empty map",r),new Map}};getBrandingById=async(e,t)=>{if(!e)return null;let a=`/clients/${this.clientId}/templates/brandings/${e}${this.clientApiSignInUrl}`;t&&(a+=`&disable_cache=${Date.now()}`);let i=`There was a problem fetching branding: ${e}`;try{let s=await this.fetchWithoutAuth(a,i);return this.brandingRemapper.remapBranding(s.data)}catch(s){return console.warn(`Failed to fetch branding ${e}, returning null`,s),null}};getCachedFeatures=async()=>{let e=await this.getLocalStorageData();if(!(!e||!Object.keys(e).length))return e.predictor.client_id&&e.predictor.client_id!==this.clientId?(await this.localStorage.deleteClientFeatures(),null):e};getLocalStorageData=async()=>{let e=Math.floor(Date.now()/1e3);return await this.localStorage.getExpiration("client","features")>e?await this.localStorage.getClientFeatures():null}},Et=class{clientHttps=null;errorHandlingMode=null;constructor(e){this.clientHttps=new _e(e),this.errorHandlingMode=e.errorHandlingMode}setAvailableMarketsForMatch=async e=>{let{fullCoverageCompetitions:t,markets:a}=await this.clientHttps.getConfig("predictor");if(Array.isArray(e))return e.map(i=>this.setAvailableMarkets(i,t,a));if(typeof e=="object"&&Object.keys(e).length)return this.setAvailableMarkets(e,t,a)};setAvailableMarkets=(e,t,a)=>{let i=e.context.competition?.id;return i&&this.isMatchInCoverageCompetition(i,t)?(e.availableMarkets=a.all,e):(e.availableMarkets=a.main,e)};setMetaDataBatchRequest=(e,t,a)=>{let i=new fe;if(i.pagination.totalItems=e,i.pagination.itemsPerPage=t,i.pagination.numberOfPages=e?Math.ceil(e/t):0,i.pagination.currentPage=a,i.pagination.numberOfPages>0&&a>i.pagination.numberOfPages)throw this.errorHandlingMode==="standard"?new O(400,"invalid_page_number","Invalid page number provided. Use number between 1 and max number of pages."):new x(400,"invalid_page_number","Invalid page number provided. Use number between 1 and max number of pages.");return i};finalizeMatchesDataBatchRequest=(e,t)=>{e=e.sort((i,s)=>new Date(i.kickoffAt).getTime()-new Date(s.kickoffAt).getTime());let a=t.limit||20;if(t.page){let i=t.page>1?a*(t.page-1):0;e=e.slice(i,i+a)}return!t.page&&e.length>a&&(e=e.slice(0,a)),e};isMatchInCoverageCompetition=(e,t)=>{let a=!1;return t.includes(e)&&(a=!0),a}},Td=class{footballService=null;https=null;idMapping=null;constructor(e,t,a){this.idMapping=a,this.https=t,this.footballService=new Et(e)}getTeamsIdMapping=async(e,t)=>{try{let a=!1;if(e){if(e=new Aa(e),e.countryId){let s=await this.idMapping.getEntityIdsBySchemaId([`${e.countryId}`],"country","native");s.country.length===0&&(a=!0),e.countryId=s.country[0]}if(e.scope){let s=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");s.competition.length===0&&(a=!0),e.scope=s.competition}if(e.teamIds){let s=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");s.team.length===0&&(a=!0),e.teamIds=s.team}}if(a)return[];let i=await this.getTeams(e,t);return i.data=await this.idMapping.remapEntities(i.data,"team"),i}catch(a){throw console.warn("There was a problem browsing all teams",a),a}};getTeamsMapWithNativeIds=async e=>{let t=new Map,a=e.length,i=new Aa({teamIds:e,limit:a}),{data:s}=await this.getTeams(i);s.sort((o,l)=>o.id.localeCompare(l.id));let r=ja(e),n=await this.idMapping.remapEntities(s,"team");return r.forEach((o,l)=>t.set(o,n[l])),t};getTeams=async(e,t)=>{try{return t=t||!1,await this.https.getTeams(e,t)}catch(a){throw console.warn("There was a problem retrieving all teams",a),a}};getTeamByIdIdMapping=async(e,t)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let a=await this.getTeamById(e,t);return await this.idMapping.remapEntities(a,"team")}catch(a){throw console.warn(`There was a problem browsing the following team:${e}`,a),a}};getTeamById=async(e,t)=>{try{return t=t||!1,await this.https.getTeamById(e,t)}catch(a){throw console.warn(`There was a problem retrieving the following team: ${e}`,a),a}};getTopTeamsIdMapping=async e=>{try{let t=await this.getTopTeams(e);return await this.idMapping.remapEntities(t,"team")}catch(t){throw console.warn("There was a problem browsing the top teams",t),t}};getTopTeams=async e=>{try{return e=e||!1,await this.https.getTopTeams(e)}catch(t){throw console.warn("There was a problem retrieving the top teams",t),t}};getNextMatchForTeamIdMapping=async(e,t)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let a=await this.getNextMatchForTeam(e,t);return await this.idMapping.remapEntities(a,"match")}catch(a){throw console.warn(`There was a problem browsing the next match for the following team:${e}`,a),a}};getNextMatchForTeam=async(e,t)=>{try{t=t||!1;let a=await this.https.getNextMatchForTeam(e,t);return await this.footballService.setAvailableMarketsForMatch(a)}catch(a){throw console.warn(`There was a problem retrieving the next match for the following team: ${e}`,a),a}};getPrevMatchForTeamIdMapping=async(e,t)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"team","native")).team[0];let a=await this.getPrevMatchForTeam(e,t);return await this.idMapping.remapEntities(a,"match")}catch(a){throw console.warn(`There was a problem browsing the previous match for the following team:${e}`,a),a}};getPrevMatchForTeam=async(e,t)=>{try{t=t||!1;let a=await this.https.getPrevMatchForTeam(e,t);return await this.footballService.setAvailableMarketsForMatch(a)}catch(a){throw console.warn(`There was a problem retrieving the previous match for the following team: ${e}`,a),a}}},aa=class{https=null;footballService=null;idMapping=null;constructor(e,t,a){this.idMapping=a,this.https=t,this.footballService=new Et(e)}getPlayersIdMapping=async(e,t)=>{try{let a=!1;if(e){if(e=new ka(e),e.countryId){let s=await this.idMapping.getEntityIdsBySchemaId([e.countryId],"country","native");s.country.length===0&&(a=!0),e.countryId=s.country[0]}if(e.playerIds){let s=await this.idMapping.getEntityIdsBySchemaId(e.playerIds,"player","native");s.player.length===0&&(a=!0),e.playerIds=s.player}if(e.scope){let s=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");s.competition.length===0&&(a=!0),e.scope=s.competition}if(a)return[]}let i=await this.getPlayers(e,t);return i.data=await this.idMapping.remapEntities(i.data,"player"),i}catch(a){throw console.warn("There was a problem browsing the players",a),a}};getPlayersWithNativeIds=async e=>{let t=e.length,a=new ka({playerIds:e,limit:t}),i=await this.getPlayers(a);return i.data.sort((s,r)=>s.id.localeCompare(r.id)),await this.idMapping.remapEntities(i.data,"player")};getPlayersMapWithNativeIds=async e=>{let t={},a=_t(e);a.sort((s,r)=>s.localeCompare(r));let i=await this.getPlayersWithNativeIds(Array.from(a));return a.forEach((s,r)=>t[s]=i[r]),t};getPlayers=async(e,t)=>{try{return t=t||!1,await this.https.getPlayers(e,t)}catch(a){throw console.warn("There was a problem retrieving the players",a),a}};getPlayerIdMapping=async(e,t)=>{try{let a=await this.idMapping.getEntityIdsBySchemaId([e],"player","native"),i=await this.getPlayerById(a.player[0],t);return await this.idMapping.remapEntities(i,"player")}catch(a){throw console.warn(`There was a problem browsing the following player:${e}`,a),a}};getPlayerById=async(e,t)=>{try{return t=t||!1,await this.https.getPlayerById(e,t)}catch(a){throw console.warn(`There was a problem retrieving the following player: ${e}`,a),a}};getTopPlayersIdMapping=async e=>{try{let t=await this.getTopPlayers(e);return await this.idMapping.remapEntities(t,"player")}catch(t){throw console.warn("There was a problem browsing the top players",t),t}};getTopPlayers=async e=>{try{return e=e||!1,await this.https.getTopPlayers(e)}catch(t){throw console.warn("There was a problem retrieving the top players",t),t}};getNextMatchForPlayerIdMapping=async(e,t)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let a=await this.getNextMatchForPlayer(e,t);return await this.idMapping.remapEntities(a,"match")}catch(a){throw console.warn(`There was a problem browsing the next match for player:${e}`,a),a}};getNextMatchForPlayer=async(e,t)=>{try{t=t||!1;let a=await this.https.getNextMatchForPlayer(e,t);return await this.footballService.setAvailableMarketsForMatch(a)}catch(a){throw console.warn(`There was a problem retrieving the next match for player: ${e}`,a),a}};getPrevMatchForPlayerIdMapping=async(e,t)=>{try{e=(await this.idMapping.getEntityIdsBySchemaId([e],"player","native")).player[0];let a=await this.getPrevMatchForPlayer(e,t);return await this.idMapping.remapEntities(a,"match")}catch(a){throw console.warn(`There was a problem browsing the previous match for player:${e}`,a),a}};getPrevMatchForPlayer=async(e,t)=>{try{t=t||!1;let a=await this.https.getPrevMatchForPlayer(e,t);return await this.footballService.setAvailableMarketsForMatch(a)}catch(a){throw console.warn(`There was a problem retrieving the previous match for player: ${e}`,a),a}}},ia=class{https=null;idMapping=null;footballService=null;constructor(e,t,a){this.https=t,this.idMapping=a,this.footballService=new Et(e)}getMatchesIdMapping=async(e,t)=>{try{if(e){if(e=new qe(e),e.countryIds&&e.countryIds.length>0){let i=await this.idMapping.getEntityIdsBySchemaId(e.countryIds,"country","native");e.countryIds=i.country}if(e.competitionIds&&e.competitionIds.length>0){let i=await this.idMapping.getEntityIdsBySchemaId(e.competitionIds,"competition","native");e.competitionIds=i.competition}if(e.matchIds&&e.matchIds.length>0){let i=await this.idMapping.getEntityIdsBySchemaId(e.matchIds,"match","native");e.matchIds=i.match}if(e.teamIds&&e.teamIds.length>0){let i=await this.idMapping.getEntityIdsBySchemaId(e.teamIds,"team","native");e.teamIds=i.team}}let a=await this.getMatches(e,t);return a.data=await this.footballService.setAvailableMarketsForMatch([...a.data]),a.data=await this.idMapping.remapEntities(a.data,"match"),a}catch(a){throw console.warn("There was a problem browsing the matches",a),a}};getMatchesWithNativeIds=async e=>{let t=e.length,a=new qe({matchIds:e,limit:t}),i=await this.getMatches(a);return i.data.sort((s,r)=>s.id.localeCompare(r.id)),await this.idMapping.remapEntities(i.data,"match")};getMatchesMapWithNativeIds=async e=>{let t={},a=_t(e);a.sort((s,r)=>s.localeCompare(r));let i=await this.getMatchesWithNativeIds(Array.from(a));if(a.length!==i.length){let s=new qe({matchIds:a,limit:a.length}),r=await this.getMatches(s),n=a.filter(o=>{if(r.data.every(l=>l.id!==o))return o});a=a.filter(o=>{if(!n.includes(o))return o})}return a.forEach((s,r)=>t[s]=i[r]),t};getMatches=async(e,t)=>{try{return t=t||!1,await this.https.getMatches(e,t)}catch(a){throw console.warn("There was a problem retrieving the matches",a),a}};getMatchIdMapping=async(e,t)=>{try{let a=await this.idMapping.getEntityIdsBySchemaId([e],"match","native"),i=await this.getMatchById(a.match[0],t),s=await this.footballService.setAvailableMarketsForMatch(i);return await this.idMapping.remapEntities(s,"match")}catch(a){throw console.warn(`There was a problem browsing the following match: ${e}`,a),a}};getMatchById=async(e,t)=>{try{return t=t||!1,await this.https.getMatchById(e,t)}catch(a){throw console.warn(`There was a problem retrieving the following match: ${e}`,a),a}}},bd=class{https=null;idMapping=null;constructor(e,t){this.https=e,this.idMapping=t}searchIdMapping=async(e,t)=>{try{if(e=new ol(e),e.scope){let i=await this.idMapping.getEntityIdsBySchemaId(e.scope,"competition","native");e.scope=i.competition}let a=await this.search(e,t);if(a.teams&&a.teams.length>0){let i=await this.idMapping.remapEntities(a.teams,"team");a.teams=i}if(a.players&&a.players.length>0){let i=await this.idMapping.remapEntities(a.players,"player");a.players=i}if(a.competitions&&a.competitions.length>0){let i=await this.idMapping.remapEntities(a.competitions,"competition");a.competitions=i}return a}catch(a){throw console.warn("There was a problem with browsing the search result",a),a}};search=async(e,t)=>{try{return await this.https.search(e,t)}catch(a){throw console.warn("There was a problem retrieving the search response",a),a}}},Ee=class{errorHandlingModel=null;constructor(e){this.errorHandlingModel=e}throwException=(e,t,a)=>{throw this.errorHandlingModel==="standard"?new O(e,t,a):new x(e,t,a)}},Pd=class extends Ee{limit=50;constructor(e){super(e.errorHandlingMode)}validateTeamFormArguments=(e,t)=>{(!e||typeof e!="string")&&this.throwException(400,"invalid_team_id","Invalid team ID provided. Please provide a valid team ID."),t&&(t.competitionId&&typeof t.competitionId!="string"&&this.throwException(400,"invalid_competition_id","Invalid competition ID provided. Please provide a valid competition ID."),t.limit&&typeof t.limit!="number"&&this.throwException(400,"invalid_limit","Invalid limit type. The proper type is number."),t.limit&&t.limit>this.limit&&this.throwException(400,"invalid_limit","Invalid limit. The maximum limit is: "+this.limit.toString()))}},ns=class{countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;validator=null;constructor(e,t,a,i){this.countriesFacade=new Rn(t,a,i),this.competitionsFacade=new Sn(t,a,i),this.teamsFacade=new Td(e,a,i),this.playerFacade=new aa(e,a,i),this.matchFacade=new ia(e,a,i),this.searchFacade=new bd(a,i),this.validator=new Pd(e)}getCountries=async e=>this.countriesFacade.getCountriesWithIdMapping(e);getCompetitions=async(e,t)=>this.competitionsFacade.getCompetitionsIdMapping(e,t);getCompetitionById=async(e,t)=>this.competitionsFacade.getCompetitionByIdIdMapping(e,t);getTopCompetitions=async e=>this.competitionsFacade.getTopCompetitionsIdMapping(e);getCompetitionsMapWithNativeIds=async e=>await this.competitionsFacade.getCompetitionsMapWithNativeIds(e);getTeams=async(e,t)=>this.teamsFacade.getTeamsIdMapping(e,t);getTeamById=async(e,t)=>this.teamsFacade.getTeamByIdIdMapping(e,t);getTopTeams=async e=>this.teamsFacade.getTopTeamsIdMapping(e);getNextMatchForTeam=async(e,t)=>this.teamsFacade.getNextMatchForTeamIdMapping(e,t);getPrevMatchForTeam=async(e,t)=>this.teamsFacade.getPrevMatchForTeamIdMapping(e,t);getTeamsMapWithNativeIds=async e=>await this.teamsFacade.getTeamsMapWithNativeIds(e);getPlayers=async(e,t)=>this.playerFacade.getPlayersIdMapping(e,t);getPlayerById=async(e,t)=>this.playerFacade.getPlayerIdMapping(e,t);getTopPlayers=async e=>this.playerFacade.getTopPlayersIdMapping(e);getNextMatchForPlayer=async(e,t)=>this.playerFacade.getNextMatchForPlayerIdMapping(e,t);getPrevMatchForPlayer=async(e,t)=>this.playerFacade.getPrevMatchForPlayerIdMapping(e,t);getPlayersMapWithNativeIds=async e=>this.playerFacade.getPlayersMapWithNativeIds(e);getMatches=async(e,t)=>this.matchFacade.getMatchesIdMapping(e,t);getMatchesMapWithNativeIds=async e=>this.matchFacade.getMatchesMapWithNativeIds(e);getMatchById=async(e,t)=>this.matchFacade.getMatchIdMapping(e,t);search=async(e,t)=>this.searchFacade.searchIdMapping(e,t);getTeamForm=async(e,t,a)=>{this.validator.validateTeamFormArguments(e,t);let i=t?.direction||"ltr",s={teamIds:[e],competitionIds:t&&t.competitionId?[t.competitionId]:null,status:"finished",limit:t?.limit||5,sortField:"date",sortOrder:"desc"},r=await this.matchFacade.getMatchesIdMapping(s,a),n={teamId:e,matches:[]};if(n.matches=r.data.map(o=>{let l=o.homeTeam.id===e,c=o.scores.ftScore.homeGoals??0,d=o.scores.ftScore.awayGoals??0,p;return l?p=c>d?"W":c<d?"L":"D":p=d>c?"W":d<c?"L":"D",{matchModel:o,isHomeGame:l,result:p}}),i==="ltr"){let o=Array.from(n.matches);n.matches=o.reverse()}return n}},me=class{countriesFromResponse=e=>{if(e)return e.map(t=>this.countryFromResponse(t))};countryFromResponse=e=>{try{if(e){let t=new zo;return t.id=e.id,t.alias=e.alias,t.assets=e.assets,t.countryCode=e.country_code,t.name=e.name,t}}catch(t){throw t}return null}},Le=class{countryRemapper=null;constructor(){this.countryRemapper=new me}fromResponse(e){try{let t=new Vo;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.type=e.type,t.name=e.name,t}catch(t){throw console.warn("There was a problem remapping the competition response",t),t}}},Re=class{countryRemapper=null;constructor(){this.countryRemapper=new me}fromResponse(e){try{let t=new il;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.code=e.code,t.national=e.national,t.fullName=e.full_name,t.shortName=e.short_name,t.name=e.name,t.isDeleted=e.is_deleted,t.undecided=e.undecided,t}catch(t){throw console.warn("There was a problem remapping teams response",t),t}}},Ed=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new me,this.teamBasicRemapper=new Re}fromResponse(e){try{let t=new Wo;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.type=e.type,t.name=e.name,t.participants=e.participants.map(a=>this.teamBasicRemapper.fromResponse(a)),t}catch(t){throw console.warn("There was a problem remapping the competition response",t),t}}},Rd=class{countryRemapper=null;constructor(){this.countryRemapper=new me}fromResponse(e){try{let t=new el;return t.id=e.id,t.startDate=e.start_date,t.endDate=e.end_date,t.shirtNumber=e.shirt_number,t.loan=e.loan,t.position=e.position,t.country=this.countryRemapper.countryFromResponse(e.country),t.name=e.name,t.assets=e.assets,t.birthDate=e.birth_date,t}catch(t){throw console.warn("There was a problem remapping the player from squad",t),t}}},Sd=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new me,this.competitionRemapper=new Le,this.playerRemapper=new Rd}fromResponse(e){try{let t=new rl;return t.id=e.id,t.country=this.countryRemapper.countryFromResponse(e.country),t.gender=e.gender,t.assets=e.assets,t.code=e.code,t.national=e.national,t.fullName=e.full_name,t.shortName=e.short_name,t.name=e.name,t.isDeleted=e.is_deleted,t.undecided=e.undecided,t.competitions=e.competitions?e.competitions.map(a=>this.competitionRemapper.fromResponse(a)):[],t.colors=e.colors?e.colors:t.colors,t.squad=e.squad?e.squad.map(a=>this.playerRemapper.fromResponse(a)):[],t}catch(t){throw console.warn("There was a problem remapping team response",t),t}}},os=class{fromResponse(e){try{let t=new Yo;return t.ftScore=this.statEntityFromResponse(e.ft_score),t.htScore=this.statEntityFromResponse(e.ht_score),t.aetScore=this.statEntityFromResponse(e.aet_score),t.aggScore=this.statEntityFromResponse(e.agg_score),t.penScore=this.statEntityFromResponse(e.pen_score),t}catch(t){throw console.warn("There was a problem remapping the scores",t),t}}statEntityFromResponse=e=>({homeGoals:e.home_goals,awayGoals:e.away_goals})},Cd=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new Re,this.competitionRemapper=new Le,this.scoresRemapper=new os}fromResponse(e){try{let t=new qo;return t.id=e.id,t.kickoffAt=e.kickoff_at,t.finishedAt=e.finished_at,t.updatedAt=e.updated_at,t.isDeleted=e.is_deleted,t.undecided=e.undecided,t.homeTeam=this.teamRemapper.fromResponse(e.home_team),t.awayTeam=this.teamRemapper.fromResponse(e.away_team),t.lineupsConfirmed=e.lineups_confirmed,t.startedAt=e.started_at,t.minute=e.minute,t.scores=this.scoresRemapper.fromResponse(e.scores),t.context={competition:e.context.competition?this.competitionRemapper.fromResponse(e.context.competition):null},t.status={type:e.status.type,subType:e.status.sub_type},t}catch(t){throw console.warn("There was a problem remapping the match response",t),t}}},Md=class{fromResponse(e){try{let t=new Qo;return t.corners=this.statEntityFromResponse(e.corners),t.cornersFirstHalf=this.statEntityFromResponse(e.corners_1h),t.cornersSecondHalf=this.statEntityFromResponse(e.corners_2h),t.cornersExtraTime=this.statEntityFromResponse(e.corners_et),t.crosses=this.statEntityFromResponse(e.crosses),t.crossesFirstHalf=this.statEntityFromResponse(e.crosses_1h),t.crossesSecondHalf=this.statEntityFromResponse(e.crosses_2h),t.crossesExtraTime=this.statEntityFromResponse(e.crosses_et),t.offside=this.statEntityFromResponse(e.offside),t.offsideFirstHalf=this.statEntityFromResponse(e.offside_1h),t.offsideSecondHalf=this.statEntityFromResponse(e.offside_2h),t.offsideExtraTime=this.statEntityFromResponse(e.offside_et),t.shotsOn=this.statEntityFromResponse(e.shots_on),t.shotsOnFirstHalf=this.statEntityFromResponse(e.shots_on_1h),t.shotsOnSecondHalf=this.statEntityFromResponse(e.shots_on_2h),t.shotsOnExtraTime=this.statEntityFromResponse(e.shots_on_et),t.throwIn=this.statEntityFromResponse(e.throw_in),t.throwInFirstHalf=this.statEntityFromResponse(e.throw_in_1h),t.throwInSecondHalf=this.statEntityFromResponse(e.throw_in_2h),t.throwInExtraTime=this.statEntityFromResponse(e.throw_in_et),t.redCards=this.statEntityFromResponse(e.red_cards),t.redCardsFirstHalf=this.statEntityFromResponse(e.red_cards_1h),t.redCardsSecondHalf=this.statEntityFromResponse(e.red_cards_2h),t.redCardsExtraTime=this.statEntityFromResponse(e.red_cards_et),t.shotsOff=this.statEntityFromResponse(e.shots_off),t.shotsOffFirstHalf=this.statEntityFromResponse(e.shots_off_1h),t.shotsOffSecondHalf=this.statEntityFromResponse(e.shots_off_2h),t.shotsOffExtraTime=this.statEntityFromResponse(e.shots_off_et),t.goalKicks=this.statEntityFromResponse(e.goal_kicks),t.goalKicksFirstHalf=this.statEntityFromResponse(e.goal_kicks_1h),t.goalKicksSecondHalf=this.statEntityFromResponse(e.goal_kicks_2h),t.goalKicksExtraTime=this.statEntityFromResponse(e.goal_kicks_et),t.possession=this.statEntityFromResponse(e.possession),t.possessionFirstHalf=this.statEntityFromResponse(e.possession_1h),t.possessionSecondHalf=this.statEntityFromResponse(e.possession_2h),t.possessionExtraTime=this.statEntityFromResponse(e.possession_et),t.treatments=this.statEntityFromResponse(e.treatments),t.treatmentsFirstHalf=this.statEntityFromResponse(e.treatments_1h),t.treatmentsSecondHalf=this.statEntityFromResponse(e.treatments_2h),t.treatmentsExtraTime=this.statEntityFromResponse(e.treatments_et),t.yellowCards=this.statEntityFromResponse(e.yellow_cards),t.yellowCardsFirstHalf=this.statEntityFromResponse(e.yellow_cards_1h),t.yellowCardsSecondHalf=this.statEntityFromResponse(e.yellow_cards_2h),t.yellowCardsExtraTime=this.statEntityFromResponse(e.yellow_cards_et),t.shotsBlocked=this.statEntityFromResponse(e.shots_blocked),t.shotsBlockedFirstHalf=this.statEntityFromResponse(e.shots_blocked_1h),t.shotsBlockedSecondHalf=this.statEntityFromResponse(e.shots_blocked_2h),t.shotsBlockedExtraTime=this.statEntityFromResponse(e.shots_blocked_et),t.substitutions=this.statEntityFromResponse(e.substitutions),t.substitutionsFirstHalf=this.statEntityFromResponse(e.substitutions_1h),t.substitutionsSecondHalf=this.statEntityFromResponse(e.substitutions_2h),t.substitutionsExtraTime=this.statEntityFromResponse(e.substitutions_et),t.counterAttacks=this.statEntityFromResponse(e.counter_attacks),t.counterAttacksFirstHalf=this.statEntityFromResponse(e.counter_attacks_1h),t.counterAttacksSecondHalf=this.statEntityFromResponse(e.counter_attacks_2h),t.counterAttacksExtraTime=this.statEntityFromResponse(e.counter_attacks_et),t.foulsCommitted=this.statEntityFromResponse(e.fouls_committed),t.foulsCommittedFirstHalf=this.statEntityFromResponse(e.fouls_committed_1h),t.foulsCommittedSecondHalf=this.statEntityFromResponse(e.fouls_committed_2h),t.foulsCommittedExtraTime=this.statEntityFromResponse(e.fouls_committed_et),t}catch(t){throw console.warn("There was a problem remapping the stats",t),t}}statEntityFromResponse=e=>({homeTeam:e?e.home_team:null,awayTeam:e?e.away_team:null})},ls=class{fromResponse(e){try{let t=new al;return t.id=e.id,t.name=e.name,t.position=e.position,t.shirtNumber=e.shirt_number,t.assets=e.assets,t.type=e.type,t}catch(t){throw console.warn("There was a problem remapping the player from timeline",t),t}}},Od=class{playerRemapper=null;constructor(){this.playerRemapper=new ls}fromResponse(e){try{let t=new Di;return t.homeTeam.players=e.home_team&&e.home_team.players?e.home_team.players.map(a=>this.playerRemapper.fromResponse(a)):[],t.awayTeam.players=e.away_team&&e.away_team.players?e.away_team.players.map(a=>this.playerRemapper.fromResponse(a)):[],t}catch(t){throw console.warn("There was a problem remapping the lineups",t),t}}},Fd=class{playerRemapper=null;constructor(){this.playerRemapper=new ls}fromResponse(e){try{let t=new Xo;return t.minute=e.minute,t.type=e.type,t.teamId=e.team_id,t.player=this.playerRemapper.fromResponse(e.player),t.relatedPlayer=e.related_player?this.playerRemapper.fromResponse(e.related_player):null,t.updatedAt=e.updated_at,t}catch(t){throw console.warn("There was a problem remapping timeline",t),t}}},Ad=class{fromResponse(e){try{let t=new Jo;return t.playerId=e.player_id,t.position=e.position,t.minutesPlayed=e.minutes_played,t.yellowCards=e.yellow_cards,t.redCards=e.red_cards,t.goals=e.goals,t.penaltyGoals=e.penalty_goals,t.penaltyCommitted=e.penalty_committed,t.penaltyWon=e.penalty_won,t.penaltyMissed=e.penalty_missed,t.penaltySaved=e.penalty_saved,t.penaltyReceived=e.penalty_received,t.ownGoals=e.own_goals,t.assists=e.assists,t.cleanSheets=e.clean_sheets,t.shots=e.shots,t.shotsOn=e.shots_on,t.shotsBlocked=e.shots_blocked,t.offsides=e.offsides,t.foulsCommitted=e.fouls_committed,t.foulsWon=e.fouls_won,t.tackles=e.tackles,t.tacklesBlocks=e.tackles_blocks,t.tacklesInterceptions=e.tackles_interceptions,t.concededGoals=e.conceded_goals,t.caughtBall=e.caught_ball,t.saves=e.saves,t.passes=e.passes,t.crosses=e.crosses,t.interceptions=e.interceptions,t.keyPasses=e.key_passes,t.passesAccuracy=e.passes_accuracy,t.duels=e.duels,t.duelsWon=e.duels_won,t.dribblesAttempts=e.dribbles_attempts,t.dribblesSuccess=e.dribbles_success,t.dribblesPast=e.dribbles_past,t.updatedAt=e.updated_at,t}catch(t){throw console.warn("There was a problem remapping the player stats",t),t}}},kd=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;playerStatsMapper=null;constructor(){this.teamMapper=new Re,this.competitionsMapper=new Le,this.lineupsMapper=new Od,this.scoresMapper=new os,this.statsMapper=new Md,this.timelineMapper=new Fd,this.playerStatsMapper=new Ad}fromResponse(e){try{let t=new jo;return t.id=e.id,t.kickoffAt=e.kickoff_at,t.finishedAt=e.finished_at,t.updatedAt=e.updated_at,t.isDeleted=e.is_deleted,t.undecided=e.undecided,t.homeTeam=e.home_team?this.teamMapper.fromResponse(e.home_team):null,t.awayTeam=e.away_team?this.teamMapper.fromResponse(e.away_team):null,t.lineupsConfirmed=e.lineups_confirmed,t.startedAt=e.started_at,t.minute=e.minute,t.scores=this.scoresMapper.fromResponse(e.scores),t.stats=this.statsMapper.fromResponse(e.stats),t.playerStats=e.player_stats?e.player_stats.map(a=>this.playerStatsMapper.fromResponse(a)):e.player_stats,t.context={competition:this.competitionsMapper.fromResponse(e.context.competition)},t.timeline=e.timeline?e.timeline.map(a=>this.timelineMapper.fromResponse(a)):[],t.status={type:e.status.type,subType:e.status.sub_type},t.lineups=e.lineups?this.lineupsMapper.fromResponse(e.lineups):new Di,t}catch(t){throw console.warn("There was a problem remapping the match response",t),t}}},Dd=class{countryRemapper=null;constructor(){this.countryRemapper=new me}fromResponse(e){try{let t=new tl;return t.id=e.id,t.firstName=e.first_name?e.first_name:null,t.lastName=e.last_name?e.last_name:null,t.name=e.name?e.name:null,t.birthDate=e.birth_date,t.country=this.countryRemapper.countryFromResponse(e.country),t.assets=e.assets,t.position=e.position,t}catch(t){throw console.warn("There was a problem remapping top player response",t),t}}},cs=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new me,this.teamRemapper=new Re}fromResponse(e){try{let t=new Ko;return t.id=e.id,t.firstName=e.first_name?e.first_name:null,t.lastName=e.last_name?e.last_name:null,t.name=e.name?e.name:null,t.birthDate=e.birth_date,t.country=this.countryRemapper.countryFromResponse(e.country),t.assets=e.assets,t.teams=e.teams?e.teams.map(a=>this.teamRemapper.fromResponse(a)):[],t.position=e.position,t.isDeleted=e.is_deleted,t}catch(t){throw console.warn("There was a problem remapping players response",t),t}}},Ld=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new me,this.teamRemapper=new Re,this.competitionRemapper=new Le}fromResponse(e){try{let t=new Zo;return t.id=e.id,t.firstName=e.first_name?e.first_name:null,t.lastName=e.last_name?e.last_name:null,t.name=e.name?e.name:null,t.birthDate=e.birth_date,t.country=this.countryRemapper.countryFromResponse(e.country),t.assets=e.assets,t.teams=e.teams?e.teams.map(a=>this.teamRemapper.fromResponse(a)):[],t.position=e.position,t.isDeleted=e.is_deleted,t.competitions=e.competitions?e.competitions.map(a=>this.competitionRemapper.fromResponse(a)):[],t}catch(t){throw console.warn("There was a problem remapping player response",t),t}}},xd=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new Re,this.playerRemapper=new cs,this.competitionremapper=new Le}fromResponse(e){try{let t=new nl;return t.teams=e.teams?e.teams.map(a=>this.teamRemapper.fromResponse(a)):[],t.players=e.players?e.players.map(a=>this.playerRemapper.fromResponse(a)):[],t.competitions=e.competitions?e.competitions.map(a=>this.competitionremapper.fromResponse(a)):[],t}catch(t){throw console.warn("There was a problem remapping search response",t),t}}},Nd=class{remapMetaProp=e=>{let t=new fe;return t.pagination.currentPage=e.pagination.current_page,t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.totalItems=e.pagination.total_items,t.pagination.numberOfPages=e.pagination.number_of_pages,t}},Gd=class{remapPlayersPoints=e=>{let t=new Uo;return t.meta.filters.templateId=e.meta.filters.template_id,t.data=e.data.map(a=>this.remapPlayersPointsData(a)),t};remapPlayersPointsData=e=>{let t=new Ho;return t.playerId=e.player_id,t.points=e.points,t.rank=e.rank,t};remapPlayerDetailedStats=e=>{let t=new xo;return t.meta.filters.templateId=e.meta.filters.template_id,t.meta.filters.playerId=e.meta.filters.player_id,t.data=e.data.map(a=>this.remapPlayerDetailedData(a)),t};remapPlayerDetailedData=e=>{let t=new Bo;return t.matchId=e.match_id,t.points=e.points?this.remapPlayerDetailedPoints(e.points):null,t.stats=e.stats?this.remapPlayerDetailedStatsData(e.stats):null,t};remapPlayerDetailedPoints=e=>{let t=new ki;return t.total=e.total,t.minutesPlayed=e.minutes_played,t.yellowCards=e.yellow_cards,t.redCards=e.red_cards,t.goals=e.goals,t.penaltyGoals=e.penalty_goals,t.ownGoals=e.own_goals,t.assists=e.assists,t.cleanSheets=e.clean_sheets,t.shots=e.shots,t.shotsOn=e.shots_on,t.offsides=e.offsides,t.foulsCommitted=e.fouls_committed,t.penaltyCommitted=e.penalty_committed,t.penaltyWon=e.penalty_won,t.penaltyMissed=e.penalty_missed,t.tackles=e.tackles,t.concededGoals=e.conceded_goals,t.caughtBall=e.caught_ball,t.saves=e.saves,t};remapPlayerDetailedStatsData=e=>{let t=new Xt;return t.minutesPlayed=e.minutes_played,t.yellowCards=e.yellow_cards,t.redCards=e.red_cards,t.goals=e.goals,t.penaltyGoals=e.penalty_goals,t.penaltyCommitted=e.penalty_committed,t.penaltyWon=e.penalty_won,t.penaltyMissed=e.penalty_missed,t.penaltySaved=e.penalty_saved,t.penaltyReceived=e.penalty_received,t.ownGoals=e.own_goals,t.assists=e.assists,t.cleanSheets=e.clean_sheets,t.shots=e.shots,t.shotsOn=e.shots_on,t.shotsBlocked=e.shots_blocked,t.offsides=e.offsides,t.foulsCommitted=e.fouls_committed,t.foulsWon=e.fouls_won,t.tackles=e.tackles,t.tacklesBlocks=e.tackles_blocks,t.tacklesInterceptions=e.tackles_interceptions,t.concededGoals=e.conceded_goals,t.caughtBall=e.caught_ball,t.saves=e.saves,t.passes=e.passes,t.crosses=e.crosses,t.interceptions=e.interceptions,t.keyPasses=e.key_passes,t.passesAccuracy=e.passes_accuracy,t.duels=e.duels,t.duelsWon=e.duels_won,t.dribblesAttempts=e.dribbles_attempts,t.dribblesSuccess=e.dribbles_success,t.dribblesPast=e.dribbles_past,t}},Ke=class extends se{limitIds=200;countryRemapper=null;competitionBasicRemapper=null;competitionFullRemapper=null;teamBasicRemapper=null;teamFullRemapper=null;matchBasicRemapper=null;matchFullRemapper=null;playerBasicRemapper=null;playerFullRemapper=null;topPlayerRemapper=null;searchRemapper=null;footballMetaRemapper=null;fantasyRemapper=null;footballService=null;constructor(e){super(e,ee(e.environment,"football")),this.apiSignInUrl=e.lang!=="en"?this.apiSignInUrl+`&lang=${e.lang}`:this.apiSignInUrl,this.countryRemapper=new me,this.competitionBasicRemapper=new Le,this.competitionFullRemapper=new Ed,this.teamBasicRemapper=new Re,this.teamFullRemapper=new Sd,this.matchBasicRemapper=new Cd,this.matchFullRemapper=new kd,this.playerBasicRemapper=new cs,this.playerFullRemapper=new Ld,this.topPlayerRemapper=new Dd,this.searchRemapper=new xd,this.footballMetaRemapper=new Nd,this.footballService=new Et(e),this.fantasyRemapper=new Gd}getCountries=async e=>{let t="There was a problem with the football countries request",a=`/countries${this.apiSignInUrl}`,i=Date.now();e&&(a+=`&disable_cache=${i}`);let s=await this.fetchWithoutAuth(a,t);return this.countryRemapper.countriesFromResponse(s.data)};getCompetitions=async(e,t)=>{let a=Date.now(),i="There was a problem with football competitions request";if(t=t||!1,e&&e.competitionIds&&e.competitionIds.length>this.limitIds-1){let s=[],r=Fe(e.competitionIds,this.limitIds);for(let n of r){e.competitionIds=n;let o=`/competitions${this.apiSignInUrl}${e.constructFilterUrl()}`;t&&(o+=`&disable_cache=${a}`);let l=await this.fetchWithoutAuth(o,i);s.push(l.data.map(c=>this.competitionBasicRemapper.fromResponse(c)))}return Array.prototype.concat.apply([],s)}else{let s=`/competitions${this.apiSignInUrl}`;return e&&(s+=`${e.constructFilterUrl()}`),t&&(s+=`&disable_cache=${a}`),(await this.fetchWithoutAuth(s,i)).data.map(r=>this.competitionBasicRemapper.fromResponse(r))}};getCompetitionById=async(e,t)=>{let a=`/competitions/${e}${this.apiSignInUrl}`,i="There was a problem with football competition by ID request",s=Date.now();t&&(a+=`&disable_cache=${s}`);let r=await this.fetchWithoutAuth(a,i);return this.competitionFullRemapper.fromResponse(r.data)};getTopCompetitions=async e=>{let t="There was a problem with top football competitions request",a=`/competitions/top${this.apiSignInUrl}`,i=Date.now();return e&&(a+=`&disable_cache=${i}`),(await this.fetchWithoutAuth(a,t)).data.map(s=>this.competitionBasicRemapper.fromResponse(s))};getTeams=async(e,t)=>{let a=Date.now(),i="There was a problem with football teams request";if(e&&e.teamIds&&e.teamIds.length>this.limitIds){let s=[],r=Fe(e.teamIds,this.limitIds);for(let n of r){e.teamIds=n,e.limit=n.length;let o=`/teams${this.apiSignInUrl}${e.constructFilterUrl()}`;t&&(o+=`&disable_cache=${a}`);let l=await this.fetchWithoutAuth(o,i);s.push(l.data.map(c=>this.teamBasicRemapper.fromResponse(c)))}return Array.prototype.concat.apply([],s)}else{let s=new rt,r=`/teams${this.apiSignInUrl}`;e&&(r+=`${e.constructFilterUrl()}`),t&&(r+=`&disable_cache=${a}`);let n=await this.fetchWithoutAuth(r,i);return s.meta=this.footballMetaRemapper.remapMetaProp(n.meta),s.data=n.data.map(o=>this.teamBasicRemapper.fromResponse(o)),s}};getTeamById=async(e,t)=>{let a="There was a problem with football team by ID request",i=`/teams/${e}${this.apiSignInUrl}`,s=Date.now();t&&(i+=`&disable_cache=${s}`);let r=await this.fetchWithoutAuth(i,a);return this.teamFullRemapper.fromResponse(r.data)};getTopTeams=async e=>{let t=`/teams/top${this.apiSignInUrl}`,a="There was a problem with top football teams request",i=Date.now();e&&(t+=`$disable_cache=${i}`);let s=await this.fetchWithoutAuth(t,a);return s.data?s.data.map(r=>this.teamBasicRemapper.fromResponse(r)):[]};getNextMatchForTeam=async(e,t)=>{let a=`/teams/${e}/next-match${this.apiSignInUrl}`,i=Date.now(),s="There was a problem with next match for team request";t&&(a+=`&disable_cache=${i}`);let r=await this.fetchWithoutAuth(a,s);return this.matchFullRemapper.fromResponse(r.data)};getPrevMatchForTeam=async(e,t)=>{let a=`/teams/${e}/previous-match${this.apiSignInUrl}`,i=Date.now(),s="There was a problem with previous match for team request";t&&(a+=`&disable_cache=${i}`);let r=await this.fetchWithoutAuth(a,s);return this.matchFullRemapper.fromResponse(r.data)};getPlayers=async(e,t)=>{let a=Date.now(),i="There was a problem with football players request";if(e&&e.playerIds&&e.playerIds.length>this.limitIds-1){let s=[],r=Fe(e.playerIds,this.limitIds);for(let l of r){e.playerIds=l,e.limit=l.length;let c=`/players${this.apiSignInUrl}${e.constructFilterUrl()}`;t&&(c+=`&disable_cache=${a}`);let d=await this.fetchWithoutAuth(c,i);s.push(d.data.map(p=>this.playerBasicRemapper.fromResponse(p)))}let n=Array.prototype.concat.apply([],s),o=new rt;return o.data=n,o}else{let s=new rt,r=`/players${this.apiSignInUrl}`;e&&(r+=`${e.constructFilterUrl()}`),t&&(r+=`&disable_cache=${a}`);let n=await this.fetchWithoutAuth(r,i);return s.meta=this.footballMetaRemapper.remapMetaProp(n.meta),s.data=n.data.map(o=>this.playerBasicRemapper.fromResponse(o)),s}};getPlayerById=async(e,t)=>{let a=`/players/${e}${this.apiSignInUrl}`,i=Date.now(),s="There was a problem with football player by ID request";t&&(a+=`&disable_cache=${i}`);let r=await this.fetchWithoutAuth(a,s);return this.playerFullRemapper.fromResponse(r.data)};getTopPlayers=async e=>{let t=`/players/top${this.apiSignInUrl}`,a=Date.now();return e&&(t+=`&disable_cache=${a}`),(await this.fetchWithoutAuth(t,"There was a problem with top football players request")).data.map(s=>this.topPlayerRemapper.fromResponse(s))};getNextMatchForPlayer=async(e,t)=>{let a=`/players/${e}/next-match${this.apiSignInUrl}`,i=Date.now(),s="There was a problem with next match for player request";t&&(a+=`&disable_cache=${i}`);let r=await this.fetchWithoutAuth(a,s);return this.matchFullRemapper.fromResponse(r.data)};getPrevMatchForPlayer=async(e,t)=>{let a=`/players/${e}/previous-match${this.apiSignInUrl}`,i=Date.now(),s="There was a problem with previous match for player request";t&&(a+=`&disable_cache=${i}`);let r=await this.fetchWithoutAuth(a,s);return this.matchFullRemapper.fromResponse(r.data)};getMatchById=async(e,t)=>{let a=`/matches/${e}${this.apiSignInUrl}`,i=Date.now(),s="There was a problem with match by ID request";t&&(a+=`&disable_cache=${i}`);let r=await this.fetchWithoutAuth(a,s);return this.matchFullRemapper.fromResponse(r.data)};getMatches=async(e,t)=>{let a=new rt,i="There was a problem with football matches request";if(e&&e.matchIds&&e.matchIds.length>this.limitIds){let s=[],r=Fe(e.matchIds,this.limitIds);for(let o of r){let l=new qe({...e,matchIds:o,limit:o.length}),c=!0,d=`/matches${this.apiSignInUrl}${l.constructFilterUrl(c)}&limit=${o.length}`;t&&(d+=E());let p=await this.fetchWithoutAuth(d,i);s.push(p.data.map(m=>this.matchBasicRemapper.fromResponse(m)))}let n=Array.prototype.concat.apply([],s);return a.meta=this.footballService.setMetaDataBatchRequest(n.length,e.limit||20,e.page||1),a.data=this.footballService.finalizeMatchesDataBatchRequest(n,e),a}else{let s=`/matches${this.apiSignInUrl}`;e&&(s+=`${e.constructFilterUrl()}`),t&&(s+=E());let r=await this.fetchWithoutAuth(s,i);return a.meta=this.footballMetaRemapper.remapMetaProp(r.meta),a.data=r.data.map(n=>this.matchBasicRemapper.fromResponse(n)),a}};search=async(e,t)=>{let a=`/search${this.apiSignInUrl}${e.constructFilterUrl()}`,i=Date.now(),s="There was a problem with football search request";t&&(a+=`&disable_cache=${i}`);let r=await this.fetchWithoutAuth(a,s);return this.searchRemapper.fromResponse(r.data)};getPlayersPoints=async(e,t,a)=>{let i=`/players/points/${e}${this.apiSignInUrl}`,s=Date.now(),r="There was a problem with players points request";t&&(i+=`&position=${t.toLocaleLowerCase()}`),a&&(i+=`&disable_cache=${s}`);let n=await this.fetchWithoutAuth(i,r);return this.fantasyRemapper.remapPlayersPoints(n)};getPlayerDetailedStatistics=async(e,t,a)=>{let i=`/players/${t}/points/${e}${this.apiSignInUrl}`,s=Date.now(),r="There was a problem with detailed player points request";a&&(i+=`&disable_cache=${s}`);let n=await this.fetchWithoutAuth(i,r);return this.fantasyRemapper.remapPlayerDetailedStats(n)}},$d=class{idMapping=null;idSchema=null;native="native";footballFacade=null;constructor(e,t,a){this.idMapping=a,this.idSchema=e.idSchema,this.footballFacade=t}remapProfileStats=async e=>{if(!e.predictions)return e;let{successRates:t,predictions:a}=e,i={competition:this.getIdsKeys(t.byFootballCompetition,a.single.breakdown.footballCompetitions),team:this.getIdsKeys(t.byFootballTeam,a.single.breakdown.footballTeams)};if(Object.values(i.competition).length){let s=JSON.parse(JSON.stringify(e.successRates.byFootballCompetition)),r=await this.getEntitiesMap(i.competition,"competition"),n=await this.setSuccessRatesModels(s,r);e.successRates.byFootballCompetition=n,a.single.breakdown.footballCompetitions=this.reconstructBreakdown(a.single.breakdown.footballCompetitions,r)}if(Object.values(i.team).length){let s=JSON.parse(JSON.stringify(e.successRates.byFootballTeam)),r=await this.getEntitiesMap(i.team,"team"),n=await this.setSuccessRatesModels(s,r);e.successRates.byFootballTeam=n,a.single.breakdown.footballTeams=this.reconstructBreakdown(a.single.breakdown.footballTeams,r)}return e};setSuccessRatesModels=async(e,t)=>this.reconstructRecords(e,void 0,t);getEntitiesMap=async(e,t)=>{switch(t){case"competition":return await this.footballFacade.getCompetitionsMapWithNativeIds(e);case"team":return await this.footballFacade.getTeamsMapWithNativeIds(e)}};reconstructRecords=(e,t,a)=>e&&Object.keys(e).length?(Object.keys(e).forEach(i=>{let s=a.get(i);t={...t,[s.id]:e[i]},t[s.id].model=s}),t):e;reconstructBreakdown=(e,t)=>e.length?e.map(a=>{let i=t.get(a.entityId);return a.entityId=i.id,a.model=i,a}):e;getIdsKeys=(e,t)=>{let a=Object.keys(e);if(t.length){let i=t.map(s=>s.entityId);return Array.from(new Set([...a,...i]))}return a};remapInterestsToIdSchema=async e=>{if(this.idSchema!==this.native)if(e&&e.length>0){let t={},a={},i=e.filter(o=>o.source.toLocaleUpperCase()==="FOOTBALL"),s=e.filter(o=>o.source.toLocaleUpperCase()!=="FOOTBALL");i.forEach(o=>{t.hasOwnProperty(o.type)||(t[o.type]=[],a[o.type]=[]),t[o.type].push(o.id),a[o.type].push(o)});let r=await this.remapIdsObj(t,this.native,this.idSchema),n=[];for(let[o,l]of Object.entries(a))l.forEach((c,d)=>{c.id=r[o][d],n.push(c)});return n.concat(s)}else return e;return e};remapInterestToNative=async e=>{if(this.idSchema!==this.native&&e.source.toLocaleUpperCase()==="FOOTBALL"){let t={},{id:a,type:i}=e;t[i]=[a];let s=await this.remapIdsObj(t,this.idSchema,this.native);return e.id=s[i][0],e}return e};inquiryCustomInterests=(e,t)=>{let a=[];return e&&e.length>0&&(a=e.filter(i=>i.source.toLocaleUpperCase()==="CUSTOM"),t)?a.map(i=>{let s=new Kc;return s.id=i.id,s.type=i.type,s.source=i.source,s.favourite=i.favourite,s}):a};remapInterests=async e=>{let t=this.inquiryCustomInterests(e,!1);if(t&&t.length>0){let a=e.filter(s=>s.source.toLocaleUpperCase()!=="CUSTOM"),i=await this.remapInterestsToIdSchema(a);return t.forEach(s=>i.push(s)),i}return await this.remapInterestsToIdSchema(e)};showFullInterests=async e=>{let t=[];if(e&&e.length>0){let a=this.inquiryCustomInterests(e,!0);t.push(a);let i=e.filter(l=>l.source.toLocaleUpperCase()!=="CUSTOM"),{competitionsMap:s,teamsMap:r,playersMap:n}=await this.getInterestsEntitiesMap(i),o=i.map(l=>{let c=null;if(l.source.toLocaleUpperCase()==="FOOTBALL"){if(l.type==="competition")return c=s.get(l.id),c&&(l.id=c.id),l.model=c,l;if(l.type==="team")return c=r.get(l.id),c&&(l.id=c.id),l.model=c,l;if(l.type==="player")return n?(l.model=n[l.id],l.id=n[l.id].id):l.model=c,l}else return l.model=c,l});return t.push(o),t.flat()}return t};getInterestsEntitiesMap=async e=>{let t=[],a=[],i=[],s=new Map,r=new Map,n=null;return e.forEach(o=>{o.type==="competition"&&o.source.toLocaleUpperCase()==="FOOTBALL"?t.push(o.id):o.type==="team"&&o.source.toLocaleUpperCase()==="FOOTBALL"?a.push(o.id):o.type==="player"&&o.source.toLocaleUpperCase()==="FOOTBALL"&&i.push(o.id)}),t.length&&(s=await this.footballFacade.getCompetitionsMapWithNativeIds(t)),a.length&&(r=await this.footballFacade.getTeamsMapWithNativeIds(a)),i.length&&(n=await this.footballFacade.getPlayersMapWithNativeIds(i)),{competitionsMap:s,teamsMap:r,playersMap:n}};remapIdsObj=async(e,t,a)=>await this.idMapping.idMappingFacade.getEntitiesByIds(e,t,a)},Ud=class{idMapping=null;profileOperations=null;constructor(e,t){this.idMapping=new te(e),this.profileOperations=new $d(e,t,this.idMapping)}remapProfileStats=async e=>await this.profileOperations.remapProfileStats(e);remapInterestToNative=async e=>await this.profileOperations.remapInterestToNative(e);remapInterests=async e=>await this.profileOperations.remapInterests(e);showFullInterests=async e=>await this.profileOperations.showFullInterests(e)},le=class{idsRemapper=null;profileHttps=null;activityHttps=null;footballHttps=null;footballFacade=null;idMapping=null;localCache=null;profileFacade=null;ownProfileBuilder=null;profileBuilder=null;constructor(e){this.profileHttps=new yi(e),this.activityHttps=new ti(e),this.footballHttps=new Ke(e),this.idMapping=new te(e),this.localCache=new Qe().createLocalCacheInstance(e.idSchema),this.footballFacade=new ns(e,this.localCache,this.footballHttps,this.idMapping),this.profileFacade=new Tt(this.localCache,this.profileHttps,this.activityHttps,e.errorHandlingMode),this.idsRemapper=new Ud(e,this.footballFacade),this.ownProfileBuilder=new En(e,this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps),this.profileBuilder=new wi(this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps)}getOwn=()=>this.ownProfileBuilder;getById=e=>this.profileBuilder.getById(e);getCountries=async e=>await this.profileFacade.getCountries(e);getByIds=async(e,t,a)=>await this.profileFacade.getByIds(e,t,a);collectLead=async e=>await this.profileFacade.collectLead(e);checkFollowStatus=async e=>await this.profileFacade.checkFollowStatus(e);getOwnStats=async()=>await this.ownProfileBuilder.getStats();getStats=async(e,t)=>await this.profileBuilder.getById(e).getStats(t);getOwnBadges=async()=>await this.ownProfileBuilder.getBadges();getBadges=async e=>await this.profileBuilder.getById(e).getBadges();collectConsents=async e=>await this.profileFacade.collectConsents(e);getOwnConsents=async()=>await this.ownProfileBuilder.getConsents();deleteConsent=async e=>await this.ownProfileBuilder.deleteConsent(e)},Bd=class extends B{},Hd=(e=>(e.LIKE="like",e.DISLIKE="dislike",e.SHARE="share",e.COMMENT="comment",e.PREDICTION_MADE="prediction_made",e))(Hd||{}),Vd=(e=>(e.CORRECT="CORRECT",e.INCORRECT="INCORRECT",e.PARTIALLY_CORRECT="PARTIALLY_CORRECT",e.NOT_VERIFIED="NOT_VERIFIED",e))(Vd||{}),ds=(e=>(e.ONE="1",e.X="x",e.TWO="2",e))(ds||{}),ps=(e=>(e.ONE_X="1x",e.X_TWO="x2",e.ONE_TWO="12",e))(ps||{}),us=(e=>(e.ONE_ONE="1/1",e.ONE_X="1/x",e.ONE_TWO="1/2",e.X_ONE="x/1",e.X_X="x/x",e.X_TWO="x/2",e.TWO_ONE="2/1",e.TWO_X="2/x",e.TWO_TWO="2/2",e))(us||{}),Wd=(e=>(e.NONE="none",e.FINISHED="finished",e.CANCELLED="cancelled",e.POSTPONED="postponed",e.NOT_STARTED="not_started",e.FIRST_HALF="1st_half",e.SECOND_HALF="2nd_half",e.FINISHED_AFTER_AWARDED_WIN="finished_after_awarded_win",e.TO_FINISH="to_finish",e.FINISHED_AET="finished_aet",e.HALFTIME="halftime",e.FINISHED_AP="finished_ap",e.INTERRUPTED="interrupted",e.KICK_OFF_DELAYED="kick_off_delayed",e.ABANDONED="abandoned",e.WAITING_FOR_PENALTY="waiting_for_penalty",e.PENALTY="penalty",e.PAUSE="pause",e.EXTRA_TIME_1ST_HALF="extra_time_1st_half",e.EXTRA_TIME_END_OF_1ST_HALF="extra_time_end_of_1st_half",e.EXTRA_TIME_2ND_HALF="extra_time_2nd_half",e.WAITING_FOR_EXTRA_TIME="waiting_for_extra_time",e.NO_INFO_YET="no_info_yet",e.AWAITING_INFO="awaiting_info",e.FINISHED_ASG="finished_asg",e))(Wd||{}),zd=class extends Ee{constructor(e){super(e)}validatePrediction=e=>{(!e.fixtures||!Array.isArray(e.fixtures)||e.fixtures.length===0)&&this.throwException(400,"invalid_method_call","Fixtures field is required and should contain at least one fixtures object. For more information please visit our documentation");let t=Object.keys(new lo);for(let a of e.fixtures)(Object.keys(a).length!==t.length||Object.keys(a).some(i=>!t.includes(i)))&&this.throwException(400,"invalid_method_call","Fixtures field is invalid. For more information please visit our documentation");e.tiebreaker&&(!e.tiebreaker.statTotal||!Number.isInteger(e.tiebreaker.statTotal))&&this.throwException(400,"invalid_method_call","Tiebreaker field is invalid. It should contain statTotal key with integer value. For more information please visit our documentation")}},qd=class{https=null;validator=null;profile=null;brandingResolver=null;constructor(e){this.https=new jt(e),this.profile=new le(e),this.validator=new zd(e.errorHandlingMode),this.brandingResolver=new ye(e)}getGames=async(e,t)=>{e&&(e=new co(e));let a=await this.https.getBracketGames(e,t),i=await this.brandingResolver.resolveBrandingBatch([...a.data],t);return a.data=i,a};getGameById=async(e,t)=>{let a=await this.https.getBracketGameById(e,t);return await this.brandingResolver.resolveBranding(a,t),a};makePrediction=async(e,t)=>(this.validator.validatePrediction(t),await this.https.makeBracketGamePrediction(e,t));updatePrediction=async(e,t,a)=>(this.validator.validatePrediction(a),await this.https.updateBracketGamePrediction(e,t,a));getGamePredictionsForUser=async(e,t,a,i)=>{a&&(a=new no(a));let s=await this.https.getBracketGamePredictionsForUser(e,t,a,i),r=null;try{r=await this.profile.getById(t).getInfo()}catch(n){console.error(n)}return s.data.forEach(n=>{n.profileModel=r}),s};getGamePredictionById=async(e,t,a)=>await this.https.getBracketGamePredictionById(e,t,a);getRankings=async(e,t,a)=>{t&&(t=new Bd(t));let i=await this.https.getBracketGameRankings(e,t,a),s=i.data.map(n=>n.profileId),r=[];return s.length>0&&(r=await this.profile.getByIds(s),i.data=i.data.map(n=>(n.profileModel=r.find(o=>o.id===n.profileId)||null,n))),i}},jd=class{facade=null;constructor(e){this.facade=new qd(e)}getGames=async(e,t)=>await this.facade.getGames(e,t);getGameById=async(e,t)=>await this.facade.getGameById(e,t);makePrediction=async(e,t)=>await this.facade.makePrediction(e,t);updatePrediction=async(e,t,a)=>await this.facade.updatePrediction(e,t,a);getGamePredictionsForUser=async(e,t,a,i)=>await this.facade.getGamePredictionsForUser(e,t,a,i);getGamePredictionById=async(e,t,a)=>await this.facade.getGamePredictionById(e,t,a);getRankings=async(e,t,a)=>await this.facade.getRankings(e,t,a)},Qd=class{remapResponse=e=>(e.meta=this.remapMeta(e.meta),e.data=this.remapData(e.data),e);remapLeagueLeaderboardResponse=e=>(e.meta=this.remapLeagueLeaderboardMeta(e.meta),e.data=this.remapData(e.data),e);remapTemplateBreakdown=e=>(e.meta=this.remapMeta(e.meta),e.data=e.data.map(t=>this.remapTemplatePoints(t)),e);remapMeta=e=>{let t=new vl;return t.rankType=e.rank_type,t.fromDate=e.from_date,t.toDate=e.to_date,t.pagination.currentPage=e.pagination.current_page,t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.totalItems=e.pagination.total_items,t.pagination.numberOfPages=e.pagination.number_of_pages,t};remapLeagueLeaderboardMeta=e=>{let t=new _l;return t.templateId=e.template_id,t.privateLeagueId=e.private_league_id,t.fromDate=e.from_date,t.toDate=e.to_date,t.pagination.currentPage=e.pagination.current_page,t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.totalItems=e.pagination.total_items,t.pagination.numberOfPages=e.pagination.number_of_pages,t};remapData=e=>{let t=[];return e.forEach(a=>{let i=new Li;i.position=a.position,i.profileId=a.profile_id,i.points=a.points,i.predictionsMade=a.predictions_made,t.push(i)}),t};remapTemplatePoints=e=>{let t=new Pl;return t.groupId=e.group_id,t.averagePoints=e.average_points,t.highestPoints=e.highest_points,t}},Yd=class{remapRankings=e=>(e.meta=this.remapMeta(e.meta),e.data=this.remapData(e.data),e);remapRankingsPrivateLeague=e=>(e.meta=this.remapMeta(e.meta),e.data=this.remapDataUserRankingPrivateLeague(e.data),e);remapRankingsChallenge=e=>(e.meta=this.remapMeta(e.meta),e.data=this.remapDataUserRankingChallenge(e.data),e);remapMeta=e=>{let t=new fe;return t.pagination.currentPage=e.pagination.current_page,t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.numberOfPages=e.pagination.number_of_pages,t.pagination.totalItems=e.pagination.total_items,t};remapData(e){let t=[];return e.forEach(a=>{let i=new bl;i.id=a.id,i.rankType=a.rank_type,i.position=a.position,i.points=a.points,i.gameType=a.game_type,delete i.profileId,delete i.profileModel,delete i.predictionsMade,t.push(i)}),t}remapDataUserRankingPrivateLeague(e){let t=[];return e.forEach(a=>{let i=new Qc;i.templateId=a.template_id,i.privateLeagueId=a.private_league_id,i.position=a.position,i.points=a.points,t.push(i)}),t}remapDataUserRankingChallenge(e){let t=[];return e.forEach(a=>{let i=new fo;i.templateId=a.template_id,i.challengeId=a.private_league_id,i.position=a.position,i.points=a.points,t.push(i)}),t}},Xd=class{entityId=null;entityType=null},Jd=class extends pe{remapResponse=e=>{let t=[];return e.forEach(a=>{let i=new xi;i.id=a.id,i.name=a.name,i.description=a.description,i.type=a.type,i.fromDate=a.from_date,i.toDate=a.to_date,i.markets=a.markets?a.markets:null,i.teamIds=a.team_ids?a.team_ids:null,i.matchIds=a.match_ids?a.match_ids:null,i.groups=a.groups?this.remapGroups(a.groups):null,i.gameIds=a.game_ids?a.game_ids:null,i.gameTypes=a.game_types?a.game_types:null,i.competitionIds=a.competition_ids?a.competition_ids:null,i.excludedProfileIds=a.excluded_profile_ids?a.excluded_profile_ids:null,i.rules=a.rules?a.rules:null,i.labels=a.labels?a.labels:null,i.customFields=a.custom_fields?a.custom_fields:null;let s=this.remapBrandingWithId(e);i.branding=s.branding,i.brandingId=s.brandingId,i.flags=a.flags?a.flags:null,i.images=a.images?a.images:null,i.status=a.status?a.status:null,i.automaticallyChangeStatus=a.automatically_change_status,i.createdAt=a.created_at,i.updatedAt=a.updated_at,i.related=a.related?this.remapRelated(a.related):null,t.push(i)}),t};remapResponseId=e=>{let t=new El;t.id=e.id,t.name=e.name,t.description=e.description,t.type=e.type,t.fromDate=e.from_date,t.toDate=e.to_date,t.markets=e.markets?e.markets:null,t.teamIds=e.team_ids?e.team_ids:null,t.matchIds=e.match_ids?e.match_ids:null,t.groups=e.groups?this.remapGroups(e.groups):null,t.gameIds=e.game_ids?e.game_ids:null,t.gameTypes=e.game_types?e.game_types:null,t.competitionIds=e.competition_ids?e.competition_ids:null,t.excludedProfileIds=e.excluded_profile_ids?e.excluded_profile_ids:null,t.rules=e.rules?e.rules:null,t.flags=e.flags?e.flags:null,t.images=e.images?e.images:null,t.status=e.status?e.status:null,t.automaticallyChangeStatus=e.automatically_change_status,t.related=e.related?this.remapRelated(e.related):null,t.labels=e.labels,t.customFields=e.custom_fields;let a=this.remapBrandingWithId(e);return t.branding=a.branding,t.brandingId=a.brandingId,t.adContent=e.ad_content,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapMeta=e=>{let t=new Tl;return t.pagination.currentPage=e.pagination.current_page,t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.totalItems=e.pagination.total_items,t.pagination.numberOfPages=e.pagination.number_of_pages,t.filters.flags=e.filters.flags,t.filters.status=e.filters.status,t.filters.type=e.filters.type,t.filters.activeFrom=e.filters.active_from,t.filters.activeTo=e.filters.active_to,t.filters.createdFrom=e.filters.created_from,t.filters.createdTo=e.filters.created_to,t.filters.updatedFrom=e.filters.updated_from,t.filters.updatedTo=e.filters.updated_to,t};remapRelated=e=>e.map(t=>{let a=new Xd;return a.entityId=t.entity_id,a.entityType=t.entity_type,a});remapGroups=e=>e.map(t=>{let a=new Rl;return a.groupId=t.group_id,a.label=t.label,a.flags=t.flags,a.filters=this.remapGroupFilters(t.filters),a});remapGroupFilters=e=>{let t=new Sl;return t.fromDate=e.from_date,t.toDate=e.to_date,t.matchIds=e.match_ids,t}},Kd=class{remapHighestSuccessRate=e=>e.map(t=>{let a=new wl;return a.position=t.position,a.points=t.points,a.predictionsMade=t.predictions_made,a.profileId=t.profile_id,a.successRatePercent=t.success_rate_percent,a})},Rt=class extends se{templateRemapper=null;leaderboardRemapper=null;rankingsRemapper=null;highestSuccessRateRemapper=null;constructor(e){super(e,ee(e.environment,"loyalty")),this.templateRemapper=new Jd,this.leaderboardRemapper=new Qd,this.rankingsRemapper=new Yd,this.highestSuccessRateRemapper=new Kd}getTemplates=async(e,t)=>{let a=e?`/leaderboard/templates/${this.apiSignInUrl}${e.constructFiltersUrl()}`:`/leaderboard/templates/${this.apiSignInUrl}`;a+=S(t)?E():"";let i="There was a problem fetching the list of templates",s=await this.fetchWithoutAuth(a,i),r=JSON.parse(JSON.stringify(s));return r.meta=this.templateRemapper.remapMeta(s.meta),r.data=this.templateRemapper.remapResponse(s.data),r};getTemplateById=async(e,t)=>{let a=S(t)?`/leaderboard/templates/${e}${this.apiSignInUrl}${E()}`:`/leaderboard/templates/${e}${this.apiSignInUrl}`,i=`There was a problem requesting the following template: ${e}`,s=await this.fetchWithoutAuth(a,i);return this.templateRemapper.remapResponseId(s.data)};getLeaderboard=async(e,t,a)=>{let i=S(t)?`/leaderboard/${e}${this.apiSignInUrl}${E()}`:`/leaderboard/${e}${this.apiSignInUrl}`,s=`There was a problem fetching the leaderboard for the following template: ${e}`;a&&(i+=`${a.constructFiltersUrl()}`);let r=await this.fetchWithoutAuth(i,s),n=JSON.parse(JSON.stringify(r));return this.leaderboardRemapper.remapResponse(n)};getLeaderboardForGame=async(e,t,a)=>{let i=S(t)?`/leaderboard/games/${e}${this.apiSignInUrl}${E()}`:`/leaderboard/games/${e}${this.apiSignInUrl}`,s=`There was a problem fetching the leaderboard for the following game: ${e}`;a&&(i+=`${a.constructFiltersUrl()}`);let r=await this.fetchWithoutAuth(i,s),n=JSON.parse(JSON.stringify(r));return this.leaderboardRemapper.remapResponse(n)};getLeaderboardForLeague=async(e,t)=>{let a=`/private-league/${e}${this.apiSignInUrl}`,i=`There was a problem fetching the leaderboard for the following league: ${e}`;t&&(a+=`${t.constructFiltersUrl()}`);let s=await this.fetchWithoutAuth(a,i);return this.leaderboardRemapper.remapLeagueLeaderboardResponse(s)};getUserRankings=async(e,t,a)=>{let i=`/leaderboard/users/${e}/rankings${this.apiSignInUrl}`,s=`There was a problem fetching the rankings for the following user: ${e}`;t&&(i+=`${t.constructFiltersUrl()}`),S(a)&&(i+=`${E()}`);let r=await this.fetchWithoutAuth(i,s);return this.rankingsRemapper.remapRankings(r)};getHighestSuccessRate=async(e,t)=>{let a=`/statistics/top${this.apiSignInUrl}`,i="There was a problem fetching highest success rate";e&&(a+=`${e.constructFiltersUrl()}`),S(t)&&(a+=`${E()}`);let s=await this.fetchWithoutAuth(a,i);return this.highestSuccessRateRemapper.remapHighestSuccessRate(s.data)};getEntitiesFollows=async(e,t)=>{let a=S(t)?`/statistics/follows${this.apiSignInUrl}${E()}`:`/statistics/follows${this.apiSignInUrl}`;return e.footballCompetitions&&(a+=`&competitions=${e.footballCompetitions.join(",")}`),e.footballTeams&&(a+=`&teams=${e.footballTeams.join(",")}`),e.footballPlayers&&(a+=`&players=${e.footballPlayers.join(",")}`),(await this.fetchWithoutAuth(a,"There was a problem fetching follows for entities")).data};getUserRankingsForPrivateLeagueAndChallenges=async(e,t,a)=>{let i=`/private-league/users/${e}/rankings${this.apiSignInUrl}&private_league_type=${t==="PRIVATE_LEAGUE"?"private":"one_vs_one"}`,s=`There was a problem fetching user rankings for ${t}`;a&&(i+=`${a.constructFiltersUrl()}`);let r=await this.fetchWithoutAuth(i,s);return t==="PRIVATE_LEAGUE"?this.rankingsRemapper.remapRankingsPrivateLeague(r):this.rankingsRemapper.remapRankingsChallenge(r)};getTemplateBreakdownPoints=async e=>{let t=`/leaderboard/${e}/breakdown${this.apiSignInUrl}`,a=`There was a problem fetching template breakdown points for: ${e}`,i=await this.fetchWithoutAuth(t,a);return this.leaderboardRemapper.remapTemplateBreakdown(i)}},Zd=class{remapToPrivateLeagues=e=>(e.meta=this.remapMetaPrivateLeagues(e.meta.pagination),e.data=e.data.map(t=>this.remapToPrivateLeagueById(t)),e);remapMetaPrivateLeagues=e=>{let t=new V;return t.pagination.itemsPerPage=e.items_per_page,t.pagination.nextPageStartsAfter=e.next_page_starts_after,t};remapToPrivateLeagueById=e=>{let t=new Wc;return t.id=e.id,t.name=e.name,t.description=e.description,t.type=e.type,t.members=e.members,t.administrators=e.administrators,t.banned=e.banned,t.invites=e.invites,t.membersCount=e.members_count,t.usersCanInviteUsers=e.users_can_invite_users,t.invitationCode=e.invitation_code,t.templateId=e.template_id,t.pastTemplates=e.past_templates,t.pinnedPosts=e.pinned_posts,t.scoringStartsAt=e.scoring_starts_at,t};remapToMyPrivateLeagues=e=>{let t=new Ki;return t.id=e.id,t.name=e.name,t.description=e.description,t.type=e.type,t.administrators=e.administrators,t.banned=e.banned,t.invites=e.invites,t.membersCount=e.members_count,t.usersCanInviteUsers=e.users_can_invite_users,t.invitationCode=e.invitation_code,t.templateId=e.template_id,t.pastTemplates=e.past_templates,t.pinnedPosts=e.pinned_posts,t.scoringStartsAt=e.scoring_starts_at,t};remapToAcceptPrivateLeague=e=>{let t=new Vc;return t.profileId=e.profile_id,t.leagueId=e.league_id,t.message=e.message,t};remapToAcceptChallenge=e=>{let t=new po;return t.profileId=e.profile_id,t.challengeId=e.league_id,t.message=e.message,t};remapPredictions=e=>(e.meta=this.remapMeta(e.meta),e.data=this.remapPredictionsData(e.data),e);remapMeta=e=>{let t=new fe;return t.pagination.currentPage=e.pagination.current_page,t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.numberOfPages=e.pagination.number_of_pages,t.pagination.totalItems=e.pagination.total_items,t};remapPredictionsData=e=>e.map(t=>{let a=new zc;return a.predictionId=t.prediction_id,a.profileId=t.profile_id,a})},hs=class{remapToDiscussions=e=>(e.meta=this.remapToMeta(e.meta),e.data=e.data.map(t=>this.remapToDiscussionById(t)),e);remapToDiscussionById=e=>{let t=new yo;return t.id=e.id,t.label=e.label,t.status=e.status,t.deleted=e.deleted,t.deletedAt=e.deleted_at,t.deletedBy=e.deleted_by,t.discussionType=e.discussion_type,t.discussionUrl=e.discussion_url,t.moderationType=e.moderation_type,t.postsCount=e.posts_count,t.pinnedPosts=e.pinned_posts,t.lastPostId=e.last_post_id,t.customFields=e.custom_fields,t.context=e.context,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapToPostsForDiscussion=(e,t)=>{let a=new Io,i=new To;return a.meta=this.remapToPostMeta(e.meta),a.data=e.data.map(s=>this.remapToPostByIdBasic(s)),i.meta=this.remapToPostMeta(e.meta),i.data=e.data.map(s=>this.remapToPostByIdFull(s)),t==="basic"?a:i};remapToPosts=e=>{let t=new bo;return t.meta=this.remapToMeta(e.meta),t.data=e.data.map(a=>this.remapToPostByIdBasic(a)),t};remapToPostMeta=e=>{let t=new Yt;return t.pagination.totalItems=e.pagination.total_items,t.pagination.nextPageStartsAfter=e.pagination.next_page_starts_after,t.pagination.lastCommentCreateTimestamp=e.pagination.last_comment_create_timestamp,t};remapToMeta=e=>{let t=new V;return t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.nextPageStartsAfter=e.pagination.next_page_starts_after,t};remapToPostByIdBasic=e=>{let t=new Fi;return t.id=e.id,t.userId=e.user_id,t.discussionId=e.discussion_id,t.content=e.content,t.anonymousNickname=e.anonymous_nickname,t.reactionsCount=e.reactions_count,t.replyId=e.reply_id,t.reactions=e.reactions.length?e.reactions.map(a=>this.remapReactionsPost(a)):e.reactions,t.repliesCount=e.replies_count,t.reports=e.reports.length?e.reports.map(a=>this.remapReportPost(a)):e.reports,t.reportsCount=e.reports_count,t.versions=e.versions.length?e.versions.map(a=>this.remapVersionsPost(a)):e.versions,t.privatePost=e.private_post,t.deleted=e.deleted,t.deletedAt=e.deleted_at,t.deletedBy=e.deleted_by,t.moderated=e.moderated,t.moderatedAt=e.moderated_at,t.moderatedBy=e.moderated_by,t.moderatedReason=e.moderated_reason,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapToPostByIdFull=e=>{let t=new wo;return t.id=e.id,t.userId=e.user_id,t.discussionId=e.discussion_id,t.content=e.content,t.anonymousNickname=e.anonymous_nickname,t.reactionsCount=e.reactions_count,t.replyId=e.reply_id,t.reactions=e.reactions.length?e.reactions.map(a=>this.remapReactionsPost(a)):e.reactions,t.repliesCount=e.replies_count,t.reports=e.reports.length?e.reports.map(a=>this.remapReportPost(a)):e.reports,t.reportsCount=e.reports_count,t.versions=e.versions.length?e.versions.map(a=>this.remapVersionsPost(a)):e.versions,t.privatePost=e.private_post,t.deleted=e.deleted,t.deletedAt=e.deleted_at,t.deletedBy=e.deleted_by,t.moderated=e.moderated,t.moderatedAt=e.moderated_at,t.moderatedBy=e.moderated_by,t.moderatedReason=e.moderated_reason,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapToPostCount=e=>e.map(t=>{let a=new vo;return a.id=t.id,a.postsCount=t.posts_count,a});remapReactionsPost=e=>{let t=new Po;return t.type=e.type,t.userIds=e.user_ids,t.reactionCount=e.reaction_count,t};remapVersionsPost=e=>{let t=new Ro;return t.content=e.content,t.updatedAt=e.updated_at,t};remapReportPost=e=>{let t=new Eo;return t.userId=e.user_id,t.reason=e.reason,t.reasonDetails=e.reason_details,t}},ms=class extends se{remapper=null;discussionsRemapper=null;discussionsBaseURL=null;constructor(e){super(e,ee(e.environment,"privateLeagues")),this.discussionsBaseURL=ee(e.environment,"discussions"),this.remapper=new Zd,this.discussionsRemapper=new hs}create=async(e,t)=>{let a="/leagues"+this.apiSignInUrl,i=`There was a problem ${t==="PRIVATE_LEAGUE"?"creating private league":"issuing challenge"}`,s="POST",r=await this.fetchWithAuth(a,i,s,e);return this.remapper.remapToPrivateLeagueById(r.data)};update=async(e,t,a)=>{let i=`/leagues/${e}`+this.apiSignInUrl,s=`There was a problem updating ${a==="PRIVATE_LEAGUE"?"private league":"challenge"}`,r="PUT",n=await this.fetchWithAuth(i,s,r,t);return this.remapper.remapToPrivateLeagueById(n.data)};updateLeagueTemplate=async(e,t,a,i)=>{let s=`/leagues/${e}/template`+this.apiSignInUrl,r=`There was a problem updating template for the ${i==="PRIVATE_LEAGUE"?"private league":"challenge"}`,n="POST",o={new_template_id:t,past_template_name:a},l=await this.fetchWithAuth(s,r,n,o);return this.remapper.remapToPrivateLeagueById(l.data)};getById=async(e,t,a)=>{let i=`/leagues/${e}`+this.apiSignInUrl;S(a)&&(i+=E());let s=`There was a problem getting ${t==="PRIVATE_LEAGUE"?"private league":"challenge"}`,r=await this.fetchWithAuth(i,s);return this.remapper.remapToPrivateLeagueById(r.data)};getMyLeagues=async(e,t)=>{let a="/leagues"+this.apiSignInUrl+e.constructFiltersUrl(),i=`There was a problem getting user's ${t==="PRIVATE_LEAGUE"?"private leagues":"challenges"}`;return(await this.fetchWithAuth(a,i)).data.map(s=>this.remapper.remapToMyPrivateLeagues(s))};delete=async(e,t)=>{let a=`/leagues/${e}`+this.apiSignInUrl,i=`There was a problem deleting ${t==="PRIVATE_LEAGUE"?"private league":"challenge"}`;return await this.fetchWithAuth(a,i,"DELETE"),!0};invite=async(e,t)=>{let a=`/membership/invite/${e}`+this.apiSignInUrl,i=`There was a problem inviting the following users: ${t.join(",")}`,s="POST",r={profiles:t};return(await this.fetchWithAuth(a,i,s,r)).data};deleteInvitation=async(e,t)=>{let a=`/membership/invite/${e}`+this.apiSignInUrl,i=`There was a problem deleting invitation for the following users: ${t.join(",")}`,s="DELETE",r={profiles:t};return await this.fetchWithAuth(a,i,s,r),!0};accept=async(e,t,a)=>{let i=`/membership/accept/${e}`+this.apiSignInUrl+`&accept=${t?"ACCEPT":"REJECT"}`,s=`There was a problem ${t?"accepting":"rejecting"} invitation for ${a==="PRIVATE_LEAGUE"?"private league":"challenge"}: ${e}`,r="POST",n=await this.fetchWithAuth(i,s,r);return a==="PRIVATE_LEAGUE"?this.remapper.remapToAcceptPrivateLeague(n.data):this.remapper.remapToAcceptChallenge(n.data)};ban=async(e,t)=>{let a=`/membership/ban/${e}`+this.apiSignInUrl,i=`There was a problem banning the following users: ${t.join(",")}`,s="POST",r={profiles:t};return(await this.fetchWithAuth(a,i,s,r)).data};unban=async(e,t)=>{let a=`/membership/unban/${e}`+this.apiSignInUrl,i=`There was a problem unbanning the following users: ${t.join(",")}`,s="POST",r={profiles:t};return(await this.fetchWithAuth(a,i,s,r)).data};join=async e=>{let t="/membership/join"+this.apiSignInUrl+`&invitation_code=${e}`,a="There was a problem joining league",i="POST",s=await this.fetchWithAuth(t,a,i);return this.remapper.remapToAcceptPrivateLeague(s.data)};leave=async(e,t)=>{let a=`/membership/leave/${e}`+this.apiSignInUrl,i=`There was a problem leaving the following ${t==="PRIVATE_LEAGUE"?"league":"challenge"}: ${e}`;return(await this.fetchWithAuth(a,i,"POST")).data};getInvitations=async(e,t)=>{let a="/membership/invitations"+this.apiSignInUrl+t.constructMainFiltersUrl(),i=`There was a problem getting invitations for ${e==="PRIVATE_LEAGUE"?"leagues":"challenges"}`,s=await this.fetchWithAuth(a,i);return this.remapper.remapToPrivateLeagues(s)};getReportedPosts=async(e,t)=>{let a=`/discussions/${e}/posts/reported${this.apiSignInUrl}`,i=`There was a problem fetching posts for the following: ${e}`;t&&(a+=t.constructMainFiltersUrl());let s=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,a,i);return this.discussionsRemapper.remapToPostsForDiscussion(s,"full")};getPredictions=async(e,t)=>{let a=`/leagues/${e}/predictions`+this.apiSignInUrl,i=`There was a problem getting predictions for private league: ${e}`;t&&(a+=t.constructFiltersUrl());let s=await this.fetchWithAuth(a,i);return this.remapper.remapPredictions(s)};moderatePost=async(e,t)=>{let a=`/posts/${e}/admin/moderate${this.apiSignInUrl}`,i=`There was a problem moderating the following post: ${e}`,s="POST",r={moderation_reason:t},n=await this.fetchWithAuthNewBaseURL(this.discussionsBaseURL,a,i,s,r);return this.discussionsRemapper.remapToPostByIdBasic(n.data)}},gs=class{createRequestBodyFromParam=(e,t)=>{let a=t==="PRIVATE"?new Yc:new uo;return a.name=e.name,a.description=e.description,a.invitation_code=e.invitationCode,a.template_id=e.templateId,a.users_can_invite_users=e.usersCanInviteUsers,e.administrators?a.administrators=e.administrators:delete a.administrators,e.scoringStartsAt?a.scoring_starts_at=e.scoringStartsAt:delete a.scoring_starts_at,a};createUpdateRequestBodyFromParam=(e,t)=>{let a=t==="PRIVATE"?new Xc:new ho;return a.name=e.name,a.description=e.description,a.invitation_code=e.invitationCode,a.template_id=e.templateId,a.users_can_invite_users=e.usersCanInviteUsers,a.administrators=e.administrators,a.pinned_posts=e.pinnedPosts,a.scoring_starts_at=e.scoringStartsAt,a}},ep=class{ALL_FINISHED_STATUSES=["finished","cancelled","interrupted","abandoned","finished_after_awarded_win","finished_aet","finished_ap","finished_asg","to_finish"];ALL_UPCOMING_STATUSES=["not_started","kick_off_delayed"];ALL_LIVE_STATUSES=["1st_half","2nd_half","halftime","waiting_for_penalty","waiting_for_extra_time","penalty","pause","extra_time_1st_half","extra_time_2nd_half","extra_time_end_of_1st_half","awaiting_info"];getMatchEventStatus(e){if(!e||!e.type||!e.subType)return"no_info_yet";let t=e.type.toLowerCase(),a=e.subType.toLowerCase();return t==="finished"?a==="awarded_win"?"finished_after_awarded_win":a==="aet"?"finished_aet":a==="ap"?"finished_ap":a==="asg"?"finished_asg":"finished":t==="notstarted"?a==="postponed"?"postponed":a==="delayed"?"kick_off_delayed":"not_started":t==="inprogress"?a==="1st_half"?"1st_half":a==="2nd_half"?"2nd_half":a==="halftime"?"halftime":a==="penalty"?"penalty":a==="waiting_penalty"?"waiting_for_penalty":a==="pause"?"pause":a==="extra_time_1st_half"?"extra_time_1st_half":a==="extra_time_2nd_half"?"extra_time_2nd_half":a==="extra_time_halftime"?"extra_time_end_of_1st_half":a==="waiting_extra_time"?"waiting_for_extra_time":"awaiting_info":t==="interrupted"?a==="abandoned"?"abandoned":a==="to_finish"?"to_finish":"interrupted":t==="cancelled"?"cancelled":"no_info_yet"}isUpcoming(e){if(!e)return!1;let t=this.getMatchEventStatus(e);return this.ALL_UPCOMING_STATUSES.includes(t)}isLive(e){if(!e)return!1;let t=this.getMatchEventStatus(e);return this.ALL_LIVE_STATUSES.includes(t)}isFinished(e){if(!e)return!1;let t=this.getMatchEventStatus(e);return this.ALL_FINISHED_STATUSES.includes(t)}},tp=class{matchStatusHelper;constructor(){this.matchStatusHelper=new ep}getMatchStatusEnum(e){return this.matchStatusHelper.getMatchEventStatus(e)}isMatchUpcoming(e){return this.matchStatusHelper.isUpcoming(e)}isMatchLive(e){return this.matchStatusHelper.isLive(e)}isMatchFinished(e){return this.matchStatusHelper.isFinished(e)}},xe=class{https=null;idMapping=null;localCache=null;footballFacade=null;footballHelpers;constructor(e){this.https=new Ke(e),this.idMapping=new te(e),this.localCache=new Qe().createLocalCacheInstance(e.idSchema),this.footballFacade=new ns(e,this.localCache,this.https,this.idMapping),this.footballHelpers=new tp}getCountries=async e=>await this.footballFacade.getCountries(e);getCompetitions=async(e,t)=>await this.footballFacade.getCompetitions(e,t);getCompetitionById=async(e,t)=>await this.footballFacade.getCompetitionById(e,t);getTopCompetitions=async e=>await this.footballFacade.getTopCompetitions(e);getTeams=async(e,t)=>await this.footballFacade.getTeams(e,t);getTeamById=async(e,t)=>await this.footballFacade.getTeamById(e,t);getTopTeams=async e=>await this.footballFacade.getTopTeams(e);getNextMatchForTeam=async(e,t)=>await this.footballFacade.getNextMatchForTeam(e,t);getPrevMatchForTeam=async(e,t)=>await this.footballFacade.getPrevMatchForTeam(e,t);getPlayers=async(e,t)=>await this.footballFacade.getPlayers(e,t);getPlayerById=async(e,t)=>await this.footballFacade.getPlayerById(e,t);getTopPlayers=async e=>await this.footballFacade.getTopPlayers(e);getNextMatchForPlayer=async(e,t)=>await this.footballFacade.getNextMatchForPlayer(e,t);getPrevMatchForPlayer=async(e,t)=>await this.footballFacade.getPrevMatchForPlayer(e,t);getMatches=async(e,t)=>await this.footballFacade.getMatches(e,t);getMatchById=async(e,t)=>await this.footballFacade.getMatchById(e,t);search=async(e,t)=>await this.footballFacade.search(e,t);getTeamForm=async(e,t,a)=>await this.footballFacade.getTeamForm(e,t,a);get helpers(){return this.footballHelpers}},ap=class{matchFacade=null;playerFacade=null;predictorService=null;constructor(e,t,a){this.matchFacade=e,this.playerFacade=t,this.predictorService=a}remapFixturesRequest=e=>{let t={};if(t.match_id=e.matchId,t.match_type="FOOTBALL",e instanceof Ae)t.market=e.market,t.prediction=e.prediction.value,t.player_id=e.prediction.playerId;else if(e instanceof Qi||e instanceof Yi)t.market=e.market,t.prediction=e.prediction.value;else if(e instanceof ea){t.market=e.market;let a=e.prediction.value.split(":");t.goals_home=Number(a[0]),t.goals_away=Number(a[1])}else t.market=e.market,t.prediction=e.prediction.value;return t};remapFixturesResponse=async e=>{let t="OWN_GOAL",a=[],i=[],s=null,r=[];e.length>1&&e.sort((o,l)=>o.match_id.localeCompare(l.match_id));for(let o of e)a.push(o.match_id),o.player_id&&!i.includes(o.player_id)&&i.push(o.player_id);let n=await this.matchFacade.getMatchesMapWithNativeIds(a);i.sort((o,l)=>o.localeCompare(l)),i&&i.length>0&&!i.includes(t)&&(s=await this.playerFacade.getPlayersMapWithNativeIds(i));for(let o of e){let l=new qi;o.target?l.market=this.predictorService.convertMarketForResponseModel(o.market,o.target):l.market=o.market,l.matchId=n[o.match_id].id,l.matchType=o.match_type,l.matchModel=n?n[o.match_id]:null,delete l.matchModel.availableMarkets,o.prediction!==void 0?l.prediction.value=o.prediction:o.goals_home!==void 0&&o.goals_away!==void 0&&(l.prediction.value=o.goals_home.toString()+":"+o.goals_away.toString()),l.prediction.playerId=o.player_id?o.player_id:null,o.market==="PLAYER_PERFORMANCE"&&(l.prediction.playerRole=o.role),l.prediction.playerId&&l.prediction.playerId!==t&&(l.prediction.playerModel=s[o.player_id],l.prediction.playerId=s[o.player_id].id),l.result=this.remapResult(o.result),r.push(l)}return r};remapResult=e=>{let t=new ji;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t.points=e.points,t}},Wt=class{constructor(){}static createMatchMarketsResultsModel(e,t){return{FT_1X2:this.createOneXTwoResult(e.scores,"full_time"),HT_1X2:this.createOneXTwoResult(e.scores,"half_time"),BOTH_TEAMS_SCORE:e.scores.ftScore.homeGoals>0&&e.scores.ftScore.awayGoals>0,DOUBLE_CHANCE:this.createDoubleChanceResult(e.scores),HT_FT:this.createHalfTimeFullTimeResult(e.scores),RED_CARD_MATCH:this.createMarketResultByCriteria(e,"red_card"),PENALTY_MATCH:this.createMarketResultByCriteria(e,"penalty"),CORNERS_MATCH:isNaN(e.stats?.corners?.homeTeam+e.stats?.corners?.awayTeam)?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam,PLAYER_YELLOW_CARD:this.createPlayersMarketsResults(e,t,"yellow_card"),PLAYER_RED_CARD:this.createPlayersMarketsResults(e,t,"red_card"),PLAYER_SCORE_FIRST_GOAL:this.createPlayersMarketsResults(e,t,"first_goal"),PLAYER_SCORE:this.createPlayersMarketsResults(e,t,"one_goal"),PLAYER_SCORE_TWICE:this.createPlayersMarketsResults(e,t,"two_goals"),PLAYER_SCORE_HATTRICK:this.createPlayersMarketsResults(e,t,"hattrick"),CORRECT_SCORE:{homeGoals:e.scores.ftScore.homeGoals,awayGoals:e.scores.ftScore.awayGoals},CORRECT_SCORE_ADVANCED:{homeGoals:e.scores.ftScore.homeGoals,awayGoals:e.scores.ftScore.awayGoals},CORRECT_SCORE_HT:{homeGoals:e.scores.htScore.homeGoals,awayGoals:e.scores.htScore.awayGoals},OVER_GOALS_0_5:e.scores.ftScore.homeGoals+e.scores.ftScore.awayGoals>0,OVER_GOALS_1_5:e.scores.ftScore.homeGoals+e.scores.ftScore.awayGoals>1,OVER_GOALS_2_5:e.scores.ftScore.homeGoals+e.scores.ftScore.awayGoals>2,OVER_GOALS_3_5:e.scores.ftScore.homeGoals+e.scores.ftScore.awayGoals>3,OVER_GOALS_4_5:e.scores.ftScore.homeGoals+e.scores.ftScore.awayGoals>4,OVER_GOALS_5_5:e.scores.ftScore.homeGoals+e.scores.ftScore.awayGoals>5,OVER_GOALS_6_5:e.scores.ftScore.homeGoals+e.scores.ftScore.awayGoals>6,OVER_CORNERS_6_5:isNaN(e.stats?.corners?.homeTeam+e.stats?.corners?.awayTeam)?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam>6,OVER_CORNERS_7_5:isNaN(e.stats?.corners?.homeTeam+e.stats?.corners?.awayTeam)?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam>7,OVER_CORNERS_8_5:isNaN(e.stats?.corners?.homeTeam+e.stats?.corners?.awayTeam)?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam>8,OVER_CORNERS_9_5:isNaN(e.stats?.corners?.homeTeam+e.stats?.corners?.awayTeam)?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam>9,OVER_CORNERS_10_5:isNaN(e.stats?.corners?.homeTeam+e.stats?.corners?.awayTeam)?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam>10,OVER_CORNERS_11_5:isNaN(e.stats?.corners?.homeTeam+e.stats?.corners?.awayTeam)?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam>11,OVER_CORNERS_12_5:isNaN(e.stats?.corners?.homeTeam+e.stats?.corners?.awayTeam)?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam>12,OVER_CORNERS_13_5:isNaN(e.stats?.corners?.homeTeam+e.stats?.corners?.awayTeam)?null:e.stats.corners.homeTeam+e.stats.corners.awayTeam>13}}},Ie=Wt;de(Ie,"createOneXTwoResult",(e,t)=>t==="full_time"?e.ftScore.homeGoals>e.ftScore.awayGoals?"1":e.ftScore.homeGoals===e.ftScore.awayGoals?"x":"2":e?.htScore?.homeGoals>e?.htScore?.awayGoals?"1":e?.htScore?.homeGoals===e?.htScore?.awayGoals?"x":"2"),de(Ie,"createDoubleChanceResult",e=>e?.ftScore?.homeGoals>e?.ftScore?.awayGoals?["1x","12"]:e?.ftScore?.homeGoals===e?.ftScore?.awayGoals?["1x","x2"]:["x2","12"]),de(Ie,"createHalfTimeFullTimeResult",e=>{if(e?.htScore?.homeGoals>e?.htScore?.awayGoals){if(e?.ftScore?.homeGoals>e?.ftScore?.awayGoals)return"1/1";if(e?.ftScore?.homeGoals===e?.ftScore?.awayGoals)return"1/x";if(e?.ftScore?.homeGoals<e?.ftScore?.awayGoals)return"1/2"}if(e?.htScore?.homeGoals===e?.htScore?.awayGoals){if(e?.ftScore?.homeGoals>e?.ftScore?.awayGoals)return"x/1";if(e?.ftScore?.homeGoals===e?.ftScore?.awayGoals)return"x/x";if(e?.ftScore?.homeGoals<e?.ftScore?.awayGoals)return"x/2"}if(e?.htScore?.homeGoals<e?.htScore?.awayGoals){if(e?.ftScore?.homeGoals>e?.ftScore?.awayGoals)return"2/1";if(e?.ftScore?.homeGoals===e?.ftScore?.awayGoals)return"2/x";if(e?.ftScore?.homeGoals<e?.ftScore?.awayGoals)return"2/2"}}),de(Ie,"createMarketResultByCriteria",(e,t)=>!e.timeline||!e.timeline.length?null:t==="red_card"?e.timeline.filter(a=>Number(a.minute)<=90).some(a=>a.type==="red_card"):e.timeline.filter(a=>Number(a.minute)<=90).some(a=>a.type.startsWith(t))),de(Ie,"createPlayersMarketsResults",(e,t,a)=>{if(!e.timeline||!e.timeline.length)return a==="first_goal"?null:[];if(a==="first_goal"){let n=e.timeline.find(o=>o.type==="goal"||o.type==="penalty_goal"||o.type==="own_goal")||null;if(n){let o=t[n.player.id];return{playerId:n.type==="goal"||n.type==="penalty_goal"?n.player.id:"OWN_GOAL",playerModel:o}}return null}if(a==="yellow_card"||a==="red_card")return Wt.transformPlayerMarketResult(e.timeline.filter(n=>Number(n.minute)<=90).filter(n=>n.type===a).map(n=>t[n.player.id]));let i=new Map,s=a==="one_goal"?1:a==="two_goals"?2:3,r=[];return e.timeline.filter(n=>Number(n.minute)<=90).filter(n=>n.type==="goal"||n.type==="penalty_goal").forEach(n=>{let o=t[n.player.id];if(i.has(n.player.id)){let l=i.get(n.player.id);l.push(o),i.set(n.player.id,l)}else i.set(n.player.id,[o])}),i.forEach(n=>{n.length>=s&&r.push(n[0])}),Wt.transformPlayerMarketResult(r)}),de(Ie,"transformPlayerMarketResult",e=>e.map(t=>({playerId:t.id,playerModel:t})));var St=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;profileNamespace=null;constructor(e,t){this.footballHttps=new Ke(e),this.idMapping=t,this.matchFacade=new ia(e,this.footballHttps,t),this.playerFacade=new aa(e,this.footballHttps,t),this.profileNamespace=new le(e)}remapMatchIdToNative=async e=>(await this.idMapping.getEntityIdsBySchemaId(e,"match","native")).match;remapPlayerIdToNative=async e=>(await this.idMapping.getEntityIdsBySchemaId(e,"player","native")).player[0];remapPlayerIdMapToNative=async e=>{let t={},a=_t(e),i=(await this.idMapping.getEntityIdsBySchemaId(a,"player","native")).player;return a.forEach((s,r)=>t[s]=i[r]),t};remapPlayerIdToIdSchema=async e=>{let t=["playerScore","playerYellowCard","playerRedCard","playerScoreFirstGoal","playerScoreHattrick","playerScoreTwice"],a=[];for(let[s,r]of Object.entries(e))if(t.includes(s))for(let n of Object.keys(r))n!=="NOBODY"&&n!=="OWN_GOAL"&&a.push(n);if(!a.length)return e;let i=await this.playerFacade.getPlayersMapWithNativeIds(a);for(let[s,r]of Object.entries(e))if(t.includes(s))for(let n of Object.keys(r))n!=="NOBODY"&&n!=="OWN_GOAL"&&(r[i[n].id]=r[n],r[i[n].id].model=i[n],this.idMapping.idSchema!=="native"&&delete r[n]);return e};convertMarketForResponseModel=(e,t)=>{let a=t.toString();return e+"_"+a};getMarketSummary=async(e,t,a)=>{let i=gr.get(t),s={};if(s.matchId=e.matchId,s.matchType=e.matchType,Object.keys(e.predictions).includes(i))s[i]=e.predictions[i];else throw new Error("You have passed invalid market");if(ge.includes(t)&&a){let r="";if(a!=="OWN_GOAL"&&a!=="NOBODY"&&(r=(await this.idMapping.idMappingFacade.getEntitiesByIds({player:[a]},this.idMapping.idSchema,"native")).player[0]),r&&s[i][r]){let n=await this.playerFacade.getPlayersMapWithNativeIds([r]);return s[i][r].model=n[r],s[i][r]}else return r?(s[i][r]=new W,s[i][r]):s[i][a]}else if(ge.includes(t)&&!a){let r=Object.keys(s[i]).filter(o=>o!=="NOBODY"&&o!=="OWN_GOAL"),n=r.length?await this.playerFacade.getPlayersMapWithNativeIds(r):{};Object.keys(n).length&&Object.keys(s[i]).forEach(o=>{o!=="NOBODY"&&o!=="OWN_GOAL"&&(s[i][n[o].id]=s[i][o],s[i][n[o].id].model=n[o],this.idMapping.idSchema!=="native"&&delete s[i][o])})}return s};remapCompetitionsFromConfig=async e=>{if(e instanceof Pi){let t={competition:e.fullCoverageCompetitions},a={competition:e.successRateScopes.competitions},i={team:e.successRateScopes.teams},s=await this.idMapping.idMappingFacade.getEntitiesByIds(t,"native",this.idMapping.idSchema),r=await this.idMapping.idMappingFacade.getEntitiesByIds(a,"native",this.idMapping.idSchema),n=await this.idMapping.idMappingFacade.getEntitiesByIds(i,"native",this.idMapping.idSchema);return e.fullCoverageCompetitions=s.competition,e.successRateScopes.competitions=r.competition,e.successRateScopes.teams=n.team,e}if(e instanceof bi||e instanceof Ti){let t={competition:e.competitionsWhitelist},a=await this.idMapping.idMappingFacade.getEntitiesByIds(t,"native",this.idMapping.idSchema);return e.competitionsWhitelist=a.competition,e}};remapMatchIdsFixtures=async e=>{if(Array.isArray(e.data))if(e.data.length>0){let t=[],a=[];return e.data.forEach(i=>{i instanceof gt||i instanceof dt||i instanceof ze||i instanceof as?(i.fixtures.forEach(s=>t.push(s.matchId)),i instanceof ze&&i.fixtures.forEach(s=>{s.prediction.playerId&&s.prediction.playerId!=="OWN_GOAL"&&a.push(s.prediction.playerId)})):i instanceof Vt&&i.results.forEach(s=>t.push(s.matchId))}),await this.refactorResponseArrModel(e,t,a)}else return e;else return await this.refactorResponseObjModel(e)};refactorResponseArrModel=async(e,t,a)=>{let i=[],s=await this.matchFacade.getMatchesMapWithNativeIds(t),r={};return a.length>0&&(r=await this.playerFacade.getPlayersMapWithNativeIds(a)),e.data.forEach(n=>{n instanceof gt||n instanceof dt||n instanceof ze?(n.fixtures.forEach(o=>{this.handleMatchModel(s,o),n instanceof ze&&o.prediction.playerId&&o.prediction.playerId!=="OWN_GOAL"&&(o.prediction.playerModel=r[o.prediction.playerId],o.prediction.playerId=r[o.prediction.playerId].id)}),i.push(n)):n instanceof Vt&&(n.results.forEach(o=>{o.matchModel=s[o.matchId],delete o.matchModel.availableMarkets,o.matchId=o.matchModel.id}),i.push(n))}),e.data=i,e};refactorResponseObjModel=async e=>{let t=[];e.fixtures.forEach(i=>t.push(i.matchId));let a=await this.matchFacade.getMatchesMapWithNativeIds(t);return e.fixtures.forEach(i=>this.handleMatchModel(a,i)),e};getCurrentGameId=e=>{let t=new Date;if(e.data.length>1){let a=[];return e.data.forEach(i=>a.push(i.predictionsCutoff)),e.data.sort((i,s)=>{let[r,n]=[i.predictionsCutoff,s.predictionsCutoff].map(o=>Math.abs(new Date(o)-t));return r-n})[0].id}else return e.data[0].id};initGameTypePredictions=(e,t)=>{let a={type:e,limit:null,startAfter:null,gameIds:null};return t&&(t.limit&&(a.limit=t.limit),t.startAfter&&(a.startAfter=t.startAfter),t.gameIds&&(a.gameIds=t.gameIds,a.type=null)),a=new Q(a),a};initGameFilters=(e,t,a)=>{if(t&&a)return t.type=e,t.gameIds=a,t=new oe(t),t;if(t&&!a)return t.type=e,t=new oe(t),t;if(!t&&a){let i={type:e,gameIds:a};return i=new oe(i),i}else{let i={type:e};return i=new oe(i),i}};addPredictionProp=async(e,t)=>(t.data.forEach(a=>{let i=a.fixtures.map(s=>s.matchId);e.data.forEach(s=>{a.id===s.game_instance_id&&(a.fixtures.sort((r,n)=>r.matchId.localeCompare(n.matchId)),s.fixtures.sort((r,n)=>r.match_id.localeCompare(n.match_id)),a.predictionId=s.id,a.outcome=s.status,a.fixtures.forEach((r,n)=>{s.fixtures[n].goals_home!==void 0&&s.fixtures[n].goals_away!==void 0?r.prediction.value=s.fixtures[n].goals_home+":"+s.fixtures[n].goals_away:r.prediction.value=s.fixtures[n].prediction,s.fixtures[n].player_id?r.prediction.playerId=s.fixtures[n].player_id:s.fixtures[n].target&&(r.prediction.target=s.fixtures[n].target),r.prediction.result=this.remapResult(s.fixtures[n].result)}),a.predictionsMadeAt=s.created_at,a.predictionsUpdatedAt=s.profile_last_updated_at,a.points=s.points,a instanceof dt&&(s.tiebreaker?a.predictionTiebreaker.goldenGoal=s.tiebreaker.golden_goal:a.predictionTiebreaker=s.tiebreaker))}),a.fixtures.sort((s,r)=>i.indexOf(s.matchId)-i.indexOf(r.matchId))}),t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,await this.remapMatchIdsFixtures(t));remapResult=e=>{let t=new ji;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t.points=e.points,t};areIdsExceeded=e=>e.length>10;initPredictionsFilters=(e,t,a)=>{switch(t){case"user":e&&(e=new Q(e));break;case"current":if(e)this.deleteUnexpectedProperties(e),e.status=["ACTIVE"],e=new Q(e);else{let i={status:["ACTIVE"]};e=new Q(i)}break;case"past":if(e)this.deleteUnexpectedProperties(e),e.status=Ga,e=new Q(e);else{let i={status:Ga};e=new Q(i)}break;case"matches":if(e)this.deleteUnexpectedProperties(e),e.matchIds=a,e=new Q(e);else{let i={matchIds:a};e=new Q(i)}break}return e};completeGameMarketResults=async(e,t)=>{switch(t){case"MATCH_QUIZ":let a={},i=e.results[0].matchId,s=e.results.map(l=>ge.includes(l.market)&&!l.result.includes("OWN_GOAL")?[...l.result]:[]).flat(),r=await this.matchFacade.getMatchesMapWithNativeIds([i]);return s.length&&(a=await this.playerFacade.getPlayersMapWithNativeIds(s)),e.results=e.results.map(l=>{if(l.matchModel=r[l.matchId]?r[l.matchId]:null,l.playerModels&&Object.keys(a).length&&l.result.forEach(c=>{let d=a[c];l.playerModels.push(d)}),this.idMapping.idSchema!=="native"&&(this.remapMatchIdForResultsMarkets(r,l),l.playerModels&&Object.keys(a).length)){let c=l.result;l.result=c.map(d=>a[d].id)}return l}),e;case"TOP_X":let n=e.results.map(l=>l.matchId),o=await this.matchFacade.getMatchesMapWithNativeIds(n);if(e.results=e.results.map(l=>(l.matchModel=o[l.matchId]?o[l.matchId]:null,this.idMapping.idSchema!=="native"&&this.remapMatchIdForResultsMarkets(o,l),l)),e.tieBreakers.goldenGoals.length){let l=e.tieBreakers.goldenGoals.map(d=>d.playerId),c=await this.playerFacade.getPlayersMapWithNativeIds(l);e.tieBreakers.goldenGoals=e.tieBreakers.goldenGoals.map(d=>(d.matchModel=o[d.matchId],d.playerModel=c[d.playerId],this.idMapping.idSchema!=="native"&&(d.matchId=o[d.matchId].id,d.playerId=c[d.playerId].id),d))}return e}};completeContestWinners=async e=>{if(e.userList&&e.userList.length){let t=e.userList.map(i=>i.profileId),a=await this.profileNamespace.getByIds(t);e.userList.forEach(i=>{let s=a.filter(r=>r.id===i.profileId)[0];delete s.interests,i.profileModel=s})}return e};handleMatchModel=(e,t)=>{e[t.matchId]?(t.matchModel=e[t.matchId],delete t.matchModel.availableMarkets,t.matchId=t.matchModel.id):(t.matchModel=null,this.idMapping.idSchema!=="native"&&this.idMapping.idMappingFacade.getEntityById(t.matchId,"match","native").then(a=>{t.matchId=a[H[this.idMapping.idSchema]]}))};remapMatchIdForResultsMarkets=(e,t)=>{e[t.matchId]?t.matchId=e[t.matchId].id:this.idMapping.idMappingFacade.getEntityById(t.matchId,"match","native").then(a=>{t.matchId=a[H[this.idMapping.idSchema]]})};deleteUnexpectedProperties=e=>(e.status&&(console.warn(Sa.UNEXPECTED_STATUS_PROP),delete e.status),e.type&&(console.warn(Sa.UNEXPECTED_TYPE_PROP),delete e.type),e);getMatchMarketsResults=async e=>{let t=await this.footballHttps.getMatchById(e,!0);if(t.status.type!=="finished"||!t.finishedAt)return new Uc;let a=[];t.timeline.filter(s=>Number(s.minute)<=90).filter(s=>s.type==="goal"||s.type==="penalty_goal"||s.type==="yellow_card"||s.type==="red_card").forEach(s=>{a.push(s.player.id)});let i={};return a.length&&(i=await this.playerFacade.getPlayersMapWithNativeIds(a)),Ie.createMatchMarketsResultsModel(t,i)}},fs=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(e,t){this.footballHttps=new Ke(e),this.matchFacade=new ia(e,this.footballHttps,t),this.playerFacade=new aa(e,this.footballHttps,t),this.predictorService=new St(e,t),this.fixturesRemapper=new ap(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=e=>{if(e instanceof Ai)return e;let t={};return t.game_instance_id=e.gameInstanceId,t.fixtures=e.fixtures.map(a=>this.fixturesRemapper.remapFixturesRequest(a)),e instanceof is&&e.tiebreaker&&(t.tiebreaker={},t.tiebreaker.golden_goal=e.tiebreaker.goldenGoal?e.tiebreaker.goldenGoal:null),t};remapResponseArrayBody=async e=>{if(e.length){let t="OWN_GOAL",a=[],i=[],s={},r=[];e.forEach(o=>{o.fixtures.forEach(l=>{a.push(l.match_id),l.player_id&&l.player_id!==t&&i.push(l.player_id)})});let n=await this.matchFacade.getMatchesMapWithNativeIds(a);return i.length>0&&(s=await this.playerFacade.getPlayersMapWithNativeIds(i)),e.forEach(o=>{let l=new Na,c=[];l.id=o.id,l.gameInstanceId=o.game_instance_id,l.gameType=o.game_type,l.wager=o.wager,l.totalFixtures=o.total_fixtures,l.settledFixtures=o.settled_fixtures,l.userId=o.user_id,l.templateId=o.template_id,l.groupId=o.group_id,l.profileLastUpdatedAt=o.profile_last_updated_at,o.fixtures.forEach(d=>{let p=new qi;d.target?p.market=this.predictorService.convertMarketForResponseModel(d.market,d.target):p.market=d.market,p.matchId=n[d.match_id].id,p.matchType=d.match_type,p.matchModel=n[d.match_id],delete p.matchModel.availableMarkets,d.prediction!==void 0?p.prediction.value=d.prediction:d.goals_home!==void 0&&d.goals_away!==void 0&&(p.prediction.value=d.goals_home.toString()+":"+d.goals_away.toString()),p.prediction.playerId=d.player_id?d.player_id:null,p.prediction.playerId&&p.prediction.playerId!==t&&(p.prediction.playerModel=s[p.prediction.playerId],p.prediction.playerId=s[p.prediction.playerId].id),d.market==="PLAYER_PERFORMANCE"&&(p.prediction.playerRole=d.role),p.result=this.fixturesRemapper.remapResult(d.result),c.push(p)}),l.fixtures=c,l.status=o.status,o.tiebreaker?l.tiebreaker.goldenGoal=o.tiebreaker.golden_goal:l.tiebreaker=null,l.points=o.points,l.createdAt=o.created_at,l.updatedAt=o.updated_at,r.push(l)}),r}return e};remapResponseObjBody=async e=>{let t=new Na;return t.id=e.id,t.gameInstanceId=e.game_instance_id,t.gameType=e.game_type,t.wager=e.wager,t.totalFixtures=e.total_fixtures,t.settledFixtures=e.settled_fixtures,t.userId=e.user_id,t.templateId=e.template_id,t.groupId=e.group_id,t.profileLastUpdatedAt=e.profile_last_updated_at,t.fixtures=await this.fixturesRemapper.remapFixturesResponse(e.fixtures),t.status=e.status,e.tiebreaker?t.tiebreaker.goldenGoal=e.tiebreaker.golden_goal:t.tiebreaker=null,t.points=e.points,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapPredictionModel=e=>{let t=new Bc;return t.fullTimeOneXTwo=e.FT_1X2,t.halfTimeOneXTwo=e.HT_1X2,t.bothTeamsScore=e.BOTH_TEAMS_SCORE,t.overZeroPointFiveGoals=e.OVER_GOALS_0_5,t.overOnePointFiveGoals=e.OVER_GOALS_1_5,t.overTwoPointFiveGoals=e.OVER_GOALS_2_5,t.overThreePointFiveGoals=e.OVER_GOALS_3_5,t.overFourPointFiveGoals=e.OVER_GOALS_4_5,t.overFivePointFiveGoals=e.OVER_GOALS_5_5,t.overSixPointFiveGoals=e.OVER_GOALS_6_5,t.overSixPointFiveCorners=e.OVER_CORNERS_6_5,t.overSevenPointFiveCorners=e.OVER_CORNERS_7_5,t.overEightPointFiveCorners=e.OVER_CORNERS_8_5,t.overNinePointFiveCorners=e.OVER_CORNERS_9_5,t.overTenPointFiveCorners=e.OVER_CORNERS_10_5,t.overElevenPointFiveCorners=e.OVER_CORNERS_11_5,t.overTwelvePointFiveCorners=e.OVER_CORNERS_12_5,t.overThirteenPointFiveCorners=e.OVER_CORNERS_13_5,t.doubleChance=e.DOUBLE_CHANCE,t.halfTimeFullTime=e.HT_FT,t.playerScore=e.PLAYER_SCORE,t.playerYellowCard=e.PLAYER_YELLOW_CARD,t.playerRedCard=e.PLAYER_RED_CARD,t.redCardMatch=e.RED_CARD_MATCH,t.penaltyMatch=e.PENALTY_MATCH,t.playerScoreFirstGoal=e.PLAYER_SCORE_FIRST_GOAL,t.cornersMatch=e.CORNERS_MATCH,t.correctScore=e.CORRECT_SCORE,t.correctScoreHalfTime=e.CORRECT_SCORE_HT,t.correctScoreAdvanced=e.CORRECT_SCORE_ADVANCED,t.playerScoreHattrick=e.PLAYER_SCORE_HATTRICK,t.playerScoreTwice=e.PLAYER_SCORE_TWICE,t}},ip=class{remapPredictions=null;constructor(e,t){this.remapPredictions=new fs(e,t)}remapResponse=e=>{let t=new Hc;return t.matchId=e.match_id,t.matchType=e.match_type,t.predictions=this.remapPredictions.remapPredictionModel(e.predictions),t}},sp=class extends pe{remapPaginatedGames=e=>{let t=new ie;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(a=>this.remapGamesListResponse(a)),t};remapGamesListResponse=e=>{let t=new gt;t.id=e.id,t.title=e.title,t.description=e.description,t.type=e.type,t.status=e.status,t.authRequirement=e.auth_requirement||null,t.scheduleOpenAt=e.schedule_open_at,t.predictionsCutoff=e.predictions_cutoff,t.fixtures=e.fixtures.map(i=>this.remapFixturesResponse(i)),t.tiebreaker=e.tiebreaker?this.remapTimeTiebreaker(e.tiebreaker.time_tiebreaker):null,t.participantsCount=e.participants_count,t.related=e.related?this.remapRelated(e.related):[],t.excludedProfileIds=e.excluded_profile_ids,t.rules=e.rules,t.labels=e.labels,t.customFields=e.custom_fields;let a=this.remapBrandingWithId(e);return t.branding=a.branding,t.brandingId=a.brandingId,t.flags=e.flags,t.images=e.images,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapGameByIdResponse=e=>{let t=new as;t.id=e.id,t.title=e.title,t.description=e.description,t.type=e.type,t.status=e.status,t.authRequirement=e.auth_requirement||null,t.scheduleOpenAt=e.schedule_open_at,t.predictionsCutoff=e.predictions_cutoff,t.fixtures=e.fixtures.map(i=>this.remapFixturesResponse(i)),t.tiebreaker=e.tiebreaker?this.remapTimeTiebreaker(e.tiebreaker.time_tiebreaker):null,t.participantsCount=e.participants_count,t.related=e.related?this.remapRelated(e.related):[],t.excludedProfileIds=e.excluded_profile_ids,t.rules=e.rules,t.flags=e.flags,t.adContent=e.ad_content,t.labels=e.labels,t.customFields=e.custom_fields;let a=this.remapBrandingWithId(e);return t.branding=a.branding,t.brandingId=a.brandingId,t.images=e.images,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapFixturesResponse=e=>{let t=new td;return t.matchId=e.match_id,t.matchType=e.match_type,t.market=e.market,t.matchStatus.type=e.match_status?e.match_status.type:null,t.matchStatus.subType=e.match_status?e.match_status.sub_type:null,t};remapPaginatedUserTopXEditions=e=>{let t=new ie;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(a=>this.remapUserTopXEditionsResponse(a)),t};remapUserTopXEditionsResponse=e=>{let t=new dt;t.id=e.id,t.title=e.title,t.description=e.description,t.type=e.type,t.status=e.status,t.authRequirement=e.auth_requirement||null,t.predictionsCutoff=e.predictions_cutoff,t.scheduleOpenAt=e.schedule_open_at,t.fixtures=e.fixtures.map(i=>this.remapTopXFixturesResponse(i)),t.tiebreaker=e.tiebreaker?this.remapTimeTiebreaker(e.tiebreaker.time_tiebreaker):null,t.participantsCount=e.participants_count,t.related=e.related?this.remapRelated(e.related):[],t.excludedProfileIds=e.excluded_profile_ids,t.rules=e.rules,t.flags=e.flags,t.images=e.images;let a=this.remapBrandingWithId(e);return t.branding=a.branding,t.brandingId=a.brandingId,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapTopXFixturesResponse=e=>{let t=new id;return t.matchId=e.match_id,t.matchType=e.match_type,t.market=e.market,t.matchStatus.type=e.match_status?e.match_status.type:null,t.matchStatus.subType=e.match_status?e.match_status.sub_type:null,t};remapPaginatedUserMathQuizEditions=e=>{let t=new ie;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(a=>this.remapUserMatchQuizEditionsResponse(a)),t};remapUserMatchQuizEditionsResponse=e=>{let t=new ze;t.id=e.id,t.title=e.title,t.description=e.description,t.type=e.type,t.status=e.status,t.authRequirement=e.auth_requirement||null,t.predictionsCutoff=e.predictions_cutoff,t.scheduleOpenAt=e.schedule_open_at,t.fixtures=e.fixtures.map(i=>this.remapMatchQuizFixturesResponse(i)),t.tiebreaker=e.tiebreaker?this.remapTimeTiebreaker(e.tiebreaker.time_tiebreaker):null,t.participantsCount=e.participants_count,t.related=e.related?this.remapRelated(e.related):[],t.excludedProfileIds=e.excluded_profile_ids,t.rules=e.rules,t.flags=e.flags,t.images=e.images;let a=this.remapBrandingWithId(e);return t.branding=a.branding,t.brandingId=a.brandingId,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapMatchQuizFixturesResponse=e=>{let t=new Ml;return t.matchId=e.match_id,t.matchType=e.match_type,t.market=e.market,t.matchStatus.type=e.match_status?e.match_status.type:null,t.matchStatus.subType=e.match_status?e.match_status.sub_type:null,t};remapPaginatedGameResults=e=>{let t=new ie;return t.meta.pagination.nextPageStartsAfter=e.meta.pagination.next_page_starts_after,t.meta.pagination.itemsPerPage=e.meta.pagination.items_per_page,t.data=e.data.map(a=>this.remapGameResults(a)),t};remapGameResults=e=>{let t=new Vt;return t.userId=e.user_id,t.points=e.points?e.points:0,t.results=e.results.map(a=>this.remapResults(a)),t.tiebreaker=e.tiebreaker?this.remapTiebreaker(e.tiebreaker):null,t};remapGameMarketsResults=e=>{let t=new Ol;return t.gameId=e.game_id,t.results=this.remapMarketsResults(e.results),t.tieBreakers=e.tie_breakers?this.remapTieBreakers(e.tie_breakers):null,t};remapContestWinners=e=>{let t=new rd;return t.contestId=e.contest_id,t.contestType=e.contest_type,t.description=e.description,t.userList=e.user_list?e.user_list.map(a=>this.remapUserListWinners(a)):null,t};remapUserListWinners=e=>{let t=new nd;return t.position=e.position,t.profileId=e.profile_id,t.note=e.note,t.tags=e.tags,t};remapTieBreakers=e=>{let t={goldenGoals:[]};return t.goldenGoals=e.golden_goals.map(a=>({minute:a.minute,matchId:a.match_id,matchModel:null,playerId:a.player_id,playerModel:null,goalType:a.goal_type})),t};remapMarketsResults=e=>{let t=[];return e.forEach(a=>{let i={matchId:a.match_id,market:a.market,result:this.remapMarketResult(a.market,a.result),matchModel:null,playerModels:[],matchStatus:this.remapMarketsResultsMatchStatus(a.match_status)};t.push(this.deleteUnusefulField(i))}),t};remapMarketsResultsMatchStatus=e=>{let t=new De;return e&&(t.type=e.type,t.subType=e.sub_type),t};remapMarketResult=(e,t)=>{if(ir.includes(e))return t[0];if(ge.includes(e))return t;if(t[0]==="true")return!0;if(t[0]==="false")return!1};deleteUnusefulField=e=>((!ge.includes(e.market)||this.isPlayerMarketWithNoResult(e.market,e.result))&&delete e.playerModels,e);isPlayerMarketWithNoResult=(e,t)=>ge.includes(e)&&t.length===0;remapResults=e=>{let t=new sd;return t.matchId=e.match_id,t.outcome=e.outcome,t};remapTiebreaker=e=>{let t=new Pt;return t.goldenGoal=e.golden_goal,t};remapTimeTiebreaker=e=>{let t=new bt;return t.timeTiebreaker=e,t};remapRelated=e=>e.map(t=>{let a=new we;return a.entityId=t.entity_id,a.entityType=t.entity_type,a.entityRelationship=t.entity_relationship,a})},rp=class{remapMetaData=e=>{let t=new V;return t.pagination.nextPageStartsAfter=e.pagination.next_page_starts_after,t.pagination.itemsPerPage=e.pagination.items_per_page,t}},Ze=class extends se{predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;idMapping=null;constructor(e){super(e,ee(e.environment,"predictor")),this.idMapping=new te(e),this.predictionRemapper=new fs(e,this.idMapping),this.matchSummaryRemapper=new ip(e,this.idMapping),this.gamesRemapper=new sp,this.metaRemapper=new rp}makeFootballPrediction=async e=>{let t=`/predictions${this.apiSignInUrl}`,a="There was a problem making POST request",i="POST",s=await this.fetchWithAuth(t,a,i,this.predictionRemapper.remapRequestBody(e));return await this.predictionRemapper.remapResponseObjBody(s)};getMatchSummary=async(e,t)=>{let a=S(t)?`/predictions/summary/${e}${this.apiSignInUrl}${E()}`:`/predictions/summary/${e}${this.apiSignInUrl}`,i=`There was a problem fetching predictions for match: ${e}`,s=await this.fetchWithoutAuth(a,i);return this.matchSummaryRemapper.remapResponse(s)};deleteFootballPrediction=async e=>{let t=`/predictions/${e}${this.apiSignInUrl}`,a=`There was a problem deleting your prediction: ${e}`;return await this.fetchWithAuth(t,a,"DELETE"),!0};getMyPredictions=async e=>{let t=new ie,a=`/predictions${this.apiSignInUrl}`,i="There was a problem fetching own predictions";e&&(a+=`${e.constructFiltersUrl()}`);let s=await this.fetchWithAuth(a,i);return t.meta=this.metaRemapper.remapMetaData(s.meta),t.data=await this.predictionRemapper.remapResponseArrayBody(s.data),t};getMyPredictionsNoRemap=async e=>{let t=`/predictions${this.apiSignInUrl}${e.constructFiltersUrl()}`;return await this.fetchWithAuth(t,"There was a problem fetching own predictions")};getUserPredictions=async(e,t,a)=>{let i=new ie,s=S(t)?`/predictions/users/${e}${this.apiSignInUrl}${E()}`:`/predictions/users/${e}${this.apiSignInUrl}`,r=`There was a problem fetching predictions for user: ${e}`;a&&(s+=`${a.constructFiltersUrl()}`);let n=await this.fetchWithoutAuth(s,r);return i.meta=this.metaRemapper.remapMetaData(n.meta),i.data=await this.predictionRemapper.remapResponseArrayBody(n.data),i};getUserPredictionsNoRemap=async(e,t)=>{let a=`/predictions/users/${e}${this.apiSignInUrl}${t.constructFiltersUrl()}`,i=`There was a problem fetching predictions for user: ${e}`;return await this.fetchWithoutAuth(a,i)};getGames=async(e,t)=>{let a=S(t)?`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}${E()}`:`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}`,i="There was a problem fetching the games list",s=await this.fetchWithoutAuth(a,i);return this.gamesRemapper.remapPaginatedGames(s)};getGamesNoRemap=async(e,t)=>{let a=S(t)?`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}${E()}`:`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}`;return await this.fetchWithoutAuth(a,"There was a problem fetching the games list")};getGameById=async(e,t)=>{let a=S(t)?`/games/${e}${this.apiSignInUrl}${E()}`:`/games/${e}${this.apiSignInUrl}`,i=`There was a problem fetching the following game: ${e}`,s=await this.fetchWithoutAuth(a,i);return this.gamesRemapper.remapGameByIdResponse(s)};getGamePredictions=async(e,t,a)=>{let i=new ie,s=S(t)?`/games/${e}/predictions${this.apiSignInUrl}${E()}`:`/games/${e}/predictions${this.apiSignInUrl}`,r=`There was a problem fetching the predictions for game: ${e}`;a&&(s+=`${a.constructFiltersUrl()}`);let n=await this.fetchWithoutAuth(s,r);return i.meta=this.metaRemapper.remapMetaData(n.meta),i.data=await this.predictionRemapper.remapResponseArrayBody(n.data),i};getUserGameEditions=async(e,t)=>{let a=null,i=S(t)?`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}${E()}`:`/games/${this.apiSignInUrl}${e.constructFiltersUrl()}`,s="There was a problem fetching the games list",r=await this.fetchWithoutAuth(i,s);return r.data.forEach(n=>{n.type==="TOP_X"?a=this.gamesRemapper.remapPaginatedUserTopXEditions(r):n.type==="MATCH_QUIZ"&&(a=this.gamesRemapper.remapPaginatedUserMathQuizEditions(r))}),a};getGameResults=async(e,t,a)=>{let i=S(t)?`/games/${e}/results/${this.apiSignInUrl}${E()}`:`/games/${e}/results/${this.apiSignInUrl}`,s=`There was a problem fetching the results for the following game: ${e}`;a&&(i+=`${a.constructMainFiltersUrl()}`);let r=await this.fetchWithoutAuth(i,s);return this.gamesRemapper.remapPaginatedGameResults(r)};getMarketResultsForGame=async(e,t)=>{let a=`/games/${e}/correct-results/${this.apiSignInUrl}`,i=`There was a problem fetching the markets correct results for the following game: ${e}`;S(t)&&(a+=`${E()}`);let s=await this.fetchWithoutAuth(a,i);return this.gamesRemapper.remapGameMarketsResults(s.data)};getContestWinners=async(e,t)=>{let a=`/winners/${this.apiSignInUrl}&contest_id=${e}`,i=`There was a problem fetching winners for the following game: ${e}`;t&&(a+=E());let s=await this.fetchWithoutAuth(a,i);return this.gamesRemapper.remapContestWinners(s)};getPredictionById=async e=>{let t=`/predictions/${e}${this.apiSignInUrl}`,a=`There was a problem fetching info for the following prediction: ${e}`,i=await this.fetchWithoutAuth(t,a);return(await this.predictionRemapper.remapResponseArrayBody([i.data]))[0]};getPredictionsByIds=async e=>{let t=`/predictions/by-ids${this.apiSignInUrl}&prediction_ids=${e.join(",")}`,a="There was a problem fetching predictions",i=await this.fetchWithoutAuth(t,a);return await this.predictionRemapper.remapResponseArrayBody(i.data)}},sa=class{errorHandlingMode=null;constructor(e){this.errorHandlingMode=e}validateBodyFields=(e,t)=>{let a=Object.keys(t),i=Object.keys(new Xi);switch(e){case"MATCH_QUIZ":a.forEach(o=>{i.includes(o)||this.throwInvalidParamException([o])});break;case"TOP_X":let r=t;r.fixtures.forEach(o=>this.validateMarketTopX(o.market)),a.includes("tiebreaker")&&r.tiebreaker&&this.validateTiebreaker(r.tiebreaker),a.forEach(o=>{o!=="tiebreaker"&&!i.includes(o)&&this.throwInvalidParamException([o])});break}let s=i.filter(r=>!a.includes(r));return s.length&&this.throwMissingFieldsException("game prediction body",s),t.fixtures.forEach(r=>{this.validateFixtureFields(r)}),t};validateFixture=(e,t,a,i)=>{this.validateMarket(t);let s=Object.values(ds),r=Object.values(us),n=Object.values(ps);if(t==="FT_1X2"||t==="HT_1X2"){if(s.includes(a))return new Lc(e,t,a)}else if(t==="HT_FT"){if(r.includes(a))return new kc(e,a)}else if(t==="DOUBLE_CHANCE"){if(n.includes(a))return new Fc(e,a)}else if(t==="CORRECT_SCORE"||t==="CORRECT_SCORE_ADVANCED"||t==="CORRECT_SCORE_HT"){if(typeof a=="string"&&/\d+:\d+/.test(a))return new ea(e,t,a)}else if(t==="CORNERS_MATCH"){if(typeof a=="number")return new Cc(e,a)}else if(t==="BOTH_TEAMS_SCORE"){if(this.isPredictionBoolean(a))return new Rc(e,a)}else if(t==="RED_CARD_MATCH"){if(this.isPredictionBoolean(a))return new Gc(e,a)}else if(t==="PENALTY_MATCH"){if(this.isPredictionBoolean(a))return new xc(e,a)}else if(ge.includes(t)){let o="OWN_GOAL";if(this.validatePlayerId(t,i),t===ht&&this.isPredictionBoolean(a)){let l=i&&i===o?o:i;return new Ae(e,t,a,l)}if(i&&this.isPredictionBoolean(a))return new Ae(e,t,a,i)}else if(tr.includes(t)){if(this.isPredictionBoolean(a))return new Yi(e,t,a)}else if(ar.includes(t)&&this.isPredictionBoolean(a))return new Qi(e,t,a);this.throwInvalidPredictionException(a,t)};validateFixtureFields=e=>{let t=Object.keys(e);t.forEach(i=>{Ra.includes(i)||this.throwInvalidParamException([i])});let a=Ra.filter(i=>{if(i!=="matchType"&&!t.includes(i))return i});a.length&&this.throwMissingFieldsException("fixtures",a),this.validatePredictionKey(e.market,e.prediction)};validateTiebreaker=e=>{let t=Object.keys(e);(!t.length||typeof e!="object")&&this.throwInvalidType("tiebreaker","object");let a=Object.keys(new Pt)[0];t.forEach(i=>{a!==i&&this.throwInvalidParamException([i])}),t.includes(a)||this.throwMissingFieldsException("tiebreaker",[a]),typeof e.goldenGoal!="number"&&this.throwInvalidType("goldenGoal","number")};validatePredictionKey=(e,t)=>{if(typeof t=="object"){let a=Object.keys(t),i=["value"];if(a.length||this.throwMissingFieldsException("prediction",i),a.length===1&&!a.includes(i[0])&&this.throwInvalidParamException(a),a.length>1){ge.includes(e)&&i.push("playerId");let s=a.filter(r=>!i.includes(r));s.length&&this.throwInvalidParamException(s)}}else this.throwInvalidType("prediction","object")};validatePlayerId=(e,t)=>{let a="playerId";e!==ht&&(t||this.throwInvalidParamException([a]),typeof t!="string"&&this.throwInvalidType(a,"string"))};validateMarket=e=>{Object.values(vt).includes(e)||this.throwInvalidMarketException(e)};validateMarketTopX=e=>{e!=="CORRECT_SCORE"&&e!=="CORRECT_SCORE_ADVANCED"&&this.throwInvalidMarketException(e,"TOP_X")};isPredictionBoolean=e=>typeof e=="boolean";throwInvalidPredictionException=(e,t)=>{let a=yr(e,t);throw this.errorHandlingMode==="default"?new x(400,"INVALID_PREDICTION",a):new O(400,"INVALID_TYPE",a)};throwInvalidMarketException=(e,t)=>{let a=null;throw t&&t==="TOP_X"?a=wr(e):a=ei(e),this.errorHandlingMode==="default"?new x(400,"INVALID_MARKET",a):new O(400,"INVALID_TYPE",a)};throwInvalidParamException=e=>{let t=_r(e);throw this.errorHandlingMode==="default"?new x(400,"INVALID_FIELD",t):new O(400,"INVALID_TYPE",t)};throwMissingFieldsException=(e,t)=>{let a=vr(e,t);throw this.errorHandlingMode==="default"?new x(400,"INVALID_FIELD",a):new O(400,"INVALID_TYPE",a)};throwInvalidType=(e,t)=>{let a=Ir(e,t);throw this.errorHandlingMode==="default"?new x(400,"INVALID_TYPE",a):new O(400,"INVALID_TYPE",a)}},ra=class{predictorHttps=null;predictorService=null;idMapping=null;clientHttps=null;predictorValidator=null;errorHandlingMode=null;brandingResolver=null;constructor(e){this.predictorValidator=new sa(e.errorHandlingMode),this.idMapping=new te(e),this.predictorHttps=new Ze(e),this.predictorService=new St(e,this.idMapping),this.clientHttps=new _e(e),this.errorHandlingMode=e.errorHandlingMode,this.brandingResolver=new ye(e)}getConfig=async()=>{let e=await this.clientHttps.getConfig("matchQuiz");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(e):e};play=async e=>{e=this.predictorValidator.validateBodyFields("MATCH_QUIZ",e);let t=e.fixtures.map(a=>this.predictorValidator.validateFixture(a.matchId,a.market,a.prediction.value,a.prediction.playerId));if(t&&t.length&&this.idMapping.idSchema!=="native"){let a=[],i=[];t.forEach(n=>{a.push(n.matchId),n instanceof Ae&&n.prediction.playerId&&n.prediction.playerId!=="OWN_GOAL"&&i.push(n.prediction.playerId)});let s=await this.predictorService.remapMatchIdToNative(a),r={};i&&i.length>0&&(r=await this.predictorService.remapPlayerIdMapToNative(i)),t.forEach((n,o)=>{n.matchId=s[o],n instanceof Ae&&n.prediction.playerId!=="OWN_GOAL"&&(n.prediction.playerId=r[n.prediction.playerId])})}return e.fixtures=t,await this.predictorHttps.makeFootballPrediction(e)};delete=async e=>await this.predictorHttps.deleteFootballPrediction(e);getGames=async(e,t)=>{t=t||!1;let a=this.predictorService.initGameFilters("MATCH_QUIZ",e),i=await this.predictorHttps.getGames(a,t),s=await this.brandingResolver.resolveBrandingBatch([...i.data],t);return i.data=s,await this.predictorService.remapMatchIdsFixtures(i)};getGamesNoRemap=async(e,t)=>{t=t||!1;let a=this.predictorService.initGameFilters("MATCH_QUIZ",e);return await this.predictorHttps.getGamesNoRemap(a,t)};getGameById=async(e,t)=>{t=t||!1;let a=await this.predictorHttps.getGameById(e,t);return await this.brandingResolver.resolveBranding(a,t),await this.predictorService.remapMatchIdsFixtures(a)};getGamePredictions=async(e,t,a)=>(a=a||!1,t&&(t.type&&delete t.type,t.status&&delete t.status,t=new Q(t)),await this.predictorHttps.getGamePredictions(e,a,t));getGameResults=async(e,t,a)=>{a=a||!1,t&&(t=new B(t));let i=await this.predictorHttps.getGameResults(e,a,t);return await this.predictorService.remapMatchIdsFixtures(i)};getCurrentGameResults=async e=>{e=e||!1;let t=new oe(null);t.status="OPEN",t.type="MATCH_QUIZ";let a=await this.predictorHttps.getGames(t,e),i=this.predictorService.getCurrentGameId(a);return(await this.getGameResults(i,null,e)).data[0]};getMyGameEditions=async(e,t)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),t=t||!1;let a=this.predictorService.initGameTypePredictions("MATCH_QUIZ",e),i=[],s=await this.predictorHttps.getMyPredictionsNoRemap(a);if(s.data.length>0){s.data.forEach(c=>{c.game_instance_id&&i.push(c.game_instance_id)});let r=new oe(null);e?.limit&&(r.limit=e.limit),e?.gameIds&&Array.isArray(e.gameIds)&&e.gameIds.length>0&&(r.gameIds=e.gameIds),e?.sortOrder&&(r.sortOrder=e.sortOrder);let n=this.predictorService.initGameFilters("MATCH_QUIZ",r,i),o=await this.predictorHttps.getUserGameEditions(n,t),l=await this.brandingResolver.resolveBrandingBatch([...o.data],t);return o.data=l,await this.predictorService.addPredictionProp(s,o)}else return new ie};getMyGamePrediction=async e=>{let t=new Q({gameIds:[e]}),a=await this.predictorHttps.getMyPredictions(t);if(a.data.length>0){let i=a.data.filter(s=>s.gameInstanceId===e);return i.length?i[0]:null}return null};getUserGameEditions=async(e,t,a)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),a=a||!1;let i=this.predictorService.initGameTypePredictions("MATCH_QUIZ",t),s=[],r=await this.predictorHttps.getUserPredictionsNoRemap(e,i);if(r.data.length>0){r.data.forEach(d=>{d.game_instance_id&&s.push(d.game_instance_id)});let n=new oe(null);t?.limit&&(n.limit=t.limit),t?.gameIds&&Array.isArray(t.gameIds)&&t.gameIds.length>0&&(n.gameIds=t.gameIds),t?.sortOrder&&(n.sortOrder=t.sortOrder);let o=this.predictorService.initGameFilters("MATCH_QUIZ",n,s),l=await this.predictorHttps.getUserGameEditions(o,a),c=await this.brandingResolver.resolveBrandingBatch([...l.data],a);return l.data=c,await this.predictorService.addPredictionProp(r,l)}else return new ie};getUserGamePrediction=async(e,t,a)=>{a=a||!1;let i=new Q({gameIds:[t]}),s=await this.predictorHttps.getUserPredictions(e,a,i);if(s.data.length>0){let r=s.data.filter(n=>n.gameInstanceId===t);return r.length?r[0]:null}else return null};getMarketsResultsForGame=async(e,t)=>{let a=await this.predictorHttps.getMarketResultsForGame(e,t);return await this.predictorService.completeGameMarketResults(a,"MATCH_QUIZ")};getGameWinners=async(e,t)=>{let a=await this.predictorHttps.getContestWinners(e,t),i=await this.getGameById(e);return a.contestModel=i,this.predictorService.completeContestWinners(a)};validateLimitFilterOnGames=e=>{if(this.errorHandlingMode==="default"&&e>50)throw new x(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.");if(this.errorHandlingMode==="standard"&&e>50)throw new O(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}},np=class extends pe{remapClassicQuizzes=e=>(e.meta.pagination=this.remapMetaPagination(e.meta.pagination),e.data=e.data.map(t=>this.remapBasicClassicQuiz(t)),e);remapClassicQuizById=e=>{let t=new Al;t.id=e.id,t.title=e.title,t.alternativeTitle=e.alternative_title,t.description=e.description,t.type=e.type,t.images=e.images,t.participationCount=e.participation_count,t.questionsCount=e.questions_count,t.status=e.status,t.language=e.language,t.authRequirement=e.auth_requirement,t.flags=e.flags,t.adContent=e.ad_content,t.rules=e.rules,t.customFields=e.custom_fields;let a=this.remapBrandingWithId(e);return t.branding=a.branding,t.brandingId=a.brandingId,t.labels=e.labels,t.time=e.time,t.points=e.points,t.related=e.related?this.remapRelated(e.related):[],t.scored=e.scored,t.maxAttempts=e.max_attempts,t.context=e.context?this.remapContext(e.context):e.context,t.averageScore=e.average_score,t.perfectScore=e.perfect_score,t.questions=e.questions.map(i=>this.remapQuestions(i)),t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapClassicQuizParticipation=e=>{let t=new Ll;return t.classicQuizId=e.classic_quiz_id,t.userId=e.user_id,t.questions=e.questions?e.questions.map(a=>this.remapParticipationQuestions(a)):null,t.correctOptions=e.correct_options,t.personalBest=e.personal_best,t.points=e.points,t.attempts=e.attempts,t};remapClassicQuizParticipationBody=e=>e.map(t=>({question_id:t.questionId,option_id:t.optionId}));remapUserClassicQuizParticipationsWithPagination=e=>{let t=new Nl;return t.meta.pagination=this.remapMetaPagination(e.meta.pagination),t.data=e.data.map(a=>{let i=new La;return i.classicQuizId=a.classic_quiz_id,i.correct=a.correct,i.classicQuizQuestions=a.classic_quiz_questions,i.personalBest=a.personal_best,i.points=a.points,i.attempts=a.attempts,i.answers=a.answers?a.answers.map(s=>this.remapParticipationQuestions(s)):a.answers,i}),t};remapUserClassicQuizParticipations=e=>e.map(t=>{let a=new La;return a.classicQuizId=t.classic_quiz_id,a.correct=t.correct,a.classicQuizQuestions=t.classic_quiz_questions,a.personalBest=t.personal_best,a.points=t.points,a.attempts=t.attempts,a.answers=t.answers?t.answers.map(i=>this.remapParticipationQuestions(i)):t.answers,a});remapClassicQuizzesLeaderboard=e=>(e.meta=this.remapClassicQuizLeaderboardMeta(e.meta),e.data=e.data.map(t=>this.remapClassicQuizLeaderboard(t)),e);remapClassicQuizUserRankings=e=>(e.meta.pagination=this.remapMetaPaginationRank(e.meta.pagination),e.data=e.data.map(t=>this.remapClassicQuizUserRanking(t)),e);remapClassicQuizQuestionsReport=e=>e.map(t=>{let a=new Gl;return a.questionId=t.question_id,a.correct=t.correct,a.wrong=t.wrong,a.skipped=t.skipped,a.total=t.total,a});remapClassicQuizResultsSummary=e=>e.map(t=>{let a=new tc;return a.questions=t.questions,a.correctAnswers=t.correct_answers,a});remapMetaPagination=e=>{let t=new Ye;return t.itemsPerPage=e.items_per_page,t.nextPageStartsAfter=e.next_page_starts_after,t};remapClassicQuizLeaderboardMeta=e=>{let t=new Ul;return t.pagination=this.remapMetaPaginationRank(e.pagination),t.filters=this.remapLeaderboardMetaFilters(e.filters),t};remapMetaPaginationRank=e=>{let t=new ke;return t.currentPage=e.current_page,t.itemsPerPage=e.items_per_page,t.numberOfPages=e.number_of_pages,t.totalItems=e.total_items,t};remapLeaderboardMetaFilters=e=>{let t=new Gi;return t.classicQuizIds=e?.classic_quiz_ids||null,t};remapClassicQuizUserRanking=e=>{let t=new Hl;return t.position=e.position,t.classicQuizId=e.classic_quiz_id,t.points=e.points,t};remapBasicClassicQuiz=e=>{let t=new Ni;t.id=e.id,t.title=e.title,t.alternativeTitle=e.alternative_title,t.description=e.description,t.type=e.type,t.images=e.images,t.participationCount=e.participation_count,t.questionsCount=e.questions_count,t.status=e.status,t.language=e.language,t.authRequirement=e.auth_requirement,t.flags=e.flags,t.customFields=e.custom_fields;let a=this.remapBrandingWithId(e);return t.branding=a.branding,t.brandingId=a.brandingId,t.labels=e.labels,t.time=e.time,t.related=e.related?this.remapRelated(e.related):[],t.averageScore=e.average_score,t.perfectScore=e.perfect_score,t.points=e.points,t.scored=e.scored,t.maxAttempts=e.max_attempts,t.context=e.context?this.remapContext(e.context):e.context,t.adContent=e.ad_content,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapQuestions=e=>{let t=new kl;return t.questionId=e.question_id,t.question=e.question,t.images=e.images,t.embedCode=e.embed_code,t.explanation=e.explanation,t.options=e.options.map(a=>this.remapOptions(a)),t};remapOptions=e=>{let t=new Dl;return t.optionId=e.option_id,t.option=e.option,t.images=e.images,t.correct=e.correct,t};remapParticipationQuestions=e=>{let t=new xl;return t.questionId=e.question_id,t.optionId=e.option_id,t.correct=e.correct,t.correctOptionId=e.correct_option_id,t};remapClassicQuizLeaderboard=e=>{let t=new Bl;return t.position=e.position,t.profileId=e.profile_id,t.points=e.points,t};remapContext=e=>{let t=new Kt;return t.content=e.content,t.tags=e.tags?e.tags.map(a=>{let i=new Zt;return i.id=a.id,i.type=a.type,i.source=a.source,i}):null,t.campaign=e.campaign,t};remapRelated=e=>e.map(t=>{let a=new we;return a.entityId=t.entity_id,a.entityType=t.entity_type,a.entityRelationship=t.entity_relationship,a})},op=class extends pe{remapEitherOrs=e=>(e.meta.pagination=this.remapMetaPagination(e.meta.pagination),e.data=e.data.map(t=>this.remapBasicEitherOr(t)),e);remapEitherOrById=e=>{let t=new Wl;t.id=e.id,t.title=e.title,t.alternativeTitle=e.alternative_title,t.description=e.description,t.type=e.type,t.images=e.images,t.status=e.status,t.language=e.language,t.authRequirement=e.auth_requirement,t.winningCondition=e.winning_condition,t.lives=e.lives,t.flags=e.flags,t.customFields=e.custom_fields;let a=this.remapBrandingWithId(e);return t.branding=a.branding,t.brandingId=a.brandingId,t.labels=e.labels,t.time=e.time,t.related=e.related?this.remapRelated(e.related):[],t.context=e.context?this.remapContext(e.context):e.context,t.points=e.points?e.points.map(i=>this.remapPoints(i)):e.points,t.rules=e.rules,t.adContent=e.ad_content,t.totalParticipationsCount=e.total_participations_count,t.totalUsersCount=e.total_users_count,t.finishedParticipationsCount=e.finished_participations_count,t.averageStartedParticipationsCount=e.average_started_participations_count,t.averageFinishedParticipationsCount=e.average_finished_participations_count,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapEitherOrOwnStats=e=>{let t=new ql;return t.eitherOrId=e.either_or_id,t.personalBest=e.personal_best,t.betterThan=e.better_than,t};remapEitherOrResults=e=>{let t=new Zl;return t.standings=e.standings?e.standings.map(a=>this.remapResultsStandings(a)):e.standings,t.breakdown=e.breakdown?e.breakdown.map(a=>this.remapResultsBreakdown(a)):e.breakdown,t};remapEitherOrParticipation=e=>{let t=new jl;return t.instanceId=e.instance_id,t.eitherOrId=e.either_or_id,t.gameStartedAt=e.game_started_at,t.currentStep=e.current_step,t.currentStreak=e.current_streak,t.remainingSteps=e.remaining_steps,t.currentLives=e.current_lives,t.currentPoints=e.current_points,t.personalBest=e.personal_best,t.participationCount=e.participation_count,t.finishedParticipationsCount=e.finished_participations_count,t.steps=e.steps?e.steps.map(a=>this.remapParticipationSteps(a)):e.steps,t};remapBasicEitherOr=e=>{let t=new Ui;t.id=e.id,t.title=e.title,t.alternativeTitle=e.alternative_title,t.description=e.description,t.type=e.type,t.images=e.images,t.status=e.status,t.language=e.language,t.winningCondition=e.winning_condition,t.authRequirement=e.auth_requirement,t.lives=e.lives,t.flags=e.flags,t.related=e.related?this.remapRelated(e.related):[],t.customFields=e.custom_fields;let a=this.remapBrandingWithId(e);return t.branding=a.branding,t.brandingId=a.brandingId,t.labels=e.labels,t.adContent=e.ad_content,t.context=e.context?this.remapContext(e.context):e.context,t.time=e.time,t.points=e.points?e.points.map(i=>this.remapPoints(i)):e.points,t.totalParticipationsCount=e.total_participations_count,t.totalUsersCount=e.total_users_count,t.finishedParticipationsCount=e.finished_participations_count,t.averageStartedParticipationsCount=e.average_started_participations_count,t.averageFinishedParticipationsCount=e.average_finished_participations_count,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapMetaPagination=e=>{let t=new Ye;return t.itemsPerPage=e.items_per_page,t.nextPageStartsAfter=e.next_page_starts_after,t};remapPoints=e=>{let t=new zl;return t.correctSteps=e.correct_steps,t.score=e.score,t};remapResultsStandings=e=>{let t=new ec;return t.userId=e.user_id,t.personalBest=e.personal_best,t};remapResultsBreakdown=e=>{let t=new Kl;return t.rangeStartInclusive=e.range_start_inclusive,t.rangeEndInclusive=e.range_end_inclusive,t.totalUsers=e.total_users,t};remapParticipationSteps=e=>{let t=new Jl;return t.pairId=e.pair_id,t.userSelection=e.user_selection,t.correct=e.correct,t.played=e.played,t.timestamp=e.timestamp,t.optionOne=e.option_one,t.optionTwo=e.option_two,t};remapContext=e=>{let t=new Kt;return t.content=e.content,t.tags=e.tags?e.tags.map(a=>{let i=new Zt;return i.id=a.id,i.type=a.type,i.source=a.source,i}):null,t.campaign=e.campaign,t};remapRelated=e=>e.map(t=>{let a=new we;return a.entityId=t.entity_id,a.entityType=t.entity_type,a.entityRelationship=t.entity_relationship,a})},lp=class extends pe{remapPersonalityQuizzes=e=>(e.meta.pagination=this.remapMetaPagination(e.meta.pagination),e.data=e.data.map(t=>this.remapBasicPersonalityQuiz(t)),e);remapPersonalityQuizById=e=>{let t=new nc;t.id=e.id,t.title=e.title,t.alternativeTitle=e.alternative_title,t.description=e.description,t.images=e.images,t.participationCount=e.participation_count,t.status=e.status,t.language=e.language,t.authRequirement=e.auth_requirement,t.flags=e.flags,t.adContent=e.ad_content,t.preferencesEnabled=e.preferences_enabled||!1,t.rules=e.rules||null,t.customFields=e.custom_fields;let a=this.remapBrandingWithId(e);return t.branding=a.branding,t.brandingId=a.brandingId,t.labels=e.labels,t.time=e.time,t.related=e.related?this.remapRelated(e.related):[],t.maxAttempts=e.max_attempts,t.context=e.context?this.remapContext(e.context):e.context,t.questions=e.questions?e.questions.map(i=>this.remapQuestions(i)):[],t.personaResults=e.persona_results?e.persona_results.map(i=>this.remapPersonaResults(i)):[],t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapPersonalityQuizParticipation=e=>{let t=new lc;return t.personalityQuizId=e.personality_quiz_id,t.userId=e.user_id,t.questions=e.questions?this.remapParticipationQuestions(e.questions):[],t.personas=e.personas?this.remapParticipationPersonas(e.personas):[],t.attempts=e.attempts,t};remapUserPersonalityQuizParticipations=e=>{let t=new uc;return t.meta.pagination=this.remapMetaPagination(e.meta.pagination),t.data=e.data.map(a=>this.remapPersonalityQuizParticipation(a)),t};remapParticipationQuestions=e=>e.map(t=>{let a=new cc;return a.questionId=t.question_id,a.optionId=t.option_id,a});remapParticipationPersonas=e=>e.map(t=>{let a=new dc;return a.personaId=t.persona_id,a.percent=t.percent,a});remapPersonalityQuizParticipationBody=e=>e.map(t=>({question_id:t.questionId,option_id:t.optionId}));remapMetaPagination=e=>{let t=new Ye;return t.itemsPerPage=e.items_per_page,t.nextPageStartsAfter=e.next_page_starts_after,t};remapBasicPersonalityQuiz=e=>{let t=new Bi;t.id=e.id,t.title=e.title,t.alternativeTitle=e.alternative_title,t.description=e.description,t.images=e.images,t.participationCount=e.participation_count,t.status=e.status,t.language=e.language,t.authRequirement=e.auth_requirement,t.flags=e.flags,t.customFields=e.custom_fields;let a=this.remapBrandingWithId(e);return t.branding=a.branding,t.brandingId=a.brandingId,t.labels=e.labels,t.time=e.time,t.related=e.related?this.remapRelated(e.related):[],t.maxAttempts=e.max_attempts,t.preferencesEnabled=e.preferences_enabled||!1,t.context=e.context?this.remapContext(e.context):e.context,t.adContent=e.ad_content,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapPersonaResults=e=>{let t=new ac;return t.personaId=e.persona_id,t.title=e.title,t.description=e.description,t.images=e.images,t};remapQuestions=e=>{let t=new ic;return t.questionId=e.question_id,t.question=e.question,t.images=e.images,t.explanation=e.explanation,t.options=e.options.map(a=>this.remapOptions(a)),t};remapOptions=e=>{let t=new rc;return t.optionId=e.option_id,t.option=e.option,t.images=e.images,t.preferencesMapping=e.preferences_mapping?this.remapPreferencesMapping(e.preferences_mapping):[],t.personaPoints=e.persona_points?this.remapPersonaPoints(e.persona_points):[],t};remapPreferencesMapping=e=>e.map(t=>{let a=new rs;return a.preferenceId=t.preference_id,a});remapPersonaPoints=e=>e.map(t=>{let a=new sc;return a.personaId=t.persona_id,a.points=t.points,a});remapContext=e=>{let t=new Kt;return t.content=e.content,t.tags=e.tags?e.tags.map(a=>{let i=new Zt;return i.id=a.id,i.type=a.type,i.source=a.source,i}):null,t.campaign=e.campaign,t};remapRelated=e=>e.map(t=>{let a=new we;return a.entityId=t.entity_id,a.entityType=t.entity_type,a.entityRelationship=t.entity_relationship,a})},ys=class extends se{classicQuizRemapper=null;eitherOrRemapper=null;personalityQuizRemapper=null;constructor(e){super(e,ee(e.environment,"miniGames")),this.classicQuizRemapper=new np,this.eitherOrRemapper=new op,this.personalityQuizRemapper=new lp}getClassicQuizzes=async(e,t)=>{let a=`/classic-quizzes${this.apiSignInUrl}`;e&&(a+=e.constructMainFiltersUrl()),a+=S(t)?E():"";let i="There was a problem with fetching classic quizzes",s=await this.fetchWithoutAuth(a,i);return this.classicQuizRemapper.remapClassicQuizzes(s)};getClassicQuizById=async(e,t,a)=>{let i=`/classic-quizzes/${e}${this.apiSignInUrl}`;t&&(i+=`&include_correct_options=${t}`),S(a)&&(i+=E());let s="There was a problem with fetching classic quiz by ID",r=await this.fetchWithoutAuth(i,s);return this.classicQuizRemapper.remapClassicQuizById(r.data)};participateInClassicQuiz=async(e,t,a)=>{let i=`/classic-quizzes/${e}/participate${this.apiSignInUrl}`,s=`There was a problem with participating in the following classic quiz: ${e}`,r="POST",n={questions:this.classicQuizRemapper.remapClassicQuizParticipationBody(t),include_correct_options:!!a},o=await this.fetchWithAuth(i,s,r,n);return this.classicQuizRemapper.remapClassicQuizParticipation(o.data)};getMyClassicQuizParticipations=async(e,t)=>{let a=`/classic-quizzes/participations${this.apiSignInUrl}`;e&&(a+=`${e.constructMainFiltersUrl()}`);let i="There was a problem with fetching user's own Classic Quiz participations",s=await this.fetchWithAuth(a,i);return t?this.classicQuizRemapper.remapUserClassicQuizParticipationsWithPagination(s):this.classicQuizRemapper.remapUserClassicQuizParticipations(s.data)};getLeaderboardForClassicQuizzes=async(e,t)=>{let a=`/classic-quizzes/rank${this.apiSignInUrl}`;e&&(a+=`${e.constructMainFiltersUrl()}`),a+=S(t)?E():"";let i="There was a problem with fetching classic quizzes leaderboard",s=await this.fetchWithoutAuth(a,i);return this.classicQuizRemapper.remapClassicQuizzesLeaderboard(s)};getClassicQuizzesUserRanking=async(e,t,a)=>{let i=`/classic-quizzes/users/${e}/rank${this.apiSignInUrl}`;t&&(i+=`${t.constructMainFiltersUrl()}`),i+=S(a)?E():"";let s="There was a problem with fetching user's rankings for classic quizzes",r=await this.fetchWithoutAuth(i,s);return this.classicQuizRemapper.remapClassicQuizUserRankings(r)};getClassicQuizQuestionsReport=async e=>{let t=`/classic-quizzes/${e}/questions-report${this.apiSignInUrl}`,a=`There was a problem with fetching questions report for quiz: ${e}`,i=await this.fetchWithoutAuth(t,a);return this.classicQuizRemapper.remapClassicQuizQuestionsReport(i.data)};getClassicQuizResultsSummary=async(e,t)=>{let a=`/classic-quizzes/${e}/results-summary${this.apiSignInUrl}`;S(t)&&(a+=E());let i="There was a problem with fetching classic quiz results summary",s=await this.fetchWithoutAuth(a,i);return this.classicQuizRemapper.remapClassicQuizResultsSummary(s.data)};getEitherOrs=async(e,t)=>{let a=`/either-or${this.apiSignInUrl}`;e&&(a+=e.constructMainFiltersUrl()),a+=S(t)?E():"";let i="There was a problem with fetching list of Either/Ors",s=await this.fetchWithoutAuth(a,i);return this.eitherOrRemapper.remapEitherOrs(s)};getEitherOrById=async(e,t)=>{let a=`/either-or/${e}${this.apiSignInUrl}`;S(t)&&(a+=E());let i="There was a problem with fetching Either/Or by ID",s=await this.fetchWithoutAuth(a,i);return this.eitherOrRemapper.remapEitherOrById(s.data)};getMyEitherOrStats=async e=>{let t=`/either-or/${e}/own-stats${this.apiSignInUrl}`,a="There was a problem with fetching Either/Or own statistics",i=await this.fetchWithAuth(t,a);return this.eitherOrRemapper.remapEitherOrOwnStats(i.data)};getEitherOrResults=async(e,t)=>{let a=`/either-or/${e}/results${this.apiSignInUrl}${S(t)?E():""}`,i="There was a problem with fetching Either/Or results",s=await this.fetchWithoutAuth(a,i);return this.eitherOrRemapper.remapEitherOrResults(s.data)};participateInEitherOr=async(e,t)=>{let a=`/either-or/${e}/participate${this.apiSignInUrl}`,i="There was a problem with participating in Either/Or",s="POST",r=await this.fetchWithAuth(a,i,s,t);return this.eitherOrRemapper.remapEitherOrParticipation(r.data)};getPersonalityQuizzes=async(e,t)=>{let a=`/personality-quizzes${this.apiSignInUrl}`;e&&(a+=e.constructMainFiltersUrl()),a+=S(t)?E():"";let i="There was a problem with fetching personality quizzes",s=await this.fetchWithoutAuth(a,i);return this.personalityQuizRemapper.remapPersonalityQuizzes(s)};getPersonalityQuizById=async(e,t)=>{let a=`/personality-quizzes/${e}${this.apiSignInUrl}`;S(t)&&(a+=E());let i="There was a problem with fetching personality quiz by ID",s=await this.fetchWithoutAuth(a,i);return this.personalityQuizRemapper.remapPersonalityQuizById(s.data)};participateInPersonalityQuiz=async(e,t)=>{let a=`/personality-quizzes/${e}/participate${this.apiSignInUrl}`,i=`There was a problem with participating in the following personality quiz: ${e}`,s="POST",r={questions:this.personalityQuizRemapper.remapPersonalityQuizParticipationBody(t)},n=await this.fetchWithAuth(a,i,s,r);return this.personalityQuizRemapper.remapPersonalityQuizParticipation(n.data)};getPersonalityQuizUserParticipation=async(e,t,a)=>{let i=`/personality-quizzes/${e}/participations/${t}${this.apiSignInUrl}`;S(a)&&(i+=E());let s="There was a problem with fetching user personality quiz participation",r=await this.fetchWithoutAuth(i,s);return this.personalityQuizRemapper.remapPersonalityQuizParticipation(r.data)};getMyPersonalityQuizParticipations=async e=>{let t=`/personality-quizzes/participations${this.apiSignInUrl}`;e&&(t+=`${e.constructMainFiltersUrl()}`);let a="There was a problem with fetching user's own Personality Quiz participations",i=await this.fetchWithAuth(t,a);return this.personalityQuizRemapper.remapUserPersonalityQuizParticipations(i)}},na=class extends Ee{entityTypes=["competition","team","player"];constructor(e){super(e.errorHandlingMode)}validateFilters=e=>{!e.entityIds&&!e.entityType||(e.entityIds&&!e.entityType&&this.throwException(400,"invalid_filters","You need to use both 'entityIds' and 'entityType' filters together"),!e.entityIds&&e.entityType&&this.throwException(400,"invalid_filters","You need to use both 'entityIds' and 'entityType' filters together"),this.entityTypes.includes(e.entityType)||this.throwException(400,"invalid_filters","Invalid 'entityType' filter. Please use one of the following valid options: competition, team, or player"))}},cp=class{idSchema=null;idMapping=null;validator=null;https=null;entityTypes=["competition","team","player"];profile=null;football=null;eitherOrTime=0;participationStartTimestamp=0;countdownTimer=0;intervalId=null;currentPairId="";constructor(e){this.idSchema=e.idSchema,this.idMapping=new te(e),this.validator=new na(e),this.profile=new le(e),this.football=new xe(e),this.https=new ys(e)}finalizeMiniGamesFilters=async e=>{if(this.idSchema!=="native"&&e.entityIds&&e.entityIds.length>0){this.validator.validateFilters(e);let t=await this.idMapping.getEntityIdsBySchemaId(Array.from(e.entityIds),e.entityType,"native");e.entityIds=t[e.entityType]}};setProfileModelsForEitherOrStandings=async e=>{let t=e.standings.map(i=>i.userId);if(!t.length)return e;let a=await this.profile.getByIds(t);return e.standings.forEach(i=>i.userModel=a.find(s=>s.id===i.userId)||null),e};setProfileModelsForClassicQuizLeaderboards=async e=>{let t=e.map(i=>i.profileId);if(!t.length)return e;let a=await this.profile.getByIds(t);return e.forEach(i=>i.profileModel=a.find(s=>s.id===i.profileId)||null),e};defaultEitherOrParticipation=async(e,t)=>{if(!t){let s=await this.https.getEitherOrById(e,!0);this.eitherOrTime=s.time;let r=await this.https.participateInEitherOr(e,null);return this.participationStartTimestamp=Date.now(),r}let a=0;if(this.participationStartTimestamp)a=(Date.now()-this.participationStartTimestamp)/1e3;else{if(!this.eitherOrTime){let s=await this.https.getEitherOrById(e,!0);this.eitherOrTime=s.time}a=this.eitherOrTime+1}let i=this.createNewParticipation(a,t);try{let s=await this.https.participateInEitherOr(e,i);return!s.currentLives||!s.remainingSteps?this.resetDefaultParticipationTimers():this.participationStartTimestamp=Date.now(),s}catch(s){throw this.resetDefaultParticipationTimers(),s}};handleEitherOrParticipationWithCallback=async(e,t,a)=>t?await this.eitherOrParticipationWithCallback(e,t,a):await this.initialEitherOrParticipationWithCallback(e,a);initialEitherOrParticipationWithCallback=async(e,t)=>{let a=await this.https.getEitherOrById(e,!0);this.eitherOrTime=a.time;let i=await this.https.participateInEitherOr(e,null);return this.participationStartTimestamp=Date.now(),this.countdownTimer=this.eitherOrTime,this.setCurrentPairId(i),await this.handleEitherOrParticipationCallbackInterface(e,t),i};eitherOrParticipationWithCallback=async(e,t,a)=>{this.intervalId&&clearInterval(this.intervalId);let i=0;if(this.participationStartTimestamp)i=(Date.now()-this.participationStartTimestamp)/1e3;else{if(!this.eitherOrTime){let r=await this.https.getEitherOrById(e,!0);this.eitherOrTime=r.time}i=this.eitherOrTime+1}let s=this.createNewParticipation(i,t);try{let r=await this.https.participateInEitherOr(e,s);return!r.currentLives||!r.remainingSteps?(this.resetCallbackParticipationTimers(),a.onElapsedResponse(r),clearInterval(this.intervalId)):(this.participationStartTimestamp=Date.now(),this.countdownTimer=this.eitherOrTime,this.setCurrentPairId(r),await this.handleEitherOrParticipationCallbackInterface(e,a)),r}catch(r){throw this.resetCallbackParticipationTimers(),clearInterval(this.intervalId),r}};setCurrentPairId=e=>{this.currentPairId=e.steps.find(t=>!t.played).pairId||""};handleEitherOrParticipationCallbackInterface=async(e,t)=>{this.intervalId=setInterval(async()=>{if(this.countdownTimer>0)this.countdownTimer--,t.onTimerTick(this.countdownTimer);else{clearInterval(this.intervalId);let a=(Date.now()-this.participationStartTimestamp)/1e3,i={pair:this.currentPairId,answer:this.currentPairId.split("_")[0]},s=this.createNewParticipation(a,i),r=await this.eitherOrParticipationWithCallback(e,s,t);t.onElapsedResponse(r)}},1e3)};createNewParticipation=(e,t)=>{let a=new Yl;return a.expired=e>this.eitherOrTime,a.time=Number(e.toFixed(3)),a.pair=t.pair,a.answer=t.answer,a};resetCallbackParticipationTimers=()=>{this.resetDefaultParticipationTimers(),this.countdownTimer=0,this.currentPairId=""};resetDefaultParticipationTimers=()=>{this.eitherOrTime=0,this.participationStartTimestamp=0};setContextTagsModels=async e=>{let t={competitions:[],teams:[],players:[]};if(e.forEach(a=>{a.context&&a.context.tags&&a.context.tags.length>0&&(t.competitions=[...t.competitions,...this.extractEntityIdsFromTags(a.context.tags,"competition")],t.competitions=Array.from(new Set(t.competitions)),t.teams=[...t.teams,...this.extractEntityIdsFromTags(a.context.tags,"team")],t.teams=Array.from(new Set(t.teams)),t.players=[...t.players,...this.extractEntityIdsFromTags(a.context.tags,"player")],t.players=Array.from(new Set(t.players)))}),t.competitions.length){let a=await this.football.footballFacade.getCompetitionsMapWithNativeIds(t.competitions);this.setModelsForContextTags(e,a,"competition")}if(t.teams.length){let a=await this.football.footballFacade.getTeamsMapWithNativeIds(t.teams);this.setModelsForContextTags(e,a,"team")}if(t.players.length){let a=await this.football.footballFacade.getPlayersMapWithNativeIds(t.players);this.setModelsForContextTags(e,a,"player")}};extractEntityIdsFromTags=(e,t)=>e.filter(a=>a.type===t).map(a=>a.id);setModelsForContextTags=(e,t,a)=>{e.forEach(i=>{i.context&&i.context.tags&&i.context.tags.length>0&&i.context.tags.forEach(s=>{s.type===a&&(s.model=a==="player"?t[s.id]:t.get(s.id),s.id=s.model.id)})})};setQuestionModelsInQuestionsReport=async(e,t)=>e.map(a=>(a.questionModel=t.questions.find(i=>i.questionId.toString()===a.questionId),a))},dp=class{https=null;service=null;activityService=null;idSchema=null;brandingResolver=null;constructor(e){this.https=new ys(e),this.service=new cp(e),this.activityService=new It(e),this.idSchema=e.idSchema,this.brandingResolver=new ye(e)}getClassicQuizzes=async(e,t,a)=>{e&&(e=new Fl(e),await this.service.finalizeMiniGamesFilters(e));let i=await this.https.getClassicQuizzes(e,a),s=await this.brandingResolver.resolveBrandingBatch([...i.data],a);if(t)await this.service.setContextTagsModels(s);else for(let r of s)await this.remapTags(r,"native",this.idSchema);return i.data=s,i};getClassicQuizById=async(e,t,a)=>{let i=await this.https.getClassicQuizById(e,t,a);return await this.brandingResolver.resolveBranding(i,a),await this.service.setContextTagsModels([i]),i};participateInClassicQuiz=async(e,t,a)=>await this.https.participateInClassicQuiz(e,t,a);getMyClassicQuizParticipations=async e=>{e&&(e=new Da(e));let t=await this.https.getMyClassicQuizParticipations(e,!1),a=t.map(s=>s.classicQuizId),i=await this.getClassicQuizzes({classicQuizIds:a});return t.forEach(s=>{s.classicQuizModel=i.data.find(r=>r.id===s.classicQuizId)||null}),t};getMyClassicQuizParticipationsWithPagination=async e=>{e&&(e=new Da(e));let t=await this.https.getMyClassicQuizParticipations(e,!0),a=t.data.map(s=>s.classicQuizId),i=await this.getClassicQuizzes({classicQuizIds:a});return t.data.forEach(s=>{s.classicQuizModel=i.data.find(r=>r.id===s.classicQuizId)||null}),t};getLeaderboardForClassicQuizzes=async(e,t)=>{e&&(e=new $l(e));let a=await this.https.getLeaderboardForClassicQuizzes(e,t);return a.data=await this.service.setProfileModelsForClassicQuizLeaderboards(a.data),a};getClassicQuizzesUserRanking=async(e,t,a)=>{t&&(t=new $i(t));let i=await this.https.getClassicQuizzesUserRanking(e,t,a),s=i.data.map(n=>n.classicQuizId),r=await this.getClassicQuizzes({classicQuizIds:s});return i.data=i.data.map(n=>{let o=r.data.find(l=>l.id===n.classicQuizId)||null;return{...n,classicQuizModel:o}}),i};getClassicQuizQuestionsReport=async(e,t)=>{t=t||!1;let a=await this.https.getClassicQuizQuestionsReport(e),i=await this.getClassicQuizById(e,t,!0);return this.service.setQuestionModelsInQuestionsReport(a,i)};getClassicQuizResultsSummary=async(e,t)=>await this.https.getClassicQuizResultsSummary(e,t);getEitherOrs=async(e,t,a)=>{e&&(e=new Vl(e),await this.service.finalizeMiniGamesFilters(e));let i=await this.https.getEitherOrs(e,a),s=await this.brandingResolver.resolveBrandingBatch([...i.data],a);if(t)await this.service.setContextTagsModels(s);else for(let r of s)await this.remapTags(r,"native",this.idSchema);return i.data=s,i};getEitherOrById=async(e,t)=>{let a=await this.https.getEitherOrById(e,t);return await this.brandingResolver.resolveBranding(a,t),await this.service.setContextTagsModels([a]),a};getMyEitherOrStats=async e=>await this.https.getMyEitherOrStats(e);getEitherOrResults=async(e,t)=>{let a=await this.https.getEitherOrResults(e,t);return await this.service.setProfileModelsForEitherOrStandings(a)};participateInEitherOr=async(e,t,a)=>a?await this.service.handleEitherOrParticipationWithCallback(e,t,a):await this.service.defaultEitherOrParticipation(e,t);calculateEitherOrResultPercentile=async(e,t)=>{if(t==null||isNaN(t)||t<0)return null;if(t===0)return t;let a=await this.getEitherOrResults(e,!0),i=a.breakdown.reduce((r,n)=>r+n.totalUsers,0),s=0;for(let r of a.breakdown)if(s+=r.totalUsers,t>=r.rangeStartInclusive&&t<=r.rangeEndInclusive)return parseFloat((s/i*100).toFixed(1));return null};getPersonalityQuizzes=async(e,t,a)=>{e&&(e=new oc(e),await this.service.finalizeMiniGamesFilters(e));let i=await this.https.getPersonalityQuizzes(e,a),s=await this.brandingResolver.resolveBrandingBatch([...i.data],a);if(t)await this.service.setContextTagsModels(s);else for(let r of s)await this.remapTags(r,"native",this.idSchema);return i.data=s,i};getPersonalityQuizById=async(e,t)=>{let a=await this.https.getPersonalityQuizById(e,t);return await this.brandingResolver.resolveBranding(a),await this.service.setContextTagsModels([a]),a};participateInPersonalityQuiz=async(e,t)=>await this.https.participateInPersonalityQuiz(e,t);getPersonalityQuizUserParticipation=async(e,t,a)=>await this.https.getPersonalityQuizUserParticipation(e,t,a);getMyPersonalityQuizParticipations=async e=>(e&&(e=new pc(e)),await this.https.getMyPersonalityQuizParticipations(e));remapTags=async(e,t,a)=>{if(this.idSchema!="native"&&e.context&&e.context.tags&&e.context.tags.length){let i=JSON.parse(JSON.stringify(e.context.tags)),s=await this.activityService.remapTagsIds(i,t,a);e.context.tags=s}}},oa=class{facade=null;constructor(e){this.facade=new dp(e)}getClassicQuizzes=async(e,t,a)=>await this.facade.getClassicQuizzes(e,t,a);getClassicQuizById=async(e,t,a)=>await this.facade.getClassicQuizById(e,t,a);participateInClassicQuiz=async(e,t,a)=>await this.facade.participateInClassicQuiz(e,t,a);getMyClassicQuizParticipations=async e=>await this.facade.getMyClassicQuizParticipations(e);getMyClassicQuizParticipationsWithPagination=async e=>await this.facade.getMyClassicQuizParticipationsWithPagination(e);getLeaderboardForClassicQuizzes=async(e,t)=>await this.facade.getLeaderboardForClassicQuizzes(e,t);getClassicQuizzesUserRanking=async(e,t,a)=>await this.facade.getClassicQuizzesUserRanking(e,t,a);getClassicQuizQuestionsReport=async(e,t)=>await this.facade.getClassicQuizQuestionsReport(e,t);getClassicQuizResultsSummary=async(e,t)=>await this.facade.getClassicQuizResultsSummary(e,t);getEitherOrs=async(e,t,a)=>await this.facade.getEitherOrs(e,t,a);getEitherOrById=async(e,t)=>await this.facade.getEitherOrById(e,t);getMyEitherOrStats=async e=>await this.facade.getMyEitherOrStats(e);getEitherOrResults=async(e,t)=>await this.facade.getEitherOrResults(e,t);participateInEitherOr=async(e,t,a)=>await this.facade.participateInEitherOr(e,t,a);calculateEitherOrResultPercentile=async(e,t)=>await this.facade.calculateEitherOrResultPercentile(e,t);getPersonalityQuizzes=async(e,t,a)=>await this.facade.getPersonalityQuizzes(e,t,a);getPersonalityQuizById=async(e,t)=>await this.facade.getPersonalityQuizById(e,t);participateInPersonalityQuiz=async(e,t)=>await this.facade.participateInPersonalityQuiz(e,t);getPersonalityQuizUserParticipation=async(e,t,a)=>await this.facade.getPersonalityQuizUserParticipation(e,t,a);getMyPersonalityQuizParticipations=async e=>await this.facade.getMyPersonalityQuizParticipations(e)},la=class{idMapping=null;predictorHttps=null;predictorService=null;predictorValidator=null;brandingResolver=null;clientHttps=null;errorHandlingMode=null;constructor(e){this.idMapping=new te(e),this.errorHandlingMode=e.errorHandlingMode,this.predictorValidator=new sa(e.errorHandlingMode),this.predictorHttps=new Ze(e),this.predictorService=new St(e,this.idMapping),this.clientHttps=new _e(e),this.brandingResolver=new ye(e)}getConfig=async()=>{let e=await this.clientHttps.getConfig("topX");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(e):e};getGames=async(e,t)=>{t=t||!1;let a=this.predictorService.initGameFilters("TOP_X",e),i=await this.predictorHttps.getGames(a,t),s=await this.brandingResolver.resolveBrandingBatch([...i.data],t);return i.data=s,await this.predictorService.remapMatchIdsFixtures(i)};getGamesNoRemap=async(e,t)=>{t=t||!1;let a=this.predictorService.initGameFilters("TOP_X",e);return await this.predictorHttps.getGamesNoRemap(a,t)};getGameById=async(e,t)=>{t=t||!1;let a=await this.predictorHttps.getGameById(e,t);return await this.brandingResolver.resolveBranding(a,t),await this.predictorService.remapMatchIdsFixtures(a)};getGamePredictions=async(e,t,a)=>(a=a||!1,t&&(t.type&&delete t.type,t.status&&delete t.status,t=new Q(t)),await this.predictorHttps.getGamePredictions(e,a,t));getGameResults=async(e,t,a)=>{a=a||!1,t&&(t=new oe(t));let i=await this.predictorHttps.getGameResults(e,a,t);return await this.predictorService.remapMatchIdsFixtures(i)};getCurrentGameResults=async e=>{e=e||!1;let t=new oe(null);t.status="OPEN",t.type="TOP_X";let a=await this.predictorHttps.getGames(t,e),i=this.predictorService.getCurrentGameId(a);return(await this.getGameResults(i,null,e)).data[0]};play=async e=>{let t=new is(e);if(t=this.predictorValidator.validateBodyFields("TOP_X",t),t.fixtures=t.fixtures.map(i=>this.predictorValidator.validateFixture(i.matchId,i.market,i.prediction.value)),this.idMapping.idSchema!=="native"){let i=[];t.fixtures.forEach(r=>i.push(r.matchId));let s=await this.predictorService.remapMatchIdToNative(i);t.fixtures.forEach(r=>r.matchId=s.shift())}let a=await this.predictorHttps.makeFootballPrediction(t);return a.fixtures.forEach(i=>{i.matchId=i.matchModel.id}),a};delete=async e=>await this.predictorHttps.deleteFootballPrediction(e);getMyGameEditions=async(e,t)=>{e&&e.limit&&this.validateLimitFilterOnGames(e.limit),t=t||!1;let a=this.predictorService.initGameTypePredictions("TOP_X",e),i=[],s=await this.predictorHttps.getMyPredictionsNoRemap(a);if(s.data.length>0){s.data.forEach(c=>{c.game_instance_id&&i.push(c.game_instance_id)});let r=new oe(null);e?.limit&&(r.limit=e.limit),e?.gameIds&&Array.isArray(e.gameIds)&&e.gameIds.length>0&&(r.gameIds=e.gameIds),e?.sortOrder&&(r.sortOrder=e.sortOrder);let n=this.predictorService.initGameFilters("TOP_X",r,i),o=await this.predictorHttps.getUserGameEditions(n,t),l=await this.brandingResolver.resolveBrandingBatch([...o.data],t);return o.data=l,await this.predictorService.addPredictionProp(s,o)}else return new ie};getMyGamePrediction=async e=>{let t=new Q({gameIds:[e]}),a=await this.predictorHttps.getMyPredictions(t);if(a.data.length>0){let i=a.data.filter(s=>s.gameInstanceId===e);return i.length?i[0]:null}return null};getUserGameEditions=async(e,t,a)=>{t&&t.limit&&this.validateLimitFilterOnGames(t.limit),a=a||!1;let i=this.predictorService.initGameTypePredictions("TOP_X",t),s=[],r=await this.predictorHttps.getUserPredictionsNoRemap(e,i);if(r.data.length>0){r.data.forEach(d=>{d.game_instance_id&&s.push(d.game_instance_id)});let n=new oe(null);t?.limit&&(n.limit=t.limit),t?.gameIds&&Array.isArray(t.gameIds)&&t.gameIds.length>0&&(n.gameIds=t.gameIds),t?.sortOrder&&(n.sortOrder=t.sortOrder);let o=this.predictorService.initGameFilters("TOP_X",n,s),l=await this.predictorHttps.getUserGameEditions(o,a),c=await this.brandingResolver.resolveBrandingBatch([...l.data],a);return l.data=c,await this.predictorService.addPredictionProp(r,l)}else return new ie};getUserGamePrediction=async(e,t,a)=>{a=a||!1;let i=new Q({gameIds:[t]}),s=await this.predictorHttps.getUserPredictions(e,a,i);if(s.data.length>0){let r=s.data.filter(n=>n.gameInstanceId===t);return r.length?r[0]:null}else return null};getMarketsResultsForGame=async(e,t)=>{let a=await this.predictorHttps.getMarketResultsForGame(e,t);return await this.predictorService.completeGameMarketResults(a,"TOP_X")};getGameWinners=async(e,t)=>{let a=await this.predictorHttps.getContestWinners(e,t),i=await this.getGameById(e);return a.contestModel=i,this.predictorService.completeContestWinners(a)};validateLimitFilterOnGames=e=>{if(this.errorHandlingMode==="default"&&e>50)throw new x(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.");if(this.errorHandlingMode==="standard"&&e>50)throw new O(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}},pp=class{idMappingService=null;profileNamespace=null;footballNamespace=null;topXFacade=null;matchQuizFacade=null;miniGamesNamespace=null;errorHandlingMode=null;constructor(e){this.idMappingService=new te(e),this.profileNamespace=new le(e),this.footballNamespace=new xe(e),this.topXFacade=new la(e),this.matchQuizFacade=new ra(e),this.miniGamesNamespace=new oa(e),this.errorHandlingMode=e.errorHandlingMode}remapTemplatesIds=async e=>{if(e.length>0){let t=[],a=[],i=[];e.forEach(n=>{n.teamIds&&n.teamIds.length>0&&(t=[...t,...n.teamIds]),n.matchIds&&n.matchIds.length>0&&(a=[...a,...n.matchIds]),n.competitionIds&&n.competitionIds.length>0&&(i=[...i,...n.competitionIds])});let s={team:t,match:a,competition:i},r=await this.idMappingService.idMappingFacade.getEntitiesByIds(s,"native",this.idMappingService.idSchema);return[...r.team],[...r.match],[...r.competition],e.forEach(n=>{n.teamIds&&n.teamIds.length>0&&(n.teamIds=n.teamIds.map(o=>r.team.shift())),n.matchIds&&n.matchIds.length>0&&(n.matchIds=n.matchIds.map(o=>r.match.shift())),n.competitionIds&&n.competitionIds.length>0&&(n.competitionIds=n.competitionIds.map(o=>r.competition.shift()))}),e}return e};remapTemplateGroupMatchIds=async e=>{if(e&&e.length>0){for(let t of e)if(!(!t.filters.matchIds||!t.filters.matchIds.every(a=>a))&&t.filters.matchIds.length>0){let a={match:Array.from(t.filters.matchIds)},i=await this.idMappingService.idMappingFacade.getEntitiesByIds(a,"native",this.idMappingService.idSchema);t.filters.matchIds=Array.from(i.match)}}};addProfileModelToLeaderboard=async e=>{if(e.length>0){let t=[],a=e.map(s=>s.profileId);if(!a.length)return e;let i=await this.profileNamespace.getByIds(a);return e.forEach(s=>{i.forEach(r=>{r.id===s.profileId&&(delete r.interests,s.profileModel=r)}),s.profileModel||(s.profileModel=null),t.push(s)}),t}return e};buildOldClientBadges=e=>{let t=new pl;return t.general=this.extractEnabledBadgesId(e.general),t.predictor=this.extractEnabledBadgesId(e.predictor),t.topX=this.extractEnabledBadgesId(e.topX),t.matchQuiz=this.extractEnabledBadgesId(e.matchQuiz),t};buildNewClientBadges=e=>{let t=new ul;return t.predictor=this.extractEnabledBadgesId(e.predictor),t.topX=this.extractEnabledBadgesId(e.topX),t.matchQuiz=this.extractEnabledBadgesId(e.matchQuiz),t.games=this.extractEnabledBadgesId(e.games),t.football=this.extractEnabledBadgesId(e.football),t.classicQuizzes=this.extractEnabledBadgesId(e.classicQuizzes),t.eitherOr=this.extractEnabledBadgesId(e.eitherOr),t.discussions=this.extractEnabledBadgesId(e.discussions),t.potm=this.extractEnabledBadgesId(e.voting.potm),t.poll=this.extractEnabledBadgesId(e.voting.poll),t};initFilters=(e,t)=>{switch(t){case"loyalty":e&&(e=new gl(e));break;case"rankings":e&&(e=new fl(e));break;case"league_leaderboard":e&&(e=new ml(e))}return e};addProfileModelToHighestSuccessRate=async e=>{let t=e.map(i=>i.profileId);if(!t.length)return e;let a=await this.profileNamespace.getByIds(t);return e.map(i=>(a.forEach(s=>{s.id===i.profileId&&(delete s.interests,i.profileModel=s)}),i))};extractRankingsIdsMap=e=>{let t=[],a=[],i=[];return e.forEach(s=>{s.rankType==="GAME"&&s.gameType==="TOP_X"?t.push(s.id):s.rankType==="GAME"&&s.gameType==="MATCH_QUIZ"?a.push(s.id):s.rankType==="TEMPLATE"&&i.push(s.id)}),[t,a,i]};setModelsForUserRankings=(e,t,a,i)=>(i.data.forEach(s=>{s.gameType==="MATCH_QUIZ"&&t?s.model=t.filter(r=>r.id===s.id)[0]:s.gameType==="TOP_X"&&e?s.model=e.filter(r=>r.id===s.id)[0]:s.rankType==="TEMPLATE"&&a&&(s.model=a.filter(r=>r.id===s.id)[0])}),i);completeContestWinners=async e=>{if(e.userList&&e.userList.length){let t=e.userList.map(i=>i.profileId),a=await this.profileNamespace.getByIds(t);e.userList.forEach(i=>{let s=a.filter(r=>r.id===i.profileId)[0];delete s.interests,i.profileModel=s})}return e};validateEntitiesFollowsFilters=e=>{if(!e||(!e.footballCompetitions||!e.footballCompetitions.length)&&(!e.footballTeams||!e.footballTeams.length)&&(!e.footballPlayers||!e.footballPlayers.length))throw this.errorHandlingMode==="default"?new x(400,"invalid_filters","At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters."):new O(400,"invalid_filters","At least one of footballCompetitions, footballTeams or footballPlayers properties should be provided for filters.");if(e.footballCompetitions&&e.footballCompetitions.length>24||e.footballTeams&&e.footballTeams.length>24||e.footballPlayers&&e.footballPlayers.length>24)throw this.errorHandlingMode==="default"?new x(400,"EXCEEDED_LENGTH","Maximum length per entity should be 24 or less."):new O(400,"EXCEEDED_LENGTH","Maximum length per entity should be 24 or less.")};remapEntitiesFollowsFilters=async e=>{let t=JSON.parse(JSON.stringify(e)),a={},i={};t.footballCompetitions&&t.footballCompetitions.length&&(i.competition=t.footballCompetitions),t.footballTeams&&t.footballTeams.length&&(i.team=t.footballTeams),t.footballPlayers&&t.footballPlayers.length&&(i.player=t.footballPlayers);let s=await this.idMappingService.idMappingFacade.getEntitiesByIds(i,this.idMappingService.idSchema,"native");return Object.keys(s).forEach(r=>{r==="competition"?a.footballCompetitions=s[r]:r==="team"?a.footballTeams=s[r]:r==="player"&&(a.footballPlayers=s[r])}),a};addModelsToEntitiesFollows=async e=>{let t=[],a="fb:c:",i=new Map,s=[],r="fb:t:",n=new Map,o=[],l="fb:p:",c=null;return e.breakdown.forEach(d=>{d.id.includes(a)?t.push(d.id):d.id.includes(r)?s.push(d.id):d.id.includes(l)&&o.push(d.id)}),t.length&&(i=await this.footballNamespace.footballFacade.competitionsFacade.getCompetitionsMapWithNativeIds(t)),s.length&&(n=await this.footballNamespace.footballFacade.teamsFacade.getTeamsMapWithNativeIds(s)),o.length&&(c=await this.footballNamespace.footballFacade.playerFacade.getPlayersMapWithNativeIds(o)),e.breakdown.forEach(d=>{d.id.includes(a)?(d.model=i.get(d.id),d.id=d.model.id):d.id.includes(r)?(d.model=n.get(d.id),d.id=d.model.id):d.id.includes(l)&&(d.model=c[d.id],d.id=d.model.id)}),e};getMatchIdsFromGamesInTemplates=async(e,t)=>{if(e&&e.length>0){let s=Fe(e,100),r=[];if(t&&t.length===1){if(t.includes("TOP_X"))try{r=(await Promise.all(s.map(o=>this.topXFacade.getGamesNoRemap({gameIds:o,limit:o.length},!0)))).reduce((o,l)=>[...o,...l.data],[])}catch(o){throw console.error("There was a problem fetching match IDs from Top X games",o),o}if(t.includes("MATCH_QUIZ"))try{r=(await Promise.all(s.map(o=>this.matchQuizFacade.getGamesNoRemap({gameIds:o,limit:o.length},!0)))).reduce((o,l)=>[...o,...l.data],[])}catch(o){throw console.error("There was a problem fetching match IDs from Match Quiz games",o),o}}try{r=(await Promise.all(s.map(o=>{let l=this.topXFacade.getGamesNoRemap({gameIds:o,limit:o.length},!0),c=this.matchQuizFacade.getGamesNoRemap({gameIds:o,limit:o.length},!0);return Promise.all([l,c])}))).reduce((o,[l,c])=>[...o,...l.data,...c.data],[])}catch(o){throw console.error("There was a problem fetching match IDs from both Top X and Match Quiz games",o),o}let n=new Set;return r.forEach(o=>{o.fixtures.map(l=>l.match_id).forEach(l=>n.add(l))}),Array.from(n)}let a=[],i=100;try{for(let r of t){let n=!0,o="",l=0;for(;n;){let c,d={limit:i,startAfter:o};r==="TOP_X"?(c=await this.topXFacade.getGamesNoRemap(d,!0),a=[...a,...c.data],o=c.meta.pagination.next_page_starts_after||null):r==="MATCH_QUIZ"&&(c=await this.matchQuizFacade.getGamesNoRemap(d,!0),a=[...a,...c.data],o=c.meta.pagination.next_page_starts_after||null),n=!!o,l++,l>=5&&(n=!1)}}let s=new Set;return a.forEach(r=>{r.fixtures.map(n=>n.match_id).forEach(n=>s.add(n))}),Array.from(s)}catch(s){throw console.error("There was a problem fetching match IDs from games",s),s}};initMatchFiltersForTemplates=async(e,t)=>{let a=[],i=[],s=[],r=e.fromDate?this.reformatDate(e.fromDate):null,n=e.toDate?this.reformatDate(e.toDate,!0):null,o=500;if(e.competitionIds&&e.competitionIds.length>0&&(a=Array.from(e.competitionIds)),e.teamIds&&e.teamIds.length>0&&(i=Array.from(e.teamIds)),e.matchIds&&e.matchIds.length>0&&(s=Array.from(e.matchIds)),this.isGameTemplate(e)&&(s=await this.getMatchIdsFromGamesInTemplates(e.gameIds,e.gameTypes)),t){let l=e.groups.find(d=>d.groupId===t);if(!l)throw this.errorHandlingMode==="default"?new x(400,"invalid_template_group_id","There is no group in this template with the provided groupId"):new O(400,"invalid_template_group_id","There is no group in this template with the provided groupId");if(!l.filters)throw this.errorHandlingMode==="default"?new x(400,"invalid_template_group_filters","The provided template group has no filters"):new O(400,"invalid_template_group_filters","The provided template group has no filters");r=l.filters.fromDate?this.reformatDate(l.filters.fromDate):null,n=l.filters.toDate?this.reformatDate(l.filters.toDate,!0):null;let c=l.filters.matchIds.every(d=>d);l.filters.matchIds.length>0&&c&&(s=Array.from(l.filters.matchIds))}return new qe({competitionIds:a,teamIds:i,matchIds:s,fromDate:r,toDate:n,limit:o})};isGameTemplate=e=>!!(e.gameIds&&e.gameIds.length>0||e.gameTypes&&e.gameTypes.length>0&&(e.gameTypes.includes("TOP_X")||e.gameTypes.includes("MATCH_QUIZ")));reformatDate=(e,t)=>{let a=new Date(e);t&&a.setUTCHours(23,59,59);let i=a.toISOString();return i=i.slice(0,-5)+"Z",i};extractEnabledBadgesId=e=>{let t=[];return e.forEach(a=>{a.enabled&&t.push(a.id)}),t};addEntityModelToFootballBadges=async e=>{let t=[],a=[],i=[],s=[];if(e.football&&e.football.length>0&&(t=e.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="competition").map(n=>n.requirements.entityId),a=e.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="team").map(n=>n.requirements.entityId),i=e.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="player").map(n=>n.requirements.entityId),s=e.football.filter(n=>n.requirements.entityType.toLocaleLowerCase()==="match").map(n=>n.requirements.entityId)),e.voting&&e.voting.poll&&e.voting.poll.length>0){let[n,o,l,c]=this.extractEntityIdsFromBadges(e.voting.poll);t=t.concat(n),t=Array.from(new Set(t)),a=a.concat(o),a=Array.from(new Set(a)),i=i.concat(l),i=Array.from(new Set(i)),s=s.concat(c),s=Array.from(new Set(s))}if(e.voting&&e.voting.potm&&e.voting.potm.length>0){let[n,o,l,c]=this.extractEntityIdsFromBadges(e.voting.potm);t=t.concat(n),t=Array.from(new Set(t)),a=a.concat(o),a=Array.from(new Set(a)),i=i.concat(l),i=Array.from(new Set(i)),s=s.concat(c),s=Array.from(new Set(s))}let r=await this.fetchFootballEntities(t,a,i,s);e.football&&e.football.length>0&&e.football.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",r.competitions),this.setEntityModelsFromMap(n.requirements,"team",r.teams),this.setEntityModelsFromObject(n.requirements,"player",r.players),this.setEntityModelsFromObject(n.requirements,"match",r.matches)}),e.voting&&e.voting.poll&&e.voting.poll.length>0&&e.voting.poll.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",r.competitions),this.setEntityModelsFromMap(n.requirements,"team",r.teams),this.setEntityModelsFromObject(n.requirements,"player",r.players),this.setEntityModelsFromObject(n.requirements,"match",r.matches)}),e.voting&&e.voting.potm&&e.voting.potm.length>0&&e.voting.potm.forEach(n=>{this.setEntityModelsFromMap(n.requirements,"competition",r.competitions),this.setEntityModelsFromMap(n.requirements,"team",r.teams),this.setEntityModelsFromObject(n.requirements,"player",r.players),this.setEntityModelsFromObject(n.requirements,"match",r.matches)})};setEntityModelsFromMap=(e,t,a)=>{e.entityType===t&&(e.entityModel=a&&a.get(e.entityId)||null,e.entityModel&&(e.entityId=e.entityModel.id))};setEntityModelsFromObject=(e,t,a)=>{e.entityType===t&&(e.entityModel=a[e.entityId]?a[e.entityId]:null,e.entityModel&&(e.entityId=e.entityModel.id))};fetchFootballEntities=async(e,t,a,i)=>{let s={competitions:null,teams:null,players:null,matches:null};if(e.length){let r=await this.footballNamespace.footballFacade.getCompetitionsMapWithNativeIds(e);s.competitions=r}if(t.length){let r=await this.footballNamespace.footballFacade.getTeamsMapWithNativeIds(t);s.teams=r}if(a.length){let r=await this.footballNamespace.footballFacade.getPlayersMapWithNativeIds(a);s.players=r}if(i.length){let r=await this.footballNamespace.footballFacade.getMatchesMapWithNativeIds(i);s.matches=r}return s};extractEntityIdsFromBadges=e=>{let t=e.filter(r=>r.requirements.entityType&&r.requirements.entityType.toLocaleLowerCase()==="competition").map(r=>r.requirements.entityId),a=e.filter(r=>r.requirements.entityType&&r.requirements.entityType.toLocaleLowerCase()==="team").map(r=>r.requirements.entityId),i=e.filter(r=>r.requirements.entityType&&r.requirements.entityType.toLocaleLowerCase()==="player").map(r=>r.requirements.entityId),s=e.filter(r=>r.requirements.entityType&&r.requirements.entityType.toLocaleLowerCase()==="match").map(r=>r.requirements.entityId);return[t,a,i,s]};addGameModelToGamesBadges=async e=>{if(!e.games||e.games.length===0)return;let t=this.getGameIdsFromGamesBadge(e.games,"top_x"),a=this.getGameIdsFromGamesBadge(e.games,"match_quiz"),i=this.getGameIdsFromGamesBadge(e.games,"classic_quiz"),s=this.getGameIdsFromGamesBadge(e.games,"either_or"),r=await this.fetchGamesEntities(t,a,i,s);e.games.forEach(n=>{n.requirements.specificGames&&n.requirements.specificGames.forEach(o=>{o.gameModel=r.find(l=>l.id===o.gameId)||null})})};getGameIdsFromGamesBadge=(e,t)=>{let a=e.filter(i=>i.requirements.specificGames?i.requirements.specificGames.some(s=>s.gameType.toLocaleLowerCase()===t):!1).map(i=>i.requirements.specificGames.map(s=>s.gameId));return Array.prototype.concat.apply([],a)};fetchGamesEntities=async(e,t,a,i)=>{let s=[];if(e.length){let r=await this.topXFacade.getGames({gameIds:e});s=[...s,...r.data]}if(t.length){let r=await this.matchQuizFacade.getGames({gameIds:t});s=[...s,...r.data]}if(a.length){let r=await this.miniGamesNamespace.getClassicQuizzes({classicQuizIds:a});s=[...s,...r.data]}if(i.length){let r=await this.miniGamesNamespace.getEitherOrs({eitherOrIds:i});s=[...s,...r.data]}return s}},up=class{validate=(e,t)=>{e.market&&this.validateMarket(e.market,t),e.fromDate&&this.validateDate(e.fromDate,"fromDate",t),e.toDate&&this.validateDate(e.toDate,"toDate",t),e.usersCount&&this.validateNumberFilters(e.usersCount,"usersCount",t),e.minimumPredictions&&this.validateNumberFilters(e.minimumPredictions,"minimumPredictions",t)};validateMarket=(e,t)=>{if(!Object.keys(vt).includes(e)){let a=ei(e);throw t==="default"?new x(400,"INVALID_MARKET",a):new O(400,"INVALID_MARKET",a)}};validateDate=(e,t,a)=>{let i=/^\d{4}-\d{2}-\d{2}$/;if(typeof e!="string")throw a==="default"?new x(400,"invalid_filters",`You have provided invalid type. The valid type is string for ${t} filter`):new O(400,"invalid_filters",`You have provided invalid type. The valid type is string for ${t} filter`);if(!i.test(e))throw a==="default"?new x(400,"invalid_filters",`You have provided invalid value. The valid value is YYYY-MM-DD for ${t}`):new O(400,"invalid_filters",`You have provided invalid value. The valid value is YYYY-MM-DD for ${t}`)};validateNumberFilters=(e,t,a)=>{let i=t==="usersCount"?1:0,s=t==="usersCount"?1e3:1e6;if(typeof e!="number")throw a==="default"?new x(400,"invalid_filters",`You have provided invalid type. The valid type is number for ${t} filter`):new O(400,"invalid_filters",`You have provided invalid type. The valid type is number for ${t} filter`);if(e<i||e>s)throw a==="default"?new x(400,"invalid_filters",`You have provided invalid value. The valid value is between ${i} and ${s}`):new O(400,"invalid_filters",`You have provided invalid value. The valid value is between ${i} and ${s}`)}},hp=class{limit=null;page=null;groupId=null;constructor(e){this.limit=e?.limit||null,this.page=e?.page||null,e?.groupId!==void 0&&console.warn("Warning: groupId filter property is deprecated and no longer supported by the API. This property will be removed in a future version. Please update your code accordingly.")}constructFiltersUrl(){let e="";return this.limit&&(e+="&",e+=`limit=${this.limit}`),this.page&&(e+="&",e+=`page=${this.page}`),e}},mp=class{config=null;clientHttps=null;loyaltyHttps=null;loyaltyService=null;profileFacade=null;loyaltyValidator=null;topXFacade=null;matchQuizFacade=null;predictorHttps=null;errorHandlingMode=null;football=null;brandingResolver=null;constructor(e,t,a,i,s){this.config=e,this.clientHttps=t,this.loyaltyHttps=a,this.profileFacade=new Tt(s,i),this.loyaltyService=new pp(this.config),this.loyaltyValidator=new up,this.topXFacade=new la(e),this.matchQuizFacade=new ra(e),this.predictorHttps=new Ze(e),this.errorHandlingMode=e.errorHandlingMode,this.football=new xe(e),this.brandingResolver=new ye(e)}getConfig=async()=>await this.clientHttps.getConfig("loyalty");getConfigV2=async e=>{let t=await this.clientHttps.getNewLoyaltyConfig(e);return await this.loyaltyService.addEntityModelToFootballBadges(t.rewards.badges),await this.loyaltyService.addGameModelToGamesBadges(t.rewards.badges),t};getClientBadges=async()=>{let e=await this.getConfig();return this.loyaltyService.buildOldClientBadges(e.rewards.badges)};getClientBadgesV2=async e=>{let t=await this.clientHttps.getNewLoyaltyConfig(e);return this.loyaltyService.buildNewClientBadges(t.rewards.badges)};getTemplates=async(e,t)=>{if(e&&(e=new yl(e)),this.config.idSchema==="native")return await this.loyaltyHttps.getTemplates(e,t);let a=await this.loyaltyHttps.getTemplates(e,t);a.data=await this.loyaltyService.remapTemplatesIds([...a.data]);for(let s of a.data)await this.loyaltyService.remapTemplateGroupMatchIds(s.groups);let i=await this.brandingResolver.resolveBrandingBatch([...a.data],t);return a.data=i,a};getTemplateById=async(e,t)=>{let a=await this.loyaltyHttps.getTemplateById(e,t),i=await this.brandingResolver.resolveBranding(a);if(this.config.idSchema==="native")return i;let s=await this.loyaltyService.remapTemplatesIds([i]);return await this.loyaltyService.remapTemplateGroupMatchIds(s[0].groups),s[0]};getLeaderboard=async(e,t,a)=>{t=this.loyaltyService.initFilters(t,"loyalty");let i=await this.loyaltyHttps.getLeaderboard(e,a,t);return i.data=await this.loyaltyService.addProfileModelToLeaderboard(i.data),i};getLeaderboardForGame=async(e,t,a)=>{t&&(t=new hp(t));let i=await this.loyaltyHttps.getLeaderboardForGame(e,a,t);return i.data=await this.loyaltyService.addProfileModelToLeaderboard(i.data),i};getLeaderboardForLeague=async(e,t)=>{t=this.loyaltyService.initFilters(t,"league_leaderboard");let a=await this.loyaltyHttps.getLeaderboardForLeague(e,t);return a.data=await this.loyaltyService.addProfileModelToLeaderboard(a.data),a};getOwnRankings=async(e,t)=>{let{id:a}=await this.profileFacade.getOwn();return this.getUserRankings(a,e,t)};getUserRankings=async(e,t,a)=>{t=this.loyaltyService.initFilters(t,"rankings");let i=await this.loyaltyHttps.getUserRankings(e,t,a);return await this.getModelsForUserRankings(i)};getHighestSuccessRate=async(e,t)=>{e&&(e=new hl(e),this.loyaltyValidator.validate(e,this.errorHandlingMode));let a=await this.loyaltyHttps.getHighestSuccessRate(e,t);return this.loyaltyService.addProfileModelToHighestSuccessRate(a)};getTemplateWinners=async(e,t)=>{let a=await this.predictorHttps.getContestWinners(e,t),i=await this.getTemplateById(e);return a.contestModel=i,this.loyaltyService.completeContestWinners(a)};getEntitiesFollows=async(e,t)=>{this.loyaltyService.validateEntitiesFollowsFilters(e),this.config.idSchema!=="native"&&(e=await this.loyaltyService.remapEntitiesFollowsFilters(e));let a=await this.loyaltyHttps.getEntitiesFollows(e,t);return await this.loyaltyService.addModelsToEntitiesFollows(a)};getModelsForUserRankings=async e=>{let t=null,a=null,i=null,[s,r,n]=this.loyaltyService.extractRankingsIdsMap(e.data);if(n.length&&(t=(await this.getTemplates()).data.filter(o=>n.includes(o.id))),s.length){let o={gameIds:s};a=(await this.topXFacade.getGames(o)).data}if(r.length){let o={gameIds:r};i=(await this.matchQuizFacade.getGames(o)).data}return this.loyaltyService.setModelsForUserRankings(a,i,t,e)};getTemplateMatches=async(e,t,a)=>{let i=await this.getTemplateById(e,a);if((!i.competitionIds||i.competitionIds.length===0)&&(!i.teamIds||i.teamIds.length===0)&&(!i.matchIds||i.matchIds.length===0)&&(!i.gameIds||i.gameIds.length===0)&&(!i.gameTypes||i.gameTypes.length===0)&&(!i.groups||i.groups.length===0))return[];let s=await this.loyaltyService.initMatchFiltersForTemplates(i,t);return(await this.football.getMatches(s,a)).data}},ca=class{clientHttps=null;profileHttps=null;loyaltyHttps=null;loyaltyFacade=null;localCache=null;constructor(e){this.clientHttps=new _e(e),this.profileHttps=new yi(e),this.loyaltyHttps=new Rt(e),this.localCache=new Qe().createLocalCacheInstance(e.idSchema),this.loyaltyFacade=new mp(e,this.clientHttps,this.loyaltyHttps,this.profileHttps,this.localCache)}getConfig=async()=>(console.warn("getConfig is deprecated. From 1st October the logic will be replaced by getConfigV2. The V2 version returns enhanced models with additional badge categories and improved metadata."),await this.loyaltyFacade.getConfig());getConfigV2=async e=>await this.loyaltyFacade.getConfigV2(e);getClientBadges=async()=>(console.warn("getClientBadges is deprecated. From 1st October the logic will be replaced by getClientBadgesV2. The V2 version returns expanded badge categories including games, football, discussions, and voting badges."),await this.loyaltyFacade.getClientBadges());getClientBadgesV2=async e=>await this.loyaltyFacade.getClientBadgesV2(e);getTemplates=async(e,t)=>await this.loyaltyFacade.getTemplates(e,t);getTemplateById=async(e,t)=>await this.loyaltyFacade.getTemplateById(e,t);getLeaderboard=async(e,t,a)=>await this.loyaltyFacade.getLeaderboard(e,t,a);getLeaderboardForGame=async(e,t,a)=>await this.loyaltyFacade.getLeaderboardForGame(e,t,a);getLeaderboardForLeague=async(e,t)=>await this.loyaltyFacade.getLeaderboardForLeague(e,t);getOwnRankings=async(e,t)=>await this.loyaltyFacade.getOwnRankings(e,t);getUserRankings=async(e,t,a)=>await this.loyaltyFacade.getUserRankings(e,t,a);getHighestSuccessRate=async(e,t)=>await this.loyaltyFacade.getHighestSuccessRate(e,t);getTemplateWinners=async(e,t)=>await this.loyaltyFacade.getTemplateWinners(e,t);getEntitiesFollows=async(e,t)=>await this.loyaltyFacade.getEntitiesFollows(e,t);getTemplateMatches=async(e,t,a)=>await this.loyaltyFacade.getTemplateMatches(e,t,a)},gp=class{predictorHttps=null;clientHttps=null;idMapping=null;predictorService=null;predictorValidator=null;errorHandlingMode=null;constructor(e,t,a,i){this.predictorHttps=t,this.idMapping=i,this.clientHttps=a,this.errorHandlingMode=e.errorHandlingMode,this.predictorValidator=new sa(e.errorHandlingMode),this.predictorService=new St(e,i)}makeFootballPrediction=async(e,t,a,i)=>{let s=this.predictorValidator.validateFixture(e,t,a,i),r=new Xi;if(this.idMapping.idSchema!=="native"){let n=s.matchId,o="",l=await this.predictorService.remapMatchIdToNative([n]);if(s.matchId=l[0],this.errorHandlingMode==="default"&&!s.matchId)throw new x(400,"INVALID_FIELD","Match id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&!s.matchId)throw new O(400,"INVALID_FIELD","Match id is invalid!");if(s instanceof Ae&&s.prediction.playerId!=="OWN_GOAL"){if(s.prediction.playerId&&(o=s.prediction.playerId,s.prediction.playerId=await this.predictorService.remapPlayerIdToNative([o])),this.errorHandlingMode==="default"&&s.market!==ht&&!s.prediction.playerId)throw new x(400,"INVALID_FIELD","Player id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&s.market!==ht&&!s.prediction.playerId)throw new O(400,"INVALID_FIELD","Player id is invalid!")}r.fixtures=[s];let c=await this.predictorHttps.makeFootballPrediction(r);return c.fixtures.forEach(d=>{d.prediction.playerId&&d.prediction.playerId!=="OWN_GOAL"&&(d.prediction.playerId=o),d.matchId=n}),c}else return r.fixtures=[s],await this.predictorHttps.makeFootballPrediction(r)};getMatchSummary=async(e,t)=>{let a=await this.getMatchSummaryBase(e,t),i=JSON.parse(JSON.stringify(a.predictions)),s=await this.predictorService.remapPlayerIdToIdSchema(i);return a.predictions=s,a};getMarketSummary=async(e,t,a,i)=>{try{let s=await this.getMatchSummaryBase(e,i);return await this.predictorService.getMarketSummary(s,t,a)}catch(s){throw s}};getMatchSummaryBase=async(e,t)=>{if(this.idMapping.idSchema!=="native"){let a=(await this.predictorService.remapMatchIdToNative([e]))[0],i=await this.predictorHttps.getMatchSummary(a,t);return i.matchId=e,i}else return await this.predictorHttps.getMatchSummary(e,t)};getConfig=async()=>{let e=await this.clientHttps.getConfig("predictor");return this.idMapping.idSchema!=="native"?await this.predictorService.remapCompetitionsFromConfig(e):e};deleteFootballPrediction=async e=>await this.predictorHttps.deleteFootballPrediction(e);getMyPredictions=async e=>{let t=this.predictorService.initPredictionsFilters(e,"user");return await this.predictorHttps.getMyPredictions(t)};getMyPredictionsForMatches=async(e,t)=>{if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(e))throw new x(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();if(this.errorHandlingMode==="standard"&&this.predictorService.areIdsExceeded(e))throw new O(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.");this.idMapping.idSchema!=="native"&&(e=await this.predictorService.remapMatchIdToNative([...e]));let a=this.predictorService.initPredictionsFilters(t,"matches",e);return await this.predictorHttps.getMyPredictions(a)};getMyCurrentPredictions=async e=>{let t=this.predictorService.initPredictionsFilters(e,"current");return await this.predictorHttps.getMyPredictions(t)};getMyPastPredictions=async e=>{let t=this.predictorService.initPredictionsFilters(e,"past");return await this.predictorHttps.getMyPredictions(t)};getUserPredictions=async(e,t,a)=>{let i=this.predictorService.initPredictionsFilters(t,"user");return await this.predictorHttps.getUserPredictions(e,a,i)};getUserCurrentPredictions=async(e,t,a)=>{let i=this.predictorService.initPredictionsFilters(t,"current");return await this.predictorHttps.getUserPredictions(e,a,i)};getUserPastPredictions=async(e,t,a)=>{let i=this.predictorService.initPredictionsFilters(t,"past");return await this.predictorHttps.getUserPredictions(e,a,i)};getUserPredictionsForMatches=async(e,t,a,i)=>{if(this.errorHandlingMode==="default"&&this.predictorService.areIdsExceeded(t))throw new x(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.").errorMessage();if(this.errorHandlingMode==="standard"&&this.predictorService.areIdsExceeded(t))throw new O(400,"EXCEEDED_LENGTH","Maximum matchIds in PredictionFilters should be 10 or less.");this.idMapping.idSchema!=="native"&&(t=await this.predictorService.remapMatchIdToNative([...t]));let s=this.predictorService.initPredictionsFilters(a,"matches",t);return await this.predictorHttps.getUserPredictions(e,i,s)};getPredictionById=async e=>await this.predictorHttps.getPredictionById(e);getPredictionsByIds=async e=>await this.predictorHttps.getPredictionsByIds(e);getMatchMarketsResults=async e=>(this.idMapping.idSchema!=="native"&&(e=(await this.predictorService.remapMatchIdToNative([e]))[0]),await this.predictorService.getMatchMarketsResults(e))},fp=class extends Ee{constructor(e){super(e.errorHandlingMode)}validateMatchSummary=e=>{e||this.throwException(400,"invalid_match_summary","Match summary is required."),e.predictions||this.throwException(400,"invalid_match_summary_predictions","Predictions in match summary are required."),(!e.predictions.correctScore||!e.predictions.correctScoreAdvanced)&&this.throwException(400,"invalid_match_summary_predictions_keys","Keys in predictions in match summary are invalid. The valid ones are: correctScore and correctScoreAdvanced")}},yp=class{validator=null;constructor(e){this.validator=new fp(e)}calculateOneXTwoFromScores=e=>{this.validator.validateMatchSummary(e);let{correctScore:t,correctScoreAdvanced:a}=e.predictions,i={...t,...a},s=0,r=0,n=0,o=0;return Object.entries(i).forEach(([l,c])=>{if(c===0)return;let d=c;s+=d;let[p,m]=l.split(":").map(Number);p>m?r+=d:p===m?n+=d:o+=d}),{home:s?Math.round(r/s*100):0,draw:s?Math.round(n/s*100):0,away:s?Math.round(o/s*100):0}};getTopCorrectScores=e=>{this.validator.validateMatchSummary(e);let{correctScore:t,correctScoreAdvanced:a}=e.predictions,i={...t,...a},s=0;return Object.values(i).forEach(r=>{s+=r}),Object.entries(i).filter(([r,n])=>n>0).map(([r,n])=>({score:r,percentage:Math.round(n/s*100)})).sort((r,n)=>n.percentage-r.percentage).slice(0,3)}},ws=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;helpers=null;constructor(e){this.idMapping=new te(e),this.predictorHttps=new Ze(e),this.clientHttps=new _e(e),this.predictorFacade=new gp(e,this.predictorHttps,this.clientHttps,this.idMapping),this.helpers=new yp(e)}makeFootballPrediction=async(e,t,a,i)=>await this.predictorFacade.makeFootballPrediction(e,t,a,i);getMatchSummary=async(e,t)=>await this.predictorFacade.getMatchSummary(e,t);getMarketSummary=async(e,t,a,i)=>await this.predictorFacade.getMarketSummary(e,t,a,i);getConfig=async()=>await this.predictorFacade.getConfig();deleteFootballPrediction=async e=>await this.predictorFacade.deleteFootballPrediction(e);getMyPredictions=async e=>await this.predictorFacade.getMyPredictions(e);getMyCurrentPredictions=async e=>await this.predictorFacade.getMyCurrentPredictions(e);getMyPastPredictions=async e=>await this.predictorFacade.getMyPastPredictions(e);getMyPredictionsForMatches=async(e,t)=>await this.predictorFacade.getMyPredictionsForMatches(e,t);getUserPredictions=async(e,t,a)=>await this.predictorFacade.getUserPredictions(e,t,a);getUserCurrentPredictions=async(e,t,a)=>await this.predictorFacade.getUserCurrentPredictions(e,t,a);getUserPastPredictions=async(e,t,a)=>await this.predictorFacade.getUserPastPredictions(e,t,a);getUserPredictionsForMatches=async(e,t,a,i)=>await this.predictorFacade.getUserPredictionsForMatches(e,t,a,i);getPredictionById=async e=>await this.predictorFacade.getPredictionById(e);getPredictionsByIds=async e=>await this.predictorFacade.getPredictionsByIds(e);getMatchMarketsResults=async e=>await this.predictorFacade.getMatchMarketsResults(e)},_s=class{loyalty=null;profile=null;predictor=null;constructor(e){this.loyalty=new ca(e),this.profile=new le(e),this.predictor=new ws(e)}setTemplateModels=async e=>{let t=await this.loyalty.getTemplates();e.templateModel=t.data.find(a=>a.id===e.templateId),e.pastTemplates&&e.pastTemplates.length>0&&e.pastTemplates.forEach(a=>{a.model=t.data.find(i=>i.id===a.id)})};setTemplateModelsInLeagues=async e=>{if(!e.length)return;let t=await this.loyalty.getTemplates();e.forEach(a=>{a.templateModel=t.data.find(i=>i.id===a.templateId),a.pastTemplates&&a.pastTemplates.length>0&&a.pastTemplates.forEach(i=>{i.model=t.data.find(s=>s.id===i.id)})})};setTemplateModelsFromLeagueModels=(e,t)=>{if(t==="PRIVATE_LEAGUE"){e.forEach(a=>{a.templateModel=a.templateId===a.privateLeagueModel.templateId?a.privateLeagueModel.templateModel:a.privateLeagueModel.pastTemplates.find(i=>i.id===a.templateId).model});return}e.forEach(a=>{a.templateModel=a.templateId===a.challengeModel.templateId?a.challengeModel.templateModel:a.challengeModel.pastTemplates.find(i=>i.id===a.templateId).model})};setProfileModel=async e=>{let t=await this.profile.getById(e.profileId).getInfo();e.profileModel=t};setModelsForPredictions=async e=>{if(e.data.length){let t=e.data.map(r=>r.profileId),a=e.data.map(r=>r.predictionId),i=await this.getProfileModels(t),s=await this.getPredictionModels(a);e.data.forEach(r=>{r.profileModel=i.find(n=>n.id===r.profileId),r.predictionModel=s.find(n=>n.id===r.predictionId)})}return e};getProfileModels=async e=>await this.profile.getByIds(e);getPredictionModels=async e=>await this.predictor.getPredictionsByIds(e)},da=class{idSchema=null;profile=null;validator=null;idMapping=null;constructor(e){this.idSchema=e.idSchema,this.profile=new le(e),this.validator=new na(e),this.idMapping=new te(e)}finalizePostFullModel=async e=>{let t=e.map(i=>i.userId),a=await this.profile.getByIds(t);return e.map(i=>(i.userModel=this.extractModelById(a,i.userId),i))};finalizeTopDiscussionsFilters=async e=>{if(this.idSchema!=="native"&&e.entityIds&&e.entityIds.length>0){this.validator.validateFilters(e);let t=await this.idMapping.getEntityIdsBySchemaId(Array.from(e.entityIds),e.entityType,"native");e.entityIds=t[e.entityType]}};extractModelById=(e,t)=>{if(e.length){let a=e.find(i=>i.id===t);return a?(delete a.interests,a):null}return null}},wp=class{factory=null;https=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(e){this.factory=new gs,this.https=new ms(e),this.service=new _s(e),this.loyaltyHttps=new Rt(e),this.profile=new le(e),this.discussionsService=new da(e)}issue=async(e,t)=>{let a=this.factory.createRequestBodyFromParam(e,"ONE_VS_ONE"),i=await this.https.create(a,"CHALLENGE");await this.service.setTemplateModels(i);let s=await this.https.invite(i.id,[t]);return i.invites=[],i.invites.push(s[0]),i};update=async(e,t)=>{let a=this.factory.createUpdateRequestBodyFromParam(t,"ONE_VS_ONE"),i=await this.https.update(e,a,"CHALLENGE");return await this.service.setTemplateModels(i),i};updateTemplate=async(e,t,a)=>{let i=await this.https.updateLeagueTemplate(e,t,a,"CHALLENGE");return await this.service.setTemplateModels(i),i};delete=async e=>await this.https.delete(e,"CHALLENGE");getById=async(e,t)=>{let a=await this.https.getById(e,"CHALLENGE",t);return await this.service.setTemplateModels(a),a};getMyChallenges=async e=>{e=new go(e);let t=await this.https.getMyLeagues(e,"CHALLENGE");return await this.service.setTemplateModelsInLeagues(t),t};accept=async e=>{let t=await this.https.accept(e,!0,"CHALLENGE");return await this.finalizeAcceptModel(t,!0)};reject=async e=>{let t=await this.https.accept(e,!1,"CHALLENGE");return await this.finalizeAcceptModel(t,!1)};leave=async e=>await this.https.leave(e,"CHALLENGE");finalizeAcceptModel=async(e,t)=>{if(t){let a=await this.getById(e.challengeId);e.challengeModel=a}return await this.service.setProfileModel(e),e};getMyChallengesStandings=async e=>{e&&(e=new mo(e));let t=await this.profile.getOwn().getInfo(),a=await this.loyaltyHttps.getUserRankingsForPrivateLeagueAndChallenges(t.id,"CHALLENGE",e);for(let i of a.data){let s=await this.getById(i.challengeId);i.challengeModel=s}return this.service.setTemplateModelsFromLeagueModels(a.data,"CHALLENGE"),a};getInvitations=async e=>{e=new Zi(e),e.type="ONE_VS_ONE";let t=await this.https.getInvitations("CHALLENGE",e);return await this.service.setTemplateModelsInLeagues(t.data),t};getReportedPosts=async(e,t)=>{t&&(t=new es(t));let a=await this.https.getReportedPosts(e,t);return a.data=await this.discussionsService.finalizePostFullModel(a.data),a};getPredictions=async(e,t)=>{if(t){if(t.limit&&t.limit>20)throw new O(400,"invalid_limit","Invalid limit. The maximum limit is: 20");t=new ts(t)}let a=await this.https.getPredictions(e,t);return await this.service.setModelsForPredictions(a)};moderatePost=async(e,t)=>await this.https.moderatePost(e,t)},_p=class{facade=null;constructor(e){this.facade=new wp(e)}issue=async(e,t)=>await this.facade.issue(e,t);update=async(e,t)=>await this.facade.update(e,t);updateTemplate=async(e,t,a)=>await this.facade.updateTemplate(e,t,a);delete=async e=>await this.facade.delete(e);getById=async(e,t)=>await this.facade.getById(e,t);getMyChallenges=async e=>await this.facade.getMyChallenges(e);accept=async e=>await this.facade.accept(e);reject=async e=>await this.facade.reject(e);leave=async e=>await this.facade.leave(e);getMyChallengesStandings=async e=>await this.facade.getMyChallengesStandings(e);getInvitations=async e=>await this.facade.getInvitations(e);getReportedPosts=async(e,t)=>await this.facade.getReportedPosts(e,t);getPredictions=async(e,t)=>await this.facade.getPredictions(e,t);moderatePost=async(e,t)=>await this.facade.moderatePost(e,t)},vp=class extends se{remapper=null;constructor(e){super(e,ee(e.environment,"discussions")),this.remapper=new hs}getAll=async(e,t)=>{let a="/discussions"+this.apiSignInUrl;e&&(a+=`${e.constructMainFiltersUrl()}`),S(t)&&(a+=E());let i="There was a problem getting discussions",s=await this.fetchWithoutAuth(a,i);return this.remapper.remapToDiscussions(s)};getById=async e=>{let t=`/discussions/${e}`+this.apiSignInUrl,a="There was a problem getting discussion",i=await this.fetchWithoutAuth(t,a);return this.remapper.remapToDiscussionById(i.data)};createPost=async(e,t)=>{let a=`/discussions/${e}/posts`+this.apiSignInUrl,i="There was a problem creating post in discussion",s="POST",r=await this.fetchWithAuth(a,i,s,t);return this.remapper.remapToPostByIdBasic(r.data)};getPostById=async e=>{let t=`/posts/${e}`+this.apiSignInUrl,a="There was a problem getting post by ID in discussion",i=await this.fetchWithoutAuth(t,a);return this.remapper.remapToPostByIdFull(i.data)};updatePost=async(e,t)=>{let a=`/posts/${e}`+this.apiSignInUrl,i="There was a problem editing post in discussion",s="PUT",r={content:t},n=await this.fetchWithAuth(a,i,s,r);return this.remapper.remapToPostByIdBasic(n.data)};reactToPost=async(e,t)=>{let a=`/posts/${e}/reaction`+this.apiSignInUrl,i="There was a problem reacting to post in discussion",s="PUT",r={reaction:t.toLocaleLowerCase()},n=await this.fetchWithAuth(a,i,s,r);return this.remapper.remapToPostByIdFull(n.data)};deletePost=async e=>{let t=`/posts/${e}`+this.apiSignInUrl;return await this.fetchWithAuth(t,"There was a problem deleting post in discussion","DELETE"),!0};getPosts=async(e,t)=>{let a=`/discussions/${e}/posts`+this.apiSignInUrl;t&&(a+=`${t.constructMainFiltersUrl()}`);let i="There was a problem getting posts in discussion",s=await this.fetchWithoutAuth(a,i);return this.remapper.remapToPostsForDiscussion(s,"full")};getPostReplies=async(e,t)=>{let a=`/posts/${e}/replies`+this.apiSignInUrl;t&&(a+=`${t.constructMainFiltersUrl()}`);let i="There was a problem getting post's replies in discussion",s=await this.fetchWithoutAuth(a,i);return this.remapper.remapToPostsForDiscussion(s,"full")};reportPost=async(e,t,a)=>{let i=`/posts/${e}/report`+this.apiSignInUrl,s="There was a problem reporting post in discussion",r="POST",n={reason:t.toLocaleUpperCase(),reason_details:a||null},o=await this.fetchWithAuth(i,s,r,n);return this.remapper.remapToPostByIdBasic(o.data)};getOwnPosts=async e=>{let t="/posts"+this.apiSignInUrl;e&&(t+=`${e.constructMainFiltersUrl()}`);let a="There was a problem getting own posts",i=await this.fetchWithAuth(t,a);return this.remapper.remapToPosts(i)};getUserPosts=async(e,t,a)=>{let i=`/posts/users/${e}`+this.apiSignInUrl;t&&(i+=`${t.constructMainFiltersUrl()}`),S(a)&&(i+=E());let s="There was a problem getting user's posts",r=await this.fetchWithoutAuth(i,s);return this.remapper.remapToPosts(r)};getPostsCount=async(e,t)=>{let a="/discussions/posts/count"+this.apiSignInUrl+`&discussion_ids=${e.join(",")}`;S(t)&&(a+=E());let i="There was a problem getting posts count for discussions",s=await this.fetchWithoutAuth(a,i);return this.remapper.remapToPostCount(s.data)};getTopDiscussions=async(e,t)=>{let a="/discussions/top"+this.apiSignInUrl;e&&(a+=`${e.constructMainFiltersUrl()}`),S(t)&&(a+=E());let i="There was a problem getting top discussions",s=await this.fetchWithoutAuth(a,i);return this.remapper.remapToDiscussions(s)};getPostsCountExtended=async e=>{let t="/discussions/posts/count"+this.apiSignInUrl,a={discussion_ids:Array.from(e)},i="POST",s="There was a problem getting posts count extended for discussions",r=await this.fetchWithoutAuth(t,s,i,a);return this.remapper.remapToPostCount(r.data)}},Ip=class{createRequestBodyFromParam=e=>{let t=new _o;return t.content=e.content,t.reply_id=e.replyId,t.discussion_label=e.discussionLabel,t.discussion_url=e.discussionUrl,t.anonymous_nickname=e.userNickname,t.context=e.context,t}},Tp=class{idSchema=null;errorHandlingMode=null;https=null;clientHttps=null;activityService=null;service=null;factory=null;LIMIT_POSTS_COUNT=50;LIMIT_POSTS_COUNT_EXTENDED=250;constructor(e){this.idSchema=e.idSchema,this.errorHandlingMode=e.errorHandlingMode,this.https=new vp(e),this.clientHttps=new _e(e),this.activityService=new It(e),this.service=new da(e),this.factory=new Ip}getAll=async(e,t)=>{e&&(e=new Mo(e));let a=await this.https.getAll(e,t);for(let i of a.data)await this.remapTags(i,"native",this.idSchema);return a};getById=async e=>{let t=await this.https.getById(e);return await this.remapTags(t,"native",this.idSchema),t};createPost=async(e,t)=>{let a=JSON.parse(JSON.stringify(t));await this.remapTags(a,this.idSchema,"native");let i=this.factory.createRequestBodyFromParam(a);return await this.https.createPost(e,i)};getPostById=async e=>{let t=await this.https.getPostById(e);return(await this.service.finalizePostFullModel([t]))[0]};updatePost=async(e,t)=>await this.https.updatePost(e,t);deletePost=async e=>await this.https.deletePost(e);getPosts=async(e,t)=>{t&&(t=new st(t));let a=await this.https.getPosts(e,t);return a.data=await this.service.finalizePostFullModel(a.data),a};getPostReplies=async(e,t)=>{t&&(t=new st(t));let a=await this.https.getPostReplies(e,t);return a.data=await this.service.finalizePostFullModel(a.data),a};reactToPost=async(e,t)=>{let a=await this.https.reactToPost(e,t);return(await this.service.finalizePostFullModel([a]))[0]};reportPost=async(e,t,a)=>await this.https.reportPost(e,t,a);getOwnPosts=async e=>(e&&(e=new st(e)),await this.https.getOwnPosts(e));getUserPosts=async(e,t,a)=>(t&&(t=new st(t)),await this.https.getUserPosts(e,t,a));getConfig=async()=>await this.clientHttps.getConfig("discussions");getPostsCount=async(e,t)=>{if(!e||!Array.isArray(e)||!e.length)throw this.errorHandlingMode==="standard"?new O(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array"):new x(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array");if(e.length>this.LIMIT_POSTS_COUNT)throw this.errorHandlingMode==="standard"?new O(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids."):new x(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is 50. You can use 'getPostsCountExtended' method for more than 50 discussion ids.");return await this.https.getPostsCount(e,t)};getTopDiscussions=async(e,t)=>{e&&(e=new Oo(e),await this.service.finalizeTopDiscussionsFilters(e));let a=await this.https.getTopDiscussions(e,t);for(let i of a.data)await this.remapTags(i,"native",this.idSchema);return a};getPostsCountExtended=async e=>{if(!e||!Array.isArray(e)||!e.length)throw this.errorHandlingMode==="standard"?new O(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array"):new x(400,"invalid_discussion_ids","Invalid discussion ids argument. Please provide at least one discussion id in an array");if(e.length>this.LIMIT_POSTS_COUNT_EXTENDED)throw this.errorHandlingMode==="standard"?new O(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is: "+this.LIMIT_POSTS_COUNT_EXTENDED):new x(400,"invalid_discussion_ids","Maximum number of discussion ids exceeded. The maximum number of discussion ids is: "+this.LIMIT_POSTS_COUNT_EXTENDED);return await this.https.getPostsCountExtended(e)};remapTags=async(e,t,a)=>{if(this.idSchema!="native"&&e.context&&e.context.tags&&e.context.tags.length){let i=JSON.parse(JSON.stringify(e.context.tags)),s=await this.activityService.remapTagsIds(i,t,a);e.context.tags=s}}},bp=class{facade=null;constructor(e){this.facade=new Tp(e)}getAll=async(e,t)=>await this.facade.getAll(e,t);getById=async e=>await this.facade.getById(e);createPost=async(e,t)=>await this.facade.createPost(e,t);getPostById=async e=>await this.facade.getPostById(e);updatePost=async(e,t)=>await this.facade.updatePost(e,t);deletePost=async e=>await this.facade.deletePost(e);getPosts=async(e,t)=>await this.facade.getPosts(e,t);getPostReplies=async(e,t)=>await this.facade.getPostReplies(e,t);react=async(e,t)=>await this.facade.reactToPost(e,t);reportPost=async(e,t,a)=>await this.facade.reportPost(e,t,a);getOwnPosts=async e=>await this.facade.getOwnPosts(e);getUserPosts=async(e,t,a)=>await this.facade.getUserPosts(e,t,a);getConfig=async()=>await this.facade.getConfig();getPostsCount=async(e,t)=>await this.facade.getPostsCount(e,t);getTopDiscussions=async(e,t)=>await this.facade.getTopDiscussions(e,t);getPostsCountExtended=async e=>await this.facade.getPostsCountExtended(e)},Pp=class extends Ee{constructor(e){super(e)}validatePrediction=e=>{(!e.fixtures||!Array.isArray(e.fixtures)||e.fixtures.length===0)&&this.throwException(400,"invalid_method_call","Fixtures field is required and should contain at least one fixtures object. For more information please visit our documentation");let t=["id","predictionType","prediction"];for(let a of e.fixtures)(Object.keys(a).length!==t.length||Object.keys(a).some(i=>!t.includes(i)))&&this.throwException(400,"invalid_method_call","Fixtures field is invalid. For more information please visit our documentation"),this.validatePredictionType(a.predictionType,a.prediction);e.tiebreaker&&(!e.tiebreaker.statTotal||!Number.isInteger(e.tiebreaker.statTotal))&&this.throwException(400,"invalid_method_call","Tiebreaker field is invalid. It should contain statTotal key with integer value. For more information please visit our documentation")};validatePredictionType=(e,t)=>{switch(e){case"BOOLEAN":typeof t!="boolean"&&this.throwException(400,"invalid_method_call",`Prediction must be a boolean for prediction type ${e}`);break;case"NUMBER":(typeof t!="number"||!Number.isFinite(t))&&this.throwException(400,"invalid_method_call",`Prediction must be a number for prediction type ${e}`);break;case"ENUM":case"FREE_INPUT":(typeof t!="string"||t.trim()==="")&&this.throwException(400,"invalid_method_call",`Prediction must be a non-empty string for prediction type ${e}`);break;default:this.throwException(400,"invalid_method_call",`Unknown prediction type: ${e}`)}}},Ep=class{https=null;validator=null;profile=null;brandingResolver=null;constructor(e){this.https=new jt(e),this.profile=new le(e),this.validator=new Pp(e.errorHandlingMode),this.brandingResolver=new ye(e)}getGames=async(e,t)=>{e&&(e=new Fo(e));let a=await this.https.getEventGames(e,t),i=await this.brandingResolver.resolveBrandingBatch([...a.data],t);return a.data=i,a};getGameById=async(e,t)=>{let a=await this.https.getEventGameById(e,t);return await this.brandingResolver.resolveBranding(a,t),a};makePrediction=async(e,t)=>(this.validator.validatePrediction(t),await this.https.makeEventGamePrediction(e,t));updatePrediction=async(e,t,a)=>(this.validator.validatePrediction(a),await this.https.updateEventGamePrediction(e,t,a));getGamePredictionsForUser=async(e,t,a,i)=>{a&&(a=new Ao(a));let s=await this.https.getEventGamePredictionsForUser(e,t,a,i),r=null;try{r=await this.profile.getById(t).getInfo()}catch(n){console.error(n)}return s.data.forEach(n=>{n.profileModel=r}),s};getRankings=async(e,t,a)=>{t&&(t=new ko(t));let i=await this.https.getEventGameRankings(e,t,a),s=i.data.map(n=>n.profileId),r=[];return s.length>0&&(r=await this.profile.getByIds(s),i.data=i.data.map(n=>(n.profileModel=r.find(o=>o.id===n.profileId)||null,n))),i}},Rp=class{facade=null;constructor(e){this.facade=new Ep(e)}getGames=async(e,t)=>await this.facade.getGames(e,t);getGameById=async(e,t)=>await this.facade.getGameById(e,t);makePrediction=async(e,t)=>await this.facade.makePrediction(e,t);updatePrediction=async(e,t,a)=>await this.facade.updatePrediction(e,t,a);getGamePredictionsForUser=async(e,t,a,i)=>await this.facade.getGamePredictionsForUser(e,t,a,i);getRankings=async(e,t,a)=>await this.facade.getRankings(e,t,a)},Sp=Object.keys(new Xt),Cp=new Map().set("minutesPlayed","Minutes Played").set("cleanSheets","Clean Sheets").set("concededGoals","Goals Conceded").set("saves","Saves").set("penaltySaved","Penalties Saved").set("penaltyCommitted","Penalties Committed").set("yellowCards","Yellow Cards").set("redCards","Red Cards").set("assists","Assists").set("foulsCommitted","Fouls Committed").set("ownGoals","Own Goals").set("goals","Goals").set("tackles","Tackles").set("shotsOn","Shots On Target").set("penaltyGoals","Penalty Goals").set("penaltyWon","Penalty Won").set("penaltyMissed","Penalty Missed").set("penaltySaved","Penalty Saved").set("penaltyReceived","Penalty Received").set("shots","Shots").set("shotsBlocked","Shots Blocked").set("offsides","Offsides").set("foulsWon","Fouls Won").set("tacklesBlocks","Tackles Blocks").set("tacklesInterceptions","Tackles Interceptions").set("caughtBall","Caught Ball").set("passes","Passes").set("crosses","Crosses").set("interceptions","Interceptions").set("keyPasses","Key Passes").set("passesAccuracy","Passes Accuracy").set("duels","Duels").set("duelsWon","Duels Won").set("dribblesAttempts","Dribbles Attempts").set("dribblesSuccess","Dribbles Success").set("dribblesPast","Dribbles Past"),kt=class{static createFantasyPrediction(e,t,a,i){let s=new Ai;return s.template_id=e||null,s.group_id=t||null,s.fixtures=a?.map(r=>({player_id:r,match_type:"FOOTBALL",market:"PLAYER_PERFORMANCE",role:i?.get(r)?.toLocaleUpperCase()||null}))||[],s}static createFantasyPlayerStats(e){return Sp.map(t=>{let a=new No,i=e.data.reduce((s,r)=>s+r.stats[t],0);return a.key=t,a.label=Cp.get(t),a.value=i,a})}},Mp=class{idMapping=null;idSchema=null;errorHandlingModel=null;football=null;constructor(e){this.idSchema=e.idSchema,this.errorHandlingModel=e.errorHandlingMode,this.football=new xe(e),this.idMapping=new te(e)}remapCompetitions=async e=>{let t={competition:e};return(await this.idMapping.idMappingFacade.getEntitiesByIds(t,"native",this.idSchema)).competition};remapPlayers=async(e,t,a,i)=>{let s={player:Array.from(e)},r=await this.idMapping.idMappingFacade.getEntitiesByIdsMap(s,t,a);if(i){let n=new Map;for(let[o,l]of Array.from(i.entries())){let c=r.get(o);c&&n.set(c,l)}i.clear();for(let[o,l]of Array.from(n.entries()))i.set(o,l)}return Array.from(r.values())};addPlayerModels=async e=>{let t=e.map(i=>i.playerId),a=await this.football.footballFacade.getPlayersMapWithNativeIds(t);return e.forEach(i=>{i.playerModel=Object.keys(a).length&&a[i.playerId]||null,i.playerId=i.playerModel?.id||i.playerId}),e};remapPlayerIdToNative=async e=>{let t=await this.idMapping.getEntityIdBySchemaId("player",e);if(t)return t.id;this.throwException(404,"id_mapping_not_found","No ID mappings are available for the provided ID. ID argument: "+e)};addMatchModels=async e=>{let t=e.map(i=>i.matchId),a=await this.football.footballFacade.getMatchesMapWithNativeIds(t);return e.forEach(i=>{i.matchModel=Object.keys(a).length&&a[i.matchId]||null,i.matchId=i.matchModel?.id||i.matchId}),e};throwException=(e,t,a)=>{throw this.errorHandlingModel==="standard"?new O(e,t,a):new x(e,t,a)}},Op=class{idSchema=null;clientHttps=null;footballHttps=null;predictorHttps=null;loyaltyHttps=null;service=null;constructor(e){this.idSchema=e.idSchema,this.clientHttps=new _e(e),this.footballHttps=new Ke(e),this.service=new Mp(e),this.predictorHttps=new Ze(e),this.loyaltyHttps=new Rt(e)}getConfig=async()=>{let e=await this.clientHttps.getConfig("fantasy");return this.idSchema!=="native"&&(e.competitionsWhitelist=await this.service.remapCompetitions([...e.competitionsWhitelist])),e};getPlayersPoints=async(e,t,a)=>{let i=await this.footballHttps.getPlayersPoints(e,t,a);return i.data=await this.service.addPlayerModels(i.data),i};getPlayerDetailedStatistics=async(e,t,a)=>{let i="";this.idSchema!=="native"&&(i=await this.service.remapPlayerIdToNative(t));let s=await this.footballHttps.getPlayerDetailedStatistics(e,i||t,a);return s.meta.filters.playerId=t,s.data=await this.service.addMatchModels(s.data),s};play=async(e,t,a,i)=>{if((!a||!Array.isArray(a))&&this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: playerIds"),i){let r="playersRoles";i instanceof Map||this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+r);let n=Array.from(i.keys());n.length||this.service.throwException(400,"invalid_method_call","Invalid parameter provided. Please check the following parameter: "+r),n.every(c=>!a.includes(c))&&this.service.throwException(400,"invalid_method_call","The keys in the players roles map are not part of the valid keys. The valid keys are: "+a.join(","));let o=Array.from(i.values()),l=["CAPTAIN","VICE_CAPTAIN"];o.every(c=>l.includes(c.toLocaleUpperCase()))||this.service.throwException(400,"invalid_method_call","The values in the map are not valid. The valid ones are: "+l.join(",")+". Case insensitive.")}let s=null;if(this.idSchema!=="native"){let r=await this.service.remapPlayers(a,this.idSchema,"native",i);s=kt.createFantasyPrediction(e,t,r,i)}else s=kt.createFantasyPrediction(e,t,a,i);return await this.predictorHttps.makeFootballPrediction(s)};getMyPrediction=async(e,t)=>{let a=`${e}_${t}`,i=new Q(null);i.gameIds=[a];let s=await this.predictorHttps.getMyPredictions(i);return s.data.length===0?null:s.data[0]};getPlayerStatistics=async(e,t,a)=>{let i=await this.getPlayerDetailedStatistics(e,t,a);return kt.createFantasyPlayerStats(i)};getGameWeekStatistics=async e=>await this.loyaltyHttps.getTemplateBreakdownPoints(e)},Fp=class{facade=null;constructor(e){this.facade=new Op(e)}getConfig=async()=>await this.facade.getConfig();getPlayersPoints=async(e,t,a)=>await this.facade.getPlayersPoints(e,t,a);getPlayerDetailedStatistics=async(e,t,a)=>await this.facade.getPlayerDetailedStatistics(e,t,a);play=async(e,t,a,i)=>await this.facade.play(e,t,a,i);getMyPrediction=async(e,t)=>await this.facade.getMyPrediction(e,t);getPlayerStatistics=async(e,t,a)=>await this.facade.getPlayerStatistics(e,t,a);getGameWeekStatistics=async e=>await this.facade.getGameWeekStatistics(e)},Ap=class{configuration;constructor(e){this.configuration=e}getSDKConfiguration(){return this.configuration}},kp=class{remapToResponseModel=(e,t,a)=>{let i=new cl;return i.meta.input=t,i.meta.output=a,e.size===0||(i.data=Array.from(e).map(([s,r])=>({input:s,output:r}))),i}},Dp=class{errorHandlingModel=null;constructor(e){this.errorHandlingModel=e.errorHandlingMode}validate=(e,t,a)=>{(!e||!Array.isArray(e)||e.length===0)&&this.throwException(400,"invalid_ids","Invalid or empty IDs provided. Please provide at least one ID."),(!t||t!=="native"&&t!=="enetpulse"&&t!=="sportal365"&&t!=="sportradar"&&t!=="api_football")&&this.throwException(400,"invalid_input_provider","Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'."),(!a||a!=="native"&&a!=="enetpulse"&&a!=="sportal365"&&a!=="sportradar"&&a!=="api_football")&&this.throwException(400,"invalid_output_provider","Invalid provider. The valid providers are: 'native', 'enetpulse', 'sportal365', 'sportradar' and 'api_football'."),t===a&&this.throwException(400,"invalid_output_provider","Invalid output provider. The output can not be the same as the input provider.")};throwException=(e,t,a)=>{throw this.errorHandlingModel==="standard"?new O(e,t,a):new x(e,t,a)}},Lp=class{validator=null;idMappingFacade=null;factory=new kp;constructor(e){this.validator=new Dp(e),this.idMappingFacade=new si(e)}getMappedFootballCountryIds=async(e,t,a)=>{this.validator.validate(e,t,a);let i={country:Array.from(e)},s=await this.idMappingFacade.getEntitiesByIdsMap(i,t,a);return this.factory.remapToResponseModel(s,t,a)};getMappedFootballCompetitionIds=async(e,t,a)=>{this.validator.validate(e,t,a);let i={competition:Array.from(e)},s=await this.idMappingFacade.getEntitiesByIdsMap(i,t,a);return this.factory.remapToResponseModel(s,t,a)};getMappedFootballTeamIds=async(e,t,a)=>{this.validator.validate(e,t,a);let i={team:Array.from(e)},s=await this.idMappingFacade.getEntitiesByIdsMap(i,t,a);return this.factory.remapToResponseModel(s,t,a)};getMappedFootballPlayerIds=async(e,t,a)=>{this.validator.validate(e,t,a);let i={player:Array.from(e)},s=await this.idMappingFacade.getEntitiesByIdsMap(i,t,a);return this.factory.remapToResponseModel(s,t,a)};getFootballMappedMatchIds=async(e,t,a)=>{this.validator.validate(e,t,a);let i={match:Array.from(e)},s=await this.idMappingFacade.getEntitiesByIdsMap(i,t,a);return this.factory.remapToResponseModel(s,t,a)}},xp=class{facade=null;constructor(e){this.facade=new Lp(e)}getMappedFootballCountryIds=async(e,t,a)=>await this.facade.getMappedFootballCountryIds(e,t,a);getMappedFootballCompetitionIds=async(e,t,a)=>await this.facade.getMappedFootballCompetitionIds(e,t,a);getMappedFootballTeamIds=async(e,t,a)=>await this.facade.getMappedFootballTeamIds(e,t,a);getMappedFootballPlayerIds=async(e,t,a)=>await this.facade.getMappedFootballPlayerIds(e,t,a);getMappedFootballMatchIds=async(e,t,a)=>await this.facade.getFootballMappedMatchIds(e,t,a)},Np=class{findLastGame=e=>{if(!Array.isArray(e)||e.length===0)return null;let t=e.filter(s=>s.status==="SETTLED").sort((s,r)=>new Date(r.predictionsCutoff).getTime()-new Date(s.predictionsCutoff).getTime());if(t.length>0)return t[0];let a=new Date,i=e.filter(s=>new Date(s.predictionsCutoff)<a).sort((s,r)=>new Date(r.predictionsCutoff).getTime()-new Date(s.predictionsCutoff).getTime());return i.length>0?i[0]:null};findNextGame=e=>{if(!Array.isArray(e)||e.length===0)return null;let t=this.findCurrentGame(e);if(!t)return null;let a=[...e].sort((s,r)=>new Date(s.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime()),i=new Date(t.predictionsCutoff).getTime();return a.find(s=>new Date(s.predictionsCutoff).getTime()>i)||null};findCurrentGame=e=>{if(!Array.isArray(e)||e.length===0)return null;let t=e.find(s=>s.status==="LIVE");if(t)return t;let a=e.find(s=>s.status==="OPEN");if(a)return a;let i=new Date;return e.filter(s=>new Date(s.predictionsCutoff)>i).sort((s,r)=>new Date(s.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime())[0]||null}},vs=class{matchQuizFacade=null;helpers=new Np;constructor(e){this.matchQuizFacade=new ra(e)}getConfig=async()=>await this.matchQuizFacade.getConfig();play=async e=>await this.matchQuizFacade.play(e);delete=async e=>await this.matchQuizFacade.delete(e);getGames=async(e,t)=>await this.matchQuizFacade.getGames(e,t);getGameById=async(e,t)=>await this.matchQuizFacade.getGameById(e,t);getGamePredictions=async(e,t,a)=>await this.matchQuizFacade.getGamePredictions(e,t,a);getGameResults=async(e,t,a)=>await this.matchQuizFacade.getGameResults(e,t,a);getCurrentGameResults=async e=>await this.matchQuizFacade.getCurrentGameResults(e);getMyGameEditions=async(e,t)=>await this.matchQuizFacade.getMyGameEditions(e,t);getMyGamePrediction=async e=>await this.matchQuizFacade.getMyGamePrediction(e);getUserGameEditions=async(e,t,a)=>await this.matchQuizFacade.getUserGameEditions(e,t,a);getUserGamePrediction=async(e,t,a)=>await this.matchQuizFacade.getUserGamePrediction(e,t,a);getMarketsResultsForGame=async(e,t)=>await this.matchQuizFacade.getMarketsResultsForGame(e,t);getGameWinners=async(e,t)=>await this.matchQuizFacade.getGameWinners(e,t)},Gp=class{findLastGame=e=>{if(!Array.isArray(e)||e.length===0)return null;let t=e.filter(s=>s.status==="SETTLED").sort((s,r)=>new Date(r.predictionsCutoff).getTime()-new Date(s.predictionsCutoff).getTime());if(t.length>0)return t[0];let a=new Date,i=e.filter(s=>new Date(s.predictionsCutoff)<a).sort((s,r)=>new Date(r.predictionsCutoff).getTime()-new Date(s.predictionsCutoff).getTime());return i.length>0?i[0]:null};findNextGame=e=>{if(!Array.isArray(e)||e.length===0)return null;let t=this.findCurrentGame(e);if(!t)return null;let a=[...e].sort((s,r)=>new Date(s.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime()),i=new Date(t.predictionsCutoff).getTime();return a.find(s=>new Date(s.predictionsCutoff).getTime()>i)||null};findCurrentGame=e=>{if(!Array.isArray(e)||e.length===0)return null;let t=e.find(s=>s.status==="LIVE");if(t)return t;let a=e.find(s=>s.status==="OPEN");if(a)return a;let i=new Date;return e.filter(s=>new Date(s.predictionsCutoff)>i).sort((s,r)=>new Date(s.predictionsCutoff).getTime()-new Date(r.predictionsCutoff).getTime())[0]||null}},Is=class{topXFacade=null;helpers=new Gp;constructor(e){this.topXFacade=new la(e)}getConfig=async()=>await this.topXFacade.getConfig();getGames=async(e,t)=>await this.topXFacade.getGames(e,t);getGameById=async(e,t)=>await this.topXFacade.getGameById(e,t);getGamePredictions=async(e,t,a)=>await this.topXFacade.getGamePredictions(e,t,a);getGameResults=async(e,t,a)=>await this.topXFacade.getGameResults(e,t,a);getCurrentGameResults=async e=>await this.topXFacade.getCurrentGameResults(e);play=async e=>await this.topXFacade.play(e);delete=async e=>await this.topXFacade.delete(e);getMyGameEditions=async(e,t)=>await this.topXFacade.getMyGameEditions(e,t);getMyGamePrediction=async e=>await this.topXFacade.getMyGamePrediction(e);getUserGameEditions=async(e,t,a)=>await this.topXFacade.getUserGameEditions(e,t,a);getUserGamePrediction=async(e,t,a)=>await this.topXFacade.getUserGamePrediction(e,t,a);getMarketsResultsForGame=async(e,t)=>await this.topXFacade.getMarketsResultsForGame(e,t);getGameWinners=async(e,t)=>await this.topXFacade.getGameWinners(e,t)},$p=class{remapUserVotes=e=>{let t=new md;return t.meta=this.remapMeta(e.meta.pagination),t.data=e.data.map(a=>this.remapUserVoteModel(a)),t};remapResults=e=>{let t=new yd;return t.meta=e.meta,t.data=e.data.map(a=>this.remapResultsModel(a)),t};remapMeta=e=>{let t=new V;return t.pagination.itemsPerPage=e.items_per_page,t.pagination.nextPageStartsAfter=e.next_page_starts_after,t};remapUserVoteModel=e=>{let t=new gd;return t.matchId=e.match_id,t.playerId=e.player_id,t.createdAt=e.created_at,t};remapResultsModel=e=>{let t=new wd;return t.teamId=e.team_id,t.playerId=e.player_id,t.votes=e.votes,t.winner=e.winner,t}},Up=class{id=null;pollId=null;optionIds=[];optionsModels=[];userId=null;createdAt=null},Bp=class extends pe{remapPolls=e=>{let t=new pd;return t.meta.pagination=this.remapMetaPagination(e.meta.pagination),t.data=e.data.map(a=>this.remapPoll(a)),t};remapPollById=e=>{let t=new od;t.id=e.id,t.title=e.title,t.alternativeTitle=e.alternative_title,t.description=e.description,t.type=e.type,t.images=e.images,t.status=e.status,t.language=e.language,t.authRequirement=e.auth_requirement,t.flags=e.flags,t.totalVotes=e.total_votes,t.customFields=e.custom_fields,t.related=e.related?this.remapRelated(e.related):[];let a=this.remapBrandingWithId(e);return t.branding=a.branding,t.brandingId=a.brandingId,t.embedCode=e.embed_code,t.labels=e.labels,t.rules=e.rules,t.adContent=e.ad_content,t.options=e.options?this.remapOptions(e.options):[],t.context=e.context?this.remapContext(e.context):e.context,t.preferencesEnabled=e.preferences_enabled,t.multipleChoice=e.multiple_choice,t.maxMultipleChoiceOptions=e.max_multiple_choice_options,t.participationCount=e.participation_count,t.maxAttempts=e.max_attempts,t.externalActivity=e.external_activity,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapUserVote=e=>{let t=new dd;return t.id=e.id,t.pollId=e.poll_id,t.optionId=e.option_id,t.optionIds=e.option_ids,t.userId=e.user_id,t.attempts=e.attempts||null,t.previousVotes=e.previous_votes?e.previous_votes.map(a=>this.remapPreviousVotes(a)):[],t.createdAt=e.created_at,t};remapPreviousVotes=e=>{let t=new Up;return t.id=e.id,t.pollId=e.poll_id,t.optionIds=e.option_ids,t.userId=e.user_id,t.createdAt=e.created_at,t};remapPollsVotes=e=>{let t=new ud;return t.meta.pagination=this.remapMetaPagination(e.meta.pagination),t.data=e.data.map(a=>this.remapAllPollsVotes(a)),t};remapAllPollsVotes=e=>{let t=new ta;return t.id=e.id,t.pollId=e.poll_id,t.optionId=e.option_id,t.optionIds=e.option_ids,t.userId=e.user_id,t.createdAt=e.created_at,t};remapSinglePollVote=e=>{let t=new cd;return t.id=e.id,t.pollId=e.poll_id,t.optionId=e.option_id,t.optionIds=e.option_ids,t.userId=e.user_id,t.attempts=e.attempts||null,t.createdAt=e.created_at,t.previousVotes=e.previous_votes?e.previous_votes.map(a=>this.remapPreviousVotes(a)):[],t};remapMetaPagination=e=>{let t=new Ye;return t.itemsPerPage=e.items_per_page,t.nextPageStartsAfter=e.next_page_starts_after,t};remapPoll=e=>{let t=new ss;t.id=e.id,t.title=e.title,t.alternativeTitle=e.alternative_title,t.description=e.description,t.type=e.type,t.images=e.images,t.status=e.status,t.language=e.language,t.authRequirement=e.auth_requirement,t.flags=e.flags,t.totalVotes=e.total_votes,t.customFields=e.custom_fields,t.related=e.related?this.remapRelated(e.related):[];let a=this.remapBrandingWithId(e);return t.branding=a.branding,t.brandingId=a.brandingId,t.embedCode=e.embed_code,t.labels=e.labels,t.adContent=e.ad_content,t.options=e.options?this.remapOptions(e.options):[],t.context=e.context?this.remapContext(e.context):e.context,t.preferencesEnabled=e.preferences_enabled,t.multipleChoice=e.multiple_choice,t.maxMultipleChoiceOptions=e.max_multiple_choice_options,t.participationCount=e.participation_count,t.maxAttempts=e.max_attempts,t.externalActivity=e.external_activity,t.createdAt=e.created_at,t.updatedAt=e.updated_at,t};remapContext=e=>{let t=new qt;return t.content=e.content,t.tags=e.tags?e.tags.map(a=>{let i=new ro;return i.id=a.id,i.type=a.type,i.source=a.source,i}):null,t.campaign=e.campaign,t};remapRelated=e=>e.map(t=>{let a=new we;return a.entityId=t.entity_id,a.entityType=t.entity_type,a.entityRelationship=t.entity_relationship,a});remapOptions=e=>e.map(t=>{let a=new ld;return a.id=t.id,a.title=t.title,a.description=t.description,a.images=t.images,a.votes=t.votes,a.embedCode=t.embed_code,a.preferencesMapping=t.preferences_mapping?this.remapPreferencesMapping(t.preferences_mapping):[],a});remapPreferencesMapping=e=>e.map(t=>{let a=new rs;return a.preferenceId=t.preference_id,a})},Hp=class extends se{pollRemapper=null;playerOfTheMatchRemapper=null;constructor(e){super(e,ee(e.environment,"voting")),this.pollRemapper=new Bp,this.playerOfTheMatchRemapper=new $p}getPolls=async(e,t)=>{let a=`/polls${this.apiSignInUrl}`;e&&(a+=e.constructMainFiltersUrl()),S(t)&&(a+=E());let i="There was a problem fetching polls",s=await this.fetchWithoutAuth(a,i);return this.pollRemapper.remapPolls(s)};getPollById=async(e,t)=>{let a=`/polls/${e}${this.apiSignInUrl}`;S(t)&&(a+=E());let i="There was a problem fetching the following poll: "+e,s=await this.fetchWithoutAuth(a,i);return this.pollRemapper.remapPollById(s.data)};voteForPoll=async(e,t)=>{let a=`/polls/${e}/votes${this.apiSignInUrl}`,i="PUT",s={option_ids:t},r="There was a problem voting for the following poll: "+e,n=await this.fetchWithAuth(a,r,i,s);return this.pollRemapper.remapUserVote(n.data)};deleteVoteForPoll=async e=>{let t=`/polls/${e}/votes${this.apiSignInUrl}`,a="DELETE",i="There was a problem deleting vote for the following poll: "+e;return await this.fetchWithAuth(t,i,a),!0};getMyPollVote=async e=>{let t=`/polls/${e}/votes${this.apiSignInUrl}`,a="There was a problem fetching user's own vote for the following poll: "+e,i=await this.fetchWithAuth(t,a);return this.pollRemapper.remapSinglePollVote(i.data)};getMyPollsVotes=async e=>{let t=`/polls/votes${this.apiSignInUrl}`;e&&(t+=e.constructMainFiltersUrl());let a="There was a problem fetching user's votes for polls",i=await this.fetchWithAuth(t,a);return this.pollRemapper.remapPollsVotes(i)};voteForPlayerOfTheMatch=async(e,t)=>{let a=`/football/potm/${e}${this.apiSignInUrl}`,i="PUT",s={player_id:t};return{playerId:(await this.fetchWithAuth(a,"There was a problem voting for 'Player of the match'",i,s)).data.player_id}};deleteVoteForPlayerOfTheMatch=async e=>{let t=`/football/potm/${e}${this.apiSignInUrl}`;await this.fetchWithAuth(t,"There was a problem with deleting vote for 'Player of the match'","DELETE")};getOwnVotesForPlayerOfTheMatch=async e=>{let t=`/football/potm${this.apiSignInUrl}`;e&&(t+=e.constructFiltersUrl());let a="There was a problem fetching user's own votes for 'Player of the match'",i=await this.fetchWithAuth(t,a);return this.playerOfTheMatchRemapper.remapUserVotes(i)};getResultsForPlayerOfTheMatch=async(e,t)=>{let a=`/football/potm/${e}${this.apiSignInUrl}${S(t)?E():""}`,i="There was a problem fetching results for 'Player of the match'",s=await this.fetchWithoutAuth(a,i);return this.playerOfTheMatchRemapper.remapResults(s)}},Vp=class{idMappingService=null;idSchema=null;errorHandlingMode=null;validator=null;activityService=null;football=null;constructor(e){this.idSchema=e.idSchema,this.errorHandlingMode=e.errorHandlingMode,this.idMappingService=new te(e),this.validator=new na(e),this.activityService=new It(e),this.football=new xe(e)}finalizePollsFilters=async e=>{if(this.idSchema!=="native"&&e.entityIds&&e.entityIds.length>0){this.validator.validateFilters(e);let t=await this.idMappingService.getEntityIdsBySchemaId(Array.from(e.entityIds),e.entityType,"native");e.entityIds=t[e.entityType]}};remapTags=async(e,t,a)=>{if(this.idSchema!="native"&&e.context&&e.context.tags&&e.context.tags.length){let i=JSON.parse(JSON.stringify(e.context.tags)),s=await this.activityService.remapTagsIds(i,t,a);e.context.tags=s}};remapMatchAndPlayerIds=async(e,t,a,i)=>{let s={match:[e],player:[t]},r=await this.idMappingService.idMappingFacade.getEntitiesByIds(s,a,i);if(r.match.length>0&&r.player.length>0){let n=r.match[0],o=r.player[0];return[n,o]}throw this.errorHandlingMode==="default"?new x(404,"entity_ids_not_found","Some of the sport entity IDs were not found for the provided id schema"):new O(404,"entity_ids_not_found","Some of the sport entity IDs were not found for the provided id schema")};remapMatchIds=async(e,t,a)=>{let i=Array.from(e),s={match:e},r=await this.idMappingService.idMappingFacade.getEntitiesByIds(s,t,a);if(r.match.length>0&&r.match.length===i.length)return r.match;throw this.errorHandlingMode==="default"?new x(404,"match_ids_not_found","Some of the match IDs were not found for the provided id schema"):new O(404,"match_ids_not_found","Some of the match IDs were not found for the provided id schema")};setModelsForUserVotes=async e=>{let t=e.data.map(i=>i.matchId),a=e.data.map(i=>i.playerId);if(t.length>0&&a.length>0){let i=await this.football.footballFacade.getMatchesMapWithNativeIds(t),s=await this.football.footballFacade.getPlayersMapWithNativeIds(a);e.data.forEach(r=>{r.matchModel=i[r.matchId]||null,r.playerModel=s[r.playerId]||null,r.matchId=r.matchModel?r.matchModel.id:r.matchId,r.playerId=r.playerModel?r.playerModel.id:r.playerId}),e.meta.pagination.nextPageStartsAfter&&(e.meta.pagination.nextPageStartsAfter=e.data[e.data.length-1].matchId)}return e};setModelsForPotmResults=async e=>{let t=e.map(i=>i.teamId),a=e.map(i=>i.playerId);if(t.length>0&&a.length>0){let i=await this.football.footballFacade.getTeamsMapWithNativeIds(t),s=await this.football.footballFacade.getPlayersMapWithNativeIds(a);e.forEach(r=>{r.teamModel=i.get(r.teamId)||null,r.playerModel=s[r.playerId]||null,r.teamId=r.teamModel?r.teamModel.id:r.teamId,r.playerId=r.playerModel?r.playerModel.id:r.playerId})}}},Wp=class{https=null;service=null;idSchema=null;brandingResolver=null;constructor(e){this.idSchema=e.idSchema,this.https=new Hp(e),this.service=new Vp(e),this.brandingResolver=new ye(e)}getPolls=async(e,t)=>{e&&(e=new At(e),await this.service.finalizePollsFilters(e));let a=await this.https.getPolls(e,t),i=await this.brandingResolver.resolveBrandingBatch([...a.data],t);for(let s of i)await this.service.remapTags(s,"native",this.idSchema);return a.data=i,a};getPollById=async(e,t)=>{let a=await this.https.getPollById(e,t),i=await this.brandingResolver.resolveBranding(a,t);return await this.service.remapTags(i,"native",this.idSchema),i};voteForPoll=async(e,t)=>(typeof t=="string"&&(console.warn("Passing a single optionId as a string will be deprecated. Please pass it as an array."),t=[t]),await this.https.voteForPoll(e,t));deleteVoteForPoll=async e=>await this.https.deleteVoteForPoll(e);getMyPollVote=async(e,t)=>{let a=await this.https.getMyPollVote(e);if(t){let i=await this.getPolls(new At({pollIds:[e]}),!0);a.pollModel=i.data.find(s=>s.id===e)||null,a.optionModel=i.data.find(s=>s.id===e)?.options.find(s=>s.id===a.optionId)||null,a.optionsModels=a.optionIds?i.data.find(s=>s.id===e)?.options.filter(s=>a.optionIds.includes(s.id))||[]:[],a.previousVotes.forEach(s=>{s.optionsModels=i.data.find(r=>r.id===s.pollId)?.options.filter(r=>s.optionIds.includes(r.id))||[]})}return a};getMyPollsVotes=async e=>{e&&(e=new B(e));let t=await this.https.getMyPollsVotes(e),a=t.data.map(s=>s.id),i=await this.getPolls(new At({pollIds:a}),!0);return t.data=t.data.map(s=>(s.pollModel=i.data.find(r=>r.id===s.pollId)||null,s.optionModel=s.pollModel?.options.find(r=>r.id===s.optionId)||null,s.optionsModels=s.optionIds?s.pollModel?.options.filter(r=>s.optionIds.includes(r.id))||[]:[],s)),t};voteForPlayerOfTheMatch=async(e,t)=>{if(this.idSchema!=="native"){let[a,i]=await this.service.remapMatchAndPlayerIds(e,t,this.idSchema,"native");return await this.https.voteForPlayerOfTheMatch(a,i),{playerId:t}}return await this.https.voteForPlayerOfTheMatch(e,t)};deleteVoteForPlayerOfTheMatch=async e=>{if(this.idSchema!=="native"){let t=await this.service.remapMatchIds([e],this.idSchema,"native");return await this.https.deleteVoteForPlayerOfTheMatch(t[0]),!0}return await this.https.deleteVoteForPlayerOfTheMatch(e),!0};getOwnVotesForPlayerOfTheMatch=async e=>{if(e&&(e=new hd(e)),e&&e.matchIds&&e.matchIds.length>0&&this.idSchema!=="native"){let a=await this.service.remapMatchIds(e.matchIds,this.idSchema,"native");e.matchIds=a}let t=await this.https.getOwnVotesForPlayerOfTheMatch(e);return await this.service.setModelsForUserVotes(t)};getResultsForPlayerOfTheMatch=async(e,t)=>{if(this.idSchema!=="native"){let i=await this.service.remapMatchIds([e],this.idSchema,"native"),s=await this.https.getResultsForPlayerOfTheMatch(i[0],t);return await this.service.setModelsForPotmResults(s.data),s}let a=await this.https.getResultsForPlayerOfTheMatch(e,t);return await this.service.setModelsForPotmResults(a.data),a}},Ts=class{facade=null;constructor(e){this.facade=new Wp(e)}getPolls=async(e,t)=>await this.facade.getPolls(e,t);getPollById=async(e,t)=>await this.facade.getPollById(e,t);voteForPoll=async(e,t)=>await this.facade.voteForPoll(e,t);deleteVoteForPoll=async e=>await this.facade.deleteVoteForPoll(e);getMyPollVote=async(e,t)=>await this.facade.getMyPollVote(e,t);getMyPollsVotes=async e=>await this.facade.getMyPollsVotes(e);voteForPlayerOfTheMatch=async(e,t)=>await this.facade.voteForPlayerOfTheMatch(e,t);deleteVoteForPlayerOfTheMatch=async e=>await this.facade.deleteVoteForPlayerOfTheMatch(e);getOwnVotesForPlayerOfTheMatch=async e=>await this.facade.getOwnVotesForPlayerOfTheMatch(e);getResultsForPlayerOfTheMatch=async(e,t)=>await this.facade.getResultsForPlayerOfTheMatch(e,t)},zp=class{clientHttps=null;topX=null;matchQuiz=null;loyalty=null;miniGames=null;voting=null;constructor(e){this.clientHttps=new _e(e),this.topX=new Is(e),this.matchQuiz=new vs(e),this.loyalty=new ca(e),this.miniGames=new oa(e),this.voting=new Ts(e)}getListContent=async(e,t,a)=>{t&&(t=new dl(t));let i=await this.clientHttps.getListContent(e,t,a);return await this.setModels(i.data,a),i};setModels=async(e,t)=>{let a=[],i=new Map;e.forEach(s=>{if(i.has(s.entityType)){let r=i.get(s.entityType);i.set(s.entityType,[...r,s.entityId])}else i.set(s.entityType,[s.entityId])});try{for(let[s,r]of Array.from(i.entries()))switch(s){case"TOP_X":let n=await this.topX.getGames({limit:r.length,gameIds:r},t);a=[...a,...n.data];break;case"MATCH_QUIZ":let o=await this.matchQuiz.getGames({limit:r.length,gameIds:r},t);a=[...a,...o.data];break;case"LEADERBOARD_TEMPLATES":let l=await this.loyalty.getTemplates(void 0,t);a=[...a,...l.data.filter(u=>r.includes(u.id))];break;case"CLASSIC_QUIZ":let c=await this.miniGames.getClassicQuizzes({limit:r.length,classicQuizIds:r},!1,t);a=[...a,...c.data];break;case"EITHER_OR":let d=await this.miniGames.getEitherOrs({limit:r.length,eitherOrIds:r},!1,t);a=[...a,...d.data];break;case"POLL":let p=await this.voting.getPolls({limit:r.length,pollIds:r},t);a=[...a,...p.data];break;case"PERSONALITY_QUIZ":let m=await this.miniGames.getPersonalityQuizzes({limit:r.length,personalityQuizIds:r},t);a=[...a,...m.data];break;default:}}catch(s){throw console.error("An error occurred while trying to set models for list content entities",s),s}e.forEach(s=>{let r=a.find(n=>n.id===s.entityId)||null;s.entityModel=r})}},qp=class{facade=null;constructor(e){this.facade=new zp(e)}getListContent=async(e,t,a)=>await this.facade.getListContent(e,t,a)},jp=class{fromResponse(e,t){let a=new Map;return e.matches.forEach(i=>{let s=i.odds.map(r=>{let n=new Pc;return n.bookmaker=r.bookmaker?this.remapBookmaker(r.bookmaker):null,n.type=r.type,n.markets=r.markets?this.remapMarkets(r.markets,t):[],n});a.set(i.id,s)}),a}remapBookmaker(e){let t=new hc;return t.id=e.id,t.name=e.name,t.assets=e.assets?this.remapAssets(e.assets):[],t.links=e.links||[],t.branding=e.branding?this.remapBranding(e.branding):null,t.eventUrls=e.event_urls?this.remapEventUrls(e.event_urls):[],t.stakesDisclaimer=e.stakes_disclaimer,t.domainName=e.domain_name,t}remapMarkets(e,t){return e.map(a=>{let i=new _c;return i.type=a.type?this.remapMarketType(a.type):null,i.scope=a.scope?this.remapMarketScope(a.scope):null,i.selections=a.selections?this.remapMarketSelections(a.selections,i.type.code,t):[],i})}remapEventUrls(e){return e.map(t=>{let a=new fc;return a.url=t.url,a.appType=t.app_type,a})}remapBranding(e){let t=new mc;return t.backgroundColor=e.background_color,t.textColor=e.text_color,t}remapAssets(e){return e.map(t=>{let a=new gc;return a.logo=t.logo,a.type=t.type,a.transparentBackgroundUrl=t.transparent_background_url,a.backgroundColor=t.background_color,a})}remapMarketType=e=>{let t=new Tc;return t.id=e.id,t.name=e.name,t.code=e.code,t.entityType=e.entity_type,t};remapMarketScope=e=>{let t=new vc;return t.id=e.id,t.name=e.name,t.type=e.type,t.entityType=e.entity_type,t};remapMarketSelections=(e,t,a)=>{let i=Array.from(e);return a.length>0&&t==="OVER_UNDER"&&(i=i.filter(s=>s.code==="over"?a.some(r=>{switch(r){case"OVER_GOALS_0_5":return s.value==="0.5";case"OVER_GOALS_1_5":return s.value==="1.5";case"OVER_GOALS_2_5":return s.value==="2.5";case"OVER_GOALS_3_5":return s.value==="3.5";case"OVER_GOALS_4_5":return s.value==="4.5";case"OVER_GOALS_5_5":return s.value==="5.5";default:return!1}}):!1)),i.map(s=>{let r=new Ic;return r.id=s.id,r.name=s.name,r.code=s.code,r.value=s.value,r.odds=s.odds,r.urls=s.urls?this.remapEventUrls(s.urls):[],r.movement=s.movement,r.oddsOld=s.odds_old,r.entityType=s.entity_type,r.additionalInfo=s.additional_info,r.providerInfo=s.provider_info?this.remapProviderInfo(s.provider_info):null,r})};remapProviderInfo=e=>{let t=new bc;return t.selectionId=e.selection_id,t.eventId=e.event_id,t.marketId=e.market_id,t.competitionId=e.competition_id,t}},Qp=class{footballBaseUrl="https://football.api.sportal365.com/";retryRequest=!1;oddClient=null;remapper=null;constructor(e){this.oddClient=e.oddClient,this.remapper=new jp}getMatchOdds=async(e,t)=>{let a=`v2/matches/livescore?odd_client=${this.oddClient.name}&match_ids=${e.join(",")}${t.constructFiltersUrl()}`,i=`Error while fetching match odds for matchIds: ${e.join(",")}`,s=await this.fetchWithAuth(a,i),r=t.marketTypes&&t.marketTypes.length>0?t.marketTypes.filter(n=>n.includes("OVER")):[];return this.remapper.fromResponse(s,r)};getAuthHeaders=()=>({"Content-Type":"application/json",Authorization:`Basic ${typeof window<"u"?window.btoa(`${this.oddClient.credentials.username}:${this.oddClient.credentials.password}`):Buffer.from(`${this.oddClient.credentials.username}:${this.oddClient.credentials.password}`).toString("base64")}`});fetchWithAuth=async(e,t)=>{let a=await fetch(this.footballBaseUrl+e,{headers:this.getAuthHeaders()}),i=await a.json();if(!a.ok)throw(a.status===401||a.status===403)&&!this.retryRequest&&(this.retryRequest=!0,await this.fetchWithAuth(e,t)),this.retryRequest=!1,console.warn(t,i),i;return this.retryRequest=!1,i}},Yp=class{https;idSchema;oddClient;idMapping=null;validator;constructor(e){this.idSchema=e.idSchema,this.oddClient=e.oddClient,this.https=new Qp(e),this.validator=new Ee(e.errorHandlingMode),this.idMapping=new te(e)}getByMatchIds=async(e,t)=>{this.validateOddClient(),(!e||!Array.isArray(e)||e.length===0)&&this.validator.throwException(400,"invalid_match_ids","Match IDs are invalid!");let a=Array.from(e);this.idSchema!=="sportal365"&&(a=(await this.idMapping.idMappingFacade.getEntitiesByIds({match:Array.from(e)},this.idSchema,"sportal365")).match);let i=new wc(t),s=await this.https.getMatchOdds(a,i);if(this.idSchema!=="sportal365"){let r=await this.idMapping.idMappingFacade.getEntitiesByIdsMap({match:Array.from(s.keys())},"sportal365",this.idSchema),n=new Map;return Array.from(s.entries()).forEach(([o,l])=>{n.set(r.get(o),l)}),n}return s};validateOddClient=()=>{this.oddClient||this.validator.throwException(412,"odd_client_configuration_not_found","Odds namespace requires oddClient configuration to be set")}},Xp=class{facade;constructor(e){this.facade=new Yp(e)}getByMatchIds=async(e,t)=>await this.facade.getByMatchIds(e,t)},Jp=class{factory=null;privateLeagueHttps=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(e){this.factory=new gs,this.privateLeagueHttps=new ms(e),this.loyaltyHttps=new Rt(e),this.profile=new le(e),this.service=new _s(e),this.discussionsService=new da(e)}create=async e=>{let t=this.factory.createRequestBodyFromParam(e,"PRIVATE"),a=await this.privateLeagueHttps.create(t,"PRIVATE_LEAGUE");return await this.service.setTemplateModels(a),a};getById=async(e,t)=>{let a=await this.privateLeagueHttps.getById(e,"PRIVATE_LEAGUE",t);return await this.service.setTemplateModels(a),a};getMyLeagues=async e=>{e=new qc(e);let t=await this.privateLeagueHttps.getMyLeagues(e,"PRIVATE_LEAGUE");return await this.service.setTemplateModelsInLeagues(t),t};update=async(e,t)=>{let a=this.factory.createUpdateRequestBodyFromParam(t,"PRIVATE"),i=await this.privateLeagueHttps.update(e,a,"PRIVATE_LEAGUE");return await this.service.setTemplateModels(i),i};updateTemplate=async(e,t,a)=>{let i=await this.privateLeagueHttps.updateLeagueTemplate(e,t,a,"PRIVATE_LEAGUE");return await this.service.setTemplateModels(i),i};delete=async e=>await this.privateLeagueHttps.delete(e,"PRIVATE_LEAGUE");invite=async(e,t)=>await this.privateLeagueHttps.invite(e,t);deleteInvitation=async(e,t)=>await this.privateLeagueHttps.deleteInvitation(e,t);accept=async e=>{let t=await this.privateLeagueHttps.accept(e,!0,"PRIVATE_LEAGUE");return await this.finalizeAcceptModel(t,!0)};reject=async e=>{let t=await this.privateLeagueHttps.accept(e,!1,"PRIVATE_LEAGUE");return await this.finalizeAcceptModel(t,!1)};banUsers=async(e,t)=>await this.privateLeagueHttps.ban(e,t);unbanUsers=async(e,t)=>await this.privateLeagueHttps.unban(e,t);join=async e=>{let t=await this.privateLeagueHttps.join(e);return await this.finalizeAcceptModel(t,!0)};leave=async e=>await this.privateLeagueHttps.leave(e,"PRIVATE_LEAGUE");finalizeAcceptModel=async(e,t)=>{if(t){let a=await this.getById(e.leagueId);e.leagueModel=a}return await this.service.setProfileModel(e),e};getMyLeaguesStandings=async e=>{e&&(e=new jc(e));let t=await this.profile.getOwn().getInfo(),a=await this.loyaltyHttps.getUserRankingsForPrivateLeagueAndChallenges(t.id,"PRIVATE_LEAGUE",e);for(let i of a.data){let s=await this.getById(i.privateLeagueId);i.privateLeagueModel=s}return this.service.setTemplateModelsFromLeagueModels(a.data,"PRIVATE_LEAGUE"),a};getInvitations=async e=>{e=new Zi(e),e.type="PRIVATE";let t=await this.privateLeagueHttps.getInvitations("PRIVATE_LEAGUE",e);return await this.service.setTemplateModelsInLeagues(t.data),t};getReportedPosts=async(e,t)=>{t&&(t=new es(t));let a=await this.privateLeagueHttps.getReportedPosts(e,t);return a.data=await this.discussionsService.finalizePostFullModel(a.data),a};getPredictions=async(e,t)=>{if(t){if(t.limit&&t.limit>20)throw new O(400,"invalid_limit","Invalid limit. The maximum limit is: 20");t=new ts(t)}let a=await this.privateLeagueHttps.getPredictions(e,t);return await this.service.setModelsForPredictions(a)};moderatePost=async(e,t)=>await this.privateLeagueHttps.moderatePost(e,t)},Kp=class{privateLeaguesFacade=null;constructor(e){this.privateLeaguesFacade=new Jp(e)}create=async e=>await this.privateLeaguesFacade.create(e);update=async(e,t)=>await this.privateLeaguesFacade.update(e,t);updateTemplate=async(e,t,a)=>await this.privateLeaguesFacade.updateTemplate(e,t,a);delete=async e=>await this.privateLeaguesFacade.delete(e);getById=async(e,t)=>await this.privateLeaguesFacade.getById(e,t);getMyLeagues=async e=>await this.privateLeaguesFacade.getMyLeagues(e);invite=async(e,t)=>await this.privateLeaguesFacade.invite(e,t);deleteInvitation=async(e,t)=>await this.privateLeaguesFacade.deleteInvitation(e,t);accept=async e=>await this.privateLeaguesFacade.accept(e);reject=async e=>await this.privateLeaguesFacade.reject(e);banUsers=async(e,t)=>await this.privateLeaguesFacade.banUsers(e,t);unbanUsers=async(e,t)=>await this.privateLeaguesFacade.unbanUsers(e,t);join=async e=>await this.privateLeaguesFacade.join(e);leave=async e=>await this.privateLeaguesFacade.leave(e);getMyLeaguesStandings=async e=>await this.privateLeaguesFacade.getMyLeaguesStandings(e);getInvitations=async e=>await this.privateLeaguesFacade.getInvitations(e);getReportedPosts=async(e,t)=>await this.privateLeaguesFacade.getReportedPosts(e,t);getPredictions=async(e,t)=>await this.privateLeaguesFacade.getPredictions(e,t);moderatePost=async(e,t)=>await this.privateLeaguesFacade.moderatePost(e,t)},Zp=class{KEY_PREFIX="fu-progress-";get=(e,t)=>{let a=localStorage.getItem(`${this.KEY_PREFIX}${e}-${t}`);return a&&JSON.parse(a)};set=(e,t,a)=>(localStorage.setItem(`${this.KEY_PREFIX}${e}-${t}`,JSON.stringify(a)),JSON.stringify(a));delete=(e,t)=>{localStorage.removeItem(`${this.KEY_PREFIX}${e}-${t}`)}},eu=class extends Ee{validatePrediction=e=>{(!e||!Array.isArray(e)||e.length===0||e.some(t=>!t))&&this.throwException(400,"invalid_method_call","The prediction argument is invalid. For more information please visit our documentation")}},tu=class{https=null;profile=null;validator=null;brandingResolver=null;constructor(e){this.https=new jt(e),this.profile=new le(e),this.validator=new eu(e.errorHandlingMode),this.brandingResolver=new ye(e)}getGames=async(e,t)=>{e&&(e=new Zc(e));let a=await this.https.getStandingsGames(e,t),i=await this.brandingResolver.resolveBrandingBatch([...a.data],t);return a.data=i,a};getGameById=async(e,t)=>{let a=await this.https.getStandingGameById(e,t);return await this.brandingResolver.resolveBranding(a,t),a};makePrediction=async(e,t)=>(this.validator.validatePrediction(t),await this.https.makeStandingGamePrediction(e,t));updatePrediction=async(e,t,a)=>(this.validator.validatePrediction(a),await this.https.updateStandingGamePrediction(e,t,a));getGamePredictionForUser=async(e,t,a)=>{let i=await this.https.getStandingGamePredictionsForUser(e,t,a),s=null;try{s=await this.profile.getById(t).getInfo()}catch(r){console.error(r)}return i.data.forEach(r=>{r.profileModel=s}),i};getRankings=async(e,t,a)=>{t&&(t=new ed(t));let i=await this.https.getStandingGameRankings(e,t,a),s=i.data.map(n=>n.profileId),r=[];return s.length>0&&(r=await this.profile.getByIds(s),i.data=i.data.map(n=>(n.profileModel=r.find(o=>o.id===n.profileId)||null,n))),i}},au=class{facade=null;constructor(e){this.facade=new tu(e)}getGames=async(e,t)=>await this.facade.getGames(e,t);getGameById=async(e,t)=>await this.facade.getGameById(e,t);makePrediction=async(e,t)=>await this.facade.makePrediction(e,t);updatePrediction=async(e,t,a)=>await this.facade.updatePrediction(e,t,a);getGamePredictionForUser=async(e,t,a)=>await this.facade.getGamePredictionForUser(e,t,a);getRankings=async(e,t,a)=>await this.facade.getRankings(e,t,a)};function iu(){let e=Hs(),t="-RC",a=null,i=e.version.split("."),s=Number(i[0]),r=Number(i[1]),n=i[2];if(n.includes(t)){let o=n.split(t);n=Number(o[0]),a=Number(o[1])}else n=Number(n);return{version:e.version,major:s,minor:r,patch:n,releaseCandidate:a}}var pt=null,ut=null;function su(e){if(ru(e)){let t=nu(e);if(t.isValid)return pt={profile:new le(e),football:new xe(e),predictor:new ws(e),loyalty:new ca(e),topX:new Is(e),matchQuiz:new vs(e),activity:new Or(e),miniGames:new oa(e),discussions:new bp(e),privateLeagues:new Kp(e),challenges:new _p(e),progress:new Zp,voting:new Ts(e),fantasy:new Fp(e),helpers:new Ap(e),idMapping:new xp(e),bracketGame:new jd(e),lists:new qp(e),standingGame:new au(e),eventGame:new Rp(e),odds:new Xp(e),getVersion:iu},ut={...e},pt;ou(t)}return pt}var ru=e=>!pt||JSON.stringify(e)!==JSON.stringify(ut)||e.authProvider?.getIdToken()!==ut.authProvider?.getIdToken()||$t(e.cookieToken)!==$t(ut?.cookieToken),nu=e=>{let t=new er().validate(e);return(t.idSchema.validation==="missing"||t.idSchema.validation==="invalid")&&(console.warn(t.idSchema.message.text),e.idSchema="native"),(t.environment.validation==="missing"||t.environment.validation==="invalid")&&(console.warn(t.environment.message.text),e.environment="prod"),(t.lang.validation==="missing"||t.lang.validation==="invalid")&&(console.warn(t.lang.message.text),e.lang="en"),(t.errorHandlingMode.validation==="missing"||t.errorHandlingMode.validation==="invalid")&&(console.warn(t.errorHandlingMode.message.text),e.errorHandlingMode="default"),t.authProvider.validation==="invalid"&&console.warn(t.authProvider.message.text),(t.oddClient.message.type==="warning"||t.oddClient.credentials.message.type==="warning")&&console.warn(t.oddClient.message.text||t.oddClient.credentials.message.text),t},ou=e=>{let t="isValid";Object.keys(e).forEach(a=>{let i=e[a];if(a!==t&&a!=="authProvider"){if(i.message.type==="error")throw new Error(i.message.text)}else if(a!==t&&a==="authProvider"){if(i?.message.type==="error")throw new Error(i.message.text);Object.keys(new Gt).forEach(s=>{if(i[s].message.type==="error")throw new Error(i[s].message.text)})}if(a!==t&&a==="oddClient"){if(i?.message.type==="error")throw new Error(i.message.text);let s=i;if(s.credentials.message.type==="error")throw new Error(s.credentials.message.text)}})};function lu(){const e=zt();return h.useMemo(()=>{if(typeof window>"u")return null;if(!e.sdk)return console.error("FansUnited SDK configuration not provided. Add 'sdk' property to your FansUnitedConfigProvider config."),null;const a=e.sdk;if(!a.apiKey||!a.clientId)return console.error("FansUnited SDK configuration is invalid. Both 'apiKey' and 'clientId' are required."),null;if(!a.authProvider&&!a.cookieToken)return console.error("FansUnited SDK configuration is invalid. Either 'authProvider' or 'cookieToken' must be provided."),null;try{const i={apiKey:a.apiKey,clientId:a.clientId,environment:a.environment||"prod",lang:a.lang||"en",idSchema:a.idSchema,errorHandlingMode:a.errorHandlingMode,oddClient:a.oddClient,cookieToken:a.cookieToken,authProvider:a.authProvider};return su(i)}catch(i){return console.error("Failed to initialize FansUnited SDK:",i),null}},[e.sdk])}const pa=h.createContext(null);function cu(){const e=h.useContext(pa);if(!e)throw new Error("useCompetition must be used within CompetitionProvider");return e}function du(e){const t=h.useCallback(d=>e.find(p=>p.id===d),[e]),a=h.useCallback(d=>e.filter(p=>p.competitorOne.id===d||p.competitorTwo.id===d),[e]),i=h.useCallback(d=>e.filter(p=>p.timing.kickoffTime.toISOString().startsWith(d)),[e]),s=h.useCallback(d=>e.filter(p=>p.round?.id===d),[e]),r=h.useCallback(()=>e.filter(d=>d.status.code==="live"),[e]),n=h.useCallback(d=>{const p=new Date;let m=e.filter(u=>u.status.code==="not_started"&&u.timing.kickoffTime>p);return d&&(m=m.filter(u=>u.competitorOne.id===d||u.competitorTwo.id===d)),m.sort((u,_)=>u.timing.kickoffTime.getTime()-_.timing.kickoffTime.getTime())},[e]),o=h.useCallback(d=>{let p=e.filter(m=>m.status.type==="FINISHED");return d&&(p=p.filter(m=>m.competitorOne.id===d||m.competitorTwo.id===d)),p.sort((m,u)=>u.timing.kickoffTime.getTime()-m.timing.kickoffTime.getTime())},[e]),l=h.useCallback(d=>e.filter(m=>m.status.type==="FINISHED"&&(m.competitorOne.id===d||m.competitorTwo.id===d)).sort((m,u)=>u.timing.kickoffTime.getTime()-m.timing.kickoffTime.getTime())[0],[e]),c=h.useCallback(d=>{const p=new Date;return e.filter(u=>u.status.code==="not_started"&&u.timing.kickoffTime>p&&(u.competitorOne.id===d||u.competitorTwo.id===d)).sort((u,_)=>u.timing.kickoffTime.getTime()-_.timing.kickoffTime.getTime())[0]},[e]);return h.useMemo(()=>({getMatch:t,getMatchesByTeam:a,getMatchesByDate:i,getMatchesByRound:s,getLiveMatches:r,getUpcomingMatches:n,getFinishedMatches:o,getTeamLastMatch:l,getTeamNextMatch:c}),[t,a,i,s,r,n,o,l,c])}function pu(e){const t=h.useMemo(()=>e.entries,[e.entries]),a=h.useCallback(l=>t.find(c=>c.competitor.id===l),[t]),i=h.useCallback(l=>a(l)?.rank,[a]),s=h.useCallback((l=5)=>e.entries.slice(0,l),[e.entries]),r=h.useCallback((l=5)=>e.entries.slice(-l),[e.entries]),n=h.useMemo(()=>e.entries.map(l=>({id:l.competitor.id,name:l.competitor.name,shortName:l.competitor.shortName,logo:l.competitor.logo,type:"club"})).sort((l,c)=>l.name.localeCompare(c.name)),[e.entries]),o=h.useMemo(()=>l=>{const c=a(l);if(c)return{position:c.rank,points:c.stats.points??0,played:c.stats.played??0,won:c.stats.won??0,drawn:c.stats.drawn??0,lost:c.stats.lost??0,goalsFor:c.stats.goalsFor??0,goalsAgainst:c.stats.goalsAgainst??0,goalDifference:c.stats.goalDifference??0}},[a]);return h.useMemo(()=>({getTeamStanding:a,getTeamRank:i,getTopTeams:s,getBottomTeams:r,getTeamsAlphabetically:n,getTeamSeasonStats:o}),[a,i,s,r,n,o])}function Dt(e,t,a,i=8,s){const r=Array.from(t).map(n=>{const o=a(n);if(!o)return null;let l=e.filter(_=>_.competitorOne.id===n||_.competitorTwo.id===n);s&&(l=l.filter(_=>s(_,n))),l=l.slice(0,i);let c=0,d=0,p=0,m=0,u=0;return l.forEach(_=>{const v=_.competitorOne.id===n,b=parseInt(v?_.score?.competitorOne??"0":_.score?.competitorTwo??"0"),I=parseInt(v?_.score?.competitorTwo??"0":_.score?.competitorOne??"0");d++,b>I?(p++,c+=3):b===I?(m++,c+=1):u++}),{rank:0,competitor:o,stats:{played:d,won:p,drawn:m,lost:u,points:c}}}).filter(n=>n!==null);return r.sort((n,o)=>(o.stats.points??0)-(n.stats.points??0)),r.forEach((n,o)=>{n.rank=o+1}),{entries:r,metadata:{legend:[]}}}function nt(e,t,a,i,s){const r=Array.from(t).map(n=>{const o=a(n);if(!o)return null;let l=e.filter(p=>p.competitorOne.id===n||p.competitorTwo.id===n);s&&(l=l.filter(p=>s(p,n))),i!==void 0&&(l=l.slice(0,i));let c=0,d=0;return l.forEach(p=>{const m=p.competitorOne.id===n,u=parseInt(m?p.score?.competitorOne??"0":p.score?.competitorTwo??"0");c+=u,d++}),{rank:0,competitor:o,stats:{played:d,goalsFor:c}}}).filter(n=>n!==null);return r.sort((n,o)=>(o.stats.goalsFor??0)-(n.stats.goalsFor??0)),r.forEach((n,o)=>{n.rank=o+1}),{entries:r,metadata:{legend:[]}}}function ot(e,t,a,i,s){const r=Array.from(t).map(n=>{const o=a(n);if(!o)return null;let l=e.filter(p=>p.competitorOne.id===n||p.competitorTwo.id===n);s&&(l=l.filter(p=>s(p,n))),i!==void 0&&(l=l.slice(0,i));let c=0,d=0;return l.forEach(p=>{const m=p.competitorOne.id===n,u=parseInt(m?p.score?.competitorTwo??"0":p.score?.competitorOne??"0");c+=u,d++}),{rank:0,competitor:o,stats:{played:d,goalsAgainst:c}}}).filter(n=>n!==null);return r.sort((n,o)=>(n.stats.goalsAgainst??0)-(o.stats.goalsAgainst??0)),r.forEach((n,o)=>{n.rank=o+1}),{entries:r,metadata:{legend:[]}}}const Lt=(e,t)=>e.competitorOne.id===t,xt=(e,t)=>e.competitorTwo.id===t;function uu(e,t,a){const i=h.useMemo(()=>e.filter(I=>I.status.type==="FINISHED").sort((I,A)=>A.timing.kickoffTime.getTime()-I.timing.kickoffTime.getTime()),[e]),s=h.useMemo(()=>new Set(t.entries.map(I=>I.competitor.id)),[t.entries]),r=h.useMemo(()=>I=>a(I)?.competitor,[a]),n=h.useMemo(()=>(I=8)=>Dt(i,s,r,I),[i,s,r]),o=h.useMemo(()=>(I=8)=>Dt(i,s,r,I,Lt),[i,s,r]),l=h.useMemo(()=>(I=8)=>Dt(i,s,r,I,xt),[i,s,r]),c=h.useMemo(()=>()=>nt(i,s,r),[i,s,r]),d=h.useMemo(()=>(I=8)=>nt(i,s,r,I),[i,s,r]),p=h.useMemo(()=>()=>nt(i,s,r,void 0,Lt),[i,s,r]),m=h.useMemo(()=>()=>nt(i,s,r,void 0,xt),[i,s,r]),u=h.useMemo(()=>()=>ot(i,s,r),[i,s,r]),_=h.useMemo(()=>(I=8)=>ot(i,s,r,I),[i,s,r]),v=h.useMemo(()=>()=>ot(i,s,r,void 0,Lt),[i,s,r]),b=h.useMemo(()=>()=>ot(i,s,r,void 0,xt),[i,s,r]);return h.useMemo(()=>({getFormStandings:n,getHomeFormStandings:o,getAwayFormStandings:l,getOffenceStandings:c,getFormOffenceStandings:d,getHomeOffenceStandings:p,getAwayOffenceStandings:m,getDefenceStandings:u,getFormDefenceStandings:_,getHomeDefenceStandings:v,getAwayDefenceStandings:b}),[n,o,l,c,d,p,m,u,_,v,b])}function hu(e){return e==="GOAL"||e==="PENALTY_GOAL"||e==="OWN_GOAL"}function $a(e,t=15){const a=l=>Math.round(l*10)/10,i=[];e.forEach(l=>{l.status.type==="FINISHED"&&l.mainEvents?.forEach(c=>{hu(c.type)&&c.minute!==void 0&&i.push({baseMinute:c.minute,totalMinute:c.minute+(c.injuryMinute??0)})})});const s=i.length,r=[];for(let l=1;l<=45;l+=t){const c=Math.min(l+t-1,45),d=i.filter(p=>p.baseMinute>=l&&p.baseMinute<=c).length;r.push({label:c===45?`${l}-${c}+`:`${l}-${c}`,startMinute:l,endMinute:c,goals:d,percentage:s>0?a(d/s*100):0})}for(let l=46;l<=90;l+=t){const c=Math.min(l+t-1,90),d=c===90?i.filter(p=>p.baseMinute>=l).length:i.filter(p=>p.baseMinute>=l&&p.baseMinute<=c).length;r.push({label:c===90?`${l}-${c}+`:`${l}-${c}`,startMinute:l,endMinute:c,goals:d,percentage:s>0?a(d/s*100):0})}const n=i.filter(l=>l.baseMinute<=45).length,o=i.filter(l=>l.baseMinute>=46).length;return{intervals:r,byHalf:{firstHalf:{goals:n,percentage:s>0?a(n/s*100):0},secondHalf:{goals:o,percentage:s>0?a(o/s*100):0}},totalGoals:s}}function mu(e){const t=h.useMemo(()=>e.filter(s=>s.status.type==="FINISHED"),[e]),a=h.useMemo(()=>$a(t,15),[t]),i=h.useMemo(()=>(s=15)=>$a(t,s),[t]);return h.useMemo(()=>({goalDistribution:a,getGoalDistribution:i}),[a,i])}function Ua(e){if(!e)return 0;const t=parseInt(e,10);return isNaN(t)?0:t}function gu(e){if(!e.mainEvents||e.mainEvents.length===0)return"NONE";const t=e.mainEvents.filter(s=>s.type==="GOAL"||s.type==="PENALTY_GOAL"||s.type==="OWN_GOAL");if(t.length===0)return"NONE";const i=[...t].sort((s,r)=>{const n=(s.minute??0)+(s.injuryMinute??0),o=(r.minute??0)+(r.injuryMinute??0);return n-o})[0];return i.type==="OWN_GOAL"?i.competitorPosition==="ONE"?"AWAY":"HOME":i.competitorPosition==="ONE"?"HOME":"AWAY"}function fu(e){const t=e.length,a=e.filter(A=>A.status.type==="FINISHED"),i=a.length;let s=0,r=0,n=0,o=0,l=0,c=0,d=0,p=0,m=0,u=0,_=0,v=0,b=0;a.forEach(A=>{const F=Ua(A.score?.competitorOne),$=Ua(A.score?.competitorTwo),D=F+$;F>$?s++:$>F?r++:n++,o+=D,l+=F,c+=$,D>1.5&&d++,D>2.5&&p++,D>3.5&&m++,F>0&&$>0&&u++;const g=gu(A);g==="HOME"?_++:g==="AWAY"?v++:b++});const I=A=>Math.round(A*10)/10;return{totalMatches:t,finishedMatches:i,completionPercentage:t>0?I(i/t*100):0,homeWins:s,awayWins:r,draws:n,homeWinPercentage:i>0?I(s/i*100):0,awayWinPercentage:i>0?I(r/i*100):0,drawPercentage:i>0?I(n/i*100):0,totalGoals:o,goalsPerMatch:i>0?o/i:0,homeGoalsPerMatch:i>0?l/i:0,awayGoalsPerMatch:i>0?c/i:0,over1_5Goals:d,over2_5Goals:p,over3_5Goals:m,over1_5Percentage:i>0?I(d/i*100):0,over2_5Percentage:i>0?I(p/i*100):0,over3_5Percentage:i>0?I(m/i*100):0,bothTeamsScored:u,bothTeamsScoredPercentage:i>0?I(u/i*100):0,homeTeamScoredFirst:_,awayTeamScoredFirst:v,noGoalScored:b,homeTeamScoredFirstPercentage:i>0?I(_/i*100):0,awayTeamScoredFirstPercentage:i>0?I(v/i*100):0,noGoalScoredPercentage:i>0?I(b/i*100):0}}function yu(e){return h.useMemo(()=>fu(e),[e])}function wu(e,t){return{getTeamResultsTable:h.useCallback(i=>{const s=e.filter(o=>o.status.type==="FINISHED"),r=e.filter(o=>o.status.type==="NOT_STARTED"||o.status.type==="POSTPONED"),n=t.entries.map(o=>{const l=o.competitor.id,c=s.filter(u=>u.competitorOne.id===i&&u.competitorTwo.id===l||u.competitorOne.id===l&&u.competitorTwo.id===i),d=r.filter(u=>u.competitorOne.id===i&&u.competitorTwo.id===l||u.competitorOne.id===l&&u.competitorTwo.id===i);let p,m;return c.forEach(u=>{const _=u.competitorOne.id===i,v=parseInt(u.score?.competitorOne??"0"),b=parseInt(u.score?.competitorTwo??"0"),I=_?v:b,A=_?b:v;let F;I>A?F="W":I===A?F="D":F="L";const $={result:F,score:`${v} - ${b}`,date:u.timing.kickoffTime,matchId:u.id,isUpcoming:!1};_?p=$:m=$}),d.forEach(u=>{const _=u.competitorOne.id===i;_&&!p?p={date:u.timing.kickoffTime,matchId:u.id,isUpcoming:!0}:!_&&!m&&(m={date:u.timing.kickoffTime,matchId:u.id,isUpcoming:!0})}),{rank:o.rank,teamId:o.competitor.id,teamName:o.competitor.name,teamShortName:o.competitor.shortName,teamLogo:o.competitor.logo,gamesPlayed:o.stats.played??0,points:o.stats.points??0,homeResult:p,awayResult:m}});return{teamId:i,rows:n}},[e,t.entries])}}function _u(e){return{getTeamPosition:h.useCallback(a=>e.entries.find(s=>s.competitor.id===a)?.rank,[e])}}function vu({competitionId:e,seasonId:t,stageId:a,competition:i,season:s,matches:r,standings:n,previousSeasons:o,config:l,autoRefresh:c=!0,refreshInterval:d=3e4,children:p}){const m=yt(),[u,_]=h.useState(i),[v,b]=h.useState(s),[I,A]=h.useState(r??[]),[F,$]=h.useState(n??{entries:[],metadata:{legend:[]}}),[D,g]=h.useState(!1),[f,y]=h.useState(void 0);h.useEffect(()=>{if(u&&v)return;(async()=>{try{const M=t??v?.id,[N,ne]=await Promise.all([u?Promise.resolve(u):Z.getFootballCompetition(e,void 0,m),v?Promise.resolve(v):M?Z.getFootballSeasonDetails({seasonId:M},m):Z.getFootballSeasonDetails({competitionId:e,status:"CURRENT"},m)]);u||_(N),v||b(ne)}catch(M){console.error("[CompetitionProvider] Error fetching initial data:",M)}})()},[e,t,m]);const T=h.useCallback(async()=>{const R=t??v?.id;if(R){g(!0);try{const M=a??v?.stages?.find(ve=>ve.status==="ACTIVE")?.id,[N,ne]=await Promise.all([Z.getFootballMatches({tournamentIds:[e],seasonIds:[R],stageIds:M?[M]:void 0,limit:552,offset:0},m),M?Z.getFootballStandings({stageId:M,expand:["rules","form.events"]},m):Promise.resolve({entries:[],metadata:{legend:[]}})]);A(N),$(ne),y(new Date)}catch(M){console.error("[CompetitionProvider] Error refreshing matches/standings:",M)}finally{g(!1)}}},[e,t,a,v?.id,v?.stages,m]);h.useEffect(()=>{if(!c||!I.some(N=>N.status.code==="live"))return;const M=setInterval(()=>{T()},d);return()=>clearInterval(M)},[c,d,I,T]);const C=du(I),P=pu(F),k=uu(I,F,P.getTeamStanding),{goalDistribution:U,getGoalDistribution:q}=mu(I),z=yu(I),{getTeamResultsTable:re}=wu(I,F),{getTeamPosition:ae}=_u(F),Y=h.useCallback(R=>P.getTeamStanding(R)?.form,[P]),X=h.useCallback(R=>o?.find(M=>M.id===R)?.matches,[o]),J=h.useCallback(R=>o?.find(M=>M.id===R)?.standings,[o]),w=h.useMemo(()=>({competitionId:e,seasonId:t,stageId:a,competition:u,season:v,isRefreshing:D,lastRefreshed:f,matches:I,standings:F,previousSeasons:o,config:l,refresh:T,...C,...P,getTeamForm:Y,getTeamPosition:ae,...k,goalDistribution:U,getGoalDistribution:q,competitionStats:z,getSeasonMatches:X,getSeasonStandings:J,getTeamResultsTable:re}),[e,t,a,u,v,D,f,I,F,o,l,T,C,P,Y,ae,k,U,q,z,X,J,re]);return ft.jsx(pa.Provider,{value:w,children:p})}const ua=h.createContext(null);function Iu(){const e=h.useContext(ua);if(!e)throw new Error("useTeam must be used within TeamProvider");return e}function Tu(e){const t=h.useMemo(()=>e?.players??[],[e]),a=h.useCallback(m=>t.find(u=>u.id===m),[t]),i=h.useCallback(m=>t.find(u=>u.shirtNumber===m),[t]),s=h.useCallback(m=>t.filter(u=>u.position===m),[t]),r=h.useCallback(()=>t.filter(m=>m.status==="ACTIVE"),[t]),n=h.useCallback(()=>t.filter(m=>m.status==="INACTIVE"),[t]),o=h.useCallback(m=>t.filter(u=>u.contractType===m),[t]),l=h.useCallback(()=>t.filter(m=>m.position?.toLowerCase().includes("keeper")),[t]),c=h.useCallback(()=>t.filter(m=>m.position?.toLowerCase().includes("defender")),[t]),d=h.useCallback(()=>t.filter(m=>m.position?.toLowerCase().includes("midfielder")),[t]),p=h.useCallback(()=>t.filter(m=>m.position?.toLowerCase().includes("forward")||m.position?.toLowerCase().includes("attacker")),[t]);return h.useMemo(()=>({getPlayer:a,getPlayerByShirtNumber:i,getPlayersByPosition:s,getActiveSquad:r,getInactiveSquad:n,getSquadByContractType:o,getGoalkeepers:l,getDefenders:c,getMidfielders:d,getForwards:p}),[a,i,s,r,n,o,l,c,d,p])}function bu(e,t){const a=h.useCallback(()=>t.filter(l=>l.status.type==="FINISHED"&&(l.competitorOne.id===e||l.competitorTwo.id===e)).sort((l,c)=>c.timing.kickoffTime.getTime()-l.timing.kickoffTime.getTime())[0],[e,t]),i=h.useCallback(()=>{const o=new Date;return t.filter(c=>c.status.code==="not_started"&&c.timing.kickoffTime>o&&(c.competitorOne.id===e||c.competitorTwo.id===e)).sort((c,d)=>c.timing.kickoffTime.getTime()-d.timing.kickoffTime.getTime())[0]},[e,t]),s=h.useCallback(()=>t.find(o=>o.status.code==="live"&&(o.competitorOne.id===e||o.competitorTwo.id===e)),[e,t]),r=h.useCallback(()=>{const o=new Date;return t.filter(l=>(l.status.code==="not_started"||l.status.code==="live")&&(l.timing.kickoffTime>=o||l.status.code==="live")&&(l.competitorOne.id===e||l.competitorTwo.id===e)).sort((l,c)=>l.timing.kickoffTime.getTime()-c.timing.kickoffTime.getTime())},[e,t]),n=h.useCallback(()=>t.filter(o=>o.status.type==="FINISHED"&&(o.competitorOne.id===e||o.competitorTwo.id===e)).sort((o,l)=>l.timing.kickoffTime.getTime()-o.timing.kickoffTime.getTime()),[e,t]);return h.useMemo(()=>({getLastMatch:a,getNextMatch:i,getLiveMatch:s,getUpcomingMatches:r,getFinishedMatches:n}),[a,i,s,r,n])}function Ce(e,t){let a=0,i=0,s=0,r=0;return t.forEach(n=>{const o=n.competitorOne.id===e,l=parseInt(o?n.score?.competitorOne??"0":n.score?.competitorTwo??"0"),c=parseInt(o?n.score?.competitorTwo??"0":n.score?.competitorOne??"0");r++,i+=l,s+=c,l>c?a+=3:l===c&&(a+=1)}),{pointsPerGame:r>0?a/r:0,goalsForPerGame:r>0?i/r:0,goalsAgainstPerGame:r>0?s/r:0,played:r}}function ue(e,t){if(t===0)return 0;const a=(e-t)/t*100;return Math.round(a*10)/10}function Pu(e,t){const a=h.useCallback((i=8)=>{if(!e)return null;const s=t.filter(b=>b.status.type==="FINISHED").filter(b=>b.competitorOne.id===e||b.competitorTwo.id===e).sort((b,I)=>I.timing.kickoffTime.getTime()-b.timing.kickoffTime.getTime());if(s.length===0)return null;const r=Ce(e,s),n=s.slice(0,i),o=Ce(e,n),l=s.filter(b=>b.competitorOne.id===e),c=Ce(e,l),d=l.slice(0,i),p=Ce(e,d),m=s.filter(b=>b.competitorTwo.id===e),u=Ce(e,m),_=m.slice(0,i),v=Ce(e,_);return{pointsPerGame:r.pointsPerGame,goalsForPerGame:r.goalsForPerGame,goalsAgainstPerGame:r.goalsAgainstPerGame,pointsPerGameForm:o.pointsPerGame,goalsForPerGameForm:o.goalsForPerGame,goalsAgainstPerGameForm:o.goalsAgainstPerGame,pointsPerGameDiffPercent:ue(o.pointsPerGame,r.pointsPerGame),goalsForPerGameDiffPercent:ue(o.goalsForPerGame,r.goalsForPerGame),goalsAgainstPerGameDiffPercent:ue(o.goalsAgainstPerGame,r.goalsAgainstPerGame),home:{pointsPerGame:c.pointsPerGame,goalsForPerGame:c.goalsForPerGame,goalsAgainstPerGame:c.goalsAgainstPerGame,pointsPerGameForm:p.pointsPerGame,goalsForPerGameForm:p.goalsForPerGame,goalsAgainstPerGameForm:p.goalsAgainstPerGame,pointsPerGameDiffPercent:ue(p.pointsPerGame,c.pointsPerGame),goalsForPerGameDiffPercent:ue(p.goalsForPerGame,c.goalsForPerGame),goalsAgainstPerGameDiffPercent:ue(p.goalsAgainstPerGame,c.goalsAgainstPerGame)},away:{pointsPerGame:u.pointsPerGame,goalsForPerGame:u.goalsForPerGame,goalsAgainstPerGame:u.goalsAgainstPerGame,pointsPerGameForm:v.pointsPerGame,goalsForPerGameForm:v.goalsForPerGame,goalsAgainstPerGameForm:v.goalsAgainstPerGame,pointsPerGameDiffPercent:ue(v.pointsPerGame,u.pointsPerGame),goalsForPerGameDiffPercent:ue(v.goalsForPerGame,u.goalsForPerGame),goalsAgainstPerGameDiffPercent:ue(v.goalsAgainstPerGame,u.goalsAgainstPerGame)}}},[e,t]);return h.useMemo(()=>({getFormStats:a}),[a])}function Eu({teamId:e,team:t,squad:a,matches:i=[],config:s,autoRefresh:r=!1,refreshInterval:n=6e4,children:o}){const l=yt(),[c,d]=h.useState(t),[p,m]=h.useState(a??null),[u]=h.useState(i),[_,v]=h.useState(!1),[b,I]=h.useState(void 0);h.useEffect(()=>{if(c&&p)return;(async()=>{try{const[T,C]=await Promise.all([c?Promise.resolve(c):Z.getFootballTeam(e,void 0,l),p?Promise.resolve(p):Z.getFootballTeamSquad(e,void 0,l)]);c||d(T),p||m(C)}catch(T){console.error("Failed to fetch initial team data:",T)}})()},[l]);const A=h.useCallback(async()=>{v(!0);try{const[y,T]=await Promise.all([Z.getFootballTeam(e,void 0,l),Z.getFootballTeamSquad(e,void 0,l)]);d(y),m(T),I(new Date)}catch(y){console.error("Failed to refresh team data:",y)}finally{v(!1)}},[e,l]);h.useEffect(()=>{if(!r)return;const y=setInterval(A,n);return()=>clearInterval(y)},[r,n,A]);const F=Tu(p),$=c?.id??e,D=bu($,u),{getFormStats:g}=Pu($,u),f=h.useMemo(()=>({teamId:e,team:c,isRefreshing:_,lastRefreshed:b,squad:p,matches:u,config:s,refresh:A,getFormStats:g,...F,...D}),[e,c,_,b,p,u,s,A,g,F,D]);return ft.jsx(ua.Provider,{value:f,children:o})}const ha=h.createContext(null);function Ru(){const e=h.useContext(ha);if(!e)throw new Error("useMatch must be used within MatchProvider");return e}function Su(e){const t=h.useCallback(()=>{if(!e)return!1;const n=e.status?.type||"",o=e.status?.code||"";return n==="LIVE"||o==="live"},[e]),a=h.useCallback(()=>e?e.status?.type==="FINISHED":!1,[e]),i=h.useCallback(()=>e?e.status?.type==="NOT_STARTED":!1,[e]),s=h.useCallback(()=>e?.timing?.currentMinute,[e]),r=h.useCallback(()=>e?.timing?.currentPeriod,[e]);return h.useMemo(()=>({isLive:t,isFinished:a,isUpcoming:i,getMatchMinute:s,getMatchPeriod:r}),[t,a,i,s,r])}function Cu(e){const t=h.useCallback(()=>{if(!e?.score)return;const s=parseInt(e.score.competitorOne||"0",10),r=parseInt(e.score.competitorTwo||"0",10);return{home:s,away:r}},[e]),a=h.useCallback(()=>{if(!e?.score?.breakdown?.halfTime)return;const s=parseInt(e.score.breakdown.halfTime.competitorOne||"0",10),r=parseInt(e.score.breakdown.halfTime.competitorTwo||"0",10);return{home:s,away:r}},[e]),i=h.useCallback(()=>{const s=t();if(s)return s.home>s.away?"home":s.away>s.home?"away":"draw"},[t]);return h.useMemo(()=>({getScore:t,getHalfTimeScore:a,getWinner:i}),[t,a,i])}function Mu(e){const t=h.useCallback(()=>e?.competitorOne,[e]),a=h.useCallback(()=>e?.competitorTwo,[e]),i=h.useCallback(r=>{if(!e?.score)return;const o=e.competitorOne.id===r?e.score.competitorOne:e.score.competitorTwo;if(o)return parseInt(o,10)},[e]),s=h.useCallback(r=>e?.competitorOne.id===r,[e]);return h.useMemo(()=>({getHomeTeam:t,getAwayTeam:a,getTeamScore:i,isHomeTeam:s}),[t,a,i,s])}function Ou(e,t){const a=h.useMemo(()=>t||e?.mainEvents||[],[t,e]),i=h.useCallback(()=>a.filter(l=>l.type==="GOAL"||l.type==="PENALTY_GOAL"||l.type==="OWN_GOAL"||l.type==="PENALTY_SHOOTOUT_SCORED"),[a]),s=h.useCallback(()=>a.filter(l=>l.type==="YELLOW_CARD"||l.type==="RED_CARD"||l.type==="YELLOW_RED_CARD"),[a]),r=h.useCallback(()=>a.filter(l=>l.type==="SUBSTITUTION"),[a]),n=h.useCallback(l=>{if(!e)return[];const d=e.competitorOne.id===l?"ONE":"TWO";return a.filter(p=>p.competitorPosition===d)},[e,a]),o=h.useCallback(l=>a.filter(c=>c.period===l),[a]);return h.useMemo(()=>({getGoals:i,getCards:s,getSubstitutions:r,getEventsByTeam:n,getEventsByPeriod:o}),[i,s,r,n,o])}function Fu(e,t){const a=h.useCallback(()=>t?.competitorOne,[t]),i=h.useCallback(()=>t?.competitorTwo,[t]),s=h.useCallback(l=>!t||!e?void 0:e.competitorOne.id===l?t.competitorOne:t.competitorTwo,[t,e]),r=h.useCallback(l=>s(l)?.starters||[],[s]),n=h.useCallback(l=>s(l)?.substitutes||[],[s]),o=h.useCallback(l=>s(l)?.formation,[s]);return h.useMemo(()=>({getHomeLineup:a,getAwayLineup:i,getTeamLineup:s,getStartingEleven:r,getSubstitutes:n,getFormation:o}),[a,i,s,r,n,o])}function Au(e,t){const a=h.useCallback(r=>!t||!e?void 0:e.competitorOne.id===r?t.competitorOne:t.competitorTwo,[t,e]),i=h.useCallback((r,n)=>a(r)?.statistics.find(l=>l.key===n),[a]),s=h.useCallback(()=>{if(!t)return;const r=t.competitorOne.statistics.find(o=>o.key==="possession"),n=t.competitorTwo.statistics.find(o=>o.key==="possession");if(!(!r||!n))return{home:parseInt(r.value,10),away:parseInt(n.value,10)}},[t]);return h.useMemo(()=>({getTeamStatistics:a,getStatistic:i,getPossession:s}),[a,i,s])}function ku(e){const t=h.useCallback(s=>{if(!e)return[];const r=[];for(const n of e.operators){const o=n.markets.find(l=>l.type.code===s);o&&r.push(o)}return r},[e]),a=h.useCallback(s=>{if(e)return e.operators.find(r=>r.operator.id===s)},[e]),i=h.useCallback((s,r)=>{const n=t(s);if(n.length===0)return;let o;for(const l of n){const c=l.selections.find(d=>d.name===r);if(c&&c.odds){const d=parseFloat(c.odds);(!o||d>o)&&(o=d)}}return o},[t]);return h.useMemo(()=>({getOddsByMarket:t,getOddsByOperator:a,getBestOdds:i}),[t,a,i])}function Du(e,t){const a=h.useCallback(()=>{if(!t||!e)return{homeWins:0,awayWins:0,draws:0};let s=0,r=0,n=0;const o=e.competitorOne.id;for(const l of t){if(l.status.type!=="FINISHED"||!l.score)continue;const c=parseInt(l.score.competitorOne||"0",10),d=parseInt(l.score.competitorTwo||"0",10),p=l.competitorOne.id===o;c>d?p?s++:r++:d>c?p?r++:s++:n++}return{homeWins:s,awayWins:r,draws:n}},[t,e]),i=h.useCallback((s=5)=>t?t.filter(r=>r.status.type==="FINISHED").sort((r,n)=>n.timing.kickoffTime.getTime()-r.timing.kickoffTime.getTime()).slice(0,s):[],[t]);return h.useMemo(()=>({getHeadToHeadStats:a,getLastMeetings:i}),[a,i])}function Me(e,t){let a=0,i=0,s=0,r=0;return t.forEach(n=>{const o=n.competitorOne.id===e,l=parseInt(o?n.score?.competitorOne??"0":n.score?.competitorTwo??"0"),c=parseInt(o?n.score?.competitorTwo??"0":n.score?.competitorOne??"0");r++,i+=l,s+=c,l>c?a+=3:l===c&&(a+=1)}),{pointsPerGame:r>0?a/r:0,goalsForPerGame:r>0?i/r:0,goalsAgainstPerGame:r>0?s/r:0,played:r}}function he(e,t){if(t===0)return 0;const a=(e-t)/t*100;return Math.round(a*10)/10}function Lu(e,t){const a=h.useMemo(()=>new Map,[t]);return h.useMemo(()=>{const i=(n,o="all",l=8)=>{if(!t||t.length===0)return null;const c=`${n}-${o}-${l}`;if(a.has(c))return a.get(c);let d=t.filter(f=>f.status.type==="FINISHED").filter(f=>f.competitorOne.id===n||f.competitorTwo.id===n).sort((f,y)=>y.timing.kickoffTime.getTime()-f.timing.kickoffTime.getTime());if(o==="home"?d=d.filter(f=>f.competitorOne.id===n):o==="away"&&(d=d.filter(f=>f.competitorTwo.id===n)),d.length===0)return null;const p=Me(n,d),m=d.slice(0,l),u=Me(n,m),_=d.filter(f=>f.competitorOne.id===n),v=Me(n,_),b=_.slice(0,l),I=Me(n,b),A=d.filter(f=>f.competitorTwo.id===n),F=Me(n,A),$=A.slice(0,l),D=Me(n,$),g={pointsPerGame:p.pointsPerGame,goalsForPerGame:p.goalsForPerGame,goalsAgainstPerGame:p.goalsAgainstPerGame,pointsPerGameForm:u.pointsPerGame,goalsForPerGameForm:u.goalsForPerGame,goalsAgainstPerGameForm:u.goalsAgainstPerGame,pointsPerGameDiffPercent:he(u.pointsPerGame,p.pointsPerGame),goalsForPerGameDiffPercent:he(u.goalsForPerGame,p.goalsForPerGame),goalsAgainstPerGameDiffPercent:he(u.goalsAgainstPerGame,p.goalsAgainstPerGame),home:{pointsPerGame:v.pointsPerGame,goalsForPerGame:v.goalsForPerGame,goalsAgainstPerGame:v.goalsAgainstPerGame,pointsPerGameForm:I.pointsPerGame,goalsForPerGameForm:I.goalsForPerGame,goalsAgainstPerGameForm:I.goalsAgainstPerGame,pointsPerGameDiffPercent:he(I.pointsPerGame,v.pointsPerGame),goalsForPerGameDiffPercent:he(I.goalsForPerGame,v.goalsForPerGame),goalsAgainstPerGameDiffPercent:he(I.goalsAgainstPerGame,v.goalsAgainstPerGame)},away:{pointsPerGame:F.pointsPerGame,goalsForPerGame:F.goalsForPerGame,goalsAgainstPerGame:F.goalsAgainstPerGame,pointsPerGameForm:D.pointsPerGame,goalsForPerGameForm:D.goalsForPerGame,goalsAgainstPerGameForm:D.goalsAgainstPerGame,pointsPerGameDiffPercent:he(D.pointsPerGame,F.pointsPerGame),goalsForPerGameDiffPercent:he(D.goalsForPerGame,F.goalsForPerGame),goalsAgainstPerGameDiffPercent:he(D.goalsAgainstPerGame,F.goalsAgainstPerGame)}};return a.set(c,g),g};return{getTeamForm:i,getHomeTeamForm:(n="all",o=8)=>e?.competitorOne?.id?i(e.competitorOne.id,n,o):null,getAwayTeamForm:(n="all",o=8)=>e?.competitorTwo?.id?i(e.competitorTwo.id,n,o):null}},[e,t,a])}function xu(e){const t=h.useMemo(()=>e?.entries??[],[e?.entries]),a=h.useCallback(n=>t.find(o=>o.competitor.id===n),[t]),i=h.useCallback(n=>a(n)?.rank,[a]),s=h.useCallback(n=>{const o=a(n);if(o)return{position:o.rank,points:o.stats.points??0,played:o.stats.played??0,won:o.stats.won??0,drawn:o.stats.drawn??0,lost:o.stats.lost??0,goalsFor:o.stats.goalsFor??0,goalsAgainst:o.stats.goalsAgainst??0,goalDifference:o.stats.goalDifference??0}},[a]),r=h.useCallback(n=>a(n)?.form,[a]);return h.useMemo(()=>({getTeamStanding:a,getTeamRank:i,getTeamSeasonStats:s,getTeamStandingForm:r}),[a,i,s,r])}function Nt(e,t,a,i){if(!t||t.length===0)return{...e,entries:[]};const s=t.filter(l=>l.status.type==="FINISHED").sort((l,c)=>c.timing.kickoffTime.getTime()-l.timing.kickoffTime.getTime());if(s.length===0)return{...e,entries:[]};const r=new Map;s.forEach(l=>{const c=l.competitorOne.id,d=l.competitorTwo.id;r.has(c)||r.set(c,{teamId:c,teamName:l.competitorOne.name,competitor:l.competitorOne,matches:[],points:0,played:0}),r.has(d)||r.set(d,{teamId:d,teamName:l.competitorTwo.name,competitor:l.competitorTwo,matches:[],points:0,played:0}),r.get(c).matches.push(l),r.get(d).matches.push(l)});const n=Array.from(r.values()).map(l=>{const c=l.teamId;let d=l.matches;i==="HOME"?d=d.filter(m=>m.competitorOne.id===c):i==="AWAY"&&(d=d.filter(m=>m.competitorTwo.id===c)),d=d.sort((m,u)=>u.timing.kickoffTime.getTime()-m.timing.kickoffTime.getTime()),a!==void 0&&(d=d.slice(0,a));const p=d.reduce((m,u)=>{const _=u.competitorOne.id===c,v=parseInt(_?u.score?.competitorOne||"0":u.score?.competitorTwo||"0",10),b=parseInt(_?u.score?.competitorTwo||"0":u.score?.competitorOne||"0",10);return v>b?m+3:v===b?m+1:m},0);return{teamId:c,competitor:l.competitor,formPoints:p,formPlayed:d.length}});n.sort((l,c)=>c.formPoints!==l.formPoints?c.formPoints-l.formPoints:l.competitor.name.localeCompare(c.competitor.name));const o=n.map((l,c)=>({rank:c+1,competitor:l.competitor,stats:{played:l.formPlayed,points:l.formPoints,wins:0,draws:0,losses:0,goalsFor:0,goalsAgainst:0,goalDifference:0}}));return{...e,entries:o}}function lt(e,t,a,i){if(!t||t.length===0)return{...e,entries:[]};const s=t.filter(l=>l.status.type==="FINISHED").sort((l,c)=>c.timing.kickoffTime.getTime()-l.timing.kickoffTime.getTime());if(s.length===0)return{...e,entries:[]};const r=new Map;s.forEach(l=>{const c=l.competitorOne.id,d=l.competitorTwo.id;r.has(c)||r.set(c,{teamId:c,competitor:l.competitorOne,matches:[]}),r.has(d)||r.set(d,{teamId:d,competitor:l.competitorTwo,matches:[]}),r.get(c).matches.push(l),r.get(d).matches.push(l)});const n=Array.from(r.values()).map(l=>{const c=l.teamId;let d=l.matches;i==="HOME"?d=d.filter(m=>m.competitorOne.id===c):i==="AWAY"&&(d=d.filter(m=>m.competitorTwo.id===c)),d=d.sort((m,u)=>u.timing.kickoffTime.getTime()-m.timing.kickoffTime.getTime()),a!==void 0&&(d=d.slice(0,a));const p=d.reduce((m,u)=>{const _=u.competitorOne.id===c,v=parseInt(_?u.score?.competitorOne||"0":u.score?.competitorTwo||"0",10);return m+v},0);return{teamId:c,competitor:l.competitor,goalsScored:p,played:d.length}});n.sort((l,c)=>c.goalsScored!==l.goalsScored?c.goalsScored-l.goalsScored:l.competitor.name.localeCompare(c.competitor.name));const o=n.map((l,c)=>({rank:c+1,competitor:l.competitor,stats:{played:l.played,points:0,wins:0,draws:0,losses:0,goalsFor:l.goalsScored,goalsAgainst:0,goalDifference:0}}));return{...e,entries:o}}function ct(e,t,a,i){if(!t||t.length===0)return{...e,entries:[]};const s=t.filter(l=>l.status.type==="FINISHED").sort((l,c)=>c.timing.kickoffTime.getTime()-l.timing.kickoffTime.getTime());if(s.length===0)return{...e,entries:[]};const r=new Map;s.forEach(l=>{const c=l.competitorOne.id,d=l.competitorTwo.id;r.has(c)||r.set(c,{teamId:c,competitor:l.competitorOne,matches:[]}),r.has(d)||r.set(d,{teamId:d,competitor:l.competitorTwo,matches:[]}),r.get(c).matches.push(l),r.get(d).matches.push(l)});const n=Array.from(r.values()).map(l=>{const c=l.teamId;let d=l.matches;i==="HOME"?d=d.filter(m=>m.competitorOne.id===c):i==="AWAY"&&(d=d.filter(m=>m.competitorTwo.id===c)),d=d.sort((m,u)=>u.timing.kickoffTime.getTime()-m.timing.kickoffTime.getTime()),a!==void 0&&(d=d.slice(0,a));const p=d.reduce((m,u)=>{const _=u.competitorOne.id===c,v=parseInt(_?u.score?.competitorTwo||"0":u.score?.competitorOne||"0",10);return m+v},0);return{teamId:c,competitor:l.competitor,goalsConceded:p,played:d.length}});n.sort((l,c)=>l.goalsConceded!==c.goalsConceded?l.goalsConceded-c.goalsConceded:l.competitor.name.localeCompare(c.competitor.name));const o=n.map((l,c)=>({rank:c+1,competitor:l.competitor,stats:{played:l.played,points:0,wins:0,draws:0,losses:0,goalsFor:0,goalsAgainst:l.goalsConceded,goalDifference:0}}));return{...e,entries:o}}function Nu(e,t){const a=h.useMemo(()=>(u=8)=>!e||!t||t.length===0?null:Nt(e,t,u),[e,t]),i=h.useMemo(()=>(u=8)=>!e||!t||t.length===0?null:Nt(e,t,u,"HOME"),[e,t]),s=h.useMemo(()=>(u=8)=>!e||!t||t.length===0?null:Nt(e,t,u,"AWAY"),[e,t]),r=h.useMemo(()=>()=>!e||!t||t.length===0?null:lt(e,t),[e,t]),n=h.useMemo(()=>(u=8)=>!e||!t||t.length===0?null:lt(e,t,u),[e,t]),o=h.useMemo(()=>()=>!e||!t||t.length===0?null:lt(e,t,void 0,"HOME"),[e,t]),l=h.useMemo(()=>()=>!e||!t||t.length===0?null:lt(e,t,void 0,"AWAY"),[e,t]),c=h.useMemo(()=>()=>!e||!t||t.length===0?null:ct(e,t),[e,t]),d=h.useMemo(()=>(u=8)=>!e||!t||t.length===0?null:ct(e,t,u),[e,t]),p=h.useMemo(()=>()=>!e||!t||t.length===0?null:ct(e,t,void 0,"HOME"),[e,t]),m=h.useMemo(()=>()=>!e||!t||t.length===0?null:ct(e,t,void 0,"AWAY"),[e,t]);return{getFormTable:a,getHomeFormTable:i,getAwayFormTable:s,getOffenceStandings:r,getFormOffenceStandings:n,getHomeOffenceStandings:o,getAwayOffenceStandings:l,getDefenceStandings:c,getFormDefenceStandings:d,getHomeDefenceStandings:p,getAwayDefenceStandings:m}}function Gu({matchId:e,match:t,lineups:a,statistics:i,odds:s,commentary:r,events:n,headToHeadMatches:o,standings:l,contextMatches:c,config:d,autoRefresh:p=!0,refreshInterval:m=3e4,children:u}){const _=yt(),[v,b]=h.useState(t),[I]=h.useState(a),[A,F]=h.useState(i),[$]=h.useState(s),[D,g]=h.useState(r),[f,y]=h.useState(n),[T]=h.useState(l),[C,P]=h.useState(!1),[k,U]=h.useState(void 0);h.useEffect(()=>{if(v)return;(async()=>{try{const K=await Z.getFootballMatch(e,{optionalData:["MAIN_EVENTS","LINEUP_STATUS"]},_);b(K)}catch(K){console.error("[MatchProvider] Error fetching initial data:",K)}})()},[_]);const q=h.useCallback(async()=>{P(!0);try{const[G,K,Se,Ne]=await Promise.all([Z.getFootballMatch(e,{optionalData:["MAIN_EVENTS","LINEUP_STATUS"]},_),Z.getFootballMatchEvents(e,void 0,_).catch(()=>[]),Z.getFootballMatchStatistics(e,void 0,_).catch(()=>{}),Z.getFootballMatchCommentary(e,void 0,_).catch(()=>[])]);b(G),y(K),F(Se),g(Ne),U(new Date)}catch(G){console.error("[MatchProvider] Error refreshing match data:",G)}finally{P(!1)}},[e,_]);h.useEffect(()=>{if(!p||!v)return;const G=v.status?.type||"",K=v.status?.code||"";if(!(G==="LIVE"||K==="live"))return;const Ne=setInterval(()=>{q()},m);return()=>clearInterval(Ne)},[p,m,v,q]);const z=Su(v),re=Cu(v),ae=Mu(v),Y=Ou(v,f),X=Fu(v,I),J=Au(v,A),w=ku($),R=Du(v,o),M=Lu(v,c),N=xu(T),ne=Nu(T,c),ve=h.useMemo(()=>({matchId:e,match:v,lineups:I,statistics:A,odds:$,commentary:D,events:f,headToHeadMatches:o,standings:T,contextMatches:c,isRefreshing:C,lastRefreshed:k,config:d,refresh:q,...z,...re,...ae,...Y,...X,...J,...w,...R,...M,...N,...ne}),[e,v,I,A,$,D,f,o,T,c,C,k,d,q,z,re,ae,Y,X,J,w,R,M,N,ne]);return ft.jsx(ha.Provider,{value:ve,children:u})}exports.CompetitionContext=pa;exports.CompetitionProvider=vu;exports.FansUnitedConfigProvider=Rs;exports.MatchContext=ha;exports.MatchProvider=Gu;exports.TeamContext=ua;exports.TeamProvider=Eu;exports.useCompetition=cu;exports.useDataLayerConfig=yt;exports.useFansUnitedConfig=zt;exports.useFansUnitedSDK=lu;exports.useMatch=Ru;exports.useTeam=Iu;
|