fansunited-data-layer 0.13.0 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/fansunited/constants.js +5 -0
- package/api/fansunited/constants.js.map +1 -0
- package/api/fansunited/football/competition/index.js +21 -0
- package/api/fansunited/football/competition/index.js.map +1 -0
- package/api/fansunited/football/competition/transformer.js +41 -0
- package/api/fansunited/football/competition/transformer.js.map +1 -0
- package/api/fansunited/football/competitions/index.js +56 -0
- package/api/fansunited/football/competitions/index.js.map +1 -0
- package/api/fansunited/football/competitions/transformer.js +68 -0
- package/api/fansunited/football/competitions/transformer.js.map +1 -0
- package/api/fansunited/football/http.js +7 -0
- package/api/fansunited/football/http.js.map +1 -0
- package/api/fansunited/football/matches/index.js +132 -0
- package/api/fansunited/football/matches/index.js.map +1 -0
- package/api/fansunited/football/matches/transformer.js +148 -0
- package/api/fansunited/football/matches/transformer.js.map +1 -0
- package/api/fansunited/football/players/index.js +60 -0
- package/api/fansunited/football/players/index.js.map +1 -0
- package/api/fansunited/football/players/transformer.js +85 -0
- package/api/fansunited/football/players/transformer.js.map +1 -0
- package/api/fansunited/football/search/index.js +64 -0
- package/api/fansunited/football/search/index.js.map +1 -0
- package/api/fansunited/football/search/transformer.js +114 -0
- package/api/fansunited/football/search/transformer.js.map +1 -0
- package/api/fansunited/football/teams/index.js +66 -0
- package/api/fansunited/football/teams/index.js.map +1 -0
- package/api/fansunited/football/teams/transformer.js +53 -0
- package/api/fansunited/football/teams/transformer.js.map +1 -0
- package/api/fansunited/http.d.ts.map +1 -1
- package/api/fansunited/http.js +70 -0
- package/api/fansunited/http.js.map +1 -0
- package/api/fansunited/search/constants.js +5 -0
- package/api/fansunited/search/constants.js.map +1 -0
- package/api/fansunited/search/http.js +7 -0
- package/api/fansunited/search/http.js.map +1 -0
- package/api/fansunited/search/index.js +308 -0
- package/api/fansunited/search/index.js.map +1 -0
- package/api/fansunited/search/transformer.js +374 -0
- package/api/fansunited/search/transformer.js.map +1 -0
- package/api/fansunited-sdk/loyalty/matches.js +21 -0
- package/api/fansunited-sdk/loyalty/matches.js.map +1 -0
- package/api/fansunited-sdk/loyalty/template.js +52 -0
- package/api/fansunited-sdk/loyalty/template.js.map +1 -0
- package/api/fansunited-sdk/odds/matches.js +109 -0
- package/api/fansunited-sdk/odds/matches.js.map +1 -0
- package/api/sportal365-sports/basketball/games/index.js +32 -0
- package/api/sportal365-sports/basketball/games/index.js.map +1 -0
- package/api/sportal365-sports/basketball/games/transformers/game.js +137 -0
- package/api/sportal365-sports/basketball/games/transformers/game.js.map +1 -0
- package/api/sportal365-sports/basketball/http.js +7 -0
- package/api/sportal365-sports/basketball/http.js.map +1 -0
- package/api/sportal365-sports/constants.js +15 -0
- package/api/sportal365-sports/constants.js.map +1 -0
- package/api/sportal365-sports/football/competitions/index.js +52 -0
- package/api/sportal365-sports/football/competitions/index.js.map +1 -0
- package/api/sportal365-sports/football/competitions/utils.js +92 -0
- package/api/sportal365-sports/football/competitions/utils.js.map +1 -0
- package/api/sportal365-sports/football/http.js +7 -0
- package/api/sportal365-sports/football/http.js.map +1 -0
- package/api/sportal365-sports/football/matches/index.js +206 -0
- package/api/sportal365-sports/football/matches/index.js.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/commentary.js +27 -0
- package/api/sportal365-sports/football/matches/transformers/commentary.js.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/lineup.js +74 -0
- package/api/sportal365-sports/football/matches/transformers/lineup.js.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/match-event.js +60 -0
- package/api/sportal365-sports/football/matches/transformers/match-event.js.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/match.js +195 -0
- package/api/sportal365-sports/football/matches/transformers/match.js.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/odds.js +11 -0
- package/api/sportal365-sports/football/matches/transformers/odds.js.map +1 -0
- package/api/sportal365-sports/football/matches/transformers/statistics.js +41 -0
- package/api/sportal365-sports/football/matches/transformers/statistics.js.map +1 -0
- package/api/sportal365-sports/football/search/index.js +42 -0
- package/api/sportal365-sports/football/search/index.js.map +1 -0
- package/api/sportal365-sports/football/search/search.transformer.js +166 -0
- package/api/sportal365-sports/football/search/search.transformer.js.map +1 -0
- package/api/sportal365-sports/football/standings/index.js +28 -0
- package/api/sportal365-sports/football/standings/index.js.map +1 -0
- package/api/sportal365-sports/football/standings/standing.transformer.js +107 -0
- package/api/sportal365-sports/football/standings/standing.transformer.js.map +1 -0
- package/api/sportal365-sports/football/statistics/index.js +154 -0
- package/api/sportal365-sports/football/statistics/index.js.map +1 -0
- package/api/sportal365-sports/football/statistics/player-career.transformer.js +77 -0
- package/api/sportal365-sports/football/statistics/player-career.transformer.js.map +1 -0
- package/api/sportal365-sports/football/statistics/player-recent.transformer.js +54 -0
- package/api/sportal365-sports/football/statistics/player-recent.transformer.js.map +1 -0
- package/api/sportal365-sports/football/statistics/player-season.transformer.js +147 -0
- package/api/sportal365-sports/football/statistics/player-season.transformer.js.map +1 -0
- package/api/sportal365-sports/football/teams/index.js +73 -0
- package/api/sportal365-sports/football/teams/index.js.map +1 -0
- package/api/sportal365-sports/football/teams/utils.js +196 -0
- package/api/sportal365-sports/football/teams/utils.js.map +1 -0
- package/api/sportal365-sports/http.js +58 -0
- package/api/sportal365-sports/http.js.map +1 -0
- package/api/sportal365-sports/search/http.js +7 -0
- package/api/sportal365-sports/search/http.js.map +1 -0
- package/api/sportal365-sports/search/index.js +61 -0
- package/api/sportal365-sports/search/index.js.map +1 -0
- package/api/sportal365-sports/search/search.transformer.js +254 -0
- package/api/sportal365-sports/search/search.transformer.js.map +1 -0
- package/api/sportal365-sports/shared/odds.transformer.js +65 -0
- package/api/sportal365-sports/shared/odds.transformer.js.map +1 -0
- package/api/sportal365-sports/shared/providerRef.helper.js +31 -0
- package/api/sportal365-sports/shared/providerRef.helper.js.map +1 -0
- package/api/sportal365-sports/standings/http.js +7 -0
- package/api/sportal365-sports/standings/http.js.map +1 -0
- package/api/sportal365-sports/standings/index.js +29 -0
- package/api/sportal365-sports/standings/index.js.map +1 -0
- package/api/sportal365-sports/standings/standing.transformer.js +185 -0
- package/api/sportal365-sports/standings/standing.transformer.js.map +1 -0
- package/api/sportal365-sports/statistics/http.js +7 -0
- package/api/sportal365-sports/statistics/http.js.map +1 -0
- package/api/sportal365-sports/statistics/index.js +25 -0
- package/api/sportal365-sports/statistics/index.js.map +1 -0
- package/api/sportal365-sports/statistics/team-stats.transformer.js +16 -0
- package/api/sportal365-sports/statistics/team-stats.transformer.js.map +1 -0
- package/api/sportal365-sports/tennis/http.js +7 -0
- package/api/sportal365-sports/tennis/http.js.map +1 -0
- package/api/sportal365-sports/tennis/matches/index.js +34 -0
- package/api/sportal365-sports/tennis/matches/index.js.map +1 -0
- package/api/sportal365-sports/tennis/matches/transformers/match.js +193 -0
- package/api/sportal365-sports/tennis/matches/transformers/match.js.map +1 -0
- package/cache/cache-manager.js +136 -0
- package/cache/cache-manager.js.map +1 -0
- package/cache/memory-store.js +29 -0
- package/cache/memory-store.js.map +1 -0
- package/client.js +38 -12337
- package/client.js.map +1 -0
- package/config/index.js +20 -0
- package/config/index.js.map +1 -0
- package/fansunited-data-layer.js +146 -3553
- package/fansunited-data-layer.js.map +1 -0
- package/helpers/competition.helpers.js +11 -0
- package/helpers/competition.helpers.js.map +1 -0
- package/helpers/player.helpers.js +165 -0
- package/helpers/player.helpers.js.map +1 -0
- package/helpers/player.hooks.js +34 -0
- package/helpers/player.hooks.js.map +1 -0
- package/helpers/team.helpers.js +216 -0
- package/helpers/team.helpers.js.map +1 -0
- package/package.json +6 -8
- package/providers/competition/hooks/useCompetitionStats.js +10 -0
- package/providers/competition/hooks/useCompetitionStats.js.map +1 -0
- package/providers/competition/hooks/useGoalDistribution.js +23 -0
- package/providers/competition/hooks/useGoalDistribution.js.map +1 -0
- package/providers/competition/hooks/useMatchHelpers.js +85 -0
- package/providers/competition/hooks/useMatchHelpers.js.map +1 -0
- package/providers/competition/hooks/useStandingsCalculations.js +89 -0
- package/providers/competition/hooks/useStandingsCalculations.js.map +1 -0
- package/providers/competition/hooks/useStandingsHelpers.js +61 -0
- package/providers/competition/hooks/useStandingsHelpers.js.map +1 -0
- package/providers/competition/hooks/useTeamPosition.js +15 -0
- package/providers/competition/hooks/useTeamPosition.js.map +1 -0
- package/providers/competition/hooks/useTeamResultsTable.js +86 -0
- package/providers/competition/hooks/useTeamResultsTable.js.map +1 -0
- package/providers/competition/utils/competitionStats.js +109 -0
- package/providers/competition/utils/competitionStats.js.map +1 -0
- package/providers/competition/utils/goalDistribution.js +64 -0
- package/providers/competition/utils/goalDistribution.js.map +1 -0
- package/providers/competition/utils/standingsCalculations.js +152 -0
- package/providers/competition/utils/standingsCalculations.js.map +1 -0
- package/providers/competition.context.js +14 -0
- package/providers/competition.context.js.map +1 -0
- package/providers/competition.provider.js +187 -0
- package/providers/competition.provider.js.map +1 -0
- package/providers/fansunited-config.context.js +6 -0
- package/providers/fansunited-config.context.js.map +1 -0
- package/providers/fansunited-config.hooks.js +20 -0
- package/providers/fansunited-config.hooks.js.map +1 -0
- package/providers/fansunited-config.provider.js +9 -0
- package/providers/fansunited-config.provider.js.map +1 -0
- package/providers/fansunited-sdk.hook.js +50 -0
- package/providers/fansunited-sdk.hook.js.map +1 -0
- package/providers/leaderboard/hooks/useMatchHelpers.js +30 -0
- package/providers/leaderboard/hooks/useMatchHelpers.js.map +1 -0
- package/providers/leaderboard/hooks/useTemplateHelpers.js +39 -0
- package/providers/leaderboard/hooks/useTemplateHelpers.js.map +1 -0
- package/providers/leaderboard.context.js +14 -0
- package/providers/leaderboard.context.js.map +1 -0
- package/providers/leaderboard.provider.js +98 -0
- package/providers/leaderboard.provider.js.map +1 -0
- package/providers/match/hooks/useBatchMatchOdds.js +72 -0
- package/providers/match/hooks/useBatchMatchOdds.js.map +1 -0
- package/providers/match/hooks/useEventHelpers.js +46 -0
- package/providers/match/hooks/useEventHelpers.js.map +1 -0
- package/providers/match/hooks/useHeadToHeadHelpers.js +52 -0
- package/providers/match/hooks/useHeadToHeadHelpers.js.map +1 -0
- package/providers/match/hooks/useLineupHelpers.js +53 -0
- package/providers/match/hooks/useLineupHelpers.js.map +1 -0
- package/providers/match/hooks/useMatchStandingsCalculations.js +332 -0
- package/providers/match/hooks/useMatchStandingsCalculations.js.map +1 -0
- package/providers/match/hooks/useMatchStatus.js +37 -0
- package/providers/match/hooks/useMatchStatus.js.map +1 -0
- package/providers/match/hooks/useOddsHelpers.js +54 -0
- package/providers/match/hooks/useOddsHelpers.js.map +1 -0
- package/providers/match/hooks/useScoreHelpers.js +34 -0
- package/providers/match/hooks/useScoreHelpers.js.map +1 -0
- package/providers/match/hooks/useStandingsHelpers.js +53 -0
- package/providers/match/hooks/useStandingsHelpers.js.map +1 -0
- package/providers/match/hooks/useStatisticsHelpers.js +40 -0
- package/providers/match/hooks/useStatisticsHelpers.js.map +1 -0
- package/providers/match/hooks/useTeamHelpers.js +38 -0
- package/providers/match/hooks/useTeamHelpers.js.map +1 -0
- package/providers/match/hooks/useTeamStatsHelpers.js +141 -0
- package/providers/match/hooks/useTeamStatsHelpers.js.map +1 -0
- package/providers/match.context.js +14 -0
- package/providers/match.context.js.map +1 -0
- package/providers/match.provider.js +176 -0
- package/providers/match.provider.js.map +1 -0
- package/providers/team/hooks/useFormStats.js +116 -0
- package/providers/team/hooks/useFormStats.js.map +1 -0
- package/providers/team/hooks/useMatchHelpers.js +46 -0
- package/providers/team/hooks/useMatchHelpers.js.map +1 -0
- package/providers/team/hooks/useSquadHelpers.js +67 -0
- package/providers/team/hooks/useSquadHelpers.js.map +1 -0
- package/providers/team.context.js +14 -0
- package/providers/team.context.js.map +1 -0
- package/providers/team.provider.js +98 -0
- package/providers/team.provider.js.map +1 -0
- package/utilities/stats/core/helpers.js +105 -0
- package/utilities/stats/core/helpers.js.map +1 -0
- package/utilities/stats/core/types.js +5 -0
- package/utilities/stats/core/types.js.map +1 -0
- package/utilities/stats/match/headToHead.js +83 -0
- package/utilities/stats/match/headToHead.js.map +1 -0
- package/utilities/stats/match/homeVsAway.js +140 -0
- package/utilities/stats/match/homeVsAway.js.map +1 -0
- package/utilities/stats/match/overUnder.js +91 -0
- package/utilities/stats/match/overUnder.js.map +1 -0
- package/utilities/stats/match/result.js +21 -0
- package/utilities/stats/match/result.js.map +1 -0
- package/utilities/stats/team/commonOpponents.js +77 -0
- package/utilities/stats/team/commonOpponents.js.map +1 -0
- package/utilities/stats/team/goalStats.js +50 -0
- package/utilities/stats/team/goalStats.js.map +1 -0
- package/utilities/stats/team/streaks.js +183 -0
- package/utilities/stats/team/streaks.js.map +1 -0
- package/client.cjs +0 -8
- package/fansunited-data-layer.cjs +0 -1
- package/matches-BvHU-bP0.js +0 -1795
- package/matches-Ci0Ci_Mw.cjs +0 -1
package/client.cjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),B=require("./matches-Ci0Ci_Mw.cjs");var at={exports:{}},$e={};var ya;function Ss(){if(ya)return $e;ya=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 $e.Fragment=t,$e.jsx=a,$e.jsxs=a,$e}var Ue={};var wa;function Cs(){return wa||(wa=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 T:return"Fragment";case O:return"Profiler";case I:return"StrictMode";case g:return"Suspense";case f:return"SuspenseList";case M: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 G:return w.displayName||"Context";case C:return(w._context.displayName||"Context")+".Consumer";case A: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 b: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 F=R.error,N=typeof Symbol=="function"&&Symbol.toStringTag&&w[Symbol.toStringTag]||w.constructor.name||"Object";return F.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===T)return"<>";if(typeof w=="object"&&w!==null&&w.$$typeof===b)return"<...>";try{var R=e(w);return R?"<"+R+">":"<...>"}catch{return"<...>"}}function s(){var w=D.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 F(){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))}F.isReactWarning=!0,Object.defineProperty(w,"key",{get:F,configurable:!0})}function l(){var w=e(this.type);return ie[w]||(ie[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,F,N,ne,Ie){var $=F.ref;return w={$$typeof:_,type:w,key:R,props:F,_owner:N},($!==void 0?$: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:Ie}),Object.freeze&&(Object.freeze(w.props),Object.freeze(w)),w}function d(w,R,F,N,ne,Ie){var $=R.children;if($!==void 0)if(N)if(j($)){for(N=0;N<$.length;N++)p($[N]);Object.freeze&&Object.freeze($)}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($);if(U.call(R,"key")){$=e(w);var ee=Object.keys(R).filter(function(Ge){return Ge!=="key"});N=0<ee.length?"{key: someKey, "+ee.join(": ..., ")+": ...}":"{key: someKey}",Z[$+N]||(ee=0<ee.length?"{"+ee.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,$,ee,$),Z[$+N]=!0)}if($=null,F!==void 0&&(a(F),$=""+F),n(R)&&(a(R.key),$=""+R.key),"key"in R){F={};for(var Ce in R)Ce!=="key"&&(F[Ce]=R[Ce])}else F=R;return $&&o(F,typeof w=="function"?w.displayName||w.name||"Unknown":w),c(w,$,F,s(),ne,Ie)}function p(w){m(w)?w._store&&(w._store.validated=1):typeof w=="object"&&w!==null&&w.$$typeof===b&&(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"),T=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),G=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),P=Symbol.for("react.client.reference"),D=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=Object.prototype.hasOwnProperty,j=Array.isArray,q=console.createTask?console.createTask:function(){return null};u={react_stack_bottom_frame:function(w){return w()}};var re,ie={},J=u.react_stack_bottom_frame.bind(u,r)(),K=q(i(r)),Z={};Ue.Fragment=T,Ue.jsx=function(w,R,F){var N=1e4>D.recentlyCreatedOwnerStacks++;return d(w,R,F,!1,N?Error("react-stack-top-frame"):J,N?q(i(w)):K)},Ue.jsxs=function(w,R,F){var N=1e4>D.recentlyCreatedOwnerStacks++;return d(w,R,F,!0,N?Error("react-stack-top-frame"):J,N?q(i(w)):K)}})()),Ue}var _a;function Ms(){return _a||(_a=1,process.env.NODE_ENV==="production"?at.exports=Ss():at.exports=Cs()),at.exports}var Qe=Ms();const Wa=h.createContext(null);function Os({config:e,children:t}){return Qe.jsx(Wa.Provider,{value:e,children:t})}function qt(){const e=h.useContext(Wa);if(!e)throw new Error("useFansUnitedConfig must be used within FansUnitedConfigProvider. Wrap your app with <FansUnitedConfigProvider config={...}>");return e}function wt(){return qt().dataLayer}var Fs=Object.create,_t=Object.defineProperty,As=Object.getOwnPropertyDescriptor,ks=Object.getOwnPropertyNames,Ds=Object.getPrototypeOf,Ls=Object.prototype.hasOwnProperty,xs=(e,t,a)=>t in e?_t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Ns=(e,t)=>()=>(e&&(t=e(e=0)),t),Ye=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Gs=(e,t)=>{for(var a in t)_t(e,a,{get:t[a],enumerable:!0})},$s=(e,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ks(t))!Ls.call(e,s)&&s!==a&&_t(e,s,{get:()=>t[s],enumerable:!(i=As(t,s))||i.enumerable});return e},Us=(e,t,a)=>(a=e!=null?Fs(Ds(e)):{},$s(!e||!e.__esModule?_t(a,"default",{value:e,enumerable:!0}):a,e)),de=(e,t,a)=>(xs(e,typeof t!="symbol"?t+"":t,a),a),za={};Gs(za,{default:()=>qa});var va,qa,Bs=Ns(()=>{va={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},qa=va}),Hs=Ye((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,T,I){typeof _=="object"&&(v=_.depth,T=_.prototype,I=_.includeNonEnumerable,_=_.circular);var O=[],C=[],G=typeof Buffer<"u";typeof _>"u"&&(_=!0),typeof v>"u"&&(v=1/0);function A(g,f){if(g===null)return null;if(f===0)return g;var y,b;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(J,K){g.then(function(Z){J(A(Z,f-1))},function(Z){K(A(Z,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(G&&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 T>"u"?(b=Object.getPrototypeOf(g),y=Object.create(b)):(y=Object.create(T),b=T)}if(_){var M=O.indexOf(g);if(M!=-1)return C[M];O.push(g),C.push(y)}i(g,s)&&g.forEach(function(J,K){var Z=A(K,f-1),w=A(J,f-1);y.set(Z,w)}),i(g,r)&&g.forEach(function(J){var K=A(J,f-1);y.add(K)});for(var P in g){var D;b&&(D=Object.getOwnPropertyDescriptor(b,P)),!(D&&D.set==null)&&(y[P]=A(g[P],f-1))}if(Object.getOwnPropertySymbols)for(var U=Object.getOwnPropertySymbols(g),P=0;P<U.length;P++){var j=U[P],q=Object.getOwnPropertyDescriptor(g,j);q&&!q.enumerable&&!I||(y[j]=A(g[j],f-1),q.enumerable||Object.defineProperty(y,j,{enumerable:!1}))}if(I)for(var re=Object.getOwnPropertyNames(g),P=0;P<re.length;P++){var ie=re[P],q=Object.getOwnPropertyDescriptor(g,ie);q&&q.enumerable||(y[ie]=A(g[ie],f-1),Object.defineProperty(y,ie,{enumerable:!1}))}return y}return A(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)}),Vs=Ye((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=C,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 b=g==="error",M=this._events;if(M!==void 0)b=b&&M.error===void 0;else if(!b)return!1;if(b){var P;if(f.length>0&&(P=f[0]),P instanceof Error)throw P;var D=new Error("Unhandled error."+(P?" ("+P.message+")":""));throw D.context=P,D}var U=M[g];if(U===void 0)return!1;if(typeof U=="function")i(U,this,f);else for(var j=U.length,q=T(U,j),y=0;y<j;++y)i(q[y],this,f);return!0};function p(g,f,y,b){var M,P,D;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),D=P[f]),D===void 0)D=P[f]=y,++g._eventsCount;else if(typeof D=="function"?D=P[f]=b?[y,D]:[D,y]:b?D.unshift(y):D.push(y),M=d(g),M>0&&D.length>M&&!D.warned){D.warned=!0;var U=new Error("Possible EventEmitter memory leak detected. "+D.length+" "+String(f)+" listeners added. Use emitter.setMaxListeners() to increase limit");U.name="MaxListenersExceededWarning",U.emitter=g,U.type=f,U.count=D.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 b={fired:!1,wrapFn:void 0,target:g,type:f,listener:y},M=m.bind(b);return M.listener=y,b.wrapFn=M,M}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,b,M,P,D;if(c(f),b=this._events,b===void 0)return this;if(y=b[g],y===void 0)return this;if(y===f||y.listener===f)--this._eventsCount===0?this._events=Object.create(null):(delete b[g],b.removeListener&&this.emit("removeListener",g,y.listener||f));else if(typeof y!="function"){for(M=-1,P=y.length-1;P>=0;P--)if(y[P]===f||y[P].listener===f){D=y[P].listener,M=P;break}if(M<0)return this;M===0?y.shift():I(y,M),y.length===1&&(b[g]=y[0]),b.removeListener!==void 0&&this.emit("removeListener",g,D||f)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(g){var f,y,b;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 M=Object.keys(y),P;for(b=0;b<M.length;++b)P=M[b],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(b=f.length-1;b>=0;b--)this.removeListener(g,f[b]);return this};function _(g,f,y){var b=g._events;if(b===void 0)return[];var M=b[f];return M===void 0?[]:typeof M=="function"?y?[M.listener||M]:[M]:y?O(M):T(M,M.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 T(g,f){for(var y=new Array(f),b=0;b<f;++b)y[b]=g[b];return y}function I(g,f){for(;f+1<g.length;f++)g[f]=g[f+1];g.pop()}function O(g){for(var f=new Array(g.length),y=0;y<f.length;++y)f[y]=g[y].listener||g[y];return f}function C(g,f){return new Promise(function(y,b){function M(D){g.removeListener(f,P),b(D)}function P(){typeof g.removeListener=="function"&&g.removeListener("error",M),y([].slice.call(arguments))}A(g,f,P,{once:!0}),f!=="error"&&G(g,M,{once:!0})})}function G(g,f,y){typeof g.on=="function"&&A(g,"error",f,y)}function A(g,f,y,b){if(typeof g.on=="function")b.once?g.once(f,y):g.on(f,y);else if(typeof g.addEventListener=="function")g.addEventListener(f,function M(P){b.once&&g.removeEventListener(f,M),y(P)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof g)}}),Ws=Ye((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=Hs(),a=Vs().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,T;if(v=m,[...m]=v,[u]=s.call(m,-1),typeof u=="function")try{T=p(...m),u(null,T)}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,T,I,O,C;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,T=c.length;m<T;m++){if(v=c[m],{key:_,val:C,ttl:O}=v,O&&typeof O!="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:C,ttl:O}=v,this.set(_,C,O);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)}),zs=Ye((e,t)=>{(function(){var a;a=t.exports=Ws(),a.version="5.1.2"}).call(e)}),qs=Ye((e,t)=>{t.exports={name:"fansunited-sdk-esm",version:"1.124.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}}),ja=(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))(ja||{}),js=class{validate=e=>{let t=this.validateField(e.lang),a=this.generateMessage(t);return{validation:t,message:a}};validateField=e=>{let t=Object.values(ja),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}}},Qa=(e=>(e.DEV="dev",e.PROD="prod",e.STAGING="staging",e))(Qa||{}),Qs=class{validate(e){let t=this.validateField(e.environment),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 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}}},Ys=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}}},Ya=(e=>(e.NATIVE="native",e.ENETPULSE="enetpulse",e.SPORTRADAR="sportradar",e.SPORTAL_365="sportal365",e.API_FOOTBALL="api_football",e))(Ya||{}),Xs=class{validate(e){let t=this.validateField(e.idSchema),a=this.generateMessage(t);return{validation:t,message:a}}validateField=e=>{let t=Object.values(Ya),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}}},$t=class{getIdToken=null;logout=null},be=class{text=null;type=null},Ia=class{validation=null;message=new be;getIdToken={validation:null,message:new be};logout={validation:null,message:new be}},Js=class{validate(e){if(e.cookieToken)return new Ia;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 $t),a=new Ia;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 $t).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)},Fe=class{validation;message},Ks=class{apiKey=null;environment=null;idSchema=null;clientId=null;lang=null;errorHandlingMode=null;cookieToken={name:new Fe,requestHeaders:new Fe};oddClient=null;authProvider={getIdToken:new Fe,logout:new Fe};isValid=!1},Zs=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}}},er=(e=>(e.DEFAULT="default",e.STANDARD="standard",e))(er||{}),tr=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}}},Ta=class extends Fe{name={validation:null,message:new be};requestHeaders={validation:null,message:new be}},ar=class{keys=["name","requestHeaders"];isServerSide=typeof document>"u";validate(e){if(!e.cookieToken){let a=new Ta;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 Ta;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)},ba=class extends Fe{name={validation:null,message:new be};credentials={validation:null,message:new be}},ir=class{keys=["name","credentials"];validate=e=>{if(!e.oddClient){let a=new ba;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 ba;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)},sr=class{validate=e=>{let t=this.checkFieldsForValues(e);return t.isValid=this.containsErrorMessage(t),t};checkFieldsForValues=e=>{let t=new Ks,a={apiKey:new Ys,environment:new Qs,idSchema:new Xs,clientId:new Zs,lang:new js,errorHandlingMode:new tr,authProvider:new Js,cookieToken:new ar,oddClient:new ir};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}},Pa=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},Ae=(e,t)=>{let a=[];for(;e.length>t;){let i=e.splice(0,t);a.push(i)}return a.push(e),a},X=(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},vt=e=>Array.from(new Set(e)),S=e=>e||!1,E=()=>`&disable_cache=${Date.now()}`,Xa=e=>JSON.parse(JSON.stringify(e.sort((t,a)=>t.localeCompare(a)))),Ut=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}},It=(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))(It||{}),rr=["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"],nr=["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"],fe=["PLAYER_RED_CARD","PLAYER_SCORE","PLAYER_SCORE_FIRST_GOAL","PLAYER_SCORE_HATTRICK","PLAYER_SCORE_TWICE","PLAYER_YELLOW_CARD"],or=["FT_1X2","HT_1X2","HT_FT","DOUBLE_CHANCE","CORNERS_MATCH","CORRECT_SCORE","CORRECT_SCORE_HT","CORRECT_SCORE_ADVANCED"],gt="PLAYER_SCORE_FIRST_GOAL",lr=class{id="";achievedAt=""},Ja=class{participationCount=null;points=null},Ka=class{totalPoints=null;postPoints=null;postsMade=null;reactionPoints=null;reactionCount=null},Za=class{participationCount=null},Ea=class{participations=0;points=0},Bt=class{footballCompetitions=[];footballTeams=[]},ei=class{predictionsMade=0;correct=0;points=0;breakdown=new Bt},ti=class{single=new ei;topX=new Ea;matchQuiz=new Ea},cr=class{overallPercent;byFootballCompetition;byFootballTeam;byFootballMarket},dr=class{profileId;tier;points;predictionsMade;successRates=new cr;predictions=new ti;tiers=[];badges=[];discussions=new Ka;classicQuizzes=new Ja;eitherOr=new Za},pr=class{entityId="";entityType="";entitySource="";model=null;predictionsMade=0;correct=0;points=0},ur=class{successRatePercent;model=null},jt=class{content=null;tags=[];campaign=null},ai=class{id=null;profileId=null;property=null;value=null;action=null;context=new jt;points=0},De=class{currentPage=null;itemsPerPage=null;totalItems=null;numberOfPages=null},ye=class{pagination=new De},hr=class{meta=new ye;data=[new ai]},mr=class{remapSingleResponse=e=>{let t=new ai;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 hr;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 dr;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)},It[a]&&delete t[a].model});else return e;return t};remapSuccessRatePercent=e=>{let t=new ur;return t.successRatePercent=e.success_rate_percent,t};remapPredictionsStats=e=>{let t=new ti;return t.single=this.remapSinglePredictionsStats(e.single),t.topX=e.top_x,t.matchQuiz=e.match_quiz,t};remapSinglePredictionsStats=e=>{let t=new ei;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 Bt,a=[],i=[];return Object.keys(e).forEach(s=>{let r=new pr;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 Bt};remapAchievementsStats=e=>e.map(t=>{let a=new lr;return a.id=t.id,a.achievedAt=t.achieved_at,a});remapDiscussionStats=e=>{let t=new Ka;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 Ja;return t.participationCount=e.participation_count,t.points=e.points,t};remapEitherOrStats=e=>{let t=new Za;return t.participationCount=e.participation_count,t}};function Ht(e){this.message=e}Ht.prototype=new Error,Ht.prototype.name="InvalidCharacterError";var Ra=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Ht("'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 gr(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(Ra(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 Ra(t)}}function ft(e){this.message=e}function fr(e,t){if(typeof e!="string")throw new ft("Invalid token specified");var a=(t=t||{}).header===!0?0:1;try{return JSON.parse(gr(e.split(".")[a]))}catch(i){throw new ft("Invalid token specified: "+i.message)}}ft.prototype=new Error,ft.prototype.name="InvalidTokenError";var Sa=fr,yr=(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))(yr||{}),wr=(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))(wr||{}),V={native:"id",sportradar:"sportradar_id",sportal365:"sportal365_id",enetpulse:"enetpulse_id",api_football:"api_football_id"},Ca={PREDICTOR_USER_RELATED_OPERATION:"https://docs.fansunitedmedia.com/docs/predictor-operations#user-related-operations"},Ma=["matchId","matchType","market","prediction"],_r=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"),vr=(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))(vr||{}),Oa={UNEXPECTED_STATUS_PROP:`Unexpected provided property 'status'. You can NOT use this property for this method. For more information visit our documentation:
|
|
7
|
-
${Ca.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
|
-
${Ca.PREDICTOR_USER_RELATED_OPERATION}`},Ir=(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`,ii=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`,Tr=e=>`The market '${e}' is not valid for Top X game. The only available market is CORRECT_SCORE.`,br=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`,Pr=(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`,Er=(e,t)=>`The field ${e} has incorrect type. The correct type is ${t}`,it=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},k=class{error={code:0,status:"",message:""};constructor(e,t,a){this.error.code=e,this.error.status=t,this.error.message=a}},te=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?Ut(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 k(401,"unauthorized","Invalid JWT token is provided");let r={code:401,status:"unauthorized",message:"Invalid JWT token is provided"};return new it(e,r)}let{code:a,status:i,message:s}=t.error;return this.errorHandlingMode==="standard"?new k(a,i,s):new it(e,t.error)};validateJWTToken=()=>{let e=null;try{e=Sa(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 it(a,i)}else if(this.errorHandlingMode==="standard")throw new k(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 it(t,a)}else if(this.errorHandlingMode==="standard")throw new k(401,"invalid_token","The provided JWT token is expired")}};extractUserIdFromToken=()=>{try{return Sa(this.getJwtToken())?.sub||""}catch(e){return console.error(e),""}}},si=class extends te{activityRemapper=null;constructor(e){super(e,X(e.environment,"loyalty")),this.activityRemapper=new mr}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)}},Rr=(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))(Rr||{}),Fa=class{action=null;context=new jt;constructor(e,t,a,i){this.action=e,this.context.tags=t,a&&(this.context.content=a),i&&(this.context.campaign=i)}},Be={player:"players",team:"teams",homeTeam:"teams",awayTeam:"teams",country:"countries",competition:"competitions",match:"matches"},Sr=class extends te{constructor(e){super(e,X(e.environment,"idMapping"))}getEntityById=async(e,t)=>{let a=`/football${this.apiSignInUrl}&input_provider=${this.idSchema}&${Be[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}&${Be[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}&${Be[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=Pa(t),s=[];for(let r of i){let n=`/football${this.apiSignInUrl}&input_provider=${a}&${Be[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=vt(a),n=Pa(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+=`${Be[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}},Mt="FansUnited",st={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="";storageInstance=null;expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(e){this.idSchema=e,this.getStorageInstance()}static getInstance(e){return We.instance||(We.instance=new We(e)),We.instance}async getStorageInstance(){try{let e=await Promise.resolve().then(()=>(Bs(),za));this.storageInstance=e.default}catch(e){console.error(e)}}async getData(){try{let e=await this.storageInstance.getItem(Mt);return e?JSON.parse(e):(await this.storageInstance.setItem(Mt,JSON.stringify(st)),st)}catch(e){throw console.error("AsyncStorage error:",e),e}}async setData(e){await this.storageInstance.setItem(Mt,JSON.stringify(e))}clearData=async()=>{await this.setData(st)};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=V[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=V[a];return s&&e.includes(`${s[r]}`)&&s.resource===t}):i.football.ids.find(s=>{let r=V[a];return s&&`${s[r]}`===e&&s.resource===t})};checkForExistingIdObjs=async(e,t)=>{let a=V[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=V[a],r=V[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(st)}},ri=We;de(ri,"instance");var Ot="FansUnited",Ft={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}}},ze=class{idSchema="";expirationProfileTimeout=600;expirationBadgesTimeout=3600;expirationClientFeaturesTimeout=14400;expirationFootballIdsTimeout=604800;constructor(e){this.idSchema=e}static getInstance(e){return ze.instance||(ze.instance=new ze(e)),ze.instance}clearData=async()=>{this.setData(Ft)};getEntityById=async(e="",t="")=>this.getData().football.ids.find(a=>{let i=V[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=V[a];return i&&e.includes(`${i[s]}`)&&i.resource===t}):this.getData().football.ids.find(i=>{let s=V[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=V[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=V[a],s=V[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(Ot)||this.setData(Ft),JSON.parse(localStorage.getItem(Ot)));setData=e=>{localStorage.setItem(Ot,JSON.stringify(e))};initialNewSchema=(e,t)=>{let a=this.getData();(!a||!a[e]||!a[e][t])&&this.setData(Ft)}},ni=ze;de(ni,"instance");var Cr=Us(zs()),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=V[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=V[a];return s&&e.includes(`${s[r]}`)&&s.resource===t}):i.find(s=>{let r=V[a];return s&&`${s[r]}`===e&&s.resource===t})};checkForExistingIdObjs=async(e,t)=>{let a=V[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=V[a],s=V[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"}}},Vt=L;de(Vt,"instance"),de(Vt,"nodeCache",new Cr.default);var Xe=class{createLocalCacheInstance=e=>typeof window>"u"?Vt.getInstance(e):typeof __DEV__<"u"?ri.getInstance(e):ni.getInstance(e)},oi=class{localCache=null;https=null;constructor(e){this.localCache=new Xe().createLocalCacheInstance(e.idSchema),this.https=new Sr(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)}},li=e=>{switch(e){case"competitions":return"competition";case"players":case"relatedPlayer":case"squad":case"playerStats":return"player";case"teams":case"participants":case"homeTeam":case"awayTeam":case"timeline":case"teamId":return"team";default:return e}},Mr=class{extractedObjIds={};traverse=(e,t)=>(t=li(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"||a==="playerId"?(this.extractedObjIds.hasOwnProperty(t)||(this.extractedObjIds[t]=[]),i&&this.extractedObjIds[t].push(i)):e[a]&&this.traverse(e[a],a)})}},Or=class{replaceObjIdsIndex=null;remappedIdsObj={};traverse=(e,t,a)=>(t=li(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"||a==="playerId"?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)})}},ae=class{idSchema="";idMappingFacade=null;constructor(e){this.idSchema=e.idSchema,this.idMappingFacade=new oi(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 Mr().traverse(a,t);return this.idMappingFacade.getEntitiesByIds(i,"native",this.idSchema).then(s=>new Or().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}},Tt=class{idSchema;idMapping;constructor(e){this.idSchema=e.idSchema,this.idMapping=new ae(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}},ci=class{page=null;limit=null;constructor(e){this.page=e.page?e.page:null,this.limit=e.limit?e.limit:null}},Fr=class extends ci{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}},Ar=class extends ci{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}},kr=class{idSchema;activityHttps;activityService;constructor(e){this.idSchema=e.idSchema,this.activityHttps=new si(e),this.activityService=new Tt(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 Fa(e,n,a,i),l=await this.activityHttps.createActivity(o);return l.context.tags=r,l}let s=new Fa(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 Fr(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 Ar(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)}},Dr=class{activityFacade;constructor(e){this.activityFacade=new kr(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)},di=class{colors=null;urls=null;images=null},pi=class{primaryColor=null;secondaryColor=null;contentColor=null;backgroundColor=null;borderColor=null;additionalColor=null},ui=class{primaryUrl=null;secondaryUrl=null;privacyPolicyUrl=null;termsAndConditionsUrl=null;additionalUrl=null},hi=class{mainLogo=null;mobileLogo=null;backgroundImage=null;mobileBackgroundImage=null;additionalImage=null},Lr=class extends te{clientId=null;clientApiSignInUrl=null;constructor(e){super(e,X(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 di;return e.colors&&(t.colors=new pi,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 ui,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 hi,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}},we=class{brandingHttps;constructor(e){this.brandingHttps=new Lr(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}},xr=class extends te{clientId=null;clientApiSignInUrl=null;constructor(e){super(e,X(e.environment,"client")),this.clientId=e.clientId,this.clientApiSignInUrl=`?key=${e.apiKey}`}getInfoPageByIds=async(e,t)=>{if(!e||e.length===0)return new Map;let a=Array.from(new Set(e)),i=`/clients/${this.clientId}/info-pages${this.clientApiSignInUrl}&limit=50&info_page_ids=${a.join(",")}`;t&&(i+=`&disable_cache=${Date.now()}`);let s=`There was a problem fetching info pages 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=>{n.set(o.id,o.body)}),n}catch(r){return console.warn("Failed to fetch info pages, returning empty map",r),new Map}};getInfoPageById=async(e,t)=>{if(!e)return null;let a=`/clients/${this.clientId}/info-pages/${e}${this.clientApiSignInUrl}`;t&&(a+=`&disable_cache=${Date.now()}`);let i=`There was a problem fetching info page: ${e}`;try{return(await this.fetchWithoutAuth(a,i)).data.body}catch(s){return console.warn(`Failed to fetch info page ${e}, returning null`,s),null}}},_e=class{infoPageHttps;constructor(e){this.infoPageHttps=new xr(e)}async resolveContent(e,t){if(!e.related||e.related.length===0)return e;let a=e.related.find(l=>l.entityType==="info_page"&&l.entityRelationship==="rulesFrom"),i=e.related.find(l=>l.entityType==="info_page"&&l.entityRelationship==="adContentFrom"),s=[],r=a&&(!e.rules||e.rules.trim()===""),n=i&&(!e.adContent||e.adContent.trim()==="");if(r&&s.push(a.entityId),n&&s.push(i.entityId),s.length===0)return e;let o;if(s.length===1){let l=await this.infoPageHttps.getInfoPageById(s[0],t);o=new Map,l&&o.set(s[0],l)}else o=await this.infoPageHttps.getInfoPageByIds(s,t);if(r&&a){let l=o.get(a.entityId);l&&(e.rules=l)}if(n&&i){let l=o.get(i.entityId);l&&(e.adContent=l)}return e}async resolveContentBatch(e,t){if(!e||e.length===0)return e;let a=new Set;if(e.forEach(s=>{if(!s.related||s.related.length===0)return;let r=s.related.find(o=>o.entityType==="info_page"&&o.entityRelationship==="rulesFrom");r&&(!s.rules||s.rules.trim()==="")&&a.add(r.entityId);let n=s.related.find(o=>o.entityType==="info_page"&&o.entityRelationship==="adContentFrom");n&&(!s.adContent||s.adContent.trim()==="")&&a.add(n.entityId)}),a.size===0)return e;let i=await this.infoPageHttps.getInfoPageByIds(Array.from(a),t);return e.forEach(s=>{if(!s.related||s.related.length===0)return;let r=s.related.find(o=>o.entityType==="info_page"&&o.entityRelationship==="rulesFrom");if(r&&(!s.rules||s.rules.trim()==="")){let o=i.get(r.entityId);o&&(s.rules=o)}let n=s.related.find(o=>o.entityType==="info_page"&&o.entityRelationship==="adContentFrom");if(n&&(!s.adContent||s.adContent.trim()==="")){let o=i.get(n.entityId);o&&(s.adContent=o)}}),e}},me=class{entityId=null;entityType=null;entityRelationship=null},pe=class{remapBranding=e=>{let t=new di;return e.colors&&(t.colors=new pi,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 ui,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 hi,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}}},mi=class{participantOne=null;participantTwo=null},Nr=class{matchId="";participantOne="";participantTwo="";winner="";homeParticipant="";startDate="";score=new mi},gi=class{participants=[]},Gr=class{id=null;name=null;group=null;image=null;undecided=!1},$r=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 gi;fixtures=[];branding=null;brandingId=null;createdAt=null;updatedAt=null},Je=class{nextPageStartsAfter=null;itemsPerPage=null},W=class{pagination=new Je},Ur=class{meta=new W;data=[]},Br=class{meta=new W;data=[]},Hr=class{statTiebreakerEnabled;statTotal},Vr=class{matchId="";participantOne="";participantTwo="";winner;correct=null},fi=class{statTotal=0},Wr=(e=>(e.ACTIVE="ACTIVE",e.WON="WON",e.LOST="LOST",e.PARTIALLY_WON="PARTIALLY_WON",e.CANCELED="CANCELED",e))(Wr||{}),zr=class{id="";profileId="";profileModel=null;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new fi;createdAt="";updatedAt=""},qr=class{meta=new W;data=[]},jr=class extends pe{remapBracketGames=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.remapBracketGameById(a)),t};remapBracketGameById=e=>{let t=new $r;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 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 Ur;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 me;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 Vr;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 fi;return t.statTotal=e.stat_total,t};remapBracketGameMeta=e=>{let t=new gi;return t.participants=e.participants.map(a=>{let i=new Gr;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 Nr;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 mi;return t.participantOne=e.participant_one,t.participantTwo=e.participant_two,t};remapBracketGameTiebreaker=e=>{let t=new Hr;return t.statTiebreakerEnabled=e.stat_tiebreaker_enabled,t.statTotal=e.stat_total,t}},yi=class{participants=[]},Qr=class{id=null;title=null;description=null;rules=null;customFields=null;images=null;type="STANDING";status=null;points=null;related=[];predictionsCutoff="";meta=new yi;outcomeCount=null;outcome=[];branding=null;brandingId=null;createdAt=null;updatedAt=null},Yr=class{meta=new W;data=[]},Xr=class{id=null;name=null;group=null;image=null;undecided=!1},Jr=class{id="";profileId="";profileModel=null;total=0;gameId="";totalPoints=null;gamePoints=null;bonusPoints=null;position=null;status="ACTIVE";standing=[];createdAt="";updatedAt=""},Kr=class{meta=new W;data=[]},Zr=class{meta=new W;data=[]},en=class extends pe{remapBracketGames=e=>{let t=new Yr;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 Qr;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 Jr;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 Kr;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 Zr;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 me;return a.entityId=t.entity_id,a.entityType=t.entity_type,a.entityRelationship=t.entity_relationship,a});remapStandingGameMeta=e=>{let t=new yi;return t.participants=e.participants.map(a=>{let i=new Xr;return i.id=a.id,i.name=a.name,i.group=a.group,i.image=a.image,i.undecided=a.undecided,i}),t}},tn=class{meta=new W;data=[]},an=class{statTiebreakerEnabled;statTotal},wi=class{statTotal=0},sn=(e=>(e.ACTIVE="ACTIVE",e.WON="WON",e.LOST="LOST",e.PARTIALLY_WON="PARTIALLY_WON",e.CANCELED="CANCELED",e))(sn||{}),rn=class{id="";profileId="";profileModel=null;gameId="";gamePoints=null;bonusPoints=null;totalPoints=null;position=null;status="ACTIVE";fixtures=[];tiebreaker=new wi;createdAt="";updatedAt=""},nn=class{meta=new W;data=[]},on=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},ln=(e=>(e.BOOLEAN="BOOLEAN",e.NUMBER="NUMBER",e.ENUM="ENUM",e.FREE_INPUT="FREE_INPUT",e))(ln||{}),He=class{id="";question="";status="ACTIVE";voidReason=null;points=0;outcomeType=null;validOutcomes=null;outcome=null},Ve=class{id="";predictionType;prediction;correct=null;points=0},cn=class{meta=new W;data=[]},dn=class extends pe{remapEventGames=e=>{let t=new tn;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 on;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 rn;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 cn;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 nn;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 me;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 Ve;switch(t.prediction_type){case"BOOLEAN":a=new Ve;break;case"NUMBER":a=new Ve;break;case"ENUM":a=new Ve;break;case"FREE_INPUT":a=new Ve;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 wi;return t.statTotal=e.stat_total,t};remapEventGameFixtures=e=>e.map(t=>{let a=new He;switch(t.outcome_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.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 an;return t.statTiebreakerEnabled=e.stat_tiebreaker_enabled,t.statTotal=e.stat_total,t}},pn={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:""},Qt=class extends te{bracketGameRemapper=null;standingGameRemapper=null;eventGameRemapper=null;constructor(e){super(e,X(e.environment,"predictor")),this.bracketGameRemapper=new jr,this.standingGameRemapper=new en,this.eventGameRemapper=new dn}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(pn));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)}},_i=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},un=class extends _i{email=null;phoneNumber=null;phoneCountryCode=null;preferences=null;consentIds=null},hn=class{profilesFromResponse=e=>e?e.map(t=>this.publicProfileFromResponse(t)):null;fullProfileFromResponse=e=>{let t=new un;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 _i;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}))},se=class{meta=new W;data=[]},mn=class{avatar=null;followingId=null;name=null;nickname=null;profileId=null},gn=class{followResponse=e=>e.map(t=>this.remapResponse(t));followingFromResponse=e=>{let t=new se;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 mn;return t.avatar=e.avatar,t.followingId=e.following_id,t.name=e.name,t.profileId=e.profile_id,t.nickname=e.nickname,t}},fn=class{avatar=null;followerId=null;name=null;nickname=null;profileId=null},yn=class{followsMe=[];iFollow=[];followsMeBack=[]},wn=class{followersFromResponse=e=>{let t=new se;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 yn;return t.iFollow=e.i_follow,t.followsMe=e.follows_me,t.followsMeBack=e.follows_me_back,t};remapResponse=e=>{let t=new fn;return t.avatar=e.avatar,t.followerId=e.follower_id,t.name=e.name,t.profileId=e.profile_id,t}},Aa=class{profile_ids=[]},_n=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},vn=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 _n;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}},In=class{consentId="";entityId=null;entityType=null;content=null;consentedAt=""},Tn=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 In;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})}},bn=class{id="";datetime="";status="available"},Pn=class{fromResponse(e){return e.map(t=>{let a=new bn;return a.id=t.id,a.datetime=t.datetime,a.status=t.status,a})}},En="/countries",Q="/profile",rt="/profiles",vi=class extends te{profileRemapper=null;followingRemapper=null;followersRemapper=null;leadRemapper=null;consentRemapper=null;externalActivityRemapper=null;lang=null;limitIds=100;constructor(e){super(e,X(e.environment,"profile")),this.lang=e.lang,this.profileRemapper=new hn,this.followingRemapper=new gn,this.followersRemapper=new wn,this.leadRemapper=new vn,this.consentRemapper=new Tn,this.externalActivityRemapper=new Pn}getCountries=async e=>{let t=`&lang=${this.lang}`,a=`${En}${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=`${Q}${this.apiSignInUrl}`,a="";if(e){t=`${rt}/${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=Ae(e,this.limitIds);for(let p of d){let m=`${rt}${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=`${rt}${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=`${rt}${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=`${Q}/followers${this.apiSignInUrl}`,i="There was a problem fetching the followers for own profile";if(e&&!t){a=`${Q}/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=`${Q}/${t}/followers${this.apiSignInUrl}${e.constructFilterUrl()}`:!e&&t&&(a=`${Q}/${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=`${Q}/following${this.apiSignInUrl}`,i="There was a problem fetching the followers of own profile";if(e&&!t){a=`${Q}/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=`${Q}/${t}/following${this.apiSignInUrl}${e.constructFilterUrl()}`:!e&&t&&(a=`${Q}/${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 Aa;t.profile_ids=e;let a=Q+`/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 Aa;t.profile_ids=e;let a=Q+`/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=`${Q}/badges${this.apiSignInUrl}`,a="There was a problem with fetching own badges";return e?(t=`${Q}/${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=Q+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=Q+`/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=Q+`/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=Q+`/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}},Rn=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)},Sn=class{totalPercentage;breakdown=new Rn},ka=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},bt=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 k(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 ka(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 ka(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 Sn,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 k(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 k(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 k(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}}},Cn=class{id=null;name=null;assets=null},Mn=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}}},On=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 Mn,this.profileFacade=new bt(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 Cn,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 k(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}},Ii=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 bt(t,a,i)}getById=e=>new Ii(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)},Fn=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}}},Da=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}},An=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 Da(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 Da({competitionIds:e,limit:a}),s=await this.getCompetitions(i);s.sort((o,l)=>o.id.localeCompare(l.id));let r=Xa(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}}},La=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}},kn=class{reason="";words=[]},Ti=class{enabled=!1;moderateLinks=!1;linksWhitelist=[];moderatorProfileId="";dictionary=new kn},Dn=class{enabled=!1;clientId=null;automaticModeration=new Ti},Yt=class{points=null;gameParticipationCount=null;entityId=null;entityType=null;predictionsMade=null;correctPredictions=null},Ln=class{id;weight;multiplier;conditions},bi=class{value=[new Ln]},Pi=class{points=null;tiers=null;badges=null},xn=class{enabled=!1;clientId=null;conditions={list:null};actions=new bi;rewards=new Pi},Nn=class{general=null;predictor=null;activity=null;topX=null;matchQuiz=null;discussionPost=null},Ei=class{enabled=!1;clientId=null;defaultMarkets=null;competitionsWhitelist=null;authRequirement=null},Ri=class{enabled=!1;clientId=null;minFixtures=null;maxFixtures=null;competitionsWhitelist=null;authRequirement=null},Gn=class{competitions=[];teams=[];markets=[]},Si=class{enabled=!1;clientId=null;fullCoverageCompetitions=null;markets=null;successRateScopes=new Gn;userDataConfig=null},$n=class{storeIp=!1;storeDeviceId=!1;storeAgent=!1},Un=class{potm=[];poll=[]},Bn=class{predictor=[];topX=[];matchQuiz=[];games=[];football=[];classicQuizzes=[];eitherOr=[];discussions=[];voting=new Un},Pe=class{id;label;description;flags;assets={mainImageUrl:""};enabled},Hn=class{predictionsNumber;correctPredictions;points;fromDate;toDate},Vn=class extends Pe{requirements=new Hn},Wn=class{participationCount;points;fromDate;toDate},zn=class extends Pe{requirements=new Wn},qn=class{participationCount;points;specificGames;fromDate;toDate},jn=class extends Pe{requirements=new qn},Qn=class{predictionsNumber;correctPredictions;points;entityId;entityType;entityModel=null},Yn=class extends Pe{requirements=new Qn},Xn=class{participationCount;fromDate;toDate},Jn=class extends Pe{requirements=new Xn},Kn=class{totalDiscussionPoints;postsCount;postPoints;reactionsCount},Zn=class extends Pe{requirements=new Kn},eo=class{points;voteCount;entityId;entityType;entityModel},to=class extends Pe{requirements=new eo},Ci=class{points=null;tiers=null;badges=null},ao=class{enabled=!1;clientId=null;conditions={list:null};actions=new bi;rewards=new Ci},io=class{general=[];predictor=[];topX=[];matchQuiz=[]},so=class{id;label;assets={mainImageUrl:""};enabled;requirements=new Yt},Mi=class extends Yt{postPoints=null;postsCount=null;reactionsCount=null;totalDiscussionPoints=null},ro=class{id;label;assets={mainImageUrl:""};enabled;requirements=new Mi},Oi=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},Fi=class{total=null;minGoalkeepers=null;maxGoalkeepers=null;minDefenders=null;maxDefenders=null;minMidfielders=null;maxMidfielders=null;minStrikers=null;maxStrikers=null},no=class{enabled=!1;clientId=null;addPointsToProfileTotal=!1;coefficients=new Oi;players=new Fi;multipliers=null;competitionsWhitelist=[]},oo=class{captain=null;viceCaptain=null},lo=class{remapPredictorConfig=e=>{let t=new Si;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 Ri;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 Ei;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 xn;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 ao;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 Dn;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 no;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 Fi;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 Oi;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 Ti;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 Ci;return t.points=this.remapPoints(e.points),t.tiers=e.tiers,t.badges=this.remapNewBadges(e.badges),t};remapRewards=e=>{let t=new Pi;return t.points=this.remapPoints(e.points),t.tiers=e.tiers,t.badges=this.remapBadges(e.badges),t};remapPoints=e=>{let t=new Nn;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 io;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 Bn;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 Vn;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 zn;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 jn;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 Yn;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 Jn;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 Zn;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 to;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 so;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 Yt;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 $n;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 ro;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 Mi;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 oo;return t.captain=e.captain,t.viceCaptain=e.vice_captain,t}},co=class{entityId;entityType;entityModel=null},po=class{id=null;source=null;type=null},H=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}},uo=class extends H{},ho=(e=>(e.PARTICIPANT_ONE="PARTICIPANT_ONE",e.PARTICIPANT_TWO="PARTICIPANT_TWO",e.DRAW="DRAW",e))(ho||{}),mo=class{matchId="";participantOne="";participantTwo="";winner="PARTICIPANT_ONE"},Ke=(e=>(e.OPEN="OPEN",e.LIVE="LIVE",e.PENDING="PENDING",e.CANCELED="CANCELED",e.CLOSED="CLOSED",e.SETTLED="SETTLED",e))(Ke||{}),go=class extends H{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(Ke).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}},fo=class{profileId="";profileModel=null;challengeId="";challengeModel=null;message=""},Ai=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];scoring_starts_at=""},yo=class extends Ai{type="ONE_VS_ONE"},ki=class{name="";description="";invitation_code="";template_id="";users_can_invite_users=!1;administrators=[];pinned_posts=[];scoring_starts_at=""},wo=class extends ki{type="ONE_VS_ONE"},_o=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}},vo=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}},Io=class{templateId="";templateModel=null;challengeId="";challengeModel=null;position="";points=0;type="challenge"},To=class{id="";label="";discussionType="LEAGUE";discussionUrl=null;moderationType="USER";postsCount=0;pinnedPosts=[];lastPostId="";status="";deleted=!1;deletedAt="";deletedBy="";customFields=null;context=null;createdAt="";updatedAt=""},Di=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=""},bo=class extends Di{userModel=null},Po=class{content="";reply_id="";discussion_label="";discussion_url="";anonymous_nickname="";context=null},Eo=class{id="";postsCount=0},Xt=class{pagination={totalItems:0,nextPageStartsAfter:"",lastCommentCreateTimestamp:""}},Ro=class{meta=new Xt;data=[]},So=class{meta=new Xt;data=[]},Co=class{meta=new W;data=[]},Mo=class{type="";userIds=[];reactionCount=0},Oo=class{userId=null;reason="AD";reasonDetails=null},Fo=class{updatedAt="";content=""},Ao=["CREATED_AT_ASC","CREATED_AT_DESC","POSTS_COUNT_ASC","POSTS_COUNT_DESC"],ko=["ACTIVE","INACTIVE"],Do=class extends H{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&&Ao.includes(this.sort.toUpperCase())&&(e+=`&sort=${this.sort.toUpperCase()}`),this.status&&ko.includes(this.status.toUpperCase())&&(e+=`&status=${this.status.toUpperCase()}`),this.skipDeleted!==null&&(e+=`&skip_deleted=${this.skipDeleted}`),e}},nt=class extends H{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}},Lo=class extends H{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}},xo=class extends H{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(Ke).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}},No=class extends H{},Go=class extends H{},$o=class{templateId=null;playerId=null},Uo=class{filters=new $o},Bo=class{meta=new Uo;data=[]},Ho=class{key=null;label=null;value=null},Vo=class{templateId=null},Wo=class{filters=new Vo},zo=class{meta=new Wo;data=[]},Li=class{template_id=null;group_id=null;fixtures=[]},xi=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},Jt=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},qo=class{matchId=null;matchModel=null;points=new xi;stats=new Jt},jo=class{playerId=null;playerModel=null;points=null;rank=null},Qo=class{id="";country=null;gender="";assets=null;type="";name=""},Yo=class{id="";country=null;gender="";assets=null;type="";name="";participants=[]},Xo=class{id="";alias="";countryCode="";assets=null;name=""},Le=class{type=null;subType=null},Jo=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 Le},Ko=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 Le;lineups=null},je=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}},Zo=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},el=class{ftScore=null;htScore=null;aetScore=null;aggScore=null;penScore=null},Ni=class{homeTeam={players:[]};awayTeam={players:[]}},tl=class{minute="";type="";teamId="";player=null;relatedPlayer=null;updatedAt=""},al=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},il=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;teams=[]},sl=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null;isDeleted=!1;competitions=[];teams=[]},rl=class{id="";startDate="";endDate="";shirtNumber;loan=!1;position="";country=null;name="";assets=null;birthDate=""},nl=class{id="";country=null;birthDate="";firstName="";lastName="";name="";position="";assets=null},xa=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}},ol=class{id="";name="";position="";shirtNumber;assets=null;type=""},ll=class{id="";country=null;gender="";assets=null;name="";code="";national=!1;undecided=!1;fullName="";shortName="";isDeleted=!1},cl=class{primary=null;secondary=null;tertiary=null},dl=class{id="";country=null;gender="";assets=null;name="";competitions=[];code="";national=!1;fullName="";shortName="";isDeleted=!1;undecided=!1;colors=new cl;squad=[]},pl=class{teams=null;players=null;competitions=null},ul=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}},ot=class{meta=new ye;data=[]},Ee=class{main=null;cover=null;mobile=null},hl=class{input=null;output=null},ml=class{meta=new hl;data=[]},gl=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}},fl=class{general;predictor;topX;matchQuiz},yl=class{predictor;topX;matchQuiz;games;football;classicQuizzes;eitherOr;discussions;potm;poll},wl=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}},_l=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}},vl=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}},Il=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}},Tl=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}},bl=class{position=null;points=null;predictionsMade=null;profileId=null;profileModel=null;successRatePercent=null},Pl=class{templateId=null;privateLeagueId=null;fromDate=null;toDate=null;pagination=new De},El=class{rankType=null;fromDate=null;toDate=null;pagination=new De},Gi=class{position=null;profileId=null;profileModel=null;points=null;predictionsMade=null},Rl=class{flags="";status="";type="";activeFrom="";activeTo="";createdFrom="";createdTo="";updatedFrom="";updatedTo=""},Sl=class{pagination=new De;filters=new Rl},Cl=class extends Gi{id=null;rankType=null;model=null;gameType=null},Ml=class{groupId;averagePoints;highestPoints},$i=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 Ee;status=null;automaticallyChangeStatus=!0;createdAt=null;updatedAt=null;related=null},Ol=class extends $i{adContent=null},Fl=class{groupId=null;label=null;flags=[];filters=null},Al=class{fromDate=null;toDate=null;matchIds=[]},kl=class{value=null;target=null;playerId=null;playerModel=null;result=null},Dl=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new Le;prediction=new kl},Ll=class{gameId=null;results=null;tieBreakers=null},Pt=class{timeTiebreaker=!1},qe=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new Pt;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},Ui=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new Ee;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},Kt=class extends H{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}},xl=class extends Kt{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}},Nl=class extends Ui{rules=null;questions=[]},Gl=class{questionId=null;question=null;images=null;embedCode=null;explanation=null;options=[]},$l=class{optionId=null;option=null;images=null;correct=null},Ul=class{classicQuizId=null;userId=null;questions=[];correctOptions=null;personalBest=null;points=null;attempts=null},Bl=class{questionId=null;optionId=null;correct=null;correctOptionId=null},Na=class extends H{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}},Ga=class{classicQuizId=null;classicQuizModel=null;correct=null;classicQuizQuestions=null;personalBest=null;points=null;answers=[];attempts=0},Hl=class{meta=new W;data=[]},Vl=class{questionId=null;questionModel=null;wrong=null;correct=null;skipped=null;total=null},Bi=class{classicQuizIds=null},Hi=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}},Wl=class extends Hi{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}},zl=class{pagination=new De;filters=new Bi},ql=class{position=null;profileId=null;profileModel=null;points=null},jl=class{position=null;classicQuizId=null;classicQuizModel=null;points=null},Vi=class{id="";title="";alternativeTitle="";description="";images=new Ee;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=""},Ql=class extends Kt{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}},Yl=class extends Vi{rules=""},Xl=class{correctSteps=0;score=0},Jl=class{eitherOrId="";personalBest=0;betterThan=0},Kl=class{instanceId="";eitherOrId="";gameStartedAt="";currentStep=0;currentStreak=0;remainingSteps=0;currentLives=0;currentPoints=0;personalBest=0;participationCount=0;finishedParticipationsCount=0;steps=[]},Zl=class{pair="";answer=""},ec=class extends Zl{expired=!1;time=0},tc=class{main;mobile},$a=class{id="";label="";images=new tc;value=null},ac=class{pairId="";userSelection="";correct=null;played=null;timestamp="";expired=null;optionOne=new $a;optionTwo=new $a},ic=class{rangeStartInclusive=0;rangeEndInclusive=0;totalUsers=0},sc=class{standings=[];breakdown=[]},rc=class{userId="";userModel=null;personalBest=""},Zt=class{content=null;tags=[];campaign=null},ea=class{id=null;model=null;source=null;type=null},nc=class{questions=null;correctAnswers=null},Wi=class{id=null;title=null;alternativeTitle=null;description=null;images=new Ee;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},oc=class{personaId=null;title=null;description=null;images=null},lc=class{questionId=null;question=null;images=null;explanation=null;options=[]},cc=class{personaId=null;points=null},dc=class{optionId=null;option=null;images=null;personaPoints=[];preferencesMapping=[]},pc=class extends Wi{rules=null;questions=[];personaResults=[]},uc=class extends Kt{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}},hc=class{personalityQuizId=null;userId=null;questions=[];personas=[];attempts=null},mc=class{questionId=null;optionId=null},gc=class{personaId=null;percent=null},fc=class extends H{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}},yc=class{meta=new W;data=[]},wc=class{id=null;name=null;url=null;assets=[];links=[];branding=null;eventUrls=[];stakesDisclaimer=null;domainName=null},_c=class{backgroundColor=null;textColor=null},vc=class{logo=null;type=null;transparentBackgroundUrl=null;backgroundColor=null},Ic=class{url=null;appType=null},zi=(e=>(e.PRE_EVENT="PRE_EVENT",e.LIVE="LIVE",e.ALL="ALL",e))(zi||{}),qi=(e=>(e.ORDINARY_TIME="ORDINARY_TIME",e.FULL_TIME="FULL_TIME",e))(qi||{}),ji=(e=>(e.DECIMAL="DECIMAL",e.MONEYLINE="MONEYLINE",e.FRACTIONAL="FRACTIONAL",e))(ji||{}),Qi=(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))(Qi||{}),Tc={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"},bc=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(zi),a=Object.values(qi),i=Object.values(ji),s=Object.values(Qi);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":Tc[e]}},Pc=class{type=null;scope=null;selections=[]},Ec=class{id=null;type=null;name=null;entityType=null},Rc=class{id=null;name=null;code=null;value=null;odds=null;urls=[];movement=null;oddsOld=null;entityType=null;additionalInfo=null;providerInfo=null},Sc=class{id=null;name=null;code=null;entityType=null},Cc=class{selectionId=null;eventId=null;marketId=null;competitionId=null},Mc=class{bookmaker=null;type=null;markets=[]},Oc=class{value=null;playerId=null;playerModel=null;playerRole},Yi=class{market=null;matchId=null;matchType=null;matchModel=null;prediction=new Oc;result=null},Xi=class{settledAt=null;resettledAt=null;status=null;outcome=null;points=0},Ze=class{value=!1},Fc=class{matchId=null;market="BOTH_TEAMS_SCORE";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new Ze,this.prediction.value=t}},Ac=class{value},kc=class{matchId=null;market="CORNERS_MATCH";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new Ac,this.prediction.value=t}},Dc=class{value=null},ta=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}},Lc=class{value=null},xc=class{matchId=null;market="DOUBLE_CHANCE";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new Lc,this.prediction.value=t}},Nc=class{value=null},Gc=class{matchId=null;market="HT_FT";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new Nc,this.prediction.value=t}},$c=class{value=null},Uc=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,a){this.matchId=e,this.market=t,this.prediction=new $c,this.prediction.value=a}},Ji=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,a){this.matchId=e,this.market=t,this.prediction=new Ze,this.prediction.value=a}},Ki=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,a){this.matchId=e,this.market=t,this.prediction=new Ze,this.prediction.value=a}},Bc=class{matchId=null;market="PENALTY_MATCH";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new Ze,this.prediction.value=t}},Hc=class{value=!1;playerId=null},ke=class{matchId=null;market=null;matchType="FOOTBALL";prediction=null;constructor(e,t,a,i){this.matchId=e,this.market=t,this.prediction=new Hc,this.prediction.value=a,this.prediction.playerId=i}},Vc=class{matchId=null;market="RED_CARD_MATCH";matchType="FOOTBALL";prediction=null;constructor(e,t){this.matchId=e,this.prediction=new Ze,this.prediction.value=t}},At=class{homeGoals=null;awayGoals=null},Wc=class{playerId=null;playerModel=null},zc=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 Wc;PLAYER_SCORE=[];PLAYER_SCORE_TWICE=[];PLAYER_SCORE_HATTRICK=[];CORRECT_SCORE=new At;CORRECT_SCORE_ADVANCED=new At;CORRECT_SCORE_HT=new At;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},z=class{no=0;yes=0},Zi=class{gameInstanceId=null;fixtures=null},Et=class{goldenGoal=null},Ua=class{id=null;gameInstanceId=null;gameType=null;wager=null;totalFixtures=null;settledFixtures=null;userId=null;fixtures=[];status=null;tiebreaker=new Et;points=null;templateId=null;groupId=null;profileLastUpdatedAt=null;createdAt=null;updatedAt=null},es=(e=>(e.ACTIVE="ACTIVE",e.WON="WON",e.LOST="LOST",e.PARTIALLY_WON="PARTIALLY_WON",e.CANCELED="CANCELED",e))(es||{}),Ba=["WON","LOST","PARTIALLY_WON","CANCELED"],Y=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(es).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}},qc=class{fullTimeOneXTwo={};halfTimeOneXTwo={};bothTeamsScore=new z;doubleChance={};halfTimeFullTime={};playerScore={};playerYellowCard={};playerRedCard={};redCardMatch=new z;penaltyMatch=new z;playerScoreFirstGoal={};cornersMatch={};correctScore={};correctScoreHalfTime={};correctScoreAdvanced={};playerScoreHattrick={};playerScoreTwice={};overZeroPointFiveGoals=new z;overOnePointFiveGoals=new z;overTwoPointFiveGoals=new z;overThreePointFiveGoals=new z;overFourPointFiveGoals=new z;overFivePointFiveGoals=new z;overSixPointFiveGoals=new z;overSixPointFiveCorners=new z;overSevenPointFiveCorners=new z;overEightPointFiveCorners=new z;overNinePointFiveCorners=new z;overTenPointFiveCorners=new z;overElevenPointFiveCorners=new z;overTwelvePointFiveCorners=new z;overThirteenPointFiveCorners=new z},jc=class{matchId=null;matchType=null;predictions=null},Qc=class{profileId="";profileModel=null;leagueId="";leagueModel=null;message=""},ts=class{id="";name="";description="";type="";banned=[];invites=[];administrators=[];membersCount=0;invitationCode="";templateId="";templateModel=null;pastTemplates=[];usersCanInviteUsers=!1;scoringStartsAt="";pinnedPosts=[]},Yc=class extends ts{members=[]},Xc=class{predictionId=null;predictionModel=null;profileId=null;profileModel=null},as=class extends H{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}},Jc=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}},Kc=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}},is=class extends H{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}},ss=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}},Zc=class{templateId="";templateModel=null;privateLeagueId="";privateLeagueModel=null;position="";points=0;type="private_league"},ed=class extends Ai{type="PRIVATE"},td=class extends ki{type="PRIVATE"},ad=class{id="";source="";type="";favourite=!1},id=class extends ad{model=null},sd=class extends H{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(Ke).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}},rd=class extends H{},nd=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new Le},od=class{value=null;result=null},ld=class{matchId=null;matchType=null;market=null;matchModel=null;matchStatus=new Le;prediction=new od},yt=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;scheduleOpenAt=null;predictionsCutoff=null;fixtures=[];tiebreaker=new Pt;participantsCount=0;related=[];excludedProfileIds=null;rules=null;labels=null;customFields=null;branding=null;brandingId=null;flags=null;images=new Ee;createdAt=null;updatedAt=null},rs=class extends yt{adContent=null},Wt=class{userId=null;points=null;results=[];tiebreaker=null},cd=class{matchId=null;matchModel=null;outcome=null},oe=class extends H{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(Ke).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}},ut=class{id=null;title=null;description=null;type=null;status=null;authRequirement=null;outcome=null;predictionsCutoff=null;fixtures=[];tiebreaker=new Pt;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 Et;branding=null;brandingId=null},dd=class{contestId="";contestType="GAME";contestModel=null;description="";userList=[]},pd=class{position="";profileId="";profileModel=null;note="";tags=[]},ns=class{gameInstanceId=null;fixtures=[];tiebreaker=null;constructor(e){this.gameInstanceId=e.gameInstanceId,e.fixtures.forEach(t=>this.fixtures.push(new ta(t.matchId,t.market,t.prediction.value))),this.tiebreaker=e.tiebreaker?e.tiebreaker:null}},kt=class extends H{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}},os=class{id=null;title=null;alternativeTitle=null;description=null;type=null;images=new Ee;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},ud=class extends os{rules=null},hd=class{id=null;title=null;description=null;images=new Ee;votes=null;embedCode=null;preferencesMapping=[]},ls=class{preferenceId=""},aa=class{id=null;pollId=null;optionId=null;optionIds=[];userId=null;createdAt=null},md=class extends aa{pollModel=null;optionModel=null;optionsModels=[];previousVotes=[];attempts=null},gd=class extends aa{previousVotes=[];attempts=null},fd=class{meta=new W;data=[]},yd=class{meta=new W;data=[]},wd=class extends H{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}},_d=class{meta=new W;data=[]},vd=class{matchId=null;matchModel=null;playerId=null;playerModel=null;createdAt=null},Id=class{total},Td=class{meta=new Id;data=[]},bd=class{teamId=null;teamModel=null;playerId=null;playerModel=null;votes=null;winner=null},Pd=class{meta=new ye;data=[]},Ed=class{remapListContent=e=>{let t=new Pd;return t.meta=this.remapMeta(e.meta),t.data=e.data.map(a=>{let i=new co;return i.entityId=a.entity_id,i.entityType=a.entity_type,i}),t};remapMeta=e=>{let t=new ye;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}},Rd=class extends pe{remapBranding=e=>this.remapBranding(e)},ve=class extends te{featureConfigRemapper=null;listContentRemapper=null;brandingRemapper=null;localStorage=null;clientId=null;clientApiSignInUrl=null;constructor(e){super(e,X(e.environment,"client")),this.clientId=e.clientId,this.localStorage=new Xe().createLocalCacheInstance(e.idSchema),this.featureConfigRemapper=new lo,this.listContentRemapper=new Ed,this.brandingRemapper=new Rd,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}},Rt=class{clientHttps=null;errorHandlingMode=null;constructor(e){this.clientHttps=new ve(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 ye;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 k(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}},Sd=class{footballService=null;https=null;idMapping=null;constructor(e,t,a){this.idMapping=a,this.https=t,this.footballService=new Rt(e)}getTeamsIdMapping=async(e,t)=>{try{let a=!1;if(e){if(e=new La(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 La({teamIds:e,limit:a}),{data:s}=await this.getTeams(i);s.sort((o,l)=>o.id.localeCompare(l.id));let r=Xa(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}}},ia=class{https=null;footballService=null;idMapping=null;constructor(e,t,a){this.idMapping=a,this.https=t,this.footballService=new Rt(e)}getPlayersIdMapping=async(e,t)=>{try{let a=!1;if(e){if(e=new xa(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 xa({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=vt(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}}},sa=class{https=null;idMapping=null;footballService=null;constructor(e,t,a){this.https=t,this.idMapping=a,this.footballService=new Rt(e)}getMatchesIdMapping=async(e,t)=>{try{if(e){if(e=new je(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 je({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=vt(e);a.sort((s,r)=>s.localeCompare(r));let i=await this.getMatchesWithNativeIds(Array.from(a));if(a.length!==i.length){let s=new je({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}}},Cd=class{https=null;idMapping=null;constructor(e,t){this.https=e,this.idMapping=t}searchIdMapping=async(e,t)=>{try{if(e=new ul(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}}},Re=class{errorHandlingModel=null;constructor(e){this.errorHandlingModel=e}throwException=(e,t,a)=>{throw this.errorHandlingModel==="standard"?new k(e,t,a):new x(e,t,a)}},Md=class extends Re{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()))}},cs=class{countriesFacade=null;competitionsFacade=null;teamsFacade=null;playerFacade=null;matchFacade=null;searchFacade=null;validator=null;constructor(e,t,a,i){this.countriesFacade=new Fn(t,a,i),this.competitionsFacade=new An(t,a,i),this.teamsFacade=new Sd(e,a,i),this.playerFacade=new ia(e,a,i),this.matchFacade=new sa(e,a,i),this.searchFacade=new Cd(a,i),this.validator=new Md(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}},ge=class{countriesFromResponse=e=>{if(e)return e.map(t=>this.countryFromResponse(t))};countryFromResponse=e=>{try{if(e){let t=new Xo;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}},xe=class{countryRemapper=null;constructor(){this.countryRemapper=new ge}fromResponse(e){try{let t=new Qo;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}}},Se=class{countryRemapper=null;constructor(){this.countryRemapper=new ge}fromResponse(e){try{let t=new ll;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}}},Od=class{countryRemapper=null;teamBasicRemapper=null;constructor(){this.countryRemapper=new ge,this.teamBasicRemapper=new Se}fromResponse(e){try{let t=new Yo;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}}},Fd=class{countryRemapper=null;constructor(){this.countryRemapper=new ge}fromResponse(e){try{let t=new rl;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}}},Ad=class{countryRemapper=null;competitionRemapper=null;playerRemapper=null;constructor(){this.countryRemapper=new ge,this.competitionRemapper=new xe,this.playerRemapper=new Fd}fromResponse(e){try{let t=new dl;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}}},ds=class{fromResponse(e){try{let t=new el;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})},kd=class{teamRemapper=null;competitionRemapper=null;scoresRemapper=null;constructor(){this.teamRemapper=new Se,this.competitionRemapper=new xe,this.scoresRemapper=new ds}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=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}}},Dd=class{fromResponse(e){try{let t=new Zo;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})},ps=class{fromResponse(e){try{let t=new ol;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}}},Ld=class{playerRemapper=null;constructor(){this.playerRemapper=new ps}fromResponse(e){try{let t=new Ni;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}}},xd=class{playerRemapper=null;constructor(){this.playerRemapper=new ps}fromResponse(e){try{let t=new tl;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}}},Nd=class{fromResponse(e){try{let t=new al;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}}},Gd=class{teamMapper=null;competitionsMapper=null;lineupsMapper=null;scoresMapper=null;statsMapper=null;timelineMapper=null;playerStatsMapper=null;constructor(){this.teamMapper=new Se,this.competitionsMapper=new xe,this.lineupsMapper=new Ld,this.scoresMapper=new ds,this.statsMapper=new Dd,this.timelineMapper=new xd,this.playerStatsMapper=new Nd}fromResponse(e){try{let t=new Ko;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 Ni,t}catch(t){throw console.warn("There was a problem remapping the match response",t),t}}},$d=class{countryRemapper=null;constructor(){this.countryRemapper=new ge}fromResponse(e){try{let t=new nl;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}}},us=class{countryRemapper=null;teamRemapper=null;constructor(){this.countryRemapper=new ge,this.teamRemapper=new Se}fromResponse(e){try{let t=new il;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}}},Ud=class{countryRemapper=null;teamRemapper=null;competitionRemapper=null;constructor(){this.countryRemapper=new ge,this.teamRemapper=new Se,this.competitionRemapper=new xe}fromResponse(e){try{let t=new sl;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}}},Bd=class{teamRemapper=null;playerRemapper=null;competitionremapper=null;constructor(){this.teamRemapper=new Se,this.playerRemapper=new us,this.competitionremapper=new xe}fromResponse(e){try{let t=new pl;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}}},Hd=class{remapMetaProp=e=>{let t=new ye;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}},Vd=class{remapPlayersPoints=e=>{let t=new zo;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 jo;return t.playerId=e.player_id,t.points=e.points,t.rank=e.rank,t};remapPlayerDetailedStats=e=>{let t=new Bo;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 qo;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 xi;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 Jt;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}},et=class extends te{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,X(e.environment,"football")),this.apiSignInUrl=e.lang!=="en"?this.apiSignInUrl+`&lang=${e.lang}`:this.apiSignInUrl,this.countryRemapper=new ge,this.competitionBasicRemapper=new xe,this.competitionFullRemapper=new Od,this.teamBasicRemapper=new Se,this.teamFullRemapper=new Ad,this.matchBasicRemapper=new kd,this.matchFullRemapper=new Gd,this.playerBasicRemapper=new us,this.playerFullRemapper=new Ud,this.topPlayerRemapper=new $d,this.searchRemapper=new Bd,this.footballMetaRemapper=new Hd,this.footballService=new Rt(e),this.fantasyRemapper=new Vd}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=Ae(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=Ae(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 ot,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=Ae(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 ot;return o.data=n,o}else{let s=new ot,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 ot,i="There was a problem with football matches request";if(e&&e.matchIds&&e.matchIds.length>this.limitIds){let s=[],r=Ae(e.matchIds,this.limitIds);for(let o of r){let l=new je({...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)}},Wd=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 id;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)},zd=class{idMapping=null;profileOperations=null;constructor(e,t){this.idMapping=new ae(e),this.profileOperations=new Wd(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 vi(e),this.activityHttps=new si(e),this.footballHttps=new et(e),this.idMapping=new ae(e),this.localCache=new Xe().createLocalCacheInstance(e.idSchema),this.footballFacade=new cs(e,this.localCache,this.footballHttps,this.idMapping),this.profileFacade=new bt(this.localCache,this.profileHttps,this.activityHttps,e.errorHandlingMode),this.idsRemapper=new zd(e,this.footballFacade),this.ownProfileBuilder=new On(e,this.idsRemapper,this.localCache,this.profileHttps,this.activityHttps),this.profileBuilder=new Ii(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)},qd=class extends H{},jd=(e=>(e.LIKE="like",e.DISLIKE="dislike",e.SHARE="share",e.COMMENT="comment",e.PREDICTION_MADE="prediction_made",e))(jd||{}),Qd=(e=>(e.CORRECT="CORRECT",e.INCORRECT="INCORRECT",e.PARTIALLY_CORRECT="PARTIALLY_CORRECT",e.NOT_VERIFIED="NOT_VERIFIED",e))(Qd||{}),hs=(e=>(e.ONE="1",e.X="x",e.TWO="2",e))(hs||{}),ms=(e=>(e.ONE_X="1x",e.X_TWO="x2",e.ONE_TWO="12",e))(ms||{}),gs=(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))(gs||{}),Yd=(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))(Yd||{}),Xd=class extends Re{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 mo);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")}},Jd=class{https=null;validator=null;profile=null;brandingResolver=null;infoPageContentResolver=null;constructor(e){this.https=new Qt(e),this.profile=new le(e),this.validator=new Xd(e.errorHandlingMode),this.brandingResolver=new we(e),this.infoPageContentResolver=new _e(e)}getGames=async(e,t)=>{e&&(e=new go(e));let a=await this.https.getBracketGames(e,t),i=await this.brandingResolver.resolveBrandingBatch([...a.data],t);return i=await this.infoPageContentResolver.resolveContentBatch([...i],t),a.data=i,a};getGameById=async(e,t)=>{let a=await this.https.getBracketGameById(e,t);return await this.brandingResolver.resolveBranding(a,t),await this.infoPageContentResolver.resolveContent(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 uo(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 qd(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}},Kd=class{facade=null;constructor(e){this.facade=new Jd(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)},Zd=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 El;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 Pl;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 Gi;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 Ml;return t.groupId=e.group_id,t.averagePoints=e.average_points,t.highestPoints=e.highest_points,t}},ep=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 ye;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 Cl;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 Zc;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 Io;i.templateId=a.template_id,i.challengeId=a.private_league_id,i.position=a.position,i.points=a.points,t.push(i)}),t}},tp=class extends pe{remapResponse=e=>{let t=[];return e.forEach(a=>{let i=new $i;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 Ol;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 Sl;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 me;return a.entityId=t.entity_id,a.entityType=t.entity_type,a.entityRelationship=t.entity_relationship,a});remapGroups=e=>e.map(t=>{let a=new Fl;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 Al;return t.fromDate=e.from_date,t.toDate=e.to_date,t.matchIds=e.match_ids,t}},ap=class{remapHighestSuccessRate=e=>e.map(t=>{let a=new bl;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})},St=class extends te{templateRemapper=null;leaderboardRemapper=null;rankingsRemapper=null;highestSuccessRateRemapper=null;constructor(e){super(e,X(e.environment,"loyalty")),this.templateRemapper=new tp,this.leaderboardRemapper=new Zd,this.rankingsRemapper=new ep,this.highestSuccessRateRemapper=new ap}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)}},ip=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 W;return t.pagination.itemsPerPage=e.items_per_page,t.pagination.nextPageStartsAfter=e.next_page_starts_after,t};remapToPrivateLeagueById=e=>{let t=new Yc;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 ts;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 Qc;return t.profileId=e.profile_id,t.leagueId=e.league_id,t.message=e.message,t};remapToAcceptChallenge=e=>{let t=new fo;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 ye;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 Xc;return a.predictionId=t.prediction_id,a.profileId=t.profile_id,a})},fs=class{remapToDiscussions=e=>(e.meta=this.remapToMeta(e.meta),e.data=e.data.map(t=>this.remapToDiscussionById(t)),e);remapToDiscussionById=e=>{let t=new To;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 Ro,i=new So;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 Co;return t.meta=this.remapToMeta(e.meta),t.data=e.data.map(a=>this.remapToPostByIdBasic(a)),t};remapToPostMeta=e=>{let t=new Xt;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 W;return t.pagination.itemsPerPage=e.pagination.items_per_page,t.pagination.nextPageStartsAfter=e.pagination.next_page_starts_after,t};remapToPostByIdBasic=e=>{let t=new Di;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 bo;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 Eo;return a.id=t.id,a.postsCount=t.posts_count,a});remapReactionsPost=e=>{let t=new Mo;return t.type=e.type,t.userIds=e.user_ids,t.reactionCount=e.reaction_count,t};remapVersionsPost=e=>{let t=new Fo;return t.content=e.content,t.updatedAt=e.updated_at,t};remapReportPost=e=>{let t=new Oo;return t.userId=e.user_id,t.reason=e.reason,t.reasonDetails=e.reason_details,t}},ys=class extends te{remapper=null;discussionsRemapper=null;discussionsBaseURL=null;constructor(e){super(e,X(e.environment,"privateLeagues")),this.discussionsBaseURL=X(e.environment,"discussions"),this.remapper=new ip,this.discussionsRemapper=new fs}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)}},ws=class{createRequestBodyFromParam=(e,t)=>{let a=t==="PRIVATE"?new ed:new yo;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 td:new wo;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}},sp=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)}},rp=class{matchStatusHelper;constructor(){this.matchStatusHelper=new sp}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)}},Ne=class{https=null;idMapping=null;localCache=null;footballFacade=null;footballHelpers;constructor(e){this.https=new et(e),this.idMapping=new ae(e),this.localCache=new Xe().createLocalCacheInstance(e.idSchema),this.footballFacade=new cs(e,this.localCache,this.https,this.idMapping),this.footballHelpers=new rp}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}},np=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 ke)t.market=e.market,t.prediction=e.prediction.value,t.player_id=e.prediction.playerId;else if(e instanceof Ji||e instanceof Ki)t.market=e.market,t.prediction=e.prediction.value;else if(e instanceof ta){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 Yi;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 Xi;return t.settledAt=e.settled_at,t.resettledAt=e.resettled_at,t.status=e.status,t.outcome=e.outcome,t.points=e.points,t}},zt=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}}},Te=zt;de(Te,"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(Te,"createDoubleChanceResult",e=>e?.ftScore?.homeGoals>e?.ftScore?.awayGoals?["1x","12"]:e?.ftScore?.homeGoals===e?.ftScore?.awayGoals?["1x","x2"]:["x2","12"]),de(Te,"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(Te,"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(Te,"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 zt.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])}),zt.transformPlayerMarketResult(r)}),de(Te,"transformPlayerMarketResult",e=>e.map(t=>({playerId:t.id,playerModel:t})));var Ct=class{footballHttps=null;idMapping=null;matchFacade=null;playerFacade=null;profileNamespace=null;constructor(e,t){this.footballHttps=new et(e),this.idMapping=t,this.matchFacade=new sa(e,this.footballHttps,t),this.playerFacade=new ia(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=vt(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=_r.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(fe.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 z,s[i][r]):s[i][a]}else if(fe.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 Si){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 Ri||e instanceof Ei){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 yt||i instanceof ut||i instanceof qe||i instanceof rs?(i.fixtures.forEach(s=>t.push(s.matchId)),i instanceof qe&&i.fixtures.forEach(s=>{s.prediction.playerId&&s.prediction.playerId!=="OWN_GOAL"&&a.push(s.prediction.playerId)})):i instanceof Wt&&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 yt||n instanceof ut||n instanceof qe?(n.fixtures.forEach(o=>{this.handleMatchModel(s,o),n instanceof qe&&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 Wt&&(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 Y(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 ut&&(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 Xi;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 Y(e));break;case"current":if(e)this.deleteUnexpectedProperties(e),e.status=["ACTIVE"],e=new Y(e);else{let i={status:["ACTIVE"]};e=new Y(i)}break;case"past":if(e)this.deleteUnexpectedProperties(e),e.status=Ba,e=new Y(e);else{let i={status:Ba};e=new Y(i)}break;case"matches":if(e)this.deleteUnexpectedProperties(e),e.matchIds=a,e=new Y(e);else{let i={matchIds:a};e=new Y(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=>fe.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[V[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[V[this.idMapping.idSchema]]})};deleteUnexpectedProperties=e=>(e.status&&(console.warn(Oa.UNEXPECTED_STATUS_PROP),delete e.status),e.type&&(console.warn(Oa.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 zc;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)),Te.createMatchMarketsResultsModel(t,i)}},_s=class{fixturesRemapper=null;footballHttps=null;matchFacade=null;playerFacade=null;predictorService=null;constructor(e,t){this.footballHttps=new et(e),this.matchFacade=new sa(e,this.footballHttps,t),this.playerFacade=new ia(e,this.footballHttps,t),this.predictorService=new Ct(e,t),this.fixturesRemapper=new np(this.matchFacade,this.playerFacade,this.predictorService)}remapRequestBody=e=>{if(e instanceof Li)return e;let t={};return t.game_instance_id=e.gameInstanceId,t.fixtures=e.fixtures.map(a=>this.fixturesRemapper.remapFixturesRequest(a)),e instanceof ns&&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 Ua,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 Yi;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 Ua;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 qc;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}},op=class{remapPredictions=null;constructor(e,t){this.remapPredictions=new _s(e,t)}remapResponse=e=>{let t=new jc;return t.matchId=e.match_id,t.matchType=e.match_type,t.predictions=this.remapPredictions.remapPredictionModel(e.predictions),t}},lp=class extends pe{remapPaginatedGames=e=>{let t=new se;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 yt;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 rs;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 nd;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 se;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 ut;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 ld;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 se;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 qe;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 Dl;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 se;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 Wt;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 Ll;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 dd;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 pd;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 Le;return e&&(t.type=e.type,t.subType=e.sub_type),t};remapMarketResult=(e,t)=>{if(or.includes(e))return t[0];if(fe.includes(e))return t;if(t[0]==="true")return!0;if(t[0]==="false")return!1};deleteUnusefulField=e=>((!fe.includes(e.market)||this.isPlayerMarketWithNoResult(e.market,e.result))&&delete e.playerModels,e);isPlayerMarketWithNoResult=(e,t)=>fe.includes(e)&&t.length===0;remapResults=e=>{let t=new cd;return t.matchId=e.match_id,t.outcome=e.outcome,t};remapTiebreaker=e=>{let t=new Et;return t.goldenGoal=e.golden_goal,t};remapTimeTiebreaker=e=>{let t=new Pt;return t.timeTiebreaker=e,t};remapRelated=e=>e.map(t=>{let a=new me;return a.entityId=t.entity_id,a.entityType=t.entity_type,a.entityRelationship=t.entity_relationship,a})},cp=class{remapMetaData=e=>{let t=new W;return t.pagination.nextPageStartsAfter=e.pagination.next_page_starts_after,t.pagination.itemsPerPage=e.pagination.items_per_page,t}},tt=class extends te{predictionRemapper=null;matchSummaryRemapper=null;gamesRemapper=null;metaRemapper=null;idMapping=null;constructor(e){super(e,X(e.environment,"predictor")),this.idMapping=new ae(e),this.predictionRemapper=new _s(e,this.idMapping),this.matchSummaryRemapper=new op(e,this.idMapping),this.gamesRemapper=new lp,this.metaRemapper=new cp}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 se,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 se,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 se,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)}},ra=class{errorHandlingMode=null;constructor(e){this.errorHandlingMode=e}validateBodyFields=(e,t)=>{let a=Object.keys(t),i=Object.keys(new Zi);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(hs),r=Object.values(gs),n=Object.values(ms);if(t==="FT_1X2"||t==="HT_1X2"){if(s.includes(a))return new Uc(e,t,a)}else if(t==="HT_FT"){if(r.includes(a))return new Gc(e,a)}else if(t==="DOUBLE_CHANCE"){if(n.includes(a))return new xc(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 ta(e,t,a)}else if(t==="CORNERS_MATCH"){if(typeof a=="number")return new kc(e,a)}else if(t==="BOTH_TEAMS_SCORE"){if(this.isPredictionBoolean(a))return new Fc(e,a)}else if(t==="RED_CARD_MATCH"){if(this.isPredictionBoolean(a))return new Vc(e,a)}else if(t==="PENALTY_MATCH"){if(this.isPredictionBoolean(a))return new Bc(e,a)}else if(fe.includes(t)){let o="OWN_GOAL";if(this.validatePlayerId(t,i),t===gt&&this.isPredictionBoolean(a)){let l=i&&i===o?o:i;return new ke(e,t,a,l)}if(i&&this.isPredictionBoolean(a))return new ke(e,t,a,i)}else if(rr.includes(t)){if(this.isPredictionBoolean(a))return new Ki(e,t,a)}else if(nr.includes(t)&&this.isPredictionBoolean(a))return new Ji(e,t,a);this.throwInvalidPredictionException(a,t)};validateFixtureFields=e=>{let t=Object.keys(e);t.forEach(i=>{Ma.includes(i)||this.throwInvalidParamException([i])});let a=Ma.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 Et)[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){fe.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!==gt&&(t||this.throwInvalidParamException([a]),typeof t!="string"&&this.throwInvalidType(a,"string"))};validateMarket=e=>{Object.values(It).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=Ir(e,t);throw this.errorHandlingMode==="default"?new x(400,"INVALID_PREDICTION",a):new k(400,"INVALID_TYPE",a)};throwInvalidMarketException=(e,t)=>{let a=null;throw t&&t==="TOP_X"?a=Tr(e):a=ii(e),this.errorHandlingMode==="default"?new x(400,"INVALID_MARKET",a):new k(400,"INVALID_TYPE",a)};throwInvalidParamException=e=>{let t=br(e);throw this.errorHandlingMode==="default"?new x(400,"INVALID_FIELD",t):new k(400,"INVALID_TYPE",t)};throwMissingFieldsException=(e,t)=>{let a=Pr(e,t);throw this.errorHandlingMode==="default"?new x(400,"INVALID_FIELD",a):new k(400,"INVALID_TYPE",a)};throwInvalidType=(e,t)=>{let a=Er(e,t);throw this.errorHandlingMode==="default"?new x(400,"INVALID_TYPE",a):new k(400,"INVALID_TYPE",a)}},na=class{predictorHttps=null;predictorService=null;idMapping=null;clientHttps=null;predictorValidator=null;errorHandlingMode=null;brandingResolver=null;infoPageContentResolver=null;constructor(e){this.predictorValidator=new ra(e.errorHandlingMode),this.idMapping=new ae(e),this.predictorHttps=new tt(e),this.predictorService=new Ct(e,this.idMapping),this.clientHttps=new ve(e),this.errorHandlingMode=e.errorHandlingMode,this.brandingResolver=new we(e),this.infoPageContentResolver=new _e(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 ke&&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 ke&&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 await this.infoPageContentResolver.resolveContentBatch([...s],t),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.infoPageContentResolver.resolveContent(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 Y(t)),await this.predictorHttps.getGamePredictions(e,a,t));getGameResults=async(e,t,a)=>{a=a||!1,t&&(t=new H(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 l=await this.infoPageContentResolver.resolveContentBatch([...l],t),o.data=l,await this.predictorService.addPredictionProp(s,o)}else return new se};getMyGamePrediction=async e=>{let t=new Y({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 c=await this.infoPageContentResolver.resolveContentBatch([...c],a),l.data=c,await this.predictorService.addPredictionProp(r,l)}else return new se};getUserGamePrediction=async(e,t,a)=>{a=a||!1;let i=new Y({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 k(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}},dp=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 Nl;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 Ul;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 Hl;return t.meta.pagination=this.remapMetaPagination(e.meta.pagination),t.data=e.data.map(a=>{let i=new Ga;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 Ga;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 Vl;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 nc;return a.questions=t.questions,a.correctAnswers=t.correct_answers,a});remapMetaPagination=e=>{let t=new Je;return t.itemsPerPage=e.items_per_page,t.nextPageStartsAfter=e.next_page_starts_after,t};remapClassicQuizLeaderboardMeta=e=>{let t=new zl;return t.pagination=this.remapMetaPaginationRank(e.pagination),t.filters=this.remapLeaderboardMetaFilters(e.filters),t};remapMetaPaginationRank=e=>{let t=new De;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 Bi;return t.classicQuizIds=e?.classic_quiz_ids||null,t};remapClassicQuizUserRanking=e=>{let t=new jl;return t.position=e.position,t.classicQuizId=e.classic_quiz_id,t.points=e.points,t};remapBasicClassicQuiz=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.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 Gl;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 $l;return t.optionId=e.option_id,t.option=e.option,t.images=e.images,t.correct=e.correct,t};remapParticipationQuestions=e=>{let t=new Bl;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 ql;return t.position=e.position,t.profileId=e.profile_id,t.points=e.points,t};remapContext=e=>{let t=new Zt;return t.content=e.content,t.tags=e.tags?e.tags.map(a=>{let i=new ea;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 me;return a.entityId=t.entity_id,a.entityType=t.entity_type,a.entityRelationship=t.entity_relationship,a})},pp=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 Yl;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 Jl;return t.eitherOrId=e.either_or_id,t.personalBest=e.personal_best,t.betterThan=e.better_than,t};remapEitherOrResults=e=>{let t=new sc;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 Kl;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 Vi;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 Je;return t.itemsPerPage=e.items_per_page,t.nextPageStartsAfter=e.next_page_starts_after,t};remapPoints=e=>{let t=new Xl;return t.correctSteps=e.correct_steps,t.score=e.score,t};remapResultsStandings=e=>{let t=new rc;return t.userId=e.user_id,t.personalBest=e.personal_best,t};remapResultsBreakdown=e=>{let t=new ic;return t.rangeStartInclusive=e.range_start_inclusive,t.rangeEndInclusive=e.range_end_inclusive,t.totalUsers=e.total_users,t};remapParticipationSteps=e=>{let t=new ac;return t.pairId=e.pair_id,t.userSelection=e.user_selection,t.correct=e.correct,t.played=e.played,t.timestamp=e.timestamp,t.expired=e.expired,t.optionOne=e.option_one,t.optionTwo=e.option_two,t};remapContext=e=>{let t=new Zt;return t.content=e.content,t.tags=e.tags?e.tags.map(a=>{let i=new ea;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 me;return a.entityId=t.entity_id,a.entityType=t.entity_type,a.entityRelationship=t.entity_relationship,a})},up=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 pc;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 hc;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 yc;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 mc;return a.questionId=t.question_id,a.optionId=t.option_id,a});remapParticipationPersonas=e=>e.map(t=>{let a=new gc;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 Je;return t.itemsPerPage=e.items_per_page,t.nextPageStartsAfter=e.next_page_starts_after,t};remapBasicPersonalityQuiz=e=>{let t=new Wi;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 oc;return t.personaId=e.persona_id,t.title=e.title,t.description=e.description,t.images=e.images,t};remapQuestions=e=>{let t=new lc;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 dc;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 ls;return a.preferenceId=t.preference_id,a});remapPersonaPoints=e=>e.map(t=>{let a=new cc;return a.personaId=t.persona_id,a.points=t.points,a});remapContext=e=>{let t=new Zt;return t.content=e.content,t.tags=e.tags?e.tags.map(a=>{let i=new ea;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 me;return a.entityId=t.entity_id,a.entityType=t.entity_type,a.entityRelationship=t.entity_relationship,a})},vs=class extends te{classicQuizRemapper=null;eitherOrRemapper=null;personalityQuizRemapper=null;constructor(e){super(e,X(e.environment,"miniGames")),this.classicQuizRemapper=new dp,this.eitherOrRemapper=new pp,this.personalityQuizRemapper=new up}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)}},oa=class extends Re{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"))}},hp=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 ae(e),this.validator=new oa(e),this.profile=new le(e),this.football=new Ne(e),this.https=new vs(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 ec;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))},mp=class{https=null;service=null;activityService=null;idSchema=null;brandingResolver=null;infoPageContentResolver=null;constructor(e){this.https=new vs(e),this.service=new hp(e),this.activityService=new Tt(e),this.idSchema=e.idSchema,this.brandingResolver=new we(e),this.infoPageContentResolver=new _e(e)}getClassicQuizzes=async(e,t,a)=>{e&&(e=new xl(e),await this.service.finalizeMiniGamesFilters(e));let i=await this.https.getClassicQuizzes(e,a),s=await this.brandingResolver.resolveBrandingBatch([...i.data],a);if(s=await this.infoPageContentResolver.resolveContentBatch([...s],a),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.infoPageContentResolver.resolveContent(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 Na(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 Na(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 Wl(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 Hi(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 Ql(e),await this.service.finalizeMiniGamesFilters(e));let i=await this.https.getEitherOrs(e,a),s=await this.brandingResolver.resolveBrandingBatch([...i.data],a);if(s=await this.infoPageContentResolver.resolveContentBatch([...s],a),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.infoPageContentResolver.resolveContent(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 uc(e),await this.service.finalizeMiniGamesFilters(e));let i=await this.https.getPersonalityQuizzes(e,a),s=await this.brandingResolver.resolveBrandingBatch([...i.data],a);if(s=await this.infoPageContentResolver.resolveContentBatch([...s],a),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.infoPageContentResolver.resolveContent(a,t),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 fc(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}}},la=class{facade=null;constructor(e){this.facade=new mp(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)},ca=class{idMapping=null;predictorHttps=null;predictorService=null;predictorValidator=null;brandingResolver=null;infoPageContentResolver=null;clientHttps=null;errorHandlingMode=null;constructor(e){this.idMapping=new ae(e),this.errorHandlingMode=e.errorHandlingMode,this.predictorValidator=new ra(e.errorHandlingMode),this.predictorHttps=new tt(e),this.predictorService=new Ct(e,this.idMapping),this.clientHttps=new ve(e),this.brandingResolver=new we(e),this.infoPageContentResolver=new _e(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 await this.infoPageContentResolver.resolveContentBatch([...s],t),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.infoPageContentResolver.resolveContent(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 Y(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 ns(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 l=await this.infoPageContentResolver.resolveContentBatch([...l],t),o.data=l,await this.predictorService.addPredictionProp(s,o)}else return new se};getMyGamePrediction=async e=>{let t=new Y({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 c=await this.infoPageContentResolver.resolveContentBatch([...c],a),l.data=c,await this.predictorService.addPredictionProp(r,l)}else return new se};getUserGamePrediction=async(e,t,a)=>{a=a||!1;let i=new Y({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 k(400,"EXCEEDED_LENGTH","Maximum limit for filtering games is 50 or less.")}},gp=class{idMappingService=null;profileNamespace=null;footballNamespace=null;topXFacade=null;matchQuizFacade=null;miniGamesNamespace=null;errorHandlingMode=null;constructor(e){this.idMappingService=new ae(e),this.profileNamespace=new le(e),this.footballNamespace=new Ne(e),this.topXFacade=new ca(e),this.matchQuizFacade=new na(e),this.miniGamesNamespace=new la(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 fl;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 yl;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 vl(e));break;case"rankings":e&&(e=new Il(e));break;case"league_leaderboard":e&&(e=new _l(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 k(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 k(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=Ae(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 k(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 k(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 je({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}},fp=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(It).includes(e)){let a=ii(e);throw t==="default"?new x(400,"INVALID_MARKET",a):new k(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 k(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 k(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 k(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 k(400,"invalid_filters",`You have provided invalid value. The valid value is between ${i} and ${s}`)}},yp=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}},wp=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;infoPageContentResolver=null;constructor(e,t,a,i,s){this.config=e,this.clientHttps=t,this.loyaltyHttps=a,this.profileFacade=new bt(s,i),this.loyaltyService=new gp(this.config),this.loyaltyValidator=new fp,this.topXFacade=new ca(e),this.matchQuizFacade=new na(e),this.predictorHttps=new tt(e),this.errorHandlingMode=e.errorHandlingMode,this.football=new Ne(e),this.brandingResolver=new we(e),this.infoPageContentResolver=new _e(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 Tl(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 i=await this.infoPageContentResolver.resolveContentBatch([...i],t),a.data=i,a};getTemplateById=async(e,t)=>{let a=await this.loyaltyHttps.getTemplateById(e,t),i=await this.brandingResolver.resolveBranding(a);if(await this.infoPageContentResolver.resolveContent(i,t),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 yp(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 wl(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}},da=class{clientHttps=null;profileHttps=null;loyaltyHttps=null;loyaltyFacade=null;localCache=null;constructor(e){this.clientHttps=new ve(e),this.profileHttps=new vi(e),this.loyaltyHttps=new St(e),this.localCache=new Xe().createLocalCacheInstance(e.idSchema),this.loyaltyFacade=new wp(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)},_p=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 ra(e.errorHandlingMode),this.predictorService=new Ct(e,i)}makeFootballPrediction=async(e,t,a,i)=>{let s=this.predictorValidator.validateFixture(e,t,a,i),r=new Zi;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 k(400,"INVALID_FIELD","Match id is invalid!");if(s instanceof ke&&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!==gt&&!s.prediction.playerId)throw new x(400,"INVALID_FIELD","Player id is invalid!").errorMessage();if(this.errorHandlingMode==="standard"&&s.market!==gt&&!s.prediction.playerId)throw new k(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 k(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 k(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))},vp=class extends Re{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")}},Ip=class{validator=null;constructor(e){this.validator=new vp(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)}},Is=class{predictorHttps=null;clientHttps=null;predictorFacade=null;idMapping=null;helpers=null;constructor(e){this.idMapping=new ae(e),this.predictorHttps=new tt(e),this.clientHttps=new ve(e),this.predictorFacade=new _p(e,this.predictorHttps,this.clientHttps,this.idMapping),this.helpers=new Ip(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)},Ts=class{loyalty=null;profile=null;predictor=null;constructor(e){this.loyalty=new da(e),this.profile=new le(e),this.predictor=new Is(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)},pa=class{idSchema=null;profile=null;validator=null;idMapping=null;constructor(e){this.idSchema=e.idSchema,this.profile=new le(e),this.validator=new oa(e),this.idMapping=new ae(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}},Tp=class{factory=null;https=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(e){this.factory=new ws,this.https=new ys(e),this.service=new Ts(e),this.loyaltyHttps=new St(e),this.profile=new le(e),this.discussionsService=new pa(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 vo(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 _o(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 as(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 is(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 k(400,"invalid_limit","Invalid limit. The maximum limit is: 20");t=new ss(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)},bp=class{facade=null;constructor(e){this.facade=new Tp(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)},Pp=class extends te{remapper=null;constructor(e){super(e,X(e.environment,"discussions")),this.remapper=new fs}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)}},Ep=class{createRequestBodyFromParam=e=>{let t=new Po;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}},Rp=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 Pp(e),this.clientHttps=new ve(e),this.activityService=new Tt(e),this.service=new pa(e),this.factory=new Ep}getAll=async(e,t)=>{e&&(e=new Do(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 nt(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 nt(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 nt(e)),await this.https.getOwnPosts(e));getUserPosts=async(e,t,a)=>(t&&(t=new nt(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 k(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 k(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 Lo(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 k(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 k(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}}},Sp=class{facade=null;constructor(e){this.facade=new Rp(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)},Cp=class extends Re{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}`)}}},Mp=class{https=null;validator=null;profile=null;brandingResolver=null;infoPageContentResolver=null;constructor(e){this.https=new Qt(e),this.profile=new le(e),this.validator=new Cp(e.errorHandlingMode),this.brandingResolver=new we(e),this.infoPageContentResolver=new _e(e)}getGames=async(e,t)=>{e&&(e=new xo(e));let a=await this.https.getEventGames(e,t),i=await this.brandingResolver.resolveBrandingBatch([...a.data],t);return i=await this.infoPageContentResolver.resolveContentBatch([...i],t),a.data=i,a};getGameById=async(e,t)=>{let a=await this.https.getEventGameById(e,t);return await this.brandingResolver.resolveBranding(a,t),await this.infoPageContentResolver.resolveContent(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 No(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 Go(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}},Op=class{facade=null;constructor(e){this.facade=new Mp(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)},Fp=Object.keys(new Jt),Ap=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"),Dt=class{static createFantasyPrediction(e,t,a,i){let s=new Li;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 Fp.map(t=>{let a=new Ho,i=e.data.reduce((s,r)=>s+r.stats[t],0);return a.key=t,a.label=Ap.get(t),a.value=i,a})}},kp=class{idMapping=null;idSchema=null;errorHandlingModel=null;football=null;constructor(e){this.idSchema=e.idSchema,this.errorHandlingModel=e.errorHandlingMode,this.football=new Ne(e),this.idMapping=new ae(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 k(e,t,a):new x(e,t,a)}},Dp=class{idSchema=null;clientHttps=null;footballHttps=null;predictorHttps=null;loyaltyHttps=null;service=null;constructor(e){this.idSchema=e.idSchema,this.clientHttps=new ve(e),this.footballHttps=new et(e),this.service=new kp(e),this.predictorHttps=new tt(e),this.loyaltyHttps=new St(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=Dt.createFantasyPrediction(e,t,r,i)}else s=Dt.createFantasyPrediction(e,t,a,i);return await this.predictorHttps.makeFootballPrediction(s)};getMyPrediction=async(e,t)=>{let a=`${e}_${t}`,i=new Y(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 Dt.createFantasyPlayerStats(i)};getGameWeekStatistics=async e=>await this.loyaltyHttps.getTemplateBreakdownPoints(e)},Lp=class{facade=null;constructor(e){this.facade=new Dp(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)},xp=class{configuration;constructor(e){this.configuration=e}getSDKConfiguration(){return this.configuration}},Np=class{remapToResponseModel=(e,t,a)=>{let i=new ml;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}},Gp=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 k(e,t,a):new x(e,t,a)}},$p=class{validator=null;idMappingFacade=null;factory=new Np;constructor(e){this.validator=new Gp(e),this.idMappingFacade=new oi(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)}},Up=class{facade=null;constructor(e){this.facade=new $p(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)},Bp=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}},bs=class{matchQuizFacade=null;helpers=new Bp;constructor(e){this.matchQuizFacade=new na(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)},Hp=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}},Ps=class{topXFacade=null;helpers=new Hp;constructor(e){this.topXFacade=new ca(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)},Vp=class{remapUserVotes=e=>{let t=new _d;return t.meta=this.remapMeta(e.meta.pagination),t.data=e.data.map(a=>this.remapUserVoteModel(a)),t};remapResults=e=>{let t=new Td;return t.meta=e.meta,t.data=e.data.map(a=>this.remapResultsModel(a)),t};remapMeta=e=>{let t=new W;return t.pagination.itemsPerPage=e.items_per_page,t.pagination.nextPageStartsAfter=e.next_page_starts_after,t};remapUserVoteModel=e=>{let t=new vd;return t.matchId=e.match_id,t.playerId=e.player_id,t.createdAt=e.created_at,t};remapResultsModel=e=>{let t=new bd;return t.teamId=e.team_id,t.playerId=e.player_id,t.votes=e.votes,t.winner=e.winner,t}},Wp=class{id=null;pollId=null;optionIds=[];optionsModels=[];userId=null;createdAt=null},zp=class extends pe{remapPolls=e=>{let t=new fd;return t.meta.pagination=this.remapMetaPagination(e.meta.pagination),t.data=e.data.map(a=>this.remapPoll(a)),t};remapPollById=e=>{let t=new ud;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 gd;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 Wp;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 yd;return t.meta.pagination=this.remapMetaPagination(e.meta.pagination),t.data=e.data.map(a=>this.remapAllPollsVotes(a)),t};remapAllPollsVotes=e=>{let t=new aa;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 md;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 Je;return t.itemsPerPage=e.items_per_page,t.nextPageStartsAfter=e.next_page_starts_after,t};remapPoll=e=>{let t=new os;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 jt;return t.content=e.content,t.tags=e.tags?e.tags.map(a=>{let i=new po;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 me;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 hd;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 ls;return a.preferenceId=t.preference_id,a})},qp=class extends te{pollRemapper=null;playerOfTheMatchRemapper=null;constructor(e){super(e,X(e.environment,"voting")),this.pollRemapper=new zp,this.playerOfTheMatchRemapper=new Vp}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)}},jp=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 ae(e),this.validator=new oa(e),this.activityService=new Tt(e),this.football=new Ne(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 k(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 k(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})}}},Qp=class{https=null;service=null;idSchema=null;brandingResolver=null;infoPageContentResolver=null;constructor(e){this.idSchema=e.idSchema,this.https=new qp(e),this.service=new jp(e),this.brandingResolver=new we(e),this.infoPageContentResolver=new _e(e)}getPolls=async(e,t)=>{e&&(e=new kt(e),await this.service.finalizePollsFilters(e));let a=await this.https.getPolls(e,t),i=await this.brandingResolver.resolveBrandingBatch([...a.data],t);await this.infoPageContentResolver.resolveContentBatch([...i],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);return await this.brandingResolver.resolveBranding(a,t),await this.infoPageContentResolver.resolveContent(a,t),await this.service.remapTags(a,"native",this.idSchema),a};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 kt({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 H(e));let t=await this.https.getMyPollsVotes(e),a=t.data.map(s=>s.id),i=await this.getPolls(new kt({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 wd(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}},Es=class{facade=null;constructor(e){this.facade=new Qp(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)},Yp=class{clientHttps=null;topX=null;matchQuiz=null;loyalty=null;miniGames=null;voting=null;constructor(e){this.clientHttps=new ve(e),this.topX=new Ps(e),this.matchQuiz=new bs(e),this.loyalty=new da(e),this.miniGames=new la(e),this.voting=new Es(e)}getListContent=async(e,t,a)=>{t&&(t=new gl(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})}},Xp=class{facade=null;constructor(e){this.facade=new Yp(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 Mc;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 wc;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 Pc;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 Ic;return a.url=t.url,a.appType=t.app_type,a})}remapBranding(e){let t=new _c;return t.backgroundColor=e.background_color,t.textColor=e.text_color,t}remapAssets(e){return e.map(t=>{let a=new vc;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 Sc;return t.id=e.id,t.name=e.name,t.code=e.code,t.entityType=e.entity_type,t};remapMarketScope=e=>{let t=new Ec;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 Rc;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 Cc;return t.selectionId=e.selection_id,t.eventId=e.event_id,t.marketId=e.market_id,t.competitionId=e.competition_id,t}},Kp=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}},Zp=class{https;idSchema;oddClient;idMapping=null;validator;constructor(e){this.idSchema=e.idSchema,this.oddClient=e.oddClient,this.https=new Kp(e),this.validator=new Re(e.errorHandlingMode),this.idMapping=new ae(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 bc(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")}},eu=class{facade;constructor(e){this.facade=new Zp(e)}getByMatchIds=async(e,t)=>await this.facade.getByMatchIds(e,t)},tu=class{factory=null;privateLeagueHttps=null;loyaltyHttps=null;profile=null;service=null;discussionsService=null;constructor(e){this.factory=new ws,this.privateLeagueHttps=new ys(e),this.loyaltyHttps=new St(e),this.profile=new le(e),this.service=new Ts(e),this.discussionsService=new pa(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 Jc(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 Kc(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 as(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 is(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 k(400,"invalid_limit","Invalid limit. The maximum limit is: 20");t=new ss(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)},au=class{privateLeaguesFacade=null;constructor(e){this.privateLeaguesFacade=new tu(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)},iu=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}`)}},su=class extends Re{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")}},ru=class{https=null;profile=null;validator=null;brandingResolver=null;infoPageContentResolver=null;constructor(e){this.https=new Qt(e),this.profile=new le(e),this.validator=new su(e.errorHandlingMode),this.brandingResolver=new we(e),this.infoPageContentResolver=new _e(e)}getGames=async(e,t)=>{e&&(e=new sd(e));let a=await this.https.getStandingsGames(e,t),i=await this.brandingResolver.resolveBrandingBatch([...a.data],t);return i=await this.infoPageContentResolver.resolveContentBatch([...i],t),a.data=i,a};getGameById=async(e,t)=>{let a=await this.https.getStandingGameById(e,t);return await this.brandingResolver.resolveBranding(a,t),await this.infoPageContentResolver.resolveContent(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 rd(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}},nu=class{facade=null;constructor(e){this.facade=new ru(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 ou(){let e=qs(),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 ht=null,mt=null;function lu(e){if(cu(e)){let t=du(e);if(t.isValid)return ht={profile:new le(e),football:new Ne(e),predictor:new Is(e),loyalty:new da(e),topX:new Ps(e),matchQuiz:new bs(e),activity:new Dr(e),miniGames:new la(e),discussions:new Sp(e),privateLeagues:new au(e),challenges:new bp(e),progress:new iu,voting:new Es(e),fantasy:new Lp(e),helpers:new xp(e),idMapping:new Up(e),bracketGame:new Kd(e),lists:new Xp(e),standingGame:new nu(e),eventGame:new Op(e),odds:new eu(e),getVersion:ou},mt={...e},ht;pu(t)}return ht}var cu=e=>!ht||JSON.stringify(e)!==JSON.stringify(mt)||e.authProvider?.getIdToken()!==mt.authProvider?.getIdToken()||Ut(e.cookieToken)!==Ut(mt?.cookieToken),du=e=>{let t=new sr().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},pu=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 $t).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 ua(){const e=qt();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 lu(i)}catch(i){return console.error("Failed to initialize FansUnited SDK:",i),null}},[e.sdk])}const ha=h.createContext(null);function uu(){const e=h.useContext(ha);if(!e)throw new Error("useCompetition must be used within CompetitionProvider");return e}function hu(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 mu(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 Lt(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,T=parseInt(v?_.score?.competitorOne??"0":_.score?.competitorTwo??"0"),I=parseInt(v?_.score?.competitorTwo??"0":_.score?.competitorOne??"0");d++,T>I?(p++,c+=3):T===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 lt(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 ct(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 xt=(e,t)=>e.competitorOne.id===t,Nt=(e,t)=>e.competitorTwo.id===t;function gu(e,t,a){const i=h.useMemo(()=>e.filter(I=>I.status.type==="FINISHED").sort((I,O)=>O.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)=>Lt(i,s,r,I),[i,s,r]),o=h.useMemo(()=>(I=8)=>Lt(i,s,r,I,xt),[i,s,r]),l=h.useMemo(()=>(I=8)=>Lt(i,s,r,I,Nt),[i,s,r]),c=h.useMemo(()=>()=>lt(i,s,r),[i,s,r]),d=h.useMemo(()=>(I=8)=>lt(i,s,r,I),[i,s,r]),p=h.useMemo(()=>()=>lt(i,s,r,void 0,xt),[i,s,r]),m=h.useMemo(()=>()=>lt(i,s,r,void 0,Nt),[i,s,r]),u=h.useMemo(()=>()=>ct(i,s,r),[i,s,r]),_=h.useMemo(()=>(I=8)=>ct(i,s,r,I),[i,s,r]),v=h.useMemo(()=>()=>ct(i,s,r,void 0,xt),[i,s,r]),T=h.useMemo(()=>()=>ct(i,s,r,void 0,Nt),[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:T}),[n,o,l,c,d,p,m,u,_,v,T])}function fu(e){return e==="GOAL"||e==="PENALTY_GOAL"||e==="OWN_GOAL"}function Ha(e,t=15){const a=l=>Math.round(l*10)/10,i=[];e.forEach(l=>{l.status.type==="FINISHED"&&l.mainEvents?.forEach(c=>{fu(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 yu(e){const t=h.useMemo(()=>e.filter(s=>s.status.type==="FINISHED"),[e]),a=h.useMemo(()=>Ha(t,15),[t]),i=h.useMemo(()=>(s=15)=>Ha(t,s),[t]);return h.useMemo(()=>({goalDistribution:a,getGoalDistribution:i}),[a,i])}function Va(e){if(!e)return 0;const t=parseInt(e,10);return isNaN(t)?0:t}function wu(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 _u(e){const t=e.length,a=e.filter(O=>O.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,T=0;a.forEach(O=>{const C=Va(O.score?.competitorOne),G=Va(O.score?.competitorTwo),A=C+G;C>G?s++:G>C?r++:n++,o+=A,l+=C,c+=G,A>1.5&&d++,A>2.5&&p++,A>3.5&&m++,C>0&&G>0&&u++;const g=wu(O);g==="HOME"?_++:g==="AWAY"?v++:T++});const I=O=>Math.round(O*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:T,homeTeamScoredFirstPercentage:i>0?I(_/i*100):0,awayTeamScoredFirstPercentage:i>0?I(v/i*100):0,noGoalScoredPercentage:i>0?I(T/i*100):0}}function vu(e){return h.useMemo(()=>_u(e),[e])}function Iu(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"),T=parseInt(u.score?.competitorTwo??"0"),I=_?v:T,O=_?T:v;let C;I>O?C="W":I===O?C="D":C="L";const G={result:C,score:`${v} - ${T}`,date:u.timing.kickoffTime,matchId:u.id,isUpcoming:!1};_?p=G:m=G}),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 Tu(e){return{getTeamPosition:h.useCallback(a=>e.entries.find(s=>s.competitor.id===a)?.rank,[e])}}function bu({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=wt(),[u,_]=h.useState(i),[v,T]=h.useState(s),[I,O]=h.useState(r??[]),[C,G]=h.useState(n??{entries:[],metadata:{legend:[]}}),[A,g]=h.useState(!1),[f,y]=h.useState(void 0);h.useEffect(()=>{if(u&&v)return;(async()=>{try{const F=t??v?.id,[N,ne]=await Promise.all([u?Promise.resolve(u):B.getFootballCompetition(e,void 0,m),v?Promise.resolve(v):F?B.getFootballSeasonDetails({seasonId:F},m):B.getFootballSeasonDetails({competitionId:e,status:"CURRENT"},m)]);u||_(N),v||T(ne)}catch(F){console.error("[CompetitionProvider] Error fetching initial data:",F)}})()},[e,t,m]);const b=h.useCallback(async()=>{const R=t??v?.id;if(R){g(!0);try{const F=a??v?.stages?.find(Ie=>Ie.status==="ACTIVE")?.id,[N,ne]=await Promise.all([B.getFootballMatches({tournamentIds:[e],seasonIds:[R],stageIds:F?[F]:void 0,limit:552,offset:0},m),F?B.getFootballStandings({stageId:F,expand:["rules","form.events"]},m):Promise.resolve({entries:[],metadata:{legend:[]}})]);O(N),G(ne),y(new Date)}catch(F){console.error("[CompetitionProvider] Error refreshing matches/standings:",F)}finally{g(!1)}}},[e,t,a,v?.id,v?.stages,m]);h.useEffect(()=>{if(!c||!I.some(N=>N.status.code==="live"))return;const F=setInterval(()=>{b()},d);return()=>clearInterval(F)},[c,d,I,b]);const M=hu(I),P=mu(C),D=gu(I,C,P.getTeamStanding),{goalDistribution:U,getGoalDistribution:j}=yu(I),q=vu(I),{getTeamResultsTable:re}=Iu(I,C),{getTeamPosition:ie}=Tu(C),J=h.useCallback(R=>P.getTeamStanding(R)?.form,[P]),K=h.useCallback(R=>o?.find(F=>F.id===R)?.matches,[o]),Z=h.useCallback(R=>o?.find(F=>F.id===R)?.standings,[o]),w=h.useMemo(()=>({competitionId:e,seasonId:t,stageId:a,competition:u,season:v,isRefreshing:A,lastRefreshed:f,matches:I,standings:C,previousSeasons:o,config:l,refresh:b,...M,...P,getTeamForm:J,getTeamPosition:ie,...D,goalDistribution:U,getGoalDistribution:j,competitionStats:q,getSeasonMatches:K,getSeasonStandings:Z,getTeamResultsTable:re}),[e,t,a,u,v,A,f,I,C,o,l,b,M,P,J,ie,D,U,j,q,K,Z,re]);return Qe.jsx(ha.Provider,{value:w,children:p})}const ma=h.createContext(null);function Pu(){const e=h.useContext(ma);if(!e)throw new Error("useTeam must be used within TeamProvider");return e}function Eu(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 Ru(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 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 ue(e,t){if(t===0)return 0;const a=(e-t)/t*100;return Math.round(a*10)/10}function Su(e,t){const a=h.useCallback((i=8)=>{if(!e)return null;const s=t.filter(T=>T.status.type==="FINISHED").filter(T=>T.competitorOne.id===e||T.competitorTwo.id===e).sort((T,I)=>I.timing.kickoffTime.getTime()-T.timing.kickoffTime.getTime());if(s.length===0)return null;const r=Me(e,s),n=s.slice(0,i),o=Me(e,n),l=s.filter(T=>T.competitorOne.id===e),c=Me(e,l),d=l.slice(0,i),p=Me(e,d),m=s.filter(T=>T.competitorTwo.id===e),u=Me(e,m),_=m.slice(0,i),v=Me(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 Cu({teamId:e,team:t,squad:a,matches:i=[],config:s,autoRefresh:r=!1,refreshInterval:n=6e4,children:o}){const l=wt(),[c,d]=h.useState(t),[p,m]=h.useState(a??null),[u]=h.useState(i),[_,v]=h.useState(!1),[T,I]=h.useState(void 0);h.useEffect(()=>{if(c&&p)return;(async()=>{try{const[b,M]=await Promise.all([c?Promise.resolve(c):B.getFootballTeam(e,void 0,l),p?Promise.resolve(p):B.getFootballTeamSquad(e,void 0,l)]);c||d(b),p||m(M)}catch(b){console.error("Failed to fetch initial team data:",b)}})()},[l]);const O=h.useCallback(async()=>{v(!0);try{const[y,b]=await Promise.all([B.getFootballTeam(e,void 0,l),B.getFootballTeamSquad(e,void 0,l)]);d(y),m(b),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(O,n);return()=>clearInterval(y)},[r,n,O]);const C=Eu(p),G=c?.id??e,A=Ru(G,u),{getFormStats:g}=Su(G,u),f=h.useMemo(()=>({teamId:e,team:c,isRefreshing:_,lastRefreshed:T,squad:p,matches:u,config:s,refresh:O,getFormStats:g,...C,...A}),[e,c,_,T,p,u,s,O,g,C,A]);return Qe.jsx(ma.Provider,{value:f,children:o})}const ga=h.createContext(null);function Mu(){const e=h.useContext(ga);if(!e)throw new Error("useMatch must be used within MatchProvider");return e}function Ou(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 Fu(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 Au(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 ku(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 Du(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 Lu(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 xu(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 Nu(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 Oe(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 Gu(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=Oe(n,d),m=d.slice(0,l),u=Oe(n,m),_=d.filter(f=>f.competitorOne.id===n),v=Oe(n,_),T=_.slice(0,l),I=Oe(n,T),O=d.filter(f=>f.competitorTwo.id===n),C=Oe(n,O),G=O.slice(0,l),A=Oe(n,G),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:C.pointsPerGame,goalsForPerGame:C.goalsForPerGame,goalsAgainstPerGame:C.goalsAgainstPerGame,pointsPerGameForm:A.pointsPerGame,goalsForPerGameForm:A.goalsForPerGame,goalsAgainstPerGameForm:A.goalsAgainstPerGame,pointsPerGameDiffPercent:he(A.pointsPerGame,C.pointsPerGame),goalsForPerGameDiffPercent:he(A.goalsForPerGame,C.goalsForPerGame),goalsAgainstPerGameDiffPercent:he(A.goalsAgainstPerGame,C.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 $u(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 Gt(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),T=parseInt(_?u.score?.competitorTwo||"0":u.score?.competitorOne||"0",10);return v>T?m+3:v===T?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 dt(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 pt(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 Uu(e,t){const a=h.useMemo(()=>(u=8)=>!e||!t||t.length===0?null:Gt(e,t,u),[e,t]),i=h.useMemo(()=>(u=8)=>!e||!t||t.length===0?null:Gt(e,t,u,"HOME"),[e,t]),s=h.useMemo(()=>(u=8)=>!e||!t||t.length===0?null:Gt(e,t,u,"AWAY"),[e,t]),r=h.useMemo(()=>()=>!e||!t||t.length===0?null:dt(e,t),[e,t]),n=h.useMemo(()=>(u=8)=>!e||!t||t.length===0?null:dt(e,t,u),[e,t]),o=h.useMemo(()=>()=>!e||!t||t.length===0?null:dt(e,t,void 0,"HOME"),[e,t]),l=h.useMemo(()=>()=>!e||!t||t.length===0?null:dt(e,t,void 0,"AWAY"),[e,t]),c=h.useMemo(()=>()=>!e||!t||t.length===0?null:pt(e,t),[e,t]),d=h.useMemo(()=>(u=8)=>!e||!t||t.length===0?null:pt(e,t,u),[e,t]),p=h.useMemo(()=>()=>!e||!t||t.length===0?null:pt(e,t,void 0,"HOME"),[e,t]),m=h.useMemo(()=>()=>!e||!t||t.length===0?null:pt(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 Bu({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 _=wt(),[v,T]=h.useState(t),[I]=h.useState(a),[O,C]=h.useState(i),[G]=h.useState(s),[A,g]=h.useState(r),[f,y]=h.useState(n),[b]=h.useState(l),[M,P]=h.useState(!1),[D,U]=h.useState(void 0);h.useEffect(()=>{if(v)return;(async()=>{try{const ee=await B.getFootballMatch(e,{optionalData:["MAIN_EVENTS","LINEUP_STATUS"]},_);T(ee)}catch(ee){console.error("[MatchProvider] Error fetching initial data:",ee)}})()},[_]);const j=h.useCallback(async()=>{P(!0);try{const[$,ee,Ce,Ge]=await Promise.all([B.getFootballMatch(e,{optionalData:["MAIN_EVENTS","LINEUP_STATUS"]},_),B.getFootballMatchEvents(e,void 0,_).catch(()=>[]),B.getFootballMatchStatistics(e,void 0,_).catch(()=>{}),B.getFootballMatchCommentary(e,void 0,_).catch(()=>[])]);T($),y(ee),C(Ce),g(Ge),U(new Date)}catch($){console.error("[MatchProvider] Error refreshing match data:",$)}finally{P(!1)}},[e,_]);h.useEffect(()=>{if(!p||!v)return;const $=v.status?.type||"",ee=v.status?.code||"";if(!($==="LIVE"||ee==="live"))return;const Ge=setInterval(()=>{j()},m);return()=>clearInterval(Ge)},[p,m,v,j]);const q=Ou(v),re=Fu(v),ie=Au(v),J=ku(v,f),K=Du(v,I),Z=Lu(v,O),w=xu(G),R=Nu(v,o),F=Gu(v,c),N=$u(b),ne=Uu(b,c),Ie=h.useMemo(()=>({matchId:e,match:v,lineups:I,statistics:O,odds:G,commentary:A,events:f,headToHeadMatches:o,standings:b,contextMatches:c,isRefreshing:M,lastRefreshed:D,config:d,refresh:j,...q,...re,...ie,...J,...K,...Z,...w,...R,...F,...N,...ne}),[e,v,I,O,G,A,f,o,b,c,M,D,d,j,q,re,ie,J,K,Z,w,R,F,N,ne]);return Qe.jsx(ga.Provider,{value:Ie,children:u})}const fa=h.createContext(null);function Hu(){const e=h.useContext(fa);if(!e)throw new Error("useLeaderboard must be used within LeaderboardProvider");return e}function Vu(e){const t=h.useCallback(n=>e.find(o=>o.id===n),[e]),a=h.useCallback(n=>e.filter(o=>o.competitorOne.id===n||o.competitorTwo.id===n),[e]),i=h.useCallback(()=>e.filter(n=>n.status.code==="live"),[e]),s=h.useCallback(()=>{const n=new Date;return e.filter(o=>o.status.code==="not_started"&&o.timing.kickoffTime>n).sort((o,l)=>o.timing.kickoffTime.getTime()-l.timing.kickoffTime.getTime())},[e]),r=h.useCallback(()=>e.filter(n=>n.status.type==="FINISHED").sort((n,o)=>o.timing.kickoffTime.getTime()-n.timing.kickoffTime.getTime()),[e]);return h.useMemo(()=>({getMatchById:t,getTeamMatches:a,getLiveMatches:i,getUpcomingMatches:s,getFinishedMatches:r}),[t,a,i,s,r])}function Wu(e,t){const a=h.useCallback(r=>e.find(o=>o.groupId===r)?.filters?.matchIds||[],[e]),i=h.useCallback(()=>{const r=new Set;for(const n of e){const o=n?.filters?.matchIds||[];for(const l of o)r.add(l)}return Array.from(r)},[e]),s=h.useCallback(r=>{const n=a(r);return t.filter(o=>n.includes(o.id))},[a,t]);return h.useMemo(()=>({getGroupMatchIds:a,getAllMatchIds:i,getGroupMatches:s}),[a,i,s])}function zu({leaderboardId:e,template:t,matches:a,config:i,autoRefresh:s=!0,refreshInterval:r=3e4,children:n}){const o=ua(),[l,c]=h.useState(t),[d,p]=h.useState(a??[]),[m,u]=h.useState(!1),[_,v]=h.useState(void 0);h.useEffect(()=>{if(l||!o)return;(async()=>{try{const g=await B.getLeaderboardTemplate(o,e);c(g)}catch(g){console.error("[LeaderboardProvider] Error fetching initial template:",g)}})()},[e,o]);const T=h.useCallback(async()=>{if(o){u(!0);try{const A=await B.getLeaderboardMatches(o,e);p(A),v(new Date)}catch(A){console.error("[LeaderboardProvider] Error refreshing matches:",A)}finally{u(!1)}}},[e,o]);h.useEffect(()=>{if(!s||!d.some(f=>f.status.code==="live"))return;const g=setInterval(()=>{T()},r);return()=>clearInterval(g)},[s,r,d,T]);const I=h.useMemo(()=>l?.groups||[],[l?.groups]),O=Vu(d),C=Wu(I,d),G=h.useMemo(()=>({leaderboardId:e,template:l,isRefreshing:m,lastRefreshed:_,matches:d,groups:I,config:i,refresh:T,...C,...O}),[e,l,m,_,d,I,i,T,C,O]);return Qe.jsx(fa.Provider,{value:G,children:n})}const Rs=3e4;function qu({matchIds:e,markets:t=["1x2"],operatorId:a,oddType:i="ALL",isLive:s=!1,pollingIntervalMs:r=Rs}){const n=ua(),[o,l]=h.useState(new Map),[c,d]=h.useState(!0),[p,m]=h.useState(null),u=h.useRef(!0),_=h.useMemo(()=>e.join(","),[e]),v=h.useMemo(()=>t.join(","),[t]),T=h.useCallback(async(O=!1)=>{if(!n||e.length===0){d(!1);return}try{O||d(!0),m(null);const C=await B.getBatchMatchOdds(n,e,{marketTypes:t,bookmakerIds:a?[a]:void 0,oddType:i});l(C)}catch(C){console.error("Error fetching batch odds:",C),m(C instanceof Error?C:new Error("Failed to fetch odds"))}finally{d(!1),u.current=!1}},[n,_,v,a,i]);h.useEffect(()=>{u.current=!0,T(!1)},[T]),h.useEffect(()=>{if(!s||e.length===0)return;const O=setInterval(()=>{T(!0)},r);return()=>{clearInterval(O)}},[s,e.length,r,T]);const I=h.useCallback(()=>{T(!0)},[T]);return{oddsMap:o,loading:c,error:p,refetch:I}}exports.getBatchMatchOdds=B.getBatchMatchOdds;exports.getLeaderboardMatches=B.getLeaderboardMatches;exports.getLeaderboardTeamMatches=B.getLeaderboardTeamMatches;exports.getLeaderboardTemplate=B.getLeaderboardTemplate;exports.CompetitionContext=ha;exports.CompetitionProvider=bu;exports.DEFAULT_ODDS_POLLING_INTERVAL_MS=Rs;exports.FansUnitedConfigProvider=Os;exports.LeaderboardContext=fa;exports.LeaderboardProvider=zu;exports.MatchContext=ga;exports.MatchProvider=Bu;exports.TeamContext=ma;exports.TeamProvider=Cu;exports.useBatchMatchOdds=qu;exports.useCompetition=uu;exports.useDataLayerConfig=wt;exports.useFansUnitedConfig=qt;exports.useFansUnitedSDK=ua;exports.useLeaderboard=Hu;exports.useMatch=Mu;exports.useTeam=Pu;
|